akhauriyash/Code-Regression huggingface dataset:
import java.util.*;
import java.io.*;

public class Main {	
	public static void main(String[] args) {
		FastScanner fs = new FastScanner();
		Map<String, Integer> map = new HashMap<>();
		int N = fs.nextInt();

		for(int i=0; i<N; i++){
			String s = fs.next();
			if (map.containsKey(s)) {		
				int tmp = map.get(s);		
				map.put(s, ++tmp);
			} else {
				map.put(s,1);
			}
		}

		int M = fs.nextInt();

		for(int i=0; i<M; i++){
			String t = fs.next();
			if (map.containsKey(t)) {		
				int tmp = map.get(t);		
				map.put(t, --tmp);
			} else {
				map.put(t,-1);
			}
		}

		int ans = 0;		
		for (String key : map.keySet()) {	
			ans = Math.max(ans,map.get(key));			
		}
		
		System.out.println(ans);

	}
	
	static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");

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

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

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

		public int[] readArray(int n) {
			int[] a=new int[n];
			for (int i=0; i<n; i++) {
				a[i]=nextInt();
			}
			return a;
		}

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

	}
	
}


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

int main(){
  int a, b;
  cin >> a >> b;
  cout << (a % 3 == 0 || b % 3 == 0 || (a+b) % 3 == 0 ? "Possible" : "Impossible") << endl; 
  return 0;
}

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

int main() {
    int K, N;
    cin >> K >> N;
    vector<int> home(N);
    rep(i, N) cin >> home.at(i);
    int maxv = 0;
    rep(i, N) {
        if(i == 0) {
            maxv = max(maxv, home[i] + K - home[N - 1]);
            continue;
        }
        if(i == N - 1) {
            break;
        }
        maxv = max(maxv, home[i + 1] - home[i]);
    }

    cout << K - maxv << endl;
}

Measured memory_bytes: 1024
#include<iostream>
#include<stdio.h> 
#include<algorithm>
#include<string.h>
#include<math.h>
#include<queue>
#include<map>
#include<stack>
#define go(i,a,b) for (int (i)=(a);(i)<=(b);(i)++)
#define ll long long
#define N 100005
#define INF 1000000005
using namespace std;

int x[N];
int ans,pos;
int main(){
	int n,k;
	scanf("%d%d",&n,&k);
	go(i,1,n){
		scanf("%d",&x[i]);
		if (x[i]==0){
			i--;
			n--;
			k--;
		}
	} 
	sort(x+1,x+1+n);
	if (k==0){
		printf("0");
	}
	else if (x[1]>0){
		printf("%d",x[k]);
	}
	else if (x[n]<0){
		printf("%d",-1*x[n-k+1]);
	}
	else{
		go(i,2,n){
			if (x[i-1]<0&&x[i]>0){
				pos=i;
				break;
			}
		}
		int ans=INF;
		for (int i=pos-1;i>=1;i--){
			if (pos-i>k) break;
			if (pos+(k-(pos-i))-1>n) continue;
			ans=min(ans,-1*x[i]*2+(pos-i==k?0:x[pos+(k-(pos-i))-1]));
		}
		for (int i=pos;i<=n;i++){
			if (i-pos+1>k) break;
			if (pos-(k-(i-pos+1))<1) continue;
			ans=min(ans,x[i]*2+(i-pos+1==k?0:(-1*x[pos-(k-(i-pos+1))])));
		}
		printf("%d",ans);
	}
}

Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <iomanip>
#include <random>
#include <cstdio>
#include <cmath>
#include <map>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (int) n; i++)

int main() {
    int m; cin >> m;
    cout << 48-m << endl;
    return 0;
}

Measured memory_bytes: 256
/* ***************************************
Author        :Scau.ion
Created Time  :2016/11/06 20:46:54 UTC+8
File Name     :ion.cpp
*************************************** */

#include <bits/stdc++.h>

#define LL long long
#define ULL unsigned long long
#define PB push_back
#define MP make_pair
#define PII pair<int,int>
#define VI vector<int>
#define VPII vector<PII>
#define X first
#define Y second
#define IOS ios::sync_with_stdio(0);cin.tie(0);
#define IN freopen("in", "r", stdin);
#define OUT freopen("out", "w", stdout);

using namespace std;

const int maxn=100010;

VI son[maxn];
bool vis[maxn];
int mi[maxn],ma[maxn];

int main()
{
    int n;
    cin>>n;
    for (int j=1;j<n;++j)
    {
        int u,v;
        cin>>u>>v;
        son[u].PB(v);
        son[v].PB(u);
    }
    int m;
    cin>>m;
    for (int j=1;j<=m;++j)
    {
        int v,p;
        cin>>v>>p;
        vis[v]=1;
        mi[v]=ma[v]=p;
    }
    queue<int> que;
    while(!que.empty()) que.pop();
    for (int j=1;j<=n;++j)
    {
        if (vis[j]) que.push(j);
    }
    bool flag=1;
    while(!que.empty())
    {
        int tis=que.front();
        que.pop();
        int nxmi=mi[tis]-1,nxma=ma[tis]+1;
        for (int j=0;j<son[tis].size();++j)
        {
            int nx=son[tis][j];
            if (vis[nx])
            {
                if (mi[nx]>nxma||ma[nx]<nxmi||ma[nx]%2!=nxma%2) flag=0;
                if (mi[nx]<nxmi||ma[nx]>nxma)
                {
                    mi[nx]=max(mi[nx],nxmi);
                    ma[nx]=min(ma[nx],nxma);
                    que.push(nx);
                }
            }
            else
            {
                vis[nx]=1;
                mi[nx]=nxmi;
                ma[nx]=nxma;
                que.push(nx);
            }
        }
    }
    if (!flag) cout<<"No\n";
    else
    {
        cout<<"Yes\n";
        for (int j=1;j<=n;++j)
            cout<<mi[j]<<"\n";
    }
    cout<<flush;
	return 0;
}


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

