akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cmath>

void setPrimesUnder(int n, bool *p){
    if(n > 2){
        setPrimesUnder(sqrt(n), p);
        for(int i=2; i<=sqrt(n); i++){
            if(!p[i])                       // if i is not a prime
                continue;                   // i++
            for(int j=2; j<=1000000/i; j++) // if i is a prime
                p[i*j] = false;             // the other multiples of i is not a prime
        }
    }
    else{
        p[0] = false;
        p[1] = false;
        p[2] = true;
    }
}

int main(){
    int n;
    bool p[1000000];
    for(int i=0; i<1000000; i++)
        p[i] = true;
    setPrimesUnder(1000000, p);
    
    while(std::cin >> n){
        int count = 0;
        for(int i=0; i<=n; i++){
            if(p[i])
                count++;
        }
        std::cout << count << std::endl;
    }
    return 0;
}

Measured memory_bytes: 2132
#include "math.h"
#include <set>
#include <algorithm>
#include <complex>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
using namespace std;
typedef long long int lli;
int main()
{
    int n;
    string s;
    cin >> n;
    cin >> s;
    //(をなるべくひだり,)をなるべく右
    string ans = s;
    int l{}, r{}, cnt{};
    rep(i, n)
    {
        if (s[i] == '(')
            l++;
        else
            r++;
    }
    if (l > r) {
        rep(i, l - r)
            ans
            += ")";
    } else {
        rep(i, r - l)
        {
            ans = "(" + ans;
        }
    }
    s = ans;
    l = 0, r = 0;
    rep(i, s.size())
    {
        if (s[i] == '(')
            l++;
        else
            r++;
        if (l + cnt < r) {
            ans = "(" + ans;
            cnt++;
        }
    }
    rep(i, l + cnt - r)
    {
        ans += ")";
    }

    cout << ans << endl;
}


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

int main() {
  int N;
  cin >> N;
  int n = 1000000000;
  
  
  for (int i = 0; i < N; i++){
  	int A;
    cin >> A;
    
    int a = 0;
    
    while ( A%2 == 0){
    	a ++;
    	A /= 2;
    }
    
    if (n > a){
    	n = a;
    }
  }
  
  cout << n;

}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define f(i,a,n) for(int i=a;i<n;i++)
#define ve vector
#define ss second 
#define ff first
#define pf pop_front
#define pob pop_back
#define psf push_front
#define res(x) cout<<x<<'\n'
#define read(t) ll t;cin>>t

int main(){

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	cout.tie(NULL);

   int a[32]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
   int t;
   cin>>t;
   cout<<a[t-1]<<endl;

    
    
    


   

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define FOR(i, a, b) for(ll i = (ll)a; i <= (ll)b; i++)
#define DEC(i, a, b) for(ll i = (ll)a; i >= (ll)b; i--)
typedef pair<ll, ll> pi;
typedef pair<pi, ll> pii;
#define f first
#define s second
#define pb push_back
#define all(v) v.begin(), v.end()
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)

ll n, a, b, c;
string moves[100005];
string str;
vector<string> ans;

void fail() {
	cout << "No";
	exit(0);
}

void f(string s, int x) {
	if (x == 1) {
		if (s == "AB") {
			a++, b--;
			ans.pb("A\n");
		} else if (s == "AC") {
			a++, c--;
			ans.pb("A\n");
		}
	} else if (x == 2) {
		if (s == "AB") {
			b++, a--;
			ans.pb("B\n");
		} else if (s == "BC") {
			b++, c--;
			ans.pb("B\n");
		}
	} else {
		if (s == "AC") {
			c++, a--;
			ans.pb("C\n");
		} else if (s == "BC") {
			c++, b--;
			ans.pb("C\n");
		}
	}
}

int main() {
	fastio; cin >> n >> a >> b >> c;
	FOR(i, 1, n) cin >> moves[i];
	FOR(i, 1, n) {
		if (moves[i] == "AB") {
			if (i != n and moves[i+1] != moves[i]) {
				if (moves[i+1] == "AC") {
					if (c == 0 and b) f(moves[i], 1);
					else if (a) f(moves[i], 2);
					else if (b) f(moves[i], 1);
					else fail();
				} else if (moves[i+1] == "BC") {
					if (c == 0 and a) f(moves[i], 2);
					else if (a) f(moves[i], 2);
					else if (b) f(moves[i], 1);
					else fail();
				}
			} else {
				if (a) f(moves[i], 2);
				else if (b) f(moves[i], 1);
				else fail();
			}
		} else if (moves[i] == "AC") {
			if (i != n and moves[i+1] != moves[i]) {
				if (moves[i+1] == "AB") {
					if (b == 0 and c) f(moves[i], 1);
					else if (a) f(moves[i], 3);
					else if (c) f(moves[i], 1);
					else fail();
				} else if (moves[i+1] == "BC") {
					if (b == 0 and a) f(moves[i], 3);
					else if (a) f(moves[i], 3);
					else if (c) f(moves[i], 1);
					else fail();
				}
			} else {
				if (a) f(moves[i], 3);
				else if (c) f(moves[i], 1);
				else fail();
			}
		} else if (moves[i] == "BC") {
			if (i != n and moves[i+1] != moves[i]) {
				if (moves[i+1] == "AB") {
					if (a == 0 and c) f(moves[i], 2);
					else if (b) f(moves[i], 3);
					else if (c) f(moves[i], 2);
					else fail();
				} else if (moves[i+1] == "AC") {
					if (a == 0 and b) f(moves[i], 3);
					else if (b) f(moves[i], 3);
					else if (c) f(moves[i], 2);
					else fail();
				}
			} else {
				if (b) f(moves[i], 3);
				else if (c) f(moves[i], 2);
				else fail();
			}
		}
	}
	
	cout << "Yes\n";
	for (auto it:ans) cout << it;
}


Measured memory_bytes: 10540
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())
#define ll long long
#define pb(a) push_back(a)
#define INF 1000000000
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

typedef vector<unsigned int>vec;
typedef vector<vec> mat;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline void add(T &a, T b){a = ((a+b) % MOD + MOD) % MOD;};

const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

struct Edge{int to,weight; Edge(int t, int w) : to(t), weight(w) {}};
using DirectedGraph = vector<vector<Edge>>;
using UndirectedGraph = vector<vector<int>>;

