akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize(2)
#include<bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0)
#define ull unsigned ll
#define uint unsigned
#define pai pair<int,int>
#define pal pair<ll,ll>
#define IT iterator
#define pb push_back
#define fi first
#define se second
#define For(i,j,k) for (int i=(int)(j);i<=(int)(k);++i)
#define Rep(i,j,k) for (int i=(int)(j);i>=(int)(k);--i)
#define endl '\n'
#define ll long long
const int N = 2e5+5;
int a[N];
int n,k;
bool check(int mid){
    int need = 0;
    for(int i=1;i<=n;i++)
    {
        need += (a[i] - 1) / mid;
    }
    return need <= k;
}
int main()
{
   IOS;
   cin >> n >> k;
   for(int i=1;i<=n;i++) cin >> a[i];
   //二分答案//
   int l = 1, r = 1e9;
   while(r - l > 1){
       int mid = (l + r) >> 1;
       if(check(mid)) r = mid;//mid越短  切的刀数🔪应该越多  我们想要mid越短越好
       else l = mid;
   }
   cout << (check(l) ? l : r);
}


Measured memory_bytes: 4456
#pragma gcc optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort(ALL(V)) //小さい方からソート
#define REV(V) reverse(ALL(V)) //リバース
#define RSORT(V) SORT(V);REV(V) //大きい方からソート
#define NPN(V) next_permutation(ALL(V)) //順列
#define pb(n) push_back(n)
#define endl '\n'
#define Endl '\n'
#define DUMP(x)  cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define yes(n) cout << ((n) ? "yes" : "no"  ) << endl
#define Yay(n) cout << ((n) ? "Yay!": ":(") << endl
#define RAPID cin.tie(0);ios::sync_with_stdio(false)
#define VSUM(V) accumulate(ALL(V), 0)
#define MID(a,b,c) (a) < (b) && (b) < (c)
#define MIDe(a,b,c) (a) <= (b) && (b) <= (c)
#define IN(n) cin >> n
#define IN2(a,b) cin >> a >> b
#define IN3(a,b,c) cin >> a >> b >> c 
#define IN4(a,b,c,d) cin >> a >> b >> c >> d
#define VIN(V) for(int i = 0; i < (V).size(); i++) {cin >> (V).at(i);}
#define OUT(n) cout << n << endl
#define VOUT(V) REP(i, (V).size()) {cout << (V)[i] << endl;}
#define VOUT2(V) REP(i, (V).size()) {cout << (V)[i] << " ";} cout<<endl;
#define FIX cout << fixed << setprecision(15)

// 型マクロ定義
#define int long long
#define P pair<ll,ll>
#define Vi vector<ll>
#define VVi vector<vector<ll>>
#define Vd vector<double>
#define Vb vector<bool>
#define Vs vector<string>
#define Vc vector<char>
#define M map<ll,ll>
#define S set<ll>
#define PQ priority_queue<ll>
#define PQG priority_queue<ll,V,greater<ll>
//

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;}

using ll = long long;
using Graph = vector<vector<int>>;

const int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

int gcd(int a,int b){return b != 0 ? gcd(b, a % b) : a;} //最大公約数
int lcm(int a, int b){return a * b / gcd(a, b);}
string toStrUp(string str){char diff = 'A'-'a';REP(i,str.size()) str[i] += diff;return str;}
string gCh(string str, int key){return str.substr(key,1);}

signed main() {
  RAPID;
  // デフォルト変数定義
  int n=0,m=0,a=0,b=0,c=0,d=0,x=0,y=0,z=0;
  string s="",t="";
  //

  // ここから
  IN(n);
  Vi T(n);
  Vi X(n);
  Vi Y(n);
  REP(i,n){
    IN3(T[i],X[i],Y[i]);
  }
  int time = 0;
  bool ok = true;
  REP(i,n){
    int dit = T[i] - time;
    time = T[i];
    int did = abs(X[i]-x) + abs(Y[i]-y);
    x = X[i];
    y = Y[i];
    if(dit % 2 != did % 2 || dit < did) {
      ok = false;
      break;
    }
  }
  Yes(ok);
}

Measured memory_bytes: 2560
#include <iostream>

int main(void){
    int A, N;

    std::cin >> N; // 支払い額
    std::cin >> A; // 1円の枚数

    int amari = N % 500;
    if(amari <= A){
        std::cout << "Yes" << std::endl;
    }
    else{
        std::cout << "No" << std::endl;
    }

    return 0;
}

Measured memory_bytes: 256
from _collections import deque
n,m,k=map(int,input().split())

fre=[[] for _ in range(n+1)]
bro=[[] for _ in range(n+1)]

for i in range(m):
    a,b=map(int,input().split())
    fre[a].append(b)
    fre[b].append(a)

for i in range(k):
    a, b = map(int, input().split())
    bro[a].append(b)
    bro[b].append(a)

ans=[]

x=[-1]*(n+1)

for i in range(1,n+1):
    if x[i]==-1:
        x[i]=i
        data=deque([i])
        while len(data)>0:
            p=data.popleft()
            for j in fre[p]:
                if x[j]==-1:
                    x[j]=i
                    data.append(j)
g=[0]*(n+1)
for i in range(1,n+1):
    g[x[i]]+=1
for i in range(1,n+1):
    g[i]=g[x[i]]

for i in range(1,n+1):
    aa=g[i]-1
    aa-=len(fre[i])
    for j in bro[i]:
        if x[i]==x[j]:
            aa-=1
    ans.append(str(aa))
print(" ".join(ans))



Measured memory_bytes: 109580
#include <bits/stdc++.h>
#include <stdio.h>
#include <algorithm>
using namespace std;
#define r(i,n) for(int i=0;i<n;i++)
#define rn(i,n) for(int i=1;i<=n;i++)

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

  n*a>b? cout<<b<<endl : cout<<n*a<<endl;

  
  return 0;
}


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

typedef long long ll;
using namespace std;

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

	while(1){
		int n; cin >> n;
		if(n == 0) break;
		vector<ll> dp(31,-1);
		dp[0] = 1;
		dp[1] = 1;
		dp[2] = 2;
		dp[3] = 4;
		for (int i = 4;i <= n;i++){
			dp[i] = dp[i-1] + dp[i-2] + dp[i-3];
		}	
	
		ll day = (dp[n]-1)/10 + 1;
		cout << ((day - 1)/365 + 1) << endl;
	}

	return 0;

}



