akhauriyash/Code-Regression huggingface dataset:
// g++ macro.cpp -std=c++14
#include <bits/stdc++.h> //STL include
typedef long long ll;// long long int
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
using namespace std;//namespace

#define dump(x)  cout << #x << " = " << (x) << endl;// debug cout
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl;
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl;

#define SANKOU(n,a,b) cout << ((n) ? (a) : (b) ) << endl;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)// for macro
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)

#define FOREACH(x,a) for(auto& (x) : (a) )

#define WFA(d,v) REP(k,v)REP(i,v)REP(j,v)d[i][j]=min(d[i][j],d[i][k]+d[k][j]);// warshall-floyd

#define CIN(x) int x;cin>>x;
#define SCIN(x) string x;cin>>x;
#define COUT(x) cout<<(x)<<endl;
#define SCOUT(x) cout<<(x)<<" ";
#define ENDL cout<<endl;

#define VECCIN(x) for(auto&youso_: (x) )cin>>youso_;
#define VECCOUT(x) for(auto&youso_: (x) )cout<<youso_<<" ";cout<<endl;

#define ALL(obj) (obj).begin(),(obj).end()// iterator

#define UNIQUE(obj) sort(ALL( obj )); obj.erase(unique(ALL(obj)),obj.end());

#define P pair<int,int>
#define V vector<int>
#define M map<int,int>

#define pb(a) push_back(a)//push_back
#define mp make_pair// make_pair


int main(){

    CIN(n);
    vector<ll> a(n);
    V b(n);
    REP(i,n)cin>>a[i]>>b[i];
    ll sum=0;
    REPR(i,n-1){
        ll mod=((a[i]+sum)%b[i]?b[i]-(a[i]+sum)%b[i]:0);//koko 
        sum+=mod;

    }
    COUT(sum);

    return 0;
}


Measured memory_bytes: 1408
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <queue>
#include <algorithm>
#include <utility>
#include <cmath>

#define INF_LL 9000000000000000000
#define INF 2000000000

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

using namespace std;

typedef long long ll;
typedef pair<int, int> PII;

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

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

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

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

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

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

int main(void){
	int n;
	int res = 0;
	int l[200];
	cin >> n;
	REP(i, 2*n){
		cin >> l[i];
	}
	sort(l, l+2*n, greater<int>());
	REP(i, n){
		res += l[i*2+1];
	}
	cout << res << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
using namespace std;
#define INF (1<<28)
int cut[10000] , n;
#define rep(i,n) for(int i = 0 ; i < n ; i++)
int dp[2][5001][2];
/*
int dfs(int pos,int amount){
	if(amount > n/2) return INF;
	if(pos == n) return amount == n/2 ? 0 : INF;
	int ans = INF;
	for(int i = 1 ; i+pos <= n ; i++){
		ans = min( dfs( i+pos , amount+i) + cut[pos+i-1] , ans );
		ans = min( dfs( i+pos , amount  ) + cut[pos+i-1] , ans );
	}
	return ans;
}
*/
int main(){
	cin >> n;
	rep(i,n-1) cin >> cut[i];
	rep(i,2)rep(j,5001)rep(k,2) dp[i][j][k] = INF;
	dp[0][0][0] = 0;
	dp[0][0][1] = 0;
	rep(i,n){
		rep(amount,n/2+1) rep(f,2) dp[(i+1)&1][amount][f] = INF;
		rep(amount,n/2+1){
			rep(f,2){
				if(f == 0){
					dp[(i+1)&1][amount+1][0] = min( dp[(i+1)&1][amount+1][0] , dp[i&1][amount][f] );
					dp[(i+1)&1][amount+1][1] = min( dp[(i+1)&1][amount+1][1] , cut[i] + dp[i&1][amount][f] );
				}else{
					dp[(i+1)&1][amount  ][1] = min( dp[(i+1)&1][amount  ][1] , dp[i&1][amount][f] );
					dp[(i+1)&1][amount  ][0] = min( dp[(i+1)&1][amount  ][0] , cut[i] + dp[i&1][amount][f] );
				}
			}
		}
	}
	cout << min(dp[n&1][n/2][0],dp[n&1][n/2][1]) << endl;
}

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

using namespace std;
using llong = long long;
using ldbl = long double;
using P = pair<llong, llong>;

#define BE(x) x.begin(), x.end()

const llong inf = llong(1e18)+7;
const llong mod = 1e9+7;

int main(){
	llong W, H;
	vector<llong> w,h;

	cin >> W >> H;
	w.resize(W);
	h.resize(H);
	for(auto &x : w)
		cin >> x;
	for(auto &x : h)
		cin >> x;

	sort(BE(w), greater<>());
	bool check = true;
	for(auto x : w){
		sort(BE(h), greater<>());
		for(int i = 0; i < x; i++){
			if(h[i] == 0){
				check = false;
				break;
			}
			h[i]--;
		}
	}
	sort(BE(h), greater<>());
	if(h[0])
		check = false;

	cout << check << endl;

	return 0;
}


Measured memory_bytes: 3164
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,n-1,0)
#define REPL(i,m,n) for(ll i=(ll)(m); i<(ll)(n); i++)
#define repl(i,n) REPL(i,0,n)
#define all(v) v.begin(), v.end()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;
int dx[] = {0, 1};
int dy[] = {1, 0};
vector<vector<int> > dist;
void warshall_floyd(int n) { // nは頂点数
  rep(i, n)      // 経由する頂点
    rep(j, n)    // 開始頂点
      rep(k, n)  // 終端
        dist[j][k] = min(dist[j][k], dist[j][i] + dist[i][k]);
}
int main() {
  int H, W;
  cin >> H >> W;
  vector<string> S(H);
  rep(i, H) cin >> S[i];
  dist = vector<vector<int> >(H*W, vector<int>(H*W, inf));
  rep(i, H) rep(j, W) {
    if(S[i][j] == '.') {
      dist[i*W+j][i*W+j] = 0;
      rep(k, 2) {
        int nx = i + dx[k];
        int ny = j + dy[k];
        if(nx < H && ny < W && S[nx][ny] == '.') {
          dist[i*W+j][nx*W+ny] = 1;
          dist[nx*W+ny][i*W+j] = 1;
        }
      }
    }
  }
  warshall_floyd(H*W);
  int ans = 0;
  rep(i, H*W) rep(j, H*W) if(dist[i][j] != inf) ans = max(dist[i][j], ans);
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 896
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
const int INF=1e9,MOD=1e9+7,ohara=1e6+10;
const ll LINF=1e18;
using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout<<(x)<<endl
#define Cerr(x) cerr<<(x)<<endl
#define fi first
#define se second

ll n,cnt,ans,a,b,d,tmp,tmpp,m,h,w,x[ohara],y[ohara],pos,k,sum[5000][5000];
ld doua;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
//int dy[]={-1,0,1,-1,1,-1,0,1};
//int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl;
struct edge{int to,cost;};
char c[ohara];

//-------------------------↓↓↓↓↓↓------------------------

ll area(ll frx,ll fry,ll tox,ll toy){
    return sum[frx][fry]+sum[tox][toy]-sum[frx][toy]-sum[tox][fry];
}

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

    cin>>n>>k;
    rep(i,n)cin>>x[i]>>y[i]>>c[i];

    //whiteにしましょう
    rep(i,n){
        if(c[i]=='B')x[i]+=k;
    }
    rep(i,n){
        x[i]%=2*k;
        y[i]%=2*k;
    }
    rep(i,n){
        sum[x[i]][y[i]]++;
        sum[x[i]+2*k][y[i]]++;
        sum[x[i]][y[i]+2*k]++;
        sum[x[i]+2*k][y[i]+2*k]++;
    }
    rep(i,4*k+10){
        rep(j,4*k+10){
            sum[i+1][j]+=sum[i][j];
        }
    }
    rep(i,4*k+10){
        rep(j,4*k+10){
            sum[i][j+1]+=sum[i][j];
        }
    }
    //<2*k　左下白
    rep(i,2*k){
        rep(j,2*k){
            //i+k=toで一個余分に
            //基本x→y順
            cnt=area(i,j,i+k,j+k)+area(i+k,j+k,i+2*k,j+2*k);
            ans=max(ans,cnt);
        }
    }
    Cout(ans);
    return 0;
}


