akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
//#pragma GCC optimize("O3")
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops")
#define pb push_back
#define IOS                                                                    \
  ios_base::sync_with_stdio(false);                                            \
  cin.tie(0);                                                                  \
  cout.tie(0);cout<<fixed<<setprecision(16);
#define ll long long int
#define ld long double
#define el '\n'
#define El '\n'
#define PI (ld)3.141592653589793238462643383279502884197169399375105820974944
#define inf (ll)1000000000
#define mod (ll)1000000007
#define mod1 (ll)998244353
#define fo(i, n) for (long long i = 0; i < n; i++)
#define pll pair<ll, ll>
#define ml map<ll,ll>
#define vpl vector<pll>
#define vvl vector<vector<ll> >
#define vvpl vector< vector<pll> >
#define ff first
#define ss second
#define pqueue priority_queue< ll >
#define pdqueue priority_queue< ll,vl ,greater< ll > >
#define mem(a,b) memset(a,b,sizeof(a));
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define sz(a) (ll)a.size()
#define f(i,a,b) for(ll i=a;i<b;i++)
#define fd(i,a,b) for(ll i=a;i>=b;i--)
#define all(a) a.begin(),a.end()
#define vl vector<ll>
//#define x ff
//#define y ss
#define pt(a) for(auto it:a)cout<<it<<" ";cout<<endl;
unsigned seed = std::chrono::system_clock::now().time_since_epoch().count();
using namespace std;

// vector
template<class T> istream& operator >> (istream &is , vector<T> &v) { for(T &a : v) is >> a; return is; }
template<class T> ostream& operator << (ostream &os , const vector<T> &v) { for(const T &t : v) os << t<<" "; return os << endl; }
// pair
template<class T, class U> ostream& operator << (ostream &os , const pair<T, U> &v) { return os << v.first << " " << v.second ; }

double gcd(double a, double b) { return a < 0.01 ? b : gcd(fmod(b, a), a); }

long long bpow(long long a, long long b, long long m) {
  a %= m;
  long long res = 1;
  while (b > 0) {
    if (b & 1)

      res = res * a % m;
      a = a * a % m;
      b >>= 1;
  }
  return res;
}


ll kv;
ll t,n,x,y,h,k,z,p,q,w,r;
string s,s1,s2;
//vvl v;
//vl vis,d;

int main() {
    IOS;
    cin>>n;
    ml m;
    fo(i,9)fo(j,9)m[(i+1)*(j+1)]++;
    if(m.count(n))cout<<"Yes";
    else cout<<"No";
    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
char s[200000];
stack<char>ha;
int main(){
	scanf("%s",s+1);
	int len=strlen(s+1);
	for(int i=1;i<=len;++i) {
		if(ha.size()&&ha.top()=='S'&&s[i]=='T') ha.pop();
		else ha.push(s[i]);
	}
	printf("%d",ha.size());
}

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

#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a, 0, sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define SIZE(array) (sizeof(array) / sizeof(array[0]))

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

#define MAX_V 100000

#define MOD 1000000007L
#define INF 100000000000

signed main() {
	int n;
	cin >> n;
	cout << (n * 800 - ((n / 15) * 200)) << endl;
}


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

using namespace std;

#define INF 1000000007
#define LINF (1LL << 62)
#define PI 3.14159265358979

typedef long long i64;
typedef pair<i64,i64> P;

inline i64 mod(i64 a, i64 m) { return (a % m + m) % m; }

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }



string s;
void solve(){
	cin >> s;
	
	int cnt = 0;
	int ans = 0;
	for(int i = 0; i < 3; i++){
		if(s[i] == 'R') cnt++;
		else{
			chmax(ans,cnt);
			cnt = 0;
		}
	}
	cout << max(ans, cnt) << endl;
}

int main(){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	int t = 1;
	//cin >> t;
	while(t--){
		solve();
	}
	
	return 0;
}

Measured memory_bytes: 3644
#include<bits/stdc++.h>
#define ll long long int
#define __ ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pi acos(-1)
using namespace std;

ll mod = 1e9+7;

int main ()
{
__

int n;
ll k,ans=0,v1,v2;

cin >> n >> k;

v1 = (k*(k-1))/2;

v2 = (k*(k+1))/2;

int a[n],b[n],c[n];

for(int i=0;i<n;i++)  cin >> a[i];

for(int cnt1,cnt2,i=0;i<n;i++)
{
cnt1 = 0;
cnt2 = 0;

for(int j=0;j<n;j++)
{
if(j<=i && a[i]>a[j]) cnt1++;

if(j>i && a[i]>a[j]) cnt2++;

}

//cout << cnt1 << " "<< cnt2 << '\n';
ans = (ans + (((v1 % mod) * (cnt1 % mod) ) % mod))% mod;

ans = (ans + (((v2 % mod) * (cnt2 % mod) ) % mod))% mod;

}

cout << ans << '\n';

return 0;
}


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

int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  for(int i=0;i<n;i++) cin >> a[i];
  n--;
  
  ll money=1000;
  ll kabu=0;
  
  for(int i=0;i<n;i++){
    if(a[i]<a[i+1]){
      kabu+=money/a[i];
      money%=a[i];
    }
    else if(a[i]>a[i+1]){
      money+=kabu*a[i];
      kabu=0;
    }
  }
  
  cout << money+kabu*a[n] << endl;
}

Measured memory_bytes: 3604
#include <stdio.h> 
int main()
{
	int n, mini, res, r, i;
    scanf("%d%d%d", &n, &mini, &r);
	res = r - mini;
    if(r < mini) mini = r;
	for (i = 2; i < n; i++) {
        scanf("%d", &r);
        if(r - mini > res) res = r - mini;
        if(r < mini) mini = r;
	}
    printf("%d\n", res);
	return 0;
}


Measured memory_bytes: 2144
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;

int main() 
{
  int count=0;

  string w,t;
  cin >> w;

  while( cin >> t ) 
  {
    if( t == "END_OF_TEXT" ) break;  
    transform( t.begin(), t.end(), t.begin(), ::tolower );
    if( t == w ) count++;
  }

  cout << count << endl;
  
  return 0;
}



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

