akhauriyash/Code-Regression huggingface dataset:
import java.util.*;
import java.io.*;

class Main {
  final static int mod = 1000000000 + 7;
  static long [] sum;
  static void addValue(int node, long value) {
    while(node > 0) {
      value = (value * node) % mod;
      sum[node] = (sum[node] + value) % mod;
      node >>= 1;
    }
  }
  static long getSum(int node, long value) {
    long ans = 0;
    while(node > 1) {
      value = (value * node) % mod;
      long product = (value * (node >> 1)) % mod;
      ans = (ans + product * sum[node ^ 1]) % mod;
      node >>= 1;
    }
    return ans;
  }
  static long pathProduct(int cur, int root) {
    long product = 1;
    while(true) {
      product = (product * cur) % mod;
      if(cur == root) break;
      cur >>= 1;
    }
    return product;
  }
  public static void main(String [] args) {
    Reader in = new Reader();
    int h = in.nextInt();
    int n = (1 << (h - 1));
    int [] a = new int [n];
    sum = new long [1 << h];
    for(int i = 0; i < n; i++) {
      a[i] = in.nextInt() - 1;
    }
    long ans = 0;
    for(int i = 1; i < n; i++) {
      int [] left = getIndex(2 * i, h);
      int [] right = getIndex(2 * i + 1, h);
      for(int j : left) {
        addValue(a[j - n] + n, pathProduct(j, 2 * i));  
      }
      for(int j : right) {
        ans = (ans + getSum(a[j - n] + n, pathProduct(j, i))) % mod; 
      }
      for(int j : left) {
        addValue(a[j - n] + n, (mod - pathProduct(j, 2 * i)) % mod);
      }
    }
    System.out.println(ans);
  }
  static int msb(int value) {
    for(int i = 31; i >= 0; i--) {
      if(((value >> i) & 1) == 1) {
        return i;
      }
    }
    return 0;
  }
  static int [] getIndex(int node, int h) {
    int remaining = h - msb(node) - 1;
    int [] a = new int [1 << remaining];
    for(int i = 0; i < (1 << remaining); i++) {
      a[i] = node * (1 << remaining) + i;
    }
    return a;
  }
}

class Reader {
  BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
  StringTokenizer s = new StringTokenizer("");
  Reader () {}
  String nextLine() {
    try {
      return in.readLine();
    } catch (Exception e) {
      e.printStackTrace();
      return "Error";
    }
  }
  String next() {
    while(!s.hasMoreTokens()) {
      s = new StringTokenizer(nextLine());
    }
    return s.nextToken();
  }
  int nextInt() {
    return Integer.parseInt(next());
  }
}



Measured memory_bytes: 54844
#include<iostream>
#include<string>
#include<vector>
#include<math.h>
#include<algorithm>
#include<cstdio>
#include<stdio.h>
#include<stack>
#include<sstream>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<list>
#include<numeric>
#include <utility>
typedef long long ll;

#define pi 3.14159265358979323846
#define VI vector<int>
#define VLL vector<long long>
#define MAX max_element
#define MIN min_element
#define all(v) v.begin(), v.end()
const ll MOD = 1e9 + 7;
using namespace std;
template<typename T>
T gcd(T a, T b) {
	return b ? gcd(b, a % b) : a;
}
template<typename T>
T lcm(T a, T b) {
	return a * b / gcd(a, b);
}

template<typename T>
T binarysearch(vector<T> A, T key) {
	ll left = 0;ll right = 4;ll mid;
	while (left < right) {
		mid = (left + right) / 2;
		if (key == A[mid]) return 1;
		if (key > A[mid]) left = mid + 1;
		else if (key < A[mid]) right = mid;
	}
	return 0;
}

template<typename T>
T finder(vector<T> vec, T number) {
	auto itr = find(vec.begin(), vec.end(), number);
	size_t index = distance(vec.begin(), itr);
	if (index != vec.size()) { // 発見できたとき
		return 1;
	}
	else { // 発見できなかったとき
		return 0;
	}
}
ll frac(ll n)//階乗
{
	if (n == 0) {
		return 1;
	}
	return (n * frac(n - 1)) % MOD;
}

template<typename T>
T keta(T a) {
	ll kazu = 1;
	while (1) {
		if (a / 10 != 0) { a /= 10;kazu++; }
		else break;
	}
	return kazu;
}//桁数


template<typename T>
T nCr(ll n, T r) {
	ll ans = 1;
	for (int i = n; i > n - r; --i) {
		ans = ans * i;
	}
	for (int i = 1; i < r + 1; ++i) {
		ans = ans / i;
	}
	return ans;
}
/*char r[4];
int yaju[4];
char op[3];
int sum = 0;
scanf("%s", r);
for (int i = 0;i < 4;i++) {
	yaju[i] = r[i] - '0';
}
*///map < string, ll> s;

/*i++ずつずらす
a[0] a[1] a[2]//a[1] a[2] a[3]
a[0] a[2] a[4]//a[1] a[3] a[5]
/*if (N % 2 != 0)a = N / 2;
else a = N / 2 - 1;
for (int i = 1;i <= a;i++) {
	for (int j = 0;j < N - (i * 2);j++) {
		if (S[j] != S[j + i] && S[j + i * 2] != S[j] && S[j + i] != S[j + i * 2]) sum--;
		if (sum == 0)break;
	}
}*/

//mapの使い方
/*map<int, int> mp;
for (int i = 0; i < N; i++)
	mp[a[i]]++;

int ans = 0;
for (auto p : mp) {
	int x = p.first;
	int n = p.second;
	if (n < x) ans += n;
	else ans += n - x;
}*/

int main() {
	ll N;cin >> N;
	cout << "ABC" << N << endl;
}

Measured memory_bytes: 256
from fractions import gcd

n, x = map(int, input().split())
li = list(map(int, input().split()))
li += [x]
li.sort()
nums = []
for i in range(n):
  nums.append(li[i+1]-li[i])
  
nums = set(nums)

ans = 0
for i in nums:
  if ans == 0:
    ans = i
  else:
    ans = gcd(ans, i)
