akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
using namespace std;

int main(){
  int D;
  cin >>  D;
  string S;
  if(D == 25) S = "Christmas";
  else if(D == 24) S = "Christmas Eve";
  else if(D == 23) S = "Christmas Eve Eve";
  else if(D == 22) S = "Christmas Eve Eve Eve";
  cout << S << endl;
  return 0;
}


Measured memory_bytes: 256
import scala.io.StdIn

object Main extends App {
  val Array(a, b) = StdIn.readLine().trim.split(' ').map(_.toInt)

  println{ 
    if(a < b) "a < b" 
    else if(a > b) "a > b" 
    else "a == b"
  }
  
}



Measured memory_bytes: 44084
package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)
	xs := make([]float64, n)
	us := make([]string, n)
	for i := range xs {
		fmt.Scan(&xs[i], &us[i])
	}

	ans := 0.0
	for i, x := range xs {
		if us[i] == "BTC" {
			x *= 380000.0
		}
		ans += x
	}

	fmt.Printf("%f\n", ans)
}


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

using namespace std;

#define int long long
#define all(v) (v).begin(), (v).end()
#define resz(v, ...) (v).clear(), (v).resize(__VA_ARGS__)
#define reps(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep(i, n) reps(i, 0, n)

template<class T1, class T2> void chmin(T1 &a, T2 b){if(a>b)a=b;}
template<class T1, class T2> void chmax(T1 &a, T2 b){if(a<b)a=b;}

using Pi = pair<int, int>;
using Tapris = tuple<int, int, int>;
using vint = vector<int>;

const int inf = 1LL << 55;
const int mod = 1e9 + 7;

struct UnionFind {
  vector<int> data;
  UnionFind(int n):data(n, -1){}
  int find(int x) {
    return data[x] < 0 ? x : data[x] = find(data[x]);
  }
  int size(int x) {
    return -data[find(x)];
  }
  void unite(int x, int y) {
    x = find(x), y = find(y);
    if(x == y) return;
    if(data[x] > data[y]) swap(x, y);
    data[x] += data[y];
    data[y] = x;
  }
};

signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  int n, m;
  cin >> n >> m;
  vint a(n);
  rep(i, n) cin >> a[i];
  UnionFind uf(n);
  rep(i, m) {
    int u, v;
    cin >> u >> v;
    uf.unite(u, v);
  }
  if(uf.size(0) == n) {
    cout << 0 << endl;
    return 0;
  }
  int cnt = 0;
  rep(i, n) cnt += i == uf.find(i);
  vector<vint> vec(n);
  rep(i, n) vec[uf.find(i)].push_back(a[i]);
  int ans = 0;
  priority_queue<int, vint, greater<int> > que;
  rep(i, n) {
    if(vec[i].empty()) continue;
    sort(all(vec[i]));
    ans += vec[i][0];
    reps(j, 1, vec[i].size()) que.emplace(vec[i][j]);
  }
  if((int)que.size() < cnt-2) {
    cout << "Impossible" << endl;
    return 0;
  }
  rep(i, cnt-2) {
    ans += que.top(); que.pop();
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 7296
using System;
using System.IO;
using System.Linq;
class Z { static void Main() { new K(); } }
class K
{
	public K()
	{
		Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });
		Solve();
		Console.Out.Flush();
	}
	void Solve()
	{
		var I = Console.ReadLine().Split().Select(int.Parse).ToArray();
		int H = I[0], W = I[1];
		var t = YesNo(H, W, I[2], I[3]);
		if (t == null) Console.WriteLine("No");
		else
		{
			Console.WriteLine("Yes");
			for (var h = 0; h < H; h++)
			{
				for (var w = 0; w < W; w++) Console.Write("{0}{1}", t[h, w], w == W - 1 ? "" : " ");
				Console.WriteLine();
			}
		}
	}
	int[,] Swap2(int[,] t)
	{
		var Y = t.GetLength(0);
		var X = t.GetLength(1);
		var t2 = new int[X, Y];
		for (var x = 0; x < X; x++) for (var y = 0; y < Y; y++) t2[x, y] = t[y, x];
		return t2;
	}
	int[,] YesNo(int H, int W, int h, int w)
	{
		if (H % h == 0 && W % w == 0) return null;
		if (H % h == 0) return Swap2(YesNo(W, H, w, h));
		var r = H % h;
		var s = h - r;
		var N = H / h;
		var a = s * (2 * N + 1);
		var b = 2 * r * (N + 1);
		var x = s * (N + 1);
		var t = new int[H, W];
		for (var y = 0; y < W; y++)
		{
			for (var i = 0; i < N; i++)
			{
				for (var j = 0; j < r; j++) t[i * h + j, y] = a;
				for (var j = r; j < h; j++) t[i * h + j, y] = -b;
			}
			for (var i = N * h; i < H; i++) t[i, y] = x;
		}
		return t;
	}
}


Measured memory_bytes: 19664
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
using namespace std;
#define REP(i, j) for(int i = 0; i < (int)(j); ++i)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define REVERSE(v) reverse((v).begin(), (v).end())
typedef pair<double, double> P;
typedef pair<P, double> PP;
const double R = 6378.1;

void inputP(P &p){
  double x, y; cin >>x >>y;
  p = P(x, y);
}

PP make_pp(P &p){
  PP res;
  res.first.first = R * cos(p.first) * cos(p.second);
  res.first.second = R * cos(p.first) * sin(p.second);
  res.second = R * sin(p.first);
  return res;
}

double distancePP(PP &a, PP &b){
  double x = a.first.first - b.first.first;
  double y = a.first.second - b.first.second;
  double z = a.second - b.second;
  return sqrt(x * x + y * y + z * z);
}
 
int main() {
  P a, b;
  while(cin >>a.first >>a.second >>b.first >>b.second && a != P(-1, -1) && b != P(-1, -1)){
  a.first = a.first / 180.0 * M_PI;
  a.second = a.second/ 180.0 * M_PI;
  b.first = b.first / 180.0 * M_PI;
  b.second = b.second / 180.0 * M_PI;
  PP pa = make_pp(a), pb = make_pp(b);
  double l = distancePP(pa, pb), r = (R * R + R * R - l * l) / (2 * R * R);
  cout <<(int)round(acos(r) * R) <<endl;
  }
  return 0;
}