Measured memory_bytes: 3116
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long int64;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<29;
const long long  INFL = 1e18;
const int MOD = 1000000007;
const int MAX = 210000;
const int MAX_NUM = 999999999;
void solve() {
	string s; cin >> s;
	cout << s[0] + to_string(s.length() - 2) + s[s.size() - 1] << endl;	
	return;
}
int main() {
	solve();
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
    int n,m,l,A[200][200]={{0}},B[200][200]={{0}};
    long C[200][200]={{0}};
    int i,j,k;
    cin>>n>>m>>l;
    for(i=0; i<n; i++){
        for(j=0; j<m; j++){
            cin>>A[i][j];
        }
    }
    for(i=0; i<m; i++){
        for(j=0; j<l; j++){
            cin>>B[i][j];
        }
    }
    for(i=0; i<n; i++){
        for(j=0; j<l; j++){
            for(k=0; k<m; k++){
            C[i][j]+=A[i][k]*B[k][j];
            }
        }
    }
    for(i=0; i<n; i++){
        for(j=0; j<l; j++){
            cout<<C[i][j];
            if(j!=l-1)cout<<" ";
        }
        cout<<endl;
    }
}


Measured memory_bytes: 3728
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int a = sc.nextInt();
        int b = sc.nextInt();

        System.out.println(solve(a, b));

        sc.close();
    }

    static int solve(int a, int b) {
        return (a + b + 1) / 2;
    }
}

Measured memory_bytes: 21844
# 提出用のインプット
n, m, l = map(int, input().split())
A = [[0] * m for i in range(n)]
B = [[0] * l for i in range(m)]
C = [[0] * l for i in range(n)]
for i in range(n):
    A[i] = [int(i) for i in input().split()]
for i in range(m):
    B[i] = [int(i) for i in input().split()]

# # 動作確認用のインプット
# with open(file='input_itp1_7_d_1.txt', mode='r', encoding='utf8') as input:
#     n, m, l = map(int, next(input).split())
#     A = [[0] * m for i in range(n)]
#     B = [[0] * l for i in range(m)]
#     C = [[0] * l for i in range(n)]
#     for i in range(n):
#         A[i] = [int(i) for i in next(input).split()]
#     print(A)
#     for i in range(m):
#         B[i] = [int(i) for i in next(input).split()]
#     print(B)

for i in range(n):
    for j in range(l):
        tmp = 0
        for k in range(m):
            tmp += A[i][k] * B[k][j]
        C[i][j] = tmp
    print(' '.join(map(str, C[i])))




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

#define ll long long
#define pq priority_queue
#define debug(x) cerr << #x << ": " << x << endl;
#define line() cerr << "---------------" << endl;

int main() {
   string a, b;
   cin >> a >> b;
   string s = a + b;
   int c = stoi(s);
   for (int i = 1; i <= 1000; i++) {
      for (int j = 1; j <= 1000; j++) {
         if (i == j) {
            if (i*j == c) {
               puts("Yes");
               return 0;
            }
         }
      }
   }
   puts("No");

   return 0;
}

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

int main() {
  long long N, K; cin >> N >> K;
  vector<int> A(N);
  for (int i = 0; i < N; i++) {
    int a; cin >> a; a--;
    A.at(i) = a;
  };
  vector<bool> visited(N);
  vector<int> R;
  int cur = 0;
  bool flag = false;
  for (long long i = 0; i < K; i++) {
    if (visited.at(cur)) {
      R.push_back(cur);
      flag = true;
      break;
    }
    visited.at(cur) = true;
    R.push_back(cur);
    cur = A.at(cur);
  }
  if (!flag) {
    cout << cur + 1 << endl;
    return 0;
  }
  int left = 0;
  int right = ((int)R.size()) - 1;
  for (int i = 0; i < R.size(); i++) {
    if (R.at(i) == cur) {
      left = i;
      break;
    }
  }
  int cycle = right - left;
  K -= left;
  K %= cycle;
  cout << R.at(left + K) + 1 << endl;
}

Measured memory_bytes: 5072
def main():
    n, m = map(int, input().split())
    ab = [list(map(int, input().split())) for _ in [0]*(n-1)]

    g = [[] for _ in [0]*n]
    [g[a-1].append(b-1) for a, b in ab]
    [g[b-1].append(a-1) for a, b in ab]

    class rerooting():
        # addは頂点iに頂点jを根とする部分木（DPの値：x）をくっつけるときの補正
        def __init__(self, tree, ini, monoid, add):
            # 頂点iについて、jが根のときのDPの値を求める（アクセス時間を考慮してここで定義）
            def calc(i, j):
                root = tree_d[i][j]+1
                try:
                    return monoid(tc_l[i][root-1], tc_r[i][root])
                except:
                    return tc_l[i][root-1]
            size = len(tree)
            dp, order, q, anc = [ini]*size, [], [0], [-1]*n
            oa, qa, qp = order.append, q.append, q.pop
            tree_d = [{k: j for j, k in enumerate(i)} for i in g]
            g_size = [len(i) for i in g]
            tc_l = [[ini]*(i+1) for i in g_size]
            tc_r = [[ini]*i for i in g_size]

            # トポロジカル順序をorderに記録、0を根とする根付き木上のiの祖先をanc[i]とする
            while q:
                i = qp()
                a = anc[i]
                oa(i)
                for j in g[i]:
                    if j != a:
                        qa(j)
                        anc[j] = i

            # dpおよびtree_preに記録
            for i in order[:0:-1]:
                a = anc[i]
                d, t = add(a, i, dp[i]), tree_d[a][i]
                tc_l[a][t+1], tc_r[a][t], dp[a] = d, d, monoid(dp[a], d)

            # 頂点0のみ先に処理
            for j in range(1, g_size[0]+1):
                tc_l[0][j] = monoid(tc_l[0][j], tc_l[0][j-1])
            for j in range(g_size[0]-2, 0, -1):
                tc_r[0][j] = monoid(tc_r[0][j], tc_r[0][j+1])

            # 行きがけ順に処理
            for i in order[1:]:
                a = anc[i]
                d, c, length = tree_d[i][a], add(a, i, calc(a, i)), g_size[i]
                tc_l[i][d+1], tc_r[i][d] = c, c
                for j in range(1, length+1):
                    tc_l[i][j] = monoid(tc_l[i][j], tc_l[i][j-1])
                for j in range(length-2, 0, -1):
                    tc_r[i][j] = monoid(tc_r[i][j+1], tc_r[i][j])
                dp[i] = tc_l[i][-1]

            # アトリビュートに格納
            self.dp, self.tc_l, self.tc_r, self.tree_d, self.monoid = dp, tc_l, tc_r, tree_d, monoid

        # 頂点iについて、jが根のときのDPの値を求める

        def DP_part(self, i, j):
            root = self.tree_d[i][j]+1
            try:
                return self.monoid(self.tc_l[i][root-1], self.tc_r[i][root])
            except:
                return self.tc_l[i][root-1]

    def monoid1(x, y): return x*y % m
    def add1(i, j, x): return x+1

    r1 = rerooting(g, 1, monoid1, add1)
    for i in r1.dp:
        print(i)


