akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define ll long long
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin >> n;
	vector<int> a(n),b(255);
	int ans=INT_MAX,c=0;
	for(int i=0;i<n;i++)
	{
		cin >> a[i];	
	}
	for(int i=-100;i<=100;i++)
	{
		c=0;
		for(int j=0;j<n;j++)
		{
			c+=(i-a[j])*(i-a[j]);
		}
		ans=min(ans,c);
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;

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

    ll n, k;
    cin >> n >> k;

    ll ans = 0;
    for(ll i = k; i <= n + 1; i++) {
        ll lo = (i - 1) * i / 2; // 0 ~ k - 1
        ll hi = (2*n - i + 1) * i / 2; // k ~ n
        ans += hi - lo + 1;
    }

    cout << ans % MOD << '\n';
    return 0;
}


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

int main(){
	int N, M, i, j, ans = 0, old, new;
	scanf("%d%d", &N, &M);
	int *A = (int *)malloc(sizeof(int) * N);
	int *Anum = (int *)malloc(sizeof(int) * N);
	int *B = (int *)malloc(sizeof(int) * N * 2);
	int *X = (int *)malloc(sizeof(int) * M);
	int *Y = (int *)malloc(sizeof(int) * M);
	for(i = 0; i < N; i++){
		scanf("%d", &A[i]);
		A[i]--;
		Anum[i] = 0;
		B[i] = 0;
		B[N + i] = 0;
	}
	for(j = 0; j < M; j++){
		scanf("%d%d", &X[j], &Y[j]);
		X[j]--;
		Y[j]--;
	}
	for(i = 0; i < N; i++){
		B[N + A[i] - Anum[A[i]]]++;
		Anum[A[i]]++;
	}
	for(i = 0; i < N; i++){
		if(B[N + i] == 0){
			ans++;
		}
	}/*
	printf("A: ");
	for(i = 0; i < N; i++){
		printf("%d  ", A[i]);
	}
	printf("\n");
	printf("Anum: ");
	for(i = 0; i < N; i++){
		printf("%d  ", Anum[i]);
	}
	printf("\n");
	printf("B: ");
	for(i = 0; i < 2 * N; i++){
		printf("%d  ", B[i]);
	}
	printf("\n");
	printf("%d\n", ans);
	printf("\n");*/
	for(j = 0; j < M; j++){
		//printf("(X, Y) = (%d, %d)\n", X[j], Y[j]);
		old = A[X[j]];
		new = Y[j];
		A[X[j]] = Y[j];
		Anum[old]--;
		B[N + old - Anum[old]]--;
		if(B[N + old - Anum[old]] == 0 && old - Anum[old] >= 0){
			ans++;
		}
		if(B[N + new - Anum[new]] == 0 && new - Anum[new] >= 0){
			ans--;
		}
		B[N + new - Anum[new]]++;
		Anum[new]++;/*
		printf("A: ");
		for(i = 0; i < N; i++){
			printf("%d  ", A[i]);
		}
		printf("\n");
		printf("Anum: ");
		for(i = 0; i < N; i++){
			printf("%d  ", Anum[i]);
		}
		printf("\n");
		printf("B: ");
		for(i = 0; i < 2 * N; i++){
			printf("%d  ", B[i]);
		}
		printf("\n");*/
		printf("%d\n", ans);
		//printf("\n");
	}
	return 0;
}

Measured memory_bytes: 6144
#include <iostream>

using namespace std;

int main()
{
    int n;
    cin >> n;
    int d[n];
    for(int i=0; i<n; i++){
        cin >> d[i];
    }
    int total = 0;
    for(int i=0; i<n; i++){
        for(int j=i+1; j<n; j++){
            total += d[i]*d[j];
        }
    }
    cout << total << endl; 
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int w[100005];
int v[100005];
int dp[100005];
#define inf 0x3f3f3f3f
int main() {
	int m, n;
	scanf("%d %d", &m, &n);
	int i, j;
	for (i = 0; i < n; i++) {
		scanf("%d %d", &w[i], &v[i]);
	}
	memset(dp, inf, sizeof dp);
	dp[0] = 0;
	for (i = 0; i < n; i++) {
		for (int j = w[i]; j <= m + 10000; j++) {
			dp[j] = min(dp[j], dp[j - w[i]] + v[i]);
		}
	}
	int ans = inf;
	for (i = m; i <= m + 10000; i++) {
		ans = min(ans, dp[i]);
	}
	cout << ans << endl;
	return 0;
}

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


void solve(long long N, long long K){
  cout << floor(log(N)/log(K))+1 << endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
  scanf("%lld",&N);
  long long K;
  scanf("%lld",&K);
    solve(N, K);
    return 0;
}


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()

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

    // start
    vector<char> a(3), b(3);
    rep(i, 3) cin >> a.at(i);
    rep(i, 3) cin >> b.at(i);
    reverse(all(a));
    if (a == b)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
    // end

    return 0;
}


Measured memory_bytes: 256
import collections
import itertools


N,C = list(map(int,input().split(" ")))

Ds = []

for i in range(C):
    Ds.append(list(map(int,input().split(" "))))


grid = []
for i in range(N):
    grid.append(list(map(int,input().split(" "))))
color_gird_count = [[0 for _ in range(C + 1)] for _ in range(3)]

for i in range(N):
    for j in range(N):
        c = grid[i][j]
        amari = (i + j + 2) % 3
        color_gird_count[amari][c] += 1
col_val = itertools.permutations(range(1,C + 1),3)
ans = 10** 23
for col in col_val: # 塗り替える色
    cot = 0
    for i in range(3):
        for from_c in range(0,C):
           cot += color_gird_count[i][from_c + 1] * Ds[from_c ][col[i] -1 ]
    ans = min(ans,cot)

print(ans)

Measured memory_bytes: 5876
//teja349
#include <bits/stdc++.h>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <climits>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <iomanip>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
//setbase - cout << setbase (16); cout << 100 << endl; Prints 64
//setfill -   cout << setfill ('x') << setw (5); cout << 77 << endl; prints xxx77
//setprecision - cout << setprecision (14) << f << endl; Prints x.xxxx
//cout.precision(x)  cout<<fixed<<val;  // prints x digits after decimal in val

using namespace std;
using namespace __gnu_pbds;

