akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

#define ll long long

const int N = 102, K = 100005, M = 1000000007;
int dp[K], a[N];

int main() {
	int n, k;
	scanf("%d %d", &n, &k);
	for (int i = 1; i <= n; i++) {
		scanf("%d", &a[i]);
	}
	dp[0] = 1;
	for (int i = 1; i <= k; i++) {
		dp[i] += dp[i-1];
		dp[i] %= M;
	}
	for (int i = 1; i <= n; i++) {
		for (int j = k; j >= 0; j--) {
			dp[j] = (dp[j] - (j - a[i] - 1 < 0 ? 0 : dp[j-a[i]-1]) + M) % M;
		}
		if (i < n) {
			for (int j = 1; j <= k; j++) {
				dp[j] += dp[j-1];
				dp[j] %= M;
			}
		}
	}
	printf("%d", dp[k]);
	return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define rep(i,n) for(ll i=0;i<n;i++)
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define fi first
#define se second
#define endl "\n"

template<typename T> inline bool chmax(T &a, T b){if(a<b){a=b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if(a>b){a=b;return true;}return false;}
template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){int len=d.size();rep(i,len){s<<d[i];if(i<len-1) s<<" ";}return s;}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){int len=d.size();rep(i,len){s<<d[i]<<endl;}return s;}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;}
template<typename T> ostream& operator<<(ostream& s,const multiset<T>& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){s<<"{"<<endl;for(auto itr=m.begin();itr!=m.end();++itr){s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;}s<<"}"<<endl;return s;}

const ll mod=1e9+7;
const ll inf=1e17;
const int INF=1e9;
const double EPS=1e-10;
const double PI=acos(-1);

int main(){
	cin.tie(0);ios::sync_with_stdio(false);
	ll n;
	cin>>n;
	vector<ll> a(n);
    set<ll> st;
	map<ll,ll> mp,mp2,cnt;
	rep(i,n){
		cin>>a[i];
		mp[a[i]]++;
	}
    sort(begin(a),end(a));
    a.erase(unique(begin(a),end(a)),end(a));
	for(auto x:mp){
		if(x.se>=2){
            st.insert(x.fi);
            cnt[x.fi]=0;
		}
	}
    n=a.size();
	rep(i,n){
		mp2[a[i]]=i;
	}
	ll ans=0;
	vector<bool> used(n,false);
	rep(i,n){
        if(used[i]) continue;
        bool flag=st.count(a[i]);
        if(flag && cnt[a[i]]) continue;
		for(ll x=a[i]+a[i];x<=a.back();x+=a[i]){
			if(mp2.count(x)) used[mp2[x]]=true;
		}
        if(flag) cnt[a[i]]++;
	}
	rep(i,n){
        if(st.count(a[i])) continue;
		if(!used[i]) ans++;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 29864
/**
  *  @Author: Pranta Sarker
  *
  */

#include<bits/stdc++.h>

using namespace std;

#define fast ios_base::sync_with_stdio(0)
#define bfast cin.tie(0)
#define outs(x) cout << x << " "
#define outn(x) cout << x << "\n"
#define sf scanf
#define pf printf
#define pfn(x , k) printf(k , x)
#define nl puts("")
#define psb push_back
#define mset(c,v) memset(c , v , sizeof c)
#define loop0(n) for(int i=0; i<n; i++)
#define loop1(n) for(int i=1; i<=n; i++)
#define mpair(x , y) make_pair(x , y)
#define all(x) x.begin(), x.end()
#define pi acos(-1.0)
#define psb push_back
#define clr clear()

typedef unsigned long long ull;
typedef long long LL;
typedef vector<int>vii;
typedef vector<LL>vll;
typedef vector<string>vs;
typedef map<int, int>mpii;
typedef map<string, int>mpsi;
typedef map<char, int>mpci;
typedef map<LL, LL>mpll;

const int mod = 1000007;
const int high = 1e5+2;

mpii mp;
int ar[high];

int main()
{
	fast;
	int N , x;
	cin >> N;
	int i=0 , cnt=0;
	for(i=0; i<N; i++)
	{
		cin >> x;
		//ar[i] = x;
		mp[x]++;
		if(mp[x] == 1) cnt++;
		else cnt--, mp[x] = 0;
	}

	cnt = cnt < 0 ? 0 : cnt;

	outn(cnt);

	return 0;
}


Measured memory_bytes: 4992
#include <bits/stdc++.h>
using namespace std;
//make_tuple emplace_back next_permutation push_back make_pair second first setprecision

#if MYDEBUG
#include "lib/cp_debug.h"
#else
#define DBG(...) ;
#endif

using LL = long long;
constexpr LL LINF=334ll<<53;
constexpr int INF=15<<26;
constexpr LL  MOD=1E9+7;

struct Problem{
    int r,c,n;
    vector<LL> a_row;
    vector<vector<pair<int,LL>>> g;
    vector<int> visited;
    Problem(LL r, LL c):r(r),c(c),a_row(r+c,LINF),g(r+c),visited(r+c){};
    void impossible(){cout <<"No"<<"\n";exit(0);}
    void solve(){
        cin >> n;
        for(int i=0; i<n; ++i){
            LL rr,cc,a;
            cin >> rr >> cc >> a;
            --rr;--cc;
            g[rr].emplace_back(cc+r,a);
            g[cc+r].emplace_back(rr,a);
        }
        vector<int> tmp;
        for(int i=0; i<r+c; ++i){
            if(!visited[i]){
                tmp.clear();
                dfs(tmp,i);
            }
        }
        cout <<"Yes" << "\n";

    }
    void dfs(vector<int>& tmp, int cur, int p=-1,LL a=0){
        if(visited[cur]){
            if(a_row[p]+a_row[cur]!=a)impossible();
            return;
        }
        if(p==-1){
            a_row[cur]=0;
        }else{
            a_row[cur]=a-a_row[p];
        }
        visited[cur]=1;
        tmp.push_back(cur);
        for(auto &&x:g[cur])if(p!=x.first){
            dfs(tmp,x.first,cur,x.second);
        }
        if(p==-1){
            LL rmin=LINF, cmin=LINF;
            DBG(tmp,a_row)
            for( auto && i:tmp){
                DBG(i)
                if(i<r)rmin=min(rmin,a_row[i]);
                else cmin =min(cmin,a_row[i]);
            }
            DBG(rmin,cmin)
            if(rmin+cmin<0)impossible();
        }
    }
};

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    long long r,c=0;
    cin >> r  >> c;
    Problem p(r,c);
    p.solve();
    return 0;
}



Measured memory_bytes: 18172
#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 7;
typedef long long ll;
string s, t;
int main()
{
    cin >> s >> t;
    int len = s.size();
    int ans = 0;
    for (int i = 0; i < len; i++) {
        if(s[i] != t[i]) ans++;
    }
    printf("%d\n", ans);
}


Measured memory_bytes: 3852
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
	int n;
	int x,y,b,p;
	cin>>n;
	int ans;
	for(int i=0;i<n;i++){
		cin>>x>>y>>b>>p;
		if(b<5&&p<2) ans=(x*5+y*2)*0.8;
		else if(b<5&&p>=2) ans=(x*5+y*p)*0.8;
		else if(b>=5&&p<2) ans=(x*b+y*2)*0.8;
		else  ans=(x*b+y*p)*0.8;
		cout<<min(ans,x*b+y*p)<<endl;
	}
	return 0;
}

