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

public class Main {
    private static StringBuilder sb = new StringBuilder();

    public static void main(String... args) throws IOException {
        final int[] targetAry = load();

        insertionSort(targetAry);

        System.out.print(sb.toString());
    }

    public static int[] load() throws IOException {
        final Scanner scanner = new Scanner(System.in);
        final int n = scanner.nextInt();
        final int[] nums = new int[n];
        for (int i = 0; i < n; i++) {
            nums[i] = scanner.nextInt();
        }

        return nums;
    }

    public static void insertionSort(final int[] targetAry) {
        for (int i = 0; i < targetAry.length; i++) {
            for (int j = i; 0 < j; j--) {
                if (targetAry[j - 1] > targetAry[j]) {
                    swap(targetAry, j - 1, j);
                }
                if ((1 < j) && (targetAry[j - 1] > targetAry[j - 2])) {
                    break;
                }
            }

            append(targetAry);
        }
    }

    public static void swap(final int[] targetAry, final int from, final int to) {
        final int tmp = targetAry[to];
        targetAry[to] = targetAry[from];
        targetAry[from] = tmp;
    }

    public static void append(final int[] targetAry) {
        for (int j = 0; j < targetAry.length; j++) {
            sb.append(targetAry[j]).append(j != targetAry.length - 1 ? ' ' : '\n');
        }
    }
}

Measured memory_bytes: 20772
package main

import (
	"bufio"
	"os"
	"strings"
	"strconv"
	"fmt"
)

var sc = bufio.NewScanner(os.Stdin)

func readLine() string {
	sc.Scan()
	return sc.Text()
}

func lineToInts(line string) []int {
	var array []int
	for _, s := range strings.Split(line, " ") {
		i, _ := strconv.Atoi(s)
		array = append(array, i)
	}
	return array
}

func main() {
	var n int
	fmt.Scan(&n)
	p := lineToInts(readLine())
	counter := 0
	for i := 0; i < len(p); i++ {
		if p[i] != i + 1 {
			counter++
			if counter > 2 {
				break
			}
		}
	}
	if counter > 2 {
		fmt.Println("NO")
	} else {
		fmt.Println("YES")
	}
}


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

int main(void){
  int n,i,j,a[1000],s=0,min,l,c,d;
  while(1){
    min = 1000000;
    cin >> n;
    if (n == 0)
        break;
    for (i=0;i<n;i++){
        cin >> l;
        a[i] = l;
    }
    for(i=0;i<n;i++){
      for(j=i+1;j<n;j++){
        s = abs(a[i] - a[j]);
        if(min > s)
          min = s;
      }
    }
    cout << min << endl;
  }
}


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

