akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <string>
#include <stdio.h>
#include<limits.h>
#include<algorithm>
#include<queue>
#include<set>
#include<math.h>
#include<random>


#define MOD 1000000007

using namespace std;

long long int modpow(long long int a, long long int n) {
	if (n == 0)return 1;
	if (n == 1)return (a % MOD);

	long long int hanbun = n / 2;
	long long int amari = n % 2;

	long long int ans = (a * a) % MOD;
	ans = modpow(ans, hanbun);

	if (amari == 1)ans *= a;

	ans %= MOD;

	return ans;

}

long long int gcd(long long int a, long long int b) {
	if (a < b) {
		long long int tmp = a;
		a = b;
		b = tmp;
	}

	long long int amari = a % b;

	if (amari == 0)return b;

	return gcd(b, amari);
}

long long int lcm(long long int a, long long int b) {
	long long int ans = (a * b) % MOD;
	long long int wari = modpow(gcd(a, b), MOD - 2);
	ans = (ans * wari) % MOD;
	return ans;
}

long long int factElement[10000] = { 0 };

long long int factrial(int n) {

	if (factElement[n] != 0)return factElement[n];

	if (n == 0) {
		factElement[0] = 1;
		return factElement[n];
	}

	long long int ans = n * factrial(n - 1);
	factElement[n] = ans;
	return factElement[n];

}

struct SegmentTree {
private:
	int n;
	vector<long long int> node;
	int TANNI;

	long long int Func(long long int a, long long int b) {
		return min(a,b);
	}

public:
	//元配列ｖをセグメント木で表現する。
	SegmentTree(vector<long long int> v, long long int tanni) {
		//最下段のノード数は元配列のサイズ以上になる最小の2冪→これをｎとおく。
		//セグメント木全体で必要なノード数は2n-1個である。
		int sz = v.size();
		n = 1;
		while (n < sz)n *= 2;

		TANNI = tanni;
		node.resize(2 * n - 1, TANNI);

		//最下段に値を入れた後に、下の段から順番に値を入れる。
		//値を入れるには、自分の子の２値を参照すればよい。
		for (int i = 0; i < sz; i++)node[i + n - 1] = v[i];
		for (int i = n - 2; i >= 0; i--)node[i] = Func(node[2 * i + 1], node[2 * i + 2]);
	}

	void update(long long int x, long long int val) {
		//最下段のノードにアクセスする。
		x += (n - 1);

		//最下段のノードを更新したら、あとは親に上って更新していく。
		node[x] = val;

		while (x > 0) {
			x = (x - 1) / 2;
			node[x] = Func(node[2 * x + 1], node[2 * x + 2]);
		}
	}

	long long int getVal(int x) {
		x += (n - 1);
		return node[x];
	}

	long long int getAns(int a, int b, int k = 0, int l = 0, int r = -1) {
		//最初に呼び出された時の区間は[0,n)
		if (r < 0)r = n;

		//要求区間と対象区間が交わらない→単位元を返す。
		if (r <= a || b <= l) return TANNI;

		//要求区間が対象区間を完全に被覆する→対象区間を答えの計算に使う。
		if (a <= l && r <= b) return node[k];

		//要求区間が対象区間の一部を被覆→子をよびだす。
		//左の子をvl、右の子をvrとしている。
		//新しい対象区間は現在の対象区間を半分に割ったもの。
		int vl = getAns(a, b, 2 * k + 1, l, (l + r) / 2);
		int vr = getAns(a, b, 2 * k + 2, (l + r) / 2, r);
		return Func(vl, vr);


	}



};




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

	vector<int> a(n);
	for (auto& i : a)cin >> i;

	int sum = 0;
	for (auto& i : a)sum += i;

	int ans = 0;

	for (int i = 0; i < a.size(); i++) {

		if (4 * m * a[i]< sum) {

		}
		else {
			ans++;
		}
	}

	if (ans >= m) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	





}



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

int main()
{
  long long int a, b, k;
  int i;
  
  scanf("%lld", &a);
  scanf("%lld", &b);
  scanf("%lld", &k);

  if(k != 0) {
    if(a != 0) {
      if(a < k) {
	k = k - a;
	a = 0;
      } else {
	a = a - k;
	k = 0;
      }
    }
  }

  if(k != 0) {
    if(b != 0) {
      if(b < k) {
	k = k - b;
	b = 0;
      } else {
	b = b - k;
	k = 0;
      }
    }
  }   

  printf("%lld %lld\n", a, b);

  return(0);
}


Measured memory_bytes: 1708
#include <algorithm>
#include <functional>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <vector>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <climits>

#define all(c) (c).begin(), (c).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)
#define fr first
#define sc second

const int INF=100000000;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
using namespace std;
typedef pair<int ,int > P;
typedef long long ll;

template<class T, int N=100000>
class Queue {
private:
    T ary[N];
    int head,tail;
public:
    Queue() : head(0),tail(0) {}
    bool is_empty() {
        return head == tail;
    }
    void enqueue(T x) {
        ary[tail++] = x;
        tail %= N;
    }
    T dequeue() {
        T x = ary[head++];
        head %= N;
        return x;
    }
};

struct Job {
    string name;
    int time;
};
Job job[100005];
int main() {
    int n,q;
    cin>>n>>q;
    rep(i,n) cin>>job[i].name>>job[i].time;
    Queue<Job> que;
    rep(i,n) que.enqueue(job[i]);
    int total = 0;
    while(!que.is_empty()) {
        Job t = que.dequeue();
        total += min(t.time,q);
        t.time -= q;
        if(t.time > 0) {
            que.enqueue(t);
        }
        else {
            cout<<t.name<<" "<<total<<endl;
        }
    }
    return 0;
}

Measured memory_bytes: 6672
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = a; i < (b); i++)
#define rrep(i, a, b) for (int i = a; i >= (b); i--)
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
template <class T>
inline bool chmin(T& a, T b) {
   if (a > b) {
      a = b;
      return true;
   }
   return false;
}
template <class T>
inline bool chmax(T& a, T b) {
   if (a < b) {
      a = b;
      return true;
   }
   return false;
}
const int INF = 2e9;
const int MOD = 1e9 + 7;

