akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <stdlib.h>

struct discount {
    int x;
    int y;
    int dis_fee;
};

void cpy_array(int *dst_array, int *src_array, int num) {
    for (int i = 0; i < num; i++) {
        dst_array[i] = src_array[i];
    }
}

void sort(int *array, int left, int right) {
    /*
    for (int i = left; i <= right; i++) {
        printf("%d ", array[i]);
    }
    printf("\n");
    */

    if ((right - left) > 0) {
        int pivot = array[(left + right) / 2];
        int pl = left, pr = right;

        while (pl < pr) {
            while (array[pl] < pivot) pl++;
            while (array[pr] > pivot) pr--;
            
            if (pl < pr){
                // printf("swap: %d %d\n", array[pl], array[pr]);
                int tmp = array[pr];
                array[pr] = array[pl];
                array[pl] = tmp;
                pl++; pr--;
            }
        }
        // printf("break\n");

        sort(array, left, pr);
        sort(array, pr + 1, right);
    }
}

int main(void) {
    int a, b, m;
    scanf("%d %d %d", &a, &b, &m);

    int fee_a[a], fee_b[b], fee_a_seq[a], fee_b_seq[b];
    struct discount dis[m];
    for (int i = 0; i < a; i++) {
        scanf(" %d", &fee_a[i]);
    }
    for (int i = 0; i < b; i++) {
        scanf(" %d", &fee_b[i]);
    }
    for (int i = 0; i < m; i++) {
        scanf(" %d", &dis[i].x);
        scanf(" %d", &dis[i].y);
        scanf(" %d", &dis[i].dis_fee);
    }

    cpy_array(fee_a_seq, fee_a, a);
    cpy_array(fee_b_seq, fee_b, b);

    sort(fee_a, 0, a - 1);
    sort(fee_b, 0, b - 1);

    /*
    for (int i = 0; i < a; i++) {
        printf("%d ", fee_a[i]);
    }
    printf("\n");
    for (int i = 0; i < b; i++) {
        printf("%d ", fee_b[i]);
    }
    printf("\n");
    */

    int fee_min = fee_a[0] + fee_b[0];
    for (int i = 0; i < m; i++) {
        struct discount tmp_dis = dis[i];
        int fee_tmp = fee_a_seq[tmp_dis.x - 1] + fee_b_seq[tmp_dis.y - 1] - tmp_dis.dis_fee;
        if (fee_tmp < fee_min) {
            fee_min = fee_tmp;
        }
    }

    printf("%d\n", fee_min);
    return 0;
}

Measured memory_bytes: 2944
#include <stdio.h>

int main() {
	int i, sum;
	char x[1000];

	while (1) {
		scanf("%s", &x);

		if (x[0] == '0') {
			break;
		}
		else {
			sum = 0;
			for (i = 0; x[i] != '\0'; i++) {
				sum += x[i] - '0';
			}
			printf("%d\n", sum);
		}
	}
	return 0;
}


Measured memory_bytes: 2048
import sys
import math
from collections import Counter


inint = lambda: int(sys.stdin.readline())
inintm = lambda: map(int, sys.stdin.readline().split())
inintl = lambda: list(inintm())
instrm = lambda: map(str, sys.stdin.readline().split())
instrl = lambda: list(instrm())

n = inint()
D = inintl()
m = inint()
T = inintl()

D = Counter(D)

for t in T:
    D[t] -= 1

for i in D:
    if D[i] < 0:
        print("NO")
        exit()

print("YES")

Measured memory_bytes: 138820
'use strict'
function main(input: string) {
    const [s, t]: string[][] = input.trim().split('\n').map(v => v.trim().split('')));
    const r: string[] = t.filter((v: string, i: number) => v === s[i]);
    console.log(r.length);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 7372
#include<bits/stdc++.h>
#define inf 100000000000
#define int long long int
#define hell (int)(1e9+7)

using namespace std;

void solve(){
    int n,k;
    cin>>n>>k;
    n%=k;
    int ans=min(n,abs(n-k));
    cout<<ans;
}

signed main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int t;
	//cin>>t;
	t=1;
	while(t--){
		solve();
	}
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;
int gg[55][55];
int h,w;
int dx[]={1,-1,0,0},dy[]={0,0,1,-1};
string s[55];
void solve(int sx,int sy){
    queue<pair<int,int>> q;
    q.push({sx,sy});
    //cout<<"aaa"<<q.empty()<<endl;
    while(q.empty()==0){
        //cout<<"haita"<<endl;
        int x = q.front().first,y = q.front().second;
        q.pop();
        rep(i,4){
            int nx = x + dx[i],ny = y + dy[i];
            //cout<<nx<<" "<<ny<<" "<<gg[nx][nyendl;
            if(nx<=h && nx>=0 && ny<=w && ny>=0 && gg[nx][ny]==inf && s[nx][ny]!='#'){
                gg[nx][ny]=gg[x][y]+1;
                //cout<<nx<<" "<<ny<<" is "<<gg[nx][ny]<<endl;
                q.push({nx,ny});
            }
        }
    }
}
int main(){
    cin>>h>>w;
    h--;w--;
    rep(i,h+1) cin>>s[i];
    rep(i,55) rep(j,55) gg[i][j]=inf;
    gg[0][0]=0;
    solve(0,0);
    int cnt_b = 0;
    rep(i,h+1){
        rep(j,s[i].size()) if(s[i][j]=='#') cnt_b++;
    }
    int min1 = gg[h][w];
    /*rep(i,5){
        rep(j,5){
            cout<<gg[i][j]<<" ";
        }
        cout<<endl;
    }*/
    //cout<<gg[h][w]<<endl;
    if(min1!=inf)cout<< (h+1)*(w+1)-min1-cnt_b-1<<endl;
    else cout<<"-1"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void){
    int a,b,ans,i,ansc,kk=0;
    while(1){
        ansc=0;
        scanf("%d%d",&a,&b);
        if(a==0&&b==0){
            break;
        }
        if(kk!=0){
            printf("\n");
        }
        for(i=a;i<=b;i++){
            if (i%4==0 && (i%100!=0||i%400==0)){
                printf("%d\n",i);
                ansc++;
            }else if(i==b&&ansc==0){
                printf("NA\n");
            }
        }
        kk++;
    }
    return 0;
}

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

h = {}
for c in "MARCH":
    h[c] = 0

for i in range(int(input())):
    c = input().strip()[0]
    if c in h:
        h[c] += 1

import itertools
ans = 0
for i,j,k in itertools.combinations("MARCH", 3):
    ans += h[i]*h[j]*h[k]
print(ans)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#include <math.h>
#define REP(i, n) for(int i = 0; i < (n); i++)
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1001001001;
const int mINF = -1001001001;
// << fixed << setprecision(10) <<

