akhauriyash/Code-Regression huggingface dataset:
import java.io.{BufferedOutputStream, BufferedReader, InputStreamReader, PrintWriter}

import scala.collection.mutable
import scala.collection.mutable.ArrayBuffer

object Main {
  def main(args: Array[String]): Unit = {
    val in = new BufferedReader(new InputStreamReader(System.in))
    val out = new PrintWriter(new BufferedOutputStream(System.out))
    val s = in.readLine()
    val t = in.readLine()

    val s2t = mutable.HashMap.empty[Char, Char]
    val t2s = mutable.HashMap.empty[Char, Char]

    for (i <- s.indices) {
      s2t.get(s(i)) match {
        case Some(sit) => if (sit != t(i)) {
          out.println("No")
          out.flush()
          return
        }
        case None => s2t.update(s(i), t(i))
      }
      t2s.get(t(i)) match {
        case Some(tis) => if (tis != s(i)) {
          out.println("No")
          out.flush()
          return
        }
        case None => t2s.update(t(i), s(i))
      }
    }

    out.println("Yes")
    out.flush()
  }
}


Measured memory_bytes: 31856
n = int(input())
S = list(input())
temp=['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z']
for i in range(len(S)):
    S[i] = temp[((temp.index(S[i]))+n)%26]
print(*S,sep='')

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

