akhauriyash/Code-Regression huggingface dataset:
#include <math.h>
#include <stdio.h>
#include <bitset>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main() {
  unsigned int A, B, K;
  cin >> A >> B >> K;
  unsigned int count = 0;
  for (int i = min(A, B); i > 0; i--) {
    if (A % i == 0 && B % i == 0) {
      count++;
    }
    if (count == K) {
      cout << i << endl;
      break;
    }
  }
  return 0;
}

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

#define int long long
#define fast_io(); ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define loop(i,a,b) for(int i=a;i<b;i++)
#define all(x) x.begin(),x.end()
#define us unordered_set
#define um unordered_map
#define ms multiset
#define mm multimap
#define pb push_back
#define pf push_front
#define ins insert
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define _max max_element
#define _min min_element
#define tc(T) int T; cin>>T; while(T--)
#define q(q) int q; cin>>q; while(q--)
#define pi 3.1415926535897932384626433832
const int pinf=((int)2e18);
const int ninf=((int)-2e18);
const int mod=1000000007;

using namespace std;

int power(int x,int n,int M)
{
    if(n==0)
        return 1;
    else if(n%2 == 0)
        return power((x*x)%M,n/2,M);
    else
        return (x*power((x*x)%M,(n-1)/2,M))%M;
}

bool vowel(char c)
{
    return(c=='a' or c=='e' or c=='i' or c=='o' or c=='u' or c=='A' or c=='E' or c=='I' or c=='U' or c=='O');
}

int32_t main()
{
    fast_io();

    //FILE *fptr1=freopen("in.txt","r",stdin);
    //FILE *fptr2=freopen("out.txt","w",stdout);

    int n;
    cin>>n;
    int ans=n*n*n;
    cout<<ans;


    return 0;
}


Measured memory_bytes: 3580
#include<stdio.h>
int main(void){
  int A,B,C,D;
  scanf("%d %d %d %d ",&A,&B,&C,&D);
  while(1){
    C= C-B;
    if(C<=0){
      printf("Yes");
      break;
    }
    A = A-D;
    if(A<=0){
      printf("No");
      break;
    }
  }
}

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

int main() {
  int a,b,c,d,e;
  cin >> a >> b >> c >> d >> e;
  int s=a*60+b;
  int t=c*60+d;
  cout << t-e-s << '\n';
  return 0;
}

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

int main()
{
    int n=0,i=0,j=0,ma=0,fa=0,mb=0,fb=0,a0[100001]={0},b0[100001]={0};
    cin >> n;
    for(i=0;i<n;i++){
        cin >> j;
        if(i%2==0){
           // a[i/2] = j;
            a0[j]++;
            if(a0[j]>ma){
                ma=a0[j];//元素出现最多的次数
                fa=j;//出现次数最多的元素
            }
        }
        else{
          //  b[i/2]=j;
            b0[j]++;
             if(b0[j]>mb){
                mb=b0[j];//元素出现最多的次数
                fb=j;//出现次数最多的元素
            }
        }
    }
    if(fa==fb && ma==mb==n/2){
        cout << n/2;//完全相同的情况
    }
    else if(fa==fb){
        if(ma > mb){
            b0[fb]=0;
            mb=*max_element(b0,b0+100001);
            cout << (n-ma)-mb;
        }
        else if(ma < mb){
            a0[fa]=0;
            ma=*max_element(a0,a0+100001);
            cout << (n-mb)-ma;
        }
        else if(ma == mb){
            j=ma;
            a0[fa]=0;
            b0[fb]=0;
            ma=*max_element(a0,a0+100001);
            mb=*max_element(b0,b0+100001);
            if(ma>mb){
                cout << n-j-ma;
            }
            else{
                cout << n-j-mb;
            }
        }
    }
    else{
        cout << n-ma-mb;
    }
    return 0;
}


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

int main() {
  std::string s; std::cin >> s;
  int ans = 0;
  int l = s.size();
  for (int i = 0; i < l/2; ++i) {
    if (s[i] == s[l-1-i]) continue;
    ++ans;
  }
  std::cout << ans << std::endl;
  
  return 0;
}

Measured memory_bytes: 3520
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	//--- lt以下の要素を探索 ---//
	static int search(int[] c,int lt) {
		for(int i = lt; i >= 0; i--) {
			if(Arrays.binarySearch(c, i) >= 0) {
				return Arrays.binarySearch(c, i);
			}
		}
		return -1;
	}
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int N = stdIn.nextInt();
		int Q = stdIn.nextInt();
		int[] c = new int[N];
		for(int i = 0; i < N; i++) {
			c[i] = stdIn.nextInt();
		}
		Arrays.sort(c);
		for(int i = 0; i < Q; i++) {
			int max = 0;
			int q = stdIn.nextInt();
			for(int j = c.length-1; j >= 0; j--) {
				if(c[j] % q > max) max = c[j] % q;
				int tmp = search(c,c[j]-c[j]%q-1);
				if(tmp == -1) {
					break;
				}
				else {
					j = tmp+1;
				}
			}
			System.out.println(max);
		}

		

	}
}

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

