akhauriyash/Code-Regression huggingface dataset:
'''
https://atcoder.jp/contests/abc106/tasks/abc106_d
'''
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10000000)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate
    #from itertools import product
    from bisect import bisect_left,bisect_right
    import heapq
    from math import floor, ceil
    #from operator import itemgetter

    #inf = 10**17
    #mod = 1000000007

    N,M,Q = map(int, input().split())
    table = [[0]*N for _ in range(N)]
    for _ in range(M):
        l,r = map(int, input().split())
        table[l-1][r-1] += 1

    def csum_gen(h, w, table):
        d = [[0]*w for _ in range(h)]
        d[0][0] = table[0][0]
        for i in range(1, w):
            d[0][i] = d[0][i-1]+table[0][i]
        #上のマスとその行の和を足す
        for i in range(1, h):
            total = 0
            for j in range(w):
                total += table[i][j]
                d[i][j] = d[i-1][j]+total
        return d

    d = csum_gen(N, N, table)

    def csum_cal(p, q, x, y, d):
        #p<=x and q<=y
        if p>x or q>y:
            return 0
        if p==0 and q==0:
            return d[x][y]
        if p==0:
            return d[x][y] - d[x][q-1]
        if q==0:
            return d[x][y] - d[p-1][y]
        return d[x][y]-d[p-1][y]-d[x][q-1]+d[p-1][q-1]


    for _ in range(Q):
        p,q = map(int, input().split())
        print(csum_cal(p-1, p-1, q-1, q-1, d))



if __name__ == '__main__':
    main()

Measured memory_bytes: 57692
n, x = list(map(int, input().split(' ')))
L = [int(i) for i in input().split(' ')]
L.append(0)
count = 1
for i in range(n):
    L[i+1] += L[i]
    if L[i] <= x:
        count += 1
    else:
        break
print(count)

Measured memory_bytes: 3060
<?php
	fscanf(STDIN,'%d%d',$n,$m);
	for($i=0;$i<$n;$i++){
		$L=explode(' ',fgets(STDIN));
		for($j=1;$j<=$L[0];$j++){
			$c[0+$L[$j]]++;
		}
	}
	for($i=1;$i<=$m;$i++){
		$a+=$c[$i]==$n;
	}
	echo $a;


Measured memory_bytes: 3576
s = input()
mod = 2019
l = [0]*mod
l[0] = 1 #余りが0の場合が1足りないので補う
ans = 0
r = 0
t = 1

for i in s[::-1]:
    r += int(i)*t
    r %= mod # 余りをrに代入してしまっても、後の計算に支障が無い。
    l[r] += 1
    t *= 10
    t %= mod # t *= 10を使用しても、ここの余りを使用しても、r%modの答えは変わらない。

for i in l:
    ans += i*(i - 1)//2

print(ans)

Measured memory_bytes: 9180
#include <iostream>
#include <string>
#include <fstream>
#include <algorithm>
#include <cmath>
using namespace std;

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

    long sum = 0, len = s.length();
    for (long bits = 1 << (len - 1); bits < 1 << len; bits++)
    {
        long tmp = 0;
        for (long left = 0, right = 0; right <= len; right++)
        {
            if ((bits >> right) & 1)
            {
                tmp += stol(s.substr(left, right - left + 1));
                left = right + 1;
            }
        }
        sum += tmp;
    }

    cout << sum << endl;
    return 0;    
}

Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder2 {
	class Program {
		static void Main(string[] args) {

			//出力の都度更新をやめる
			var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
			Console.SetOut(sw);


			Ans();

			//更新する
			Console.Out.Flush();
			
		}
	public static void Ans() {

			var inputArray = retreiveLongArray();
			var inputCount = 1;

			// 不正な入力は処理しない
			if (inputArray.Length != inputCount) {
				Console.WriteLine("invalid input");
				return;
			}
			long N = inputArray[0];
			var numArray = retreiveLongArray();

			var delCount = new Dictionary<long, long>();

			foreach (var n in numArray) {

				if (delCount.ContainsKey(n)) {
					delCount[n]++;
				}
				else {
					delCount.Add(n, 0);
				}
			}

			var toBeDeleted = delCount.Select(x => x.Value).Sum();
			if (toBeDeleted%2!=0) {
				toBeDeleted++;
			}

			//答えの出力
			var ans = N- toBeDeleted;
			Console.WriteLine(ans);

		}

		/// <summary>
		/// スペースで区切られた文字列配列の入力を受け取る
		/// </summary>
		/// <returns></returns>
		private static string[] retreiveStringArray() {
			var inputArray = Console.ReadLine().Split(' ');
			return inputArray;
		}

		/// <summary>
		/// スペースで区切られた整数配列の入力を受け取る
		/// </summary>
		/// <returns></returns>
		private static long[] retreiveLongArray() {
			var inputArray = Console.ReadLine().Split(' ');
			var longArray = inputArray.Select(s => long.Parse(s));
			return longArray.ToArray();
		}


		/// <summary>
		/// 2組みずつの入力データ(数値)からTuppleListを作成する
		/// </summary>
		/// <param name="N"></param>
		/// <returns></returns>
		private static List<Tuple<long, long>> createLongTuppleList(long N) {
			var inpList = new List<Tuple<long, long>>();

			for (int i = 0; i < N; i++) {
				var inp = retreiveLongArray();
				var item1 = inp[0];
				var item2 = inp[1];
				inpList.Add(new Tuple<long, long>(item1, item2));
			}
			return inpList;
		}
	}
}



Measured memory_bytes: 41196
n=int(input())
p=[int(i) for i in input().split()]

mini=[p[0]]*n
for i in range(n-1):
  mini[i+1]=min(mini[i],p[i+1])
ans=1
for i in range(1,n):
  if p[i]<=mini[i-1]:
    ans+=1
print(ans)

Measured memory_bytes: 26012
k = int(input())
s = input()

l = len(s)

N = k + l + 100
MOD = 10 ** 9 + 7
fact = [0 for _ in range(N)]
invfact = [0 for _ in range(N)]
fact[0] = 1
for i in range(1, N):
    fact[i] = i * fact[i - 1] % MOD

invfact[N - 1] = pow(fact[N - 1], MOD - 2, MOD)

for i in range(N - 2, -1, -1):
    invfact[i] = invfact[i + 1] * (i + 1) % MOD
    
def nCk(n, k):
    if k < 0 or n < k:
        return 0
    else:
        return fact[n] * invfact[k] * invfact[n - k] % MOD

