akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<queue>
#include<map>
#define rep(index,num) for(int index=0;index<num;index++)
#define rep1(index,num) for(int index=1;index<=num;index++)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-15
typedef long long ll;
using namespace std;
typedef pair<int,int> pint;
typedef vector<int> vint;
int INF=2e+9+1;
int main(){
	int H,W;
	int c[10][10];
	int A[200][200];
	int mindis[10][10];
	int numcount[10]={0};
	int cost=0;
	scan(H);scan(W);
	rep(i,10){
		rep(j,10){
			scan(c[i][j]);
			mindis[i][j]=c[i][j];
		}
	}
	rep(i,H){
		rep(j,W){
			scan(A[i][j]);
			if(A[i][j]>=0) numcount[A[i][j]]++;
		}
	}
	rep(i,10){
		rep(j,10){
			rep(k,10){
				mindis[j][k]=min(mindis[j][k],mindis[j][i]+mindis[i][k]);
			}
		}
	}
	rep(i,10){
		cost+=numcount[i]*mindis[i][1];
	}
	prin(cost);

	return 0;
}


Measured memory_bytes: 384
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {
            var S = cin.ReadInt;
            var W = cin.ReadInt;
            WriteLine(S > W ? "safe" : "unsafe");
        }

        public void Display(int[] array)
        {
            var txt = "";
            foreach (var item in array)
            {
                txt += " " + item.ToString();
            }
            WriteLine("{0}", txt);
        }

        public void Display(int index,int[] array)
        {
            var txt = "";
            foreach (var item in array)
            {
                txt += " " + item.ToString();
            }
            WriteLine("{0} : {1}", index,txt);
        }

        public void Display(List<int>[] list) 
        {
            for (int i = 0; i < list.Length; i++)
            {
                Display(i, list[i].ToArray());
            }
        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }

        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; i++)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }

        public string ReadLine { get { return _stream.ReadLine(); } }
        public int ReadInt { get { return int.Parse(Read); } }
        public long ReadLong { get { return long.Parse(Read); } }
        public double ReadDouble { get { return double.Parse(Read); } }
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
    }
}


Measured memory_bytes: 27808
#include <stdio.h>

int main(){
  int x[3];
  int a,b,max;
  scanf("%d%d",&a,&b);

  x[0]=a+b;
  x[1]=a-b;
  x[2]=a*b;

  max=x[0];
for(int i=1; i<=2; i++)
  if(x[i]>=max)max=x[i];

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

}

Measured memory_bytes: 128
//g++ -std=c++14 test.cpp -o test.out

#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <iomanip>
#include <vector>
#include <queue>
#include <map> 
#include <utility>
#include <limits.h>
#include <bitset>
#include <set>
using namespace std;
 
#define LL long long int
const LL INF = (LL)(1e18)+1;
const int INF_INT = 2147483647-1e6-1;
const LL mod = 1000000007ll;
const int mod_int = 1000000007;

LL N,H;
vector<pair<LL,LL>> sword;

LL ans = 0;

void solve(){
	sort(sword.begin(),sword.end(),greater<pair<LL,LL>>());
	LL max_slashing = sword[0].first;
	vector<LL> throwing;//投げる予定の刀
	for(int i=0;i<N;i++){
		if(sword[i].second>max_slashing){
			throwing.push_back(sword[i].second);
		}
	}

	sort(throwing.begin(),throwing.end(),greater<LL>());
	for(int i=0;i<throwing.size();i++){
		H -= throwing[i];
		ans++;
		if(H<=0) return;
	}
	ans += H/max_slashing + (H%max_slashing!=0);
}

int main(){
    cin >> N >> H;
    for(int i=0;i<N;i++){
    	LL a,b;cin >> a >> b;
    	sword.push_back(pair<LL,LL>(a,b));
    }
 
    solve();

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3568
#include<iostream>
#include<string>
#include<algorithm>
#include<stack>
#include<vector>
#include<math.h>
#include<utility>
#include<iomanip>

using namespace std;

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

	int n, k;
	cin >> n >> k;
	vector<int> h(n);
	long long att = 0;
	for (int i = 0; i < n; i++) {
		cin >> h[i];
	}

	sort(h.begin(), h.end());
	for (int i = n-1-k; i >= 0; i--) {
		att += 1L * h[i];
	}

	cout << att;

}

Measured memory_bytes: 1024
INF=999999999

n,t=[int(i) for i in input().split()]
a=[int(i) for i in input().split()]


res=0
mini=a[0]
best = -INF

for i in range(1,n):
	if a[i]-mini == best:
		res+=1
	elif a[i]-mini > best:
		best=a[i]-mini
		res=1
	mini=min(mini,a[i])
print(res)


Measured memory_bytes: 14292
// I am Varun Das from Jadavpur University
#include <bits/stdc++.h>
#define mod 1000000007
#define ll long long
#define dbg(x) cerr << #x << " = " << x << endl
#define INF LLONG_MAX
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a,b) for(int i=a;i>=b;i--)
using namespace std;

int main() {
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);
#endif
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout<<fixed<<setprecision(5);
float a,b;
cin>>a>>b;
cout<< (float) a/b;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <numeric>
#include <unordered_map>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <memory>
#include <iomanip>
#include <type_traits>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
constexpr long long MOD = 1e9 + 7;
constexpr long long MAX = 1000000;

//long long MOD = 998244353;
constexpr ll INF = 1e17;
constexpr double PI = 3.141592653589793;
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }



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

    int n;
    string s;
    cin >> n >> s;

    for (char& c : s) {
        int ci = c - 'A';
        ci += n;
        ci %= 26;
        char cn = 'A' + ci;
        c = cn;
    }

    cout << s << endl;
    return 0;
}



Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstring>
#include <iostream>
#include <list>
#include <functional>
#include <algorithm>
#include <sstream>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
using namespace std;

