akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using ll = long long;
using  INT = long long;
#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=ll(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=ll(b);i--)
#define ALL(x) x.begin(),x.end()

#define INF (int)1e9 //10^9:∞
#define LLINF (long long)1e12
#define MOD (int)1e9+7 //10^9+7:合同式の法
#define PI 3.141592653589

#define YESNO(T) if(T){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define yesno(T) if(T){cout<<"yes"<<endl;}else{cout<<"no"<<endl;}
#define YesNo(T) if(T){cout<<"Yes"<<endl;}else{cout<<"No"<<endl;}

#define Graph vector<vector<int>>
#define PII pair<int,int>
#define VI vector<int>
#define VVI vector<vector<int>>
#define VPII vector<pair<int,int>>

#define DDD fixed<<setprecision(10)

using namespace std;
/*........................................DEFINE FUNCTIONS.........................................*/


/*....................................DEFINE GLOBAL VARIABLES .....................................*/

using id = string;

/*.........................................kemkemG0................................................*/
signed main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);

	
	ll N,X;
	cin>>N>>X;

	vector<ll> x(N),dis;

	REP(i,N){cin>>x[i];}

	sort(ALL(x));

	REP(i,N-1){
		dis.push_back(x.at(i+1)-x.at(i));
		dis.push_back(abs(X-x.at(i)));
	}
	dis.push_back(abs(X-x.at(N-1)));

	ll ans=dis.at(0);

	REP(i,N+N-1){
		ans=gcd(ans,dis.at(i));
	 }

	cout<<ans<<endl;
		










	return 0;
}












Measured memory_bytes: 6004
#include<bits/stdc++.h>
using namespace std;
int n,k,ans;
int main()
{
     cin>>n>>k;
     ans=1;
     for(int i=0;i<n;i++)
    {
        if(ans>k)
        {
            ans+=k;
        }
        else 
        ans*=2;

    }
    cout<<ans;

    return 0;
}

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

int main() {
  vector<int> a(32);
  a = { 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51 };
  int k;
  cin >> k;
  cout << a.at(k-1) << endl;
}

Measured memory_bytes: 3640
import java.util.*;
import static java.lang.Math.*;
import static java.util.Arrays.*;

public class Main {

	int INF = 1 << 28;
	double EPS = 1e-10;
	int n, s, g;
	double[][] map;
	
	
	void run() {
		Scanner sc = new Scanner(System.in);
		for(;;) {
			n = sc.nextInt();
			s = sc.nextInt(); g = sc.nextInt();
			if( (n|s|g) == 0 ) break;
			s--; g--;
			
			Pent[] pents = new Pent[n];
			for(int i=0;i<n;i++) {
				pents[i] = new Pent(sc.nextDouble(), sc.nextDouble(), sc.nextDouble(), sc.nextDouble());
			}
			
			map = new double[n][n];
			for(int i=0;i<n;i++) for(int j=i+1;j<n;j++) {
				map[i][j] = map[j][i] = pents[i].d(pents[j]);
			}
			
			for(int k=0;k<n;k++) for(int i=0;i<n;i++) for(int j=0;j<n;j++) {
				map[i][j] = min(map[i][j], map[i][k] + map[j][k]);
			}
			
			System.out.printf("%.10f\n", map[s][g]);
			
		}
	}
	
	class Pent {
		P[] ps;
		Pent (double x, double y, double a, double r) {
			ps = new P[5];
			for(int i=0;i<5;i++) {
				ps[i] = new P( -sin( (a + 72 * i) * PI / 180 ) * r + x, cos( (a + 72 * i) * PI / 180 ) * r + y );
			}
		}
		
		double d(Pent p) {
			double d = disSP(ps[0], ps[2], p.ps[0]);
			for(int i=0;i<5;i++) for(int j=0;j<5;j++){
				if( cross(ps[i], ps[(i+2)%5], p.ps[j], p.ps[(j+2)%5] ) ) return 0;
				d = min( disSP(ps[i], ps[(i+2)%5], p.ps[j]), d );
				d = min( disSP(p.ps[i], p.ps[(i+2)%5], ps[j]), d );
			}
			return d;
		}
	}
	
	double disSP(P p1, P p2, P q) {
		if( p2.sub(p1).dot(q.sub(p1)) < EPS ) return q.sub(p1).len();
		if( p1.sub(p2).dot(q.sub(p2)) < EPS ) return q.sub(p2).len();
		return disLP(p1, p2, q);
	}
	
	double disLP(P p1, P p2, P q) {
		double abs = abs ( p1.sub(p2).det(q.sub(p2)) ) / p1.sub(p2).len();
		if( abs < EPS ) return 0;
		return abs;
	}
	
	boolean cross(P p1, P p2, P q1, P q2) {
		return ccw(p1, p2, q1) * ccw(p1, p2, q2) <= 0 &&
			ccw(q1, q2, p1) * ccw(q1, q2, p2) <= 0;
	}
	
	int ccw (P a, P b, P c) {
		P s = b.sub(a);
		P t = c.sub(a);
		if( s.det(t) > EPS ) return 1;
		if( s.det(t) < -EPS ) return -1;
		if( s.dot(t) < -EPS ) return 2;
		if( s.dot(s) + EPS < t.dot(t) ) return -2;
		return 0;
	}
	
	class P {
		double x, y;
		P( double x, double y ) {
			this.x = x;
			this.y = y;
		}
		
		P add(P p) {
			return new P(add(x,p.x), add(y,p.y));
		}
		
		P sub(P p) {
			return new P(x-p.x, y-p.y);
		}
		
		double dot(P p) {
			return add( x*p.x, y*p.y );
		}
		
		double det(P p) {
			return add( x*p.y, -y*p.x );
		}
		
		double len() {
			double abs = sqrt ( add(x*x, y*y) );
			if( abs(abs) < EPS ) return 0;
			return abs;
		}
		
		double add(double a, double b) {
			if( abs(a+b) < EPS * ( abs(a) + abs(b) ) ) return 0;
			return a+b;
		}
	}

	public static void main(String[] args) {
		new Main().run();
	}

	void debug(Object... os) {
		System.err.println(Arrays.deepToString(os));
	}
}

