akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <iostream>
#include <cstring>

using namespace std;
typedef long long ll;

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

int main(){
	int n=getint(); int sum=0;
	for(int i=1;i<=n;i++){
		int x=getint(); if(x&1) sum++;
	} 
	if(n==1||sum&1) cout<<"NO"<<endl; 
	else cout<<"YES"<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/rope>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#define int long long
#define pb push_back
#define x first
#define y second
#define mk(a,b) make_pair(a,b)
#define rr return 0
#define sqr(a) ((a)*(a))
#define all(a) (a).begin(), (a).end()
#define sz(a) (int)(a).size()

using namespace std;
using namespace __gnu_cxx;
using namespace __gnu_pbds;

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

template<class value, class cmp = less<value> >
using ordered_set = tree<value, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
template<class value, class cmp = less_equal<value> >
using ordered_multiset = tree<value, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
template<class key, class value, class cmp = less<key> >
using ordered_map = tree<key, value, cmp, rb_tree_tag, tree_order_statistics_node_update>;

/// find_by_order()
/// order_of_key()
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
inline int randll(int l = INT_MIN, int r = INT_MAX) {
    return uniform_int_distribution<int>(l, r)(rng);
}
const int INF = 1e9, MOD = 1e9 + 7; /// think
const ll LINF = 1e18;


const int dx[] = {0, 0, 1, -1}, dy[] = {1, -1, 0, 0};
inline bool inside (int x, int y, int n, int m) {
    return 0 <= x && 0 <= y && x < n && y < m;
}

template<class T> bool umin (T &a, T b) {return a > b ? (a = b, true) : false; }
template<class T> bool umax (T &a, T b) {return a < b ? (a = b, true) : false; }

const int N = 1e5 + 11;
ll dp[N][3] = {};
int a[N][3] = {};
main()
{
    ios::sync_with_stdio(0);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> a[i][0] >> a[i][1] >> a[i][2];
    }
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < 3; j++) {
            for (int k = 0; k < 3; k++) {
                if (j == k) continue;
                umax(dp[i + 1][k], dp[i][j] + a[i][k]);
            }
        }
    }
    cout << max({dp[n][0], dp[n][1], dp[n][2]}) << '\n';
}


Measured memory_bytes: 7056
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<=(b);++i)
#define mem(a,x) memset(a,x,sizeof(a))
#define pb push_back
#define pi pair<int, int>
#define mk make_pair
using namespace std;
typedef long long ll;
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
const int N=12;
char s[N];
int n;
int main()
{
	n=6;
	cin>>s+1;
	int flag=0;
	if(s[3]==s[4]&&s[5]==s[6]) flag=1;
	if(flag) puts("Yes");
	else puts("No");
}


Measured memory_bytes: 256
def main():
    H, W, K = list(map(int, input().split()))
    S = []

    for i in range(H):
        s = input()
        S.append(s)

    ans = []
    for i in range(H):
        tmp = []
        ans.append(['.'] * W)

    # non_rows = []
    k = 1
    for i in range(H):
        row = S[i]
        k_c = row.count('#')
        if k_c == 0:
            # non_rows.append(i)
            pass
        else:
            new_row = []
            flag = True
            for si in row:
                if flag:
                    if si == '#':
                        new_row.append(str(k))
                        flag = False
                    elif si == '.':
                        new_row.append(str(k))
                else:
                    if si == '.':
                        new_row.append(str(k))
                    elif si == '#':
                        k += 1
                        new_row.append(str(k))
            flag = True
            k += 1
            ans[i] = new_row
    

    for i in range(1, H):
        if ans[i][0] == '.':
            ans[i] = ans[i-1]

    for i in range(H-1, -1, -1):
        if ans[i][0] == '.':
            ans[i] = ans[i+1]

    for ans1 in ans:
        print(" ".join(ans1))

if __name__ == "__main__":
    main()


Measured memory_bytes: 9332
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#pragma comment(linker, "/STACK:1024000000")
#pragma warning( disable : 6031)
#pragma warning( disable : 4244)
#pragma warning( disable : 26451)
#ifdef _MSC_VER
#  include <intrin.h>
#  define __builtin_popcount __popcnt
#  define __builtin_popcountll __popcnt64
#endif
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <cstdint>
#include <climits>
#include <cassert>
#include <string>
#include <vector>
#include <iostream>
#include <map>
#include <stack>
#include <set>
#include <queue>
#include <numeric>
#include <algorithm>
#include <utility>
#include <bitset>
#include <cmath>
#include <sstream>
#include <functional>
#include <iomanip>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <chrono>

#define all(a) (a).begin(),(a).end()
#define sz(a) (int)(a).size()
#define eps (1e-15)

using namespace std;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef long long ll;
typedef vector<int> vi;
typedef vector< vi > vvi;
typedef vector<double> vd;
typedef vector< vd > vvd;
typedef vector< string > vs;
typedef pair< int, int > pii;
typedef vector< pii > vpii;
typedef vector<ll> vl;
typedef vector<vector<long long>> vvl;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef tuple<int, int, int> tiii;
const long long mod = int(1e9) + 7;
const int INF = 1e9;
const ll LINF = 1e18;


ll is_square(ll a)
{
	for (ll i = sqrt(a) - 5; i * i <= a; i++)
		if (i * i == a)
			return i;
	return -1;
}

ll gcd(ll a, ll b)
{
	return b == 0 ? a : gcd(b, a % b);
}

int main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); cout << setprecision(18) << fixed;
#ifdef LOCAL_MACHINE
	freopen("input.txt", "rt", stdin);
	freopen("output.txt", "wt", stdout);
#endif
	ll a, b, c;
	cin >> a >> b >> c;
	ll d = c - a - b;
	if (d > 0 && d * d > 4 * a * b)
	{
		cout << "Yes";
	}
	else
	{
		cout << "No";
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <functional>
#include <numeric>
#include <list>
#include <set>
#include <map>
#include <algorithm>
#include <cmath>
#include <limits>
#include <iomanip>
#include <bitset>
#include <queue>
#include <unordered_set>

using namespace std;
typedef long long ll;

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
#define rep(i, n) for(int i = 0;i < n;i++)
const int INF = 1LL << 30;

int MOD = 1000000007;

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

    int n,k; cin >> n >> k;
    string s; cin >> s;
    string s_;

    int score = 0;

    rep(i,n){
        if(i==0){ s_+= s[i]; continue;}
        if(s[i]==s[i-1]) score ++;
        else s_+=s[i];
    }

    if(s_ == "RL" || s_ == "LR"){
        cout << n-1 << endl;
        return 0;
    }

    if(s_ == "R" || s_ == "L"){
        cout << n-1 << endl;
        return 0;
    }

    int j = 1;
    while(j<s_.length()){
        if(s_[j] != s_[0] && k>0){
            score+=2;
            k--;
            if(j==s_.length()-1) score-=1;
        }
        j++;
    }

    cout << score << endl;
    //cout << s_ << endl;

    return 0;
}

