akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cmath>
#include <algorithm>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define REP(i,k,n) for(int i = k; i < (int)(n); i++)
using namespace std;

int main(){
        int n,p;
        int a[50];
        while(true) {
                rep(i,50) a[i]=0;
                cin >> n >> p;
                int cup = p;
                if(n==0) break;
                bool flag = false;
                while(true) {
                        rep(i,n){
                                if (cup==0) {
                                        cup=a[i];
                                        a[i]=0;
                                        continue;
                                }
                                a[i]++;
                                cup--;
                                if(a[i]==p) {
                                        cout << i << endl;
                                        flag = true;
                                        break;
                                }
                        }
                        if(flag == true) break;
                }
        }

        return 0;
}



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

M = int(N**(1/2))
min_ans = len(str(N))
ans = 0

for i in range(1,M+1):
    a, b = divmod(N, i)
    if b==0:
        ans = max(len(str(a)),len(str(i)))
        if min_ans >= ans:
            min_ans = ans

print(min_ans)

Measured memory_bytes: 3188
from sys import setrecursionlimit

setrecursionlimit(2 * 10 ** 9)

n, a, b = map(int, input().split())
mod = 10 ** 9 + 7

ans = pow(2, n, mod) - 1


def cmb(n, r):
    p, q = 1, 1
    for i in range(1, r + 1):
        p *= (n - i + 1)
        p %= mod
        q *= i
        q %= mod
    return p * pow(q, mod - 2, mod)


ans -= cmb(n, a)
ans -= cmb(n, b)


print(int(ans % mod))


Measured memory_bytes: 38768
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

#define int long long

#define override_rep(i, l, r, mes, ...) mes
#define rep1(i, n) for (int i = 0; i < n; i++)
#define rep2(i, l, r) for (int i = l; i < r; i++)
#define rep(...) override_rep(__VA_ARGS__, rep2, rep1)(__VA_ARGS__)

using namespace std;
using P = pair<int, int>;
using ll = long long;
using ld = double;

using bint = boost::multiprecision::cpp_int;

constexpr int MOD = 1e9 + 7;

template<typename T, typename U>
istream& operator>>(istream& in, pair<T, U>& p) {
    in >> p.first >> p.second;
    return in;
}

bool isOK(string s){
    for(char c:s){
        if(c!='7')return false;
    }
    return true;
}

// https://twitter.com/vane11ope ←フォローしましょう
// (ノ)>◡<(ヾ)ﾓﾁﾓﾁ
signed main(signed argc, char* argv[]) {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);

    int k;
    cin>>k;
    int a=7%k;
    int cnt=a;
    rep(i,k){
        if(cnt==0){
            cout<<i+1<<endl;
            return 0;
        }
        cnt=(cnt*10+a)%k;
    }
    cout<<-1<<endl;
}


Measured memory_bytes: 3660
#include<stdio.h>
#include<string.h>

int main() {
	char s[200001], t[200001];
	scanf("%s", s);
	scanf("%s", t);
	long long ans = 0;
	for (int i = 0; i < strlen(s); i++) {
		if (s[i] != t[i]) ans++;
	}
	printf("%lld", ans);

	return 0;
}

Measured memory_bytes: 2516
#include <bits/stdc++.h>  // ver1.8
#define int long long
#define ALL(v) (v).begin(),(v).end()
#define Vi vector<int>
#define pb push_back
#define mp make_pair
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repeq(i,a,b) for(int i=a;i<=b;i++)
#define repr(i,a,b) for(int i=a;i>b;i--)
#define repreq(i,a,b) for(int i=a;i>=b;i--)
#define leng(n) (int)(log10(n)+1)
#define INF 9000000000000000000  //  9.0 * 10^18
#define MOD 1000000007  //  10^9 + 7
#define PAI 3.14159265358979
using namespace std;

int gcd(int a,int b){return b?gcd(b,a%b):a;}  //  最大公約数gcd
int lcm(int a,int b){return a/gcd(a,b)*b;}  //  最小公倍数lcm

