akhauriyash/Code-Regression huggingface dataset:
#include<map>
#include<set>
#include<list>
#include<cmath>
#include<queue>
#include<stack>
#include<cstdio>
#include<string>
#include<vector>
#include<complex>
#include<cstdlib>
#include<cstring>
#include<numeric>
#include<sstream>
#include<iostream>
#include<algorithm>
#include<functional>

#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,b,n) for(int i=b;i<n;i++)

using namespace std;

typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;

const int INF=1<<29;
const double EPS=1e-9;

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

int main(){
	int n;
	cin>>n;
	vector<pii> data;
	rep(i,n){
		int v,a;
		cin>>v>>a;
		data.push_back(pii(a,-v));
	}
	sort(data.begin(),data.end(),greater<pii>());
	int ans1 =data[0].first;
	int ans2 =-data[0].second;
	cout <<ans2<<" "<<ans1<<endl;
	return 0;
}

Measured memory_bytes: 1204
import java.util.*;
import java.io.*;
import java.lang.reflect.Array;

import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
 
public class Main{
    static final long mod=1000000007;
//    static int dx[]={-1,0,1,0};
//    static int dy[]={0,-1,0,1};

    public  static void main(String[] args)   throws Exception, IOException{        
        Reader sc = new Reader(System.in);
        //110110011
        PrintWriter out=new PrintWriter(System.out);
        // int n=sc.nextInt();
        int n=sc.nextInt();
        int d[] = sc.nextIntArray(n);        
        int a[] = new int[n];
        int f=0;
        ArrayList<Integer> ls=new ArrayList<>();
        for (int i = 0; i <d.length; i++) {
        	ls.add(d[i]);
        }
        for (int i = 0; i <d.length; i++) {
			int id=-1;
			for (int t = 0; t < ls.size(); t++) {
				if(ls.get(t)==t+1 ) {id=t; }
			}
			if(id<0) {f++;break;}
			ls.remove(id);
			a[i]=id+1;
		}
        if(f>0)
        out.println(-1);
        else {
        	for (int i = 0; i < d.length; i++) {
				out.println(a[d.length-i-1]);
			}
        }
        out.flush();
    }



    static boolean validpos(int x,int y,int r, int c){
        return x<r && 0<=x && y<c && 0<=y;
    }

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

//class P {
//    int id, d;
//    P(int  id, int d) {
//        this.id=id;
//        this.d=d;
//    }
//}

class P implements Comparable<P>{
    int id,T;
    P(int id, int T) {
        this.id=id;
        this.T=T;
    }
    public int compareTo(P p){
        return id-p.id; //des
    }
}

class Reader
{ 
    private BufferedReader x;
    private StringTokenizer st;
    
    public Reader(InputStream in)
    {
        x = new BufferedReader(new InputStreamReader(in));
        st = null;
    }
    public String nextString() throws IOException
    {
        while( st==null || !st.hasMoreTokens() )
            st = new StringTokenizer(x.readLine());
        return st.nextToken();
    }
    public int nextInt() throws IOException
    {
        return Integer.parseInt(nextString());
    }
    public int[] nextIntArray(int size) throws IOException{
    	int r[] = new int[size];
    	for (int i = 0; i < size; i++) {
			r[i] = this.nextInt(); 
		}
    	return r;
    }
    public long[] nextLongArray(int size) throws IOException{
    	long r[] = new long[size];
    	for (int i = 0; i < size; i++) {
			r[i] = this.nextLong(); 
		}
    	return r;
    }
    public long nextLong() throws IOException
    {
        return Long.parseLong(nextString());
    }
    public double nextDouble() throws IOException
    {
        return Double.parseDouble(nextString());
    }
}


Measured memory_bytes: 21332
#include<stdio.h>
#define N 501

static const int INFTY=(1<<21);
static const int WHITE=0;
static const int GRAY=1;
static const int BLACK=2;

int n,M[N][N];
int color[N],d[N],f[N],tt;

void dfs_visit(int u){
  int v;
  color[u]=GRAY;
  tt++;
  d[u]=tt;
  for(v=0;v<n;v++){
    if(M[u][v]==0)continue;
    if(color[v]==WHITE){
      dfs_visit(v);
    }
  }
  color[u]=BLACK;
  f[u]=++tt;
}

void dfs(){
  int i,u;
  for(i=0;i<n;i++)color[i]=WHITE;
  tt=0;
  for(u=0;u<n;u++){
    if(color[u]==WHITE)dfs_visit(u);
  }
  for(i=0;i<n;i++){
    printf("%d %d %d\n",i+1,d[i],f[i]);
  }
}

int main(){
  int u,k,v;
  int i,j;

  scanf("%d",&n);

  for(i=0;i<n;i++){
    for(j=0;j<n;j++)M[i][j]=0;
  }

  for(i=0;i<n;i++){
    scanf("%d %d",&u,&k);
    u--;
    for(j=0;j<k;j++){
      scanf("%d",&v);
      v--;
      M[u][v]=1;
    }
  }

  dfs();
  
  return 0;
}
 



Measured memory_bytes: 2056
import java.io.*;
import java.util.*;
//import java.util.Map.Entry;
//import java.util.stream.*;
//import java.math.*;

public class Main {

    public static int gcd(int a, int b) {
        return (b == 0) ? a : gcd(b, a % b);
    }

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

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int array[] = new int[n];
        int sum = 0;
        for (int i = 0; i < n; i++) {
            array[i] = sc.nextInt();
            sum += array[i];
        }
        if (sum % 10 == 0) {
            Arrays.sort(array);
            for (int i = 0; i < array.length; i++) {
                if (array[i] % 10 != 0) {
                    sum -= array[i];
                    break;
                }
            }
        }
        System.out.println(sum % 10 == 0 ? 0 : sum);
        bw.flush();
    }
//==============================================//
//==============================================//
//==============================================//
//==============================================//
//==============================================//
//==============================================//
//==============================================//
//==============================================//

    static class Pair implements Comparable<Pair> {

        int a, b;

        public Pair(int x, int y) {
            a = x;
            b = y;
        }

        @Override
        public int compareTo(Pair p) {
            return a - p.a;
        }
    }

