akhauriyash/Code-Regression huggingface dataset:
import collections, math

N = int(input())
s_l = [list(input()) for _ in range(N)]

for idx in range(N):
    s_l[idx] = "".join(sorted(s_l[idx]))

c = collections.Counter(s_l)
ans = 0

for i in c.values():
    if i >= 2:
        ans += math.factorial(i) / (math.factorial(i - 2) * math.factorial(2))

print(int(ans))

Measured memory_bytes: 30612
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>

using namespace std;
typedef long long llint;

llint n,a,b;
void solve(){
  cin >> n >> a >> b;
  if(a%2==b%2){
    cout << abs(a-b)/2 << endl;
  }
  else{
    llint top=a-1;
    llint down=n-b;
    llint ans=min(top,down)+1+abs(b-a-1)/2;
    cout << ans << endl;
  }

}

int main(int argc, char *argv[]) {
  solve();
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(void)
{
    int L,A,B,C,D,day,day1,day2;
    scanf("%d%d%d%d%d",&L,&A,&B,&C,&D);
    day1=(A/C);
    day2=(B/D);
    if(A%C>0)
        day1++;
    if(B%D>0)
        day2++;
    if(day1<day2)
        day=day2;
    else
        day=day1;
    printf("%d\n",L-day);
    return 0;
}

Measured memory_bytes: 596
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    ll n,p,q,r,t,x,y,flag,ct;
    cin>>n;
    r=n;
    //cout<<r<<endl;
    for(int i=0;i<=n;i++)
    {
    ct=0;p=i;
        while(p>0){ct+=p%9; p/=9; }
        p=n-i;
        while(p>0){ct+=p%6; p/=6; }
        //cout<<ct<<endl;
        if(r>ct) r=ct;
    }
    cout<<r<<endl;
    return 0;
}


Measured memory_bytes: 256
import sys
from sys import exit
from collections import deque
from bisect import bisect_left, bisect_right, insort_left, insort_right
from heapq import heapify, heappop, heappush
from itertools import product, permutations, combinations, combinations_with_replacement
from functools import reduce
from math import gcd, sin, cos, tan, asin, acos, atan, degrees, radians

sys.setrecursionlimit(10**6)
INF = 10**20
eps = 1.0e-20
MOD = 10**9+7

def lcm(x,y):
    return x*y//gcd(x,y)
def lgcd(l):
    return reduce(gcd,l)
def llcm(l):
    return reduce(lcm,l)
def powmod(n,i,mod):
    return pow(n,mod-1+i,mod) if i<0 else pow(n,i,mod)
def div2(x):
    return x.bit_length()
def div10(x):
    return len(str(x))-(x==0)
def intput():
    return int(input())
def mint():
    return map(int,input().split())
def lint():
    return list(map(int,input().split()))
def ilint():
    return int(input()), list(map(int,input().split()))
def judge(x, l=['Yes', 'No']):
    print(l[0] if x else l[1])
def lprint(l, sep='\n'):
    for x in l:
        print(x, end=sep)
def ston(c, c0='a'):
    return ord(c)-ord(c0)
def ntos(x, c0='a'):
    return chr(x+ord(c0))
class counter(dict):
    def __init__(self, *args):
        super().__init__(args)
    def add(self,x,d=1):
        self.setdefault(x,0)
        self[x] += d
    def list(self):
        l = []
        for k in self:
            l.extend([k]*self[k])
        return l
class comb():
    def __init__(self, n, mod=None):
        self.l = [1]
        self.n = n
        self.mod = mod
    def get(self,k):
        l,n,mod = self.l, self.n, self.mod
        k = n-k if k>n//2 else k
        while len(l)<=k:
            i = len(l)
            l.append(l[i-1]*(n+1-i)//i if mod==None else (l[i-1]*(n+1-i)*powmod(i,-1,mod))%mod)
        return l[k]
def pf(x):
    C = counter()
    p = 2
    while x>1:
        k = 0
        while x%p==0:
            x //= p
            k += 1
        if k>0:
            C.add(p,k)
        p = p+2-(p==2) if p*p<x else x
    return C

N=10**5
p=[1]*(N+1)
p[0]=p[1]=0
q=[0]*(N+1)
for i in range(2,N+1):
    if p[i]==1:
        tmp=2*i
        while tmp<=N:
            p[tmp]=0
            tmp+=i
    if i%2!=0 and p[i]==1 and p[(i+1)//2]==1:
        q[i]=q[i-1]+1
    else:
        q[i]=q[i-1]
Q=intput()
for _ in range(Q):
    l,r=mint()
    print(q[r]-q[l-1])

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

ll max(ll a, ll b){ 
	if(a >= b) return a;
	else if(a < b) return b;
}
ll min(ll a, ll b){ 
	if(a <= b) return a;
	else if(a > b) return b;
}
ll gcd(ll a, ll b){
	if(b == 0) return a;
	return gcd(b, a%b);
}
ll fact(ll n){
	ll res = 1;
	rep(i, n){
		res *= i + 1;
		res =  res%((ll)(1e9 + 7));
	}
	return res;
}
ll digit(const ll n){
	ll res = 0;
	ll i = 1;
	while(n % i != n){
		res += 1;
		i *= 10;
	}
	return res;
}

int main(){
	ll x;
	cin >> x;
	ll ans = 1;
	for(ll i = 1; i*(i+1)< 2*x; i++){
		ans = i+1;
	}
	cout << ans << endl;
}

Measured memory_bytes: 384
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

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

            int[,,] resident = new int[4,3,10];

            for(int i = 0; i < n; i++)
            {
                int[] nums = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
                resident[nums[0]-1,nums[1]-1,nums[2]-1]+=nums[3];
                
            }
            for(int i = 0; i < 4; i++)
            {
                for(int j = 0; j < 3; j++)
                {
                    for(int k=0;k<10;k++){
                        Console.Write(" "+resident[i,j,k]);
                    }
                    Console.WriteLine();
                }
                if(i<3){
                    Console.WriteLine("####################");
                }
            }
        }
    }
}



Measured memory_bytes: 18328
#include <bits/stdc++.h>
using namespace std;
#define int long long
struct str{
    int w;
    int v;
};
int dp[101][100001];
int knapsack(int n,str arr[],int w)
{   if(dp[n][w]!=-1)
      return dp[n][w];
    if(w==0)
    {
        return 0;
    }
    if(n==0)
    {
        return 0;
    }
  if(arr[n].w>w)
  {
     return knapsack(n-1,arr,w);
  }

 dp[n][w]= max(knapsack(n-1,arr,w),arr[n].v+knapsack(n-1,arr,w-arr[n].w));
 return dp[n][w];
}