print(ans)

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

int main(){
  string s,t;
  cin >> s >> t;
  sort(s.begin(), s.end());
  sort(t.begin(), t.end(), greater<char>());
  if(s < t) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <list>

using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
typedef long long ll;
int d[105000];
int main() {
    int n;
    cin >> n;
    priority_queue<int> q;
    rep(i, n) {
        int qi;
        cin >> qi;
        q.push(qi);
    }

    int ans = 0;
    int cnt = 1;
    int prev = q.top();
    q.pop();
    while(q.size() != 0) {
        int qt = q.top();
        q.pop();
        //cout << "qt: " << qt << " prev: " << prev << endl;
        if(prev == qt) {
            cnt += 1;
        } else{
            if(cnt % 2 == 1) ans += 1;
            cnt = 1;
        }
        prev = qt;
    }
    if(cnt % 2 == 1) ans += 1;

    cout << ans << endl;
}

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

int main() {
	// your code goes here
    long long x,i,j,l,r,m;
    cin >> x;
    l=floor(x/100);
    r=floor(x/105)+1;
    for(i=0;i<=x;i++){
        m=x-100*i;
        if(m>=0&&m<=5*i){
            cout << "1" << endl;
            return 0;
        }
    }
    cout << "0" << endl;
    return 0;
}

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

typedef long long ll;

int main() {
  int N, K;
  std::cin >> N >> K;

  double ans = 0;
  for(int n = 1; n <= N; ++n) {
    if(n >= K) {
      ans += 1;
    } else {
      int tmp = n;
      double p = 1;
      while(tmp < K) {
        p *= 0.5;
        tmp *= 2;
      }
      ans += p;
    }
  }
  ans /= N;

  std::cout << std::fixed << std::setprecision(11) << ans << std::endl;
}


Measured memory_bytes: 256
N, M = gets.split.map(&:to_i)
str = "*" * N

M.times do |i|
  s,c = gets.split.map(&:to_i)
  if (str[s-1] != "*") && (str[s-1] != c.to_s)
    puts "-1"
    exit
  else
    str[s-1] = c.to_s
  end
end
if str[0] == "*" && N != 1
  str[0] = "1"
end
str = str.gsub(/\*/, '0')

val = str.to_i
ret = val.to_s
if ret.length != N
  puts "-1"
else
  puts ret
end


Measured memory_bytes: 1788
#coding: UTF-8

N = int(input())
A = input()
#A = list(map(int, input().split()))
IN1 = [None] * N
IN2 = [None] * N
i=0


for a in A.split():
    tmp = int(a.lstrip("SHCD"))
    IN1[i] = [tmp, i, a]
    IN2[i] = [tmp, i, a]
    i+=1

def BubbleSort(A,N):
    for i in range(N - 1):
        for j in range(N - 1, i,-1):
            if A[j][0] < A[j - 1][0]:
                tmp = A[j]
                A[j] = A[j - 1]
                A[j - 1] = tmp

def InsertionSort(A,N):
    for i in range(0,N):
        minj = i
        for j in range(i, N):
            if A[j][0] < A[minj][0]:
                 minj = j
        if i != minj:
            tmp = A[i]
            A[i] = A[minj]
            A[minj] = tmp

def StableCheck(A):
    tmp = [0,0]
    for t in A:
        if(tmp[1] > t[1]):
            if(tmp[0] == t[0]):
                return False
        tmp = t
    return True


BubbleSort(IN1,N)
InsertionSort(IN2,N)

for i in range(N - 1):
    print(IN1[i][2],end=' ')
print(IN1[N - 1][2])
if(StableCheck(IN1)):print("Stable")
else:print("Not stable")

for i in range(N - 1):
    print(IN2[i][2],end=' ')
print(IN2[N - 1][2])
if(StableCheck(IN2)):print("Stable")
else:print("Not stable")

Measured memory_bytes: 7876
#include <iostream>
#include <vector>
#include <algorithm>

std::vector<int> V, C;

int value(int Vsum, int idx) {
    if (idx == V.size()) return Vsum;
    
    return std::max(value(Vsum+V[idx]-C[idx], idx+1), value(Vsum, idx+1)); 
}

int main() {
    int N;
    std::cin >> N;
    for (int i=0, temp; i<N; i++) {
        std::cin >> temp;
        V.push_back(temp);
    }
    for (int i=0, temp; i<N; i++) {
        std::cin >> temp;
        C.push_back(temp);
    }
    
    int ans = value(0, 0);
    std::cout << ans << std::endl;
}

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

int main(){
    int a, b;
    while(1){
        int s;
        cin >> a >> b;
        if(a == 0 && b ==0) break;
        if(a > b){
            s = a;
            a = b;
            b = s;
        }
        cout << a << " " << b << endl;
    }
    return 0;
    
}


Measured memory_bytes: 3056
#include<iostream>
using namespace std;
#define INF 10000000000;

long long cnt = 0;

void merge(int A[], int left, int mid, int right){
  int n1 = mid - left;
  int n2 = right - mid;
  int l[n1], r[n2];
  for ( int i = 0; i < n1; i++){l[i] = A[left + i];}
  for ( int i = 0; i < n2; i++){r[i] = A[mid + i];}
  l[n1] = r[n2] = INF;

  int i = 0,  j = 0;
  for ( int k = left; k < right; k++){
    if ( l[i] <= r[j]){
      A[k] = l[i];
      i++;
    } else {
      A[k] = r[j];
      cnt = cnt + mid + j - k;
      j++;
    }
  }
}

void mergeSort(int A[], int left, int right){
  if ( left + 1 < right){
    int mid = (left + right)/2;
    mergeSort(A, left, mid);
    mergeSort(A, mid, right);
    merge(A, left, mid, right);
  }
}

int main(){
  int n;
  cin >> n;
  int A[n+1];
  for ( int i = 0; i < n; i++){cin >> A[i]; }
  mergeSort(A, 0, n);

  cout << cnt << endl;

  return 0;
}


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

int main() {
    int N;
    int num[100000] = {0};
    cin >> N;
    for(int i=0; i<N; ++i) {
        int A; cin >> A;
        num[A] += 1;
        if(num[A] == 3 || num[0] == 2 || (N % 2 == A % 2)) {
            cout << 0 << endl;
            return 0;
        }
    }
    long long ans = 1;
    for(int i=0; i < N/2; ++i) {
        ans *= 2;
        ans %= 1000000007;
    }
    cout << ans << endl;
}

Measured memory_bytes: 640
#include <iostream>

using namespace std;

int main(){
        int N,M,a,b;
        cin >> N >> M;
        int tr[N] = {};
        for(int i=0;i<M;i++){
                cin >> a >> b;
                tr[a-1]++;
                tr[b-1]++;
        }
        for(int i=0;i<N;i++){
                cout << tr[i] << endl;
        }
        return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <algorithm>
#include <climits>
#include <vector>
#include <string>
#include <set>
#include <iomanip>
#include <map>
#define REP(i,n) for (int i=0;i<(n);++i)
using namespace std;
using ll = long long;

int main(){
    double a, b, c, d, e, f;
    cin >> a >> b >> c >> d >> e >> f;

    vector<double> ansW, ansS;

    for(int i = 0; a * i <= f; ++i){
        for(int j = 0; 100 * a  * i + 100 * b *j <= f; ++j){
            if(i == 0 && j == 0) continue;
            ansW.push_back(100 * a * i + 100 * b * j);
            //cout << ansW[i] << " ";
        }
    }
    //cout << endl;

    for(int i = 0; c * i < f; ++i){
        for(int j = 0; c * i + d * j < f; ++j){
            ansS.push_back(c * i + d * j);
            //cout << ansS[i] << " ";
        }
    }

    //cout << endl;

    double sum = 0, sumS = 0;
    double noudo = e * 100.0 / (e + 100.0);

    for(int i = 0; i < ansW.size(); ++i){
        for(int j = 0; j < ansS.size(); ++j){
            if(ansW[i] + ansS[j] > f) continue;
            double tmp = (ansS[j] * 100) / (ansW[i] + ansS[j]);
            double n = 0;
            if(sum != 0)
                n = sumS * 100 / sum;
            if(tmp <= noudo && tmp >= n){
                sum = ansW[i] + ansS[j];
                sumS = ansS[j];
            }
        }
        //cout << noudo << endl;
    }
    cout << sum << " " << sumS << endl;
    return 0;
}


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

int main() {
  int N;
  cin >> N;
  vector<int> a;
  //int b[55];
  //vector<int> c(55);
 	int p;
  for(int i=0;i<N;i++){
    cin >> p;
    p--;
    a.push_back(p);
  }
  int now,count=0;
  for(int i=0;i<N;i++){
    
    if(now==1){
      cout << count << endl;
      return 0;
    }
   	count++;
    now=a[now];
  }
   cout << -1 << endl;
}

     

Measured memory_bytes: 3900
import sys
from collections import deque

H,W=map(int,input().split())
S=list(sys.stdin)

ans=0
for i in range(H):
    for j in range(W):
        if S[i][j]=='#':
            continue
        dist=[[-1]*W for _ in range(H)]
        dist[i][j]=0
        que=deque()
        que.append((i,j))
        while que:
            i,j=que.popleft()
            ans=max(ans,dist[i][j])
            for ni,nj in (i-1,j),(i,j+1),(i+1,j),(i,j-1):
                if 0<=ni<H and 0<=nj<W and S[ni][nj]=='.' and dist[ni][nj]==-1:
                    dist[ni][nj]=dist[i][j]+1
                    que.append((ni,nj))

print(ans)


Measured memory_bytes: 9456
w, h, n = map(int, input().split())
query = [tuple(map(int, input().split())) for _ in range(n)]

sx, sy = 0, 0
for x, y, a in query:
    if a == 1:
        sx = max(sx, x)
    elif a == 2:
        w = min(w, x)
    elif a == 3:
        sy = max(sy, y)
    else:
        h = min(h, y)
print(max(0, w - sx) * max(0, h - sy))

Measured memory_bytes: 9232
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>

size_t linear_search_find(int32_t data[], size_t data_size, int32_t find[], size_t find_size)
{
  if ((data == NULL) || (find == NULL)) {
    return 0;
  }

  size_t found = 0;
  int32_t i = 0;
  for (i = 0; i < find_size; i++) {
    int32_t f = find[i];
    int32_t j;
    for (j = 0; j < data_size; j++) {
      if (data[j] == f) {
        found++;
        break;
      }
    }
  }
  return found;
}

static int32_t data[10000];
static int32_t find[500];

#if !defined(TEST)
int32_t main(void)
{
  int32_t num1, num2;
  scanf("%d", &num1);
  int32_t i;
  for (i = 0; i < num1; i++) {
    scanf("%d", &data[i]);
  }

  scanf("%d", &num2);
  for (i = 0; i < num2; i++) {
    scanf("%d", &find[i]);
  }

  size_t n = linear_search_find(data, num1, find, num2);
  printf("%lu\n", n);

  return 0;
}
#endif

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

int N, K;
vector<int> A;

void input_init(void) {
	cin >> N >> K;
	A.resize(N + 1);
	for (int i = 1; i <= N; ++i)
		cin >> A[i];
}

void solve(void) {
	for (int j = K + 1, i = 1; j <= N; ++i, ++j) {
		if (A[j] > A[i])
			cout << "Yes\n";
		else
			cout << "No\n";
	}
}

int main(void) {
	input_init();
	solve();
	return 0;
}


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

#define lli long long int
#define mpr make_pair
#define pr pair<lli,lli>
#define pb push_back
#define vl vector<lli>
#define mp map<lli,lli>
#define all(x) x.begin(),x.end()
#define FOR(i,n) for(lli i=0;i<(lli)n;i++)
#define FOR1(i,j,n) for(lli i=j;i<(lli)n;i++)
#define mod 1000000007

lli power(lli x,lli n,lli m)
{
	lli res=1;
	while(n>0)
	{
		if(n&1) res=(res*x)%m;
		x=(x*x)%m;
		n=n>>1;
	}
	return res;
}

lli maxSubsetSum(vl v)
{
	lli max_so_far=LLONG_MIN,max_ending_here=0;
	for(lli i=0;i<(lli)v.size();i++)
	{
		max_ending_here+=v[i];
		if(max_so_far<max_ending_here)
		max_so_far=max_ending_here;
		if(max_ending_here<0)
		max_ending_here=0;
	}
	return max_so_far;
}

int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    lli a,b,c,k;
    cin>>a>>b>>c>>k;
    lli res=0;
    if(k<=a)
    res+=k;
    else
    {
		res+=a;
		k-=a;
		k-=b;
		if(k>0)
		res-=k;
	}
	cout<<res<<endl;
		
	
	
	
	
return 0;
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  int tmp = N;
  int X = 0;
  while (tmp > 0)
  {
    X += tmp % 10;
    tmp = tmp / 10;
  }
  
  if (N % X == 0) cout << "Yes" << endl;
  else cout << "No" << endl;
  
}

Measured memory_bytes: 256
n = gets.chomp.to_i
a = gets.chomp.split(" ").map(&:to_i)
aa = Array.new(n+2)
n_dup_i = Array.new()
a.each_with_index do |e, i|
  if aa[e].nil?
    aa[e] = i
  else
    n_dup_i = [aa[e], i]
  end
end

# http://hos.ac/slides/20130319_enumeration.pdf
P = 10**9 + 7

inv = Array.new(n+2, 0)
inv[1] = 1
(2..(n+2)).each do |i|
  inv[i] = P - (P / i) * inv[P % i] % P
end


@fac = Array.new(n+2, 0)
@facInv = Array.new(n+2, 0)
@fac[0] = 1
@facInv[0] = 1
(1..(n+2)).each do |i|
  @fac[i] = (@fac[i-1] * i) % P
  @facInv[i] = (@facInv[i-1] * inv[i]) % P
end

def choose(n, k)
  if !(0 <= k && k <= n)
    return 0
  end
  return (((@fac[n] * @facInv[k]) % P) * @facInv[n - k]) % P
end

d = n_dup_i[1] - n_dup_i[0]

(1..(n+1)).each do |i|
  puts (choose(n + 1, i) - choose(n-d, i - 1)) % P
end


Measured memory_bytes: 15372
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
import java.util.HashSet;
import java.util.NoSuchElementException;

class Main {
	public static void main(String[] args) {
		new Main().run();
	}
	
	void run() {
		FastScanner sc=new FastScanner();
		int N=sc.nextInt();
		int M=sc.nextInt();
		int[] a=new int[N];
		Arrays.fill(a, -1);
		for(int i=0;i<M;++i) {
			int s=sc.nextInt();
			int c=sc.nextInt();
			--s;
			if(a[s]!=-1&&a[s]!=c) {
				System.out.println(-1);
				return;
			}
			a[s]=c;
		}
		if(N>1&&a[0]==0) {
			System.out.println(-1);
			return;
		}
		long ans=0;
		for(int i=0;i<a.length;++i) {
			ans=10*ans+(a[i]==-1?i==0&&N>1?1:0:a[i]);
		}
		System.out.println(ans);
	}
	
	static void tr(Object... objects) {
	}

}


class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }
    public double nextDouble() { return Double.parseDouble(next());}
}

