akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
#include<algorithm>    
#include<cmath>
#include<map>
#include<vector>
#include<math.h>
#include<stdio.h>
#include<stack>
#include<queue>
#include<tuple>
#include<cassert>
#include<set>
#include<functional>
//#include<bits/stdc++.h>
#define rep(i, x) for(ll i = 0; i < x; i++)
#define rep2(i, x) for(ll i = 1; i <= x; i++)
#define all(a) (a).begin(),(a).end()
using ll = long long;
using ld = long double;
using namespace std;
const ll INF = 1000000000000000000;
const ll mod = 1000000007;
const ld pi = 3.141592653589793238;

/*bool IsPrime(ll num) {
	if (num < 2) return false;
	else if (num == 2) return true;
	else if (num % 2 == 0) return false; // 偶数はあらかじめ除く
	double sqrtNum = sqrt(num);
	for (int i = 3; i <= sqrtNum; i += 2) {
		if (num % i == 0) { // 素数ではない
			return false;
		}
	}
	// 素数である
	return true;
}*/
/*ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (a % b == 0)return b;
	return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}*/
/*ll keta(ll n) {
	ll res = 0;
	while (n >= 1) {
		res += n % 10; n /= 10;
	}
	return res;
}*/
/*ll modpow(ll x, ll y) {
	ll res = 1;
	while (y) {
		if (y % 2) { res *= x; res %= mod; }
		x = x * x % mod; y /= 2;
	}
	return res;
}*/
/*ll nCk(ll n, ll k) {
	ll a = 1, b = 1;
	for (int h = n - k + 1; h <= n; h++) { a *= h; a %= mod; }
	for (int h = 1; h <= k; h++) { b *= h; b %= mod; }
	return a * modpow(b, mod - 2) % mod;
}*/
//printf("%.10f\n", n);

ll te[12345678];
signed main() {
	string s, t;
	ll n, m, a, b, cnt = 0, ans = 0;
	cin >> s;
	rep(i, 3) {
		if (s[i] == 'R') { cnt++; }
		else { ans = max(ans, cnt); cnt = 0; }
	}
	cout << max(ans, cnt) << endl;
	return 0;
}

Measured memory_bytes: 3624
#pragma GCC optimize("Ofast")
#include<stdio.h>
#include<algorithm>
using namespace std;
int a[200005],b[200005];
int main(){
	int i,n;
	scanf("%d",&n);
	for(i=0;i<n;i++)
		scanf("%d%d",&a[i],&b[i]);
	sort(a,a+n);
	sort(b,b+n);
	if(n&1)
		printf("%d\n",b[n/2]-a[n/2]+1);
	else
		printf("%d\n",b[n/2]+b[n/2-1]-a[n/2]-a[n/2-1]+1);
}


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

int main()
{
  int A, B, C, K;
  cin >> A >> B >> C >> K;
  
  bool possible = true;
  
  while(A >= B)
  {
    B *= 2;
    K--;
    if(K < 0)
    {
      possible = false;
      break;
    }
  }
  while(B >= C && K >= 0)
  {
    C *= 2;
    K--;
    if(K < 0)
    {
      possible = false;
      break;
    }
  }
  
  if(possible){cout << "Yes" << endl;}
  else{cout << "No" << endl;}
}

Measured memory_bytes: 3624
#include<cstdio>
const char N_MAX = 105;
short time=0;
bool matrix[N_MAX][N_MAX];
char n;
struct Node{
    char state;//0:undiscovered 1:active 2:end
    short stTime, endTime;
};
Node V[N_MAX];
char next(char num){
    for(char i=0;i<n;i++){
        if(matrix[num][i]&&V[i].state==0){
            return i;
        }
    }
    return -1;
}
void dfs(char num){
    if(num==-1) return;
    V[num].stTime = ++time;
    V[num].state = 1;
    for(char i=next(num); i!=-1;i=next(num)){
        dfs(i);
    }
    V[num].state = 2;
    V[num].endTime = ++time;
}
void buildMatrix(){
	for(char i=0; i<n;i++){
		int degree, index;
		scanf("%u%u", &index, &degree);
		for(char j=0; j<degree; j++){
			int temp;
			scanf("%d", &temp);
			matrix[index-1][temp-1] = true;
		}
	}
}
int main(){
    scanf("%d", &n);
    buildMatrix();
    for(char i=0; i<N_MAX; i++){
        if(V[i].state==0){
            dfs(i);
        }
    }
    for(char i=0;i<n;i++){
        printf("%d %d %d\n", i+1, V[i].stTime, V[i].endTime);
    }
    return 0;
}



Measured memory_bytes: 2692
#include <iostream>
#include <cmath>

const long long MAX_X = std::pow(10, 6);
long long X;

bool IsPrime(int num) {
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false;

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2) {
        if (num % i == 0) {
            return false;
        }
    }

    return true;
}

int main() {
    std::cin >> X;
    if (IsPrime(X)) {
        std::cout << X;
        return 0;
    }

    if (X % 2 == 0) {
        X = X + 1;
    }

    for (int i = X; X < MAX_X; X += 2) {
        if (IsPrime(X)) {
            std::cout << X;
            break;
        }
    }
    return 0;
}

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

typedef long long ll;

using namespace std;

#define swap(a, b)    do { typeof(a) __tmp = (a); (a) = (b); (b) = __tmp; } while(0)
#define repd(i, a, b) for(typeof(b) i = a; i < (b); ++i)
#define rep(i, n)     repd(i, 0, n)
#define dump(x)       cerr << #x << " = " << (x) << endl
#define debug(x)      cerr << "L" << __LINE__ << ": " << #x << " = " << (x) << endl
#define YesNo(x)      cout << ((x) ? "Yes" : "No") << endl
#define YESNO(x)      cout << ((x) ? "YES" : "NO") << endl
#define absi(x)       ( ((x) >= 0) ? (x) : (-(x)) )

int main(int argc, const char* argv[]) {
	ll p, q, r;
	cin >> p >> q >> r;

	cout << p + q + r - max({p, q, r}) << endl;

	return 0;
}


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