int main() {
   int n;
   cin >> n;
   string s;
   cin >> s;
   int ans = 0;
   rep(i, 0, n - 2) {
      if (s.substr(i, 3) == "ABC") ans++;
   }
   cout << ans << endl;
   return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
typedef long long int LL;
int main(){
	LL n;
	int i,j,k;
	int s;
	bool g=true;
	cin>>n;
	for(i=0;n>=10;n/=10){
		if(n%10!=9)g=false;
		i++;
	}
	s=i*9+n;
	if(!g)s--;
	cout<<s<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<typename T> using gpp_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T, typename L> using gpp_map = tree<T, L, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T> using gpp_multiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;*/
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define all(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)
#define bit(n) (1LL<<(n))
#define bit_exist(x, n) ((x >> n) & 1)
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) cout << #v << "=" << endl; REP(i_debug, v.size()){ cout << v[i_debug] << ","; } cout << endl;
#define mdebug(m) cout << #m << "=" << endl; REP(i_debug, m.size()){ REP(j_debug, m[i_debug].size()){ cout << m[i_debug][j_debug] << ","; } cout << endl;}
#define pb push_back
#define f first
#define s second
#define int long long
#define INF 1000000000000000000
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream &operator<<(ostream &os, vector<T> &v){ for(int i = 0; i < v.size(); i++) { cout << v[i]; if(i != v.size() - 1) cout << endl; }; return os; }
template<typename T> void Out(T x) { cout << x << endl; }
template<typename T1, typename T2> void Ans(bool f, T1 y, T2 n) { if(f) Out(y); else Out(n); }

using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using PiP = pair<int, Pii>;
using PPi = pair<Pii, int>;
using bools = vector<bool>;
using pairs = vector<Pii>;

//int dx[4] = {1,0,-1,0};
//int dy[4] = {0,1,0,-1};
//char d[4] = {'D','R','U','L'};

const int mod = 1000000007;
//const int mod = 998244353;
//#define Add(x, y) x = (x + (y)) % mod
//#define Mult(x, y) x = (x * (y)) % mod



signed main(){

    int N; cin >> N;
    string S; cin >> S;

    mat dp(N + 1, vec(N + 1, 0));
    int ans = 0;
    REP(i, N) REP(j, i + 1) if(S[i] == S[j]){
        dp[i + 1][j + 1] = dp[i][j] + 1;
        if(dp[i + 1][j + 1] <= i - j) Max(ans, dp[i + 1][j + 1]);
    }
    cout << ans << endl;

    return 0;
}


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

int sum_s[100005], sum_t[100005];
int sa(int a,int b){
    return sum_s[b] - sum_s[a-1];
}
int sb(int a,int b){
    return b-a+1-sa(a,b);
}
int ta(int a,int b){
    return sum_t[b] - sum_t[a-1];
}
int tb(int a,int b){
    return b-a+1 - ta(a,b);
}


int main(){
    string s,t;
    cin >> s >> t;
    int q; cin >> q;
    sum_s[0] = 0;
    sum_t[0] = 0;
    for(int i=1;i<s.length()+1;i++)  sum_s[i] = sum_s[i-1] + (s[i-1]=='A' ? 1 : 0);
    for(int i=1;i<t.length()+1;i++)  sum_t[i] = sum_t[i-1] + (t[i-1]=='A' ? 1 : 0);
    for(int i=0;i<q;i++){
        int a,b,c,d;
        cin >> a >> b >> c >> d;
        int aa = sa(a,b) + 2*sb(a,b), bb = ta(c,d) + 2*tb(c,d);
        //cout << " "<< bb << endl;
        if(aa < bb) swap(aa,bb);
        if((aa - bb) % 3 ==0) cout << "YES" << endl;
        else cout << "NO" << endl;
    }
    return 0;
}

Measured memory_bytes: 1664
from collections import defaultdict
n, *A = map(int, open(0).read().split())
d = defaultdict(int)
for a in A:
    d[a] += 1
s = 0
for v in d.values():
    s += v*(v-1)//2
for a in A:
    print(s-d[a]*(d[a]-1)//2+(d[a]-1)*(d[a]-2)//2)

Measured memory_bytes: 25924
#include <cstdio>
#include <algorithm>

using namespace std;

int main(){
  int N;
  int L[11];
  scanf("%d", &N);
  for(int i=0; i < N; i++){
    scanf("%d", L+i);
  }
  sort(L, L+N);
  int s = 0;
  for(int i=0; i < N-1; i++){
    s += L[i];
  }
  if(L[N-1] < s){
    printf("Yes\n");
  }else{
    printf("No\n");
  }
  
  return 0;
}


Measured memory_bytes: 128
#include<cstdio>
#include<cmath>
#include<iostream>
#include<cstring>
using namespace std;
int n,m,base;
int main(){
	cin>>n>>m;
	for(int i=n;i<=sqrt(m);i++){
		if(m%i==0)
        {
          if(i<n) continue;
          printf("%d",m/i);
          return 0;
        }
    }
	for(int i=sqrt(m);i>=1;i--){
		if(m%i==0)
        {
          if(m/i<n)continue;
            printf("%d",i);
          	return 0;
        }
    }
     return 0;
}


Measured memory_bytes: 256
N = int(input())
t = list(map(int,input().split()))
vlist = list(map(int,input().split()))
import numpy as np
t = np.cumsum(np.array(t))
T = t[-1]
def line(tl,tr,v):
    leq = np.arange(2*T+1)/2
    leq[:2*tl+1] *= -1
    leq[:2*tl+1] += tl
    leq[2*tl+1:2*tr+1] *= 0
    leq[2*tr+1:] -= tr
    leq += v
    return leq

f = np.zeros((N+2)*(2*T+1)).reshape((N+2,2*T+1))
for i in range(N):
    if i != 0:
        tl = t[i-1]
    else:
        tl = 0
    tr = t[i]
    v = vlist[i]
    f[i] = line(tl,tr,v)
f[N]=line(0,0,0)
f[N+1]=line(T,T,0)
v = f.min(0)

ans = 0
for i in range(len(v)-1):
    ans += v[i]+v[i+1]
ans *= 0.25
print(ans)

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

int main(){
  int N;
  cin>>N;
  int a[N+1][3];
  int dp[N+1][3];
  
  for (int i=0;i<N;i++){
    for(int j=0;j<3;j++){
      cin>>a[i][j];
      dp[i][j]=0;
    }
  }
  dp[N][0]=0;
  dp[N][1]=0;
  dp[N][2]=0;
  
  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;
        }
        dp[i+1][k]=max(dp[i+1][k],dp[i][j]+a[i][k]);
      }
    }
  }
  
  cout<<max(max(dp[N][0],dp[N][1]),dp[N][2])<<endl;
  return 0;
}

    

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

public class Main {