int main(){
    int H, W;  cin >> H >> W;
    vector<string> A(H);
    for(int i=0; i<H; i++) cin >> A[i];
    
    ll mod = 1e9+7;
    vector<vector<ll>> dp(H, vector<ll>(W,0));
    dp[0][0] = 1;
    for(int i=0; i<H; i++) for(int j=0; j<W; j++){
        if(A[i][j]=='#') continue;
        if(i>0) dp[i][j] = (dp[i][j] + dp[i-1][j])%mod;
        if(j>0) dp[i][j] = (dp[i][j] + dp[i][j-1])%mod;
    }
    cout << dp[H-1][W-1] << endl;
}


Measured memory_bytes: 9216
const Main = (input) => {
    array = input.split('\n')
    S = array.shift()
    // array.pop()
    // array = array[0].split(' ')
    // arrayInt = array.map(item => parseInt(item))
    console.log(F(S))
}


const F = (contest) => { result = ''
    if (contest == 'ABC') {
        result = 'ARC'
    } else {
        result = 'ABC'
    }
    return result
}

//*この行以降は編集しないでください（標準入出力から一度に読み込み、mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 29620
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <algorithm>
#include <utility>
typedef long long ll;
const int INF = 1e9+1;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;
using namespace std;

int main() {
	int a, b, c, x;
	int cnt = 0;
	cin >> a >> b >> c >> x;
	for (int i = 0; i <= a; i++) {
		for (int j = 0; j <= b; j++) {
			for (int k = 0; k <= c; k++) {
				if (500 * i + 100 * j + 50 * k == x)cnt++;
			}
		}
	}
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 3556
S = input()
import collections
li = [i for i in S]
d = collections.Counter(li)
li_uniq = list(set(li))
ans = "No"
if len(li_uniq) == 2:
    if d[li_uniq[0]] == 2:
        if d[li_uniq[1]] == 2:
            ans = "Yes"
print(ans)

Measured memory_bytes: 38384
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */

public class Main {
    public static void main(String[] args) {
        InputStream    inputStream    = System.in;
        OutputStream outputStream = System.out;
        InputReader    in                      = new InputReader(inputStream);
        PrintWriter     out                    = new PrintWriter(outputStream);
        TaskA             solver                = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            String s = in.next();
            s = s.replace("2017", "2018");
            out.println(s);
        }
    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

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

    }
}



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

#define mod      1e9+7;
#define INF      1e9+9;
#define ps(x,y)  fixed<<setprecision(y)<<x
# define PI 3.14159265358979323846264338327950 L
typedef long long ll;
typedef unsigned long long ull;
int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
#endif
	int n;
	cin>>n;
	int mn;
	ll sum=0;
	for(int i=1;i<=n;i++){
		for(int j=1;j<=n;j++){
			int nn=__gcd(i,j);
			for(int k=1;k<=n;k++){
				//cout<<nn<<" ";
				mn=__gcd(nn,k);
				//cout<<i<<" "<<j<<" "<<k<<" "<<mn<<endl;
				sum+=mn;	
			}
		}
	}
	cout<<sum<<endl;
	return 0;
}

Measured memory_bytes: 3612
#include <iostream>
#include <algorithm>
#include <vector>
#include <string.h>
#include <set>
#include <cassert>
using namespace std;
using lint = long long;
const long mod = 1e9 + 7;
#define all(x) (x).begin(), (x).end()
#define bitcount(n) __builtin_popcountl(long(n))
#define fcout cout << fixed << setprecision(15)
#define highest(x) (63 - __builtin_clzl(x))
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void POSS(T condition){ if(condition) cout << "POSSIBLE" << endl; else cout << "IMPOSSIBLE" << endl; }
template<class T> inline void Poss(T condition){ if(condition) cout << "Possible" << endl; else cout << "Impossible" << endl; }
template<class T> inline void First(T condition){ if(condition) cout << "First" << endl; else cout << "Second" << endl; }
template<class T = string, class U = char>int character_count(T text, U character){ int ans = 0; for(U i: text){ ans += (i == character); } return ans; }
long power(long base, long exponent, long module){ if(exponent % 2){ return power(base, exponent - 1, module) * base % module; }else if(exponent){ long root_ans = power(base, exponent / 2, module); return root_ans * root_ans % module; }else{ return 1; }}
struct position{ int y, x; }; position mv[4] = {{-1, 0}, {0, 1}, {1, 0}, {0, -1}}; // double euclidean(position first, position second){ return sqrt((second.x - first.x) * (second.x - first.x) + (second.y - first.y) * (second.y - first.y)); }
template<class T, class U> string to_string(pair<T, U> x){ return to_string(x.first) + "," + to_string(x.second); } string to_string(string x){ return x; }
template<class itr> void array_output(itr start, itr goal){ string ans; for(auto i = start; i != goal; i++) ans += to_string(*i) + " "; if(!ans.empty()) ans.pop_back(); cout << ans << endl; }
template<class itr> void cins(itr start, itr goal){ for(auto i = start; i != goal; i++){ cin >> (*i); } }
template<class T> T gcd(T a, T b){ if(a && b){ return gcd(min(a, b), max(a, b) % min(a, b)); }else{ return a; }} template<class T> T lcm(T a, T b){ return a / gcd(a, b) * b; }
struct combination{ vector<long> fact, inv; combination(int sz) : fact(sz + 1), inv(sz + 1){ fact[0] = 1; for(int i = 1; i <= sz; i++){ fact[i] = fact[i - 1] * i % mod; } inv[sz] = power(fact[sz], mod - 2, mod); for(int i = sz - 1; i >= 0; i--){ inv[i] = inv[i + 1] * (i + 1) % mod; } } long C(int p, int q) const{ if(q < 0 || p < q) return 0; return (fact[p] * inv[q] % mod * inv[p - q] % mod); } };

