akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
const int N = 2000006;
const int MOD = 1e9 + 7;
#define eps 1e-9
#define LL long long
#define pb push_back
#define mk make_pair
#define inf 0x3f3f3f3f
#define vi vector <int>
#define all(a) a.begin(), a.end()
#define Unique(a) sort(all(a)), a.erase(unique(all(a)), a.end()

using namespace std;

int main()
{
    int n; cin >> n;
    vi in;
    for(int i = 0; i < 4; i++) {
        in.pb(n % 10);
        n /= 10;
    }
    int a = 1, b = 1;
    for(int i = 0; i < 3; i++) if(in[i] != in[0]) a = 0;
    for(int i = 1; i < 4; i++) if(in[i] != in[1]) b = 0;
    if(a || b) puts("Yes");
    else puts("No");
    return 0;
}


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

#define _CRT_SECURE_NO_WARNINGS
#define TLong long long
#define TBMod 1000000007

int main(int argc, char const *argv[])
{
	char s[103];
	TLong k;
	scanf("%s",s);
	scanf("%lld",&k);
	for (int i = 0; i < strlen(s); ++i)
	{
		if(s[i] != '1'){
			printf("%c\n", s[i]);
			return 0;
		}
		else if(i == k - 1){
		  puts("1");
		  return 0;
		}
	}
	puts("1");
	return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
#define MOD (1000000007)
#define INF (1e9)
#define INFL (1e18)
 
typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
template<class T>using arr=vector<vector<T>>;
template<class T>void pr(T x){cout << x << endl;}
template<class T>void prvec(vector<T>& a){rep(i, a.size()-1){cout << a[i] << " ";} cout << a[a.size()-1] << endl;}
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
 
int main()
{
    int n; cin >> n;
    map<int, int> m;
    int a;
    ll ans = 0;
    rep(i, n){
        cin >> a;
        m[a]++;
        ans += a;
    }
    int q; cin >> q;
    rep(i, q){
        int b, c; cin >> b >> c;
        if(m[b]==0){
            pr(ans);
            continue;
        }
        ans += m[b]*(c-b);
        pr(ans);
        m[c] += m[b];
        m[b] = 0;
    }
    return 0;}

Measured memory_bytes: 7800
#include<bits/stdc++.h>
#define For(i, a, b)  for(int i = a, _b = b; i <= _b; ++i)
#define Ford(i, a, b) for(int i = a, _b = b; i >= _b; --i)
#define FileName      "test"
#define ll            long long
#define ld            long double
#define ull           unsigned long long
#define Print(x)      cerr << #x << "is " << x << '\n';
#define pb            push_back
#define X             first
#define Y             second
//#define Karma

using namespace std;

template<typename T> inline void Cin(T &x)
{
    char c;
    T sign = 1;
    x = 0;
    for (c = getchar(); c < '0' || c > '9'; c = getchar())
        if (c == '-') sign = -1;
    for (; c >= '0' && c <= '9'; c = getchar())
        x = x * 10 + c - '0';
    x *= sign;
}
template <typename T> inline void Out(T x) {if(x > 9) Out(x / 10); putchar(x % 10 + '0');}
template <typename T> inline void Cout(T x, char c) {if(x < 0) putchar('-'); x = abs(x); Out(x); putchar(c);}
template <typename T, typename... Args> inline void Cin(T& a, Args&... args) {Cin(a);Cin(args...);}
template <typename T, typename... Args> inline void Cout(T a, char c, Args... args) {Cout(a, c);Cout(args...);}

typedef pair<int, int> pii;
typedef pair<ll, int> plli;
const int N = 1e3 + 7;
const int M = 2e4 + 7;

struct TVal
{
    int w, s;
    ll v;
    bool operator<(const TVal& x)const&
    {
        return s - x.w < x.s - w;
    }
} a[N];
ll f[M][N];
int n;

void Enter()
{
     Cin(n);
     For(i, 1, n) Cin(a[i].w, a[i].s, a[i].v);
     sort(a + 1, a + n + 1);
}

void Solve()
{
     ll res = 0;
     For(i, 0, 10000)
     {
         For(j, 1, n)
         {
             f[i][j] = max(f[i][j], f[i][j - 1]);
             res = max(res, f[i][j]);
             if(a[j].s >= i && i + a[j].w < M)
             {
                 f[i + a[j].w][j] = max(f[i + a[j].w][j], f[i][j - 1] + a[j].v);
                 res = max(res, f[i + a[j].w][j]);
             }
         }
     }
     cout << res;
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
#ifdef Karma
    freopen(FileName".inp", "r", stdin);
    freopen(FileName".out", "w", stdout);
#endif // Karma

    Enter();
    Solve();

    return 0;
}


Measured memory_bytes: 157696
M,D = map(int,input().split())

ans = 0
for m in range(1,M+1):
    for d in range(1,D+1):
        d1 = d%10
        d10 = (d%100)//10
        if d1*d10==m and d1>1 and d10>1:
            ans += 1

print(ans)

Measured memory_bytes: 39408
# 初期入力
import sys
input = sys.stdin.readline
N,X = (int(x) for x in input().split())
L = list(map(int, input().split()))
d =[0]*(N+1)
count =1
for i in range(N):
    d[i+1] =d[i] +L[i]
    if d[i+1] <= X:
        count +=1
    else:
        break
print(count)

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

int main()
{
  int N, A, ret;
  cin >> N;
  ret = pow(3, N);

  int count_even = 0;
  for (int i = 0; i < N; i++)
  {
    cin >> A;
    if (A % 2 == 0)
      count_even++;
  }
  ret -= pow(2, count_even);

  cout << ret;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <vector>
#include <iostream>
#include <queue>
#include <bits/stdc++.h>
 
#define rep(i,n) for (int i=0;i<(n);++i)
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<double> vd;
typedef pair<int, int> pi;


int main() {
  int n, m;
  cin >> n >> m;
  vi a(m);
  rep(i, m) cin >> a[i];

  ll sum = 0;
  rep(i, m) sum += a[i];
  if (sum > n) cout << -1 << endl;
  else cout << n - sum << endl;
  return 0;
}

Measured memory_bytes: 3640
#include<cstdio>
using namespace std;
int g_x,g_y;
char field[105][105];
void solve(int y,int x);
int main(){

    int h,w;
    while(scanf("%d %d",&h,&w),!h==0 && !w==0){
        for(int i=0;i<h;i++){
            scanf("%s",field[i]);
        }
        solve(0,0);
        if(g_x==-1 && g_y==-1)puts("LOOP");
        else printf("%d %d\n",g_x,g_y);
    }
    return 0;

}

void solve(int y,int x){
    if(field[y][x]=='0'){
        g_x=g_y=-1;
        return;
    }
    if(field[y][x]=='.'){
        g_x=x;
        g_y=y;
        return;
    }
    if(field[y][x]=='>'){
        field[y][x]='0';
        solve(y,x+1);
    }
    if(field[y][x]=='<'){
        field[y][x]='0';
        solve(y,x-1);
    }
    if(field[y][x]=='^'){
        field[y][x]='0';
        solve(y-1,x);
    }
    if(field[y][x]=='v'){
        field[y][x]='0';
        solve(y+1,x);
    }
}

Measured memory_bytes: 1076
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <iomanip>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector< vector<int> > VVI;
typedef pair<int,int> P;
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(a) (a).begin(),(a).end()

int main(){
  string S;
  cin>>S;
  int ans=0;
  int P=0;
  int G=0;
  int F=0;
  rep(i,S.size()){
    if(F==0){
      if(S[i]=='p') P++;
      else G++;
      if(G-P>=S.size()-1-i) F=1;
    }else{
      if(S[i]=='g') ans++;
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 512
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC push_options
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx")
#include<bits/stdc++.h>
#include <xmmintrin.h>
#include <immintrin.h>
using namespace::std;
__attribute__((constructor))void init(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/priority_queue.hpp>
#include<ext/pb_ds/tag_and_trait.hpp>
// #include <boost/multiprecision/cpp_dec_float.hpp>
// #include <boost/multiprecision/cpp_int.hpp>
// namespace mp = boost::multiprecision;
// typedef mp::number<mp::cpp_dec_float<0>> cdouble;
// typedef mp::cpp_int cint;
template<typename T>using pbds=__gnu_pbds::tree<T,__gnu_pbds::null_type,less<T>,__gnu_pbds::rb_tree_tag,__gnu_pbds::tree_order_statistics_node_update>;
template<typename T>using pbds_map=__gnu_pbds::tree<T,T,less<T>,__gnu_pbds::rb_tree_tag,__gnu_pbds::tree_order_statistics_node_update>;
template<typename T,typename E>using hash_map=__gnu_pbds::gp_hash_table<T,E>;
template<typename T>using pqueue =__gnu_pbds::priority_queue<T, greater<T>,__gnu_pbds::rc_binomial_heap_tag>;
typedef long long lint;
#define INF (1LL<<60)
#define IINF (1<<30)
#define LINF (9223372036854775807LL)
#define EPS (1e-10)
#define endl ('\n')
//#define MOD 1000000007LL
#define MOD 998244353LL
//#define MOD 18446744069414584321ULL
typedef vector<lint> vec;
typedef vector<vector<lint>> mat;
typedef vector<vector<vector<lint>>> mat3;
typedef vector<string> svec;
typedef vector<vector<string>> smat;
template<typename T>inline void numout(T t){bool f=0;for(auto i:t){cout<<(f?" ":"")<<i<INF/2?i:"INF";f=1;}cout<<endl;}
template<typename T>inline void numout2(T t){for(auto i:t)numout(i);}
template<typename T>inline void output(T t){bool f=0;for(auto i:t){cout<<(f?" ":"")<<i;f=1;}cout<<endl;}
template<typename T>inline void output2(T t){for(auto i:t)output(i);}
template<typename T>inline void _output(T t){bool f=0;for(lint i=0;i<t.size();i++){cout<<f?"":" "<<t[i];f=1;}cout<<endl;}
template<typename T>inline void _output2(T t){for(lint i=0;i<t.size();i++)output(t[i]);}
#define rep(i,n) for(lint i=0;i<lint(n);++i)
#define repi(i,a,b) for(lint i=lint(a);i<(lint)(b);++i)
#define rrep(i,n) for(lint i=lint(n)-1;i>=0;--i)
#define rrepi(i,a,b) for(lint i=lint(b)-1;i>=lint(a);--i)
#define irep(i) for(lint i=0;;++i)
#define all(n) begin(n),end(n)
#define dist(a,b,c,d) sqrt(pow(a-c,2)+pow(b-d,2))
inline lint gcd(lint A,lint B){return B?gcd(B,A%B):A;}
inline lint lcm(lint A,lint B){return A/gcd(A,B)*B;}
// inline cint cgcd(cint A,cint B){return B?cgcd(B,A%B):A;}
// inline cint clcm(cint A,cint B){return A/cgcd(A,B)*B;}
bool chmin(auto& s,const auto& t){bool res=s>t;s=min(s,t);return res;}
bool chmax(auto& s,const auto& t){bool res=s<t;s=max(s,t);return res;}
const vector<lint> dx={1,0,-1,0,1,1,-1,-1};
const vector<lint> dy={0,1,0,-1,1,-1,1,-1};
#define SUM(v) accumulate(all(v),0LL)
auto call=[](auto f,auto... args){return f(f,args...);};

int main(){
    lint n;
    cin>>n;
    cout<<lcm(2,n)<<endl;
}

Measured memory_bytes: 3656
#include <bits/stdc++.h>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define FOR(i,a,b) for(int i=a; i<(int)(b); i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort(ALL(x))
#define CLR(a) memset((a), 0 ,sizeof(a))
#define PB push_back
#define MP make_pair
#define SP << " " <<
const int INF = 1001001001;
const ll LINF = 100100100100100100;
const double EPS = 1e-10;
const long double PI  = acos(-1.0L);
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
#define chmax(a,b) a = (((a)<(b))?(b):(a))
#define chmin(a,b) a = (((a)>(b))?(b):(a))

__attribute__((constructor))
void initial(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}

ll mpow(ll a, ll b){
	if(b==0){
		return 1;
	}else if(b%2==0){
		ll memo = mpow(a,b/2);
		return memo*memo%MOD;
	}else{
		return mpow(a,b-1)*a%MOD;
	}
}

signed main(){
	int sx,sy,tx,ty; cin>>sx>>sy>>tx>>ty;
	int dx=tx-sx, dy=ty-sy;

	rep(i,dx) cout << 'R';
	rep(i,dy) cout << 'U';
	rep(i,dx) cout << 'L';
	rep(i,dy+1) cout << 'D';
	rep(i,dx+1) cout << 'R';
	rep(i,dy+1) cout << 'U';
	cout << "LU";
	rep(i,dx+1) cout << 'L';
	rep(i,dy+1) cout << 'D';
	cout << 'R';

	return 0;
}


Measured memory_bytes: 256
#include<algorithm>
#include<bitset>
#include<cmath>
#include<complex>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<iterator>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>

using namespace std;
typedef long long ll;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define D()
#define INF 1000000000000
#define MOD 10000007
#define MAXR 100000
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define INITA(a,i,j,v) for(ll k=i;k<=j;k++){a[k]=v;}

int main() {
    int n; cin >> n;
    // 似ている数列は3^n通り
    // そこから全て奇数のパターンを除いたものが答え
    int odd_pattern = 1;
    REP(i, n) {
        int tmp;
        cin >> tmp;
        if (tmp % 2 == 0) {
            odd_pattern *= 2;
        }
    }
    cout << pow(3, n) - odd_pattern << endl;
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
using ll = long long;

ll fact;
ll fact_inv;

const ll MOD = 1e9 + 7;
// 繰り返し二乗法
ll power(ll a, ll b) {
    ll res = 1;
    while (b > 0) {
        if (b & 1) res = res * a % MOD;
        a = a * a % MOD;
        b >>= 1;
    }
    return res;
}

int main() {
    ll n, a, b;
    cin >> n >> a >> b;
    ll ans = power(2, n) - 1;

    //nCa
    ll nca = 1;
    ll ncb = 1;

    ll x = 1, y = 1;

    for (int i = 0; i < a; i++) {
        x *= (n - i);
        x %= MOD;
        y *= (i + 1);
        y %= MOD;
    }
    nca = x * power(y, MOD - 2) % MOD;

    x = 1, y = 1;
    for (int i = 0; i < b; i++) {
        x *= (n - i);
        x %= MOD;
        y *= (i + 1);
        y %= MOD;
    }
    ncb = x * power(y, MOD - 2) % MOD;
    //cout << ans <<"\n" << nca << "\n" << ncb << " ";
    cout << (MOD * 3 + ans - (nca + ncb)) % MOD << "\n";

    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <string>
#include <utility>
#include <vector>
#define FOR(i, a, b) for (int i = a, i##_len = (b); i < i##_len; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) (x).begin(), (x).end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
#define EPS (1e-7)
#define INF (1e9)

using namespace std;

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

  string s;
  cin >> s;

  const char *str = s.c_str();
  int len = s.length();
  if (str[0] != 'A')
  {
    cout << "WA" << endl;
    return 0;
  }

  int C = 0;
  int lower = 0;
  FOR(i, 1, len)
  {
    // cout << i << str[i] << endl;
    if (islower(str[i]))
    {
      lower++;
    }
    else if (2 <= i && i <= len - 2 && str[i] == 'C')
    {
      C++;
    }
  }

  // cout << C << " " << lower << endl;

  if (C == 1 && lower == len - 2)
  {
    cout << "AC" << endl;
  }
  else
  {
    cout << "WA" << endl;
  }
}


Measured memory_bytes: 256
#include <iostream>

int main()
{
	int x, y;
	bool bx = false;
	bool by = false;
	int group1[] = {1, 3, 5, 7, 8, 10, 12};
	int group2[] = {4, 6, 9, 11};
	int group3[] = {2};
	scanf("%d %d", &x, &y);
	int i;
	for (i = 0; i < sizeof(group1)/sizeof(group1[0]); i++) {
		if (group1[i] == x)
			bx = true;
		if (group1[i] == y)
			by = true;
	}
	if (bx && by) {
		printf("Yes");
		return 0;
	} else {
		bx = false;
		by = false;
	}
	for (i = 0; i < sizeof(group2)/sizeof(group2[0]); i++) {
		if (group2[i] == x)
			bx = true;
		if (group2[i] == y)
			by = true;
	}
	if (bx && by) {
		printf("Yes");
		return 0;
	} else {
		bx = false;
		by = false;
	}

	for (i = 0; i < sizeof(group3)/sizeof(group3[0]); i++) {
		if (group3[i] == x)
			bx = true;
		if (group3[i] == y)
			by = true;
	}
	if (bx && by) {
		printf("Yes");
		return 0;
	} else {
		bx = false;
		by = false;
	}
	printf("No");
	return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int a =sc.nextInt();
     int b=sc.nextInt();
     if( a>b){
         System.out.println("a > b");
     } else if (a<b){
         System.out.println("a < b");
     } else {System.out.println("a == b");}
     
        //BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        //String line = br.readLine();
    }
}



Measured memory_bytes: 26236
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);



int main(){
	IOS;
	string s;
	cin >> s;
	int ans = 0;
	string prv = "";
	string cur = "";
	for(int i = 0; i < s.size(); i++)
	{
		cur += s[i];
		if(cur != prv)
		{
			prv = cur;
			cur = "";
			ans++;
		}
	}		
	cout << ans;
	return 0;
}


Measured memory_bytes: 720
N=int(input())
A=sorted(list(map(int,input().split())))

MOD=10**9+7

if N%2:
    arr=sorted([0]+list(range(2,N))[::2]*2)
else:
    arr=sorted(list(range(1,N))[::2]*2)

print(2**(N//2)%MOD if A == arr else 0)

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

int main()
{    
    int a;
    string s;
    cin >> a >> s;
    cout << (a>=3200 ? s:"red") << endl;
    return 0;
}

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

int main()
{
  int x,a,b;
  char res;
  cin >> x>>a>>b;

  if(abs(x-a)<abs(x-b)) res = 'A';
  else res='B';

  cout << res << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

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

    int N = scanner.nextInt();
    int[] W = new int[N];
    int sum = 0;
    for (int i = 0; i < N; i++) {
      W[i] = scanner.nextInt();
      sum += W[i];
    }

    int min = sum;
    int s = 0;
    for (int i = 0; i < N - 1; i++) {
      s += W[i];
      min = Math.min(min, Math.abs(sum - s * 2));
    }
    System.out.println(min);
  }
}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> VI;
 
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 (a>b) { a=b; return 1; } return 0; }
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()

int main(){
    int n;cin>>n;
    cout<<(n*3.141*2)<<endl;
}

Measured memory_bytes: 3788
import java.io.*;

class Main {
    BufferedReader bf;
    PrintWriter writer;
    StringBuilder sb;
    static boolean local_system = false;

    void run() throws IOException {
        int n = getInt();
        int a = n % 1000 == 0 ? 0 : -(n - 1000*(n/1000+1));
        writer.println(a); 
    }

    public static void main(String[] args) throws IOException {
        long start_time = System.currentTimeMillis();
        Main obj = new Main();
        obj.run();
        long end_time = System.currentTimeMillis();
        if (local_system) obj.writer.println("Time : " + (end_time - start_time));
        obj.close();
    }

    public Main(){
        writer = new PrintWriter(System.out);
        bf = new BufferedReader(new InputStreamReader(System.in));
        sb = new StringBuilder();
    }

    public int getInt() throws IOException {
        return Integer.parseInt(bf.readLine());
    }

    public long getLong() throws IOException {
        return Long.parseLong(bf.readLine());
    }

    public int[] ints() throws IOException {
        String[] data = bf.readLine().split(" ");
        int[] send = new int[data.length];
        for (int i = 0, h = data.length; i < h; i++) send[i] = Integer.parseInt(data[i]);
        return send;
    }

    public long[] longs() throws IOException {
        String[] data = bf.readLine().split(" ");
        long[] send = new long[data.length];
        for (int i = 0, h = data.length; i < h; i++) send[i] = Long.parseLong(data[i]);
        return send;
    }

    public void close() throws IOException{
        writer.flush();
        writer.close();
        bf.close();
    }
}




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

int main(){
    ll K;  cin >> K;
    ll N = 50;
    vector<ll> a(N, N-1 + K/N);

    ll R = K%N;
    for(int i=0; i<N; i++){
        if(i < R){
            a[i] += N - (R - 1);
        }else{
            a[i] -= R;
        }
    }
    cout << N << endl;
    for(ll v : a){
        cout << v << " ";
    }cout << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <time.h>
#include <math.h>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <iterator>
#include <sstream>
#include <string>
#include <bitset>
using namespace std;
#define FOR(I,F,N) for(int I = F; I < (int)(N); I++)
#define rep(i, n) FOR(i, 0, n)
#define FIN(V) cout<<V<<endl
#define pb push_back
#define INF (1 << 30)
typedef pair<int, int> P;
typedef long long ll;
typedef priority_queue<int> pq;
int StrToInt(string);
string IntToStr(int);
int dx[4] = {1, -1, 0, 0};
int dy[4] = {0, 0, 1, -1};

int main(void){
	int n;
	while(cin >> n, n){
		int y;
		double maxi = 0.0;
		cin >> y;
		int b, r, t, ans;
		rep(i, n){
			cin >> b >> r >> t;
			double par;
			if(t == 1){
				par = 1+y*(r/100.0);
			}else{
				par = pow((1+r/100.0), y);
			}
			if(par > maxi){
				maxi = par;
				ans = b;
			}
		}
		cout << ans << endl;

		
	}	

	return 0;
}



int StrToInt(string s){
	stringstream ss;
	ss << s;
	int val;
	ss >> val;
	return val;
}
string IntToStr(int i){
	stringstream ss;
	ss << i;
	return ss.str();
}

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

using namespace std;

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

  int n, a;
  cin >> n;
  map<int, int> hash;
  for (int i = 0; i < n; ++i) {
    cin >> a;
    hash[a]++;
  }
  int res = 0;
  for (auto &h: hash) {
    if (h.second < h.first) res += h.second;
    else res += h.second-h.first;
  }
  cout << res << endl;

  return 0;
}



Measured memory_bytes: 4736
#include <iostream>
#include <utility>
#include <vector>
using namespace std;
#define rep(i, N) for(int i = 0; i < N; ++i)

int main()
{
    int n;
    cin >> n;

    vector<pair<string, int> > list[n];

    list[0].push_back(make_pair("a", 1));
    for (auto i = 1; i < n; i ++)
    {
        //cout << "LOOP: " << i << endl;

        for (auto k = 0; k < list[i-1].size(); k++)
        {
            int index = k;
            int numTypes =  list[i-1].at(index).second;
            auto str =  list[i-1].at(index).first;
            //cout << "count: " << numTypes << " str: " << str<< endl;
            for (auto j = 0; j < numTypes + 1; j++)
            {
                string base = list[i-1].at(index).first;
                char init = 'a' + j;
                string add{init};
                int numCount = numTypes;
                if (base.find(add) == string::npos)
                {
                    numCount++;
                }
                //cout << "numCount" << numCount << "add:" << base + add <<endl;
                list[i].push_back(make_pair(base+add, numCount));
            }
        }
    }

    for (auto i = 0; i < list[n-1].size(); i++)
    {
        cout << list[n-1].at(i).first << endl;
    }
    return 0;
}


Measured memory_bytes: 10736
#include<bits/stdc++.h>
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifndef ONLINE_JUDGE
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
using ll = long long;
int main() {
	ll x,k,d;
	cin >> x >> k >> d;
	if(x < 0) {
		x = abs(x);
		//d = -d;
	}
	if(k <= floor(x/d)) {
		cout<<abs(x-(k*d));
		return 0;
	} else {
		k-=(floor(x/d));
	}
	x-=(d * (x/d));
	if(k%2) k=1;
	else k=0;
	if(k) {
		if(x>0) x-=d;
		else x+=d;
	}
	cout<<abs(x);
	//debug()<<imie(abs(x));
	//debug()<<imie(x) imie(k);
}


Measured memory_bytes: 3636
import java.util.Scanner;
import java.util.Stack;

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

    Stack<Character> stack = new Stack<>();
    char[] s = scanner.next().toCharArray();
    int N = s.length;
    for (char c : s) {
      if (!stack.isEmpty() && stack.peek() != c) stack.pop();
      else stack.add(c);
    }
    System.out.println(N - stack.size());
  }
}


Measured memory_bytes: 26388
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,o,n) for(long long i = o;i<n;i++)
#define oneforall ios::sync_with_stdio(false);cin.tie(0);
#define all(v) (v).begin(),(v).end()
#define ini(...) int __VA_ARGS__; in(__VA_ARGS__)
#define inl(...) long long __VA_ARGS__; in(__VA_ARGS__)
#define ins(...) string __VA_ARGS__; in(__VA_ARGS__)
#define int long long 
const long long inf=1e18;
void in(){} template <typename T,class... U> void in(T &t,U &...u){ cin >> t; in(u...);}
void out(){cout << "\n";} template <typename T,class... U> void out(const T &t,const U &...u){ cout << t; if(sizeof...(u)) cout << " "; out(u...);}
typedef vector<int> vi;
typedef vector<long long> vl;
typedef long long ll;
typedef vector<pair<long, long > > vpll;
typedef vector<pair<int, int > > vpii;
#define FORR(x,arr) for(auto& x:arr)
#define ZERO(a) memset(a,0,sizeof(a))





//3111111111111111111111111111111

	void solve(){

		ini(n);
		vi morty(n);
		FOR(i,0,n){
			in(morty[i]);
		}
		ini(n1);
		int tmp = 0;
		FOR(i,0,n1){
			ini(x);
			int ll = 0;
			int rr = n;
			int tmp1 = 0;
			while(ll<=rr){
				int mid = ll+(rr-ll)/2;
				if(morty[mid] == x){
					tmp1 = 1;
					break;
				}
				else{
					if(morty[mid]>x){
						rr = mid-1;
					}
					else{
						ll  = mid+1;
					}
				}
			}
			if(tmp1 == 1){
				tmp++;
			}
		}
		out(tmp);
		
	}























int32_t main() {
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall 
	oneforall

	solve();
	


	return 0;
}



Measured memory_bytes: 3544
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) {
        MyScanner sc = new MyScanner();

        int n = sc.nextInt();
        int[] a = new int[n];

        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
        }

        int rate_num = 8;
        boolean[] is_rate = new boolean[rate_num];
        int cnt_change = 0;

        for (int i : a) {
            if (i >= 3200) {
                cnt_change++;
            } else {
                is_rate[i / 400] = true;
            }
        }

        int min = 0;
        for (boolean i : is_rate) {
            if (i)
                min++;
        }

        int max = min+cnt_change;
        min = Math.max(1, min);
        System.out.println(min + " " + max);
    }

    static class MyScanner {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in), 1 << 15);
        StringTokenizer tokenizer;

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

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }
    }
}

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