int main()
{
	//freopen("in.txt", "r", stdin);
	//freopen("out.txt", "w", stdout);
	int n;
	scanf("%d", &n);
	int k = n;
	int sum = 0;
	while (n > 0)
	{
		sum += n % 10;
		n /= 10;
	}
	if (k % sum == 0)printf("Yes\n");
	else printf("No\n");
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <map>

#include <algorithm>
#include <queue>
#include <cctype>

using namespace std;

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

int n, m;
pair<int,int> ab[100003];
vector<int> bredge;

bool compare_by_b(pair<int, int> a, pair<int, int> b) {
    if(a.second != b.second){
        return a.second < b.second;
    }else{
        return a.first < b.first;
    }
}

int main() {
    cin >> n >> m;
    rep(i, m) {
        pair<int, int> item;
        cin >> item.first >> item.second;
        ab[i] = item;
    }
    sort(ab,ab + m, compare_by_b);
    rep(i, m) {
        bool is_ok = false;
        rep(k, bredge.size()) {
            if(ab[i].first <= bredge[k] && bredge[k] < ab[i].second) {
                is_ok = true;
            }
        }
        if (is_ok) continue;
        else {
            bredge.push_back(ab[i].second -1);
        }
    }
    cout << bredge.size() << '\n';
}

Measured memory_bytes: 1024
n = int(input())
l = list(map(int,input().split()))
l.sort()
ans = 0
for i in range(n-2):
    a = l[n-1-i]
    for j in range(i+1,n-1):
        b = l[n-1-j]
        #print(a,b)
        mn = a - b
        ng = -1
        ok = n-1-j
        if mn >= b:
            continue
        while abs(ok - ng) > 1:
            hf = (ng + ok) // 2
            #print(a,b,l[hf])
            if l[hf] > mn:
                ok = hf
            else:
                ng = hf
        ans += n-1-j - ok
        #print(a,b,l[ok],mn,ok)


print(ans)



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

int main() {
  int N,K;
  cin >> N>>K;
  vector<int>x(N);
  for (int i=0; i < N; i++) {
   cin >> x.at(i);//i番目のx座標（yはすべて同じだから考慮する必要なし）
  }
  int f =0;
  for(int i=0;i<N;i++){
    if(K>x.at(i)*2){//B-xとx-Aの比較の結果、Aが近い
      f+=x.at(i)*2;
    }
    else if(K<=x.at(i)*2){//Bが近い
      f+=(K-x.at(i))*2;
    }
  }
    cout<< f << endl;
}
 

Measured memory_bytes: 256
N,P = map(int,input().split())

def factoring(M,n=2):
    for i in range(n,int(M**0.5)+1):
        if M%i==0:
            ret = factoring(M//i,i)
            ret[i] = ret.get(i,0)+1
            return ret
    return {M:1}

ans = 1
for a,n in factoring(P).items():
    ans *= a**(n//N)
print(ans)

Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
	
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		
		int[] d = {a, b, c};
		
		System.out.println(d[2] + " " + d[0] + " " + d[1] );
		
		
	}

}

Measured memory_bytes: 22612
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<queue>
#include<map>
#include<iomanip>
#include<set>
#include<bitset>
#define rep(index,num) for(int index=0;index<num;index++)
#define rep1(index,num) for(int index=1;index<=num;index++)
#define brep(index,num) for(int index=num-1;index>=0;index--)
#define brep1(index,num) for(int index=num;index>0;index--)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-7
#define mp(a1,a2) make_pair(a1,a2)
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef long long ll;
typedef long double ld;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=1e+18+1;
int INF=1e+9+1;
int main(){
	int N,K,p[200001];
	double ki[200001];
	scan(N>>K);
	rep(i,N){
		scan(p[i]);
		ki[i]=(double)(p[i]+1)/2;
	}
	double kisum[200001]={};
	rep(i,N){
		kisum[i+1]=kisum[i]+ki[i];
	}
	double ans=0;
	for(int i=K;i<=N;i++){
		ans=max(ans,kisum[i]-kisum[i-K]);
	}
	prin(setprecision(11)<<ans);
	return 0;
}


Measured memory_bytes: 4096
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <ctime>
#include <climits>
using namespace std;

#define rep(i,a,n) for(int i=a; i<n; i++)
#define repr(i,a,n) for(int i=a; i>=n; i--)
#define pb(a) push_back(a)
#define fr first
#define sc second
#define INF 999999999

#define X real()
#define Y imag()
#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) ( EQ((a).X, (b).X) && EQ((a).Y, (b).Y) )
#define LE(n, m) ((n) < (m) + EPS)
#define GE(n, m) ((n) + EPS > (m))

typedef vector<int> VI;
typedef vector<VI> MAT;
typedef pair<int, int> pii;
typedef long long int ll;

typedef complex<double> P;
typedef pair<P, P> L;
typedef pair<P, double> C;

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

namespace std {
    bool operator<(const P a, const P b) {
        return a.X != b.X ? a.X < b.X : a.Y < b.Y;
    }
}

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i,0,n) cin >> a[i];

    int ans, m = INF;
    rep(i,-100, 101) {
        int temp = 0;
        rep(j,0,n) {
            temp += (a[j] - i) * (a[j] - i);
        }
        if(temp < m) {
            m = temp;
            ans = i;
        }
    }
    cout << m << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i, n) for (int i = 0; i < n; i++)
#define ALL(a) (a).begin(), (a).end()
typedef vector<int> vi;
const int INF = 1LL << 58;
const int MOD = 1000000007;
const int MAX_N = 200100;

int func(int b)
{
    return b * b * b * b * b;
}

// index が条件を満たすかどうか
bool isOK(int index, int key)
{
    if (func(index) >= key)
        return true;
    else
        return false;
}

// 汎用的な二分探索のテンプレ
int binary_search(int key)
{
    int left = -1000; //「index = 0」が条件を満たすこともあるので、初期値は -1
    int right = 1000; // 「index = a.size()-1」が条件を満たさないこともあるので、初期値は a.size()

    /* どんな二分探索でもここの書き方を変えずにできる！ */
    while (right - left > 1)
    {
        int mid = left + (right - left) / 2;

        if (isOK(mid, key))
            right = mid;
        else
            left = mid;
    }

    /* left は条件を満たさない最大の値、right は条件を満たす最小の値になっている */
    return right;
}

signed main()
{
    //  以降 cin の入力元が 'input.txt' になる
    //std::ifstream in("input.txt");
    //std::cin.rdbuf(in.rdbuf());
    int X;
    cin >> X;
    int a, b;
    b = -1000;
    while (1)
    {
        a = binary_search(X + func(b));
        if (func(a) - func(b) == X)
        {
            cout << a << " " << b;
            break;
        }
        b++;
    }

    return 0;
}

Measured memory_bytes: 3628
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <iomanip>
using namespace std;

