akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;
import java.util.TreeMap;
import java.util.TreeSet;

public class Main {
    static final long MOD = 1000000007;

    public static void main(String[] args) {
        final Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = scanner.nextInt();
        }
        int cnt = 0;
        for (int i = 1; i <= n; i++) {
            if (a[i-1] != i) {
                cnt++;
            }
        }

        if ((cnt == 2) || (cnt == 0)) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
}


Measured memory_bytes: 23508
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
const int INF = 1e9, MOD = 1e9 + 7, ohara = 1e6 + 10;
const ll LINF = 1e18;
using namespace std;

#define rep(i, n) for (int(i) = 0; (i) < (int)(n); (i)++)
#define rrep(i, a, b) for (int i = (a); i < (b); i++)
#define rrrep(i, a, b) for (int i = (a); i >= (b); i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout << (x) << endl

ll n, cnt, ans, a[ohara], b, c, d, tmp, tmpp, m, h, w, x, y, sum, pos, k;
ld doua;
int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
//int dy[]={-1,0,1,-1,1,-1,0,1};
//int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"), s;
bool fl;
struct edge
{
    int to, cost;
};

//-------------------------↓↓↓↓↓↓------------------------

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    cin >> n;
    rep(i, n) cin >> a[i];
    ll le = 0;
    ll add = 0;
    rep(ri, n)
    {
        x ^= a[ri];
        sum += a[ri];
        if (x == sum)
        {
            add++;
            ans+=add;
            //cout << "ri " << ri << " le " << le << "\n";
            //cout<<"ri "<<ri<<"\n";
        }
        else
        {
            //ans += (add + 1) * add / 2;
            while (1)
            {
                //cout<<"le "<<le<<" x "<<x<<" sum "<<sum<<"\n";
                x ^= a[le];
                sum -= a[le];
                le++;
                add--;
                if (x == sum)
                    break;
            }
            add++;
            ans += add;
            //cout << "ri " << ri << " le " << le << "\n";
            //cout<<"le "<<le<<"\n";
        }
        //Cout(ans);
    }
    //ans += (add + 1) * add / 2;
    Cout(ans);
    return 0;
}


Measured memory_bytes: 1792
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    long ans = 0;
    HashMap<Long, Long> map = new HashMap<Long, Long>();
    for(int i = 0; i < n; i++) {
      long a = sc.nextLong();
      ans += a;
      if(map.containsKey(a)) {
        map.put(a, map.get(a) + 1);
      } else {
        map.put(a, (long)1);
      }
    }
    int q = sc.nextInt();
    for(int i = 0; i < q; i++) {
      long b = sc.nextLong();
      long c = sc.nextLong();
      if(map.containsKey(b)) {
        long g = map.get(b);
        ans += (g * (c - b));
        map.put(b, (long)0);
        if(map.containsKey(c)) {
          map.put(c, map.get(c) + g);
        } else {
          map.put(c, g);
        }
      } else {

      }
      System.out.println(ans);
    }
  }
}

Measured memory_bytes: 67100
#include <bits/stdc++.h>

using namespace std;

int main(){
    string s;
    while(cin>>s){
        for(int i = 0;i < s.size();i++){
            if(s[i] == ',') printf(" ");
            else cout<<s[i];
        }
        puts("");
    }
    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
using ll =long long;
#define all(v) v.begin(),v.end()
 
int main() {
  ll a,b,c;
  cin>>a>>b>>c;
  if((a*100+b*10+c)%4==0) {
    cout<<"YES"<<endl;
  }
  else {
    cout<<"NO"<<endl;
  }
}


Measured memory_bytes: 3536
package main

import (
	"bufio"
	"container/heap"
	"fmt"
	"os"
	"strconv"
)

// I/O
type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &Scanner{sc}
}

func (s *Scanner) nextStr() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *Scanner) nextInt() int {
	i, e := strconv.Atoi(s.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) nextFloat() float64 {
	f, e := strconv.ParseFloat(s.nextStr(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *Scanner) nextRuneSlice() []rune {
	return []rune(s.nextStr())
}

func (s *Scanner) nextIntSlice(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextInt()
	}
	return res
}

func (s *Scanner) nextFloatSlice(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextFloat()
	}
	return res
}

// Arithmetic
func max(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m < i {
			m = i
		}
	}
	return m
}

func min(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m > i {
			m = i
		}
	}
	return m
}

func abs(x int) int {
	if x > 0 {
		return x
	}
	return -x
}

func pow(x, y int) int {
	res := 1
	for i := 0; i < y; i++ {
		res *= x
	}
	return res
}

func ceil(a, b int) int {
	if a%b == 0 {
		return a / b
	} else {
		return a/b + 1
	}
}

// Sort
type RuneSlice []rune

func (a RuneSlice) Len() int           { return len(a) }
func (a RuneSlice) Less(i, j int) bool { return a[i] < a[j] }
func (a RuneSlice) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }

// Main
const INF = 1 << 60

type Edge struct {
	to, cost int
}

type Node struct {
	id, cost int
}

type PQ []Node

func (pq PQ) Len() int           { return len(pq) }
func (pq PQ) Less(i, j int) bool { return pq[i].cost < pq[j].cost }
func (pq PQ) Swap(i, j int)      { pq[i], pq[j] = pq[j], pq[i] }

func (pq *PQ) Push(x interface{}) {
	*pq = append(*pq, x.(Node))
}

func (pq *PQ) Pop() interface{} {
	old := *pq
	n := len(old)
	x := old[n-1]
	*pq = old[0 : n-1]
	return x
}

func main() {
	sc := NewScanner()
	wtr := bufio.NewWriter(os.Stdout)
	N := sc.nextInt()
	E := make([][]Edge, N)
	for i := 0; i < N; i++ {
		id, k := sc.nextInt(), sc.nextInt()
		E[id] = make([]Edge, k)
		for j := 0; j < k; j++ {
			to, cost := sc.nextInt(), sc.nextInt()
			E[id][j] = Edge{to, cost}
		}
	}

	d := make([]int, N)
	for i := 0; i < N; i++ {
		d[i] = INF
	}
	done := make([]bool, N)
	pq := &PQ{}
	heap.Init(pq)
	d[0] = 0
	heap.Push(pq, Node{0, 0})
	for pq.Len() > 0 {
		cur := heap.Pop(pq).(Node).id
		if done[cur] {
			continue
		}
		done[cur] = true
		for i := 0; i < len(E[cur]); i++ {
			to, cost := E[cur][i].to, E[cur][i].cost+d[cur]
			if !done[to] && cost < d[to] {
				d[to] = cost
				heap.Push(pq, Node{to, cost})
			}
		}
	}

	for i := 0; i < N; i++ {
		fmt.Fprintln(wtr, i, d[i])
	}
	wtr.Flush()
}