Measured memory_bytes: 592
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string a,b;
    cin>>a>>b;
    if(a[0]==b[2]&&a[1]==b[1]&&a[2]==b[0])
    {
        cout<<"YES";
    }

    else
    {
        cout<<"NO";
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
int main()
{
    int n;
    cin >> n;
    vector<ll> a(n);
    for(int i = 0; i < n; i++) cin >> a[i];
    sort(a.begin(), a.end());
    reverse(a.begin(), a.end());
    ll ans = a[0];
    int count = 2;
    for(int i = 1; i < n; i++)
    {
        if(count == n) break;
        ans += a[i];
        count++;
        if(count == n) break;
        ans += a[i];
        count++;
    }
    cout << ans << endl;
}



Measured memory_bytes: 4812
#include <bits/stdc++.h>
using namespace std;
#define m_p make_pair
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define fi first
#define se second
typedef long long ll;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
mt19937 rnf(2106);
const int N = 3003, M = 998244353;

int n0, m0, n, m;

int dp[N][N];

void solv()
{
    scanf("%d%d%d%d", &n0, &m0, &n, &m);
    for (int i = 1; i <= n; ++i)
    {
        for (int j = 1; j <= m; ++j)
        {
            if (i == n0 && j == m0)
            {
                dp[i][j] = 1;
                continue;
            }
            dp[i][j] = ((dp[i - 1][j] * 1LL * j) % M + (dp[i][j - 1] * 1LL * i) % M) % M;
            dp[i][j] = (dp[i][j] - (dp[i - 1][j - 1] * 1LL * (i - 1) * (j - 1)) % M + M) % M;
        }
    }
    printf("%d\n", dp[n][m]);
}

int main()
{
    #ifdef SOMETHING
    freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    #endif // SOMETHING
    //ios_base::sync_with_stdio(false), cin.tie(0);
    solv();
    return 0;
}

//while ((double)clock() / CLOCKS_PER_SEC <= 0.9){}


Measured memory_bytes: 39008
N=int(input())
M=0
A=list(map(int,input().split()))
B=list(map(int,input().split()))
for i in range(N):
  if B[i]<=A[i]:
    M+=B[i]
  else:
    n=B[i]-A[i]
    M+=A[i]
    if n<=A[i+1]:
      M+=n
      A[i+1]-=n
    else:
      M+=A[i+1]
      A[i+1]=0
print(M)
    

Measured memory_bytes: 18476
#include<iostream>
#include<vector>
using namespace std;
#define int long long
#define V vector
#define vel V<int>
#define rep(i,n) for(int i=0;i<n;i++)
#define mkp make_pair
#define pin pair<int,int>
pin solve(V<pin>& ab, int ex) {
	if (!ex) { return mkp(1, 0); }
	V<V<pin>> qab(2);
	for (pin x : ab) {
		qab[x.second & 1].push_back(mkp(x.first / 2, x.second / 2));
		if (x.first & 1) { qab[(x.second + 1) & 1].push_back(mkp(x.first / 2, (x.second + 1) / 2)); }
	}
	V<vel> c(4, vel(3)); c[3] = vel(3, 1);
	rep(i, 2) {
		for (pin x : qab[i]) {
			int qc = (2 * x.first + x.second) % 3;
			c[i][qc] ^= 1;
		}
	}
	rep(i, 2) {
		if (c[1 - i] == c[3] || c[1 - i] == c[2]) {
			pin ans = solve(qab[i], ex - 1);
			ans.first *= 2; ans.second *= 2; ans.second += i;
			return ans;
		}
	}
	for (pin& v : ab) { v.first++; }
	pin ans = solve(ab, ex); ans.first--;
	return ans;
}
signed main() {
	long long inf = 2e17;
	int n; cin >> n;
	V<pin> ab(n);
	rep(i, n) {
		long long a, b; cin >> a >> b;
		ab[i] = { a + inf,b + inf };
	}
	pin ret = solve(ab, 70);
	cout << ret.first - inf << " " << ret.second - inf << "\n";
}


Measured memory_bytes: 11860
#include<bits/stdc++.h>
using namespace std;
long long t1, t2, a1, a2, b1, b2;
void inf(){
    cout << "infinity\n";
    exit(0);
}


int brute(long long gain){
    long long x1 = 0;
    long long x2 = 0;
    int ans = 0;
    int prev = 0;
    while(x2 - x1 <= gain){
        x1 += a1 * t1;
        x2 += a2 * t1;
        if(prev == 1 && x1 > x2) ans++;
        if(x1 > x2) prev = 2;
        else prev = 1;
        if(x1 == x2) cout << "AHAA", prev = 0;
        x1 += b1 * t2;
        x2 += b2 * t2;
        assert(x2 != x1);
        if(prev == 2 && x2 > x1) ans++;
        if(x1 > x2) prev = 2;
        else prev = 1;
    }
    return ans;
}
int main(){
	ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    cin >> t1 >> t2 >> a1 >> b1 >> a2 >> b2;
    if(a1 < a2){
        swap(a1,a2);
        swap(b1,b2);
    }
    if(b1 > b2) {
        cout << 0 << '\n';
        return 0;
    }
    long long gain = (a1 - a2) * t1;
    long long diff = (a1 - a2) * t1 + (b1 - b2) * t2;
    if(diff == 0) inf();
    if(diff > 0) {
        cout << 0 << '\n';
        return 0;
    }
    diff *= -1LL;
    long long need = (long long)ceil((double)gain / (double)diff);
    cout << 2LL * need - 1  + ((gain % diff) == 0) << '\n';

    return 0;
}


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

#define NREP() for(ll i = 0; i < n; i++)
#define REP(i, n) for(ll i = 0; i < n; i++)
#define ALL(x) (x).begin(), (x).end()
#define MSG(x) cout << x << endl;
#define YN(x) x ? cout << "YES" << endl : cout << "NO" << endl;
#define Yn(x) x ? cout << "Yes" << endl : cout << "No" << endl;
#define yn(x) x ? cout << "yes" << endl : cout << "no" << endl;

using namespace std;
using ll = long long;
const static ll MOD = 1e9 + 7;

int main(int argc, char *argv[]) {
    char c;
    cin >> c;
    MSG((char) (int(c) + 1))
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
using namespace std;
typedef long long ll;
int INF = (1LL << 30) - 1;
int MOD = 1e9+7;
main(){
    int N,A;
    cin >> A >> N;
    int sum = 0;
    rep(i,0,N){
        int x;
        cin >> x;
        sum += x;
    }
    if(sum >= A){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}

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

void push(int);
int pop(void);

int stack[1000],top;

int main(){
  
  int x,y;
  char a[100];

  top=0;

  while(scanf("%s",a)!=EOF){
    if(a[0]=='+'){
      x=pop();
      y=pop();
      push(x+y);
    }

    else if(a[0]=='-'){
      y=pop();
      x=pop();
      push(x-y);
    }

    else if(a[0]=='*'){
      x=pop();
      y=pop();
      push(x*y);
    }

    else push(atoi(a));
  }

  printf("%d\n",pop());

  
    return 0;
}
  


    void push(int c){
      stack[++top]=c;
    }

    int pop (){
      top--;
      return stack[top+1];
    }
	



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

int main() {
    int r, d, x;
    cin >> r >> d >> x;
    vector<int> xx(11, x);
    for (int i = 0; i < 10; i++) {
        xx[i + 1] = r * xx[i] - d;
        cout << xx[i + 1] << endl;
    }
}

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

int main() {
  string S;
  cin >> S;
  int x = 0;
  for(int i =0;i <3;i++){
    if(S.at(i) == 'o')
      x++;
  }
  cout << 700+x*100 << endl;

}

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

#define ll long long 
using namespace std;

char lcs[3001];

void print_lcs(ll dp[][3001],ll i,ll j,char *s1,char *s2,ll l){
	if(i==0 || j==0)
		return ;
	if(s1[i]==s2[j]){
		lcs[l--]=s1[i];
		print_lcs(dp,i-1,j-1,s1,s2,l);}
	else{
		if(dp[i][j]==dp[i-1][j])
			print_lcs(dp,i-1,j,s1,s2,l);
		else print_lcs(dp,i,j-1,s1,s2,l);}}
	






main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	string str1,str2;
	map<ll,ll> mp;
	multimap<ll,ll>mp1;
	ll test,n,w,i,j,area,flag=0,a1[100],d=0,m=INT_MAX,amt,r,a2[100],x,y,k,K,I,m1,m2,m3,o,o1,o2,o3,dp[3001][3001];
	char s2[3001],s1[3001];
	cin>>str1>>str2;
	
	n=str1.length();
	m=str2.length();
	for(i=1;i<=n;++i)
		s1[i]=str1[i-1];
	for(i=1;i<=m;++i)
		s2[i]=str2[i-1];
	
	
	
	for(i=0;i<=m;++i)
		dp[0][i]=0;
	for(i=0;i<=n;++i)
		dp[i][0]=0;
	for(i=1;i<=n;++i){
		for(j=1;j<=m;++j){
			if(s1[i]==s2[j])
				dp[i][j]=1+dp[i-1][j-1];
			else
				dp[i][j]=max(dp[i-1][j],dp[i][j-1]);}}
	
	
	
	print_lcs(dp,n,m,s1,s2,dp[n][m]);
	
	for(i=1;i<=dp[n][m];++i)
		cout<<lcs[i];
	cout<<endl;
	
	
	}
		
	





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

#define rep(i,n) for(int i=0;i<n;i++)
#define repa(i,a,n) for(int i=a;i<=n;i++)
#define repb(i,a,n) for(int i=a;i>=n;i--)
#define trav(a,x) for(auto a=x.begin();a!=x.end();a++)
#define all(x) x.begin(),x.end()
#define fst first
#define snd second
#define pb push_back
#define mp make_pair
typedef long double ld;
typedef pair <int,int> pii;
typedef vector <int> vi;
typedef long long ll;

void pre(){

}

void solve(){
  int l,r,d; cin>>l>>r>>d;

  int ans=0;

  for(int i=l;i<=r;i++){
    if(i%d==0) ans++;
  }

  cout<<ans<<"\n";
}

int main(){
  ios_base::sync_with_stdio(0); cin.tie(0);
  pre();
  int t; t=1;
  rep(i,t) solve();
  return 0;
}

/* Cherry, Please look at the stuff down */

/* 1) Did you checked special case (n==1)?
   2) Look at the code once, check whether there are some typos
   3) Cherry! Is contest over ??
   4) Do something instead of doing notthing
*/


Measured memory_bytes: 3632
#include <vector>
#include <cstdio>
#include <cstring>
#include <queue>
#include <cctype>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <bitset>
#include <map>
#include <complex>
#include <ctime>
#include <numeric>
#include <set>

using namespace std;

typedef long long ll;

typedef struct node{
    int s, e, val, pos;
    bool operator<(const node& n) const{
        if(e != n.e) return e < n.e;
        return val > n.val;
    }
    node(){};
    node(int ss, int ee, int v, int p){
        s = ss, e = ee, val = v, pos = p;
    }
}node;

int occs[(int)1e6 + 5], tree[500005], n, ans[500005];

void update(int x, int val){
    while(x <= n){
        tree[x] += val;
        x += x & -x;
    }
}

int query(int x){
    int ret = 0;
    while(x > 0){
        ret += tree[x];
        x -= x & -x;
    }
    return ret;
}

int main()
{
    int q, s, e;
    vector<node> v;
    scanf("%d", &n);
    scanf("%d", &q);
    for(int i = 1; i <= n; i++){
        scanf("%d", &s);
        v.push_back(node(i, i, s, -1));
    }
    
    for(int i = 0; i < q; i++){
        scanf("%d %d", &s, &e);
        v.push_back(node(s, e, 0, i));
    }
    
    sort(v.begin(), v.end());
    
    for(int i = 0;i < v.size(); i++){
        if(v[i].val == 0){
            ans[v[i].pos] = query(v[i].e) - query(v[i].s - 1);
        }else{
            if(occs[v[i].val] != 0) update(occs[v[i].val], -1);
            update(v[i].s, 1);
            occs[v[i].val] = v[i].s;
        }
    }
    
    for(int i = 0; i < q; i++){
        printf("%d\n", ans[i]);
    }
    
    return 0;
}



Measured memory_bytes: 25380
#include "bits/stdc++.h"
using namespace std;

#define say(obj) (cout << (obj) << endl)
#define endline (cout << endl)
#define all(container) (container).begin(), (container).end()
#define sortall(container) (sort((container).begin(), (container).end()))
#define yn(cond) ((cond) ? (cout << "yes" << endl) : (cout << "no" << endl))
#define Yn(cond) ((cond) ? (cout << "Yes" << endl) : (cout << "No" << endl))
#define YN(cond) ((cond) ? (cout << "YES" << endl) : (cout << "NO" << endl))

typedef long long       ll;

typedef vector<int>     vi;
typedef vector<ll>      vll;
typedef vector<double>  vd;
typedef vector<bool>    vb;
typedef vector<char>    vc;
typedef vector<string>  vs;
typedef pair<int, int>  pii;
typedef pair<ll, ll>    pll;
typedef vector<vi>		vvi;
typedef vector<vll>		vvll;
typedef vector<vd>		vvd;
typedef vector<vb>		vvb;
typedef vector<vc>		vvc;
typedef vector<vs>		vvs;
typedef vector<pii>     vpii;
typedef vector<pll>     vpll;

typedef struct edge_ {
	ll to, cost;
	edge_(ll to, ll cost) : to(to), cost(cost) {}
} edge;

typedef struct point_ {
	ll x, y;
	point_(ll x = 0, ll y = 0) : x(x), y(y) {}
} point;

template <typename T>
using mat2d = vector<vector<T>>;

constexpr double	PI = 3.14159265358979323846;
constexpr int		INF = (int)1e7;
constexpr ll		MOD = (ll)1e9 + 7;
constexpr double	EPS = 1e-7;
constexpr int		dy4[4] = { 0, 1, 0, -1 };
constexpr int		dx4[4] = { 1, 0, -1, 0 };
constexpr int		dy8[8] = { 0, 1, 1, 1, 0, -1, -1, -1 };
constexpr int		dx8[8] = { 1, 1, 0, -1, -1, -1, 0, 1 };

template <typename T>
T getSum(std::vector<T>& v) {
	T ret = 0;
	for (T& x : v) ret += x;
	return ret;
}

template <typename T>
istream& operator >> (istream& is, vector<T>& vec) { for (T& x : vec) is >> x;  return is; }
template <typename S, typename T>
istream& operator >> (istream& is, pair<S, T>& p) { is >> p.first >> p.second; return is; }
istream& operator >> (istream& is, point& p) { is >> p.x >> p.y;          return is; }

template <typename T>
ostream& operator << (ostream& os, const vector<T>& vec) { for (const T& x : vec) os << x << " "; return os; }
template <typename T>
ostream& operator << (ostream& os, const vector<vector<T>>& mat) { for (const vector<T>& m : mat) os << m << endl; return os; }
template <typename S, typename T>
ostream& operator << (ostream& os, const pair<S, T>& p) { os << "{" << p.first << " : " << p.second << "}"; return os; }
template <typename T>
ostream& operator << (ostream& os, const set<T>& s) { for (const T& x : s) os << x << " "; return os; }
ostream& operator << (ostream& os, const edge e) { os << "{to: " << e.to << ", cost: " << e.cost << "}"; return os; }
ostream& operator << (ostream& os, const point& p) { os << "(" << p.x << " " << p.y << ")"; return os; }

/******************************************************************************/
/**********************         Don't make WA !!         **********************/
/******************************************************************************/

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

	if (A == B)
		say(A + B);
	else {
		int ma = max(A, B);
		say(ma + ma - 1);
	}

	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(void){
    string s,t;
    cin>>s>>t;
    int count=0;
    for(int i=0;i<3;i++){
        if(s[i]==t[i]){
            count++;
        }
    }
    cout <<count<<endl;
    return 0;
}

Measured memory_bytes: 256
import sys
from collections import defaultdict

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
printV = lambda x: print(*x, sep="\n")
printH = lambda x: print(" ".join(map(str,x)))
def IS(): return sys.stdin.readline()[:-1]
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LII(rows_number): return [II() for _ in range(rows_number)]
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]
mo = 10**9+7

def main():
	s =II()
	dic = defaultdict(lambda : False)
	idx = 1
	while(True):
		if idx!=1:
			if s%2==0:
				s/=2
			else:
				s=3*s+1
		if dic[s]:
			print(idx)
			exit()
		else:
			dic[s]=True
		idx+=1


if __name__ == '__main__':
	main()

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

bool is_prime(long long n) {
    if(n <= 1){
        return false;
    }
    for(long long i=2LL; i*i<=n; i++){
        if(n%i==0){
            return false;
        }
    }
    return true;
}

int main(){
    long long x;
    cin >> x;
    long long i = x;
    while(true){
        if(is_prime(i)){
            cout << i << endl;
            break;
        }
        i++;
    }

    return 0;
}

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

const int MaxN = 1e5;
using namespace std;

char a[4][4];

int main()
{
	for(int i = 1;i <= 3;i++){
		for(int j = 1;j <= 3;j++){
			scanf(" %c",&a[i][j]);
		}
	}
	cout << a[1][1] << a[2][2] << a[3][3] <<endl;
	return 0;
}


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

using ll = long long int;

const int MAX = (int)(1e5 + 5);
const ll INF = (ll)(1e10 + 5);

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

ll n;

ll ans;

int main(void) {
  // Here your code !
  scanf("%lld", &n);

  ll base = 1;
  for (ll i = 1; i <= n; ++i) {
    base *= i;
    base %= MOD;
  }

  ans = base;

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

  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		int a[][] = new int[N][N];
		for (int i=0;i<M;i++) {
			int n,m;
			n= sc.nextInt();
			m= sc.nextInt();
			a[n-1][m-1] = 1;
			a[m-1][n-1] = 1;
		}
		boolean isExist = true;
		int result=0;
		while(isExist) {
			isExist = false;
			for (int i=0;i<N;i++) {
				int count =0;
				for (int j=0;j<N;j++) {
					if (a[i][j]==1) {
						count ++;
					}
				}
				if (count ==1) {
					result++;
					isExist = true;
					for (int j=0;j<N;j++) {
						a[i][j] =0;
						a[j][i] =0;
					}
				}
			}
		}
		System.out.println(result);
	}
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
#define ll long long
#define ff first
#define ss second
#define PB push_back
#define MP make_pair
#define mod 1000000007
#define all(x) x.begin(),x.end()
#define deb(x) cout<<#x<<" "<<x<<endl;

using namespace std;

void run(){
ll d,t,s;
cin>>d>>t>>s;
if(d<=t*s)cout<<"Yes";
else cout<<"No";
}

int main() {
	int t=1;
	//cin>>t;
	for(ll i=0;i<t;i++){
	run();
	}
	// your code goes here
	return 0;
}

Measured memory_bytes: 3624
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <map>
using namespace std;
typedef long long ll;
#define rep(i,n) for (int i=0;i < (int)(n);i++)

int main(){
   string s,t;
   s="CODEFESTIVAL2016";
   cin >> t;
   int ans=0;
   rep(i,16){
     if (s[i]!=t[i]) ans++;
   }
   cout << ans << endl;
  
  return 0;
}



Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;

namespace C
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = Convert.ToInt32(Console.ReadLine());
            string[] S = new string[N];
            for (var i = 0; i < N; i++)
            {
                char[] c = Console.ReadLine().ToCharArray();
                Array.Sort(c);
                S[i] = new string(c);
            }

            Dictionary<string, long> dict = new Dictionary<string, long>();
            for (var i = 0; i < N; i++)
            {
                if (dict.ContainsKey(S[i]))
                {
                    dict[S[i]]++;
                }
                else
                {
                    dict[S[i]] = 1L;
                }
            }
            long res = 0L;
            foreach (var i in dict)
            {
                if (i.Value > 1)
                {
                    res += i.Value * (i.Value - 1) / 2;
                }
            }
            Console.WriteLine(res);
        }
    }
}