void solve(){
  string s, t; cin >> s >> t;
  s += s;
  for(int i = 0; i < s.length() / 2; i++){
    int ans = s.compare(i, s.length() / 2, t);
    if(ans == 0){
      cout << "Yes\n";
      return;
    }
  }
  cout << "No\n";
  return;
}
int main(){
  solve();
  return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AtCoder
{
	class Program
	{
		static void Main(string[] args)
		{
			var n = int.Parse(Console.ReadLine());

			long power = 1;

			for(int i = 1; i <= n; i++)
			{
				power = power * i % 1000000007;
			}
			
			Console.WriteLine(power);
        }
	}
}


Measured memory_bytes: 11092
#include <stdio.h>
#include <string.h>
#define N 5000
#define M 500000
#define MAX(a, b) ((a)>(b)?(a):(b))

typedef struct tagBX {
    short b;
    short x;
    struct tagBX *next;
} BX;

BX bx[M], *abx[N + 1];

short work1[N+1];
short work2[N+1];

int main(void) {
    int m, n, a, i, j;
    int ans = 0;
    short *prev, *now, *tmp;
    scanf("%d %d", &n, &m);
    for (i = 0; i < m; i++) {
        scanf("%d %d %d", &a, &bx[i].b, &bx[i].x);
        bx[i].next = abx[a];
        bx[i].x += 1;
        abx[a] = bx + i;
    }
    prev = work1;
    now = work2;
    for (i = 1; i <= n; i++) {
        BX *p;
        memset(now, 0, sizeof(short)*i);
        for (p = abx[i]; p != NULL; p = p->next) {
            if (p->x > now[p->b]) now[p->b] = p->x;
        }
        for (j = 1; j <= i; j++) {
            now[j] = MAX(now[j], MAX(prev[j], prev[j-1])-1);
            ans += now[j] > 0;
        }
        tmp = prev;
        prev = now;
        now = tmp;
    }
    printf("%d\n", ans);
    return 0;
}

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

using namespace std;

typedef long long ll;
typedef vector<int> vi;

string solve() {
    int n; cin >> n;
    unordered_map<string, int> freq;
    freq["AC"] = 0; freq["WA"] = 0; freq["TLE"] = 0; freq["RE"] = 0;
    while (n--) {
        string s; cin >> s;
        freq[s]++;
    }
    string res = "AC x " + to_string(freq["AC"]) + "\n";
    res += "WA x " + to_string(freq["WA"]) + "\n";
    res += "TLE x " + to_string(freq["TLE"]) + "\n";
    res += "RE x " + to_string(freq["RE"]) + "\n";
    
    return res;
}

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

    cout << solve();
}


Measured memory_bytes: 3704
a,b,c,d,e,f = map(int, input().split())

water_list = []

