akhauriyash/Code-Regression huggingface dataset:
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 500001), 500000)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}

func getNextUint64(scanner *bufio.Scanner) uint64 {
	i, _ := strconv.ParseUint(getNextString(scanner), 10, 64)
	return i
}

func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}

func main() {
	fp := os.Stdin
	wfp := os.Stdout

	if os.Getenv("MASPY") == "ますピ" {
		fp, _ = os.Open(os.Getenv("BEET_THE_HARMONY_OF_PERFECT"))
	}
	if os.Getenv("MASPYPY") == "ますピッピ" {
		wfp, _ = os.Create(os.Getenv("NGTKANA_IS_GENIUS10"))
	}

	scanner := getScanner(fp)
	writer := bufio.NewWriter(wfp)

	a := getNextInt(scanner)
	b := getNextInt(scanner)

	c := 0
	for i := 0; i < 3; i++ {
		if a == i+1 {
			continue
		}
		if b == i+1 {
			continue
		}
		c = i + 1
	}

	fmt.Println(c)
	writer.Flush()
}


Measured memory_bytes: 640
#include<iostream>
#include<vector>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
using ll = long long;
using P = pair<int, int>;
#include<algorithm>
#include<math.h>
#include<map>
#include<queue>
#include<string>
#include<iomanip>
 
int main() {
	double r;
	cin >> r;
	double m = 3.141593;
	double ans = 2 * r * m;
	cout << fixed << setprecision(8) << ans;
 
	return 0;
}

Measured memory_bytes: 3788
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        C solver = new C();
        solver.solve(1, in, out);
        out.close();
    }

    static class C {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int N = in.nextInt();
            int[] d = new int[N];
            for (int i = 0; i < N; i++) {
                d[i] = in.nextInt();
            }
            Arrays.sort(d);
            int l = d[N / 2 - 1];
            int r = d[N / 2];
            if (l == r) {
                out.println(0);
            } else {
                out.println(r - l);
            }
        }

    }
}



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

void show(vector<ll>& vc)
{
    for(auto it:vc)cout<<it<<" ";
    cout<<endl;
}
#define M 10
bool p[M+2];
vector<ll>prime;
void seive(void)
{
    memset(p,0,sizeof p);
    p[1]=1;
    p[0]=1;

    for(int i=4; i<=M; i+=2)
    {
        p[i]=1;

    }

    for(ll i=3; i*i<=M; i+=2)
    {

        if(!p[i])
        {

            for(ll j=i*i; j<=M; j+=2*i)
            {
                p[j]=1;

            }
        }
    }

    prime.push_back(2);
    for(int i=3; i<=M; i+=2)prime.push_back(i);
}
ll dx[] = {-1,-1,0,-1,1,0,1,1};
ll dy[] = {-1,0,-1,1,-1,1,0,1};

typedef pair<ll, ll> pii;
#define x first
#define y second


pii extendedEuclid(ll a, ll b)   // returns x, y | ax + by = gcd(a,b)
{
    if(b == 0) return pii(1, 0);
    else
    {
        pii d = extendedEuclid(b, a % b);
        return pii(d.y, d.x - d.y * (a / b));
    }
}

ll modularInverse(ll a, ll n)
{
    pii ret = extendedEuclid(a, n);
    return ((ret.x % n) + n) % n;
}



string s1,s2;

ll dp[3005][3005];

void solve(ll t)
{
    cin>>s1>>s2;
    for(int i=1; i<=s1.size(); i++)
    {
        for(int j=1; j<=s2.size(); j++)
        {
            if(s1[i-1] == s2[j-1])
            {
                dp[i][j] =  dp[i-1][j-1] + 1;

            }
            else
            {
                dp[i][j] = max(dp[i-1][j], dp[i][j-1]);
            }
        }
    }

    vector<char>vc;
    for(int i=s1.size(), j = s2.size(); i>0 && j>0 ; )
    {

        if(dp[i][j]==dp[i-1][j])
        {
            --i;
        }
        else if(dp[i][j]==dp[i][j-1])
        {
            --j;
        }
        else{
            --i;
            --j;
            vc.push_back(s1[i]);
        }

    }
    reverse(vc.begin(),vc.end());

    for(auto it:vc)cout<<it;
    cout<<endl;






}


int main()
{

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    //seive();


    ll t=1;
    //cin>>t;
    ll T=t;



    while(t--)
    {


        solve(T-t);

    }
}


Measured memory_bytes: 70784
//#include <boost/multiprecision/cpp_dec_float.hpp>
//#include <boost/multiprecision/cpp_int.hpp>
#include <stdio.h>
#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <math.h>
#include <algorithm>
#include <bitset>
#include <iomanip>
using namespace std;
//namespace mp = boost::multiprecision;
//using llll = mp::cpp_int;
// 仮数部が1024ビットの浮動小数点数型(TLEしたら小さくする)
//using Real = mp::number<mp::cpp_dec_float<1024>>;
using ll = long long;
const double EPS = 1e-10;
const ll MOD = 7+(1e+9);

int main(){
  //cout<<fixed<<setprecision(10);
  ll n,ans=0;
  cin>>n;
  vector<pair<ll,ll>>v;
  ll a,b;
  for(ll i=0;i<n;i++){
    cin>>a>>b;
    v.push_back(make_pair(a+b,a-b));
  }
  sort(v.begin(),v.end());
  ll t=v[0].first;
  ans++;
  for(ll i=1;i<n;i++){
    if(v[i].second>=t){
      ans++;
      t=v[i].first;
    }
  }
  cout<<ans<<endl;

}


Measured memory_bytes: 2420
#include <bits/stdc++.h>
#include <cassert>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
struct Edge
{
  int to;
  int weight;
  Edge(int t, int w) : to(t), weight(w) {}
};
using Graph = vector<vector<Edge>>;
// using Graph = vector<vector<int>>;

