akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <sstream>
#include <cstdio>
#include <vector>
using namespace std;

bool fizzBuzzCheck(int n,string s){
	if(n%15==0)return (s == "FizzBuzz");
	if(n%3==0)return  (s == "Fizz");
	if(n%5==0)return  (s == "Buzz");
	
	for(int i=0;i<s.length();i++) if(s[i]<'0'||s[i]>'9')return false;

	return (atoi(s.c_str()) == n);
}

int main(){
	int n,m;
	string s;
	
	while(scanf("%d %d\n",&m,&n), m){
	
		vector<int> rem(m);
		for(int i=0;i<m;i++){
			rem[i] = i+1;
		}
		int c = 0;
		for(int i=1;i<=n;i++){
			getline(cin,s);
			if(rem.size() == 1)continue;
			if( !fizzBuzzCheck(i,s) ){
				rem.erase(remove(rem.begin(),rem.end(),rem[c]),rem.end());
			}else{
				c++;
			}
			c %= rem.size();
		}
		for(int i=0;i<rem.size();i++){
			cout << (i?" ":"") << rem[i];
		}
		cout << endl;
	}
}

Measured memory_bytes: 968
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <functional>
using namespace std;


int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
    int n, l[100100], r[100100];
    cin >> n;
    int sum = 0;
    for (int i = 0; i < n; i++) {
        cin >> l[i] >> r[i];
        sum += (r[i] - l[i] + 1);
    }
    cout << sum << endl;
	return 0;
}

Measured memory_bytes: 256
n, y = map(int, input().split())

for i in range(n + 1):
    for j in range(n - i + 1):
        k = n - i - j
        if k >= 0 and 10000 * i + 5000 * j + 1000 * k == y:
            print(i, j, k)
            exit()

print('-1 -1 -1')


Measured memory_bytes: 9064
#include<stdio.h>

long long min(long long x, long long y){
  return x < y ? x : y;
}

int main(){
  long long N, A, B;
  scanf("%lld%lld%lld", &N, &A, &B);
  
  if((A ^ B) & 1){
    printf("%lld\n", min(A - 1, N - B) + (B - A + 1) / 2);
  }else{
    printf("%lld\n", (B - A) / 2);
  }
  
  return 0;
}



Measured memory_bytes: 128
#include <iostream>

using namespace std;

typedef long long ll;

