akhauriyash/Code-Regression huggingface dataset:
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
using namespace std;
using ll = long long;
using VL=vector<ll>;

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
const long long INF =  999999999;

string s,t;
string dp[2][3010];
//dp[i][j]:=(s_1,...,s_iとt_1,...,t_jに対するLCSの長さ)

int main(){
  cin >> s>>t;
  dp[0][0]="";
  REP(i,s.length()){
    REP(j,t.length()){
      if(s[i]==t[j]){
        dp[(i+1)%2][j+1]=dp[i%2][j]+s[i];
      }
      else{
        if(dp[(i+1)%2][j].length()<=dp[i%2][j+1].length()){
          dp[(i+1)%2][j+1]=dp[i%2][j+1];
        }
        else{
          dp[(i+1)%2][j+1]=dp[(i+1)%2][j];
        }
      }
    }
  }
  cout <<dp[s.length()%2][t.length()]<<endl;
}


Measured memory_bytes: 16980
//"BISMILLAHIR RAHMANIR RAHIM"
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
const long long M = 1e8 ;
int main()
{
    ll n,x,t,ans;
    cin>>n>>x>>t;
    if(n%x==0)
      ans= (n/x)*t;
    else
      ans = ((n/x)+1)*t;
    cout<<ans<<endl;
    
    return 0;
}



Measured memory_bytes: 3628
n, w = map(int, input().split())

weight = []
value = []

for i in range(n):
    wi, vi = map(int, input().split())
    weight.append(wi)
    value.append(vi)

v_sum = sum(value)

dp = [[float('inf') for _ in range(v_sum+1)] for i in range(n)]

for i in range(n):
    if i == 0:
        dp[i][0] = 0
        dp[i][value[0]] = weight[0]
    else:
        for k in range(v_sum+1):
            if k < value[i]:
                dp[i][k] = dp[i-1][k]
            else:
                dp[i][k] = min(dp[i-1][k], dp[i-1][k-value[i]]+weight[i])

for i in range(v_sum, -1, -1):
    if dp[n-1][i] <= w:
        print(i)
        exit()


Measured memory_bytes: 314864
import numpy as np
def resolve():
    n, w = map(int, input().split())
    goods = np.array([list(map(int, input().split())) for _ in range(n)])
    
    # dpテーブルを1次元にして破壊的に更新していくパターン
    dp = np.zeros([w + 1], dtype=int)

    for i in range(1, n + 1):
        tmp = np.zeros(w + 1, dtype=int)
        tmp[goods[i - 1][0]:] = dp[:-goods[i - 1][0]] + goods[i - 1][1]
        dp = np.maximum(dp, tmp)

    print(dp[w])
    
resolve()

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

using namespace std;

int BubbleSort(int A[ ]  , int n){
    int count = 0;
    bool flag = 1;
    for(int i = 0 ; flag ; i++){ // if the flag equals to 1 , the loop keeps going until the flag equals to zero.
        flag = 0 ;
        for(int j = n -1; j >= i + 1 ; j--){
            if(A[j] < A[j-1]){
                swap(A[j],A[j-1]);
                flag = 1;
                count++;

            }
        
        }
    }
    return count;
}

 



int main(){

    int n; 
    int  count;
    cin >> n ;
    int A[n];
    
    for(int i = 0 ; i < n ; i++){
        cin >> A[i];
    }
    
    count = BubbleSort(A , n);
    for(int i = 0; i < n ; i++){
        if(i) cout << " ";
        cout << A[i];
    }
    cout << endl;
    cout << count << endl;
    
   return 0;
}


Measured memory_bytes: 3088
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector> 
#include<limits>
#include<numeric>
#include<type_traits>
#include<math.h>
#include<fstream>
#include<set>
using namespace std;
typedef long long ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i = (int)(a); i < (int)(b); i++)
#define out(str) cout << str << endl
#define ALL(a) (a).begin(),(a).end()
#define INF (1<<29)

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 ans[7] = {7,6,5,4,3,2,1};
string S[7] = { "SUN","MON","TUE","WED","THU","FRI","SAT" },b;

