akhauriyash/Code-Regression huggingface dataset:
n,k = map(int,input().split())
score = []
res = 0

for i in range(1,n+1):
    count = 0
    while True:
        if i*2**count < k:
            count += 1
        else:
            score.append(count)
            break

for s in score:
    res += (1/n)*((1/2)**s)

print(res)

Measured memory_bytes: 3864
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        Main m = new Main(sc);
        m.show(m.solve());
        sc.close();
    }
    
	//フィールド
    Scanner sc;
    int N;
    String S;
    
    //入力
    Main(Scanner sc) {
        this.sc = sc;
        this.N = sc.nextInt();
        this.S = sc.next();
    }
    
    //解答処理
    private int solve() {
    	char[] s = S.toCharArray();
    	int[] e = new int[N];
    	int[] w = new int[N];
        int countE = 0;
        int countW = 0;
        
        for (int i = 0; i < N; i++) {
        	if (s[i] == 'E') {
        		countE++;
        		e[i] += countE;
        		w[i] = countW;
        	} else if (s[i] == 'W') {
        		countW++;
        		e[i] = countE;
        		w[i] += countW;
        	}
        }
        
        int min = e[N-1] - e[0];
        for (int i = 1; i < N; i++) {
        	int tmp = w[i-1] + e[N-1] - e[i];
        	min = Math.min(min, tmp);
        }
        
        return min;
    }
    
    //出力
    public void show(int answer) {
        System.out.println(answer);
    }

}


Measured memory_bytes: 45364
import java.io.IOException;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws IOException {
		new Main().run();
	}

	private void run() throws IOException {
		Scanner scanner = new Scanner(System.in);
		while (true) {
			w = scanner.nextInt();
			h = scanner.nextInt();
			n = scanner.nextInt();
			if ((w | h | n) == 0)
				break;
			size = new int[n + 1];
			for (int i = 0; i < n; i++) {
				int b = scanner.nextInt();
				int k = scanner.nextInt();
				size[b] = k;
			}
			map = new int[h][w];
			pos = new int[n + 1][2];
			for (int i = 0; i < h; i++) {
				for (int j = 0; j < w; j++) {
					int s = scanner.nextInt();
					map[i][j] = s;
					if (s > 0) {
						pos[s][0] = i;
						pos[s][1] = j;
					}
				}
			}
			count = 0;
			ans = new int[h][w];
			f(1);
			if (count == 1) {
				for (int i = 0; i < h; i++) {
					for (int j = 0; j < w; j++) {
						System.out.print(ans[i][j]);
						System.out.print(j == w - 1 ? '\n' : ' ');
					}
				}
			} else {
				System.out.println("NA");
			}
		}
	}

	private void f(int k) {
		if (k == n + 1) {
			count++;
			if (count == 2)
				return;
			for (int i = 0; i < h; i++) {
				for (int j = 0; j < w; j++) {
					int a = map[i][j];
					ans[i][j] = a >= 100 ? a / 100 : a;
				}
			}
			return;
		}
		int s = size[k];
		for (int r = 1; r <= s; r++) {
			if (s % r != 0)
				continue;
			int y = pos[k][0];
			int x = pos[k][1];
			for (int ui = y + 1 - s / r; ui <= y; ui++) {
				if (ui < 0)
					continue;
				loop: for (int lj = x + 1 - r; lj <= x; lj++) {
					if (lj < 0)
						continue;
					int di = ui + s / r;
					int rj = lj + r;
					if (di > h || rj > w)
						continue;
					for (int i = ui; i < di; i++) {
						for (int j = lj; j < rj; j++) {
							if (map[i][j] != 0 && map[i][j] != k)
								continue loop;
						}
					}
					for (int i = ui; i < di; i++) {
						for (int j = lj; j < rj; j++) {
							if (map[i][j] != k)
								map[i][j] = k * 100;
						}
					}
					f(k + 1);
					if (count == 2)
						return;
					for (int i = ui; i < di; i++) {
						for (int j = lj; j < rj; j++) {
							if (map[i][j] != k)
								map[i][j] = 0;
						}
					}
				}
			}
		}
	}

	int count;
	int h, w, n;
	int[] size;
	int[][] map;
	int[][] pos;
	int[][] ans;

}

Measured memory_bytes: 26280
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  if (abs(c - a) <= d || (abs(b - a) <= d && abs(c - b) <= d)) { cout << "Yes" << endl; }
  else { cout << "No" << endl; }
}

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

namespace abc151_c
{
  class Program
  {
    static void Main(string[] args)
    {
      var N = CIn.ReadInt();
      var M = CIn.ReadInt();

      var AC = new bool[N];
      var WA = new int[N];

      for (var i = 0; i < M; i++)
      {
        var p = CIn.ReadInt() - 1;
        var S = CIn.Read();

        if (!AC[p])
        {
          if (S == "AC")
          {
            AC[p] = true;
          }
          else
          {
            WA[p]++;
          }
        }
      }

      var a = 0;
      var w = 0;

      for (var i = 0; i < N; i++)
      {
        if (AC[i])
        {
          a++;
          w += WA[i];
        }
      }

      Console.WriteLine("{0} {1}", a, w);
    }
  }

  class CIn
  {
    private static readonly Queue<string> fieldBuffer = new Queue<string>();

    public static string Read()
    {
      if (fieldBuffer.Count == 0)
      {
        foreach (var field in Console.ReadLine().Split())
        {
          fieldBuffer.Enqueue(field);
        }
      }
      return fieldBuffer.Dequeue();
    }

    public static int ReadInt() => int.Parse(Read());
    public static long ReadLong() => long.Parse(Read());
    public static double ReadDouble() => double.Parse(Read());

    public static string[] ReadStringArray(long n)
    {
      var array = new string[n];
      for (var i = 0; i < n; i++)
      {
        array[i] = Read();
      }
      return array;
    }

    public static int[] ReadIntArray(long n)
    {
      var array = new int[n];
      for (var i = 0; i < n; i++)
      {
        array[i] = ReadInt();
      }
      return array;
    }

    public static long[] ReadLongArray(long n)
    {
      var array = new long[n];
      for (var i = 0; i < n; i++)
      {
        array[i] = ReadLong();
      }
      return array;
    }

    public static double[] ReadDoubleArray(long n)
    {
      var array = new double[n];
      for (var i = 0; i < n; i++)
      {
        array[i] = ReadDouble();
      }
      return array;
    }
  }
}