#define f(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) f(i,0,n)
#define fd(i,a,b) for(i=a;i>=b;i--)
#define pb push_back
#define mp make_pair
#define vi vector< int >
#define vl vector< ll >
#define ss second
#define ff first
#define ll long long
#define pii pair< int,int >
#define pll pair< ll,ll >
#define sz(a) a.size()
#define inf (1000*1000*1000+5)
#define all(a) a.begin(),a.end()
#define tri pair<int,pii>
#define vii vector<pii>
#define vll vector<pll>
#define viii vector<tri>
#define mod (998244353)
#define pqueue priority_queue< int >
#define pdqueue priority_queue< int,vi ,greater< int > >
#define flush fflush(stdout) 
#define primeDEN 727999983
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

// find_by_order()  // order_of_key
typedef tree<
int,
null_type,
less<int>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;

ll a[123456];
int main(){
    std::ios::sync_with_stdio(false); cin.tie(NULL);
  	int n;
  	cin>>n;
  	ll i;
  	rep(i,n){
  		cin>>a[i];
  	}
  	sort(a,a+n);
  	ll ans=1;
  	ans=a[0];
  	f(i,1,n){
  		ans*=__gcd(i,a[i]);
  		ans%=mod;
  	}
  	cout<<ans<<endl;
    return 0;   
}


Measured memory_bytes: 1152
import sys


def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def S(): return input()
def LS(): return input().split()


INF = float('inf')


n = I()
cnt = [0] * 10001
for x in range(1, 101):
    for y in range(1, 101):
        for z in range(1, 101):
            v = x**2 + y**2 + z**2 + x*y + y*z + z*x
            if v <= n:
                cnt[v] += 1

for i in range(1, n + 1):
    print(cnt[i])


Measured memory_bytes: 9276
#include<iostream>
using namespace std;
int main(){
  long h,w,s1,s2,s3,num,mi,smi,sma;
  cin >> h >> w;
  mi = h*w;
  for(int i=1;i<w;i++){
    s1=i*h; s2=s3=(w-i)*(h/2);
    if(h%2!=0) s3+=w-i;
    smi = min(s1,min(s2,s3)); sma=max(s1,max(s2,s3));
    num = sma-smi;
    mi = (num<mi)?num:mi;
  }
  for(int i=1;i<h;i++){
    s1=i*w; s2=s3=(h-i)*(w/2);
    if(w%2!=0) s3+=h-i;
    smi = min(s1,min(s2,s3)); sma=max(s1,max(s2,s3));
    num = sma-smi;
    mi = (num<mi)?num:mi;
  }
  if(w%3==0){
    mi =0;
  }else{
    num = h;
    mi = (num<mi)?num:mi;
  }
  if(h%3==0){
    mi =0;
  }else{
    num = w;
    mi = (num<mi)?num:mi;
  }
  cout << mi <<endl;
}
  


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <array>
#include <queue>
#include <stack>
#include <set>
#include <utility>
using namespace std;

int main() {
  int N; cin >> N;
  int c = 0;
  for (int i = 0; i < N; i++) {
    int l, r; cin >> l >> r;
    c += r-l+1;
  }
  cout << c << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
  ll n,ans=1e12;
  cin >> n;
  for(ll i=1;i*i<=n;i++){
    ll a,b;
    if(n%i == 0){
      a = i;
      b = n/i;
    }
    ans = min(ans,a+b-2);
  }
   cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int judge(int number, int sum, int counter) {
	if (sum == 0 && number == 0) {
		return 1;
	} else if ((sum > 0 && number == 0) || (number >= 2 && sum <= 0) || counter < 0){
		return 0;
	} else {
		if (counter > sum) {
			return judge(number, sum, counter-1);
		} else {
			return judge(number-1, sum-counter, counter-1)+judge(number, sum, counter-1);
		}
	}
}

int main() {
	int n,s;
	while (cin >> n >> s) {
		if (n == 0 && s == 0) {
			break;
		}
		cout << judge(n,s,9) << endl;
	}
	return 0;
}

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

int main(){
  int h, w, k; cin >> h >> w >> k;
  vector<string> s(h);
  for (int i = 0; i < h; i++){
    cin >> s.at(i);
  }
  vector<int> row;
  for (int i = 0; i < h; i++){
    int flag = 0;
    for (int j = 0; j < w; j++){
      if (s.at(i).at(j) == '#') flag = 1;
    }
    if (flag) row.push_back(i);
  }
  int num = 0;
  vector<vector<int>> ans(h, vector<int>(w));
  for (int i = 0; i < row.size(); i++){
    int v1 = 0, v2 = h-1;
    if (i < row.size()-1) v2 = row.at(i);
    if (i > 0) v1 = row.at(i-1)+1;
    vector<int> col;
    int r = row.at(i);
    for (int j = 0; j < w; j++){
      if (s.at(r).at(j) == '#') col.push_back(j);      
    }
    for (int j = 0; j < col.size(); j++){
      num++;
      int z1 = 0, z2 = w-1;
      if (j < col.size()-1) z2 = col.at(j);
      if (j > 0) z1 = col.at(j-1)+1;
      for (int k = z1; k <= z2; k++){
        for (int l = v1; l <= v2; l++){
          ans.at(l).at(k) = num;
        }
      }
    }
  }
  for (int i = 0; i < h; i++){
    for (int j = 0; j < w; j++){
      cout << ans.at(i).at(j) << " ";
    }
    cout << endl;
  }
}

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

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


Measured memory_bytes: 3608
#include <stdio.h>

int main(void)
{
	int n;
	int i, j, k;
	int a[8];
	int ans[16];
	char hugou[20];
	
	while (1){
		scanf("%d", &n);
		if (n == 0){
			break;
		}
		
		
		for (i = 0; i < n; i++){
			for (j = 0; j < 8; j++){
				scanf("%d", &a[j]);
			}
			
			for (j = 0; j < 4; j++){
				for (k = 0; k < 4; k++){
					ans[4 * j + k] = a[j] * a[k + 4];
				}
			}
			
			strcpy(hugou, "0ijki0kjjk0ikji0");
			
			ans[5] *= -1;
			ans[7] *= -1;
			ans[9] *= -1;
			ans[10] *= -1;
			ans[14] *= -1;
			ans[15] *= -1;
			
			ans[0] += ans[5] + ans[10] + ans[15];
			ans[1] += ans[4] + ans[11] + ans[14];
			ans[2] += ans[7] + ans[8] + ans[13];
			ans[3] += ans[6] + ans[9] + ans[12];
			
			printf("%d %d %d %d\n", ans[0], ans[1], ans[2], ans[3]);
		}
	}
	
	return (0);
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
typedef long long ll;
#define rep(i,n) for(ll i = 0; i < (n); ++i )
#define rep_rev(n,i) for(ll i = n; i >= 0; --i )
using namespace std;
using P = pair<int, int>;
const long long INF = 1LL << 60;

int main(){
  int N; cin >> N;
  double ans = (double)N / 2;
  cout << round(ans) << endl;
  return 0;
}


Measured memory_bytes: 256
package main

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

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 500001), 500000)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}

