akhauriyash/Code-Regression huggingface dataset:
import std.stdio, std.string, std.conv;
import std.range, std.algorithm, std.array, std.typecons, std.container;
import std.math, std.numeric, core.bitop;

enum inf3 = 1_001_001_001;
enum inf6 = 1_001_001_001_001_001_001L;
enum mod = 1_000_000_007L;


void main() {
    int n;
    scan(n);
    auto s = readln.chomp;
    int rc, bc;
    foreach (ch ; s) {
        if (ch == 'R') rc++;
        else bc++;
    }
    auto ans = rc > bc;
    writeln(ans ? "Yes" : "No");
}

























int[][] readGraph(int n, int m, bool isUndirected = true, bool is1indexed = true) {
    auto adj = new int[][](n, 0);

    foreach (i; 0 .. m) {
        int u, v;
        scan(u, v);
        if (is1indexed) {
            u--, v--;
        }
        adj[u] ~= v;
        if (isUndirected) {
            adj[v] ~= u;
        }
    }

    return adj;
}

alias Edge = Tuple!(int, "to", int, "cost");

Edge[][] readWeightedGraph(int n, int m, bool isUndirected = true, bool is1indexed = true) {
    auto adj = new Edge[][](n, 0);

    foreach (i; 0 .. m) {
        int u, v, c;
        scan(u, v, c);
        if (is1indexed) {
            u--, v--;
        }
        adj[u] ~= Edge(v, c);
        if (isUndirected) {
            adj[v] ~= Edge(u, c);
        }
    }

    return adj;
}

void yes(bool b) {
    writeln(b ? "Yes" : "No");
}

void YES(bool b) {
    writeln(b ? "YES" : "NO");
}

T[] readArr(T)() {
    return readln.split.to!(T[]);
}

T[] readArrByLines(T)(int n) {
    return iota(n).map!(i => readln.chomp.to!T).array;
}

void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}

void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}

bool chmin(T, U...)(ref T x, U args) {
    bool isChanged;

    foreach (arg; args) {
        if (x > arg) {
            x = arg;
            isChanged = true;
        }
    }

    return isChanged;
}

bool chmax(T, U...)(ref T x, U args) {
    bool isChanged;

    foreach (arg; args) {
        if (x < arg) {
            x = arg;
            isChanged = true;
        }
    }

    return isChanged;
}


Measured memory_bytes: 256
s1 = input()
s2 = input()

#dp[j][i] = (s1のi文字目までとs2のj文字目までの距離)
dp = [[float('inf') for i in range(len(s1)+1)] for j in range(len(s2)+1)]

for i in range(len(s1)+1):
    dp[0][i] = i
for j in range(len(s2)+1):
    dp[j][0] = j

for i in range(len(s1)):
    for j in range(len(s2)):
        if s1[i] == s2[j]:
            dp[j+1][i+1] = dp[j][i]
        else:
            dp[j+1][i+1] = min(dp[j][i], dp[j+1][i], dp[j][i+1]) +1
print(dp[len(s2)][len(s1)])



Measured memory_bytes: 46656
#include<stdio.h>
 
int main(void){
  int N,i,work,min,ans=-1000000000;
 
  scanf("%d",&N);
 
  for(i=0;i<N;i++){
    scanf("%d",&work);
     
    if(i==0){
      min=work;
      continue;
    }
  
    if(ans<(work-min)) ans=work-min;
 
    if(work<min) min=work;
  }
 
  printf("%d\n",ans);
 
  return 0;
}

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

using namespace std;
using ll = long long;


int main()
{
    int a, b, c, d;
    cin >> a >> b >> c >> d;

    for(int i = 0;; i++) {
        if(i % 2 == 0) {

            c -= b;

        }else {

            a -= d;

        }

        if(a <= 0) {
            cout << "No" << endl;
            return 0;
        }

        if(c <= 0) {
            cout << "Yes" << endl;
            return 0;
        }
    }
}

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