signed main() {
  cout << fixed << setprecision(14);
  string s;
  cin >> s;
  int ans = s.size();
  int now = 0;
  rep(i,0,s.size()){
    if(s[i]=='S') now++;
    if(s[i]=='T' && now>0) {
      now--;
      ans -= 2;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstring>
#include <string>
#include <stdio.h>
using namespace std;

int main()
{
    string W,t,T;
    char c;
    int num=0;
    cin>> W;

    cin>>t;
    T="";
    while ((t.find("END_OF_TEXT")!=0)){
        transform(t.begin(), t.end(), t.begin(), ::tolower);

        if(W==t){
            num++;
        }
        cin>>t;

    }
    cout << num << "\n";

    return 0;
}


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

int Parent(int );
int Left(int );
int Right(int );

int main() {
  int n;
  int i;
  int j;
  int *array;

  scanf("%d",&n);
  array = (int *)malloc(n * sizeof(int));
  for(i=0;i<n;i++) scanf(" %d",&array[i]);

  for(i=0;i<n;i++) {
    j = i+1;//いちいちi+1とやるのめんどいのでjに格納
    //parentまで
    if(Parent(j) == 0) printf("node %d: key = %d, ",j,array[i]);
    else printf("node %d: key = %d, parent key = %d, ",j,array[i],array[Parent(j) - 1]); //添え字なので-1する(array[2] = array[3-1])
    if(Left(j) <= n) printf("left key = %d, ",array[Left(j)-1]);
    if(Right(j) <= n) printf("right key = %d, ",array[Right(j)-1]);
    printf("\n");
  }
  
  return 0;
}

int Parent(int i) {
  return i/2;
}

int Left(int i) {
  return 2*i;
}

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



Measured memory_bytes: 2044
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <iomanip>
#include <queue>
#include <deque>
#include <map>
#include <unordered_map>
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define repr(e,x) for(auto& e:x)
using namespace std;
typedef long long ll;

ll N,K;
ll A[200001];
ll P[200001];

int main(){
    cin>>N>>K;
    repn(i,N) cin>>A[i];
    fill(P,P+N+1,-1);

    ll t=0;
    ll pos=1;
    do{
        P[pos]=t;
        pos=A[pos];
        t++;
        if(t==K){
            cout<<pos<<endl;
            return 0;
        }
    }while(P[pos]==-1);

    K-=P[pos];
    K%=(t-P[pos]);
    
    rep(i,K){
        pos=A[pos];
    }

    cout<<pos<<endl;
}

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

#define int long long
const double PI = 3.14159265358979323846;
typedef vector<int> vint;
typedef pair<int, int> pint;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

int N;
signed main() {
    cin>>N;
    if(N%2==1)N*=2;
    cout<<N<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<algorithm>
#include<queue>
#include<vector>
#define ll long long
#define max(a,b) (a>b?a:b)
#define min(a,b) (a<b?a:b)
#define inf 0x3f3f3f3f
#define mod 1000000007
#define eps 1e-18
inline ll read()
{
    ll tmp=0; char c=getchar(),f=1;
    for(;c<'0'||'9'<c;c=getchar())if(c=='-')f=-1;
    for(;'0'<=c&&c<='9';c=getchar())tmp=(tmp<<3)+(tmp<<1)+c-'0';
    return tmp*f;
}
using namespace std;
int a,b,c;
int main()
{
	a=read(); b=read(); c=read();
	if(a>b){int tmp=a; a=b; b=tmp;}
	if(a>c){int tmp=a; a=c; c=tmp;}
	if(b>c){int tmp=b; b=c; c=tmp;}
	int ans=c-b;
	if((b-a)&1)ans+=(b-a)/2+2;else ans+=(b-a)/2;
	printf("%d\n",ans);
	return 0;
}

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

int main() {
  int N, M, a[100001] = {}, sum[100001] = {}, l, r, count = 0;
  cin >> N >> M;
  for (int i = 0; i < M; i++){
    cin >> l >> r;
    a[l] += 1;
    a[r+1] += -1;
  }
  for (int j = 1; j <= N+1; j++){
    sum[j] = sum[j-1] + a[j];
    if (sum[j] == M) count++; 
  }
  cout << count << endl;
  return 0;
}

Measured memory_bytes: 4424
macro_rules! scan_sub {
    ( $itr:ident, $t:ty ) => {
        let mut buf = String::new();
        let $itr = {
            while buf.trim().len() == 0 {
                buf = String::new();
                std::io::stdin().read_line(&mut buf).unwrap();
            }
            buf.split_whitespace().map(|n| n.parse::<$t>().unwrap())
        };
    };
}

macro_rules! scan {
    ( $x:ident; Vec<$t:ty> ) => {
        scan_sub!(itr, $t);
        let $x = itr.collect::<Vec<_>>();
    };
    ( $( $x:ident ),*; $t:ty ) => {
        scan_sub!(itr, $t);
        let mut itr = itr;
        $(
            let $x = itr.next().unwrap();
        )*
    };
}

fn main() {
    scan!(k; usize);

    let mut n = 0;
    let mut flag = false;
    for i in 1..=k {
        n = (10 * n + 7) % k;
        if n % k == 0 {
            println!("{}", i);
            flag = true;
            break;
        }
    }

    if !flag {
        println!("-1");
    }
}


Measured memory_bytes: 2132
#include <bits/stdc++.h>
// #pragma GCC optimize ("O3")
// #pragma GCC target ("sse4")

using namespace std;

#define li long long int
#define ld double_t
#define mod (li)(1e9+7)
const int MX1=1e5+5;
const int MX2=1e6+5;
const li inf=1e18;

li power(li a,li b){li res=1;while(b){if(b%2)res=(res*a)%mod;
a=(a*a)%mod;b/=2;}return res;}

li mmi(li a){return power(a,mod-2);}

li cntbit(li n){li cnt=0;while(n){n&=(n-1);cnt++;}return cnt;}

int n,cnt[MX1];
li fact[MX1];

void factorial(){
	fact[0]=1;
	for(int i=1;i<MX1;i++){
		fact[i]=(fact[i-1]*i)%mod;
	}
}

void solve(){
	cin>>n;
	for(int i=1;i<=n;i++){
		int x;
		cin>>x;
		cnt[x]++;
	}
	int ok=0;
	for(int i=0;i<n;i++){
		if(cnt[i]==2) ok++;
	}
	if(n%2==0 and (ok!=n/2 or cnt[0]!=0)){
		cout<<"0";
		return ;
	}
	if(n%2==1 and (ok!=n/2 or cnt[0]!=1)){
		cout<<"0";
		return ;
	}
	li ans=1;
	for(int i=0;i<n;i++){
		ans=(ans*fact[cnt[i]])%mod;
	}
	cout<<ans;
}

int main(){
	ios_base::sync_with_stdio(false);
	factorial();
	int t=1;
	//cin>>t;
	while(t--){
		solve();
	}
	return 0;
}

Measured memory_bytes: 1408
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    n, a, b = LI()
    print(min(n*a,b))
    return

#B
def B():
    a = S()
    print(a.count("1"))
    return

#C
def C():
    n = II()
    a = list(str(n))
    a = list(map(int,a))
    if not n % sum(a):
        print("Yes")
    else:
        print("No")
    return

#D
def D():
    n = II()
    a = LI()
    ans = 0
    while True:
        for i in range(n):
            if a[i] % 2:
                print(ans)
                return    
            a[i] /= 2
        ans += 1
    print(ans)
    return

#E
def E():
    return

#F
def F():
    n, k = LI()
    a = LI()
    dic = defaultdict(int)
    for a_ in a:
        dic[a_] += 1
    dic = sorted(dic.values(),reverse = True)
    l = 0
    ans = 0
    for j in dic:
        l += 1
        ans += j
        if l == k:
            break
    print(n-ans)
    

    return

#G
def G():
    return

#H
def H():
    return

#Solve
if __name__ == '__main__':
    F()


Measured memory_bytes: 94460
package main

import "fmt"

func main() {

	var N int
	fmt.Scanf("%d", &N)
	A := make([]int, N)
	for i := 0; i < N; i++ {
		fmt.Scanf("%d", &A[i])
		if A[i]%2 == 0 {
			if A[i]%3 != 0 && A[i]%5 != 0 {
				fmt.Println("DENIED")
				return
			}
		}
	}
	fmt.Println("APPROVED")
}


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

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            string w = Console.ReadLine();

            Console.WriteLine(CheckWord(w));
        }

        static string CheckWord(string w)
        {
            int[] memo = new int[26];

            for (int i = 0; i < w.Length; i++)
            {
                int idx = w[i] - 'a';
                memo[idx]++;
            }

            for (int i = 0; i < memo.Length; i++)
            {
                if (memo[i] % 2 == 1) return "No";
            }
            return "Yes";
        }
    }
}

Measured memory_bytes: 2776
#include<iostream>
#include<string>
#include<cmath>
//#include<array>
#include<algorithm>
//#include<deque>
#include<vector>
//#include<utility>
#include<set>
//#include<map>
//#include<list>

using namespace std;

//class UnionFind {
//public:
//	vector<int>data;
//	UnionFind(int size) :data(size, -1) {};
//	bool unionset(int x, int y) {
//		x = root(x), y = root(y);
//		if (x != y) {
//			if (data[y] < data[x]) {
//				swap(x, y);
//			}
//			data[x] += data[y];
//			data[y] = x;
//		}
//		return x != y;
//	}
//	bool findset(int x, int y) {
//		return root(x) == root(y);
//	}
//	int root(int x) {
//		return data[x] < 0 ? x : data[x] = root(data[x]);
//	}
//	int size(int x) {
//		return -data[root(x)];
//	}
//};

//int gcd(int x, int y) {
//	int tmp, r;
//	if (x < y) {
//		tmp = x;
//		x = y;
//		y = tmp;
//	}
//	r = x % y;
//	while (r != 0) {
//		x = y;
//		y = r;
//		r = x % y;
//	}
//	return y;
//}

int main(void) {
	string S,a,b,c;
	int A;
	bool res = true;
	cin >> S;
	a = S.substr(0,4);
	b = S.substr(5, 2);
	c = S.substr(8, 2);
	A = stoi(a) * 10000 + stoi(b) * 100 + stoi(c);
	if (A > 20190430) {
		cout << "TBD" << endl;
	}
	else {
		cout << "Heisei" << endl;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define MOD 1000000007
#define INF 1000000000
#define LINF 1000000000000000000
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define bit(n) (1LL<<(n))
using namespace std;

typedef pair<int, int> P;
typedef pair<long long, long long> LLP;

int main() {

    int N, K;
    cin >> N >> K;
    vector<int> x(N);
    rep(i,N) cin >> x[i];
    int ans = 0;

    rep(i,N) ans += min(x[i], K - x[i]) * 2;

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

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


using namespace std;

#define debug(x) cout << '>' << #x << ':' << x << endl;
#define loop(i,n) for(int i=0;i<(int)(n);i++)
#define foi(i,k,n) for(int i=(k); i<(int)(n); i+=1)
#define fod(i,n,k) for(int i=k; i>=(int)n; i-=1)
#define fast_io ios_base::sync_with_stdio(false) , cin.tie(NULL);
#define all(x) x.begin(), x.end()
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define endl "\n"

#define int long long
#define INF 0x3f3f3f3f
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007

#define fir first
#define sec second
#define pb push_back
#define mp make_pair

typedef long long llint;
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<llint> VL;
typedef vector<string> VS;
typedef vector<PII> VII;
typedef vector<VI> VVI;
typedef map<int,int> MII;
typedef set<int> SI;
string tostr(int n) {stringstream rr;rr<<n;return rr.str();}
llint toint(string s) {stringstream ss(s); llint x; ss >> x; return x;}
//typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
//gp_hash_table<string, llint> table;


//int mpow(llint base, llint exp) {
  //base %= MOD;
  //llint result = 1;
  //while (exp > 0) {
    //if (exp & 1) result = ((llint)result * base) % MOD;
    //base = ((llint)base * base) % MOD;
    //exp >>= 1;
  //}
  //return result;
//}


//void makegraph(int n, int m){
	//int i, u, v;
	//while(m--){
		//cin>>u>>v;
		//u--, v--;
		//g[u].pb(v);
		//g[v].pb(u);
	//}
//}

//void dfs(int u, int par){
	//for(int v:g[u]){
		//if (v == par) continue;
		//dfs(v, u);
	//}
//}


// ------------------------------------------------------------------ILB----------------------------------------------------------------  //



void solve(){
	int n;
	cin >> n;
	int last = 0, x = 0;
	while(x <= n){
		last *= 10;
		last += 7;
		x++;
		last = last % n;
		if(last == 0) break;
	}
	if(last == 0){
		cout << x;
	}
	else cout << -1;
}




int32_t main() {
	fast_io;
    int t = 1;
    //cin >> t;
    //int xx = 0
    while(t--) {
		//xx++;
		//cout << "Case ";
      solve();
    }
    return 0;
}



Measured memory_bytes: 3608
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n,res=0;
  cin>>n;
  vector<int> a(n);
  for(int i=0;i<n;i++)
    cin>>a[i];
  for(int i=0;i<n;i++)
  {for(int j=i+1;j<n;j++)
  {for(int k=j+1;k<n;k++)
  {if(a[i]!=a[j] and a[j]!=a[k] and a[k]!=a[i])
    if(a[i]+a[j]>a[k] and a[j]+a[k]>a[i] and a[i]+a[k]>a[j])
          res++;
  }}}
  cout<<res;
  return 0;
}

Measured memory_bytes: 3604
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <stack>
#include<algorithm>
#include<sstream>
#include<iomanip>
#include<deque>
#include<list>


using namespace std;

typedef long long ll;

typedef pair<int, int> pii;

const ll MOD_CONST = 1000000007;
const ll BIG_NUM = 1000000000000000000;
const int BIG_INT = 1000000000;

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

	map<string, int> m;
	for (int i = 0; i < n;i++) {
		string s;
		cin >> s;
		m[s]++;
	}

	int maxCnt = 0;
	for (auto it = m.begin();it != m.end();it++) {
		maxCnt = max(maxCnt, it->second);
	}
	for (auto it = m.begin();it != m.end();it++) {
		if (it->second == maxCnt) {
			cout << it->first << endl;
		}
	}


}
	

Measured memory_bytes: 25216
/**
*    author:  boutarou
*    created: 12.06.2020 18:00:11
**/

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define fcout cout << fixed << setprecision(15)
using lint = long long;
using P = pair<int, int>;

template<class T> inline bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }

const double PI = 3.1415926535897932;
const int INF = 1e9 + 7;

int n;
int a[305][305];
lint dist[305][305];
lint ans = 0;
vector<pair<int, P>> vec;

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

	cin >> n;
	rep(i, n) {
		rep(j, n) {
			cin >> a[i][j];
			vec.push_back({a[i][j], {i, j}});
		}
	}
	sort(vec.begin(),vec.end());

	rep(i, n) {
		rep(j, n) {
			dist[i][j] = (i == j ? 0 : INF);
		}
	}
	rep(i, vec.size()) {
		int cost, from, to;
		cost = vec[i].first;
		from = vec[i].second.first;
		to = vec[i].second.second;
		if (dist[from][to] < cost) {
			cout << -1 << endl;
			return 0;
		}
		else if (dist[from][to] > cost) {
			ans += cost;
			rep(j, n) {
				rep(k, n) {
					chmin(dist[j][k], min(dist[j][from] + cost + dist[to][k], dist[j][to] + cost + dist[from][k]));
				}
			}
		}
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 2548
#include <algorithm>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for(int(i) = 0; (i) < (n); (i)++)
#define FOR(i, m, n) for(int(i) = (m); (i) < (n); (i)++)
#define All(v) (v).begin(), (v).end()
#define pb push_back
#define MP(a, b) make_pair((a), (b))
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const int INF = 1 << 30;
const ll LINF = 1LL << 60;
const int MOD = 1e9 + 7;

set<ll> divisor(ll n) {
    set<ll> ret;
    for(ll i = 1; i * i <= n; i++) {
        if(n % i == 0) {
            ret.insert(i);
            if(i * i != n)
                ret.insert(n / i);
        }
    }
    return ret;
}

int main() {
    ll N;
    cin >> N;
    vector<int> num(N + 1, 1);
    for(int i = 1; i <= N; i++) {
        for(int j = 2 * i; j <= N; j += i) {
            num[j]++;
        }
    }
    ll res = 0;
    for(ll i = 1; i <= N; i++) {
        res += num[i] * i;
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 42340
import java.io.IOException;

import java.io.BufferedReader;
import java.io.InputStreamReader;

import java.util.Formatter;

public class Main {
    public static void main(String[] args) throws IOException {
        try (
            BufferedReader reader = new BufferedReader(
                new InputStreamReader(System.in))) {
            final String c1 = reader.readLine();
            final String c2 = reader.readLine();
            final String c3 = reader.readLine();

            String ans = "";
            Formatter fm = new Formatter();
            fm.format(ans + "%c", c1.charAt(0));
            fm.format(ans + "%c", c2.charAt(1));
            fm.format(ans + "%c", c3.charAt(2));

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


Measured memory_bytes: 20564
#include<cstdio>
#include<cstring>
using namespace std;
int now,len;
char s1[105],s2[105],s[105];
int main()
{
	scanf("%s",s1+1);
	scanf("%s",s2+1);
	len=strlen(s1+1);
	for (int i=1; i<=len; i++)
	{
		for (int j=i; j<=len; j++)
			s[j-i+1]=s1[j];
		for (int j=1; j<=i-1; j++)
			s[len-i+1+j]=s1[j];
		now=0;
		for (int j=1; j<=len; j++)
			if (s[j]==s2[j]) now++;
		if (now==len)
		{
			printf("Yes\n");
			break;
		}
	}
	if (now!=len) printf("No\n");
}

Measured memory_bytes: 128
import math

# Input the amount of money Takahashi paid
N = int(input())

# Find nearest integer price more than or equal to X/1.08
X = math.ceil(N / 1.08)

# Check if the "taxed price" is equal to N yen
if math.floor(X * 1.08) == N:
	print(X)
else:
	print(":(")


Measured memory_bytes: 9044
def main():
    n, m= map(int, input().split())
    inlis = []
    swlis = []
    light = 0
    ans = 0

    for _ in range(m):
        inlis.append(list(map(int, input().split())))
    swlis = list(map(int, input().split()))
    #print(inlis)
    #print(swlis)
    for i in range(2 ** n):
        tmp = []
        for j in range(n):
            if ((i >> j) & 1):
                tmp.append("On")
            else:
                tmp.append("Off")
        for k in range (m):
            cnt = 0
            for l in range(1, len(inlis[k])):
                #print(k, l, inlis[k], inlis[k][l])
                if tmp[inlis[k][l]-1] == "On":
                    cnt += 1
            if cnt % 2 == swlis[k]:
                light += 1
                #print(k, l, tmp, swlis[k])
        if light == m:
            ans += 1
        light = 0
    print(ans)


if __name__ == "__main__":
    main()

Measured memory_bytes: 42480
#include <algorithm>
#include <array>
#include <cassert>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#define FOR(i,a,b) for (int i=(a),for_##i##_max=(b);i<=(for_##i##_max);++i)
#define RFOR(i,a,b) for (int i=(a),rfor_##i##_min=(b);i>=(rfor_##i##_min);--i)
#define REP(i,n) for (int i=0,rep_##i##_len=(n);i<(rep_##i##_len);++i)
#define RREP(i,n) for (int i=(n)-1;i>=0;--i)

namespace { // Basics

template<typename T>
void chmin(T &x, T y) {
  x = std::min(x, y);
}

template<typename T>
void chmax(T &x, T y) {
  x = std::max(x, y);
}

template<typename T>
__attribute__((unused))
const auto minimum = static_cast<T const &(*)(T const &, T const &)>(std::min);

template<typename T>
__attribute__((unused))
const auto maximum = static_cast<T const &(*)(T const &, T const &)>(std::max);

template<typename T>
__attribute__((unused))
T constexpr infty = std::numeric_limits<T>::max / 3;
template<>
__attribute__((unused))
auto constexpr infty<int> = 1'100'100'100;
template<>
__attribute__((unused))
auto constexpr infty<long long int> = 100'500'400'300'200'100LL;

using lli = long long int;
using ld = long double;

} // namespace

namespace { // GCD

template <typename T>
T gcd(T m, T n) {
  return (n == 0) ? m : gcd(n, m % n);
}

template <typename T>
T extgcd(T a, T b, T &x, T &y) {
  T d = a;
  if (b != 0) {
    d = extgcd(b, a % b, y, x);
    y -= (a / b) * x;
  } else {
    x = 1, y = 0;
  }
  return d;
}

}

using namespace std;

int main() {
  // cout << fixed << setprecision(10);

  lli x, y; cin >> x >> y;
  cout << gcd(x, y) << endl;
  return 0;
}



Measured memory_bytes: 3100
#include <bits/stdc++.h>
 
using namespace std;
 
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl;
#define DEBUG_MAT(v) cerr<<#v<<endl;for(int i=0;i<v.size();i++){for(int j=0;j<v[i].size();j++) {cerr<<v[i][j]<<" ";}cerr<<endl;}
typedef long long ll;
#define int ll
 
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
template<class S, class T> pair<S, T> operator+(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first + t.first, s.second + t.second); }
template<class S, class T> pair<S, T> operator-(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first - t.first, s.second - t.second); }
template<class S, class T> ostream& operator<<(ostream& os, pair<S, T> p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
#define X first
#define Y 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 rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define rrep1(i,n) for(int i=(int)(n);i>0;i--)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define in(x, a, b) (a <= x && x < b)
#define all(c) c.begin(),c.end()
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a = b; return 1; } return 0; }
#define UNIQUE(v) v.erase(std::unique(v.begin(), v.end()), v.end());
const ll inf = 1000000001;
const ll INF = (ll)1e18 + 1;
const long double pi = 3.1415926535897932384626433832795028841971L;
#define Sp(p) cout<<setprecision(25)<< fixed<<p<<endl;
//int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
//int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };
vi dx = {1, 0, -1, 0}, dy = {0, 1, 0, -1};
vi dx2 = { 1,1,0,-1,-1,-1,0,1 }, dy2 = { 0,1,1,1,0,-1,-1,-1 };
#define fio() cin.tie(0); ios::sync_with_stdio(false);
const ll MOD = 1000000007;
//const ll MOD = 998244353;
// #define mp make_pair
//#define endl '\n'


signed main() {
    fio();
    
    string s;
    cin >> s;
    int n = s.size();
    vi sum(n + 1);
    ll mul = 1;
    int m = 2019;
    rep (i, n) {
        int x = s[n - 1 - i] - '0';
        sum[i + 1] = (sum[i] + mul * x) % m;
        mul = mul * 10 % m;
    }

    map<int, int> mp;
    rep (i, n + 1) {
        mp[sum[i]]++;
    }

    ll ans = 0;
    rep (i, 2019) {
        ans += (mp[i] * (mp[i] - 1)) / 2;
    }
    cout << ans << endl;
}

Measured memory_bytes: 5148
#include <bits/stdc++.h>
using namespace std;
string s;
unsigned int i = 1;
int main() {
    cin >> s;
    for (; i <= s.length(); ++i) {
        if (i & 1) {
            putchar(s[i - 1]);
        }
    }
    puts("");
    return 0;
}


Measured memory_bytes: 512
N,K,Q = map(int, raw_input().split())
K_list = [Q-K]*N
for i in range(0,Q):
  index = int(raw_input())
  K_list[index-1] = K_list[index-1] -1

for i in K_list:
  if i < 0:
    print "Yes"
  else:
    print "No"

Measured memory_bytes: 7940
#include <bits/stdc++.h> 
using namespace std;
#define rep(i, N) for(int i=0; i<N; i++)
typedef long long ll;
#define dump(x) cerr<<#x<<"="<<x<<endl
using P = pair<int, int>;

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

    if(n>=1000){
        cout << "ABD" << endl;
    }
    else cout << "ABC" << endl;
    return 0;
}


Measured memory_bytes: 256
n = int(input())
a = [input() for i in range(n)]
m = int(input())
b = [input() for i in range(m)]

from collections import Counter

c = Counter(a)
d = Counter(b)

ans = 0

for key, value in c.items():
    ans = max(ans, value - d[key])
print(ans)

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

#define ll long long
int n, a, b, c;
string s[100001];
char ans[100001];

void dfs(int i, int a, int b, int c) {
    if(i==n) {
        cout << "Yes" << '\n';
        for(int i=0;i<n;i++)
            cout << ans[i] << '\n';
        exit(0);
    }

    if(s[i] == "AB") {
        if(a) ans[i] = 'B', dfs(i+1, a-1, b+1, c);
        if(b) ans[i] = 'A', dfs(i+1, a+1, b-1, c);
    }
    if(s[i] == "BC") {
        if(b) ans[i] = 'C', dfs(i+1, a, b-1, c+1);
        if(c) ans[i] = 'B', dfs(i+1, a, b+1, c-1);   
    }
    if(s[i] == "AC") {
        if(a) ans[i] = 'C', dfs(i+1, a-1, b, c+1);
        if(c) ans[i] = 'A', dfs(i+1, a+1, b, c-1);
    }
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    
    cin >> n >> a >> b >> c;
    for(int i=0;i<n;i++)
        cin >> s[i];

    dfs(0, a, b, c);
    cout << "No";
}

Measured memory_bytes: 16260
#include<iostream>
#include<iomanip>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<string>
#include<algorithm>
#include<functional>
#include<math.h>
#include<unordered_set>
using namespace std;

int INF = 1 << 30;

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

	int m = str.length();

	for (int i = 1; i < str.length(); i++) {
		if (str[i - 1] != str[i]) {
			m = min(m, max(i, (int)str.length() - i));
		}
	}

	cout << m << endl;

	return 0;
}

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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;

int main() {
    //cout.precision(10);
    string s, in;
    cin >> in;
    int n = in.size();
    s = "a";
    s = s + in;
    //cout << s << endl;
    //int parent[105000];
    if((s[1] == '0') || (s[n] == '1')){
        cout << -1 << endl;
        return 0;
    }
    for(int i = 1; i < n; i++){
        if(s[i] != s[n - i]){
            cout << -1 << endl;
            return 0;
        }
    }
    int checked = 1;
    int parent = 1;
    for(int i = 1; 2 * i <= n; i++){
        if(s[i] == '1'){
            cout << parent << " " << i + 1 << endl;
            parent = i + 1;
            checked = i + 1;
            continue;
        }
        checked = i + 1;
        cout << i + 1 << " " << parent << endl;
    }
    for(int i = checked + 1; i <= n; i++){
        cout << i << " " << parent << endl;
    }
    return 0;
}

Measured memory_bytes: 1664
s=input()
n=len(s)
flag=False
for i in range(n//2):
    if s[i]!=s[-i-2]:
        flag=True
        break
if flag or s[0]=="0" or s[-1]=="1":
    print(-1)
elif n==2:
    print("2 1")
elif n==3:
    print("2 1")
    print("3 2")
else:
    print("2 1")
    head=2
    for i in range(3,n//2+2):
        print(str(i)+" "+str(head))
        if s[i-2]=="1":
            head=i
    i+=1
    while i<=n:
        print(str(i)+" "+str(head))
        i+=1


Measured memory_bytes: 47448
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MOD=1e9+7;
const int INF=1e9;
const ll LINF=(ll)1e18;

ll modpow(ll x,ll n){
    ll res=1;
    while(n>0){
        if(n&1)res=res*x%MOD;
        x=x*x%MOD;
        n>>=1;
    }
    return res;
}

struct Combination{
    vector<ll> fac,finv,inv;
    Combination(int mx){init(mx);}
    void init(int mx){
        fac.resize(mx+1);
        finv.resize(mx+1);
        inv.resize(mx+1);
        fac[0]=fac[1]=1;
        finv[0]=finv[1]=1;
        inv[1]=1;
        for(int i=2;i<=mx;i++){
            fac[i]=fac[i-1]*i%MOD;
            inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;
            finv[i]=finv[i-1]*inv[i]%MOD;
        }
    }
    ll operator()(int n,int k){
        if(n<k)return 0;
        return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD;
    }
};

int main(){
    int b,w;
    cin>>b>>w;
    ll half=modpow(2,MOD-2);
    ll s=0,t=0;
    Combination comb(b+w);
    for(int i=1;i<=b+w;i++){
        ll ans=(half*(1+s-t+MOD))%MOD;
        cout<<ans<<endl;
        if(i>=w){
            s=(s+comb(i-1,w-1)*modpow(half,i))%MOD;
        }
        if(i>=b){
            t=(t+comb(i-1,b-1)*modpow(half,i))%MOD;
        }
    }
}


Measured memory_bytes: 6912
//#include <bits/stdc++.h>                          //include all library
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <map>
#include <sstream>
#include <vector>
#include <stack>
#include <queue>
#include <string.h>
#include <functional> // greater<int> はfunctionalヘッダ
using namespace std;

#define REP(i, n) for(int i = 0;i < n;i++)          //REP(i, 10){...} //i=0～i=9までのループ
#define REPR(i, n) for(int i = n;i >= 0;i--)        //REPR(i, 10){...} //i=10～i=0までのループ
#define FOR(i, m, n) for(int i = m;i < n;i++)       //FOR(i, 3, 10){...} //i=3～i=9までのループ
#define FORR(i, m, n) for(int i = m;i >= n;i--)     //FORR(i, 10, 3){...} //i=10～i=3までのループ
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
#define PI 3.141592653589
#define npos -1


int n,a,b;


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

	cout <<  min(n*a, b) << endl;

}

Measured memory_bytes: 256
use std::io;

#[allow(unused_macros)]
macro_rules! input {
    ( $($x:expr ),*) => {
        {
            let temp_str = input_line_str();
            let mut split_result_iter = temp_str.split_whitespace();
                $(
                let buf_split_result = split_result_iter.next();
                let buf_split_result = buf_split_result.unwrap();
                    ($x) = buf_split_result.parse().unwrap();
                )*
        }
    };
}

#[allow(dead_code)]
fn input_line_str() -> String {
    let mut s = String::new();
    io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

#[allow(dead_code)]
fn p<T>(t: T)
where
    T: std::fmt::Display,
{
    println!("{}", t);
}

const SPLIT_DELIMITER: char = ' ';

#[allow(dead_code)]
fn input_vector<T>() -> Vec<T>
where
    T: std::str::FromStr,
{
    let mut v: Vec<T> = Vec::new();

    let s = input_line_str();
    let split_result = s.split(SPLIT_DELIMITER);
    for z in split_result {
        let buf = match z.parse() {
            Ok(r) => r,
            Err(_) => panic!("Parse Error"),
        };
        v.push(buf);
    }
    v
}

fn main() {
    let (n, k): (usize, usize);
    input!(n, k);
    let mut l = input_vector::<usize>();
    l.sort();
    let mut ans = 0;
    for z in &l[l.len() - k..] {
        ans += *z;
    }
    p(ans);
}

Measured memory_bytes: 4352
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int L[] = new int[N];

		for (int i = 0; i < N; i++) {
			L[i] = sc.nextInt();
		}

		Arrays.sort(L);

		int sum = 0;
		for (int i = 0; i < N - 1; i++) {
			sum += L[i];
		}

		if (L[N - 1] < sum) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}

	}
}


Measured memory_bytes: 23636
#include<iostream>
using namespace std;
int main()
{
	long long i,j,k,s=0,p,ss=5555555,q,r;
	string t,l;
	cin>>t>>l;
	q=t.size();
	r=l.size();
	for(i=0;i<=(q-r);i++)
	{
		s=0;
		p=i;
		for(j=0;j<r;j++)
		{
			if (t[p]!=l[j])s++;
			
			p++;
		}
		if (s<ss)ss=s;
	}
	cout<<ss;
}
			

Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define ALL(v) v.begin(), v.end()
#define MOD 1000000007
#define INF 1000000011
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i++)
using namespace std;
typedef long long ll;
 
