akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define int long long
//vector <int> a;
//set <int> st;
//map <int, int> mp;
//priority_queue <int> pq_l; //largest  
//priority_queue <int, vector<int>, greater<int>> pq_s; //s
void init();
int a[100005];
int dp[100005];
signed main() 
{ 
	//freopen("out.txt", "w", stdout);
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	init();
	int q;
	cin >> q;
	cin >> a[0] >> a[1];
	dp[0] = 0; dp[1] = abs(a[0]-a[1]);
	
	for (int i = 2; i < q; i++){
		int tmp;
		cin >> tmp;
		a[i] = tmp;
		dp[i]=min(dp[i-1]+abs(tmp-a[i-1]), dp[i-2]+abs(tmp-a[i-2]));
	} 
	cout << dp[q-1];
} 

void init()
{

}
 

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

#define mp make_pair
#define pb push_back


typedef long long ll;
typedef long long llong;
typedef long double ld;
typedef unsigned long long ull;

using namespace std;

template <typename T> void dprint(T begin, T end) {
    for (auto i = begin; i != end; i++) {
        cerr << (*i) << " ";
    }
    cerr << "\n";
}
const int MAXN = 210000;

pair<int, int> rmq0[MAXN * 4];
pair<int, int> rmq1[MAXN * 4];
int pl[MAXN];
int p[MAXN];
vector<pair<int, int> > vv;
int n;
set<pair<pair<int, int>, pair<int, int> > > ss;

void build(int v, int tl, int tr) {
    if (tl + 1 == tr) {
        rmq1[v] = rmq0[v] = make_pair(MAXN, tl);
        if (tl % 2 == 0)
            rmq0[v] = make_pair(p[tl], tl);
        else
            rmq1[v] = make_pair(p[tl], tl);
        return;
    }
    int m = (tl + tr) >> 1;
    build(v * 2 + 1, tl, m);
    build(v * 2 + 2, m, tr);
    rmq0[v] = min(rmq0[v * 2 + 1], rmq0[v * 2 + 2]);
    rmq1[v] = min(rmq1[v * 2 + 1], rmq1[v * 2 + 2]);
}

pair<int, int> get0(int v, int tl, int tr, int l, int r) {
    if (r <= tl || tr <= l)
        return make_pair(MAXN, 0);
    if (l <= tl && tr <= r)
        return rmq0[v];
    int m = (tl + tr) >> 1;
    return min(get0(v * 2 + 1, tl, m, l, r), get0(v * 2 + 2, m, tr, l, r));
}
pair<int, int> get1(int v, int tl, int tr, int l, int r) {
    if (r <= tl || tr <= l)
        return make_pair(MAXN, 0);
    if (l <= tl && tr <= r)
        return rmq1[v];
    int m = (tl + tr) >> 1;
    return min(get1(v * 2 + 1, tl, m, l, r), get1(v * 2 + 2, m, tr, l, r));
}

pair<int, int> get_(int l, int r) {
    if (l % 2 == 0) {
        int x = get0(0, 0, n, l, r).second;
        return make_pair(x, get1(0, 0, n, x + 1, r).second);
    }
    else {
        int x = get1(0, 0, n, l, r).second;
        return make_pair(x, get0(0, 0, n, x + 1, r).second);
    }
}

pair<int, int> get(int l, int r) {
    pair<int, int> a = get_(l, r);
    return make_pair(p[a.first], p[a.second]);
}

void add(int l, int r) {
    ss.insert(make_pair(get(l, r), make_pair(l, r)));
}

int main() {
    scanf("%d", &n);
    for (int i = 0; i < n; ++i)
        scanf("%d", p + i), --p[i], pl[p[i]] = i;
    build(0, 0, n);
    ss.insert(make_pair(get(0, n), make_pair(0, n)));
    while (!ss.empty()) {
        pair<pair<int, int>, pair<int, int> > a = *ss.begin();
        ss.erase(ss.begin());
        vv.push_back(a.first);
        pair<int, int> x = a.second;
        pair<int, int> y = make_pair(pl[a.first.first], pl[a.first.second]);
        if (x.first < y.first)
            add(x.first, y.first);
        if (y.first + 1 < y.second)
            add(y.first + 1, y.second);
        if (y.second + 1 < x.second)
            add(y.second + 1, x.second);
    }
    for (int i = 0; i < vv.size(); ++i)
        printf("%d %d ", vv[i].first + 1, vv[i].second + 1);
    printf("\n");
    return 0;
}




Measured memory_bytes: 17012
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<vector>
#include<functional>
#include<iomanip>
#include<cmath>
#include<queue>
#include<limits>
#include<cassert>
#include<set>
#include<tuple>
#include<map>
#include<list>

#define PB push_back
#define ALL(a)  (a).begin(),(a).end()
#define DWN(a)  (a).begin(),(a).end(), greater<int>()
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

using namespace std;
typedef long long ll;

ll H, W;

ll solve(ll a, ll b) {
	ll m = min(a, b);
	for (ll i = 1; i < a; i++) {
		ll x = b / 2;
		ll sa = i * b;
		ll sb = (a - i) * x;
		ll sc = (a - i) * (b - x);
		ll mi = min(min(sa, sb), sc);
		ll ma = max(max(sa, sb), sc);
		m = min(m, ma - mi);
	}
	return m;
}

int main() {
	cin >> H >> W;
	if (H % 3 == 0 || W % 3 == 0) {
		cout << 0 << endl;
		return 0;
	}
	cout << min(solve(H, W), solve(W, H)) << endl;
	return 0;
}

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

const double eps = 1e-9;
bool same(double a, double b) { return abs(a - b) < eps; }

struct P {
    double x, y;
    P() : x(0), y(0) {}
    P(double x, double y) : x(x), y(y) {}
    P operator + (P b) { return P(x + b.x, y + b.y); }
    P operator - (P b) { return P(x - b.x, y - b.y); }
    P operator * (double b) { return P(x * b, y * b); }
    P operator / (double b) { return P(x / b, y / b); }
    double operator * (P b) { return x * b.x + y * b.y; }
    double operator ^ (P b) { return x * b.y - y * b.x; }
    double abs() { return hypot(x, y); }
    P unit() { return *this / abs(); }
};

struct L{
    // ax + by + c = 0
    double a, b ,c, o;
    P pa, pb;
    L() : a(0), b(0), c(0), o(0), pa(), pb() {}
    L(P pa, P pb) : a(pa.y - pb.y), b(pb.x - pa.x), c(pa ^ pb), o(atan2(-a, b)), pa(pa), pb(pb) {}
    P project(P p) { return pa + (pb - pa).unit() * ((pb - pa) * (p - pa) / (pb - pa).abs()); }
    P reflect(P p) { return p + (project(p) - p) * 2; }
    double get_ratio(P p) { return (p - pa) * (pb - pa) / ((pb - pa).abs() * (pb - pa).abs()); }
};