int main() {
  int N, A, B, C, D;
  cin >> N;
  A = N / 1000;
  B = (N - A * 1000) / 100;
  C = (N - A * 1000 - B * 100) / 10;
  D = (N - A * 1000 - B * 100 - C * 10) / 1;
  
  if (A == B && B == C) {
    cout << "Yes" << endl;
  }
  else if (B == C && C == D) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 3600
#include<cstdio>
#include<iostream>
#include<cstring>
using namespace std;
char s[8010];
int x,y,n;
int cnt1,cnt2;
int maxn1,maxn2;
int h[4010],l[4010];
bool f1[4010][8010],f2[4010][8010];
int abs(int x)
{
	return (x<0?-x:x);
}
int main()
{
	scanf("%s",s+1);
	n=strlen(s+1);s[n+1]='T';
	n++;
	int nw=1;
	int mo=0;
	while (s[nw]=='F') mo++,nw++; 
	scanf("%d %d",&x,&y);
	int now=0;
	bool p=0;
	for (int i=nw;i<=n;i++)
	{
		if (s[i]=='T')
		{
			if (now)
			{
				if (p) h[++cnt1]=now,maxn1=max(now,maxn1);
				else l[++cnt2]=now,maxn2=max(now,maxn2);
			}
			p^=1;
			now=0;
		}
		else now++;
	}
//	for (int i=1;i<=cnt1;i++) cout<<h[i]<<" ";cout<<endl;
//	for (int i=1;i<=cnt2;i++) cout<<l[i]<<" ";cout<<endl;
	n--;
	x=abs(x-mo);
	y=abs(y);
	f2[0][0]=1;
	for (int i=1;i<=cnt2;i++)
		for (int j=0;j<=n;j++)
		{
			if (j-l[i]>=0)
				f2[i][j]|=f2[i-1][j-l[i]];
			if (j+l[i]<=n)
				f2[i][j]|=f2[i-1][j+l[i]];
			//cout<<i<<" "<<j<<" "<<l[i]<<" "<<f2[i][j]<<endl;
		}
	f1[0][0]=1;
	for (int i=1;i<=cnt1;i++)
		for (int j=0;j<=n;j++)
		{
			if (j-h[i]>=0)
				f1[i][j]|=f1[i-1][j-h[i]];
			if (j+h[i]<=n)
				f1[i][j]|=f1[i-1][j+h[i]];
		}
	if (f1[cnt1][y]&&f2[cnt2][x]) printf("Yes");
	else printf("No");
}

Measured memory_bytes: 33024
#include <cstdio>
#include <iostream>
#include <cstdlib>
#include <queue>
#include <cstring>
using namespace std;
int N,M,cnt=1,f,t,c,ans;
int head[100001];
bool vis[200002];
struct EDGE{
    int to,next,from;
};
EDGE edge[5005];
void add(int u,int v){
    edge[cnt].from=u;
    edge[cnt].to=v;
    edge[cnt].next=head[u];
    head[u]=cnt++;
}
void dfs(int u){
    vis[u]=true;
    c++;
    for(int i=head[u];i>0;i=edge[i].next){
        if(vis[edge[i].to])continue;
        if((u==f&&edge[i].to==t)||(u==t&&edge[i].to==f))continue;
        dfs(edge[i].to);
    }
}
int main(){
    scanf("%d%d",&N,&M);
    for(int i=1;i<=M;i++){
        int x,y;
        scanf("%d%d",&x,&y);
        add(x,y);add(y,x);
    }
    for(int i=1;i<cnt;i+=2){
        memset(vis,false,sizeof(vis));
        f=edge[i].from;
        t=edge[i].to;
        c=0;
        dfs(f);
        if(c<N)ans++;
    }
    printf("%d",ans);
    return 0;
}

Measured memory_bytes: 512
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
mod2 = 998244353
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

n,m,q = inpl()
lr = [inpl() for i in range(m)]
st = [inpl() for i in range(q)]
cnt = [[0 for j in range(n)] for i in range(n)]

for i in lr:
    a,b = i
    cnt[a-1][b-1] += 1
for i in range(n):
    for j in range(i,n-1):
        cnt[i][j+1] += cnt[i][j]
# pprint.pprint(cnt)
for i in st:
    cc = 0
    a,b = i
    for _ in range(a-1,b):
        cc += cnt[_][b-1]
    print(cc)

Measured memory_bytes: 121944
#include <iostream>
using namespace std;
typedef long long  ll;

#define rep(i,s,n)for(ll i=s;i<n;i++)
#define repe(i,s,n)for(ll i=s;i<=n;i++)

int main()
{
	ll N, Y; cin >> N >> Y;

	repe(i, 0, N) {
		repe(j, 0, N) {
			ll T = (Y - 10000 * i - 5000 * j) / 1000;
			if (T >= 0 && i + j + T == N) {
				cout << i << " " << j << " " << T << endl;
				return 0;
			}
		}
	}
	cout << "-1 -1 -1" << endl;

	return 0;
}

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

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


template<typename T>
struct PrimalDual{
  struct edge{
    Int to;
    T cap,cost;
    Int rev;
    edge(){}
    edge(Int to,T cap,T cost,Int rev):to(to),cap(cap),cost(cost),rev(rev){}
  };
  
  T INF;
  vector<vector<edge> > G;
  vector<T> h,dist;
  vector<Int> prevv,preve;

  PrimalDual(){}
  PrimalDual(Int n,T INF):INF(INF),G(n),h(n),dist(n),prevv(n),preve(n){}
  
  void add_edge(Int from,Int to,T cap,T cost){
    G[from].emplace_back(to,cap,cost,G[to].size());
    G[to].emplace_back(from,0,-cost,G[from].size()-1);
  }

  T flow(Int s,Int t,T f,Int &ok){    
    T res=0;
    fill(h.begin(),h.end(),0);
    while(f>0){    
      struct P{
        T first;
        Int second;
        P(T first,Int second):first(first),second(second){}
        bool operator<(const P&a) const{return first>a.first;}
      };      
      priority_queue<P> que;
      
      fill(dist.begin(),dist.end(),INF);
      
      dist[s]=0;
      que.emplace(dist[s],s);
      while(!que.empty()){
        P p=que.top();que.pop();
        Int v=p.second;
        if(dist[v]<p.first) continue;
        for(Int i=0;i<(Int)G[v].size();i++){
          edge &e=G[v][i];
          if(e.cap==0) continue;
          if(dist[e.to]>dist[v]+e.cost+h[v]-h[e.to]){
            dist[e.to]=dist[v]+e.cost+h[v]-h[e.to];
            prevv[e.to]=v;
            preve[e.to]=i;
            que.emplace(dist[e.to],e.to);
          }
        }
      }
      if(dist[t]==INF) return ok=0;
      
      for(Int v=0;v<(Int)h.size();v++) h[v]+=dist[v];

      T d=f;
      for(Int v=t;v!=s;v=prevv[v])
        d=min(d,G[prevv[v]][preve[v]].cap);
      
      f-=d;
      res+=d*h[t];
      for(Int v=t;v!=s;v=prevv[v]){
        edge &e=G[prevv[v]][preve[v]];
        e.cap-=d;
        G[v][e.rev].cap+=d;
      }
    }
    ok=1;
    return res;
  }
};

//INSERT ABOVE HERE
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(0);
  
  Int n;
  cin>>n;
  const Int INF2 = 1e9;
  const Int INF3 = 1e15;
  PrimalDual<Int> G(n+1,INF3);
  Int num=0,ans=0;
  for(Int i=0;i<n;i++){   
    Int k;
    cin>>k;
    num+=k;
    map<Int, Int> cnt,dst;
    for(Int j=0;j<k;j++){
      Int t,c;
      cin>>t>>c;
      t--;
      cnt[t]++;
      ans+=c+INF2;
      if(!dst.count(t)) dst[t]=c;
      chmin(dst[t],c);
    }
    
    for(auto p:cnt){
      G.add_edge(i,p.first,cnt[p.first],-INF2);
      G.add_edge(i,p.first,INF2,dst[p.first]);      
    }
      
    G.add_edge(i,n,INF2,0);
  }
  
  Int ok=1;
  ans+=G.flow(0,n,INF2,ok);  
  cout<<ans<<endl; 
  assert(ok);
  return 0;
}