int main() {
    int n,k;
    cin>>n>>k;
    int a[n];
    for(int i=0;i<n;i++)cin>>a[i];
    sort(a,a+n);
    int ans=0;
    for(int i=0;i<n && k--;i++) {
        ans+=a[i];
    }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 3596
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

ll solve(ll a){
	if(a%4==1)return 1;
	if(a%4==2)return a+1;
	if(a%4==3)return 0;
	if(a%4==0)return a;
	return 0;
}


int main(){
	ll a,b;
	cin>>a>>b;
	cout<<(solve(b)^solve(a-1))<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  long long int n,m;
  cin>>n>>m;
  long long int A[m];
  for(long long int i=0;i<m;i++)cin>>A[i];
 long long  int sum=0;
  for(long long int i=0;i<m;i++)sum+=A[i];
  long long int ans=n-sum;
  if(ans<0)ans=-1;
  cout<<ans<<endl;
  return 0;}

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


#define pb push_back 
#define rep(i, n, a) for(int i = a;i< n;i++)
#define all(x) (x).begin(), (x).end()
#define so(x) sort(x.begin(), x.end());
typedef long long int ll;
typedef vector<int> vi;
typedef vector<vector<int>>vii;
typedef vector<ll> vl;
typedef vector<vector<ll>>vll;
typedef pair <int, int> pii;
typedef pair<ll, ll> pll;

void printVec(vector<int> &A){
    for(int i=0;i< A.size();i++){
        cout<<A[i]<<' ';
    }
    cout <<endl;
}

void printArr(int arr[], int n){
    for(int i =0;i< n;i++){
        cout<<arr[i]<<' ';
    }
    cout <<endl;
}


void solve(){
    ll x, k, d;
    cin>>x>>k>>d;
    long double k1 = 1.0*abs(x - k*d)/(d);
    x = abs(x);
    if ( (1.0*x / d)  >=  k){
        // cout<<"LLL"<<endl;
        cout<< x - k*d <<endl;
        return ;
    }
    if( x%d == 0){
        if( (k - x/d)%2 == 0 ){
            cout<<0<<endl;
            return ;
        }
        else cout<<d<<endl;
        return ;
    }
    k = k - x/d;
    x = x%d;
    if(k % 2 == 0){
        cout<< x<<endl;
    }
    else cout<< abs(x-d)<<endl;
    // cout<<min(abs(x%d ), abs(x%d -d))<<endl;
    return ;
}

int main(){
    int t;
    // cin>>t;
    t = 1;
    while(t--){
        solve();
    }
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
int main()
{
	char s[200000];
	char t[200000];
	for(int i = 0; i < 200000; i++)
		s[i] = t[i] = '0';
	cin >> s;
	cin >> t;
	int counter = 0;
	for(int i = 0; i < 200000; i++){
		if(s[i] != t[i])
			counter++;
	}
	cout << counter;
	return 0;
}

Measured memory_bytes: 4016
//#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>

using namespace std;


void solve() {
    int N, K; cin >> N >> K;
    vector<long long> V(N);
    for (int i = 0; i < N; i++) cin >> V[i];

    long long ans = 0;
    for (int p = 0; p <= min(K, N); p++) {
        for (int q = 0; p + q <= min(K, N); q++) {
            vector<long long> v;
            long long cur = 0;
            for (int i = 0; i < p; i++) v.push_back(V[i]), cur += V[i];
            for (int i = 0; i < q; i++) v.push_back(V[N-1-i]), cur += V[N-1-i];

            sort(v.begin(), v.end());
            for (int i = 0; i < min(K - p - q, (int)v.size()); i++) {
                if (v[i] < 0) cur -= v[i];
            }

            ans = max(ans, cur);
        }
    }

    cout << ans << endl;
}


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

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

using namespace std;

#define inf 1<<30
#define llong long long
#define usd unsigned
#define pqueue priority_queue
#define mp make_pair
#define pb push_back
#define fn fill_n
typedef pair<int, int> P;
typedef struct data{
	int now;
	int cost;
}data;
int nw[9] = {0, 1, 0, -1, -1, 1, 1, -1, 0};
int nh[9] = {1, 0, -1, 0, 1, 1, -1, -1, 0};
int a,b,c,d, A[100], B[100], C[100][100], D[100][100][100];
string s, t, r;




int main(){
	cin >> s;
	a = 0;
	for(int i = 0; i < 4; i++){
		if(s[i] == '+') a++;
		else a--;
	}
	cout << a << endl;

	return 0;
}

Measured memory_bytes: 256
function main()
  n, m = map(s->parse(BigInt,s),split(readline()))
  answer = big"1"
  i = big"2"
  while i^2 <= m
    if mod(m,i) == 0
      count = big"0"
      while mod(m,i) == 0
        count += 1
        m /= i
      end
      answer *= comb(n+count-1,count)
    end
    i += 1
  end
  if m > 1
    answer *= n
  end
  println(mod(answer,big"1000000007"))
end

function comb(n,k)
  if n-k < k return comb(n,n-k) end
  numer = one(n)
  denom = one(n)
  for i = 0:k-1
    numer *= n - i
    denom *= i + 1
  end
  return div(numer,denom)
end

main()


Measured memory_bytes: 116188
#include<bits/stdc++.h>
using namespace std;
#define Nitroboost  ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
#define ll long long int 
const int mod=1e9+7;
const int N=1e5+5;

ll sum1[N],sum2[N];

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

        int d,t,s;
        cin>>d>>t>>s;
        if(1ll*t*s>=d)
            cout<<"Yes";
        else
            cout<<"No";
    }

Measured memory_bytes: 3632
#include <iostream>
#include <string>
using namespace std;
string s;
int main(){
  cin >> s;
  int len;
  len=s.length()%2;
  int f;
  if(s[0]==s[s.length()-1])f=0;
  else f=1;
  if(len!=f)cout << "Second" << endl;
  else cout << "First" << endl;
  return 0;
}


Measured memory_bytes: 512
#include <iostream>

using namespace std;
typedef long long ll;

int main(){
    ll n, k;
    cin >> n >> k;
    if(k == 0){
        cout << n * n << endl;
        return 0;
    }
    ll ans = 0;
    for(int b = k + 1; b <= n; ++b){
        ans += (n / b) * (b - k) + max(n % b - k + 1, 0LL);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 504
require "matrix"

n,m = gets.split.map { |e| e.to_i }
matElem = []
vecElem = []

# 行列の要素を格納
n.times do 
  matElem << gets.split.map { |e| e.to_i }
end

# ベクトルの要素を格納
m.times do 
  vecElem << gets.to_i
end

mat = Matrix.rows(matElem)
vector = Matrix.column_vector(vecElem)

# 乗じた結果を配列に変換して出力　
(mat*vector).to_a.each do |elem|
  puts elem
end

Measured memory_bytes: 6984
#include<cstdio>
#include<vector>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<set>
#include<map>
#include<queue>
#include<stack>
using namespace std;
#define ll long long
#define INF 2147483647
#define N 1000000007

int main()
{
	bool flag=false;
	string s;
	cin>>s;
	for(int i=0;i<s.size();i++)
	{
		if(s[i]=='C') flag=true;
		else if(flag&&s[i]=='F') {printf("Yes");return 0;} 
	}
	printf("No");
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
void solve(){
	string s,t;
	cin>>s>>t;
	long n=s.size();
	long m=t.size();
	long count=0,ans=LONG_MAX;
	for(int i=0;i<n-m+1;i++){
//		cout<<i<<"\n";
		count=0;
		for(int j=0;j<m;j++){
			if(t[j]==s[i+j]){
				count++;
			}
		}
		ans=min(ans,m-count);
	}
	cout<<ans<<"\n";
}
int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	long t=1;
//	cin>>t;
	while(t--){
		solve();
	}
}

Measured memory_bytes: 3640
#include<bits/stdc++.h>
using namespace std;
long double M=3.1415926535;
int main()
{
	long double a,b,x,v,j;
	cin>>a>>b>>x;
	if (x*2==a*a*b)
	{
		cout<<setprecision(10)<<asin(b/sqrt(a*a+b*b))*180.0/M<<endl;
	}
	else if(x*2>a*a*b)
	{
		v=a*a*b-2*(a*a*b-x);
		j=v/(a*a);
		j=b-j;
		cout<<setprecision(10)<<asin(j/sqrt(a*a+j*j))*180.0/M<<endl;
	}
	else
	{
		v=a*a*b-2*x;
		j=v/(b*a);
		j=a-j;
		cout<<setprecision(10)<<asin(b/sqrt(b*b+j*j))*180.0/M<<endl;
	}
}

Measured memory_bytes: 256
module kkk
  sub main()
 
    Dim N As Integer = Integer.Parse(Console.ReadLine)
    Dim a() As Integer = Array.ConvertAll(Of String, Integer)(Console.ReadLine.Split(" "), AddressOf Integer.Parse)

    
    dim i as long
    
    dim cnt as long
    
    for i = 0 to N - 1
      if a(i) = cnt + 1 then
        cnt = cnt + 1
      end if
  next
    
    if cnt = 0 then
      console.writeline(-1)
    else 
      console.writeline(N - cnt)
    end if
    
  end sub
end module

Measured memory_bytes: 33116
# import sys
# sys.setrecursionlimit(10 ** 6)
# import bisect
# from collections import deque
# from decorator import stop_watch
#
#
# @stop_watch
def solve(H, W, K, Si):
    Si = [[int(i) for i in S] for S in Si]
    ans = H + W
    for i in range(2 ** (H - 1)):
        h_border = bin(i).count('1')
        w_border = 0
        white_counts = [0] * (h_border + 1)
        choco_w = 0
        for w in range(W):
            choco_w += 1
            wc_num = 0
            tmp_count = [0] * (h_border + 1)
            for h in range(H):
                white_counts[wc_num] += Si[h][w]
                tmp_count[wc_num] += Si[h][w]
                if i >> h & 1:
                    wc_num += 1
            if max(white_counts) > K:
                if choco_w == 1:
                    break  # 1列の時点で > K の場合は条件を達成できない
                w_border += 1
                white_counts = tmp_count
                choco_w = 1
        else:
            ans = min(ans, h_border + w_border)
    print(ans)


if __name__ == '__main__':
    H, W, K = map(int, input().split())
    Si = [input() for _ in range(H)]
    solve(H, W, K, Si)

    # # test
    # from random import randint
    # from func import random_str
    # 
    # H, W, K = 10, 1000, randint(1, 100)
    # Si = [random_str(W, '01') for _ in range(H)]
    # print(H, W, K)
    # for S in Si:
    #     print(S)
    # solve(H, W, K, Si)


Measured memory_bytes: 9368
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
typedef pair<int, int> pii;
typedef vector<pii> VP;
typedef vector<string> VS;
typedef priority_queue<int> PQ;
template<class T>bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//priority_queue<int,vector<int>, greater<int> > q2;



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

	int N; cin >> N;
	VI A(N);
	VI cnt(N, 0);
	int mi = INF, ma = -1;
	REP(i, N) {
		cin >> A[i];
		cnt[A[i]]++;
		chmin(mi, A[i]);
		chmax(ma, A[i]);
	}
	rSORT(A);
	bool F = 1;
	int type = 1;
	if (ma % 2)type++;
	eFOR(i, mi, ma) {
		//cout << F << endl;
		if (i == mi && cnt[i] != type)F = 0;
		else if (i == mi)continue;
		if (cnt[i] < 2)F = 0;
		else if (cnt[i] == 0)F = 0;
	}
	//cout << F << endl;
	if ((ma + 1) / 2 != mi)F = false;

	if (F)cout << "Possible" << endl;
	else cout << "Impossible" << endl;

	return 0;
}



Measured memory_bytes: 256
/*
 * author :Sadik Hassan(_sad_)
 *
*/
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")
#include "bits/stdc++.h"
using namespace std;
using   ll =          long long;
using   ld =          long double;
#define nl            "\n"
#define pb            push_back
#define fi            first
#define se            second
#define MP            make_pair
#define PI            (acos(-1.0))
#define rep1(i,n)     for(int i=1;i<=n;i++)
#define rep(i,n)      for(int i=0;i<n;i++)
#define SZ(s)         (int)s.size()
#define all(x)        (x).begin(), (x).end()
#define rall(x)       (x).rbegin(), (x).rend()
#define w(t)          int t;cin>>t;while(t--)
#define TSU(s)        transform(s.begin(),s.end(),s.begin(),::toupper);
#define TSL(s)        transform(s.begin(),s.end(),s.begin(),::tolower);
#define _SAD()     	  ios::sync_with_stdio(0),cin.tie(0),cout.tie(0),cout<<fixed<<setprecision(15);

typedef vector<int> vi;
typedef vector<ll> vii;
typedef set<int> si;
typedef set<ll> sii;
/*---------------------------------------------------------------------*/

const int N = (int)2e5+5;
const int MOD =(int)1e9+7;
const ll INF = (ll)1e18+5;

int main()
{
    _SAD()
    int n,x,t;
    cin>>n>>x>>t;
    if(n%x==0)
    {
        cout<<(n/x)*t<<nl;
    }
    else cout<<((n/x)+1)*t<<nl;
    return 0;
}


Measured memory_bytes: 3648
import Control.Applicative

main = do
  ss <- words <$> getLine
  let n = read (ss !! 0) :: Int
  let a = read (ss !! 1) :: Int
  let b = read (ss !! 2) :: Int
  let p = n `div` (a+b)
  let q = n `mod` (a+b)
  let r = min a q
  putStrLn $ show (p*a+r)

Measured memory_bytes: 508
cards = [[s + " " + str(n) for n in range(1,14)] for s in ["S","H","C","D"]]

n = int(input())
for _ in range(n):
    suit,num = input().split()
    if   suit=='S': cards[0][int(num)-1] = 0
    elif suit=='H': cards[1][int(num)-1] = 0
    elif suit=='C': cards[2][int(num)-1] = 0
    elif suit=='D': cards[3][int(num)-1] = 0
for s in cards:
    for n in s:
        if n!=0: print(n)


Measured memory_bytes: 5600
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,a) for(int i=0;i<(a);i++)
const ll MOD=1000000007;
//const ll MOD=998244353;

int main(){
  int N,K; cin>>N>>K;
  ll A[N]; rep(i,N) cin>>A[i];
  for(int i=K;i<N;i++){
    if(A[i-K]<A[i]) cout<<"Yes\n";
    else cout<<"No\n";
  }
  return 0;
}


Measured memory_bytes: 5192
n = int(input())
ls = [int(x) for x in input().split()]
if 0 in ls:
    print(0)
    exit()
res = 1
for x in ls:
    if res <= 1000000000000000000:
        res *= x
    else:
        break

print(res if res <= 1000000000000000000 else -1)

Measured memory_bytes: 21652
import java.util.*;

public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String s = sc.next();
        int num = 1 << n;
        HashMap hm = new HashMap<String, Integer>();
        for(int i=0; i<num; i++){
            String bin = String.format("%"+n+"s",Integer.toBinaryString(i)).replace(' ', '0');
            char[] left = new char[n];
            int lc = 0, rc = n-1;
            for(int j=0; j<n; j++){
                if(bin.charAt(j) == '0'){
                    left[lc] = s.charAt(j);
                    lc++;
                }else{
                    left[rc] = s.charAt(j);
                    rc--;
                }
            }
            String sleft = new String(left) + lc;
            if(hm.get(sleft) != null){
                hm.put(sleft, (int)hm.get(sleft) + 1);
            }else{
                hm.put(sleft, 1);
            }
        }

        long ans = 0;

        for(int i=0; i<num; i++){
            String bin = String.format("%"+n+"s",Integer.toBinaryString(i)).replace(' ', '0');
            char[] right = new char[n];
            int lc = 0, rc = n-1;
            for(int j=0; j<n; j++){
                if(bin.charAt(j) == '0'){
                    right[lc] = s.charAt(2*n-j-1);
                    lc++;
                }else{
                    right[rc] = s.charAt(2*n-j-1);
                    rc--;
                }
            }
            String sright = new String(right) + lc;
            if(hm.get(sright) != null){
                ans += (int)hm.get(sright);
            }
        }

        System.out.println(ans);
    }
}