signed main()
{
 int n,w;
 cin>>n>>w;
 str arr[n+1];
 for(int i=1;i<=n;i++)
 {

    cin>>arr[i].w>>arr[i].v;
 }
 for(int i=1;i<=100;i++)
 {
     for(int w=0;w<=100000;w++)
     {
         dp[i][w]=-1;
     }
 }
 cout<<knapsack(n,arr,w);

    return 0;
}


Measured memory_bytes: 78336
from collections import Counter
N=int(input())
Alist=[]
maxi=0
n2=0
for _ in range(N):
    A=int(input())
    Alist.append(A)
    if A>maxi:
        n2=maxi
        maxi=A
    elif A>n2:
        n2=A
count=Counter(Alist)
for A in Alist:
    if A!=maxi:
        print(maxi)
    elif A==maxi and count[A]>1:
        print(maxi)
    else:
        print(n2)

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


const int n = 30;
int N, M;
bool A[n][n];


void input() {
    cin >> N >> M;
    rep(i, N) {
        int k;
        cin >> k;
        rep(j, k) {
            int a;
            cin >> a;
            A[i][a-1] = true;
        }
    }
}


int main() {
    input();
    int ans = M;
    rep(i, M) {
        rep(j, N) {
            if (A[j][i] == false) {
                ans--;
                break;
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	long long ans = 0; 
	int N; cin >> N;
	long long A[80][80] = {}; // 2, 5の回数が0のとき10
	long long cnt = 0; 
	for(int i = 0; i < N; i++){
		string S; cin >> S;
		int L = (int) S.size(); 
		long long mul;
		int idx = -1; 
		for(int j = 0; j < L; j++){
			if(S.at(j) == '.'){
				idx = j; break; 
			}
		}
		if(idx == -1){
			mul = stoll(S); cnt ++; int t = 0; int f = 0; 
			while(mul % 2 == 0){
				t ++; mul /= 2; 
			}
			while(mul % 5 == 0){
				f ++; mul /= 5; 
			}
			A[t + 10][f + 10] ++; 
		}else{
			string T = S.substr(0, idx); 
			string U = S.substr(idx + 1, L - idx - 1); 
			long long sei = stoll(T); long long sho = stoll(U); 
			for(int k = 0; k < (int) U.size(); k++){
				sei *= 10; 
			}
			mul = sei + sho; 
			if(sho == 0LL) cnt++; 
			int t = 0; int f = 0; 
			while(mul % 2 == 0){
				t ++; mul /= 2; 
			}
			while(mul % 5 == 0){
				f ++; mul /= 5; 
			}
			int d = (int) U.size(); 
			t -= d; f -= d; 
			A[t + 10][f + 10] ++; 
		}
	}
	for(int i = 0; i < 80; i++){
		for(int j = 0; j < 80; j++){
			for(int k = 0; k < 80; k++){
				for(int l = 0; l < 80; l++){
					if(i + k >= 20 && j + l >= 20){
						ans += A[i][j] * A[k][l]; 
					}
				}
			}
		}
	}
	ans -= cnt; ans /= 2; 
	cout << ans << "\n";
}

Measured memory_bytes: 3696
#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <map>
#include <queue>

static const int INF = 1000000007;
using ll = long long;
using u32 = unsigned;
using namespace std;

int main() {
    ll mx = 1, my = 1;
    int n;
    cin >> n;
    cin >> mx >> my;
    for (int i = 0; i < n - 1; ++i) {
        int x, y;
        cin >> x >> y;
        ll k = max((mx+x-1)/x ,(my+y-1)/y);
        mx = k * x, my = k * y;
    }
    cout << mx + my << "\n";
    return 0;
}

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

#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) begin(r),end(r)
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)
#define vvl(v,w,h,init) vector<vector<ll>> v(w,vector<ll>(h,init))
#define mp(a,b) make_pair(a,b)

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

using ll = long long;
using pii = pair<int,int> ;
using pll = pair<ll,ll> ;
  const double EPS = 1e-8;
  const double INF = 1e12;
  typedef complex<double> P;//????´???°????????¢?????????????????¨?§£???
  namespace std {
    bool operator < (const P& a, const P& b) {//x????????????
      return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);
    }
    bool sorty(const P& a, const P& b) {//y????????????
      return imag(a) != imag(b) ? imag(a) < imag(b) : real(a) < real(b);
    }
  }
  double cross(const P& a, const P& b) {//??????
    return imag(conj(a)*b);
  }
  double dot(const P& a, const P& b) {//??????
    return real(conj(a)*b);
  }

  struct L : public vector<P> {//??´???
    L(){};
    L(const P &a, const P &b) {
      push_back(a); push_back(b);
    }
  };

  typedef vector<P> G;

  struct C {//???
    P p; double r;
    C(){};
    C(const P &p, double r) : p(p), r(r) { }
  };
  int ccw(P a, P b, P c) {//3????????????????????§????????§??????????????????
    b -= a; c -= a;
    if (cross(b, c) > 0)   return +1;       // counter clockwise
    if (cross(b, c) < 0)   return -1;       // clockwise
    if (dot(b, c) < 0)     return +2;       // c--a--b on line
    if (norm(b) < norm(c)) return -2;       // a--b--c on line
    return 0;//a--c--b on line
  }
  P crosspoint(const L &l, const L &m) {
    double A = cross(l[1] - l[0], m[1] - m[0]);
    double B = cross(l[1] - l[0], l[1] - m[0]);
    if (abs(A) < EPS && abs(B) < EPS) return m[0]; // same line
    if (abs(A) < EPS) assert(false); // !!!PRECONDITION NOT SATISFIED!!!
    return m[0] + B / A * (m[1] - m[0]);
  }
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  double x,y;
  cin >> x >> y;
  P a(x,y);
  cin >> x >> y;
  P b(x,y);
  ll q;
  cin >> q;
  rep(i,q){
    cin >> x >> y;
    P c(x,y);
    int k = ccw(a,b,c);
    if(k == 1){
      cout << "COUNTER_CLOCKWISE" << endl;
    }
    else if(k == -1){
      cout << "CLOCKWISE" << endl;
    }
    else if(k == 2){
      std::cout << "ONLINE_BACK" << std::endl;
    }
    else if(k == -2){
      std::cout << "ONLINE_FRONT" << std::endl;
    }
    else{
      std::cout << "ON_SEGMENT" << std::endl;
    }
  }
  return 0;
}

