akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <iomanip>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)

#define DEBUG

#ifdef DEBUG
#define var_dump(...) fprintf(stdout, __VA_ARGS__)
#define dump(a) cout << a << "\n";
#else
#define var_dump(...) 42
#define dump(a) 42
#endif

// https://beta.atcoder.jp/contests/abc043/tasks/abc043_b

int main() {

    string s; cin >> s;
    deque<char> dq;

    REP(i, s.length()) {
        if (s[i] == 'B') {
            if (!dq.empty())dq.pop_front();
        }
        else dq.push_front(s[i]);
    }

    while(!dq.empty()) {
        cout << dq.back();
        dq.pop_back();
    }

    cout << "\n";

    return 0;
}


Measured memory_bytes: 256
#!/usr/local/bin/ruby
n=gets.to_i
rec=Array.new
ans=Array.new
n.times{
   rec=gets.split(" ").map(&:to_i)
   rec.sort!{|a,b| a <=> b}
   x,y,z=rec[0].to_i,rec[1].to_i,rec[2].to_i
   a=x*x+y*y
   b=z*z
   if a==b
      puts"YES"
   else
      puts"NO"
   end
}

Measured memory_bytes: 6112
from functools import reduce
import math

def main():
    # 文字列の2進数を数値にする
    # '101' → '5'
    # 文字列の頭に'0b'をつけてint()にわたす
    # binary = int('0b'+'101',0)

    # 2進数で立っているbitを数える
    # 101(0x5) → 2
    # cnt_bit = bin(5).count('1')
    
    # N! を求める
    # f = math.factorial(N)

    # N の逆元
    # N_inv = pow(N,MOD-2,MOD)

    # nCr
    # Nの階乗 * rの階乗の逆元 * n-rの階乗の逆元
    
    # 切り捨て
    # 4 // 3
    # 切り上げ
    #-(-4 // 3)
    
    # 初期値用:十分大きい数(100億)
    INF = float("inf")

    # 大きな素数
    MOD = 10**9+7
    
    # 1文字のみを読み込み
    # 入力:2
    # a = input().rstrip()
    # 変数:a='2'
    
    # スペース区切りで標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a, b, c, d = (int(_) for _ in input().split())  
    # 変数:a=2 b=4 c=5 d =7
    
    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a = list(int(_) for _ in input().split())
    # 変数:a = [2, 4, 5, 7]    

    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2457
    # a = list(int(_) for _ in input())
    # 変数:a = [2, 4, 5, 7]    
    a = list(int(_) for _ in input())
    if (a[0] == a[1] and a[1] == a[2]) or (a[1] == a[2] and a[2] == a[3]):        
        print('Yes')
    else:
        print('No')
if __name__ == '__main__':
    main()


Measured memory_bytes: 3572
# 累積和を用いたdpの高速か

n, k = map(int, input().split())
mod = 998244353

lr_list = [list(map(int, input().split())) for _ in range(k)]

dp = [0] * (n + 1)
dp[1] = 1
sdp = [0] * (n + 1)
sdp[1] = 1
for i in range(2, n + 1):
    for j in range(k):
        right = max(0, i - lr_list[j][0])
        left = max(0, i - lr_list[j][1] - 1)
        dp[i] = (dp[i] + sdp[right] - sdp[left]) % mod
    sdp[i] = sdp[i - 1] + dp[i]

print(dp[n])

Measured memory_bytes: 28016
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        Double a=sc.nextDouble();
        Double b=sc.nextDouble();
        Double c=sc.nextDouble();
        sc.close();
        //三角形の面積
        System.out.println(a*b*Math.sin(c* (Math.PI / 180))/2);
        //周の長さ
        System.out.println(a + b + Math.sqrt(a*a + b*b - 2*a*b*Math.cos(c* (Math.PI / 180))));
        //a を底辺としたときの高さ h
        System.out.println(b*Math.sin(c* (Math.PI / 180)));
    }
}



Measured memory_bytes: 27988
n=int(input())
a=[]
b=[]
for i in range(n):
  tmpa,tmpb=map(int,input().split())
  a.append(tmpa)
  b.append(tmpb)