int main(){
    cin>>b;
    rep(i,7){
        if(b==S[i]){
            out(ans[i]);
            return 0;
        }
    }
    
    
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline

N,M = map(int,input().split())
mod = 998244353

FACT=[1]
for i in range(1,4*10**6+1):
    FACT.append(FACT[-1]*i%mod)

FACT_INV=[pow(FACT[-1],mod-2,mod)]
for i in range(4*10**6,0,-1):
    FACT_INV.append(FACT_INV[-1]*i%mod)

FACT_INV.reverse()

def Combi(a,b):
    if 0<=b<=a:
        return FACT[a]*FACT_INV[b]*FACT_INV[a-b]%mod
    else:
        return 0


ANS=Combi(M*3+N-1,N-1)

for i in range(M*2+1,M*3+1):
    k=M*3-i
    ANS=(ANS-N*Combi(k+(N-1)-1,N-2))%mod


for i in range(M+1,N+1):
    if (M*3-i)%2==1:
        continue
    k=(M*3-i)//2
    ANS=(ANS-Combi(N,i)*Combi(k+N-1,N-1))%mod

print(ANS)



Measured memory_bytes: 157616
/*    *** Bismillahir Rahmanir Rahim***
          *A S M Masud Parvez*
             *18ICTCSE035*
           *SHIICT(BSMRSTU)*
*/
#include<bits/stdc++.h>
using namespace std;
#define MP ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define        nl "\n"
#define        End return 0
#define        gt greater<int>()
#define        ll long long int
#define        mp make_pair
#define        pb push_back
#define        mod 1000000007
#define        ull unsigned long long int
int            Max = INT_MIN;
int            Min = INT_MAX;
#define        pi acos(-1)
int i,j,f=0,x,y,z,S=0,len,n,m;
/*
bool isprime(int n)
{
  if(n<2)return false;
  for(i=2;i*i<=n;i++)
  {
    if(n%i==0)
    return false;
  }
  return true;
}*/

int main()
{
  MP;

cin>>n;
cout<<fixed<<setprecision(2)<<pi*2*n;


  End;
}


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

using namespace std;

int R, G, B, N;

bool isGood(int r, int g, int b){
	return (r % R == 0 && g % G == 0 && b % B == 0);
}

int main(){
	
	cin >> R >> G >> B >> N;
	int ans = 0;
	
	for(int i=0; i<=N; i++){
		for(int j=0; j<=i; j++){
			if(isGood(N-i, i-j, j)) ans++;
			//printf("r: %d, g: %d, b: %d\n", N-i, i-j, j);
		}
	}
	
	printf("%d\n", ans);
	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cassert>
#include <map>
#include <algorithm>

using namespace std;

int main() {
  int T;
  cin >> T;
  for (int t=0; t<T; t++) {
    int h, w;
    cin >> h >> w;
    int table[60][60];
    map<char, int> Map;
    int N = 0;
    // 荷物を0からN-1の数字に置き換える。-1は何もない。
    for (int i=0; i<h; i++) {
      for (int j=0; j<w; j++) {
	char c;
	scanf(" %c", &c);
	int num = -2;
	if (c == '.') num = -1;
	else {
	  if (Map.find(c) == Map.end()) {
	    Map[c] = (num = N);
	    N++;
	  } else {
	    num = Map[c];
	  }
	}
	assert(num > -2);
	table[i][j] = num;
      }
    }
    // 各材料に対し、最小の長方形のラッパーを求める。
    int maxx[10], minx[10], maxy[10], miny[10];
    for (auto i=0; i<N; i++) {
      maxx[i] = 0;
      minx[i] = 100;
      maxy[i] = 0;
      miny[i] = 100;
    }
    for (int i=0; i<h; i++) {
      for (int j=0; j<w; j++) {
	int tij = table[i][j];
	if (tij >= 0) {
	  maxx[tij] = max(maxx[tij], i);
	  minx[tij] = min(minx[tij], i);
	  maxy[tij] = max(maxy[tij], j);
	  miny[tij] = min(miny[tij], j);
	}
      }
    }
    int J[10];
    for (auto i=0; i<N; i++) {
      J[i] = i;
    }
    do {
      int tempt[60][60];
      for (int i=0; i<h; i++) {
	for (int j=0; j<w; j++) {
	  tempt[i][j] = table[i][j];
	}
      }
      for (int k=0; k<N; k++) {
	// 荷物J[k]は長方形でありうるか？
	for (int i=minx[J[k]]; i<=maxx[J[k]]; i++) {
	  for (int j=miny[J[k]]; j<=maxy[J[k]]; j++) {
	    if (tempt[i][j] != J[k] && tempt[i][j] != 9) {
	      goto EXIT;
	    }
	  }
	}
	// J[k]を取り除く。
	for (int i=minx[J[k]]; i<=maxx[J[k]]; i++) {
	  for (int j=miny[J[k]]; j<=maxy[J[k]]; j++) {
	    tempt[i][j] = 9;
	  }
	}
      }
      cout << "SAFE" << endl;
      goto NEXT;
    EXIT: continue;
    } while(next_permutation(J, J+N));
    cout << "SUSPICIOUS" << endl;
  NEXT: continue;
  }
}

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

int main()
{
  while(1)
    {
      int h,w;
      cin >> h >> w;

      if(h == 0 && w == 0)
  	{break;}
      
      for(int i=1; i <= h; i++)
  	{
  	  if(i == 1 || i == h)
  	    {	      for(int j = 1; j <= w; j++)	{cout << "#";}       }
  	  else
  	    {
  	      for(int k=1; k <= w; k++)
  		if(k == 1 || k == w)
  		  {cout << "#";}
  		else
  		  {cout << ".";}	  
  	    }
	  cout << endl;
  	}
      cout << endl;
    }
}



Measured memory_bytes: 3136
#include<bits/stdc++.h>
// Begin Header {{{
#define all(x) (x).begin(), (x).end()
#define lli long long int
#define rep(i,n) for(lli i=0; i<n; i++)
#define loop(i, j, n) for(lli i=j; i<n; i++)
#define Max(a, b) ((a) > (b) ? (a) : (b))
#define Min(a, b) ((a) < (b) ? (a) : (b))
constexpr int INF  = 0x3f3f3f3f;
const long long mod=1e9+7;
const double PI = acos(-1);
//Function
lli combi(lli n, lli r){
	if(r==0 || r==n) return 1;
	else return combi(n-1,r) + combi(n-1,r-1);
}
lli sigma1(lli n){return n*(n+1)/2;}
lli sigma2(lli s, lli n){return sigma1(n) - sigma1(s -1);}
using namespace std;
// }}} End Header

int main() {
	map<int, int> s;
	rep(i,3){
		int a;
		cin >> a;
		s[a]++;
	}
	for(const auto& x : s){
		if(x.second == 1) cout << x.first << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
	ios_base::sync_with_stdio(false); 
    cin.tie(NULL);                    
    cout.tie(NULL);
    ll n;
    cin>>n;
    ll arr[n];
    ll cnt[100002]={0};
    ll sum=0;
    for(int i=0;i<n;i++) cin>>arr[i],sum^=arr[i];
    for(int i=0;i<n;i++) cout<<(sum^arr[i])<<" ";
	return 0;
}

Measured memory_bytes: 5172
import math
a,b,h,m=map(int, input().split())
th=30*(h+m/60)
tm=6*m

if th>=tm:
    tbig=th
    tsml=tm
else:
    tbig=tm
    tsml=th
#print(tm,th)
    
if tbig-tsml <= 180:
    print((a**2+b**2-2*a*b*math.cos(math.radians(tbig-tsml)))**(1/2))
else:
    print((a**2+b**2-2*a*b*math.cos(math.radians(360-tbig+tsml)))**(1/2))

Measured memory_bytes: 9512
#include <iostream>
#include <cassert>
#include <climits>
#include <bitset>
#include <stack>
#include <queue>
#include <iomanip>
#include <limits>
#include <string>
#include <cmath>
#include <set>
#include <map>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string.h>

using namespace std;

typedef long long ll;
typedef pair<ll,ll> P;

long long int INF = 3e18;
double Pi = 3.1415926535897932384626;

vector<ll> G[500005];
vector<P> tree[500010];
priority_queue <ll> pql;
priority_queue <P> pqp;
//big priority queue
priority_queue <ll,vector<ll>,greater<ll> > pqls;
priority_queue <P,vector<P>,greater<P> > pqps;
//small priority queue
//top pop

int dx[8]={1,0,-1,0,1,1,-1,-1};
int dy[8]={0,1,0,-1,1,-1,-1,1};
char dir[] = "DRUL";
//ll bit[500005];
//↓,→,↑,←


#define p(x) cout<<x<<endl;
#define el cout<<endl;
#define pe(x) cout<<x<<" ";
#define ps(x) cout<<fixed<<setprecision(25)<<x<<endl;
#define pu(x) cout<<x;
#define re(i,n) for(i=0;i<n;i++);
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define deba(x) cout<< #x << " = " << x <<endl


ll mod = 1000000007;
ll rui(ll number1,ll number2){
    if(number2 == 0){
        return 1;
    }else{
        ll number3 = rui(number1,number2 / 2);
        number3 *= number3;
        number3 %= mod;
        if(number2%2==1){
            number3 *= number1;
            number3 %= mod;
        }
        return number3;
    }
}
ll gcd(ll number1,ll number2){
    if(number1 > number2){
        swap(number1,number2);
    }
    if(number1 == 0 || number1 == number2){
        return number2;
    }else{
        return gcd(number2 % number1,number1);
    }
}
void YES(bool condition){
    if(condition){
        p("YES");
    }else{
        p("NO");
    }
    return;
}
void Yes(bool condition){
    if(condition){
        p("Yes");
    }else{
        p("No");
    }
    return;
}

ll n,m,num,sum,a,b,c,d,e,f,g,h,i,j,k,w,ok,ng,l,q;
ll x[500005],y[500005],z[500005];
char s[500005],t[500005];
bool flag,dame;
ll p[60][60];
ll ans[60];

void solve(ll ans[],ll p[][60],ll k){
	//p(k);
	if(k % 2 == 0 && k != 0){
		ll next[60][60];
		for(i=0;i<n;i++){
			for(j=0;j<n;j++){
				next[i][j] = 0;
				for(ll k=0;k<n;k++){
					next[i][j] += p[i][k] * p[k][j];
					next[i][j] %= mod;
				}
			}
		}
		solve(ans,next,k/2);
	}else if(k != 0){
		ll next[60];
		for(i=0;i<n;i++){
			//ans[i]を求める
			next[i] = 0;
			for(j=0;j<n;j++){
				next[i] += ans[j] * p[j][i];
				next[i] %= mod;
			}
		}
		solve(next,p,k-1);
	}else{
		a = 0;
		for(i=0;i<n;i++){
			a += ans[i];
			a %= mod;
		}
		p(a);
		return;
	}
}



int main(){
    cin >> n >> k;
	for(i=0;i<n;i++){
		for(j=0;j<n;j++){
			cin >> p[i][j];
		}
	}
	for(i=0;i<n;i++)ans[i] = 1;
	solve(ans,p,k);
	return 0;
}

Measured memory_bytes: 25984
import std.stdio,std.conv,std.string,std.algorithm,std.array;
void main(){
  auto sx=readln().split();
  auto sa=readln().split();
  auto sb=readln().split();
  int x,a,b;
  x=to!int(sx[0]);
  a=to!int(sa[0]);
  b=to!int(sb[0]);
  writeln((x-a)%b);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define sqr(x) ((x)*(x))
#define mp make_pair
#define uint unsigned
#define PI pair<int,int>
inline char gc(){
    static char buf[100000],*p1=buf,*p2=buf;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}
#define gc getchar
inline ll read(){
	ll x = 0; char ch = gc(); bool positive = 1;
	for (; !isdigit(ch); ch = gc())	if (ch == '-')	positive = 0;
	for (; isdigit(ch); ch = gc())	x = x * 10 + ch - '0';
	return positive ? x : -x;
}
inline void write(ll a){
    if(a<0){
    	a=-a; putchar('-');
	}
    if(a>=10)write(a/10);
    putchar('0'+a%10);
}
inline void writeln(ll a){write(a); puts("");}
inline void wri(ll a){write(a); putchar(' ');}
inline ull rnd(){
	return ((ull)rand()<<30^rand())<<4|rand()%4;
}
const int N=187;
short f[18][N][N][N],g[18][N][N][N];
char a[N][N];
int main(){
	//freopen("std.in","r",stdin); freopen("my.out","w",stdout);
	int n=read(),m=read();
	for(int i=1;i<=n;i++)scanf("%s",a[i]+1);
	for(int i=1;i<=n;i++){
		for(int j=i;j<=n;j++){
			for(int k=m;k;k--){
				if(i==j||(f[0][i][j-1][k]>=k&&a[j][k]==a[j-1][k]))f[0][i][j][k]=a[i][k]==a[i][k+1]?f[0][i][j][k+1]:k;
				else f[0][i][j][k]=k-1;
			}
		}
	}
	for(int i=1;i<=m;i++){
		for(int j=i;j<=m;j++){
			for(int k=n;k;k--){
				if(i==j||(g[0][i][j-1][k]>=k&&a[k][j]==a[k][j-1]))g[0][i][j][k]=a[k][i]==a[k+1][i]?g[0][i][j][k+1]:k;
				else g[0][i][j][k]=k-1;
			}
		}
	}
	if(f[0][1][n][1]>=m){puts("0"); return 0;}
	for(int ans=1;;ans++){
		for(int i=1;i<=n;i++)for(int j=i;j<=n;j++)f[ans-1][i][j][m+1]=m;
		for(int i=1;i<=m;i++)for(int j=i;j<=m;j++)g[ans-1][i][j][n+1]=n;
		for(int i=1;i<=n;i++)
			for(int j=i;j<=n;j++)
				for(int k=m;k;k--)f[ans][i][j][k]=f[ans-1][i][j][f[ans-1][i][j][k]+1];
		for(int i=1;i<=m;i++)
			for(int j=i;j<=m;j++)
				for(int k=n;k;k--)g[ans][i][j][k]=g[ans-1][i][j][g[ans-1][i][j][k]+1];
		for(int i=1;i<=n;i++)
			for(int j=i;j<=n;j++)
				for(int k=1;k<=m;k++){
					f[ans][i][j][k]=max(f[ans][i][j][k-1],f[ans][i][j][k]);
					while(f[ans][i][j][k]<m&&g[ans][k][f[ans][i][j][k]+1][i]>=j)f[ans][i][j][k]++;
				}
		for(int i=1;i<=m;i++)
			for(int j=i;j<=m;j++)
				for(int k=1;k<=n;k++){
					g[ans][i][j][k]=max(g[ans][i][j][k-1],g[ans][i][j][k]);
					while(g[ans][i][j][k]<n&&f[ans][k][g[ans][i][j][k]+1][i]>=j)g[ans][i][j][k]++;
				}
		if(f[ans][1][n][1]>=m){
			cout<<ans<<endl; return 0;
		}
		//for(int i=1;i<=m;i++)for(int j=i;j<=m;j++)for(int k=1;k<=n;k++)cout<<ans<<" "<<i<<" "<<j<<" "<<k<<" "<<(int)g[ans][i][j][k]<<endl;
	}
}
/*
3 3
.#.
#.#
.#.

*/

Measured memory_bytes: 438400
#include <iostream>
#include <vector>
#include <algorithm>
#include <climits>
using namespace std;
int main()
{
    size_t n;
    long long k, ans = LLONG_MAX;
    cin >> n;
    vector<long long> l(n);
    cin >> l[0];
    for(size_t i = 1; i < n; i++){
        scanf("%lld", &k);
        l[i] += l[i-1] + k;
    }
    for(int i = 0; i < n-1; i++){
        ans = min(ans, abs(l[n-1] - 2*l[i]));
    }
    cout << ans << endl;
    return 0;
}

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

using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<string> svec;

#define IN_LL(in) ll in; cin >> in
#define IN_STR(in) string in; cin >> in
#define IN_VEC(in, size) vec in; for(int i = 0; i < (size); ++i){int ____cur; cin >> ____cur; in.push_back(____cur); } 0
#define IN_SVEC(in, size) svec in; for(int i = 0; i < (size); ++i){string ____cur; cin >> ____cur; in.push_back(____cur); } 0

#define OUT(out) cout << (out)
#define OUT_VEC(out) for(ll i = 0; i < (out).size(); ++i) cout << (out)[i]

double func(double hl, double ml, double h, double m){
	const double pi = acos(-1);
	double hs, ms, hx, hy, mx, my;

	ms = 2 * pi * (m / 60);
	hs = 2 * pi * ((h + m / 60) / 12);
	mx = sin(ms) * ml;
	my = cos(ms) * ml;
	hx = sin(hs) * hl;
	hy = cos(hs) * hl;
	return sqrt((mx - hx) * (mx - hx) + (my - hy) * (my - hy));
}

int main(void){
	IN_LL(a);
	IN_LL(b);
	IN_LL(h);
	IN_LL(m);

	double ret = func(a, b, h, m);

	cout << setprecision(12) << ret;
	return 0;
}


Measured memory_bytes: 4100
def check(weight):
    if weight <= 60.00 :
        if weight <= 51.00 :
            if weight <= 48.00 : print('light fly') 
            else : print('fly')
        elif 54.00 < weight :
            if weight <= 57.00 : print('feather')
            else : print('light')
        else : print('bantam')
    elif 64.00 < weight  :
        if weight <= 75.00 :
            if weight <= 69.00 : print('welter')
            else : print('light middle')
        elif 81.00 < weight :
            if weight <= 91.00 : print('light heavy')
            else : print('heavy')
        else : print('middle')
    else : print('light welter')
    
while True :
    try    : check(float(input()))
    except : break

Measured memory_bytes: 7432
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;

public class Main {

	public static void main(String[] args) {

		FastScanner sc = new FastScanner();
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int d = sc.nextInt();
		int e = sc.nextInt();
		int k = sc.nextInt();
		if (e-a > k)
			System.out.println(":(");
		else
			System.out.println("Yay!");

	}
	//以下、自作ライブラリ

	//最大公約数
	public static long gcd(long a, long b) {
		if (a < b)
			return gcd(b, a);
		long c = 0;
		c = a % b;
		if (c == 0)
			return b;
		return gcd(b, c);
	}

	//最小公倍数
	public static long lcm(long m, long n) {
		return m * n / gcd(m, n);
	}

	//素数判定
	public static boolean isPrime(int n) {
		if (n < 2)
			return false;
		if (n == 2)
			return true;
		if (n % 2 == 0)
			return false;

		for (int i = 3; i * i <= n; i += 2) {
			if (n % i == 0)
				return false;
		}
		return true;
	}
}

//以下、高速スキャナークラス
class FastScanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;

	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) {
				return false;
			}
		}
		return true;
	}

	private int readByte() {
		if (hasNextByte())
			return buffer[ptr++];
		else
			return -1;
	}

	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}

	public boolean hasNext() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr]))
			ptr++;
		return hasNextByte();
	}

	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	public long nextLong() {
		if (!hasNext())
			throw new NoSuchElementException();
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}

	public int nextInt() {
		long nl = nextLong();
		if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
			throw new NumberFormatException();
		return (int) nl;
	}

	public double nextDouble() {
		return Double.parseDouble(next());
	}
}


