akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
                
#define speedio ios_base::sync_with_stdio(false); cin.tie(NULL);
#define pretime float(clock()-clk)/CLOCKS_PER_SEC
#define max2(a,b) ((a)>(b) ? (a) : (b))   
#define min2(a,b) ((a)<(b) ? (a) : (b)) 
#define rep(i,a,b) for(i=a;i<=b;++i)
#define rev(i,a,b) for(i=a;i>=b;--i) 
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
#define lli long long int 
#define ins insert
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define PI 3.14159265
#define mod 1000000007
#define inf 1000000000000000

using namespace std;
typedef vector<lli>   vll;
typedef vector<int>   vi;
typedef set<lli>      sll;
typedef set<int>      si;
typedef pair<lli,lli> pll;
typedef pair<int,int> pii;
clock_t clk=clock();       

int i,j;
void solve(void);

int main()
{
  speedio;
   int t=1;  
  // cin>>t;
   while(t--)
     solve();

  return 0;
}
//
void solve()
{
	string s; cin>>s;
	int n=s.length();
lli ct1=0,ct2=0;
	rep(i,0,n-1)
	 if(i%2==0 && s[i]=='1') ++ct1;
	 else if(i%2==1 && s[i]=='0') ++ct1;

	rep(i,0,n-1)
	 if(i%2==0 && s[i]=='0') ++ct2;
	 else if(i%2==1 && s[i]=='1') ++ct2;

	 cout<<min2(ct1,ct2)<<"\n";
	 
}

Measured memory_bytes: 512
K, X = map(int, input().split())

#num_line = [i for i in range(-1000000, 1000001)] 
answer = []

if X-K< -1000000:
    answer = [i for i in range(-1000000,X+K+1)]
elif X+K>1000000:
    answer = [i for i in range(X-K+1,1000000)]
else:
    answer = [i for i in range(X-K+1,X+K)]

for i in range(len(answer)):
    print("{} ". format(answer[i]))

Measured memory_bytes: 3064
s = list(input())
count = 1
cursor = 1
prev = s[0]
l = len(s)
while cursor < l-1:
  if s[cursor] != prev:
    prev = s[cursor]
    cursor += 1
    count += 1
  else:
    prev = s[cursor:cursor+1]
    cursor += 2
    count += 1
if cursor == l-1 and prev != s[-1]:
  count += 1
print(count)

Measured memory_bytes: 4840
n = int(input())
c = input()

rtow = c.count('R')
wtor = 0

anses = []
for i in range(n + 1):
  anses.append(max(rtow, wtor))
  if i == n:
    break
  if c[i] == 'W':
    wtor += 1
  else:
    rtow -= 1

print(min(anses))


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

//宣言
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;

//数値
#define MOD 1000000007
#define INF (1<<20)
const double EPS = 1e-10;
const double PI = acos(-1.0);

//操作
#define FOR(i,a,b) for(int i=a;i<b;++i)
#define REP(i,n) FOR(i,0,n)
#define REPB(i,n) for(int i=n;i>=0;--i)
#define SORT(A) sort(A,A+sizeof(A)/sizeof(A[0]))
#define VSORT(A) sort(A.begin(),A.end())
#define EXIST(s,e) (s.find(e)!=s.end())
#define PB push_back
#define MP make_pair
#define Int(x) int x; scanf("%lld", &x);
#define int2(x, y) int x, y; scanf("%lld %lld", &x, &y);

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


int main() {
	int n,a,b;
	cin >>n>> a>>b;
	int Sum = 0;
	for (int i = 1;i <= n;i++) {
		int sum = 0;
		int k = i;
		while(k){
			sum += k % 10;
			k /= 10;
		}
		if (sum >= a&&sum <= b) Sum +=i;
	}

	cout << Sum << endl;
}

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

int main() {
  int N; cin >> N;
  for (int i = 1; i <= 9; i++) {
    for (int j = 1; j <= 9; j++) {
      if (i*j == N) {
        cout << "Yes" << endl;
        return 0;
      }
    }
  }
  cout << "No" << endl;
}

Measured memory_bytes: 256
n = int(input())
for i in range(n):
    bs = list(map(int, input().split()))
    lanes = [0,0]
    for j in bs:
        if j > lanes[0] and  j > lanes[1]:
            lanes[lanes.index(max(lanes))] = j
        elif j>lanes[0]:
            lanes[0] = j
        elif j>lanes[1]:
            lanes[1] = j
        else:
            print('NO')
            break
    else:
        print('YES')

Measured memory_bytes: 7520
import sys

h,w=map(int,input().split())
C=[input() for i in range(h)]
for i in range(h):
    for j in range(w):
        if C[i][j]==".":
            continue
        flag=0
        if i!=0:
            if C[i-1][j]=="#":
                flag=1
        if i!=h-1:
            if C[i+1][j]=="#":
                flag=1
        if j!=0:
            if C[i][j-1]=="#":
                flag=1
        if j!=w-1:
            if C[i][j+1]=="#":
                flag=1
        if flag==0:
            print("No")
            sys.exit()
print("Yes")

Measured memory_bytes: 3064
#include<stdio.h>
int main() {
	int n,a=0;
	scanf("%d", &n);
	if (n >= 105)a++;
	if (n >= 135)a++;
	if (n >= 165)a++;
	if (n >= 189)a++;
	if (n >= 195)a++;
	printf("%d", a);
}

Measured memory_bytes: 128
/**
*	created: 14.09.2020 00:11:15
**/
#include <bits/stdc++.h>
// #include <boost/multiprecision/cpp_int.hpp>
// using bint = boost::multiprecision::cpp_int;
using namespace std;
using ll = long long;
using P = pair<int,int>;
// #define endl '\n'
#define int long long
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define rrep(i,n) for (int i = (int)(n - 1); i >= 0; i--)
#define rep2(i,s,n) for (int i = (s); i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define pcnt(bit) __builtin_popcountll(bit)
const long double pi = acos(-1.0);
const int MAX = 1000010;
const int INF = 1ll << 60;
const int MOD = 1000000007;
// const int MOD = 998244353;
template<typename T> inline bool chmax(T &a, T b) {if (a < b) {a = b; return 1;} return 0;}
template<typename T> inline bool chmin(T &a, T b) {if (b < a) {a = b; return 1;} return 0;}
template<typename T> T pow(T a, ll n) {T r(1); while(n) {if (n & 1) r *= a; a *= a; n >>= 1;} return r;}
struct faster_io {faster_io() {cin.tie(0); ios_base::sync_with_stdio(false);}} faster_io_;

signed main() {
    int n; cin >> n;
    vector<int> z, w;
    rep(i,n) {
        int a, b; cin >> a >> b;
        int Z = a + b, W = a - b;
        z.push_back(Z); w.push_back(W);
    }
    sort(all(z));
    sort(all(w));
    cout << max(z[n-1]-z[0], w[n-1]-w[0]) << endl;
    return 0;
}