    static void forl_0(int n, int[] array, Scanner sc) {
        for (int i = 0; i < n; i++) {
            array[i] = sc.nextInt();
        }
    }

    static void forl_1(int n, int[] array, Scanner sc) {
        for (int i = 1; i <= n; i++) {
            array[i] = sc.nextInt();
        }
    }

    static void two_d(int n, int m, int[][] array, Scanner sc) {
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++) {
                array[i][j] = sc.nextInt();
            }
        }
    }

    static boolean isPrime(long n) {
        if (n < 2) {
            return false;
        } else if (n == 2 || n == 3) {
            return true;
        } else if (n % 2 == 0 || n % 3 == 0) {
            return false;
        }
        long sqrtN = (long) Math.sqrt(n) + 1;
        for (long i = 6L; i <= sqrtN; i += 6) {
            if (n % (i - 1) == 0 || n % (i + 1) == 0) {
                return false;
            }
        }
        return true;
    }
}


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

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

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

  int count = 0;
  while(a>=b) {b*=2; count++;}
  while(b>=c) {c*=2; count++;}

  if(count<=k) cout << "Yes";
  else cout << "No";
  
}

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

#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define vecp(p) int aa;cin>>aa;(p).push_back(aa);
#define vecpl(p) long long aa;cin>>aa;(p).push_back(aa);
#define vecps(p) string aa;cin>>aa;(p).push_back(aa);
#define vecp2(p) cin>>aa;(p).push_back(aa);
#define vecpl2(p) long long a	b;cin>>ab;(p).push_back(ab);
#define vecps2(p) string ab;cin>>ab;(p).push_back(ab);
#define set0(k,n) for(int nn=0;nn<(n);nn++){ (k).push_back(0); }
#define sorts(c) sort((c).begin(),(c).end());
#define reverses(c) reverse((c).begin(),(c).end());
#define vec(b) vector<int> (b);
#define vecl(b) vector<long long> (b);
#define vecs(b) vector<string> (b);
#define vecsize(b,size) vector<int> (b)((size));
#define pb(b,a) (b).push_back((a));
#define doublece(a,b) cout<<(a)<<' '<<(b)<<endl;
#define pairs(s) vector<pair<int,int>> (s);
#define pairsl(s) vector<pair<ll,ll>> (s);
#define pairss(s) vector<pair<string,string>> (s);
#define pairsp(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairspl(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairsps(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairsREV(s) (s).push_back(make_pair(bb,aa));
#define pairslREV(s) (s).push_back(make_pair(bb,aa));
#define pairssREV(s) (s).push_back(make_pair(bb,aa));
#define MOD 1000000007

int N;
string S;

string check(string s1) {

	for (int x = 1; x < N - 1; x++) {
		if (S[x] == 'o') {
			if (s1[x] == 'W') {
				if (s1[x - 1] == 'W') {
					s1 += "S";
				}
				else {
					s1 += "W";
				}
			}
			else {
				s1 += s1[x - 1];
			}
		}
		else {
			if (s1[x] == 'W') {
				s1 += s1[x - 1];
			}
			else {
				if (s1[x - 1] == 'W') {
					s1 += "S";
				}
				else {
					s1 += "W";
				}
			}
		}
	}

	if (S[0] == 'o') {
		if (s1[0]=='W') {
			if (s1[1]==s1[N-1]) {
				return "";
			}
		}
		else {
			if (s1[1] != s1[N - 1]) {
				return "";
			}
		}
	}
	else {
		if (s1[0] == 'S') {
			if (s1[1] == s1[N - 1]) {
				return "";
			}
		}
		else {
			if (s1[1] != s1[N - 1]) {
				return "";
			}
		}
	}

	if (S[N-1] == 'o') {
		if (s1[N-1] == 'W') {
			if (s1[0] == s1[N - 2]) {
				return "";
			}
		}
		else {
			if (s1[0] != s1[N - 2]) {
				return "";
			}
		}
	}
	else {
		if (s1[N-1] == 'S') {
			if (s1[0] == s1[N - 2]) {
				return "";
			}
		}
		else {
			if (s1[0] != s1[N - 2]) {
				return "";
			}
		}
	}
	return s1;
}

int main()
{

	cin >> N >> S;
	string s1="WW", s2="SW",s3="SS",s4="WS";
	string T[4] = { "WW",  "SW", "SS", "WS" };
	bool flag = true;
	fx(4) {
		string t = check(T[x]);
		if (t!="") {
			ce(t)
				flag = false;
			break;
		}
	}

	if (flag) {
		ce(-1)
	}

    return 0;
}



Measured memory_bytes: 776
#!/usr/bin/env python3

from copy import deepcopy

ABMAX = 400
HUGE = 10 ** 12

def main():
    n, ma, mb = map(int, input().split())
    sold = []
    for i in range(n):
        a, b, c = map(int, input().split())
        sold.append((a, b, c))
    mincost = dp(sold, n)
    print(find_mincost(mincost, ma, mb))

def find_mincost(mincost, ma, mb):
    res = HUGE
    for mult in range(1, ABMAX):
        if ma * mult > ABMAX:
            break
        if mb * mult > ABMAX:
            break
        res = min(res, mincost[ma * mult][mb * mult])
    return -1 if res == HUGE else res

def dp(sold, n):
    # mincost[a][b]: Minimum cost of achieving a, b
    mincost = [[HUGE for b in range(ABMAX + 1)] for a in range(ABMAX + 1)]
    mincost[0][0] = 0
    for a, b, c in sold:
        mincost = update(mincost, a, b, c)
    return mincost

def update(prevcost, a, b, c):
    mincost = deepcopy(prevcost)
    for ia in range(ABMAX + 1):  # 配る
        for ib in range(ABMAX + 1):
            na = ia + a
            nb = ib + b
            if na <= ABMAX and nb <= ABMAX:
                mincost[na][nb] = min(mincost[na][nb], prevcost[ia][ib] + c)
    return mincost

main()


Measured memory_bytes: 107996
use std::io::*;
use std::str::FromStr;