Measured memory_bytes: 21076
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repr(i, n) for(int i = ((int)(n) - 1); i >= 0; i--)
#define repn(i, n) for(int i = 1; i <= (int)(n); i++)
#define reprn(i, n) for(int i = ((int)(n)); i > 0; i--)
#define all(x) (x).begin(), (x).end()
#define LARGE_PRIME_NUM 1000000007
using ll = long long;

#include <iostream>
#include <array>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <numeric>
using namespace std;

int main() {
	int a, b;
	cin >> a >> b;
	int ans;
	if (a < 6) {
		ans = 0;
	} else if (a < 13) {
		ans = b / 2;
	} else {
		ans = b;
	}
	
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())
#define ll long long
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<ll>vec;
typedef vector<vec> mat;
typedef vector<vector<int>> Graph;

//const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
//const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const int INF = 1000000000;
const ll LINF = 1000000000000000000;//1e18
const ll  MOD = 1000000007;
const double PI = acos(-1.0);
const double EPS = 1e-10;

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;};

bool is_prime(int n){
    for(int i = 2;i * i <=n;i++){
        if(n % i == 0) return false;
    }
    return n != 1; //1の場合は例外
}

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

    for(ll i=X;i<=INF;i++){
        if(is_prime(i)){
            cout << i << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=int(a);i<int(b);i++)
typedef long long ll;
typedef pair<ll,ll> P;



int main(){
    ll n,k;cin>>n>>k;
    ll a[200020];
    rep(i,0,n)cin>>a[i];
    ll r=1e9,l=0;
    while(r>l+1){
        ll mid=(l+r)/2;
        ll cn=0;
        rep(i,0,n){
            cn+=(a[i]-1)/mid;
        }
        if(k>=cn)r=mid;
        else l=mid;
    }
    cout<<r<<endl;
}

    









Measured memory_bytes: 5124
N = int(input())
A = [int(i) for i in input().split()]

import numpy
res = numpy.cumsum(A)
sum_A = sum(A)

ans = 10 ** 18
for i in range(N-1):
    x = res[i]
    ans = min(abs(x - (sum_A-x)), ans)
print(ans)

Measured memory_bytes: 24824
#include<bits/stdc++.h>
using namespace std;
const int MAXN = 3005;
const int P = 1e9 + 7;
const int inv2 = (P + 1) / 2;
typedef long long ll;
template <typename T> void read(T &x) {
	x = 0; int f = 1;
	char c = getchar();
	for (; !isdigit(c); c = getchar()) if (c == '-') f = -f;
	for (; isdigit(c); c = getchar()) x = x * 10 + c - '0';
	x *= f;
}
int power(int x, int y) {
	if (y == 0) return 1;
	int tmp = power(x, y / 2);
	if (y % 2 == 0) return 1ll * tmp * tmp % P;
	else return 1ll * tmp * tmp % P * x % P;
}
int n, q, a[MAXN], x[MAXN], y[MAXN];
int mul, inv, dp[MAXN][MAXN];
int main() {
	read(n), read(q);
	for (int i = 1; i <= n; i++)
		read(a[i]);
	for (int i = 1; i <= q; i++)
		read(x[i]), read(y[i]);
	for (int i = 1; i <= n; i++)
	for (int j = 1; j <= n; j++)
		dp[i][j] = i > j;
	mul = inv = 1;
	for (int i = q; i >= 1; i--) {
		int tmp = 1ll * inv2 * inv % P;
		for (int j = 1; j <= n; j++)
			if (j != x[i] && j != y[i]) {
				dp[x[i]][j] = dp[y[i]][j] = 1ll * mul * (dp[x[i]][j] + dp[y[i]][j]) % P * tmp % P;
				dp[j][x[i]] = dp[j][y[i]] = 1ll * mul * (dp[j][x[i]] + dp[j][y[i]]) % P * tmp % P;
			}
		dp[x[i]][y[i]] = dp[y[i]][x[i]] = 1ll * mul * (dp[x[i]][y[i]] + dp[y[i]][x[i]]) % P * tmp % P;
		mul = 2ll * mul % P, inv = tmp;
	}
	for (int i = 1; i <= n; i++)
	for (int j = 1; j <= n; j++)
		dp[i][j] = 1ll * dp[i][j] * mul % P;
	int ans = 0;
	for (int i = 1; i <= n; i++)
	for (int j = i + 1; j <= n; j++)
		if (a[i] < a[j]) ans = (ans + dp[i][j]) % P;
		else if (a[i] > a[j]) ans = (ans + dp[j][i]) % P;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 35456
var
  a,t,i,j,y:longint;
  b,c,d:array[0..100009]of longint;
begin
readln(a);
y:=maxlongint;
for i:=1 to a do
begin
readln(b[i],c[i]);
d[i]:=b[i]+c[i];
if d[i]<y then y:=d[i];
end;
writeln(y);
end.

Measured memory_bytes: 1280
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;

/*int keta(int N){
  int ans = 0;
  while(N>0){
    ans++;
    N /= 10;
  }
  return ans;
}*/

int main(){
  int N,K;
  cin >> N >> K;
  bool abl[10];
  fill(abl,abl+10,true);
  for(int i=0;i<K;i++){
    int k;
    cin >> k;
    abl[k] = false;
  }

  int ans;
  for(int i=N;i<=99999;i++){
    int itmp = i;
    bool isok = true;
    while(itmp != 0){
      if(abl[itmp%10]==false){
        isok = false;
        break;
      }
      itmp/=10;
    }
    if(isok){
      ans = i;
      break;
    }
  }

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

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

using namespace std;

using ll = long long;

const ll INF = 1e18L + 5;

int min_self(ll &a , ll b){
    a = min(a , b);
return a;
}

int main (){
    int n , w;
    scanf("%d %d"  , &n , &w);
    vector<int> weight(n) , val(n);
    for(int i = 0; i < n; ++i){
        scanf("%d %d" , &weight[i] , &val[i]);
    }
    int sum_val = 0;
    for(int x : val){
        sum_val += x;
    }
    vector<ll> dp(sum_val + 1 , INF);
    dp[0] = 0;
    for(int item = 0; item < n; ++item){
        for(int valready = sum_val - val[item]; valready >= 0;  --valready){
            min_self(dp[valready + val[item]] , dp[valready] + weight[item]);
        }
    }
    ll answer = 0;
    for(int i = 0; i <= sum_val; ++i){
        if(dp[i] <= w){
            answer = max(answer , (ll) i);
        }
    }
    printf("%lld" , answer);
return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <vector>

using namespace std;


int main(){
  int n,k;
  long long int point[50][2];
  cin >> n >> k;
  for(int i=0;i<n;i++) cin >> point[i][0] >> point[i][1];

  long long int ans = 9223372036854000000;
  for(int xt=0;xt<n;xt++){
    for(int xb=n-1;xb>=0;xb--){
      for(int yt=0;yt<n;yt++){
        for(int yb=n-1;yb>=0;yb--){
          // judging the number of points included inside
          int count = 0;
          for(int i=0;i<n;i++){
            if((point[i][0]-point[xt][0]) * (point[i][0]-point[xb][0]) <= 0 &&
               (point[i][1]-point[yt][1]) * (point[i][1]-point[yb][1]) <= 0) count++;
          }
          if (count < k) continue;
          long long int square = (point[xt][0] - point[xb][0]) * (point[yt][1] - point[yb][1]);
          if(square<0) square *= -1;
          ans = min(ans, square);
        }
      }
    }
  }
  cout << ans << endl;
  return 0;
}


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

using namespace std;

const int BUFFER_SIZE = 1 << 20;
char rb[BUFFER_SIZE], *rp = rb, *rt = rb;
inline char read_char() {
    return rp == rt ? (rt = rb + fread(rb, 1, BUFFER_SIZE, stdin), rp = rb, *rp ++) : *rp ++;
}
inline int read_int() {
    int x = 0;
    char ch = read_char(), flag = 0;
    while (ch != '-' && (ch < '0' || ch > '9')) {
        ch = read_char();
    }
    if (ch == '-') {
        flag = 1;
        ch = read_char();
    }
    for (x = 0; ch >= '0' && ch <= '9'; ch = read_char()) {
        x = x * 10 + (ch - '0');
    }
    return flag ? -x : x;
}

const int MAX_N = 100000 + 5;

int A, B, M, a[MAX_N], b[MAX_N];
int ans_a, ans_b, ans;

int main() {
    A = read_int();
    B = read_int();
    M = read_int();
    ans_a = 1e9;
    for (int i = 1; i <= A; i ++) {
        a[i] = read_int();
        ans_a = min(ans_a, a[i]);
    }
    ans_b = 1e9;
    for (int j = 1; j <= B; j ++) {
        b[j] = read_int();
        ans_b = min(ans_b, b[j]);
    }
    ans = ans_a + ans_b;
    for (int k = 1; k <= M; k ++) {
        int i = read_int();
        int j = read_int();
        int c = read_int();
        ans = min(ans, a[i] + b[j] - c);
    }
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 2048
n = int(input()) + 2
a = [0] + list(map(int, input().split())) + [0]
all = 0
for i in range(1, n):
    all += abs(a[i - 1] - a[i])
for i in range(1, n - 1):
    if a[i - 1] < a[i] and a[i + 1] < a[i] or a[i - 1] > a[i] and a[i + 1] > a[i]:
        s = min(abs(a[i - 1] - a[i]) , abs(a[i + 1] - a[i]))
        print(all - s * 2)
    else:
        print(all)

Measured memory_bytes: 14176
while 1:
	a,b = map(int,raw_input().split())
	if a == 0: break
	block = [map(int,raw_input().split()) for i in range(input())]
	road = [[0]*(a+1) for i in range(b+1)]
	road[1][1] = 1
	for bi in range(1,b+1):
		for ai in range(1,a+1):
			if [ai,bi] not in block:
				road[bi][ai] += road[bi-1][ai] + road[bi][ai-1]
	print road[b][a]

Measured memory_bytes: 4232
#include<bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
typedef long long ll;
#define pb push_back
#define fi first
#define se second
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
template <class T, class U> ostream &operator<<(ostream &os, const pair<T, U> &p){os<<"("<<p.first<<","<< p.second<<")";return os;}
template <class T> ostream &operator<<(ostream &os, const vector<T> &v){os<<"{";REP(i,(int)v.size()){if(i)os<<",";os<<v[i];}os<<"}";return os;}
template <typename T, size_t S> void printArray(const T (&array)[S]){for(auto val : array)std::cout << val << ", ";std::cout << "\n";}
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}
const double PI=acos(-1);
const ll MOD = 1000000007;
using Graph = vector<vector<int>>;
template<class T>inline bool chmax(T& a, T b){if(a < b){a = b; return 1;}return 0;}
template<class T>inline bool chmin(T& a, T b){if(a > b){a = b; return 1;}return 0;}
const ll INF = 1LL<<60;
//const int dy[4] = {0, 1, 0, -1};
//const int dx[4] = {1, 0, -1, 0};
//const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
//const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};

void solve(){
    string s; cin >> s;
    vector<ll> a(4, 0); //a[0]:N, a[1]:S, a[2]:E, a[3]:W
    REP(i, s.size()){
        if(s[i] == 'N') a[0]++;
        if(s[i] == 'S') a[1]++;
        if(s[i] == 'E') a[2]++;
        if(s[i] == 'W') a[3]++;
    }
    if(a[0] > 0 && a[1] > 0 && a[2] == 0 && a[3] == 0 || a[0] == 0 && a[1] == 0 && a[2] > 0 && a[3] > 0 || a[0] > 0 && a[1] > 0 && a[2] > 0 && a[3] > 0) Yes();
    else No();
}

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

Measured memory_bytes: 3660
import sys
sys.setrecursionlimit(10**5)

n = int(input())

path = [[] for i in range(n)]

for _ in range(n-1):
    u,v,w = list(map(int,input().split()))
    path[u-1].append((v-1, w))
    path[v-1].append((u-1, w))

global dist
dist = [-1 for i in range(n)]
dist[0] = 0

def dfs(now):
    for v,w in path[now]:
        if dist[v] == -1:
            dist[v] = w + dist[now]
            dfs(v)
    
dfs(0)

for i in dist:
    print(i%2)

Measured memory_bytes: 156320
#include <iostream>
#include <algorithm>
  
using namespace std;
  
int main(){
    string s,ans = "";
  
    cin >> s;
    int len = (int)s.size();
    for(int i = 0 ; i < len ; i++){
	string str = "";
	for(int j = 0 ; j < 8 ; j++){
	    if(i + j > len) break;
	    str += s[i+j];
	}   
	sort(str.begin(),str.end());
	if(str == "AADINNUY"){
	    ans += "AIZUNYAN";
	    i += 7;
	}else{
	    ans += s[i];
	}
    }
    cout << ans << endl;
  
    return 0;
}

Measured memory_bytes: 3172
//### In The Name Of GOD ###

#include <bits/stdc++.h>

using namespace std;

typedef long long ll ;

#define int ll
#define pb push_back
#define bp pop_back
#define pf push_front
#define fp pop_front
#define X first
#define Y second
#define IO ios_base::sync_with_stdio(false);
#define sz(a) (int)(a.size())

const int MOD = 1000000007;
const int INF = 30 * 1000 + 20;
const int MAXN = 401;
const int MLOG = 18;
const int NMAX = 60;

signed main(){
  int ans = 0;
  string s, ss;
  cin >> s;
  for(int i = 0; i < sz(s); i++){
    if(i%2) ss += 'p';
    else ss += 'g';
    if(s[i] > ss[i])
      ans++;
    if(s[i] < ss[i])
      ans--;
  }
  cout << -ans;
}


Measured memory_bytes: 512
import java.io.*;
import java.util.*;
public class Main{
    private static void solver(InputReader sc, PrintWriter out) throws Exception {
        int n = sc.nextInt();
        int k = sc.nextInt();
        long mod = 1000000007;
        long sum=0;
        long pre[] = new long[n+1];
        pre[0] = 0;
        for(int i=1; i<n+1; i++){
            pre[i] = i + pre[i-1];
        }
        long suf[] = new long[n+1];
        suf[n] = n;
        for(int i=n-1;i>=0; i--){
            suf[i] = i+suf[i+1];
        }
      /* for(long xx : suf)
           out.print(xx+" ");
       out.println();
        for(long xx : pre)
            out.print(xx+" ");*/
        for(int i=k-1; i<n+1; i++){
            sum += (suf[n-i]-pre[i] + 1)%mod;
            sum %=mod;
        }
        out.println(sum);
    }
    private static boolean helper(long x){
        double ans = Math.sqrt(x);
        return ans%1!=0;
    }

    private static int gcd(int a, int b){
        if(b==0)
            return a;
        return gcd(b, a%b);
    }
    public static void main(String[] args) throws Exception {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        solver(in,out);
        out.close();
    }
    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }
        public long nextLong() {
            return Long.parseLong(next());
        }
        public int[] readIntArray(int n){
            int arr[] = new int[n];
            for(int i=0;i<n;i++) arr[i] = nextInt();
            return arr;
        }
    }
}
class Pair  {
    int x;
    int y;

    Pair(int x, int y) {
        this.x = x;
        this.y = y;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Pair pair = (Pair) o;
        return x == pair.x &&
                y == pair.y;
    }

    @Override
    public int hashCode() {
        return Objects.hash(x, y);
    }
}

Measured memory_bytes: 36164
#include<iostream>
using namespace std;
typedef long long int ll;
int main(){
	int N;
	int C[500], S[500], F[500];
	cin >> N;
	for(int i = 0; i < N - 1; i++){
		cin >> C[i] >> S[i] >> F[i];
	}

	for(int i = 0; i < N - 1; i++){
		int tt = 0;
		for(int j = i; j < N - 1; j++){
			int t;
			if(tt <= S[j]){
				t = S[j] - tt;
			}else{
				t = S[j];
				while(t < tt){
					t += F[j];
				}
				t -= tt;
			}
			tt += (t + C[j]);
		}
		cout << tt << endl;
	}
	cout << 0 << endl;
	return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <vector>

using namespace std;

const int N = 200'009;

int a[N];
int b[N];
vector<int> wb[2];

int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    scanf("%d", a + i);
  }
  for (int i = 0; i < n; ++i) {
    scanf("%d", b + i);
  }
  int ans = 0;
  for (int i = 0; i <= 29; ++i) {
    for (int j = 0; j < 2; ++j) {
      wb[j].clear();
    }
    for (int j = 0; j < n; ++j) {
      wb[b[j] >> i & 1].push_back(b[j] & ((1 << i) - 1));
    }
    for (int j = 0; j < 2; ++j) {
      sort(wb[j].begin(), wb[j].end());
    }
    int xr = 0;
    for (int j = 0; j < n; ++j) {
      int va = a[j] >> i & 1;
      int wa = a[j] & ((1 << i) - 1);
      for (int vb = 0; vb < 2; ++vb) {
        int l = -1, r = (int)wb[vb].size();
        while (r - l > 1) {
          int s = (l + r) / 2;
          if (wb[vb][s] + wa < (1 << i)) {
            l = s;
          } else {
            r = s;
          }
        }
        if ((l + 1) % 2 == 1) {
          xr ^= va ^ vb;
        }
        if (((int)wb[vb].size() - l - 1) % 2 == 1) {
          xr ^= va ^ vb ^ 1;
        }
      }
    }
    ans += xr << i;
  }
  printf("%d\n", ans);
}


Measured memory_bytes: 3444
N=int(input())
*A,=map(int,input().split())

count4=sum(a%4==0 for a in A)
c_odd=sum(a%2==1 for a in A)

if N%2==1:
    print('YNeos'[c_odd>count4+1::2])
else:
    print('YNeos'[c_odd>count4::2])

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

bool fun(ll n, ll i)
{
    if(i==1)
    return false;
    while(n%i==0)
    {
        n=n/i;
    }
    if(n%i==1)
    return true;
    else
    return false;
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll n;
    cin>>n;
    vector<ll> vec,vec1;
    for(ll i=1;i*i<=n;++i)
    {
        if(n%i==0)
        {
            ll temp1=i;
            ll temp2=n/i;
            vec.push_back(temp1);
            if(temp2!=temp1)
             vec.push_back(temp2);
        }
    }
    
    ll n1=n-1;
    for(ll i=1;i*i<=n1;++i)
    {
        if(n1%i==0)
        {
            ll temp1=i;
            ll temp2=n1/i;
            vec1.push_back(temp1);
            if(temp2!=temp1)
             vec1.push_back(temp2);
        }
    }
    
    set<ll> s;
    for(int i=0;i<vec.size();++i)
    {
        if(fun(n,vec[i]))
        {
            if(vec[i]>=2)
            s.insert(vec[i]);
        }
    }
    
    for(int i=0;i<vec1.size();++i)
    {
        if(vec1[i]>=2&&n%vec1[i]!=0)
        s.insert(vec1[i]);
    }
    
   cout<<s.size()<<endl; 
    
    

}


Measured memory_bytes: 384
#![allow(unused)]

//input
//use std::io::Read;

//collections
//use std::collections::BTreeMap;
//use std::collections::BTreeSet;
//use std::collections::HashMap;
//use std::collections::HashSet;


//入力マクロここから
//https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
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! {
        c: chars,
    }

    let ans = (c[0] as u8 + 1) as char;

    println!("{}",ans);
}

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

