akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

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

	multiset<int> st;
	st.insert(1e9+1);
	while(q--){
		int query,y;cin>>query>>y;
		if(query==0){
			// insert
			st.insert(y);
			cout<<(st.size()-1)<<endl;
		}else if(query==1){
			cout<<st.count(y)<<endl;
		}else if(query==2){
			st.erase(y);
		}else{
			int r;cin>>r;
			for(auto it=st.lower_bound(y);it!=st.upper_bound(r);++it){
				cout<<*it<<endl;
			}
		}
	}
  return 0;
}



Measured memory_bytes: 12324
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<map>
#include<iomanip>
#include<sstream>
#include<vector>
#include<stack>
#include<math.h>
#include<queue>
#include<complex>
using namespace std;

const long long int INF=99999999999999,inf=199999;
const long long int mod=1000000007;


long long int n,m,a,b,c,res=0,cou=0,h[200005]={},key=0,LID,RID;
int main() {
    int count=0;
    string str,str2;
    map<long long int,long long int>mp;
	cout << fixed << setprecision(10);
    cin>>str;
    cou=1;
    str.push_back('R');
    for(int i=1;i<str.length();i++){
        if(key==0&&str[i]=='R'){
            cou++;
        }else if(key==1&&str[i]=='L'){
            cou++;
        }else if(key==0){
            LID=i;
            RID=i+1;
            h[LID]=cou/2+cou%2;
            h[RID]=cou/2;
            key=1;
            cou=1;
        }else if(key==1){
            
            h[RID]+=cou/2+cou%2;
            h[LID]+=cou/2;
            cou=1;
            key=0;
        }
    }
    for(int i=1;i<str.length();i++){
        cout<<h[i]<<" ";
    }
    
} 


Measured memory_bytes: 1408
//----------BHAVIK DIWANI(PICT_COMP)---------------
#include<bits/stdc++.h>
#include<stdlib.h>
#include<stdio.h>
#define test ll t; cin>>t; while(t--)
#define FOR(p,n) for(ll i=p;i<(ll)n;i++)
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define mod 1000000007
#define ll long long
#define int long long
#define ull unsigned long long
#define MAX 1000005
#define pb push_back
#define mkp make_pair
#define vi vector<int>
#define pii pair<int,int>
#define endl '\n'
#define vs vector<string>
#define mii map<int,int>
#define msi map<string,int>
#define vpii vector< pair<int, int > >
#define vpsi vector< pair< string ,int > >
#define forci(p,q) for(int i=p;i<q;i++)
ll gcd(ll a,ll b){ if(b==0) return a;    return gcd(b,a%b);}
ll lcm(ll a,ll b) { return (a/gcd(a,b)*b);}
ull power(ull a, ull b) {a %= mod;  ull res = 1;  while (b > 0) { if (b & 1) res = res * a % mod;  a = a * a % mod;  b >>= 1; }  return res%mod; }
ll modmul(ll x, ll y){return (x*y)%mod;}
ll modadd(ll x, ll y){return (x+y)%mod;}
ll modsub(ll x, ll y){return (x-y+mod)%mod;}
ll fact[1000007]={0};
void facto() {fact[0]=1;fact[1]=1;for(int i=2;i<100007;i++)fact[i]=(fact[i-1]*i)%mod;}
ll ncr(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(power(fact[r],mod-2)))%mod; res=(res*(power(fact[n-r],mod-2)))%mod; return res;}
ll npr(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(power(fact[n-r],mod-2)))%mod; return res;}
inline long long toint(const std::string &s) {std::stringstream ss; ss << s; long long x; ss >> x; return x;}
inline std::string tostring(long long number) {std::stringstream ss; ss << number; return ss.str();}
inline std::string tobin(long long x) {return std::bitset<63>(x).to_string();}
/*bool prime[MAX];
ull sieve(){memset(prime,true,sizeof(prime));for(ull p=2;p*p<MAX;p++){if(prime[p]==true){for(ull i=2*p;i<MAX;i+=p){prime[i]=false;}}}prime[0]=0;prime[1]=0;
}*/
/*int inv[1000001]={0};
void findinverse(){inv[1] = 1;for(int i = 2; i <=1e6 ; ++i)	inv[i] = (mod - (mod/i) * inv[mod%i] % mod) % mod;}
*/
using namespace std;
int solve()
{
	int n;
	cin>>n;
	int x=n%1000;
	if(x==0)
		cout<<0<<endl;
	else
		cout<<1000-x<<endl;
	return 0;
}
signed main()
{
	fastio;
//	test
		solve();
}






Measured memory_bytes: 3656
import java.util.HashSet;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		var sc = new Scanner(System.in);
		var h = sc.nextInt();
		var w = sc.nextInt();
		var ch = sc.nextInt();
		var cw = sc.nextInt();
		var dh = sc.nextInt();
		var dw = sc.nextInt();
		var s = new int[h][w];
		for (var i = 0; i < h; i++) {
			var rs = sc.next();
			for (var j = 0; j < w; j++) {
				s[i][j] = rs.substring(j, j + 1).equals(".") ? 0 : -1;
			}
		}
		sc.close();

		var number = 1;
		s[ch - 1][cw - 1] = 1;
		var set = new HashSet<Integer>();
		set.add((ch - 1) * w + cw - 1);
		while (!set.isEmpty()) {
			var set2 = new HashSet<Integer>();
			for (var index : set) {
				check(s, index / w, index % w, number, set2);
			}
			number++;
			set = set2;
		}

		var result = s[dh - 1][dw - 1] < 0 ? -1 : s[dh - 1][dw - 1] - 1;
		System.out.println(result);
	}

	public static void check(int[][] s, int i, int j, int number, HashSet<Integer> set) {
		if (i > 0 && (s[i - 1][j] == 0 || s[i - 1][j] == number + 1)) {
			s[i - 1][j] = number;
			set.remove(i * s[0].length + j);
			check(s, i - 1, j, number, set);
		}
		if (j > 0 && (s[i][j - 1] == 0 || s[i][j - 1] == number + 1)) {
			s[i][j - 1] = number;
			set.remove(i * s[0].length + j);
			check(s, i, j - 1, number, set);
		}
		if (i < s.length - 1 && (s[i + 1][j] == 0 || s[i + 1][j] == number + 1)) {
			s[i + 1][j] = number;
			set.remove(i * s[0].length + j);
			check(s, i + 1, j, number, set);
		}
		if (j < s[0].length - 1 && (s[i][j + 1] == 0 || s[i][j + 1] == number + 1)) {
			s[i][j + 1] = number;
			set.remove(i * s[0].length + j);
			check(s, i, j + 1, number, set);
		}
		for (var x = i - 2; x <= i + 2; x++) {
			for (var y = j - 2; y <= j + 2; y++) {
				if (x >= 0 && x < s.length && y >= 0 && y < s[0].length && s[x][y] == 0) {
					s[x][y] = number + 1;
					set.add(x * s[0].length + y);
				}
			}
		}
	}
}