def nearest_suger(suger1, suger2, rest_amount, water):
    max_sum = 0
    target = min(int(water * (e / 100)), rest_amount)
    for i in range((target//suger1)+1):
        for j in range((target//suger2)+1):
            sum = i * suger1 + j* suger2
            if sum > target:
                break
            if max_sum < sum:
                max_sum = sum
    return max_sum



for i in range(30):
    if 100*a*i <= f:
        water_list.append(100*a*i)
    if 100*b*i <= f:
        water_list.append(100*b*i)

water_list = set(water_list)
water_list = list(water_list)
water_list.sort()
water_list.pop(0)

max_percent = 0

for i in water_list:
    suger = nearest_suger(c, d, f-i, i)
    percent = suger / (i + suger)
    if percent == (e / 100):
        print(suger+i, suger)
        exit()
    elif percent > (e / 100):
        continue
    elif percent >= max_percent:
        max_percent = percent
        suger_ans = suger
        water_ans = i

print(water_ans + suger_ans, suger_ans)




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

int main(){
  string a;
  cin >> a;
  if (a[0] == a[1]) cout << "Bad" << endl;
  else if (a[1] == a[2]) cout << "Bad" << endl;
  else if (a[2] == a[3]) cout << "Bad" << endl;
  else cout << "Good" << endl;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
	int m, n, c[100] = {};
	cin >> n;
	cin >> m;
	int b[100];
	int a[100][100];
	for (int i = 0; i < n; i++){
		for (int i2 = 0; i2 < m; i2++){
			cin >> a[i][i2];
		}
	}
	for (int i3 = 0; i3 < m; i3++){
		cin >> b[i3];
	}
	for (int i4 = 0; i4 < n; i4++){
		for (int i5 = 0; i5 < m; i5++){
			c[i4] += a[i4][i5] * b[i5];
		}
	}
	for (int i6 = 0; i6 < n; i6++){
		cout << c[i6] << endl;
	}
	return 0;
}

Measured memory_bytes: 3132
#include <stdio.h>

int main(void)
{
	int a, b, c,i;
	scanf("%d%d%d", &a, &b, &c);
	if (a > b){
		i = a;
		a = b;
		b = i;
	}
	if (b > c){
		i = b;
		b = c;
		c = i;
	}
	if (a > b){
		i = a;
		a = b;
		b = i;
	}
	printf("%d %d %d\n", a, b, c);
	return 0;
}

Measured memory_bytes: 596
#include<iostream>
#include<iomanip>
#include<math.h>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<string>
#define INF 1000000000ll
#define MOD 1000000007ll
#define EPS 1e-10
#define REP(i,m) for(long long i=0; i<m; ++i)
#define FOR(i,n,m) for(long long i=n; i<m; ++i)
#define DUMP(n,a) for(long long dump=0; dump<n; ++dump) { cout<<a[dump]; if(dump!=n-1) cout<<" "; else cout<<endl; }
#define ALL(v) v.begin(),v.end()
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef long double ld;

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n;
	cin>>n;
	vector<ll> a(n);
	REP(i,n) cin>>a[i];
	ll cnt=0;
	ll buf=0;
	REP(i,n) {
		if(a[i]==0) {
			cnt+=buf/2;
			buf=0;
		} else {
			buf+=a[i];
		}
	}
	cnt+=buf/2;
	cout<<cnt<<endl;
}


Measured memory_bytes: 1024
#include <stdio.h>

int main(){
  int a[5];
  int k;
  for(int i = 0;i < 5;i++){
    scanf("%d",a+i);
  }
  scanf("%d",&k);
  if(a[4]-a[0]>k){
    printf(":(\n");
  }else{
    printf("Yay!\n");
  }
}

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

using namespace std;

#define N 100000

int n,m,xb,t,c[N],ans[N],pw[N];
char s[N];
map<int,bool> vis;

int main(){
	scanf("%s%d",s+1,&m);
	n=strlen(s+1);
	pw[0]=1; for (int i=1;i<=m;++i) pw[i]=pw[i-1]*30;
	for (int i=1;i<=n;++i){
		int x=0;
		for (int j=i;j<i+m&&j<=n;++j){
			x=x*30+s[j]-'a'+1;
			int y=x*pw[m-(j-i)];
			if (!vis.count(y)){vis[y]=1; c[++xb]=y;}
		}
	}
	sort(c+1,c+xb+1);
	for (int x=c[m];x;x/=30)
		if (x%30) ans[++t]=x%30+'a'-1;
	for (;t;--t) putchar(ans[t]);
	
	return 0;
}
			

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
  ll n,t=0;
  cin>>n;
  ll v[n];
  for(ll i=0;i<n;i++){
    cin>>v[i];
    t+=v[i];
  }
  ll c=1000000000000000000,a=0;
  for(ll i=0;i<n-1;i++){
    a+=v[i];
    t-=v[i];
    c=min(c,abs(a-t));
  }
  cout<<c;
}

Measured memory_bytes: 1792
//⣿⣿⣿⣿⣿⣿⠟⠋⠁⣀⣤⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⢿⣿⣿
//⣿⣿⣿⣿⠋⠁⠀⠀⠺⠿⢿⣿⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⠻⣿
//⣿⣿⡟⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣀⣤⣤⣤⣤⠀⠀⠀⠀⠀⣤⣦⣄⠀⠀
//⣿⡟⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣤⣶⣿⠏⣿⣿⣿⣿⣿⣁⠀⠀⠀⠛⠙⠛⠋⠀⠀
//⡿⠀⠀⠀⠀⠀⠀⠀⠀⡀⠀⣰⣿⣿⣿⣿⡄⠘⣿⣿⣿⣿⣷⠄⠀⠀⠀⠀⠀⠀⠀⠀
//⡇⠀⠀⠀⠀⠀⠀⠀⠸⠇⣼⣿⣿⣿⣿⣿⣷⣄⠘⢿⣿⣿⣿⣅⠀⠀⠀⠀⠀⠀⠀⠀
//⠁⠀⠀⠀⣴⣿⠀⣐⣣⣸⣿⣿⣿⣿⣿⠟⠛⠛⠀⠌⠻⣿⣿⣿⡄⠀⠀⠀⠀⠀⠀⠀
//⠀⠀⠀⣶⣮⣽⣰⣿⡿⢿⣿⣿⣿⣿⣿⡀⢿⣤⠄⢠⣄⢹⣿⣿⣿⡆⠀⠀⠀⠀⠀⠀
//⠀⠀⠀⣿⣿⣿⣿⣿⡘⣿⣿⣿⣿⣿⣿⠿⣶⣶⣾⣿⣿⡆⢻⣿⣿⠃⢠⠖⠛⣛⣷⠀
//⠀⠀⢸⣿⣿⣿⣿⣿⣿⣾⣿⣿⣿⣿⣿⣿⣮⣝⡻⠿⠿⢃⣄⣭⡟⢀⡎⣰⡶⣪⣿⠀
//⠀⠀⠘⣿⣿⣿⠟⣛⠻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣿⣿⣿⡿⢁⣾⣿⢿⣿⣿⠏⠀
//⠀⠀⠀⣻⣿⡟⠘⠿⠿⠎⠻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣵⣿⣿⠧⣷⠟⠁⠀⠀
//⡇⠀⠀⢹⣿⡧⠀⡀⠀⣀⠀⠹⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠋⢰⣿⠀⠀⠀⠀
//⡇⠀⠀⠀⢻⢰⣿⣶⣿⡿⠿⢂⣿⣿⣿⣿⣿⣿⣿⢿⣻⣿⣿⣿⡏⠀⠀⠁⠀⠀⠀⠀
//⣷⠀⠀⠀⠀⠈⠿⠟⣁⣴⣾⣿⣿⠿⠿⣛⣋⣥⣶⣿⣿⣿⣿⣿⠀⠀⠀⠀⠀⠀⣿⡀ 
//
//⣿⠛⣷⠀⠀⢸⣟⡛⠀⠀⣿⠛⣷⠀⠀⢸⣟⡛⠀⠀⣴⢟⣛⡀⠀⠀⣸⢿⣇⠀ 
//⣿⠉⠉⠀⠀⢸⣯⣥⠀⠀⣿⠉⠉⠀⠀⢸⣯⣥⠀⠀⢿⣮⣽⡇⠀⢠⡿⠶⣿⡄ 
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define DEBUG false
#define debugf if (DEBUG) printf
#define MAXN 1000010
#define MAXM 900009
#define MAXLOGN 20
#define ALFA 256
#define MOD 998244353
#define INF 0x3f3f3f3f
#define INFLL 0x3f3f3f3f3f3f3f3f
#define EPS 1e-9
#define PI 3.141592653589793238462643383279502884
#define FOR(x,n) for(int x=0; (x)<int(n); (x)++)
#define FOR1(x,n) for(int x=1; (x)<=int(n); (x)++)
#define REP(x,n) for(int x=int(n)-1; (x)>=0; (x)--)
#define REP1(x,n) for(int x=(n); (x)>0; (x)--)
#define pb push_back
#define pf push_front
#define pr printf
#define sc(x) scanf(" %d", &x)
#define sc2(x, y) sc(x);sc(y)
#define sc3(x, y, z) sc2(x, y);sc(z)
#define scll(x) scanf(" %lld", &x)
#define sc2ll(x, y) scll(x);scll(y)
#define sc3ll(x, y, z) sc2ll(x, y);scll(z)
#define ff first
#define ss second
#define mp make_pair
#define sz(x) int(x.size())
#define all(x) x.begin(), x.end()
#define mset(x,y) memset(&x, (y), sizeof(x))
#define LOWBIT(A) (A & -A)
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef unsigned int uint;
typedef vector <int> vi;
typedef pair <int, int> ii;
typedef pair <ll, ll> pll;
typedef pair < pll, ll > plll;
template <class T>
	using ord_set = tree<T, null_type, less<T>, rb_tree_tag,
	tree_order_statistics_node_update>;

int main(){
    int a, b, c;sc3(a, b, c);
    if(a + b + c >= 22)pr("bust\n");
    else pr("win\n");
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <math.h>
using namespace std;
int main(void){
    int N,D;
    cin >> N >> D;
    double X[N][D];
    for(int i = 0; i < N ; i++){
        for(int j = 0; j < D ; j++){
            cin >> X[i][j];   
        }
    }
    int ans = 0;
    double dist = 0;
    for(int i = 0; i < N ; i++){
        for(int j = i; j < N ; j++){
            
            if(j == i)continue;
            for(int k = 0; k < D;k++){
                dist += (X[i][k]-X[j][k])* (X[i][k]-X[j][k]);
                
            }
            
            dist = sqrt(dist);
            if(ceil(dist)==floor(dist)){
                ans++;
            }
            dist = 0;
            
        }
    }
    cout << ans << endl;
    
    
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
 
#include <bits/stdc++.h> 
 
using namespace std;
 
#define len(x) (int)((x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define endl '\n'
#define x first
#define y second
#define int long long
#define double long double
#define vi vector<int> 
#define vvi vector<vector<int>>
#define pb push_back
#define pii pair<int, int>
#define pdd pair<double, double> 
#define beg begin
 
#ifdef LOCAL
    #define dbg(x) cout << #x << " = " << x << endl;
#else 
    #define dbg(x)
#endif 
 
template<class T> istream& operator>>(istream &str, vector<T> &a) {
    for (auto &i : a) {
        str >> i; 
    }
    return str;
}
 
template<class T> ostream& operator<<(ostream &str, vector<T> &a) {
    for (auto &i : a) {
        str << i << " ";
    }
    return str;
}
 
template<class T> istream& operator>>(istream &str, pair<T, T> &a) {
    str >> a.x >> a.y;
    return str;
}
 
template<class T> ostream& operator<<(ostream &str, pair<T, T> &a) {
    str << a.x << " " << a.y;
    return str;
}
 
void solve(); signed main() {
#ifdef LOCAL
    freopen("input.txt", "r", stdin);                                       
    freopen("output.txt", "w", stdout);
#endif
    srand(time(0));
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cout.setf(ios::fixed); cout.precision(6);
    solve();    
    return 0;
}
 
const int INF = 1e18, MAXN = 1e4 + 10, MOD = 1e9 + 7, BASE = 37;

void solve() {
    double a, b, x;
    cin >> a >> b >> x;
    x /= a;

   	if (a * b / 2 < x) {
   		cout << 180 * atan(2 * (a * b - x) / (a * a)) / M_PI << endl;
   	}
   	else {
   		cout << 90 - 180 * atan(2 * x / (b * b)) / M_PI << endl;
   	}
}

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

int main() {
  string A;
  cin >> A;
  vector<int> X(4);
  for(int i = 0; i < 4; i++){
    X.at(i) = (int)(A.at(i)-48);
  }
  
  bool ans = false;
  
  for (int tmp = 0; tmp < (1 << 4); tmp++) {
    bitset<4> s(tmp);  
  
	int sum = 0;
  	for (int i = 0; i < 4; i++) {
      if (s.test(i)) {
        sum += X.at(i);
      }
      else sum -= X.at(i);
    }
      if (sum == 7) {
      cout << X.at(0);
        if(s.test(1)) cout << "+";
        else cout << "-";
      cout << X.at(1);
        if(s.test(2)) cout << "+";
        else cout << "-";
      cout << X.at(2);
        if(s.test(3)) cout << "+";
        else cout << "-";
      cout << X.at(3);
      cout << "=7" << endl;
      break;
      }
    }
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace _0028
{
    public class Program

    {
        public static void Main(string[] args)
        {
            Dictionary<int, int> items = new Dictionary<int, int>();
            while (true)
            {
                string line = RSt();
                if (string.IsNullOrEmpty(line)) break;

                int num = int.Parse(line);
                if (!items.ContainsKey(num)) items.Add(num,0); 
                items[num]++;
            }
            foreach (var item in items.OrderBy(x => x.Key).Where(x => x.Value == items.Max(y => y.Value)))
            {
                Console.WriteLine(item.Key);
            }
        }

        static string RSt() { return Console.ReadLine(); }
        static int RInt() { return int.Parse(Console.ReadLine().Trim()); }
        static long RLong() { return long.Parse(Console.ReadLine().Trim()); }
        static double RDouble() { return double.Parse(Console.ReadLine()); }
        static string[] RStAr(char sep = ' ') { return Console.ReadLine().Trim().Split(sep); }
        static int[] RIntAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => int.Parse(e)); }
        static long[] RLongAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => long.Parse(e)); }
        static double[] RDoubleAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => double.Parse(e)); }
        static string WAr(int[] array, string sep = " ") { return String.Join(sep, array.Select(x => x.ToString()).ToArray()); }
        static string WAr(double[] array, string sep = " ") { return String.Join(sep, array.Select(x => x.ToString()).ToArray()); }
        static string WAr(long[] array, string sep = " ") { return String.Join(sep, array.Select(x => x.ToString()).ToArray()); }
    }

}