int main() {
	int T, N, K, X[100000+10];

	cin >> T;
	for (int i = 0; i<T; i++) {
		cin >> N >> K;
		int A[100000+10];
		for (int j=0;j<N;j++) {
			cin >> X[j];
		}
		for (int k=0;k<N-1;k++){
			A[k] = X[k+1]-X[k];
		}
		sort(A,A+N-1);

		if (N<=K) {
			cout << 0 << endl;
		} else if(K == 1) {
			int result1 =0;
			for(int y=0; y<N-1;y++) {
				result1+=A[y];
			}
			cout << result1 << endl;

		} else {
			int margin = K-1;
			int result2 = 0;
			for(int t=0; t<N-1-margin;t++) {
				result2 += A[t];
			}
			cout << result2 << endl;
		}

		

	}
	return 0;
}

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

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP0(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REP1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)

typedef long long LL;
typedef pair<int, int> pii;

const int INTINF = 1e9;
const LL LLINF = 1e18;

void solve()
{
    int N;
    cin >> N;
    vector<int> A(N);
    REP0(i, N)
    {
        cin >> A[i];
    }
    sort(A.begin(), A.end());
    reverse(A.begin(), A.end());

    LL s1 = 0;
    LL s2 = 0;

    REP0(i, N - 1)
    {
        if (A[i] == A[i + 1])
        {
            if (s1 == 0)
                s1 = A[i];
            else if (s2 == 0)
                s2 = A[i];
            else
                break;
            ++i;
        }
    }
    cout << s1 * s2 << endl;
}