func main() {
	fp := os.Stdin
	if len(os.Args) > 1 {
		fp, _ = os.Open(os.Args[1])
	}

	scanner := getScanner(fp)
	writer := bufio.NewWriter(os.Stdout)

	s := getNextString(scanner)
	n := len(s)
	dp := make([][2][13]int, n+1)

	dp[0][0][0] = 1

	mod := int(1e9 + 7)

	for i := 0; i < n; i++ {
		i10 := n - 1 - i
		for ii := 0; ii < 2; ii++ {
			for iii := 0; iii < 13; iii++ {
				if s[i] == '?' {
					for iiii := 0; iiii <= 9; iiii++ {
						m := inc(iiii, i10)
						dp[i+1][ii][(iii+m)%13] += dp[i][ii][iii]
						dp[i+1][ii][(iii+m)%13] %= mod
					}

					continue
				}
				m := inc(int(s[i]-'0'), i10)
				if ii == 0 {
					dp[i+1][0][(iii+m)%13] += dp[i][ii][iii]
					dp[i+1][0][(iii+m)%13] %= mod
				} else {
					dp[i+1][1][(iii+m)%13] += dp[i][ii][iii]
					dp[i+1][1][(iii+m)%13] %= mod
				}
			}
		}
	}
	fmt.Fprintln(writer, dp[n][0][5]+dp[n][1][5])
	writer.Flush()
}

func inc(num, i10 int) int {
	mm := [6]int{
		1, 10, 9, 12, 3, 4,
	}
	return num * (mm[i10%6])
}


Measured memory_bytes: 21888
#include <iostream>

using namespace std;

int main(int argc, const char *argv[]) {
  int K, A, B;
  cin >> K >> A >> B;

  for(int i = A; i < B+1; i++){
    if(i % K == 0){
      cout << "OK" << endl;
      return 0;
    }
  }
  cout << "NG" << endl;
  return 0;
}


Measured memory_bytes: 3628
# coding: utf-8
# Your code here!


while True:
    x,y = map(int,input().split())
    if x == 0 and y == 0:
        break

    for i in range(x):
        if i % 2 == 0:
            for j in range(y):
                if j % 2 == 0:
                    print("#", end="")
                else:
                    print(".", end="")
        else:
            for j in range(y):
                if j % 2 == 0:
                    print(".", end="")
                else:
                    
                    print("#", end="")
        print()
    print()


Measured memory_bytes: 7012
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():
    def main():
        H,W=map(int,input().split())
        grid=[list(map(str,input().split())) for _ in range(H)]

        moji='ABCDEFGHIJKLMNOPQRSTUVWXYZ'

        for i in range(H):
            for j in range(W):
                if grid[i][j]=='snuke':
                    return [moji[j],i+1]
    for i in main():
        print(i, end='')
    print()
resolve()

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

    int main(){
        string s;
        getline(cin, s);
        int a = s.size();
        int b = 0;
        for(int i = 0; i < (int)a/2; i++){
            if(s[i] != s[a-i-1]){
                b++;
            }
        }
        cout << b << endl;
    }

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <string>
#include <unordered_map>

int t1,t2,t3;

int n,s;

std::unordered_map<std::string,long long> memo;
long long getans(std::string a,std::string b,std::string c)
{
    //printf("AAA %s/%s/%s\n",a.c_str(),b.c_str(),c.c_str());
    if (!a.empty() && !c.empty()) {
        t1=0;
        while (t1<a.size() && t1<c.size() && a[t1]==c[c.size()-1-t1]) t1++;
        if (t1<a.size() && t1<c.size()) return 0;
        a=a.substr(t1);
        c=c.substr(0,c.size()-t1);
    }
    if (a.size()>b.size()) return 0;
    if (c.size()>b.size()) return 0;
    if (b.empty()) return 1;
    std::string key=a+"/"+b+"/"+c;
    //printf("BBB %s\n",key.c_str());
    if (memo.count(key)) return memo[key];
    // don't select first letter
    long long ans=getans(a+b[0],b.substr(1),c);
    // select first letter
    for (int i=1; i<b.size(); i++) {
        if (b[0]==b[i]) {
            ans+=getans(a,b.substr(1,i-1),b.substr(i+1)+c);
        }
    }
    // done
    //printf("what %s = %lld\n",key.c_str(),ans);
    return memo[key]=ans;
}

int main()
{
    #ifdef NOT_DMOJ
    freopen("data.txt","r",stdin);
    #endif // NOT_DMOJ
    std::string zero,s;
    std::cin >> n >> s;
    std::cout << getans(zero,s,zero)*2;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define FOR(i, m, n) for (int i = m; i < (n); i++)
#define RFOR(i, m, n) for (int i = (m - 1); i >= 0; i--)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, n, 0)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
using namespace std;
typedef long long ll;
const int mod = 1e9 + 7;
const ll INF = 1000000000000000000LL;

struct mint {
  ll x;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod - a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res -= a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod - 2); }
  mint& operator/=(const mint a) { return (*this) *= a.inv(); }
  mint operator/(const mint a) const {
    mint res(*this);
    return res /= a;
  }
};

mint factorial(ll n) {
  mint answer = 1;
  while (n > 1) {
    answer *= n;
    n--;
  }
  return answer;
}

mint combination(ll n, ll r) {
  return factorial(n) / (factorial(r) * factorial(n - r));
}

mint permutation(ll n, ll r) { return factorial(n) / factorial(n - r); }

// setprecision(8) 桁数指定
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }

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

template <typename T>
void remove(std::vector<T>& vector, unsigned int index) {
  vector.erase(vector.begin() + index);
}