Measured memory_bytes: 18488
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n; string s;
    cin >> n >> s;
    for (int i = 0; i < s.length(); ++i)
        s[i] = 'A' + (s[i] - 'A' + n) % 26;
    cout << s << '\n';
    return 0;
}

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

int main(){
    long long a;
    double b;
    int B;
    scanf("%lld %lf",&a,&b);
    B = b*100+0.5;
    printf("%lld\n",a*B/100);
    return 0;
}

Measured memory_bytes: 3804
#include <iostream>
#include <iomanip>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <utility>
#include <string>
#include <cmath>
#include <cstdlib>
#include <cstring>

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;

const double PI=3.14159265358979323846;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

#define rep(i, N) for(int i = 0; i < N; ++i)

#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 1000000007ULL

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

    int N;
    cin >> N;

    cout << setprecision(10) << (double)CEIL(N, 2) / N<< "\n";
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <limits>
#include <numeric>
#include <algorithm>
#include <functional>

#include <vector>

using namespace std;

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

	int free_cnt = 0;
	vector<int> color_cnt(8, 0);

	int N;
	cin >> N;

	for (int i = 0; i < N; i++)
	{
		int a;
		cin >> a;

		if (a >= 3200)
		{
			free_cnt++;
		}
		else
		{
			color_cnt[a / 400] = 1;
		}
	}

	int accum = accumulate(color_cnt.begin(), color_cnt.end(), 0);
	if (accum != 0)
	{
		cout << accum << " " << accum + free_cnt;
	}
	else
	{
		cout << 1 << " " << free_cnt;
	}

	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<cstring>
