akhauriyash/Code-Regression huggingface dataset:
//Author : Prakhar Asaiya
#include<bits/stdc++.h>
using namespace std;
#define REP(i,a,b) for(int i=a;i<b;++i)
#define REPN(i,a,b) for(int i=a;i<=b;++i)
#define REPV(i,a,b) for(int i = a; i>= b; --i)
#define db1(x) cout<<#x<<"="<<x<<'\n'
#define db2(x,y) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<'\n'
#define db3(x,y,z) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<","<<#z<<"="<<z<<'\n'
#define ll long long
#define INF 100000
#define ff first
#define ss second
const int M=1e9+7;

void solve()
{
	string s;
	cin>>s;
	if(s[0] == 'R' && s[1] == 'R' && s[2] == 'R')
	{
		cout<<3;
	}
	else if((s[0] == 'R' && s[1] == 'R') || (s[1] == 'R' && s[2] == 'R'))
	{
		cout<<2;
	}
	else if(s[0] == 'R' || s[1] == 'R' || s[2] == 'R')
	{
		cout<<1;
	}
	else
	cout<<0;
}

int main()
{/*
#ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
#*/
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  
  	solve();
  
  return 0;
}


Measured memory_bytes: 3652
#include<iostream>
#include<algorithm>

using namespace std;

struct land {
	int x;
	int y;
}k[100100];

bool cmp(land a, land b) {
	if (a.y == b.y) {
		return a.x < b.x;
	}
	return a.y < b.y;
}

int main() {
	ios::sync_with_stdio(false);
	cout.tie(NULL);
	int n, m, ans = 1;
	cin >> n >> m;
	for (int i = 0; i < m; i++) {
		cin >> k[i].x >> k[i].y;
	}
	sort(k, k + m, cmp);
	land start = k[0];
	for (int i = 1; i < m; i++) {
		if (k[i].x >= start.y) {
			ans++;
			start = k[i];
		}
	}
	cout << ans << endl;
}

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

#define MAX_N 100

int N, res;
unsigned int x, a[MAX_N];

int solve() {
    int idx=0;
    std::sort(a, a+N);
    while ( x > 0 && idx < N ) {
        if ( a[idx] <= x ) {
            x -= a[idx];
            ++res;
        } else if ( a[idx] > x ) {
            x = 0;
            break;
        }
        ++idx;
    }
    if ( x > 0) --res;
    return res;
}

int main() {
    std::cin >> N >> x;

    for (int i=0; i<N; ++i) std::cin >> a[i];

    std::cout << solve() << std::endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ff first
#define ss second
#define len(x) (int)(x.size())
#define all(x) x.begin(), x.end();
using namespace std;
using ll = long long;
using ii = pair<int, int>;

int main(){
	ios::sync_with_stdio(0);
	string st;
	cin >> st;
	set<char> s;
	for(auto c:st)
		s.insert(c);
	if(len(s)==2)
		cout << "Yes\n";
	else
		cout << "No\n";
}


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

#define pow(n) (n)*(n)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()

using namespace std;

/* function */
//  - none - 


/* code */
int main (void) 
{

  /* Variable_Proclamation */
  int64_t n;    // input

  int64_t i, j;    // subscript
  int     eao;     // even and odd

  int64_t  sum;
  bool     default_flag;
  bool     plus_flag, minus_flag;
  int64_t  ope_count;
  int64_t  plus_count,  minus_count;


  /* Input, Array_Proclamation */
  cin >> n;
  vector<int64_t> a(n);

  for(i=0; i<n; i++)
  {
    cin >> a.at(i);
  }


  /* Initialize */
  sum       = 0;
  ope_count = 0;
  eao       = 0;

  default_flag = true;
  plus_flag    = false;
  minus_flag   = false;


  /* Calculation */
  while(eao < 2)
  {
    for(i=0; i<n; i++)
    {

      sum += a.at(i);

      if(default_flag == true)
      {

        default_flag = false;
        if(eao == 0)
        {
          while(sum <= 0)
          {
            ope_count++;
            sum++;
          }
          plus_flag = true;
        }
        else if(eao == 1)
        {
          while(sum >= 0)
          {
            ope_count++;
            sum--;
          }
          minus_flag = true;
        }

      }

      else if(plus_flag == true)
      {

        while(sum >= 0)
        {
          ope_count++;
          sum--;
        }

        plus_flag  = false;
        minus_flag = true;

      }

      else if(minus_flag == true)
      {

        while(sum <= 0)
        {
          ope_count++;
          sum++;
        }

        plus_flag  = true;
        minus_flag = false;

      }

    }

    if(eao == 0)
    {
      plus_count  = ope_count;
    }
    else if(eao == 1)
    {
      minus_count = ope_count;
    }
    default_flag = true;
    plus_flag    = false;
    minus_flag   = false;

    sum = 0;
    ope_count = 0;

    eao++;
  }
  
  ope_count = min(plus_count, minus_count);

  /* Output */
  cout << ope_count << endl;


  return 0;

}


/* entity */
//  - none -




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

int main(){
    string s;cin>>s;
    //int cnt=0;
    int n=s.size();
    int nzero=0;
    int none=0;
    for(int i=0;i<n;i++){
        if(s[i]=='0')nzero++;
        else none++;
    }
    //cout<<nzero<<endl;
    cout<<2*min(nzero,none)<<endl;

}

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

int main(){
  long long int X,Y,Z,K;
  vector<long long int>A,B,C,ansList;

  cin >>X>>Y>>Z>>K;

  for(int i=0;i<X;i++){
      long long int x;
      cin >>x;
      A.push_back(x);
}

  for(int i =0;i<Y;i++){
      long long int x;
      cin >>x;
      B.push_back(x);
  }

  for(int i =0;i<Z;i++){
      long long int x;
      cin >>x;
      C.push_back(x);
  }
  
  sort(A.begin(),A.end(),greater<long long int>());
  sort(B.begin(),B.end(),greater<long long int>());
  sort(C.begin(),C.end(),greater<long long int>());
  

	long int loopNum = 0;

	for(int i = 0;(i < X);i++){
		for(int j = 0;(j < Y);j++){
			for(int k = 0;(k < Z);k++){
        if ((i+1)*(j+1)*(k+1) <= 3000)ansList.push_back(A[i]+B[j]+C[k]);
        else break;
        
			}
		}
	}

	sort(ansList.begin(),ansList.end(),greater<long long int>());

	for(int i = 0;i<K;i++){
		cout <<ansList[i]<<endl;
	}

  return 0;
  }

Measured memory_bytes: 1412
#include<bits/stdc++.h>
// #include <boost/lexical_cast.hpp>
using namespace std;
#define ll long long int
#define vll vector<ll>
#define vllv vector<vector<ll>> 
#define sz size()
#define pb push_back
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
#define allr(v) v.rbegin(),v.rend()
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)

