akhauriyash/Code-Regression huggingface dataset:
import java.util.*;

public class Main {
    public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
        String line = sc.nextLine();
        int number = Integer.parseInt(line);
        
        String line2 = sc.nextLine();
        String[] line2sp = new String[number];
    	line2sp=line2.split(" ");
    	int[] figArray = new int[number];
    	int[] afterSort = new int[number];
    	
    	 for(int i=0;i<number;i++){
    		 figArray[i]=Integer.parseInt(line2sp[i]);
    		 afterSort[i]=0;
    		 
         }    	 
    	 
    	 int insert=-1;
    	 
    	 for(int i=0;i<number;i++){
    		 insert=figArray[i];
    		 int j=i-1;
    		 
    		 while(j>=0&&figArray[j]>insert){
    			 figArray[j+1]=figArray[j];
    			 j--;
    			 figArray[j+1]=insert;
    		 }
    		 
    		 
    		 for(int k=0;k<number-1;k++){
    			 System.out.print(figArray[k]+" ");
    		 }
    		 System.out.println(figArray[number-1]);
    		 
    	 }
    }   
}

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

int main(){
int n,q;
cin >> n;
vector<int> num(100010);
ll sum=0;
rep(i,n){
    int a;
    cin >> a;
    num[a]++;
    sum +=a;
}
vector<ll> s(100010);
cin >> q;
rep(i,q){
    int b,c;
    cin >> b >> c;
    num[c] += num[b];
    s[i]= sum + (c-b)*num[b];
    num[b]=0;
    sum = s[i];
}

rep(i,q) cout << s[i] << endl;

}

Measured memory_bytes: 4588
import math
class SegmentTree:
    __slots__ = ["elem_size", "tree_size", "tree", "default", "op"]

    def __init__(self, a: list, default: int, op):
        real_size = len(a)
        self.elem_size = 1 << math.ceil(math.log2(real_size))
        self.tree_size = 2 * self.elem_size
        self.tree = [default] * self.elem_size + a + [default] * (self.elem_size - real_size)
        self.default = default
        self.op = op
        self.init_tree(op)

    def init_tree(self, op) -> None:
        tree = self.tree
        for i in range(self.elem_size - 1, 0, -1):
            left, right = tree[i << 1], tree[(i << 1) + 1]
            # ===== change me =====
            tree[i] = op(left, right)

    def get_value(self, x: int, y: int):
        op = self.op
        l, r = x + self.elem_size, y + self.elem_size
        tree, result = self.tree, self.default
        while l < r:
            if l & 1:
                # ===== change me =====
                result = op(tree[l], result)
                l += 1
            if r & 1:
                r -= 1
                # ===== change me =====
                result = op(tree[r], result)
            l, r = l >> 1, r >> 1

        return result

    def set_value(self, i: int, value: int, op: str = "="):
        tree = self.tree
        k = self.elem_size + i
        if op == "=":
            tree[k] = value
        elif op == "+":
            tree[k] += value
        elif op == "?":
            # ===== change me =====
            tree[k] = value if value < tree[k] else tree[k]

        while k > 1:
            k >>= 1
            left, right = tree[k << 1], tree[(k << 1) + 1]
            # ===== change me =====
            tree[k] = self.op(left, right)

import sys
n, q = map(int, input().split())
tree = SegmentTree([2**31-1]*n, 2**31-1, min)
ans = []
append = ans.append
for com, x, y in (map(int, l.split()) for l in sys.stdin.readlines()):
    if com == 0:
        tree.set_value(x, y)
    else:
        append(tree.get_value(x, y+1))
print(*ans, sep="\n")


Measured memory_bytes: 16364
#include<stdio.h>

#define GRAY 2
#define N 101

int color[N],d[N],f[N],e[N],count,A[N][N],v[N],B[N][N];

void DFE_Visit(int);
void DFS(int);

int main() {
    int i,j,n,v1;
    
    scanf("%d",&n);
    
    for(i=1; i<=n; i++) {
        scanf("%d%d",&v[i],&e[i]);
        for(j=1; j<=e[i]; j++) {
            scanf("%d",&v1);
            B[i][j] = v1;
            A[i][v1] = 1;
        }
    }
    
    DFS(n);
    
    return 0;
}


void DFS(int n) {
    int i,u;
    
    for(i=1; i<=n; i++){
        u = v[i];
        color[u] = 0;
    }
    
    count = 0;
    
    for(i=1; i<=n; i++){
        u = v[i];
        if(color[u]==0) DFE_Visit(u);
        printf("%d %d %d\n",u,d[u],f[u]);
    }
}


void DFE_Visit(int u) {
    int i,v;
    
    color[u] = GRAY;
    d[u] = ++count;
    
    for(i=1; i<=e[u]; i++) {
        v = B[u][i];
        if(color[v]==0) DFE_Visit(v);
    }
    
    color[u] = 1;
    f[u] = ++count;
}

Measured memory_bytes: 676
#include <iostream>
#include <string>
#include <bits/stdc++.h>
#include <map>
#include <cmath>


using namespace std;

int main(int argc, char const *argv[])
{
        ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int N;
    cin>>N;
    cout <<  ceil(N/2.) << endl;


    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())//vectorの降順ソート
#define ll long long
#define pb(a) push_back(a)
#define INF 1000000000
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

typedef vector<unsigned int>vec;
typedef vector<vec> mat;
//typedef tuple<ll, ll, ll> T;

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


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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N,C,K;
    cin>>N>>C>>K;
    vector<ll> T(N);
    REP(i,N) cin>>T[i];
    VSORT(T);
    ll cur=0;
    ll ans=0;
    ll cnt=0;
    REP(i,N){
        if(i==0){
            cur=T[i];
            cnt++;
            continue;
        }
        if(T[i]-cur<=K && cnt<C){
            cnt++;
            continue;
        }
        else{
            cur=T[i];
            cnt=1;
            ans++;
            //cout<<cur<<endl;
        }
    }
    if(cnt<=C) ans++;
    cout<<ans<<endl;
}


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

for i in range(0, 26):
        if 4 * i > N:
                break
        for j in range(0, 16):
                if 4 * i + 7 * j > N:
                        break
                if 4 * i + 7 * j == N:
                        print("Yes")
                        exit()
print("No")

