akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <queue>
#include <bitset>		//UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>		//do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double

const double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;

const int MOD = 1e9 + 7;
const int MR = 2e5 + 10;

LL modPow( LL a, LL x, LL p ) {
    // return a^x mod p
    LL res = 1;
    while (x>0) {
        if (x & 1) res = ( res*a ) % p;
        a = ( a*a ) % p;
        x >>= 1;
    }

    return res;
}

LL modInverse( LL a, LL p ) {
    // return modular multiplicative of: a mod p, assuming p is prime
    return modPow( a, p - 2, p );
}

int sil[MR];

int main()
{
    map < int, vector < int > > M; M.clear();

    int N, X, Y;
    scanf( "%d%d%d", &N, &X, &Y );
    REP( i, N )
    {
        int c, w;
        scanf( "%d%d", &c, &w );
        M[c].push_back( w );
    }

    vector < pair<int, int>> V; V.clear();

    for (auto &color : M)
    {
        int mn = MOD;
        for (auto &weight : color.second)
            mn = min( mn, weight );
        for (auto &weight : color.second)
            if (weight + mn <= X)
                weight = mn;
        for (auto &weight : color.second)
            V.push_back( MP( weight, color.first ) );
    }

    assert( N == V.size() );
    
    sort( V.begin(), V.end() );

    map<int, int> ile; ile.clear();

    int n = N;
    int next = -1;
    REP( i, N )
    {
        if (V[i].second != V.front().second)
        {
            next = i;
            break;
        }
    }

    int sub = 0;
    REP( i, N )
    {
        if (V[i].first + V.front().first > Y)
        {
            n = i;
            break;
        }
        else if (V[i].second == V.front().second && V[i].first != V.front().first)
        {
            // przypadek, gdzie wierzcholek jest z tego koloru co minimalny
            // ale jednoczesnie nie mozemy zamienic ich miejscami
            // ze wzgledu na ograniczenie przez X
            if (next == -1 || V[i].first + V[next].first > Y)
            {
                // tego dziada nie mozna przesuwac
                sub++;
                continue;
            }
        }
        ile[V[i].second]++;
    }

    n -= sub;

    sil[0] = 1;
    FORQ( i, 1, n )
        sil[i] = ( sil[i - 1] * (LL)i ) % MOD;

    int res = sil[n];

    for (auto &color : ile)
        res = ( res* modInverse( sil[color.second], MOD ) ) % MOD;

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

    return 0;
}

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

int main() {
  int X;
  cin >> X;
  
  string result;
  if (X >= 30) {
    result = "Yes";
  } else {
    result = "No";
  }
  
  cout << result << endl;
  
  return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(ll i=0;i<n;i++)
#define INF 10000000000000000
int main(void){
    ll n,W;cin>>n>>W;
    vector<vector<ll>>dp(n+1,vector<ll>(100010,INF));
    dp[0][0]=0;ll w,p;
    rep(i,n){
        cin>>w>>p;
        rep(j,100010)dp[i+1][j]=min(dp[i+1][j],dp[i][j]);
        for(int j=0;j+p<100010;j++)dp[i+1][j+p]=min(dp[i+1][j+p],dp[i][j]+w);
    }
    ll ans=0;
    rep(i,100010){
        if(dp[n][i]<=W)ans=max(ans,i);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 80256
#include <iostream>

using namespace std;
using ll = long long;
using ld = long double;

#define ALL(x) begin(x), end(x)
#define REP(i, n) for (size_t i = 0, i##_len = (n); i < i##_len; ++i)

void solve(string S) {
  if (S=="Sunny") {
    cout << "Cloudy" << endl;
  } else if (S=="Cloudy") {
    cout << "Rainy" << endl;
  } else {
    cout << "Sunny" << endl;
  }
}

int main() {
  string S;
  cin >> S;
  solve(S);
  return 0;
}


Measured memory_bytes: 256
#![allow(dead_code)]
#![allow(unused_imports)]
use ascii::{AsciiChar, AsciiStr, AsciiString};
use indexmap::IndexMap;
use itertools::*;
use libm::*;
use num::*;
use ordered_float::OrderedFloat;
use permutohedron::LexicalPermutation;
use proconio::marker::{Bytes, Chars};
use proconio::{fastout, input};
use std::cmp::{max, min, Ordering};
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
use std::mem::swap;

fn main() {
    input!(n: isize, a: [isize; n]);
    let all = a.iter().fold(0, |x, y| x ^ y);
    for x in a {
        print!("{} ", x ^ all);
    }
    println!("");
}


Measured memory_bytes: 6368
import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		while(scan.hasNext()){
			int i = 1;
			int[] gcd = new int[2];
			gcd[0] = scan.nextInt();
			gcd[1] = scan.nextInt();
			
			while(i != 0){
				i = gcd[0] % gcd[1];
				gcd[0] = gcd[1];
				gcd[1] = i;
			}
			System.out.println(gcd[0]);
		}
	}
}

Measured memory_bytes: 26084
#include <iostream>
using namespace std;
long long n, m, s, M=1e9+7;
int main() {
	cin>>n>>m;
	s = n^m ? n-m<-1 || n-m>1 ? 0:1:2;
	while(n) s = (s*n--) % M;
	while(m) s = (s*m--) % M;
	cout<<s;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define inf LLONG_MAX
#define pll pair <ll,ll>
#define min_pq priority_queue <pll> ,vector <pll>, greater <pll> > > 
#define f first
#define s second

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);

	ll n,m;
	cin>>n>>m;
	if(m<n)
		cout<<"No\n";
	else
		cout<<"Yes\n";
}


Measured memory_bytes: 256
A,B,C = map(int,input().split())

ans = 0

while (A%2 == 0) & (B%2 == 0) & (C%2 == 0):
    if (A==B) & (B==C) :
        ans = -1
        break

    a = (B+C)/2
    b = (A+C)/2
    c = (A+B)/2
    A = a
    B = b
    C = c
    ans += 1

print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <numeric>

using namespace std;


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

    int sum=0;
    for(int i=0;i<n;i++){
        sum+=a[i]-1;
    }
    cout<<sum<<endl;
}


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