	public static void main(String[] args) throws IOException{

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int value = 100000;
		int count = Integer.parseInt(br.readLine());
		
		for (int i = 0; i < count; i++) {
			value *= 1.05;
			if(value % 1000 == 0){
				value /= 1000;
				value *= 1000;
			}else{
				value /= 1000;
				value++;
				value *= 1000;
			}
		}
		System.out.println(value);
	}
}

Measured memory_bytes: 16872
/*
AizuOnline A0022
Maximum Sum Sequence
*/
#include <stdio.h>

long long x;

int log3(long long x)
{
  return(log3_a(x,0,1LL));
}
int log3_a(long long x,int a,long long b)
{
  // printf("%lld:%d:%lld\n",x,a,b); 

  if(x <= b)return(a);
  return(log3_a(x,a+1,b*3));
}

main()
{
  while(EOF != scanf("%lld",&x))
    {
      printf("%d\n",log3(x));
    }

return(0);
}

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

x = [0] * N
y = [0] * N
h = [0] * N
for i in range(N):
    x[i], y[i], h[i] = map(int, input().split())

C_x = C_y = H = 0


for i in range(N):
    for c_x in range(101):
        for c_y in range(101):
            H = h[i] + abs(x[i] - c_x) + abs(y[i] - c_y)

            for j in range(N):
                if h[j] == max(H - abs(x[j] - c_x) - abs(y[j] - c_y), 0):
                    continue
                break

            else:
                C_x = c_x
                C_y = c_y
                break
            continue
        else:
            continue
        break
    else:
        continue
    break

else:
    print('No!')

print(C_x, C_y, H)



Measured memory_bytes: 3064
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<stdio.h>

#define rep(i,a,n) for(int (i)=(a);(i)<(n);(i)++)
#define rrep(i,a,n) for(int (i)=(a);(i)>=(n);(i)--)

#define INF 1000000000
#define MOD 1000000007

typedef  long long ll;

using namespace std;


void ys(){
    cout << "Yes" << endl;
}

void yb(){
    cout << "YES" << endl;
}

void ns(){
    cout << "No" << endl;
}

void nb(){
    cout << "NO" << endl;
}

void solve(void){
    int n;
    cin  >> n;
    for(int i = 0;i <= n/4;i++){
        for(int j= 0;j <= n/7;j++){
            if(4*i+7*j == n){
                ys();
                return;
            }
        }
    }
    ns();
}


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


Measured memory_bytes: 384
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.Reader;
import java.util.Arrays;

public class Main {

	static FastScanner sc = new FastScanner();

	public static void main(String[] args) throws Exception {
		int[] hist = new int[256];
		while (true) {
			int N = sc.nextInt();
			if (N == 0) break;
			int[] I = new int[N];
			for (int i = 0; i < N; ++i) {
				I[i] = sc.nextInt();
			}
			double best = Double.MAX_VALUE;
			int bs = 0;
			int ba = 0;
			int bc = 0;
			for (int s = 0; s < 16; ++s) {
				for (int a = 0; a < 16; ++a) {
					for (int c = 0; c < 16; ++c) {
						Arrays.fill(hist, 0);
						int r = s;
						for (int i = 0; i < N; ++i) {
							r = (a * r + c) & 0xFF;
							hist[(I[i] + r) & 0xFF]++;
						}
						double e = 0;
						for (int i = 0; i < 256; ++i) {
							if (hist[i] != 0) {
								double v = 1.0 * hist[i] / N;
								e -= v * Math.log(v);
								if (e >= best) break;
							}
						}
						if (e < best - 1e-10) {
							best = e;
							bs = s;
							ba = a;
							bc = c;
						}
					}
				}
			}
			System.out.println(bs + " " + ba + " " + bc);
		}
	}

	static class FastScanner {
		Reader input;

		FastScanner() {
			this.input = new BufferedReader(new InputStreamReader(System.in));
		}

		int nextInt() throws IOException {
			int sign = 1;
			int b = input.read();
			while ((b < '0' || '9' < b) && b != '-' && b != '+') {
				b = input.read();
			}
			if (b == '-') {
				sign = -1;
				b = input.read();
			} else if (b == '+') {
				b = input.read();
			}
			int ret = b - '0';
			while (true) {
				b = input.read();
				if (b < '0' || '9' < b) return ret * sign;
				ret *= 10;
				ret += b - '0';
			}
		}
	}

}

Measured memory_bytes: 21328
#include <iostream>
#include <algorithm>
#include <fstream>
#include <vector>
#include <deque>
#include <assert.h>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <stdio.h>
#include <string.h>
#include <utility>
#include <math.h>
#include <bitset>
#include <iomanip>
#include <complex>
#include <ios>
#include <iomanip>
using namespace std;
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define IDX(vec, element_iter) distance((vec).begin(), element_iter)
#define print(x) cout<<(x)<<'\n'
#define print_vec(v) rep(i,v.size()){if(i!=0)cout<<" ";cout<<v[i];}cout<<'\n'
#define pe(x) cout<<(x)<<" "
#define DEBUG(x) cout<<#x<<": "<<x<<'\n'
#define DEBUG_VEC(v) cout<<#v<<":";rep(i,v.size())cout<<" "<<v[i];cout<<'\n'
#define pb push_back
#define mp make_pair
#define MOD 1000000007 //10^9+7
#define fi first
#define sc second
using ll=long long;
using pi=pair<int,int>;
using pll=pair<ll,ll>;
using vi=vector<int>;
using vll=vector<ll>;
using vstr=vector<string>;

void solve() {
    int n,fib[50]; 
    cin >> n;
    fib[0] = 1;
    fib[1] = 1;
    rng(i,2,n+1){
        fib[i] = fib[i-1]+fib[i-2];
    }
    print(fib[n]);
}
 
int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
	cout<<fixed<<setprecision(20);
    //int q; cin >> q;
	//while (q--)
		solve();
    return 0;
}


Measured memory_bytes: 3184
#include <cstring>
#include <cstdio>
#include <vector>
#include <queue>
#include <algorithm>
#include <cmath>
#define MaxN 105
#define MaxL 3000005
#define eps 1e-14
using namespace std;