int main(){
 int h,w;
  cin>>h>>w;
  char grid[h][w];
  int lc[h][w];
  int rc[h][w];
  int sc[h][w];
  for(int i=0;i<h;i++){
    string s;
    cin>>s;
    for(int j=0;j<w;j++){
      grid[i][j]=s[j];}
  }
  
  for(int i=0;i<h;i++){
  for(int j=0;j<w;j++){
  lc[i][j]=0;
    rc[i][j]=0;
  }
  }
  
  //
  for(int i=0;i<h;i++){
    int cnt=0;
  for(int j=0;j<w;j++){
    
  if(grid[i][j]=='.'){
    cnt++;}
    
    else{
      
      if(j>=1){
      if(grid[i][j-1]=='.'){
        lc[i][j-1]=cnt;}
      cnt=0;
      }
    }
    
    if(grid[i][j]=='.'&&j==w-1){
      lc[i][j]=cnt;
      cnt=0;}
  }
  }
  
  //
  for(int i=0;i<h;i++){
    int cnt=0;
  for(int j=w-1;j>=0;j--){
    if(lc[i][j]!=0){
      cnt=lc[i][j];}
    if(lc[i][j]==0&&grid[i][j]=='.'){
      lc[i][j]=cnt;}
    if(grid[i][j]=='#'){
      cnt=0;}
 
  }
  }
  //
  
  
  
  
  //
  for(int j=0;j<w;j++){
    int cnt=0;
  for(int i=0;i<h;i++){
    
  if(grid[i][j]=='.'){
    cnt++;}
    
    else{
      
      if(i>=1){
      if(grid[i-1][j]=='.'){
        rc[i-1][j]=cnt;}
      cnt=0;
      }
    }
    
    if(grid[i][j]=='.'&&i==h-1){
      rc[i][j]=cnt;
      cnt=0;}
  }
  }
  
  //
  for(int j=0;j<w;j++){
    int cnt=0;
  for(int i=h-1;i>=0;i--){
    if(rc[i][j]!=0){
      cnt=rc[i][j];}
    if(rc[i][j]==0&&grid[i][j]=='.'){
      rc[i][j]=cnt;}
    if(grid[i][j]=='#'){
      cnt=0;}
 
  }
  }
  //
  
  int ans=0;
  for(int i=0; i<h; i++){
    for(int j=0; j<w; j++){
      int val=lc[i][j]+rc[i][j];
      sc[i][j]=val;
      ans=max(ans, val);
    }
  }
  
  
  
  cout<<ans-1<<endl;
  

  
 
}