Measured memory_bytes: 338928
N, C = map(int, input().split())
D = []
for i in range(C):
    D.append(list(map(int, input().split())))

c_arr = []
for i in range(N):
    c_arr.append(list(map(int, input().split())))


c_arr1 = []
c_arr2 = []
c_arr3 = []

for i in range(N):
    for j in range(N):
        if (i+j)%3 == 0: 
            c_arr1.append(c_arr[i][j])
        if (i+j)%3 == 1: 
            c_arr2.append(c_arr[i][j])
        if (i+j)%3 == 2: 
            c_arr3.append(c_arr[i][j])

tmp = 1000*500*500

def cost(arr, aft):
    sum = 0
    for i in range(len(arr)):
        sum += D[arr[i]-1][aft]
    return sum

ans_arr1 = []
ans_arr2 = []
ans_arr3 = []

for l in range(C):
    ans_arr1.append(cost(c_arr1, l))
for l in range(C):
    ans_arr2.append(cost(c_arr2, l))
for l in range(C):
    ans_arr3.append(cost(c_arr3, l))


ans_arr = []
for l in range(C):
    for m in range(C):
        for n in range(C):
            if l == n or n == m or m == l:
                pass
            else:
                ans_arr.append(ans_arr1[l]+ans_arr2[m]+ans_arr3[n])