int main()
{
    ios::sync_with_stdio(0);
    ll n, k, ans=0;
    cin >> n >> k;
    for(ll b=k+1; b<=n; ++b)
    {
        ans+=(n/b)*(b-k);
        ans+=max(0LL, n%b-k+(k!=0));
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
#define rep(i,n) for (ll i=0;i<(n);++i)
#define rep2(i,a,b) for (ll i=(a);i<(b);++i)
#define debug(x) cout << #x << '=' << x << endl
#define all(v) (v).begin(),(v).end()
const ll MOD=1e9+7;
//const ll MOD=998244353;
const ll INF=1e9;
const ll IINF=1e18;
const double EPS=1e-8;
const double pi=acos(-1);

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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,m; cin >> n >> m;
    vector<int> c(m);
    rep(i,m) cin >> c[i];
    vector<int> dp(n+1,INF);
    dp[0]=0;
    rep(i,m) rep2(j,c[i],n+1){
        chmin(dp[j],dp[j-c[i]]+1);
    }
    cout << dp[n] << endl;
}


Measured memory_bytes: 3232
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main(void)
{
    int n = 0;
    int ans = 0;
    vector<int> p(n);
    cin >> n;
    for (size_t i = 0; i < n; i++)
    {
        int tmp;
        cin >> tmp;
        p.push_back(tmp);
    }
    sort(p.begin(), p.end());
    for (size_t i = 0; i < n - 1; i++)
    {
        ans += p[i];
    }
    ans += p[n - 1] / 2;
    cout << ans << endl;
    return 0;
}

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

using namespace std;

const int N = 8e3 + 100;

string s, sx, sy;
int x, y;

int pos(const int p) {
    return p + N;
}

bool now[2 * N], next_pos[2 * N];
void search(const string s) {
    int move = 0;
    for (int i = 0; i < s.size(); i++) {
	if (s[i] == 'T') {
	    for (int j = -N; j < N; j++) {
		if (now[pos(j)]) {
		    next_pos[pos(j + move)] = true;
		    next_pos[pos(j - move)] = true;
		}
	    }
	    move = 0;
	    copy(next_pos, next_pos + 2 * N, now);
	    fill(next_pos, next_pos + 2 * N, false);
	}
	else
	    move++;
    }
}

int main() {
    cin >> s >> x >> y;
    bool x_axis = true;
    for (auto &itr : s) {
	if (x_axis)
	    sx += itr;
	else
	    sy += itr;
	if (itr == 'T')
	    x_axis = !x_axis;
    }
    sx = sx + 'T';
    sy = sy + 'T';
    now[pos(0)] = true;
    search(sy);
    if (now[pos(y)] == false) {
	cout << "No" << endl;
	return 0;
    }
    fill(now, now + 2 * N, false);
    int movex = 0;
    for (int i = 0; i < sx.size(); i++) {
	if (sx[i] == 'T') {
	    now[pos(movex)] = true;
	    sx = sx.substr(i + 1);
	    break;
	}
	else {
	    movex++;
	}
    }
    search(sx);
    if (now[pos(x)] == false) {
	cout << "No" << endl;
	return 0;
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 256
n, m = map(int, input().split())
ls = [(0, 0) for _ in range(n)]


for i in range(n):
    a, b = map(int, input().split())
    ls[i] = (a, b)

ls = list(sorted(ls))

i = 0
_m = 0
total = 0

while _m < m:
    a, b = ls[i]
    _m += b
    total += a * b
    i += 1

a, b = ls[i - 1]
print(total - (_m - m) * a)


Measured memory_bytes: 18180
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

int main(){
	int n,i,j,k,a[100],tmp,count=0;
	char input[4001],*p;
	
	fgets(input,sizeof input,stdin);
	sscanf(input,"%d",&n);
	
	fgets(input,sizeof input,stdin);
	p=strtok(input," ");
	a[0]=atoi(p);
	
	for(i=1;i<n;i++){
		p=strtok(NULL," ");
		a[i]=atoi(p);
	}
	
	k=n-1;
	for(i=0;i<n-1;i++){
		for(j=0;j<k;j++){
			if(a[j]>a[j+1]){
				tmp=a[j];
				a[j]=a[j+1];
				a[j+1]=tmp;
				count++;
			}
		}
		k--;
	}
	for(i=0;i<n;i++){
		printf("%d",a[i]);
		if(i!=n-1){
			printf(" ");
		}
	}
	printf("\n%d\n",count);
	
	
	
	
	return 0;
}

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

int main() {
    //
    int X,N;
    cin >> X >> N;
    
    if (N==0) {
        cout << X << endl;
        exit(0);
    }
    
    vector<int> p(N);
    for (int i=0; i<N; i++) {
        cin >> p.at(i);
    }
    sort(p.begin(),p.end());

    //
    vector<int> num;
    for (int i=0; i<=101; i++) {
        for(int j=0; j<N; j++) {
            if (i == p.at(j)) {
                break;
            }
            if (j == N-1) {
                num.push_back(i);
            }
        }
        
    }

    //
    vector<int> d(num.size());
    for (int i=0; i<num.size(); i++) {
        d.at(i) = abs(X-num.at(i));
    }
    sort(d.begin(),d.end());

    //
    for (int i=0; i<d.size(); i++) {
        if (num.at(i) == X-d.at(0)) {
            cout << X-d.at(0) << endl;
            exit(0);
        }
    }
    cout << X+d.at(0) << endl;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
using i64 = int64_t;
using f80 = __float80;
static const int dy[4] = {0,1,0,-1}, dx[4] = {1,0,-1,0};
constexpr i64 INF = 1'010'000'000'000'000'017LL;
constexpr i64 MOD = 1'000'000'007LL;
#define _overload3(_1,_2,_3,name,...) name
#define repi(i,start,end) for(i64 i=(start);i<(end);++i)
#define _rep(i,n) repi(i,0,n)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define rrep(i,start,end) for(i64 i=(start);i>end;--i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define v(T) vector<T>
#define vv(T) v(v(T))
typedef v(i64) vi;
typedef v(vi) vvi;
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<typename T> ostream &operator<<(ostream &os, const vector< T > &v){
  rep(i,v.size()) os << v[i] << (i + 1 != v.size() ? " " : "");
  return os;
}
template<typename T> istream &operator>>(istream &is, vector< T > &v){
  for(T &in : v) is >> in;
  return is;
}

void Main()
{
  i64 N;
  cin >> N;
  cout << 180 * N - 360 << "\n";
}

int main()
{
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  Main();
}

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

#define endl '\n'
#define fi first
#define se second
#define pb push_back
#define debug(x) cout << "[debug] " << #x << ": " << x << endl
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
const int MOD = 1e9 + 7;
const int maxn = 1e6 + 5;
const int inf = 0x3f3f3f3f;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const double eps = 1e-8;
const double PI = acos(-1.0);

char s[maxn];
int l[maxn], r[maxn];

int main() {
    int n, k, c;
    scanf("%d%d%d%s", &n, &k, &c, s + 1);
    for (int i = 1; i <= n; i++) {
        l[i] = (s[i] == 'x' ? l[i - 1] : max(l[i - 1], l[max(0, i - c - 1)] + 1));
    }

    for (int i = n; i > 0; i--) {
        r[i] = (s[i] == 'x' ? r[i + 1] : max(r[i + 1], r[i + c + 1] + 1));
    }

    map<PII, int> vis;
    for (int i = 1; i <= n; i++) {
        if (s[i] == 'o' && l[i] + r[i] - 1 == k) {
            vis[{l[i], r[i]}]++;
        }
    }

    for (int i = 1; i <= n; i++) {
        if (s[i] == 'o' && l[i] + r[i] - 1 == k && vis[{l[i], r[i]}] == 1) {
            printf("%d\n", i);
        }
    }
	return 0;
}


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

Measured memory_bytes: 256
#include<iostream>
#include<map>
#include<string>
#include<vector>
#include<algorithm>
#include<numeric>
#include<cmath>
using namespace std;
int inf = 1000000000;

int main(){

  int n;
  cin >> n;
  cin.ignore();
  for(int l=0; l<=n; l++){
    string s;
    getline(cin, s);

    bool f = true;
    for(int i=1; i<50&&f; i++){
      if( i % 2 == 0 || i % 13 == 0 ) continue;
      for(int j=1; j<50&&f; j++){
        string t = s;
        for(int k=0; k<s.size(); k++){
          if( 'a' <= t[k] && t[k] <= 'z' ) t[k]=(i*(t[k]-'a')+j)%26+'a';
        }
        if( t.find("that") != -1 || t.find("this") != -1 ){cout << t << endl; f = false; break;}
      }
    }

  }


  return 0;
}

Measured memory_bytes: 2968
import java.util.Comparator;
import java.util.Scanner;
import java.util.ArrayList;
import java.util.PriorityQueue;
import java.util.Arrays;
	/* static int java.util.Arrays.binarySearch(int[] a, int key); */
import java.math.BigDecimal;
	
 
 
class Main {
	Scanner sc = new Scanner(System.in);
	int n;
	public void run(){
		n = sc.nextInt();
		solve();
	}
	public void solve(){
		if(n < 1000) System.out.println("ABC");
		else System.out.println("ABD");
	}
	
	public static void main(String[] args){
		new Main().run();
	}
	
	static class Pair {
        int first,second;
        public Pair(int a,int b) {
            this.first = a;
            this.second = b;
        }
    }
	static class Edge{
		int to, cost;
		public Edge(int a, int b){
			this.to = a;
			this.cost = b;
		}
	}
	class MyComparator implements Comparator {
		@Override
		public int compare (Object arg0, Object arg1) {
			int x = ((Pair)arg0).first;
			int y = ((Pair)arg1).first;
			
			if (x < y) {
				return 1;
			} else if (x > y) {
				return -1;
			} else{
				return 0;
			}
		}
	}
	static class UnionFind{
		int par[];
		int rank[];
		
		//n要素で初期化
		public UnionFind(int maxn){
			par = new int[maxn];
			rank = new int[maxn];
			
			for(int i = 0; i < maxn; i++){
				par[i] = i;
				rank[i] = 0;
			}
		}
		
		//木の根を求める
		int find(int x){
			if(par[x] == x){
				return x;
			}
			else {
				return par[x] = find(par[x]);
			}
		}
		
		// xとyの属する集合を併合
		void unite (int x, int y){
			x = find(x);
			y = find(y);
			if(x == y){
				return;
			}
			
			if(rank[x] < rank[y]){
				par[x] = y;
			}
			else{
				par[y] = x;
				if(rank[x] == rank[y]) rank[x]++;
			}
		}
		
		// xとyが同じ集合に属するか否か
		boolean same(int x, int y){
			return find(x) == find(y);
		}
	}
}

Measured memory_bytes: 23892
///  author:Kissheart  ///
#include<stdio.h>
#include<algorithm>
#include<iostream>
#include<string.h>
#include<vector>
#include<stdlib.h>
#include<math.h>
#include<queue>
#include<deque>
#include<ctype.h>
#include<unordered_set>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<string>
#define INF 0x3f3f3f3f
#define FAST_IO ios::sync_with_stdio(false)
const double PI = acos(-1.0);
const double eps = 1e-6;
const int MAX=1e6+10;
const long long mod=1e9+7;
typedef long long ll;
using namespace std;
#define gcd(a,b) __gcd(a,b)
inline ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
inline ll qpow(ll a,ll b){ll r=1,t=a; while(b){if(b&1)r=(r*t)%mod;b>>=1;t=(t*t)%mod;}return r;}
inline ll inv1(ll b){return qpow(b,mod-2);}
inline ll exgcd(ll a,ll b,ll &x,ll &y){if(!b){x=1;y=0;return a;}ll r=exgcd(b,a%b,y,x);y-=(a/b)*x;return r;}
inline ll read(){ll x=0,f=1;char c=getchar();for(;!isdigit(c);c=getchar()) if(c=='-') f=-1;for(;isdigit(c);c=getchar()) x=x*10+c-'0';return x*f;}
//freopen( "in.txt" , "r" , stdin );
//freopen( "data.txt" , "w" , stdout );
ll n;
ll a[MAX];
ll sum[MAX];
map<ll,ll>mp;
int main()
{
	mp[0]=1;
	scanf("%lld",&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%lld",&a[i]);
		sum[i]=sum[i-1]+a[i];
		mp[sum[i]]++;
	}
	
	ll ans=0;
	for(int i=0;i<=n;i++)
        ans+=mp[sum[i]]-1;
        
	printf("%lld\n",ans/2LL);

	return 0;
}



Measured memory_bytes: 18432
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;

#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define range(i,a,n) for(int i=(a);i<(n);i++)

#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI 3.1415926535897932384

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

template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class S>S acm(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
void YN(bool b){cout<<(b?"YES":"NO")<<"\n";}
void Yn(bool b){cout<<(b?"Yes":"No")<<"\n";}
void yn(bool b){cout<<(b?"yes":"no")<<"\n";}
int sgn(const double&r){return (r>EPS)-(r<-EPS);} // a>0  : sgn(a)>0
int sgn(const double&a,const double&b){return sgn(a-b);} // b<=c : sgn(b,c)<=0

ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1; for(auto s:t){os<<(a?"":" ")<<s;a=0;} return os;}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n;
	cin>>n;
	range(i,1,100000){
		if((int)(i*1.08)==n){
			cout<<i<<endl;
			return 0;
		}
	}
	cout<<":("<<endl;
}


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

#define rep(i, N) for (int i = 0; i < N; i++)
#define rep1(i, N) for (int i = 1; i <= N; i++)
const int intinf = numeric_limits<int>::max();

using ll = long long int;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

#define MOD 1000000007

int suu[32] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};

void solveA()
{
    int K;
    cin >> K;
    K--;
    cout << suu[K] << endl;
}

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


Measured memory_bytes: 256
#pragma region include
#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <tuple>
#include <bitset>

#include <queue>
#include <complex>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <fstream>
#include <random>
//#include <time.h>
#include <ctime>
#pragma endregion //#include
/////////
#define REP(i, x, n) for(int i = x; i < n; ++i)
#define rep(i,n) REP(i,0,n)
/////////
#pragma region typedef
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
#pragma endregion //typedef
////定数
const int INF = (int)1e9;
const LL MOD = (LL)1e9+7;
const LL LINF = (LL)1e18;
const double PI = acos(-1.0);
const double EPS = 1e-9;
/////////
using namespace::std;

void solve(){
	int N;
	cin >> N;
	vector<int> A(N+1);
	for(int i=1;i<=N;++i){
		cin >> A[i];
	}
	if(N&1 ){
		for(int i=N;i>=1;i-=2){
			if( i != N ) cout << " ";
			cout << A[i];
		}
		for(int i=2;i<=N;i+=2){
			cout << " " << A[i];
		}
	}else{
		for(int i=N;i>=2;i-=2){
			if( i != N ) cout << " ";
			cout << A[i];
		}
		for(int i=1;i<=N;i+=2){
			cout << " " << A[i];
		}
	}
	cout << endl;
}

#pragma region main
signed main(void){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	

	solve();
}
#pragma endregion //main()


Measured memory_bytes: 2944
#include <stdio.h>
#include <stdlib.h>
int comp(const void *a,const void *b){return *(int*)a-*(int*)b;}
int comp2(const void *a,const void *b){return *(int*)b-*(int*)a;}
int main(void){
  int n,m,i,s=0;
  scanf("%d%d",&n,&m);
  int x[m],d[m];
  for(i=0;i<m;scanf("%d",&x[i++]));
  qsort(x,m,sizeof(int),comp);
  for(i=0;i<m-1;i++)d[i]=x[i+1]-x[i];
  qsort(d,m-1,sizeof(int),comp);
  for(i=0;i<m-n;s+=d[i++]);
  printf("%d",s);
}

Measured memory_bytes: 1396
#include <stdio.h>

int main (){
    int temp;
    int n;
    int i;
    int ans;
    temp = scanf("%d", &n);
    i=1;
    while (i<10) {
        ans = n/i;
        if (ans<10){
            if (n==i*ans){
                printf("Yes\n");
                return 0;
            }
        }
        
        i++;
    }
    printf("No\n");
    
    return 0;
}


Measured memory_bytes: 128
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int x = scan.nextInt();
		int y = scan.nextInt();
		boolean f1 = false;
		boolean f2 = false;
		if ((x!=2 && y == 2) ||(x==2 && y!= 2)) {
			System.out.println("No");
			return;
		}
		if (x==1 || x == 3 || x== 5 || x== 7 ||x==8||x==10||x==12) {
			f1 = true;
		}
		if (y==1 || y == 3 || y== 5 || y== 7 ||y==8||y==10||y==12) {
			f2 = true;
		}
		if (f1 == f2) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}


Measured memory_bytes: 23636
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define chmin(x,y) x = min(x,y)

ll mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}


