akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <sstream>

#include <string>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <deque>
#include <queue>
#include <stack>

#include <algorithm>
#include <utility>
#include <numeric>
#include <functional>

#include <chrono>
#include <random>

using namespace std;
using i64 = int_fast64_t;
using ui64 = uint_fast64_t;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<i64>;
using vvl = vector<vl>;
using vd = vector<double>;
using vvd = vector<vd>;
using vb = vector<bool>;
using vvb = vector<vb>;
using pii = pair<int, int>;
using pll = pair<i64, i64>;

//////////////////////////////////////////////////

int main(){
    int n;
    cin >> n;
    // if(n % 100 > 12 && n / 100 > 12)cout << "NA" << endl;
    // else if(n / 100 <= 12 && n % 100 <= 12)cout << "AMBIGUOUS" << endl;
    // else if(n / 100 > 12 && n % 100 <= 12 && n % 100 > 0)cout << "YYMM" << endl;
    // else if(n % 100 > 12 && n / 100 <= 12 && n / 100 > 0)cout << "MMYY" << endl;
    // else cout << "NA" << endl;
    if(n / 100 == 0){
        if(n % 100 > 0 && n % 100 <= 12) cout << "YYMM" << endl;
        else cout << "NA" << endl;
    }
    else if(n / 100 <= 12){
        if(n % 100 == 0)cout << "MMYY" << endl;
        else if(n % 100 <= 12) cout << "AMBIGUOUS" << endl;
        else cout << "MMYY" << endl;
    }
    else{
        if(n % 100 == 0 || n % 100 > 12)cout << "NA" << endl;
        else cout << "YYMM" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("O3")
//#pragma GCC target("avx")
#include <bits/stdc++.h>
using namespace std;
#define re return
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define make_unique(x) sort(all(x)),x.resize(unique(all(x))-x.begin())
#define fi first
#define se second
#define ss second.second
#define sf second.first
#define ff first.first
#define fs first.second
#define sqrt(x) sqrt(abs(x))
#define mp make_pair
#define PI 3.14159265358979323846
#define E 2.71828182845904523536
#define er erase
#define in insert
#define fo(i,n) for((i)=0;(i)<(n);(i)++)
#define ro(i,n) for((i)=n-1;(i)>=0;(i)--)
#define fr(i,j,n) for((i)=(j);(i)<(n);(i)++)
#define rf(i,j,n) for((i)=((n)-1);(i)>=(j);(i)--)
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int uint;
    const int N=(int)1e6+100;
    const int M=(int)2e6+100;
    const int inf=(int)1e9+100;
#define filename ""

int main()
{
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    //freopen(filename".in","r",stdin);
    //freopen(filename".out","w",stdout);
    //freopen("ans.txt","w",stdout);
    mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
    srand(time(0));
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    ld a;
    cin>>a;
    cout<<setprecision(60)<<2*a*PI;
}


Measured memory_bytes: 3800
#include <iostream>
using namespace std;
int main() {
	int r;
	cin >> r;
	if (r < 1200) cout << "ABC\n";
	else if (r >= 1200 && r < 2800) cout << "ARC\n";
	else cout << "AGC\n";
	//system("pause");
	return 0;
}

Measured memory_bytes: 256
import sys
import bisect


MAX = 100001
prime = [-1] * MAX
i = 2
p = []
while MAX > i:
	if prime[i - 1] == -1:
		prime[i - 1] = 0
		p.append(i)
		temp = i * 2
		while temp < MAX:
			prime[temp - 1] = 1
			temp += i
	if i == 2:
		i += 1
	else:
		i += 2


while True:
    m, a, b = map(int, sys.stdin.readline().split())
    if m == 0:
        break
    cand = (-1, -1, -1)
    for q in p:
        idx = bisect.bisect_right(p, min(m / q, q)) - 1
        if idx == -1:
            continue
        value = p[idx]
        if value >= float(a) / b * q and cand[0] < q * value and value <= q:
            cand = (q * value, value, q)
    print cand[1], cand[2]

Measured memory_bytes: 5332
#include <iostream>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
#include <queue>
#include <cmath>
#include <string>

using namespace std;

int main() {
	int h, w;
    cin >> h >> w;
    vector<string> s(h);
    vector<vector<int>> ans_h(h, vector<int>(w, 0));
    vector<vector<int>> ans_w(h, vector<int>(w, 0));
    for (int i=0; i<h; i++) {
        cin >> s[i];
        for (int j=0; j<w; j++) {
            if (s[i][j] == '#') continue;
            int cnt = 0;
            while (j+cnt < w && s[i][j+cnt] == '.')
                cnt++;
            for (int k=j; k<j+cnt; k++)
                ans_w[i][k] = cnt;
            j += cnt-1;
        }
    }

    for (int i=0; i<w; i++) {
        for (int j=0; j<h; j++) {
            if (s[j][i] == '#') continue;
            int cnt = 0;
            while (j+cnt < h && s[j+cnt][i] == '.')
                cnt++;
            for (int k=j; k<j+cnt; k++)
                ans_h[k][i] = cnt;
            j += cnt-1;
        }
    }

    int ans = 0;
    for (int i=0; i<h; i++) {
        for (int j=0; j<w; j++) {
            ans = max(ans, ans_w[i][j] + ans_h[i][j] - 1);
        }
    }

    cout << ans << endl;
}


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

ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

template<class T>
    bool chmin(T& a, T b) {
        if (a > b) {
            a = b;
            return true;
        }
        return false;
}
template<class T> 
    bool chmax(T& a, T b) {
        if (a < b) {
            a = b;
            return true;
        }
        return false;
}

const ll INF = 1e10;;

int main(){
    ll N,W;
    cin >> N >> W;
    vector<ll> w(N);
    vector<ll> v(N);
    rep(i,N) cin >> w[i] >> v[i];

    ll maxValue = (N+5)*1e3;
    vector<vector<ll>> dp(N+5,vector<ll>(maxValue+5,INF));

    dp[0][0]=0;

    rep(i,N){
        rep(sum_v,maxValue+1){
            if(sum_v - v[i] >= 0){
                chmin(dp[i+1][sum_v] , dp[i][sum_v - v[i]] + w[i]);
            }

            chmin(dp[i+1][sum_v] , dp[i][sum_v]);
        }
    }

    ll ans = 0;
    rep(i,maxValue){
        if(dp[N][i] > W){
            continue;
        }else{
            ans = i;
        }
    }

    cout << ans << endl;
    // rep(i,N+1)rep(j,maxValue+1){
    //     cout << dp[i][j] << " ";
    //     if(j==W)cout << endl;
    // }

    return 0;
}

Measured memory_bytes: 87552
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

public class Main {

	static Scanner scanner;
	public static void main(String[] args) {
	    scanner = new Scanner(System.in);

	    int n=gi();
	    int y=gi();
	    
	    for (int i=0; i<=n;i++) {
	    	for (int j=0; j<=n-i; j++) {
	    		if (10000*i+5000*j+1000*(n-i-j) == y) {
	    			System.out.println(i + " " + j+ " "+ (n-i-j));
	    			return;
	    		}
	    	}
	    }
	    System.out.println("-1 -1 -1");
//	    if (isNumber(s1) && isNumber(s2) && s.charAt(a) == '-') {
//	    	System.out.print("Yes");
//	    }else {
//	    	System.out.print("No");
//	    }



	}

public static boolean isNumber(String val) {
	try {
		Integer.parseInt(val);
		return true;
	} catch (NumberFormatException nfex) {
		return false;
	}
}

	public static int d(int n) {
		int m=0;
		while(true) {
			if(n<1) {
				break;
			}
			int l= n%10;
			m+=l;
			n= (n-l)/10;
		}
		return m;
	}
	public static long d(long n) {
		String a=String.valueOf(n);
		return (long)a.length();
	}

	// 文字列として入力を取得
	public static String gs() {
		return scanner.next();
	}

	// intとして入力を取得
	public static int gi() {
		return Integer.parseInt(scanner.next());
	}

	// longとして入力を取得
	public static long gl() {
		return Long.parseLong(scanner.next());
	}

	// doubleとして入力を取得
	public static double gd() {
		return Double.parseDouble(scanner.next());
	}
}

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

int main(void){
   
   int X,A,B;
   cin >> X >> A >> B;
   X-= A;
   
   while(1){
       if(X - B < 0) break;
       X -= B;
   }
   
   cout << X << endl;
}

Measured memory_bytes: 3572
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007

long long dp[310][310][310];

struct Query {
    int l, r, x;
    Query(int l, int r, int x) : l(l), r(r), x(x) {}
};

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n, m; cin >> n >> m; n += 3;
    vector<Query> qv;
    for (int i = 0; i < m; i++) {
        int l, r, x; cin >> l >> r >> x;
        qv.emplace_back(l+2, r+2, x);
    } 
    sort(qv.begin(), qv.end(), [&](Query a, Query b) { return a.r < b.r; });
    int qvi = 0;
    dp[0][1][2] = 1;
    for (int i = 3; i < n; i++) {
        for (int j = 0; j < i-1; j++) {
            for (int k = j+1; k < i-1; k++) {
                // dp[j][k][i-1];
                dp[k][i-1][i] = (dp[k][i-1][i] + dp[j][k][i-1]) % mod;
                dp[j][i-1][i] = (dp[j][i-1][i] + dp[j][k][i-1]) % mod;
                dp[j][k][i] = (dp[j][k][i] + dp[j][k][i-1]) % mod;
            }
        }

        while (qvi != m && qv[qvi].r == i) {
            int l = qv[qvi].l, x = qv[qvi].x;
            for (int j = 0; j < i; j++) {
                for (int k = j+1; k < i; k++) {
                    if (x == 3) {
                        if (!(l <= j)) dp[j][k][i] = 0;
                    } else if (x == 2) {
                        if (!(j < l && l <= k)) dp[j][k][i] = 0;
                    } else if (x == 1) {
                        if (!(k < l)) dp[j][k][i] = 0;
                    }
                }
            }
            qvi++;
        }
    }
    long long ans = 0;
    for (int i = 0; i < n-1; i++) {
        for (int j = i+1; j < n-1; j++) {
            ans = (ans + dp[i][j][n-1]) % mod;
        }
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 227712
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int q = sc.nextInt();
        String s = sc.next();

        int[] cumSum = new int[n + 1];
        for (int i = 0; i < n; ++i) {
            if (i != n - 1 && s.charAt(i) == 'A' && s.charAt(i+1) == 'C') cumSum[i + 1] = cumSum[i] + 1;
            else cumSum[i + 1] = cumSum[i];
        }


        for (int i = 0; i < q; ++i) {
            int a = sc.nextInt();
            int b = sc.nextInt();
            System.out.println(cumSum[b - 1] - cumSum[a - 1]);
        }
    }
}

Measured memory_bytes: 64504
import sys

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

ans = [0 for _ in range(n)]

for i in range(n):
    dis = sys.maxsize
    for j in range(m):
        abs_dis = abs(ab[i][0] - cd[j][0]) + abs(ab[i][1] - cd[j][1])
        if dis > abs_dis:
            ans[i] = j + 1
            dis = abs_dis

for n in range(len(ans)):
    if n == len(ans) - 1:
        print(ans[n], end="")
    else:
        print(ans[n])


Measured memory_bytes: 3064
program main
   implicit none
   integer(8) ::n,m
   integer(8) i
   integer(8),allocatable,dimension(:)::x,sa
   read(*,*)n,m
   allocate(x(m),sa(m-1))
   read(*,*)x
   call heapsort(m,x)
   if(m>=2)then
   do i=1,m-1
      sa(i)=x(i+1)-x(i)
   enddo
   call heapsort(m-1,sa)
   if(m<=n)then
      write(*,*)0
   else   
      write(*,*)sum(sa(1:m-n))
   endif
   else
      write(*,*)"0"
   endif
contains
subroutine heapsort(n,array)
  implicit none
  integer(8),intent(in) :: n
  integer(8),intent(inout) :: array(1:n)
  
  integer(8) ::i,k,j,l
  integer(8) :: t
  
  if(n.le.0)then
     write(6,*)"Error, at heapsort"; stop
  endif
  if(n.eq.1)return

  l=n/2+1
  k=n
  do while(k.ne.1)
     if(l.gt.1)then
        l=l-1
        t=array(L)
     else
        t=array(k)
        array(k)=array(1)
        k=k-1
        if(k.eq.1) then
           array(1)=t
           exit
        endif
     endif
     i=l
     j=l+l
     do while(j.le.k)
        if(j.lt.k)then
           if(array(j).lt.array(j+1))j=j+1
        endif
        if (t.lt.array(j))then
           array(i)=array(j)
           i=j
           j=j+j
        else
           j=k+1
        endif
     enddo
     array(i)=t
  enddo

  return
end subroutine heapsort
end program main


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

int main(){
    int h, w, k, Min = 100000000;
    cin >> h >> w >> k;
    char s[h][w];
    for(int i=0; i<h; i++){
        for(int j=0; j<w; j++){
            cin >> s[i][j];
        }
    }
    for(int i=0; i < (1 << h-1); i++){
        bool line[h];
        int count=0;
        fill(line, line+h, false);
        for(int j=0; j<h-1; j++){
            if(i >> j & 1) {
                line[j] = true;
                count++;
            }
        }
        int sum[h];
        fill(sum, sum+h, 0);
        for(int m=0; m<w; m++){
            int l=0, a[h];
            fill(a, a+h, 0);
            for(int j=0; j<h; j++){
                if(s[j][m] == '1') {
                    a[l]++;
                    if(a[l]+sum[l] > k) {
                        fill(sum, sum+h, 0);
                        count++;
                    }
                }
                if(line[j]) l++; 
            }
            for(int j=0; j<h; j++){
                sum[j] += a[j];
            }
        }
        Min = min(Min, count);
    }
    cout << Min << endl;
}

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

int s1[maxn],s2[maxn];
int n,l,r,mid;
int x,y;
long long ans;
int main(){
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>x;
		s1[i]=s1[i-1]+x;
		s2[i]=s2[i-1]^x;
	}
	
	for(int i=1;i<=n;i++){
		l=i,r=n+1;
		while(l+1<r){
			mid=l+r>>1;
			x=s1[mid]-s1[i-1];
			y=s2[mid]^s2[i-1];
			if(x==y)l=mid;else r=mid;
		}
		ans=ans+1ll*(l-i+1);
	}
	
	cout<<ans<<endl;
}

