akhauriyash/Code-Regression huggingface dataset:
/*
======================
[     ___T_          ]
[    | 6=6 | =>HI :-)] 
[    |__o__|         ]
[ >===]__o[===<      ]
[     [o__]          ]
[      .".           ]
[      |_|           ]
[                    ]
======================
 */

#include<bits/stdc++.h>
using namespace std;
using lli = int64_t;
int main() {
	 ios::sync_with_stdio(false);
	 cin.tie(nullptr);
	 cout.tie(nullptr);
	 int T = 1;
	 for(int t = 1; t <= T; t++) {
		 int n,m;
		 cin >> n >> m;
		 cout << ((n <= 9 and m <= 9) ? n * m : -1) << "\n";
	 }
}


Measured memory_bytes: 3644
S = int(input())
MOD = 10**9 + 7
ans = 0

g1 = [1, 1]
g2 = [1, 1]
inverse = [0, 1]
for i in range(2, 10**4): # <- どこまでfor文を回すかは問題次第, 2*10**6くらいまでならpypyなら間に合う
    g1.append((g1[-1] * i) % MOD)
    inverse.append((-inverse[MOD % i] * (MOD // i)) % MOD)
    g2.append((g2[-1] * inverse[-1]) % MOD)

def memo_comb(n, r, mod=MOD):
    if r < 0 or r > n:
        return 0
    r = min(r, n - r)
    return g1[n] * g2[r] * g2[n-r] % mod


for n in range(1, S):
    s = S - 3*n
    if s < 0:
        break

    ans += memo_comb(s+n-1, s)
    ans %= MOD

print(ans)

Measured memory_bytes: 10232
#include<iostream>
#include<vector>
#include<climits>

using namespace std;

int main() {
  
  	int n;
  	int w;
  	cin >> n >> w;
  
  	long long dp[n+1][w+1];
  
  	for(int i = 0; i < n+1; i++)
      for(int j = 0; j < w+1; j++)
        dp[i][j] = 0;
  
  	long long values[w];
  	long long weights[w];
  
  	for(int i = 0; i < w; i++)
    {
     	values[i] = 0;
      	weights[i] = 0;
    }
  
  	for(int i = 0; i < n; i++)
    {
     	cin >> weights[i];
      	cin >> values[i];
    }
  
 
  	for(int i = 1; i < n+1; i++)
      for(int j = 1; j < w+1; j++)
      {
        	if(weights[i-1] == j)
            {
              	dp[i][j] = max(dp[i][j], values[i-1]);
            }
        	dp[i][j] = max(dp[i][j], max(dp[i][j-1], dp[i - 1][j])); //top and left
        	if(j - weights[i - 1] >= 0)
        		dp[i][j] = max(dp[i][j], dp[i-1][j - weights[i-1]] + values[i-1]); //subset sum*/
      }
  
  	cout << dp[n][w] << endl;
  
 	return 0;
}

Measured memory_bytes: 80768
import java.io.IOException; 
import java.io.InputStream; 
import java.io.PrintWriter; 

class Main{ 

	static long factorial[];
	static long inv[];
	static long mod;

	static long inverse(long n){
		long res = 1;
		for(int i=0;i<32;++i){
			if(((mod-2L)&(1L<<i))>0)res=(res*n)%mod;
			n=(n*n)%mod;
		}
		return res%mod;
	}
	static long c(int n,int k){
		return ((factorial[n]*inv[k])%mod*inv[n-k])%mod;
	}

	static void solve(){ 
		int N = ni();
		int A = ni();
		int B = ni();
		long K = nl();
		mod = 998244353;
		long ans = 0;
		factorial = new long[N+1];
		factorial[0]=1;
		for(int i=1;i<=N;++i)factorial[i]=(factorial[i-1]*i)%mod;
		inv = new long[N+1];
		for(int i=0;i<=N;++i)inv[i]=inverse(factorial[i]);

		for(int i=0;i<=N;++i){
			int n = i;
			if((K-(n*(long)A))%(long)B!=0)continue;
			long m = (K-(n*(long)A))/(long)B;
			if(m>N || m<0)continue;
			ans = (ans+(c(N,n)*c(N,(int)m))%mod)%mod;
		}
		out.println(ans);

	} 
 
 
 
 
	public static void main(String[] args){ 
		 solve(); 
		 out.flush(); 
	 } 
	 private static InputStream in = System.in; 
	 private static PrintWriter out = new PrintWriter(System.out); 
 
	 private static final byte[] buffer = new byte[1<<15]; 
	 private static int ptr = 0; 
	 private static int buflen = 0; 
	 private static boolean hasNextByte(){ 
		 if(ptr<buflen)return true; 
		 ptr = 0; 
		 try{ 
			 buflen = in.read(buffer); 
		 } catch (IOException e){ 
			 e.printStackTrace(); 
		 } 
		 return buflen>0; 
	 } 
	 private static int readByte(){ if(hasNextByte()) return buffer[ptr++]; else return -1;} 
	 private static boolean isSpaceChar(int c){ return !(33<=c && c<=126);} 
	 private static int skip(){int res; while((res=readByte())!=-1 && isSpaceChar(res)); return res;} 
 
	 private static double nd(){ return Double.parseDouble(ns()); } 
	 private static char nc(){ return (char)skip(); } 
	 private static String ns(){ 
		 StringBuilder sb = new StringBuilder(); 
		 for(int b=skip();!isSpaceChar(b);b=readByte())sb.append((char)b); 
		 return sb.toString(); 
	 } 
	 private static int[] nia(int n){ 
		 int[] res = new int[n]; 
		 for(int i=0;i<n;++i)res[i]=ni(); 
		 return res; 
	 } 
	 private static long[] nla(int n){ 
		 long[] res = new long[n]; 
		 for(int i=0;i<n;++i)res[i]=nl(); 
		 return res; 
	 } 
	 private static int ni(){ 
		 int res=0,b; 
		 boolean minus=false; 
		 while((b=readByte())!=-1 && !((b>='0'&&b<='9') || b=='-')); 
		 if(b=='-'){ 
			 minus=true; 
			 b=readByte(); 
		 } 
		 for(;'0'<=b&&b<='9';b=readByte())res=res*10+(b-'0'); 
		 return minus ? -res:res; 
	 } 
	 private static long nl(){ 
		 long res=0,b; 
		 boolean minus=false; 
		 while((b=readByte())!=-1 && !((b>='0'&&b<='9') || b=='-')); 
		 if(b=='-'){ 
			 minus=true; 
			 b=readByte(); 
		 } 
		 for(;'0'<=b&&b<='9';b=readByte())res=res*10+(b-'0'); 
		 return minus ? -res:res; 
	} 
} 



Measured memory_bytes: 27092
#include<stdio.h>
int main()
{
    int h,i,j;
    scanf("%d",&h);
    for(i=9;i>=1;i--)
    {
        if(h%i==0)
        {
            j=h/i;
            if(j<=9)
            {
                printf("Yes");
            }
            else printf("No");
            break;
        }
    }
    return 0;
}


Measured memory_bytes: 128
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <cstring>
#include <cmath>
#include <ctime>
#include <algorithm>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <stack>
#include <bitset>
using namespace std;
typedef long long LL;
LL gi () {
    LL ret=0; char ch=getchar();
    while((ch<'0' || ch>'9') && ch!='-') ch=getchar();
    char c=ch=='-'?getchar():ch;
    while(c>='0' && c<='9') ret=ret*10+c-'0',c=getchar();
    return ch=='-'?-ret:ret;
}
LL a,b,c,x,y;
int main () {
    a = gi(); b = gi(); c = gi(); x = gi(); y = gi();
    LL ret = 1e18;
    for(int i=0;i<=((x+y)<<1);i+=1) {
        LL t = max(0ll,x - i/2), p = max(0ll,y - i/2);
        LL cur = t * a + p * b + c * i;
        ret = min(ret,cur);
    }
    cout << ret;
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <queue>
#include <set>
#include <map>

using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
ll ans;
ll N, K;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setprecision(10) << fixed;
    cin >> N >> K;
    ll l = 0, r = 0;
    for(int i = 1; i <= N+1; i++){
        l += i-1;
        r += N-i+1;
        if(i >= K) ans += r-l+1;
        ans %= MOD;
    }
    cout << ans << endl;
}

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

using ll = long long;

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	string s;
	cin >> s;
	cout << (s == "ABC" ? "ARC" : "ABC");
	return 0;
}


Measured memory_bytes: 3640
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<iostream>
#include<cstring>
#include<string>
#include<map>
#include<vector>
using namespace std;
typedef long long ll;
const int maxn = 110;
const int inf = 0x3f3f3f3f;
int n, m;
int main() 
{
	int t;
	scanf("%d", &t);
	if (t == 7 || t == 5 || t == 3)
		printf("YES\n");
	else
		printf("NO\n");
	return 0;
}

Measured memory_bytes: 256
while True:
    a,b=map(int,input().split())
    if a==0 and b==0:break
    f=[[0 for i in range(b)]for j in range(a)]
    for i in range(a):
        for j in range(b):
            if i==0 or i==a-1 or j==0 or j==b-1:
                f[i][j]=1
    for i in range(a):
        for j in range(b):
            if f[i][j]==1:
                print('#',end='')
            else :
                print('.',end='')
        print()
    print()


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

using namespace std;

int main()
{
	int N, M;
	
	cin >> N >> M;
	
	vector<int> X(M);
	
	for (int i = 0; i < M; i++) {
		cin >> X[i];
	}
	
	sort(X.begin(), X.end());
	
	vector<int> D(M);
	
	//差分計算
	for (int i = 0; i < M - 1; i++) {
		D[i] = X[i + 1] - X[i];
	}
	
	//差分並び替え
	sort(D.begin(), D.end());
	
	int ans = 0;
	
	for (int i = 0; i < M - (N - 1); i++) {
		ans += D[i];
	}
	
	cout << ans << endl;
}

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

typedef long long ll;
 
using tpl = tuple<int, int, int>;
typedef pair<int,int> pii;

void fastStream(){cin.tie(0);std::ios_base::sync_with_stdio(0);}
const int mod = 998244353;
string S;

ll dp[4010][4010][2];

ll rec(int b, int r,int fin){
    if(dp[b][r][fin]>=0) return dp[b][r][fin];
    ll res = 0;
    int pos = b + r;
    if(fin == 1){
        int cr = r; int cb = b;
        if(cr + cb == 0){
            res = 1;
        }
        else{
            if(cr > 0){
                res = (res + rec(cb, cr - 1, fin)) % mod;
            }
            if(cb > 0){
                res = (res + rec(cb - 1, cr, fin)) % mod;
            }
        }        
    }
    else if(pos == (int)S.size()){
        res = rec(b, r, 1);
    }
    else{
        int cb = b;
        int cr = r;
        if(S[pos] == '0'){
            cr += 2;
        }
        else if(S[pos] == '2'){
            cb += 2;
        }
        else{
            cr++;
            cb++;
        }
        if(cr > 0){
            res = (res + rec(cb, cr - 1, fin)) % mod;
        }
        if(cb > 0){
            res = (res + rec(cb - 1, cr, fin)) % mod;
        }
    }

    return dp[b][r][fin] = res;
}

int main(){

    cin >> S;
    memset(dp, -1, sizeof(dp));
    cout << rec(0, 0, 0)<< endl;

    return 0;
}



Measured memory_bytes: 251776
#include<iostream>
#include<string>
#include<set>
#include<algorithm>

using namespace std;

set<string> data;

void solve(const string& str){
  if(str.size() == 1) return;
  if(data.find(str) != data.end()) return;
  string s = str.substr(0, str.size()/2);
  string t = str.substr(str.size()/2);
  if(s == t){ solve(s); return; }
  data.insert(str);
  solve(s); solve(t);
}

int main(){
  int n;
  string s;
  data.clear();
  cin >> n >> s;
  solve(s);
  cout << data.size() << endl;
  return 0;
}

Measured memory_bytes: 1240
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef double db;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define rep(i,l,r) for(int i=(l);i<(r);++i)
#define dd(x) cout << #x << " = " << x << ", "
#define de(x) cout << #x << " = " << x << endl
//-------
ll N;
void solve() {
	rep(n, 1, 3500 + 1)
		rep(w, n, 3500 + 1) {
			ll P = 4ll * n * w - (w + n) * N;
			ll Q = N * n * w;
			if (P <= 0) continue;
			if (Q % P == 0) {
				int h = Q / P;
				printf("%d %d %d\n", h, n, w);
				return ;
			}
		}
}
int main() {
	cin >> N;
	solve();
	return 0;
}

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

int main(){
  string s;
  string t;
 
  cin >>s;
  cin >>t;
  
  int res=0;
  for(int i=0;i<s.size();i++){
    if(s[i]!=t[i]) res++;
  }
  
  cout << res <<endl;   
return 0;
}


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

bool solve() {
    ll N, sa = 0;
    cin >> N;
    vector<ll> A(N);
    for ( int i = 0; i < N; i++ ) {
        cin >> A[i];
        sa += A[i];
    }
    ll nn = N*(N+1)/2;
    if ( sa % nn != 0 ) return false;
    ll k = sa / nn;
    for ( int i = 0; i < N; i++ ) {
        ll d = - ( A[(i+1)%N] - A[i] - k );
        if ( d < 0 || d % N != 0 ) return false;
    }
    return true;
}

int main() {
    string ans = solve() ? "YES" : "NO";
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 1024
//Resting_Prince
#include<bits/stdc++.h>
#define mod 1000000007
#define inf 1e18
#define PI 3.141592653589
#define fi first
#define se second 
#define sv(v) sort(all(v));reverse(all(v))
#define all(v) v.begin(),v.end()
#define rep(i,a,b) for(ll i=a;i<=b;i++)
#define repr(i,a,b) for(ll i=a;i>=b;i--)
#define pb push_back
#define mk make_pair
#define en '\n'
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef long double ld;

ll dp[200005],n,k;
vector<ll> g[200005];

void dfs(ll node,ll p,ll c1,ll c2)
{
    ll wex=k-c1-c2,t=0;
    dp[node]=wex;
    for(auto y:g[node])
    {
        if(y==p)continue;
        dfs(y,node,1,c1+t);
        t++;
    }   
}

int main()
{
    ll i,j,l;
    cin>>n>>k;
    rep(i,0,n-2)
    {
        cin>>j>>l;
        g[j].pb(l);g[l].pb(j);
    }dfs(1,-1,0,0);
    ll ans=1;
    rep(i,1,n)
    {   //cout<<dp[i]<<" ";
        ans*=(dp[i]);
        ans%=mod;
    }cout<<ans%mod<<en;
    //cout<<1522054186920312832%mod;
    return 0;
}


Measured memory_bytes: 14208
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <deque>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <ctime>
#include <iterator>
#include <bitset>
#include <numeric>
#include <list>
#include <iomanip>
using namespace std;
#define ll int64_t
const long MOD = 1e9 + 7;
const long LINF = 1e13;
const long LLINF = 1e18;
const long ALPHABET = 26;

template <class T>
void Swap(T& r, T& l) {
  T tmp = r;
  r = l;
  l = tmp;
}


int main() {

  long w, h, H,W;
  // string s;
  // vector<pair<long,long>> ft(3);
  // vector<long> b(3);

  // vector<long> count(4,0);
  cin >> H >> W ;
  cin >> h >> w ;

  // for(int i=0;i<3;i++){
  //   cin >> a >> b ;
  //   // ft[i] = make_pair(a, b);
  //   count[a-1]++;
  //   count[b-1]++;
  // }


  long an = H*W;
  // bool ans = true;


  // for(int i=0;i<4;i++){
  //   if (count[i]>=3)ans=false;
  // }

  an -= h * W + w * H - h*w;
  
  cout << an;




  // if (ans){
  //   cout << "YES" <<endl;
  // }else{
  //   cout << "NO" <<endl;
  // }


}




















Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define lli long long int
int main(){
	lli n,k;
	cin>>n>>k;
	lli arr[n];
	for(lli i=0;i<n;i++)
	cin>>arr[i];
	lli dp[n];
	for(lli i=0;i<n;i++){
		dp[i]=INT_MAX;
	}
	dp[0]=0;
	for(lli i=0;i<n;i++){
		for(lli j=1;j<=k;j++){
			if(i+j<n)
			dp[i+j]=min(dp[i+j],dp[i]+abs(arr[i]-arr[i+j]));
		}
	}
	cout<<dp[n-1];
	return 0;
}


Measured memory_bytes: 1792
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES 
#include<iomanip> 
#include<cmath>  
#include<iostream>
#include<fstream>
#include<vector>
#include<algorithm>
#include<numeric>
#include<bitset>
#include<map>
// #include<unordered_map>
#include<set>
// #include<unordered_set>
#include<queue>
#include<deque>
#include<stack>
#include<functional>
using namespace std;
typedef long long ll;
#define repi(i,a,b) for(ll i = (ll)(a) ; i < (ll)(b) ; i++)
#define repd(i,a,b) for(ll i = (ll)(a) ; i > (ll)(b) ; i--)
#define rd(x) cin >> x
#define wr(x)  cout << x
#define wrln(x) cout << x << endl
#define wl() cout << endl
const ll MAX_10p5 = 100010;
const ll MAX_10p9 = 1000000010;
const ll MAX_10p18 = 1000000000000000010;
const ll MOD = 1000000007;
const ll m4x[4] = { 1,0,-1,0 };
const ll m4y[4] = { 0,1,0,-1 };
const ll m8x[8] = { 1,1,0,-1,-1,-1,0,1 };
const ll m8y[8] = { 0,1,1,1,0,-1,-1,-1 };
const ll m9x[9] = { 1,1,0,-1,-1,-1,0,1,0 };
const ll m9y[9] = { 0,1,1,1,0,-1,-1,-1,0 };

struct edge {
	ll from, to, cost;
	bool operator<(const edge& right) const {
		return cost < right.cost;
	}
};
struct point {
	ll x, y, idx;
	bool operator<(const point& right) const {
		return x == right.x ? y < right.y : x < right.x;
	}
};

template<typename T>
T minT(T a, T b) {
	if (a < b) return a;
	else return b;
}

template<typename T>
T maxT(T a, T b) {
	if (a > b) return a;
	else return b;
}

template<typename T>
T absT(T a) {
	if (a < 0) a *= -1;
	return a;
}

template<typename T>
T powT(T a, T x) {
	T res = 1;
	while (x > 0) {
		if (x & 1) res = res * a;
		a = a * a;
		x >>= 1;
	}
	return res;
}

ll StoLL(string str) {
	ll ret = 0, ini = 0;
	if (str[0] == '-') ini = 1;
	repi(i, ini, str.length()) {
		ret *= 10;
		ret += (ll)(str[i] - '0');
	}
	if (ini) ret *= -1;
	return ret;
}

///////////////////////////////////////////////////////////////////////////////////////

string s;
ll k;

int main() {
	cin >> s >> k;
	repi(i, 0, s.length()) {
		ll cost = (26 - (ll)(s[i] - 'a')) % 26;
		if (k >= cost) {
			k -= cost;
			s[i] = 'a';
		}
	}
	k %= 26;
	while (true) {
		if (k == 0)break;
		s[s.length() - 1]++;
		if ((int)(s[s.length() - 1] - 'a') == 26) s[s.length() - 1] = 'a';
		k -= 1;
	}
	wrln(s);
	return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <complex>
#include <map>
#include <set>

using namespace std;

string alpha;
int poses[1001];

int main(){

  for(char ch='a';ch<='z';ch++){
    alpha+=ch;
    poses[ch]=(int)alpha.size()-1;
  }
  for(char ch='A';ch<='Z';ch++){
    alpha+=ch;
    poses[ch]=(int)alpha.size()-1;
  }
  int N;
  while(cin>>N&&N){
    vector<int> keys;
    for(int i=0;i<N;i++){
      int a;
      cin>>a;
      keys.push_back(a);
    }
    string str;
    cin>>str;
    int pos=0;
    for(int i=0;i<(int)str.size();i++){
      int a=keys[pos];
      int op=poses[str[i]];
      op=(op-a+(int)alpha.size())%(int)alpha.size();
      cout<<alpha[op];
      pos=(pos+1)%(int)keys.size();
    }
    cout<<endl;
  }
  
  return 0;
}

Measured memory_bytes: 1228
N,K=list(map(int,input().split()))
a=[]
for i in range(N):
  a.append(int(input()))
a.sort(reverse=True)
ans=a[0]-a[K-1]
for i in range(N-K+1):
  ans = min(ans, a[i]-a[i+K-1])
print(ans)

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

int main(){
int A, B, C, X; cin >> A >> B >> C >> X;

int ans = 0;
for (int a = 0; a <= A; a++) {
    for (int b = 0; b <= B; b++) {
        for (int c = 0; c <= C; c++) {
            if (a*500 + b*100 + c*50 == X) {
                ans++;
            }
        }
    }
}

cout << ans << endl;

}



Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int M=-1000000,m=1000000;
		long S = 0;

		for(int i = 1;i <= n;i++){
			int x = sc.nextInt();
			M = Math.max(M, x);
			m = Math.min(m, x);
			S = S+x;
		}
		System.out.println(m+" "+M+" "+S);
	}
}

Measured memory_bytes: 41292
#include <bits/stdc++.h>
using namespace std;
int main(){
  long long n,b[100000]={},ans=0,tmp;
  cin >> n;
  long long a[n];
  for(int i=0;i<n;i++){
    cin >> a[i];
    b[a[i]]++;
  }
  sort(a,a+n);
  for(int i=0;i<n-2;i++){
    tmp=b[i]+b[i+1]+b[i+2];
    ans=max(ans,tmp);
  }
  if(ans==0){
    ans++;
  }
  cout << ans << endl;
  return 0;
}


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

int main(){
    char a[102][102];
    char b[102][102];
    int h,w;
    cin>>h>>w;
    for(int i=0;i<h;i++){
        cin>>a[i];
    }

    for(int i=0;i<h+2;i++){
        for(int j=0;j<w+2;j++){
            b[i][j]='#';
        }
    }

    for(int i=1;i<h+1;i++){
        for(int j=1;j<w+1;j++){
            b[i][j]=a[i-1][j-1];
        }
    }

    for(int i=0;i<h+2;i++){
        for(int j=0;j<w+2;j++){
            cout<<b[i][j];
        }
        cout<<endl;
    }
}

Measured memory_bytes: 256
#include<cstdio>
#include<string>
#include<cstring>
#include<utility>
#include<cmath>
#include<map>
#include<queue>
#include<set>
#include<algorithm>
#include<vector>
#include<iostream>
#define ll long long
#define pii pair<int,int>
#define mp make_pair
#define fi first
#define se second
#define inf 0x7fffffff
using namespace std;
string s;
vector<int> v;
int main()
{
	int i,j,k,n,m,x,y,la;
	scanf("%d%d",&n,&k);
	cin>>s;
	la=0;
	s+='*';
	if(s[0]=='0')
		v.push_back(0);
	for(i=1;i<=n;i++)
	{
		if(s[i]!=s[i-1])
		{
			v.push_back(i-la);
			la=i;
		}
	}
	if(s[n-1]=='0')
	{
		v.push_back(0);
	}
	int sum=0,ma;
	if(2*k+1>=v.size())
	{
		printf("%d",n);
		return 0;
	}
	for(i=0;i<2*k+1;i++)
	{
		sum+=v[i];
	}
	ma=sum;
	for(i=2*k+1;i<v.size();i+=2)
	{
		sum-=v[i-2*k-1];
		sum-=v[i-2*k];
		sum+=v[i];
		sum+=v[i+1];
		ma=max(ma,sum);
	}
	printf("%d",ma);
	return 0;
}


Measured memory_bytes: 1020
#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>
#include <queue>

using namespace std;

#define fst first
#define snd second
#define all(c) ((c).begin()), ((c).end())

struct UnionFind {
  vector<int> parent; // parent[root] is the negative of the size.
  UnionFind(int n) : parent(n, -1) { };
  bool unite(int u, int v) { 
    u = root(u); v = root(v);
    if (u == v) return false;
    if (parent[u] > parent[v]) swap(u, v);
    parent[u] += parent[v]; parent[v] = u;
    return true;
  }
  bool find(int u, int v) { return root(u) == root(v); }
  int root(int u) { return parent[u] < 0 ? u : parent[u] = root(parent[u]); }
  int size(int u) { return -parent[root(u)]; }
};

int main()
{ 
    int n, m;
    cin >> n >> m;
    
    vector<vector<int>> a(m);
    
    for (int i = 0; i < n; i++) {
        int k;
        cin >> k;
        
        for (int j = 0; j < k; j++) {
            int l;
            cin >> l;
            
            a[l-1].push_back(i);
        }
    }
    
    UnionFind uf(n);
    
    for (int i = 0; i < m; i++) {
        for (int j = 0; j < a[i].size(); j++) {
            uf.unite(a[i][0], a[i][j]);   
        }
    }
    
    if (uf.size(0) == n) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
}


Measured memory_bytes: 4608
import collections
n,k=map(int,input().split())
a=list(map(int,input().split()))

c=collections.Counter(a)
num_kind=len(set(a)) #種類の数
diff = num_kind-k #変更すべき数
values, counts = zip(*c.most_common()[::-1]) #少ない順
print(sum(counts[:diff]))

Measured memory_bytes: 131644
import std.stdio;
import std.string;
import std.conv;

void main() {
	int n;
	scanf("%d\n", &n);
	auto ds = readln.chomp.split.to!(long[]);
	long total = 0;
	foreach(i; 0..ds.length) {
		foreach(j; i+1..ds.length) {
			total += ds[i] * ds[j];
		}
	}
	total.write;
}


Measured memory_bytes: 256
#include <stdio.h>

int main () {
	char str[25];
	scanf("%[^\n]", str);
		
	for (int i =0 ; str [i] != '\0'; i++) {
		if(str[i] != ','){
			printf("%c", str[i]);
		}
		else{
			printf(" ", str[i]);
		}
			
		}
	puts("");
	return 0;
}

Measured memory_bytes: 1668
import java.util.Scanner;

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

    String c = scanner.next();

    // 母音か子音かを判定する（a, i, u, e, oのどれかなら母音）
    // 母音なら"vowel"、子音なら"consonant"
    // *データ型どうしの比較は「==」
    // *オブジェクトどうしの比較は「.equals」
    switch(c) {
      case "a":
      case "i":
      case "u":
      case "e":
      case "o":
        System.out.println("vowel");
        break;
      default:
        System.out.println("consonant");
    }
  }
}


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

