akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = a; i < (b); i++)
#define rrep(i, a, b) for (int i = a; i >= (b); i--)
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
template <class T>
inline bool chmin(T& a, T b) {
   if (a > b) {
      a = b;
      return true;
   }
   return false;
}
template <class T>
inline bool chmax(T& a, T b) {
   if (a < b) {
      a = b;
      return true;
   }
   return false;
}
void hr() {
   cerr << "--------------" << endl;
}
const int INF = 1001001001;
const int MOD = 1000000007;

struct mint {
   ll x;
   mint(ll x = 0) { (this->x = (x + MOD)) %= MOD; }
   mint operator-() const { return mint(-x); }
   mint& operator+=(const mint a) {
      if ((this->x += a.x) >= MOD) x -= MOD;
      return *this;
   }
   mint& operator-=(const mint a) {
      if ((this->x += MOD - a.x) >= MOD) this->x -= MOD;
      return *this;
   }
   mint& operator*=(const mint a) {
      (this->x *= a.x) %= MOD;
      return *this;
   }
   mint operator+(const mint a) const {
      mint res(*this);
      return res += a;
   }
   mint operator-(const mint a) const {
      mint res(*this);
      return res -= a;
   }
   mint operator*(const mint a) const {
      mint res(*this);
      return res *= a;
   }
   mint pow(ll t) const {
      if (!t) return 1;
      mint a = pow(t >> 1);
      a *= a;
      if (t & 1) a *= *this;
      return a;
   }
   mint inv() const { return pow(MOD - 2); }
   mint& operator/=(const mint a) { return *this *= a.inv(); }
   mint operator/(const mint a) const {
      mint res(*this);
      return res /= a;
   }
};
istream& operator>>(istream& is, mint& a) {
   return is >> a.x;
}
ostream& operator<<(ostream& os, const mint& a) {
   return os << a.x;
}
int main() {
   cin.tie(0);
   ios_base::sync_with_stdio(0);

   int n, k;
   cin >> n >> k;
   vector<int> a(n);
   vector<int> s, t;
   rep(i, 0, n) {
      cin >> a[i];
      if (a[i] > 0)
         s.push_back(a[i]);
      else
         t.push_back(a[i]);
   }

   int S = s.size();
   int T = t.size();
   bool ok = false;
   if (S > 0) {
      if (n == k)
         ok = (T % 2 == 0);
      else
         ok = true;
   } else {
      ok = (k % 2 == 0);
   }
   mint ans = 1;
   if (!ok) {
      sort(a.begin(), a.end(), [](int x, int y) { return abs(x) < abs(y); });
      rep(i, 0, k) ans *= a[i];
   } else {
      sort(s.begin(), s.end());
      sort(t.rbegin(), t.rend());
      if (k % 2 == 1) {
         ans *= s.back();
         s.pop_back();
      }
      vector<ll> p;
      while (s.size() >= 2) {
         ll x = s.back();
         s.pop_back();
         x *= s.back();
         s.pop_back();
         p.push_back(x);
      }
      while (t.size() >= 2) {
         ll x = t.back();
         t.pop_back();
         x *= t.back();
         t.pop_back();
         p.push_back(x);
      }
      sort(p.rbegin(), p.rend());
      rep(i, 0, k / 2) ans *= p[i];
   }
   cout << ans << endl;
   return 0;
}

Measured memory_bytes: 6372
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repI(i, d, n) for (int i = (d); i < (n); ++i)
#define reps1(i, n) for (int i = 1; i < (n); ++i)
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

using ll = long long;
using P = pair<int, int>;
using Pl = pair<ll, ll>;
using M = map<int, int>;
using Ml = map<ll, ll>;
ll const INF = 1ll<<61;
double pi = 3.141592653589793238;

int main() {
  string n;
  cin >> n;
  for(char c: n) {
    if (c == '1') cout << 9;
    else cout << 1;
  }
  cout << endl;

  return 0;
}


Measured memory_bytes: 256
from collections import*
a=deque([1,2,3,4,5,6,7,8,9])
k=int(input())
for _ in range(k):
  i=a.popleft()
  if i%10>0:a.append(10*i+i%10-1)
  a.append(10*i+i%10)
  if i%10<9:a.append(10*i+i%10+1)
print(i)

Measured memory_bytes: 74764
#include <iostream>
#include <map>
#include <vector>
#include <algorithm>
#include <map>
#include <string>
#include <queue>
#include <set>
#include <math.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<ll, P> Q;
const ll mod = 1000000007;
const ll INF = 1000000000000000;

ll n, a[110], b[110];
ll bit[100010], ans;

bool used[100010];

ll sum(ll i)
{
	ll s = 0;
	while (i > 0)
	{
		s += bit[i];
		i -= i & -i;
	}
	return s;
}

void add(ll i, ll x)
{
	while (i <= n)
	{
		bit[i] += x;
		i += i & -i;
	}
}

ll pow_mod(ll x, ll y)
{
	ll res = 1;
	while (y > 0)
	{
		if (y % 2 == 1)
		{
			(res *= x) %= mod;
		}
		(x *= x) %= mod;
		y /= 2;
	}
	return res;
}

ll div(ll x)
{
	return pow_mod(x, mod - 2);
}