Measured memory_bytes: 1272
#include<iostream>
#include <fstream>
#include <math.h>


using namespace std;


int main(){
    int n;
    while(cin>>n){
        int sum=0;
        int input[10000]={0};
        //int max = 0;
        int now=0;
        for(int i=0; i<n; i++){
            int temp;
            cin>>temp;
            int flag=0;
            for(int j=0; j<now; j++){
                if(input[i]==temp){
                    flag++;
                }
            }
            if(flag==0){
                int flag2=0;
                for(int j=2; j<=sqrt(temp); j++){
                    if(temp%j==0){
                        flag2++;
                        break;
                    }
                }
                if(flag2==0)sum++;
            }
        }
        cout<<sum<<endl;
        
    }
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
// #include <numeric>
#include <complex>

#define FAST ios_base::sync_with_stdio(false); cin.tie(0)
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define repr(i, a, b) for(int i=int(a); i>=int(b); i--)
#define reps(i,n) for(int i=1;i<=int(n);++i)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)
#define iceil(x,y) (x+y-1)/y
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define all(x) (x).begin(),(x).end()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )

int gcd(int a,int b){return b?gcd(b,a%b):a;}

using namespace std;
typedef long long int ll;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
typedef pair<int, PII> PP;

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

int main() {
	int n;
	cin >> n;
	char m[100];

	sprintf(m, "%d", n);
	rep(i,3) {
		if (m[i]=='1') cout << "9";
		else cout << "1";
	}
	cout <<"\n";

	return 0;
}

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

#define DEBUG (0)

int main() {
  int N = 0;
  int a1 = 0;
  int a2 = 0;
  
  cin >> N;
  vector<int> a(N, 0);	//N個の要素を0で初期化
  for(int i = 0; i < N; i++){
    cin >> a[i];
  }

#if DEBUG
  cout << "--------------" << endl;
  for(int i = 0; i < N; i++){
    cout << i << " : " << a[i] << endl;
  }
#endif
  
  sort(a.begin(), a.end());

#if DEBUG
  cout << "--------------" << endl;
  for(int i = 0; i < N; i++){
    cout << i << " : " << a[i] << endl;
  }
#endif

  reverse(a.begin(), a.end());
  
#if DEBUG
  cout << "--------------" << endl;
  for(int i = 0; i < N; i++){
    cout << i << " : " << a[i] << endl;
  }
#endif

  for(int i = 0; i < N; i++){
    if(i%2 == 0){
      a1 += a[i];
    }else{
      a2 += a[i];
    }
  }
  
  int ans = a1 - a2;
  cout << ans << endl;
}

Measured memory_bytes: 256
def bitCount(bits):
    bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555)
    bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333)
    bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f)
    bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff)
    return (bits & 0x0000ffff) + (bits >> 16 & 0x0000ffff)


N = int(input())
F = [0] * N
for i in range(N):
    F[i] = int("".join(input().split()), 2)

P = [] * N
for i in range(N):
    P.append(list(map(int, input().split())))

maxx = -9999999999999999
for bina in range(1, 2**10):
    total = 0
    for i in range(N):
        zyu = bina & F[i]
        total += P[i][bitCount(zyu)]
    maxx = max(total, maxx)

print(maxx)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
vector<int>a(220);
int main(){
  int N;
  cin >> N;
  for(int i = 0; i < N; ++i) cin >> a.at(i);
  bool flag = false;
  int count = 0;
  while(true){
    for(int i = 0; i < N; ++i){
      if(a.at(i)%2 == 1) flag = true;
    }
    if(flag) break;
    for(int i = 0; i < N; ++i) a.at(i) /= 2;
    ++count;
  }
  cout << count << endl;
}

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

