akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define MOD 1000000007
#define INF 1001001001
#define LINF 1001001001001001001
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define bit(n) (1LL<<(n))
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> LLP;

int main() {
  
  vector<string> c(3);
  rep(i,3) cin >> c[i];

  cout << c[0][0] << c[1][1] << c[2][2] << endl;

  return 0;
}

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

using namespace std;

int main(){

int n,m;

cin>>n>>m;

string str;

vector<string>iso;

for(int i=0;i<n;i++){

  cin>>str;

  iso.push_back(str);

}

sort(iso.begin(),iso.end());

for(int i=0;i<iso.size();i++){

 cout<<iso[i];

}

return 0;

}

Measured memory_bytes: 256
s=list(input())
t=list(input())
flag=False
ata=0
for i in range(len(s)-len(t)+1):
  if flag==True:
    break
  for j in range(len(t)):
    if s[len(s)-1-(i+j)]!="?" and s[len(s)-1-(i+j)]!=t[len(t)-1-j]:
      break
    if j==(len(t)-1):
      flag=True
      ata=i
if flag==True:
  for i in range(len(t)):
    s[len(s)-1-(ata+i)]=t[len(t)-1-i]
  for i in range(len(s)):
    if s[i]=="?":
      s[i]="a"
  print("".join(s))
else:
  print("UNRESTORABLE")

Measured memory_bytes: 3188
// inputに入力データ全体が入る
function Main(input) {
	// 1行目がinput[0], 2行目がinput[1], …に入る
	input = input.split("\n");
	tmp = input[1].split(" ");
	//文字列から10進数に変換するときはparseIntを使います
	var n = parseInt(input[0], 10);
	var a = input[1].split(" ");
	var money = 1000;
	var kabu = 0;
	var rate;
	var nextrate;
	for (let i = 0; i < n; i++) {
		rate = parseInt(a[i], 10);
		// 最終はレートを0にして強制売却
		if (i == n - 1) {
			nextrate = 0;
		} else {
			nextrate = parseInt(a[i + 1], 10);
		}

		// 次が高ければ購入
		if (rate < nextrate) {
			kabu += Math.floor(money / rate);
			money = money % rate;

		// 次が安ければ売却
		} else {
			money += kabu * rate;
			kabu = 0;
		}
	}
	//出力
	console.log('%d', money);
}

// 実行 ファイル名により本番かどうか判断
if (__filename.match("Main.js$")) {
	Main(require("fs").readFileSync("/dev/stdin", "utf8"));
} else {
//	Main("3\n4 5\nhello\n");
	Main(require("fs").readFileSync("q4.txt", "utf8"));
}


Measured memory_bytes: 29684
import sys
from collections import Counter
input = sys.stdin.readline


def readstr():
    return input().strip()


def readint():
    return int(input())


def readnums():
    return map(int, input().split())


def readstrs():
    return input().split()


N = readint()
A = list(readnums())

L = [i + x for i, x in enumerate(A)]
R = [i - x for i, x in enumerate(A)]

l_c = Counter(L)
r_c = Counter(R)

x1 = min(max(L), max(R))
x2 = max(min(L), min(R))

ans = 0
for i in range(x2, x1 + 1):
    ans += l_c[i] * r_c[i]

print(ans)


Measured memory_bytes: 63428
#include <bits/stdc++.h>
using namespace std;
int m[222][222];
bool f(int x, int y){
    if(m[x][y]==-1){
        m[x][y]=0;
        for(int i=2;i<=x;i+=2){
            if(!f(x-i,y+i/2)){
                return (m[x][y]=1);
            }
        }
        for(int i=2;i<=y;i+=2){
            if(!f(x+i/2,y-i)){
                return (m[x][y]=1);
            }
        }
    }
    return m[x][y];
}
int main(){
    long long A,B;
    cin>>A>>B;
    if(abs(A-B)>1) cout<<"Alice";
    else cout<<"Brown";
    return 0;
}


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

namespace DPL_1_B
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] x = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int[] dp = new int[x[1] + 1];
            for (int i = 0; i < x[0]; i++)
            {
                int[] a = Console.ReadLine().Split().Select(int.Parse).ToArray();
                for (int j = x[1]; j >= a[1]; j--)
                {
                    dp[j] = Math.Max(dp[j],dp[j - a[1]] + a[0]);
                }
            }
            Console.WriteLine(dp[x[1]]);
        }
    }
}


Measured memory_bytes: 9680
/* Hello darkness my old friend, I've come to visit you again! */

#include<bits/stdc++.h>
#define lli long long int
#define FOR(i,a,b) for(i=a;i<b;i++)
#define FORB(i,b,a) for(i=b;i>=a;i--)
#define mod 1000000007
#define PI 2*acos(0.0)
#define gs getline(cin,s)
#define pii pair<int,int>
#define pli pair<long long int,int>
#define pil pair<int,long long int>
#define pll pair<long long int,long long int>
#define pb push_back
#define eb emplace_back
#define mem(a,b) memset(a,b,sizeof(a))
#define inf 1000000005
#define INF 1000000000000000005
#define io ios_base::sync_with_stdio(0);
#define ff first
#define ss second
using namespace std;
int sum(int x)
{
    int s=0;
    while(x)
    {
        s+=x%10;
        x/=10;
    }
    return s;
}
int main()
{
    io;
    cin.tie(0);
    cout.tie(0);
    int n,i,mn=inf;
    cin>>n;
    FOR(i,1,n)
    {
        int j=n-i;
        mn=min(mn,sum(i)+sum(j));
    }
    cout<<mn;
    return 0;
}

/* This is the end, beautiful friend! */


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <set>
#include <map>
#include <string>

using namespace std;
typedef long long ll;
#define rep(i,s,n)for(ll i = s;i<n;i++)
#define repe(i,s,n)for(ll i = s;i<=n;i++)