Measured memory_bytes: 165120
/*
      H   H
       \ / 	
        C
       / \ 
      H   H
*/

#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define	endl		'\n'
#define pii         pair<ll, ll>
#define vi          vector<ll>
#define vvi			vector<vi>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll)x.size()
#define hell        998244353
#define rep(i,a,b)	for(ll i=a;i<b;i++)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define tr(c,i)		for(typeof((c).begin() i = (c).begin(); i != (c).end(); i++)
#define present(c,x)	((c).find(x) != (c).end()) 
#define cpresent(c,x)	(find(all(c),x) != (c).end()) 
#define int ll
using namespace std;

#define N  100005

int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int TESTS=1;
//	cin>>TESTS;
	while(TESTS--)
	{
		int a, b, c, k;
		cin >> a>> b>>c >> k;

		int ans = 0;
		ans+=min(k, a);
		k-=min(k, a);

		k-=min(k, b);

		ans-=min(k, c);

		cout << ans;
	}
	return 0;
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
//T+N
//#pragma GCC optimize ("O3")
//#pragma GCC target ("sse4")
#define endl "\n"
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
template<class T, class T2> inline bool chkmax(T &x, const T2 &y) { return x < y ? x = y, 1 : 0; }
template<class T, class T2> inline bool chkmin(T &x, const T2 &y) { return x > y ? x = y, 1 : 0; }
const ll mod = 1e9 + 7;
template<class T> inline void fix(T &x) {if(x >= mod | x <= -mod) {x %= mod;} if(x < 0) {x += mod;}}
#define out(x) cout << __LINE__ << ": " << (#x) << " = " << (x) << endl

const int MAX_W = 2e5 + 10;
ll dp[2][MAX_W];

signed main() {
    //ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    int n, w;
    cin >> n >> w;
    for(int i = 0; i < n; i ++) {
        fill_n(dp[(i + 1) & 1], MAX_W, 0);
        ll a, b;
        cin >> a >> b;
        for(int j = 0; j <= w; j ++) {
            dp[(i + 1) & 1][j + a] = dp[i & 1][j] + b;
            chkmax(dp[(i + 1) & 1][j], dp[i & 1][j]);
        }
    }
    ll ans = 0;
    for(int i = 0; i <= w; i ++) {
        chkmax(ans, dp[n & 1][i]);
    }
    cout << ans << endl;
    return 0;
}




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

using namespace std;

int a,b,c,d,e,f,ans,tot;
int dp[3000+10][3000+10];

void dfs(int su,int wa){
    if (dp[su][wa]!=-1) return;
     dp[su][wa] = 1;
    if (su*100>e*wa) return;
    if (su+wa>f) return;
    if (tot==0 || su*tot>ans*(su+wa)){
        if (wa>0){
            ans = su;
            tot = su + wa;
        }
    }
    dfs(su,wa+100*a);
    dfs(su,wa+100*b);
    dfs(su+c,wa);
    dfs(su+d,wa);
}

int main(){

    memset(dp,255,sizeof dp);
    cin >> a >> b >> c >> d >> e >> f;
    dfs(0,0);
    cout << tot << ' '<< ans << endl;
    return 0;
}


Measured memory_bytes: 35584
#include<iostream>
#include<vector>
#include<map>
#define pb push_back
using namespace std;
map<char,long long int > ind;
long long int save[200005][3];
vector<char> res;
char s[200005][2];
int  main(){
  long long int  N;
  cin>>N>>ind['A']>>ind['B']>>ind['C'];
  for(long long int  i=0; i<N; i++) cin>>s[i];
  save[N][0]=save[N][1]=save[N][2]=N;
  for(int i=N-1; i>=0; i--){
    if(s[i][0]=='A' || s[i][1]=='A') save[i][0]=i;
    else save[i][0]=save[i+1][0];
    if(s[i][0]=='B' || s[i][1]=='B') save[i][1]=i;
    else save[i][1]=save[i+1][1];
    if(s[i][0]=='C' || s[i][1]=='C') save[i][2]=i;
    else save[i][2]=save[i+1][2];
  }
  for(long long int i=0; i<N; i++){
    if(ind[s[i][0]]==ind[s[i][1]] && ind[s[i][0]]==0){
      cout<<"No"<<endl;
      return 0;
    }
    else if(ind[s[i][0]]!=0 && ind[s[i][1]]==0){
      ind[s[i][0]]--;
      ind[s[i][1]]++;
      res.pb(s[i][1]);
    }
    else if(ind[s[i][1]]!=0 && ind[s[i][0]]==0){
      ind[s[i][1]]--;
      ind[s[i][0]]++;
      res.pb(s[i][0]);
    }
    else if(ind[s[i][0]]==1 && ind[s[i][1]]>1){
      ind[s[i][0]]++;
      ind[s[i][1]]--;
      res.pb(s[i][0]);
    }
    else if(ind[s[i][1]]==1 && ind[s[i][0]]>1){
      ind[s[i][1]]++;
      ind[s[i][0]]--;
      res.pb(s[i][1]);
    }
    else if(ind[s[i][1]]==1 && ind[s[i][0]]==1 && i!=N-1){
      char n1=s[i+1][0],n2=s[i+1][1];
      if(s[i][0]==n1 || s[i][0]==n2){
        ind[s[i][1]]--;
        ind[s[i][0]]++;
        res.pb(s[i][0]);
      }
      else{
        ind[s[i][0]]--;
        ind[s[i][1]]++;
        res.pb(s[i][1]);
      }
    }
    else{
      ind[s[i][0]]--;
      ind[s[i][1]]++;
      res.pb(s[i][1]);
    }
  }
  cout<<"Yes"<<endl;
  for(long long int  i=0; i<res.size(); i++) cout<<res[i]<<endl;
  return 0;
}