Measured memory_bytes: 22100
#include <iostream>
#include <numeric>
#include <cmath>
#include <limits>
#include <stdio.h>
#include <iomanip>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;
using ll = long long;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
ll Max(ll(a), ll(b), ll(c)) {
	return max(max(a, b), c);
}
ll Min(ll(a), ll(b), ll(c)) {
	return min(min(a, b), c);
}





int main() {

	ll N;
	cin >> N ;
	vector<ll> A(N);
	rep(i, N) {
		cin >> A.at(i);
	}
	ll mon = 1000;
	ll kabu = 0;
	rep(i, N) {
		if (i == 0) {
			if (A.at(0) < A.at(1)) {
				kabu += 1000 / A.at(0);
				mon = mon % A.at(i);
			}
			
		}
		else if (i == N - 1) {
			mon += kabu * A.at(i);
		}
		else {
			if (A.at(i) < A.at(i + 1) && A.at(i) <= A.at(i - 1)) {
				kabu += mon / A.at(i);
				mon = mon % A.at(i);
			}
			if (A.at(i) > A.at(i + 1) && A.at(i) >= A.at(i - 1)) {

				mon += kabu * A.at(i);
				kabu = 0;
			}
		}
	}
	cout << mon << endl;
	
}


Measured memory_bytes: 3628
n, q = tuple(map(int, input().split()))
queue = []
for _ in range(n):
    name, qtime = input().split()
    qtime = int(qtime)
    queue.append((name, qtime))