Measured memory_bytes: 65828
import java.math.BigDecimal;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        List<BigDecimal> list = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            list.add(new BigDecimal(sc.next()));
        }
        Collections.sort(list);
        Deque<BigDecimal> d = new ArrayDeque();
        for (BigDecimal b : list) {
            d.add(b);
        }
        while (d.size() > 1) {
            BigDecimal x = d.poll();
            BigDecimal y = d.poll();
            d.addFirst(y.add(x).divide(new BigDecimal(2)));
        }
        System.out.println(d.poll());
    }
}

Measured memory_bytes: 23380
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline
inpl = lambda: list(map(int,input().split()))

def get_sequence(arr):
    if len(arr) == 0:
        return [], []
    elements = []
    nums = []
    n = 1
    prev = arr[0]
    for c in arr[1:]:
        if c == prev:
            n += 1
        else:
            elements.append(prev)
            nums.append(n)
            prev = c
            n = 1
    elements.append(prev)
    nums.append(n)
    return elements, nums

N, K = inpl()
S = input().rstrip('\n')

elements, nums = get_sequence(S)
loss = len(nums)
loss -= K*2
if loss < 1:
    loss = 1
print(N-loss)

Measured memory_bytes: 51696
#include <bits/stdc++.h>
#define FOR(i, a, n) for(ll i = (ll)a; i < (ll)n; i++)
#define FORR(i, n) for(ll i = (ll)n - 1LL; i >= 0LL; i--)
#define rep(i, n) FOR(i, 0, n)
#define ALL(x) begin(x), end(x)
using namespace std;
using ll = long long;
template <typename T> using V = vector<T>;
constexpr int Mod = 998244353;
constexpr int mod = 1e9 + 7;
constexpr ll inf = 1LL << 60;
template <typename T> constexpr bool chmax(T &a, const T &b) {
    if(a >= b) return false;
    a = b;
    return true;
}
template <typename T> constexpr bool chmin(T &a, const T &b) {
    if(a <= b) return false;
    a = b;
    return true;
}

/*-------------------------------------------*/

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

    int n, m, x;
    int c[20], a[20][20];
    cin >> n >> m >> x;
    rep(i, n) {
        cin >> c[i];
        rep(j, m) cin >> a[i][j];
    }

    int ans = mod;
    rep(xx, 1 << n) {
        int sum[20]{};
        int y = 0;
        rep(i, n) if(xx >> i & 1) {
            y += c[i];
            rep(j, m) sum[j] += a[i][j];
        }
        bool ok = 1;
        rep(i, m) if(sum[i] < x) ok = false;
        if(ok) chmin(ans, y);
    }

    cout << (ans == mod ? -1 : ans) << endl;

    return 0;
}

Measured memory_bytes: 3656
#include <stdio.h>

int main(void){
    int a, b, answer;
    char op;
    while (1){
        scanf("%d %c %d", &a, &op, &b);
        switch (op){
        case '+':
            answer = a + b;
            break;
        case '-':
            answer = a - b;
            break;
        case '*':
            answer = a*b;
            break;
        case '/':
            answer = a / b;
            break;
        }
        if (op == '?')break;
        printf("%d\n", answer);
    }
    return 0;
}

Measured memory_bytes: 600
import numpy as np
N,A,B,*P=map(int,open(0).read().split())
dp=np.full(N+1,10**18,np.int64)
dp[0]=0
for p in P:
    dp[p]=min(dp[:p])
    dp[p+1:]+=B
    dp[:p]+=A
print(min(dp))

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

typedef long long LL;

LL ans, a, b, c;