ll modsize = 100005;
vector<ll> fac(modsize);
vector<ll> inv(modsize);
vector<ll> facinv(modsize);

void modcalc(){
    if(modsize == 0) abort();
    fac[0] = 1; fac[1] = 1; inv[1] = 1;
    facinv[0] = 1; facinv[1] = 1;
    for(ll i = 2 ; i < modsize ; i++){
        fac[i] = fac[i-1] * i % mod;
        inv[i] = mod - inv[mod % i] * (mod / i) % mod;
        facinv[i] = facinv[i-1] * inv[i] % mod;
    }
}

ll modinv(ll a){
    if(a==0) abort();
    ll b = mod, u = 1, v = 0;
    while(b){
        ll t = a/b;
        a -= t * b; swap(a,b);
        u -= t * v; swap(u,v);
    }
    u %= mod;
    if(u<0) u += mod;
    return u;
}

ll modpow(ll a,ll b){
    ll ans = 1;
    a %= mod;
    while(b){
        if(b&1) ans = ans * a % mod;
        a = a * a % mod;
        b >>= 1;
    }
    return ans;
}

ll modcomb(ll n, ll k){
    if(n<0||k<0||n<k) return 0;
    return fac[n] * facinv[k] % mod * facinv[n-k] % mod;
}

ll modperm(ll n, ll k){
    if(n<0||k<0||n<k) return 0;
    return fac[n] * facinv[n-k] % mod;
}