int main() {
	string str;
	cin >> str;
	bool n = false, s = false, w = false, e = false;
    for (int i = 0; i < str.size(); i++){
        if (str.at(i) == 'N'){
            n = true;
        }
        else if (str.at(i) == 'S'){
            s = true;
        }
        else if (str.at(i) == 'W'){
            w = true;
        }
        else if (str.at(i) == 'E'){
            e = true;
        }
    }

    cout << (((!(n ^ s)) & (!(w ^ e))) ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
#define tii tuple<int,int,int>
#define Priq priority_queue<int,vi,greater<int>>
#define pb push_back
#define mp make_pair
#define INF (1ll<<62)-1
#define MAX 1000000000
signed main(){
    int H,W,h,w; cin>>H>>W>>h>>w;
    if(H%h>0){
        cout<<"Yes"<<endl;
        rep(i,0,H){
            rep(j,0,W){
                if(i%h==0&&j%w==0) cout<<MAX-1<<" ";
                else if(i%h==0) cout<<MAX<<" ";
                else if(i%h==h-1) cout<<-MAX<<" ";
                else cout<<0<<" ";
            }
            cout<<endl;
        }
    }
    else if(W%w>0){
        cout<<"Yes"<<endl;
        rep(i,0,H){
            rep(j,0,W){
                if(i%h==0&&j%w==0) cout<<MAX-1<<" ";
                else if(j%w==0) cout<<MAX<<" ";
                else if(j%w==w-1) cout<<-MAX<<" ";
                else cout<<0<<" ";
            }
            cout<<endl;
        }
    }
    else cout<<"No"<<endl;
}

Measured memory_bytes: 3072
#include<iostream>
#include<algorithm>
using namespace std;
#define int long long
signed main() {
	int h, w;
	cin >> h >> w;
	int ans;
	int res = 1000000000000;
	for (int i = 1; i < w; i++) {
		int a = h*i;
		int b = (w - i)*(h / 2);
		int c = h*w - a - b;
		int d = max(a, max(b, c)) - min(a, min(b, c));
		res = min(d, res);
	}
	for (int i = 1; i < h; i++) {
		int a = w*i;
		int b = (h - i)*(w / 2);
		int c = h*w - a - b;
		int d = max(a, max(b, c)) - min(a, min(b, c));
		res = min(d, res);
	}
		for (int i = 1; i < w; i++) {
			int a = i;
			if (w - i < 1)break;
			int b = (w - i) / 2;
			if (b < 1)break;
			int c = w - a - b;
			if (c < 1)break;
			int d = max(a*h, max(b*h, c*h)) - min(a*h, min(b*h, c*h));
			res = min(d, res);
		}

		for (int i = 1; i < h; i++) {
			int a = i;
			if (h - i < 1)break;
			int b = (h - i) / 2;
			if (b < 1)break;
			int c = h - a - b;
			if (c < 1)break;
			int d = max(a*w, max(b*w, c*w)) - min(a*w, min(b*w, c*w));
			res = min(d, res);
		}
		ans = res;
	cout << ans << endl;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws IOException {
		try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
			String sd = br.readLine();
			String t = br.readLine();

			System.out.println(ans(sd, t));
		}
	}

	private static String ans(String sd, String t) {
		int maxLength = sd.length();
		char qes = '?';

		for (int i = maxLength - t.length(); i >= 0; i--) {
			boolean flag = true;
			for (int j = 0; j < t.length(); j++) {
				char sdChar = sd.charAt(i + j);
				char tChar = t.charAt(j);

				if (sdChar != qes) {
					flag = flag && (tChar == sdChar);
				}
			}
			if (flag) {
				char[] tmp = sd.toCharArray();
				for (int j = 0; j < t.length(); j++) {
					tmp[i + j] = t.charAt(j);
				}
				return new String(tmp).replaceAll("\\?", "a");
			}
		}

		return "UNRESTORABLE";
	}
}


Measured memory_bytes: 21204
n = int(input())
AB = [[int(i) for i in input().split()] for i in range(n)]
ans = ["Yes", "No"]
flag = 0
current = 0
AB.sort(key=lambda x:x[1])
for i in AB:
  current += i[0]
  if current > i[1]:
    flag = 1
    break
print(ans[flag])

Measured memory_bytes: 41176
#include<bits/stdc++.h>
#define fastIO ios::sync_with_stdio(false);cin.tie(0);
#define ll long long
#define f(i, l, r) for(i = l; i < r; i++)
#define fd(i, l, r) for(i = l; i > r; i--)
#define mod 1000000007
#define pb push_back
using namespace std;
typedef pair <int, int> pi;

ll max(ll a, ll b){
    return a<b? b:a;
}

int main(){
	fastIO
    int test = 1;
    // cin >> test;
    while(test--){
        int n, w; cin >> n >> w;
        ll weight[n], i, j;
        ll value[n];
        f(i,0,n) cin >> weight[i] >> value[i];
        ll knapsack[n+1][w+1];
        f(i,0,n+1){
            f(j,0,w+1){
                if(i==0 || j==0)
                    knapsack[i][j] = 0;
                else if(weight[i-1] <= j)
                    knapsack[i][j] = max(value[i-1] + knapsack[i-1][j-weight[i-1]], knapsack[i-1][j]);
                else knapsack[i][j] = knapsack[i-1][j];
            }
        }
        cout << knapsack[n][w];
        
    }
}


Measured memory_bytes: 79232
using System;
using System.Collections.Generic;
using System.Linq;
 
static class MainClass {
 
  public static void Main (string[] args) {
    var temp = Console.ReadLine().Split(' ').Select(long.Parse);
    var M = temp.ElementAt(2);

    var aList = Console.ReadLine().Split(' ').Select(long.Parse).ToList();
    var bList = Console.ReadLine().Split(' ').Select(long.Parse).ToList();

    var ans = aList.Min() + bList.Min();
    for(var i = 0; i < M; ++i){
      var temp2 = Console.ReadLine().Split(' ').Select(long.Parse);
      ans = Math.Min(aList[(int)temp2.ElementAt(0) - 1] + bList[(int)temp2.ElementAt(1) - 1] - temp2.ElementAt(2), ans);
    }
   
    Console.WriteLine(ans);
 
  }
  
}

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

int main() {
  int n;
  cin >> n;
  bool include = false;
  while(n>0) {
    if(n%10==9) {
      include = true;
      break;
    }
    n /= 10;
  }
  if(include) cout << "Yes" << endl;
  else cout << "No" << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
//#include <algorithm>
#include <cctype>

using namespace std;

char upper(char c){
    if('a' <= c && c <= 'z'){
        c = c - ('a' - 'A');
    }
    return c;
}

char lower(char c){
    if('A' <= c && c <= 'Z'){
        c = c + ('a' - 'A');
    }
    return c;
}

int main(void){
    string wd;
    int cnt;
   
    getline(cin,wd);
    cnt = wd.length();
    char chwd[cnt];
   
   
   for(int i=0; i<cnt; i++){
       chwd[i] = wd[i];
        if (isupper(chwd[i])){
            chwd[i]=lower(chwd[i]);
        }else if(islower(chwd[i])){
            chwd[i]=upper(chwd[i]);
        }
        cout << chwd[i];
   }
   cout << endl;
}


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

#define int ll

#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(), (v).end() 
#define sz(v) (int)((v).size())
#define fs first
#define sd second

typedef long long ll;

typedef pair < int, int > pi;
typedef pair < pi, int > ppi;

typedef vector < int > vi;
typedef vector < vector < int > > vvi;
typedef vector < pi > vpi;
typedef vector < vpi > vvpi;
typedef vector < ppi > vppi;

void fast() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}

vector<string> vec_splitter(string s) {
	s += ',';
	vector<string> res;
	while(!s.empty()) {
		res.push_back(s.substr(0, s.find(',')));
		s = s.substr(s.find(',') + 1);
	}
	return res;
}

void debug_out(
vector<string> __attribute__ ((unused)) args,
__attribute__ ((unused)) int idx, 
__attribute__ ((unused)) int LINE_NUM) { cerr << endl; } 
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
	if(idx > 0) cerr << ", "; else cerr << "Line(" << LINE_NUM << ") ";
	stringstream ss; ss << H;
	cerr << args[idx] << " = " << ss.str();
	debug_out(args, idx + 1, LINE_NUM, T...);
}

#ifdef LOCAL
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
#else
#define debug(...) 42
#endif

double get_time() {
	return 1.0 * clock() / CLOCKS_PER_SEC;
}