consumed_time = 0
completed_tasks = []
while True:
    try:
        n_qt = queue.pop(0)
    except:
        break

    name, qtime = n_qt
    if qtime <= q:
        consumed_time += qtime
        completed_tasks.append((name, consumed_time))
    else:
        qtime -= q
        consumed_time += q
        queue.append((name, qtime))

for name, t in completed_tasks:
    print(name, t)


Measured memory_bytes: 13884
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define sz size()
#define all(a)  a.begin(), a.end()
#define allr(a) a.rbegin(), a.rend()
#define mod 1000000007
#define _for(it, a) for(__typeof(a.begin()) it = a.begin(); it != a.end(); ++it)

using namespace std;

int main(){
   long long N, x;
   cin >> N >> x;
   long long res = 3ll * (N - __gcd(N, x));
   cout << res << endl;
   return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <string>

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (a); i > (b); i--)
#define ALL(a) (a).begin(), (a).end()

int main() {
    int a, b;
    cin >> a >> b;
    cout << (a + b + 1) / 2 << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define itrfor(itr,A) for(auto itr = A.begin(); itr !=A.end();itr++)
typedef long long llong;
char moji[26]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
char moji2[26]={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
char moji3[10]={'0','1','2','3','4','5','6','7','8','9'};
#define Sort(a) sort(a.begin(),a.end());
#define Reverse(a) reverse(a.begin(),a.end());


int main(){
    int a,b,c;
    cin >> a >> b >> c;
    if( b-a == c - b) cout << "YES" << endl;
    else cout << "NO" << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<cstdio>
#include<string>
#include<cmath>
#include<math.h>
#include<algorithm>
#include<string.h>
#include <iomanip>
#include <sstream>
using namespace std;

int main() {
  int N, M;
  int ans = 0;
  string s;

  cin >> N;
  cin >> s;

  for(int i = 0; i < s.size(); i++){
    char c;

    if((s[i]+N - 'A') > 25){
      c=s[i]+N-26;
      // cout << "a--";
    }else{
      c=s[i]+N;
      // cout << "b--";
    }
    // cout << " ";
 
    printf("%c", c); 
    // cout << endl;
  }

  cout  << endl;

}


Measured memory_bytes: 256
K = int(input())
A_list = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(A_list[K - 1])

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

using namespace std;

int main() {
    int n, m;
    int from, to;
    cin >> n >> m;

    vector<int> cities(n, 0);

    for (int i = 0; i < m; i++) {
        cin >> from >> to;
        cities.at(from - 1)++;
        cities.at(to - 1)++;
    }

    for (int i = 0; i < n; i++) {
        cout << cities.at(i) << endl;
    }

    return 0;
}


Measured memory_bytes: 3604
//  Created by conan1024hao in 2020.
//  Copyright © 2020 conan1024hao. All rights reserved.
//  専用ライブラリです、自由にコピーして構いません。
//  感谢看我的代码！Wechat:conan1024hao Twitter/QQ:810396815
#pragma GCC optimize ("O3")
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <cctype>
#include <cstdlib>
#define IINF 10e8
#define INF 10e17
#define MOD 1000000007
#define mod 1000000007
#define rep(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define Endl endl
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define mmax(x,y)(x>y?x:y)
#define mmin(x,y)(x<y?x:y)
#define chmax(x,y) x=mmax(x,y)
#define chmin(x,y) x=mmin(x,y)
#define all(x) (x).begin(),(x).end()
#define siz(x) (ll)(x).size()
#define PI acos(-1.0)
using namespace std;
//using Int=int_fast64_t;
typedef long long int ll;
typedef long long int LL;
typedef pair<ll,ll>Pll;
typedef pair<int,int>Pin;
template<class T> using V=vector<T>;
long long GCD(long long a, long long b) { return b ? GCD(b, a%b) : a; }
long long LCM(long long a, long long b)  {return a/GCD(a,b)*b;}
int dx[4]={-1,0,1,0};
int dy[4]={0,-1,0,1};
int ddx[8]={-1,0,1,0,1,1,-1,-1};
int ddy[8]={0,-1,0,1,1,-1,1,-1};
char dir[4]={'u','l','d','r'};
ll cmp1(pair<ll,string>a,pair<ll,string> b){
        if(a.fi!=b.fi)
        return a.fi<b.fi;
        else
        return a.se<b.se;
}

//---------------------------------------------------------------------------
bool color[1001][1001];ll m[30];
//---------------------------------------------------------------------------
int main(){//問題をちゃんと見ろ!!!!!!!!!!!!!!!!!      llか??????????统一类型        memset()!!!!!!!!!!!!       ペナを減らせ!!!!!!!!!!!!!
    cin.tie(0);
    ios::sync_with_stdio(false);
    //-------------------------------
    int n,m;cin>>n>>m;
    string s,t;cin>>s>>t;
    ll g=GCD(n,m),l=LCM(n,m);
    for(ll i=0;i<g;i++){
        if(t[i*(m/g)]!=s[i*(n/g)]){
            cout<<-1<<endl;
            return 0;
        }
    }
    cout<<l<<endl;
    //-------------------------------
    return 0;
}
//---------------------------------------------------------------------------








Measured memory_bytes: 640
/*

                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                    prayer
*/

// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(long long i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) {rep(_,v.size())cout<<" "<<v[_];cout<<endl;}
#define show2d(v) {rep(__,v.size())show1d(v[__]);}
using namespace std;
//kaewasuretyuui
typedef long long ll;
#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
#define mt make_tuple
typedef tuple<int,int,int,int> tp;
typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
#define yes cout<<"Yes\n"
#define no cout<<"No\n"

template< typename T >
istream &operator>>(istream &is, vector< T > &v) {
  for(T &in : v) is >> in;
  return is;
}

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

    int n;
    cin>>n;
    int s=0,t=0;
    rep(i,n){
        int a;cin>>a;
        s+=a,t+=a*a;
    }
    cout<<(s*s-t)/2<<endl;
}


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

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef pair<ll,ll> pll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<pll> vpll; 

#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define test() int t;cin>>t;while(t--)
#define all(v) v.begin(),v.end()
#define prinp(p) cout<<p.first<<" "<<p.second<<endl
#define prinv(V) for(auto v:V) cout<<v<<" ";cout<<endl
#define take(V,f,n) for(int in=f;in<f+n;in++) cin>>V[in]
#define what(x) cerr<<#x<<" = "<<x<<endl
#define KStest() int t,t1;cin>>t;t1=t;while(t--)
#define KScout cout<<"Case #"<<t1-t<<": "

const int MOD = 1e9+7,MAX = 1e5+5;
const ll INF = 1e18+5;
/////////////////FastExp///////////////////
ll powN(ll a,ll p)
{
	if(p==0) return 1;
	ll z=powN(a,p/2);
	z=(z*z)%MOD;
	if(p%2) z=(z*a)%MOD;
	return z;
}
/////////////////FastExp///////////////////
///////////////////PnC/////////////////////
vl Fac(MAX),Inv(MAX);
void CalcFac()
{
	Fac[0]=Inv[0]=1;
	for(int i=1;i<MAX;i++)
	{
		Fac[i]=(Fac[i-1]*i)%MOD;
		Inv[i]=powN(Fac[i],MOD-2);
	}
}

ll NCR(int n,int r)
{
	if(r>n) return 0;
	return (((Fac[n]*Inv[r])%MOD)*Inv[n-r])%MOD;
}
///////////////////PnC/////////////////////
//////////////////Sieve////////////////////
vector<bool> is_prime(MAX, true);
vi MinDiv(MAX);
void Sieve()
{
	is_prime[0] = is_prime[1] = false;
	int i,j;
	for (i = 2; i*i <= MAX; i++) 
	{
    	if (is_prime[i]) 
    	{
    		MinDiv[i]=i;
        	for (j = i * i; j <= MAX; j += i)
            {
				is_prime[j] = false;
				MinDiv[j]=i;
    		}
    	}
	}
	for(int i=2;i<=MAX;i++) if(is_prime[i]) MinDiv[i]=i;
}
//////////////////Sieve////////////////////

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
vi C(26);
vvi S(366,vi(26));
int D;
void score(vi t)
{
	int Sat=0;
	vi L(26);
	for(int i=1;i<=D;i++)
	{
		Sat+=S[i][t[i]-1];
		L[t[i]-1]=i;

		for(int c=0;c<26;c++)
		{
			Sat-= C[c]*(i-L[c]);
		}
		cout<<Sat<<endl;
	}
	// return Sat;
}

int main()
{
	cin>>D;
	take(C,0,26);
	for(int i=1;i<=D;i++)
	{
		take(S[i],0,26);
	}
	vi T(D+1);
	take(T,1,D);

	score(T);


}		

Measured memory_bytes: 5152
#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 <iomanip>
#include <cassert>

using namespace std;
typedef long long ll;

int main(){
   long long N,M,K;
   cin >> N >> M >> K;
   long long A[N];
   long long B[M];
   for (int i = 0; i < N; i++)
   {
      cin >> A[i];
   }
   for (int i = 0; i < M; i++)
   {
      cin >> B[i];
   }
   long long time = 0;
   long long ans = 0;
   long long asum = 0;
   long long bsum = 0;
   int bind = 0;
   while(bind < M && time + B[bind] <= K){
      time += B[bind];
      bind++;
   }
   ans = bind;
   for(int i = 0 ; i < N; i++){
      time += A[i];
      while(bind > 0 && time > K){
         bind--;
         time -= B[bind];
      }
      if(bind == 0 && time > K){
         break;
      }
      ans = max(ans,i+1LL+bind);
   }
   cout << ans << endl;
   return 0;
}


Measured memory_bytes: 6728
module Main where

import Control.Applicative
import Numeric

main :: IO ()
main = loop

loop :: IO()
loop = do
  { [h, w] <- getInts
  ; if h == 0 && w == 0 then done
    else do
      { putStrLn $ unlines $ frame h w
      ; loop
      }
  }

tedge :: Int -> String
tedge n = replicate n '#'

mbody :: Int -> String
mbody n = case n of
          0 -> ""
          1 -> "#"
          _ -> "#" ++ replicate (n-2) '.' ++ "#"

frame :: Int -> Int -> [String]
frame h w = case h of
          0 -> []
          1 -> [tedge w]
          _ -> [tedge w] ++ replicate (h-2)  (mbody w) ++ [tedge w]

--

getInts :: IO[Int]
getInts = map read . words <$> getLine

putInts :: [Int] -> IO ()
putInts = putStrLn . unwords . map show

getDoubles :: IO [Double]
getDoubles = map read . words <$> getLine

putDoubles :: [Double] -> IO ()
putDoubles = putStrLn . unwords . map showDouble

showDouble :: Double -> String
showDouble d = showFFloat Nothing d ""

done :: IO()
done = return ()



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

int main(){
    string N;
    cin >> N;

    if(N[0]==N[1]&&N[1]==N[2]&&N[2]==N[3]) puts("Yes");
    else if(N[0]==N[1]&&N[1]==N[2]) puts("Yes");
    else if(N[1]==N[2]&&N[2]==N[3]) puts("Yes");
    else puts("No");

    return 0;
}

Measured memory_bytes: 3628
import math
def lcm(x,y):
    return(x*y)//math.gcd(x,y)
n,m=map(int,input().split())
l=list(map(int,input().split()))
a=l[0]//2
for i in range(n-1):
    a=lcm(a,l[i+1]//2)
 
ok = True
for i in range(n):
  if (a//(l[i]//2))%2!=1:
    ok=False
    break
ans = 0
if ok:
    ans = ((m//a)+1)//2
print(ans)

Measured memory_bytes: 20088
#include <iostream>

using namespace std;

int main(void)
{
	int a , b;
	cin >> a >> b;

	int b_x;

	int div = b - a;

	int h[1000];

	h[1]= 1;

	for (int i = 2; i < 1000; i++)
	{
		h[i] = h[i - 1] + i;

		if (i == div)
		{
			b_x = h[i];
			break;
		}
	}

	cout << b_x - b << endl;

	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		char[] n = sc.next().toCharArray();
		if ((n[0] == n[1] && n[1] == n[2]) || (n[1] == n[2] && n[2] == n[3]))
			System.out.println("Yes");
		else
			System.out.println("No");
		sc.close();
	}
}

Measured memory_bytes: 23892
N = int(input())
L = [list(map(int,input().split())) for k in range(N)]
m = 0
for e in L:
    m = max(m,e[2])

def check(x,y,h):
    for e in L:
        if e[2] != max(h-abs(e[0]-x)-abs(e[1]-y),0):
            return False
    return True

for x in range(101):
    for y in range(101):
        for h in range(m,m+101):
            if check(x,y,h) == True:
                print(x,y,h)
                exit(0)


Measured memory_bytes: 46428
#include<iostream>
#include<stdio.h>
using namespace std;
int mset[100];
int findmset(int x){
    if (x == mset[x])
        return x;
    else
        return mset[x] = findmset(mset[x]);
}
void unionmset(int x,int y)
{
    int fx = findmset(x);
    int fy = findmset(y);
    mset[fy] = fx;
}
int main(){
    int m,n;
   scanf("%d%d",&m,&n);

    for (int i = 1; i <= 100; i++)
        mset[i]=i;
    mset[3]=1;
    mset[5]=1;
    mset[7]=1;
    mset[8]=1;
    mset[10]=1;
    mset[12]=1;
    mset[6]=4;
    mset[9]=4;
    mset[11]=4;
   if (findmset(m)==findmset(n)) cout<<"Yes";  else cout<<"No";
        return 0;
}

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

int main() {

    int n; cin >> n;
    deque<int> dq;
    for (int i = 0; i < n; i++) {
        int a; cin >> a;
        if (i % 2 == 0) dq.emplace_front(a);
        else dq.emplace_back(a);        
    }

    if (n % 2 != 0) {
        for (int i = 0; i < n; i++) {
            cout << dq.front() << " ";
            dq.pop_front();
        }
    }
    else {
        for (int i = 0; i < n; i++) {
            cout << dq.back() << " ";
            dq.pop_back();
        }
    }

    cout << endl;
    return 0;
}

Measured memory_bytes: 3072
#include <iostream>
#include <vector>
#include <string>
using namespace std;
int main()
{
    string s;
    cin >> s;
    int si = 0;

    int count1 = 0, count2 = 0;
    bool flag = false;

    for (int i = 0; i < s.length(); i++)
    {
        si = s[i] - '0';
        if (flag)
        {
            if (si)
            {
                count1++;
            }
            else
            {
                count2++;
            }
        }
        else
        {
            if (!(si))
            {
                count1++;
            }
            else
            {
                count2++;
            }
        }
        flag = !flag;
    }
    if (count1 > count2)
        swap(count1, count2);
    cout << count1 << endl;
    return 0;
}

Measured memory_bytes: 512
using System;

public class A_per_B_Problem {
  
  static void Main(string[] args) {
    
    var line = System.Console.ReadLine().Trim().Split(' ');

    int a = int.Parse(line[0]);
    int b = int.Parse(line[1]);
    double c = (double)a / (double)b;

    System.Console.WriteLine("{0} {1} {2}", a / b, a % b, c.ToString("F8") );
  }

}

Measured memory_bytes: 9228
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <iomanip>
#include <math.h>
#include <string.h>
#include <cstdio>
#include <tuple>
#include <numeric>
#include <time.h>
#include <chrono>
#ifdef _MSC_VER
#  include <intrin.h>
#  define __builtin_popcount __popcnt
#endif
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define REP(i,a,b) for(ll i=a;i>b;i--)
#define CST(x) cout<<fixed<<setprecision(x)//小数点以下の桁数指定
#define ct(a) cout<<a<<endl
#define rep(i,n) for(int i=0;i<(n);i++)
#define repl(i,l,r) for(int i=(1);i<(r);i++)
#define per(i, n) for(int i = ((n)-1); i >= 0; i--)
static const double pi = 3.141592653589793;
using namespace std;
typedef long long ll;
const ll MOD = 998244353;
const ll INF = (1LL << 31) - 1;
const ll mod = 1e9 + 7;


ll N,ans;



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

	cin >> N;
	
	cout << 10 -N / 200 << endl;


	return 0;
}

Measured memory_bytes: 3644
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<cstdio>
#include<cmath>
#define repp(i,a,b) for(int i=(int)a;i<(int)b;++i)
#define repm(i,a,b) for(int i=(int)a;i>(int)b;--i)
using ll=long long;
static const ll mod = 1e9;
static const ll INF = 1LL << 50;
using namespace std;

int main() {
	int n, m;
	cin >> n >> m;
	vector<int>l(m), r(m);
	int ansl =0, ansr =200000 ;
	repp(i, 0, m) {
		cin >> l[i] >> r[i];
		if (l[i] > ansl)ansl = l[i];
		if (r[i] < ansr)ansr = r[i];
	}int ans=ansr-ansl+1;
	if (ans < 0)ans = 0;
	cout << ans << endl;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
typedef tree<ii,null_type,less<ii>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	string s; cin>>s;
	cout<<(s[2]==s[3]&&s[4]==s[5]?"Yes":"No")<<endl;
	return 0;
}

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

using namespace std;


//repetition
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define euc_dis(x, y) sqrt(x*x + y*y)

#define pb push_back
#define mp make_pair
#define INF 999999999
#define MOD 1000000007
#define sp ' '


//typedef
typedef long long ll;
typedef pair<int, int> pint;
typedef pair<long, long> pll;
typedef map<int, int> mint;
typedef set<int> sint;
typedef vector<int> vint;
typedef vector<char> vchr;
typedef vector<long long> vll;
typedef vector<string> vstr;


ll mod(ll a, ll b){return (a%b+b)%b;}
ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b){return a*b/gcd(a,b);}
void Yes(){cout << "Yes" << endl;}
void No(){cout << "No" << endl;}
void Judge(bool b){b?Yes():No();}
void YES(){cout << "YES" << endl;}
void NO(){cout << "NO" << endl;}
void JUDGE(bool b){b?YES():NO();}
ll powMod(ll a, ll b, ll c){ll ans=1; rep(i, b){ans=ans*a%c;} return ans;}
double distance(ll x1, ll y1, ll x2, ll y2){return sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));}

template<typename T>
void ppp(T n){cout << n << endl;}
template<typename T>
void dpp(T n){cerr << n << endl;}
template<typename T>
void vpp(T a){rep(i,a.size()){cout << a[i] << endl;}}
template<typename T>
void vdp(T a){rep(i,a.size()){cerr << a[i] << endl;}}

const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int ddx[8] = {1,0,-1,0,1,-1,-1,1};
const int ddy[8] = {0,1,0,-1,1,1,-1,-1};

int main(){

    cin.tie(0);
    ios::sync_with_stdio(false);

    int n, k;
    cin >> n >> k;
    if(k % 2 == 1){
        ll X = n/k;
        ppp(X*X*X);
    }
    else{
        ll X = n/k, Y = n/(k/2) - X;
        ppp(X*X*X+Y*Y*Y);
    }


    return 0;
}


Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author NikuKyabe
 */

#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
const double EPS = 1e-9;
#define INF (1LL<<60)
#define D double
#define fs first
#define sc second
#define int long long
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define RFOR(i,a,b) for(int i = (int)(b-1);i>=(int)(a);--i)
#define REP(i,n)  FOR(i,0,(n))
#define RREP(i,n) RFOR(i,0,(n))
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr,mp) for(auto itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x)  cout << #x << " = " << (x) << endl;
#define SP << " " <<
#define outdicimal out << fixed << setprecision(10)//TODO 小数点以下の桁数の変更
typedef pair<int,int> P;
typedef vector<int> vec;
typedef vector<vector<int>> mat;