int main() {
    int n;
    cin>>n;
    char c[n];
    int ans = 0;
    int whiteptr = -1;
    int redptr = -1;
    for (int i = 0; i < n; i++) {
        cin>>c[i];
        if (c[i] == 'W' && whiteptr == -1) whiteptr = i;
    }

    if (whiteptr == -1) {
        cout<<0<<endl;
        return 0;
    }

    for (int i = n-1; i >= 0; i--) {
        if (c[i] == 'R') {
            redptr = i;
            break;
        }
    }

    if (whiteptr > redptr) {
        cout<<0<<endl;
        return 0;
    }

    while (whiteptr < redptr) {
        swap(c[whiteptr], c[redptr]);
        ans++;

        int currentwhite = whiteptr;
        whiteptr = -1;
        for (int i = currentwhite + 1; i < n; i++) {
            if (c[i] == 'W') {
                whiteptr = i;
                break;
            }
        }

        int currentred = redptr;
        redptr = -1;
        for (int i = currentred - 1; i >= 0; i--) {
            if (c[i] == 'R') {
                redptr = i;
                break;
            }
        }

        if (whiteptr == -1 || redptr == -1) break;
    }

    for (int i = 1; i < n; i++) {
        if (c[i] == 'R' && c[i-1] == 'W') {
            ans++;
            break;
        }
    }

    cout<<ans<<endl;
}


Measured memory_bytes: 3764
a,b,c=map(int,input().split())
k=int(input())
d=max(a,max(b,c))
if d==a:
  print(a*(2**k)+b+c)
elif d==b:
  print(a+b*(2**k)+c)
else:
  print(a+b+c*(2**k))

Measured memory_bytes: 3060
//package com.karancp;

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.*;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.io.InputStream;


 class Main {
    public static void main(String args[])
    {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader z = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        task solver =new task();
        solver.solve(z,out);
        out.close();
    }

    static class task
    {

        static long gcd(long a,long b)
        {
            if(b==0)return a;
            else return gcd(b,a%b);
        }
        static long lcm(long a,long b)
        {
            long pp=a*b;
            long bb=gcd(a,b);
            long res =pp/bb;
            return res;
        }
        static int max(int a,int b)
        {
            return Math.max(a,b);
        }
        static int min(int a,int b)
        {
            return Math.min(a,b);
        }





        public static void solve(InputReader z, PrintWriter out) {
            int n=z.nextInt();
            int ar[]=new int[n];
            int dp[]=new int[n+1];
            int i;
            for(i=0;i<n;i++)ar[i]=z.nextInt();

            dp[1]=0;
            dp[2]=Math.abs(ar[0]-ar[1]);
            for(i=3;i<=n;i++)
            {
                int a=Math.abs(ar[i-2]-ar[i-1]);
                int b=Math.abs(ar[i-3]-ar[i-1]);
                dp[i]=Math.min(dp[i-1]+a,dp[i-2]+b);
            }
            out.print(dp[n]);


        }
    }
    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }
        public long nextLong() {
            return Long.parseLong(next());
        }

    }



}

Measured memory_bytes: 32264
#!/usr/bin/env python3
import sys
 
YES = "Yes"  # type: str
NO = "No"  # type: str
 
def solve(N: int, A: int, B: int, C: int, D: int, S: str):
    ret = YES
    if '##' in S[A - 1:C] or '##' in S[B - 1:D]:
        ret = NO
    else:
        if D < C:
            #if S[B - 2:B] == '..' or S[B - 1:B + 1] == '..':
            if not '...' in S[B - 2:D + 1]:
                ret = NO
    print(ret)
    return
 
 
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    C = int(next(tokens))  # type: int
    D = int(next(tokens))  # type: int
    S = next(tokens)  # type: str
    solve(N, A, B, C, D, S)
 
if __name__ == '__main__':
    main()

Measured memory_bytes: 40816
// Gaurav Aggarwal
 
#include<bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii > vii;
typedef vector<pll > vll;
#define pb push_back
#define mp make_pair 
#define mod 1000000007
#define F first
#define S second
#define p(s) cout<<(s)<<endl
#define p2(s, t) cout << (s) << " " << (t) << endl
#define For(i, a, b) for(__typeof (a) i=a; i<=b; i++)
#define inp_arr(a,n) for(__typeof (n) i=0; i<n; ++i) {cin>>a[i];}
#define debug_arr(a,n) {{for(__typeof (n) i=0; i<n; ++i) {cout<<a[i]<<" ";}cout<<"\n";}}
 
ll power(ll x, ll y) 
{ 
    ll res = 1;   
    while (y > 0) { 
        if (y & 1) 
            res = (res*x)%mod; 
        y = y>>1;
        x = (x*x)%mod;
    } 
    return res%mod; 
}

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

    // #ifndef ONLINE_JUDGE
    // freopen("input.txt", "r", stdin);
    // freopen("out.txt", "w", stdout); 
    // #endif  

    int n;
    cin>>n;
    int ans = 0;
    if(n <= 9) ans = n;
    else if(n <= 99) ans = 9;
    else if(n <= 999) ans = (n - 99) + 9;
    else if(n <= 9999) ans = (999 - 99) + 9;
    else if(n <= 99999) ans = (n - 9999) + (999 - 99) + 9;
    else ans = (99999 - 9999) + (999 - 99) + 9;
    cout<<ans<<"\n";
    return 0;
}

Measured memory_bytes: 256
R,G,B,N = map(int,input().split())
cnt = 0
for r in range(3001):
    if R*r <= N:
        for g in range(3001):
            if N - R*r -G*g >= 0:
                if (N - R*r -G*g)%B == 0:
                    cnt += 1
print(cnt)

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

int NIL;
const int inf = 1<<29;

typedef vector<int> vi;
typedef vector<vector<int> > Graph;

bool bfs(const Graph &g,vi &dist,const vi &pair,int m) {
    queue<int> q;

    for(int i=0; i<m; ++i)
        if(pair[i] == NIL) {
            dist[i] = 0;
            q.push(i);
        }else
            dist[i] = inf;
    dist[NIL] = inf;

    while(!q.empty()) {
        int v = q.front(); q.pop();
        if(v == NIL) continue;
        for(int i=0; i<g[v].size(); ++i) {
            int u = g[v][i];
            if(dist[pair[u]] == inf) {
                dist[pair[u]] = dist[v]+1;
                q.push(pair[u]);
            }
        }
    }
    return dist[NIL] != inf;
}