if n%2==1:
  a.sort()
  b.sort()
  print(b[n//2]-a[n//2]+1)
else:
  a.sort()
  b.sort()
  tmp=(b[n//2-1]+b[n//2])/2 - (a[n//2-1]+a[n//2])/2
  if tmp.is_integer():
    print(int(tmp)*2+1)
  else:
    print(int(tmp+0.5)*2)

Measured memory_bytes: 25420
<?php
$s = trim(fgets(STDIN));
$s = str_replace(array("\r\n","\r","\n"), '', $s);
$s = explode(" ", $s);

$S = $s[0];

$chars = array();
for ($i = 0; $i < 4; $i++) {
    $c = $S[$i];
    if (!isset($chars[$c])) {
        $chars[$c] = 0;
    }
    $chars[$c]++;
}

$ret = "Yes";
foreach ($chars as $char) {
    if ($char != 2) {
        $ret = "No";
        break;
    }
}

echo($ret);

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

import java.util.Arrays;
import java.util.Collections;
import java.util.ArrayList;
import java.util.List;
import java.util.HashSet;
import java.io.PrintWriter;
import java.io.OutputStream;
import java.util.Comparator;

public class Main {
    // 標準入力
    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

    // 標準入力数値配列用 int
    static int[] inputval() throws Exception {
        String[] strarray = br.readLine().trim().split(" ");
        int[] intarray = new int[strarray.length];
        for (int i = 0; i < intarray.length; i++) {
            intarray[i] = Integer.parseInt(strarray[i]);
        }
        return intarray;
    }

    // 標準入力数値リスト用 int
    static List<Integer> inputIntList() throws Exception {
        List<String> strList = Arrays.asList(br.readLine().trim().split(" "));
        List<Integer> intList = new ArrayList<Integer>();
        for (String elem : strList){
            intList.add(Integer.parseInt(elem));
        }
        return intList;
    }

    // 標準入力数値配列用 integer ソート用
    static Integer[] inputvalInteger() throws Exception {
        String[] strarray = br.readLine().trim().split(" ");
        Integer[] intarray = new Integer[strarray.length];
        for (int i = 0; i < intarray.length; i++) {
            intarray[i] = Integer.parseInt(strarray[i]);
        }
        return intarray;
    }

    public static void main(String[] args) throws Exception {
        // write your code here
        int n = Integer.parseInt(br.readLine());
        int min = Integer.MAX_VALUE;
        for (int i=1; i<=n/2; i++){
            int ab =0;
            String sa = Integer.toString(i);
            String sb = Integer.toString(n-i);
            for (int j=0; j<sa.length(); j++){
                ab += Character.getNumericValue(sa.charAt(j));
            }
            for (int k=0; k<sb.length(); k++){
                ab += Character.getNumericValue(sb.charAt(k));
            }
            min = Math.min(min,ab);

        }
        System.out.println(min);


    }

}



Measured memory_bytes: 39600
#include <cstdio>

int as[100005];
int N;

int gcd(int a,int b){
  return b?gcd(b,a%b):a;
}

int solve(){
  int odd=0;
  int last=0;
  for(int i=0;i<N;i++){
    if(as[i]&1){
      odd++;
      last=i;
    }
  }
  if(N%2==0&&odd%2==0) return 0;
  if(N%2==0&&odd%2==1) return 1;
  if(N%2==1&&odd%2==0) return 1;
  if(as[last]==1) return 0;
  as[last]--;
  int g=0;
  for(int i=0;i<N;i++){
    g=gcd(g,as[i]);
  }
  for(int i=0;i<N;i++){
    as[i]/=g;
  }
  return !solve();
}

int main(){
  scanf("%d",&N);
  for(int i=0;i<N;i++){
    scanf("%d",&as[i]);
  }
  if(solve()){
    printf("First\n");
  }else{
    printf("Second\n");
  }
  return 0;
}


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

int main() {
    int n;
    char s[3];
    int a = 0, b = 0, ab = 0, o = 0;
    while(~scanf("%d,%s", &n, s)) {
        if(s[0] == 'A' && s[1] == 'B') {
            ab++;
        } else if(s[0] == 'A') {
            a++;
        } else if(s[0] == 'O') {
            o++;
        } else {
            b++;
        }
    }
    cout << a << '\n' << b << '\n' << ab << '\n' << o << endl;
}


Measured memory_bytes: 3044
//set many funcs template
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<stdbool.h>
#define inf 1072114514
#define llinf 4154118101919364364
#define mod 1000000007
#define pi 3.1415926535897932384

int max(int a,int b){if(a>b){return a;}return b;}
int min(int a,int b){if(a<b){return a;}return b;}
int zt(int a,int b){return max(a,b)-min(a,b);}
int round(int a,int b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;}
int ceil(int a,int b){if(a%b==0){return a/b;}return (a/b)+1;}
int gcd(int a,int b){int c;while(b!=0){c=a%b;a=b;b=c;}return a;}
int lcm(int a,int b){int c=gcd(a,b);a/=c;return a*b;}
int nCr(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
int fact(int a){int i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}
int pow(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}
long long llmax(long long a,long long b){if(a>b){return a;}return b;}
long long llmin(long long a,long long b){if(a<b){return a;}return b;}
long long llzt(long long a,long long b){return llmax(a,b)-llmin(a,b);}
long long llround(long long a,long long b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;}
long long llceil(long long a,long long b){if(a%b==0){return a/b;}return (a/b)+1;}
long long llgcd(long long a,long long b){long long c;while(b!=0){c=a%b;a=b;b=c;}return a;}
long long lllcm(long long a,long long b){long long c=llgcd(a,b);a/=c;return a*b;}
long long llnCr(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
long long llfact(long long a){long long i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}
long long llpow(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}
double dbmax(double a,double b){if(a>b){return a;}return b;}
double dbmin(double a,double b){if(a<b){return a;}return b;}
double dbzt(double a,double b){return dbmax(a,b)-dbmin(a,b);}
int sortfncsj(const void *a,const void *b){if(*(int *)a>*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;}
int sortfnckj(const void *a,const void *b){if(*(int *)a<*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;}
int llsortfncsj(const void *a,const void *b){if(*(long long *)a>*(long long *)b){return 1;}if(*(long long *)a==*(long long *)b){return 0;}return -1;}
int llsortfnckj(const void *a,const void *b){if(*(long long *)a<*(long long *)b){return 1;}if(*(long long *)a==*(long long *)b){return 0;}return -1;}
int dbsortfncsj(const void *a,const void *b){if(*(double *)a>*(double *)b){return 1;}if(*(double *)a==*(double *)b){return 0;}return -1;}
int dbsortfnckj(const void *a,const void *b){if(*(double *)a<*(double *)b){return 1;}if(*(double *)a==*(double *)b){return 0;}return -1;}

int main(void){
    int i,j,k,n,y,a[262144],r=0,l;
    double d;
    char s[262144];
    scanf("%d%d",&n,&y);
    //l=strlen(s);
    for(i=0;i<=n;i++){
        for(j=0;i+j<=n;j++){
            k=n-i-j;
            if(10000*i+5000*j+1000*k==y){printf("%d %d %d\n",i,j,k);return 0;}
        }
    }
    printf("-1 -1 -1\n");
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <set>
#include <iomanip>
using namespace std;

int N, K;
double E[200000] = {0};
int main()
{
    cin >> N >> K;

    for (int i = 0; i < N; i++)
    {
        int p;
        cin >> p;
        E[i] = (1.0 + p) / 2.0;
    }

    double sum = 0, ans = 0;
    for (int i = 0; i < K; i++)
    {
        sum += E[i];
    }
    ans = sum;
    for (int i = K; i < N; i++)
    {
        sum += E[i] - E[i - K];
        ans = max(ans, sum);
    }
    cout << setiosflags(ios::fixed) << setprecision(12) << ans << endl;
    // system("pause");
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,x,y=0,res=0;
  cin >> N >> x;
  vector<int> A(N);
  for(int i=0; i<N; i++) cin >> A.at(i);
  sort(A.begin(),A.end());
  for(int i=0; i<N; i++) {
    if(x >= A.at(i)) {
      if ( i == N-1 && x > A.at(i) ) break; 
      x -= A.at(i);
      res++;
    } 
  }
  cout << res << endl;
}


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

int main()
{
    int A,B;
    cin>>A>>B;

    int count = 1;
    int loop = 0;
    while(true)
    {
        if(count>=B)
        {
            break;
        }
        count+=A-1;
        loop++;
    }
    cout<<loop<<endl;
}

Measured memory_bytes: 256
/*input
2
ip cc
*/
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define F first
#define S second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define eb emplace_back
#define pb push_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define EL cout<<'\n'
#define BS(a,x) binary_search(ALL(a),x)
template<typename T1,typename T2>
ostream& operator<<(ostream& out,pair<T1,T2> P){
	out<<'('<<P.F<<','<<P.S<<')';
	return out;
}
template<typename T>
ostream& operator<<(ostream& out,vector<T> V){
	REP(i,SZ(V)) out<<V[i]<<((i!=SZ(V)-1)?" ":"");
	return out;
}
//}}}
const ll maxn=300005;
const ll maxlg=20;
const ll INF64=1e18;
const int INF=0x3f3f3f3f;
const ll MOD=ll(1e9+7);
const ld PI=acos(-1);
const ld eps=1e-9;
//const ll p=880301;
//const ll P=31;

ll mypow(ll a,ll b){
	ll res=1LL;
	while(b){
		if(b&1) res=res*a%MOD;
		a=a*a%MOD;
		b>>=1;
	}
	return res;
}


int main(){
	IOS;
	int n;
  cin>>n;
  cout<<(n-1)/2;
	return 0;
}


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

int digit(int A){
	string S=to_string(A);
	return S.size();
}

signed main() {
	int N;
	cin >> N;
	int A,B;
	A=sqrt(N)+1;
	B=N/A;
	
	while(true){
		if(A*B==N){
			cout<<max(digit(A),digit(B))<<endl;
			break;
		}
		A--;
		B=N/A;
	}
	
	return 0;
}
	
	

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
typedef unsigned long long int ulli;
#define vec(s) vector
;
#define vvec(s) vector<vector
> ;
typedef vector<lli> vi;
typedef vector<vi> vvi;
typedef pair<lli,lli> pii;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define YN(x) cout<<(bool x?"Yes":"No")<<endl;
#define out(s) cout<<s<<endl;
#define pb(s) push_back(s);
#define sp " ";
#define INF 10000000000
#define all(s) s.begin(),s.end()
void vout(vi v){
    for(int i=0;i<v.size();i++)
    cout<<v.at(i)<<endl;
}
long long int mod=1000000007;
struct modint{
    long long int x;
    modint(long long int x=0):x(x%mod){}//メンバ変数を初期化する。
    modint& operator+= (const modint a){
        if((x+=a.x)>=mod){x-=mod;}//%は遅い
        return *this;//関数を終了するためにはreturnを返さなければならないが、return aとでもするとその値が代入されてしまう。そこで、計算された後の自分自身のアドレス、つまり何もしないようにしている？
    }
    modint& operator-= (const modint a){
        if((x+=mod-a.x)>=mod) x-=mod;
        return *this;
    }
    modint& operator*= (const modint a){
        x*=a.x;
        x%=mod;
        return *this;
    }
    modint operator+(const modint a) const{//引数の横のconstは関数自体がconstつまりメンバ変数の変更ができなくなるということ。バグ防止に役立つ
        modint copy(*this);//constがあるのでメンバ変数をいじれないから値だけコピーする
        return copy+=a;
    }
    modint operator-(const modint a)const{
        modint copy(*this);
        return copy-=a;
    }
    modint operator*(const modint a)const{
        modint copy(*this);
        return copy*=a;
    }
    modint pow(long long int t)const{//繰り返し二乗法
        if(t==0) return 1;
        modint a=pow(t>>1);//tを1/2倍したものの累乗
        a*=a;//aを二乗する
        if(t&1) a*=*this;//ビット形式での一桁目が1、つまりtが奇数ならば、もう一回掛ける。
        return a;
    }
    modint inv() const{
        return pow(mod-2);
    }
    modint operator/=(const modint a){
        return (*this)*=a.inv();
    }
    modint operator/(const modint a){
        modint copy(*this);
        return copy/=a;
    }
};
modint dfs(lli x,lli y,vvi &dp,vector<string> &ma){
    modint res;
    res.x=0;
    if(x==dp.size()-1&&y==dp[x].size()-1){
        res.x=1;
        return res;
    }
    else if(x>=dp.size()||y>=dp[x].size()){
        return res;
    }
    else if(dp[x][y]!=-1){
        res.x=dp[x][y];
        return res;
    }
    else if(ma[x][y]=='#'){
        res.x=0;
        return res;
    }
    else{
        res+=dfs(x+1,y,dp,ma);
        res+=dfs(x,y+1,dp,ma);
        dp[x][y]=res.x;
        return res;
    }
}

int main(){
    lli h,w;
    cin>>h>>w;
    vector<string> ma(h);
    rep(i,h) cin>>ma[i];
    vvi dp(h,vi(w,-1));
    modint ans;
    ans=dfs(0,0,dp,ma);
    out(ans.x);

}

Measured memory_bytes: 13304
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
from bisect import bisect, bisect_left, bisect_right

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

H, W = MAP()
C = [input() for i in range(H)]
C = ["0"*(W+2)] + ["0"+C[i]+"0" for i in range(H)] + ["0"*(W+2)]
Z = [[0] * (W + 2) for i in range(H + 2)]

def surround_plus(i, j, Z):
    dx = [0, 1, 1, 1, 0,-1,-1,-1]
    dy = [1, 1, 0,-1,-1,-1, 0, 1]
    for idx in range(8):
        Z[i + dx[idx]][j + dy[idx]] += 1
    return Z


for i in range(H + 2):
    for j in range(W + 2):
        if C[i][j] == "#":
            Z = surround_plus(i, j, Z)

A = [[""] * W for i in range(H)]

for i in range(1, H + 1):
    for j in range(1, W + 1):
        if C[i][j] != "#":
            A[i-1][j-1] = str(Z[i][j])
        else:
            A[i-1][j-1] = "#"
print(*["".join(a) for a in A], sep="\n")


Measured memory_bytes: 10668
import java.io.IOException;
import java.util.ArrayList;

public class Main {

	public static void main(String[] args) {
		while (true) {
			int n = nextInt();
			if (n == 0) {
				break;
			}
			int lim = 2 * n;

			if (n == 1) {
				System.out.println(1);
				continue;
			} else if (n % 2 == 0) {
				n++;
			} else {
				n += 2;
			}

			ArrayList<Integer> list = new ArrayList<Integer>();
			while (n <= lim) {
				// nは必ず3以上の奇数
				boolean is_prime = true;
				for (int i = 1; 2 * i + 1 <= Math.sqrt(n); i++) {
					if (n % (2 * i + 1) == 0) {
						is_prime = false;
						break;
					}
				}
				if (is_prime) {
					list.add(n);
				}

				n += 2;
			}

			System.out.println(list.size());

		}

	}

	static int nextInt() {
		int c;
		try {
			c = System.in.read();
			while (c != '-' && (c < '0' || c > '9'))
				c = System.in.read();
			if (c == '-')
				return -nextInt();
			int res = 0;
			while (c >= '0' && c <= '9') {
				res = res * 10 + c - '0';
				c = System.in.read();
			}
			return res;
		} catch (IOException e) {
			e.printStackTrace();
		}
		return -1;
	}

}

Measured memory_bytes: 36988
#include <bits/stdc++.h>
using namespace std;
const int maxx = 1e5 + 7;
int n;
int a[maxx];
map <int, int> cnt;
map <int, bool> vis;
int ans;

int main() {
	cnt.clear();
	vis.clear();
	cin >> n;
	for(int i = 1; i <= n; i++) {
		cin >> a[i];
		cnt[a[i]]++;
	}
	for(int i = 1; i <= n; i++) {
		if(cnt[a[i]] & 1 && !vis[a[i]]) {
			vis[a[i]] = 1;
			ans++;
		}
	}
	cout << ans << endl;
}

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


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



long double l;
cin>>l;
long double a = l/3;
long double b=a;
long double c=l-a-b;
long double vol=a*b*c;
cout<<fixed<<setprecision(18)<<vol;
return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <string>
#include <set>
#include <queue>
#include <stack>
using namespace std;
typedef vector<long long int> vi;
typedef vector< vi > vvi;
int main() {
	int n, m, l;
	cin >> n >> m >> l;
	vvi a(n, vi(m));
	vvi b(m, vi(l));
	vvi c(n, vi(l));
	for (int i = 0; i < n;i++) {
		for (int j = 0; j < m; j++) {
			cin >> a[i][j];
		}
	}
	for (int i = 0; i < m; i++) {
		for (int j = 0; j < l; j++) {
			cin >> b[i][j];
		}
	}
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < l; j++) {
			for (int k = 0; k < m; k++) {
				c[i][j] += a[i][k] * b[k][j];
			}
		}
	}
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < l; j++) {
			if (j == l - 1) {
				cout << c[i][j] << endl;
			}
			else {
				cout << c[i][j] << " ";
			}
		}
	}
}

Measured memory_bytes: 1424
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define REP(i,b) FOR(i,0,b)
#define RFOR(i,a,b) for (int i = a-1; i >= b; i--)
#define RREP(i,a) RFOR(i,a,0)
#define REPALL(i,v) for (int i = 0; i < v.size(); i++)
#define RREPALL(i,v) for (int i = v.size()-1; i >= 0; i--)
#define ALL(v) v.begin(), v.end()
#define SORT(v) sort(v.begin(), v.end())
#define MIN_ELEMENT(v) min_element(v.begin(), v.end())
#define MAX_ELEMENT(v) max_element(v.begin(), v.end())
#define COUNT(v,n) count(v.begin(), v.end(), n)
void YES(bool flag) {cout<<(flag ? "YES" : "NO")<<endl;}
void Yes(bool flag) {cout<<(flag ? "Yes" : "No")<<endl;}
void yes(bool flag) {cout<<(flag ? "yes" : "no")<<endl;}
typedef long long ll;
typedef unsigned long long ull;
const int INF = 1e7;
const ll MOD = 1e9 + 7;

//最大公約数
ll GCD(ll a, ll b)
{
    if (a == b || b == 0) {
        return a;
    } else if (a < b) {
        return GCD(b, a);
    } else {
        return GCD(b, a % b);
    }
}

//最小公倍数
ll LCM(ll a, ll b)
{
    return a * b / GCD(a, b);
}

vector<ll> primenum;
void get_prime_nembers(ll n)
{
    ll m = n;
    FOR(i,2,m+1) {
        bool flag = true;
        REPALL(j,primenum) {
            if (i % primenum[j] == 0) {
                flag = false;
                break;
            }
        }
        if (flag) {
            primenum.push_back(i);
            while (m % i == 0) {
                m /= i;
            }
        }
        if (i > sqrt(n)+1) {
            primenum.push_back(m);
            break;
        }
    }
}

vector<pair<int, int>> prime_factorization(ll n)
{
    if (primenum.empty())
        get_prime_nembers(n);

    vector<pair<int, int>> rtn;
    REPALL(i,primenum) {
        int num = 0;
        ll tmpn = n;
        while(tmpn % primenum[i] == 0) {
            num++;
            tmpn /= primenum[i];
        }
        if (num > 0)
            rtn.push_back(make_pair(primenum[i],num));
    }
    return rtn;
}

ll mypow(ll a, ll b)
{
    ll r = 1ll;
    while(b != 0){
        if(b&1) r = r * a % MOD;
        a = a * a % MOD;
        b /= 2;
    }
    return r;
}

vector<ll> fac;
vector<ll> ifac;

void factorial_init(ll n)
{
    fac.resize(n+1);
    ifac.resize(n+1);
    fac[0] = 1;
    ifac[0] = 1;
    REP(i,n) {
        fac[i+1] = fac[i] * (i + 1) % MOD;
        ifac[i+1] = ifac[i] * mypow(i + 1, MOD - 2) % MOD;
    }
}

ll Combination(ll a, ll b)
{
    if(a == 0 && b == 0) return 1;
    if(a < b || a < 0) return 0;
    ll r = ifac[a-b] * ifac[b] % MOD;
    return r * fac[a] % MOD;
}

int main()
{
    int n, k;
    cin>>n>>k;
    factorial_init(2222);
    ll ans;
    FOR(i,1,k+1) {
        ans = 0ll;
        ans += Combination(n-k+1, i) * Combination(k-1, i-1);
        ans %= MOD;
        cout<<ans<<endl;
    }

    return 0;
}


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

int main() {
  int N;
  cin >> N;
  int A[100010];
  for (int i = 0; i < N; i++)
    cin >> A[i];
  
  int B[100010];
  for (int i = 1; i <= N; i++)
    B[A[i-1] - 1] = i;
  
  for (int i = 0; i < N; i++)
    cout << B[i] << " ";
  return 0;
}

Measured memory_bytes: 1536
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 ] ;
    int minA = 1000 ;
    int maxA = 0    ;

    for(int i = 0 ; i <  N ;i ++){
      a[ i ] = sc.nextInt();
      if(a[ i ] < minA){
        minA = a[ i ];
      }
      if(a[ i ] > maxA){
        maxA = a[ i ];
      }
    }
    System.out.println( maxA - minA );

  }
}


Measured memory_bytes: 21844
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std; 
using namespace __gnu_pbds;
#define pb push_back
#define int long long
#define m_p make_pair
#define pair pair<int,int> 
//#define M 998244353
#define M 1000000007
const int inf=4e18;
const int MX=100;
const int MN=-100;
const double pi=3.14159265358979;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);cout.tie(NULL);
	int n,m;cin>>n>>m;
	map<int,int> mp;
	int o1=0,o2=0,i;
	for(i=0;i<m;i++)
	{
		int x;string s;
		cin>>x>>s;
		if(s=="AC")
		{
			if(mp[x]<=0)
			{
				o1++;
				o2-=mp[x];
				mp[x]=1;
			}
		}
		else if(mp[x]<=0)
			mp[x]--;
	}
	cout<<o1<<' '<<o2<<endl;
}

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