print(min(ans_arr))

Measured memory_bytes: 8664
#include <cstdio>
#include <iostream>
#include <string.h>
#include <string> 
#include <map>
#include <queue>
#include <vector>
#include <set>
#include <algorithm>
#include <math.h>
#include <cmath>
#include <bitset>
#define mem0(a) memset(a,0,sizeof(a))
#define meminf(a) memset(a,0x3f,sizeof(a))
using namespace std;
typedef long long ll;
typedef long double ld;
const int maxn=100005,inf=0x3f3f3f3f;
const ll llinf=0x3f3f3f3f3f3f3f3f; 
const ld pi=acos(-1.0L);
int a[maxn];

int gcd(int a,int b) {
	int x=a,y=b,z;
	if (x<y) {
		z=x;x=y;y=z;
	}
	while (y) {
		z=x;x=y;y=z%y;
	}
	return x;
}

int main() {
	int n,i,j,k,m;
	scanf("%d%d",&n,&k);
	scanf("%d",&a[1]);
	m=j=a[1];
	for (i=2;i<=n;i++) {
		scanf("%d",&a[i]);
		j=gcd(j,a[i]);
		m=max(m,a[i]);
	}
	if (k%j==0&&k<=m) {
		printf("POSSIBLE");
	} else printf("IMPOSSIBLE");
	return 0;
}


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

int main() {
  long long x;
  cin>>x;
  long long a = 100;
  int y = 0;
  while (true) {
    ++y;
    a = a * 1.01;
    if (a >= x) {
      cout<<y<<endl;
      return 0;
    }
  }
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()   //reverse
#define strall(v) (v).cbegin(),(v).cend() //const_itterator
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>;
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
template<typename t, typename u, typename Comp=less<>>
bool chmax(t& xmax, const u& x, Comp comp={}) { if(comp(xmax, x)) { xmax = x; return true; } return false;}
template<typename t, typename u, typename Comp=less<>>
bool chmin(t& xmin, const u& x, Comp comp={}) { if(comp(x, xmin)) { xmin = x; return true;} return false;}
const int INF = 1e8;
const ll infl = 1LL << 60;
///////
using type = pair<int,ll>;//1: query, 0; delete, -1: insert
using event = pair<ll,type>;

int main(){
  int N,Q;cin >> N >> Q;
  vector<event> v;
  for(int i=0;i<N;i++){
    int s,t,x; cin >> s >> t >> x;
    v.push_back({s-x,type(-1, x)});
    v.push_back({t-x,type(0,  x)});
  }
  for(int i=0;i<Q;i++){
    int d;cin >> d;
    v.push_back({d,type(1,i)});
  }
  sort(all(v));
   vector<long long> res(Q);
    multiset<long long> se;
    for (auto p : v) {
        long long x = p.first;
        int type = p.second.first;
        long long val = p.second.second;
        if (type == -1) se.insert(val);
        else if (type == 0) se.erase(se.lower_bound(val));
        else res[val] = (se.empty() ? -1 : *(se.begin()));
    }
    for (auto v : res) cout << v << endl;
}

Measured memory_bytes: 26984
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <stack>
#include <functional>
#include <queue>
#include <cmath>

#define rep(i,j,k) for(int i=j;i<k;i++)
#define drep(n,m) for(int i=0;i<n;i++)for(int j=0;j<m;j++)
#define fi first
#define se second
#define vi vector<int>
#define INF 1000000000
#define MOD 1000000009
#define pb push_back
#define mp make_pair
int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

using namespace std;


int main() {
    int a,b;
    cin>>a>>b;
    string s;cin>>s;
    rep(i,0,s.length()){
        if(i==a&&s[i]!='-'){
            cout<<"No"<<endl;
            return 0;
        }
        if(i!=a && !('0'<=s[i]&&s[i]<='9')){
            cout<<"No"<<endl;
            return 0;
        }
    }
    cout<<"Yes"<<endl;
    
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>

int main(void) {
  // initialize and read input
  int n, m, i, j;
  scanf(" %d %d", &n, &m);
  int *A = (int *) malloc(sizeof(int) * n * m);
  int *b = (int *) malloc(sizeof(int) * m); 
  int *c = (int *) malloc(sizeof(int) * n);
  for (i = 0; i < n; i++)
    for (j = 0; j < m; j++)
      scanf(" %d", A+i*m+j);
  for (i = 0; i < m; i++)
    scanf(" %d", b+i);
  // compute
  for (i = 0; i < n; i++) {
    *(c+i) = 0;
    for (j = 0; j < m; j++)
      *(c+i) += *(A+m*i+j) * *(b+j);
    // print
    printf("%d\n", *(c+i));
  }
  return 0;
}



Measured memory_bytes: 2076
from copy import deepcopy

S = input()
T = input()

candidate = []
ln = len(S) - len(T) + 1
for i in range(ln):
    if S[i] == T[0] or S[i] == '?':
        for s, t in zip(S[i:i+len(T)], T):
            if not(s == t or s == '?'):
                break
        else:
            candidate.append(i)

if candidate == []:
    print('UNRESTORABLE')
    exit()

ans = []
for i in candidate:
    tmp_s = list(deepcopy(S))
    tmp_s[i:i+len(T)] = list(T)
    tmp_s = ['a' if c == '?' else c for c in tmp_s]
    ans.append(''.join(tmp_s))

ans.sort()
print(ans[0])

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

int main(){
  int a,b,t;
  cin >> a >> b >> t;
  int pro = t/a;
  cout << pro * b << endl;
  return 0;
}


Measured memory_bytes: 256
#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(){
  int n, k;
  cin >> n >> k;
  vector<int> p(n);
  rep(i,n) cin >> p[i];
  rep(i,n) p[i]++;
  int mx = 0;
  int s = 0;
  queue<int> q;
  rep(i,n){
    s += p[i];
    q.push(p[i]);
    if (q.size()>k){
      s -=q.front(); q.pop();
    }
    if (q.size()==k){
      mx = max(mx, s);
    }
  }
  double ans = mx;
  ans /= 2;
  printf("%.10f\n", ans);
  return 0;
}

Measured memory_bytes: 1792
#include<iostream>
#include<algorithm>
#include <cstring>
#define maxn 100100
using namespace std;
struct node
{
    int x,y;
};
node a[maxn];
bool cmp (node b,node c)
{
    return b.y<c.y;
}
int main ()
{
    int n,m;
    cin>>n>>m;
    for (int i=0;i<m;i++)
    {
        cin>>a[i].x>>a[i].y;
    }
    int sum=1;
    sort(a,a+m,cmp);
    int d=a[0].y;
    for (int i=1;i<m;i++)
    {
        if (a[i].x>=d)
        {
            d=a[i].y;
            sum++;
        }
    }
    cout<<sum<<endl;
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
int main(int argc, char** argv)
{
    using namespace std;
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int a, b, c;
    cin >> a >> b >> c;
    cout << (a+b>=c ? "Yes":"No") << "\n";
    return 0;
}

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

using namespace std;

using ll = long long;
#define FOR(i, a, b) for (ll i = (a); i < (b); ++i)
#define FORE(i, a, b) for (ll i = (a); i <= (b); ++i)
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define repe(i, n) for (ll i = 0; i <= (n); ++i)
#define ALL(v) (v).begin(), (v).end()
#define SP cout << fixed << setprecision(10)
typedef pair<int, int> P;
const ll INF = (ll)1e16;
const int MOD = (int)1e9 + 7;
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }

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

    ll l, r;
    cin >> l >> r;

    if (r - l < (ll)(2019)) {
        ll ans = (ll)(5e18);
        FORE(i, l, r) {
            FORE(j, i + 1, r) { ans = min((i * j) % (ll)(2019), ans); }
        }
        cout << ans << endl;
    } else {
        cout << 0 << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#B 105
a = int(input())
s = 0
k = 0
if a%2==0:
    a-=1
if(a > 105):
    for i in range(105,a+2,2):
        #print(i)
        for j in range(1,i+1):
            if i%j==0:
                #print(i,j)
                k+=1
        if k==8:
            s+=1
        k = 0
elif a == 105:
    s=1
print(s)

Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner stdIn = new Scanner(System.in);
        int a = stdIn.nextInt();
        int b = stdIn.nextInt();

        if(a < b) {
            System.out.println("a < b");
        } else if(a > b) {
            System.out.println("a > b");
        } else {
            System.out.println("a == b");
        }
    }
}

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