Measured memory_bytes: 6632
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long A = Integer.parseInt(sc.next());
        long B = Integer.parseInt(sc.next());
        long C = Integer.parseInt(sc.next());
        sc.close();


        int count = 0;
        boolean isEven = true;
        while(isEven) {
        	if(A % 2 == 0 && B % 2 == 0 && C % 2 == 0) {
        		if(A == B && B == C && C == A) {
                    System.out.println("-1");
                    return;
                }
        		long tmpA = A / 2;
        		long tmpB = B / 2;
        		long tmpC = C / 2;
        		A = B = C = 0;
        		A = tmpB + tmpC;
        		B = tmpC + tmpA;
        		C = tmpA + tmpB;
        		count++;
        	}else {
        		isEven = false;
        	}
        }
        System.out.println(count);
    }

}

Measured memory_bytes: 35592
from collections import defaultdict
N = int(input())
# N = 1000
string_dict = defaultdict(int)

for i in range(N):
    inp = list(input())
    # inp = list("aaaa")
    inp.sort()

    string_dict["".join(inp)] += 1
# print(string_dict)

count = 0
for i in string_dict.values():
    count += i*(i-1)//2
print(count)


Measured memory_bytes: 18192
import copy

def stable_sort(A: list, N:int) -> list:
    """
    トランプのカードを整列しましょう。ここでは、４つの絵柄(S, H, C, D)と９つの数字(1, 2, ..., 9)から構成される計 36 枚のカードを用います。例えば、ハートの 8 は"H8"、ダイヤの 1 は"D1"と表します。
    バブルソート及び選択ソートのアルゴリズムを用いて、与えられた N 枚のカードをそれらの数字を基準に昇順に整列するプログラムを作成してください。アルゴリズムはそれぞれ以下に示す疑似コードに従うものとします。数列の要素は 0 オリジンで記述されています。
    5
    H4 C9 S4 D2 C3
    """

    def bubble_sort(A: list, N:int) -> list:
        """
        :A[N]: サイズがNの整数型配列。
        :i: 未ソートの部分の先頭を指すループ変数で、配列の先頭から末尾に向かって移動します。
        :j: 未ソートの部分の隣り合う要素を比較するためのループ変数で、Aの末尾であるN-1 から開始しi+1 まで減少します。
        """
        has_finished = True
        i = 0
        count = 0
        while has_finished and len(A) > 1:
            has_finished = False
            for j in reversed(range(i + 1, N)):
                if int(A[j][1]) < int(A[j - 1][1]):
                    # alter position
                    a, b = A[j - 1], A[j]
                    A[j - 1], A[j] = b, a
                    has_finished = True
                    count += 1
            i += 1

        return A

    def selection_sort(A: list, N:int) -> list:
        """
        :A[N]: サイズがNの整数型配列。
        :i: 未ソートの部分の先頭を指すループ変数で、配列の先頭から末尾に向かって移動する。
        :minj: 各ループの処理でi 番目からN-1 番目までの要素で最小のものの位置。j 未ソートの部分から最小値の位置（minj）を探すためのループ変数。
        """
        for i in range(0, N):
            minj = i
            for j in range(i, N):
                if int(A[j][1]) < int(A[minj][1]):
                    minj = j
            # alter position
            if i != minj:
                a, b = A[i], A[minj]
                A[i], A[minj] = b, a

        return A

    A_1 = A.copy()
    A_2 = A.copy()
    bubble_result = bubble_sort(A_1, N)
    selection_result = selection_sort(A_2, N)


    return bubble_result, selection_result


N = int(input())
A = list(input().split())

bubble_result, selection_result = stable_sort(A, N)

print(*bubble_result)
print("Stable")
print(*selection_result)
if bubble_result != selection_result:
    print("Not stable")
else:
    print("Stable")


Measured memory_bytes: 6348
/*Function Template*/
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> pint;
const int MAX = 510000;
const int MOD = 1000000007;
#define rep(i, n) for(ll i = 0; i < (n); i++)
#define Rep(i, n) for(ll i = 1; i < (n); i++)
#define ALL(a)  (a).begin(),(a).end()
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ll fac[MAX], finv[MAX], inv[MAX];


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;
}
// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }

}
ll Len(ll n) {
  ll s=0;
  while(n!=0) s++, n/=10;
  return s;
}


ll Sint(ll n) {
  ll m=0,s=0,a=n;
  while(a!=0) s++, a/=10;
  for(ll i=s-1;i>=0;i--) m+=n/((ll)pow(10,i))-(n/((ll)pow(10,i+1)))*10;
  return m;
}


ll Svec(vector<ll> v){
  ll n=0;
  for(ll i=0;i<v.size();i++) n+=v[i];
  return n;
}


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


ll LCM(ll a,ll b){
  return a/GCD(a,b)*b;
}


ll Factorial(ll n){
  ll m=1;
  while(n>=1) m*=n,n--;
  return m;
}

void runlength(string s,vector<pair<char,ll>> &p){
  ll x=1;
  if(s.size()==1){
    p.push_back(pair<char,ll>(s[0],1));
  }
  for(ll i=0;i<s.size()-1;i++){
    if(s[i]==s[i+1]){
      x++;
      if(i==s.size()-2){
        p.push_back(pair<char,ll>(s[i],x));
      }
    }else{
      p.push_back(pair<char,ll>(s[i],x));
      x=1;
      if(i==s.size()-2){
        p.push_back(pair<char,ll>(s[s.size()-1],x));
      }
    }
  }
}