ll modhom(ll n, ll k){
    if(n<0||k<0||(n==0&&k>0)) return 0;
    if(n==0&&k==0) return 1;
    return fac[n+k-1] * facinv[k] % mod * facinv[n-1] % mod;
}

int main(){
    modcalc();
    ll n,k; cin>>n>>k;
    vector<ll> a(n);
    rep(i,n) cin>>a[i];
    sort(a.begin(),a.end());
    mint ans = 0;
    rep(i,n){
        ans += a[i] * modcomb(i,k-1);
        ans -= a[i] * modcomb(n-i-1,k-1);
    }
    cout << ans.x << endl;
}

Measured memory_bytes: 6352
import java.util.Scanner;
import java.util.ArrayList;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        ArrayList<Integer> a = new ArrayList<Integer>();
        int temp;

        while(true){
            temp = sc.nextInt();
            a.add(temp);
            if(temp == 0) break;
        }

        for(int i = 0; i < a.size() - 1; i++){
            System.out.println("Case " + (i+1) + ": " + a.get(i));
        }

        sc.close();
    }
}


Measured memory_bytes: 44008
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <queue>
#include <set>
#include <stdio.h>
using namespace std;
#define ll long long


int main() {
	int a;
	cin >> a;
	cout << 3 * a * a << endl;
	return 0;
}

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

int main(){

    int N;
    cin >> N;

    int max_num = 1;
    for(int i=1; i<=N; i++) max_num *= 3;

    int temp, buf = 1;
    for(int i=0; i<N; i++){
        cin >> temp;

        if(temp%2 == 0) buf *= 2;
    }

    cout << max_num - buf << endl;
    return 0;
}

Measured memory_bytes: 3640
a,b,c,x,y = map(int,input().split())
l = min(x,y)
m = max(x,y)
M = a * x + b * y
for i in range(1,l+1):
  K = a * (x-i) + b * (y-i) + 2 * c * i 
  M = min(M,K)
for i in range(l+1,m+1):
  if x == l:
    K = b * (y-i) + 2 * c * i
  else:
    K = a * (x-i) + 2 * c * i
  M = min(M,K)
print(M)

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <vector>
#include <climits>
#include <set>
#include <algorithm>
#include <unordered_map>
#include <queue>
#include <iomanip>
#include <map>
#include <utility>
#include <numeric>
#include <chrono>
#include <ctime>
#include <bitset>
#include <iterator>
#include <cmath>
#include <stack>

#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define debug(x) cerr << #x << ": " << x << ", "
#define debugln(x) cerr << #x << ": " << x << '\n'

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

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

constexpr ll mod = 1e9 + 7;
const double PI = acos(-1.0);

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

  int n, k; cin >> n >> k;
  if (n < 2*k-1) {
    cout << "NO" << endl;
  } else {
    cout << "YES" << endl;
  }

}


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

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef pair<LL, LL> PLL;

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort((c).begin(),(c).end())

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

#define FF first
#define SS second
template<class S, class T>
istream& operator>>(istream& is, pair<S,T>& p){
  return is >> p.FF >> p.SS;
}

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD = 1e9+7;

int H, W;
LL tab[310][310][310];
LL dp[310][310];
int main(){
  cin.tie(0);
  ios_base::sync_with_stdio(false);

  cin >> H >> W;
  VVI xs(H, VI(W));
  REP(y,H) REP(x,W){
	char c; cin >> c;
	xs[y][x] = c - 'a';
  }

  for(int x=0;x+1<W;++x){
	REP(y,H+1)
	  tab[x][y][0] = tab[x][0][y] = 0;
	REP(y1,H) REP(y2,H){
	  tab[x][y1+1][y2+1] = tab[x][y1][y2] + (xs[y1][x] == xs[y2][x+1]);
	}
  }

  LL ans = 0;
  for(int x=0;x+1<W;++x){
	fill((LL*)dp, (LL*)dp+310*310, 1e15);
	dp[H][H] = 0;
	for(int y1=H;y1>=0;--y1)
	  for(int y2=H;y2>=0;--y2){
		if(y1 > 0)
		  dp[y1-1][y2] = min(dp[y1-1][y2], dp[y1][y2] + tab[x][y1][y2]);
		if(y2 > 0)
		  dp[y1][y2-1] = min(dp[y1][y2-1], dp[y1][y2] + tab[x][y1][y2]);
	  }
	ans += dp[0][0];
  }

  cout << ans << endl;

  return 0;
}


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