bool dfs(int v,const Graph &g,vi &dist,vi &pair) {
    if(v != NIL) {
        for(int i=0; i<g[v].size(); ++i) {
            int u = g[v][i];
            if(dist[pair[u]] == dist[v]+1) {
                if(dfs(pair[u],g,dist,pair)) {
                    pair[u] = v, pair[v] = u;
                    return true;
                }
            }
        }
        dist[v] = inf;
        return false;
    }
    return true;
}

// 0-(m-1)  <-->  m-(n-1)
// O(|E| * |V|^(1/2))
int hopcroft_karp(Graph &graph,int m) {
    const int n = graph.size();
    NIL = n;
    vi pair(n+1, NIL), dist(n+1, 0);
    int ret = 0;
    while(bfs(graph,dist,pair,m)) {
        for(int i=0; i<m; ++i)
            if(pair[i] == NIL)
                if(dfs(i,graph,dist,pair)) ret++;
    }
    return ret;
}

int gcd(int x,int y) {
    if(y == 0) return x;
    return gcd(y,x%y);
}

int main() {
    int m,n;
    while(cin>>m>>n, m|n) {
        Graph g(m+n);
        vector<int> b(m), r(n);
        for(int i=0; i<m; ++i) cin>>b[i];
        for(int i=0; i<n; ++i) cin>>r[i];

        for(int i=0; i<m; ++i)
            for(int j=0; j<n; ++j)
                if(gcd(b[i],r[j]) > 1)
                    g[i].push_back(j+m);
        cout<<hopcroft_karp(g,m)<<endl;
    }
}

Measured memory_bytes: 1628
#include <iostream>
using namespace std;
int main() {
    char N[202], s[101], t[101];
    int i, j = 0, k, n;
    cin >> n;
    cin >> s >> t;
    for (i = 0; i < ((2 * n)-1); i = i + 2) {
        N[i] = s[j];
        N[i + 1] = t[j];
        j++;
    }
    N[(2 * n)]='\0';
    cout << N;
    return 0;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline

def main():
	h, w = map(int, input().split())
	a = [map(int, input().split()) for _ in range(h)]
	b = [map(int, input().split()) for _ in range(h)]
	g = [list(abs(x - y) for x, y in zip(l1, l2)) for l1, l2 in zip(a, b)]
	poss = [0] * w
	poss[0] |= 1 << 6400 + g[0][0]
	poss[0] |= 1 << 6400 - g[0][0]
	for i in range(h):
		for j in range(w):
			if j < w - 1:
				d = g[i][j + 1]
				poss[j + 1] |= poss[j] << d
				poss[j + 1] |= poss[j] >> d
			if i < h - 1:
				d = g[i + 1][j]
				poss[j] = poss[j] << d | poss[j] >> d
	res = poss[-1]
	for i in range(6400):
		if res & (1 << 6400 + i) or res & (1 << 6400 - i):
			print(i)
			exit()

if __name__ == "__main__":
	main()

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

// グリッドグラフの移動ベクトル
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
// グリッドグラフでのdfsでのseen配列
vector<vector<bool>> seen;
int H, W;
VS S;

void pathlen_dfs(int h, int w, int64_t &black, int64_t &white){
    seen[h][w] = true;
    if (S[h][w] == '#') ++black;
    else ++white;

    rep(i, 0, 4){
        int nh = h + dx[i], nw = w + dy[i];
        if (nh < 0 || nh >= H || nw < 0 || nw >= W || seen[nh][nw] || S[nh][nw] == S[h][w])
            continue;
        pathlen_dfs(nh, nw, black, white);
    }
}

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

cin >> H >> W;
S.assign(H, ""); rep(i, 0, H) cin >> S[i];
seen.assign(H, vector<bool>(W, false));
// 黒から白黒と進んで 白 で終わるパスの数
// 黒白交互に繋がる連結なグラフにおいて，黒から任意の白へのパスが存在する．
int64_t cnt = 0;
rep(i, 0, H) rep(j, 0, W)
    if (!seen[i][j]) {
        int64_t black = 0, white = 0;
        pathlen_dfs(i, j, black, white);
        cnt += black * white;
    }


cout << cnt << endl;

}
// 書いて考える
// 境界，出力文字列 チェック
// 可読性優先．高速化次点．
// まずは全探索，分割統治，次にDP
// 制限を見る．境界に注意．求めたい量の変域．動かせる量．
// 偶奇，逆から，ソート，出現回数，出現位置，DP， 余事象，包除
// データ構造． 問題の特徴量．単調性，二分探索
// 存在判定：構成方法，入力の特徴
// gcd, lcm ,素因数分解．
// 例外を十分に含む一般化．想像力の限界
// 小さい系から例示
// 代数的処理．前処理によるクエリ高速化．
// 始めは過剰に例示・場合分けしてもいい．各場合を確実に対処．
// 自明な例から処理，除外．
// 小数のときは，精度の設定する．doubel 変数に数値を入力するときは 123. とする．
// テストケース作成は数表あり
// 実行エラー：vector添え字超え．0割り．



Measured memory_bytes: 20480
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define max(p,q) ((p)>(q)?(p):(q))
#define min(p,q) ((p)<(q)?(p):(q))
#define chmax(a,b) ((a)=(a)>(b)?(a):(b))
#define chmin(a,b) ((a)=(a)<(b)?(a):(b))
#define abs(p) ((p)>=(0)?(p):(-(p)))
#define MOD 1000000007
ll power(ll a,ll b){ll r=1;rep(i,b){r*=a;}return r;}
#define swap(a,b) do{ll w=(a);(a)=(b);(b)=w;}while(0)

//your code here!

