akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using  LL = long long;
LL yhaa(LL x, LL n, LL mod){
    if (n == 0){
        return 1;
    }
    if (n%2 == 0){
        LL t = (yhaa(x,n/2, mod)) % mod;//???????
        return (t*t) % mod;
    }
    return (x * yhaa(x, n-1, mod)) % mod;
}
 
LL nCk(LL n,LL k,LL m){
    int K;
    if (2*k > n){
        K  = n - k;
    }
    else{
        K = k;
    }
    LL X = 1;
    for(int i = 0; i < K;i++){
        X = (X*(n-i)) % m;
    }
    LL Y = 1;
    for(int i = 1; i < K+1; i++){
        Y = (Y*i) % m;
    }
    LL YY = yhaa(Y,1000000005,m);
    return (X*YY) % m;
 
}
int main(){
    int X, Y;
    cin >> X >> Y;
    int a, b;
    LL ans; 
    ans = 0;
    
    if ((X+Y) % 3 == 0){
        a = (2*X - Y) / 3;
        b = X - 2*a;
        if (a >= 0){
            if(b >= 0){
                ans = nCk(a+b,min(a,b),1000000007);
            }
        }
            
    }
 
    if (ans < 0){
        ans += 1000000009;
    }
    cout << ans << endl;
 
}

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

//--------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define LL long long
#define INF INT_MAX/3

//--------------------------------------------
const double EPS = 1e-14;
const double PI  = acos(-1.0);

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

int main(){
  char a, b;
  scanf("%c %c", &a, &b);

  if (a == b) {
    printf("=\n");
  } else if (a > b) {
    printf(">\n");
  } else {
    printf("<\n");
  }
}


Measured memory_bytes: 256
def lun(s):
    ch = 1
    temp = int(s[0])
    for i in s[1: ]:
        i = int(i)
        if abs(i - temp) > 1:
            ch = 0
            break
        temp = i
    return ch
k = int(input())
d = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
l = ['1', '2', '3', '4', '5', '6', '7', '8', '9']
while 1:
    for i in l:
        for j in d:
            # print(i, j)
            s = i + str(j)
            if lun(s): l.append(s)
        if len(l) >= 100002: break
    if len(l) >= 100002: break
print(l[k - 1])

Measured memory_bytes: 56028
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <queue>
#include <map>
#include <stack>
using namespace std;

int main(){
    int N,M; cin>>N>>M;
    vector<string> A(N);
    vector<string> B(M);
    int count;
    for(int i=0;i<N;i++)cin>>A.at(i);
    for(int i=0;i<M;i++)cin>>B.at(i);
    for(int i=0;i<=N-M;i++){
        for(int j=0;j<=N-M;j++){
            count=0;
            for(int k=0;k<M;k++){
                if(B.at(k)==A.at(k+i).substr(j,M))count++;
            }
            if(count==M){
                cout<<"Yes"<<endl;
                return 0;
            }
        }
    }
    cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;
import java.lang.*;
import java.io.*;
import java.math.*;

public class Main
{
    static BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
    static int tc=1;
    static String[] s;

    public static long[] ila(String[] s){
        long[] array=new long[s.length];
        for(int i=0;i<array.length;i++)
            array[i]=Long.parseLong(s[i]);
        return array;
    }
    public static void main (String[] args) throws java.lang.Exception
    {
        tc=1;
        t:
        for(int z=1;z<=tc;z++){
        	String[] s=br.readLine().split(" ");
        	int N = Integer.parseInt(s[0]);
        	int M = Integer.parseInt(s[1]);
        	long ans = ((long)N*(N-1))>>1;
        	ans += ((long)M*(M-1))>>1;
        	System.out.println(ans);
        }
    }
}

Measured memory_bytes: 22484
#include<iostream>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<map>
using namespace std;
int main() {
  int n,m,cnt=1;
  cin >> n >> m;
  for(int i=0; i<m; i++) {
    cnt*=2;
  }
  cout << (100*(n-m)+1900*m)*cnt << endl;
}

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

int main(){
    int a[3]={},b[3]={};
    int c[3][3];

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

    b[0] = c[0][0];
    b[1] = c[0][1];
    b[2] = c[0][2];
    a[1] = c[1][0] - b[0];
    a[2] = c[2][0] - b[0];


    for(int i=0;i<3;i++){
        for(int j=0;j<3;j++){
            if(c[i][j] != a[i] + b[j]){
                cout << "No" << endl;
                return 0;
            }
        }
    }

    cout << "Yes" << endl;

    return 0;
}

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

int main()
{
	int n, k, res = 0;
	cin >> n >> k;
	for (int i = 2; i <= 6; i++) {
		if(n >= 2 && i * 9 % 11 == k)
			res--;
	}
	for (int j = 2; j <= 6; j++) {
		if (j * 9 % 11 == k) {
			res += max(n / 11, 0);
		}
		for (int i = 2; i <= 10; i++) {
			if (((i * 7 + j - 7) * 9) % 11 == k) {
				res += n / 11;
			}
		}
		if ((j + 70) * 9 % 11 == k) {
			res += max(n / 11, 0);
		}
	}
	if (n % 11 == 1) n--;
	for (ll j = 2; j <= 6; j++) {
		for (ll i = n / 11 * 11 + 1; i < n; i++) {
			if (((i * 7 + j - 7) * 9) % 11 == k) {
				res++;
			}
		}
	}
	cout << res << endl;
	return 0;
}


Measured memory_bytes: 256
n=int(input())
cnt=[0]*(n+1)

for x in range(1, 101):
    for y in range(1, 101):
        for z in range(1, 101):
            tmp=x*x + y*y + z*z + x*y + y*z + z*x
            if tmp <=n:
                cnt[tmp]+=1


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

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

// #undef DEBUG  // Uncomment this line to forcefully disable debug print.
#if DEBUG
template <typename T>
void debug(const T& value) {
  std::cerr << value;
}
template <typename T, typename... Ts>
void debug(const T& value, const Ts&... args) {
  std::cerr << value << ", ";
  debug(args...);
}
#define dbg(...)                        \
  do {                                  \
    cerr << #__VA_ARGS__ << ": ";       \
    debug(__VA_ARGS__);                 \
    cerr << " (L" << __LINE__ << ")\n"; \
  } while (0)
#else
#define dbg(...)
#endif

void read_from_cin() {}
template <typename T, typename... Ts>
void read_from_cin(T& value, Ts&... args) {
  std::cin >> value;
  read_from_cin(args...);
}
#define in(type, ...) \
  type __VA_ARGS__;   \
  read_from_cin(__VA_ARGS__);

template <typename T>
void write_to_cout(const T& value) {
  std::cout << value << '\n';
}
template <typename T, typename... Ts>
void write_to_cout(const T& value, const Ts&... args) {
  std::cout << value << ' ';
  write_to_cout(args...);
}
#define out(...) write_to_cout(__VA_ARGS__);

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

using ll = long long;

template <typename T>
using V = std::vector<T>;
template <typename T>
using VV = V<V<T>>;

using namespace std;

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

  in(int, n, m);
  VV<ll> x(n, V<ll>(3));
  V<int> idx(n);
  rep(i, n) {
    rep(j, 3) cin >> x[i][j];
    idx[i] = i;
  }
  ll ans = 0;
  rep(s, 1 << 3) {
    auto f = [&](int i) {
      ll ret = 0;
      rep(j, 3) { ret += x[i][j] * (((s >> j) & 1) ? 1 : -1); }
      return ret;
    };
    sort(all(idx), [&](int a, int b) { return f(a) > f(b); });
    ll sum = 0;
    rep(j, 3) {
      ll tmp = 0;
      rep(i, m) { tmp += x[idx[i]][j]; }
      sum += abs(tmp);
    }
    ans = max(ans, sum);
  }
  out(ans);
}


