akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<queue>
#include<deque>
#include<map>
#include<bitset>
using namespace std;

typedef long long ll;
#define rep(i, n) for(int i = 0;i < (n);i++)
#define repr(i, n) for(int i = (n);i >= 0;i--)
#define repf(i, m, n) for(int i = (m);i < (n);i++)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1;} return 0;}
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1;} return 0;}
int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};
//////////////////////////////////////////////////


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

Measured memory_bytes: 3572
while 1:
    n,m,p=map(int,input().split())
    if n==m==p==0:break
    ticket=[]
    for i in range(n):ticket.append(int(input()))
    if ticket[m-1]==0:print(0)
    else:print(sum(ticket)*(100-p)//ticket[m-1])


Measured memory_bytes: 5612
// template version 1.15
using namespace std;
#include <bits/stdc++.h>

// varibable settings
#define int long long
const int INF=1e18;

// define basic macro {{{
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _rrep(i,n) rrepi(i,0,n)
#define rrepi(i,a,b) for(int i=(int)((b)-1);i>=(int)(a);--i)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
#define each(i,a) for (auto&& i : a)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define mt(a, b, c) make_tuple(a, b, c)
#define divceil(a,b) ((a)+(b)-1)/(b)
#define is_in(x, a, b) ((a)<=(x) && (x)<(b))
#define uni(x) sort(all(x));x.erase(unique(all(x)),x.end())
#define ub upper_bound
#define lb lower_bound
#define posl(A, x) (lower_bound(all(A), x)-A.begin())
#define posu(A, x) (upper_bound(all(A),x)-A.begin())
template<class T> inline void chmax(T &a, const T &b) { if((a) < (b)) (a) = (b); }
template<class T> inline void chmin(T &a, const T &b) { if((a) > (b)) (a) = (b); }

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long double ld;
typedef pair<int,int> pii;
typedef tuple<int,int,int> iii;

template<typename T> using PQ = priority_queue<T, vector<T>, greater<T>>;
struct Fast { Fast(){ std::cin.tie(0); ios::sync_with_stdio(false); } } fast;

#if defined(PCM) || defined(LOCAL)
  #include "lib/dump.hpp"
#else
  #define dump(...) 42
  #define dump_1d(...) 42
  #define dump_2d(...) 42
  #define cerrendl 42
#endif
//}}}

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

  string x;
  string y;
  rep(i, a) x += '0'+b;
  rep(i, b) y += '0'+a;
  dump(x, y);

  cout << (x<y ? x : y) << endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main{
    public static void main(String[] args){
	new Main().run();
    }
    Scanner sc = new Scanner(System.in);

    int n, p;

    void run(){
	while(sc.hasNext()){
	    n = sc.nextInt();
	    if(n==0) break;

	    p = cal(n); // パターン数
	    //System.out.println("pattern:"+p);
	    p = p/10 + (p%10==0 ? 0:1); // 日数
	    //System.out.println("days:"+p);
	    p = p/365 + (p%365==0 ? 0:1); // 年変換

	    System.out.println(p);
	}
    }

    int cal(int n){
	if(n<0) return 0;
	if(n==0) return 1;

	return cal(n-1)+cal(n-2)+cal(n-3);
    }
}

Measured memory_bytes: 19304
def main():
    N = int(input())
    A = list(map(int, input().split()))
    c = [0] * N
    for r in reversed(range(N)):
        ar = A[r]
        c[r] = t = ar
        for l in range(r + 1, N):
            c[l] = t = max(ar - c[l], A[l] - t)
    
    print(c[-1])


main()


Measured memory_bytes: 3444
A,B,C,K = map(int, open(0).read().split())
count = 0
while B <= A:
    if count < K:
        count += 1
        B *= 2
    else:
        print('No')
        break
else:
    while C <= B:
        if count < K:
            count += 1
            C *= 2
        else:
            print('No')
            break
    else:
        print('Yes')

Measured memory_bytes: 9212
#include <iostream>

using namespace std;

int main()
{
   int a, b, t, i;
   for(i=1; i<=3000; i++)
   {
       cin >> a >> b;
       
       if(a > b)
       {  
           t = a;
           a = b;
           b = t;
       }
        if(a == 0, b == 0)
          break;
          
       cout << a << " " << b << endl;
    }
}


Measured memory_bytes: 3092
using System;
using System.IO;
using System.Linq;

class Program
{
    static void Main(string[] args)
    {
        var ab = Console.ReadLine().Split().Select(int.Parse).ToArray();
        var a = ab[0];
        var b = ab[1];
        int answer = 0;
        for (int soc = 1; soc < b; soc += a, b++) answer++;
        var writer = new StreamWriter(Console.OpenStandardOutput()) {AutoFlush = false};
        Console.SetOut(writer);
        Console.WriteLine(answer);
        Console.Out.Flush();
    }
}

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

map <string, int> ids;

char buf[10];

string read(){
	scanf("%s", buf);
	return buf;
}

vector <double> all;
vector <int> movex[2], movey[2], constx, consty;

void add(vector <int> a, vector <int> b, double p){
	if (!a.size() || !b.size()) return ;
	all.push_back(abs(a[0] - b[0]) / p);
	all.push_back(abs(a[0] - b.back()) / p);
	all.push_back(abs(a.back() - b[0]) / p);
	all.push_back(abs(a.back() - b.back()) / p);
}

double f(double x){
	double minj = 1e18, maxj = -1e18;
	if (movex[0].size()) minj = min(minj, movex[0][0] - x), maxj = max(maxj, movex[0].back() - x);
	if (movex[1].size()) minj = min(minj, movex[1][0] + x), maxj = max(maxj, movex[1].back() + x);
	if (constx.size()) minj = min(minj, (double)constx[0]), maxj = max(maxj, (double)constx.back());
	double ans = maxj - minj;
	minj = 1e18, maxj = -1e18;
	if (movey[0].size()) minj = min(minj, movey[0][0] - x), maxj = max(maxj, movey[0].back() - x);
	if (movey[1].size()) minj = min(minj, movey[1][0] + x), maxj = max(maxj, movey[1].back() + x);
	if (consty.size()) minj = min(minj, (double)consty[0]), maxj = max(maxj, (double)consty.back());
	return ans * (maxj - minj);
}

int main(){
	int n; scanf("%d", &n);
	ids["D"] = 0, ids["U"] = 1, ids["L"] = 2, ids["R"] = 3;
	for (int i = 0; i < n; i++){
		int x, y; scanf("%d%d", &x, &y);
		int type = ids[read()];
		if (type < 2) constx.push_back(x), movey[type & 1].push_back(y);
		else consty.push_back(y), movex[type & 1].push_back(x);
	}
	sort(movex[0].begin(), movex[0].end());
	sort(movey[0].begin(), movey[0].end());
	sort(movex[1].begin(), movex[1].end());
	sort(movey[1].begin(), movey[1].end());
	sort(constx.begin(), constx.end());
	sort(consty.begin(), consty.end());
	all.push_back(0);
	add(movex[0], movex[1], 2.0), add(movex[0], constx, 1.0), add(movex[1], constx, 1.0);
	add(movey[0], movey[1], 2.0), add(movey[0], consty, 1.0), add(movey[1], consty, 1.0);
	double ans = 1e18;
	for (int i = 0; i < all.size(); i++){
		double x = all[i];
		ans = min(ans, f(x));
	}
	printf("%.9lf\n", ans);
	return 0;
}


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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> pll;
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int(i) = 0; (i) < (n); (i)++)