Measured memory_bytes: 1792
#include<iostream>
#include<cstdio>
using namespace std;
const int mod=1e9+7;
int n,k,ans,f[202019];
int fpow(int x,int y){
	int res=1;
	for(;y;y>>=1,x=1ll*x*x%mod)
		if(y&1)res=1ll*res*x%mod;
	return res;
}
int main()
{
	scanf("%d%d",&n,&k);
	for(int i=k;i>=1;i--){
		f[i]=fpow(k/i,n);
		for(int j=i+i;j<=k;j+=i)
			f[i]=(f[i]-f[j])%mod;
		ans=(ans+1ll*f[i]*i%mod)%mod;
	} cout<<(ans+mod)%mod<<endl;
	return 0;
}

Measured memory_bytes: 4024
N = int(input())

C = {}
for i in range(N):
  city, score = input().split(' ')
  score = int(score)
  if city not in C:
    C[city] = []
  C[city].append({'score':score,'idx':i})
  
for p in sorted(C.keys()):
  for k in sorted(C[p],key=lambda x:x['score'],reverse=True):
    print(k['idx']+1)

Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {
    private static final int MAXSIZE = 200000;

    public static void main(String[] args) {
        int[] R = new int[MAXSIZE];

        Scanner sc = new Scanner(System.in);
        int rLength = sc.nextInt();

        for (int idx = 0; idx < rLength; idx++) {
            R[idx] = sc.nextInt();
        }

        int res = Integer.MIN_VALUE;
        int currMin = R[0];
        for (int idx = 1; idx < rLength; idx++) {
            res = Math.max(res, R[idx] - currMin);
            currMin = Math.min(currMin, R[idx]);
        }

        System.out.println(res);
    }
}