int main() {
    int n;
    cin >> n;
    cout << n*n*n << endl;
}


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

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = mod * mod;
const int INF_N = 1e+9;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-12;
const ld pi = acos(-1.0);
//typedef vector<vector<ll>> mat;
typedef vector<int> vec;

//繰り返し二乗法
ll mod_pow(ll a, ll n, ll m) {
	ll res = 1;
	while (n) {
		if (n & 1)res = res * a%m;
		a = a * a%m; n >>= 1;
	}
	return res;
}

struct modint {
	ll n;
	modint() :n(0) { ; }
	modint(ll m) :n(m) {
		if (n >= mod)n %= mod;
		else if (n < 0)n = (n%mod + mod) % mod;
	}
	operator int() { return n; }
};
bool operator==(modint a, modint b) { return a.n == b.n; }
modint operator+=(modint &a, modint b) { a.n += b.n; if (a.n >= mod)a.n -= mod; return a; }
modint operator-=(modint &a, modint b) { a.n -= b.n; if (a.n < 0)a.n += mod; return a; }
modint operator*=(modint &a, modint b) { a.n = ((ll)a.n*b.n) % mod; return a; }
modint operator+(modint a, modint b) { return a += b; }
modint operator-(modint a, modint b) { return a -= b; }
modint operator*(modint a, modint b) { return a *= b; }
modint operator^(modint a, int n) {
	if (n == 0)return modint(1);
	modint res = (a*a) ^ (n / 2);
	if (n % 2)res = res * a;
	return res;
}

