akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = s; i < (int)(n); i++)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

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

//const ll INF = 1e18L + 5;
//const int INF = 1e9 + 5;
//const double pi = 3.14159265358979323846;

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

	ll x;
	cin >> x;
	for (ll i = -2000; i <= 2000; i++) {
		for (ll j = -2000; j <= 2000; j++) {
			if (i*i*i*i*i - j*j*j*j*j == x) {
				cout << i << " " << j << endl;
				return 0;
			}
		}
	}
}

Measured memory_bytes: 3640
#include <stdio.h>
#include<math.h>
int main ()
{
    int a,b,c,x,k,i,j,t;
    while(scanf("%d%d%d%d",&a,&b,&c,&x)==4)
    {
        k=0;
        for(i=0;i<=a;i++)
            for(j=0;j<=b;j++)
                for(t=0;t<=c;t++)
                {
                    if(i*500+j*100+t*50==x)
                         k++;
                }
        printf("%d\n",k);
    }
    return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
#define rep(i,x,y) for (int i=(x);i<=(y);i++)
#define ll long long

using namespace std;

const int N=1e5+10,mod=1e9+7;
int n,cnt[N],ans; char s[N];

int main(){
	scanf("%d%s",&n,s+1);
	rep (i,1,n){
		int tmp=1;
		rep (j,0,25) if (j!=s[i]-'a') tmp=(ll)tmp*(cnt[j]+1)%mod;
		ans=(ans+tmp)%mod; cnt[s[i]-'a']++;
	}
	printf("%d\n",ans);
	return 0;
}

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

typedef long long   signed int LL;
typedef long long unsigned int LU;

#define incID(i, l, r) for(int i = (l)    ; i <  (r); i++)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); i++)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); i--)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); i--)
#define  inc(i, n) incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define  dec(i, n) decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)

#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))

#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define PQ priority_queue

#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
#define  FOR(it, v) for(auto it =  v.begin(); it !=  v.end(); ++it)
#define RFOR(it, v) for(auto it = v.rbegin(); it != v.rend(); ++it)

template<typename T> bool   setmin(T & a, T b) { if(b <  a) { a = b; return true; } else { return false; } }
template<typename T> bool   setmax(T & a, T b) { if(b >  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } }
template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }

// ---- ----

int n, k;

int main() {
	cin >> n >> k;
	
	int a = 1;
	inc(i, n) {
		if(a < k) { a += a; } else { a += k; }
	}
	
	cout << a << endl;
	
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<math.h>
#include<algorithm>
#include<utility>
#include<functional>
#include<queue>
#include<string.h>
#include<string>
#include<set>
#include<map>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll INF=2e18;

ll N,M,K,C;
ll a,b,c,d;
string s;
int main(){
    cin>>a>>b>>c;
    d=0;
    if(a%b==c){
        cout<<"YES"<<endl;
        return 0;
    }
    for(int i=2;(i*a)%b!=a%b;i++){
        if((i*a)%b==c){
            cout<<"YES"<<endl;
        return 0;
        }
    }
    cout<<"NO"<<endl;
    
    return 0;
}

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

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a,b,c,d,e,f,g,h;
    cin >> a >> b >> c >> d;
    cin >> e >> f >> g >> h;
    cout << max((a+b+c+d),(e+f+g+h)) << endl;

    return 0;
}


Measured memory_bytes: 3164
#include<bits/stdc++.h>
using namespace std;
using LL = long long;
constexpr int maxn = -1;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    LL A, V, B, W, T;
    cin >> A >> V >> B >> W >> T;
    cout << (abs(A - B) <= (V - W) * T ? "YES" : "NO");
    return 0;
}


Measured memory_bytes: 3652
import java.util.Scanner;

public class Main {

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

        int start = str.length();
        int end=0;
        for(int i=0;i<str.length();i++){
            if(str.charAt(i)=='A'){
                start= Math.min(start,i);
            }
            else if (str.charAt(i)=='Z'){
                end = Math.max(end,i);
            }
        }

        System.out.println(end-start+1);

        sc.close();
    }

}

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

//INSERT ABOVE HERE
Int co[303][303];
Int dp[303][303];

signed main(){
  Int n,k,mod;
  cin>>n>>k>>mod;
  memset(co,0,sizeof(co));
  co[0][0]=1;
  for(Int i=0;i<=n;i++){
    for(Int j=0;j<=n;j++){
      Int t=1;
      for(Int l=0;l<=j;l++){
	co[i+1][j]+=co[i][j-l]*t%mod;
	co[i+1][j]%=mod;
	t=t*(i+1)%mod;
      }
    }
  }
  
  memset(dp,0,sizeof(dp));
  dp[0][0]=1;
  for(Int i=0;i<k;i++){
    for(Int j=0;j<=n;j++){
      for(Int l=0;j+l<=n;l++){
	dp[i+1][j+l]+=dp[i][j]*co[j+1][l]%mod;
	dp[i+1][j+l]%=mod;
      }
    }
  }
  
  cout<<dp[k][n]<<endl;
  return 0;
}


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

#define deb(x) cout << #x << " " << x << endl;
#define fo(i,n) for(int i=0;i<n;i++)
#define Fo(i,k,n) for(int i=k;i<n;i++)
#define vi vector<int>
#define ii pair<int,int>
#define vii vector<ii>
#define ll long long
#define pb push_back
#define endl "\n"
#define mp map<int,int>
#define F first
#define S second
#define sz(v) (int)v.size()
#define mod 1000000007

void c_p_c()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

}

int main(){
	c_p_c();
	string s,t;
	cin >> s;
	int q; cin >> q;
	while(q--){
		int r; cin >> r;
		if(r==1) swap(t,s);
		else{
			int f; char c;
			cin >> f >> c;
			if(f==1) t.pb(c);
			else s.pb(c);
		}
	}

	reverse(t.begin(),t.end());

	cout << t+s << endl;


	return 0;
}

Measured memory_bytes: 1328
#include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>

using namespace std;

#define FOR(i,k,n) for(int i=(k); i<(int)n; ++i)
#define REP(i,n) FOR(i,0,n)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

template<class T> void debug(T begin, T end){ for(T i = begin; i != end; ++i) cout<<*i<<" "; cout<<endl; }