Measured memory_bytes: 26964
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <unordered_set>
#include <cmath>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;

int main(){
  int N,K;
  int r;
  string s;
  cin >> r;
  cout << pow(r, 2) << endl;
  return 0;
}

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

int main() {
    ll N;
    cin >> N;
    vector<ll> X(N),OrigiNal(N);
    for(int i=0;i<N;i++){
        cin >> X[i];
        OrigiNal[i] = X[i]; 
    }
    sort(X.begin(),X.end());
    for(int i=0;i<N;i++){
        int t= lower_bound(X.begin(),X.end(),OrigiNal[i]) - X.begin();
        // cerr <<"t="<<t << endl;
        if(t<(N/2)){
            cout << X[(N/2)] << endl;
        }else{
            cout << X[(N/2)-1] <<endl;
        }
    }


    return 0;
}

Measured memory_bytes: 5376
import sys
sys.setrecursionlimit(1000000000)
import math
from fractions import gcd
def lcm(a, b): return a * b // gcd(a, b)
from itertools import count, permutations
from functools import lru_cache
from collections import deque, defaultdict
from pprint import pprint
ii = lambda: int(input())
mis = lambda: map(int, input().split())
lmis = lambda: list(mis())
INF = float('inf')
N1097 = 10**9 + 7

def meg(f, ok, ng):
    while abs(ok-ng)>1:
        mid = (ok+ng)//2
        if f(mid):
            ok=mid
        else:
            ng=mid
    return ok