int main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(10);
    solve();
    return 0;
}

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

namespace ConsoleApplication40
{
    class Program
    {
        static void Main()
        {
            int A, B;A = B = 0;
            while (true)
            {
                string C = Console.ReadLine();
                if (C == null) break;
                int[] D = C.Split(',').Select(int.Parse).ToArray();
                if (D[0] * D[0] + D[1] * D[1] == D[2] * D[2]) A++;
                if (D[0] == D[1]) B++;
            }
            Console.WriteLine(A);
            Console.WriteLine(B);
        }
    }
}

Measured memory_bytes: 9384
#include <stdio.h>

int
main(void)
{
	int a, b, c, res = 0;

	scanf("%d%d%d", &a, &b, &c);

	for (;a <= b; a++)
		if ((c % a) == 0)
			res++;

	printf("%d\n", res);

	return 0;
}



Measured memory_bytes: 2092
#include<cstdio>
#include<vector>
#include<cstring>
using i64=long long;
int n,flg=1,t[300007];std::vector<int>p[3];
int read(){int x;scanf("%d",&x);return x;}
void add(int p){while(p)++t[p],p^=p&-p;}
int ask(int p){int r=0;while(p<=n)r+=t[p],p+=p&-p;return r;}
i64 tao(std::vector<int>p){i64 r=0;memset(t,0,sizeof t);for(int x:p)r+=ask(x),add(x);return r;}
int main()
{
    n=read();
    for(int i=1,x;i<=n;++i) p[2].push_back(x=read()),p[i&1].push_back(x),flg&=!((i^x)&1);
    puts(flg&(tao(p[2])==3*(tao(p[0])+tao(p[1])))? "Yes":"No");
}