const long long INF = 1LL << 60;
const int INT_INF = 1000000000;

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

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n;
  while (1)
  {
    cin >> n;
    if (n == 0)
      break;
    vector<int> w(n);
    for (auto &it : w)
      cin >> it;
    vector<vector<ll>> dp(n + 1, vector<ll>(n + 1, 0));
    for (int W = 2; W <= n; W++)
    {
      // left
      for (int l = 0; l < n; l++)
      {
        int r = l + W;
        if (r > n)
          continue;
        if (dp[l + 1][r - 1] == W - 2 && abs(w[l] - w[r - 1]) <= 1)
          dp[l][r] = W;

        for (int mid = l; mid <= r; mid++)
        {
          dp[l][r] = max(dp[l][r], dp[l][mid] + dp[mid][r]);
        }
      }
    }
    ll ans = dp[0][n];
    cout << ans << endl;
  }
  return 0;
}


Measured memory_bytes: 3596
N = int(input())
MOD = 10**9+7
a = [int(c) for c in input().split()]
M = max(a).bit_length()
ls = [0]*M
for i in range(N):
  m = a[i]
  for j in range(M):
    if m%2==1:
      ls[j] += 1
    m >>= 1

ans = 0
x = 1
for i in range(M):
  ans += x*(ls[i]*(N-ls[i]))
  ans %= MOD
  x *= 2
  x %= MOD
print(ans)

Measured memory_bytes: 122808
from collections import defaultdict
from collections import deque

h, w = map(int, input().split())
ch, cw = map(int, input().split())
dh, dw = map(int, input().split())
ch -= 1
cw -= 1
dh -= 1
dw -= 1
d = {'#': -1, '.': 0}
ss = [
    list(map(lambda x: d[x], input().rstrip()))
    for i in range(h)
]

canmove = defaultdict(set)

def dfs(c, x, y):
    global ss
    if not (0 <= x < w and 0 <= y < h):
        return
    if ss[y][x] != 0:
        return
    ss[y][x] = c
    dfs(c, x - 1, y)
    dfs(c, x + 1, y)
    dfs(c, x, y - 1)
    dfs(c, x, y + 1)

c = 1
for y in range(h):
    for x in range(w):
        if ss[y][x] == 0:
            dfs(c, x, y)
            c += 1

for y in range(h):
    for x in range(w):
        if ss[y][x] <= 0:
            continue

        for j in range(y - 2, y + 3):
            if not (0 <= j < h):
                continue
            for i in range(x - 2, x + 3):
                if not (0 <= i < w):
                    continue
                if ss[j][i] <= 0:
                    continue
                c1 = ss[y][x]
                c2 = ss[j][i]
                if c1 != c2:
                    canmove[c1].add(c2)
                    canmove[c2].add(c1)

cs = ss[ch][cw]
cd = ss[dh][dw]
if cs == cd:
    print(0)
    exit(0)

q = [cs]
visited = [False] * c
visited[cs] = True
ans = 1
while q:
    nq = []

    for cc in q:
        for cm in canmove[cc]:
            if cm == cd:
                print(ans)
                exit(0)
            if not visited[cm]:
                visited[cm] = True
                nq.append(cm)
    q = nq
    ans += 1
print(-1)


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

using namespace std;
using ll = long long;
using ld = long double;

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

  #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
  #endif

  ld PI = acos(-1);
  ll r;
  cin >> r;
  ld ans = (ld) r * 2 * PI;
  cout << fixed << setprecision(12) << ans << '\n';

  return 0;
}


Measured memory_bytes: 3800
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<(n);++i)
#define alrep(i,j,n) for(int i=0;i<(n);++i)for(int j=i+1;j<(n);++j)
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; }
const int MOD=1e9+7;
const long long INF = 1LL << 60;
int gcd(int a,int b) { return b ? gcd(b,a%b) : a;}
int lcm(int a,int b) { return a/gcd(a,b)*b;}
/*素数判定*/int isPrime(int n){if(n<2){return 0;}for(int i=2; i*i<=n; i++){if(n%i==0){return 0;}}return 1;}
/*約数列挙*/vector<int> getDivisor(int n){vector<int> v; for(int i=1; i*i<=n; i++){if(n%i==0){v.push_back(i);if(i!=n/i){v.push_back(n/i);}}}sort(v.begin(),v.end()); return v;}
void printb(unsigned int v) {
  unsigned int mask = (int)1 << (sizeof(v) * CHAR_BIT - 1);
  do putchar(mask & v ? '1' : '0');
  while (mask >>= 1);
}
void putb(unsigned int v) {putchar('0'), putchar('b'), printb(v), putchar('\n');}
#define ALL(W) (W).begin(),(W).end()
/*
bool solve(int a){
  if(1<=a && 9>= a) return true;
  else false;
}*/

signed main(){
  int A,B;
  cin >> A >> B;
  if(A<10 && B<10) cout << A*B << endl;
  else cout << "-1" << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long a,b,k;
    cin>>a>>b>>k;
    if(k<a)
    {
        cout<<a-k<<" "<<b;
    }
    else
    {
        k=k-a;
        if(k<b)
        {
            b= b-k;
        }
        else b=0;
        cout<<0<<" "<<b;
    }
    return 0;
}


Measured memory_bytes: 3648
package main

import "fmt"