const int DIM = 5e1 + 5;

long long dp[DIM][DIM * DIM];

int main( void ) {
    
    int n, a;
    cin >> n >> a;
    
    dp[0][0] = 1;
    for( int i = 1; i <= n; i ++ ) {
        int x;
        cin >> x;
        
        for( int j = i - 1; j >= 0; j -- )
            for( int k = 0; k <= DIM * j; k ++ )
                dp[j + 1][k + x] += dp[j][k];
    }
    
    long long ans = 0;
    for( int i = 1; i <= n; i ++ )
        ans += dp[i][a * i];
    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1024
n = int(input())
d = int(input())
p = 10**9+7
if d == 1:
    print(n % p)
    exit()
N = [int(i) for i in list(str(n))]
DP0 = [0] * d
DP1 = [0] * d
DP1[0] += 1
for i in N:
    DP0_ = [0] * d
    DP1_ = [0] * d
    for r in range(d):
        for j in range(i):
            DP0_[r] += DP1[(r-j) % d]
            DP1_[r] += DP1[(r-j) % d]
        DP0_[r] += DP0[(r-i) % d]
        DP1_[r] += DP1[(r-i) % d]
        for j in range(i+1, 10):
            DP0_[r] += DP0[(r-j) % d]
            DP1_[r] += DP0[(r-j) % d]
        DP0_[r], DP1_[r] = DP0_[r] % p, DP1_[r] % p
    DP0, DP1 = DP0_, DP1_
print((DP1[0]-1+p) % p)


Measured memory_bytes: 44636
#include<bits/stdc++.h>
using namespace std;
int main() {
	double x1,x2,x3,y1,y2,y3,a,b,c,m,r;
	cin>>x1>>y1>>x2>>y2>>x3>>y3;
	a=sqrt((y1-y2)*(y1-y2)+(x1-x2)*(x1-x2));
	b=sqrt((y2-y3)*(y2-y3)+(x2-x3)*(x2-x3));
	c=sqrt((y1-y3)*(y1-y3)+(x1-x3)*(x1-x3));
	m=max({a,b,c});
	r=abs((x2-x1)*(y3-y1)-(x3-x1)*(y2-y1))/(a+b+c);
	cout<<setprecision(15)<<m/(2+m/r)<<endl;
	return 0;
}

Measured memory_bytes: 256
import sys
from io import StringIO
import unittest

def resolve():
    n = int(input())
    s = list(input())

    ans = 0
    for i in range(len(s) - 1):
        left = s[0:i + 1]
        right = s[i + 1:]

        tmp_ans = len(set(left) & set(right))

        # if ans < tmp_ans:
        #     ans = tmp_ans
        ans = max(ans, tmp_ans)

    print(ans)


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)
    def test_入力例_1(self):
        input = """6
aabbca"""
        output = """2"""
        self.assertIO(input, output)
    def test_入力例_2(self):
        input = """10
aaaaaaaaaa"""
        output = """1"""
        self.assertIO(input, output)
    def test_入力例_3(self):
        input = """45
tgxgdqkyjzhyputjjtllptdfxocrylqfqjynmfbfucbir"""
        output = """9"""
        self.assertIO(input, output)