const ll MOD = 1000000007;
const ll INF = 1e18; //1*10^18

ll powll(ll a, ll n)
{ //O(log n)
  ll res = 1;
  while (n > 0)
  {
    if (n & 1) //(n & 1)=(n % 2 !=0)
    {
      res = res * a;
    }
    a = a * a;
    n >>= 1; //(n & 1)=(n % 2 !=0)
  }
  return res;
}

ll modpow(ll a, ll n, ll mod) //O(log n)
{
  ll res = 1;
  while (n > 0)
  {
    if (n & 1) //(n & 1)=(n % 2 !=0)
    {
      res = res * a % mod;
    }
    a = a * a % mod;
    n >>= 1; //(n>>=1)=(n/2)
  }
  return res;
}

int ReturnDigit(ll num)
{
  string number = to_string(num);
  return number.length();
}

const ll MAX = 1e4;
long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit()
{
  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;
  }
}

// 二項係数計算
long long 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;
}

int main()
{
  // srand((unsigned int)time(NULL));//--> rand()
  ll i, j, k, l, ans = 0;
  ll a, b, c, x, y;
  cin >> a >> b >> c >> x >> y;

  if (c * 2 <= a && c * 2 <= b)
  {
    ans = max(x, y) * c * 2;
  }
  else if (c * 2 <= a)
  {
    ans += x * c * 2;
    y = max(0ll, y - x);
    ans += y * b;
  }
  else if (c * 2 <= b)
  {
    ans += y * c * 2;
    x = max(0ll, x - y);
    ans += x * a;
  }
  else if (c * 2 <= a + b)
  {
    ans += min(x, y) * c * 2;
    if (x < y)
    {
      ans += (y - x) * b;
    }
    else
    {
      ans += (x - y) * a;
    }
  }
  else
  {
    ans += x * a + y * b;
  }

  cout << ans << endl;
}


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