Measured memory_bytes: 3276
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <bitset>
#include <math.h>
#include <iomanip>
#include <queue>
#define out(X) cout << X << endl
#define out16(X) cout << setprecision(16) << X << endl
#define rep(i,n) for(int i=0;i<n;i++ )
#define rep2(i,f,n) for(int i=f;i<n;i++ )
#define MAX(A) *max_element(A.begin(),A.end())
#define MIN(A) *min_element(A.begin(),A.end())
#define SORT(A) sort(A.begin(),A.end())
using namespace std;

typedef long long int ll;
#define MOD 1000000007
#define INF 1000000001

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

bool bfs(vector<vector<int>> g, vector<int> &dist, int sv)
{
	queue<int> q;
	q.push(sv);
	dist[sv]=0;
	while(!q.empty()){
		int now = q.front(); q.pop();
		for(auto v : g[now]){
			if(dist[v]!=-1) continue;
			dist[v] = dist[now]+1;
			q.push(v);
		}
	}
}

int main(void) {
	int n; cin >> n;
	vector<double> p(n); rep(i,n) cin >> p[i];
	//dp[i][j] : 上から(i+1)枚使ってj枚表になる確率
	vector<vector<double>> dp(n,vector<double>(n+1,0));
	dp[0][0] = 1-p[0]; dp[0][1] = p[0];
	rep2(i,1,n)rep(j,i+2){
		dp[i][j] = dp[i-1][j]*(1-p[i]);
		if(j>0) dp[i][j] += dp[i-1][j-1]*p[i];
	}
	double ans = 0;
	rep2(j,n/2+1,n+1) ans += dp[n-1][j];
	out16(ans);
}




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

int main() {
    string s;
    cin >> s;
    int a = atoi(s.substr(0, 2).c_str());
    int b = atoi(s.substr(2, 2).c_str());

    if (1 <= a && a <= 12) {
        // 月の可能性あり
        if (1 <= b && b <= 12) {
            puts("AMBIGUOUS");
        } else {
            puts("MMYY");
        }
    } else {
        if (1 <= b && b <= 12) {
            puts("YYMM");
        } else {
            puts("NA");
        }
    }

}

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

#define TRACE(x) x
#define WATCH(x) TRACE(cout << #x" = " << x << endl)
#define WATCHR(a, b) TRACE(for (auto it=a; it!=b;) cout << *(it++) << " "; cout << endl)
#define WATCHC(V) TRACE({cout << #V" = "; WATCHR(V.begin(), V.end());})

#define all(x) (x).begin(), (x).end()

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vs = vector<string>;

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

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

    string S;
    cin >> S;

    int year = atoi(S.substr(0, 4).c_str());
    int month = atoi(S.substr(5, 2).c_str());
    int day = atoi(S.substr(8).c_str());

    if (year < 2019 || (year == 2019 && month <= 4)) {
        cout << "Heisei\n";
    } else {
        cout << "TBD\n";
    }

    return 0;
}



Measured memory_bytes: 256
var lines = [];
var readline = require('readline');

var rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout,
});

rl.on('line', function (x) {
    lines.push(x);
});

rl.on('close', function () {
    var N = Number(lines[0].split(" ")[0]);
    var M = Number(lines[0].split(" ")[1]);

    // 最大公約数をkとする
    // k + k + k + ... + k + (k * m) = M = k * n となれば良い

    var ans = 1;
    for (var k = 1; k * k < M; k++) {

        // Mがkの倍数でない場合，コンテニュー
        if (M % k !== 0) { continue }
        else {
            var n = M / k;
            if (k * N <= M) ans = Math.max(ans, k)
            if (n * N <= M) ans = Math.max(ans, n)
        }
    }
    console.log(ans)
});

Measured memory_bytes: 7628
N, K, C = list(map(int, input().split()))
S = input()

l = [-1] * N
r = [-1] * N

idx = 1
i = 0
C += 1

while i < N:
    if S[i] == 'o':
        l[i] = idx
        idx += 1
        i += C
    else:
        i += 1

idx = 1
i = N-1
while 0 <= i:
    if S[i] == 'o':
        r[i] = idx
        idx += 1
        i -= C
    else:
        i -= 1

if idx-1 <= K:
    for i in range(N):
        if l[i] != -1 and r[i] != -1: print(i+1)

Measured memory_bytes: 24964
#include <iostream>
#include <vector>
using namespace std;
struct Node
{
	Node(int k) : depth(0), parentId(-1) { vChildId.resize(k, -1); }
	int depth;
	int parentId;
	vector<int> vChildId;
};

void SetNodeDepthRecursive(Node* n, vector<Node*>& vNode)
{
	int s = n->vChildId.size();
	if (0 == s) return;
	for (int i = 0; i < s; ++i){
		Node* cn = vNode[n->vChildId[i]];
		cn->depth = n->depth + 1;
		SetNodeDepthRecursive(cn, vNode);
	}
}

int main()
{
	int nu, id, k, c;
	cin >> nu;
	vector<Node*> vNode(nu, (Node*)0);
	while (nu--){
		cin >> id >> k;
		vNode[id] = new Node(k);
		for (int j = 0; j < k; ++j){
			cin >> c;
			vNode[id]->vChildId[j] = c;
		}
	}
	for (int i = 0; i < vNode.size(); ++i){
		Node* n = vNode[i];
		for (int j = 0; j < n->vChildId.size(); ++j){
			Node* cn = vNode[n->vChildId[j]];
			cn->parentId = i;
		}
	}
	vector<Node*> vRoot;
	for (int i = 0; i < vNode.size(); ++i){
		if (vNode[i]->parentId == -1)
			vRoot.push_back(vNode[i]);
	}
	for (int i = 0; i < vRoot.size(); ++i)
		SetNodeDepthRecursive(vRoot[i], vNode);

	Node* n;
	for (int i = 0; i < vNode.size(); ++i){
		n = vNode[i];
		cout << "node " << i << ": parent = " << n->parentId << ", depth = " << n->depth << ", ";
		if (n->parentId == -1){
			cout << "root, [";
			if (n->vChildId.size() == 0)
				cout << "]\n";
		}
		else if (n->vChildId.size() == 0) cout << "leaf, []\n";
		else cout << "internal node, [";
		if (n->vChildId.size() != 0){
			int cs = n->vChildId.size();
			for (int j = 0; j < cs; ++j){
				cout << n->vChildId[j];
				if (j < cs - 1)
					cout << ", ";
			}
			cout << "]\n";
		}
	}

	return 0;
}