Measured memory_bytes: 3088
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstring>
#include <string>
#include <math.h>
using namespace std;
typedef long long ll;
typedef double D;
typedef pair<int,int> P;
#define M 1000000007
#define F first
#define S second
#define PB push_back
#define INF 100000000000000000
void YES(bool anser){
    if(anser)printf("YES\n");
    else printf("NO\n");
}
void Yes(bool anser){
    if(anser)printf("Yes\n");
    else printf("No\n");
}
void yes(bool anser){
    if(anser)printf("yes\n");
    else printf("no\n");
}
ll n,k;
int main(void){
    cin>>n;
    if(n==1)cout<<"Hello World\n";
    else{
        int a,b;
        cin>>a>>b;
        cout<<a+b<<endl;
    }
    
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define INF 2000000000
#define MOD 1000000007
#define EPS (1e-10)

using namespace std;

int main(int argc, char *argv[]) {

	int A,B; cin >> A >> B;

	for (int i = 0; i < 3; i++) {
		if (A * B * (i+1) % 2 == 1) {
			cout << "Yes" << endl;	
			return 0;
		}
	}
	cout << "No" << endl;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include <stdlib.h>
#include <algorithm>
#include <string>
#include <math.h>
#include <vector>
#include <numeric>
#include <functional>
#include <cassert>
typedef long long int ll;
using namespace std;

int main(){
	ll N, K,a,b,c,e;
	string d;
	cin>>N>>K;
	vector<int> D;
	for(int i=0;i<K;i++){
		cin>>a;
		D.push_back(a);
	}
	while(1){
		a=N;
		e=0;
		d=to_string(a);
		for(int i=d.length()-1;i>=0;i--){
			b=pow(10,i);
			c=a/b;
			auto result=find(D.begin(),D.end(),c);
			if(result!=D.end()){
				e=1;
				break;
			}else{
				a=a-b*c;
			}
		}
		if(e==0){
			cout<<N<<endl;
			return 0;
		}else{
			N++;
		}
	}
	return 0;
}

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

int q, r, ten, ma, cnt;

int main() {
  cin >> q;
  for(int a = 0; a < q; ++a) {
    map<int, bool> mp;
    cin >> r;
    cnt = 0;
    while(r >= 10) {
      ma = 0;
      ten = 10;
      while(r / ten > 0) {
        if(ma < (r / ten) * (r % ten)) ma = (r / ten) * (r % ten);
        ten *= 10;
      }
      if(mp.find(ma) != mp.end()) {
        cnt = -1;
        break;
      }
      mp[ma] = 1;
      r = ma;
      ++cnt;
    }
    cout << cnt << endl;
  }
  return 0;
}


Measured memory_bytes: 3108
import sys
input = sys.stdin.readline
li = [[0]*2 for _ in range(5)]
count = 0
total = 0
for i in range(5):
    li[i][0] = int(input())
    li[i][1] = li[i][0]%10
    if li[i][1] == 0:
        count += 1
li.sort(key=lambda x:x[1])
for i in range(count):
    total += li[0][0]
    li = li[1:]
if count != 5:
    for i in range(5-count-1):
        total += (li[-1][0]+10-li[-1][1])
        li = li[:-1]
    print(total+li[0][0])
else:
    print(total)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repr(i, n) for (int i = (n)-1; i >= 0; i--)
constexpr char newl = '\n';

constexpr int inf = 1e9 + 7;
constexpr int MaxN = 100'005;
int n;
vector<int> graph[MaxN];
int p[MaxN];
int dp0[MaxN], dp1[MaxN], dp2[MaxN];

void dfs(int v, int par) {
  for (auto c : graph[v]) if (c != par) dfs(c, v);
  dp0[v] = p[v];
  for (auto c : graph[v]) if (c != par) dp0[v] += max(0, dp0[c] - 2);
  dp1[v] = dp0[v];  int nc = -1;
  for (auto c : graph[v]) if (c != par)
    if (dp1[v] <= dp0[v] - max(0, dp0[c] - 2) + dp1[c] - 1)
      nc = c, dp1[v] = dp0[v] - max(0, dp0[c] - 2) + dp1[c] - 1;
  dp2[v] = dp1[v];
  for (auto c : graph[v]) if (c != par and c != nc)
    dp2[v] = max(dp2[v], dp1[v] - max(0, dp0[c] - 2) + dp1[c] - 1);
  for (auto c : graph[v]) if (c != par)
    dp2[v] = max(dp2[v], dp0[v] - max(0, dp0[c] - 2) + dp2[c] - 2);
}

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

  cin >> n;
  rep(i, n) cin >> p[i];
  rep(_, n - 1) {
    int s, t;
    cin >> s >> t;
    s--;
    t--;
    graph[s].push_back(t);
    graph[t].push_back(s);
  }
  dfs(0, -1);
  int res = -inf;
  rep(i, n) res = max(res, dp2[i]);
  cout << res << newl;
}


Measured memory_bytes: 18080
#include <iostream>

int main()
{
	int n;
	while (std::cin >> n) {
		int num_comb = 0;
		for (int a = 0; a < 10; ++a) {
		for (int b = 0; b < 10; ++b) {
		for (int c = 0; c < 10; ++c) {
		for (int d = 0; d < 10; ++d) {
			if (a + b + c + d == n) {
				++num_comb;
			}
		}}}}
		std::cout << num_comb << std::endl;
	}
	return 0;
}

Measured memory_bytes: 0
from bisect import bisect
from itertools import accumulate
n,*l = map(int,open(0).read().split())
s = sorted
a,b,c = s(l[:n]),s(l[n:2*n]),s(l[2*n:])
ref=[]
for i in b:
	ref.append(n-bisect(c,i))
ref = list(accumulate(ref[::-1]))[::-1] + [0]
ans=0
for i in a:
	ans += ref[bisect(b,i)]
print(ans)

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

int main() {
  char c;
  cin >> c;
  
  if(c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o'){
    cout << "vowel" << endl;
  }else{
    cout << "consonant" << endl;
  }
}

Measured memory_bytes: 256
N = int(input())
l = []
for i in range(N):
    l.append([int(x) for x in input().split()])

xlim = []
ylim = []

def cha(a):
    return [a[0]-a[1],a[0]+a[1]]

for i in range(N):
        ylim.append(cha(l[i])[1])
        xlim.append(cha(l[i])[0])

xlim.sort()
ylim.sort()

print(max(xlim[-1]-xlim[0],ylim[-1]-ylim[0]))

Measured memory_bytes: 134764
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<numeric>
#include<map>
#include<iostream>
using namespace std;
#define rep(i,n) for(int i = 0;i<((int)(n));i++)
#define reg(i,a,b) for(int i = ((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i = ((int)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(int i = ((int)(b));i>=((int)(a));i--)
typedef long long ll;
typedef pair<ll, ll> mp;

int main(void){
	ll N,W;
	cin>>N>>W;
	ll v[101],w[101];
	reg(i,1,N)cin>>v[i]>>w[i];
	ll DP[101][10001]; //i???????????§????????£????????????j??§????????¨???????????§?????????
	reg(i,0,N){
		reg(j,0,W)DP[i][j]=0;
	}
	ll ans=0;
	reg(i,1,N){
		reg(j,1,W){
			if(DP[i][j]<DP[i-1][j])DP[i][j]=DP[i-1][j];
			if(j>=w[i] && DP[i][j]<DP[i-1][j-w[i]]+v[i])DP[i][j]=DP[i-1][j-w[i]]+v[i];
			if(ans<DP[i][j])ans=DP[i][j];
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 10996
#include<cstdio>
#include<string>
#include<sstream>

using namespace std;

int main(){
    int h, w;
    scanf("%d %d", &h, &w);
    char s[h][w+1];
    for(int i = 0; i < h; i++){
        scanf("%s", s[i]);
    }
    int dx[8] = {1, 1, 1, -1, -1, -1, 0, 0};
    int dy[8] = {0, -1, 1, 0, -1, 1, -1, 1};
    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            if (s[i][j] == '.'){
                int count = 0;
                for(int k = 0; k < 8; k++){
                    int x, y;
                    x = i + dx[k];
                    y = j + dy[k];
                    if (0 <= x && x < h && 0 <= y && y < w){
                        if (s[x][y] == '#') count++;
                    }
                }
                s[i][j] = '0' + count;
            }
        }
    }
    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            printf("%c", s[i][j]);
        }
        printf("\n");
    }
}

Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp make_pair
#define pb push_back
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)


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


  int n,x,y;
  cin >> n >> x >> y;
  vector<int> g[n];
  rep(i,n-1) g[i].pb(i+1);
  rep1(i,n-1) g[i].pb(i-1);

  --x;--y;
  g[x].pb(y);
  g[y].pb(x);
  vector<int> ans(n,0);
  rep(i,n){
    queue<pair<int,int>> qu;
    qu.push({i,0});
    vector<int> dp(n,INT_MAX/4);
    while(!qu.empty()){
      auto c = qu.front(); qu.pop();
      int cv = c.first;
      int dist = c.second;
      if(dist > dp[cv]) continue;
      else{
	dp[cv] = dist;	
      }
      for(auto i: g[cv]){
	if(dp[i] <= dist +1) continue;
	else qu.push({i,dist+1});
      }
    }
    rep(i,n) ans[dp[i]]++;
  }
  rep(i,n-1){
    cout << ans[i+1]/2 << endl;
  }
    
  
  return 0;
    

}