int H,W;
char field[51][51];
bool seen[51][51];

void dfs(int h,int w){
    if(seen[h][w]) return;

    seen[h][w] = true;

    REP(i,8){
        int nh=h+dy[i];
        int nw=w+dx[i];

        if(nh<0 || nh>=H || nw<0 || nw>=W || field[nh][nw]=='0') continue;
        dfs(nh,nw);
    }
    return;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    while(1){
        cin>>W>>H;
        if(!H && !W) return 0;
        REP(i,H) REP(j,W) cin>>field[i][j];
        
        memset(seen,0,sizeof(seen));

        int ans=0;
        REP(i,H) REP(j,W){
            if(field[i][j]=='1' && !seen[i][j]){
                //cout<<i<<":"<<j<<endl;
                dfs(i,j);
                ans++;
            }
        }

        cout<<ans<<endl;
    }
}



Measured memory_bytes: 3252
#include <stdio.h>
main(){
  int H,W,i,j,k;
  while(1){
    scanf("%d %d",&H,&W);
    if(H==0 && W==0)break;
    for(i=0;i<W;i++){
      printf("%c",'#');
    }
    printf("\n");
    for(i=1;i<H-1;i++){
      for(j=0;j<W;j++){
	if(j==0 || j==W-1){
	  printf("#");
	}
	else{
	  printf(".");
	}
      }
      printf("\n");
    }
    for(i=0;i<W;i++){
      printf("#");
    }
    printf("\n");
    printf("\n");
  }
  return 0;
}

Measured memory_bytes: 572
//Don't have to see. start------------------------------------------
var read = require('readline').createInterface({
  input: process.stdin, output: process.stdout
});
var obj; var inLine = [];
read.on('line', function(input){inLine.push(input);});
read.on('close', function(){
  obj = init(inLine);
  console.error('\n');
  var start = Date.now();
  Main();
  var end = Date.now() - start;
  myerr('time : ' + end + 'ms');
  myerr('memory : ' + Math.round(process.memoryUsage().heapTotal / 1024) + 'KB');
});
function makeClone(obj){return (obj instanceof Set) ? new Set(Array.from(obj)) : JSON.parse(JSON.stringify(obj));}
function nextInt(){return myconv(next(),1);} function nextStrArray(){return myconv(next(),2);}
function nextIntArray(){return myconv(next(),4);} function nextCharArray(){return myconv(next(),6);}
function next(){return obj.next();} function hasNext(){return obj.hasNext();}
function init(input){  
  return {
    list : input, index : 0, max : input.length,
    hasNext : function(){return (this.index < this.max);},
    next : function(){if(this.hasNext()){return this.list[this.index++];}else{throw 'ArrayIndexOutOfBoundsException ‚There is no more input';}}
  };
}
function myout(s){console.log(s);}
function myerr(s){console.error('debug:' + require('util').inspect(s,false,null));}
//param "no" is
//unknown or outlier : return i. 1: parseInt.
//2: split space. 4: split space and parseInt.
//6: split 1 character. 7: split 1 character and parseInt.
//8: join space. 9: join nextline. 0: join no character.
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(' ');case 4:return i.split(' ').map(Number);case 6:return i.split('');case 7:return i.split('').map(Number);case 8:return i.join(' ');case 9:return i.join('\n');case 0:return i.join('');default:return i;}}catch(e){return i;}}

//Don't have to see. end------------------------------------------
function Main(){
  var map = {
  	"SUN" : 7,
  	"MON" : 6,
  	"TUE" : 5,
  	"WED" : 4,
  	"THU" : 3,
  	"FRI" : 2,
  	"SAT" : 1
  };
  var s = next();
  myout(map[s]);
}

Measured memory_bytes: 31108
#include <bits/stdc++.h>
#define clr(x) memset(x,0,sizeof x)
#define For(i,a,b) for (int i=(a);i<=(b);i++)
#define Fod(i,b,a) for (int i=(b);i>=(a);i--)
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define fi first
#define se second
#define outval(x) cerr<<#x" = "<<x<<endl
#define outtag(x) cerr<<"-----------------"#x"-----------------\n"
#define outarr(a,L,R) cerr<<#a"["<<L<<".."<<R<<"] = ";\
                    For(_x,L,R) cerr<<a[_x]<<" ";cerr<<endl;
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef pair <int,int> pii;
LL read(){
    LL x=0,f=0;
    char ch=getchar();
    while (!isdigit(ch))
        f=ch=='-',ch=getchar();
    while (isdigit(ch))
        x=(x<<1)+(x<<3)+(ch^48),ch=getchar();
    return f?-x:x;
}
const int N=1005,INF=2e9;
const LL LLINF=1e18;