ll COM(ll n,ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

const int MAX_N=100010;
vector<bool> sieve_of_eratosthenes(){
  vector<bool> isPrime(MAX_N+1,true);
  for(int i=2;i<=MAX_N;i++){
    if(isPrime[i]){
      for(int j=2*i;j<=MAX_N;j+=i){
        isPrime[j]=false;
      }
    }
  }
  return isPrime;
}

vector<pint> prime_factorize(ll n){
  vector<pint> ans;
  for(ll p=2;p<=sqrt(n);p++){
    if(n%p!=0) continue;
    ll cnt=0;
    while(n%p==0){
      n/=p;
      cnt++;
    }
    ans.push_back(make_pair(p,cnt));
  }
  if(n!=1) ans.push_back(make_pair(n,1));
  return ans;
}

/*↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓*/
int main() {
  IOS;
  ll n;
  cin>>n;
  vector<ll> a(n),b(n),v(n);
  vector<vector<ll>> ans;
  rep(i,n) cin>>a[i];
  rep(i,n) cin>>b[i];
  rep(i,n) v[i]=i+1;
  do{
    ans.push_back(v);
  }while(next_permutation(ALL(v)));
  cout<<abs((lower_bound(ALL(ans),a)-ans.begin())-(lower_bound(ALL(ans),b)-ans.begin()))<<endl;
}

Measured memory_bytes: 4408
use std::io::stdin;
use std::str::FromStr;
#[allow(dead_code, unused_mut)]
fn read<T: FromStr>() -> T {
    let mut s = String::new();
    stdin().read_line(&mut s).ok();
    s.trim().parse().ok().expect("1")
}
#[allow(dead_code, unused_mut)]
fn read_vec<T: FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().expect("2"))
        .collect()
}
#[allow(dead_code, unused_mut)]
fn read_two<T: FromStr>() -> (T, T) {
    let mut s = String::new();
    stdin().read_line(&mut s).unwrap();
    let mut x = s.split_whitespace().map(|x| x.parse().ok().unwrap());
    (x.next().unwrap(), x.next().unwrap())
}
#[allow(dead_code, unused_mut)]
fn read_three<T: FromStr>() -> (T, T, T) {
    let mut s = String::new();
    stdin().read_line(&mut s).unwrap();
    let mut x = s.split_whitespace().map(|x| x.parse().ok().unwrap());
    (x.next().unwrap(), x.next().unwrap(), x.next().unwrap())
}
#[allow(dead_code)]
fn remove_whitespace(s: &str) -> String {
    s.chars().filter(|c| !c.is_whitespace()).collect()
}

#[allow(unused_imports)]
use std::io::{stdout, Write};
#[allow(unused_imports)]
use std::collections::HashMap;
fn gcd(mut x: u64, mut y: u64) -> u64 {
    let mut z = x;
    let mut gcd_num = x;
    while z != 0 {
        gcd_num = z;
        z = y % x;
        y = x;
        x = z;
    }
    gcd_num
}
fn main() {
    let v: Vec<f64> = read_vec();
    let k1: f64 = (v[2] / 12.0 + v[3] / (12.0 * 60.0)) * 2.0 * 3.14159265358979;
    let k2: f64 = v[3] / 60.0 * 2.0 * 3.14159265358979;
    let ans: f64 = ((v[0] * k1.sin() - v[1] * k2.sin()).powf(2.0) + (v[0] * k1.cos() - v[1] * k2.cos()).powf(2.0)).powf(0.5);
    println!("{}", ans);
}


Measured memory_bytes: 2908
// Why am I so dumb? :c
#include <bits/stdc++.h>

#define pb push_back
#define mp make_pair

#define all(x) (x).begin(), (x).end()

#define fi first
#define se second

using namespace std;

typedef long long ll;

const int MAXN = (int)1e5 + 5;

ll cl[MAXN], cr[MAXN];

ll arr[MAXN];

int n;

void solve() {                   
	scanf("%d", &n);

    for (int i = 1; i <= n; ++i) {
    	scanf("%lld", &arr[i]);
    }

    if (arr[n] > 2) {
    	printf("-1\n");
    	return;
    }

    cl[n] = 2, cr[n] = 2;

    for (int i = n - 1; i > 0; --i) {
    	cr[i] = (cr[i + 1] + arr[i + 1] - 1) / arr[i] * arr[i];
    	cl[i] = (cl[i + 1] + arr[i] - 1) / arr[i] * arr[i];

    	if (cr[i] - (cr[i] % arr[i + 1]) > cr[i + 1]) {
    		printf("-1\n");
    		return;
    	}

    	if (cl[i] - (cl[i] % arr[i + 1]) < cl[i + 1]) {
    		printf("-1\n");
    		return;
    	}

        if (cr[i] < cl[i]) {
        	printf("-1\n");
        	return;
        }
  	}

    printf("%lld %lld\n", cl[1], cr[1] + arr[1] - 1);
}

int main() {    
    int tt = 1;

    while (tt--) {
        solve();
    }

    return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int MX = 1e5+2;
string qry[MX];
int cnt[3];
vector<char> ans;
pair<int, int> to_ab(string &s) {
	if(s == "AB")
		return {0, 1};
	else if(s == "AC")
		return {0, 2};
	else
		return {1, 2};
}
int32_t main() {
	ios::sync_with_stdio(0);cin.tie(0);
	int n;
	cin >> n;
	for(int i=0; i<3; i++) {
		cin >> cnt[i];
	}
	for(int i=0; i<n; i++) {
		cin >> qry[i];
	}
	for(int i=0; i<n; i++) {
		int a, b;
		tie(a, b) = to_ab(qry[i]);
		bool add_a = 1;
		if(!cnt[a] && !cnt[b])
			return !(cout << "No");
		else if(cnt[a] == 1 && cnt[b] == 1) {
			auto [na, nb] = to_ab(qry[i+1]);
			add_a = (a == na) || (a == nb);
		} else {
			add_a = cnt[a] < cnt[b];
		}
		if(add_a) {
			ans.push_back(qry[i][0]);
			cnt[a]++;
			cnt[b]--;
			if(cnt[b] < 0)
				exit(123);
		} else {
			ans.push_back(qry[i][1]);
			cnt[b]++;
			cnt[a]--;
			if(cnt[a] < 0)
				exit(456);
		}
	}
	cout << "Yes\n";
	for(char c: ans)
		cout << c << '\n';
}

Measured memory_bytes: 6920
#include <stdio.h>

int A[100000];


int binarysearch(int key,int n){
	int left = 0;
	int right = n;
	int mid;
	
	while(left < right){
		mid = (left + right) / 2;
		if(key == A[mid]) return 1;
		if(key > A[mid]){
			 left = mid + 1;
		}else if(key < A[mid]){
			right = mid;
		}
	}
return 0;

}


int main(void){
	
	int i,n,q,key,sum=0;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d",&A[i]);
	}
	scanf("%d",&q);
	for(i=0;i<q;i++){
		scanf("%d",&key);
		if(binarysearch(key,n) == 1) sum++;
	}
	
	printf("%d\n",sum);
		
return 0;
}



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

N = int(input())

ans = 1
count = 0
for i in range(1, N + 1):
    c = 0
    tmp = i
    if tmp % 2 == 0:
        c += 1
        tmp /= 2
        while tmp % 2 == 0:
            c += 1
            tmp /= 2
    if count < c:
        ans = i
        count = c

print(ans)


Measured memory_bytes: 2940
#include <iostream>
#include <map>

using namespace std;

map<int, int> memo;

int count(int n) {
	if (memo.find(n) != memo.end()) return memo[n];

	int m6 = 6;
	int m9 = 9;
	while (m6*6 <= n) {
		m6 *= 6;
	}
	while (m9*9 <= n) {
		m9 *= 9;
	}

	int c6 = 1 + count(n - m6);
	int c9 = 1 + count(n - m9);
	memo[n] = min(c6, c9);
	return min(c6, c9);
}