int main() {
int n;
cin >> n;
int a[n],b[n];
REP(i,n) {
  cin >> a[i];
}
REP(i,n) {
  b[a[i]-1]=i+1;
}
REP(i,n) cout << b[i] << " ";
cout << endl;
return 0;
}


Measured memory_bytes: 1536
#include <iostream>
#include <cstring>
#include <vector>
#include <set>
#include <list>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <utility>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
#define for1(i,n) for (ll i=0;i<(n);i++)
#define for2(i,m,n) for (ll i=(m);i<(n);i++)
#define for3(i,m,n,d) for (ll i=(m);i<(n);i+=(d))
#define DEBUG 0
template <class T>
void dumplist(T list)
{
    for (auto item : list) {
        cout << item << " ";
    }
    cout << endl;
}

void solve()
{
    ll A,P;
    cin >> A >> P;
    ll ans = (A*3+P)/2;

    cout << ans << endl;
}

int main()
{
    do {
        solve();
    } while (DEBUG);
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <numeric>

#define REP(i, a, b) for (int i = int(a); i < int(b); i++)
using namespace std;
typedef long long int ll;

// clang-format off
#ifdef _DEBUG_
#define dump(...) do{ cerr << __LINE__ << ":\t" << #__VA_ARGS__ << " = "; PPPPP(__VA_ARGS__); cerr << endl; } while(false)
template<typename T> void PPPPP(T t) { cerr << t; }
template<typename T, typename... S> void PPPPP(T t, S... s) { cerr << t << ", "; PPPPP(s...); }
#else
#define dump(...)
#endif
template<typename T> vector<T> make_v(size_t a, T b) { return vector<T>(a, b); }
template<typename... Ts> auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v(ts...))>(a, make_v(ts...)); }
template<typename T>
bool chmin(T &a, T b) { if (a > b) {a = b; return true; } return false;}
template<typename T>
bool chmax(T &a, T b) { if (a < b) {a = b; return true; } return false;}
// clang-format on

#include <utility>
using P = pair<int, int>;

P diameter(vector<vector<int>> &tree, int ver, int prev) {
    P ans = {1, ver};
    for (auto &v : tree[ver]) {
        if (v == prev) continue;
        P res = diameter(tree, v, ver);
        res.first++;
        chmax(ans, res);
    }
    return ans;
}

#include <tuple>

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<vector<int>> Tree(n);
    REP(i, 0, n - 1) {
        int a, b;
        cin >> a >> b;
        Tree[a - 1].push_back(b - 1);
        Tree[b - 1].push_back(a - 1);
    }
    int dia = 0;
    {
        int a, b;
        tie(a, b) = diameter(Tree, 0, -1);
        tie(dia, a) = diameter(Tree, b, -1);
    }
    dump(dia);
    vector<bool> isWin(dia, false);
    isWin[0] = true;
    isWin[1] = false;
    REP(i, 2, dia) {
        isWin[i] = !(isWin[i - 1] * isWin[i - 2]);
    }
    cout << (isWin[dia - 1] ? "First" : "Second") << endl;

    return 0;
}


Measured memory_bytes: 26880
#include <algorithm>
#include <bitset>
#include <cmath>
#include <complex>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <vector>

const int MOD = 1e9 + 7;
const int iINF = 2147483647 / 2;
const long long int llINF = 9223372036854775807 / 2;

using namespace std;
using ll = long long int;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vvvl = vector<vector<vector<ll>>>;

typedef pair<ll, ll> pll;
bool paircomp(const pll &a, const pll &b) {
  if (a.first == b.first)
    return a.second < b.second;
  return a.first < b.first;
}

#define REP(i, n) for (ll i = 0; i < (n); i++)
#define RREP(i, n) for (ll i = (n)-1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define AUTO(i, m) for (auto &i : m)
#define ALL(a) (a).begin(), (a).end()
#define MAX(vec) *std::max_element(vec.begin(), vec.end())
#define MIN(vec) *std::min_element(vec.begin(), vec.end())
#define ARGMAX(vec)                                                            \
  std::distance(vec.begin(), std::max_element(vec.begin(), vec.end()))
#define ARGMIN(vec)                                                            \
  std::distance(vec.begin(), std::min_element(vec.begin(), vec.end()))
#define REV(T) greater<T>()
#define PQ(T) priority_queue<T, vector<T>, greater<T>>
#define VVL(a, b, c) vector<vector<ll>>(a, vector<ll>(b, c))
#define VVVL(a, b, c, d)                                                       \
  vector<vector<vector<ll>>>(a, vector<vector<ll>>(b, vector<ll>(c, d)))
#define SP(a) setprecision(a)
#define SQRT(a) sqrt((long double)(a))
#define DPOW(a, b) pow((long double)(a), (long double)(b))
#define UNIQUE(vec)                                                            \
  do {                                                                         \
    sort(ALL((vec)));                                                          \
    (vec).erase(std::unique(ALL((vec))), (vec).end());                         \
  } while (0)