Measured memory_bytes: 38256
#include <iostream>
#include <algorithm>
#include <math.h>
#include <vector>
#include <set>
#include <queue>

using namespace std;
typedef long long ll;
#define MOD 1000000007

int main() {
    string S, T;

    cin >> S >> T;

    int cnt = 0;

    for(int i=0; i<3; i++) {
        if(S[i] == T[i]) cnt++;
    }

    cout << cnt << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
int main(){
  long n;
  std::cin >> n;
  long t = (long)std::sqrt((double)n);

  for (;t>0;t--){
    if (n % t == 0)
      break;
  }
  std::cout << t + (n/t)-2 << std::endl;
  return 0;
}

Measured memory_bytes: 256
N, M = map(int, input().split())
G = [[False] * N for _ in range(N)]
A = []
B = []
C = [False] * N
for _ in range(M):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    A.append(a)
    B.append(b)
    G[a][b] = True
    G[b][a] = True


def dfs(v):
    C[v] = True
    for vv in range(N):
        if G[v][vv] is False:
            continue
        if C[vv] is True:
            continue
        dfs(vv)


def main():
    ans = 0
    for i in range(M):
        G[A[i]][B[i]] = False
        G[B[i]][A[i]] = False
        for j in range(N):
            C[j] = False
        dfs(0)
        G[A[i]][B[i]] = True
        G[B[i]][A[i]] = True
        if all(C) is False:
            ans += 1
            continue
    print(ans)


main()


Measured memory_bytes: 41180
import static java.lang.System.out;
import java.util.Scanner;
import java.util.regex.Pattern;
import java.util.regex.Matcher;

class Main{
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        String[] strs = scan.nextLine().split("");
        Pattern upper = Pattern.compile("[a-z]");
        Pattern lower = Pattern.compile("[A-Z]");
        for(String str : strs) {
            Matcher mUpper = upper.matcher(str);
            Matcher mLower = lower.matcher(str);
            if (mUpper.find()) {
                out.print(str.toUpperCase());
            } else if(mLower.find()) {
                out.print(str.toLowerCase());
            } else {
                out.print(str);                                        
            }
        }
        out.println();
    }
}

Measured memory_bytes: 29588
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
#define pb push_back
#define rsz resize
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
using pi = pair<int,int>;
#define ff first
#define ss second

void setIO(string name = "") { // name is nonempty for USACO file I/O
    ios_base::sync_with_stdio(0); cin.tie(0); // see Fast Input & Output
    freopen((name+".in").c_str(), "r", stdin); // see Input & Output
    freopen((name+".out").c_str(), "w", stdout);
}
// the code that we provide requires everything above this line to compile



int main() {
  	int l, r, d;cin>>l>>r>>d;
  	cout<<r/d - (l-1)/d;
    return 0;
}

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

int main(){
	int a,b,c;
	cin >> a >> b >> c;
	int ans = max(0,c-a+b);
	cout << ans << endl;
    return 0;
}



Measured memory_bytes: 256
fun main(args: Array<String>) {
    val N = readLine()!!.toInt()
    val s = mutableListOf<String>()
    val t = mutableListOf<Int>()

    for (i in 0 until N) {
        val (S, T) = readLine()!!.split(" ")
        s.add(S)
        t.add(T.toInt())
    }

    val X = readLine()!!

    var started = false
    var time = 0
    for (j in 0 until N) {
        if (started) {
            time += t[j]
        } else {
            if (s[j] == X) started = true
        }
    }
    println(time)
}

Measured memory_bytes: 38304
#include <stdio.h>
#include <math.h>
#include <stdbool.h>
typedef long long int lli;
#define rept(x, s, n) for (int x = s; x < n; x++)
int main(void)
{
    int N;
    scanf("%d",&N);
    int count=0;
    rept(i,1,N+1){
        if((int)(log10(i)+1)%2==1){
            count++;
        }
    }
    printf("%d",count);
    return 0;
}

Measured memory_bytes: 384
import itertools
N,M,Q=map(int,input().split())
a=[0]*Q;b=[0]*Q;c=[0]*Q;d=[0]*Q
for i in range(Q):
  a[i],b[i],c[i],d[i]=map(int,input().split())
l=range(1,M+1)

i=0;D=[]
for v in itertools.combinations_with_replacement(l, N):
  D.append(0)
  for j in range(Q):
    if v[b[j]-1]-v[a[j]-1]==c[j]:
      D[i]+=d[j]
  i+=1
print(max(D))


Measured memory_bytes: 12516
package main

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

func main() {
	sc.Split(bufio.ScanWords)
	n, m := nextInt(), nextInt()
	l, r := 1, n
	for i := 0; i < m; i++ {
		l = max(l, nextInt())
		r = min(r, nextInt())
	}
	puts(max(r-l+1, 0))
	wt.Flush()
}

var (
	sc  = bufio.NewScanner(os.Stdin)
	rdr = bufio.NewReaderSize(os.Stdin, 1000000)
	wt  = bufio.NewWriter(os.Stdout)
)

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	i, _ := strconv.Atoi(next())
	return i
}

func nextFloat64() float64 {
	f, _ := strconv.ParseFloat(next(), 64)
	return f
}

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

func nextFloat64s(n int) []float64 {
	slice := make([]float64, n)
	for i := 0; i < n; i++ {
		slice[i] = nextFloat64()
	}
	return slice
}

func nextMega() string {
	buf := make([]byte, 0, 1000000)
	for {
		l, p, _ := rdr.ReadLine()
		buf = append(buf, l...)
		if !p {
			break
		}
	}
	return string(buf)
}

func putf(format string, a ...interface{}) {
	fmt.Fprintf(wt, format, a...)
}

func puts(a ...interface{}) {
	fmt.Fprintln(wt, a...)
}

func max(nums ...int) int {
	ret := nums[0]
	for _, v := range nums {
		if v > ret {
			ret = v
		}
	}
	return ret
}