Measured memory_bytes: 3688
s=input()
#s="whbrjpjyhsrywlqjxdbrbaomnw"
minCost=len(s)
char_set=set(s)
for char in char_set:
    m=max([len(_) for _ in s.split(char)])
    if m<minCost:
        minCost=m
print(minCost)

Measured memory_bytes: 2940
import java.util.*;
	import java.io.*;
	public class Main {
		static int n,wi[],W;
		static long dp[][],vi[];
		public static void main(String[] args) throws IOException{
			BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
			int t=1;
	//		Integer.parseInt(br.readLine().trim());
			StringBuilder printans=new StringBuilder();
			while(t-->0)
			{
				StringTokenizer tok=new StringTokenizer(br.readLine()," ");
				n=Integer.parseInt(tok.nextToken());
				W=Integer.parseInt(tok.nextToken());
				
				wi=new int[n];
				vi=new long[n];
				int sm=0;
				for(int i=0;i<n;i++) {
					tok=new StringTokenizer(br.readLine()," ");
					wi[i]=Integer.parseInt(tok.nextToken());
					vi[i]=Long.parseLong(tok.nextToken());
				
				}
				dp=new long[n+1][W+1];
				memset();
				printans.append(call(n-1,W));
			    
			}
			System.out.println(printans);
			
		}
		static void memset() {
			for(long a[]:dp) {
				Arrays.fill(a, -1);
			}
		}
		static long call(int i,int W) {
			
			 if (i < 0) 
			        return 0; 
			    if (dp[i][W] != -1) 
			        return dp[i][W]; 
			  
			    if (wi[i] > W) { 
			  
			        // store the value of function call stack in  
			        // table before return 
			        dp[i][W] = call(i - 1, W); 
			        return dp[i][W]; 
			    } 
			    else { 
			  
			        // store value in a table before return 
			        dp[i][W] = Math.max(vi[i] +call(i - 1,W - wi[i]), call(i - 1,W)); 
			  
			        // return value of table after storing 
			        return dp[i][W]; 
			
		}
			
			
	}
	}
	


Measured memory_bytes: 126420
import java.util.*;

public class Main{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		if(a < b){
			System.out.println("a < b");
		}else if(a == b){
			System.out.println("a == b");
		}else{
			System.out.println("a > b");
		}
	}
}




Measured memory_bytes: 26284
N = int(input())
A = list(map(int,input().split()))
k = sum(A)
###syuutenの個数
c = 1  
###考えている列の〇の個数(次の列につながる個数)
aa = 1
ans = 1
if A[0] != 0:
    aa = 2
    if N != 0:
        print(-1)
    else:
        if A[0] == 1:
            print(1)
        else:
            print(-1)
else:
    for i in range(1,N + 1):
        c *= 2
        ##次の列につながる個数の最大値
        if A[i] > c:
            ###A[i]はここが終点になるということ。終点の方が多いことは認められない
            aa = 0
            break
        elif A[i] == c:
            ###終点と同数だとこれより下には繋がらない。もし最下段でなければアウト
            if i != N:
                aa = 0
                break
            else:
                ans += c
        else:
            c -= A[i]
            k -= A[i]
            ans += A[i]
            ###終点の個数を引く。ここで終点の個数だけansを足す
            if c >= k:
                ###次の列につながる個数はこれよりしたにある終点の個数を超えれない
                c = k
            ans += c
            ###この段で下につながる個数を足す

if aa == 0:
    print(-1)
elif aa == 1:
    print(ans)

Measured memory_bytes: 19972
n=int(input())
b=list(map(int,input().split()))


def check():
    ans=[]
    for i in range(n-1,-1, -1):
        for j in range(i, -1, -1):
            if j+1==b[j]:
                ans.append(b[j])
                del b[j]
                break
    if len(ans)==n:
        return ans
    else:
        return -1

ans=check()

if type(ans)==list:
    for i in ans[::-1]:
        print(i)
else:
    print(ans)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) (x).begin(), (x).end()
using namespace std;
using ll = long long int;

bool ok (ll a, ll b, ll c) {
  return (a % 2 == 0) && (b % 2 ==0) && (c % 2 == 0);
}