typedef long long ll;
const int INF = 100000000;
const double EPS = 1e-8;
const int MOD = 1000000007;
int H, W;
int grid[11][11];
int dx[4] = {0, 0, -1, 1};
int dy[4] = {-1, 1, 0, 0};
string state = "UDLR";
int lim[4] = {1,0,3,2};
bool used[11][11];
string dfs(int x, int y, int s, int rem, string res){
  //printf("dfs:%d %d %d %d %s\n", x, y, s, rem, res.c_str());
  if(rem == 0){
    return res;
  }
  REP(r, 4)if(r != lim[s]){
    REP(p, 10){
      int nx = x + p * dx[r];
      int ny = y + p * dy[r];
      if(0 <= nx && 0 <= ny && nx < W && ny < H){
        if(!used[ny][nx] && grid[ny][nx]){
          used[ny][nx] = true;
          //printf("call %d %d %d %d %s\n", nx, ny, r, rem -1, (res+state[r]).c_str());
          string response = dfs(nx, ny, r, rem-1, res+state[r]);
          used[ny][nx] = false;
          if(response != "") return response;
          break;
        }
      }else{
        break;
      }
    }
  }
  return "";
}

int main(){
  while(cin>>H>>W && H){
    int nx, ny, s;
    int cnt = 0;
    REP(y, H){
      string t; cin>>t;
      REP(x, W){
        if(t[x] == 'o'){
          grid[y][x] = 1;
          cnt += 1;
        }else if(t[x] == '.'){
          grid[y][x] = 0;
        }else{
          grid[y][x] = 0;
          nx = x;
          ny = y;
          REP(i, 4)if(state[i] == t[x])s = i;
        }
      }
    }
    memset(used, 0, sizeof(used));
    string ans = dfs(nx, ny, s, cnt, "");
    cout<<ans<<endl;
  }
  return 0;
}

Measured memory_bytes: 0
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using static System.Console;
using static System.Math;
using static MyIO;
using static MyUtil;

public class C
{
	public static void Main() => (new Solver()).Solve();
}


public class Solver
{
	public void Solve()
	{
		int N = GetInt();
		string S = GetString();
		int Q = GetInt();
		int[] k = GetInts(Q);

		long[] ans = new long[Q];
		for(int i = 0; i < Q; i++)
			ans[i] = solve(N, S, k[i]);

		Console.WriteLine(string.Join("\n", ans));	
	}

	private long solve(int N, string S, int k)
	{
		long ans = 0;
		long D = 0;
		long M = 0;
		long DM = 0;
		for(int i = 0; i < N; i++)
		{
			switch(S[i])
			{
				case 'D':
					D++;
					break;

				case 'M':
					DM += D;
					M++;
					break;

				case 'C':
					ans += DM;
					break;
			}

			if(i < k - 1)
				continue;

			switch(S[i - k + 1])
			{
				case 'D':
					DM -= M;
					D--;
					break;

				case 'M':
					M--;
					break;
			}
		}

		return ans;
	}
}

public static class MyIO
{
	private static string[] args = null;
	private static int num = -1;
	private static int used = -1;

	private static string getArg()
	{
		if(used == num)
		{
			args = Console.ReadLine().Split(' ');
			num = args.Length;
			used = 0;
		}
		return args[used++];
	}

	public static int GetInt() => int.Parse(getArg());
	public static long GetLong() => long.Parse(getArg());
	public static double GetDouble() => double.Parse(getArg());
	public static string GetString() => getArg();
	public static char GetChar() => getArg()[0];
	public static int[] GetInts(int N) => Enumerable.Range(0, N).Select(_ => GetInt()).ToArray();
	public static long[] GetLongs(int N) => Enumerable.Range(0, N).Select(_ => GetLong()).ToArray();
	public static double[] GetDoubles(int N) => Enumerable.Range(0, N).Select(_ => GetDouble()).ToArray();
	public static string[] GetStrings(int N) => Enumerable.Range(0, N).Select(_ => GetString()).ToArray();
}

public static class MyUtil
{
	public static void chmax<T>(ref T x, T y) where T : IComparable<T>
	{
		if(x.CompareTo(y) < 0)
			x = y;
	}

	public static void chmin<T>(ref T x, T y) where T : IComparable<T>
	{
		if(x.CompareTo(y) > 0)
			x = y;
	}

	public static void swap<T>(ref T x, ref T y)
	{
		T tmp = x;
		x = y;
		y = tmp;
	}
}

Measured memory_bytes: 17120
//chiragjn
#include <bits/stdc++.h>
#define ll long long
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define gibe_de_fast_io_b0ss ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
using namespace std;
const ll mod = 1e9 + 7;
const ll INF = 0x7FFFFFFFFFFFFFFF/2;
int main(){
    gibe_de_fast_io_b0ss;
    int a, b, c;
    cin>>a>>b>>c;
    if(a == b) cout<<c;
    else if(b == c) cout<<a;
    else if(a == c) cout<<b;
    return 0;
}


Measured memory_bytes: 256
#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 fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧  
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     
　　　　／　　　＼　 　  |　|     
　　　 /　　 /￣￣￣￣/　　|  
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿  
　 　　　＼/＿＿＿＿/　（u　⊃  
---------------------------------------------------------------------------------------------------*/






int ab, bc, ca;
//---------------------------------------------------------------------------------------------------
void _main() {
    cin >> ab >> bc >> ca;
    int ans = ab * bc / 2;
    cout << ans << endl;
}

Measured memory_bytes: 256
n, y = gets.split.map(&:to_i)
key = 0
(0..n).each do |i|
  break if y > n * 10000
  break if y < i * 10000
  (0..(n-i)).each do |j|
    break if y > i * 10000 + (n-i) * 5000
    k = n - i - j
    break if y < i * 10000 + j * 5000 + k * 1000
    if y == ( i * 10000 + j * 5000 + k * 1000 )
      puts i.to_s + " " + j.to_s + " " + k.to_s
      key = 1
      break
    end
  end
  break if key == 1
end

puts "-1 -1 -1" if key == 0