#define fi first
#define se second
#define mk(a,b) make_pair(a,b)

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

int L,R;

int main()
{
    cin >> L >> R;

    if(R - L >= 2018)
    {
        cout << 0 << endl;
        return 0;
    }

    ll ans = 100000;
    for(ll i = L; i <= R; i++)
    {
        for(ll j = i + 1; j <= R; j++)
        {
            ans = min(ans, i * j % 2019);
        }
    }

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



Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <map>
#include <string.h>
#include <math.h>
#include <set>
#include <vector>
#include <algorithm>
#define rep(i, n) for(int i = 0;i<n;i++)
#define All(a) (a).begin(), (a).end()
using namespace std;
int main(){
    int n,q;
    string s;
    cin>>n>>q>>s;
    vector<int> cnt(n);
    char last=s.at(0);
    rep(i,n-1){
        cnt[i+1] = cnt[i];
        if(last=='A' & s.at(i+1)=='C'){
            cnt[i+1]++;
        }
        last = s.at(i+1);
    }
    rep(i,q){
        int l,r;
        cin>>l>>r;
        cout<<cnt[r-1]-cnt[l-1]<<endl;
    }
}

Measured memory_bytes: 1408
N = list(input().strip())
a=len(N)
count = []
counter = 0
for n,i in zip(N,range(a)):
  if n != 'B':
    count.append(int(n))
  else:
    if len(count) == 0:
      pass
    else:
      del(count[len(count)-1]) 
p = ''.join(map(str,count))
print(p)

Measured memory_bytes: 3060
import math

N = int(input())

aa = list(map(int, input().split()))

bb = aa[:]

i = N

while i > 0:

    total = 0
    j = i * 2

    while j <= N:
        total ^= bb[j - 1]
        j += i

    bb[i - 1] = total ^ aa[i - 1]
    i -= 1

bbKisu = list(filter(lambda n: n % 2 == 1, bb))
count = len(bbKisu)

print(count)
for i in range(N):
    if bb[i] == 1:
        print(i + 1)






Measured memory_bytes: 8016
#include <bits/stdc++.h>
using namespace std;
typedef long long int lli;
typedef vector <int> vi;
typedef vector <vi> vvi;
typedef pair <int,int> pr;
#define fr(i, n) for(int i = 0; i < n; i++)
#define sz(a) int((a).size())
#define pb push_back
#define all(c)(c).begin(), (c).end()
#define tr(c, i) for (typeof ((c).begin() i = (c).begin(); i != (c).end(); i++)
#define present(c, x)((c).find(x) != (c).end())
#define cpresent(c, x)(find(all(c), x) != (c).end())
// for mod power a^b%m use power<lli> (a,b,m)
template < class mytype >
mytype power(mytype a, mytype b, mytype m){if (b == 1) return a % m;if (b == 0) return 1;
mytype root = power < lli > (a, b / 2, m);mytype ans = (root * root) % m;if (b % 2) ans = (ans * a) % m;
return ans;
}
// for gcd use gcd<int> (a,b)
template < class type >type gcd(type a, type b){if (a == 0) return b;else return gcd(b % a, a);}
template < class type >type mod_inv(type a, type p) {return power(a, p - 2, p);}
struct st{
int a,b,c;
};

int main()
{
    int n;
    cin >> n;
    vector<st> v(n);
    for(int i = 0 ; i < n ; i++){
        cin >> v[i].a >> v[i].b >> v[i].c;
    }
    vector<st> dp(n);
    for(int i = 0 ; i < n ; i++){
        dp[i].a = INT_MAX;  dp[i].b = INT_MAX; dp[i].c = INT_MAX;
    }
    dp[0].a = v[0].a;dp[0].b = v[0].b;dp[0].c = v[0].c;
    for(int i = 1 ; i < n ; i++){
        dp[i].a = v[i].a + max(dp[i-1].b , dp[i-1].c);
        dp[i].c = v[i].c + max(dp[i-1].b , dp[i-1].a);
        dp[i].b = v[i].b + max(dp[i-1].a , dp[i-1].c);
    }
    cout << max(dp[n-1].a , max(dp[n-1].b , dp[n-1].c)) << endl;
    return 0;
}


Measured memory_bytes: 2560
#include <iostream>
#include <vector>
#include <stack>
using namespace std;

int n;
vector<int> pos[100010];
stack<int> sta;
int cnt[100010],first;

inline void dfs(int v,int pr)
{
	cnt[v]=1;
	sta.push(v);
	
	if(v==n-1)
	{
		stack<int> t=sta;
		for(int i=0;i<sta.size()/2-1;i++) t.pop();
		first=t.top();
	}
	
	for(auto to:pos[v])
	{
		if(to==pr) continue;
		dfs(to,v);
		cnt[v]+=cnt[to];
	}
	sta.pop();
}

int main()
{
	cin>>n;
	for(int i=0;i<n-1;i++)
	{
		int a,b;
		cin>>a>>b;
		a--;b--;
		pos[a].push_back(b);
		pos[b].push_back(a);
	}
	
	first=-1;
	dfs(0,0);
	cout<<(cnt[first]*2<n?"Fennec":"Snuke");
	
	return 0;
}

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

typedef long long ll;
typedef long double ld;
typedef vector<vector<int>> Graph;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
#define pi 3.14159265359
#define inf 2147483647
#define INF 9223372036854775807
#define mod 1000000007
#define mod2 998244353

int main() {
    int X, t; cin >> X >> t;
    cout << max(X - t, 0) << endl;
    return 0;
}

Measured memory_bytes: 3548
#include <bits/stdc++.h>
#define rep(i, a, b) for(ll i = ll(a); i < ll(b); i++)
#define rer(i, a, b) for(ll i = ll(a) - 1; i >= ll(b); i--)
#define sz(v) (int)(v).size()
#define pb push_back
#define sc second
#define fr first
#define sor(v) sort(v.begin(),v.end())
#define rev(s) reverse(s.begin(),s.end())
#define lb(vec,a) lower_bound(vec.begin(),vec.end(),a)
#define ub(vec,a) upper_bound(vec.begin(),vec.end(),a)
#define uniq(vec) vec.erase(unique(vec.begin(),vec.end()),vec.end())
using namespace std;
typedef long long int ll;
typedef pair <int, int> P;

const ll MOD=1000000007;
int A,B,K;
vector<ll> divisor(ll n) {
    vector<ll> res;
    for (ll i=1; i*i<=n; i++){
        if (n%i==0){
            res.push_back(i);
            if (i!=n/i) res.push_back(n/i);
        }
    }
    return res;
}
ll gcd (ll a, ll b){
    if (b==0) return a;
    return gcd(b, a%b);
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin>>A>>B>>K;
    vector<ll> div=divisor(gcd(A,B));
    sor(div);
    rev(div);
    cout <<div[K-1]<<"\n";
}


Measured memory_bytes: 256
package main

import (
	"fmt"
	"sort"
)

type restaurant struct {
	s string
	p int
	i int
}

type rs []restaurant

func (r rs) Len() int {
	return len(r)
}

func (r rs) Less(i, j int) bool {
	if r[i].s == r[j].s {
		return r[i].p > r[j].p
	}
	return r[i].s < r[j].s
}

func (r rs) Swap(i, j int) {
	r[i], r[j] = r[j], r[i]
}

func main() {
	var n int
	fmt.Scan(&n)

	a := make(rs, n)
	for i := range a {
		a[i].i = i + 1
		fmt.Scan(&a[i].s, & a[i].p)
	}

	sort.Sort(a)
	for _, e := range a {
		fmt.Println(e.i)
	}
}


Measured memory_bytes: 512
#!/usr/bin/env python3
N = int(input())
b = list(map(int, input().split()))

ans = []
for i in range(N):
    for j in range(len(b))[::-1]:
        if b[j] == j + 1:
            b.pop(j)
            ans.append(j + 1)
            break

if len(ans) == N:
    print(*ans[::-1], sep='\n')
else:
    print(-1)


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


int main() {
    int N, M;
    cin >> N >> M;

    vector<vector<long long>> v(N, vector<long long>(2));
    for (int i = 0; i < N; ++i) {
        for (int j = 0; j < 2; ++j) {
            cin >> v[i][j];
        }
    }

    sort(v.begin(), v.end());

    long long ans = 0;

    for (int i = 0; i < N; ++i) {
        ans += v[i][0] * v[i][1];
        M -= v[i][1];
        if (M < 0) {
            ans -= v[i][0] * -M;
            break;
        }
    }
    cout << ans << endl;
}

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

long long d[100001];
constexpr long long mod = 1000000007;
int main() {
  int N, M;
  cin >> N >> M;
  vector<int> a(M);
  for(int i = 0; i < M; ++i) {
    cin >> a.at(i);
    d[a.at(i)] = -1;
  }
  d[0] = 1;
  if (d[1] == -1)
    d[1] = 0;
  else
    d[1] = 1;
  for (int i = 2; i <= N; ++i) {
    if (d[i] == -1) {
      d[i] = 0;
    }
    else {
      d[i] = (d[i-1] + d[i-2]) % mod;
    }
  }
  cout << d[N] << endl;
  return 0;
}


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


int main()
{
    int n;
    while(cin>>n)
    {
        set<int>S;
        for(int i=0;i<n;i++)
        {
            int x;
            scanf("%d",&x);
            if(S.count(x))S.erase(x);
            else S.insert(x);
        }
        printf("%d\n",S.size());
    }
    return 0;
}


Measured memory_bytes: 4864
#include <cstdio>
using i64 = long long;

int main() {
    int n, c[] { 0, 0, 0, 0 };
    scanf("%d", &n);
    while (n--) {
        char s[10];
        scanf("%s", s);
        if (s[0] == 'A') c[0]++;
        else if (s[0] == 'W') c[1]++;
        else if (s[0] == 'T') c[2]++;
        else c[3]++;
    }

    printf("AC x %d\n"
           "WA x %d\n"
           "TLE x %d\n"
           "RE x %d\n", c[0], c[1], c[2], c[3]);

    return 0;
}


Measured memory_bytes: 1732
#include<stdio.h>
int main()
{
	int a, b;
	scanf("%d %d", &a, &b);
	if (a < b)
		printf("a < b\n");
	else if (a > b)
		printf("a > b\n");
	else
		printf("a == b\n");
	return 0;
}


Measured memory_bytes: 2104
import sys
from heapq import heappush, heappop, heapify
import math
from math import gcd
import itertools as it
from collections import deque 

input = sys.stdin.readline

def inp():
    return int(input())
def inpl():
    return list(map(int, input().split()))

INF = 1001001001

# ---------------------------------------

def main():
    A = inpl()
    A.sort()
    if A[0]==A[1]==5 and A[2]==7:
        print("YES")
    else:
        print("NO")

main()


Measured memory_bytes: 9392
#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}a
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

using ll = long long;

const int INF = 1e9 + 5;

int main() {
	int n;
	scanf("%d", &n);
	vector<int> h(n);
	for (int& x:h){
		scanf("%d", &x);
	}
	vector<int> cost(n, INF);
	cost[0] = 0;
	for (int i = 0; i<n; ++i){
		for (int j = i+1; j <= i+2; ++j){
			if (j < n){
				cost[j] = min(cost[j], cost[i] + abs(h[i] - h[j]));
			}
		}
	}
	printf("%d\n", cost[n-1]);
}


Measured memory_bytes: 3912
#include <iostream>
#include <algorithm>
#include <cassert>

using ll = long long;
const int maxn = 1e5+7;

ll n, m, v, p, a[maxn], pre[maxn];

bool gao(ll x) {
	ll posl = std::lower_bound(a+1, a+1+n, x)-(a);
	ll posr = std::upper_bound(a+1, a+1+n, x+m)-(a);
//	std::cout << x << ' ' << x+m << ' ' << posl << ' ' << a[posl] << ' ' << posr << ' ' << a[posr] << '\n';
	assert(posl > 0);
	assert(posr <= n+1);
	posr = std::min(posr, n-p+2);
	posl = std::min(posl, n-p+2);
	if (x+m < a[n-p+1]) {
		return false;
	}
	ll ans = (posl-1)*m+(p-1)*m;
	ans += (x+m)*(posr-posl)-(pre[posr-1]-pre[posl-1]);
//	std::cout << (posl-1+1)*m << ' ' << (p-1)*m << ' ' << (x+m)*(posr-posl) << ' ' << (pre[posr-1]-pre[posl-1]) << ' ';
//	std::cout << ans << ' ' << v*m << '\n';
//	std::cout << "----------\n";
	return ans >= (v*m);
}

int main(int argc, char *argv[]) {  
	std::ios::sync_with_stdio(false);
	std::cin.tie(0); 
	std::cin >> n >> m >> v >> p;
	for (int i = 1; i <= n; i++) {
		std::cin >> a[i];
	}
	std::sort(a+1, a+n+1);
	pre[0] = 0;
	for (int i = 1; i <= n; i++) {
		pre[i] = a[i] + pre[i-1];
	}
//	for (int i = 1; i <= n; i++) {
//		std::cerr << a[i] << " \n"[i==n];
//	}
//	std::cout << "----------\n";
	int res = 0;
	for (int i = 1; i <= n; i++) {
		if (gao(a[i])) {
			res++;
		}
	}
	std::cout << res << '\n';
}

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

using namespace std;

#define N 120000

int n,a[N];

bool solve(){
	int odd=0,even=0;
	for (int i=1;i<=n;++i)
		if (a[i]&1) ++odd; else ++even;
	if (odd>1) return even&1;
	if (even&1) return 1;
	int d=0;
	for (int i=1;i<=n;++i){
		if (a[i]&1){
			if (a[i]==1) return 0;
			--a[i];
		}
		d=__gcd(d,a[i]);
	}
	for (int i=1;i<=n;++i) a[i]/=d;
	return !solve();
}

int main(){
	scanf("%d",&n);
	for (int i=1;i<=n;++i) scanf("%d",a+i);
	puts(solve()?"First":"Second");
	
	return 0;
}
			

Measured memory_bytes: 640
#include <iostream>
#include <iomanip> // << fixed << precision(10)
#include <vector>
#include <string>
#include <map>
#include <set>
#include <cmath>
#include <algorithm>
using namespace std;

#define FOR(i,s,t) for(int i=s;i<t;i++)
#define REVFOR(i,s,t) for(int i=s;i>=t;i--)
#define REP(i,n) FOR(i,0,n)
#define PRINT(s) cout << s << "\n"
#define SORT(A) sort(A.begin(), A.end())
#define EACHPRINT(A, T) for_each(begin(A), end(A), [&](T i){ cout << i << " "; });cout << "\n"
#define NEWMAT(N, M, ini) MAT(N, vector<lint>(M, ini))
#define MOD 1000000007

#define lint_in(A) lint A; cin >> A

typedef long long lint;
typedef pair<lint, lint> P;
typedef vector<lint> V;
typedef vector<vector<lint>> MAT;
bool lessPair(const P& l, const P& r){return l.second < r.second;}

lint getgcd(lint n, lint m)
{
  lint r;
  if (n > m) {
    lint t = m;
    m = n;
    n = t;
  }
  while ((r = m % n) != 0) {
    m = n;
    n = r;
  }
  return n;
}


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    std::cout<<std::fixed<<std::setprecision(10);

    lint N; cin >> N;
    lint M; cin >> M;

    V B(N);
    REP(i, N) {
      lint x; cin >> x; B[i] = x/2;
    }

    lint L = 1;
    REP(i, N) {
        L = L*B[i]/getgcd(L,B[i]);
    }

    REP(i,N){
        if((L/B[i])%2 == 0) {
            PRINT(0);
            return 0;
        }
    }

    PRINT((M/L+1)/2);
    return 0;

    return 0;
}


