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

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String[] tmp = sc.nextLine().split(" ");
		int a = Integer.parseInt(tmp[0]);
		int b = Integer.parseInt(tmp[1]);
		sc.close();

		System.out.println(a <= 5 ? 0 : (a < 13 ? b/2 : b));
	}
}


Measured memory_bytes: 23636
use proconio::{input, fastout};
use proconio::marker::{Chars};
use proconio::marker::Usize1;
use std::cmp::*;

macro_rules! debug {
      ($($a:expr),*) => {
          eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

#[fastout]
fn main() {
    input!{
        n: usize,
        k: i64,
        x: [usize;n],
    }

    let mut sum = 0;
    for i in 0..n {
        sum += min(x[i] as i64, (x[i] as i64 - k).abs());
    }
    println!("{}", sum*2);
}


Measured memory_bytes: 2136
N = int(input())
T = [0] * N
A = [0] * N
for i in range(N):
    T[i], A[i] = map(int, input().split())

x = 1
for i in range(N):
    t = T[i] * x
    a = A[i] * x
    if i == N - 1:
        break
    tx = ((T[i] * x) + (T[i+1] - 1)) // T[i+1]
    ax = ((A[i] * x) + (A[i+1] - 1)) // A[i+1]
    x = max(tx , ax)

print(t + a)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int,int> pint;

vector<pint> vp[100001];
ll d[100001];
ll inf=1000100010001000;
int n;
int dijkstra(int st){
    priority_queue<pint,vector<pint>,greater<pint> > pq;
    rep(i,n) d[i]=inf;
    d[st]=0;
    pq.push(make_pair(0,st));
    while(!pq.empty()){
        pint pi=pq.top();pq.pop();
        int t=pi.second;
        for(vector<pint>::iterator it=vp[t].begin();it!=vp[t].end();++it){
            if(d[it->second]>d[t]+it->first){
                d[it->second]=d[t]+it->first;
                pq.push(make_pair(d[it->second],it->second));
            }
        }
    }
}
int main(){
    int sr,ds,di;
    cin>>n;
    rep(i,n-1){
        cin>>sr>>ds>>di;
        vp[sr-1].pb(mp(di,ds-1));
        vp[ds-1].pb(mp(di,sr-1));
    }
    int q,k;
    cin>>q>>k;
    dijkstra(k-1);
    int x,y;
    rep(i,q){
        cin>>x>>y;
        cout<<d[x-1]+d[y-1]<<endl;
    }
    return 0;
}

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

//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
//#pragma GCC optimize("Ofast")
//1.0 * clock() / CLOCKS_PER_SEC

#define fi first
#define se second
#define ll long long
#define dl double long

using namespace std;

const int NN = 1e6 + 7;
const int N = 3e3 + 7;
const int M = 20;
const int mod = 998244353;
const ll inf = 1e18 + 7;
const dl rf = 1e-14;

void solve1()
{
    string s;
    cin >> s;
    deque < char > v;
    for( auto c : s )v.push_back(c);
    int q;
    cin >> q;
    int p = 0;
    for( int i = 1; i <= q; i++ ){
        int tp;
        cin >> tp;
        if( tp == 1 ){
            p ^= 1;
        }else{
            int x;
            char y;
            cin >> x >> y;
            if( x == 1 ){
                if( !p )v.push_front(y);
                else v.push_back(y);
            }else{
                if( !p )v.push_back(y);
                else v.push_front(y);
            }
        }
    }
    if( p )reverse( v.begin() , v.end() );
    for( auto c : v ){
        cout << c;
    }
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0); srand(time(0));
    //freopen( "input.txt" , "r" , stdin );
    //freopen( "output.txt" , "w" , stdout );

    int cghf = 1;//cin >> cghf;
    while( cghf-- ){
        solve1();
    }
}


Measured memory_bytes: 976
#include<stdio.h>

int main(void){
  int a, b, c;
  
  scanf("%d%d%d", &a, &b, &c);
  
  if(b/a>c){
    printf("%d\n", c);
  } else {
    printf("%d\n", b/a);
  }
  
  return 0;
}

Measured memory_bytes: 128
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
 *
 * @author Jaynil
 */
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);
        DBlueAndRedBalls solver = new DBlueAndRedBalls();
        solver.solve(1, in, out);
        out.close();
    }

    static class DBlueAndRedBalls {
        public static long mod = 10000_0000_7;

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            long c[][] = new long[2001][2001];
            for (int i = 0; i <= 2000; i++) c[i][0] = 1;
            for (int i = 1; i <= 2000; i++) {
                for (int j = 1; j <= i; j++) {
                    c[i][j] = (c[i - 1][j] + c[i - 1][j - 1]) % mod;
                }
            }
            int n = in.nextInt();
            int k = in.nextInt();
            for (int i = 1; i <= k; i++) {
                out.println((c[k - 1][i - 1] * c[n - k + 1][i]) % mod);
            }

        }

    }

    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: 82260
#include <bits/stdc++.h>

#define INF 0x3f3f3f3f
#define NINF -0x3f3f3f3f

using namespace std;

typedef pair<int,int> pii;

int dp[105][105];

int solve (int a, int b, int n)
{	
	int diff = abs(b-a)-1;
	
	if ((a == 0 || a == n-1) && diff == 0)
		return false;
	
	int &ret = dp[a][b];
	
	if (ret == -1)
	{
		ret = false;
		
		if (a-1 >= 0 && a-1 != b)
			ret = !solve(b,a-1,n);
			
		if (a+1 < n && a+1 != b)
			ret = ret || !solve(b,a+1,n);
	}
	
	return ret;
}