bool parallel(L x, L y) { return same(x.a * y.b, x.b * y.a); }

P intersect(L x, L y) { return P(-x.b * y.c + x.c * y.b, x.a * y.c - x.c * y.a) / (-x.a * y.b + x.b * y.a); }

int main() {
    int n; cin >> n;
    vector<P> p(n);
    for (int i = 0; i < n; ++i) cin >> p[i].x >> p[i].y;
    double ans = 0;
    for (int i = 0; i < n; ++i) ans += p[i] ^ p[(i + 1) % n];
    cout << fixed << setprecision(1) << abs(ans) / 2 << endl;
}



Measured memory_bytes: 3288
#include <stdio.h>

int main()
{
    int N, a[1000], i, big, small;
    scanf("%d", &N);
    for (i = 1; i <= N; i++)
    {
        scanf("%d", &a[i]);
    }
    big = a[1];
    small = a[1];
    for (i = 1; i <= N; i++)
    {
        if (big < a[i])
        {
            big = a[i];
        }
        else if (small > a[i])
        {
            small = a[i];
        }
    }
    printf("%d", big - small);
    return 0;
}

Measured memory_bytes: 128
#include <stdio.h>

int main(){
    int x, y;
    while(1){
        scanf("%d %d", &x, &y);
        if(x==0 && y==0)break;
        if(x<y){
            printf("%d %d\n", x, y);
        }else{
            printf("%d %d\n", y, x);
        }
    }
    return 0;
}

Measured memory_bytes: 596
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#define ll long long
#define ull unsigned long long
#define IO(x,y) freopen(x,"r",stdin);freopen(y,"w",stdout)
#define fo(x) while(x-->0)
#define nl '\n'
#define pb push_back

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
	// IO("in.txt", "out.txt");
	int i, n, in, k;
	cin >> n >> k;
	int h[n], c[n];
	for(i=0; i<n; i++){
		cin >> h[i];
	}
	int j, min;
	c[n-1]=0;
	for(i=n-2; i>=0; i--){
		min=c[i+1]+abs(h[i]-h[i+1]);
		for(j=i+2; j<=i+k && j<n; j++){
			if(min>c[j]+abs(h[i]-h[j]))
				min=c[j]+abs(h[i]-h[j]);
		}
		c[i]=min;
	}
	cout << c[0];
}


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