//逆元(Eucledean algorithm)
ll inv(ll a, ll p) {
	return (a == 1 ? 1 : (1 - p * inv(p%a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }

const int max_n = 1 << 18;
modint fact[max_n], factinv[max_n];
void init_f() {
	fact[0] = modint(1);
	for (int i = 0; i < max_n - 1; i++) {
		fact[i + 1] = fact[i] * modint(i + 1);
	}
	factinv[max_n - 1] = modint(1) / fact[max_n - 1];
	for (int i = max_n - 2; i >= 0; i--) {
		factinv[i] = factinv[i + 1] * modint(i + 1);
	}
}
modint comb(int a, int b) {
	if (a < 0 || b < 0 || a < b)return 0;
	return fact[a] * factinv[b] * factinv[a - b];
}
using mP = pair<modint, modint>;

int dx[4] = { 0,1,0,-1 };
int dy[4] = { 1,0,-1,0 };




void solve() {
    int N; cin >> N;
    ll sumd=0, cnt=0;
    vector<ll> a(N), b(N), c(N);
    rep(i, N) cin >> a[i];
    rep(i, N) cin >> b[i];
	rep(i, N){
		ll tmp = b[i] - a[i];
		if(tmp > 0){
			cnt++;
			sumd += tmp;
		}
		c[i] = tmp;
	}
	sort(all(c));
	rep(i, N){
		if(sumd <= 0) break;
		sumd += c[i];
		cnt++;
	}
	if(sumd > 0){
		cout << -1 << endl;
	}else{
		cout << cnt << endl;
	}
}

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  //cout << fixed << setprecision(10);
  //init_f();
  //init();
  //int t; cin >> t; rep(i, t)solve();
  solve();
//   stop
    return 0;
}


Measured memory_bytes: 6656
def insertion_sort(a, n, g)
  cnt = 0
  g.upto(n-1).each {|i|
    v = a[i]
    j = i - g
    while j >= 0 && a[j] > v do
      a[j+g] = a[j]
      j = j -g
      cnt += 1
    end
    a[j+g] = v
  }
  cnt
end

def shell_sort(a, n)
  cnt = 0
  g = []
  h = 1
  loop do
    g << h
    h = h * 3 + 1
    break if n < h
  end
  m = g.size
  g.reverse!
  0.upto(m-1).each {|i|
    cnt += insertion_sort(a, n, g[i])
  }
  return m, g, cnt
end

n = gets.to_i
a = 1.upto(n).map {gets.to_i}
m, g, cnt = shell_sort(a, n)

puts m
puts g.join(" ")
puts cnt
a.each {|x| puts x}

Measured memory_bytes: 16700
#include <bits/stdc++.h>
#define ll long long
#define mod 1000000007
#define upperlimit 1000100
#define INF 1000000100
#define INFL 1000000000000000100
#define eps 1e-8
#define endl '\n'
#define sd(n) scanf("%d",&n)
#define slld(n) scanf("%lld",&n)
#define pd(n) printf("%d",n)
#define plld(n) printf("%lld",n)
#define pds(n) printf("%d ",n)
#define pllds(n) printf("%lld ",n)
#define pdn(n) printf("%d\n",n)
#define plldn(n) printf("%lld\n",n)
#define REP(i,a,b) for(i=a;i<=b;i++)
#define mp make_pair
#define pb push_back
#define pcc pair<char,char>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vi vector<int>
#define vl vector<ll>
#define vii vector<pii>
#define vll vector<pll>
#define tr(container,it) for(typeof(container.begin()) it=container.begin();it!=container.end();it++)
#define F first
#define S second
#define clr(a) memset(a,0,sizeof(a))
using namespace std;
 
ll gcd(ll n1,ll n2){
    if(!n1)return n2;
    if(!n2)return n1;
    if(n1%n2==0)return n2;
    return gcd(n2,n1%n2);
}
ll powmod(ll base,ll exponent){
    base%=mod;
    ll ans=1;
    while(exponent){
        if(exponent&1)ans=(ans*base)%mod;
        base=(base*base)%mod;
        exponent/=2;
    }
    ans%=mod;
    return ans;
}
int main()
{
    int D,N;
    
    cin>>D>>N;
   if(N==100)N=101; 
   if(D==0) cout<<N<<endl;
   if(D==1) cout<<N*100<<endl;
   if(D==2) cout<<N*10000<<endl;
    
    
  return 0;
}

Measured memory_bytes: 256
int main()
{
  int n,val;
	 scanf("%d",&n);
	((n>=3)&&(n<=10000));
	for(val=1;val<=n; val++)
	{
    int tmp = val;
    if(val%3 == 0) 
	{ 
		printf(" %d",val);
    }
	 else 
	{
      while( tmp>0 )
	  {
        if( tmp%10 == 3 )
		{
          printf(" %d",val);
          break;
        }
        tmp /= 10;
      }
    }
  }
	printf("\n");
	return 0;
}

Measured memory_bytes: 600
#include <iostream>
using namespace std;
typedef long long ll;
int n,k;
ll a[100002],s[100002],t[100002],p=0;
int main(void){
    cin>>n>>k;
    s[0]=t[0]=0;
    for(int i=1;i<=n;i++){
        cin>>a[i];
        s[i]=s[i-1]+a[i];
        t[i]=t[i-1]+max((ll)0, a[i]);
    }
    for(int i=1;i<=n-k+1;i++){
        ll q=t[n]-t[i+k-1]+t[i-1];
        q+=max((ll)0, s[i+k-1]-s[i-1]);
        p=max(p,q);
    }
    cout<<p<<endl;
}


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

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


#define rep(i,n) for(ll (i)=0; (i)<(ll)(n); (i)++)
#define frep(i,m,n) for(ll (i)=(m); (i)<=(ll)(n); (i)++)
#define rrep(i,n) for(ll (i)=(n)-1; (i)>-1; (i)--)
#define frrep(i,m,n) for(ll (i)=(n); (i)>(ll)(m); (i)--)
#define ALL(x) (x).begin(), (x).end()

const ll INF = 100100100100100100;
const ll MOD = 1000000007;

// get abs
ll my_abs(ll a);
// a^n
ll a_n(ll a, ll n);
// get gcd
ll my_gcd(ll a, ll b);
// a^(-1) % MOD 
ll inv(ll a);
// (a+b+c)%MOD
ll madd(ll a, ll b, ll c);
// (a-b)%MOD
ll msub(ll a, ll b);
// (a*b*c)%MOD
ll mtime(ll a, ll b, ll c);


int main() {
    ll x, y;
    cin >> x >> y;
    cout << x+(y/2) << endl;
    return 0;
}

ll my_abs(ll a) {
    if(a >= 0) return a;
    else return -1 *a;
}

ll a_n(ll a, ll n) { 
    if(n == 0) return 1;
    
    ll ret = a, count = 1;
    while(count * 2 < n) {
        ret *= ret;
        count *= 2;
    }
    if(count == n) return ret;
    else return (ret * a_n(a, n-count));
}

ll my_gcd(ll a, ll b) {
    if(b == 0) return a;
    return my_gcd(b, a%b);
}

ll inv(ll a) {
    return a_n(a, MOD-2);
}

ll madd(ll a, ll b, ll c) {
    ll ret = (a+b) % MOD;
    return (ret+c) % MOD;
}

ll msub(ll a, ll b) {
    if(a < b) return (a-b+MOD) % MOD;
    else return (a-b) % MOD;
}

ll mtime(ll a, ll b, ll c) {
    ll ret = (a*b) % MOD;
    return (ret*c) % MOD;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#define maxn 102
using namespace std;
char s1[maxn],s[maxn];
bool d[30][maxn*maxn];
int ans,n;
int main() {
	scanf("%s",s1);
	n=strlen(s1);
	for (int i=1;i<=n;i++)
		s[i]=s1[i-1];
	bool t=true;
	for (int i=2;i<=n;i++)
		if (s[i]!=s[i-1]) {
			t=false;
			break;
		}
	if (t)
		printf("0\n");
	else {
		for (int i=1;i<=n;i++)
			d[s[i]-'a'+1][i]=1;
		for (ans=1;ans<n;ans++) {
			for (int j=1;j<=26;j++) 
				for (int i=1;i<=n-ans;i++) {
					if (d[j][(ans-1)*n+i]||d[j][(ans-1)*n+i+1])
						d[j][ans*n+i]=1;
				}
			for (int j=1;j<=26;j++) {
				t=true;
				for (int i=1;i<=n-ans;i++)
					if (!d[j][ans*n+i]) {
						t=false;
						break;
					}
				if (t)
					break;
			}
			if (t)
				break;
		}
		printf("%d\n",ans);
	}
	return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <set>
#include <vector>
using namespace std;

int main(void){
  int m;
  while(cin>>m,m){
    vector<vector<int> > a(m);
    for(int i=0;i<m;++i) a[i].resize(2);
    for(int i=0;i<m;++i) cin>>a[i][0]>>a[i][1];
    int n;cin>>n;
    multiset<pair<int,int> > b;
    for(int i=0;i<n;++i){
      int bx,by;cin>>bx>>by;
      b.insert(make_pair(bx,by));
    }
    multiset<pair<int,int> >::iterator it=b.begin();
    for(;it!=b.end();++it){
      int ax=a[0][0], ay=a[0][1];
      int bx=it->first, by=it->second;
      bool f=true;
      for(int i=1;i<m;++i){
        if( b.find(make_pair(a[i][0]-ax+bx, a[i][1]-ay+by)) == b.end() ){
          f=false;break;
        }
      }
      if(f==true){
        cout<<-ax+bx<<" "<<-ay+by<<endl;
        break;
      }
    }
  }
  return 0;
}

Measured memory_bytes: 1252
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define INF -99999999
typedef pair<int, int> P;
int main(void)
{
  string S;
  string BS="";
  cin >> S;
  ll Q;
  cin >> Q;

  bool swap = false;
  
  for (ll i = 0; i < Q; i++)
  {
    ll T;
    cin >> T;

    if (T == 1)
    {
      swap = !swap;
      continue;
    }
    else
    {
      ll F;
      cin >> F;
      char C;
      cin >> C;
      if (!swap)
      {
        if (F == 1)
        {
          BS.push_back(C);
        }
        else
        {
          S.push_back(C);
        }
      }
      else{
        if(F==1){
          S.push_back(C);
        }
        else{
          BS+=C;
        }
      }
    }
  }
  reverse(BS.begin(),BS.end());
  
  BS += S;

  if (swap)
  {
    reverse(BS.begin(), BS.end());
  }
  
  cout<<BS<<endl;

  return 0;
}

Measured memory_bytes: 1128
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define fi first
#define se second
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,K,A,B;
string S;
string alpha = "abcdefghijklmnopqrstuvwxyz";
string ALPHA = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";

int main() {
    cin>>S;
    char last = S.at(0);
    rep(i,3){
        char now = S.at(i+1);
        if(last == now){
            cout<<"Bad"<<endl;
            return 0;
        }
        last = now;
    }
    cout<<"Good"<<endl;
}

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

int dot[4]={1, 2, 3, 0};
string s;

void plusdot(void)
{
	++dot[2];
	if(dot[2]>=s.size())
	{
		++dot[1];
		dot[2]=dot[1]+1;
		if(dot[2]>=s.size())
		{
			++dot[0];
			dot[1]=dot[0]+1;
			dot[2]=dot[1]+1;
		}
	}
	return;
}

int main(int argc, char const *argv[])
{
	cin >> s;
	dot[3]=s.size();
	int now=0, f=0, ans=0;
	string tmp;
	while(dot[2]<s.size())
	{
		f=1;
		int j=0;
		for (int i = 0; i < 4; ++i)
		{
			tmp={};
			while (1)
			{
				tmp.push_back(s.at(j));
				++j;
				if(j==dot[i]||j==s.size()) break;
			}
			
			if (tmp=="0") continue;
			else if(tmp.at(0)=='0' || tmp.size()>3) f=0;
			else if(tmp.size()<=2) continue;
			else if(tmp.size()==3&&tmp.at(0)=='1') continue;
			else if(tmp.size()==3&&tmp.at(0)=='2')
			{
				if(tmp.at(1)-'5'<0) continue;
				else if(tmp.at(1)=='5')
				{
					if(tmp.at(2)-'5'<=0) continue;
					else f=0;
				}
				else f=0;
			}
			else f=0; 
		}
		if(f) ++ans;
		plusdot();
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3208
var n,sl:qword;

begin
  //Assign(input,'a.inp');  reset(input);
  //Assign(output,'a.out');  rewrite(output);

  read(n);
  if(n mod 2=0) then
    begin
      sl:=0;
      n:=n div 2;
      while(n<>0) do
        begin
          sl:=sl+(n div 5);
          n:=n div 5;
        end;
      write(sl);
    end
  else write(0);
end.


Measured memory_bytes: 128
(x=>{
data = x.split('\n');
nmxy = data[0].split(' ');
li_1 = data[1].split(' ').map(Number);
li_2 = data[2].split(' ').map(Number);
X = nmxy[2];
Y = nmxy[3];
for(z = 0; z < Y; z++){
	if(X < z && li_1.filter(x=>x<z).length == li_1.length && li_2.filter(x=>x>=z).length == li_2.length) {
		console.log('No War');
		return;
	}
}
console.log('War');
})(require("fs").readFileSync("/dev/stdin", "utf8"));

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

int main() {
  int R,D,X;
  cin >> R >> D >> X;
  int A = X;
  for (int i = 0; i < 10; i++) {
    cout << R*A - D << endl;
    A = R*A - D;
  }
}

Measured memory_bytes: 3624
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <vector>
#include <utility>
#include <climits>
#include <iomanip>
using namespace std;
#define MAXSIZE 100005
#define MAXL 100
#define MOD 998244353
typedef long long int lli;

int main(){
    int n;
    cin >> n;
    string s;
    cin >> s;
    if(n % 2 == 1){
        cout << "No\n";
        return 0;
    }

    string s_former = "";
    string s_latter = "";
    n /= 2;
    for(int i = 0; i < n; ++i){
        s_former += s[i];
        s_latter += s[i + n];
    }
    string ans = (s_former == s_latter) ? "Yes" : "No";
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 888
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define mod 1000000007
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    ll a,b;
    cin>>a>>b;
    if(b%a==0)
        cout<<a+b<<endl;
    else
        cout<<b-a<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

int main()
{
    int dy[] = {1, 1, 0, 1};
    int dx[] = {0, 1, 1, -1};

    for(;;){
        int n;
        cin >> n;
        if(n == 0)
            return 0;

        vector<string> s(n+2);
        s[0] = s[n+1] = string(n+2, '0');
        for(int i=1; i<=n; ++i){
            cin >> s[i];
            s[i] = '0' + s[i] + '0';
        }

        int ret = 0;
        for(int i=1; i<=n; ++i){
            for(int j=1; j<=n; ++j){
                for(int k=0; k<4; ++k){
                    int y = i;
                    int x = j;
                    if(s[y-dy[k]][x-dx[k]] == '1')
                        continue;
                    int num = 0;
                    while(s[y][x] == '1'){
                        ++ num;
                        y += dy[k];
                        x += dx[k];
                    }
                    ret = max(ret, num);
                }
            }
        }

        cout << ret << endl;
    }
}

Measured memory_bytes: 1064
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <iostream>
using namespace std;

int n;
string str;

int main(void){
	cin >> str;
	n=str.size();
	for(int i=0;i<n-1;i++){
		if(str[i]==str[i+1]){
			printf("%d %d\n",i+1,i+2);
			return 0;
		}
	}
	for(int i=0;i<n-2;i++){
		if(str[i]==str[i+2]){
			printf("%d %d\n",i+1,i+3);
			return 0;
		}
	}
	printf("-1 -1\n");
	return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using PLL = pair<ll, ll>;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repn(i,n) for(int i = 0; i <= (int)(n); i++)
#define srep(i,l,n) for(int i = l; i < (int)(n); i++)
#define srepn(i,l,n) for(int i = l; i <= (int)(n); i++)
#define drep(i,n) for(int i = (int)(n-1); i >= 0; i--)
#define drepn(i,n) for(int i = (int)(n); i >= 0; i--)
#define size(s) (int)s.size()
#define debug(var)  do{std::cout << #var << " : ";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }
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; }
template<class T = int> using V = vector<T>;
template<class T = int> using VV = vector<V<T>>;
bool isIn(int i, int j, int h, int w) {return i >= 0 && i < h && j >= 0 && j < w;}
void Yes(){cout << "Yes" << endl;}
void No(){cout << "No" << endl;}
void YES(){cout << "YES" << endl;}
void NO(){cout << "NO" << endl;}
void err() {cout << -1 << endl;}
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define pb push_back
#define ep emplace_back

const int MOD = 1000000007;
const int INF = 1e9;

#define PI acos(-1);
int dx[4] = {1,-1,0,0};
int dy[4] = {0,0,1,-1};
int ddx[8] = {1,1,1,-1,-1,-1,0,0};
int ddy[8] = {0,1,-1,0,1,-1,1,-1};


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin >> s;
    int n = size(s);
    s = '.' + s;
    bool ok = true;
    srepn(i, 1, n-1) if(s[i] != s[n-i]) ok = false;
    if(s[1] != '1' || s[n] != '0') ok = false;
    if(!ok) {
        cout << -1 << endl;
        return 0;
    }
    s[n] = '1';
    queue<int> ones;
    for(int i = 1; i <= n; i++) {
        if(s[i] == '1') ones.push(i);
    }
    srep(i, 1, n) {
        if(ones.front() == i) ones.pop();
        printf("%d %d\n", i, ones.front());
    }

    
}

Measured memory_bytes: 4212
package main

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

var sc = bufio.NewScanner(os.Stdin)

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

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

	n := nextInt()
	c := nextInt()
	k := nextInt()

	slice := make([]int, n)
	for i := 0; i < n; i++ {
		slice[i] = nextInt()
	}

	sort.Ints(slice)

	answer := 0
	i := 0
	for i < n {
		cap := slice[i] + k
		sum := 0
		for i < n && slice[i] <= cap && sum+1 <= c {
			i++
			sum++
		}
		answer++
	}

	fmt.Println(answer)

}


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

int main() {
    int A, B, count = 0;
    cin >> A >> B;

    int a[5];
    for(int i = A; i < (B+1); i++){
        int num = i;
        for(int j = 4; j > -1; j--){
            a[j] = num / std::pow(10, j);
            num -= std::pow(10, j) * a[j]; 
        }
        if((a[4] == a[0]) && (a[3] == a[1]))count++;
    }
    cout << count << endl;
}


Measured memory_bytes: 4036
# include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,b,c,x,ans=0;
	cin>>a>>b>>c>>x;
	for(int i=0;i<=a;i++)
		for(int j=0;j<=b;j++)
			for(int m=0;m<=c;m++)
				if(i*500+j*100+m*50==x)
					ans++;
	cout<<ans;
	return 0;
}

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

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

Measured memory_bytes: 2940
using static System.Math;
using System.Linq;
using System.Collections.Generic;
using System;

public class P
{
    public int x { get; set; }
    public int y { get; set; }
}

public class hello
{
    public static void Main()
    {
        while (true)
        {
            string[] line = Console.ReadLine().Trim().Split(' ');
            var a = int.Parse(line[0]);
            var b = int.Parse(line[1]);
            if (a == 0 && b == 0) break;
            getAns(a, b);
        }
    }
    static void getAns(int a, int b)
    {
        var t1 = getDiv(a);
        var t2 = getDiv(b);
        var ans = int.MaxValue;
        for (int i = 0; i < t1.Count(); i++)
            for (int j = 0; j < t2.Count(); j++)
            {
                var w = getSum(t1[i], t2[j]);
                ans = Min(ans, w);
            }
        Console.WriteLine(ans);
    }
    static int getSum(P p1, P p2)
    {
        var a = new int[4];
        a[0] = p1.x; a[1] = p1.y; a[2] = p2.x; a[3] = p2.y;
        Array.Sort(a);
        return (a[0] - a[1]) * (a[0] - a[1]) + (a[1] - a[2]) * (a[1] - a[2]) +
            (a[2] - a[3]) * (a[2] - a[3]);
    }
    static List<P> getDiv(int n)
    {
        var ans = new List<P>();
        for (int i = 1; i * i <= n; i++)
            if (n % i == 0) ans.Add(new P { x = i, y = n / i });
        return ans;
    }
}



Measured memory_bytes: 18224
#include<iostream>
#include<vector>
#include<utility>
#include<algorithm>

using namespace std;

int main(){
    int N,M;
    cin>>N>>M;
    vector<pair<int,int> > num(M);
    for(int i=0;i<M;i++){
        cin>>num[i].first>>num[i].second;
    }
    sort(num.begin(),num.end());
    int l = 1;
    int r = N;
    int res=1;
    for(int i=0;i<M;i++){
        int L = max(l, num[i].first);
        int R = min(r, num[i].second);
        if (L >= R) {
            L = num[i].first;
            R = num[i].second;
            res++;
        }
        l = L; r = R;
    }
    cout<<res;
  return 0;
}

Measured memory_bytes: 1024
package main

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

var sc, wr = bufio.NewScanner(os.Stdin), bufio.NewWriter(os.Stdout)

func scanString() string   { sc.Scan(); return sc.Text() }
func scanRunes() []rune    { return []rune(scanString()) }
func scanInt() int         { a, _ := strconv.Atoi(scanString()); return a }
func scanInt64() int64     { a, _ := strconv.ParseInt(scanString(), 10, 64); return a }
func scanFloat64() float64 { a, _ := strconv.ParseFloat(scanString(), 64); return a }

func scanInts(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = scanInt()
	}
	return a
}

func debug(a ...interface{}) {
	if os.Getenv("ONLINE_JUDGE") == "false" {
		fmt.Fprintln(os.Stderr, a...)
	}
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}
func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

//•*¨*•.¸¸♪main•*¨*•.¸¸♪(　-ω-)ノ　(　・ω・)
func main() {
	defer wr.Flush()
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1001), 1001001)

	n, m := scanInt(), scanInt()
	uf := newUnionFind(n)

	for i := 0; i < m; i++ {
		a, b := scanInt()-1, scanInt()-1
		uf.unite(a, b)
	}
	cnt := map[int]int{}
	for i := 0; i < n; i++ {
		cnt[uf.find(i)]++
	}
	fmt.Fprintln(wr, len(cnt)-1)
}

type unionFind []int

func newUnionFind(n int) *unionFind {
	uf := make(unionFind, n)
	for i := 0; i < n; i++ {
		uf[i] = -1
	}
	return &uf
}

func (uf unionFind) find(x int) int {
	if uf[x] < 0 {
		return x
	}
	uf[x] = uf.find(uf[x])
	return uf[x]
}

func (uf unionFind) unite(x, y int) bool {
	x, y = uf.find(x), uf.find(y)
	if x != y {
		if uf[x] > uf[y] {
			x, y = y, x
		}
		uf[x] += uf[y]
		uf[y] = x
		return true
	}
	return false
}

func (uf unionFind) size(x int) int {
	return -uf[uf.find(x)]
}


Measured memory_bytes: 8264
//By Don4ick
#define _GLIBCXX_DEBUG

#include <bits/stdc++.h>

#define ll long long
#define pb push_back
#define forn(i, n) for (int i = 1; i <= n; i++)
#define all(x) x.begin(), x.end()
#define y2 qwerqwe

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

using namespace std;

int n, cnt, cur = 3;
string a, b;
long long ans = 1;

int main()
{
	cin >> n >> a >> b;
	int last = 0;
	for (int i = n - 1; i >= 0; i--)
	{
		if (a[i] != b[i])
		{
			i--;
			if (last == 0)
				ans = ans * 6 % MOD;
			else if (last == 1)
				ans = ans * 2 % MOD;
			else	
				ans = ans * 3 % MOD;
			last = 2;
		}
		else
		{
			if (last == 0)	
				ans = ans * 3 % MOD;
			else if (last == 1)
				ans = ans * 2 % MOD;
			last = 1;
		}
	}
	cout << ans << endl;

	return 0;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
//make_tuple emplace_back next_permutation push_back make_pair second first setprecision

#if MYDEBUG
#include "lib/cp_debug.h"
#else
#define DBG(...) ;
#endif

using LL = long long;
constexpr LL LINF=334ll<<53;
constexpr int INF=15<<26;
constexpr LL  MOD=1E9+7;

struct Problem{
    string s;
    multiset<pair<int,int>> m;
    vector<int> mask;
    Problem(string s):s(s),mask(s.size()){};

    void solve(){
        int cnt =0;
        for(int i=0; i<(int)s.size(); ++i){
            cnt^=(1<<(s[i]-'a'));
            m.emplace(cnt,i);
            mask[i]=cnt;
        }
        queue<pair<int,int>> Q;
        Q.emplace(-1,0);
        while(1){
            auto now=Q.front();
            Q.pop();
            int nowmask=now.first<0?0:mask[now.first];
            auto lb = m.lower_bound({nowmask,now.first});
            while(lb!=m.end() and lb->first==nowmask){
                if(lb->second==(int)s.size()-1){
                    cout << now.second+1 <<endl;
                    return ;
                }
                Q.emplace(lb->second,now.second+1);
                lb = m.erase(lb);

            }
            for(int i=0; i<26; ++i){
                int newmask = nowmask^(1<<i);
                auto lb = m.lower_bound({newmask,now.first});
                while(lb!=m.end() and lb->first==newmask){
                    if(lb->second==(int)s.size()-1){
                        cout << now.second+1 <<endl;
                        return ;
                    }
                    Q.emplace(lb->second,now.second+1);
                    lb = m.erase(lb);
                }
            }
        }

    }
};

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    string s;
    cin >> s;
    Problem p(s);
    p.solve();
    return 0;
}



Measured memory_bytes: 11796
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
#define sp(x) fixed << setprecision(x)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const int inf = (1<<30)-1;
const ll INF = (1LL<<60)-1;
const ld EPS = 1e-10;
template<typename T> bool chmax(T &x, const T &y) {return (x < y)? (x = y, true) : false;};
template<typename T> bool chmin(T &x, const T &y) {return (x > y)? (x = y, true) : false;};

int main(){
    int X;
    cin >> X;
    cout << 10-X/200 << endl;
}

Measured memory_bytes: 3592
class Heap
    attr_reader :size
    def initialize
        @heap = []
        @size = 0
    end

    def length
        @size
    end

    def push(x)
        i = @size
        @size += 1
        while i > 0 do
            p = (i - 1) / 2
            break if @heap[p] <= x
            @heap[i] = @heap[p]
            i = p
        end
        @heap[i] = x
        self
    end

    def pop
        return nil if @size == 0
        ret = @heap[0]
        @size -= 1
        x = @heap[@size]
        i = 0
        while i * 2 + 1 < @size do
            a = i * 2 + 1
            b = a + 1
            if b < @size && @heap[b] < @heap[a]
                a = b
            end
            break if @heap[a] >= x
            @heap[i] = @heap[a]
            i = a
        end
        @heap[i] = x
        @heap.pop
        return ret
    end
end

class Dpair
    attr_reader :dist, :vertex
    include Comparable
    def initialize(dist, vertex)
        @dist = dist
        @vertex = vertex
    end
    def <=>(other)
        @dist <=> other.dist
    end
end

# edges[i] = [src, dst, cost]
def dijkstra(start, n, edges)
    e_neighbors = Array.new(n){Hash.new}
    edges.each do |src, dst, cost|
        e_neighbors[src][dst] = cost
    end

    queue = Heap.new
    dist = Array.new(n, Float::INFINITY)
    dist[start] = 0
    queue.push(Dpair.new(0, start))
    while queue.size > 0 do
        dpair = queue.pop
        v = dpair.vertex
        next if dist[v] < dpair.dist
        e_neighbors[v].each do |dst, cost|
            if dist[dst] > dist[v] + cost
                dist[dst] = dist[v] + cost
                queue.push(Dpair.new(dist[dst], dst))
            end
        end
    end
    return dist
end


K = gets.to_i

edges = []
K.times do |i|
    edges.push([i, (i + 1) % K, 1])
    edges.push([i, (i * 10) % K, 0])
end

dist = dijkstra(1, K, edges)

print dist[0] + 1

Measured memory_bytes: 46332
#pragma GCC optimize "03"
#include "bits/stdc++.h"
using namespace std;
 
#define int long long int
#define ld long double
#define pi pair<int, int>
#define pb push_back
#define fi first
#define se second
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#ifndef LOCAL
#define endl '\n'
#endif
 
const int N = 1e5 + 5;
const int mod = 1e9 + 7;
const int inf = 1e18 + 9;

int a[N];

signed main() {
	IOS;
	#ifdef LOCAL
		freopen("input.txt","r", stdin);
		freopen("output.txt","w",stdout);
	#endif
	int n, k;
	cin >> n >> k;
	for(int i = 1; i <= n; i++)
		cin >> a[i];
	int ans = inf;
	for(int i = 1; i <= n-k+1; i++){
		if(a[i] < 0 && a[i+k-1] < 0){
			ans = min(ans, -a[i]);
		}
		else if(a[i] > 0 && a[i+k-1] > 0){
			ans = min(ans, a[i+k-1]);
		}
		else{
			ans = min(ans, a[i+k-1] - a[i] + min(-a[i], a[i+k-1]));
		}
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 1024
import sys
n=int(input())
b=True
print(0)
w1=input()
if w1=="Vacant":
  b=False
  sys.exit()
print(n-1)
w2=input()
if w2=="Vacant":
  b=False
  sys.exit()
left=0
right=n-1
count=2
while b and count<20:
  mid=(left+right)//2
  print(mid)
  w=input()
  count+=1
  if w=="Vacant":
    b=False
    sys.exit()
  else:#left%2 right%2 mid%2 が等しいかどうか全部で4通り
    if left%2==mid%2 and w1!=w:
      right=mid
      w2=w
    elif left%2!=mid%2 and w1==w:
      right=mid
      w2=w
    elif right%2==mid%2 and w2!=w:
      left=mid
      w1=w
    elif right%2!=mid%2 and w2==w:
      left=mid
      w1=w

Measured memory_bytes: 3908
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair< ll, ll > Pi;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep2(i,n) for(int i=1;i<=(n);i++)
#define rep3(i,i0,n) for(int i=i0;i<(n);i++)
#define pb push_back
#define mod 1000000007
const ll INF = 1LL << 60;
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; }
ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}
#define all(x) x.begin(), x.end()
#define mp make_pair
bool compare(Pi a, Pi b) {
    if(a.first != b.first){
        return a.first < b.first;
        
    }else{
        return a.second < b.second;
    }
}


bool In_map(ll y,ll x,ll h,ll w){
    if(y<0 || x<0 || y>=h || x>=w){
        return 0;
    }else{
        return 1;
    }
}
const vector<ll> dx{1,0,-1,0};
const vector<ll> dy{0,1,0,-1};
const int MAX = 510000;
const ll MOD = 10000000000007;

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

int main() {
    ll N;
    string S;
    cin >>N>>S;
    ll r=0,g=0,b=0;
    rep(i,N){
        if(S[i]=='R'){
            r++;
        }else if(S[i]=='G'){
            g++;
        }else{
            b++;
        }
    }
    
    ll ans = r*g*b;

    rep2(i,N){
        rep(j,N){
            if(j+2*i >= N) break;
            if(S[j] != S[j+i] && S[j] != S[j+2*i] && S[j+i] != S[j +2*i]){
                ans--;
            }
        }
    }
    cout << ans << endl;


    return 0;
    

}

Measured memory_bytes: 3616
#include<bits/stdc++.h>
#define mod 1000000007
#define f first
#define second s
using namespace std;
int ar[100001];
int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL); 
	int n , num;
	cin >> n;
	map<int , int> M;
	map<int , int> :: iterator it;
	for( int i = 1; i <= n; i++ ){
		cin >> num;
		it = M.find( num );
		if( it != M.end() ){
			M.erase(it);
		}
		else{
			M[num] = 1;
		}
	}
	cout << M.size();
}    
 