int main() {
    ans = 1e18;
	cin>>a>>b>>c;
	ans = min(ans, a*c*(b%2));
	ans = min(ans, a*b*(c%2));
	ans = min(ans, b*c*(a%2));
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3532
#include <iostream>
#include <vector>
#include <stdlib.h>
#include <string.h>
#include <math.h>
using namespace std;
#define ll long long                                    // long long省略
#define pb push_back                                    // push_back省略
#define fi first                                        // first省略
#define se second                                       // second省略
#define itn int                                         // int誤字保険
#define count cout                                      // cout誤字保険
#define vecotr vector                                   // vector誤字保険
#define opt() cin.tie(0); ios::sync_with_stdio(false)   // 入出力速度改善

#define rep(i,l,r)for(ll i=(l);i<(r);i++)               // 範囲[l, r)で刻み1のfor文(順方向)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))         // 範囲[l, r)で刻みkのfor文(順方向)
#define rrep(i,l,r)for(ll i=(r-1);i>=(l);i--)           // 範囲[l, r)で刻み1のfor文(逆方向)
#define rrepp(i,l,r,k)for(ll i=(r-1);i>=(l);i-=(k))     // 範囲[l, r)で刻みkのfor文(逆方向)
#define all(x) (x).begin(), (x).end()                   // vectorのポインタ位置指定用
#define max(p,q)((p)>(q)?(p):(q))                       // max拡張
#define min(p,q)((p)<(q)?(p):(q))                       // min拡張
#define bit(n,m)(((n)>>(m))&1)                          // 変数nのm番目のbitを取り出す

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

/*
   upll : (a<b)なら-1, (a=b)なら0, (a>b)なら1
 downll : (a<b)なら1, (a=b)なら0, (a>b)なら-1

 const void* a : 型を縛らずにconstをつける(=変数aが読み込み専用の変数であることを明示する)
        (ll*)a : 変数aがconst long long *型であると明示する
*/
// int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
// int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
// void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
// void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}
ll pom(ll a,ll n,int m){ll x=1;for(a%=m;n;n/=2)n&1?x=x*a%m:0,a=a*a%m;return x;}

#define INF ((1LL<<62)-(1LL<<31))
//#define MOD 998244353
#define MOD 1000000007
#define invp(a,p) pom(a,p-2,p)

int main(){
    ll sx, sy, tx, ty; cin >> sx >> sy >> tx >> ty;
    ll x = tx - sx, y = ty - sy, n = x + y;

    rep(i,0,x) cout << "R";
    rep(i,0,y+1) cout << "U";
    rep(i,0,x+1) cout << "L";
    rep(i,0,y+1) cout << "D";
    cout << "R";
    rep(i,0,y) cout << "U";
    rep(i,0,x+1) cout << "R";
    rep(i,0,y+1) cout << "D";
    rep(i,0,x+1) cout << "L";
    cout << "U";
}

Measured memory_bytes: 256
import java.io.IOException;
import java.util.NoSuchElementException;

import java.io.InputStream;

@SuppressWarnings("unchecked")
public class Main {
    public static void main(String[] args) throws IOException {
        FastScanner fs = new FastScanner();

        final int N = fs.nextInt();

        int sum = 0;

        for (int i = 0; i < N; i++) {
            int a = fs.nextInt();

            int j = 0;
            int cnt = 0;

            // 偶数の時だけ
            while ((a & 1) == 0) {
                a = a >> 1;
                j++;

                if ((a & 1) == 1) cnt = j;
            }

            sum += cnt;
        }

        System.out.println(sum);
    }
}

class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        } else {
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() {
        if (hasNextByte()) return buffer[ptr++];
        else return -1;
    }
    private static boolean isPrintableChar(int c) {
        return 33 <= c && c <= 126;
    }
    public boolean hasNext() {
        while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;
        return hasNextByte();
    }
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true) {
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            } else if(b == -1 || !isPrintableChar(b)) {
                return minus ? -n : n;
            } else {
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
            throw new NumberFormatException();
        return (int) nl;
    }
    public double nextDouble() {
        return Double.parseDouble(next());
    }
}


Measured memory_bytes: 23888
import sys
from collections import deque
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
def input(): return sys.stdin.readline().rstrip()

def main():
    from collections import deque
    dy,dx=[1,0,-1,0],[0,1,0,-1]
    def maze_init(grid,road_chr='.',wall_chr='#',start_chr=None,goal_chr=None):
        H,W=len(grid),len(grid[0])
        if isinstance(grid[0],str):
            grid=[list(row) for row in grid]
        S,G=None,None
        c=[[-1]*(W+2) for _ in range(H+2)]
        for i,row in enumerate(grid,1):
            for j,x in enumerate(row,1):
                if x==road_chr:
                    c[i][j]=0
                elif x==wall_chr:
                    c[i][j]=1
                elif x==start_chr:
                    S=(i,j)
                    c[i][j]=0
                elif x==goal_chr:
                    G=(i,j)
                    c[i][j]=0
        return c,S,G
    def maze_bfs(grid,start_coordinate,road_cost=1,wall_cost=None):
        d=[[INF]*len(grid[0]) for _ in range(len(grid))]
        que=deque()
        que.append((start_coordinate[0],start_coordinate[1]))
        d[start_coordinate[0]][start_coordinate[1]]=0
        while que:
            v=que.popleft()
            for k in range(4):
                nv=(v[0]+dy[k],v[1]+dx[k])
                if grid[nv[0]][nv[1]]==0:
                    if d[nv[0]][nv[1]]>d[v[0]][v[1]]+road_cost:
                        que.append(nv)
                        d[nv[0]][nv[1]]=d[v[0]][v[1]]+road_cost
                elif grid[nv[0]][nv[1]]==1 and wall_cost is not None:
                    if d[nv[0]][nv[1]]>d[v[0]][v[1]]+wall_cost:
                        que.append(nv)
                        d[nv[0]][nv[1]]=d[v[0]][v[1]]+wall_cost
        return d
    
    H,W=map(int,input().split())
    s=[list(input()) for _ in range(H)]
    
    grid,S,G=maze_init(s,road_chr='.',wall_chr='#',start_chr=None,goal_chr=None)
    
    ans=0
    for i in range(1,H+1):
        for j in range(1,W+1):
            d=maze_bfs(grid,(i,j),road_cost=1,wall_cost=None)
            for k in range(1,H+1):
                for l in range(1,W+1):
                    if grid[i][j]==grid[k][l]==0:
                        ans=max(ans,d[k][l])
    print(ans)

if __name__ == '__main__':
    main()


Measured memory_bytes: 46060
import java.util.*;
import java.util.function.*;
import java.math.*;
public class Main {
    public static void main(String[] args){
		Scanner s = new Scanner(System.in);
		int H = Integer.valueOf(s.next());
		int W = Integer.valueOf(s.next());
		int K = Integer.valueOf(s.next());
		char[][] maze = new char[H][W];
		for(int i = 0; i < H; i++) {
			maze[i] = s.next().toCharArray(); 
		}
		
		int ret = 0;
		for(int i = 0; i < (1<<H); i++) {
			for(int j = 0; j < (1<<W); j++) {
				int cnt = 0;
				for(int h = 0; h < H; h++) {
					if(((i>>h)&1) == 1) {
						continue;
					}
					for(int w = 0; w < W; w++) {
						if(((j>>w)&1) == 1) {
							continue;
						}
						if(maze[h][w] == '#') {
							cnt++;
						}
					}
				}
				if(cnt == K) {
					ret++;
				}
			}
		}
		System.out.println(ret);
	}
}

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