int main(){

  int a, b, c;
  cin >> a >> b >> c;
  if (a == b) cout << c << endl;

  if (c == b) cout << a << endl;

  if (a == c) cout << b << endl;

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <cstdlib>

using namespace std;
//DP用
template<class T> inline bool chmin(T& a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

//a^n mod を計算する関数
long long modpow(long long a,long long n,long long mod) {
    long long res = 1;
    while(n > 0) {
        if(n % 2 == 1) {
            res = res * a % mod;
        }
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

//a^(-1) mod すなわちaの逆元を返す関数
long long modinv(long long a,long long mod) {
    return modpow(a,mod-2,mod);
}

//最大公約数をを返す関数
long long gcd (long long a,long long b) {
    if(a % b == 0) {
        return b;
    }else {
        return (gcd(b,a%b));
    }
}

const long long INF = 1LL << 60;
const long long P = 1000000007;

//nCkを求める関数
long long conbi (long long n,long long k) {
    long long res = 1;
    long long inv;
    for(long long i = n-k+1; i <= n; i++) {
        res *= i;
        res %= P;
    }
    for(long long i = 1; i <= k; i++) {
        inv = modinv(i,P);
        res *= inv;
        res %= P;
    }
    return res;
}

int main() {
    int A,B,M;
    cin >> A >> B >> M;
    int a[A],b[B];
    int minA = 100000,minB = 100000;
    for(int i = 0; i < A; i++) {
        cin >> a[i];
        minA = min(minA,a[i]);
    }
    for(int i = 0; i < B; i++) {
        cin >> b[i];
        minB = min(minB,b[i]);
    }
    int price = minA+minB;
    int x[M],y[M],c[M];
    for(int i = 0; i < M; i++) {
        cin >> x[i] >> y[i] >> c[i];
        price = min(price,a[x[i]-1]+b[y[i]-1]-c[i]);
    }
    cout << price;
    return 0;
}



Measured memory_bytes: 2176
#include<iostream>
#include<cmath>
using namespace std;
double p1[2]={0.0,0.0},p2[2]={100.0,0.0};

int koch(double n,double p1[],double p2[]){
    if(n == 0){
    return 0;
    }
    double p3[2],p4[2],p5[2];
	p3[0]=p1[0]+(p2[0]-p1[0])*1.0/3.0;
	p3[1]=p1[1]+(p2[1]-p1[1])*1.0/3.0;
	p5[0]=p1[0]+(p2[0]-p1[0])*2.0/3.0;
	p5[1]=p1[1]+(p2[1]-p1[1])*2.0/3.0;
	p4[0]=(p5[0]-p3[0])*cos(1.0471975511965)-(p5[1]-p3[1])*sin(1.0471975511965)+p3[0];
	p4[1]=(p5[0]-p3[0])*sin(1.0471975511965)+(p5[1]-p3[1])*cos(1.0471975511965)+p3[1];
	koch(n-1,p1,p3);
	cout<<p3[0]<<' '<<p3[1]<<endl;
	koch(n-1,p3,p4);
	cout<<p4[0]<<' '<<p4[1]<<endl;
	koch(n-1,p4,p5);
	cout<<p5[0]<<' '<<p5[1]<<endl;
	koch(n-1,p5,p2);
}

int main(){
	int n;
	cin>>n;
	cout<<p1[0]<<' '<<p1[1]<<endl;
	koch(n,p1,p2);
	cout<<p2[0]<<' '<<p2[1]<<endl;
	return 0;
}



Measured memory_bytes: 3292
from collections import defaultdict


def main():
    H, W, N = map(int, input().split())

    d = defaultdict(int)
    for _ in range(N):
        a, b = map(int, input().split())
        for y in range(-2, 1):
            for x in range(-2, 1):
                n_y, n_x = y + a, x + b
                if 0 < n_y <= H - 2 and 0 < n_x <= W - 2:
                    d[(n_y, n_x)] += 1

    ans = [0] * 10
    for k, v in d.items():
        ans[v] += 1
    ans[0] = (H - 2) * (W - 2) - sum(ans)

    print(*ans, sep="\n")

if __name__ == '__main__':
    main()


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

using namespace std;

struct UnionFind
{
  vector< int > data;

  UnionFind(int sz)
  {
    data.assign(sz, -1);
  }

  int find(int k)
  {
    if(data[k] < 0) return (k);
    return (data[k] = find(data[k]));
  }

  void unite(int x, int y)
  {
    x = find(x);
    y = find(y);
    if(x == y) return;
    if(data[x] > data[y]) swap(x, y);
    data[x] += data[y];
    data[y] = x;
  }
};

void dfs(int idx, bool *used, vector< int > &order, vector< int > *g)
{
  if(used[idx]++) return;
  for(auto &to : g[idx]) dfs(to, used, order, g);
  order.push_back(idx);
};

void rdfs(int idx, int k, int *cmp, vector< int > *rg)
{
  if(~cmp[idx]) return;
  cmp[idx] = k;
  for(auto &to : rg[idx]) rdfs(to, k, cmp, rg);
};

int main()
{
  int N;
  double p[100];
  int cmp[100];
  bool used[100];
  bool in[100];

  while(scanf("%d", &N), N) {
    vector< int > g[100], rg[100];

    for(int i = 0; i < N; i++) {
      int M;
      scanf("%lf %d", &p[i], &M);
      while(M--) {
        int a;
        scanf("%d", &a);
        g[i].push_back(--a);
        rg[a].push_back(i);
      }
    }

    vector< int > order;
    memset(cmp, -1, sizeof(cmp));
    memset(used, false, sizeof(used));
    memset(in, 0, sizeof(in));
    for(int i = 0; i < N; i++) dfs(i, used, order, g);
    reverse(begin(order), end(order));
    for(int i : order) rdfs(i, i, cmp, rg);

    for(int i = 0; i < N; i++) {
      for(int &to : g[i]) in[cmp[to]] += cmp[i] != cmp[to];
    }
    double ret = 1.0;
    for(int i = 0; i < N; i++) {
      if(cmp[i] == i && !in[cmp[i]]) {
        double curr = 1.0;
        for(int j = 0; j < N; j++) {
          if(cmp[i] == cmp[j]) curr *= p[j];
        }
        ret *= 1 - curr;
      }
    }
    printf("%.10lf\n", ret);
  }
}

Measured memory_bytes: 3420
n, k = map(int, input().split())
p = 10 ** 9 + 7
a = min(k, n - 1)

def mod_inverse(a, p):
    mod = 1
    p_bin = bin(p-2)
    for i in range(len(p_bin) - 1, 1, -1):
        if i == len(p_bin) - 1:
            mul = a
            mul %= p
            mod *= (mul ** int(p_bin[i]))
            mod %= p
        else:
            mul = mul ** 2
            mul %= p
            mod *= (mul ** int(p_bin[i]))
            mod %= p
    return mod

b = []
for i in range(a):
    b.append(mod_inverse(i + 1, p))
b1 = [1]
b2 = [1]
for i in range(a):
    temp = b1[-1] * (n - i)
    temp *= b[i]
    temp %= p
    b1.append(temp)
    temp2 = b2[-1] * (n - 1 - i)
    temp2 *= b[i]
    temp2 %= p
    b2.append(temp2)
ans = 0
for i in range(a + 1):
    ans += b1[i] * b2[i]
    ans %= p
print(ans)

Measured memory_bytes: 106076
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<vector>
#include<algorithm>
#include<functional>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<deque>
#include<tuple>
#include<iostream>
#include<string>
#include<unordered_map>
#include<unordered_set>
using namespace std;
#define REP(i,x) for (int i=0;i<x;i++)
#define REPP(i,x,y) for (int i=x;i<=y;i++)
#define SI(x) scanf("%d",&x)
#define SL(x) scanf("%lld",&x)
#define MX3(x,y,z) max({x,y,z})
#define MX4(x,y,z,p) max({x,y,z,p})
#define MX5(x,y,z,p,q) max({x,y,z,p,q})
#define MN3(x,y,z) min({x,y,z})
#define MN4(x,y,z,p) min({x,y,z,p})
#define MN5(x,y,z,p,q) min({x,y,z,p,q})
#define amax(x,y) x=max(x,y)
#define amin(x,y) x=min(x,y)
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<bool> vb;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef vector<vb> vvb;
typedef long double ld;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
typedef tuple<int,int,int> ti;
typedef tuple<ll,ll,ll> tl;
// #####################################################################

const int MAX = 500 + 10;
char arr[MAX][MAX];
bool mark[MAX];

int n;
int cnt;
void _case1() {
    cnt = 0;
    REP(j, n) {
        bool all_same = true;
        REP(i, n) {
            all_same &= arr[i][j] == '#';
        }
        if(!all_same) cnt++;
    }
}

void solve() {

    SI(n);
    REP(i, n) {
        scanf("%s", arr[i]);
    }
    _case1();

    bool all_blank = true;
    REP(i, n) {
        bool all_same = true;
        REP(j, n) {
            all_same &= arr[i][j] == '#';
            all_blank &= arr[i][j] == '.';
            if(arr[i][j] == '#') {
                mark[j] = true;
            }
        }
        if(all_same) {
            printf("%d\n", cnt);
            return;
        }
    }
    if(all_blank) {
        puts("-1");
        return;
    }
    int ans = 2147483647;
    REP(i, n) {
        int cc = mark[i] ? 0 : 1;
        REP(j, n) {
            if(arr[i][j] == '.') cc++;
        }
        amin(ans, cnt+cc);
    }
    printf("%d\n", ans);
}

void init() {
    


}

int main () {
    init();
    solve();
    return 0;
}


Measured memory_bytes: 512
#include <stdio.h>

#define MAX_VALUE (200000)

int main(void) {
        int i, j;
        int num_value = 0;
        int value_currency[MAX_VALUE];
        int value_def, value_min;

        scanf("%d", &num_value);

        scanf("%d", &value_currency[0]);
        scanf("%d", &value_currency[1]);
        value_def = value_currency[1] - value_currency[0];
        value_min = value_currency[0];

        if (value_currency[1] < value_min)
                value_min = value_currency[1];

        for ( i = 2; i < num_value; i++) {
                scanf("%d", &value_currency[i]);
                if (value_def <= (value_currency[i] - value_min))
                        value_def = (value_currency[i] - value_min);
                if (value_currency[i] < value_min)
                        value_min = value_currency[i];
        }

        printf("%d\n", value_def);

        return 0;
}



Measured memory_bytes: 2640
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>
#include <cstring>
#include <cmath>
#include <stack>
#include <iomanip>
#include <tuple>
#include <functional>
#include <deque>

#define int long long
#define CONTAINS(v,n) (find((v).begin(), (v).end(), (n)) != (v).end())
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define ARY_SORT(a, size) sort((a), (a)+(size))
#define MAX(a,b) (((a) > (b)) ? (a) : (b))
#define MIN(a,b) (((a) < (b)) ? (a) : (b))
#define REMOVE(v,a) v.erase(remove(v.begin(), v.end(), a), v.end())
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define REPE(i, n) for (int (i) = 0; (i) <= (n); (i)++)
using namespace std;

int N, K;
int ans[300000];

signed main()
{
	cin >> K >> N;

	if (K % 2 == 0)
	{
		cout << ((K / 2 - 1) + 1);
		for (int i = 1; i < N; i++)
		{
			cout << " " << K;
		}
	}
	else
	{
		for (int i = 0; i < N; i++)
		{
			ans[i] = (K / 2) + 1;
		}

		int ind = N - 1;
		for (int i = 0; i < N / 2; i++)
		{
			ans[ind]--;
			if (ans[ind] == 0)
			{
				ind--;
			}
			else if (ind < N - 1)
			{
				for (int j = ind + 1; j <= N - 1; j++)
				{
					ans[j] = K;
				}
				ind = N - 1;
			}
		}

		for (int i = 0; i < N; i++)
		{
			if (ans[i] == 0) break;
			cout << ans[i] << " ";
		}
	}
}

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

vector<int> child[108000];
int n;
int a;

int dfs(int x){
  int res = 0;
  vector<int> ans;
  for(int i = 0;i < child[x].size();i++){
    int to = child[x][i];
    ans.push_back(dfs(to));
  }
  sort(ans.rbegin(), ans.rend());
  for(int i = 0;i < ans.size();i++){
    res = max(res, ans[i] + i + 1);
  }
  return res;
}

int main(){
  cin >> n;
  for(int i = 0;i < n-1;i++){
    cin >> a;
    child[a].push_back(i+2);
  }
  cout << dfs(1)<< endl;
  return 0;
}


Measured memory_bytes: 15232
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
      int N = sc.nextInt();
      int X = 1;
	  for(X=1;X<50000;X++){
        if((X*108)/100==N){
          System.out.println(X);
          return;
        }
      }
      System.out.println(":(");
      

    }
  
  private static long lcm(long m, long n) {
    return m * n / gcd(m, n);
}
  
  private static long gcd(long m, long n) {
    if(m < n) return gcd(n, m);
    if(n == 0) return m;
    return gcd(n, m % n);
}
}


Measured memory_bytes: 21844
#include <cstdio>
#include <algorithm>

using namespace std;

using ll = long long int;

const ll MAXN=2007;
const ll MOD=1e9+7;

ll dp[MAXN];

int main(){
    ll S;
    scanf("%lld",&S);

    // dp[3]=1;

    for(ll i=3;i<=S;i++){
        for(ll k=3;k<=i;k++) dp[i]=(dp[i]+dp[i-k])%MOD;
        dp[i]=(dp[i]+1)%MOD;
    }

    printf("%lld\n",dp[S]);

    return 0;
}

Measured memory_bytes: 1732
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<pi> vpi;
typedef vector<vi> vvi;
const int inf = 0x3f3f3f3f;
const ll linf = 123456789012345678;
const ll mod = 1000000007;
#pragma GCC optimize("Ofast")
#define all(x) x.begin(), x.end()
#define debug(x) cerr << #x << " = " << x << endl
#define sz(x) ((int)(x).size())


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

    int n;
    cin >> n;
    vi a(n);
    for(int i = 0; i < n; i++) cin >> a[i];
    vi colors(100001, -1);
    for(int i = 0; i < n; i++){
        int lo = 0, hi = 100001;
        while(lo+1<hi){
            int mid = (lo+hi-1)/2;
            if(colors[mid] >= a[i]){
                lo = mid + 1;
            }
            else{
                hi = mid + 1;
            }
        }
        colors[lo] = a[i];
    }
    int ans = 0;
    for(int i = 0; i < 100001; i++) ans += colors[i]!=-1;
    cout << ans << "\n";
}

Measured memory_bytes: 1152
import java.util.Scanner;
import java.util.TreeSet;

public class Main {
	public static void main(String[] args) {
		final Scanner sc = new Scanner(System.in);
		long a = sc.nextLong();
		long b = sc.nextLong();
		long k = sc.nextLong();
		TreeSet<Long> set = new TreeSet<>();
		for(long i = a; i <= b; i++) {
			if(i < a+k || i > b - k) {
				set.add(i);
			}
		}
		set.stream().forEach(System.out::println);
	}
}

Measured memory_bytes: 28360
import bisect
import copy
import heapq
import math
import sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
sys.setrecursionlimit(500000)
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

n,m=map(int,input().split())
ab=[list(map(int,input().split())) for i in range(m)]

dic=defaultdict(int)

for i in range(m):
    a,b=ab[i]
    dic[a]+=1
    dic[b]+=1

for i in range(n):
    if dic[i+1]%2==0:
        continue
    else:
        print("NO")
        break
else:
    print("YES")

Measured memory_bytes: 102588
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
// make it understandable one day...
const int N=2e5+1;
int n;
int a[N],b[N];
int f[31][31];
int main(){
	ios::sync_with_stdio(false);cin.tie(0);
	cin >> n;
	for(int i=1; i<=n ;i++){
		string s;cin >> s;
		ll x=0;
		bool d=false;
		int g=0;
		for(auto c:s){
			if(c=='.'){
				d=true;continue;
			}
			x=x*10+c-48;
			if(d) g++;
		}
		while(g++<9) x=x*10;
		while(x%2==0){
			a[i]++;x/=2;
		}
		while(x%5==0){
			b[i]++;x/=5;
		}
		a[i]=min(a[i],18);
		b[i]=min(b[i],18);
	}
	for(int i=1; i<=n ;i++){
		f[a[i]][b[i]]++;
	}
	for(int i=18; i>=0 ;i--){
		for(int j=18; j>=0 ;j--){
			f[i][j]+=f[i+1][j]+f[i][j+1]-f[i+1][j+1];
		}
	}
	ll ans=0;
	for(int i=1; i<=n ;i++){
		ans+=f[18-a[i]][18-b[i]];
		if(a[i]*2>=18 && b[i]*2>=18) ans--;
	}
	ans/=2;
	cout << ans << '\n';
}

Measured memory_bytes: 5180
//
// Created by sark2 on 23-10-2019.
//

#include "bits/stdc++.h"

using namespace std;
#define PB push_back
#define IOS cin.sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define CASES int t;cin>>t;while(t--)
#define MP make_pair

using ll = long long;
using ld = long double;

ll mod = 1e9 + 7;

int main() {
    IOS

    int n;
    cin>>n;
    int d[n+4], pre[n+4];
    int sum = 0;
    for(int i = 0; i < n; i++)cin>>d[i], sum += d[i];

    pre[0] = d[0];
    for(int i = 1; i < n; i++){
        pre[i] = pre[i-1] + d[i];
    }

    int ans = 0;
    for(int i = 0; i < n; i++){
        ans += (d[i]*(sum-pre[i]));
    }

    cout<<ans;



}


Measured memory_bytes: 256
//package com.company;

import java.io.*;
import java.util.*;

public class Main {
    static long TIME_START, TIME_END;
    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);
//        Scanner sc = new Scanner(new FileInputStream("Test.in"));
        PrintWriter pw = new PrintWriter(System.out);
//        PrintWriter pw = new PrintWriter(new FileOutputStream("Test.out"));
//        PrintWriter pw = new PrintWriter(new FileOutputStream("Test.in"));

        Runtime runtime = Runtime.getRuntime();
        long usedMemoryBefore = runtime.totalMemory() - runtime.freeMemory();
        TIME_START = System.currentTimeMillis();
        Task t = new Task();
        t.solve(sc, pw);
        TIME_END = System.currentTimeMillis();
        long usedMemoryAfter = runtime.totalMemory() - runtime.freeMemory();
        pw.close();
//        System.out.println("Memory increased:" + (usedMemoryAfter-usedMemoryBefore) / 1000000 );
//        System.out.println("Time used: " + (TIME_END - TIME_START) + ".");

    }


    public static class Task {

        public void solve(Scanner sc, PrintWriter pw) throws IOException {
            int A = sc.nextInt();
            int B = sc.nextInt();
            int C = sc.nextInt();
            int X = sc.nextInt();
            int cnt = 0;
            for (int i = 0; i <= A; i++) {
                for (int j = 0; j <= B; j++) {
                    for (int k = 0; k <= C; k++) {
                        if (i * 500 + j * 100 + k * 50 == X) {
                            cnt++;
                        }
                    }
                }
            }
            pw.println(cnt);
        }

    }



    static class Scanner {
        StringTokenizer st;
        BufferedReader br;

        public Scanner(InputStream s){  br = new BufferedReader(new InputStreamReader(s));}

        public Scanner(FileReader s) throws FileNotFoundException {br = new BufferedReader(s);}

        public String next() throws IOException
        {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

        public int nextInt() throws IOException {return Integer.parseInt(next());}

        public long nextLong() throws IOException {return Long.parseLong(next());}

        public String nextLine() throws IOException {return br.readLine();}

        public double nextDouble() throws IOException { return Double.parseDouble(next()); }

        public boolean ready() throws IOException {return br.ready();}
    }
}