int n;
struct Node{
	int c,x,y;
}a[N],b[N];
namespace flows{//maxcost
	const int N=1005*((4+1)*2),M=N*2*2;
	struct Edge{
		int x,y,nxt,cap;
		LL cost;
		Edge(){}
		Edge(int _x,int _y,int _nxt,int _cap,LL _cost){
			x=_x,y=_y,nxt=_nxt,cap=_cap,cost=_cost;
		}
	}e[M];
	int fst[N],vis[N],cnt,cur[N];
	int n,S,T;
	void clear(int _n,int _S,int _T){
		n=_n,S=_S,T=_T;
		cnt=1,clr(fst);
	}
	void Add(int x,int y,int cap,LL cost){
		e[++cnt]=Edge(x,y,fst[x],cap,cost),fst[x]=cnt;
		e[++cnt]=Edge(y,x,fst[y],0,-cost),fst[y]=cnt;
	}
	LL dis[N];
	int bfs(){
		static queue <int> q;
		while (!q.empty())
			q.pop();
		For(i,1,n)
			dis[i]=-LLINF;
		dis[S]=0,q.push(S);
		clr(vis);
		while (!q.empty()){
			int x=q.front();
			q.pop();
			vis[x]=0;
			for (int i=fst[x];i;i=e[i].nxt){
				int y=e[i].y;
				if (e[i].cap&&dis[x]+e[i].cost>dis[y]){
					dis[y]=dis[x]+e[i].cost;
					if (!vis[y]){
						vis[y]=1;
						q.push(y);
					}
				}
			}
		}
		return dis[T]>-LLINF;
	}
	int dfs(int x,int Lim){
		if (x==T||!Lim)
			return Lim;
		int rem=Lim;
		vis[x]=1;
		for (int &i=cur[x];i;i=e[i].nxt){
			int y=e[i].y;
			if (e[i].cap&&!vis[e[i].y]&&dis[x]+e[i].cost==dis[y]){
				int d=dfs(y,min(rem,e[i].cap));
				rem-=d,e[i].cap-=d,e[i^1].cap+=d;
			}
		}
		vis[x]=0;
		return Lim-rem;
	}
	LL Dinic(){
		LL cost=0;
		while (bfs()){
			clr(vis);
			For(i,1,n)
				cur[i]=fst[i];
			int d=dfs(S,INF);
			cost+=dis[T]*d;
		}
		return cost;
	}
}
int main(){
	n=read();
	int s=0;
	For(i,1,n)
		a[i].x=read(),a[i].y=read(),a[i].c=read(),s+=a[i].c;
	For(i,1,n)
		b[i].x=read(),b[i].y=read(),b[i].c=read();
	int S=n*5*2+4+1,T=S+1;
	flows::clear(T,S,T);
	For(i,1,n){
		flows::Add(S,i,a[i].c,0);
		flows::Add(i+n*5,T,b[i].c,0);
		For(j,0,3){
			int av=(j&1?a[i].x:-a[i].x)+(j&2?a[i].y:-a[i].y);
			int bv=(j&1?b[i].x:-b[i].x)+(j&2?b[i].y:-b[i].y);
			flows::Add(i,i+n*(j+1),10,0);
			flows::Add(i+n*(j+1),n*10+j+1,10,(LL)av-INF);
			flows::Add(i+n*(j+6),i+n*5,10,0);
			flows::Add(n*10+(j^3)+1,i+n*(j+6),10,(LL)bv-INF);
		}
	}
	LL res=flows::Dinic()+(LL)INF*s*2;
	cout<<res<<endl;
	return 0;
}

Measured memory_bytes: 1280
v[]={0,4,2,5,0,5,2,4,0,3,2,1,0,1,2,3,4,3,5,1,1,5,3,4};main(n,c,i,j,s){while(scanf("%d",&n)&&n){int d[]={1,3,6,4,2,5};for(s=1;n--&&scanf(" %s",&c);){c&=255;i=c-78?c-83?c-69?c-87?c-76?20:16:12:8:4:0;c=d[v[i]];for(;++i&3;)d[v[i-1]]=d[v[i]];d[v[i-1]]=c;s+=*d;}printf("%d\n",s);}}

Measured memory_bytes: 0
#include <iostream>

using namespace std;

int main() {
    int n, m, c, *b, **a;
    cin >> n >> m >> c;
    b = new int[m];
    for (int i = 0; i < m; i++)
        cin >> b[i];
    a = new int*[n];
    for (int i = 0; i < n; i++)
        a[i] = new int[m];
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            cin >> a[i][j];
        }
    }

    int ans = 0;
    for (int i = 0; i < n; i++) {
        int sum = 0;
        for (int j = 0; j < m; j++)
            sum += b[j]*a[i][j];
        if (sum + c > 0)
            ans++;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
  int n , ans= 0;
  scanf("%d",&n);
  int s = n;
  
  while(1){
    ans +=s%10;
    int temp = s;
    s = temp/10;
    if(s==0){
      break;
    }
  }
  if(n%ans==0){
    printf("Yes");
  }
  else{
    printf("No");
  }
  return 0;
}

   

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(),v.end()
#define puts(i) cout << i << endl
#define INF INT_MAX;
#define INFL LLONG_MAX;
typedef long long ll;
using namespace std;
int main(){

int X;

cin >> X;

if(X>=30){
  cout << "Yes" << endl;
}

else{
  cout << "No" << endl;
}

}


Measured memory_bytes: 3628
import bisect
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
ans = 0
A.sort()
C.sort()
for i in B:
    x = bisect.bisect_left(A,i)
    y = N-bisect.bisect_right(C,i)
    ans += x*y
print(ans)


Measured memory_bytes: 23232
// Author : Syed Mujtaba
// Seek knowledge from the Cradle to the Grave !!
// https://www.linkedin.com/in/syed-mujtaba

#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp> 
// #include <ext/pb_ds/tree_policy.hpp> 
// using namespace __gnu_pbds;
using namespace std;
#define int             long long
#define ld              long double
#define ll              long long
#define pb              push_back
#define fi              first
#define se              second
// #define mod             1000000007  //998244353// 1e9 + 7
int mod = 1e9;
int modd = 1e9;
#define inf             1000000007 // 1e9 + 7
#define MAX             8000000000000000064LL
#define MIN            -8000000000000000064LL
#define MAXN 			10000004
#define mt 				make_tuple
#define eps             1e-6
#define endl			'\n'
#define test            int t; cin>>t; while(t--)
#define fast_io         ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
// #define tree            tree <int, null_type, less <int>, rb_tree_tag, tree_order_statistics_node_update>
// int fact[1000007]={0};
// int spf[(int)(1e7) + 20];
// bool prime[(int)((1e7) + 20)];
// int gcd(int a,int b){if(b==0)return a; return gcd(b,a%b);}
// void sp(int n){spf[1]=1;for(int i=2;i<n;i++)spf[i]=i;for(int i=4;i<n;i+=2)spf[i]=2;for(int i=3;i*i<n;i++){if(spf[i]==i){for(int j=i*i;j<n;j+=i)if(spf[j]==j)spf[j]=i;}}}
// void sieve(int n){memset(prime,true,sizeof(prime) );for(int p=2;p*p<=n;p++){if(prime[p]==true)for(int i=p*p;i<=n;i+=p)prime[i]=false;}prime[0]=false;prime[1]=false;}
// int xyp(int x,int y){int res=1;while(y>0){if(y%2==1) res=(res*x)%mod;x=(x*x)%mod;y/=2;}return res%mod;}
// int inv(int x){return xyp(x,mod - 2);}
// int inv_euclid(int a, int m = mod){int m0 = m;int y = 0, x = 1;if (m == 1)return 0;while (a > 1){int q = a / m;int t = m;m = a % m, a = t;t = y;y = x - q * y;x = t;}if (x < 0)x += m0;return x;}
// void init() {fact[0]=1;fact[1]=1;for(int i=2;i<1000007;i++)fact[i]=(fact[i-1]*i)%mod;}
// int ncr(int n,int r) {int res=1; res=fact[n]; res=(res*(xyp(fact[r],mod-2)))%mod; res=(res*(xyp(fact[n-r],mod-2)))%mod; return res;}
// int npr(int n,int r) {int res=1; res=fact[n]; res=(res*(xyp(fact[n-r],mod-2)))%mod; return res; }
// bool isp(int a){if(a == 2)return true;if(a == 1)return false;for(int x= 2; x <= sqrt(a) + 1; x++)if(a % x == 0)return false;return true;}
// int add(int a, int b){return (a%mod + b%mod + mod)%mod;}
// int sub(int a, int b){return (a%mod - b%mod + mod)%mod;}
// int mul(int a, int b){return ((a%mod)*(b%mod) + mod)%mod;}
// #define p_set tree< pair<int,int> ,  null_type ,  less<pair<int,int>> ,  rb_tree_tag ,  tree_order_statistics_node_update>
// #define i_set tree< int ,  null_type ,  less< int > ,  rb_tree_tag ,  tree_order_statistics_node_update>
// freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
// mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
// int dx[] = {1, -1, 0};
// int dy[] = {1, -1, 0};
signed main()
{
	fast_io
	int n, m;
	cin >> n >> m;
	int su = 0;
	int x;
	while(m--)
	{
		cin >> x;
		su += x;
	}
	if(su <= n)cout << n - su << endl;
	else cout << -1 << endl;
}