Measured memory_bytes: 6268
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include<limits.h>
#include<iomanip>
#define rep(i, n) for(int i = 0; i < n; i++)
#define REP(i, m, n) for(int i = m; i < n; i++)
#define ALL(v) v.begin(),v.end()
#define RALL(v) v.rbegin(),v.rend()
#define check(v) rep(i,v.size()) cout << v[i] << " ";\
cout << endl
#define INF 1e8
typedef long long ll;
using namespace std;
//オーバーフローに気をつけろよおおおおおお
//確認忘れるなよおおおおおお

int main() {
    int n; cin >> n;
    vector<int> v(2*n);
    rep(i,n*2) cin >> v[i];
    sort(ALL(v));
    int ans = 0;
    for(int i = 0; i < 2*n; i+=2){
        ans += v[i];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <stack>
#include <functional>
#include <queue>
#include <cmath>
#include <set>
#include <map>

#define rep(i,j,k) for(int i=j;i<k;i++)
#define Sort(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define vi vector<int>
#define INF 1000000000
#define MOD 1000000007
#define pb push_back
#define MP make_pair
typedef long long ll;
typedef std::pair<int,int> pii;
int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

using namespace std;

int main() {
    int n;
    cin>>n;
    int ct2=0,ct4=0,el=0;
    rep(i,0,n){
        int x;
        cin>>x;
        if(x%4==0)ct4++;
        else if(x%2==0)ct2++;
        else el++;
    }
    if(ct4>=el)cout<<"Yes"<<endl;
    else if(ct4==el-1&&ct2==0)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using LL = long long int;
#define incID(i, l, r) for(int i = (l)    ; i <  (r); ++i)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); --i)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); ++i)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); --i)
#define inc(i, n)  incID(i, 0, n)
#define dec(i, n)  decID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define dec1(i, n) decII(i, 1, n)
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))
#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define MT make_tuple
#define FI first
#define SE second
#define FR front()
#define BA back()
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
auto setmin   = [](auto & a, auto b) { return (b <  a ? a = b, true : false); };
auto setmax   = [](auto & a, auto b) { return (b >  a ? a = b, true : false); };
auto setmineq = [](auto & a, auto b) { return (b <= a ? a = b, true : false); };
auto setmaxeq = [](auto & a, auto b) { return (b >= a ? a = b, true : false); };
#define SI(v) static_cast<int>(v.size())
#define RF(e, v) for(auto & e: v)
#define until(e) while(! (e))
#define if_not(e) if(! (e))
#define ef else if
#define UR assert(false)
#define IN(T, ...) T __VA_ARGS__; IN_(__VA_ARGS__);
void IN_() { };
template<typename T, typename ... U> void IN_(T &  a, U &  ... b) { cin >> a; IN_(b ...); };
template<typename T                > void OUT(T && a            ) { cout << a << endl; }
template<typename T, typename ... U> void OUT(T && a, U && ... b) { cout << a << " "; OUT(b ...); }

// ---- ----

int main() {
	IN(int, x);
	inc1(i, 360) {
		if(x * i % 360 == 0) { OUT(i); exit(0); }
	}
	UR;
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define all(v) v.begin(),v.end()
#define P pair<int,int>
#define len(s) (int)s.size()
#define pb push_back

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;
}
constexpr int mod = 1e9+7;
constexpr int inf = 3e18;

int D;
int C[26];
int A[365][26];
int con[365];
set<int>st[26];
int score(){
	vector<int>last(26,-1);
	int res=0;
	rep(i,D){
		last[con[i]]=i;
		res+=A[i][con[i]];
		rep(j,26){
			res-=C[j]*(i-last[j]);
		}
	}
	return res;
}
int change(int x,int y){
	int res=A[x][y]-A[x][con[x]];
	auto pre_old=--st[con[x]].lower_bound(x);
	auto next_old=st[con[x]].upper_bound(x);
	res+=(*next_old-x-1)*(*next_old-x)/2*C[con[x]];
	res-=(x-*pre_old+*next_old-*pre_old-1)*(*next_old-x)/2*C[con[x]];
	auto pre_new=--st[y].lower_bound(x);
	auto next_new=st[y].lower_bound(x);
	res+=(x-*pre_new+*next_new-*pre_new-1)*(*next_new-x)/2*C[y];
	res-=(*next_new-x-1)*(*next_new-x)/2*C[y];
	return res;
}
signed main(){
	cin>>D;
	rep(i,26){
		cin>>C[i];
		st[i].insert(-1);st[i].insert(D);
	}
	rep(i,D){
		int mx=0,idx;
		rep(j,26){
			cin>>A[i][j];
			if(chmax(mx,A[i][j]))idx=j;
		}
		con[i]=idx;
		st[idx].insert(i);
	}
	int score_=score();
	cerr<<score_<<endl;
	while(1000.*clock()/CLOCKS_PER_SEC<=1990){
		int x=rand()%D,y;
		do{
			y=rand()%26;
		}while(con[x]==y);
		int diff=change(x,y);
		if(diff>=0){
			score_+=diff;
			st[con[x]].erase(x);
			con[x]=y;
			st[y].insert(x);
		}
	}
	rep(i,D)cout<<con[i]+1<<"\n";
	//cerr<<score_<<" "<<score()<<endl;
}


Measured memory_bytes: 3704
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rrep(i, n) for (int i = (n - 1); i >= 0; i--)
#define ALL(v) v.begin(), v.end()
using namespace std;
using P = pair<long long, long long>;
typedef long long ll;

int main() {
  int n;
  cin >> n;
  vector<P> XL(n);
  rep(i, n){
    ll x, l;
    cin >> x >> l;
    XL[i] = {x-l,x +l};
  }
  sort(XL.begin(), XL.end(), [](P a, P b){
    return a.second < b.second;
  });
  ll now = -2000000000000;
  int ans = 0;
  rep(i, n){
    if(now > XL[i].first)continue;
    ans++;
    now = XL[i].second;
  }
  cout << ans << endl;
}

Measured memory_bytes: 4680
#!/usr/bin/env python
# coding: utf-8

# In[18]:


a,b = map(int, input().split())


# In[19]:


if a*b <= 0:
    print("Zero")
elif a > 0 and b > 0:
    print("Positive")
else:
    if (b-a)%2 == 1:
        print("Positive")
    else:
        print("Negative")


# In[ ]:






Measured memory_bytes: 2940
import java.util.Scanner;
import java.lang.*;
import java.io.*;

public class Main {
	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);
		int A = scanner.nextInt();
		int B = scanner.nextInt();
		int C = scanner.nextInt();
		int D = scanner.nextInt();
		int E = scanner.nextInt();
		int a = A % 10;
		if (a == 0) {
			a += 10;
		}
		int b = B % 10;
		if (b == 0) {
			b += 10;
		}
		int c = C % 10;
		if (c == 0) {
			c += 10;
		}
		int d = D % 10;
		if (d == 0) {
			d += 10;
		}
		int e = E % 10;
		if (e == 0) {
			e += 10;
		}
		int T = 0;
		int min = 100;
		int[] data = { a, b, c, d, e};
		for(int i = 0; i < data.length; i++) {
			min = Math.min(min,data[i]);
		}
		//System.out.println(min);
		T = A+B+C+D+E+40-a-b-c-d-e+min;
		System.out.println(T);
	}
}

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