int main (int argc, char const* argv[])
{
	int n;
	scanf("%d",&n);
	
	int a,b;
	scanf("%d %d",&a,&b);
	
	memset(dp,-1,sizeof dp);
	if (solve(a,b,n))
		printf("Alice\n");
	else
		printf("Borys\n");
	
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <fstream>
#include <algorithm>
#include <cmath>
#include <deque>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <map>
#include <stack>
#include <set>
using namespace std;

int main(){    
int a,b;
scanf("%d%d",&a,&b);
printf("%d %d\n",a*b,2*a+2*b);


    return 0;
    }




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

#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))
#define INF 1000000000000000000

typedef long long LL;
typedef long double LD;

struct move{
  int num;
  LD t;
  // bool operator<(const struct move & right) const{
  //   return t<right.t;
  // }
};

struct edge{
  int to;
  LD a;
  LD b;
};

int main(){
  int n,m,s,g;
  cin >> n >> m >> s >> g;
  s--,g--;
  vector<list<struct edge>> e(n);
  int u,v;
  LD a,b;
  for(int i=0;i<m;i++){
    cin >> u >> v >> a >> b;
    e[--u].push_back({--v,a,b});
    e[v].push_back({u,a,b});
  }
  auto c = [](struct move l, struct move r){return l.t>r.t;};
  priority_queue<struct move,vector<struct move>,decltype(c)> dijk(c);
  vector<LL> d(n,INF);
  dijk.push({s,0});
  struct move now;
  LD f;
  while(!dijk.empty()){
    now=dijk.top();
    // cout << now.num << " " << now.t << endl;
    dijk.pop();
    if(d[now.num]==INF){
      d[now.num]=now.t;
      for(auto ed:e[now.num]){
        if(d[ed.to]==INF){
          f=floor(sqrt(ed.b)-ed.a);
          if(f>now.t){
            dijk.push({ed.to,min(f-1+ceil((LD)ed.b/(f-1+ed.a)),min(f+ceil((LD)ed.b/(f+ed.a)),f+1+ceil((LD)ed.b/(f+1+ed.a))))});
          }else if(f>=now.t){
            dijk.push({ed.to,min(f+ceil((LD)ed.b/(f+ed.a)),f+1+ceil((LD)ed.b/(f+1+ed.a)))});
          }else{
            dijk.push({ed.to,now.t+ceil((LD)ed.b/(now.t+ed.a))});
          }
        }
      }
    }
  }
  if(d[g]==INF) cout << -1 << endl;
  else cout << d[g] << endl;
  return 0;
}



Measured memory_bytes: 47228
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 1e9;
const int MOD = 1000000007;
const double PI = acos(-1);
int dx[4] = {0,1,0,-1};
int dy[4] = {1,0,-1,0};

void solve() {
  string s, t;
  cin >> s >> t;
  sort(ALL(s));
  sort(t.rbegin(), t.rend());
  cout << (s < t ? "Yes": "No") << endl;
}

int main() {
  solve();
  return 0;
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
 
int main(){

    int n;
    cin >> n;
    string s;
    cin >> s;
    int ans = 0; 

    for(int i = 1; i <= n; ++i){
        
        int cnt = 0;
       for(int j = 'a'; j <= 'z'; ++j){
            bool a = 0, b = 0;
            for(int k = 0; k < n; ++k){
                if(s[k] == j){
                    if(k < i)a = 1;
                    else b = 1;
                }
            }
            if(a && b)++cnt;
        }

        ans = max(ans,cnt);

    }

    cout << ans << endl;

}

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

void i_sort(vector<int>a , int n ){
	int i , j;
	for(i=0; i<n ; ++i){
		for(j=0; j<i ; ++j){
			if(a[j]>a[i]){
				a[j]^=a[i];
				a[i]^=a[j];
				a[j]^=a[i];
			}
		}
		for(int k=0; k<n-1 ; ++k){
				cout << a[k] << " ";
			}
			cout << a[n-1] <<endl;
	}
}

int main(){
	int n;
	cin >> n;
	vector<int> a(n);
	for(int i=0 ; i<n ; ++i){
		cin >> a[i];
	}
	i_sort(a,n);
	return 0;
}

Measured memory_bytes: 1212
# coding: utf-8
import sys
# from operator import itemgetter
sysread = sys.stdin.readline
read = sys.stdin.read
sys.setrecursionlimit(10 ** 7)
#from heapq import heappop, heappush
#from collections import OrderedDict, defaultdict
#import math
#from itertools import product, accumulate, combinations, product
#import bisect# lower_bound etc
#import numpy as np
#from copy import deepcopy
#from collections import deque
#import numba

def run():
    K = int(input())
    S = input()
    L = len(S)
    mod = 10 ** 9 +7
    def comb_mod2(n, a, mod):
        """
        return: [n, a] % mod
        Note: mod must be a prime number
        """
        if a == 0:
            return 1 % mod
        ret = 1
        for i in range(1, a + 1):
            ret *= n - i + 1
            ret %= mod
            ret *= inv[i]
            ret %= mod
        return ret

    ##################################################################
    def generate_inv(n, mod):
        """
        逆元行列
        n >= 2
        Note: mod must bwe a prime number
        """
        ret = [0, 1]
        for i in range(2, n + 1):
            next = -ret[mod % i] * (mod // i)
            next %= mod
            ret.append(next)
        return ret

    inv = generate_inv(10 ** 6, mod)

    ret = 0
    tmp_comb = 1

    pow25 = [pow(25, i, mod) for i in range(L+K)]
    pow26 = [pow(26, i, mod) for i in range(L + K)]
    for k in range(L, L+K+1):
        if k == L:
            tmp_comb = 1
        else:
            tmp_comb *= k-1
            tmp_comb %= mod
            tmp_comb *= inv[k-L]
            tmp_comb %= mod
        pow25_tmp = pow25[k-L]
        pow26_tmp = pow26[L+K-k]
        tmp_ret = pow25_tmp * pow26_tmp
        tmp_ret %= mod
        tmp_ret *= tmp_comb
        tmp_ret %= mod
        ret += tmp_ret
        ret %= mod
    print(ret)



if __name__ == "__main__":
    run()

Measured memory_bytes: 172144
var lines: string[] = [];
var reader: any = require("readline").createInterface({
  input: process.stdin,
  output: process.stdout
});
reader.on("line", function(line: string) {
  lines.push(line);
});

reader.on("close", function() {
  var strA: string = lines[0].split(" ")[0];
  var strB: string = lines[0].split(" ")[1];
  var numA: number = Number(strA);
  var numB: number = Number(strB);
  var result = 0;
  for (var i = numA; i <= numB; i++) {
    if (
      Math.floor(i / 10000) == i % 10 &&
      Math.floor(i / 1000) % 10 == Math.floor((i % 100) / 10)
    ) {
      result++;
    }
  }
  console.log(result);
});


Measured memory_bytes: 7756
#include<stdio.h>
#define N 100
#define WHITE 0
#define GRAY 1
#define 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;
	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 u;
	
	for( u = 0; u < n; u++ )
	{
		color[u] = WHITE;
	}
	tt= 0;
		
	for( u = 0; u < n; u++ )
	{
		if( color[u] == WHITE )
		{
			dfs_visit(u);
		}
	}
	for( u = 0; u < n; u++ )
	{
		printf( "%d %d %d\n" , u+1 , d[u] , f[u] );
	}
}

int main( void )
{
	
	int u , v , k , 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: 2104
#include <stdio.h>
#define FINDING       1
#define MISSING       0
#define SUIT_NUM      4
#define RANK_NUM      13
#define SUIT_SPADES   'S'
#define SUIT_HEARTS   'H'
#define SUIT_CLUBS    'C'
#define SUIT_DIAMONDS 'D'

int suitToNum(char suit);
char numToSuit(int num);

int main(void) {

    int i;
    int j;
    int finding_num;
    char suit;
    int iSuit;
    int rank;
    int cards[4][13] = { MISSING };
    
    scanf("%d", &finding_num);
    
    for(i = 0; i < finding_num; i++) {
        scanf("\n%c %d", &suit, &rank);
        iSuit = suitToNum(suit);
        cards[iSuit][rank-1] = FINDING;
    }
    
    for(i = 0; i < SUIT_NUM; i++) {
        for(j = 0; j < RANK_NUM; j++) {
            if(cards[i][j] == MISSING) {
                printf("%c %d\n", numToSuit(i), j+1);
            }
        }
    }

    return 0;
}

int suitToNum(char suit) {

    switch(suit) {
        case SUIT_SPADES :
            return 0;
        case SUIT_HEARTS :
            return 1;
        case SUIT_CLUBS :
            return 2;
        case SUIT_DIAMONDS :
            return 3;
        default:
            return -1;
    }
}

char numToSuit(int num) {
    
    switch(num) {
        case 0:
            return SUIT_SPADES;
        case 1:
            return SUIT_HEARTS;
        case 2:
            return SUIT_CLUBS;
        case 3:
            return SUIT_DIAMONDS;
        default:
            return ' ';
    }
}

Measured memory_bytes: 596
# ABC084D - 2017-like Number
import sys
input = sys.stdin.readline

from bisect import bisect_left, bisect_right


def get_primes(n: int) -> list:
    # return a list of primes <= n
    n += 1  # include n itself
    sieve = [1] * n
    for i in range(3, int(n ** 0.5) + 1, 2):
        if sieve[i]:
            sieve[i * i :: 2 * i] = [0] * ((n - i * i - 1) // (2 * i) + 1)
    return [2] + [i for i in range(3, n, 2) if sieve[i]]


def main():
    Q = int(input())
    A = tuple(tuple(map(int, input().split())) for _ in range(Q))
    P = get_primes(10 ** 5)
    S = set(P)
    selected_P = [p for p in P if (p + 1) // 2 in S]
    bsr, bsl = bisect_right, bisect_left
    ans = [bsr(selected_P, r) - bsl(selected_P, l) for l, r in A]
    print(*ans, sep="\n")


if __name__ == "__main__":
    main()

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

int main() {
    int N;
    cin >> N;
    vector<vector<int>> A(2, vector<int>(N));
    for(int i = 0;i<2;i++){
        for(int j = 0;j<N;j++){
            cin >> A[i][j];
        }
    }
    int ans = 0;
    //何列目で下に行くか場合分け
    //2列目で下にいく場合

    //sum += A[0][1] + A[0][1] + A[0][2]
    //sum += A[1][2] + A[1][3] + A[0][4]
     for(int i = 0;i<N;i++){
         int sum = 0;//i列目で下に行く時の和
         for(int j = 0;j<=i;j++){
             sum += A[0][j];
         }
         for(int j = i;j<N;j++){
             sum += A[1][j];
         }
         ans = max(ans,sum);
     }
     cout << ans << endl;
}

Measured memory_bytes: 256
/*
 * AOJ 2200: Mr. Rito Post Office
 * ?¢?????????????????????´?????\????°´????????????????°´?????¬???????????¶????°±?????¨??£????????????????????¬?°´??????????????£????§?????±??????????????????????????????????????????????????????¶??´???
 * ?±????????????????+DP
 * ??????????????¨Floyd?¢???????????????¬??°?°´???s?????????l??????????????´???????????????d[i][j]??¨?????°???????¬¬i?????¶????????¨j?????¶?????¬?§??????????a??°b?????????c??°d?????\?????¨??????l[a,c]+s[c,d]+l[d,b]?????\????????¨???????????????l[a][b]???
 */


#include <cstdio>
#include <cstring>
#include <algorithm>

using namespace std;

int s[210][210];
int l[210][210];
int d[1010][210];
int b[1010];

const int INF = 0x3f3f3f3f;

void Floyd(int n) {
  for (int k = 1; k <= n; ++k) {
    for (int i = 1; i <= n; ++i) {
      for (int j = 1; j <= n; ++j) {
        s[i][j] = min(s[i][j], s[i][k] + s[k][j]);
        l[i][j] = min(l[i][j], l[i][k] + l[k][j]);
      }
    }
  }
}

int main() {
  int n, m, r;
  int u, v, c;
  char tp[3];

  while (scanf("%d%d", &n, &m) != EOF && n) {
    memset(s, 0x3f, sizeof(s));
    memset(l, 0x3f, sizeof(l));
    memset(d, 0x3f, sizeof(d));

    while (m--) {
      scanf("%d%d%d%s", &u, &v, &c, tp);
      if (tp[0] == 'L') {
        l[u][v] = min(l[u][v], c);
        l[v][u] = min(l[v][u], c);
      } else {
        s[u][v] = min(s[u][v], c);
        s[v][u] = min(s[v][u], c);
      }
    }

    for (int i = 1; i <= n; ++i) {
      l[i][i] = 0;
      s[i][i] = 0;
    }

    scanf("%d", &r);

    for (int i = 1; i <= r; ++i) {
      scanf("%d", &b[i]);
    }

    Floyd(n);

    for (int i = 1; i <= n; ++i) {
      d[1][i] = min(d[1][i], s[b[1]][i] + l[i][b[1]]);
    }

    for (int i = 2; i <= r; ++i) {
      for (int j = 1; j <= n; ++j) {
        if (l[j][b[i]] >= INF) continue;
        for (int k = 1; k <= n; ++k) {
          if (d[i - 1][k] >= INF) continue;
          if (j == k) {
            if (l[b[i - 1]][b[i]] < INF) {
              d[i][j] = min(d[i][j], d[i - 1][k] + l[b[i - 1]][b[i]]);
            }
          } else {
            if (l[b[i - 1]][k] < INF && s[k][j] < INF && l[j][b[i]] < INF) {
              d[i][j] = min(d[i][j], d[i - 1][k] + l[b[i - 1]][k] + s[k][j] + l[j][b[i]]);
            }
          }
        }
      }
    }

    int ans = INF;
    for (int j = 1; j <= n; ++j) {
      ans = min(ans, d[r][j]);
    }
    printf("%d\n", ans);
  }
  return 0;
}

Measured memory_bytes: 3820
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;
#define rep(i, begin, n) for (int i = begin; i < n; i++)
#define repe(i, begin, n) for (int i = begin; i <= n; i++)
#define repr(i, begin, n) for (int i = begin; i > begin - n; i--)
#define repre(i, begin, end) for (int i = begin; i >= end; i--)

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

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

const int inf = 1000000007;
const int MOD = 1000000007;
const long long INF = 1000000000000000007;

// -------------------------------------------------------

string s;

int main() {
  cin >> s;
  if (s[0] == s[s.size() - 1]) {
    if (s.size() % 2 == 0) {
      cout << "First";
    } else {
      cout << "Second";
    }
  } else {
    if (s.size() % 2 == 0) {
      cout << "Second";
    } else {
      cout << "First";
    }
  }
}


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


using namespace std;
typedef long long ll;

#define REP(i,n) for(ll i=0; i<ll(n); i++)
#define FOR(i,m,n) for(int i=int(m); i<int(n); i++)
#define ALL(obj) (obj).begin(),(obj).end()

const int  INF = 1 << 29;
const ll INFL = 1LL << 60;
const ll mod = 1000000007;


ll gcd(ll x, ll y) {
	if (y == 0) return x;
	return gcd(y, x%y);
}


int main() {
	ll n, m;
	cin >> n >> m;
	vector<ll> a(n);
	REP(i, n)cin >> a[i];
	REP(i, n)a[i] /= 2;

	vector<int> b(n, 0);

	REP(i, n) {
		ll c = a[i];
		while (c % 2 == 0) {
			b[i]++;
			c /= 2;
		}
	}

	REP(i, n - 1) {
		if (b[i] != b[i + 1]) {
			cout << 0 << endl;
			return 0;
		}
	}


	ll d = 1;
	REP(i, n) {
		a[i] /= gcd(a[i], d);
		d *= a[i];
		if (d > m) {
			cout << 0 << endl;
			return 0;
		}
	}


	ll e = m / d;

	e = (e + 1LL) / 2LL;

	cout << e << endl;

}



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

int main() {
    string s, t;
    cin >> s;
    cin >> t;
    int ans = 0;
    rep(i, s.size()) {
        if (s[i] != t[i])ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3912
#include <bits/stdc++.h>
using namespace std;
 
long long gcd(long long a,long long b){
  long long c=max(a,b);
  long long d=min(a,b);
  long long e=c%d;
  if(e==0)return d;
  else{
    return gcd(d,e);
  }
}
 
int main() {
  long long x,y;
cin >> x>>y;
cout << gcd(x,y)<< endl;
}


Measured memory_bytes: 3092
#include<stdio.h>

int n=0;
int a[101]={};

void printer(n){
  for(int i=0;i<n;i++){
      if(i==n-1){
          printf("%d\n",a[i]);
          break;
      }
      printf("%d ",a[i]);
  }


}

int main(){


    scanf("%d",&n);

    for(int i=0;i<n;i++){
        scanf("%d",&a[i]);
    }
    printer(n);


    for(int i=1;i<=n-1;i++){
        int v,j;
        v=a[i];
        j=i-1;
        while(j>=0 && a[j]>v){
            a[j+1]=a[j];
            j--;
            a[j+1]=v;
        }
            printer(n);
    }
    return 0;
}



Measured memory_bytes: 2132
//前置き
#include<iostream>
#include<cstdio>
#include<cmath>
#include<string>
#include<vector>
#include<list>
#include<algorithm>
#include<set>
#include<map>
#include<stack>
#include<queue>

using namespace std;

typedef  long long ll;

#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

#define FOR(i, a, n) for(int i = (int)(a); i < (int)(n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define SORT(a) sort(all(a))
#define REVERSE(a) reverse(all(a))

#define PRINT(str) printf(#str "\n")
#define yOUT PRINT(Yes)
#define nOUT PRINT(No)
#define YOUT PRINT(YES)
#define NOUT PRINT(NO)

//関数定義
//最大公約数
ll gcd(ll a, ll b);

//最小公倍数
ll lcm(ll a, ll b);

int main(){
    // ========================================================
    int flag[4] = {-1, 0, 0, 0};
    int a, b;
    cin >> a >> b;
    flag[a] = 1;
    flag[b] = 1;
    REP(i, 4){
        if(flag[i] == 0) cout << i << endl;
    }
}

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

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

Measured memory_bytes: 256
#include <cstdio>

typedef unsigned long long int ll;

int main(){
    ll X;
    scanf("%llu",&X);
    ll total=100;
    ll year=0;
    while (total<X){
        year++;
        total=total/100+total;
    }

    printf("%llu\n",year);

    return 0;
}

Measured memory_bytes: 1728
#include<bits/stdc++.h>
#define ll long long 
#define pb push_back
#define ff first
#define ss second
#define vi vector<int>
#define pr pair<int,int>
#define endl "\n"
#define MOD 1000000007 // 10^9 + 7
#define trace(x) cerr<<#x<<": "<<x<<" "<<endl;
#define all(c) (c).begin(), (c).end()

using namespace std;

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

	//freopen("addin.txt","r",stdin);
	//freopen("addout.txt","w",stdout);

	int n;
	cin >> n;
	vi mon(n+1),def(n);
	for(auto &x : mon) cin >> x;
	for(auto &x : def) cin >> x;
	ll max = 0;
	for(int i = 0;i < n;i++){
		if(def[i] > (mon[i]+mon[i+1])){
			max += mon[i]+mon[i+1];
			mon[i+1] = 0;
		}
		else{
			max += def[i];
			if(mon[i] < def[i]){
				mon[i+1] = (mon[i]+mon[i+1]) - def[i];
			}
		}
	}
	cout<<max<<endl;

	return 0;
}

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

#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define repp(i, m, n) for(int i = m, i##_len = (n); i < i##_len; ++i)
#define all(x) (x).begin(), (x).end()
#define clr(ar, val) memset(ar, val, sizeof(ar))
template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair <int,int> P;
typedef long double ld;

int main(void)
{
	ll n, a, ans = 0;
	cin >> n;
	rep(i, n){
		cin >> a;
		ans += a;
	}
	cout << ans - n << endl;
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cfloat>
#include <climits>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <tuple>
#include <algorithm>

using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef vector<int> vi;
typedef vector<long> vl;

#define ten(n) (1e##n)
#define COUT cout <<
#define SPACE_COUT << " "  <<
#define COMMA_COUT << ", " <<
#define ENDL << endl;

int
main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    long long N, A, B;
    cin >> N >> A >> B;
    vector<ll> X;
    for (int i = 0 ; i < N; ++i) {
      int tmp;
      cin >> tmp;
      X.push_back(tmp);
    }

    ll total = 0;
    int cur = X[0];
    for (int i = 1; i < N; ++i) {
      total += min((X[i] - cur) * A, B);
      cur = X[i];
    }
    cout << total << endl;
    return 0;
}


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

void solve() {
    int N, M;
    cin >> N >> M;
    vector<pii> p;
    int m = M, i = 1;
    while ( m > 0 ) {
        cout << i << " " << N-i+1 << "\n";
        m--;
        if ( m == 0 ) break;
        cout << (N+1)/2-i << " " << (N+1)/2+i << "\n";
        m--;
        i++;
    }
    return;
}

int main() {
    solve();
    return 0;
}

Measured memory_bytes: 3636
#include <iostream>
#include <iosfwd>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <cmath>
#include <cassert>
#include <cctype>
#include <climits>
#include <vector>
#include <bitset>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <deque>
#include <string>
#include <list>
#include <iterator>
#include <sstream>
#include <complex>
#include <fstream>
#include <functional>
#include <numeric>
#include <utility>
#include <algorithm>
#include <assert.h>
#include <unordered_map>

using namespace std;

typedef long long ll;
typedef vector < long long > vll;
typedef pair < long long, long long > pll;
typedef pair < int, int > pii;
typedef vector < int > vii;

#define deb(x) cout << #x << " : " << x << endl
#define rep(i,n) for(int i = 0; i < n; i++)
#define reps(i,a,n) for(int i = a; i < n; i++)
#define rsz(x,n) x.clear(); x.resize(n)
#define rrsz(x,a,n) x.clear(); x.resize(n,a)
#define wt while(true)
#define all(x) x.begin(),x.end()
#define pb push_back
#define csl ios_base::sync_with_stdio(false); cin.tie(NULL)
#define s(n) cin >> n
#define ls(x) ((2*(x)) + 1)
#define rs(x) ((ls(x)) + 1)
#define md(a,b) ((b)+((a) - (b))/2)
#define test(testcase) for(int i = 0;i < testcase;i++)

ll t, u, v, n, k,testcase;
const int IN = (1e9 + 7);

int main(){
    csl;
    cin >> t;

    vector<int> a(t);
    for (int& x : a){
        cin >> x;
    }

    vector<int>dp(t, IN);
    dp[0] = 0;
    for (int i = 0 ; i < t ; i++) {
        for (int j : {i+1 , i+2}){
            if (j < t) {
                dp[j] = min(dp[j] , dp[i]+abs(a[j]-a[i]));
            }
        }
    }

    cout << dp[t-1] << endl;
    return 0;
}


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

As = list(map(int,input().split()))
sorted_As = sorted(As,reverse = True)

sum = 0
for i in range(N-1):
    if i == 0:
        sum += sorted_As[0]
    elif i % 2 == 1:
        sum += sorted_As[(i+1)//2]
    else:
        sum += sorted_As[i//2]

print(sum)


Measured memory_bytes: 105276
/*
digu_J - Digvijay Janartha
NIT Hamirpur - INDIA
*/

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

void test() {
    int n, k;
    cin >> n >> k;
    int a[n + 1];
    for (int i = 1; i <= n; ++i) {
        cin >> a[i];
    }
    int mx = ceil(log(n)) + 2;
    mx = mx * 4 + 10;
    for (int j = 0; j < min(k, mx); ++j) {
        int diff[n + 2] = {0};
        auto update = [&](int l, int r) {
            l = max(l, 1);
            r = max(r, 1);
            l = min(l, n);
            r = min(r, n);
            ++diff[l], --diff[r + 1];
        };
        for (int i = 1; i <= n; ++i) {
            update(i - a[i], i + a[i]);
        }
        for (int i = 1; i <= n; ++i) {
            diff[i] += diff[i - 1];
            a[i] = diff[i];
        }
    }
    for (int i = 1; i <= n; ++i) {
        cout << a[i] << " ";
    }
    cout << "\n";
}

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    #ifdef HOME
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    int t = 1;
    // cin >> t;
    for (int i = 0; i < t; ++i) {
        test();
    }
    return 0;
}


Measured memory_bytes: 5388
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>
#include <cstring>
#include <cmath>
#include <stack>
#include <iomanip>
#include <tuple>
#include <functional>
#include <cfloat>
#include <map>
#include <set>
#include <array>
#include <stdio.h>
#include <string.h>
using ll = long long;
using ull = unsigned long long;
using namespace std;
#define int long long
#define CONTAINS(v,n) (find((v).begin(), (v).end(), (n)) != (v).end())
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define ARY_SORT(a, size) sort((a), (a)+(size))
#define REMOVE(v,a) (v.erase(remove((v).begin(), (v).end(), (a)), (v).end()))
#define REVERSE(v) (reverse((v).begin(), (v).end()))
#define ARY_REVERSE(v,a) (reverse((v), (v)+(a)))
#define REP(i, n) for (int (i)=0; (i) < (n); (i)++)
#define CONTAINS_MAP(m, a) (m).find((a)) != m.end()
void YesNo(bool b) { cout << (b ? "Yes" : "No") << endl; }
void YESNO(bool b) { cout << (b ? "YES" : "NO") << endl; }
//max_element


signed main()
{
	int N;
	cin >> N;
	int a = 1000 - N % 1000;
	if (a == 1000)
	{
		cout << 0 << endl;
	}
	else
	{
		cout << a << endl;
	}
}



Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
	int n;
	cin>>n;
	vector<int>c(n),v(n);
	for(int i=0; i<n; i++)
	 cin>>v[i];
	for(int i=0; i<n; i++)
	 cin>>c[i];
	int ans=-1e9;
	for(int i=0; i<(1<<n); i++)
	{
		int temp1=0,temp2=0;
		for(int j=0; j<n; j++){
			if(i&(1<<j)){
				temp1+=v[j];
				temp2+=c[j];
			}
		}
		ans=max(ans,temp1-temp2);
	}
	cout<<ans;
	return 0;
	
	
}

Measured memory_bytes: 3592
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;cin>>N;
  vector<int>L(2*N);for(int i=0;i<2*N;i++)cin>>L[i];
  sort(L.begin(),L.end());
  int ans=0;
  for(int i=0;i<N;i++){
    ans+=L[2*i];
  }cout<<ans;
}


Measured memory_bytes: 256
using System;

public class Test
{
	public static void Main( )
	{
		while( true ) {
			string cards = Console.ReadLine().Trim();
			if( "-" == cards ) { break; }
			int m = int.Parse( Console.ReadLine() );
			for( var i=0; i<m; i++ ) {
				int h = int.Parse( Console.ReadLine() );
				cards = cards.Substring( h )+cards.Substring( 0, h );
			}
			Console.WriteLine( cards );
		}
	}
}

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

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using pint = pair<int, int>;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
const int MOD = 1000000009;
const long long INF = 1LL << 60;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

ll N, W, weight[110], value[110];
ll dp[110][100100]{};

int main() {
    cin >> N >> W;
    for (int i = 0; i < N; ++i) cin >> weight[i] >> value[i];

    for (int i = 0; i < N; ++i) {
        for (int sum_w = 0; sum_w <= W; ++sum_w) {
            if (sum_w - weight[i] >= 0) {
                chmax(dp[i + 1][sum_w], dp[i][sum_w - weight[i]] + value[i]);
            }
            chmax(dp[i + 1][sum_w], dp[i][sum_w]);
        }
    }
    cout << dp[N][W] << endl;
    return 0;
}

Measured memory_bytes: 81624
#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

using ll = long long;

const ll INF = 1e18L + 5;

void min_self(ll& a, ll b) {
	a = min(a, b);
}

int main() {
    int n, w;
    scanf("%d%d", &n, &w);
    vector<int > weight(n), value(n);
    for(int i = 0; i < n; ++i) {
		scanf("%d%d", &weight[i], &value[i]);
	}
	int sum_value = 0;
	for(int x : value) {
		sum_value += x;
	}
	vector<ll > dp(sum_value + 1, INF);
	dp[0] = 0;
	for(int item = 0; item < n; ++item) {
		for(int value_already = sum_value - value[item]; value_already >= 0; --value_already) {
			min_self(dp[value_already + value[item]], dp[value_already] + weight[item]);
		}
	}
	ll answer = 0;
	for(int i = 0; i <= sum_value; ++i) {
		if(dp[i] <= w) {
			answer = max(answer, (ll) i);
		}		
	}
	printf("%lld\n", answer);
}


Measured memory_bytes: 1024
#include<stdio.h>
#include<iostream>
#include<math.h>
using namespace std;
int main()
{
	unsigned long long int n,i;
	cin>>n;
	long double ans =1 ;
	long double ar[n];
	for(i=0;i<n;i++)
	{
		cin>>ar[i];
		if(ar[i] == 0)
		{
			cout<<"0";
			return(0);
		}
	}
	for(i=0;i<n;i++)
	{
		ans *= ar[i];
		if(ans > ((long double) (pow(10,18))))
		{
			cout<<"-1";
			return(0);
		}
	}

	cout<<(unsigned long long int)ans;
	return(0);
}


Measured memory_bytes: 5284
using System;
using System.Collections.Generic;
using System.Linq;

class Abc158b
{
    static ulong n, a, b;

    static void Solve()
    {
        var lenOneSequence = a + b;
        var m = n / lenOneSequence;
        var r = n % lenOneSequence;
        var answer = m * a + Math.Min(r, a);
        
        Console.WriteLine(answer);
    }

    static void Scan()
    {
        var buf = Console.ReadLine().Split().ToList().ConvertAll(ulong.Parse);
        n = buf.ElementAt(0);
        a = buf.ElementAt(1);
        b = buf.ElementAt(2);
    }

    static void Main()
    {
        Scan();
        Solve();
    }
}

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

int main(){
    int n;
    cin >> n;
    int a[n];
    int cnt = 0;
    for(int i = 0; i < n; i++){
        cin >> a[i];
    }
    cnt = a[0];
    for(int i = 1; i < n; i++){
        cnt = cnt ^ a[i];
    }
    if(cnt == 0){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}



Measured memory_bytes: 3996
N,M = map(int,input().split())
AB = list(list(map(int,input().split()))for i in range(N))
AB.sort()
ans = 0
i = 0
while M > 0:
    A,B = AB[i]
    ans += A*B
    M -= B
    i+=1
ans += M*A
print(ans)

Measured memory_bytes: 27880
const x = Number(require('fs').readFileSync('/dev/stdin', 'utf8'));
let ans = [];
for (let i = 1; i < x + 1; i++) {
    if (i % 3 === 0) {
        ans.push(i);
        continue;
    }
     for (let x = i; x > 0; x = Math.floor(x /10)) {
            if ( x % 10 === 3 ) {
                ans.push(i);
                break;
           }
     }     
}
console.log(" " + ans.join(" "));


Measured memory_bytes: 16716
using System;
using System.Collections.Generic;
using System.Linq;
class Program
{
    public static bool f = false, t = true;
    static void Main(string[] args)
    {
        string a = Read.Str();
        for (int i = 0; i < a.Length - 1; i++)
        {
            if (a[i] == a[i + 1]) { Console.WriteLine((i + 1) + " " + (i + 2));return; }
        }
        for (int i = 0; i < a.Length - 2; i++)
        {
            if (a[i] == a[i + 2]) { Console.WriteLine((i + 1) + " " + (i + 3)); return; }
        }
        Console.WriteLine("-1 -1");

    }
    public static long gcd(long a, long b)
    {
        while (true)
        {
            if (a == 0) { return b; }
            if (b == 0) { return a; }
            if (a > b) { a -= b; }
            else { b -= a; }
        }
    }
    public static long lcm(long a, long b) { return a / gcd(a, b) * b; }
    public static string Reverse(string s)
    {
        return new string(s.Reverse().ToArray());
    }
    public static bool IsPrime(int num)
    {
        if (num < 2) return false;
        else if (num == 2) return true;
        else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

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

        // 素数である
        return true;
    }
}
public static class Read
{
    public static void outl(string n = "") { Console.WriteLine(n); return; }
    public static long Long() { return long.Parse(Console.ReadLine()); }
    public static long[] longs() { return Console.ReadLine().Split().Select(long.Parse).ToArray(); }
    public static int Int() { return int.Parse(Console.ReadLine()); }
    public static int[] ints() { return Console.ReadLine().Split().Select(int.Parse).ToArray(); }
    public static string Str() { return Console.ReadLine(); }
    public static string[] Strs() { return Console.ReadLine().Split(); }
}

Measured memory_bytes: 11232
#include<stdio.h>

int main(void)
{
  int h,w,i;
  char c[100][101];
  scanf("%d %d",&h,&w);
  for(i=0;i<h;i++)
    {
      scanf("%s",c[i]);
    }
  for(i=0;i<h;i++)
    {
      printf("%s\n",c[i]);
      printf("%s\n",c[i]);
    }
  return 0;
}
    


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

typedef long long ll;
typedef pair<int, int> P;

int MOD = 1e9 + 7;
ll INF = 1e18;

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

int n;
vector<bool> visited(100010, false);
vector<bool> black(100010, false);
vector<bool> white(100010, false);
vector<vector<int>> g(100010);

int bfs(){
    queue<P> que;
    que.push(P(0, 0));
    visited[0]=true;

    while(!que.empty()){
        P q=que.front(); que.pop();
        int now_v=q.first, cost=q.second;

        if(now_v == n-1) return cost;

        for(int i=0; i<g[now_v].size(); i++){
            int nxt_v=g[now_v][i];

            if(visited[nxt_v] == false){
                visited[nxt_v]=true;
                que.push(P(nxt_v, cost+1));
            }
        }
    }
}

void black_paint(int x){
    queue<P> que;
    que.push(P(0, 0));
    black[0]=true;

    while(!que.empty()){
        P q=que.front(); que.pop();
        int now_v=q.first, cost=q.second;

        if(cost == x) continue;

        for(int i=0; i<g[now_v].size(); i++){
            int nxt_v=g[now_v][i];

            if(black[nxt_v] == false){
                black[nxt_v]=true;
                que.push(P(nxt_v, cost+1));
            }
        }
    }
}

int white_paint(){
    queue<int> que;
    que.push(n-1);
    white[n-1]=true;

    int cnt=1;
    while(!que.empty()){
        int now_v=que.front(); que.pop();

        for(int i=0; i<g[now_v].size(); i++){
            int nxt_v=g[now_v][i];

            if(white[nxt_v] == false && black[nxt_v] == false){
                cnt++;
                white[nxt_v]=true;
                que.push(nxt_v);
            }
        }
    }
    return cnt;
}

int main(){
    cin>>n;
    for(int i=0; i<n-1; i++){
        int a, b; cin>>a>>b;
        a--, b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }

    black_paint(bfs()/2);

    int white_cnt=white_paint();
    int black_cnt=n-white_cnt;

    if(black_cnt > white_cnt){
        cout << "Fennec" << endl;
    }
    else{
        cout << "Snuke" << endl;
    }
}

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

int main(void){
    int N;
    cin >> N;
    for(int i=1;i<=9;i++){
        int m = N/i;
        if(N%i==0 && 1 <= m && m <= 9){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int p=2019;
int l,r,ans=2018;
int main() {
	scanf("%d%d",&l,&r);
	int a=l/p,b=r/p,c=l%p,d=r%p;
	for(int i=0; i<p; i++) {
		for(int j=0; j<p; j++) {
			if(i==j)continue;
			if(a==b&&i>=c&&i<=d&&j>=c&&j<=d)ans=min(ans,i*j%p);
			else if(a+1==b&&((i>=c||i<=d)&&(j>=c||j<=d)))ans=min(ans,i*j%p);
			else if(a+1<b)ans=min(ans,i*j%p);
		}
	}
	printf("%d",ans);
}

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

int main() {
  int n, cnt = 0;
  cin >> n;
  for(int i = 1; i <= n; i+= 2) {
    int yaku = 0;
    for(int j = 1; j <= n; j++) {
      if(i % j == 0) yaku++;
    }
    if(yaku == 8) cnt++;
  }
  cout << cnt;
}

Measured memory_bytes: 3604
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cctype>

using namespace std;

int main(){
    int N,A,B;
    cin >> N >> A >> B;

    if(A*N < B){
        cout << A*N << endl;
    }else{
        cout << B << endl;
    }

    return 0;
}


Measured memory_bytes: 256
"""Boot-camp-for-Beginners_Easy012_C_Next-Prime_30-August-2020.py"""
import numpy as np

K, N = map(int, input().split())
A = list(map(int, input().split()))

theta = []
for i in range(len(A)):
    if i == len(A)-1:
        theta.append((K-A[i]+A[0]))
    else:
        theta.append((A[i+1]-A[i]))

#print("sum",sum(theta))

theta.remove(max(theta))
#print(theta)
s=0
for j in range(len(theta)):
    s+=theta[j]
#print(s)
l_min=s
print(l_min)

Measured memory_bytes: 50888
a = int(input())
b = int(input())
c = int(input())
x = int(input())

ans = 0

for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if x == 500*i + 100*j + 50*k:
                ans += 1
print(ans)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define ll unsigned long long int

int main(){
  int y,m,d;
  char a,b;

  cin>>y>>a>>m>>b>>d;

  if(y>2019||m>4||d>30){
    cout<<"TBD"<<endl;
  }

  else
    cout<<"Heisei"<<endl;

  return 0;
}

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

int main() {
	int a,b,c;
	int n, x;
	scanf("%d", &n);
	a = n;
	b = 0;
	c = 0;
	for(int i = 1; i <= n; i++) {
		scanf("%d", &x);
		b -= 2 * x;
		c += x * x;
	}
	x = - b / a / 2;
	int res = a * x * x + b * x + c;
	x++;
	res = min(res, a * x * x + b * x + c);
	x-=2;
	res = min(res, a * x * x + b * x + c);
	printf("%d\n",res);
}


Measured memory_bytes: 256
import java.io.PrintWriter
import java.util.*
import java.math.*
import java.lang.*
import kotlin.comparisons.*

val pw = PrintWriter(System.out)
val MOD: Long = (1e+9 + 7).toLong()

fun main(args: Array<String>) {
    val abc = readListOfInt().sorted()
    println(abc.slice(0..1).sum())

    pw.flush()
}

/****** Declared Functions and Data Structures ******/
// IO
fun read() = readLine()!!
fun readInt() = read().toInt()
fun readLong() = read().toLong()
fun readDouble() = read().toDouble()
fun readListOfString() = read().split(" ")
fun readListOfInt() = readListOfString().map { it.toInt() }
fun readListOfLong() = readListOfString().map { it.toLong() }
fun readListOfDouble() = readListOfString().map { it.toDouble() }

fun Double.format(digits: Int) = String.format("%.${digits}f", this)
fun Float.format(digits: Int) = String.format("%.${digits}f", this)

fun print(value: Any) { pw.print(value) }
fun println(value : Any) { pw.println(value) }


// Extensions
fun<T> List<T>.toBuckets(bucketKeys: List<T>): Map<T, Int> {
    val buckets = bucketKeys.associate { t -> Pair(t, 0) }.toMutableMap()
    this.forEach { t ->
        buckets[t] = buckets[t]!! + 1
    }
    return buckets
}

fun <K, V> Map<K, V>.toMutableMap(): MutableMap<K, V> = HashMap(this)

// Util Functions
fun<T> permutations(src: List<T>): List<List<T>> {
    if(src.size == 1) return listOf(src)
    val perms = mutableListOf<List<T>>()
    val insertElement = src[0]
    permutations(src.drop(1)).forEach { perm ->
        for(i in 0..perm.size) {
            val newPerm = perm.toMutableList()
            newPerm.add(i, insertElement)
            perms.add(newPerm.toList())
        }
    }
    return perms
}

// return nCr, if you want nCr, please access v[n][r]
fun combinations(n: Long): List<List<Long>> {
    val v = (0..n).map { (0..n).map{0L}.toMutableList() }.toMutableList()
    for(i in 0 until v.size) {
        v[i][0] = 1L
        v[i][i] = 1L
    }
    for(i in 0 until v.size) {
        for(j in 1 until i) {
            v[i][j] = (v[i-1][j-1] + v[i-1][j]) % MOD
        }
    }
    return v.map { it.toList() }.toList()
}

// should be a >= b
fun gcd(a: Long, b: Long): Long = 
    if(b == 0L) a else gcd(b, a % b)

// shoud be a >= b
fun lcm(a: Long, b: Long): Long = 
    a / gcd(a, b) * b

fun sumDigits(num_: Long): Long {
    var num = num_
    var rtn: Long = 0
    while(num != 0.toLong()) {
        val tmp = num % 10
        rtn += tmp
        num /= 10
    }
    return rtn
}

fun Double.isDecimal(): Boolean = ((this - Math.floor(this)) != 0.0)

// Data Structures
class Stack<T>(private var st: MutableList<T> = mutableListOf<T>()) {
    fun isEmpty() = st.isEmpty()
    fun top(): T = st.last()
    fun push(e: T) { st.add(e) }
    fun pop() { st = st.dropLast(1).toMutableList() }
}

class Queue<T>(private var que: MutableList<T> = mutableListOf<T>()) {
    fun isEmpty() = que.isEmpty()
    fun top(): T = que.first()
    fun push(e: T) { que.add(e) }
    fun pop() { que = que.drop(1).toMutableList() }
}


Measured memory_bytes: 36000
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
template<typename T> istream& operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename T> ostream& operator<<(ostream &os, vector<T> &vec){ os << "["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> ostream& operator<<(ostream &os, set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T1, typename T2> ostream& operator<<(ostream &os, pair<T1, T2> &pa){ os << "(" << pa.first << "," << pa.second << ")"; return os; }
template<typename TK, typename TV> ostream& operator<<(ostream &os, map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
#define dbg(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ") " << __FILE__ << endl;

vector<int> A(3);

int main()
{
    cin >> A;
    sort(A.begin(), A.end());
    cout << A[2] * 10 + A[1] + A[0] << endl;
}


Measured memory_bytes: 256