Measured memory_bytes: 7076
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using namespace std;
typedef long long ll;
const int INF = (1<<30);
const int MOD = 1000000007;
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; }

int main() {
    int N,M;
    scanf("%d%d", &N, &M);
    int A[N];
    rep(i, N) scanf("%d", A+i);
    map<int, int> m;
    int SUM[N+1];
    SUM[0]=0;
    rep(i, N){
        SUM[i+1] = (SUM[i] + A[i])%M;
    }
    ll ans = 0;
    rep(i, N+1){
        ans += m[SUM[i]];
        m[SUM[i]]++;
    }
    printf("%lld\n", ans);
    return 0;
}

Measured memory_bytes: 3968
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define MAX_N 200010
long long inv[MAX_N];
long long factorial[MAX_N];
long long inv_factorial[MAX_N];

void GetInv(){
    for (int i = 1; i < MAX_N; i++) {
        if (i == 1) inv[i] = 1;
        else {
            inv[i] = (mod - (mod / i) * inv[mod % i]) % mod;
            if (inv[i] < 0) inv[i] += mod;
        }
    }
}
void GetFactorial(){
    factorial[0] = 1; inv_factorial[0] = 1;
    for (int i = 1; i < MAX_N; i++) {
        factorial[i] = factorial[i-1] * i;
        factorial[i] %= mod;
        inv_factorial[i] = inv_factorial[i-1] * inv[i];
        inv_factorial[i] %= mod;
    }
}

long long dp[210][100010];

int main() {
    GetInv(); GetFactorial();
    int n, x; cin >> n >> x;
    dp[0][x] = 1;
    vector<int> s(n);
    for (int i = 0; i < n; i++) cin >> s[i];
    sort(s.rbegin(), s.rend());
    for (int i = 0; i < n; i++) {
        for (int j = 0; j <= x; j++) {
            // dp[i][j]
            long long u = dp[i][j] * inv[n-i] % mod;
            dp[i+1][j%s[i]] = (dp[i+1][j%s[i]] + u) % mod;
            dp[i+1][j] = (dp[i+1][j] + u * (n-i-1)) % mod;
        }
    }
    long long ans = 0;
    for (int i = 0; i < x; i++) {
        ans = (ans + dp[n][i] * i) % mod;
    }
    cout << ans * factorial[n] % mod << endl;
    return 0;
}

Measured memory_bytes: 162048
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int n = s.nextInt();
		int i = 1;
		int max = 0;

		for (i = 1; i < n + 1; i++) {
			max = max + i;
		}

		System.out.println(max);

	}

}

Measured memory_bytes: 21716
#include <stdio.h>



int main(){

	int a, b, c;

	scanf("%d%d%d", &a, &b, &c);

	int min = a + b;

	

	if(min > b + c) min = b + c;

	if(min > a + c) min = a + c;

	

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

}

Measured memory_bytes: 128
package main

import (
        "fmt"
)

func solution(a, b, k int) []int {

        out := make([]int, 0, 2*k)
        for i := a; i <= b; i++ {
                if i < a+k || b-k < i {
                        out = append(out, i)
                }
        }
        return out
}

func main() {
        var a, b, k int
        fmt.Scan(&a, &b, &k)
        for _, n := range solution(a, b, k) {
                fmt.Println(n)
        }
}

Measured memory_bytes: 512
#coding: utf-8
import math
import heapq
import bisect
import numpy as np
from collections import Counter, deque
#from scipy.misc import comb

N,M = map(int, input().split())

if N <= M//2:
    ans = N + max(M-2*N,0)//4
else:
    ans = M // 2

print(ans)

Measured memory_bytes: 12204
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
 
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
 
template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;
 
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
 
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001; //check the limits, dummy
 
int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);    
	
	int N, K, Q; cin >> N >> K >> Q;
	int counts[N];
	F0R(i, N) counts[i] = 0;
	int req = Q-K;
	
	F0R(i, Q) {
		int X; cin >> X; X--;
		counts[X]++;
	}
	
	F0R(i, N) {
		cout << (counts[i] > req ? "Yes" : "No") << endl;
	}
	
	return 0;
}
 
// read the question correctly (ll vs int)
// template by bqi343


Measured memory_bytes: 1024
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <functional>
#include <algorithm>

using namespace std;

#define rep(i,j) REP((i), 0, (j))
#define REP(i,j,k) for(int i=(j);(i)<(k);++i)
#define BW(a,x,b) ((a)<=(x)&&(x)<=(b))
#define ALL(v) (v).begin(), (v).end()
#define LENGTHOF(x) (sizeof(x) / sizeof(*(x)))
#define AFILL(a, b) fill((int*)a, (int*)(a + LENGTHOF(a)), b)
#define SQ(x) ((x)*(x))
#define Mod(x, mod) (((x)+(mod)%(mod))
#define MP make_pair
#define PB push_back
#define Fi first
#define Se second
#define INF (1<<29)
#define EPS 1e-10
#define MOD 1000000007

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

string s,t;
int k;

map<string,int>m;

int main(){
  while(cin >> k, k){
    cin >>s >> t;

    m.clear();
    queue<string>q;
    m[s] = 0;
    q.push(s);

    while(!q.empty()){
      string cur = q.front(); q.pop();
      int cnt = m[cur];
      //      cout << cur << endl;
      if(cur == t){
	printf("%d\n", cnt);
	break;
      }
      
      int p = 0;
      while(cur[p]- t[p] == 0 ) p++;
      int diff = (t[p]-'0') - (cur[p]-'0');
      for(;p<k;p++){
	int tmp = (int)(cur[p]-'0'+diff+10)%10;
	cur[p] = tmp+'0';
	if(m.find(cur) == m.end()){
	  q.push(cur);
	  m[cur] = cnt+1;
	}
      }
    }
  }
  return 0;
}

Measured memory_bytes: 2652
#include <iostream>
#include <math.h>
#include <algorithm>
#include <functional> 
#include <string>
#include <vector>

#include <cstring>
#include <set>
#include <map>
#include <queue>
#include <utility>

using namespace std;

typedef long long LL;

#define dump(c) { for (auto it = c.begin(); it != c.end(); ++it) if (it == c.begin()) cout << *it; else cout << ' ' << *it; cout << endl; } 

const int MOD = 1000000007;