Measured memory_bytes: 7640
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <valarray>
#include <vector>

#define EPS 1e-9
#define INF 1070000000LL
#define MOD 1000000007LL
#define fir first
#define foreach(it,X) for(__typeof((X).begin()) it=(X).begin();it!=(X).end();it++)
#define ite iterator
#define mp make_pair
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define pb push_back
#define sec second
#define sz(x) ((int)x.size())

using namespace std;

struct timer{
	time_t start;
	timer(){start=clock();}
	~timer(){cerr<<1.*(clock()-start)/CLOCKS_PER_SEC<<" secs"<<endl;}
};

typedef istringstream iss;
typedef long long ll;
typedef pair<int,int> pi;
typedef stringstream sst;
typedef vector<int> vi;

int V,E;
string g[1010];
int odd,even;
int used[1010];

int dfs(int cur){
	int res=1;
	used[cur]=1;
	rep(i,V)if(g[cur][i]=='Y' && !used[i]){
		res+=dfs(i);
	}
	return res;
}

int main(){
	cin.tie(0);
	ios_base::sync_with_stdio(0);
	
	cin>>V;
	rep(i,V)cin>>g[i];
	rep(i,V)rep(j,V)E+= g[i][j]=='Y';
	E/=2;
	rep(i,V)if(!used[i]){
		if(dfs(i)%2==1)odd++;
		else even++;
	}
	if(V%4==1){
		cout<<(E%2==1 ? "Taro":"Hanako")<<endl;
	}
	else if(V%4==3){
		cout<<(E%2==0 ? "Taro":"Hanako")<<endl;
	}
	else{
		int taro;
		if(V%4==0)taro=1 ^ (E%2);
		if(V%4==2)taro=0 ^ (E%2);
		if(taro==1){
			if(odd+even==2)cout<<(odd==2 ? "Taro":"Hanako")<<endl;
			else cout<<(even==1 ? "Taro":"Hanako")<<endl;
		}else{
			cout<<(even>=1 ? "Taro":"Hanako")<<endl;
		}
	}
}

Measured memory_bytes: 2268
#include <bits/stdc++.h>
#define exrep(i, a, b) for(long long i = a; i <= b; i++)
#define rep(i,n)for(long long i=0;i<(long long)(n);i++)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
 
const ll MOD=1e9+7;
const ll INF=1e18;
const int MAX=510000;
const double pi=acos(-1);
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
ll modpow(ll a, ll n){
  if(n==0)return 1;
  if(n%2==0){
    ll t=modpow(a,n/2);
    return t*t%MOD;
  }
  return a*modpow(a,n-1)%MOD;
}
ll modinv(ll a){
  return modpow(a,MOD-2);
}
long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
struct UnionFind {
    vector<int> par; // 親ノード
    vector<int> rank; // ランク

    UnionFind(int n = 1) {
        init(n);
    }

    void init(int n = 1) {
        par.resize(n); rank.resize(n);
        for (int i = 0; i < n; ++i) par[i] = i, rank[i] = 0;
    }

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

    bool issame(int x, int y) {
        return root(x) == root(y);
    }

    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (rank[x] < rank[y]) swap(x, y);
        if (rank[x] == rank[y]) ++rank[x];
        par[y] = x;
        return true;
    }
};

    
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false); 
  COMinit();
  
  ll n;
  cin >> n;
  string s,t;
  cin >> s >> t;
  ll ans=1;
  int kind=0;
  rep(i,n){
    if(i==0){
      if(s[0]==t[0]){
        ans*=3;
        kind=0;
      }
      else{
        ans*=6;
        kind=1;
        i++;
      }
    }
    else{
      if(s[i]==t[i] && kind==0){
        ans*=2;
        ans%=MOD;
        kind=0;
      }
      else if(s[i]==t[i] && kind==1){
        ans*=1;
        ans%=MOD;
        kind=0;
      }
      else if(s[i]!=t[i] && kind==1){
        ans*=3;
        ans%=MOD;
        kind=1;
        i++;
      }
      else if(s[i]!=t[i] && kind==0){
        ans*=2;
        ans%=MOD;
        kind=1;
        i++;
      }
    }
  }
  cout << ans << endl;
           

}


Measured memory_bytes: 12160
//author rhythmicankur
                                                                  //god_is_almighty