Measured memory_bytes: 384
#include <iostream>

using namespace std;

int main(void)
{
    int a, b;
    
    cin >> a >> b;
    
    if (a < b)
        cout << "a < b" << endl;
    else if (a > b)
        cout << "a > b" << endl;
    else
        cout << "a == b" << endl;
}


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

int main()
{
	int n;
	cin>>n;
	int a[n],cnt=0;
	for(int i=0;i<n;i++)
		cin>>a[i];
	int max1=0;
	for(int i=0;i<n;i++)
	{
		if(a[i+1]<=a[i]&&i!=n-1)
			cnt++;
		else{
			max1=max(cnt,max1);
			cnt=0;
		}
	}
	cout<<max1<<endl;;
	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
int main(){
    int N,M; cin >> N >> M;
    vector<vector<int>> S(M);
    for (int i=0;i<M;i++){
        int k; cin >> k;
        S[i].resize(k);
        for (int j=0;j<k;j++) {
            cin >> S[i][j];
            --S[i][j];
        }
    }
    vector<int> P(M);
    for (int i=0;i<M;i++) cin >> P[i];
    int res = 0;

    for (int bit=0; bit<(1<<N);++bit){
        bool can=true;
        for (int j=0;j<M;j++){
            int cnt=0;
            for (int id : S[j]){
                if (bit & (1<<id)) ++cnt;
            }
            if ((cnt%2 != P[j])) can = false; 
        }
        if (can) res++;
    }
    cout << res << endl;
    return 0;
}

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

int main( void )
{
  int N;
  cin >> N;
  bool can = false;

  for( int i = 0; i <= ( N + 3 ) / 4; i++ )
    for( int j = 0; j <= ( N + 6 ) / 7; j++ )
      if( 4 * i + 7 * j == N )
	can = true;

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

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define forr(i, n) for(int i = 0;i < (int)n; i++)
#define deb(x) cout<<#x<<" " <<x<<"\n";
#define all(x) x.begin(), x.end()
#define eb emplace_back
#define mp make_pair
#define test int t;cin >> t;while(t--)
#define endl "\n"
const int INF = 2e9;
int32_t main()
{
#ifndef ONLINE_JUDGE
	freopen("input1.txt", "r", stdin);
#endif
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	string s;
	cin>>s;
	forr(i,s.length()) {
		if(i==3) break;
		cout<<s[i];
	}
	return 0;
}


Measured memory_bytes: 3640
# AOJ 0100 Sale Result
# Python3 2018.6.17 bal4u

while True:
	n = int(input())
	if n == 0: break

	id = []
	pq = [-1]*4001
	for i in range(n):
		e, p, q = list(map(int, input().split()))
		if pq[e] < 0:
			id.append(e)
			pq[e] = p*q
		else: pq[e] += p*q
		
	f = False
	for e in id:
		if pq[e] >= 1000000:
			print(e)
			f = True
	if not f: print('NA')


Measured memory_bytes: 5836
#include<stdio.h>
int main(void){
    long long MAX=-1000000,min=1000000,i;
    long long a[10000]={0},N,some=0;
    scanf("%lld",&N);
    for(i=0;i<N;i++){
        scanf("%lld",&a[i]);
        if(a[i]>MAX)MAX = a[i];
    }
    for(i=0;i<N;i++){
        if(a[i]<min)min = a[i];
    }
    for(i=0;i<N;i++){
        if(i == 0)some=a[i];
        else some=some+a[i];
    }
    printf("%lld %lld %lld\n",min,MAX,some);
return 0;
}

Measured memory_bytes: 688
#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <string>
using namespace std;
const int INF = 1001001001;
typedef long long int ll;
#define rep(i, n) for (int(i) = 0; (i) < (n); (i)++)
#define re0 return 0
#include<string.h>
int npr(int n , int r){//nPr
    r = n - r;
    int sum = 1;
    int i;
    for (i=n;i>=r+1;i--)sum*=i;
    return sum;
}
int gcd(int a, int b) {//最大公約数
    if (b==0) return a;
    else return gcd(b, a%b);
}
int lcm(int a, int b) {//最小公倍数
    return a * b / gcd(a, b);
}
int digsum(int n) {//桁和
    int res = 0;
    while(n > 0) {
        //res += n%10;
        //　↑をres++;にすれば桁数
         res++;
        n /= 10;
    }
    return res;
}
bool isPrime(int x){//素数判定
    if(x==1)return 0;
    if(x==2)return 1;
    if(x%2==0)return 0;
    for(int i=3;i*i<=x;i++)if(x%i==0)return 0;
    return 1;
}
/*bit全探索
for (int bit = 0; bit < (1<<N); ++bit) {
}
if (bit & (1 << i)) {
}
*/


signed main(){
    ll n;
    cin >> n;
    ll ac=0,wa=0,tle=0,re=0;
    rep(i,n){
        string s;
        cin >> s;
        if(s=="AC"){
            ac++;
        }else if(s=="WA"){
            wa++;
        }else if(s=="TLE"){
            tle++;
        }else if(s=="RE"){
            re++;
        }
    }
    cout <<"AC x "<<ac<<endl;
    cout <<"WA x "<<wa<<endl;
    cout <<"TLE x "<<tle<<endl;
    cout <<"RE x "<<re<<endl;
    return 0;
}


Measured memory_bytes: 3632
n = int(input())
d = [input().split(" ") for _ in range(n)]

f = False
for i in range(n-2):
    if d[i][0] == d[i][1] and not f :
        if d[i+1][0] == d[i+1][1] and d[i+2][0] == d[i+2][1]:
            f = True
if f:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 9192
#include <bits/stdc++.h>
using namespace std;
typedef long long ll ;
#define pb push_back
#define F first
#define S second
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)

# define M_PIl          3.141592653589793238462643383279502884L /* pi */

const ll M=1e9+7;
const int MaxM=100005;


void SieveOfEratosthenes(int n)                                   //all prime <= n
{
    bool prime[n+1];
    memset(prime, true, sizeof(prime));

    for (int p=2; p*p<=n; p++)
    {
        if (prime[p] == true)
        {
            for (int i=p*p; i<=n; i += p)
                prime[i] = false;
        }
    }

    for (int p=2; p<=n; p++)
       if (prime[p])
          cout << p << " ";
}


bool isPowerOfTwo (int x)
{
    return x && (!(x&(x-1)));
}



bool comp(pair<int,int> a,pair<int,int> b){
  if(a.F==b.F){
    return a.S>b.S;
  }
  return a.F<b.F;
}




void solve(){


int n,k;cin>>n>>k;

bool dp[k+1]={false};
int a[n];
for(int i=0;i<n;i++){
          cin>>a[i];
          dp[a[i]]=true;      
}

for(int i=0;i<=k;i++){
    if(!dp[i]){
        for(int j=0;j<n;j++){

              if(a[j]<i){
                if(!dp[i-a[j]]){dp[i]=true; break;}
              }
              else if(a[j]==i){dp[i]=true; break;}
              else{break;}
        }
    }
      
}


if(dp[k]){cout<<"First";}
else{cout<<"Second";}

}

int main(){


   int t=1;
//  cin>>t;
   while(t--){
      solve();
       }

 }


Measured memory_bytes: 3728
#include<bits/stdc++.h>
#define ALL(c) (c).begin(),(c).end()
#define EACH(i,c) for(auto i=(c).begin();i!=(c).end();++i)
using namespace std;
#define int long long

const int MOD = (int)1e9 + 7;

signed main(){
	int N;
	cin >> N;
	vector<int> cnt(N + 1);
	for(int i = 2; i <= N; ++i) {
		int a = i;
		for(int j = 2; j <= a; ++j) {
			while(a % j == 0) {
				cnt[j] ++;
				a /= j;
			}
		}
	}
	int res = 1;
	for(int i = 1; i <= N; ++i) {
		res = (res * (cnt[i] + 1)) % MOD;
	}
	cout << res << endl;

	return 0;
}


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

using namespace std;

int l_r_rule(string s)
{
    int len = s.length();
    int res = 0;
    char ope = '+';
    for (int i = 0; i < len; i++)
    {
        if (i % 2 == 0)
        { //??°???
            if (ope == '+')
                res += (s[i] - 48);
            else
                res *= (s[i] - 48);
        }
        else
            ope = s[i];
    }
    return res;
}

int m_f_rule(string s)
{
    s += '+';
    int len = s.length();
    std::vector<int> v;
    int tmp = -1;
    for (int i = 0; i < len / 2; i++)
    {
        if (s[i * 2 + 1] == '+')
        {
            if (tmp == -1)
                v.push_back((s[i * 2] - 48));
            else
                v.push_back(tmp);
            tmp = -1;
        }
        else
        {
            if (tmp == -1)
                tmp = (s[i * 2] - 48);
            //cout <<tmp<<endl;
            tmp *= (s[i * 2 + 2] - 48);
            //cout <<tmp<<endl;
        }
    }
    int vlen = v.size();
    int res = 0;
    for (int i = 0; i < vlen; i++)
        res += v[i];
    return res;
}

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

    string s;
    int n;
    cin >> s >> n;
    int mans = m_f_rule(s);
    int lans = l_r_rule(s);
    // cout << mans<<" "<<lans<<endl;
    if (mans == n && lans == n)
        cout << "U" << endl;
    else if (mans == n)
        cout << "M" << endl;
    else if (lans == n)
        cout << "L" << endl;
    else
        cout << "I" << endl;
}