int main()
{
    string S;

    cin >> S;

    bool ok = true;
    bool right = true;
    for (int i = 0; ok && i < S.length(); ++i, right = !right) {
        char c = S[i];
        if ((right && c == 'L') || (!right && c == 'R')) {
            ok = false;
        } 
    }

    cout << (ok ? "Yes" : "No") << endl;

    return 0;
}


Measured memory_bytes: 256
//#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <climits>
#include <iomanip>

using namespace std;

#define FAST       			ios_base :: sync_with_stdio(false); cin.tie(NULL); 
#define endl "\n"

typedef long long int  ll;
typedef unsigned long long int ull;


int main()
{
	FAST;
	string str,ans="";
	cin >> str;
	for(int i=0 ; i<str.size() ; i++)
	{
		if(str[i] == '0')
			ans += "0";
		else if(str[i] == '1')
			ans += "1";
		else
		{
			if(ans.size() != 0)
		    	ans.pop_back();
		}
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 256
K = int(input())
a, b = map(int, input().split())

c = 1
result = False

while not result:
  if a <= c*K and c*K <= b:
    result = True
  elif c*K > b:
    break
  c += 1

if result == True:
  print('OK')
else:
  print('NG')

Measured memory_bytes: 9080
/*
	Atcoder Beginner 168 A
	Author : Hardik Bagada
*/
#include<bits/stdc++.h>
using namespace std;

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


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

using ll = long long;

template<typename T>
T gcd(T a, T b)
{
	if (a < b)	return gcd(b, a);
	T r;
	while ((r = a % b))
	{
		a = b;
		b = r;
	}
	return b;
}

template<typename T>
T lcm(T a, T b)
{
	return a * b / gcd(a, b);
}

template<typename T>
T ext_gcd(T a, T b, T& x, T& y)
{
	x = 1;
	y = 0;
	T x0 = 0, y0 = 1;
	while (b != 0)
	{
		T q = a / b;
		a -= q * b;
		swap(a, b);
		x -= q * x0;
		swap(x, x0);
		y -= q * y0;
		swap(y, y0);
	}
	return a;
}

template<typename T>
T inv_mod(T a, T mod)
{
	T t1, t2;
	ext_gcd(a, mod, t1, t2);
	t1 %= mod;
	if (t1 < 0)		t1 += mod;
	return t1;
}

template<typename T>
T combination_large(T n, T k, T mod)
{
	if (n < k || n < 0 || k < 0)	return 0;
	vector<T> inv(n + 1, 1), fact(n + 1, 1), fact_inv(n + 1, 1);
	for (T i = 2; i <= n; ++i)
	{
		inv[i] = mod - inv[mod % i] * (mod / i) % mod;
		fact[i] = (fact[i - 1] * i) % mod;
		fact_inv[i] = fact_inv[i - 1] * inv[i] % mod;
	}
	return fact[n] * (fact_inv[k] * fact_inv[n - k] % mod) % mod;
}

template<typename T>
T combination(T n, T k, T mod = 1)
{
	vector<vector<T>> table(n + 1, vector<T>(k + 1, 1));
	for (T i = 1; i <= n; ++i)
	{
		table[i][0] = 1;
		for (T j = 1; j <= n; ++j)
		{
			table[i][j] = (table[i - 1][j - 1] + table[i - 1][j]) % mod;
		}
	}
}

int main(int, char**)
{
	long long N;
	scanf("%lld",&N);
	long long K;
	scanf("%lld",&K);
	long long R;
	scanf("%lld",&R);
	long long S;
	scanf("%lld",&S);
	long long P;
	scanf("%lld",&P);
	std::string T;
	std::cin >> T;

	vector<ll> dp(N, 0);
	vector<bool> won(N, false);
	switch (T[0])
	{
		case 'r':
			dp[0] = P;
			break;
		case 's':
			dp[0] = R;
			break;
		case 'p':
			dp[0] = S;
			break;
	}
	won[0] = true;
	for (ll i = 1; i < K; ++i)
	{
		switch (T[i])
		{
			case 'r':
				dp[i] = dp[i - 1] + P;
				break;
			case 's':
				dp[i] = dp[i - 1] + R;
				break;
			case 'p':
				dp[i] = dp[i - 1] + S;
				break;
		}
		won[i] = true;
	}
	for (ll i = K; i < N; ++i)
	{
		if (T[i - K] == T[i] && won[i - K])
		{
			dp[i] = dp[i - 1];
			won[i] = false;
		}
		else
		{
			switch (T[i])
			{
				case 'r':
					dp[i] = dp[i - 1] + P;
					break;
				case 's':
					dp[i] = dp[i - 1] + R;
					break;
				case 'p':
					dp[i] = dp[i - 1] + S;
					break;
			}
			won[i] = true;
		}
	}
	cout << dp[N - 1] << endl;

	return 0;
}


Measured memory_bytes: 1280
#include "bits/stdc++.h"
#define DEBUG(x) cout<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cout<<#v<<":";for(int i=0;i<v.size();i++) cout<<" "<<v[i]; cout<<endl
using namespace std;
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define MOD 1000000007
#define mod 1000000009
#define pi 3.14159265358979323846
#define Sp(p) cout<<setprecision(15)<< fixed<<p<<endl;
#define pb push_back
template<class T> void print(const T& x){cout << x << endl;}
int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };
typedef long long ll;
const int inf = 1000000001;
const ll INF = 1e18 * 4;

int main(){
    int a, p;
    cin >> a >> p;
    int ans = (3 * a + p) / 2;
    cout << ans << endl;
    return 0;
}




Measured memory_bytes: 3588
#include <iostream>
#include <algorithm>

using namespace std;

int main()
{
	int n,c,k;
	int cnt=0;
	int ans=0;
	int t_begin=0;
	int n_begin=0;
	int t[100000];
	cin>>n>>c>>k;
	for(int i=0;i<n;i++)
	{
		cin>>t[i];
	}
	sort(t,t+n);
	for(int i=0;i<n;i++)
	{
		t_begin=t[i];
		n_begin=i;
		while(i<n && t[i]-t_begin<=k && i-n_begin+1!=c)
		{
			i++;
		}
		if(i<n && t[i]-t_begin>k)
		{
			cerr<<"doe"<<endl;
			cnt = i-n_begin;
			i--;
		}else if(i-n_begin+1==c){
			cnt = i-n_begin+1;
		}else{
			cnt = i-n_begin;
		}
		cerr<<i<<cnt<<endl;
		ans += cnt/c;
		if(cnt % c !=0)
		{
			cerr<<"done"<<endl;
			ans++;
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 640
import math
K = int(input())
A = list(map(int,input().split()))
if A[K-1]!=2:
    print(-1)
elif K==1:
    print(2,3)
else:
    nmin = 2
    nmax = 2+A[K-1]-1
    flag = 0
    for i in range(K-2,-1,-1):
        b = A[i]
        nmin = math.ceil(nmin/b)*b
        nmax = math.floor(nmax/b)*b
        if nmin>nmax:
            flag = 1
            break
        nmax += b-1
    if flag==1:
        print(-1)
    else:
        print(nmin,nmax)

Measured memory_bytes: 84464
//#if 1
//#include"pch.h"
//#define _CRT_SECURE_NO_WARNINGS
//#endif
#include<stdio.h>
#include<stdlib.h>
#include<cmath>
#include<math.h>
#include<string>
#include<string.h>
#include<algorithm>
#include<iostream>
using namespace std;
int main() {
	
	int A, B, C, X;
	int ans = 0;
	cin >> A >> B >> C >> X;
	for (int i = 0; i <= A; i++) {
		for (int j = 0; j <= B; j++) {
			for (int k = 0; k <= C; k++) {
				if (500 * i + 100 * j + 50 * k == X)ans++;
			}
		}
	}
	cout << ans << endl;

	return(0);
}

Measured memory_bytes: 256
#pragma GCC optimize (3)
#include<vector>
#include<stack>
#include<bitset>
#include<cstdlib>
#include<cmath>
#include<set>
#include<list>
#include<deque>
#include<map>
#include<queue>
#include<iostream>
#include<cstdio>
#include<cstring>
#include<iomanip>
#include<algorithm>
#include<unordered_map>
/*#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/hash_policy.hpp>
#include<ext/pb_ds/trie_policy.hpp>
#include<ext/pb_ds/priority_queue.hpp>*/
//#include<ext/rope>
#define ll long long
#define ull unsigned long long
#define INFI 2147483647
#define INFL 9223372036854775807
#define INFU 18446744073709551615
using namespace std;
//using namespace __gnu_pbds;
//using namespace __gnu_cxx;
const double PI=acos(-1.0);
const double eps=1e-6;
inline int read()
{
    int x=0,f=1;
    char ch=getchar();
    while(ch<'0' || ch>'9'){
        if(ch=='-') f=-1;
        ch=getchar();
    }
    while(ch>='0' && ch<='9'){
        x=x*10+ch-'0';
        ch=getchar();
    }
    return x*f;
}
signed main()
{
    //ios_base::sync_with_stdio(false);
    //cin.tie(0);
    //cout.tie(0);
    ll s;
    cin>>s;
    if(s==1e18) cout<<0<<" "<<0<<" "<<1000000000<<" "<<0<<" "<<0<<" "<<1000000000<<endl;
    else if(s<=1e9) cout<<0<<" "<<0<<" "<<s<<" "<<0<<" "<<0<<" "<<1<<endl;
    else{
    cout<<0<<" "<<0<<" ";
    ll a1=s/1e9+1;
    ll a2=1e9;
    ll aa=a1*a2-s;
    cout<<a1<<" "<<1<<" "<<aa<<" "<<a2<<endl;
    }
    return 0;
}


Measured memory_bytes: 3576
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(k,i,n) fpr(ll i=k;i<n;++i)
int main(void){
    ll r;
    cin>>r;
    cout<<fixed<<setprecision(10)<<2*3.141592*r<<endl;
}


Measured memory_bytes: 3780
import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
import numpy as np
from collections import Counter,defaultdict
def main():
    n, *a = map(int, read().split())
    aa = Counter(a)
    d1 = defaultdict(int)
    d2 = defaultdict(int)
    for k, v in aa.items():
        d1[k] = v * (v - 1) // 2
        v -= 1
        d2[k] = v * (v - 1) // 2
    sumd1 = sum(d1.values())
    for ae in a:
        r = sumd1 - d1[ae] + d2[ae]
        print(r)

if __name__ == '__main__':
    main()

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

int main(){
	int n, in;
	cin >> n;
	vector<int> vin(n);
	rep(i, n){
		cin >> in;
		vin.at(i) = in;
	}
	
	for(int i = n-1; i > 0; i--){
		if(i != n-1 && vin.at(i) > vin.at(i+1)){
			vin.at(i)--;
			if(vin.at(i) > vin.at(i+1)){
				cout << "No" << endl;
				return 0;
			}
		}
	}
	
	cout << "Yes" << endl;
	
	return 0;
}

Measured memory_bytes: 640
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size)
#define MOD 1000000007
const long long mod = 1e9+7;
typedef vector<long long> Vl;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<Vl> VVl;
typedef pair<int, int> PII;
typedef long long ll;

int main(){
    int a,b,c;
    string s;
    cin >> a >> b;
    cout << b*2-a << endl;
    return 0;
} 

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

typedef long long int ll;
typedef pair<ll,ll> P;

vector<ll> v;

void add(ll k,int bef,int n){
    k=k*10+bef;
    if(!n){
        v.push_back(k);
        return ;
    }
    
    if(bef>=1){
        add(k,bef-1,n-1);
    }
    add(k,bef,n-1);
    if(bef<=8){
        add(k,bef+1,n-1);
    }
    return ;
}

int main(){
    int n=1;
    int i=1;
    int k=0;
    cin>>k;
    while(v.size()<k){
        if(i==10){
            i=1;
            n++;
        }
        add(0,i,n-1);
        i++;
    }
    sort(v.begin(),v.end());
    cout<<v[k-1];


    return 0;
}

Measured memory_bytes: 1400
#include<bits/stdc++.h>
#define int long long
#define fi first
#define se second
#define pii pair<int,int>
#define mp make_pair
#define tp tuple<int,int,int>
#define mtp make_tuple
using namespace std;


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

main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int t;
    t=1;
    while(t--) solve();
}


Measured memory_bytes: 3616
/**
 *   author:  cryforthemoon46
 *   created: 26.05.2020 20:56:51
**/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;

#define REP(i, n) for(size_t i = 0; i < (n); i++)
#define FOR(i, a, b) for(size_t i = a; i < (b); i++)
#define FOREACH(x, a) for(auto&& x : (a))

string S; 

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cin >> S;
    char o[3];
    for(int bit = 0; bit < (1 << 3); bit++){
        int res = S[0] - '0';
        for (int i = 0; i < 3; i++) {
            if (bit & (1 << i)) {
                res += S[i + 1] - '0';
                o[i] = '+';
            } else {
                res -= S[i + 1] - '0';
                o[i] = '-';
            }
        }
        if (res == 7) break;
    }
    cout << S[0] << o[0] << S[1] << o[1] << S[2] << o[2] << S[3]<< "=7" << endl;
}

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


int main() {
  int k;
  while (cin >> k, k) {
    int ans = 0;
    for (int i = 0; i < k * (k - 1) / 2; i++) {
      int t;
      cin >> t;
      ans += t;
    }
    cout << ans / (k - 1) << endl;
  }
  
  return 0;
}

Measured memory_bytes: 3068
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;

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

    long N;
    cin >> N;

    long max;
    for (long i = 1; i <= sqrt(N); i++) {
        if (N % i == 0) {
            max = i;
        }
    }

    cout << max + (N / max) - 2 << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

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

    string s, t;
    cin >> s >> t;

    int n = s.size();
    int m = t.size();

    for (int i = 0; i < n; i++) {
        s[i] -= 'a';
    }
    for (int i = 0; i < m; i++) {
        t[i] -= 'a';
    }

    vector<vector<int>> a(26, vector<int>());
    for (int i = 0; i < n; i++) {
        a[s[i]].push_back(i);
    }
    for (int j = 0; j < 26; j++) {
        if (!a[j].empty()) a[j].push_back(a[j][0] + n);
    }

    ll r = 0;
    int h = 0;
    for (int i = 0; i < m; i++) {
        int j = t[i];
        auto it = lower_bound(a[j].begin(), a[j].end(), h);
        if (it == a[j].end()) {
            r = -1;
            break;
        }
        int x = *it + 1;
        r += x - h;
        h = x;
        if (h >= n) h -= n;
    }

    cout << r << endl;

    return 0;
}