int main (void) {
  ll a, b, c;
  cin >> a >> b >> c;
  if (a % 2 == 0 && a == b && b == c) {
    cout << -1 << endl;
  } else {
    int ans = 0;
    while (ok(a, b, c)) {
      ll newa = 0, newb = 0, newc = 0;
      newa = b / 2 + c / 2;
      newb = a / 2 + c / 2;
      newc = a / 2 + b / 2;
      a = newa;
      b = newb;
      c = newc;
      ans++;
    }
    cout << ans << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define lli long long int
const int mod = (int)1e9+7;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	
	int n;
	cin >> n;
	if(n==1) cout << 0;
	else {
		lli ans1 = 1LL, ans2 = 2LL, ans3 = 1LL;
		for(int i=0; i<n; i++){
			ans1 = (ans1 * 10)%mod;
			ans2 = (ans2*9)%mod;
			ans3 = (ans3 * 8)%mod;
		}
		lli ans = ((ans1-ans2+ans3)%mod+mod)%mod;
		cout << ans ;
	}
	return 0;
}

Measured memory_bytes: 3644
#include<iostream>
#include<string>
#include<vector>
#include<ctime>
#include<iomanip>
#include<fstream>
#include<stack>
#include<queue>
#include<cassert>
#include<algorithm>
#include<unordered_map>
#include<map>
#include<functional>
#include<exception>
#include<utility>
#define fori(i,z,u) for(i=z;i<u;i++)
#define forz(i,m) for(i=0;i<m;i++)
#define forinc(i,z,u,inc) for(i=z;i<u;i+=inc)
using namespace std;
#define fi first
#define se second
#define vi vector<int>
#define vill vector<long long>
#define vd vector<long double>
#define vvi vector<vector<int>>
#define vs vector<string>
#define vb vector<bool>
#define ump unordered_map
#define debug(x) cout<<#x<<" : "<<x
using ll = long long;
using ld = long double;
using ull = unsigned long long;
#define pii pair<int,int>
#define pll pair<ll,ll>
//#define Onlaptop

int main()
{
	int i{ 0 }, j{ 0 }, k{ 0 }, l{ 0 }, a{ 0 }, b{ 0 }, c{ 0 }, d{ 0 }, t{ 0 }, n{ 0 };

	#ifdef Onlaptop
		fstream cin,cout;
	
		cin.open("input.txt");
		cout.open("output.txt",ios::trunc);
	#endif
	
	cin>>n;
	if(n==1)
	{
		cout<<"Yes";return 0;
	}
	
	vi vec(n);
	
	forz(i,n)
	{
		cin>>vec[i];
	}
	
	for(int i=n-1;i>0;i--)
	{
		if(vec[i]-vec[i-1]<-1)
		{
			cout<<"No";return 0;
		}
		else if(vec[i]-vec[i-1]<0)
		{
			vec[i-1]-=1;
		}
	}
	cout<<"Yes";
	
	return 0;
}

Measured memory_bytes: 640
#include<stdio.h>
#include<string.h>
 
int main(){
  char w[101];
  scanf("%s",w);
  int len=strlen(w);
  
  int alpha[26]={0};
  for(int k=0;k<len;k++){
    alpha[w[k]-'a']++;
  }
  int t=0;
  for(int k=0;k<26;k++){
    if(alpha[k]%2!=0){
      t++;
    }
  }
  
  if(t>0){
    printf("No\n");
  }else{
    printf("Yes\n");
  }
  return 0;
}

Measured memory_bytes: 1660
#include <bits/stdc++.h>
using namespace std;
using pint = pair<int,int>;

int main(){
    int N,M,X;
    cin >> N >> M >> X;
    vector<int> A(M);
    int a;
    int ans =0;
    for(int i=0;i<N;i++){
        cin >> a;
        if(a < X) ans++;
        else break;
    }
    if(ans > (M-ans)) ans = M-ans;
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
  ll N; cin >> N;
  string s; cin >> s;
  ll num = 0;
  for (ll i = 1; i < N; i++) {
    if (s[i] == 'E') {num++;}
  }
  ll res = num;
  for (ll i = 1; i < N; i++) {
    if (s[i-1] == 'W') {num++;}
    if (s[i] == 'E') {num--;}
    if (res > num) {res = num;}
  }
  cout << res << endl;
}

Measured memory_bytes: 900
const main = (arg) => {
  const lines = arg.trim().split('\n');
  const A = lines[0].split(' ').map((x) => Number.parseInt(x));
  A.sort((a, b) => b - a);
  console.log(A[0] - A[2]);
};
main(require('fs').readFileSync('/dev/stdin', 'utf8'));


Measured memory_bytes: 30276
n=int(input())
ba,a,b,ab=0,0,0,0
for i in range(n):
    s=input()
    if s[0]=='B' and s[-1]=='A':
        ba+=1
    elif s[0]=='B':
        b+=1
    elif s[-1]=='A':
        a+=1
    for i in range(len(s)-1):
        if s[i]=='A' and s[i+1]=='B':
            ab+=1
if a==b and a==0 and ba!=0:
	ba-=1
print(min(a,b)+ba+ab)


Measured memory_bytes: 47372
<?php
//error_reporting(0);
$S = trim(fgets(STDIN));
//list($N,$M) =  explode(" ",trim(fgets(STDIN)));
//$p = explode(" ",trim(fgets(STDIN)));

$k = strlen($S);

$w = substr_count($S,"o");

$left = 15 - $k;

if ($w + $left >= 8) {
  printf("YES\n");
}
else {
  printf("NO\n");
}


Measured memory_bytes: 4728
K = int(input())
import sys
from queue import Queue
queue = Queue()
for i in range(1,10):
  queue.put(i)
if K <= 9:
  print(K)
  sys.exit()
count = 0
while True:
  j = queue.get()
  count += 1
  if count == K:
    print(j)
    break
  if j % 10 != 0:
    queue.put(10*j+(j%10)-1)
  queue.put(10*j+(j%10))
  if j % 10 != 9:
    queue.put(10*j+(j%10)+1)

Measured memory_bytes: 18996
#include <stdio.h>
#define HILLS 10

int main(void){
	int i, t, max[3]={0,0,0};
	for(i=0;i<HILLS;i++){
		scanf("%d",&t); if(t>max[0]) max[0]=t;
		for(t=0;t<2;t++)
			if(max[t]>max[t+1]){ int x; x=max[t], max[t]=max[t+1], max[t+1]=x; }
	}
	for(i=2;i>=0;i--) printf("%d\n",max[i]);
	return 0;
}

Measured memory_bytes: 0
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);

		int a = scan.nextInt();
		String b = scan.next();
int n = b.length();


if(n <= a) {
	System.out.println(b);
}else {
	System.out.println(b.substring(0,a)+"...");
}

		scan.close();
	}

}


Measured memory_bytes: 26996
#include "bits/stdc++.h"
using namespace std;

int main() {
    
    string s;
    cin >> s;
    for (int i=0; i<26; i++) {
		bool oc = false;
		for (int j=0; j<s.size(); j++) {
			if ((int) s[j] == 'a' + i) oc = true;
		}
		if (!oc) {
			cout << ((char) ('a' + i)) << endl;
			exit(0);
		}
	}
	cout << "None" << endl;
}


Measured memory_bytes: 512
#include "bits/stdc++.h"
using namespace std;
const int MAX = 700000;
const int MOD = 1000000007;