ex_25 = [0 for _ in range(N)]
ex_26 = [0 for _ in range(N)]
ex_25[0] = 1
ex_26[0] = 1
for i in range(1, N):
    ex_25[i] = ex_25[i - 1] * 25 % MOD
    ex_26[i] = ex_26[i - 1] * 26 % MOD

ans = 0
for i in range(k + 1):
    ans += ex_25[i] * ex_26[k - i] * nCk(i + l - 1, i)
    ans %= MOD
    
print(ans)
    

Measured memory_bytes: 248432
#include<iostream>
#include<algorithm>
using namespace std;
int alice(int x, int y, char c);
int main(){
  char a[3] = {'+','-','*'},b[3] = {'+','-','*'},c[3] = {'+','-','*'};
  int n[4];
  sort(a,a+3);
  sort(b,b+3);
  sort(c,c+3);
  while(cin >>n[0]>>n[1]>>n[2]>>n[3],n[0]||n[1]||n[2]||n[3]){
    sort(n,n+4);
    bool f = false;
    do{
      do{
	do{
	  do{
	    if(alice(alice(alice(n[0],n[1],a[0]),n[2],b[0]),n[3],c[0]) == 10){cout <<"((("<<n[0]<<" "<<a[0]<<" "<<n[1]<<")"<<" "<<b[0]<<" "<<n[2]<<")"<<" "<<c[0]<<" "<<n[3]<<")"<<endl;f = true;goto ans;}
	    if(alice(alice(n[0],n[1],a[0]),alice(n[2],n[3],c[0]),b[0]) == 10){cout <<"(("<<n[0]<<" "<<a[0]<<" "<<n[1]<<")"<<" "<<b[0]<<" "<<"("<<n[2]<<" "<<c[0]<<" "<<n[3]<<"))"<<endl;f = true;goto ans;}
	    if(alice(alice(n[0],alice(n[1],n[2],b[0]),a[0]),n[3],c[0]) == 10){cout <<"(("<<n[0]<<" "<<a[0]<<" "<<"("<<n[1]<<" "<<b[0]<<" "<<n[2]<<"))"<<" "<<c[0]<<" "<<n[3]<<")"<<endl;f = true;goto ans;}
	    if(alice(n[0],alice(alice(n[1],n[2],b[0]),n[3],c[0]),a[0]) == 10){cout <<"("<<n[0]<<" "<<a[0]<<" "<<"(("<<n[1]<<" "<<b[0]<<" "<<n[2]<<")"<<" "<<c[0]<<" "<<n[3]<<"))"<<endl;f = true;goto ans;}
	    if(alice(n[0],alice(n[1],alice(n[2],n[3],c[0]),b[0]),a[0]) == 10){cout <<"("<<n[0]<<" "<<a[0]<<" "<<"("<<n[1]<<" "<<b[0]<<" "<<"("<<n[2]<<" "<<c[0]<<" "<<n[3]<<")))"<<endl;f = true;goto ans;}
	  }while(next_permutation(c,c+3));
	}while(next_permutation(b,b+3));
      }while(next_permutation(a,a+3));
    }while(next_permutation(n,n+4));
  ans:;
    if(!f){cout <<"0"<<endl;}
  }
  return 0;
}
int alice(int x, int y, char c){
  if(c == '+'){return x+y;}
  if(c == '-'){return x-y;}
  return x*y;
}

Measured memory_bytes: 1180
#include <iostream>
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <math.h>
#define int long long
using namespace std;
signed main() {
    string S;
    int w;

    cin>>S>>w;

    for(int i=0;i<S.size();i+=w){
        cout<<S[i];
    }
}

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

int f(int x){
    int count = 0;
    for(int i = 1;i <= x;i += 2){
        if(x%i == 0){
             count++;
        }
    }

    return count;
}

int main(){
    int n,ans = 0;
    cin >> n;


    for(int i = 1;i <= n;i += 2){
        
        if(f(i) == 8){
            ans++;
        }
    }

    cout << ans << endl;
  

    return 0;
}

Measured memory_bytes: 256
#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+1; i++)
#define sort(A) sort(A.begin(),A.end())
#define reverse(A) reverse(A.begin(),A.end());

typedef long long ll;