Measured memory_bytes: 11100
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math

mod = 10**9+7


X = int(input())
position = 0
cnt = 0
for i in range(1,mod):
    cnt += 1
    position += i
    if position >= abs(X):
        break

print(cnt)


Measured memory_bytes: 5460
#include <bits/stdc++.h>
using namespace std;

int main() {
    string s;
    cin >> s;
    int ans = 101;
    for (char c = 'a'; c <= 'z'; c++) {
        int right = 0, max_d = 0;
        for (int i = 0; i < s.size(); i++) {
            if (c == s[i]) {
                max_d = max(max_d, i - right);
                right = i + 1;
            } 
        }
        max_d = max(max_d, (int)s.size() - right);
        ans = min(max_d, ans);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;
int n;
int N[210000];

bool mtime()
{
    for(int i=0; i<n; i++)
    {
        if(N[i]-N[i-1]>1||N[i]>i)
            return true;
    }
    return false;
}

int main()
{
    long long ans;
    cin>>n;
    for(int i=0; i<n; i++)
    {
        cin>>N[i];
    }
    if(mtime())
    {
        cout<<-1<<endl;
        return 0;
    }
    ans=0;
    for(int i=1; i<n; i++)
    {
        if(N[i]-N[i-1]==1)
            ans++;
        else
            ans+=N[i];
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 1024
#include "bits/stdc++.h"
#define ed cout<<"\n";
#define speed ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long int
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define All(obj) (obj).begin(),(obj).end()

using namespace std;

int main() {
	speed;
	int a, b;
	cin >> a >> b;
	if (b%a==0)cout << b + a;
	else {
		cout << b - a;
	}
	ed;
	return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define rep(i,n)for(int i=0;i<(int)(n);i++)
#define PI 3.141592653589793
//vector < vector<int>>a(0, vector<int>(0));二次元配列宣言


int main()
{
	int a, b, h;
	cin >> a >> b >> h;
	cout << (a + b) * h / 2 << endl;
} 

Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;

int main() {
  int N, ans;
  cin >> N;
  int V[N], C[N];
  for (int i = 0; i < N; i++) {
    cin >> V[i];
  }
  for (int i = 0; i < N; i++) {
    cin >> C[i];
  }
  ans = 0;
  for (int i = 0; i < N; i++) {
    if (V[i] - C[i] > 0) ans += V[i] - C[i];
  }
  cout << ans;
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void){
    int a,b,c;
    int s=0;
    scanf("%d%d%d",&a,&b,&c);
    for(int i=1;i<=b;i++){
        if(a*i%b-c){
            
        }else{
          s++;
        }
    }
    printf(s?"YES":"NO");
}

Measured memory_bytes: 1700
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define DEBUG(x) cerr << #x << " = " << x << endl
const int INF = (int)1e9;
int N, W[300];
int dp[300][300];
// [i,j]
bool solve(int i, int j) {
  assert(0 <= i && i < N && 0 <= j && j < N);
  assert(i <= j);
  int &res = dp[i][j];
  if(res != -1) return res;
  res = false;
  if(i + 1 == j) if(abs(W[i] - W[j]) <= 1) res = true;
  if(i + 2 <= j) {
    if(abs(W[i] - W[j]) <= 1 && solve(i + 1, j - 1)) {
      res = true;
    }
  }
  for(int k = i; k < j; ++k) {
    if(solve(i, k) && solve(k + 1, j)) res = true;
  }
  return res;
}
signed main() {
  ios::sync_with_stdio(false);
  while(true) {
    cin >> N;
    if(N == 0) break;
    REP(i,N) cin >> W[i];
    memset(dp, -1, sizeof(dp));
    REP(i,N) for(int j = i + 1; j < N; ++j) {
      solve(i, j);
      // cerr << "[" << i << "," << j << "] = " << (solve(i, j) ? "yes" : "no") << endl;
    }
    vector<int> cost(N + 1, INF);
    cost[0] = 0;
    REP(i,N) {
      cost[i + 1] = min(cost[i + 1], cost[i] + 1);
      for(int j = N - 1; j > i; --j) {
        if(solve(i, j)) {
          cost[j + 1] = min(cost[j + 1], cost[i]);
        }
      }
    }
    // REP(i,N+1) {
    //   cerr << " " << cost[i];
    // }
    // cerr << endl;
    cout << N - cost[N] << endl;
  }
}

Measured memory_bytes: 3816
n, m = map(int, input().split())

mod = 10 ** 9 + 7
N = 200000

#逆元テーブル
inv_t = [0]+[1]
for i in range(2, N):
  inv_t += [inv_t[mod % i] * (mod - int(mod / i)) % mod]

#階乗計算
kai = [1, 1]
rev_kai = [1, inv_t[1]]
for i in range(2, N):
	kai.append(kai[-1] * i % mod)
	rev_kai.append(rev_kai[-1] * inv_t[i] % mod)

# コンビネーション計算
def cmb(n, r):
	return kai[n] * rev_kai[r] * rev_kai[n-r] % mod

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

ans = 1

for _, cnt in factorization(m):
    if _ == 1:
        break
    ans = ans * cmb(cnt + n - 1, n - 1) % mod

print(ans)

Measured memory_bytes: 27024
#include <cstdio>

int main()
{
  char s[16];
  scanf("%s", s);
  int x = 0;
  for (char *p = s; *p; ++p)
  {
    if (*p == 'x') ++x;
  }
  puts(x < 8 ? "YES" : "NO");
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define int long long

const int N=1005;
const int MOD=1e9+7;
 
 
int32_t main()
{
  //#ifndef ONLINE_JUDGE
  //freopen("input.txt", "r", stdin);
  //freopen("output.txt", "w", stdout);
  //#endif
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  /* stuff you should look for
  * int overflow, array bounds
  * special cases (n=1?)
  * do smth instead of nothing and stay organized
*/
  int n;
  cin>>n;
  string s;
  map<string,int> m;
  for(int i=0;i<n;i++)
  {
    cin>>s;
    m[s]++;

  }
  vector<string > v;
int x=-1;
  for(auto it:m)
  {
     x=max(x,it.second);
  }

  for(auto it:m)
  {
    if(it.second==x)
    {
      v.push_back(it.first);
    }
  }

  for(int i=0;i<v.size();i++)
    {
      cout<<v[i]<<endl;
    }
  
  
}




Measured memory_bytes: 25584
import java.util.*;
import java.io.*;

public class Main {

	public static void main(String[] args) throws IOException {
		InputReader in = new InputReader(System.in);
		int x = in.readInt();
		int y = in.readInt();
		int z = in.readInt();
		int ans = 0;
		x -= z; 
		while(x >= y+z) {
			ans++;
			x -= y+z;
		}
		System.out.println(ans);
	}
}
class InputReader {

	private InputStream stream;
	private byte[] buf = new byte[1024];
	private int curChar;
	private int numChars;
	private SpaceCharFilter filter;

	public InputReader(InputStream stream) {
		this.stream = stream;
	}

	public int read() {
		if (numChars == -1)
			throw new InputMismatchException();
		if (curChar >= numChars) {
			curChar = 0;
			try {
				numChars = stream.read(buf);
			} catch (IOException e) {
				throw new InputMismatchException();
			}
			if (numChars <= 0)
				return -1;
		}
		return buf[curChar++];
	}

	public int readInt() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		int res = 0;
		do {
			if (c < '0' || c > '9')
				throw new InputMismatchException();
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}

	public String readString() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		StringBuilder res = new StringBuilder();
		do {
			res.appendCodePoint(c);
			c = read();
		} while (!isSpaceChar(c));
		return res.toString();
	}

	public long readLong() {
		int c = read();
		while (isSpaceChar(c)) {
			c = read();
		}
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		long res = 0;
		do {
			if (c < '0' || c > '9') {
				throw new InputMismatchException();
			}
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}
	
	public boolean isSpaceChar(int c) {
		if (filter != null)
			return filter.isSpaceChar(c);
		return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
	}

	public String next() {
		return readString();
	}

	public interface SpaceCharFilter {
		public boolean isSpaceChar(int ch);
	}
}


Measured memory_bytes: 23124
#include<bits/stdc++.h>
using namespace std;
int main()
  {
  int n,k;
  cin>>n>>k;
  int a[n];
  for(int i=0;i<n;i++)
  {
    cin>>a[i];
   }
  for(int i = k;i<n;i++)
{
if(a[i]>a[i-k])
{
cout<<"Yes"<<endl;
}
else
{
cout<<"No"<<endl;
}
}
  }
  

Measured memory_bytes: 4372
#include <bits/stdc++.h>
using namespace std;
#define ALL(x) (x).begin(),(x).end()
#define COUT(x) cout<<(x)<<"\n"
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define REP(i, n) for(int i=0;i<n;i++)
#define YES(x) cout<<(x?"YES":"NO")<<"\n"
#define Yes(x) cout<<(x?"Yes":"No")<<"\n"
#define dump(x) cout<<#x<<" = "<<(x)<<"\n"
#define endl "\n"
using G = vector<vector<int>>;
using M = map<int,int>;
using P = pair<int,int>;
using PQ = priority_queue<int>;
using PQG = priority_queue<int,vector<int>,greater<int>>;
using V = vector<int>;
using ll = long long;
using edge = struct { int to; int cost; };
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

int main() {
  IOS;
  int n, d;
  cin >> n >> d;
  int ans = 0;
  REP(i,n) {
    ll x,y;
    cin >> x >> y;
    if (sqrt(x*x + y*y) <= d) ans++;
  }
  COUT(ans);

  return 0;
}

Measured memory_bytes: 3696
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);
    int N = scan.nextInt();
    int M = scan.nextInt();
    int[] p = new int[M];
    String[] S = new String[M];
    for(int i=0; i<M; i++) {
      p[i] = scan.nextInt();
      S[i] = scan.next();
    }
    scan.close();

    int ok[] = new int[N];
    int pe[] = new int[N];
    for(int i=0; i<M; i++) {
      if(ok[p[i]-1] == 0) {
        if(S[i].equals("AC")) {
          ok[p[i]-1] = 1;
        }
        else if(S[i].equals("WA")) {
          pe[p[i]-1]++;
        }
      }
    }

    int okSum = 0;
    int peSum = 0;
    for(int i=0; i<N; i++) {
      okSum += ok[i];
      if(ok[i] == 1) {
        peSum += pe[i];
      }
    }

    System.out.println(okSum + " " + peSum);
  }
}

Measured memory_bytes: 70244
import sys, re
from math import ceil, floor, sqrt, pi, factorial, gcd
from copy import deepcopy
from collections import Counter, deque
from heapq import heapify, heappop, heappush
from itertools import accumulate, product, combinations, combinations_with_replacement
from bisect import bisect, bisect_left, bisect_right
from functools import reduce
from decimal import Decimal, getcontext
# input = sys.stdin.readline 
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_str(N): return [s_list() for _ in range(N)]
def s_row_list(N): return [list(s_input()) for _ in range(N)]
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 6)
INF = float('inf')
MOD = 10 ** 9 + 7
num_list = []
str_list = []

def main():
    a, b = i_map()

    count = 0
    for i in range(a,b+1):
        s_n = list(str(i))
        if s_n == s_n[::-1]:
            count += 1
    print(count)

if __name__ == '__main__':
    main()


Measured memory_bytes: 78312
url = "https://atcoder.jp//contests/abc156/tasks/abc156_c"

def main():
    n = int(input())
    people_pos = list(map(int, input().split()))

    syukai_pos = max(people_pos) + min(people_pos) // 2
    tmp = 0
    tmp2 = 0
    for pp in people_pos:
        tmp += (pp - syukai_pos) ** 2
        tmp2 += (pp - syukai_pos + 1) ** 2
    print(tmp) if tmp < tmp2 else print(tmp2)


def main2():
    n = int(input())
    people_pos = list(map(int, input().split()))
    people_pos.sort()
    count = 10000000000
    for i in range(people_pos[0] , people_pos[-1] + 1):
        tmp = 0
        for pp in people_pos:
            tmp += (pp - i) ** 2
        count = count if count < tmp else tmp
    print(count)




if __name__ == '__main__':
    main2()


Measured memory_bytes: 3064
#include<iostream>
using namespace std;
string a;
bool v[2];
int main(){
    
    cin>>a;
    for(int i=0;i<a.length();i++)
	{
        if(a[i]=='C') v[0]=1;
        if(a[i]=='F' && v[0])  v[1]=1;
    }
    if(v[1]) cout<<"Yes";
    else cout<<"No";
    return 0;
}

Measured memory_bytes: 256
from functools import reduce

def combination2(n, r, MOD=10**9+7):
    if not 0 <= r <= n: return 0
    r = min(r, n - r)
    numerator = reduce(lambda x, y: x * y % MOD, range(n, n - r, -1), 1)
    denominator = reduce(lambda x, y: x * y % MOD, range(1, r + 1), 1)
    return numerator * pow(denominator, MOD - 2, MOD) % MOD

X, Y = map(int, input().split())
if (2*X-Y)%3 or (2*Y-X)%3:
    print(0)
    exit()
x, y = (2*X-Y)//3, (2*Y-X)//3
print(combination2(x+y,x))


Measured memory_bytes: 73328
#include <bits/stdc++.h>
using namespace std;
                                                                                                
  

int main(){
                                                                     

    string o, e, s;

    int i, k; 


    cin >> o >> e;

    
    k = o.size() - e.size();


    for( i = 0 ; i < e.size() ; i = i + 1 ){

         s.push_back( o.at(i) );

         s.push_back( e.at(i) );

         }

    if( k == 1 ) s.push_back( o.at(i) );


    cout << s << endl;

    return 0;

    }

Measured memory_bytes: 256
import queue

h, w = map(int, input().split())

s = []
for i in range(h):
	tmp = input()
	s.append(tmp)

max = 0

def next(x, y, num):
	relist = []
	if x > 0 and s[x-1][y] == '.' and map[x-1][y] == '.':
		relist.append((x-1,y,num+1))
	if y > 0 and s[x][y-1] == '.' and map[x][y-1] == '.':
		relist.append((x,y-1,num+1))
	if x < h-1 and s[x+1][y] == '.' and map[x+1][y] == '.':
		relist.append((x+1,y,num+1))
	if y < w-1 and s[x][y+1] == '.' and map[x][y+1] == '.':
		relist.append((x,y+1,num+1))
	return relist

for i in range(h):
	for j in range(w):
		if s[i][j] == '.':
			map = s.copy()
			q = queue.Queue()
			q.put((i, j, 0))
			map[i] = map[i][:j] + '#' + map[i][j+1:]
			while q.empty() == False:
				x, y, num = q.get()
				if num > max:
					max = num
					xy = (i, j)
				list = next(x, y, num)
				for nx, ny, nnum in list:
					q.put((nx,ny,nnum))
					map[nx] = map[nx][:ny] + '#' + map[nx][ny+1:]

print(max)

Measured memory_bytes: 3952
o = list(input())
e = list(input())

ans = []
for i in range(len(o)):
  ans.append(o[i])
  if i < len(o)-1:
    ans.append(e[i])
  else:
    if len(e) == len(o):
      ans.append(e[i])
    
print("".join(ans))

Measured memory_bytes: 3060
/**
*   @Author : MeGaCrazy
*   @InitTime : Wed Jan 02 17:39:58 2019
*   @Idea :
*
*
*
*
*
*  Happy Solving :)
**/
#include <bits/stdc++.h>
using namespace std;
int main(){
#ifndef ONLINE_JUDGE
 //  freopen("in","r",stdin);
   //freopen("out","w",stdout);
#endif
   long long n;
   cin>>n;
   long long l=0,r=1e15;
   if(n<6){
   	cout<<1<<endl;
   	return 0;
   }
   while((r-l)>1){
    	long long mid=(l+r)>>1;
    	if(mid*5ll + mid*6ll >=n)r=mid;
    	else l=mid+1;
   }   
   while(1ll*5*(r-1)+(1ll*6*(r-1)) >=n)r--;
   while(1ll*5*(r)+(1ll*6*(r)) <n)r++;

   if(1ll*5*(r-1)+(1ll*6*(r))>=n){
        cout<<(r)+(r-1)<<endl;
   }else{
   	cout<<(r*2)<<endl;
   }
//   cout<<5ll*(long long)(1e15)+(6ll*(long long)(1e15))<<endl;

}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <limits.h>
#include <math.h>
int acs(const void *a, const void *b){return *(int*)a - *(int*)b;} /* 1,2,3,4.. */
int des(const void *a, const void *b){return *(int*)b - *(int*)a;} /* 8,7,6,5.. */
int cmp_char(const void *a, const void *b){return *(char*)a - *(char*)b;} /* a,b,c,d.. */
int cmp_str(const void *a, const void *b){return strcmp(*(const char **)a, *(const char **)b);} /* aaa,aab.. */
#define min(a,b) (a < b ? a: b)
#define max(a,b) (a > b ? a: b)
#define rep(i, l, r) for (int i = l; i < r; i++)
#define MAX 100001
#define MOD 1000000007

typedef long long int lli;

int main(void) {
  int N, T;
  scanf("%d %d", &N, &T);
  int c, t;
  int ans = 1001;
  rep(i, 0, N) {
    scanf("%d %d", &c, &t);
    if (t <= T) ans = min(ans, c);
  }
  if (ans == 1001) printf("TLE\n");
  else printf("%d\n", ans);
  return 0;
}


Measured memory_bytes: 128
#include<iostream>
using namespace std;
int main(){
	int a,b,c;
	cin >>a>>b>>c;
	int chk=0;
	for(int i=1;i<=b;++i){
		if(a*i%b==c){
			chk=1;
			break;
		}
	}
	if(chk==1) cout<<"YES\n";
	else cout<<"NO\n";
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;

int main(){
    int n, i, a, min;
    long long max, sum;
    cin >> n;
    sum = 0;
    max = -1000001;
    min = 10000001;

    for( i = 0; i < n ; i++){
        cin >> a;
    sum += a;

    if (max <= a) max = a ;
    if (a <= min) min = a ;
    }
    cout << min << " "<< max << " " << sum << endl;
}



Measured memory_bytes: 3120
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; ++i)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = int64_t;
using P = pair<int, int>;
using vs = vector<string>;
using vi = vector<int>;
using vvi = vector<vi>;
const int INF = 100010001;
const ll LINF = (ll)INF*INF*10;

int main() {
    int n;
    cin >> n;
    vs s(n);
    vi t(n);
    rep(i, n){
        cin >> s[i] >> t[i];
    }
    int ans = 0;
    string x;
    cin >> x;
    rep(i, n) {
        if(x == s[i]) {
            x = "";
        } else if(x == "") {
            ans += t[i];
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Queue;
import java.util.Random;
import java.util.Scanner;
 


public class Main {
	private static Scanner sc = new Scanner(System.in);
	//result = Math.pow(num1, num3)
	//StringBuffer str = new StringBuffer(hoge1);
	//String hoge2 = str.reverse().toString();
	//map.containsKey(A)

	//Map<String, Integer> map = new HashMap<String, Integer>(n);
	/*for ( キーのデータ型 key : マップの名前.keySet() ) {
		データのデータ型 data = マップの名前.get( key );
		
		// keyやdataを使った処理;
	}*/
	//int i = Integer.parseInt(s);
	//Queue<String> qq=new ArrayDeque<>(); //add,poll,peek
	//Deque<String> qq=new ArrayDeque<>();//push,pop,peek
	//ArrayList<Integer> cc = new ArrayList<>(N);
	//Collections.sort(list);
	//Array.sort(list);   cc.contains(tmp)
	//Arrays.asList(c).contains("a")
	//list.set(1,"walk");//1 1 2 3 5
	static long mod =1000000007;
	//static 	ArrayList<Integer> cc = new ArrayList<>(100);
	static int INF=1000000007;
	
	public static void main(String[] args) {
		//int N=sc.nextInt();for(int i=0;i<N;i++) {}
		//int a[]=new int[N];for(int i=0;i<N;i++) {}
		//Ae2+Be2=Ce2
		//StringBuffer str = new StringBuffer(hoge1);
		//for(int i=0;i<N;i++) {}
		int K=sc.nextInt();
		int S=sc.nextInt();
		
		int ans=0;
		
		for(int a=0;a<=K;a++) {
			for(int b=0;b<=K;b++) {
				if(a+b+K>=S&&a+b<=S)ans++;
				
				
			}
		}
		
		p(ans);
	}
	
		
	
	
		
	
	public static long modPow(long g,long N) {
		long T=1;
		for(int i=0;i<N;i++) {
			T*=g;
			T%=mod;
		}
		return T;
	}
	
	public static long lcm(long a, long b) {
        return a / gcd(a, b) * b;
	}
	
	public static long gcd(long a, long b) {
        return b == 0 ? a: gcd(b, a % b);
	}
	static String nextPermutation(String s) {
		ArrayList<Character> list=new ArrayList<>();
		for(int i=0;i<s.length();i++) {
			list.add(s.charAt(i));
		}
		int pivotPos=-1;
		char pivot=0;
		for(int i=list.size()-2;i>=0;i--) {
			if(list.get(i)<list.get(i+1)) {
				pivotPos=i;
				pivot=list.get(i);
				break;
			}
		}
		if(pivotPos==-1&&pivot==0) {
			return "Final";
		}
		int L=pivotPos+1,R=list.size()-1;
		
		
		
		int minPos=-1;
		char min =Character.MAX_VALUE;
		
		for(int i=R;i>=L;i--) {
			if(pivot<list.get(i)) {
				if(list.get(i)<min) {
					min=list.get(i);
					minPos=i;
				}
			}
		}
		
		Collections.swap(list, pivotPos, minPos);
		Collections.sort(list.subList(L, R+1));
		
		
		StringBuilder sb=new StringBuilder();
		for(int i=0;i<list.size();i++) {
			sb.append(list.get(i));
		}
		return sb.toString();
	}
	


	
	static void p(String ans) {System.out.println(ans);};
	static void p(int ans) {System.out.println(ans);};
	static void p() {System.out.println();};
	static void p(long ans) {System.out.println(ans);};
	static void p(double ans) {System.out.println(ans);};
	
}
	


Measured memory_bytes: 22740
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;

int main(){
	int n;
	while(n!=0){
		cin>>n;
		if(n==0){
			break;
		}
		vector<int> score;
		int hoge;
		for(int i=0;i<n;i++){
			cin>>hoge;
			score.push_back(hoge);
		}
		sort(score.begin(), score.end());
		int sum=0;
		for(int i=1;i<n-1;i++){
			sum += score[i];
		}
		cout<<sum/(n-2)<<endl;
	}
}

Measured memory_bytes: 1220
#include<bits/stdc++.h>
using namespace std;

#define rep(i,n) for(ll i=0;i<(n);++i)
#define reps(i,n) for(ll i=1;i<=(n);++i)
#define out(a) cout<<(a)<<endl;
using ll = long long;
using str = string;
constexpr long long INF = (1LL<<60);
constexpr long long MOD = (1e9+7);
constexpr long long LMAX = LLONG_MAX;
template<class T>inline T gcd(T a,T b){if(b==0)return a; return(gcd(b,a%b));}
template<class T>inline T lcm(T a,T b){return a/gcd(a,b)*b;}
template<class T>inline bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>inline bool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;}
inline void dump(){cout<<endl;}
template<class Head,class... Tail>inline void dump(Head&& head, Tail&&... tail){cout<<head<<", ";dump(forward<Tail>(tail)...);} // output
template<typename T>inline istream &operator>>(istream&input,vector<T>&v){for(auto &elemnt:v)input>>elemnt;return input;} // input,vector<>

signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(10);
  
  ll m,d;
  cin>>m>>d;

  ll ans=0;
  for(ll i=1;i<=m;++i){
    for(ll j=1;j<=d;++j){
      ll d1=j%10,d2=j/10;
      if(d1<2||d2<2)continue;
      if(d1*d2==i){
        //cout<<i<<" "<<j<<endl;
        ans++;
      }
    }
  }
  out(ans);
  
  
  
  return 0;
}


Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int[] s = new int[3];
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        List<Integer> list = new ArrayList<>();
        list.add(a * 10 + b + c);
        list.add(b * 10 + a + c);
        list.add(c * 10 + a + b);
        Collections.sort(list);
        System.out.println(list.get(2));
    }
}

Measured memory_bytes: 35856
n = int(input())
num = list( map( int, input().split() ) )
ans = 1E10
for t in range( 0, n ):
    s1 = sum( num[0:t] )
    s2 = sum( num[t:n] )
    ans = min( ans, abs(s1-s2) )
print(ans)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main()
{
  int A, B;
  cin >> A >> B;
  int ans = A - 2 * B;
  if (ans < 0)
    ans = 0;
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<iostream>
using namespace std;
#define ll long long  
#define esp 0.00000001
#define ld long double
int main()
{
	ios::sync_with_stdio(0);cin.tie(0);
	ld a,b,c;
	cin>>a>>b>>c;
	if(a+b+2*sqrtl(a*b)<c)cout<<"Yes";
	else cout<<"No";
}


Measured memory_bytes: 256
n,k,s = map(int,input().split())

ans=[]

cnt=n-k
for i in range(k):
    ans.append(s)

for j in range(cnt):
    if s==1:
        ans.append(2)
    elif s==10**9:
        ans.append((10**9)-1)
    else:
        ans.append(s+1)


print(*ans)

Measured memory_bytes: 9580
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,d;
    cin>>n>>d;
    double a[n],b[n];
    for (int i = 0; i < n; ++i)
    {
        cin>>a[i]>>b[i];
    }
    int cnt=0;
    for (int i = 0; i < n; ++i)
    {
        long double x=sqrt((a[i]*a[i])+(b[i]*b[i]));
        if (x<=d)
        {
            cnt++;
        }
    }
    cout<<cnt;

    return 0;
}

Measured memory_bytes: 6840
#include <bits/stdc++.h>
using namespace std;

int main(){
  long N,K;cin>>N>>K;
  vector<long> A(N);
  for(int i=0;i<N;i++) cin>>A.at(i);
  sort(A.begin(),A.end());
  long left=1;
  long right=A.at(N-1);
  while(left<right){
    long X=(left+right)/2;
    long ans=0;
    for(int i=0;i<N;i++){
      ans+=A.at(i)/X;
      if(A.at(i)%X==0) ans--;
    }
    if(ans>K) left=X+1;
    else right=X;
  }
  cout<<right<<endl;
}


Measured memory_bytes: 4840
#include<stdio.h>
int main(){

  int a[101][101],r,c,n,x[101][101],i,j;

  for(i=0;i<101;i++){
    for(j=0;j<101;j++){
      x[i][j]=0;
      a[i][j]=0;
    }
  }


  scanf("%d%d",&r,&c);

  for(i=0;i<r;i++){
    for(j=0;j<c;j++){
      scanf("%d",&n);
      x[i][j]=n;
		}
	}
		for(i=0;i<r;i++){
		for(j=0;j<c;j++){
			x[i][c]+=x[i][j];
			x[r][j]+=x[i][j];
		}
	}
	for(i=0;i<r;i++){
		x[r][c]+=x[i][c];
		}
	
	
  for(i=0;i<=r;i++){
		for(j=0;j<=c;j++){
			printf("%d",x[i][j]);
			if(j<c){
				printf(" ");
				}
			}
    puts("");
	}
  return 0;
}

Measured memory_bytes: 656
#include<cstdio>
#include<algorithm>
using namespace std;
int a[105];
int main()
{
	int n;
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
	}
	int ans=0;
	sort(a+1,a+n+1);
	for(int i=1;i<=n;i++)
	{
		for(int j=i+1;j<=n;j++)
		{
			for(int k=j+1;k<=n;k++)
			{
				if(a[i]+a[j]>a[k]&&a[i]!=a[j]&&a[j]!=a[k]&&a[i]!=a[k])
				{
					//printf("%d %d %d\n",a[i],a[j],a[k]);
					ans++;
				}
			}
		}
	}
	printf("%d\n",ans);
	return 0;
} 

