akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <queue>
#include <algorithm>
#include <utility>
#include <cmath>
#include <map>
#include <set>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>

#define INF_LL 1e18
#define INF 1e9

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

using namespace std;

using ll = long long;
using PII = pair<int, int>;

class Union_find{
private:
	vector<int> par;
	vector<int> rank;
	int n;

public:
	Union_find(int a){
		n = a;
		for(int i = 0;i < n;i++){
			par.push_back(i);
			rank.push_back(0);
		}
	}

	int find(int x){
		if(par[x] == x){
			return x;
		}else{
			return par[x] = find(par[x]);
		}
	}

	void unite(int x, int y){
		x = find(x);
		y = find(y);
		if(x == y) return;

		if(rank[x] < rank[y]){
			par[x] = y;
		}else{
			par[y] = x;
			if(rank[x] == rank[y]) rank[x]++;
		}
	}

	bool same(int x, int y){
		return find(x) == find(y);
	}
};

struct status{
	int rate, hand, id;
	int win = 0, lose = 0, draw = 0;
};

bool comp_1(status x, status y){
	if(x.rate > y.rate) return true;
	if(x.rate < y.rate) return false;
	if((x.hand+1)%3 == y.hand) return true;
	if((y.hand+1)%3 == x.hand) return false;
	return true;
}

bool comp_2(status x, status y){
	if(x.id < y.id)
		return true;
	else
		return false;
}

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


Measured memory_bytes: 256
#include"bits/stdc++.h"
using namespace std;
#define REP(k,m,n) for(int (k)=(m);(k)<(n);(k)++)
#define rep(i,n) REP((i),0,(n))
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using tp3 = tuple<int, int, int>;
using Mat = vector<vector<ll>>;
constexpr int INF = 1 << 28;
constexpr ll INFL = 1ll << 60;
constexpr int dh[4] = { 0,1,0,-1 };
constexpr int dw[4] = { -1,0,1,0 };
bool isin(const int H, const int W, const int h, const int w) {
    return 0 <= h && h < H && 0 <= w && w < W;
}
template<typename T>
T minch(T& l, T r) {
    return l = min(l, r);
}
template<typename T>
T maxch(T& l, T r) {
    return l = max(l, r);
}
template<typename T>
void output(const T& val) {
    cout << val << endl;
}
template<typename T>
void output(const vector<T>& vec, const bool newline = false) {
    for (const T& val : vec)cout << val << (newline ? '\n' : ' '); cout << endl;
}
template<typename T>
void output(const vector<vector<T>>& mat) {
    for (const auto& row : mat)output(row);
}
// ============ template finished ============

int main()
{
    int N, M;
    cin >> N >> M;
    vector<pair<int, int>> v;
    if (N % 2 == 1) {
        int l = 1, r = N - 1;
        while (l < r) {
            v.push_back({ l,r });
            l++;
            r--;
        }
    }
    else {
        int K = N / 2 - 1;
        int norm = K / 2 + K % 2;
        int l = 1, r = N;
        rep(i, norm) {
            v.push_back({ l,r });
            l++;
            r--;
        }
        r--;
        while (l < r) {
            v.push_back({ l,r });
            l++;
            r--;
        }
    }
    rep(i, M) {
        cout << v[i].first << " " << v[i].second << endl;
    }
    return 0;
}


Measured memory_bytes: 4216
#include <stdio.h>
#include <limits.h>

int nums[270000], nums2[270000];
int leaves;

void add(int node, int l, int r, int nl, int nr, int val) {
  if (nl <= l && r <= nr) {
    nums[node] += val;
    nums2[node] += val;
  } else if (nl > r || l > nr) {
  
  } else {
    if (nums2[node]) {
      nums2[node * 2 + 1] += nums2[node];
      nums2[node * 2 + 2] += nums2[node];
      nums[node * 2 + 1] += nums2[node];
      nums[node * 2 + 2] += nums2[node];
      nums2[node] = 0;
    }
    add(node * 2 + 1, l, (l + r) / 2, nl, nr, val);
    add(node * 2 + 2, (l + r) / 2 + 1, r, nl, nr, val);
    
    if (nums[node * 2 + 1] < nums[node * 2 + 2])
      nums[node] = nums[node * 2 + 1];
    else
      nums[node] = nums[node * 2 + 2];
  }
}

int find(int node, int l, int r, int nl, int nr) {
  if (nl > r || l > nr)
    return INT_MAX;
  else if (nl <= l && r <= nr)
    return nums[node];
  else {
    if (nums2[node]) {
      nums2[node * 2 + 1] += nums2[node];
      nums2[node * 2 + 2] += nums2[node];
      nums[node * 2 + 1] += nums2[node];
      nums[node * 2 + 2] += nums2[node];
      nums2[node] = 0;
    }
    
    int leftVal = find(node * 2 + 1, l, (l + r) / 2, nl, nr);
    int rightVal = find(node * 2 + 2, (l + r) / 2 + 1, r, nl, nr);

    if (leftVal < rightVal)
      return leftVal;
    else
      return rightVal;
  }
}


int main() {
  int n, q, i, x, y, z, command;

  scanf("%d %d", &n, &q);

  for (leaves = 1; leaves < n; leaves *= 2);

  memset(nums, 0, sizeof(nums));
  memset(nums2, 0, sizeof(nums2));

  for (i = 0; i < q; i++) {
    scanf("%d %d %d", &command, &x, &y);

    if (command)
      printf("%d\n", find(0, 0, leaves, x, y));
    else {
      scanf("%d", &z);
      add(0, 0, leaves, x, y, z);
    }
  }
}



Measured memory_bytes: 3900
using System;

class Program{
    static void CountingSort(int[] A, int[] B, int k){
        var C=new int[k+1];
        for(var j=0; j<A.Length; j++){
            C[A[j]]++;
        }
        for(var i=1; i<=k; i++){
            C[i]=C[i]+C[i-1];
        }
        for(var j=A.Length-1; j>=0; j--){
            B[C[A[j]]-1]=A[j];
            C[A[j]]--;
        }

        /* or
        var remain=B.Length-1;
        for(; k>=0; k--){
            while(C[k]>0){
                B[remain]=k;
                remain--;
                C[k]--;
            }
        }
        */
    }