int main()
{
	int am[13] = {0, 31,29,31,30,31,30,31,31,30,31,30,31 };
	int a, b;

	while (cin >> a >> b&&a!=0&&b!=0)
	{
		

		int c=b;
		for (int i = 0; i < a; i++) {
			c += am[i];
		}
		
		int d = c % 7;

		switch (d) {
		case 0:
			cout << "Wednesday" << endl;
			break;

		case 1:
			cout << "Thursday" << endl;
			break;
		
		case 2:
			cout << "Friday" << endl;
			break;

		case 3:
			cout << "Saturday" << endl;
			break;
			
		case 4:
			cout << "Sunday" << endl;
			break;

		case 5:
			cout << "Monday" << endl;
			break;

		case 6:
			cout << "Tuesday" << endl;
			break;
		}
	}

	return 0;
}

Measured memory_bytes: 3080
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/integer/common_factor.hpp>
#include <boost/integer/common_factor_rt.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>

using std::string;
using std::vector;
using std::set;
using std::multiset;
using std::unordered_set;
using std::map;
using std::multimap;
using std::unordered_map;
using std::pair;
using std::cin;
using std::cout;

typedef uintmax_t    ull;
typedef intmax_t     ll;
typedef uint64_t     ul;
typedef uint32_t     ui;
typedef uint8_t      uc;

typedef boost::multiprecision::number<boost::multiprecision::cpp_dec_float<1000>> cpp_dec_float_1000;

constexpr char CRLF = '\n';
constexpr char SPACE = ' ';
constexpr char VECTOR_COUT_SEPARATOR = SPACE;
constexpr ll INF = 1000'000'007;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> std::ostream& operator<< (std::ostream& os, const std::vector<T>& vc) { for(auto it = vc.begin(); it != vc.end(); ++it) { if (std::next(it) == vc.end()) os << *it; else os << *it << VECTOR_COUT_SEPARATOR; } return os; }
template<class T1, class T2> inline std::ostream & operator<< (std::ostream & os, const std::pair<T1, T2> & p) { return os << p.first << ' ' << p.second; }

void solve(void)
{
  vector<char> s(3);
  for(auto& c : s) cin >> c;

  ui res{700};
  for(const auto& c : s)
    if(c == 'o')
      res += 100;

  cout << res << CRLF;
  return;
}

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

  solve();

  return 0;
}


Measured memory_bytes: 256
n = int(input())

# import math
# def isPrime(x):
#   if x == 2:
#     return True
#   if x % 2 == 0:
#     return False
#   for i in range(3, int(math.sqrt(x)) + 1, 2):
#     if x % i == 0:
#       return False
#   return True

# primes=[]
# for i in range(2,100):
#   if isPrime(i):
#     primes.append(i)


primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37,
          41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97]

pows = {}
for p in primes:
  if p > n:
    break
  pows[p] = 0
  pp = p
  while n // pp >= 1:
    pows[p] += n // pp
    pp *= p

e = []
for x in pows.values():
  e.append(x + 1)
# print(e)

import itertools
ans = 0

for x in e:
  if x >= 75:
    ans += 1

for (x, y) in itertools.combinations(e, 2):
  #print(x, y)
  for a, b in [(25, 3), (15, 5), (5, 15), (3, 25)]:
    if x >= a and y >= b:
      ans += 1

for (x, y, z) in itertools.combinations(e, 3):
  #print(x, y, z)
  for a, b, c in [[5, 5, 3], [5, 3, 5], [3, 5, 5]]:
    if x >= a and y >= b and z >= c:
      ans += 1

print(ans)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mod = (int)1e9 + 7;
const int INF = (int)100100100;
const int nmax=8;
bool graph[nmax][nmax]={};

int dfs(ll v,ll N,bool visited[nmax]){
    bool all_visited=true;
    for (int i = 0; i < N; i++){
        if(!visited[i])all_visited=false;
    }
    if(all_visited){
        return 1;
    }
    int ret=0;
    for(int i=0;i<N;i++){
        if (!graph[v][i])continue;
        if (visited[i])continue;
        visited[i]=true;
        ret+=dfs(i,N,visited);
        visited[i]=false;
    }

    return ret;
}
    
int main() {
    ll N,M;
	cin >> N >> M;
    //ll N; cin >> N;
    //string S; cin >> S;
    //ll H,W; cin >> H >> W;
    vector<vector<ll>> a(N);
    for(int i=0;i<M;i++){
        int x,y;
        cin >> x >> y;
        graph[x-1][y-1]=true;
        graph[y-1][x-1]=true;
    }

    bool visited[N]={};
    visited[0]=true;
    cout << dfs(0,N,visited) << endl;
}

/*



 */



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

int main() {
    int a, b;
    cin >> a >> b;
    if (a < b) {
        for (int i = 0; i < b; i++) {
            cout << a;
        }
    }
    else if (b < a) {
        for (int i = 0; i < a; i++) {
            cout << b; 
        }
    }
    else if (a == b) {
        for (int i = 0; i < min(a, b); i++) {
            cout << a;
        }
    }
return 0;
}

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

#define ll long long

// 0 ~ nの整数の内、xで割り切れるもの
ll f(ll n, ll x) {
    if (n < 0) return 0;

    return n / x + 1;
}

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

    cout << f(b, x) - f(a - 1, x) << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ALL(a)  (a).begin(),(a).end()
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
template <typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template <typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
const int INT_INF = 1LL << 30;

ll choose2(ll n){
  return n*(n-1)/2;
}

int main(){
  int N;
  cin >> N;
  vll C(N);
  vll A(N);
  for(int i = 0; i < N; i++){
    cin >> A.at(i);
    A.at(i)--;
    C.at(A.at(i))++;
  }
  ll sum = 0;
  for(int i = 0; i < C.size(); i++){
    sum += choose2(C.at(i));
  }
  for(int i = 0; i < N; i++){
    ll result = sum;
    result -= choose2(C.at(A.at(i)));
    result += choose2(C.at(A.at(i))-1);
    cout << result << endl;
  }
}