main()


Measured memory_bytes: 127832
#include <bits/stdc++.h>
using namespace std;
typedef int64_t ll;
struct Solution {
    void solve(std::istream& in, std::ostream& out) {
        string s;
        in >> s;
        ll l = 0, r = s.size() - 1;
        ll ans = 0;
        while (l < r) {
            if (s[l] == s[r]) {
                l++;
                r--;
            }
            else if (s[l] == 'x') {
                ans++;
                l++;
            }
            else if (s[r] == 'x') {
                ans++;
                r--;
            }
            else {
                ans = -1;
                break;
            }
        }
        out << ans << '\n';
    }
};
void solve(std::istream& in, std::ostream& out) {
    out << std::setprecision(12);
    Solution solution;
    solution.solve(in, out);
}
#include <fstream>
#include <iostream>
int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    istream& in = cin;
    ostream& out = cout;
    solve(in, out);
    return 0;
}


Measured memory_bytes: 512
/*#include<iostream>
#include<algorithm>
#include<vector>
#include<cmath>
#include<string>*/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#define INF 1000000000000 //10^12:極めて大きい値,∞
#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--)

int main(){
    int a,b,c;
    cin >>a>>b>>c;
    if (a<b&&b<c) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 3084
package main

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

var sc = bufio.NewScanner(os.Stdin)

func Scanner() string {
	sc.Scan()
	return sc.Text()
}

func intScanner() int {
	n, _ := strconv.Atoi(Scanner())
	return n
}

func floatScanner() float64 {
	n, _ := strconv.ParseFloat(Scanner(), 64)
	return n
}
func stringToInt(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}
func stringSliceScanner(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = Scanner()
	}
	return a
}
func intSliceScanner(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = intScanner()
	}
	return a
}
func larger(a, b int) int {
	if a < b {
		return b
	} else {
		return a
	}
}
func smaller(a, b float64) float64 {
	if a > b {
		return b
	} else {
		return a
	}
}
func max(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x < a[i] {
			x = a[i]
		}
	}
	return x
}
func min(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x > a[i] {
			x = a[i]
		}
	}
	return x
}

var mod int

func main() {
	mod = 1000000007
	buf := make([]byte, 0)
	sc.Buffer(buf, mod)
	sc.Split(bufio.ScanWords)
	n := intScanner()
	m := intScanner()
	x := make([]int, n)
	for i := 0; i < m; i++ {
		a, b := intScanner()-1, intScanner()-1
		x[a]++
		x[b]++
	}
	ans := "YES"
	for i := 0; i < n; i++ {
		if x[i]%2 != 0 {
			ans = "NO"
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 2560
#include<cstdio>
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>

using namespace std;

int main(void) {

	int n, m;

	vector<string> s(100), t(100), mojikostr(100);
	int mojiko[100] = {}, mojikonum = 0;

	cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> s[i];
	}

	cin >> m;
	for (int i = 0; i < m; i++)
	{
		cin >> t[i];
	}

	//cout << "\n";


	for (int i = 0; i < n; i++)
	{
		//printf("i=%d\n", i);
		if (i == 0) {
			mojikostr[mojikonum] = s[i];
			mojiko[mojikonum]++;
			//cout << mojikonum << "p\n";
		}
		else {
			for (int sear = 0; sear <= mojikonum; sear++)
			{
				if (s[i] == mojikostr[sear]) {
					mojiko[sear]++;
					//cout << mojikostr[sear] << mojiko[sear] << "\n";
					break;
				}
				if (sear == mojikonum) {
					mojikonum++;
					mojikostr[mojikonum] = s[i];
					mojiko[mojikonum]++;
					//cout << mojikonum << "p\n";
					break;
				}
			}
		}

	}

	for (int i = 0; i < m; i++)
	{
		///printf("i=%d\n", i);
		for (int sear = 0; sear <= mojikonum; sear++)
		{
			if (t[i] == mojikostr[sear]) {
				mojiko[sear]--;
				//cout << mojikostr[sear] << mojiko[sear] << "\n";
				break;
			}
			if (sear == mojikonum) {
				mojikonum++;
				mojikostr[mojikonum] = t[i];
				mojiko[mojikonum]--;
				//cout << mojikonum << "m\n";
				break;
			}
		}
	}

	//cout << "\n";
	int maxn = 0;
	for (int i = 0; i <= mojikonum; i++)
	{
		maxn = max(maxn, mojiko[i]);
		//cout << mojikostr[i] << mojiko[i] << "\n";
	}

	cout << maxn << "\n";

	return 0;
}

Measured memory_bytes: 256
//int a = stoi(c); 文字列をintへ
//小文字から大文字
//transform(a.begin(), a.end(), a.begin(), ::toupper);
//途中の出力をそのまま残さない
//数値計算 個数以外はdouble
//map<キー,値> p は辞書。p[キー] = 値
//map 全探索
//auto begin = p.begin(), end = p.end();
//for (auto it = begin; it != end; it++) {}
//mapのキー：it->first mapのバリュー：it->second
//絶対値 abs()
//入力は空白で切れる
//大文字判定 isupper(文字) 小文字判定 islower(文字)
//do{}while(next_permutation(ALL(配列)))
//while(N)で回すとき、Nはコピーを作っておく
//小文字に対応する文字コード：S[i] - 'a'
//文字コード→小文字：(char)(数字+'a')
//グラフの距離:隣接行列で扱う
//等価なものに変換する思考
//bool型　初期値はTrue
//島渡りの問題：中間ノードに着目
//配列はvector<>を使う：意味わからないエラーがなくなる。
//背反な事象にちゃんとわける
//チェックリストはマップを使う
//数が大きい時の比較はstring型で行う
//全て0になったか調べたい->0になるたびにcntする
//またはかかつか
//例外処理は最初にする
#include <bits/stdc++.h>
#define rep(i,N) for(int i = 0; i < N;i++)
#define ALL(a) (a).begin(),(a).end()
#define ll long long int
using namespace std;

// K進数でのNの桁数
ll dig(ll N, ll K) {
	ll dig = 0;
	while (N) {
		dig++;
		N /= K;
	}
	return dig;
}
// a,bの最大公約数
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a%b);
}

ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}

//nC2の計算
ll C(ll N) {
	return N * (N - 1) / 2;
}

//円周率
const double PI = 3.14159265358979323846;
//割るやつ
const ll MOD = (pow(10, 9) + 7);

int main() {
	ll N, A, B, C, D, E; cin >> N >> A >> B >> C >> D >> E;
	vector<ll> a(5); 
	a[0] = A; a[1] = B; a[2] = C; a[3] = D; a[4] = E;

	sort(ALL(a));

	ll x;
	if (N%a[0] == 0)  x = N / a[0];
	else x = N / a[0] + 1;
	cout << x + 4 << endl;
}