def get_inv(n, modp):
    return pow(n, modp-2, modp)

def factorials_list(n, modp):    # 10**6
    fs = [1]
    for i in range(1, n+1):
        fs.append(fs[-1] * i % modp)
    return fs

def invs_list(n, fs, modp):     # 10**6
    invs = [get_inv(fs[-1], modp)]
    for i in range(n, 1-1, -1):
        invs.append(invs[-1] * i % modp)
    invs.reverse()
    return invs

def comb(n, k, modp):
    vn = vk = vn_k = 1
    for i in range(1, n+1):
        vn = vn * i % modp
        if i == k:
            vk = vn
        if i == n-k:
            vn_k = vn
    return vn * get_inv(vk, modp) * get_inv(vn_k, modp) % modp

def comb_from_list(n, k, modp, fs, invs):   
    return fs[n] * invs[n-k] * invs[k] % modp

#

def main():
    N=ii()
    import numpy as np
    X = np.array(lmis())
    ans = INF
    for i in range(1, 100+1):
        ans = min(ans, np.sum((X-i)**2))
    print(ans)

main()







Measured memory_bytes: 22784
#include <math.h>
#include <iostream>
#include <vector>
#include <algorithm>

int main(void) {
	using namespace std;

	int  a = 1, n = 1;
	bool flag = false;

	while(!(a == 0 &&  n == 0)){
		cin >> a >> n;
		flag = false;

		if(a == 0 && n == 0) break;

		vector <int> dec;
		vector <int> sum;

		sum.push_back(a);

		while(!flag){
			dec.clear();

			int max = 0, min = 0;

			for(int i=0; i < n; i++) {
				dec.push_back(a % 10);
				a /= 10;
			}

			//DESC sort
			sort(dec.begin(), dec.end(), greater<int>() );

			for(int i = 0; i < n; i++){
				max += dec.at(i) * pow(10, n-i-1);
				min += dec.at(n-i-1) * pow(10, n-i-1);
			}
			a = max - min;
			sum.push_back(a);

			//same digit check
			for(int j =sum.size() - 2; j >= 0; j--){
				if(sum.at(sum.size() -1) == sum.at(j)){
					cout << j <<" "<< sum.at(sum.size() -1) << " " << (sum.size() -1) - j << endl;
					flag = true;
				}
				if(flag) break;
			}
		}
	}

	return 0;
}