using namespace std;

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

    for (int i = 0; i < s.length(); ++i) {
        if(s[i] == '7') {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;

}




Measured memory_bytes: 3624
#![allow(non_snake_case)]
#![allow(dead_code)]
#![allow(unused_macros)]
#![allow(unused_imports)]

use std::str::FromStr;
use std::io::*;
use std::collections::*;
use std::cmp::*;

struct Scanner<I: Iterator<Item = char>> {
    iter: std::iter::Peekable<I>,
}

macro_rules! exit {
    () => {{
        exit!(0)
    }};
    ($code:expr) => {{
        if cfg!(local) {
            writeln!(std::io::stderr(), "===== Terminated =====")
                .expect("failed printing to stderr");
        }
        std::process::exit($code);
    }}
}

impl<I: Iterator<Item = char>> Scanner<I> {
    pub fn new(iter: I) -> Scanner<I> {
        Scanner {
            iter: iter.peekable(),
        }
    }

    pub fn safe_get_token(&mut self) -> Option<String> {
        let token = self.iter
            .by_ref()
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        if token.is_empty() {
            None
        } else {
            Some(token)
        }
    }

    pub fn token(&mut self) -> String {
        self.safe_get_token().unwrap_or_else(|| exit!())
    }

    pub fn get<T: FromStr>(&mut self) -> T {
        self.token().parse::<T>().unwrap_or_else(|_| exit!())
    }

    pub fn vec<T: FromStr>(&mut self, len: usize) -> Vec<T> {
        (0..len).map(|_| self.get()).collect()
    }

    pub fn mat<T: FromStr>(&mut self, row: usize, col: usize) -> Vec<Vec<T>> {
        (0..row).map(|_| self.vec(col)).collect()
    }

    pub fn char(&mut self) -> char {
        self.iter.next().unwrap_or_else(|| exit!())
    }

    pub fn chars(&mut self) -> Vec<char> {
        self.get::<String>().chars().collect()
    }

    pub fn mat_chars(&mut self, row: usize) -> Vec<Vec<char>> {
        (0..row).map(|_| self.chars()).collect()
    }

    pub fn line(&mut self) -> String {
        if self.peek().is_some() {
            self.iter
                .by_ref()
                .take_while(|&c| !(c == '\n' || c == '\r'))
                .collect::<String>()
        } else {
            exit!();
        }
    }

    pub fn peek(&mut self) -> Option<&char> {
        self.iter.peek()
    }
}

fn main() {
    let cin = stdin();
    let cin = cin.lock();
    let mut sc = Scanner::new(cin.bytes().map(|c| c.unwrap() as char));
    let N: usize = sc.get();
    let A: Vec<i64> = sc.vec(N);
    let mut ans = 0;
    if A[0] != 0 {
        println!("-1");
        return;
    }
    for i in 1..N {
        if A[i] == A[i-1] + 1 {
            ans += 1;
        } else if A[i] <= A[i-1] {
            ans += A[i];
        } else {
            println!("-1");
            return;
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 6396
#include <iostream>

using namespace std;

int main(){
    int d;
    int n;
    cin >> d >> n;
    int s = 1;
    for(int i = 0; i < d; i++) s *= 100;{
        if(n <= 99){
            cout << s * n << endl;
        }
        else{
            cout << s * 101 << endl;
        }
    }

}

Measured memory_bytes: 256
import java.util.Scanner;

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

        int correct = 0;
        for (int i = 0; i < 3; i++) {
            if (S.charAt(i) == T.charAt(i)) correct++;
        }

        System.out.println(correct);
    }
}

Measured memory_bytes: 23124
#include <iostream>
#include <math.h>
#include <algorithm>
#include <map>
#include <vector>
using namespace std;
typedef long long ll;
#define rep(i,s,n)for(ll i=s;i<n;i++)
#define repe(i,s,n)for(ll i=s;i<=n;i++)
#define rep_r(i,s,n)for(ll i=n-1;i>=s;i--)
#define repe_r(i,s,n)for(ll i=s;i<=n;i++)
static const ll MOD = 1e9 + 7;
static const double PI = 3.141592653589793;
static const ll MAX_L = (ll)1 << 62;

ll m[31][200001] = {};
ll sum[200001] = {};
int main() {
	ll n, C; cin >> n >> C;

	rep(i, 0, n) {
		ll s, t, c; cin >> s >> t >> c;

		if (m[c][2 * s] < 0) {
			m[c][2 * s]++;
		}
		else {
			m[c][2 * s - 1]++;
		}

		//m[c][2 * s - 1]++;
		m[c][2 * t]--;
	}
	repe(i, 1, C) {
		rep(j, 1, 200001) {
			m[i][j] += m[i][j - 1];
		}
	}

	ll maxV = 0;
	rep(i, 1, 200001) {
		repe(j, 1, C) {
			if (m[j][i] >= 1) {
				sum[i]++;
			}
			//sum[i] += m[j][i];//wrong!!
		}
		maxV = max(maxV, sum[i]);
	}

	cout << maxV << endl;
	return 0;
}

Measured memory_bytes: 49792
from sys import stdin


def get_result(data):
    X, Y, A, B, C = data[0]
    p = sorted(data[1], reverse=True)
    q = sorted(data[2], reverse=True)
    r = sorted(data[3], reverse=True)
    tmp = p[0:X] + q[0:Y] + r
    ans = sum(sorted(tmp, reverse=True)[0:(X+Y)])
    return ans


if __name__ == '__main__':
    raw_data = [val.rstrip('\n') for val in stdin.readlines()]
    data = [list(map(int, val.split(' '))) for val in raw_data]
    result = get_result(data)
    print(result)

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

#define SIZE_OF_ARRAY(array) sizeof(array)/sizeof(array[0])

int main() {
    string S;
    cin >> S;
    if(S[2]==S[3] && S[4] == S[5]){
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}


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

using namespace std;
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define sz(x) ll(x.size())
typedef long long ll;
typedef pair<int, int> P;
const ll INF = 1001001001;

const int mod = 1000000007;

int main() {

    set<ll> p;
    for (int i = 0; i < 1000; i++) {
        p.insert(i * i);
    }

    int n, d;
    cin >> n >> d;

    vector<vector<int>> s = vector<vector<int>>(n, vector<int>(d, 0));

    rep(i, n) {
        rep(j, d) {
            cin >> s[i][j];
        }
    }

    int ans = 0;

    for (int i = 0; i < n; i++) {
        for (int j = i + 1; j < n; j++) {

            int sum = 0;
            for (int sd = 0; sd < d; sd++) {
                int z = s[i][sd] - s[j][sd];
                sum += z * z;
            }
            if (p.find(sum) != p.end()) {
                ans++;
            }
        }
    }

    cout << ans << endl;

}



Measured memory_bytes: 256
//#pragma comment(linker, "/STACK:102400000,102400000") 
#pragma warning(disable:4996)
#include <fstream>
#include <iostream>
#include <functional>
#include <algorithm>
#include <cstring>
#include <vector>
#include <string>
#include <cstdio>
#include <cmath>
#include <queue>
#include <stack>
#include <deque>
#include <ctime>
#include <list>
#include <set>
#include <map>
using namespace std;

typedef long long ll;
#define eps 1e-10
#define LL_INF 0x33ffffffffffffff
#define INF 0x3f3f3f3f
#define mem(a, b) memset(a, b, sizeof(a))
#define pper(i,n,m) for(int i = n;i >= m; i--)
#define repp(i, n, m) for (int i = n; i <= m; i++)
#define rep(i, n, m) for (int i = n; i < m; i++)
#define sa(n) scanf("%d", &(n))
#define mp make_pair
#define ff first
#define ss second
#define pb push_back

const int maxn = 20;
const ll mod = 1e9 + 7;
const double PI = acos(-1.0);
const ll hax = 1e6 + 7;

const int MOD = 1e9 + 7;

int n, x, y, z;
ll dp[44][1 << 18];

void solve()
{
	int i, j, k;
	int mask = 0;
	sa(n), sa(x), sa(y), sa(z);

	mask |= (1 << z);
	mask |= (1 << (y + z));
	mask |= (1 << (x + y + z));
	int s = (1 << (x + y + z + 1));
	s--;
	ll res = 10;
	for (i = 2; i <= n; i++)
	{
		res = res * 10 % mod;
	}
	mem(dp, 0);
	dp[0][1] = 1;
	for (i = 1; i <= n; i++)
	{
		for (int sta = 0; sta <= s; sta++)
		{
			for (k = 1; k <= 10; k++)
			{
				int state = ((sta << k)&s) + 1;
				if ((state&mask) == mask)continue;
				dp[i][state] += dp[i - 1][sta];
				dp[i][state] %= mod;
			}
		}
	}
	for (int sta = 0; sta < s; sta++)
	{
		res = res - dp[n][sta];
		res %= mod;
	}
	res = (res%mod + mod) % mod;
	printf("%lld\n", res);
}

int main()
{
	solve();
	return 0;
}


Measured memory_bytes: 90368
from bisect import bisect_left,bisect_right
import string 

dic = {c:[] for c in string.ascii_lowercase}

n = int(input())
s = list(input())
q = int(input())

for i,c in enumerate(s,start=1):
  dic[c].append(i)
  
for i in range(q):
  p,l,r = map(str,input().split())
  if p =='1':
    j = int(l)
    if r == s[j-1]:
      continue
    c = s[j-1]    
    dic[c].pop(bisect_left(dic[c],j))
    dic[r].insert(bisect_left(dic[r],j),j)
    s[j-1] = r
  else:
    ans = 0
    l = int(l)
    r = int(r)
    for c in string.ascii_lowercase:
      pl = bisect_left(dic[c],l)
      if pl < len(dic[c]):
        if dic[c][pl] <= r:
          ans += 1
    print(ans)

Measured memory_bytes: 29064
//Pantyhose(black) + glasses = infinity

#include <bits/stdc++.h>
using namespace std;
 
#define debug(x) cerr << #x << " = " << x << '\n';
#define BP() cerr << "OK!\n";
#define PR(A, n) {cerr << #A << " = "; for (int _=1; _<=n; ++_) cerr << A[_] << ' '; cerr << '\n';}
#define PR0(A, n) {cerr << #A << " = "; for (int _=0; _<n; ++_) cerr << A[_] << ' '; cerr << '\n';}
#define FILE_NAME "data"

int64_t n, p;
int64_t res = 1;

int64_t pw(int64_t n, int64_t k) {
	if (k==0)
		return 1;
	int64_t tmp = pw(n, k/2);
	if (k%2)
		return tmp * tmp * n;
	return tmp * tmp;
}

void solve(int64_t p) {
	for (int64_t i=2; i*i<=p; ++i) {
		if (p%i==0) {
			int cnt = 0;
			while (p%i==0) {
				++cnt;
				p /= i;
			}
			res = res * pw(i, cnt/n);
			return solve(p);
		}
	}

	res *= pw(p, 1/n);
}

int main() {
	#ifdef GLASSES_GIRL
		freopen(FILE_NAME".inp", "r", stdin);
		freopen(FILE_NAME".out", "w", stdout);
	#endif
	ios::sync_with_stdio(0); cin.tie(0);
	cin >> n >> p;
	solve(p);
	cout << res;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    int K = scan.nextInt();
    String S = scan.next();
    int x = S.length();
    if(x > K){
      String ans = S.substring(0,K);
      System.out.println(ans + "...");
    }else{
      System.out.println(S);
    }
  }
}

Measured memory_bytes: 38568
#include <bits/stdc++.h>
using namespace std;
const long long int mod = 1000000007;

int main() {
	long long N, M;
	cin >> N >> M;
	long long ans=0;
	if (2*N >M) {//Sが余る場合はccを最大限作る
		//cout << "c";
		ans = M / 2;
	}
	else {//Cが余る場合
		ans += N;
		M -= 2 * N;
		ans += M / 4;
	}
	cout << ans;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
  int i,a[3],m=0,k;
  for(i=0;i<3;i++){
    scanf("%d",&a[i]);
  }
  scanf("%d",&k);
  for(i=0;i<3;i++){
    if(a[i]>=k){
      m+=k*(1-i);
      break;
    }
    m+=a[i]*(1-i);
    k-=a[i];
  }
  printf("%d",m);
  return(0);
}

Measured memory_bytes: 1732
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<ctime>
#include<cctype>
#include<climits>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<memory>
#include<functional>
#include<set>
 
using namespace std;
 
#define ALL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define P(p) cout<<(p)<<endl;
#define PP(p) cout<<(p)<<" ";
#define INF 1e18

typedef long long ll;
#define int ll
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pi;
//int dy[8]={1,1,1,0,-1,-1,-1,0};
//int dx[8]={-1,0,1,1,1,0,-1,-1};
int dx[4]={0,1,0,-1};
int dy[4]={1,0,-1,0};
int n,m,x;
vi c;
vvi a;
int ans = INF;
bool check(vi t){
    bool f = true;
    rep(i,t.size()){
        if(t[i]<x)f = false;
    }
    return f;
}
void rec(int i,vi t,int sum){
    if(i>=n){
        if(check(t))
            ans=min(ans,sum);
        return;
    }
    rec(i+1,t,sum);
    rep(j,m){
        t[j]+=a[i][j];
    }
    rec(i+1,t,sum+c[i]);

    return;
}
signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin>>n>>m>>x;
    c.resize(n+1);
    a.resize(n+1,vi(m+1));
    rep(i,n){
        cin>>c[i];
        rep(j,m){
            cin>>a[i][j];
        }
    }
    vi t(m,0);
    rec(0,t,0);
    if(ans==INF)cout<<"-1"<<endl;
    else
        cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3596
#include <bits/stdc++.h> 
using namespace std;
///////////////////////////////////////////
const long long int INF = INT32_MAX;
const long long int Mod = 1000000007;
const long long int mod = 100000;//10^5
using ll = long long int; //long long int は64bit
using ci = const int; using vi = vector<int>; using Vi = vector<long long int>; using pii = pair<int,int>;
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define mt make_tuple
#define all(x) (x).begin(),(x).end()
#define rep(i,N) for(int i=0;i<N;i++)
#define np nullptr
template<class T>bool chmax(T &former, const T &b) { if (former<=b) { former=b; return true; } return false; }
template<class T>bool chmin(T &former, const T &b) { if (b<former) { former=b; return true; } return false; }
template<class T>T sqar(T x){ return x*x; }//sqrt(x)は平方根;
#define Sort(v) std::sort(v.begin(), v.end(), std::greater<decltype(v[0])>()) //降順でVをソート
#define fill(x,num) memset(x,num,sizeof(x));
typedef vector<vector<ll> > matrix;
//       cin.tie(0);ios::sync_with_stdio(false);
void cinit(){cin.tie(0);ios::sync_with_stdio(false);}
//////////////////////////^^ *Emile ^^^//////////////////////////////////////////////////////

vi v;

int main(){
	ll aa=0;
	ll n,a,b;cin>>n>>a>>b;
	rep(i,n){
		cin>>aa;v.pb(aa);
	}
	sort(all(v));
	ll ax=0;ll bx=n;
	rep(i,n){
		if(v[i]>a){ax=i;break;}
	}
	rep(i,n){
		if(v[i]>b){bx=i;break;}
	}
	ll ans = min(ax,bx-ax);
	ans = min(ans,n-bx);
	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 PI acos(-1)

using namespace std;
using ll = long long;
using P = pair<int, int>;
using LP = pair<ll, ll>;

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

    ll n, q;
    cin>>n>>q;
    vector<vector<int>> es(n);
    vector<ll> nodes(n);
    rep(i, n - 1) {
        int a, b;
        cin>>a>>b; a--; b--;
        es[a].push_back(b);
        es[b].push_back(a);
    }

    rep(i, q) {
        int p, x;
        cin>>p>>x; p--;

        nodes[p] += x;
    }

    queue<LP> que;
    que.push(LP(0, 0));
    vector<ll> visited(n, -1);
    while (!que.empty()) {
        LP lp = que.front(); que.pop();
        ll v = lp.first;
        ll w = lp.second;
        if (visited[v] != -1) continue;

        visited[v] = nodes[v] + w;
        for (auto e : es[v]) {
            que.push(LP(e, nodes[v] + w));
        }
    }

    rep(i, n - 1) cout<<visited[i]<<" ";
    cout<<visited[n - 1]<<endl;
}

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

namespace AtCoder.Heuristics
{
    class Introduction
    {
        private static int GeneN = 50;

        private static int DayN;

        private static int ContestN = 26;

        private static int[] c;

        private static int[][] s;

        private static int sumC;

        class Gene
        {
            public int[] Contest;
            public int[] Score;
            public Gene()
            {
                Contest = new int[DayN + 1];
                Score = new int[DayN + 1];
            }
        }

        public static void Score(int[] t, int[] v)
        {
            var last = new int[DayN + 1];
            var sum = c.Sum();
            var dec = 0;
            v[0] = 0;
            for (int i = 1; i <= DayN; i++)
            {
                dec += sum - (c[t[i]] * (i - last[t[i]]));
                last[t[i]] = i;
                v[i] = v[i-1] - dec + s[i][t[i]];
            }
        }

        public static void Main()
        {
            DayN = int.Parse(Console.ReadLine());
            c = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();

            c.Select((index, x) => (index: index, c: x)).OrderByDescending(x => x.c);

            sumC = c.Sum();

            s = new int[DayN + 1][];

            List<int[]> gene = new List<int[]>();

            var random = new Random();

            var seed = Enumerable.Range(0, 26);

            
            seed.OrderBy(x => random.Next());


            var t = new int[DayN + 1];
            for (int i = 1; i <= DayN; i++)
                s[i] = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();

            t = InitByGreedy();
            for (int i = 1; i <= DayN; i++)
                Console.WriteLine(t[i] + 1);
        }


        private static int[] InitByGreedy()
        {
            var gene = new int[DayN + 1];
            var last = new int[DayN + 1];
            var sum = c.Sum();
            for (int i = 1; i <= DayN; i++)
            {
                int max = int.MinValue;
                int maxIndex = 0;
                for (int j = 0; j < ContestN; j++)
                {
                    var temp = c[j] * last[j] + s[i][j];
                    if (max < temp)
                    {
                        max = temp;
                        maxIndex = j;
                    }
                }
                last[maxIndex] = i;
                gene[i] = maxIndex;
            }
            return gene;
        }
    }
}


Measured memory_bytes: 28948
X = int(input())

X_mod = X%100
X_count = X//100

count = 0
for i in reversed(range(1,6)):
  count += X_mod//i
  X_mod = X_mod%i

ans = 0
if count <= X_count:
  ans = 1
else:
  ans = 0

print(ans)


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

using namespace std;
using ll =long long;
#define For(i, a, b)    for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)
#define debug(x)  cerr << #x << " = " << (x) << endl;
#define leftunique(a) {sort((a).begin(),(a).end());(a).erase(unique((a).begin(),(a).end()),(a).end());}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
static const ll INF = 1LL << 60;
//Write From this Line

using pii = pair<int,int>;
vector<pii> G[2010];
int min_cost[2010];
int n, k;
void dijkstra(int s){
	/*sから各頂点への最短距離を求めていく。*/
	//initialize
	fill(min_cost, min_cost + n, INF);
	min_cost[s] = 0 ;
	priority_queue<pii,vector<pii>, greater<pii>> QUE;
	QUE.push(pii(0,s));//距離、頂点
	while(!QUE.empty()){
		int cur_cost = QUE.top().first ;
		int cur_vert = QUE.top().second ; QUE.pop();
		for(int i = 0 ; i < G[cur_vert].size() ; i++){
			int to , cost ;
			to = G[cur_vert][i].first ;
			cost = G[cur_vert][i].second ;
			int next_cost = cur_cost + cost ;
			if(next_cost < min_cost[to]){
				min_cost[to] = next_cost;
				QUE.push(pii(next_cost,to));
			}
		}
	}
}
int main()
{
	ll n , x, y;
	cin >> n  >> x >> y;
	--x, --y;
	// O(N^2)
	map<int,int> mp;
	rep(i,n){
		for(int j = i +1 ; j < n ; j++){
			// 単純なi と j の距離
			// i　から x 、x から y 、ｙからj
			ll tmp;
			tmp = abs(x - i) + 1; //今yまでキた
			tmp += abs(y - j);
			tmp =min((ll)j - i,tmp);
			mp[tmp] ++;
		}
	}
	For(i,1,n){
		cout << mp[i] << endl;
	}
}


Measured memory_bytes: 384
import java.util.*;
public class Main{
public static void main(String[]args){
Scanner sc=new Scanner(System.in);
  int n=sc.nextInt();int m=sc.nextInt();int x=sc.nextInt();
  int po[]=new int[n+1];
  for(int i=0;i<m;i++){
  po[sc.nextInt()]++;
  }
  int r=0,l=0;
  for(int i=x;i<=n;i++){
  	r+=po[i];
  }
  for(int i=0;i<=x;i++){
  	l+=po[i];
  }
  System.out.println(Math.min(r,l));
}
}


Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    int n;
    cin>>n;
    ll a[n];
    map <ll,ll> m;
    for(int i=0;i<n;i++){
        cin>>a[i];
        m[a[i]]++;
    }
    ll s=0,x,ans;
    for(map <ll,ll>::iterator it=m.begin();it!=m.end();it++){
        x=it->second;
        s+=(x*(x-1))/2;
    }
    for(int i=0;i<n;i++){
        x=m[a[i]];
        ans=s-(x*(x-1))/2;
        ans+=((x-1)*(x-2))/2;
        cout<<ans<<"\n";
    }
    return 0;
}


Measured memory_bytes: 11008
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  string S,T;
  cin >> S >> T;
  for(int i=0;i<S.size();i++){
    printf("%c%c",S[i],T[i]);
  }
  printf("\n");
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    int n;
    scanf("%d",&n);
    vector<ll> a(n);
    for(ll& x: a)
        scanf("%d", &x);
    vector<vector<vector<ll>> > dp(n+1, vector<vector<ll> > (n+1 , vector<ll> (2)) );
    for(int l =1; l<= n;l++)
    {
        for(int i = 1; i + l -1 <=n; i++)
        {
            int j = i + l -1;
            if(i==j)
                dp[i][j][0] = dp[i][j][1] = a[i-1];
            else 
                {
                    dp[i][j][0] = max(a[i-1]  - dp[i+1][j][1] , a[j-1] - dp[i][j-1][1]);
                    dp[i][j][1] = max(a[i-1] - dp[i+1][j][0] , a[j-1] - dp[i][j-1][0]);
                }
        }
    }
    cout<<dp[1][n][0]<<"\n";

}

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