func main() {
	var n, y int
	fmt.Scan(&n, &y)

	a, b, c := -1, -1, -1

	for i := 0; i <= n; i++ {
		for j := 0; j <= n; j++ {
			k := n - (i + j)
			if k >= 0 && 10000*i+5000*j+1000*k == y {
				a, b, c = i, j, k
			}
		}
	}
	fmt.Printf("%d %d %d\n", a, b, c)
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define FOR(i, a, n) for(int (i) = (int)(a); (i) < (int)(n); ++(i))
#define FORe(i, a, n) for(int (i) = (int)(a); (i) <= (int)(n); ++(i))
#define rFOR(i, a, n) for(int (i) = (int)(n)-1; (i) >= (int)(a); --(i))
#define REP(i, n) FOR((i), 0, (n))
#define REPe(i, n) FORe((i), 0, (n))
#define rREP(i, n) rFOR((i), 0, (n))
#define rep(i, n) FOR((i), 0, (n))
#define all(v) (v).begin(), (v).end()
using namespace std;
using ll = long long;
using P = pair<int,int>;

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

int main() {
  int k, n;
  cin >> k >> n;
  vector<int> a(n);
  REP(i, n) cin >> a[i];
  a.push_back(a[0]+k);
  int l = 0;
  REP(i, n) chmax(l, a[i+1]-a[i]);
  int ans = k - l;
  cout << ans << endl;

  return 0;
}

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

void solve()
{
    int n,flag=0;
    cin>>n;
    for(int i=9;i>=1;i--)
    if(n%i==0)
    {
        if(i<10 and (n/i)<10){
        cout<<"Yes\n";flag=1;break;}
    }
    if(flag==0)
    cout<<"No\n";
}


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


Measured memory_bytes: 256
N = int(input())
T, A = map(int, input().split())
H = list(map(int, input().split()))

tlst = [T - x*0.006 for x in H]
min = 10000000

for t in tlst:
    if min > abs(t - A):
        min = abs(t - A)
        ans = tlst.index(t) + 1
print(ans)

Measured memory_bytes: 3060
#include <iostream>

using namespace std;

int main(){
    int N;

    while(1){
        cin >> N;
        if(N==0) break;
        if(N==1){
            cout << 0 << endl;
            continue;
        }

        int c=0,sum=1;
        for(int i=2; ; i++){
            sum+=i;
            int check=N-sum;
            if(check < 0) break;
            if(check%i==0) c++;
        }
        cout << c << endl;
    }
    
    return 0;
}

Measured memory_bytes: 2980
from collections import Counter
l = []
while True:
    try:
        a=int(input())
    except EOFError:
        break
    l.append(a)
L = sorted(l)
def calculate_mode(L):
    c = Counter(L)
    freq_scores = c.most_common()
    max_count = freq_scores[0][1]

    modes = []
#出現回数と最大出現回数が等しいかを確認します。
    for num in freq_scores:
        if num[1] == max_count:
            modes.append(num[0])
    return(modes)

if __name__ == '__main__':
    data = L
    modes = calculate_mode(L)

    for mode in modes:
        print(mode)


Measured memory_bytes: 6004
#include <bits/stdc++.h>
using namespace std;
#define ll long long 
#define endl "\n"
#define pb push_back
#define f(i,n) for(i=0;i<n;i++)
#define F(i,a,b) for(i=a;a<=b;i++)
#define arr(a,n) for( i=0;i<n;i++)cin>>a[i];
#define fi first
#define se second
#define mp make_pair
#define mod 1000000007
#define YES cout<<"YES"<<endl;
#define Yes cout<<"Yes"<<endl;
#define NO cout<<"NO"<<endl;
#define No cout<<"No"<<endl;
#define yes cout<<"yes"<<endl;
#define no cout<<"no"<<endl;
#define vi vector<ll>
#define ed end()
#define bg begin()
#define sz size()
#define ln length()
#define s() sort(a,a+n);
#define sr() sort(a,a+n,greater<ll>());
#define v()  sort(v.begin(),v.end());
#define vr() sort(v.begin(),v.end(),greater<ll>());
#define mod 1000000007
#define fast() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
ll gcd(ll a, ll b){if(!b)return a;return gcd(b, a % b);}
ll power(ll x,ll y,ll p){ll res=1;x%=p;while(y>0){if(y&1)res=(res*x)%p;y=y>>1;x=(x*x)%p;}return res;}
int main() {
    /*#ifndef ONLINE_JUDGE
        // for getting input from input.txt
        freopen("input.txt", "r", stdin);
        // for writing output to output.txt
        freopen("output.txt", "w", stdout);
    #endif*/
        /* 
        Ofcourse it's Hard.
        It's supposed to be Hard.
        If it's easy everyone would do it.
        HARD IS WHAT MAKES IT GREAT

        YESTERDAY U SAID TOMORROW

        SLOWLY BECOMING THE PERSON I 
        SHOULD HAVE BEEN A LONG TIME AGO

        SAME TASK CAN'T BE FOUND DIFFICULT TWICE

        BTBHWSITW

        SPRH TU KAB P

        CP IS ALL ABOUT THINKING 
        YOU HAVE MUCH MORE POTENTIAL THAN U THINK

        AJIT SHIDDAT 10

        UR DAILY ROUTINE 


        */

fast();
//ll t;cin>>t;while(t--)
{
    ll a,b;
    cin>>a>>b;
    ll ans=max(0ll,a-(2*b));
    cout<<ans<<endl;
    
}
return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
using ll=long long;
using vi=vector<int>;
using pii=pair<int,int>;
#define ALL(c) begin(c),end(c)
#define RALL(c) rbegin(c),rend(c)
#define ITR(i,b,e) for(auto i=(b);i!=(e);++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 SZ(c) ((int)c.size())
#define CONTAIN(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,begin(v),end(v)) os<<*i<<(i==end(v)-1?"":" "); return os; }
template<class T> istream& operator >> (istream &is,vector<T> &v) {
    ITR(i,begin(v),end(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;}
template <class T> using heap = priority_queue<T,vector<T>,greater<T>>;
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;
        #define endl "\n"
    }
} before_main_function;
//------------------8<------------------------------------8<--------------------

signed main() {
    int N;
    cin>>N;
    REPF(h,1,3501) {
        REPF(n,1,3501) {
            if(4*h*n-N*n-N*h==0) continue;
            if((N*h*n)%(4*h*n-N*n-N*h)==0) {
                int w=(N*h*n)/(4*h*n-N*n-N*h);
                if(1<=w && w<=3500) {
                    cout<<h<<" "<<n<<" "<<w<<endl;
                    return 0;
                }
            }
        }
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef pair<int, int>P;
typedef tuple<int,int,int,int>T;
#define PI 3.14159265359
#define MOD 1000000007
const int MAX =510000;
int maxd=0;
vector<int>A(11);
int N,M,Q;
vector<int>a(51);
vector<int>b(51);
vector<int>c(51);
vector<int>d(51);
void dfs(int n,int m,int x){
  	int dn=N-n;
      	A[dn]=x;
	if(n!=1){
    	for(int i=x;i<=m;i++){
        	dfs(n-1,m,i);
        }
    }
  	else{
      	int memo=0;
      	rep(i,Q){
        	if(A[b[i]]==(A[a[i]]+c[i]))
        	memo+=d[i];
        }
      	::maxd=max(memo,::maxd);
    } 
}
int main(){
 	cin >>N>>M>>Q;
  	rep(i,Q){
    	int x,y,z,w;
    	cin >>x>>y>>z>>w;
    	a[i]=x-1;
      	b[i]=y-1;
      	c[i]=z;
      	d[i]=w;
    }
  	dfs(N,M,1);
  	cout<<maxd;
  
}


Measured memory_bytes: 3600
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int R = sc.nextInt(), G = sc.nextInt(), B = sc.nextInt(), N = sc.nextInt();
        int ans = 0;
        for (int i = 0; i <= N/R; i++)
            for (int j = 0; j <= (N-i*R)/G; j++)
                if ((N-i*R-j*G) % B == 0)
                    ans += 1;
        System.out.println(ans);
    }
}


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

int main()
{
	int a, b, c;
	cin >> a >> b >> c;
	if (a == b) {
		cout << c;
	}
	else if (a == c) {
		cout << b;
	}
	else {
		cout << a;
	}
	return 0;
}

Measured memory_bytes: 256
N = int(input())
dp = [[0, 0, 0] for _ in range(N + 1)]

for i in range(1, N+1):
    a, b, c = map(int, input().split())
    dp[i][0] = a + max(dp[i - 1][1], dp[i - 1][2])
    dp[i][1] = b + max(dp[i - 1][2], dp[i - 1][0])
    dp[i][2] = c + max(dp[i - 1][0], dp[i - 1][1])

print(max(dp[N]))

Measured memory_bytes: 86656
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define loop(i, s, n) for (int i = s; i < n; i++)
#define all(in) in.begin(), in.end()
#define rep(i, n) for (int i = 0; i < n; i++)
#define loop(i, s, n) for (int i = s; i < n; i++)
#define all(in) in.begin(), in.end()
#define MP make_pair
#define INF (sizeof(int) == 4 ? (int) 1e9 : (int) 1e18)
#define EPS 0.0000000001
using namespace std;
template <class T, class S> void cmin(T &a, const S &b) {
    if (a > b) a = b;
}
template <class T, class S> void cmax(T &a, const S &b) {
    if (a < b) a = b;
}
template <typename Head, typename Value>
auto vectors(const Head &head, const Value &v) {
    return vector<Value>(head, v);
}
template <typename Head, typename... Tail> auto vectors(Head x, Tail... tail) {
    auto inner = vectors(tail...);
    return vector<decltype(inner)>(x, inner);
}
template <class T> void join(T a) {
    for (auto itr : a) {
        if (itr != *a.begin()) cout << " ";
        cout << itr;
    }
}
using ll   = long long;
using ld   = long double;
using pii  = pair<int, int>;
using piii = pair<int, pii>;
int W, H;
int dx[] = {0, 0, 1, -1}, dy[] = {1, -1, 0, 0};
bool valid(int x, int y) { return (0 <= x && x < W) && (0 <= y && y < H); }
#define int ll
main() {
    int n, q;
    cin >> n >> q;
    int res = 0;
    int MOD = n;
    rep(_, q) {
        int Q, k;
        cin >> Q >> k;
        if (Q) {
            res = (k + res) % MOD;
        } else {
            cout << (res + k - 1) % MOD + 1 << endl;
        }
    }
}


Measured memory_bytes: 3096
// Original macro is in https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = || -> String {
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}
 
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};
 
    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
    
    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}
 
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };
 
    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [$t:tt]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };
 
    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };
 
    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };
 
    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