Measured memory_bytes: 100536
import sys
import math
import collections
import itertools
import array
import inspect

# Set max recursion limit
sys.setrecursionlimit(1000000)


# Debug output
def chkprint(*args):
    names = {
        id(v): k
        for k, v in inspect.currentframe().f_back.f_locals.items()
    }
    print(', '.join(
        names.get(id(arg), '???') + ' = ' + repr(arg) for arg in args))


# Binary converter
def to_bin(x):
    return bin(x)[2:]


def li_input():
    return [int(_) for _ in input().split()]


def gcd(n, m):
    if n % m == 0:
        return m
    else:
        return gcd(m, n % m)


def gcd_list(L):
    v = L[0]

    for i in range(1, len(L)):
        v = gcd(v, L[i])

    return v


def lcm(n, m):
    return (n * m) // gcd(n, m)


def lcm_list(L):
    v = L[0]

    for i in range(1, len(L)):
        v = lcm(v, L[i])

    return v


# Width First Search (+ Distance)
def wfs_d(D, N, K):
    """
    D: 隣接行列(距離付き)
    N: ノード数
    K: 始点ノード
    """

    dfk = [-1] * (N + 1)
    dfk[K] = 0

    cps = [(K, 0)]
    r = [False] * (N + 1)
    r[K] = True
    while len(cps) != 0:
        n_cps = []
        for cp, cd in cps:
            for i, dfcp in enumerate(D[cp]):
                if dfcp != -1 and not r[i]:
                    dfk[i] = cd + dfcp
                    n_cps.append((i, cd + dfcp))
                    r[i] = True

        cps = n_cps[:]

    return dfk


# Depth First Search (+Distance)
def dfs_d(v, pre, dist):
    """
    v:  現在のノード
    pre: １つ前のノード
    dist: 現在の距離

    以下は別途用意する
    D: 隣接リスト(行列ではない)
    D_dfs_d: dfs_d関数で用いる，始点ノードから見た距離リスト
    """

    global D
    global D_dfs_d

    D_dfs_d[v] = dist

    for next_v, d in D[v]:
        if next_v != pre:
            dfs_d(next_v, v, dist + d)

    return


def sigma(N):
    ans = 0
    for i in range(1, N + 1):
        ans += i
    return ans