int N,W,Dif,Ans=0,Wei,V;
vector <pair<int,int>>lista;
int main()
{
	scanf("%d%d",&N,&W);
	for(int i=1;i<=N;i++)
	{
		scanf("%d%d",&Wei,&V);
		int X=lista.size();
		for(int j=0;j<X;j++)
		{
			if(Wei+lista[j].first<=W)
				lista.push_back(make_pair(lista[j].first+Wei,V+lista[j].second));
		}
		if(Wei<=W)lista.push_back(make_pair(Wei,V));
		sort(lista.begin(),lista.end());
		X=-1;
		for(int j=0;j<lista.size();j++)
		{
			if(X==-1||lista[j].first!=lista[X].first)
				lista[++X]=lista[j];
			else lista[X].second=max(lista[X].second,lista[j].second);
			Ans=max(lista[j].second,Ans);
		}
		while(lista.size()>X+1)
			lista.pop_back();
	}
	printf("%d",Ans);
	return 0;
}

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

typedef long long int ll;
ll MOD = 1000000007;
ll INFL = 1ll << 60;
ll INF = 1 << 30;
int dx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
int dy[8] = {1, 1, 0, -1, -1, -1, 0, 1};

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<long long> vll;
#define inf 999999
#define EPS (1e-7)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(a) a.begin(), a.end()
#define PB push_back
const ll MOD = 1e9 + 7;
const int MAX = 10000000;

int main(){
    int N;
    cin >> N;
    int a,b,c;
    a = N % 10;
    b = (N-a) / 10 % 10;
    c = (N - 10*b -a) / 100;
    // if(N.at(0) != '7' && N.at(1) != '7' && N.at(2) != '7'){
    //     cout << "No" << endl;
    // }else{
    //     cout << "Yes" << endl;
    // }
    if(a != 7 && b != 7 && c != 7){
        cout << "No" << endl;
    }else{
        cout << "Yes" << endl;
    }
}

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

using namespace std;

const int INF = 1e9 + 7;

int main(){
  string N_in;
  cin >> N_in;
  
  reverse(N_in.begin(), N_in.end());
  
  vector<int> N(N_in.size());
  for(int i = 0; i < N_in.size(); i++){
    N[i] = N_in[i] - '0';
  }
  
  long long ans = 0;
  int up = 0;
  for(int i = 0; i < N.size(); i++){
    int p = INF;
    N[i] += up;
    up = 0;
    p = 5 - abs(5 - N[i] % 10);
    if(N[i] % 10 >= 6){
      up = 1;
    }
    if(N[i] % 10 == 5){
      if(i + 1 < N.size() && N[i + 1] >= 5){
        up = 1;
      }
    }
    if(N[i] >= 10) up += 1;
    ans += p;
  }
  
  ans += up;
  
  cout << ans << endl;
  
  return 0;
}


Measured memory_bytes: 5252
L, R = gets.split.map &:to_i
MOD = 2019

upper = R / MOD * MOD
if upper.between?(L, R)
  p 0
  exit
end

a, b =  [*L..R].map{|n| n % MOD }.combination(2).min_by{|a, b|
  a * b % MOD
}
# p [a, b]
p a * b % MOD

Measured memory_bytes: 1788
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <math.h>

using namespace std;

#define x first
#define y second
#define vi vector<int>
#define pb push_back
#define mp make_pair
#define pii pair<int, int>
#define all(x) x.begin(),x.end()
#define SZ(x) int(x.size())
#define rep(i, a, b) for(int i = a; i < b; i++)
#define per(i, a, b) for(int i = b-1; i >= a; i--)
#define DBG(x) cerr << (#x) << "=" << x << "\n";
#define ll long long
#define inf 1000000007
#define mod 998244353//1000000007
#define N 41

template<typename U, typename V> void Min(U &a, const V & b){if(a > b)a = b;}
template<typename U, typename V> void Max(U &a, const V & b){if(a < b)a = b;}
template<typename U, typename V> void add(U &a, const V & b){a = (a + b) % mod;}
template<typename U> U gcd(U a, U b){
    if(a == 0)return b;
    if(b == 0)return a;
    if(a >= b)return gcd(a % b, b);
    else return gcd(a, b % a);
}
int pow(int a, int b){
    int ans = 1;
    while(b){
        if(b & 1)ans = 1LL * ans * a % mod;
        a = 1LL * a * a % mod;
        b >>= 1;
    }
    return ans;
}

char s[N];
ll dp[N][N][N];
int a[N][N];
int main(){
    int T, i, j, k, m, n, K;
    scanf("%d", &n);
    n <<= 1;
    rep(i, 0, n){
        scanf("%s", s);
        rep(j, 0, n)if(s[j] == '1')a[i][j] = 1;
    }
    rep(i, 0, n)dp[i][i][i] = 1;
    for(int L = 3; L <= n; L += 2){
        rep(i, 0, n){
            j = i + L - 1;
            if(j >= n)break;
            for(int l = i; l < j; l += 2){
                for(int r = j; r > l; r -= 2){
                    ll s = 0;
                    rep(x, i, l+1){
                        rep(y, r, j+1)if(a[x][y]){
                            s += dp[i][l][x] * dp[r][j][y];
                        }
                    }
                    rep(x, l+1, r)dp[i][j][x] += s * dp[l+1][r-1][x];
                }
            }
        }
    }
    ll ans = 0;
    rep(i, 1, n)if(a[0][i])ans += dp[1][n-1][i];
    printf("%lld\n", ans);
}


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

using namespace std;

int main(){

    int temp, status = 1;
    char letters[100];
    int alphabets[27] = { 0 };
    cin >> letters;

    for(int i = 0; i < strlen(letters); i++){
        temp = letters[i] - 96;
        alphabets[temp-1] += 1;
    }

    for(int i = 0; i < 26; i ++){
        if(alphabets[i] % 2 != 0){
            status = 0;
            break;
        }
    }

    if(status == 0){
        cout << "No" << endl;
    }
    else{
        cout << "Yes" << endl;
    }

    return 0;

}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;
int a[100005];
int main()
{
    int n,falg=0;
    scanf("%d",&n);
    for(int i=0; i<n; i++)
    {
        scanf("%d",&a[i]);
    }
    sort(a,a+n);
    long long m,p;
    for(int i=n-2; i>=0; i--)
    {
        if(a[i]==a[i+1]&&falg==0)
        {
            m=a[i];
            i--;
            falg++;
        }
        else if(a[i]==a[i+1]&&falg==1)
        {
            p=a[i];
            falg=2;
            break;
        }
    }
    if(falg!=2)
        printf("0\n");
    else
        printf("%lld",m*p);
    return 0;
}


Measured memory_bytes: 512
#include <iostream>
using namespace std;
 