int main(void){
    ll N;
	scanf("%lld", &N);
	ll i=0, j=0;
	for(ll i=0; i*4<=N; i++){
		for(ll j=0; i*4+j*7<=N; j++){
			if(i*4+j*7 == N){
				printf("Yes\n");
				return 0;
			}
		}
	}
	
	printf("No\n");
    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <map>
#include <utility>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)

pair<int, string> pairif[110000];

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

    if (K >= A + B) {
        cout << 0 << " " << 0 << endl;
    } else if (K <= A) {
        cout << A-K << " " << B << endl;
    } else {
        cout << 0 << " " << A+B-K << endl;
    }

    return 0;


}

Measured memory_bytes: 1920
package main

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

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 500001), 500000)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}

func main() {
	fp := os.Stdin
	if len(os.Args) > 1 {
		fp, _ = os.Open(os.Args[1])
	}

	scanner := getScanner(fp)
	writer := bufio.NewWriter(os.Stdout)

	n := getNextInt(scanner)
	cc := getNextInt(scanner)
	var imos [30][100001]int

	for i := 0; i < n; i++ {
		s := getNextInt(scanner) - 1
		t := getNextInt(scanner) - 1
		c := getNextInt(scanner) - 1

		imos[c][s]++
		imos[c][t+1]--
	}

	var broadcast [100001]int

	ans := 0
	for i := 0; i < cc; i++ {
		for ii := 0; ii < 100000; ii++ {
			imos[i][ii+1] += imos[i][ii]
			if imos[i][ii] > 0 {
				broadcast[ii] |= 1 << uint(i)
			}
		}
	}

	for i := 0; i < 100001; i++ {
		needed := 0
		for ii := 0; ii < 30; ii++ {
			needed += (broadcast[i] >> uint(ii)) & 1
		}
		if ans < needed {
			ans = needed
		}
	}

	fmt.Fprintln(writer, ans)

	writer.Flush()
}


Measured memory_bytes: 27264
N = int(input())
li = list(map(int, input().split()))
li_2 = []

if N == 1:
    print(0)
else:
   for i in range(min(li),max(li)+1):
       cost_sum = 0
       for t in range(N):
           cost_sum += (li[t]-i) ** 2
       li_2.append(cost_sum)
   print(min(li_2))


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