/*template*/
ll t[100001] = {};
ll x[100001] = {};
ll y[100001] = {};
int main() {
	ll N; cin >> N;

	repe(i, 1, N) {
		cin >> t[i] >> x[i] >> y[i];
		ll d = abs(x[i] - x[i - 1]) + abs(y[i] - y[i - 1]);
		ll T = t[i] - t[i - 1];
		if (d > T || (T - d) % 2 != 0) {
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 2560
#include "iostream"
using namespace std;
int main(){
    int a,b,c,cnt=0;
    cin>>a>>b>>c;
    int i=0;
    while(cnt<c){
        i++;
        cnt+=a;
        if(i%7==0){
            cnt+=b;
        }
    }
    cout<<i<<endl;
}


Measured memory_bytes: 3112
/* cpp file
 * kanzo
 * @2020
 * */
#include<bits/stdc++.h>
#include "string"
using namespace std;

#define boost ios::sync_with_stdio(false);cin.tie(nullptr)
#define pi pair<int,int>

int main()
{
		boost;
		int D=0,T=0,S=0;
		cin >> D >> T >> S;
		
		if(((float)(D)/(float)(T)) <= float(S))
			cout << "Yes";
		else
			cout << "No";		
		return 0;
}




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

int main()
{
    int n,k,x,y;
    cin>>n>>k>>x>>y;
    int sum = 0;
    if(n>k)
    {
        sum = (n-k)*y+k*x;
    }
    else
    {
        sum = n*x;
    }
    cout<<sum<<endl;
    return 0;
}

Measured memory_bytes: 256
N, A, B, C = map(int, input().split())
l = [int(input()) for _ in range(N)]
INF = float('inf')


def dfs(cue, a, b, c):
    if cue == N:
        if min(a, b, c) > 0:  # 全てに竹を使用している場合
            return abs(a - A) + abs(b - B) + abs(c - C) - 30
        else:  # 作られていない竹がある場合
            return INF
    ret0 = dfs(cue + 1, a, b, c)  # 使用しない
    ret1 = dfs(cue + 1, a + l[cue], b, c) + 10  # aに使う
    ret2 = dfs(cue + 1, a, b + l[cue], c) + 10  # bに使う
    ret3 = dfs(cue + 1, a, b, c + l[cue]) + 10  # cに使う
    return min(ret0, ret1, ret2, ret3)


ans = dfs(0, 0, 0, 0)
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;

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

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

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

  int ans = INF;
  rep(i, N) {
    int temp = 0;

    while (A[i] % 2 != 1) {
      temp++;
      A[i] /= 2;
    }
    chmin(ans, temp);
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
fun main(args: Array<String>) {
  var (A, B, C, K) = readInts()
  if (A >= K) {
    println(K)
    return
  }
  K -= A
  if (B >= K) {
    println(A)
    return
  }
  K -= B
  println(A - K)
}

fun readString() = readLine()!!
fun readStrings() = readString().split(" ")
fun readInt() = readString().toInt()
fun readLong() = readString().toLong()
fun readInts() = readStrings().map { it.toInt() }
fun readLongs() = readStrings().map { it.toLong() }


Measured memory_bytes: 36448
n = int(input())

if n < 105:
    print(0)
    exit()

ans = 0
for i in range(105, n + 1, 2):
    count = 0
    for j in range(1, i + 1):
        if i % j == 0:
            count += 1
    
    if count == 8:
        ans += 1
print(ans)

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

    class Program
    {
        static void Main(string[] args)
        {
            int[] input = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
            Console.WriteLine(input[0] * input[1] / 2);

            Console.ReadKey();
        }
    }

Measured memory_bytes: 13396
import java.util.*;

import static java.lang.System.*;

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

        int[] s = new int[N];
        for (int i = 0; i < N; i++) {
            s[i] = sc.nextInt();
        }

        int sum = 0;
        for (int i = 0; i < N; i++) {
            sum += s[i];
        }

        Arrays.sort(s);
        int i = 0;
        while (sum % 10 == 0) {
            // 全て10の倍数
            if(i >= s.length){
                sum = 0;
                break;
            }

            if (s[i] % 10 != 0) {
                sum -= s[i];
            }
            i++;
        }

        out.println(sum);
    }
}

Measured memory_bytes: 23252
#include <bits/stdc++.h>
#define IO(i, o) freopen(i, "r", stdin), freopen(o, "w", stdout)
#define MOD 1000000007

using namespace std;
int W, A, B, D;

int main(void){
	//IO("test.in", "test.out");
	scanf("%d%d%d", &W, &A, &B);
	D = min(abs(B + W - A), abs(A + W - B));
	if(abs(A - B) < D) D = abs(A - B);
	if((B >= A && B <= A + W) || (B + W >= A && B + W <= A + W)) D = 0;
	printf("%d\n", D);
}

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

using namespace std;
const int MAXN = 10;
const int INF = 1e9;

int n, A, B, C;
int l[MAXN];

int dfs(int cur, int a, int b, int c) {
  if (cur == n) {
    if (a > 0 && b > 0 && c > 0) {
      return abs(A - a) + abs(B - b) + abs(C - c) - 30;
    } else {
      return INF;
    }
  }
  int useA = dfs(cur+1, a + l[cur], b, c) + 10;
  int useB = dfs(cur+1, a, b + l[cur], c) + 10;
  int useC = dfs(cur+1, a, b, c + l[cur]) + 10;
  int notUse = dfs(cur+1, a, b, c);
  return min(useA, min(useB, min(useC, notUse)));
}

void solve() {
  cout << dfs(0, 0, 0, 0) << endl;
}

int main() {
  cin >> n >> A >> B >> C;
  for (int i=0;i<n;i++) {
    cin >> l[i];
  }
  solve();
}


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

using namespace std;

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

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

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

#define CHMIN(a, b) a=min((a), (b))
#define CHMAX(a, b) a=max((a), (b))

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

const double EPS=1e-11;
#define EQ0(x) (abs((x))<EPS)
#define EQ(a, b) (abs((a)-(b))<EPS)

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n, m;
	cin>>n>>m;
	pii ba[114514];
	REP(i, m){
		cin>>ba[i].second>>ba[i].first;
		--ba[i].first;
		--ba[i].second;
	}
	sort(ba, ba+m);
	int ans=0, cut=-1;
	REP(i, m){
		if(ba[i].second>cut){
			++ans;
			cut=ba[i].first-1;
		}
	}
	cout<<ans<<'\n';
	return 0;
}


Measured memory_bytes: 1152
// Problem : C - Multiplication 3
// Contest : AtCoder - AtCoder Beginner Contest 169
// URL : https://atcoder.jp/contests/abc169/tasks/abc169_c
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
#define int long long
#define fastio                      \
  ios_base::sync_with_stdio(false); \
  cin.tie(0);                       \
  cout.tie(0);
#define sz(a) int((a).size())
#define pb push_back
#define mp make_pair
#define db1(x) cout << #x << "=" << x << endl
#define db2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define db3(x, y, z)                                                       \
  cout << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z \
       << endl
#define dbp(x) \
  cout << #x << "= {" << (x.first) << ", " << (x.second) << "}" << endl;
#define dbv(v)                         \
  {                                    \
    cout << #v << " : ";               \
    for (auto x : v) cout << x << ' '; \
    cout << endl;                      \
  }
#define rep(i, a, b) for (int i = a; i <= b; i++)
#define rep2(i, a, b) for (int i = a; i >= b; i--)
#define die(x) return cout << x << '\n', 0;

using namespace std;

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

int32_t main() {
  fastio;

  int testcases;
  testcases = 1;
  // cin>>testcases;

  while (testcases--) {
    int a;
    string t;
    int b;
    cin >> a;

    cin >> t;
    if (t.length() > 1) t.erase(t.begin() + 1);
    stringstream ss;
    ss << t;
    ss >> b;
    // db1(b);
    cout << (a * b) / 100;
  }

  return 0;
}


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

const int maxn=1e5+10,mod=1e9+7;
int n,sum[maxn],dp[maxn],last[3]={0,-1,-1};
char s[maxn];

int main(){
	cin>>(s+1);
	n=strlen(s+1);
	for(int i=2;i<=n;++i)
		if(s[i-1]==s[i])
			goto dy;
	puts("1");
	return 0;
dy:
	dp[0]=1;
	for(int i=1;i<=n;++i){
		sum[i]=sum[i-1]+(s[i]=='a'?1:2);
		if(sum[i]%3==0&&i<n)
			dp[i]=1;
		for(int j=1;j<=2;++j){
			int x=last[(sum[i]+3-j)%3];
			if(~x)
				(dp[i]+=dp[x])%=mod;
		}
		last[sum[i]%3]=i;
	}
	cout<<dp[n]<<endl;
	return 0;
}

Measured memory_bytes: 1152
//
//  main.cpp
//  vjudge
//
//  Created by Sudipto Mondal on 7/9/20.
//  Copyright © 2020 Sudipto Mondal. All rights reserved.
//

#include <iostream>
using namespace std;
int main(int argc, const char * argv[]) {
    long long int a,b,t;
    cin>>a>>b;
    t=(a*3)+b;
    if(t<2){
        cout<<0<<endl;
    }else {
        cout<<t/2<<endl;
    }
    return 0;
}


Measured memory_bytes: 3192
#include <stdio.h>

long A[100][100];
long B[100][100];
long C[100][100];
int n,m,l;
int i,j,k;

main(){
	scanf("%d %d %d",&n,&m,&l);
	for(i=0; i<n; i++){
		for(j=0 ; j <m; j++){
			scanf("%ld",&A[i][j]);
		}
	}
	for(i=0; i<m; i++){
		for(j=0; j<l; j++){
			scanf("%ld",&B[i][j]);
		}
	}
	for(i=0; i<n; i++){
		for(j=0 ; j <l; j++){
			C[i][j]=0;
			for(k=0;k<m;k++){
				C[i][j] += A[i][k]*B[k][j];
			}
		}
	}
	for(i=0; i<n; i++){
		for(j=0 ; j <l; j++){
			if(j){
			printf(" ");
			}
			printf("%ld",C[i][j]);
		}
		printf("\n");
	}
	return 0;
}
	
	
	
	
	

Measured memory_bytes: 832
#include<bits/stdc++.h>
#define rep(i,s,n) for(int i = s;i<n;i++)
#define long long ll
using namespace std;
struct Num{
    int no;
    int num;
};
int cmp(Num a,Num b){
    return a.num<b.num;
}
int main()
{

    int n;
    while(cin>>n){
        Num a[n];
        Num b[n];
        rep(i,0,n){
            int num;
            cin>>num;
            a[i].num = num;
            a[i].no = i;
        }
        sort(a,a+n,cmp);
        rep(i,0,n) {
            b[i].no  = i;
            b[i].num = a[i].no;
        }
        sort(b,b+n,cmp);
        rep(i,0,n){
            int t = (n)/2;
            int n = b[i].no;
            if(n<t){
                cout<<a[t].num<<endl;
            }else{
                cout<<a[t-1].num<<endl;
            }
        }
    }
}


Measured memory_bytes: 5376
import java.util.*;
 
public class Main{
	public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        int ans = 0;
        int cnt = 0;
        for(int i=0; i<s.length(); i++){
            char c = s.charAt(i);
            if(c=='A'||c=='C'||c=='G'||c=='T'){
                cnt++;
            }else{
                ans = Math.max(ans,cnt);
                cnt = 0;
            }
        }
        ans = Math.max(ans,cnt);
        System.out.println(ans);
    }
}


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