Measured memory_bytes: 1728
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		
		String[] possible = new String[]{
			"AKIHABARA",
			"KIHABARA",
			"AKIHBARA",
			"KIHBARA",
			"AKIHABRA",
			"KIHABRA",
			"AKIHBRA",
			"KIHBRA",
			"AKIHABAR",
			"KIHABAR",
			"AKIHBAR",
			"KIHBAR",
			"AKIHABR",
			"KIHABR",
			"AKIHBR",
			"KIHBR"
		};
		foreach(var t in possible){
			if(S == t){
				Console.WriteLine("YES");
				return;
			}
		}
		Console.WriteLine("NO");
		
	}
	String S;
	public Sol(){
		S = rs();
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


Measured memory_bytes: 13140
import sys,collections,math,random;sys.setrecursionlimit(10**7)
def Is(): return [int(x) for x in sys.stdin.readline().split()]
def Ss(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

n = I()
alis = Is()
blis = Is()
ans = 0
for i in range(n):
    if alis[i] >= blis[i]:
        ans += blis[i]
    elif alis[i] + alis[i+1] <= blis[i]:
        ans += alis[i] + alis[i+1]
        alis[i+1] = 0
    else:
        ans += blis[i]    
        alis[i+1] = max(0, alis[i] + alis[i+1] - blis[i])
print(ans)

Measured memory_bytes: 20136
# -*- coding: utf-8 -*-
# 整数の入力
N = int(input())
# スペース区切りの整数の入力
A = [int(a) for a in input().split()]

order = sorted(range(len(A)), key=lambda k: A[k])
sorted_order = [_a + 1 for i, _a in enumerate(order)]
print(*sorted_order)

Measured memory_bytes: 17632
#include<stdio.h>
int main(void)
{
	int a,b,c;
	scanf("%d%d%d",&a,&b,&c);
	if(a==1&&b==0&&c==0) printf("Close\n");
	else if(a==0&&b==1&&c==0) printf("Close\n");
	else if(a==0&&b==0&&c==0) printf("Close\n");
	else if(a==1&&b==1&&c==0) printf("Open\n");
	else printf("Open\n");
	return 0;
}

Measured memory_bytes: 2648
#include <bits/stdc++.h>
using namespace std;
string rotate(string s){
    string ret;
    ret += s.back();
    for(int i = 0; i < s.length()-1; i++){
        ret += s[i];
    }
    return ret;
}
int main(){
    string s,t;
    cin >> s >> t;
    if(s.compare(t)==0){
        cout << "Yes" << endl;
        return 0;
    }
    int cnt = 0;
    while(true){
        s = rotate(s);
        if(s.compare(t)==0){
            cout << "Yes" << endl;
            return 0;
        }
        cnt++;
        if(cnt>=s.length())break;
    }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3612
from itertools import accumulate
import numpy as np
MOD = 10 ** 9 + 7


def cumprod(A, mod=MOD):
    L = len(A)
    Lsq = int(L ** 0.5 + 1)
    A = np.resize(A, Lsq ** 2).reshape((Lsq, Lsq))
    for i in range(1, Lsq):
        A[:, i] *= A[:, i - 1]
        A[:, i] %= mod
    for i in range(1, Lsq):
        A[i] *= A[i - 1][-1]
        A[i] %= mod
    return A.ravel()[:L]


def make_fact_and_inv(U, mod=MOD):
    """
    0~Nまでのサイズ(N+1)の階乗およびその逆元の配列を返す
    """
    tmp = np.arange(U, dtype=np.int64)
    tmp[0] = 1
    fact = cumprod(tmp, mod)
    tmp = np.arange(U, 0, -1, dtype=np.int64)
    tmp[0] = pow(int(fact[-1]), mod - 2, mod)
    inv = cumprod(tmp, mod)[::-1]
    return fact, inv


fact, inv = make_fact_and_inv(2 * 10 ** 5 + 10)


def nCr(n, r, mod=MOD):
    if r < 0 or r > n or n < 0:
        return 0
    return fact[n] * inv[r] % mod * inv[n - r] % mod


if __name__ == "__main__":
    N, K = map(int, input().split())

    ans = []
    for i in range(min(N - 1, K) + 1):
        val = nCr(N, i) * nCr(N - 1, i) % MOD
        ans.append(val)

    answer = 0
    while ans:
        answer = (answer + ans.pop()) % MOD
    print(answer)


Measured memory_bytes: 27460
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string s;
	cin>>s;
	if(s[0]=='A')
	{
		int ind=-1,cnt=0;
		for(int i=2;i<s.size()-1;i++)
		{
			if(s[i]=='C')
			{
				ind=i;
				cnt++;
			}
		}
		if(cnt==1)
		{
			bool f=false;
			for(int i=1;i<s.size();i++)
			{
				if(i!=ind)
				{
					if(s[i]<97||s[i]>122)f=true;
				}
			}
			if(f==false)
			{
				cout<<"AC"<<endl;
				return 0;
			}
			else cout<<"WA"<<endl;
		}
		else cout<<"WA"<<endl;
	}
	else cout<<"WA"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>

using namespace std;
#define inf 1000000000
#define unvisited -1
#define visited 1
#define eps 1e-9
#define mp make_pair
#define pb push_back
#define pi acos(-1.0)
#define uint64 unsigned long long
#define FastSlowInput ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define debug if(true)
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> ii;
typedef vector<ii> vii;

int main(){
	char c;
	cin>>c;
	printf("%c\n",c+1);
	return 0;
};

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;

int main() {
  string S;
  cin >> S;
  
  int size = S.size();
  if(S.at(size-1) == 's'){
    S += "es";
  }else{
    S += "s";
  }
  
  cout << S << endl;
  
}

Measured memory_bytes: 3600
N=int(input())
A=input().split()
B=input().split()
A=[int(i) for i in A]
B=[int(i) for i in B]
sum=0
D,E=list(),list()
for i in range(N):
	sum+=(A[i]-B[i])
if sum<0:
	print(-1)
else:
	sub,p=0,0
	for i in range(N):
		n=0
		n=A[i]-B[i]
		if n<0:
			sub+=n
			p+=1
		elif n>0:
			E.append(n)
	E.sort(reverse=True)
	j=0
	while sub < 0:
		sub=sub+E[j]
		j+=1
	print(j+p)

Measured memory_bytes: 22388
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        MyScanner in = new MyScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        C solver = new C();
        solver.solve(1, in, out);
        out.close();
    }

    static class C {
        public void solve(int testNumber, MyScanner in, PrintWriter out) {
            int A = in.Int();
            int B = in.Int();
            int H = in.Int();
            int M = in.Int();

            double hr = Math.toRadians(H * 30.0 + M * 0.5);
            double mr = Math.toRadians(M * 6.0);
            double hx = A * Math.sin(hr);
            double hy = A * Math.cos(hr);
            double mx = B * Math.sin(mr);
            double my = B * Math.cos(mr);
            double dx = hx - mx;
            double dy = hy - my;
            double ans = Math.sqrt(dx * dx + dy * dy);
            out.printf("%.14f", ans);
        }

    }

    static class MyScanner {
        private BufferedReader in;
        private StringTokenizer st;

        public MyScanner(InputStream stream) {
            in = new BufferedReader(new InputStreamReader(stream));
        }

        public String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    String rl = in.readLine();
                    if (rl == null) {
                        return null;
                    }
                    st = new StringTokenizer(rl);
                } catch (IOException e) {
                    return null;
                }
            }
            return st.nextToken();
        }

        public int Int() {
            return Integer.parseInt(next());
        }

    }
}