Measured memory_bytes: 1788
a,b,c,d=map(int,input().split())
turn=0# takahashi's turn
while a>0 and c>0:
    if turn==0:
        c-=b
        if c<=0:
            print('Yes')
    else:
        a-=d
        if a<=0:
            print('No')
    turn=1-turn


Measured memory_bytes: 9172
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rep1(i,n) for(int i=1; i<=(n); ++i)
#define repi(i,a,b) for(int i=a; i<=(b); ++i)
#define rrep(i,n) for(int i=(n-1); i>=0; --i)
#define ALL(obj) (obj).begin(), (obj).end()
#define RALL(obj) (obj).rbegin(), (obj).rend()
#define pb push_back
#define mp make_pair
#define to_s to_string
#define sz(v) (int)v.size()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )
#define pr(x) cout<<(x)<<'\n'
#define debug(x) cout << #x << ": " << (x) << '\n'
#define yes "Yes"
#define no "No"
using ll = long long;
using namespace std;
typedef pair<int,int> P;
struct aaa{aaa(){ cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);};}aaaaaaa;
int MOD = 1e9 + 7;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return (a*b)/gcd(a,b);}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

ll a,b;
int main(){
    cin >> a >> b;
    
    if(a*b <= 0) pr("Zero");
    else if(a > 0) pr("Positive");
    else{
        if((abs(a-b)+1)%2 == 0) pr("Positive");
        else pr("Negative");
    }
}

Measured memory_bytes: 256
object Main extends App {
    val Array(n, m) = io.StdIn.readLine.split(" ").map(_.toInt)
    val lrs = for (_ <- 1 to m) yield io.StdIn.readLine.split(" ").map(_.toInt)

    /* TLE case
    // (L_i to R_i)
    val indexedseqs = lrs.map(lr => lr.head to lr.last).map(_.toIndexedSeq)
    // compute intersect
    val numberPassAllGate = indexedseqs.reduce((a,b) => a.intersect(b))

    println(numberPassAllGate.length)
    */

    // L_max and R_min
    val L_max = lrs.map(_.head).max
    val R_min = lrs.map(_.last).min

    val range = R_min - L_max + 1 match {
        case value if 0 <= value => value
        case _ => 0
    }
    println(range)
}

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

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

    int n,k;
    cin>>n>>k;

    vector<int> l(n);

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

    sort(l.begin(),l.end(),greater<int>());

    int ans=0;

    for(int i=0;i<k;i++)ans+=l[i];

    cout<<ans<<"\n";

    return 0;
}


Measured memory_bytes: 3652
I = lambda:map(int,input().split())
N = 0xfffff
n, q = I()
c = list(I())
Q = []
for i in range(q):
    l, r = I()
    Q.append(l << 40 | r << 20 | i)

Q.sort()
A = [[] for i in range(N)]
for i, x in enumerate(c):
    A[x].append(i)

B = [0] * N
def P(i, x):
    i+=1
    while i <= n:
        B[i] += x
        i += i & -i

def G(i):
    s = 0
    while i:
        s += B[i]
        i -= i & -i
    return s

for i in A:
    if i:
        P(i[0], 1)
        i.reverse()

t = 0
o = [0] * q
for x in Q:
    l = x >> 40
    r = x >> 20 & N
    i = x & N
    while t+1 < l:
        b = A[c[t]]
        P(b[-1], -1)
        b.pop()
        if b:
            P(b[-1], 1)
        t += 1
    o[i] = G(r) - G(l-1)

for i in o:
    print(i)

Measured memory_bytes: 248256
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
using P = pair<int, int>;
using vec = vector<int>;
using mat = vector<vector<int>>;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define endl "\n"

constexpr int MOD = 1000000007;
const int INF = 1 << 30;

int main() {
    int h, w, d;
    cin >> h >> w >> d;
    mat a(h, vec(w));
    vector<P> m(h*w);
    rep(i, h) rep(j, w) {
        cin >> a[i][j];
        --a[i][j];
        m[a[i][j]] = make_pair(i, j);
    }
    int q;
    cin >> q;
    vec l(q), r(q);
    rep(i, q) {
        cin >> l[i] >> r[i];
        --l[i];
        --r[i];
    }

    vec cost(h*w, 0);

    for (int i = d; i < h*w; i++) {
        cost[i] = cost[i-d];
        auto prev = m[i-d], now = m[i];
        cost[i] += abs(prev.first - now.first) + abs(prev.second - now.second);
    }

    rep(i, q) {
        int res = cost[r[i]] - cost[l[i]];
        cout << res << endl;
    }
    return 0;
}

Measured memory_bytes: 3328
N=int(input())
count = 0
listA=[]
while (count <= N-1):
    try:
        listA.append(str(input()))
        count+=1
    except:
        break;
if(len(listA) != len(set(listA))):
    print("No")
else:
    for i in range(N-1):
        if(listA[i][-1]!=listA[i+1][0]):
            print("No")
            break
        if(i==N-2):
            print("Yes")

Measured memory_bytes: 3064
s=input()
op_cnt=len(s)-1


for i in range(2**op_cnt):
    t=int(s[0])
    op=['-']*op_cnt
    for j in range(op_cnt):
        ans=''
        if (i>>j &1):
            op[op_cnt-1-j]='+'
        
    for k in range(op_cnt):
            if op[k]=='-':
                t-=int(s[k+1])
            else:
                t+=int(s[k+1])
    if t==7:
            for l in range(op_cnt):
                ans+=s[l]+op[l]
            ans+=s[op_cnt]
            print(ans+'=7')
            break


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

using namespace std;

long long mod=1e9+7;

int main(){
    int a=0,b=0;
    int n;
    cin>>n;
    int total=1;
    for(int i=2;i<=n;i++)
        total=total*i;
    vector<int>aa(n);
    vector<int>bb(n);
    for(int i=0;i<n;i++)
        cin>>aa[i];
    for(int i=0;i<n;i++)
        cin>>bb[i];
    while(next_permutation(aa.begin(),aa.end()))
        a++;
    while(next_permutation(bb.begin(),bb.end()))
        b++;
            a=total-a;
    b=total-b;
    a=abs(a-b);
    cout<<a;
    return 0;
}





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