const int MAX = 2E5 + 5, MOD = 998244353;
int fac[MAX], ifac[MAX];

ll binpow(ll base, ll e, ll mod = MOD) {
	ll ret = 1;
	while(e) {
		if(e & 1)
			ret  = ret * base % mod;
		base = base * base % mod;
		e >>= 1;
	}		
	return ret;
}

int32_t main() {
	fac[0] = ifac[0] = 1;
	for(int i = 1; i < MAX; i++) {
		fac[i] = (i * fac[i - 1]) % MOD;
		ifac[i] = (binpow(i, MOD - 2) * ifac[i - 1]) % MOD;
	}
	int n, m, k;
	cin >> n >> m >> k;
	int res = 0;
	for(int i = n - k; i <= n; i++) {
		int val = (m * binpow(m - 1, i - 1)) % MOD;
		val = (val * fac[n - 1] % MOD) * ifac[i - 1] % MOD;
		val = (val * ifac[n - i]) % MOD;
		res = (res + val) % MOD;
	}
	cout << res << '\n';
}


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

int main()
{
    int n;
    cin >> n;
    for (int i = 0; i <= n; i += 7)
    {
        if ((n - i) % 4 == 0)
        {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
}

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

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pll;
typedef vector<bool> vb;
const ll oo = 0x3f3f3f3f3f3f3f3f;
const double eps = 1e-9;
#define sz(c) ll((c).size())
#define all(c) begin(c), end(c)
#define FOR(i,a,b) for (ll i = (a); i < (b); i++)
#define FORD(i,a,b) for (ll i = (b)-1; i >= (a); i--)
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
#define xx first
#define yy second
#define has(c,i) ((c).find(i) != end(c))
#define DBGDO(X) ({ if(1) cerr << "DBGDO: " << (#X) << " = " << (X) << endl; })

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	ll n; cin >> n;
	ll m = 3501;
	FOR(a,1,m) FOR(b,1,m) {
		ll x = n*a*b, y = 4*a*b - n*(a+b);
		ll c;
		if (y == 0) {
			if (x != 0) continue;
			c = 1;
		} else {
			if (x % y) continue;
			c = x / y;
		}
		if (c <= 0) continue;
		cout << a << " " << b << " " << c << endl;
		return 0;
	}

}



Measured memory_bytes: 256
package main

import (
	"fmt"
	"math"
)

var a, b, c, ans int

func main() {
	fmt.Scan(&a, &b, &c)
	if b-a == c-b {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}

/*  ----------------------------------------  */

func gcd(x, y uint64) uint64 {
	if x%y == 0 {
		return y
	} else {
		r := x % y
		return gcd(y, r)
	}
}

func combination(x, y int) int {
	return permutation(x, y) / permutation(y, y)
}

func permutation(x, y int) int {
	var ans int = 1
	for i := x - y; 0 < i; i-- {
		ans *= i
	}
	return ans
}

func max(x ...int) int {
	var res int = x[0]
	for i := 1; i < len(x); i++ {
		res = int(math.Max(float64(x[i]), float64(res)))
	}
	return res
}

func min(x ...int) int {
	var res int = x[0]
	for i := 1; i < len(x); i++ {
		res = int(math.Min(float64(x[i]), float64(res)))
	}
	return res
}

func pow(x, y int) uint64 { return uint64(math.Pow(float64(x), float64(y))) }
func abs(x int) int       { return int(math.Abs(float64(x))) }
func floor(x int) int     { return int(math.Floor(float64(x))) }

type si struct {
	s int
	i int
}

type SortBy []si

func (a SortBy) Len() int           { return len(a) }
func (a SortBy) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }
func (a SortBy) Less(i, j int) bool { return a[i].s < a[j].s }


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

int main() {
  std::string S;
  long long K;
  std::cin >> S >> K;

  size_t num1 = 0;
  char first_char = '1';

  for (auto c : S) {
    if (c == '1') {
      num1++;
    } else {
      first_char = c;
      break;
    }
  }

  if (K > num1) {
    std::cout << first_char << std::endl;
  } else {
    std::cout << '1' << std::endl;
  }

  return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
const int mxn = 1e5;
int T,K;
int dp[mxn+5];
int a[mxn+5];

int fn(int pos){
    if(pos==T-1) return 0;
    if(pos>=T) return 1<<30;
    if(dp[pos]!=-1) return dp[pos];
    int res = 1<<30;
    for(int i=1; i<=K; i++)
        if(pos+i<T)
            res = min( fn(pos+i)+abs(a[pos]-a[pos+i]) , res );

    return dp[pos] = res;
}

void solve(){

    cin>>T>>K;
    memset(dp,-1,sizeof(dp));
    for(int i=0; i<T; i++)
        cin>>a[i];

    cout<<fn(0)<<"\n";

}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    solve();
    return 0;
}




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

typedef long long ll;
#define REP(i, n) for(int i=0; (i) < int(n); ++(i))

int main(void){

	string s; cin >> s;
	s[3] = '8';
	cout << s << endl;

	return 0;
}


Measured memory_bytes: 256
#include <iostream> 
#include <vector> 
#include <algorithm> 
using namespace std; 
long long arr[100005];
int main()
{ 

int n; 
cin>>n; 
long long sum = 0; 
for (int i = 0; i < n; i++)
{
int x; 
cin >> x; 		
arr[x] += 1; 	
sum += x; 
} 	
int q;
cin >> q; 
while (q--)
{ 		
int b, c; 	
cin >> b >> c; 	
arr[c] += arr[b]; 	
sum = sum + arr[b] * c-arr[b]*b ; 
arr[b] = 0; 	
cout << sum << '\n'; 	} 	
}


Measured memory_bytes: 4404
//
// ~oisín~ C++ Template
//

#include                <bits/stdc++.h>
#define MX_N            5001
#define mp              make_pair
#define mod7            1000000007
#define modpi           314159
#define PI              3.141592653589793238
#define pb              push_back
#define FastIO          ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define All(a)          a.begin(),a.end()
#define fi              first
#define se              second
#define ll              long long int
#define ull             unsigned long long int

int kx[8]  =            {+2, +2, -2, -2, +1, +1, -1, -1};
int ky[8]  =            {+1, -1, +1, -1, +2, -2, +2, -2};
int d9x[9] =            {+1, +1, +1, +0, +0, +0, -1, -1, -1};
int d9y[9] =            {+1, +0, -1, +1, +0, -1, +1, +0, -1};
int dx4[4] =            {+0, +0, +1, -1};
int dy4[4] =            {+1, -1, +0, +0};

ll gcd(ull a, ull b){
    return (a==0)?b:gcd(b%a,a);
}

ll lcm(ull a, ull b){
    return a*(b/gcd(a,b));
}

const long long INF = 1e18;

using namespace std;

int main(){
    int n;
    cin >> n;
    int a, b;
    cin >> a >> b;
    int p[n];
    vector<int> ans = {0, 0, 0};
    for(int i=0;i<n;++i){
        cin >> p[i];
        if(p[i] <= a){
            ans[0]++;
        }else if(p[i] > b){
            ans[2]++;
        }else{
            ans[1]++;
        }
    }
    cout << *(min_element(All(ans))) << endl;
}


Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pp;
const int INF = 1e9;
const int MOD = 1000000007;
#define rep(i,n) for(int i=0;i<n;i++)
 
int main() {
  int h,w;
  cin >> h >> w;
  vector<vector<int>> dist(10,vector<int>(10,0));
  rep(i,10)rep(j,10) cin >> dist.at(i).at(j);
  rep(k,10)rep(i,10)rep(j,10){
    dist.at(i).at(j) = min(dist.at(i).at(j), dist.at(i).at(k)+dist.at(k).at(j));
  }
  vector<int> count(10,0);
  rep(i,h)rep(j,w){
    int a;
    cin >> a;
    if(a==-1);
    else count.at(a) ++;
  }
  int ans = 0;
  rep(i,10) ans += count.at(i) * dist.at(i).at(1);
  cout << ans << endl;
      
  return 0;
}




Measured memory_bytes: 256
import math
PRIME_NUM = 1000000007
N, M = map(int, input().split())
if abs(N - M) > 1:
    print(0)
elif N == M:
    print(2 * (math.factorial(N) % PRIME_NUM) * (math.factorial(M) % PRIME_NUM) % PRIME_NUM)
else:
    print((math.factorial(N) % PRIME_NUM) * (math.factorial(M) % PRIME_NUM) % PRIME_NUM)


Measured memory_bytes: 4096
MOD=10**9+7
K=int(input())
S=list(input())
len_S=len(S)

def invmod(a):
  return pow(a,MOD-2,MOD)
fact_dic={0:1}
fact_inv_dic={0:1}
fact_mod=1
for i in range(1,K+len_S+1):
  fact_mod=(fact_mod*i)%MOD
  fact_dic[i]=fact_mod
  fact_inv_dic[i]=invmod(fact_mod)
def comb_mod_table(n,r):
  if 0<=r<=n:
    return fact_dic[n]*fact_inv_dic[r]*fact_inv_dic[n-r]
  else:
    return 0
  
pow25=pow(25,K,MOD)
inv25=invmod(25)
pow26=1
answer=0
for i in range(K+1):
  answer+=comb_mod_table(K+len_S-i-1,len_S-1)*pow25*pow26
  pow25=pow25*inv25%MOD
  pow26=pow26*26%MOD
  answer%=MOD
  
print(answer)

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

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

using namespace std;
using ll = long long;

int main(){

	int r; cin >> r;

	cout << 2 * r * M_PI << endl;

	return 0;
}


Measured memory_bytes: 3764
#include<stdio.h>
main(){
int s[9000],i,n,m,t,f;
while(scanf("%d%d",&n,&m),i=0,t=f=1,n)
	while(++i<=n+m)
		if(scanf("%d",&s[i]),i>n)if(t+=s[t+=s[i]],f==t>=n)
			printf("%d\n",i-n,f=0);
	
}

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

int n,m,w[100];


bool C(int width){
	int now = 0,b = 0;
	for(int i = 0;i < n;i++){
		if(now + w[i] > width){
			now = w[i];
			b++;
		}else now += w[i];
		if(b >= m) return false;
	}
	return true;
}

int main(){
	while(cin >> m >> n,n){
		int ma = 0;
		for(int i = 0;i < n;i++) {
			cin >> w[i];
			ma = max(ma,w[i]);
		}
		int low = ma - 1,up = 1500000;
		while(up - low > 1){
			int mid = (low + up) / 2;
			if(C(mid)) up = mid;
			else low = mid;
		}
		cout << up << endl;
	}
	return 0;
}

Measured memory_bytes: 2992
#include <cstdio>
#include <cstdlib>
using namespace std;

int digit(int num){
	if((num / 10) > 0 ) return (digit(num/10))+1;
	else return 1;
}

int main(){
	int num1,num2,result=0;
	while(fscanf(stdin,"%d %d",&num1,&num2) != EOF){
		result = digit(num1+num2);
		printf("%d\n",result);
	}
	return 0;
}

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

using namespace std;
using llint = long long;
using pint = pair<int,int>;

#define LOG(x) cout << "# " << #x <<" => "<< (x) <<endl

const int INF = 1<<28;
const llint LLINF = 1LL<<60;

llint l, r;
llint ans = LLINF;

int main() {
    // Input
    cin >> l >> r;

    // Solve
    if (r-l >= 2019)
    {
        l = 0;
        r = 2018;
    }

    for (llint i = l; i <= r-1; ++i) {
        for (llint j = i+1; j <= r; ++j) {
            ans = min(ans, ((i%2019)*(j%2019))%2019);
        }
    }

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

Measured memory_bytes: 256
import java.util.*;

public class Main {
    static Scanner scanner = new Scanner(System.in);

    public static void main(String[]$) {
        int n = scanner.nextInt();
        int sum = 0;
        for (int i = 1; i <= n; i *= 10) {
            sum += n % (i * 10) / i;
        }
        System.out.println(n % sum == 0 ? "Yes" : "No");
    }
}

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

#define ll long long
#define ull unsigned long long
#define ld long double
#define pll pair<long long,long long>
#define pcc pair<char,char>
#define vl vector<long long>
#define vvl vector<vector<long long>>
#define vvvl vector<vector<vector<long long>>>
#define vc vector<char>
#define vvc vector<vector<char>>
#define vs vector<string>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define vp vector<pair<long long,long long>>
#define umap unordered_map
#define uset unordered_set
#define Lqueue priority_queue<long long>
#define Squeue priority_queue<long long,vector<long long>,greater<long long>>
#define fi first
#define se second
#define mp make_pair
#define mt make_tuple
#define eb emplace_back

const int MOD1=1000000007;
const int MOD2=998244353;
const long double PI=3.1415926535897932;
const long long MAXLL=9223372036854775807;
const long long INF=2305843009213693951;
const int dx[]={0,1,0,-1,1,-1,1,-1};
const int dy[]={1,0,-1,0,1,1,-1,-1};

#define unless(a) if(!(a))
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define rbf(a,x) for(auto& a:x)
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep2(i,s,n) for(int i=(s);i<(n);i++)
#define bitrep(i,s,n) for(int i=(s);i<(1LL<<(n));i++)
#define bitcheck(bit,i) (bit)&(1LL<<(i))
#define Maxe(x) *max_element((x).begin(),(x).end())
#define Mine(x) *min_element((x).begin(),(x).end())
#define Size(x) ((long long)(x).size())
#define Lin(s) getline(cin,(s))

void Yes(bool a){cout<<(a?"Yes":"No")<<endl;}
void YES(bool a){cout<<(a?"YES":"NO")<<endl;}
template<class T,class U> auto max(T a,U b){return a>b?a:b;}
template<class T,class U> auto min(T a,U b){return a<b?a:b;}
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;}
long long cutup(long long a,long long b){return (a+b-1)/b;}
long long popcnt(long long a){return __builtin_popcountll(a);}
template<class T,class U> inline bool chmin(T& a,U b){if(a>b){a=b;return true;}return false;}
template<class T,class U> inline bool chmax(T& a,U b){if(a<b){a=b;return true;}return false;}

struct edge{long long to,cost;};
struct edge2{long long from,to,cost;};

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll n,a,b,c,d,e;
    cin>>n>>a>>b>>c>>d>>e;
    ll res=4;
    res+=max({cutup(n,a),cutup(n,b),cutup(n,c),cutup(n,d),cutup(n,e)});
    cout<<res<<endl;
}

