akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <cstdio>
#include <string>
#include <cmath>
#include <queue>
#include <tuple>
#include <set>
#include <assert.h>
#include <sstream>
#include <string>
//#include <bits/stdc++.h>
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i,i0,n) for(int (i)=(i0);(i)<(n);(i)++)
#define FORR(i,i0,n) for(int (i)=(n)-1; (i)>=(i0);(i)--)
#define SORT(x) sort(x.begin(),x.end())
#define rn return
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
typedef std::pair<int,int> P;
using namespace std;
using ll = long long;



int  MOD = 1e9 + 7;
uint64_t inverseModp(uint64_t a, uint64_t p) {
    assert(p < (1ull << 63));
    assert(a < p);
    assert(a != 0);
    uint64_t ex = p-2, result = 1;
    while (ex > 0) {
        if (ex % 2 == 1) {
            result = (result*a) % p;
        }
        a = (a*a) % p;
        ex /= 2;
    }
    return result;
}


uint32_t nCrModp(uint32_t n, uint32_t r, uint32_t p)
{
    assert(r <= n);
    if (r > n-r) r = n-r;
    if (r == 0) return 1;
    if(n/p - (n-r)/p > r/p) return 0;
    
    uint64_t result = 1; //intermediary results may overflow 32 bits
    
    for (uint32_t i = n, x = 1; i > r; --i, ++x) {
        if( i % p != 0) {
            result *= i % p;
            result %= p;
        }
        if( x % p != 0) {
            result *= inverseModp(x % p, p);
            result %= p;
        }
    }
    return 0;
}




int main(){
    int n;
    
    
    cin >> n;
    vector<int> s(n);
    string S;
    cin >> S;
    rep(i,n){
        s[i] = S[i]-48;
    }

    
    vector<bool> done(10,false);
    ll ans = 0;
    rep(i,n){
        if (!done[s[i]]){
            vector<bool> done2(10,false);
            FOR(j,i+1,n){
                if (!done2[s[j]]){
                    int count = 0;
                    vector<bool> done3(10,false);
                    FOR(k,j+1,n){
                        if (!done3[s[k]]){
                            count++;
                            done3[s[k]] = true;
                        }
                    }
                    ans += count;
                    done2[s[j]] = true;
                }
            }
            done[s[i]] = true;
        }
    }
    cout << ans;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef long double ld;
int main()
{
  string s;
  cin >> s;
  replace(ALL(s), ',', ' ');
  cout << s << endl;
  return 0;
}


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

int main()
{
   int l,r,d;
   scanf("%d %d %d",&l,&r,&d);
   
   int a,b,c;
   a = floor((double)r/d) ;
   b = floor((double)(l-1)/d);
   
   
   if(l<d && r<d)
   printf("0\n");
   //else if(l<=d && d<r)
   //printf("%d\n",a);
   else
   printf("%d\n",a-b);
   
   
   
}

Measured memory_bytes: 3744
from sys import exit

ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

n= int(input())
a = li()
sa = sorted(a)
sa.reverse()
ans = 0
for i in range(n):
    if i%2==0:
        ans += sa[i]
    else:
        ans -= sa[i]
print(ans)

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

int main()
{
    int h, w;
    cin >> h >> w;
    vector<string> a(h);
    for (int i = 0; i < h; i++)
    {
        cin >> a.at(i);
    }
    for (int i = 0; i < w + 2; i++)
    {
        cout << '#';
    }
    cout << endl;
    for (int i = 0; i < h; i++)
    {
        cout << '#' << a.at(i) << '#' << endl;
    }
    for (int i = 0; i < w + 2; i++)
    {
        cout << '#';
    }
    cout << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		long b = sc.nextLong();
		long n = sc.nextLong();
		
		long x = Math.min(n, b-1);
		
		System.out.println((int) (Math.floor(a*x/b)-a*Math.floor(x/b)));
	}

}

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

void Main() {
    // input
    string S;
    cin >> S;


    // process


    // output
    for (int i = 0; i < S.length(); i++) {
        cout << "x";
    }
    cout << endl;

}

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


Measured memory_bytes: 3636
N=int(input())

inf=float("inf")
X=[[-inf]*10 for _ in range(N+1)]

X[0][0]=0
for k in range(N):
    s=int(input())

    for a in range(10):
        X[k+1][a]=max(X[k][a],X[k][(a-s)%10]+s)

X[-1][0]=0
print(max(X[-1]))


Measured memory_bytes: 62944
#include <iostream>
#include <cstdio>
#include <vector>
#include <stack>
#include <math.h>
#include <queue>

using namespace std;

typedef long long int ll;
typedef long double ld;

#define rep(i,n) for(int i = 0; i < (n); ++i)
#define vsort(a) sort(a.begin(), a.end())
#define rev(a) reverse(a.begin(), a.end())

const int MOD = 1000000007;
const int INF = INT_MAX;


// a,bの最小公倍数
ll lcm(ll a, ll b){ll lcm = a * b; ll r = a % b;while(r != 0){a = b; b = r; r = a % b;}return lcm /= b;}
// a,bの最大公約数
ll gcd(ll a, ll b){ll r = a % b;while(r != 0){a = b; b = r; r = a % b;}return b;}
// MOD
ll modadd(ll a, ll b){return (a%MOD+b%MOD+MOD)%MOD;}
ll modmul(ll a, ll b){return a%MOD*b%MOD%MOD;}
ll modexp(ll a, ll n){if(n==0)return 1; if(n%2==0){ll e=modexp(a,n/2); return modmul(e,e);} return modexp(a,n-1)*a%MOD;}
ll modinv(ll n){return modexp(n%MOD,MOD-2);}
ll modfact(ll n){ll res=1; for (int i=1; i <= n; ++i){res *= i; res %= MOD;} return res;}
ll modncr(ll n, ll r){ll numer=1;ll denom=1;for(int i=1;i<=r;++i){numer=modmul(numer,n-r+i);denom=modmul(denom,i);}return modmul(numer, modinv(denom));}


int main(){

    int n, T;
    cin >> n >> T;
    int t[n];
    rep(i,n) cin >> t[i];

    ll ans = 0; 
    rep(i,n-1) {
        if (T <= t[i+1] - t[i]) ans += T;
        else ans += t[i+1] - t[i];
    }
    ans += T;


    cout << ans << endl;
    





}