if __name__ == "__main__":
    # unittest.main()
    resolve()

Measured memory_bytes: 6256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define l long
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define M1 1000000007
#define M2 998244353

#define fl(i,a,b)  for(ll i=a;i<b;i++)
#define bfl(i,a,b) for(ll i=b-1;i>=a;i--)
#define f(i,n)     for(int i=0;i<n;i++)
#define bf(i,n)    for(int i=n-1;i>=0;i--)


#define p0(a) cout << a << " "
#define p1(a) cout << a << endl
#define p2(a, b) cout << a << " " << b << endl
#define p3(a, b, c) cout << a << " " << b << " " << c << endl
#define p4(a, b, c, d) cout << a << " " << b << " " << c << " " << d << endl

#define bn "\n"

//------------------------------------------------------------------------ 
// #define V(a) vector<a>
// #define vt() vector< tuple < int ,int ,int > > ;
// #define vector< int ,int > pv;
// vector< pair <int,int> > vect;


//------------------------------------------------------------------------

ll modI(ll a,ll m);
ll gcd(ll a,ll b);
ll powM(ll x,ll y,ll m);
ll swap(ll a,ll b);

void swap(ll& a,ll& b)
{
    ll tp=a;
    a=b;
    b=tp;
}

ll gcd(ll x,ll y)
{
    if(x==0) return y;
    return gcd(y%x,x);
}