Measured memory_bytes: 3660
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Edge = pair<int, int>;
using Graph = vector<vector<Edge>>;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
const ll MOD = 1000000007;
const ll nmax = 8;
const ll INF = 1e9;
bool graph[nmax][nmax];
vector<vector<ll>> dist = vector<vector<ll>>(nmax, vector<ll>(nmax, INF));
void warshall_floyd(ll n)
{
    for (size_t i = 0; i < n; i++)
    {
        for (size_t j = 0; j < n; j++)
        {
            for (size_t k = 0; k < n; k++)
            {
                dist[j][k] = min(dist[j][k], dist[j][i] + dist[i][k]);
            }
        }
    }
}

class UnionFind
{
public:
    vector<ll> Parent;

    UnionFind(ll N)
    {
        Parent = vector<ll>(N, -1);
    }
    ll find(ll A)
    {
        if (Parent[A] < 0)
            return A;
        return Parent[A] = find(Parent[A]);
    }

    ll size(ll A)
    {
        return -Parent[find(A)];
    }

    bool Union(ll A, ll B)
    {
        A = find(A);
        B = find(B);
        if (A == B)
        {
            return false;
        }
        if (size(A) < size(B))
            swap(A, B);

        Parent[A] += Parent[B];
        Parent[B] = A;

        return true;
    }
};

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