ll ceil1(ll n,ll m){if(n%m==0){return n/m;}return n/m +1;}
vll factor(ll n){
    vll ans;
    if(n>0)ans.pb(1);if(n==2)ans.pb(2);
    for(ll i=2;i*i<=n;i++){if(n%i==0){ans.pb(i);if(n/i!=i)ans.pb(n/i);}}if(n>2)ans.pb(n);
    return ans;
}
ll fact(ll n){
	
    ll res = 1; 
    for (ll i = 2; i <= n; i++) 
        res = res * i; 
    return res; 
} 
  
int nCr(ll n, ll r) 
{ 
    return fact(n) / (fact(r) * fact(n - r)); 
} 
  
void dfs(vllv &v,ll k,vll &par,vll &dis,ll p)
{
 
    par[k]=p;
    dis[k]=dis[p]+1;
    for(ll i=0;i<v[k].sz;i++){
        if(v[k][i]!=p){
            dfs(v,v[k][i],par,dis,k);
        }
    }
}
bool sortbysec(const pair<int,int> &a,const pair<int,int> &b){return (a.second<b.second);} 


ll ston(string s) 
{ 
    stringstream geek(s); 
    ll x = 0; 
    geek >> x; 
    
  
    return x; 
}
ll pow2(ll n,ll k){ll ans=1;
    while(k>0){
        if(k%2==1)ans=ans*n;n=n*n;k/=2;
    }return ans;}

void solve()
{
	ll n;
	cin>>n;
	ll a,b;
	cin>>a>>b;
	for(ll i=a;i<=b;i++)
	{
		if(i%n==0){
			cout<<"OK";
			return;}
			
	
			
	}
	cout<<"NG";
	return;
}

int main()
{
    ll q;
    q=1;
    // cin>>q;
    while(q--)
    {
        solve();
    }
    return 0;
}

Measured memory_bytes: 3632
#include <stdio.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
    int m1,m2,d1,d2;
    scanf("%d %d %d %d", &m1, &d1, &m2, &d2);
    if(m1 == m2){
        printf("0");
    } else {
        printf("1");
    }
    return 0;
}


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

#define REP(i, e) for(int (i) = 0; (i) < (e); ++(i))
#define FOR(i, b, e) for(int (i) = (b); (i) < (e); ++(i))
#define ALL(c) (c).begin(), (c).end()
#define ACC(c) (accumulate(ALL(c), 0LL))
#define ENDL "\n"
#define PRINT(x) cout << (x) << ENDL
#define DUBUG(x) cerr << (x) << ENDL

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

inline int in(int& a) {return scanf("%d", &a);}
inline void out(int n) {printf("%d\n", n);}
auto pint_compare = [](pint x, pint y) -> bool{return (x.first < y.first);};


int N, M, S, T;
ll yen[100000], snuke[100000], ans[100001];
vector<pint> adjy[100000], adjs[100000];

void dijkstra(int s, int g){
    REP(i, N) yen[i] = snuke[i] = INT64_MAX;
    yen[s] = 0;
    priority_queue<pint, vector<pint>, greater<pint> > que;
    que.push(pint(0, s));
    while(!que.empty()){
        int index = que.top().second;
        que.pop();
        for(auto p : adjy[index]){
            int weight = p.first;
            int next = p.second;
            if(yen[index] + weight < yen[next]){
                yen[next] = yen[index] + weight;
                que.push(pint(yen[next], next));
            }
        }
    }
    snuke[g] = 0;
    que.push(pint(0, g));
    while(!que.empty()){
        int index = que.top().second;
        que.pop();
        for(auto p : adjs[index]){
            int weight = p.first;
            int next = p.second;
            if(snuke[index] + weight < snuke[next]){
                snuke[next] = snuke[index] + weight;
                que.push(pint(snuke[next], next));
            }
        }
    }
    REP(i, N){
        cerr << "yen[" << i << "] = " << yen[i] << ", snuke[" << i << "] = " << snuke[i] << ENDL;
    }
}

signed main(){
    cin >> N >> M >> S >> T;
    S--; T--;
    int u, v, a, b;
    REP(i, M){
        cin >> u >> v >> a >> b;
        adjy[u - 1].push_back(pint(a, v - 1));
        adjy[v - 1].push_back(pint(a, u - 1));
        adjs[u - 1].push_back(pint(b, v - 1));
        adjs[v - 1].push_back(pint(b, u - 1));
    }
    dijkstra(S, T);
    ans[N] = INT64_MAX;
    REP(i, N){
        ans[N - 1 - i] = min(ans[N - i], yen[N - 1 - i] + snuke[N - 1 - i]);
    }
    REP(i, N){
        PRINT((ll)(1e15) - ans[i]);
    }
    return 0;
}

Measured memory_bytes: 16344
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin >> n;
    vector<int> v(n), memo(n);
    for(int i=0; i<n; i++)
        cin >> v[i];
    memo[n-1] = 0;
    for(int i=n-2; i>=0; i--){
        if(v[i]>=v[i+1])
            memo[i] = memo[i+1]+1;
    }
    int maxval = 0;
    for(int i=0; i<memo.size(); i++)
        maxval = max(maxval, memo[i]);
    cout << maxval;
    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <cstdio>
#include <queue>
#include <algorithm>
#include <functional>
#include <string>
#include <queue>
#include <cmath>
#include <iomanip>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <numeric>
#define ll long long
#define fr(i,k,N) for(ll i=k; i<N;i++)
#define rep(i,N) for(ll i=0; i<N;i++)
#define ALL(v) v.begin(),v.end()
#define mp make_pair
using namespace std;
template <class X> void pr(X test){cout<<test<<endl;}
template <class X> void prr(X test){for(auto it:test){cout<<it<<endl;}}
template <class X> void prrr(X test){int f=0;for(auto it:test){cout<<(f++!=0?" ":"")<<it;}cout<<endl;}
template<typename X>
istream&operator>>(istream&i,vector<X>&v){for(X&x:v)i>>x;return i;}