func min(nums ...int) int {
	ret := nums[0]
	for _, v := range nums {
		if v < ret {
			ret = v
		}
	}
	return ret
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
main(){
    int n,k;
    cin>>n>>k;
    int a[n];
    for(int i=0;i<n;i++) cin>>a[i];
    while(k--){
        int b[n]={0},m=2*n;
        for(int i=0;i<n;i++){
            m=min(m,a[i]);
            b[max(0,i-a[i])]++;
            if(i+a[i]+1<n) b[i+a[i]+1]--;
        }
        if(m>=n) break;
        for(int i=0;i<n-1;i++) b[i+1]+=b[i];
        memcpy(a,b,sizeof(b));
    }
    for(int i=0;i<n;i++) cout<<a[i]<<" ";
}


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

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

  ll amari = n;
  bool is_a = true;
  ll res = 0;

  if (a == 0) {
    cout << 0 << endl;
    return 0;
  } else if (b == 0) {
    cout << n << endl;
    return 0;
  }

  ll s1 = n / (a+b);
  ll s2 = n % (a+b);
  cout << s1*a + min(s2, a) << endl;
  
  

  // while (amari > 0) {
  //   if (is_a) {
  //     res += min(a, amari);
  //     amari -= a;
  //     is_a = false;
  //   } else {
  //     amari -= b;
  //     is_a = true;
  //   }
  // }

  // cout << res << endl;
  return 0;
}


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

#define debug(x) cout << #x << " = " << x << endl;
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define FOR(it, b, e) for (typeof(b) it = (b); it != (e); ++it)
#define MSET(c, v) memset(c, v, sizeof(c))

const int INF = 0x3F3F3F3F; 
const int NEGINF = 0xC0C0C0C0;
const int NULO = -1;
const double EPS = 1e-10;
const ll mod = 1e9 + 7;

inline int cmp(double x, double y = 0) 
{  
  if(fabs(x - y) < EPS)
    return 0;
  return x > y ? 1 : -1;
}

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

const int maxn = 2e5 + 10;
ll fat[maxn], inv[maxn];

ll C(int n, int k)
{
  if(n < k) 
    return 0;
  if(n < 0 || k < 0) 
    return 0;
  return (((fat[n] * inv[k]) % mod) * inv[n - k]) % mod;
}

ll dp[maxn];

int main()
{
  fat[0] = 1;
  inv[0] = 1;
  for(int i = 1; i < maxn; i++)
  {
    fat[i] = (fat[i-1] * i) % mod;
    inv[i] = exp(fat[i], mod - 2);
  }

  ios::sync_with_stdio(0);
  ll n,k;
  cin >> n >> k;

  ll ans = 0;

  for(int i = k; i >= 1 ; i--)
  {
    ll p = (k / i);

    ll val = exp(p, n);
    for(int j = i + i; j <= k; j += i)
    {
      val = (val - dp[j] + mod) % mod;
    }
    dp[i] = val;
    dp[i] %= mod;
    ans = (ans +  (i * dp[i]) % mod) % mod;
  }

  cout << ans << endl;




  return 0;
}

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

#define CEIL(a,b) ((a) / (b) + ((a) % (b) == 0 ? 0 : 1))

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

constexpr int MOD = 1'000'000'007;
constexpr int INF = 1'000'000'001;
constexpr ll LLINF = 4'000'000'000'000'000'001;
// constexpr int INF = 2147483647; // 2 * 1e9
// constexpr ll LLINF = 9223372036854775807; // 9 * 1e18

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

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(10);
    int n, k, cnt = 0;
    cin >> n >> k;
    for(int i = 0; i < n; ++i){
        int h;
        cin >> h;
        if(h >= k) ++cnt;
    }
    cout << cnt << "\n";
    return 0;
}

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

ll n;
lvector v{3,5,7};

ll dfs(ll a) {
  if(a>n) return 0;
  ll ret=0;
  string s=to_string(a);
  if(  find(s.begin(),s.end(),'3')!=s.end()
     &&find(s.begin(),s.end(),'5')!=s.end()
     &&find(s.begin(),s.end(),'7')!=s.end()) ret++;
  for(ll i:v) ret+=dfs(a*10+i);
  return ret;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin>>n;
  ll ans=dfs(0);
  print(ans);
  return 0;
}

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

using namespace std;

int N;
vector<pair<int, int>> A;
int x[101010];

int main() {
  cin >> N;
  A.assign(N + 1, pair<int, int>());
  int a;
  A[0] = make_pair(0, 0);
  for (int i = 1; i <= N; i++) {
    cin >> a;
    A[i] = make_pair(a, i);
  }
  sort(A.begin(), A.end());

  int res = 0;
  for (int i = 2; i <= N; i += 2) {
    if (A[i].second % 2) res++;
  }

  cout << res << endl;

  return 0;
}

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

const int N = 202020;
const int MOD = 1000000007;
typedef long long ll;
typedef tuple<int, int, int> Tuples;

inline char get(void) {
	static char buf[100000], *S = buf, *T = buf;
	if (S == T) {
		T = (S = buf) + fread(buf, 1, 100000, stdin);
		if (S == T) return EOF;
	}
	return *S++;
}
template<typename T>
inline void read(T &x) {
	static char c; x = 0; int sgn = 0;
	for (c = get(); c < '0' || c > '9'; c = get()) if (c == '-') sgn = 1;
	for (; c >= '0' && c <= '9'; c = get()) x = x * 10 + c - '0';
	if (sgn) x = -x;
}

int fa[N];
struct edge {
	int to, next;
	edge (int t = 0, int n = 0):to(t), next(n) {}
};
edge G[N << 1];
int head[N], dep[N], d[N], dnm[N];
int pw2[N];
deque<Tuples> dp[N];
deque<Tuples> blank;
int Gcnt, n, mxd, ans;

inline void AddEdge(int from, int to) {
	G[++Gcnt] = edge(to, head[from]); head[from] = Gcnt;
}
inline void Add(int &x, int a) {
	x = (x + a) % MOD;
}
inline void Debug(Tuples x) {
	int a, b, c; tie(a, b, c) = x;
	cout << a << ' ' << b << ' ' << c << endl;
}
inline Tuples Calc(Tuples f, Tuples g) {
	int s = ((ll)get<0>(f) + get<1>(f) + get<2>(f)) % MOD * ((ll)get<0>(g) + get<1>(g) + get<2>(g)) % MOD;
	int x = (ll)get<0>(f) * get<0>(g) % MOD,
		y = ((ll)get<0>(f) * get<1>(g) + (ll)get<1>(f) * get<0>(g)) % MOD;
	return Tuples(x, y, ((ll)s - x - y + MOD + MOD) % MOD);
}
inline void dfs(int u, int d) {
	mxd = max(mxd, d); ++dnm[d];
	int len = 0, to, sz;
	for (int i = head[u]; i; i = G[i].next) {
		to = G[i].to; dfs(to, d + 1);
		sz = dp[to].size();
		sz = dp[u].size();
		if (dp[u].size() < dp[to].size()) swap(dp[u], dp[to]);
		len = max(len, sz = dp[to].size());
		for (int j = 0; j < sz; j++)
			dp[u][j] = Calc(dp[u][j], dp[to][j]);
		dp[to] = blank;
	}
	dp[u].push_front(Tuples(1, 1, 0));
	for (int i = 0; i <= len; i++) {
		dp[u][i] = Tuples((get<0>(dp[u][i]) + get<2>(dp[u][i])) % MOD, get<1>(dp[u][i]), 0);
	}
}