int main()
{
 
	int a, b, c, d;
 
	cin >> a >> b >> c >> d; 
	if (  b <= c || a >= d ){
		cout << "0" << endl;
	}
	else {
		if ( b <= d && a <= c ) {
			cout << b-c << endl;
		}
		else {
			if ( c <= b && b <= d ) {
				cout << b-a << endl;
			}
			else {
				if (c >= a && b >= d ) {
					cout << d-c << endl;
				}
				else {
					cout << d-a << endl;
				}
			}
		}
	}	
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
typedef unsigned long long int ulli;
#define vec(s) vector
;
#define vvec(s) vector<vector
> ;
typedef vector<lli> vi;
typedef vector<vi> vvi;
typedef pair<lli,lli> pii;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define YN(x) cout<<(bool x?"Yes":"No")<<endl;
#define out(s) cout<<s<<endl;
#define pb(s) push_back(s);
#define sp " ";
#define INF 10000000000
#define all(s) s.begin(),s.end()
void vout(vector<int> v){
    for(int i=0;i<v.size();i++)
    cout<<v.at(i)<<endl;
}
int gcd(long long int x,long long int y){
    if(y==0) return x;
    return gcd(y,x%y);

}
int main(){
    lli n,x,ans;
    cin>>n>>x;
    rep(i,n){
        lli xi;
        cin>>xi;
        xi=abs(xi-x);
        if(i==0){
            ans=xi;
        }
        else{
            ans=gcd(xi,ans);
        }
    }
    out(ans);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(a,b) for(int a=0;a<(b);++a)
#define REP1(i,n) for(int i=1;i<=(n);++i)
#define debug(x) cerr<<#x<<": "<<x<<'\n'
#define all(x) (x).begin(),(x).end()
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define isYES(x) printf("%s\n",(x) ? "YES" : "NO")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define isYes(x) printf("%s\n",(x) ? "Yes" : "No")
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair
#define INF (1<<29)
#define Sp(p) cout<<setprecision(25)<< fixed<<p<<endl
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
#define X first
#define Y second
#define pie 3.14159265358979323846
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;


template<class T=int>
T in(){T x;cin>>x;return (x);}
template<class T>
void print(T& x){cout<<x<<'\n';}

const int MOD =(int)1e9+7;
const int mod =(int)1e9+7;
const int MAX =510000;
ll fac[MAX],finv[MAX],inv[MAX];
void COMint(){
    fac[0]=fac[1]=1;
    finv[0]=finv[1]=1;
    inv[1]=1;
    for(int i=2;i<MAX;i++){
        fac[i]=fac[i-1]*i%MOD;
        inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;
        finv[i]=finv[i-1]*inv[i]%MOD;
    }
}
ll COM(int n,int k){
    if(n<k) return 0;
    if(n<0||k<0)return 0;
    return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD;
}
ll gcd(ll a,ll b){
    if(b==0)return a;
    if(a>b){
        swap(a,b);
    }
    return gcd(a,b%a);
}
ll lcm(ll a,ll b){
    ll g;g=gcd(a,b);
    return a*b/g;
}
bool compare_by_b(pair<int, int> a, pair<int, int> b) {
    if(a.second != b.second){
        return a.second < b.second;
    }else{
        return a.first < b.first;
    }
}

bool compare_by_a(pair<int, int> a, pair<int, int> b) {
    if(a.first != b.first){
        return a.first < b.first;
    }else{
        return a.second < b.second;
    }
}
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

ll RS(ll N,ll P,ll M){
    if(P==0){
        return 1;
    }else{
        if(P%2==0){
            ll t=RS(N,P/2,M);
            return t*t%M;
        }else{
            return N*RS(N,P-1,M)%M;
        }
    }
}
bool greater_pair(pair<ll,ll> a,pair<ll,ll> b){
    if(a.first!=b.first){
        return a.first>b.first;
    }else{
        return a.second>b.second;
    }
}
int main() {
    ios::sync_with_stdio(false);
    int N=in();
    map<int,int> m;
    int ans=0;

    REP(i,N){
        int a=in();
        if(m.count(a)>0&&m[a]==1){
            m[a]=0;
            ans--; 
        }else{
            m[a]=1;
            ans++;
        }
    }
    cout<<ans<<endl;
    return 0;
}



Measured memory_bytes: 4992
#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>
#include <functional>
#include <queue>
#include <map>
#define REP(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}
 
template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
const int INF = 100000000;

int main(){
  int n, x, t;
  cin >> n >> x >> t;
  if(n % x == 0){
    cout << n/x*t << endl;
  }else{
    cout << (n/x + 1)*t << endl;
  }
}

Measured memory_bytes: 3640
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define sz(a) (a).size() 
#define all(c) (c).begin(),(c).end()
#define rep(i,n) for(int i=0;i<n;i++)
#define forn(i,n) for(int i=1;i<=n;i++)
#define ford(i,n) for(int i=n;i>=0;i--) 
#define REP(i,a,n) for(int i=a;i<n;i++)
#define foreach(c,itr) for(__typeof((c).begin(),(c).end())itr=c.begin();itr!=c.end();itr++) 
#define fill(a,b) memset(a,b,sizeof(a))
#define re return
#define INF 1e9
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pi;
typedef vector<int> vi;
typedef vector<pi > vpi; 
int main(){
	int n;
	cin>>n;
	string s;
	cin>>s;
	if(n%2==1){
		cout<<"No";
		re 0;
	}
	if(s.substr(0,n/2)==s.substr(n/2,n/2)){
		cout<<"Yes";
	}
	else{
		cout<<"No";
	}
	re 0;
}

Measured memory_bytes: 256
// use procontools::prelude::*;
use proconio::input;
macro_rules! p {
    ($x:expr) => {
        println!("{}", $x);
    };
}
fn main() {
    input! {
    k:i64,a:i64,b:i64
        }
    let mut c = 0;
    loop {
        c += k;
        if a <= c && c <= b {
            p!("OK");
            return;
        }
        if c > b {
            p!("NG");
            return;
        }
    }
}


Measured memory_bytes: 2140
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		int T = scan.nextInt();
		int[]c = new int[N];
		int[]t = new int[N];
		for(int i = 0; i < N; i++) {
			c[i] = scan.nextInt();
			t[i] = scan.nextInt();
		}
		scan.close();
		int min = Integer.MAX_VALUE;
		for(int i = 0; i < N; i++) {
			if(t[i] <= T) {
				min = Math.min(min, c[i]);
			}
		}
		if(min != Integer.MAX_VALUE) {
			System.out.println(min);
		}else {
			System.out.println("TLE");
		}
	}
}