    public static void Main(){
        var n=int.Parse(Console.ReadLine());
        var s=Console.ReadLine().Split(' ');
        var A=new int[n];
        var k=-1;
        for(var i=0; i<n; i++){
            A[i]=int.Parse(s[i]);
            if(A[i]>k){
                k=A[i];
            }
        }

        var B=new int[n];
        CountingSort(A, B, k);

        var ss=new System.Text.StringBuilder();
        for(var i=0; i<B.Length; i++){
            ss.Append(B[i]);
            if(i<B.Length-1){
                ss.Append(" ");
            }
        }
        Console.WriteLine(ss);
    }
}

Measured memory_bytes: 225620
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <math.h>
#include <cassert>
#define rep(i,n) for(int i = 0; i < n; ++i )
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main() {
  int x;
  cin >> x;
  cout << (x>=30?"Yes":"No") << endl;
}


Measured memory_bytes: 3608
#include "bits/stdc++.h"

using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
	REP(i, v.size()) { if (i)os << " "; os << v[i]; }return os;
}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
	REP(i, v.size()) { if (i)os << endl; os << v[i]; }return os;
}

const ll INF = LLONG_MAX;
ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

#define int long long

inline void my_io() {

	std::ios::sync_with_stdio(false);

	std::cin.tie(0);

	cout << fixed << setprecision(16);

	//cout << setprecision(10) << scientific << ans << endl;
}

signed main() {
	ll n;

	cin >> n;

	ll ans = 0;

	REP(i, n) {
		string s = to_string(i + 1);
		if (s.size() % 2 == 1) {
			ans++;
		}
	}

	cout << ans << endl;
}

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

int main() {
	int a,b,c,d,e,k;
	cin >> a >> b >> c >> d >> e;
	int a2=0,b2=0,c2=0,e2=0,d2=0,a3,b3,c3,d3,e3;
	if(a%10>0)
	{
		a2=10-a%10;
	}
	if(b%10>0)
	{
		b2=10-b%10;
	}
	if(c%10>0)
	{
		c2=10-c%10;
	}
	if(d%10>0)
	{
		d2=10-d%10;
	}
	if(e%10>0)
	{
		e2=10-e%10;
	}
	a3 = a + a2;
	b3 = b + b2;
	c3 = c + c2;
	d3 = d + d2;
	e3 = e + e2;
	k = min({a3+b3+c3+d3+e,
		     a3+b3+c3+d+e3,
		     a3+b3+c+d3+e3,
		     a3+b+c3+d3+e3,
		     a+b3+c3+d3+e3});
	cout << k << endl;
	return 0;
}


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

#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF 1e9
typedef long long ll;


int main() {
    int a,b; cin >> a >> b;
    if(a%2==0 || b%2==0) cout << "Even" << endl;
    else cout << "Odd" << endl;
    return 0;
}

Measured memory_bytes: 3580
#include<bits/stdc++.h>
#define fasterthanlight ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define endl "\n"
#define int long long
#define vi vector<int>
#define pb push_back
#define mod 1000000007
#define MAX 1e9
#define MIN -1e9
#define hi "visited\n" //sasta debugging
using namespace std;

//author::@whohet-->Het Patel

void solve()
{
	int n;
	cin >> n;
	int x = 0; int t = 0;
	for (int i = 0; i < n; i++)
	{
		int a, b;
		cin >> a >> b;
		if (a == b)
			x++;
		else
			x = 0;
		if (x >= 3)
			t = 1;

	}
	if (t)
	{
		cout << "Yes\n";
	}
	else
		cout << "No\n";
}

signed main()
{
	fasterthanlight;
	int T; T = 1;
	//cin>>T;
	while (T--)
	{
		solve();
	}

	//cout << "\n\n"<<"Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " seconds.\n";
	return 0;
}

Measured memory_bytes: 3648
#include<stdio.h>
int main(void)
{
  int a;

  scanf("%d", &a);

  if (a==3) {
    printf("YES");
  }else if (a==5) {
    printf("YES");
  }else if (a==7) {
    printf("YES");
  }else{
    printf("NO");
  }
  return 0;
}




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

int main() {
  int N;
  cin >> N;
  vector<int> vec(N);
  
  for (int i = 0; i < N; i++) {
  cin >> vec.at(i);
  }
  
  int p=0;
  int answer=0;
  
  for (int i = 0; i < N-1; i++) {
    if(vec.at(i)>=vec.at(i+1)){
      p++;
    }
    else{
       p=0;
    }
    if(p>answer){
        answer=p;
      }
  }
  
  cout<<answer<<endl;
      
      
}


Measured memory_bytes: 640
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <queue>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double

const double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;
const int mod=1000000007;