Measured memory_bytes: 256
N, K = map(int, input().split())

def Base_10_to_n(X, n):
    if (int(X/n)):
        return Base_10_to_n(int(X/n), n)+str(X%n)
    return str(X%n)

ans = Base_10_to_n(N, K)
print(len(ans))

Measured memory_bytes: 38384
#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<utility>
#include<algorithm>
#include<cstdio>
#include<iomanip>
#include<queue>
#include<stack>

#define ll int64_t
#define Rep(i, n) for (ll i = 0; i < n; i++)

using namespace std;

const int MOD = 1000000007;

ll modpow (ll a, ll n) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a;
        a = a * a;
        n >>= 1;
    }
    return res;
}

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

    ll N, K;
    cin >> N >> K;

    ll num = N / K;

    ll ans = modpow(num, 3);
    if (K % 2 == 0) {
        if (N % K >= K/2) {
            num++;
        }
        ans += modpow(num, 3);
    }

    cout << ans << "\n";
}

Measured memory_bytes: 256
#include <iostream>
#include<vector>
#include<algorithm>
#include<queue>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,m,n) for(int i=m;i<(int)(n);i++)
typedef pair<int,int> pint;
typedef long long ll;
const int inf   = 1<<30;
const int mod=1000000007;    
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};

  
int main(){
  ll n,k;
  cin>>n>>k;
  ll a[n];
  rep(i,n)cin>>a[i];
  rep(i,n-1){
    if(a[i]+a[i+1]>=k){
      cout<<"Possible"<<"\n";
      rep(j,i)cout<<j+1<<"\n";
      REP(j,1,n-i-1)cout<<n-j<<"\n";
      cout<<i+1<<"\n";
      return 0;
      }
    }
  cout<<"Impossible"<<"\n";
  return 0;
  }


Measured memory_bytes: 1536
n, w = map(int, input().split())
weights, values = zip(*[tuple(map(int, input().split())) for _ in range(n)])
UV = 10**5
INF = 10**10
dp = [INF]*(UV+1)
dp[0] = 0

for i in range(1, n+1):
    for j in reversed(range(1, UV+1)):
        if j-values[i-1] < 0:
            continue
        dp[j] = min(dp[j], dp[j-values[i-1]]+weights[i-1])

ans = 0
for j in reversed(range(UV+1)):
    if dp[j] <= w:
        ans = j
        break
print(ans)



Measured memory_bytes: 41964
#include<algorithm>
#include<complex>
#include<ctype.h>
#include<iomanip>
#include<iostream>
#include<map>
#include<math.h>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<stdio.h>
#include<string>
#include<string>
#include<vector>

using namespace std;
typedef long long ll;

#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define ALL(v) (v).begin(), (v).end()
#define p(s) cout<<(s)<<endl
#define p2(s, t) cout << (s) << " " << (t) << endl
#define br() p("")
#define pn(s) cout << (#s) << " " << (s) << endl
#define p_yes() p("YES")
#define p_no() p("NO")

template < typename T >
void vprint(T &V){
	for(auto v : V){
    	cout << v << " ";
	}
	cout << endl;
}

const ll mod = 1e9 + 7;
const ll inf = 1e18;

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

    // input
    double n, m, d;
    cin >> n >> m >> d;

    if(d==0){
        double ans = 1.0 / n * (m-1);
        cout << setprecision(15);
        p(ans);
        return 0;
    }

    if(1+d > n){
        p(0);
        return 0;
    }

    // 以降、答えは0以上
    double beau = 2 * (n-d) / (n*n) * (m-1);
    
    cout << setprecision(15);
    p(beau);


    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,N) for(i=0;i<N;i++)
typedef long long ll;
typedef pair<int, int> P;
typedef struct{
  int first;
  int second;
  int third;
}T;

//昇順
bool comp_Se(T& l, T& r){
  return l.second < r.second;
}

int N;