#pragma GCC optimize("O3")
#pragma GCC target ("sse4")
#include<bits/stdc++.h>
#define f 		first
#define s 		second
#define ll 		int
#define int 		long long
#define ld 		long double
#define pb 		push_back
#define eb 		emplace_back
#define mk 		make_pair
#define vi 		vector<int>
#define pii 		pair<int,int>
#define vpi 		vector<pii>
#define trav(a, x)      for(auto& a : x)
#define all(x)          x.begin(), x.end()
#define fill(a,val)	memset(a,val,sizeof(a))
#define fori(a,b,c) for(register int i=a;i<b;i+=c)
#define ford(a,b,c) for(register int i=a;i>=b;i-=c)
#define 	PI acos(-1)
#define coud(a,b) cout<<fixed << setprecision((b)) << (a)
#define M1 	998244353
#define M2 	1000000007
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
template<typename T> T gcd(T a,T b) { if(a==0) return b; return gcd(b%a,a); } 
#define test4(x,y,z,a) 		cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<"  |  "<<#a<<": "<<a<<endl;
#define test1(x)                cerr<<#x<<": "<<x<<endl
#define test2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define test3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
ll power(ll a,ll b,ll m=M2){ll answer=1;while(b){if(b&1)answer=(answer*a)%m;b/=2;a=(a*a)%m;}return answer;}
using namespace std;
void ctrl()
{
	cout<<"Control\n";
}
signed main()
{	ios::sync_with_stdio(0);
	cin.tie(0); 
	cin.exceptions(cin.failbit);
	int	x,a;
 cin>>x>>a;
 if(x<a)
   cout<<0;
 else
   cout<<10;

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);
		
		
		String input = sc.nextLine();
		String[] parts = input.trim().split(" ");
		
		int a = Integer.parseInt(parts[0]);
		int b = Integer.parseInt(parts[2]);
		
		int res = 0;
		if (parts[1].equals("+")) {
			res = a + b;
		} else {
			res = a - b;
		}
		
		System.out.println(res);
	}
}


Measured memory_bytes: 9680
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
use std::io::Read;
#[allow(dead_code)]
fn getline() -> String {
    let mut ret = String::new();
    std::io::stdin().read_line(&mut ret).ok().unwrap();
    ret
}
fn get_word() -> String {
    let mut stdin = std::io::stdin();
    let mut u8b: [u8; 1] = [0];
    loop {
        let mut buf: Vec<u8> = Vec::with_capacity(16);
        loop {
            let res = stdin.read(&mut u8b);
            if res.unwrap_or(0) == 0 || u8b[0] <= b' ' {
                break;
            } else {
                buf.push(u8b[0]);
            }
        }
        if buf.len() >= 1 {
            let ret = String::from_utf8(buf).unwrap();
            return ret;
        }
    }
}

#[allow(dead_code)]
fn get<T: std::str::FromStr>() -> T { get_word().parse().ok().unwrap() }

fn solve() {
    let n = get();
    let mut tot = 0;
    for _ in 0 .. n {
        let l: i64 = get();
        let r: i64 = get();
        tot += r - l + 1;
    }
    println!("{}", tot);
}

fn main() {
    // In order to avoid potential stack overflow, spawn a new thread.
    let stack_size = 104_857_600; // 100 MB
    let thd = std::thread::Builder::new().stack_size(stack_size);
    thd.spawn(|| solve()).unwrap().join().unwrap();
}


Measured memory_bytes: 8572
import java.util.*;
import java.math.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    String luckyNum = sc.next();
    int[] s1 = new int[10];
    int[] s2 = new int[100];
    int[] s3 = new int[1000];
    checkStr(luckyNum, 0, "", s1, s2, s3);
    int out = 0;
    for (int i:s3) if (i == 1) out++;
    System.out.println(out);
  }

  public static void checkStr(String luckyNum, int idx, String s, int[] s1, int[] s2, int[] s3) {
    if (s.length() == 3) {
      s3[Integer.valueOf(s)] = 1;
      return;
    }
    if (idx == luckyNum.length()) return;

    if (s.length() == 0) {
      for (int i = idx; i < luckyNum.length()-2; i++) checkStr(luckyNum, i+1, s+luckyNum.charAt(i), s1, s2, s3);
    } else if (s.length() == 1) {
      if (s1[Integer.valueOf(s)] != 1) {
        for (int i = idx; i < luckyNum.length()-1; i++) checkStr(luckyNum, i+1, s+luckyNum.charAt(i), s1, s2, s3);
        s1[Integer.valueOf(s)] = 1;
      }
    } else if (s.length() == 2) {
      if (s2[Integer.valueOf(s)] != 1) {
        for (int i = idx; i < luckyNum.length(); i++) checkStr(luckyNum, i+1, s+luckyNum.charAt(i), s1, s2, s3);
        s2[Integer.valueOf(s)] = 1;
      }
    }
  }
}


Measured memory_bytes: 184648
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
    string s;
    cin >> s;
    vector<unsigned long long> p[26];
    for(int i = 0; i < s.size(); i++){
        p[s[i] - 'a'].push_back(i + 1);
    }
    unsigned long long ans = 0;
    string t;
    cin >> t;
    for(auto&& i : t){
        if(p[i - 'a'].empty()){
            cout << "-1\n";
            return 0;
        }
        auto point = upper_bound(begin(p[i - 'a']), end(p[i - 'a']), ans % s.size());
        if(point == end(p[i - 'a'])){
            point = upper_bound(begin(p[i - 'a']), end(p[i - 'a']), 0);
            ans += s.size();
        }
        ans /= s.size();
        ans *= s.size();
        ans += *point;
    }
    cout << ans << "\n";
}

Measured memory_bytes: 1536
h, w, k = map(int,input().split())
S = [list(map(int, list(input()))) for _ in range(h)]

ans = 10**9+7

for i in range(1<<(h-1)):
    box = [[0] * w]
    bcnt = 0 #縦のindex

    box[bcnt] = [s + b for s, b in zip(S[0], box[bcnt])]

    #横に適当に線を入れる(=その分のboxを増やす)
    #線が入らなかったらその区画にそのまま値を入れる
    #区画ごとの畳み込み
    for j in range(1, h):
        if (i >> (j-1)) & 1:
            bcnt += 1
            box.append([0] * w)
        box[bcnt] = [s + b for s, b in zip(S[j], box[bcnt])]

    #
    if not all([all([i<=k for i in b]) for b in box]):
        continue

    
    cutcnt = len(box) - 1 #すでに縦にに切っている分の個数
    cnt = [0] * len(box)    #区画ごとのcntのbox
    #縦ごとにグループに白チョコの個数を追加していく
    for m in range(w):
        for n in range(len(box)):
            cnt[n] += box[n][m] #n番目のグループにbox n番目m列目の個数を追加する
        if any([c > k for c in cnt]):  #グループ内白チョコの個数がkを超えているグループが1つでもあったら縦線を1つ追加する
            cutcnt += 1
            #個数がオーバーしたので改めて今の列を新しいグループの最初の列としてこれから白チョコを追加していく
            for n in range(len(box)):
                cnt[n] = box[n][m]
    ans = min(ans, cutcnt)