int main(){
    int T[101][101],r,c;
    
    cin>>r>>c;
    for(int i=0;i<r;i++ )
    for(int j=0;j<c;j++ )cin>>T[i][j];
    
    for(int i=0;i<=r;i++ )T[i][c]=0;
    for(int j=0;j<=c;j++ )T[r][j]=0;
    
    for(int i=0;i<r;i++ ){
        for(int j=0;j<c;j++ ){
            T[i][c]+=T[i][j];
            T[r][j]+=T[i][j];
            T[r][c]+=T[i][j];
        }
    }
    
    for(int i=0;i<=r;i++ ){
        for(int j=0;j<=c;j++ ){
        if(j)cout<<" ";
        cout<<T[i][j];
        }
        cout<<endl;
    }
    
    
    return 0;
}


Measured memory_bytes: 3104
var input: string = require('fs').readFileSync('/dev/stdin', 'utf8');
var inputLines: string[] = input.trim().split("\n");
var parts = inputLines[0].split(" ");

var A = parseInt(parts[0]);
var B = parseInt(parts[1]);
console.log(A + B > 9 ? "error" : String(A + B));

Measured memory_bytes: 7372
import java.util.Scanner;
public class Main {
	public static int[] qlist;

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		char[] s = sc.next().toCharArray();
		int q = sc.nextInt();
		qlist = new int[q];
		long dcnt = 0,dmcnt = 0,cnt = 0,mcnt = 0;
		int k;
		char c;
		for(int i = 0;i < q;i++) {
			qlist[i] = sc.nextInt();
		}
		sc.close();
		for(int j = 0;j < q;j++) {
			dmcnt = 0;
			dcnt = 0;
			mcnt = 0;
			cnt = 0;
			for(int i = 0;i < n;i++) {
				k = qlist[j];
				if(i - k >= 0) {
					c = s[i-k];
					if(c == 'D') {
						dcnt--;
						dmcnt -= mcnt;
					}
					else if(c == 'M') {
						mcnt--;
					}
				}
				if(s[i] == 'D') {
					dcnt++;
				}
				else if(s[i] == 'M') {
					mcnt++;
					dmcnt += dcnt;
				}
				else if(s[i] == 'C') {
					cnt += dmcnt;
				}
			}
			System.out.println(cnt);
		}

	}
}