int main(){
  string s;cin>>s;
  int k;cin>>k;
  
  for(int i=0;i<s.size();++i){
    if(s[i]!='1'){
      if(i+1<=k){
      cout<<s[i]<<endl;
      return 0;
      }
      else{
      cout<<1<<endl;
      return 0;
      }
    }
  }
  cout<<1<<endl;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define INF (1LL<<30)
#define DEKAI 1000000007
#define lp(i,n) for(int i=0;i<n;i++)
#define int long long

int da(int a,int b){
	  int r, x, tmp;
 
  x = a * b;
 
  /* 自然数 a > b を確認・入替 */
  if(a<b){
    tmp = a;
    a = b;
    b = tmp;
  }
 
  /* ユークリッドの互除法 */
  r = a % b;
  while(r!=0){
    a = b;
    b = r;
    r = a % b;
  }
  return x/b;
}


int solv(int a,int b,int c){
	int d=da(b,c);
	return a/b+a/c-a/d;
}


signed main(){
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	cout<<b-a+1-(solv(b,c,d)-solv(a-1,c,d))<<endl;
	return 0;
}

Measured memory_bytes: 256
X, K, D = map(int, input().split())
scnt = abs(X) // D
if K <= scnt:
    print(abs(X) - K * D)
else:
    if X % D == 0:
        if (K - scnt) % 2 == 0:
            print(0)
        else:
            print(D)
    else:
        if (K - scnt) % 2 == 0:
            print(abs(abs(X) - scnt * D))
        else:
            print(min(abs(abs(X) - (scnt + 1) * D), abs(X - (scnt + 1) * D)))


Measured memory_bytes: 9196
N = int(input())
li = list(map(int, input().split()))
ans = "Yes"
count = N - 1
while count >= 1:
    if li[count] - li[count-1] >= 0:
        pass
    elif li[count] - li[count-1] == -1:
        li[count-1] -= 1
    else:
        ans = "No"
        break
    count -= 1
print(ans)

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

bool isNum(char ch){
  return ('0'<=ch&&ch<='9');
}

vector<string> f(string s){
  vector<string> res;
  string tmp="";
  for(int i=0;i<(int)s.size();i++){
    if( i && (isNum(s[i-1]) != isNum(s[i])) ){
      res.push_back(tmp);
      tmp="";
    }
    tmp.push_back(s[i]);
  }
  if( tmp!="" )res.push_back(tmp);
  return res;
}

bool judge(string A,string B){
  if( isNum(A[0]) && isNum(B[0]) ){
    if( A.size() == B.size())return A<B;
    else return A.size()<B.size();
  }
  if( isNum(A[0]) )return true;
  if( isNum(B[0]) )return false;
  return A<B;
}

bool judge( vector<string> A, vector<string> B ){
  int n=min(A.size(),B.size());
  for(int i=0;i<n;i++){
    if(A[i]==B[i])continue;
    return judge(A[i],B[i]);
  }
  return (A.size()<B.size());
}

vector<string> input(){
  string str;
  cin>>str;
  return f(str);
}
int main(){
  int n;
  cin>>n;
  vector<string> A,B;
  A=input();
  for(int i=0;i<n;i++){
    B=input();
    cout<< ( (A==B || judge(A,B)) ? '+' : '-') <<endl;
  }
  return 0;
}



Measured memory_bytes: 3236
using System;
using System.Collections.Generic;

class MyClass
{
    static string repeat(int num, int repeat)
    {
        string str = "";
        for (int i = 0; i < repeat; i++)
        {
            str += num.ToString();
        }
        return str;
    }

    static void Main(string[] args)
    {
        int n;
        while ((n=int.Parse(Console.ReadLine())) != 0)
        {
            int point = 0;
            bool nomove = false;
            string[] stone = new string[n];
            for (int i = 0; i < n; i++)
            {
                stone[i] = Console.ReadLine().Replace(" ", "");
            }
            while (!nomove)
            {
                nomove = true;
                for (int i = 0; i < n; i++)
                {
                    for (int chain = 5; chain >= 3; chain--)
                    {
                        for (int start = 0; start <= 5 - chain; start++)
                        {
                            for (int num = 1; num < 10; num++)
                            {
                                if (stone[i].Substring(start, chain) == repeat(num, chain))
                                {
                                    stone[i] = stone[i].Replace(repeat(num, chain), repeat(0, chain));
                                    point += num * chain;
                                    nomove = false;
                                    break;
                                }
                            }
                        }
                    }
                }
                for (int i = n - 1; i >= 0; i--)
                {
                    for (int j = 0; j < 5; j++)
                    {
                        if (stone[i][j] == '0')
                        {
                            for (int k = i; k >= 0; k--)
                            {
                                if (stone[k][j] != '0')
                                {
                                    string str1 = "";
                                    string str2 = "";
                                    for (int l = 0; l < 5; l++)
                                    {
                                        str1 += (l == j) ? stone[k][l] : stone[i][l];
                                        str2 += (l == j) ? '0' : stone[k][l];
                                    }
                                    stone[i] = str1;
                                    stone[k] = str2;
                                    break;
                                }
                            }   
                        }
                    }
                }
            }
            Console.WriteLine(point);
        }
    }
}


Measured memory_bytes: 5844
import java.util.Scanner;




public class Main {

    public static void main(String[] args) {

    	Main main=new Main();

    	main.run();

    }

    void run() {
    	Scanner sc=new Scanner(System.in);

    	String S=sc.next();

    	String[] s=S.split("");

    	boolean hasS=false;
    	boolean hasN=false;
    	boolean hasW=false;
    	boolean hasE=false;

    	for(int i=0;i<s.length;i++) {

    		if(s[i].equals("S")) {
    			hasS=true;
    		}else if(s[i].equals("N")) {
    			hasN=true;
    		}else if(s[i].equals("W")) {

    			hasW=true;

    		}else {
    			hasE=true;
    		}

    	}

    	boolean inX=(hasS==hasN);
    	boolean inY=(hasW==hasE);

    	if(inX && inY) {
    		System.out.println("Yes");
    	}else {
    		System.out.println("No");
    	}

    }


}



Measured memory_bytes: 21844
//Radhe Radhe
#include<bits/stdc++.h>
#define godspeed  ios_base:: sync_with_stdio(false); cin.tie(0); cout.tie(0);

#define limit 1000000000000000000 //1e18
#define mod 1000000007 //1e9+7
#define llu long long unsigned
#define ll long long
#define ld long double
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define rep(i,n)    for(ll i=0; i<n; i++)
#define rep1(i,a,b)    for(ll i=a; i<b; i++)
#define repV(i,n)    for(ll i=0; i<v.size(); i++)
#define fixed cout.setf(ios::fixed);
#define Precise cout.precision(7);
#define yes cout<<"Yes"<<'\n';
#define no cout<<"No"<<'\n';
using namespace std;

int main()
{
    godspeed
    ll  i,j,n,k;
    cin>>n;
    ll a[n],spell=0;
    for(i=0; i<n; i++)
        cin>>a[i];
    for(i=0; i<n-1; i++)
    {
        if(a[i]==a[i+1])
        {
            a[i+1]=0;
            spell++;
        }
    }
    cout<<spell<<endl;
    return 0;
}


Measured memory_bytes: 3620
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <map>
#include <set>
#include <algorithm>
#include <string>
#include <queue>
#define PIE 3.14159265358979
#define rep(i,n) for(int i = 0;i < (n);i++)
using namespace std;
typedef long long ll;

double dp[305][305][305];
int N;

double dfs(int i,int j,int k){
    if(dp[i][j][k]>=0){
        return dp[i][j][k];
    }
    double ret=0.0;
    if(i>0) ret += dfs(i-1,j,k)*i;
    if(j>0) ret += dfs(i+1,j-1,k)*j;
    if(k>0) ret += dfs(i,j+1,k-1)*k;
    ret += N;
    ret /= (i+j+k);
    
    dp[i][j][k]=ret;
    return ret;
}

int main() {
    int a[4]={0,0,0,0};
    cin>>N;
    rep(i,N){
        int temp;
        cin>>temp;
        a[temp]++;
    }
    rep(i,305){
        rep(j,305){
            rep(k,305){
                dp[i][j][k]=-1;
            }
        }
    }
    dp[0][0][0]=0.0;
    printf("%.10lf\n",dfs(a[1],a[2],a[3]));
    return 0;
}



Measured memory_bytes: 221952
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <iomanip> // double
using namespace std;
using vi = vector<int>;
using vii = vector<vi>;
using in6 = int64_t;
using ind = double;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
ios::sync_with_stdio(false);
cout << fixed << setprecision(5);
ind a,b;
cin >> a >> b;
ind f = a / b;
int d = f;
cout << d << " " << (int)a % (int)b << " " << f << "\n";
}


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

class Program
{
    static void Main()
    {
        string[] arr = Console.ReadLine().Split(' ');
        int N = int.Parse(arr[0]);
        int M = int.Parse(arr[1]);
        int ac = 0;
        int wa = 0;

        bool[] arrAC = new bool[N];
        int[] arrWA = Enumerable.Repeat(0, N).ToArray();

        for (int i = 0; i < M; i++)
        {
            string[] ps = Console.ReadLine().Split(' ');
            int qNo = int.Parse(ps[0]);
            if (N < qNo || qNo < 1)
            {
                continue;
            }

            if (arrAC[qNo - 1])
            {
                continue;
            }


            if (ps[1] == "AC")
            {
                arrAC[qNo - 1] = true;
                wa += arrWA[qNo - 1];
                ac++;
            }
            else
            {
                arrWA[qNo - 1]++;
            }
        }

        Console.WriteLine(ac.ToString() + " " + wa.ToString());
    }
}