Measured memory_bytes: 3692
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;
int main(){
    ll n,A[200000];
    cin>>n;
    rep(i,n) cin>>A[i];
    int z=1;
    if(n%3){
        sort(A,A+n);
        if(A[0]!=A[n-1]) z=0;
    }
    else{
        z=0;
        sort(A,A+n);
        if(A[0]==A[n/3-1]&&A[n/3]==A[2*n/3-1]&&A[2*n/3]==A[n-1]){
            if(A[0]==(A[n/3]^A[2*n/3])&&A[n/3]==(A[0]^A[2*n/3])&&A[2*n/3]==(A[0]^A[n/3])) z=1;
        }
    }
    if(z) cout<<"Yes";
    else cout<<"No";
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; i++)
#define vv(T) vector<vector<T>>
using namespace std;
using ll = long long;
using vint = vector<int>;
using vvint = vector<vector<int>>;
using vll = vector<long long>;
using vvll = vector<vector<long long>>;
using vbool = vector<bool>;
using vvbool = vector<vector<bool>>;
using qint = queue<int>;
using sint = stack<int>;
using pii = pair<int, int>;


int main(){
    long long a, b, c, d;
    cin >> a >> b >> c >> d;

    long long ans = 0;
    // if(b < 0){
    //     // if(c < 0){
    //         // ans = a * c;
    //     // }
    //     ans = a * c;
    // }

    ll a1, a2, a3, a4;
    a1 = a * c;
    a2 = a * d;
    a3 = b * c;
    a4 = b * d;
    ans = max(a1, max(a2, max(a3, a4)));

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


Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  cin>>n;
  string s;
  cin>>s;
  int f=0;
  if(n%2!=0)
    f=1;
  else
  {
    int j=0;
    
    int l=n/2;
    for(int i=l;i<n;i++)
    {
      if(s[j]!=s[i])
      {
        f=1;
        break;
      }
      else{
      j++;
    }
    }
   

  }
   if(f)
      cout<<"No"<<endl;
    else
      cout<<"Yes"<<endl;
}


Measured memory_bytes: 256
dogs, monkeys = gets.split.map(&:to_i)
mod = 1e9 + 7
tmp = 1

case (dogs - monkeys).abs
when 0
  1.upto(dogs) do |x|
    tmp = (x * tmp) % mod
  end

  1.upto(monkeys) do |x|
    tmp = (x * tmp) % mod
  end

  puts(((2 * tmp) % mod).floor)

when 1
  1.upto(dogs) do |x|
    tmp = (x * tmp) % mod
  end

  1.upto(monkeys) do |x|
    tmp = (x * tmp) % mod
  end

  puts tmp.floor
else
  puts 0
end

Measured memory_bytes: 1916
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double D;
typedef pair<ll,ll> P;
#define M 1000000007
#define F first
#define S second
#define PB push_back
#define INF 100000000000000000
ll a,b,c;
int main(void){
    cin>>a>>b>>c;
    if(a==b&&b==c)cout<<"Yes\n";
    else cout<<"No\n";
    
}


Measured memory_bytes: 764
#include <bits/stdc++.h> 
using namespace std;
void fast()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
} 
long long int printDivisors(long long int n,long long int k) 
{ 
    // Note that this loop runs till square root 
    long long int ans=1,i,j,l;
    l=sqrt(n);
    j=min(l,k);
    for ( i=2;i<=j;i++) 
    { 
        if (n%i == 0) 
        { 
           ans=max(ans,i);
           if(n/i<=k)
            ans=max(ans,n/i); 
        } 
    }
    return ans; 
}



 
int main() 
    {
            fast();
            long long int a=0,b=0,c=0,d=0,e=0,f=0,t,type,sum1=0,sum2=0,sum=0,flag=0,mini=0,pos=0,add=0,count=0,a1=0,b1=0,c1=0,end=0,index=0;
            long long int n,h,m,i,j,g,p,q,l,u,v,w,k,x,y,z,x1,x2,y1,y2,gcdc,centre=0,maxi=0,med=0,start=0,ans=0,mid=0,lo=0,hi=0,rem=0,one;
            string s,s1,s2,s3,s4,s5,s6,s7,s8,s9,ss;
            //double e=0,f,tot,fav,ans=1,sum1=0,sum2=0;
            //int a=0,b=0,c=0,d=0;
            long double xx,yy,r;
            //cin>>t;
            //while(t--)
            {
                cin>>n>>k;
                //vector<long long int> ar;
                //a.push_back(0);
                //pair<char ,long long int > a[n];
                //long long int a[n+1];
                cout<<n*k<<endl;

            }
                        

            
                
                
                


            

              return 0;
    }