ll powM(ll x,ll y,ll m)
{
    ll ans=1,r=1;
    x%=m;
    while(r>0&&r<=y)
    {
        if(r&y)
        {
            ans*=x;
            ans%=m;
        }
        r<<=1;
        x*=x;
        x%=m;
    }
    return ans;
}
 
ll modI(ll a, ll m)
{
    ll m0=m,y=0,x=1;
    if(m==1) return 0;
    while(a>1)
    {
        ll q=a/m;
        ll t=m;
        m=a%m;
        a=t;
        t=y;
        y=x-q*y;
        x=t;
    }
    if(x<0) x+=m0;
    return x;
}

//---------------------------------------------------------------------------

// variable = Expression1 ? Expression2 : Expression3
// max = (n1 > n2) ? n1 : n2; 
// (n>m) ? cout<<"True"<<endl:cout<<"false"<<endl ;

// ---------------------------------------------------------------------------	

// int n;cin>>n;int a[n];for(int i=0;i<n;i++)cin>>a[i];    
// for(int i=0;i<n;i++)cout<<a[i];
// int a,b;cin>>a>>b;   

//----------------------------------------------------------------------------

// vector< tuple < int ,int ,int > > tv;
// vector< int ,int > pv;


//----------------------------------------------------------------------------


int main() {
	
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(0);
	int tt=1;
   // cin>>tt;
	while(tt--)
	{
	    int a[5];
	    int id=-1;
	    f(i,5){cin>>a[i];if(a[i]==0)id=i+1;}
	   p1(id);
	   
	   
	    
	}
	
	return 0;
}


Measured memory_bytes: 3596
#include <iostream>
#include <vector>
#include <cmath>

using namespace std;
typedef long long ll;

int main(){
  ll K, tmp;
  cin >> K;
  vector<ll> A;
  for (ll i=0; i<K; i++){
    cin >> tmp;
    A.push_back(tmp);
  }
  ll l = 2;
  ll r = 2;
  ll l2, r2;
  ll f = 0;
  for (ll i=K-1; i>=0; i--){
    f = A[i];
    l2 = f * (ceil((double)l / (double)f));
    r2 = f * (floor((double)r / (double)f));
    if (l2 > r && r2 < l){
      l = -1;
      r = -1;
      break;
    }
    l = l2;
    r = r2 + f - 1;
    cerr << l << " " << r << endl;
  }
  
  if (l == -1){
    cout << -1 << endl;
  }
  else{
    cout << l << " " << r << endl;
  }
  return 0;
}
  


Measured memory_bytes: 1400
// ref: https://img.atcoder.jp/abc084/editorial.pdf

//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
typedef int64_t int64;
typedef uint32_t uint;
typedef uint64_t uint64;
using namespace std;

//---