Measured memory_bytes: 34536
// ABC150-C
#include <bits/stdc++.h>
#define endl "\n"
#define rep(i,n) for(int i=0;i<int(n);i++)
#define SZ(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}
namespace you {
    std::string to_string(char val) {
        return std::string(1, val);
        // return std::string{val};
        // you::to_string(char)
    }
}

vector<int> p(10);
vector<int> q(10);

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(12);

    int n;
    cin>>n;
    rep(i,n) cin>>p[i];
    rep(i,n) cin>>q[i];
    vector<int> kind(n);
    rep(i,n) kind[i]=i+1;
    int ind_p,ind_q;
    int cur=0;
    do{ 
        cur+=1;
        int c_p=0,c_q=0;
        rep(i,n){
            if(p[i]==kind[i]) c_p+=1;
            if(q[i]==kind[i]) c_q+=1;
        }
        if(c_p==n) ind_p=cur;
        if(c_q==n) ind_q=cur;
    }while(next_permutation(all(kind))); 
    cout<<abs(ind_p-ind_q)<<endl;
    return 0;
}

Measured memory_bytes: 256
/*Arnab's Code
*/
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp(a,b) make_pair(a,b)
#define vll vector<ll>
#define vii vector<int>
#define pll pair<ll,ll>
#define pii pair<int,int>/*Arnab's Code
*/
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp(a,b) make_pair(a,b)
#define vll vector<ll>
#define vii vector<int>
#define pll pair<ll,ll>
#define pii pair<int,int>
#define take(a,n) for(ll i=0;i<n;i++)cin>>a[i]
#define takes(a,n,st) for(ll i=st;i<n+st;i++)cin>>a[i]
ll sum(ll a[],ll n,ll s){ for(ll i=0;i<n;i++)s+=a[i]; return s;}
#define mod 1000000009
ll power(ll x, ll y, ll p)  {  
    ll res = 1;  
    x = x % p;   
    if (x == 0) return 0;  
    while (y > 0){  
        if (y & 1)  
            res = (res*x) % p;  
        y = y>>1;
        x = (x*x) % p;  
    }  
    return res;  
}
void solve(){
	ll n,x,t;
	cin>>n>>x>>t;
	cout<<((n/x)+(n%x != 0))*t;
	return;
}
int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	#ifndef ONLINE_JUDGE
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
	#endif
	ll t,T;
