akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		String s = sc.next();
		String t = sc.next();

		for(int i = n; i >= 0; i--){
			if(s.substring(n - i).equals(t.substring(0, i))){
				System.out.println(2*n - i);
				return;
			}
		}
	}
}


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

class program
{
    static void Main()
    {
            var line = Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray();

            long X = line[0]; // 現在地
            var K = line[1]; // 移動回数
            var D = line[2]; // 移動距離

            long ans = X; // K回後の最小の絶対値

            // moveTimesToRoundTrip: 往復移動をするまでに必要な移動回数
            // Xがマイナスでも答えは変わらないため絶対値で計算
            // 切り捨ててもKは整数であるため同じ値になる
            var moveTimesToRoundTrip = Math.Abs(X) / D;

            if (moveTimesToRoundTrip >= K)
            {
                // 往復移動をしない場合
                // 現在地から移動回数*移動距離を足し引きして求める
                if (X >= 0)
                {
                    ans = X - K * D;
                }
                else
                {
                    ans = X + K * D;
                }
            }
            else
            {
                // 往復移動をする場合

                // distanceBeforeRoundTrip: 往復移動する前の距離
                var distanceBeforeRoundTrip = X % D;

                // roundTripTimes: 往復回数
                // 原点近くにたどり着くまでにmoveTimesToRoundTripかかる
                // 残りの回数roundTripTimesは原点をまたいで-D, +Dを繰り返す
                var roundTripTimes = K - moveTimesToRoundTrip;

                if (roundTripTimes % 2 == 0)
                {
                    // 偶数回移動するなら
                    // 往復移動しても往復移動する前の距離が答え
                    ans = distanceBeforeRoundTrip;
                }
                else
                {
                    // 奇数回移動するなら
                    // 往復移動する前の距離が正なら移動距離Dを引いて
                    // 往復移動する前の距離が負なら移動距離Dを足す
                    if (distanceBeforeRoundTrip > 0)
                    {
                        ans = distanceBeforeRoundTrip - D;
                    }
                    else
                    {
                        ans = distanceBeforeRoundTrip + D;
                    }
                }
            }

            Console.WriteLine(Math.Abs(ans));
                
    }
}


Measured memory_bytes: 28228
import sys

input = sys.stdin.readline
sys.setrecursionlimit(1000000)


def getN():
    return int(input())


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


import math
MOD = 10 ** 9 + 7

n, k = getList()
anums = getList()

space = [[] for i in range(2002)]
remain = [1 for j in range(n)]
yet = n

for i, x in enumerate(anums):
    space[x].append(i)


ans = 0
for s in space:
    if s:
        jump = 0
        ls = len(s)
        yet -= ls
        for num in s:
            jump += sum(remain[:num])
            remain[num] = 0
            # print(jump)
        ans += ls * (yet * (k * (k-1))) // 2
        ans += jump * k
        # print(ans, jump, yet)
        # remain[num] = 0

        ans %= MOD
        # yet -= len(s)
        # yet -= 1
print(ans)
# print((43 * (998244353*998244354) // 2) % MOD)

Measured memory_bytes: 41840
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvi vector<vector<int> >
#define vvl vector<vector<ll> >
#define vll vector<ll>
#define rep(c, a, b) for(ll c=a;c<b;c++)
#define re(c, b) for(ll c=0;c<b;c++)
#define all(obj) (obj).begin(), (obj).end()
typedef long long int ll;
typedef long double ld;
using namespace std;