ll lcm(ll a, ll b)
{
    ll g = gcd(a, b);
    return a / g * b;
}

ll mulMod(ll a, ll b)
{
    return (((a % MOD) * (b % MOD)) % MOD);
}

ll powMod(ll a, ll p)
{
    if (p == 0)
    {
        return 1;
    }
    else if (p % 2 == 0)
    {
        ll half = powMod(a, p / 2);
        return mulMod(half, half);
    }
    else
    {
        return mulMod(powMod(a, p - 1), a);
    }
}

ll ceil(ll a, ll b)
{
    return (a + b - 1) / b;
}

void solve(long long N, std::vector<long long> A, std::vector<long long> B)
{
    priority_queue<pair<int, int>> q;

    for (int i = 0; i < N; i++)
    {
        q.push(make_pair(B[i], i));
    }
    ll ans = 0;
    while (!q.empty())
    {
        int now = q.top().second;
        q.pop();
        int dif = B[now] - A[now];
        int tmp = B[(now - 1 + N) % N] + B[(now + 1) % N];

        if (dif != 0 && dif < tmp)
        {
            ans = -1;
            break;
        }
        ans += dif / tmp;
        B[now] -= dif / tmp * tmp;
        if (B[now] != A[now])
            q.push(make_pair(B[now], now));
    }

    cout << ans << endl;
    return;
}

int main()
{
    long long N;
    scanf("%lld", &N);

    std::vector<long long> A(N);
    for (int i = 0; i < N; i++)
    {
        scanf("%lld", &A[i]);
    }
    std::vector<long long> B(N);
    for (int i = 0; i < N; i++)
    {
        scanf("%lld", &B[i]);
    }
    solve(N, std::move(A), std::move(B));
    return 0;
}


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

int a[100005];