Measured memory_bytes: 4992
use std::cmp::max;
use std::io::*;
use std::str::FromStr;

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

fn main() {
    let x: u32 = read();
    let y: u32 = read();
    println!("{} {}", x*y, x*2+y*2);
}


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

int main() {
    int a, b;
    cin >> a >> b;

    if(a%3 == 0 || b%3 == 0 || (a+b)%3 == 0) {
        cout << "Possible";
    }
    else {
        cout << "Impossible";
    }
    
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'
#define sz(v) (int)v.size() 
#define all(v) v.begin(), v.end()
void dbg_out() { cerr << "\b\b]\n"; }
template<typename Head, typename... Tail> void dbg_out(Head H, Tail... T){ cerr << H << ", "; dbg_out(T...);}
#define watch(...) cerr << "[" << #__VA_ARGS__ << "]: [", dbg_out(__VA_ARGS__)


/****************************** CODE IS HERE ***********************************/


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

    int n; cin >> n;
    ll ans = 0;
    vector <ll> A(n);
    for (ll &i: A) cin >> i;

    for (int i = 1; i < n; ++i) {
        ll diff = max(A[i-1] - A[i], 0LL);
        A[i] += diff;
        ans += diff;
    }

    cout << ans;


    return 0;
}



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

int main() {
    int a, b, c;
    cin >> a >> b >> c;
    int isPoor = 0;
    if(a == b && b != c) isPoor = 1;
    if(b == c && c != a) isPoor = 1;
    if(c == a && a != b) isPoor = 1;
    if(isPoor) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}



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

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl





using ll = long long;

const ll mod = 1e9+7;
const int maxn = 1e6 + 5;





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

    int n,x,t;
    cin>>n>>x>>t;
    int ans = ((n+x-1)/x)*t;
    cout<<ans<<endl;
    
    
    return 0;
}


Measured memory_bytes: 3640
N, W = map(int, input().split())
v = [0] * N
w = [0] * N
for i in range(N):
    v[i], w[i] = map(int, input().split())

dp = [[0] * (W+1) for _ in range(N)]

for i in range(N):
    for j in range(1, W+1):
        if w[i] > j:
            dp[i][j] = dp[i-1][j]
        else:
            dp[i][j] = max(dp[i-1][j], v[i]+dp[i-1][j-w[i]])

print(max(dp[N-1]))



Measured memory_bytes: 25448
import java.util.*;
import java.lang.*;
import java.util.stream.*;

public class Main {
    public static void main(String[] args) {
        //コード
        Scanner scanner = new Scanner(System.in);
        int n = Integer.parseInt(scanner.next());
        int d = Integer.parseInt(scanner.next());

        for(int i = 1; i < n; i++) {
            int bottom = i - d;
            int top = i + d;
            if(bottom == 1) {
                if(n % top == 0) {
                    System.out.println(n/top);
                    System.exit(0);
                } else {
                    System.out.println((n/top) + 1);
                    System.exit(0);
                }
            }
        }
        System.out.println(1);
    }
}