int main() {
  int N, A, B;
  cin >> N >> A;
  B = N % 500;
  if (B == 0){
   	cout << "Yes";
    }
  	else if(B <= A){
    cout << "Yes";
    }
    else {
    cout << "No";
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(v, a, b) for(int v = (a); v < (b); ++v)
#define FORE(v, a, b) for(int v = (a); v <= (b); ++v)
#define REP(v, n) FOR(v, 0, n)
#define REPE(v, n) FORE(v, 0, n)
#define REV(v, a, b) for(int v = (a); v >= (b); --v)
#define ALL(x) (x).begin(), (x).end()
#define ITR(it, c) for(auto it = (c).begin(); it != (c).end(); ++it)
#define RITR(it, c) for(auto it = (c).rbegin(); it != (c).rend(); ++it)
#define EXIST(c,x) ((c).find(x) != (c).end())
#define LLI long long int
#define fst first
#define snd second

#ifdef DEBUG
#include <misc/C++/Debug.cpp>
#else
#define dump(x) ((void)0)
#endif

#define gcd __gcd

using namespace std;
template <class T> constexpr T lcm(T m, T n){return m/gcd(m,n)*n;}

template <typename I> void join(ostream &ost, I s, I t, string d=" "){for(auto i=s; i!=t; ++i){if(i!=s)ost<<d; ost<<*i;}ost<<endl;}
template <typename T> istream& operator>>(istream &is, vector<T> &v){for(auto &a : v) is >> a; return is;}
template <typename T, typename U> istream& operator>>(istream &is, pair<T,U> &p){is >> p.first >> p.second; return is;}

template <typename T, typename U> bool chmin(T &a, const U &b){return (a>b ? a=b, true : false);}
template <typename T, typename U> bool chmax(T &a, const U &b){return (a<b ? a=b, true : false);}
template <typename T, size_t N, typename U> void fill_array(T (&a)[N], const U &v){fill((U*)a, (U*)(a+N), v);}

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

  int N;
  while(cin >> N){
    if(N == 3){
      cout << "2 5 63" << endl;
    }else if(N == 4){
      cout << "2 5 20 63" << endl;
    }else{
      vector<int> ans;

      int p=0,q=0;

      if(N%2 == 0){
	FORE(i,1,10000){
	  if(i%4 == 0 and N-i > 1 and N-i <= 10000){
	    p = i;
	    q = N-p;
	    break;
	  }
	}

      }else{
	FORE(i,1,10000){
	  if(i%4 == 3 and N-i > 1 and N-i <= 10000){
	    p = i;
	    q = N-p;
	    break;
	  }
	}
      }

      FORE(i,1,p){
	ans.push_back(3*i);
      }

      int k=1;
      FORE(i,1,q){
	if(k%3==0){
	  --i;
	  ++k;
	  continue;
	}
	ans.push_back(2*k);
	++k;
      }

      join(cout, ALL(ans));
    }
    
  }
  
  return 0;
}


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

public class Main {

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

        public InputReader(InputStream inputStream) {
            reader = new BufferedReader(new InputStreamReader(inputStream));
            tok = null;
        }

        public InputReader(String inputFile) throws FileNotFoundException {
            reader = new BufferedReader(new FileReader(inputFile));
            tok = null;
        }

        public String nextLine() {
            String c = "";
            try {
                c = reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }

            return c;
        }

        public String next() {
            while (tok == null || !tok.hasMoreTokens()) {
                try {
                    tok = new StringTokenizer(nextLine());
                } catch (Exception e) {
                    throw new RuntimeException(e);
                }
            }

            return tok.nextToken();
        }

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

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

    public static void main(String args[]) {
        InputStream inputstream = System.in;
        OutputStream outputstream = System.out;
        InputReader in = new InputReader(inputstream);
        PrintWriter out = new PrintWriter(outputstream);
        Task solver = new Task();
        solver.solve(in, out);
        out.flush();
    }

    static class Task {
        public void solve(InputReader in, PrintWriter out) {
            int t = in.nextInt();
            if(t>=30)
            out.println("Yes");
            else
            out.println("No");
           
        }
    }
}
                
                

Measured memory_bytes: 32672
import itertools
n,m,R = map(int,input().split())
r = list(map(int,input().split()))
cost = [[-1]*n for i in range(n)]
for i in range(m):
    a,b,c = map(int,input().split())
    cost[a-1][b-1] = c
    cost[b-1][a-1] = c

for k in range(n):
    for i in range(n):
        for j in range(n):
            if k == i or k == j or cost[i][k] == -1 or cost[k][j] == -1:
                continue
            if cost[i][j] == -1:
                cost[i][j] = cost[i][k]+cost[k][j]
            else:
                cost[i][j] = min(cost[i][j], cost[i][k]+cost[k][j])

ans = -1
for p in itertools.permutations(r):
    c = 0
    for i in range(R-1):
        c += cost[p[i]-1][p[i+1]-1]
    if ans == -1:
        ans = c
    else:
        ans = min(c, ans)
print(ans)

Measured memory_bytes: 49240
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>

using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;

#define inf (1<<30)-1
#define INF (1LL<<62)-1
#define MOD 1000000007LL
#define MP make_pair
#define PB push_back
#define ALL(x) x.begin(),x.end()
#define PI acos(-1)
#define MEM(x,y) memset(x,y,sizeof (x))
#define debug cout<<"A"<<'\n'
#define REP(i,a,b) for (int i=(a); i<=(b); i++)
#define PER(i,a,b) for (int i=(a); i>=(b); i--)
#define REPL(i,a,b) for (LL i=(a); i<=(b); i++)
#define PERL(i,a,b) for (LL i=(a); i>=(b); i--)
#define print(x) cout<<x<<'\n'
#define itrALL(c,itr) for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
#define UNIQUE(X) X.erase( unique( X.begin(), X.end() ), X.end() )


typedef long long LL;
typedef unsigned long long ULL;
typedef pair<int,int>PII;
typedef pair<LL,LL>PLL;
typedef vector<int> VI;
typedef vector<LL> VL;


// Order Statistic Tree

/* Special functions:

        find_by_order(k) --> returns iterator to the kth largest element counting from 0
        order_of_key(val) --> returns the number of items in a set that are strictly smaller than our item
*/

typedef tree<
PII,
null_type,
less<PII>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;

template <class T> inline T bigmod(T p,T e,T M)
{
    T ret = 1;
    for(; e > 0; e >>= 1)
    {
        if(e & 1) ret = (ret * p) % M;
        p = (p * p) % M;
    } return (T)ret;
}

template <class T> inline T gcd(T a,T b){if(b==0)return a;return gcd(b,a%b);}
template <class T> inline T modinverse(T a,T M){return bigmod(a,M-2,M);}
template <class T, class X> inline bool getbit(T a, X i) { T t=1; return ((a&(t<<i))>0);}
template <class T, class X> inline T setbit(T a, X i) { T t=1;return (a|(t<<i)); }
template <class T, class X> inline T resetbit(T a, X i) { T t=1;return (a&(~(t<<i)));}

/*end of header*/

int n;
VI graph[100009];
int grundy[100009];

void dfs(int u,int par)
{
    REP(i,0,graph[u].size()-1)
    {
        int v=graph[u][i];
        if(v==par)continue;
        dfs(v,u);
        grundy[u]^=(grundy[v]+1);
    }
}

int main()
{
    //freopen("input_file_name.in","r",stdin);
    //freopen("output_file_name.out","w",stdout);
    scanf("%d",&n);
    REP(i,1,n-1)
    {
        int u,v;
        scanf("%d %d",&u,&v);
        graph[u].PB(v);
        graph[v].PB(u);
    }
    dfs(1,-1);
    if(grundy[1])print("Alice");
    else print("Bob");
    return 0;
}



Measured memory_bytes: 13952
#include<cstdio>

long long a[100000];

int main() {
	int n;
	scanf("%d", &n);
	long long sum = 0;
	long long odd_sum = 0;
	for(int i=0;i<n;i++) {
		scanf("%d", &a[i]);
		sum += a[i];
		if(i % 2) odd_sum += a[i];
	}
	long long x = sum / 2 - odd_sum;
	printf("%d", 2*x);
	for(int i=0;i<n-1;i++) {
		x = a[i] - x;
		printf(" %d", 2*x);
	}
	printf("\n");
	return 0;
}


Measured memory_bytes: 2048
from collections import Counter
n = int(input())
list_ = [tuple(map(int, input().split())) for i in range(n)]
list_.sort()

if n == 1:
    print(1)
else:
    ab = []
    for i in range(len(list_)-1):
        x_1, y_1 = list_[i]
        
        for j in range(i+1, len(list_)):
            x_2, y_2 = list_[j]
            a = x_2 - x_1
            b = y_2 - y_1
            ab.append((a, b))

    p, q = Counter(ab).most_common()[0][0]

    res = 0
    while len(list_):
        res += 1
        x, y = list_.pop(0)
        while True:
            if (x+p, y+q) in list_:
                list_.remove((x+p, y+q))
                x, y = x+p, y+q
            else:
                break

    print(res)            

Measured memory_bytes: 3692
import sys
from collections import defaultdict, deque
import bisect
from heapq import *
sys.setrecursionlimit(200000)
input = sys.stdin.readline

N, = map(int, input().split())
# gx, gy, = map(int, input().split())
# N = int(input())
# L = [int(v) for v in input().split()]
# L = [[int(v) for v in input().split()] for _ in range(N)]
# L = [int(input()) for _ in range(N)]
# L = [list(input().strip())  for _ in range(N)]
# S = input().strip()

l = []
for i in range(1, int(N ** 0.5) + 1):
    if N % i == 0:
        l.append(i)
    
ans = 10 ** 18
for v in l:
    x, y = v, N // v
    ans =  min(ans, x - 1 + y - 1)

print(ans)

Measured memory_bytes: 3436
#include <iostream>
#include <bits/stdc++.h>
#include <algorithm>
#include <math.h>

using namespace std;

int main(){
    int  n, ans=0,sum;
    cin>>n; int a[2][n];
    for (int i=0; i<n; i++)
        cin>>a[0][i];

    for (int i=0; i<n; i++)
        cin>>a[1][i];

    for (int i=0; i<n; i++) {
            sum=0;
        for (int j=0; j<=i; j++)    sum += a[0][j];
        for (int j=i; j<n; j++)     sum += a[1][j];
        if (ans<sum)    ans = sum;
    }

    cout<<ans;
return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long;
const int maxn = 1e5+10;
int main(){
	int n;
	cin>>n;
	if(n==25){
		cout<<"Christmas\n";
	}	
	else if(n==22){
		cout<<"Christmas Eve Eve Eve\n";
	}
	else if(n==23){
		cout<<"Christmas Eve Eve\n";
	}
	else{
		cout<<"Christmas Eve\n";
	} 
} 

Measured memory_bytes: 256
# -*- coding: utf-8 -*-

N, K = map(int, input().split())
D = list(map(str, input().split()))
flag = True
while flag:
    list_N = list(str(N))

    for num in D:
        if num in list_N:
            flag = True
            N += 1
            break
        else:
            flag = False
print(N)

Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)

int main(){
    string s;
    cin >> s;
    ll n = s.size();
    ll r = 0;
    rep(i, 0, n){
        if(s[i] == '0') r++;
    }
    cout << 2*min(n-r, r) << endl;
    return 0;
}

Measured memory_bytes: 512
import static java.lang.Integer.parseInt;
import static java.lang.Long.parseLong;
import static java.lang.System.exit;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {

	static void solve() throws Exception {
		scanInt();
		int a = scanInt() - 1, b = scanInt() - 1, c = scanInt() - 1, d = scanInt() - 1;
		String s = scanString();
		for (int i = a + 1; i < c - 1; i++) {
			if (s.charAt(i) == '#' && s.charAt(i + 1) == '#') {
				out.print("No");
				return;
			}
		}
		for (int i = b + 1; i < d - 1; i++) {
			if (s.charAt(i) == '#' && s.charAt(i + 1) == '#') {
				out.print("No");
				return;
			}
		}
		if (c < d) {
			out.print("Yes");
			return;
		}
		for (int i = b; i <= d; i++) {
			if (s.charAt(i - 1) == '.' && s.charAt(i) == '.' && s.charAt(i + 1) == '.') {
				out.print("Yes");
				return;
			}
		}
		out.print("No");
	}

	static int scanInt() throws IOException {
		return parseInt(scanString());
	}

	static long scanLong() throws IOException {
		return parseLong(scanString());
	}

	static String scanString() throws IOException {
		while (tok == null || !tok.hasMoreTokens()) {
			tok = new StringTokenizer(in.readLine());
		}
		return tok.nextToken();
	}

	static BufferedReader in;
	static PrintWriter out;
	static StringTokenizer tok;

	public static void main(String[] args) {
		try {
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);
			solve();
			in.close();
			out.close();
		} catch (Throwable e) {
			e.printStackTrace();
			exit(1);
		}
	}
}