Measured memory_bytes: 1228
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int n;
ll a, b, c, d;
int main()
{
	scanf("%d", &n);
	for(int i = 1; i <= n; ++i)
	{
		ll a, b;
		cin >> a >> b;
		if(i == 1)
		{
			c = a;
			d = b;
		}
		else
		{
			ll x = max((d + b - 1) / b, (a + c - 1) / a);
			c = x * a;
			d = x * b;
		}
	}
	cout << c + d << endl;
	return 0;
}

Measured memory_bytes: 3728
while True:
    h, w = map(int, input().split())
    if h == 0 and w == 0:
        break
    else:
        for hline in range(h):
            for wline in range(w):
                if (hline + wline) % 2 == 0:
                    print('#', end='')
                else:
                    print('.', end='')
            print('')
        print('')


Measured memory_bytes: 7012
using System;
using System.Linq;

namespace aaaaa
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            string N = Console.ReadLine();
            int n=int.Parse(N);
            string A = Console.ReadLine();
            string[] f = A.Split();
            int[] a = new int[n];
            for(int i = 0; i < n; i++)
            {
                a[i] = int.Parse(f[i]);
            }
            Array.Sort(a);
            int aa = n;
            for(int i = 0; i < n - 1; i++)
            {
                if (a[i] == a[i + 1]) { aa -= 1; }
            }
            Console.WriteLine(aa);
        }
    }
}