Measured memory_bytes: 23764
import java.util.*;

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

        int N = sc.nextInt();
        int[] h = new int[N];

        for (int i=0; i<N; i++) {
            h[i] = sc.nextInt();
        }
        
        for (int i=N-1; i>0; i--) {
            if (h[i] - h[i-1] > -1) {
                continue;
            }

            if (h[i] - h[i-1] == -1) {
                h[i-1]--;
                continue;
            }

            if (h[i] - h[i-1] < -1) {
                System.out.println("No");
                return;
            }
        }

        System.out.println("Yes");
        return;
    }
}



Measured memory_bytes: 50264
import java.util.*;

public class Main {
	
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int value = n;
		for (int i = 0; ; i++) {
			value = n + i;
			if (value % 111 == 0) {
				break;
			}
		}
		System.out.println(value);
	}
	
}

Measured memory_bytes: 21204
#include <iostream>
#include <climits>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
 
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;

#define MOD 1000000007LL

int n;

string c;
size_t cl;
int lm, rm;

int findw() {
  for (int i = lm; i<(int)cl; i++) {
    if (c[i] == 'W') return i;
  }
  return cl;
}

int findr() {
  for (int i = rm; i>=0; i--) {
    if (c[i] == 'R') return i;
  }
  return -1;
}
int main()
{
  ll ans = 0;
//  int rn, wn;

  cin >> n >> c;

  cl = c.size();
  /*
  rn = wn = 0;
  for (int i=0; i<cl; i++) {
    switch(c[i]) {
    case 'R': rn++; break;
    case 'W': wn++; break;
    }
  }
    */

  lm = 0;
  rm = cl-1;

  lm = findw();
  rm = findr();

  while (lm < rm) {
    c[lm] = 'R';
    c[rm] = 'W';
    ans ++;
    lm = findw();
    rm = findr();
  }

  cout << ans << endl;

  return 0;
}