Measured memory_bytes: 1264
#include<bits/stdc++.h>
using namespace std;
signed main(){
  int n,h[100005],dp[100005]={};
  cin>>n;
  for(int i=1;i<=n;i++){
    cin>>h[i];
  }
  dp[1]=0;
  for(int i=2;i<=n;i++){
    if(i!=2){
      dp[i]=min(abs(h[i]-h[i-2])+dp[i-2],abs(h[i]-h[i-1])+dp[i-1]);
    }
    else{
      dp[i]=abs(h[i]-h[i-1])+dp[i-1];
    }
  }
  cout<<dp[n]<<"\n";
}


Measured memory_bytes: 1024
N = gets.to_i
K = gets.to_i
x_list = gets.split("\s").map {|s|s.to_i}

sum = 0
x_list.each do |x|
  if x < (K-x).abs then
    sum += 2*x
  else
    sum += 2*(K-x).abs
  end
end
p sum

Measured memory_bytes: 1916
#include <iostream>
#include <math.h>
#include <iomanip>

using std::cin;
using std::cout;
using std::endl;

int main() {
  double r;
  cin >> r;
  cout << std::fixed << std::setprecision(7)<< M_PI * r * r << " " << 2 * r * M_PI<<endl;
  return 0;
}

Measured memory_bytes: 1288
#include<iostream>
	#include<vector>
	#include<algorithm>
	#include<string>
	#include<cmath>
	#include<map>
	#include<cstdio>
	#include<stack>
	#include<queue>
	#include<fstream>
	#include<cstdio>
	#include<deque>
	#include<iomanip>
	#include <numeric>
	//#include<bits/stdc++.h>

	using namespace std;
	#define ok1 printf("ok1\n");
	#define ok2 printf("ok2\n");
	#define M 1000000000000000000LL
	#define rep(i,n) for(int i=0;i<n;i++)
	#define REP(i,s,n) for(int i=(s);i<(n);i++)
	#define repr(i,n) for(int i=n-1;i>=0;i--)
	#define REPR(i,s,n) for(int i=(s);i>=(n);(i)--)
	#define all(a) (a).begin(),(a).end()
	#define reall(a) (a).rbegin(),(a).rend()
	#define pb push_back
	#define pf push_front
	#define MIN(a,b) a=min((a),(b))
	#define MAX(a,b) a=max((a),(b))
	#define SIZE(v) (int)v.size()
	const double pi = acos(-1.0);

	typedef vector<int> vi;
	typedef vector<string> vs;
	typedef long long ll;
	typedef vector<ll> vll;
	typedef vector<vi> vvi;
	typedef vector<vll> vvll;
	typedef deque<ll> dll;
	typedef pair<ll, ll> P;
	const ll mod = 1e9 + 7;
	ll dx[4] = {1,0,-1,0};
	ll dy[4] = {0,1,0,-1};


	int main() {
		cin.tie(0);
		ios::sync_with_stdio(false);
		
		vs s(5);
		cin >> s[0] >> s[1] >> s[2];
		int t = 0;
		while (true) {
			if (s[t].size() == 0) {
				cout << (char)(t + 'A');
				return 0;
			}
			char c = s[t][0];
			s[t].erase(s[t].begin());
			t = c - 'a';
		}
		return 0;
	}	
	

Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <set>
#include <algorithm>
#include <vector>
#include <sstream>
#include <string>
#include <functional>
#include <queue>
#include <deque>
#include <stack>
#include <limits>
#include <unordered_map>
#include <unordered_set>
#include <math.h>
#include <fstream>
#include <iterator>
#include <random>
#include <chrono>
 
 
#define forr(i,start,count) for (int i = (start); i < (start)+(count); ++i)
#define set_map_includes(set, elt) (set.find((elt)) != set.end())
#define readint(i) int i; cin >> i
#define readll(i) ll i; cin >> i
#define readdouble(i) double i; cin >> i
#define readstring(s) string s; cin >> s
 