Measured memory_bytes: 21332
s = list(input())

f = 0
if 1 <= int(''.join(s[:2])) <= 12:
    f |= 1
if 1 <= int(''.join(s[2:])) <= 12:
    f |= 2

if f == 0:
    print("NA")
elif f == 1:
    print("MMYY")
elif f == 2:
    print("YYMM")
else:
    print("AMBIGUOUS")

Measured memory_bytes: 38256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define rep1(i, n) FOR(i, 1, n+1)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; --i)
#define whole(x) (x).begin(),(x).end()
#define rwhole(x) (x).rbegin(), (x).rend()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define P pair<int, int>
#define debug(var) cerr << "[" << #var << "] " << var << endl
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define vi vector<int>
#define vl vector<ll>
#define pb push_back
#define eb emplace_back
#define pr(s) cout << (s) << '\n'
const ll mod = 1000000007;
const int dx[] = {-1,0,1,0};
const int dy[] = {0,-1,0,1};
const int INF = 1001001001;


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int h, w;
    cin >> h >> w;
    P c, d;
    cin >> c.first >> c.second >> d.first >> d.second;
    c.first--; c.second--;
    d.first--; d.second--;
    vector<string> s(h);
    rep(i, h) cin >> s[i];
    deque<P> q;
    q.push_front(c);
    vector<vector<int>> dist(h, vector<int>(w, INF));
    dist[c.first][c.second] = 0;
    while (!q.empty()) {
        auto [x, y] = q.front();
        q.pop_front();
        for (int i=-2; i<=2; i++) {
            for (int j=-2; j<=2; j++) {
                if (i==0 && j==0) continue;
                int ix = x + i;
                int iy = y + j;
                if (ix<0 || ix>=h || iy<0 || iy>=w) continue;
                if (s[ix][iy]=='#') continue;
                if (abs(i)+abs(j)==1) {
                    int d = dist[x][y];
                    if (dist[ix][iy]>d) {
                        dist[ix][iy] = d;
                        q.emplace_front(ix, iy);
                    }
                }
                else {
                    int d = dist[x][y] + 1;
                    if (dist[ix][iy]>d) {
                        dist[ix][iy] = d;
                        q.emplace_back(ix, iy);
                    }
                }
            }
        }
    }
    int ans = dist[d.first][d.second];
    if (ans==INF) ans = -1;
    
    pr(ans);
    return 0;
}