//	cin>>T;
	T=1;
	for(t=1;t<=T;t++){
//		cout<<"Case #"<<t<<": ";
		solve();
	}
	return 0;
}


Measured memory_bytes: 3648
#include <stdio.h>
#include <algorithm>

using namespace std;

#define MAX_IN 100000
#define MAX_MN 12

int main(){
    int N,M,X,C[MAX_MN], A[MAX_MN][MAX_MN];

    scanf("%d %d %d", &N, &M, &X);
    for(auto i=0; i<N; i++){
        scanf("%d", &C[i]);

        for(auto j=0; j<M; j++){
            scanf("%d", &A[i][j]);
        }
    }

    // DEBUG
    // printf("%d %d %d\n", N, M, X);
    // for(auto i=0; i<N; i++){
    //     printf("%d ", C[i]);

    //     for(auto j=0; j<M; j++){
    //         printf("%d ", A[i][j]);
    //     }

    //     printf("\n");
    // }

    long long int min_cost = 12000000;
    int ruijo = 1;

    for(auto i = 0; i<N; i++){
        ruijo *= 2;
    }

    for(unsigned int i=1; i<=ruijo-1; i++){
        long long int Rikaido[MAX_IN] = {0};
        char RikaiKan = 1;
        int cost = 0;

        // printf("%ud \n", i);

        for(auto j=0; j<N; j++){
            for(auto k=0; k<M; k++){
                Rikaido[k] += A[j][k] * ((int)((i >> j)&0x0001));
                // printf("%d ", A[j][k] * ((int)((i >> j)&0x0001)));
            }
            cost += C[j] * ((int)((i >> j)&0x0001));
            // printf("\n");
        }
        
        for(auto j=0; j<M; j++){
            if(Rikaido[j] < X){
                RikaiKan = 0;
            }
        }

        if(RikaiKan == 1){
            min_cost = min(min_cost, (long long int)cost);
        }
    }

    if(min_cost < 12000000){
        printf("%lld", min_cost);
    }else{
        printf("-1");
    }
}

