akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef long long unsigned int ll;

// definition {{{ 1

// scaning {{{ 2
#define Scd(x) scanf("%d", &x)
#define Scd2(x,y) scanf("%d%d", &x, &y)
#define Scd3(x,y,z) scanf("%d%d%d", &x, &y, &z)

#define Scll(x) scanf("%llu", &x)
#define Scll2(x,y) scanf("%llu%llu", &x, &y)
#define Scll3(x,y,z) scanf("%llu%llu%llu", &x, &y, &z)

#define Scc(c) scanf("%c", &c);
#define Scs(s) scanf("%s", s);
#define Scstr(s) scanf("%s", &s);
// }}} 2

// constants {{{ 2
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
// }}} 2

// systems {{{ 2
#define Rep(x,y) for(int x = 0; x < y; x++)
#define Repe(x,y,z) for(int x = z; x < y; x++)
// }}} 2

// output {{{ 2
#define YesNo(a) (a)?printf("Yes\n"):printf("No\n");
// }}} 2

// }}} 1

int main() {

    int N,K;
    Scd2(N,K);

    vector<int> a[123];

    Rep(i,N){
        Repe(j,N,i+1){
            a[i].push_back(j+1);
        }
    }

    bool ans = true;
    if( K > (N-1)*(N-2)/2 ) ans = false;

    int M = (N)*(N-1)/2 - K;

    if( !ans ) M = -1;
    printf ("%d\n", M );
    if( M > 0 )
    Rep(i,N){
        for( int to : a[i] ){
            if( to == N ){
                printf ("%d %d\n", i+1, to );
            } else
            if( K ) K--;
            else{
                printf ("%d %d\n", i+1, to );
            }
        }
    }



    return 0;
}



Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
  int m,d,count=0;
  cin >> m >> d;
  for(int i=1;i<=m;i++){
    for(int j=2;j<=d;j++){
      int a,b;
      a=j%10;
      b=(j-a)/10;
      if(i==a*b && a>=2 && b>=2){
        count++ ;
      }
    }
  }
  cout << count;
}

Measured memory_bytes: 256
def iter_neighbor_indices(y, x, H, W):
    # up
    if y != 0:
        yield (y - 1, x)
    # bottom
    if y != H - 1:
        yield (y + 1, x)
    # left
    if x != 0:
        yield (y, x - 1)
    # right
    if x != W - 1:
        yield (y, x + 1)


if __name__ == '__main__':
    H, W = map(int, input().split())
    color_grid = [list(input()) for _ in range(H)]
    # H, W = 3, 3
    # color_grid = [list('.#.'), list('###'), list('.#.')]

    for y in range(H):
        for x in range(W):
            if color_grid[y][x] == '#':
                found = False

                # search '#' on neighbors
                for ny, nx in iter_neighbor_indices(y, x, H, W):
                    if color_grid[ny][nx] == '#':
                        found = True

                if not found:
                    print("No")
                    exit(0)

    print("Yes")


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

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define REP(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) std::cout << x << '\n'
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define sz(x) ((int)(x).size())
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { ll g = gcd(a, b); return a / g * b; }
const int dx[4] = { 1, 0, -1,  0 };
const int dy[4] = { 0, 1,  0, -1 };
const int INF = INT_MAX / 2;
const ll  inf = LLONG_MAX / 2;
const int mod = 1000000007;
const int MAX_N = 101010;
const double PI = acos(-1);

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

	int a, b, h;
	cin >> a >> b >> h;
	out((a + b) * h / 2);

	return 0;
}

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


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

if(R < 1200) cout << "ABC" << endl;
else if(R < 2800) cout << "ARC" << endl;
else cout << "AGC" << endl;


return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> iint;
typedef pair<ll,ll> llll;
#define ALL(x) (x).begin(),(x).end()
const ll zero = 0;
const ll INF = 3000000000000000000; //10^18
const int inINF = 1000000000; //10^9
const ll MOD = 1000000007; //10^9+7
const ll MOD2 = 998244353;
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

int main(){
    string s;
    cin >> s;
    string t = s.substr(4);
    printf("2018%s\n", t.c_str());
}

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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)
ll R, C, N;
vector<pll> p1, p2, p3, p4;

bool haji(ll a, ll b){
    return (a==0||a==R||b==0||b==C);
}

void push_line(ll a, ll b, ll index){
    pii point;
    point.second = index;
    if(a==0){
        point.first = b;
        p4.push_back(point);
    }else if(a==R){
        point.first = b;
        p2.push_back(point);
    }else if(b==0){
        point.first = a;
        p1.push_back(point);
    }else if(b==C){
        point.first = a;
        p3.push_back(point);
    }
}

int main(){
    cin >> R >> C >> N;
    REP(i, N){
        ll a, b, c, d;
        cin >> a >> b >> c >> d;
        if(haji(a, b)&&haji(c,d)){
            push_line(a, b, i);
            push_line(c, d, i);
        }
    }
    sort(p1.begin(), p1.end());
    sort(p2.begin(), p2.end());
    sort(p3.rbegin(), p3.rend());
    sort(p4.rbegin(), p4.rend());
    vector<pll> p;
    REP(i, p1.size()) p.push_back(p1[i]);
    REP(i, p2.size()) p.push_back(p2[i]);
    REP(i, p3.size()) p.push_back(p3[i]);
    REP(i, p4.size()) p.push_back(p4[i]);
    /*
    cout << "p1:" << endl;
    REP(i, p1.size()){
        cout << p1[i].first << " " << p1[i].second << endl;
    }
    cout << "p2:" << endl;
    REP(i, p2.size()){
        cout << p2[i].first << " " << p2[i].second << endl;
    }
    cout << "p3:" << endl;
    REP(i, p3.size()){
        cout << p3[i].first << " " << p3[i].second << endl;
    }
    cout << "p4:" << endl;
    REP(i, p4.size()){
        cout << p4[i].first << " " << p4[i].second << endl;
    }
    */
    bool checked[200000]={};
    stack<ll> st;
    bool res = true;
    for(int i=0;i<p.size();i++){
        ll index = p[i].second;
        if(!checked[index]){
            st.push(index);
            checked[index] = true;
        }else{
            if(index!=st.top()){
                res = false;
            }
            st.pop();
        }
    }
    cout << (res?"YES":"NO") << endl;
    return 0;
}

Measured memory_bytes: 11232
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		sc.close();
		
		boolean ans=true;
		for (char c='a'; c<='z'; c++){
			int count = 0;
			
			for (int i=0; i<s.length(); i++){
				if (s.charAt(i)==c)
					count++;
			}
			
			if (count%2==1){
				ans=false;
				System.out.println("No");
				break;
			}
		}
		
		if (ans==true)
			System.out.println("Yes");

	}

}