#define pout(n)  printf ("%d\n", n)

#define rep(i,a,n) for (int i = a;i < n;i++)
#define per(i,n,a) for (int i = n-1;i >= a;i--)

const int d4x[4] = {1, 0, -1, 0};
const int d4y[4] = {0, 1, 0, -1};
const int d8x[8] = { 1,1,0,-1,-1,-1,0,1 };
const int d8y[8] = { 0,1,1,1,0,-1,-1,-1 };

typedef long long ll;
using namespace std;

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

  int ans = 0;
  int a = n;     

  rep(i,0,8){
    ans += a%10;
    a /= 10;
  }
  if(n%ans == 0) printf("Yes\n");
  else printf("No\n");
	return 0;
}

Measured memory_bytes: 256
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))

ans = 0
tmp = -10
for ai in a:
    ans += b[ai-1]
    if tmp+1 == ai:
        ans += c[tmp-1]
    tmp = ai
    # print(ans)
print(ans)

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

vector<ll> dp(100005,LLONG_MAX),newdp(100005,LLONG_MAX);
int main(){
	ll n,w;cin>>n>>w;
  	vector<pair<ll,ll> >a(n+1);
  	ll sum=0;
  	for(int i=1;i<=n;i++){
    	cin>>a[i].first>>a[i].second;
      	sum+=a[i].second;
    }
  	dp[0]=0;
  	for(int i=1;i<=n;i++){
    	for(int j=0;j<=sum;j++){
        	ll wt=a[i].first,val=a[i].second;
          	newdp[j]=dp[j];
          	if(val<=j && dp[j-val]!=LLONG_MAX){
            	newdp[j]=min(newdp[j],dp[j-val]+wt);
            }
        }
      	dp=newdp;
    }
  	ll ans=0;
	for(int j=0;j<=sum;j++){
    	if(dp[j]<=w)ans=j;
    } 
  	cout<<ans<<endl;
}


Measured memory_bytes: 4612
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
typedef double db;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> pll;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;

vector<bool> visited;

void dfs(const vvl &G, int v) {
    visited[v] = true;
    for(auto u : G[v]) { 
        if(visited[u]) {
            continue;
        }
        dfs(G, u);
    }
}

int main() {
    ll n, m;
    cin >> n >> m;    

    vvl G(n);
    rep(i, m) {
        ll x, y, z;
        cin >> x >> y >> z;
        x--;  y--;
        G[x].push_back(y);
        G[y].push_back(x);
    }

    visited.assign(n, false);
    
    ll renketuseibun = 0;  // 連結成分の個数
    rep(i, n) {
        if(visited[i]) {
            continue;
        } 
        dfs(G, i);
        renketuseibun++;
    }
    
    out(renketuseibun);
    re0;
}

Measured memory_bytes: 10368
///******* In the name of Allah *******///


#include <bits/stdc++.h>
using namespace std;

int main()
{
	int a,b,c,m,n,i,j,k,l,ans;
    char aa,bb,cc;
    cin>>aa;
    ans = aa - 0;
    bb = ans + 1;
    cout<<bb<<endl;

	return 0;
}

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

int main() {
    int A, B, C, D, E, F;
    cin >> A >> B >> C >> D >> E >> F;
    double max_dens = 0;
    int max_weight = 0;
    int max_sugar = 0;
    for (int i = 0; i * A * 100 <= F; i++) {
        for (int j = 0; (i * A + j * B) * 100 <= F; j++) {
            int water = (A * i + B * j) * 100;
            for (int k = 0; k * C + water <= F; k++) {
                for (int l = 0; k * C + l * D + water <= F; l++) {
                    int sugar = k * C + l * D;
                    if (sugar <= E * (water / 100) && water + sugar <= F) {
                        double density = 100.0 * sugar / (water + sugar);
                        if (density >= max_dens) {
                            max_weight = water + sugar;
                            max_sugar = sugar;
                            max_dens = density;
                        }
                    } else {
                        break;
                    }
                }
            }
        }
    }
    cout << max_weight << ' ' << max_sugar << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define all(x) x.begin(),x.end()
#define cmin(a,b) (a>b?a=b:a)
#define cmax(a,b) (a<b?a=b:a)
#define mem(a,k) memset(a,k,sizeof(a))
#define lop(i,s,t) for(int i=s;i<(t);++i)
#define rep(i,s,t) for(int i=s;i<=(t);++i)
#define dec(i,s,t) for(int i=s;i>=(t);--i)
#define fore(i,v) for(int i=g[v],d=es[i].d;i;i=es[i].nxt,d=es[i].d)
using namespace std;

typedef long long ll;

template<typename T>
void read(T &x){
	x=0; 
	char c;
	for(c=getchar();!isdigit(c);c=getchar()); 
	for(;isdigit(c);c=getchar())x=x*10+c-'0'; 
}

const int N=2005; 

int n,k,q,a[N],b[N],m,ans=1e9; 
vector<int> v,g;

int main(int argc,char *argv[]){
#ifdef CURIOUSCAT
	//freopen("dat.in","r",stdin); 
#endif
	read(n),read(k),read(q);
	rep(i,1,n){
		read(a[i]); 
		b[i]=a[i]; 
	}
	m=n;
	sort(b+1,b+m+1); 
	m=unique(b+1,b+m+1)-b-1; 
	rep(d,0,m){
		int x=b[d];
		v.clear(),g.clear(); 
		rep(i,1,n+1){
			if(a[i]>x)v.pb(a[i]); 
			else if(!v.empty()){
				sort(all(v));
				for(size_t j=0;j+k<=v.size();++j)g.pb(v[j]); 
				v.clear();
			}
		}
		if((int)g.size()<q)break;
		sort(all(g)); 
		cmin(ans,g[q-1]-g[0]); 
	}
	printf("%d\n",ans); 
	return 0;
}


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


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

    lint abc;

    set<lint> sabc[26]; //a,b,c...が何文字目にくるか
    lint slen = s.length();
    
    rep0(i, slen * 2)
    {
        abc = s[i%slen]-'a';
        sabc[abc].insert(i + 1);
    }

    lint used = 0; //現在の文字位置
    lint pos = 0; //直前の文字の位置
    lint sloop = 0; //sを何度繰り返すか
    rep0(i, t.length())
    {
        abc = t[i]-'a';
        if(sabc[abc].size() == 0)
        {// もしsに存在しない文字を使っていたら不可能
            used = -1;
            break;
        }
        lint sc = *sabc[abc].lower_bound(pos + 1);
        used = slen * sloop + sc;
        if(sc > slen)
        {
            sloop++;
            pos = sc - slen;
        }
        else
        {
            pos = sc;
        }
        

    }

    cout << used << endl;
    return 0;
}