Measured memory_bytes: 3676
#include <bits/stdc++.h>
#include <cmath>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REP1(i,n) for(int i = 1; i < n+1 ;i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))
using namespace std;
typedef long long ll;

int main(){
  int N;
  cin >> N;
  int i, cp = 0, cw = 0, cg = 0, cy = 0;
  for (i = 0; i < N; i++) {
    string arare;
    cin >> arare;
    if (arare == "P") {
      cp += 1;
    }
    else if (arare == "W") {
      cw += 1;
    }
    else if (arare == "G") {
      cg += 1;
    }
    else if (arare == "Y") {
      cy += 1;
    }
    else {
      cout << "error" << endl;
      break;
    }
  }

  if (cp != 0 && cw != 0 && cg != 0 && cy !=0) {
    cout << "Four" << endl;
  }else{
    cout << "Three" << endl;
  }

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0; i<(n); i++)
#define all(n) begin(n),end(n)
using ll = long long;
using P = pair<int,int>;

int main() {
    long double a, b, c;
    cin >> a >> b >> c;
    if(4*a*b < pow((c-a-b),2.0) && (c-a-b)>0){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <stdlib.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> P;
typedef priority_queue<P,vector<P>,greater<P>> P_queue;

const ll MOD=998244353;
const ll mod=1000000007;
const ll INF=1e15;
const double PI=3.1415926535897932;
vec dx={1,0,-1,0};
vec dy={0,1,0,-1};

#define REP(i,a,b) for(int i=(int)a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define mp make_pair
#define ALL(a) a.begin(),a.end()
#define SORT(a) sort(ALL(a))
#define U_ERASE(V) V.erase(unique(ALL(V)), V.end());
#define ADD(a,b) a=(a+b)%mod

ll ans[60][3];
int main(){
    ll L; cin>>L;
    ll N=0;
    ll X=1;
    while(true){
        if(X>L) break;
        X*=2; N++;
    }
    ll i=0;
    cout<<N<<' ';
    while(true){
        if(L==1) break;
        if(L%2) {
            ans[i][0]=1;
            ans[i][1]=N;
            ans[i][2]=L-1;
            L--; i++;
        }
        else{
            ll K=L/2;
            ans[i][0]=N-1;
            ans[i][1]=N;
            ans[i][2]=K;
            i++;
            ans[i][0]=N-1;
            ans[i][1]=N;
            ans[i][2]=0;
            N--; L=K; i++;
        }
    }
    cout<<i<<endl;
    rep(j,i) cout<<ans[j][0]<<' '<<ans[j][1]<<' '<<ans[j][2]<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define EPS (1e-9)
#define INF (1e17)
#define PI (acos(-1))
//const double PI = acos(-1);
//const double EPS = 1e-15;
//long long INF=(long long)1E17;
#define i_7 (long long)(1e9+7)
//#define i_7 998'244'353
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
using namespace std;

bool prime_(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}

long long gcd_(long long a, long long b){
  if(a<b){
    swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd_(b,a%b);
  }
}
 
long long lcm_(long long x, long long y){
  return (x/gcd_(x,y))*y;
}


int main(){
  
  int a,b,c,d;
  cin>>a>>b;
  cin>>c>>d;
  if(a==c){
    cout<<0<<endl;
  }else{
    cout<<1<<endl;
  }
  return 0; 
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin >> n;
    vector<long long> a(n);
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
    }
    vector<long long> L(n), R(n);
    for (int i = 0; i < n - 1; i++)
    {
        L[i + 1] = __gcd(L[i], a[i]);
    }
    for (int i = n - 1; i >= 1; i--)
    {
        R[i - 1] = __gcd(R[i], a[i]);
    }
    long long ans = -1;
    for (int i = 0; i < n; i++)
    {
        ans = max(ans, __gcd(L[i], R[i]));
    }
    cout<<ans<<endl;
}

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

int n;

void dfs(string s,char a){
  if(s.size()==n){
    cout << s << endl;
    return;
  }
  for(char now='a';now<=a+1;++now){
    if(now<a){
      dfs(s+now,a);
    }else{
      dfs(s+now,now);
    }
  }
}

int main(){
  cin >> n;
  dfs("",'a'-1);
  return 0;
}


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

int main(){
	int a, b, sum = 0;
	double c;
	cin >> a >> b >> c;
	c += 0.5;
	for(int i = a; i < c; i += a){
		sum += b;
	}
	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<queue>
#include<deque>
#include<map>
#include<bitset>
using namespace std;
typedef long long ll;

#define rep(i, n) for(int i = 0;i < (n);i++)
#define repr(i, n) for(int i = (n);i >= 0;i--)
#define repf(i, m, n) for(int i = (m);i < (n);i++)

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1;} return 0;}
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1;} return 0;}
int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};
//////////////////////////////////////////////////

ll dp[3010][3010];

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

    memset(dp, 0, sizeof(dp));
    string ans = "";

    rep(i,s.size()) rep(j,t.size()) {
        if (s[i] == t[j]) {
            chmax(dp[i+1][j+1], dp[i][j]+1);
        }
        chmax(dp[i+1][j+1], dp[i+1][j]);
        chmax(dp[i+1][j+1], dp[i][j+1]);
    }
    
    int i = s.size(), j = t.size();
    while (i > 0 && j > 0) {
        if (dp[i][j] == dp[i-1][j]) i--;
        else if (dp[i][j] == dp[i][j-1]) j--;
        else {
            ans = s[i-1]+ans;
            i--; j--;
        }
    }

    cout << ans << endl;

    return 0;
}

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

public class Main {
	public static void main(String[] args) throws IOException{
		Sequence solver = new Sequence();
		solver.readInput();
		solver.solve();
		solver.writeOutput();
	}


	static class Sequence {
		private int n;
		private long a[];

		private long output;
		private Scanner scanner;

		public Sequence() {
			this.scanner = new Scanner(System.in);
		}

		public void readInput() {
			n = Integer.parseInt(scanner.next());
			a = new long[n];
			for(int i=0; i<n; i++) {
				a[i] = Integer.parseInt(scanner.next());
			}
		}

		private int count(int sign) {
			int count=0;
			long sum=0;
			for(int i=0; i<n; i++) {
				sum += a[i];
				if(i%2==sign) {
					// a[i]までの合計を正にするとき
					if(sum<=0) {
						count += 1-sum;
						sum = 1;
					}
				} else {
					// a[i]までの合計を負にするとき
					if(0<=sum) {
						count += 1+sum;
						sum = -1;
					}
				}
			}
			return count;
		}