int main() {
  
  	string s1, s2;
  	cin>>s1>>s2;
  	int n = s1.size(), m = s2.size();
  	vector<vector<int> > memo(n+1, vector<int>(m+1, 0) );
  	for( int i=1;i<=n;i++ ) {
  		for( int j=1;j<=m;j++ ) {
  			if( s1[i-1] == s2[j-1] ) {
  				memo[i][j] = 1 + memo[i-1][j-1];
  			} else {
  				memo[i][j] = max( memo[i-1][j], memo[i][j-1]);
  			}
  		}
  	}

  	string str = "";
  	while( n>0 && m>0 ) {
  		if( s1[n-1] == s2[m-1] ) {
  			str = s1[n-1] + str;
  			n--;
  			m--;
  		} else {
  			if( memo[n-1][m] > memo[n][m-1] )
  				n--;
  			else
  				m--;
  		}
  	}
  	cout<<str;
  	
  	return 0;
}

Measured memory_bytes: 35584
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

S_A = [0]*N
S_A[0] = A[0]
for i in range(1,N):
    S_A[i] = S_A[i-1] + A[i]

S_B = [0]*N
S_B[0] = B[0]
for i in range(1,N):
    S_B[i] = S_B[i-1] + B[i]

ans = 0
max_sb = S_B[-1]
for i in range(N): 
    tmp = 0
    tmp += S_A[i]
    if i == 0:
        tmp += max_sb
    else:
        tmp += max_sb - S_B[i-1]
    ans = max(ans, tmp)
print(ans)


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

list<long> L;

bool isprime(long n){
    if (n == 2) return true;
    if (n == 1 || n % 2 == 0) return false;
    long k = 3;
    while( k * k <= n ){
        if (n % k == 0) return false;
        k = k + 2;
    }
    return true;
}

void setprime(){
    L.push_back(2);
    long n = 3;
    while (n < 10010){
        if (isprime(n)) L.push_back(n);
        n += 2;
    }
    return;
}

int main(){
    setprime();
    long D[L.size() + 2];
    D[0] = 0;
    int i = 1;
    while (!(L.empty())) {
        D[i] = D[i - 1] + *(L.begin());
        L.pop_front(); i++;
    }
    long k;
    while(cin >> k) {
        if (k == 0) return 0;
        int i = 1, x = 0;
        while( D[i] - D[i - 1] <= k ) {
            int j = 0;
            while(j < i){
                if (D[i] - D[j] == k) x++;
                j++;
            }
            i++;
        }
        cout << x << endl;
    }
}


Measured memory_bytes: 3064
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define N 2*10e5
#define precise cout<<fixed<<setprecision(10)
#pragma GCC optimize("O0")
#pragma GCC optimize ("Ofast")
#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize ("-ffloat-store")
#define rep(i,a,b) for(int i=a;i<b;i++)
#define min3(a,b,c) min(a,min(b,c))
#define nl cout<<"\n";
#define all(v) v.begin(),v.end()
#define F first
#define S second
typedef long long ll;
typedef vector<long long> vl;
typedef vector<pair<long,long>> vp;
void get(ll arr[],ll n){for(ll i=0;i<n;i++) cin>>arr[i];}
ll gcd(ll a,ll b);
ll binpow(ll a,ll b);
void solve()
{
    ll n;
    cin>>n;
    string x1="AC",x3="TLE",x2="WA",x4="RE";
    string y;
    ll c1=0,c2=0,c3=0,c4=0;
    rep(i,0,n)
    {
        cin>>y;
        if(y==x1) c1++;
        else if(y==x2) c2++;
        else if(y==x3) c3++;
        else c4++;
    }
    cout<<x1<<" x "<<c1;nl;
    cout<<x2<<" x "<<c2;nl;
    cout<<x3<<" x "<<c3;nl;
    cout<<x4<<" x "<<c4;nl;
}
int main()
{
 	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	ll t;
	t=1;
	//cin>>t;
	while(t--)
	{
	 	solve();
	}
	//cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
}
ll binpow(ll a, ll b) {
   ll res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}
ll gcd(ll a,ll b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}

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

#ifdef LOCAL

template<typename T, typename U>
ostream& operator<<(ostream& os, const pair<T, U>& p) {
	os << "(" << p.first << ", " << p.second << ")";
	return os;
}

template<template<class, class...> class C, class... A>
typename enable_if<!is_same<C<A...>, string>::value, ostream&>::type
operator<<(ostream& os, const C<A...> &c) {
	auto i = c.begin();
	while (i != c.end()) {
		os << " {"[i == c.begin()] << *i;
		os << ",}"[++i == c.end()];
	}
	return os;
}

#define debug(x) cerr << #x << " = " << x << endl;

#else
#define debug(...) {}
#endif

const int N = 1e6 + 5;

#define st first
#define nd second

typedef pair<int,int> pun;
typedef long long ll;

int ile[2];

long long pow(int x, int k) {
	if (k == 0) return 1;
	return pow(x, k - 1) * x;
}

int main() {
	int n;
	scanf("%d", &n);
	for (int i = 0; i < n; i ++) {
		int x;
		scanf("%d", &x);
		ile[x % 2] ++;
	}
	printf("%lld\n", pow(3, n) - pow(2, ile[0]));
}


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

using namespace std;

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

    int result = C-(A-B);
    if (result < 0) {
        result = 0;
    }
    cout << result;
    
    return 0;
}   


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include  <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <string>
#include<math.h>
#include<iomanip>
#include<stdio.h>
#include <stdlib.h>
#include<stdio.h>
#include <queue>
#include<map>
#include <sstream>
#include<set>
#include<stack>
#include<time.h>
typedef long long int ll;
//#include<bits/stdc++.h>