Measured memory_bytes: 1024
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn main() {
    let mut ac: i32 = 0;
    let mut tle: i32 = 0;
    let mut wa: i32 = 0;
    let mut re: i32 = 0;
    let n:i32 = read();
    for _ in 0..n {
        let result: String = read();
        match &*result {
            "AC" => ac+=1,
            "TLE" => tle+=1,
            "WA" => wa+=1,
            "RE" =>re+=1,
            _ => println!("not matched"),
        }
    }
    println!("AC x {}", ac);
    println!("WA x {}", wa);
    println!("TLE x {}", tle);
    println!("RE x {}", re);

}

Measured memory_bytes: 2152
N = 0
S = {'AC': 0, 'WA': 0, 'TLE': 0, 'RE': 0}

try:
  N = int(input())
  for i in range(N):
      result = input()
      for k in S:
          if k == result:
              S[k] += 1
except:
  pass

for k in S:
    print('%s x %d' % (k, S[k])) 

Measured memory_bytes: 9204
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main() {
	int c[60];
	int n, m; cin >> n >> m;
	for (int i = 1; i <= n; i++)c[i] = 0;
	for (int i = 0; i < m; i++){
		int a, b; cin >> a >> b;
		c[a]++;
		c[b]++;
	}
	for (int i = 1; i <= n; i++){
		cout << c[i] << endl;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;

int main(int argc, char const *argv[]) {
    ll N;
    std::cin >> N;
    ll A[N];
    ll mod = 1000000007;
    for (size_t i = 0; i < N; i++) {
        std::cin >> A[i];
    }

    std::map<ll, ll> m{};

    for (size_t i = 0; i < N; i++) {
        m[A[i]] += 1;
    }
    ll ans = 1;

    for (auto x : m) {
        if ((x.first == 0 && x.second != 1) ||
            (x.first != 0 && x.second != 2)) {
            std::cout << 0 << '\n';
            return 0;
        } else if (x.first != 0) {
            ans = (ans * 2) % mod;
        }
    }

    std::cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 4992
#include <stdio.h>
int gcd(int a, int b)
{
	if(a%b == 0)
		return b; 
	else
		return (gcd(b, a%b));
}

int main(void) {	
	long long int a, b;
	while(scanf("%lld %lld", &a, &b)>0)
	{
	long long int lcm=(a*b)/gcd(a, b);
	if(lcm == 0) break;
	printf("%lld %lld\n", gcd(a,b), lcm);
	}
	return 0;
}


Measured memory_bytes: 2040
N = int(input())

ans = [0] * N
for i in range(N-1):
  C, S, F = map(int, input().split())
  for j in range(i+1):
    if S >= ans[j]:
      ans[j] = S + C
    else:
      ans[j] = F * (1 + (ans[j]-1)//F) + C

for ansi in ans:
  print(ansi)

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

int main() {
    int N;
    int ans = 0;
    int h = 1;
    int f[100];

    cin >> N;
    for(int i = 0; i < N; i++) cin >> f[i];

    bool flag = true;
    while(flag){
        flag = false;
        for(int i = 0; i < N; i++){
            if(h <= f[i]) {
                while(true){
                    i++;
                    if (h > f[i]) break;
                }
                ans++;
                flag = true;
            }
        }
        h++;
    }
    cout << ans;
	return 	0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(){
	int H1, M1, H2, M2, K;
	scanf("%d %d %d %d %d", &H1, &M1, &H2, &M2, &K);
	int x;
	
	x = ((H2 - H1) * 60) + (M2 - M1) - K;
	
	printf("%d", x);
	
return 0;
}

Measured memory_bytes: 1732
#include <algorithm>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <vector>

using namespace std;

#define rep(i, n) for (int64_t i = 0; i < (n); i++)
#define irep(i, n) for (int64_t i = 0; i <= (n); i++)
#define rrep(i, n) for (int64_t i = (n)-1; i >= 0; i--)
#define rirep(i, n) for (int64_t i = n; i >= 0; i--)

int64_t dceil(int64_t, int64_t);
int64_t dfloor(int64_t, int64_t);

int64_t dceil(int64_t x, int64_t y) {
  if (y < 0) {
    return dceil(-x, -y);
  }
  if (x < 0) {
    return -dfloor(-x, y);
  }
  return (x + y - 1) / y;
}

int64_t dfloor(int64_t x, int64_t y) {
  if (y < 0) {
    return dfloor(-x, -y);
  }
  if (x < 0) {
    return -dceil(-x, y);
  }
  return x / y;
}

int main() {
  int N;
  int64_t K;
  cin >> N >> K;

  vector<int64_t> b, c;
  int64_t zeros = 0;
  rep(i, N) {
    int a;
    cin >> a;
    if (a == 0) {
      zeros++;
    } else {
      (a >= 0 ? b : c).push_back(a);
    }
  }

  sort(b.begin(), b.end());
  sort(c.begin(), c.end());

  const int64_t INPUT_MAX = 1'000'000'000;
  int64_t ub = INPUT_MAX * INPUT_MAX;
  int64_t lb = -INPUT_MAX * INPUT_MAX;
  while (ub - lb > 1) {
    int64_t mid = (lb + ub) / 2;

    int64_t cnt = 0;

    // count positive products
    {
      int j = b.size() - 1;
      rep(i, b.size()) {
        while (j >= 0 && b[i] * b[j] > mid) {
          j--;
        }
        cnt += max(0L, j - i);
      }
    }

    {
      int j = 0;
      rrep(i, c.size()) {
        while (j < c.size() && c[i] * c[j] > mid) {
          j++;
        }
        cnt += max(0L, i - j);
      }
    }

    // count zero products
    if (0 <= mid) {
      cnt += zeros * (zeros - 1) / 2 + zeros * (N - zeros);
    }

    // count negative products
    {
      int j = c.size() - 1;
      rrep(i, b.size()) {
        while (j >= 0 && b[i] * c[j] > mid) {
          j--;
        }
        cnt += j + 1;
      }
    }

    (cnt >= K ? ub : lb) = mid;
  }

  int64_t result = numeric_limits<int64_t>::max();
  rep(i, b.size()) {
    auto it = lower_bound(b.begin() + 1, b.end(), dceil(ub, b[i]));
    if (it != b.end()) {
      result = min(result, *it * b[i]);
    }
  }

  rrep(i, c.size()) {
    auto it = upper_bound(c.begin(), c.begin() + i, dfloor(ub, c[i]));
    if (it != c.begin()) {
      result = min(result, *(it - 1) * c[i]);
    }
  }

  rep(i, b.size()) {
    auto it = lower_bound(c.begin(), c.end(), dceil(ub, b[i]));
    if (it != c.end()) {
      result = min(result, *it * b[i]);
    }
  }
  if (ub <= 0) {
    result = min(result, 0L);
  }

  cout << result << endl;

  return 0;
}

Measured memory_bytes: 2420