		public void solve() {
			long sum1 = 0;
			long count1 = 0;
			long sum2 = 0;
			long count2 = 0;
			for (int i = 0; i < n; i++) {
			    sum1 += a[i];
			    sum2 += a[i];
			    if (i % 2 == 1) {
			        if (sum1 <= 0) {
			            count1 += 1 - sum1;
			            sum1 = 1;
			        }
			        if (sum2 >= 0) {
			            count2 += sum2 + 1;
			            sum2 = -1;
			        }
			    } else {
			        if (sum2 <= 0) {
			            count2 += 1 - sum2;
			            sum2 = 1;
			        }
			        if (sum1 >= 0) {
			            count1 += sum1 + 1;
			            sum1 = -1;
			        }
			    }
			}
			output = Math.min(count1,count2);
		}


		public void writeOutput() {
			System.out.println(output);
		}
	}

}

Measured memory_bytes: 49020
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define ll long long
#define P pair<ll,ll>
#define all(v) (v).begin(),(v).end()

const ll mod = 1e9+7;
const ll INF = 1e18;
const double pi = acos(-1);


int main(void)
{
    ll n,next=1,ans=0; cin>>n;
    vector<ll> a(n);
    rep(i,n) cin>>a[i];
    rep(i,n){
        if(next==a[i]) next++;
        else ans++;
    }
    if(ans==n) cout<<-1<<endl;
    else cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 4824
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        n: usize,
        h: [usize; n],
    }
    let mut max = h[0];
    for i in 1..n {
        if h[i] < h[i - 1] {
            if max > h[i] + 1 {
                println!("No");
                return;
            }
        }
        if h[i] > max {
            max = h[i];
        }
    }
    println!("Yes");
}


Measured memory_bytes: 4352
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
template <class T>
inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}

typedef long long ll;