int main(void) {
	read(n); pw2[0] = 1;
	for (int i = 1; i <= n + 1; i++) Add(pw2[i], pw2[i - 1] + pw2[i - 1]);
	for (int i = 1; i <= n; i++) {
		read(fa[i]); AddEdge(fa[i], i);
	}
	dfs(0, 0);
	for (int i = 0; i <= mxd; i++)
		Add(ans, (ll)get<1>(dp[0][i]) * pw2[n - dnm[i] + 1] % MOD);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 177664
# パナソニック2020D
import sys
write = lambda x: sys.stdout.write(x+"\n")
from queue import deque
n = int(input())
q = deque([("a", "a")])
while True:
    s, m = q.pop()
    if len(s)==n:
        write(s)
    elif len(s)>=n+1:
        break
    for o in range(ord("a"), ord(m)+2):
        if ord(m)<o:
            m = chr(o)
        q.appendleft((s + chr(o), m))

Measured memory_bytes: 155736
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1e18;
const ll mod = 1000000007;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
template<class T> inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template<class T> inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
int ctoi(char c) {
  if (c >= '0' && c <= '9') {
    return c - '0';
  }
  return 0;
}
ll factorial(ll n) {
  if (n == 1) {
    return 1;
  }
  ll ans = factorial(n-1);
  return ans*n;
}
ll gcd(ll a, ll b) {
  if (a < b) {
    ll tmp = a;
    a = b;
    b = tmp;
  }
  ll r = a%b;
  while(r != 0) {
    a = b;
    b = r;
    r = a%b;
  }
  return b;
}
ll lcm(ll a, ll b) {
  return (a/gcd(a, b))*b;
}

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

Measured memory_bytes: 256
open System
open System.Collections.Generic

module InputUtility =
    let InputTokens = new Queue<string>()

    let EnsureInput () =
        if InputTokens.Count = 0 then
            let input = Console.ReadLine ()
            let s = input.Split ([|' '|], StringSplitOptions.RemoveEmptyEntries)
            if s.Length > 0 then
                for x in s do InputTokens.Enqueue(x)
                true
            else false
        else true

    let rec ReadNext () =
        if EnsureInput () then InputTokens.Dequeue ()
        else ReadNext ()

    let ReadNextInt () = ReadNext () |> int

    let Read2Int () = ReadNextInt (), ReadNextInt ()

    let Read3Int () = ReadNextInt (), ReadNextInt (), ReadNextInt ()

    let ReadListOf f n =
        let rec loop acc = function
            | 0 -> List.rev acc
            | c -> loop ((ReadNext () |> f) :: acc) (c-1)
        loop [] n

    let MultipleCaseWithId f =
        let caseNum = ReadNextInt ()
        let rec loop index =
            if index = caseNum then ()
            else
                f index
                loop (index + 1)
        loop 0

    let MultipleCase f = MultipleCaseWithId (fun _ -> f ())

    let ReadList n =
        let rec loop acc = function
            | 0 -> List.rev acc
            | c -> loop (ReadNext () :: acc) (c-1)
        loop [] n

open InputUtility

module _2017QualA =
    let private toBoolStr b = if b then "Yes" else "No"

    let private allPairs s1 s2 = seq { for a in s1 do for b in s2 do yield (a, b) }

    let private PalindromicMatrix () =
        let n, m = Read2Int ()
        let mp =
            let a = Array.zeroCreate 26
            for _ in [1..n] do
                let s = ReadNext ()
                for c in s do
                    let d = (int)c - (int)'a'
                    a.[d] <- a.[d] + 1
            a
        let r1 = (n % 2) * (m % 2)
        let r2 = ((n % 2) * m + (m % 2) * n) / 2 - r1
        let r4 = (n * m - r1 - r2 * 2) / 4
        let s1 = Seq.sumBy (fun d -> d % 2) mp
        let s4 = Seq.sumBy (fun d -> d / 4) mp
        //printfn "mp : %A" mp
        //printfn "%d %d %d | %d %d" r4 r2 r1 s4 s1
        toBoolStr (s1 = r1 && s4 >= r4) |> printfn "%s"

    let Entry = PalindromicMatrix

_2017QualA.Entry ()

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

#define REP(i,num) for(int i=0;i<(num);++i)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto& x:c){cout<<x<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int Q=in();
	set<int> S;
	REP(i,Q){
		int q=in();
		if(q==1){
			out(S.find(in())==S.end()?0:1);
		}
		else if(q==2){
			S.erase(in());
		}
		else if(q==3){
			int L=in(),R=in();
			auto start = S.lower_bound(L);
			auto end = S.upper_bound(R);
			while(start!=end){
				out(*start);
				++start;
			}
		}
		else{
			S.insert(in());
			out(S.size());
		}
	}
	return 0;
}


Measured memory_bytes: 12456
n=int(input())
a=[int(i) for i in input().split()]
x=a[0]
y=sum(a[1:])
min=abs(x-y)
for i in range(1,n-1):
    x+=a[i]
    y-=a[i]
    if(abs(x-y)<min):
        min=abs(x-y)
print(min)

Measured memory_bytes: 24828
#include <bits/stdc++.h>
using namespace std;
int main() {
	
  int k,ans=1; cin>>k;
  if (k%7==0){k/=7;}
  if(__gcd(10,k)!=1){
  	return cout<<-1<<endl, 0;
  }
  
  long long v = 1 % k;
  while (v!=0) {
    v=(10*v+1)% k;
    ans++;
}
  return cout<<ans<<endl, 0;
}