template <typename T>
inline void print(const T& rhs){ std::cout<<" = "<<rhs<<std::endl; }
template <typename T>
inline void print(const std::vector<T>& rhs){
    std::cout<<" = [ ";
    for(uint i=0; i<rhs.size(); ++i){ std::cout<<rhs[i]<<' '; }
    std::cout<<"]"<<std::endl;
}
template <typename T>
inline void print(const std::vector<std::vector<T>>& rhs){
    std::cout<<" = "<<std::endl;
    std::cout<<"[[ ";
    for(uint p=0; p<rhs.size(); ++p){
        if(p!=0){ std::cout<<" [ "; }
        for(uint q=0; q<rhs[p].size(); ++q){
            std::cout<<rhs[p][q]<<' ';
        }
        if(p!=rhs.size()-1){ std::cout<<"]"<<std::endl; }
    }
    std::cout<<"]]"<<std::endl;
}
template <typename TL, typename TR>
inline void print(const std::vector<std::pair<TR,TL>>& rhs){
    std::cout<<" = [";
    uint i=0;
    for(; i<rhs.size()-1; ++i){ std::cout<<"[f: "<<rhs[i].first<<", s: "<<rhs[i].second<<"], "; }
    std::cout<<"[f: "<<rhs[i].first<<", s: "<<rhs[i].second<<"]]" << endl;
}
#define printn(var) {printf("%s", #var);print(var);}
#define printn_all(var) {printf("%s(%d): ", __func__, __LINE__);printf("%s", #var);print(var);}

//---

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); 
    
    int N=100000;
    
    int Q; cin >> Q;
    
    vector<bool> pTbl(N+1, true);
    pTbl[0] = false;
    pTbl[1] = false;
    for(int prime=2; prime<=N; ++prime){
        if(!pTbl[prime]){ continue; }
        for(int tmp=2*prime; tmp<=N; tmp+=prime){ pTbl[tmp]=false; }
    }
    
    vector<int> vSimilar2017;
    for(int i=0; i<=N; ++i){
        if(pTbl[i] && pTbl[(i+1)/2]){
            vSimilar2017.push_back(i);
        }
    }
    
    vector<int> cSum(N+1, 0);
    for(uint i=0; i<vSimilar2017.size(); ++i){
        ++cSum[ vSimilar2017[i] ];
    }
    for(int i=1; i<=N; ++i){ cSum[i] += cSum[i-1]; }
    
    for(int i=0; i<Q; ++i){
        int l, r; cin >> l >> r;
        cout << (cSum[r] - cSum[l-1]) << endl;
    }
    
    return 0;
}

Measured memory_bytes: 1024
#include<iostream>
int main(){
std::string l[1000];int c=0,k;while(std::cin>>l[c]){k=l[c].length();if((l[c].find(","))+(l[c].find("."))!=-2)l[c].replace(k-1,1,""),k-=1;if((k>2)&&(k<7))c++;}for(k=0;k<c;k++){std::cout<<l[k];if(k!=c-1) std::cout<<" ";}std::cout<<"\n";}

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