long long  fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
/*第二引数で第一引数を割ったときの切り上げの計算*/
long long int maxtime(long long int x, long long int y){
	return(x + y - 1) / y;

}
/*最大公約数*/
long long int lcm(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;

	if (number2 > number1) {
		m = number2;
		n = number1;
	}
	long long int s = -1;
	while (s != 0) {
		s = m % n;
		m = n;
		n = s;
	}
	return m;
}
/*最大公倍数*/
long long int gcd(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;
	return m / lcm(m, n) * n;
}
/*逆元計算*/
long long int  modinv(long long a, long long m) {
	long long int b = m, u = 1, v = 0;
	while (b) {
		long long int t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
// index が条件を満たすかどうか
vector<long long int >meguru;
bool isOK(int index, int key) {
	if (meguru[index] >= key) return true;
	else return false;
}
// 汎用的な二分探索のテンプレ
int binary_search(int key) {
	int left = -1; //「index = 0」が条件を満たすこともあるので、初期値は -1
	int right = (int)meguru.size(); // 「index = a.size()-1」が条件を満たさないこともあるので、初期値は a.size()
	/* どんな二分探索でもここの書き方を変えずにできる！ */
	while (right - left > 1) {
		int mid = left + (right - left) / 2;

		if (isOK(mid, key)) right = mid;
		else left = mid;
	}
	/* left は条件を満たさない最大の値、right は条件を満たす最小の値になっている */
	return right;
}
long long modpow(long long a, long long n, long long mod) {
	long long res = 1;
	while (n > 0) {
		if (n & 1) res = res * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}
int dp[3000][3000] = {};
int main() {
	long long int n, x, y;
	cin >> n >> x >> y;
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= n; j++) {
			if (i == x && j == y) {
				dp[i][j] = 1;
			}
			else if (i == y && j == x) {
				dp[j][i] = 1;
			}
			else {
				dp[i][j] = abs(i - j);
			}
		}
	}
		for (int i = 1; i <= n; i++) {
			for (int j = 1; j <= n; j++) {
				int t = abs(i - x) + abs(j - y)+1;
				dp[i][j] = min(t,abs(i-j));
			}
		}
	int ans[3000] = {};
	for (int i = 1; i <= n; i++) {
		for (int j = i; j <= n; j++) {
			ans[dp[i][j]]++;
		}
	}
	for (int i = 1; i <= n - 1; i++) {
		cout << ans[i] << endl;
	}
}


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

int main() {
  int H, W;
  cin >> H >> W;
  vector<string>a(H+2);
  for(int i=0;i<W+2;i++){
    a.at(0)+='#';
    a.at(H+1)+='#';
  }
  cout << a.at(0) << endl;
  for(int i=1;i<H+1;i++){
    a.at(i)='#';
    string s;
    cin >> s;
    a.at(i)+=s;
    a.at(i)+='#';
    cout << a.at(i) << endl;
  }
  cout << a.at(H+1) << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
string s;
long long d;
long long dp[10012][112][2];
const long long MOD = 1e9+7;
long long rec(long long digit,long long m,long long flag){
    
    if(digit<0){
        if(m==0){
            return 1;
        }else{
            return 0;
        }
    }
    if(dp[digit][m][flag]!=-1){
        return dp[digit][m][flag];
    }
    dp[digit][m][flag] = 0;
    if(flag == 1){
        for(long long j=0;j<s[digit]-48;j++){
            dp[digit][m][flag] += rec(digit-1,(m+j)%d,0);
        }
        dp[digit][m][flag] += rec(digit-1,(m+(s[digit]-48))%d,1);
    }else{
        for(long long j=0;j<=9;j++){
            dp[digit][m][flag] += rec(digit-1,(m+j)%d,0);
        }
    }
    dp[digit][m][flag]%=MOD;
    
    return dp[digit][m][flag];
}
int main(){
    cin>>s>>d;
    for(long long i=0;i<=10010;i++){
        for(long long j=0;j<=110;j++){
            dp[i][j][0] = dp[i][j][1] = -1;
        }
    }
    reverse(s.begin(),s.end());
    cout<<(rec(s.size()-1,0,1)-1+MOD)%MOD<<endl;
}

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

using namespace std;

int main() {
    string N;
    cin >> N;
    int fx = 0;
    for(auto c: N)
        fx += c-'0';
    if(stoi(N)%fx)
        cout << "No" << endl;
    else
        cout << "Yes" << endl;

    return 0;
}

Measured memory_bytes: 256
arr = gets.chomp.tr("/_\\","210").split("").map(&:to_i)

height = []
i = 0
height[0] = 0
arr.each{|j|
  i += 1
  height[i] = height[i-1] + j - 1
}

lake = []
tmp = height.clone
x0 = 0
loop do
  break if arr[x0] == 0
  break if tmp.size == 0
  tmp.shift
  x0 += 1
end
loop do
  break if tmp.size == 0
  h = tmp.shift
  x1 = tmp.index(h)
  if x1 then
    area = 0
    for i in x0..x0+x1
      #      printf "%d %d %d\n", i, height[i], arr[i]
      area += h - height[i]
      area += 0.5 if arr[i] == "0"
      area -= 0.5 if arr[i] == "2"
    end
    if area.to_i > 0 then
      lake.push(area.to_i)
    end
    tmp = tmp[x1...tmp.size]
    x0 += x1+1
    loop do
      break if arr[x0] == 0
      break if tmp.size == 0
      h = tmp.shift
      x0 += 1
    end
    # p x0
  else
    x0 += 1
  end
end

if lake.size > 0 then
  puts lake.inject(&:+)
  printf "%d %s\n", lake.size, lake.join(" ")
else
  puts 0
  puts 0
end

Measured memory_bytes: 9500
import java.util.Scanner;

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

		String s = sc.next();

		int minSub = 1000;
		for (int i = 0; i + 2 < s.length(); i++) {
			int x = Integer.parseInt(s.substring(i, i + 3));
			int sub = 753 - x;
			if (sub < 0)
				sub *= -1;
			if (sub < minSub) {
				minSub = sub;
			}
		}
		System.out.println(minSub);
		sc.close();
	}
}


Measured memory_bytes: 21716
#include<bits/stdc++.h>
#define ll long long
#define pii_ pair<int,int>
#define mp_ make_pair
#define pb push_back
#define fi first
#define se second
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define show1(a) cout<<#a<<" = "<<a<<endl
#define show2(a,b) cout<<#a<<" = "<<a<<"; "<<#b<<" = "<<b<<endl
using namespace std;
const ll INF = 1LL<<60;
const int inf = 1<<30;
const int maxn = 2e5+5;
inline void fastio() {ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);}