int main() {
    int n, num_query; cin >> n >> num_query;
    queue<int> Q[n];
    
    for (int i = 0; i < num_query; ++i) {
        int command, t, x; cin >> command >> t;
        
        switch (command) {
            case 0:
                cin >> x;
                Q[t].push(x);
                break;
                
            case 1:
                if (!Q[t].empty()) printf("%d\n", Q[t].front());
                break;
            case 2:
                if (!Q[t].empty()) Q[t].pop();
                break;
        }
    }
    return 0;
}


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

ll gcd(ll a, ll b) {
  return b != 0 ? gcd(b, a % b) : a;
}

int main(){
  int n,i;cin>>n;
  ll t,s,ans=1;
  for(i=0;i<n;++i){
    scanf("%lld",&t);
    s=gcd(t,ans);
    ans=ans/s*t;
  }
  cout<<ans<<endl;    
  return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{   
    int a[3],flag5 = 0,flag7 = 0;

    cin>>a[0]>>a[1]>>a[2];
    for(int i = 0;i<3;i++)
    {
        if(a[i] == 5)
        {   flag5++;
            continue;
        }
        if(a[i]==7)
        {   flag7++;
            continue;
        }

        else{
            cout << "NO" << endl;
            return 0;
        }
    }
    if(flag5 == 2&&flag7 == 1){
        cout << "YES" << endl;
        return 0;
    }

    cout << "NO\n" << endl;
    return 0;
    

   /*
   int a,cnt = 0;
   cin >> a;

   for(int i = 0;i<a;i++)
   {
       cnt += i+1;
   }
    cout << cnt << endl;
    return 0;
    */

   /*
   int k,x,y,n,sum = 0;

   cin >> n >> k >> x >> y;
   for(int i = 0;i<k;i++)
   {
       sum += x;
   }

    for(int i = 0;n-k>i;i++)
    {
        sum+=y;
    }

    cout << sum << endl;

    return 0;
    */



}


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

int main() {
  int k,n;
  cin>>k>>n;
  
  int a[n];
  int x[n];
  for(int i=0; i<n; i++) cin >> a[i];
  int M = 0;
  
  for(int i=0; i<n-1; i++){
    int p = a[i+1]-a[i];
    M = max (M, p);
  }
  
  int q = k - a[n-1] + a[0];
  M = max (M, q);
  
  int ans = k - M;
  
  cout << ans << endl;
}

Measured memory_bytes: 1024
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
using namespace std;
string s;
int N,M;
unsigned long H[3<<17],base=1e9+7;
unsigned long P[3<<17];
main()
{
	cin>>N>>M>>s;
	P[0]=1;
	for(int i=1;i<3<<17;i++)P[i]=P[i-1]*base;
	H[0]=0;
	for(int i=0;i<s.size();i++)H[i+1]=H[i]*base+s[i];
	int L=0,R=1;
	set<unsigned long>S;
	for(;M--;)
	{
		string t;cin>>t;
		if(t=="R++")R++;
		else if(t=="L++")L++;
		else if(t=="R--")R--;
		else L--;
		unsigned long now=H[R]-H[L]*P[R-L];
		S.insert(now);
	}
	cout<<S.size()<<endl;
}


Measured memory_bytes: 22648
def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod
mod = 10**9+7 #出力の制限
N = 10**6
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル
for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )

N, K = map(int, input().split())
a = [int(c) for c in input().split()]
a.sort()
M = 0
m = 0
for i in range(N-1, 0, -1):
  M += cmb(i,K-1, mod)*a[i]
  M %= mod
for i in range(N-1):
  m += cmb(N-1-i, K-1, mod)*a[i]
  m %= mod
print((M-m)%mod)

Measured memory_bytes: 127816
#include <iostream>
#include <algorithm>
#include <fstream>
#include <vector>
#include <deque>
#include <assert.h>
#include <stack>
#include <set>
#include <map>
#include <stdio.h>
#include <string.h>
#include <utility>
#include <math.h>
#include <bitset>
#include <iomanip>
#include <complex>
#include <queue>
using namespace std;
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define IDX(vec, element_iter) distance((vec).begin(), element_iter)
#define print(x) cout<<(x)<<'\n'
#define print_vec(v) rep(i,v.size()){if(i!=0)cout<<" ";cout<<v[i];}cout<<'\n'
#define pe(x) cout<<(x)<<" "
#define DEBUG(x) cout<<#x<<": "<<x<<'\n'
#define DEBUG_VEC(v) cout<<#v<<":";rep(i,v.size())cout<<" "<<v[i];cout<<'\n'
#define pb push_back
#define mp make_pair
#define MOD 1000000007 //10^9+7
#define fi first
#define sc second
using ll=long long;
using pll=pair<ll,ll>;
using vll=vector<ll>;
using vvll=vector<vll>;
using vstr=vector<string>;

string S,T;
ll N,M,H,W,K,L;
void solve() {
    cin >> N;
    ll ans;
    if(N>=1800) ans = 1;
    else if(N>=1600) ans = 2;
    else if(N>=1400) ans = 3;
    else if(N>=1200) ans = 4;
    else if(N>=1000) ans = 5;
    else if(N>=800) ans = 6;
    else if(N>=600) ans = 7;
    else ans = 8;
    print(ans);
}
 
int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
	cout<<fixed<<setprecision(20);
    //int q; cin >> q;
	//while (q--)
		solve();
    return 0;
}

Measured memory_bytes: 3648
import java.util.*;

public class Main {

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

        int a = sc.nextInt();
        int b = sc.nextInt();



        int ans = 1500;

        int tmp = ans;

        while (tmp>0){
            double tmpA = tmp*0.08;
            int A = (int)tmpA;
//            System.out.print(A);
            double tmpB = tmp*0.1;
            int B = (int)tmpB;
//            System.out.print(B);
            if (A==a && B==b){
                ans = tmp;
            }
            tmp--;
        }


//        System.out.print(ans);

        if (ans==1500){
            System.out.print(-1);
        }else {
            System.out.print(ans);
        }

    }
}



Measured memory_bytes: 23892
include Math

N = gets.to_i
town = (0..N-1).to_a
x, y = N.times.map{gets.split.map(&:to_i)}.transpose
sum = 0

town.combination(2) do |i, j|
  sum += sqrt((x[i]-x[j])**2 + (y[i]-y[j])**2)
end