//https://qiita.com/tubo28/items/e6076e9040da57368845
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}
fn main(){
    let n: usize = read();
    let a:Vec<i64> = (0..n).map(|_| read()).collect();
    let mut x = a[0];
    let mut y:i64 = a.iter().skip(1).sum();
    let mut ans = (x-y).abs(); 

    if n == 2 {
        println!("{}",ans);
        return;
    }

    for i in 1..n-1 {
        x += a[i];
        y -= a[i];
        ans = std::cmp::min(ans,(x-y).abs());
    }
    println!("{}",ans);
}


Measured memory_bytes: 6396
#include <bits/stdc++.h>
template<class T> inline bool chmin(T&a, T b){if(a > b){a = b; return true;}else{return false;}}
template<class T> inline bool chmax(T&a, T b){if(a < b){a = b; return true;}else{return false;}}
#define ll long long
#define double long double
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define mod (ll)(1e9+7)
#define inf (ll)(3e18+7)
#define pi (double) acos(-1.0)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
using namespace std;

int main() {
    ll x, y, z, k;
    cin >> x >> y >> z >> k;
    vector<ll> a(x), b(y), c(z);
    rep(i, x)cin >> a[i];
    rep(i, y)cin >> b[i];
    rep(i, z)cin >> c[i];
    vector<ll> d, ans;
    rep(i, x)rep(j, y)d.push_back(a[i] + b[j]);
    sort(rall(d)); sort(rall(c));
    rep(i, min(x*y, k)){
        rep(j, min(z, k)){
            ans.push_back(d[i] + c[j]);
        }
    }
    sort(rall(ans));
    rep(i, k)cout << ans[i] << endl;
}


Measured memory_bytes: 43368
#include <cstdio>
#include <iostream>
#include <array>
#include <vector>
#include <algorithm>
#include <functional>
#include <tuple>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <queue>
#include <utility>
#include <memory>
#include <valarray>
#include <climits>

using namespace std;

using ll = long long int;

#define loop(i, N) for (int i = 0; i < N; ++i)
#define scanInt(x) int x; scanf("%d", &x); getchar();
#define scanLLInt(x) ll x; scanf("%lld", &x); getchar();
#define scanVecInt(A, N) vector<int> A(N); loop(i, N){scanf("%d", &(A[i])); getchar();}
#define scanVecLLInt(A, N) vector<ll> A(N); loop(i, N){scanf("%lld", &(A[i])); getchar();}

int main()
{
    scanInt(N);
    scanLLInt(K);
    // vector<pair<int, int>> arr;
    map<int, ll> arr;
    loop(i, N){
        scanInt(ai);
        scanInt(bi);
        // arr.emplace_back(ai, bi);
        arr[ai] += bi;
    }
    // using p = pair<int, int>;
    // sort(arr.begin(), arr.end(), [](p& l, p& r){return l.first <= r.first;});
    ll count = 0;
    for (auto& e : arr){
        count += e.second;
        if (K <= count){
            printf("%d\n", e.first);
            return 0;
        }
    }
}


Measured memory_bytes: 4224
import unittest


class TestD(unittest.TestCase):
    def test_1(self):
        self.assertEqual(think(4, [-10, 8, 2, 1, 2, 6]), 14)

    def test_2(self):
        self.assertEqual(think(4, [-6, -100, 50, -2, -5, -3]), 44)

    def test_3(self):
        self.assertEqual(think(3, [-6, -100, 50, -2, -5, -3]), 0)


def solve():
    k, v = read()
    result = think(k, v)
    write(result)


def read():
    n, k = read_int(2)
    return k, read_int(n)


def read_int(n):
    return read_type(int, n)


def read_float(n):
    return read_type(float, n)


def read_type(t, n):
    return list(map(lambda x: t(x), read_line().split(' ')))[:n]


def read_line(n=0):
    if n == 0:
        return input().rstrip()
    else:
        return input().rstrip()[:n]


def think(k, v):
    max_value = -(10 ** 10)

    max_dequeue = min(len(v), k)
    for dequeue in range(max_dequeue + 1):
        max_enqueue = min(k - dequeue, dequeue)
        for left in range(dequeue + 1):
            dequeued_v = []
            right = dequeue - left
            dequeued_v += v[0:left]
            dequeued_v += [] if right == 0 else v[-right:]
            dequeued_v.sort()
            for i in range(max_enqueue + 1):
                max_value = max(max_value, sum(dequeued_v[i:]))
    return max_value


def write(result):
    print(result)


if __name__ == '__main__':
    # unittest.main()
    solve()

Measured memory_bytes: 6232
//
//  main.cpp
//  DPS2
#include <iostream>
#include <string>
#include <algorithm>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll=long long;
const int mod = 1e9 + 7;

int main() {
    string A;
    cin >> A;
    ll n = A.length();
    int d;
    cin >> d;
    int dp[10001][2][101]={}; // dp[桁][Aより小さいことが1:確定 0:未定][mod d]
    dp[0][0][0]=1;
    for(ll i=0;i<n;i++){
        rep (j, 2)rep(l,d) {
            int lim=9;
            if (j==0) lim=A[i]-'0';
            rep (now, lim + 1) {
                (dp[i + 1][j || now < lim][(l+now)%d] += dp[i][j][l])%=mod;
            }
        }
    }
    ll ans= -1;
    rep (j, 2)rep(l,d) if(l==0) (ans+=dp[n][j][l])%=mod;
    cout << (ans+mod)%mod << endl;
    return 0;
}


Measured memory_bytes: 11024
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int64_t gcdgcd(int64_t a,int64_t b) {
  if(a < b) return gcdgcd(b, a);
  int64_t r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}
int main(){
  int64_t a,b;
  cin >> a >> b;
  int64_t y=gcdgcd(a,b);
  int u=3;
  /*while(u<=250000){
    int c=0;
    for(int q: p){
      if(u%q==0){
        c=1;
        break;
      }
    }
    if(c==0)p.push_back(u);
    u++;
  } */ 
  int cnt=1;
  rep(i,1000000){
    int64_t q=i+2;
    if(y<=1)break;
    if(y%q==0){
      cnt++;
      while(y%q==0){
        y/=q;
      }
    }
  }
  if(y>1)cnt++;
  cout << cnt << endl;
}  