Measured memory_bytes: 25832
#include <iostream>
#include <vector>

using namespace std;
const long long INF = 1LL << 60;

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

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

int main() {
  int N;
  cin >> N;
  vector<vector<int> > abc(N, vector<int>(3));
  vector<vector<long long> > dp(N + 1, vector<long long>(3, 0));

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

  for (int i = 0; i < N; i++) {
    for (int j = 0; j < 3; j++) {
      for (int k = 0; k < 3; k++) {
        if (j == k) continue;
        chmax(dp[i + 1][k], dp[i][j] + abc[i][k]);
      }
    }
  }
  long long res = 0;
  for (int i = 0; i < 3; i++) {
    chmax(res, dp[N][i]);
  }

  cout << res << endl;
}

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

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

using namespace std;
using ll = long long;

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

    int n, q;
    cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a[i];

    unordered_set<int> sums;
    int sum, bits;
    rep(i, 1 << n) {
        sum = 0;
        bits = i;
        rep(i, n) {
            if(bits & 1) sum += a[i];
            bits >>= 1;
        }
        sums.emplace(sum);
    }

    cin >> q;
    int m;
    rep(i, q) {
        cin >> m;
        if(sums.find(m) == sums.end()) printf("no\n");
        else printf("yes\n");
    }

    return 0;
}


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

int main() {
  int N, K;
  cin >> N >> K;
  int n = (N-1) * (N-2) / 2;
  if(n < K) {
    cout << -1 << endl;
    return 0;
  }
  using P = pair<int, int>;
  vector<P> A;
  rep(i, 1, N) A.push_back(P(i, N));
  rep(i, 1, N) rep(j, i, N) {
    if(i == j) continue;
    if(A.size() - N + 1 == n - K) break;
    A.push_back(P(i, j));
  }
  cout << A.size() << "\n";
  for(P p : A) cout << p.first << " " << p.second << "\n";
  return 0;
}


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