ans = 2*sum / N

puts sprintf("%.10f", ans)

Measured memory_bytes: 1788
def main():
    import numpy as np
    from builtins import int, map, list, print, len
    from itertools import combinations
    import sys
    sys.setrecursionlimit(10 ** 6)

    input = (lambda: (sys.stdin.readline()).rstrip())
    input_list = (lambda: input().split())
    input_number = (lambda: int(input()))
    input_number_list = (lambda: list(map(int, input_list())))

    H, W, K = input_number_list()
    field = []
    ans = 0
    yoko = [0] * H
    tate = [0] * W
    total = 0
    for i in range(H):
        line = input()
        field.append(list(line))
        black_count = line.count("#")
        yoko[i] = black_count
        total += black_count
        for j in range(W):
            if line[j] == "#":
                tate[j] += 1
    # 選択無し
    if total == K:
        ans += 1
    combi_h = []
    for i in range(1, H + 1):
        combi_h.extend(combinations(range(H), i))

    combi_w = []
    for i in range(1, W + 1):
        combi_w.extend(combinations(range(W), i))
    field = np.array(field)
    for c_h in combi_h:
        f_tmp = field.copy()
        for h in c_h:
            f_tmp[h] = "." * len(f_tmp[h])
        if np.count_nonzero(f_tmp == '#') == K:
            ans += 1
        for c_w in combi_w:
            f_tmp2 = f_tmp.copy()
            for w in c_w:
                f_tmp2[:, w] = '.'
            if np.count_nonzero(f_tmp2 == '#') == K:
                ans += 1
    for c_w in combi_w:
        f_tmp = field.copy()
        for w in c_w:
            f_tmp[:, w] = "." * len(f_tmp[:, w])
        if np.count_nonzero(f_tmp == '#') == K:
            ans += 1
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 27104
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(n) begin(n), end(n)
using ll = long long;
using namespace std;

int main(){
  ll x;
  cin >> x;
  ll en = 100;
  int ans = 1;
  while(1){
    en = (double)en * 1.01;
    if(en >= x){
      cout << ans << endl;
      return 0;
    }
    ans++;
  }
  return 0;
}

Measured memory_bytes: 3632
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <iomanip>
#include <set>
#include <cmath>
#include <math.h>

using namespace std;
        