typedef long long ll;
 
using namespace std;

//ll modd = 1000*1000*1000+7;

ll modd = 1000003;

template<class T>
T fastpower(T a, long long n) {  // n must be >= 1
  if (n==0) {return 1;}
  if (n % 2 == 0) {  
      T halfpower = fastpower<T>(a, n/2);
      return (halfpower*halfpower) % modd;
  } else {
      if (n == 1) {  return a; } else {  
          T halfpower = fastpower<T>(a, n/2);
          return (((halfpower*halfpower)%modd)*a)%modd;
      }
  }
};


int main()   {

    ios_base::sync_with_stdio(false);

    cout.precision(17);
    mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
    uniform_int_distribution<int> rand_gen(0, modd);   // rand_gen(rng) gets the rand no
 
//    auto start = chrono::steady_clock::now();
  
//    readint(test_cases);
    int test_cases = 1;
    forr(t, 1, test_cases) {

        vector<ll> fact(modd+1);
        fact[0]=1;
        forr(i,1,modd) {
            fact[i] = fact[i-1] * i;
            fact[i] = fact[i] % modd;
        }

        readint(q);

        forr(i,0,q) {
            readll(x); readll(d); readll(n);
            if (d==0) {
                cout << fastpower<ll>(x, n) << endl;
            } else {
              ll ret = fastpower<ll>(d, n);
              ll xd = x*fastpower<ll>(d, modd-2); xd = xd % modd;
              if (xd+n-1>=modd) {cout << 0 << endl; continue;}
              ret *= fact[xd+n-1]; ret = ret % modd;
              if (x==0) {cout << 0 << endl; continue;}
              ret *= fastpower<ll>(fact[xd-1], modd-2); ret = ret % modd;
              cout << ret << endl;
            }
        }

    }
 
//    auto end = chrono::steady_clock::now();
//    cout << chrono::duration_cast<chrono::milliseconds>(end - start).count() << endl;
 
    return 0;
}

Measured memory_bytes: 11076
import java.util.*;
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.util.Arrays;
import java.util.List;
import java.util.ArrayList;
import java.util.ArrayDeque;
import java.util.Deque;
import java.util.Collections;
import java.awt.Point;


public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        List<Point> blue = new ArrayList();
        List<Point> red = new ArrayList();
        
        for (int i = 0; i < n; i++) {
            String[] xy = br.readLine().split(" ");
            int x = Integer.parseInt(xy[0]);
            int y = Integer.parseInt(xy[1]);
            red.add(new Point(x, y));
        }
        
        for (int i = 0; i < n; i++) {
            String[] xy = br.readLine().split(" ");
            int x = Integer.parseInt(xy[0]);
            int y = Integer.parseInt(xy[1]);
            blue.add(new Point(x, y));
        }
        
        Collections.sort(blue, new Comparator<Point>() {
            @Override
            public int compare(Point p1, Point p2) {
                return p1.x - p2.x;
            }
        });
        
        Collections.sort(red, new Comparator<Point>() {
            @Override
            public int compare(Point p1, Point p2) {
                return p1.x - p2.x;
            }
        });
        
        int max_y = -1;
        int r_ind = -1;
        int count = 0;
        boolean matched = false;
        for (int i = 0; i < blue.size(); i++) {
            Point b = blue.get(i);
            for (int j = 0; j < red.size(); j++) {
                Point r = red.get(j);
                if ((b.x - r.x > 0) && (b.y - r.y > 0)) {
                    if (r.y > max_y) {
                        //System.out.println("aaa");
                        max_y = r.y;
                        r_ind = j;
                        matched = true;
                    }
                }
            }
            if (matched) {
                //blue.remove(i);
                red.remove(r_ind);
                count++;
            }
            else {
                //blue.remove(i);
            }
            matched = false;
            max_y = -1;
        }
        
        System.out.println(count);
    }
}

class Box {
    int w;
    int h;
    public Box(int w, int h) {
        this.w = w;
        this.h = h;
    }
}

class BoxComparator1 implements Comparator<Box>{
	public int compare(Box b1, Box b2) {
		return b1.w - b2.w;
	}
}

class BoxComparator2 implements Comparator<Box> {
    public int compare(Box b1, Box b2) {
        return b1.h - b2.h;
    }
}