int main() {
	memo[0] = 0;
	memo[1] = 1;
	memo[2] = 2;
	memo[3] = 3;
	memo[4] = 4;
	memo[5] = 5;
	memo[6] = 1;
	memo[7] = 2;
	memo[8] = 3;
	memo[9] = 1;
	int n;
	cin >> n;
	cout << count(n) << endl;
}


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

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            //[summary]A - Rating Goal
            var line = ReadLines(2);
            int R = line[0];
            int G = line[1];

            Console.WriteLine(G * 2 - R);
        }

        static List<int> ReadLines(int count = 0)
        {
            //[summary]コンソールの値を読み込む
            var lines = new List<int>();
            string s;

            //読み込む行数が未指定のときは、1行目の値を"count"とみなす
            if (count == 0)
            {
                s = Console.ReadLine().TrimEnd();
                count = int.Parse(s);
            }

            for (int i = 0; i < count; i++)
            {
                s = Console.ReadLine().TrimEnd();
                lines.Add(int.Parse(s));
            }

            return lines;
        }
    }
}

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

void kmp(char String[],int next[]){
    next[1] = 0;
    int i = 1;
    int j = 0;
    while(i < strlen(String) && j < strlen(String)){
        if(j == 0 || String[i] == String[j]){
        i++;
        j++;
        next[i] = j;

        }else{
            j = next[j];
        }
    }


}


int main()
{
    int next[105];

    char Stringc[105];
    char String[105];

    int i=0;
    int j=0;
    int k=0;

    scanf("%s",Stringc);
    scanf("%s",String);

    int length=strlen(String);
    int lengthc=strlen(Stringc);
    for(i = 0 ; i <= length ; i++){
        next[i] =   0;
    }
    kmp(String , next);

    for(i = 0 ; i < 2*lengthc ; ){
        if(j == length)
            break;
        if(j == 0 || Stringc[i%lengthc] == String[j]){
            j++;
            i++;
        }else{
            j = next[j];
        }
    }
    if(j!=length){
        printf("No\n");
    }else{
        printf("Yes\n");
    }
    return 0;
}


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

int main(){
    int n;
    cin>>n;
    vector<ll> a(n);
    rep(i,n){
        cin>>a[i];
    }

    ll m = 1000;
    ll stock = 0;
    rep(i,n-1){
        if(a[i]>a[i+1]){
            m += stock*a[i];
            stock = 0;
        }else if(a[i]<a[i+1]){
            stock += m/a[i];
            m = m%a[i];
        }
    }

    m += stock*a[n-1];
    cout<<m<<endl;
    return 0;
}

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

using namespace std;

int N,K;
vector<int> h;

int main(){
    cin >> N >> K;
    h.resize(N);
    for(int i=0;i<N;i++) cin >> h[i];
    sort(h.begin(),h.end());
    int min = 1e9;
    for(int i=0;i<N-K+1;i++){
        if(min > h[i+K-1]-h[i]) min = h[i+K-1]-h[i];
    }
    cout << min << endl;
    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long lld;
 
const int INF = 2000000000;
const int N = 100000 + 10;
lld arr[N], cnt[N], sm[N];
 
int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);
	int n, m;cin>>n>>m;
	for(int i=0;i<n;i++) cin>>arr[i];
	lld sumL=0, sumR=0;
	for(int i=0;i<n-1;i++) sumL+=arr[i];
	for(int i=1;i<n;i++) sumR+=arr[i]+m*(arr[i-1]>arr[i]);
	for(int i=1;i<n;i++){
		if(arr[i-1]>arr[i]){
			cnt[arr[i-1]+1]+=1;
			cnt[m+1]-=1;
			cnt[1]+=1;
			cnt[arr[i]+1]-=1;
			sm[arr[i-1]+1]+=arr[i-1];
			sm[m+1]-=arr[i-1];
			sm[1]+=arr[i-1]-m;
			sm[arr[i]+1]-=arr[i-1]-m;
		}else{
			cnt[arr[i-1]+1]+=1;
			cnt[arr[i]+1]-=1;
			sm[arr[i-1]+1]+=arr[i-1];
			sm[arr[i]+1]-=arr[i-1];
		}
	}
	for(int i=1;i<=m+1;i++) cnt[i]+=cnt[i-1];
	for(int i=1;i<=m+1;i++) sm[i]+=sm[i-1];
	lld val=sumR-sumL;
	for(int i=1;i<=m;i++) val=min(val, sumR-sumL-cnt[i]*(i-1)+sm[i]);
	cout<<val<<'\n';
	return 0;
}

Measured memory_bytes: 2560
import java.util.*
import java.math.*

fun main(args: Array<String>) {
//    var (N,L) = readLine()!!.split(" ").map { it.toInt() }
    var N = readLine()!!.toInt()
//    val S = readLine()!!.toInt()
//    val P = readLine()!!.split(" ").map { it.toInt() }.toIntArray()

    var ans = 0
    for (i in 1..N){
        if (Math.log10(i.toDouble()).toInt() %2==0) ans++
    }

    println(ans)
}


Measured memory_bytes: 30048
#include<stdio.h>
#include<string.h>

int main(){
    char s1[101], s2[101];
    int a = 0;
    int b[2] = {0, 0};
    int i = 0;
    scanf("%d", &a);
    
    for(i = 0; i < a; i++) {
        scanf("%s %s", s1, s2);
        
        if( strcmp(s1, s2) == 0 ) {
            b[0]++;
            b[1]++;
        }
        else if( strcmp(s1, s2) > 0 ) {
            b[0] += 3;
        }
        else if( strcmp(s1, s2) < 0 ) {
            b[1] += 3;
        }
    }
    
    printf("%d %d\n", b[0], b[1]);
    return 0;
}