int main() {
  int N;
  cin >> N;
  vector<int> p(N);
  rep(i, N) cin >> p[i];
  int ans = 0;
  for (int i = 0; i < N-1; i++) {
    if (p[i] == i+1) {
      ans++;
      swap(p[i], p[i+1]);
    }
    if (i == N-2 && p[i+1] == N) {
      ans++;
      swap(p[i], p[i+1]);
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3740
#include <iostream>

int main(){
    const int MINITES_MAX = 60;
    const int SECOND_MAX  = 60;

    int fullSecond = 0;
    std::cin >> fullSecond;

    int hour = fullSecond / ( MINITES_MAX * SECOND_MAX );
    int min  = ( fullSecond / SECOND_MAX ) % MINITES_MAX;
    int sec  = fullSecond % SECOND_MAX;

    std::cout << hour << ':' << min << ':' << sec << std::endl;
}

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

int main() {
int K;
  cin >> K;
  string S;
  cin >> S;
  if(S.length() <= K){
  	cout << S << endl;
  }
  else{
  	for(int i = 0; i < K; i++){
    	cout << S[i];
    }
    cout << "..." << endl;
  }
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(int i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(int i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(int i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define uniq(x) (x).erase(unique((x).begin(), (x).end()), (x).end())

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // std::ifstream in("input.txt");
    // std::cin.rdbuf(in.rdbuf());
    int n, t;
    cin >> n >> t;
    vector<pair<int, int>> ab(n);
    rep(i, n) cin >> ab[i].first >> ab[i].second;
    int ans = INT_MIN;
    // dp[見た数][合計食事時間][食事時間を1にした数] = 美味しさ
    vector<vector<vector<int>>> dp(n + 1, vector<vector<int>>(t + 1, vector<int>(2, INT_MIN)));
    rep(i, n + 1) rep(ii, 2) dp[i][0][0] = 0;
    reps(i, 1, n + 1) {
        int a = ab[i - 1].first, b = ab[i - 1].second;
        rep(flg, 2) {
            rep(ii, t + 1) {
                dp[i][ii][flg] = max(dp[i][ii][flg], dp[i - 1][ii][flg]);
                if ((ii < a) || (dp[i - 1][ii - a][flg] == INT_MIN)) continue;
                dp[i][ii][flg] = max(dp[i][ii][flg], dp[i - 1][ii - a][flg] + b);
                ans = max(ans, dp[i][ii][flg]);
            }
        }
        reps(ii, 1, t + 1) {
            if (dp[i - 1][ii - 1][0] == INT_MIN) continue;
            dp[i][ii][1] = max(dp[i][ii][1], dp[i - 1][ii - 1][0] + b);
            ans = max(ans, dp[i][ii][1]);
        }
    }
    cout << ans << endl;
    return 0;
}


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

set<string> a;

int main()
{
    int n;
    string s;
    cin >> n;
    for(int i=0;i<n;i++){
        cin >> s;
        a.insert(s);
    }
    cout << a.size() << "\n";
}


Measured memory_bytes: 19232
from collections import defaultdict
n = int(input())
di = [list(map(int, input().split(' '))) for _ in range(n)]
#result = {0:0}
md = defaultdict(int)
md[0] = 0
for i in range(n):
    for j in range(n):
        if i == j:
            continue
        else:
            p = di[i][0] - di[j][0]
            q = di[i][1] - di[j][1]
            #result[(p,q)] = result.get((p,q), 0)+1
            md[(p,q)] += 1
#print(result)
#print(n - max(result.values()))
#print(md)
print(n - max(md.values()))

Measured memory_bytes: 3828
n, x = map(int, input().split())
a = list(map(int ,input().split()))

a = sorted(a)

ans = 0
temp = x

while ans < n:
    temp -= a[ans]
    ans += 1
    if temp == 0:
        break
    elif temp < 0:
        ans -= 1
        break

if ans == n and temp > 0:
    ans -= 1
print(ans)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define downque(que)  priority_queue<ll> que;
#define upque(que) priority_queue<ll, vector<int>, greater<int>> que;
typedef long long ll;
const int MOD = 1e9+7;

ll bikkuri(int n){
    ll a=1;
    FOR(i,1,n+1){
      a*=i; a%=MOD;
    }
    return a;
}

int main(){
  int n,m; cin>>n>>m;
  ll res=0;
  if(n==m-1||n==m+1){
     res=bikkuri(n)*bikkuri(m);
  }else if(n==m){
     res=bikkuri(n)*bikkuri(m)*2;
  }else res=0;
  res%=MOD;
  cout<<res<<endl;
}

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

int main() {
int n;
  cin>>n;
  int sum=0;
  for(int i=0;i<n;i++){
string s;
    cin>>s;
if(s=="Y"){
  sum+=1;
}
  }
  
    if(0<sum){
      cout<<"Four"<<endl;
    }
    else{
      cout<<"Three"<<endl;
    }
    
}

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

using namespace std;

typedef long long ll;

const int MAXN = 1e5 + 5;

int x[MAXN][3], dp[MAXN][3];
int n;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cin >> n;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < 3; ++j) {
      cin >> x[i][j];
    }
  }
  for (int i = 0; i < 3; ++i) {
    dp[0][i] = x[0][i];
  }
  for (int i = 1; i < n; ++i) {
    for (int j = 0; j < 3; ++j) {
      for (int k = 0; k < 3; ++k) {
        if (k == j) continue;
        dp[i][j] = max(dp[i][j], dp[i - 1][k] + x[i][j]);
      }
    }
  }
  cout << max({dp[n - 1][0], dp[n - 1][1], dp[n - 1][2]}) << endl;
  return 0;
}



Measured memory_bytes: 5888
#include<stdio.h>
#define MAX 10000
#define NIL -1

struct Node {int p,l,r;};
struct Node T[MAX];
int n;

void preParse(int u){
  if(u == NIL) return;
  printf(" %d",u);
  preParse(T[u].l);
  preParse(T[u].r);
}

void inParse(int u){
  if(u == NIL) return;
  inParse(T[u].l);
  printf(" %d",u);
  inParse(T[u].r);
}

void postParse(int u){
  if(u == NIL) return;
  postParse(T[u].l);
  postParse(T[u].r);
  printf(" %d",u);
}

int main(){
  int i,v,l,r,root;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    T[i].p = NIL;
  }

  for(i=0;i<n;i++){
    scanf("%d%d%d",&v,&l,&r);
    T[v].l = l;
    T[v].r = r;
    if(l!=NIL) T[l].p=v;
    if(r!=NIL) T[r].p=v;
  }

  for(i=0;i<n;i++) if(T[i].p == NIL) root = i;

  printf("Preorder\n");
  preParse(root);
  printf("\n");
  printf("Inorder\n");
  inParse(root);
  printf("\n");
  printf("Postorder\n");
  postParse(root);
  printf("\n");

  return 0;
}



Measured memory_bytes: 1940
#define _CRT_SECURE_NO_WARNINGS

#include<fstream>
#include<iostream>
#include<string>
#include<iomanip>
#include<list>
#include<math.h>
#include<stack>
#include<queue>
#include<vector>
#include<algorithm>
#include<utility>

using namespace std;

int main(int argc, char **argv){
	int w, h, x, y, r;
	cin >> w >> h >> x >> y >> r;
	if (w >= x + r && h >= y + r && x - r >= 0 && y - r >= 0) {
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 1156
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iomanip>
#include <numeric>
#include <queue>
#include <cmath>
using namespace std;

int main() {   
    int h, w;
    cin >> h >> w;
    vector<string>vs;
    for (int i = 0; i < h; i++) {
        string s;
        cin >> s;
        vs.push_back(s);
    }
    vector<vector<int>> dir{{0, 1}, {0, -1}, {-1, 0}, {1, 0}};
    vector<vector<int>> v(h, vector<int>(w, 0));
    long long int res = 0;
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            if (v[i][j] == 0) {
                v[i][j] = 1;
                long long int c1 = 0, c2 = 0;
                vector<pair<int, int>> vp;
                vp.push_back(make_pair(i, j));
                while (vp.size() > 0) {
                    auto node = vp.back();
                    if (vs[node.first][node.second] == '.') {
                        c1++;
                    } else {
                        c2++;
                    }
                    vp.pop_back();
                    for (auto d : dir) {
                        int x = node.first + d[0], y = node.second + d[1];
                        if (x < 0 || y < 0 || x >= h || y >= w) continue;
                        if (vs[node.first][node.second] == vs[x][y]) continue;
                        if (v[x][y] == 0) {
                            v[x][y] = 1;
                            vp.push_back(make_pair(x, y));
                        }
                    }
                }
                res += c1 * c2;
            }
        }
    }
    cout << res << endl;
}




Measured memory_bytes: 5128
use std::io::prelude::*;

fn input<T>() -> T
where
    T: std::str::FromStr,
{
    let stdin = std::io::stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}

fn main() {
    let n: usize = input();
    let s: Vec<String> = (0..n).map(|_| input()).collect();

    let mut v = vec![vec![0; n]; 26];
    for i in 0..n {
        for c in s[i].chars() {
            v[(c as u8 - 'a' as u8) as usize][i] += 1;
        }
    }

    let mut ans = String::new();
    for c in b'a'..b'z' + 1 {
        let c = char::from(c);
        let i = c as u8 - 'a' as u8;
        let cnt = *v[i as usize].iter().min().unwrap();
        for _ in 0..cnt {
            ans.push(c);
        }
    }

    println!("{}", ans);
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
#define int unsigned long long
#define N 666666
int arr[N],f[N];

signed main(){
	int n,m;
	cin>>n>>m;
	int t=n*m;
	if(n==1||m==1){
		cout<<"1";return 0;
	}
	if(t%2==0) cout<<t/2;
	else cout<<t/2+1;
	return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#ifdef MYDEF
//#pragma optimize( "/Od", off )  
//#pragma optimize( "/Oa", off )  
//#pragma optimize( "/Og", off )  
//#pragma optimize( "/Oi", off )  
#endif
#include <iostream>	
#include <time.h>
#include <vector>
#include <stdio.h>
#include <memory.h>
#include <string>
#include <string.h>
#include <map>
#include <algorithm>
#include <queue>
#include <set>
#include <time.h>
#include <assert.h>
#include <sstream>
//#include <unordered_map>
#include <bitset>
#include <utility>
#include <iomanip>
#include <climits>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <numeric>
#include <math.h>
#include <cmath>
#include <complex>
#ifdef MYDEF
#include "inc.h"
#endif
using namespace std;
typedef long long ll;

int n, m;


int main() {
#ifdef MYDEF
	HEAD;
	freopen("a.txt", "r", stdin);
	//freopen("b.txt", "w", stdout);
	decTime;
#endif

	scanf("%d%d", &n, &m);
	if(n == 1 && m == 1)
		return 0 * printf("1\n");
	if(n == 1)
		return 0 * printf("%d\n", m - 2);
	if(m == 1)
		return 0 * printf("%d\n", n - 2);
	printf("%lld\n", n * 1LL * m - 2LL * n - 2LL * m + 4);
	
	

#ifdef MYDEF
	printTime;
#endif
	return 0;
}

Measured memory_bytes: 256
P = int(input())
N = list(map(int,input().split()))
N.reverse()
#print(N)
s = sum(N)/P
minfr=9999
ans = 0
#print(s)
for i ,n in enumerate(N):
    minfr = min(minfr,abs(n-s))
    #print(minfr,i,n)
    if minfr == abs(n-s):
        ans = i
    # TODO: write code...
print(abs(ans-(P-1)))

Measured memory_bytes: 3064
import java.util.*;
import java.io.*;
import java.math.*;
 
public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int h = sc.nextInt();
        int w = sc.nextInt();
        for(int i = 0; i < h+2; i++){
            if(i == 0 || i == h+1){
                String s = "";
                for(int j = 0; j < w+2; j++) s += "#";
                System.out.println(s);
            }else{
                String s = sc.next();
                System.out.println("#" + s + "#");
            }
        }
    }
}

Measured memory_bytes: 21844
use std::io::*;
use std::str::FromStr;

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

use std::cmp::min;

fn main() {
    let n = read::<usize>();    
    let m = read::<usize>();    
    let l = read::<usize>();    
    let INF = 100_100_100_1;
    let mut dist = vec![vec![INF; n]; n];
    for i in 0..m {
        let a = read::<usize>()-1;
        let b = read::<usize>()-1;
        let c = read::<usize>();
        
        dist[b][a] = c;
        dist[a][b] = c;
    }
    for k in 0..n {
        for i in 0..n {
            for j in 0..n {
                dist[i][j] = std::cmp::min(dist[i][j], dist[i][k] + dist[k][j]);
            }
        }
    }

    let mut dist2 = vec![vec![INF; n]; n];

    for i in 0..n {
        for j in 0..n {
            if dist[i][j] <= l {
                dist2[i][j] = 1;
            }
        }
    }

    for k in 0..n {
        for i in 0..n {
            for j in 0..n {
                dist2[i][j] = std::cmp::min(dist2[i][j], dist2[i][k] + dist2[k][j]);
            }
        }
    }
    
    let q = read::<usize>();
    for i in 0..q {
        let s = read::<usize>()-1;
        let t = read::<usize>()-1;
        if dist2[s][t] == INF { println!("-1") } else { println!("{}", dist2[s][t]-1) }
    }
}

Measured memory_bytes: 4604
#include "bits/stdc++.h"
using namespace std;

// Inserted snippets: io, root
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
template<typename H> bool chmin(H& v1, const H v2) { if (v1 > v2) { v1 = v2; return true; } return false; }
template<typename H> bool chmax(H& v1, const H v2) { if (v1 < v2) { v1 = v2; return true; } return false; }
template<typename H> void read(H& head) { cin >> head; }
template<typename H, typename ...T> void read(H& head, T& ...tail) { cin >> head; read(tail...); }
template<typename H> void write(H head) { cout << head << '\n'; }
template<typename H, typename ...T> void write(H head, T ...tail) { cout << head << " "; write(tail...); }
template<typename ...T> void die(T ...tok) { write(tok...); exit(0); }
// End snippets

int main() {
	cin.tie(0)->sync_with_stdio(0);
	cin.exceptions(cin.failbit);

	int n; read(n);
	map<string, int> m;
	rep(i, 0, n) { string s; read(s); m[s]++; }

	write("AC x", m["AC"]);
	write("WA x", m["WA"]);
	write("TLE x", m["TLE"]);
	write("RE x", m["RE"]);
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;
typedef long long ll;

struct int_hash {
    static uint64_t splitmix64(uint64_t x) {
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

struct pair_hash {
    size_t operator()(pair<int, int> x) const {
        return int_hash{}(x.first) ^ (int_hash{}(x.second) << 16);
    }
};

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const int MOD = 1000000007;
const ll INF = numeric_limits<ll>::max();
const int inf = 1e7;
const int MX = 100001; //check the limits, dummy

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

    string s; cin >> s;
    ll n = s.size();
    ll k; cin >> k;
    vector<vector<ll>> c(n + 1, vector<ll>(k + 1, 0));

    c[0][0] = 1;
    for(int i = 1; i <= n; i++) {
        c[i][0] = 1;
        for(int j = 1; j <= k; j++)
            c[i][j] = c[i - 1][j - 1] + c[i - 1][j];
    }

    vector<int> pows{1, 9, 9 * 9, 9 * 9 * 9};

    ll ans = 0;
    for(int i = 0; i < n && n - i >= k && k; i++) {
        if(s[i] != '0') {
            ans += (s[i] - '0' - 1) * c[n - i - 1][k - 1] * pows[k - 1];
            if(n - i - 1 >= k) ans += c[n - i - 1][k] * pows[k];
            k--;
        }
    }

    cout << ans + (k == 0) << endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cmath>
#include<string>
#include<vector>
#include<algorithm>
#include<set>
#include<stack>
#include<queue>
#include<map>
#include<cstring>
#include<functional>

using namespace std;

int main()
{
	//freopen("input.txt", "r", stdin);

	int n;
	char input[200001];

	scanf("%d", &n);

	scanf("%s", input);
	string str = input;

	int rnum = 0;

	for (int i = 0; i < n; i++)
	{
		rnum += (str[i] == 'R');
	}

	int sol = rnum;
	int wnum = 0;

	for (int i = 0; i < n; i++)
	{
		wnum += (str[i] == 'W');
		rnum -= (str[i] == 'R');

		const int cost = wnum > rnum ? wnum : rnum;

		if (cost < sol)
		{
			sol = cost;
		}
	}

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

	return 0;
}

Measured memory_bytes: 3484
#include <bits/stdc++.h>
using namespace std;
int main(){
	int a,b,c,d,p;	cin>>a>>b>>c>>d>>p;
	int x=a*p;
	int y=b;
	if(c<p)	y+=d*(p-c);
	cout<<min(x,y)<<endl;
	return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
typedef long double ld;
//typedef tree<int,null_type,less<int >,rb_tree_tag,tree_order_statistics_node_update>indexed_set;
template<class T1, class T2>
ostream &operator <<(ostream &os, pair<T1,T2>&p);
template <class T>
ostream &operator <<(ostream &os, vector<T>&v);
template <class T>
ostream &operator <<(ostream &os, set<T>&v);
template <class T1, class T2>
ostream &operator <<(ostream &os, map<T1,T2>&v);
#ifdef APURBA
#define HERE cout<<"here - "<<__LINE__<<"\n";
#define debug(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it)
{
    cout<<endl;
}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args)
{
    cout << *it << " = " << a << " ";
    err(++it, args...);
}
#else
#define HERE
#define debug(args...)
#endif
const ll mod = 1e9+7 ;
const int N = (1<<17);
typedef pair<int,int> pii;
int add(int a, int b)
{
    a+=b;
    if(a>=mod)
        a-=mod;
    return a;
}
int sub(int a, int b)
{
    a-=b;
    if(a<0)
        a+= mod;
    return a;
}
int mul(int a, int b)
{
    return a*1ll*b %mod;
}
void TEST_CASES(int cas)
{
    int n;
    scanf("%d",&n);
    int sum =0;
    vector<int>a(n);
    for(int i=0;i<n;i++)
    {
        scanf("%d",&a[i]);
        sum = add(sum , a[i]);
    }
    int ans =0;
    for(int i=0;i<n;i++)
    {
        int now = a[i];
        sum = sub(sum , a[i]);
        ans = add(ans , mul(now,sum));
    }
    printf("%d\n",ans);
}


/*

*/

int main()
{
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    int t=1,cas=0;
    //scanf("%d",&t);
    while(t--)
    {
        TEST_CASES(++cas);
    }
    return 0;
}



template<class T1, class T2>
ostream &operator <<(ostream &os, pair<T1,T2>&p)
{
    os<<"{"<<p.first<<", "<<p.second<<"} ";
    return os;
}
template <class T>
ostream &operator <<(ostream &os, vector<T>&v)
{
    os<<"[ ";
    for(int i=0; i<v.size(); i++)
    {
        os<<v[i]<<" " ;
    }
    os<<" ]";
    return os;
}

template <class T>
ostream &operator <<(ostream &os, set<T>&v)
{
    os<<"[ ";
    for(T i:v)
    {
        os<<i<<" ";
    }
    os<<" ]";
    return os;
}
template <class T1, class T2>
ostream &operator <<(ostream &os, map<T1,T2>&v)
{
    for(auto i:v)
    {
        os<<"Key : "<<i.first<<" , Value : "<<i.second<<endl;
    }
    return os;
}



Measured memory_bytes: 4068
#include <stdio.h>
 
int main (void) {
  int i, s, count=0;
  int L, R, d;
  
  scanf("%d %d %d", &L, &R, &d);
  
  for(i=L; i<R+1; i++) {
    if (i % d == 0) {
      count += 1;
    }
  }
  
  printf("%d", count);
  
  return 0;
}

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

using namespace std;

#define int long long

const int MAXN = 2e5 + 7;
const int INF = 9e18 + 7;

int n, k;
int a[MAXN];

int pref[MAXN];

void precalc() {
    for (int i = 0; i < n; ++i) pref[i + 1] = pref[i] + a[i];
}

int getsum(int l, int r) {
    return pref[r + 1] - pref[l];
}

int get(int t) {
    int ans = k * (n + t);
    int l = n - t, r = n - 1;
    ans += getsum(l, r) * 5;
    int f = 2;
    while (1) {
        l -= t;
        r -= t;
        ans += getsum(max(0ll, l), r) * (f + 3);
        if (ans > INF) return INF;
        if (l <= 0) break;
        f += 2;
    }
    return ans;
}

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
                                    
    cin >> n >> k;
    for (int i = 0; i < n; ++i) cin >> a[i];    

    precalc();

    int ans = INF;
    for (int i = 1; i <= n; ++i) {
        ans = min(ans, get(i));
    }

    cout << ans << '\n';
    return 0;   
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
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;
    }
}


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

int main(){
char t1[100];
char t2[100];
    int n;
    int a=0,b=0;
    int i;
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%s %s",&t1,&t2);
        if(strcmp(t1,t2)==0) a++,b++;
        if(strcmp(t1,t2)>0) a+=3;
        if(strcmp(t1,t2)<0) b+=3;
    }
    printf("%d %d\n",a,b);
    return 0;
}


Measured memory_bytes: 2048
#include<bits/stdc++.h>
#define _ ios_base::sync_with_stdio(0);cin.tie(0);
#define REP(i,n) for(int i=0;i<(int)(n);i++)

using namespace std;
typedef long long int ll;
ll y[12];

int main(){ _;
  ll n,a,b,c,x;
  while(cin>>n>>a>>b>>c>>x,(n|a|b|c|x)!=0){
    REP(i,n)cin>>y[i];
    ll idx=0,i=0;
    ll curX=x;
    for(;i<=10000;i++){
      if(curX==y[idx]) idx++;
      if(idx==n) break;
      curX=(a*curX+b)%c;
    }
    cout<<(idx==n?i:-1)<<endl;
  }
}

Measured memory_bytes: 1188
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i = a; i < b; ++i)
#define all(c) c.begin(), c.end()
#define gmax(x,y) x=max(x,y)
#define gmin(x,y) x=min(x,y)
#define gadd(x,y) x=add(x,y)
#define gmul(x,y) x=mul(x,y)
using namespace std;

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

int main(){
	cin.tie(0);
	cout.tie(0);
	ios_base::sync_with_stdio(0);
	double d;
	cin >> d;
	double pi = acos(-1);
	cout << setprecision(19) << fixed; 
	cout << 2 * d * pi << '\n';
}


Measured memory_bytes: 3804
#include<bits/stdc++.h>
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb emplace_back
#define mp make_pair
#define all(v) v.begin(),v.end()
#define sz(x) (ll)x.size()
#define F first
#define S second
#define FOR(i,a,b) for(ll i=a;i<=b;++i)
#define ROF(i,a,b) for(ll i=a;i>=b;--i)
typedef long long ll;
using namespace std;

const int N = 3002;

int R, C, k;
ll item[N][N];
ll dp[4][N][N];

ll solve(int cnt, int row, int col){
    ll &ret = dp[cnt][row][col];
    if(ret != -1)
        return ret;
    ret = 0;
    if(row <= R){
        ret = max(ret, solve(0, row + 1, col));
        if(item[row][col] > 0 && cnt < 3)
            ret = max(ret, item[row][col] + solve(0, row + 1, col));
    }
    if(col <= C){
        ret = max(ret, solve(cnt, row, col + 1));
        if(item[row][col] > 0 && cnt < 3)
            ret = max(ret, item[row][col] + solve(cnt + 1, row, col + 1));
    }
    return ret;
}

int main(){
    IOS

    cin >> R >> C >> k;
    FOR(i,1,k){
        int r, c, v;
        cin >> r >> c >> v;
        item[r][c] = v;
    }
    memset(dp, -1, sizeof(dp));
    cout << solve(0, 1, 1);

    return 0;
}

Measured memory_bytes: 356040
#include <bits/stdc++.h>
typedef long long int ll;
using namespace std;
const ll mod=1e9+7;
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;}