Measured memory_bytes: 5760
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<math.h>
#include<stdlib.h>
#include<string>
#include<iostream>
#include<set>
#include<map>
#include<deque>
using namespace std;
typedef long long ll;
typedef pair<ll, ll>pii;
typedef pair<pii, ll>pi3;
ll mod = 1000000007;
int d[1000];
int main()
{
	int n, k;
	scanf("%d%d", &n, &k);
	int now = 1;
	for (int i = 0; i < n; i++)
	{
		if (now < k)now *= 2;
		else now += k;
	}
	printf("%d\n", now);
}

Measured memory_bytes: 256
### ----------------
### ここから
### ----------------

import sys
from io import StringIO
import unittest

def yn(b):
    print("Yes" if b==1 else "No")
    return

def resolve():
    readline=sys.stdin.readline

    a,b=map(int, readline().rstrip().split())
    #arr=list(map(int, readline().rstrip().split()))
    #n=int(readline())
    #ss=readline().rstrip()
    #yn(1)
    n=1
    tap=0

    if b==1:
        print(0)
        return

    while 1:
        n-=1
        n+=a
        tap+=1
        if n>=b:
            print(tap)
            break


    return

if 'doTest' not in globals():
    resolve()
    sys.exit()

### ----------------
### ここまで 
### ----------------

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

using namespace std;

using Weight=long long;

struct Edge{
    int src,dst;
    Weight weight;
    Edge(int src,int dst,Weight weight):
    src(src),dst(dst),weight(weight){}
};

auto operator < (const Edge &e,const Edge &f){
    if(e.weight!=f.weight)return e.weight>f.weight;
    else if(e.src!=f.src)return e.src<f.src;
    else return e.dst<f.dst;
}

using Edges=vector<Edge>;
using Graph=vector<Edges>;

class UnionFind{
private:
    vector<int>data;
public:
    UnionFind(int n):data(n,-1){}
    bool unite(int x,int y){
        x=root(x);y=root(y);
        if(x!=y){
            if(data[y]<data[x])swap(x,y);
            data[x]+=data[y];data[y]=x;
        }
        return x!=y;
    }
    int root(int x){
        return data[x]<0?x:data[x]=root(data[x]);
    }
    bool same(int x,int y){
        return root(x)==root(y);
    }
    int size(int x){
        return -data[root(x)];
    }
};

pair<Weight,Edges>kruskal(const Graph &g){
    int n=g.size();
    UnionFind uf(n);
    priority_queue<Edge>q;
    for(int i=0;i<n;++i){
        for(auto e:g[i]){
            if(i<e.dst)q.push(e);
        }
    }
    Weight total=0;
    Edges forest;
    while(forest.size()<n-1 && !q.empty()){
        Edge e=q.top();q.pop();
        if(uf.unite(e.src,e.dst)){
            forest.push_back(e);
            total+=e.weight;
        }
    }
    return {total,forest};
}

int main(){
    int v,e;cin>>v>>e;
    Graph g(v);
    for(int i=0;i<e;++i){
        int s,t,w;cin>>s>>t>>w;
        g[s].emplace_back(s,t,w);
        g[t].emplace_back(t,s,w);
    }
    cout<<kruskal(g).first<<endl;
    return 0;
}
// be checked by AOJ(GRL-2-A).

Measured memory_bytes: 10332
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
#include<stdio.h>
#include <cstdint>
#include <stdlib.h> 
#include <time.h>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define rrep(i,n) REP(i,1,n+1)
#define all(a) a.begin(), a.end()
#define fi first
#define se second
#define RNG(x, a, n) &((x)[a]), &((x)[n])
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
typedef long long ll;
typedef pair<ll, ll> Pll;
typedef pair<int, int> PII;
typedef vector<ll> Vl;
typedef vector<int> VI;
typedef tuple<int, int, int> TT;
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
#define rall(v) v.rbegin(), v.rend()
#define dmp(x,y) make_pair(x,y)
#define dmt(x, y, z) make_tuple(x, y, z)
#define pb(x) push_back(x)
#define pf(x) push_front(x)
const int MAX = 510000;
const int inf = 1e9 + 7;
const int mod = 1e9 + 7;
const ll longinf = 1LL << 60;
const long double PI = (acos(-1));
const long double EPS = 0.0000000001;


ll n, k;

int main() {

	cin >> n >> k;

	cout << min(n % k, abs((n % k) - k)) << endl;

	return 0;
}


Measured memory_bytes: 256
use std::cmp::Ordering;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).ok();

    let q: Vec<i32> = buf
        .trim()
        .split_whitespace()
        .map(|x| x.parse().unwrap())
        .collect();

    match (q[0] + q[1]).cmp(&(q[2] + q[3])) {
        Ordering::Greater => println!("Left"),
        Ordering::Equal => println!("Balanced"),
        Ordering::Less => println!("Right"),
    }
}


Measured memory_bytes: 4352
#include<stdio.h>
#include<math.h>
int main()
{
    long long i,n,m,sum,task[10010],result;

    scanf("%lld %lld",&n,&m);

    for(i=0; i<m; i++)
    {
        scanf("%lld",&task[i]);
    }
    sum=0;
    for(i=0; i<m; i++)
    {
        sum=sum+task[i];
    }

    result=n-sum;

    if(sum>n)
    {
        printf("-1\n");
    }
    else
    {
        printf("%lld\n",result);
    }
    return 0;
}


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

def f(x):
    if x % 4 == 0:
        return x
    elif x % 4 == 1:
        return 1
    elif x % 4 == 2:
        return x + 1
    else:
        return 0
if A == B:
    print(A)
elif A == 0:
    print(f(B))
else:
    print(f(B) ^ f(A-1))

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ii pair <int, int>
#define app push_back
#define all(a) a.begin(), a.end()
#define bp __builtin_popcountll
#define ll long long
#define mp make_pair
#define f first
#define s second
#define Time (double)clock()/CLOCKS_PER_SEC
signed main() {
    #ifdef HOME
    freopen("input.txt", "r", stdin);
    #else
    #define endl '\n'
    ios_base::sync_with_stdio(0); cin.tie(0);
    #endif
    int n;
    cin >> n;
    vector <int> a(3 * n);
    for (int i = 0; i < 3 * n; ++i)
        cin >> a[i];
    sort(all(a));
    int ans = 0;
    for (int i = n; i < 3 * n; i += 2)
        ans += a[i];
    cout << ans << endl;
}