int main(){
  string s,t;cin >> s >> t;
  if(s.length() == t.length()-1){
    if(s == t.substr(0,s.length()))cout << "Yes" << endl;
    else cout << "No" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 3628
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int a, b;
    
    cin >> a >> b;
    
    if(a>=10||b>=10){
        
        cout <<"-1"<<endl;
        
    }
    
    else{
        
        cout << a * b << endl;
    
    }
}

Measured memory_bytes: 3596
function Main(input){ 
  var N = input.trim();
  N = parseInt(N,10);
  var array = input.trim().split("");
  var count = 0;
  switch(array.length){
    case 1:
      count += N;
    break;
    case 2:
      count += 9;
    break;
    case 3:
      count += (N-90);
    break;
    case 4:
      count += 909;
    break;
    case 5:
      count += (N-9090);
    break;
    case 6:
      count += 90909;
    break;
  }
  console.log(count);

  
}
    Main(require('fs').readFileSync('/dev/stdin','utf8'));

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


#define li          long long int
#define rep(i,to)   for(li i=0;i<((li)(to));i++)
#define repp(i,start,to)    for(li i=(li)(start);i<((li)(to));i++)
#define pb          push_back
#define sz(v)       ((li)(v).size())
#define bgn(v)      ((v).begin())
#define eend(v)     ((v).end())
#define allof(v)    (v).begin(), (v).end()
#define dodp(v,n)       memset(v,(li)n,sizeof(v))
#define bit(n)      (1ll<<(li)(n))
#define mp(a,b)     make_pair(a,b)
#define rin rep(i,n)
#define EPS 1e-12
#define ETOL 1e-8
#define MOD 998244353
typedef pair<li, li> PI;

#define INF bit(60)

#define DBGP 1


#define idp if(DBGP)
#define F first
#define S second
#define p2(a,b)     idp cout<<a<<"\t"<<b<<endl
#define p3(a,b,c)       idp cout<<a<<"\t"<<b<<"\t"<<c<<endl
#define p4(a,b,c,d)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<endl
#define p5(a,b,c,d,e)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<endl
#define p6(a,b,c,d,e,f)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<endl
#define p7(a,b,c,d,e,f,g)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<endl
#define p8(a,b,c,d,e,f,g,h)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<endl
#define p9(a,b,c,d,e,f,g,h,i)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<endl
#define p10(a,b,c,d,e,f,g,h,i,j)        idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<"\t"<<j<<endl
#define foreach(it,v)   for(__typeof((v).begin()) it=(v).begin(); it!=(v).end(); ++it)
#define p2p(x)      idp p2((x).F, (x).S)
#define dump(x,n)   idp{rep(i,n){cout<<x[i]<<" ";}puts("");}
#define dump2(x,n)  idp{rep(i,n){cout<<"["<<x[i].F<<" , "<<x[i].S<<"] ";}puts("");}
#define dumpi(x)    idp{foreach(it, x){cout<<(*it)<<" ";}puts("");}
#define dumpi2(x)   idp{foreach(it, x){cout<<"["<<(it)->F<<" , "<<(it)->S<<"] ";}puts("");}

#define read2d(a,w,h)   rep(i,h)rep(j,w)cin>>a[i][j]
#define dump2d(a,w,h)   rep(i,h){rep(j,w)cout<<a[i][j]<<" ";puts("");}

typedef pair<li, li> PI;


li a, b, c;

inline bool check() {
    if (c - a - b < 0) {
        return false;
    }
    li cab2 = (c - a - b) * (c - a - b);
    li ab4 = a * b * 4;
    return ab4 < cab2;
}

int main() {
    cin >> a >> b >> c;
    cout << (check() ? "Yes" : "No") << endl;

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main() {
    int H, N;
    scanf("%d %d", &H, &N);
    int sum = 0;
    int temp;
    int i;
    for(i=0; i<N; i++) {
        scanf("%d", &temp);
        sum += temp;
    }
    if(H <= sum) {
        printf("Yes\n");
    }
    else {
        printf("No\n");
    }
    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const ll inf = 3e18;
const char sp = ' ';


int N, A;
set<int>st;
int main() {
	cin >> N;
	while (N--) {
		cin >> A;
		st.insert(A);
	}
	cout << st.size() << endl;
}


Measured memory_bytes: 7684
from itertools import combinations


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

for i, j in combinations(range(n + 2), 2):
    a, b, c = i, j - i - 1, n + 1 - j
    if 10000 * a + 5000 * b + 1000 * c == y:
        print(a, b, c)
        exit()

print(-1, -1, -1)


Measured memory_bytes: 40812
import math
N, D = map(int, input().split())
X = []
for i in range(N):
    X.append(list(map(int,input().split())))

ans = 0

def ks(x,y):
    p = 0
    for i in range(D):
        p += (x[i]-y[i])**2
    return p**(1/2)



for j in range(N):
    for k in range(N-j-1):
        l = ks(X[j], X[-k-1])
        if l % 1 == 0:
            ans += 1
print(ans)

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

int main()
{
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	
	if(fabs(a-c)<=d)
	{
		cout<<"Yes"<<endl;
		return 0;
	}
	else if(fabs(a-b)<=d&&fabs(b-c)<=d)
	{
		cout<<"Yes"<<endl;
		return 0;
	}
	
	cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
package main

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

func configure(scanner *bufio.Scanner) {
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 1000005), 1000005)
}
func getNextString(scanner *bufio.Scanner) string {
	scanned := scanner.Scan()
	if !scanned {
		panic("scan failed")
	}
	return scanner.Text()
}
func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}
func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}
func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}
func main() {
	fp := os.Stdin
	wfp := os.Stdout
	extra := 0
	if os.Getenv("I") == "IronMan" {
		fp, _ = os.Open(os.Getenv("END_GAME"))
		extra = 100
	}
	scanner := bufio.NewScanner(fp)
	configure(scanner)
	writer := bufio.NewWriter(wfp)
	defer func() {
		r := recover()
		if r != nil {
			fmt.Fprintln(writer, r)
		}
		writer.Flush()
	}()
	solve(scanner, writer)
	for i := 0; i < extra; i++ {
		fmt.Fprintln(writer, "-----------------------------------")
		solve(scanner, writer)
	}
}
func solve(scanner *bufio.Scanner, writer *bufio.Writer) {
	n := getNextInt(scanner)
	k := getNextInt(scanner)
	aa := make([]int, n)
	for i := 0; i < n; i++ {
		aa[i] = getNextInt(scanner)
	}
	sort.Ints(aa)
	mc := newModcom(n)
	var ans mint
	for i := 0; i < n; i++ {
		if i >= k-1 {
			ans.addAs(mc.choose(i, k-1).mul(mint(aa[i])))
		}
		if n-(i+1) >= k-1 {
			ans.subAs(mc.choose(n-(i+1), k-1).mul(mint(aa[i])))
		}
	}
	fmt.Fprintln(writer, ans)
}

type modcom struct {
	facs, invs []mint
}

func newModcom(n int) modcom {
	facs := make([]mint, n+1)
	invs := make([]mint, n+1)
	facs[0] = 1
	for i := 0; i < n; i++ {
		facs[i+1] = facs[i].mul(mint(i + 1))
	}
	invs[n] = facs[n].inv()
	for i := n - 1; i >= 0; i-- {
		invs[i] = invs[i+1].mul(mint(i + 1))
	}
	return modcom{
		facs: facs,
		invs: invs,
	}
}
func (mc *modcom) choose(n, k int) mint {
	return mc.facs[n].mul(mc.invs[k]).mul(mc.invs[n-k])
}