int main(int argc, const char * argv[]) {
    int N, Z, W;
    cin >> N >> Z >> W;
    vector<int> a;
    for (int i = 0; i < N; i++) {
        int inp; cin >> inp;
        a.push_back(inp);
    }

    if(N == 1) {
        cout << abs(a[0] - W) << endl;
    } else {
        cout << max(abs(a[N-1] - W), abs(a[N-2] - a[N-1])) << endl;
    }
    
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int t=1;
    //cin>>t;
    while(t--)
    {
        int n;
      cin>>n;
      vector<int>v(n),v1(3);
      int i,j,k,ans=0;
      for(i=0;i<n;i++) cin>>v[i];
      for(i=0;i<n;i++){
        for(j=i+1;j<n;j++){
            if(v[i]!=v[j]){
                for(k=j+1;k<n;k++){
                    if(v[k]!=v[i]&&v[k]!=v[j]){
                        v1[0]=v[i],v1[1]=v[j],v1[2]=v[k];
                        sort(v1.begin(),v1.end());
                        if(v1[0]+v1[1]>v1[2]) ans++;
                    }
                }
            }
        }
      }
      cout<<ans;
    }
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
/**  I'm Klaus, NicKlaus :v **/
using namespace std;
#define ms(a,v) memset(a,v,sizeof a)
#define ll long long
#define LOG2(X) ((unsigned) (8*sizeof(int) - __builtin_clz((X)) - 1))
ll gcd(ll x, ll y){return (y ? gcd(y, x%y) : x); }
ll lcm(ll x, ll y){return x*(y/gcd(x,y));}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
vector<int> g[100002];
int main(){
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	#ifdef LOCAL_JUDGE
		//freopen("in_out/in.txt", "rt", stdin);
		//freopen("int_out/out.txt", "wt", stdout);
	#endif
	int n, m;
	cin>>n>>m;
	for(int i=0; i<n; i++){
		int a, b;
		cin>>a>>b;
		if(m - a >= 0) g[m-a].push_back(b);
	}
	int ans = 0;
	priority_queue<int> q;
	for(int i=m; i>=0; i--){
		if(g[i].size()){
			for(auto e : g[i]) q.push(e);
		}
		if(!q.empty()){
			ans += q.top();
			q.pop();
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 5632
s = input()
n = len(s)

ans = 'AC'
count = 0

if s[0] != 'A':
    ans = 'WA'

s = 'a' + s[1:]

for i in range(2,n-1):
    if s[i] == 'C':
        count += 1
        s = s[:i] + 'c' + s[i+1:]

if count != 1:
    ans = 'WA'

if not s.islower():
    ans = 'WA'

print(ans)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define endl "\n"
using namespace std;

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

    int n,x,t;
    cin >> n >> x >> t;
    int alpha=n/x;
    if (n%x!=0)
    {
        alpha++;
    }

    cout << alpha*t << endl;

    return 0;
}

Measured memory_bytes: 3636
N = int(input())

lis = [0]

for i in range(N):

    i += 1

    now = lis[ i - 1 ] + 1

    cnt = 1
    while True:

        if i - ( 6 ** cnt )  >= 0:
            now = min(now, lis[i - ( 6 ** cnt )] + 1)
            cnt += 1

        else:
            break

    cnt = 1
    while True:

        if i - ( 9 ** cnt )  >= 0:
            now = min(now, lis[i - ( 9 ** cnt )] + 1)
            cnt += 1

        else:
            break

    #print (i,"は",now)
    lis.append(now)

print (lis[N])

Measured memory_bytes: 3860
#include<iostream>
#include<math.h>
#include<vector>
#include<array>
#include<algorithm>
#include<numeric>
#include<map>
#include<queue>
#include<deque>
#include<set>
#include<cstdio>
#include<cstring>
#include<string>
using namespace std;
typedef long long ll;
typedef vector<int> vec;
typedef vector<vector<int>> mat;

int main(){
    string S;cin>>S;
    ll K;cin>>K;
    int N=S.size();
    int i=0;ll count=0;
    bool b=false;
    while(i<N-1){
        if(S[i]==S[i+1]){
            count++;
            if(i==N-2)b=true;
            i+=2;
        }
        else i++;
    }
    bool same=true;
    for(int i=0;i<N-1;i++){
        if(S[i]!=S[i+1])same=false;
    }
    int N0=1;
    for(int i=1;i<N;i++){
        if(S[i]==S[0])N0++;
        else break;
    }

    if(same && N%2==1){
        cout<<(ll)N*K/2<<endl;
        return 0;
    }
    else{
        if(S[0]!=S[N-1] || b){
            cout<<K*count<<endl;
            return 0;
        }
        else if(N0%2==1){
            cout<<(ll)K*count+(ll)K-(ll)1<<endl;
            return 0;
        }
        else{
            cout<<K*count<<endl;
            return 0;            
        }
    }
}

Measured memory_bytes: 256
from collections import deque
N, M = map(int, input().split())
root = [set() for i in range(N + 1)]
ans = [0 for i in range(N + 1)]
for i in range(M):
    a, b = map(int, input().split())
    root[a].add(b)
    root[b].add(a)
task = deque([1])
itta = {1}
while len(task) > 0:
    now = task.popleft()
    additional = root[now] - itta
    for i in additional:
        ans[i] = now
        itta.add(i)
    task.extend(list(additional))
print("Yes")
for i in range(2, N + 1):
    print(ans[i])

Measured memory_bytes: 68828
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const int N = 200005;
ld arr[N];

int n, m, x;
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n, k;
    cin >> n >> k;
    for (int i = 1; i <= n; i++) {
        cin >> arr[i];
        arr[i] = (1. / arr[i]) * ((arr[i] * (arr[i] + 1)) / 2);
        arr[i] += arr[i - 1];
    }
    ld mx = 0;
    for (int i = 1; i <= n; i++) {
        if (i + k - 1 <= n)
            mx = max(mx, arr[i + k - 1] - arr[i - 1]);
    }
    cout << fixed << setprecision(9) << mx;
    return 0;
}


Measured memory_bytes: 3456
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.*;
import java.util.Locale.FilteringMode;

 
public class Main {
	static final long MOD1=1000000007;
	static final long MOD2=998244353;
	public static void main(String[] args) {
		PrintWriter out = new PrintWriter(System.out);
		InputReader sc=new InputReader(System.in);
		int N=sc.nextInt();
		long ans=0;
		int[] soinsu=new int[N+1];
		for (int i = 1; i <= N; i++) {
			for (int j = i; j <= N; j+=i) {
				soinsu[j]++;
			}
		}
		for (int i = 1; i <= N-1; i++) {
			ans+=soinsu[N-i];
		}
		System.out.println(ans);
	}
		static class InputReader { 
		private InputStream in;
		private byte[] buffer = new byte[1024];
		private int curbuf;
		private int lenbuf;
		public InputReader(InputStream in) {
			this.in = in;
			this.curbuf = this.lenbuf = 0;
		}
 
		public boolean hasNextByte() {
			if (curbuf >= lenbuf) {
				curbuf = 0;
				try {
					lenbuf = in.read(buffer);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (lenbuf <= 0)
					return false;
			}
			return true;
		}
 
		private int readByte() {
			if (hasNextByte())
				return buffer[curbuf++];
			else
				return -1;
		}
 
		private boolean isSpaceChar(int c) {
			return !(c >= 33 && c <= 126);
		}
 
		private void skip() {
			while (hasNextByte() && isSpaceChar(buffer[curbuf]))
				curbuf++;
		}
 
		public boolean hasNext() {
			skip();
			return hasNextByte();
		}
 
		public String next() {
			if (!hasNext())
				throw new NoSuchElementException();
			StringBuilder sb = new StringBuilder();
			int b = readByte();
			while (!isSpaceChar(b)) {
				sb.appendCodePoint(b);
				b = readByte();
			}
			return sb.toString();
		}
 
		public int nextInt() {
			if (!hasNext())
				throw new NoSuchElementException();
			int c = readByte();
			while (isSpaceChar(c))
				c = readByte();
			boolean minus = false;
			if (c == '-') {
				minus = true;
				c = readByte();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res = res * 10 + c - '0';
				c = readByte();
			} while (!isSpaceChar(c));
			return (minus) ? -res : res;
		}
 
		public long nextLong() {
			if (!hasNext())
				throw new NoSuchElementException();
			int c = readByte();
			while (isSpaceChar(c))
				c = readByte();
			boolean minus = false;
			if (c == '-') {
				minus = true;
				c = readByte();
			}
			long res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res = res * 10 + c - '0';
				c = readByte();
			} while (!isSpaceChar(c));
			return (minus) ? -res : res;
		}
 
		public double nextDouble() {
			return Double.parseDouble(next());
		}
 
		public int[] nextIntArray(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		}
 
		public long[] nextLongArray(int n) {
			long[] a = new long[n];
			for (int i = 0; i < n; i++)
				a[i] = nextLong();
			return a;
		}
 
		public char[][] nextCharMap(int n, int m) {
			char[][] map = new char[n][m];
			for (int i = 0; i < n; i++)
				map[i] = next().toCharArray();
			return map;
		}
	}
}


Measured memory_bytes: 36556
<?php
fscanf(STDIN, "%d %d %d %d", $r,$g,$b,$n);
$result = 0;
for($i=0; $i*$r<=$n; $i++)
{ 
	for($j=0; $i*$r+$j*$g<=$n; $j++)
	{
		if(is_int(($n - $i*$r - $j*$g)/$b))
			$result++;
	}
}


echo($result);

Measured memory_bytes: 3828
#include <iostream>
#include <iomanip>
#include <ios> 
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <bitset>
#include <map>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define sz(c) ((int)(c).size())

using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
//const int MAX=;



int main(){
	int N,K;
	cin>>N>>K;
	string S;
	cin>>S;
	
	K--;
	rep(i,N){
		if(i==K){ 
			if(S[i]=='A')cout<<"a";
			if(S[i]=='B')cout<<"b";
			if(S[i]=='C')cout<<"c";
		}
		else cout<<S[i];
		
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cmath>
#include <string>
#include <vector>
#include <cstdlib>
#include <map>
#include <queue>
#include <algorithm>
#include <stack>
#include <functional>
#define rep(i,j,n) for(i=j;i<(n);i++)
#define rrep(i,j,n) for(i=j;i>(n);i--)
typedef long long int lli;
#define N 1000000007

using namespace std;

//lli gcd(lli a,lli b){
//    lli x,y;
//    x=max(a,b);
//    y=min(a,b);
//    if(x%y==0){
//        return y;
//    }
//    else{
//        return gcd(y,x%y);
//    }
//}
//
//lli lcm(lli a,lli b){
//    lli x,y;
//    x=max(a,b);
//    y=min(a,b);
//    return x*y/gcd(x,y);
//}

int main(){
    lli n,b;
    vector<lli> vec,ans;
    lli i,j;
    cin>>n;
    rep(i,0,n){
        cin>>b;
        vec.push_back(b);
    }
    rep(i,0,n){
        rrep(j,vec.size()-1,-1){
            if(vec[j]==j+1){
                ans.push_back(vec[j]);
                vec.erase(vec.begin()+j);
                break;
            }
            else{
                if(0==j){
                    break;
                }
            }
        }
    }
    if(ans.size()==n){
        rrep(i,n-1,-1){
            cout<<ans[i]<<endl;
        }
    }
    else{
        cout<<"-1"<<endl;
    }
}


Measured memory_bytes: 256
//AcFreak

#include<bits/stdc++.h>
#define lint long long int 
#define mp make_pair
#define pb push_back
#define f first
#define __ ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define s second
#define endl '\n'
#define pii pair<int,int >
using namespace std;


int main()
{__
      lint n;
      cin>>n;

      vector<lint >arr(n);

      lint i;
      for(i=0;i<n;i++)cin>>arr[i];

        for(i=0;i<n;i++)
        {
            arr[i]-=(i+1);
        }

        sort(arr.begin(),arr.end());

        lint mid=0,midmax=0,midmin=0;
        int index=n/2;

        lint sum=0;
        for(i=0;i<n;i++)
            sum+=arr[i];

        lint b=sum/n;
        lint pb=b+1;
        lint ppb=b-1;

        lint bs=0,pbs=0,ppbs=0;

        for(i=0;i<n;i++)
        {
            bs+=(abs(arr[i]-b));
            mid+=(abs(arr[i]-arr[index]));

            midmax+=(abs(arr[i]-arr[index+1]));

            midmin+=(abs(arr[i]-arr[index-1]));

            pbs+=(abs(arr[i]-pb));

            ppbs+=(abs(arr[i]-ppb));

        }

        lint aa=min(bs,min(pbs,ppbs));
        lint bb=min(mid,min(midmin,midmax));

        aa=min(aa,bb);

       cout<<aa<<endl;
      return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <iomanip>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
#include <queue>
#include <cmath>
#include <numeric>
#include <set>
#include <random>


using namespace std;
struct aaa{aaa(){cin.tie(nullptr); ios::sync_with_stdio(false); cout<<fixed<<setprecision(20);};}aaa;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v){o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}
#define debug(v) {cerr<<"\033[1;36m[debug]\033[m "<<#v<<" : "<<v<<endl;}

using int64 = long long;

int main() {
    int d;
    cin >> d;

    vector<vector<int>> s(d, vector<int>(27, 0));
    for (int i=0; i<d; i++) {
        for (int j=1; j<27; j++)
            cin >> s[i][j];
    }

    for (int i=0; i<d; i++) {
        auto it = max_element(s[i].begin(), s[i].end());
        cout << it - s[i].begin() << endl;
    }
}

Measured memory_bytes: 3280
#include<stdio.h>
int main() {
    int a, b, k;
    scanf("%d%d%d", &a, &b, &k);
    int i;
    if (b - a < k * 2) {
        for (i = a; i <= b; i++)
            printf("%d\n", i);
    }
    else {
        for (i = a; i < a+k; i++) {
            printf("%d\n", i);
        }
        for (i = b - k + 1; i <= b; i++) {
            printf("%d\n", i);
        }
    }
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <stack>
#include <algorithm>
#include <string>
#include <map>
#include <iterator>
#include <set>
#include <queue>

using namespace std;


int main() {


    int A, B;
    cin >> A >> B;

    cout << (A * B) << endl;

    return 0;
}

Measured memory_bytes: 3568
a, b, c = (input() for _ in range(3))
d = {"a": a, "b": b, "c": c}
nex = "a"

while len(d[nex]) != 0:
    tmp = d[nex][0]
    d[nex] = d[nex][1:]
    nex = tmp

print(nex.upper())


Measured memory_bytes: 9020
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define rep2(i,s,n) for (int i = s; i < n; ++i)
#define all(a) a.begin(),a.end()
using namespace std;

int main() {
    int n,l;
    cin >> n >> l;
    vector<string> s(n);
    rep(i,n) cin >> s[i];
    sort(all(s));
    rep(i,n) cout << s[i];
    cout << endl;
}

Measured memory_bytes: 256
#include<stdio.h>

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

Measured memory_bytes: 580
#include<iostream>
#include<string>
#include<algorithm>//next_permutation
using namespace std;

int main(){
    int n ;
    cin >> n ;
    string s,t;
    cin >> s >> t  ;
  for(int i=0;i<n;++i)
  {
        cout  << s[i] << t[i] ;
  }

  cout << endl;

  return 0;
}


Measured memory_bytes: 256
A, B = map(int, input().split())

def primeCount(N):
    R = int(N**(0.5)) + 1  # 素数の範囲
    primes = {}  # 素数のリスト
    n = N
    for num in range(2, R):
        primes[num] = 0
        while n % num == 0:
            n //= num
            primes[num] += 1
    if n > 1 :
        primes[n] = 1
    return { key : val for key, val in primes.items() if val > 0}  # フィルターをかける

primeA = primeCount(A)
ans = 1
prd = 1
for p in sorted(primeA.keys()):
    if B % p == 0 and prd % p != 0:
        prd *= p
        ans += 1
print(ans)


Measured memory_bytes: 99040
#include<bits/stdc++.h>
#define ll long long
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

using namespace std;
int main()
{
    fast_io
    ll i,n,x;
    cin>>n;
    ll a[n]={0};
   for(i=0;i<n-1;i++)
   {
       cin>>x;
       a[x-1]++;
   }
   for(i=0;i<n;i++)
   {
       cout<<a[i]<<endl;
   }
    return 0;
}




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

ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return b/gcd(a,b)*b;}

int main() {
  ll n, m;
  cin >> n >> m;

  ll ans = 0;
  ans = n * (n - 1) / 2 + m * (m - 1) / 2;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
int main()
{
    int a,b,n,m=1,i;
    int re;
    scanf("%d%d",&a,&b);
    n=b;
    while(n)
    {
        n/=10;
        m*=10;
    }
    re=a*m+b;
   for(i=1;;i++)
   {
       if(re==i*i)
       {
           printf("Yes");
           break;
       }
       else if(re<i*i)
       {
           printf("No");
           break;
       }
   }
    return 0;
}

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

using namespace std;

//#define FILE_IO

typedef long double LD;

class Circles
{
private:
    struct Circle
    {
        int x, y, r;
    };

    vector <Circle> v;
    LD dst[1005][1005];
    LD d[1005];

    LD getDistance(LD x11, LD y11, LD x22, LD y22)
    {
        LD ans = sqrt( (LD)1 * (x11 - x22) * (x11 - x22) + (LD)1 * (y11 - y22) * (y11 - y22) );
        return ans;
    }

    LD getDistance(Circle x, Circle y)
    {
        LD d = getDistance(x.x, x.y, y.x, y.y);
        d = max((LD)0.0, d - x.r - y.r);
        return d;
    }

    void calculateDistances()
    {
        for(int i = 0; i < v.size(); i++)
            for(int j = i + 1; j < v.size(); j++)
                dst[i][j] = dst[j][i] = getDistance(v[i], v[j]);
    }

public:
    void addCircle(int x, int y, int r)
    {
        Circle c;
        c.x = x;
        c.y = y;
        c.r = r;
        v.push_back(c);
    }

    LD getDistance(int st, int fn)
    {
        calculateDistances();

        for(int i = 0; i < v.size(); i++)
            d[i] = 2e18;

        queue <int> q;
        d[st] = 0.0;
        q.push(st);
        while(!q.empty())
        {
            int id = q.front();
            q.pop();

            for(int i = 0; i < v.size(); i++)
                if(d[i] > d[id] + dst[id][i])
                {
                    d[i] = d[id] + dst[id][i];
                    q.push(i);
                }
        }
        return d[fn];
    }
};

Circles crc;

int main()
{
    #ifdef FILE_IO
    freopen("1.in", "r", stdin);
    freopen("1.out", "w", stdout);
    #endif

    int x, y;
    scanf("%d%d", &x, &y);
    crc.addCircle(x, y, 0);
    scanf("%d%d", &x, &y);
    crc.addCircle(x, y, 0);

    int N;
    scanf("%d", &N);
    for(int i = 1; i <= N; i++)
    {
        int x, y, r;
        scanf("%d%d%d", &x, &y, &r);
        crc.addCircle(x, y, r);
    }

    LD ans = crc.getDistance(0, 1);
    cout << fixed << setprecision(15) << ans;

    return 0;
}


Measured memory_bytes: 17024
n,m=map(int,input().split())
X=sorted(list(map(int,input().split())))
init=[]
tmp=0
i=1

if m<n:
  n=m

while i<len(X):
  init.append([X[i]-X[i-1],i])
  i+=1
init.sort(reverse=True,key=lambda x:x[0])
init=list(map(lambda x:x[1],init))
ans=0
init=sorted(init[:n-1])
if len(init)==0:
  print(X[-1]-X[0])
  exit()
tmp=0
for i in init:
  ans+=(X[i-1]-X[tmp])
  tmp=i
try:
  if i!=len(X)-1:
    ans+=X[-1]-X[i]
except IndexError:
  print(0)
  exit()
print(ans)


Measured memory_bytes: 21616
#include <cstdio>
#include <cstring>
#include <iostream>
#include <queue>
using namespace std;

const long N=200000;

int main(){
	int n, m;
	int ct[21][21];
	
	memset(ct, -1, sizeof(ct));
	
	scanf(" %d %d", &n, &m);
	for(int i=0; i<m; ++i){
		int a, b, c, d;
		scanf(" %d,%d,%d,%d", &a, &b, &c, &d);	
		ct[a][b]=c;
		ct[b][a]=d;
	}
	
	int x1, x2;
	long y1, y2;
	scanf(" %d,%d,%ld,%ld", &x1, &x2, &y1, &y2);
	y1-=y2;
	
	long cost[21]; //各街までかかる最小の交通費
	for(int i=0; i<=20; ++i) cost[i]=N;
	//行きのbfs
	queue<int> que;
	cost[x1]=0;
	que.push(x1);
	while( !que.empty() ){
		int v=que.front();
		que.pop();	
		for(int i=1; i<=n; ++i){
			if(ct[v][i]>=0 && ct[v][i]+cost[v] < cost[i]){
				cost[i]=ct[v][i]+cost[v];	
				que.push(i);
			}
		}
	}
	y1-=cost[x2];

	for(int i=0; i<=20; ++i) cost[i]=N;
	//帰りのbfs
	cost[x2]=0;
	que.push(x2);
	while( !que.empty() ){
		int v=que.front();
		que.pop();	
		for(int i=1; i<=n; ++i){
			if(ct[v][i]>=0 && ct[v][i]+cost[v] < cost[i]){
				cost[i]=ct[v][i]+cost[v];	
				que.push(i);
			}
		}
	}
	y1-=cost[x1];
	
	printf("%ld\n", y1);
}

Measured memory_bytes: 1192
package main

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

var sc = bufio.NewScanner(os.Stdin)
var buff []byte

func init() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(buff, bufio.MaxScanTokenSize*1024)
	log.SetFlags(log.Lshortfile)
}

func ok(_i, _j, _k int, s string) bool {
	var i byte = byte(_i) + '0'
	var j byte = byte(_j) + '0'
	var k byte = byte(_k) + '0'
	var l, m, n int
	for l < len(s) && s[l] != i {
		l++
	}
	for m = l + 1; m < len(s) && s[m] != j; {
		m++
	}
	for n = m + 1; n < len(s) && s[n] != k; {
		n++
	}
	return n < len(s)
}

func main() {
	_ = nextInt()
	S := nextString()
	var ans int
	for i := 0; i <= 9; i++ {
		for j := 0; j <= 9; j++ {
			for k := 0; k <= 9; k++ {
				if ok(i, j, k, S) {
					ans++
				}
			}
		}
	}
	fmt.Println(ans)
}

func nextString() string {
	sc.Scan()
	return sc.Text()
}

func nextFloat64() float64 {
	sc.Scan()
	f, err := strconv.ParseFloat(sc.Text(), 64)
	if err != nil {
		panic(err)
	}
	return f
}

func nextInt() int {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return i
}

func nextInts(n int) (r []int) {
	r = make([]int, n)
	for i := 0; i < n; i++ {
		r[i] = nextInt()
	}
	return r
}

var dy = []int{0, 1, 0, -1}
var dx = []int{1, 0, -1, 0}
var MAX = math.MaxInt32

func pow(a, b int) int {
	return int(math.Pow(float64(a), float64(b)))
}

func lcm(a, b int) int {
	return a * b / gcd(a, b)
}
func gcd(a, b int) int {
	if a < b {
		a, b = b, a
	}
	for b != 0 {
		a, b = b, a%b
	}
	return a
}
func maxInt(a ...int) int {
	r := a[0]
	for i := 0; i < len(a); i++ {
		if r < a[i] {
			r = a[i]
		}
	}
	return r
}
func minInt(a ...int) int {
	r := a[0]
	for i := 0; i < len(a); i++ {
		if r > a[i] {
			r = a[i]
		}
	}
	return r
}
func sum(a []int) (r int) {
	for i := range a {
		r += a[i]
	}
	return r
}
func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

type Pair struct {
	a, b int
}

type Pairs []Pair

func (p Pairs) Len() int {
	return len(p)
}
func (p Pairs) Swap(i, j int) {
	p[i], p[j] = p[j], p[i]
}

func (p Pairs) Less(i, j int) bool {
	if p[i].a == p[j].a {
		return p[i].b < p[j].b
	}
	return p[i].a < p[j].a
}


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

#define fi first
#define se second
#define pb push_back
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
#define FOR(i, a, b) for (int i = a; i <= (b); i++)
#define ROF(i, a, b) for (int i = a; i >= (b); i--)

using pii = pair<int, int>; using vpii = vector<pii>;
using vi = vector<int>; using vvi = vector<vi>;
using ll = long long;
using pll = pair<ll, ll>; using vpll = vector<pll>;
using vll = vector<ll>; using vvll = vector<vll>;

int main() {
    int n, k, q; cin >> n >> k >> q;
    vi p(n + 1, k);
    FOR(i, 1, q) {
        int a; cin >> a;
        p[a]++;
    }
    FOR(i, 1, n) {
        if (p[i] <= q) cout << "No\n";
        else cout << "Yes\n";
    }
}

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

typedef long long ll;
using namespace std;

int main()
{
    int N, Q, l, r;
    string S;

    cin >> N >> Q;
    cin >> S;

    vector <int> X(N, 0);
    vector <int> ans(Q, 0);

    for (int i = 1; i < N; i++) {
        if (S[i-1] == 'A' && S[i] == 'C') X[i] = X[i-1] + 1;
        else X[i] = X[i-1];
    }

    for (int i = 0; i < Q; i++) {
        cin >> l >> r;
        ans[i] = X[r-1] - X[l-1];
    }
    for (int i = 0; i < Q; i++) {
        cout << ans[i] << endl;
    }
    return 0;
}


Measured memory_bytes: 1792
(defun lower-count (value rank max rest-count)
  (let 
    ((inc-value (+ value 1))
     (dec-rest (- rest-count 1)))
    (if 
      (zerop rest-count) 
      max
      (let ((n (read)))
        (if (and (>= rank n))
            (lower-count inc-value n (max max inc-value) dec-rest)
            (lower-count 0 n max dec-rest))))))

(defun main ()
 (princ (lower-count 0 0 0 (read))))

(main)
      

Measured memory_bytes: 76808
import itertools

N, M, Q = map(int, input().split())
A = [int(i + 1) for i in range(M)]
abcd = [[int(j) for j in input().split()] for i in range(Q)]
ans = 0
for i in itertools.combinations_with_replacement(A, N):
	a = 0
	for j in abcd:
		if i[j[1] - 1] - i[j[0] - 1] == j[2]:
			a += j[3]
	ans = max(a, ans)
print(ans)

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

int	main()
{
	vector<int>	q_vec;
	int	q, max_q = 0;
	while (cin >> q) {
		if (q == 0) break;
		if (max_q < q)
			max_q = q;
		q_vec.push_back(q);
	}
	vector<int>	cost(max_q + 1, -1);
	vector<int>	odd_cost(max_q + 1, -1);
	cost[0] = 0;
	odd_cost[0] = 0;
	int	num;
	for (int i = 1; (num = i * (i + 1) * (i + 2) / 6) <= max_q; ++i) {
		for (int j = 0; j <= max_q; ++j) {
			if (cost[j] == -1) continue;
			int	k = j + num;
			if (k > max_q) continue;
			int	cost_k = cost[j] + 1;
			if (cost[k] == -1 || cost[k] > cost_k)
				cost[k] = cost_k;
		}
		if (num % 2 == 0) continue;
		for (int j = 0; j <= max_q; ++j) {
			if (odd_cost[j] == -1) continue;
			int	k = j + num;
			if (k > max_q) continue;
			int odd_cost_k = odd_cost[j] + 1;
			if (odd_cost[k] == -1 || odd_cost[k] > odd_cost_k)
				odd_cost[k] = odd_cost_k;
		}
	}
	for (int q : q_vec) {
		cout << cost[q] << " " << odd_cost[q] << endl;
	}
}






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

// definitions
#define __Imperial_Lord__ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define _cps CLOCKS_PER_SEC
#define f first
#define s second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define rep(i, l, r) for (long long i = (l); i < (long long)(r); i++)
#define repb(i, r, l) for (long long i = (r); i > (long long)(l); i--)
#define lowb(a, x) ( lower_bound((a).begin(), (a).end(), (x)) - (a).begin())
#define uppb(a, x) ( upper_bound((a).begin(), (a).end(), (x)) - (a).begin())
#define sum(a)     ( accumulate ((a).begin(), (a).end(), 0ll))
#define high(x) __builtin_popcountll(x)
#define pb push_back
#define pf push_front
#define p0(a) cout << a << " "
#define p1(a) cout << a << endl
#define p2(a, b) cout << a << " " << b << endl
#define p3(a, b, c) cout << a << " " << b << " " << c <<endl
#define p4(a, b, c, d) cout << a << " " << b << " " << c << " " << d <<endl
#define exec cerr<<"Time taken : "<<(ld)(clock())/_cps<<"s"<<endl
#define mod1 998244353
#define mod 1000000007
#define pi 3.1415926535897932384

using namespace std;

// alias name for common data types
typedef vector<long long> vl;
typedef vector<long double> vld;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector< pair<long long, long long> > vp;
typedef vector<tuple<long long , long long , long long> > vtup;
typedef deque <long long> dql;
typedef deque <char> dqc;
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;

const ll INF=1e18;

template <class ...Args>
istream &read_args(Args &...args) {return (cin >> ... >> args);}
#define read(...)   __VA_ARGS__; read_args(__VA_ARGS__)

// cin and cout overloaded for vectors
template<typename T>    istream& operator>>(istream& is,  vector<T>& v)
{
    for (auto& i : v) 
        is >> i;        
    return is;
}
template<typename T>             
ostream& operator<<(ostream& os,  vector<T>& v)
{
    for (auto& i : v) 
        os << i << ' '; 
        return os;
}

ll none(ll i,ll j,ll n,ll m)
{
	if((i==0&&(j==0||j==m-1)) || (i==n-1&&(j==0||j==m-1))) return 2;
	else if(i==0 || j==0 || i==n-1 || j==m-1) return 3;
	else return 4;
}

// code beigns in main
int main()
{
	__Imperial_Lord__
    ll t=1;
    // cin >> t;
    ll lo;
    while(t--)
    {
    	ll read(n);
    	vl a(n);
    	cin >> a;
    	sort(all(a),greater<ll>());

    	// p1(a);
    	ll ans=a[0];
    	ll c=1,cnt=0;
    	rep(i,2,n)
    	{
    		// p1(a[c]);
    		if(cnt<2) ans+=a[c],cnt++;
    		if(cnt==2) cnt=0,c++;
    	}

    	p1(ans);
    }	
    exec;
}

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

int main() {
  int N;
  std::cin >> N;
  
  int ans = 100;
  for (int i = 0; i < N; i++){
    int a;
    std::cin >> a;
    
    int temp = 0;
    while (a % 2 == 0){
      temp += 1;
      a /= 2;
    }
    ans = min(temp, ans);
  }
  std::cout << ans << std::endl;
}


Measured memory_bytes: 3640
import sys
sys.setrecursionlimit(10**7)
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return sys.stdin.readline().strip()
INF = 10 ** 18
MOD = 10 ** 9 + 7

def get_primes_tuple(n):  # including n
    isPrime = [True for _ in range(n+1)]
    isPrime[0] = False
    isPrime[1] = False
    for j in range(4, n+1, 2): isPrime[j] = False  # multiples of 2
    primes = [2]

    for i in range(3, int(n**0.5)+1):
        if not isPrime[i]: continue
        primes.append(i)
        for j in range(i*i, n+1, i+i):  # j = (i*i, (i+2)*i, ..., m*i <= n)
            isPrime[j] = False
    # return tuple(isPrime)
    return tuple(primes)


primes = get_primes_tuple(10000)
def prime_factorization(n):
    pf = []
    for p in primes:
        while n != 1 and n%p == 0:
            pf.append(p)
            n //= p
    return pf


import collections

def main(): 
    n = II()

    pf_of_n_factorial = collections.defaultdict(int)
    for i in range(2, n+1):
        for p in prime_factorization(i):
            pf_of_n_factorial[p] += 1

    import itertools

    ans = 0

    # 1つの素数が75-1個以上ある。
    for i in primes:
        if pf_of_n_factorial[i] >= 74:
            ans += 1

    # 3-1, 25-1 または 5-1, 15-1
    for i, j in itertools.permutations(primes, 2):
        if pf_of_n_factorial[i] >= 2 and pf_of_n_factorial[j] >= 24:
            ans += 1
        if pf_of_n_factorial[i] >= 4 and pf_of_n_factorial[j] >= 14:
            ans += 1

    # 3-1, 5-1, 5-1
    for i, j, k in itertools.permutations(primes, 3):
        if pf_of_n_factorial[i] >= 2 and pf_of_n_factorial[j] >= 4 and pf_of_n_factorial[k] >= 4 and j<k:
            ans += 1

    print(ans)


main()

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

vector<int> A;

int main(){
    int N;
    int Alice=0, Bob=0;
    cin >> N;
    A.resize(N);
    rep(i,N) cin >> A[i];
    sort(A.begin(), A.end(), greater<int>());

    for(int i=0; i<N; i++){
        if(i%2==0){
            Alice+=A[i];
        }else{
            Bob+=A[i];
        }
    }
    int tmp=Alice-Bob;

    cout << tmp << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
 
int main(void){
  int i;
  char a[256];
  scanf("%s", a);
  for(i = strlen(a) - 1; i >= 0; i--){
    printf("%c",a[i]);
  }
  printf("\n");
  return 0;
}

Measured memory_bytes: 2560
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);


//入力変数
long N=sc.nextInt();
long K=sc.nextInt();

//入力値変換


//出力変数
long ans=0;

//計算
long quo=0;
long rem=0;
if(K==0){
    ans=N*N;
}else{
for(long b=K+1;b<=N;b++){
    quo=N/b;
    rem=N%b;
    ans+=quo*(b-K)+Math.max(rem+1-K,0);
}
}

//出力
System.out.println(ans);

}}


Measured memory_bytes: 23892
#include <bits/stdc++.h>
#define REP(i,n,N) for(int i=n;i<N;i++)
#define p(S) cout<<(S)<<endl
#define ck(a,b) (0<=(a)&&(a)<(b))

using namespace std;


int main(){
	int N,M;
	cin>>N;
	set<string> s;
	string str;
	REP(i,0,N) cin>>str,s.insert(str);
	cin>>M;
	bool flag=true;
	REP(i,0,M){
		cin>>str;
		if(s.find(str)!=s.end()){
			if(flag) cout<<"Opened by ";
			else cout<<"Closed by ";
			flag=!flag;
		}else	cout<<"Unknown ";
		p(str);
	}
	return 0;
}

Measured memory_bytes: 3232
const input = require("fs").readFileSync("/dev/stdin", "utf8")

const lines = input.split('\n')
let N = lines[0].trim()

let sum = 0
for (let i = 0; i < N.length; i++) {
    sum += N[i] - 0
}

console.log(sum % 9 === 0 ? 'Yes' : 'No')


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

// O(n)のアルゴリズム
bool solve(int n)
{
  if (n % 2 == 0)
  {
    return false;
  }
  int cnt = 0;
  for (int i = 1; i <= n; i++)
  {
    if (n % i == 0)
    {
      cnt++;
    }
  }
  if (cnt == 8)
  {
    return true;
  }
  else
  {
    return false;
  }
}

int main()
{
  int N;
  cin >> N;
  int cnt = 0;
  // O(N^2)のアルゴリズム
  for (int i = 1; i <= N; i++)
  {
    if (solve(i))
    {
      cnt++;
    }
  }
  cout << cnt << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define clr(x) memset(x,0,sizeof x)
#define For(i,a,b) for (int i=(a);i<=(b);i++)
#define Fod(i,b,a) for (int i=(b);i>=(a);i--)
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define fi first
#define se second
#define outval(x) cerr<<#x" = "<<x<<endl
#define outtag(x) cerr<<"-----------------"#x"-----------------\n"
#define outarr(a,L,R) cerr<<#a"["<<L<<".."<<R<<"] = ";\
                    For(_x,L,R) cerr<<a[_x]<<" ";cerr<<endl;
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
LL read(){
    LL x=0,f=0;
    char ch=getchar();
    while (!isdigit(ch))
        f=ch=='-',ch=getchar();
    while (isdigit(ch))
        x=(x<<1)+(x<<3)+(ch^48),ch=getchar();
    return f?-x:x;
}
const int N=55;
const int INF=N;
int n,ans;
int a[N][N],b[N][N];
int fa[N],fb[N];
vector <int> e[N];
void dfsa(int x,int pre){
	fa[x]=pre;
	For(i,1,n)
		if (a[x][i]&&i!=pre)
			dfsa(i,x);
}
void dfsb(int x,int pre){
	fb[x]=pre;
	For(i,1,n)
		if (b[x][i]&&i!=pre)
			dfsb(i,x);
}
int vis[N];
void dfs(int x,int pre){
	vis[x]=1;
	For(i,1,n)
		if (a[x][i]&&b[x][i]&&i!=pre)
			dfs(i,x);
}
bool check(int x){
	if (vis[x]==2)
		return 1;
	if (vis[x]==1)
		return 0;
	vis[x]=1;
	for (auto y : e[x])
		if (!check(y))
			return 0;
	vis[x]=2;
	return 1;
}
int Solve(int x){
	clr(fa),clr(fb);
	dfsa(x,0);
	dfsb(x,0);
	clr(vis);
	dfs(x,0);
	For(i,1,n)
		e[i].clear();
	For(i,1,n){
		if (!vis[i]&&!vis[fa[i]])
			e[i].pb(fa[i]);
		if (!vis[i]&&!vis[fb[i]])
			e[fb[i]].pb(i);
	}
	int c=0;
	For(i,1,n)
		if (!vis[i])
			c++;
	clr(vis);
	For(i,1,n)
		if (!check(i))
			return INF;
	return c;
}
int ina[N],inb[N];
int SolveN(int x,int y){
	clr(fa),clr(fb);
	dfsa(x,0);
	dfsb(y,0);
	For(i,1,n)
		e[i].clear();
	For(i,1,n){
		if (i!=x&&i!=y&&fa[i]!=x&&fa[i]!=y)
			e[i].pb(fa[i]);
		if (i!=x&&i!=y&&fb[i]!=x&&fb[i]!=y)
			e[fb[i]].pb(i);
	}
	clr(vis);
	For(i,1,n)
		if (!check(i))
			return 0;
	return 1;
}
int SolveN(){
	clr(ina),clr(inb);
	For(i,1,n)
		For(j,1,n){
			if (a[i][j])
				ina[j]++;
			if (b[i][j])
				inb[j]++;
		}
	For(i,1,n)
		if (inb[i]==1)
			For(j,1,n)
				if (j!=i&&ina[j]==1)
					if (SolveN(i,j))
						return 1;
	return 0;
}
void Solve(){
	clr(a),clr(b);
	ans=INF;
	n=read();
	For(i,1,n-1){
		int x=read(),y=read();
		a[x][y]=a[y][x]=1;
	}
	For(i,1,n-1){
		int x=read(),y=read();
		b[x][y]=b[y][x]=1;
	}
	For(i,1,n)
		ans=min(ans,Solve(i));
	if (ans==INF)
		ans=SolveN()?n:-1;
	cout<<ans<<endl;
}
int main(){
	int T=read();
	while (T--)
		Solve();
	return 0;
}

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

 
int gcd(int a,int b){
    if(a==0)
        return b;
 
    return gcd(b%a,a);
}
 
int main(){
  lli a,b;
  cin>>a>>b;
  lli c=gcd(a,b);
  cout<<c*(a/c)*(b/c);
}

Measured memory_bytes: 256
num = input().split()
wa = int(num[0]) + int(num[1])
sa = int(num[0]) - int(num[1])
seki =  int(num[0]) * int(num[1])
if wa >= sa:
  if wa >= seki:
    print(wa)
  else:
    print(seki)
else:
  if sa >= seki:
    print(sa)
  else:
    print(seki)

Measured memory_bytes: 3060
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include <stdbool.h>
#include <math.h>
#include <time.h>
#define ll long long
#define min(a, b) ((a) > (b) ? (b) : (a))
#define max(a, b) ((a) > (b) ? (a) : (b))
#define miin(a, b, c) min((a), min((b), (c)))
#define maax(a, b, c) max((a), max((b), (c)))
#define mod 1000000007

int main()
{
    char s[100], t[100];
    int i, f = 0, slen, tlen;
    scanf("%s %s", s, t);
    slen = strlen(s);
    tlen = strlen(t);
    for (i = 0; i < slen; i++) {
        if (s[i] != t[i]) {
            printf("No");
            f = 1;
            break;
        }
    }
    if (f == 0 && slen + 1 == tlen) printf("Yes");
    return 0;
}

Measured memory_bytes: 1732
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
#include<stdio.h>
#include<string.h>
#include <bitset>
#include<assert.h>

using namespace std;
#define int long long

#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007


#define MEM_SIZE 10000
#define DEBUG_OUT true
#define ALL(x) (x).begin(), (x).end()

template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return; std::cout << e <<" ";}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){std::cout<< e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T,class... Ts> void DEBUG(T d, Ts... e){if(DEBUG_OUT == false)return;DEBUG(d);DEBUG(e...);}
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; abort();}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }



void solve(void)
{

  int A;
  string B;
  cin>>A>>B;
  int X = (B[0] - '0')*100 +(B[2] - '0')*10 +(B[3] - '0');
  cout<<(X*A)/100<<endl;

}
int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(11);
  solve();

  return 0;
}


Measured memory_bytes: 3652
#include<iostream>
#include<algorithm>
#include<cmath>
#include<map>
#include<vector>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)

int main(){
	
    int a, b, ans;
    cin >> a >> b;

    ans = max(a + b, a * b);

    cout << max(a - b, ans) << endl;

	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        String[] splt = scanner.nextLine().split(" ");
        if(Integer.parseInt(splt[0])*500>=Integer.parseInt(splt[1])){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }

    }

}


Measured memory_bytes: 21840
//inlclude前用define 
#define _USE_MATH_DEFINES

//include
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<cstdio>
#include<type_traits>
#include<numeric>
#include<limits>
#include<iomanip>
using namespace std;
//typedef
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<char> VC;

//grobal変数


int main() {
	string s;
	cin >> s;
	int n = s.size();
	char memo=s[0];
	if (s[0] < s[1]) {
		memo = s[0];
		memo++;
	}else if (s[0] == s[1]) {
		if (s[2] > s[1]) {
			memo = s[0];
			memo++;
		} else {
			memo = s[1];
		}
	}
		
	for (int i = 0; i < 3; i++) {
		cout << memo;
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 256