Measured memory_bytes: 2560
#include <iostream>
#include <string>
#include <algorithm>
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <deque>
#include <cstdio>
#include <set>
#include <map>
#include <bitset>
#include <stack>
#include <cctype>
using namespace std;
int co[2020][2020] = { 0 };
int co1[2020][2020] = { 0 };
int main() {
    int h, w;
    cin >> h >> w;
    string s[2020];
    for (int i = 0; i < h; i++) {
        cin >> s[i];
    }
    for (int i = 0; i < h; i++) {
        int c = 0;
        for (int j = 0; j < w; j++) {
            if (s[i][j] == '.') {
                c++;
            }
            else {
                c = 0;
            }
            co[i][j] = c;
        }
        for (int j = w - 2; j >= 0; j--){
            if (co[i][j] != 0 && co[i][j + 1] != 0) {
                co[i][j] = co[i][j + 1];
            }
        }
    }
    for (int i = 0; i < w; i++) {
        int c = 0;
        for (int j = 0; j < h; j++) {
            if (s[j][i] == '.') {
                c++;
            }
            else {
                c = 0;
            }
            co1[j][i] = c;
        }
        for (int j = h - 2; j >= 0; j--) {
            if (co1[j][i] != 0 && co1[j + 1][i] != 0) {
                co1[j][i] = co1[j + 1][i];
            }
        }
    }
    int ans = 0;
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            if (co[i][j] + co1[i][j] - 1 > ans) {
                ans = co[i][j] + co1[i][j] - 1;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 42768
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(n); ++i) 
using namespace std;
using ll = long long;
int main() {
 int n ,k ;
cin >> n >> k;
 if (n>=10) cout << k << endl;
 else cout << k +100*(10-n) << endl;

}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<string>
#include<algorithm>
#define ll long long
using namespace std;
#define MAXN 200050
int n,m;
char c;
int label[MAXN];
int x,y;
struct T
{
    int y;
    int next;
}e[MAXN*5];
int top=1;
int st[MAXN];
bool hasCheck[MAXN];
bool result[MAXN];
bool ig[MAXN];

void adde(int x,int y)
{
    if (!st[x])
    {
        e[top].y=y;
        e[top].next=0;
        st[x]=top++;
    } else
    {
        e[top].y=y;
        e[top].next=st[x];
        st[x]=top++;
    }
}
void printe()
{
    for (int i=1; i<=n; ++i)
    {
        cout<<i<<":";
        for (int j=st[i]; j; j=e[j].next)
        {
            cout<<e[j].y<<' ';
        }
        cout<<endl;
    }
}

bool checkig(int i)
{
    if (ig[i]==1) return 0;
    bool A=0,B=0;
    for (int j=st[i];j;j=e[j].next)
    {
        int y=e[j].y;
        if (ig[y]) continue;
        if (label[y]==0) A=1;
        if (label[y]==1) B=1;
    }
    if (A==0 || B==0)
        ig[i]=1;
    return ig[i];
}

bool inq[MAXN];
int q[MAXN];
void solve(int i)
{
    int l=1;
    q[l]=i;
    while (l>0)
    {
        int now=q[l];
        inq[now]=0;
        l--;
        if (checkig(now))
        {
            for (int j=st[now]; j; j=e[j].next)
            {
                int y=e[j].y;
                if (ig[y]) continue;
                if (inq[y]) continue;
                inq[y]=1;
                l++;
                q[l]=y;
            }
        }
    }
}

int main()
{
    cin>>n>>m;
    for (int i=1; i<=n; ++i)
    {
        cin>>c;
        if (c=='A') label[i]=0;
        else label[i]=1;
    }
    for (int i=1; i<=m; ++i)
    {
        cin>>x>>y;
        adde(x,y);
        adde(y,x);
    }
    bool flag=0;
    for (int i=1; i<=n; ++i)
        solve(i);
    for (int i=1; i<=n; ++i)
        if (ig[i]==0)
        {
            cout<<"Yes"<<endl;
            flag=1;
            break;
        }
    if (!flag)
    {
        cout<<"No"<<endl;
    }
        

    return 0;
}


Measured memory_bytes: 7936
use std::io::*;
use std::str::FromStr;
use std::collections::BTreeMap;

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

fn main(){
    let n: usize = read();
    let c: Vec<u64> = (0..n).map(|_| read()).collect();
    let mut tree: BTreeMap<u64, u64> = BTreeMap::new();

    for a in &c {
        match tree.get_mut(a) {
            Some(b) => {
                *b += 1;
            },
            None => {
                tree.insert(*a, 1);
            }
        }
    }
    let ret = (&tree).into_iter().fold(0, |x, (_, &y)| if y < 2 { 0 } else { y * (y - 1) / 2} + x);

    for &a in &c {
        let b = *tree.get(&a).unwrap();
        if b < 2 {
            println!("{}", ret);
        } else {
            println!("{}", ret - b * (b - 1) / 2 + (b - 1) * (b - 2) / 2);
        }
    }
}


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

using namespace std;

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

    vector<int> box(n, 1);//箱iに入っているボールの数
    vector<bool> red(n, false);//箱iに赤が入っている可能性
    red[0] = true;

    while (m--) {
        int x, y;
        cin >> x >> y;
        x--;
        y--;

        if (box[x] == 0) continue;

        if (!red[x]) {
            box[x]--;
            box[y]++;
        } else if (box[x] > 1) {
            box[x]--;
            box[y]++;
            red[y] = true;
        } else if (box[x] == 1) {
            box[x]--;
            box[y]++;
            red[x] = false;
            red[y] = true;
        }
    }

    int ans = 0;
    for (int i = 0; i < n; ++i) {
        if (red[i]) ans++;
    }
    cout << ans << endl;
    return 0;
}


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

using namespace std;