type mint int64

func (mt mint) mod() mint {
	m := mint(1e9 + 7)
	mt %= m
	if mt < 0 {
		return mt + m
	}
	return mt
}
func (mt mint) inv() mint {
	return mt.pow(mint(0).sub(2))
}
func (mt mint) pow(n mint) mint {
	p := mint(1)
	for n > 0 {
		if n&1 == 1 {
			p.mulAs(mt)
		}
		mt.mulAs(mt)
		n >>= 1
	}
	return p
}
func (mt mint) add(x mint) mint {
	return (mt + x).mod()
}
func (mt mint) sub(x mint) mint {
	return (mt - x).mod()
}
func (mt mint) mul(x mint) mint {
	return (mt * x).mod()
}
func (mt mint) div(x mint) mint {
	return mt.mul(x.inv())
}
func (mt *mint) addAs(x mint) *mint {
	*mt = mt.add(x)
	return mt
}
func (mt *mint) subAs(x mint) *mint {
	*mt = mt.sub(x)
	return mt
}
func (mt *mint) mulAs(x mint) *mint {
	*mt = mt.mul(x)
	return mt
}
func (mt *mint) divAs(x mint) *mint {
	*mt = mt.div(x)
	return mt
}


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

int main(){
  int l;
  cin >> l;
  int f = l/100;
  l = l-(l/100)*100;
  if (f==0)
  {
    if(0<l &&l< 13)
    {
      cout << "YYMM";
    }else
    {
      cout << "NA";
    }
    return 0;

  }
  if (l==0)
  {
    if(0< f&&f< 13)
    {
      cout << "MMYY";
    }else
    {
      cout << "NA";
    }
    return 0;

  }
  if(l < 13 && f < 13)
  {
    cout << "AMBIGUOUS";
  }
  else if(l > 12 && f < 13){
    cout << "MMYY";
  }
  else if(f > 12 && l < 13){
      cout << "YYMM";
  }
  else if(f > 12 && l > 12){
    cout << "NA";
  }
  return 0;

}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string.h>
#include <set>
#include <map>
#include <unordered_map>
#include <assert.h>
#include <algorithm>
#include <queue>
#include <bitset>
#include <stack>
#include <chrono>
#include <random>
#define all(x) x.begin(),x.end()
#define ff first
#define ss second
#define ll long long
#define INF 1000000000000000000
#define MOD 1000000007
#define rnd mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define FIO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define uid uniform_int_distribution <int>
using namespace std;

int main() {
	int a;
	cin >> a;
	cout << a + a * a + a * a * a;
}


Measured memory_bytes: 3596
#include <iostream>
#include <vector>
#include <math.h>
#include <algorithm>
#include <stdio.h>
#include <string>
using namespace std;

int main(){
  long int N;
  cin >> N;
  vector<int> v;
  int max = 0,min = 10;
  int ans = 0;
  int J;
  
  for(int i=0;i<N;i++){
    int x;
    cin >> x;
    v.push_back(x);
  }
  max = v[0];
  min = v[0];
  for(int i=0;i<N;i++){
    if(max < v[i]){
      max = v[i];
    }
    else{
      if(min >= v[i]){
	ans++;
	min = v[i];
      }
    }
  }
  cout << ans << endl;
  return 0;
  }


Measured memory_bytes: 1400
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <sstream>
#include <algorithm>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <list>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <climits>
#include <bitset>
#include <functional>
#include <numeric>
#include <ctime>
#include <cassert>
#include <cstring>
#include <fstream>

using namespace std;

int main() {
    int k;
    cin >> k;
    vector<long long> a(k);
    for (int i = 0; i < k; i++) {
        cin >> a[i];
    }
    long long x = 2, y = 2;

    for (int i = k - 1; i >= 0; i--) {
        long long mod1 = x % a[i];
        long long toadd = (a[i] - mod1) % a[i];
        long long minx = x + toadd;

        long long mod2 = y % a[i];
        long long tosub = mod2;
        long long maxx = y - tosub;

        if (minx > maxx) {
            cout << -1 << endl;
            return 0;
        }
        else {
            x = minx;
            y = maxx + a[i] - 1;
        }
    }
    cout << x << " " << y << endl;
    return 0;
}

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

using namespace std;
int main()
{
    int n,c;
    cin >> n >> c;
    int a[c];
    int cnt=0;
    for(int i=0;i<c;i++){
        cin >> a[i];
        cnt+=a[i];
    }
    int ans;
    if(cnt%(n+1)==0){
        ans=cnt/(n+1);
    }else{
        ans=cnt/(n+1)+1;
    }
    cout << ans << endl;
    return 0;
}



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

int main(){
  int n;
  cin >> n;
  if(n%10 == 2 or n%10 == 4 or n%10 == 5 or n%10 == 7 or n%10 == 9) cout << "hon" << endl;
  if(n%10 == 0 or n%10 == 1 or n%10 == 6 or n%10 == 8) cout << "pon" << endl;
  if(n%10 == 3) cout << "bon" << endl;
  
  return 0;
}


Measured memory_bytes: 3636
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rep2(i,s,f) for(int i=s;i<f;i++)
#define INF 1000000000000000000
#define MOD 1000000007
#define endl "\n"
#define fcout cout<<fixed<<setprecision(15)
typedef pair<int, int> P;
//struct edge { int to, cost; };

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

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