int main() {
    int n;
    cin >> n;
    for (int i = 0; i < n; i++)
        cin >> a[i];
    for (int i = 0; i < n; i++) {
        a[i]--;
        if ((i && a[i] < a[i - 1]) || (i != n - 1 && a[i] > a[i + 1]))
            a[i]++;
    }
    for (int i = 0; i < n - 1; i++) {
        if (a[i] > a[i + 1]) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
}

Measured memory_bytes: 640
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import math

def sieve_of_erastosthenes(num):
    input_list = [False if i % 2 == 0 or i % 3 == 0 or i % 5 == 0 else True for i in range(num)]
    input_list[0] = input_list[1] = False
    input_list[2] = input_list[3] = input_list[5] = True
    sqrt = math.sqrt(num)

    for serial in range(3, num, 2):
        if serial >= sqrt:
            return input_list
        for s in range(serial ** 2, num, serial): 
            input_list[s] = False

primeTable = sieve_of_erastosthenes(13*(10**5))

while True:
    k = int(input())
    if k == 0:
        break
    if primeTable[k]:
        print(0)
    else:
        i = k
        while primeTable[i] is False: i += 1
        j = i-1
        while primeTable[j] is False: j -= 1
        print(i-j)

Measured memory_bytes: 17060
package main

import "fmt"

type tower struct {
	height    int
	canAchive []int
}

func newTower(height int) *tower {
	return &tower{
		height:    height,
		canAchive: make([]int, 0),
	}
}

func (t *tower) addReachable(i int) {
	t.canAchive = append(t.canAchive, i)
}

func (t *tower) isGoodTower(h []int) bool {
	for _, v := range t.canAchive {
		if t.height <= h[v] {
			return false
		}
	}
	return true
}

func main() {
	var n, m int
	fmt.Scanf("%d%d", &n, &m)

	h := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scanf("%d", &h[i])
	}

	towers := make([]*tower, n)
	for i := 0; i < n; i++ {
		towers[i] = newTower(h[i])
	}

	for i := 0; i < m; i++ {
		var a, b int
		fmt.Scanf("%d%d", &a, &b)
		towers[a-1].addReachable(b - 1)
		towers[b-1].addReachable(a - 1)
	}

	var count int = 0
	for i := 0; i < n; i++ {
		if towers[i].isGoodTower(h) {
			count++
		}
	}

	fmt.Println(count)

}


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

const int MAX_N = 100005;

bool is_prime(int x) {
	if (x == 2) return true;
	if (x < 2 || x % 2 == 0) return false;
	for (int i = 3; i * i <= x; i += 2) {
		if (x % i == 0) return false;
	}
	return true;
}

int main() {
	vector<bool> ok(MAX_N);
	rep(i, MAX_N) if (is_prime(i)) ok[i] = true;
	vector<int> s(MAX_N);
	rep(i, MAX_N - 1) {
		if (ok[i] && ok[(i + 1) / 2]) s[i + 1] = s[i] + 1;
		else s[i + 1] = s[i];
	}
	int q;
	cin >> q;
	rep(i, q) {
		int l, r;
		cin >> l >> r;
		cout << s[r + 1] - s[l] << endl;
	}
	return 0;
}

Measured memory_bytes: 3644
fn main() {
    let v = read_vec::<u32>();
    let n = v[0];
    let k = v[1];

    let mut x = 1;
    for i in 1.. {
        x *= k;
        if x > n {
            println!("{}", i);
            break;
        }
    }
}

#[allow(dead_code)]
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}
#[allow(dead_code)]
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}
#[allow(dead_code)]
fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}
#[allow(dead_code)]
fn yn(result: bool) {
    if result {
        println!("Yes");
    } else {
        println!("No");
    }
}


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

using namespace std;
typedef long long ll;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setprecision(10) << fixed;
    int N;
    string S, T;
    cin >> N;
    cin >> S >> T;
    for(int i = 0; i < N; i++){
        cout << S[i] << T[i];
    }
    cout << endl;
}

Measured memory_bytes: 256
from sys import setrecursionlimit, exit
setrecursionlimit(1000000000)

def main():
    x, y = map(int, input().split())
    a = max(0, (4 - x) * 100000)
    b = max(0, (4 - y) * 100000)
    c = 400000 if x == y == 1 else 0
    print(a + b + c)

main()

Measured memory_bytes: 2940
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <array>
#include <vector>
#include <functional>
#include <unordered_map> 
#include <map> 
#include <numeric>
#include <limits>
#include <utility>
#include <queue>
#include <random>
#include <bitset>
#include <memory>
using namespace std;
typedef long long LL;
//#define _USE_MATH_DEFINES

int main(void) {
	int n;
	cin >> n;
	if (n >= 1000) {
		cout << "ABD" << endl;
	}
	else {
		cout << "ABC" << endl;
	}

	return 0;
}


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

using namespace std;