Measured memory_bytes: 3636
def main():
    N = int(input())
    A = list(map(int, input().split()))
    start_len = sum(A)
    mokuteki = start_len/2
    temp = 0
    for n in range(N):
        temp += A[n]
        if(temp >= mokuteki):
            break
    n1 = n-1
    kouho1 = temp - A[n]
    n2 = n
    kouho2 = temp
    kouho1_ = start_len - kouho1*2
    kouho2_ = kouho2*2 - start_len
    res = min(kouho1_, kouho2_)
    print(res)
            

if __name__ == "__main__":
    main()


Measured memory_bytes: 26220
#include <vector>
#include <array>
#include <algorithm>
#include <iostream>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <map>
#include <math.h>
#include <assert.h>
#include <queue>
#include <deque>
#include <iomanip>
#include <numeric>
#include <fstream>

using namespace std;

typedef long long ll;
typedef long double ld;

#define fi first
#define se second

#define mp make_pair
#define pb push_back
#define sz(x) ((int)(x).size())

typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<ld> vld;
typedef vector<vector<int>> vvi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<ld>> vvd;
typedef vector<string> vs;
typedef vector<bool> vb;

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


int main() {
    cout << setprecision(30);
    ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);

    ll a, b, c;
    cin >> a >> b >> c;
    cout << (c - min(a - b, c)) << endl;

    return 0;
}


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


int main(){
	
	int n,m;
	cin >> n >> m;
	int a[n][m],b[m],c[n];
	
	for(int i = 0;i < n;i++)c[i] = 0;
	for(int i = 0;i < n;i++){
		for(int j = 0;j < m;j++){
			cin >> a[i][j];
		}
	}
	for(int i = 0;i < m;i++){
		cin >> b[i];
	}
	
	for(int i = 0;i < n;i++){
		for(int j = 0;j < m;j++){
			c[i] += a[i][j] * b[j];
		}
	}
	
	for(int i = 0;i < n;i++){
		cout << c[i] << endl;;
	}
	
	return 0;
}

Measured memory_bytes: 3108
#include<iostream>
#include<cctype>
#include<cstring>
using namespace std;

int main(){
  char counter[27]="abcdefghijklmnopqrstuvwxyz";
  string str;
  int num,dat[26],i,x;

  for ( i =0 ; i< 26 ; i++){
    dat[i] = 0;
  }
  while( cin >> str ){
    x = str.size();
    for ( i = 0 ; i < x ; i++){
      if ( isupper(str[i])){
	str[i] = tolower(str[i]);
      }
    int num = str[i] -'a';
    dat[num]++;
    }
  }

  for ( i = 0 ; i < 26 ; i++){
    cout << counter[i] << " : " <<dat[i]<<endl;
  }
  return 0;
}

Measured memory_bytes: 1184
n = int(input())
a = list(map(int, input().split()))
i = 0
j = 1
b = list(range(2))
c = []
while i < n:
    b[0] = a[i]
    b[1] = j
    b.sort()
    c.append(''.join(str(b)))
    i += 1
    j += 1
l = len(set(c))
print(str(n - l))


Measured memory_bytes: 21408
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
using namespace std;
typedef long long int ll;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}


int main() {
    int n,m;
    cin >> n >> m;
    int x[10] = {0,2,5,5,4,5,6,3,7,6};
    int f[10] = {};
    int dp[n+100][10];
    int sum[n+100] = {};
    rep(i,n+100){rep(j,10){dp[i][j]=0;}}
    rep(i,m){
        int a; cin >> a;
        f[a] = 1;
    }

    if(f[6]+f[9]==2)f[6] = 0;
    if(f[2]+f[3]==2)f[2] = 0;
    if(f[3]+f[5]==2)f[3] = 0;
    if(f[2]+f[5]==2)f[2] = 0;

    srep(i,1,n+1){
        srep(j,1,10){
            if(f[j]==0)continue;
            if(i<x[j])continue;
            if(x[j] == i){
                if(sum[i] == 0){
                    dp[i][j] = 1;
                    sum[i] = 1;
                }else if(sum[i] == 1){
                    rep(k,10){
                        if(dp[i][k]==1){
                            if(k<j){
                                dp[i][k] = 0;
                                dp[i][j] = 1;
                            }
                        }
                    }
                }
            }else{
                if(sum[i-x[j]]==0)continue;
                if(sum[i]<=sum[i-x[j]]){
                    sum[i] = sum[i-x[j]] + 1;
                    rep(k,10){
                        dp[i][k] = dp[i-x[j]][k];
                    }
                    dp[i][j]++;
                }else if(sum[i] == sum[i-x[j]] + 1){
                    int tmp[10];
                    rep(k,10){
                        tmp[k] = dp[i-x[j]][k];
                    }
                    tmp[j]++;
                    int flag = 0;
                    drep(k,10){
                        if(dp[i][k]<tmp[k]){
                            flag = 1;
                            break;
                        }
                        if(dp[i][k]>tmp[k]){
                            break;
                        }
                    }
                    if(flag==1){
                        rep(k,10){
                            dp[i][k] = tmp[k];
                        }
                    }
                }
            }
        }
    }

    drep(i,10){
        rep(j,dp[n][i]){
            cout << i;
        }
    }
    cout << endl;

    return 0;
}
 
 


Measured memory_bytes: 640
class ModCombination
  attr_reader :fac, :inv, :finv, :mod

  MOD = 10 ** 9 + 7

  def initialize(n, mod: MOD)
    @mod = mod
    @fac = [1, 1]
    @inv = [1, 1]
    @finv = [1, 1]

    (2..n).each do |i|
      @fac[i] = fac[i - 1] * i % mod
      @inv[i] = mod - inv[mod % i] * (mod / i) % mod
      @finv[i] = finv[i - 1] * inv[i] % mod
    end
  end

  def combination(n, k)
    return 0 if n < k
    return 0 if n < 0 || k < 0

    fac[n] * (finv[k] * finv[n - k] % mod) % mod
  end

  def repeated_combination(n, k)
    combination(n + k - 1, k)
  end
end

MOD = 10 ** 9 + 7
R1, C1, R2, C2 = gets.split.map(&:to_i)

MC = ModCombination.new((2 * 10 ** 6) + 10)

def sum(n, k)
  k, n = [n, k].minmax
  n += k
  MC.combination(n + 2, k + 1) - 1