Measured memory_bytes: 3228
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int N;
    cin>>N;
    
    map<int,int> ma;
    for(int i=0;i<N;i++){
        int a;
        cin>>a;
        ma[a]++;
    }
    
    int count=0;
    for(auto it=ma.begin();it!=ma.end();it++){
        if((it->second)%2==1)count++;
    }
    
    cout<<count<<endl;
    
}


Measured memory_bytes: 4992
n=int(input())
a=list(map(int,input().split()))
d={}
for x in a:
  if x in d:
    d[x]+=1
  else:
    d[x]=1
cnt=0
for x in d:
  if d[x]>=x:
    cnt+=d[x]-x
  else:
    cnt+=d[x]
print(cnt)

Measured memory_bytes: 18168
#include <bits/stdc++.h>
 
using namespace std;
inline void prep ()
{
  cin.tie (0);
  cin.sync_with_stdio (0);
};
const double pi = acos(-1.);
//printf(%.12lf\n,mid);
// __builtin_popcount(int) count 1's in binary
// get decimal part of number
/*
double intpart;
double thiss = modf((double)(n*m)/(double)k, &intpart);
*/
// round = (int)(num+.5)
long long mod = 1000000007;
 
long long mymod(long long num){
  if (num< 0 && !(num%mod == 0)){
    if (mod == 1){
      return 0;
    }
    return mod-abs(num)%mod;
  }else{
    return num%mod;
  }
}
 