Measured memory_bytes: 23508
#include <bits/stdc++.h>
#define cout16 cout << setprecision(16) 
#define rep(i,n) for(int i=0;i<n;i++ )
#define rep2(i,f,n) for(int i=f;i<n;i++ )
#define SORT(A) sort(A.begin(),A.end())
#define REV(A) reverse(A.begin(),A.end())
typedef long long int ll;
using vi = std::vector<int>;
using vvi = std::vector<std::vector<int>>;
using vll = std::vector<ll>;
using vvll = std::vector<std::vector<ll>>;
using P = std::pair<int,int>;
using vp = std::vector<P>;
using namespace std;
#define INF 1001001001
#define LL_INF 1001001001001001001
#define fi first
#define se second

int main(void) {
	int a,b; cin >> a >> b;
	rep(i,2000){
		int tax8 = int(i*0.08);
		int tax10 = int(i*0.1);
		if(tax8==a&&tax10==b){
			cout << i << endl;
			return 0;
		}
	}
	cout << -1 << endl;
}




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

using ll = long long;

int main() {
    int N;
    cin >> N;
    vector<int> v;
    int one = 0, zero = 0;
    for(int i = 0; i < N; ++i) {
        int a;
        cin >> a;
        if(a != 0 && a != 1) {
            v.push_back(a);
        }
        one += (a == 1);
        zero += (a == 0);
    }
    sort(v.begin(), v.end());
    vector<int> res;
    if(zero & 1) {
        for(int i = 0; i < zero - 1; ++i) {
            res.push_back(0);
        }
        if(one > 0) {
            res.push_back(1);
            one--;
        } else if(v.size() != 0) {
            res.push_back(*v.begin());
            v.erase(v.begin());
        }
        res.push_back(0);
        zero = 0;
    }
    for(int i = 0; i < zero; ++i) {
        res.push_back(0);
    }
    for(int i = 0; i < one; ++i) {
        res.push_back(1);
    }
    if(v.size() >= 2 && v.back() == 3 && v[v.size() - 2] == 2) {
        swap(v[v.size() - 1], v[v.size() - 2]);
    }
    res.insert(res.begin(), v.begin(), v.end());
    for(auto x : res) {
        cout << x << endl;
    }
}


Measured memory_bytes: 3148
n,m = map(int, input().split())

boxl = [1]*(n+1)
redl = [False]*(n+1)
redl[1] = True

for _ in range(m):
    x,y = map(int, input().split())
    if redl[x]:
        redl[y] = True
    if boxl[x] == 1:
        redl[x] = False
    boxl[x] -= 1
    boxl[y] += 1

ans = 0
for r in redl:
    if r: ans += 1

print(ans)