Measured memory_bytes: 9856
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<iostream>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<cmath>
#include<cstdlib>
using namespace std;
#define ll long long
const int maxn=1e5+5;
int a[maxn],times[maxn];
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int n;
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
        times[a[i]]++;
    }
    ll sum=0;
    for(int i=1;i<=100000;i++)
        sum+=(ll)times[i]*i;
    int q;
    cin>>q;
    while(q--)
    {
        int b,c;
        cin>>b>>c;
        sum+=(ll)times[b]*(c-b);
        times[c]+=times[b];
        times[b]=0;
        cout<<sum<<'\n';
    }
    return 0;
}


Measured memory_bytes: 4420
#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 1e9
#define ALL(v) (v).begin(), (v).end()
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;

int main()
{
  ll N, M, a, rr[3] = {0, 0, 1}, MOD = 1e9 + 7;
  vector<bool> A;
  cin >> N >> M;

  REP(i, N + 1)
  {
    A.push_back(true);
  }
  REP(i, M)
  {
    cin >> a;
    A[a] = false;
  }

  FOR(i, 1, N + 1)
  {
    if (A[i])
    {
      rr[0] = rr[1];
      rr[1] = rr[2];
      rr[2] = (rr[0] + rr[1]) % MOD;
    }
    else
    {
      rr[0] = rr[1];
      rr[1] = rr[2];
      rr[2] = 0;
    }
  }

  cout << rr[2] << '\n';
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define PI 3.14159265359
using namespace std;
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 long long INF = 1LL << 60;
using pll = pair<long long, long long>;

int main() {
  // 標準入力が早くなる。Cスタイルの入出力とC++スタイルの入出力を混合させてはならない。
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);

  // vector<vector<int>> A(3, vector<int>(3));
  vector<int> A(9);
  vector<int> res(9, 0);

  for (int i = 0; i < 9; i++) {
    cin >> A.at(i);
  }

  int N;
  cin >> N;

  vector<int> B(N);

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

  for (int i = 0; i < N; i++) {
    vector<int>::iterator itr;
    itr = find(A.begin(), A.end(), B.at(i));
    if (itr == A.end()) continue;
    res.at(distance(A.begin(), itr)) = 1;
  }

  if ((res.at(0) == 1 && res.at(1) == 1 && res.at(2) == 1) ||
      (res.at(3) == 1 && res.at(4) == 1 && res.at(5) == 1) ||
      (res.at(6) == 1 && res.at(7) == 1 && res.at(8) == 1) ||
      (res.at(0) == 1 && res.at(3) == 1 && res.at(6) == 1) ||
      (res.at(1) == 1 && res.at(4) == 1 && res.at(7) == 1) ||
      (res.at(2) == 1 && res.at(5) == 1 && res.at(8) == 1) ||
      (res.at(0) == 1 && res.at(4) == 1 && res.at(8) == 1) ||
      (res.at(2) == 1 && res.at(4) == 1 && res.at(6) == 1)) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}


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

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
#define rep(i, s, n) for(int i = (int)(s); i < (int)(n); i++)

ll INF = 1ll << 60;

int main(){
  int n, k;
  cin >> n >> k;
  vi a(n);
  rep(i, 0, n)
    cin >> a[i];
  
  rep(i, k, n){
    if(a[i-k] < a[i]){
      cout << "Yes" << endl;
    }
    
    else
      cout << "No" << endl;
  }
  
  return 0;
  
}

Measured memory_bytes: 3984
var s,st:ansistring;
    len,i:longint;
    t:char;
begin
  readln(s); st:=s;
  len:=length(s);
  if (len mod 2=1) then begin writeln('No');exit;end;
  for i:=1 to len div 2 do
  begin
   t:=s[i];s[i]:=s[len-i+1];s[len-i+1]:=t;
  end;
  for i:=1 to len do
  begin
    if s[i]='b' then s[i]:='d' else
    if s[i]='d' then s[i]:='b' else
    if s[i]='p' then s[i]:='q' else
    s[i]:='p';
  end;
  if s=st then writeln('Yes') else writeln('No');
end.

Measured memory_bytes: 384
def main():
    import sys
    input = sys.stdin.readline

    n = int(input())
    l = list(map(int,input().split()))

    l.sort()
    c = 0

    import bisect

    for i in range(n):
        for j in range(i+1,n):
            ind = bisect.bisect_left(l,l[i]+l[j])
            c += max((ind-j)-1 , 0)
            
    print(c)

if __name__ == "__main__":
    main()

Measured memory_bytes: 42204
import java.util.Scanner;

class Main
{
	public static void main ( String[] args ) {
		Scanner sc = new Scanner ( System.in );

		int s = sc.nextInt ();

		int s1 = s % 60;
		int s2 = ( s / 60 ) % 60;
		int s3 = s / 60 / 60;
		
		System.out.println ( s3 + ":" + s2 + ":" + s1 );
	}
}

Measured memory_bytes: 26372
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <algorithm>
#include <map>
#include<set>
#include <vector>
#include <string>
#include <utility>
#include <stack>
#include <queue>
using namespace std;
const int mod=1e9+7;

int main()
{
  int m;
  int count=0;
  string t;
  cin>>m;
  set<string>s;
  while(count<m){
  	cin>>t;
  	count++;
  	s.clear();
  	for(int i=0;i<t.length()-1;i++){
  		string p=t.substr(0,i+1);
  		string pr=p;
  		string b=t.substr(i+1,t.length()-i);
  		string br=b;
  		reverse(pr.begin(),pr.end());
  		reverse(br.begin(),br.end());
  		s.insert(p+b);
  		s.insert(p+br);
  		s.insert(pr+b);
  		s.insert(pr+br);
  		s.insert(b+p);
  		s.insert(b+pr);
  		s.insert(br+p);
  		s.insert(br+pr);
  	}
  	cout<<(int)s.size()<<endl;
  }
  return 0;
}