//              g++ -std=c++1z


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define fo(a,b) for(int a=0;a<b;a++)
#define Sort(a) sort(a.begin(),a.end())
#define rev(a) reverse(a.begin(),a.end())
#define fi first
#define se second
#define co(a) cout<<a<<endl
#define sz size()
#define bgn begin()
#define en end()
#define pb(a) push_back(a)
#define pop pop_back
#define V vector
#define P pair
#define V2(a,b,c) V<V<int>> a(b,V<int>(c))
#define V2a(a,b,c,d) V<V<int>> a(b,V<int>(c,d))
#define incin(a) int a; cin>>a
#define yuko(a) setprecision(a)
//#define min min<int>
//#define max max<int>
template<class T>
 void cou(vector<vector<T>> a){
  int b=a.size();
  int c=a[0].size();
  fo(i,b){
    fo(j,c){
      cout<<a[i][j];
      if(j==c-1)
        cout<<endl;
      else
        cout<<' ';
    }
  }
}
/*template<>
 void cou(vector<vector<char>> a){
  int b=a.size();
  int c=a[0].size();
  fo(i,b){
    fo(j,c){
      cout<<a[i][j];
      if(j==c-1)
        cout<<endl;
      else
        cout<<' ';
    }
  }
}*/
 int wari(int a,int b) {
   if(a%b==0)
     return a/b;
   else
     return a/b+1;
 }
 int keta(int a){
  double b=a;
  b=log10(b);
  int c=b;
  return c+1;
 }
 int souwa(int a){
  return a*(a+1)/2;
 }
 int lcm(int a,int b){
  int d=a,e=b,f;
  if(a<b)
    swap(a,b);
  int c,m=1;
  while(m){
    c=a%b;
    if(c==0){
       f=b;
      m--;
    }
    else{
      a=b;
      b=c;
 }
  }
  return d*e/f;
    }
  int gcm(int a,int b){
      int d=a,e=b,f;
  if(a<b)
    swap(a,b);
  int c,m=1;
  while(m){
    c=a%b;
    if(c==0){
       f=b;
      m--;
    }
    else{
      a=b;
      b=c;
 }
  }
  return f;
  }
 bool prime(int a){
   if(a<2)
     return false;
   else if(a==2)
     return true;
   else if(a%2==0)
     return false;
   double b=sqrt(a);
    for(int i=3;i<=b;i+=2){
      if(a%i==0){
        return false;
      }
    }
   return true;
 }
struct Union{
  vector<int> par;
  Union(int n){
	par= vector<int>(n, -1);
  }
  int find(int x){
    if(par[x]<0)
      return x;
    else
      return par[x]=find(par[x]);
  }
  bool same(int a,int b){
    return find(a)==find(b);
  }
  int Size(int a){
    return -par[find(a)];
  }
  void unite(int a,int b){
    a=find(a);
    b=find(b);
    if(a==b)
      return;
    if(Size(b)>Size(a))
      swap<int>(a,b);
    par[a]+=par[b];
    par[b]=a;
  }
};
int ketas(int a){
  string b=to_string(a);
  int c=0;
  fo(i,keta(a)){
    c+=b[i]-'0';
  }
  return c;
}
/*struct aa{
	vector<int> gt;
  aa(int n){
	gt= vector<int>(n, 1);
  }
	void c(V<int> d,int b){
	if(d[b]==0){
		gt[d[b]-1]++;
		gt[gt.sz-1]++;
	}
	else{
		gt[d[b]-1]++;
		c(d,d[d[b]]-1);
	}
}
void cok(int a){
	cout<<gt[a-1]<<endl;
	fo(i,a-1)
	cout<<gt[i]<<endl;
}
};
*/
signed main(){
	int a,b;
	cin>>a>>b;
	cout<<a+1-b<<endl;
}

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

typedef long long int int64;

#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)>(0)?(a):-(a))

int calc(int m,int *a,int n){
  if(m<0) return 0;
  if(m==0) return 1;
  if(n==0) return 0;
  return calc(m,a+1,n-1) || calc(m-a[0],a+1,n-1);
}

void run(void){
  int n;
  scanf("%d",&n);
  int a[20];
  int i;
  for(i=0;i<n;i++) scanf("%d",a+i);
  int q;
  scanf("%d",&q);
  while(q--){
    int m;
    scanf("%d",&m);
    printf("%s\n",calc(m,a,n)?"yes":"no");
  }
  return;
}

int main(void){
  run();
  return 0;
}



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

minus = 0
abs_min = 10 ** 10
sum_A = sum(list(map(abs, A)))

for i in range(N):
    if A[i] < 0:
        minus += 1
    if abs(A[i]) < abs_min:
        abs_min = abs(A[i])

if (minus % 2 == 0):
    print(sum_A)
else:
    print(sum_A - 2 * abs_min)


Measured memory_bytes: 64800
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static void Main()
    {
        Console.WriteLine(Solve());
        //Solve();
        return;
    }

    public static string Solve()
    {
        int K = ReadInt();
        long sum = 0;
        for (int i = 0; i < K; i++)
        {
            for (int j = 0; j < K; j++)
            {
                int a = Gcd(i+1, j+1);
                for (int k = 0; k < K; k++)
                {
                    sum += Gcd(a, k + 1);
                }
            }
        }
        return sum.ToString();
    }

    public static int Gcd(int a, int b)
    {
        if (a < b)
            return Gcd(b, a);
        while (b != 0)
        {
            var remainder = a % b;
            a = b;
            b = remainder;
        }
        return a;
    }

    private static string Read() { return Console.ReadLine(); }
    private static int ReadInt() { return int.Parse(Read()); }
    private static long ReadLong() { return long.Parse(Read()); }
    private static double ReadDouble() { return double.Parse(Read()); }
    private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
    private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
    private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
}


Measured memory_bytes: 17648
#include <stdio.h>

int main() {
    int h, w;
    while (1) {
        scanf("%d %d", &h, &w);
        if (h == 0 && w == 0) {
            break;
        }
        for (int i=0; i<h; ++i) {
            if (i % 2 == 0) {
                for (int j=0; j<w; ++j) {
                    if (j % 2 == 0) {
                        printf("%c", '#');
                    } else {
                        printf("%c", '.');
                    }
                }
            } else {
                for (int j=0; j<w; ++j) {
                    if (j % 2 == 0) {
                        printf("%c", '.');
                    } else {
                        printf("%c", '#');
                    }
                }
            }
            printf("\n");
        }
        printf("\n");
    }

    return 0;
}