// for adhoc read (ex. https://atcoder.jp/contests/abc112/tasks/abc112_a)
#[allow(dead_code)]
fn read_line() -> String {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

fn main() {
    input!{x_1:i32,y_1:i32,x_2:i32,y_2:i32}
    // A(x_1, y_1), B(x_2, y_2), C(x_3, y_3), D(x_4, y_4)
    let x_3 = y_1 - y_2 + x_2;
    let y_3 = (-1)*x_1 + x_2 + y_2;
    let x_4 = x_1 + y_1 - y_2;
    let y_4 = (-1)*x_1 + x_2 + y_1;
    println!("{} {} {} {}", x_3, y_3, x_4, y_4);
}



Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=2e5+10;
int a[maxn];
int main()
{
   double x,y,z,w;
     cin>>x>>y>>z>>w;
     printf("%.6f ",(double)(x*y)/2);
     if(z==x/2&&w==y/2)
        cout<<1<<endl;
     else
        cout<<0<<endl;


    return 0;
}


Measured memory_bytes: 256
import java.util.LinkedList;
import java.util.Queue;
import java.util.Scanner;
import java.util.Iterator;

class Graph {
	private int totalVertex;
	int[] path;
	private LinkedList<LinkedList<Integer>> adjList;
	//adjacency list of edges
	public Graph() { totalVertex = 0; }
	public void loadAdjList() {
		Scanner in = new Scanner(System.in);
		totalVertex = in.nextInt();
		int edges = in.nextInt();
		path = new int[totalVertex];
		adjList = new LinkedList<LinkedList<Integer>>();
		for(int i = 0; i < totalVertex; i ++) {
			LinkedList<Integer> tmp = new LinkedList<Integer>();
			adjList.add(tmp);
			path[i] = 0;
			}	
			for(int i = 0; i < edges; i++) {
				int vert = in.nextInt();
				int edge = in.nextInt();
				path[edge] += 1;
				adjList.get(vert).add(edge);
				
		}
		in.close();
	}
	public void printAdjMatrix() {
		Queue<Integer> vertices = new LinkedList<Integer>();
		for(int i = 0; i < adjList.size(); i++) {
			if(path[i] == 0) {
				vertices.add(i);
			}
		}
		while(vertices.size() != 0) {
			int vertice = vertices.poll();
			System.out.println(vertice);
			for(Integer v :adjList.get(vertice)) {
				path[v] = path[v] - 1;
				if(path[v] == 0) {
					vertices.add(v);
				}
			}
		}
	}
}

//change class name GraphRepresentation to Main() for submission to AIZU
public class Main {
	public static void main(String argv[]) {
		Graph g = new Graph();
		g.loadAdjList();
		g.printAdjMatrix();
	}
}


Measured memory_bytes: 74508
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
#include <cmath>
#include <chrono>
using namespace std;

int main(int argc, const char * argv[]) {
    
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int N;
    cin >> N;
    vector<vector<int>> a(2, vector<int>(N));
    for (int i = 0; i < 2; i++) {
        for (int j = 0; j < N; j++) {
            cin >> a.at(i).at(j);
        }
    }
    int ans = 0;
    for (int i = 0; i < N; i++) {
        int temp = 0;
        for (int j = 0; j <= i ; j++) {
            temp += a.at(0).at(j);
        }
        for (int j = i; j < N; j++) {
            temp += a.at(1).at(j);
        }
        ans = max(ans, temp);
    }
    
    cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>
#include <cstring>
#include <cassert>


using namespace std;
#define SZ(x) (int)(x.size())
#define REP(i, n) for(int i=0;i<n;++i)
#define FOR(i, a, b) for(int i=a;i<b;++i)
#define RREP(i, n) for(int i=n-1;i>=0;--i)
#define RFOR(i, a, b) for(int i=b-1;i>=a;--i)

#define all(x) begin(x),end(x)
#define dump(x) cerr<<#x<<" = "<<(x)<<endl
#define debug(x) cerr<<#x<<" = "<<(x)<<" (L"<<__LINE__<<")"<< endl;

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using P = pair<int, int>;
const double eps = 1e-8;
const ll MOD = 1000000007;
const int INF = INT_MAX / 2;
const ll LINF = LLONG_MAX / 2;

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

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


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

template<class T>
ostream &operator<<(ostream &os, const vector<T> &v) {
    os << "[";
    REP(i, SZ(v)) {
        if (i) os << ", ";
        os << v[i];
    }
    return os << "]";
}

// edit
int N;
vector<int> A;
vector<vector<int>> G;
vector<int> dp;
vector<int> ans;


void dfs(int v, int p = -1){
    // update dp
    
//    int idx = upper_bound(all(dp), A[v]) - dp.begin();
    int idx = lower_bound(all(dp), A[v]) - dp.begin();
    int val = dp[idx];
    dp[idx] = A[v];
    
//    ans[v] = idx;
    ans[v] = lower_bound(all(dp), INF) - dp.begin() - 1;
    
    for(auto e : G[v]){
        if(e != p){
            dfs(e, v);
        }
    }

    dp[idx] = val;
}



void solve() {
    cin >> N;
    A.resize(N);
    G.resize(N);
    dp.resize(N + 1, INF);
    dp[0] = -INF;
    ans.resize(N, -1);
    
    REP(i, N){
        cin >> A[i];
    }
    
    REP(i, N - 1){
        int u, v;
        cin >> u >> v;
        u--;v--;
        
        G[u].push_back(v);
        G[v].push_back(u);
    }
    
    dfs(0);
    
    for(auto e : ans){
        cout << e << endl;
    }
    
    
    
    

}


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
//    std::ifstream in("input.txt");
//    std::cin.rdbuf(in.rdbuf());

    solve();


    return 0;
}


Measured memory_bytes: 27516
def ii():
    return int(input())


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


def lvi(N):
    l = []
    for _ in range(N):
        l.append(ii())
    return l


def lv(N):
    l = []
    for _ in range(N):
        l.append(input())
    return l


def main():
    N, K = lii()
    a = lii()
    min_ix = None
    for i, v in enumerate(a):
        if v == 1:
            min_ix = i
            break

    def t(n, k):
        if n <= 0: return 0, 0

        ans = n // k
        if n % k:
            ans += 1
        return ans, n % k

    if N-1 - min_ix >= K-1 and min_ix >= K-1:
        ans1, p1 = t(min_ix, K-1)
        ans2, p2 = t(N-1 - min_ix, K-1)
        ans = ans1 + ans2
        if p1 > 0 and p2 > 0 and p1 + p2 <= K-1:
            ans -= 1
        return ans

    elif min_ix < K-1:
        d = K-1 - min_ix
        ans, _ = t(N-1 - min_ix - d, K-1)
        return 1 + ans

    elif N-1 - min_ix < K-1:
        d = K-1 - (N-1 - min_ix)
        ans, _ = t(min_ix - d, K-1)
        return ans + 1


if __name__ == '__main__':
    print(main())

Measured memory_bytes: 13812
#include <algorithm>
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <list>
#include <cmath>
#include <stack>
#include <string>
#include <cstring>
#include <numeric>
#include <iomanip>
#include <fstream>
using namespace std;
int main(){
	long long n;
	long long a[200000];
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	long long b[200000];
	long long c[200000];
	for(int i=0;i<n;i++){
		b[i]=a[i]+i;
		c[i]=i-a[i];
	}
	sort(b,b+n);
	sort(c,c+n);
	long long ans=0;
	for(int i=0;i<n;i++){
		ans+=upper_bound(c,c+n,b[i])-lower_bound(c,c+n,b[i]);
	}
	cout<<ans<<endl;
	return 0;
}

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

class Combination{
	private:
		const static long long MOD = 1e18+7;
		const static long long MAX = 510000;
		vector<long long> fact;
		vector<long long> finv;
		vector<long long> inv;
	public:
		Combination() : fact(MAX),finv(MAX),inv(MAX){ //n,k <=10^7くらいまで
			fact[0] = fact[1] = 1;
			finv[0] = finv[1] = 1;
			inv[1] = 1;
			for(int i=2;i<MAX;i++){
				fact[i] = fact[i-1] * i % MOD;
				inv[i] = MOD - inv[MOD%i] * (MOD/i) % MOD;
				finv[i] = finv[i-1] * inv[i] % MOD;
			}
		}

		long long nCk(long long n,long long k){
			if(n<k) return 0;
			if(n<0 || k<0) return 0;
			return fact[n] * (finv[k] * finv[n-k] % MOD) % MOD;
		}

		vector<long long> com; //n固定で n<=10^9, k <= 10^7
		void nCbigk(long long n){
			com.push_back(1);
            com.push_back(n);
            for(long long i=2;i<200010;i++){
                com.push_back((com[i-1] * (n-(i-1)) % MOD) * inv[i] % MOD);
            }
		}

};


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

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    int cnt[5]={};
    Combination C;
    rep(i,0,n){
        string tmp;
        cin >> tmp;
        if(tmp[0]=='M')cnt[0]++;
        if(tmp[0]=='A')cnt[1]++;
        if(tmp[0]=='R')cnt[2]++;
        if(tmp[0]=='C')cnt[3]++;
        if(tmp[0]=='H')cnt[4]++;
    }
    ll ans=0;
    rep(i,0,1<<5){
        bool f[5];
        rep(j,0,5) f[j] = false;
        int c = 0;
        rep(j,0,5){
            if(i & (1<<j)){ f[j] = true; c++;}
        }
        ll tmp=0;
        if(c==3){
            tmp++;
            rep(i,0,5){
                if(f[i]){
                    tmp *= cnt[i];
                }
            }
        }
        ans += tmp;
    }
    cout << ans << endl;
}


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