end

r0, c0 = R1 - 1, C1 - 1
r1, c1 = R1 - 1, C2
r2, c2 = R2, C1 - 1
r3, c3 = R2, C2

puts (sum(r3, c3) - sum(r2, c2) - sum(r1, c1) + sum(r0, c0)) % MOD


Measured memory_bytes: 50816
#include<cmath>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
int A,B,C;
int main(){
	cin>>A>>B>>C;
	int ans=0;
	while (1){
		if ((A&1)||(B&1)||(C&1)) break;
		if (A==B&&B==C){puts("-1");return 0;}
		ans++;
		int na=(B+C)/2,nb=(A+C)/2,nc=(A+B)/2;
		A=na,B=nb,C=nc;
	}
	printf("%d\n",ans);
	return 0;
}

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

string rep(string s,int a,int b,string p);
string rev(string s,int a,int b);
void pri(string s,int a,int b);

int main(){
        string code,k,p;
        int n,a,b;
        string haki;
        getline(cin,code);
        cin >> n;
        getline(cin, haki);
        for(int i = 0; i < n; i++){
                cin >> k;
                if(k == "replace"){
                        cin >> a >> b >> p;
                        code = rep(code ,a,b,p);
                }else if(k == "reverse"){
                        cin >> a >> b;
                        code =rev(code , a,b);
                }else if(k == "print"){
                        cin >> a >> b;
                        pri(code, a,b);
                }
                getline(cin,haki);
        }
}

string rep(string s,int a, int b, string p){
        for(int i = a; i <=b; i++){
                s[i] = p[i-a];
        }
        return s;
}string rev(string s, int a, int b){
        string p = s;
        for(int i = a; i <= b; i++){
                s[i] = p[b-i+a];
        }
        return s;
}
void pri(string s, int a, int b){
        for(int i = a; i <= b;i++){
                cout <<s[i];
        }
        cout << endl;
}


Measured memory_bytes: 3220
#include<bits/stdc++.h>
#define maxn 100005
#define ll long long
using namespace std;
inline ll read(){
	ll x=0,c;while(!isdigit(c=getchar()));
	while(x=x*10+c-'0',isdigit(c=getchar()));
	return x;
}
//char a[maxn],b[maxn],c[maxn];
int n,a[maxn],b[maxn],c[maxn],vis[maxn],id[maxn];
inline bool cmp(int x,int y){return c[x]>c[y];}
int main(){
	n=read();
	for(int i=1;i<=n;i++)a[i]=read(),b[i]=read(),c[i]=a[i]+b[i],id[i]=i;
	sort(id+1,id+n+1,cmp);ll ans=0;
	for(int i=1;i<=n;i++)
		if(i&1)ans+=a[id[i]];else ans-=b[id[i]];
	printf("%lld\n",ans);return 0;
}

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

int main() {
    int n,k,q; cin >> n >> k >> q;
    int sankas[100000];
    rep(i,n) sankas[i] = k;
    rep(i,q) {
        int a; cin >> a;
        sankas[a-1] ++;
    }
    rep(i,n) {
        if (sankas[i] - q > 0) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
}

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

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	int n, m; cin >> n >> m;
	vector<vector<int>> adj(n);
	vector<pair<int, int>> T(n - 1);
	vector<pair<int, int>> B(m - n + 1);
	int state = 0;
	function<bool(int, int, int)> dfs = [&](int u, int p, int x) {
		if (u == x) {
			return true;
		}
		for (int e : adj[u]) {
			int v = T[e].first ^ T[e].second ^ u;
			if (v == p) {
				continue;
			}
			if (dfs(v, u, x)) {
				state |= 1 << e;
				return true;
			}
		}
		return false;
	};
	vector<int> cnt(1 << (n - 1), 0);
	for (int i = 0; i < m; i++) {
		int u, v; cin >> u >> v;
		u--, v--;
		if (i < n - 1) {
			adj[u].push_back(i);
			adj[v].push_back(i);
			T[i] = {u, v};
		} else {
			state = 0;
			assert(dfs(u, -1, v));
			cnt[state]++;
		}
	}
	for (int j = 0; j < n; j++) {
		for (int i = 0; i < 1 << (n - 1); i++) {
			if (i >> j & 1) {
				cnt[i] += cnt[i - (1 << j)];
			}
		}
	}
	reverse(cnt.begin(), cnt.end());
	vector<int> dp(1 << (n - 1));
	vector<int> sum(1 << (n - 1));
	dp[0] = 1, sum[0] = 0;
	const int P = 1e9 + 7;
	vector<vector<int>> prod(m + 2, vector<int>(m + 1, 1));
	for (int i = 0; i <= m; i++) {
		for (int j = 0; j <= m; j++) {
			prod[i][j] = j == 0 ? 1 : prod[i][j - 1] * 1LL * (i + j - 1) % P;
		}
	}
	auto add = [&](int &x, int y) {
		x = (x + y) % P;
	};
	for (int i = 0; i < 1 << (n - 1); i++) {
		for (int j = 0; j < n - 1; j++) {
			if (i >> j & 1) {
				continue;
			}
			int prev = m - n + 1 - cnt[i] + __builtin_popcount(i);
			int added = cnt[i] - cnt[i | (1 << j)];
			add(dp[i | (1 << j)], dp[i] * 1LL * prod[prev + 1][added] % P);
			add(sum[i | (1 << j)], (sum[i] * 1LL * prod[prev + 2][added] + dp[i] * 1LL * prod[prev + 1][added] % P * (__builtin_popcount(i) + 1)) % P);
		}
	}
	cout << sum[(1 << (n - 1)) - 1] << endl;
	return 0;
}

Measured memory_bytes: 6528
import java.io.*;
import java.util.*;
//import java.util.stream.*;
//import java.math.*;

public class Main {

    public static void main(String[] args) throws IOException {

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
        Scanner sc = new Scanner(System.in);
        int a, x, y, w, h, n, min_x, max_x, min_y, max_y;
        w = sc.nextInt();
        h = sc.nextInt();
        n = sc.nextInt();
        min_x = 0;
        max_x = w;
        min_y = 0;
        max_y = h;
        for (int i = 0; i < n; i++) {
            x = sc.nextInt();
            y = sc.nextInt();
            a = sc.nextInt();
            if (a == 1) {
                min_x = Math.max(min_x, x);
            } else if (a == 2) {
                max_x = Math.min(max_x, x);
            } else if (a == 3) {
                min_y = Math.max(min_y, y);
            } else {
                max_y = Math.min(max_y, y);
            }
        }
        System.out.println(Math.max(0, max_x - min_x) * Math.max(0, max_y - min_y));
        bw.flush();
    }
}