Measured memory_bytes: 3288
#include <bits/stdc++.h>
using namespace std;
const int N = 200000 + 10;
char s[N];
int f[N][2],g[N][2];
void upd(int i,int j,int p,int x){
    if(f[i][j]<x) f[i][j] = x, g[i][j] = p;
}
int main(){
    scanf("%s",s+1);
    int n = strlen(s+1);
    memset(f,-1,sizeof(f));
    f[0][1] = 0;
    for(int i=0;i<n;i++){
        for(int j=0;j<2;j++) if(f[i][j]!=-1){
            if(s[i+1]=='D'||s[i+1]=='?') upd(i+1,1,j,f[i][j]+1+(j==0));
            if(s[i+1]=='P'||s[i+1]=='?') upd(i+1,0,j,f[i][j]);
        }
    }
    int x = 0;
    if(f[n][1]>f[n][0]) x = 1;
    for(int i=n;i>=1;i--){
        if(x) s[i] = 'D';
        else s[i] = 'P';
        x = g[i][x];
    }
    printf("%s\n",s+1);
}


Measured memory_bytes: 6980
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int D;
  vector<pair<int, int>> c(26);
  vector<vector<int>> s(D, vector<int>(26));
  vector<int> t(D);
  
  cin >> D;
  for(int i = 0; i < 26; i++){
    cin >> c.at(i).first;
    c.at(i).second = 0;
  }
  
  for(int i = 0; i < D; i++){
    for(int j = 0; j < 26; j++){
      cin >> s.at(i).at(j);
    }
  }
  
  for(int i = 0; i < D; i++){
    cin >> t.at(i);
  }
  
  vector<int> M(1);
  cin >> M.at(0);
  vector<pair<int, int>> q(M.at(0));
  
  for(int i = 0; i < M.at(0); i++){
    int a = 0;
    int b = 0;
    cin >> a >> b;
    q.at(i).first = a;
    q.at(i).second = b;
  }

  int Pl = 0;
  int Mi = 0;
  
  for(int k = 0; k < M.at(0); k++){
    t.at(q.at(k).first-1) = q.at(k).second;
    for(int i = 0; i < D; i++){
      Pl += s.at(i).at(t.at(i)-1);
      c.at(t.at(i)-1).second = i + 1;
      for(int j = 0; j < 26; j++){
        Mi += c.at(j).first*(i+1 - c.at(j).second);
      }
      Pl -= Mi;
      Mi = 0;
    }
    cout << Pl << endl;
    Pl = 0;
    for(int i = 0; i < 26; i++){
      c.at(i).second = 0;
    }
  }
}


Measured memory_bytes: 8412
#include<bits/stdc++.h>
#define del(a,i) memset(a,i,sizeof(a))
#define ll long long
#define inl inline
#define il inl void
#define it inl int
#define ill inl ll
#define re register
#define ri re int
#define rl re ll
#define mid ((l+r)>>1)
#define lowbit(x) (x&(-x))
#define INF 0x3f3f3f3f
using namespace std;
template<class T>il read(T &x){
	int f=1;char k=getchar();x=0;
	for(;k>'9'||k<'0';k=getchar()) if(k=='-') f=-1;
	for(;k>='0'&&k<='9';k=getchar()) x=x*10+k-'0';
	x*=f;
}
template<class T>il _print(T x){
	if(x>=10) _print(x/10);
	putchar(x%10+'0');
}
template<class T>il print(T x){
	if(x<0) putchar('-'),x=-x;
	_print(x);
}
ll mul(ll a,ll b,ll mod){long double c=1.;return (a*b-(ll)(c*a*b/mod)*mod)%mod;}
it qpow(int x,int k,int mod){
	int res=1,bas=x;
	while(k){
		if(k&1) res=1ll*res*bas%mod;
		bas=1ll*bas*bas%mod,k>>=1;
	}
	return res;
}
int n,k;
char s[55];
int main(){
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
	read(n),read(k),scanf("%s",s+1);
	s[k]=s[k]-'A'+'a';
	for(ri i=1;i<=n;++i) putchar(s[i]);
	return 0;
}

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

int main(void) {
    int i, j, n, x[100], y[100], index=0;
    scanf("%d", &n);
    for(i=0; i<n; i++) scanf("%d", &x[i]);
    for(i=0; i<n; i++) {
        int front=0, back=0;
        for(j=0; j<n; j++) {
            if(j<=i) front+=x[j];
            else back+=x[j];
        }
        y[i]=abs(front-back);
    }
    int min = y[0];
    for(i=0; i<n; i++) if(y[i]<min) min = y[i];
    printf("%d\n", min);
    return 0;
}

Measured memory_bytes: 128
#include<iostream>
using std::cin;
using std::cout;
int main()
{
    int k;
    cin >> k;
    int num = 7;
    int count = 1;
    while(num % k != 0 && count <= 10000000)
    {
        num = num % k * 10 + 7;
        count++;
    }
    cout << ((count > 10000000) ? -1 : count);

}

Measured memory_bytes: 3648
#include <iostream>

using namespace std;

int E;
int x,y,z;
long long solve(){
    long long ans = 1000000;
    for (z=0;z*z*z<=E;z++)
        for(y=0;y*y<=E-z*z*z;y++){
            x = E-z*z*z-y*y;
            if (x+y+z<ans) ans=x+y+z;
        }
    return ans;
}
int main() {
    while(cin>>E&&E>0) cout<<solve()<<endl;
}


Measured memory_bytes: 3104
s = input()

if s[0] == s[1] and s[2] == s[3] and s[0] != s[2] :
    print("Yes")
elif s[0] == s[2] and s[1] == s[3] and s[0] != s[1] :
    print("Yes")
elif s[0] == s[3] and s[2] == s[1] and s[0] != s[2] :
    print("Yes")
else :
    print("No")

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

using namespace std;

#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)((x).size()))

typedef pair<int, int> PII;
typedef vector<int> VI;
typedef long long int64;
typedef unsigned int uint;
typedef unsigned long long uint64;

#define gi(x) ((x) = F())
#define gii(x, y) (gi(x), gi(y))
#define giii(x, y, z) (gii(x, y), gi(z))

int F()
{
	char ch;
	int x, a;
	while (ch = getchar(), (ch < '0' || ch > '9') && ch != '-');
	if (ch == '-') ch = getchar(), a = -1;
	else a = 1;
	x = ch - '0';
	while (ch = getchar(), ch >= '0' && ch <= '9')
		x = (x << 1) + (x << 3) + ch - '0';
	return a * x;
}

const int N = 1e5 + 10;

int n, c, k, t[N], ans;

