akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<set>
#include<algorithm>
using namespace std;
int main() {
	typedef long long ll;
	ll n, k; cin >> n >> k;
	ll ar[114514];
	set<ll>s;
	for (ll i = 0; i < 114513; i++)ar[i] = 0;
	for (ll i = 0; i < n; i++){
		ll a, b; cin >> a >> b;
		s.insert(a);
		ar[a] += b;
	}
	ll now = 0;
	for (auto i = s.begin(); i != s.end(); i++){
		now += ar[*i];
		if (now >= k) {
			cout << *i << endl;
			return 0;
		}
	}
}

Measured memory_bytes: 4096
fun main(args: Array<String>) {
    val (a, v) = readLine()!!.split(" ").map { it.toLong() }
    val (b, w) = readLine()!!.split(" ").map { it.toLong() }
    val t = readLine()!!.toLong()

    var tmpA = a
    var tmpB = b
    val moveToRight = a < b

    for (i in 0 until t) {
        if (moveToRight) {
            tmpA += v
            tmpB += w

            if (tmpB <= tmpA) {
                println("YES")
                return
            }
        } else {
            tmpA -= v
            tmpB -= w

            if (tmpA <= tmpB) {
                println("YES")
                return
            }

        }
    }
    println("NO")
}


Measured memory_bytes: 37040
import java.util.Scanner;
import java.util.HashMap;
import java.util.TreeMap;
import java.util.Map;
import java.util.Collections;
import java.util.List;
import java.util.Arrays;
import java.util.ArrayList;
import java.lang.Math;

public class Main {

    private static Scanner sc = new Scanner(System.in);
    private static int mod = (int) 10e8 + 7;

    public static void main(String[] args) {
        int n = sc.nextInt();
        int m = sc.nextInt();
        Map<Integer, Integer> maps = new HashMap<Integer, Integer>();
        int key;
        int value;
        for (int i = 0; i < m; i++) {
            key = sc.nextInt();
            value = sc.nextInt();
            if ((maps.containsKey(key) && maps.get(key) != value) || (key == 1 && value == 0 && n != 1)) {
                System.out.println(-1);
                return;
            }
            maps.put(key, value);
        }
        String first_digit = "0";
        String second_digit = "0";
        String third_digit = "0";
        for (Map.Entry<Integer, Integer> map : maps.entrySet()) {
            if (map.getKey() == 1) {
                first_digit = String.valueOf(map.getValue());
            } else if (map.getKey() == 2) {
                second_digit = String.valueOf(map.getValue());
            } else if (map.getKey() == 3) {
                third_digit = String.valueOf(map.getValue());
            }
        }
        if (n == 1) {
            System.out.println(first_digit);
        } else if (n == 2) {
            if (maps.containsKey(1)) {
                System.out.println(first_digit+second_digit);
            } else {
                System.out.println("1"+second_digit);
            }
        } else {
            if (maps.containsKey(1)) {
                System.out.println(first_digit+second_digit+third_digit);
            } else {
                System.out.println("1"+second_digit+third_digit);
            }
        }
    }

}


Measured memory_bytes: 23252
MOD = 10**9+7
h, w = map(int, input().split())
S = [input() for _ in range(h)]
L = [[0]*w for _ in range(h)]
R = [[0]*w for _ in range(h)]
U = [[0]*w for _ in range(h)]
D = [[0]*w for _ in range(h)]
for i in range(h):
  for j in range(w):
    if j > 0:
      if S[i][j-1] == ".":
        L[i][j] = L[i][j-1]+1
      if S[i][w-j] == ".":
        R[i][w-1-j] = R[i][w-j]+1
    if i > 0:
      if S[i-1][j] == ".":
        U[i][j] = U[i-1][j]+1
      if S[h-i][j] == ".":
        D[h-1-i][j] = D[h-i][j]+1
ans = 0
for i in range(h):
  for j in range(w):
    if S[i][j] == ".":
      temp = L[i][j]+R[i][j]+U[i][j]+D[i][j]+1
      ans = max(ans, temp)
print(ans)

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

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

int main(){
  string S;
  cin>> S;

  int N = S.size();
  int mae = (N-1)/2;
  string ans = "Yes";

  rep(i,(N-1)/2){
    if(S.at(i) != S.at(N-1-i)) ans = "No";
    if(S.at(i) != S.at((N-1)/2 - 1-i)) ans = "No";
  }

  cout << ans;
  
}

Measured memory_bytes: 256
import math

N = int(input())
xy = []
N_root = math.factorial(N)
distance = 0

for i in range(N):
    xy.append( list(map(int, input().split())) )

for i in range(N):
    
    for j in range(i+1, N):
        
        tmp = (xy[i][0] - xy[j][0])**2 + (xy[i][1] - xy[j][1])**2
        distance += math.sqrt(tmp)

distance *= 2 * math.factorial(N-1)

print(distance/N_root)

Measured memory_bytes: 3064
// C.

#include <iostream>
#include <sstream>
#include <algorithm>
#include <vector>
#include <cstdio>

using namespace std;

int main(int argc, char *argv[]) {
	int n;
	cin >> n;
	string s;
	cin >> s;
	int dp[2] = {};
	for (char c : s) {
		int a = dp[0], b = dp[1];
		if (c == '.') {
			dp[0] = a;
			dp[1] = b + 1;
		} else {
			dp[0] = a + 1;
			dp[1] = min(a, b);
		}
	}
	int ans = min(dp[0], dp[1]);
	cout << ans << endl;
	fprintf(stderr, "1\n");
	return 0;
}


Measured memory_bytes: 1336
N = int(input())
Bn = list(map(int,input().split(' ')))
An = [-1 for _ in range(N)]
An[0] = Bn[0]
for i in range(1,N-1):
    An[i] = min(Bn[i-1],Bn[i])
An[N-1] = Bn[N-2]
print(sum(An))