Measured memory_bytes: 2052
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
const lint mod = 998244353;
#define all(x) (x).begin(), (x).end()
#define bitcount(n) __builtin_popcountl((lint)(n))
#define fcout cout << fixed << setprecision(15)
#define highest(x) (63 - __builtin_clzl(x))
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T = string, class U = char>int character_count(T text, U character){ int ans = 0; for(U i: text){ ans += (i == character); } return ans; }
lint power(lint base, lint exponent, lint module){ if(exponent % 2){ return power(base, exponent - 1, module) * base % module; }else if(exponent){ lint root_ans = power(base, exponent / 2, module); return root_ans * root_ans % module; }else{ return 1; }}
struct position{ int y, x; }; position mv[4] = {{0, -1}, {1, 0}, {0, 1}, {-1, 0}}; // double euclidean(position first, position second){ return sqrt((second.x - first.x) * (second.x - first.x) + (second.y - first.y) * (second.y - first.y)); }
template<class T, class U> string to_string(pair<T, U> x){ return to_string(x.first) + "," + to_string(x.second); } string to_string(string x){ return x; }
template<class itr> void array_output(itr start, itr goal){ string ans; for(auto i = start; i != goal; i++) ans += to_string(*i) + " "; if(!ans.empty()) ans.pop_back(); cout << ans << endl; }
template<class itr> void cins(itr first, itr last){ for(auto i = first; i != last; i++){ cin >> (*i); } }
template<class T> T gcd_calc(T a, T b){ if(b){ return gcd_calc(b, a % b); }else{ return a; }}
template<class T> T gcd(T a, T b){ if(a < b) swap(a, b); return gcd_calc(a, b); }
template<class T> T lcm(T a, T b){ return a / gcd(a, b) * b; }
struct combination{ vector<lint> fact, inv; combination(int sz) : fact(sz + 1), inv(sz + 1){ fact[0] = 1; for(int i = 1; i <= sz; i++){ fact[i] = fact[i - 1] * i % mod; } inv[sz] = power(fact[sz], mod - 2, mod); for(int i = sz - 1; i >= 0; i--){ inv[i] = inv[i + 1] * (i + 1) % mod; } } lint C(int p, int q) const{ if(q < 0 || p < q) return 0; return (fact[p] * inv[q] % mod * inv[p - q] % mod); } };
template<class itr> bool next_sequence(itr first, itr last, int max_bound){ itr now = last; while(now != first){ now--; (*now)++; if((*now) == max_bound){ (*now) = 0; }else{ return true; } } return false; }
inline int at(int x, int k){ return (x >> k) & 1; }
random_device rnd;

string day[7] =  {"Sunny", "Cloudy", "Rainy"};

int main(){
    int X, Y;
    cin >> X >> Y;
    cout << X + Y / 2 << endl;
}


Measured memory_bytes: 256
N, M = map(int, input().split())
cities = [int("{}{:010}".format(*tuple(map(int, input().split())))) for _ in range(M)]
sorted_cities = sorted(cities)

ids = {}
cnt = 1
before = -1
for c in sorted_cities:
    id_ = c//10000000000
    if before != id_:
        before = id_
        cnt = 1
    else:
        cnt += 1
    ids[c] = cnt