Measured memory_bytes: 21844
#include<iostream>
#include<cstdio>
using namespace std;
long long int sub(long long int x,long long int y);
int sort(long long int *a,long long int *b);
int main(){
long long int a,b,c,x,y;
 while(scanf("%lld %lld",&a,&b)!=EOF){
   c=a*b;
   sort(&a,&b);
   while(1){
     if(a==b)break;
     x=sub(a,b);
     sort(&b,&x);
     a=b;
     b=x;
   }
   y=c/b;
   printf("%lld %lld\n",b,y);
 }
}
long long int sub(long long int x,long long int y){
  return x-y;
}
int sort(long long int *a,long long int *b){
  if(*a<*b){
    long long int temp =*a;
    *a=*b;
    *b=temp;
  }
}

Measured memory_bytes: 1188
/*{{{*/
#include<bits/stdc++.h>
#define sz(X) ((int)(X).size())
#define all(X) (X).begin(), (X).end()
#define rep(I, A, B) for (int I = (A); I <= (B); ++I)
#define repr(I, A, B) for (int I = (A); I >= (B); --I)
#define fors(I, S) for (int I = 0; S[I]; ++I)
#define get_pos(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#define mp make_pair
#define pb emplace_back
#define ms0(X) memset((X), 0, sizeof((X)))
#define ms1(X) memset((X), -1, sizeof((X)))
#define len(X) strlen(X)
#define in insert
#define cn count
#define F first
#define S second
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vpii;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef set<int> si;
template<class T> void _R(T &x) { cin >> x; }
void _R(int &x) { scanf("%d", &x); }
void _R(int64_t &x) { scanf("%lld", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template<class T, class... U> void R(T &head, U &... tail) { _R(head); R(tail...); }
template<class T> void _W(const T &x) { cout << x; }
void _W(const int &x) { printf("%d", x); }
void _W(const int64_t &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template<class T, class U> void _W(const pair<T, U> &x) {_W(x.F); putchar(' '); _W(x.S);}
template<class T> void _W(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W(const T &head, const U &... tail) { _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...); }
#ifdef HOME
#define DEBUG(...) {printf("[DEBUG] ");W(__VA_ARGS__);}
#else
#define DEBUG(...)
#endif
int MOD = 1e9 + 7;
/*}}}*/
void solve() {
	int n, k;
	R(n, k);
	vi v(n);
	rep(i, 0, n - 1) R(v[i]);
	sort(all(v));
	reverse(all(v));
	if (k >= n) {
		W(0);
		return;
	}
	ll an = 0;
	rep(i, k, n - 1) {
		an += v[i];
	}
	W(an);
}

int main() {

#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

#define MULTITEST 0
#if MULTITEST
	CASET {
		solve();
	}
#else
	solve();
#endif
	return 0;
}


Measured memory_bytes: 4060
#include <iostream>

#define rep(i,n) for(int i=0;i<(int)(n);i++)

using namespace std;
typedef pair<string, int> P;
/** Problem0183 : Black-and-White **/
int main()
{
	string board;
	while (cin>>board, board!="0") {
		string s; cin>>s;
		board+=s;
		cin >>s; board+=s;
		for (int i=0; i<3; i++) {
			if (board[i*3] != '+' && board[i*3] == board[i*3+1] && board[i*3] == board[i*3+2]) {
				cout << board[i*3] << endl;
				goto end;
			}
			else if (board[i] != '+' && board[i] == board[i+3] && board[i] == board[i+6]) {
				cout << board[i] << endl;
				goto end;
			}
		}
		
		if (board[0] != '+' && board[0] == board[4] && board[0] == board[8])
			cout << board[0] << endl;
		else if (board[2] != '+' && board[2] == board[4] && board[2] == board[6])
			cout << board[2] << endl;
		else
			cout << "NA" << endl;
		
	end: ;
	}
	return 0;
}

Measured memory_bytes: 1188
#include <iostream>
#include <string>

using namespace std;

int main() {
    string s_in, s_out;
    cin >> s_in;

    for (int i = 0; i < s_in.length(); i++) {
        if (s_in[i] == '0') {
            s_out.push_back('0');
        } else if(s_in[i] == '1') {
            s_out.push_back('1');
        } else if (s_in[i] == 'B' && !s_out.empty()) {
            s_out.pop_back();
        }
    } 
    
    cout << s_out << endl;
    return 0;
}

Measured memory_bytes: 256
/*
       This sky
       Is lonely and grey
       But every night I feel your gravity waves
       And the world is cold
       But it's beautiful
       I wish you were here now
       I miss your soul
       But you lost your light
       When the darkness called
       I still stand here waiting
       The last to fall
       The last to fall
       The last to fall
       The last to fall
                            */
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
template <typename X> ostream& operator << (ostream& x,const vector<X>& v){for(ll i=0;i<v.size();++i) x<<v[i]<<" ";return x;}
template <typename X> ostream& operator << (ostream& x,const set<X>& v){for(auto it:v) x<<it<<" ";return x;}
template <typename X, typename Y> ostream& operator << (ostream& x, const pair<X,Y>& v) {x<<v.ff<<" "<<v.ss;return x;}
template <typename T, typename S> ostream& operator << (ostream& os, const unordered_map<T, S>& v) { for (auto it : v) os << it.first << "=>" << it.second << endl; return os; }
struct pair_hash {inline std::size_t operator()(const std::pair<ll, ll> & v) const {return v.first*31+v.second;}};
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC targett("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define speed ios_base::sync_with_stdio(false);cin.tie(NULL)
#define pb push_back
#define fr first
#define sc second
#define tra(it,m) for(auto it=m.begin();it!=m.end();++it)
#define dbg(x) cout<<#x<<" = "<<x<<'\n';
#define fri(i,s,n) for(ll i=s;i<n;i++)
#define mod 1000000007
#define mod2 998244353
#define vct2 vector<vector<ll>>
#define vct vector<ll>
#define pll pair<ll,ll>
#define rz(n) resize(n)
#define all(v) v.begin(),v.end()
#define mkp make_pair
#define arrin(a,n) for(ll i = 0; i < n ; i++){cin>>a[i];}
#define arrout(a,n) for(ll i = 0;i < n; i++){cout<<a[i]<<" ";}
#define ex(s) cout<<s<<endl,exit(0);
#define inf 4e18
#define five 100005;
#define six 1000005;
#define printclock cerr<<"Time"<<1000*(ld)clock()/(ld)CLOCKS_PER_SEC<<"ms\n";
//_______________________________________________________________________________________
int main()
{
       int x,n;
       cin>>x>>n;
       set<int> p;
       fri(i,0,n){
              int xx;
              cin>>xx;
              p.insert(xx);
       }
       map<int,set<int>> mp;
       fri(i,-300,304){
              int xx = abs(x-i);
              if(p.find(i)==p.end()){
                     mp[xx].insert(i);
              }
       }
       map<int,set<int>> :: iterator it = mp.begin();
       int ans = *(it->sc.begin());
       cout<<ans<<endl;
}


Measured memory_bytes: 3684
#include<bits/stdc++.h>
using namespace std;
#define PI 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117067982148086513282306647093844609550582231725359408128481117450284102701938521105559644622948954930381964428810975665933446128475648233786783165
int main(){
  int A, B, H, M;
  long double At, Bt, rad;
  cin >> A >> B >> H >> M;
  At = 30*H+(long double)M/(long double)2;//360*H/12 + 360/12*M/60
  Bt = 6*M;//360*M/60
  rad = (At-Bt)*PI/(long double)180;
  //rad = (30*H+(long double)M/(long double)2-6*M)*PI/(long double)180;
  cout << setprecision(20) << sqrtl(A*A+B*B-2*A*B*cosl(rad));
}

Measured memory_bytes: 4164
#include <stdio.h>
#include <ctype.h>

int main(){
    char ch;
    while(1){
        scanf("%c", &ch);
        if(ch=='\n'){
            printf("\n");
            break;
        }else if(islower(ch)){
            printf("%c", toupper(ch));
        }else if(isupper(ch)){
            printf("%c", tolower(ch));
        }else{
            printf("%c", ch);
        }
    }

    return 0;
}


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

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

	int32_t N;
	int32_t input;

	cin >> N;

	vector<int32_t> w={};
	vector<int32_t> answer={};

	for (size_t i = 0; i<N; ++i){
		cin >> input;
		w.push_back(input);
	}

    for (int32_t i=1; i<=w.size(); ++i){
	int32_t s1 = accumulate(w.begin(), w.begin()+i, 0);

		int32_t s2 = accumulate(w.begin()+i, w.end(), 0);

		if (s1 <= s2) {
			answer.push_back(s2-s1);
		} else {
			answer.push_back(s1-s2);
		}
	}

	int32_t min = *min_element(answer.begin(), answer.end());

	cout << min << endl;
}


Measured memory_bytes: 256
/*
                        --------------- Shuvo 's code-_______
                        /''''''''''(______O] ----------____  \______/]_
     __...---'"""\_ --''        Metropolitan university     ___________@ -> ->  -> - --  - -- - ---- ->>
 |'''                   ._   _______________=---------"""""""
 |                ..--''|   l L |_l   |
 |          ..--''      .  /-___j '   '
 |    ..--''           /  ,       '   '
 |--''                /           `    \
                      L__'         \    -
                                    -    '-.
                                     '.    /
                                       '-./
*/

///   ------------ Bismillah hirrahman nirrahim ----------   ///

#include <bits/stdc++.h>
#define ll long long int
#define ull unsigned long long
#define sc(n) scanf("%I64d", &n);
#define pr(n) printf("%I64d\n", n);
#define prr(n, m) printf("%I64d %I64d\n", n, m);
#define prrr(n, m, p) printf("%I64d %I64d %I64d\n", n, m, p);
#define lp(i,s,n) for(long long  i = s; i<n; i++)
#define pl(n) for(long long i=n-1; i>=0; i--)
#define  ars(arr,s,e) sort(arr+s,arr+n);
#define pb push_back
#define FastRead        ios_base::sync_with_stdio(0);cin.tie(0)

long long int mx = 1e18;
long long int mn = -1e18;
using namespace std;
ll a[10];

vector < ll > v;
set < ll > st[100010];

ll gcd(ll a,ll b){
    ll tmp;
    while(b){
        tmp=b;
        b=a%tmp;
        a=tmp;
    }
    return a;
}


int main()
{
    FastRead;
    ll p,q,r,s,t,i, j,ii, x, jj, n, ans, sum, cnt = 0, st,tc = 0, len ;
    string str;

    cin >> a[0] >> a[1] >> a[2];
    sort(a, a+3);
    ans  = 0;
    for(i=1; i<3; i++)
    {
        ans += a[i]- a[i-1];
    }

    cout << ans << endl;

}



Measured memory_bytes: 4992
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,b;
	cin>>a>>b;
    if(a>0) cout<<"Positive"<<endl;             
    else if(b>=0) cout<<"Zero"<<endl;            
    else if((a&1)^(b&1))cout<<"Positive"<<endl;//?  
    else cout<<"Negative"<<endl;
    return 0;
}

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

int main(){
  int h, a, cnt=0;
  cin >> h >> a;
  while(h>0){
    h-=a;
    cnt++;
  }

  cout << cnt << endl;

  return 0;
}

Measured memory_bytes: 3620
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <cmath>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <iostream>
#include <random>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include <fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <bitset>
using namespace std;

using ll = long long;
using vll = vector<long long>;
using pll = pair<long long, long long>;
#define rep(i,n) for(long long i(0);(i)<(n);(i)++)

const string YES = "Yes";
const string NO = "No";

void solve(long long N){
    vector<bool> d(N+1, false);
    d[0] = true;
    rep(i, N){
        //* d[i+1]
        if(i+1 - 4 >=0 && d[i+1-4])
            d[i+1] = true;
        if(i+1 - 7 >= 0 && d[i+1-7])
            d[i+1] = true;
    }
    if(d[N])
        cout << YES << endl;
    else
    {
        cout << NO << endl;
    }
    

}

int main(){
    long long N;
    scanf("%lld",&N);
    solve(N);
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define rep(i, a, b) for(int i=(a); i<(b); i++)
#define per(i, a, b) for(int i=(b)-1; i>=(a); i--)
#define sz(a) (int)a.size()
#define de(a) cout << #a << " = " << a << endl
#define dd(a) cout << #a << " = " << a << " "
#define all(a) a.begin(), a.end()
#define pw(x) (1ll<<(x))
#define endl "\n"
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
ll dp[1000000+10][6];
ll a[1000000+10];
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	int n;
	cin >> n;
	rep(i,1,n+1){
		cin >> a[i];
	}
	dp[1][0]=a[1];
	dp[1][1]=a[1];
	dp[2][0]=a[2];
	dp[2][1]=a[2];
	if(n%2==0){
		rep(i,3,n+1){
			if(i%2==0) dp[i][1]=max(dp[i-3][0],dp[i-2][1]);
			else dp[i][1]=dp[i-2][1];
			dp[i][0]=dp[i-2][0];
			dp[i][0]+=a[i];
			dp[i][1]+=a[i];
		}
		cout<<max(dp[n-1][0],max(dp[n][0],dp[n][1]));
	}
	else{
		rep(i,3,n+1){
			dp[i][4]=max(dp[i-3][0],dp[i-2][4]);
			if(i>=5&&i%2==1) dp[i][3]=dp[i-4][0];
			if(i%2==0) dp[i][1]=max(dp[i-3][0],dp[i-2][1]);
			else dp[i][1]=dp[i-2][1];
			dp[i][0]=dp[i-2][0];
			dp[i][3]=max(dp[i][3],dp[i-2][3]);
			if(i%2==1) dp[i][2]=dp[i-3][1];
			dp[i][2]=max(dp[i][2],dp[i-2][2]);
			dp[i][0]+=a[i];
			dp[i][1]+=a[i];
			dp[i][2]+=a[i];
			dp[i][3]+=a[i];
			dp[i][4]+=a[i];
		}
		ll t1=max(max(max(dp[n][0],dp[n][1]),max(dp[n][2],dp[n][3])),dp[n][4]);
		ll t2=max(max(max(dp[n-1][0],dp[n-1][1]),max(dp[n-1][0],dp[n-1][0])),dp[n-1][4]);
		cout<<max(dp[n-3][1],max(dp[n-2][0],max(t1,t2)));
	}
	return 0;
}

Measured memory_bytes: 14580
#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;

void Main()
{
    int r;
    cin >> r;

    cout << r * r << endl;
}

int main()
{
    std::cout << std::fixed << std::setprecision(15);
    Main();
}

Measured memory_bytes: 256
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <tuple>
# include <unordered_map>
# include <numeric>
# include <complex>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
constexpr int INF = 2000000000;
constexpr int HINF = INF / 2;
constexpr double DINF = 100000000000000000.0;
constexpr long long LINF = 9223372036854775807;
constexpr long long HLINF = 4500000000000000000;
const double PI = acos(-1);
int dx[4] = { 0,1,0,-1 }, dy[4] = { 1,0,-1,0 };
# define ALL(x)     (x).begin(),(x).end()
# define UNIQ(c)    (c).erase(unique(ALL((c))), end((c)))
# define mp         make_pair
# define eb         emplace_back
# define FOR(i,a,b) for(int i=(a);i<(b);++i)
# define REP(i,n)   FOR(i,0,n)
# define INIT       std::ios::sync_with_stdio(false);std::cin.tie(0);

int main() {
	LL n, t, q;
	cin >> n >> t >> q;
	LL a[111111], d[111111];
	for (int i = 0; i < n; i++) {
		cin >> a[i] >> d[i];
	}
	vector<LL>stoplist;
	for (int i = 1; i < n; i++) {
		if (d[i - 1] == 1 && d[i] == 2) {
			stoplist.emplace_back((a[i - 1] + a[i]) / 2);
		}
	}
	int Q;
	for (int i = 0; i < q; i++) {
		cin >> Q;
		Q--;
		if (d[Q] == 1) {
			LL goal = a[Q] + t;
			bool flag = true;
			for (int j = 0; j < stoplist.size(); j++) {
				if (a[Q] <= stoplist[j] && stoplist[j] <= goal) {
					cout << stoplist[j] << endl;
					flag = false;
					break;
				}
			}
			if (flag) {
				cout << goal << endl;
			}
		}
		else {
			LL goal = a[Q] - t;
			bool flag = true;
			/*for (int j = 0; j < stoplist.size(); j++) {
			if (goal <= stoplist[j] && stoplist[j] <= a[Q]) {
			cout << stoplist[j] << endl;
			flag = false;
			break;
			}
			}*/
			for (int j = stoplist.size() - 1; j >= 0; j--) {
				if (goal <= stoplist[j] && stoplist[j] <= a[Q]) {
					cout << stoplist[j] << endl;
					flag = false;
					break;
				}
			}
			if (flag) {
				cout << goal << endl;
			}
		}
	}
	//system("pause");
}

Measured memory_bytes: 4856
#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for(ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF (1ll << 60)
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll, ll> p;
constexpr int MOD = 1000000007;
using ll = long long;
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 print(const std::vector<int> &v) {
    std::for_each(v.begin(), v.end(), [](int x) { std::cout << x << " "; });
    std::cout << std::endl;
}

int main() {
    int N;
    cin >> N;
    vector<long long> H(N);
    vector<long long> MIN(N);
    REP(i, N) { cin >> H[i]; }
    //累積min的な
    for(int i = N - 1; i >= 0; i--) {
        if(i == N - 1) {
            MIN[i] = H[i];
        } else {
            MIN[i] = min(H[i], MIN[i + 1]);
        }
    }
    // REP(i, N) { cout << MIN[i] << " "; }
    REP(i, N - 1) {
        if(H[i] <= MIN[i + 1]) {
            continue;
        }
        if(H[i] - 1 > MIN[i + 1]) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 1792
def prepare(n):
    global MOD
    modFacts = [0] * (n + 1)
    modFacts[0] = 1
    for i in range(n):
        modFacts[i + 1] = (modFacts[i] * (i + 1)) % MOD

    invs = [1] * (n + 1)
    invs[n] = pow(modFacts[n], MOD - 2, MOD)
    for i in range(n, 1, -1):
        invs[i - 1] = (invs[i] * i) % MOD

    return modFacts, invs


MOD = 10 ** 9 + 7
K = int(input())
S = input()
L = len(S)
modFacts, invs = prepare(K + L)

pow25 = [1] * max(L + 1, K + 1)
pow26 = [1] * max(L + 1, K + 1)
for i in range(max(L, K)):
    pow25[i + 1] = (pow25[i] * 25) % MOD
    pow26[i + 1] = (pow26[i] * 26) % MOD

ans = 0
for n in range(L, L + K + 1):
    nonSi = (pow25[n - L] * pow26[L + K - n]) % MOD
    Si = (modFacts[n - 1] * invs[L - 1] * invs[n - 1 - (L - 1)]) % MOD
    ans += nonSi * Si
    ans %= MOD

print(ans)


Measured memory_bytes: 138400
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
using namespace std;

void turn(vector<pair<int,int> >& a){
	for(int i=0; i<(int)a.size(); i++){
		int x=a[i].first;
		int y=a[i].second;
		a[i].first = -y;
		a[i].second = x;
	}
}

int main(){
	while(1){
		int n;
		cin >> n;
		if(n==0) break;
		
		//input
		vector<vector<pair<int, int> > > lines(n+1);
		for(int i=0; i<=n; i++){
			int m, sx, sy;
			cin >> m;
			cin >> sx >> sy;
			lines[i].push_back(make_pair(0,0));
			for(int j=1; j<m; j++){
				int x,y;
				cin >> x >> y;
				lines[i].push_back(make_pair(x-sx,y-sy));
			}
		}
		
		vector<pair<int,int> > a,b;
		a = b = lines[0];
		for(int i=0; i<(int)b.size(); i++){
			b[i].first -= b[b.size()-1].first;
			b[i].second -= b[b.size()-1].second;
		}
		reverse(b.begin(), b.end());
		
		//check
		for(int i=1; i<=n; i++){
			if(a.size() != lines[i].size()) continue;
			for(int s=0; s<4; s++){
				bool same_a = true, same_b = true;
				for(int j=0; j<(int)a.size(); j++){
					if(a[j] != lines[i][j]){
						same_a = false;
						break;
					}
				}
				for(int j=0; j<(int)b.size(); j++){
					if(b[j] != lines[i][j]){
						same_b = false;
						break;
					}
				}
				if(same_a || same_b){
					cout << i << endl;
					s = 4;
					break;
				}
				turn(a);
				turn(b);
			}
		}
		cout << "+++++" << endl;
	}
	return 0;	
}

Measured memory_bytes: 3004
W, H, N = map(int, input().split())
a1, a2, a3, a4 = [], [], [], []
dispatch = {1: a1, 2: a2, 3: a3, 4: a4}
for _ in range(N):
    x, y, a = map(int, input().split())
    dispatch[a].append((x, y))

a1x = max(a1, key=lambda x: x[0])[0] if a1 else 0
a2x = min(a2, key=lambda x: x[0])[0] if a2 else W
a3y = max(a3, key=lambda x: x[1])[1] if a3 else 0
a4y = min(a4, key=lambda x: x[1])[1] if a4 else H

if a2x - a1x > 0 and a4y - a3y > 0:
    print((a2x - a1x) * (a4y - a3y))
else:
    print(0)


Measured memory_bytes: 3064
#include<iostream>
 
using namespace std;
 
int main()
{
  int r, c;
  cin >> r >> c;
 
  int a[101][101];
 
  for ( int i = 0; i < r; i++ )
    {
      int sum = 0;
      for ( int j = 0; j < c; j++ )
        {
          cin >> a[i][j];
          sum += a[i][j];
        }
      a[i][c] = sum;
    }
 
  for ( int i = 0; i < r; i++ )
    {
      for ( int j = 0; j <= c; j++ )
        {
          if ( j ) cout << " ";
          cout << a[i][j];
        }
      cout << endl;
    }
 
  for ( int i = 0; i <=c; i++ )
    {
      int sum = 0;
      for ( int j = 0; j < r; j++ )
        {
          sum += a[j][i];
        }
      if ( i ) cout << " ";
      cout << sum;
    }
  cout << endl;
   
  return 0;
}

Measured memory_bytes: 1200
flag = 1
while flag == 1:
	nums = list(input().split(" "))
	a = int(nums[0])
	op = nums[1]
	b = int(nums[2])

	if op != "?":
		if op == "+":
			print(a+b)
		elif op == "-":
			print(a-b)
		elif op == "*":
			print(a*b)
		elif op == "/":
			print(int(a/b))
	elif op == "?":
		flag = 0


Measured memory_bytes: 5596
N, X, M = gets.split.map(&:to_i)
as = Array.new(M, nil)

c = X
m = 0
i = 0
g = false
while true do
  i += 1
  m += c
  if i == N then
    g = true
    puts m
    break
  end
  if as[c] == nil then
    as[c] = [i, m]
  else
    aa = as[c]
    ro = i - aa[0]
    rb = m - aa[1]
    loc = (N - i) / ro
    # pp [aa, i, m]
    i += loc * ro
    m += loc * rb
    break
  end
  c = c * c % M
end

if !g && i == N then
  puts m
  g = true
end

if !g then
  while true do
    # puts i
    c = c * c % M
    i += 1
    m += c
    if i == N then
      puts m
      break
    end
  end
end


Measured memory_bytes: 16764
s=input()

ans=0
if s[0]=="R":
    ans+=1
    if s[1]=="R":
        ans+=1
        if s[2]=="R":
            ans+=1
elif s[1]=="R":
    ans+=1
    if s[2]=="R":
        ans+=1
elif s[2]=="R":
    ans+=1

print(ans)



Measured memory_bytes: 9044
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=1;i<=n;i++)
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
using namespace std;

int main(){
    int n,x,c=0;
    cin>>n>>x;
    vector<int> a(n);
    rep(i, n){
        cin>>a[i];
        x -= a[i];
        c++;
    }
    sort(a.begin(), a.end());
    while (x>=a[0]) {
        x-=a[0];
        c++;
    }
    cout<<c<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <string>
#include <bitset>
#include <cstring>
#include <map>
#include <math.h>
#include <queue>
#include <set>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> P;
#define rep(i,n) for (int i = 0; i < n; i++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define fir first
#define sec second
#define pb push_back
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF = 1<<30;
const ll LINF = 1LL<<58;
const int mod = 1000000007;

bool check(int a){
	for (int i = 1; i < 130; i++){
		int d = i*i;
		if(a==d) return true;
	}
	return false;
}

int main(){
	int n, d;
	cin >> n >> d;
    cout << (n-1)/(2*d+1) + 1 << endl;
	return 0;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
)

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

	dp := make([]bool, x+106)
	dp[0] = true

	for i := 0; i <= x; i++ {
		if dp[i] {
			for j := 100; j <= 105; j++ {
				dp[i+j] = true
			}
		}
	}
	if dp[x] {
		fmt.Println(1)
	} else {
		fmt.Println(0)
	}
}


Measured memory_bytes: 1852
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <map>
#include <assert.h>
#include <stack>
#include <queue>
#include <deque>
#include <list>
#include <set>
#include <bitset>
#include <numeric>
#include <string.h>
#include <utility>

using namespace std;
#define IO                 \
	ios::sync_with_stdio(0); \
	cin.tie(0);              \
	cout.tie(0);
#define sz(x) (int)((x).size())
#define forn(i,n) for (int i=0; i < n; i++)
#define forse(i,s,e) for (int i=s; i < e; i++)
#define pb push_back 
#define pf push_front
#define rb pop_back
#define rf pop_front
#define mp make_pair
#define fi first
#define se second
#define all(vec) vec.begin(), vec.end()
#define time() ((double)clock() / CLOCKS_PER_SEC)
#define debug(x) cerr << (#x) << " is " << (x) << endl;

#ifndef LOCAL
#define cerr if(false)cerr
#endif

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
ll P=1e9+7;
double PI=3.141592653589793;
const int arrn = 2e5 + 1;


void solve(){
	int n;ll k;
	cin >> n >> k;
	vector<int> a(n);
	forn(i,n) cin >> a[i];
	forn(i,n) a[i]--;
	vector<int> dis(n,-1);
	vector<int> proc;
	int ind=0,bef=-1;
	while(dis[ind]==-1){
		proc.pb(ind);
		dis[ind]=bef+1;	
		bef=dis[ind];
		ind=a[ind];
	}
	if(k<sz(proc)){
		cout << proc[k]+1;
	}else{
		k-=dis[ind];
		int clen=sz(proc)-dis[ind];
		k%=clen;
		cout << proc[dis[ind]+k]+1;
	}
}

int main() {
	IO;
	int T=1;
//	cin >> T;
	forn(c,T){
		solve();
	}
}



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

long long min(long long a, long long b) {
    if (a > b) {
        return b;
    }
    return a;
}

int main() {
    int a[100000], dp[100000], n, k;;
    const int inf = 1e9;
    scanf("%d", &n);
    scanf("%d", &k);
    for(int i = 0; i < n; i++) {
        scanf("%d", &a[i]);
        dp[i] = inf;
    }
    dp[0] = 0;
    for(int i = 1; i < n; i++){
        for(int j = 1; j < min(i, k) + 1; j++){
            dp[i] = min(dp[i], abs(a[i] - a[i - j]) + dp[i - j]);
        }
    }
    printf("%d\n", dp[n - 1]);
    return 0;
}

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

struct UnionFind{
  vector< int > data;
  UnionFind(int sz){
    data.resize(sz, -1);
  }
  int Find(int a){
    return(data[a] < 0 ? a : data[a] = Find(data[a]));
  }
  void Union(int a, int b){
    a = Find(a), b = Find(b);
    if(a == b) return;
    if(data[a] < data[b]) swap( a, b);
    data[b] += data[a];
    data[a] = b;
  }
};

struct edge {
  int to, cost;
};
struct edge2 {
  int u, v, cost;
  bool operator<(const edge2& e) const {
    return cost < e.cost;
  }
};
typedef vector< vector< edge > > Graph;
typedef pair< int, int > Pi;
const int INF = 1 << 30;
int N, M, K, Q, F[100000];
Graph graph;
vector< edge2 > weighted;
set< int > buffer[100000];
stack< int > st;
int ret[100000];

void Dijkstra(Graph& g, vector< int >& min_cost){
  min_cost.assign( g.size(), INF);
  priority_queue< Pi, vector< Pi >, greater< Pi > > que;
  for(int i = 0; i < K; i++){
    que.push( make_pair( 0, F[i]));
    min_cost[F[i]] = 0;
  }
  while(!que.empty()){
    Pi p = que.top(); que.pop();
    if(p.first > min_cost[p.second]) continue;
    for(int i = 0; i < g[p.second].size(); i++){
      edge& e = g[p.second][i];
      if(p.first + e.cost >= min_cost[e.to]) continue;
      que.push( make_pair( p.first + e.cost, e.to));
      min_cost[e.to] = p.first + e.cost;
    }
  }
}


int main(){
  scanf("%d %d %d %d", &N, &M, &K, &Q);
  graph.resize(N);
  UnionFind uftree(N);

  for(int i = 0; i < M; i++){
    int a, b, c;
    scanf("%d %d %d", &a, &b, &c);
    --a, --b;
    graph[a].push_back((edge){b, c});
    graph[b].push_back((edge){a, c});
    weighted.push_back((edge2){a, b});
  }

  for(int i = 0; i < K; i++){
    scanf("%d", &F[i]);
    --F[i];
  }
  for(int i = 0; i < Q; i++){
    int a, b;
    scanf("%d %d", &a, &b);
    --a, --b;
    buffer[a].insert(i);
    buffer[b].insert(i);
  }

  vector< int > min_cost;
  Dijkstra( graph, min_cost);
  
  for(int i = 0; i < M; i++){
    weighted[i].cost = min( min_cost[weighted[i].u], min_cost[weighted[i].v]);
  }
  sort( weighted.rbegin(), weighted.rend());

  for(int i = 0; i < M; i++){
    int u = uftree.Find(weighted[i].u), v = uftree.Find(weighted[i].v);
    if(u == v) continue;
    uftree.Union( u, v);
    int unioned = uftree.Find(weighted[i].u);
    set< int > *oo = &buffer[u], *pp = &buffer[v];
    if(u != unioned) swap( oo, pp);
    for(set< int >::iterator it = pp -> begin(); it != pp -> end(); it++){
      if(oo -> find(*it) != oo -> end()) ret[*it] = weighted[i].cost;
      else st.push(*it);
    }
    for( ;!st.empty(); oo -> insert(st.top()), st.pop());
  }
  
  for(int i = 0; i < Q; i++){
    printf("%d\n", ret[i]);
  }
}

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

int h,w;

enum{
	UP = 0,
	DOWN = 1,
	RIGHT = 2,
	LEFT = 3
};

struct{
	int link;
	int d;
}typedef Task;

class Cell{
	private:
		int links[4];
		bool hasLink[4];
		bool arrived;
	public:
		Cell(int up,int down,int right,int left) : arrived(false){
			if(0 <= up && up < h * w){				
				links[UP] = up;
				hasLink[UP] = true;
			}
			if(0 <= down && down < h * w){
				links[DOWN] = down;
				hasLink[DOWN] = true;
			}
			if(0 <= right && right < h * w){
				links[RIGHT] = right;
				hasLink[RIGHT] = true;
			}
			if(0 <= left && left < h * w){
				links[LEFT] = left;
				hasLink[LEFT] = true;
			}
		}

		bool enQueueLink(queue<Task>* taskQueue,int d){
			if(arrived)
				return false;

			for(int i = 0; i < 4;i++){
				if(hasLink[i]){
					Task task;
					task.link = links[i];
					task.d = d + 1;
					taskQueue->push(task);
				}
			}
			arrived = true;
			return true;
		}
};


int main(){
	cin >> h;
	cin >> w;
	Cell** cells = new Cell*[h * w];
	queue<int> startCell;
	for(int i = 0;i < h * w;i++){
		int up = i - w;
		int down = i + w;
		int right = (i % w != (w - 1)) ? i + 1 : -1;
		int left = (i % w != 0) ? i - 1 : -1;
		Cell* cell = new Cell(up,down,right,left);
		cells[i] = cell;	

		char c;
		cin >> c;
		if(c == '#')
			startCell.push(i);
	}
	queue<Task> tasks;
	int mostD = 0;
	while(!startCell.empty()){
		Cell* cell = cells[startCell.front()];
		startCell.pop();
		cell->enQueueLink(&tasks,0);
	}
	while(!tasks.empty()){
		Task task = tasks.front();
		tasks.pop();
		Cell* cell = cells[task.link];
		if(cell->enQueueLink(&tasks,task.d) && task.d > mostD){
			mostD = task.d;
		}
	}
	cout << mostD << endl;
	return 0;
}

Measured memory_bytes: 72068
#include <stdio.h>

int main() {
  char S[3];
  int judge=0;
  scanf("%s",S);
  for(int i=0;i<2;i++) {
    if(S[i] !=S[i+1]) {
      printf("Yes");
      judge++;
      break;
    }
  }
  if(judge==0) {
    printf("No");
  }
  return 0;
}

Measured memory_bytes: 1708
n = int(input())
a = list(map(int, input().split()))
num_map = dict()
for i in range(n):
    if a[i] not in num_map:
        num_map[a[i]] = 1
    else:
        num_map[a[i]] += 1

counter = 0
for key, value in num_map.items():
    if value % 2 == 0:
        num_map[key] = 2
        counter += 1
    else:
        num_map[key] = 1

res = len(num_map) - counter % 2
print(res)


Measured memory_bytes: 21924
#include<bits/stdc++.h>
using namespace std;
const int N=2e5+5;
int a[N];
int n,k;
bool check(int L){
	int ret=0;
	for(int i=1;i<=n;i++){
		ret+=(a[i]-1)/L;
		if(ret>k) return false;
	}
	return ret<=k;
}
int main(){
	scanf("%d %d",&n,&k);
	int maxx=0;
	for(int i=1;i<=n;i++){
		scanf("%d",&a[i]);
		maxx=max(maxx,a[i]);
	}
	int left=1,right=maxx;
	int mid;
	while(left<right){
		mid=left+right>>1;
		if(check(mid)){
			right=mid;
		}
		else{
			if(left==mid) break;
			left=mid;
		}
	}
	printf("%d",right);
	return 0;
}

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

int main() {
	long long a[3];
 	cin >> a[0] >> a[1] >> a[2];
    sort(a, a + 3);
  	if(a[0] % 2 && a[1] % 2 && a[2] % 2)
    	cout << a[0] * a[1] << endl;
    else
    	cout << 0 << endl;
   	return 0;
}

Measured memory_bytes: 256
n,d,a=[int(j) for j in input().split()]
xh=[[int(j) for j in input().split()] for i in range(n)]
xh.sort()
from collections import deque
q=deque()
ans=0
dmg=0
for x,h in xh:
    while q and q[0][0]<x:
        i,j=q.popleft()
        dmg-=j
    r=h-dmg
    if r<=0:
        continue
    p=-(-r//a)
    dmg+=p*a
    ans+=p
    q.append((x+2*d,p*a))
print(ans)






Measured memory_bytes: 85464
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define loop(i,a,b) for(ll i=a;i<b;i++)
#define loope(i,a,b) for(ll i=a;i<=b;i++)
#define test() ull t;cin>>t;while(t--)
#define pll pair<ll,ll>
#define puu pair<ull,ull>
#define f first
#define s second
#define pb push_back
#define mkp make_pair
#define ins insert
#define Vint vector<int>
#define Vll vector<ll>
#define Vull vector<ull>
#define nl cout<<endl
#define sp cout<<" "
#define MOD 1000000007
#define all(x) x.begin(),x.end()
int dx[] = {1,0,-1,0};
int dy[] = {0,1,0,-1};
 
int main() 
{
	// ios::sync_with_stdio(0);
	// cin.tie(0);
	// cout.tie(0);
	int n;
	cin>>n;
	int k = n==0?1:0;
	cout<<k;
}

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

int main () {
    int N;
    cin >> N;
    vector <int> d(N);
    for (int i=0; i<N; i++) {
        cin >> d.at(i);
    }

    sort (d.begin(), d.end());
    int sum=1;

    for (int i=0; i<N-1; i++) {
        if (d.at(i)<d.at(i+1)) {
            sum++;
        }
        else {
            sum+=0;
        }        
    }
    cout << sum << endl;
}

    

  
    


Measured memory_bytes: 3588
def main():
    n,m=map(int,input().split())
    s=list(map(int,input().split()))
    t=list(map(int,input().split()))
    mod=10**9+7
    s=[(s[i+1]-s[i])*(i+1)*(n-i-1)%mod for i in range(n-1)]
    t=[(t[i+1]-t[i])*(i+1)*(m-i-1)%mod for i in range(m-1)]
    print(sum(s)*sum(t)%mod)
main()

Measured memory_bytes: 18624
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("faild to read char") as char)
        .take_while(|c| !c.is_whitespace())
        .collect();
    token
        .parse()
        .ok()
        .expect("faild to parse token")
}

struct Point {
    x: i64,
    y: i64,
}

fn main(){
    let n: usize = read();
    let mut p: Vec<Point> = (0..n).map(|_| Point {x: read(), y: read()}).collect();
    p.sort_by(|a, b| (a.x + a.y).partial_cmp(&(b.x + b.y)).unwrap());
    let plus = (p[0].x - p[n - 1].x).abs() + (p[0].y - p[n - 1].y).abs();
    p.sort_by(|a, b| (a.x - a.y).partial_cmp(&(b.x - b.y)).unwrap());
    let minus = (p[0].x - p[n - 1].x).abs() + (p[0].y - p[n - 1].y).abs();
    println!("{}", std::cmp::max(plus, minus));
}


Measured memory_bytes: 6552
/*{{{*/
//#pragma GCC optimize("O3")

#include <bits/stdc++.h>

#ifdef __linux__
#define getchar getchar_unlocked
#define putchar putchar_unlocked
#endif

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

std::string Name = __FILE__;
std::string iput = Name.substr(0, Name.length() - 4) + ".in";
std::string oput = Name.substr(0, Name.length() - 4) + ".out";

template <class T> inline bool chkmin(T &x, T y) { return x > y ? x = y, true : false; }
template <class T> inline bool chkmax(T &x, T y) { return x < y ? x = y, true : false; }

template <class T> inline T &read(T &x)
{
    static int f;
    static char c; 
    for (f = 1; !isdigit(c = getchar()); ) {
        if (c == '-')
            f = -1;
    }
    for (x = 0; isdigit(c); c = getchar()) {
        x = x * 10 + c - 48;
    }
    return x *= f;
}
 
template <class T> inline void write(T x, const char p = '\n')
{
    static int top;
    static int s[30];
    if (x < 0) {
        x = -x;
        putchar('-');
    }
    do s[++ top] = x % 10 + 48;
    while (x /= 10);
    while (top)
        putchar(s[top --]);
    putchar(p);
}
/*}}}*/
 
const int maxn = 2e5 + 5;
const int maxm = 2000 + 5;
const int mo = 1e9 + 7;
const int inv2 = mo + 1 >> 1;
 
int n;
int m;
int a[maxn], b[maxn];
int c[maxm << 1][maxm << 1];

long long fac[maxn << 2], inv[maxn << 2];

int C(int a, int b)
{
    return (long long)fac[a] * inv[b] % mo * inv[a - b] % mo;
}

int qpow(int a, int b)
{
    int ret = 1;
    while (b) {
        if (b & 1) ret = (long long)ret * a % mo;
        a = (long long)a * a % mo;
        b >>= 1;
    }
    return ret;
}

void exec()
{
    for (int i = fac[0] = 1; i <= 8000; ++ i) {
        fac[i] = (long long)fac[i - 1] * i % mo;
    }
    inv[8000] = qpow(fac[8000], mo - 2);
    for (int i = 8000 - 1; ~i; -- i) {
        inv[i] = (long long)inv[i + 1] * (i + 1) % mo;
    }

    read(n);
    for (int i = 1; i <= n; ++ i) {
        read(a[i]), read(b[i]);
        ++ c[maxm - a[i]][maxm - b[i]];
    }
    for (int i = 1; i < maxm << 1; ++ i)
        for (int j = 1; j < maxm << 1; ++ j)
            (c[i][j] += (c[i - 1][j] + c[i][j - 1]) % mo) %= mo;
    int ans = 0;
    for (int i = 1; i <= n; ++ i) {
        (ans += c[maxm + a[i]][maxm + b[i]]) %= mo;
        (ans += mo - C(a[i] + b[i] << 1, a[i] << 1)) %= mo;
    }
    write((long long)ans * inv2 % mo);
}

/*{{{*/
int main() 
{
    if (fopen(iput.c_str(), "r") != NULL) {
        freopen(iput.c_str(), "r", stdin);
        freopen(oput.c_str(), "w", stdout);
    }

    exec();

    fclose(stdin);
    fclose(stdout);

    return 0;
}
/*}}}*/




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

int main() 
{
    string s;
    cin>>s;
    sort(s.begin(),s.end());
    if(s=="abc")
    {
        cout<<"Yes";
        return 0;
    }
    cout<<"No";
    return 0;
}

Measured memory_bytes: 256
def num_357(ls, i, num_l):
    l = ["3", "5", "7"]
    if i > 0:
        for c in l:
            i -= 1
            ls.append(c)
            num_l.append("".join(ls))
            num_357(ls, i, num_l)
            ls.pop(-1)
            i += 1
    else:
        return

num_l = []
ls = []
i =9 

num_357(ls, i, num_l)
num_new = []
for l in num_l:
    if "3" in l and "5" in l and "7" in l:
        num_new.append(int(l))
N = int(input())
if N in num_new:
    num_new.sort()
    print(num_new.index(N)+1)
else:
    num_new.append(N)
    num_new.sort()
    print(num_new.index(N))


Measured memory_bytes: 6208
#include <bits/stdc++.h>
#define mset(a, b) memset(a, b, sizeof(a))
#define mpcy(a, b) memcpy(a, b, sizeof(a))
using namespace std;
typedef long long LL;
const int MAXN = 200005;

template <typename T> inline void read(T &AKNOI) {
	T x = 0, flag = 1;
	char ch = getchar();
	while (!isdigit(ch)) {
		if (ch == '-') flag = - 1;
		ch = getchar();
	}
	while (isdigit(ch)) {
		x = x * 10 + ch - '0';
		ch = getchar();
	}
	AKNOI = flag * x;
}

int n, fa[MAXN], f[MAXN], vis[MAXN];

struct Node {
	int c0, c1, id;
	bool operator < (const Node &rhs) const {
		return 1LL * c0 * rhs.c1 < 1LL * c1 * rhs.c0;
	}
} p[MAXN];
priority_queue<Node> q;

int getf(int x) {
	return (f[x] == x)? x : f[x] = getf(f[x]);
}

void init() {
	read(n);
	for (int i = 2; i <= n; ++i) {
		read(fa[i]);
	}
	for (int i = 1; i <= n; ++i) {
		int x; read(x);
		(x? p[i].c1 : p[i].c0) = 1;
		p[i].id = f[i] = i;
	}
}

void solve() {
	LL ans = 0;
	for (int i = 2; i <= n; ++i) {
		q.push(p[i]);
	}
	while (!q.empty()) {
		Node cur = q.top();
		q.pop();
		int u = cur.id;
		if (vis[u] || cur.c0 != p[u].c0 || cur.c1 != p[u].c1) continue;
		vis[u] = 1;
		int v = getf(fa[u]);
		ans += 1LL * p[v].c1 * p[u].c0;
		f[u] = v;
		p[v].c0 += p[u].c0;
		p[v].c1 += p[u].c1;
		if (v > 1) q.push(p[v]);
	}
	printf("%lld\n", ans);
}

int main() {
	init();
	solve();
	return 0;	
}


Measured memory_bytes: 10704
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func scanInt() int {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return i
}

func main() {
	sc.Split(bufio.ScanWords)

	N := scanInt()
	B := make([]int, N)
	for i := 0; i < N; i++ {
		a := scanInt()
		if N%2 == 0 {
			if i%2 == 0 {
				B[N/2+(i+1)/2] = a
			} else {
				B[N/2-(i+1)/2] = a
			}
		} else {
			if i%2 == 0 {
				B[N/2-(i+1)/2] = a
			} else {
				B[N/2+(i+1)/2] = a
			}
		}
	}

	for _, b := range B {
		fmt.Printf("%d ", b)
	}
	fmt.Printf("\n")
}


Measured memory_bytes: 7044
#include<bits/stdc++.h>
using namespace std;
typedef int ll;
ll read(){
	ll a=0,b=getchar(),c=1;
	while(!isdigit(b))c=b=='-'?-1:1,b=getchar();
	while(isdigit(b))a=a*10+b-'0',b=getchar();
	return a*c;
}
const ll mod=998244353;
ll n,ri,le,s0,f[1000005];
struct node{
	int x,y;
	/*bool operator<(node b)const{
		return x-y>b.x-b.y;
	}*/
}a[1000005];
int tot;
char s[1000005];
int cmp(node a,node b){
	return a.x-a.y>b.x-b.y;
}
int main(){
	n=read();
	for(int i=1;i<=n;i++){
		ll l=0,r=0;
		scanf("%s",s+1);
		for(int j=1;s[j];j++)
			if(s[j]=='(')l++;
			else{
				if(l)l--;
				else r++;
			}
		if(!l&&r)ri+=r;
		else if(l&&!r)le+=l;
		else if(l&&r)a[++tot]=(node){l,r};	
		//s0+=l-r;
	}
	//if(s0!=0)return puts("No"),0;
	sort(a+1,a+1+tot,cmp);
	for(int i=1;i<=tot;i++){
		if(le<a[i].y)
			return puts("No"),0;
		le-=a[i].y-a[i].x;
	}
	if(le!=ri)puts("No");
	else puts("Yes");
	return 0;
}

Measured memory_bytes: 5112