int main(void){

    int n;
    double ans = 0;
    cin >> n;

    for(int i = 0;i < n;i++){
        double x;
        string str;
        cin >> x >> str;

        ans += (str[0] == 'J' ? x : x*380000.0);
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define int long long int
#define ld long double
#define mod 1000000007 
#define pii pair<int,int>
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define all(a) (a).begin(), (a).end()
#define forn(i,s, e) for (int i = s; i <= e; i++)
#define fornd(i,s, e) for (int i = s ; i >= e; i--)
#define autoit(x,it) for(auto it = x.begin(); it != x.end(); it++)
#define print(x) for(auto el: x) cout<<el<<" ";cout<<"\n"
#define PSET(x,y) fixed<<setprecision(y)<<x
// #define bits(x) __builtin_popcount(x)
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
void fileio()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}
 

 
template <typename T> 
void swap(T& a, T& b){
    T temp = a;
    a = b;
    b = temp;
}

const int N = 100001; 


int dp[N][3];
int arr[N][3];

void solve(){
    int n;
    cin>>n;

    forn(i,0,n-1)
        cin>>arr[i][0]>>arr[i][1]>>arr[i][2];

    dp[0][0] = arr[0][0];
    dp[0][1] = arr[0][1];
    dp[0][2] = arr[0][2];

    for(int i=1;i<n;i++){
        dp[i][0] = arr[i][0]+max(dp[i-1][1],dp[i-1][2]);
        dp[i][1] = arr[i][1]+max(dp[i-1][0],dp[i-1][2]);
        dp[i][2] = arr[i][2]+max(dp[i-1][0],dp[i-1][1]);
    }
    cout<<max({dp[n-1][0],dp[n-1][1],dp[n-1][2]})<<endl;
}
 
int32_t main()
{
    fast;
    // int t;
    // cin>>t;
    // for(int y=1;y<=t;y++)
    {
        // cout<<"Case #"<<y<<": ";
        solve();
    }
    return 0;
} 

Measured memory_bytes: 4992
#include <bits/stdc++.h>
using namespace std;
const long long INF = 100000000000000;
const int MOD = 1000000007;
#define rep(i, a) REP(i, 0, a)
#define REP(i, a, b) for(int i = a; i < b;i++)
#define all(x) x.begin(), x.end()
typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<P> vp;



int main() {
    int n;
    cin >> n;
    vi a(n);
    rep(i, n) cin >> a[i];
    bitset<2001*2001> dp;
    dp[0] = 1;
    int sum = 0;
    rep(i, n){
        sum += a[i];
        dp = dp | (dp << a[i]);
    }
    for(int i = (sum + 1) / 2;i <= sum;i++){
        if(dp[i]){
            cout << i << endl;
            break;
        }
    }
}

Measured memory_bytes: 2176
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using vec=vector<ll>;
using mat=vector<vec>;
#define For(i,a,b) for(i=a;i<b;i++)
#define rep(i,N) For(i,0,N)
#define rep1(i,N) For(i,1,N)
#define all(v) (v).begin(),(v).end()
#define allr(v) (v).rbegin(),(v).rend()
#define vsort(v) sort(all(v))
#define vrsort(v) sort(allr(v))
#define mod 1000000007
using datas=pair<ll,ll>;
using tdata=pair<datas,ll>;

long mmid(long a,long b,long c){return a<b?(b<c?b:max(a,c)):(b>c?b:min(a,c));}

ll modinv(ll a) {
  ll b=mod,u=1,v=0,t;
  while(b){
    t=a/b;
    a-=t*b; swap(a,b);
    u-=t*v; swap(u,v);
  }
  return (u+mod)%mod;
}

ll moddevide(ll a,ll b){return (a*modinv(b))%mod;}

ll modncr(ll n,ll r){
  ll i,plus=1;
  rep(i,r){
    plus=(plus*(n-i))%mod;
    plus=moddevide(plus,i+1);
  }
  return plus;
}

ll modncrlistp[200000],modncrlistm[200000];

ll modncrs(ll n,ll r){
  ll i,j;
  if(modncrlistp[n]==0){
    for(i=n;i>=0;i--){
      if(modncrlistp[i])break;
    }
    if(i<0){
      modncrlistp[0]=1;
      rep1(i,n+1){
        modncrlistp[i]=(modncrlistp[i-1]*i)%mod;
      }
    }else{
      For(j,i+1,n+1){
        modncrlistp[j]=(modncrlistp[j-1]*j)%mod;
      }
    }
  }
  if(modncrlistm[n]==0){
    for(i=n;i>=0;i--){
      if(modncrlistm[i])break;
    }
    if(i<0){
      modncrlistm[0]=1;
      rep1(i,n+1){
        modncrlistm[i]=(modncrlistm[i-1]*modinv(i))%mod;
      }
    }else{
      For(j,i+1,n+1)modncrlistm[j]=(modncrlistm[j-1]*modinv(j))%mod;
    }
  }
  return (((modncrlistp[n]*modncrlistm[r])%mod)*modncrlistm[n-r])%mod;
}

ll euclidean_gcd(ll a, ll b) {
  if(a<b) return euclidean_gcd(b, a);
  ll r;
  while ((r=a%b)){a=b;b=r;}
  return b;
}

ll countdigits(ll n){
  ll ans=0;
  while(n){n/=10;ans++;}
  return ans;
}

ll sumdigits(ll n){
  ll ans=0;
  while(n){ans+=n%10;n/=10;}
  return ans;
}

void printmap(vector<ll>& a,ll H,ll W){
  ll i,j;
  For(i,0,H+2){
    For(j,0,W+2){cout<<a[i*(W+2)+j];}
    cout<<endl;
  }
}
void inputmap(vector<ll>& a,ll H,ll W){
  ll i,j;
  string ss;
  For(i,1,H+1){
    cin>>ss;
    For(j,1,W+1){
      if(ss[j-1]=='#'){
        a[i*(W+2)+j]=1;
      }else{
        a[i*(W+2)+j]=0;
      }
    }
  }
}

int main(){
  ll i=0,N,M=1,K;
  cin>>N>>K;N--;
  while(1){
    if(M>=K)break;
    i++;
    M+=N;
  }
  cout<<i<<endl;
  return 0;
}

Measured memory_bytes: 256
#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 rrep2(ri,x,n) for(int ri = (int)(n-1); ri >= (int)(x); ri--)
#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(x) x.begin(), x.end()
using ll = long long;
using namespace std;

int main(){
  int r;
  cin >> r;
  if(r < 1200) cout << "ABC" << endl;
  else if(r < 2800) cout << "ARC" << endl;
  else cout << "AGC" << endl;
  return 0;
}

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

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using ll = long long;
int mod = 1000000000+7;

int main(){

	int d;
	cin>>d;
	int c[26];
	rep(i,26)cin>>c[i];
	//int lastd[26]={};
	int s[d][26];
	rep(i,d){
		rep(j,26){
			cin>>s[i][j];
		}
	}

	rep(i,d){
		cout<<1;
		if(i!=d-1)cout<<endl;
	}

	return 0;
}


Measured memory_bytes: 3652
#include <iostream>
#include <string>
#include <cmath>
#include <ctime>
#include <vector>
#include <algorithm>
#include <cstdlib>
using namespace std;

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

    while(true){
        C = C - B;
        if(C <= 0){
            cout << "Yes" << endl;
            return 0;
        }

        A = A - D;
        if(A <= 0){
            cout << "No" << endl;
            return 0;
        }


    }


}