int main(void){
  cin >> N;
  int n = N;
  while(true){
    int i = n,j;
    bool flag = true;
    j = i%10;
    while(i != 0){
      if(i%10 == j){
        i/=10;
      }else{
        flag = false;
        break;
      }
    }
    if(flag){
      cout << n << endl;
      break;
    }
    n++;
  }
  return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <string>
#include <iostream>
#include <set>
#include <queue>
#include <algorithm>
#include <vector>
#include <unordered_map>
using namespace std;

const int N = 1e6;

namespace fastinput
{
	/** Interface */

	inline long long readChar();
	template <class T = long long> inline T readInt();
	template <class T> inline void writeInt(T x, char end = 0);
	inline void writeChar(long long x);
	inline void writeWord(const char *s);

	/** Read */

	static const long long buf_size = 16384;

	inline long long getChar() {
		static char buf[buf_size];
		static long long len = 0, pos = 0;
		if (pos == len)
			pos = 0, len = fread(buf, 1, buf_size, stdin);
		if (pos == len)
			return -1;
		return buf[pos++];
	}

	inline long long readChar() {
		long long c = getChar();
		while (c <= 32)
			c = getChar();
		return c;
	}

	template <class T>
	inline T readInt() {
		long long s = 1, c = readChar();
		T x = 0;
		if (c == '-')
			s = -1, c = getChar();
		while ('0' <= c && c <= '9')
			x = x * 10 + c - '0', c = getChar();
		return s == 1 ? x : -x;
	}

	/** Write */

	static long long write_pos = 0;
	static char write_buf[buf_size];

	inline void writeChar(long long x) {
		if (write_pos == buf_size)
			fwrite(write_buf, 1, buf_size, stdout), write_pos = 0;
		write_buf[write_pos++] = x;
	}

	template <class T>
	inline void writeInt(T x, char end) {
		if (x < 0)
			writeChar('-'), x = -x;

		char s[24];
		long long n = 0;
		while (x || !n)
			s[n++] = '0' + x % 10, x /= 10;
		while (n--)
			writeChar(s[n]);
		if (end)
			writeChar(end);
	}

	inline void writeWord(const char *s) {
		while (*s)
			writeChar(*s++);
	}

	struct Flusher {
		~Flusher() {
			if (write_pos)
				fwrite(write_buf, 1, write_pos, stdout), write_pos = 0;
		}
	} flusher;
}

using namespace fastinput;

long double group = 0;

int main()
{
	::ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int a, b;
	cin >> a >> b;
	if (a <= 0 && b >= 0)
		cout << "Zero" << endl;
	else
		if (a > 0)
			cout << "Positive" << endl;
		else
			if (b < 0)
			{
				if ((b - a + 1) % 2 == 0)
					cout << "Positive" << endl;
				else
					cout << "Negative" << endl;
			}
	return 0;
}

Measured memory_bytes: 764
#include<bits/stdc++.h>
using namespace std;
vector<int>v;
main()
{
	int t,m,n,la=-1,co=1,cur=1,p;
	scanf("%d%d%d",&t,&m,&n);
	for(int i = 0;i < t;i++)
	{
		scanf("%d",&p);
		v.push_back(p);
	}
	sort(v.begin(),v.end());
	for(int i = 0;i < v.size();i++)
	{
		//printf("%d %d %d %d\n",cur,co,v[i],la);
		if(la==-1)
		la=v[i];
		else
		{
			//printf("i = %d\n",i);
			if(cur==m)
			{
				//printf("gt %d %d\n",la,v[i]);
				la=v[i];
				co++;
				cur=1;
				continue;
			}
			if(v[i]-la<=n)
			{
				//printf("         %d %d    ",v[i],la);
				cur++;
			}
			else
			{
				la=v[i];
				cur=1;
				co++;
				//printf("r");
			}
		}
	}
	printf("%d",co);
}

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

int N, M, X, Y;
int x[110], y[110];

int main()
{
	cin >> N >> M >> X >> Y;
	for (int i = 0; i < N; ++i)
		cin >> x[i];
	for (int i = 0; i < M; ++i)
		cin >> y[i];
	int max_x = *max_element(begin(x), begin(x) + N);
	int min_y = *min_element(begin(y), begin(y) + M);
	if (max_x < min_y && X < min_y && max_x < Y) {
		cout << "No War" << endl;
	}
	else {
		cout << "War" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
s = input()

a = [0] * (len(s)+1)

larger_count = 0
for i in range(len(s)):
    if s[i] == '>':
        larger_count += 1
        continue
    
    for j in range(larger_count+1):
        a[i-j] = max(a[i-j], j)
    larger_count = 0
    a[i+1] = a[i] + 1

for j in range(larger_count+1):
    a[len(a)-j-1] = max(a[len(a)-j-1], j)

print(sum(a))

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

int main(){
  ll x, k, d;
  cin >> x >> k >> d;
    
  x = abs(x);
  if(x/d >= k){
    cout << x-k*d << endl;
    return 0;
  }else{
    k -= x/d;
    if(k%2 == 0){
      cout << x-d*(x/d) << endl;
    }else{
      cout << abs(x-d*(x/d)-d) << endl;
    }
  }
 
  return 0;
}

Measured memory_bytes: 3608
N,K=map(int,input().split(' '))
Num=list(map(int,input().split(' ')))
l=list()
for i in range(K):
  min_Num=min(Num)
  l.append(min_Num)
  Num.remove(min_Num)
sum_Num=sum(l)
print(sum_Num)

Measured memory_bytes: 9248
#include<cstdio>
#include<algorithm>
using  namespace std;
int main(void)
{
	int n,k,ax,ay,MIN,i;
	scanf("%d %d",&n,&k);
	for(i=0;i<k;i++){
		scanf("%d %d",&ax,&ay);
		MIN=min(ax-1,ay-1);
		MIN=min(MIN,n-ax);
		MIN=min(MIN,n-ay);
		if(MIN>=3){
			MIN=MIN%3;
		}
		if(MIN==0){
			printf("1\n");
		}
		if(MIN==1){
			printf("2\n");
		}
		if(MIN==2){
			printf("3\n");
		}
	}
	return 0;
}


Measured memory_bytes: 2676
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <array>
#include <vector>
#include <functional>
#include <unordered_map> 
#include <map> 
#include <numeric>
#include <limits>
#include <utility>
#include <queue>
#include <random>
#include <bitset>
using namespace std;
typedef long long LL;

int main() {
	int t, i, j, k;
	int a, b, c=1 ,d,n,F=0;
	string A,D,E;
	char B,C;
	cin >> a >> b;
	if (a == 1) {
		c = 2;
	}
	else {
		while (F == 0) {
			if (c + b > c * 2) {
				c = c * 2;
				a--;
			}
			else {
				F = 1;
			}
		}

		while (a > 0) {
			c += b;
			a--;
		}
	}
	cout << c << endl;
	return 0;
}

Measured memory_bytes: 256
// Abhishek Chaturvedi- abhishekchaturvedi10oct //

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define endl            "\n"
#define inf             2e18+1
#define ninf            -2e18+1
#define mod             1000000007
#define eps             1e-9
#define ff              first
#define ss              second
#define int             long long 
#define ld              long double
#define str             string 
#define pb              emplace_back
#define mp              make_pair
#define vi              vector<int>
#define si              set<int>
#define pii             pair<int,int>
#define psi             pair<str,int>
#define mii             map<int,int>
#define msi             map<str,int>
#define maxheap         priority_queue<int>
#define minheap         priority_queue<int,vi,greater<int>>
#define sz(x)           (int)x.size()
#define all(x)          x.begin(),x.end()
#define allr(x)         x.rbegin(),x.rend()
#define gcd(x,y)        __gcd(x, y)
#define arrsz(x)        sizeof(x)/sizeof(x[0])
#define sp(x,y)         fixed<<setprecision(y)<<x
#define tc(x)           int x; cin>>x; while(x--)
#define loopf(i,x,y)    for(int i=x;i<=y;i++)
#define loopb(i,x,y)    for(int i=x;i>=y;i--)
#define in(x,n)         int x[n];loopf(i,0,n-1) cin>>x[i];
#define out(x)          for(auto i:x) cout<<i<<" "; cout<<endl;
#define init(x,n,y)     int x[n];loopf(i,0,n-1) x[i]=y;

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

bool isPowerOfTwo(int x){
   return x&&(!(x&(x-1)));
}

int takemod(int x){ 
    return (x%mod + mod) % mod; 
}

int lcm(int x,int y) {
    return (x/gcd(x,y)) * y;
}

int fpow(int base,int power,int MOD) {
    int result = 1;
    base=base%MOD;
    while(power){
        if(power&1) 
            result = (result*base) % MOD;
        base = (base*base) % MOD;
        power = power>>1;
    }
    return result;
}

int modinv(int x){return fpow(x,mod-2,mod);}

void fastIO(){
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
}

void solve(){  
}

int32_t main(){
    
    fastIO();

    //tc(t){
        solve();
    //}
    int n,w; cin>>n>>w;
    init(dp,w+1,0); //Maximum value at weight=i
    loopf(i,0,n-1){
        int wt,cost; cin>>wt>>cost;
        loopb(j,w-wt,0){
            dp[j+wt]=max(dp[j]+cost,dp[j+wt]);
        }
    }
    int ans=0;
    loopf(i,0,w) ans=max(ans,dp[i]);
    cout<<ans; 
    return 0;
}

Measured memory_bytes: 1024
s  = input()
a = int(s[:2])
b = int(s[2:])
is_MMxx = is_xxMM = False
if 13 > a > 0:
  is_MMxx = True
if 13 > b > 0:
  is_xxMM = True
if is_MMxx and is_xxMM:
  print("AMBIGUOUS")
elif is_MMxx:
  print("MMYY")
elif is_xxMM:
  print("YYMM")
else:
  print("NA")

Measured memory_bytes: 3060
#include<stdio.h>

int main()
{
  int A,B,C,X,a,b,c,count,i,j;
  
  scanf("%d",&A);
  scanf("%d",&B);
  scanf("%d",&C);
  scanf("%d",&X);
  
  count=0;
  a=X/500;
  if(a>A)
  {
    a=A;
  }
  
  for(i=0;i<a+1;i++)
  {
    b=(X-500*i)/100;
    if(b>B)
    {
      b=B;
    }
    for(j=0;j<b+1;j++)
    {
      c=(X-500*i-100*j);
      if(c%50==0)
      {
        c=(X-500*i-100*j)/50;
        if(c<=C)
        {
          count++;
        }
        
      }
    }
  }
      
      printf("%d",count);
  
  

  return 0;
}

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

int main() {
    string s;
    cin >> s;
    if (s[0] == s[1] || s[1] == s[2] || s[2] == s[3]) {
        cout << "Bad" << endl;
    }
    else {
        cout << "Good" << endl;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin >> n;
	bool four_flag = false;
	for(int i = 0; i < n; i++){
		char s_i;
		cin >> s_i;
		if(s_i == 'Y') four_flag = true;
	}
	if(four_flag)cout << "Four" << endl;
	else cout << "Three" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp> 
//#include <ext/pb_ds/tree_policy.hpp>
//#include <functional> // for less
//using namespace __gnu_pbds;

#define max_(x, y) (((x) > (y)) ? (x) : (y))
#define min_(x, y) (((x) < (y)) ? (x) : (y))
#define ___ ios_base::sync_with_stdio(false);cin.tie(NULL);
using namespace std;
#define Mx 1000001   
#define inf 1e15
const int MOD = 1e9+7;
const double pi = 2 * acos (0.0);

/*------------------------------Graph Moves----------------------------*/
//const int fx[]={+1,-1,+0,+0};
//const int fy[]={+0,+0,+1,-1};
//const int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};   // Kings Move
//const int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};  // Kings Move
//const int fx[]={-2, -2, -1, -1,  1,  1,  2,  2};  // Knights Move
//const int fy[]={-1,  1, -2,  2, -2,  2, -1,  1}; // Knights Move
/*---------------------------------------------------------------------*/


typedef long long  L;
//typedef tree<L,null_type,less<L>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

L a1,a2,a3,b1,b2,b3,c,c1,c2,c3,d,d1,d2,d3,d4,d5,e1,e2,e3,f,h,k,l,m,n,m1,m2,n1,n2,o,p,p1,p2,p3,p4,q,q1,q2,q3,q4,s,t,
u,x,y,z,sum,mx=-inf,mn=inf,flg,flg1,flg2,id1,id2,id3,id4,lim;

int main()
{
    scanf("%lld%lld%lld",&a1,&a2,&a3);
    if((a1==a2&&a1!=a3)||(a1==a3&&a1!=a2)||(a2==a3&&a1!=a2)){
        printf("Yes\n");
    }else printf("No\n");
    return 0;
}
/// lld I64d push_back() top() pop() insert() upper_bound() lower_bound() memset() max() min() scanf continue


Measured memory_bytes: 256
N = int(input())
B = list(map(int, input().split()))
#flag = True
ans = B[0]
before = B[0]
for k in range(N-1):
  if before > B[k]:
    ans -= before
    ans += B[k]+B[k]
    before = B[k]
  else:
    ans += B[k]
    before = B[k]
print(ans)
#print('Yes')
#print('No')

Measured memory_bytes: 62012
#define _GLIBCXX_DEBUG//TLEの原因になるので注意！！！！！！！！！！！
#include<cmath>
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
vector<int> arr;
stack<int> st;
queue<int> qu;
queue<pair<int,int> > qu2;
priority_queue<int> pq;
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define rep2(i,n) for(int i=1; i<=(int)(n); i++)
#define mins(x,y) x=min(x,y)
#define maxs(x,y) x=max(x,y)
typedef set<int> set_t;
typedef set<string> set_g;
typedef complex<double> xy_t;
static const int NIL = -1;
static const int INF = 1000000007;
#define mp make_pair
#define sz(x) int(x.xise())
#define mod 1000000007
#define reps(i,s,n) for(int i = s; i < n; i++)
deque<int> deq;
//#define int long long

//cerrはコメントアウトしなくても通る//ただしTLEを引き起こすことがある

int dp[100][1005];

int main(){
    int x;
    cin >> x;
    int k=x/100;
    dp[0][0]=1;
    dp[1][0]=1;
    dp[2][0]=1;
    dp[3][0]=1;
    dp[4][0]=1;
    dp[5][0]=1;
    rep2(i,k-1){
        rep(j,100){
            dp[j][i]+=dp[j][i-1];
            if(j-1<0){
                dp[j][i]+=dp[100-(1-j)][i-1];
            }else{
                dp[j][i]+=dp[j-1][i-1];
            }
            if(j-2<0){
                dp[j][i]+=dp[100-(2-j)][i-1];
            }else{
                dp[j][i]+=dp[j-2][i-1];
            }
            if(j-3<0){
                dp[j][i]+=dp[100-(3-j)][i-1];
            }else{
                dp[j][i]+=dp[j-3][i-1];
            }
            if(j-4<0){
                dp[j][i]+=dp[100-(4-j)][i-1];
            }else{
                dp[j][i]+=dp[j-4][i-1];
            }
            if(j-5<0){
                dp[j][i]+=dp[100-(5-j)][i-1];
            }else{
                dp[j][i]+=dp[j-5][i-1];
            }
        }
    }
    int y=x%100;
    if(dp[y][k-1]){
        cout<<1<<endl;
    }else{
        cout<<0<<endl;
    }
    cerr<<dp[y][k-1]<<endl;
    return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int main(){
    string s;
    cin>>s;
    int l=s.size();
    int num;
    if(l%2){num=l/2+1;}
    else{num=l/2;}
    for(int i=0;i<num;i++){
        char x=s[i*2];
        cout<<x;
    }
    cout<<endl;
    return 0;
}

Measured memory_bytes: 512
/*
 © 2020-01-31 19:54:48 crystaalroo all Rights Reserved
*/
#include <bits/stdc++.h>
#define fore(i, a, b) for(int i = (a); i <(b); ++i)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define _ ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0), cout.precision(15);
#define sz(x) (int) (x).size()
#define f first
#define s second
#define pb push_back
using namespace std;

typedef long long lli;
typedef pair<lli,lli > ii;
#define ENDL '\n'
#define deb(x) cout << #x": " << (x) << endl;
const int INF=1e9+5;
const lli mod = 1e9+7;
const int N = 1e6+5;
vector<int>g[N];
vector<int>dp(N,-1);
int dfs(int u){
  //cout<<"a"<<u<<' '<<sz(g[u])<<ENDL;
  if(dp[u]!=-1)return dp[u];
  dp[u]=0;
  for(auto i:g[u]){dp[u]=(dp[u]+dfs(i))%mod;}
  return dp[u];
}
int main(){_
  int n,m;
  cin>>n>>m;
  vector<string>s(n);
  fore(i,0,n)cin>>s[i];
  fore(i,0,n){
    fore(j,0,m){
      if(s[i][j]=='#')continue;
      int v = i * m + j;
      int v1 = i * m + j+1;
      int v2 = (i+1) * m + j;
      if(j+1<m and s[i][j+1]=='.'){g[v].pb(v1);}
      if(i+1<n and s[i+1][j]=='.'){g[v].pb(v2);}
    }
  }
  int cur = (n-1) * m + (m-1);
  dp[cur]=1;
  cout<<dfs(0)<<ENDL;

}


Measured memory_bytes: 60032
/*  -*- coding: utf-8 -*-
 *
 * b.cc: B - fLIP
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>

using namespace std;

/* constant */

const int MAX_N = 1000;
const int MAX_M = 1000;

/* typedef */

/* global variables */

/* subroutines */

/* main */

int main() {
  int n, m, k;
  cin >> n >> m >> k;

  for (int i = 0; i <= n; i++)
    for (int j = 0; j <= m; j++)
      if (i * (m - j) + j * (n - i) == k) {
	puts("Yes");
	return 0;
      }

  puts("No");
  return 0;
}


Measured memory_bytes: 256
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
from operator import mul
from functools import reduce
sys.setrecursionlimit(10 ** 9)



INF = 10 ** 20
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 10 ** 9 + 7


n, q = LI()
G = [[] for _ in range(n)]
for a, b in LIR(n - 1):
    G[a - 1] += [b - 1]
    G[b - 1] += [a - 1]

D = [0] * n
for p, x in LIR(q):
    D[p - 1] += x


que = [0]
visited = [0] * n
visited[0] = 1
while que:
    u = que.pop()
    for v in G[u]:
        if visited[v] == 0:
            visited[v] = 1
            D[v] += D[u]
            que += [v]


print(*D)












Measured memory_bytes: 124620
import sys
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): return [[ini]*i for i2 in range(j)]
def dp3(ini, i, j, k): return [[[ini]*i for i2 in range(j)] for i3 in range(k)]

K, N = mi()

A = li()

m = 0

for i in range(N-1):
    if A[i+1]-A[i] > m:
        m = A[i+1]-A[i]

if A[0]+(K-A[N-1]) > m:
    m = A[0]+(K-A[N-1])

print(K-m)

Measured memory_bytes: 25880
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string S;
    cin >> S >> S;
    cout << "A" << S[0] << "C" << endl;

    return 0;
}


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

using namespace std;

typedef long long ll;
typedef long double ld;

const int N = 305;
ld dp[N][N][2];
int n, t[4];

void table() {
	for (int t3 = 0; t3 <= t[3]; t3++){
		int pr1 = t3 % 2, pr2 = (pr1 + 1) % 2;
		for (int t2 = 0; t2 + t3 <= t[2] + t[3]; t2++)
			for (int t1 = 0; t1 + t2 + t3 <= n; t1++) {
				int t0 = n - (t1 + t2 + t3);
				ld &ans = dp[t1][t2][pr1];
				if (t0 == n)
					ans = 0;
				else {
					ans = 1;
					if (t1)
						ans += dp[t1 - 1][t2][pr1] * ((ld) t1 / n);
					if (t2)
						ans += dp[t1 + 1][t2 - 1][pr1] * ((ld) t2 / n);
					if (t3)
						ans += dp[t1][t2 + 1][pr2] * ((ld) t3 / n);
					ans /= (1 - ((ld) t0 / n));
				}
			}
	}
}

int main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	cin >> n;
	for (int i = 0; i < n; i++) {
		int a;
		cin >> a;
		t[a]++;
	}
	table();
	cout << fixed << setprecision(12) << dp[t[1]][t[2]][t[3] % 2];
	return 0;
}


Measured memory_bytes: 6096
#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define dunk(a) cout << (a) << endl
#define rall(a) (a).rbegin(),(a).rend()
const int INF = 2e9;
using namespace std;
using Graph = vector<vector<int>>;
typedef pair<int,int> P;
typedef long long ll;

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

    if(b <= a) cout << "delicious" << endl;
    else if(b <= a+x) cout << "safe" << endl;
    else cout << "dangerous" << endl;
}



Measured memory_bytes: 256
#include <iostream>
    #include <vector>
    #include <algorithm>
    #include <map>
    #include <functional>
     
    int main() {
      size_t n;
      std::cin >> n;
     
      // std::map<int, int, std::greater<int>> v[2];  // (出現数, 要素)
      // 出現数の降順で並んでほしいです．冷静に考えてこれ map で
      // 持つ必要無くないですか？ vector に突っ込んでいい気がする
      // というかそうしないとだめで，同じ出現数の要素が複数あるときにこわれる．
      // multimap というものがあって云々？
      std::vector<std::pair<int, int>> v[2];
      {
        std::map<int, int> tmp[2];  // (要素, 出現数)
        for (size_t i=0; i<n; i+=2)
          for (size_t j=0; j<2; ++j) {
            int v_i;
            std::cin >> v_i;
            ++tmp[j][v_i];
          }
        for (size_t j=0; j<2; ++j) {
          for (const auto& p: tmp[j])
            v[j].emplace_back(p.second, p.first);
          std::sort(v[j].begin(), v[j].end(), std::greater<>());
        }
      }
     
      // 偶奇で分けたとき，各々のうちで最も多く出現する値とその数（へのイテレータ）
      // *f0 の型は std::pair<int, int> のはず
      auto f0=v[0].begin();
      auto f1=v[1].begin();
     
      if (v[0].size() == 1 && v[1].size() == 1) {
        // 各グループの種類数がどちらも 1 のとき
        if (f0->second == f1->second) {
          // それらが同じなら半分を変える必要があります
          std::cout << n/2 << std::endl;
        } else {
          // 異なっていれば何も変える必要がありません
          std::cout << "0\n";
        }
        return 0;
      }
     
      if (f0->second != f1->second) {
        // 最も多く出現する値が異なっていれば，それら以外を変えます
        std::cout << n-(f0->first+f1->first) << std::endl;
        return 0;
      }
     
      // どちらも同じ場合はどうしますか？
      // 出現数が少ない方は二番目に多く出現する値に変えます
      auto g0=std::next(f0);  // vector になったので，ここは
      auto g1=std::next(f1);  // gi=fi+1 でいいですね
      if (f0->first != f1->first) {
        // 要素数が 1 のとき，std::next(foo.begin()) の要素を取得することは
        // できませんが，今回は問題設定の関係からそうした状況は避けられます．
        // 要素数が 1 だった場合，出現数は n/2 のはずで，相手のグループがそれを
        // 上回ることはできないからです．
        if (f0->first > f1->first) {
          std::cout << n-(f0->first+g1->first) << std::endl;
        } else {
          std::cout << n-(g0->first+f1->first) << std::endl;
        }
        return 0;
      }
     
      // タイの場合はどうしますか？
      // 二番目に多く出現する値の出現数が大きい方のグループは，
      // その値に変えることにし，そうでない方のグループは一番多く出現する
      // 値に変えることにします．それでも同じなら適当に選びます
      std::cout << n-(f0->first+std::max(g0->first, g1->first)) << std::endl;
    }

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

using namespace std;

typedef long long ll;

ll n,anw,nd;
vector<ll> a,b,p;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cin>>n;
	for(int i=0;i<n;i++)
	{
		ll c;cin>>c;
		a.push_back(c);
	}
	for(int i=0;i<n;i++)
	{
		ll c;cin>>c;
		b.push_back(c);
	}
	for(int i=0;i<n;i++)
	{
		if(a[i]>b[i])
			p.push_back(a[i]-b[i]);
		if(a[i]<b[i])
		{
			anw++;
			nd+=abs(b[i]-a[i]);
		}
	}
	sort(p.begin(),p.end(),greater<ll>());
	if(nd==0)
	{
		cout<<0;
		return 0;
	}
	ll sum=0;
	for(int i=0;i<p.size();i++)
	{
		sum+=p[i];
		if(nd<=sum)
		{
			cout<<anw+i+1;
			return 0;
		}
	}
	cout<<-1;	
	return 0;
}

Measured memory_bytes: 2804
// 問題URL
// https://atcoder.jp/contests/abc165/tasks/abc165_b

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        //コード
        Scanner scanner = new Scanner(System.in);
        Long n = scanner.nextLong();

        //System.out.println(n / 100L);
        Long count = 0L;
        Long result = 100L;
        for(;;) {
            result += ((long)Math.floor(result*0.01));
            count++;
            if(result >= n) break;;
        }


        System.out.println(count);
    }
}


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