class Combination:
    def __init__(self, n, mod):

        g1 = [1, 1]
        g2 = [1, 1]
        inverse = [0, 1]
        for i in range(2, n + 1):
            g1.append((g1[-1] * i) % mod)
            inverse.append((-inverse[mod % i] * (mod // i)) % mod)
            g2.append((g2[-1] * inverse[-1]) % mod)
        self.MOD = mod
        self.N = n
        self.g1 = g1
        self.g2 = g2
        self.inverse = inverse

    def __call__(self, n, r):
        if (r < 0 or r > n):
            return 0
        r = min(r, n - r)
        return self.g1[n] * self.g2[r] * self.g2[n - r] % self.MOD


# --------------------------------------------

dp = None


def main():
    S = input()

    while len(S) >= 5:
        if len(S) >= 7 and S[-7:] == "dreamer":
            S = S[:-7]
            continue

        if len(S) >= 6 and S[-6:] == "eraser":
            S = S[:-6]
            continue

        elif S[-5:] == "dream" or S[-5:] == "erase":
            S = S[:-5]
            continue

        else:
            break

    if len(S) == 0:
        print("YES")
    else:
        print("NO")


main()


Measured memory_bytes: 4976
import numpy as np
import math

A, B = list(map(int, input().split()))

answer = -1
for i in range(1000, 1, -1):
    check1 = math.floor(i * 0.08)
    check2 = math.floor(i * 0.1)
    if ((check1 == A) & (check2 == B)):
        answer = i
print(answer)

Measured memory_bytes: 21276
#include<bits/stdc++.h>
#include<cstdio>
using namespace std;
int main()
{
	int a,b;
	cin>>a>>b;
	if(b-a>=2019)
	{
		cout<<0<<endl;
		return 0;
	}
	long long min_ans=2019;
	for(int i=a;i<b;i++)
		for(int j=i+1;j<=b;j++)
			if(((i%2019)*(j%2019))%2019<min_ans)
				min_ans=((i%2019)*(j%2019))%2019;
	cout<<min_ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<unordered_map>
using namespace std;
using Graph = vector<vector<int>>;
#define ll long long
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for(ll i = 0; i < n; i++)
const ll INF = 1LL << 60;


//C DFSでもできる
int main(){
    ll N, K;
    cin >> N >> K;
    vector<int> a(N + 1);
    rep(i, N)cin >> a[i + 1];
    vector<bool> seen(N + 1, false);
    vector<int> path;
    seen[1] = true;
    int pos = 1;
    path.push_back(1);
    rep(i, N){
        pos = a[pos];
        if(seen[pos] == true){//ループ発見
            break;
        }
        seen[pos] = true;
        path.push_back(pos);
    }
    auto itr = find(all(path), pos) - path.begin();
    int loop = path.size() - itr;
    if(K <= itr){
        cout << path[K] << endl;
        return 0;
    }
    K -= itr;
    cout << path[itr + K % loop] << endl;
}

Measured memory_bytes: 5116
n=int(input())
p=list(map(int,input().split()))
res=0
for i in range(n):
    if i==n-1:
        if p[i]==i+1:
            p[i],p[i-1]=p[i-1],p[i]
            res+=1
    elif p[i]==i+1:
        p[i],p[i+1]=p[i+1],p[i]
        res+=1
print(res)

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

//#define int long long
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rep1(i,n) for(int i=1;i<=(int)(n);++i)
#define rep11(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define repm(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define pb(n) push_back(n)
#define mp make_pair
#define MOD 1002000007
#define INF LONG_LONG_MAX


int main(){
    int n;
    cin>>n;
    long long h[n];
    for (int i=0; i<n; i++){
        cin>>h[i];
    }
    string flag="Yes";
    for (int i=1; i<n; i++){
        if (h[i-1]<=h[i]-1){
            h[i]-=1;
        }
        else if(h[i-1]==h[i]){
        }
        else{
            flag="No";
        }
    }
    cout<<flag<<endl;
}

Measured memory_bytes: 1024
using System; using System.Collections.Generic;
class A {
	static void Main() {

		var list = new List<Char>();
		list.AddRange(Console.ReadLine().ToCharArray());
		list.Add('a');
		for(int i = list.Count-1;i >= 0;i--) {
			if(list[i] == 'S' && list[i + 1] == 'T') {
				list.RemoveRange(i,2);
			}
		}
		Console.Write(list.Count-1);
	}
}

Measured memory_bytes: 5464
#include<bits/stdc++.h>
#define F first
#define S second
#define MP make_pair
#define pb push_back
#define endl '\n'

using namespace std;

typedef long long LL;
typedef pair< int, int > P;
typedef pair< LL, LL > LP;
typedef pair< int, P > iP;
typedef pair< P, P > PP;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1000000007;

int dx[] = {0, -1, 1, 0};
int dy[] = {-1, 0, 0, 1};

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    string s;
    cin >> s;
    int cnt = 0;
    for( int i = 1; i < s.size(); ++i ) {
        if( s[i] == s[i - 1] ) {
            if( s[i - 1] == '0' ) s[i] = '1';
            else s[i] = '0';
            ++cnt;

        }
    }
    cout << cnt << endl;
    return 0;
}



Measured memory_bytes: 512
#include <iostream>
#include <algorithm>
#include <vector>
 
using namespace std;
 
struct Node {
    int name;
    int pen;
    int ac;
    vector<int> wa;
    Node(int n, int P) : name(n), pen(0), ac(0), wa(P, 0) { }
    // 0origin
    void accept(int i, int t) {
        ac++;
        pen += wa[i] * 20 + t;
    }
 
    void wrong(int i) {
        wa[i]++;
    }
 
    bool operator <(const Node & n) const {
        if(ac != n.ac) return ac > n.ac;
        if(pen != n.pen) return pen < n.pen;
        return name > n.name;
    }
 
    bool same(const Node & n) const {
        return ac == n.ac && pen == n.pen;
    }
};
 
int main() {
    for(int M, T, P, R; cin >> M >> T >> P >> R, M || T || P || R; ) {
        vector<Node> vec;
        for(int i = 0; i < T; i++) vec.push_back(Node(i+1, P));
        for(int i = 0; i < R; i++) {
            int m, t, p, j; cin >> m >> t >> p >> j;
            t--;
            p--;
            if(j == 0) {
                vec[t].accept(p, m);
            }
            else {
                vec[t].wrong(p);
            }
        }
        sort(vec.begin(), vec.end());
        cout << vec[0].name;
        for(int i = 1; i < (int)vec.size(); i++) {
            if(vec[i - 1].same(vec[i])) cout << "=";
            else cout << ",";
            cout << vec[i].name;
        }
        cout << endl;
    }
}
 

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

int main() {
	string S;
	cin >> S;
	sort(S.begin(), S.end());
	char judge = 'a' - 1, sc = ' ';
	rep(i, S.size()) {
		if (S.at(i) != sc) {
			sc = S.at(i);
			judge++;
		}
		if (sc != judge) {
			cout << judge << endl;
			return 0;
		}
	}
	if (judge != 'z') printf("%c\n", judge + 1);
	else puts("None");
	return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define sz(x) (int)((x).size())
#define debug(x) cout << #x << ":" << x << ' ';
#define debugg(x) cout << #x << ":" << x << ' ' << "\n";
#define endl "\n"
#define L(X) ((X)<<1)
#define R(X) (((X)<<1)|1)
#define M(X,Y) (((X)+(Y))>>1)

using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

const int MAXN = 1e5 + 5;
const int MOD = 1e9 + 7;
const int INF = 0x3f3f3f3f;
const long long int LLINF = 0x3f3f3f3f3f3f3f3f;
const double EPS = 1e-9;
const double PI = acos(-1);

template<typename T>   T max_self(T& a, T b) { if (a < b) a = b; return a; }
template<typename T>   T min_self(T& a, T b) { if (a > b) a = b; return a; }
template<typename T>   T add(T x, T y) { return ((x % MOD)  + (y % MOD)) % MOD;}
template<typename T>   T mul(T x, T y) { return ((x % MOD) * (long long)(y % MOD)) % MOD;}
template<typename T>   T sub(T x, T y) { return add(x, -y + MOD);}
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 / gcd(a, b) * b;}
template<typename T>   vector<T> read(vector<T>& v, int n) {v.resize(n); for (auto &x : v)cin >> x;}
template<typename T>   void trav(vector<T> &v) {for (int i = 0 ; i < (int)v.size() ; ++i) {cout << v[i]; if (i != (int)v.size() - 1) cout << ' ';}}
int lg2(long long x)   {   return 64 - __builtin_clzll(x) - 1;	}
int lg2(int x)   {   return 32 - __builtin_clz(x) - 1;	}


//Variables Declaration


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

	ull N,K;
	cin>>N>>K;
	cout<<min(N%K, K-N%K);
	return 0;
}


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

public class Main {
	@SuppressWarnings("unchecked")
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		V = sc.nextInt();
		E = sc.nextInt();
		g = new ArrayList[V];
		for (int i = 0; i < V; ++i)
			g[i] = new ArrayList<>();

		for (int i = 0; i < E; ++i) {
			int s = sc.nextInt();
			int t = sc.nextInt();
			g[s].add(t);
		}

		vis = new boolean[V];
		ord = new int[V];

		topologialSort();

		for (int i = V - 1; i >= 0; --i) {
			System.out.println(ord[i]);
		}

	}

	static ArrayList<Integer>[] g;
	static boolean[] vis;
	static int V, E;
	static int[] ord;
	static int now = 0;

	static void topologialSort() {
		for (int i = 0; i < V; ++i) {
			if (!vis[i])
				dfs(i, -1);
		}
	}

	static void dfs(int cur, int pre) {
		for (int to : g[cur]) {
			if (!vis[to] && pre != cur)
				dfs(to, cur);
		}
		vis[cur] = true;
		ord[now++] = cur;
	}
}

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

int main() {
  string s; cin >> s;
  int q; cin >> q;
  
  int rev_c = 0;
  
  string mae,ato;
  
  for(int i=0; i<q; i++){
    int t; cin >> t;
    
    if(t==1){
      rev_c = (rev_c +1)%2;
    }
    
    else{
      int f; cin >> f;
      string c; cin >> c;
      if((rev_c + f)%2 == 1){
        mae = c + mae;
      }
      else{
        ato = ato + c;
      }
    }
  }
  string ans;
  if(rev_c%2 == 0){
    ans = mae + s + ato;
  }
  else{
    reverse(s.begin(),s.end());
    reverse(mae.begin(),mae.end());
    reverse(ato.begin(),ato.end());
    
    ans = ato + s + mae;
  }
  
  cout << ans << endl;
}
    
      

Measured memory_bytes: 1544
import java.io.IOException;
public class Main {
	public static void main(String[] args) throws IOException {
		char moji[]=new char[11];
		int count[]=new int[11];
		for(int i=0;i<10;i++) {
			moji[i]=(char)System.in.read();
			if(moji[i]=='\n') {
				break;
			}
		}
		for(int i=0,j=0;i<moji.length;i++,j++) {

			while(moji[i]=='A'||moji[i]=='C'||moji[i]=='G'||moji[i]=='T') {
				count[j]++;
					i++;
			}
		}
		int max=0;
		for(int i=0;i<count.length;i++) {
			if(max<count[i]) {
				max=count[i];
			}
		}
		System.out.println(max);
	}
}

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


class Primes {
public:
	int size;
	vector<int> v, primes;
	Primes(int _size) : size(_size), v(_size,0), primes(){
		int sqrtsize = (int)sqrt((double)_size);
		
		for ( int i = 2; i < size; i++ ){
			if ( v[i] )
				continue;
			primes.push_back(i);
			if ( i <= sqrtsize )
				for ( int j = i*i; j < _size; j+=i )
					v[j] = 1;
		}
	}
	
	// map<prime,pow>
	map<int,int> factor(ll x){
		map<int,int> m;
		for ( auto it : primes ){
			int prime = it;
			if ( x < prime )
				break;
			
			int count = 0;
			while ( x % prime == 0 ){
				x /= prime;
				count++;
			}
			if ( count )
				m[prime] = count;
		}
		if ( x != 1 )
			m[x] = 1;
		return m;
	}
	
	
	vector<pair<int,int>> factorv(ll x){
		auto m = factor( x );
		vector<pair<int,int>> v;
		for ( auto it : m ){
			v.push_back({it.first,it.second});
		}
		return v;
	}
	
	// 約数を求める
	vector<int> divisor( ll x ){
		auto v = factorv( x );
		vector<int> div;
		divisor2( div, v, 0, 1 );
		sort(div.begin(), div.end());
		return div;
	}
	
	void divisor2( vector<int> &div, vector<pair<int,int>> &v, int i, int mul ){
		for ( int j = 0; j <= v[i].second; j++ ){
			if ( i == v.size()-1 ){
				div.push_back(mul);
			}
			else {
				divisor2( div, v, i+1, mul );
			}
			mul *= v[i].first;
		}
	}
};




int N;
vector<ll> A, B;



int main2(){
	
	cin >> N;
	A.resize(N+1);
	B.resize(N+1);
	
	for ( int i = 0; i < N; i++ ){
		cin >> A[i];
	}
	for ( int i = 0; i < N; i++ ){
		cin >> B[i];
	}
	A[N] = A[0];
	B[N] = B[0];
	
	
	vector<ll> AA(N), BB(N);
	for ( int i = 0; i < N; i++ ){
		AA[i] = A[i] ^ A[i+1];
		BB[i] = B[i] ^ B[i+1];
	}
	
	
	// A, Bの周期を調べる
	Primes p(200000);
	auto divs = p.divisor(N);
	
	int min_k = N;
	for ( int kk = 0; kk < divs.size(); kk++ ){
		int k = divs[kk];
		bool match = true;
		for ( int i = 0; i < N; i++ ){
			if ( A[i] != A[(i+k)%N] || B[i] != B[(i+k)%N] ){
				match = false;
				break;
			}
		}
		if ( match ){
			min_k = k;
			break;
		}
	}
	
	
	int offset = 0;
	vector<pair<int,int>> result;
	for ( int k = 0; k < min_k; k++ ){
		bool match = true;
		for ( int i = 0; i < min_k; i++ ){
			if ( AA[(i+offset+k)%N] != BB[(i+offset)%N] ){
				match = false;
				offset = (offset+N+i-1)%N;
				break;
			}
		}
		if ( match ){
			result.push_back({k,A[k]^B[0]});
		}
	}
	for ( int k = 0; k < N; k += min_k ){
		for ( auto it: result ){
			cout << (k+it.first) << " " << it.second << endl;
		}
	}
	
	
	return 0;
}

int main(){
	int result = main2();
	return 0;
}




Measured memory_bytes: 10752
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
#define f(i,a,b,c) for(ll i=a;i<b;i+=c)
#define r(i,a,b,c) for(ll i=a;i>=b;i-=c)
#define mod 1000000007

int main(){
    ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    ll k; cin >> k;
    ll c=0;
    bool flag=0;
    while(k--){
    	ll n,m; cin >> n >> m;
    	if(n==m) c++;
    	if(n!=m) c=0;
    	if(c==3) {
    		flag=1;
    		break;
    	}
    	else flag=0;
    }
    if(flag) cout << "Yes";
    else cout << "No";
    return 0;
}

Measured memory_bytes: 3636
#include<iostream>
#include<vector>
#include<sstream>
#include<string>
using namespace std;
int main(){
  string str;getline(cin,str);stringstream ss(str);
  vector<string> v;vector<int> n;
  while(ss >> str){
    bool f=0;
    for(int i=0;i<v.size();i++){
      if(str==v[i]) {
	n[i]++;f=1;
      }
    }
    if(!f){
      v.push_back(str);
      n.push_back(1);
    }
  }
  str="";int c=0;
  for(int i=0;i<v.size();i++){
    if(c<n[i]) c=n[i];
  }
  for(int i=0;i<v.size();i++){
    if(n[i]==c) cout << v[i];
    if(str.size()<v[i].size()) str=v[i];
  }cout << " " << str << endl;
}


Measured memory_bytes: 3072
#include <iostream>

using namespace std;
#define MAX 26
#define NIL -1
struct Node{
    int p,l,r;
};
Node T[MAX];
int n;
void preTW(int u){
    if(u!=NIL){
        cout<<" "<<u;
        preTW(T[u].l);
        preTW(T[u].r);
    }
}
void inTW(int u){
    if(u!=NIL){

        inTW(T[u].l);
        cout<<" "<<u;
        inTW(T[u].r);
    }
}
void postTW(int u){
    if(u!=NIL){

        postTW(T[u].l);
        postTW(T[u].r);
        cout<<" "<<u;
    }
}
int main()
{
    cin>>n;
    for(int i=0;i<n;i++){
        T[i].p = T[i].l = T[i].r = NIL;
    }
    for(int i=0;i<n;i++){
        int id,l,r;
        cin>>id>>l>>r;
        T[id].l = l;
        T[id].r = r;
        if(l!=NIL) T[l].p = id;
        if(r!=NIL) T[r].p = id;
    }
    cout<<"Preorder"<<endl;
    int r;
    for(int i=0;i<n;i++){
        if(T[i].p==NIL) r=i;
    }
    preTW(r);
    cout<<endl;
    cout<<"Inorder"<<endl;
    inTW(r);
    cout<<endl;
    cout<<"Postorder"<<endl;
    postTW(r);
    cout<<endl;
    return 0;
}



Measured memory_bytes: 3080
#include <stdio.h>

long long min(long long a,long long b){
  if(a < b){
    return a;
  }
  return b;
}

int main(void){
  int N;
  scanf("%d\n", &N);

  long long A[N];
  long long sum = 0;
  for (int i = 0; i < N; i++) {
    scanf("%lld", &A[i]);
    sum += A[i];
  }

  long long even = 0;
  for (int i = 2; i < N; i++) {
    if(i%2 == 0) even += A[i];
  }

  long long ans[N];
  ans[1] = sum-2*even;
  for (int i = 1; i < N; i++) {
    ans[i+1] = A[i]*2-ans[i];
  }
  ans[0] = A[N-1]*2-ans[N-1];

  for (int i = 0; i < N; i++) {
    printf("%lld", ans[i]);
    if(i != N-1) printf(" ");
  }

  return 0;
}

Measured memory_bytes: 2816
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <functional>
#include <queue>
#include <string>
#include <cstring>
#include <numeric>
#include <cstdlib>
#include <cmath>
#include <queue>
using namespace std;

typedef long long ll;

#define INF 10e6
#define rep(i,n) for(int i=0; i<n; i++)
#define rep_r(i,n,m) for(int i=m; i<n; i++)
#define END cout << endl
#define MOD 1000000007
#define pb push_back
// 昇順sort
#define sorti(x) sort(x.begin(), x.end())
// 降順sort
#define sortd(x) sort(x.begin(), x.end(), std::greater<int>())

typedef pair<int, int> P; // firstは最短距離, secondは頂点の番号
typedef struct edge {int to, cost;} edge;
vector<edge> g[100002];
int d[100002];
int V;

void dijkstra(int s) {
  priority_queue<P,vector<P>,greater<P> > que;
  for (int i = 0; i <= V; ++i) d[i] = INF;
  d[s] = 0;
  que.push(P(0,s));

  while (!que.empty()) {
    P p = que.top(); que.pop();
    int v = p.second;

    if (d[v] < p.first) continue;

    for (int i = 0; i < g[v].size(); ++i) {
      edge e = g[v][i];
      if (d[e.to] > d[v] + e.cost) {
        d[e.to] = d[v] + e.cost;
        que.push(P(d[e.to], e.to));
      }
    }
  }
}

int main() {
  cin >> V;
  rep(i,V-1) {
    int a,b; scanf("%d %d", &a, &b);
    g[a].pb({b,1});
    g[b].pb({a,1});
  }
  int f_cost[V+1], s_cost[V+1];

  dijkstra(1);
  rep(i,V+1) {
    f_cost[i] = d[i];
  }

  dijkstra(V);
  rep(i,V+1) {
    s_cost[i] = d[i];
  }

  int scnt = 0, fcnt = 0;
  for (int i = 1; i <= V; ++i){
    if (f_cost[i] <= s_cost[i]) {
      fcnt++;
    } else {
      scnt++;
    }
  }
  // cout << fcnt << " " << scnt << endl;
  if (fcnt <= scnt) {
    cout << "Snuke" << endl;
  } else {
    cout << "Fennec" << endl;
  }
}


Measured memory_bytes: 7568
import java.util.*;
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[n];
        for(int i = 0 ; i < n ; i++ ){
            a[i] = sc.nextInt();
        }
        sc.close();
        int s = 1;
        int bre = 0;
        for(int i = 0 ; i < n ; i++){
            if(a[i] == s){
                s++;
            }else{
                bre++;
            }
        }
        if(bre == n){
            bre = -1;
        }
        System.out.println(bre);
    }
}