#define ll long long
#define ull unsigned long long
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(a,b) for(int a=0;a<(b);++a)
#define REP1(i,n) for(int i=1;i<=(n);++i)
#define debug(x) cerr<<#x<<": "<<x<<'\n'
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair
#define INF (1<<29)
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

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

template<class T=int>
T in(){T x;cin>>x;return (x);}
template<class T>
void print(T& x){cout<<x<<'\n';}

const int MOD =(int)1e9+7;
const int MAX =510000;
ll fac[MAX],finv[MAX],inv[MAX];
void COMint(){
    fac[0]=fac[1]=1;
    finv[0]=finv[1]=1;
    inv[1]=1;
    for(int 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 COM(int n,int k){
    if(n<k) return 0;
    if(n<0||k<0)return 0;
    return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD;
}
ll gcd(ll a,ll b){
    if(b==0)return a;
    if(a>b){
        swap(a,b);
    }
    return gcd(a,b%a);
}
ll lcm(ll a,ll b){
    ll g;g=gcd(a,b);
    return a*b/g;
}
bool compare_by_b(pair<int, int> a, pair<int, int> b) {
    if(a.second != b.second){
        return a.second < b.second;
    }else{
        return a.first < b.first;
    }
}

bool compare_by_a(pair<int, int> a, pair<int, int> b) {
    if(a.first != b.first){
        return a.first < b.first;
    }else{
        return a.second < b.second;
    }
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N=in();
    vector<int>s;
    int val;
    REP(i,N){
        cin>>val;
        s.pb(val);
    }
    vector<int> ans;
    REP(i,N){
        int _ans;_ans=0;
        REP(j,s.size()){
            if(s[j]==j+1){
                _ans=j+1;
            }
        }
        if(_ans==0){
            cout<<-1<<endl;
            return 0;
        }
        s.erase(s.begin()+_ans-1);
        ans.pb(_ans);
    }
    REP(i,ans.size()){
        cout<<ans[ans.size()-1-i]<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define GET_REP(_1, _2, _3, NAME, ...) NAME
#define rep(...) GET_REP(__VA_ARGS__, irep, _rep)(__VA_ARGS__)
#define rep1(...) GET_REP()(__VA_ARGS__, irep1, _rep1)(__VA_ARGS__)
#define _rep(i, n) irep (i, 0, n)
#define _rep1(i, n) irep1(i, 1, n)
#define irep(i, a, n) for (int i = a; i < (int)(n); ++i)
#define irep1(i, a, n) for (int i = a; i <= (int)(n); ++i)
#define rrep(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define rrep1(i, n) for (int i = (int)(n); i >= 1; --i)
#define allrep(X, x) for (auto &&X : x)
#define all(x) (x).begin(), (x).end()
#ifdef LOCAL
  #include "../../Lib/cout_container.hpp"
  #define debug(x) cerr << #x " => " << x << endl
#else
  #define debug(x) 0
#endif
using lint = long long;
constexpr int    INF  = 1 << 30;
constexpr lint   INFL = 1LL << 62;
constexpr int    MOD  = (int)1e9 + 7;
constexpr double EPS  = 1e-9;
using namespace std;
namespace { struct INIT { INIT() { cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(15); } } INIT; }

int main(void) {
  int n;
  cin >> n;
  int ans = 1;
  rep (i, 3) ans *= n;
  cout << ans << endl;
  return 0;
}

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

using namespace std;

int cnt1[100010],cnt2[100010];
int main(){
    int i,q,n,m,a,b,c,d;
    string s,t;
    cin >> s >> t >> q;
    n = s.size();
    m = t.size();
    cnt1[0]=0; cnt2[0] = 0;
    for(i=0;i<n;i++){
        if(s[i]=='A'){
            cnt1[i+1] = cnt1[i] + 1;
        }else{
            cnt1[i+1] = cnt1[i] + 2;
        }
    }

     for(i=0;i<m;i++){
        if(t[i]=='A'){
            cnt2[i+1] = cnt2[i] + 1;
        }else{
            cnt2[i+1] = cnt2[i] + 2;
        }
    }
    
    for(i=0;i<q;i++){
        cin >> a >> b >> c >> d;
        if((cnt1[b]-cnt1[a-1])%3==(cnt2[d]-cnt2[c-1])%3){
            cout << "YES" << endl;
        }else{
            cout <<"NO" << endl;
        }
    }
}

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

using namespace std;

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

    vector<int> v(w);
    for (int i=0; i<w; ++i) v[i] = i + 1;

    int a, b;
    char c;
    for (int i=0; i<n; ++i) {
        cin >> a >> c >> b;
        swap(v[a - 1], v[b - 1]);
    }

    for (int i=0; i<w; ++i) {
        cout << v[i] << endl;
    }

    return 0;
}

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

using namespace std;
using ll = long long;
using pint = pair<int, int>;

int main() {
	int N;
	cin >> N;
	vector<ll> A(N);
	for (int i = 0; i < N; ++i) {
		cin >> A[i];
		if (A[i] == 0) {
			cout << 0 << endl;
			return 0;
		}
	}

	ll ans = 1;
	for (int i = 0; i < N; ++i) {
		if (A[i] <= 1000000000000000000 / ans) {
			ans *= A[i];
		}
		else {
			ans = -1;
			break;
		}
	}
	cout << ans << endl;
	return 0;
}


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

int main()
{
	int64_t h, w, n;
	cin >> h >> w >> n;
	vector<int64_t> rs(n), cs(n), vs(n);
	for (int64_t i = 0; i < n; i++)
	{
		cin >> rs[i] >> cs[i] >> vs[i];
		rs[i]--;
		cs[i]--;
	}

	vector<vector<int64_t>> board(h, vector<int64_t>(w));
	for (int64_t i = 0; i < n; i++)
	{
		board[rs[i]][cs[i]] = vs[i];
	}

	vector<vector<vector<int64_t>>> dp(h, vector<vector<int64_t>>(w, vector<int64_t>(4, 0)));
	if (0 < board[0][0])
	{
		dp[0][0][1] = board[0][0];
	}

	for (int64_t i = 0; i < h; i++)
	{
		for (int64_t j = 0; j < w; j++)
		{
			for (int64_t k = 0; k <= 3; k++)
			{
				if (i + 1 < h)
				{
					dp[i + 1][j][0] = max(dp[i + 1][j][0], dp[i][j][k]);
					dp[i + 1][j][1] = max(dp[i + 1][j][1], dp[i][j][k] + board[i + 1][j]);
				}
				if (j + 1 < w)
				{
					dp[i][j + 1][k] = max(dp[i][j + 1][k], dp[i][j][k]);

					if (k + 1 <= 3)
					{
						dp[i][j + 1][k + 1] = max(dp[i][j + 1][k + 1], dp[i][j][k] + board[i][j + 1]);
					}
				}
			}
		}
	}

	cout << max({dp[h - 1][w - 1][0], dp[h - 1][w - 1][1], dp[h - 1][w - 1][2], dp[h - 1][w - 1][3]}) << endl;

	return 0;
}

Measured memory_bytes: 711508
S=lambda:input()
I=lambda:int(input())
L=lambda:list(map(int,input().split()))
LS=lambda:list(map(str,input().split()))

def main():
    w,h,x,y=L()
    print(w*h/2,end=" ")
    print(1 if w/2==x and h/2==y else 0)
    

if __name__=='__main__':
    main()

Measured memory_bytes: 3316
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int count = 0;
		if (n > 1) {
			count += (n * (n - 1)) / 2;
		}
		if (m > 1) {
			count += (m * (m - 1)) / 2;
		}
		System.out.println(count);
		sc.close();
	}

}

Measured memory_bytes: 21844
#include<stdio.h>

int main(){
	
	int H,W,i,h;
	while(1){
		scanf("%d %d",&H,&W);
		if(H==0 && W==0)break;
		for(i=0;i<H;i++){
			for(h=0;h<W;h++){
				if(i%2==h%2){
					printf("#");
				} else {
					printf(".");
				}
			}
			printf("\n");
		}
		printf("\n");
	}
	
	return 0;
}



Measured memory_bytes: 2048
N = int(input())
 
T = []
for i in range(5):
	T.append(int(input()))
 
#print()
 
#print(N)
#print(T)
 
minT = min(T)
#print(minT)
 
indminT = T.index(minT)
#print(indminT)
 
time = 1 + indminT - 1 + ((N-1)//minT) + 1 + 5 - (indminT + 1)
print(time)

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

int main() {
  int N, K;
  cin >> N >> K;
  int n = 1;
  for (int i = 0; i < N; i++) {
    if (n < K) {
      n *= 2;
    } else {
      n += K;
    }
  }
  cout << n;
}


Measured memory_bytes: 256
using System;

namespace Rouding2
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input_txt = Console.ReadLine().Split();
            int X = int.Parse(input_txt[0]);
            int A = int.Parse(input_txt[1]);

            if(0 <= X && X <= 9) {
                if (0 <= A && A <= 9) {
                    if(X < A) {
                        Console.WriteLine("0");
                    } else {
                        Console.WriteLine("10");
                    }
                }
            }
        }
    }
}