Measured memory_bytes: 23380
n    = gets.to_i
t, a = [1, 1]

n.times do
  rT, rA = gets.split.map(&:to_i)
  tT = (t % rT == 0 ? 0 : 1) + t / rT
  tA = (a % rA == 0 ? 0 : 1) + a / rA
  r = [tT, tA].max
  t, a = rT * r, rA * r
end

puts (t + a).to_i

Measured memory_bytes: 1788
#include <iostream>
#include <vector>
#include <numeric>
#include <algorithm>
#include <math.h>
using namespace std;

const long long INF = 1LL << 60;  // どういう意味だろうか

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

void water_flower(int *h, int num) {
	for (int i = 0; i < num; i++) {
		if (h[i] == 0) {
			water_flower(h, i);
		} else {
			h[i]--;
		}
	}
}

int main() {
	int N;
	int h[100] = { 0 };
	int max = 0;
	int count = 0;

	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> h[i];
	}

	max = h[0];
	for (int i = 0; i < N; i++) {
		chmax(max, h[i]);
	}


	for (int j = 0; max > 0; j++) {
		for (int i = 0; i < N; i++) {
			if (max == h[i]) {
				h[i]--;
				count++;

				while (max == h[++i]) {
					h[i]--;
				}
			}
		}
		max--;
	}

	cout << count << endl;


}


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

int main() {
  int a;
  int c = 10000000;

  cin >> a;
  vector<int> bbb(a);
  for (int i = 0; i < a; i++) {
    cin >> bbb.at(i);}
  for (int i = 0; i < 100; i++) {
    int p = 0;
    for (int k = 0; k < a; k++) {
      p += (bbb.at(k)-i)*(bbb.at(k)-i);}
    if(p < c){c = p;}
  }
  cout << c << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(long long i=0;i<int(N);++i)
using ll = long long;
const int INF = 2147483647;
const ll MOD = 1e9+7;
// const ll INF = 1000000000000000000LL;
 
 
 int main() {
	 int n;
	 cin >> n;
	 vector<int> a(n);
	 rep(i,n) cin >> a[i];
	 priority_queue<int> v;
	 sort(a.begin(),a.end(),greater<int>());
	 v.push(a[0]);
	 ll ans = 0;
	 for(int i=1;i<n;i++){
		 ans += v.top();
		 v.pop();
		 int cur = a[i];
		 for(int j=0;j<2;j++){
			 v.push(cur);
		 }
	 }
	 cout << ans << endl;
	 return 0;
 }


Measured memory_bytes: 4948
#include <bits/stdc++.h>
//#include <ext/pb_ds/tree_policy.hpp>
//#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
//using namespace __gnu_pbds;
//template<typename key, typename val>
//using ordered_tree =
//  tree<key, val, greater<>, rb_tree_tag, tree_order_statistics_node_update>;
typedef long long int64;
typedef complex<double> comp;
const double pi = 3.14159265358979323846;
const int inf = (int)1e+9 + 2;
const int64 inf64 = (int64)1e+18 + 2;
const double dinf = 1e+20;
const int mod = 1'000'000'007;//998244353;
const int base = 2187;
const double eps = 1e-8;
const int N = 300'000;
const int LOGN = 19;

int n, m, k;

void solve(int test)
{
  cin >> n;
  int mn = inf, c = 0;
  int64 s = 0;
  for (int i = 0; i < n; ++i) {
    int x;
    cin >> x;
    c += x < 0;
    mn = min(mn, abs(x));
    s += abs(x);
  }
  if (c & 1)
    s -= 2 * mn;
  cout << s << '\n';
}

void precalc()
{
}

int main()
{
  ios::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);
  precalc();
  int test = 1;
  //cin >> test;
  //auto start = chrono::high_resolution_clock::now();
  for (int i = 1; i <= test; ++i)
    solve(i);
  //cerr << chrono::duration_cast<chrono::milliseconds>(chrono::high_resolution_clock::now() - start).count() << '\n';
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
#define fi first
#define se second
using namespace std;
typedef pair<int,int> P;
int n,score[101],a[101][3];
 
 
bool ch(){
 
  int t[101]={},x[101];
  r(i,3){
    int cnt=0,pre,c2=0;
    memset(x,0,sizeof(x));
     
    vector<P> v;
     
    r(j,n)v.push_back(P(a[j][i],j));
     
    sort(v.begin(),v.end(), greater<P>() );
     
    r(k,n){
      if(!k){
    t[v[k].se]+=score[cnt];
    pre=v[k].fi;
      }
      else{
    if(pre==v[k].fi){
      c2++;
      t[v[k].se]+=score[cnt];
    }
    else{
      pre=v[k].fi;
      cnt+=c2+1;c2=0;
      t[v[k].se]+=score[cnt];
    }
      }
    }
     
   }
 
  vector<P> v;
     
  r(j,n)v.push_back(P(t[j],j));
     
  sort(v.begin(),v.end(), greater<P>() );
  int cnt=0,c2=0,pre;
  r(i,n){
    if(!i){
 
      if(!v[i].se&&cnt<=7)return 1;
       
      pre=v[i].fi;
    }
    else{
      if(pre==v[i].fi){
        if(!v[i].se&&cnt<=7)return 1;
        pre=v[i].fi;
        c2++;
      }
       else{
        cnt+=c2+1;c2=0;
        if(!v[i].se&&cnt<=7)return 1;
        pre=v[i].fi;
      }
    }
  }
  return 0;
}
 
 
 
 
int main(){
  cin>>n;
  r(i,n)cin>>score[i];
  r(i,n)r(j,3)cin>>a[i][j];
  r(i,1000)r(j,3){
    a[0][j]+=i;
    if(ch()){
      cout<<i<<endl;
      return 0;
    }
    a[0][j]-=i;
  }
  cout<<"Saiko"<<endl;
}

Measured memory_bytes: 3100
#include <stdio.h>
#include <iostream>
#include <string.h>
#include <string>
#include <set>
#include <algorithm>
using namespace std;
int main()
{
	long long a[100001];
	long long b[100001];
	long long n,x;
	cin>>n>>x;
	for (int i=0;i<n;i++)
	{
		cin>>a[i];
		b[n-1-i]=a[i];
	}
	long long count1=0;
	for(int i=1;i<n;i++)
	{
		if(a[i-1]+a[i]>x)
		{
			int t1=a[i];
			int t2=a[i-1];
			a[i]=max(a[i]-(a[i]+a[i-1]-x),0ll);
			a[i-1]=max(a[i-1]-(a[i]+a[i-1]-x),0ll);
			count1=count1+t1-a[i]+t2-a[i-1];
		}
	}
	long long count2=0;
	for(int i=1;i<n;i++)
	{
		if(b[i-1]+b[i]>x)
		{
			int t1=b[i];
			int t2=b[i-1];
			b[i]=max(b[i]-(b[i]+b[i-1]-x),0ll);
			b[i-1]=max(b[i-1]-(b[i]+b[i-1]-x),0ll);
			count2=count2+t1-b[i]+t2-b[i-1];
		}
	}
	cout<<min(count1,count2);


	
	return 0;
}


Measured memory_bytes: 1920
from collections import Counter
n = int(input())
a = list(map(int,input().split()))
q = int(input())
num = Counter(a)
s = sum(a)
for _ in range(q):
    b,c = map(int,input().split())
    s += (c-b)*num[b]
    num[c] += num[b]
    num[b] = 0
    print(s)

Measured memory_bytes: 23988
from sys import stdin
from collections import defaultdict as dd
from collections import deque as dq
import itertools as it
from math import sqrt, log, log2
from fractions import Fraction

n = int(input())

is_prime = [1]*(n + 1)
is_prime[0], is_prime[1] = 0, 0

for num in range(2, n+1):
    for mult in range(2*num, n+1, num):
        is_prime[mult] += 1
    

ans = 1
for i, elem in enumerate(is_prime[2:]):
    ans += (elem + 1)*(i + 2)

print(ans)




Measured memory_bytes: 234936
#include <bits/stdc++.h>
#define mem(a,b) memset(a,b,sizeof(a))
using namespace std;
typedef long long LL;

const int maxn=2e5+5;
int n,a[maxn],w[maxn],ans;

int read()
{
    int x=0,flag=1;
    char c=getchar();
    while((c>'9' | c<'0') && c!='-') c=getchar();
    if(c=='-') flag=0,c=getchar();
    while(c<='9' && c>='0') {x=(x<<3)+(x<<1)+c-'0';c=getchar();}
    return flag?x:-x;
}

int main()
{
    //freopen("input.txt","r",stdin);
    n=read();
    for(int i=1;i<=n;i++) a[i]=read();
    for(int k=n;k>=1;k--)
    {
        int sum=0;
        for(int i=k;i<=n;i+=k) sum+=w[i];
        w[k]=sum%2==a[k]?0:1;
        if(w[k]) ans++;
    }
    printf("%d\n",ans);
    for(int i=1;i<=n;i++)
        if(w[i]) printf("%d ",i);

	return 0;
}


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

def is_prime(n):
    if n == 1:
        return False
    i = 2
    while(i * i <= n):
        if n % i == 0:
            return False
        i += 1
    return True

result = n
while(not is_prime(result)):
    result += 1

print(result)


Measured memory_bytes: 38384
#include <iostream>
using namespace std;
int main()
{
	int n, m, c[1000], x[1000], p, i;
	while (cin >> n >> m)
	{
		if (!n && !m) break;
		for (i = 0; i < n; i++)
			cin >> c[i];
		for (i = 0; i < m; i++)
			cin >> x[i];
		p = 0;
		for (i = 0; i < m; i++)
		{
			p += x[i];
			if (p >= n-1)
				break;
			p += c[p];
			if (p >= n-1)
				break;
		}
		cout << i+1 << endl;
	}
}

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

using namespace std;

#define int long long
#define pb push_back
#define FOR(i, a, b) for(int i=(a);i<(b);i++)
#define REP(i, n) FOR(i, 0, n)
#define RFOR(i, a, b) for(int i=(a);i>=(b);i--)
#define RREP(i, n) FOR(i, n, 0);

int gcd(int a, int b) {
  if(b == 0) {
    return a;
  } else {
    return gcd(b, a%b);
  }
}

signed main () {
  cin.tie(0);
  cout << setprecision(10);

  int n, m; cin >> n >> m;
  string s, t; cin >> s >> t;

  map<int, char> a;

  int l = n * m / gcd(n, m);

  REP(i, n) {
    a[i * l / n] = s[i];
  }

  REP(j, m) {
    if(a.find(j * l / m) != a.end() && (a[j * l / m] != t[j])) {
      cout << -1 << endl;
      return 0;
    }
  }

  cout << l << endl;
}


Measured memory_bytes: 6144
function Main(input) {
    // 1行目がinput[0], 2行目がinput[1], …に入る
    A = Number(input.split(" ")[0]);
    B = Number(input.split(" ")[1]);
    answer = 0;

    if(A >= B){
        answer += A;
        A =A -1;
    }else{
        answer += B;
        B =B -1;
    }

    if(A >= B){
        answer += A;
        A =A -1;
    }else{
        answer += B;
        B =B -1;
    }


    
    console.log(answer);
}
    


//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

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

using namespace std;

#define N 500
int n, c[N], s[N], f[N];

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cin >> n;
    for (int i = 0; i < n - 1; i++)
        cin >> c[i] >> s[i] >> f[i];
    for (int g = 0; g < n - 1; g++) {
        int t = 0;
        for (int i = g; i < n - 1; i++) {
            if (t < s[i])
                t = s[i];
            while (t % f[i] != 0)
                t++;
            t += c[i];
        }
        cout << t << endl;
    }
    cout << 0 << endl;
    return 0;
}