Measured memory_bytes: 3064
function Main(input) {
  input = input.replace(/\n/g, ' ').split(" ");
  var a = Number(input[0]);
  var b = Number(input[1]);
  var c = Number(input[2]);
  var ans =c;
  var mem=b;
  while(true){
    if(mem>=a){
      break;
    }
    ans+=c;
    mem+=b;
  }
  console.log(ans);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 29540
import java.util.*;
import java.lang.*;
import java.io.*;

public class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		
		long a = in.nextLong();
		long b = in.nextLong();
		long max = Math.max(a, b);
		
		for(long i = 0; i < max; i++)
		{
			if(Math.abs(a - i) == Math.abs(b - i))
			{
				out.println(i);
				out.close();
				return;
			}
		}
		
		out.println("IMPOSSIBLE");
		
		out.close();
	}
	
	static class InputReader
	{
		public BufferedReader reader;
		public StringTokenizer tokenizer;
		
		public InputReader(InputStream stream)
		{
			reader = new BufferedReader(new InputStreamReader(stream), 32768);
			tokenizer = null;
		}
		
		public String next()
		{
			while(tokenizer == null || !tokenizer.hasMoreTokens())
			{
				try
				{
					tokenizer = new StringTokenizer(reader.readLine());
				}
				catch(IOException e)
				{
					throw new RuntimeException(e);
				}
			}
			
			return tokenizer.nextToken();
		}
		
		public int nextInt()
		{
			return Integer.parseInt(next());
		}
		
		public long nextLong()
		{
			return Long.parseLong(next());
		}
	}
}

Measured memory_bytes: 23636
D,G = map(int, input().split())
prob_num = []
bonus = []
comp_pt = []
for i in range(D):
    p,b = map(int, input().split())
    prob_num.append(p)
    bonus.append(b)
    comp_pt.append(100*(i+1)*p+b)