#define  int  long long
#define  endl  '\n'
const int mod = 1e9 + 7;


int32_t main()
{ 
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
 
  
  int n;
  cin >> n;
  int a[n + 1], b[n + 1], c[n];

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

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

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

  int sum = 0, last = -1;

  for(int i = 1; i <= n; i++)
  {
    int pos = a[i];
    sum += b[pos];
    if(pos == last + 1)
      sum += c[last];
    last = pos;
  }

  cout << sum;
  return 0;
}

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

vector<vector<vector<int>>> uv(100000, vector<vector<int>>(2));
vector<vector<int>> uv_N(100000, vector<int>(2, 0));
vector<int> even_odd(100000, -1);
int N;

void dfs(int n)
{
  int tmp;
  for (int i = 0; i < uv_N[n][0]; i++)
  {
    tmp = uv[n][0][i];
    if (even_odd[tmp] != -1)
      continue;
    even_odd[tmp] = even_odd[n];
    dfs(tmp);
  }
  for (int i = 0; i < uv_N[n][1]; i++)
  {
    tmp = uv[n][1][i];
    if (even_odd[tmp] != -1)
      continue;
    if (even_odd[n] == 1)
      even_odd[tmp] = 0;
    else
      even_odd[tmp] = 1;
    dfs(tmp);
  }
}