int n;
ll a[maxn];
void GG()
{
    cout<<-1<<endl; exit(0);
}
int main()
{
    fastio();
    cin>>n;
    rep(i,1,n) cin>>a[i];
    ll T = 0;
    rep(i,3,n) T ^= a[i];
    ll S = a[1] + a[2];
    ll D = (S-T)/2;
    if(S<T || (S-T)%2 || D&T) GG();
    for(ll i=62;i>=0;i--){
        if ((T&(1LL<<i)|D) <= a[1]){
            D |= T&(1LL<<i);
        }
    }
    if(D>0 && D<=a[1]) cout<<a[1] - D<<endl;
    else GG();
    return 0;
}


Measured memory_bytes: 3656
#include <stdio.h>
#include <stdlib.h>
#define MAX 2000001
#define VMAX 10000


int main(){
  int *A,*B;
  int C[VMAX+1];
  int n,i,j;
  int k=0;

  scanf("%d",&n);

  A=malloc(sizeof(int)*n+1);
  B=malloc(sizeof(int)*n+1);

  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
    if(A[i]>k)k=A[i];
  }
  for(i=0;i<=k;i++){
    C[i]=0;
  }
  for(j=0;j<n;j++){
    C[A[j]]++;
  }
  for(i=1;i<=k;i++){
    C[i]=C[i]+C[i-1];
  }
  for(j=n-1;j>=0;j--){
    B[C[A[j]] - 1]=A[j];
    C[A[j]]--;
  }
  for(i=0;i<n;i++){
  printf("%d",B[i]);
  if(i<n-1)printf(" ");
  }
  printf("\n");
  return 0;
}



Measured memory_bytes: 17388
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc=new Scanner(System.in);
		
		int r=sc.nextInt();
		int g=sc.nextInt();
		int b=sc.nextInt();
				
		if((100*r+10*g+b)%4==0) {
			System.out.println("YES");
		}else {
			System.out.println("NO");
		}		
	}

}


Measured memory_bytes: 23252
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,n,s) for(int i = s; i < (n); ++i)
#define rsrep(i,n,s) for(int i = (n)-1; i >= s; --i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define show(x) cout<<#x<<" = "<<x<<endl;
#define yn(f) { if (f) puts("YES"); else puts("NO"); }
#define yns(f) { if (f) puts("Yes"); else puts("No"); }
#define show_ary(...) { cout<<#__VA_ARGS__<<" = "; for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define out_ary(...) { for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
using namespace std;
typedef long long int ll;
const ll LINF = 9000000000000000000ll;
const int INF = 2000000000;
const ll MOD = 1e9+7;

int main() {
    int n, k;
    cin >> n >> k;
    k = min(n-1, k);
    vector<int> h(n);
    rep(i, n) {
        cin >> h[i];
    }
    int dp[n];
    dp[0] = 0;
    int mn;
    srep(i, k, 1) {
        mn = INF;
        rep(j, i) {
            mn = min(mn, dp[j] + abs(h[i] - h[j]));
        }
        dp[i] = mn;
    }
    //show_ary(dp);
    srep(i, n, k) {
        mn = INF;
        srep(j, k+1, 1) {
            mn = min(mn, dp[i-j] + abs(h[i-j] - h[i]));
        } 
        dp[i] = mn;
    }
    //show_ary(dp);
    cout << dp[n-1] << endl;
    return 0;
}

Measured memory_bytes: 1024
# Template 1.0
import sys, re
from collections import deque, defaultdict, Counter, OrderedDict
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from heapq import heappush, heappop, heapify, nlargest, nsmallest
def STR(): return list(input())
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def list2d(a, b, c): return [[c] * b for i in range(a)]
def sortListWithIndex(listOfTuples, idx):   return (sorted(listOfTuples, key=lambda x: x[idx]))
def sortDictWithVal(passedDic):
    temp = sorted(passedDic.items(), key=lambda kv: (kv[1], kv[0]))
    toret = {}
    for tup in temp:
        toret[tup[0]] = tup[1]
    return toret
def sortDictWithKey(passedDic):
    return dict(OrderedDict(sorted(passedDic.items())))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

n = INT()

a = 1
ans = 0
while(n/a>1):
    ans+=ceil(n/a) - 1


    a+=1
print(int(ans))

Measured memory_bytes: 68696
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    String S = sc.next();
    int[][] dp = new int[N+1][N+1];
    int max = 0;
    for (int i = 1; i <= N-1; i++) {
      for (int j = i+1; j <= N; j++) {
        if (S.charAt(i-1) == S.charAt(j-1)) {
          dp[i][j] = dp[i-1][j-1] + 1;
          if (dp[i][j] <= j-i) {
            max = Math.max(max, dp[i][j]);
          }
        }
      }
    }
    System.out.println(max);
  }
}

Measured memory_bytes: 167200
N = int(input())
DEBUG = False
flag = False
for i in range(1,10):
    div = int(N / i)
    if DEBUG:
        print('i = %d : div = %d'%(i,div))
    if i*div == N and div-9 <=0:
        flag = True
    if flag:
        break
        
if flag:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3060
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>

int main() {
	int W, H, x, y, r;

	scanf("%d %d %d %d %d", &W, &H, &x, &y, &r);

	if ((0 <= x - r && x + r <= W) && (0 <= y - r && y + r <= H)) {
		printf("Yes\n");
	}
	else {
		printf("No\n");
	}
	return 0;
}


Measured memory_bytes: 2140
#include<bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
int main(){
    int n,d,l;
    while(cin>>n>>d>>l,n){
        int a[n],ans=0,p=0;
        r(i,n)cin>>a[i];
        r(i,n-1){
            if(a[i]>=l)p=d;
            p--;
            if(p>=0)ans++;
        }
        cout<<ans<<endl;
    }
}

Measured memory_bytes: 3472
//AcFreak