int main(){
	LL n,k,ans=0;
	cin>>n>>k;
	pair<int,int> p[101010]={};
	FOR(i,0,n){
		int aa,bb;
		cin>>aa>>bb;
		p[i]=MP(aa,bb);
	}
	int lim=0,tmpk=k;
	while(tmpk!=0){
		tmpk>>=1;
		lim++;
	}
	FORD(i,lim+1,0){
		int mask=k;
		if(i==lim){

		}else{
			if(!(k&(1<<i)))continue;
			mask&=~(1<<i);
			FORD(j,i,0){
				mask|=1<<j;
			}
		}
		mask=~mask;
		LL tmp=0;
		FOR(j,0,n){
			if(mask&p[j].ST){

			}else{
				tmp+=p[j].ND;
			}
		}
		if(tmp>ans){
			ans=tmp;
		}
		//cerr<<i<<" "<<mask<<" "<<tmp<<endl;
	}
	cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 1152
#include <bits/stdc++.h>
#define ll long long

#define rep(i, a, b) for (int i = a; i < b; i++)
#define For(i, a, b) for (int i = a; i <= b; i++)

using namespace std;

const int mod = 1000000000 + 7;
const int MAXN = 100000 + 5;

int n;
string s;

int main(){
    scanf("%d", &n);
    cin >> s;
    if (n >= 3200)
        cout << s;
    else
        cout << "red";
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<map>
#include<cstdlib>
#include<stack>
#include<queue>
#include<algorithm>
#include<set>
#include<vector>
#include<cmath>
#include<string>
#include<deque>
#define lmid l,mid,rt<<1
#define rmid mid+1,r,rt<<1|1
using namespace std;
int main()
{
     long long n,m;
     scanf("%lld%lld",&n,&m);
     int sum=1;
     long long res=1;
     while(2*res*n<=m){res*=2,sum++;}
     printf("%d\n",sum);
}


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

using namespace std;

const int MAX = 101;
const int INF = (1<<25);
int T[MAX][MAX];
int N,M,L,K,A,H;
bool heal[MAX];
struct Edge{
  int to,cost;
  Edge(int a, int b):to(a),cost(b){};
  Edge(){}
};

struct State{
  int pos,blood,t;
  State(int a,int b,int c):pos(a),blood(b),t(c){}
  bool operator < (const State& s) const {return t > s.t;}
};

vector<Edge> E[MAX];

void init(){
  for(int i = 0; i < MAX; i++){
    fill(T[i],T[i]+MAX,INF);
    heal[i] = false;
    E[i].clear();
  }
}

void input(){
  for(int i = 0; i < L; i++){
    int in;
    cin >> in;
    heal[in] = true;
  }

  for(int i = 0; i < K; i++){
    int a,b,c;
    cin >> a >> b >> c;
    E[a].push_back(Edge(b,c));
    E[b].push_back(Edge(a,c));
  }
}

void solve(){
  
  priority_queue<State> Q;
  Q.push(State(A,M,0));
  T[A][M] = 0;


  while(!Q.empty()){
    State s = Q.top();
    Q.pop();

    if(T[s.pos][s.blood] < s.t) continue;

    //heal
    if(heal[s.pos]){
      for(int i = 1; s.blood+i <= M; i++){
	if(T[s.pos][s.blood+i] > s.t+i){
	  T[s.pos][s.blood+i] = s.t+i;
	  Q.push(State(s.pos,s.blood+i,s.t+i));
	}
      }
    }

    //go next

    for(int i = 0; i < E[s.pos].size(); i++){
      int nex = E[s.pos][i].to;
      int cos = E[s.pos][i].cost;
      int rem = s.blood;
      if(rem >= cos && T[nex][rem-cos] > s.t+cos){
	T[nex][rem-cos] = s.t+cos;
	Q.push(State(nex,rem-cos,s.t+cos));
      }
    }
  }

  int ans = INF;

  for(int i = 0; i < MAX; i++) ans = min(ans,T[H][i]);

  if(ans == INF) cout << "Help!" << endl;
  else cout << ans << endl;
}

int main(){
  
  while(cin >> N >> M >> L >> K >> A >> H && N+M+L+K+A+H){
    init();
    input();
    solve();
  }
  return 0;
}

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

int main(){
  int A,B;
  int tasu,hiku,kake;
  cin >> A >> B;
  tasu = A + B;
  hiku = A - B;
  kake = A * B;
  
  if(tasu >= hiku){
    if(tasu >= kake){
      cout << tasu << endl;
    }else{
      cout << kake << endl;
    }
  }else{
    if(hiku >= kake){
      cout << hiku << endl;
    }else{
      cout << kake << endl;
    }
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    ll a,b,c,d,x,y,m,n;
    cin>>a>>b>>c>>d;
    x=a*c;
    y=b*d;
    m=a*d;
    n=b*c;
    cout<<max({x,y,m,n});
    return 0;
}


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

struct TCoordinate
{
	double x;
	double y;
};

bool IsSameSide(TCoordinate T1, TCoordinate T2, TCoordinate L1, TCoordinate L2)
{
	if(L1.x == L2.x){
		if((T1.x - L1.x) * (T2.x - L2.x) > 0){
			return true;
		}else{
			return false;
		}
	}else{
		if(((L2.x - L1.x) * (T1.y - L1.y) - (L2.y - L1.y) * (T1.x - L1.x)) * ((L2.x - L1.x) * (T2.y - L1.y) - (L2.y - L1.y) * (T2.x - L1.x)) > 0){
			return true;
		}else{
			return false;
		}
	}
}

int main()
{
	while(true){
		TCoordinate A1, A2, A3, Ap;
		cin >> A1.x >> A1.y >> A2.x >> A2.y >> A3.x >> A3.y >> Ap.x >> Ap.y;
		if(cin.eof() == true) break;
		if(IsSameSide(A3, Ap, A1, A2) && IsSameSide(A1, Ap, A2, A3) && IsSameSide(A2, Ap, A3, A1)){
			cout << "YES" << endl;
		}else{
			cout << "NO" << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 3156
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REPR(i, n) for(int i = (int)(n); i >= 0; i--)
#define FOR(i, s, n) for (int i = (s); i < (int)(n); i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

int main() {
    ll N;
    cin >> N;
    ll b;
    vector<ll> A(N);
    ll ans = 0;
    REP(i, N-1){
        cin >> b;
        if (i == 0) {
            A[i] = b;
        } else {
            A[i] = min(A[i], b);
        }
        A[i+1] = b;
        ans += A[i];
    }
    ans += A[N-1];
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 256
s = input()
digit = len(s) - 1
ans = 0
for i in range(2 ** digit):
    reg = []
    tmp = s[0]
    for j in range(digit):
        if (i >> j) & 1:
            reg.append(int(tmp))
            tmp = s[j+1]
        else:
            tmp += s[j+1]
    if tmp:
        reg.append(int(tmp))
    ans += sum(reg)
print(ans)

Measured memory_bytes: 3060
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long a = sc.nextLong();
        long b = sc.nextLong();
        long n = sc.nextLong();
        long max = Math.max(func(a, b, n), func(a, b, Math.max(n / b * b - 1, 0)));
        System.out.println(max);
    }
    
    static long func(long a, long b, long x) {
        return a * x / b - a * (x / b);
    }
}

Measured memory_bytes: 35788
#include <iostream>
#include <string>
#include <vector>
#include<algorithm>
#include <stdio.h>
#include <bitset>
#include<math.h>
using namespace std;
typedef long long ll;

int main(){
	vector<char> s(6, '0');
	int ans = 0;
	for (int i = 0; i < 6; i++)
		cin >> s[i];
	for (int i = 0; i < 3; i++) {
		if (s[i] == s[i + 3]) {
			ans++;
		}
	}
	cout << ans << endl;
}

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

int main(){
  int n;
  cin >> n;
  vector<int> A(n + 2);
  A[0] = 0;
  A[n + 1]  = 0;
  for(int i=1;i<n+1;++i) cin >> A[i];
  vector<int> ans(n);
  int res=0;
  for(int i=1;i<n + 2;++i){
    res += abs(A[i - 1] - A[i]);
  }
  //cout << res << endl;
  for(int i=1;i<n+1;++i){
    ans[i - 1] = res + abs(A[i - 1] - A[i + 1]) - (abs(A[i] - A[i + 1]) + abs(A[i - 1] - A[i]));
  }
  rep(i,n) cout << ans[i] << endl;
  return 0;
}

Measured memory_bytes: 2048
s=input()

def f(a):
    a=int(a)
    if a>0 and a<=12:
        return 0
    elif a>12 or a==0:
        return 1


if f(s[0:2])*f(s[2:4])==0:
    if f(s[0:2])==0 and f(s[2:4])==0:
        print("AMBIGUOUS")
    elif f(s[0:2])==1 and f(s[2:4])==0:
        print("YYMM")
    elif f(s[0:2])==0 and f(s[2:4])==1:
        print("MMYY")
else:
    print("NA")

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

x = [0 for i in range(N)]

number_of_times = 0

def compare_add():
    added_or_not = False
    index = None
    for i in range(len(x)):
        if index == None:
            if x[i] != h[i]:
                x[i] += 1
                added_or_not = True
                index = i
        else:
            if x[i] != h[i]:
                if i != index + 1:
                    return True
                x[i] += 1
                index = i
    return added_or_not
    
while True:
    y = compare_add()
    if y == False:
        break
    number_of_times += 1

print(number_of_times)


Measured memory_bytes: 3064
#include<bits/stdc++.h>
typedef long long ll;
const int mod=1e9+7;
const int N=4e3+5;

int n;
char s[N];
int sr[N],sg[N],sb[N];

int main()
{
	// freopen("test.in","r",stdin);
	// scanf("%d",&T);
	// while(T--)
	// {
	scanf("%d%s",&n,s);
	for(int i=0;i<n;i++)
	{
		sr[i]=sr[i-1];
		sg[i]=sg[i-1];
		sb[i]=sb[i-1];
		if(s[i]=='R') sr[i]++;
		if(s[i]=='G') sg[i]++;
		if(s[i]=='B') sb[i]++;
	}
	long long ans=0;
	for(int i=0;i<n;i++)
	{
		for(int j=i+1;j<n;j++)
		{
			if(s[i]==s[j]) continue;
			if('R'!=s[i]&&'R'!=s[j])
				ans+=sr[n-1]-sr[j];
			if('G'!=s[i]&&'G'!=s[j])
				ans+=sg[n-1]-sg[j];
			if('B'!=s[i]&&'B'!=s[j])
				ans+=sb[n-1]-sb[j];
			int k=j+j-i;
			if(k<n&&s[k]!=s[i]&&s[k]!=s[j])
				ans--;
		}
	}
	printf("%lld\n",ans);
	// }
	return 0;
}

Measured memory_bytes: 3872
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<vector>
using namespace std;
vector<int>a[1200000];
int n,m,tot;
int cal(int x){
	for(int i=1;i<=x;i++){
		for(int j=i+1;j<=x;j++){
			tot++;
			a[i].push_back(tot);
			a[j].push_back(tot);
		}
	}
	printf("Yes\n");
	printf("%d\n",x);
	for(int i=1;i<=x;i++){
		printf("%d ",a[i].size());
		for(int j=0;j<a[i].size();j++)printf("%d ",a[i][j]);
		printf("\n");
	}
	exit(0);
	return 0;
}
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		m+=i;
		if(m==n)cal(i+1);
		if(m>n)break;
	}
	printf("No\n");
}

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

int main() {
  int64_t N,A,B;
  cin>>N>>A>>B;
  if(A>B||(N==1&&A!=B)){
    cout<<"0"<<endl;
  }
  else{
    cout<<1+(N-2)*(B-A)<<endl;
  }
}



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

int main() { 
    int n,l;
    cin>>n>>l;
    vector<string>v;
    for(int i=0;i<n;i++){
        string s;
        cin>>s;
        v.push_back(s);
    }
    sort(v.begin(),v.end());
    for(int i=0;i<v.size();i++)cout<<v[i];
    
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
using namespace std;

typedef long long ll;

/*
  let's try computer shogi!!
 */

const ll DIST_INF = 1145141919;

int getdigit(ll a){
  int i = 1;
  while(a/10 != 0){
    a = a/10;
    i+=1;
  }
  return i;
}

int mg(ll a, int dig){
  for(int i=0; i<dig-1; ++i){
    a = a/ 10;
    cerr<<a<<endl;
  }
  return a;
}

int main(){
  ll a;
  cin >> a;
  int dig = getdigit(a);
  ll maxdig = mg(a,dig);
  cerr<<a<<","<<dig<<","<<maxdig<<endl;
  if(getdigit(a+1) !=dig){
    cout<<dig*9<<endl;
    return 0;
  }
  if(maxdig != mg(a+1,dig)){
    cout<<maxdig +  (dig-1) * 9<<endl;
    return 0;
  }
  if(dig == 1){
    cout<<a<<endl;
  }else{
    cout<<maxdig-1 + (dig-1) * 9<<endl;
  }
  
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <set>
#include <utility>
#include <cstdlib>
#include <queue>
#include <stack>
#include <iomanip>
#include <cstdio>
#include <map>

using namespace std;

using ll = long long;
using P = pair<ll,ll>;

#define rep(i,x) for(ll i = 0; i < (ll)(x); i++)
#define rrep(i,x) for(ll i = ((ll)(x) - 1); i >= 0; i--)

#define _upgrade ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define all(x) (x).begin(), (x).end()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

template<class T1, class T2> void chmin(T1 &a, T2 b){if(a>b)a=b;}
template<class T1, class T2> void chmax(T1 &a, T2 b){if(a<b)a=b;}

//ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
//ll lcm(ll x, ll y) {return x / gcd(x, y) * y;}

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

const ll mod = 1e9 + 7;
const ll IMF = 1e18;
const double PI = 3.14159265358979323846;


// ****************************************CODE***************************************//



ll n,W;
ll w[110],v[110];
ll dp[100010];

int main(){
        cin >> n >> W;
        for(int i = 1; i <= n; i++) cin >> w[i] >> v[i];
        for(int i = 0; i < 100005; i++) dp[i] = -IMF;
        dp[0] = 0;
        for(int i = 1; i <= n; i++){
                for(int j = W; j >= w[i]; j--){
                        dp[j] = max(dp[j], dp[j-w[i]]+v[i]);
                }
        }

        ll ans = 0;
        for(int i = 0; i <= W; i++) ans = max(ans,dp[i]);
        cout << ans << endl;
        return 0;
}






















































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

int n,m;
LL A[200005], B[200005],k;
LL pa[200005], pb[200005];

int main(){
  scanf("%d%d%lld",&n,&m,&k);
  for ( int i = 0; i < n; i++ ) {
    scanf("%lld",&A[i]);
    pa[i] = A[i];
    if ( i ) pa[i] += pa[i-1];
  }
  for ( int i = 0; i < m; i++ ){
    scanf("%lld",&B[i]);
    pb[i] = B[i];
    if ( i ) pb[i] += pb[i-1];
  }
  
  int ans = 0;
  int pos = m-1;
  for ( int i = 0; i < n; i++ ){
    LL a = pa[i];
    if ( a > k ) break;
    while ( pos >= 0 && a + pb[pos] > k ) pos--;
    ans = max( ans, i + 1 + pos + 1 );
  }
  for ( int i = 0; i < m; i++ ){
    if ( pb[i] <= k ) ans = max( ans, i + 1 );
  }
  printf("%d\n",ans);
  return 0;
}







Measured memory_bytes: 10060
#include <bits/stdc++.h>
#define lli long long int
using namespace std;

int main(){
	int n;
	cin >> n;
	vector<int> a(n);
	for(int i=0;i<n;i++){
		cin >> a[i];
	}
	lli ans = 0;
	for(int i=0;i<n;i++){
		ans+=a[i]/2;
		if(a[i]%2 == 1){
			if(i+1<n && a[i+1] >= 1){
				a[i+1]--;
				ans++;
			}
		}
	}
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 640
#include<stdio.h>
int main()
{
    int a,r,x,d,i;
    scanf("%d%d%d",&r,&d,&x);
    for(i=1;i<=10;i++)
    {
        a=r*x-d;
        x=a;
        printf("%d\n",a);
    }
    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <bitset>
#include <map>
#include <string>

#define repd(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;

using namespace std;

int inputValue(){
	int a;
	cin >> a;
	return a;
}

void inputArray(int *p,int a){
	rep(i,a){
		cin >> p[i];
	}
}

void inputVector(vector<int> *p,int a){
	rep(i,a){
		int input;
		cin >> input;
		p -> push_back(input);
	}
}

template <typename T>
void output(T a,int precision){
	if(precision > 0){
		cout << setprecision(precision) << a << "\n";
	}else{
		cout << a << "\n";
	}
}

int main(){
	//source
	int n=inputValue();
	int x[n],y[n],h[n];
	rep(i,n){
		cin >> x[i] >> y[i] >> h[i];
	}
	int cx,cy,H;
	bool flag=false;
	rep(l1,101){
		rep(l2,101){
			int temp;
			int h_temp;
			rep(i,n){
				if(h[i]==0){
					continue;
				}
				temp=abs(x[i]-l1)+abs(y[i]-l2);
				h_temp=h[i]+temp;
				break;
			}
			rep(i,n){
				if(h[i]!=max(h_temp-abs(x[i]-l1)-abs(y[i]-l2),0)){
					break;
				}
				if(i==n-1){
					cx=l1;
					cy=l2;
					H=h_temp;
					flag==true;
				}
			}
			if(flag){
				break;
			}
		}
		if(flag){
			break;
		}
	}

	cout << cx << " " << cy << " " << H << endl;

	return 0;
}


Measured memory_bytes: 256
def examA():
    N = I()
    sum = 0
    for i in range(N):
        sum +=(i+1)
    ans = sum
    print(sum)



import sys
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

examA()

Measured memory_bytes: 38256
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <queue>
#include <bitset>		//UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>		//do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)
#define ALL(u) (u).begin(),(u).end()

#define ST first
#define ND second
#define PB push_back
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double

typedef pair<int, int> PII;

const double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;

int main()
{
	int N, M;
	scanf("%d%d", &N, &M);

	if (min(N, M) == 1 && max(N, M) != 1)
		printf("%d\n", max(N, M) - 2);
	else
		printf("%lld\n", N*(LL)M - 2 * (LL)(N + M - 2));

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
 
using namespace __gnu_pbds;
using namespace std;
 
typedef long long int ll;
typedef unsigned long long int sll;
typedef  double ld;
#define A 1000000007ll
#define D 100000000000000ll
#define B 998244353ll
#define C 1000000000000000000ll
#define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define oset tree<ll, null_type,less_equal<ll>, rb_tree_tag,tree_order_statistics_node_update> 
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define mxe(v) *max_element(v.begin(),v.end())
#define mne(v) *min_element(v.begin(),v.end())
#define bs binary_search
#define lb lower_bound
#define ub upper_bound
#define ve vector
#define br break
#define PI acos(-1)
#define subt cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n" 

int main() 
{
    FAST;
    ll h,w;
    cin>>h>>w;
    if(h==1 || w==1)
    {
        cout<<1;
        return 0;
    }
    if((h*w)%2==0)
        cout<<(h*w)/2;
    else
        cout<<((h*w)/2)+1;
    subt;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>
#include <cmath>

using ll = long long;

using namespace std;

int main() {
    long t1, t2, a1, a2, b1, b2;
    cin >> t1 >> t2 >> a1 >> a2 >> b1 >> b2;
    long d1 = t1 * (a1 - b1),
         d2 = t2 * (a2 - b2);
    if (d1 == 0 || d1 + d2 == 0) {
        cout << "infinity\n";
        return 0;
    }
    long ab1 = abs(d1),
         ab2 = abs(d1 + d2);
    if (d1 / ab1 == (d1 + d2) / ab2) {
        cout << 0 << '\n';
        return 0;
    }
    cout << 2 * (ab1 / ab2) + (ab1 % ab2 > 0) << '\n';
    return 0;
}

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

int h[100005], dp[100005];
int main()
{
    int n;
    cin >> n;
    for (int i = 1; i <= n; i++) cin >> h[i];
    dp[2] = abs(h[1]-h[2]);
    for (int i = 3; i <= n; i++)
    {
        dp[i] = min(dp[i-1]+abs(h[i]-h[i-1]), dp[i-2]+abs(h[i]-h[i-2]));
    }
    cout << dp[n];
}

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

class UnionFind{
private:
    std::vector<int> parent;
    std::vector<int> size;
    
public:
    UnionFind(int N){
        parent.resize(N);
        size.resize(N);
        for(int i = 0; i < N; i++){
            parent[i] = i;
            size[i] = 1;
        }
    }

    int root(int x){
        if (parent[x] == x) return x;
        int rx = root(parent[x]);
        parent[x] = rx;
        return rx;
    }

    void unite(int x, int y){
        int rx = root(x);
        int ry = root(y);
        if (rx == ry) return;
        parent[rx] = ry;
        size[ry] += size[rx];
    }

    bool same(int x, int y) {
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
    
    int get_size(int x){
        return size[root(x)];
    }
};

int main(){
    int N, M;
    std::cin >> N >> M;
    UnionFind tree(N);
    std::vector< int > A(M);
    std::vector< int > B(M);
    for(int i=0; i<M; i++){
        std::cin >> A[i] >> B[i];
    }
    
    std::vector< long long > ans(M);
    ans[0] = 0;
    ans[M-1] = (long long)N * ((long long)N - 1) / 2;
    
    for(int i=M-1; i>0; i--){
        long long tmp = 0;
        if(!tree.same(A[i] - 1, B[i] - 1)){
            tmp = (long long)tree.get_size(A[i] - 1) * (long long)tree.get_size(B[i] - 1);
        }
        tree.unite(A[i] - 1, B[i] - 1);
        ans[i-1] = ans[i] - tmp;
    }
    
    for(int i=0; i<M; i++){
        std::cout << ans[i] << std::endl;;
    }
    
    return 0;
    
}


Measured memory_bytes: 5704
n = int(input())

if n < 10:
    print(0)
    exit()

prime = [2, 3]
for i in range(5, n+1, 2):
    for p in prime:
        if i % p == 0:
            break
    else:
        prime.append(i)

# factrization
num = []
for p in prime:
    cnt = 1
    now = p
    while now <= n:
        cnt += n // now
        now *= p
    num.append(cnt)

more3 = [i for i in num if i >= 3]
more5 = [i for i in more3 if i >= 5]
more15 = [i for i in more5 if i >= 15]
more25 = [i for i in more15 if i >= 25]
more75 = [i for i in more25 if i >= 75]

more3 = len(more3); more5 = len(more5); more15 = len(more15); more25 = len(more25); more75 = len(more75)

print(more25 * (more3 - 1) + more15 * (more5 - 1) + more5 * (more5 - 1) * (more3 - 2) // 2 + more75)


Measured memory_bytes: 9232
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,mxx=0;
    string s;
    map <string , int> maap;
    map <string , int> :: iterator it;
    cin>>n;
    for(int i=0;i<n;i++)
        {
        cin>>s;
        maap[s]++;
        }
    for(it=maap.begin();it!=maap.end();it++)
        {
            if(it->second>mxx){
                mxx=it->second;
            }
        }
    for(it=maap.begin();it!=maap.end();it++)
        {
            if(mxx==it->second){
                cout<<it->first<<endl;
            }
        }

}



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

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(x) (x).begin(), (x).end()

typedef int64_t ll;
typedef long double ld;

const int INF = 1e9;
const ld EPS = 1e-8;

int main(){
  int N, M, R;
  cin >> N >> M >> R;
  vector<int> r(R);
  REP(i, R) {
    cin >> r[i]; --r[i];
  }
  vector<vector<int>> dist(N, vector<int> (N, INF));
  REP(i, N) dist[i][i] = 0;
  REP(i, M) {
    int A, B, C;
    cin >> A >> B >> C; --A; --B;
    dist[A][B] = dist[B][A] = C;
  }
  REP(k, N) REP(i, N) REP(j, N) dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);

  vector<vector<int>> dist2(R, vector<int> (R));
  REP(i, R) REP(j, R) dist2[i][j] = dist[r[i]][r[j]];

  vector<int> perm(R);
  iota(ALL(perm), 0);
  int ret = INF;
  do{
    int tmp = 0;
    REP(i, R - 1) tmp += dist2[perm[i]][perm[i + 1]];
    ret = min(ret, tmp);
  }while(next_permutation(ALL(perm)));

  cout << ret << endl;
  return 0;
}



Measured memory_bytes: 512
while(True):
    a = 0
    try:
        n = input()
    except EOFError:
        break

    n=int(n)

    if n > 36:
        print(0)
        continue
    elif n==36:
        print(1)
        continue
    b = n
    for i in range(10):
        if n-i==0:
            a=a+1
            #print("(%d,0,0,0)"%(i))
            break
        for j in range(10):
            if n-i-j==0:
                a=a+1
                #print("(%d,%d,0,0)"%(i,j))
                break
            for k in range(10):
                b = n-i-j-k
                if b>=0 and b<=9:
                    a=a+1
                    #print("(%d,%d,%d,%d)"%(i,j,k,b))
                    continue
                elif b > 9:
                    continue
                else:
                    break


    print(a)

Measured memory_bytes: 6720
#include <bits/stdc++.h>
using namespace std;
const int N=200005;
int ar[N],n,re[N];
vector<int> ans;
int main()
{ios_base::sync_with_stdio(0);cout.tie(0);cin.tie(0);
    cin>>n;
    for(int i=1;i<=n;i++)cin>>ar[i];
    for(int i=n;i>=1;i--){
        int cnt=0;
        for(int j=i;j<=n;j+=i)cnt+=re[j];
        if((cnt%2)!=ar[i]){
            re[i]=1;
            ans.push_back(i);
        }
    }
    cout<<ans.size()<<'\n';
    reverse(ans.begin(),ans.end());
    for(auto el:ans)cout<<el<<'\n';
    return 0;
}


Measured memory_bytes: 2936
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define rrep(i, n) for (int i = (int)n-1; i >= 0; --i)
using namespace std;
using ll = long long;
template<typename T>
inline bool chmax(T& a, const T& b) {
    if (a < b){
        a = b;
        return true;
    }
    return false;
}
template<typename T>
inline bool chmin(T& a, const T& b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}
template<typename T> vector<T> make_vec(size_t n) { return vector<T>(n); }
template<typename T, typename... Args> auto make_vec(size_t n, Args... args) {
    return vector<decltype(make_vec<T>(args...))>(n, make_vec<T>(args...));
}
template<typename T, typename U, typename... V>
typename enable_if<is_same<T, U>::value>::type fill_v(U& u, const V... v) { u = U(v...); }
template<typename T, typename U, typename... V>
typename enable_if<!is_same<T, U>::value>::type fill_v(U& u, const V... v) {
    for (auto& e : u) fill_v<T>(e, v...);
}

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

    string s;
    cin >> s;
    int n = s.size();
    vector<int> l(n), r(n);

    rep(i, n) {
        if (i != 0) r[i] = r[i-1];
        if (s[i] == 'R') r[i] = i;
    }
    rrep(i, n) {
        if (i != n-1) l[i] = l[i+1];
        if (s[i] == 'L') l[i] = i;
    }

    vector<int> ans(n);
    rep(i, n) {
        if (s[i] == 'L') {
            int d = i - r[i];
            if (d % 2 == 0) {
                ans[r[i]]++;
            } else {
                ans[r[i]+1]++;
            }
        } else {
            int d = l[i] - i;
            if (d % 2 == 0) {
                ans[l[i]]++;
            } else {
                ans[l[i]-1]++;
            }
        }
    }

    rep(i, n) cout << ans[i] << (i == n-1 ? '\n' : ' ');
}


Measured memory_bytes: 4492
def main():
    rt = 0
    Q,H,S,D = map(int,input().split(" "))
    N = float(input())
    count_1 = N//2
    count_2 = (N-count_1*2)//1
    count_3 = (N-count_1*2-count_2)*100//50
    count_4 = (((N-count_1*2-count_2)*100)-50*count_3)//25
    if count_1:
        rt+=int(count_1)*min(2*S,D,4*H,8*Q)
    if count_2:
        rt+=int(count_2)*min(S,2*H,4*Q)
    if count_3:
        rt+=min(H,2*Q)*int(count_3)
    if count_4:
        rt+=Q*int(count_4)
    print(int(rt))

if __name__=="__main__":
    main()

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

int n, a[105];

int main() {
	scanf("%d", &n);

	for(int i = 1; i <= n; i++)
		scanf("%d", &a[i]);

	int ans = INT_MAX;
	for(int x = -100; x <= 100; x++) {
		int res = 0;
		for(int i = 1; i <= n; i++)
			res += (a[i] - x) * (a[i] - x);
		ans = min(ans, res);
	}

	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 256
import numpy as np
n = int(input())
a = [int(i) for i in input().split()]
a.sort()
a = np.array(a)
c = np.array([0]*n)
np.cumsum(a,out=c)
ans = n
for i in range(n-1,0,-1):
  if c[i-1]*2 < a[i]:
    ans -= i
    break
print(ans)

Measured memory_bytes: 31048
#include<bits/stdc++.h>
#define rep(i, n) for(int i = 1, i##_end_ = (n); i <= i##_end_; ++i)
using namespace std;
typedef pair<int, int> pii;
typedef long long ll;

const int maxn = 300300;
int n, a[maxn];

void elim(int p) {
    a[p]--;
    int g = a[1];
    for(int i = 2; i <= n; ++i)
        g = __gcd(g, a[i]);
    for(int i = 1; i <= n; ++i)
        a[i] /= g;
}

void go(int p) {
    puts((p & 1) ? "First" : "Second");
    exit(0);
}

void dfs(bool inv) {
    int odd = 0, even = 0, p = -1;
    for(int i = 1; i <= n; ++i) {
        if(a[i] & 1) {
            odd++;
            if(a[i] != 1) p = i;
        }
        else even++;
    }
    if(even & 1) {
        go(inv ^ 1);
    } else {
        if(odd > 1) { 
            go(inv);
        } else {
            assert(odd == 1);
            if(p == -1) {
                ll tot = 0;
                for(int i = 1; i <= n; ++i)
                    tot += a[i] - 1;
                go(tot ^ inv);
            } else {
                elim(p);
                dfs(inv ^ 1);
            }
        }
    }
}

int main() {
    scanf("%d", &n);
    rep(i, n) scanf("%d", &a[i]);
    if(n == 1) { 
        puts((a[1] & 1) ? "Second" : "First");  
        return 0; 
    }

    dfs(0);
    
    return 0;
}

Measured memory_bytes: 640
#include <cstdio>

using namespace std;
typedef long long llong;

#define MAX
const llong mod = 1000000000 + 7;

int main()
{
  int X;
  int ans = 0;
  scanf("%d", &X);

  if (X <= 599)
  {
    ans = 8;
  }
  else if (X <= 799)
  {
    ans = 7;
  }
  else if (X <= 999)
  {
    ans = 6;
  }
  else if (X <= 1199)
  {
    ans = 5;
  }
  else if (X <= 1399)
  {
    ans = 4;
  }
  else if (X <= 1599)
  {
    ans = 3;
  }
  else if (X <= 1799)
  {
    ans = 2;
  }
  else if (X <= 1999)
  {
    ans = 1;
  }

  printf("%d", ans);
  return 0;
}

Measured memory_bytes: 1732
/*
このコード、と～おれ!
Be accepted!
∧＿∧　
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
 　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
		  　　　　　　　　　　(¸.·´ (¸.·'* ☆
*/

#include <cstdio>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstring>
#include <vector>
#include <numeric>
#include <iostream>
#include <random>
#include <map>
#include <unordered_map>
#include <queue>
#include <regex>
#include <functional>
#include <complex>
#include <list>
#include <cassert>
#include <iomanip>
#include <set>
#include <stack>
#include <bitset>

////多倍長整数, cpp_intで宣言
//#include <boost/multiprecision/cpp_int.hpp>
//using namespace boost::multiprecision;

//#pragma gcc target ("avx2")
//#pragma gcc optimization ("Ofast")
//#pragma gcc optimization ("unroll-loops")
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define rep1(i, n) for(int i = 1; i <= (n); ++i)
#define rep2(i, n) for(int i = 2; i < (n); ++i)
#define repr(i, n) for(int i = n; i >= 0; --i)
#define reprm(i, n) for(int i = n - 1; i >= 0; --i)
#define printynl(a) printf(a ? "yes\n" : "no\n")
#define printyn(a) printf(a ? "Yes\n" : "No\n")
#define printYN(a) printf(a ? "YES\n" : "NO\n")
#define printim(a) printf(a ? "possible\n" : "imposible\n")
#define printdb(a) printf("%.50lf\n", a) //少数出力
#define printLdb(a) printf("%.50Lf\n", a) //少数出力
#define printdbd(a) printf("%.16lf\n", a) //少数出力(桁少なめ)
#define prints(s) printf("%s\n", s.c_str()) //string出力
#define all(x) (x).begin(), (x).end()
#define allsum(a, b, c) ((a + b) * c / 2LL) //等差数列の和、初項,末項,項数
#define pb push_back
#define rpriq priq<int, vector<int>, greater<int>>
#define deg_to_rad(deg) (((deg)/360.0L)*2.0L*PI)
#define rad_to_deg(rad) (((rad)/2.0L/PI)*360.0L)
#define Please return
#define AC 0
#define manhattan_dist(a, b, c, d) (abs(a - c) + abs(b - d)) /*(a, b) から (c, d) のマンハッタン距離 */
#define inf numeric_limits<double>::infinity();
#define linf numeric_limits<long double>::infinity()

using ll = long long;

constexpr int INF = 1073741823;
constexpr int MINF = -1073741823;
constexpr ll LINF = ll(4661686018427387903);
constexpr ll MOD = 1e9 + 7;
constexpr long double eps = 1e-6;
const long double PI = acosl(-1.0L);

using namespace std;

void scans(string& str) {
	char c;
	str = "";
	scanf("%c", &c);
	if (c == '\n')scanf("%c", &c);
	while (c != '\n' && c != -1 && c != ' ') {
		str += c;
		scanf("%c", &c);
	}
}

void scanc(char& str) {
	char c;
	scanf("%c", &c);
	if (c == -1)return;
	while (c == '\n') {
		scanf("%c", &c);
	}
	str = c;
}

double acot(double x) {
	return PI / 2 - atan(x);
}

ll LSB(ll n) { return (n & (-n)); }

/*-----------------------------------------ここからコード-----------------------------------------*/



int main() {

	int n;
	scanf("%d", &n);
	while ((n & (n - 1)) != 0)--n;
	printf("%d\n", n);

	Please AC;
}


Measured memory_bytes: 3184
#include <iostream>
#include <vector>
#include <list>
using namespace std;

int main() {
    string s;
    int x, y, j = 0, k = 0;
    cin >> s >> x >> y;
    list<int> nums[2];
    for (int i = 0; i < s.size(); i++) {
        if (s[i] == 'T') {
            nums[j].emplace_back(k);
            k = 0;
            j = 1 - j;
        } else {
            k++;
        }
    }
    nums[j].emplace_back(k);
    x -= nums[0].front();
    nums[0].pop_front();
    auto knapsack = [&](list<int>& nums, int target)->bool {
        int size = s.size() * 2 + 1;
        if (s.size() + target >= size) {
            return false;
        }
        vector<bool> table(size);
        auto dp = [&](int i)->decltype(auto) {
            return table[s.size() + i];
        };
        dp(0) = true;
        for (int i : nums) {
            vector<bool> next(size);
            for (int j = 0; j < size; j++) {
                if (j - i >= 0) {
                    next[j] = next[j] || table[j - i];
                }
                if (j + i < size) {
                    next[j] = next[j] || table[j + i];
                }
            }
            swap(next, table);
        }
        return dp(target);
    };
    if (knapsack(nums[0], x) && knapsack(nums[1], y)) {
        cout << "Yes";
    } else {
        cout << "No";
    }
    return 0;
}


Measured memory_bytes: 512
#include <cstdio>
#include <algorithm>

using namespace std;

typedef long long int ll;

ll X,K,D;

int main(){
    scanf("%lld%lld%lld",&X,&K,&D);

    ll round=min(K,abs(X)/D);
    ll a=abs(X)-round*D;
    ll remain=K-round;

    if (remain%2) a=abs(a-D);

    printf("%lld\n",a);

    return 0;
}

Measured memory_bytes: 1732
#include<cstdio>
#include<algorithm>
#include<iostream>
#include<map>
#include<string>
using namespace std;
map<string,int> s;
int n1,n2,ans;
string s1[105],s2[105];
int main()
{
    scanf("%d",&n1);
    for(int i=1;i<=n1;i++)
    {
     cin>>s1[i];
     s[s1[i]]++;
    }
    scanf("%d",&n2);
    for(int i=1;i<=n2;i++)
    {
        cin>>s2[i];
        s[s2[i]]--;
    }
    for(int i=1;i<=n1;i++)ans=max(ans,s[s1[i]]);
    for(int i=1;i<=n2;i++)ans=max(ans,s[s2[i]]);
    printf("%d",ans);
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>

#define rep(i,n) for(int i=0;i<(n);i++)
typedef long long LL;
using namespace std;

int main() {
	string s;
	cin >> s;
	int cc = 0;
	int si = s.size();

	if (si % 2 != 0) {
		cout << "No" << endl;
		return 0;
	}
	else {
		for (int i = 0; i < si / 2; i++) {
			if (s[2 * i] == 'h'&&s[2 * i + 1] == 'i') {
				cc++;
			}
		}
	}
	if (cc == si/2) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		long a = in.nextInt();
		long b = in.nextInt();

		long sum = a + b;

		if(sum % 2 == 1) {
			System.out.println("IMPOSSIBLE");
			return;
		}

		System.out.println(sum / 2);

		return;
	}
}


Measured memory_bytes: 21844
#include <cstdio>
#include <cstdint>
#include <vector>
#include <algorithm>
#include <string>

int main() {
  size_t n;
  scanf("%zu", &n);
  char buf[128];
  scanf("%s", buf);
  std::string s = buf;

  puts((s.substr(0, n/2) == s.substr(n/2))? "Yes": "No");
}


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

using namespace std;

typedef long long ll;

const ll LongINF=1e13+7;
const int INF=1e9+7;
const int dx[]={0,1,0,-1};
const int dy[]={1,0,-1,0};

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template <class T, class Y>T GCD(T a, Y b){if(a<b){int c=a;a=b;b=c;}if (a % b == 0){return b;}return GCD(b, a % b);}
void clear(queue<pair<int, int>> &q){queue<pair<int, int>> empty;swap(q, empty);} //queueの中身の型は適時変更を忘れない

#define REP(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define rv reverse

int main(){
    string A,B;
    cin>>A>>B;
    
    vector<vector<int> >dp(1010,vector<int>(1010,INF));
    int L=A.length(),O=B.length();
    dp[0][0]=0;

    REP(i,-1,L){
        REP(j,-1,O){
            if(i==-1&&j==-1)continue;
            if(i>=0&&j>=0){
                if(A[i]==B[j])dp[i+1][j+1]=min(dp[i+1][j+1],dp[i][j]);//変更する必要がない
                else dp[i+1][j+1]=min(dp[i+1][j+1],dp[i][j]+1);//変更する
            }
            if(i>=0)dp[i+1][j+1]=min(dp[i+1][j+1],dp[i][j+1]+1);//文字の長さを合わせる必要がある
            if(j>=0)dp[i+1][j+1]=min(dp[i+1][j+1],dp[i+1][j]+1);//上記と同様 ただ、削除か挿入のどちらかという違い
        }
    }

    cout<<dp[L][O]<<endl;



    return 0;
}

//a=97,z=122


Measured memory_bytes: 6908
#include<iostream>
using namespace std;
   
int main()
{
    int a,b,c,Cnt=0;
    cin>>a>>b>>c;
    for(int i=a;i<=b;i++)
    {
        if(c%i==0)Cnt++;
    }
    cout<<Cnt<<endl;
    return 0;
}

Measured memory_bytes: 3120