Measured memory_bytes: 7156
#include <stdio.h>
typedef long long ll;

int main(void) {
  ll i, j, k, n;
  scanf("%lld", &n);
  ll a[n], b[n], suma = 0, sumb = 0, counta, countb;
  for(i = 0;  i < n; ++i) {
    scanf("%lld", &a[i]);
    suma += a[i];
  }
  for(i = 0; i < n; ++i) {
    scanf("%lld", &b[i]);
    sumb += b[i];
  }
  counta = sumb - suma;
  countb = sumb - suma;
  if(counta < 0) {
    printf("No");
    return 0;
  }
  for(i = 0; i < n; ++i) {
    if(a[i] > b[i]) {
      countb -= a[i] - b[i];
    } else if(a[i] < b[i]){
     if((a[i] - b[i]) % 2) {
       countb--;
       counta -= (b[i] + 1 - a[i]) / 2;
     } else {
      counta -= (b[i] - a[i]) / 2;
     }
   }
  }
  //printf("%d %d %d %d", suma, sumb, counta, countb);
  if(counta >= 0 && countb >= 0 && !(countb % 2) && counta == countb / 2) printf("Yes");
  else printf("No");
  return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import numpy as np
import sys
from collections import deque
from collections import defaultdict
import heapq
import collections
import itertools
import bisect

sys.setrecursionlimit(10**6)


def zz():
    return list(map(int, sys.stdin.readline().split()))


def z():
    return int(sys.stdin.readline())


def S():
    return sys.stdin.readline()


def C(line):
    return [sys.stdin.readline() for _ in range(line)]


N = z()
H = zz()
H = np.array(H)
ans = 0
while (sum(H) != 0):
    s = 0
    while (s < N):
        if(H[s] != 0):
            break
        s += 1
    e = s
    while (e < N):
        if (H[e] == 0):
            break
        e += 1
    # print(H, s, ? e, '-', min(H[s:e]))
    H[s:e] -= 1
    ans += 1
print(ans)


Measured memory_bytes: 27096
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repp(i, n, m) for (int i = (int)(n); i < (int)(m); i++)
#define rrep(i, n, m) for (int i = n; i >= m; i--)
#define p(s) cout << s << endl;
typedef long long LL;
template <class T>
bool contain(const std::string &s, const T &v)
{
    return s.find(v) != std::string::npos;
}

int main()
{
    LL x,a,b; cin>>x>>a>>b;
    if(b-a > 0){
        if(x+1 > b-a){
            cout << "safe" << endl;
        }else{
            cout << "dangerous" << endl;
        }
    }else{
        cout << "delicious" << endl;
    }
}


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

int main()
{
    vector<char> N(2);
    cin >> N.at(0) >> N.at(1);
    if(N.at(0)=='9' || N.at(1)=='9'){
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
    
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
  int ans=0,p;
  double temp=0.0;
    int n,all[105];
  scanf("%d",&n);
  for(int i = 1;i<=n;i++)
  {
    scanf("%d",&all[i]);
    temp+=all[i];
  }
  temp=temp/n;
  if((temp-(int)temp)>=0.5)
    p=(int)temp+1;
  else
    p=(int)temp;
  for(int i = 1;i<=n;i++)
    ans=ans+(p-all[i])*(p-all[i]);
  
  
  printf("%d",ans);
  return 0;
}


Measured memory_bytes: 128
import java.util.Scanner;
public class Main{
 public static void main(String[] args){
   Scanner sc = new Scanner(System.in);
   int A = sc.nextInt();
   int B = sc.nextInt();
   int C = sc.nextInt();
   if(A-B>=C) System.out.println(0);
   else System.out.println(C-A+B);
 }
}

Measured memory_bytes: 21972
import * as fs from 'fs';
// main
function main(input: string[]) {
    // param
    let s: string = "";
    let ans: string = "";
    // init
    s = input.shift();
    // solve
    ans = (s == "AAA" || s == "BBB") ? "No" : "Yes";
    // answer
    console.log(ans);
}
// entrypoint
function entrypoint() {
    try {
        // linux
        let input = fs.readFileSync("/dev/stdin", "utf8").trim().split("\n");
        console.debug = function () { };
        main(input);
    }
    catch (ex) {
        // windows
        const lines: string[] = [];
        // @ts-ignore
        const reader = require('readline').createInterface({
            // @ts-ignore
            input: process.stdin,
            // @ts-ignore
            output: process.stdout
        });
        reader.on('line', function (line: string) {
            lines.push(line);
        });
        reader.on('close', function () {
            let input = lines;
            main(input);
        });
    }
}
entrypoint();


Measured memory_bytes: 29588