Measured memory_bytes: 22100
#include<bits/stdc++.h>
using namespace std;
const int N=200010;
const int inf=0x3f3f3f3f;
int H, W, n;
int x[N], y[N];
vector <int> v[N],s[N];
int p[N],q[N];
int main(){
	scanf("%d%d%d",&H,&W,&n);
	for(int i=1; i<=n; ++i)scanf("%d%d",&x[i],&y[i]);
	for(int i=1; i<=n; ++i)v[x[i]].push_back(y[i]),s[y[i]].push_back(x[i]);
	for(int i=1; i<=H; ++i)sort(v[i].begin(),v[i].end());
	for(int i=1; i<=W; ++i)sort(s[i].begin(),s[i].end());
	p[1]=1;
	for(int i=1; i<H; ++i){
		v[i+1].push_back(W+1);
		int d=lower_bound(v[i+1].begin(),v[i+1].end(),p[i]+1)-v[i+1].begin();
		p[i+1]=(v[i+1][d]==p[i]+1?p[i]:p[i]+1);
	}
	int ans=inf;
	memset(q,0x3f,sizeof(q));
	for(int i=1; i<=H; ++i)q[p[i]]=min(q[p[i]],i);
	for(int i=1; i<=W; ++i)
		if(q[i]<inf){
			s[i].push_back(H+1);
			int d=lower_bound(s[i].begin(),s[i].end(),q[i])-s[i].begin();
			if(s[i][d]>q[i])ans=min(ans, s[i][d]-1);
			else{
				while(d<s[i].size()-1&&s[i][d+1]==s[i][d]+1)++d;
				if(d!=s[i].size()-1)ans=min(ans, s[i][d+1]-1);
			}
		}
	printf("%d", ans);
	return 0;
}

Measured memory_bytes: 25088
from collections import Counter
MOD = 998244353
n = int(input())
d = list(map(int, input().split()))

if d[0] != 0 or min(d[1:]) == 0:
	print(0)
else:
	ans = 1
	c = Counter(d)
	for k, v in c.items():
		if k == 0:
			continue
		ans *= pow(c[k-1], v, MOD)
		ans %= MOD
	print(ans)

Measured memory_bytes: 19936
//@source : 
//@create : 23:26:34 Monday 29/06/2020
//@author : nghethuat102
//@status : 
#include <bits/stdc++.h>
using namespace std;

char solve() {
    char s;
    cin >> s;
    if ('a' <= s && s <= 'z') {
        return 'a';
    }
    return 'A';
}

int main() {
    ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    int t = 1;
    while (t--) {
        cout << solve() << "\n";
    }
  //  cerr << fixed << setprecision(5) << double(clock()) * 1000 / CLOCKS_PER_SEC << " ms\n";
    return 0;
}