/*string sentence = And I feel fine...;
    istringstream iss(sentence);
*/  
 
double eps = .000000001;
 
 
vector<pair<int, int> > top;
vector<pair<int, int> > rightt;
vector<pair<int, int> > bottom;
vector<pair<int, int> > leftt;
int r, c, n;
void func(int x, int y, int i){
    if (x == 0){
          top.emplace_back(y, i);
      }else if (x == r){
          bottom.emplace_back(y, i);
      }else if (y == 0){
          leftt.emplace_back(x, i);
      }else if (y == c){
          rightt.emplace_back(x, i);
      }
}
bool border(int x, int y){
    if (x == 0 || x == r){
        return true;
    }
    if (y == 0 || y == c){
        return true;
    }
    return false;
}
int main ()
{
  prep();
  
  cin >> r >> c >> n;
  
 
  for (int i=0; i<n; i++){
      int x, y, a, b;
      cin >> x >> y >> a >> b;
      if (!border(x, y) || !border(a, b)){
          continue;
      }
      func(x, y, i);
      func(a, b, i);
      
  }
  sort(top.begin(), top.end());
  sort(rightt.begin(), rightt.end());
  sort(bottom.rbegin(), bottom.rend());
  sort(leftt.rbegin(), leftt.rend());
  vector<vector<pair<int, int> > > vecs = {top, rightt, bottom, leftt};
  stack<int> st;
  bool did[n] = {false};
  for (int j=0; j<4; j++){
      vector<pair<int, int> > v = vecs[j];
      for (int i=0; i<v.size(); i++){
          int num = v[i].second;
          if (did[num]){
              if (st.top() != num){
                  cout << "NO";
                  return 0;
              }
              st.pop();
          }else{
              did[num] = true;
              st.push(num);
          }
      }
  }
  cout << "YES";
  return 0; 
}

Measured memory_bytes: 5204
#include<bits/stdc++.h>
 
#define rep(i,n) for(ll i = 0;i < n;++i)
#define all(v) v.begin(),v.end()
using namespace std;
using ll = long long;
typedef pair<int,int> P;
 