Measured memory_bytes: 18656
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
		int n = in.nextInt();
		String s = in.next();
		long r = solve(n, s);
		System.out.println(r);
		in.close();
	}

	private static long solve(int n, String s) {
		long[][] dp = new long[n][n + 1];
		long[][] prefixSum = new long[n][n + 1];
		dp[0][1] = 1;
		prefixSum[0][1] = 1;
		// for (int i = 1; i <= n; i++) {
		// dp[0][i] = 1;
		// prefixSum[0][i] = prefixSum[0][i - 1] + dp[0][i];
		// }
		for (int i = 1; i <= n - 1; i++) {
			for (int j = 1; j <= i + 1; j++) {
				if (s.charAt(i - 1) == '<') {
					dp[i][j] = add(dp[i][j], prefixSum[i - 1][j - 1]);
				} else {
					if (j <= i) {
						dp[i][j] = add(dp[i][j], add(prefixSum[i - 1][i], -prefixSum[i - 1][j - 1]));
					}
				}
				prefixSum[i][j] = add(prefixSum[i][j - 1], dp[i][j]);
			}
		}
		long r = 0;
		for (int i = 1; i <= n; i++) {
			r = add(r, dp[n - 1][i]);
		}
		return r;
	}

	static long mod = 1000000007;

	static long add(long a, long b) {
		long r = a + b;
		if (r < 0) {
			r += mod;
		}
		return r % mod;
	}

	static long mul(long a, long b) {
		return (a * b) % mod;
	}

	static String str(int[] a) {
		String[] str = new String[a.length];
		for (int i = 0; i < a.length; i++) {
			str[i] = a[i] + "";
		}
		return String.join(" ", str);
	}

	static int[] getIntArr(Scanner in, int size) {
		int[] arr = new int[size];
		for (int i = 0; i < size; i++) {
			arr[i] = in.nextInt();
		}
		return arr;
	}

	static int[][] getIntArr(Scanner in, int row, int col) {
		int[][] arr = new int[row][];
		for (int i = 0; i < row; i++) {
			arr[i] = getIntArr(in, col);
		}
		return arr;
	}

	static char[] getCharArr(Scanner in, int size) {
		char[] arr = in.next().toCharArray();
		return arr;
	}

	static String[] getStringArr(Scanner in, int size) {
		String[] arr = new String[size];
		for (int i = 0; i < size; i++) {
			arr[i] = in.next();
		}
		return arr;
	}

	static Map<Integer, List<Integer>> getEdges(Scanner in, int size, boolean directed) {
		Map<Integer, List<Integer>> edges = new HashMap<>();
		for (int i = 0; i < size; i++) {
			int from = in.nextInt();
			int to = in.nextInt();
			if (!edges.containsKey(from)) {
				edges.put(from, new ArrayList<Integer>());
			}
			edges.get(from).add(to);
			if (!directed) {
				if (!edges.containsKey(to)) {
					edges.put(to, new ArrayList<Integer>());
				}
				edges.get(to).add(from);
			}

		}
		return edges;
	}
}


Measured memory_bytes: 179664
def main():
	n = int(input())
	List = list(map(int,input().split()))
	# print(List)
	ans = []

	for i in range(n):
		ans.append(0)
	
	# print(ans)
	
	for i in range(n):
		# print("i = {}".format(i))
		# print("List[i] ={}".format(List[i]))
		ans[List[i]-1] = i+1
		# print("ans[i] = {}".format(ans[i]))
		# print("List[List[i]] = {}".format(List[List[i]-1]))

	print(' '.join(map(str,ans)))

if __name__ == '__main__':
	main()

Measured memory_bytes: 65324
#include<stdio.h>

int main(void){
    char ch[3];
    scanf("%s",ch);
    if (ch[0]=='A' && ch[1] == 'B' && ch[2] == 'C')
        printf("ARC");
    if (ch[0]=='A' && ch[1] == 'R' && ch[2] == 'C')
        printf("ABC");
        
    return 0;
}

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

int main() {
#ifdef LOCAL_DEFINE
	//freopen("in.txt", "rt", stdin);
	//freopen("out.txt", "w", stdout);
	long long _begin_time = clock();
#endif
	
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout << fixed << setprecision(15);
	int n;
	cin >> n;
	cout << (n & 1 ? n << 1 : n) << '\n';

#ifdef LOCAL_DEFINE
	long long _end_time = clock();
	cerr << "time = " << _end_time - _begin_time << " ms\n";
#endif
	return 0;
}

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

int main() {
	int N;
	cin >> N;
	vector<ll> L(N,0);
	for (int i = 0; i < N; i++) {
		cin >> L[i];
	}

	ll c = 0;
	for (int i = 0; i < N - 2; i++) {
		for (int j = i + 1; j < N - 1; j++) {
			for (int k = j + 1; k < N; k++) {
				set<ll> l;
				l.insert(L[i]);
				l.insert(L[j]);
				l.insert(L[k]);
				if (l.size() != 3) continue;
				ll A = *l.begin();
				ll B = *(++l.begin());
				ll C = *(++(++l.begin()));
				if (A + B > C) c++;
//				cout << A << " " << B << " " << C << " " << c << endl;
//				cout << L[i] << " " << L[j] << " " << L[k] << endl;
			}
		}
	}
	cout << c << endl;
	return(0);
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std ;
char s[55][55] ;
int d[55][55] ;
vector< pair< int , int > > v , vv ;
bool vis[55][55] ;
int fx[4] = { -1 , 0 , 1 , 0 } ;
int fy[4] = { 0 , 1 , 0 , -1 } ;
int main(){
    int n , m ;
    cin >> n >> m ;
    for( int i = 1 ; i <= n ; i++ )
        scanf( "%s" ,s[i] + 1 ) ;
    int cnt = 0 ;
    for( int i = 1 ; i <= n ; i++ )
        for( int j = 1 ; j <= m ; j++ )
           if ( s[i][j] == '.' ) cnt++ ;
    memset( d , 0x3f , sizeof( d ) ) ;
    v.push_back( make_pair( 1 , 1 ) ) ; d[1][1] = 0 ; vis[1][1] = true ;
    int dis = 0 ;
    while( v.size() ){
          dis++ ; vv.clear() ;
          for( int i = 0 ; i < v.size() ; i++ ){
              int x = v[i].first ;
              int y = v[i].second ;
              for( int j = 0 ; j < 4 ; j++ ){
                  int xx = x + fx[j] ;
                  int yy = y + fy[j] ;
                  if ( xx >= 1 && xx <= n && yy >= 1 && yy <= m && s[xx][yy] == '.' && !vis[xx][yy] ){
                      d[xx][yy] = dis ;
                      vis[xx][yy] = true ;
                      vv.push_back( make_pair( xx , yy ) ) ;
                  }
              }
          }
          v = vv ;
    }
    int ans ;
    if ( d[n][m] == 0x3f3f3f3f ) ans = -1 ;
    else ans = cnt - d[n][m] - 1 ;
    cout << ans << endl ;
    return 0 ;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define sz(arr) (int)arr.size()
#define All(arr) arr.begin(), arr.end()

using namespace std;
typedef long long ll;

void _cin() {}
template <class Head, class... Tail>
void _cin(Head&& head, Tail&&... tail) {
  cin >> head;
  _cin(forward<Tail>(tail)...);
}

#define Cin(T, ...) \
  T __VA_ARGS__;    \
  _cin(__VA_ARGS__)

#define Cins(T, n, xs) \
  vector<T> xs(n);     \
  for (int i = 0; i < n; ++i) cin >> xs[i]

void Main() {
  Cin(int, n, k);
  Cins(int, n, h);

  int ans = 0;
  for (auto e : h) {
    if (e >= k) ans++;
  }
  cout << ans << endl;
}

int main() {
  cout << fixed << setprecision(15);
  Main();
  return 0;
}

Measured memory_bytes: 640
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int h = sc.nextInt();
		int x = sc.nextInt();
		int y = sc.nextInt();
		int r = sc.nextInt();

		sc.close();


		// はみ出しフラグ
		Boolean isOver = false;
		// 円の左チェック
		if(x-r < 0) isOver = true;
		// 円の下チェック
		if(y-r < 0) isOver = true;
		// 円の右チェック
		if(x+r > w) isOver = true;
		// 円の上チェック
		if(y+r > h) isOver = true;

		if(isOver) {
			System.out.println("No");
		} else {
			System.out.println("Yes");
		}



	}

}


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