Measured memory_bytes: 2516
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;

int main() {
  int n;
  cin >> n;

  vector<int> ans(10001);

  for (int x = 1; x * x <= n; x++) {
    for (int y = 1; x * x + y * y <= n - x; y++) {
      for (int z = 1; z <= n - y; z++) {
        int a = x + y + z;
        ll v = a * a - x * y - y * z - z * x;
        if (v <= n) ans[v]++;
      }
    }
  }

  for (int i = 1; i <= n; i++) {
    cout << ans[i] << endl;
  }

  return 0;
}

Measured memory_bytes: 3660
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstring>
#include <assert.h>
#include <sys/time.h>
#include <fstream>

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  FOR(i,0,n)
#define REP(i,n)  FOR(i,0,n)
#define each(i,c) for(auto i=(c).begin(); i!=(c).end(); ++i)
#define EACH(i,c) for(auto i=(c).begin(); i!=(c).end(); ++i)
#define exist(s,e) ((s).find(e)!=(s).end())

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define deb(x) cerr << #x << " = " << (x) << " , ";
#define debl cerr << " (L" << __LINE__ << ")"<< endl;
#define sz(s) (int)((s).size())


#define clr(a) memset((a),0,sizeof(a))
#define nclr(a) memset((a),-1,sizeof(a))
#define pb push_back
#define INRANGE(x,s,e) ((s)<=(x) && (x)<(e))
#define MP(x,y) make_pair((x),(y))