Measured memory_bytes: 59876
//2007-yo-2のように直接探す方法では、最大O(MN/2)となり、制限時間内に終わらない。そこで、2011-ho-1のように交互列を考える。
#include<stdio.h>

int N,M;
int data[1000000];
int main(){
	char c[2];
	int count,corsole;
	int num;	//個数
	int i;
	while(1){
		count = 0;
		corsole = 0;
		num = 0;
		scanf("%d",&N);
		if(N == 0)
			break;
		scanf("%d",&M);
		do{
			scanf("%c",c+1);
		}while(c[1] != 'I' && c[1] !='O');
		for(i = 1;i < M;){
			while(c[1] != 'I' && i < M){
				c[0] = c[1];
				scanf("%c",c+1);
				i++;
			}
			c[0] = 'X';	//ループを抜けた際の履歴が次回に影響しないようにする。
			while(c[1] != c[0]){
				count++;
				if(i >= M)
					break;
				c[0] = c[1];
				scanf("%c",c+1);
				i++;
			}
			data[corsole] = (count-1)/2;
			if(data[corsole] > 0)
				corsole++;
			count = 0;
		}
		for(i = 0;i <= corsole;i++){
			if(N <= data[i]){
				num+=data[i]-N+1;
			}
		}
		printf("%d\n",num);
	}
	return 0;
}