int main(){
  int n;
  while(cin >> n,n){
    int a[n];
    for(int i=0; i<n; ++i){
      cin >> a[i];
    }
    int ans = 1000000;
    for(int i=0; i<n; ++i){
      for(int j=i+1; j<n; ++j){
        if(abs(a[i]-a[j]) < ans){
          ans = abs(a[i]-a[j]);
        }
      }
    }
    cout << ans << endl;
  }
}



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

int main(){
    int q;
    cin >> q;
    set<int> s;
    for(int i=0; i<q; i++){
        int a, x;
        cin >> a >> x;
        if(a == 0){
            s.insert(x);
            cout << s.size() << endl;
        }else if(a == 1){
            cout << s.count(x) << endl;
        }else{
            s.erase(x);
        }
    }
    return 0;
}


Measured memory_bytes: 12396
import sys
import math
import collections
import itertools
import array
import inspect

# Set max recursion limit
sys.setrecursionlimit(10000)

# Debug output
def chkprint(*args):
    names = {id(v):k for k,v in inspect.currentframe().f_back.f_locals.items()}
    print(', '.join(names.get(id(arg),'???')+' = '+repr(arg) for arg in args))

# Binary converter
def to_bin(x):
    return bin(x)[2:]

# Set 2 dimension list
def dim2input(N):
    li = []
    for _ in range(N):
        li.append(input().split())
    return li

# --------------------------------------------

dp = None

def main():
    a, b, c = list(map(int, input().split()))

    if a == b:
        print(c)
    else:
        if a == c:
            print(b)
        else:
            print(a)

main()


Measured memory_bytes: 4796
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <unordered_map>
#include <iomanip>
#define REP(i, n) for(int i = 0; (i) < (n); (i)++)
#define MOD 1000000007
using namespace std;
 