int main() {
  ll N, M;
  cin >> N >> M;
  vector<vector<ll> > edges(N, vector<ll>(N, 1001));
  vector<ll> costs(M);
  vector<ll> B(M);
  vector<ll> A(M);
  for (ll i = 0; i < M; i++) {
    ll a, b, c;
    cin >> a >> b >> c;
    edges[a-1][b-1] = min(edges[a-1][b-1], c);
    edges[b-1][a-1] = min(edges[b-1][a-1], c);
    edges[a-1][a-1] = 0;
    edges[b-1][b-1] = 0;

    A[i] = a - 1;
    B[i] = b - 1;
    costs[i] = c;
  }
  // warshal floyd
  for (ll k = 0; k < N; k++) {
    // 始点
    for (ll i = 0; i < N; i++) {
      // 終点
      for (ll j = 0; j < N; j++) {
        edges[i][j] = min(edges[i][j], edges[i][k] + edges[k][j]);
      }
    }
  }
  ll ans = 0;
  for (ll i = 0; i < M; i++) {
    ll a = A[i];
    ll b = B[i];
    if (edges[a][b] < costs[i]) {
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}


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

int main() {
  int n,k,x,y;
  cin >> n >> k >> x >> y;
  if(n<=k){
    cout << n*x << endl;
  }
  else {
    cout << k*x + (n-k)*y << endl;
  }
  
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,i,a[100001],b[100001],c[100001],res[100001][4];
int main(){
	cin>>n;
	for(i=1;i<=n;i++)scanf("%d%d%d",&a[i],&b[i],&c[i]);
	res[1][1]=a[1];
	res[1][2]=b[1];
	res[1][3]=c[1];
	for(i=2;i<=n;i++){
		res[i][1]=max(res[i-1][2],res[i-1][3])+a[i];
		res[i][2]=max(res[i-1][1],res[i-1][3])+b[i];
		res[i][3]=max(res[i-1][2],res[i-1][1])+c[i];
	}
	cout<<max(res[n][1],max(res[n][2],res[n][3]));
}

Measured memory_bytes: 2944
import java.util.*;


public class Main {

    public static void main(String[] args) {
      Scanner sc = new Scanner(System.in);
      String day = sc.nextLine();
      int output = 0;
        switch(day){
          case "SUN":
            output = 7;
            break;
          case "MON":
            output = 6;
            break;
          case "TUE":
            output = 5;
            break;
          case "WED":
            output = 4;
            break;
          case "THU":
            output = 3;
            break;
          case "FRI":
            output = 2;
            break;
          case "SAT":
            output = 1;
            break;
          default:
            break;
    	}
    System.out.println(output);
    }
}

Measured memory_bytes: 21588
#include <iostream>
#include<stdio.h>
#include<stdlib.h>
#include<vector>
#include<algorithm>
#include<math.h>
#include<tuple>
#include<bitset>

#define MOD 1000000007
using namespace std;

int main()
{
	int N, M; cin >> N >> M;
	vector<vector<int>> s(M);

	for (int i = 0; i < M; i++)
	{
		int k;
		cin >> k;
		for (int j = 0; j < k; j++)
		{
			int tmp;
			cin >> tmp;
			s[i].push_back(tmp);	//つながっているスイッチを表す配列
		}
	}

	vector<int> p(M);
	for (int i = 0; i < M; i++)
	{
		cin >> p[i];	//スイッチがonになる条件
	}
	int ans = 0;
	for (int i = 0; i < pow(2,N); i++)
	{
		bitset<10> b(i);
		for (int j = 0; j < M; j++)	//つくか調べる電球
		{
			int count = 0;	//ついてるスイッチの数
			for (int k = 0; k < s[j].size(); k++)	//つながっているスイッチを検証
			{
				if (b[(s[j][k]-1)] == 1)	count++;
			}
			//cout <<b<<"のとき、" <<j<<"番目の電球に："<<count <<"あまりは："<<p[j]<< endl;
			if (count % 2 != p[j])	break;	//電球がつかないとき
			if(j==M-1)	ans++;	//電球が全部ついたとき
		}
	}

	cout << ans;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    int a,b,m,h;
    double pi=2*acos(0.0);
    double ans,x,y;
    cin>>a>>b>>h>>m;
    if(a<b)
        swap(a,b);
    double t;
    x=(h+(m/60.0))*30;
    y=m*6;
    if(x>=y)
        t=x-y;
    else{
        t=y-x;
    }
    if(t>180)
        t=360-t;
    //cout<<t<<endl;
    if(t>=0 && t<=180 ){
        ans= a*a+b*b-2*a*b*cos(t*pi/180);
        ans=sqrt(ans);
        cout<<fixed<<setprecision(12)<<ans;
    }
       return 0;
}


Measured memory_bytes: 4108
import itertools
import math

if __name__ == "__main__":
  N = int(input())
  
  points = []
  
  for _ in range(N):
    points.append(list(map(int, input().split())))
    
  sum_dist = 0

  for ord_ps in itertools.permutations(points, N):
    for i in range(N - 1):
      sum_dist += math.sqrt((ord_ps[i][0] - ord_ps[i + 1][0]) ** 2 + (ord_ps[i][1] - ord_ps[i + 1][1]) ** 2)
  
  print(sum_dist / math.factorial(N))


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


int main () {
	int n;
	scanf("%d", &n);
	char str[n + 1];
	scanf("%s", str);
	if (n % 2 == 1) {
		puts("No");
	}
	else {
		int flag = 1;
		for (int i = 0; i < n / 2; i++){
			if (str[i] != str[i + n / 2]){
				flag = 0;
			}
		}
		if ( flag){
			puts("Yes");
		}
		else {
			puts("No");
		}
	}
	return 0;
}

Measured memory_bytes: 1660
#include<bits/stdc++.h>
using namespace std;
const int N=100005;
int n,a[N];map<int,int>mp;
int main()
{
	scanf("%d",&n);int t=0;
	for(int i=1;i<=n;++i)scanf("%d",&a[i]),mp[a[i]]++,t^=a[i];
	if(mp[0]==n){puts("Yes");return 0;}
	if(n%3){puts("No");return 0;}
	if(t){puts("No");return 0;}
	sort(a+1,a+n+1);n/=3;t=a[1]^a[n+1]^a[n+n+1];
	for(int i=1;i<=n*3;++i)if(mp[a[i]]%n){puts("No");return 0;};
	if(mp[0]||!t){puts("Yes");return 0;}
	puts("No");return 0;
}

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

int main() {
  ll n, k;
  cin >> n >> k;
  ll a = n % k;
  cout << min(a, k-a) << endl;
}

Measured memory_bytes: 256
import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.stdio;
import std.string;
import std.range;

int readint() {
    return readln.chomp.to!int;
}

int[] readints() {
    return readln.split.map!(to!int).array;
}

void main() {
    int n;
    while ((n = readint()) > 0) {
        auto xs = new int[][](n + 1, n + 1);
        for (int i = 0; i < n; i++) {
            auto ys = readints();
            for (int j = 0; j < n; j++) {
                xs[i][j] = ys[j];
            }
        }

        // ?????????
        for (int c = 0; c < n; c++) {
            int sum = 0;
            for (int r = 0; r < n; r++) {
                sum += xs[r][c];
            }
            xs[n][c] = sum;
        }

        // ?¨???????
        for (int r = 0; r < n + 1; r++) {
            int sum = 0;
            for (int c = 0; c < n; c++) {
                sum += xs[r][c];
            }
            xs[r][n] = sum;
        }

        // ??????
        for (int r = 0; r < n + 1; r++) {
            for (int c = 0; c < n + 1; c++) {
                writef("%5d", xs[r][c]);
            }
            writeln();
        }
    }
}

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

using namespace std;

typedef long long LL;
typedef vector<int>    VI;
typedef vector<bool>   VB;
typedef vector<string> VS;

#define MP make_pair
#define PB push_back
#define ALL(x)  (x).begin(),(x).end()
#define rep(i, N)  for (int i = 0; i < (int)(N); i++)
#define REP(i, init, N)  for (int i = (init); i < (int)(N); i++)
#define DUMP( x ) cerr << #x << " = " << ( x ) << endl

int x, y, s;

int main(void) {
	while (1) {
		cin >> x >> y >> s;
		if (x == 0 && y == 0 && s == 0) break;
		int ans = -1;
		REP (i, 1, s) REP (j, 1, s) {
			int p1 = i * (100 + x) / 100.0;
			int p2 = j * (100 + x) / 100.0;
			int np1 = i * (100 + y) / 100.0;
			int np2= j * (100 + y) / 100.0;
			if (p1 + p2 == s && ans < np1 + np2) {
				ans = np1 + np2;
			}
		}
		cout << ans << endl;
	}
    return 0;
}

Measured memory_bytes: 3048
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define pi acos(-1.0)
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
 
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) c.begin(), c.end()
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

int main(){
    int h, w;
    cin >> h >> w;
    cout << string(w+2, '#') << endl;
    REP(i,h){
        string s;
        cin >> s;
        cout << "#" + s + "#" << endl;
    }
    cout << string(w+2, '#') << endl;

    return 0;
}

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

int main(void) {
	int x[5];
	int a;


	for (int i = 0; i < 5; i++) {
		cin >>x[i];
		if (x[i] == 0) {
			a = i+1;
		}
	}
	cout << a;
	return 0;
}

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

const ll logx=30;
const ll N=4e5+5;
const ll M=3e5+5;
const ll mod=1e9+7;
const ll INF=1e18+5;
const double PI = 3.14159265358979323846;

#define ints(n) scanf("%d",&n)
#define intp(n) printf("%d\n",n)
#define longs(n) scanf("%intd",&n)
#define longp(n) printf("%intd\n",n)

inline ll mul(ll a, ll b){ return (a * 1ll * b) % mod; }
inline ll sub(ll a, ll b){ ll c = a - b; if(c < 0) c += mod; return c; }
inline ll add(ll a, ll b){ ll c = a + b; if(c > mod) c -= mod; return c; }

#define f first
#define s second
#define pb(x) push_back(x)
#define pf(x) push_front(x)
#define mp(x,y) make_pair(x,y)
#define GCD(a,b) __gcd((a),(b))
#define all(v) v.begin(),v.end()
#define bits(x) __builtin_popcount(x)
#define LCM(a,b) ((a)*(b))/GCD((a),(b))
#define ms(dp,val) memset(dp,val,sizeof(dp))
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
template<typename T> T power(T x,T y,ll m){T ans=1;while(y>0){if(y&1LL) ans=(ans*x)%m;y>>=1ll;x=(x*x)%m;}return ans%m;}

#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl

ll f[20];

int main()
{
  ll n,l;
  cin>>n>>l;
  vector<string> v;
  for(ll i=0;i<n;i++)
  {
    string s;
    cin>>s;
    v.pb(s);
  }
  sort(all(v));
  for(auto i:v){cout<<i;}
}


Measured memory_bytes: 256
a,b,m=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
ans=min(a)+min(b)
for _ in range(m):
  x,y,c=map(int,input().split())
  tmp=a[x-1]+b[y-1]-c
  ans=min(ans,tmp)
print(ans)

Measured memory_bytes: 18736
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>

int main(int argc, char const* argv[])
{
  while (true) {
    int n;
    std::cin >> n;
    if (n == 0) {
      break;
    }
    std::vector<int> scores(n);
    for (int i = 0; i < n; ++i) {
      int s;
      std::cin >> s;
      scores[i] = s;
    }
    std::sort(scores.begin(), scores.end());
    scores.erase(scores.begin());
    scores.pop_back();
    int sum = std::accumulate(scores.begin(), scores.end(), 0);
    std::cout << (sum / (n - 2)) << std::endl;
  }
  return 0;
}

Measured memory_bytes: 1224
#include <iostream>

using namespace std;

int n, m, res;
int a[55559];
int b[55559];
int kq[59];

int main()
{
    for (int i = 2; i <= 55555; ++i)
        if (!a[i])
        {
            b[m] = i;
            ++m;
            for (int j = 2 * i; j <= 55555; j += i)
                a[j] = 1;
        }

    cin >> n;

    int j = 1;
    for (int i = 1; i <= n; ++i)
    {
        while (j < m)
            if (b[j] % 10 == 1)
            {
                kq[i] = b[j];
                ++j;
                break;
            }
            else
                ++j;
    }


    for (int i = 1; i < n; ++i)
        cout << kq[i] << " ";
    cout << kq[n] << endl;

    return 0;
}

Measured memory_bytes: 512
#include<iostream>
#include<string>
#include<cmath>
#include<iomanip>
using namespace std;
double PI = acos(-1);

int main(){
    double a, b, c, deg, rad;
    double area, circum, height;
    cin >> a >> b >> deg;
    rad = 2 * PI * deg / 360;
    c = sqrt(a * a + b * b - 2 * a * b * cos(rad));
    
    area = 0.5 * a * b * sin(rad);
    circum = a + b + c;
    height = b * sin(rad);

    cout << setprecision(10) << area << endl;
    cout << setprecision(10) << circum << endl;
    cout << setprecision(10) << height << endl;


    return 0;
}


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

int main() {
  int n, l;
  cin >> n >> l;
  vector<string> s(n);
  rep(i, n) cin >> s[i];
  sort(s.begin(), s.end());
  rep(i, n) cout << s[i];
  cout << endl;
  return 0;
}

Measured memory_bytes: 3624
def linearSearch(A, n, key):
	i = 0
	A.append(key)
	while (A[i] != key):
		i += 1
	del A[n]

	return i != n


if __name__ == '__main__':
	
	n = int(input())
	L = list(map(int, input().split()))

	q = int(input())
	Key = list(map(int, input().split()))

	cnt = 0
	for i in range(q):
		if (linearSearch(L, n, Key[i])):
			cnt += 1

	print(cnt)


Measured memory_bytes: 6552
import math
a = []
for i in range(5):
    a.append(int(input()))
sum = 0
r =10
for i in range(5):
  if a[i] % 10 ==0:
    sum+=a[i]
  elif a[i] % 10 !=0:
    r = min(r,a[i]%10)
    sum+= (10*math.ceil(a[i]/10))
print(sum-10+r)

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

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

	if((a-c)*(a-c)<=d*d){printf("Yes");}
	else if((a-b)*(a-b)<=d*d && (b-c)*(b-c)<=d*d){printf("Yes");}
	else{printf("No");}
		return 0;
}


Measured memory_bytes: 128
package main

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

// go run ./ABC168/C\ -\ \:\ \(Colon\)/main.go < ./ABC168/C\ -\ \:\ \(Colon\)/in

func main() {
	sc := bufio.NewScanner(os.Stdin)

	sc.Scan()
	inputs := strings.Split(sc.Text(), " ")
	houCM, _ := strconv.Atoi(inputs[0])
	minCM, _ := strconv.Atoi(inputs[1])
	min, _ := strconv.Atoi(inputs[3])
	hou, _ := strconv.Atoi(inputs[2])

	// 針の角度を計算
	angle := calcAngle(float64(hou), float64(min))
	cosAngle := math.Cos(angle * math.Pi / 180)

	ans := yogen(float64(houCM), float64(minCM), cosAngle)
	fmt.Println(ans)
}

func calcAngle(hou, min float64) float64 {
	// 時針 (1時間 30度) + (1分 0.5度)
	houAngle := (hou * 30) + (min * 0.5)
	// 分針 (1分 6度)
	minAngle := min * 6
	return math.Abs(minAngle - houAngle)
}

// 余弦定理
func yogen(houCM, minCM, cosAngle float64) float64 {
	ansans := houCM*houCM + minCM*minCM - 2*houCM*minCM*cosAngle
	return math.Sqrt(ansans)
}


Measured memory_bytes: 1756
#include "bits/stdc++.h"

using namespace std;

using ll = long long;
using ld = long double;

const int INF = (1 << 30) - 1;
const ll INF64 = ((ll)1 << 62) - 1;
const double PI = 3.1415926535897932384626433832795;

const int dx[] = { 0, 1, 0, -1 };
const int dy[] = { -1, 0, 1, 0 };

int gcd(int x, int y) { return y ? gcd(y, x % y) : x; }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
int lcm(int x, int y) { return x / gcd(x, y) * y; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }

char solve(string s, ll k) {
	int n = s.size();

	for (int i = 0; i < k; i++) {
		if (s[i] == '1') {
			continue;
		}

		return s[i];
	}

	return '1';
}

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

	string s;
	ll k;
	cin >> s >> k;

	char c = solve(s, k);
	cout << c << endl;
	return 0;
}


Measured memory_bytes: 256