#define rep(i, n) for(int i = 0; i<(n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef long long ll;

typedef pair<int, int> P;

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

    int m_i = 0;
    rep(i, N) {
        if (abs(a[m_i]) < abs(a[i])) m_i = i;
    }

    vector<P> ans;
    rep(i, N) {
        if (m_i == i) continue;
        ans.push_back(make_pair(m_i + 1, i + 1));
    }

    if (a[m_i] > 0) {
        rep(i, N - 1) ans.push_back(make_pair(i + 1, i + 2));
    } else {
        for (int i = N - 1; i > 0; i--) ans.push_back(make_pair(i + 1, i));
    }

    cout << ans.size() << endl;
    rep(i, ans.size()) cout << ans[i].first << " " << ans[i].second << endl;
}

Measured memory_bytes: 256
n, T = gets.split().map(&:to_i)
t = gets.split().map(&:to_i)
pre = 0
s = 0
for i in t do
  if pre + T > i
    s = s + i - pre
  else
    s = s + T
  end
  pre = i
end
s = s + T
puts s


Measured memory_bytes: 16004
#include <bits/stdc++.h>
using namespace std;
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;
}
typedef long long int ll;

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define endl "\n"
const double EPS = 1e-7;
const int INF = 1 << 30;
const ll LLINF = 1LL << 60;
const double PI = acos(-1);
const int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

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

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    map<string, ll> mp;
    for(int i = 0; i < n; i++) {
        string s;
        cin >> s;
        sort(ALL(s));
        mp[s]++;
    }
    ll ans = 0;
    for(const auto &p : mp) {
        ans += (p.second - 1) * p.second / 2;
    }
    cout << ans << endl;
}

Measured memory_bytes: 11264
#ifdef LOCAL
#include <cstdio>
#include <vector>
#include <algorithm>
#include <iostream>
#include <cstring>
#else
#include <bits/stdc++.h>
#endif
using namespace std ;

typedef long long ll ;
#define rep(i , n ) for ( int i =0; i < n ; i++)
#define _sort(arg) sort(begin(arg), end(arg))
#define MOD 1000000007
#define pb push_back
#define DEBUG(x) cout << #x << ": " << x << endl;

class UnionFind {
private:
	unsigned size_; 
	std::vector<unsigned> par, rank;
public:
	UnionFind() : size_(0), par(std::vector<unsigned>()), rank(std::vector<unsigned>()) {};
	UnionFind(unsigned size__) : size_(size__) {
		par.resize(size_); rank.resize(size_);
		for (unsigned i = 0; i < size_; i++) par[i] = i, rank[i] = 0;
	}
	unsigned size() { return size_; }
	//unsigned root(unsigned x) { return par[x] == x ? x : par[x] = root(par[x]); }
	unsigned root(unsigned x)
	{
		while(par[x] != x)
		{
			par[x] = par[par[x]];
			x = par[x];
		}
		return x;
	}
	bool same(unsigned x, unsigned y) { return root(x) == root(y); }
	void unite(unsigned x, unsigned y) {
		x = root(x), y = root(y);
		if (x == y) return;
		if (rank[x] < rank[y]) par[x] = y;
		else if (rank[x] == rank[y]) par[y] = x, rank[x]++;
		else par[y] = x;
	}
	bool operator==(const UnionFind &u) { return par == u.par; }
	bool operator!=(const UnionFind &u) { return par != u.par; }
};

/*
__attribute__((constructor))
void initial()
{
	cin.tie(NULL);
	ios::sync_with_stdio(false);
}
*/

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

	/*
	ll N, A, B, C,D,E;
	
	cin >> N >> A >> B >> C >> D >> E;
	ll a[6];
	memset(a, 0, sizeof(a));

	a[0] = N;
	ll total = 0;
	while(a[5] < N)
	{
		if (a[4] > 0)
		{
			ll tmp = min(a[4], E);
			a[4] -= tmp;
			a[5] += tmp;
		}
		if (a[3] > 0)
		{
			ll tmp = min(a[3], D);
			a[3] -= tmp;
			a[4] += tmp;
		}
		if (a[2] > 0)
		{
			ll tmp = min(a[2], C);
			a[2] -= tmp;
			a[3] += tmp;
		}
		if (a[1] > 0)
		{
			ll tmp = min(a[1], B);
			a[1] -= tmp;
			a[2] += tmp;
		}
		if (a[0] > 0)
		{
			ll tmp = min(a[0], A);
			a[0] -= tmp;
			a[1] += tmp;
		}
		total++;
	}
	cout << total << endl;
	*/

	ll N;
	ll a[5];

	cin >> N;
	ll min = 0;

	rep(i, 5)
	{
		cin >> a[i];
		if (a[i] < a[min])
		{
			min = i;
		}
	}

	ll total = 0;
	ll re = N / a[min];
	if (N % a[min])
	{
		re++;
	}
	total = re + 4;

	cout << total << endl;
	
	return 0;
}