Measured memory_bytes: 76256
#include<bits/stdc++.h>
using namespace std;
int a[101];
int main()
{
	int n,k;
	scanf("%d %d",&n,&k);
	for(int i=1;i<=k;i++)
	{
		int d;
		scanf("%d",&d);
		for(int j=1;j<=d;j++)
		{
			int x;
			scanf("%d",&x);
			a[x]++;
		}
	}
	int ans=0;
	for(int i=1;i<=n;i++)
	if(!a[i])ans++;
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 3824
#include <bits/stdc++.h>
using namespace std;
 
int main () {
  int N, K;
  cin >> N >> K;
  vector<int> H(N);
  int64_t sum = 0;
  for (int i = 0; i < N; i++) {
    cin >> H.at(i);
    sum += H.at(i);
  }
  sort(H.begin(), H.end());
  reverse(H.begin(), H.end());
  int64_t sum2 = 0;
  if (K < N) {
    for (int i = 0; i < K; i++) {
      sum2 += H.at(i);
    } 
  }
  else {
    for (int i = 0; i < N; i++) {
      sum2 += H.at(i);
    } 
  }
  int64_t ans = sum - sum2; 
  cout << ans << endl;
}


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

using namespace std;

typedef long long LL;

inline char gc()
{
	static const int L = 23333;
	static char sxd[L], *sss = sxd, *ttt = sxd;
	if (sss == ttt)
	{
		ttt = (sss = sxd) + fread(sxd, 1, L, stdin);
		if (sss == ttt) return EOF;
	}
	return *sss++;
}

#ifdef ___my_computer
#define gc getchar
#endif

#define dd c = gc()
template <class T>
inline bool read(T& x)
{
	x = 0;
	register char dd;
	bool flag = false;
	for (; !isdigit(c); dd)
	{
		if(c == '-') flag = true;
		else if(c == EOF) return false;
	}
	for (; isdigit(c); dd)
		x = (x << 1) + (x << 3) + (c ^ 48);
	if (flag) x = -x;
	return true;
}
#undef dd

const int maxn = 100005;
const int mod = 3;

int n, m;

#define mo(x) \
{\
	if (x < 0) \
		x += mod; \
	else if (x >= mod) \
		x -= mod; \
}

bool vis[maxn];
int bh[maxn];

struct Edge
{
	int to, nxt, dist;
} e[maxn << 1];

int first[maxn];

inline void add_edge(int from, int to)
{
	static int cnt = 0;
	e[++cnt].nxt = first[from];
	first[from] = cnt;
	e[cnt].to = to;
	e[cnt].dist = 1;
	e[++cnt].nxt = first[to];
	first[to] = cnt;
	e[cnt].to = from;
	e[cnt].dist = -1;
}

int hv[3];
bool flag;
int edges;

inline void dfs(int now)
{
	vis[now] = true;
	hv[bh[now]]++;
//	cout << "now = " << now << endl;
	for (int i = first[now]; i; i = e[i].nxt)
	{
		edges++;
		register int to = e[i].to;
		register int tmp = bh[now] + e[i].dist;
		mo(tmp);
		if (!vis[to])
		{
			bh[to] = tmp;
			dfs(to);
		}
		else if (bh[to] != tmp)
			flag = false;
	}
}

LL ans = 0;

inline void getans(int root)
{
	hv[0] = hv[1] = hv[2] = 0;
	edges = 0;
	flag = true;
	dfs(root);
	if (!flag)
		ans += (LL) (hv[0] + hv[1] + hv[2]) * (hv[0] + hv[1] + hv[2]);
	else
	{
		if (hv[0] && hv[1] && hv[2])
			ans += (LL) hv[0] * hv[1] + (LL) hv[1] * hv[2] + (LL) hv[2] * hv[0];
		else
			ans += edges >> 1;
	}
}

int main()
{
	read(n), read(m);
	set<int> st;
	for (int i = 1, x, y; i <= m; ++i)
	{
		read(x), read(y);
		add_edge(x, y);
		st.insert(x);
		st.insert(y);
	}
	for (auto i : st)
		if (!vis[i])
			getans(i);
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 9856
# -*- coding: utf-8 -*-
import sys,copy,math,heapq,itertools as it,fractions,re,bisect,collections as coll
import random

N = int(raw_input())
t = [[".","."], [".", "#"], ["#", "."], ["#", "#"]]
s1, s2 = "", ""

left = True
for loop in xrange(421):
    random.shuffle(t)
    if left:
        for t1, t2 in t: 
            print "\n".join([s1 + t1, s2 + t2])
            sys.stdout.flush()
            res = raw_input()
            if res == "T":
                s1 += t1
                s2 += t2
                break
            if res == "end":
                exit()
        else:
            left = False

    if not left:
        for t1, t2 in t:
            print "\n".join([t1 + s1, t2 + s2])
            sys.stdout.flush()
            res = raw_input()
            if res == "T":
                s1 = t1 + s1
                s2 = t2 + s2
                break
            if res == "end":
                exit()


Measured memory_bytes: 5100
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

int main() {
	ll n,m;
	cin>>n>>m;
	if(2*n>m){
		cout << m/2;
		return 0;
	}
	else{
		cout << n+(m-2*n)/4;
	}
	return 0;
}

Measured memory_bytes: 256
a = int(input())
x = str(a)
aa = int(x[len(x)-1])

if aa in (2,4,5,7,9):
    print('hon')
    exit()
if aa in (0,1,6,8):
    print('pon')
    exit()
if aa == 3:
    print('bon')
    exit()

Measured memory_bytes: 9172
import java.util.*;

public class Main {

  public static void main (String[] args) {

    Scanner sc = new Scanner(System.in);
    
    int N = sc.nextInt();
    int M = sc.nextInt();
    int[] a = new int[N+1];

    for (int i = 0; i < M; i++) {
      int m = sc.nextInt();
      a[m] = 1;
    }

    sc.close();

    long[] dp = new long[N+1];
    
    long mod = 1000000007;

    dp[N] = 1;

    for (int i = N-1; 0 <= i ; i--) {
      if (a[i] == 1){
        dp[i] = 0;
      } else {
        if (i == N - 1){
          dp[i] = dp[N];
        } else if (N < i+2){
          dp[i] = (dp[i+1] + dp[N]) % mod;
        }else {
          dp[i] = (dp[i+1] + dp[i+2]) % mod;
        }
      }
    }

    System.out.println(dp[0]);
    
  }

}

Measured memory_bytes: 47224
n, k = map(int, input().split())
a = [0] + list(map(int, input().split()))

journey = [1]

for i in range(2 * n + 100):
    next = a[journey[-1]]
    journey.append(next)

if k < n+1:
    print(journey[k])
    exit()

loop_end = n

loop_start = n - 1

while (journey[loop_start] != journey[loop_end]):
    loop_start -= 1

period = loop_end - loop_start
k %= period

while k < n:
    k += period

print(journey[k])


Measured memory_bytes: 32352
defmodule Main do
  def main() do
    [n, a, b] =
      IO.gets("")
      |> String.trim()
      |> String.split()
      |> Enum.map(&String.to_integer/1)
    some_sum(n, a, b)
  end

  def some_sum(n, a, b) do
    1..n
    |> Enum.filter(&(a <= digits_sum(&1) and b >= digits_sum(&1)))
    |> Enum.sum()
    |> IO.puts()
  end

  def digits_sum(n) do
    Integer.to_string(n)
    |> String.codepoints()
    |> Enum.map(&(String.to_integer/1))
    |> Enum.sum()
  end
end


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

long long int m=1000000007;

long long int fermat(long long int base,long long int ex){
    long long int res=1;
    while(ex>0){
        if(ex%2==1){
            res=(res*base)%m;
        }
        base=(base*base)%m;
        ex=ex/2;
    }
    return res;
}

int main(){
	// your code goes here
	ios_base::sync_with_stdio(false); 
    cin.tie(NULL);
	cout.tie(NULL);
	
	long long int n;
	cin>>n;
	long long int i,j;
	long long int arr[n];
	map<long long int,long long int> hm;
	long long int count=0;
	for(i=0;i<n;i++){
	    cin>>arr[i];
	    long long int num=arr[i];
	    j=2;
	    count=0;
	    while(num%2==0){
	        count++;
	        num=num/2;
	    }
	    if(count>hm[j]){
	        hm[j]=count;
	    }
	    for(j=3;j<=sqrt(num);j=j+2){
	        count=0;
	        while(num%j==0){
	            count++;
	            num=num/j;
	        }
	        if(count>hm[j]){
	            hm[j]=count;
	        }
	    }
	    if(num>2){
	        if(hm[num]<1){
	            hm[num]=1;
	        }
	    }
	}
	long long int lcm=1;
	for(auto itr=hm.begin();itr!=hm.end();itr++){
	    long long int num=itr->first;
	    for(long long int k=0;k<(itr->second);k++){
	        lcm=(lcm*num)%m;
	    }
	}
	long long int sum=0;
	for(i=0;i<n;i++){
	   sum=(sum+((fermat(arr[i],m-2))*lcm)%m)%m;
	}
	cout<<sum;
	return 0;
}


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

char s[1010];

void c2s(long long c) {    // 将数值c转换成字符串s
    int i;
    long long t = 1;
    for (i = 0; t <= c; i++, t *= 26) {
        s[i] = 'a';
        c -= t;
    }
    s[i] = '\0';
    for (int i = 0; c > 0; i ++) {
        s[i] += c % 26;
        c /= 26;
    }
    i = 0;
    while (s[i]) i ++;
    while (i > 0) {
        i --;
        putchar(s[i]);
    }
}

int main() {
    long long c;
    cin >> c;
    c2s(c);
    // cout << s << endl;

    return 0;
}


Measured memory_bytes: 3632
def input_n
  gets.to_i               # 単一整数
end

def input_s
  gets.chomp              # 文字列。chompを付けないと改行文字がついてくる
end

def input_a
  gets.split.map(&:to_i)  # スペースで区切られた複数の整数
end

def input_o(num)
  num.times.map { gets.to_i }  # 縦に並んだ複数の整数。たまにある
end

def output_f(num)
  puts sprintf("%.12f", num)
end

a = input_s

if a.downcase == a
  puts "a"
else
  puts "A"
end


Measured memory_bytes: 14380
#include<bits/stdc++.h>
#define ll          long long int
#define ld          long double
#define pb          push_back
#define mp          make_pair
#define ff          first
#define se          second
#define endl        '\n'
#define fd(n)       fixed<<setprecision(n)
#define MAX         100000000000001
#define MAXN        400005
#define mod         1000000007
using namespace std;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n;
    cin>>n;
    cout<<3*n*n;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <vector>
#include <queue>
#include <string>
#include <limits>
#include <algorithm>
#include <map>
#include <sstream>

using ll = long long;
using ull = unsigned long long;
using uint = unsigned int;
static ull tenq = 1000000000;
static ull mod = tenq + 7;

using namespace std;

int main()
{
  ll N;
  cin >> N;
  vector<ll> as(N);
  for (auto i = 0; i < N; i++) {
    cin >> as[i];
  }
  sort(as.begin(), as.end());
  ll l, r;
  l = as[0];
  r = as[N-1];
  ll b, e;
  b = 1;
  e = N-2;
  ll res = abs(l - r);
  while (b <= e) {
    ll tmp = e;
    if (l > r) {
      tmp = l;
      l = r;
      r = tmp;
    }
    if (abs(l - as[e]) < abs(r - as[b])) {
      res += abs(r - as[b]);
      r = as[b];
      b++;
    } else {
      res += abs(l - as[e]);
      l = as[e];
      e--;
    }
  }

  cout << res << endl;

  return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define mod 1000000007
#define ll long long int
#define ar array
#define pb push_back
using namespace std;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	int a,b,c;
	cin>>a>>b>>c;
	cout<<(a^(b^c))<<endl;
	return 0;
}

Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)

	a := make([]int, n+1)
	for i := 0; i < n; i++ {
		fmt.Scan(&a[i])
	}


	kabu := 0
	cash := 1000

	for i := 0; i < n; i++ {
		if a[i] > a[i+1] {
			if kabu > 0 {
				// 売る
				cash += a[i] * kabu
				kabu = 0
			}
		} else {
			if kabu == 0 {
				// 買う
				kabu = cash / a[i]
				cash = cash % a[i]
			}
		}
	}
	fmt.Println(cash)

}


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