int main()
{
	giii(n, c, k);
	for (int i = 1; i <= n; ++i) gi(t[i]);
	sort(t + 1, t + n + 1);
	for (int i = 1; i <= n; ++i)
	{
		int j;
		if (t[n] > t[i] + k) j = upper_bound(t + 1, t + n + 1, t[i] + k) - t - 1;
		else j = n;
		j = min(i + c - 1, j);
		i = j;
		++ans;
	}
	printf("%d\n", ans);
}

Measured memory_bytes: 640
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayDeque;
import java.util.Arrays;

public class Main {
	static char[][] c;

	static int[][] m = new int[][] {
			{ 0, 1 },
			{ 1, 0 },
			{ 0, -1 },
			{ -1, 0 }
	};

	static boolean isbomb(int x, int y) {
		if (x < 0 || y < 0 || x > 7 || y > 7)
			return false;
		return c[y][x] == '1';
	}

	static void bfs(int x, int y) {
		ArrayDeque<Integer> ad = new ArrayDeque<Integer>();
		ad.addLast(y * 8 + x);
		c[y][x] = 0;
		c[y][x] = '0';
		while (!ad.isEmpty()) {
			int n = ad.pollFirst();
			int nx = n % 8;
			int ny = n / 8;
			for (int i = 0; i < 4; i++)
				for (int j = 1; j <= 3; j++)
					if (isbomb(nx + j * m[i][0], ny + j * m[i][1])) {
						c[ny + j * m[i][1]][nx + j * m[i][0]] = '0';
						ad.addLast((ny + j * m[i][1]) * 8 + nx + j * m[i][0]);
					}
		}
	}

	public static void main(String[] args) throws Exception {
		c = new char[8][];
		BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(bf.readLine());

		for (int i = 1; i <= n; i++) {
			bf.readLine();
			for (int j = 0; j < 8; j++) {
				c[j] = Arrays.copyOf(bf.readLine().toCharArray(),8);
			}
			int x = Integer.parseInt(bf.readLine());
			int y = Integer.parseInt(bf.readLine());
			bfs(x - 1, y - 1);
			System.out.println("Data " + i + ":");
			for (int j = 0; j < 8; j++) {
				System.out.println(new String(c[j]));
			}
		}
	}
}

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

#define  ll  long long
#define  pii pair<int,int>
#define  pll pair<ll , ll>
#define  debug cout << "this far" << endl;
#define  For(i, n) for(int i = 0; i < (n); ++i)
#define  lsb(x) ((x) & (-x))
#define  PI acos(-1)
#define  line cout << endl;
#define  getbit(n, i) (((n) & (1LL << (i))) != 0)
#define  resetbit(n, i) ((n) & (~(1LL << (i))))
#define  setbit(n, i) ((n) | (1LL << (i)))
#define  togglebit(n, i) ((n) ^ (1LL << (i)))
#define  gap " "
using namespace std;
const int N = 1e3 + 10;
typedef pair<pii, int> iii;
int vis[N][N];
int n, m;
string s[N];
int inx, iny, fx, fy;
vector<int> magic = {0, -1, -2, 1, 2};
int dx[] = {1, -1, 0, 0};
int dy[] = {0, 0, 1, -1};

struct vxd {
    int x, y, cval;

    vxd(int _x, int _y, int _cval) : x(_x), y(_y), cval(_cval) {}

    bool operator<(const vxd &o) const {
        return cval > o.cval;
    }
};
int bfs() {
    int ans = 1e9;
    priority_queue<vxd> q;
    q.push(vxd(inx, iny, 0));
    while (!q.empty()) {
        int cx = q.top().x;
        int cy = q.top().y;
        int cval = q.top().cval;
        q.pop();
        if (cx == fx && cy == fy) {
            ans = min(ans, cval);
        }
        if (vis[cx][cy]) continue;
        vis[cx][cy]++;
        for (int i = 0; i < 4; ++i) {
            int tx = cx + dx[i];
            int ty = cy + dy[i];
            if (tx >= n || tx < 0 || ty >= m || ty < 0) continue;
            if (vis[tx][ty] || s[tx][ty] == '#') continue;
            q.push(vxd(tx, ty, cval));
        }
        for (int i = 0; i < 5; ++i) {
            for (int j = 0; j < 5; ++j) {
                if (i == 0 && j == 0) continue;
                int tx = cx + magic[i];
                int ty = cy + magic[j];
                if (tx >= n || tx < 0 || ty >= m || ty < 0) continue;
                if (vis[tx][ty] || s[tx][ty] == '#') continue;
                q.push(vxd(tx, ty,1+  cval));
            }
        }

    }
    return ans;
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cin >> n >> m >> inx >> iny >> fx >> fy;
    --inx, --iny, --fx, --fy;
    for (int i = 0; i < n; ++i) cin >> s[i];
    int ans = bfs();
    if (ans == 1e9) cout << "-1";
    else cout << ans;

}

Measured memory_bytes: 9252
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;
const int MAXN=5005;
int n; ll f[MAXN];
struct DATA{
	int h,p;
	bool operator <(const DATA v)const{return h+p<v.h+v.p;}
} A[MAXN];
int main(){
	memset(f,63,sizeof(f)); f[0]=0;
	scanf("%d",&n);
	for (int i=1;i<=n;i++) scanf("%d%d",&A[i].h,&A[i].p);
	sort(A+1,A+1+n);
	for (int i=1;i<=n;i++)
		for (int j=n;j;j--)
			if (f[j-1]<=A[i].h&&f[j-1]+A[i].p<f[j]) f[j]=f[j-1]+A[i].p;
	for (int ans=n;~ans;ans--)
		if (f[ans]!=0x3f3f3f3f3f3f3f3f){
			cout<<ans<<endl;
			return 0;
		}
}