Measured memory_bytes: 1036
#include<bits/stdc++.h>
using namespace std;
template<typename T>inline void read(T &x)
{
	x=0;
	static int p;p=1;
	static char c;c=getchar();
	while(!isdigit(c)){if(c=='-')p=-1;c=getchar();}
	while(isdigit(c)) {x=(x<<1)+(x<<3)+(c-'0');c=getchar();}
	x*=p;
}
const int mod=1e9+7;
int n,x,y,z;
int dp[41][1<<19];
long long ksm(long long x,long long mc)
{
	long long tmp=x%mod;
	long long res=1;
	while(mc)
	{
		if(mc&1)res=res*tmp%mod;
		tmp=tmp*tmp%mod;
		mc>>=1;
	}
	return res;
}
int main()
{
	read(n);read(x);read(y);read(z);
	int maxn=(1<<x+y+z)-1;
	int sta=((((1<<x-1)<<y)|(1<<(y-1)))<<z)|(1<<(z-1));
	dp[0][0]=1;
	for(int i=1;i<=n;i++)
		for(int j=0;j<=maxn;j++)
			if(dp[i-1][j])
				for(int k=1;k<=10;k++)
				{
					int newsta=((j<<k)|(1<<(k-1)))&maxn;
					if((newsta&sta)==sta)continue;
					(dp[i][newsta]+=dp[i-1][j])%=mod;
				}
	int ans=0;
	for(int i=0;i<=maxn;i++)
		(ans+=dp[n][i])%=mod;
	printf("%lld\n",((ksm(10,n)-ans)%mod+mod)%mod);
	return 0;
}