Measured memory_bytes: 2068
#include<iostream>
#include<vector>
#include<cstdio>

using namespace std;

int main(){
  int n,t,l,b;
  while(cin >> n >> t >> l >> b, n+t+l+b){
    vector<long double> v1(n+1),v2(n+1),v3(n+1);
    vector<bool> lose(n+1), back(n+1);
    while(l--){
      int tmp; cin >> tmp;
      lose[tmp]=true;
    }
    while(b--){
      int tmp; cin >> tmp;
      back[tmp]=true;
    }
    v1[0]=1.0;
    while(t--){
      for(int i=0;i<n;i++){
        for(int j=1;j<=6;j++){
          int next = j+i;
          vector<long double> *a = &v2;
          if(next > n) next = n-(next-n);
          if(lose[next]) a = &v3;
          if(back[next]) next=0;
          (*a)[next]+=(1.0/6.0)*v1[i];
        }
      }
      v2[n]+=v1[n];
      v1=v2;v2=v3;v3=vector<long double>(n+1);
    }
    printf("%.6llf\n",v1[n]);
  }
  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define all(x) (x).begin(),(x).end()

using namespace std;
using ll = long long;
using P = pair<int, int>;

const int INF = 1001001001;
const vector<int> di = {-1,  0, 1, 0};
const vector<int> dj = { 0, -1, 0, 1};

void chmin(int &a, int b) { if (a > b) a = b; }

ll GCD(ll a, ll b) {
    if (b == 0) return a;
    else return GCD(b, a % b);
}
ll LCM(ll a, ll b) { return a * b / GCD(a, b); }


int main(){
    int N;
    cin >> N;
    vector<pair<int, int>> tasks;
    rep(i, N) {
        int a, b;
        cin >> a >> b;
        tasks.push_back({b, a});
    }

    sort(all(tasks));

    int sum = 0;
    for (auto v: tasks) {
        sum += v.second;

        if (sum > v.first) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 2420
#include<iostream>
#include <algorithm>
#include <string>
#include<math.h>
#define rep(i,n)for(int i=0;i<n;i++)
using namespace std;
int main() {
    char a;
    cin >> a;
    switch (a) {
    case 'A':cout << "T" << endl; break;
    case 'G':cout << "C" << endl; break;
    case 'C':cout << "G" << endl; break;
    case 'T':cout << "A" << endl; break;
    }
    return 0;
}


Measured memory_bytes: 256
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.PriorityQueue;

public class Main {

	public static void main(String[] args) {
		while (true) {
			int N = nextInt();
			if (N == 0) {
				break;
			}
			int M = nextInt();
			ArrayList<Edge> list = new ArrayList<Edge>();

			for (int i = 0; i < M; i++) {
				int a = nextInt() - 1;
				int b = nextInt() - 1;
				int w = nextInt();
				list.add(new Edge(w, a, b));
			}
			Collections.sort(list);

			int ans = Integer.MAX_VALUE;
			for (int i = 0; i < list.size(); i++) {
				PriorityQueue<Edge> priorityQueue = new PriorityQueue<Edge>();
				for (int j = i; j < list.size(); j++) {
					priorityQueue.add(new Edge(list.get(j).weight, list.get(j).from, list.get(j).to));
				}

				// クラスカル法
				UnionFind uf = new UnionFind(N);

				int max = 0;
				while (!priorityQueue.isEmpty()) {
					Edge e = priorityQueue.poll();
					if (!uf.isSame(e.from, e.to)) {
						max = Math.max(max, e.weight);
						uf.unite(e.from, e.to);
					}
				}
				boolean allSame = true;
				for (int j = 1; j < N; j++) {
					if (!uf.isSame(0, j)) {
						allSame = false;
						break;
					}
				}
				if (allSame) {
					ans = Math.min(ans, max - list.get(i).weight);
				}
			}
			if (ans == Integer.MAX_VALUE) {
				System.out.println(-1);
			} else {
				System.out.println(ans);
			}
		}
	}

	static int nextInt() {
		int c;
		try {
			c = System.in.read();
			while (c != '-' && (c < '0' || c > '9'))
				c = System.in.read();
			if (c == '-')
				return -nextInt();
			int res = 0;
			while (c >= '0' && c <= '9') {
				res = res * 10 + c - '0';
				c = System.in.read();
			}
			return res;
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return -1;
	}
}

class UnionFind {
	int[] parts;

	UnionFind(int n) {
		parts = new int[n];
		for (int i = 0; i < n; i++)
			parts[i] = i;
	}

	public int find(int x) {
		if (parts[x] == x)
			return x;
		return parts[x] = find(parts[x]);
	}

	public Boolean isSame(int x, int y) {
		return find(x) == find(y);
	}

	public void unite(int x, int y) {
		if (find(x) == find(y))
			return;
		parts[find(x)] = find(y);
	}
}

class Edge implements Comparable<Edge> {
	int weight;
	int from, to;

	Edge(int w, int f, int t) {
		this.weight = w;
		this.from = f;
		this.to = t;
	}

	@Override
	public int compareTo(Edge edge) {
		// 昇順
		return this.weight - edge.weight;
	}
}

Measured memory_bytes: 162520
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define MOD 1000000007
#define MOD2 998244353
#define pb push_back
#define mp make_pair
#define all(v) v.begin(),v.end()
#define sz(x) (ll)x.size()
#define F first
#define S second
#define FOR(i,a,b) for(ll i=a;i<=b;++i)
#define ROF(i,a,b) for(ll i=a;i>=b;--i)
#define trace(x) cerr<<#x<<": "<<x<<'\n';
typedef long long ll;
using namespace std;
using namespace __gnu_pbds;
#define T ll
#define ordered_set tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>

ll mexp(ll a, ll b, ll m){
    ll ans=1;
    a%=m;
    while(b){
        if(b&1) ans=ans*a%m;
        b>>=1;
        a=a*a%m;
    }
    return ans;
}

const int N = 100005;

int dp[N][13];

int main(){
    IOS

    string s;
    cin>>s;
    int n=sz(s);
    dp[0][0]=1;
    FOR(i,0,n-1){
    	if(s[i]=='?'){
    		FOR(j,0,12){
    			FOR(k,0,9){
    				dp[i+1][(10*j+k)%13]+=dp[i][j];
    				dp[i+1][(10*j+k)%13]%=MOD;
    			}
    		}
    	}
    	else{
    		FOR(j,0,12){
    			int k=s[i]-'0';
    			dp[i+1][(10*j+k)%13]+=dp[i][j];
    			dp[i+1][(10*j+k)%13]%=MOD;
    		}
    	}
    }
    cout<<dp[n][5];
    
    return 0;
}

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

int main(){
    //入力
    int A,B,C;
    cin >> A >> B >> C;

    //処理
    bool ans=false;
    for(int i=1;i<B+1;i++){
        if((A*i)%B==C){
            ans = true;
            cout << "YES" <<endl;
            break;
        }
    }

    if(ans==false){
        cout << "NO" << endl;
    }

}

Measured memory_bytes: 256
//Bartek Kostka
//  You are not prepared!

#include "bits/stdc++.h"

using namespace std;

#define x first
#define y second
#define SZ(x) int(x.size())
#define ll long long
#define pii pair <int, int>
#define vi vector <int>
#define ALL(x) x.begin(), x.end()

#ifdef LOCAL
template<class TH> void _dbg(const char *sdbg, TH h){ cerr<<sdbg<<" = "<<h<<endl; }
template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) {
  while(*sdbg!=',')cerr<<*sdbg++;
  cerr<<" = "<<h<<", "; _dbg(sdbg+1, a...);
}
#define dbg(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define dbg(...)
#define cerr if(false) cout
#endif

int main() {
  vi A(5);
  for(int i=0; i<5; i++) cin >> A[i];
  int k;
  cin >> k;
  if(A[4] - A[0] > k) cout << ":(\n";
  else cout << "Yay!\n";
}


Measured memory_bytes: 256
#include <stdio.h>

int Prime_numbers(int);

int main(){
  int N,n,i,j=0;

  scanf("%d",&N);

  for(i=0;i<N;i++){
    scanf("%d",&n);
    if(Prime_numbers(n)==1)j++;
  }

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

  return 0;
}

int Prime_numbers(int n)
{
  int i,flag=0;
  
  if(n==2)return 1;
  if(n==3)return 1;

    for(i=2;i*i<=n;i++)
    {
        if(n%i==0)return 0;
    }

    return 1;
}


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

#define vi vector<int>
#define pb push_back

int main(){
//    ifstream in("a_in.txt");
//    cin.rdbuf(in.rdbuf());

    int m, m_min, m_max;
    while(cin >> m >> m_min >> m_max, m) {
        int P[200];
        rep(p, m) {
            cin >> P[p];
        }

        int sabun[200];
        sabun[0] = 0;
        REP(i, 1, m) {
            sabun[i] = P[i-1] - P[i];
        }

        int s_max = 0;
        int ans = 0;
        REP(i, m_min, m_max+1) {
            if(s_max <= sabun[i]) {
                s_max = sabun[i];
                ans = i;
            }
        }

        cout << ans << endl;
    }

    return 0;
}


Measured memory_bytes: 3016
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const ll INF = mod * mod;
#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++)

int main()
{
    int A, B;
    cin >> A >> B;
    cout << max(0,A - 2 * B) << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <sstream>
#include <algorithm>
#include <math.h>
//#include <map>
#include <iomanip>
#include <vector>

using namespace std;



string map[8];
int d_row[] = {-3, -2, -1, 0, 0, 0, 0, 0, 0, 1, 2, 3};
int d_col[] = {0, 0, 0, -3, -2, -1, 1, 2, 3, 0, 0, 0};


void bomb(int row, int col)
{
	//cout << "row = " << row << " : col = " << col << endl;
	map[row][col] = '0';
	
	for (int i=0; i<12; i++)
	{
		int n_row = row + d_row[i];
		int n_col = col + d_col[i];
		
		if (0<=n_row && n_row<8 && 0<=n_col && n_col<8 && map[n_row][n_col]=='1')
		{
			bomb(n_row, n_col);
		}
	}
}


int main()
{
	int n;
	int X, Y;
	
	cin >> n;
	for (int i=0; i<n; i++)
	{
		for (int j=0; j<8; j++)
		{
			cin >> map[j];
		}
		cin >> X >> Y;
		
		bomb(Y - 1, X - 1);
		
		cout << "Data " << i + 1 << ":" << endl;
		for (int j=0; j<8; j++)
		{
			cout << map[j] << endl;
		}
	}
	
	return 0;
}

Measured memory_bytes: 1204
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int inf = 0x3f3f3f3f;
const int maxn = 2e5 + 7;
const int mod = 1e9 + 7;
int a[maxn];
ll sum[maxn];

int main() {
	int n,k;
	scanf("%d%d",&n,&k);
	sum[0] = 0;
	for(int i = 1;i <= n;++i) 
		scanf("%d",&a[i]),sum[i] = sum[i-1]+a[i];
	double ans = 0;
	for(int i = 1;i+k-1 <= n;++i){
		double t = (double)(sum[i+k-1]-sum[i-1]+k)/2.0;
		ans = max(ans,t);
	}
	printf("%.12lf\n",ans);
	return 0;
}

Measured memory_bytes: 2560
#include<bits/stdc++.h>
#define bye return 0
#define Yes cout << "Yes" << "\n"
#define No  cout << "No" << "\n"
#define YES cout << "YES" << "\n"
#define NO cout << "NO" << "\n"
using namespace std;
int main(){
	ios::sync_with_stdio(false);
    cin.tie(NULL);
    string s;
   int a, b, c, cnt=0, in=0;

   cin >> a >> b >> c;

    cnt = b/a;
    //cout << cnt << "\n";
  
    cout << min(b/a, c) << "\n";
   	
    
    

   bye;

}


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

using namespace std;

typedef long long ll;

// DPテーブル
const int MAX_N = 15;
const int MAX_W = 110000;
int dp[MAX_N][MAX_W]; // 12 種類だが余裕をもつ

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

    // 品物を列挙 (価値はすべて 1)
    vector<int> weight;
    for (int i = 1; i <= W; i *= 6) weight.push_back(i);
    for (int i = 9; i <= W; i *= 9) weight.push_back(i); // 1 が重複しないように (しても問題はない)
    int n = (int)weight.size();

    // DP初期条件: dp[i][0] = 0
    for (int i = 0; i < MAX_N; ++i) for (int w = 0; w < MAX_W; ++w) dp[i][w] = 1 << 29; // INF
    for (int i = 0; i <= n; ++i) dp[i][0] = 0;

    // DPループ
    for (int i = 0; i < n; ++i) {
        for (int w = 0; w <= W; ++w) {
            dp[i + 1][w] = dp[i][w];
            if (w >= weight[i]) dp[i + 1][w] = min(dp[i][w], dp[i + 1][w - weight[i]] + 1);
        }
    }

    cout << dp[n][W] << endl;
}

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

int main(){
	int a,b,c,n;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a>>b>>c;
		a=a*a;
		b=b*b;
		c=c*c;
		if(a+c==b||b+a==c||b+c==a){
			cout<<"YES"<<endl;
		}else{
			cout<<"NO"<<endl;
		}
	}
	return 0;
}

Measured memory_bytes: 3040
#include <iostream>
using namespace std;
int main(){
    int a,b,c;
    while(cin >> a >> b){
        c = 10;
        for(int i = 1; i < 10; i++){
            if(a + b < c){
                cout << i <<endl;
                break;
            }
            else c *= 10;
        }
    }
    return 0;
}

Measured memory_bytes: 1160
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <cmath>
using namespace std;

int arr[101] = {0};

int main()
{
	int a;
	cin >> a;
	while(a>0)
	{
		if(a%10 == 7)
		{
			cout << "Yes";
			return 0;
		}
		a/=10;
	}
	cout << "No";
}



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

using ll = long long;
using namespace std;
const int INFint = 2e9+1;
const ll INFll = 2e18+1;
ll MOD=1e9+7;

int main(){
  int N;
  cin>>N;
  if(N%2 == 0) cout << 0.5 << endl;
  else{
    cout << setprecision(10) << (double)(N/2+1)/N << endl;
  }
  return 0;
}

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

int gcm(int x,int y){
	int a=min(x,y),b=max(x,y);
	if(a==0) return b;
	else return gcm(a,b%a);
}

int main(){
	int n;
	cin>>n;
	int a,b;
	cin>>a;
	for(int i=1;i<n;i++){
		cin>>b;
		a=gcm(a,b);
	}
	cout<<a;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int VM = 1e5;
long long dp[101][VM + 1];
long long INF = 1e15;
int main()
  {for (int i = 0; i < 101; ++i) for (int j = 0; j <= VM; ++j) dp[i][j] = INF;
  dp[0][0] = 0;
  int N, W; cin >> N >> W;
  for (int i = 0; i < N; ++i)
    {int w, v; cin >> w >> v;
    for (int j = 0; j <= VM; ++j)
      dp[i + 1][j] = min(dp[i][j], j < v ? INF : dp[i][j - v] + w);}
  for (int i = VM; i >= 0; --i)
    if (dp[N][i] <= W) {cout << i << endl; break;}}

Measured memory_bytes: 79104
#include<bits/stdc++.h>
using namespace std;
int main()
{
  string s;
  cin>>s;
  int a;
  a=700;
  for(int i=0;i<s.size();i++){
      if(s[i]=='o'){
          a += 100;
      }
  }
  cout<<a<<endl;
  return 0;
}


Measured memory_bytes: 256
result = 'NO'

nums_array = gets.split(' ')
if nums_array.size == 3 then
  nums_hash = nums_array.group_by(&:itself)
  if nums_hash['7'] != nil && nums_hash['7'].size == 1 then
    if nums_hash['5'] != nil && nums_hash['5'].size == 2 then
      result = 'YES'
    end
  end
end
puts result

Measured memory_bytes: 1788
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <queue>
#include <map>
#include <numeric>
#include <cmath>

using namespace std;

typedef long long int ll;

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

const ll mod = 1e9+7;
const int INF = 1e9;
const ll MAXN = 1e9;

int main()
{
	int N,C;
	cin >> N >> C;

	int d[31][31] = {0}, c[501][501]= {0};
	for(int i = 1; i <= C; i++){
		for(int j = 1; j <= C; j++){
			cin >> d[i][j];
		}
	}
	for(int i = 1; i <= N; i++){
		for(int j = 1; j <= N; j++){
			cin >> c[i][j];
		}
	}

	map<int,int> color[3];
	for(int i = 1; i <= N; i++){
		for(int j = 1; j <= N; j++){
			color[(i+j)%3][c[i][j]]++;
		}
	}

	// for(int i = 0; i < 3; i++){
	// 	cout << "i = " << i  << endl;
	// 	for(auto itr  = color[i].begin(); itr != color[i].end() ; ++itr){
	// 		cout << itr->first << " " <<  itr->second  << endl;
	// 	}
	// }


	int ans = INF;
	for(int i = 1; i <= C; i++){
		for(int j = 1; j <= C; j++){
			for(int k = 1; k <= C; k++){
				if(i != j && j != k && k != i){
					int res = 0;
					for(int l = 0; l < 3; l++){
						int m = i;
						if(l == 1) m = j;
						else if(l == 2) m = k;
						for(auto itr = color[l].begin(); itr != color[l].end(); ++itr){
							res += d[itr->first][m] * itr->second;
						}
					}
					ans = min(res,ans);
				}
			}
		}
	}

	cout << ans << endl;

	return 0;
}


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

template<class T> void mkmin(T& a, const T b) { a = min(a, b); }
template<class T> void mkmax(T& a, const T b) { a = max(a, b); }

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

#define F first
#define S second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define ferrari ios_base::sync_with_stdio(false); cin.tie(NULL)
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const ll mod = 1e9 + 7; // 998244353
const ll OO = 1e18;
const int oo = 2e9;
const int N = 200100;

int main() {
	int x; cin >> x;
	int range[] = {599, 799, 999, 1199, 1399, 1599, 1799, 1999};
	for (int i = 0; i < 8; i++)
		if (x <= range[i]) {
			cout << 8 - i;
			break;
		}
}


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

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

using ll = long long;

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

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

int main() {
  ll N;
  cin>>N;
  vector<int> ans;
  ll t = N;
  while(t!=0LL){
    if(t%2LL==0LL)ans.push_back(0);
    if(t%2LL!=0LL){
      ans.push_back(1);
      t--;
    }
    t/=(-2LL);
  }
  if((int)ans.size()==0) ans.push_back(0);
  reverse(ans.begin(),ans.end());
  for(auto x:ans) cout<<x;
  cout<<endl;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
	"strconv"
	"strings"
)

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

	from, to := x-(k-1), x+(k-1)
	if x-k < -1000000 {
		from = -1000000
	}
	if x+k > 1000000 {
		to = 1000000
	}

	var blackableNums []string
	for i := from; i <= to; i++ {
		blackableNums = append(blackableNums, strconv.Itoa(i))
	}
	fmt.Println(strings.Join(blackableNums, " "))
}


Measured memory_bytes: 1860
#include<iostream>
#include<cmath>
#include<bits/stdc++.h>
#include<string.h>
using namespace std;
typedef long long int ll;
const long long int m=(int)1e6;
int main()
{
    int n;
    cin>>n;
    int a[n];
    int i,j;
    for(i=0;i<n;i++)
    {
        cin>>a[i];
    }
    int freq[m+1]={0};
    for(i=0;i<n;i++)
    {
        freq[a[i]]++;
    }
    int c=0;
    if(freq[1]==1)
        cout<<1;
    else if(freq[1]>1)
        cout<<0;
    else{
    for(i=0;i<n;i++)
    {
        if(freq[a[i]]>1)
            continue;
        int f=0;
        for(j=2;j*j<=a[i];j++)
        {
            if(a[i]%j!=0)
                continue;
            if(freq[j]>0 || freq[a[i]/j]>0)
            {
                f=1;
                break;
            }
        }
        if(f==0)
            c++;
    }
    cout<<c;
    }
    cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
    return 0;
}


Measured memory_bytes: 8272
#include <vector>
#include <iostream>
#include <stack>
#include <string>
#include <algorithm>
#include <unordered_set>

using namespace std;
typedef long long ll;
typedef vector<int> VI;

unordered_set<char> m;

int main(void)
{
	int n;
	cin >> n;
	string s;
	cin >> s;

	char c = -1;
	vector<char> vs;
	for (char t : s) {
		if (t != c) {
			vs.push_back(t);
		}
		c = t;
	}
	cout << vs.size() << endl;
	return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) (x).begin(), (x).end()
int main() {
  int x, a, b ;
  cin >> x >> a >> b;
  int ans = x-a;
  while(ans >= b) {
    ans -= b;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)   // 0-indexed昇順

int main() {
    int N;
    cin >> N;
    map<int, pair<int,int>> M;
    rep(i,N) {
        int t, x, y;
        cin >> t >> x >> y;
        M[t] = make_pair(x,y);
    }
    int x = 0;
    int y = 0;
    int t = 0;
    for (auto z : M) {
      int t1 = z.first;
      int x1 = z.second.first;
      int y1 = z.second.second;
      int d1 = t1 - t;
      int d2 = abs(x - x1) + abs(y - y1);
      if (d2 <= d1 && (d2 % 2 == d1 % 2)) {
        t = t1;
        x = x1;
        y = y1;
        continue;
      } else {
          cout << "No" << endl;
          return 0;
      }
    }
    cout << "Yes" << endl;
}


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

using namespace std;

int main(int argc, char** argv){
    string S;
    cin >> S;
    for (int i=0; i<3; i++){
        if (S[i] == S[i+1]) {
            cout << "Bad\n";
            return 0;
        }
    }
    cout << "Good\n";
    return 0;
}


Measured memory_bytes: 256
import numpy as np
n, a = map(int, input().split())
x = list(map(int, input().split()))

# dp[i][j][k]：　i枚目までのカードをj枚使用して合計kを作れる組み合わせ
dp = np.zeros((n+1, n+1, 3001)).astype(np.int64)
dp[0][0][0] = 1

for i in range(n):
    _x = x[i]
    for j in range(n):
        dp[i+1, j+1, _x:] += dp[i, j, :-_x]
        dp[i+1, j, :] += dp[i, j, :]

ans = 0
for j in range(1, n+1):
    ans += dp[n, j, j*a]
print(ans)

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

int main(){
	string s;
	cin >> s;
	int len = s.size();
	if(s[len-1] != 's'){
		s.push_back('s');
		cout << s << endl;
	}else{
		s.push_back('e');
		s.push_back('s');
		cout << s << endl;
	}
}	

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

int main()
{
    long long n;
    cin>>n;
    string str="";
    while(n>0)
    {
		int m=n%26;
		if(m==0)
		m=26;
		str+=(char)(m+96);
		n=(n-m)/26;
	}
    reverse(str.begin(),str.end());
    cout<<str;
    return 0;
}


Measured memory_bytes: 3584
n = input()
l = map(int, raw_input().split())
ans = 1
for i in l:
    if i == 0:
        ans = 0
if (ans != 0):
    for i in l:
        if (ans * i) <= 1e18:
            ans = ans * i
        else:
            ans = -1
            break
print(ans) 

Measured memory_bytes: 84304
#include <stdio.h>
#include <string.h>

int main(void)
{
    long long int h, w;

    scanf("%lld %lld", &h, &w);
	if (h == 1 || w ==1)
	{
		h = 1;
	}
	else if (h%2 == 1 && w%2 ==1)
	{
		h = ((h * w) / 2) + 1;
	}
	else
	{
		h = (h * w)/2;
	}
	printf("%lld", h);
    return (0);
}


Measured memory_bytes: 128
/// Containers Start
#include <algorithm>
#include <bitset>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
/// C Header Files
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <math.h>
#include <stdio.h>
/// Containers End

using namespace std;

/// Math Start
#define PI acos(-1.0)
#define Pi 3.141592653589793
#define EPS (1e-7)
#define INF (0x3f3f3f3f)
/// Math End

/// Extra Start
#define nn '\n'
#define pb push_back
#define ull unsigned long long
#define ll long long
#define MOD 1000000007
#define sz(a) int((a).size())
#define space " "
#define All(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
/// Extra End

#define rep(i, n) for (int i = 0; i < n; i++)
#define Cini(a)                                                                \
    int a;                                                                     \
    cin >> a;
#define Cinii(a, b)                                                            \
    int a, b;                                                                  \
    cin >> a >> b;
#define Ciniii(a, b, c)                                                        \
    int a, b, c;                                                               \
    cin >> a >> b >> c;
#define Cins(s)                                                                \
    string s;                                                                  \
    cin >> s;
#define Cinss(s1, s2)                                                          \
    string s1, s2;                                                             \
    cin >> s1 >> s2;
#define Cinc(c)                                                                \
    char c;                                                                    \
    cin >> c;
/// Functions End


/// Debug Start
#define deb(x) cout << #x << ": " << x << endl
#define deb2(x, y) cout << #x << ": " << x << '\t' << #y << ": " << y << endl;
#define deb3(x, y, z)                                                          \
    cout << #x << ": " << x << '\t' << #y << ": " << y << '\t' << #z << ": "   \
         << z << endl;
/// Debug End

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

/**>>>>>>>>>>>>>>>>>>> END <<<<<<<<<<<<<<<<<<**/

/// template


signed main(void) {
    cin.sync_with_stdio(false);
    cin.tie(0);
    Cinii(n,x);
    vector<int> l(n+1);
    l[0] = 0;
    rep(i,n) cin >> l[i+1];
    int acc = 0;
    int ans = 0;
    rep(i,n+1){
        acc += l[i];
        if(acc<=x) ans++;
    }
    cout << ans << nn;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <queue>
#include <cstdio>
#include <algorithm>
#include <map>

using namespace std;


int dir[4] = {-1, 1, -4, 4};
int input[8];
map<string, int> table;

int main(){
    string start = "01234567", cur;

    queue<string> myqueue;
    myqueue.push(start);
    table.insert(make_pair(start,0));


    while(!myqueue.empty()){

        cur = myqueue.front();
        myqueue.pop();

        int zero;
        for(int i=0; i<8; ++i){
            if(cur.at(i)=='0'){
                zero = i;
                break;
            }
        }

        for(int i=0; i<4; ++i){
            if(zero + dir[i] < 0 || zero + dir[i] > 7) continue;
            if(zero == 3 && i == 1) continue;
            if(zero == 4 && i == 0) continue;

            string temp = cur;
            swap(temp.at(zero), temp.at(zero+dir[i]));
            if(table.find(temp) == table.end()){
                table.insert(make_pair(temp, table.find(cur)->second+1));
                myqueue.push(temp);
            }
        }
    }

    string in;
    while(scanf("%d %d %d %d %d %d %d %d", &input[0], &input[1], &input[2], &input[3], &input[4], &input[5], &input[6], &input[7]) != EOF){
        in.clear();
        for(int i=0; i<8; ++i) in.push_back(input[i]+'0');
        cout << table.find(in)->second << endl;
    }

    return 0;
}



Measured memory_bytes: 5424
n,k = map(int, input().split())

ans = 0
for i in range(1,n+1):
    num = i
    cnt = 0
    while True:
        if num >= k: break
        num *= 2
        cnt += 1
    prob = 1/pow(2,cnt)
    ans += prob

ans /= n
print(ans)

Measured memory_bytes: 9072
#include <iostream>
#include <cstdio>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <math.h>
#include <map>
#include<functional>
#include <iomanip>
#include <vector>
#include <queue>
#include <set>
#include <typeinfo>
#define PI 3.14159265359
#define INF 99999999;
#define rep(i, n) for(int i=0; i<n; i++)
#define REP(n) rep(i, n)
#define EPS 1e-10
typedef long long ll;
using namespace std;



/*
class Target
{
public:
	vector <string> draw(int n)
	{

	}
};
*/



int main()
{
	int N;
	
	while (cin >> N, N)
	{
		bool two = false;
		int oneSum = 0;
		int k[N];
		
		REP(N)
		{
			cin >> k[i];
		}
		
		REP(N)
		{
			if (k[i] >= 2)
			{
				two = true;
			}
		}
		if (!two)
		{
			cout << "NA" << endl;
			continue;
		}
		
		REP(N)
		{
			if (k[i] >= 1)
			{
				oneSum++;
			}
		}
		
		cout << oneSum + 1 << endl;
	}
	
	return 0;
}

Measured memory_bytes: 1200
#include <iostream>
#include <fstream>
#include <typeinfo>
#include <vector>
#include <cmath>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <iomanip>
#include <cctype>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<25;
const ll INF=1ll<<50;
const double pi=acos(-1);
const double eps=1e-8;
const vi emp;

int n;
vi ans;
vp sco;

int main(){
	cin>>n;
	ans=vi(n);
	sco=vp(n);
	for(int i=0;i<n;i++) sco[i].second=i;
	for(int i=0;i<n*(n-1)/2;i++){
		int a,b,c,d;
		cin>>a>>b>>c>>d;
		if(c>d) sco[a-1].first-=3;
		else if(c<d) sco[b-1].first-=3;
		else{
			sco[a-1].first--;
			sco[b-1].first--;
		}
	}
	sort(sco.begin(),sco.end());
	for(int i=0;i<n;i++){
		if(i&&sco[i].first==sco[i-1].first) ans[sco[i].second]=ans[sco[i-1].second];
		else ans[sco[i].second]=i;
	}
	for(int i=0;i<n;i++) cout<<ans[i]+1<<endl;
}

Measured memory_bytes: 3140
using System;
using System.Collections.Generic;
using System.Linq;
 
class Program
{
    static void Main(string [] args)
    {
        var a = Console.ReadLine();
        var b = Console.ReadLine();

        if (a.Length > b.Length) Console.WriteLine("GREATER");
        else if (a.Length < b.Length) Console.WriteLine("LESS");
        else
        {
            for (var i = 0; i < a.Length; i++)
            {
                if (a[i] == b[i]) continue;
                if (a[i] > b[i]) Console.WriteLine("GREATER");
                if (a[i] < b[i]) Console.WriteLine("LESS");
                return;
            }
            Console.WriteLine("EQUAL");
        }
    }
}

Measured memory_bytes: 11092
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<array>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<functional>
#include<limits>
#include<list>
#include<map>
#include<numeric>
#include<set>
#include<stack>
#include<string>
#include<sstream>
#include<unordered_map>
#include<queue>
#include<vector>
using namespace std;

using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;

#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(a) (a).begin(),(a).end()
#define dump(o) {cerr<<#o<<" "<<o<<endl;}
#define dumpc(o) {cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
const int MOD = 1e9 + 7;

signed main() {
	int dp[5010];
	memset(dp, 0x3f, sizeof(dp));
	dp[0] = 0;
	int a[3] = { 200,300,500 },
		b[3] = { 380,550,850 },
		c[3] = { 5,4,3 };
	double d[3] = { 0.8,0.85,0.88 };
	rep(h, 0, 3) {
		rep(i, 1, 30) {
			int m = a[h] * i;
			int p = b[h] * (i / c[h])*c[h] * d[h] + b[h] * (i%c[h]);
			rep(j, 0, 5010 - m) {
				dp[j + m] = min(dp[j + m], dp[j] + p);
			}
		}
	}
	for (int n; cin >> n&&n;) {
		cout << dp[n] << endl;
	}
	return 0;
}

Measured memory_bytes: 3128
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> P;
int INF = 1e9+7;
int mod = 1e9+7;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
signed main() {
    int H,W;
    cin >> H >> W;
    vector<string>A(H);
    vector<vector<int>>cnt(H,vector<int>(W,INF));
    queue<P> que;
    for(int i = 0; i < H; i++) {
        cin >> A[i];
        for(int j = 0; j < W; j++) {
            if(A[i][j] == '#') {
                que.push({i,j});
                cnt[i][j] = 0;
            }
        }
    }
    int ans = 0;
    while(!que.empty()) {
        P x = que.front();
        que.pop();
        for(int i = 0; i < 4; i++) {
            int nx = x.first+dx[i];
            int ny = x.second+dy[i];
            if(nx >= 0 && nx < H && ny >= 0 && ny < W) {
                if(cnt[nx][ny] == INF) {
                    cnt[nx][ny] = cnt[x.first][x.second]+1;
                    ans = max(ans,cnt[nx][ny]);
                    que.push({nx,ny});
                }
            }
        }
    }
    cout << ans << endl;
}


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

int main(){
  int N;
  cin >> N;
  vector<int> A(N);
  for(int i=0;i<N;i++){
    cin >> A[i];
  }
  
  for(int i=0;i<N;i++){
    if(A[i]==A[i+1]){
      A[i+1]=-1;
    }
  }
  
  int count=0;
  
  for(int i=0;i<N;i++){
    if(A[i]==-1){
      count++;
    }
  }
  
  cout << count << endl;
}


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

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0);
    int n,x;
    while(cin >> n >> x) {
        if(x == 1 || x == 2*n - 1) {
            cout << "No" << '\n';
            continue;
        }
        cout << "Yes" << '\n';
        vector<int> v(2*n-1);
        int cont = 1;
        for(int i = 0; i < 2*n - 1; i++) {
            v[i] = (i == n-1)? x : cont++;
            if(cont == x)
                cont++;
        }
        reverse(v.begin(), v.begin()+n-1);
        reverse(v.begin()+n, v.end());
        for(auto x : v) {
            cout << x << '\n';
        }
    }
    return 0;
}

Measured memory_bytes: 2304
import java.util.*;
public class Main {
  	static int mod = 1000000007;
	public static void main(String args[]){
    	Scanner s = new Scanner(System.in);
      	int M = s.nextInt();
      	int N = s.nextInt();
      	int[][] matrix = new int[M][N];
      	for(int i=0;i<M;i++){
        	String str = s.next();
          	for(int j=0;j<N;j++){
            	matrix[i][j] = str.charAt(j)=='#'?0:1;
            }
        }
      	for(int i=0;i<M;i++){
          	for(int j=0;j<N;j++){
              	if(i==0 && j==0){
                } else if(matrix[i][j]!=0){
                	int a = i>0?matrix[i-1][j]:0;
                  	int b = j>0?matrix[i][j-1]:0;
                  	matrix[i][j]=(a+b)%mod;
                }
              	//System.out.print(matrix[i][j]+" ");
            }
          	//System.out.println();
        }
      	System.out.println(matrix[M-1][N-1]);
    }
}

Measured memory_bytes: 33512
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#pragma warning(disable:4996)
#include <stdio.h>
#include <string>
#include <stdlib.h>
#include <math.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <functional>
#include <stack>
#include <queue>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <list>
#include <set>
#include <map>
#include <iomanip> 
#include <ctime>
#include <numeric>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;

const double PI = 3.14159265358979323846;
const int MAX = 1e7;
const int MOD = 1e9+7;


int main(int argc, char *args[]) {
	int k, x;
	cin >> k >> x;
	if (500 * k >= x)cout << "Yes" << endl;
	else cout << "No" << endl;
}

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

using namespace std;
typedef long long ll;

const int N = 310;
int n, a[4];
double dp[N][N][N];

double solve(int one, int two, int three) {
    if (one < 0 || two < 0 || three < 0) {
		return 0;
	}
	if (one == 0 && two == 0 && three == 0) {
		return 0;
	}
	if (dp[one][two][three] != -1.0) {
		return dp[one][two][three];
	}
	double &ret = dp[one][two][three];
	double rem = one + two + three;
	double val = n + one * solve(one - 1, two, three) + two * solve(one + 1, two - 1, three) + three * solve(one, two + 1, three - 1);
	return ret = val / rem;
}

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

    cin >> n;
    for (int i = 1; i <= n; i++) {
        int x;
        cin >> x;
        a[x]++;
    }
    for (int i = 0; i < N; i++) {
		for (int j = 0; j < N; j++) {
			fill_n(dp[i][j], N, -1.0);
		}
	}
    double ans = solve(a[1], a[2], a[3]);
    cout << fixed << setprecision(12) << ans;

	return 0;
}


Measured memory_bytes: 233088
N, x = map(int, input().split())
a = list(map(int, input().split()))

ans = 0
a.sort()
a_sum = [sum(a[:i+1]) for i in range(len(a))]

for i, item in enumerate(a_sum):
    if x < item:
        ans = i
        break
    elif x == item:
        ans = i+1
        break
    elif x > item and i == len(a_sum)-1:
        ans = i
        break

print(ans)



Measured memory_bytes: 9156