double pi=3.14159265358979323846;

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<string> vs;

template<typename T> std::ostream& operator<<(std::ostream& os, const vector<T>& z){
	os << "[ ";
	REP(i,z.size())os << z[i] << ", " ;
	return ( os << "]" << endl);
}

template<typename T> std::ostream& operator<<(std::ostream& os, const set<T>& z){
	os << "set( ";
	EACH(p,z)os << (*p) << ", " ;
	return ( os << ")" << endl);
}

template<typename T,typename U> std::ostream& operator<<(std::ostream& os, const map<T,U>& z){
	os << "{ ";
	EACH(p,z)os << (p->first) << ": " << (p->second) << ", " ;
	return ( os << "}" << endl);
}

template<typename T,typename U> std::ostream& operator<<(std::ostream& os, const pair<T,U>& z){
	return ( os << "(" << z.first << ", " << z.second << ",)" );
}

double get_time(){
	struct timeval tv;
	gettimeofday(&tv, NULL);
	return tv.tv_sec + tv.tv_usec*1e-6;
}

typedef unsigned int uint32_t;
struct RND{
	uint32_t x;
	uint32_t y;
	uint32_t z;
	uint32_t w;
	RND(){
		x=123456789;
		y=362436069;
		z=521288629;
		w=88675123;
	}
	void init(int seed){
		x=123456789;
		y=362436069;
		z=521288629;
		w=seed+100;
		REP(i,10)get();
	}
	uint32_t get(){
		uint32_t t;
		t=x^(x<<11);
		x=y;y=z;z=w;
		w=(w^(w>>19))^(t^(t>>8));
		return w;
	}
};
RND rnd;

vl X;
vl SX;

void _main(istream &inp){
	int n;
	inp >> n;
	rep(i,n){
		int x;
		inp >> x;
		X.push_back(x);
	}
	SX = X;
	sort(SX.begin(), SX.end());
	rep(i,n){
		if(X[i]<SX[n/2])cout << SX[n/2] << endl;
		else{
			cout << SX[n/2-1] << endl;
		}
	}
	while(true){
		break;
	}

}

int main(){
	if(0){
		ifstream ifs("test.txt");
		_main(ifs);
	}
	else{
		_main(cin);
	}
	return 0;
}


Measured memory_bytes: 5488