#include<string>
#include<cmath>
#include<vector>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
using namespace std;
const int inf=2147483647,dx[]={-1,0,1,0},dy[]={0,-1,0,1};// 上 左 下 右
const int N=100005,M=1000005,mod=1000000007;
const long long llinf=9223372036854775807ll;
int n,m,l;
long long ans;
pair<int,int> a[N];
int main(){
	cin>>n>>m;
	l=m;
	for(int i=1;i<=n;i++)
		scanf("%d%d",&a[i].first,&a[i].second);
	sort(a+1,a+1+n);
	for(int i=1;i<=n;i++)
	{
		if(a[i].second>=l)
		{
			ans+=1ll*l*a[i].first;
			break;
		}
		else
			ans+=1ll*a[i].second*a[i].first,l-=a[i].second;
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 1024
import bisect
import heapq
import itertools
import math
import os
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7

N, K = list(map(int, sys.stdin.readline().split()))
X = list(map(int, sys.stdin.readline().split()))
ans = INF
for i in range(N - K + 1):
    L = X[i]
    r = X[i + K - 1]
    if r <= 0:
        ans = min(ans, abs(L))
    elif 0 <= L:
        ans = min(ans, abs(r))
    else:
        al = abs(L)
        ar = abs(r)
        ans = min(ans, min(al, ar) * 2 + max(al, ar))
print(ans)


Measured memory_bytes: 24084
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define li 100005
#define mp make_pair
#define lo long long 
#define pb push_back
#define inf 1000000000000
#define md 1000000007
lo int n,x[105],y[105],h[105];
int main(){
	scanf("%lld",&n);
	for(int i=1;i<=n;i++){
		scanf("%lld %lld %lld",&x[i],&y[i],&h[i]);
	}
	for(lo int cx=0;cx<=100;cx++){
		for(lo int cy=0;cy<=100;cy++){
			lo int mx=inf,last=-1,flag=0,olmadi=0;
			for(lo int i=1;i<=n;i++){
				lo int topla=abs(cx-x[i])+abs(cy-y[i]);
				if(h[i]==0) {mx=min(mx,topla);if(last!=-1 && mx<last){olmadi=1;break;};flag=1;}
				else{
					lo int hh=h[i]+topla;
					if(flag==1 && hh>mx){olmadi=1;break;}
					if(last!=-1 && hh!=last){olmadi=1;break;}
					last=hh;
				}
			}
			if(olmadi==0){
				if(last!=-1 && last>=1){
					printf("%lld %lld %lld\n",cx,cy,last);
					return 0;
				}
				else if(mx>=1){
					printf("%lld %lld %lld\n",cx,cy,mx);
					return 0;
				}
			}
		}
	}
	return 0;
}



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

using namespace std;

int n, MAX;
string s[200007];
vector<string> v;

int main()
{
    cin >> n;
    for (int i = 1; i <= n; ++i) cin >> s[i];
    sort(s+1, s+n+1);
    int cnt = 0;
    for (int i = 1; i <= n; ++i)
    {
        cnt++;
        if (s[i] != s[i+1])
        {
            MAX = max(MAX, cnt);
            cnt = 0;
        }
    }
    for (int i = 1; i <= n; ++i)
    {
        cnt++;
        if (s[i] != s[i+1])
        {
            if (cnt == MAX) v.push_back(s[i]);
            cnt = 0;
        }
    }
    sort(v.begin(), v.end());
    for (auto x : v)
        cout << x << '\n'   ;
    return 0;
}


Measured memory_bytes: 15988
# -*- coding: utf-8 -*-
"""
A - Password
https://atcoder.jp/contests/abc140/tasks/abc140_a

"""
import sys


def solve(N):
    return N**3


def main(args):
    N = int(input())
    ans = solve(N)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])


Measured memory_bytes: 2940
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
//#define cerr if(false) cerr
#ifdef DEBUG
#define show(...) cerr << #__VA_ARGS__ << " = ", debug(__VA_ARGS__);
#else
#define show(...) 42
#endif
using namespace std;
using ll = long long;
using pii = pair<int, int>;
template <typename T, typename S>
ostream &operator<<(ostream &os, pair<T, S> a) {
    os << '(' << a.first << ',' << a.second << ')';
    return os;
}
template <typename T>
ostream &operator<<(ostream &os, vector<T> v) {
    for (auto x : v) os << x << ' ';
    return os;
}
void debug() {
    cerr << '\n';
}
template <typename H, typename... T>
void debug(H a, T... b) {
    cerr << a;
    if (sizeof...(b)) cerr << ", ";
    debug(b...);
}
int main(){
    int n, d;
    cin >> n >> d;
    int k = 2 * d + 1;
    cout << (n + k - 1) / k << endl;
}

Measured memory_bytes: 256
def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
N = 10**6
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )

x, y = map(int, input().split())

n = (x+y)/3
a = (-x+2*y)/3

#print(n)
#print(a)

if not n.is_integer() or not a.is_integer():
  print(0)
else:
  n = int(n)
  a = int(a)
  ans = cmb(n,a,mod)
  print(ans)
  
  

Measured memory_bytes: 127684
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
const int MAX=1e3 + 100;
int lastmatch[MAX];
int main ()
{
    int N;cin >> N;
    queue<int>Q[N+1];
    for(int i=1;i<=N;i++){
            for(int j=1;j<N;j++){
                int x;
                cin >> x;
                Q[i].push(x);
            }
    }
    int total_match = N*(N-1)/2LL , bad=0 , res = 0;

    while(total_match>0){
            bad = 1;
            for(int i=1;i<=N;i++){
                if(Q[i].size())
                {
                    int curr = Q[i].front();
                    int opponent = Q[curr].front();
                    if(opponent==i){
                        total_match--;
                        Q[i].pop();
                        Q[curr].pop();
                        bad=0;
                        int day = max(lastmatch[i],lastmatch[curr])+1;
                        lastmatch[i]=day;
                        lastmatch[curr]=day;
                        res = max(res,day);
                    }
                }

            }
            if(bad)break;
    }
    if(bad)cout<<-1;
    else cout<<res;
    return 0;
}
/*
*/


Measured memory_bytes: 4736
using System;