int main(){
  int N;
  cin >> N;
  int A[N], B[N], C[N-1], sum = 0;
  REP(i,N){
    cin >> A[i];
  }
  REP(i,N){
    cin >> B[i];
    sum += B[i];
  }
  REP(i,N-1){
    cin >> C[i];
  }
  for (int i = 1; i < N; i++){
    if (A[i] == A[i-1] + 1){
      sum += C[A[i-1]-1];
    }
  }
  cout << sum << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <queue>
#include <set>
#include <map>

using namespace std;
typedef long long ll;

int H, W;
char S[12][12];

bool used[12];
bool used_verify[12];
void clear(){
    for(int i = 0; i < 12; i++) used_verify[i] = false;
}
vector<int> buf;

bool verify_pair(int i, int j){
    for(int k = 0; k+1 < H; k += 2){
        int s = buf[k], t = buf[k+1];
        // cout << s << ':' << t << ' ';
        if(S[s][i] != S[t][j]) return false;
        if(S[s][j] != S[t][i]) return false;
    }
    if(H%2 == 1){
        int s = buf[H-1];
        if(S[s][i] != S[s][j]) return false;
    }
    return true;
}

bool verify(){
    // for(int i = 0; i < H; i++) cout << buf[i];
    // cout << endl;
    if(buf.size() != H) return false;
    clear();
    for(int i = 0; i < W; i++){
        for(int j = i+1; j < W; j++){
            if(!used_verify[i] && !used_verify[j] && verify_pair(i, j)) {
                // cout << "unite " << i << ' ' << j << endl;
                used_verify[i] = true; used_verify[j] = true;
            }
        }
    }
    int unused = 0;
    for(int i = 0; i < W; i++){
        if(!used_verify[i]){
            unused++;
            if(!verify_pair(i, i)) return false;
        }
    }
    // cout << unused << endl;
    if(W%2 == 0 && unused > 0) return false;
    if(unused > 1) return false;
    return true;
}

bool ans = false;

void search_pairs(int t, int cnt){
    if(buf.size()+2 > H){
        if(H%2 == 1){
            for(int i = 0; i < H; i++){
                if(!used[i]) {
                    buf.push_back(i);
                    break;
                }
            }
        }
        ans |= verify();
        if(H%2 == 1){
            buf.pop_back();
        }
    }else{
        for(int i = t; i < H; i++){
            if(used[i]) continue;
            for(int j = i+1; j < H; j++){
                if(used[j]) continue;
                used[i] = true; used[j] = true;
                buf.push_back(i); buf.push_back(j);
                search_pairs(i+1, cnt);
                used[i] = false; used[j] = false;
                buf.pop_back(); buf.pop_back();
            }
            if(!used[i]) cnt++;
            if(cnt >= 2) break;
        }
    }
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setprecision(10) << fixed;
    cin >> H >> W;
    for(int i = 0; i < H; i++){
        for(int j = 0; j < W; j++){
            cin >> S[i][j];
        }
    }
    search_pairs(0, 0);
    cout << (ans?"YES":"NO") << endl;
}

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

using namespace std;

vector<int> string_to_large_int(const string& str){
	vector<int> v;
	for(auto it = str.rbegin(); it != str.rend(); ++it){
		v.push_back(*it - '0');
	}
	return v;
}

string large_int_to_string(const vector<int>& v){
	string str;
	for(auto it = v.rbegin(); it != v.rend(); ++it){
		str += (char)*it + '0';
	}
	return str;
}

vector<int> add_large_int(const vector<int>& a, const vector<int>& b){
	vector<int> c;
	int carry = 0;
	for(int i = 0; i < max(a.size(), b.size()); ++i){
		int x = i < a.size() ? a[i] : 0;
		int y = i < b.size() ? b[i] : 0;
		int z = x + y + carry;
		c.push_back(z % 10);
		carry = z / 10;
	}
	if(carry != 0){
		c.push_back(carry);
	}
	return c;
}

int main(){
	int n;
	cin >> n;
	for(int i = 0; i < n; ++i){
		string str;
		cin >> str;
		auto a = string_to_large_int(str);
		cin >> str;
		auto b = string_to_large_int(str);

		auto c = add_large_int(a, b);

		if(c.size() <= 80){
			cout << large_int_to_string(c) << endl;
		}
		else{
			cout << "overflow" << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 3148
#include <bits/stdc++.h>
using namespace std;
 
#define FASTIO  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define ll long long int
#define ld long double
#define vll vector<ll>
#define pll pair<ll,ll>
#define vl(p) vector<p>
#define W while
#define For(i,s,x) for(i=s;i<x;i++)
#define Fore(i,s,x) for(i=s;i<=x;i++)
#define FOR(i,x) for(i=0;i<x;i++)
#define Rof(i,s,x) for(i=s;i>=x;i--)
#define all(v) v.begin(),v.end()
#define it(r,v) for(auto r=v.begin();r!=v.end();r++)
#define pb push_back
#define in insert
#define sz size()
#define F first
#define S second
#define nl cout<<"\n"
#define pr(a) cout<<a<<" "
#define pr2(a,b) cout<<a<<" "<<b<<"\n"
#define pr3(a,b,c) cout<<a<<" "<<b<<" "<<c<<"\n"
#define mod 1000000007

  int main()
  {
    ll r;
    cin>>r;
    cout<<fixed<<setprecision(2)<<2*3.14*r;
  }

Measured memory_bytes: 3788
#n = int(input()) #入力
#a, b = (int(x) for x in input().split())
#a, b = map(int, input().split())

#a = [int(x) for x in input().split()]
#a = list(map(int, input().split()))
#a = [list(map(int,input().split(" "))) for i in range(N)]   #2次元


#a.sort() # C++ の sort(a.begin(), a.end());
#a.append(3) # C++ の a.push_back(3);


#exit(0) # return 0 的な。終了できる。
## 整数の切り捨て除算は // (ダブルスラッシュ)


#a[始まりの位置: 終わりの位置: スライスの増分] # (a は配列)


#import numpy as np  #importに100 ms 程度かかる。
import math
import copy
import string
#math.gcd(a, b) で、gcd 計算できる。
#math.pi は円周率。

INF = int(10**18) #べき乗 C++ の pow(10, 18) or 1e18;
pi = math.pi

MOD = 1000000007
#MOD = 1000000009
#MOD = 998244353




#繰り返し2乗法
#N^aの、Mで割った余りを求める。
def my_pow(N, a, M):
    if(a == 0):
        return 1
    else:
        if(a % 2 == 0):
            tempo = my_pow(N, a/2, M)
            return (tempo * tempo) % M
        else:
            tempo = my_pow(N, a - 1, M)
            return (tempo * N) % M




#N_C_a を M で割った余り
def my_combination(N, a, M):
    res = 1

    for i in range(0, a):
        res *= N - i
        res %= M

    for i in range(0, a):
        res *= my_pow(i + 1, M - 2, M)
        res %= M

    return res




#N_C_i を M で割った余りを、v[i] に代入する。
def my_combination_table(N, M, v):
    if(len(v) < N + 1):
        l = N + 1 - len(v)
        tempo = [1] * l
        v.extend(tempo)

    for i in range(1, N + 1):
        v[i] = v[i - 1] * (N - (i - 1))
        v[i] %= M

        v[i] *= my_pow(i, M - 2, M)
        v[i] %= M

    return




#math.factorial で階乗は計算できる。
#math.gcd で gcd は計算できる。
#np.gcd.reduce(A) #(Aは配列) で、Aの全ての要素の gcd が計算できる。





S = input()
T = input()

NS = len(S)
NT = len(T)


res = NT
for i in range(0, NS - NT + 1):
    tempo = 0
    for j in range(0, NT):
            if S[i + j] != T[j]: tempo += 1   
    res = min(res, tempo)
print(res)















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

using namespace std;
pair <long long, double> B[4];
pair <double, int> A[4];
int main() {
	int n;
	double temp = 0.25;
	for (int i = 0; i < 4; i++) {
		long long x;
		scanf("%lld", &x);
		B[i] = make_pair(x, temp);
		A[i] = make_pair((double)x / temp, i);
		temp *= 2;
	}
	sort(A, A + 4);
	scanf("%d", &n);
	long long ans = 0;
	int pos = 0;
	while (n > 0 && pos < 4) {
		int idx = A[pos].second;
		int cur = floor(n / B[idx].second);
		ans += cur * B[idx].first;
		n -= (int)(cur * B[idx].second);  
		pos++;
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main() {
	int n;
	cin >> n;
	int a[101];
	int count = 0;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		if ((a[i] % 6 == 0) || (a[i] % 10 == 0) || (a[i] % 2 != 0)) {
			count+=1;
		}
	}
	if (count == n) {
		cout <<"APPROVED"<<endl;
	}
	else {
		cout<<"DENIED"<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
//include
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath> 
#include <iomanip>
#include <math.h>
#include <utility>
#include <functional>
#include <cstdlib>
//using
using namespace std;
using vl = vector <long long>;
using vs = vector <string>;
using vc = vector <char>;
using ll= long long;
using vvl = vector<vector<ll> >;
using vvc = vector<vector<char> >;
//vector<vector<char> > hyou(N, vector<char>(N));
using vd = vector <double>;
//define
//#define int long long
#define rep(i,n) for(int i=0; i<n; i++)
#define print(n) cout<<n<<endl;
#define sortp(d) sort(d.begin(),d.end()) //1234
#define sortm(d) sort(d.rbegin(),d.rend()) //4321
//素数判定　O(√A) 
bool is_prime(int x){
 if(x<=1) return false;
 for(int i=2;i*i<=x;i++)
 if(x%i==0) return false;
 return true;
 }
/*順列生成
do {
  // 順列に対する処理
} while (next_permutation(配列変数.begin(), 配列変数.end()));*/

//絶対値　abs()
//文字→数字　'0' アルファベット→数字　'a'　'A'が65番,'a'が97番だわ
//型キャスト　char('a'+1)
//reverse 回文
//if(isupper('A'))->大なら真

//各位の和　
int wa(ll x)
{
ll sum = 0;
while(x!=0){
  sum += x% 10;
  x /= 10;
}
return sum;
}


//グローバル変数宣言
ll p=0,q=0,r=0;

int main()
{
  string s;
  cin>>s;
  p=s.size();
   
  rep(i,p)
  {
  if(i==0){
  if (s[0]!='A')
  {
    print("WA")return 0;
  }}
  else if (i==1||i==p-1)
  {
    if(isupper(s[i]))
    {
      print("WA")return 0;
    }
  }
  
  else
  {
    if(s[i]=='C')q++;
    else if(isupper(s[i]))
    {
      print("WA")return 0;
    }
  }
  }

if(q!=1){print("WA")return 0;} else print("AC")
  
}


Measured memory_bytes: 3608
# 6:05
n, d = gets.to_s.split.map{|t|t.to_i}
x = Array.new(n){ gets.to_s.split.map{|t|t.to_i} }

def distance(p_i, p_j)
  
  dist = 0
  p_i.each_with_index do |x, i|
    dist += (x-p_j[i]) ** 2
  end
  dist
end

cnt = 0
n.times do |j|
  j.times do |i|
    dist = distance(x[i], x[j])
    cnt += 1 if dist == ((dist**0.5).round ** 2)
  end
end

puts cnt

Measured memory_bytes: 1788
#include <stdio.h>
#include <string.h>
#include <ctype.h>

int w,h;
char input[70][100];

char map[71][71][100];

int mystrcmp(const char* a,const char* b) {
	int la,lb;
	la=strlen(a);
	lb=strlen(b);
	if(la>lb)return 1;
	if(la<lb)return -1;
	return strcmp(a,b);
}

int main(void) {
	int i,j;
	int mi,mj;
	while(1) {
		scanf("%d%d",&w,&h);
		if(w==0 && h==0)break;
		for(i=0;i<h;i++)scanf("%s",input[i]);
		memset(map,0,sizeof(map));
		for(i=h-1;i>=0;i--) {
			for(j=w-1;j>=0;j--) {
				if(isdigit(input[i][j])) {
					map[i][j][0]=input[i][j];
					map[i][j][1]=0;
					if(mystrcmp(map[i+1][j],map[i][j+1])>0) {
						strcat(map[i][j],map[i+1][j]);
					} else {
						strcat(map[i][j],map[i][j+1]);
					}
				}
			}
		}
		mi=mj=0;
		for(i=0;i<h;i++) {
			for(j=0;j<w;j++) {
				if(isdigit(input[i][j]) && input[i][j]!='0') {
					if(mystrcmp(map[i][j],map[mi][mj])>0 || input[mi][mj]=='0') {
						mi=i;
						mj=j;
					}
				}
			}
		}
		puts(map[mi][mj]);
	}
	return 0;
}

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

#define ll long long int
#define ull unsigned long long int
#define forr(i,n) for(int i=0;i<n;i++)
#define f(i,a,b) for(ll i=a;i<b;i++)
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define endl '\n'
#define ce(ele) cout<<ele<<' '
#define cs(ele) cout<<ele<<'\n'
#define CASE(t) int t; cin>>t; while(t--)
#define sor(v) sort(v.begin(),v.end())
#define rev(v) reverse(v.begin(),v.end())
#define vi vector<ll>
const ll md=1e9 +7;const ll M1=998244353;
ll mod(ll n){return ((n%md)+md)%md;}
ll power(ll x,ll y){ll res=1;x=x;while(y>0){if(y&1)res=res*x;x=x*x;y=y>>1;}return res;}

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

    ll n;cin>>n;
    ll cnt=0;
    f(i,1,n){
        cnt+=(n-1)/i;
    }
    cs(cnt);
}


Measured memory_bytes: 3636
import math

a, b, h, m = map(float, input().split())

ax = 0.0
ay = 0.0
bx = 0.0
by = 0.0

c = math.sin(math.radians(h * 30 + m / 2))
d = math.cos(math.radians(h * 30 + m / 2))
e = math.sin(math.radians(m * 6))
f = math.cos(math.radians(m * 6))
# print(c)
# print(d)
# print(e)
# print(f)
ax = a * c
ay = a * d
bx = b * e
by = b * f
# print(ax)
# print(ay)
# print(bx)
# print(by)
print(math.sqrt((ax - bx)**2 + (ay - by)**2))


Measured memory_bytes: 9348
N=int(input())
S=input()
if N%2==1:print('No')
else:
  s1,s2=S[:N//2],S[N//2:]
  ok=1
  for i in range(N//2):
    if s1[i]!=s2[i]:
      print('No')
      ok=0
      break
  if ok==1:print('Yes')

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

int main(){
    long long n, T;
    cin >> n >> T;

    long long minv = 1e9;
    for(long long i = 0; i < n; i++){
        long long c, t;
        cin >> c >> t;
        if(t <= T) minv = min(minv, c);
    }

    if(minv == 1e9) printf("TLE\n");
    else printf("%lld\n", minv);

    return 0;
}

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

#define REP(i,n) for(int i=0;i<(int)n;i++)
#define REP1(j,n) for(int j=0;j<(int)n;j++)
#define REPD(i,n) for(int i=n;i>=0;i--)
#define REPD1(j,n) for(int j=n;j=>0;j--)
#define REPS(i,n) for(int i=1;i<=(int)n;i++)
#define REPS1(j,n) for(int j=1;j<=(int)n;j++)
#define rep(i,a,n) for(int i=a;i<(int)n;i++)
#define SZ(x) ((int)(x).size())	//size() unsigned -> int
#define DescSort(a) sort(a.begin(),a.end(),std::greater<int>())

using namespace std;
typedef long long ll;


int main(void) {
	int n, t, a, h;
	int num = 0;
	double ans= 10000000;
	cin >> n;
	cin>> t >> a;
	REPS(i, n){
		cin >> h;
		double temp = abs(a-(t - h * 0.006));
		if (ans > temp) {
			ans=temp;
			num = i;
		}
	}
	cout << num << endl;
	return 0;
}



Measured memory_bytes: 256
import math

N,K = map(int,input().split())

a = list(map(int, input().split()))
l = 0
r = max(a)

x = (l+r)//2
ans = r+1
while(r>1+l):

    
    x = (l+r)//2
    if x == 0:
        break

    count = 0
    for i in range(N):
        count += math.ceil(a[i] /x)-1
    if (count <=K):
        if (ans > x):
            ans = x
        r = x
    else:
        l = x
count = 0
ans = x
if(x!= 0 and l != 0):
        
    for i in range(N):
        count += math.ceil(a[i]/l)-1

    if (count <=K):
        ans = l
    else:
        ans = r

if l==0:
    ans = r
print(ans)

        
        

    


Measured memory_bytes: 31152
S = str(input())
len_s = len(S)


def get_diff(str_a, str_b):
    res = ''
    for i in range(len(str_a)):
        if str_a[i] == str_b[i]:
            res = res + '-'
        else:
            res = res + '+'
    return res


def get_mixed_a(ml):
    return ('01' * (1 + int(ml / 2)))[0:ml]


def get_mixed_b(ml):
    return ('10' * (1 + int(ml / 2)))[0:ml]


zba = get_mixed_a(len_s)
zbb = get_mixed_b(len_s)
res_a = get_diff(zba, S)
res_b = get_diff(zbb, S)
ma = res_a.count('+')
mb = res_b.count('+')
print(min(ma, mb))


Measured memory_bytes: 3572
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while (true) {
			int w = sc.nextInt();
			int h = sc.nextInt();
			if (w == 0 && h == 0)
				break;
			int[][] var = new int[w - 1][h];
			int[][] hor = new int[w][h - 1];
			for (int i = 0; i < h - 1; i++) {
				for (int j = 0; j < w - 1; j++)
					var[j][i] = sc.nextInt();
				for (int j = 0; j < w; j++)
					hor[j][i] = sc.nextInt();
			}
			for (int i = 0; i < w - 1; i++)
				var[i][h - 1] = sc.nextInt();
			int[][] field = new int[w][h];
			for (int i = 0; i < h; i++)
				for (int j = 0; j < w; j++)
					field[j][i] = 0;
			field[0][0] = 1;
			for (int f = 1; true; f++) {
				for (int i = 0; i < h; i++)
					for (int j = 0; j < w; j++) {
						if (field[j][i] == f) {
							if (j > 0 && var[j - 1][i] == 0) {
								if (field[j - 1][i] > 0)
									field[j - 1][i] = Math.min(field[j - 1][i],
											field[j][i] + 1);
								else
									field[j - 1][i] = field[j][i] + 1;
							}
							if (i > 0 && hor[j][i - 1] == 0) {
								if (field[j][i - 1] > 0)
									field[j][i - 1] = Math.min(field[j][i - 1],
											field[j][i] + 1);
								else
									field[j][i - 1] = field[j][i] + 1;
							}
							if (j < w - 1 && var[j][i] == 0) {
								if (field[j + 1][i] > 0)
									field[j + 1][i] = Math.min(field[j + 1][i],
											field[j][i] + 1);
								else
									field[j + 1][i] = field[j][i] + 1;
							}
							if (i < h - 1 && hor[j][i] == 0) {
								if (field[j][i + 1] > 0)
									field[j][i + 1] = Math.min(field[j][i + 1],
											field[j][i] + 1);
								else
									field[j][i + 1] = field[j][i] + 1;
							}
						}
					}
				if (field[w - 1][h - 1] > 0)
					break;
				if (f > w * h + 1)
					break;
			}
			System.out.println(field[w - 1][h - 1]);
		}
		sc.close();
	}
}

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

const int  maxi=5e5+10;
const int lm= 5e5+10;;
pair<int , pair<int , int>>  pr[maxi] ;
int tree[maxi] ;
int p[lm] ;
int ans[maxi] ;
void update(int idx, int val)
{
while(idx < maxi)
{
tree[idx] += val;
idx += (idx & -idx);
}
}

int read(int idx)
{
int sum = 0;
while(idx > 0)
{
sum += tree[idx];
idx -= (idx & -idx);
}
return sum;
}

int main()
{
   int n ,q;
   cin>>n;
   cin>>q;
   int a[n+1] ;
   for(int i=1;i<=n;i++)cin>>a[i];
  
   int x =1;

   for(int i=1 ; i<=q ; i++)
   {
       scanf("%d %d" , &pr[i].second.first , &pr[i].first) ;
       pr[i].second.second = i ;
   }
   sort(pr+1 , pr+q+1)  ;
   memset(tree , 0 , sizeof(tree)) ;
   memset(p , -1 , sizeof(p)) ;
   for(int i=1 ; i<=n ; i++)
   {
       if(p[a[i]]!= -1)
       update(p[a[i]] , -1)  ;
       p[a[i]] = i ;
       update(i , 1) ;


   while(x<=q && pr[x].first == i)
   {
       ans[pr[x].second.second] = read(pr[x].first) - read(pr[x].second.first-1);

       x++;

   }
   }
   for(int i=1 ;i<=q ; i++)
   printf("%d\n", ans[i]) ;
}

Measured memory_bytes: 17456