map<ll, ll> prime_factor(ll n) {
  map<ll, ll> ret;
  for (ll i = 2; i * i <= n; i++) {
    while (n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if (n != 1) ret[n] = 1;
  return ret;
}
// for (auto p : prime_factor(n)) {
//	while (p.second--) {
//		cout << p.first << endl;
//	}
//}

vector<ll> divisor(ll n) {
  vector<ll> ret;
  for (ll i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      ret.push_back(i);
      if (i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}

bool compare_by_b(pair<ll, ll> a, pair<ll, ll> b) {
  if (a.second != b.second) {
    return a.second < b.second;
  } else {
    return a.first < b.first;
  }
}

vector<ll> Eratosthenes(const ll N) {
  bool is_prime[1000000 + 1];
  vector<ll> P;
  for (ll i = 0; i <= N; i++) {
    is_prime[i] = true;
  }
  for (ll i = 2; i <= N; i++) {
    if (is_prime[i]) {
      for (ll j = 2 * i; j <= N; j += i) {
        is_prime[j] = false;
      }
      P.emplace_back(i);
    }
  }
  return P;
}

typedef vector<int> ivec;
typedef vector<string> svec;
typedef vector<ll> lvec;

int main() {
  int a, b;
  cin >> a >> b;
  int x = min(a, b);
  int r = max(a, b);
  REP(i, r) { cout << x; }
  cout << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>

int main()
{
  int n,d;
  std::cin >> n;
  std::cin >> d;

  int i = 1+d*2;

  int number=0;

  while (1){
    ++number;
    if (n <= i * number){
      break;
    }
  }

  std::cout << number << std::endl;
  

}


Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**5)
 
n, m = map(int, input().split())
 
edges = [[] for _ in range(n+1)]
for _ in range(m):
    x, y = map(int, input().split())
    edges[x].append(y)
 
dp = [-1 for _ in range(n+1)]
 
def longest_path(u):
    if dp[u] != -1:
        return dp[u]
    d = 0
    for v in edges[u]:
        d = max(d, 1+longest_path(v))
    dp[u] = d
    return d
 
for u in range(1, n+1):
    longest_path(u)
 
print(max(dp))

Measured memory_bytes: 162508
def resolve():

    n = int(input())
    li_p = list(map(int, input().split()))

    cnt = 0

    for i in range(1, n-1):

        if li_p[i-1] < li_p[i] & li_p[i] < li_p[i+1]:
            cnt += 1

        elif li_p[i-1] > li_p[i] & li_p[i] > li_p[i+1]:
            cnt += 1

    print(cnt)
    
resolve()

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

public class Main {

	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String s = br.readLine();
		String[] array = s.split(" ");

		int a = Integer.parseInt(array[0]);
		int b = Integer.parseInt(array[1]);

		if (a + b >= 10) {
			System.out.println("error");
		} else {
			System.out.println(a + b);
		}
	}
}


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

int main(){
  int n,ans=1;
  cin>>n;
  
  vector<int> lis;
  rep(i,0,n){
    int tmp;
    cin>>tmp;
    lis.emplace_back(tmp);
  }

  sort(lis.begin(),lis.end(),greater<int>());
  rep(i,0,n-1){
    if(lis[i]>lis[i+1]){ans++;}
  }
  
  cout<<ans<<endl;

  return 0;
}


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

#if __has_include("print.hpp")
  #include "print.hpp"
#endif

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define MOD 1000000007
#define INF 100100100

typedef long long ll;
typedef pair<int, int> p;


int main(){
  int n;
  cin >> n;
  vector<ll> v(3*n);
  for (int i = 0; i < 3*n; i++) {
    cin >> v[i];
  }
  sort(all(v));
  ll res = 0;
  ll count = 0;
  for (int i = 3*n-2; count != n; i-=2) {
    count++;
    res += v[i];
    // cout << res << endl;
  }
  cout << res << endl;
}


Measured memory_bytes: 2560
#include<stdio.h>
#include<math.h>

int main(){
	double a,b,c,d,e,f;
	double X,Y;
	while(scanf("%lf %lf %lf %lf %lf %lf",&a,&b,&c,&d,&e,&f)!=EOF){
		X=(b*f-e*c)/(d*b-a*e);
		Y=(a*f-d*c)/(a*e-d*b);
		X=round(X*1000)/1000;
		Y=round(Y*1000)/1000;
		if(X==0)
			X=0;
		if(Y==0)
			Y=0;
		printf("%.3f %.3f\n",X,Y);
	}
	return 0;
}

Measured memory_bytes: 664
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long 
#define inf 0x3f3f3f3f
#define infll 0x3f3f3f3f3f3f3f3f
#define all(x) (x).begin(),(x).end()
#define forn(i, a, b) for (int i=a; i<(signed)(b); ++i)
#define pb push_back
 
 
// debug templates 
#define debug(x)       cerr<< #x <<" : "<< x << endl;
#define debuga(A,N)    cerr<< #A <<" : [";for(int i = 0; i<N;i++) cerr<<A[i]<<" "; cerr<<"]\n";
#define debuga2(A,N,M) cerr<< #A << " : \n"; for(int i=0;i<N;i++){cerr<<"[";for(int j=0;j<M;++j) cerr<<A[i][j]<<" ";cerr<<"]\n";}
#define debugp(p)      cerr<< #p <<" : "<<"("<<(p).first<<","<<(p).second<<")\n";
#define debugv(v)      cerr<< #v <<" : "<<"[";for(int i = 0; i< (v).size(); i++) cerr<<v[i]<<" "; cerr<<"]\n";
#define debugv2(v)     cerr<< #v << " : \n"; for(int i=0;i<v.size();i++){cerr<<"[";for(int j=0;j<(v[0].size());++j) cerr<<v[i][j]<<" ";cerr<<"]\n";}
#define debugs(m)      cerr<< #m <<" : [ "; for(auto itr = m.begin(); itr!=m.end();itr++) cerr<<*itr<<" "; cerr<<"]\n";
#define debugm(m)      cerr<< #m <<" : [ "; for(auto itr = m.begin();itr!=m.end(); itr++) cerr<<"("<<itr->first<<","<<itr->second<<") ";cerr<<"]\n";
 

void solve(){
	int x,n; cin >> x >> n;
	set<int> s;
	forn(i,0,n){
		int a; cin >> a;
		s.insert(a);
	}
	int sep = 0;
	while(1){
		int small = x - sep;
		int big = x + sep;
		if(s.find(small) == s.end()){
			cout << small;
			break;
		}
		if(s.find(big) == s.end()){
			cout << big; 
			break;
		}
		++sep;
	}
}
 
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	
	solve();
	return 0;
}
 


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

double p(double P){
    if (P == 0) return 0;

    return P + p(P-1);

}

int main(){
    long long n,k;
    cin >> n >> k;

    vector<double> sum(n);
    vector<double> out(n);
    double num;
    out[0] = 0;
    for (int i = 0;i < n;i++){
        cin >> num;
        sum[i] = p(num) / num;
        if (i == 0) out[i] = sum[i];
        out[i] = out[i-1] + sum[i];
    }   

    double ans = 0;
    if (k == 1) ans = out[0];
        for (int i = 0;i < n;i++){
            double rep = 0;
            if (i < k) continue;
        
            rep = out[i] - out[i-k];

            ans = max(ans,rep);
        }
    if (n == k) ans = out[n-1];
    printf("%.10lf\n",ans);
}

Measured memory_bytes: 3456
#include<iostream>
using namespace std;
long long gcd(long long x, long long y) {
	if (x % y == 0) {
        return y;
    } else {
        return gcd(y, x % y);
    }
}
main(){
    long long a, b, c, d;
    cin >> a >> b >> c >> d;
    long long count = 0;
    long long gc = 0;
    gc = gcd(c, d);
    long long lc = c * d / gc;
    long long e = b / c - (a - 1) / c;
    long long f = b / d - (a - 1) / d; 
    long long g = b / lc - (a - 1) / lc;
    count =  b - a + 1 - e - f + g;
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
#define sort(v) sort(all(v))
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;

int main() {
    IOS
	int t=1;
	//cin>>t;
	while(t--)
	{
	    int x;
	    cin>>x;
	    cout<<(x/500)*1000+((x-(x/500)*500)/5)*5;
	}
	return 0;
}

Measured memory_bytes: 256
a,z,x,i,j;main(t){for(scanf("%d",&t);t--;printf("%d %d\n",-z,a))for(a=z=0,scanf("%d%d",&x,&i);--x;i=j)scanf("%d",&j),i-=j,a=i>a?i:a,z=i<z?i:z;}

Measured memory_bytes: 0
def acinput():
    return list(map(int, input().split(" ")))


def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return sorted(divisors)


N,M=acinput()


for d in make_divisors(M):
    if d<=M/N:
        res=d
        

print(res)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=(n)-1;i>=0;i--)
using namespace std;

int main()
{
    int N;
    scanf("%d", &N);
    vector<int> a(N + 1);
    for(int i = 1; i <= N; i++){
        scanf("%d", &a[i]);
    }
    int ans = 0;
    for(int i = 1; i <= N; i++){
        if(a[a[i]] == i){
            ans++;
        }
    }
    printf("%d\n", ans / 2);
}

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

int main() {
	int n;
	int a[100];
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	sort(a, a + n, greater<int>());
	int alice = 0, bob = 0;
	for (int i = 0; i < n; i++) {
		if (i % 2 == 0) {
			alice += a[i];
		} else {
			bob += a[i];
		}
	}
	cout << alice - bob << endl;
}

Measured memory_bytes: 3584
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define ll unsigned long long
#define ld long double
#define pii pair<int,int>
#define fi first
#define se second
#define mex 1000005
#define fast  ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
vector<int> adj[mex];
//a+b=a^b+2*(a&b)
ll binpow(ll a, ll b){
	ll r=1;
	while(b){
		if(b&1)
		 r=(r*a)%mod;
		a=(a*a)%mod;
	    b=b/2;
	}
	return r%mod;
}	 

bool comp(pair<int,int> a, pair<int,int> b){
	if(a.fi<b.fi)
	 return true;
	else if(a.fi==b.fi){
		if(a.se<b.se)
		 return true;
		return false;
	}
	return false;
}
   
int main(){
	fast
	int h,w,n;
	cin>>h>>w>>n;
	vector<pair<int,int> > v(n);
	for(int i=0;i<n;i++)
	 cin>>v[i].fi>>v[i].se;
	
	sort(v.begin(),v.end(),comp);
	//for(int i=0;i<n;i++)
	 //cout<<v[i].fi<<" "<<v[i].se<<endl;  
	ll fact[mex];
	fact[0]=1;
	for(ll i=1;i<mex;i++)
	 fact[i]=(i*fact[i-1])%mod;
	
	ll t=((fact[h+w-2]*binpow(fact[h-1],mod-2))%mod*binpow(fact[w-1],mod-2))%mod;
	ll t1[n],t2[n];
	for(int i=0;i<n;i++){
		t1[i]=((fact[v[i].fi+v[i].se-2]*binpow(fact[v[i].fi-1],mod-2))%mod*binpow(fact[v[i].se-1],mod-2))%mod;
		t2[i]=0;
		for(int j=0;j<i;j++){
			ll tt=0;
			if(v[j].fi<=v[i].fi && v[j].se<=v[i].se){
				tt=((fact[v[i].fi+v[i].se-v[j].fi-v[j].se]*binpow(fact[v[i].fi-v[j].fi],mod-2))%mod*binpow(fact[v[i].se-v[j].se],mod-2))%mod;
				tt=(tt*t1[j])%mod;
			}
			
			t2[i]=(t2[i]+tt)%mod;	
		}
		t1[i]=(t1[i]-t2[i]+mod)%mod;
		//cout<<t1[i]<<endl;
		ll t3=(fact[h+w-v[i].fi-v[i].se]*binpow(fact[h-v[i].fi],mod-2))%mod;
		t3=(t3*binpow(fact[w-v[i].se],mod-2))%mod;
		ll tt1=(t1[i]*t3)%mod;
		//cout<<t1<<endl;
		t=(t-tt1+mod)%mod;
	}
	cout<<t%mod;
		
}


Measured memory_bytes: 31616
#include<iostream>
#include<cstring>
#include<cstdio>
using namespace std;
const int mod = 1e9+7;
long long a[2001]={0,0,0,1,1,1,2,3,4,6,9,13};
int main()
{
	int x;
	cin>>x;
	for(int i=12;i<=x;i++)
		a[i]=(a[i-1]%mod+a[i-3]%mod)%mod;
	cout<<a[x]<<endl;	
	return 0;
}


Measured memory_bytes: 3652
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
#include <numeric>

using namespace std;
namespace {

	void chmin(long long& x, long long y)
	{
		if (x > y || x < 0)
			x = y;
	}

	void chmax(long long& x, long long y)
	{
		if (x < y)
			x = y;
	}

	long long gcd(long long a, long long b) {
		if (b == 0) return a;
		else return gcd(b, a%b);
	}

	long long gcd(long long a, long long b, long long c) {
		return gcd(gcd(a, b), c);
	}

	void core()
	{
		long N;
		cin >> N;

		string inS;
		cin >> inS;



		std::vector<long> numR(N + 1, 0);
		std::vector<long> numG(N + 1, 0);
		std::vector<long> numB(N + 1, 0);

		std::vector<char> S(N + 1);
		for (int i = 1; i <= N; ++i)
			S[i] = inS[i - 1];

		for (long i = N; i >= 1; --i)
		{
			if (i < N)
			{
				numR[i] = numR[i+1];
				numG[i] = numG[i + 1];
				numB[i] = numB[i + 1];
			}
				
			if (S[i] == 'R')
				numR[i]++;
			else if (S[i] == 'G')
				numG[i]++;
			else if (S[i] == 'B')
				numB[i]++;
		}


		long long ret(0);
		for (long i = 1; i <= N; ++i)
		{
			if (S[i] == 'R')
			{
				for (long j = i+1; j < N; ++j)
				{
					if (S[j] == 'G')
					{
						long diff = j - i;
						long numBLeft = numB[j + 1];
						long KSameWidth = j + diff;
						if (KSameWidth <= N && S[KSameWidth] == 'B')
							numBLeft--;

						ret += numBLeft;
					}

					if (S[j] == 'B')
					{
						long diff = j - i;
						long numGLeft = numG[j + 1];
						long KSameWidth = j + diff;
						if (KSameWidth <= N && S[KSameWidth] == 'G')
							numGLeft--;

						ret += numGLeft;
					}
				}
			}


			else if (S[i] == 'G')
			{
				for (long j = i + 1; j < N; ++j)
				{
					if (S[j] == 'B')
					{
						long diff = j - i;
						long numLeft = numR[j + 1];
						long KSameWidth = j + diff;
						if (KSameWidth <= N && S[KSameWidth] == 'R')
							numLeft--;

						ret += numLeft;
					}

					if (S[j] == 'R')
					{
						long diff = j - i;
						long numLeft = numB[j + 1];
						long KSameWidth = j + diff;
						if (KSameWidth <= N && S[KSameWidth] == 'B')
							numLeft--;

						ret += numLeft;
					}
				}
			}

			else if (S[i] == 'B')
			{
				for (long j = i + 1; j < N; ++j)
				{
					if (S[j] == 'R')
					{
						long diff = j - i;
						long numLeft = numG[j + 1];
						long KSameWidth = j + diff;
						if (KSameWidth <= N && S[KSameWidth] == 'G')
							numLeft--;

						ret += numLeft;
					}

					if (S[j] == 'G')
					{
						long diff = j - i;
						long numLeft = numR[j + 1];
						long KSameWidth = j + diff;
						if (KSameWidth <= N && S[KSameWidth] == 'R')
							numLeft--;

						ret += numLeft;
					}
				}
			}
		}

		cout << ret;
	}
}

int main()
{
	core();

	return 0;
}

//int main()
//{
//	for (long i = 0; i < 3; ++i)
//	{
//		cout << "Input test" << endl;
//		core();
//		cout << endl;
//	}
//
//	cout << "test ended" << endl;
//
//	int ret;
//	cin >> ret;
//
//	return 0;
//}

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

using namespace std;

#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)((x).size()))

typedef pair<int, int> PII;
typedef vector<int> VI;
typedef long long int64;
typedef unsigned int uint;
typedef unsigned long long uint64;

#define gi(x) ((x) = F())
#define gii(x, y) (gi(x), gi(y))
#define giii(x, y, z) (gii(x, y), gi(z))

int F()
{
	char ch;
	int x, a;
	while (ch = getchar(), (ch < '0' || ch > '9') && ch != '-');
	if (ch == '-') ch = getchar(), a = -1;
	else a = 1;
	x = ch - '0';
	while (ch = getchar(), ch >= '0' && ch <= '9')
		x = (x << 1) + (x << 3) + ch - '0';
	return a * x;
}

int a[7], b[7];

int64 ans = 0, res = 0;

int main()
{
	for (int i = 0; i < 7; ++i) gi(a[i]), b[i] = a[i];
	ans += 4LL * (a[0] >> 1); a[0] &= 1;
	ans += 4LL * (a[3] >> 1); a[3] &= 1;
	ans += 4LL * (a[4] >> 1); a[4] &= 1;
	ans += 2LL * a[1]; a[1] = 0;
	if (a[0] && a[3] && a[4]) ans += 6;
	if (b[0] && b[3] && b[4]) --b[0], --b[3], --b[4], res += 6;
	res += 4LL * (b[0] >> 1);
	res += 4LL * (b[3] >> 1);
	res += 4LL * (b[4] >> 1);
	res += 2LL * b[1];
	printf("%lld\n", max(ans, res) >> 1);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<cmath>
#define pb push_back
#define ld long double
#define mp make_pair
#define vl vector<ll> 
#define vd vector<double>
#define vld vector<long double>
#define ll long long int
#define pl pair<ll, ll>
#define all(a) a.begin(), a.end()
#define forr(i, n) for(ll i=0; i<n; i++) 
#define forr1(i, n) for(ll i=1; i<=n; i++)
using namespace std;
const ld PI =3.1415926535897923846;
const ll MOD = 1000000007;
const ll N=998244353;
ll power(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;}
ll modinverse(ll a){return power(a, MOD-2);}
void solve()
{
    ll n;
    cin>>n;
    vl dp(n+10, 0);
    dp[3]=1;
    dp[4]=1;
    dp[5]=1;
    dp[0]=1;
    // i is for the sum
    for(ll i=6; i<=n; i++)
    {
    	forr(j, i)
    	{
    		if((i-j>=3&&j>=3)||j==0)
    		{
    			dp[i]+=dp[j];

    			dp[i]%=MOD;
    			/*if(i==n)
    				cout<<i<<' '<<j<<' '<<dp[i]<<' '<<dp[i-j]<<endl;*/
    		}
    	}
    }
    cout<<dp[n]<<endl;
}
int main()
{
	#ifndef ONLINE_JUDGE
        // for getting input from input.txt
        freopen("input.txt", "r", stdin);
        // for writing output to output.txt
        freopen("output.txt", "w", stdout);
    #endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll test=1;
    //cin>>test;
    while(test--)
    {
        solve();
    }
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
}

Measured memory_bytes: 3800
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Atc_0024
{
    class Program
    {
        static void Main(string[] args)
        {
            var rStr = Console.ReadLine();

            int N = int.Parse(rStr.Split(' ')[0]);
            int R = int.Parse(rStr.Split(' ')[1]);

            int result = 0;

            if (10 <= N)
            {
                result = R;
            }
            else
            {
                result = R + 100 * (10 - N);
            }

            Console.WriteLine(result);

        }
    }
}


Measured memory_bytes: 27248
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <string>
#include <set>
#include <algorithm>

using namespace std; 

int main()
{
	int a, b, c;

	cin >> a >> b >> c;
 

  
   cout << max(c - (a - b),0) << endl;

	return 0;
}

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

#ifdef NON_SUBMIT
#define TEST(n) (n)
#define tout cerr
#else
#define TEST(n) ((void)0)
#define tout cin
#endif

using namespace std;

const int dx[]={-1,1,0,0}, dy[]={0,0,-1,1};
vector<pair<int,int>> O;
int N, dist[500][500];
bool C[500][500];

bool valid_coord(int x, int y)
{
	return 0<=x && x<N && 0<=y && y<N;
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
	TEST(freopen("input.txt","r",stdin));
	TEST(freopen("output.txt","w",stdout));
	TEST(freopen("debug.txt","w",stderr));
	int ans=0;
	queue<pair<int,int>> Q;
	cin>>N; memset(dist,0x7f,sizeof(dist));
	for(int i=0;i<N;i++) {
		for(int j=0;j<N;j++) {
			int p;
			cin>>p; --p;
			O.emplace_back(p/N,p%N);
			C[i][j]=true;
			if(i==0 || j==0 || i==N-1 || j==N-1) {
				dist[i][j]=1;
				Q.emplace(i,j);
			}
		}
	}
	while(!Q.empty()) {
		auto[x,y]=Q.front();
		Q.pop();
		for(int k=0;k<4;k++) if(valid_coord(x+dx[k],y+dy[k]) && dist[x+dx[k]][y+dy[k]]>dist[x][y]+1) {
			dist[x+dx[k]][y+dy[k]]=dist[x][y]+1;
			Q.emplace(x+dx[k],y+dy[k]);
		}
	}
	for(auto[x,y]: O) {
		ans+=--dist[x][y];
		C[x][y]=false;
		Q.emplace(x,y);
		while(!Q.empty()) {
			auto[x,y]=Q.front();
			Q.pop();
			for(int k=0;k<4;k++) if(valid_coord(x+dx[k],y+dy[k]) && dist[x+dx[k]][y+dy[k]]>dist[x][y]+C[x+dx[k]][y+dy[k]]) {
				dist[x+dx[k]][y+dy[k]]=dist[x][y]+C[x+dx[k]][y+dy[k]];
				Q.emplace(x+dx[k],y+dy[k]);
			}
		}
	}
	cout<<ans<<'\n';
	return 0;
}

Measured memory_bytes: 6584
using System;
using System.Collections.Generic;
using System.Linq;

namespace AtCoder {
    class Program {
        static void Main(string[] args) {

            string[] buf = Console.ReadLine().Split(' ');
            int[] upperArray = Array.ConvertAll(buf, int.Parse);

            buf = Console.ReadLine().Split(' ');
            int[] middleArray = Array.ConvertAll(buf, int.Parse);

            buf = Console.ReadLine().Split(' ');
            int[] lowerArray = Array.ConvertAll(buf, int.Parse);

            int n = int.Parse(Console.ReadLine());

            List<int> numberList = new List<int>();

            for (int i = 0; i < n; i++) {
                numberList.Add(int.Parse(Console.ReadLine()));
            }

            bool result = false;

            bool[,] bingo = new bool[3, 3];

            for (int i = 0; i < 3; i++) {
                if (numberList.Contains(upperArray[i])) {
                    bingo[0, i] = true;
                }
                if (numberList.Contains(middleArray[i])) {
                    bingo[1, i] = true;
                }
                if (numberList.Contains(lowerArray[i])) {
                    bingo[2, i] = true;
                }
            }

            for(int i = 0; i < 3; i++) {
                if (bingo[i, 0] == true && bingo[i, 1] == true && bingo[i, 2] == true) {
                    Console.WriteLine("Yes");
                    return;
                }

                if (bingo[0, i] == true && bingo[1, i] == true && bingo[2, i] == true) {
                    Console.WriteLine("Yes");
                    return;
                }
            }

            if (bingo[0, 0] == true && bingo[1, 1] == true && bingo[2, 2] == true) {
                Console.WriteLine("Yes");
                return;
            }

            if (bingo[0, 2] == true && bingo[1, 1] == true && bingo[2, 0] == true) {
                Console.WriteLine("Yes");
                return;
            }

            Console.WriteLine("No");

        }

    }

}


Measured memory_bytes: 13148
package main

import (
	"fmt"
	"strconv"
	"strings"
)

func main() {
	var S string
	fmt.Scan(&S)
	s := strings.Split(S, "")

	w, _ := strconv.Atoi(s[0])
	x, _ := strconv.Atoi(s[1])
	y, _ := strconv.Atoi(s[2])
	z, _ := strconv.Atoi(s[3])

	// MM
	if 0 < w*10+x && w*10+x <= 12 {
		if 0 < y*10+z && y*10+z <= 12 {
			fmt.Println("AMBIGUOUS")
		} else {
			fmt.Println("MMYY")
		}
	} else {
		if 0 < y*10+z && y*10+z <= 12 {
			fmt.Println("YYMM")
		} else {
			fmt.Println("NA")
		}
	}
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
typedef long long ll;
#define rep(i,a,n) for(ll i = a;i < n;i++)
#define rrep(i,a,n) for(ll i = n; i >= a;i--)
#define index_check(i,n) if(i > n-1 || i < 0) continue; 
#define LINF 1e18
#define INF 1e9
using namespace std;

#define fs first
#define sc second

using P = pair<ll,ll>;
using Pll = pair<P,ll>;
using PQ = priority_queue<P,vector<P>,greater<P>>;


const ll MOD = 1e9+7;

signed main(){
    ll n;
    cin >> n;
    rep(i,1,12){
        if(1000*i >= n){
            cout << 1000*i - n << endl;
            return 0;
        }
    }
}


Measured memory_bytes: 3596
//
// Created by yuu on 2019-06-22.
//
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <utility>
#include <math.h>
#include <stack>
#include <queue>
#include <cstdio>

using namespace std;

bool compare_by_b(pair<int, int> a, pair<int, int> b) {
    if(a.second != b.second){
        return a.second < b.second;
    }else{
        return a.first < b.first;
    }
}



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

    vector<pair<int, int>>jobs;
    for (int i = 0; i < N; ++i) {
        int a, b;
        cin>>a>>b;

        jobs.push_back(make_pair(a,b));
    }

    sort(jobs.begin(), jobs.end(), compare_by_b);

    int now_time = 0;
    int now_job = 0;

//    for (int i = 0; i < N; ++i) {
//        cout<<jobs[i].first<<" "<<jobs[i].second<<endl;
//    }

    while(1){
        if(now_job >= N){
            break;
        }

//        if(jobs[now_job - 1].second < now_time){
//            cout<<"No"<<endl;
//            return 0;
//        }
//
//        if(jobs[now_job].first == 0){
//            now_job ++;
//            continue;
//        }

        now_time += jobs[now_job].first;
        if(jobs[now_job].second < now_time){
            cout<<"No"<<endl;
            return 0;
        }
        now_job ++;
    }

    cout<<"Yes"<<endl;
    return 0;
}


Measured memory_bytes: 3444
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

N,M = map(int,input().split())
AB = [list(map(int,input().split())) for m in range(M)]
UF = UnionFind(N)

for A,B in AB:
  UF.union(A-1,B-1)

print(UF.group_count()-1)

Measured memory_bytes: 29392
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  
  int N,R,naibu;
    
  cin>>N >>R;
  
    if (N >9){
      naibu=R;
    }
    else{
      naibu=R+100*(10-N);
    }  
    cout<<naibu <<endl;
 
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
int N,i=0,j=0,t=0,M;
cin>>N;
int T[N+5];
for(i=1;i<=N;i++)
{
cin>>T[i];
t+=T[i];
}
cin>>M;
int p[M+5],x[M+5];
for(j=1;j<=M;j++)
{
cin>>p[j]>>x[j];
cout<<t+x[j]-T[p[j]]<<endl;
}}

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

#define repd(i, a, b) for (ll i = (a); i < (b); i++)
#define rep(i, n) repd(i, 0, n)

using namespace std;

namespace mp = boost::multiprecision;

using ll = long long;
using Bint = mp::cpp_int;
ll mod = pow(10, 9) + 7;

int main() {
    // source
    ll n;
    cin >> n;

    ll a[n];
    rep(i, n) { cin >> a[i]; }

    map<ll, ll> m;
    rep(i, n) {
        ll temp = m[a[i]];
        m[a[i]] = temp + 1;
    }

    ll ans = 0;
    for (auto iter = m.begin(); iter != m.end(); iter++) {
        ll num0 = iter->first;
        ll num1 = iter->second;
        if (num0 < num1) {
            ans += num1 - num0;
        } else if (num0 > num1) {
            ans += num1;
        }
    }

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



Measured memory_bytes: 7040
#include <stdio.h>
#include <vector>
#include <iostream>
#include <string>
#include <math.h>

using namespace std;

int main(){
	int N,D;
  	cin >> N >> D;
  	int X[N][D];
  	for(int i = 0; i < N; i++){
    	for(int j = 0; j < D; j++){
        	cin >> X[i][j];
        }
    }
  	int count;
  	for(int i = 0; i < N; i++){
    	for(int j = 0; j < N; j++){
          	if(i < j){
                double sum = 0;
                for(int k = 0; k < D; k++){
                    int diff = X[i][k] - X[j][k];
                  	sum += diff * diff;
                }
              	cerr << "bf" << sum << endl;
              	sum = sqrt(sum);
              	cerr << sum << endl;
              	if(ceil(sum) == floor(sum)) count++;
            }
        }
    }
  	cout << count << endl;
}

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

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string s,t;
    cin>>s>>t;
    int a=s.size();
    int b=t.size();
    int r=a-b+1;
    int c=0,max=0;
    for(int i=1;i<=r;i++)
    {
        for(int j=0;j<b;j++)
        {
            if(s[i-1+j]==t[j])
            c++;
        }
        if(c>max)
        max=c;
        c=0;
    }
  //  cout<<max<<"\n";
    cout<<b-max<<"\n";
   	return 0;
}


Measured memory_bytes: 3612
#include<bits/stdc++.h>
#define ll long long
#define fio ios_base::sync_with_stdio(false); cin.tie(NULL)
 
using namespace std;
int main()
{
	fio;
	
		ll n,k,min;
		cin>>n>>k;
		if(n%k>k-n%k)
			cout<<(k-n%k)<<"\n";
		else
			cout<<n%k<<"\n";
	
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <queue>
using namespace std;
using ll = long long;

int main() {
    ll n;
    cin>>n;
    ll min=n+2;
    for(ll i=1;i*i<=n;i++){
        ll x=n%i;
        ll y=n/i;
        if(x==0){
            if(min>y+i)min=y+i;
        }
        
    }
    cout<<min-2;
}

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

int main(){
  int n; cin >> n;
  int cnt = 0;
  for(int i = 0; i < n; i++){
    int a, b;
    cin >> a >> b;
    if(a==b)cnt++;
    else cnt = 0;
    if(cnt==3){
      cout << "Yes" <<endl;
      return 0;
    }
  }
    cout << "No" << endl;
    return 0;
  }

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

int main() {
  char c;
  cin >> c;
  
  if(c == 'a' || c == 'e' || c =='i' || c =='o' || c =='u'){
    cout << "vowel" <<endl;
  }
  else{
    cout << "consonant" << endl;
  }
   
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define pb push_back
const int maxn = 10000;
const int INF32 = 1'050'000'000;
const long long INF64 = 4'000'000'000'000'000'000;
const int MOD7 = 1'000'000'007;
const int MOD9 = 1'000'000'009;

ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
int dx[8]={-1,0,1,0,1,1,-1,-1};
int dy[8]={0,-1,0,1,1,-1,1,-1};

int N;
ll L, T;
vector<ll> X;
vector<int> W;

int main(){
    cin >> N >> L >> T;
    X.resize(N);  W.resize(N);
    rep(i,N) cin >> X[i] >> W[i];
//-------------------------------------------
    vector<ll> tmp(N);
    rep(i,N){
        if(W[i]==1) tmp[i] = (X[i]+T)%L;
        else tmp[i] = ((X[i]-T)%L+L)%L; //tmp[i] = (X[i]-T)%L;
    }

    sort(tmp.begin(), tmp.end());

    int cnt = 0;
    rep(i,N){
        if(W[i]==1) cnt += (X[i]+T)/L;
        else{
            if(T > X[i]){
                cnt -= (T-X[i])/L;
                if((X[i]-T)%L<0) cnt--;
            }
        }
    }
    int flag = (cnt%N+N)%N;
//-------------------------------------------
    for(int i = flag; i < N; i++) cout << tmp[i] << endl;
    for(int i = 0; i < flag; i++) cout << tmp[i] << endl;
}

Measured memory_bytes: 3200