ll a[135];
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    map<char,int>m;
    string s;
    cin>>s;
    for(int i=0;i<s.length();i++){
        m[s[i]]++;
    }
    if(m.size()!=2){cout<<"No"<<endl;return 0;}
    else{
        map<char,int>::iterator it=m.begin();
        for(it;it!=m.end();it++){
            if(it->second!=2){cout<<"No"<<endl;return 0;}
        }
    }
    cout<<"Yes"<<endl;
    return 0;
    }


Measured memory_bytes: 256
/*********************************************************************| 
|---------|    /\  ....                  ....                         |         
     |        /  \   \                    /  /------| ----- |-------| |
     |       /    \   \                  /  /           |   |         |
     |      /      \   \       /\       /  |            |   |         |
     |     /        \   \     /  \     /   |---|        |   |----|    |
     |    /__________\   \   /    \   /        |---|    |   |         |
     |   /            \   \ /      \ /              |   |   |         |
     |  /              \   |        |               /   |   |         |
     _ __              __ ...      ...      |------/  ----- _         |
                                                                      |  
        Md Tawsif Rahman                                              |
        Institute Of Information Technology                           |
        Jahangirnagar University                                      |                                                                         
                                                                      |
**********************************************************************/                 
#include<bits/stdc++.h>

using namespace std;
#define ll long long int
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define mp make_pair
#define pii pair <int, int>
#define xx first
#define yy second
#define vi vector < int >
#define vl vector < ll >
#define inf  100000000 
#define f(i, c, n) for(i = c; i < n; i++)
#define fe(i, c, n) for(i = c; i <= n; i++)
#define fr(i, n, c) for(i = n - 1; i >= 0; i--) 
#define vbe(a) a.begin(), a.end()
#define vsort(a) sort(a.begin(), a.end())
#define mem(a) memset(a, 0, sizeof(a))
#define memn(a) memset(a, -1, sizeof(a))
#define srti(a, n) sort(a, a + n)
#define srtd(a, n) sort(a, a + n, greater<int>())
#define LB(a, x) (lower_bound(vbe(a), x) - a.begin())
#define UB(a, x) (upper_bound(vbe(a), x) - a.begin())