print(ans)

Measured memory_bytes: 56412
#include "bits/stdc++.h"
#define rep(i,b) for(ll i=0;i<b;i++)
#define ll long long
using namespace std;
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vvvl vector<vector<vector<ll>>>
#define debug(x) cerr<<#x<<" "<<x<<'\n';
bool cmp(pair<ll,ll> a, pair<ll,ll> b) { return a.second < b.second; }
ll mod = 1e9+7;

signed main() {
    ll decimal,x; cin>>decimal>>x;
    ll base=0;
    ll binary=0;
    while(decimal>0){
        binary = binary + ( decimal % x ) * base;
        decimal = decimal / x;
        base++;
    }
    cout<<base<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include <boost/multiprecision/cpp_ll.hpp>
//typedef boost::multiprecision::cpp_ll ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E16;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
string alp="abcdefghijklmnopqrstuvwxyz";
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);


int main(){
    ll n,m;cin>>n>>m;
    ll s[n+1],t[m+1];rep(i,1,n)cin>>s[i];
    rep(i,1,m)cin>>t[i];
    ll dp[n+1][m+1];
    rep(i,0,n){
        dp[i][0]=1;
    }
    rep(i,0,m){
        dp[0][i]=1;
    }
    rep(i,0,n-1){
        rep(j,0,m-1){
            if(s[i+1]!=t[j+1]){
                dp[i+1][j+1]=((dp[i+1][j]+dp[i][j+1]-dp[i][j])%i_7+i_7)%i_7;
            }else{
                dp[i+1][j+1]=(dp[i+1][j]+dp[i][j+1])%i_7;
            }
        }
    }
    cout<<dp[n][m]<<endl;
    
    
    
    return 0;
}




Measured memory_bytes: 31616
#include <cstdio>
#include <iostream>
#include <string>
#include <cstdlib>
#include <list>
using namespace std;
list<int> l;
int main()
{
  for(;;){
    int n,m,i;
    scanf("%d %d",&m,&n);
    if(m == 0) break;
    string dummy;
    getline(cin,dummy);
    l.clear();
    for(i=1; i<=m; i++){
      l.push_back(i);
    }
    list<int>::iterator it = l.begin();
    for(i=1; i<=n; i++){
      string s;
      getline(cin,s);
      if(l.size() == 1) continue;
      if(i % 15 == 0){
        if(s != "FizzBuzz"){
          it = l.erase(it);
        }else{
          it++;
        }
      }else if(i % 3 == 0){
        if(s != "Fizz"){
          it = l.erase(it);
        }else{
          it++;
        }
      }else if(i % 5 == 0){
        if(s != "Buzz"){
          it = l.erase(it);
        }else{
          it++;
        }
      }else{
        int j = atoi(s.c_str());
        if(j != i){
          it = l.erase(it);
        }else{
          it++;
        }
      }
      if(it == l.end()){
        it = l.begin();
      }
    }
    it = l.begin();
    printf("%d",*it);
    it++;
    for(; it != l.end(); it++){
      printf(" %d",*it);
    }
    printf("\n");
  }
  return 0;
}

Measured memory_bytes: 1288
#!/usr/bin/env python
N = int(input())
if N < 9:
    print(N)
    exit(0)
n = 0
while True:
    nxt = n * 10 + 9
    if nxt > N:
        break
    n = nxt

ans = n
for i in range(1, 10):
    n1 = int(str(i) + str(n))
    if n1 <= N:
        ans = n1
s = 0
while(ans):
    s += ans % 10
    ans = ans // 10
print(s)


Measured memory_bytes: 3060
#include <iostream>
#include <fstream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cassert>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <bitset>
#include <algorithm>
#include <iomanip>

using namespace std;

#define forn(i,n) for (int i = 0; i < int(n); i++)
#define ford(i,n) for (int i = int(n) - 1; i >= 0; i--)
#define fore(i,l,r) for (int i = int(l); i <= int(r); i++)
#define all(a) a.begin(), a.end()
#define sz(a) int(a.size())
#define mp make_pair
#define pb push_back
#define ft first
#define sc second
#define x first
#define y second

template<typename X> inline X abs(const X& a) { return a < 0 ? -a : a; }
template<typename X> inline X sqr(const X& a) { return a * a; }

typedef long long li;
typedef long double ld;
typedef pair<int, int> pt;

const int INF = int(1e9);
const li INF64 = li(1e18);
const ld EPS = 1e-9;
const ld PI = acosl(ld(-1));

const int N = 2 * 100 + 13;
int n;
int a[N];

inline bool read()
{
	if (scanf ("%d", &n) != 1)
		return false;
	forn (i, 2 * n)
		assert(scanf ("%d", &a[i]) == 1);
	return true;
}

inline void solve()
{
	sort(a, a + 2 * n);
	
	li ans = 0;
	for (int i = 0; i + 1 < 2 * n; i += 2)
		ans += a[i];
		
	cout << ans << endl;
}