Measured memory_bytes: 82176
#include <bits/stdc++.h>
using namespace std;
typedef int int__;
#define int long long
#define pb push_back
#define pi pair<int,int>
#define vpi vector<pi>
#define vi vector<int>
#define vvi vector<vi>
#define fi first
#define se second
#define forn(i, n)for(int i=0;i<int__(n);i++) 
#define sz(a)int__(a.size())
template <class A, class B> ostream& operator << (ostream& out, const pair<A, B> &a){return out << "(" << a.first << ", " << a.second << ")";}
template<class A>ostream& operator<<(ostream& out,const vector<A>&v){out<<"[";forn(i,sz(v)){if(i)out<<", ";out<<v[i];}return out<<"]";}
const int MAX = 1e5 + 100;
#define fast ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
int Mod(int x){const int mm=998244353;x%=mm;if(x<0)x+=mm;return x;}
int Pow(int x,int n){if(n==0)return 1;int t=Pow(x,n/2);t=Mod(t*t);if(n&1)t=Mod(t*x);return t;}
#define watch(x) cout << #x << " : " << x << endl;
int gcd(int a,int b){if(b==0)return a;return gcd(b,a%b);}

int__ main()
{	
	int a,b; cin >> a >> b;
	cout << (a*b)/gcd(a,b);
}

Measured memory_bytes: 256
#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;

const int mx2=57, mx=mx2*mx2;
ll dp[mx][mx2];

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int n,a; cin>>n>>a;
	vector<int> x(n);
	for (int i=0; i<n; i++)
		cin>>x[i];
	dp[0][0]=1;
	for (int i=0; i<n; i++)
		for (int j=mx2-2; j>=0; j--)
			for (int k=mx-1; k>=x[i]; k--)
				dp[k][j+1]+=dp[k-x[i]][j];
	ll ret=0;
	for (int i=1; i<=n; i++)
		ret+=dp[i*a][i];
	cout<<ret<<"\n";
	return 0;
}

Measured memory_bytes: 1664
import sys
def minimumChar(T,S): 
    n, m = len(T), len(S) 
    ans = sys.maxsize 
    for i in range(m - n + 1): 
        minRemovedChar = 0
        for j in range(n): 
            if (T[j] != S[i + j]): 
                minRemovedChar += 1
        ans = min(minRemovedChar, ans) 
    return ans 
      
S=input()
T=input()

print(minimumChar(T,S)) 

Measured memory_bytes: 9116
'use strict'
function main(input) {
  input = input.trim().split('\n')
  const NM = input.shift().split(' ').map(val => Number(val))
  const P = input.pop().split(' ').map(val => Number(val))
  input = input.map(val => val.split(' ').slice(1).map(v => Number(v)))

  const isOn = (sw, state) => {
    sw = Math.pow(2, sw - 1)
    return (sw & state) === sw
  }
  
  let count = 0
  for (let i = 0; i < Math.pow(2, NM[0]); i++) {
    let light = 0
    for (let j = 0; j < NM[1]; j++) {
      let swCount = 0
      input[j].forEach(sw => {
        if (isOn(sw, i)) swCount++
      })
      if (swCount % 2 === P[j]) light++
    }
    if (light === NM[1]) count++
  }

  console.log(count)
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));


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

using ll=int64_t;
#define int ll

#define FOR(i,a,b) for(int i=int(a);i<int(b);i++)
#define REP(i,b) FOR(i,0,b)
#define MP make_pair
#define PB push_back
#define ALL(x) x.begin(),x.end()
#ifdef MAROON_LOCAL
#define cerr (cerr<<"-- line "<<__LINE__<<" -- ")
#else
class CerrDummy{}cerrDummy;
template<class T>
CerrDummy& operator<<(CerrDummy&cd,const T&){
	return cd;
}
using charTDummy=char;
using traitsDummy=char_traits<charTDummy>;
CerrDummy& operator<<(CerrDummy&cd,basic_ostream<charTDummy,traitsDummy>&(basic_ostream<charTDummy,traitsDummy>&)){
	return cd;
}
#define cerr cerrDummy
#endif
#define REACH cerr<<"reached"<<endl
#define DMP(x) cerr<<#x<<":"<<x<<endl
#define ZERO(x) memset(x,0,sizeof(x))
#define ONE(x) memset(x,-1,sizeof(x))

using pi=pair<int,int>;
using vi=vector<int>;
using ld=long double;

template<class T,class U>
ostream& operator<<(ostream& os,const pair<T,U>& p){
	os<<"("<<p.first<<","<<p.second<<")";
	return os;
}

template<class T>
ostream& operator <<(ostream& os,const vector<T>& v){
	os<<"{";
	REP(i,(int)v.size()){
		if(i)os<<",";
		os<<v[i];
	}
	os<<"}";
	return os;
}

ll read(){
	ll i;
	scanf("%" SCNd64,&i);
	return i;
}

void printSpace(){
	printf(" ");
}

void printEoln(){
	printf("\n");
}

void print(ll x,int suc=1){
	printf("%" PRId64,x);
	if(suc==1)
		printEoln();
	if(suc==2)
		printSpace();
}

string readString(){
	static char buf[3341000];
	scanf("%s",buf);
	return string(buf);
}

char* readCharArray(){
	static char buf[3341000];
	static int bufUsed=0;
	char* ret=buf+bufUsed;
	scanf("%s",ret);
	bufUsed+=strlen(ret)+1;
	return ret;
}

template<class T,class U>
void chmax(T& a,U b){
	if(a<b)
		a=b;
}

template<class T,class U>
void chmin(T& a,U b){
	if(b<a)
		a=b;
}

template<class T>
T Sq(const T& t){
	return t*t;
}