int main() {
  int H, A;
  cin >> H >> A;
  int sum = H;
  int count = 0;
  while(sum > 0) {
      sum -= A;
    count++;
  }

  cout << count;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

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

	cout << ceil((a + b) / 2.0);
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<utility>
#include<vector>

using namespace std;

int main() {
    long long int h, w, ans;
    cin >> h >> w;
    if (h == 1 || w == 1) {
     ans = 1;
    }
    else if ((h * w) % 2 == 0) {
        ans = h * w / 2;
    }
    else {
        ans = (h * w / 2) + 1;
    }
    cout << ans << endl;

}

Measured memory_bytes: 256
#include<stdio.h>

int n, a[2000];

int solve(int i, int m){
  int res;
  
  if(m == 0) return 1;
  if(i >= n) return 0;

  res = solve(i + 1, m) || solve(i + 1, m - a[i]);
  return res;
}


int main(){
  int q, m, i;

  scanf("%d", &n);
  for(i = 0 ; i < n ; i++) scanf("%d", &a[i]);
  scanf("%d", &q);
  for(i = 0 ; i < q ; i++){
    scanf("%d", &m);
    if(solve(0, m)) printf("yes\n");
    else printf("no\n");
  }

  return 0;
}



Measured memory_bytes: 2104
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(void){
    // Your code here!
    int n;
    cin >> n;
    
    int cnt = 0;
    
    
    for(int i = 0; i < n; i++) {
        char a;
        cin >> a;
        if(a == 'Y'){
            cnt++;
        }
    }
    if(cnt != 0){
        cout << "Four" << endl;
    } else {
        cout << "Three" << endl;
    }
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define USE_LLONG_AS_INT
#ifdef USE_LLONG_AS_INT
#define int long long
#define inf (1ll<<60)
#else
#define inf (1<<30)
#endif
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define vi vector<int>
#define vvi vector<vi>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int>>
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define MEMSET(a) memset(a,0,sizeof(a))
#define Yes(f) cout<<(f?"Yes":"No")<<endl
#define yes(f) cout<<(f?"yes":"no")<<endl
#define YES(f) cout<<(f?"YES":"NO")<<endl
#define SORT(v) sort(all(v))
#define RSORT(v) sort(all(v), greater<int>())

using namespace std;

const int mod=1e9+7;
const string sp=" ";

void run();

void init() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(12);
}

signed main(){
    init();
    run();
    return 0;
}

void run(){
    int n;
    cin>>n;
    cout<<(n-1)/2<<endl;
}

Measured memory_bytes: 256
#include <iostream>


int n;
int A[50];

bool solve(int i, int m){
	if(m == 0) return true;
	if(i >= n) return false;
	bool res = solve(i+1, m) || solve(i+1, m-A[i]);
	return res;
}

int main(){
	std::cin >> n;
	for(int i = 0; i < n; i++){
		std::cin >> A[i];
	}
	int q;
	std::cin >> q;
	int B[q];
	for(int i = 0; i < q; i++){
		std::cin >> B[i];
	}
	for(int i = 0; i < q; i++){
		if(solve(0, B[i])) std::cout << "yes" << std::endl;
		else std::cout << "no" << std::endl;
	}
	return 0;

}

Measured memory_bytes: 1152
N=int(input())
l=[]
for h in range(1,3501):
  for n in range(1,3501):
    try:
      final=N*h*n/(4*h*n-N*n-N*h)
      if final.is_integer()==True and final>0:
        w=int(final)
        l.append([h,n,w])
    except:
      pass
print("{0} {1} {2}".format(l[0][0],l[0][1],l[0][2]))

Measured memory_bytes: 43308
import java.util.*

fun main(args: Array<String>) {
  val sc = Scanner(System.`in`)
  val n = sc.nextInt()
  val s = sc.next()

  var index = -1
  var count = 0
  while (index <= s.length - 4) {
    index = s.indexOf("ABC", index)
    if (index >= 0) {
      count += 1
      index += 3
    } else {
      break
    }
  }
  println(count)
}

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


int compare_int(const void *a, const void *b)
{
    return *(int*)a - *(int*)b;
//    return *(long long*)a - *(long long*)b;
}
//  qsort(A, b, sizeof(int), compare_int);

long long  factorial(long long n) {
    if (n > 0) {
        return n * factorial(n - 1);
    } else {
        return 1;
    }
}

int min(int a, int b) {
    if (a > b)
        return b;
    else
        return a;
}

int distance(int a, int b) {
  return abs(a-b)*abs(a-b);
}

//int ()
/*
int triangle(int a, int b, int c){
  if(a<b+c){
    if(b<c+a){
      if(c<a+b){
        printf("1\n");
        return 1;
      }
    }
  }
  printf("1\n");
  return 0;
}
*/

int main()
{
  int  a ,b, c, d, e, X, Y ,r;
//  long long  a, b, c, d, e, X, Y;
  //  double  c;
//  int  A[200003]={};
  int  A[100003]={};
  int  B[100003]={};
  int  C[100003][11]={};

  int  flg=0;

//  long long  a, b, c, d, X, Y;
//  char s[101][101]={};
  char s[100001]={};
  char t[101]={};
//  int N, M;
//  int A[1000000001]={};
//  long long  C[101]={};
  int i,j,k;
  long long p,q;
//  int flag=0;
//  int tmp=0;
//  char tmp[101]={};
//  long long min=10000000000;
//  long long min=100000001;
  int len=0;
  int l=0;
//  int r=1000001;
  int cnt=0;
  int num=0;
  int num1=0;
  int num2=0;
  int ans=0;
  int max=0;
  int sum=0;
  int addr=0;
  int ptn=0;
  long long  tmp=0;
//  bool on_off[100]={};
  
//  char alp[26]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};

  //  a=0;
  scanf("%d", &a);

  for(i=1;i<10;i++)
  if(a%i==0){
    if((a/i<10)){
 //     printf("%d\n", a/i);
      printf("Yes\n");
    return 0;
    }
  }

 
  printf("No\n");
  
return 0;
}


Measured memory_bytes: 128
//#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <climits>
#include <iomanip>

using namespace std;

#define FAST       			ios_base :: sync_with_stdio(false); cin.tie(NULL); 
#define endl "\n"

typedef long long int  ll;
typedef unsigned long long int ull;


int main()
{
	FAST;
	int a,b,c,d;
	cin >> a >> b >> c >> d;
    int lower = max(a,c);
    int upper = min(b,d);
    
	cout << max(0 , upper-lower);
	return 0;
}

Measured memory_bytes: 256
object Main extends App {

  import scala.io.StdIn._
  solve
  def solve: Unit = {
    val line = readLine.trim
    if (line == ".") return
    line.toList match {
      case b Bool Nil ⇒ println(Combination.all.count(c ⇒ b(c) == True))
      case _ ⇒ ???
    }
    solve
  }
  object Combination {
    def all: List[Combination] = List.tabulate(3){_ ⇒ List(True, False, Unknown)}.foldLeft(Nil::Nil:List[List[Bool]]){(l, r) ⇒ l.flatMap(list ⇒ r.map(_::list))}.map{case p::q::r::Nil ⇒ Combination(p, q, r); case _ ⇒ ???}
  }
  case class Combination(p: Bool, q: Bool, r: Bool)
  sealed trait Bool {
    def unary_- : Bool
    def *(that: Bool): Bool
    def +(that: Bool): Bool
  }
  object Bool {
    def unapply(arg: List[Char]): Option[(Combination ⇒ Bool, List[Char])] = {
      arg match {
        case l Term rest ⇒ rest match {
          case Nil ⇒ Some(l, Nil)
          case '+'::(r Term t) ⇒ Some(c ⇒ l(c) + r(c), t)
          case '*'::(r Term t) ⇒ Some(c ⇒ l(c) * r(c), t)
          case _ ⇒ None
        }
        case _ ⇒ None
      }
    }
  }

  object True extends Bool {
    def unapply(arg: List[Char]): Option[(Bool, List[Char])] = {
      arg match {
        case '2'::t ⇒ Some(True, t)
        case _ ⇒ None
      }
    }
    override def unary_- : Bool = False
    override def * (that: Bool): Bool = that
    override def + (that: Bool): Bool = True
  }
  object False extends Bool {
    def unapply(arg: List[Char]): Option[(Bool, List[Char])] = {
      arg match {
        case '0'::t ⇒ Some(False, t)
        case _ ⇒ None
      }
    }
    override def unary_- : Bool = True
    override def * (that: Bool): Bool = False
    override def + (that: Bool): Bool = that
  }
  object Unknown extends Bool {
    def unapply(arg: List[Char]): Option[(Bool, List[Char])] = {
      arg match {
        case '1'::t ⇒ Some(Unknown, t)
        case _ ⇒ None
      }
    }
    override def unary_- : Bool = Unknown
    override def * (that: Bool): Bool = that match {
      case False ⇒ False
      case _ ⇒ Unknown
    }
    override def + (that: Bool): Bool = that match {
      case True ⇒ True
      case _ ⇒ Unknown
    }
  }
  object Variable {
    def unapply(arg: List[Char]): Option[(Combination ⇒ Bool, List[Char])] = {
      arg match {
        case 'P'::t ⇒ Some(_.p, t)
        case 'Q'::t ⇒ Some(_.q, t)
        case 'R'::t ⇒ Some(_.r, t)
        case _ ⇒ None
      }
    }
  }
  object Term {
    def unapply(arg: List[Char]): Option[(Combination ⇒ Bool, List[Char])] = {
      arg match {
        case '-'::(b Term t) ⇒ Some(c ⇒ -b(c), t)
        case '('::(b Bool ')'::t) ⇒ Some(b, t)
        case b True t ⇒ Some(_ ⇒ b, t)
        case b False t ⇒ Some(_ ⇒ b, t)
        case b Unknown t ⇒ Some(_ ⇒ b, t)
        case v Variable t ⇒ Some(v, t)
        case _ ⇒ None
      }
    }
  }
  implicit class Extension[T](val value :T) extends AnyVal {
    @inline
    def let[A](@inline func: T ⇒ A): A = func(value)
    @inline
    def also(@inline func: T ⇒ Unit): T = {func(value); value}
  }
}


Measured memory_bytes: 45724
#include <iostream>
#include <string>
#include <vector>
#include <numeric>
#include <queue>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <sstream>
#include <stack>
#include <map>
#include <set>
#include <ios>
#include <cctype>
#include <cstdio>

#define REP(i,a) for(int i = 0;i < (a);++i)
#define FOR(i,a,b) for(int i = (a);i < (b); ++i)
#define FORR(i,a,b) for(int i = (a) - 1;i >=(b);--i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SIZE(obj) (int)(obj).size()
#define YESNO(cond,yes,no){cout <<((cond)?(yes):(no))<<endl; }
#define SORT(list) sort(ALL((list)));
#define RSORT(list) sort((list).rbegin(),(list).rend())

using namespace std;

template<typename T>
T round_up(const T& a, const T& b) {
    return (a + (b - 1)) / b;
}

template <typename T1, typename T2>
istream& operator>>(istream& is, pair<T1, T2>& p) {
    is >> p.first >> p.second;
    return is;
}

template <typename T1, typename T2>
ostream& operator<<(ostream& os, pair<T1, T2>& p) {
    os << p.first << p.second;
    return os;
}

template <typename T>
istream& operator>>(istream& is, vector<T>& v) {
    REP(i, (int)v.size())is >> v[i];
    return is;
}

template <typename T>
ostream& operator<<(ostream& os, vector<T>& v) {
    REP(i, (int)v.size())os << v[i] << endl;
    return os;
}

using ll = long long;
constexpr int mod = 1'000'000'007;
constexpr int INF = 1'050'000'000;

template <typename T>
T clamp(T& n, T a, T b) {
    if (n < a)n = a;
    if (n > b)n = b;
    return n;
}

template <typename T>
static T GCD(T u, T v) {
    T r;
    while (v != 0) {
        r = u % v;
        u = v;
        v = r;
    }
    return u;
}

template <typename T>
static T LCM(T u, T v) {
    return u * v / gcd(u, v);
}

struct City {
    int cityNum;
    int prefNum;
    int year;
    string ID = "";
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    std::cout << fixed << setprecision(20);

    int N;
    cin >> N;
    if (N == 0) {
        cout << 0 << endl;
        return 0;
    }
    stringstream S;

    while (N != 0) {
        if (N > 0) {
            S << N % 2;
            N = -N / 2;
        }
        else {
            S << -N % 2;
            N--;
            N = -N / 2;
        }
    }

    string ans = S.str();
    reverse(ALL(ans));
    cout << ans << endl;
    return 0;

}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int L[4],R[4];
main()
{
    double l,r;
    while(cin>>l>>r)
    {
        L[l<0.2?3:l<0.6?2:l<1.1?1:0]++;
        R[r<0.2?3:r<0.6?2:r<1.1?1:0]++;
    }
    for(int i=0;i<4;i++)cout<<L[i]<<" "<<R[i]<<endl;
}


Measured memory_bytes: 3196
import math

n=int(input())
P=list(map(int,input().split()))
Q=list(map(int,input().split()))
P_s=sorted(P)
Q_s=sorted(Q)
num_p=0
num_q=0
for i in range(n):
    num_p+=(P_s.index(P[i]))*math.factorial(n-i-1)
    num_q+=(Q_s.index(Q[i]))*math.factorial(n-i-1)
    P_s.remove(P[i])
    Q_s.remove(Q[i])

print(abs(num_p-num_q))

Measured memory_bytes: 3064
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <sstream>
#include <functional>
#include <map>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <set>
#include <list>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const ll INF = 1LL<<29;
const ll mod = 1e9+7;
#define rep(i,n) for(int (i)=0;(i)<(ll)(n);++(i))
#define repd(i,n,d) for(ll (i)=0;(i)<(ll)(n);(i)+=(d))
#define all(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset((m),(v),sizeof(m))
#define chmin(x,y) (x=min(x,y))
#define chmax(x,y) (x=max(x,y))
#define fst first
#define snd second
#define UNIQUE(x) (x).erase(unique(all(x)),(x).end())
template<class T> ostream &operator<<(ostream &os, const vector<T> &v){int n=v.size();rep(i,n)os<<v[i]<<(i==n-1?"":" ");return os;}
#define N 210
ll dp[N][3][3];
int main(){
	int n;
	string s[2];
	cin>>n>>s[0]>>s[1];
	if(s[0][0]==s[1][0]) dp[0][0][0] = dp[0][1][1] = dp[0][2][2] = 1;
	else rep(i, 3) rep(j, 3) dp[0][i][j] = (i!=j);
	for(int i = 1; i < n; i++){
		int a = s[0][i]==s[0][i-1], b = s[1][i]==s[1][i-1];
		rep(k, 3) rep(l, 3){
			if(s[0][i]==s[1][i]){
				rep(j, 3){
					if((j==k)!=a || (j==l)!=b) continue;
					(dp[i][j][j]+=dp[i-1][k][l])%=mod;
				}
			} else {
				rep(j, 3) rep(j2, 3){
					if(j==j2) continue;
					if((j==k)!=a || (j2!=l)==b) continue;
					(dp[i][j][j2]+=dp[i-1][k][l])%=mod;
				}
			}
		}
	}
	ll res = 0;
	rep(i, 3) rep(j, 3) (res+=dp[n-1][i][j])%=mod;
	cout<<res<<endl;
	return 0;
}


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

int main()
{
    int n, result = 0, counts = 0;

    cin >> n;

    if (n < 105)
    {
        cout << 0 << endl;
        return 0;
    }

    for (int j = 105; j <= n;)
    {

        for (int i = 1; i * i <= j; i++)
        {
            if ((j % i) == 0)
            {
                counts++;
                if ((j / i) != i)
                    counts++;
            }
        }
        if (counts == 8)
            result++;
        counts = 0;
        j += 2;
    }

    cout << result << endl;
    return 0;
}

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

#define int long long
#define sz(x) (int)(x.size())
#define fi first
#define se second
#define pii pair<int, int>

const int N = 1011;
const int mod = 1e9 + 7;
string s[N];
vector<vector<int> >  dp(N, vector<int>(N, 0));
int n, m;
signed main(){
    ios::sync_with_stdio(false);
    cin >> n >> m;
    for(int i = 0; i < n;i++){
        cin >> s[i];
    }
    dp[0][0] = 1;
    for(int i = 1;i < n;i++){
        if(s[i][0] == '.'){
            dp[i][0] = 1;
        }else{
            break;
        }
    }
    for(int i = 1;i < m;i++){
        if(s[0][i] == '.'){
            dp[0][i] = 1;
        }else{
            break;
        }
    }

    for(int i = 1; i < n;i++){
        for(int j = 1;j < m;j++){
            if(s[i][j] == '#'){
                continue;
            }
            if(s[i][j - 1] == '.'){
                dp[i][j] += dp[i][j - 1];
            }
            if(s[i - 1][j] == '.'){
                dp[i][j] += dp[i - 1][j];
            }
            dp[i][j] %= mod;
        }
    }
    cout << dp[n - 1][m - 1] << "\n";
}

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


int main() {
	long long int N,M;
	cin >> N>>M;
	if (N >= M) {
		cout << 0 << endl;
		return 0;
	}
	vector<long long int> X(M);
	for (auto& i : X)cin >> i;

	sort(X.begin(), X.end());

	vector<long long int> diffs;
	for (int i = 1; i <M; i++) {
		diffs.push_back(X[i] - X[i - 1]);
	}
	sort(diffs.begin(), diffs.end());

	long long int ans=0;

	for (int i = 0; i <M-N; i++) {
		ans += diffs[i];
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 2168
#include <bits/stdc++.h>
using namespace std;
 
  
int main()
{
  int A, B, N=-1;
  cin >> A >> B;
  
  // 10 % 消費税の最小値
  int BB = B * 10;
  for(int nn=0; nn<10; nn++)
  { double Bn = double(BB + nn);

    // 8 % 消費税
    double D8 = Bn * 0.08;
    int    I8 =(int) D8;
    if(I8==A)
    {	N = BB + nn;
        break;
    }
  }
  cout << N << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define N 1001
typedef long long int lli;
int a[N][N];
lli dp[N][N];

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	
	int h, w;
	cin>>h>>w;
	for(int i=0; i<h; i++){
		string s;
		cin>>s;
		for(int j=0; j<w; j++)
			a[i+1][j+1] = (s[j]=='#');
	}
	dp[1][1]  = 1;
	lli mod = 1e9  + 7;
	for(int i=1; i<=h; i++)
		for(int j=1; j<=w; j++){
			if(!a[i-1][j])
				dp[i][j] = (dp[i][j] + dp[i-1][j])%mod;
			if(!a[i][j-1])
				dp[i][j] = (dp[i][j] + dp[i][j-1])%mod;
		}
	
	cout<<dp[h][w];
	return 0;
}

Measured memory_bytes: 12032
#include <math.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define PI acos(-1)
typedef long long int ll;
typedef long double ld;

int compare_base_down(const void *b, const void *f) {
  return (*(int *)f - *(int *)b);
}

int compare_base_up(const void *b, const void *f) {
  return (*(int *)b - *(int *)f);
}

int main(void) {
  int   scan;

  char  s[1000];
  char  t[1000];

  scan = scanf("%s", s);
  scan = scanf("%s", t);

  ll    slen;
  ll    tlen;
  ll    *answer;
  ll    *match;

  slen = strlen(s);
  tlen = strlen(t);
  answer = (ll *)malloc(sizeof(ll) * (slen - tlen + 1));
  match = (ll *)malloc(sizeof(ll) * (slen - tlen + 1));

  for (ll i = 0; i <= slen - tlen; i++) {
    match[i] = 0;
    for (ll k = 0; k < tlen; k++) {
      if (s[i + k] == t[k]) {
        match[i]++;
      }
    }
  }

  for (ll j = 0; j <= slen - tlen; j++) {
    answer[j] = tlen - match[j];
  }

  qsort(answer, (slen - tlen + 1), sizeof(ll), compare_base_up);

  printf("%lld", answer[0]);
  return (0);
}



Measured memory_bytes: 1736
from collections import Counter
from itertools import combinations
N = int(input())

S = [input()[0] for _ in range(N)]

s = Counter(S)

sd = {'M':0, 'A':0, 'R':0, 'C':0, 'H':0}

for i in 'MARCH':
    sd[i] += s[i]
    
ans = 0

for ss in combinations(['M','A','R','C','H'], 3):
    ans += sd[ss[0]]*sd[ss[1]]*sd[ss[2]]
    
print(ans)


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

#define rep(i,n) for(ll (i)=0;(i)<(ll)(n);(i)++)
#define rept(i,n) for(ll (i)=0;(i)<=(ll)(n);(i)++)
#define reps(i,s,n) for(ll (i)=(s);(i)<(ll)(n);(i)++)
#define repst(i,s,n) for(ll (i)=(s);(i)<=(ll)(n);(i)++)
#define repr(i,n) for(int (i)=(n);(i)>=0;(i)--)
#define each(itr,v) for(auto (itr):(v))
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define mp(x,y) make_pair((x),(y))
#define fi first
#define se second
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln "\n"
#define dbg(x) cout<<#x" = "<<(x)<<ln

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vector<int> > mat;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

const int inf = (int)1e9;
const ll linf = (ll)1e18;
const int mod = (int)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};

struct oreno_initializer {
	oreno_initializer() {
		cin.tie(0);
		ios::sync_with_stdio(0);
	}
} oreno_initializer;

// ━━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…
// .｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋
// ・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・

ll n, x, a[4567], b[4567], t, r = linf;

int main() {
	cin >> n >> x;
	rep(i,n) cin >> a[i];
	// 1の手前はNって処理を楽にするために配列を2個繋げてn〜2n-1を使う
	rep(i,n) a[n+i] = a[i];
	// 魔法を唱える回数をkに固定するとi番目のスライムを作るコストはmin(a[i], a[i-1], ..., a[i-k])になる
	fill(b, b+2*n, 1145141919);
	rep(k,n) {
		t = k*x;
		reps(i,n,2*n) {
			// min(a[i]..a[i-k]) = min(min(a[i]..a[i-k+1]), a[i-k])
			chmin(b[i], a[i-k]);
			t += b[i];
		}
		chmin(r, t);
	}
	cout << r << ln;
}

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

using ll = long long int;
using ull = unsigned long long int;
using P = pair<int, int>;
using P3 = pair<double,P>;
using PP = pair<P, P>;
constexpr int INF = 1 << 30;
constexpr ull MOD = 998244353;
constexpr int di[] = {0, 1, 0, -1};
constexpr int dj[] = {1, 0, -1, 0};
constexpr double EPS = 1e-9;


ull dp[2][505][555]; // i番目まで、最後につかった数がj以下、xorがk

int main(){
    int N, X;
    cin >> N >> X;
    for(int j=0;j<=X;j++){
        dp[0][j][0] = 1ULL;
    }
    for(int i=0;i<N;i++){
        int i1 = (i+1)&1, i0 = i&1;
        for(int k=0;k<550;k++){
            for(int j=0;j<=X;j++){
                dp[i1][j][k] = (dp[i0][j][k^j] + (j>0 ? dp[i1][j-1][k] : 0)) %MOD;
            }
        }
    }
    cout << dp[N&1][X][X] << endl;
    return 0;
}


Measured memory_bytes: 7456
import std.stdio, std.string, std.conv;
import std.range, std.algorithm, std.array, std.typecons, std.container;
import std.math, std.numeric, core.bitop;

enum inf3 = 1_001_001_001;
enum inf6 = 1_001_001_001_001_001_001L;
enum mod = 1_000_000_007L;




void main() {
    auto s = readln.chomp;
    int n = s.length.to!int;
    
    auto dp = new long[][](n + 1, 13);
    dp[0][0] = 1;

    foreach (i ; 0 .. n) {
        foreach (j ; 0 .. 13) {
            if (s[i] == '?') {
                foreach (k ; 0 .. 10) {
                    (dp[i + 1][(10*j + k) % 13] += dp[i][j]) %= mod;
                }
            }
            else {
                int d = s[i] - '0';
                (dp[i + 1][(10*j + d) % 13] += dp[i][j]) %= mod;
            }
        }
    }

    long ans = dp[n][5];

    writeln(ans);
}


















int[][] readGraph(int n, int m, bool isUndirected = true, bool is1indexed = true) {
    auto adj = new int[][](n, 0);

    foreach (i; 0 .. m) {
        int u, v;
        scan(u, v);
        if (is1indexed) {
            u--, v--;
        }
        adj[u] ~= v;
        if (isUndirected) {
            adj[v] ~= u;
        }
    }

    return adj;
}

alias Edge = Tuple!(int, "to", int, "cost");

Edge[][] readWeightedGraph(int n, int m, bool isUndirected = true, bool is1indexed = true) {
    auto adj = new Edge[][](n, 0);

    foreach (i; 0 .. m) {
        int u, v, c;
        scan(u, v, c);
        if (is1indexed) {
            u--, v--;
        }
        adj[u] ~= Edge(v, c);
        if (isUndirected) {
            adj[v] ~= Edge(u, c);
        }
    }

    return adj;
}

void yes(bool b) {
    writeln(b ? "Yes" : "No");
}

void YES(bool b) {
    writeln(b ? "YES" : "NO");
}

T[] readArr(T)() {
    return readln.split.to!(T[]);
}

T[] readArrByLines(T)(int n) {
    return iota(n).map!(i => readln.chomp.to!T).array;
}

void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}

void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}