long long int choice(long long int n){
if(n>=1)return n*(n-1)/2;
else return 0;
}

int main(){
   long long int N;
   cin >> N;
   vector<long long int> vec(N+1,0);
   long long int count[N];
   for(int i=1;i<N+1;i++){count[i]=0
   ;}
   for(int i=1;i<N+1;i++){cin>>vec[i];
   count[vec[i]]++
   ;}

   long long int Sum=0;
   for(int i=1;i<N+1;i++){Sum+=choice(count[i])
   ;}
   for(int i=1;i<N+1;i++){
    cout<<Sum-choice(count[vec[i]])+choice(count[vec[i]]-1)<<endl
  ;}
   
}

Measured memory_bytes: 5760
#include<iostream>
#include<string>
using namespace std;
int main()
{
	int k;
	string s;
	cin>>k;
	cin>>s;
	int len=s.size();
	if(len<=k)cout<<s<<endl;
	else
	{
		for(int i=0;i<=k-1;i++)cout<<s[i];
		cout<<"..."<<endl;
	}
	return 0;
}


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

int main() {
  int x;
  cin >> x;
  
  int tmp = 0;
  for (int k = 1; k > 0; k++) {
    tmp = x * k;
    
    if (tmp % 360 == 0) {
      tmp = k;
      break;
    }
  }
  
  cout << tmp << endl;
}

Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
int main(){
	int a,b,c;
    cin>>a>>b>>c;
	if (max({a,b,c})==(a+b+c)-max({a,b,c})) cout<<"Yes"<<endl;
  	else cout<<"No"<<endl;
  return 0;
}