int main() {
	long long x;
	cin >> x;
	//x < [100 * 1.01]
	long long a = 100,c=0;
	while(a < x)
	{
		a *= 1.01;
		c++;
	}
	cout << c << endl;
	return 0;
}


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

vector<int> X;
vector<vector<bool>> Y;
int ans;

void dfs(int x) {
  if (X.at(x) != 1) return;
  int y = 1;
  while(!Y.at(x).at(y)) y++;
  X.at(x)--, X.at(y)--;
  Y.at(x).at(y) = Y.at(y).at(x) = 0;
  ans++;
  dfs(y);
}

int main() {
  int N, M;
  cin >> N >> M;
  X.resize(N + 1);
  Y.resize(N + 1, vector<bool>(N + 1));
  for (int i = 0; i < M; i++) {
    int a, b;
    cin >> a >> b;
    X.at(a)++, X.at(b)++;
    Y.at(a).at(b) = Y.at(b).at(a) = 1;
  }

  for (int i = 1; i <= N; i++) dfs(i);

  cout << ans << "\n";
}

Measured memory_bytes: 384
import Data.List
import Control.Applicative
import Control.Monad.Writer
import Data.Monoid

main = do
  getLine
  input <- map read . words <$> getContents
  let result = runWriter $ solve input
  putStrLn . intercalate " " . map show $ fst result
  putStrLn . show . getSum . snd $ result

myfunc :: [Int] -> (Int, [Int], Int)
myfunc (x:xs) = foldl func (x, [], 0) xs
  where func (m, xs, c) x = if x <= m
                              then (x, m:xs, c)
                              else (m, x:xs, c+1)

solve :: [Int] -> Writer (Sum Int) [Int]
solve [] = return []
solve xs = do
    let (h, ts, c) = myfunc $ reverse xs
    tell (Sum c)
    xs' <- solve ts
    return (h:xs')



Measured memory_bytes: 4240
#include<stdio.h>
#include <stdlib.h>

int main()
{
	int W , H, x, y , r ;
	scanf("%d %d %d %d %d",&W ,&H ,&x ,&y ,&r);
	if(x>=r && x<=W-r)
	{
		if(y>=r && y<=H-r)
		{
			printf("Yes\n");
			exit(0);
		}
		printf("No\n");
		
	}
	else
	{
		printf("No\n");
	}
	return 0;
}


Measured memory_bytes: 2080
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define All(V) V.begin(), V.end()
typedef long long int ll;
typedef pair<int, int> P;
const ll MOD = 1e9+7, INF = 1e9;

int main()
{
  int n; cin >> n;
  vector<ll> v(n);
  rep(i, n) cin >> v[i];
  vector<ll> sum_front(n+1, 0), sum_back(n+1, 0);
  for(int i = 0; i < n; i++){
    sum_front[i+1] = sum_front[i]+v[i];
    sum_back[i+1] = sum_back[i] + v[n-i-1];
  }
  ll ans = 1e10;
  for(int i = 1; i <= n-1; i++){
    ans = min(ans, abs(sum_front[i]-sum_back[n-i]));
  }
  cout << ans << endl;
  system("pause");
}

Measured memory_bytes: 5120
#include<stdio.h>
#include<algorithm>
using namespace std;
int gcd(int a,int b)
{
    return b>0?gcd(b,a%b):a;
}
int main()
{
    int k;
    scanf("%d",&k);
    int sum=0;
    for(int i=1;i<=k;i++)
    {
        for(int j=1;j<=k;j++)
        {
            for(int ii=1;ii<=k;ii++)
            {
                int g=gcd(i,j);
                sum+=gcd(g,ii);
            }
        }
    }
    printf("%d\n",sum);
    return 0;
}


Measured memory_bytes: 1732
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    x,n=map(int, input().split())
    l=list(map(int,input().split()))
    samin=1000
    ans=1000
    for i in range(102):
        if i not in l and abs(i-x)<samin:
            samin=abs(i-x)
            ans=i
    print(ans)
resolve()

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

using namespace std;

int main() {
  int A, B;
  char op;
  
  cin >> A >> op >> B;
  
  int x;
  if(op == '+')
    x = A + B;
  else if(op == '-')
    x = A - B;
  
  cout << x << endl;
}

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

int main(){
  ll N;
  cin>>N;
  vector<ll> A(N);
  for(ll i=0;i<N;i++){
    cin>>A.at(i);
    A.at(i)-=i;
  }
  sort(A.begin(),A.end());
  ll mid=A.at(N/2);
  ll ans=0;
  for(ll i=0;i<N;i++){
    ans+=abs(A.at(i)-mid);
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 4820