int main(){
    int N, Q;
    cin >> N >> Q;
    string S;
    cin >> S;
    int sum[N];
    sum[0] = 0;
    for(int i = 0; i < N - 1; i++){
        sum[i + 1] = sum[i] + (S.substr(i, 2) == "AC");
    }
    for(int i = 0; i < Q; i++){
        int l, r;
        cin >> l >> r;
        cout << sum[r - 1] - sum[l - 1] << endl;
    }
}


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

#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define size_t unsigned long long
#define ll long long
#define rep(i,a) for(int i=0;i<(a);i++)
#define repr(i,a) for(int i=(int)(a)-1;i>=0;i--)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define FORR(i,a,b) for(int i=(int)(b)-1;i>=a;i--)
#define ALL(a) a.begin(), a.end()
using namespace std;
int si() { int x; scanf("%d", &x); return x; }
long long sl() { long long x; scanf("%lld", &x); return x; }
string ss() { string x; cin >> x; return x; }
void pi(int x) { printf("%d ", x); }
void pl(long long x) { printf("%lld ", x); }
void pd(double x) { printf("%.15f ", x); }
void ps(const string &s) { printf("%s ", s.c_str()); }
void br() { putchar('\n'); }

const ll MOD = 1e9 + 7;
const ll INF = 1e16 + 5;

struct mint {
    int n;
    mint(int n_ = 0) : n(n_) {}
};

mint operator+(mint a, mint b) { a.n += b.n; if (a.n >= MOD) a.n -= MOD; return a; }
mint operator-(mint a, mint b) { a.n -= b.n; if (a.n < 0) a.n += MOD; return a; }
mint operator*(mint a, mint b) { return (long long)a.n * b.n % MOD; }
mint &operator+=(mint &a, mint b) { return a = a + b; }
mint &operator-=(mint &a, mint b) { return a = a - b; }
mint &operator*=(mint &a, mint b) { return a = a * b; }

typedef pair<int, int> P;

const ll N = 1e5+5;
vector<ll> v[N];
ll n;
ll a,b,q;
ll dif[N];

int main () {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cin >> a >> b >> q;
  vector<ll> s(a),t(b),x(q);
  rep(i,a) {
    cin >> s[i];
  }
  rep(i,b) {
    cin >> t[i];
  }
  rep(i,q) {
    cin >> x[i];
  }
  rep(i,q) {
    auto ite1 = upper_bound(ALL(s), x[i]);
    auto ite2 = upper_bound(ALL(t), x[i]);
    dif[i] = INF;
    rep(k,2) rep(j,2) {
      ll d1 = INF, d2 = INF;
      if(ite1-k-s.begin() >= 0 && ite1-k-s.begin() < s.size() && ite2-j-t.begin() >= 0 && ite2-j-t.begin() < t.size()) {
        d1 = abs(*(ite1-k) - x[i]) + abs(*(ite1-k) - *(ite2-j));
        d2 = abs(*(ite2-j) - x[i]) + abs(*(ite1-k) - *(ite2-j));
      }
      // ll d1 = ite1 - k - s.end() >= 0 || ite2 - j - t.begin() < 0 ? INF : abs(*(ite1-k) - x[i]) + abs(*(ite1-k) - *(ite2-j));
      // ll d2 = (ite2 - j - t.end() >= 0 && ite2 - j - t.begin() < 0) || (ite1 - k - s.begin() < 0 && ite1 - k - s.end >= 0) ? INF : abs(*(ite2-j) - x[i]) + abs(*(ite1-k) - *(ite2-j));
      dif[i] = min({dif[i], d1, d2});
      // cout << ite2 - j - t.end() << "    ";
      // cout << i << " : " << k << " : " << j << " = " << d1 << " : " << d2 << " : " << dif[i] << endl;
    }
  }
  rep(i,q) cout << dif[i] << endl;
}


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