/*
  全ての赤石を左に寄せる
  全てを赤石にする
  全てを白石にする
  */


Measured memory_bytes: 3732
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
#define tr(container, it) \
        for (auto it = container.begin(); it != container.end(); it++)
#define scontains(c, x) ((c).find(x) != (c).end())   //O(log n)
#define contains(c, x) (find((c).begin(),(c).end(),x) != (c).end()) //O(n)
#define pll pair<ll,ll>
#define pii pair<int,int>
#define mll map<ll,ll>
#define intv(x, a, b)((x)>=a && (x)<=b)
#define  rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define  _for(i, end) for (__typeof(end) i = 0; i < (end); i += 1)
#define all(x) (x).begin(),(x).end()
//#define len(array)  (sizeof(array)/sizeof((array)[0]))
#define what_is(x) cerr << #x << " is " << x << endl;
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
#define mod(x, m) ((((x) % (m)) + (m)) % (m))
const double PI = 2 * acos(.0);
const int INF = 0x3f3f3f3f;
const ll LLINF = 1000000000000000005LL;;
const ll MOD = (ll) (1e9) + 7;

void _mod(ll &x) { x = mod(x, MOD); }

//const ll MOD = (ll) 998244353 ;
const double EPS = 1e-10;

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
    std::fill((T *) array, (T *) (array + N), val);
}