Measured memory_bytes: 256
s = gets.chomp
ans = Array.new(s.size,0)
n = s.size
cnt_r = 0
cnt_l = 0
n.times do |i|
  if s[i] == "R"
    cnt_r += 1
  else
    ans[i] += cnt_r/2
    ans[i-1] += (cnt_r+1)/2
    cnt_r = 0
  end
end

n.times do |i|
  j = n - i - 1
  if s[j] == "L"
    cnt_l += 1
  else
    ans[j] += cnt_l/2
    ans[j+1] += (cnt_l+1)/2
    cnt_l = 0
  end
end

puts ans.join(" ")

Measured memory_bytes: 3196
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=0
for i in range(n):
    if b[i]<=a[i]:
        c+=b[i]
    else:
        c+=a[i]+min(a[i+1],b[i]-a[i])
        a[i+1]=max(a[i+1]-b[i]+a[i],0)
print(c)

Measured memory_bytes: 18624
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(long i = 0; i < n; i++)
#define erep(i, n) for(long i = 1; i <= n; i++)
const long MOD = 1000000007;

int main() {long N, K;
cin >> N >> K;
long ans;
ans = K * pow(K - 1, N - 1);



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



Measured memory_bytes: 256
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] d = new int[n];
		for(int i = 0 ; i < n ; i++) d[i] = sc.nextInt();
		int m = sc.nextInt();
		int[] t = new int[m];
		for(int i = 0 ; i < m ; i++) {
			t[i] = sc.nextInt();
		}
		Map<Integer, Integer> mpa = new HashMap<>();
		Map<Integer, Integer> mpb = new HashMap<>();
		for(int i = 0 ; i < n ; i++) {
			if(!mpa.containsKey(d[i])) {
				mpa.put(d[i], 1);
			} else {
				mpa.put(d[i], mpa.get(d[i]) + 1);
			}
		}
		for(int i = 0 ; i < m ; i++) {
			if(!mpb.containsKey(t[i])) {
				mpb.put(t[i], 1);
			} else {
				mpb.put(t[i], mpb.get(t[i]) + 1);
			}
		}
		for(int i = 0 ; i < m ; i++) {
			if(!mpa.containsKey(t[i]) || mpa.get(t[i]) < mpb.get(t[i])) {
				System.out.println("NO");
				return;
			} else {
				mpa.put(t[i], mpa.get(t[i]) - 1);
				mpb.put(t[i], mpb.get(t[i]) - 1);
			}
		}
		System.out.println("YES");
	}
}


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

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

using ll = long long;
using lb = long double;
using P = pair<ll,ll>;
using graph = vector<vector<ll>>;

const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const ll INF = 1LL<<60;
const ll mod = 1000000007LL;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
  ll N;
  cin>>N;
  vector<ll> A(N),B(N);
  rep(i,N) cin>>A[i]>>B[i];
  ll cnt = 0;
  rep(i,N){
    if(A[i]>B[i]) cnt++;
  }
  ll ans = 0;
  if(cnt == 0) ans = 0;
  else {
    ll b = INF;
    rep(i,N) {
      ans += A[i];
      if(A[i]>B[i]) chmin(b,B[i]);
    }
    ans -= b;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3604
#include<vector>
#include<iostream>
#include<string>
#include<algorithm>
#include<math.h>
#include<map>
#include<functional>
#include<queue>
#include<stack>
#include<string.h>
#include<list>
#include<limits>
#include<bitset>
#include<ctype.h>
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
const ll MOD=1000000007;
const ll INF=1000000000;
ll mod_pow(ll x,ll n,ll mod){
    ll ret=1;
    while(n>0){
        if(n&1){
            ret=ret*x%mod;
        }
        x=x*x%mod;
        n>>=1;
    }
    return ret;
}
ll f[300000],fr[300000];
ll ncr(int x,int y){
    if(y==0){
        return 1;
    }else{
        return f[x]*fr[y]%MOD*fr[x-y]%MOD;
    }
}
int main() {   
    ll w,h,a,b;
    cin>>h>>w>>a>>b;
    f[0]=1;
    for(ll i=1;i<h+w;i++){
        f[i]=f[i-1]*i%MOD;
    }
    fr[h+w-1]=mod_pow(f[h+w-1],MOD-2,MOD);
    for(ll i=h+w-2;i>=0;i--){
        fr[i]=fr[i+1]*(i+1)%MOD;
    }
    ll ans=0;
    for(ll i=b;i<w;i++){
        ll m=ncr(i+h-a-1,i)*ncr(w-1-i+a-1,w-1-i);
        ans+=m;
        ans%=MOD;
    }
    cout<<ans<<endl;
    getchar();
    getchar();
}

                           


Measured memory_bytes: 3840
X = int(input())

# 2のケース
if X == 2:
    print(X)
    exit()

# 2 以外のケース
for i in range(X, 10 ** 6):
    cnt = 1
    for j in range(2, i // 2 + 2):
        cnt += 1
        if i % j == 0:
            break
        if cnt == (i // 2 + 1):
            print(i)
            exit()


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

using namespace std;

typedef long long int ll;
 
template<class T> inline bool chmax(T& a,T b){ if(a<b){ a=b; return true;} return false; }
template<class T> inline bool chmin(T& a,T b){ if(a>b){ a=b; return true;} return false; }
 
typedef pair<int,int> pair;

int main(){
  string s; cin >> s;
  bool a=false;

  for(int i=0;i<3;i++){
    if(s[i]=='7'){
      a=true;
    }
  }

  if(a){
      puts("Yes");
  }else{
    puts("No");
  }

  return 0;
}


Measured memory_bytes: 3604
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        ArrayList<Integer> numbers = new ArrayList<>();
        
        for (int i = 0; i < n; i++) {
            int query = sc.nextInt();
            switch (query) {
                case 0:
                    numbers.add(sc.nextInt());
                    break;
                case 1:
                    System.out.println(numbers.get(sc.nextInt()));
                    break;
                case 2:
                    numbers.remove(numbers.size() - 1);
                    break;
            }
            
        }
    }
}


Measured memory_bytes: 140276
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<map>
#include<string.h>
#include<complex>
#include<math.h>
#include<queue>
#include<time.h>
using namespace std;
typedef long long int llint;
typedef pair<int, int> pint;
typedef pair<llint, llint> pllint;
typedef vector<int> vint;
typedef vector<llint> vllint;
typedef vector<pint> vpint;
typedef vector<string> vstring;
typedef vector<pair<llint, llint>> vpllint;
typedef vector<vector<int>> vvint;
typedef vector<vector<llint>> vvllint;
typedef vector<vector<pint>> vvpint;
typedef vector<bool> vbool;
#define rep(i,n) for(int i=0;i<n;i++)
#define drep(i,n) for(int i=n-1;0<=i;i--)
#define yes(ans) if(ans)cout<<"yes"<<endl;else cout<<"no"<<endl;
#define Yes(ans) if(ans)cout<<"Yes"<<endl;else cout<<"No"<<endl;
#define YES(ans) if(ans)cout<<"YES"<<endl;else cout<<"NO"<<endl;
#define POSSIBLE(ans) if(ans)cout<<"POSSIBLE"<<endl;else cout<<"IMPOSSIBLE"<<endl;
#define Pi 3.1415926535897932384626
#define mod llint(1e9+7)

class UnionFind {
public:
	//親の番号を格納する。親だった場合は-(その集合のサイズ)
	vector<int> Parent;

	//作るときはParentの値を全て-1にする
	//こうすると全てバラバラになる
	UnionFind(int N) {
		Parent = vector<int>(N, -1);
	}

	//Aがどのグループに属しているか調べる
	int root(int A) {
		if (Parent[A] < 0) return A;
		return Parent[A] = root(Parent[A]);
	}

	//自分のいるグループの頂点数を調べる
	int size(int A) {
		return -Parent[root(A)];//親をとってきたい
	}

	//AとBをくっ付ける
	bool connect(int A, int B) {
		//AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
		A = root(A);
		B = root(B);
		if (A == B) {
			//すでにくっついてるからくっ付けない
			return false;
		}

		//大きい方(A)に小さいほう(B)をくっ付けたい
		//大小が逆だったらひっくり返しちゃう。
		if (size(A) < size(B)) swap(A, B);

		//Aのサイズを更新する
		Parent[A] += Parent[B];
		//Bの親をAに変更する
		Parent[B] = A;

		return true;
	}
};

//aとbの最大公約数を求めるよ
long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}