Measured memory_bytes: 51072
#include <bits/stdc++.h>
using namespace std;
#define ll                      long long int
#define pb                      push_back
#define MOD                     1000000007
#define inf                     3e18
#define ld                      long double
//#define mp                      make_pair
#define vpll                    vector<pair<ll,ll>>
#define sll                     set<ll>
#define vll                     vector<ll>
#define vld                     vector<ld>
#define vvll                    vector<vector<ll>>
#define vvld                    vector<vector<ld>>
#define pll                     pair<ll,ll>
#define vvpll                   vector<vector<pair<ll,ll>>>
#define pqll                    priority_queue<ll>
#define mll                     map<ll,ll>
#define mlc                     map<ll,char>
#define um                      unordered_map
#define umll                    um<ll,ll>
#define umlc                    um<ll,char>
#define umcl                    um<char,ll>
#define all(x)                  x.begin(),x.end()
#define fi                      first
#define se                      second
#define test                    ll Testcases;cin>>Testcases;while(Testcases--)
#define fastIO                  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define db(...)                 __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) { cerr << " "<< name << " : " << arg1 <<'\n'; }
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
    const char* comma = strchr(names + 1, ',');
    cerr.write(names, comma - names) << " : " << arg1 << " | "; __f(comma + 1, args...);
}