class UF { // union find from https://github.com/kartikkukreja/blog-codes (MIT)
    // [usage]
    // auto uf = new UF(n);
    // uf->merge(l, r); // 0 <= l, r <= n-1
    // ...
public:
    int *id; // inner id
    int cnt; // number of all vartices
    int *sz; // sz[i] means size of i's set
    UF(int N)   {
        cnt = N;
        id = new int[N];
        sz = new int[N];
        for(int i=0; i<N; i++) {
            id[i] = i;
            sz[i] = 1;
        }
    }
    ~UF() {
        delete [] id;
        delete [] sz;
    }
    int find(int p) {
        int root = p;
        while (root != id[root]) root = id[root];
        while (p != root) {
            int newp = id[p];
            id[p] = root;
            p = newp;
        }
        return root;
    }
    void merge(int x, int y) {
        int i = find(x);
        int j = find(y);
        if (i == j) return;
        
        if (sz[i] < sz[j]) {
            id[i] = j;
            sz[j] += sz[i];
        } else {
            id[j] = i;
            sz[i] += sz[j];
        }
        cnt--;
    }
    bool connected(int x, int y) {
        return find(x) == find(y);
    }
    int count() {
        return cnt;
    }
};

// return sorted 約数list 1 <= x <= n
vector<ll> divv(ll n) {
  vector<ll> v;
  for(ll i = 1; i*i <= n; i++) {
    if(n%i == 0) {
      v.push_back(i);
      if(i*i != n) v.push_back(n/i);
    }
  }
  sort(ALL(v));
  return v;
}