const int INF = 1001001001;
const long double PI = (acos(-1));
const int mod = 1e9+7;
const int vx[6] = {0,1,0,-1,1,-1};
const int vy[6] = {1,0,-1,0,1,1};


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

    int n;
    cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    sort(all(a),greater<int>());
    ll ans = 0;
    ans += a[0];
    rep(i,(n-2)/2){
        rep(j,2) ans += a[i+1];
    }
    if((n) % 2 == 1){
        ans += a[(n-2)/2+1];
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3992
#include<bits/stdc++.h>
using namespace std;
#define print(x) cout<<"["#x<<" :";printx(x);cout<<"]\n"
template <typename T> void printx(T x){ cout<<x; }
template <typename T> void printx(vector<T> &v){ for(int x:v){ cout<<x<<" ";}}
template <typename T> void printx(vector<vector<T>> &v){ for(size_t i=0;i<v.size();i++){cout<<"\t";
										for(size_t j=0;j<v[i].size();j++){cout<<v[i][j]<<" ";}if(i!=v.size()-1) cout<<endl;}}

void solve(){
	string num;
	cin>>num;
	for(size_t i=0;i<num.length();i++){
		if(num[i]=='7'){
			cout<<"Yes\n";
			return;
		}
	}
	cout<<"No\n";
}

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


Measured memory_bytes: 3648
def separate(a,b):
    r=[]
    tmp=[a//3*b,(a-a//3)*(b//2),(a-a//3)*(b//2+b%2)]
    r.append(max(tmp)-min(tmp))
    tmp=[(a//3+1)*b,(a-a//3-1)*(b//2),(a-a//3-1)*(b//2+b%2)]
    r.append(max(tmp)-min(tmp))
    return min(r)

H,W=list(map(int,input().split()))
ans=0

if H%3==0 or W%3==0:
    ans=0
else:
    S=[H,W]
    S.append(separate(H,W))
    S.append(separate(W,H))
    ans=min(S)
print(ans)

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

int main() {
  int n;
  string s;
  cin >> n >> s;
  
  string t = s.substr(0, n / 2);
  if (s == t + t) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  
  return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string S; cin >> S;
    int ans = 0;
    rep(i, S.length()) {
        if (S[i] == 'g' && i % 2 == 1) ans++;
        if (S[i] == 'g' && i % 2 == 0) ans += 0;
        if (S[i] == 'p' && i % 2 == 1) ans += 0;
        if (S[i] == 'p' && i % 2 == 0) ans--;
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 512
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for(int(i) = 0; (i) < (n); (i)++)
#define FOR(i, m, n) for(int(i) = (m); (i) < (n); (i)++)
#define All(v) (v).begin(), (v).end()
typedef long long ll;

const ll MOD = 998244353;

ll PowMod(ll N, ll P, ll M) {
    ll ans = 1;
    for(ll i = 0; i < P; ++i) {
        ans *= N;
        ans %= M;
    }
    return ans;
}

int main() {
    int N;
    cin >> N;
    vector<ll> A(N);
    vector<ll> cnt(N);
    ll ma = 0;
    rep(i, N) {
        cin >> A[i];
        if(i == 0 && A[i] != 0) {
            cout << 0 << endl;
            return 0;
        }
        if(i != 0 && A[i] == 0) {
            cout << 0 << endl;
            return 0;
        }
        cnt[A[i]]++;
        ma = max(ma, A[i]);
    }

    ll res = 1LL;
    for(int i = 1; i <= ma; i++) {
        res = (res * PowMod(cnt[i - 1], cnt[i], MOD)) % MOD;
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 1792
import Control.Applicative

main = do
    [a,b,c] <- map (read :: String -> Int) . words <$> getLine
    print $ length $ findDivisors a b c

findDivisors :: Int -> Int -> Int -> [Int]
findDivisors a b c = [n | n <- [a..b], c `mod` n == 0]

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

using namespace std;

#define endl "\n"
#define lln long long int
#define IOS ios::sync_with_stdio(0);cin.tie(0);

int main(){
    IOS;

    string s,ans;
    cin >> s; 
    int n = s.length();
    for(int i=0;i<n;i+=2){
        ans.push_back(s[i]);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3784
#include<bits/stdc++.h>
using namespace std;
#define num 1000000007
//#define num 998244353
#define REP(i,a,n) for(ll i=a;i<n;i++)
#define inarr(i,a,n,A) for(ll i=a;i<n;i++) { cin>>A[i]; }
#define vll vector<long long>
#define pii pair <int,int>
#define pll pair<long long, long long>
#define vpii vector< pair <int,int>>
#define vpll vector< pair<long long, long long>>
//#define max(a,b) ((a>b)?a:b)
//#define min(a,b) ((a>b)?b:a)
#define max3(a,b,c) ((a>b)?(a>c)?a:c:(b>c)?b:c)
#define min3(a,b,c) ((a<b)?(a<c)?a:c:(b<c)?b:c)
#define avg(a,b) ((a)+(b))/2
#define pb push_back
#define pob pop_back
#define sf int flag=0     //Remember semicolon
// #define assmin(a,b) if(b<=a) { a=b; }
// #define assmax(a,b) if(b>=a) { a=b; }
#define f first
#define s second
#define fix(f,n) std::fixed<<std::setprecision(n)<<f
#define all(x) x.begin(), x.end()
#define M_PI 3.14159265358979323846
#define epsilon (double)(0.00000000001)
#define side 1e9
#define watch(x) cout << (#x) << " is " << (x) << endl
typedef long long ll;
ll mod(ll a, ll b)
{
	if(a%b<0)
	{
		return a%b + b;
	}
	return a%b;
}
 
 
ll mod_exp(ll a, ll b, ll c)
{
	ll res=1;
	a=a%c;
	while(b>0)
	{
		if(b%2==1)
		{
			res=(res*a)%c;
		}
		b/=2;
		a=(a*a)%c;
	}
	return res;
}
ll mymod(ll a,ll b)
{
    return ((a%b)+b)%b;
}
bool prime[200001];
void SieveOfEratosthenes() 
{ 
    memset(prime, true, sizeof(prime)); 
    prime[1]=false;
    for (int p=2; p*p<=200000; p++) 
    { 
        if (prime[p] == true) 
        { 
            for (int i=p*p; i<=200000; i += p) 
                prime[i] = false; 
        } 
    } 
    return;
}
ll powe[200005];
void power()
{
    powe[0]=1;
    REP(i,1,200005)
    {
        powe[i]=mymod(2*powe[i-1],num);
    }
}
ll gcdExtended(ll,ll,ll *,ll *);
ll modInverse(ll a, ll m) 
{ 
    ll x, y; 
    ll g = gcdExtended(a, m, &x, &y); 
        ll res = (x%m + m) % m;
        return res;
} 
ll gcdExtended(ll a, ll b, ll *x, ll *y) 
{ 
    if (a == 0) 
    { 
        *x = 0, *y = 1; 
        return b; 
    } 
    ll x1, y1; 
    ll gcd = gcdExtended(b%a, a, &x1, &y1); 
    *x = y1 - (b/a) * x1; 
    *y = x1; 
    return gcd; 
}
struct node
{
	vpll adj;
    ll biggest;
    ll op;
    ll size;
};

ll find(ll n, ll wt, ll nm)
{
    ll st = 1;
    ll en = nm;
    ll mid = (st) + (en - st)/2;
    while(st<=en)
    {
        if(wt+3*(nm+mid)>=n && wt+2*(nm+mid)<=n)
        {
            return mid;
        }
        else if(wt+3*(nm+mid)<n)
        {
            st = mid+1;
        }
        else
        {
            en = mid-1;
        }
        mid = (st) + (en - st)/2;
    }
    if(wt+3*(nm+mid)>=n && wt+2*(nm+mid)<=n)
    {
            return mid;
     }
    return 0;
}
ll digits(ll a)
{
    ll ans = 0;
    while(a)
    {
        ans++;
        a/=10;
    }
    return ans;
}
bool my(pair<ll, char> p1, pair<ll, char> p2)
{
    return p1.first > p2.first;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll x=100;
    ll n;
    cin>>n;
    ll days=0;
    while(n>x)
    {
        x+=x/100;
        days++;
    }
    cout<<days<<'\n';
    return 0;
}


Measured memory_bytes: 3604
#pragma GCC optimize(3)
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/priority_queue.hpp>
#define MAXN 100005
#define INF 1000000000
#define MOD 1000000007
#define F first
#define S second
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef pair<int,int> P;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
typedef __gnu_pbds::priority_queue<int,greater<int>,pairing_heap_tag> pq;
int n,c,k,a[MAXN];
int main()
{
    scanf("%d%d%d",&n,&c,&k);
    for(int i=1;i<=n;i++) scanf("%d",&a[i]);
    sort(a+1,a+n+1);
    int last=1,ans=0;
    for(int i=2;i<=n;i++)
    {
        if(i-last>=c||a[i]-a[last]>k)
        {
            ans++;
            last=i;
        }
    }
    ans++;
    printf("%d\n",ans);
    return 0;
}



Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const ll INF = 1LL << 60;
const int MAX = 1000000010;
const ll MOD = 1000000007;
const double PI = acos(-1);

int main () {
    vector<int> A(5);
    for (int i = 0; i < 5; i++) {
        cin >> A[i];
    }
    for (int i = 0; i < 5; i++) {
        if (A[i] == 0) {
            cout << i + 1 << endl;
            return 0;
        }
    }
}

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

int main(){
    int b,n,i,j,k,count=0;

    cin >> n >> k;

    int d[k];
    int ans[n]={};

    for(i=0;i<k;i++){
        cin >> d[i];
        int a[i+1][d[i]];
        for(j=0;j<d[i];j++){
            cin >> a[i][j];
            b = a[i][j] - 1;
            ans[b]=1;
        }
    }

    for(i=0;i<n;i++){
        if(ans[i]==0) count++;
    }

    cout << count << endl;
}

Measured memory_bytes: 3624
using System;
using System.Linq;
using System.Collections.Generic;
class Program
{
    static void Main(string[] args)
    {
        string s = Console.ReadLine();
        bool[] notBeautiful = new bool[26];
        for (int i = 0; i < s.Length; i++)
            notBeautiful[s[i] - 'a'] = notBeautiful[s[i] - 'a'] == false;
        Console.WriteLine(notBeautiful.Count(x => x == true) == 0 ? "Yes" : "No");
    }
}


Measured memory_bytes: 11220
#include <stdio.h>
int prime[1000000],z;
bool p[1000010];
void pr()
{
    p[2] = 1;
    prime[z] = 2;
    z++;
    for(int i=3; i<1000000; i+=2)
    {
        p[i] = 1;
    }
    for(int i=3; i*i<1000000; i+=2)
    {
        if(p[i])
        {
            for(int j=i+i; j<1000000; j+=i)
            {
                p[j] = 0;
            }
        }
    }
    for(int i=3; i<1000000; i+=2)
    {
        if(p[i])
        {
            prime[z] = i;
            z++;
        }
    }
}

int main()
{
    pr();
    int n,cnt;
    while(~scanf("%d", &n))
    {
        cnt = 0;
        for(int i=0; i<z; i++)
        {
            cnt++;
            if(prime[i] > n)
            {
                cnt--; break;
            }
        }
        printf("%d\n", cnt);
    }
    return 0;
}


Measured memory_bytes: 3940
#include<bits/stdc++.h>
using namespace std;
long long  a[100005];
const long long  MOD = 998244353;
long long  mult(long long  a , long long  b) {
    return (a%MOD*b%MOD)%MOD;
}
long long  sd[1000005] = {0};
int  main(int argc , char* argv[]){
    long long  n;
    cin >> n;
    for(long long  i = 0 ; i < n ; i++) cin >> a[i];
    if(a[0] !=0 ){ cout << "0"; return 0;}
    long long  ans = 1;
    
    for(long long  i = 0 ; i < n ; i++)
        sd[a[i]]++;
    long long  f= 0 ;
    /*for(long long  i = 0 ; i < n ;i++){
        if(sd[i] == 1 && f == 1) { cout << "0"; return 0;}
        else if(sd[i] == 0){ f=1;
        } 
    }*/
    for(long long i = 1 ; i < n;i++){
        if(a[i]==0) {
            f=1;break;
        }
    }
    if(f){cout << "0"; return 0;}

    for(long long  i = 1 ; i < n ; i++){
      //if(sd[i-1] == 0) continue;
        ans  = ans % MOD;
        for(int j  = 0 ; j <  sd[i] ; j++)
            ans = mult(ans , sd[i-1]);
        //sum+=sd[i-1];
    }
    //sum+=sd[n-1];
    //if(sum!= n) cout << "0";
    ans = ans % MOD;
    cout << ans;
    return 0;
    
}

Measured memory_bytes: 3456
# coding:utf-8
import sys 
def main():
    n = int(input())
    t = [0]*(n+1)
    x = [0]*(n+1)
    y = [0]*(n+1)
    for i in range(1,n+1):
        t[i],x[i],y[i]=map(int,input().split())

    for i in range(1,n+1):
        idou  =  abs(x[i]-x[i-1])+abs(y[i]-y[i-1])
        jikan = t[i]-t[i-1]
        if idou > jikan:
            print('No')
            exit()
        elif jikan %2 != idou%2:
            print('No')
            exit()
    print('Yes')


if __name__ == '__main__' :
    main()

Measured memory_bytes: 11636
#include <bits/stdc++.h>
#define ll long long
#define MODV 1000000007
#define INFLL LLONG_MAX // 9223372036854775807
#define EPS 1e-9
#define rep(i, n) for(ll i=0, i##_len=(ll)(n); i<i##_len; i++)
#define repf(i, n) for(ll i=1, i##_len=(ll)(n+1); i<i##_len; i++)
#define all(v) v.begin(), v.end()
#define endl "\n"
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define Yes() cout << "Yes" << endl
#define YES() cout << "YES" << endl
#define No() cout << "No" << endl
#define NO() cout << "NO" << endl
#define Init() std::ios::sync_with_stdio(false); std::cin.tie(0); std::cout<<fixed<<setprecision(15);
template<class T>bool chmax(T &a, const T &b){ if(a<b){ a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b){ if(b<a){ a=b; return 1; } return 0; }
using namespace std;

int main(){
    Init();
    long double a, b;
    cin >> a >> b;
    b = (ll)((b+0.001)*100);
    cout << (ll)(a*b/100) << endl;
}

Measured memory_bytes: 3716
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <functional>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;

#define fst first
#define scd second
#define PB push_back
#define MP make_pair
#define rep(i,x) for(int i=0;i<(x);++i)
#define rep1(i,x) for(int i=1;i<=(x);++i)
#define rrep(i,x) for(int i=(x)-1;i>=0;--i)
#define rrep1(i,x) for(int i=(x);i>=1;--i)
#define FOR(i,a,x) for(int i=(a);i<(x);++i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()

#define omajinai ios::sync_with_stdio(false);cin.tie(0)

template<typename T>bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<typename T>bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
template<typename T>T get(){T a;cin>>a;return a;}
template<typename T>T rev(T a){reverse(all(a));return a;}
template<typename T>istream&operator>>(istream&is,vector<T>&vec){rep(i,vec.size())is>>vec[i];return is;}
template<typename T>vector<T>&sort(vector<T>&a){sort(all(a));return a;}

const int inf = 1e9;
const ll linf = 3e18;
const double eps = 1e-9;

int C[300010];

signed main()
{
    omajinai;

    int N, Q; cin >> N >> Q;

    rep(i, N) {
        int c; cin >> c;
        C[c] = c;
    }

    rep1(i, 300000) {
        chmax(C[i], C[i - 1]);
    }

    rep(i, Q) {
        int q; cin >> q;

        int ma = 0;

        for (int j = q - 1; j <= 300000; j += q) {
            chmax(ma, C[j] % q);
        }

        cout << ma << endl;
    }
}

Measured memory_bytes: 2368
#include <iostream>


using namespace std;


int main()
{
    int i, ans, a, b, c,d;
    
    cin >> a >> b >> c;
    ans = 0;
    d=0;
    for(i=a; i<=b; i++)
    {
        if(ans== c % i )
        d++;
    }
    cout << d << endl;
}




Measured memory_bytes: 3100
// Lavina Jain
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ord_set;
#define pii pair<int,int>
#define pll pair<ll,ll>
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define MAX 1000000007
#define fast_io ios_base::sync_with_stdio(false); cin.tie(NULL);
#define cases int t; cin>>t; while(t--)
ll mini(ll a,ll b) { if(a<b) return a; return b; }
ll maxi(ll a,ll b) { if(a>b) return a; return b; }
ll mod(ll a) { return a % MAX ; }
ll power(ll a,ll b) { if(b==0) return 1; else if(b%2==0) return power(a*a,b/2); else return a*power(a*a,b/2); }
ll powermod(ll a,ll b) { if(b==0) return 1; else if(b%2==0) return mod(powermod(mod(a*a),b/2)); else return mod(a)*mod(powermod(mod(a*a),b/2)); }
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

int main()
{
    fast_io;
    ll n;
    ll ar[200010];
    ll ind[200010];
    memset(ind,-1,sizeof ind);
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        cin>>ar[i];
        ind[ar[i]]=i;
    }
    int next = 1;
    ll l = 0, temp;
    int prev;
    while(1)
    {
        if(next>n)
            break;
        temp = 1;
        prev = ind[next];
        for(int i=next+1;;i++)
        {
            if(i>n)
            {
                next = i;
                break;
            }
            if(ind[i]>prev)
            {
                temp++;
                prev = ind[i];
                next = i+1;
            }
            else
            {
                next = i;
                break;
            }
        }
        l = maxi(l,temp);
    }
    ll ans = n-l;
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3328
#pragma GCC optimize(2)
#pragma GCC optimize(3)
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double lld;
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define loop(i,n) for(ll i=0;i<(n);++i)
#define FOR(i,a,b) for(ll i=(a);i<=(b);++i)
#define FORD(i,a,b) for(ll i=(a);i>=(b);--i)
#define cases ll T=0;cin>>T;while(T--)
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
#define END "\n"
#define pb push_back
#define go(c,itr) for(auto itr=(c).begin(); itr!=(c).end(); ++itr)
#define back(c,itr) for(auto itr=(c).rbegin(); itr!=(c).rend(); ++itr)
#define PI 3.14159265359
#define inf 9e18
#define MOD 1000000007
#define MODU 998244353
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define MAXN 200001
const string alpha = "abcdefghijklmnopqrstuvwxyz";
void task(bool flag)
{
	if (flag)
		cout << "YES\n";
	else
		cout << "NO\n";
}
signed main() {
// #ifndef ONLINE_JUDGE
// 	freopen("input.txt", "r", stdin);
// 	freopen("output.txt", "w", stdout);
// #endif
	fast
	ll a, b, h, m;
	cin >> a >> b >> h >> m;
	lld hangle = 0.0, mangle = 0.0;
	mangle = 6.0 * m;
	hangle = 30.0 * h + m / 2.0;
	// cout << mangle << " " << hangle << END;
	lld angle = (long double)(fabs(mangle - hangle));
	angle = (angle * PI / 180.0);
	// cout << angle << END;
	lld dist = sqrt(a * a + b * b - 2 * a * b * cos(angle));
	cout << fixed << setprecision(18) << dist << END;

// #ifndef ONLINE_JUDGE
// 	cout << "\nTime Elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " sec\n";
// #endif
	return 0;
}

Measured memory_bytes: 3820
#include<bits/stdc++.h>
using namespace std;
int main()
{ vector<int>a;int k=0,l=0;
   a.resize(3);
   for(int i=0;i<a.size();i++)
   cin>>a[i];
   for(int i=0;i<a.size();i++)
    { if(a[i]==5)
        k++;
      else if(a[i]==7)
       l++;}
if(k==2&&l==1)
 cout<<"YES";
else
cout<<"NO";
return 0;
}
      

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <deque>
#include <queue>
#include <list>
#include <stack>
#include <string>
#include <functional>
#include <numeric>
#include <cmath>
#include <iomanip>
#include <map>
#include <cstdlib>
#define INF 100000000
#define _INF -100000000
#define Loop(i, n) for(int i = 0; i < (int)n; i++)
#define Loop1(i, n) for(int i = 1; i <= (int)n; i++)
#define Loopr(i, n) for(int i = (int)n - 1; i >= 0; i--)
#define Loopr1(i, n) for(int i = (int)n; i >= 1; i--)
using namespace std;
typedef long long int ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef pair<int, int> P;

char field[1000][1001];
int d[1000][1000];
int h, w, n;
int sx, sy;
int dx[4] = { 0,0,-1,1 }, dy[4] = { -1,1,0,0 };
int ret;
queue<P> que;

void solve() {
	char c = '1';
	while (c < '1' + n) {
		Loop(i, h) {
			Loop(j, w) {
				d[i][j] = -1;
			}
		}
		que.push(P(sx, sy));
		d[sx][sy] = ret;
		while (que.size()) {
			P p = que.front(); que.pop();
			Loop(k, 4) {
				int a = p.first + dx[k], b = p.second + dy[k];
				if (a >= 0 && a <= h - 1 && b >= 0 && b <= w - 1
					&& field[a][b] != 'X' && d[a][b] == -1) {
					d[a][b] = d[p.first][p.second] + 1;
					if (field[a][b] == c) {
						ret = d[a][b];
						sx = a; sy = b;
						while (que.size()) que.pop();
						c++;
						break;
					}
					else que.push(P(a, b));
				}
			}
		}
	}

}

int main() {
	cin >> h >> w >> n;
	Loop(i, h) {
		Loop(j, w) {
			cin >> field[i][j];
			if (field[i][j] == 'S') { sx = i;sy = j; }
		}
	}
	ret = 0;
	solve();
	cout << ret << endl;
	return 0;
}

Measured memory_bytes: 7980
def I(): return int(input())
def LI(): return list(map(int,input().split()))
def MI(): return map(int,input().split())
def LLI(n): return [list(map(int, input().split())) for _ in range(n)]

n = I()
h = [0]+ LI()
#h[i]はi番目の高さ
#0-indexedにしておくと考えにくいので1-indexedにしておく
#dp[i]は足場iにいくのに必要な最小コスト
dp = [0]*(n+1)
#これも1-indexedにしておく
dp[1] = 0
dp[2] = abs(h[2]-h[1])
#2番目の足場に移るのは1番目の足場からいくしかないのでわけて考える
#最初蛙は足場1にいるため最小コストは0としておく
for i in range(3,n+1):
    dp[i] = min(dp[i-2]+abs(h[i]-h[i-2]), dp[i-1]+abs(h[i]-h[i-1]))
print(dp[n])

Measured memory_bytes: 20896