void inp_out()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    freopen("debug.txt", "w", stderr);
    #endif
}

int main()
{
	fastIO
	//inp_out();
	ll n,k;
	cin>>n>>k;
	vll a(n);
	for(ll i=0;i<n;++i)
	{
		cin>>a[i];
	}

	ll dp[n];
	dp[0]=0;
	for(ll i=1;i<n;++i)
	{
		dp[i]=dp[i-1]+abs(a[i]-a[i-1]);
		for(ll j=2;j<=k;++j)
		{
			if(i-j>=0)
			{
				dp[i]=min(dp[i],dp[i-j]+abs(a[i-j]-a[i]));
			}
		}
	}
	cout<<dp[n-1];
	return 0;
}



Measured memory_bytes: 1792
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
using namespace std;
#define rep(i,x) for(ll i = 0; i < (ll)(x); i++)
#define rrep(i,x) for(ll i = (ll)(x)-1;0 <= i; i--)
#define reps(i,x) for(ll i = 1; i < (ll)(x)+1; i++)
#define rreps(i,x) for(ll i = (ll)(x); 1 <= i; i--)
#define debug(x) cerr << #x << ": " << (x) << "\n";
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<vector<ll>>> vvvl;
const ll INF = numeric_limits<ll>::max()/4;
const int n_max = 1e5+10;
#define int ll