Measured memory_bytes: 256
#include<stdio.h>
#include <string.h>
#include<algorithm>
#include<math.h>
using namespace std;
int main(void){
long int N,ix,min_ix,i;
long int x;
scanf("%ld",&N);
min_ix=N+2;
for (i=1;i<=sqrt(N);i++){
		if(N%i==0){
			x=N/i;
			ix=i+x;
			if(min_ix>ix){
				min_ix=ix;
			}
		}
} 
	printf("%ld",min_ix-2);
}

Measured memory_bytes: 128
#include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
typedef long long i64;
typedef long double ld;
typedef pair<i64, i64> P;
#define rep(i, s, e) for (int i = (s); i <= (e); i++)
#include <iostream>
#include <queue>
#include <vector>
using namespace std;

using i64 = long long;

struct Graph {
  struct edge {
    int to;
    i64 cap;
    i64 rev;
  };

  int n;
  vector<vector<edge>> edges;

  Graph(int N) {
    n = N;
    edges.resize(n, vector<edge>());
  }

  int size() const { return n; }

  vector<edge> &operator[](int v) { return edges[v]; }
};

struct Dinic {
  int N;
  vector<int> level;
  vector<int> itr;
  Graph G;

  Dinic(int n) : G(n) { N = n; }

  void add_edge(int from, int to, int cap, int rev_cap) {
    G[from].push_back({to, cap, (int)G[to].size()});
    G[to].push_back({from, rev_cap, (int)G[from].size() - 1});
  }

  bool g_level(int s, int t) {
    level.assign(N, -1);
    queue<int> que;
    que.push(s);
    level[s] = 0;
    while (!que.empty()) {
      int v = que.front();
      que.pop();
      for (auto &e : G[v]) {
        if (e.cap > 0 && level[e.to] == -1) {
          level[e.to] = level[v] + 1;
          que.push(e.to);
        }
      }
    }
    return level[t] >= 0;
  }

  i64 dfs(int v, int t, i64 f) {
    if (v == t)
      return f;

    for (int &i = itr[v]; i < G[v].size(); i++) {
      auto &e = G[v][i];
      if (e.cap > 0 && level[e.to] > level[v]) {
        i64 mi_f = dfs(e.to, t, min(f, e.cap));
        if (mi_f > 0) {
          e.cap -= mi_f;
          G[e.to][e.rev].cap += mi_f;
          return mi_f;
        }
      }
    }
    return 0;
  }

  i64 max_flow(int s, int t) {
    i64 result = 0;
    i64 flow;
    while (g_level(s, t)) {
      itr.assign(N, 0);
      while ((flow = dfs(s, t, 1e9)) > 0)
        result += flow;
    }
    return result;
  }
};

/*

checked
    http://judge.u-aizu.ac.jp/onlinejudge/review.jsp?rid=2723921#1
*/

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

int m;
int n;

int main() {
  while (cin >> m >> n, n) {
    vector<int> a(m + 1), b(n + 1);
    rep(i, 1, m) { cin >> a[i]; }
    rep(i, 1, n) { cin >> b[i]; }
	Dinic din(m + n + 2);
	int s= 0;
	int t = m + n + 1;
	rep(i,1,m){
		din.add_edge(s, i, 1, 0);
	}
	rep(i,1,n){
		din.add_edge(i + m, t, 1, 0);
	}
	rep(i,1,m){
		rep(j,1,n){
			if(gcd(a[i],b[j]) > 1){
				din.add_edge(i, j + m, 1, 0);
			}
		}
	}

	cout << din.max_flow(s, t) << endl;
  }
}



Measured memory_bytes: 11284
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

const int N = 10000;

vector<int> prime;
bool is_prime[N+1];
int data[1230];

void sieve(){
  fill(is_prime, is_prime+N+1, true);
  is_prime[0] = is_prime[1] = false;
  for(int i=2;i<=N;i++){
    if(is_prime[i]){
      prime.push_back(i);
      for(int j=2*i;j<=N;j+=i) is_prime[j] = false;
    }
  }
}

void init(){
  fill(data, data+1230, 0);
  for(int i=0;i<prime.size();i++){
    data[i+1] = data[i] + prime[i];
  }
}

main(){
  sieve();
  init();
  int n;
  while(cin >> n && n){
    int l = 0, r = 1;
    int ans = 0;
    while(l < prime.size() && r <= prime.size()){
      int tmp = data[r] - data[l];
      if(tmp == n){
        ans++;
        l++;
      }else if(tmp < n){
        r++;
      }else if(tmp > n){
        l++;
      }
    }
    cout << ans << endl;
  }
}

Measured memory_bytes: 0
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
import resource
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub


sys.setrecursionlimit(10**6)
input = sys.stdin.readline
INF = 2**62-1


def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


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


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


class Mod:
    def __init__(self, m):
        self.m = m

    def add(self, a, b):
        return (a + b) % self.m

    def sub(self, a, b):
        return (a - b) % self.m

    def mul(self, a, b):
        return (a * b) % self.m

    def div(self, a, b):
        return self.mul(a, self.pow(b, self.m-2))

    @lru_cache(maxsize=None)
    def pow(self, a, b):
        return pow(a, b, self.m)


M = Mod(10**9 + 7)
m = 10**9 + 7
fact = [1] * (2 * (10**5) + 1)
fact_inv = [0] * (2 * (10**5) + 1)
for i in range(1, 2 * (10**5)+1):
    fact[i] = M.mul(fact[i-1], i)
    fact_inv[i] = pow(fact[i], m-2, m)


@mt
def slv(N, AB):
    g = defaultdict(list)
    for a, b in AB:
        g[a].append(b)
        g[b].append(a)

    memo = defaultdict(dict)

    def f(u, p, flag=False):
        if u in memo and p in memo[u]:
            return memo[u][p]
        r = 1
        n = 1
        if p == 0 or flag:
            for v in g[u]:
                if v == p:
                    continue
                n_, r_ = f(v, u, flag)
                n += n_
                r = M.mul(r, r_)
                r = M.mul(r, fact_inv[n_])
            r = M.mul(r, fact[n-1])
        else:
            np, rp = f(p, u, False)
            na, ra = f(u, 0, False)
            r = M.div(ra, rp)
            r = M.mul(r, fact[np])
            n = na - np
            r = M.mul(r, fact_inv[na-1])
            r = M.mul(r, fact[n-1])

        memo[u][p] = n, r
        return n, r

    f(1, 0, True)

    for i in range(1, N+1):
        print(f(i, 0, False)[1])