bool prime(int n) {
    for (int i = 2; i <= sqrt(n); i++) {
        if (n % i == 0)return false;
    }
    return n != 1;
}
int gcd(int x, int y) {
    if (y == 0)return x;
    return gcd(y, x % y);
}
int lcm(int x, int y) {
    return x / gcd(x, y) * y;
}
int mod_pow(int n, int p, int m) {
    if (p == 0) return 1;
    if (p % 2 == 0) {
        int t = mod_pow(n, p / 2, m);
        return (t * t) % m;
    }
    return n * mod_pow(n, p - 1, m) % m;
}
int extGCD(int a, int b, int& x, int& y) {
    if (b == 0) {
        x = 1;
        y = 0;
        return a;
    }
    long long d = extGCD(b, a % b, y, x);
    y -= a / b * x;
    return d;
}
int modinv(int a, int m) {
    int b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
int modinv2(int a, int mod) {
    return mod_pow(a, mod - 2, mod);
}
int digit(int x) {
    int cnt = 0;
    while (x > 0) {
        cnt += x % 10;
        x /= 10;
    }
    return cnt;
}
int read() {
    int tmp;
    cin >> tmp;
    return tmp;
}
int xor128() {
    static int x = 123456789, y = 362436069, z = 521288629, w = 88675123;
    int t = (x xor (x << 11));
    x = y; y = z; z = w;
    return (w = (w xor (w >> 19)) xor (t xor (t >> 8)));
}
map<int, int> factaring(int x) {
    map<int, int>ans;
    int now = 2;
    while (now * now <= x) {
        if (x % now == 0) {
            x /= now;
            ans[now]++;
        }
        else now++;
    }
    if (x != 1) ans[x]++;
    return ans;
}
int comb(int n, int k, int mod) {
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    k = min(k, n - k);
    int x = 1, y = 1;
    rep(i, k) {
        y *= i + 1;
        y %= mod;
    }
    for (int i = n - k + 1; i <= n; i++) {
        x *= i;
        x %= mod;
    }
    return x * modinv(y, mod) % mod;
}

signed main() {
    //srand((unsigned)time(NULL));

    cin.tie(nullptr);
    ios::sync_with_stdio(false);

    int n;
    int a[20005], b[20005];

    cin >> n;
    rep(i, n) {
        a[i] = 1 + i * 20000;
        b[i] = 20000 * (n-1) + 1 - i * 20000;
    }

    rep(i, n) {
        int q;
        cin >> q;
        a[q - 1] += i;
    }
    rep(i, n) {
        cout << a[i] << " ";
    }
    cout << endl;
    rep(i, n) {
        cout << b[i] << " ";
    }
    cout << endl;

    return 0;
}


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

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

    ll x;
    cin >> x;
    ll s = 0;
    ll i = 1;
    while (s < x){
        s += i;
        i++;
        //cout << s << endl;
    }
    cout << i-1 << endl;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)
constexpr int mod=1000000007;
constexpr int mod1=998244353;
vector<int> dx={0,-1,0,1},dy={1,0,-1,0};
bool inside(int y,int x,int h,int w){
	if(y<h && y>=0 && x<w && x>=0) return true;
	return false;
}





int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int m,d;cin >> m >> d;
	int ans = 0;
	for(int i = 1; i <= m; i++){
		for(int j = 22; j <= d; j++){
			int d1 = j % 10, d2 = j / 10;
			if(d1 >= 2 && d2 >= 2 && d1 * d2 == i) ans++;
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 892
#include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int H,W;
int C[10][10];

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>H>>W;
	FOR(x,10) FOR(y,10) cin>>C[x][y];
	
	FOR(r,10) FOR(x,10) FOR(y,10) C[x][y]=min(C[x][y],C[x][r]+C[r][y]);
	
	
	ll ret=0;
	FOR(y,H) FOR(x,W) {
		cin>>r;
		if(r>=0) ret+=C[r][1];
	}
	cout<<ret<<endl;
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String args[]) {

		Scanner sc = new Scanner(System.in);
		int X =sc.nextInt();

		for(int i=X;i>0;i--) {

			if(i == 1) {
				System.out.println(1);
				return;
			}

			for(int b=(int)Math.sqrt(i)+1;b>2;b--) {
				int temp = i;
				int p = 0;
				while(temp % b == 0) {
					p++;
					temp /= b;
				}

				if(temp == 1 && p > 1) {
					System.out.println(i);
					return;
				}
			}
		}
	}
}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i < (int)(n); i++)
#define Sort(a) sort(a.begin(), a.end())
typedef long long int ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
template <class T> inline bool chmax(T& a,T b){if(a<b){a=b;return true;} return false;}
template <class T> inline bool chmin(T& a,T b){if(a>b){a=b;return true;} return false;}

int main(){
    ll n;
    cin >> n;
    vll a(n);
    rep(i, n) {
        cin >> a[i];
    }
    ll kabu = 0;
    ll money = 1000;
    ll up_down = -1;
    rep(i, n-1) {
        if(a[i] < a[i+1]) {
            if(up_down != 0) {
                kabu = money/a[i];
                money %= a[i];
            }
            up_down = 0;
        }
        else if(a[i] > a[i+1]) {
            if(up_down != 2) {
                money += kabu*a[i];
                kabu = 0;
            }
            up_down = 2;
        }
    }
    money += a[n-1]*kabu;
    cout << money << endl;
    return 0;
}

Measured memory_bytes: 3628
import java.util.*;
import java.lang.*;
import java.math.*;

public class Main {
	Scanner sc = new Scanner(System.in);
	String rev(String a){
		String ret = "";
		for(int i = a.length()-1;i >= 0; i--){
			ret += a.charAt(i);
		}
		return ret;
	}
	void run(){
		int n = sc.nextInt();
		for(int z = 0; z < n; z++){
			String in = sc.next();
			LinkedList<String> pattern = new LinkedList<String>();
			for(int i = 0;i < in.length();i++){
				String sub1 = in.substring(0,i);
				String sub2 = in.substring(i, in.length());
				String m1 = sub1+sub2;
				String m2 = rev(sub1)+sub2;
				String m3 = sub1+rev(sub2);
				String m4 = rev(sub1)+rev(sub2);
				if(!pattern.contains(m1)){
					pattern.add(m1);
				}
				if(!pattern.contains(m2)){
					pattern.add(m2);
				}
				if(!pattern.contains(m3)){
					pattern.add(m3);
				}
				if(!pattern.contains(m4)){
					pattern.add(m4);
				}
				m1 = rev(m1);
				m2 = rev(m2);
				m3 = rev(m3);
				m4 = rev(m4);
				if(!pattern.contains(m1)){
					pattern.add(m1);
				}
				if(!pattern.contains(m2)){
					pattern.add(m2);
				}
				if(!pattern.contains(m3)){
					pattern.add(m3);
				}
				if(!pattern.contains(m4)){
					pattern.add(m4);
				}
			}
/*			for(String pat:pattern){
				System.out.println("\t"+pat);
			}*/
			System.out.println(pattern.size());
		}
	}
	public static void main(String[] args){
		Main m = new Main();
		m.run();
	}
}