int main(){
  int A, B;
  cin >> A >> B;
  int N = min(A, B);
  int S = 1;
  int maxS = 1;
  while(S <= N){
    if(A % S == 0 && B % S == 0) maxS = S;
    S++;
  }
  cout << (ll)A * (ll)B / (ll)maxS << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include<cstdio>
using namespace std;
int main(void){
  int cards[4][13];
  
  for(int i=0;i<4;i++){
      for(int j=0;j<13;j++){
         cards[i][j]=0;
          }
   }
  int n;
  cin>>n;
  
  char a;
  int b;
  char moji[4]= {'S','H','C','D'};
  
  for(int i=1;i<=n;i++){
      cin>>a>>b;
      if(a=='S'){
          cards[0][b-1]=1;
      }
      if(a=='H'){
          cards[1][b-1]=1;
      }
       if(a=='C'){
          cards[2][b-1]=1;
      }
      if(a=='D'){
          cards[3][b-1]=1;
      }
  }

 for(int i=0;i<4;i++){
      for(int j=0;j<13;j++){
        if(cards[i][j]==0){
              cout<<moji[i]<<" "<<j+1<<endl;
          }
      
      }
 }
}





Measured memory_bytes: 3032
#include<iostream>
#include<math.h>
#include<string>
#include<algorithm>
using namespace std;

#define rep0(n) for(int i=0;i<n;i++)
#define rep(n) for(int i=1;i<=n;i++)

double const pi=3.1415926535;

int printint(int n){
	cout<<n<<endl;
	return 0;
}

int prints(string s){
	cout<<s<<endl;
	return 0;
}

int main(){
	int n;
	cin>>n;
	unsigned long long a[100];
	a[0]=2;
	a[1]=1;
	for(int i=2;i<=90;i++)a[i]=a[i-1]+a[i-2];
	cout<<a[n]<<endl;
	return 0;
}

Measured memory_bytes: 888
#include <algorithm>
#include <bitset>
#include <cassert>
#include <deque>
#include <fstream>
#include <iostream>
#include <map>
#include <math.h>
#include <memory>
#include <queue>
#include <sstream>
#include <stdio.h>
#include <string>
#include <vector>

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define POW(n) ((n) * (n))
#define ALL(a) (a).begin(), (a).end()
#define dump(v) (cerr << #v << ": " << v << endl)
#define cerr                                                                   \
  if (true)                                                                    \
  cerr

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<unsigned long long> vull;

// ll n = to_T<ll>("114514")
template <class T> T to_T(const string &s) {
  istringstream is(s);
  T res;
  is >> res;
  return res;
}
template <class T> string to_s(const T &a) {
  ostringstream os;
  os << a;
  return os.str();
}

void solve(long long N, vector<long long> a) {
  sort(ALL(a));
  cout << (a[N - 1] - a[0]) << endl;
}

int main() {
  ios::sync_with_stdio(false);
  long long N;
  cin >> N;
  vector<long long> a(N - 1 + 1);
  for (int i = 0; i <= N - 1; i++) {
    cin >> a[i];
  }
  solve(N, a);
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	int a, b;
	int ans;
	scanf("%d", &a);
	scanf("%d", &b);

	if (b %a == 0) {
		ans = a + b;
	}
	else {
		ans = b-a;
	}

	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
const int INF=1e9;

int u[100001],v[100001];

int main(){
    int a,b,m; cin >> a >> b >> m;
    int minA=INF,minB=INF;
    for(int i=0;i<a;i++){cin >> u[i]; minA=min(minA,u[i]);}
    for(int i=0;i<b;i++){cin >> v[i]; minB=min(minB,v[i]);}
    int ans=minA+minB;
    for(int i=0;i<m;i++){
        int x,y,c; cin >> x >> y >> c;
        ans=min(ans,u[x-1]+v[y-1]-c);
    }
    cout << ans << endl;
}

Measured memory_bytes: 1024
//Written by Zhu Zeqi
//Come on,baby
//Hack,please
#include<cmath>
#include<math.h>
#include<ctype.h>
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cerrno>
#include<cfloat>
#include<ciso646>
#include<climits>
#include<clocale>
#include<complex>
#include<csetjmp>
#include<csignal>
#include<cstdarg>
#include<cstddef>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<cwchar>
#include<cwctype>
#include<deque>
#include<exception>
#include<fstream>
#include<functional>
#include<iomanip>
#include<ios>
#include<iosfwd>
#include<iostream>
#include<istream>
#include<iterator>
#include<limits>
#include<list>
#include<locale>
#include<map>
#include<memory>
#include<new>
#include<numeric>
#include<ostream>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<stdexcept>
#include<streambuf>
#include<string>
#include<typeinfo>
#include<utility>
#include<valarray>
#include<vector>
#include<string.h>
#include<stdlib.h>
#include<stdio.h>
#define CLR(x) memset(x,0,sizeof x)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define pii pair<int,int>
#define vi vector<int>
#define MAX 1000000000000000000
#define MOD 1000000007
#define PI 3.141592653589793238462
#define INF 0x3f3f3f3f
typedef long long ll;
//orz yht
using namespace std;
string i_s(int x){
	if(x==0)
	return "0";
	string ret="";
	while(x){
		ret=ret+(char)(x%10+'0');
		x/=10;
	}
	reverse(ret.begin(),ret.end());
	return ret;
}
string add(string a,string b){
	if(a=="")
	a="0";
	if(b=="")
	b="0";
	if(a.length()<b.length())
	swap(a,b);
	while(b.length()<a.length()){
		b='0'+b;
	}
	for(int i=0;i<a.length();i++){
		a[i]=a[i]+(b[i]-'0');
	}
	bool big=false;
	for(int i=a.length()-1;i>=0;i--){
		if(big){
			a[i]++;
		}
		big=false;
		if(a[i]>'9'){
			a[i]=a[i]-10;
			big=true;
		}
	}
	if(big)
	a='1'+a;
	return a;
}
string mul(string a,string b){
	vector<int> va,vb;
	if(a=="0" || b=="0")
	return "0";
	string ans;
	for(int i=0;i<a.length();i++){
		va.push_back(a[i]-'0');
	}
	for(int i=0;i<b.length();i++){
		vb.push_back(b[i]-'0');
	}
	reverse(va.begin(),va.end());
	reverse(vb.begin(),vb.end());
	vector<int> res;
	res.clear();
	res.resize(1005);
	for(int i=0;i<a.length();i++){
		for(int j=0;j<b.length();j++){
			res[i+j]+=(va[i]*vb[j]);
		}
	}
	for(int i=0;i<1005;i++){
		if(res[i]>9){
			res[i+1]+=(res[i]/10);
			res[i]%=10;
		}
	}
	for(int i=0;i<1005;i++){
		ans+=(res[i]+'0');
	}
	reverse(ans.begin(),ans.end());
	int k=0;
	while(ans[k]=='0'){
		k++;
	}
	ans=ans.substr(k);
	return ans;
}
bool is_prime(int n){
	if(n<2)
    return false;
    for(int i=2;i*i<=n;i++)
    if(n%i==0)
    return false;
    return true;
}
int n; 
int main(){
	//freopen("input.in","r",stdin);
	//freopen("output.out","w",stdout);
	cin>>n;
	cout<<24+24-n;
	//system("pause");
	return 0;
}

Measured memory_bytes: 764
/*  ex4_3
    B30095    */
#include <stdio.h>

int calculateSnowDepth(int towerA, int towerB){
    int towerBNum = towerB - towerA;
    
    int towerBHeight = 0;
    for(int i = 1; i <= towerBNum; i++)
        towerBHeight += i;
    
    return towerBHeight - towerB;  // actual depth of snowfall
}
 
int main(void){
    int towerA, towerB;
    scanf("%d %d", &towerA, &towerB);  // visible height of tower A and B

    int snowFallDepth = calculateSnowDepth(towerA, towerB);
    printf("%d", snowFallDepth);

    return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<iomanip>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<string>
#include<algorithm>
#include<functional>
#include<math.h>
#include<unordered_set>
using namespace std;

const int MAX = 100001;


int main() {
	int N;
	int a[MAX];
	int table[MAX] = { 0 };
	int cnt = 0;

	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> a[i];
	}

	for (int i = 0; i < N; i++) {
		if (a[i] < MAX)table[a[i]]++;
		else cnt++;
	}

	for (int i = 0; i < MAX; i++) {
		if (table[i] > i)cnt += table[i] - i;
		else if (table[i] < i)cnt += table[i];
	}


	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 1024
import math
from functools import reduce


def gcd(*numbers):
    return reduce(math.gcd, numbers)


def gcd_list(numbers):
    return reduce(math.gcd, numbers)


def eratosthenes(n):
    D = [0]*(n+1)
    for i in range(2, n+1):
        if D[i] > 0:
            continue
        for j in range(i, n+1, i):
            D[j] = i
    return D


N = int(input())
A = list(map(int, input().split()))
D = eratosthenes(10**6+1)
# D = eratosthenes(max(A))
dic = {}
for i in A:
    while i != 1:
        if i in dic:
            dic[i] += 1
        else:
            dic[i] = 1
        i //= D[i]
isPairwise = True
for i in dic.items():
    if i[1] > 1:
        isPairwise = False
        break


def is_pairwise():
    used_primes = [False] * (10**6 + 1)
    for a in A:
        while a > 1:
            prime = D[a]
            while a % prime == 0:
                a //= prime
            if used_primes[prime]:
                return False
            used_primes[prime] = 1
    return True


# if isPairwise:
if is_pairwise():
    print("pairwise coprime")
elif gcd_list(A) == 1:
    print("setwise coprime")
else:
    print("not coprime")


Measured memory_bytes: 233572
n, k = map(int, input().split())

d = []
a = []

for i in range(k):
	d.append(int(input()))
	a.append(list(map(int, input().split())))

snk = [0]*n

for i in range(k):
	for j in range(d[i]):
		snk[a[i][j]-1] += 1

c = 0
for i in range(n):
	if snk[i] == 0:
		c += 1

print(c)

Measured memory_bytes: 9284
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi=vector<int>;
using vvi=vector<vi>;
using pii=pair<int,int>;
#define rep(i,n) for(int i=0;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define INF 1e9
#define EPS 1e-9
#define MOD (1e9+7)
void put(string d){}template<class H,class...T>void put(string d,H&h,T&...t){cout<<h;if(sizeof...(t))cout<<d;put(d,t...);}
template<class T>void puti(T&a,string d=" "){bool f=1;for(auto&_:a)cout<<(exchange(f,0)?"":d)<<_;cout<<endl;}
template<class T>void putii(T&a,string d=" "){for(auto&_:a)puti(_,d);}
constexpr int gcd(int a,int b){return b?gcd(b,a%b):a;}
constexpr int lcm(int a,int b){return a*b/gcd(a,b);}


int main(){
	int a,b;
	cin>>a>>b;
	cout<<gcd(a,b)<<endl;
	return 0;
}



Measured memory_bytes: 3088
n = int(input())
# a, p = list(map(int, input().split()))
# a = list(map(int, input().split()))
# S = [list(map(int, input().split())) for i in range(n)]
S = [list(input().split()) for i in range(n)]

for i, s in enumerate(S):
    s.append(i+1)

S = sorted(S, key=lambda x: int(x[1]), reverse=True)
S = sorted(S, key=lambda x: x[0], reverse=False)

for s, p, n in S:
    print(n)

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

int main() {
    long long N, K;
    cin >> N >> K;

    long long ans = 0;
    for (int b=K+1; b<=N; b++) {
        long long n = (N - b + 1) / b;
        ans += (b - K) * (n + 1);
        if (K == 0) ans -= 1;
        if (N >= (n+1)*b + K) {
            ans += N - ((n+1)*b+K) + 1;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class MainClass
{
	public const long Giri = 1000000007;

	public static void Main(string[] args)
	{
		int n = Console.ReadLine().ToInt();
		var h = Input().ToInt();
		
		int max = h.Max();
		long r = 0;
		for(int i = max; i >= 1; i--)
		{
			bool area = false;
			for(int j = 0; j < n+1; j++)
			{
				
				if(j < n && h[j] >= i)
				{
					area = true;
				}
				else if((j == n || h[j] < i) && area)
				{
					area = false;
					r++;
				}
			}
		}
		Console.WriteLine(r);
	}
	
	static long GCD(long a, long b)
	{
		var v = new[] { a, b };
		while (v[1] != 0) { v = new[] { v[1], v[0] % v[1] }; }
		return v[0];
	}
	public static string[] Input() { return Console.ReadLine().Split(' '); }
	public static int Clamp(int val, int max, int min = 0) { return Math.Min(max, Math.Max(min, val)); }
}

public static class Smarter
{
	public static int ToInt(this string str) { return int.Parse(str); }
	public static long ToLong(this string str) { return long.Parse(str); }
	public static int[] ToInt(this string[] str)
	{
		int[] r = new int[str.Length];
		for(int i = 0; i < str.Length; i++) r[i] = str[i].ToInt();
		return r;
	 }
	
}

Measured memory_bytes: 13268
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String {
            bytes
                .by_ref()
                .map(|r| r.unwrap() as char)
                .skip_while(|c| c.is_whitespace())
                .take_while(|c| !c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

use std::cmp::{min, max};

fn main() {
    input!{
        x: usize,
        a: usize
    }
    println!("{}", if x < a {0} else {10});
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> VI;

template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
#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 all(x) (x).begin(),(x).end()

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



int main() {
    vector<int> p(100001, 0);
    rep (i, 3, 100001) {
        if (is_prime(i) && is_prime((i + 1) / 2)) {
            p[i]++;
        }
        p[i] += p[i-1];
    }
    int q;
    cin >> q;
    rep (i, q) {
        int l, r;
        cin >> l >> r;
        cout << p[r] - p[l-1] << endl;
    }

}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define F first
#define S second
#define pb push_back
#define lth length
#define sz size
#define keyb GetAsyncKeyState
const int maxn=100003;
vector<int> g[maxn];
int N,M,d1[maxn],d2[maxn],dep,p1,p2;
inline void dfs1(int v,int p){
	if(v==1)dep=0;
	d1[v]=dep;dep++;
	for(int i=0;i<g[v].size();i++){
		if(g[v][i]!=p)dfs1(g[v][i],v);
	}dep--;return;
}
inline void dfs2(int v,int p){
	if(v==N)dep=0;
	d2[v]=dep;dep++;
	for(int i=0;i<g[v].size();i++){
		if(g[v][i]!=p)dfs2(g[v][i],v);
	}dep--;return;
}
signed main(){
	cin>>N;for(int i=1;i<N;i++){
		int x,y;cin>>x>>y;
		g[x].pb(y);g[y].pb(x);
	}dfs1(1,0);dfs2(N,0);
	for(int i=1;i<=N;i++){
		if(d1[i]<=d2[i])p1++;
		else p2++;
	}if(p1>p2)cout<<"Fennec\n";
	else cout<<"Snuke\n";
    return 0;
}


Measured memory_bytes: 8704
#include <iostream>
#include <string>
#include <algorithm>
#include <ctime>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cassert>
#include <bitset>
#include <list>
#include <cstdio>
#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <math.h>
#include <cmath>
#include <tuple>
#include <cassert>
#include <array>
#include <iomanip>

using namespace std;
using ll = long long;
using pii = pair<int, int>;
using ti = tuple<int, int, int>;

const double eps=1e-14;
const int mod = 1e9 + 7;
const int inf = ((1<<28));
const ll linf = (1LL<<58);

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin >> n;
    ll ans = 1;
    for(ll i=1; i<n+1; i++)
    {
        ans *= i;
        ans %= mod;
    }
    cout << ans << endl;
    return 0;
}


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

int main(){
  long N;
  cin >> N;
  
  long ans = 1000000000000;
  bool flag = false;
  
  if (N == 2) {
    cout << 1;
    return 0;
  }

  long i = 2;
  while (i * i <= N) {
    if (N % i == 0) {
      ans = min(ans, i + N / i - 2);
      flag = true;
    }
    i++;
  }
  
  if(flag) cout << ans;
  else cout << N - 1;
  
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int one = Main.findDigits(n);
        switch (one) {
        case 2:
        case 4:
        case 5:
        case 7:
        case 9:
            System.out.println("hon");
            break;
        case 0:
        case 1:
        case 6:
        case 8:
            System.out.println("pon");
            break;
        case 3:
            System.out.println("bon");
            break;
        }
        sc.close();
    }

    private static int findDigits(int n) {
        int rtn = n;
        while (n > 0) {
            rtn %= 10;
            n /= 10;
        }
        return rtn;
    }

}


Measured memory_bytes: 35512
package main

import (
  "fmt"
)

func main() {
  var output = "No"
  var n int
  fmt.Scan(&n)

  for i := 1; i < 10; i++ {
    for j := 1; j < 10; j++ {
      if n == i*j {
        output = "Yes"
        break
      }
    }
  }
  
  fmt.Println(output)
}

Measured memory_bytes: 512
#include <stdio.h>
#include <iostream>
#include <vector>
#include <list>
#include <cmath>
#include <fstream>
#include <algorithm>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <complex>
#include <iterator>
#include <cstdlib>
#include <cstring>
#include <sstream>

using namespace std;

#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) (EQ((a).real(),(b).real()) && EQ((a).imag(),(b).imag()))

typedef complex<double> P;
typedef long long ll;

const int MAX_SIZE = 10000;

void solve(){
    int n,k,t,u,v,l;
    cin>>n>>k>>t>>u>>v>>l;
    int d[1000];
    for(int i = 0; i < n; i++)
        cin>>d[i];
    d[n]=l;
    double sumS=0;
    int prvP=0;
    double left=0;
    for(int i = 0; i <= n; i++){
        int move=-prvP+d[i];
        // ±Ì£ðÅ«éÀèÁ¬µÄÊß·é
        double s=(double)move/v;
        if(s>left){
            sumS+=left;
            double leftDis=move-v*left;
            sumS+=(double)leftDis/u;
            left=0;
        }
        else{
            left-=s;
            sumS+=s;
        }
        if(i==n)
            break;
        // ¡Éñ¶ñðÇÁÅ«éÈç
        if(left<=k*t)
            left+=t;
        else{
            left=(k+1)*t;
        }
        prvP=d[i];
    }
    printf("%.8f\n",sumS);
}
int main(){
    solve();
    return 0;
}

Measured memory_bytes: 0
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque, OrderedDict
from copy import deepcopy
from fractions import gcd
from functools import lru_cache, reduce
from math import ceil, floor
from sys import setrecursionlimit

import heapq as hq
import itertools as its
import operator as op


# globals
inf = float('inf')
N = 0


def set_inputs():
    global N
    return


def main():
    setrecursionlimit(100000)
    set_inputs()
    # ----------MAIN----------
    a, p = get_li()
    print((a * 3 + p) // 2)
    return


def get_int():
    return int(input())


def get_float():
    return float(input())


def get_str():
    return input().strip()


def get_li():
    return [int(i) for i in input().split()]


def get_lf():
    return [float(f) for f in input().split()]


def get_lc():
    return list(input().strip())


def get_data(n, types, sep=None):
    if len(types) == 1:
        return [types[0](input().strip()) for _ in range(n)]
    return list(zip(*(
        [t(x) for t, x in zip(types, input().strip().split(sep=sep))]
        for _ in range(n)
    )))


if __name__ == '__main__':
    main()


Measured memory_bytes: 65516
n,m,q = map(int,input().split())
a = [0 for i in range(q)]
ans = 0
for i in range(q):
    a[i] = list(map(int,input().split()))
for i in range(1,m+1):
    for j in range(i,m+1):
        for k in range(j,m+1):
            for s in range(k,m+1):
                for p in range(s,m+1):
                    for l in range(p,m+1):
                        for e in range(l,m+1):
                            for u in range(e,m+1):
                                for v in range(u,m+1):
                                    b = [1,i,j,k,s,p,l,e,u,v]
                                    nn = 0
                                    for h in range(q):
                                        if b[a[h][1]-1] - b[a[h][0]-1] == a[h][2]:
                                            nn += a[h][3]
                                    ans = max(ans,nn)
print(ans)

Measured memory_bytes: 9272
#include <cstdio>
#include <cctype>
#include <utility>
#include <algorithm>
using namespace std;

#define gcu getchar_unlocked
#define pcu putchar_unlocked
#define _T template <typename T>
#define _HT template <typename H, typename... T>
#define _il inline
#define _in _il int in
#define _sc _il bool scan
_T T in(int c){T n=0;bool m=false;while(isspace(c)){c=gcu();}if(c=='-')m=true,c=gcu();
	do{n=10*n+(c-'0'),c=gcu();}while(c>='0');return m?-n:n;} //&&c<='9'
_in() {return in<int>(gcu());}
_T T scan(T &n){int c=gcu();return c==EOF?false:(n=in<T>(c),true);}
_sc(char &c){c=gcu();gcu();return c!=EOF;}
#ifdef _GLIBCXX_STRING
_sc(string &s){int c;s="";
	for(;;){c=gcu();if(c=='\n'||c==' ')return true;else if(c==EOF)return false;s+=c;}}
#endif
_HT _sc(H &h, T&&... t){return scan(h)&&scan(t...);}
#define _vo _il void out
#define _vl _il void outl
_vo(bool b) {pcu('0'+b);}
_vo(const char *s){while(*s)pcu(*s++);}
_vo(char c){pcu(c);}
#ifdef _GLIBCXX_STRING
_vo(string s){for(char c:s)pcu(c);}
#endif
_T _vo(T n){static char buf[20];char *p=buf;
	if(n<0)pcu('-'),n*=-1;if(!n)*p++='0';else while(n)*p++=n%10+'0',n/=10;
	while (p!=buf)pcu(*--p);}
_vl(){out('\n');}
#ifdef _GLIBCXX_VECTOR
_T _vo(vector<T> &v){for(T &x:v)out(&x == &v[0]?"":" "),out(x);outl();}
#endif
_HT _vo(H&& h, T&&... t){out(h);out(move(t)...);}
template <typename... T> _vl(T&&... t){out(move(t)...);outl();}

int main() {
	for (int a, b; scan(a, b);)
		outl(__gcd(a, b));
}


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

long long beki(long long n,long long k){
  long long t=1;
  for(long long i=0;i<k;i++){
    t=t*n;
  }
  return t;
}

int main(){
  long long a,k=0,s;
  scanf("%lld",&a);
  for(long long i=1;i<=50;i++){
    if(beki(2,i)>a){
      s=beki(2,i);
      break;
    }
  }  
  cout <<s-1;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define inf 0x3f3f3f3f
#define mod 
#define maxm 
#define maxn 
int a[310][310], b[310][310], d[310], v[310];
int main()
{
	int n, m, x;
	
	scanf("%d%d", &n, &m);
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m; j++) {
			scanf("%d", &a[i][j]);
		}
	}
	for (int i = 1; i <= m; i++) {
		v[i] = 1;
	}
	int ans = n + 1, ct = 0;
	while (1) {
		memset(d, 0, sizeof d);
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < m; j++) {
				if (v[a[i][j]]) {
					d[a[i][j]]++;
					break;
				}
			}
		}
		int mx = d[1];
		for (int i = 1; i <= m; i++) {
			if (d[i] > mx) {
				mx = d[i];
			}
		}
		for (int i = 1; i <= m; i++) {
			if (d[i] == mx) {
				v[i] = 0;
				ct++;
			}
		}
		if (ans > mx) {
			ans = mx;
		} 
		if (ct == m) break;
	}
	for (int i = 1; i <= m; i++) {
		if (v[i]) printf("%d ", i);
	}
	printf("%d\n", ans);
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
#define pb push_back
#define mp make_pair
#define ms memset
#define FOR(i, a, b) for(int i = a; i <= b; i++)
#define lower_bound lb
#define upper_bound ub

void setIO(string name){
    freopen((name + ".in").c_str(), "r", stdin);
    freopen((name + ".out").c_str(), "w", stdout);
    ios_base::sync_with_stdio(0);
}
int main()
{
    int D; cin >> D;
    int C[27]; FOR(i,1,26) cin >> C[i];
    int S[D+1][27];
    FOR(i,1,D){
        FOR(j,1,26) cin >> S[i][j];
    }
    int T[D+1]; FOR(i,1,D) cin >> T[i];
    int last[27];
    ll sat = 0;
    int M; cin >> M;
    FOR(_,1,M){
        int d, q; cin >> d >> q;
        T[d] = q;
        ms(last,0,sizeof(last));
        sat = 0;
        FOR(i,1,D){
            last[T[i]] = i;
            sat += S[i][T[i]];
            FOR(j,1,26) sat -= C[j] * (i - last[j]);
        }
        cout << sat << '\n';
    }
    return 0;
}

Measured memory_bytes: 3676
#include <stdio.h>

int x[45] = {1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181, 6765, 10946, 17711, 28657, 46368, 75025, 121393, 196418, 317811, 514229, 832040, 1346269, 2178309, 3524578, 5702887, 9227465, 14930352, 24157817, 39088169, 63245986, 102334155, 165580141, 267914296, 433494437, 701408733, 1134903170};

int main() {
    int n;
    scanf("%d", &n);
    printf("%d\n", x[n]);
}



Measured memory_bytes: 2092
#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()
{
    ll N;
    cin >> N;
    vector<ll> B(N - 1);
    rep(i, N - 1) cin >> B[i];
    // ll sum = max(B[0], B[N - 1]);
    ll sum = B[0] + B[N - 2];
    rep(i, N - 2) sum += min(B[i], B[i + 1]);
    cout << sum << endl;

    return 0;
}


Measured memory_bytes: 256
n,a,b,c,d = map(int,input().split())
s = input()
ng = '##'
if c < d:
    if (ng in s[b-1:d]) or (ng in s[a-1:c]):
        print('No')
    else:
        print('Yes')
else:
    if ('...' not in s[b-2:d+1]):
        print('No')
    else:
        print('Yes')

Measured memory_bytes: 3572
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
#define yn {puts("Yes");}else{puts("No");}
#define MAX_N 200005

int main() {
    int n, k, c;
    cin >> n >> k >> c;
    string s;
    cin >> s;
    int cnt = 0;
    rep(i,n){
        if(s[i] == 'o'){
            cnt++;
            i += c;
        }
    }
    if(cnt > k){
        cout << endl;
        return 0;
    }

    int l[k], r[k];
    cnt = 0;
    rep(i,n){
        if(s[i] == 'o'){
            l[cnt] = i;
            cnt++;
            i += c;
        }
    }
    cnt = k - 1;
    drep(i,n){
        if(s[i] == 'o'){
            r[cnt] = i;
            cnt--;
            i -= c;
        }
    }

    rep(i,k){
        if(l[i] == r[i]){
            cout << l[i] + 1 << endl;
        }
    }

    return 0;
}




Measured memory_bytes: 3332
# include "bits/stdc++.h"
using namespace std;
using LL = long long;
using ULL = unsigned long long;
const double PI = acos(-1);
template<class T>constexpr T INF() { return ::std::numeric_limits<T>::max(); }
template<class T>constexpr T HINF() { return INF<T>() / 2; }
template <typename T_char>T_char TL(T_char cX) { return tolower(cX); };
template <typename T_char>T_char TU(T_char cX) { return toupper(cX); };
const int vy[] = { -1, -1, -1, 0, 1, 1, 1, 0 }, vx[] = { -1, 0, 1, 1, 1, 0, -1, -1 };
const int dx[4] = { -1,0,1,0 }, dy[4] = { 0,-1,0,1 };
int popcnt(unsigned long long n) { int cnt = 0; for (int i = 0; i < 64; i++)if ((n >> i) & 1)cnt++; return cnt; }
int d_sum(LL n) { int ret = 0; while (n > 0) { ret += n % 10; n /= 10; }return ret; }
int d_cnt(LL n) { int ret = 0; while (n > 0) { ret++; n /= 10; }return ret; }
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; };
# define ALL(qpqpq)           (qpqpq).begin(),(qpqpq).end()
# define UNIQUE(wpwpw)        (wpwpw).erase(unique(ALL((wpwpw))),(wpwpw).end())
# define LOWER(epepe)         transform(ALL((epepe)),(epepe).begin(),TL<char>)
# define UPPER(rprpr)         transform(ALL((rprpr)),(rprpr).begin(),TU<char>)
# define FOR(i,tptpt,ypypy)   for(LL i=(tptpt);i<(ypypy);i++)
# define REP(i,upupu)         FOR(i,0,upupu)
# define INIT                 std::ios::sync_with_stdio(false);std::cin.tie(0)
# pragma warning(disable:4996)

int h, w, n;
int sa[202020];
vector<pair<int, int>>v;
int main() {
	cin >> h >> w >> n;
	int ans = h;
	REP(i, n) {
		int x, y;
		cin >> x >> y;
		v.emplace_back(make_pair(x, y));
	}
	sort(ALL(v));
	int num = 0;
	REP(i, v.size()) {
		if (v[i].first - v[i].second == num) {
			num++;
			sa[v[i].first] = num;
		}
	}
	for (int i = 1; i < 202020; i++) {
		if (sa[i] >= 1)continue;
		sa[i] = sa[i - 1];
	}
	REP(i, v.size()) {
		if (v[i].first - v[i].second >= sa[v[i].first])ans = min(ans, v[i].first - 1);
	}
	cout << ans << endl;
}

Measured memory_bytes: 2672
"""
    こんにちは。これはクシャルです
    
    Author : thekushalghosh (クシャル)
    Team   : CodeDiggers
 
    I prefer Python language over the C++ language :p :D
        
    Visit my website : thekushalghosh.github.io
"""
import sys,math,cmath,time
start_time = time.time()
##########################################################################
################# ---- THE ACTUAL CODE STARTS BELOW ---- #################

def solve():
    a,b = invr()
    print(len(set(prime_factors(math.gcd(a,b)))) + 1)
            
################## ---- THE ACTUAL CODE ENDS ABOVE ---- ##################
##########################################################################
 
def main():
    global tt
    if not ONLINE_JUDGE:
        sys.stdin = open("input.txt","r")
        sys.stdout = open("output.txt","w")
    t = 1
    for tt in range(t):
        solve()
    if not ONLINE_JUDGE:
        print("Time Elapsed :",time.time() - start_time,"seconds")
        sys.stdout.close()
    
#---------------------- USER DEFINED INPUT FUNCTIONS ----------------------#
def inp():
    return(int(input()))
def inlt():
    return(list(map(int,input().split())))
def insr():
    return(input().strip())
def invr():
    return(map(int,input().split()))
 
#------------------ USER DEFINED PROGRAMMING FUNCTIONS ------------------#
def counter(a):
    q = [0] * max(a)
    for i in range(len(a)):
        q[a[i] - 1] = q[a[i] - 1],1
    return(q)
 
def string_counter(a):
    q = [0] * 26
    for i in range(len(a)):
        q[ord(a[i]) - 97] = q[ord(a[i]) - 97],1
    return(q)

def factors(n):
    q = []
    for i in range(1,int(n ** 0.5) + 1):
        if n % i == 0: q.append(i); q.append(n // i)
    return(list(sorted(list(set(q)))))

def prime_factors(n):
    q = []
    while n % 2 == 0: q.append(2); n = n // 2
    for i in range(3,int(n ** 0.5) + 1,2):
        while n % i == 0: q.append(i); n = n // i
    if n > 2: q.append(n)
    return(list(sorted(q)))

#-----------------------------------------------------------------------#
        
ONLINE_JUDGE = __debug__
if ONLINE_JUDGE:
    input = sys.stdin.readline
main()

Measured memory_bytes: 64256