using namespace std;



int main()
{
    int n;
    cin >> n;
    cout << n + n * n + n * n * n << endl;


    return 0;

}

Measured memory_bytes: 3644
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <array>
#include <set>
#include <map>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <cassert>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cstdint>

using namespace std;
using i64 = int64_t;
using i32 = int32_t;
template<class T, class U> void init_n(vector<T>& v, size_t n, U x) 
{ v = vector<T>(n, x); }
template<class T> void init_n(vector<T>& v, size_t n) { init_n(v, n, T()); }
template<class T> void read_n(vector<T>& v, size_t n, size_t o = 0) 
{ v = vector<T>(n+o); for (size_t i=o; i<n+o; ++i) cin >> v[i]; }
template<class T> void read_n(T a[], size_t n, size_t o = 0)
{ for (size_t i=o; i<n+o; ++i) cin >> a[i]; }
template<class T> T gabs(const T& x) { return max(x, -x); }
#define abs gabs

const i64 mod = 1e9 + 7;
i64 fact_memo[200001];
i64 fact(i64 x) {
  if (x == 0) return 1;
  if (fact_memo[x]) return fact_memo[x];
  return fact_memo[x] = x * fact(x - 1) % mod;
}
i64 ipow(i64 a, i64 b) {
  return (b & 1 ? a : 1) * (b > 1 ? ipow(a * a % mod, b >> 1) : 1) % mod;
}
i64 fact_inv(i64 x) {
  return ipow(fact(x), mod - 2);
}
i64 perm(i64 a, i64 b) {
  return fact(a) * fact_inv(a - b) % mod;
}
i64 conb(i64 a, i64 b) {
  return fact(a) * fact_inv(b) % mod * fact_inv(a - b) % mod;
}

i64 n, k;
int main() {
  cin >> n >> k;
  i64 l = n - k;
  for (i64 i = 1; i <= k; ++i) {
    if (l < i - 1) {
      cout << 0 << '\n';
    } else {
      i64 b = conb(i + k - i - 1, k - i);
      i64 r = conb(i + 1 + l - (i - 1) - 1, l - (i - 1));
      cout << b * r % mod << '\n';
    }
  }
  return 0;
}



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

int main(){
  string s;
  cin >> s;
  int count = 0;
    for(int i=0;i<s.size()/2;i++){
      if(s[i] != s[s.size()-i-1]) count++;
    }
  cout << count << endl;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define _USE_MATH_DEFINES
#include <math.h>
#define rep(i,n) for(int i = 0;i < n;i++)
#define NIL = -1;
const ll INF = 1e9;
const ll mod = 1e9 + 7;

int digit(ll x) {
    if (x / 10 == 0) return 1;
    return digit(x / 10) + 1;
}

ll gcd(long long a,long long b) {
    if (a < b) swap(a,b);
    if (b == 0) return a;
    
    return gcd(b,a%b);
}

ll lcm(ll a,ll b){
    return ((a * b == 0)) ? 0 : (a / gcd(a,b) * b);
}

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


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

int main(){
    int n;
    cin >> n;
    vector<vector<int>> g(n);
    vector<pair<int,int>> vp;
    for (int i = 1;i < n;i++){
        int a,b;
        cin >> a >> b;
        a--; b--;

        g[a].push_back(b);
        g[b].push_back(a);
        vp.emplace_back(a,b);
    }

    int k = 0;

    map<pair<int,int>,int> c;
    vector<int> color(n,0);

    vector<int> use(n,0);
    queue<int> que;
    use[0] = 1;
    que.emplace(0);
    while(!que.empty()){
        int v = que.front();
        que.pop();
        if (k < g[v].size()){
            k = g[v].size();
        }

        int cur = 1;
        for (int u : g[v]){
            if (use[u] == 1) continue;
            if (cur == color[v]) cur++;
            color[u] = c[make_pair(u,v)] = c[make_pair(v,u)] = cur++;
            use[u] = 1;
            que.emplace(u);
        }
    }

    cout << k << endl;
    for (auto p : vp) cout << c[p] << endl;
    return 0;
}

Measured memory_bytes: 20084
import sys
input = sys.stdin.readline
N, M = map(int, input().split())
KA = [list(map(int,input().split())) for i in range(N)]

menu = [0 for _ in range(M+1)]

for i in range(N) :
    for j in range(KA[i][0]) :
        menu[KA[i][j+1]] += 1

from collections import Counter
dict_M = Counter(menu)

print(dict_M[N])


Measured memory_bytes: 3316
#include <bits/stdc++.h>
using namespace std;
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; }
using ll = long long;
using P = pair<ll, ll>;
const long double PI = acos(-1.0L);
ll GCD(ll a, ll b) { return b?GCD(b, a%b):a; }
ll LCM(ll a, ll b) { return a/GCD(a, b)*b; }

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

int h, w;
struct pqdata {
    int x, y; ll cnt;
    bool operator<(const pqdata &r) const { return cnt > r.cnt; }
};