class Program
{
    static void Main(string[] args)
    {
        int ac = 0, wa = 0, tle = 0, re = 0;
        for(int i = 0, n = int.Parse(Console.ReadLine());i < n; i++)
        {
            switch (Console.ReadLine()) 
            {
                case "AC": ac++; break;
                case "WA": wa++; break;
                case "TLE":tle++;break;
                case "RE":re++;break;
            }

        }

        Console.WriteLine("AC x " + ac);
        Console.WriteLine("WA x " + wa);
        Console.WriteLine("TLE x " + tle);
        Console.WriteLine("RE x " + re);
    }



}



Measured memory_bytes: 30636
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <cmath>
#include <set>
#include <algorithm>

typedef long long ll;
const ll MOD = 1e9 + 7;
const long long INF = 1LL<<60;
const double PI=3.14159265358979323846;
const int NMAX=100005;
using namespace std;

int main(){
    int n,m;
    int k[11];
    int p[11];
    cin >> n >> m;
    vector<vector<int> > s(m);

    for(int i = 0; i < m; i++){
        cin >> k[i];
        for(int j = 0; j < k[i]; j++){
            int k;
            cin >> k;
            s[i].push_back(k);
        }
        sort(s[i].begin(), s[i].end());
    }

    for(int i = 0; i < m; i++){
        cin >> p[i];
    }

    int ans = 0;
    for(int i = 0; i < 1<<n; i++){
        bool flag = true;
        for(int j = 0; j < m; j++){
            int cnt = 0;
            int sp = 0;
            for(int l = 0; l < k[j]; l++){
                if((i>>(s[j][l]-1))&1) cnt++;
            }
            if(cnt%2 != p[j]){
                flag = false;
                break;
            }
        }
        if(flag) ans++;
    }

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<string>
#include<utility>
#include<numeric>
#include<algorithm>
#include<cmath>
#include<climits>
using namespace std;

using ll = long long;

class Stream{
public:
    Stream(){

    }
    //配列以外の入力を受け取る
    void read(){

    }
    template<typename First, typename... Rest>
    void read(First& first, Rest&... rest){
        cin >> first;
        read(rest...);
    }
    template<typename T>
    vector<T> read_vec(size_t n){
        vector<T> tmp(n);
        for(size_t i = 0; i < n; i++){
            cin >> tmp[i];
        }
        return tmp;
    }
    //配列を区切って出力する
    template<typename T>
    void write_vec(vector<T>& v, char divider){
        for(size_t i = 0; i < v.size(); i++){
            cout << v[i] << divider;
        }
    }
};

int main(){
    Stream io;
    
    int N;
    io.read(N);
    int ans = 1;
    while((ans << 1) <= N) ans = ans << 1;
    cout << ans;
    return 0;
}

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

#define N 100

int main(void){
  int n, A[N];
  int i, j, cnt=0;

  scanf("%d", &n);
  for(i=0; i<n; i++) scanf("%d", &A[i]);

  for(i=0; i<n-1; i++){
    for(j=n-1; j>i; j--){
      if(A[j]<A[j-1]){
	swap(A[j], A[j-1]);
	cnt++;
      }
    }
  }

  for(i=0; i<n; i++){
    if(i) printf(" %d", A[i]);
    else  printf("%d", A[i]);
  }

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

  return 0;
}



Measured memory_bytes: 3208
#include <iostream>
#include <algorithm>
#include <map>
#include <utility>
#include <vector>
#include <cstdio>
#include <iomanip>
#include <cmath>  
#include <cstdlib>
#include <limits>
#include <numeric>
#include <type_traits>
using namespace std;
using ll = long long;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep1(i, n) for(int i = 1; i <= n; i++) 

int main() {
    int N, M;
    cin >> N >> M;
    int A;
    int ans = 0;
    rep(i,M) {
        cin >> A;
        ans += A;
    }
    if (ans > N) {
        cout << -1 << endl;
        return 0;
    }
    cout << N - ans << endl;
    return 0;
}

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

int main()
{
  int n;
  string S;
  cin >> n;
  cin >> S;

  string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
  //処理
  rep(i,S.size()){
    rep(j,26){
      if(S[i]==ABC[j]){
        S[i]=ABC[(j+n)%26];
        break;
      }
    }
  }

   cout << S;
    
  return 0;
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

const int N=2e5+10;

int n,k;
int a[N];

int up(int x,int y)
{
	if (x%y==0)  return x/y-1;
	else return (x/y);
}

bool check(int len)//check函数
{
	int tot=0;
	for (int i=1;i<=n;i++)  tot+=up(a[i],len);//每次加上每个a被切的刀数！
	if (tot<=k)  return true;
	return false;
}

int main()
{
	cin>>n>>k;
	for (int i=1;i<=n;i++)  cin>>a[i];
	int l=1,r=1e9;
	while(l<r)
    {
        int mid=l+r>>1;
        if(check(mid)) r=mid;
        else l=mid+1;
    }
    cout<< r <<endl;
	return 0;
}

Measured memory_bytes: 4372
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
//const long long mod = 1000000007;
//const long long mod = 998244353;

struct W {
	int a, b, c;
	int o(int n) {
		return a == n ? b : a;
	}
	bool operator<(const W&o)const {
		return c < o.c;
	}
};
struct Path
{
	int a, b;
	int o(int n) {
		return a == n ? b : a;
	}
};
int main() {
	int N, M, L;
	scanf("%d %d %d", &N, &M, &L);
	W*w = new W[M];
	std::vector<W*>*ws = new std::vector<W*>[N];
	for (int i = 0; i < M; i++) {
		int a, b, c;
		scanf("%d %d %d", &a, &b, &c);
		w[i].a = a - 1;
		w[i].b = b - 1;
		w[i].c = c;
	}
	for (int i = 0; i < M; i++) {
		ws[w[i].a].push_back(w + i);
		ws[w[i].b].push_back(w + i);
	}
	std::vector<int>*path = new std::vector<int>[N];
	for (int i = 0; i < N; i++) {
		int*cost = new int[N];
		for (int j = 0; j < N; j++)cost[j] = L + 1;
		cost[i] = 0;
		std::priority_queue<std::pair<int, int>> q;
		q.push(std::pair<int, int>(0, i));
		for (; !q.empty(); q.pop()) {
			std::pair<int, int> p = q.top();
			int a = p.second;
			int c = -p.first;
			if (a != i && cost[a] <= c)continue;
			cost[a] = c;
			for (int j = 0; j < ws[a].size(); j++) {
				int b = ws[a][j]->o(a);
				if (cost[b] > c + ws[a][j]->c)q.push(std::pair<int, int>(-(c + ws[a][j]->c), b));
			}
		}
		for (int j = 0; j < N; j++) {
			if (i != j) {
				if (cost[j] <= L)path[i].push_back(j);
			}
		}
		delete[] cost;
	}
	int **res = new int*[N];
	for (int i = 0; i < N; i++) {
		res[i] = new int[N];
		for (int j = 0; j < N; j++) {
			res[i][j] = N;
		}
	}
	for (int i = 0; i < N; i++) {
		std::vector<int>q;
		q.push_back(i);
		res[i][i] = 0;
		for (int l = 0; l < q.size(); l++) {
			int j = q[l];
			for (int k = 0; k < path[j].size(); k++) {
				if (res[i][path[j][k]] > res[i][j] + 1) {
					res[i][path[j][k]] = res[i][j] + 1;
					q.push_back(path[j][k]);
				}
			}
		}
	}
	int Q;
	scanf("%d", &Q);
	int*ress = new int[Q];
	for (int i = 0; i < Q; i++) {
		int s, t;
		scanf("%d %d", &s, &t);
		ress[i] = res[s - 1][t - 1] - 1;
		if (res[s - 1][t - 1] == N)ress[i] = -1;
	}
	for (int i = 0; i < Q; i++) {
		printf("%d\n", ress[i]);
	}
	return 0;
}

Measured memory_bytes: 3456
// #pragma GCC optimize(3,"Ofast","inline")
// #pragma GCC optimize(2)
#include <cstdio>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
#include <stack>
#include <vector>
#include <string>
#include <iostream>
#include <list>
#include <cstdlib>
#include <bitset>
#include <assert.h>
#include <time.h>
#include <iomanip>
// #define getchar() (p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1 << 21, stdin), p1 == p2) ? EOF : *p1++)
// char buf[(1 << 21) + 1], * p1 = buf, * p2 = buf;
// #define int long long
#define lowbit(x) (x & (-x))
#define lson root << 1, l, mid
#define rson root << 1 | 1, mid + 1, r
#define pb push_back
typedef unsigned long long ull;
typedef long long ll;
typedef std::pair<int, int> pii;
typedef std::pair<ll, ll> pll;
typedef std::vector<ll> VI;
#define rep(i, a, n) for (int i = a; i < n; ++i)
#define SZ(x) ((int)((x).size()))
#define bug puts("BUG")
const long long INF = 0x3f3f3f3f3f3f3f3fLL;
const int inf = 0x3f3f3f3f;
const int mod = 998244353;
const double eps = 1e-6;
template <class T>
inline void read(T &x)
{
    int sign = 1;char c = getchar();x = 0;
    while (c > '9' || c < '0'){if (c == '-')sign = -1;c = getchar();}
    while (c >= '0' && c <= '9'){x = x * 10 + c - '0';c = getchar();}
    x *= sign;
}
#ifdef LOCAL
    FILE* _INPUT=freopen("input.txt", "r", stdin);
    // FILE* _OUTPUT=freopen("output.txt", "w", stdout);
#endif
using namespace std;
int main()
{
    ll x;
    read(x);
    ll cur = 100;
    int res = 0;
    while (cur < x)
    {
        cur += cur / 100;
        res += 1;
    }
    printf("%lld\n", res);
}

Measured memory_bytes: 3692
#include <bits/stdc++.h>
#define inf 100000000
#define rep(i,n) for(int i=0;i<n;i++) 
using namespace std;
typedef long long ll;
int main (){
int n,m;
cin >> n >> m;
int x[m + 5];
rep(i,m){
    cin >> x[i];
}
sort(x, x + m);
int sub[m + 4];

rep(i,m-1){
    sub[i] = x[i + 1] - x[i];
}
sort(sub, sub + (m - 1));
ll sum = 0;
for (int i = 0; i < (m  - n);i++){
    sum += sub[i];
}
cout << sum << endl;
return 0;
}


Measured memory_bytes: 1024
n = int(input())
alp = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
list = [[] for _ in range(26)]
ans = []

for i in range(n):
    s = input()
    for j in range(26):
        list[j].append(s.count(alp[j]))

for i in range(26):
    for j in range(min(list[i])):
        ans.append(alp[i])

ans = sorted(ans)

for i in ans:
    print(i, end = '')

Measured memory_bytes: 9180
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define F first
#define S second
#define PB push_back
#define MAXN 100005
#define MP make_pair
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define debug(x) cout << '>' << #x << ':' << x << endl;
#define SQ(a) (a)*(a)
#define nl "\n"
#define INF std::numeric_limits<int>::max()
using namespace std;
using namespace __gnu_pbds;
typedef tree<int,null_type,less<int>,rb_tree_tag,
tree_order_statistics_node_update> indexed_set;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
ll mod=1000000009;
int t[4*MAXN],n;
void build(int a[],int v,int tl,int tr){
	if( tl == tr) t[v] = a[tl];
	else{
		int tm = (tl + tr)/2;
		build(a,2*v,tl,tm);
		build(a,2*v+1,tm+1,tr);
		t[v] = min(t[2*v],t[2*v+1]);
	}
}

int min(int v,int tl,int tr,int l,int r){
	if(l > r){
		return INF - 1;
	}	
	if(l == tl && r == tr)
		return t[v];
	else{
		int tm = (tl + tr)/2;
		return min(min(2*v,tl,tm,l,min(tm,r)),min(2*v+1,tm+1,tr,max(tm+1,l),r));
	}
}

void update(int v,int tl,int tr,int pos,int new_val){
	if(tl == tr){
		t[v] = new_val;
	}
	else{
		int tm = (tl + tr)/2;
		if(pos<=tm)
			update(2*v,tl,tm,pos,new_val);
		else update(2*v+1,tl,tm,pos,new_val);
		t[v] = min(t[2*v],t[2*v+1]);
	}
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin>>n;
	int a[n];
	int f = 0;
	rep(i,0,n-1){
		cin>>a[i];
		if(a[i]%2==0){
			if(a[i]%3==0||a[i]%5==0){
			
			}else{
				f = 1;
				break;
			}
		}
	}
	if(f ==0){
		cout<<"APPROVED"<<nl;
	}
	else cout<<"DENIED"<<nl;
	return 0;
}






Measured memory_bytes: 256