bool chmin(T, U...)(ref T x, U args) {
    bool isChanged;

    foreach (arg; args) {
        if (x > arg) {
            x = arg;
            isChanged = true;
        }
    }

    return isChanged;
}

bool chmax(T, U...)(ref T x, U args) {
    bool isChanged;

    foreach (arg; args) {
        if (x < arg) {
            x = arg;
            isChanged = true;
        }
    }

    return isChanged;
}


Measured memory_bytes: 18456
# -*- coding: utf-8 -*-

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

def max_choice(V, n, m):
    if len(V) <= n:
        n = len(V)
    a = -999999999
    for i in range(n+1):
        tlist = V[:i]
        tlist.extend(V[len(V)-n+i:])
        tlist.sort()
        for j in range(m):
            if tlist[j]<0:
                tlist[j] = 0
            else:
                break       
        a = max(a, sum(tlist))
    return a

ans = 0
for i in range(1, min(N, K)+1):
    ans = max(max_choice(V, i, min(K-i, i-1)), ans)
    
print(ans)


Measured memory_bytes: 3064
#include<iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;

bool isPrime(int n){
  for(int i=2;i<=sqrt(n)+1;i++)
    if(n%i==0)
      return false;
  return true;
}

int main(){
  int N;
  cin >> N;
  int x = 6;
  int count = 0;
  while(1){
    if(isPrime(x)){
      cout << x << " ";
      count ++;
    }
    if(count>=N)
      break;
    x += 5;
  }
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
int a,b,c;
int ans;
int min(int x,int y)
{
	return x<y?x:y;
}
int minn(int x,int y,int z)
{
	int k=min(x,y);
	int p=min(k,z);
	return p;
}
int main ()
{
	cin>>a>>b>>c;
	ans=minn(a+b,a+c,b+c);
	cout<<ans<<endl;
	return 0;
}

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

using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    int yen,point=0;
    cin>>yen;
    if(yen>=500) {
        point=yen/500*1000;
    yen=yen%500;

    }
    if(yen>=5) {
        point+=yen/5*5;
    }
    cout<<point<<"\n";


}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <stdlib.h>
#include <map>
#include <cmath>
#define MOD_P 1000000007
#define MOD_Q 998244353
#define PI 3.14159265358979
#define ll long long
using namespace std;