int main(int argc, char const *argv[]) {
  ll a, b, c;std::cin >> a >> b >> c;
  std::cout << (c>=a&&c<=b?"Yes":"No") << '\n';
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define MOD 1000000007
#define rep(i,n) for(i=0;i<(n);i++)
#define loop(i,a,n) for(i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define int ll
typedef vector<int> vi;
typedef pair<int,int> pii;

ll c[51][51];// c[n][k] := nCk



signed main(void) {
  int i,j;
  int n,a,b;
  cin>>n>>a>>b;
  vi v(n);
  rep(i,n)cin>>v[i];
  sort(all(v));
  int ans=0;
  rep(i,a)ans+=v[n-1-i];
  cout<<shosu(10)<<1.0*ans/a<<endl;
  int cnt=0,sum=0;
  rep(i,n)if(v[n-a]==v[i]){
    if(i>=n-a)cnt++;
    sum++;
  }

  rep(i,n+1)rep(j,i+1)
    if(j==0 || j==i) c[i][j]=1;
    else c[i][j]=c[i-1][j-1]+c[i-1][j];

  ans=0;
  if(cnt!=sum && v[n-1]==v[n-a]){//all
    loop(i,a,b+1) ans+=c[sum][i];
  }else{
    ans=c[sum][cnt];
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 256
n = int(input())
L = [int(i) for i in input().split()]
L.sort()

def out_detect(n,L):
  flag = 0
  if n%2 == 0:
    for i in range(n):
      if L[i] != -(-(i+1)//2)*2-1:
        flag = 1
        break
  else:
    if L[0] != 0:
      flag = 1
      return (flag)
    for i in range(1,n):
      if L[i] != (-(-i//2)*2):
        flag = 1
        break
  return (flag)

if out_detect(n,L) == 1:
  print(0)
else:
  if n%2 == 0:
    out = pow(2,n//2)
  else:
    out = pow(2,(n-1)//2)
  print(out%(pow(10,9)+7))

Measured memory_bytes: 13880
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0;i<n;i++)
#define rep1(i,n) for(int i = 1;i<n;i++)
typedef long long ll;
#define vint vector<int>
#define vstring vector<string>
#define vll vector<ll>
#define vbool vector<bool>
#define INF 100000000

const int limit = 50;
vint a[limit],b[limit];
bool graph[limit][limit];
bool visited[limit];

int main(){
  int n,m;
  cin >> n >> m;
  int ans = 1900*m + 100*(n-m);
  cout << ans*pow(2,m) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
long long const MOD = 1000000007;
long long dp[2010][2010] = {};

int main() {
    int N, M; cin >> N >> M;
    vector<int> S(N), T(M);
    for(int i=0; i<N; ++i) cin >> S[i];
    for(int j=0; j<M; ++j) cin >> T[j];

    for(int j=0; j<=M; ++j) dp[0][j] = 1;
    for(int i=0; i<=N; ++i) dp[i][0] = 1;

    for(int i=0; i<N; ++i) {
        for(int j=0; j<M; ++j) {
            dp[i + 1][j + 1] = dp[i + 1][j] + dp[i][j + 1] - dp[i][j];
            if(S[i] == T[j]) dp[i + 1][j + 1] += dp[i][j];
            dp[i + 1][j + 1] %= MOD;
            dp[i + 1][j + 1] = (dp[i + 1][j + 1] + MOD) % MOD;
        }
    }
    cout << dp[N][M] << endl;
}

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

typedef long long ll;

int main() {
    ll N, K;
    cin >> N >> K;
    vector<ll>A(N);
    for (int i = 0; i < N; i++) {
        cin >> A[i];
    }
    for (int k = 0; k < K; k++) {
        vector<ll>s(N+1, 0);
        for (int i = 0; i < N; i++) {
            ll x = A[i];
            ll l = (i-A[i] <= 0 ? 0 : i-A[i]);
            ll r = (i+A[i] >= N-1 ? N-1 : i+A[i]);
            s[l]++;
            s[r+1]--;
        }
        bool check = true;
        for (int i = 0; i < N; i++) {
            s[i+1] += s[i];
            A[i] = s[i];
            if (A[i] != N) {
                check = false;
            }
        }
        if (check) {
            break;
        }
    }
    for (int i = 0; i < N; i++) {
        cout << A[i];
        if (i != N-1) {
            cout << " ";
        }
    }
    cout << endl;
}


Measured memory_bytes: 6424
from collections import Counter
N = int(input())
scounter = Counter([input() for _ in range(N)])
M = int(input())
tcounter = Counter([input() for _ in range(M)])

nums = []
for s in scounter.keys():
    nums.append(scounter[s] - tcounter[s])

max_num = max(nums)
print(max_num if max_num > 0 else 0)


Measured memory_bytes: 3564
import sys, math

def input():
    return sys.stdin.readline()[:-1]

def main():
    N, K = map(int,input().split())
    D = set(list(input().split()))
    for k in range(N,100001):
        s = str(k)
        f = 0
        for e in s:
            if e in D:
                f = 1
                break
        if f == 0:
            print(s)
            exit(0)

if __name__ == '__main__':
    main()


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

int main() {
	vector<P> vec(9);
	rep (i, 9)
		cin >> vec.at(i).first; 
	int N;
	cin >> N;
	rep (i, N)
	{
		int a;
		cin >> a;
		rep (i, 9)
		{
			if (vec.at(i).first == a)
				vec.at(i).second = 1;
		}
	}
	if (vec.at(0).second == 1 && vec.at(1).second == 1 && vec.at(2).second == 1)
		cout << "Yes" << endl;
	else if (vec.at(3).second == 1 && vec.at(4).second == 1 && vec.at(5).second == 1)
		cout << "Yes" << endl;
	else if (vec.at(6).second == 1 && vec.at(7).second == 1 && vec.at(8).second == 1)
		cout << "Yes" << endl;
	else if (vec.at(0).second == 1 && vec.at(3).second == 1 && vec.at(6).second == 1)
		cout << "Yes" << endl;
	else if (vec.at(1).second == 1 && vec.at(4).second == 1 && vec.at(7).second == 1)
		cout << "Yes" << endl;
	else if (vec.at(2).second == 1 && vec.at(5).second == 1 && vec.at(8).second == 1)
		cout << "Yes" << endl;
	else if (vec.at(0).second == 1 && vec.at(4).second == 1 && vec.at(8).second == 1)
		cout << "Yes" << endl;
	else if (vec.at(2).second == 1 && vec.at(4).second == 1 && vec.at(6).second == 1)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}


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

int main()
{
    ll x,y,i,j;
    cin>>x>>y;
    if(x%y==0)
        cout<<"-1";
    else
    {
        for(i=1;i*x<=ll(1e18);i++)
        {
            if(i%y!=0)
            {
                cout<<x*i;
                return 0;
            }
        }
        cout<<"-1";
    }
    return 0;
}


Measured memory_bytes: 256
import Data.Array

main :: IO ()
main = do
  cs <- listArray ((1,1),(3,3)) . map read . words <$> getContents
  putStrLn $ if solve cs then "Yes" else "No"

solve :: Array (Int, Int) Int -> Bool
solve cs
  | cs ! (2,2) /= a2 + b2 = False
  | cs ! (2,3) /= a2 + b3 = False
  | cs ! (3,2) /= a3 + b2 = False
  | cs ! (3,3) /= a3 + b3 = False
  | otherwise             = True
 where
  a1 = 0
  b1 = cs ! (1,1)
  b2 = cs ! (1,2)
  b3 = cs ! (1,3)
  a2 = cs ! (2,1) - b1
  a3 = cs ! (3,1) - b1

Measured memory_bytes: 508
def solve():
    N = int(input())
    A = list(map(int,input().split()))
    neg = []
    pos = []
    for a in A:
        if a < 0:
            neg.append(a)
        else:
            pos.append(a)
    
    neg.sort()
    pos.sort()
    
    op = []
    if len(neg) == N:
        pos.append(neg[-1])
        neg.pop()
    
    if len(pos) == N:
        neg.append(pos[0])
        pos = pos[1:]
    
    for i in range(len(pos)-1):
        op.append("{0} {1}".format(neg[0], pos[i]))
        neg[0] -= pos[i]
    
    for ne in neg:
        op.append("{0} {1}".format(pos[-1], ne))
        pos[-1] -= ne
    
    printAns(pos[-1], op)

def printAns(M, op):
    print(M)
    print(*op, sep='\n')
    
if __name__ == '__main__':
    solve()

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

int main()
{
    long long n,k;
    cin>>n>>k;
    
    long long h[n],i;
    
    for(i=0;i<n;i++){
        cin>>h[i];
    }
    
    sort(h,h+n);
    long long sum = 0;
    
    for(i=0;i<n-k;i++){
        sum = sum + h[i];
    }
    
    cout<<sum<<endl;
    
    return 0;
}


Measured memory_bytes: 1792
using System;


namespace abc055_a
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = Convert.ToInt32(Console.ReadLine());
            int x = 0;
            int y = 0;
            for(int i = 1; i <= N; i++)
            {
                x = x + 800;
                if (i % 15 == 0)
                {
                    y = y + 200;
                }
            }
            Console.WriteLine(x - y);
            Console.ReadLine();
        }
    }
}


Measured memory_bytes: 11220
#include <iostream>
using namespace std;
int main(int argc, char *argv[]) {
	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 n; cin>>n;
	cout<<a[n-1]<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <string.h>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <time.h>
#define _USE_MATH_DEFINES
#define LL long long
#define UN unsigned
using namespace std;
const double PI = acos(-1.0);

int max_num(int ary[], int length) {
	int max = ary[0];
	for (int i = 1; i < length; i++)
		if (max < ary[i]) max = ary[i];
	return max;
}

int max_ord(int ary[], int length) {
	int max;
	max = max_num(ary, length);
	for (int i = 0; i < length; i++) {
		if (ary[i] == max) return i;
	}
	return -1;
}

int min_num(int ary[], int length) {
	int min = ary[0];
	for (int i = 1; i < length; i++)
		if (min > ary[i]) min = ary[i];
	return min;
}

int min_ord(int ary[], int length) {
	int min;
	min = min_num(ary, length);
	for (int i = 0; i < length; i++) {
		if (ary[i] == min) return i;
	}
	return -1;
}

int mp[10000][10000];

int main() {
	int h, w, n, a[10000], big = 1, small = 1;
	cin >> h >> w >> n;
	for (int i = 0; i < n; i++) cin >> a[i];

	for (int i = 0; i < h; i++) {
		if (i % 2 == 0)
			for (int j = 0; j < w; j++, small++) {
				mp[i][j] = big;
				if (small == a[big - 1]) {
					big++;
					small = 0;
				}
			}
		else
			for (int j = w - 1; j >= 0; j--, small++) {
				mp[i][j] = big;
				if (small == a[big - 1]) {
					big++;
					small = 0;
				}
			}
	}

	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			cout << mp[i][j];
			cout << "  ";
		}
		cout << endl;
	}

	return 0;
	return 0;
}


Measured memory_bytes: 2560
// inputに入力データ全体が入る
function Main(input) {
	// 1行目がinput[0], 2行目がinput[1], …に入る 
        //console.log("***input = " + input);
        //console.log("type = " + typeof(input));
        //console.log("size=" + input.length);
	input = input.split("\n");
        //console.log("***input.split = " + input);
        //console.log("type = " + typeof(input));
        //console.log("size=" + input.length);
	//文字列から10進数に変換するときはparseIntを使います
	var a = parseInt(input[0], 10);
	var b = parseInt(input[1], 10);
        var score = 1;
	//出力
	for(var i = 0; i < a; i++) {
		if( score < b ){
			//console.log("*2");
			score = score * 2;
		}else{
			//console.log("+b");
			score = score + b;
		}
	}
	console.log('%d',score);
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
#include <iostream>
#include <cstdio>
#include <cmath>
#include <string>
#include <algorithm>
using namespace std;
#define mp  std::make_pair
#define ll long long int
#define abs(n) ((n>0)?(n):((n)*(-1)))
#define CEIL(a,b) (((a) + ((b)-1)) / (b))
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n) FOR(i,0,(n)-1)
#define VREP(v) for(std::vector<ll>::iterator itr = (v).begin(); itr != (v).end();itr++)
#define VALL(v) ((v).begin(),(v).end())
#define errln(v) cerr << (v) << endl;
#define println(v) cout << (v) << endl;


int main(int argc, const char * argv[]) {
	string s;
	cin >> s;
	int K;
	cin >> K;
	string subs[K];
	REP(i,K){
		subs[i]="zzzzz";
	}
	for (int i = 0; i < s.size(); ++i) {
		for(int j = 1; j <= K && j + i -1  < s.size();++j){
			string curr = s.substr(i,j);
			REP(k,K){
				if(subs[k] == curr) break;
				if(curr < subs[k]){
					for(int h = K-1; h > k ; h--){
						subs[h] = subs[h-1];
					}
					subs[k] = curr;
					REP(h,K){
//						errln(subs[h]);
					}
//						errln("-------------");
					break;
				}
			}
		}
	}
	println(subs[K-1]);
	return 0;
}


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

int main(){
    long N, A, B;
    cin >> N >> A >> B;//nが個数、aが最小、bが最大

    if(A > B){
        cout << 0 << endl;
        return 0;
    }
    
    if(N == 1){
        if(A < B){
            cout << 0 << endl;
            return 0;
        }
        if(A == B){
            cout << 1 << endl;
            return 0;
        }
    }
    if(N == 2){
        long ansn2 = A + B;
        cout << ansn2 << endl;
        return 0;
    }

    if(N >= 3){
        long ansn3 = (A + (N-1) * B) - ((N-1) * A + B) + 1;
        cout << ansn3 << endl;
        return 0;
    }
}

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

int main(){
    int A,B;
    cin >> A >> B;
    if(A==1)
    A+=13;
    if(B==1)
    B+=13;
    if(A<B)
    cout << "Bob" << endl;
    else if(A>B)
    cout << "Alice" << endl;
    else
    cout << "Draw" << endl;
}

Measured memory_bytes: 256
import java.util.*;
class Main
{
  public static void main(String[] args)
  {
    Scanner sc = new Scanner(System.in);
    
    int a = sc.nextInt();
    int b = sc.nextInt();
    
    if(a<b*2){
      System.out.println(0);
      return;
    }else{
      System.out.println(a-b*2);
    }
  }
}

Measured memory_bytes: 21844
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int N;
vector<string> strings;
void dfs(string s,char mx){
    if(s.length()==N){
        printf("%s\n",s.c_str());
    }else{
        for(char c='a'; c<=mx; c++){
            if(c==mx){
                dfs(s+c,(char)(mx+1));
            }else{
                dfs(s+c,mx);
            }

        }
    }

}

void solve(){
    
    
    cin >> N;
    dfs("",'a');
    
}

int main(){
    solve();
}

Measured memory_bytes: 1536
#include <iostream>
#include <memory>

int main() {

	int N;
	std::cin >> N;
	std::unique_ptr<int[]> A(std::make_unique<int[]>(N));
	int max_num_ones = 0;
	int num_ones = 0;
	for (int i = 0; i < N; i++) {
		std::cin >> A[i];
		if (A[i] == 1) { num_ones += 1; }
		if (A[i-1] == 1 && (A[i] == 0 || i == N-1)) 
		{ 
			max_num_ones = (max_num_ones < num_ones) ? num_ones : max_num_ones;
			num_ones = 0; 
		}
	}

	std::cout << max_num_ones + 1 << std::endl;
	return 0;
}


Measured memory_bytes: 3104
/*
  AUTHOR:SOURABH
  CREATED:30:05:20
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define ordered_set tree<pii , null_type, less< pii >, rb_tree_tag, tree_order_statistics_node_update>
#define ll long long int
#define ld long double
#define fi first
#define se second
#define pb push_back
#define pob pop_back
#define W while
#define fn(i,x) for(i=0;i<x;i++)
#define fs(i,s,x) for(i=s;i<x;i++)
#define fr(i,x) for(i=x;i>=0;i--)
#define fit(it,s) for(it=s.begin();it!=s.end();it++)
#define mp make_pair
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vii vector<int>
#define vll vector<ll>
#define mii map<int,int>
#define mll map<ll,ll>
#define mod 998244353
#define MAX 100005
#define M 32

using namespace std;
using namespace __gnu_pbds;

const ll INF=1e18;

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

    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);

    ll t,n,i,p,ans;
    t=1;
    //cin>>t;
    W(t--)
    {
        cin>>n;
        vll a(n+1),b(n+1),post(n+1);
        ans=0;
        fn(i,n+1)
        {cin>>a[i];ans+=a[i];}
        post[n]=a[n];
        fr(i,n-1)
        post[i]=post[i+1]+a[i];
        b[0]=min(1-a[0],post[1]);
        if(b[i]<0)
        {cout<<-1;return 0;}
        ans+=b[0];
        fs(i,1,n)
        {
            b[i]=min(b[i-1]*2-a[i],post[i+1]);
            if(b[i]<0)
                {cout<<-1;return 0;}
            ans+=b[i];
        }
        b[i]=b[i-1]*2-a[i];
        if(b[i]<0)
        {cout<<-1;return 0;}
        cout<<ans;
    }
    return 0;
}



Measured memory_bytes: 5468
#include <bits/stdc++.h>
#define range(i, l, r) for(long long int (i) = (l); (i) < (r); (i)++)
#define reversed_range(i, l, r) for (long long int (i) = (r) - 1; (i) >= l; (i)--)
using namespace std;
template <typename T>
using vec = vector<T>;
using lint = long long;
using ulint = unsigned long long;
using pint = pair<int, int>;
using plint = pair<lint, lint>;

template <typename S, typename T>
ostream& operator <<(ostream& os, pair<S, T> p) {
    os << "(";
    os << p.first << ", " << p.second;
    return os << ")";
}

template <typename T>
ostream& operator <<(ostream& os, vec<T> v) {
    os << "[";
    if (v.size() == 0) return os << "]";
    for (int i = 0; i < v.size() - 1; i++) {
        os << v.at(i) << ", ";
    }
    return os << v.at(v.size() - 1) << "]";
}

template <typename T>
ostream& operator <<(ostream& os, set<T>& s) {
    os << "{";
    if (s.begin() == s.end()) return os << "}";
    auto it_first_item = s.begin();
    os << *it_first_item;
    for (auto it = ++it_first_item; it != s.end(); it++) {
        os << ", " << *it;
    }
    return os << "}";
}

template <typename T>
ostream& operator <<(ostream& os, unordered_set<T>& s) {
    os << "{";
    if (s.begin() == s.end()) return os << "}";
    auto it_first_item = s.begin();
    os << *it_first_item;
    for (auto it = ++it_first_item; it != s.end(); it++) {
        os << ", " << *it;
    }
    return os << "}";
}

template <typename K, typename V>
ostream& operator <<(ostream& os, map<K, V> m) {
    os << "{";
    if (m.begin() == m.end()) return os << "}";
    auto it_first_item = m.begin();
    os << it_first_item->first << ": " << it_first_item->second;
    for (auto it = ++it_first_item; it != m.end(); it++) {
        os << ", " << it->first << ": " << it->second;
    }
    return os << "}";
}

template <typename K, typename V>
ostream& operator <<(ostream& os, unordered_map<K, V> m) {
    os << "{";
    if (m.begin() == m.end()) return os << "}";
    auto it_first_item = m.begin();
    os << it_first_item->first << ": " << it_first_item->second;
    for (auto it = ++it_first_item; it != m.end(); it++) {
        os << ", " << it->first << ": " << it->second;
    }
    return os << "}";
}

lint pow(lint num, lint e, lint MOD) {
    lint res = 1;
    lint cur_num = num;
    while (e) {
        if (e & 1) {
            res *= cur_num;
            res %= MOD;
        }
        cur_num *= cur_num;
        cur_num %= MOD;
        e >>= 1;
    }
    return res;
}

int main() {
    cin.tie(0); cout.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    lint N, M; cin >> N >> M;
    lint sum = 0;
    range(i, 0, M) {
        lint days_taken; cin >> days_taken;
        sum += days_taken;
    }
    lint ans;
    if (N - sum >= 0) ans = N - sum;
    else ans = -1;
    cout << ans << "\n";
}

Measured memory_bytes: 3632
N, L=list(map(int,input().split()))
s=[]
ans=''
for i in range(N):
    s.append(input())
for i in range(N-1):
    for j in range(N-i-1):
        s1=s[i]
        s2=s[i+j+1] 
        k=0
        while k < L-1 and ord(s1[k])==ord(s2[k]): 
            k+=1
        if ord(s1[k]) > ord(s2[k]):
            s[i]=s2
            s[i+j+1]=s1
    ans+=s[i]
ans+=s[N-1]
print(ans)

Measured memory_bytes: 3064
#include "bits/stdc++.h"
#define rep(i, N) for(int (i) = 0; (i) < (N); (i)++)
#define debug(var) std::cout << #var << " : " << var << std::endl;
using ll = long long;
using ull = unsigned long long;
using vint = std::vector<int>;
using vvint = std::vector<std::vector<int>>;
using namespace std;
ll mod = 1e9 + 7;

/*int <= 10^9*/


int main() {


	ll N; cin >> N;
	if (N % 2 == 0)cout << N;
	else cout << N * 2;


	return 0;
}

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

#define rep(i, n) REP(i, 0, n)
#define REP(i,k,n) for(int i = k; i < n; i++)
#define mmax(start, end) *max_element(start, end)
#define mmin(start, end) *min_element(start, end)
#define argmax max_element
#define argmin min_element
#define ALL(x) (x).begin(), (x).end()

typedef long long ll;
typedef pair<int, int> prii;

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

template<class T = ll> T in() {
    T _in;
    cin >> _in;
    return _in;
}

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

    int N, t[100010], x[100010], y[100010];
    cin >> N;
    t[0] = x[0] = y[0] = 0;
    rep(n, N) {
        cin >> t[n+1] >> x[n+1] >> y[n+1];
    }

    string ans = "Yes";
    REP(i, 1, N+1) {
        int prev_t = t[i-1];
        int prev_x = x[i-1];
        int prev_y = y[i-1];

        int d = abs(prev_x - x[i] + prev_y - y[i]);
        int tim = t[i] - prev_t;
        if(d > tim) {
            ans = "No";
            break;
        } else if(d == tim) {
            continue;
        } else { // d < tim
            if(d%2 == tim%2) {
                continue;
            } else {
                ans = "No";
                break;
            }
        }
    }

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


Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,a,b) for(int i=(a); i<(b); i++)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
typedef long long ll;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
int main(){
    ll a,b; cin >> a >> b;
    ll ans = (a*b)/gcd(a,b);
    cout << ans << endl;
}

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

using namespace std;

int main() {
  int N, K, Q;
  cin >> N >> K >> Q;
  vector<int> points(N, K);
  vector<int> wins(N, 0);
  for (int i = 0; i < Q; i++) {
    int A;
    cin >> A;
    wins[A - 1]++;
  }

  for (int i = 0; i < N; i++) {
    int lose = Q - wins[i];
    if (points[i] - lose <= 0) {
      cout << "No\n";
    } else {
      cout << "Yes\n";
    }
  }

  return 0;
}


Measured memory_bytes: 1408
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);++i)
#define ALL(v) (v).begin(),(v).end()
#define INF 1e9
typedef long long llong;
using namespace std;

int main(){
	int n;
	cin>>n;
	
	vector<int> b(n);
	REP(i,n) cin>>b[i];
	
	vector<int> a;
	for(int i=n-1;i>=0;--i){
		bool jud=false;
		for(int j=i;j>=0;--j){
			if(j+1==b[j]){
				a.push_back(b[j]);
				b.erase(b.begin()+j);
				jud=true;
				break;//for(j).
			}
		}
		if(!jud){
			cout<<-1<<endl;
			return 0;
		}
	}
	
	
	for(int i=n-1;i>=0;--i){
		cout<<a[i]<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
N, K = gets.split.map(&:to_i)
xs = gets.split.map(&:to_i)
ans = 1 << 60
(N - K + 1).times do |i|
  l = xs[i]
  r = xs[i + K - 1]
  n = if l < 0 && r < 0
    l.abs
  elsif l < 0 && r >= 0
    [l.abs, r].min * 2 + [l.abs, r].max
  else
    r
  end
  ans = n if n < ans
end
puts ans


Measured memory_bytes: 11012
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdlib>
using namespace std;

//repetition
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//infinity
#define INTINF 2000000000
#define LONGINF 2000000000

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

int main(){
	string s;
	string t;
	cin >> s >> t;

	REP(i, s.size()){
		string tt = s.substr(i) + s.substr(0, i); 
		if(tt == t){
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
	return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
int main() {
	int N; cin >> N;
	while (N--) {
		int score = 0;
		int out = 0;
		int run = 0;
		while (out <= 2) {
			string st; cin >> st;
			if (st == "OUT")out++;
			else if (st == "HIT") {
				run++;
				if (run > 3) {
					run = 3;
					score++;
				}
			}
			else {
				score += 1 + run;
				run = 0;
			}
		}
		cout << score << endl;
	}
	return 0;
}

Measured memory_bytes: 3020
import java.util.*;
import java.io.*;
//atcoder
public class Main {
    public static void main(String[] args) {
        FastScanner scanner = new FastScanner();
        PrintWriter out = new PrintWriter(System.out);
        char[] line = scanner.next().toCharArray();
        int b= 0;
        long ans = 0;
        for(int i = 0; i < line.length; i++) {
            if (line[i] == 'B') b++;
            else ans += b;
        }
        out.println(ans);
        out.flush();
    }
    
    public static class FastScanner {
        BufferedReader br;
        StringTokenizer st;
        
        public FastScanner(Reader in) {
            br = new BufferedReader(in);
        }
        
        public FastScanner() {
            this(new InputStreamReader(System.in));
        }
        
        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
        
        int nextInt() {
            return Integer.parseInt(next());
        }
        
        long nextLong() {
            return Long.parseLong(next());
        }
        
        double nextDouble() {
            return Double.parseDouble(next());
        }
        
        String readNextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
}


Measured memory_bytes: 26964
import sys
input=sys.stdin.readline
S = input()[:-1]
n = len(S)
def kaibun(S):
    if S == S[::-1]:
        return 1
    else:
        return 0
if kaibun(S) == 0:
    print("No")
else:
    s1 = S[0:n // 2]
    if kaibun(s1) == 1:
        print("Yes")
    else:
        print("No")


Measured memory_bytes: 3060
import java.util.*;
public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B;
        if(A%1000 == 0){
            B = (A/1000);

        }else{
            B = (A/1000)+1;
        }
        int anc = (B*1000)-A; 
        System.out.println(anc);
    }
}


Measured memory_bytes: 35664
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = 1001001001;
const ll LINF = 1LL << 60;
const int MOD = 1'000'000'007;

template <typename T>
void print(const T &v)
{
    for (int i = 0; i < v.size(); i++)
    {
        if (i)
            cout << ' ';
        cout << v[i];
    }
    cout << endl;
}

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

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

const int MAX = 100010;
ll dp[MAX][3];

int main()
{
    int n;
    cin >> n;
    vector<int> a(n), b(n), c(n);
    for (int i = 0; i < n; i++)
    {
        cin >> a[i] >> b[i] >> c[i];
    }
    for (int d = 0; d < n; d++)
    {
        dp[d + 1][0] = max(dp[d][1], dp[d][2]) + a[d];
        dp[d + 1][1] = max(dp[d][2], dp[d][0]) + b[d];
        dp[d + 1][2] = max(dp[d][0], dp[d][1]) + c[d];
    }
    cout << max(dp[n][0], max(dp[n][1], dp[n][2])) << endl;
    return 0;
}

Measured memory_bytes: 6584
k=int(input())
import numpy as np
data="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"

output2 = np.array(data.split(","), dtype = np.int).tolist()

print(output2[k-1])


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

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

	int n;
	cin >> n;
	vector<int> t(n), a(n);

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

	long long int ts = t[0];
	long long int as = a[0];

	long long int ratio;
	for (int i = 1; i < n; i++) {
		if (t[i] >= ts && a[i] >= as) {
			ts = t[i];
			as = a[i];
		}
		else {
			ratio = max((ts % t[i] == 0) ? ts / t[i] : ts / t[i] + 1,
				(as % a[i] == 0) ? as / a[i] : as / a[i] + 1);
			ts = t[i] * ratio;
			as = a[i] * ratio;
		}
	}

	cout << ts + as << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main()
{
  int A, B, C;
  cin >> A;
  cin >> B;
  cin >> C;
  if (C+B-A<0) cout << 0 << endl;
  else cout << C+B-A << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

void swap(int *a, int *b);

int main(){
  int n, list[100], i, j, count = 0, temp;

  scanf("%d", &n);

  for(i = 0; i < n; i++) scanf("%d", &list[i]);

  for(i = 0; i < n-1; i++)
    for(j = n-1; j > i; j--)
      if(list[j] < list[j-1]){
	swap(&list[j], &list[j-1]);
	count++;
      }

  for(i = 0; i < n-1; i++) printf("%d ", list[i]);
  printf("%d\n%d\n", list[i], count);
  
  return 0;
}

void swap(int *a, int *b){
  int temp;
  temp = *a;
  *a = *b;
  *b = temp;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
 
using namespace std;
 
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl;
#define DEBUG_MAT(v) cerr<<#v<<endl;for(int i=0;i<v.size();i++){for(int j=0;j<v[i].size();j++) {cerr<<v[i][j]<<" ";}cerr<<endl;}
typedef long long ll;
#define int ll
 
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
template<class S, class T> pair<S, T> operator+(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first + t.first, s.second + t.second); }
template<class S, class T> pair<S, T> operator-(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first - t.first, s.second - t.second); }
template<class S, class T> ostream& operator<<(ostream& os, pair<S, T> p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
#define X first
#define Y second
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define rrep1(i,n) for(int i=(int)(n);i>0;i--)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define in(x, a, b) (a <= x && x < b)
#define all(c) c.begin(),c.end()
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a = b; return 1; } return 0; }
#define UNIQUE(v) v.erase(std::unique(v.begin(), v.end()), v.end());
const ll inf = 1000000001;
const ll INF = (ll)1e18 + 1;
const long double pi = 3.1415926535897932384626433832795028841971L;
#define Sp(p) cout<<setprecision(25)<< fixed<<p<<endl;
// int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
// int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };
vi dx = {1, 0, -1, 0}, dy = {0, 1, 0, -1};
vi dx2 = { 1,1,0,-1,-1,-1,0,1 }, dy2 = { 0,1,1,1,0,-1,-1,-1 };
#define fio() cin.tie(0); ios::sync_with_stdio(false);
const ll MOD = 1000000007;
// const ll MOD = 998244353;
// #define mp make_pair
//#define endl '\n'


signed main() {
	fio();
	char c;
	cin >> c;
	if (in(c, 'a', 'z' + 1)) cout << 'a' << endl;
	else cout << 'A' << endl;
}

Measured memory_bytes: 3656
N, A, B = map(int, input().split())
total = 0


def ketawa(n):
    sum = 0
    while n >= 1:
        sum += n % 10
        n //= 10
    return sum


for i in range(1, N + 1):
    sum = ketawa(i)
    if A <= sum <= B:
        total += i

print(total)

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

using namespace std;

#define INF 1000000000
#define pb(a) push_back(a)
#define vi vector<int>
#define vvi vector<vi>
#define P pair<int,int>
#define all(vec) (vec.begin()),(vec.end())
#define ll long long;
#define sz(x) ((int)(x).size())
#define in(x) int x;cin>>x;
#define bit(n) (1<<(n))

#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define REP3(i, m, n) for(int i = m, i##_len=(n);i < i##_len;i++)
#define FORVEC(i, v) for(int i = 0;i < sz(v);i++)


int main(){
	long long x,y;
	int ans=0;
	cin>>x>>y;
	while(x<=y){
		ans++;
		x=x<<1;
	}
	cout<<ans<<"\n";
	return 0;
}


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

using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
#define all(x) x.begin(), x.end()

template <typename T1, typename T2> inline void chkmin(T1 &x, const T2 & y) {if (x > y) x = y;}
template <typename T1, typename T2> inline void chkmax(T1 &x, const T2 & y) {if (x < y) x = y;}

const int MOD = 1e9 + 7;

int add(int a, int b) {
	a += b;
	if (a >= MOD)
		a -= MOD;
	return a;
}

int sub(int a, int b) {
	a -= b;
	if (a < 0)
		a += MOD;
	return a;
}

int mul(int a, int b) {
	return (ll) a * b % MOD;
}

int binpow(int a, int n) {
	if (n == 0) return 1;
	if (n & 1) {
		return mul(a, binpow(a, n - 1));
	} else {
		return binpow(mul(a, a), n / 2);
	}
}

int inv(int a) {
	return binpow(a, MOD - 2);
}

const int MAXN = 2e5 + 10;
int fact[MAXN], rfact[MAXN];

void build() {
	fact[0] = rfact[0] = 1;
	for (int i = 1; i < MAXN; i++) {
		fact[i] = mul(fact[i - 1], i);
		rfact[i] = inv(fact[i]);
	}
}

int c_n_k(int n, int k) {
	return mul(fact[n], mul(rfact[n - k], rfact[k]));
}

int n;
vector<int> g[MAXN];

void read() {
	cin >> n;
	for (int i = 0; i < n - 1; i++) {
		int u, v;
		cin >> u >> v;
		u--;
		v--;
		g[u].push_back(v);
		g[v].push_back(u);
	}	
}

int merge(int a, int sz_a, int b, int sz_b) {
	int ans = mul(a, b);
	ans = mul(ans, c_n_k(sz_a + sz_b, sz_a));
	return ans;
}

int dp[MAXN];
int sz[MAXN];
void dfs_down(int v, int p) {
	sz[v] = 1;
	for (auto i : g[v]) {
		if (i == p) continue;
		dfs_down(i, v);
		sz[v] += sz[i];
	}

	int sz_now = 0;
	dp[v] = 1;
	for (auto i : g[v]) {
		if (i == p) continue;
		dp[v] = merge(dp[v], sz_now, dp[i], sz[i]);
		sz_now += sz[i];
	}
}

int ans[MAXN];

void dfs_up(int v, int p) {
	if (p != -1) {
		int val_p = dp[p];
		int sz_p = n - sz[v] - 1;
		val_p = mul(val_p, inv(dp[v]));
		val_p = mul(val_p, inv(c_n_k(n - 1, sz[v])));
		dp[v] = merge(dp[v], sz_p + 1, val_p, sz[v] - 1);
	}

	for (auto i : g[v]) {
		if (i != p) {
			dfs_up(i, v);
		}
	}
}

void run() {
	build();
	dfs_down(0, 0);
	dfs_up(0, -1);
}

void write() {
	for (int i = 0; i < n; i++) {
		cout << dp[i] << "\n";
	}
}

signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	read();
	run();
	write();
	return 0;
}

Measured memory_bytes: 17140
#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef long long ll;
typedef long double ld;
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define mod 1000000007
#define inf 1000000000000000000
#define bpc(x) __builtin_popcountll(x)
#define autoit(x,it) for(auto it = x.begin(); it != x.end(); it++)
#define rep(n) for(ll i = 0; i < n; i++)
#define repi(i,n) for(ll i = 0; i < n; i++)

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 

#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 

using namespace std;

int main()
{
  FAST/**/
   
   ll n;
   cin>>n;
   
   ll arr[n];
   rep(n)
        cin>>arr[i];
   
   ll ans = 0;
   rep(n)
   {
       if(i%2 == 0 && arr[i]%2 == 1)
            ans++;
   }
   
   cout<<ans;
   
   return 0;        
}  
  
          
   

Measured memory_bytes: 3612
N = int(input())
s = [int(input()) for _ in range(N)]
ans = sum(s)
op = float('inf')
for s_i in s:
    if s_i % 10 != 0 and op > s_i:
        op = s_i
if ans % 10 == 0:
    ans -= op
if op == float('inf'):
    ans = 0
print(ans)

Measured memory_bytes: 3060
N = gets.to_i
ans = 0.0
points = []
N.times do
  points << gets.split(' ').map(&:to_f)
end
(0...N).each do |i|
  p1 = points[i]
  (0...N).each do |j|
    next if i == j
    p2 = points[j]
    ans += (((p1[0] - p2[0])**2) + ((p1[1] - p2[1])**2))**0.5
  end
end
puts ans/N.to_f

Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(a) (a).begin(), (a).end()
using ll = long long;
using P = pair<int, int>;

int main()
{
    int n;
    cin >> n;
    cout << n / 3 << endl;
    return 0;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
int main(){
int N;
cin>>N;
vector<long long>L(88);
L.at(0)=2L;
L.at(1)=1L;
for(int i=0;i<N-1;i++){
  L.at(i+2)=L.at(i+1)+L.at(i);
  }
printf("%ld\n",L.at(N));
}

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

// @@ !! LIM()

int main(/* int argc, char *argv[] */) {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << setprecision(20);

  ll H, W, K; cin >> H >> W >> K;
  vector<string> ss(H);
  vector<ll> rcnt(H);
  for (ll i = 0; i < H; i++) {
    cin >> ss[i];
    ll z = 0;
    for (ll j = 0; j < W; j++) {
      if (ss[i][j] == '#') z++;
    }
    rcnt[i] = z;
  }

  ll seq = 1;
  vector<vector<ll>> ans(H, vector(W, 0LL));

  auto func = [&](ll from, ll to, ll idx) -> void {
    bool first = true;
    ll p = 0;
    for (ll j = 0; j <= W; j++) {
      if (j == W || ss[idx][j] == '#') {
	if (first) first = false;
	else {
	  for (ll i = from; i < to; i++) {
	    for (ll m = p; m < j; m++) {
	      ans[i][m] = seq;
	    }
	  }
	  p = j;
	  seq++;
	}
      }
    }
  };

  {
    ll i = 0;
    bool first = true;
    ll p = 0;
    ll q = -1;
    while (i < H) {
      if (rcnt[i] > 0) {
	if (first) {
	  first = false;
	  q = i;
	}else {
	  func(p, i, q);
	  p = i;
	  q = i;
	}
      }
      i++;
    }
    func(p, H, q);
  }
  for (ll i = 0; i < H; i++) {
    for (ll j = 0; j < W; j++) {
      if (j > 0) cout << " ";
      cout << ans[i][j];
    }
    cout << "\n";
  }

  return 0;
}



Measured memory_bytes: 3948
#include <algorithm>
#include <iostream> //標準入出力
#include <fstream>  //ファイルでの入出力
#include <vector>
#include <queue>
#include <functional>
#include <string>
#include <utility> //pair
#include <cmath>  //sqrt 
#include <iomanip> //setprecision
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
#define ALL(a)  (a).begin(),(a).end()
#define MAX 1000000
#define pair(a) pair<a,a>

void _main(){
    int d,t,s; cin >> d >> t >> s;
    if(d/s<t)cout << "Yes" <<endl;
    else if(d == s*t)cout << "Yes" <<endl;
    else cout << "No"<< endl;
    return;
}
int main() {
    cout << fixed << setprecision(10);
    _main();
    return 0;
}

Measured memory_bytes: 3104
import math
import sys

N = int(input())

X2 = math.floor(N / 1.08)
X1 = X2 - 1
if X1 < 0:
    X1 = 0
X3 = X2 + 1
if math.floor(X1 * 1.08) == N: 
    print(X1)
elif  math.floor(X2 * 1.08) == N:
    print(X2)
elif  math.floor(X3 * 1.08) == N:
    print(X3)
else:
    print(":(")


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  int n; cin >> n;
  ll ans = 0;
  for(int i = 1; i < n+1; ++i) {
    int j = 1;
    while(i*j <= n) ans += i*(j++);
  }
  cout << ans << "\n";
  return 0;
}

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

using namespace std;
typedef long long LL;
typedef pair<int,int> pii;

const int MAXN = 2e5 + 5;
const int MOD = 1e9+7;
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second 
#define FAIL0 {cout << "0\n"; return 0;}
#define FAIL1 {cout << "-1\n"; return 0;}
#define FAILNO {cout << "No\n"; return 0;}

int N;
pair<int,int> P[MAXN];

int main(int argc, char **argv) {
#ifdef OJ
    freopen("input.txt", "rt", stdin);
    //freopen("output.txt", "wt", stdout);
#endif
    ios::sync_with_stdio(false);
    cin.tie(0);

    cin >> N;
    for (int i = 0; i < N; i++) cin >> P[i].se >> P[i].fi;
    sort(P,P+N);

    LL cur = 0;
    int ok = 1;
    for (int i = 0; i < N; i++) {
        if (cur + P[i].se > P[i].fi) {
            ok = 0;
            break;
        }

        cur += P[i].se;
    }

    if (ok) cout << "Yes\n";
    else cout << "No\n";
    return 0;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
#include<algorithm>
#include<math.h>
#include<string>
#include<iostream>
#include<vector>
#include<cstdlib>
using namespace std;
 
template <class T> using V = vector<T>;
 
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;
 
using ll = long long;
using db = double;
using st = string;
using ch = char;
using bl = bool;
using vll = V<ll>;
using vpll =V<pair<ll,ll>>;
using vst = V<st>;
using vdb = V<db>;
using vch = V<ch>;
using vbl = V<bl>;

 
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define rFOR(i,a,b) for(ll i=(a);i>=(b);i--)
#define oFOR(i,a,b) for(ll i=(a);i<(b);i+=2)
#define bgn begin()
#define en end()
#define SORT(a) sort((a).bgn,(a).en)
#define REV(a) reverse((a).bgn,(a).en)
#define M(a,b) max(a,b)
#define rM(a,b) min(a,b)
#define fi first
#define se second
#define sz size()
#define gcd(a,b) __gcd(a,b)
#define co(a) cout<<a<<endl;
#define ci(a) cin>>a;
  
 

ll sum(ll n) {
ll m=0;
  while(n){
    m+=n%10;
    n/=10;
  }
  return m;
}
 
 
const int MAX = 510000;
const int MOD = 1000000007;
 
long long fac[MAX], finv[MAX], inv[MAX];
 
void Comuse() {
    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;
    }
}
 
 
#define comuse Comuse()
 
ll combi(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
 
 
 
 
ll lcm(ll a,ll b){
  ll n;
  n=a/gcd(a,b)*b;
  return n;
}




 
/****************************************\
| Thank you for viewing my code:)        |
| Written by RedSpica a.k.a. RanseMirage |
| Twitter:@asakaakasaka                  | 
\****************************************/
 
 
signed main() {
  db n;
  ci(n);
  ll m=n/1;
  db one=1;
  if(m%2==0){
    co(0.5)
  }
  else{
    co(((n-1)/2+one)/n)
  }
}

Measured memory_bytes: 256
#ifdef __GNUC__
#pragma GCC target("avx2")
#pragma GCC optimize ("O25")
#pragma GCC optimize ("tree-vectorize")
#pragma GCC optimize("unroll-loops")
#define iss std::cin
#endif
#include "bits/stdc++.h"
#define rep(i, times) for(ll i = 0; i < (times); ++i)
#define p(x) (cout << x << "\n")
using ll = uint16_t; using ld = long double; using namespace std;

#ifndef __GNUC__
string text =
R"X(
8
7 3 5 4 2 1 6 8
3 8 2 5 4 6 7 1
)X";
stringstream iss{text};
#endif

class CountOrder
{
	ll N{0};
	vector<ll> p, q;
	void inp( ) {
		iss >> N; p.resize(N); q.resize(N);
		rep(n, N) { iss >> p[n]; }
		rep(n, N) { iss >> q[n]; }
		//for_each(begin(p), end(p), [](auto x) { cout << x << "\n"; });
	}
	void change( ) {
		long long sa{0};
		if (p > q) swap(p, q);
		do {
			if (p == q) break;
			++sa;
		} while (next_permutation(begin(p), end(p)));
		p(sa);
	}
public:
	void procedures( ) {
		inp( );
		change( );
	}
};
//https://atcoder.jp/contests/abc145/tasks/abc145_c
int main( ) {
	cin.tie(0);	ios::sync_with_stdio(0);
	class CountOrder a; a.procedures( );
}

Measured memory_bytes: 3596