int main(){
    int N;
    cin >> N;
    int A[100000] = {}, num;
    for(int i=0;i<N;i++){
        cin >> num;
        A[num - 1]++;
    }

    int k = 0, ans;
    for(int i=0;i<100000;i++){
        if(A[i] > 0){
            k++;
        }
    }
    if(k%2 == 1){
        ans = k;
    }else{
        ans = k - 1;
    }

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

Measured memory_bytes: 640
Scanf.scanf" %d %d %d"@@fun a b k->
	let rec f a b t k = match t,k with
	| ( _,0) -> (a,b)
	| (`A,k) -> f (a/2) (b+a/2) `B (k-1)
	| (`B,k) -> f (a+b/2) (b/2) `A (k-1)
	in let a,b = f a b `A k
	in Printf.printf "%d %d" a b

Measured memory_bytes: 384
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define LL long long
#define DB double
#define ST string
#define BS bitset
#define VE vector
#define VL vector<LL>
#define VP vector<pair<LL,LL>>
#define VVL vector<vector<LL>>
#define PQ priority_queue<LL>
#define PQS priority_queue<LL, vector<LL>, greater<LL>>
#define PB push_back
#define POB pop_back
#define PF push_front
#define POF pop_front
#define MP make_pair
#define TS to_string
#define TU to_ullong
#define FOR(i,a,n) for(i=a;i<n;i++)
#define rep(i,n) FOR(i,0,n)
#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()
#define SORT(a) sort(ALL(a))
#define REV(a) reverse(ALL(a))
#define UB(a,n) *upper_bound(ALL(a),n)
#define LB(a,n) *lower_bound(ALL(a),n)
#define INF 1145141919810364364
#define PI 3.14159265358979
//#define MOD 1000000007
#define MOD 998244353
#define ERR 0.00000000000001
#define NUM 200010

void Yn(LL a){if(a)printf("Yes\n");else printf("No\n");}
void YN(LL a){if(a)printf("YES\n");else printf("NO\n");}
LL pwmn(LL a,LL n){LL ans=1;while(ans<a)ans*=n;return ans;}
LL GCD(LL a,LL b){LL c=1,tmp=max(a,b);b=min(a,b);a=tmp;while(c!=0){c=a%b;a=b;b=c;}return a;}
LL LCM(LL a,LL b){return a*b/GCD(a,b);}
LL mod(LL a,LL m){if(a<0)return a%m+m;else return a%m;}
LL DIV(LL a,LL d){LL m=MOD,x=1,y=0,k;while(m){k=d/m;d-=k*m;swap(m,d);x-=k*y;swap(x,y);}return mod(a*mod(x,MOD),MOD);}
LL FAC(LL a){LL i,ans=1;FOR(i,1,a+1){ans*=i;if(MOD>0&&ans>MOD)ans%=MOD;}return ans;}
LL POW(LL a,LL n){LL ans=1;while(n>0){if(n&1)ans=ans*a%MOD;a=a*a%MOD;n>>=1;}return ans;}
LL fact[NUM],finv[NUM],inv[NUM];
void comi(){LL i;fact[0]=fact[1]=1;finv[0]=finv[1]=1;inv[1]=1;FOR(i,2,NUM){fact[i]=fact[i-1]*i%MOD;inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;finv[i]=finv[i-1]*inv[i]%MOD;}}
LL com(LL n,LL k){if(n<k||n<0||k<0)return 0;return fact[n]*(finv[k]*finv[n-k]%MOD)%MOD;}
bool cmps(pair<LL,LL> a,pair<LL,LL> b){if(a.second!=b.second)return a.second<b.second;return a.first<b.first;}

struct UF{
private:
  VL par;
public:
  UF(LL n){par.resize(n,-1);}
  LL root(LL x){if(par[x]<0)return x;else return par[x]=root(par[x]);}
  LL size(LL x){return -par[root(x)];}
  bool same(LL x,LL y){return root(x)==root(y);}
  void unite(LL x,LL y){x=root(x);y=root(y);if(x!=y){if(size(x)<size(y))swap(x,y);par[x]+=par[y];par[y]=x;}}
};
typedef struct{LL s,e,c,n;}Edge;
bool cmpc(Edge a,Edge b){return a.c<b.c;}
struct Kruscal{
private:UF *uf;VE<Edge> ed;
public:
  VE<Edge> edge;
  Kruscal(LL N){uf=new UF(N);}
  void add(LL s,LL e,LL c,LL n=0){Edge f;f.s=s,f.e=e,f.c=c,f.n=n;ed.PB(f);}
  void run(){sort(ALL(ed),cmpc);for(Edge a:ed){if(uf->same(a.s,a.e))continue;else{edge.PB(a);uf->unite(a.s,a.e);}}}
};

typedef struct{LL x,y,n;}Node;
bool cmpx(Node a,Node b){return a.x<b.x;}
bool cmpy(Node a,Node b){return a.y<b.y;}

int main(){
  LL i,N,ans=0;
  cin>>N;
  VE<Node> v(N);
  Kruscal k(2*N-2);
  rep(i,N){
    cin>>v[i].x>>v[i].y;
    v[i].n=i;
  }
  sort(ALL(v),cmpx);
  rep(i,N-1)k.add(v[i].n,v[i+1].n,v[i+1].x-v[i].x);
  sort(ALL(v),cmpy);
  rep(i,N-1)k.add(v[i].n,v[i+1].n,v[i+1].y-v[i].y);
  k.run();
  for(Edge a:k.edge)ans+=a.c;
  cout<<ans<<endl;
}


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

using namespace std;
typedef long long int ll;
typedef pair <ll,ll> P;
#define REP(i, n) for(ll i = 0LL; i < (ll)(n); i++)
#define REPR(i, n) for(ll i = n-1; i >= 0LL; i--)
#define FOR(i, n, m) for(ll i = n; i < (ll)(m); i++)
#define PRINT(x) cout << x << endl
#define ALL(v) v.begin(), v.end()
#define INF (ll)1e18
#define INFD 1e18
#define PI 3.14159265358979
#define MOD 1000000007
// #define MOD 998244353
#define VL vector<ll>

vector<ll> dx = {-1, 1, 0, 0};
vector<ll> dy = {0, 0, 1, -1};

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; }

int main()
{
	ll N, D, A;
	cin >> N >> D >> A;
	vector<P> v(N);
	REP(i, N) {
		ll X, H;
		cin >> X >> H;
		v[i] = P(X, H);
	}
	sort(ALL(v));
	v.push_back(P(INF, 0));
	vector<ll> u(N+1);
	ll ans = 0;
	REP(i, N) {
		if (v[i].second - A * u[i] > 0) {
			ll tmp = ((v[i].second - A * u[i])+A-1) / A;
			auto iter = upper_bound(ALL(v), P(v[i].first + 2*D, INF));
			ll ind = distance(v.begin(), iter);
			u[i] += tmp;
			u[ind] -= tmp;
			ans += tmp;
		}
		u[i+1] += u[i];
		// REP(i, N+1) cout << u[i] << " ";
		// cout << endl;
	}
	// REP(i, N+1) cout << u[i] << " ";
	// cout << endl;
	PRINT(ans);
	return 0;
}


Measured memory_bytes: 8192
/*input
15
13 76 46 15 50 98 93 77 31 43 84 90 6 24 14
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef tree<pair<int,int>, null_type, less<pair<int,int>>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
#pragma GCC optimize("unroll-loops,no-stack-protector")
//order_of_key #of elements less than x
// find_by_order kth element
typedef long long int ll;
#define ld double
#define pii pair<ll,ll>
#define f first
#define s second
#define pb push_back
#define REP(i,n) for(ll i=0;i<n;i++)
#define REP1(i,n) for(ll i=1;i<=n;i++)
#define FILL(n,x) memset(n,x,sizeof(n))
#define ALL(_a) _a.begin(),_a.end()
#define sz(x) (int)x.size()
const ll maxn=5e5+5;
const ll maxlg=__lg(maxn)+2;
const ll INF64=4e18;
const int INF=0x3f3f3f3f;
const ll MOD=ll(1e9+7);
const ld PI=acos(-1);
const ld eps=1e-9;
#define lowb(x) x&(-x)
#define MNTO(x,y) x=min(x,(__typeof__(x))y)
#define MXTO(x,y) x=max(x,(__typeof__(x))y)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
ll mult(ll a,ll b){
    return (a*b)%MOD;
}
ll mypow(ll a,ll b){
    if(b<=0) return 1;
    ll res=1LL;
    while(b){
        if(b&1) res=mult(res,a);
        a=mult(a,a);
        b>>=1;
    }
    return res;
}
int main(){
    ios::sync_with_stdio(false),cin.tie(0);
    int n;
    cin>>n;
    int ans=0;
    REP1(i,n){
        int x;
        cin>>x;
        if(x%2 and i%2) ++ans;
    }
    cout<<ans;
}

Measured memory_bytes: 3636
#include <iostream>
#include <cstdlib>
#include <vector>
#include <functional>
#include <algorithm>
using namespace std;

int main()
{
    // データ何個あるか
    int a,b;
    std::cin >> a >> b;
    if(a+b==15){
        std::cout << "+" << endl;
    }
    else if(a*b==15){
        std::cout << "*" << endl;
    }
    else {
        std::cout << "x" << endl;
    }
}



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

int main(){
 int N;
  cin >> N;
  int A[2][51];
  int C[51];
  for(int i = 0; i < 2; i++){
   	for(int j = 0; j < N; j++){
     	cin >> A[i][j]; 
    }
  }
  for(int i = 0; i < N-1; i++)cin >> C[i];
  C[N-1] = 0;
  int before = 0;
  int ans = 0;
  ans += A[1][A[0][0]-1];
  before = C[A[0][0] - 1];
  for(int i = 1 ;i < N; i++){
    ans +=A[1][A[0][i]-1];
    if(A[0][i-1]+1 == A[0][i])
      ans += before;
    before = C[A[0][i]-1];
  }
  cout << ans << endl;
}


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

int n, k, r, a, maxa; 
int gcd(int a, int b) {
	return b == 0 ? a : gcd(b, a % b);
}
int main(void) {
	scanf("%d%d%d", &n, &k, &r);
	maxa = r;
	for (int i = 1; i < n; i++) {
		scanf("%d", &a);
		r = gcd(r, a);
		maxa = max(maxa, a);
	}
	if (!(k % r) && k <= maxa)
		printf("POSSIBLE");
	else
		printf("IMPOSSIBLE");
}

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

int main(){
  int n,a,b;
  cin >> n >> a >> b;
  string s;
  cin >> s;
  
  int cnt = 0;
  int br = 0;
  rep(i,n){
    if( s.at(i) == 'a' ){
      if( cnt < a+b ){
        cout << "Yes" << endl;
        cnt++;
      }else{
        cout << "No" << endl;
      }
    }else if( s.at(i) == 'b' ){
      if( cnt < a+b && br < b ){
        cout << "Yes" << endl;
        cnt++;
        br++;
      }else{
        cout << "No" << endl;
      }
    }else{
      cout << "No" << endl;
    }
  }
  
  return 0;
}


Measured memory_bytes: 896
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Scanner;
import java.util.Set;
import java.util.function.Predicate;

public class Main {

	public static void main(String[] args) throws IOException {

		Scanner scan = new Scanner(System.in);

		Set<Integer> penkis = new HashSet<>();

		penkis.add(scan.nextInt());
		penkis.add(scan.nextInt());
		penkis.add(scan.nextInt());

		System.out.println(penkis.size());

	}

	//***********************以下共通関数************************************************
	/**
	 * 文字列を反転して返す
	 * @param pStr 文字列
	 * @return 反転した文字列
	 */
	public static String myReverse(String pStr) {
		if (pStr.length() < 1) {
			return "";
		}

		StringBuffer sb = new StringBuffer(pStr);
		return sb.reverse().toString();
	}

	/**
	 * 余りを求める。
	 * @param a
	 * @param b
	 * @return 余り。余りがマイナスの時はプラスで返す。
	 */
	public static long myMod(long a, long b) {
		long ret = 0;

		ret = a % b;

		if (ret < 0) {
			ret += b;
		}

		return ret;
	}

	/**
	 * 乗数を求める ※mod対応
	 * @param kisu 基数
	 * @param josu 乗数
	 * @param primeNumMod_0 法 mod値 使わない場合は「0」
	 * @return
	 */
	public static long myPowWithMod(long kisu, long josu, long primeNumMod_0) {

		long ans = 1;

		//乗数が0の場合→1
		if (josu == 0)
			return 1;

		if (primeNumMod_0 == 0) {
			//modを使わないとき

			while (josu > 0) {

				if (josu % 2 == 0) {
					//累乗が偶数の時

					kisu *= kisu;
					josu = josu / 2;
				} else {
					//累乗が奇数の時
					ans *= kisu;
					josu--;
				}
			}

			return ans;

		} else {
			//modを使うとき

			//初めに桁を落とす
			kisu = myMod(kisu, primeNumMod_0);

			while (josu > 0) {

				if (josu % 2 == 0) {
					//累乗が偶数の時

					kisu *= myMod(kisu, primeNumMod_0);
					josu = josu / 2;

				} else {
					//累乗が奇数の時
					ans *= myMod(kisu, primeNumMod_0);
					josu--;

				}
			}

			return myMod(ans, primeNumMod_0);

		}

	}

}


Measured memory_bytes: 26988
#include <bits/stdc++.h>
using namespace std;
int arr[100005];
map<int,int> ff;
int main()
{
    int n;
    cin >> n;
    for(int i = 0;i <= 100;i++)
    {
        for(int j = 0;j <= 100;j++)
        {
            if(i*4 + j*7 == n)
            {
                cout << "Yes\n";
                return 0;
            }
        }
    }
    cout << "No";
    return 0;
}


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

using namespace std;

int main(){
    string s;
    int a,b,c,d,sum=1,n,i;
    cin >> s;
    a = s[0] - '0';
    b = s[1] - '0';
    c = s[2] - '0';
    d = s[3] - '0';
    sum = a;

    for(i=0;i<8;i++){
        n=i;
        if((n&1)==1){
            sum += b;
        }else{
            sum -= b;
        }
        n = n>>1;
        if((n&1)==1){
            sum += c;
        }else{
            sum -= c;
        }
        n = n>>1;
        if((n&1)==1){
            sum += d;
        }else{
            sum -= d;
        }

        if(sum == 7){
            break;
        }else{
            sum = a;
        }
    }

    cout << a;        
    if((i&1)==1){
        cout << "+";
    }else{
        cout << "-";
    }
    cout << b;
    i >>= 1;
    if((i&1)==1){
        cout << "+";
    }else{
        cout << "-";
    }
    cout << c;
    i >>= 1;
    if((i&1)==1){
        cout << "+";
    }else{
        cout << "-";
    }
    cout << d;

    cout << "=7" << endl;
}

Measured memory_bytes: 384
// #include {{{
#include <iostream>
#include <cassert>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <ctime>
#include <queue>
#include <set>
#include <map>
#include <stack>
#include <string>
#include <bitset>
#include <vector>
#include <complex>
#include <algorithm>
using namespace std;
// }}}
// #define {{{
typedef long long ll;
typedef double db;
typedef pair<int,int> pii;
typedef vector<int> vi;
#define de(x) cout << #x << "=" << x << endl
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define per(i,a,b) for(int i=(b)-1;i>=(a);--i)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define fi first
#define se second
// }}}

const int N = 2e5 + 10 , M = 26;
string s;
int ne[N][M] , dis[N] , n , m;

int main(){
    cin >> s;
    n = sz(s);m = M;
    rep(i,0,m) ne[n+1][i]=n+1;
    dis[n+1]=0;
    per(i,0,n+1) {
        rep(j,0,m) ne[i][j]=ne[i+1][j];
        if(i!=n) ne[i][s[i]-'a']=i+1;
        dis[i]=1<<30;
        rep(j,0,m) dis[i]=min(dis[i],dis[ne[i][j]]+1);
    }
    string ans="";
    for(int i=0;i!=n+1;) {
        int id=0;
        rep(j,0,m) if(dis[ne[i][j]]<dis[ne[i][id]]) id=j;
        ans+=char('a'+id);
        i=ne[i][id];
    }
    cout<<ans<<endl;
    return 0;
}


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

int main(){
  int A, B, C;
  cin >> A >> B >> C;
  vector<int> vec;
  vec.push_back(A);
  vec.push_back(B);
  vec.push_back(C);
  int min = 100000;
  for (int i = 0; i < vec.size(); i++){
    for (int j = i + 1; j < vec.size(); j++){
     if (min > vec.at(i) + vec.at(j)){
       min = vec.at(i) + vec.at(j);
     } 
    }
  }
  cout << min << endl;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define Red ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define rep(i, n) for(int i =0 ; i < n; ++i)
#define Rep(i,a,b) for(int i=a;i<=b;i++)
#define pii pair < int, int >
typedef vector<int> vi;
typedef  long long ll;
const int mod =1e9+7;
const int N = (int)2e5 + 5;

int used[N];

void solve(){
	int n;
	cin>>n;
	int d=n;
	d--;
	while(d--){
		int x;
		cin>>x;
		used[x]++;
	}
	for(int i=1;i<=n;i++){
		cout<<used[i]<<"\n";
	}

}

int main(){
	Red;
	int t=1;
	// cin>>t;
	while(t--)
	solve();
	return 0;
}

Measured memory_bytes: 4440
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, s, n) for (int i = (int)(s); i < (int)(n); i++)
using ll = long long;
const ll MOD = 1e9 + 7;
const long long INF = 1LL << 60;

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

    if (s == "ABC")
    {
        cout << "ARC" << endl;
    }
    else if (s == "ARC")
    {
        cout << "ABC" << endl;
    }
}

Measured memory_bytes: 3560