void print() {
    cout << endl;
}

template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
    cout << head;
    if (sizeof...(tail) != 0) cout << ' ';
    print(forward<Tail>(tail)...);
}

template <class T>
void print(vector<T> &vec) {
    for (auto& a : vec) {
        cout << a;
        if (&a != &vec.back()) cout << ' ';
    }
    cout << endl;
}

template <class T>
void print(vector<vector<T>> &df) {
    for (auto& vec : df) {
        print(vec);
    }
}

template<class T, class U>
void print(pair<T,U> &p){
    print(p.first, p.second);
}

template<class T>
bool chmax(T &a, T b){if(a < b){a = b; return true;} return false;}
template<class T>
bool chmin(T &a, T b){if(a > b){a = b; return true;} return false;}
void YES(bool ok){
    cout << (ok ? "Possible" : "Impossible") << endl;
}
signed main(){

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

    ll n; cin >> n;
    vector<ll> a(n);
    rep(i,n) cin >> a[i];
    ll max_ = 0;
    vector<ll> cnt(n+10);
    rep(i,n){
        chmax(max_, a[i]);
        cnt[a[i]]++;
    }
    bool ok = true;
    if(max_ % 2 == 1){
        for(int i = max_; i > max_ / 2; i--)ok &= cnt[i] > 1;
        rep(i,max_ / 2 + 1)ok &= cnt[i] == 0;
        ok &= cnt[max_ / 2 + 1] == 2;
    }
    else{
        for(int i = max_; i > max_ / 2; i--)ok &= cnt[i] > 1;
        ok &= cnt[max_ / 2] == 1;
        rep(i,max_ / 2)ok &= cnt[i] == 0;
    }

    ok &= max_ < n;
    // print(cnt);

    YES(ok);
}

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