[print("{:06}{:06}".format(c//10000000000, ids[c])) for c in cities]


Measured memory_bytes: 20016
class Dice:
    D = {'E':(3,1,0,5,4,2), 'W':(2,1,5,0,4,3), 'S':(4,0,2,3,5,1), 'N':(1,5,2,3,0,4)}
    def __init__(self, tp, fwd, rs, ls, bk, bm):
        self.nbrs = [tp, fwd, rs, ls, bk, bm]
    def rll(self, drctn):
        return [self.nbrs[i] for i in self.D[drctn]]


A = input().split()
for i in input():
    dice = Dice(A[0], A[1], A[2], A[3], A[4], A[5])
    A = dice.rll(i)
print(A[0])


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

int main(){
    int N,K;
    int ans = 0;
    cin >> N >> K;
    vector<int> tmp(N);
    rep(j,K){
        int d;
        cin >> d;
        vector<int> A(d);
        rep(i,d){
            cin >> A[i];
            tmp[A[i] - 1] = 1;
        }   
    }

    rep(i,N){
        if(tmp[i] == 0) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define sanyes ios_base::sync_with_stdio(0), cout.tie(0); cin.tie(0);
#define llong long long int
#define pb push_back
#define bpc __builtin_popcount
#define f first
#define s second

const llong mxn = 2 * 1e5 + 7;
const llong mod = 1e9 + 7;
const llong inf = 1e18 + 9;

using namespace std;

llong n, pr[mxn], a[mxn], cnt = 1, sum = 0;

int main(){
    cin >> n;
    for (int i = 1; i <= n; i ++){
        cin >> a[i];
        pr[i] = pr[i - 1] + a[i];
    }sort(pr, pr + n + 1);
    for (int i = 1; i <= n; i ++){
        if(pr[i] == pr[i - 1]){
            cnt ++;
        }else{
            sum += (cnt * (cnt - 1) / 2);
            cnt = 1;
        }if(i == n){
            sum += (cnt * (cnt - 1) / 2);
        }
    }cout << sum;
    return 0;
}


Measured memory_bytes: 3328
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int t = sc.nextInt();
		int[] a = new int[n];
		for (int i = 0; i < a.length; i++) {
			a[i] = sc.nextInt();
		}
		int x = 0,count = 0;
		for (int i = 0; i < a.length; i++) {
			if (count<=t) {
				x++;
			}
			count+=a[i];
		}
      if(count<=t) x++;
		System.out.println(x);
		sc.close();
	}
}

Measured memory_bytes: 23124
def i():
	return int(input())
def i2():
	return map(int,input().split())
def s():
	return str(input())
def l():
	return list(input())
def intl():
	return list(int(k) for k in input().split())

n = i()
a = [int(i) for i in input().split()]

cnt = 1
ans = 0
for i in range(n):
	if a[i] == cnt:
		cnt += 1
	else:
		ans += 1
if cnt == 1:
	print(-1)
else:
	print(ans)

Measured memory_bytes: 32220
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
  int a,b,c,d,e,f,g;
  cin >> a >> b >> c >> d >> e;
  f=min(a,b);
  f=min(f,c);
  g=min(d,e);
  cout << f+g-50 << endl;
  return 0;
}

Measured memory_bytes: 1164
#include <cstdio>
long long A[100001];
int main()
{
    long long N,add,target,temp,f;
    scanf("%lld",&N);
    add=0;
    for(long long i=0;i<N;i++)
        scanf("%lld",&A[i]);
    for(long long i=0;i<N;i++)
        add+=A[i];
    f=0;
    if(add%(N*(N+1)/2)!=0)
        printf("NO\n");
    else
    {
        target=add/(N*(N+1)/2);
        for(long long i=N-1;i>=0;i--)
            if((A[(N-i+N)%N]-A[(N-i-1+N)%N]-target)%N!=0||(A[(N-i+N)%N]-A[(N-i-1+N)%N]-target)/N>0)
            {
                f=1;
                break;
            }
        if(f==0)
            printf("YES\n");
        else printf("NO\n");
    }
    return 0;
}


Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
struct point {
    int x;
    int y;
    int a;
};

int main() {
    int W, H, N;
    cin >> W >> H >> N;

    vector<point> points(N);
    for (int i = 0; i < N; i++) {
        cin >> points[i].x >> points[i].y >> points[i].a;
    }
    vector<vector<bool>> field(W + 1, vector<bool>(H + 1, false));

    for (int i = 0; i < N; i++) {
        if (points[i].a == 1) {
            for (int w = 1; w < points[i].x + 1; w++) {
                for (int h = 1; h < H + 1; h++) {
                    field[w][h] = true;
                }
            }
        } else if (points[i].a == 2) {
            for (int w = points[i].x + 1; w < W + 1; w++) {
                for (int h = 1; h < H + 1; h++) {
                    field[w][h] = true;
                }
            }
        } else if (points[i].a == 3) {
            for (int w = 1; w < W + 1; w++) {
                for (int h = 1; h < points[i].y + 1; h++) {
                    field[w][h] = true;
                }
            }
        } else {
            for (int w = 1; w < W + 1; w++) {
                for (int h = points[i].y + 1; h < H + 1; h++) {
                    field[w][h] = true;
                }
            }
        }
    }
    int output = 0;
    for (int w = 1; w < W + 1; w++) {
        for (int h = 1; h < H + 1; h++) {
            if (!field[w][h]) {
                //  cout << w << " " << h << endl;
                output++;
            }
        }
    }
    cout << output << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define M 1000000007
long long int power(int a,int b)
{
    if(b==0)
        return 1;
    long long int k=power(a,b/2);
    if(b%2==0)
        return ((k%M)*(k%M))%M;
    else
        return ((k%M)*(k%M)*(a%M))%M;
}
long long int fact(long long int n)
{
    if(n==1 || n==0)
        return 1;
    else
        return ((n%M)*(fact(n-1)%M))%M;

}
int div(int n)
{  int c=0;
    for(int i=1;i<=sqrt(n);i++)
    {
        if(n%i==0)
        {
          if(n/i==i)
            c++;
          else
            c+=2;
        }

    }

    
    return  c;
}
int func(int n)
{
    return (n*(n+1))/2;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
     #ifndef ONLINE_JUDGE
 
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
 
   #endif
   
   string a,b;
   cin>>a>>b;
   sort(a.begin(),a.end());
   sort(b.begin(),b.end(),greater<int>());
   int i=0;
   if(a.size()==b.size())
  {
     while(i!=a.size())
   {
      if(a[i]>b[i])
      {
        cout<<"No";
        return 0;
      }
      else if(a[i]==b[i])
      {
           
        i++;
      }
      else 
      {
        cout<<"Yes";
        return 0;
      }
   }
   if(i==a.size())
   {
    cout<<"No";
    return 0;
   }
  }
   i=0;
   if(a.size()<b.size())
   {    
        while(i!=a.size())
       {
                if(a[i]>b[i])
              {
                cout<<"No";
                return 0;
              }
              else if(a[i]==b[i])
              {
                   
                i++;
              }
              else 
              {
                cout<<"Yes";
                return 0;
              }
      }
    if(i==a.size())
    {
        cout<<"Yes";
        return 0;
    }

         
   }
   i=0;
   if(a.size()>b.size())
   {
        while(i!=b.size())
       {
                if(a[i]>b[i])
              {
                cout<<"No";
                return 0;
              }
              else if(a[i]==b[i])
              {
                   
                i++;
              }
              else 
              {
                cout<<"Yes";
                return 0;
              }
      }
      if(i==b.size())
      {
        cout<<"No";
        return 0;
      }

   }




 return 0;
}








Measured memory_bytes: 3676
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdio>

using namespace std;

typedef long long ll;
const int maxn=2e5+10;
int a[maxn];

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	string s;
	cin>>s;
	int cnt=0;
	int ans=0;
	for(int i=0;i<s.size();i++){
		cnt=0;
		while(s[i]=='R') cnt++,i++;
		ans=max(ans,cnt);
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
#define int long long
using ll=long long;
using vi=vector<int>;
using vl=vector<long long>;
using pii=pair<int,int>;
using pll=pair<long long,long long>;
#define ITR(i,c) for(auto i=begin(c);i!=end(c);++i)
#define FORE(x,c) for(auto &x:c)
#define REPF(i,a,n) for(int i=a,i##len=(int)(n);i<i##len;++i)
#define REP(i,n) REPF(i,0,n)
#define REPR(i,n) for(int i=(int)(n);i>=0;--i)
#define REPW(i,n) for(i=0;i<(int)(n);++i)
#define ALL(c) begin(c),end(c)
#define RALL(c) rbegin(c),rend(c)   // c++14
#define SZ(c) ((int)c.size())
#define EXIST(c,x) (c.find(x)!=end(c))
#define OUTOFRANGE(y,x,h,w) (y<0||x<0||y>=h||x>=w)
#define dump(...)
const int DX[9]={0,1,0,-1,1,1,-1,-1,0},DY[9]={-1,0,1,0,-1,1,1,-1,0};
#define INF (1001001001)
#define INFLL (1001001001001001001ll)
template<class T> ostream& operator << (ostream &os,const vector<T> &v) {
    ITR(i,v) os << *i << (i==end(v)-1 ? "" : "\n"); return os; }
template<class T> istream& operator >> (istream &is,vector<T> &v) {
    ITR(i,v) is >> * i; return is; }
template<class T> istream& operator >> (istream &is, pair<T,T> &p) {
        is >> p.first >> p.second; return is; }
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;}
//------------------------------------------------------------------------------
struct before_main_function {
    before_main_function() {
        #ifdef int
            #undef INF
            #define INF INFLL
            #define stoi stoll
        #endif
        cin.tie(0);ios::sync_with_stdio(false);
        cout<<setprecision(15)<<fixed;
    }
} before_main_function;
//------------------------------------------------------------------------------

signed main() {
    int N,k;
    cin>>N>>k;
    int x=0;
    REP(i,N-1) {
        int l=0,r=1e18;
        while(r-l>1) {
            int m=(l+r)/2;
            int y=(m-(m/k+1));
            if(x<=y) r=m;
            else l=m;
        }
        x=r;
    }
    cout<<x<<endl;
    return 0;
}

Measured memory_bytes: 3220
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int W = sc.nextInt();
		int H = sc.nextInt();
		int x = sc.nextInt();
		int y = sc.nextInt();
		int count = 0;

		double ans = (double)W*H/2;
		if(W == 2*x && H == 2*y) {
			count = 1;
		}
		System.out.println(ans +" "+count);
	}
}

Measured memory_bytes: 23764
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>

using namespace std;

int main(void) {
    int N, K;
    cin >> N >> K;
    vector< pair<int,int> > sushi(N);
    for(int i=0; i<N; i++) {
        cin >> sushi[i].second >> sushi[i].first;
        sushi[i].second--;
    }

    sort(sushi.rbegin(), sushi.rend());
    int64_t ans = 0, sum = 0, x = 0;
    vector<int> v(N);
    priority_queue<int, vector<int>, greater<int> > pq;
    for(int i=0; i<K; i++) {
        int64_t d = sushi[i].first;
        int t = sushi[i].second;
        sum += d;
        if(v[t]) {
            pq.emplace(d);
        } else {
            v[t] = 1;
            ++x;
        }
    }

    ans = sum + x*x;
    for(int i=K; i<N; i++) {
        if(pq.empty()) break;
        int64_t d = sushi[i].first;
        int t = sushi[i].second;
        if(v[t]) continue;
        v[t] = 1;
        ++x;
        sum += d;
        sum -= pq.top();
        pq.pop();
        ans = max(ans, sum + x*x);
    }

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


Measured memory_bytes: 1792
#include <cstdio>
#include <cctype>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;

#define ll long long
#define reg register
#define rep(i, a, b) for (reg int i = (a), i##end = (b); i <= i##end; ++i)
#define dep(i, a, b) for (reg int i = (a), i##end = (b); i >= i##end; --i)

template <typename _typer> inline _typer read() {
    _typer init = 0;
    char ch = getchar(), k = 0;
    for ( ; !isdigit(ch); ch = getchar()) k = (ch == '-');
    for ( ; isdigit(ch); ch = getchar())
        init = (init << 3) + (init << 1) + (ch ^ 48);
    return k ? -init : init;
}
const ll N = 0, INF = 1e9;

/*******************************************************************************
 *
 *
 *
 ******************************************************************************/

int main() {
    double sum = 0;
    int n = read<int>();
    rep (i, 1, n) {
        int x = read<int>();
        sum = sum + 1.0 / x;
    }
    printf("%.7lf\n", 1.0 / sum);
    return 0;
}



Measured memory_bytes: 256
import java.util.LinkedList;
import java.util.PriorityQueue;
import java.util.Scanner;
import java.util.Set;
import java.util.Stack;
import java.util.TreeSet;

//Pile Up!
public class Main{

	void run(){
		Scanner sc = new Scanner(System.in);
		for(;;){
			int n = sc.nextInt();
			if(n==0)break;
			Set<Integer> floor = new TreeSet<Integer>();
			LinkedList<Stack<Integer>> pile = new LinkedList<Stack<Integer>>();
			for(int i=1;i<=n;i++)floor.add(i);
			for(;;){
				int a = sc.nextInt();
				int b = sc.nextInt();
				if((a|b)==0)break;
				if(a==b)continue;
				if(b==0){
					if(floor.contains(a))continue;
					for(Stack<Integer> s:pile){
						if(s.contains(a)){
							if(s.get(0)==a)break;
							while(s.peek()!=a){
								floor.add(s.pop());
							}
							floor.add(s.pop());
							break;
						}
					}
					continue;
				}
				int ai = -1;
				int bi = -1;
				for(int i=0;i<pile.size();i++){
					if(pile.get(i).contains(a))ai = i;
					if(pile.get(i).contains(b))bi = i;
				}
				if(ai==bi&&ai!=-1){
					Stack<Integer> s = pile.get(ai);
					int aj = s.search(a);
					int bj = s.search(b);
					if(aj<bj)continue;
					while(s.peek()!=a){
						floor.add(s.pop());
					}
					floor.remove(b);
					Stack<Integer> st = new Stack<Integer>();
					st.push(b); st.push(s.pop());
					pile.add(st);
					if(s.isEmpty())pile.remove(ai);
					continue;
				}
				if(ai!=-1){
					Stack<Integer> s = pile.get(ai);
					while(s.peek()!=a)floor.add(s.pop());
					s.pop();
					if(s.isEmpty())pile.remove(ai);
					for(int i=0;i<pile.size();i++)if(pile.get(i).contains(b))bi=i;
				}
				else floor.remove(a);
				if(bi!=-1)pile.get(bi).push(a);
				else{
					Stack<Integer> st = new Stack<Integer>();
					floor.remove(b);
					st.push(b); st.push(a);
					pile.add(st);
				}
			}
			PriorityQueue<Integer> q = new PriorityQueue<Integer>();
			for(int i=0;i<floor.size();i++)q.add(1);
			for(Stack<Integer> s:pile)q.add(s.size());
			while(!q.isEmpty())System.out.println(q.poll());
			System.out.println("end");
		}
	}
	
	public static void main(String[] args) {
		new Main().run();
	}
}

Measured memory_bytes: 12000
def resolve():
    S = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
    k = int(input())
    print(S[k-1])

if __name__ == '__main__':
    resolve()

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

const int N = 1e5 + 5, mod = 1e9 + 7;

int n, k, a[101], dp[N];

signed main() {
	cin >> n >> k;
	for (int i = 1; i <= n; i++) {
		cin >> a[i];
	}
	for (int i = 1; i <= k; i++) {
		for (int j = 1; j <= n; j++) {
			int x = a[j];
			if (i >= x) {
				if (!dp[i - x]) {
					dp[i] = 1;
				}
			}
		}
	}
	cout << (dp[k] ? "First" : "Second");
}

Measured memory_bytes: 1024
BIG = 20000000
SMALL =-20000000
n = int(input())
table = list(map(int, input().split()))

maxnum=SMALL
minnum=BIG
total=0
for a in table:
    total=total+a
    if a <minnum:
        minnum=a
    
    if a>maxnum:
        maxnum=a
        
print("%d %d %d"%(minnum,maxnum,total))


Measured memory_bytes: 6596
import java.util.Scanner;
 
public class Main {
  public static void main(String[] args){
  Scanner scan = new Scanner(System.in);
   
  int A = scan.nextInt();
  int B = scan.nextInt();
  int C = scan.nextInt();
  scan.close();

  	if(A <= C && C<=B){
  	System.out.println("Yes");
  	
  	}else{
  	System.out.println("No");
  	}
  }
}


Measured memory_bytes: 22604
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <map>
#include <vector>
#include <math.h>
#include <algorithm>
#include <queue>
#include <set>
using namespace std;

#define rep(i,a) for(int i=0; i<a; i++)
#define rrep(i,a) for(int i=a; i>=0; i--)
#define loop3(i,j,k,a) for(int i=0; i<a; i++)for(int j=0; j<a; j++)if(i!=j)for(int k=0; k<a; k++)if(i!=k&&j!=k)
#define loop4(i,j,k,l,a) for(int i=0; i<a; i++)for(int j=0; j<a; j++)if(i!=j)for(int k=0; k<a; k++)if(i!=k&&j!=k)for(int l=0; l<a; l++)if(i!=l&&j!=l&&k!=l)
#define rep1(i,a) for(int i=1; i<=a; i++)

#define scnd1(a) scanf("%d", &a)
#define scnd2(a,b) scanf("%d%d", &a,&b)
#define scnd3(a,b,c) scanf("%d%d%d", &a,&b,&c)
#define scnd4(a,b,c,d) scanf("%d%d%d%d", &a,&b,&c,&d)

#define cin1(a) cin >> a;
#define cin2(a,b) cin >> a >> b;
#define cin3(a,b,c) cin >> a >> b >> c;
#define cin4(a,b,c,d) cin >> a >> b >> c >> d;
#define cout1(a) cout << a << endl;
#define cout2(a,b) cout << a << " " << b << endl;
#define cout3(a,b,c) cout << a << " " << b << " " << c << endl;
#define cout4(a,b,c,d) cout << a << " " << b << " " << c << " " << d << endl;
#define prtd1(a) printf("%d\n", a)
#define prtd2(a,b) printf("%d %d\n", a,b)
#define prtd3(a,b,c) printf("%d %d %d\n", a,b,c)
#define prtd4(a,b,c,d) printf("%d %d %d %d\n", a,b,c,d)

#define mem(a,n) memset( a, n, sizeof(a))
typedef long long ll;
const int INF = 1e9;
const ll LLINF = 1e18;

int main() {
    string S;
    cin>>S;
    
    int cnt=0;
    char c=S[0];
    rep(i,S.size()){
        if(S[i]!=c){
            cnt++;
            c = S[i];
        }
    }
    cout<<cnt<<endl;
}

Measured memory_bytes: 512
# -*- coding: utf-8 -*-
import numpy as np
s = np.array(list(input()))
t = np.array(list(input()))

t_len = len(t)
chk_num = len(s) - t_len

change_num = t_len
for i in range(chk_num + 1):
    tmp = t_len - np.count_nonzero(s[i: t_len + i] == t)
    change_num = min(tmp, change_num)

print(change_num)


Measured memory_bytes: 27128
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
const ll INF = 1LL << 60;

int main(){
    int n;
    cin >> n;
    vector<int> aa(n);
    vector<int> ab(n);
    rep(i,n) cin >> aa[i];
    rep(i,n) cin >> ab[i];

    int ans=0;
    for(int i=0; i<n; i++){
        int count=0;
        for(int j=0; j<=i; j++){
            count += aa[j];
        }
        for(int k=i; k<n; k++){
            count += ab[k];
        }
        ans = max(ans,count);
    }
    cout << ans << endl;

}

Measured memory_bytes: 3584
#include <cmath>
#include <iomanip>
#include <iostream>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;

int main(void) {
  ios::sync_with_stdio(false);
  int64_t a, b, c;
  cin >> a >> b >> c;
  int64_t abx4 = 4 * a * b;
  int64_t cab = (c - a - b);
  int64_t cab2 = cab * cab;
  if (cab < 0) {
    cout << "No" << endl;
  } else {
    if (abx4 < cab2)
      cout << "Yes" << endl;
    else
      cout << "No" << endl;
  }

  return 0;
}


Measured memory_bytes: 256
def ForBaseConvert(Roop,MaxD,Base):
    if all(type(TT) is int for TT in [Roop,MaxD,Base]):
        if Base>=2 and MaxD>=1:
            ConvertN = []
            while Roop>0:
                ConvertN.append(Roop%Base)
                Roop = Roop//Base

            BaseConv = [0]*(MaxD-len(ConvertN))+ConvertN[::-1]
            BaseSInd = [[] for TB in range(0,Base)]
            for TB in range(0,Base):
                BaseSInd[TB] = [SInd for SInd,SNum in enumerate(BaseConv) if SNum==TB]
            return BaseConv,BaseSInd
        else:
            return []
    else:
        return []
      
N = int(input())
F = [[] for TF in range(0,N)]
for TF in range(0,N):
    F[TF] = [int(T) for T in input().split()]
P = [[] for TP in range(0,N)]
for TP in range(0,N):
    P[TP] = [int(T) for T in input().split()]
    
MAXB = -10**9
for TB in range(1,2**10):
    BaseConv,BaseSInd = ForBaseConvert(TB,10,2)
    Benefit = 0
    for TN in range(0,N):        
        Count = sum(1 if F[TN][TT]==1 else 0 for TT in BaseSInd[1])
        Benefit += P[TN][Count]
    if MAXB<Benefit:
        MAXB = Benefit
print(MAXB)

Measured memory_bytes: 9260
#include <bits/stdc++.h>
//#include <vector>
#define ALL(l)  (l).begin(),(l).end()
using namespace std;
typedef long long ll;
 

 
int main(){
    ll n,k,q;
    cin>>n>>k>>q;
    vector<ll> score(n);
    for(int i=0;i<n;i++)score.at(i)=k;
    
    vector<ll> a(q);
    
    for(int i=0;i<q;i++){
        cin>>a.at(i);
        score.at(a.at(i)-1)++;
    }
    for(int i=0;i<n;i++){
        if(score.at(i)<=q)cout<<"No"<<endl;
        else cout<<"Yes"<<endl;
    }
    
}

Measured memory_bytes: 2176
// Exhaustive Search
#include <stdio.h>

int a[20], b[200];

int solve(int i, int m, int n);

int main() {

  int i, j, k, n, q;
  int count;
  int flag = 0;

  // input the number
  scanf("%d", &n);
  for(i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }

  scanf("%d", &q);
  for(i = 0; i < q; i++) {
    scanf("%d", &b[i]);
  }

  // search
  for(i = 0; i < q; i++) {
    flag = 0;
    for(j = 0; j < n; j++) {
      if(solve(j, b[i], n) != 0) flag++;
    }
    if(flag != 0) printf("yes\n");
    else printf("no\n");
  }
  return 0;
}

int solve(int i, int m, int n) {
  int res;
  
  if(m == 0) return 1;
  if(i >= n) return 0;
  res = solve(i + 1, m, n) + solve(i + 1, m - a[i], n);
  return res;
}



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

using namespace std;

const int maxi=1e6+6;

long long  a[maxi];
int n;

int main()
{

    cin>>n;

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

    long long  ans=a[1];

    for (int i=2;i<=n;i++)
    {
        long long p=__gcd(a[i],ans);
        ans/=p;
        ans*=a[i];
    }

  cout<<ans;
  return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define All(a) a.begin(),a.end()
#define INF 1000000007
const int MOD = 1000000007;
//accumulate(vec.begin(), vec.end(), 0)
//std::sort(v.begin(), v.end(), std::greater<Type>());
//set_intersection(x, x+7, y, y+6, back_inserter(v));
//set_union(x, x+7, y, y+6, back_inserter(v));
//set_difference(x, x+7, y, y+6, back_inserter(v));

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

bool isPrime(int n){
  if(n < 2) return false;
  else if(n == 2) return true;
  else if(n%2==0) return false;

  for(int i=3;i<=sqrt(n);i++){
    if(n%i==0) return false;
  }
  return true;
}


int main(){
  int n,m,sum = 0;
  cin >> n;
  vector<int>T(n);
  for(int i=0;i<n;i++){
    cin >> T[i];
    sum += T[i];
  }
  cin >> m;
  for(int i=0;i<m;i++){
    int p,x;
    cin >> p >> x;
    p--;
    cout<< sum-T[p]+x <<endl;
  }


}


Measured memory_bytes: 256