int main()
{
  int u, v, w;

  cin >> N;
  for (int i = 0; i < N - 1; i++)
  {
    cin >> u >> v >> w;
    if (w % 2 == 0)
    {
      uv[u - 1][0].push_back(v - 1);
      uv[v - 1][0].push_back(u - 1);
      uv_N[u - 1][0]++;
      uv_N[v - 1][0]++;
    }
    else
    {
      uv[u - 1][1].push_back(v - 1);
      uv[v - 1][1].push_back(u - 1);
      uv_N[u - 1][1]++;
      uv_N[v - 1][1]++;
    }
  }
  for (int i = 0; i < N; i++)
  {
    if (even_odd[i] == -1)
    {
      even_odd[i] = 0;
      dfs(i);
    }
  }
  for (int i = 0; i < N; i++)
    cout << even_odd[i] << '\n';
}

Measured memory_bytes: 21504
import scipy.sparse.csgraph as c,numpy
_,*s=open(0)
s=numpy.array([list(map(int,t[:-1]))for t in s])
m=c.floyd_warshall(s)
i=m[0]%2<1
j=i^True
print((s[i][:,i].any()|s[j][:,j].any())*-1or int(m.max()+1))

Measured memory_bytes: 15004
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <array>
#include <queue>
#include <deque>
#include <set>
#include <unordered_set>
#include <list>
#include <map>
#include <stack>
#include <utility>
#include <bitset>
#include <complex>
#include <algorithm>
#include <numeric>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <climits>
#include <random>
#include <functional>
#include <sstream>
#include <iomanip>