Measured memory_bytes: 384
#include <iostream>
using namespace std;
int main(){
    int ans;
    cin>>ans;
    char c;
    while(cin >> c){
        if(c == '=') break;
        int n;
        cin>>n;
        if(c == '+')ans += n;
        if(c == '-')ans -= n;
        if(c == '*')ans *= n;
        if(c == '/')ans /= n;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 1160
#include<stdio.h>
int main(void){
	
	int h,w,i,j,k;
	
	for(i=0;;i++){
		scanf("%d%d",&h,&w);
		
		if(h == 0 && w == 0)break;
		
		for(j=0;j<h;j++){
			for(k=0;k<w;k++)
			putchar('#');
			printf("\n");
		}
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 576
n = gets.chomp.to_i
a = gets.chomp.split.map(&:to_i)

cnt = 0
a.each_with_index{|b,i|
  if b % 2 != 0 || b == 1
    if (i+1) % 2 != 0 || (i+1) == 1
      cnt += 1
    end
  end
}

puts cnt

Measured memory_bytes: 14364
N, M, X = map(int, input().split())

hon = []
for _ in range(N):
    hon.append(list(map(int, input().split())))

minyen = float("inf")
for i in range(2**N):
    flag = False
    hoji = []
    rikai = [0]*M
    #print("pattern{}: ".format(i), end="")
    for j in range(N):
        if((i>>j)&1):
            hoji.append(hon[j][0])  # フラグが立っていたら bag に果物を詰める
            for k in range(M):
                rikai[k] += hon[j][k+1]

    for k in range(M):
        if X > rikai[k]:
            flag = True
            break

    if flag:
        continue
    else:
        minyen = min(minyen,sum(hoji))

if minyen == float("inf"):
    print("-1")
else:
    print(minyen)

Measured memory_bytes: 9236
<?php

//標準入力
$n = trim(fgets(STDIN));
$s = str_split(trim(fgets(STDIN)));

//配列の値の出現回数をカウントする
$count = array_count_values($array);

$rsl = 0;
$i = 1;
while($i < $n -1){
  $a = array_slice($s,0,$i); //0から$iの範囲を返す
  $b = array_slice($s,$i); //$i以降の範囲の文字列を返す
  $c = array_intersect($a,$b); //$aと$bの共通項を計算して返す
  $rsl = max($rsl,count(array_count_values($c))); 
  $i++;
}

echo $rsl;

Measured memory_bytes: 4728
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<deque>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<climits>
#define MOD 1000000007
typedef long long ll;
using namespace std;

int main(){
  int n; cin >> n;
  vector<ll> a;
  for(int i=0;i<n;i++){
    int t; cin >> t;
    a.push_back(t);
  }
  sort(a.begin(),a.end());
  ll ans = 0;
  int flag = 0;
  ll rec1;
  ll rec2;
  int j = n-1;
  for(;j>=0;){
    if(flag >= 2) break;
    int cnt = upper_bound(a.begin(),a.end(),a[j]) - lower_bound(a.begin(),a.end(),a[j]);
    if(cnt >= 4){
      if(flag == 0){
        rec1 = a[j];
        rec2 = a[j];
        ans = rec1 * rec2;
        flag += 2;
      }else if(flag == 1){
        rec2 = a[j];
        ans = rec1 * rec2;
        flag++;
      }
    }
    else if(cnt >= 2){
      if(flag == 0){
        rec1 = a[j];
        flag++;
      }
      else if(flag == 1){
        rec2 = a[j];
        ans = rec1 * rec2;
        flag++;
      }
    }
    j -= cnt;
  }
  
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1400
def megalomania():
    n = int(input())
    tasks = []
    for i in range(n):
        tasks.append(tuple(map(int, input().split())))

    tasks_sorted = sorted(tasks, key=lambda x: x[1])

    time = 0
    for a, b in tasks_sorted:
        time += a
        if time <= b:
            continue
        else:
            print('No')
            exit()

    print('Yes')


if __name__ == '__main__':
    megalomania()


Measured memory_bytes: 33452
#include<stdio.h>

int main(){
    int a , b;
 /* ????????°a ?????¢?????¬?????????????????¢?????¨?????¢?????\?????????????????´??°????????????????´???????????????????????????????*/
      scanf("%d %d", &a ,&b);
    if (a < b){printf("a < b\n");};
    if (a ==  b){printf("a == b\n");};
    if (a > b){printf("a > b\n");};
    return 0;
}

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

vector<int> V(101);

int main() {
    int N; cin >> N;
    for (int i = 2; i <= N; i++){
        int n = i;
        for (int j = 2; j <= N; j++){
            while(n % j == 0){
                V[j]++;
                n /= j;
                if(n == 1)break;  
            }
        }
    }
    int c2 = 0;
    int c4 = 0;
    int c14 = 0;
    int c24 = 0;
    int c74 = 0;

    for (int i = 2; i <= N; i++){
        if(V[i] >= 2)c2++;
        if(V[i] >= 4)c4++;
        if(V[i] >= 14)c14++;
        if(V[i] >= 24)c24++;
        if(V[i] >= 74)c74++;
    }

    int ans = c74 + (c24 * (c2-1)) + (c14 * (c4-1)) + ((c4 * (c4-1) / 2) * (c2 -2));
    cout << ans << endl;


    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	int a, b, c;
	scanf("%d%d%d", &a, &b, &c);
	if(a == 5 && b == 5 && c == 7){
		printf("YES\n");
	}
	else if(a == 5 && b == 7 && c == 5){
		printf("YES\n");
	}
	else if(a == 7 && b == 5 && c == 5){
		printf("YES\n");
	}
	else{
	printf("NO\n");
	}
	return 0;
	}


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

int main(){
    ll n;
    cin>>n;
    ll p[n];
    ll q[n];
    for(ll i=0;i<n;++i){
        cin>>p[i];
        q[i]=i+1;
    }

    string ans="NO";
    ll flag=0;
    for(ll i=0;i<n;++i){
        if(p[i]==q[i]){
            flag++;
        }
    }
    if(flag>=n-2){
        ans="YES";
    }
    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    ios::sync_with_stdio(false);
    string s;
    int q;
    cin >> s >> q;
    vector<string> que(q+6);
    deque<char> ds(s.size());

    for(int i = 0; i < s.size(); i++){
        ds[i] = s[i];
    }
    bool reverseFlag = false;
    for(int i = 0 ;i <= q;i++){
        getline(cin,que[i]);
        if(que[i][0] == '1'){
            if(reverseFlag == false){
                reverseFlag = true;
            }else{
                reverseFlag = false;
            }
        }else if(que[i][0]=='2' && que[i][2]=='1'){
            if(reverseFlag == false){
            ds.push_front(que[i][4]);
            }else{
            ds.push_back(que[i][4]);
            }
        }else if(que[i][0]=='2' && que[i][2]=='2'){
            if(reverseFlag == false){
            ds.push_back(que[i][4]);
            }else{
            ds.push_front(que[i][4]);
            }
        }
    }

    if(reverseFlag){
        reverse(ds.begin(),ds.end());
    }

    for(auto x:ds){
        cout << x ;
    }
    cout << endl;

}



Measured memory_bytes: 11856
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define FORR(i, m, n) for(int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)

ll mod = 1e09;

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

  ll n, a, b;
  cin >> n >> a >> b;
  ll ans = 0;
  REP(i, n){
    int c = i + 1, s = 0;
    while(c){
      s += c % 10;
      c /= 10;
    }
    if(a <= s && s <= b) ans += i + 1;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#k = int(input())
#s = input()
#a, b = map(int, input().split())
#s, t = map(str, input().split())
#l = list(map(int, input().split()))
#l = [list(map(int,input().split())) for i in range(n)]
#a = [list(input()) for _ in range(n)]


a,b = map(int, input().split())

ans = a + b
if (ans >= 10):
    print("error")
else:
    print(ans)




Measured memory_bytes: 8992