Measured memory_bytes: 3632
#include <cstdio>
#include <queue>
#include <vector>
#include <algorithm>

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

int main( void ){
	int n, k;
	if (!scanf( "%d%d", &n, &k ))
		return -1;
	char* str = new char[ n+1 ];
	if (!scanf( "%s", str ))
		return -1;
	bool is_L = (str[0] != 'L');
	int count_same = 0, count_diff = -1;
	rep(i, 0, n){
		if (!(is_L ^ (str[i] == 'L')))
			count_same++;
		else
			count_diff++;
		is_L = (str[i] == 'L');
	}
	count_same += std::min(2*k, count_diff);
	printf("%d\n", count_same);
}


Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <numeric>
#include <ctime>
#include <complex>
#include <bitset>
#include <random>
#include <climits>
#include <stack>

using namespace std;

typedef long long ll;
typedef long double ld;

#define int ll
#define double ld
#define loop(i, n) for(int i = 0; i < (int)n; ++i)
#define loop1(i, n) for(int i = 1; i <= (int)n; ++i)
#define F first
#define S second
#define pb push_back
#define pi pair <int, int>
#define all(x) begin(x), end(x)
#define ti tuple <int, int, int>
#define Point Vect
#define no {cout << 0; return;}
#define mkp make_pair
#define mkt make_tuple
#define cerr if(0) cerr

void solve() {
    int a, b, k;
    cin >> a >> b >> k;
    int d = min(a, k);
    k -= d; a -= d;
    d = min(b, k);
    k -= d; b -= d;
    cout << a << " " << b;
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    solve();
    return 0;
}


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

const int MAXN = 200010;
int a[MAXN], b[MAXN], n;
struct HEAPDATA {
	int pos, val;
	bool operator<(const HEAPDATA &rhs) const {
		return val < rhs.val;
	}
};
int g(int pos) {
	return b[(pos+n)%n];
}
int max3(int v1, int v2, int v3) {
	return max(v1, max(v2, v3));
}
int main() {
	cin>>n;
	for (int i=0; i<n; i++)
		cin>>a[i];
	for (int i=0; i<n; i++)
		cin>>b[i];
	priority_queue<HEAPDATA> heap;
	for (int i=0; i<n; i++) {
		if (b[i] < a[i]) {
			cout<<-1<<endl;
			return 0;
		}
		if (b[i] > a[i])
			heap.push(HEAPDATA{i, b[i]});
	}

	long long ans = 0;
	for (int i=heap.top().pos; heap.size()>0; i=heap.top().pos){
		heap.pop();
		int decrment = g(i-1) + g(i+1);
		int allowdelta = b[i] - max3(g(i-1), a[i], g(i+1));
		int allowmulti = allowdelta / decrment + (allowdelta%decrment?1:0);
		b[i] -= decrment*allowmulti;
		// cout<<"b["<<i<<"] == "<<b[i]<<" \tby decr="<<decrment<<"*"<<allowmulti<<"  (heapsize="<<heap.size()<<endl;
		if (b[i] < a[i]) {
			cout<<-1<<endl;
			return 0;
		}
		ans += (long long)allowmulti;
		if (b[i] > a[i])
			heap.push(HEAPDATA{i, b[i]});
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3956
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define int long long
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e18;

signed main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	int n, h, w;
	cin >> n >> h >> w;
	int ans = 0;
	rep(i, 0, n){
		int a, b;
		cin >> a >> b;
		if(h <= a && w <= b) ans++;
	}
	cout << ans << endl;
}

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

int main()
{
    int a,ac=0,wa=0,tle=0,re=0;
    string b;
    cin>>a;
    for(int i = 1;i<=a;i++){
        cin>>b;
        if(b == "AC"){
            ac++;
        }
        else if(b == "WA"){
            wa++;
        }
        else if(b == "TLE"){
            tle++;
        }
        else {
            re++;
        }
    }
    cout<<"AC x "<<ac<<endl;
    cout<<"WA x "<<wa<<endl;
    cout<<"TLE x "<<tle<<endl;
    cout<<"RE x "<<re<<endl;

    return 0;
}

Measured memory_bytes: 3608
n = gets.chomp("").to_i
s = gets.chop

cnt = 1
(n-1).times do |i|
  if s[i] != s[i+1]
    cnt += 1
  else
    if (n-1) == (i+1) && cnt == 0
      cnt += 1
    end
  end
end

puts cnt


Measured memory_bytes: 2044
package main

import (
	"fmt"
	"strings"
)

func main() {
	var s1, s2, s3 string
	fmt.Scan(&s1, &s2, &s3)
	fmt.Printf("%s%s%s\n", strings.ToUpper(s1[0:1]), strings.ToUpper(s2[0:1]), strings.ToUpper(s3[0:1]))
}


Measured memory_bytes: 640