Measured memory_bytes: 8724
#include<stdio.h>
#define PI 3.141592653589

int main (void){
	
	int a,b,ans;
	char op;
	
	while(1){
	scanf("%d %c %d",&a,&op,&b);
	if(op == '?')break;
	if(op == '+'){
		ans = a+b;
	}else if(op == '-'){
		ans = a-b;
	}else if(op == '*'){
		ans = a*b;
	}else if(op == '/'){
		ans =a/b;
	}
	printf("%d\n",ans);
	}
return 0;
}

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

int main() {
  int K;
  cin >> K;
  string s;
  cin >> s;

  if (s.size() <= K) {
    cout << s << endl;
  } else {
    cout << s.substr(0, K) << "..." << endl;
  }
}


Measured memory_bytes: 3632
s = input()

ks = "keyence"

if s.startswith(ks) or s.endswith(ks):
  print("YES")
  exit(0)
  
for i in range(1, len(ks)):
  k1 = ks[:i]
  k2 = ks[i:len(ks)]
  if s.startswith(k1) and s.endswith(k2):
    print("YES")
    exit(0)

print("NO")
    

Measured memory_bytes: 9140
#include <iostream>
#include <cmath>
#include <climits>
#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
using namespace std;
// scanf
#pragma warning(disable: 4996)