#include<bits/stdc++.h>
#define lint long long int 
#define mp make_pair
#define pb push_back
#define f first
#define INF (lint )(1e9)
#define __ ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define s second
#define endl '\n'
#define pii pair<int,int >
using namespace std;


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

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<string>
using namespace std;
int main()
{
    double time1,time2;
    while(scanf("%lf %lf",&time1,&time2) != EOF){
        if(time1 < 35.5 && time2 < 71) cout << "AAA" << endl;
        else if(time1 < 37.5 && time2 < 77) cout << "AA" << endl;
        else if(time1 < 40 && time2 < 83) cout << "A" << endl;
        else if(time1 < 43 && time2 < 89) cout << "B" << endl;
        else if(time1 < 50 && time2 < 105) cout << "C" << endl;
        else if(time1 < 55 && time2 < 116) cout << "D" << endl;
        else if(time1 < 70 && time2 < 148) cout << "E" << endl;
        else cout << "NA" << endl;
    }

	return 0;
}

Measured memory_bytes: 1228
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,K,a,kotae=0;
  cin >> N;
  cin >> K;
  
  for(int p=0;p<N;p++){
    cin>>a;
    if(a>=K){
      kotae++;
    }
    
  }
  
   cout << kotae << endl; 
 
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i, n) FOR(i, 0, (n))
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define LAR(a, b) ((a)=max((a),(b)))
#define SML(a, b) ((a)=min((a),(b)))
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pair<int, int>> vpii;
typedef pair<int, int> pii;
#define PB push_back
#define EB emplace_back
#ifdef LOCAL_DEBUG
#define DEBUG(...) printf(__VA_ARGS__)
#else
#define DEBUG(...)
#endif

int main(){
	int n; scanf("%d", &n);
	int ans = 0;
	FOR(i, 1, n+1){
		int sm = 0, a = i;
		while(a){
			sm ++;
			a /= 10;
		}
		if(sm%2) ans++;
	}
	printf("%d\n", ans);
}


Measured memory_bytes: 256
#include<stdio.h>
int main(){
	int a, b;
	scanf("%d %d", &a, &b);
	if (a == b){
		printf("a == b\n");
	}
	else if (a < b){
		printf("a < b\n");
	}
	else{
		printf("a > b\n");
	}
	return 0;
}

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

#define PI 3.14159265359

typedef struct{
	double x;
	double y;
}Point;

void kock(int, Point, Point);

main(){
	int n;
	Point p1 = { 0, 0 }, p2 = { 100, 0 };

	scanf("%d", &n);

	printf("%f %f\n", 0, 0);
	kock(n, p1, p2);
	printf("%f %f\n", (double)100, 0);

	return 0;
}

void kock(int n, Point p1, Point p2){
	Point s, u, t;
	if (n == 0) return;

	s.x = (2 * p1.x + p2.x) / 3;
	s.y = (2 * p1.y + p2.y) / 3;
	t.x = (p1.x + 2 * p2.x) / 3;
	t.y = (p1.y + 2 * p2.y) / 3;
	u.x = (t.x - s.x)*cos(PI / 3) - (t.y - s.y)*sin(PI / 3) + s.x;
	u.y = (t.x - s.x)*sin(PI / 3) + (t.y - s.y)*cos(PI / 3) + s.y;

	kock(n - 1, p1, s);
	printf("%f %f\n", s.x, s.y);
	kock(n - 1, s, u);
	printf("%f %f\n", u.x, u.y);
	kock(n - 1, u, t);
	printf("%f %f\n", t.x, t.y);
	kock(n - 1, t, p2);
}

Measured memory_bytes: 636
#include <iostream>
#include <algorithm>
#include <string>
#include <list>
#include<vector>
#include <sstream>
#include <stdio.h>
#include <valarray>
#include <iomanip>
#include <unordered_set>
#include <set>
using namespace std;

int main(void)
{

	vector<int> Price;
	int Count;
	int Buy;

	cin >> Count >> Buy;
	int tmp;
	for (int i=0;i<Count;i++)
	{
		cin >> tmp;
		Price.emplace_back(tmp);
	}

	std::sort(Price.begin(), Price.end());

	int Sum = 0;

	for (int i=0;i<Buy;i++)
	{
		Sum += Price[i];
	}
	
	cout << Sum<<endl;

	return 0;
}

Measured memory_bytes: 3172
#include <iostream>
#include <vector>
#include <cmath>
#include <queue>
#include <deque>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <functional>
#include <bitset>
#include <utility>
#include <sstream>
#include <fstream>
#include <stack>
#include <cstdlib>
#include <complex>
#include <set>

using namespace std;

#define INF 1070000000LL
#define pb push_back
#define irep(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) irep(i,0,n)

typedef long long lint;
typedef pair<int, int> pint;
struct Edge{
    int to,weight;
};
typedef vector<vector<Edge> > Graph;
    

int main(){
    int x,y,z,k;
    cin >> x >> y >> z >> k;
    vector<lint> a(x);
    rep(i,x)cin >> a[i];
    vector<lint> b(y);
    rep(i,y)cin >> b[i];
    vector<lint> c(z);
    rep(i,z)cin >> c[i];

    vector<lint> d;
    rep(i,x)rep(j,y)d.pb(a[i]+b[j]);
    sort(d.begin(),d.end(),greater<lint>());

    vector<lint> all;
    rep(i,z)rep(j,min(k,x*y))all.pb(c[i]+d[j]);
    sort(all.begin(),all.end(),greater<lint>());

    rep(i,k)cout << all[i] << endl;	
}


Measured memory_bytes: 43368
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
	Scanner sc = new Scanner(System.in);
	while(true){
		int count = 0;
		int count2 = 1;
		int h = sc.nextInt();
		int w = sc.nextInt();
		if(h==0 && w==0) break;
		for(int i=0; i<h; i++){
		for(int j=0; j<w; j++){
			if(count2==1 || count2==h){
				System.out.print("#");}
			else	if(count==1 || count==w){
		System.out.print("#");}
			else{System.out.print(".");}
			count+=1;
		}
		System.out.println(); 
		count2+=1;
		count = 1;
		
		
		 }
		System.out.println();
		}
         
        }
}

Measured memory_bytes: 24636
n = int(input())
ali = list(map(int, input().split()))

allxor = 0
for ai in ali:
    allxor = allxor ^ ai

for i in range(n):
    ans = allxor ^ ali[i]
    
    if i != (n-1):
        print(ans, end=" ")
    else:
        print(ans)

Measured memory_bytes: 31548
import sys
from itertools import combinations

import numpy as np

n = int(input())
points = np.array([np.fromiter(map(int, line.split()), dtype=np.float64) for line in sys.stdin])

if n == 2:
    p1, p2 = points
    print(np.sqrt(((p1 - p2) ** 2).sum()) / 2)
    exit()