//#define CAPITAL
void Yes(bool ex=true){
	#ifdef CAPITAL
	cout<<"YES"<<endl;
	#else
	cout<<"Yes"<<endl;
	#endif
	if(ex)exit(0);
}
void No(bool ex=true){
	#ifdef CAPITAL
	cout<<"NO"<<endl;
	#else
	cout<<"No"<<endl;
	#endif
	if(ex)exit(0);
}

const ll infLL=LLONG_MAX/3;

#ifdef int
const int inf=infLL;
#else
const int inf=INT_MAX/2-100;
#endif

int GetInvMod2(vi a){
	int n=a.size(),res=n%2;
	cerr<<res<<endl;
	REP(i,n)if(a[i]!=-1){
		res^=1;
		cerr<<res<<endl;
		int x=i;
		while(a[x]!=-1){
			cerr<<i<<" "<<x<<endl;
			int y=x;
			x=a[x];
			a[y]=-1;
		}
	}
	return res;
}

const int Nmax=100010;
int a[Nmax][3];

signed main(){
	int n=read();
	REP(j,3)REP(i,n)
		a[i][j]=read();
	int inv[2]{},vert[2]{};
	vi arr[2];
	REP(i,n){
		int p=a[i][0],q=a[i][1],r=a[i][2];
		if(q%3!=2)No();
		if(min(p,r)!=q-1)No();
		if(max(p,r)!=q+1)No();
		q/=3;
		if(q%2!=i%2)No();
		arr[i%2].PB(q/2);
		if(p>r)vert[i%2]^=1;
	}
	cerr<<arr[0]<<endl;
	cerr<<arr[1]<<endl;
	REP(k,2)inv[k]=GetInvMod2(arr[k]);
	cerr<<vert[0]<<endl;
	cerr<<vert[1]<<endl;
	cerr<<inv[0]<<endl;
	cerr<<inv[1]<<endl;
	if(inv[0]==vert[1]&&inv[1]==vert[0])
		Yes();
	else
		No();
}


Measured memory_bytes: 5748
N=int(input())
S = []
for _ in range(N):
    S.append(input())

judgelist=['AC', 'WA', 'TLE', 'RE']

AC=0
WA=0
TLE=0
RE=0

for i in S:
    if i == judgelist[0]:
        AC+=1
    elif i == judgelist[1]:
        WA+=1
    elif i == judgelist[2]:
        TLE+=1
    elif i == judgelist[3]:
        RE+=1

print("AC x {}".format(AC))
print("WA x {}".format(WA))
print("TLE x {}".format(TLE))
print("RE x {}".format(RE))


Measured memory_bytes: 16332
#include <iostream>
#include <map>
#include <vector>
#define rep(i,n) for(int (i)=0;(i)<(n);++(i))
#define all(x) (x).begin(),(x).end()
#define dump(x) cout << #x << " = " << (x) << endl

using namespace std;
using ll = long long;


vector<pair<ll, ll>> prime_factorize(ll n) {
    vector<pair<ll, ll>> res;

    for (ll a = 2; a * a <= n; ++a) {
        if (n % a != 0) continue;

        ll ex = 0;
        while (n % a == 0) {
            ++ex;
            n /= a;
        }
        res.emplace_back(a, ex);
    }

    if (n != 1) res.emplace_back(n, 1ll);

    return res;
}


int n;
map<ll, int> sisuu;

ll rec(map<ll, int>::iterator p, ll mul) {
    if (p == sisuu.end()) {
        if (mul == 1) return 1;
        else return 0;
    }

    ll res = 0;
    for (int i = 0; i < p->second + 1; ++i) {
        if (mul % (i + 1) != 0) continue;
        res += rec(++p, mul / (i + 1));
        --p;
    }

    return res;
}



int main() {
    cin >> n;
    for (int i = 2; i <= n; ++i) {
        auto ps = prime_factorize(i);
        for (auto it: ps) sisuu[it.first] += it.second;
    }

    cout << rec(sisuu.begin(), 75) << endl;
}

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

typedef long long ll;
typedef vector<int> vi;

const double PI=acos(-1.0);

int N;
void input()
{
    cin>>N;
}

void solve()
{
    cout<<(N+1)/2<<endl;
}

int main()
{
    cin.tie();
    ios::sync_with_stdio(false);
    input();
    solve();
    return 0;
}

Measured memory_bytes: 3588
main = do
  n <- readLn :: IO Integer
  putStrLn $ show $ h n

foldlState :: (c -> a -> b -> (c, a)) -> c -> a -> [b] -> a
foldlState f s a l = snd $ foldl (\(s,a) -> f s a) (s, a) l

h n | mod n 2 == 1 = 0
    | otherwise    = foldlState step 5 0 [2..30]
    where m = div n 2
          step k a _ = (k * 5, a + div m k)


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

int main() {
	int c[3][3];

	for (int i = 0; i < 3; ++i) {
		for (int j = 0; j < 3; ++j) {
			cin >> c[i][j];
		}
	}

	if (
		(c[0][0] - c[0][1] == c[1][0] - c[1][1]) &&
		(c[0][2] - c[0][1] == c[1][2] - c[1][1]) &&
		(c[2][0] - c[2][1] == c[1][0] - c[1][1]) &&
		(c[2][2] - c[2][1] == c[1][2] - c[1][1]) &&
		(c[0][0] - c[1][0] == c[0][1] - c[1][1]) &&
		(c[2][0] - c[1][0] == c[2][1] - c[1][1]) &&
		(c[0][2] - c[1][2] == c[0][1] - c[1][1]) &&
		(c[2][2] - c[1][2] == c[2][1] - c[1][1])
		) cout << "Yes";

	else cout << "No";

	return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
    public static void main(String args[]) throws Exception{
        BufferedReader stdR = new BufferedReader(new InputStreamReader(System.in));
        String[] s = stdR.readLine().split(" ");
        int X = Integer.parseInt(s[0]);
        int A = Integer.parseInt(s[1]);
        if(X < A) {
            System.out.println(0);
        }else {
            System.out.println(10);
        }
    }
}

Measured memory_bytes: 23252
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef vector<ll> vl;
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define in insert
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int INF = 1e9 + 5;
int main(){
    int n;
    cin >> n;
    
    if(n>9 && n<100){
        cout << 9;
    }
    else if(n>0 && n<10){
        cout << n;
    }
    else if(n>99 && n<1000){
        cout << (n-99+9);
    }
    else if(n>999 && n<9999){
        cout << 909;
    }
    else if(n>9999 && n<100000){
        cout << (n-9090);
    }
    else if(n==100000){
        cout << 90909;
    }
    
}

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

const int MOD =1000000007;
//

signed main() {
 int n;
 string s,t;
 cin>>n>>s>>t;
 for(int i=0;i<n;i++){
     cout<<s[i]<<t[i];
 }
 return 0;
}


Measured memory_bytes: 256