//ex.n = 60 = 2^2 * 3 * 5なら{(2, 2), (3, 1), (5, 1)}を返す
vector<P> prime_factorize(int n){
  vector<P> res;
  for(int p = 2; p * p <= n; p++){
    if(n % p != 0) continue;
    else{
      int num = 0;
      while(n % p == 0) {
        num++;
        n /= p;
      }
      res.push_back(make_pair(p, num));
    }
  }
  if(n != 1) res.push_back(make_pair(n, 1));
  return res;
}

class DDivGame {
public:
	void solve(std::istream& in, std::ostream& out) {
    int n;
    in >> n;
    vector<P> p = prime_factorize(n);
    int ans = 0;
    REP(i, p.size()){
      ans += (sqrt(p[i].second * 4 * 2 + 1) - 1) / 2;
    }
    out << ans << endl;
	}
};


signed main() {
  ios::sync_with_stdio(false);
  cout.tie(0);
  cout << fixed;
	DDivGame solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 3676
fun main(args: Array<String>) {
    val s = readLine()!!
    val array = s.map{ it - '0' }
    val sb = StringBuilder().append(array[0])
    var current = array[0]
    var count = 0
    for (i in 1..(s.length-1)) {
        if (array[i] == current) {
            current = if (current == 0) {
                sb.append("1")
                1
            } else {
                sb.append("0")
                0
            }
            count++
        } else {
            sb.append(array[i].toString())
            current = array[i]
        }
    }
    println(count)
}



Measured memory_bytes: 38984
#include <algorithm>
#include <iostream>
#include <numeric>
#include <vector>

int main()
{
    std::size_t n = 0;
    std::cin >> n;

    auto top = std::vector<std::size_t>(n);
    for (std::size_t i = 0; i < n; ++i) std::cin >> top[i];
    std::sort(top.begin(), top.end());

    auto mid = std::vector<std::size_t>(n);
    for (std::size_t i = 0; i < n; ++i) std::cin >> mid[i];
    std::sort(mid.begin(), mid.end());

    auto bot = std::vector<std::size_t>(n);
    for (std::size_t i = 0; i < n; ++i) std::cin >> bot[i];
    std::sort(bot.begin(), bot.end());

    auto count = std::size_t(0);

    for (std::size_t& it_m : mid)
    {
        auto t_lower = std::lower_bound(top.begin(), top.end(), it_m);
        auto top_num = std::size_t(0);
        if (*t_lower >= it_m && t_lower != top.end())
        {
            t_lower--;
            top_num = static_cast<std::size_t>(t_lower - top.begin() + 1);
        }
        else if (*t_lower >= it_m && t_lower == top.begin())
            top_num = 0;
        else
            top_num = static_cast<std::size_t>(t_lower - top.begin());

        auto b_upper = std::upper_bound(bot.begin(), bot.end(), it_m);
        auto bot_num = std::size_t(0);
        if ((*b_upper == it_m) && b_upper != bot.end())
        {
            b_upper++;
            bot_num = static_cast<std::size_t>(bot.end() - b_upper);
        }
        else if (*b_upper <= it_m && b_upper == bot.end())
            bot_num = 0;
        else
            bot_num = static_cast<std::size_t>(bot.end() - b_upper);

        count += top_num * bot_num;
    }

    std::cout << count << std::endl;

    return 0;
}

Measured memory_bytes: 2560
#include <iostream>
#include <string>
#include <vector>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
#define rop(i,n) for(int i=1;i<n+1;i++)

using namespace std;
using std::swap;

//vector<long long int> p;
vector<long long int> q;



int main() {

	int n;
	string s;
	cin >> n>>s;
	if(n%2==1)cout << "No" << "\n";
	else if (s.substr(0, n / 2) == s.substr(n / 2, n / 2))cout << "Yes" << "\n";
	else cout << "No" << "\n";

	return 0;
}

Measured memory_bytes: 256
#! usr/bin/env python3
#C:


S = list(input())


i = 0
j = len(S) - 1

insert = 0

while True:
	if i >= j:
		break

	elif S[i] == S[j]:
		i += 1
		j -= 1

	elif S[i] == 'x':
		i += 1
		insert += 1

	elif S[j] == 'x':
		j -= 1
		insert += 1

	else:
		insert = -1
		break

print(insert)

Measured memory_bytes: 4084
s=list(input())
n=len(s)
ind=[]
count=[]
temp=0
for i in range(n-1):
    temp+=1
    if s[i]!=s[i+1] and s[i]=="R":
        count.append(temp)
        ind.append(i)
        temp=0
    if s[i]!=s[i+1] and s[i]=="L":
        count.append(temp)
        temp=0
    if i==n-2:
      count.append(temp+1)

ans=[0]*n
for j in range(len(ind)):
    if (count[2*j]+count[2*j+1])%2==1:
        if count[2*j]%2==0:
            ans[ind[j]]+=(count[2*j]+count[2*j+1])//2
            ans[ind[j]+1]+=((count[2*j]+count[2*j+1])//2+1)
        else:
            ans[ind[j]]+=((count[2*j]+count[2*j+1])//2+1)
            ans[ind[j]+1]+=(count[2*j]+count[2*j+1])//2
    else:
        ans[ind[j]]+=(count[2*j]+count[2*j+1])//2
        ans[ind[j]+1]+=(count[2*j]+count[2*j+1])//2
ans2=[]
for k in range(n):
    ans2.append(str(ans[k]))
print(" ".join(ans2))

Measured memory_bytes: 88388