int main(){
     vector<vector<char>> v(2, vector<char>(3, '\0'));
    for(int i=0;i<2;i++){
        for(int j=0;j<3;j++){
            cin>>v[i][j];
        }
    }
    
       vector<vector<char>> v2(2, vector<char>(3, '\0'));
    v2[0][0]=v[1][2];
    v2[0][1]=v[1][1];
    v2[0][2]=v[1][0];
    v2[1][0]=v[0][2];
    v2[1][1]=v[0][1];
    v2[1][2]=v[0][0];
    for(int i=0;i<2;i++){
        for(int j=0;j<3;j++){
            if(v[i][j]!=v2[i][j]){
                cout<<"NO"<<endl;
                return 0;
            }
        }
    }
    cout<<"YES"<<endl;

        
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>

using namespace std;

int d;
int sum;
int height;


int main(){
	while(cin >> d){
		sum = 0;
		for(int now = 600 - d;now >= d;now -= d){
			height = now * now;
			sum += height * d;
		}

		cout << sum << endl;
	}

}

Measured memory_bytes: 2988
#!/usr/bin/env python3
import sys

#solve
def solve():

    input = sys.stdin.buffer.readline
    LI = lambda: map(int, input().split())
    II = lambda: int(input())
    n = II()
    vw = [[]] * n
    M = 10 ** 5 + 1
    M0 = [0] * M
    XX = 1 << 10
    d = [[]] * XX
    d[0] = M0

    for i in range(1, min(XX, n + 1)):
        v, w = LI()
        vw[i - 1] = (v, w)
        di = d[i // 2][:]
        for j in range(M - 1, w - 1, -1):
            if di[j] < di[j - w] + v:
                di[j] = di[j - w] + v
        d[i] = di

    for i in range(XX, n + 1):
        v, w = LI()
        vw[i - 1] = (v, w)

    Vv = [i.bit_length() for i in range(1 << 18)]
    n = [pow(2, i) for i in range(18)]
    lentl = [i - 10 for i in range(19)]
    maskset = [[]] * n[10]

    for i in range(1, 11):
        for mask in range(n[i - 1], n[i]):
            a = mask & -mask
            b = Vv[a] - 1
            maska = mask - a
            maskset[mask - 1] = (mask, b, maska)

    for _ in range(II()):
        V, L = LI()

        if V < XX:
            print(d[V][L])
            continue

        n2 = lentl[Vv[V]]
        vw2 = [None] * n2

        for i in range(n2):
            vw2[i] = (vw[V - 1][0], vw[V - 1][1])
            V //= 2

        lw = [0] * n[n2]
        lv = [0] * n[n2]
        dv = d[V]
        ans = dv[L]

        for i in range(n[n2] - 1):
            mask, b, maska = maskset[i]
            v, w = vw2[b]
            ww = lw[maska] + w
            Lww = L - ww
            lw[mask] = ww
            if Lww < 0: continue
            vv = lv[maska] + v
            lv[mask] = vv
            tmp = dv[Lww] + vv
            if tmp > ans:
                ans = tmp
        print(ans)
    return

if __name__ == "__main__":
    solve()


Measured memory_bytes: 899064
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<string>
#include<map>
#include<set>
#include<unordered_map>
#include<unordered_set>
#include<list>
#include<queue>
#include<stack>
#include<deque>
#include<stdlib.h>
using namespace std;

vector<int>par[20];
bool s[20];
void saiki(int a) {
	s[a] = true;
	for (int b : par[a]) {
		if (!s[b])saiki(b);
	}
	cout << a+1 << endl;
}
int main() {
	int a, b; cin >> a >> b;
	for (int c = 0; c < b; c++) {
		int d, e; scanf("%d%d", &d, &e);
		d--; e--;
		par[e].push_back(d);
	}
	for (int d = 0; d < a; d++) {
		if (!s[d]) {
			s[d] = true;
			saiki(d);
		}
	}
}

Measured memory_bytes: 3172
#include<bits/stdc++.h>
using namespace std;
     
#define int long long
#define hell 998244353 
#define endl "\n"
     
float min(float a, float b)
{
     
    if(a>b)
        return b;
    return a;
}
     
int max(int a, int b)
{
     
    if(a>b)
        return a;
    return b;
    }
 
 
int32_t main()
{
    int n, m; 
    cin >> n >> m;

    vector<pair<int, int>> v(n);

    for (int i = 0; i < n; i++) 
        cin >> v[i].second >> v[i].first;

    sort(v.begin(), v.end(), greater<pair<int, int>>());
 
    int ans = 0;
    set<int, greater<int>> st;

    for (int i = 0; i < m; i++) 
        st.insert(i);
    for (int i = 0; i < n; i++) 
    {
        auto it = st.lower_bound(m - v[i].second);
        
        if (it != st.end()) 
        {
            ans += v[i].first;
            st.erase(it);
        }
    }
    cout << ans << endl;
    return 0;
}

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

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)

using ll = long long;
ll INF = LLONG_MAX;
 
using vc = vector<char>;
using vi = vector<int>;
using vb = vector<bool>;

int main() {
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int N, M; cin >> N >> M;
    vector<vi> graph (N);
    F0R(i, M) {
        int a, b; cin >> a >> b; --a; --b;
        graph[a].push_back(b);
        graph[b].push_back(a);
    }
    vb inPath (N);
    deque<int> path; 
    path.push_front(0);
    path.push_back(graph[0][0]);
    inPath[0] = true;
    inPath[graph[0][0]] = true;

    while (true) {
        bool leftValid = true;
        for (int n : graph[path.front()]) if (!inPath[n]) {
            leftValid = false; 
            path.push_front(n);
            inPath[n] = true;
            break;
        }

        bool rightValid = true;
        for (int n : graph[path.back()]) if (!inPath[n]) {
            rightValid = false;
            path.push_back(n);
            inPath[n] = true;
            break; 
        }

        if (leftValid && rightValid) break;
    }

    cout << path.size() << endl;
    for (int item : path) {
        cout << item + 1<< " ";
    }
    cout << endl;

}

Measured memory_bytes: 6784
#include <bits/stdc++.h>
#define FOR(i, k, n) for(int i = (k); i < (n); i++)
#define FORe(i, k, n) for(int i = (k); i <= (n); i++)
#define FORr(i, k, n) for(int i = (k)-1; i > (n); i--)
#define FORre(i, k, n) for(int i = (k)-1; i >= (n); i--)
#define REP(i, n) FOR(i, 0, n)
#define REPr(i, n) FORre(i, n, 0)
#define ALL(x) (x).begin(), (x).end()
#define ALLr(x) (x).rbegin(), (x).rend()
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
using namespace std;
using ll = long long;

const int INF = 1001001001;

const int mod = 1000000007;

class mint{
  public:
  ll x;
  mint(ll x = 0):x((x % mod + mod) % mod){};
  mint pow(ll y) const {
    mint res(1);
    mint a(x);
    while(y>0){
      if(y&1) res *= a;
      a *= a;
      y >>= 1;
    }
    return res;
  }
  mint inv() const{ return pow(mod-2); }
  mint& operator+= (const mint a) noexcept {
    if((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-= (const mint a) noexcept {
    if((x += mod - a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*= (const mint a) noexcept {
    (x *= a.x) %= mod;
    return *this;
  }
  mint& operator/= (const mint a) noexcept {
    return (*this) *= a.inv();
  }
  mint operator+ (const mint a) const noexcept {
    mint res(*this);
    return res += a;
  }
  mint operator- (const mint a) const noexcept {
    mint res(*this);
    return res -= a;
  }
  mint operator* (const mint a) const noexcept {
    mint res(*this);
    return res *= a;
  }
  mint operator/ (const mint a) const noexcept{
    mint res(*this);
    return res /= a;
  }
};

mint modncm(ll n, ll m){
  mint a = 1, b = 1;
  REP(i, m) a *= mint(n-i), b *= (m-i);
  return a * b.inv();
}

mint dp[100005][2];
//0:i桁目が同じ 1:i桁目が未満
int main(void){
  string s;
  cin >> s;
  int n = s.size();
  dp[0][0] = 1;
  REP(i, n){
    //a+b = 0 -> a=0 b=0
    if(s[i] == '0'){
      dp[i+1][0] += dp[i][0];
      dp[i+1][1] += dp[i][1];
    }else{
      dp[i+1][1] +=  dp[i][0] + dp[i][1];
    }

    //a+b=1 a=0 b=1 or a=1 b=0
    if(s[i] == '0'){
      dp[i+1][1] += dp[i][1] * 2;
    }else{
      dp[i+1][0] += dp[i][0] * 2;
      dp[i+1][1] += dp[i][1] * 2; 
    }
  }
  mint ans = dp[n][0] + dp[n][1];
  cout << ans.x << endl;
  return 0;
}

Measured memory_bytes: 2048
#include<stdio.h>
#include<string.h>
main(){
  char tmp[16][16];
  int i,j,a,b;
  while(scanf("%s",tmp[0])!=EOF){
  for(i=1;i<8;i++){
    scanf("%s",tmp[i]);
    for(j=8;j<=15;j++)
    tmp[i][j]='0';
  }
  for(i=8;i<=15;i++){
    for(j=0;j<=15;j++){
      tmp[i][i]='0';
    }
  }

  for(i=0;i<8;i++){
    for(j=0;j<8;j++){
      if(tmp[i][j]=='1'){
	if(tmp[i][j+1]=='1'&&tmp[i+1][j]=='1'&&tmp[i+1][j+1]=='1'){
	  printf("A");
	}else if(tmp[i+3][j]=='1'){
	  printf("B");
	}else if(tmp[i][j+3]=='1'){
	  printf("C");
	}else if(tmp[i+2][j-1]=='1'){
	  printf("D");
	}else if(tmp[i+1][j+2]=='1'){
	  printf("E");
	}else if(tmp[i+2][j+1]=='1'){
	  printf("F");
	}else printf("G");
	goto exit;
      }
    }
  }
  exit:
  puts("");
  }
  return 0;
}

Measured memory_bytes: 524
#include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>
#define rep(i,n) for(int i = 0; i < (n); i++)
using namespace std;

const int M = 1000005;
int main()
{
    int n, ans = 0;
    cin >> n;
    vector<int>a(n);
    vector<int>cnt(M);
    rep(i,n) cin >> a[i];
    sort(a.begin(),a.end());
    //Σi = 1~M M/1 -> O(MlogM) ∵1/xの積分で分かる
    for(int x : a){
        if(cnt[x] != 0){
            cnt[x] = 2;
        }else{
            for(int j = x; j < M; j += x){
                cnt[j]++;
            }
        }
    }
    for(int x : a){
        if(cnt[x] == 1) ans++;
    }
    cout << ans << endl;
    return 0;
}

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

int a[] = {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};

main() {
	int k;
	cin >> k;
	cout << a[k - 1] << '\n';
}


Measured memory_bytes: 764
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <map>

#define reps(i,s,n) for(int (i) = (s); (i) < (n); (i)++)
#define rep(i,n) reps(i,0,n)
using namespace std;
using ll = long long;

int main(){
    vector<int> vec;
    ll num;
    cin >> num;
    while(num > 100){
        vec.push_back(num % 1000);
        num /= 10;
    }
    int ans = 1000;
    for(auto e : vec) {
        ans = min(ans,abs(753-e));
        // cout << ans << endl;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
# スペース区切りの整数の入力
n, y = map(int, input().split())

i = 0
j = 0
k = 0

l = [-1,-1,-1]
#print(l)

for i in reversed(range(0,n+1)):
    #print('i= %d' % i)
    if  y >= i*10000:
        for j in reversed(range(0,n-i+1)):
            #print('j= %d' % j)
            k = n - i - j
            #print('k= %d' % k)
            if  y == i*10000 + j*5000 + k*1000:
                l = [i, j, k]

#----ここは一つ見つかったら抜けるための命令
                break
        else:
            continue
        break
#------------------------------------

                #print(l)

print(l[0], l[1], l[2])


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

typedef long long ll;

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

const int MAX_N=18;
int N;
string S;

ll memo[MAX_N][MAX_N];

int one;

string rs,bs;

ll dfs(int n,int m){
	if (n==N){
		return 1;
	}
	if (memo[n][m]!=-1){
		return memo[n][m];
	}
	ll ret=0;
	if (m>0){
		if (S[2*N-n-1]==bs[N-one-m]){
			ret=dfs(n+1,m-1);
		}
	}
	if (N-n-m>0){
		if (S[2*N-n-1]==rs[n-N+one+m]){
			ret+=dfs(n+1,m);
		}
	}
	return memo[n][m]=ret;
}

int main(){
	cin>>N;
	cin>>S;
	ll ans=0;
	REP(b,1<<N){
		rs.clear();
		bs.clear();
		memset(memo,-1,sizeof(memo));
		one=0;
		REP(i,N){
			if ((b>>i)&1){
				rs.push_back(S[i]);
				one++;
			}else{
				bs.push_back(S[i]);
			}
		}
		ans+=dfs(0,N-one);
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}
fn main() {
    input! {
        a: chars,
        b: chars,
    }
    if a.len() > b.len() {
        println!("GREATER");
    } else if a.len() < b.len() {
        println!("LESS");
    } else {
        for (i, _) in a.iter().rev().enumerate() {
            if a[i] > b[i] {
                println!("GREATER");
                return;
            } else if a[i] < b[i] {
                println!("LESS");
                return;
            } else {
            }
        }
        println!("EQUAL");
    }
}

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

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll n, m, p, a = 0, b = 0;
    string s;
    cin >> n >> m;
    map<ll, ll> mp, wa;
    for (ll i = 0; i < m; ++i) {
        cin >> p >> s;
        if (s == "AC") {
            if (mp.find(p) == mp.end()) {
                ++a;
                b += wa[p];
                mp[p] = 1;
            }
        }
        else if (s == "WA") {
            if (mp.find(p) == mp.end()) {
                ++wa[p];
            }
        }
    }
    cout << a << " " << b;
    return 0;
}

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

using namespace std;

long long inf=1000000000;

int main(){
	long long n,k,s;
	cin>>n>>k>>s;

	for(int i=1;i<=n;i++){
		if(i<=k){
			cout<<s;
		}else{
			if(s==inf){
				cout<<1;
			}else{
				cout<<inf;
			}
		}

		if(i<n) cout<<" ";
		else cout<<endl;
	}

	return 0;
}


Measured memory_bytes: 1280
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<set>
#include<math.h>
#include <bits/stdc++.h>
using namespace std;
int n;


int main(){
    int x,n;
    cin>>x>>n;
    //cout<<x<<n<<endl;
    int p[n];
    for(int i=0;i<n;i++) cin>>p[i];

    //for(int i=0;i<n;i++) cout<<p[i]<<endl;

    int d=10000;
    int ans;
    vector<int> q;
    for(int i=0;i<103;i++){
        q.push_back(i-1);
    }

    //for(int i=0;i<q.size();i++) cout<<q[i]<<endl;

    for(int i=0;i<n;i++){
        q.erase(remove(q.begin(),q.end(),p[i]),q.end());
    }
    for(int i=0;i<q.size();i++){
        if(abs(x-q[i])<d){
            d=abs(x-q[i]);
            ans=q[i];
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3604
import java.util.*;

class Main{
	static Scanner s=new Scanner(System.in);
	public static void main(String[] $){
		int n;
		PrimeIterator p=new PrimeIterator(1300000);
		while(true) {
			n=s.nextInt();
			if(n==0)return;
			System.out.println(
					p.bitset.nextSetBit(n)
					-p.bitset.previousSetBit(n));
		}
	}
}

class PrimeIterator implements Iterable<Integer>,PrimitiveIterator.OfInt{
	BitSet		bitset;
	private int	currentvalue,limit;

	public PrimeIterator(int limit){
		currentvalue=0;
		bitset=new BitSet(limit+1);
		this.limit=limit;
		construct();
	}
	/** Atkin's sieve */
	private final void construct(){
		int sqLim=(int)Math.sqrt(limit+0.5);
		{
			int n;
			for(int z=1;z<=5;z+=4){
				for(int y=z;y<=sqLim;y+=6){
					int ysq=y*y;
					for(int x=1;x<=sqLim&&(n=4*x*x+ysq)<=limit;++x)
						bitset.flip(n);
					for(int x=y+1;x<=sqLim&&(n=3*x*x-ysq)<=limit;x+=2)
						bitset.flip(n);
				}
			}
			for(int z=2;z<=4;z+=2){
				for(int y=z;y<=sqLim;y+=6){
					int ysq=y*y;
					for(int x=1;x<=sqLim&&(n=3*x*x+ysq)<=limit;x+=2)
						bitset.flip(n);
					for(int x=y+1;x<=sqLim&&(n=3*x*x-ysq)<=limit;x+=2)
						bitset.flip(n);
				}
			}
			for(int y=3;y<=sqLim;y+=6){
				int ysq=y*y;
				for(int z=1;z<=2;++z)
					for(int x=z;x<=sqLim&&(n=4*x*x+ysq)<=limit;x+=3)
						bitset.flip(n);
			}
		}
		{
			//remove square
			for(int n=5;n<=sqLim&&n!=-1;n=bitset.nextSetBit(n+1)){
				int nsq=n*n;
				for(int k=nsq;k<=limit;k+=nsq)
					bitset.clear(k);
			}
		}
		bitset.set(2);
		bitset.set(3);
	}

	@Override
	public boolean hasNext(){
		int r=getNextValue();
		return 0<=r&&r<=limit;
	}
	private int getNextValue(){
		return bitset.nextSetBit(currentvalue+1);
	}
	@Override
	public int nextInt(){
		int r=getNextValue();
		if(r<0||limit<r) throw new NoSuchElementException();
		return currentvalue=r;
	}
	@Override
	public OfInt iterator(){
		return this;
	}
	public BitSet getClonedBitSet(){
		return (BitSet)bitset.clone();
	}
}


Measured memory_bytes: 31536
import numpy

def main():
    n,m=map(int,input().split())
    a=numpy.array([list(input()) for _ in range(n)])
    b=numpy.array([list(input()) for _ in range(m)])
    for i in range(n-m+1):
        for j in range(n-m+1):
            if numpy.all(a[i: i+m, j: j+m] == b):
                print("Yes")
                return
    print("No")
    
if __name__ == "__main__":
    main()

Measured memory_bytes: 27040
#include <cstdio>
#include <utility>
#include <cctype>
#include <string>
using namespace std;

#ifdef __linux
#define _U(s) s##_unlocked
#else
#define _U(s) _##s##_nolock
#define _CRT_DISABLE_PERFCRIT_LOCKS
#endif
#define gcu _U(getchar)
#define pcu _U(putchar)
#define _DEF(r, n, ...) inline r n(__VA_ARGS__) noexcept
#define _T template <typename T>
#define _HT template <typename H,typename... T>
#define _OP(t) inline operator t()
struct _in {
#ifdef _GLIBCXX_STRING
	_OP(string){string s;char c;while(isspace(c = gcu()));do{s+=c;}while(c=gcu(),c!=' '&&c!='\n'&&c!=EOF);return s;}
#define _S
#endif
	_OP(char){char c=gcu();gcu();return c;}
	_OP(double){double d; scanf("%lf",&d); gcu();return d;}
	_T _OP(T){T n{},m{1},c;while(isspace(c = gcu()));if(c=='-')m=-1,c=gcu();do{n=10*n+(c-'0'),c=gcu();}while(c>='0'&&c<='9');return m*n;}
} in;
#define _SCAN(...) _DEF(bool,scan,__VA_ARGS__)
#ifdef _S
_SCAN(string &o) {int c{gcu()};if(c==EOF)return false;else{ungetc(c,stdin);string t=move(in);o=t;return true;}}
#endif
_T _SCAN(T &o) {int c{gcu()};return c==EOF?false:(ungetc(c,stdin),o=in,true);}
_HT _SCAN(H &h,T&&... t){return scan(h)&&scan(t...);}
#define _OUT(...) _DEF(void,out,__VA_ARGS__)
#define _OUTL(...) _DEF(void,outl,__VA_ARGS__)
_OUT(bool b){pcu('0'+b);}
_OUT(const char *s){while(*s)pcu(*s++);}
_OUT(char c){pcu(c);}
#ifdef _S
_OUT(string &s){for(char c:s)pcu(c);}
#endif
_T _OUT(T n){static char b[20];char *p=b;T m=n<0?pcu('-'),-1:1;
	if(!n)*p++='0';else while(n)*p++=(char)(n%10*m+'0'),n/=10;while(p!=b)pcu(*--p);}
_OUTL(){out('\n');}
#ifdef _GLIBCXX_VECTOR
	_T _OUT(vector<T> &v){for(T &x:v)out(&x == &v[0]?"":" "),out(x);}
#endif
_HT _OUT(H &&h, T... t){out(h);out(t...);}
template <typename... T> _OUTL(T... t){out(t...);outl();}
struct range{
	int e,b=0,s=1;range(int _b,int _e,int _s):e(_e),b(_b),s(_s){} range(int _b,int _e): e(_e), b(_b){} range(int _e):e(_e){}
	struct it{int v,s; it(int _v,int _s):v(_v),s(_s){} operator int()const{return v;} operator int&(){return v;}int operator*()const{return v;}
		it& operator++(){v+=s;return *this;} }; it begin(){return {b,s};} it end(){return {e,s};}};
#define times(i,n) for(int i=n;i;i--)

int main() {
	for (;;) {
		string t[3] = {in, in, in};
		if (t[0] == "0")
			break;
		auto check = [&](int ai, int aj, int bi, int bj, int ci, int cj){
			return t[ai][aj] != '+' && t[ai][aj] == t[bi][bj] && t[ai][aj] == t[ci][cj];
		};
		outl([&] () -> string {
			 for (int i: range(3))
				if (t[i] == "bbb" || t[i] == "www")
					return {t[i][0]};
				else if (check(0, i, 1, i, 2, i))
					return {t[0][i]};
			return check(0, 0, 1, 1, 2, 2) || check(2, 0, 1, 1, 0, 2) ? string {t[1][1]} : "NA";
			}());
	}
}


Measured memory_bytes: 2612