// 返り値: a と b の最大公約数
// ax + by = gcd(a, b) を満たす (x, y) が格納される
long long extGCD(long long a, long long b, long long& x, long long& y) {
	if (b == 0) {
		x = 1;
		y = 0;
		return a;
	}
	long long d = extGCD(b, a % b, y, x);
	y -= a / b * x;
	return d;
}

bool check(int a, int b) {
	return a > b;
}

// mod. m での a の逆元 a^{-1} を計算する
long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}

//aCbを1000000007で割った余りを求める
llint convination(llint a, llint b) {
	llint ans = 1;
	for (llint i = 0; i < b; i++) {
		ans *= a - i;
		ans %= 1000000007;
	}
	for (llint i = 1; i <= b; i++) {
		ans *= modinv(i, 1000000007);
		ans %= 1000000007;
	}
	return ans;
}

//aのb乗をmodで割った余りを求める
llint power(llint a, llint b) {
	if (b == 1)return a;
	if (b == 0)return 1;
	llint tmp = power(a, (llint)b / 2);
	tmp *= tmp;
	tmp %= mod;
	if (b % 2 == 1) {
		tmp *= a;
		tmp %= mod;
	}
	return tmp;
}

int main() {
	int n;
	cin >> n;
	int a[4] = {};
	rep(i, n) {
		int x;
		cin >> x;
		a[x % 4]++;
	}
	a[1] += a[3];
	a[3] = 0;
	if (a[2] == 0) {
		Yes(a[0] >= a[1] - 1);
	}
	else {
		Yes(a[0] >= a[1]);
	}
	return 0;
}


Measured memory_bytes: 256
// JavaProgram.cpp
// Author : Priydarshi Singh (@dryairship)
// One cat just leads to another. One bug leads to two others.

#include <bits/stdc++.h>
using namespace std;

// I like my types defined.
typedef long long           ll;
typedef pair<int, int>      pii;
typedef pair<ll, ll>        pll;
typedef vector<int>         vi;
typedef vector<ll>          vl;
typedef vector<pii>         vii;
typedef vector<pll>         vll;
typedef set<int>            si;
typedef map<string, int>    msi;
typedef map<int, int>       mii;

// Traditional science is all about finding "hashtag define"s.
#define fr(i, n)            for(int i=0; i<(n); ++i)
#define frC(i, n, c)        for(int i=0; (i<(n)) && (c); ++i)
#define frA(i, a, n)        for(int i=a; i<=(n); ++i)
#define frD(i, a, n)        for(int i=a; i>=(n); --i)
#define fill(a)             memset(a, 0, sizeof(a))
#define fill1(a)            memset(a, -1, sizeof(a))
#define revsort(a, b)       sort(a, b, greater<int>())
#define ff                  first
#define ss                  second
#define pb                  push_back 
#define dout                if(DEBUGGING) cout
#define dbg                 if(DEBUGGING) 
#define endl                "\n"

// When you realize MOD > INF...
int DEBUGGING    =          0;
const int INF    =          1000000000;
const int MOD    =          1000000007;
const ll LINF    =          1e18;
const double PI  =          3.1415926535897932;
const double EPS =          1e-7;

// I'D SPAM. Hehe.
ll gcdEx                    (ll a, ll b, ll *x, ll *y){if(!a){*x=0;*y=1;return b;} 
ll x1,y1,gcd=gcdEx          (b%a,a,&x1,&y1); *x=y1-(b/a)*x1;*y=x1; return gcd;}
ll modI(ll b, ll m)         {ll x,y;gcdEx(b,m,&x,&y);return (x%m+m)%m;}
ll modD(ll a, ll b)         {return (modI(b,MOD)*(a%MOD))%MOD;}
ll modS(ll a, ll b)         {return ((a%MOD)-(b%MOD)+MOD)%MOD;}
ll modP(ll x, ll y)         {ll r=1; x%=MOD; while(y>0){if(y&1){r=(r*x)%MOD;} y=y>>1; x=(x*x)%MOD;} return r;}
ll modA(ll a, ll b)         {return ((a%MOD)+(b%MOD))%MOD;}
ll modM(ll a, ll b)         {return ((a%MOD)*(b%MOD))%MOD;}

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

ll dp[105005];
ll wt[105], v[105];