ll POW(ll n, ll m) {
  if (m == 0) {
    return 1;
  } else if (m % 2 == 0) {
    ll tmp = POW(n, m / 2);
    return (tmp * tmp);
  } else {
    return (n * POW(n, m - 1));
  }
}

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

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ll N, K;
  cin >> N >> K;
  vl A(N);
  REP(i, N) cin >> A[i];
  vl DP1(N + 1, 0);
  vl DP2(N + 1, 0);
  REP(i, N) {
    DP1[i + 1] = DP1[i] + max(0LL, A[i]);
    DP2[i + 1] = DP2[i] + A[i];
  }
  ll ans = 0;
  REP(i, N - K + 1) {
    ll score = DP1[i] + DP1[N] - DP1[i + K];
    score += max(DP2[i + K] - DP2[i], 0LL);
    ans = max(score, ans);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 2560
#define _USE_MATH_DEFINES

#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <iterator>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <bitset>

#include <queue>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <ctime>
////
//#include <random>//
/////////

typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;

////定数
const int INF = (int)1e9 + 10;
const LL MOD = (LL)1e9 + 7;
const LL LINF = (LL)4e18 + 20;
const LD PI = acos(-1.0);
const double EPS = 1e-9; 
/////////
using namespace::std;
void chmax(LL& a, LL b) {
	a = max(a, b);
}
//////////////

void solve() {
	int N;
	cin >> N;
	vector<LL> A(N);
	vector<vector<int>>B(N,vector<int>(64,0));
	for (int i = 0; i < N; ++i) {
		cin >> A[i];//ここでMODとるのはだめ。
		LL temp = A[i];
		for (int j = 0; j < 64; ++j) {
			if (temp & 1) {
				B[i][j] = 1;
			}
			temp /= 2;
		}
	}
	for (int i = 0; i < N; ++i) {
		for (int j = 0; j < 64; ++j) {
			if (i > 0) {
				B[i][j] += B[i - 1][j];
			}
		}
	}
	LL sum = 0;
	for (int i = 0; i < N - 1; ++i) {
		LL ter = A[i];
		LL base = 1;
		for (int j = 0; j < 64; ++j) {
			if (ter & 1) {
				//0の数を数える。
				LL res = N-(i+1) - (B[N - 1][j] - B[i][j]);
				sum += (base * res)%MOD;
				sum %= MOD;
			}
			else {//1の数
				LL res = (B[N - 1][j] - B[i][j]);
				sum += (base * res)%MOD;
				sum %= MOD;
			}
			ter = ter / 2;
			base = (base*2)%MOD;
		}
	}
	cout << sum << endl;
}

signed main(void) {
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	

	solve();
}


Measured memory_bytes: 89344
#include<iostream>
#include<vector>

using namespace std;

vector<int> blue,red,redpair,v;
vector<vector<int> >c;
/*blue[i]??§i?????????????????????????????°???,red[i]??§i?????????????????????????????°???,redpair[i]??§i??????????????????????????¨?????¢????????????????????????????????????????????????,v[i]??§i??????????????????????????????????????????????????????(1:?????????0:??????)
c[i][j]??§blue[i]??¨red[j]????????¢?????§???????????¨???*/
int m=0,n=0;

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

bool match(int x){
	if(x==-1)return 1;
	for(int i=0;i<n;i++){
		if(c[x][i]==1 && v[i]==0){
			v[i]=1;
			if(match(redpair[i])){
				redpair[i]=x;
				return 1;
			}
		}
	}
	return 0;
}

int main(){
	while(cin>>m>>n){
		if(m==0 && n==0){break;}
		blue.clear();
		red.clear();
		redpair.clear();
		v.clear();
		c.clear();
		for(int i=0;i<m;i++){
			int tmp=0;
			cin>>tmp;
			blue.push_back(tmp);
		}
		for(int i=0;i<n;i++){
			int tmp=0;
			cin>>tmp;
			red.push_back(tmp);
			redpair.push_back(-1);//-1??§?????¢??????????????¶????????¨???
			v.push_back(0);
		}
		for(int i=0;i<m;i++){
			c.push_back(vector<int>());
			for(int j=0;j<n;j++){
				c[i].push_back(gcd(blue[i],red[j])!=1);
			}
		}
		int ans=0;
		for(int i=0;i<m;i++){
			for(int j=0;j<n;j++){
				v[j]=0;
			}
			if(match(i)){ans++;}
		}
		cout<<ans<<endl;
	}
	return 0;
}

Measured memory_bytes: 2156
use std::cmp::Ord;
use std::fmt::Display;

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

fn print_vec<T: Display>(a: &Vec<T>, n: usize) {
    for i in 0..n {
        print!("{}", a[i]);
        if i == n - 1 {
            println!("");
        } else {
            print!(" ");
        }
    }
}

fn bubble_sort<T: Ord + Clone>(a: &mut Vec<T>, n: usize) -> u32 {
    let mut cnt: u32 = 0;
    let mut flag = true;
    while flag {
        flag = false;
        for j in (1..n).rev() {
            if a[j] < a[j - 1] {
                let tmp = a[j].clone();
                a[j] = a[j - 1].clone();
                a[j - 1] = tmp;
                flag = true;
                cnt += 1;
            }
        }
    }
    cnt
}

fn main() {
    let n: usize = read();
    let mut a: Vec<i32> = read_vec();

    let c = bubble_sort(&mut a, n);

    print_vec(&a, n);

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



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

using namespace std;

long long A, B;
 
int main()	{
	scanf("%lld%lld", &A, &B);
	if((A + B) & 1)	{
		printf("IMPOSSIBLE");
	}
	else	{
		printf("%lld", (A + B) / 2);
	}
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<utility>
#include<algorithm>
#include<map>
#include<cmath>
#include<bitset>
typedef long long ll;
#define PB	push_back
#define FOR(n)			for(int i = 0; i < n; ++i)
#define RFOR(n)			for(int i = n; i >= 0; --i)
#define FORR(start,end) for(int i = start; i < end; ++i)
#define COUT(n)			cout << n << " " << flush
#define vi(v)			vector<int> v
#define vii(v)			vector<pair<int,int>> v
#define pii(p)			pair<int,int> p
#define mii(m)			map<int, int> m
#define msi(m)			map<string, int, less<>> m
#define mmsi(m)			multimap<string, int, less<>> m
#define mkp(a,b)		make_pair(a,b)
#define ALL(obj)		obj.begin(), obj.end()
#define PI 3.141592
#define MOD 1e9+7
using namespace std;

void solve() {
	int n, m;
	vi(p);
	vector<string> s;
	cin >> n >> m;
	p.resize(m); s.resize(m);
	FOR(m) {
		cin >> p[i];
		cin >> s[i];
	}

	vi(ac)(n); vi(pn)(n);
	FOR(n) {
		ac[i] = 0; pn[i] = 0;
	}

	for (int i = 0; i < m; ++i) {
		if (ac[p[i]-1] == 0 && s[i] == "AC") 
			++ac[p[i]-1];
		else if(ac[p[i] - 1] == 0)
			++pn[p[i]-1];
	}
	int ansac = 0, anspn = 0;
	FOR(n) {
		ansac += ac[i];
		if(ac[i] == 1)
		anspn += pn[i];
	}
	cout << ansac << ' ' << anspn << endl;
}

int main() {
	solve();
	return 0;
}

Measured memory_bytes: 6912
K=int(input())
num=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(num[K-1])

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;

int n;
string s;
int sz;
int cumL[100010], cumR[100010];
int posL[100010], posR[100010];

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  cin >> n >> s;
  sz = s.size();
  int tmp = 0;
  for (int i = 0; i < sz; i++) {
    if (i) cumL[i] = cumL[i - 1];
    if (s[i] == '>') {
      cumL[i]++;
      posL[tmp++] = i;
    }
  }
  tmp = 0;
  for (int i = sz - 1; i >= 0; i--) {
    if (i + 1 < sz) cumR[i] = cumR[i + 1];
    if (s[i] == '<') {
      cumR[i]++;
      posR[tmp++] = i;
    }
  }

  int ans = 0;
  for (int i = 0; i < sz; i++) {
    if (s[i] == '>') {
      if (cumL[i] <= cumR[i]) {
        ans = max(ans, posR[cumR[i] - cumL[i]] + 1);
      } else {
        ans = max(ans, n - posL[cumL[i] - cumR[i] - 1]);
      }
    } else {
      if (cumL[i] >= cumR[i]) {
        ans = max(ans, n - posL[cumL[i] - cumR[i]]);
      } else {
        ans = max(ans, posR[cumR[i] - cumL[i] - 1] + 1);
      }
    }
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 4516
#include <bits/stdc++.h>
 using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
 int main(){
   int a,b,c;
   cin>>a>>b>>c;
   if(a+b+c>=22){
    cout<<"bust"<<endl;
   }
   else{
    cout<<"win"<<endl;
   }

}

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

/*
,,,,
　　　　　　　　　　　　　　　　　　　　　　　　　　,.斗*''“i:i:{
　　　　　　　　　　　　　,.　｡. . . * : : : ''' : : : :” :”“ ''ｰ - 弋,,_
　　　　　 　 　 ,.斗*''“ : : : : : : : : : : : : : ' ' ' ' ' ' : : : : : : : : : : :”: '':* ｡ ,
　　　 ,.斗*''“ ” ＼：　　 ”・・． ' ' ' '　　　　　　　　 ' ' ' ' : : : : : : : : : : : : ”ミ*｡,,,,,,　　　　　　 　 　 　 ＿
　　く.　 ◎　 ﾞ:.ﾞ:..　ﾟ:,　:　───────────　　　--　　,,,,,,__ ' ' ' :.:.:.:.:.”≧s｡.　　＿,,,｡s*i:i:i:i:<
　　ﾏ*s｡ :,　 }　ﾟ:,　 :}　　　　　　　　　　　　　　　　　　　　　　　　　　　　”　''　-　”””：：”：：`*｡i:i:i:i:i:i:i;:’
　　　` .｡`　 ,　,ノ ／｡ ,,,_　　　　　　　　　　　　　　　　　　　　　　　　　　　　　＿＿`　　} }　　ﾉi:i:i:i:i:ﾂ
　　　　　 `　*　｡　　`*｡i:i:i::*=-　　　　　　　　　　　＿＿　　　　　　,,,....｡s*'i,:’　　　”`*｡＿,*’i:i:i:i:r’
　　　　　　　　　　　”　─ --　　　　｡｡｡｡｡　　 -　－`''''''''ヽ ─ '''”　　　｀ｰ“　　　　　　　`*｡i:i:i:i:i:i:
　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　`*｡i:i:::
　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　`*ﾟ:,
         fozubaoyou    no BUGs alive!
*/

typedef long long ll;
//{
#define mp make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define dumo dump
//}

#define debug_interval ','
#define dump_interval endl
#define debug_toggle 0

//{
inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}
template<class...A> inline void dump(){cout<<endl;}
template<class...A> inline void dump_rest() {cout<<endl;}
template<class T, class...A> inline void dump_rest(const T& first, const A&... rest){cout<<dump_interval<<first;dump_rest(rest...);}
template<class T,class...A> inline void dump(const T&first,const A&...rest){cout<<first;dump_rest(rest...);}
template<class...A> inline void debug(){cout<<endl;}
template<class...A> inline void debug_rest() {cout<<endl;}
template<class T, class...A> inline void debug_rest(const T& first, const A&... rest){cout<<debug_interval<<first;debug_rest(rest...);}
template<class T,class...A> inline void debug(const T&first,const A&...rest){if(debug_toggle)cout<<first,debug_rest(rest...);}
//}

ll a,b,c,sum,n,m;

int main(){
  cin>>a>>b;
  c=abs(a-2)*abs(b-2);
  dump(c);
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;


public class Main {

	/**
	 * @param args
	 * @throws IOException 
	 */
	public static void main(String[] args) throws IOException {
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		Manager manager = new Manager();
		
		while(true){
			String str = br.readLine();
			
			if(str == null){
				break;
			}
			
			String[] strArray = str.split(",");
			
			manager.swap(strArray[0], strArray[1]);
		}
		
		System.out.println(manager.currentBallPos());

	}

}

class Manager {
	int ballPos = 0;
	
	public void swap(String s1, String s2){
		int index1 = strToIndex(s1);
		int index2 = strToIndex(s2);
		
		if(index1 == ballPos){
			ballPos = index2;
		}
		else if(index2 == ballPos){
			ballPos = index1;
		}
	}
	
	public char currentBallPos(){
		
		char result;
		switch (ballPos){
		case 0:
			result = 'A';
			break;
		case 1:
			result = 'B';
			break;
		case 2:
			result = 'C';
			break;
		default:
			result = 'F';
		}
		
		return result;
	}
	
	private int strToIndex(String str){
		if(str.equals("A")){
			return 0;
		}
		else if (str.equals("B")){
			return 1;
		}
		else {
			return 2;
		}
	}
}

Measured memory_bytes: 24196
def resolve():
	s = list(input())
	k = int(input())
	for i in range(len(s)):
		if int(s[i]) == 1:
			continue
		else:
			for j in range(i, len(s)):
				s[j] = s[i]
	if k < len(s):
		print(s[k-1])
		return
	print(s[-1])
resolve()

Measured memory_bytes: 38512
#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int x=0;
  if(s=="SUN") {
    x=7;}
  else if(s=="MON") {
    x=6;}
  else if(s=="TUE") {
    x=5;}
  else if(s=="WED") {
    x=4;}
  else if(s=="THU") {
    x=3;}
  else if(s=="FRI") {
    x=2;}
  else if(s=="SAT") {
    x=1;}
  cout << x << endl;
  }


Measured memory_bytes: 256
#include<algorithm>
#include<cstdio>
#include<vector>

using namespace std;

const int N_MAX = 2 * 1e5, Q_MAX = 2 * 1e5;

struct ver {
    int cnt = 0;
    vector<int> to;
};

ver v[N_MAX];
int cost[N_MAX];

void dfs(int, int);

int main() {
    int n, q;
    scanf("%d %d", &n, &q);
    for (int i = 0; i < n - 1; i++) {
        int a, b;
        scanf("%d %d", &a, &b);
        v[a - 1].to.push_back(b - 1);
        v[b - 1].to.push_back(a - 1);
    }
    for (int i = 0; i < q; i++) {
        int cn, cc;
        scanf("%d %d", &cn, &cc);
        cost[cn - 1] += cc;
    }

    dfs(0, 0);
    
    for (int i = 0; i < n - 1; i++) printf("%d ", v[i].cnt);
    printf("%d\n", v[n - 1].cnt);
    return 0;
}

void dfs(int m, int prn) {
    v[m].cnt = v[prn].cnt + cost[m];
    while (v[m].to.size() > 0) {
        if (v[m].to.back() != prn) dfs(v[m].to.back(), m);
        v[m].to.pop_back();
    }
}


Measured memory_bytes: 24832
n, t = map(int, input().split())
c_t = [list(map(int, input().split())) for _ in range(n)]

cost = []

for i in range(n):
    if c_t[i][1] <= t:
        cost.append(c_t[i][0])
if len(cost) == 0:
    print("TLE")
else:
    print(min(cost))

Measured memory_bytes: 3060
/*
*/
#include<cstdio>
#include<iostream>
#include<cstring>
#define LL long long 
using namespace std;
const int MAXN = 2001;
inline int read() {
	char c = getchar(); int x = 0, f = 1;
	while(c < '0' || c > '9') {if(c == '-') f = -1; c = getchar();}
	while(c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
	return x * f;
}
int N, M, Q;
char s[MAXN][MAXN];
int P[MAXN][MAXN], R[MAXN][MAXN], L[MAXN][MAXN];
int GetP(int x, int y) {
	if(x == 0 || y == 0) return 0;
	return P[x - 1][y] + P[x][y - 1] - P[x - 1][y - 1];
}
int GetR(int x, int y) {
	if(x == 0 || y == 0) return 0;
	return R[x - 1][y] + R[x][y - 1] - R[x - 1][y - 1];
}
int GetL(int x, int y) {
	if(x == 0 || y == 0) return 0;
	return L[x - 1][y] + L[x][y - 1] - L[x - 1][y - 1];
}
main() {
	N = read(); M = read(); Q = read();
	for(int i = 1; i <= N; i++) {
		scanf("%s", s[i] + 1);
		for(int j = 1; j <= M; j++) {
			P[i][j] = GetP(i, j);
			R[i][j] = GetR(i, j);
			L[j][i] = GetL(j, i);//tag
			if(s[i][j] == '1') L[j][i] += (s[i - 1][j] == '1'),
							   R[i][j] += (s[i][j - 1] == '1'), 
							   P[i][j]++;
		}
	}
	/*for(int i = 1; i <= N; i++, puts(""))
		for(int j = 1; j <= M; j++)
			printf("%d ", R[i][j]);*/
	while(Q--) {
		int x1 = read(), y1 = read(), x2 = read(), y2 = read();
		// printf("%d %d %d %d\n", GetP(x2, y2), GetP(x1 - 1, y2), GetP(x2, y1 - 1), GetP(x1 - 1, y1 - 1));
		int ans1 = P[x2][y2] - P[x1 - 1][y2] - P[x2][y1 - 1] + P[x1 - 1][y1 - 1];
		int ans2 = R[x2][y2] - R[x1 - 1][y2] - R[x2][y1] + R[x1 - 1][y1];
		int ans3 = L[y2][x2] - L[y1 - 1][x2] - L[y2][x1] + L[y1 - 1][x1];
		cout << ans1 - ans2 - ans3 << endl;
	}
    return 0;
}
/*

*/

Measured memory_bytes: 52608
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_poizcy.hpp>
typedef long long  ll;
#define pb                push_back
#define mp                make_pair
#define all(a)            (a).begin(), (a).end()
#define mem(a,h)          memset(a, (h), sizeof(a))
#define se second
#define por(a,b) (((a%MOD) * (b%MOD))%MOD)
#define forg(i, b, e, c)    for (ll i = (ll)b; i < (ll)e; i+=c)
#define forr(i, b, e)    for (ll i = b; i < e; i++)
 
 
using namespace std;
//using namespace __gnu_pbds;
typedef double lldb;
typedef pair<ll, ll>  ii;
typedef pair<double, ii>  iii;
typedef pair<double, double>  iidb;
typedef vector<ll>     vi;
typedef vector<vi>     vvi;
typedef vector<ii>      vii;
typedef vector<ll>      vll;
//typedef tree<ii,null_type,less<ii>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
const ll INF = 1e9+7;
const double PI = acos(-1);
#define initseg ll new_nodo=(pnodo*2),mid=(iz+der)/2;
 
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define tam 3600
#define offset 3000
#define ptr nodo*
const ll MOD=1e9+7;

using namespace std;


int main()
{	
	ios::sync_with_stdio(false);cin.tie(0);
	int n;
	cin>>n;
	forr(a,1,tam)
	{
		forr(b,1,tam)
		{
			ll num1=4*a*b-n*a-n*b;
			ll num2=n*a*b;
			if (num1<=0)continue;
			if (num2%num1==0)
			{
				cout<<num2/num1<<" "<<a<<' '<<b<<endl;
				return 0;
			}
		}
	}
}			

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

using namespace std;

typedef double D;
typedef long long int LL;

#define st first
#define nd second
#define pb push_back
#define PII pair <int, int>

const int N = 1e5 + 7;
const int MX = 1e9 + 7;
const LL INF = 1e18 + 7LL;

string rotate(string a){
	string ret;
	ret.push_back(a[a.size() - 1]);
	for(int i = 0; i + 1 < a.size(); ++i)
		ret.push_back(a[i]);
	return ret;
}

int main(){
	int cnt = 150;
	string a, b;
	cin >> a >> b;
	
	while(cnt--){
		if(a == b){
			cout << "Yes";
			return 0;
		}
		
		a = rotate(a);
	}
	
	cout << "No";
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
using namespace std;
static const double EPS = 1e-5;
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define sz(a) a.size()
#define all(a) a.begin(),a.end()
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define SS stringstream
#define DBG1(a) rep(_X,sz(a)){printf("%d ",a[_X]);}puts("");
#define DBG2(a) rep(_X,sz(a)){rep(_Y,sz(a[_X]))printf("%d ",a[_X][_Y]);puts("");}
#define bitcount(b) __builtin_popcount(b)
#define inf (1<<26)
typedef int Weight;
typedef int weight;

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

bool operator < (const Edge &e, const Edge &f) {
  return e.weight != f.weight ? e.weight > f.weight : // !!INVERSE!!
    e.src != f.src ? e.src < f.src : e.dst < f.dst;
}
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;
typedef vector<Edge> edges;
typedef vector<Edges> graph;

typedef vector<Weight> Array;
typedef vector<Array> Matrix;
typedef vector<Weight> array;
typedef vector<Array> matrix;

weight minimum_steiner_tree(const vector<int>& T, const matrix &g) {
  const int n = g.size();
  const int numT = T.size();
  if (numT <= 1) return 0;

  matrix d(g); // all-pair shortest
  for (int k = 0; k < n; ++k)
    for (int i = 0; i < n; ++i)
      for (int j = 0; j < n; ++j)
        d[i][j] = min( d[i][j], d[i][k] + d[k][j] );

  weight OPT[(1 << numT)][n];
  for (int S = 0; S < (1 << numT); ++S)
    for (int x = 0; x < n; ++x)
      OPT[S][x] = inf;

  for (int p = 0; p < numT; ++p) // trivial case
    for (int q = 0; q < n; ++q)
      OPT[1 << p][q] = d[T[p]][q];

  for (int S = 1; S < (1 << numT); ++S) { // DP step
    if (!(S & (S-1))) continue;
    for (int p = 0; p < n; ++p)
      for (int E = 0; E < S; ++E)
        if ((E | S) == S)
          OPT[S][p] = min( OPT[S][p], OPT[E][p] + OPT[S-E][p] );
    for (int p = 0; p < n; ++p)
      for (int q = 0; q < n; ++q)
        OPT[S][p] = min( OPT[S][p], OPT[S][q] + d[p][q] );
  }
  weight ans = inf;
  for (int S = 0; S < (1 << numT); ++S)
    for (int q = 0; q < n; ++q)
      ans = min(ans, OPT[S][q] + OPT[((1 << numT)-1)-S][q]);
  return ans;
}
int main(){
    int w,h;
	int dx[] = { 1, 0,-1, 0} , 
		dy[] = { 0,-1, 0, 1};
    while(cin >> h >> w, w){
        vector<int> T;
        rep(i,h)rep(j,w){
            bool t; cin >> t;
            if(t)T.push_back(w*i+j);
        }
        int sz = T.size();
        vector< vector<int> > table(h*w,vector<int>(w*h,1<<25));
        rep(i,h*w)table[i][i]=0;
		rep(i,h)rep(j,w){
			rep(d,4){
				int x = j+dx[d] , y = i+dy[d];
				if(x < w && y < h && y>=0 && x >=0){
					table[i*w+j][y*w+x] = 1;
				}
			}
		}
        int ans = minimum_steiner_tree(T,table);
        cout << w*h-(ans+1) << endl;
    }
}

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

typedef long long int ll;

ll ar[1<<17+5];

int main() {
    ll n;
    set<ll>st;
    ll x;
    cin >> n;
    while(n--){
        cin>>x;
        st.insert(x);
    }cout<<st.size()<<endl;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <bitset>
#include <complex>
#include <unistd.h>
#include <cassert>
#include <cctype>
#include <random>
#include <time.h>
#define _USE_MATH_DEFINES
#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef pair<double, ll> pdlg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef tuple<double, double, double> tddd;
typedef complex<double> xy_t;
typedef vector<ll> vll;
typedef vector< vector<ll> > matrix;
#define REP(i, x, y) for(ll i = (ll)x; i < (ll)y; i++)
#define DREP(i, x, y, d) for(ll i = (ll)x; i < (ll)y; i += (ll)d)
#define PER(i, x, y) for(ll i = (ll)x; i > (ll)y; i--)
#define DPER(i, x, y, d) for(ll i = (ll)x; i > (ll)y; i -= (ll)d)
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
double pi = 3.141592653589793;
ll mod = 1000000007;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;
int iinf = intmax / 8;
ll inf = llmax / 8;
double eps = 1e-11;

ll dp[410][410];
ll sum[410];

ll rec(ll left, ll right) {
    if (dp[left][right] > 0) {
        return dp[left][right];
    }
    if (left == right) {
        return 0;
    }

    ll ans = inf;
    REP(i, left, right) {
        ans = min(ans, rec(left, i) + rec(i + 1, right) + sum[right + 1] - sum[left]);
    }

    return dp[left][right] = ans;
}

int main() {
    ll N;
    cin >> N;
    ll a[N];
    REP(i, 0, N) {
        cin >> a[i];
    }
    sum[0] = 0;
    REP(i, 0, N) {
        sum[i + 1] = sum[i] + a[i];
    }
    REP(i, 0, 410) {
        fill(dp[i], dp[i] + 410, 0);
    }
    ll ans = rec(0, N - 1);
    cout << ans << endl;
}


Measured memory_bytes: 1536
#include <iostream>
using namespace std;
int main(){
	int a;
	cin>>a;
	if(a<1200){
		cout<<"ABC"<<endl;;
	}else if((a>=1200)&&(a<2800)){
		cout<<"ARC"<<endl;
		
	}else{
		cout<<"AGC"<<endl;	
	}

return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define sz size()
#define all(x) (x).begin(), (x).end()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)

#define ll long long

int main() {


	int x;
	cin>>x;
	if (x>=30) cout<<"Yes\n";
		else cout<<"No\n";


    return 0;
}

Measured memory_bytes: 3620
// whats 1000 minus 7 ?
// I'm bad, and that's good. I will never be good, and that's not bad. There's no one I'd rather be than me.
// unless someone like you cares a whole awful lot nothing is going to get better. it's not
#include <bits/stdc++.h>
using namespace std;
inline int in(){int32_t x ; scanf("%d",&x) ; return x ; }
inline long long lin(){long long x ; scanf("%lld",&x) ; return x ;}
inline string get(){char ch[2000010] ; scanf("%s",ch) ; return ch;}
const int MAX_LG = 21;
#define int long long
#define X first
#define Y second
#define endl "\n"
#define Mp make_pair
#define amin main
typedef pair<int , int > pii;
typedef long double ld;
typedef unsigned long long ull;
typedef long long ll;
typedef vector<int> vi;
typedef vector<pii> vii;
const int maxn = 1e5 + 10;
const int base = 29;
const int mod = 1e9 + 7;
const int INF = 1e10 + 100;
int32_t main()
{
    int a = in() , b = in() , c = in();
    if (a % 2 == 0 || b % 2 == 0 || c % 2 == 0) return cout << 0 << endl , 0;
    int arr[] = {a,b,c};
    sort(arr,arr+3);
    cout << arr[0] * arr[1] << endl ;
    
}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#include<vector>
#include<cmath>

#define MAXX 65555

unsigned long long gcd(const unsigned long long &a,const unsigned long long &b)
{
    return b?gcd(b,a%b):a;
}

unsigned long long n,i,j,k,m;
unsigned long long num[MAXX],g;
std::vector<unsigned long long>ev,od;

int main()
{
    ev.reserve(MAXX);
    od.reserve(MAXX);
    while(scanf("%llu",&n),n)
    {
        m=n*(n+1)/2;
        ev.resize(0);
        od.resize(0);
        for(i=0;i<m;++i)
        {
            scanf("%llu",num+i);
            if(!(num[i]&1))
                ev.push_back(num[i]);
            else
                od.push_back(num[i]);
        }
        std::sort(ev.begin(),ev.end());
        std::sort(od.begin(),od.end());
        g=ev[0];
        for(i=1;i<ev.size();++i)
            g=gcd(g,ev[i]);
        k=od[0]/(ev[0]/g)/(ev[1]/g);
        g/=sqrt(k);
        printf("%llu\n%llu",g,ev[0]/g);
        for(i=1;i<ev.size();++i)
            printf(" %llu",ev[i]/g);
        puts("");
    }
    return 0;
}

Measured memory_bytes: 1536
#include <stdio.h>

int main(void)
{
	char r[8], a[8];
	
	while (scanf("%s %s", r, a) * r[1] != 0){
		int i, j;
		int hit, blow;
		
		hit = blow = 0;
		for (i = 0; i < 4; i++){
			for (j = 0; j < 4; j++){
				if (r[i] == a[j]){
					i == j ? hit++ : blow++;
				}
			}
		}
		printf("%d %d\n", hit, blow);
	}
	
	return 0;
}

Measured memory_bytes: 540
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

int main(){

	int n, k, tmp, ans=0;

	cin>> n >> k;
	for(int i=0;i<n;i++){
		cin>> tmp;
		if(k<=tmp) ans++;
	}

	cout<< ans << endl;

}

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

int flag;

void dfs(int n){
     if (n < 0) return ;
     if(n == 0){
         flag = 1;
         //cout << "Yes"<<endl;
         return ;
     }
     dfs(n - 4);
     dfs(n - 7);
}

int main(){

   int n;
   while(cin >> n ){
        flag = 0;
        dfs(n);
        if(!flag) cout << "No" <<endl;
        else  cout << "Yes" <<endl;

   }
  return 0;
}


Measured memory_bytes: 256
# include"stdio.h"
# include"stdlib.h"
int main(){
    int n,m;
    scanf("%d %d",&n,&m);
    int s[n][2],c[m][2],dis,min=3*1.0e+8,memo[n];
    for(int i=0;i<n;i++)
        scanf("%d %d",&s[i][0],&s[i][1]);
    for(int i=0;i<m;i++)
        scanf("%d %d",&c[i][0],&c[i][1]);
    for(int i=0;i<n;i++){
         for(int j=0;j<m;j++){
             dis = abs(s[i][0]-c[j][0])+abs(s[i][1]-c[j][1]);
             if(dis<min){
                 min=dis;
                 memo[i]=j+1;
             }
         }
         min =3*1.0e+8;
    }
    for(int i=0;i<n;i++)
        printf("%d\n",memo[i]);
}


Measured memory_bytes: 1708
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

#define MAX_N 300001

bool is_mfp[MAX_N];

void init() {
    is_mfp[0] = is_mfp[1] = is_mfp[2] = false;
    for (int i = 3; i < MAX_N; i++) {
        if (i % 7 == 1 || i % 7 == 6) is_mfp[i] = true;
        else is_mfp[i] = false;
    }
    for (int i = 6; i < MAX_N; i++) {
        if (is_mfp[i]) {
            for (int j = i+i; j < MAX_N; j+=i) {
                is_mfp[j] = false;
            }
        }
    }
}

vector<int> mfp_factors(int n) {
    vector<int> mfp_fs;
    for (int i = 6; i <= n; i++) {
        if (is_mfp[i] && n % i == 0) {
            mfp_fs.push_back(i);
        }
    }
    return mfp_fs;
}

int main() {
    init();
    int n;
    while (cin >> n, n != 1) {
        cout << n << ":";
        vector<int> mfp_fs = mfp_factors(n);
        for (int i = 0; i < mfp_fs.size(); i++) {
            cout << ' ' << mfp_fs[i];
        }
        cout << endl;
    }
    return 0;
}

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

bool dp[81][81][30000];
const int dis = 15000;

int main() {
  int H, W; cin >> H >> W;
  vector<vector<int>> A(H, vector<int>(W, 0));
  vector<vector<int>> B(H, vector<int>(W, 0));
  vector<vector<int>> D(H + 1, vector<int>(W + 1, 0));
  rep(h, H) rep(w, W) cin >> A[h][w];
  rep(h, H) rep(w, W) {
    cin >> B[h][w];
    D[h][w] = A[h][w] - B[h][w];
  }

  dp[0][0][D[0][0] + dis] = true;
  dp[0][0][-D[0][0] + dis] = true;

  rep(h, H) rep(w, W){
    rep(i, 30000) {
      if (dp[h][w][i]) {
        dp[h][w + 1][i + D[h][w + 1]] = true;
        dp[h + 1][w][i + D[h + 1][w]] = true;
        dp[h][w + 1][i - D[h][w + 1]] = true;
        dp[h + 1][w][i - D[h + 1][w]] = true;
      }
    }
  }
  const int INF = 1e9 + 10;
  int ans = INF;
  rep(i, 30000) {
    if (dp[H - 1][W - 1][i]) {
      ans = min(ans, abs(i - dis));
    }
  }

  cout << ans << endl;
}

Measured memory_bytes: 190848
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
 
using namespace std;
using sl = signed long;
using sll = signed long long;
using ll = long long;
 
// -exec call dup2(open("input.txt", 0), 0)
int main(int argc, char *argv[])
{
	int N;
	cin >> N;
	string tmp;
	vector<string> vec;
 
	for(int i=0;i<N;i++){
		cin >> tmp;	
		sort(tmp.begin(), tmp.end());
		vec.push_back(tmp);
	}
 
	sort(vec.begin(), vec.end());
 
	int cnt = 0, k = 0; ll sum = 0;
	for(int i=1;i<N;i++){
		if (vec[i]==vec[cnt] ){
			k++;
			sum += k;
		}else{
			k = 0;
			cnt = i;
		}
	}
 
	cout << sum;
	return 0;
}

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

const int MOD=1000000007;
const int INF=0x3f3f3f3f;
const ll INFL=0x3f3f3f3f3f3f3f3f;

int a[3000];
ll dp[3000][3000];

int main(){
	int n;cin>>n;
	vector<P>v;
	rep(i,n){
		scanf("%d",&a[i]);
		v.push_back(P(a[i],i));
	}
	sort(v.begin(),v.end(),greater<>());
	memset(dp,-1,sizeof(dp));
	dp[0][0]=0;
	rep(i,n)rep(j,i+1){
		if(dp[i][j]==-1)continue;
		dp[i+1][j+1]=max(dp[i+1][j+1],dp[i][j]+v[i].first*(ll)abs(v[i].second-j));
		dp[i+1][j]=max(dp[i+1][j],dp[i][j]+v[i].first*(ll)abs(v[i].second-(n-(i-j)-1)));
	}
	cout<<*max_element(dp[n],dp[n]+n+1)<<endl;
}

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

int main() {
    std::string S;
    std::cin >> S;

    if (std::regex_match(S, std::regex("^(dream|dreamer|erase|eraser)+$"))) {
        std::cout << "YES" << std::endl;
    } else {
        std::cout << "NO" << std::endl;
    }

    return 0;
}

Measured memory_bytes: 28216
# DP
mod = 1000000007

n, m = map(int, input().split())
b_list = [True] * (n+1)
dp = [0 for _ in range(n+1)]
for i in range(m):
    b_list[int(input())] = False

dp[0] = 1
for i in range(n):
    for j in range(i+1, min(n, i+2)+1):
        if b_list[j] == True:
            dp[j] += dp[i]
            dp[j] %= mod
# print(b_list)
# print(dp)
print(dp[n])


Measured memory_bytes: 7864
#include<stdio.h>
#include<math.h>

typedef struct {
  double x, y;
} Point;

void print(Point p);
void plot(int n, Point p1, Point p2);

int main(){
  Point p1, p2;
  int n;
  scanf("%d", &n);

  p1.x = 0;
  p1.y = 0;
  p2.x = 100;
  p2.y = 0;
  print(p1);
  plot(n, p1, p2);
  print(p2);

  return 0;
}

void print(Point p){
  printf("%.8f %.8f\n", p.x, p.y);
}

void plot(int n, Point p1, Point p2){
  Point s, t, u;
  double th = 60.0*(acos(-1)/180.0);
  if ( n == 0 ) return;
  s.x = (2.0 * p1.x + 1.0 * p2.x)/3.0;
  s.y = (2.0 * p1.y + 1.0 * p2.y)/3.0;
  t.x = (1.0 * p1.x + 2.0 * p2.x)/3.0;
  t.y = (1.0 * p1.y + 2.0 * p2.y)/3.0;
  u.x = (t.x - s.x) * cos(th) - (t.y - s.y ) * sin(th) + s.x;
  u.y = (t.x - s.x) * sin(th) + (t.y - s.y ) * cos(th) + s.y;
  
  plot(n-1, p1, s);
  print(s);
  plot(n-1, s, u);
  print(u);
  plot(n-1, u, t);
  print(t);
  plot(n-1, t, p2);
}



Measured memory_bytes: 1996
x = int(input())
i = 0
num = []
for i in range(-1000,1000):
    num.append(i)
    i += 1
for i in range(2000):
    for j in range(2000):
        if num[i]**5 - num[j]**5 == x:
            print(num[i],num[j])
            exit()


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

int main() {
    int A,B;
    char S[20];
    int C, counts = 0;
    scanf("%d %d", &A, &B);
    scanf("%s", S);
    C = strlen(S);
    
    if(!(S[A] == '-')){
        printf("No");
        return 0;
    }
    for(int i=0;i<C;i++){
        if(S[i] == '-'){
            counts++;
        }
    }
    if(counts > 1){
        printf("No");
        return 0;
    }
    
    printf("Yes");
            
return 0;
}

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

using namespace std;

const int max_n = 200222, inf = 1000111222;

int n, k, a[max_n], sum[max_n];

void add(int l, int r, int x) {
    l = max(l, 0);
    r = min(r, n - 1);
    sum[l] += x;
    sum[r + 1] -= x;
}

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    scanf("%d%d", &n, &k);
    for (int i = 0; i < n; ++i) {
        scanf("%d", &a[i]);
    }
    while (k--) {
        fill(sum, sum + n, 0);
        for (int i = 0; i < n; ++i) {
            add(i - a[i], i + a[i], 1);
        }
        bool change = false;
        int x = 0;
        for (int i = 0; i < n; ++i) {
            x += sum[i];
            change |= x != a[i];
            a[i] = x;
        }
        if (!change) {
            break;
        }
    }
    for (int i = 0; i < n; ++i) {
        printf("%d ", a[i]);
    }
    puts("");
    return 0;
}


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

int main() {
	int H, N;
	cin >> H >> N;
	int sum = 0;
	for (int i = 0; i < N; i++) {
		int A;
		cin >> A;
		sum += A;
	}
	cout << (sum >= H ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
int a, b;
int main() {
	scanf("%d%d", &a, &b);
	if (a >= 13)printf("%d\n", b);
	if (a > 5 && a <= 12)printf("%d\n", b / 2);
	if (a <= 5)printf("0\n");
}

Measured memory_bytes: 128
#include <stdio.h>
int main () {
  int i, j, k;
  int H[99999], W[99999];
  for (i=0; i<99999; i++) {
    H[i]=0;
    W[i]=0;
  }
  i=0;
  while (1) {
    scanf("%d %d", &H[i], &W[i]);
    if (H[i]==0 && W[i]==0) {
      break;
    }
    i++;
  }
 
  for (i=0; i<99999; i++) {
    if (H[i] == 0 && W[i] == 0) {
      break;
    }
    for (j=0; j<H[i]; j++) {
      for (k=0; k<W[i]; k++) {
        if ((j % 2 == 0 && k % 2 == 0) || (j % 2 == 1 && k % 2 == 1)) {
          printf("#");
        } else {
          printf(".");
        }
      }
      printf("\n");
    }
    printf("\n");
  }
  return 0;
}

Measured memory_bytes: 1352
#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
#include <map>
using namespace std;

typedef long long ll;

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

//--------------------



int main() {

  double N, M, sum = 0;
  cin >> N >> M;
  vector<double> A(N);
  rep(i, N) {
    cin >> A[i];
    sum += A[i];
  }

  ll cnt = 0;
  rep(i, N) {
    if(A[i]>=sum*(1/(4*M))) {
      ++cnt;
    }
    if(cnt==M) {
      cout << "Yes" << endl;
      return 0;
    }
  }

  cout << "No" << endl;

  return 0;
}


Measured memory_bytes: 384
# 753数を列挙したほうが速い

N = int(input())


def func(s):
    global N
    if int(s) > N:
        return 0

    ret = 1 if all(s.count(c) > 0 for c in '753') else 0

    for char in '753':
        ret += func(s + char)
    return ret


print(func('0'))


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

using E = System.Linq.Enumerable;

using SyrupBeans.Competitive.Integer;

public class Program
{
    public static void Main()
    {
        var ab = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();
        var a = ab[0];
        var b = ab[1];
        Console.WriteLine(a / Divisibility.FindGcd(a, b) * b);
    }
}

namespace SyrupBeans.Competitive.Integer
{
    using Integer = System.Int64;

    using System;
    using System.Collections.Generic;
    using System.Linq;

    public static class Divisibility
    {
        /// <summary>O(log min(<paramref name="x" />, <paramref name="y" />))</summary>
        public static Integer FindGcd(Integer x, Integer y) => x < 1 ? y : FindGcd(y % x, x);

        /// <summary>O(sqrt(<paramref name="x" />))</summary>
        public static IEnumerable<Integer> EnumerateDivisors(Integer x)
        {
            var cache = new Stack<Integer>();
            for (Integer i = 1; i * i <= x; ++i)
            {
                Integer r, d = Math.DivRem(x, i, out r);
                if (r != 0)
                {
                    continue;
                }
                yield return i;
                cache.Push(d);
            }
            if (cache.Any() && cache.Peek() * cache.Peek() == x)
            {
                cache.Pop();
            }
            while (cache.Any())
            {
                yield return cache.Pop();
            }
        }
    }
}


Measured memory_bytes: 13396
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<random>
#include<array>
#include<cassert>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())

int n,t;
int a[200000];


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

	cin>>n>>t;
	rep(i,n){
		cin >> a[i];
	}
	long long ans=t;
	rep(i,n-1){
		ans += min(t,a[i+1]-a[i]);
	}
	cout<<ans<<endl;


	return 0;
}

Measured memory_bytes: 1024