int main()
{
#ifdef SU2_PROJ
	assert(freopen("input.txt", "r", stdin));
	assert(freopen("output.txt", "w", stdout));
#endif

	cout << setprecision(25) << fixed;
	cerr << setprecision(10) << fixed;

	srand(int(time(NULL)));

	assert(read());
	solve();

#ifdef SU2_PROJ
	cerr << "TIME: " << clock() << endl;
#endif

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int maxn=2e5+7;
const LL mod=998244353;
LL n,m,k;
LL p[maxn];
LL po(LL x,LL N)
{
    LL ans=1;
    LL tmp=x%mod;
    while(N){
        if(N&1){
            ans=ans*tmp;
            ans%=mod;
        }
        tmp*=tmp;
        tmp%=mod;
        N/=2;
    }
    return ans%mod;
}
int main()
{
    p[0]=1;
    p[1]=1;
    for(LL i=2;i<=maxn-5;i++){
        p[i]=p[i-1]*i;
        p[i]%=mod;
    }
    scanf("%lld%lld%lld",&n,&m,&k);
    LL res=0;
    res=m%mod;
    res=res*po(m-1,n-1);
    res%=mod;
    for(LL i=1;i<=k;i++){
      LL pre=m%mod;
      pre*=p[n-1];
      pre%=mod;
      pre*=po(p[i],mod-2);
      pre%=mod;
      pre*=po(p[n-1-i],mod-2);
      pre%=mod;
      pre*=po(m-1,n-1-i);
      pre%=mod;
      res+=pre;
      res%=mod;
      //printf("%lld\n",res);
    }
    printf("%lld\n",res%mod);
    return 0;
}


Measured memory_bytes: 5392
def getval():
    h,w = map(int,input().split())
    a = [input() for i in range(h)]
    return h,w,a 

def main(h,w,a):
    mod = 10**9 + 7
    dp = [[0 for i in range(w+1)] for i in range(h+1)]
    dp[1][1] = 1
    for i in range(1,h+1):
        for j in range(1,w+1):
            if i==1 and j==1:
                continue
            if a[i-1][j-1]=="#":
                continue
            dp[i][j] = (dp[i-1][j] + dp[i][j-1]) % mod
    print(dp[h][w])

if __name__=="__main__":
    h,w,a = getval()
    main(h,w,a) 

Measured memory_bytes: 83564
from collections import deque
from heapq import heapify,heappop,heappush,heappushpop
from copy import copy,deepcopy
from itertools import product,permutations,combinations,combinations_with_replacement
from collections import defaultdict,Counter
from bisect import bisect_left,bisect_right
from math import gcd,ceil,floor,factorial
# from fractions import gcd
from functools import reduce
from pprint import pprint
from statistics import mean,median,mode

INF = float("inf")

def mycol(data,col):
    return [ row[col] for row in data ]

def mysort(data,col,reverse_flag):
    data.sort(key=lambda x:x[col],reverse=reverse_flag)
    return data

def mymax(data):
    M = -1*float("inf")
    for i in range(len(data)):
        m = max(data[i])
        M = max(M,m)
    return M

def mymin(data):
    m = float("inf")
    for i in range(len(data)):
        M = min(data[i])
        m = min(m,M)
    return m

def mycount(ls,x):
    # lsはソート済みであること
    l = bisect_left(ls,x)
    r = bisect_right(ls,x)
    return (r-l)

def myoutput(ls,space=True):
    if space:
        if len(ls)==0:
            print(" ")
        elif type(ls[0])==str:
            print(" ".join(ls))
        elif type(ls[0])==int:
            print(" ".join(map(str,ls)))
        else:
            print("Output Error")
    else:
        if len(ls)==0:
            print("")
        elif type(ls[0])==str:
            print("".join(ls))
        elif type(ls[0])==int:
            print("".join(map(str,ls)))
        else:
            print("Output Error")

def I():
    return int(input())

def MI():
    return map(int,input().split())

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

def CI(n):
    return [ int(input()) for _ in range(n) ]

def LI(n):
    return [ list(map(int,input().split())) for _ in range(n) ]

def S():
    return input()

def MS():
    return input().split()

def RS():
    return list(input())

def CS(n):
    return [ input() for _ in range(n) ]

def LS(n):
    return [ list(input()) for _ in range(n) ]

# ddict = defaultdict(lambda: 0)
# ddict = defaultdict(lambda: 1)
# ddict = defaultdict(lambda: int())
# ddict = defaultdict(lambda: list())
# ddict = defaultdict(lambda: float())

n,k = MI()
a = RI()

ind = a.index(1)
ans = INF

if ind>(k-1) and ind<(n-k):
    for i in range(ind-k+1,ind+k):
        # print('i={}'.format(i))
        m = 0
        m += ceil(i/(k-1))
        m += ceil((n-i-1)/(k-1))
        ans = min(ans,m)
        # print('ans={}'.format(ans))
elif ind<=(k-1):
    ans = 0
    ans += ceil((n-k)/(k-1)) + 1
else:
    ans = 0
    ans += ceil((n-k)/(k-1)) + 1

print(ans)

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

int main() {
    int n;
    cin >> n;
    int ans = 0;
    int searchNum = 1;
    int tmpNum;
    for(int i = 0; i<n;i++ ){
        cin >> tmpNum;
        if(tmpNum == searchNum) searchNum++;
        else ans++;
    }
    if(n==ans)ans=-1;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;
int n;
typedef long long ll;
ll ans,a[60];
int main(){
    scanf("%d",&n);
    for(int i=1;i<=n;++i){
        cin>>a[i];
    }
    ll* p;
    while(*(p=max_element(a+1,a+n+1)) >= (ll)n){
        for(int i=1;i<=n;++i){
            if(a+i!=p){
                a[i]+=(*p)/(ll)n;
            }
        }
        ans+=(*p)/(ll)n;
        (*p)%=(ll)n;
    }
    cout<<ans<<endl;
    return 0;
}

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

using namespace std;

int f[60][30];
int memo[2][60][30];
int lx[9] = { 1, 1, 2, 1, 2, 3, 1, 2, 1};
int ly[9] = {-2,-1,-1, 0, 0, 0, 1, 1, 2};
int rx[9] = {-1,-1,-2,-1,-2,-3,-1,-2,-1};
int ry[9] = {-2,-1,-1, 0, 0, 0, 1, 1, 2};
int w,h;
class state{
public:
    int foot;
    int x;
    int y;
    int cost;

    state(int f,int x, int y, int c):foot(f),x(x),y(y),cost(c){}
};

#define INF 1 << 29

int main(){
    char tmp;
    while(cin >> w >> h){
        if((w|h) == 0) break;
        deque<state> q;
        vector<pair<int,int> > v;
        fill((int *)memo, (int *)memo+2*60*30, INF);
        
        for(int i=0;i<h;i++){
            for(int j=0;j<w;j++){
                cin >> tmp;
                if(tmp == 'X'){
                    f[i][j] = INF;
                }else if(tmp == 'S'){
                    f[i][j] = 0;
                    q.push_back(state(0,j,i,0));
                    q.push_back(state(1,j,i,0));
                    memo[0][i][j] = 0;
                    memo[1][i][j] = 0;
                }else if(tmp == 'T'){
                    f[i][j] = 0;
                    v.push_back(make_pair(i,j));
                }else{
                    f[i][j] = tmp - '0';
                }
            }
        }
        
        int tx,ty,tf,tc,nx,ny;
        int ret = INF;
        while(!q.empty()){
            tx = q.front().x;
            ty = q.front().y;
            tf = q.front().foot; //0:left 1:right
            tc = q.front().cost;

            //cout << "(" << tf << ")" << ty << " " << tx << " " << tc << endl;
            q.pop_front();

            for(int i=0;i<9;i++){
                if(tf == 0){
                    nx = tx + lx[i];
                    ny = ty + ly[i];
                }else{
                    nx = tx + rx[i];
                    ny = ty + ry[i];
                }

                //cout << "ny =" << ny << " nx = " << nx << endl;
                if(!(0 <= nx && nx < w && 0 <= ny && ny < h)){
                    continue;
                }else{
                    if(tc+f[ny][nx] < memo[1-tf][ny][nx]){
                        memo[1-tf][ny][nx] = tc+f[ny][nx];
                        q.push_back(state(1-tf,nx,ny,memo[1-tf][ny][nx]));
                    }
                }
            }
        }

        for(int i=0;i<v.size();i++){
            ret = min(ret, memo[0][v[i].first][v[i].second]);
            ret = min(ret, memo[1][v[i].first][v[i].second]);
        }

        if(ret == INF){
            cout << -1 << endl;
        }else{
            cout << ret << endl;
        }
    }
}

Measured memory_bytes: 1320
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define MM 1000000000;
#define mod MM + 7;
#define INF (ll)1e18
#define pi acos(-1.0)
#define MAX 100005
#define NIL -1
int main(){
    int n; cin >> n;
    int h[n];
    for(int i = 0; i < n; i++){
        cin >> h[i];
    }
    int ans = 0;
    for(int l = 0; l < n; l++){
        while(h[l] > 0){
            int r;
            for(r = l + 1; r < n; r++){
                if(h[r] == 0) break;
            }
            for(int x = l; x < r; x++){
                --h[x];
            }
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#ifdef LOCAL
//#define _GLIBCXX_DEBUG
#endif
//#pragma GCC target("avx512f,avx512dq,avx512cd,avx512bw,avx512vl")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<int, int> Pi;
typedef vector<ll> Vec;
typedef vector<int> Vi;
typedef vector<string> Vs;
typedef vector<char> Vc;
typedef vector<P> VP;
typedef vector<vector<ll>> VV;
typedef vector<vector<int>> VVi;
typedef vector<vector<char>> VVc;
typedef vector<vector<vector<ll>>> VVV;
typedef vector<vector<vector<vector<ll>>>> VVVV;

#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define PER(i, a, b) for(ll i=(a); i>=(b); i--)
#define rep(i, n) REP(i, 0, n)
#define per(i, n) PER(i, n, 0)
const ll INF=1e18+18;
const ll MOD=1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;
#define ALL(v) v.begin(), v.end()
#define rALL(v) v.rbegin(), v.rend()
#define pb(x) push_back(x)
#define mp(a, b) make_pair(a,b)
#define Each(a,b) for(auto &a :b)
#define rEach(i, mp) for (auto i = mp.rbegin(); i != mp.rend(); ++i)
#ifdef LOCAL
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define dbgmap(mp) cerr << #mp << ":"<<endl; for (auto i = mp.begin(); i != mp.end(); ++i) { cerr << i->first <<":"<<i->second << endl;}
#define dbgset(st) cerr << #st << ":"<<endl; for (auto i = st.begin(); i != st.end(); ++i) { cerr << *i <<" ";}cerr<<endl;
#define dbgarr(n,m,arr) rep(i,n){rep(j,m){cerr<<arr[i][j]<<" ";}cerr<<endl;}
#define dbgdp(n,arr) rep(i,n){cerr<<arr[i]<<" ";}cerr<<endl;
#else
#define dbg(...)
#define dbgmap(...)
#define dbgset(...)
#define dbgarr(...)
#define dbgdp(...)
#endif
#define out(a) cout<<a<<endl
#define out2(a,b) cout<<a<<" "<<b<<endl
#define vout(v) rep(i,v.size()){cout<<v[i]<<" ";}cout<<endl
#define Uniq(v) v.erase(unique(v.begin(), v.end()), v.end())
#define fi first
#define se second

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }

template<typename T1, typename T2>
ostream &operator<<(ostream &s, const pair<T1, T2> &p) { return s<<"("<<p.first<<", "<<p.second<<")"; }

template<typename T>istream& operator>>(istream&i,vector<T>&v)
{rep(j,v.size())i>>v[j];return i;}

// vector
template<typename T>
ostream &operator<<(ostream &s, const vector<T> &v) {
    int len=v.size();
    for(int i=0; i<len; ++i) {
        s<<v[i];
        if(i<len-1) s<<"	";
    }
    return s;
}

// 2 dimentional vector
template<typename T>
ostream &operator<<(ostream &s, const vector<vector<T> > &vv) {
    int len=vv.size();
    for(int i=0; i<len; ++i) {
        s<<vv[i]<<endl;
    }
    return s;
}

int solve(){
    ll n;
    cin>>n;
    if(n==0){
        out(1);
    }else{
        out(0);
    }
    return  0;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<std::setprecision(10);
//    ll T;
//    cin>>T;
//    while(T--)
    solve();
}


Measured memory_bytes: 3680
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<random>
#include<array>
#include<cassert>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())




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

	int n, h, w;
	cin >> n >> h >> w;
	cout << (n - h + 1)*(n - w + 1) << endl;


	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define IO_OP std::ios::sync_with_stdio(0); std::cin.tie(0);
#define F first
#define S second
#define V vector
#define PB push_back
#define MP make_pair
#define EB emplace_back
#define ALL(v) (v).begin(), (v).end()
#define debug(x) cerr << #x << " is " << x << endl
#define endl '\n'

using namespace std;

typedef long long ll;
typedef pair<int, int> pi;
typedef V<int> vi;

const int INF = 1e9 + 7;

int d[303][303];
int vis[303][303];

vi G[303];

signed main()
{
	setvbuf ( stdout , NULL , _IOFBF , 1000000 );
	int n, m, l;
	scanf("%d%d%d", &n, &m, &l);
	memset(d, 0x3f, sizeof d);
	for(int i=1;i<=n;i++) d[i][i] = 0;
	for(int i=0,u,v,c;i<m;i++) {
		scanf("%d%d%d", &u, &v, &c);
		d[u][v] = d[v][u] = c;
	}
	for(int k=1;k<=n;k++)
		for(int i=1;i<=n;i++)
			for(int j=1;j<=n;j++)
				d[i][j] = min(d[i][j], min((d[i][k] + d[k][j]), l+1));
	for(int i=1;i<=n;i++)
		for(int j=1;j<i;j++)
			if(d[i][j] <= l) 
				G[i].PB(j), G[j].PB(i);

	for(int s=1;s<=n;s++) {
		for(int i=1;i<=n;i++) vis[s][i] = -1;
		vi queue;		
		queue.PB(s); vis[s][s] = 0;
		for(int i=0;i<queue.size();i++) {
			int v = queue[i];
			for(int u:G[v]) {
				if(vis[s][u] == -1) {
					vis[s][u] = vis[s][v] + 1;
					queue.PB(u);
				}
			}
		}
		for(int i=1;i<=n;i++) if(vis[s][i] != -1) vis[s][i]--;
	}

	int q;
	scanf("%d", &q);
	for(int s, t;q--;) {
		cin >> s >> t;
		cout << vis[s][t] << endl;
	}
}





Measured memory_bytes: 1792
package main

import "fmt"

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

	ans := 0.0
	for i := 1; i <= n; i++ {
		v := i
		p := 1.0 / float64(n)
		for v < k {
			p /= 2.0
			v *= 2
		}
		ans += p
	}
	fmt.Println(ans)
}


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

int main(){
    int x=0;
    int fc=0,sc=0;
    for(int i=0;i<3;i++){
    	cin >> x;
    	if(x==5){
    		fc++;
    	}
        else if(x==7){
        	sc++;
        }
    }
    //cout << fc << " " << sc;
    if(fc==2&&sc==1){
    	cout << "YES" << endl;
    }
    else{
    	cout << "NO" << endl;
    }
	return 0;
}

Measured memory_bytes: 3608
import sys
input = sys.stdin.readline

# 解説AC
def main():
    N = int(input())
    A = list(map(int, input().split()))
    B = list(map(int, input().split()))
    n = 0
    for a, b in zip(A, B):
        if a > b:
            n += a - b
    for a, b in zip(A, B):
        if a < b:
            n -= (b - a)//2
    if n <= 0:
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()


Measured memory_bytes: 4468
#include <cstdlib>
#include <cmath>
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <cstring>
#include <string>
#include <map>
#include <list>
#define MOD 1000000007
#define INF 1000000000
typedef long long ll;
using namespace std;
typedef pair<int,int> P;

int main(void){
    int n;
    cin>>n;
    list<int>l;
    for(int i=1;i<=n;i++){
        int tmp;
        cin>>tmp;
        if(i%2){
            l.push_back(tmp);
        }else{
            l.push_front(tmp);
        }
    }
    if(n%2)l.reverse();
    list<int>::iterator it;
    bool first=true;
    for(it=l.begin();it!=l.end();it++){
        if(first==false)printf(" ");
        cout<<*it;
        first=false;
    }
    cout<<endl;

    return 0;
}


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


int main()
{/*
#ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
#*/
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  
  int a,b,c,d,e;
  cin>>a>>b>>c>>d>>e;
  if(a == 0)
  cout<<1;
  else if(b == 0)
  cout<<2;
  else if(c == 0)
  cout<<3;
  else if (d == 0)
  cout<<4;
  else
  cout<<5;
   return 0;
}


Measured memory_bytes: 3620
#include <iostream>

using namespace std;

int main(){
	int N,M,C;
	int b[M];
	cin >> N >> M >> C;
	for(int i=0;i<M;i++){
		cin >> b[i];
	}
	int a[N][M];
	for(int i=0;i<N;i++){
		for(int j=0;j<M;j++){
			cin >> a[i][j];
		}
	}

	int check=0;
	for(int i=0;i<N;i++){
		int ans=C;
		for(int j=0;j<M;j++){
			ans+=a[i][j]*b[j];
		}
		if(ans>0){
			check++;
		}
	}
	cout << check << endl;
	return 0;
}



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

n=0
sm=0
if A[0]>0:
  mn=A[0]
else:
  mn=(-1)*A[0]


for i in range(0,N):
  if A[i]<0:
    n=n+1
    sm=sm-A[i]
    if (-1)*A[i]<mn:
      mn=(-1)*A[i]
  else:
    sm=sm+A[i]
    if A[i]<mn:
      mn=A[i]
if n%2==0:
  print(sm)
else:
  print(sm-2*mn)

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

struct node{
    struct node *right;
    struct node *left;
    struct node *parent;
    int key;
};
typedef struct node * Node;
#define NIL NULL

Node root;

Node treeSearch(Node u,int k){
    while(u != NIL && k != u->key){
        if(k < u->key){
            u = u->left;
        }
        else u = u->right;
    }
    return u;
}

void insert(int k){
    Node y = NIL;
    Node x = root;
    Node z;

    z = malloc(sizeof(struct node));
    z->key = k;
    z->left = NIL;
    z->right = NIL;

    while(x!=NIL){
        y = x;
        if(z->key < x->key){
            x = x->left;
        }
        else{
            x = x->right;
        }
    }
    z->parent = y;
    if(y == NIL){
        root = z;
    }
    else{
        if(z->key < y->key){
            y->left = z;
        }
        else{
            y->right = z;
        }
    }
}

void inorder(Node u){
    if(u == NIL){
        return;
    }
    inorder(u->left);
    printf(" %d",u->key);
    inorder(u->right);
}

void preorder(Node u){
    if(u == NIL){
        return;
    }
    printf(" %d",u->key);
    preorder(u->left);
    preorder(u->right);
}

int main(){
    int n,i,x;
    char com[20];
    Node t;
    scanf("%d",&n);

    for(i=0;i<n;i++){
        scanf("%s",com);
        if(com[0] == 'f'){
            scanf("%d",&x);
            t = treeSearch(root,x);
            if(t != NIL) printf("yes\n");
            else printf("no\n");
        }
        else if(com[0] == 'i'){
            scanf("%d",&x);
            insert(x);
        }
        else if(com[0] == 'p'){
            inorder(root);
            printf("\n");
            preorder(root);
            printf("\n");
        }
    }

    return 0;
}


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

int main() {
  int N;
  cin >> N;
  
  vector<int> btn(N); 
 
  for (int i = 0; i < N; i++) {
    cin >> btn.at(i);
  }
  
  int Cbtn = 1;
  int cunt = 0;
  for (int i=0; i < N + 3 ; i++){
     if(btn.at(Cbtn-1) == 2){
        cunt++;
        break;
     }
     else{
     Cbtn = btn.at(Cbtn-1);
     cunt++;
     }
     if(i == N+2){
        cunt = -1;
        break;
     }
  } 
  cout << cunt << endl;
}


Measured memory_bytes: 3764