Measured memory_bytes: 35348
#include<stdio.h>

int main(void){
    register int i;
    int n,k;
    scanf("%d%d",&n,&k);
    int a[n];
    for (i = 0;i < n;i++)scanf("%d",&a[i]);
    int ans = 1;
    n -= k;
    ans += (n+(k-2)) / (k-1);
    printf("%d",ans);
}

Measured memory_bytes: 512
#include <stdio.h>

int main(int argv, char *argc[]){
    int hex, wide, x, y;
    
    while(1){
        scanf("%d %d", &hex ,&wide);
        
        if(hex == 0 || wide == 0)break;
        
        for(y=0;y<hex;y++){
            for(x=0;x<wide;x++){
                if(!(y%2)){ /* 偶数行(0,2~) */
                    if(!(x%2)){
                        printf("#");/* 偶数列(0,2~) */
                    }else{
                        printf(".");/* 奇数列(1,3~) */
                    }
                }else{      /* 奇数行(0,2~) */
                    if(!(x%2)){
                        printf(".");/* 偶数列(0,2~) */
                    }else{
                        printf("#");/* 奇数列(1,3~) */
                    }
                }
                 
            }
            printf("\n");
        }
        printf("\n");
        
    }
    return 0;
}

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

int main() {
    string s; cin >> s;
    set<char> p;
    for (int i = 0; i < s.size(); i++)
    {
        p.insert(s[i]);
    }
    if(p.size() == s.size()) cout << "yes" << endl;
    else cout << "no" << endl;
        
}

Measured memory_bytes: 256