Measured memory_bytes: 256
n, m = map(int, input().split())
if m % n == 0:
    print(m//n)
    exit()
ret = 1
for d in reversed(range(2,100001)):
    while(m % d == 0):
        if m//d >= n:
            m //= d
            ret *= d
        else:
            break
print(ret)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
  
int main(void){
  int n; cin >> n;
  int AC=0, WA=0, TLE=0, RE = 0;
  
  for(int i=0; i<n; i++) {
    string tmp;
    cin >> tmp;
    if(tmp == "AC") {
      AC++;
    } else if(tmp=="WA") {
      WA++;
    } else if(tmp=="TLE") {
      TLE++;
    } else if(tmp== "RE") {
      RE++;
    }
  }
    
  cout << "AC  x " << AC << endl;
  cout << "WA x " << WA << endl;
  cout << "TLE x " << TLE << endl;
  cout << "RE x " << RE << endl;

  return 0;
}

Measured memory_bytes: 3624
//Sheep and Wolves

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,x,y) for(int i=x;i<y;i++)
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) a / __gcd(a, b) * b
#define range(a) (a).begin(),(a).end()
const int inf = 2147483647;

int main (){
    int S,W;cin>>S>>W;
    cout << (S>W ? "safe" : "unsafe") << endl;
    return 0;
}

Measured memory_bytes: 3636