/*
	v:vector  type:型  order:greater or less
*/
#define _sort(v,type,order) do { sort(v.begin(),v.end(),order<type>()); } while(0)
/*
	v:vector  default_value:初期値
*/
#define _sum(v,default_value) accumulate(v.begin(),v.end(),default_value )
/*
	丸め
*/
#define _round(v) round(v)
/*
	2乗 / 3乗  default_value:初期値
*/
#define _square(v) pow(v,2)
#define _cube(v)   pow(v,3)
/*
	大小判定
*/
#define _max(x,y) max(x,y)
#define _min(x,y) min(x,y)

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

	for (size_t i = 0; i < s.length(); i++) {
		int  cnt = 1;
		if (s[i] == -1) { continue; }
		for (size_t j = i + 1; j < s.length(); j++) {
			if (s[i] != s[j]) { continue; }
			s[j] = -1;
			cnt++;
		}
		if (!(cnt & 1)) { continue; }
		printf("No\n");
		return 0;
	}

	printf("Yes\n");
	return 0;
	//	std::cout << "Hello World!\n"; 
}


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

int main() {

	int a,b,x;
	cin >> a >> b >> x;
	if (x-a >= 0 && x-a < b) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}
	
	return 0;
}

Measured memory_bytes: 256
import math

a, b = map(int, input().split())
 
x = math.ceil(a/0.08)
ans = 0
while True:    
    y = int(x * 0.1)
    if (y == b):
        ans = 1
        break
    x += 1
    if int((x) * 0.08) > a:
        break
 
if ans == 1:
    print (int(x))
else:
    print (-1)

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

int main(void){
    int n, m;
    cin >> n >> m;

    int a[m];
    rep(i, m)
        cin >> a[i];

    ll step[n + 2];
    step[0] = 0;
    step[1] = 1;
    int count = 0;

    for(int i = 2; i <= n + 1; i++){
        if(i - 1 == a[count] && count != m){
            count++;
            step[i] = 0;
        }else{
            step[i] = (step[i - 1] + step[i - 2]) % 1000000007;
        }
    }
    cout << step[n + 1] << endl;
    return 0;
}


Measured memory_bytes: 1408
#include<bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define lli long long int
using namespace std;
int main()
{
//fastio;
int n;
cin>>n;
int k,l;
k=n%111;
if(k==0)
cout<<n;
else
{
l=111-k;
n=n+l;
cout<<n;
}
}


Measured memory_bytes: 256
#include<iostream>
#include<fstream>
#include<cmath>
#include<string>
#include<set>
#include <map>
#include<algorithm>
#include<vector>
#include <queue>
using namespace std;
typedef long long ll ;