int main(void)
{
	cin >> n;
	ll ans = 0;

	for (int i = 1; i < n; i++)
	{
		cin >> b[i];
		if (i == 1)
		{
			ans += b[i];
		}
		else
		{
			if (b[i] >= b[i - 1])
			{
				ans += b[i - 1];
			}
			else
			{
				ans += b[i];
			}
		}
	}
	ans += b[n - 1];

	cout << ans << endl;
	
	
	int www;
	cin >> www;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <vector>
#include <functional>
#include <cstdlib>
#include <map>
#include <set>
#include <iostream>
#include <string>
#include <ctype.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
typedef long long lint;


int main(){
	int a[3][3]={};
	int n;
	REP(i,3) REP(j,3) cin >> a[i][j];
	cin >> n;
	int b[n]={};
	REP(i,n) cin >> b[i];
	
	REP(i,3){
		REP(j,3){
			REP(k,n){
				if(a[i][j] == b[k]) a[i][j] = 0;
			}
		}
	}
	
	if(a[0][0]==a[1][1] && a[1][1]==a[2][2] && a[2][2]==0){
		cout << "Yes\n";
		return 0;
	} 
	if(a[0][2]==a[1][1] && a[1][1]==a[0][2] && a[0][2]==0){
		cout << "Yes\n";
		return 0;
	} 
	REP(i,3){
		if(a[i][0]==a[i][1] && a[i][1]==a[i][2] && a[i][2]==0){
		cout << "Yes\n";
		return 0;
		} 
	}
	REP(i,3){
		if(a[0][i]==a[1][i] && a[1][i]==a[2][i] && a[2][i]==0){
		cout << "Yes\n";
		return 0;
		} 
	}
	
	cout << "No\n";
	return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC088A
{
    class Program
    {
        static void Main(string[] args)
        {
            int a,b;
            a = int.Parse(Console.ReadLine());
            b = int.Parse(Console.ReadLine());
            if ((a % 500) <= b)
                Console.WriteLine("Yes");
            else
                Console.WriteLine("No");
            Console.ReadKey();
        }
    }
}


Measured memory_bytes: 11092
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#define REP(i,n) for (int i=0;i<(n);i++)
#define ll long long
#define ull unsigned long long
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

using namespace std;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
	string s;
	cin >> s;
	REP(i,s.size())if(s[i] == ',')s[i] = ' ';
	cout << s << endl;
  return 0;
}


Measured memory_bytes: 384
#include <cstdio>
 
using namespace std;
int a[34]={0, 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
int K;
int main(){
	scanf("%d",&K);
    printf("%d",a[K]);
	return 0;
}

Measured memory_bytes: 128
var GET=(function(){function f(s){return new g(s);}function g(s){this._s=s.trim().split("\n");this._y=0;}g.prototype.a=function(f){var s=this._s, y=this._y, r;if(typeof s[y]==="string")s[y]=s[y].split(" ").reverse();r=s[y].pop();if(!s[y].length)this._y++;return f?r:+r;};g.prototype.l=function(f){var s=this._s[this._y++].split(" ");return f?s:s.map(a=>+a);};g.prototype.m=function(n,f){var r=this._s.slice(this._y,this._y+=n).map(a=>a.split(" "));return f?r:r.map(a=>a.map(a=>+a));};g.prototype.r=function(n,f){var r=this._s.slice(this._y,this._y+=n);return f?r:r.map(a=>+a);};return f;})();
var o=GET(require("fs").readFileSync("/dev/stdin","utf8"));
function xArray(v){var a=arguments,l=a.length,r="Array(a["+--l+"]).fill(0).map(x=>{return "+v+";})";while(--l)r="Array(a["+l+"]).fill(0).map(x=>"+r+")";return eval(r);}

console.log(main());
function main(){
  var s = o.a(1);
  var ans = 0;
  var a = 0;
  for(var i = 0; i < s.length; i++){
    if(s[i] === "A"){
      a++;
    }else if(s[i]+s[i+1] === "BC"){
      ans += a;
      i++;
    }else a = 0;
  }
  return ans;
}

Measured memory_bytes: 21192
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
import java.util.NoSuchElementException;

class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;

    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        } else {
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }

    private int readByte() {
        if (hasNextByte())
            return buffer[ptr++];
        else
            return -1;
    }

    private static boolean isPrintableChar(int c) {
        return 33 <= c && c <= 126;
    }

    public boolean hasNext() {
        while (hasNextByte() && !isPrintableChar(buffer[ptr]))
            ptr++;
        return hasNextByte();
    }

    public String next() {
        if (!hasNext())
            throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while (isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    public long nextLong() {
        if (!hasNext())
            throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while (true) {
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            } else if (b == -1 || !isPrintableChar(b)) {
                return minus ? -n : n;
            } else {
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }

    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
            throw new NumberFormatException();
        return (int) nl;
    }

    public double nextDouble() {
        return Double.parseDouble(next());
    }
}

public class Main {
    static int[] w = new int[100010];
    static int[] v = new int[100010];
    static int[][] dp = new int[110][100010];
    static int k;

    static int chmin(int a, int b) {
        if (a > b) {
            a = b;
            return a;
        }
        return a;
    }

    static int chmax(int a, int b) {
        if (a < b) {
            a = b;
            return a;
        }
        return a;
    }

    public static void main(String[] args) {
        FastScanner fs = new FastScanner();
        int a = fs.nextInt();
        int b = fs.nextInt();
        int time = a + b;
        if (time >= 24)
            time -= 24;
        System.out.println(time);
    }

}


Measured memory_bytes: 80212
#include <bits/stdc++.h>
#define pb push_back
#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;

#define Pr(f,...) //fprintf(stderr,f,##__VA_ARGS__),fflush(stderr)

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

bool small(ll a,ll b){
	ll A=0,B=0,x;
	for(x=a;x;x/=10)A+=x%10;
	for(x=b;x;x/=10)B+=x%10;
	return a*B<=b*A;
}

int main(int argc,char *argv[]){
#ifdef CURIOUSCAT
#endif
	ll n,p=0,i;
	for(cin>>n,i=1;n;){
		p+=i;
		if(small(p,p+i))printf("%lld\n",p),--n;
		else p-=i,i*=10;
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <memory>
#include <complex>
#include <numeric>
#include <cstdio>
#include <iomanip>

#define REP(i,m,n) for(int i=int(m);i<int(n);i++)
#define EACH(i,c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR 
#endif
using namespace std;

using UI = unsigned int;
using UL = unsigned long;
using LL = long long int;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VS = vector<string>;
using PII = pair<int,int>;
using VP = vector<PII>;

//struct edge {int from, to, cost;};

constexpr double EPS = 1e-10;
constexpr double PI  = acos(-1.0);
//constexpr int INF = INT_MAX;

template<class T> inline T sqr(T x) {return x*x;}

int main() {
    int n,a,b;
    cin >> n >> a >> b;
    if (n == 1) {
        if (a == b) cout << 1 << endl;
        else cout << 0 << endl;
        return 0;
    }
    if (a > b) {
        cout << 0 << endl;
        return 0;
    }
    LL minv = (LL)a * (n - 1) + b;
    LL maxv = a + (LL)b * (n - 1);
    cout << maxv - minv + 1 << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define rep(i,s,f) for(i=s;i<f;i++)
#define print(v) for(auto &z:v) cout<<z<<' ';cout<<'\n'
#define hi cout<<'h'<<'i'<<'\n' 
#define pb push_back
#define pii pair<int,int>
#define F first
#define S second
#define B begin()
#define E end()
#define sz(v) (int)((v).size())
#define vi vector<int>
#define vii vector<pair<int,int>>
#define boost ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define clk1 clock_t start_time=clock()
#define clk2 cout<<(clock()-start_time)/(double)CLOCKS_PER_SEC
#define clean(arr) memset(arr,0,sizeof(arr))
#define mod 1000000007
#define mod2 998244353
#define space 100005
//<<fixed << setprecision(9)

int main()
{
    int n,i,j,t;
    boost;

    cin>>t;
    cout<<t*t;

    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <climits>
#include <algorithm>
#include <map>
#include <utility>

#define int long long

using namespace std;

int c(int x) {
    return x * (x - 1) / 2;
}

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

    int x, n, d;

    cin >> n >> x >> d;

    if (d == 0) {
        if (x == 0)
            cout << "1\n";
        else
            cout << n + 1 << "\n";

        return 0;
    }

    if (d < 0) {
        x *= (-1);
        d *= (-1);
    }

    map<int, vector<pair<int, int>>> seg;

    for (int a = -n; a <= n; a++) {
        if ((a & 1) != (n & 1))
            continue;

        int plus = (n + a) / 2;
        int minus = n - plus;

        int bmin = 2 * c(plus) - c(n);
        int bmax = -2 * c(minus) + c(n);

        int p = a * x + bmin * d;
        int k = (bmax - bmin) / 2 + 1;

        int q = p % (2 * d);
        if (q < 0) q += 2 * d;

        seg[q].push_back({(p - q) / (2 * d), (p - q) / (2 * d) + k});
    }

    int res = 0;

    for (auto &each : seg) {
        auto &arr = each.second;
        sort(arr.begin(), arr.end());

        int r = LLONG_MIN;

        for (auto el : arr) {
            if (el.second <= r) continue;
            res += el.second - max(r, el.first);
            r = el.second;
        }
    }

    cout << res << "\n";

    return 0;
}


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

int main(){
	
	int m , sum ;
	int c , a , n ;
	int x ;
	
	cin >> m ;
	for( int i=0 ; i<m ; i++ ){
		cin >> c >> a >> n ;
		
		sum = 0 ;
		
		if( c >= 1 && a >= 1 && n >= 1 ){
			if( c <= a && c <= n ) x = c ;
			else if( a <= c && a <= n ) x = a ;
			else x = n ;
			sum += x ;
			c -= x ;
			a -= x ;
			n -= x ;
		}
		if( c >= 2 && a >= 1 ){
			x = min( c/2 , a ) ;
			sum += x ;
			c -= x*2 ;
			a -= x ;
		}
		if( c >= 3 ) sum += c/3 ;
		
		cout << sum << endl ;
	}
	
return 0; 
}

Measured memory_bytes: 1164
N,K = map(int,input().split())
S = []
d = {}
A = list(map(int,input().split()))
ans = 0
sum =0
for i in range(1,N+1):
    sum += A[i-1] % K
    s = (sum - i) % K
    if i > K:
        x = S.pop(0)
        d[x] -= 1
    elif i < K:
        if s == 0:
            ans += 1
    if s not in d:
        d[s] = 0
    ans += d[s]
    d[s] += 1
    S.append(s)
print(ans)


Measured memory_bytes: 38820
def palindrome(S):
    N=len(S)
    for i in range(N):
        if S[i]!=S[N-i-1]:
            return False
    return True
def g(S):
    N=len(S)
    if palindrome(S)==True and palindrome(S[(((N+3)//2)-1):])==True and palindrome(S[:((N-1)//2)])==True:
        return "Yes"
    else:
        return "No"
S=input()
print(g(S))
    

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

using namespace std;

typedef long long ll;

#define rep(i,p,q) for(ll i = p; i < q; i++)

ll gcd(ll a, ll b){
    if(a < b) swap(a,b);
    if(a % b == 0) return b;
    else{
        return gcd(b,a % b);
    }
}

ll gcd(ll a, ll b, ll c){
    ll ab = gcd(a,b);
    ll bc = gcd(b,c);
    return gcd(ab,bc);
}

int main(void){
    ll k;
    cin >> k;
    k++;
    ll ans = 0;
    rep(i,1,k){
        rep(j,1,k){
            rep(m,1,k){
                ans += gcd(i,j,m);
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3652
#include<bits/stdc++.h>
#define int long long int
#define ld long double
#define getFaster ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define rep(i,init,n) for(int i=init;i<n;i++)
#define rev(i,n,init) for(int i=n;i>=init;i--)
#define MAXN 200005
#define MOD2 998244353
#define MOD1 1e9+7
#define f first
#define s second
#define endl '\n'
#define pii pair<int,int>
#define piii pair<pii,int>
#define precise(i) cout<<fixed<<setprecision(i)
using namespace std;
const long double PI = atan(1.0)*4;
const int64_t INF=INT64_MAX;
const int32_t LOG=21;
const int MOD=MOD2;

int cnt[4005][3];
map<char,int> m;

int32_t main()
{ 
      getFaster;
      int tests=1;
      //cin>>tests;
      rep(ii,0,tests)
      {
             m['R']=0,m['G']=1,m['B']=2;

             int n;
             cin>>n;
             string s;
             cin>>s;

             rep(i,1,n+1)
             {
                  cnt[i][m[s[i-1]]]++;
                  rep(j,0,3)cnt[i][j]+=cnt[i-1][j];
             }

             int ans=0;
             rep(i,1,n+1)
             {
                  rep(j,i+1,n+1)
                  {
                        int diff=j-i;
                        if(s[i-1]!=s[j-1])
                        {
                              int val=3-m[s[i-1]]-m[s[j-1]];
                              //cout<<"YO "<<i<<" "<<j<<" "<<val<<endl;
                              int k=i-diff;
                              int toSub=0;
                              int add=0;
                              if(k>=1 && m[s[k-1]]==val)toSub++;

                              ans+=cnt[i-1][val];
                              ans-=toSub;
                        }      
                  }
             }
             cout<<ans<<endl; 
      }

      return 0;                         
}

/*
 TIPS(FOR ME):
 1.) Check for corner cases (like 0 is exception case)
 2.) Check for global memory sizes,memory refreshments and its complexity 
 3.) Check for sorting criteria (if used 1-based indexing)
 4.) Check for numbers overflow (while multiplying and doing MOD)
 5.) Check for typecasting issues like int to float( while dividing numbers)
*/


Measured memory_bytes: 3684
def abc173b_judge_status_summary():
    n = int(input())
    cnt_dict = {'AC': 0, 'WA': 0, 'TLE': 0, 'RE': 0}
    for _ in range(n):
        cnt_dict[input()] += 1

    print('AC x', cnt_dict['AC'])
    print('WA x', cnt_dict['WA'])
    print('TLE x', cnt_dict['TLE'])
    print('RE x', cnt_dict['RE'])

abc173b_judge_status_summary()

Measured memory_bytes: 9204
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        ITP1_1_B(args);
    }

    public static void ITP1_1_B(String[] args) {

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        System.out.println(n * n * n);
    }
}



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

int main() {
  int x, a; cin >> x >> a;
  if (x < a) cout << 0;
  else cout << 10;
  return 0;
}

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

int main(){
  string a, b;
  cin >> a >> b;
  if(a.size() < b.size()) cout << "LESS" << endl;
  else if(a.size() > b.size()) cout << "GREATER" << endl;
  else if(a == b) cout << "EQUAL" << endl;
  else if(a < b) cout << "LESS" << endl;
  else if(a > b) cout << "GREATER" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main()
{
	int e[101][101];
	int R, C, r, c;
	int s, total;

	scanf("%d%d", &R, &C);
	for (r = 1; r <= R; r++) {
		for (c= 1; c <= C; c++) scanf("%d", &e[r][c]);
	}
	
	for (r = 1; r <= R; r++) {
		s = 0;
		for (c = 1; c <= C; c++) s += e[r][c];
		e[r][0] = s;
	}
	total = 0;
	for (c = 1; c <= C; c++) {
		s = 0;
		for (r = 1; r <= R; r++) s += e[r][c];
		e[0][c] = s;
		total += s;
	}
	for (r = 1; r <= R; r++) {
		for (c = 1; c <= C; c++) printf("%d ", e[r][c]);
		printf("%d\n", e[r][0]);
	}
	for (c = 1; c <= C; c++) printf("%d ", e[0][c]);
	printf("%d\n", total);
	return 0;
}


Measured memory_bytes: 2048
//
// Created by moono on 2018/10/27.
//

#include <algorithm>
#include <iostream>
#include <string>
#include <cmath>
using namespace std;



int main() {
    string S;
    cin >> S;

    cout << S.rfind("Z") - S.find("A") + 1<< endl;



    return 0;
}

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

#define rep(i,n) for(i = 0;i < n;++i)
#define all(v) v.begin(), v.end()
using ll = long long;

struct UnionFind
{
    int i;
    vector<int> par;
    vector<int> size;
    UnionFind(int n): par(n),size(n,1){
        for(i = 0;i < n;++i){
            par.at(i) = i;
        }
    }
    
    int root(int x){
        if(par.at(x) == x){
            return x;
        }else{
            return par.at(x) = root(par.at(x));
        }
    }
    
    void unite(int x, int y){
        int rx = root(x);
        int ry = root(y);
        if(rx == ry){
            return;
        }else{
            if(size.at(rx) < size.at(ry)){
                swap(rx,ry);
            }
            par.at(ry) = rx;
            size.at(rx) += size.at(ry);
            return;
        }
    }
    
    bool same(int x, int y){
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
    
    int get_size(int x){
        return size.at(root(x));
    }
};

int main()
{
    ll i,j;
    ll n;
    cin >> n;
    vector<ll> x(n);
    vector<ll> y(n);
    for(i = 0;i < n;++i){
        cin >> x.at(i) >> y.at(i);
    }

    priority_queue<pair<ll,pair<ll,ll>>> pq; //優先度付きキュー

    vector<ll> ids(n);
    iota(all(ids), 0);
    sort(all(ids), [&](ll i, ll j){ return x.at(i) < x.at(j);});
    for(i = 0;i + 1 < ids.size();++i){
        ll u = ids.at(i);
        ll v = ids.at(i+1);
        pq.emplace(x.at(u) - x.at(v),make_pair(u,v));
    }
    sort(all(ids), [&](ll i, ll j){ return y.at(i) < y.at(j);});
    for(i = 0;i + 1 < ids.size();++i){
        ll u = ids.at(i);
        ll v = ids.at(i+1);
        pq.emplace(y.at(u) - y.at(v),make_pair(u,v));
    }
    
    ll ans = 0; //最小全域木の重み
    
    UnionFind uf(n); //連結管理(UnionFind)
    while(!pq.empty()){
        auto x = pq.top();
        pq.pop();
        ll w = -x.first;
        ll s = x.second.first;
        ll t = x.second.second;
        if(uf.same(s,t)) continue; //連結は排除
        ans += w;
        uf.unite(s,t);
    }

    cout << ans << endl;

    return 0;
}

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

int main(){
  int N, K ;
  long int total = 0 ;
  long int ansA = 0, ansB = 0 ;
  cin >> N >> K ;
  int A[N] ;
  for(int i=0;i<K;i++){
    cin >> A[i] ;
    A[i]++ ;
    total += A[i] ;
  }  
  long int Max = total ;
  for(int i=K;i<N;i++){
    cin >> A[i] ;
    A[i]++ ;
    total = total + A[i] - A[i-K];
    Max = max(total, Max) ;
  }  
  ansA = Max / 2 ;
  ansB = Max % 2 ;
  cout << ansA ;
  if(ansB == 1) cout << ".5" ;
  cout << endl ;
  return 0 ;
}

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

int main() {

  int n;
  cin >> n;

  // l × m 行列と m × n 行列の積では、l × m × n 回の計算が生じる
  // M_i を p_i-1 × p_i 行列とすると、M_i × M_i+1 の計算回数は、p_i-1 × p_i × p_i+1 となる
  // M_1, M_2, M_3 が与えられたとき、((M_1 × M_2) × M_3) と (M_1 × (M_2 × M_3)) の計算量が少ない方を選択する

  // p:M_i を p_i-1 × p_i 行列とする
  vector<int> p(n+1);
  for (int i = 1; i <= n; i++) {
    cin >> p[i-1] >> p[i];
  }

  // cost[i][j]:M_i から M_j までの最小計算量
  vector<vector<int>> cost(n+1, vector<int> (n+1));

  // i から l 個まで調べる
  for (int l = 2; l <= n; l++) {
    for (int i = 1; i <= n - l + 1; i++) {
      // i から l までの個数
      int j = i + l - 1;
      // 大きい数値を入れておく
      cost[i][j] = 1000000007;
      // i から j 回調べる
      for (int k = i; k < j; k++){
        cost[i][j] = min(cost[i][j], cost[i][k] + cost[k+1][j] + p[i - 1] * p[k] * p[j]);
      }
    }
  }

  cout << cost[1][n] << endl;

  return 0;

}


Measured memory_bytes: 3212
#include <iostream>
#include <ccomplex>
#include <vector>
#include <cassert>
#include <utility>
#include <algorithm>
#include <string>
#include <deque>
#include <queue>
#include <functional>
#include <cmath>
#include <iomanip>
#include <map>
#include <numeric>
#include <list>
#include <assert.h>
#include <math.h>
#include <valarray>
#include <stdio.h>
#include <algorithm>
#include <set>
#include <complex>
#include <list>
#include <time.h>
#include <stack>
#include <locale>
#include <clocale>
#include <ctype.h>
#include <wchar.h>

using namespace std;
typedef long long int LL;
typedef pair<long long int, long long int> pii;
typedef pair<double, double> pdd;

#define SORT(c) sort((c).begin(),(c).end())
#define BACKSORT(c) sort((c).begin(),(c).end(),std::greater<LL>())
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

int xcomp(vector<LL>& a, vector<LL>& b) {
	return a[0] < b[0];
}

#define XSORT(c) sort((c).begin(),(c).end(),xcomp)

#define ALL(x) (x).begin(),(x).end()
LL mod = 1000000007;

int main() {
	LL N, M;
	cin >> N >> M;
	vector<LL> v(N, 0);
	REP(i, M) {
		LL a, b;
		cin >> a >> b;

		v[a - 1]++;
		v[b - 1]++;
	}
	REP(i, N) {
		cout << v[i] << endl;
	}
}

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

int main() {
    string topping;
    int ramen = 700;
    cin >> topping;
    for (int i = 0; i < 3; i++)
    {
        if (topping[i] == 'o') ramen += 100;
    }
    cout << ramen << endl;
}


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

int main(void){

    int n;

    scanf("%d", &n);

    long long a[n];
    long long sum = 0, c = 0;

    for(int i = 0; i < n; i++){
        scanf("%lld", &a[i]);
    }

    long long b[n];

    for(int i = 0; i < n; i++){
        b[i] = a[i];
    }

    if(b[0] <= 0){
        c = 1 - b[0];
        b[0] = 1;
    }
    sum = b[0];

    for(int i = 1; i < n; i++){
        if(sum * (sum + b[i]) >= 0){
            if(sum > 0){
                c += b[i] + 1 + sum;
                b[i] = -1-sum;
            }else if(sum < 0){
                c += 1 - sum - b[i];
                b[i] = 1 - sum;
            }
        }
        sum += b[i];
    }

    long long d = 0;

    if(a[0] >= 0){
        d = a[0] + 1;
        a[0] = -1;
    }
    sum = a[0];

    for(int i = 1; i < n; i++){
        if(sum * (sum + a[i]) >= 0){
            if(sum > 0){
                d += a[i] + 1 + sum;
                a[i] = -1-sum;
            }else if(sum < 0){
                d += 1 - sum - a[i];
                a[i] = 1 - sum;
            }
        }
        sum += a[i];
    }

    if(c > d){
        printf("%lld\n", d);
    }else{
        printf("%lld\n", c);
    }

    return 0;
}

Measured memory_bytes: 3248
#include <bits/stdc++.h>
#include <cmath>
#include <numeric>
using namespace std;
#define rep(i,a,b) for(int64_t i=(a);i<(b);++i) // a ≦ i < b 
#define Rrep(i,a,b) for(int64_t i=(a);i>=(b);--i) // reverse repeat. a から b まで減少．
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend() //逆イテレータ
#define RANGE(a,b,c) (a).begin()+(b),(a).begin()+(c) // [b,c) イテレータ
#define INF 1000000000000000
#define MOD 1000000007
using PII = pair<int64_t, int64_t>;
using VI = vector<int64_t>;
using VVI = vector<VI>;
using VS = vector<string>;
using VP = vector<PII>;
using i64 = int64_t;
template<typename T> void invec(vector<T> &A){for(T& a:A) cin >> a;} 

#include <boost/multiprecision/integer.hpp>
long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m; 
    if (u < 0) u += m;
    return u;
}
template <typename T>
unordered_map<T, int> count_prime(T N){
    unordered_map<T, int> num; // N の素因数の個数
    T n = N;
    for(T j = 2; j * j <= N; ++j)
        while (n % j == 0) {
            ++num[j];
            n /= j;
        }

    if (n != 1) ++num[n];
    return num;
}

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

int N; cin >> N;
VI A(N); invec(A);

// i64 maxA = *max_element(ALL(A));
unordered_map<i64, int> cntp;
for(i64 a: A){
    unordered_map<i64, int> cnta = count_prime(a);
    for (pair<i64, int> p: cnta)
        cntp[p.first] = max(cntp[p.first], p.second);
}

i64 L = 1;
// rep(i, 2, maxA+1) if (cntp[i] > 0)
for(pair<i64, int> p: cntp)
    (L *= boost::multiprecision::powm(p.first, p.second, MOD)) %= MOD;

i64 ans = 0;
for(i64 a: A) 
    (ans += L * modinv(a, MOD) %MOD) %= MOD;

cout << ans % MOD << "\n";

return 0;
}
// コンテスト前はtemplate振り返り。
// 書いて考える．場合分け．情報整理．
// 単純に分かる量から．愚直解を実装して研究．
// 境界，出力文字列 チェック．行末にスペース入れない．
// 可読性優先．高速化次点．
// まずは全探索，分割，次にDP(小さい問題から大きな問題)
// 制限を見る．境界に注意．求めたい量の変域．動かせる量．
// 偶奇，逆から，ソート，出現回数，出現位置，DP， 余事象，包除
// データ構造． 問題の特徴量．単調性→二分探索
// 存在判定：構成方法，入力の特徴
// 構築問題。極端解を試す。
// 例外を十分に含む一般化．想像力の限界
// 小さい系から例示
// 代数的処理．前処理によるクエリ高速化．
// 始めは過剰に例示・場合分けしてもいい．各場合を確実に対処．
// 自明な例から処理，除外．
// 小数のときは，精度の設定する．doubel 変数に数値を入力するときは 123. とする．
// コーナーケース。境界値。数表出力プログラム作る
// 実行エラー：vector添え字超え．0割り．



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

typedef vector <int> VI;
typedef vector <VI> VVI;

#define INF ( 1 << 21 )
#define NONE -1
#define NUM 10

VVI L;
VI E;

int get_length( int start, int goal )
{
	VI V( NUM, NONE );
	VI C( NUM, NONE );

	V[start] = 1;
	C[start] = 0;

	while ( 1 )
	{
		/* Cツづーツ更ツ新 */
		for ( int i = 0; i < NUM; i++ )
		{
			if ( E[i] == NONE ) continue;
			if ( V[i] == NONE ) continue;
			for ( int j = 0; j < NUM; j++ )
			{
				if ( E[j] == NONE ) continue;
				if ( V[j] != NONE ) continue;
				if ( L[i][j] == NONE ) continue;
				
				if ( C[j] == NONE )
					C[j] = C[i] + L[i][j];
				else
					C[j] = min( C[j], C[i] + L[i][j] );
			}
		}

		/* Vツづーツ更ツ新 */
		int min_no = NONE;
		int min_value = INF;
		for ( int i = 0; i < NUM; i++ )
		{
			if ( E[i] == NONE ) continue;
			if ( V[i] != NONE ) continue;
			if ( C[i] == NONE ) continue;

			if ( C[i] < min_value )
			{
				min_no = i;
				min_value = C[i];
			}
		}

		if ( min_no == NONE ) break;
		V[min_no] = 1;
	}

	return C[goal];
}

int main( void )
{
	int n;
	while ( cin >> n && n )
	{
		L = VVI( NUM, VI( NUM, NONE ) );
		E = VI( NUM, NONE );

		for ( int i = 0; i < n; i++ )
		{
			int a, b, c;
			cin >> a >> b >> c;
			L[a][b] = L[b][a] = c;
			E[a] = E[b] = 1;
		}

		int min_no = -1;
		int min_value = INF;
		for ( int i = 0; i < NUM; i++ )
		{
			if ( E[i] == NONE ) continue;
			int sum = 0;
			for ( int j = 0; j < NUM; j++ )
			{
				if ( i == j || E[j] == NONE ) continue;
				sum += get_length( i, j );
			}
			if ( sum < min_value )
			{
				min_no = i;
				min_value = sum;
			}
		}

		cout << min_no << " " << min_value << endl;
	}
	return 0;
}

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

using namespace std;

#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define MOD 1000000007
#define NUM 2520
#define INF (1LL<<50)
#define DEBUG 0
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())
#define PI (3.141592653589794)

#define P pair<lli,lli>

signed main(){

	lli n,m;
	cin>>n>>m;

	lli ans=0;

	map<lli,vector<lli>> s;

	REP(i,0,m){
		lli k;
		cin>>k;
		REP(j,0,k){
			lli ss;
			cin>>ss;
			ss--;
			s[i].push_back(ss);
		}
	}

	vector<lli> p(m);
	REP(i,0,m)cin>>p[i];

	for(lli b=0;b<(1LL<<n);b++){
		lli swC=0;
		REP(i,0,m){
			lli cnt=0;
			REP(j,0,s[i].size()){
				if(b&(1LL<<s[i][j]))cnt++;
			}
			if(cnt%2==p[i])swC++;
		}
		if(swC == m)ans++;
	}
	cout<<ans<<endl;

	return 0;
}

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

using namespace std;


#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define all(i) (i).begin(), (i).end()
#define rall(i) (i).begin(), (i).end(), greater<int>()

#define int long long

#define elif else if
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define fst first
#define sec second

template <typename T>
void print(T x)
{
	std::cout << x <<" " ;
}


template <typename T>
void println(T x)
{
	std::cout << x << "\n";
}

signed main(void) {
	string s;
	cin >> s;
	int ans = 0;
	rep(i, s.size() / 2) {
		if (s[i] != s[s.size() - 1-i])ans++;
	}
	print(ans);
}

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

struct edge {int /*from,*/to,cost;};
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> VI;
typedef vector<long long int> VL;
typedef vector<edge> VE;
//static const int INF = 2147483647;
//static const long long INf = 9223372000000000000;
//static const long long INF = 9223372000000000000/2;
static const int INF = 1000010000;
static const int NIL = -1;
static const int MOD = 1000000007;
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define np next_permutation
#define pq priority_queue
#define itn int
#define scnaf scanf
#define reutnr return
#define scamf scanf
//int dx4[4] = {0,1,0,-1}, dy4[4] = {-1,0,1,0};
//int dx5[5] = {-1,0,0,0,1}, dy5[5] = {0,-1,0,1,0};
//int dx8[8] = {-1,0,1,1,1,0,-1,-1}, dy8[8] = {1,1,1,0,-1,-1,-1,0};
//int dx9[9] = {-1,0,1,1,1,0,-1,-1,0}, dy9[9] = {1,1,1,0,-1,-1,-1,0,0};
//#define int ll

int k,n;
VI rullonz;

void subtract(int d){
    if(rullonz[d]>1){
        rullonz[d] --;
    } else if(rullonz[d]==0){
        if(rullonz[d-1]>1){
            for(int i=d;i<=n-1;i++) rullonz[i] += k;
        }
        subtract(d-1);
    } else {
        rullonz[d] --;
    }
    return;
}

void output(){
    for(int i=0;i<n;i++){
        if(rullonz[i]==0) break;
        printf("%d ",rullonz[i]);
    }
    printf("\n");
    return;
}

void solveOdd(){
    for(int i=0;i<n;i++) rullonz.pb((k+1)/2);
    int N;
    n%2==1 ? N=n-1 : N=n;
    for(int i=0;i<N/2;i++) /*output(),*/subtract(n-1);
    output();
    return;
}

void solveEven(){
    printf("%d ",k/2);
    for(int i=1;i<n;i++) printf("%d ",k);
    printf("\n");
    return;
}

signed main(){
    scanf("%d%d",&k,&n);
    if(n==1){
        printf("%d\n",(k+1)/2);
        return 0;
    }
    if(k==1){
        for(int i=0;i<(n+1)/2;i++) printf("%d ",k);
        printf("\n");
        return 0;
    }
    if(k%2==0) solveEven();
    else solveOdd();
    return 0;
}

Measured memory_bytes: 3568
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>
#include <numeric>
#include <iomanip>

#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
/* const int MOD = 998244353; */
const int INF = 1e18;
const double PI = acos(-1);

using namespace std;
struct INIT { INIT(){
  cin.tie(0); ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
}}INIT;


signed main() {
  int A, B, C, K; 
  cin >> A >> B >> C >> K;


  int ans = min(A, K);
  A -= ans;
  K -= ans;

  int n = min(B, K);
  B -= n;
  K -= n;

  n = min(C, K);
  ans -= n;

  cout << ans << "\n";

  return 0;
}

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


int main() {
    int K, X;
    cin >> K >> X;
    if (500 * K >= X) cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 256
package main

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

var (
	read  = bufio.NewReader(os.Stdin)
	write = bufio.NewWriter(os.Stdout)
)

func main() {
	defer write.Flush()

	var n, m int
	fmt.Fscan(read, &n, &m)

	s := make([]int, m)
	c := make([]int, m)
	for i := 0; i < m; i++ {
		fmt.Fscan(read, &s[i], &c[i])
	}

	po := make([]int, n+1)
	po[0] = int(math.Pow10(n))
	for i := 1; i <= n; i++ {
		po[i] = po[i-1] / 10
	}

	ans := -1
	for i := 0; i < 1000; i++ {
		if len(strconv.Itoa(i)) != n {
			continue
		}
		chk := true
		for j := 0; j < m; j++ {
			if (i%(po[s[j]-1]))/po[s[j]] != c[j] {
				chk = false
				break
			}
		}
		if chk {
			ans = i
			break
		}
	}
	fmt.Fprintln(write, ans)
}


Measured memory_bytes: 640
#include <iostream>

int main() {
    int N, M, C;
    std::cin >> N >> M >> C;
    
    int B[M];
    for (int i = 0; i < M; i++) {
        std::cin >> B[i];
    }

    int count = 0;
    for (int i = 0; i < N; i++) {
        int sum = 0;
        for (int i = 0; i < M; i++) {
            int A;
            std::cin >> A;
            sum += A * B[i];
        }
        if (sum + C > 0) {
            count++;
        }
    }
    
    std::cout << count;
}

Measured memory_bytes: 256
#include <iostream>

int main()
{
	int x1, y1, x2, y2, x3, y3, x4, y4, a, b;
	
	std::cin >> x1 >> y1 >> x2 >> y2;
	
	a = x2 - x1;
	b = y2 - y1;
	x3 = x2 - b;
	y3 = y2 + a;
	x4 = x3 - a;
	y4 = y3 - b;
	
	std::cout << x3 << ' ' << y3 << ' '
		<< x4 << ' ' << y4 << std::endl;
	
	return 0;
}


Measured memory_bytes: 3128
#include <iostream>

using namespace std;

int main() {
	int q1, b, c1, c2, q2;
	while(cin >> q1, q1) {
	   cin >> b >> c1 >> c2 >> q2;
	   int aizu = min(b / c1, q2);
	   if (aizu == 0) {
		   cout << "NA" << endl;
		   continue;
	   }
	   int money = b - aizu * c1;
	   int ordinal = money / c2;

	   bool possible = true;
	   while (aizu + ordinal < q1) {
		   aizu--;
		   if (aizu == 0) {
			   cout << "NA" << endl;
			   possible = false;
			   break;
		   }
		   money = b - aizu * c1;
		   ordinal = money / c2;
		   money = b - aizu * c1 - ordinal * c2;
	   }
	   if (possible) cout << aizu << ' ' << ordinal << endl;
	}
	return 0;
}

Measured memory_bytes: 0
#include <stdio.h>
int main(void){
    int a,b;
    scanf("%d %d",&a,&b);
    
    if(a < b){
        puts("a < b");
    }else if(a > b){
        puts("a > b");
    }else{
        puts("a == b");
    }
    return 0;
}


Measured memory_bytes: 2104
import java.util.Scanner;

public class Main {

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

    long ans = 0;

    int cntG = 0;
    int cntS = 0;
    char prev='<';
    for (int i = 0; i < S.length() ; i++) {
      char c = S.charAt(i);

      if(c=='<'){
        if(prev == '<'){  //<<
          cntG++;
        }else{//    ><
          cntS++;
          ans +=calc(cntG,cntS);
          cntG=1;
          cntS=0;
        }
      }else{// >
        if(prev == '>'){
          cntS++;
        }else{//  <>
          //nothing
        }
      }
      prev = c;
    }

    if(prev=='<'){
//      cntG++;
    }else{//>
      cntS++;
    }

    if(cntG!=0 || cntS!=0){
      ans += calc(cntG,cntS);
    }

    System.out.println(ans);

  }
  static long calc(long cntG,long cntS){
      return Math.max(cntG,cntS) + cntG*(cntG-1)/2 +cntS*(cntS-1)/2;
  }

}


Measured memory_bytes: 28548
#include<stdio.h>

#define MAX 100

int n,M[MAX+1][MAX+1];
int d[MAX+1];
int Q[MAX+1];
int head = 1, tail;

void enqueue(int x){
   
  Q[tail] = x;
 
  if((tail +1) == MAX+1)
    tail = 0;
  else
    tail++;
 
}
 
int dequeue(){
 
  int x;
  x = Q[head];
  if((head + 1) == MAX+1)
    head = 0;
  else
    head++;
   
  return x; 
 
}
 
int Q_empty(){
  int i;
  for(i=0;i<MAX+1;i++)
    if(Q[i]!=-777) return 777;
  return 0;
}

void Breadth_First_Search(int s){
  int i,u,v,count=0,flag=1;
     
  enqueue(s);
  for(i=0;i<n;i++) d[i] = (1<<21);
  d[s]=0;
  
 
  while(1){
    if(Q_empty()==0)break;
    
    for(i=count;i<MAX+1;i++){
      u=dequeue();
      if(u!=-777) break;
    }
     if(u==-777) break;
    count=i;
    for(v=0;v<n;v++){
      if(M[u][v]==0) continue;
      if(d[v]!= (1<<21))continue;
      d[v]=d[u]+1;
      enqueue(v);
    }
  }

  for(i=0;i<n;i++){
    printf("%d",i+1);
    if(d[i]==(1<<21)) printf(" %d\n",-1);
    else printf(" %d\n",d[i]);
  }


}

int main(){
  int u,k,v,i,j;

  for(i=0;i<MAX+1;i++){
    Q[i]=-777;
  }
  
  scanf("%d",&n);
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      M[i][j]=0;
    }
  }

  for(i=0;i<n;i++){
    scanf("%d%d",&u,&k);
    u--;
    for(j=0;j<k;j++){
      scanf("%d",&v);
      v--;
      M[u][v]=1;
    }
  }
  Breadth_First_Search(0);
  return 0;
}
  
  
  

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

using namespace std;

int main(){
    string a, b, c;
    cin >> a >> b >> c;
    
    vector<bool> ab(16001), bc(16001), ca(16001);
    for (int i = -2000; i <= 2000; i++){
        for (int j = 0; j < 2000; j++){
            if (0 <= j - i and j - i < b.size() and j < a.size() and a[j] != '?' and b[j - i] != '?' and a[j] != b[j - i])
                ab[i + 8000] = true;
            if (0 <= j - i and j - i < c.size() and j < b.size() and b[j] != '?' and c[j - i] != '?' and b[j] != c[j - i])
                bc[i + 8000] = true;
            if (0 <= j - i and j - i < a.size() and j < c.size() and c[j] != '?' and a[j - i] != '?' and c[j] != a[j - i])
                ca[i + 8000] = true;
        }
    }

    int ans = 1e8;
    for (int i = -4000; i < 4000; i++){
        for (int j = -4000; j < 4000; j++){
            if (!ab[i + 8000] and !bc[j - i + 8000] and !ca[-j + 8000]){
                int r = max({int(a.size()), int(b.size()) + i, int(c.size()) + j});
                int l = min({0, i, j});
                ans = min(ans, r - l);
            }
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <climits>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <cassert>
#include <functional>

using namespace std;

#define LOG(...) printf(__VA_ARGS__)
//#define LOG(...)
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).rbegin(),(c).rend())
#define CLR(a) memset((a), 0 ,sizeof(a))

typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

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

struct P{
	int p, cost;

	bool operator >(const P& p)const {
		return cost > p.cost;
	}
};

struct Edge{
	int to, cost;
};

const int MAX_TOWN = 21;

int G[MAX_TOWN];

int main() {
	int town_n, road_n, start, goal, money, pay;
	cin >> town_n >> road_n;
	vector<vector<Edge>> E(town_n + 1);

	char gm;
	REP(i, road_n){
		int from, to, costA, costB;
		cin >> from >>gm>> to >>gm>> costA >>gm>> costB;
		E[from].push_back({to, costA});
		E[to].push_back({from, costB});
	}
	cin >> start >>gm>> goal >>gm>> money >>gm>> pay;
	money -= pay;


	{
		fill_n((int * )G, MAX_TOWN, 1e9);
		priority_queue<P, vector<P>, greater<P>> que;
		G[start] = 0;
		que.push({start, 0});

		int res = 0;
		while(!que.empty()){
			P p = que.top(); que.pop();
			if(p.p == goal){
				res = p.cost;
				break;
			}

			for(Edge e:E[p.p]){
				int next_town = e.to;
				int next_cost = p.cost + e.cost;
				if (G[next_town] > next_cost){
					G[next_town] = next_cost;
					que.push({next_town, next_cost});
				}
			}
		}
		money -= res;
	}
	{
		fill_n((int * )G, MAX_TOWN, 1e9);
		priority_queue<P, vector<P>, greater<P>> que;
		G[goal] = 0;
		que.push({goal, 0});

		int res = 0;
		while(!que.empty()){
			P p = que.top(); que.pop();
			if(p.p == start){
				res = p.cost;
				break;
			}

			for(Edge e:E[p.p]){
				int next_town = e.to;
				int next_cost = p.cost + e.cost;
				if (G[next_town] > next_cost){
					G[next_town] = next_cost;
					que.push({next_town, next_cost});
				}
			}
		}
		money -= res;
	}

	cout << money << endl;
}

Measured memory_bytes: 1220
#include <iostream>

using namespace std;

int main()
{
	int d;
	int ans;
	while (cin >> d) {
		ans = 0;
		for (size_t a = 0; a < 10; a++)
		{
			for (size_t b = 0; b < 10; b++)
			{
				for (size_t c = 0; c < 10; c++)
				{
					for (size_t e = 0; e < 10; e++)
					{
						if (a + b + c + e == d) { ans++; }
					}
				}
			}
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 2972
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
bool bo[100];
#define ll long long int
int main()
{
	string s;
	cin>>s;
	string s1="dream",s2="dreamer",s3="erase",s4="eraser";

	int l1=(int)s1.size(),l2=(int)s2.size(),l3=(int)s3.size(),l4=(int)s4.size();
	//cout<<l3<<endl;
	//cout<<s[0]<<endl;
	for(int i=0;i<(int)s.size();)
	{
		//cout<<i<<endl;
		if(s[i]=='d' && s[i+l2-1]=='r' && s[i+l2-2]=='e' && s[i+l2]!='a')
		{
			//cout<<"wd"<<endl;
			//cout<<i<<endl;
			for(int k=0;k<l2;i++,k++)
			{
				if(s[i]!=s2[k])
				{
					//cout<<i<<endl;
					cout<<"NO"<<endl;
					return 0;
				}
			}
		}
		else if(s[i]=='d' && s[i+l1-1]=='m')
		{
			//cout<<"wd"<<endl;
			for(int k=0;k<l1;i++,k++)
			{
				if(s[i]!=s1[k])
				{
					//cout<<i<<endl;
					cout<<"NO"<<endl;
					return 0;
				}
			}
		}
		else if(s[i]=='e' && s[i+l4-1]=='r')
		{
			//cout<<"wd"<<endl;
			for(int k=0;k<l4;i++,k++)
			{
				if(s[i]!=s4[k])
				{
					//cout<<i<<endl;
					cout<<"NO"<<endl;
					return 0;
				}
			}
		}
		else if(s[i]=='e' && s[i+l3-1]=='e')
		{
			//cout<<"wd"<<endl;
			for(int k=0;k<l3;i++,k++)
			{
				if(s[i]!=s3[k])
				{
					//cout<<i<<endl;
					cout<<"NO"<<endl;
					return 0;
				}
			}
		}
		else
		{
			cout<<"NO"<<endl;
			return 0;
		}
		
	}
	cout<<"YES"<<endl;
}


Measured memory_bytes: 512