int main() {
    cin >> h >> w;
    pqdata first;
    cin >> first.y >> first.x;
    first.x--; first.y--;
    first.cnt = 0;
    int dh, dw; cin >> dh >> dw;
    dh--; dw--;
    vector< vector<char> > smap(h, vector<char>(w, '.'));
    for(int i = 0; i < h; ++i) {
        for(int j = 0; j < w; ++j) {
            cin >> smap[i][j];
        }
    }
    vector< vector<int> > scnt(h, vector<int>(w, 1e9));
    scnt[first.y][first.x] = 0;
    priority_queue<pqdata> pque;
    pque.push(first);

    while(!pque.empty()) {
        pqdata now = pque.top();
        pque.pop();
        if(now.x == dw && now.y == dh) break;
        int nx, ny, ncnt;
        // ワープしない
        for(int i = 0; i < 4; ++i) {
            nx = now.x+dx[i], ny = now.y+dy[i];
            ncnt = now.cnt;
            if(nx >= 0 && nx < w && ny >= 0 && ny < h) {
                if(smap[ny][nx] != '#') {
                    if(scnt[ny][nx] > ncnt) {
                        scnt[ny][nx] = ncnt;
                        pqdata next;
                        next.x = nx;
                        next.y = ny;
                        next.cnt = ncnt;
                        pque.push(next);
                    }
                }
            }
        }

        // ワープあり
        for(int i = -2; i <= 2; ++i) {
            for(int j = -2; j <= 2; ++j) {
                if(i == 0 && j == 0) continue;
                nx = now.x+j, ny = now.y+i;
                ncnt = now.cnt+1;
                if(nx >= 0 && nx < w && ny >= 0 && ny < h) {
                    if(smap[ny][nx] != '#') {
                        if(scnt[ny][nx] > ncnt) {
                            scnt[ny][nx] = ncnt;
                            pqdata next;
                            next.x = nx;
                            next.y = ny;
                            next.cnt = ncnt;
                            pque.push(next);
                        }
                    }
                }
            }
        }
    }

    int ans = scnt[dh][dw];
    if(ans == 1e9) cout << -1 << endl;
    else cout << ans << endl;
}

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

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

inline void Main() {
  int64_t n; cin >> n;
  vector<int64_t> a(n);
  rep(i, n) cin >> a[i];
  sort(all(a));
  reverse(all(a));
  int64_t r = a[0];
  repi(i, 1, n) {
    int64_t x = i * 2, y = x + 1;
    if (x < n) r += a[i];
    if (y < n) r += a[i];
  }
  cout << r << endl;
}

int main() {
  std::cin.tie(0);
  std::ios::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(20);
  Main();
  return 0;
}


Measured memory_bytes: 4796
import std.algorithm,
       std.string,
       std.array,
       std.stdio,
       std.range,
       std.conv;

void main() {
  int[] NK = readln.chomp.split.to!(int[]);
  int N = NK[0],
      K = NK[1];
  int[] l = readln.chomp.split.to!(int[]);

  std.algorithm.sort!("a<b")(l).reverse;

  int A;

  foreach (i; 0..K) {
    A += l[i];
  }

  writeln(A);
}


Measured memory_bytes: 256
//@formatter:off
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < int(n); ++i)
#define rrep(i,n) for (int i = int(n)-1; i >= 0; i--)
#define rep2(i,s,n) for (int i = int(s); i < int(n); ++i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define pb push_back
#define eb emplace_back
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vd vector<double>
#define vvd vector<vector<double>>
#define vs vector<string>
#define vc vector<char>
#define vvc vector<vector<char>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define vp vector<P>
#define vvp vector<vector<P>>
using namespace std;
using ll = long long;
using P = pair<int,int>;
using LP = pair<ll,ll>;
template<class S,class T> istream& operator>>(istream &is,pair<S,T> &p) { return is >> p.first >> p.second; }
template<class S,class T> ostream& operator<<(ostream &os,const pair<S,T> &p) { return os<<'{'<<p.first<<","<<p.second<<'}'; }
template<class T> istream& operator>>(istream &is,vector<T> &v) { for(T &t:v){is>>t;} return is; }
template<class T> ostream& operator<<(ostream &os,const vector<T> &v) { os<<'[';rep(i,v.size())os<<v[i]<<(i==int(v.size()-1)?"":","); return os<<']'; }
void Yes(bool b) { cout << (b ? "Yes" : "No") << '\n'; }
void YES(bool b) { cout << (b ? "YES" : "NO") << '\n'; }
template<class T> bool chmin(T& a,T b) {if(a > b){a = b; return true;} return false;}
template<class T> bool chmax(T& a,T b) {if(a < b){a = b; return true;} return false;}
const int inf = 1001001001;
const ll linf = 1001001001001001001;
//@formatter:on

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    string s, t;
    cin >> s >> t;
    int ans = inf;
    int n = s.size(), m = t.size();
    rep(i, n - m + 1) {
        int cnt = 0;
        rep(j, m) {
            if (s[i + j] != t[j]) cnt++;
        }
        chmin(ans, cnt);
    }
    cout << ans << endl;
}

Measured memory_bytes: 3680
#include <bits/stdc++.h>
using namespace std;
#define retunr return
#define pb push_back
#define mp make_pair
#define null NULL
#define sc(x) scanf("%d", &x)
#define sc64(x) scanf("%I64d", &x)
#define pr(x) printf("%d", (x))
#define sp putchar(' ')
#define ln putchar('\n')
#define pr64(x) printf("%I64d", (x))
#define rep(i,l,r) for (int i = l, lim = r;i <= lim; ++i)
#define repr(i,l,r) for (int i = r, lim = l;i >= lim; --i)
#define fi first
#define se second
#define SET(__set, val) memset(__set, val, sizeof __set)
#define prf(x) printf("%.20f", x)
typedef unsigned int uint;
typedef double db;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define N 100010
#define M 1024
#define MOD 1000000007
void _add(int &a, int b){a = (a+b)%MOD;}
void _sub(int &a, int b){a = (a+MOD-b)%MOD;}
void _mul(int &a, int b){a = (ll)a*b%MOD;}
void _max(int &a, int b){a = max(a,b);}
void _min(int &a, int b){a = min(a,b);}
ll gcd(ll a, ll b){if(!b)return a;return gcd(b,a%b);}
ll pw(ll a, ll b){ll res(1);while(b){if(b&1)res=res*a%MOD;a=a*a%MOD;b>>=1;}return res;}
ll pwM(ll a, ll b, ll mod){ll res(1);while(b){if(b&1)res=res*a%mod;a=a*a%mod;b>>=1;}return res;}

const int infi = 2147483647;
const ll infl = 9223372036854775807ll;
const db PI = 3.14159265358979323846;