using namespace std;

#define rep(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, m, n) for(int i=(m); i<(n); ++i)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define SORT(x) sort((x).begin(),(x).end())
#define REVE(x) reverse((x).begin(),(x).end())
#define mp make_pair
#define pb push_back
#define Cout(x) cout << (x) << endl
#define Cout2(x, y) cout << (x) << " " << (y) << endl
#define dump(x) cout << #x << " = " << (x) << endl;
#define forauto(i, a) for(auto i : a)cout << i << " "; puts("");

typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
typedef pair<double, double> PDD;
typedef complex<double> CD;

int main() {
	int n; scanf("%d", &n);
	VVI ta(1009, VI(1009));
	int x1, y1, x2, y2;
	rep(i, n) {
		scanf("%d%d%d%d", &x1, &y1, &x2, &y2);
		++ta[y1][x1];
		--ta[y1][x2];
		--ta[y2][x1];
		++ta[y2][x2];
	}
	rep(y, 1001)FOR(x, 1, 1001) {
		ta[y][x] += ta[y][x - 1];
	}
	FOR(y, 1, 1001)rep(x, 1001) {
		ta[y][x] += ta[y - 1][x];
	}
	int ma = 0;
	rep(i, 1001) {
		ma = max(ma, *max_element(all(ta[i])));
	}
	Cout(ma);
}


Measured memory_bytes: 6872