int main(){

  ll L;
  cin >> L;
  double ans = (double)L*L*L/27;
  cout << setprecision(10) << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int a[27],b[27],c[27];
int main(){
    int n;
    cin>>n;
    for(int i=1;i<=n;++i)
        cin>>a[i];
    for(int i=1;i<=n;++i)
        cin>>b[i];
    for(int i=1;i<n;++i)
        cin>>c[i];
    int sum=0;
    for(int i=1;i<=n;++i){
        sum+=b[a[i]];
        if(a[i-1]==a[i]-1&&i>1)
            sum+=c[a[i-1]];
    }
    cout<<sum;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<vector>
#include<cctype>
#define szxb 210
#define F(a,b,c) for(register int (a)(0);(a)^((b)<<(1));(a)+=(c))
using namespace std;
int n,a[szxb];
signed main()
{
	scanf("%d",&n);int ans(0);
	F(i,n,1){scanf("%d",&a[i]);}sort(a,a+(n*2));F(i,n,2){ans+=a[i];}
	printf("%d",ans);
	return putchar(10),0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using i64 = int_fast64_t;
#define rep(i, N) for(int (i) = 0; (i) < (N); (i)++)
#define all(v) (v).begin(), (v).end()
#define eb emplace_back

int main(){
    int N, Q;
    string S;
    cin >> N >> S >> Q;
    set<int> st[26];
    for(int i = 0; i < N ; i++) st[S[i] - 'a'].insert(i);
    rep(k, Q){
        int q; cin >> q;
        if(q == 1){
            int i; char c; 
            cin >> i >> c; i--;
            if(S[i] == c) continue;

            st[S[i] - 'a'].erase(i); 
            S[i] = c;
            st[S[i] - 'a'].insert(i);
        }
        if(q == 2){
            int l, r; cin >> l >> r; l--, r--;
            int res = 0;
            for(int c = 0; c < 26; c++){
                if(st[c].size() == 0) continue; 
                auto itr = st[c].upper_bound(l-1);
                if(itr == st[c].end()) continue;
                int fst = *itr;
                //cout << fst << endl;
                if(l <= fst && fst <= r) res++;
            }
            cout << res << endl;
        }
    }
}


Measured memory_bytes: 24196
#include<bits/stdc++.h>
using namespace std;
int main ()
{
    long long n,m,i,j,k,l,s,a,b;
    cin>>n>>m;
    vector<long long>vc(n+10,0);
    for(i=0;i<m;i++)
    {
        cin>>a>>b;
        vc[a]++;
        vc[b]++;
    }
    for(i=1;i<=n;i++)
    {
        cout<<vc[i]<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define FIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define DEBUG_ARR(x, a, b) for(int i=a; i<=b; i++) cerr<<x[i]<<" "; cerr<<endl;
#define DEBUG_STR(x, a, b) for(int i=a; i<=b; i++) cerr<<x[i]; cerr<<endl;


using namespace std;

typedef long long ll;
typedef unsigned long long llu;

int main() {
	FIO;
	string s;
	cin>>s;
	if(s[2] == s[3] && s[4] == s[5]) cout<<"Yes";
	else cout<<"No";
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#define MAX 2000001
#define VMAX 10000

int main(){
    unsigned short *A,*B;
    int C[VMAX+1];
    int n,i,j;

    scanf("%d",&n);

    A = malloc(sizeof(short)*n+1);
    B = malloc(sizeof(short)*n+1);
    
    for(i=0;i<=VMAX;i++){
        C[i] = 0;
    }
    for(i=0;i<n;i++){
        scanf("%hd",&A[i+1]);
        C[A[i+1]]++;
    }
    for(i=0;i<=VMAX;i++){
        if(i==0) continue;
        C[i] = C[i] + C[i-1];
    }
    for(i=1;i<=n;i++){
        B[C[A[i]]] = A[i];
        C[A[i]]--;
    }
    for(i=1;i<=n;i++){
        if(i<n) printf("%d ",B[i]);
        else printf("%d\n",B[i]);
    }
    return 0;
}


Measured memory_bytes: 9588
# ワーシャルフロイドで解くバージョン
h, w = map(int, input().split())
INF = 10 ** 10
table = [[INF] * 10 for _ in range(10)]

for i in range(10):
    column = list(map(int, input().split()))
    for j in range(10):
        if i == j:
            continue
        table[i][j] = column[j]

wall = {}
for _ in range(h):
    for a in list(map(int, input().split())):
        if a not in wall:
            wall[a] = 1
        else:
            wall[a] += 1

for k in range(10):
    for i in range(10):
        for j in range(10):
            table[i][j] = min(table[i][j], table[i][k] + table[k][j])

ans = 0
for k, v in wall.items():
    if k != -1 and k != 1:
        ans += table[k][1] * v
print(ans)


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


int main() {
    int n; cin >> n;
    vector<ll> a(n+2,0);
    rep2(i,n+1){
        cin >> a[i];
    }
    ll sum=0;
    rep2(i,n+2){ // n+1回繰り返す。
        sum+=abs(a[i]-a[i-1]);
    }
    rep2(i,n+1){ // n回繰り返す。
        if((a[i]-a[i-1])*(a[i]-a[i+1])>0){
            cout << sum - abs(a[i]-a[i-1]) - abs(a[i]-a[i+1])+abs(a[i-1]-a[i+1]);
        }else cout << sum;
        cout << endl;
    }
}

Measured memory_bytes: 2048
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;

public class Main {

	/* --------------------------------------------------------------------
	   main
	 * -------------------------------------------------------------------- */
	public static void main(String args[]) throws Exception {

		// ----- input -----
		Input input = new Input(System.in);
		final Data l = input.readLine();
		input.close();

		// ----- main -----
		int cnt = 0;
		for(int i = Math.min(l.col[0], l.col[1]); i > 0; i--) {
			if(l.col[0] % i == 0 && l.col[1] % i == 0) {
				if(++cnt == l.col[2]) {
					System.out.println(i);
					return;
				}
			}
		}
	}

	/* --------------------------------------------------------------------
	 * inupt class
	 * -------------------------------------------------------------------- */
	static class Input {

		public BufferedReader input;

		public Input(InputStream inStream) {
			input = new BufferedReader(new InputStreamReader(inStream));
		}

		public void close() throws Exception {
			input.close();
		}

		public Data readLine() throws Exception {
			return new Data(input.readLine().split(" "));
		}
	}
	/* --------------------------------------------------------------------
	 * data class
	 * -------------------------------------------------------------------- */
	static class Data{
		public int[] col;
		public Data(String[] values) {
			col = new int[values.length];
			for(int i=0; i < values.length; i++) {
				col[i] = Integer.parseInt(values[i]);
			}
		}
	}

}

Measured memory_bytes: 21460
import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.regex : regex;
import std.container;
import std.bigint;


void main()
{
  int n, d;
  readf("%s %s\n", &n, &d);
  auto r = 2 * d + 1;
  writeln(n / r + (n % r ? 1 : 0));
}


Measured memory_bytes: 256
import math
 
 
def is_prime(n):
    global primes
    if n == 1:
        return False
 
    if n == 2:
        return True
 
    if n % 2 == 0:
        return False
 
    s = int(math.sqrt(n))
    for x in range(3, s + 1, 2):
        if n % x == 0:
            return False
    else:
        return True
 
 
N = int(input())
d = [int(input()) for _ in range(N)]
print([is_prime(x) for x in d].count(True))

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

#define mp make_pair
#define fst first
#define snd second
#define forn(i,n) for (int i = 0; i < int(n); i++)
#define forn1(i,n) for (int i = 1; i <= int(n); i++)
#define popcnt __builtin_popcount

using namespace std;

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,int> pli;
typedef pair<int,ll> pil;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;

template <typename T> T id(T b) {return b;};
template <class It> bool all(It f,It l){return std::all_of(f,l,id<bool>);}
template <class It> bool any(It f,It l){return std::any_of(f,l,id<bool>);}
template <typename T> void chmax(T &x, T y) {if (x < y) x = y;}
template <typename T> void chmin(T &x, T y) {if (x > y) x = y;}

int a,b;

int main()
{
#ifdef FASTIO
  ios_base::sync_with_stdio(false); cin.tie(nullptr);
#endif

  cin >> a >> b;

  int res;
  if (a <= 5)
    res = 0;
  else if (6 <= a && a <= 12)
    res = b/2;
  else
    res = b;

  cout << res << endl;

  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	int n,k;
	char s[100000];
	int switching[100000];
	int count=0;
	int length=0;
	int start=0;
	int countmax;
	scanf("%d",&n);
	scanf("%d",&k);
	scanf("%s",s);
	if(s[0]=='0')start=0;
	else start=1;
	count=1;
	switching[0]=0;
	for (int i=1;i<n;i++)
	{
		if((s[i-1]=='0'&&s[i]=='1')||(s[i-1]=='1'&&s[i]=='0'))
		{
			switching[count]=i;
			count++;
			//printf("%d ",i);
		}
	}
	switching[count]=n;
	for (int i=start-1;i<count;i+=2)
	{
		int ii;
		if(i==-1)ii=0;
		else ii=i;
		if(i+k*2+1>count)countmax=count;
		else countmax=i+k*2+1;
		if(length<switching[countmax]-switching[ii])length=switching[countmax]-switching[ii];
	}
	printf("%d",length);
}


Measured memory_bytes: 640
import java.util.Scanner;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Iterator;
import java.util.Collections;
import java.util.Comparator;
import java.util.Random;
import java.util.Map;
import java.util.HashMap;
 
class Main{
        public static void main(String args[]){
                Scanner sc = new Scanner(System.in);
                String s = sc.next();
                String t = sc.next();
                ArrayList<Character> S = new ArrayList<Character>();
                for(int i=0; i<s.length(); i++){
                    S.add(s.charAt(i));
                }
                ArrayList<Character> T = new ArrayList<Character>();
                for(int i=0; i<t.length(); i++){
                    T.add(t.charAt(i));
                }
                Collections.sort(S);
                Collections.sort(T,Collections.reverseOrder());
                
                boolean ch = true;
                boolean same = true;
                for(int i=0; i<Math.min(S.size(),T.size()); i++){
                    if(S.get(i)==T.get(i)){
                        same = true;
                        ch = true;
                    }else if(S.get(i)<T.get(i)){
                        same = false;
                        ch = true;
                      	break;
                    }
                    else{
                        same = false;
                        ch = false;
                        break;
                    }
                }
                
                if(ch && !same){
                    System.out.println("Yes");
                }else if(ch && same){
                    if(S.size()<T.size()){
                        System.out.println("Yes");
                    }else{
                        System.out.println("No");
                    }
                }else if(!ch){
                    System.out.println("No");
                }
        }
}

Measured memory_bytes: 23764
#include <algorithm>
#include <cassert>
#include <climits>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
// const int INF = 2000000000;
// const ll MOD = 1000000007;

const int MAX_N = 100001;
int dp[MAX_N];

int N;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> N;
  for (int i = 0; i <= N; i++) {
    dp[i] = i;
  }

  for (int c = 6; c <= N; c *= 6) {
    for (int i = 0; i <= N; i++) {
      if (c <= i) {
        dp[i] = min(dp[i], dp[i - c] + 1);
      }
    }
  }
  for (int c = 9; c <= N; c *= 9) {
    for (int i = 0; i <= N; i++) {
      if (c <= i) {
        dp[i] = min(dp[i], dp[i - c] + 1);
      }
    }
  }

  cout << dp[N] << endl;
  return 0;
}

Measured memory_bytes: 640
import numpy as np
from numba import njit

n, k = map(int, input().split())
A = np.array(list(map(int, input().split())))
F = np.array(list(map(int, input().split())))

A = np.sort(A)
F = np.sort(F)[::-1]

@njit
def is_ok(x):
    tmp = 0
    for a, f in zip(A, F):
        y = a * f
        if y > x:
            tmp += a - x // f
    return tmp <= k

ok = 10 ** 16
ng = -1
while ok - ng > 1:
    mid = (ok + ng) // 2
    if is_ok(mid):
        ok = mid
    else:
        ng = mid

print(ok)


Measured memory_bytes: 133752
parseInt(x) = parse(Int, x)
parseBigInt(x) = parse(BigInt, x)
parseFloat(x) = parse(Float64, x)
parseBigFloat(x) = parse(BigFloat, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function main()
    nC2=zeros(Int,1,2*10^5+1)
    for i in 3:2*10^5+1
        nC2[i]=(i-1)*(i-2)÷2
    end
    n=parseInt(readline())
    a=parseMap(split(readline()))
    cnt=zeros(Int,1,2*10^5)
    for i in a
        cnt[i]+=1
    end
    res=0
    for i in cnt
        res+=nC2[i+1]
    end
    for i in a
        println(res-nC2[cnt[i]+1]+nC2[cnt[i]])
    end
end
main()

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

int main() {
	int n,m;
	cin >> n >> m;
	vector<vector<int>> s(10,vector<int>(10,0));
	for(int i=0;i<m;i++)
	{
		int k;
		cin >> k;
		for(int j=0;j<k;j++)
		{
			cin >> s.at(i).at(j);
		}
	}
	vector<int> p(m,0);
	for(int i=0;i<m;i++)
	{
		cin >> p.at(i);
	}
	int ans=0;
	vector<int>b(n,0);
	for(int i=0;i<pow(2,n);i++)
	{
		int d=i;
		for(int j=0;j<n;j++)
		{
			b.at(j)=d%2;
			d/=2;
		}
		int f=0;
		for(int j=0;j<m;j++)
		{
			int sm=0;
			for(int l=0;l<n;l++)
			{
				int w=s.at(j).at(l);
				if(w>0)
				{
					sm+=b.at(w-1);
				}
			}
			if(sm%2!=p.at(j))
			{
				f++;
			}
		}
		if(f==0)
		{
			ans++;
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 4124
#include<ctime>
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<cmath> 
#include<cstring> 
#include<cassert>
#include<string>
#include<sstream>
#include<fstream>
#include<deque>
#include<queue>
#include<vector>
#include<map>
#include<list>
#include<stack>
#include<set>
#include<bitset>
#include<iomanip>
#include<utility>
#include<functional>
#include<cctype>
#include<cerrno>
#include<cfloat>
#include<ciso646>
#include<climits>
#include<clocale>
#include<complex>
#include<csetjmp>
#include<csignal>
#include<cstdarg>
#include<cstddef>
#include<cwchar>
#include<cwctype>
#include<exception>
#include<locale>
#include<numeric>
#include<new>
#include<stdexcept>
#include<limits>
using namespace std;

#define ll long long
#define INF 1e9
#define rep(i,n) for(int (i)=0;(i)<n;i++)
#define REP(i,n) for(int (i)=1;(i)<=n;i++)
#define mk(a,b) make_pair(a,b)
#define fi first
#define se second
#define pii pair<int,int>
#define sz(s) s.size()
#define all(s) (s.begin(),s.end())

const int maxn=100005;
int n,x;
int a[maxn];
ll ans;

int main(){
	scanf("%d%d",&n,&x);
	rep(i,n){
		scanf("%d",&a[i]);
		if(a[i]>x)ans+=a[i]-x,a[i]=x;
	} 
	rep(i,n-1){
		ll cur=a[i]+a[i+1];
		if(cur>x){
			ans+=cur-x;
			a[i+1]-=cur-x; 
		}
	}
	printf("%lld\n",ans);
	return 0;
} 

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

int main() {
 vector<char> a(4);
 for(int i = 0; i < 4; i++){
   cin >> a.at(i);
 }
 sort(a.begin(), a.end());
 if(a.at(0) == a.at(1) && a.at(1) != a.at(2) && a.at(2) == a.at(3)) cout << "Yes" << endl;
 else cout << "No" << endl;

}


Measured memory_bytes: 256
#include<stdio.h>

int S[1000000], n;

int binary(int key){
  int left = 0;
  int right = n;
  int mid;

  while(left < right){
    mid = (left + right) / 2;
    if(key == S[mid]) return 1;
    if(key > S[mid]) left = mid + 1;
    else if(key < S[mid]) right = mid;
  }
  return 0;
}

int main(){
  int i, q, key, sum = 0;

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

  scanf("%d",&q);
  for(i = 0; i < q; i++){
    scanf("%d",&key);
    if(binary(key)) sum++;
  }
  printf("%d\n",sum);

  return 0;
}

Measured memory_bytes: 988
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
using namespace std;
typedef long long lng;
#define FOR(i,a,b) for(int i=(a); i<=(b); ++i)
#define FORD(i,b,a) for(int i=(b); i>=(a); --i)
#define REP(i,n) FOR(i,0,n-1)
#define ALL(a) (a).begin(), (a).end()
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end()) //ATTENTION: <a> must be sorted in advance

lng power(lng b, lng n) {lng sol=1; while(n>0) {if(n&1) {sol=sol*b;} n>>=1; b*= b;} return sol;} //calculate b^n

const int MOD = 1000000007; //10^9+7


/*********** variables ************/
int H, W;
/**********************************/

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

    REP(i, W+2) cout << "#";
    cout << endl;
    REP(i, H) {
        cout << "#";
        string s;
        cin >> s;
        cout << s;
        cout << "#" << endl;
    }
    REP(i, W+2) cout << "#";
    cout << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std; typedef long double ld; typedef long long ll;
typedef unsigned long long ull;
#define MP make_pair
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define FORR(x,arr) for(auto& x:arr)
#define VI vector<int>
#define PII pair<int, int>
#define FI first 
#define SE second
#define ALL(x) (x).begin(), (x).end()
const int INF=1<<30; const ll LINF=1LL<<60 ; const ll MOD=1e9+7 ;
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; }
//-------------------
struct pa{
    ll val;
    int x,y,z;
    pa(ll v, int x, int y, int z):val(v), x(x), y(y), z(z) {}
    bool operator <(const pa& right) const {
        if(this->val < right.val) return true;
        if(this->val > right.val) return false;
        vector<int> va(3),vb(3);
        va[0] = this->x; va[1] = this->y; va[2] = this->z;
        vb[0] = right.x; vb[1] = right.y; vb[2] = right.z;
        return va < vb;
    }
};

int x,y,z,k;
const int MX = 1005;
//ll sm[MX][MX][MX];
vector<ll> a,b,c;
priority_queue<pa> pq;

int main(){

    cin >> x >> y >> z >> k;
    set<pa> s;

    FOR(i,0,x-1){
        ll m; cin >>m; a.push_back(m);
    }
    FOR(i,0,y-1){
        ll m; cin >> m; b.push_back(m);
    }
    FOR(i,0,z-1){
        ll m; cin >> m; c.push_back(m);
    }
    sort(ALL(a), greater<ll>()); sort(ALL(b),greater<ll>()); sort(ALL(c), greater<ll>());

    //sm[0][0][0] = a[0] + b[0] + c[0];
    pa now(a[0]+b[0]+c[0], 0,0,0);
    pq.push(now);
    FOR(i,1,k){
        pa cur = pq.top(); pq.pop(); 
        cout << cur.val << endl;// << cur.val << cur.x << cur.y << cur.z << endl;
        
        pa now1(a[cur.x+1] + b[cur.y] + c[cur.z],cur.x+1, cur.y, cur.z);
        pa now2(a[cur.x] + b[cur.y+1] + c[cur.z],cur.x, cur.y+1, cur.z);
        pa now3(a[cur.x] + b[cur.y] + c[cur.z+1],cur.x, cur.y, cur.z+1);
    
        if(s.find(now1)==s.end() && cur.x+1<=x-1){
            s.insert(now1);
            pq.push(now1);
        }
        if(s.find(now2)==s.end() && cur.y+1 <= y-1){
            s.insert(now2);
            pq.push(now2);
        }
        if(s.find(now3)==s.end() && cur.z+1 <=z-1){
            s.insert(now3);
            pq.push(now3);
        }
    }
    return 0;
}


Measured memory_bytes: 896
n, m = map(int, input().split())
a = list(map(int, input().split()))
ha = [i // 2 for i in a]

from fractions import gcd

# 最小公倍数
def lcm(x, y):
    return (x * y) // gcd(x, y)

# ２で割れる回数
def div2count(num):
  return (num ^ (num - 1)).bit_length() - 1

cnt = div2count(ha[0])

if not all([div2count(i) == cnt for i in ha]):
  print(0)
else:
  l = 1
  for i in ha:
    l = lcm(l, i)
  ans = (m + l) // (2 * l)
  print(ans)


Measured memory_bytes: 15060
#include<iostream>
using namespace std;
int main()
{
  int n;
  cin>>n;

  int a,b,min=100000,cnta,cntb,cnt;
  for(int i=1;i<n;i++)
  {
    cnta=i%10+(i/10)%10+(i/100)%10+(i/1000)%10+(i/10000)%10;

    b=n-i;
    cntb=b%10+(b/10)%10+(b/100)%10+(b/1000)%10+(b/10000)%10;

    cnt=cnta+cntb;
    if(cnt<min) min=cnt;
  }

  cout<<min<<endl;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;

class Program
{
    static void Main()
    {
        var sc = new Scanner();
        Enumerable.Range(1, 30)
            .Except(sc.IntArray(28))
            .Output();

        Console.ReadKey();
    }
}

static class Extensions
{
    public static IEnumerable<T> Output<T>(this IEnumerable<T> source)
    {
        foreach (var item in source)
        {
            Console.WriteLine(item);
        }
        return source;
    }

    public static T Print<T>(this T obj)
    {
        Console.WriteLine(obj);
        return obj;
    }
}

public class Scanner
{
    string[] buffer = new string[0];
    int index = 0;
    public char[] SplitChars { get; set; }
    public string String()
    {
        if (index < buffer.Length) return buffer[index++];
        string line = "";
        while (line == "") line = Console.ReadLine();
        if (line == null) return null;
        buffer = line.Split(SplitChars, StringSplitOptions.RemoveEmptyEntries);
        index = 0;
        return buffer[index++];
    }
    public string[] StringArray(int count) { return NextArray(count, x => x); }
    public void Skip(int count) { for (int i = 0; i < count; i++) String(); }
    public T Next<T>(Func<string, T> parser) { return parser(String()); }
    public T[] NextArray<T>(int count, Func<string, T> parser)
    {
        var arr = new T[count];
        for (int i = 0; i < count; i++) arr[i] = Next(parser);
        return arr;
    }
    public int Int() { return Next(int.Parse); }
    public int[] IntArray(int count) { return NextArray(count, int.Parse); }
    public double Double() { return Next(double.Parse); }
    public double[] DoubleArray(int count) { return NextArray(count, double.Parse); }
}

Measured memory_bytes: 9984
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <queue>
# include <stack>
# define MOD 1000000000+7
# define INF 1000000000
#define rep(i,rept)	for(ll i = 0; i<rept;i++)
typedef long long ll;
using namespace std;
ll counter;

int main() {
	ll a = 0, b = 0, n = 0, counter = 0, maxi = 0;
	ll A[100], B[100], bonus[100];
	ll nums[100002];
	std::string str, str2;
	cin >> n;
	rep(i, n) {
		cin >> A[i];
	}
	rep(i, n) {
		cin >> B[i];
		counter += B[i];
	}
	rep(i, n - 1) {
		cin >> bonus[i];
	}
	rep(i, n - 1) {
		if (A[i + 1] == A[i] + 1) {
			counter += bonus[A[i]-1];
		}
	}
	cout << counter << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = a; i < n; i++)
#define repr(i, a, n) for (int i = n - 1; i >= a; i--)
using namespace std;
using ll = long long;
using P = pair<int, int>;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }

const int MOD = 1000000007;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);

  int n;
  cin >> n;
  ll ans = 1;
  rep(i, 1, n + 1) ans = (ans * i) % MOD;
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <cstring> 
using namespace std;
#define fast std::ios::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
#define mpp make_pair
#define int long long int
#define F first
#define mem(a,b) memset(a,b,sizeof(a))
#define F first
#define S second
#define MOD 998244353
#define in_range(x, y, r, c) (x < r && y < c && x >= 0 && y >= 0)
#define MAXN 2000000
#define MAXI 10000000000007
 
 
signed main(){
 
    fast;
    
    #ifdef _DEBUG
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    
    int n, sum=0;
    cin>>n;
    for(int i=1;i<=n;i++){
    	if(i%3!=0&&i%5!=0)
    		sum+=i;
    }
    cout<<sum<<endl;
}

Measured memory_bytes: 3664
#include<iostream>
#include<stdio.h>
//#include <bits/stdc++.h>
#include<vector>
#include<float.h>
#include<iomanip>
#include<algorithm>
#include<string>
#include<cstring>
#include<math.h>
#include<cmath>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include <cassert>
#include <cmath>
#include<cstdint>

#define INF 1e9
#define rep(i,n)for(int i=0;(i)<(int)(n);i++)
#define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
#define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
#define vec(type,n) vector<type>(n)
#define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))
#define ALL(a)  (a).begin(),(a).end()

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using P = pair<int,ll>;

vector<int>bitSearch(int bit,int n){
    vector<int>S;
    rep(i,n)if(bit&(1<<i))S.push_back(i);
    return S;
}

ll gcd(ll a,ll b){
    if(b==0)return a;
    return gcd(b,a%b);
}




int main(){
    ll n,k;cin>>n>>k;
    ll lb = -1,ub = 1e18;
    ll mid = n/k;
    ll res;
    res = min({abs(n-k*mid),abs(n-k*(mid+1)),abs(n-k*(mid-1))});
    cout<<res;
}



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

int main()
{
	int w , h , x , y , n , i ;
	while ( 1 )
	{
		y = 1 ;
		cin >> h >> w ;
		 3 <= h , w <= 100 ;
		if ( h == 0 && w == 0 ) break ;
		for( i = 1 ; i <= w ; i ++ )
			cout << "#" ;
	cout << endl; 
	while( y < h - 1 )
	{
		cout << "#" ;
		for ( n = 1 ; n <= w - 2 ; n ++ )
			cout << "." ;
		y ++ ;
		cout << "#" << endl;
	}
		for ( x = 1 ; x <= w ; x ++ )
			cout << "#" ;
		cout << endl;
		cout << endl;
}
}

Measured memory_bytes: 1152
def gcd(a,b):
    while b != 0:
        tmp = a % b
        a = b
        b = tmp
    return a
            


k = int(input())

count =0
for a in range(1,k+1):
    for b in range(a,k+1):
        for c in range(b ,k+1):
            if a == b:
                if b ==c:
                    count += c
                else:
                    count +=3*gcd(b,c)
            else:
                if b == c:
                    count += 3*gcd(a,b)
                else:
                    tmp = gcd(b,c)
                    count += 6*gcd(a,tmp)


print(count)
    
        



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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG2(x,y) cout<<#x<<": "<<x<<" "<<#y<<": "<<y<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define DEBUG_ARR(v,n) cout<<#v<<":";REP(i,n)cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

int main() {
    ios::sync_with_stdio(false); cin.tie(0);
    string s;
    cin>>s;
    string ans="";
    if(s=="ABC") ans = "ARC";
    else if(s=="ARC") ans = "ABC";
    cout << ans << endl;
    return 0;
}

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

int main(){
  int N, M, Q;
  cin >> N >> M >> Q;
  vector<int> A(Q), B(Q), C(Q), D(Q);
  for(int i=0; i<Q; i++){
    cin >> A.at(i) >> B.at(i) >> C.at(i) >> D.at(i);
  }
  vector<int> T(10);
  int Ans=0;
  int subans=0;
  for(int i0=1; i0<=M; i0++){
    for(int i1=i0; i1<=M; i1++){
      for(int i2=i1; i2<=M; i2++){
        for(int i3=i2; i3<=M; i3++){
          for(int i4=i3; i4<=M; i4++){
            for(int i5=i4; i5<=M; i5++){
              for(int i6=i5; i6<=M; i6++){
                for(int i7=i6; i7<=M; i7++){
                  for(int i8=i7; i8<=M; i8++){
                    for(int i9=i8; i9<=M; i9++){
                      subans=0;
                      T={i0, i1, i2, i3, i4, i5, i6, i7, i8, i9};
                      vector<int> S(N);
                      for(int i=0; i<N; i++){
                        S.at(i)=T.at(i);
                      }
                      for(int i=0; i<Q; i++){
                        if(S.at(B.at(i)-1)-S.at(A.at(i)-1)==C.at(i)){
                          subans+=D.at(i);
                        }
                      }
                      Ans=max(Ans, subans);
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
  cout << Ans << endl;
}

Measured memory_bytes: 3648
//by (111110101)2
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<vector>
#include<deque>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<algorithm>
#include<functional>
#include<utility>
#include<bitset>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<cstdio>
using namespace std;
int n,sum,a,b;
int main()
{
	cin>>a>>n;
	for(int i=0;i<n;i++)
	{
		cin>>b;
		sum+=b;
	}
	if(sum>=a)
	{
		cout<<"Yes"<<endl;
	}
	else
	{
		cout<<"No"<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AtCoder
{
	class Program
	{
		static void Main(string[] args)
		{
			var firstLine = Console.ReadLine().Split(' ').Select(value => int.Parse(value)).ToList();
			var a = firstLine[0];
			var b = firstLine[1];
			var c = firstLine[2];
			var x = firstLine[3];
			var y = firstLine[4];

			var min = a * x + b * y;

			for(var i = 2; i <= Math.Max(x, y) * 2 + 1; i += 2)
			{
				min = Math.Min(min, a * Math.Max(0, (x - (i / 2))) + b * Math.Max(0, (y - (i / 2))) + c * i);
			}
			
			Console.WriteLine(min);
		}
	}
}


Measured memory_bytes: 13268
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <cassert>
using namespace std;
typedef long long ll;

#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
#define FOR(i, k, n) for (int i = (k); i < (int)(n); ++i)
#define FOREQ(i, k, n) for (int i = (k); i <= (int)(n); ++i)
#define FORIT(i, c) for (__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)

#define SZ(v) (int)((v).size())
#define MEMSET(v, h) memset((v), (h), sizeof(v))
#define FIND(m, w) ((m).find(w) != (m).end())

int HPini, HPmax;
int width, height;
char field[110][110];
int trap[300];
int mapto[300];
const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };
int dir[1010];
int potion[20];
int dp[1 << 12];

int main() {
    mapto[(int)'R'] = 0;
    mapto[(int)'D'] = 1;
    mapto[(int)'L'] = 2;
    mapto[(int)'U'] = 3;
    while (scanf("%d %d", &HPini, &HPmax), HPini|HPmax) {
        scanf("%d %d", &height, &width);
        REP(y, height) {
            REP(x, width) {
                scanf(" %c ", &field[y][x]);
            }
        }
        int t;
        scanf("%d", &t);
        REP(i, t) {
            char c;
            int d;
            scanf(" %c %d ", &c, &d);
            trap[(int)c] = d;
        }
        int s;
        scanf("%d", &s);
        int m = 0;
        REP(i, s) {
            char d;
            int n;
            scanf(" %c %d ", &d, &n);
            REP(i, n) {
                dir[m++] = mapto[(int)d];
            }
        }
        int p;
        scanf("%d", &p);
        REP(i, p) {
            scanf("%d", &potion[i]);
        }
        MEMSET(dp, 0xfe);
        int x = 0;
        int y = 0;
        dp[0] = HPini;
        REP(iter1, m) {
            REP(i, p) {
                REP(P, 1 << p) {
                    if ((P >> i) & 1) { continue; }
                    dp[P | (1 << i)] = min(HPmax, max(dp[P | (1 << i)], dp[P] + potion[i]));
                }
            }
            x += dx[dir[iter1]];
            y += dy[dir[iter1]];
            REP(P, 1 << p) {
                dp[P] -= trap[(int)field[y][x]];
                if (dp[P] <= 0) { dp[P] = -1000000000; }
            }
        }
        if (dp[(1 << p) - 1] > 0) {
            puts("YES");
        } else {
            puts("NO");
        }
    }
}

Measured memory_bytes: 888
S = input()
counter = []
for i in range(0, 26):
	counter.append(0)
for i in range(0, len(S)):
	counter[ord(S[i])-97] += 1
ans = 'Yes'
for i in range(0, 26):
	if counter[i]%2 != 0:
		ans = 'No'
		break
print(ans)

Measured memory_bytes: 38384
import sys
n,m=map(int,input().split())
ans=[0]*n
for _ in range(m):
    s,c=map(int,input().split())
    if ans[s-1]!=0 and ans[s-1]!=c:
        print(-1)
        sys.exit()
    if s==1 and c==0 and n!=1:
        print(-1)
        sys.exit()
    ans[s-1]=c
if ans[0]==0 and n!=1:
    ans[0]=1
num=0
for i in range(n):
    num+=ans[i]*(10**(n-i-1))
print(num)

Measured memory_bytes: 9220
N,M=map(int,input().split())
H=list(map(int,input().split()))
ans=[1]*N
for _ in range(M):
    A,B=map(int,input().split())
    if H[A-1]<=H[B-1]:
        ans[A-1]=0
    if H[B-1]<=H[A-1]:
        ans[B-1]=0
print(sum(ans))

Measured memory_bytes: 20100
#include <stdio.h>
int N, T, c, t, cost = 10000;

int main()
{
    scanf("%d%d", &N, &T);

    for (int i = 0; i < N; i++)
    {
        scanf("%d%d", &c, &t);
        if (t <= T && c < cost) cost = c;
    }
    if (cost < 10000) printf("%d", cost);
    else puts("TLE");
}


Measured memory_bytes: 128
#include<iostream>
#include<vector>
#include<cstdio>
#include<string>
#include<cmath>
#include<math.h>
#include<algorithm>
#include<string.h>
#include <iomanip>
#include <sstream>
using namespace std;

int main() {
  int N, M;
  int ans = 0;
  string s;

  cin >> N;

  ans = N/2;
  if(N%2 ==1) ans++;
  cout << ans << endl;
}


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

using ll = long long;
using pll = pair<ll, ll>;
using pii = pair<int, int>;
using pli = pair<ll, int>;

#define fi first
#define se second
#define pb push_back
#define sz(a) (int) ((a).size())
#define testcase int _; cin>>_; while (_--)
#define fast ios_base::sync_with_stdio(0); cin.tie(0);
#define all(x) (x).begin(), (x).end()


/*B - Product Max*/
void Solve() {
	ll a, b, c, d;	cin >> a >> b >> c >> d;
	cout << max({a * c, a * d, b * c, b * d});
}

int main() {
	fast
	//testcase
		Solve();
	return 0;
}

Measured memory_bytes: 3648
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<queue>

using namespace std;

inline int read()
{
  int x=0,f=1;char ch=getchar();
  while (!isdigit(ch)) {if (ch=='-') f=-1;ch=getchar();}
  while (isdigit(ch)) {x=(x<<1)+(x<<3)+ch-'0';ch=getchar();}
  return x*f;
}

const int maxn = 1e6+1e2;

struct Node{
	int val,num;
};
int a[maxn];
int n;
int ans[maxn];
int sum[maxn],sum1[maxn];
Node b[maxn],c[maxn];
int tmp1,tmp2;

bool cmp(Node a,Node b)
{
	return a.num>b.num;
}
int main()
{
  n=read();
  for (int i=1;i<=n;i++) a[i]=read();
  for (int i=1;i<=n;i+=2) sum[a[i]]++;
  for (int i=1;i<=100000;i++) if (sum[i]!=0) b[++tmp1].val=i,b[tmp1].num=sum[i];
  for (int i=2;i<=n;i+=2) sum1[a[i]]++;
  for (int i=1;i<=100000;i++) if (sum1[i]!=0) c[++tmp2].val=i,c[tmp2].num=sum1[i];
  sort(b+1,b+1+tmp1,cmp);
  sort(c+1,c+1+tmp2,cmp);
  if (b[1].val!=c[1].val) cout<<(n-(b[1].num+c[1].num));
  else
  {
  	 cout<<min(n-(b[1].num+c[2].num),n-(b[2].num+c[1].num));
  }
  return 0;
}


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

using namespace std;

int main()
{
  int H, W; cin >> H >> W;
  vector<vector<char>> a(H+2, vector<char>(W+2, '#'));
  for (int i = 1; i < H+1; ++i) {
    for (int j = 1; j < W+1; ++j) {
      cin >> a[i][j];
    }
  }

  for (int i = 0; i < H+2; ++i) {
    for (int j = 0; j < W+2; ++j) {
      cout << a[i][j];
    }
    cout << endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int INF = (1LL << 30) - 1;
int MOD = 1e9+7;
struct UnionFind {
    vector<int> par;
    
    UnionFind(int n) : par(n, -1) {}
    void init(int n) { par.assign(n, -1);}
    
    int root(int x) {
        if (par[x] < 0) return x;
        else return par[x] = root(par[x]);
    }
    
    bool issame(int x, int y) {
        return root(x) == root(y);
    }
    
    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (par[x] > par[y]) swap(x, y); // merge technique
        par[x] += par[y];
        par[y] = x;
        return true;
    }
    
    int size(int x) {
        return -par[root(x)];
    }
};
vector<int> X[100010], Y[100010];
set<int> setX[100010], setY[100010];

main(){
    ll N;
    cin >> N;
    vector<P> V(N);
    rep(i,0,N){
        cin >> V[i].first >> V[i].second;
        V[i].first--, V[i].second--;
        X[V[i].first].push_back(i);
        Y[V[i].second].push_back(i);
    }

    UnionFind uf(N+1);
    rep(i,0,100000){
        for(auto j:X[i]){
            uf.merge(X[i][0], j);
        }
        for(auto j:Y[i]){
            uf.merge(Y[i][0], j);
        }
    }
    rep(i,0,N){
        int idx = uf.root(i);
        int x = V[i].first, y = V[i].second;
        setX[idx].insert(x);
        setY[idx].insert(y);
    }

    /*
    rep(i,0,N){
        cout << i << " " << uf.root(i) << endl;
    }
    */
    ll ans = 0;
    rep(i,0,N){
        int idx = uf.root(i);
        if(i != uf.root(i))continue;
        
        ll size = uf.size(i);
        ll xsize = setX[idx].size(), ysize = setY[idx].size();
        ans += (xsize * ysize) - size;
    }
    cout << ans << endl;
}

Measured memory_bytes: 23296
#include <stdio.h>
#include <string.h>
#include <ctype.h>
int main(void){
    char code[100];
    int i,length;
        
    while(gets(code) != '\0'){
        length = strlen(code);
        
        for(i=0;i<length;i++){
            code[i]=tolower(code[i]);
        }
        
        while(strstr(code,"the")=='\0' && strstr(code,"this")=='\0' && strstr(code,"that") == '\0'){
            for(i=0;i<length;i++){
                if(code[i]>'z' || code[i]<'a') continue;
                code[i]++;
                if(code[i]>'z'){
                    code[i]+='a'-'z'-1;
                }
            }
        }
        
        puts(code);
    }
    return 0;
    
}

Measured memory_bytes: 524
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
# include <numeric>
#include <tuple>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
constexpr long long MOD = 1000000000 + 7;
constexpr int INF = 2000000000;
constexpr int HINF = INF / 2;
constexpr double DINF = 100000000000000000.0;
constexpr long long LINF = 9223372036854775807;
constexpr long long HLINF = 4500000000000000000;
const double PI = acos(-1);



int main() {
	int r, g;
	cin >> r >> g;
	cout << r + (g - r) * 2 << endl;
}

Measured memory_bytes: 256
S = input()
num1 = int(S[:2])
num2 = int(S[2:])

if 1 <= num1 <= 12 and 1 <=  num2 <= 12:
    ans = "AMBIGUOUS"
elif 1 <= num1 <= 12 and (num2 == 0 or 12 < num2):
    ans = "MMYY"
elif (num1 == 0 or 12 < num1) and 1 <=  num2 <= 12:
    ans = "YYMM"
else:
    ans = "NA"
print(ans)


Measured memory_bytes: 9172