/*
struct E{
	int v, w, n;
}G[N];
int cnt, point[N];
void adde(int u, int v, int w = 0){
	G[++cnt]=(E){v,w,point[u]},point[u]=cnt;
	G[++cnt]=(E){u,w,point[v]},point[v]=cnt;
}
void Ginit(){
	cnt = 0;
	SET(point,0);
}
*/
/*
struct hh{
	int a, b;
	bool operator < (const hh &x) const{
		if(a==x.a)return b<x.b;
		return a<x.a;
	}
}a[N];
*/
int n, m, k,q,a[N];
map<int,int> s;
int id(int x){
	if(s.count(x))return s[x];
	return s[x] = ++k;
}
int main(){
//	freopen("1", "r", stdin);
	sc(n);
	m = 10000;
	int ans = 0;
	rep(i,1,n){
		sc(a[i]);
		a[i] = id(a[i]);
		if(a[i] == a[i-1]){
			a[i] = m--;
			ans++;
		}
	}
	pr(ans);
/*
	int Case;
	sc(Case);
	rep(ca, 1, Case){
	    printf("Case #%d: ", ca);
	}
*/
	return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize(3, "Ofast", "inline")
#include <bits/stdc++.h>
#if __cplusplus >= 201103L
#include <chrono>
using namespace std::chrono;
#endif
using namespace std;
#define ll long long
#define ull unsigned long long
#define pii pair<int, int>
#define pb push_back
#define fi first
#define se second
#ifdef LOCAL
#define prln(x) (cout << #x << ' ' << x << endl)
#define pr(x) (cout << #x << ' ' << x << ' ' )
#define prv(x) (cout << x << ' ')
#else
#define prln(x) 
#define pr(x)
#define prv(x)
#endif
#define clr(x) memset((x), 0, sizeof((x)))
#define clr1(x) memset((x), -1, sizeof((x)))
#define endl "\n"
#define pi acos(-1)
#define rep(i, st, ed) for (int i = (st); i <= (ed); ++i)
#define rep0(i, st, ed) for (int i = (st); i < (ed); ++i)
#define per(i, st, ed) for (int i = (st); i >= ed; --i)
template<class T> void _sf(T &x) {cin >> x;}
void _sf(int &x) {scanf("%d", &x);}
void _sf(ll &x) {scanf("%lld", &x);}
void _sf(double &x) {scanf("%lf", &x);}
void _sf(char &x) {scanf(" %c", &x);}
void _sf(char *x) {scanf("%s", x);}
void sf() {}
template <class T, class...U> void sf(T & head, U&... tail) { _sf(head); sf(tail...);}
const int mod = 1e9 + 7;
const int INF = 0x3f3f3f3f;

int read() {
    int x = 0, f = 1;
    char ch = getchar();
    while (ch < '0' || ch > '9') {
        if (ch == '-') f = -1;
        ch = getchar();
    }
    while (ch >= '0' && ch <= '9') {
        x = x * 10 + ch - '0';
        ch = getchar();
    }
    return x * f;
}

int l[105];
int n;

int main(){
    #ifdef LOCAL
        freopen("in.txt", "r", stdin);
        freopen("out.txt", "w", stdout);
        #if __cplusplus >= 201103L
        auto start = steady_clock::now();
        #endif
    #endif
    n = read();
    int x =read();
    rep(i, 1, n) {
        l[i] = read();
    }

    int ans = 0;
    int d = 0;
    for (int i = 1; i <= n + 1; ++i) {
        int now = d + l[i - 1];
        prln(now);
        if (now <= x) ++ans;
        // else break;
        d = now;
    }
    cout << ans << endl;

    #ifdef LOCAL
        #if __cplusplus >= 201103L
        auto end = steady_clock::now();
        duration<double> time_span = duration_cast<duration<double>>(end - start);;
        printf("Total time: %.6fs\n", time_span.count());
        #endif
    #endif
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>

int main(void){
  int N,X,T;
  int count=0;

  scanf("%d %d %d",&N,&X,&T);
  if ((1>N)||(N>1000)) {
    exit(1);
  }
  if ((1>N)||(N>1000)) {
    exit(1);
  }
  if ((1>N)||(N>1000)) {
    exit(1);
  }

  for (int i = 0; i < 1000/X; i++) {
    if (N>=1) {
      count++;
      N=N-X;
    }
    if (N==0) {
      break;
    }
  }

  printf("%d\n", count*T);


  return 0;
}


Measured memory_bytes: 1736
#include <bits/stdc++.h>
using namespace std;
using ll=long long int;
#define all(c) (c).begin(), (c).end()
#define rep( i, a, n ) for( int i=a; i<n; i++ )
#define repp( i, a, n, p ) for( int i=a; i<n; i+=p )
#define per( i, a, n ) for( int i=n-1; i>=a; i--)
#define pb push_back
#define mp make_pair
#define acc accumulate

bool comp ( ll a, ll b ){
    return a > b;
}


int main () { 
    ll n, k;
    cin >> n >> k;
    vector <int> v;
    while ( n-- ) { ll no; cin >> no; v.pb (no); }
    sort ( all(v), comp );

    if ( k > v[0]){
        cout << 0 << endl;
    }
    else {
        ll count =0;
        rep ( i, 0, v.size() ){
            if ( v[i] >= k ) {
                count++;
            }
            else {
                break;
            }
        }

        cout << count << endl;
    }
}


Measured memory_bytes: 892
import java.util.Scanner;


public class Main {

	public static void main(String[] args)  {

		Scanner sc = new Scanner(System.in);
		Long n = Long.parseLong(sc.next());
		Long k = Long.parseLong(sc.next());
		
		Long s = n % k;
		Long ans = Math.abs(s-k);
		System.out.println(Math.min(s, ans));
		
		
	}
}


Measured memory_bytes: 23124
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
#define sp setprecision
#define pb(x) push_back(x)
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, ll> pil;
typedef pair<ll, int> pli;
typedef pair<ld, ld> pdd;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const int inf = 1e8;
const ll INF = 1e16;
const string alpha = "abcdefghijklmnopqrstuvwxyz";

int main(){
    int N, M;
    cin >> N >> M;
    cout << N*(N-1)/2 + M*(M-1)/2 << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int n,sum=0,i,j;
    cin>>n;
    long long int a[n];
    for(i=0;i<n;i++)
    {
        cin>>a[i];
    }
    for(i=0;i<n;i++)
    {
        for(j=i+1;j<n;j++)
        {
            sum+=a[i]*a[j];
        }
    }
  cout<<sum;
  return 0;
}


Measured memory_bytes: 256