ans = 10 ** 18
for p1, p2, p3 in combinations(points, 3):
    A = ((p2 - p3) ** 2).sum()
    B = ((p3 - p1) ** 2).sum()
    C = ((p1 - p2) ** 2).sum()
    sa, sb, sc = sorted([A, B, C])
    if sa + sb <= sc + 1e-7:
        c = (p2 + p3 if A == sc else p1 + p3 if B == sc else p1 + p2) / 2
        R2 = sc / 4
    else:
        T = A * (B + C - A)
        U = B * (C + A - B)
        W = C * (A + B - C)
        c = (T * p1 + U * p2 + W * p3) / (T + U + W)
        R2 = ((c - p1) ** 2).sum()
    if ((points - c) ** 2).sum(axis=1).max() <= R2 + 1e-7:
        print(np.sqrt(R2))
        break
else:
    raise AssertionError


Measured memory_bytes: 14440
#include<stdio.h>

int n;
int a[100001];

int waru(int min,int flag){
  if(min == 1){
    return 1;
  }
  
  else if(flag <= 1){
    return min;
  }
  
  int temp = min , dou = 0;
  flag = 0;
  for(int i = 0;i < n;i ++){
    if(temp != a[i]){
    a[i] = a[i]%temp;
    }
    else{
      dou ++;
    }
    if(0 < a[i]){
      flag ++;
      if(a[i] < min){
      min = a[i];
      }
    }
  }
  waru(min,flag - dou + 1);
}
  
    
  
    


int main(void){
  scanf("%d",&n);
  
  int min = 1000000001;
  for(int i = 0;i < n;i ++){
    scanf("%d",&a[i]);
    if(min > a[i]){
      min = a[i];
  }
  }
  
  int ans = waru(min,2);
  
  printf("%d",ans);
  
  return 0;
}

Measured memory_bytes: 512
#include<stdio.h>
#include<stdlib.h>
#define NIL NULL

struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;

Node root;


void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;

  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;

  while(x != NIL) {
    y = x;
    if(z->key < x->key) x = x->left;
    else x = x->right;
  }
  z->parent = y;
  if(y == NIL) root = z;
  else if(z->key < y->key) y->left = z;
  else y->right = z;
}

Node treeSearch(Node u, int k) {

}

void printInorder(Node u) {
  if(u->left != NIL)printInorder(u->left);
  printf(" %d", u->key);
  if(u->right != NIL)printInorder(u->right);
}

void printPreorder(Node u) {
  printf(" %d", u->key);
  if(u->left != NIL)printPreorder(u->left);
  if(u->right != NIL)printPreorder(u->right);
}