int main(){
	
	int a , b , c  ,count = 0 , temp1 , temp2 , temp3 ;
	cin >> a >> b >> c ;
	if(a%2!=0||b%2!=0||c%2!=0){
		cout << 0 ;
		return 0;
	}
	if(a==b && b==c)
		cout << -1 ;
	else
	{
		while(true)
		{
			count ++;
			temp1 = a; temp2 = b; temp3 = c; 
			a = temp2 /2 + temp3 /2 ;
			b = temp1 /2 + temp3 /2 ;
			c = temp1 /2 + temp2 /2 ;
			if(a%2!=0||b%2!=0||c%2!=0){
				cout << count ;
				break;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <stack>
#include <complex>
#include <stdlib.h>
#include <stdio.h>
#include <functional>
#include <cfloat>
#include <math.h>
#include <numeric>
#include <string.h>
#include <sys/time.h>
#include <random>


#define fs first
#define sc second
#define endl "\n"

using namespace std;

typedef long long ll;
typedef unsigned int uint;
typedef pair<ll, ll> P;


class Graph{
    struct edge{
        int vertice;
        ll weight;
    };

    vector<vector<edge>> g;
    unsigned int n;

public:
    Graph(unsigned int n): n{n}{
        g.resize(n);
    }

    void add_edge(int u, int v){
        g[u].emplace_back(edge{v, 1});
    };

    void add_edge(int u, int v, ll w){
        g[u].emplace_back(edge{v, w});
    }

    vector<edge>& get_edge(int v){
        return g[v];
    }

    unsigned int size(){
        return n;
    }

    vector<edge>& operator[](int v){
        return get_edge(v);
    }
};


ll dfs(int v, int prev, map<int, ll>& mp, vector<int>& colorList, vector<ll>& res, Graph& g){
    ll childs = 1;
    for(auto e: g[v]){
        if(e.vertice == prev)   continue;
        map<int, ll> mpTmp;
        ll childsTmp = dfs(e.vertice, v, mpTmp, colorList, res, g);

        ll num;
        if(mpTmp.find(colorList[v]) != mpTmp.end()){
            num = childsTmp - mpTmp[colorList[v]];
        }
        else{
            num = childsTmp;
        }
        res[colorList[v]] -= num * (num + 1) / 2;

        childs += childsTmp;

        if(mp.size() < mpTmp.size()){
            swap(mp, mpTmp);
        }
        for(auto x: mpTmp){
            if(mp.find(x.fs) == mp.end()){
                mp[x.fs] = x.sc;
            }
            else{
                mp[x.fs] += x.sc;
            }
        }
    }

    mp[colorList[v]] = childs;
    return childs;
}


int main(){
    ll n;  cin >> n;
    vector<int> c(n);
    Graph g(n);
    for(int i = 0; i < n; i++){
        cin >> c[i];
        c[i]--;
    }
    for(int i = 0; i < n-1; i++){
        int a, b;   cin >> a >> b;
        a--; b--;
        g.add_edge(a, b);
        g.add_edge(b, a);
    }

    vector<ll> res(n, n * (n + 1) / 2);
    map<int, ll> mp;
    dfs(0, 0, mp, c, res, g);
    for(int i = 0; i < n; i++){
        ll num = n;
        if(mp.find(i) != mp.end()){
            num -= mp[i];
        }
        res[i] -= num * (num + 1) / 2;
    }

    for(auto r: res){
        cout << r << endl;
    }


    return 0;
}


Measured memory_bytes: 71312
using System;
using System.Linq;
using CompLib.Util;

public class Program
{

    public void Solve()
    {
        var sc = new Scanner();
        int n = sc.NextInt();
        long s = 2;
        long t = 1;
        for (int i = 2; i <= n; i++)
        {
            long next = s + t;
            s = t;
            t = next;
        }
        Console.WriteLine(t);
    }

    public static void Main(string[] args) => new Program().Solve();
}

namespace CompLib.Util
{
    using System;
    using System.Linq;

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}


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

int main() {
    string s;
    cin >> s;
    int n = s.size();
    int ans = 1000;
    for (int i = 1; i < n - 1; i++) {
        int x = 100 * (s[i - 1] - '0') + 10 * (s[i] - '0') + s[i + 1] - '0';
        ans = min(ans, abs(x - 753));
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(100000)
input = sys.stdin.readline


def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(S):
    N = len(S)
    d = [0] * N
    #  R - L
    r = []
    for i in range(N):
        if S[i] == 'R':
            r.append(i)
        else:
            for j in r:
                d[j] = i if (i - j) % 2 == 0 else i - 1
            r = []
    else:
        for j in r:
            d[j] = i - j
    #  L - R
    l = []
    for i in range(N-1, -1, -1):
        if S[i] == 'L':
            l.append(i)
        else:
            for j in l:
                d[j] = i if (j - i) % 2 == 0 else i + 1
            l = []
    else:
        for j in l:
            d[j] = j - i

    ans = [0] * N
    for i in d:
        ans[i] += 1

    return ' '.join(map(str, ans))


def main():
    S = read_str()
    print(slv(S))


if __name__ == '__main__':
    main()


Measured memory_bytes: 16840
n,m,x = map(int,input().split())
a = list(map(int,input().split()))

# 小さいほうの料金所の数
small_cost = 0
# 大きい方の料金所の数
big_cost = 0

# リストaの値とｘを比較して
for i in a:
    # ｘより小さいものをカウント
    if x > i:
        small_cost += 1
    # ｘより大きいものをカウント
    elif x < i:
        big_cost += 1
# 少ない方のカウントを出力
if small_cost <= big_cost:
    print(small_cost)
else:
    print(big_cost)

Measured memory_bytes: 9120
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define INF 1000000000
#define LLINF 10000000000000000ll
#define MOD 1000000007

bool dbgflag = true;

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

  int n;
  string s;
  cin >> n >> s;
  
  for (int i = 0; i < s.size(); i++) {
    s[i] += n;
    if ((char)s[i] > 'Z') s[i] -= 26;
  }

  cout << s << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(ll i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  int h, w, white = 0;
  cin >> h >> w;
  vector<vi> g(h + 2, vi(w + 2, -2));
  rep2(i, 1, h + 1) rep2(j, 1, w + 1) {
    char c;
    cin >> c;
    if(c == '.') {
      g[i][j] = -1;
      white++;
    }
  }
  queue<pair<int, int>> q;
  q.push({1, 1});
  g[1][1] = 1;
  while(!q.empty()) {
    int i = q.front().first;
    int j = q.front().second;
    q.pop();
    rep(k, 4) {
      int ni = i + dir[k];
      int nj = j + dir[k + 1];
      if(g[ni][nj] != -1) continue;
      g[ni][nj] = g[i][j] + 1;
      q.push({ni, nj});
    }
  }
  cout << (g[h][w] < 0 ? -1 : white - g[h][w]) << endl;
}

Measured memory_bytes: 3612
import math

def factorize(p):
    l = []
    while p % 2 == 0:
        p //= 2
        l.append(2)

    r = 3
    while r < int(math.sqrt(p)+1):
        if p % r == 0:
            p //= r
            l.append(r)
        else:
            r += 2

    if p != 1:
        l.append(p)

    return l

n = int(input())
l = factorize(n)

print(str(n)+":",*list(l))

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

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back

typedef long long ll;
typedef pair<int, int> pi;
typedef vector<int> vi;

const int mod = 1e+9 + 7;

int main() {
	int a, p;
	cin >> a >> p;

	cout << (3 * a + p) / 2 << endl;

}


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


int main() {
  int N, M = 0;
  cin >> N;
  int n = N;
  while (true){
    M += n%10;
    n = n/10;
    if(n == 0){
      break;
    }
  }
  if(N%M == 0){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include <cstdio>
int main() {
	int N;
	std::scanf("%d", &N);
	int b, n, flag = 0;
	std::scanf("%d", &b);
	for (int i = 1; i < N; i++) {
		std::scanf("%d", &n);
		if (b < n) {
			n--;
		}
		if (n < b) {
			std::printf("No\n");
			return 0;
		}
		b = n;
	}
	std::printf("Yes\n");
	return 0;
}

Measured memory_bytes: 128
import java.io.PrintStream;
import java.util.Scanner;

public class Main {
	static PrintStream o = System.out;
	static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		if (sc.nextInt() == 0) {
			o.println(1);
		} else {
			o.println(0);
		}
	}
}

Measured memory_bytes: 35680
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n,m;
    cin >> n >> m;
    vector<int> r(m);
    vector<int> l(m);
    for(int i = 0;i < m;i++){
        cin >> l[i] >> r[i];
    }
    sort(r.begin(),r.end());
    sort(l.begin(),l.end());
    cout << max(0,r[0]-l[m-1]+1) << endl;
}

Measured memory_bytes: 1024
package main

import "fmt"

func main() {
	var x, y int
	fmt.Scan(&x, &y)

	result := "No"

	for i := 0; i <= x; i++ {
		if 2*i+(x-i)*4 == y {
			result = "Yes"
			break
		}
	}
	fmt.Println(result)
}


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

using namespace std;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef vector<ll> vll;

#define repi(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,a) repi(i,0,a)
#define rrep(i,a) for(ll i=a-1;i>=0;i--)
#define MOD 1000000007

//debug
#define debug(arr) cerr<<#arr<<"(l"<<__LINE__<<") : ";for(auto x:arr)cerr<<x<<" ";cerr<<endl;

int main(){
  ll N, Q, a, b, c, ans = 0;
  vll list(100001, 0);
  cin >> N;
  rep(i, N){
    cin >> a;
    list[a]++;
  }
  rep(i, 100001) ans += i * list[i];

  cin >> Q;
  rep(_, Q){
    cin >> b >> c;
    ans += (c - b) * list[b];
    list[c] += list[b];
    list[b] = 0;
    cout << ans << endl;
  }
  return 0;
}



Measured memory_bytes: 3880
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define all(x) x.begin(),x.end()
#define rep(i,j,n) for (long long i = j; i < (long long)(n); i++)
#define _GLIBCXX_DEBUG
const ll MOD = 1000000007;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
//(a+b-1)/b
//priority_queue<ll, vector<ll>, greater<ll>> q;

signed main(){
	//cout << fixed << setprecision(10);
	rep(q,0,100100){
		int a,b; cin>>a>>b;
		if(a==0 && b==0)return 0;
		rep(i,0,a){
			rep(j,0,b){
				if(i==0 || j==0 || i==a-1 || j==b-1)cout<<'#';
				else cout<<'.';
			}
			cout<<endl;
		}
		cout<<endl;
	}


	return 0;
}


Measured memory_bytes: 3128
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<array>
#include<map>
#include<iomanip>
#include<assert.h>
#include<list>
#include<bitset>
#include<stack>
#include<memory>
#include<numeric>
using namespace std;
using namespace std::chrono;
typedef long long int llint;
typedef long double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
/*cout<<fixed<<setprecision(20);cin.tie(0);ios::sync_with_stdio(false);*/
const int mod=1000000 ;
const llint big=2.19e15+1;
const long double pai=3.141592653589793238462643383279502884197;
const long double eps=1e-10;
template <class T,class U>bool mineq(T& a,U b){if(a>b){a=b;return true;}return false;}
template <class T,class U>bool maxeq(T& a,U b){if(a<b){a=b;return true;}return false;}
llint gcd(llint a,llint b){if(a%b==0){return b;}else return gcd(b,a%b);}
llint lcm(llint a,llint b){if(a==0){return b;}return a/gcd(a,b)*b;}
template<class T> void SO(T& ve){sort(ve.begin(),ve.end());}
template<class T> void REV(T& ve){reverse(ve.begin(),ve.end());}
template<class T>llint LBI(const vector<T>&ar,T in){return lower_bound(ar.begin(),ar.end(),in)-ar.begin();}
template<class T>llint UBI(const vector<T>&ar,T in){return upper_bound(ar.begin(),ar.end(),in)-ar.begin();}
//17:00~
/*
222
333
5
7
11

約数は128個
*/
int main(void){
	cout<<fixed<<setprecision(20);cin.tie(0);ios::sync_with_stdio(false);
	int n,i,j,k,Q;cin>>n>>Q;
	int na=n;
	vector<int>r;
	for(i=2;i*i<=na;i++){
		if(n%i>0){continue;}
		int ii=1;
		while(na%i==0){
			na/=i;
			ii*=i;
			r.pub(ii);
		}
	}
	if(na>1){r.pub(na);}
	int m=r.size();
	vector<vector<array<int,26>>>kou(m);
	vector<int>d(m);
	string s;cin>>s;
	for(i=0;i<n;i++){s[i]-='a';}
	for(i=0;i<m;i++){
		int L=n/r[i];
		kou[i].res(L);
		for(j=0;j<r[i];j++){
			for(k=0;k<L;k++){
				if(kou[i][k][s[j*L+k]]==0){d[i]++;}
				kou[i][k][s[j*L+k]]++;
			}
		}
	}
	while(Q--){
		int p;char c;cin>>p>>c;
		p--;c-='a';
		for(i=0;i<m;i++){
			int L=n/r[i];
			kou[i][p%L][s[p]]--;
			if(kou[i][p%L][s[p]]==0){d[i]--;}
			if(kou[i][p%L][c]==0){d[i]++;}
			kou[i][p%L][c]++;
		}
		s[p]=c;
		llint ans=n;
		for(i=0;i<m;i++){
			if(d[i]==n/r[i]){ans=gcd(ans,n/r[i]);}
		}
		cout<<ans<<endl;
	}
	return 0;
}



Measured memory_bytes: 18340
#include <stdio.h>
#include <stdlib.h>

#define MAX 250

struct Node{
  int p;
  int l;
  int r;
};

struct Node T[MAX];

int Parent(int i){
  return i/2;
}
int Left(int i){
  return 2*i;
}
int Right(int i){
  return 2*i+1;
}

int main(void){
  int heap_size,i,key[MAX],left[MAX],right[MAX];

  scanf("%d",&heap_size);

  for(i = 1 ; i <= heap_size ; i++){
    T[i].p = -1;
    T[i].l = -1;
    T[i].r = -1;
  }

  for(i = 1 ; i <= heap_size ; i++){
    scanf("%d",&key[i]);
  }
  
  for(i = 1 ; i <= heap_size ; i++){
    if(i > 1){
      T[i].p = key[Parent(i)];
    } 
    
    left[i] = Left(i);
    if(left[i] <= heap_size){
      T[i].l = key[left[i]]; 
    }
    
    right[i] = Right(i);
    if(right[i] <= heap_size){
      T[i].r = key[right[i]];
    } 
  }
  
  for(i = 1 ; i <= heap_size ; i++){
    printf("node %d: key = %d, ",i,key[i]);
    
    if(i > 1){
      printf("parent key = %d, ",T[i].p);
    }
    if(left[i] <= heap_size){
      printf("left key = %d, ",T[i].l); 
    }
    if(right[i] <= heap_size){
      printf("right key = %d, ",T[i].r);
    } 
    printf("\n");
  }
  return 0;
}

Measured memory_bytes: 0
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

def count_loop(start, idx_map):
    count = 0
    idx = start
    while True:
        idx = idx_map[idx]
        count += 1
        if idx == 0:
            break
    return count

A, B = zip(*sorted(zip(A, B), key=lambda x: x[1]))
idx_map = sorted(range(N), key=lambda i: A[i])
A = sorted(A)

check_1 = all(A[i] <= B[i] for i in range(N))
check_2 = any(A[i + 1] <= B[i] for i in range(N - 1))
check_3 = count_loop(0, idx_map) <= N - 2
print("Yes" if check_1 and (check_2 or check_3) else "No")


Measured memory_bytes: 101096
#include<string>
#include<string.h>
#include<map>
#include<set>
#include<vector>
#include<stdio.h>
#include<math.h>
#include<iostream>
#include<algorithm>
#include<queue>
using namespace std; 
int a[110];
int main(){
int n;
int d;
int s=0;
cin>>n;
for (int i=1;i<=n;i++){
  cin>>d;
  a[d]++;
}
for (int i=1;i<=100;i++)
{
  if (a[i]>=1) s++;
}
cout<<s<<endl;
return 0;
}

Measured memory_bytes: 256
Imports System

Module Program
    Sub Main(args As String())
        Dim S As String = Console.ReadLine()
        Dim T As String = Console.ReadLine()

        Dim ans As Integer = 0
        For i As Integer = 1 To Len(S)
            If Mid(S, i, 1) <> Mid(T, i, 1) Then
                ans += 1
            End If
        Next

        Console.WriteLine(ans)

    End Sub
End Module


Measured memory_bytes: 37524
function Main(input) {
  	var input = input.split("\n");
	var people_item = input[0].split(" ");
    var array=[];
  //偶数行の場合は、すぬけの番号を取得して配列に追加
    for(var i=1; i<input.length; i++){
      if(i%2===0){
        var leng = input[i].split(" ");
        for(var j=0; j<leng.length; j++){
          array.push(leng[j]);
         } 
       }
     }
  //取得した配列をsetする
      var set = new Set(array);
      var num=0
  //setに居ないすぬけを見つけたら、numを増やす
      for(var k=1; k<=people_item[0]; k++){
        if(set.has(String(k))===false){
        num=num+1;
        }
      }
  
   console.log(num);
  }
    
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 30360
#include <bits/stdc++.h>
#define DUMP(x)  cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define IFOR(i, m, n) for(int i = n - 1; i >= m; i-- )
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define FOREACH(x,a) for(auto& (x) : (a) )
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
const ll INF = 1e18;
/* テンプレートここまで */

int main() {
  ll n; cin >> n;
  ll k=1;
  while(k<=n){
    k *= 2;
  }
  cout << k/2 << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <list>
#include <queue>
#include <algorithm>
#include <cassert>
#include <string>
#include <climits>
#include <numeric>

#define all(x) begin(x),end(x)

using namespace std;
using ll = long long;

int main() {
  int n;
  string s;
  cin >> n >> s;
  if (n % 2 == 1) {
    cout << "No" << endl;
    goto out;
  } else {
    bool t = false;
    for (int i = 0; i < n / 2; i++) {
        if (s[i] != s[i + (n/2)]) {
          cout << "No" << endl;
          goto out;
        }
    }
  }
  cout << "Yes" << endl;
out:
  return 0;
}


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

int main(void){
	int a=0, b=1, n;
	cin>>n;
	if (n<0) return NULL;

	for (int i=-1; i<n; i++){
		a += b;
		swap(a,b);
	}
	cout<<a<<endl;
	return 0;
} 

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

int main()
{
    ll n, l;
    cin >> n >> l;
    ll a[n], ans = 0;
    rep(i, n)
    {
        a[i] = i + l;
        ans += a[i];
    }
    if (-1 * n >= l)
        ans -= a[n - 1];
    else if (l > 0)
        ans -= a[0];

    cout << ans << endl;
    return 0;
}

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

int main() {
  string s;
  cin >> s;
  int cnt = 0;
  bool flag = true;
  int maxm = 0;

  rep(i, s.size()) {
    if(s[i] == 'A'||s[i] == 'T'||s[i] == 'C'||s[i] =='G') {
      flag = false;
      cnt++;
      maxm = max(maxm, cnt);
    }
    else flag = true;
    if(flag) cnt = 0;
  }
  cout << maxm << endl;
}

Measured memory_bytes: 3604