Measured memory_bytes: 16000
<?php
while($n = trim(fgets(STDIN))){
    $s = [];
    for($i = 0; $i < $n; $i++){
        $s[] = trim(fgets(STDIN));
    }
    $ans = floor((array_sum($s) - (max($s) + min($s))) / ($n - 2));
    echo $ans."\n";
}

Measured memory_bytes: 15128
import sys

import numpy as np

sys.setrecursionlimit(10000)
INF = float('inf')

N = int(input())
A = list(map(int, input().split()))
A = np.array(A)

s = 0
L = 0
r = 0
ans = 0
while L < N:
    while r < N and s + A[r] == s ^ A[r]:
        s += A[r]
        r += 1
    ans += r - L
    s -= A[L]
    L += 1
print(ans)


Measured memory_bytes: 32580
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    S = readline().strip()

    print('x' * len(S))

    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 79564
#include <iostream>
#include <string>
using namespace std;
typedef long long LL;
const char nc[20] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J'};
string ans;
int main() {
    LL m, k, t;
    while(cin >> m) {
        if(m==0){
            cout<<"0"<<endl;
            continue;
        }
        int n=-2;
        ans = "";
        while(m != 0) {
            k = m % n;
            t = m / n;
            if(k < 0) {
                k -= n;
                t++;
            }
            m = t;
            ans.push_back(nc[k]);
        }
        for(int i = ans.length() - 1; i >= 0; i--) {
            cout << ans[i];
        }
        cout<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
    REP(i,v.size()){if(i)os<<" ";os<<v[i];}return os;}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
    REP(i,v.size()){if(i)os<<endl;os<<v[i];}return os;}

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

const int dx4[4] = {1, 0, -1, 0};
const int dy4[4] = {0, 1, 0, -1};

const int dx8[8] = {1,1,0,-1,-1,-1,0,1};
const int dy8[8] = {0,1,1,1,0,-1,-1,-1};

vector< vector<int> > Graph;
vector< int > value;




int main(int argc, const char * argv[]) {
    
    // remove the bottom 3 lines when you submit this code.
    std::ifstream in("sample.txt");
    std::cin.rdbuf(in.rdbuf());

    cin.tie(0);
    ios::sync_with_stdio(false);

    int H,W; cin >> H >> W;
    vector<string> field(H+2);
    rep(i,W+2){
        field.front() += '#';
        field.back() += '#';
    }
    for (int i = 1; i < H+1; i++) {
        string s; cin >> s;
        field[i] = '#' + s + '#';
    }
    rep(i,H+2) cout << field[i] << endl;
    
}



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

#define bb      begin()
#define ee      end()
#define ff      first
#define ss      second
#define pb      push_back
#define pf      push_front
#define popb    pop_back()
#define popf    pop_front()
#define mem(a , v)    memset(a , v , sizeof(a))

typedef long long ll;
typedef long double ld;

using namespace std;

const int BIG = 1e5+9;
const int INF = 1e9+9;
const ll BINF = 1e18+9;
const double SML = (1e-7);

int q,t,f,i;
char c;
string s;
list<char> l;
list<char>::const_iterator it;
bool rev=false;

int main()
{
    //freopen("output.txt" , "w" , stdout);
    //freopen("input.txt" , "r" , stdin);
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin>>s;
    for(i=0 ; i<s.size() ; i++)
    {
        l.pb(s[i]);
    }
    cin>>q;
    for(i=0 ; i<q ; i++)
    {
        cin>>t;
        if(t==1)
        {
            if(rev)
            {
                rev=false;
            }
            else
            {
                rev=true;
            }
        }
        else
        {
            cin>>f>>c;
            if(f==1)
            {
                if(!rev)
                {
                    l.pf(c);
                }
                else
                {
                    l.pb(c);
                }
            }
            else
            {
                if(!rev)
                {
                    l.pb(c);
                }
                else
                {
                    l.pf(c);
                }
            }
        }
    }
    if(rev)
    {
        reverse(l.bb , l.ee);
    }
    for(it=l.bb ; it!=l.ee ; it++)
    {
        cout<<*it;
    }
    return 0;
}