Measured memory_bytes: 14000
#include<iostream>
#include<string>
using namespace std;
int main(){
	string a;
	int ans=0;

	cin >>a;
	for(int i=0;i<(int)a.size();i++){
		if(a[i]=='+')ans++;
		else ans--;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#include<vector>
int main(){
    int n,k;
    long long x[50],y[50],ans=5e18;
    scanf("%d%d",&n,&k);
    for(int i=0;i<n;i++)scanf("%lld%lld",&x[i],&y[i]);
    for(int l=0;l<n;l++){
        for(int r=0;r<n;r++){
            if(x[l]>=x[r])continue;
            std::vector<std::pair<long long,long long>> v;
            for(int i=0;i<n;i++)
                if(x[l]<=x[i]&&x[i]<=x[r])v.push_back({y[i],x[i]});
            if(v.size()<k)continue;
            std::sort(v.begin(),v.end());
            for(int i=0;i+k-1<v.size();i++){
                long long xmax=-1e10,xmin=1e10;
                for(int j=0;j<k;j++){
                    if(xmax<v[i+j].second)xmax=v[i+j].second;
                    if(xmin>v[i+j].second)xmin=v[i+j].second;
                }
                if((xmax-xmin)*(v[i+k-1].first-v[i].first)<ans)
                    ans=(xmax-xmin)*(v[i+k-1].first-v[i].first);
            }
        }
    }
    printf("%lld",ans);
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <array>
#include <unordered_set>
#include <unordered_map>
#include <map>
#include <set>
#include <math.h>
#include <queue>
#include <stdio.h>
#include <sstream>
using namespace std;
using i64 = int64_t;
#define rep(i, n) for(int i=0;i<n;++i)
#define rep2(i, x, n) for(int i=x;i<n;++i)

int main()
{   
    int x,a,b;
    cin >> x >> a >> b;
    x -= a;
    x = x%b;
    cout << x << endl;
    return 0;
}

Measured memory_bytes: 256
MOD = 10 ** 9 + 7
def sieve_of_eratosthenes(N):
    N += 1
    sieve = [0] * N
    for p in range(2, N):
        if sieve[p]:
            continue
        for i in range(p, N, p):
            sieve[i] = p
    return sieve

def lcm_with_sieve(numbers, N):
    sieve = sieve_of_eratosthenes(N)
    lcm = dict()
    for n in numbers:
        d = dict()
        while n > 1:
            factor = sieve[n]
            n //= factor
            d[factor] = d.get(factor, 0) + 1
        for factor, power in d.items():
            lcm[factor] = max(lcm.get(factor, 0), power)
    return lcm

_, *A = map(int, open(0).read().split())
lcm = 1
for factor, power in lcm_with_sieve(A, 10 ** 6).items():
    lcm = lcm * pow(factor, power, MOD) % MOD
total = 0
for a in A:
    total = (total + lcm * pow(a, MOD - 2, MOD)) % MOD
print(total)

Measured memory_bytes: 51312
//
//  main.cpp
//  ITP1_6_B
//
//  Created by Saicj on 2015/07/14.
//  Copyright (c) 2015??´ saicj. All rights reserved.
//

#include <iostream>
#include <stdio.h>
using namespace std;

int main()
{
    
    int n;
    
    string color = "";
    int cartNum = 0;
    
    bool cartInit[4][13] = {};
    
    cin >> n;
    
    for (int i = 0; i < n; i++) {
        
        int index = 0;
        
        cin >> color >> cartNum;
        
        if (color == "S"){
            index = 0;
        }else if (color == "H"){
            index = 1;
        }else if (color == "C"){
            index = 2;
        }else if (color == "D"){
            index = 3;
        }

        cartInit[index][cartNum-1] = true;
        
    }
    
    //??¨???
    for (int i = 0; i < 4; i++) {
        for (int j = 0; j < 13; j++) {
            
            // ????????????????????¨???
            if (!cartInit[i][j]) {

                if (i == 0) {
                    printf("%s %d","S",j+1);
                }else if (i == 1){
                    printf("%s %d","H",j+1);
                }else if (i == 2){
                    printf("%s %d","C",j+1);
                }else if (i == 3){
                    printf("%s %d","D",j+1);
                }
                
                printf("\n");
                
            }
        }
    }
    
    return 0;
}

Measured memory_bytes: 1200
const input = require('fs').readFileSync('/dev/stdin', 'utf8');
const lines = input
	.trim()
	.split('\n')
	.map(it => it.split(' ').map(Number));
let i = 0;
let n = 2, max = 2;
while (line = lines.shift()) {
	if (i % 2 === 0) {
		[n, max] = line;
		if (n === 0 && max === 0) { break; }
	}
	else {
		let temp = 0;
		for (let i = 0; i < n; i++) {
			for (let j = 0; j < n; j++) {
				if (!line[i] || !line[j] || i === j) {
					continue;
				}
				const tempCalc = line[i] + line[j];

				if (tempCalc <= max && tempCalc > temp) {
					temp = tempCalc;
				}
			}
		}
		
		console.log(`${temp ? temp : 'NONE'}`);
	}
	i++;
}



Measured memory_bytes: 18316
#include <iostream>
#include <cstdio>
#include <string>
#include <sstream>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <vector>
#include <set>
#include <map>
#include <queue>
using namespace std;

int main() {
    long N;
    cin >> N;
    vector<long long> A(N), B(N);
    for (long i=0; i<N; i++) {
        cin >> A[i] >> B[i];
    }
    
    vector<pair<long long, long long>> BA(N);
    for (long i=0; i<N; i++) {
        BA[i] = make_pair(B[i], A[i]);
    }
    sort(BA.begin(), BA.end());
    
    long long what_time_is_it_now = 0;
    bool can=true;
    for (long i=0; i<N; i++) {
        what_time_is_it_now += BA[i].second;
        
        if (what_time_is_it_now>BA[i].first) {
            //cout << "out " << what_time_is_it_now << endl;
            can=false;
            break;
        }
    }
    
    if (can) {
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
}


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

using namespace std;

typedef vector<int> vi;
typedef set<int> si;
typedef multiset<int> msi;

typedef pair<int, int> ii;

typedef vector<bool> vb;

int main( int argc, char *argv[] ) {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	int a, b, c;
	cin >> a >> b >> c;
	if ( c >= a && c <= b ){
		cout << "Yes" << "\n";
	}else if ( c >= b && c <= a ){
		cout << "Yes" << "\n";
	}else{
		cout << "No" << "\n";
	}
	return 0;
}


Measured memory_bytes: 256
N, K = map(int, input().split())
a = [0] * N
for i in range(N):
    a[i] = int(input())
a.sort()
min = 1000000000
for i in range(N-K+1):
    if a[i+K-1] - a[i] < min:
        min = a[i+K-1] - a[i]
print(min)

Measured memory_bytes: 7472
N = int(input())
a = list(map(int,input().split()))

ans = [a[0]]
check = N%2==0
for i,j in enumerate(a[1:]):
    if(check):
        if(i%2==0):
            ans.insert(0,j)
        else:
            ans.append(j)
    else:
        if(i%2==1):
            ans.insert(0,j)
        else:
            ans.append(j)
print(" ".join(map(str,ans)))

Measured memory_bytes: 124644
#include <bits/stdc++.h>
#define sync ios_base::sync_with_stdio(false);cin.tie(NULL);
#define ll long long int
#define mod 1000000007
using namespace std;
vector<ll> prime,sfac;
vector<ll>ps;
void sieve(ll n)
{
	prime.assign(n+1,1);
	sfac.assign(n+1,1);    
    for (int p=2; p*p<=n; p++) 
    {         
        if (prime[p] == 1) 
        { 	sfac[p]=p;  			  
            for (int i=p*p; i<=n; i += p) 
              {  prime[i] = 0; sfac[i]=p;}
        } 
    } 
	for(ll i=2;i<=n;i++)
	{
		if(prime[i])
			ps.push_back(i);
	}
}
ll gcd(ll a, ll b) 
{ 
    if (a == 0) 
        return b; 
    return gcd(b % a, a); 
} 
ll power(ll x, ll y) 
{ 
    ll res = 1;     // Initialize result 
   
    while (y > 0) 
    { 
        // If y is odd, multiply x with result 
        if (y & 1) 
            res = res*x; 
   
        // y must be even now 
        y = y>>1; // y = y/2 
        x = x*x;  // Change x to x^2 
    } 
    return res; 
}
int isPrime(ll n) 
{ 
    // Corner cases 
    if (n <= 1)  return 0; 
    if (n <= 3)  return 1; 
  
    // This is checked so that we can skip  
    // middle five numbers in below loop 
    if (n%2 == 0 || n%3 == 0) return 0; 
  
    for (ll i=5; i*i<=n; i=i+6) 
        if (n%i == 0 || n%(i+2) == 0) 
           return 0; 
  
    return 1; 
} 

int main()
{
	
		char ch;
        cin>>ch;
        if(ch>=97)
            cout<<"a"<<endl;
        else 
            cout<<"A"<<endl;
	}


Measured memory_bytes: 3576
#include<stdio.h>

int main(){

int N;

scanf("%d",&N);
for(int iii=0;iii<N;iii++){

int n;int ma=0,mi=0;
int t=0;int h;
scanf("%d",&n);
for(int i=0;i<n;i++){
	scanf("%d",&h);if(i==0)t=h;
if(h-t>ma)ma=h-t;
if(h>0&&t-h>mi)mi=t-h;
t=h;
}
printf("%d %d\n",ma,mi);
}
return 0;
}

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

#define fi first
#define se second
#define pb push_back
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define MOD 1000000007

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int main() {
	int G[3][3];
	int sum1=0,sum2=0;
	rep(i,3)rep(j,3) {
		cin >> G[i][j];
		if(i==j) sum1 += G[i][j];
		sum2 += G[i][j];
	}
	if(3*sum1 == sum2) {
		cout << "Yes" << endl;
	}
	else cout << "No" << endl;

  return 0;
}


Measured memory_bytes: 256
#!/usr/bin/python3
#coding: utf-8

S = int(input())

memo = {}

def rec(n):
    if n < 3:
        return 0
    ret = 1
    if n in memo:
        return memo[n]

    for i in range(n-3):
        ret += rec(n-3-i)
        ret %= 10**9 + 7
    memo[n] = ret
    return ret

print(rec(S))

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

using namespace std;
#define sf(n) scanf("%d", &n)
#define pd(n) printf("%.12lf", n)
#define pf(n) printf("%d", n)
#define p() printf("\n")
#define ps() printf(" ")
#define ll long long
#define ull unsigned long long
#define MAX 1e9
#define mod 1000 * 1000 * 100 + 7
#define pi 3.1415926536
#define ex 1e18
#define dbl 2e09
#define qu(q) queue<int> q
#define pqu(q) priority_queue<int> q
#define len(s) s.length()
#define sz(x) int(x.size())
#define pb(x) push_back(x)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()

int main()
{
    int a, b;
    cin >> a >> b;
    if (b % a == 0)
        cout << a + b << endl;
    else
        cout << b - a << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cmath>
#include<math.h>
//#include<array>
#include<algorithm>
#include<queue>
#include<deque>
#include<vector>
//#include<utility>
//#include<set>
#include<map>
//#include<list>
//#include<bitset>
//#include<iomanip>

using namespace std;
using LLI = long long int;
LLI N;

//配列,座標
/*array<int, 8>dir_x = { 0,0,1,1,1,-1,-1,-1 };
array<int, 8>dir_y = { 1,-1,1,0,-1,1,0,-1 };
array<int, 4>dir_x2 = { 0,0,1,-1 };
array<int, 4>dir_y2 = { 1,-1,0,0 };
char alp[] = { 'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z' };*/

//Union Find
/*class UnionFind {
public:
	vector<int>data;
	UnionFind(int size) :data(size, -1) {};
	bool unionset(int x, int y) {
		x = root(x), y = root(y);
		if (x != y) {
			if (data[y] < data[x]) {
				swap(x, y);
			}
			data[x] += data[y];
			data[y] = x;
		}
		return x != y;
	}
	bool findset(int x, int y) {
		return root(x) == root(y);
	}
	int root(int x) {
		return data[x] < 0 ? x : data[x] = root(data[x]);
	}
	int size(int x) {
		return -data[root(x)];
	}
};*/

//最大公約数,最小公倍数
/*LLI gcd(LLI x, LLI y) {
	LLI  r;
	if (x < y) {
		swap(x, y);
	}
	r = x % y;
	while (r != 0) {
		x = y;
		y = r;
		r = x % y;
	}
	return y;
}
LLI lcm(LLI x, LLI y) {
	return x / gcd(x, y) * y;
}*/

//組み合わせ
/*long nCr(int n, int r) {
	long ans = 1;
	for (int i = n; i > n - r; i--) {
		ans = ans * i;
	}
	for (int i = 1; i < r + 1; i++) {
		ans = ans / i;
	}
	return ans;
}
long nHr(int n, int r) {
	n = n + r - 1;
	return nCr(n, r);
}*/

//素数判定
/*bool IsPrime(int num)
{
	if (num < 2) return false;
	else if (num == 2) return true;
	else if (num % 2 == 0) return false;

	double sqrtNum = sqrt(num);
	for (int i = 3; i <= sqrtNum; i += 2)
	{
		if (num % i == 0)
		{
			// 素数ではない
			return false;
		}
	}

	// 素数である
	return true;
}*/

//桁数
/*LLI GetDigit(LLI num) {
	LLI digit = 0;
	while (num != 0) {
		num /= 10;
		digit++;
	}
	return digit;
}*/

//サンプル
/*const int n_max = 8;
array<array<bool, n_max>, n_max>graph;
int dfs(int v,int N,array<bool,n_max>visited) {
	int ret = 0;
	bool all_visited = true;
	for (int i = 0; i < N;i++) {
		if (visited[i] == false) {
			all_visited = false;
		}
	}
	if (all_visited) {
		return 1;
	}
	for (int i = 0; i < N;i++) {
		if (graph[v][i] == false) {
			continue;
		}
		if (visited[i] == true) {
			continue;
		}
		visited[i] = true;
		ret += dfs(i,N,visited);
		visited[i] = false;
	}
	return ret;
}*/

//サンプル
/*vector<vector<int>>sub;
int dfs(int id) {
	if (sub[id].size() == 0) {
		return 1;
	}
	int minP = (int)1e9;
	int maxP = 0;
	for (int i : sub[id]) {
		int P = dfs(i);
		minP = min(minP, P);
		maxP = max(maxP, P);
	}
	return minP + maxP + 1;
}*/

//#define debug(x) cerr << #x << " : " << x << endl
//#define debugv(x) cerr << #x << " : "; for(auto i:x) cerr << i << ", "; cerr<<endl

int main(void) {
	LLI N, A, B, C, D, E, res;
	bool a = false;
	cin >> N >> A >> B >> C >> D >> E;
	res = min({ A,B,C,D,E });
	if (N % res == 0) {
		a = true;
	}
	res = N / res;
	if (a) {
		res--;
	}
	cout << res + 5 << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
set<int> s[10],a;
string t;
set<int> expr(int &p);
set<int> term(int &p);
set<int> factor(int &p);
set<int> unio(set<int> x,set<int> y){
  set<int> res;
  for(int i:x) res.insert(i);
  for(int i:y) res.insert(i);
  return res;
}
set<int> inte(set<int> x,set<int> y){
  set<int> res;
  for(int i:x)
    if(y.count(i)) res.insert(i);
  return res;
}
set<int> diff(set<int> x,set<int> y){
  set<int> res;
  for(int i:x)
    if(!y.count(i)) res.insert(i);
  return res;
}
set<int> symm(set<int> x,set<int> y){
  set<int> res;
  for(int i:x)
    if(!y.count(i)) res.insert(i);
  for(int i:y)
    if(!x.count(i)) res.insert(i);
  return res;
}
set<int> comp(set<int> x){
  set<int> res;
  for(int i:a)
    if(!x.count(i)) res.insert(i);
  return res;
}
set<int> expr(int &p){
  set<int> res=term(p);
  while(p<(int)t.size()){
    if(t[p]=='u'){
      p++;
      res=unio(res,term(p));
      continue;
    }
    if(t[p]=='i'){
      p++;
      res=inte(res,term(p));
      continue;
    }
    if(t[p]=='d'){
      p++;
      res=diff(res,term(p));
      continue;
    }
    if(t[p]=='s'){
      p++;
      res=symm(res,term(p));
      continue;
    }
    break;
  }
  return res;
}
set<int> term(int &p){
  set<int> res;
  if(t[p]=='c'){
    p++;
    res=comp(term(p));
  }else if(t[p]=='('){
    p++;
    res=expr(p);
    p++;
  }else{
    res=factor(p);
  }
  return res;
}
set<int> factor(int &p){
  set<int> res=s[t[p++]-'A'];
  return res;
}


signed main(){
  char c;
  while(cin>>c){
    for(int i=0;i<10;i++) s[i].clear();
    a.clear();
    int x[10];
    int k=0;
    do{
      cin>>x[k];
      for(int i=0,t;i<x[k];i++){
	cin>>t;
	s[c-'A'].insert(t);
	a.insert(t);
      }
    }while(cin>>c,c!='R');
    int p;
    cin>>p>>t;
    set<int> ans=expr(p);
    bool f=0;
    for(int i:ans){
      if(f) cout<<" ";
      f=1;
      cout<<i;
    }
    if(ans.empty()) cout<<"NULL";
    cout<<endl;
  }
  return 0;
}

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

bool nextP(int n){
    if(n<=1) return false;
    for(int i=2; i*i<=n; i++){
      if(n%i ==0){
        return false;
      }
    }
      return true;
}
int main(){
  int x; 
  cin>>x;
  int p=x;
  while(!nextP(p)) p++;
  cout<<p<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(a) (a).begin(), (a).end()
// #define sort(a) sort(all(a))
using P = pair<int, int>;
using ll = long long;
using ld = long double;
typedef vector<int> vi;
int dx[4] = { 0, 1, 0,-1 };
int dy[4] = { 1, 0,-1, 0 };
const ll MOD = 1000000007;

signed main() {
  int x;
  cin >> x;
  int cnt = 0;
  int money = 100;
  while (true) {
    money += money/100;
    cnt++;
    if (money>= x) {
      cout << cnt << endl;
      return 0;
    }
  }
  cout << cnt << endl;
  return 0;
}

Measured memory_bytes: 3524
//  Created by conan1024hao in 2019.
//  Copyright © 2019 conan1024hao. All rights reserved.
//  専用ライブラリです、自由にコピーして構いません。
//  感谢看我的代码！Wechat:conan1024hao QQ:810396815
#pragma GCC optimize ("O3")
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <cctype>
#include <cstdlib>
#define INF 10e16
#define MOD 1000000007
#define  mod 998244353
#define rep(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define mmax(x,y)(x>y?x:y)
#define mmin(x,y)(x<y?x:y)
#define chmax(x,y) x=mmax(x,y)
#define chmin(x,y) x=mmin(x,y)
#define all(x) (x).begin(),(x).end()
#define siz(x) (ll)(x).size()
#define PI acos(-1.0)
using namespace std;
//using Int=int_fast64_t;
typedef long long int ll;
typedef pair<ll,ll>Pll;
typedef pair<int,int>Pin;
long long GCD(long long a, long long b) { return b ? GCD(b, a%b) : a; }
long long LCM(long long a, long long b)  {return a/GCD(a,b)*b;}
int dx[8]={-1,0,1,0};
int dy[8]={0,-1,0,1};
char dir[4]={'u','l','d','r'};
ll cmp1(pair<ll,string>a,pair<ll,string> b){
        if(a.fi!=b.fi)
        return a.fi<b.fi;
        else
        return a.se<b.se;
}
//--------------------------------------------------------------------------

//---------------------------------------------------------------------------
int main(){//問題をちゃんと見ろ!!!!!!!!!!!!!!!!!      llか??????????        memset()!!!!!!!!!!!!       ペナを減らせ!!!!!!!!!!!!!
    cin.tie(0);
    ios::sync_with_stdio(false);
    //-------------------------------
    int a,b,c,d;cin>>a>>b>>c>>d;
    if(abs(a-c)<=d||((abs(a-b)<=d)&&abs(b-c)<=d))
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
    //-------------------------------
    return 0;
}
//---------------------------------------------------------------------------






Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
#define repr(i, n) for (int i = (int)n - 1; i >= 0; --i)
#define ALL(a) (a).begin(), (a).end()
using ll = long long;
// using Graph = vector<vector<int>>;
const ll MOD = 1e9 + 7;
const ll INF = 1e9;
const ll LINF = 1LL << 60;

int main() {
  int n;
  cin >> n;
  vector<int> h(n);
  rep(i, n) cin >> h[i];
  int dp[n];
  dp[n - 1] = 0;
  dp[n - 2] = abs(h[n - 1] - h[n - 2]);
  repr(i, n - 2) {
    dp[i] =
        min(abs(h[i] - h[i + 1]) + dp[i + 1], abs(h[i] - h[i + 2]) + dp[i + 2]);
  }
  cout << dp[0] << endl;
  return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<string>
#include<cmath>
//#include<array>
#include<algorithm>
//#include<deque>
#include<vector>
//#include<utility>
#include<set>
//#include<map>
//#include<list>

using namespace std;

class UnionFind {
public:
	vector<int>data;
	UnionFind(int size) :data(size, -1) {};
	bool unionset(int x, int y) {
		x = root(x), y = root(y);
		if (x != y) {
			if (data[y] < data[x]) {
				swap(x, y);
			}
			data[x] += data[y];
			data[y] = x;
		}
		return x != y;
	}
	bool findset(int x, int y) {
		return root(x) == root(y);
	}
	int root(int x) {
		return data[x] < 0 ? x : data[x] = root(data[x]);
	}
	int size(int x) {
		return -data[root(x)];
	}
};

int gcd(int x, int y) {
	int tmp, r;
	if (x < y) {
		tmp = x;
		x = y;
		y = tmp;
	}
	r = x % y;
	while (r != 0) {
		x = y;
		y = r;
		r = x % y;
	}
	return y;
}

int main(void) {
	string N;
	bool A = true;
	int a, b,res;
	cin >> N;
	for (int i = 0; i < N.size();i++) {
		if (A == true && N[i] == 'A') {
			a = i;
			A = false;
		}
		if (A == false && N[i] == 'Z') {
			b = i;
		}
	}
	res = b - a + 1;
	cout << res << endl;
}

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

int n;
vector<string> r;

void form(string s, int b) {
	int m = s.length();
	if (m == n) r.push_back(s);
	else {
		for (int i = 0; i <= b; ++i) {
			string s2 = s + (char)(i+97);
			form(s2, max(b, i+1));
		}
	}
}

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

	cin >> n;

	form("", 0);

	for (auto c : r) cout << c << '\n';
}


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

int main(){
  int N;
  cin >> N;
  vector<double> x(N);
  vector<string> u(N);
  
  for(int i = 0; i < N; i++){
    cin >> x.at(i) >> u.at(i);
  }
  
  double ans = 0;
  
  for(int i = 0; i < N; i++){
    if(u.at(i) == "JPY"){
      ans+= x.at(i);
    }
    else{
      ans += 380000.0 * x.at(i);
    }
  }
  cout << ans;
}

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

using namespace std;

using ll = long long;
using ld = long double;
using li = __int128;
using uli = unsigned __int128;

#define fi first
#define se second

template <typename T> void s_min(T& a, T b) {
	if (a > b) a = b;
}

template <typename T> void s_max(T& a, T b) {
	if (a < b) a = b;
}

const int MAXN = 410;
const ll INF = 1e18;
int N, a[MAXN];
ll dp[MAXN][MAXN], pref[MAXN];

ll rec(int l, int r) {
	if (l == r) return 0;
	if (dp[l][r] != -1) return dp[l][r];
	dp[l][r] = INF;
	for (int i = l; i < r; i++) {
		s_min(dp[l][r], rec(l, i) + rec(i + 1, r));
	}
	dp[l][r] = dp[l][r] + pref[r] - pref[l - 1];
	return dp[l][r];
}

int main() {
	ios_base::sync_with_stdio(0);

	cin >> N;
	for (int i = 1; i <= N; i++) {
		cin >> a[i];
		pref[i] = pref[i - 1] + a[i];
	}
	memset(dp, -1, sizeof(dp));
	ll ans = rec(1, N);
	cout << ans;

	return 0;
}

Measured memory_bytes: 4968
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair< ll, ll > Pi;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep2(i,n) for(int i=1;i<=(n);i++)
#define rep3(i,i0,n) for(int i=i0;i<(n);i++)
#define pb push_back
#define mod 1000000007
const ll INF = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}
#define all(x) x.begin(), x.end()
#define mp make_pair
bool compare(Pi a, Pi b) {
    if(a.first != b.first){
        return a.first < b.first;
        
    }else{
        return a.second < b.second;
    }
}


bool In_map(ll y,ll x,ll h,ll w){
    if(y<0 || x<0 || y>=h || x>=w){
        return 0;
    }else{
        return 1;
    }
}
const vector<ll> dx{1,0,-1,0};
const vector<ll> dy{0,1,0,-1};


int main() {
    ll M;
    cin >>M;
    
    cout << -M+48 << endl;


    return 0;
    

}

Measured memory_bytes: 3604
#include "bits/stdc++.h"
using namespace std;
#define pb push_back
typedef long long ll;
#define fi first
#define se second
#define FF first
#define SS second
#define INF 2e18
#define mp make_pair
#define pii pair<int,int>
#define sd(x) scanf("%d",&x)
#define slld(x) scanf("%lld",&x)
#define pd(x) printf("%d\n",x)
#define plld(x) printf("%lld\n",x)
#define endl '\n'
#define fr(i, a, b) for(int i = a; i <= b; i++)
#define sz(s) (int)s.size()
#define y1 fdfbvfds
typedef long double f80;
#define all(x) x.begin(), x.end()

const int N = 2005;
vector<int> cyc;
int vis[N];
int ans = 1e9;
vector<int> cur, best;
vector<int> g[N];

void dfs(int u,int c,int d) {
    vis[u] = c;
    cur.pb(u);
    for(int v : g[u]) {
        if(v == c) {
            if(d + 1 < ans) {
                ans = d + 1;
                best = cur;
            }
        }
        else if(vis[v] != c)
            dfs(v, c, d + 1);
    }
    cur.pop_back();
}

signed main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
    int n, m;
    cin >> n >> m;
    int c = 0;
    fr(i, 1, m) {
        int u, v;
        cin >> u >> v;
        g[u].pb(v);
    }
    fr(i, 1, n) {
        dfs(i, i, 0);
    }
    if(best.empty())
        cout << -1 << endl;
    else {
        cout << sz(best) << endl; 
        for(int x : best)
            cout << x << endl;
    }
    return 0;
}

Measured memory_bytes: 512
n = int(input())

check = n//2 +2
ans = 10**8

for i in range(1,check):
    s,t = str(i), str(n-i)
    s_li = list(s)
    t_li = list(t)
    
    s_li = [int(x) for x in s_li]
    t_li = [int(x) for x in t_li]
    
    ans = min(ans, sum(s_li)+sum(t_li))
    
print(ans)

Measured memory_bytes: 3064
import heapq
from collections import deque
from enum import Enum
import sys
import math
from _heapq import heappush, heappop
import copy
from test.support import _MemoryWatchdog

BIG_NUM = 2000000000
HUGE_NUM = 99999999999999999
MOD = 1000000007
EPS = 0.000000001
sys.setrecursionlimit(100000)


while True:

    N = int(input())
    if N == 0:
        break

    me = list(map(int,input().split()))
    enemy = list(map(int,input().split()))

    me.sort(reverse=True)
    enemy.sort(reverse=True)

    num_win = 0
    ans = BIG_NUM

    k = 0

    for i in range(N-1):
        if me[i] > enemy[k]:
            num_win += 1
            if num_win > (i+1)//2:
                ans = i+1
                break
        else:
            k += 1

    if ans == BIG_NUM:
        print("NA")
    else:
        print("%d"%(ans))



Measured memory_bytes: 21760
#include<cstdio>
#include<cmath>
#include<string>
#include<iostream>
#include<algorithm>
#include<utility>
#include<vector>
#include<map>
#include<set>
#include<limits>
#include<bitset>
#include<array>
#include<numeric>
#include<iomanip>
#include<functional>

using namespace std;
typedef long long int ll;

ll n,m,a,b,c,x,y,aa[100010],ba[100010];
bool r,br,ar;
string s;
char ca,cb;


int main(){
    cin>>a>>b>>c;
    
    cout<<min(a+b,min(a+c,b+c))<<endl;
    
}


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

int main(void){
    int N, K, Q;
    std::cin >> N >> K >> Q;
    std::vector<int> A(N, 0);

    for (int i=0; i<Q; ++i){
        int tmp;
        std::cin >> tmp;
        ++A.at(tmp - 1);
    }

    for (int i=0; i<N; ++i){
        if (A.at(i) + K > Q){
            std::cout << "Yes" << std::endl;
        } else {
            std::cout << "No" << std::endl;
        }
    }

    return 0;
}


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

int main() {
    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    for (auto &e : a) cin >> e;
    
    int ans = 0;
    for (int &e : a) {
        ans += min(e, abs(e - k)) * 2;
    }
    
    cout << ans << endl;
    return 0;
}

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

using namespace std;
#define ll long long
#define rep(i, n) for (int i = 0; i < (n); ++i)
double const PI = 3.1415926535897932384626433;

int main() {
    int a, b;
    cin >> a >> b;
    if (a % 2 != b % 2)
        cout << "IMPOSSIBLE" << endl;
    else
        cout << (a + b) / 2 << endl;

    return 0;
}

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

using namespace std;

int main(){
    string s;
    cin >> s;
    string ans;
    ans=s[0];
    for (int i=2;i<s.length();i++){
	if (i%2 == 0) ans+=s[i];
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 512
// lcmとか__builtin_popcountとかはg++ -std=c++17 default.cppみたいなかんじで

#include <bits/stdc++.h>
#define mod 1000000007
#define INF 1001001001
#define ll long long
#define ln cout<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
using namespace std;

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

    ll a,b,c,d,m,n,maxi=0,f=0,mini=INF,sum=0;
    string str,str1;
    cin>>str;
    cin>>str1;
    rep(i,str.length()){
        if(str[i]!=str1[i]) sum++;
    }
    cout<<sum<<endl;

    return 0;
}


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

int main(){
  string S;
  cin >> S;
  int N = S.size();
  string ans = "yes";
  
    for(int i = 0; i < N; ++i){
  		for(int j = i + 1; j < N; ++j){
  			if(S[i] == S[j]){
  			ans = "no";
  			}
  		}
  	}
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h> //C++の標準ライブラリを一行で一括でインクルードする
#include <math.h> //数学関数と数学定数を利用する
using namespace std;
typedef long long int ll;

int N;
ll a[100100][3];
ll dp[100100][3];

ll INF = 1LL << 60;

void chmax(ll &a, ll b){
  if (a < b){
    a = b;
  }
}

int main(){
  cin >> N;
  
  for (int i = 0; i < N; i++){
    cin >> a[i][0] >> a[i][1] >> a[i][2];
  }
  
  //ループ
  for (int i = 0; i < N; i++){
    for (int j = 0; j < 3; j++){
      for (int k = 0; k < 3; k++){
        if (j == k) continue;
        chmax(dp[i+1][k], dp[i][j] + a[i][k]);  
      }
    }
  }
  
  ll res = 0;
  for (int i = 0; i < 3; i++){
    chmax(res, dp[N][i]);
  }
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 4992
#include <bits/stdc++.h>
#define rep(i,n) for (ll i = 0; i < (n); ++i)
#define All(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()   //reverse
#define strall(v) (v).cbegin(),(v).cend() //const_itterator
#define IN(a, b, x) (a<=x&&x<b)
using namespace std;
using ll = long long;
using Pair = pair<int,int>;
using Graph = vector<vector<ll>>;
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
template<typename t, typename u, typename Comp=less<>>
bool chmax(t& xmax, const u& x, Comp comp={}) { if(comp(xmax, x)) { xmax = x; return true; } return false;}
template<typename t, typename u, typename Comp=less<>>
bool chmin(t& xmin, const u& x, Comp comp={}) { if(comp(x, xmin)) { xmin = x; return true;} return false;}
const int INF = 1e9;
const ll infl = ll(1e18)+5;

/*
*ios::sync_with_stdio(false);
*cin.tie(0);
*/
int main(){
   int a,b,c;
   cin >> a >>b >> c;
   for(int i=1;i<=b;i++){
     if(i*a%b == c) {cout << "YES" << endl;return 0;}
   }
   cout << "NO" << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
using namespace std;
typedef long long ll;

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

    for(int i = 1; i <= 3; i++){
        if(i != a && i != b) cout << i << endl;
    }

    return 0;
}


Measured memory_bytes: 256
n,m=[int(i) for i in input().split()]
P=[[int(i) for i in input().split()] for j in range(m)]

def prefecturesort(i):
    return i[0]

def yearsort(i):
    return i[1]

W=[0 for i in range(n)]
Z=[]

for i in range(m):
    P[i].append(i)
    W[P[i][0]-1]+=1

P.sort(key=prefecturesort)
P_c=[]
sum=0
for i in range(n):
    c=W[i]
    if c==0:
        P_c.append([])
    else:
        P_c.append(P[sum:c+sum])
    sum+=c
    P_c[i].sort(key=yearsort)
for x in P_c:
    for j in range(len(x)):
        X=str("{0:06d}".format(x[j][0]))
        Y=str("{0:06d}".format(j+1))
        Z.append([X+Y,x[j][2]])
Z.sort(key=yearsort)
for i in range(m):
    print(Z[i][0])
    

Measured memory_bytes: 53500
#include <cstdio>
#include <algorithm>
using namespace std;
char s[2005][2005];
int r[2005][2005],c[2005][2005];
int main()
{
 int h,w,ans=0;
 scanf("%d%d",&h,&w);
 for(int i=1;i<=h;i++)
  scanf("%s",s[i]+1);
 for(int i=1;i<=h;i++)
 {
  int cnt=0,l=1;
  for(int j=1;j<=w;j++)
   if(s[i][j]=='.')cnt++;
   else
   {
    for(int k=l;k<j;k++)
     r[i][k]=cnt;
    r[i][j]=0;
    cnt=0,l=j+1;
   }
  for(int j=l;j<=w;j++)
   r[i][j]=cnt;
 }
 for(int i=1;i<=w;i++)
 {
  int cnt=0,l=1;
  for(int j=1;j<=h;j++)
   if(s[j][i]=='.')cnt++;
   else
   {
    for(int k=l;k<j;k++)
     c[k][i]=cnt;
    c[j][i]=0;
    cnt=0,l=j+1;
   }
  for(int j=l;j<=w;j++)
   c[j][i]=cnt;
 }
 for(int i=1;i<=h;i++)
  for(int j=1;j<=w;j++)
   ans=max(ans,r[i][j]+c[i][j]);
 printf("%d\n",ans-1);
 return 0;
}

Measured memory_bytes: 35456
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
typedef long long int ll;

#define BIG_NUM 2000000000

using namespace std;

struct Node{

	Node(int arg_to,int arg_cost,bool isUsed){
		to = arg_to;
		cost = arg_cost;
		used = isUsed;
	}
	bool operator<(const struct Node &arg) const{
			return cost > arg.cost;
	};

	int to,cost;
	bool used;
};

void func(int N,int M){

	vector<Node> V[N+1],workV[N+1];

	int from,to,cost,D_used[N+1],D_unused[N+1];

	for(int i = 1; i <= N; i++){
		D_used[i] = BIG_NUM;
		D_unused[i] = BIG_NUM;
	}

	D_used[1] = 0;
	D_unused[1] = 0;

	for(int loop = 0; loop < M; loop++){
		scanf("%d %d %d",&from,&to,&cost);

		V[from].push_back(Node(to,cost,false));
		V[to].push_back(Node(from,cost,false));
	}

	int middle;

	for(int i = 1; i <= N; i++){
		for(int k = 0; k < V[i].size(); k++){
			middle = V[i][k].to;
			for(int p = 0; p < V[middle].size();p++){
				if(i != V[middle][p].to){
					workV[i].push_back(Node(V[middle][p].to,0,true));
				}
			}
		}
	}

	for(int i = 1; i <= N; i++){
		for(int k = 0; k < workV[i].size(); k++){
			V[i].push_back(workV[i][k]);
		}
	}

	priority_queue<Node> Q;

	for(int i = 0; i < V[1].size(); i++){
		if(V[1][i].used == false){
			D_unused[V[1][i].to] = V[1][i].cost;
		}else{
			D_used[V[1][i].to] = V[1][i].cost;
		}
		Q.push(Node(V[1][i].to,V[1][i].cost,V[1][i].used));
	}

	int min_index;
	while(!Q.empty()){
		if(Q.top().used == true){
			if(Q.top().cost == D_used[Q.top().to]){
				min_index = Q.top().to;
				Q.pop();
			}else{
				Q.pop();
				continue;
			}

			for(int k = 0; k < V[min_index].size(); k++){
				if(V[min_index][k].used == false){
					if(D_used[V[min_index][k].to] > D_used[min_index] + V[min_index][k].cost){
						D_used[V[min_index][k].to] = D_used[min_index] + V[min_index][k].cost;
						Q.push(Node(V[min_index][k].to,D_used[V[min_index][k].to],true));
					}
				}else{
					//Do nothing
				}
			}

		}else{
			if(Q.top().cost == D_unused[Q.top().to]){
				min_index = Q.top().to;
				Q.pop();
			}else{
				Q.pop();
				continue;
			}

			for(int k = 0; k < V[min_index].size(); k++){
				if(V[min_index][k].used == false){
					if(D_unused[V[min_index][k].to] > D_unused[min_index] + V[min_index][k].cost){
						D_unused[V[min_index][k].to] = D_unused[min_index] + V[min_index][k].cost;
						Q.push(Node(V[min_index][k].to,D_unused[V[min_index][k].to],false));
					}
				}else{
					if(D_used[V[min_index][k].to] > D_unused[min_index] + V[min_index][k].cost){
						D_used[V[min_index][k].to] = D_unused[min_index] + V[min_index][k].cost;
						Q.push(Node(V[min_index][k].to,D_used[V[min_index][k].to],true));
					}
				}
			}
		}
	}

	printf("%d\n",min(D_used[N],D_unused[N]));
}

int main(){

	int N,M;

	while(true){
		scanf("%d %d",&N,&M);
		if(N == 0 && M == 0)break;

		func(N,M);
	}

    return 0;
}

Measured memory_bytes: 2780
a = int(input())
if (a <= 10):
    print("Yes")
elif(a==12)or(a==14)or(a==15)or(a==16)or(a==18)or(a==20):
    print("Yes")
elif(a==21)or(a==24)or(a==25)or(a==27)or(a==30):
    print("Yes")
elif(a==32)or(a==35)or(a==36)or(a==40):
    print("Yes")
elif(a==40)or(a==42)or(a==45)or(a==49):
    print("Yes")
elif(a==54)or(a==56):
    print("Yes")
elif(a==63)or(a==64):
    print("Yes")
elif(a==72):
    print("Yes")
elif(a==81):
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3192
#include <bits/stdc++.h>
#define fu(i, a, b) for (long long i = a; i <= b; i++)
using namespace std;
string s;
int n, a[1111111];
int ans[1111111];
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin >> s;
    n = s.size();
    fu(i, 1, n)
    {
        if (s[i - 1] == 'L')
            a[i] = 1;
    }
    int slL=0,slR=1;
    fu(i,2,n+1)
    {
        if (!a[i]&&a[i-1])
        {
            ans[i-slL  ]= (slL+1)/2+(slR)/2;
            ans[i-slL-1]=(slL)/2+(slR+1)/2;
            slL=0;slR=0;
        }
        slL+=a[i];slR+=!a[i];
    }
    fu(i,1,n)
    {
        cout << ans[i] << " ";
    }
}

Measured memory_bytes: 3152
#define _GLIBCXX_DEBUG

#include"bits/stdc++.h"
using namespace std;

//loops
#define REP(i,n) for(int i=0;i<(ll)(n);i++)
#define REPD(i,n) for(int i=(ll)(n)-1;i>=0;i--)
#define OneToN(i,n) for(int i=1;i<(ll)(n+1);i++)
#define ZeroToN(i,n) for(int i=0;i<(ll)(n+1);i++)
#define AToB(i,a,b) for(int i=a;i<(ll)(b+1);i++)
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define FORD(i,a,b) for(int i=(a);i>=(b);i--)

//bitsearch
#define BITSEARCH(bit, n) for (int bit = 0; bit < (1<<n); ++bit)
#define isOne(bit, i) bit & (1<<i)


//arrays
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define add push_back


#define remove_unique(v) v.erase(unique(ALL(v)), v.end())

//comparision
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

//pair
#define fir first
#define sec second
#define mp make_pair

//types
#define ll long long
#define vec vector
#define cord2d pair<int,int>
//UNCOMMENT WHEN NEEDED
//#define int ll

//input
template <class T> T get(){ T s; cin >> s; return(s);}
#define gi get<int>()
#define gs get<string>()

template <class T> vector<T> getv(int n) { vec<T> v(n); REP(i, n) cin >> v[i]; return v; }
#define gim(n) getv<int>(n)
#define gsm(n) getv<string>(n)

//output
void print(int a){ cout << a << endl; }
void print(long long a){ cout << a << endl; }
void print(string a){ cout << a << endl; }
void print(char a){ cout << a << endl; }
void print(double a){ cout << a << endl; }
void print(double a, int dig){ cout << std::setprecision(dig) << a << endl; }

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

template <class T = int>
void print(vec<T> v){ cout << v << endl; }

template <class T = int>
void print2dVec(vec<vec<T>> v2d){for(vec<T> v: v2d) {print(v);}}

void YesNo1(bool i = true){ return print(i?"Yes":"No"); }
void YESNO2(bool i = true){ return print(i?"YES":"NO"); }

//debug output
#define var_name(var) #var
template <class T> void debug(T &var, int nest = 0, string before = "") { cout << string("          ", nest) << before; print(var); }

//name replacement
#define y0 y0__
#define y1 y1__
#define j0 j0__
#define j1 j1__

//bool lambdas
#define lamb(exp) [](auto i){return exp;}
#define isEven [](int i){return i % 2 == 0;}
#define isOdd [](int i){return i % 2 != 0;}

//constants
const ll INF = 1e18;
const int MOD = 10000007;

//maths
int factorial(int k){ int sum = 1; for (int i = 1; i <= k; ++i) { sum *= i; } return sum; }
int gcd(int a, int b) {
    if (b == 0)
        return a;
    return gcd(b, a % b);
}

////////////////////

void Main() {
    //code here
    int x = gi, a = gi;
    if (x >= a) print(10); else print(0);
}

signed main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    Main();
}


Measured memory_bytes: 256
import std.algorithm, std.conv, std.range, std.stdio, std.string;
import std.container, std.typecons;

void main()
{
  auto n = readln.chomp.to!size_t;

  auto ei = new size_t[][](n);
  foreach (_; n.iota) {
    auto rd = readln.split.to!(size_t[]);
    auto u = rd[0] - 1;
    auto vi = rd[2..$].map!("a - 1").array;
    ei[u] = vi;
  }

  auto li = new int[](n);
  li[] = -1;
  li[0] = 0;

  auto qi = DList!vl(vl(0, 0));
  while (!qi.empty) {
    auto q = qi.front;
    qi.removeFront;

    foreach (u; ei[q.v]) {
      if (li[u] >= 0) continue;
      li[u] = q.l + 1;
      qi.insertBack(vl(u, q.l + 1));
    }
  }

  foreach (i, l; li)
    writefln("%d %d", i + 1, l);
}

alias Tuple!(size_t, "v", int, "l") vl;

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

#define ll long long
#define mod 1000000007
#define debug1(x) cerr<<#x<<" : "<<x<<"\n";
#define debug2(x,y) cerr<<#x<<" : "<<x<<"\t"<<#y<<" : "<<y<<"\n";
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define lp3(i,s,n) for(int i = s;i < int(n); ++i)
#define lp(i, n) lp3(i,0,n)


int main() {
    IOS;
    double d,t,s;
    cin>>d>>t>>s;
    double x=d/s;
    if(x>t)cout<<"No";else cout<<"Yes";
    return 0 ;
}


Measured memory_bytes: 3732
#include <iostream>
#include <cstdio>
#include <vector>
#include <queue>
#include <string>
#include <cmath>
#include <algorithm>

using namespace std;

#define pb push_back
#define mp make_pair
#define ff first
#define ss second

typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll, ll> pii;
typedef vector<pii> vii;
typedef priority_queue<ll> pq;

const int MOD = 1e9+7;
const int INF = 2e9;
const int MAX_N = 1;

int main() {
  int w;
  string s, ans; cin >> s >> w;
  for (int i = 0; i < s.length(); i+=w) {
    ans += s[i];
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#pragma GCC optimize("O3")

#define fi first
#define se second
#define em emplace
#define eb emplace_back
#define mp make_pair
#define pi pair<int,int>
#define vi vector<int>
#define vpi vector<pair<int,int>>
#define vll vector<ll>
#define vpll vector<pair<ll,ll>>
#define endl '\n'

#define si(v) int((v).size())
#define all(v) (v).begin(), (v).end()
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i) 
#define rep2(i, n, m) for (ll i = n; i <= (ll)(m); ++i)
#define rep3(i, n, m) for (ll i = n; i >= (ll)(m); --i)

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

using ll = long long;
using ld = long double;
using namespace std;

constexpr ll MOD = 1000000007;

int h, w;
char c[500][500];

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

signed main()
{
  cout << fixed << setprecision(20);
  ios::sync_with_stdio(false);
  cin.tie(0);

  cin >> h >> w;
  rep(i, h) rep(j, w) cin >> c[i][j];

  int vs[h][w];
  rep(i, h) rep(j, w) vs[i][j] = 0;
  
  int ans = 0;
  rep(i, h) rep(j, w) {
    if (!vs[i][j]) {
      vs[i][j] = true;

      queue<pi> que;
      que.em(j, i);
      int white = 0, black = 0;

      while (!que.empty()) {
        auto p = que.front(); que.pop();

        if (c[p.se][p.fi] == '.') ++white;
        else ++black;
        
        rep(i, 4) {
          int nx = p.fi + dx[i], ny = p.se + dy[i];
          if (nx < 0 || ny < 0 || nx >= w || ny >= h || vs[ny][nx] || c[ny][nx] == c[p.se][p.fi]) continue;

          vs[ny][nx] = true;
          que.em(nx, ny);
        }
      }
      ans += black * white;
    }
  }
  
  cout << ans << endl;

  return (0);
}


Measured memory_bytes: 5120
/*
   Created by Rahul Goel.
*/

#include <iostream>
#include <vector>
#include <cstring>
#include <string>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>

using namespace std;
typedef long long ll;
ll mod = 1000000007;
const int INF = 1e9;
const ll LINF = 1e18;

#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define all(c) (c).begin(), (c).end()
#define pii pair < int, int >
#define vi vector < int >
#define vb vector < bool >
#define vvi vector < vector < int > >
#define vvb vector < vector < bool > >
#define vpii vector < pair < int, int > >
#define vvpii vector < vector < pair < int, int > > >
#define pb push_back
#define f first
#define s second
#define mp make_pair

ll gcd(ll a, ll b){
    if(!b)
        return a;
    return gcd(b, a%b);
}

int main(){
    fastio;

    ll k;
    cin >> k;
    ll sum = 0;
    for(ll a=1; a<=k; a++)
        for(ll b=1; b<=k; b++)
            for(ll c=1; c<=k; c++)
                sum += gcd(a, gcd(b, c));
    cout << sum << endl;

    return 0;
}


Measured memory_bytes: 3656