//#define int ll

int sum = 0;
int used[10], g[10][10];
class COneStrokePath {
public:
    int N, M;
    void dfs(int v, int n) {
        if (n == N)sum++;
        used[v] = 1;
        rep(i,1,N+1)if (!used[i] && g[v][i])dfs(i, n + 1);
        used[v] = 0;
    }

    void solve(std::istream &cin, std::ostream &cout) {
        memset(used,0,sizeof(used));
//        memset(g,0,sizeof(g));
        sum = 0;
        cin >> N >> M;
        _for(i, M) {
            int a, b;
            cin >> a >> b;
            g[a][b] = g[b][a] = 1;
        }
        dfs(1, 1);
        cout << sum << endl;
    }
};


#undef int
int main() {
	COneStrokePath solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 256
import sys
from collections import deque
read = sys.stdin.read

N, *ab = map(int, read().split())

graph = [[] for _ in range(N + 1)]
 
for a, b in zip(*[iter(ab)] * 2):
    graph[a].append(b)
 
color = [0] * (N + 1)
queue = deque([1])
 
while queue:
    V = queue.popleft()
    number = 1
    for v in graph[V]:
        if number == color[V]:
            number += 1
        color[v] = number
        queue.append(v)
        number += 1
 
print(max(color))
for a, b in zip(*[iter(ab)] * 2):
    print(color[b])

Measured memory_bytes: 25900
//Chandigarh University
//author:- shivamkr21 (pseduo coders)
#include<bits/stdc++.h>
#define lli long long int
#define endl "\n"
// #define loop(i,n) for(long long int (a)=i, (a)<n, (a)++)
#define mod 1000000007
using namespace std;
int main()
{
  lli a,b;
  cin>>a>>b;
  if(a>b)
  	for(lli i=0;i<a;i++)
    {
      cout<<b;
    }
  else
    for(lli i=0;i<b;i++)
    {
      cout<<a;
    }
  return 0;
}


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

using namespace std;

int main()
{
    int N,K,h,i,c;

    cin>>N>>K;

    c = 0;
    for(i=0;i!=N;i++)
    {
        cin>>h;

        if(h >= K)
            c++;
    }

    cout<<c;

    return 0;
}

Measured memory_bytes: 3624