#define si(a) scanf("%d", &a)
#define sii(a, b) scanf("%d%d", &a, &b)
#define siii(a, b, c) scanf("%d%d%d", &a, &b, &c)
#define sl(a) scanf("%lld", &a)
#define sll(a, b) scanf("%lld%lld", &a, &b)
#define slll(a, b, c) scanf("%lld%lld%lld", &a, &b, &c)

#define fast ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0)

int convert_str_to_int(string s) {
    stringstream str(s);
    int x = 0;
    str >> x;
    return x;
}



int i, j, k, cs, n;


void solve() {
    string s;
    cin >> s;
    n = s.size();
    int d = 0;
    f(i, 0, n) {
        d += s[i] - '0';
    }
    int num = convert_str_to_int(s);
    if(num % d == 0) cout << "Yes" << endl;
    else printf("No\n");

}
int main() {
    // int t; cin >> t; while(t--) 
    solve();
}
   

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

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pll;
typedef vector<bool> vb;
const ll oo = 0x3f3f3f3f3f3f3f3f;
const double eps = 1e-9;
#define sz(c) ll((c).size())
#define all(c) begin(c), end(c)
#define FOR(i,a,b) for (ll i = (a); i < (b); i++)
#define FORD(i,a,b) for (ll i = (b)-1; i >= (a); i--)
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define xx first
#define yy second
#define TR(X) ({ if(1) cerr << "TR: " << (#X) << " = " << (X) << endl; })

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	const ll X = 1e18;
	ll n; cin >> n;
	ll res = 1;
	while (n--) {
		ll a; cin >> a;
		if (a > 0 && res > X/a) res = X+1;
		else res *= a;
	}
	if (res > X) res = -1;
	cout << res << endl;
}



Measured memory_bytes: 3632