def main():
    N = read_int()
    AB = [read_int_n() for _ in range(N-1)]
    slv(N, AB)

    # N = (10**5) * 2
    # AB = [(_, _+1) for _ in range(N-1)]
    # (slv(N, AB))


if __name__ == '__main__':
    main()


Measured memory_bytes: 267908
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  string A;
  A = "Three";
  cin >> N;
  for (int i = 0; i < N; i++){
  string S;
  cin >> S;
  if (S == "Y"){
    A = "Four";
    break;
  }
  }
  cout << A;
}

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

int main()
{
  	string s;
  	cin >> s;
  	for (int i = 0; i < 19; i++) {
     	if (s[i] == ',') s[i] = ' ';
      	cout << s[i];
    }
  	cout << '\n';
 	return 0; 
}

Measured memory_bytes: 256
import sys
N = int(sys.stdin.readline().rstrip())
sec = []

for _ in range(N):
    x, l = map(int, sys.stdin.readline().rstrip().split())
    sec.append((x - l, x + l))

sec = sorted(sec, key=lambda x: x[1])
r = -10**10
ans = 0
for s, t in sec:
    if r <= s:
        ans += 1
        r = t
print(ans)

Measured memory_bytes: 19028
N = int(input())
R_L = []
for n in range(N):
    S,P = input().split()
    R_L.append([S,int(P)])

R_L2 = R_L.copy()
R_L2.sort( key=lambda x:(x[0],-x[1]))
for r in R_L2:
    print(R_L.index(r)+1)


Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <algorithm>

using namespace std;