void solve(int TEST_CASE){
    int n, w;
    cin >> n >> w;
    fr(i,n) cin >> wt[i] >> v[i];
    fr(i,105005) dp[i] = LINF;
    fr(i,n){
        frD(j,100004, 0){
            if(dp[j]!=LINF) dp[j+v[i]] = min(dp[j+v[i]], dp[j]+wt[i]);
        }
        dp[v[i]] = min(dp[v[i]], wt[i]);
    }
    dbg{
        fr(i,60) cout << dp[i] << ",";
        cout << endl;
    }
    frD(i,105000, 0){
        if(dp[i]<=w){
            dout << dp[i] <<endl;
            cout << i;
            return;
        }
    }
}

int main(int argc, char* argv[]){
    if(argc==2 && argv[1][1]=='v') DEBUGGING = 1;
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    cin.exceptions(cin.failbit);
    int nTestCases=1;
    //cin >> nTestCases;
    frA(i,1,nTestCases) solve(i);
    return 0;
}

Measured memory_bytes: 4408
// 2011/09/27 Tazoe

#include <iostream>
using namespace std;

int main()
{
	while(true){
		int N, M;
		cin >> N >> M;
		if(N==0&&M==0)
			break;

		int X[1000];
		for(int i=0; i<N; i++)
			cin >> X[i];

		int D[1000];
		for(int i=0; i<M; i++)
			cin >> D[i];

		int I = 0;
		for(int i=0; i<M; i++){
			I += D[i];
			if(I>=N-1){
				cout << i+1 << endl;
				break;
			}

			I += X[I];
			if(I>=N-1){
				cout << i+1 << endl;
				break;
			}
		}
	}

	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <string>
#include <set>
using namespace std;

int n, m, k;
string a[8];
int r[8], c[8], black, ans;

int main() {
    cin >> n >> m >> k;
    for(int i = 0; i < n ; i++) {
        cin >> a[i];
        for(int j = 0; j < m; j++)
            if(a[i][j] == '#')
                black++;
    }

    for(int i = 0; i < n; i++)
        for(int j = 0; j < m; j++)
            r[i] += (a[i][j] == '#');
    for(int j = 0; j < m; j++)
        for(int i = 0; i < n; i++)
            c[j] += (a[i][j] == '#');


    for(int rows = 0; rows < (1<<n); rows++)
        for(int cols = 0; cols < (1<<m); cols++) {
            set<int> rowsElim, colsElim;
            int rem = black;
            for(int i = 0; (1<<i) <= rows; i++)
                if((1<<i)&rows) rowsElim.insert(i);
            for(int i = 0; (1<<i) <= cols; i++)
                if((1<<i)&cols) colsElim.insert(i);

            for(auto x:rowsElim)
                for(auto y:colsElim)
                    if(a[x][y] == '#')
                        rem++;
            for(auto x:rowsElim)
                rem -= r[x];
            for(auto y:colsElim)
                rem -= c[y];

            if(rem == k) ans++;

        }
    cout << ans;
}


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

signed main(){
  int n,k,r,s,p,ans=0;string t;cin>>n>>k>>r>>s>>p>>t;
  for(int i=0;i<k;i++){
    int now=i;
    while(now<n){
      int cnt=1;
      while(now+k<n&&t[now]==t[now+k])now+=k,cnt++;
      cnt=(cnt+1)>>1;
      if(t[now]=='r')ans+=p*cnt;
      if(t[now]=='s')ans+=r*cnt;
      if(t[now]=='p')ans+=s*cnt;
      now+=k;
    }
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i,a) for(int i=0;i<int(a);++i)
#define REP(i,a,b) for(int i=int(a);i<int(b);++i)
using ll = long long;
using itn = int;
using namespace std;
using Graph = vector<vector<int>>;
int GCD(int a, int b){
    return b ? GCD(b, a%b) : a;
}
int main() {
	int N;
	cin>>N;
	bool F[N][10]={false};
	int P[N][11];
	int ans=-1e9;
	rep(i,N) rep(j,10) cin>>F[i][j];
	rep(i,N) rep(j,11) cin>>P[i][j];
	for(int mask=1; mask<(1<<10); mask++){
		int tmp=0;
		int c[N]={};
		for(int j=0; j<10; j++){
			if(mask&(1<<j)){
				rep(i,N){
					if(F[i][j]){
						c[i]++;
					}
				}
			}
		}
		rep(i,N) tmp+=P[i][c[i]];
		ans = max(ans,tmp);
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 256
import java.util.*;
import java.io.*;

public class Main{
	public static void main(String[] args){
		Scanner stdIn = new Scanner(System.in);
		List<Integer> prime = new ArrayList<Integer>();
		prime.add(2); prime.add(3);
		int[] check = new int[50001];
		check[2] = 1; check[3] = 1;
		
	outer:	for(int i = 5; i < 50000; i += 2){
			for(int j = 1; prime.get(j) <= Math.sqrt(i); j++){
				if( i%prime.get(j) == 0 ){
					continue outer;
				}
			}
			prime.add(i);
			check[i] = 1;			
		}
		
		List<Integer> result = new ArrayList<Integer>();
		int n = stdIn.nextInt();
		while( n != 0 ){
			if( n%2 != 0 ){
				if( check[n-2] == 1 ){
					result.add(1);
				} else {
					result.add(0);
				}
			
			} else {
				int sum = 0;
				int index = 0;
				while( prime.get(index) <= n/2 ){
					if( check[n-prime.get(index)] == 1 ){
						sum++;
					}
					index++;
				}
				result.add(sum);
			}
			n = stdIn.nextInt();
		}
		for(Integer sum : result){
			System.out.println(sum);
		}
	}
}

Measured memory_bytes: 13000
def solve():
	N, K = map(int, input().split())
	arr = list(map(int, input().split()))
	arr.sort()
	ans = 0
	for i in range(min(N, K)):
		ans += arr[i]
	return ans

def main():
	# for _ in range(int(input())):
	print(solve())


if __name__ == '__main__':
	main()


Measured memory_bytes: 9108
uses math;
var
    n, i, j : longint;
    h, dp : array[1..100005] of longint;

begin
    readln(n);
    for i := 1 to n do read(h[i]);
    dp[1] := 0;
    for i := 2 to n do
    if (i = 2) then dp[i] := dp[i - 1] + abs(h[2] - h[1])
    else dp[i] := min(dp[i - 1] + abs(h[i - 1] - h[i]), dp[i - 2] + abs(h[i - 2] - h[i]));
    writeln(dp[n]); 
end.

Measured memory_bytes: 1364
#!/usr/bin/env python3
import sys

YES = "Yes"  # type: str
NO = "No"  # type: str


def solve(S: str):
    if len(set(list(S))) == 1:
        print(NO)
    else:
        print(YES)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = next(tokens)  # type: str
    solve(S)


if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
def main():
	N, x = map(int, input().split())
	a = list(map(int, input().split()))

	a.sort()
	a_sum = 0
	ans = 0

	for i in range(N):
		a_sum += a[i]
		ans += 1

		if a_sum > x:
			ans -= 1
			break

		if i == N - 1 and a_sum < x:
			ans -= 1
			break

	print(ans)


  
if __name__ == "__main__":
  	main()

Measured memory_bytes: 9096
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.UncheckedIOException;
import java.util.StringTokenizer;
class Main{
	static long A,B;
	static int N;
	static long[] h;
	public static void main(String[] args) {
		SC sc=new SC(System.in);
		N=sc.nextInt();
		A=sc.nextLong();
		B=sc.nextLong();
		long min=1;
		long max=2_000_000_000L;
		h=new long[N];
		for(int i=0; i<N; i++) {
			h[i]=sc.nextLong();
		}
		while(Math.abs(max-min)>1) {
			long mid=(min+max)/2;
			if(bi(mid)) {
				max=mid;
			}
			else {
				min=mid;
			}
		}
		if(bi(min)) {
			pl(min);
		}
		else {
			pl(max);
		}
	}
	static boolean bi(long mid) {
		long kill=0;
		for(int i=0; i<N; i++) {
			long tmp=h[i]-mid*B;
			if(tmp>0) {
				kill+=(tmp+(A-B-1))/(A-B);
			}
		}
		if(mid>=kill) {
			return true;
		}
		else {
			return false;
		}
	}
	static class SC {
		private BufferedReader reader = null;
		private StringTokenizer tokenizer = null;
		public SC(InputStream in) {
			reader = new BufferedReader(new InputStreamReader(in));
		}
		public String next() {
			if (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new UncheckedIOException(e);
				}
			}
			return tokenizer.nextToken();
		}
		public int nextInt() {
			return Integer.parseInt(next());
		}
		public long nextLong() {
			return Long.parseLong(next());
		}
	}
	public static void pl(Object o) {
		System.out.println(o);
	}
	public static void pl() {
		System.out.println();
	}
	public static void p(Object o) {
		System.out.print(o);
	}
}

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

int main() {
	long long n, a, b, c, d, e;
	cin >> n >> a >> b >> c >> d >> e;
	cout << max({ (n - 1) / a,(n - 1) / b,(n - 1) / c,(n - 1) / d,(n - 1) / e }) + 5 << endl;
}

Measured memory_bytes: 256
//#include <bits/stdint.h>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <bitset>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef long long LL;

typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

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

//constant
//--------------------------------------------
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
const LL MOD = 1e9+7; 
//vector <vector<int>> x(20, vector<int> (20)), y(20,vector<int> (20));
/*int counter_1 (int x) {
    if(x == 0) return 0;
    return counter_1(x >> 1) + (x & 1);
}*/
int main(){
  int n;
  cin >> n;
  VI l(n);
  REP(i,n){
    cin >> l[i];
  }
  SORT(l);
  cout << l[n-1]-l[0] << endl;
}

Measured memory_bytes: 384
using System;
public class Hello{
    static int CntDvdByTwo(int n){
        int count = 0;
        while(n % 2 != 1){
            n /= 2;
            count++;
        }
        return count;
    }
    public static void Main(){
        int n = int.Parse(Console.ReadLine());
        int[] arr = Array.ConvertAll(Console.ReadLine().Split(' '),int.Parse);
        int ans = 0;
        
        for(var i = 0;i < n;i++){
            ans += CntDvdByTwo(arr[i]);
        }
        
        Console.WriteLine(ans);
            
        
    }
}


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

int n,l;
string s[105];

int cmp(string s1,string s2)
{
	return s1<s2;
}

int main()
{
	cin>>n>>l;
	for (int i=1;i<=n;i++)  cin>>s[i];
	sort(s+1,s+n+1);
	for (int i=1;i<=n;i++)  cout<<s[i];
	cout<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iomanip>
#include <algorithm>
#define ll long long
#include <unordered_map>
using namespace std;
 
int main() {
  ll M1, D1, M2, D2;
  cin >> M1 >> D1 >> M2 >> D2;
  if(D2 - D1 == 1) cout << 0 << endl;
  else cout << 1 << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

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

        int i;

        for(i = 1;i < 100000;i++){
            int x = sc.nextInt();
            if(x==0)break;
            System.out.printf("Case %d: %d\n",i,x);
        }
    }
}


Measured memory_bytes: 65692
import qualified Data.ByteString.Char8 as BS
import           Data.Char
import           Data.List

getAsInt :: IO [Int]
getAsInt =  unfoldr (BS.readInt . BS.dropWhile isSpace) <$> BS.getLine

main :: IO ()
main = do
  _ <- getLine
  as <- getAsInt
  print $ solve as

solve :: [Int] -> Int
solve (x:xs) = if x >= 0
               then go (-x) True 0 xs
               else go   x False 0 xs
  where go m b n []
          | b         = n - m
          | otherwise = n + m
        go m b n (y:ys)
          | y >= 0 && - m >=   y = go (-y) b (n - m) ys
          | y >= 0 && - m <    y = go  m b (n + y) ys
          | y <  0 && - m >= - y = go  y (not b) (n - m) ys
          | y <  0 && - m <  - y = go  m (not b) (n - y) ys


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

using namespace std;

int main(){
	int n,x,y;
  	cin>>n>>x>>y;
  	int arr[n-1]={0};
  	for(int i=0;i<n-1;i++){
      	for(int j=i+1;j<n;j++){
        	int ans = min(abs(j-i), abs(x-1-i)+1+abs(j-y+1));
          	ans = min(ans, abs(y-i-1)+1+abs(j-x+1));
          	arr[ans-1]++;
        }
    }
  	for(int i=0;i<n-1;i++){
    	cout<<arr[i]<<endl;
    }
  	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
  int n,i,mark=0,ans=0;
  cin >> n;
  vector<int> h(n+5,0);
  for (i=0;i<n;i++) cin >> h.at(i+1);
  i=0;
  while (1){
    while (i<n&&h.at(i)<=h.at(i+1)) i++;
    if (i==n) break;
    ans+=h.at(i)-mark;
    while (i<n&&h.at(i)>h.at(i+1)){
      i++;
      mark=h.at(i);
    }
    if (i==n) break;
    mark=h.at(i);
  }
  if (h.at(i)>mark) ans+=h.at(i)-mark;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    private static int fiveCount = 0;
    private static int sevenCount = 0;

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int A = Integer.parseInt(scanner.next());
        int B = Integer.parseInt(scanner.next());
        int C = Integer.parseInt(scanner.next());
        scanner.close();

        check(A);
        check(B);
        check(C);

        boolean isFiveSevenFive = fiveCount == 2 && sevenCount == 1;

        System.out.println(isFiveSevenFive ? "YES" : "NO");
    }

    static void check(int target) {
        if (target == 5) {
            fiveCount++;
        }
        if (target == 7) {
            sevenCount++;
        }
    }


}


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

#define ALL(a) (a).begin(), (a).end()
#define llong long long

using namespace std;


signed main(){
	const llong INF = 1000000000;
	int n,k; cin >> n >> k;
	vector<llong> h(n);
	for(auto &e: h)cin >> e;
	vector<llong> dp(n,INF);
	dp[0] = 0;
	for(int i = 1; i < n; i++){
		for(int j = 1; j <= k; j++){
			if(i-j < 0)break;
			dp[i] = min(dp[i], dp[i-j] + abs(h[i-j] - h[i]));
		}
	}
	cout << dp[n-1] << endl;

	return 0;
}



Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i,a,b) for(ll i=a;i<=b;i++)
#define FORD(i,a,b) for(ll i=a;i>=b;i--)
#define ALL(a)  (a).begin(),(a).end()
#define SZ(a) int((a).size())
#define SORT(c) sort((c).begin(),(c).end())
#define PB push_back
#define MP make_pair
#define MEMSET(v, h) memset((v), h, sizeof(v))
#define sqr(x)  ((x) * (x)) 
#define cub(x)  ((x) * (x) * (x))
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
// ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
// ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int main(){
  ll h,n; cin >> h >> n;
  ll a[n];
  ll sum = 0;
  FOR(i,0,n-1) {
    cin >> a[i];
    sum += a[i];
  }

  if(h>sum) cout << "No" << endl;
  else cout << "Yes" << endl;

  

}


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