Measured memory_bytes: 23460
#include<bits/stdc++.h>
using namespace std;
int n,m,l,r,d,fl,fr,bo=1,fa[100010],dis[100010];
int find(int x)
{
    if(fa[x]!=x)
	{
        int t=fa[x];
        fa[x]=find(fa[x]);
        dis[x]+=dis[t];
    }
    return fa[x];
}
int main()
{
    cin>>n>>m;
    for(int i=1;i<=n;i++)
    {
        fa[i]=i;
    }
    for(int i=1;i<=m;i++)
	{
        scanf("%d%d%d",&l,&r,&d);
        fl=find(l);
		fr=find(r);
        if(fl==fr&&dis[l]-dis[r]!=d)
        {
			bo=0;
		}
        if(fl!=fr)
		{
            fa[fl]=fr;
            dis[fl]=d+dis[r]-dis[l];
        }
    }
    if(bo)
	{
		cout<<"Yes";
	}
    else 
    {
		cout<<"No"; 
	}
    return 0;
} 

Measured memory_bytes: 4496
#include <bits/stdc++.h>
using namespace std;
#define ll long long
static bool primes[55555+1];
const int goro = 55556;

void sieve() {
  for(int i=0; i<goro; i++) {
    primes[i] = true;
  }
  for(int i=2; i<goro; i++) {
    if(primes[i]) {
      for(int j=2; j*i<goro; j++) primes[j*i]=false;
    }
  }
}