int main()
{
    int N;
    cin>>N;
    vector<int> A(N);
    for (int &a: A)
        cin>>a;

    map<int, int> M;
    set<int> S;
    for (int a: A)
        M[a]++,
        S.insert(-a);

    int ans = 0;
    for (int s: S)
    {
        s = -s;
        int t;
        for (int i=2; ; i*=2)
        {
            if (i>s)
            {
                t = i-s;
                break;
            }
        }
        if (t==s)
            ans += M[s] / 2;
        else
        {
            if (M.count(t)>0)
            {
                int c = min(M[s], M[t]);
                ans += c;
                M[t] -= c;
            }
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 19840
#include <iostream>
#include <string>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <map>
#include <cmath>
#include <queue>
#include <utility>
#include <functional>
#include <deque>
#include <cctype>
#include <stack>
#include <bitset>

using ll = long long;
typedef unsigned long long ull;
using namespace std;
typedef pair<ll, ll>P;

const ll Z = 1000000007;
const ll INF = 1 << 30;
const ll INF2 = 9000000000000000000LL;
bool flag = true, fl = true;
int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
string abc = "abcdefghijklmnopqrstuvwxyz";
struct edge { ll to, cost; };
struct etree { ll from, to, cost; };
double pai = 3.141592653589793;
bool comp(const etree& e1, const etree& e2) {
	return e1.cost < e2.cost;
}
#define ALL(x) (x).begin(),(x).end()

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

int main() {
	ll n, x;
	cin >> n >> x;
	cout << 3 * (n - gcd(n, x)) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i < (n); i++)
template<class T> istream& operator >> (istream& s, vector<T>& v)
{ for (T& x: v) { s >> x; } return s;}

#define MOD 998244353

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

    ll ans = 0;

    vector<ll> fact(N);
    vector<ll> finv(fact.size());
    vector<ll> inv(fact.size());
    
    fact[0] = fact[1] = 1;
    finv[0] = finv[1] = 1;
    inv[0] = 0; inv[1] = 1;
    for (int i = 2; i < fact.size(); i++) {
        fact[i] = fact[i-1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }

    auto C = [&](ll n, ll r) {
        return fact[n] * finv[n-r] % MOD * finv[r] % MOD;
    };

    vector<int> mul(N);
    mul[0] = 1;
    for (int i = 1; i < mul.size(); i++) {
        mul[i] = (ll)mul[i-1] * (M-1) % MOD;
    }

    for (int x = 0; x <= K; x++) {
        int g = N - x;
        // ans = ans + M * (M-1)^(g-1)
        ans = (ans + (ll)M * mul[g-1] % MOD * C(N-1, x) % MOD) % MOD;
    }

    cout << ans << endl;
}


Measured memory_bytes: 8716
s=input()
a = list(map(int,input().split()))
x=len(a)
f=0
for k in range(1000000000):
    f=f+1
    for i in range(x):
        if a[i]%2 == 1:
            break
        a[i]=0.5*a[i]
    else:
        continue
    break
print(f-1)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int n,k;
vector<int>v;
double EPS=1e-9;
long long int pre[200010],a[200010],sieve[1000001];

int main()
{

int x,y,z;
cin>>x>>y>>z;
cout<<z<<' '<<x<<' '<<y;

return 0;
}


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

int main(void){
  int K;
  char S[1000];
  scanf("%d%s",&K,S);
  int len = strlen(S);
  
  if(len<=K) printf("%s",S);
  else {
  	for(int i=0;i<K;i++){
      printf("%c",S[i]);
    }
    printf("...");
  }
  return 0;
}

Measured memory_bytes: 1728
#include<iostream>
#include<cstdio>
#include<algorithm>

using namespace std;

int main()
{
    int a,b,c,arr[10];

    while(scanf("%d %d %d",&a,&b,&c)==3)
    {
        arr[0]=a;
        arr[1]=b;
        arr[2]=c;

        sort(arr, arr+3);

        if(arr[0]==5&&arr[1]==5&&arr[2]==7)
            printf("YES\n");

        else
            printf("NO\n");
    }

    return (0);
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <queue>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double

const double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;
const int mod=1000000007;
typedef pair<int,int> pii;
typedef pair<int,pair<int,int>> piii;

int main(){
	int n;
	pii x[211]={},y[211]={};//(0:無,1:赤、２：青),idx
	int a[111]={},b[111]={},c[111]={},d[111]={};
	cin>>n;
	priority_queue<piii> q;
	int ans=0;
	FOR(i,0,n){
		cin>>a[i]>>b[i];
		x[a[i]]=make_pair(1,i);
		y[b[i]]=make_pair(1,i);
	}
	FOR(i,0,n){
		cin>>c[i]>>d[i];
		x[c[i]]=make_pair(2,i);;
		y[d[i]]=make_pair(2,i);;
		q.push(make_pair(-c[i],make_pair(c[i],d[i])));
	}
	//cout<<"t"<<endl;
	FORD(rep,n,0){
		//*
		piii pr=q.top();
		q.pop();
		int xb=pr.ND.ST;
		int yb=pr.ND.ND;
		priority_queue<pii> q2;
		int f=1;
		FORD(i,xb,0){
			if(x[i].ST==1){
				q2.push(make_pair(b[x[i].ND],x[i].ND));
				f=0;
			}
		}
		if(f)continue;
		while(!q2.empty()){
			pii pp=q2.top();
			q2.pop();
			int idx=pp.ND;
			if(b[idx]>yb)continue;
			//cout<<a[idx]<<" "<<b[idx]<<" "<<xb<<" "<<yb<<endl;
			ans++;
			//*/
			x[a[idx]]=make_pair(0,-1);
			break;
		}

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


Measured memory_bytes: 256
fn read<T: std::str::FromStr>() -> T {
  let mut s = String::new();
  std::io::stdin().read_line(&mut s).ok();
  s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
  read::<String>().split_whitespace()
    .map(|e| e.parse().ok().unwrap()).collect()
}

fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
  (0..n).map(|_| read_vec()).collect()
}

pub trait LexicalPermutation {
  /// Return `true` if the slice was permuted, `false` if it is already
  /// at the last ordered permutation.
  fn next_permutation(&mut self) -> bool;
}
impl<T> LexicalPermutation for [T] where T: Ord {
  /// Original author in Rust: Thomas Backman <serenity@exscape.org>
  fn next_permutation(&mut self) -> bool {
    // These cases only have 1 permutation each, so we can't do anything.
    if self.len() < 2 { return false; }

    // Step 1: Identify the longest, rightmost weakly decreasing part of the vector
    let mut i = self.len() - 1;
    while i > 0 && self[i-1] >= self[i] {
      i -= 1;
    }

    // If that is the entire vector, this is the last-ordered permutation.
    if i == 0 {
      return false;
    }

    // Step 2: Find the rightmost element larger than the pivot (i-1)
    let mut j = self.len() - 1;
    while j >= i && self[j] <= self[i-1]  {
      j -= 1;
    }

    // Step 3: Swap that element with the pivot
    self.swap(j, i-1);

    // Step 4: Reverse the (previously) weakly decreasing part
    self[i..].reverse();

    true
  }
}
fn main() {
  let n: usize = read();
  let p: Vec<usize> = read_vec();

  let mut count = 0;
  for i in 1..p.len()-1 {
    if (p[i-1] > p[i] && p[i] > p[i+1]) || (p[i-1] < p[i] && p[i] < p[i+1]) {
      count += 1;
    }
  }
  println!("{}", count);
}

Measured memory_bytes: 4352
tap = input()
cnt=1
for chat in tap:
    if cnt%2==0:
        if chat == "L" or chat =="U"or chat =="D":
            cnt+=1
        else:
            print("No")
            break
    else:
        if chat == "R" or chat =="U"or chat =="D":
            cnt+=1
        else:
            print("No")
            break
else:
    print("Yes")

Measured memory_bytes: 3060
let () =
  Printf.printf "%d\n" @@
  Scanf.scanf "%d" @@ fun n ->
  let d = Array.init n (fun _ -> Scanf.scanf " %d" ((+) 0)) in
  Array.sort (-) d;
  if n mod 2 = 1 then 0 else d.(n/2) - d.(n/2-1)

Measured memory_bytes: 5376
#include <iostream>
#include <cmath>

using namespace std;

int main() {
	int n;
	long long int t, a;
	cin >> n;
	long long int tt, aa;
	cin >> tt >> aa;
	for (int i = 1; i < n; i++) {
		cin >> t >> a;
		long long int n1, n2;
		n1 = n2 = 0;
		n1 = tt/t;
		if (tt%t != 0) {
			n1++;
		}
		n2 = aa/a;
		if (aa%a != 0) {
			n2++;
		}
		tt = max(n1, n2)*t;
		aa = max(n1, n2)*a;
	}
	cout << tt+aa << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep2(i, a, n) for(ll i = a; i < (ll)(n); i++)
#define memi cout << endl
#define kono(n) cout << fixed << setprecision(n)
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define hina cout << ' '
#define in(n) cin >> n
#define in2(n, m) cin >> n >> m
#define in3(n, m, l) cin >> n >> m >> l
#define out(n) cout << n
const ll mei = (ll)1e9 + 7;

int main(){
  ll x, y, z, k, s;
  in3(x, y, z);
  in(k);
  vector<ll> a(x), b(y), c(z), d, e;
  rep(i, x)
    in(a[i]);
  rep(i, y)
    in(b[i]);
  rep(i, z)
    in(c[i]);
  rep(i, x){
    rep(j, y)
      d.pb(a[i] + b[j]);
  }
  sort(all(d));
  reverse(all(d));
  s = 0;
  if(d.size() > k)
    s = d.size() - k;
  rep(i, s)
    d.pop_back();
  rep(i, d.size()){
    rep(j, z)
      e.pb(d[i] + c[j]);
  }
  sort(all(e));
  reverse(all(e));
  rep(i, k){
    out(e[i]);
    memi;
  }
}

Measured memory_bytes: 43368
fun main(args: Array<String>) {
    val N = readInputLine().toInt()
    val A = Array(N, { readInputLine().split(" ").map { it.toInt() - 1 }})
    val AIndex = IntArray(N)
    val days = Array(N, {IntArray(N - 1)})

    while (true) {
        val used = mutableSetOf<Int>()
        var changed = false
        var allClear = true
        
        for (i in 0 until N) {
            for (j in AIndex[i] until N - 1) {
                allClear = false
                val other = A[i][AIndex[i]]
                
                if (A[other][AIndex[other]] == i) {
                    val newDay =
                        if (AIndex[other] == 0 && AIndex[i] == 0) {
                            1
                        } else if (AIndex[other] == 0) {
                            days[i][AIndex[i] - 1] + 1
                        } else if (AIndex[i] == 0) {
                            days[other][AIndex[other] - 1] + 1
                        } else {
                            Math.max(days[i][AIndex[i] - 1], days[other][AIndex[other] - 1]) + 1
                        }
                    days[i][AIndex[i]] = newDay
                    days[other][AIndex[other]] = newDay
                    
                    AIndex[i]++
                    AIndex[other]++
                    
                    changed = true
                } else {
                    break
                }
            }
        }
        
        if (allClear) {
            break
        }
        
        if (!changed) {
            println(-1)
            return
        }
    }
    
    var ans = 0
    
    for (i in 0 until N) {
        ans = Math.max(ans, days[i][N - 2])
    }
    
    println(ans)
}

fun readInputLine(): String {
    return readLine()!!
}


Measured memory_bytes: 110924
#include "bits/stdc++.h"
using namespace std;

typedef long long ll;

const int MOD = 1000000007;
const int INF = 1001001001;

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

#define rep(i, n)  for(int i=0;i<(n);++i)
#define all(x) (x).begin(),(x).end()

int main() {
    int n;
    cin >> n;
    string s;
    cin >> s;
    int ls[s.size()];
    rep(i, s.size()) ls[i] = (int(s[i]) - int('A') + n) % 26;

    rep(i, s.size()) cout << char(ls[i] + int('A'));
    cout << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;
int main() {
	int ans = 0;
	for (int i = 0; i < 5; i++) {
		int x; cin >> x;
		ans += max(x, 40);
	}
	cout << ans / 5 << endl;
}


Measured memory_bytes: 3092
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
#define FOR(i,n,j) for(int i=(j);i<(n);++i)
#define rrep(i,n) for(int i=(n);i>=0;--i)
#define ssort(n) sort((n).begin(),(n).end())
using ll=long long;
using ld=long double;
typedef pair<int,int> P;
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define INF 10101010

int main()
{
    vector<int> num(3);
    cin >> num[0] >> num[1] >> num[2];
    int count=0;
    ssort(num);
    while(num[1]<num[2]){
        num[0]++;num[1]++;count++;
    }
    if((num[2]-num[0])%2==1){
        num[2]++;num[1]++;count++;
    }
    while(num[0]<num[2]){
        num[0]+=2;count++;
    }

    cout << count << endl;

}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
 
using namespace std;
 
#define lli long long int
#define REP(i,s,l) for(lli i=s;i<l;i++)
#define DEBUG 0
#define INF (1LL<<50)
#define MOD 1000000007

lli b(lli bit){
	if(bit)return -1;
	else return 1;
}

signed main(){

	lli n,m;

	cin>>n>>m;
	vector<lli> x(n),y(n),z(n);

	REP(i,0,n)cin>>x[i]>>y[i]>>z[i];

	lli last=-INF;
	for(lli i=0;i<8;i++){
		vector<lli> ans(n,0);
		REP(j,0,n) ans[j] = b(i&1)*x[j] + b(i&2)*y[j] + b(i&4) * z[j];
		
		sort(ans.rbegin(),ans.rend());
		lli sum=0;
		REP(j,0,m)sum+=ans[j];
		last = max(last,sum);
	}
	cout<<last<<endl;

	return 0;
}

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

const string YES = "Yes";
const string NO = "No";

void solve(std::string S){
    for(int i = 1; i < S.size()+1; ++i){
        if(i % 2 == 0){
            if(S[i-1] == 'R'){
                cout << NO << endl;
                return;
            }
        }else{
            if(S[i-1] == 'L'){
                cout << NO << endl;
                return;
            }
        }
    }
    cout << YES << endl;
}

int main(){
    std::string S;
    std::cin >> S;
    solve(S);
    return 0;
}


Measured memory_bytes: 3604
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <random>
#include <tuple>
#include <iomanip>
#include <cstring>

using namespace std;

typedef long long ll;
//typedef pair<int,int> Pint;
//typedef pair<ll, ll> P;
typedef pair<ll, pair<ll, ll>> P;
//typedef tuple<int,int,int> T;
typedef vector<ll> vec;
typedef vector<vec> mat;
#define rep(i, n) for(ll i = 0; i < (n); i++)
#define revrep(i, n) for(ll i = (n-1); i >= 0; i--)
#define pb push_back
#define f first
#define s second
const ll INFL = 1LL << 60;//10^18 = 2^60
const int INF = 1 << 30;//10^9
const ll MOD = 1e9 + 7;
//const ll MOD  = 998244353;
//ll MOD;
vector<ll> dy = {0, 0, 1, -1, 1, 1, -1, -1, 0};
vector<ll> dx = {1, -1, 0, 0, 1, -1, 1, -1, 0};

ll max(ll a, ll b){return (a > b) ? a : b;}
ll min(ll a, ll b){return (a < b) ? a : b;}
ll pow_long(ll x, ll k){
  ll res = 1;
  while(k > 0){
    if(k % 2) res *= x;
    x *= x;
    k /= 2;
  }
  return res;
}
ll pow_mod(ll x, ll k){
  x %= MOD; x += MOD; x %= MOD;
  ll res = 1;
  while(k > 0){
    if(k % 2){
      res *= x; res %= MOD;
    }
    x *= x; x %= MOD;
    k /= 2;
  }
  return res;
}
ll inverse(ll x){return pow_mod(x, MOD - 2);};

//最大公約数
ll gcd(ll a, ll b){
    if(b == 0) return a;
    return gcd(b, a % b);
}

//最小公倍数
ll lcm(ll x, ll y){return x / gcd(x, y) * y;};

//コンビネーション
const int MAXcomb = 200010;
ll fac[MAXcomb], finv[MAXcomb], inv[MAXcomb];
//facはn!,finvは1/n!
//invは逆元
void COMinit(){
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for(int i = 2; i < MAXcomb; 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 comb(int n, int k){
    if(n < k) return 0;
    if(n < 0 || k < 0) return 0;
    return fac[n] * finv[k] % MOD * finv[n-k] % MOD;
}

//約数の列挙O(√n)
vector<ll> divisor(ll n){
    vector<ll> res(0);
    for(ll i = 1; i * i <= n; i++){
        if(n % i == 0){
            res.push_back(i);
            if(i != n/i) res.push_back(n/i);
        }
    }
    sort(res.begin(), res.end());
    return res;
}



int main(void){
  int A, B;
  cin >> A >> B;
  ll ans = A + B;
  ans = max(ans, A - B);
  ans = max(ans, A * B);
  cout << ans << endl;

}


Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <iostream>
#include <fstream>

#include "bits/stdc++.h"

#define REP(i,x,y) for(ll i=(x);i<(y);i++)
#define RREP(i,x,y) for(int i=(y)-1;i>=(x);i--)
#define all(x) (x).begin(),(x).end()
//#define int long long

using namespace std;

// conversion
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

#define dump(x)  cerr << #x << " = " << (x) << endl
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl

typedef long long ll;

const ll MOD = 1e9 + 7;

class EMaxGCD {
public:
	void solve(std::istream& in, std::ostream& out) {
	    int N, K;
	    in >> N >> K;
	    vector<int> A(N);
	    REP(i,0,N) in >> A[i];

	    ll answer = 1;
	    ll sum = accumulate(all(A), 0);
	    REP(d,1,pow(sum, 0.5f)+1) {
	        if (sum % d != 0) continue;
	        for (const ll divisor : {sum / d, d}) {
	            if (answer > divisor) continue;
	            vector<ll> costs;
	            REP(j,0,N) {
	                if (A[j] % divisor == 0) continue;
	                costs.push_back(A[j] % divisor);
	            }
	            if (costs.size() == 0) {
	                answer = divisor;
	                continue;
	            }
	            sort(all(costs));
                vector<ll> sumFromHead(costs.size()), sumFromTail(costs.size());
                REP(i,0,costs.size()) sumFromHead[i] = i == 0 ? costs[i] : costs[i] + sumFromHead[i-1];
                RREP(i,0,costs.size()) sumFromTail[i] = i == costs.size()-1 ? divisor - costs[i] : (divisor - costs[i]) + sumFromTail[i+1];
                REP(i,0,costs.size()-1) {
                    if (sumFromHead[i] == sumFromTail[i+1] && sumFromHead[i] <= K) {
                        answer = divisor;
                        break;
                    }
                }
	        }
	    }
	    out << answer << "\n";
	}
};


int main() {
	EMaxGCD solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 256
import javax.swing.plaf.IconUIResource;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.nio.charset.IllegalCharsetNameException;
import java.util.*;
public class Main {

     public static void main(String[] args) {
//        Scanner sc = new Scanner(System.in);
        FastScanner sc = new FastScanner();
        PrintWriter out = new PrintWriter(System.out);
       long n=sc.nextLong();
       long ans1=1,ans2=2,ans3=1,mode=(int)1e9+7;
       for (int i=0;i<n;i++){
           ans1*=10;ans1%=mode;ans2*=9;ans2%=mode;ans3*=8;ans3%=mode;
       }
       ans1-=ans2-ans3;
         System.out.println((mode+ans1)%mode);






     }

    static void sort(int[] a) {
        ArrayList<Integer> l=new ArrayList<>();
        for (int i:a) l.add(i);
        Collections.sort(l);
        for (int i=0; i<a.length; i++) a[i]=l.get(i);
    }
    static void sortReverse(long[] a) {
        ArrayList<Long> l=new ArrayList<>();
        for (long i:a) l.add(i);
//        Collections.sort.(l);
        Collections.sort(l,Collections.reverseOrder());
        for (int i=0; i<a.length; i++) a[i]=l.get(i);
    }

    static class FastScanner {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st=new StringTokenizer("");
        String next() {
            while (!st.hasMoreTokens())
                try {
                    st=new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }
        int[] readArray(int n) {
            int[] a=new int[n];
            for (int i=0; i<n; i++) a[i]=nextInt();
            return a;
        }
        long[] readArrayLong(long n) {
            long[] a=new long[(int)n];
            for (int i=0; i<n; i++) a[i]=nextLong();
            return a;
        }
        long nextLong() {
            return Long.parseLong(next());
        }
    }


}

Measured memory_bytes: 32896
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

#define sp ' '
#define endl '\n'
#define st first
#define nd second
#define pb push_back
#define mp make_pair
#define forn(YY, yy) for(long long int yy = 0; yy < YY; ++yy)
#define prn(XX) cout << XX << endl
#define prs(XX) cout << XX << " "

typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef vector<vpll> vvpll;

const long long int MOD = 1e9 + 7;
const long long int INF = 2e9 + 13;
const long long int mINF = -2e9 - 13;
const double PI = 3.14159265358979;
const double EPS = 1e-9;

vvll AdjList, dp;

ll dn(ll n, bool c, ll prev){
    if(dp[n][c] != -1) return dp[n][c];
    ll tot = 1;
    for(ll i = 0; i < AdjList[n].size(); ++i){
        ll v = AdjList[n][i];
        if(v == prev) continue;
        if(c){ tot *= dn(v, false, n)%MOD; tot %= MOD;}
        else{
            tot *= (dn(v, true, n)%MOD + dn(v, false, n)%MOD)%MOD;
            tot %= MOD;
        }
    }
    return dp[n][c] = tot%MOD;
}

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

    ll N; cin >> N;
    AdjList.resize(N);
    dp.assign(N, vll(2, -1));

    forn(N-1, i){
        ll u, v; cin >> u >> v; u--; v--;
        AdjList[u].pb(v);
        AdjList[v].pb(u);
    }

    cout << (dn(0, false, -1) + dn(0, true, -1))%MOD << endl;

    return 0;
}

//cikisir



Measured memory_bytes: 19584