// macros
#define pb emplace_back
#define mk make_pair
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) for(int i=((int)(n)-1);i>=0;i--)
#define irep(itr, st) for(auto itr = (st).begin(); itr != (st).end(); ++itr)
#define irrep(itr, st) for(auto itr = (st).rbegin(); itr != (st).rend(); ++itr)
#define whole(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define bit(n) (1LL<<(n))
#define F first
#define S second
// functions
template <typename T> void unique(T& c){c.erase(std::unique(c.begin(), c.end()), c.end());}
template <class T>bool chmax(T &a, const T &b){if(a < b){a = b; return 1;} return 0;}
template <class T>bool chmin(T &a, const T &b){if(a > b){a = b; return 1;} return 0;}
template <typename T> istream &operator>>(istream &is, vector<T> &vec){for(auto &v: vec)is >> v; return is;}
template <typename T> ostream &operator<<(ostream &os, const vector<T>& vec){for(int i = 0; i < vec.size(); i++){ os << vec[i]; if(i + 1 != vec.size())os << " ";} return os;}
template <typename T> ostream &operator<<(ostream &os, const set<T>& st){for(auto itr = st.begin(); itr != st.end(); ++itr){ os << *itr; auto titr = itr; if(++titr != st.end())os << " ";} return os;}
template <typename T> ostream &operator<<(ostream &os, const unordered_set<T>& st){for(auto itr = st.begin(); itr != st.end(); ++itr){ os << *itr; auto titr = itr; if(++titr != st.end())os << " ";} return os;}
template <typename T> ostream &operator<<(ostream &os, const multiset<T>& st){for(auto itr = st.begin(); itr != st.end(); ++itr){ os << *itr; auto titr = itr; if(++titr != st.end())os << " ";} return os;}
template <typename T> ostream &operator<<(ostream &os, const unordered_multiset<T>& st){for(auto itr = st.begin(); itr != st.end(); ++itr){ os << *itr; auto titr = itr; if(++titr != st.end())os << " ";} return os;}
template <typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &p){os << "(" << p.first << ", " << p.second << ")"; return os;}
template <typename T1, typename T2> ostream &operator<<(ostream &os, const map<T1, T2> &mp){for(auto itr = mp.begin(); itr != mp.end(); ++itr){ os << "(" << itr->first << ", " << itr->second << ")"; auto titr = itr; if(++titr != mp.end())os << " "; } return os;}
template <typename T1, typename T2> ostream &operator<<(ostream &os, const unordered_map<T1, T2> &mp){for(auto itr = mp.begin(); itr != mp.end(); ++itr){ os << "(" << itr->first << ", " << itr->second << ")"; auto titr = itr; if(++titr != mp.end())os << " "; } return os;}
//  types
using ll = long long int;
using P = pair<int, int>;
// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double EPS = 1e-10;
const int mod = 1000000007;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};
// io
struct fast_io{
  fast_io(){ios_base::sync_with_stdio(false); cin.tie(nullptr); cout << fixed << setprecision(20);}
} fast_io_;


int main(int argc, char const* argv[])
{
  double r; cin >> r;
  cout << 2. * acosl(-1) * r << endl;
  return 0;
}


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

using namespace std;
using ll = long long;

#define INF (1LL << 60)
#define MOD 1000000007

#define REP(i,m,n) for(ll (i)=(m),i##_len=(n);(i)<(i##_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define _PR(x) cout << (x) << endl
#define _PS(x) cout << (x) << " "
#define SZ(x) ((int)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define pb push_back



int main()
{
    ll N;
    cin >> N;
    vector<ll> P(N), Q(N);
    REP(i,0,N) cin >> P[i];
    REP(i,0,N) cin >> Q[i];

    vector<ll> S;
    REP(i,1,N+1) S.pb(i);

    ll cnt = 1, a, b;
    do {
        if(P == S) a = cnt;
        if(Q == S) b = cnt;
        ++cnt;
    } while(next_permutation(ALL(S)));
    _PS(abs(a-b));

    return 0;
}

/*



*/

Measured memory_bytes: 256