int main() {
    ll s,t;

    cin>>s>>t;
    ll sum = 1, cnt = 0;
    while(1) if(sum>=t){
break;
    }else{
        cnt++;
        sum+=(s-1);
    }
    pr(cnt);
    
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <vector>
#include <string.h>
#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 INF 2e9
#define ALL(v) v.begin(), v.end()
 
using namespace std;
typedef long long ll;

int main(){
  int n;
  int res = 0;
  bool result = false;
  cin >> n;
  int D1,D2;
  rep(i,n){
    cin >> D1 >> D2;
    if(D1 == D2) res += 1;
    else res = 0; 
    if(res == 3){
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 3596
#include <cstdio>
#include <cstdint>
#include <vector>
#include <algorithm>

int main() {
  size_t n;
  intmax_t k, q;
  scanf("%zu %jd %jd", &n, &k, &q);

  std::vector<intmax_t> b(n, k-q);
  for (int i = 0; i < q; ++i) {
    size_t j;
    scanf("%zu", &j);
    --j;
    ++b[j];
  }

  for (size_t i = 0; i < n; ++i)
    puts((b[i] > 0)? "Yes": "No");
}


Measured memory_bytes: 1408
#include <iostream>
#include <vector>
#include <numeric>//accumulate(v.begin(), v.end(), 0);
#include <algorithm>//sort(v.begin(),v.end());
#include <string>//
using namespace std;
#define ll long long
#define rep(i, n) for(int i = 0; i < (int)(n); i++)

int gcd(int a, int b) {
        return b ? gcd(b, a % b) : a;
}

int main() {
        int n, x;
        cin >> n >> x;
        vector<int> v(n);
        for (auto &e : v) {
                cin >> e;
                e = abs(e - x);
        }
        int r = v.front();
        for (auto e : v) {
                r = gcd(r, e);
        }
        cout << r << endl;
        return 0;
}


Measured memory_bytes: 640
from collections import Counter, deque
from fractions import gcd
from functools import lru_cache
from functools import reduce
import functools
import heapq
import itertools
import math
import numpy as np
import re
import sys

sys.setrecursionlimit(10000)
INF = float('inf')


def get_primes(max=None, count=None):
    """
    素数列挙
    昇順にソートされています
    https://qiita.com/Ishotihadus/items/73e107271275611f05f2
    :param int max:
    :param int count:
    :return:
    """
    assert max or count
    if count:
        raise NotImplementedError()
    if max <= 1:
        return []

    primes = [2]
    sieve = [False for _ in range(max + 1)]
    p = 3
    while p <= max:
        primes.append(p)
        sieve[p] = True
        if p <= math.sqrt(max):
            for i in range(p * (p | 1), max + 1, p * 2):
                sieve[i] = True
        while p <= max and sieve[p]:
            p += 2

    return primes


N = int(input())
PRIMES = get_primes(max=55555)

ans = []
for p in PRIMES:
    if p % 5 == 1:
        ans.append(p)
    if len(ans) >= N:
        break
print(*ans)


Measured memory_bytes: 13952
#include<iostream>
#include<string>
using namespace std;
int main()
{ 
	string str;
	cin>>str;
	int l=str.length();
	int num=0;
	for(int i=(l+1)/2-1;i>=0;i--)
	if(str[i]!=str[l-1-i]) num++;
	cout<<num;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
const long long INF = numeric_limits<long long>::max();
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main() {
  string N;
  cin >> N;
  long long K;
  cin >> K;

  long long dp[110][2][110];
  REP(i, N.size()) REP(j, 2) REP(k, 110) dp[i][j][k] = 0;
  dp[0][0][0] = 1;

  REP(i, N.size()) {
    const int D = N[i] - '0';
    REP(j, 2) {
      REP(k, 100) {
        for(int d = 0; d <= (j ? 9 : D); d++) {
          dp[i+1][j || (d < D)][k + (d == 0 ? 0 : 1)] += dp[i][j][k];
        }
      }
    }
  }
  cout << dp[N.size()][0][K] + dp[N.size()][1][K] << endl;
  // cout << dp[N.size()][0][K] << endl;
  // cout <<  dp[N.size()][1][K] << endl;
  // REP(i, N.size()) {
  //   REP(j, 2) {
  //     REP(k, K+1) {
  //       cout << dp[i][j][k] << ' ';
  //     }
  //     cout << "    ";
  //   }
  //   cout << endl;
  // }

  

  return 0;
}

Measured memory_bytes: 384
import java.util.Arrays;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k = sc.nextInt();

		Sushi[] array = new Sushi[n];
		for (int i = 0; i < n; i++) {
			array[i] = new Sushi(sc.nextInt(), sc.nextInt());
		}
		sc.close();

		// おいしさ降順でソート
		Arrays.sort(array, new Comparator<Sushi>() {
			public int compare(Sushi s1, Sushi s2) {
				return s2.d - s1.d;
			}
		});

		// 種類、その種類の個数
		Map<Integer, Integer> typeMap = new HashMap<Integer, Integer>();
		// おいしさ大きい順にK個食べた場合の種類数と満足ポイント
		int typeCnt = 0;
		long manzoku = 0L;
		for (int i = 0; i < k; i++) {
			Sushi sushi = array[i];
			int bonusDiff = 0;
			if (typeMap.containsKey(sushi.t)) {
				typeMap.put(sushi.t, typeMap.get(sushi.t) + 1);
			} else {
				bonusDiff -= typeCnt * typeCnt;
				typeMap.put(sushi.t, 1);
				typeCnt++;
				bonusDiff += typeCnt * typeCnt;
			}
			manzoku += sushi.d + bonusDiff;
		}

		long ans = manzoku;
		int rmIdx = k - 1;
		for (int i = k; i < n; i++) {
			Sushi sushi = array[i];
			// 新しい種類の場合
			if (!typeMap.containsKey(sushi.t)) {
				Sushi rmSushi = null;
				for (; rmIdx >= 0; rmIdx--) {
					rmSushi = array[rmIdx];
					int rmCnt = typeMap.get(rmSushi.t);
					if (rmCnt >= 2) {
						typeMap.put(rmSushi.t, rmCnt - 1);
						rmIdx--;
						break;
					}
					rmSushi = null;
				}
				if (rmSushi != null) {
					typeMap.put(sushi.t, 1);
					int bonusDiff = 0;
					bonusDiff -= typeCnt * typeCnt;
					typeCnt++;
					bonusDiff += typeCnt * typeCnt;
					manzoku += sushi.d - rmSushi.d + bonusDiff;
					ans = Math.max(ans, manzoku);
				}
			}
		}
		System.out.println(ans);
	}

	static class Sushi {
		int t;
		int d;
		public Sushi(int t, int d) {
			this.t = t;
			this.d = d;
		}
	}
}


Measured memory_bytes: 95320
#include<stdio.h>

int main(void)
{
	unsigned long long int a, b, c, sum, k;

	scanf("%lld%lld%lld%lld", &a, &b, &c, &k);

	if (a >= k) {
		printf("%lld", k);
		return 0;
	}

	if (a + b >= k) {
		printf("%lld", a);
		return 0;
	}

	else {
		printf("%lld", (a - (k - b - a)));
		return 0;
	}

	return 0;
}

Measured memory_bytes: 2156
//OPTIMIZATONS
#pragma GCC optimize("02")
//CODE
#include<bits/stdc++.h>
#define int long long
#define float double
#define endl "\n"
#define debug cout<<"Good uptill here"<<endl<<flush;
#define deb(x) cout<<#x<<":"<<x<<endl<<flush;

using namespace std;

const int inf = 1e17 + 7;
const int MOD = 1e7 + 9;

int32_t main(){
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	//CODE FOR SPECIFIED INPUT AND OUTPUT
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	int n,k,c;
	cin>>n>>k>>c;
	string s;
	cin>>s;
	int dp[k][2];
	int cnt = 0;
	for(int i=0;i<n;i++){
		if(s[i]=='o' && cnt<k){
			dp[cnt++][0] = i;
			i+=c;
		}
	}
	cnt = k-1;
	for(int i=n-1;i>=0;i--){
		if(s[i]=='o' && cnt>=0){
			dp[cnt--][1] = i;
			i-=c;
		}
	}
	for(int i=0;i<k;i++){
		if(dp[i][0]==dp[i][1]){
			cout<<(dp[i][0]+1)<<endl;
		}
	}
	return 0;
}



Measured memory_bytes: 5012
#include <iostream>
#include <math.h>
#include <string>
#include <vector>
using namespace std;


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

  int ans = 0, maxNum = 0;
  
  for (int i=0; i<s.length(); i++){
    if (s[i] == 'A' || s[i] == 'C' || s[i] == 'G' || s[i] == 'T'){
      ans += 1;
    }
    else{
      maxNum = max(maxNum, ans);
      ans = 0;
    }
  }
  
  maxNum = max(maxNum, ans);
  cout << maxNum;
  
  
  return 0;
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPS(i, a, b) for (int i = (a); i < (b); ++i)
using namespace std;
using ll = long long;

int main() {
  int x,y;
  cin >> x >> y;
  
  int z = 2*x;
    
  REP(i,x+1){
    if(z == y){
      cout << "Yes" << endl;
      return 0;
    }
    z += 2;
  }
  
  cout << "No" << endl;
  

}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
#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 INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

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

ll inputLValue(){
    ll a;
    cin >> a;
    return a;
};

int main()
{
    int N = inputValue();
    int tax = N * 8 / 108;
    int ans = N - tax;
    int chk = ans * 108 / 100;
    if(chk != N){
        cout << ":(" << endl;
    }else{
        cout << ans << endl;
    }

}


Measured memory_bytes: 256
import bisect
from typing import List


def main():
    n, m, k = map(int, input().split())
    a = list(map(int, input().split()))
    b = list(map(int, input().split()))
    print(t(n, m, k, a, b))


def t(n: int, m: int, k: int, a: List[int], b: List[int]) -> int:
    aa = [0]
    for i in range(n):
        aa.append(aa[i] + a[i])
    bb = [0]
    for i in range(m):
        bb.append(bb[i] + b[i])

    ret = 0
    for i in range(n + 1):
        x = aa[i]
        s = k - x
        if s < 0:
            break
        j = bisect.bisect(bb, s) - 1
        ret = max(ret, i + j)

    return ret


if __name__ == '__main__':
    main()


Measured memory_bytes: 50316
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <vector>
#include <cstdlib>

#define For(i, j, k) for(int i = j; i <= k; i++)
#define Forr(i, j, k) for(int i = j; i >= k; i--)
#define pb push_back

using namespace std;

const int N = 1010, M = 5010;

int x[N], y[N], n;
vector<int> G[N];
bool f[M], dp[M];

void DFS(int o){
	int sum = 0;
	for(int v : G[o]) DFS(v), sum += x[v] + y[v];
	memset(f, false, sizeof f);
	f[0] = true;
	for(int v : G[o])
		Forr(i, x[o], 0) f[i] = (i >= x[v] && f[i - x[v]]) || (i >= y[v] && f[i - y[v]]);
	bool flag = true;
	Forr(i, x[o], 0) if(f[i]){
		sum += x[o] - i;
		flag = false;
		break;
	}
	if(flag){
		puts("IMPOSSIBLE");
		exit(0);
	}
	y[o] = sum - x[o];
}

int main(){
	scanf("%d", &n);
	For(i, 2, n){
		int p;
		scanf("%d", &p);
		G[p].pb(i);
	}
	For(i, 1, n) scanf("%d", &x[i]);
	DFS(1);
	puts("POSSIBLE");
	return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstring>

using namespace std;

const int MAX_V = 1001;
typedef pair<int,int> pii;
// d[u][v]Íu©çvÖÌRXgBßÉ×Ú·éGbWÌRXgðüêÄ¨¢½è·êÎæ¢Í¸B
int d[MAX_V][MAX_V];
pii works[1001];
vector<int> G[MAX_V*2];
int match[MAX_V*2];
bool used[MAX_V*2];

const int INF=1000000000;

// S_ÎÅZoHâèðÆ­O(V^3)AÓª ÁÄà®ì
void warshall_floyd(int V){
    for(int i = 0; i < V; i++){
        for(int j = 0; j < V; j++){
            for(int k = 0; k < V; k++){
            	d[j][k]=min(d[j][k],d[j][i]+d[i][k]);
            }
        }
    }
}

int n,m,l;


// uÆvðÔÓðOtÉÇÁ
void add_edge(int u,int v){
	G[u].push_back(v);
	G[v].push_back(u);
}
// ÁpXðdfsÅT·
bool dfs(int v){
	used[v] = true;
	for(int i = 0; i < G[v].size(); i++){
		int u = G[v][i],w = match[u];
		if(w < 0 || !used[w] && dfs(w)){
			match[v] = u;
			match[u] = v;
			return true;
		}
	}
	return false;
}

// ñOtÌÅå}b`Oðßé
int bipartite_matching(int V){
	int res = 0;
	memset(match,-1,sizeof(match));
	for(int v = 0; v < V; v++){
		if(match[v] < 0){
			memset(used,0,sizeof(used));
			if(dfs(v)){
				res++;
			}
		}
	}
	return res;
}

int main(){

	while(cin>>n>>m>>l&&(n|m|l)){
		for(int i=0;i<MAX_V*2;i++)G[i].clear();
		for(int i=0;i<MAX_V;i++){
			for(int j=0;j<MAX_V;j++){
				if(i==j)d[i][j]=0;
				else d[i][j]=INF;
			}
		}
		for(int i=0;i<m;i++){
			int u,v,c;
			cin>>u>>v>>c;
			d[u][v]=c;
			d[v][u]=c;
		}
		warshall_floyd(n);
		for(int i=0;i<l;i++)cin>>works[i].first>>works[i].second;
		for(int i=0;i<l;i++){
			for(int j=0;j<l;j++){
				if(i==j)continue;
				else if(works[i].second+d[works[i].first][works[j].first]<=works[j].second)
					add_edge(i,j+l);
			}
		}
		// OtGÉÂ¢ÄAñ}b`Oðs¤
		int res=bipartite_matching(2*l);
		cout<<l-res<<endl;
	}

	return 0;
}

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

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

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

    if(d == 0){
        if(n == 100){
            cout << 101 << endl;
            return 0;
        }
        cout << n << endl;
        return 0;
    }

    if(d == 1){
        if(n == 100){
            cout << 10100 << endl;
            return 0;
        }
        cout << 100 * n << endl;
        return 0;
    }

    if(d == 2){
        if(n == 100){
            cout << 1010000 << endl;
            return 0;
        }
        cout << 10000 * n << endl;
    }
    
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
int INF = 1e9;
int MOD = 1e9+7;
main(){
    int N,K,a;
    vector<int> v;
    cin >> N >> K;
    for(int i = 0;i < N;i++){
        cin >> a;
        v.push_back(a);
    }
    sort(v.begin(),v.end(),greater<int>());
    int sum = 0;
    for(int i = 0;i < K;i++){
        sum += v[i];
    }
    cout << sum << endl;
}

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

int main() {
  char c;
  cin >> c;

  if (c == 'a' or c == 'i' or c == 'u' or c == 'e' or c == 'o') {
    cout << "vowel" << endl;
  } else {
    cout << "consonant" << endl;
  }
}


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

#include <iostream> 

//Algoritmo de gcd de Euclides
long long int gcd(long long int a, long long int b) 
{ 
	if (b == 0) 
		return a; 
	return gcd(b, a % b); 
	
} 

int main() 
{ 
vector<long long int> v;
long long int aux, value, k, n;
cin >> n;


while(n--){

        cin >> value;
        v.push_back(value);
       
}

aux = v[0];

for (long long int i = 1; i < v.size();i++)    
                    aux = gcd(v[i], aux);


cout << aux << endl;

	return 0; 
} 


Measured memory_bytes: 1400
def main():
    from sys import setrecursionlimit, stdin, stderr
    from os import environ
    from collections import defaultdict, deque, Counter
    from math import ceil, floor
    from itertools import accumulate, combinations, combinations_with_replacement
    setrecursionlimit(10**6)
    dbg = (lambda *something: stderr.write("\033[92m{}\033[0m".format(str(something)+'\n'))) if 'TERM_PROGRAM' in environ else lambda *x: 0
    input = lambda: stdin.readline().rstrip()
    LMIIS = lambda: list(map(int,input().split()))
    II = lambda: int(input())
    P = 10**9+7
    INF = 10**18+10

    N,A,B = LMIIS()
    X = LMIIS()
    prev = X[0]
    fatigue = 0
    for i in range(1,N):
        distance = X[i] - X[i-1]
        if A*distance < B:
            fatigue += A*distance
        else:
            fatigue += B
    print(fatigue)          
    
main()

Measured memory_bytes: 62704
#include<stdio.h>
int main(void){
  int n, i, j;
  long long sum, max, min;
  int a[100000];
  scanf("%d", &n);
  sum = 0;
  for(i = 0;i<n;i++){
    scanf("%d", &a[i]);
  }
  max = a[0];
  min = a[0];
  for(i=0;i<n;i++){
    if(a[i]<min){
      min = a[i];
    }
    if(a[i]>max){
      max=a[i];
    }
    sum+=a[i];
  }
  printf("%lld %lld %lld\n", min, max, sum);
  return 0;
}



Measured memory_bytes: 2080
A = []
for _ in range(3):
    a = list(map(int, input().split()))
    A.append(a)
n = int(input())
B = []
for _ in range(n):
    b = int(input())
    B.append(b)

Check = [[0 for _ in range(3)] for _ in range(3)]

for i in range(3):
    for j in range(3):
        if A[i][j] in B:
            Check[i][j] = 1

ans = 'No'
for i in range(3):
    if sum(Check[i]) == 3:
        ans = 'Yes'
for i in range(3):
    now = 0
    for j in range(3):
        now += Check[j][i]
    if now == 3:
        ans = 'Yes'
now = 0
for i in range(3):
    now += Check[i][i]
if now == 3:
    ans = 'Yes'

if Check[2][0] + Check[1][1] + Check[0][2] == 3:
    ans = 'Yes'

print(ans)
        
    

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

unordered_map<int, int> me, mo;
typedef pair<int, int> P;
int main()
{
    int n;
    cin >> n;
    for (int i = 0; i < n / 2; i++)
    {
        int x, y;
        cin >> x >> y;
        me[x]++;
        mo[y]++;
    }
    P mxe1 = P(0, 0), mxe2 = P(0, 0);
    P mxo1 = P(0, 0), mxo2 = P(0, 0);
    unordered_map<int, int>::iterator p;
    for (p = me.begin(); p != me.end(); p++)
    {
        int tmp = p->second;
        if (tmp > mxe1.second)
        {
            mxe2 = mxe1;
            mxe1 = P(p->first, p->second);
        }
        else if (tmp > mxe2.second)
        {
            mxe2 = P(p->first, p->second);
        }
    }
    for (p = mo.begin(); p != mo.end(); p++)
    {
        int tmp = p->second;
        if (tmp > mxo1.second)
        {
            mxo2 = mxo1;
            mxo1 = P(p->first, p->second);
        }
        else if (tmp > mxo2.second)
        {
            mxo2 = P(p->first, p->second);
        }
    }

    if (mxe1.first != mxo1.first)
    {
        cout << n - mxe1.second - mxo1.second;
    }
    else
    {
        int ans = n - mxe1.second - mxo2.second;
        ans = min(ans, n - mxe2.second - mxo1.second);
        cout << ans << endl;
    }

    return 0;
}

Measured memory_bytes: 4376
using System;

class A{
  static void Main(){
    string S = Console.ReadLine(), ans = "0";
    if (!S.Contains("R")) ans = "0";
    else if (!S.Contains("S")) ans = "3";
    else if (S.Substring(0, 2) == "RR" || S.Substring(1, 2) == "RR") ans = "2";
    else ans = "1";
    Console.WriteLine(ans);
  }
}

Measured memory_bytes: 17292
N, M = gets.strip.split(" ").map(&:to_i)
correct_cnt = 0
wrong_cnt = 0
flags = Array.new(N+1, false)
wrongs = Array.new(N+1, 0)

M.times do
  n, a = gets.strip.split(' ')
  flags[n.to_i] = true if a == 'AC' && flags[n.to_i] == false
  wrongs[n.to_i] += 1 if a == 'WA' && flags[n.to_i] == false
end
(1..N).each do |n|
  if flags[n] == true
    correct_cnt += 1
    wrong_cnt += wrongs[n]
  end
end
puts "#{correct_cnt} #{wrong_cnt}"


Measured memory_bytes: 3324
// テンプレ
#include <bits/stdc++.h>
using namespace std;

using ll = long long;
#define int long long
using P = pair<int, int>;

#define LOG(variable) cerr << #variable":\t" << (variable) << endl
#define LOGCON(i, container) for(int (i) = 0; (i) < (container).size(); ++(i)) cerr << (i) << ":\t" << (container)[(i)] << endl
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPS(i, r, n) for (int i = (r); i < (n); ++i)
#define REPR(i, n) for(int i = (n); i >= 0; --i) // from n to 0
#define REPRS(i, n, r) for(int i = (n); i >= (r); --i) // from n to r
#define REPOBJ(itr, obj) for(auto itr = (obj).begin(); itr != (obj).end() ; ++itr)
#define REPROBJ(itr, obj) for(auto itr = (obj).rbegin(), e = (obj).rend(); itr != e; ++itr)
#define COUTB(x) cout << (x) << "\n"
#define COUTS(x) cout << (x) << " "
#define PB push_back
#define SORT(obj) sort((obj).begin(), (obj).end())
#define SORTR(obj) sort((obj).begin(), (obj).end(), greater<>())
#define ALL(obj) (obj).begin(), (obj).end()
#define MOD 1000000007
#define PI (acos(-1))
template<typename T = int>
T in() {T a; cin >> a; return a;}
/***** MAIN *****/
signed main() {
  int n; cin >> n;
  int tmp;
  int max_value = 0;
  int ans = 0;
  for(int i = 0; i < n; ++i) {
    cin >> tmp;
    ans += max(0LL, max_value - tmp);
    max_value = max(max_value, tmp);
  }
  cout << ans;
  cout << "\n";
  return 0;
}
/***** MAIN *****/


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


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

    int ans = S.size();
    for (int i = 0; i < 2; ++i) {
        int cnt = 0;
        for (int j = 0; j < S.size(); ++j) {
            if (j % 2 == 0 && S[j] != (char)(i + '0')) cnt++;
            if (j % 2 == 1 && S[j] == (char)(i + '0')) cnt++;
        }
        ans = min(ans, cnt);
    }
    cout << ans << endl;
}

Measured memory_bytes: 512
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
using namespace std;
int main(){
	int N,A,B,c=0;
	cin>>N>>A>>B;
	for(int i=1;i<=N;i++){
		if(i%10+i%100/10+i%1000/100+i%10000/1000+i%100000/10000<=B && i%100000/10000+i%10+i%100/10+i%1000/100+i%10000/1000>=A){
			c=c+i;
		}
	}
	cout<<c<<endl;
}

Measured memory_bytes: 256
S = list(input())
S2 = S[:]
now = S[0]
ans = 0
ans2 = 0
for i in range(len(S)-1):
  if now == "1":
    if S[i+1] == "0":
      now = "0"
    else:
      ans += 1
      now = "0"
      S[i+1] = "0"
  else:
    if S[i+1] == "1":
      now = "1"
    else:
      ans += 1
      now = "1"
      S[i+1] = "1"
S2.reverse()
now = S2[0]
for i in range(len(S2)-1):
  if now == "1":
    if S2[i+1] == "0":
      now = "0"
    else:
      ans2 += 1
      now = "0"
      S2[i+1] = "0"
  else:
    if S2[i+1] == "1":
      now = "1"
    else:
      ans2 += 1
      now = "1"
      S2[i+1] = "1"
print(min(ans, ans2))


Measured memory_bytes: 4776
#include<bits/stdc++.h>
 
using namespace std;
#define int long long
#define N 666666
int sum[N];
signed  main(){
	string s;
	cin>>s;
	for(int i=0;i<s.size();i++){
		if(s[i]=='g') sum[i]=sum[i-1]+1;
		else sum[i]=sum[i-1]-1;
	}
	//cout<<sum[s.size()-1]<<'\n';
	cout<<sum[s.size()-1]/2;
	
    return 0;
}
/*


ggppgggpgg

ggppgpgpgp

*/

Measured memory_bytes: 1280
import sys
import math
import collections
import itertools
import array
import inspect

# Set max recursion limit
sys.setrecursionlimit(1000000)


# Debug output
def chkprint(*args):
    names = {
        id(v): k
        for k, v in inspect.currentframe().f_back.f_locals.items()
    }
    print(', '.join(
        names.get(id(arg), '???') + ' = ' + repr(arg) for arg in args))


# Binary converter
def to_bin(x):
    return bin(x)[2:]


def li_input():
    return [int(_) for _ in input().split()]


def gcd(n, m):
    if n % m == 0:
        return m
    else:
        return gcd(m, n % m)


def gcd_list(L):
    v = L[0]

    for i in range(1, len(L)):
        v = gcd(v, L[i])

    return v


def lcm(n, m):
    return (n * m) // gcd(n, m)


def lcm_list(L):
    v = L[0]

    for i in range(1, len(L)):
        v = lcm(v, L[i])

    return v


# Width First Search (+ Distance)
def wfs_d(D, N, K):
    """
    D: 隣接行列(距離付き)
    N: ノード数
    K: 始点ノード
    """

    dfk = [-1] * (N + 1)
    dfk[K] = 0

    cps = [(K, 0)]
    r = [False] * (N + 1)
    r[K] = True
    while len(cps) != 0:
        n_cps = []
        for cp, cd in cps:
            for i, dfcp in enumerate(D[cp]):
                if dfcp != -1 and not r[i]:
                    dfk[i] = cd + dfcp
                    n_cps.append((i, cd + dfcp))
                    r[i] = True

        cps = n_cps[:]

    return dfk


# Depth First Search (+Distance)
def dfs_d(v, pre, dist):
    """
    v:  現在のノード
    pre: １つ前のノード
    dist: 現在の距離

    以下は別途用意する
    D: 隣接リスト(行列ではない)
    D_dfs_d: dfs_d関数で用いる，始点ノードから見た距離リスト
    """

    global D
    global D_dfs_d

    D_dfs_d[v] = dist

    for next_v, d in D[v]:
        if next_v != pre:
            dfs_d(next_v, v, dist + d)

    return


def sigma(N):
    ans = 0
    for i in range(1, N + 1):
        ans += i
    return ans


def comb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2, r + 1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p - 1, r, p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

def bisearch(L, target):
    low = 0
    high = len(L) - 1
    
    while low <= high:
        mid = (low + high) // 2
        guess = L[mid]
        if guess == target:
            return True
        elif guess < target:
            low = mid + 1
        elif guess > target:
            high = mid - 1
    if guess != target:
        return False

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

dp = None


def main():
    N = input()

    for n in N:
        if n == "1":
            print("9", end="")
        elif n == "9":
            print("1", end="")
        else:
            print(n, end="")
    
    print()


main()


Measured memory_bytes: 4904
#pragma GCC optimize ("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include <bits/stdc++.h>
using namespace std;
using Int = long long;
typedef pair<int,int> P; typedef pair<Int,Int> Pl;
const int mod = 1e9+7;
#define END {cout<<ans<<'\n'; return 0;}
#define ALL(v) (v).begin(),(v).end()
#define Pr(type) priority_queue<type>
#define gPr(type) priority_queue<type,vector<type>,greater<type>>
#define V(type) vector<type>
#define rep(i,n) for(int i=0; i<n; i++)
#define rer(i,st,en) for(int i=st; i<en; i++)
#define gnr(i,l,r) for(int i=int(r); i>=int(l); i--)
#define eb emplace_back
#define pri1(a) cout<<(a)<<'\n'
#define pri2(a,n) rep(i,n-1)cout<<a[i]<<' '; cout<<a[n-1]<<'\n'
#define prip(p) cout<<p.first<<' '<<p.second<<'\n'
template<class T> inline bool cmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool cmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int n,m,_,x,y,q;
string s,sb;
bool ok1,ok2;
char ch;


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

  cin>>n; int a[n]; Int mi[n+1],ma[n+1]; mi[n]=ma[n]=2;
  rep(i,n)cin>>a[i];
  ok1=ok2=true;
  gnr(i,0,n-1){
    mi[i]=ceil((double)mi[i+1]/a[i])*a[i];
    ma[i]=(floor((double)ma[i+1]/a[i])+1)*a[i]-1;
    if(mi[i]>ma[i]){pri1(-1); return 0;}
  }
  cout<<mi[0]<<' '<<ma[0]<<'\n';
}

Measured memory_bytes: 2176
#if 0
2019.12.08

不妨设 n > 1 。

如果所有 a[i] 都是奇数，那么先手操作后会有一个偶数，约分后仍然有唯一偶数，
此时后手一定可以对唯一偶数操作，所有数成为奇数，约分后同样如此，
直到所有数都为 1 ，仍然没有偶数，那么当 a[i] 全是奇数时先手必败。

更一般的，假设 n 足够大奇数足够多，如果有偶数个偶数，
先手操作后有奇数个偶数，后手一定可以对偶数操作使得状态还原至奇数个偶数，
也就是说有奇数个偶数时先手必胜，反之先手必败。

特别的是，如果有偶数个偶数且奇数唯一且该奇数大于 1 ，
此时先手对唯一奇数操作后，所有数都是偶数，
此时一定可以约分，并且约分后的结果是难以推断的。
由于这种情况一定可以约分，那么所有数至少缩小一半，也就是最多进行 O(logn) 次，
每次碰到这种情况暴力约分即可，直到转为上述可以直接判断的情况。
#endif
#include <cstdio>
#include <algorithm>
#define debug(...) fprintf(stderr, __VA_ARGS__)

typedef long long ll;

struct {
	inline operator int () { int x; return scanf("%d", &x), x; }
	inline operator ll () { ll x; return scanf("%lld", &x), x; }
	template<class T> inline void operator () (T &x) { x = *this; }
	template<class T, class ...A> inline void operator () (T &x, A &...a)
	{ x = *this; this -> operator ()(a...); }
} read;

const int maxn = 100005;
int a[maxn];

bool game(int n) {
	if(n == 1) return a[1] > 1;

	int even = 0;
	for(int i = 1; i <= n; i ++)
		if(!(a[i] & 1))
			++ even;

	if(even & 1) return 1;
	if(even != n - 1) return 0;

	for(int i = 1; i <= n; i ++)
		if(a[i] & 1) {
			if(a[i] == 1) return 0;
			-- a[i];
		}

	int gcd = a[1];
	for(int i = 2; i <= n; i ++)
		gcd = std::__gcd(gcd, a[i]);

	for(int i = 1; i <= n; i ++)
		a[i] /= gcd;

	return !game(n);
}

int main() {
	int n = read;

	for(int i = 1; i <= n; i ++)
		read(a[i]);

	puts(game(n) ? "First" : "Second");
}


Measured memory_bytes: 640
import collections
N, M = map(int, input().split())
x = [[0, 0] for i in range(N)]
y = [[0, 0] for i in range(N)]
z = [[0, 0] for i in range(N)]
xyz = [list(map(int, input().split())) for i in range(N)]
for i in range(N):
    x[i][0], y[i][0], z[i][0] = xyz[i][0], xyz[i][1], xyz[i][2]
    x[i][1], y[i][1], z[i][1] = i, i, i

ans = 0
for k in range(2**3):
    flag = [1, 1, 1]
    tmp = [0, 0, 0]
    for l in range(3):
        if (k >> l) % 2 == 1:
            flag[l] = -1
        else:
            flag[l] = 1
    # print(flag)
    xyz.sort(reverse=True, key=lambda x: x[0]
             * flag[0] + x[1]*flag[1] + x[2]*flag[2])

    for i in range(M):
        tmp[0] += xyz[i][0]
        tmp[1] += xyz[i][1]
        tmp[2] += xyz[i][2]
    # print(abs(tmp[0]) + abs(tmp[1]) + abs(tmp[2]))
    # print(xyz)
    ans = max(ans, abs(tmp[0]) + abs(tmp[1]) + abs(tmp[2]))
print(ans)


Measured memory_bytes: 3948
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,a,b) for(int i=a;i<b;i++)
#define each(it,v) for(auto it : v)
#define mod 1000000007
#define all(v) (v).begin(),(v).end()
#define ll long long
#define vi vector<int>
#define vll vector<ll>
#define vpii vector<pair<int,int>>
#define vv vector<vector<int>>
using namespace std;

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

    ll ans=1;
    rep(i,n)
    {
        ans=(ans*(i+1))%mod;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
int main(){
    string s, r; cin >> s;
    for(int i = 0; i < s.size(); i++) {
        if(s[i] != 'B') r.push_back(s[i]);
        else if(!r.empty()) r.pop_back();
    }
    cout << r;
}

Measured memory_bytes: 256
#include <stdio.h>
#define ABS(a) ((a)>(0)?(a):-(a))
long long min(long long a, long long b){ return a > b ? b : a; }

long long rec(long long i, long long *H, long long K, long long *memo){
    if (i == 0)  return memo[0] = 0; 
    if (i - 2 < 0) return memo[1] = ABS(H[i - 1] - H[i]);
    if (memo[i] != -1) return memo[i];
    long long ret = 100000000000;
    for (int j = K; 1 <= j; j--) {
        //rec(i)は i - j 番目の のカエルから飛んでくるものの内最小値
        if(i - j < 0) continue;
        ret =  min( rec(i - j,H,K,memo) + ABS(H[i - j] - H[i]),ret);
        //printf("%lld %lld\n", i - j, i);
    }
    return memo[i] = ret;
}

int main(void){
    long long N,K;
    long long H[100000];
    long long memo[100000];
    scanf("%lld %lld", &N, &K);
    for (long long  i = 0; i < N; i++) memo[i] = -1;
    for (long long i = 0; i < N; i++) scanf("%lld", &H[i]);
    long long ans = rec(N - 1,H, K, memo);
    printf("%lld\n",ans);
    return 0;
}


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

// isDebug?
#ifndef ONLINE_JUDGE
#define _DEBUG
#endif

// Function Macros:
#define rep(i, n) for(int(i) = 0; (i) < (n); (i)++)
#define all(v) (v).begin(), (v).end()
#define setpre(n) cout << fixed << setprecision(n)

// -* https://xn--kst.jp/blog/2019/08/29/cpp-comp/ *- Thx :)
// debug methods
// usage: debug(x,y);
#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0, a1, a2, a3, a4, x, ...) x
#define debug_1(x1) cout << #x1 << ": " << x1 << endl
#define debug_2(x1, x2) cout << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << endl
#define debug_3(x1, x2, x3) cout << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " << x3 << endl
#define debug_4(x1, x2, x3, x4) cout << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " << x3 << ", " #x4 << ": " << x4 << endl
#define debug_5(x1, x2, x3, x4, x5) cout << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " << x3 << ", " #x4 << ": " << x4 << ", " #x5 << ": " << x5 << endl
#ifdef _DEBUG
#define debug(...)                                                        \
    cout << __FILE__ << ": " << __LINE__ << ": " << __func__ << " -> ";   \
    CHOOSE((__VA_ARGS__, debug_5, debug_4, debug_3, debug_2, debug_1, ~)) \
    (__VA_ARGS__)
#else
#define debug(...)
#endif

// namespace / type / class / struct - alias, def:
using namespace std;

using ll = long long;
using ull = unsigned long long;

// Constants:
const int INF = (1ll << 30) - 1;  // approx 1.07e9
const ll INFLL = 1ll << 60;       // approx 1.15e18
const int MOD = 1e9 + 7;          // 998244353
const long double EPS = 1.0e-14;
const int FACN = 510000;

// Global Variables:
// ll fac[FACN], finv[FACN], inv[FACN];

// Prototype Declarations:
int gcd(int, int);
int lcm(int, int);
template <class T>
inline bool chmin(T&, T);
template <class T>
inline bool chmax(T&, T);

// ================ Main Loop ================
int main() {
    string s, t;
    cin >> s >> t;

    int diff = 0, ans = INF;
    rep(i, s.size() - t.size() + 1) {
        diff = 0;
        rep(j, t.size()) {
            if(s[i + j] != t[j]) {
                ++diff;
            }
        }
        chmin(ans, diff);
    }
    cout << ans << endl;
    return 0;
}
// ===========================================

// Functions:
// 最大公約数 O(log(min(a, b)))
int gcd(int a, int b) {
    return b ? gcd(b, a % b) : a;
}
// 最小公倍数 O(log(min(a, b)))
int lcm(int a, int b) {
    return a * b / gcd(a, b);
}

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


Measured memory_bytes: 3624
#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define bg begin()
#define ed end()
#define rbg rbegin()
#define red rend()
#define all(x) x.bg,x.ed
#define rall(x) x.rbg,x.red
#define pb push_back
#define pf push_front
#define eb emplace_back
using namespace std;
typedef long long ll;
template<class t,class u> bool chmax(t&a,u b){if(a<b){a=b; return true;} return false;}
template<class t,class u> bool chmin(t&a,u b){if(a>b){a=b; return true;} return false;}
template<class t,class u> t MAX(t a,u b){if(a>=b) return a; return b;}
template<class t,class u> t MIN(t a,u b){if(a<=b) return a; return b;}
template<class t> int SIZE(t s){return (int)s.size();}
template<class t> using vc=vector<t>;
template<class t> using vvc=vc<vc<t>>;
using vvi=vc<vc<int>>;
using pi=pair<int,int>;
using vi=vc<int>;
void yes(){ cout << "Yes" << endl; }
void no(){ cout << "No" << endl; }
const long long INF = 1LL << 60;

int main(){
    cout << fixed << setprecision(20);
    int k,x; cin >> k >> x;
    rng(i,x-k+1,x+k) cout << i << " ";
    cout << endl;
    return 0;
}


Measured memory_bytes: 256