#define int long long
#define faster ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define cint int t;cin>>t;while(t--)
#define rep(i,a,b) for(int i=a;i<b;i++)
#define vint vector<int>
#define all(v) (v).begin(), (v).end()
#define pii pair<int,int>
#define pb push_back
#define N 10005
#define mm0(X) memset((X), 0, sizeof((X)))
#define mm1(X) memset((X), -1, sizeof((X)))
int mod=1e9+7;
mt19937 mrand(random_device{}());
int rnd(int x) { return mrand() % x;}
int powmod(int a,int b) {int res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
int gcd(int a,int b){return b?gcd(b,a%b):a;}

int32_t main() {
    faster;

    int n,k,c;
    cin>>n>>k>>c; string s; cin>>s;

    int l[k],r[k];
    for(int i=0;i<k;i++){
        l[i]=-1;
        r[i]=-2;
    }

    int j=0;
    
    for(int i=0;i<s.length()&&j<k;i++){
        if(s[i]=='o'){
            l[j]=i;
            j++;
            i+=c;
        }
    }

    j=k-1;

    for(int i=s.length()-1;i>=0&&j>=0;i--){
        if(s[i]=='o'){
            r[j]=i;
            j--;
            i-=c;
        }
    }

    for(int i=0;i<k;i++){
        if(l[i]==r[i]){
            cout<<l[i]+1<<endl;
        }
    }
}


Measured memory_bytes: 6420
from collections import deque,defaultdict,Counter
from itertools import accumulate
import bisect
from heapq import heappop,heappush
from fractions import gcd
from copy import deepcopy
import math
Mod = 1000000007



def main(): #startline-------------------------------------------
    N = int(input())
    T = [int(input()) for i in range(N)]
    def LCM(i,j):
        return i*j//gcd(i,j)
    tempans = [T[0]]*(N)
    for i in range(1,N):
        tempans[i] = LCM(tempans[i-1],T[i])
    print(tempans[N-1])
if __name__ == "__main__":
    main() #endline===============================================




def sieve_of_eratosthenes(n):
    if not isinstance(n,int):
        raise TypeError("n is not int")
    if n<2:
        raise ValueError("n < 2 is not effective")
    prime = [1]*(n+1)
    for i in range(2,int(math.sqrt(n))):
        if prime[i] == 1:
            for j in range(2*i,n):
                if j%i == 0:
                    prime[j] = 0
    res = []
    for i in range(2,n):
        if prime[i] == 1:
            res.append(i)
    return res

class UnionFind:
    def __init__(self,n):
        self.parent = [i for i in range(n+1)]
        self.rank = [0 for i in range(n+1)]
    
    def findroot(self,x):
        if x == self.parent[x]:
            return x
        else:
            y = self.parent[x]
            y = self.findroot(self.parent[x])
            return y
    
    def union(self,x,y):
        px = self.findroot(x)
        py = self.findroot(y)
        if px < py:
            self.parent[py] = px
        else:
            self.parent[px] = py

    def same_group_or_no(self,x,y):
        return self.findroot(x) == self.findroot(y)

Measured memory_bytes: 5804
#include<cstdio>
#include<bits/stdc++.h>
typedef long long int ll;
#define REP(i, n) for(int i = 0; i < (n); i++)
#define FOR_IN(i, a, b) for(int i = (a); i < (b); i++)
#define BETWEEN(x, a, b) ((x) >= (a) && (x) <= (b))
#define BIT(b, i) (((b) >> (i)) & 1)
#define LOG_F 1
#define LOG(...) if(LOG_F) fprintf(stderr, __VA_ARGS__)

using namespace std;

ll pow(int x, int n){
  return n == 0 ? 1 : x * pow(x, n - 1);
}


/*

 */
char a[3][11];

int main(){
  REP(i,3){
    char s[11];
    cin>>s;
    s[0] += 'A'-'a';
    cout<<s[0];
  }
  cout<<endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.*;
import java.io.*;

public class Main {
    public static void main(String[] args) {
        FastReader sc = new FastReader();
        String a = sc.next();
        String b = sc.next();
        if (a.length() <= b.length()) {
            System.out.println(minimumChar(a, b));
        } else {
            System.out.println(minimumChar(b, a));
        }
    }

    static int minimumChar(String S1, String S2) {
        int n = S1.length();
        int m = S2.length();

        int ans = Integer.MAX_VALUE;
        for (int i = 0; i < m - n + 1; i++) {
            int minRemovedChar = 0;
            for (int j = 0; j < n; j++) {
                if (S1.charAt(j) != S2.charAt(i + j)) {
                    minRemovedChar++;
                }
            }

            ans = Math.min(minRemovedChar, ans);
        }

        return ans;
    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
}

Measured memory_bytes: 32744
import sys
from collections import deque

def solve():
    input = sys.stdin.readline
    N, M = map(int, input().split())
    S = input().strip("\n")
    ans = deque()
    current = N
    while current > 0:
        for i in reversed(range(1, M+1)):
            if current - i >= 0 and S[current - i] == "0":
                ans.appendleft(i)
                current -= i
                break
        else: break
    if current > 0: print(-1)
    else: print(*ans, sep=" ")


    return 0

if __name__ == "__main__":
    solve()

Measured memory_bytes: 6632
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstring>
#include <sstream>
#include <cassert>
#include <list>
using namespace std;
static const double EPS = 1e-10;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> PI;
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define SZ(a) (int(a.size()))
#define F first
#define S second
const double pi=acos(-1);
int dx[]={0,1,0,-1},dy[]={1,0,-1,0};



typedef struct _state{
  int from,vis;
  double cost;
  _state(double ic,int ifr,int iv):cost(ic),from(ifr),vis(iv){
  };
  bool operator<(const _state&r)const{
    return cost>r.cost;
  };
}state;

typedef struct _edge{
  int to,cost;
  _edge(int ito,int icost):to(ito),cost(icost){
  };
}edge;

main(){
  int n,m,p,a,b;
  while(scanf("%d%d%d%d%d",&n,&m,&p,&a,&b),n){
    --a,--b;
    int ti[n];
    vector<edge> V[m];
    rep(i,n)scanf("%d",ti+i);

    rep(i,p){
      int x,y,z;
      scanf("%d%d%d",&x,&y,&z);
      --x,--y;
      V[x].pb(edge(y,z));
      V[y].pb(edge(x,z));
    }

    priority_queue<state> Q;
    Q.push(state(0,a,0));

    bool cost[1<<n][m];
    memset(cost,0,sizeof(cost));
    double ans=-1;

    int from,cti;
    double ccost;
    while(!Q.empty()){
      from=Q.top().from,cti=Q.top().vis;
      ccost=Q.top().cost;
      Q.pop();
      if(cost[cti][from])continue;
      cost[cti][from]=true;
      if(from==b){
        ans=ccost;
        break;
      }

      int to,cc,sz;
      rep(i,n){
        if(cti>>i&1)continue;
        sz=SZ(V[from]);
        rep(j,sz){
          to=V[from][j].to;
          cc=V[from][j].cost;
          if(cost[cti|1<<i][to])continue;
          Q.push(state(ccost+1.0*cc/ti[i],to,cti|1<<i));
        }
      }
    }
    if(ans<0)puts("Impossible");
    else printf("%f\n",ans);
  }
}

Measured memory_bytes: 7772
#include<stdio.h>
#include<iostream>
using namespace std;

int main(){
  int i, j;

  int n;cin >> n;

  int cards[4][13];
  for(i=0; i<4; i++){
    for(j=0; j<13; j++){
      cards[i][j]=0;
    }
  }

  char mark[2];;
  int num;

  for(i=0; i<n; i++){
    scanf("%s %d",mark,&num);
    switch(mark[0]){
    case 'S':
      cards[0][num-1]=1;
      break;
    case 'H':
      cards[1][num-1]=1;
      break;
    case 'C':
      cards[2][num-1]=1;
      break;
    case 'D':
      cards[3][num-1]=1;
      break;
    }
  }


  for(i=0; i<4; i++){
    for(j=0; j<13; j++){
      if(cards[i][j]==0){
        switch (i)
        {
        case 0:
          printf("S ");
          break;
        case 1:
          printf("H ");
          break;;
        case 2:
          printf("C ");
          break;
        case 3:
          printf("D ");
          break;
        }
        printf("%d\n",j+1);
      }
    }
  }

  return 0;
}


Measured memory_bytes: 3152