Measured memory_bytes: 11092
// 

#include <cstdio>
#include <iostream>
#include <algorithm>
#include <deque>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <map>
#include <cmath>
#include <stack>

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

using namespace std;

int main(){
  int n;
  string s[55];
  int data[55][26];
  for(int i = 0; i < 55; i++){
    for(int k = 0; k < 26; k++){
      data[i][k] = 0;
    }
  }
  cin >> n;
  for(int i = 0; i < n; i++){
    cin >> s[i];

    int len = s[i].length();
    for(int k = 0; k < len; k++){
      data[i][s[i][k] - 'a']++;
    }
  }

  for(int k = 0; k < 26; k++){
    int sum = 100;
    for(int i = 0; i < n; i++){
      sum = min(sum, data[i][k]);
    }
    for(int i = 0; i < sum; i++){
      cout << char(k + 'a');
    }
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 256
# ALDS1_2_B - Selection Sort
def main():
    N, *A = map(int, open(0).read().split())
    swap = 0
    for i in range(N):
        mi = i
        for j in range(i, N):
            if A[j] < A[mi]:
                mi = j
        if i != mi:
            A[i], A[mi] = A[mi], A[i]
            swap += 1
    print(*A)
    print(swap)


if __name__ == "__main__":
    main()


Measured memory_bytes: 5608
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=1000000007,MAX=200005,INF=1<<29;

int prime[MAX];//i番目の素数
bool is_prime[MAX+1];

void sieve(int n){
    int p=0;
    for(int i=0;i<=n;i++){
        is_prime[i]=true;
    }
    
    is_prime[0]=is_prime[1]=false;
    
    for(int i=2;i<=n;i++){
        if(is_prime[i]){
            prime[p++] = i;
            for(int j=2*i;j<=n;j+=i){
                is_prime[j] = false;
            }
        }
    }
}

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    sieve(MAX-3);
    
    while(1){
        int M,A,B;cin>>M>>A>>B;
        if(M+A+B==0) break;
        
        int maxi=0;
        int a=0,b=0;
        for(int i=1;i*i<=M;i++){
            for(int j=i;i*j<=M;j++){
                if(is_prime[i]&&is_prime[j]){
                    if(A*j<=B*i){
                        if(maxi<i*j){
                            maxi=i*j;
                            a=i;
                            b=j;
                        }
                    }
                }
            }
        }
        
        cout<<a<<" "<<b<<endl;
    }
}



Measured memory_bytes: 3408
def main():
    N = int(input())
    A = [input() for i in range(N)]
    As = set(A)
    if len(A) != len(As):
        return print("No")
    pre = A[0][-1]
    for a in A[1:]:
        if pre != a[0]:
            return print("No")
        pre = a[-1]
    print("Yes")


if __name__ == '__main__':
    main()


Measured memory_bytes: 38256
import java.util.*;
public class Main {
	static Scanner sc = new Scanner(System.in);
	static ArrayList<HashSet<Integer>> list = new ArrayList<HashSet<Integer>>();
	static int N, K;
	static boolean[] areYouFine;
	static int[][] pair;
	public static void main(String[] args) {
		while(read()){
			solve();
			list.removeAll(list);
		}
	}
	
	static boolean read(){
		if(!sc.hasNext())return false;
		N = sc.nextInt();
		areYouFine = new boolean[N+1];
		Arrays.fill(areYouFine, true);
		K = sc.nextInt();
		for(int i = 0; i < K; i++){
			int rabbitsRidingOnBoat = sc.nextInt();
			HashSet<Integer> boat = new HashSet<Integer>();
			for(int j = 0; j < rabbitsRidingOnBoat; j++){
				boat.add(sc.nextInt());
			}
			list.add(boat);
		}
		int row = sc.nextInt();
		pair = new int[row][2];
		for(int i = 0; i < pair.length; i++){
			pair[i][0] = sc.nextInt();
			pair[i][1] = sc.nextInt();
		}
		return true;
	}
	
	static void solve(){
		int res = 0;
		for(int i = 0; i < pair.length; i++){
			int rabbit1 = pair[i][0], rabbit2 = pair[i][1];
			for(int j = 0; j < list.size(); j++){
				HashSet<Integer> boat = list.get(j);
				if(boat.contains(rabbit1) && boat.contains(rabbit2)){
					areYouFine[rabbit1] = false;
					areYouFine[rabbit2] = false;
				}
			}
		}
		for(boolean rabbt : areYouFine){
			if(!rabbt)res++;
		}
		System.out.println(res);
	}
}

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

typedef long long ll;
const int INF = 1e9;
const ll LINF = 1e18;
const int mod = 1e9+7;

#define pi pair<int,int>
#define pl pair<lld,lld>

#define dump(x) cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define SANKOU(n,a,b) cout << ((n) ? (#a) : (#b) ) << endl

#define mem0(x) memset(x,0,sizeof(x))
#define fillnum(x,n) fill(begin(x),end(x),n)
#define asort(x) sort(x.begin(),x.end())
#define dsort(x,t) sort(x.begin(),x.end(),greater<t>())
#define vuniq(x) x.erase(unique(x.begin(), x.end()), x.end())

#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)

int main() {
    int A,B,C;
    cin >> A >> B >> C;
    if((A == B && B == C) || (A != B && B != C && A != C)){
        Yes(0);
    } else {
        Yes(1);
    }
}

Measured memory_bytes: 3632
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
#define ROF(i,a,b) for(int i=a;i>=b;i--)
#define per(i,a) ROF(i,a,0)
#define pb push_back
using namespace std;
using ll=long long;
using ld=long double;
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<P> vP;
typedef vector<char> vc;
typedef vector<vc> vvc;
const ll MOD=1000000007;
const ll MOD2=998244353;
const ld PI=acos(-1);
const ll INF=1e18;
struct edge{ll to,cost;};
struct edge2{ll from,to,cost;};

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

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

int divide(int x,int y){
    if(x>=0){
        return x/y;
    }
    else{
        return -1+(x+1)/y;
    }
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int H,W,D;
    cin >> H >> W >> D;
    vvc color(H,vc(W));
    char C[]={'R','G','B','Y'};
    rep(i,H){
        rep(j,W){
            color[i][j]=C[((i+j)/D)%2*2+(2+divide(i-j,D)%2)%2];
        }
    }
    rep(i,H){
        rep(j,W){
            cout << color[i][j];
        }
        cout << endl;
    }
}
/*
overflow checked?
corner case checked?
boundary checked?
not TLE in worst case checked?
*/

Measured memory_bytes: 3776
from math import gcd
#================================================
N=int(input())
A=list(map(int,input().split()))

F=[0]*N
G=[0]*N

F[0]=A[0]
G[-1]=A[-1]

for i in range(1,N):
    F[i]=gcd(F[i-1],A[i])
    G[-(i+1)]=gcd(G[-i],A[-(i+1)])

F=[0]+F+[F[-1]]
G=[G[0]]+G+[0]

M=0
for i in range(N):
    M=max(M,gcd(F[i],G[i+2]))
print(M)


Measured memory_bytes: 90884
from collections import Counter

n,x,y = map(int,input().split())
x -= 1
y -= 1
r = y - x + 1
ans = []

for i in range(n):
    for j in range(i+1,n):
        if (x<i and i<y) and (x<j and j<y):
            ans.append(min(j-i , r - (j-i)))
        elif (i <= x) and (x<j and j<y):
            ans.append(min(j-x , r - (j-x)) + (x-i))
        elif (i <= x) and (j <= x):
            ans.append(j-i)
        elif (i <= x) and (y <= j):
            ans.append(j-i- (y-x) + 1)
        elif (y <= j) and (x<i and i<y):
            ans.append(min(y-i , r - (y-i)) + (j-y))
        elif (x <= j) and (y <= i):
            ans.append(j-i)
            
aa = Counter(ans)

for i in range(1,n):
    print(aa[i])

Measured memory_bytes: 119884