Measured memory_bytes: 256
#include <iostream>

void print(int a[], int n) {
    std::cout << a[0];
    for (int i = 1; i < n; i++) {
        std::cout << " " << a[i];
    }
    std::cout << std::endl;
}

int main(int argc, const char *argv[]) {
    int n;
    std::cin >> n;
    int a[n];
    for (int i = 0; i < n; i++) {
        std::cin >> a[i];
    }
    print(a, n);
    int v, j;
    for (int i = 1; i < n; i++) {
        v = a[i];
        j = i - 1;
        while (j >= 0 && a[j] > v) {
            a[j + 1] = a[j];
            j--;
        }
        a[j + 1] = v;
        print(a, n);
    }
    return 0;
}

Measured memory_bytes: 3076
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,i,j,maxn=0;
	cin>>n;
	for(i=1;i<=n;i++)
		for(j=2;j<=10;j++)
			if(pow(i,j)>maxn&&pow(i,j)<=n)
				maxn=pow(i,j);
	cout<<maxn<<endl;
	return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,y;
  cin >> n >> y;
  y = y/1000;
  int breaknum = 0;
  int man;
  int gosen;
  int sen;
  for(man=0;man<=n;man++){
	  for(gosen=0;gosen<=n-man;gosen++){
		  sen=n-man-gosen;
		  if(10*man+5*gosen+sen==y){
			  cout<<man<<" "<<gosen<<" "<<sen;
			  breaknum=1;
			  break;
		  }
		  if(breaknum==1){
			  break;
		  }
	  }
	  if(breaknum==1){
		  break;
	  }
  }
  if(breaknum==0){
	  cout<<-1<<" "<<-1<<" "<<-1;  
  }
  return 0;
}

Measured memory_bytes: 256
N, M, C = map(int, input().split())
cnt = 0
B = list(map(int, input().split()))
for i in range(N):
    A = list(map(int, input().split()))
    ans = 0
    for j in range(M):
        ans += B[j] * A[j]
    if ans + C > 0:
        cnt += 1
print(cnt)

Measured memory_bytes: 38384
//#define __USE_MINGW_ANSI_STDIO 0
#include <iostream>
#include <bits/stdc++.h>
using namespace std;

#define debug(x) cout<<#x<<" :: "<<x<<endl;
#define debug2(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<endl;
#define debug3(x,y,z) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<endl;

#define boost ios::sync_with_stdio(0); cin.tie(0)

#define fi first
#define se second
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)

typedef long long ll;
typedef double ld;
typedef pair<int, int> pii;

const int N = 1e6 + 5;

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

set<int> S;

int main() {

	boost;
	string str; cin>>str;
	int n = str.length();
	str = '_' + str;

	if(str[1] == '0' or str[n] == '1') {
		cout<<"-1\n";
		return 0;
	}

	for(int i=1; i<=n-1; i++) {
		if(str[i] != str[n-i]) {
			cout<<"-1\n";
			return 0;
		}
	}

	str[n] = '1';

	S.insert(1);

	for(int i=2; i<=n; i++) {
		if(str[i] == '0') {
			S.insert(i);
		}
		else {
			for(auto it : S) {
				cout<<i<<" "<<it<<"\n";
			}
			S.clear();
			S.insert(i);
		}
	}
	
	return 0;
}

Measured memory_bytes: 6252
import java.util.*;

class Main{

    int[][] dist;

    void solve(){
	Scanner sc = new Scanner(System.in);
	
	while(true){
	    int n = sc.nextInt();
	    int m = sc.nextInt();
	    if(n==0 && m==0) break;

	    dist = new int[n][n];
	    for(int i=0; i<n; i++) Arrays.fill(dist[i], -1);

	    for(int i=0; i<m; i++){
		int a = sc.nextInt()-1;
		int b = sc.nextInt()-1;
		int c = sc.nextInt();
		dist[a][b] = c;
		dist[b][a] = c;
	    }

	    System.out.println(dijstra(0, n-1));
	}
    }