Measured memory_bytes: 17612
import collections

N = int(input())
S = []
for i in range(N):
    S.append(input())

#print(N,S)
#print("------------")
c = collections.Counter(S)
#print(c.most_common())
temp = c.most_common()
max_count = temp[0][1]

T = []
for i in range(N):
    if len(temp) > 1:
        if temp[i][1] == max_count:
            T.append(temp[i][0])
        else:
            break
    else:
        T.append(temp[0][0])
        break

T.sort()
for i in range(len(T)):
    print(T[i])

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

int main(){
	int N, M;
  	cin >> N >> M;
	vector<int> A(N);
  	int sum = 0;
  	for (int i = 0; i < N; i++){cin >> A.at(i);sum += A.at(i);}
  	int count = 0;
  	for (int i = 0; i < N; i++){if(A.at(i) >= sum/(4.0*M)) count++;}
  	if(count >= M){cout << "Yes" << endl;}
  	else{cout << "No" << endl;}
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
using namespace std;
typedef long long  ll;
#define rep(i,s,n)for(ll i=s;i<n;i++)
#define repe(i,s,n)for(ll i=s;i<=n;i++)
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
using namespace std;
typedef long long  ll;
#define rep(i,s,n)for(ll i=s;i<n;i++)
#define repe(i,s,n)for(ll i=s;i<=n;i++)

int main() {
	ll a, b; cin >> a >> b;
	char m[500][500] = {};
	ll s = 100;
	rep(i, 0, s / 2) rep(j, 0, s) m[i][j] = '#';
	rep(i, s / 2, s) rep(j, 0, s) m[i][j] = '.';
	a--;
	b--;
	rep(i, 0, s / 2) {
		if (a == 0)break;
		rep(j, 0, s) {
			if (a == 0)break;
			if (!(i & 1) && !(j & 1)) {
				m[i][j] = '.';
				a--;
			}
		}
	}

	cout << s << " " << s << endl;
	rep(i, s / 2 + 1, s) {
		if (b == 0)break;
		rep(j, 0, s) {
			if (b == 0)break;
			if (!(i & 1) && !(j & 1)) {
				m[i][j] = '#';
				b--;
			}
		}
	}
	rep(i, 0, s) {
		rep(j, 0, s) {
			cout << m[i][j];
		}
		cout << endl;
	}

	return 0;
}

Measured memory_bytes: 512
#include <iostream>
using namespace std;
int main(void){
    int a=0;
    string s;
    while(cin >> s){
        if(a!=0){
            cout << " ";
        }
        a++;
        for(int i=0;i<s.size();i++){
            char c=s[i];
            if('A'<= c && c <= 'Z'){
                c=c+ 32;
            }
            else if('a'<= c && c <= 'z'){
                c=c- 32;
            }
            cout << c;
        }
          
    }
    cout << endl;
}


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

int main(){
	int H,R;
	cin >> H >> R;
	if( abs(H) < R ){
		cout << 1 << endl;
	}else if( abs(H) == R ){
		if( H > 0 ){
			cout << 1 << endl;
		}else{
			cout << 0 << endl;
		}
	}else{
		if( H > 0 ){
			cout << 1 << endl;
		}else{
			cout << -1 << endl;
		}
	}
}

Measured memory_bytes: 3108
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;

#define rep(i,n) for(int i = 0; i<n; ++i)
#define REP(i,n) for(int i = 1; i<=n; ++i)
#define all(x) begin(x),end(x)
#define show(obj) {for(auto x:obj)cout<<x<<' ';cout<<endl;}
#define line "----------"
typedef long long ll;
typedef pair<int,int> ip;
typedef pair<ll,ll> lp;
const int inf = 1001001000;
const ll INF = 1LL<<60;
const int MOD = (int)1e9 + 7;

int main(){
	int R,G,B,N;
	cin>>R>>G>>B>>N;
	int ans = 0;
	for(int r = 0; r*R<=N; ++r){
		for(int g = 0; g*G + r*R<=N; ++g){
			int rest = N- g*G - r*R;
			if(rest%B == 0) ++ans;
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Math;class Program
{
	static void Main(string[] args)
	{
        //var exStdIn = new System.IO.StreamReader( "stdin.txt" );System.Console.SetIn( exStdIn );
		var nd = Console.ReadLine().Split().Select(long.Parse).ToArray();
		long n = nd[0], d = nd[1];
		int ans = 0;
		for (int i = 0; i < n; i++)
		{
			var xy = Console.ReadLine().Split().Select(long.Parse).ToArray();
			if(xy[0]*xy[0]+xy[1]*xy[1]<=d*d)ans++;
		}		
		Console.Write(ans);
	}
	
}


Measured memory_bytes: 41164
#include <iostream>
#include <cmath>

using namespace std;

int main() {
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	
	if (abs(c - a) <= d || (abs(b - a) <= d && abs(c - b) <= d)) {
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}
	return 0;
}



Measured memory_bytes: 888
from bisect import bisect_left
def main():
    n, dis, dam = map(int, input().split())
    mon = [list(map(int, input().split())) for _ in range(n)]
    mon.sort(key=lambda x: x[0])
    p = [v[0] for v in mon]
    imos = [0]*(n+1)
    dis = 2*dis + 1
    ans = 0
    for i in range(n):
        if 0 < i:
            imos[i] += imos[i-1]
        if imos[i] < mon[i][1]:
            tmp = (mon[i][1] - imos[i] + dam - 1) // dam
            ans += tmp
            tmp *= dam
            imos[i] += tmp
            idx = bisect_left(p, p[i]+dis)
            imos[idx] -= tmp
    print(ans)

if __name__ == "__main__":
    main()

Measured memory_bytes: 61304
#include <bits/stdc++.h>
 
using namespace std;
 
#define MAX 1010
 
bool a[MAX][MAX];
int dp[MAX][MAX];
int H, W;
 
bool get_dir(int n, bool dir)
{
    return (n % 2 == 0 ? dir : !dir);
}
 
void find_last_point()
{
    int x = 0, y = 0;
    while (true) {
        if (a[y][x] == 1) {
            x++;
        } else {
            y++;
        }
        if (x >= W || y >= H) break;
    }
    cout << y+1 << " " << x+1 << endl;
}
 
int main()
{
    int N;
    while (cin >> H >> W >> N, H) {
        for (int i = 0; i < H; i++) {
            for (int j = 0; j < W; j++) {
                cin >> a[i][j];
            }
        }

        memset(dp, 0, sizeof(dp));
        dp[0][0] = N-1;

        for (int i = 0; i < H; i++) {
            for (int j = 0; j < W; j++) {
                if (dp[i][j] == 0) continue;
                a[i][j] = get_dir(dp[i][j], a[i][j]);
                if (dp[i][j] % 2 == 1) {
                    if (a[i][j] == 0) {
                        dp[i+1][j] += dp[i][j] / 2;
                        dp[i][j+1] += dp[i][j] / 2 + 1;
                    } else {
                        dp[i+1][j] += dp[i][j] / 2 + 1;
                        dp[i][j+1] += dp[i][j] / 2;
                    }
                } else {
                    dp[i+1][j] += dp[i][j] / 2;
                    dp[i][j+1] += dp[i][j] / 2;
                }
            }
        }
        find_last_point();
    }
    return 0;
}

Measured memory_bytes: 6140
#include<stdio.h>
#include<algorithm>
struct S{int h,r,c;}a[201];
int C(S l,S r){return l.h+l.r<r.h+r.r;} 
int main()
{
	int m,n,i,j;
	while(scanf("%d",&n),n)
	{
		for(i=0;i<n;a[i++].c=0)scanf("%d%d",&a[i].h,&a[i].r);
		for(scanf("%d",&m),n+=m;i<n;a[i++].c=0)scanf("%d%d",&a[i].h,&a[i].r);
		a[n].h=a[n].r=a[n].c=0;
		std::sort(a,a+n+1,C);
		for(i=n;i>=0;--i)
			for(j=i+1;j<=n;++j)
				if(a[i].h<a[j].h&&a[i].r<a[j].r)
					a[i].c=std::max(a[i].c,a[j].c+1);
		printf("%d\n",a[0].c);
	}
	return 0;
}

Measured memory_bytes: 0
#include <stdio.h>

int main() {
    int N;
    int K;
    int ans;
    scanf("%d%d",&N,&K);
    
    ans = N-K;
    if (K == 1) {
        printf("0\n");
        return 0;
    }
    
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 128
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

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

		   int n = sc.nextInt();
		   int d = sc.nextInt();
		   List<double[]> x_list = new ArrayList<double[]>();
		   for(int i=0; i<n; i++) {
			   double[] x_d = new double[d];
			   for(int j=0; j<d; j++) {
				   x_d[j] = sc.nextDouble();
			   }
			   x_list.add(x_d);
		   }

		   int cnt=0;
		   for(int i=0;i<n-1;i++) {
			   double[] x_d_i = x_list.get(i);
			   for(int j=i+1;j<n;j++) {
				   double[] x_d_j = x_list.get(j);
				   double cal = 0;
				   for(int k=0; k<d; k++) {
					   cal += (x_d_i[k]-x_d_j[k])*(x_d_i[k]-x_d_j[k]);
				   }
				   double distance = Math.sqrt(cal);
				   if(distance == (int)distance) {
					   cnt += 1;
				   }
			   }
		   }
		   System.out.println(cnt);

		    sc.close();
	}
}

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

int main(){
    int t;  cin >> t;
    while(t-- > 0){
        int gx, gy, p;
        cin >> gx >> gy >> p;
        int m[20][20][2] = {};
        while(p-- > 0){
            int a, b, c, d;
            cin >> a >> b >> c >> d;
            if(a+b > c+d)   swap(a,c), swap(b,d);
            if(a == c)  m[a][b][1] = 1;
            else        m[a][b][0] = 1;
        }
        int dp[20][20] = {};
        dp[0][0] = 1;
        for(int i = 0; i <= gx; i++){
            for(int j = 0; j <= gy; j++){
                if(m[i][j][0] == 0) dp[i+1][j] += dp[i][j];
                if(m[i][j][1] == 0) dp[i][j+1] += dp[i][j];
            }
        }
        if(dp[gx][gy])  cout << dp[gx][gy] << endl;
        else            cout << "Miserable Hokusai!" << endl;
    }
    return 0;
}


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

ll N, A, B, h[100010];

bool isOK(ll T){
    ll count = 0;
    for(int i = 0; i < N; i++){
        if(h[i] <= B*T) continue;
        else    count += (h[i] - B*T- 1)/(A-B) + 1;
    }
    
    return count <= T;
}

int main(){
    cin >> N >> A >> B;
    for(int i = 0; i < N; i++) cin >> h[i];

    ll ng = 0;
    ll ok = 1000000000;

    while (abs(ok - ng) > 1) {
        ll mid = (ok + ng)/2;

        if(isOK(mid))   ok = mid;
        else    ng = mid;
    }
    cout << ok << "\n";
    return 0;
}

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

#define ll long long
#define endl "\n"
#define FAST ios_base::sync_with_stdio(false); cin.tie(NULL);
#define M 1000000007

void solve()
{
	ll n,ans=0;
	cin>>n;
	for(ll i=1;i<=n;i++)
	{
		if(i%3==0 || i%5==0);
		else ans+=i;
	}
	cout<<ans;
}

int main() 
{
	FAST
	ll t=1;	
	//cin>>t;
	for(ll i=0;i<t;i++) solve();
	return 0;
}
    

Measured memory_bytes: 3648
#include <vector>
#include <string>
#include <iostream>
#include <queue>
#include <algorithm>
#include <functional>
#include <map>
#include <array>
#include <cmath>

long long PRIME = 1e9 + 7;
using namespace std;


int main(){ 
    int N, M;
    cin >> N >> M;

    vector<vector<int>> A(N, vector<int>(M));
    vector<int> b(M), c(N, 0);

    for(int i = 0; i < N; ++i){
        for(int j = 0; j < M; ++j){
            cin >> A.at(i).at(j);
        }
    }
    for(int i = 0; i < M; ++i){
        cin >> b.at(i);
    }

    for(int i = 0; i < N; ++i){
        for(int j = 0; j < M; ++j){
            c[i] += A[i][j] * b[j];
        }
    }

    for(int i = 0; i < N; ++i){
        cout << c[i] << endl;
    }

}




Measured memory_bytes: 3152
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
from collections import deque

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
     
def main():
    N = I()
    A = LI()
    num2freq = collections.defaultdict(int)
    for a in A:
        num2freq[a] += 1
    cnt = 0
    for key, val in num2freq.items():
        if key > val:
            cnt += val
        else:
            cnt += (val - key)
    print(cnt)

main()



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

int n, m, r, c;
int main()
{
	int i, j;
	cin >> n >> m >> r >> c;
	if (m % c > 0) {
		cout << "Yes" << endl;
		for (j = 0; j < n; j++) {
			for (i = 0; i < m; i++) {
				if (i % c == 0) printf("%d ", 1000 * (c - 1) - 1);
				else printf("-1000 ");
			}
			printf("\n");
		}
	} else if (n % r > 0) {
		cout << "Yes" << endl;
		for (j = 0; j < n; j++) {
			for (i = 0; i < m; i++) {
				if (j % r == 0) printf("%d ", 1000 * (r - 1) - 1);
				else printf("-1000 ");
			}
			printf("\n");
		}
	} else {
		cout << "No";
	}
    return 0;
}


Measured memory_bytes: 1664
import java.util.*;
import java.io.*;

public class Main {
    public static void main(String[] args) throws Exception {

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
    
        String[] str = br.readLine().split(" ");
        int a = Integer.parseInt(str[0]);
        int b = Integer.parseInt(str[1]);
        
        if(a - (b * 2) >= 0){
            out.println(a - (b * 2));
        }else{
            out.println(0);
        }
         
        out.close();
        
    }
}

Measured memory_bytes: 32476
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <numeric>
#include <climits>
#include <math.h>
#include <memory.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rrep(i, k, n) for(int i = (k); i < (int)(n); i++)
using namespace std;
using ll = long long;
int N, M;
int cnt = 0;
int ans = 0;
int i_index;
int tmp;
int dh[4] = {1, 0, -1, 0};
int dw[4] = {0, 1, 0, -1};
string board[64];
string a[64];
int main(){
    int X;
    
    cin >> N >> X;
    int a[N];
    rep(i, N){
        cin >> a[i];
        X -= a[i];
        cnt++;
    }
    int minv = a[0];
    rep(i, N){
        minv = min(minv, a[i]);
    }
    while(X >= minv){
        X -= minv;
        cnt++;
    }
    cout << cnt << endl;
    
    return 0;
}

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

typedef long long ll;

int main()
{
    ll a,b,c;
    cin >> a >> b >> c;
    if((c-a-b) < 0){
        cout << "No" << endl;
    }else{
        ll t = 4;
        ll tmp1 = t*a*b;
        ll tmp2 = (c-a-b)*(c-a-b);
        if(tmp2 > tmp1){
            cout << "Yes" << endl;
        }else{
            cout << "No" << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

//INSERT ABOVE HERE
signed main(){
  Int n;
  cin>>n;
  vector<Int> xs(n),ys(n);
  for(Int i=0;i<n;i++) cin>>xs[i]>>ys[i];
  Int ans=n;

  using P = pair<Int, Int>;
  set<P> sp;
  for(Int i=0;i<n;i++) sp.emplace(xs[i],ys[i]);

  for(Int i=0;i<n;i++){
    for(Int j=0;j<n;j++){
      if(i==j) continue;
      Int p=xs[i]-xs[j];
      Int q=ys[i]-ys[j];
      assert(p!=0||q!=0);
      Int res=0;
      for(Int k=0;k<n;k++)
        if(!sp.count(P(xs[k]+p,ys[k]+q))) res++;
      chmin(ans,res);
    }
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int hanbun(int);
int a,youso[100000];

int main(){
  int b,c,d,e,kazu=0;
  scanf("%d",&a);
  for(b=0;b<a;b++){
    scanf("%d",&youso[b]);
  }
  scanf("%d",&c);
  for(b=0;b<c;b++){
    scanf("%d",&d);
    e=hanbun(d);
    if(e)kazu++;
  }
  printf("%d\n",kazu);
  return 0;
}
int hanbun(int b)
{
  int right=a,left=0,mid;
  while(left<right){
    mid=(left+right)/2;
    if(youso[mid]==b) return 1;
    else if(b<youso[mid])right=mid;
    else left=mid+1;
  }
  return 0;
}

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

#define rep(i,n) for(int i = 0; i < (n); ++i)
#define per(i,n) for(int i = (n)-1; i >= 0; --i)
#define rng(i,a,b) for(int i = (a); i < (b); ++i)
#define all(a) (a).begin(), (a).end()
const int mod = 2019;

int main() {
    string s; cin >> s;
    reverse(all(s));
    int n = s.size();

    ll ans = 0, base = 1, x = 0;
    map<ll,ll> cnts; cnts[0] = 1;
    rep(i,n) {
        x = (x + (s[i]-'0')*base) % mod;
        ans += cnts[x];
        cnts[x]++;
        (base *= 10) %= mod;
    }
    cout << ans << endl;
    return 0;
}


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

typedef long long ll;
const int maxn=1e6+7;
const int inf=1e9+7;
const int mod=1e9+7;
#define pb push_back
#define pii pair<int,int>
#define F first
#define S second
#define rep(i,n) for (int i=1;i<=(n);i++)
#define rep2(i,a,b) for (int i=(a);i<=(b);i++)

int main()
{
 	ios::sync_with_stdio(0); cin.tie(0);
 	int n,x,sum=0,min=inf;
 	cin>>n;
 	while (n--)
 	{
 		cin>>x;
 		sum+=x;
 		if ((x%10)&&x<min) min=x;
	}
	if (sum%10) cout<<sum <<endl;
	else if (min!=inf) cout<<sum-min<<endl;
	else cout<<0<<endl;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define INF 1000000000000000000
#define mod 1000000007

ll k,ans;

int main(){
	cin>>k;

	ll num=0;
	queue<ll> que;
	for(ll i=1;i<=9;i++){
		que.push(i);
	}

	while(num<k){
		ll now=que.front();
		que.pop();
		
		ans=now;
		num++;

		if((now%10)-1>=0){
			que.push(now*10+(now%10)-1);
		}
		que.push(now*10+now%10);
		if((now%10)+1<=9){
			que.push(now*10+(now%10)+1);
		}
	}
	
	cout<<ans<<endl;
	return 0;
}

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

#define MAX_V 100001
#define INF (1e9 + 1)

struct edge {
    int des,cost;
};

int V,E,R,a,b,c;
vector< edge > G[MAX_V];
int dist[MAX_V];

void Dijkstra(){
    for (int i = 0; i < MAX_V; i++)dist[i] = INF;
    dist[R] = 0;
    priority_queue< pair<int,int> > Q;
    Q.push( make_pair(0,R) );
    while (Q.size()){
        pair<int,int> p=Q.top();
        Q.pop(); 
        int cost = -p.first, pos = p.second;
        if (cost > dist[pos]) continue; 
        for (int i = 0; i < G[pos].size(); i++){
            edge e = G[pos][i];
            int des = e.des;
            int newcost = cost + e.cost;
            if (newcost < dist[des]){
                dist[des] = newcost;
                Q.push(make_pair(-dist[des],des));
            }
        }
    }
    for (int i = 0; i < V; i++){
        if (dist[i] == INF) cout << "INF" << endl;
        else cout << dist[i] << endl;
    }
}

int main(){
    cin >> V >> E >> R;
    for(int i = 0; i < E; i++){
        cin >> a >> b >> c;
        G[a].push_back((edge){b,c});
    }
    Dijkstra();
    return 0;
    
}


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

int main()
{
    int n, k, ans = 0;
    cin >> n >> k;
    while (n--)
    {
        int a;
        cin >> a;
        ans += a >= k;
    }
    cout << ans << "\n";
}

Measured memory_bytes: 3644
#include<bits/stdc++.h>
using namespace std;
#define NL            "\n"
#define _SAD()        ios::sync_with_stdio(0),cin.tie(0), cout.tie(0);
#define SZ(s)         s.size()
#define SRT(x,y)      sort(x,x+y)
#define REV(a,b)      reverse(a,a+b)
#define VSRT(x)       sort(x.begin(),x.end())
#define VREV(x)       reverse(x.begin(),x.end())
int main()
{
    _SAD()
    int n,m;
    cin>>n>>m;
    char s[105][105];
    for(int i=0;i<n;i++)
    {
        cin>>s[i];
    }
    for(int i=0;i<=m+1;i++)
    {
        cout<<"#";
    }
    cout<<NL;
    for(int i=0;i<n;i++)
    {
        cout<<"#"<<s[i]<<"#"<<NL;
    }
    for(int i=0;i<=m+1;i++)
    {
        cout<<"#";
    }
    cout<<NL;
    return 0;
}


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

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

#define F first
#define S second
#define PB push_back
#define MP make_pair
#define what_is(x) cerr << #x << " is " << x << endl;
#define MT make_tuple
#define eb emplace_back
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))

#define REP(i,a,b) for (int i = a; i <= b; i++)
#define FOR(i,n) for (int i=0;i < n ; i++)
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}

int main(){
	ll x;
	cin >> x;
	ll q=x/11;
	ll r=x%11;
	if (r==0) cout << 2*q;
	else if(r<=6) cout << 2*q+1;
	else cout << 2*q+2;

	return 0;
}

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

vector<ll> nodes[100005];
vector<ll> len[100005];
ll di[100005];
ll n, q, k;
ll xs[100005];
ll ys[100005];
bool vi[100005];

struct cmp {
	bool operator()(pair<ll, ll>& a, pair<ll, ll>& b) {
		return a.first < b.first;
	}
};

int main() {
	cin >> n;
	for (ll i = 1; i < n; i++) {
		ll t1, t2, t3;
		cin >> t1 >> t2 >> t3;
		nodes[t1].push_back(t2);
		len[t1].push_back(t3);
		nodes[t2].push_back(t1);
		len[t2].push_back(t3);
	}
	cin >> q >> k;
	priority_queue < pair<ll, ll>, vector<pair<ll, ll>>, cmp > que;
	que.push(pair<ll, ll>(0, k));
	for (int i = 1; i <= n; i++) {
		di[i] = INT64_MAX;
	}
	di[k] = 0;
	while (que.size()) {
		pair<ll, ll> p = que.top(); que.pop();
		ll v = p.second;
		ll d = p.first;
		vi[v] = true;
		for (int i = 0; i < nodes[v].size(); i++) {
			di[nodes[v][i]] = min(di[nodes[v][i]], d + len[v][i]);
			if (vi[nodes[v][i]] == false)
				que.push(pair<ll, ll>(di[nodes[v][i]], nodes[v][i]));
		}
	}
	for (ll i = 1; i <= q; i++) {
		cin >> xs[i] >> ys[i];
	}
	for (ll i = 1; i <= q; i++) {
		cout << 1ll * di[xs[i]] + 1ll * di[ys[i]] << endl;
	}
}

Measured memory_bytes: 18020
import java.util.Scanner;

class Main {

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        while (scan.hasNextInt()) {
            int n = scan.nextInt();
            int s = 0;
            if (n >= 2) {
                s++;
            }
            for (int x = 3; x <= n; x += 2) {
                int y = 3;
                while (x % y != 0 && x >= y * y) {
                    y += 2;
                }
                if (x < y * y) {
                    s++;
                }
            }
            System.out.println(s);
        }
    }
}



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

const int mod = 1e9 + 7;

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

/*-------------------------------------------*/

double f(double x) { return x * x; }

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

    int n;
    cin >> n;
    vector<double> x(n), y(n);
    rep(i, n) cin >> x[i] >> y[i];
    if(n == 2) {
        printf("%.10f\n", sqrt(f(x[0] - x[1]) + f(y[0] - y[1])) / 2.0);
        return 0;
    }

    double ans = 1e9;
    rep(i, n) {
        FOR(j, i + 1, n) {
            FOR(k, j + 1, n) {
                if((x[j] - x[i]) * (y[k] - y[i]) ==
                   (x[k] - x[i]) * (y[j] - y[i]))
                    continue;
                double X =
                    ((y[i] - y[k]) * (f(y[i]) - f(y[j]) + f(x[i]) - f(x[j])) -
                     (y[i] - y[j]) * (f(y[i]) - f(y[k]) + f(x[i]) - f(x[k]))) /
                    (2.0 * (y[i] - y[k]) * (x[i] - x[j]) -
                     2.0 * (y[i] - y[j]) * (x[i] - x[k]));
                double Y =
                    ((x[i] - x[k]) * (f(x[i]) - f(x[j]) + f(y[i]) - f(y[j])) -
                     (x[i] - x[j]) * (f(x[i]) - f(x[k]) + f(y[i]) - f(y[k]))) /
                    (2.0 * (x[i] - x[k]) * (y[i] - y[j]) -
                     2.0 * (x[i] - x[j]) * (y[i] - y[k]));
                double r2 = f(X - x[i]) + f(Y - y[i]);
                bool ok = 1;
                rep(l, n) {
                    if(l == i || l == j || l == k) continue;
                    if(f(X - x[l]) + f(Y - y[l]) > r2) ok = 0;
                }
                if(ok) {
                    // cout << i << " " << j << " " << k << " " << r << endl;
                    chmin(ans, sqrt(r2));
                }
            }
        }
    }
    rep(i, n) {
        FOR(j, i + 1, n) {
            double X = (x[i] + x[j]) / 2.0, Y = (y[i] + y[j]) / 2.0;
            double r2 = f(X - x[i]) + f(Y - y[i]);
            bool ok = 1;
            rep(k, n) {
                if(i == k || j == k) continue;
                if(f(X - x[k]) + f(Y - y[k]) > r2) ok = 0;
            }
            if(ok) chmin(ans, sqrt(r2));
        }
    }
    printf("%.16f\n", ans);
}

Measured memory_bytes: 256
#include<iostream>
#include<string>

using namespace std;

int main(){
while(1){
	string r;
	string a;
	cin>>r>>a;
	if((r=="0")&&(a=="0")){
		break;
	}
	int h=0,b=0;
	for(int i=0;i<4;i++){
		for(int j=0;j<4;j++){
			if(r[i]==a[j]){
				if(i==j){
					h++;
				}else{
					b++;
				}
			}
		}
	}
		cout<<h<<' '<<b<<'\n';
}
return 0;
}

Measured memory_bytes: 1184
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 1e9+7;
const long long INF = 1e15;

int main(){
    int n;
    cin >> n;
    string s;
    cin >> s;
    int r = 0;
    int l = 0;
    int cnt = 0;
    for(int i = 0; i < n; i++){
        if(s[i] == ')' && r == l) cnt++;
        else if(s[i] == '(') l++;
        else if(s[i] == ')') r++;
        //cout << s << endl;
    }
    for(int i = 0; i < cnt; i++) s = "("+s;
    int k = l-r;
    //cout << k << endl;
    for(int i = 0; i < k; i++) s = s+")";
    cout << s << endl;
    return 0;
}

Measured memory_bytes: 3632
#include<iostream>
#include<algorithm>
 
using namespace std;
typedef long long Int;
#define INF (1LL<<60)

Int dp[20][54000];
Int table[54000];

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

	string N;
	cin >> N;


	if((N[0] == N[1]&&N[1]==N[2])||(N[3] == N[2]&&N[1]==N[2]))	cout<<"Yes"<<endl;
	else	cout<<"No"<<endl;

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<math.h>
using namespace std;

int main() {
	char S[20];
	string T;
	string p;
	string Q;
	double m;
	int a = 0;
	int A = 0;
	int b = 0;
	int B = 0;
	int c = 0;
	int C = 0;
	int q, w, z;
	int n = 0;
	int x = 0;
	int y = 0;
	int ans = 0;
	int X[100] = { 0 };
	cin >> a >> b >> c;
	if (a < b) {
		n = a;
		a = b;
		b = n;
	}
	if (a < c) {
		n = a;
		a = c;
		c = n;
	}
	if (b < c) {
		n = b;
		b = c;
		c = n;
	}
	cout << a * 10 + b + c;
}

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

int main() {
    int N, M;
    vector<int> H;
    vector<int> ma;
    cin >> N >> M;
    H.push_back(0);
    ma.push_back(0);
    for (int i = 1; i <= N; i++) {
        int n;
        cin >> n;
        H.push_back(n);
        ma.push_back(0);
    }
    for (int i = 0; i < M; i++) {
        int a, b;
        cin >> a >> b;
        ma.at(a) = max(ma.at(a), H.at(b));
        ma.at(b) = max(ma.at(b), H.at(a));
    }
    int ans = 0;
    for (int i = 1; i <= N; i++) {
        ans += H.at(i) > ma.at(i);
    }
    cout << ans << endl;
}


Measured memory_bytes: 4288
import java.util.*;
public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    //各硬貨と目標額
    int coinA = sc.nextInt();
    int coinB = sc.nextInt();
    int coinC = sc.nextInt();
    int X = sc.nextInt();
    int calc = 0;
    int answer = 0;
    for (int i=0;i<=coinA;i++){
      for (int j=0;j<=coinB;j++){
        for (int k=0;k<=coinC;k++){
          calc = (500*i) + (100*j) + (50*k);
          if (X == calc){
            answer = answer + 1;
          }
        }
      }
    }
    System.out.println(answer);
  }
}

Measured memory_bytes: 23124
#include <cstdio>
#include <cmath>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>

#ifdef _DEBUG
#define DMP(x) cerr << #x << ": " << x << "\n"
#else
#define DMP(x) ((void)0)
#endif

const int MOD = 1000000007, INF = 1111111111; 
using namespace std;
using lint = long long;

int main() {

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

	int N;
	cin >> N;

	vector<lint> A(N);
	for (int i = 0; i < N; i++) cin >> A[i];

	vector<lint> cnt(N), xorsum(N);
	cnt[0] = 1, xorsum[0] = A[0];

	for (int i = 1; i < N; i++) {

		if ((A[i] & xorsum[i - 1]) == 0) {
			xorsum[i] = (A[i] ^ xorsum[i - 1]);
			cnt[i] = cnt[i - 1] + 1;
		}
		else if ((A[i] & A[i - 1]) == 0) {

			xorsum[i] = A[i];
			cnt[i] = 1;

			int j = i - 1;
			while ((xorsum[i] & A[j]) == 0) {
				xorsum[i] ^= A[j];
				j--;
				cnt[i]++;
			}

		}
		else {
			xorsum[i] = A[i];
			cnt[i] = 1;
		}
	}

	lint ans = 0;
	for (int i = 0; i < N; i++) {
		ans += cnt[i];
	}

	cout << ans << "\n";

	return 0;
}

Measured memory_bytes: 4992
#include <iostream>
#include <string>

using namespace std;

int main(){
  string N;
  int K;
  cin >> N >> K;
  int ans=0;
  if(K==1) cout << 9*(N.size()-1)+(N[0]-'0') << endl;
  if(K==2){
    if(N.size()==1) cout << 0 << endl;
    else{
      for(int i=2; i<N.size(); i++) ans+=81*(i-1);
      ans+=(N[0]-'0'-1)*9*(N.size()-1);
      for(int i=1; i<N.size(); i++){
        if(N[i]!='0'){
          ans+=(N[i]-'0')+9*(N.size()-i-1);
          break;
        }
      }
      cout << ans << endl;
    }
  }
  bool endflag=false;
  if(K==3){
    if(N.size()<=2) cout << 0 << endl;
    else{
      for(int i=3; i<N.size(); i++) ans+=729*(i-1)*(i-2)/2;
      ans+=(N[0]-'0'-1)*81*(N.size()-1)*(N.size()-2)/2;
      for(int i=1; i<N.size(); i++){
        if(N[i]!='0'){
          ans+=(N[i]-'0'-1)*9*(N.size()-i-1);
          ans+=81*(N.size()-i-1)*(N.size()-i-2)/2;
          for(int j=i+1; j<N.size(); j++){
            if(N[j]!='0'){
              ans+=(N[j]-'0')+9*(N.size()-j-1);
              endflag=true;
              break;
            }
          }
        }
        if(endflag) break;
      }      
      cout << ans << endl;
    }
  }
  
  return 0;
}

Measured memory_bytes: 256
# import sys
# sys.setrecursionlimit(10**5)
# from collections import defaultdict
geta = lambda fn: map(fn, input().split())
gete = lambda fn: fn(input())

def main():
	n=gete(int)
	dp=[[0]*3 for _ in range(n+1)]
	
	
	for i in range(n):
		a,b,c = geta(int)
		dp[i+1][0] = max(dp[i][1], dp[i][2]) + a
		dp[i+1][1] = max(dp[i][2], dp[i][0]) + b
		dp[i+1][2] = max(dp[i][0], dp[i][1]) + c
		
	print(max(dp[n][0],dp[n][1],dp[n][2]))
	
	
	
if __name__ == "__main__":
	main()

Measured memory_bytes: 59500
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int N=4e5+5;
vector<pair<ll,ll> >vt;
ll n,d,a,partial[N];

ll binarysearch() {
    ll b_c,ans=0,store;
    for(int i=0; i<n; i++) {
        if(i>0)partial[i]+=partial[i-1];
        //cout<<partial[i]<<" ";
        int l=i,r=n-1,mid;
        if(partial[i]>=vt[i].second)continue;

        while(l<=r) {
            mid=(l+r)>>1ll;
            //cout<<mid<<" "<<l<<" "<<r<<endl;
            if(vt[mid].first-vt[i].first<=2ll*d) {

                store=mid;
                l=mid+1;
            } else {
                r=mid-1;
            }
        }
        b_c=0;

        if((vt[i].second-partial[i])%a) {
            b_c=((vt[i].second-partial[i])/a)+1;
        } else {
            b_c=(vt[i].second-partial[i])/a;
        }
        //cout<<store<<" "<<d<<endl;
        ans+=b_c;
        partial[i]+= (b_c*a),partial[store+1]-=(b_c*a);
    }
    return ans;
}
int main() {
    ll x,h;
    scanf("%lld %lld %lld",&n,&d,&a);
    for(int i=1; i<=n; i++) {
        scanf("%lld %lld",&x,&h);
        vt.push_back({x,h});
    }
    sort(vt.begin(),vt.end());
    printf("%lld",binarysearch());
    return 0;
}


Measured memory_bytes: 6512
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int calc(int N, vector<int> &A)
{
    int max = *max_element(A.begin(), A.end());
    vector<bool> div(max + 1, true);
    vector<bool> exist(max + 1, false);
    for (auto val : A)
    {
        if (exist[val])
        {
            div[val] = false;
            continue;
        }
        else
        {
            exist[val] = true;
        }

        if (!div[val])
        {
            continue;
        }

        for (int j = val * 2; j <= max; j += val)
        {
            div[j] = false;
        }
    }

    int ret = 0;
    for (auto val : A)
    {
        if (div[val])
        {
            ret++;
        }
    }

    return ret;    
}

int main()
{
    int N;
    cin >> N;
    vector<int> A;
    for (int i = 0; i < N; i++)
    {
        int num;
        cin >> num;
        A.push_back(num);
    }

    cout << calc(N, A) << endl;    
    return 0;
}

Measured memory_bytes: 4316
#include <bits/stdc++.h>
using namespace std;
#define ll                      long long int
#define pb                      push_back
#define rep(i,a,b,c)            for(ll i=(a);i<=(b);i+=(c))
#define repb(i,a,b,c)           for(ll i=(a);i>=(b);i-=(c))
#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 all(x)                  x.begin(),x.end()
#define fi                      first
#define se                      second
#define ln                      cout<<"\n";
#define endl                    "\n"
#define test                    ll Testcases;cin>>Testcases;while(Testcases--)
#define isvowel(a)              (a == 'a' || a == 'e' || a == 'i' || a == 'o' || a == 'u')
#define fastIO                  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define show(w,size)            for(ll i=0;i<size;i++) cout<<w[i]<<" ";
#define print(a)                cout<<a<<"\n";
#define mset(dp,no)             memset(dp,no,sizeof(dp))
#define input(a,n)              rep(i,0,n-1,1) cin>>a[i];
#define countbit                __builtin_popcount                                           //Number of setbits in decimal notation
#define lb(v,val)               lower_bound(all(v),val)-v.begin()
#define ub(v,val)               upper_bound(all(v),val)-v.begin()
#define SS                      stringstream
#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...);
}

ll poww(ll b,ll e){if(e==0)return 1;else if(e%2==0){ll a=pow(b,e/2);return a*a;}else {ll a=pow(b,e/2);return b*a*a;}}
ll powm(ll x,ll y,ll m=MOD){x=x%m;ll res=1;while(y){if(y&1)res=res*x;res%=m;y=y>>1;x=x*x;x%=m;}return res;}
ll modInverse(ll a, ll m=MOD) { return powm(a, m-2, m);}

int main()
{
	fastIO
	string s,t;
	cin>>s>>t;
	cout<<t<<s;
	return 0;
}




Measured memory_bytes: 256
#include"iostream"
#include"vector"
#include"string"
#include"map"
#include"set"
using namespace std;
int main(){
	int n;
	string str1,str2;
	cin >> n;
	cin >> str1 >> str2;
	string ans = "";
	for (int i = 0; i < n; i++){
		ans += str1[i];
		ans += str2[i];
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.*;
 
import java.io.*;
 
public class Main{
    
    
	public static void main(String[] $){
		Scanner s = new Scanner(System.in);
        int N = s.nextInt();
        int M = s.nextInt();
        int[] A = new int[M];
        int[] B = new int[M];
        List<List<Integer>> list = new ArrayList<List<Integer>>();
        for(int i = 0; i < N; i++){
            list.add(new ArrayList<Integer>());
        }
        for(int i = 0; i < M; i++){
            A[i] = s.nextInt()-1;
            B[i] = s.nextInt()-1;
            list.get(A[i]).add(B[i]);
            list.get(B[i]).add(A[i]);
        }
        
        HashMap<Integer, Integer> hash = new HashMap<Integer, Integer>();
        Queue<Integer> Q = new ArrayDeque<>();
        boolean[] permit = new boolean[N];
        Q.add(0);
        permit[0] = true;
        hash.put(0, 0);
        while(!Q.isEmpty()){
            int v = Q.poll();
            permit[v] = true;
            for(int i = 0; i < list.get(v).size(); i++){
                if(permit[list.get(v).get(i)] == false){
                    permit[list.get(v).get(i)] = true;
                    hash.put(list.get(v).get(i), v+1);
                    Q.add(list.get(v).get(i));
                }
            }
        }

        StringBuilder sb = new StringBuilder();
        sb.append("Yes" + "\n");
        for(int a = 1; a < N; a++){
            if(hash.containsKey(a)){
                sb.append(hash.get(a) + "\n");
            }else{
                System.out.println("No");
                System.exit(0);
            }
        }

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

 
	}
} 

Measured memory_bytes: 82516
#include <string>
#include <iostream>
#include <stack>
#include <queue> // priority_queue も入ってる
#include <set>   // 要素数は size() で取得 multisetもある
#include <map>
#include <array> // sizeはコンパイル時定数で固定
#include <vector>
#include <numeric>   // accumulate, gcd
#include <algorithm> // count_ifに必要
#include <iomanip>   // cout << setprecision(15) << x で小数の出力精度を指定
#include <tuple>
#include <utility> //pair
#include <cmath>

using namespace std;
// 問題が起こるまでintは使用禁止2020-04-13
using ll = long long;

#define rep(i, n) for (int i = 0; i < (n); ++i)

template <class InputIterator, class T>
bool contains_itr(InputIterator iterator, const T &value)
{
    if (find(iterator.begin(), iterator.end(), value) == iterator.end())
        return false;
    else
        return true;
}

template <class T>
bool contains_set(set<T> st, const T &value)
{
    if (st.find(value) == st.end())
    {
        return false;
    }
    else
    {
        return true;
    }
}

template <class InputIterator>
auto sum(InputIterator iterator)
{
    return accumulate(iterator.begin(), iterator.end(), 0);
}

// endは排他的(exclusive)なので注意
vector<ll> range(ll begin, ll end)
{
    vector<ll> result;
    for (ll i = begin; i < end; ++i)
    {
        result.push_back(i);
    }
    return result;
}

// =========ここまでテンプレ============

int main()
{
    ll a;
    string b;
    cin >> a;
    cin >> b;
    b.replace(b.size() - 3, 1, "");
    ll c = stoll(b);
    ll result100 = a * c;
    cout << result100 / 100 << endl;
}


Measured memory_bytes: 3200
c=[list(map(int, input().split(' '))) for _ in range(3)]

if (c[0][0] + c[1][1] + c[2][2]) * 2 == c[0][1] + c[0][2] + c[1][0] + c[1][2] + c[2][0] + c[2][1]:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(), (x).end()
#define dbg(x) cerr << #x << ": " << x << endl
int main() {
  int a, b, k;
  cin >> a >> b >> k;
  if(a < b) swap(a, b);
  int cnt = 0;
  int x = b + 1;
  while(cnt < k) {
    x--;
    if(a % x == 0 && b % x == 0) {
      cnt++;
    }
  }
  cout << x << endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    class Node {
        int id, key, parentKey, leftKey, rightKey;
        boolean parentIsValid = false;
        boolean leftIsValid = false;
        boolean rightIsValid = false;
        Node(int id, int key) {
            this.id = id;
            this.key = key;
        }
        void setParent(int k) {
            this.parentKey = k;
            this.parentIsValid = true;
        }
        void setLeft(int k) {
            this.leftKey = k;
            this.leftIsValid = true;
        }
        void setRight(int k) {
            this.rightKey = k;
            this.rightIsValid = true;
        }
public String toString() {
            StringBuilder sb = new StringBuilder();
            sb.append("node ");
            sb.append(id);
            sb.append(": key = ");
            sb.append(key);
            if (parentIsValid) {
                sb.append(", parent key = ");
                sb.append(parentKey);
            }
            if (leftIsValid) {
                sb.append(", left key = ");
                sb.append(leftKey);
            }
            if (rightIsValid) {
                sb.append(", right key = ");
                sb.append(rightKey);
            }
            sb.append(", ");
            return sb.toString();
        }
    }
void run() {
        Scanner sc = new Scanner(System.in);
        int h = sc.nextInt();
        Node[] A = new Node[h+1];
        for (int i = 1; i < A.length; i++) {
            int key = sc.nextInt();
            A[i] = new Node(i, key);
        }
        for (int i = 1; i < A.length; i++) {
            int parentId = i / 2;
            if (parentId != 0) A[i].setParent(A[parentId].key);
            int leftId = 2 * i;
            int rightId = 2 * i + 1;
            if (leftId < A.length) A[i].setLeft(A[leftId].key);
            if (rightId < A.length) A[i].setRight(A[rightId].key);
        }
        for (int i = 1; i < A.length; i++)
            System.out.println(A[i]);
    }
    public static void main(String[] args) {
        new Main().run();
    }
}


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

int main()
{
   int R;
   cin>>R;
  
  if(R<1200){
     cout<<"ABC"<<endl;
  }
  else if(R<2800){
    cout<<"ARC"<<endl;
  }
  else {
    cout<<"AGC"<<endl;
  }
  
  return 0;


}


Measured memory_bytes: 256