int main(){
  int n, i, x;
  char command[20];
  scanf("%d", &n);

  for ( i = 0; i < n; i++ ){
    scanf("%s", command);
    if ( command[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    }
    else if( command[0] == 'f') {
      scanf("%d", &x);
      if( treeSearch != NIL) printf("yes\n");
      else printf("no\n");
    }
    else if ( command[0] == 'p' ){
      printInorder(root);
      printf("\n");
      printPreorder(root);
      printf("\n");
    }
  }

  return 0;
}

Measured memory_bytes: 24040
#include <iostream>
#include <map>

using namespace std;

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

    map<string, int> m;
    for(int i=0; i<N; i++){
        string s;
        cin >> s;

        if(m.find(s) == m.end()) m[s] = 1;
        else m[s]++;

    }

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

Measured memory_bytes: 25216
#include<stdio.h>
int main(){
    int dice[101][6],subdice[6],i,j,k,l,n;
    scanf("%d",&n);
    for(i=0;i<n;i++) for(j=0;j<6;j++) scanf("%d",&dice[i][j]);
    for(i=0;i<n;i++){
        for(j=i+1;j<n;j++){
            if(dice[i][0]==dice[j][0]);
            else if(dice[i][0]==dice[j][1]||dice[i][0]==dice[j][4]){
                for(k=0;k<6;k++){
                    subdice[0]=dice[j][4];
                    subdice[4]=dice[j][5];
                    subdice[5]=dice[j][1];
                    subdice[1]=dice[j][0];
                    subdice[2]=dice[j][2];
                    subdice[3]=dice[j][3];

                    for(l=0;l<6;l++){
                        dice[j][l]=subdice[l];
                    }
                    if(dice[i][0]==dice[j][0]) break;
                }
            }else if(dice[i][0]==dice[j][2]||dice[i][0]==dice[j][3]||dice[i][0]==dice[j][5]){
                for(k=0;k<6;k++){
                    subdice[0]=dice[j][2];
                    subdice[2]=dice[j][5];
                    subdice[5]=dice[j][3];
                    subdice[3]=dice[j][0];
                    subdice[1]=dice[j][1];
                    subdice[4]=dice[j][4];
                    for(l=0;l<6;l++){
                        dice[j][l]=subdice[l];
                    }
                    if(dice[i][0]==dice[j][0]) break;
                }
            }
            for(k=0;k<4;k++){
                subdice[1]=dice[j][2];
                subdice[2]=dice[j][4];
                subdice[4]=dice[j][3];
                subdice[3]=dice[j][1];
                for(l=1;l<5;l++){
                    dice[j][l]=subdice[l];
                }
                if(dice[i][1]==dice[j][1]){
                    if(dice[i][0]==dice[j][0]&&dice[i][2]==dice[j][2]&&dice[i][3]==dice[j][3]&&dice[i][4]==dice[j][4]&&dice[i][5]==dice[j][5] ){
                        printf("No\n");
                        return 0;
                    }
                }
            }
        }
    }
    if(i==n&&j==n)printf("Yes\n");

    return 0;
}


Measured memory_bytes: 2148
#include <iostream>
#include <iomanip>
#include <string>
typedef long long ll;
using namespace std;
const  ll INF = 1e9;
const  ll MOD = 1e9 + 7;
#define repi(i,n,init) for(ll i=init;i<(n);i++)

int main()
{
    string n;
    cin >> n;
    int ans = 0;
    repi(i,n.size(),0){
        if(n[i] == '2')ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    int arr[n+1]={0};
    for(int x=1;x<=n;x++)
    {
        for(int y=1;y<=n;y++)
        {
            for(int z=1;z<=n;z++)
            {
                int value=x*x+y*y+z*z+x*y+y*z+z*x;
                if(value>n) break;
                arr[value]++;
            }
        }
    }
    for(int i=1;i<=n;i++)
        cout<<arr[i]<<"\n";
    return 0;

}


Measured memory_bytes: 3684
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = s; i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << endl;
#define CFYN(n) cout << ( (n) ? "YES":"NO") << endl;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;

int main(void)
{
    IOS
    int x; cin >> x;

    bool ans = false;
    int a = x / 100;
    int b = x % 100;
    if (b <= 5 * a) ans = true;

    if(ans) cout << 1 << endl;
    else cout << 0 << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (lli i = 0; i < (n); i++)
#define rrep(i, n) for (lli i = (n)-1; i >= 0; i--)
using namespace std;
using lli = long long int;
int main()
{
    string s;
    int n, m;
    cin >> n >> m;
    int cnt[30] = {};
    if (m & 1)
        swap(n, m);
    rep(i, n) rep(j, m)
    {
        char a;
        cin >> a;
        cnt[a - 'a']++;
    }
    rep(i, 26)
    {
        cnt[i] %= 4;
    }
    int c = 0;
    int b = 0;
    if (n & 1 and m & 1) {
        rep(i, 26)
        {
            if (cnt[i] == 1 or cnt[i] == 3) {
                c++;
                if (cnt[i] == 3)
                    b++;
            } else if (cnt[i] == 2) {
                b++;
            }
        }
        if (c > 1) {
            cout << "No" << endl;
        } else {
            if (2 * b <= n + m - 2) {
                cout << "Yes" << endl;
            } else {
                cout << "No" << endl;
            }
        }
    } else if (n & 1) {
        rep(i, 26)
        {
            if (cnt[i] == 1 or cnt[i] == 3) {
                c++;
                if (cnt[i] == 3)
                    b++;
            } else if (cnt[i] == 2) {
                b++;
            }
        }
        if (c) {
            cout << "No" << endl;
        } else {
            if (2 * b <= m) {
                cout << "Yes" << endl;
            } else {
                cout << "No" << endl;
            }
        }
    } else {
        rep(i, 26)
        {
            if (cnt[i] == 1 or cnt[i] == 3 or cnt[i] == 2) {
                c++;
            }
        }
        if (c) {
            cout << "No" << endl;
        } else {
            cout << "Yes" << endl;
        }
    }
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int[] arr = new int[5];
        for (int i = 0; i < 5; i++) {
            arr[i] = sc.nextInt();
        }
        int k = sc.nextInt();
        for (int i = 0; i < 5; i++) {
            for (int j = 0; j < 5; j++) {
                if(Math.abs(arr[i]-arr[j]) > k) {
                    System.out.println(":(");
                    return;
                }
            }
        }
        System.out.println("Yay!");
    }
}


Measured memory_bytes: 21716
#include<iostream>
using namespace std;
int main(){
	long long int s,c;
	int i=0;
	long long int a=0;
	
	cin>>s>>c;
	if(c/2>=s){
		a+=s;
		c-=s*2;
		a+=c/4;
	}else{
		a=c/2;
		//限界数到達
	}
	cout<<a<<endl;
	return 0;
}


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

int main()
{
        int n;

        while(1){
                cin >> n;
                if(!n){break;}
                double s[n], m;
                m=0;
                for(int i=0; i<n; i++){
                        cin>>s[i];
                        m+=s[i];
                }
                m /= n;
                double a_2=0;
                for(int i=0; i<n; i++){
                        a_2 += (s[i]-m)*(s[i]-m)/n;
                }
                printf("%.8lf\n", sqrt(a_2));
        }

        return 0;
}

Measured memory_bytes: 1252
#include<iostream>
using namespace std;
#define INFTY (1 << 30)

enum Color {
	WHITE,
	GRAY,
	BLACK,
};

void Prim(int verValWeight[][100], int verNum) {
	int distance[100];
	Color color[100];
	int parent[100];
	for (int i = 0; i < verNum; i++) {
		color[i] = WHITE;
		distance[i] = INFTY;
		parent[i] = -1;
	}
	distance[0] = 0;

	while (true) {
		int min_cost = INFTY;
		int subScript;
		for (int i = 0; i < verNum; i++) {
			if (color[i] != BLACK && distance[i] < min_cost) {
				min_cost = distance[i];
				subScript = i;
			}
		}

		if (min_cost == INFTY)
			break; //end

		color[subScript] = BLACK;

		for (int i = 0; i < verNum; i++) {
			if (color[i] != BLACK && verValWeight[subScript][i] != INFTY) {
				if (verValWeight[subScript][i] < distance[i]) {
					distance[i] = verValWeight[subScript][i];
					parent[i] = subScript;
					color[i] = GRAY;
				}
			}
		}
	}

	int weight_sum = 0;
	for (int i = 0; i < verNum; i++)
		weight_sum += distance[i];
		//if (parent[i] != -1)
		//	weight_sum += verValWeight[i][parent[i]];
	cout << weight_sum << endl;

}

int main() {
	int verNum;
	int verValWeight[100][100];
	int parent[100];

	cin >> verNum;
	for (int i = 0; i < verNum; i++)
		for (int j = 0; j < verNum; j++) {
			cin >> verValWeight[i][j];
			if (verValWeight[i][j] == -1) verValWeight[i][j] = INFTY;
		}

	Prim(verValWeight, verNum);

	return 0;
}

Measured memory_bytes: 3056
S = input()

ans1 = 0
ans2 = 0

for i in range(len(S)):
    if (i+1) % 2 == 0:
        if S[i] in ['R']:
            ans1 += 1
    else:
        if S[i] in ['L']:
            ans2 += 1

if ans1 + ans2 == 0:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3060
#include<stdio.h>
 #include<string.h>
 int main(void)
 {   
    char A[11],B[11],C[11];
    scanf("%s%s%s",A,B,C);
        
    int ae = strlen(A);
    int be = strlen(B);
        
    if((A[ae-1]==B[0])&&(B[be-1]==C[0]))
       printf("YES\n");
    else printf("NO\n");                                
        
    return 0;
 }   


Measured memory_bytes: 128
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner scan = new Scanner(System.in);
        
        int x = scan.nextInt();
        int a = scan.nextInt();
        int b = scan.nextInt();
        
        int c = Change(x-a,b);
        System.out.println(c);
    }
    
    public static int Change(int a,int b){
        return a%b;
    }
}

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

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

int main(void){
	string s;
    cin  >> s;
    int ans = 0;
    REP(i,s.size()/2)
        if(s[i] != s[s.size()-1-i]) ans++;
    cout << ans;
    return 0;
}


Measured memory_bytes: 256