int main() {
  sieve();
  vector<int> ps;
  for(int i=2; i<goro; i++) {
    if(primes[i]&&i%5==1) ps.push_back(i);
  }
  int n;
  cin >> n;
  for(int i=0; i<n; i++) {
    if(i==0) cout << ps[i];
    else cout << " " << ps[i];
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define mod 1000000007ll
#define mod1 998244353ll
#define endl '\n'
#define inf ((ll)1e18+1)
#include<chrono>
using namespace chrono;
mt19937_64 rng(high_resolution_clock::now().time_since_epoch().count());
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<ll,null_type,less_equal<ll>,rb_tree_tag,tree_order_statistics_node_update>
#define debr(x,y) {cout<<"-->  "<<#x<<" to "<<#y<<" :  "; auto itr=x; while(itr!=y) cout<<(*itr++)<<' '; cout<<endl; }
#define deba(x) {cout<<"-->  "<<#x<<" :  "; for(auto ele:(x)) cout<<ele<<"  "; cout<<endl; }
#define deb(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s);istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {cout<<endl;}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a <<"  ,  ";
    err(++it, args...);
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    ll t=1;
    // cin>>t;
    while(t--){
        ll a;
        cin>>a;
        cout<<a+a*a+a*a*a<<endl;
    }
    return 0;

}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
int main(){
	int H, N;
	cin >> H >> N;
	vector<int> A(N);
	int sum = 0;
	for(int i = 0; i < N; i++){
		cin >> A.at(i);
		sum += A.at(i);
	}
	cout << ((sum >= H)?"Yes":"No") << endl;

	return 0;
}

Measured memory_bytes: 640
l = input().split()
a_hp = int(l[0])
a_at = int(l[1])
b_hp = int(l[2])
b_at = int(l[3])
a_s = a_hp // b_at
a_a = a_hp % b_at
b_s = b_hp // a_at
b_a = b_hp % a_at

if a_a > 0:
  a_s += 1
if b_a > 0:
  b_s += 1
if a_s >= b_s:
  print('Yes')
else:
  print('No')

Measured memory_bytes: 9136
#include<stdio.h>
#include<math.h>
#include<stdlib.h>
 
int main(void){
 
	long long int n,p;
	long long int cur[60000] = {};
	int count[60000] = {};
	int check[60000] = {};
	int end_flag = 0;
	int index = 0;
	int i,j;
 
	long long int result;
 
	scanf("%lld %lld",&n,&p);

 	if(n == 1){
		result = p;
	}else{


 
	//素因数分解を順番にしていって、
	//N個以上ある素因数の積を返す。
 
	//2の素因数分解
	cur[index] = 2;
	while(p % cur[index] == 0 && p > 1){
		count[index]++;
		p /= cur[index];
	}
	//N個以上あったらフラグを立てる
	if(count[index] >= n){		check[index] = count[index]/n;	}
 
 
	//次の因数セット
	index++;
	cur[index] = 3;
 
	while(p > 1 && p >= cur[index] * cur[index]){
		//cur[index]の素因数分解
		while(p % cur[index] == 0 && p > 1){
			count[index]++;
			p /= cur[index];
//			printf("p=%lld(%lld)\n",p,cur[index]);
		}
		//N個以上あったらフラグを立てる
		if(count[index] >= n){		check[index] = count[index]/n;	}
 
		index++;
		cur[index] = cur[index-1] + 2;
		do{
			end_flag = 1;
			for(i=0;i<index;i++){
				if(cur[index] % cur[i] == 0){
					end_flag = 0;
					cur[index] += 2;
					break;
				}
			}
		}while(end_flag == 0);
	}
 
		result = 1;
		for(i=0;i<index;i++){
//				printf("%d: cur=%lld, count=%d, check=%d\n",i,cur[i],count[i],check[i]);
			result *= int(pow(double(cur[i]),check[i]));
		//		if(check[i] > 0){
		//			for(j = 0 ;j<check[i];j++){
		//				result *= pow(cur[i]);
		//			}
		//			printf("%d: cur=%ld, count=%ld, check=%d\n",i,cur[i],count[i],check[i]);
		//		}
		}
	}
	printf("%lld\n",result);
	return 0;
 
}

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

int main()
{
    int r,d,x;
    scanf("%d%d%d",&r,&d,&x);
    for(int i=1;i<=10;i++)
    {
        x=r*x-d;
        printf("%d\n",x);
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
template<typename T = int> vector<T> create(size_t n){ return vector<T>(n); }
template<typename T, typename... Args> auto create(size_t n, Args... args){ return vector<decltype(create<T>(args...))>(n, create<T>(args...)); }
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int a, b, c;
	cin >> a >> b >> c;
	swap(a, b);
	swap(a, c);
	cout << a << ' ' << b << ' ' << c << '\n';
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
int N,K,ans;
cin>>N>>K;

N=N-K;
if(N==0){
  ans=1;
}else if(N%(K-1)==0){
  ans=N/(K-1)+1;
}else{
  ans=(N-(N%(K-1)))/(K-1)+2;
}

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


Measured memory_bytes: 256
#include<stdio.h>
int main(void){
long double a, b, c, d;
scanf("%Lf%Lf%Lf",&a, &b, &c);
d=c-a-b;
if(d>0 && d*d > 4*a*b) printf("Yes\n");
else printf("No\n");
return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <array>
#include <set>
#include <map>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cstdint>
#include <cassert>
#include <random>

using namespace std;
using i64 = int64_t;
using i32 = int32_t;
template<class T, class U> void init_n(vector<T>& v, size_t n, U x) 
{ v = vector<T>(n, x); }
template<class T> void init_n(vector<T>& v, size_t n) { init_n(v, n, T()); }
template<class T> void read_n(vector<T>& v, size_t n, size_t o = 0) 
{ v = vector<T>(n+o); for (size_t i=o; i<n+o; ++i) cin >> v[i]; }
template<class T> void read_n(T a[], size_t n, size_t o = 0)
{ for (size_t i=o; i<n+o; ++i) cin >> a[i]; }
template<class T> T gabs(const T& x) { return max(x, -x); }
#define abs gabs

int main() {
  int a, b;
  cin >> a >> b;
  if (a <= 9 && b <= 9) {
    cout << a * b << endl;
  } else {
    cout << -1 << endl;
  }
  return 0;
}


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

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

vector<vector<Edge>> graph;
vector<bool> leaf;
vector<int> ret;
vector<int> noret;

void dp(int v, int parent) {
    for (Edge& e : graph[v]) {
        int w = e.dst;
        if (w != parent)
            dp(w, v);
    }

    int sum = 0;
    for (Edge& e : graph[v]) {
        int w = e.dst;
        if (w != parent)
            sum += leaf[w] ? e.cost : 3*e.cost + ret[w];
    }
    ret[v] = sum;

    int min_cost = INT_MAX;
    for (Edge& e : graph[v]) {
        int w = e.dst;
        if (w != parent) {
            int cost_new = leaf[w] ? e.cost : 2*e.cost + noret[w];
            int cost_old = leaf[w] ? e.cost : 3*e.cost + ret[w];
            min_cost = min(min_cost, sum - cost_old + cost_new);
        }
    }
    leaf[v] = min_cost == INT_MAX;
    noret[v] = leaf[v] ? 0 : min_cost;
}

int main() {
    ios::sync_with_stdio(false);

    int n;
    while (cin >> n, n) {
        vector<int> p(n-1);
        for (int i = 0; i < n-1; ++i)
            cin >> p[i];
        vector<int> d(n-1);
        for (int i = 0; i < n-1; ++i)
            cin >> d[i];

        graph.assign(n, vector<Edge>());
        for (int i = 0; i < n-1; ++i) {
            int src = i + 1;
            int dst = p[i] - 1;
            int cost = d[i];
            graph[src].emplace_back(src, dst, cost);
            graph[dst].emplace_back(dst, src, cost);
        }

        int ans = INT_MAX;
        for (int start = 0; start < n; ++start) {
            leaf.assign(n, false);
            ret.assign(n, 0);
            noret.assign(n, 0);
            dp(start, start);
            ans = min(ans, noret[start]);
        }

        cout << ans << endl;
    }
}

Measured memory_bytes: 1420