Measured memory_bytes: 10064
#include<bits/stdc++.h>
using namespace std;
int main()
{
long long int n,x=1,y,sum=0,a;
cin>>a;
while(a)
{
    if(a==1)
    {
        sum=sum+(x);
        break;
    }
    else
    {
        a=a/2;
          sum=sum+x;
        x=x*2;

    }
}
cout<<sum;
    return 0;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
#define _LIBCPP_DEBUG 0

using namespace std;
#define ll long long
#define rep(i,n) for (int i = 0; i < n; i++)
#define rrep(i,n) for (int i = n-1; i >= 0; i--)
#define MOD (1000000007)
#define vi vector<int>
#define vl vector<ll>
#define vb vector<bool>
#define vvi vector<vi>
#define vvl vector<vl>
#define pii pair<int, int>
#define pli pair<ll, int>a
#define pb push_back
#define sz(x) int(x.size())

#define mp make_pair
#define all(a) (a).begin(),(a).end()

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

ll gcd(ll a, ll b) {
    if (b == 0) return a;
    else return gcd(b, a % b);
}

ll keta(ll n){
  string s = to_string(n);
  ll num = s.size();
  return num;
}

const ll INF = 1LL << 60;

const int dh[4] = {1,0,-1,0};
const int dw[4] = {0,1,0,-1};

struct Edge{
  int to;
  int weight;
  Edge(int t, int w) : to(t), weight(w){}
};
using Graph = vector<vector<Edge>>;
using P = pair<ll, int>;

class UnionFind{
public:
  vi Parent;
  UnionFind(int n){
    Parent = vi(n,-1);
  }

  int root(int a){
    if(Parent[a] < 0) return a;
    else return Parent[a] = root(Parent[a]);
  }

  int size(int a){
    return -Parent[root(a)];
  }

  bool merge(int a, int b){
    a = root(a);
    b = root(b);
    if(a == b) return false;

    if(size(a) < size(b)) swap(a,b);
    Parent[a] += Parent[b];
    Parent[b] = a;

    return true;
  }
};

class Factrial{
public:
  vl Fac;
  Factrial(int MAX){
    Fac = vl(MAX+1);
    rep(i,MAX) {
      if(i == 0) Fac[i+1] = 1;
      else Fac[i+1] = ((i+1)*Fac[i])%MOD;
    }
  }
};

int H,W;
vector<string> s;

int main(){
  cin >> H >> W;
  s.resize(H);
  rep(h,H) cin >> s[h];

  int ans = 0;

  rep(h,H) rep(w,W) {
    if(s[h][w] == '#') continue;
    vvi dist(H, vi(W, -1));
    queue<pii> q;
    dist[h][w] = 0;
    q.push(mp(h,w));

    while (!q.empty())
    {
      pii v = q.front();
      q.pop();
      int h = v.first;
      int w = v.second;
      rep(dir, 4)
      {
        int nh = h + dh[dir];
        int nw = w + dw[dir];
        if (nh < 0 || nh == H || nw < 0 || nw == W)
          continue;
        if (s[nh][nw] == '#' || dist[nh][nw] != -1)
          continue;
        dist[nh][nw] = dist[h][w] + 1;
        q.push(mp(nh, nw));
      }
    }
    rep(h,H) rep(w,W) {
      if(s[h][w] == '#') continue;
      chmax(ans, dist[h][w]);
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
import numpy as np

K =int(input())
S = [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]
ans = S[K-1]

print(ans)

#print(*ans, sep='\n')

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

using namespace std;

#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 INF 1000000001
#define INFL (1LL << 60)
#define MOD 1000000007
#define ALL(v) v.begin(),v.end()
#define pb push_back
#define ll long long int
#define P pair<ll, ll>

int main() {
  int n;
  cin >> n;
  ll ans = 0;
  bool f = true;
  int m = INF;
  REP(i, n){
    ll a, b;
    cin >> a >> b;
    if(a != b) f = false;
    ans += a;
    if(a>b) m = min((int)b, m);
  }
  if(f) cout << 0 << endl;
  else cout << ans-m << endl;
  return 0;
}


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

const int N=300000;
int cnt[N];

int main()
{
    int n;
    scanf("%d",&n);
    for (int i=2;i<=n;i++) {
        int x;
        scanf("%d",&x);
        cnt[x]++;
    }
    for (int i=1;i<=n;i++) {
        printf("%d\n",cnt[i]);
    }
    return 0;
}

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

   typedef long long ll;
   typedef pair<ll, ll> Pii;
   typedef vector<ll> Vi;
   typedef vector<Vi> VVi;

   const double EPS = (1e-7);
   const ll INF =(1e13);
   const double PI = (acos(-1));
   const ll MOD = ll(1e9) + 7;

   #define REP(i, n) for(ll i = 0; i < (ll)(n); i++)
   #define REPR(i, n) for(ll i = n; i > -1; i--)
   #define FOR(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++)
   #define ALL(x) (x).begin(),(x).end()
   #define SORT(x) sort((x).begin(), (x).end())
   #define RSORT(x) sort((x).rbegin(), (x).rend()
   #define REVERSE(x) reverse((x).begin(), (x).end())
   #define SZ(x) ((ll)(x).size())
   #define pb push_back
   #define mp make_pair

   //chmax(a, b): a>bならaをbで更新　更新したときにtrueを返す
   //chmin(a, b): a<bならaをbで更新　更新したときにtrueを返す
   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; }

   #define dump(x) cerr<< #x << "= " << (x) << endl;

   ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
   ll pow(ll a, ll b){if (b == 0) return 1; else if (b % 2 == 0) return pow(a * a, b / 2); else return pow(a * a, b / 2) * a;}
   ll pow(ll a, ll b, ll m){if (b == 0) return 1; else if (b % 2 == 0) return (pow(a * a, b / 2, m) % m); else return (pow(a * a, b / 2) * a) % m;}
   ll residue(ll a, ll m){return ((a % m) + m) % m;};

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

int main(){
  int n, h, w;
  cin >> n >> h >> w;
  cout << (n - h + 1) * (n - w + 1) << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <math.h>



int main (void) {
char S[10]={'\0'};
char T[10]={'\0'};
char U[10]={'\0'};
int A,B;
scanf("%s %s",S,T);
scanf("%d %d",&A,&B);
scanf("%s",U);
if (strcmp(U,S)==0) A--;
else if (strcmp(U,T)==0) B--;
printf("%d %d",A,B);
return EXIT_SUCCESS;
}






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

using namespace std;

int main()
{
  int a, b;
  cin >> a;
  for (int i = 1; i < 10; i++)
  {
    if (a % i == 0 && a / i < 10)
    {
      cout << "Yes\n";
      return 0;
    }
  }
  cout << "No\n";
}


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

typedef long long ll;
using namespace std;

void solve(){
    string s, t;
    cin >> s >> t;
    if ((int)t.size() - (int)s.size() != 1) {
        cout << "No" << endl;
    }
    else {
        if (t.substr(0, (int)t.size() - 1) != s) {
            cout << "No" << endl;
        }
        else {
            cout << "Yes" << endl;
        }
    }
}

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

    solve();

    return 0;
}



Measured memory_bytes: 3656
#include<bits/stdc++.h>
using namespace std;
using UL = unsigned long;
using ULL = unsigned long long;
using LL = long long;
#define rep(i, n) for(UL i = 0; i < (n); i++)

struct Problem {

    void Solve() {
        int N; cin >> N;
        for (int i = 1; i <= N; i++) {
            int x = i;
            if (x % 3 == 0) {
                cout << " " << i;
                continue;
            }
            do {
                if (x % 10 == 3) {
                    cout << " " << i;
                    break;
                }
                x /= 10;
            } while (x);
        }
        cout << endl;
    }
};
int main() {
    unique_ptr<Problem> p(new Problem());
    cout << fixed << setprecision(10);
    p->Solve();
    return 0;
}



Measured memory_bytes: 3104
#include <stdio.h>
#include<stdlib.h>
#include<math.h>

int main() {
	int X, num, i,flag=0;

	scanf("%d", &X);
	for (;;) {
		for (i = 2; i <= X; i++) {
			if (X == i)flag = 1;
			else if (X%i == 0)break;
		}
		if (flag == 1)break;
		X++;
	}

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

	return 0;
}

Measured memory_bytes: 128
def resolve():
    N = int(input())
    g = {}
    edges_to_idx = {}
    edges = []
    for i in range(N-1):
        a, b = list(map(int, input().split()))
        g.setdefault(a-1, [])
        g[a-1].append(b-1)
        g.setdefault(b-1, [])
        g[b-1].append(a-1)
        edges_to_idx.setdefault("{}-{}".format(a-1, b-1), i)
        edges_to_idx.setdefault("{}-{}".format(b-1, a-1), i)
        edges.append((a-1, b-1))

    nodes = [(None, 0)]
    colors = [None for _ in range(N-1)]
    maxdeg = 0
    while nodes:
        prevcol, node = nodes.pop()
        maxdeg = max(maxdeg, len(g[node]))
        idx = 0
        for col in range(1, len(g[node])+1):
            if col == prevcol:
                continue
            nxt = g[node][idx]
            coloridx = edges_to_idx["{}-{}".format(node, nxt)] 
            if colors[coloridx] is not None:
                idx += 1
                if idx >= len(g[node]):
                    break
                nxt = g[node][idx]
                coloridx = edges_to_idx["{}-{}".format(node, nxt)] 
            colors[coloridx] = col
            nodes.append((col, nxt))
            idx += 1
            if idx >= len(g[node]):
                break
            
    
    print(maxdeg)
    for col in colors:
        print(col)
            
            




if '__main__' == __name__:
    resolve()


Measured memory_bytes: 165784
#include <iostream>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <vector>
#include <complex>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <bitset>
#include <ctime>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cassert>
#include <cstddef>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <sstream>
#include <fstream>
#include <functional>

using namespace std;
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define FOR(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define RREP(i, a) for(int (i) = (a) - 1; (i) >= 0; (i)--)
#define FORR(i, a, b) for(int (i) = (a) - 1; (i) >= (b); (i)--)
#define DEBUG(C) cerr << #C << " = " << C << endl;
using LL = long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<LL>;
using VVL = vector<VL>;
using VD = vector<double>;
using VVD = vector<VD>;
using PII = pair<int, int>;
using PDD = pair<double, double>;
using PLL = pair<LL, LL>;
using VPII = vector<PII>;
template<typename T> using VT = vector<T>;
#define ALL(a) begin((a)), end((a))
#define RALL(a) rbegin((a)), rend((a))
#define SORT(a) sort(ALL((a)))
#define RSORT(a) sort(RALL((a)))
#define REVERSE(a) reverse(ALL((a)))
#define MP make_pair
#define FORE(a, b) for (auto &&a : (b))
#define FIND(s, e) ((s).find(e) != (s).end())
#define EB emplace_back
template<typename T> inline bool chmax(T &a, T b){if (a < b){a = b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if (a > b){a = b;return true;}return false;}

const int INF = 1e9;
const int MOD = INF + 7;
const LL LLINF = 1e18;

// 素因数分解
// O(√N * std::map)
//res[i] = n : iがn個
std::map<long long, int> prime_factor_decomposition(long long N) {
    std::map<long long, int> res;
    for (long long i = 2; i * i <= N; i++) {
        int cnt = 0;
        while(N % i == 0) {
            cnt++;
            N /= i;
        }
        if (cnt) {
            res[i] = cnt;
        }
    }
    if (N != 1) {
        res[N] = 1;
    }
    return res;
}

LL pow_mod(LL a, LL p) {
    if (p == 0) return 1;
    else if (p % 2) return a * pow_mod(a, p - 1);
    else {
        auto t = pow_mod(a, p / 2);
        return t * t;
    }
}

int main(void) {
    LL N, P;
    cin >> N >> P;
    auto p = prime_factor_decomposition(P);
    LL ans = 1;
    FORE(e, p) {
        auto foo = e.second / N;
        if (foo > 0) {
            ans *= pow_mod(e.first, foo);
        }
    }
    cout << ans << endl;
}


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

using ll=long long;

using vi=vector<int>;
using vll=vector<ll>;
using vvi=vector<vi>;

int main() {
  int N; cin >>N;
  string A,B,C; cin >>A >>B >>C;
  int ans=0;
  rep(i,0,N) {
    set<char> a;
    a.insert(A[i]);
    a.insert(B[i]);
    a.insert(C[i]);
    ans+=a.size()-1;
  }
  cout <<ans <<endl;
  return 0;
}


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

#define vint vector<int>
#define vvint vector<vint>
#define rep(i, n) for(int i=0;i<(int)(n);i++) // 繰り返し処理
#define all(x) (x).begin(),(x).end() // 全体 こんな感じで使う→sort(all(a));
#define ct(a) cout << a << endl
#define iceil(a,b) (a+(b-1))/b //int ceil : 繰り上げの割り算 通常のceilではceil((7.0/2.0))のようにしなければならなかった。
vint CinLine(int N){vint v(N);for(int i=0;i<N;i++){cin >> v.at(i);}return v;}//cin line 連続でvectorに格納
void CoutLine(vint v){for(int i=0;i<v.size()-1;i++){cout<<v.at(i)<<" ";}cout << v.at(v.size()-1)<<endl;}

void Main(){
    int x;
    cin >> x;
    int a,b;
    bool f = true;
    for(a = -120 ; a <=120 ; a++){
        for(b = -120 ; b <=120 ; b++){
            if((pow(a,5) - pow(b,5)) == x){
                f = false;
                break;
            }
        }
        if(!f){
            break;
        }
    }
    cout << a << " " << b << endl;
}

int main() {
    Main();
}

Measured memory_bytes: 4024
#include <iostream>
using namespace std;
int main(){
    int a, b, c, x, y;
    cin >> a >> b >> c >> x >> y;
    int ans = 0;
    if (a+b >= 2*c) {
        int m = min(x, y);
        ans += 2*c*m;
        x -= m;
        y -= m;
        if (x) {
            if (a <= 2*c) {
                ans += x*a;
            }
            else
            {
                ans += x*2*c;
            }
        }
        if (y) {
            if (b <= 2*c) {
                ans += y*b;
            }
            else
            {
                ans += y*2*c;
            }
        }
    }
    else
    {
        ans = a*x + b*y;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
/*
AuThOr GaRyMr
技巧:
1.区别对待大数据&小数据！
2.Dp难推时算贡献！
3.long long (尤其乘法)！
4.long long INF 要大
5.Dp on trees: 换根法，每次清空当前的节点和换到的子节点
*/
#include<bits/stdc++.h>
#define rb(a,b,c) for(int a=b;a<=c;++a)
#define rl(a,b,c) for(int a=b;a>=c;--a)
#define niv vector<int>
#define LL long long
#define IT iterator
#define PB push_back
#define II(a,b) make_pair(a,b)
#define FIR first
#define SEC second
#define FREO freopen("check.out","w",stdout)
#define rep(a,b) for(int a=0;a<b;++a)
#define KEEP while(1)
#define SRAND mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define random(a) rng()%a
#define ALL(a) a.begin(),a.end()
using namespace std;
const int INF=0x3f3f3f3f;
typedef pair<int,int> mp;
typedef pair<mp,mp> superpair;
int main(){
	int a,b;
	cin>>a>>b;
	cout<<max(0,a-2*b)<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int maxn=1e5+7;
int main(){
    ll a,b,c,x;
    scanf("%lld %lld %lld",&a,&b,&x);
    ll ans=0;
    if(a==0) ans=b/x+1;
    else ans=(b/x)-(a-1)/x;
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define FOR(i,l,r) for(ll i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define REPS(i,n) FOR(i,1,n+1)
#define RFOR(i,l,r) for(ll i=(l);i>=(r);--i)
#define RREP(i,n) RFOR(i,n-1,0)
#define RREPS(i,n) RFOR(i,n,1)
#define pb push_back
#define eb emplace_back
#define SZ(x) ((ll)(x).size())
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
template<class T = ll> using V = vector<T>;
template<class T = ll> using VV = V<V<T>>;
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true; }return false; }
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true; }return false; }
inline void Yes(bool b = true) {cout << (b ? "Yes" : "No") << '\n';}
inline void YES(bool b = true) {cout << (b ? "YES" : "NO") << '\n';}
inline void err(bool b = true) {if(b) {cout << -1 << '\n'; exit(0);}}
template<class T> inline void fin(bool b = true, T e = 0) {if(b) {cout << e << '\n'; exit(0);}}
template<class T> T Roundup_div(T x, T y) {return (x+(y-1))/y;}
const ll INF = 1e18;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n; cin >> n;
    ll res = 0;
    REPS(i,n){
      	int d = n/i;
        res += i*d*(d+1) / 2;
    }
    cout << res << endl;
}

Measured memory_bytes: 3644
#include <iostream>
#include<algorithm>
#include<cstring>
using namespace std;
int compare(char a,char b)
{
    return a>b;
}
int main()
{
    char s[101],t[101];
    while(cin>>s>>t){
    if(strcmp(s,t)==0)
    {cout<<"No"<<endl; continue;}
    sort(s,s+strlen(s));
    sort(t,t+strlen(t),compare);
    if(strcmp(s,t)<1) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    }
    return 0;
}


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

int main() {
  int N;
  int min = 30;
  cin >> N;
  
  for (int i = 0; i < N; i++) {
    int a;
    cin >> a;
    int c = 0;
    while (a % 2 == 0) {
      c++;
      a /= 2;
    }
    if (c < min) {
      min = c;
    }
  }
  cout << min << endl;
}


Measured memory_bytes: 3600
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<queue>
#include<string>
#include<cstring>
#include<algorithm>
#include<set>
#include<map>
#include<iomanip>

#define REP(i,n) for(int i=0;i<(n);i++)
#define EPS (1e-7)
#define INF (2e9)
// cout << setprecision(10)

using namespace std;
typedef long long int ll;

ll N, K;
int main(void){
    cin >> N >> K;
    if(N==K) cout << 0 << endl;
    else if(N < K){
        cout << min(abs(N), abs(N-K)) << endl;
    }else{
        ll count = N / K;
        cout << min(abs(N-count*K), abs(N-(count+1)*K)) << endl;
    }
    return 0;
}



Measured memory_bytes: 256
// https://atcoder.jp/contests/abcXXX/tasks/abcXXX_x

#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using ull = unsigned long long;
using pll = pair<ll, ll>;

static const ll INF = 1001001001;
static const ll LLINF = 1001001001001001001;
static const ll MOD = (ll)1e9 + 7;
static const double EPS = 1e-9;

#define REP(i, n) for(ll i = 0; i < (n); ++i)
#define RANGE(i, m, n) for(ll i = (m); i <= (n); ++i)
#define RRANGE(i, m, n) for(ll i = (m); i >= (n); --i)
#define POSITIVE(x) (x)=((x) < 0) ? 0 : (x)

ll power(ll x, ll y) {
    ll ret = 1;
    while(y-- > 0) ret *= x;
    return ret;
}

ll gcd(ll a, ll b) {
    assert(a >= 0);
    assert(b >= 0);
    if (b == 0) return a;
    return gcd(b, a % b);
}

ll extgcd(ll a, ll b, ll& x, ll& y) {
    x = 1; y = 0;
    assert(a >= 0);
    assert(b >= 0);
    if (b == 0) return a;
    ll X, Y;
    auto d = extgcd(b, a % b, X, Y);
    x = Y;
    y = X - (a / b) * Y;
    return d;
}

int run(istream& in, ostream& out) {
    ll K, N;
    in >> K >> N;
    vector<ll> A(N);
    REP(i, N) {
        in >> A[i];
    }
    sort(A.begin(), A.end());
    ll ans = 0;
    ll min_dist = 0;
    REP(i, N) {
        if (i != N-1) {
            min_dist = max(min_dist, A[i+1] - A[i]);
        } else {
            min_dist = max(min_dist, K - A[i] + A[0]);
        }
    }
    ans = K - min_dist;
    out << ans << endl;
    return 0;
}

int main() {
    return run(cin, cout);
}


Measured memory_bytes: 1792