def dfs(hascomp:str, target:int, prob:int, depth:int) -> int:
    if target <= 0:
        #print(hascomp, depth, prob)
        return prob
    
    elif depth == D:
        for i in range(D-1,-1,-1):
            if hascomp[i] == "n":
                if target <= 100*(i+1)*(prob_num[i]-1):
                    prob += (target//(100*(i+1)))+bool(target%(100*(i+1)))
                    #print(hascomp, depth, prob)
                    return prob
                
                else:
                    prob += (prob_num[i]-1)
                    target -= 100*(i+1)*(prob_num[i]-1)
                    
        if target > 0:
            #print(hascomp, depth, prob)
            return 10**5
        
    else:
        new_tar = target-comp_pt[depth]
        new_prob = prob + prob_num[depth]
        return min(dfs(hascomp+"y",new_tar, new_prob, depth+1),
                   dfs(hascomp+"n",target, prob, depth+1))
        

ans = dfs("",G,0,0)
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
int main(){
    int  a, b ,c;
    char X,Y;
    string S1,S2;
    cin >> S1 ;
    bool ans = count(S1.begin(),S1.end(),'9');
    if(ans) cout << "Yes" << endl;
    else cout << "No" << endl;
    
}


Measured memory_bytes: 256
#include <iostream>
#include <functional>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <queue>
#include <map>
#include <iomanip>
#include <complex>
#include <random>
#include <bitset>
#include <list>
// #include <prettyprint.hpp>
using namespace std;
#define repi(i,n) for(int i=0;i<n;++i)
#define rep(i,n) for(ll i=0;i<n;++i)
#define repinvi(i,n) for(int i=n-1;i>=0;--i)
#define sll(n) scanf("%lld", &n);
#define sii(n) scanf("%d", &n);
#define slf(n) scanf("%lf", &n);
#define pll pair<ll,ll>
#define pii pair<int,int>
#define psi pair<si,si>
typedef long long ll;
typedef double lf;
typedef short int si;


void Main(){
    ll N;
    string S;
    sll(N);
    cin >> S;
    ll now_right_r = -1;
    ll now_left_w = -1;
    rep(i, N){
        if(S[i] == 'W' && now_left_w == -1){
            now_left_w = i;
        }
        if(S[N-i-1] == 'R' && now_right_r == -1){
            now_right_r = N - i - 1;
        }
    }

    if(now_left_w == -1 || now_right_r == -1){
        cout << 0 <<endl;
    }else{
        ll num = 0;
        while(now_left_w<now_right_r){
            S[now_left_w] = 'R';
            S[now_right_r] = 'W';
            ++ num;
            for(;now_left_w<N;now_left_w++){
                if(S[now_left_w] == 'W'){
                    break;
                }
            }
            for(; now_right_r>=0;now_right_r--){
                if(S[now_right_r] == 'R'){
                    break;
                }
            }
            // cout << num <<endl;
        }
        cout << num <<endl;
    }

}

int main(){
    Main();
}

Measured memory_bytes: 3548
tt, te, at, ae = input().split(" ")
tt = int(tt)
te = int(te)
at = int(at)
ae = int(ae)

win = ""
while True:
    at -= te
    if at <= 0:
        win = "t"
        break
    tt -= ae
    if tt <= 0:
        win = "a"
        break

if win == "t":
    print("Yes")
else:
    print("No")

Measured memory_bytes: 9196
X = int(input())

if(400<=X and X <=599):
    print(8)
elif(600<=X and X<=799):
    print(7)
elif(800<=X and X<=999):
    print(6)
elif(1000<=X and X<=1199):
    print(5)
elif(1200<=X and X<=1399):
    print(4)
elif(1400<=X and X<=1599):
    print(3)
elif(1600<=X and X<=1799):
    print(2)
elif(1800<=X and X<=1999):
    print(1)

Measured memory_bytes: 9212
s = input()
t = input()
n = len(t)-1
ans = len(t)
for i in range(len(s)-n):
  num = 0
  w = s[i:i+n+1]
  for l in range(len(t)):
    if t[l] != w[l]:
      num += 1
  ans = min(num,ans)
print(ans)
  

Measured memory_bytes: 9024
def main():
    N = int(input())
    end = int(N ** 0.5)
    ans = 100100100100100
    for i in range(1, end+1):
        if N % i == 0:
            j = N // i
            ans = min(ans, i+j-2)
    print(ans)


if __name__ == '__main__': main()

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

using namespace std;

#define reg register
#define ll long long
#define ge getchar()
#define Re read()
#define FI "a.in"
#define FO "a.out"
#define MAXN 100100

inline int read() {
	int x = 0, t = 0, ch;
	while(!isdigit(ch = ge)) t |= ch == '-';
	while(isdigit(ch)) x = (x << 1) + (x << 3) + (ch ^ 48), ch = ge;
	return t ? -x : x;
}

int n, q;
int a[MAXN + 1];
ll sum[MAXN + 1];
ll bck[MAXN + 1];

inline int find(int x) {
	int l = 1;
	int r = n;
	int p = lower_bound(a, a + 1 + n, x) - a - 1;
	int res = n;
	while(l <= r) {
		int mid = (l + r) >> 1;
		int T = mid - (mid >> 1);
		if(n - p <= mid && a[n - T] - x < abs(x - a[n - mid]))
			r = mid - 1, res = mid;
		else l = mid + 1;
	}
	return res;
}

int main() {
	scanf("%d%d", &n, &q);
	for(int i = 1; i <= n; i++) a[i] = Re;
	sort(a + 1, a + 1 + n);
	sum[1] = a[1], sum[2] = a[2];
	for(int i = 3; i <= n; i++) sum[i] = sum[i - 2] + a[i];
	for(int i = n; i >= 1; i--) bck[i] = bck[i + 1] + a[i];
	for(int i = 1; i <= q; i++) {
		int x = Re;
		int p = find(x);
		printf("%lld\n", sum[n - min(n, (p + 1) / 2 * 2)] + bck[n - ((p + 1) >> 1) + 1]);
	}
	return 0;
}

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

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors

divs = make_divisors(N)
m_div = divs[(len(divs)+1)//2-1]
M_div = divs[-((len(divs)+1)//2)]

print(m_div+M_div-2)


Measured memory_bytes: 3264
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <algorithm>
#include <vector>
#include <iostream>
#include <limits.h>
#include <math.h>
#include <unordered_map>
#include <assert.h>
using namespace std;

#define ran(i, a, b) for ((i) = (a); (i) < (b); (i)++)
#define rep(i, a) ran ((i), 0, (a))
#define rep1(i, a) ran ((i), 1, (a)+1)
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef long long ll;
#define _0 first
#define _1 second
#define _pb(x) push_back(x)
#define _mp(x, y) make_pair(x, y)
#if defined(SHIROKO1_LOCAL) && !defined(NDEBUG)
#define DEBUG(...) fprintf(stderr, "[DEBUG] " __VA_ARGS__)
#else
#define DEBUG(...) ((void)0)
#endif



int main()
{
	ll N, A, B, C, D;
	cin >> N >> A >> B >> C >> D;
	B = abs(B - A);
	ll i;
	ll d = abs(C-D);
	ll l = 0;
	ll in;
	ll r = 0;
	rep (i, N-1) {
		in = 2*C - l;
		l += d;
		r += D;
	}
	DEBUG("RANGE %lli; LEN %lli; IN %lli\n", r, l, in);
	if (B > r)
		puts("NO");
	else {
		if (in <= 0)
			puts("YES");
		else {
			if (N&1) {
				B -= l/2;
			} else
				B += in/2;
			ll t = in + l;
			B = (B+t)%t;
			DEBUG("PHASE %lli\n", B);
			if (B >= in || B == 0)
				puts("YES");
			else
				puts("NO");
		}
	}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; i++)
//'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122

int main() {
    int n, m;
    cin >> n >> m;
    set<pair<int, int>> st;
    rep(i, m) {
        int a, b;
        cin >> a >> b;
        st.insert(make_pair(a, b));
    }

    bool flag = false;
    for (int i = 2; i <= n - 1; i++) {
        if (st.count(make_pair(1, i)) && st.count(make_pair(i, n))) {
            flag = true;
            break;
        }
    }

    cout << (flag ? "POSSIBLE" : "IMPOSSIBLE") << endl;
    return 0;
}


Measured memory_bytes: 9600
s=list(input())
l=len(s)
ans=0
if l%2==1:
    half=(l-1)//2
    for i in range(half):
        if s[i]!=s[l-(i+1)]:
            ans+=1
else:
    half=l//2
    for i in range(half):
        if s[i]!=s[l-(i+1)]:
            ans+=1
print(ans)

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

import sys

DEBUG = False

def solve():
    return


def read_int_list(sep = " "):
    return [int(s) for s in sys.stdin.readline().rstrip().split(sep)]

def read_int():
    return int(sys.stdin.readline())

def dprint(*args, **kwargs):
    if DEBUG:
        print(*args, **kwargs)
    return


def main():
    _, x = read_int_list()
    ls = read_int_list()

    ans = 1
    p = 0
    for l in ls:
        if p + l > x:
            break
        p += l
        ans += 1
    print(ans)


if __name__ == "__main__":
    main()

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define ff first
#define ss second
#define pii pair <int,int>
#define pll pair <ll,ll>
#define testcase() int t; cin>>t; while(t--)
#define forn(i,n) for(int i=0;i<n;i++)
#define forn1(i,n) for(int i=1;i<=n;i++)
#define vll vector <ll>
#define vi vector <int>
#define all(v) v.begin(),v.end()

ll M = 1e9 + 7;
double pi = acos(-1.0);
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
ll powerm(ll x,ll y){ ll res=1; while(y){ if(y&1) res=(res*x)%M; y=y>>1; x=(x*x)%M;} return res%M; }
ll power(ll x,ll y){ ll res=1; while(y){ if(y&1) res=(res*x); y=y>>1; x=(x*x);} return res; }
ll gcd(ll a,ll b){if(b>a)return gcd(b,a); if(b==0)return a; return gcd(b,a%b);}
const int N = 2e5 + 5;
set <int> adj[N];
vector <bool> vis(N);
int cc;

void dfs(int u)
{
    vis[u] = true;
    cc++;
    for(auto it:adj[u])
    {
        if(vis[it]) continue;
        dfs(it);
    }
}

int main() {
	
	//ifstream cin("input.txt");
	//ofstream cout("output.txt");
	ios_base::sync_with_stdio(false); 
    cin.tie(NULL); 
	
	int n,m; cin>>n>>m;
    forn(i,m)
    {
        int u,v; cin>>u>>v;
        adj[u].insert(v);
        adj[v].insert(u);
    }
    vis.resize(n+1,false);
    int ans = 0;
    forn1(i,n)
    {
        if( vis[i] ) continue;
        cc = 0;
        dfs(i);
        ans = max( ans , cc );
    }
    cout<<ans;

	return 0;
}


Measured memory_bytes: 38008
#include <stdio.h>
#include <string.h>
void Search(double n);
void Answer(void);
int A[10]={0};
int main(void) {

	int i,m;
	double n;
	char str[100];

	fgets(str,sizeof(str),stdin);
	sscanf(str,"%d",&m);
	for(i=0;i<m;i++){
		fgets(str,sizeof(str),stdin);
		sscanf(str,"%lf",&n);
		Search(n);	
	}
	Answer();		
	return 0;
}
void Answer(void){
	int i,j;
	for(i=1;i<=6;i++){
		printf("%d:",i);
		for(j=1;j<=A[i];j++)
			printf("*");
		printf("\n");
	}
}
		
void Search(double n){
	if(165.0>n)                  A[1]+=1;
	else if(165.0<=n && n<170.0) A[2]+=1;
	else if(170.0<=n && n<175.0) A[3]+=1;
	else if(175.0<=n && n<180.0) A[4]+=1;
	else if(180.0<=n && n<185.0) A[5]+=1;
	else if(185.0<=n)            A[6]+=1;
}

Measured memory_bytes: 644
S = input()
# S = "RL"
rs = []
ls = []
inds = []

s_inv = S[::-1]
rcnt = 0
#Rを数える
for i,s in enumerate(S):
    if s == "R":
        rcnt += 1
    else:
        if rcnt > 0:
            #記録
            rs.append(rcnt)
            inds.append(i-1)
        rcnt = 0
#Lを数える
# print(s_inv)
lcnt = 0
for i,s in enumerate(s_inv):
    if s == "L":
        lcnt += 1
    else:
        if lcnt > 0:
            ls.append(lcnt)
        lcnt = 0
ls = ls[::-1]

ans = [0]*len(S)
for i,r,l in zip(inds,rs,ls):
    adds = r+l
    # print(adds,i)
    if (r+l)%2 == 0:
        ans[i] = (r+l)//2
        ans[i+1] = (r+l)//2
    else:
        if r%2 == 1:
            ans[i] = (r+l)//2 + 1
            ans[i+1] = (r+l)//2 
        else:
            ans[i] = (r+l)//2
            ans[i+1] = (r+l)//2 + 1

print(*ans)

Measured memory_bytes: 9128
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc = new Scanner(System.in);

		//倍数
		int K = sc.nextInt();
		//以上
		int A = sc.nextInt();
		//以下
		int B = sc.nextInt();

		sc.close();

		//A以上Bまでの範囲
		for (int i = A; i <= B; i++) {
			if (i % K == 0) {
				System.out.println("OK");
				return;

			}

		}
		System.out.println("NG");

	}

}


Measured memory_bytes: 35720
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;

ll n,m;

int main(){


	cin>>n>>m;
	
	if( n*2==m ){
		cout<<n<<endl;
		return 0;
	}
    
    if( n*2<m ) {
    	cout<<n + (m-n*2)/4<<endl;
    	return 0;
    }
    
    //n*2>m
    cout<<m/2<<endl;
    
    return 0;
}


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

using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<n;i++)
#define all_map(itr,mp) for(auto itr=mp.begin();itr!=mp.end();itr++)
#define ALL(a) (a).begin(),(a).end()

int main(){
    int d, n;
    cin >> d >> n;

    ll base = pow(100, d);
    ll ans = base*n;
    if(ans%(base*100) == 0){
        ans += base;
    }
    cout << ans << endl;
}

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

void solve() {
	int n;
	cin >> n;
	if (n >= 30) cout << "Yes" << endl;
	else cout << "No" << endl;
}

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

Measured memory_bytes: 3628
import java.util.Scanner;

public class Main{
 public static void main(String[] args){
 Scanner sc=new Scanner(System.in);
 sc.useDelimiter(",|\n");
  int w=0,n=0;
  int[] data=new int[30];
  w=sc.nextInt();
  n=sc.nextInt();
  for(int i=0;i<w;i++){
   data[i]=i+1;
  }
  for(int j=0;j<n;j++){
   int a=sc.nextInt();
   int b=sc.nextInt();
   int tmp=data[a-1];
   data[a-1]=data[b-1];
   data[b-1]=tmp;
  }
  for(int k=0;k<w;k++){
   System.out.println(data[k]);
  }
  }
}

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

int main(){
  int A,B;
  cin >> A >> B;
  int count1=0;
  int count2=0;
  int x_s,x_e,y_s,y_e;
  for(int i=0;i<1010;i++){
    int x=i*0.08;
    int y=i*0.1;
    if(x==A){
      if(count1==0){
        x_s=i;
        count1++;
      }
      if(count1>0){
        x_e=i;
      }
    }

    if(y==B){
      if(count2==0){
        y_s=i;
        count2++;
      }
      if(count2>0){
        y_e=i;
      }
    }
  }
  int money;
  if(x_e<y_s || y_e<x_s){
    money=-1;
  }
  else if(x_s<=y_s){
    money=y_s;
  }
  else{
    money=x_s;
  }
  cout << money << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
int main(){
  ll h,i=0,ans;
  cin>>h;
  while(1){
    i++;
    if(h<pow(2,i)){
      break;//i-1回割る
    }
  }
  for(int j=0;j<i;j++){
    ans+=pow(2,j);
  }
  cout<<ans<<endl;
}

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

#define ll long long

int main() {
  int N;
  cin >> N;
  
  map<ll, int> stick;
  vector<ll> length;
  
  for (int i = 0; i < N; i++) {
    ll x;
    cin >> x;
    
    stick[x]++;
    
    if (stick[x] != 0 && !(stick[x] % 2)) {
      length.push_back(x);
    }
  }
  
  sort(length.begin(), length.end(), greater<ll>());
  
  if (length.size() <= 1) {
    cout << 0 << endl;
  } else {
    cout << length[0] * length[1] << endl;
  }
    
}

Measured memory_bytes: 9840
/*{{{*/
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<string>
#include<iostream>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include<bitset>
#include<vector>
#include<limits.h>
#include<assert.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define FORS(I, S) for (int I = 0; S[I]; ++I)
#define RS(X) scanf("%s", (X))
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<PII> VPII;
typedef pair<LL,LL> PLL;
typedef vector<PLL> VPLL;
template<class T> void _R(T &x) { cin >> x; }
void _R(int &x) { scanf("%d", &x); }
void _R(LL &x) { scanf("%lld", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template<class T, class... U> void R(T &head, U &... tail) { _R(head); R(tail...); }
template<class T> void _W(const T &x) { cout << x; }
void _W(const int &x) { printf("%d", x); }
void _W(const LL &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template<class T,class U> void _W(const pair<T,U> &x) {_W(x.F); putchar(' '); _W(x.S);}
template<class T> void _W(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W(const T &head, const U &... tail) { _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...); }
#ifdef HOME
 #define DEBUG(...) {printf("# ");printf(__VA_ARGS__);puts("");}
#else
 #define DEBUG(...)
#endif
int MOD = 1e9+7;
void ADD(LL& x,LL v){x=(x+v)%MOD;if(x<0)x+=MOD;}
/*}}}*/
const int SIZE = 1e6+10;
void error(){W("No");exit(0);}
int main(){
    int n;
    R(n);
    char lt;
    set<string>AA;
    REP(i,n){
        string s;
        R(s);
        if(i){
            if(s[0]!=lt)error();
        }
        if(AA.count(s))error();
        AA.insert(s);
        lt=s.back();
    }
    W("Yes");
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <map>
#include <utility>
#include <vector>
#include <cstdio>
#include <iomanip>
#include <cmath>  
#include <cstdlib>
using namespace std;
using ll = long long;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep1(i, n) for(int i = 1; i <= n; i++) 

int main(){
    ll n;
    cin >> n;
    ll ans = 0;
    rep1(i,n) {
        if (i%3==0 || i%5==0) {
            continue;
        } else {
            ans += i;
        }
    }

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

Measured memory_bytes: 3636
from typing import List


x, n = map(int, input().split())
P = list(map(int, input().split()))


def solve(x: int, n: int, P: List[int]):
    plus = minus = x
    while True:
        if minus not in P:
            return minus
        elif plus not in P:
            return plus
        plus += 1
        minus -= 1


print(solve(x, n, P))


Measured memory_bytes: 10184
#!/usr/bin/env python3
import sys, math, fractions, itertools, collections, copy, heapq

YES = "YES"  # type: str
NO = "NO"  # type: str

def solve(N: int, A: "List[int]"):
    O = len([aa for aa in A if aa % 2 == 1])
    E = len([aa for aa in A if aa % 2 == 0])
    o = True if O % 2 == 1 else False
    E += O // 2
    while E > 1:
        E = E // 2 + E % 2
    e = True if E == 1 else False

    if o ^ e:
        print("YES")
    else:
        print("NO")
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [ int(next(tokens)) for _ in range(N) ]  # type: "List[int]"
    solve(N, A)

if __name__ == '__main__':
    main()


Measured memory_bytes: 17808
using System;
using System.Linq;

namespace Atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            //入力受け取ってやる
            string S = Console.ReadLine();
            int noodle = 700; int topping = 0;
            for (int i =0;i<3;i++){
                if(S[i] == 'o'){
                    topping += 100;
                }
            }
            Console.WriteLine(noodle + topping);
        }
    }
}


Measured memory_bytes: 13140
while True:
    (m,f,r) = [int(i) for i in input().split()]
    if m == f == r == -1:
        break
  
    total = m + f
    if m == -1 or f == -1 or total < 30:
        print('F')
    elif total < 50 and r < 50:
        print('D')
    elif total < 65:
        print('C')
    elif total < 80:
        print('B')
    else:
        print('A')

Measured memory_bytes: 6724
#include <stdio.h>

void merge(long a[], int l, int m, int r)
{
  int i;
  int j;
  int k;
  long aux[100005];
  for ( i = m + 1; i > l; i--) aux[i-1] = a[i-1];
  for ( j = m; j < r; j++) aux[r+m-j] = a[j+1];
  for ( k = l; k <= r; k++)
      if (aux[j]<aux[i])
         a[k] = aux[j--]; else a[k] = aux[i++]; 

}

void mergesort(long a[], int l, int r)
{
  int m = (r+l)/2;
  if (r <= l ) return;
  mergesort(a, l, m);
  mergesort(a, m+1, r);
  merge(a, l, m, r);
}

int main()
{
 int N;
 long A[100005];
 long store[100005];
 long Asorted[100005];
 long Acount[100005];
 int i;
 int ii=0;
 int iii=0;
 int iv=0;
 long rside[2];
 long sside=0;
 long area;
 long rarea;
 long sarea;

 scanf("%d",&N);
 for(i=0;i<N;i++) scanf("%ld",&A[i]);
 mergesort(A,0,N-1);

 for(i=0;i<N;i++) Acount[i]=0;
 Asorted[ii]=A[0];
 Acount[ii]=1;


 for(i=1;i<N;i++) 
 { 
  if(A[i]==Asorted[ii])
  {
    Acount[ii]++;
  }else{
    ii++;
    Acount[ii]++;
    Asorted[ii]=A[i];
  }
 }

 rside[0]=0;
 rside[1]=0;
 for(i=0;i<ii+1;i++)
 {
  if(Acount[ii-i]>1)
  {
    rside[iii]=Asorted[ii-i];
    iii++;
  }
  if(iii>1) break;
 }    

 for(i=0;i<ii+1;i++)
 {
  if(Acount[ii-i]>3)
  {
   sside=Asorted[ii-i];
   break;
  }
 }
 
 rarea=rside[0]*rside[1];
 sarea=sside*sside;
 area=0;
 if(rarea>sarea)
 {
  area=rarea;
 }else{
  area=sarea;
 }

 printf("%ld\n",area);

 return 0;
}


Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template<class T,class U> using P = pair<T,U>;
template<class T> using vec = vector<T>;
template<class T> using vvec = vector<vec<T>>;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int M,N;
    cin >> M >> N;
    if(M>2){
        int ans = 0,cnt = 0,pre = -1;
        for(int i=0;i<N;i++){
            int a;
            cin >> a;
            if(a==pre){
                cnt++;
                if(i==N-1) ans += cnt/2;
            }else{
                ans += cnt/2;
                cnt = 1;
                pre = a;
            }
        }
        cout << ans << endl;
        return 0;
    }
    vec<int> A(N);
    for(int i=0;i<N;i++){
        cin >> A[i];
        A[i]--;
    }
    int inf = 1e9;
    vvec<int> dp(N+1,vec<int>(2,inf));
    dp[0][0] = dp[0][1] = 0;
    for(int i=0;i<N;i++){
        if(A[i]==0){
            dp[i+1][0] = dp[i][1];
            dp[i+1][1] = dp[i][0]+1;
        }else{
            dp[i+1][0] = dp[i][1]+1;
            dp[i+1][1] = dp[i][0];
        }
    }
    cout << min(dp[N][0],dp[N][1]) << endl;
}


Measured memory_bytes: 8428
#include<iostream>
#include<stdio.h>
//#include <bits/stdc++.h>
#include<vector>
#include<float.h>
#include<iomanip>
#include<algorithm>
#include<string>
#include<cstring>
#include<math.h>
#include<cmath>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include <cassert>
#include <cmath>
#include<cstdint>

#define INF 1e9
#define rep(i,n)for(int i=0;(i)<(int)(n);i++)
#define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
#define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
#define vec(type,n) vector<type>(n)
#define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))
#define ALL(a)  (a).begin(),(a).end()

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using P = pair<int,int>;

vector<int>bitSearch(int bit,int n){
    vector<int>S;
    rep(i,n)if(bit&(1<<i))S.push_back(i);
    return S;
}


int main(){
    double w,h,x,y;cin>>w>>h>>x>>y;
    cout<<(double)w*h/2<<" ";
    cout<<(x==w/2 && y==h/2?1:0);
}



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

using namespace std;

int main() {
    int N;
    cin >> N;

    long long counter[5];
    for (int i = 0; i < 5; ++i) counter[i] = 0LL;

    string iter = "MARCH";
    for (int i = 0; i < N; ++i) {
        string s;
        cin >> s;
        for (int j = 0; j < 5; ++j) {
            if (s[0] == iter[j]) {
                counter[j]++;
            }
        }
    }

    long long ans = 0;
    for (int i = 0; i < 5; ++i) {
        for (int j = i + 1; j < 5; ++j) {
            for (int k = j + 1; k < 5; ++k) {
                ans += counter[i] * counter[j] * counter[k];
            }
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
N,*S,=open(0).read().split()
N=int(N)
C0=S.count('AC')
C1=S.count('WA')
C2=S.count('TLE')
C3=S.count('RE')
print('AC x '+str(C0))
print('WA x '+str(C1))
print('TLE x '+str(C2))
print('RE x '+str(C3))

Measured memory_bytes: 17100
#include <iostream>
#include <vector>
#include <iomanip>
#include <algorithm>
using namespace std;

int main(){
    int N;
    cin >> N;
    vector<double> v(N);
    for(int i=0;i<N;i++) cin >> v[i];
    sort(v.begin(),v.end());
    double ans = (v[0]+v[1])/2;
    for(int i=2;i<N;i++) ans = (ans+v[i])/2;
    cout << fixed;
    cout << setprecision(10) << ans << endl;
}

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

int main() {
    string s;
    cin >> s;
    if(s.at(2) == s.at(3) && s.at(4) == s.at(5)) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define FORR(i, m, n) for (int i = (m); i >= (n); --i)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const ll mod2 = 998244353;
const int INF = 1000000005;

int main() {
  int h, w;
  cin >> h >> w;
  int s[h+1][w+1];
  char c;

  rep(i, h+1) {
    rep(j, w+1) {
      if (i == 0 || j == 0) {
        s[i][j] = INF;
        continue;
      }
      else {
        cin >> c;
        s[i][j] = c - '0';
        if (i == 1 && j == 1) continue;
        s[i][j] += min(s[i-1][j], s[i][j-1]);
      }
    }
  }

  cout << s[h][w] << endl;
  
  return 0;
}


Measured memory_bytes: 3128
#include<iostream>
#include<cmath>
#include<algorithm>
#include<cstdlib>
#include<cstring>
#include<cstdio>
#define ull unsigned long long
using namespace std;

const int N=305;
const ull p1=5557;
const int p2=2333;
const int mod=998244353;

struct node{
	ull s1;int s2;
	node(){}
	node(ull s1,int s2):s1(s1),s2(s2){}
	friend node operator+(node a,node b){
		return node(a.s1+b.s1,(a.s2+b.s2)%mod);
	}
	friend node operator-(node a,node b){
		return node(a.s1-b.s1,(a.s2-b.s2+mod)%mod);
	}
	friend node operator*(node a,node b){
		return node(a.s1*b.s1,1ll*a.s2*b.s2%mod);
	}
	friend bool operator==(node a,node b){
		return (a.s1==b.s1&&a.s2==b.s2);
	}
}hs1[N][N],p[N],hs2[N][N];
int n,ans,tag;
char s[N][N];

void init(){
	int i,j,k;
	for (i=0;i<n;i++){
		for (j=0;j<n;j++){
			for (k=0;k<n;k++){
				hs1[i][j]=hs1[i][j]*node(p1,p2)+node(s[(i+k)%n][j],s[(i+k)%n][j]);
			}
		}
	}
	for (j=0;j<n;j++){
		for (i=0;i<n;i++){
			for (k=0;k<n;k++){
				hs2[j][i]=hs2[j][i]*node(p1,p2)+node(s[i][(j+k)%n],s[i][(j+k)%n]);
			}
		}
	}
}

int main(){
	int i,j,k;
	scanf("%d",&n);
	for (i=0;i<n;i++) scanf("%s",s[i]);
	p[0]=node(1,1); for (i=1;i<=n;i++) p[i]=p[i-1]*node(p1,p2);
	init();
	for (i=0;i<n;i++){
		for (j=0;j<n;j++){
			tag=1;
			for (k=0;k<n;k++){
				if (hs1[i][(j+k)%n]==hs2[j][(i+k)%n]) continue;
				tag=0;
				break;
			}
			ans+=tag;
		}
	}
	printf("%d\n",ans);
	return 0;
}

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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define RFOR(i,n,m) for(int i=(int)(n); i>=(int)(m); i--)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

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

#define ld long double
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

//-------------------------------------------------
//--Union Find tree
//-------------------------------------------------
class UnionFind
{
private:
    ::std::vector<int> par;
    ::std::vector<int> rank;
public:
    UnionFind(int n):par(n), rank(n){
        for(int i=0; i<n; i++){
            par[i] = i;
            rank[i] = 0;
        }
    }
    int root(int x){
        if (par[x]==x) return x;
        return par[x] = root(par[x]);
    }
    bool same(int x, int y){
        return root(x)==root(y);
    }
    void unite(int x, int y){
        int rx = root(x);
        int ry = root(y);
        if (rx==ry) return;
        if (rank[rx]>rank[ry]){
            par[ry] = rx;
        }else{
            par[rx] = ry;
            if (rx==ry) rank[ry]++;
        }
    }
};

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

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,m; cin>>n>>m;
    UnionFind uf(n);
    vi p(n);
    rep(i,n) cin>>p[i];
    rep(i,m){
        int x,y; cin>>x>>y; x--; y--;
        uf.unite(x,y);
    }
    int ans=0;
    rep(i,n){
        if (uf.same(i,p[i]-1)) ans++;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 1408
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,copy,time
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())

n = inp()
print(float(n//2)/n if n%2 ==0 else float(n//2+1)/n)

Measured memory_bytes: 4196
import java.util.Scanner;

public class Main {

	public static void main(String []args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int x = sc.nextInt();
		int y = sc.nextInt();
		int[]ans = new int[n-1];
		for(int i=0;i<n-1;i++){
			ans[i]=0;
		}
		
		for(int i=0;i<n-1;i++){
			for(int j=i+1;j<n;j++){
				//shortest distance
				int d = Math.min(Math.abs(i-j),Math.min(Math.abs(x-1-i)+1+Math.abs(y-1-j),
						Math.abs(y-1-i)+1+Math.abs(x-1-j)));
				ans[d-1]+=1;
			}
			
		}
		for(int k:ans){
			System.out.println(k);
		}
	} 
}


Measured memory_bytes: 22996
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <sstream>
#include <cmath>
#include <set>
#include <iomanip>
#include <deque>
#include <stdio.h>
using namespace std;

#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 iREP(i,Itr) for(auto (i)=(Itr).begin();(i)!=(Itr).end();(i)++)
#define REMOVE(Itr,n) (Itr).erase(remove((Itr).begin(),(Itr).end(),n),(Itr).end())
#define UNIQUE(Itr) sort((Itr).begin(),(Itr).end()); (Itr).erase(unique((Itr).begin(),(Itr).end()),(Itr).end())
#define LBOUND(Itr,val) lower_bound((Itr).begin(),(Itr).end(),(val))
#define UBOUND(Itr,val) upper_bound((Itr).begin(),(Itr).end(),(val))
typedef long long ll;

int main(){
    
    int N,M; cin>>N>>M;
    vector<int> X(N);
    REP(i,N)cin>>X[i];
    
    sort(X.begin(),X.end());
    
    map<int,int> cnt_pair;
    map<int,int> cnt;
    
    int t=0,pre=X[0];
    REP(i,N){
        if(cnt.find(X[i]%M)==cnt.end())cnt[X[i]%M]=1;
        else cnt[X[i]%M]++;
        if(pre==X[i]){
            t++;
            if(i==N-1){
                if(cnt_pair.find(pre%M)==cnt_pair.end())cnt_pair[pre%M]=t/2;
                else cnt_pair[pre%M]+=t/2;
                pre=X[i];
                t=1;
            }
        }else{
            if(cnt_pair.find(pre%M)==cnt_pair.end())cnt_pair[pre%M]=t/2;
            else cnt_pair[pre%M]+=t/2;
            pre=X[i];
            t=1;
        }
    }
    
    ll ans=cnt[0]/2;
    
    if(M%2==0){
        ans+=cnt[M/2]/2;
        for(int i=1;i<M/2;i++){
            int mul=min(cnt[M-i],cnt[i]);
            int pt=min(cnt_pair[M-i],(cnt[M-i]-mul)/2)+min(cnt_pair[i],(cnt[i]-mul)/2);
            ans+=mul+pt;
        }
    }else{
        for(int i=1;i<=M/2;i++){
            int mul=min(cnt[M-i],cnt[i]);
            int pt=min(cnt_pair[M-i],(cnt[M-i]-mul)/2)+min(cnt_pair[i],(cnt[i]-mul)/2);
            ans+=mul+pt;
        }
    }
    
    cout<<ans<<endl;
    
    return 0;
}


Measured memory_bytes: 9984
#include <iostream>
#include <string>
using namespace std;
struct Dice{
    int s[6];
    void roll(char c){
        int tmp;
        if(c=='N'){
            tmp=s[0];
            s[0]=s[1];
            s[1]=s[5];
            s[5]=s[4];
            s[4]=tmp;
        }
        if(c=='E'){
            tmp=s[0];
            s[0]=s[3];
            s[3]=s[5];
            s[5]=s[2];
            s[2]=tmp;
        }
        if(c=='W'){
            tmp=s[0];
            s[0]=s[2];
            s[2]=s[5];
            s[5]=s[3];
            s[3]=tmp;
        }
        if(c=='S'){
            tmp=s[0];
            s[0]=s[4];
            s[4]=s[5];
            s[5]=s[1];
            s[1]=tmp;
        }
        if(c=='R'){
            tmp=s[1];
            s[1]=s[2];
            s[2]=s[4];
            s[4]=s[3];
            s[3]=tmp;
        }
    }
    int top(){
        return s[0];
    }
    int right(){
        return s[2];
    }
    int left(){
        return s[3];
    }
    int front(){
        return s[1];
    }
};

bool same(Dice a, Dice b){
    for(int i=0; i<6; i++)
        if(a.s[i]!=b.s[i]) return false;
    return true;
}

 
int main(void){
    Dice d[2];
    for(int j=0; j<2; j++)
        for(int i=0; i<6; i++)
            cin>>d[j].s[i];
    bool f=false;
    
    for(int i=0; i<4; i++){
        d[1].roll('R');
        for(int j=0; j<4; j++){
            d[1].roll('N');
            if(same(d[0],d[1])) f=true;
        }
    }
    d[1].roll('E');
    for(int j=0; j<4; j++){
        d[1].roll('N');
        if(same(d[0],d[1])) f=true;
    }
    
    d[1].roll('W');
    d[1].roll('W');
    for(int j=0; j<4; j++){
        d[1].roll('N');
        if(same(d[0],d[1])) f=true;
    }
    
    cout<<(f?"Yes":"No")<<endl;
    
    return 0;
}


Measured memory_bytes: 3120
import java.io.IOException;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws IOException {
		new Main().run();
	}

	private void run() throws IOException {
		Scanner scanner = new Scanner(System.in);
		while (true) {
			char[] a = scanner.next().toCharArray();
			char[] b = scanner.next().toCharArray();
			if (String.valueOf(a).equals("0"))
				break;
			int h = 0;
			for (int i = 0; i < 4; i++)
				if (a[i] == b[i])
					h++;
			int br = 0;
			for (int i = 0; i < 4; i++)
				for (int j = 0; j < 4; j++)
					if (i == j)
						continue;
					else if (a[i] == b[j])
						br++;
			System.out.println(h + " " + br);
		}
	}
}

Measured memory_bytes: 43816
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
#include <map>

using namespace std;

const int mod = 1e9 + 7;

int main() {
	int n;
	cin >> n;

	map<int, int> primes;

	for (int i = 1; i <= n; i++) {
		int tmp = i;
		int j = 2;
		while (tmp > 1) {
			if (tmp % j == 0) {
				primes[j]++;
				tmp /= j;
			} else {
				j++;
			}
		}
	}

	long long ans = 1;
	for (auto p: primes) {
		// printf("%d: %d\n", p.first, p.second);
		ans = ans * (p.second + 1) % mod;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <vector>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <iostream>
#include <queue>
#include <set>
#include <map>
using namespace std;
typedef long long ll;

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


Measured memory_bytes: 3192
N = int(input())
Takahashi = [None] * N
Aoki = [None] * N
Used = [False] * N
for i in range(N):
    a, b = map(int, input().split())
    Takahashi[i] = (-a-b, -a, i)
    Aoki[i] = (-b-a, -b, i)
Takahashi.sort()
Aoki.sort()
TotalPoint = 0

usedDish = 0
tnum, anum = 0, 0
while usedDish < N:
    if usedDish % 2 == 0:
        while Used[Takahashi[tnum][2]]:
            tnum += 1
        TotalPoint -= Takahashi[tnum][1]
        Used[Takahashi[tnum][2]] = True
        usedDish += 1
    else:
        while Used[Aoki[anum][2]]:
            anum += 1
        TotalPoint += Aoki[anum][1] 
        Used[Aoki[anum][2]] = True
        usedDish += 1
print(TotalPoint)



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

#define li long long int
#define rep(i, to) for (li i = 0; i < ((li)(to)); i++)
#define MOD 1000000007
typedef pair<li, li> PI;

// 90 [do] = pi/2 [rad]
// 1[rad] = 180/pi [do]

int main(void)
{
	li a, b, x;
	cin >> a >> b >> x;

	double res_rad = 0.0;
	if (a * a * b == x * 2) {
		res_rad = atan(b * 1.0 / a);
	} else if (a * a * b <= x * 2) {
		// ((daikei_katappo_nagasa + b) * a / 2) * a == x
		// daikei_katappo_nagasa = 2x/(a^2) - b
		double daikei_katappo_nagasa = 2.0 * x / a / a - b;
		res_rad = atan((b - daikei_katappo_nagasa) * 1.0 / a);
	} else {
		double sankakukei_takasa = 2.0 * x / a / b;
		res_rad = atan(b * 1.0 / sankakukei_takasa);
	}
	double res = res_rad * 180 / 3.141592653589793238;

	printf("%.12f\n", res);

	return 0;
}

Measured memory_bytes: 384
N = int(input())
c = list(map(int, input().split()))
c.sort(reverse = True)
A = []
B = []
n = 0
for i in c:
    if n % 2 == 0:
        A.append(i)
    else:
        B.append(i)
    n += 1
print(sum(A) - sum(B))


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

int main()
{
  int n;
  cin >> n;
  vector<queue<int>> v(n);
  for (int x = 0; x < n; x++) {
    for (int y = 0; y < n-1; y++) {
      int val;
      cin >> val;
      v.at(x).push(val-1);
    }
  }
  int cnt = 0;
  int ngame = 0;
  unordered_set<int> updated_player;
  for (int i = 0; i < n; i++) {
    updated_player.insert(i);
  }
  unordered_set<int> match;
  while (ngame < n * (n-1) / 2) {
    cnt++;
    bool has_no_game = true;
    unordered_set<int> updated;
    for (int x : updated_player) {
      int y = v.at(x).front();
      int game_id = x < y ? 2000 * x + y : x + 2000 * y;
      if (match.find(game_id) == match.end()) {
        match.insert(game_id);
        continue;
      }
      v.at(x).pop();
      v.at(y).pop();
      if (!v.at(x).empty()) {
        updated.insert(x);
      }
      if (!v.at(y).empty()) {
        updated.insert(y);
      }
      ngame++;
      has_no_game = false;
    }
    if (has_no_game) {
      cnt = -1;
      break;
    }
    updated_player = updated;
  }
  cout << cnt << '\n';
  return 0;
}


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

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

  ll x = 0;

  if(n >= b){
    x = b - 1;
  }
  else{
    x = n;
  }

  ll ax = a * x;

  cout << (ax / b) - a * (x / b);

  return 0; 
}

Measured memory_bytes: 3676
def examA():
    X = [I() for _ in range(5)]
    k = I()
    X.sort()
    ans = "Yay!"
    if X[-1]-X[0]>k:
        ans = ":("
    print(ans)
    return

def examB():
    X = [I() for _ in range(5)]
    ans = 0
    for i in range(5):
        ans += (X[i]+9)//10 *10
        X[i] = (X[i]-1)%10
    ans -= (9-min(X))
    print(ans)
    return

def examC():
    N = I()
    X = [I() for _ in range(5)]
    ans = max(0,(N-1)//min(X))+5
    print(ans)
    return

import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,inf
mod = 10**9 + 7
inf = float('inf')

if __name__ == '__main__':
    examC()


Measured memory_bytes: 3444
#include <algorithm>
#include <bitset>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define MOD (1000000007l)
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)

using namespace std;

void solve() {
  ll N;
  cin >> N;
  unordered_map<string, ll> mp;
  rep (i, N) {
    string s;
    cin >> s;
    mp[s]++;
  }
  ll maximum = 0;
  for (auto it: mp) maximum = max(maximum, it.second);
  set<string> st;
  for (auto it: mp) if (it.second == maximum) st.insert(it.first);
  for (auto it: st) cout << it << endl;
}

int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout.precision(12);
  cout << fixed;
  solve();
  return 0;
}


Measured memory_bytes: 32072