int main(){
for(;;){
int n,x;
cin>>n>>x;
if(n==0 && x==0){break;}
int ans=0;
for(int a=1;a<=n;a++){
for(int b=a+1;b<=n;b++){
for(int c=b+1;c<=n;c++){
if(a+b+c==x){ans++;}
}}}
cout<<ans<<endl;
}


return 0;
}


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

const int N = 1000000;
bool flags[N];
int  counts[N];

void make_flags_and_counts ();

void make_flags_and_counts () {
    fill(flags, flags + N, true);
    flags[0] = false;
    flags[1] = false;

    fill(counts, counts + N, 0);
    for (int i = 2; i < N; ++i) {
        if (flags[i]) {
            for (int j = 2; i*j < N; ++j) {
                flags[i*j] = false;
            }
        }
        counts[i] = flags[i] ? counts[i-1] + 1 : counts[i-1];
    }
}

int main() {
    make_flags_and_counts();

    int n;
    while (cin >> n) {
        cout << counts[n] << endl;
    }
    return 0;
}

Measured memory_bytes: 6044
/*#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>

#include <boost/rational.hpp>
*/
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
using ll = long long;
using ld = long double;
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define rep3(i, n) for (ll i = 1; i < (ll)(n+1); i++)
#define rep4(i, s, n) for (ll i = (s); i < (ll)(n+1); i++)
#define repr(i,n) for (ll i = (n-1); i>=0;i--)
#define repr3(i,n) for(ll i = (n);i>0;i--)
#define repr4(i,s,n) for(ll i = (n);i>=(s);i--)
#define stlen(s) ll s.size()-1
#define all(v) v.begin(), v.end()
#define cout(n) cout<<std::fixed<<std::setprecision(n)
using Graph = vector<vector<int>>;
using Graphw = vector<vector<pair<ll,ll>>>;
#define INF1  INT_MAX;
#define INF2  LLONG_MAX;
#define PI  3.14159265358979323846;
#define MOD 1000000007;
/*
namespace mp = boost::multiprecision;
// 任意長整数型
using Bint = mp::cpp_int;
// 仮数部長が32の浮動小数点数型
using Real32 = mp::number<mp::cpp_dec_float<32>>;
// 仮数部長が1024の浮動小数点数型
using Real1024 = mp::number<mp::cpp_dec_float<1024>>;
// 有理数型
using Rat = boost::rational<Bint>;
*/
const int mod = 1000000007;