    int dijstra(int s, int t){
	//pos, cost, ticket
	PriorityQueue<int[]> 
	    q = new PriorityQueue<int[]>(t, new Comparator<int[]>(){
		    public int compare(int[] a, int[] b){
			return a[1] - b[1];
		    }
		});
	q.add(new int[]{0,0,2});

	boolean[][] v = new boolean[t+1][3];

	while(q.size()>0){
	    int[] qq = q.poll();
	    int pos = qq[0], cost = qq[1], ticket = qq[2];

	    if(pos==t && ticket!=1) return cost;

	    if(v[pos][ticket]) continue;
	    v[pos][ticket] = true;

	    for(int i=0; i<=t; i++){
		if(dist[pos][i]==-1) continue;
		if(ticket==1){
		    q.add(new int[]{i, cost, 0});
		    continue;
		}
		if(ticket==2) q.add(new int[]{i, cost, 1});
		q.add(new int[]{i,cost+dist[pos][i], ticket});
	    }
	}

	return -1;
    }

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

Measured memory_bytes: 31032
#include <iostream>
#include <math.h>
using namespace std;

int main(){
    int X, Y, H;
    int Hmax, Hmin;
    int N;
    int x[100], y[100], h[100];
    int comp = 0;
    Hmin = 0;

    cin >> N;
    for(int i = 0; i < N; i++){
        cin >> x[i] >> y[i] >> h[i];
        if(Hmin < h[i]){
            Hmin = h[i];
        }
    }

    for(X = 0; X <101; X++){
        for(Y = 0; Y < 101; Y++){
            for(H = Hmin; H < Hmin + 101; H++){
                for(int i = 0; i < N; i++){
                    if( max(int( H - fabs( X - x[i] ) - fabs( Y - y[i] )), 0) != h[i]){
                        break;
                    }
                    if( i == N - 1 ){
                        cout << X << " " << Y << " " << H << endl;
                        comp = 1;
                        break;
                    }
                }
                if(comp == 1) break;
            }
            if(comp == 1) break;
        }
        if(comp == 1) break;
    }
}




Measured memory_bytes: 764
#![allow(unused_imports)]
#![allow(unused_variables)]
use proconio::input;
use proconio::marker::*;
use std::cmp::{min, max};
use std::collections::{HashSet, HashMap, BinaryHeap};

fn calc(t: &mut Vec<u32>, abcd: &Vec<(usize, usize, u32, u32)>) -> u32{
    let mut res = 0;
    for i in abcd.iter(){
        if t[i.1] - t[i.0] == i.2{
            res += i.3;
        }
    }
    res
}

fn dfs(p: usize, x: usize, t: &mut Vec<u32>, n: usize, m: usize, abcd: &Vec<(usize, usize, u32, u32)>) -> u32{
    if p == n{
        return calc(t, abcd);
    }
    let mut res = 0;
    for i in x..=m{
        t[p] = i as u32;
        res = max(res, dfs(p + 1, i, t, n, m, abcd));
    }
    res
}

fn main() {
    input! {
        n: usize,
        m: usize,
        q: usize,
        abcd: [(Usize1, Usize1, u32, u32); q],
    }
    let mut t = vec![0; 10];
    let ans = dfs(0, 1, &mut t, n, m, &abcd);
    println!("{}", ans);
}


Measured memory_bytes: 2132
#!/usr/bin/env python3
import sys
from collections import deque, Counter
from heapq import heappop, heappush
from bisect import bisect_right
from itertools import accumulate

sys.setrecursionlimit(10**6)
INF = 10**12
m = 10**9 + 7

def main():
    N, T = map(int, input().split())
    A = list(map(int, input().split()))
    cost = [0]*N# cost[i]: i番目で買ってから最適に売ることで得られる利益
    q = []
    heappush(q,-A[N-1])
    for i in range(N-2,-1,-1):
        v = heappop(q)
        cost[i] = -v-A[i]
        heappush(q,v)
        heappush(q,-A[i])
    # print(cost)
    print(cost.count(max(cost)))

if __name__ == "__main__":
    main()


Measured memory_bytes: 21404
map$p[$'*$_]=1,//-$p[$']&&(2..1e6/$')for 2..1e5;$s[$_]=$s[$_-1]+($_%2&&!$p[$_]&&!$p[($_+1)/2])for 3..1e5;<>;/ /,print$s[$']-$s[$`-1],$/for<>

Measured memory_bytes: 62592
#include<cstdio>
#include<cmath>
#include<climits>
#include<algorithm>
#include<sstream>
#include<iostream>
#include<string>
#include<queue>
#include<stack>
#include<set>
#include<list>
#include<map>
#include<vector>

using namespace std;


#define rep(i,n) for(int i=0; i<n; i++)
#define rept(i,a,b) for(int i=a; i<b; i++)
#define ll long long
#define MOD 1000000007

#define IMIN INT_MIN;
#define IMAX INT_MAX;


int main(){
    int a, b, c;
    cin >> a >> b >> c;
    cout << ((a+b+c >= 22)? "bust" : "win") << endl;


	return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (int i= (a); i < (b); ++i)
typedef long long ll;
typedef pair<int,int> P;
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
int main() { int N;
  cin >> N;
  int a = N % 10;
  if(a==3){
    puts("bon");
  }else if(a==0||a==1||a==6||a==8){
    puts("pon");
  }else{
    puts("hon");
  }
}

Measured memory_bytes: 3632
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
void Say(bool say, string a = "Yes", string b = "No"){cout << (say ? a : b) << endl;};

int main(){

    string s;
    cin >> s;
    set<char>S;
    for(ll i = 0; i < s.size(); i++)S.insert(s[i]);
    Say(s.size() == S.size(), "yes", "no");

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <utility>
#include <functional>
#include <cmath>

#define REP(i,x,y) for(int i=(int)(x);i<(int)(y);i++)
#define RREP(i,x,y) for(int i=(int)(x);i>(int)(y);i--)
#define all(x) (x).begin(),(x).end()

#ifdef LOCAL
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define eprintf(...) 42
#endif

typedef long long ll;

using namespace std;

const int MAX_N = 100000;
int N;
int A[MAX_N];

void solve() {
    sort(A, A + N);

    int large = A[N-1];
    int small = A[0];
    int min_diff = large;

    REP(i, 0, N-1) {
        int diff = abs(large - 2 * A[i]);
        if (diff <= min_diff) {
            min_diff = diff;
            small = A[i];
        }
    }
    printf("%d %d\n", large, small);
}

int main() {
    // to shorten execution time for iostream
    cin.tie(0);
    ios::sync_with_stdio(false);

    cin >> N;
    REP(i, 0, N){
        cin >> A[i];
    }
    solve();
    return 0;
}


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

using namespace std;

int main()
{
	vector<int> v(3);
	cin >> v[0] >> v[1] >> v[2];
	
	sort(v.begin(), v.end());
	if(v[0] == 5 && v[1] == 5 && v[2] == 7)
	{
		cout << "YES" << endl;
	}
	else
	{
		cout << "NO" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define all(vec) vec.begin(),vec.end()
typedef long long int ll;
typedef pair<int,int> P;
const ll MOD=1000000007;
const ll INF=1000000010;
const ll LINF=4000000000000000010LL;
const int MAX=310;
const double EPS=1e-9;
int dx[4]={0,1,0,-1};
int dy[4]={1,0,-1,0};
ll l[100];
int main(){
    l[0]=2;
    l[1]=1;
    int n;cin>>n;
    for(int i=2;i<=n;i++){
        l[i]=l[i-1]+l[i-2];
    }
    cout<<l[n]<<endl;
}


Measured memory_bytes: 256
/**
*    author:  yuya1234
*    created: 09.07.2020 15:52:15
**/

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define FORV(i,v) for(auto i=v.begin(); i!=v.end();i++)

#define ALL(v) (s).begin(), (s).end()
#define SORT(s) sort((s).begin(),(s).end())
#define SORTD(s) sort((s).rbegin(),(s).rend())
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define SZ(x) ((int)(x).size())
#define MEMSET(v, h) memset((v), h, sizeof(v))

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

  int n,k;
  cin>>n>>k;

  int idx;
  int a[n];
  REP(i,n)
  {
    cin>>a[i];
    if(a[i]==1)idx=i;
  }

  int ans=INT_MAX-1,sum,l,r;
  l=idx;
  r=n-idx-1;

  REP(i,k-1)
  {
    l=idx-i;
    r=n-idx-1-(k-1)+i;
    sum=1+ceil(1.0*l/(k-1))+ceil(1.0*r/(k-1));
    ans=min(ans,sum);
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 3964
def check(s,A):
    A = [int(i) for i in A.split()]    
    B = [i for i in A  if i%2 ==0]
    
    for b in B:
        if b % 3 != 0 and b %5!=0:
            print('DENIED')
            return
    print('APPROVED')
    
s = int(input())
A = input()
check(s,A)

Measured memory_bytes: 3060
n, m = map(int, input().split())
ks = [list(map(int, input().split())) for _ in range(m)]
p = list(map(int, input().split()))

ans = 0

for i in range(2**n):
    light = 0
    for j in range(m):
        count = 0
        for k in range(1, ks[j][0]+1):
            if i & 2**(ks[j][k]-1) == 2**(ks[j][k]-1):
                count += 1
        if count % 2 == p[j]:
            light += 1
    if light == m:
        ans += 1

print(ans)

Measured memory_bytes: 3064
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<numeric>
#include<math.h>
using namespace std;
typedef long long ll;
ll mod = 1e9+7;
#define rep(i,n) for(int i = 0; i < (n); ++i)
int main() {
    int n;
    cin >> n;
    ll c, k;
    cin >> c >> k;
    vector<ll> t(n);
    rep(i, n) cin >> t[i];
    sort(t.begin(), t.end());
    ll ans = 0;
    int cur = 0;
    while(1) {
        if ( cur >= n ) break;
        int nex = cur;
        while(1) {
            if ( nex >= n || nex - cur >= c || t[nex] - t[cur] > k ) break;
            ++nex;
        }
        ++ans;
        cur = nex;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1024
#include <stdio.h>

int main()
{
	long long int a, b, x;
	
	scanf("%lld %lld %lld", &a, &b, &x);
	
	if(b == 0) printf("1");
	else if(a == 0) printf("%lld", b/x + 1);
	else printf("%lld", b/x - (a-1)/x);
	
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <cstdlib>
using namespace std;
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 long long INF = 1LL << 60;

// 入力
int N;
long long h[100010];

// メモ用の DP テーブル
long long dp[100010];

long long rec(int i) {
    // DP の値が更新されていたらそのままリターン
    if (dp[i] < INF) return dp[i];

    // 足場 0 のコストは 0
    if (i == 0) return 0;

    // i-1, i-2 それぞれ試す
    long long res = INF;
    chmin(res, rec(i-1) + abs(h[i] - h[i - 1])); // 足場 i-1 から来た場合
    if (i > 1) chmin(res, rec(i-2) + abs(h[i] - h[i - 2])); // 足場 i-2 から来た場合

    // 結果をメモしながら、返す
    return dp[i] = res;
}

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

    // 初期化 (最小化問題なので INF に初期化)
    for (int i = 0; i < 100010; ++i) dp[i] = INF;

    // 答え
    cout << rec(N-1) << endl;
}

Measured memory_bytes: 6528
#include <bits/stdc++.h>
using namespace std;
#define int long long int
int ar[100005];
int32_t main(){
	int n;cin>>n;
	int _1=0,_2=0,big=0;
	for(int i=1;i<=n;i++){
		cin>>ar[i];
		ar[i]&=-ar[i];
		if(ar[i]==1){
			_1++;
		}
		else if(ar[i]==2){
			_2++;
		}
		else {
			big++;
		}
	}
	if(big>=(_1-!_2)){
		cout<<"Yes";
	}
	else {
		cout<<"No";
	}
}


Measured memory_bytes: 1024
#include <iostream>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <vector>
#include <queue>
#include <algorithm>
#include <bitset>
#include <cstdlib>
#include <cmath>
#include <iomanip>
#define INF 100000000000
#define MOD 1000000007
#define ll long long int
//#define int long long int
using namespace std;

int main(){
  vector <int> A = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  int K; cin>>K;
  cout<<A[K-1]<<endl;

  return 0;
}

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

int main()
{
  int x = 0;
  int y = 0;
  int r = 0;
  int w = 0;
  int h = 0;
  
  cin >> w >> h >> x >> y >> r;
 
  if(x - r < 0 || x + r > w)
  {
    cout << "No" << endl;
  }else if(y - r < 0 || y + r > h)
  {
   	cout << "No" << endl;
  }
   else
  {
    cout << "Yes" << endl;
  }
}


Measured memory_bytes: 3116
N, M = map(int, input().split())
a = [int(i) for i in input().split()]
a.sort(reverse=1)
num = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6]

dp = [0] * (N+1)

for i in range(1, N+1):
    now = - 10 ** 9
    for aa in a:
        if i - num[aa] >= 0:
            now = max(now, dp[i-num[aa]]+1)
    dp[i] = now

answer = ''
for i in range(dp[-1]):
    for aa in a:
        if N >= num[aa]:
            if dp[N-num[aa]] == dp[N] - 1:
                answer += str(aa)
                N -= num[aa]
                break
print(answer)


Measured memory_bytes: 3420
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
 
int main() {
 
  int N; cin >> N;
  int K; cin >> K;
  
  ll ans = K;
  for(int i = 1; i < N; i++){
    ans *= K - 1;
  }
  
  cout << ans << endl;

}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <sstream>
#include <numeric>
#include <queue>
#include <sstream>
#include <set>
using namespace std;



int main(){
    string s ;
    cin >> s ;
    vector<int64_t> num(s.size()) ;
    for (size_t i = 0; i < s.size(); i++)
    {
        num.at(i) = s.at(i) - '0' ;
    }
    int64_t ans = 0;
    int64_t temp = 0 ;
    for (size_t bit = 0; bit < pow(2,s.size()-1); bit++)
    {
        temp += num.at(0) ;
        for (size_t i = 0; i < s.size()-1; i++)
        {
            if (bit & ( 1 << i ) )
            {
                ans += temp ;
                temp = num.at(i+1) ;
            }else
            {
                temp *= 10 ;
                temp += num.at(i+1) ;
            }
            
        }
        ans += temp ;
        temp = 0 ;
    }
    
    cout << ans << endl ;
}


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

int main(int argc, char const* argv[])
{
    std::string str;
    int n;
    getline(std::cin, str);
    n = std::stoi(str);

    auto res = n / 2 + n % 2;
    std::cout << res << std::endl;

    return 0;
}


Measured memory_bytes: 256