Measured memory_bytes: 3568
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include <cctype>
#include<math.h>
#include <iomanip>  
using namespace std;
int main() {
	char c;
	cin >> c;
	c = c + 1;
	cout << c << endl;
	//cin >> c;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,c;
    cin>>a>>b>>c;
    if(a==b &&a!=c)
    {
        cout<<"Yes"<<endl;
    }
    else if(a==c && a!=b)
    {
        cout<<"Yes"<<endl;
    }
    else if(b==c && b!=a)
    {
        cout<<"Yes"<<endl;
    }
    else
    {
        cout<<"No"<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

int main() {
	int n;
	cin >> n;
	VI a(n);
	REP(i,n){
		cin >> a[i];
		a[i]--;
	}
	int ans = 0, x = 0;
	VI f(n);
	while (x != 1){
		if (f[x]){
			cout << -1 << endl;
			return 0;
		}
		f[x] = 1;
		x = a[x];
		ans++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<deque>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<iterator>
#include<complex>
#include<stack>
#include "stdio.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)

using ll = long long;
using Pii = pair<int, int>;

const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const long long mod_const = 1e9+7;

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

using MIte = multimap<ll, ll, greater<ll> >::iterator;


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

	// long long?
	ll N;
	cin >> N;

	map<int, int> m;

	rep(i, N) {
		int A = 0;
		cin >> A;
		m.insert(make_pair(A, i+1));
	}

	for (map<int, int>::iterator it = m.begin(); it != m.end(); ++it) {
		cout << it->second << " ";
	}

	cout << endl;

	return 0;
}

Measured memory_bytes: 5632
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<math.h>
#include<bits/stdc++.h>
#include<stack>
#include<queue>
#include<list>
#include<vector>
#include<bitset> 
#include<unordered_map> 
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
// #include "boost/algorithm/string.hpp"
// RAJJI KI MEHER 
#define fio ios_base::sync_with_stdio(false)
//#define mod 1000000007
#define mod1 mod
#define mod2 100000009
#define li long long int
#define ll int
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define readi(x) scanf("%d",&x)
#define  reads(x)  scanf("%s", x)
#define readl(x) scanf("%lld",&x)
#define rep(i,n) for(i=0;i<n;i++)
#define revp(i,n) for(i=(n-1);i>=0;i--)
#define myrep1(i,a,b) for(i=a;i<=b;i++)
#define myrep2(i,a,b) for(i=b;i>=a;i--)
#define pb push_back
#define mp make_pair
#define fi first
#define sec second
#define MAXN 100000000000000005
#define MINN -10000000000000000
#define INTMAX 1000001000
#define pii pair<li,li>
#define pdd pair<double,double>
#define pic pair<int,char>
//#define N 5005
#define lgn 20
#define ddouble long double
#define minus minu
#define PI 3.1415926535
#define lgn 20
using namespace std;vector<li>A(3005);vector<li>B(3005);
vector<li>f(200005);vector<li>rf(100005);li mod=1000000007;
li pp(li a,li b){li z=1,ans=1;if(a==0){z=0;return(z);}
if(b==0) return(z);
ans=ans*pp(a,b/2);
ans=(ans*ans)%mod;
if(b%2==1) ans=(ans*a)%mod;
return(ans);}
li ff(li i,li j){if(i<0 || j<0) return(0);
    li ans=(((f[i+j]*rf[i])%mod)*rf[j])%mod;return(ans);
}
int main(){
    li h,w,i,j,n,x;readl(h);readl(w);readl(n);
f[0]=1;rf[0]=1;for(i=1;i<=200000;i++){f[i]=(f[i-1]*i)%mod;
if(i<=100000) rf[i]=pp(f[i],mod-2);}    
vector<vector<li>>v(n,vector<li>(3));    
for(i=0;i<n;i++){readl(v[i][1]);readl(v[i][2]);v[i][0]=(v[i][1]+v[i][2]-2);}
sort(v.begin(),v.end());
for(i=0;i<n;i++){
    if(i==0){A[i]=ff(v[i][1]-1,v[i][2]-1);B[i]=ff(h-v[i][1],w-v[i][2]);}
    else{A[i]=ff(v[i][1]-1,v[i][2]-1);B[i]=ff(h-v[i][1],w-v[i][2]);x=0;
for(j=0;j<i;j++){x=(x+(A[j]*(ff(v[i][1]-v[j][1],v[i][2]-v[j][2])))%mod)%mod;}
A[i]=(A[i]-x+mod)%mod;}}
li ans=ff(h-1,w-1);x=0;
for(i=0;i<n;i++){x=(x+(A[i]*B[i])%mod)%mod;}
ans=(ans-x+mod)%mod;cout<<ans;
}

Measured memory_bytes: 2816
#include <bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
using namespace std;
const ll mod=1e9+7;
const ll inf = (ll)1e17;
const ld eps = 1e-12;
const ld PI = 3.14159265358979323846;
ll mul(ll a, ll b, ll m = mod) { return (ll)(a * b) % m;}
ll add(ll a, ll b, ll m = mod) { a += b; if(a >= m) a -= m; if(a < 0) a += m; return a;}
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll a,n;
    cin>>a>>n;
    vector<ll>v(n);
    for(int i=0;i<n;i++){
        cin>>v[i];
    }
    sort(v.begin(),v.end());
    for(int i=0;i<n;i++){
        a-=v[i];
    }
    if(a<=0)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
    }


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define ll long long int
#define MOD 1000000007
#define INF 1e18

using namespace std;

int main(void){
  ll n, x, y;
  cin >> n >> x >> y;
  x--; y--;
  
  ll dist[n][n];
  for (ll i = 0; i < n; i++){
    for (ll j = i + 1; j < n; j++){
      if (i <= x && j <= x)
        dist[i][j] = j - i;
      else if (i <= x && j <= y)
        dist[i][j] = min(j - i, x - i + 1 + y - j);
      else if (i <= x)
        dist[i][j] = x - i + 1 + j - y;
      else if (i <= y && j <= y)
        dist[i][j] = min(j - i, i - x + 1 + y - j);
      else if (i <= y)
        dist[i][j] = min(j - i, i - x + 1 + j - y);
      else
        dist[i][j] = j - i;
    }
  }


  ll res[n] = {};
  for (int i = 0; i < n; i++){
    for (int j = i + 1; j < n; j++){
      res[dist[i][j]]++;
    }
  }

  for (int i = 1; i < n; i++){
    cout << res[i] << endl;
  }

  return 0;
}


Measured memory_bytes: 31232
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String[] str = sc.next().split("");
        boolean flg = true;
        int count = 0;
        String[] akiba = { "A", "K", "I", "H", "A", "B", "A", "R", "A" };
        int i = 0;
        for (; i < akiba.length; i++) {
            if (count < str.length) {
                if (akiba[i].equals(str[count])) {
                    count++;
                } else if (akiba[i].equals("A") && i != 8) {
                } else {
                    flg = false;
                    break;
                }
            } else if (i == 8) {
                break;
            } else {
                flg = false;
                break;
            }
        }

        if (i < str.length)

        {
            flg = false;
        }
        System.out.println(flg ? "YES" : "NO");
    }

}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
#define fastIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
    enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
    ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
    *this << "[";
    for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
    ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
typedef long long ll;

void solve()
{
	int n;
	cin>>n;
	vector<int> a(n);
	int x = 0;
	for (int i=0; i<n; i++) {
		cin>>a[i];
		x ^= a[i];
	}
	for (int i=0; i<n; i++) {
		cout << (a[i]^x) << " ";
	}
	cout << "\n";
}

int main()
{
	int t=1;
	// cin>>t;
	while (t--) {
		solve();
	}
	return 0;
}

Measured memory_bytes: 4044
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include<algorithm>
#include <iomanip>
#include <math.h>

using namespace std;
typedef long long ll;
///定義場所///
ll i, j, k, l, m, n;
ll N, M, K, H, W;
ll MOD = 1000000007;
ll ans = 0;
//関数リスト//
int ctoi(char c) {
	switch (c) {
	case '0': return 0;
	case '1': return 1;
	case '2': return 2;
	case '3': return 3;
	case '4': return 4;
	case '5': return 5;
	case '6': return 6;
	case '7': return 7;
	case '8': return 8;
	case '9': return 9;
	default: return 0;
	}
}
//(注)pairの型・比較する場所(first/second)は毎回変えて使用する
bool pairCompare(const pair<int ,int> firstElof, pair<int,int> secondElof)
{
	return firstElof.second > secondElof.second;
}
int Keta(ll F) {
	int keta = 1;
	while (F/10 > 0) {
		keta++;
		F /= 10;
	}
	return keta;
}
//////////////
int main() {
	double X, Y;
	cin >> W >> H >> X >> Y;
	double p = 2.000000;
	double S = W * H / p;
	int b = 0;
	if (X==W/p&&Y==H/p) {
		b = 1;
	}
	cout << setprecision(10) << S << endl;
	cout << b;
}

Measured memory_bytes: 256
n=int(input())
l6=[6**i for i in range(7)]
l9=[9**i for i in range(1,6)]
m=l6+l9
m.sort()
inf=float("inf")
dp=[inf]*(10**5+1)
dp[0]=0
dp[1]=1
for i in range(1,n+1):
  for mi in m:
    if i-mi>=0:
      dp[i]=min(dp[i-mi]+1,dp[i])
print(dp[n])


Measured memory_bytes: 9380