int main() {
string S,T;
cin>>S>>T;
int count=0;
rep(i,S.size()){
    if(S[i]!=T[i])count++;
}
cout<<count<<endl;
return 0;
}

Measured memory_bytes: 3836
//written by NewbieChd
#include <cstdio>
#include <cctype>
using namespace std;

const int BUF = 1000000;
char buf[BUF], *p1, *p2;
inline char getChar() { return p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, BUF, stdin), p1 == p2) ? EOF : *p1++; }
inline int read() {
    register int f = 0;
    char c;
    while (!isdigit(c = getChar())) {}
    do
        f = f * 10 + (c ^ 48);
    while (isdigit(c = getChar()));
    return f;
}

const int maxN = 100003;

int main() {
    int a = read() * 3, p = read();
    printf("%d\n", (a + p) >> 1);
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb emplace_back
typedef long long ll;
typedef pair<int,int> pint;

int c[101];
int main(){
    int n,d,x;
    cin>>n>>d>>x;
    int ai;
    rep(i,n){
        cin>>ai;
        for(int j=0;j*ai<d;++j){
            ++c[ai*j];
        }
    }
    int sum=0;
    rep(i,d) sum+=c[i];
    cout<<sum+x<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    string S,T;
    cin >> S >> T;
    int ans = 0;
    if(S[0] == T[0])ans++;
    if(S[1] == T[1])ans++;
    if(S[2] == T[2])ans++;
    cout << ans << endl;
}


Measured memory_bytes: 256
/// In the name of ALLAH
/// I'm THEOVE46
#include<bits/stdc++.h>
using namespace std;

#define gap             " "
#define nn              "\n"
#define pi              2*acos(0.0)
#define db              double
#define ft              float
#define ll              long long
#define ull             unsigned long long
#define pf              printf
#define sf              scanf
#define ff              first
#define ss              second
#define sc(n)           sf("%d",&n)
#define sc2(n, m)       sf("%d%d",&n,&m)
#define scl(n)          sf("%lld",&n)
#define scl2(n, m)      sf("%lld%lld",&n,&m)
#define pc(n)           pf("%d",n)
#define scf(f)          sf("%f",&f)
#define pcf(f)          pf("%f",f)
#define bfs             cin.get()
#define bfc             getchar()
#define gl(s)           getline(cin, s)
#define loop(a,n)       for(ll i=a; i<n; i++)
#define mloop(i,a,n)    for(ll i=a; i<n; i++)
#define rloop(a,n)      for(ll i=a; i>n; i--)
#define tloop(test)     for(ll tl=1; tl<=test; tl++)
#define case1(z)        cout<<"Case "<<z<<": "
#define case2(z)        printf("Case %d: ",z)
#define vi              vector<int>
#define vl              vector<ll>
#define vld(vc,rw)      vector<vector<ll> >vc(rw)
#define pii             pair<int,int>
#define pll             pair<ll,ll>
#define pis             pair<int,string>
#define psi             pair<string,int>
#define mls             map <ll,string>
#define msl             map <string,ll>
#define mll             map <ll,ll>
#define mp              make_pair
#define pb              push_back
#define itr             vector<int> :: iterator
#define sz(s)           s.size()
#define sl(s)           s.length()
#define Sort(s)         sort(s.begin(), s.end())
#define SortR(s)        sort(s.rbegin(), s.rend())
#define all(x)          x.begin(),x.end()
#define rall(x)         x.end(), x.begin()
#define MEM(ar,val)     memset(ar, (val), sizeof(ar))
#define IN(A,B,C)       assert(B<=A && A<=C)
#define EPS             1e-9
#define bug1            "**1**"
#define bug2            "****2****"
#define artri(b,h)      0.5*b*h
#define artrap(b1,b2,h) (b1+b2)/2*h
#define arcrl(r)        pi*r*r
#define vlsyl(r,h)      pi*r*r*h
#define vlcone(r,h)     pi*r*r*(h/3)
#define vlsph(r)        (4/3)*pi*r*r*r
#define flush           fflush(stdout);
#define pcn(dg,val)     fixed << setprecision(dg) << val
#define fap(x)          cout << __LINE__ << " says: " << #x << " = " << x << "\n"
#define FastIO          ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define showsort(n, a)  for(int i=0; i<n; i++) cout << a[i] << gap; cout << endl;

///THEOVE46

int main()
{
    FastIO;
    string a, b;
    ll x, i;
    cin >> a >> b;
    x = 0;
    mloop(i, 0, sl(a))
        if(a[i]!=b[i]) x++;
    cout << x << endl;
    return 0;
}

///   check for integer overflow, array bounds
///   check for n=1
///   - - - The Ove 46



Measured memory_bytes: 3884