int main()
{
	int n, k, t;
	cin >> n >> k >> t;
	int T;

	if (n % k) {
		T = (n / k + 1) * t;
	} else {
		T = n / k * t;
	}

	printf("%d", T);

	return 0;
}


Measured memory_bytes: 3692
import Data.List

solve :: Int -> Int -> Int -> Int
solve a b c =
  (div (z - x) 2) + (div (z - y) 2) + 
   case ((z - x) `mod` 2) + ((z - y) `mod`2) of
     0 -> 0
     1 -> 2
     2 -> 1
  where
    [x,y,z] = sort [a,b,c]


main = do
  [a,b,c] <- map read . words <$> getLine :: IO [Int]
  print $ solve a b c


Measured memory_bytes: 508
import java.util.Scanner;

class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
	double x1 = sc.nextDouble();
	double y1 = sc.nextDouble();
	double x2 = sc.nextDouble();
	double y2 = sc.nextDouble();
		
	System.out.println(Math.sqrt(Math.pow((x2-x1),2)+Math.pow((y2-y1),2)));
    }
}


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

const int mod = 1000000007;
struct mint{
    ll x;
    mint(ll x=0):x((x%mod+mod)%mod){}
    mint operator-() const { return mint(-x); }
    mint& operator+=(const mint a){
        if((x+=a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a){
        if((x += mod-a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a){
        (x *= a.x) %= mod;
        return *this;
    }
    mint operator+(const mint a) const {
        mint res(*this);
        return res += a;
    }
    mint operator-(const mint a) const {
        mint res(*this);
        return res -= a;
    }
    mint operator*(const mint a) const {
        mint res(*this);
        return res *= a;
    }
    mint pow(ll t) const {
        if(!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if(t&1) a *= *this;
        return a;
    }

    mint inv() const {
        return pow(mod - 2);
    }
    mint& operator/=(const mint a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint a) const {
        mint res(*this);
        return res /= a;
    }
};
istream& operator>>(istream& is, mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

struct combination {
    vector<mint> fact, ifact;
    combination(int n):fact(n+1),ifact(n+1){
        assert(n < mod);
        fact[0] = 1;
        for(int i = 1; i <= n; i++) fact[i] = fact[i-1]*i;
        ifact[n] = fact[n].inv();
        for(int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;  
    }
    mint operator()(int n, int k){
        if(k < 0 || n < k) return 0;
        return fact[n]*ifact[k]*ifact[n-k];
    }
};


int main(){
    int n; cin >> n;
    mint ans = 0;
    ans += mint(10).pow(n);
    ans -= mint(9).pow(n);
    ans -= mint(9).pow(n);
    ans += mint(8).pow(n);
    cout << ans << endl;
}

Measured memory_bytes: 3616
#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>

long get_rest(int x, int y, long d) {
    // x^y % dの剰余を計算

    long rest;
    int i;

    rest = x % d;

    for (i = 1; i < y; i++) {
        rest = (rest * x) % d;
    }

    return rest;
}

int main() {
    int N; std::cin >> N;
    int i, temp, abs_value;
    bool is_feasible = true;
    std::vector<int> A;

    for (i = 0; i < N; i++) {
        std::cin >> temp;
        A.push_back(temp);
    }

    std::sort(A.begin(), A.end());

    if (N % 2 == 0) {
        for (i = 0; i < N; i += 2) {
            if (A[i] != i + 1 || A[i + 1] != i + 1) {
                is_feasible = false;
            }
        }
    } else {
        if (A[0] != 0) is_feasible = false;
        for (i = 1; i < N; i += 2) {
            if (A[i] != i + 1 || A[i + 1] != i + 1) {
                is_feasible = false;
            }
        }
    }

    if (is_feasible) {
        if (N > 1) std::cout << get_rest(2, std::round(N / 2), std::pow(10, 9) + 7);
        else std::cout << "1";
     } else {
        std::cout << "0";
     }

    return 0;
}



Measured memory_bytes: 892
#include <bits/stdc++.h>
#define FOR(i, m, n) for (int i = m; i < (n); i++)
#define FORR(i, m, n) for (int i = (m); i > 0; i--)
#define REP(i, n) FOR(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
using namespace std;
typedef long long ll;

void trace(int a[], int n) {
  REP(i, n) {
    if (i > 0) cout << " ";
    cout << a[i];
  }
  cout << endl;
}

void bubbleSort(int a[], int n) {
  bool flag = true;
  int count = 0;
  while (flag) {
    flag = false;
    FORR(i, n - 1, 0) {
      if (a[i] < a[i - 1]) {
        swap(a[i], a[i - 1]);
        count++;
        flag = true;
      }
    }
  }
  trace(a, n);
  cout << count << endl;
}

int main() {
  int n;
  cin >> n;
  int a[n];
  REP(i, n) {
    cin >> a[i];
  }

  bubbleSort(a, n);

  return 0;
}


Measured memory_bytes: 3104
#include <iostream>
using namespace std;
#include <string>
#include <vector>
#include <algorithm>
#include <map>
typedef long long ll;
#include <cmath>
#include <iomanip>

const int MOD = 1000000007;


ll POWER(ll x,ll y)
{
	ll ret=1;
	ll p=x;
	for (ll i=y;i>0;i/=2)
	{
		if (i%2) ret=(ret*p)%MOD;
		p=(p*p)%MOD;
	}
	return ret;
}
ll gcm(ll a, ll b)
{
	if (b>a) {ll c=a; a=b; b=c;}
	while (b>0)
	{
		ll r=a%b;
		a=b;
		b=r;
	}
	return a;
}


int main(int argc, char *argv[])
{
	int n,k;
	cin>>n>>k;
	vector<int> h(n+1,1); 
	for (int i=0;i<k;i++)
	{
		int d;
		cin>>d;
		for (int j=0;j<d;j++)
		{
			int a;
			cin>>a;
			h[a]=0;
		}
	}
	int ret=0;
	for (int i=1;i<=n;i++) ret+=h[i];
	cout<<ret<<endl;
	return 0;
}



Measured memory_bytes: 3636