akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (int i = (int)(a); i < (int)(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define ll long long
#define lld long double
#ifdef DEBUG
#define line() cout << "[" << __LINE__ << "] ";
#define dump(i) cout << #i ": " << i << " ";
#define dumpl(i) cout << #i ": " << i << endl;
#else
#define line(i)
#define dump(i)
#define dumpl(i)
#endif
using namespace std;
class UF
{
private:
public:
    UF *root;
    int value;
    UF(int n = 1)
    {
        root = this;
        value = n;
    }
    void showInfo(void)
    {
        cout << "rootNode:" << root << ",value:" << value << endl;
    }
};

void connectNode(UF *a, UF *b)
{
    while (b->root != b)
        b = b->root;
    while (a->root != a)
        a = a->root;

    if (a > b)
    {
        a->root = b;
        b->value += a->value;
    }
    if (a < b)
    {
        b->root = a;
        a->value += b->value;
    }
    return;
}

int gnum(UF *a)
{
    UF *pa = a;
    while (a->root != a)
        a = a->root;
    pa->root = a;
    return a->root->value;
}
bool hasSameRoot(UF *a, UF *b)
{

    UF *pa = a;
    UF *pb = b;
    while (a->root != a)
        a = a->root;
    while (b->root != b)
        b = b->root;
    pa->root = a;
    pb->root = b;

    return a == b;
}

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

    UF u[n];
    map<int, vector<int>> g;
    map<int, vector<int>> block;
    map<pair<int, int>, bool> isFriend;
    map<pair<int, int>, bool> isBlock;
    rep(i, m)
    {
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        g[a].push_back(b);
        g[b].push_back(a);
        connectNode(&u[a], &u[b]);
        isFriend[{a, b}] = true;
        isFriend[{b, a}] = true;
    }
    rep(i, k)
    {
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        isBlock[{a, b}] = true;
        isBlock[{b, a}] = true;
        block[a].push_back(b);
        block[b].push_back(a);
    }
    rep(i, n)
    {
        int ans = gnum(&u[i]) - g[i].size() - 1;
        for (auto x : block[i])
        {
            if (hasSameRoot(&u[i], &u[x]))
                ans--;
        }
        cout << ans << " ";
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 49272
/*       Don't try to hack it :|

            _/﹋\_
            (҂`_´)
            <,︻╦╤─҉- - - - - - - - - - - - - - -
            _/﹋\_
*/
//@Yuvraj Garg

#include <bits/stdc++.h>

#define ull unsigned long long int
#define ll long long int
#define vi vector<int>
#define vll vector<ll>
#define vvi vector < vi >
#define pii pair<int,int>
#define pll pair<long long, long long>
#define itr vi:iterator
#define vpll vector < pair<long long,long long> >
#define mod 1000000007
#define inf 1000000000000000001
#define all(c) c.begin(),c.end()
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define f first
#define s second
#define pdd pair<double, double>
#define retrun return // Bcoz of typing error :(
#define foo() cout << "Err\n"

#define rep(i, n)    for(ll i = 0; i < (n); ++i)
#define repA(i, a, n)  for(ll i = a; i <= (n); ++i)
#define repD(i, a, n)  for(ll i = a; i >= (n); --i)

using namespace std;  

void solve(int t){
    vector<char> v(4);
    rep(i, 4) cin >> v[i];
    sort(all(v));
    if(v[0] == v[1] && v[1] != v[2] && v[2] == v[3]){
        cout << "Yes";
    }    
    else cout << "No";
}

int main(){

    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    /*#ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif*/
    int t, tmp = 0;
    // cin >> t;
    t = 1;
    while(tmp++ < t){
        solve(tmp-1);
        // cout << "\n";        
    }
    //cerr << "Time : " << (double)clock() / (double)CLOCKS_PER_SEC << "s\n";
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

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

        int N = scanner.nextInt();
        int M = scanner.nextInt();

        int[] cnts= new int[M];

        for(int i=0; i<N; i++){
            int k = scanner.nextInt();
            for(int j=0; j<k; j++){
                int idx = scanner.nextInt();
                idx--;
                cnts[idx]++;
            }
        }

        int cnt = 0;
        for(int i=0; i<M; i++){
            if(cnts[i] == N){
                cnt++;
            }
        }

        System.out.println(cnt);
    }
}


Measured memory_bytes: 24020
h, w = map(int, input().split())
grid = []
for i in range(h):
    a = list(input())
    for j in range(w):
        if a[j] == "#":
            grid.append(a)
            break
        else:
            continue

col = [i for i in range(len(grid[0]))]
for j in range(len(grid[0])):
    for i in range(len(grid)):
        if grid[i][j] == "#":
            break
    else:
        continue
    col.remove(j)

for g in grid:
    for c in col[::-1]:
        g.pop(c)
    print(*g, sep='')

Measured memory_bytes: 4596
import numpy as np
Z=[]
H,W,K=map(int,input().split())
for i in range(H):
    data=list(map(str,input().split()))
    date=list(data[0])
    Z.append(date)
S=0

for i in range(2**(H+W)) :
    A=np.array(Z)
    for j in range(H+W) :
        if i>>j & 1 :
            if j<=H-1 : 
                A[j,:]="?"
            else :
                A[:,j-H]="?"
    count=np.count_nonzero(A=="#")
    if count==K :
        S=S+1

print(S)

Measured memory_bytes: 27168
K, N = map(int, input().split())
A = list(map(int, input().split()))
distances_between_houses = []
for i in range(N):
    if i == N - 1:
        distances_between_houses.append(A[0] + (K - A[-1]))
    else:
        distances_between_houses.append(A[i + 1] - A[i])
distances_between_houses.sort()
distances_between_houses.pop()
print(sum(distances_between_houses))


Measured memory_bytes: 32376
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define pll pair<ll,ll>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))

using namespace std;

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

const ll INF=1e9+7;

int main(){
    ll n,m,Q;
    cin >> n >> m >> Q;
    vector<ll> l(m),r(m),p(Q),q(Q);
    vector<vector<ll>> d(n);
    rep(i,m){
        cin >> l[i] >> r[i];
        l[i]--;
        r[i]--;
        d[r[i]].push_back(l[i]);
    }
    rep(i,n){
        sort(d[i].begin(),d[i].end());
    }
    rep(i,Q){
        cin >> p[i] >> q[i];
        p[i]--;
        q[i]--;
        ll ans=0;
        for(ll j=p[i];j<=q[i];j++){
            auto it=lower_bound(d[j].begin(),d[j].end(),p[i])-d[j].begin();
            ans+=d[j].size()-it;
        }
        cout << ans << endl;
    }
} 

Measured memory_bytes: 9856
#!/usr/bin/env python

from sys import stdin, stderr

def main():
   H, W = map(int, stdin.readline().split())

   if H == 1 or W == 1:
      res = 1
   elif ((H * W) % 2) == 0:
      res = (H * W) / 2
   else:
      res = (H * W) / 2 + 1

   print(res)

   return 0

if __name__ == '__main__': main()


Measured memory_bytes: 2568
#include<stdio.h>
int main(void)
{
 int a,b,c;
 scanf("%d %d %d",&a,&b,&c);
 if (a < b){
   if (b < c){
     printf("Yes\n");
   }
  else{
      printf("No\n");
  }
 }
 else{
     printf("No\n");
 }
 return 0;
}


Measured memory_bytes: 2020
def main():
    mod = 10**9+7
    fact = [1, 1]
    for i in range(2, 2*(10**6)+10):
        fact.append(fact[-1]*i % mod)

    r1, c1, r2, c2 = map(int, input().split())
    r1 -= 1
    c1 -= 1

    def calc(r, c):
        return (pow(fact[c+1]*fact[r+1] % mod, mod-2, mod)*fact[r+c+2]-1) % mod

    print((calc(r2, c2)-calc(r1, c2)-calc(r2, c1)+calc(r1, c1)) % mod)


main()

Measured memory_bytes: 82260
#include <bits/stdc++.h>
#include <queue>
using namespace std;
int main(){
	string S; cin >> S; 
	int A = 10 * (S.at(0) - '0') + (S.at(1) - '0'); 
	int B = 10 * (S.at(2) - '0') + (S.at(3) - '0'); 
	bool OA = false; bool OB = false; 
	if(A > 0 && A <= 12) OA = true; 
	if(B > 0 && B <= 12) OB = true; 
	if(OA && OB) cout << "AMBIGUOUS" << endl;
	if(OA && !OB) cout << "MMYY" << endl;  	
	if(!OA && OB) cout << "YYMM" << endl;  
	if(!OA && !OB) cout << "NA" << endl;  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key

typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef long double ld; 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;

int solve(string &s1, string &s2)
{
	int n=s1.length();
	int ans=0;
	int ptr=n-1;
	vector<ii> vec;
	for(int i=n-1;i>=0;i--)
	{
		if(s1[ptr]==s2[i])
		{
			if(ptr==i)
			{
				ptr--;
			}
			continue;
		}
		ptr--;
		while(ptr>=0)
		{
			if(s1[ptr]==s2[i])
			{
				break;
			}
			ptr--;
		}
		if(ptr<0)
		{
			return -1;
		}
		vec.pb(mp(ptr,i));
	}
	int C = 0;
	vi L; deque<int> R;
	for(int i=0;i<n;i++) L.pb(0);
	for(int i=0;i<vec.size();i++)
	{
		int l=vec[i].fi; int r=vec[i].se;
		while(L.size()+R.size()>r+1)
		{
			if(!R.empty()) 
			{
				ans=max(ans,R.back()+C); R.pop_back();
			}
			else
			{
				ans=max(ans,L.back()); L.pop_back();
			}
		}
		//element l must be in L. pick r - l + 1 - R.size() elements from left side
		for(int i=int(L.size()) - 1; i > int(L.size()) - (r - l + 1 - int(R.size())); i--)
		{
			R.push_front(L.back()-C);
			L.pop_back();
		}
		L.pop_back();
		R.pb(R.back());
		C++;
	}
	for(int i=0;i<L.size();i++) ans=max(ans,L[i]);
	for(int i=0;i<R.size();i++) ans=max(ans,R[i]+C);
	return ans;
}

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	int n; string s1,s2;
	cin>>n>>s1>>s2;
	cout<<solve(s1,s2)<<'\n';
}


Measured memory_bytes: 18064
#include <iostream>
#include <vector>
#include <set>
#include <string>
#include <algorithm>
typedef long long ll;
using namespace std;

int main(void)
{
	int a, b, c; cin >> a >> b >> c;
	if (b - a == c - b) cout << "YES" << endl;
	else cout << "NO" << endl;
}


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

using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;

#define REP(i, x, n) for(ll i=x; i<(ll)n; ++i)
#define rep(i, n) REP(i, 0, n)
#define all(v) v.begin(), v.end()

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


Measured memory_bytes: 256
#include <stack>
#include <queue>
#include <cstdio>
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <math.h>
#include <string>
 
using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,n0,n) for(int i=n0;i<n;i++)
#define Com(i,j,n) for(int i=0;i<n-1;i++)for(int j=i+1;j<n;j++)
#define INF (1<<29)
#define test cout << "test" << endl;


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

	int K;
	cin >>K;
	
	vector<string> subst;

	rep(i,s.size()){
		rep(j,K){
			subst.push_back(s.substr(i,j+1));
		}
	}
	
	sort(subst.begin(),subst.end());
	unique(subst.begin(),subst.end());

	cout << subst[K-1] <<endl;

	return 0;
}


Measured memory_bytes: 1660
N  = int(input())
S = input()
P = 0
count = 0
for j in range(1000):
    V = str(P).zfill(3)
    p1 = False
    p2 = False
    for i in range(N):
        if S[i] == V[0] and not p1:
            p1 = True
            continue
        if S[i] == V[1] and p1 and not p2:
            p2 = True
            continue
        if S[i] == V[2] and p2:
            count += 1
            break
    P += 1
print (count)

Measured memory_bytes: 74012
#!/usr/bin/env python

from collections import deque, defaultdict
import itertools as ite
import sys
import math
from decimal import *

sys.setrecursionlimit(1000000)

INF = 10 ** 18
MOD = 10 ** 9 + 7

N, K = map(int, raw_input().split())
p = map(int, raw_input().split())
for i in range(N):
    p[i] += 1
    p[i] /= 2.0
S = 0.0
for i in range(K):
    S += p[i]
ans = S
for i in range(K, N):
    S += p[i]
    S -= p[i - K]
    ans = max(ans, S)
print "%.5f" % ans

Measured memory_bytes: 55448
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; ++i)
#define REPR(i, n) for (int i = n - 1; i >= 0; --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 SORT(v) sort(v.begin(), v.end())
#define SORTR(v) sort(v.rbegin(), v.rend())
#define REV(v) reverse(v.begin(), v.end())
#define ITER(itr, v) for (auto itr = v.begin(); itr != v.end(); ++itr)
#define LB(v, x) (lower_bound(v.begin(), v.end(), x) - v.begin())
#define UB(v, x) (upper_bound(v.begin(), v.end(), x) - v.begin())
#define SZ(v) (int)v.size()
using namespace std;
using ll = long long;
using P = pair<int, int>;

class Main {
    string s;
    void input() { cin >> s; }
    void output() {
        int n = s.size();
        REP(i, n - 1) {
            if (s[i] == s[i + 1]) {
                cout << i + 1 << " " << i + 2 << endl;
                return;
            }
        }
        REP(i, n - 2) {
            if (s[i] == s[i + 2]) {
                cout << i + 1 << " " << i + 3 << endl;
                return;
            }
        }
        cout << -1 << " " << -1 << endl;
    }

public:
    Main() {
        input();
        output();
    }
};

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

    Main();

    return 0;
}


Measured memory_bytes: 3688
fun main(args : Array<String>) {
    val n = readLine()!!.toInt()
    val xx = readLine()!!.split(" ").map { it.toInt() }
    val xxs = xx.sorted()

    val m1 = xxs[(n/2)-1]
    val m2 = xxs[n/2]

    println(xx.map { if (it <= m1) m2 else m1 }.joinToString(separator = System.lineSeparator()))
}

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

using namespace std;

int main() {
    // 入力値
    int N;
    cin >> N;

    vector<int> a(N);
    for (int i = 0; i < N; i++) {
        cin >> a.at(i);
    }

    // 降順にソートする(第3引数に関数オブジェクトを指定)
    sort(a.begin(), a.end(), greater<int>());

    int Alice_score = 0;
    int Bob_score = 0;
    for (int i = 0; i < N; i++) {
        if (i % 2) {  // Alice
            Alice_score += a.at(i);
        } else {  // Bob
            Bob_score += a.at(i);
        }
    }

    int diff = Alice_score - Bob_score;

    // 出力値
    cout << abs(diff) << endl;

    return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int key = sc.nextInt();
        String S = sc.next();
 		byte[] Sbyte = S.getBytes("UTF-8");
      
        String text = "abc";      
      	String ans = "";      
 
      for(int i=0; i<S.length(); i++){
         int a=S.charAt(i) + key;
         if(a>=65+26)a-=26;
         ans = ans + String.valueOf((char)(a));
      }
         System.out.println(ans);
 
    }
}

Measured memory_bytes: 147540
(* 基本 *)
(* ocamlc str.cma main.ml でコンパイルできる *)
let () =
  let l = [("SUN",7);("MON",6);("TUE",5);("WED",4);("THU",3);("FRI",2);("SAT",1)] in
  let s = Scanf.sscanf (input_line stdin) "%s" (fun a -> a) in
  let ans = List.assoc s l in
  print_int ans;
  print_newline ()


Measured memory_bytes: 384
import java.io.*;
   
public class Main {
  public static void main(String[] args) throws Exception {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    String[] inputs = br.readLine().split(" ");
    int a = Integer.parseInt(inputs[0]), b = Integer.parseInt(inputs[1]), c = Integer.parseInt(inputs[2]);
 
    if (a < b && b < c) {
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }
  }
}

Measured memory_bytes: 24472
import java.util.*;
import java.io.*;
import java.math.*;
 
public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        int c = sc.nextInt();
        char[] s = sc.next().toCharArray();
        int[] front = new int[n];
        int[] back = new int[n];
        int ind = s.length-1;
        int cnt = 0;
        while(ind >= 0){
            if(s[ind] == 'o'){
                back[ind]++;
                ind -= c;
                cnt++;
            }
            ind--;
        }
        if(cnt > k){
            return;
        }
        ind = 0;
        cnt = 0;
        while(ind < s.length && cnt < k){
            if(s[ind] == 'o'){
                front[ind]++;
                ind += c;
                cnt++;
            }
            ind++;
        }
        for(int i = 0; i < n; i++){
            if(front[i] >= 1 && back[i] >= 1){
                System.out.println(i+1);
            }
        }
    }
}


Measured memory_bytes: 53616
import numpy as np
K = int(input())
c = np.asarray([1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51])

print(c[K-1])

Measured memory_bytes: 21776
h,w=map(int,input().split())
l=[["."]*(w+2)]
for i in range(h):
    l.append(list("."+input()+"."))
l.append(["."]*(w+2))

tate=[-1,-1,-1,0,0,1,1,1]
yoko=[-1,0,1,-1,1,-1,0,1]

for i in range(1,h+1):
    l2=[]
    for j in range(1,w+1):
        if l[i][j]=="#":
            l2.append("#")
        else:
            cnt=0
            for k in range(8):
                if l[i+tate[k]][j+yoko[k]]=="#":
                    cnt+=1
            l2.append(str(cnt))
    print("".join(l2))

Measured memory_bytes: 9200
#pragma GCC optimize(2)
#include<bits/stdc++.h>
#define ll long long
#define maxn 100005
#define inf 1e9
#define eps 1e-10
using namespace std;

inline ll read()
{
	ll x=0,w=1; char c=getchar();
	while(c<'0'||c>'9') {if(c=='-') w=-1; c=getchar();}
	while(c<='9'&&c>='0') {x=(x<<1)+(x<<3)+c-'0'; c=getchar();}
	return w==1?x:-x;
}

ll n,s[maxn],vis[maxn];
vector <int> vec;

int main()
{
	n=read(); ll ans=0;
	for(int i=0;i<n;i++) s[i]=read();
	for(int i=1;i<(n+1)/2;i++)
	{
		ll tmp=0; vec.clear();
		for(int j=i;j<n;j+=i)
		{
			if(vis[n-1-j]||vis[j]||j==n-1-j||n-1-j<i) break;
			tmp+=s[j]; tmp+=s[n-j-1]; vis[j]=1; vis[n-j-1]=1;
			vec.push_back(j); vec.push_back(n-j-1);
			ans=max(ans,tmp);
		}
		for(int j=0;j<vec.size();j++) vis[vec[j]]=0;
	}
	cout<<ans<<endl;
	return 0;
}

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

int main()
{
	int64_t n, mod = 1000000007;
	cin >> n;
	vector<int64_t> as(n);
	for (auto &&a : as)
	{
		cin >> a;
	}

	int64_t ans = 1;

	vector<int64_t> cnt(3, 0);
	for (auto &&a : as)
	{
		int64_t x = 0;
		for (auto &&c : cnt)
		{
			if (c == a)
			{
				x++;
			}
		}
		for (auto &&c : cnt)
		{
			if (c == a)
			{
				c++;
				break;
			}
		}
		(ans *= x) %= mod;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
using namespace std;
int x[105],y[105];
int main()
{
	int i,flag=0;
	int n,m,X,Y;
	scanf("%d%d%d%d",&n,&m,&X,&Y);
	for(i=0;i<n;++i)
	{
		scanf("%d",&x[i]);
	}
	sort(x,x+n);
	for(i=0;i<m;++i)
	{
		scanf("%d",&y[i]);
	}
	sort(y,y+m);
	if(x[n-1]>=y[0])
	flag=1;
	else if(X>=Y)
	flag=1;
	else if(y[0]<X+1)
	flag=1;
	else if(x[n-1]+1>Y)
	flag=1;
	
	if(flag) printf("War");
	else printf("No War");
	return 0;
}

Measured memory_bytes: 256
Program ABC159C
   implicit none
   integer::L,i,j
   real::Vmax=0,xmax,ymax,zmax,x,y,z,V

      read *,L
      do i=1,100
         x=real(L)/100.0*real(i)
         do j=1,100
            y=(real(L)-x)/100.0*real(j)
            z=real(L)-x-y
            V=x*y*z
            if (V>Vmax) then
               Vmax=V
               xmax=x
               ymax=y
               zmax=z
            end if
         end do
      end do

      do i=-50,50
         x=xmax+real(L)/10000.0*real(i)
         do j=-50,50
            y=ymax+real(L)/10000.0*real(j)
            z=real(L)-x-y
            V=x*y*z
            if (V>Vmax) then
               Vmax=V
            end if
         end do
      end do

      print *,Vmax
      stop

   End Program ABC159C

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

using namespace std;

int main()
{
    int n, l;
    cin >> n >> l;
    string arr[n];
    for (int i = 0; i < n; i++) cin >> arr[i];
    sort(arr, arr+n);
    for (int i = 0; i < n; i++) cout << arr[i];
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    string s;
    cin >>s;
    if(s[0]==s[1]&&s[1]==s[2])cout <<"Yes"<<endl;
    else if(s[1]==s[2]&&s[2]==s[3])cout <<"Yes"<<endl;
    else cout <<"No"<<endl;
    
}


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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

int N;
string S[222222];
int dp[222222];
signed main(){
    cin>>N;
    rep(i,N)cin>>S[i];

    int dp2[26];
    rep(i,26)dp2[i]=INT_MAX;
    dp2[S[0][0]-'a']=0;
    rep(i,N){
        dp[i]=dp2[S[i][0]-'a']+1;
        chmin(dp2[S[i].back()-'a'],dp[i]);
    }
    cout<<dp[N-1]<<endl;
    return 0;
}



Measured memory_bytes: 11356
#include <bits/stdc++.h>
using namespace std;
int  h, w, k;
string arr[6];
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    cin >> h >> w >> k;
    for(int i = 0; i < h; i++) 
      cin >> arr[i];

    int count = 0;
    for(int maskR = 0; maskR < (1 << h) ; maskR++) {
      for(int maskC = 0; maskC < (1 << w) ; maskC++) {
        int black = 0;
        for(int i = 0; i < h; i++) {
          for(int j = 0; j < w; j++) {
            if(((maskR >> i) & 1) == 0 && ((maskC >> j) & 1) == 0 && arr[i][j] == '#')
              black++;
          }
        }
        if(black == k)
          count++;
      }
    }
    cout << count;
}


Measured memory_bytes: 3604
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <climits>
#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 <queue>
#include <random>
#include <cctype>
#include <complex>
#include <regex>

using namespace std;


int main() {

    int X, Y;
    cin >> X >> Y;

    cout << X + Y / 2 << endl;

    return 0;
}














































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


int main(){
  int N;
  cin >> N;
  int ans;
  if(N < 10){
    ans = N;
  }
  else if(N < 100){
   ans = 9;
  }
  else if(N < 1000){
    ans = (N - 99) + 9;
  }
  else if(N < 10000){
    ans = 909;
  }
  else if(N < 100000){
    ans = (N - 9999) + 900 + 9;
  }
  else{
    ans = 90909;
  }
  
  cout << ans << endl;
    
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define foi(i,k,n) for(int i = (int)k; i < (int)n; ++i)

using namespace std;
using ll = long long;
using ii = pair<int,int>;

constexpr int MAXN = 5+2e5;
constexpr int MAXK = 61;
int a[MAXN][MAXK];

int main() {
  ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
  int n;
  ll k; cin >> n >> k;
  foi (i,0,n) cin >> a[i][0], --a[i][0];

  foi (j,1,MAXK) {
    foi (i,0,n) {
      a[i][j] = a[a[i][j-1]][j-1];
    }
  }

  int r = 0;
  for (int b = MAXK-1; b >= 0; --b) {
    if (k&(1LL<<b)) {
      r = a[r][b];
    }
  }
  cout << 1+r << '\n';
  return 0;
}


Measured memory_bytes: 51312
import java.util.Scanner;

public class Main {
	private static void p(String s) {System.out.println(s);}
	static Scanner sc = new Scanner(System.in);
	static int a,b,c,n,m;
	public static void main(String[] args) {
		a=sc.nextInt();
		b=sc.nextInt();
		int max=Math.max(a, b);
		int min=Math.min(a,b);
		int ans=max+Math.max(max-1, min);
		p(""+ans);
	}
}


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

using namespace std;

int main() {
    int a, b, c, t;
    scanf("%d %d %d", &a, &b, &c);
    t = a + b;

    if (!(t >= c - 1))
        c = t + 1;

    printf("%d\n", c + b);

    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner

object Main {
  def main(args:Array[String]): Unit = {
    val sc = new Scanner(System.in)
    val a, b, c, d = sc.nextInt()

    if (a * b <= c * d) {
      println(c * d)
    } else {
      println(a * b)
    }
  }
}

Measured memory_bytes: 25528
import java.util.Scanner;

public class Main {
    public static void main(String args[]) {
        try (Scanner in = new Scanner(System.in)) {
            int AB = in.nextInt();
            int BC = in.nextInt();
            int CA = in.nextInt();

            System.out.println(AB * BC / 2);
        }
    }
}


Measured memory_bytes: 21844
n=int(input())
if (((n/1.08)//1)*1.08)//1==n:
    print(int((n/1.08)//1))
elif (((n/1.08)//1+1)*1.08)//1==n:
    print(int(((n+1)/1.08)//1))
else:
    print(":(")

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

int main(){
    vector<int> ok(303030,1);
    ok[0]=ok[1]=false;
    rep(i,303030){
        if(!ok[i])continue;
        if(i%7!=1&&i%7!=6){
            ok[i]=false;
            continue;
        }
        for(int j=2*i;j<303030;j+=i){
            ok[j]=false;
        }
    }
    int n;
    while(cin>>n,n!=1){
        vector<int> ans;
        rep(i,n+1){
            if(ok[i]&&n%i==0)ans.push_back(i);
        }
        cout<<n<<":";
        for(auto e: ans)cout<<" "<<e;
        cout<<endl;
    }
    return 0;
}


Measured memory_bytes: 3676
#include<iostream>
#include<algorithm>
using namespace std;
long dp[2020][2];
long a[2020],n;
long f(long z,long w,int i,int p)
{
	if(dp[i][p]!=-1)return dp[i][p];
	else if(i==n)
	{
		return abs(z-w);
	}
	long ans;
	if(p==0)
	{
		ans=0;
		for(int j=i;j<n;j++)
		{
			ans=max(ans,f(a[j],w,j+1,1));
		}
	}
	else
	{
		ans=2e9;
		for(int j=i;j<n;j++)
		{
			ans=min(ans,f(z,a[j],j+1,0));
		}
	}
	return dp[i][p]=ans;
}
main()
{
	long Z,W;cin>>n>>Z>>W;
	for(int i=0;i<n;i++)cin>>a[i];
	for(int i=0;i<=n;i++)dp[i][0]=dp[i][1]=-1;
	cout<<f(Z,W,0,0)<<endl;
}


Measured memory_bytes: 384
#include <iostream>
#include <string>
using namespace std;
string s, sb;
int count, f;
int main()
{
    cin >> s;
    // cout << s << endl;
    sb.resize(s.size());
    f = 0;
    for (int i = s.size() - 1; i >= 0; i--)
    {
        sb[f] = s[i];
        f++;
    }

    /*  cout << s << endl;
    cout << sb << endl; */
    for (int i = 0; i < s.size(); i++)
    {
        if (sb[i] != s[i])
        {
            count += 1;
        }
    }
    if (count != 0)
    {
        cout << count / 2 << endl;
    }
    else
    {
        cout << 0 << endl;
    }
    return 0;
}

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

int N=0, M=0;
// 割る数の定義
long long MOD = pow(10, 9)+7;

int main(){
  cin >> N >> M;
  // 階段が壊れているかどうかのflag
  vector<bool> flag(N+1, true);
  // DPテーブル。漸化式の計算結果を保存しておく用
  vector<long long> DP(N+1, 0);
  rep(i, M){
    int a = 0;
    cin >> a;
    flag[a] = false;
  }
  // 今いる場所は1通りと考えることで辻褄が合う
  DP[0] = 1;
  // 1段目が壊れていれば0のまま，壊れていなければ1で初期化する
  if (flag[1]==true) DP[1]=1;
  // MODで割ったあまりを格納していけば良い
  rep(i, N-1){
    if (flag[i+2]==true) DP[i+2] = (DP[i+1]+DP[i]) % MOD;
  }
    // DPテーブルは0段目が0インデックスなのでN段目はNインデックス
    cout << DP[N] << endl;
}

Measured memory_bytes: 4052
a, b, c = map(int, input().split())
ans = 0
lst = sorted([a, b, c])
while not lst[0]==lst[1]==lst[2]:
    ans += 1
    if lst[0] == lst[1]:
        lst[0] += 1
        lst[1] += 1
    elif lst[1] == lst[2]:
        if lst[2]-lst[0] >= 2:
            lst[0] += 2
        else:
            lst[1] += 1
            lst[2] += 1
    else:
        lst[0] += 2
        lst.sort()

print(ans)

Measured memory_bytes: 81388
#include <stdio.h>

int main(void)
{
	char str[1000];
	int a = 0;
	
	while (scanf("%c", &str[a]) != EOF){
		if (str[a] >= 'a' && str[a] <= 'z'){
			str[a] += 'A' - 'a';
		}
		printf("%c", str[a]);
		a++;
	}
	
	return (0);
}

Measured memory_bytes: 524
#include <bits/stdc++.h>
 
using namespace std;
#define repr(i,a,b) for (int i=a; i<b; i++)
#define rep(i,n) for (int i=0; i< (int) n; i++)
#define PI  3.14159265358979323846264338327950
 
 
int main () {
    string S;
    cin >> S;

    cout << count(S.begin(),S.end(),'1') << endl;


}


Measured memory_bytes: 256
def main():
    S = input()
    S1 = S[:len(S)//2]
    S2 = S[len(S)//2:][::-1]
    num_hug = 0
    for s1, s2 in zip(S1, S2):
        if s1 != s2:
            num_hug += 1
    print(num_hug)


if __name__ == "__main__":
    main()


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define countof(array) (sizeof(array) / sizeof(array[0]))
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = (n)-1; i >= 0; --i)
#define rep2(i,n) for(int i = 1; i <= (n); ++i)
#define rrep2(i,n) for(int i = (n); i > 0; --i)
#define srep(i,s,n) for(int i = s; i < (n); ++i)
#define rsrep(i,s,n) for(int i = (n)-1; i >= s; --i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define aall(a) (a), (a)+countof(a)//for array sorting
#define raall(a) (a), (a)+countof(a), greater<>()
#define show(x) cout<<#x<<" = "<<(x)<<endl;
#define vfind(v, a) find(all(v), a) != v.end()
#define yn(f) { if (f) puts("YES"); else puts("NO"); }
#define yns(f) { if (f) puts("Yes"); else puts("No"); }
#define show_ary(...) { cout<<#__VA_ARGS__<<" = "; for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define show_pair(...) cout<<#__VA_ARGS__<<" = "<<endl; for (const auto& x : (__VA_ARGS__)) { cout<<"  "<<x.fi<<" : "<<x.se<<endl; }
#define out_ary(...) { int n = (__VA_ARGS__).size(); rep(i, n) printf("%d%s", (__VA_ARGS__)[i], i != n-1 ? " " : "\n"); }
#define argmax(v) distance((v).begin(), max_element(all(v)))
#define argmin(v) distance((v).begin(), min_element(all(v)))
#define vmax(v) *max_element(all(v))
#define vmin(v) *min_element(all(v))
typedef long long int ll;
typedef pair<int, int> P;
typedef vector<P> vpair;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<string> vstr;
typedef vector<bool> vbool;
typedef vector<vint> vvint;
typedef vector<vll> vvll;
typedef vector<vstr> vvstr;
typedef vector<vbool> vvbool;
const ll LINF = 2000000000000000000ll;
const int INF = 1000000100;
const ll MOD = 1e9+7;


int main() {
    int x, y, z;
    cin >> x >> y >> z;

    cout << z << " " << x << " " << y << endl;
    return 0;
}

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

int main() {
  int X,sum=0;
  cin>>X;
  int A=X;
  while(A>0){
    sum+=(A%10);
    A/=10;
  }
  if(X%sum==0)
    cout<<"Yes"<<endl;
  else
    cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
int prime(int a){
	int i,c=0;
	for(i=1;i<=sqrt(a);i++){
		if(a%i==0 && i!=1){
			c=1;
		}
	}
	if(c==1){
		return 0;
	}else{
		return 1;
	}
}
int main(void){
	int n,co=0;
	while(scanf("%d",&n)==1){
		if(prime(n)==1){
			co++;
		}
	}
	printf("%d\n",co);
}

Measured memory_bytes: 2704
<?php
	fscanf(STDIN, "%d", $n);
	$array = explode(" ", trim(fgets(STDIN)));
    $ans = $array[0];
	for($i = 1; $i < $n; $i++){
      
      $ans *= $array[$i];
    }
	if(in_array(0, $array)){
      echo 0;
    }
	elseif($ans > pow(10, 18)){
      echo -1;
    }else{
      echo $ans;
    }

Measured memory_bytes: 25428
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back
#define mt make_tuple
#define ALL(a) (a).begin(),(a).end()
#define FST first
#define SEC second
#define DEB cerr<<"!"<<endl
#define SHOW(a,b) cerr<<(a)<<" "<<(b)<<endl
#define vi vector<int>

using ll = long long;
const int INF = (INT_MAX/2);
const ll LLINF = (LLONG_MAX/2);
const double eps = 1e-8;
const ll DIV =1e9+7;
//const double PI = M_PI;
inline ll pow(ll x,ll n,ll m){ll r=1;while(n>0){if((n&1)==1)r=r*x%m;x=x*x%m;n>>=1;}return r%m;}
inline ll lcm(ll d1, ll d2){return d1 / __gcd(d1, d2) * d2;}
inline ll inv(ll x, ll div){return pow(x, div - 2, div);}
#define chmax(a,b) a=max(a,b)
const int D = 998244353;
template<class T>
struct FT{
    vector<T> d;
    FT(size_t n = 501):d(n+1){}
    T sum(size_t i){T s{};for(++i;i>0; i -= i&-i) s+=d[i]%D; return s%D;}
    T sum(size_t i,size_t j){return i?(sum(j)-sum(i-1)+10LL*D)%D : sum(j);}
    void add(size_t i,T x){for(++i; i<d.size(); i += i&-i) d[i] += x; d[i] %= D;}
};
FT<ll> tf[2][1025];
/*Coding Space*/
int main(){
  int n,x; cin >> n >> x;
  tf[0][0].add(0,1);
  ll ans = 0;
  for(int i = 1; i <= n; ++i){
    for(int j = 0; j <= 512; ++j){
      rep(k,501+1) tf[i%2][j].d[k] = 0;
      for(int k = 0; k <= x; ++k){ 
        //cerr << i << ' ' << j << ' ' << k << ' ' << dp[i-1][j^k] << endl;
            int di = tf[(i-1)%2][j^k].sum(0,k);
            tf[i%2][j].add(k,di);
            if(i == n && j == x) ans += di, ans %= D;
      }
    }
  }
  cout << ans%D << endl;
}



Measured memory_bytes: 11100
// I 
// A M 
// T H E
// B E S T

// I 
// B E L I E V E 
// I N
// M Y S E L F
#include "bits/stdc++.h"
using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<long long> vll;
typedef vector<vll> vvll;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<pair<long long,long long> > vpll;
typedef vector<vector<pair<ll,ll> > > vvpll;
typedef vector<bool> vb;
typedef vector<vb> vvb;
 
#define FIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define all(x) x.begin() , x.end()
#define pb push_back
#define bs binary_search
#define lb lower_bound
#define ub upper_bound
#define mp make_pair
#define F first
#define S second
#define left (node << 1)
#define right (node << 1) + 1
#define pii pair<int,int> 
#define mii map<int,int>
#define vi vector<int>
#define umii unordered_map<int,int>
// #define mod 998244353
#define mod 1000000007 
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<": " <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define FILL(name,val) memset(name , val , sizeof(name))
#define repo(i,o,e) for(int i = o ; i < e ; i++)
#define rep(n) for(int i = 0 ; i < n ; i++)
#define repa(i,sta,end,inc) for(int i = sta ; i <= end ; i += inc)
#define repb(i,sta,end,inc) for(int i = sta ; i >= end ; i -= inc)
const ll sz = 1e5+5;
int dx[] = {1, -1, 0, 0};
int dy[] = {0, 0, 1, -1};
 
const ll inf = 1000000000LL * 1000000000LL;

/*
ll power(ll x , ll y){
    ll res = 1;
    x %= mod;
    while(y){
        if(y&1){
            res = res * x % mod;
        }
        x = x*x % mod;
        y /= 2;
    }
    return res%mod;
}
*/

void solve(){
    ll n;
    cin >> n;
    ll res = 1000000LL * 10000000LL;
    for(ll i = sqrt(n) ; i >= 1 ; --i){
        if(n % i == 0){
            res = min(res , i + n / i - 2LL);
        }
    }
    cout << res << endl;
    return;
}



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

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(700000)

def s_in():
    return input()

def n_in():
    return int(input())

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

def print_l(l):
    print(' '.join(map(str, l)))

class Interval():
    def __init__(self, li):
        self.li = li
        self.n = len(li)
        self.sum_li = [li[0]]
        for i in range(1, self.n):
            self.sum_li.append(self.sum_li[i-1] + li[i])

    def sum(self, a, b=None):
        if b is None:
            return self.sum(0, a)

        res = self.sum_li[min(self.n-1, b-1)]
        if a > 0:
            res -= self.sum_li[a-1]
        return res

n = n_in()
s = set()
[s.add(s_in()) for _ in range(n)]
print(len(s))


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

int main() {
    int N, M;
    cin >> N >> M;
    vector<vector<int>> S;
    for(int i=0; i<M; i++){
        int k;
        cin >> k;
        vector<int>x(k);
        for(int &z : x){
            cin >> z;
        }
        S.push_back(x);
    }
/*for(int i=0; i<M; i++){
    for(int j=0; j<S.at(i).size(); j++){
        cout << S[i][j];
    }
}*/

    vector<int>p(M);
    for(int &x : p){
        cin >> x;
    }

    
    int cnt=0;
    for (int tmp = 0; tmp < (1 << N); tmp++) {
        bitset<10> B(tmp);
        bool f=1;
        //cout << B << endl;
        for(int i=0; i<M; i++){
            int io=0;
            for(int j=0; j<S.at(i).size(); j++){
                if(B.test(S[i][j]-1)) io++;
            }
            //cout << io << endl;
            if(io%2!=p[i]){
                 f=0;
                 break;
            }
        }
    if(f) cnt++;
    //cout << cnt << endl;    
    }
    cout << cnt << endl;
    return 0;
}



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

int main(){
  long long int N,A,B;
  int dis;
  long long int ans=0;
  cin>>N>>A>>B;
  int F[N];
  for(int i=0;i<N;i++)cin>>F[i];
  for(int i=0;i<N-1;i++){
    dis = F[i+1]-F[i];
    if(dis*A<B){
      ans+=A*dis;
    }
    else{
      ans+=B;
    }
  }
  
  cout<<ans<<endl;
}

Measured memory_bytes: 640
////////////////////////// Author
////////////////////////// Nasim Hossain Rabbi
////////////////////////// JU-CSE28
////////////////////////// CF - imnasim3.1415
////////////////////////// UVA - imnasim3.1415
////////////////////////// Mail - imnasim3.1415@gmail.com
#include<bits/stdc++.h>
using namespace std;
#define E end()
#define B begin()
#define sz size()
#define EM empty()
#define fi first
#define se second
#define cl clear()
#define sqr(a) (a*a)
#define mk make_pair
#define pb push_back
string en="\n";
string sp=" ";
string t="hello";
string Y="YES\n";
string N="NO\n";
#define rep(i,n) for(i=0;i<n;i++)
#define Rep(i,n) for(i=1;i<=n;i++)
#define per(i,n) for(i=n-1;i>=0;i--)
#define peR(i,n) for(i=n;i>0;i--)
#define mem(a,b) memset(a,b,sizeof(a))
#define all(cont) cont.begin(),cont.end()
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL)
#define pi 3.1415926535897932384626433832795
#define vi vector<long long>
#define vs  vector<string>
#define MX LLONG_MAX
#define MN LLONG_MIN
#define MOD 1000000007
#define vp(vi,x) cin>>x; vi.pb(x);
#define bsearch(a,x) binary_search(all(a),x)
#define LB(a,x) (lower_bound(all(a),x)-a.B)
#define UB(a,x) (upper_bound(all(a),x)-a.B)
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
bool isprm(LL a){for(LL i=2;i*i<=a;i++){if(a%i==0)return false;}return true;}
bool palin(string a){for(int i=0;i<a.sz;i++){if(a.at(i)!=a.at(a.sz-i-1))return 0;} return 1;}
bool isVowel(char ch){ ch=toupper(ch); if(ch=='A'||ch=='U'||ch=='I'||ch=='O'||ch=='E') return true; return false;}
int toInt(string s){int sm;stringstream ss(s);ss>>sm;return sm;}
LL bpow(LL a,LL b){if(b==0)return 1;LL r=bpow(a,b/2);if(b%2)return r*r*a;else return r*r;}
LL binpow(LL a,LL b){LL r=1;while(b>0){if(b&1)r=r*a;a=a*a;b>>=1;}return r;}
LL binpow(LL a,LL b,LL m){a%=m;LL r=1;while(b>0){if(b&1) r=r*a%m;a=a*a%m; b>>=1;}return r;}
template<typename T>inline T gcd(T a,T b){if(a<0)return gcd(-a,b);if(b<0)return gcd(a,-b);return (b==0)?a:gcd(b,a%b);}
template<typename T>inline T lcm(T a,T b) {if(a<0)return lcm(-a,b);if(b<0)return lcm(a,-b);return a*(b/gcd(a,b));}
int main()
{
//    fast;
    LL i,j,k,n,m,l,s=0,x,y,tc=1,p,q,a,b,c=0;
    bool f=0,ff=0;
    string st;
    while(cin>>n>>l)
    {
        map<string,int>ss;
        while(n--)
        {
            cin>>st;
            ss[st]++;
        }
        string sss;
        for(auto it=ss.B;it!=ss.E;it++)
        {
            st=it->first;
            x=it->second;
            while(x--)sss+=st;
        }
        cout<<sss<<en;
    }
}



Measured memory_bytes: 3640
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<tuple>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define Per(i,sta,n) for(int i=n-1;i>=sta;i--)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;
int dx[4]={1,-1,0,0};
int dy[4]={0,0,1,-1};

string s;

void solve(){
    cin >> s;
    bool ans=false;
    rep(i,3){
        if(s[i]=='7') ans=true;
    }
    if(ans) cout << "Yes" << endl;
    else cout << "No" << endl;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(50);
    solve();
}

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

using namespace std;

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

#define INF 2<<29
#define F first
#define S second

int main(){
  int n;
  int cnt;
  int p,q,r,c;
  int s[1005];
  int x[1005];
  int y[1005];
  int z[1005];
 
  while(1){
    scanf("%d",&n);
    if(n==0) break;
    
    cnt=0;
    for(int i=0;i<n;i++){
      scanf("%d %d %d %d",&s[i],&x[i],&y[i],&z[i]);
    }
    scanf("%d %d %d %d",&p,&q,&r,&c);
  
    for(int i=0;i<n;i++){
      if(x[i]<=p&&y[i]<=q&&z[i]<=r&&x[i]*4+y[i]*9+z[i]*4<=c){
	cnt++;
	printf("%d\n",s[i]);
      }
    }
    if(cnt==0) printf("NA\n");
  }
  
  return (0);
}



Measured memory_bytes: 3180
#include <stdio.h>
int main ()
{
	int n,a;
	while(scanf("%d",&n)!=EOF)
	{
		if(n >= 90)
		{
			printf("Yes\n");
		}
		else
		{
		a = n % 10;
		if(a == 9)
		{
			printf("Yes\n");
		}
		else
		{
			printf("No\n");
		}
		}
	}
	return 0;
}


Measured memory_bytes: 128
from math import ceil


def main():
    number, target = map(int, input().split())
    attacks = []
    for _ in range(number):
        attack = list(map(int, input().split()))
        attacks.append((attack[0], 1))  # 振る
        attacks.append((attack[1], 0))  # 投げつける
    attacks.sort(key=lambda x: x[0], reverse=True)
    answer = 0
    index = 0
    while target > 0:
        if attacks[index][1]:
            answer += ceil(target / attacks[index][0])
            target = 0
        else:
            target -= attacks[index][0]
            index += 1
            answer += 1
    print(answer)


if __name__ == '__main__':
    main()

Measured memory_bytes: 26812
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace ABC121C
{
    class Program
    {
        static void Main(string[] args)
        {
            if (args.Length > 0)
            {
                Console.SetIn(new StreamReader(args[0]));
            }

            new Program().Solve();
        }

        void Solve()
        {
            var temp = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
            var N = temp[0];
            var M = temp[1];
            var dict = new SortedDictionary<long, long>();
            var total = 0L;

            for (int i = 0; i < N; i++)
            {
                temp = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
                var A = temp[0];
                var B = temp[1];

                if (dict.ContainsKey(A))
                {
                    var preceding = dict[A];
                    dict.Remove(A);
                    dict.Add(A, preceding + B);
                }
                else
                {
                    dict.Add(A, B);
                }
            }

            foreach (long price in dict.Keys)
            {
                long amount = dict[price];
                // Console.Error.WriteLine(price + " has " + amount);

                if (amount < M)
                {
                    total += price * amount;
                    M -= amount;
                }
                else
                {
                    total += price * M;
                    break;
                }
            }

            Console.WriteLine(total);
        }
    }
}


Measured memory_bytes: 25252
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return abs(a*b)/gcd(a,b);}
std::vector<bool> IsPrime; void sieve(size_t max){if(max+1 > IsPrime.size())IsPrime.resize(max+1,true);IsPrime[0] = false;IsPrime[1] = false;for(size_t i=2; i*i<=max; ++i)if(IsPrime[i])for(size_t j=2; i*j<=max; ++j)IsPrime[i*j] = false;}
#define roundup(divisor,dividend) (divisor + (dividend - 1)) / dividend
#define all(x) (x).begin(),(x).end()
#define size_t ll
int n,ans=0;bool f=false;
std::vector<string> s; std::vector<int> t;
string x;
int main(){
  cin >> n;
  s.resize(n); t.resize(n);
  for (size_t i = 0; i < n; i++) {
    cin >> s[i] >> t[i];
  }
  cin >> x;
  for (size_t i = 0; i < n; i++) {
    if(f)ans+= t[i];
    if(x == s[i])f=true;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
    int n,k;
    string s;
    cin >> n >> k;
    cin >> s;

    for(int i = 0; i < n; i++){
        if(i == k-1){
            cout << (char)(s[i] + 'a' - 'A');
            continue;
        }
        cout << s[i];
    }
    return 0;
}


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

int main()
{
    int n;
    cin >> n;
    long a[n];
    long t;
    for(int i = 0;i<n;i++){
       cin >> t;
       a[i] = t-i;
    }
    sort(a,a+n);
    long k = a[(n-1)/2];
    long q = 0;
    for(int i = 0;i<n;i++){
        q += abs(a[i]-k) ;
    }
    
    
    cout << q ;
    return 0;
}

Measured memory_bytes: 1792
x, y, a, b, c = map(int, input().split())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))

p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)

a = []
a.extend(p[:x])
a.extend(q[:y])
a.extend(r)
a.sort(reverse=True)

print(sum(a[:x + y]))

Measured memory_bytes: 23328
#include <bits/stdtr1c++.h>
// typedef __int128 int128;
// typedef __float128 float128;

using namespace std;
using namespace rel_ops;
typedef long long ll;
typedef long double ld;
typedef complex<ld> pt;
typedef vector<pt> pol;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<ld> vd;
typedef vector<vd> vvd;
typedef pair<ll, ll> pii;
typedef vector<pii> vpii;
#define pb push_back


int main(){
  // freopen("D.in", "r", stdin);

  ll N;
  cin >> N;

  vi A;

  for (ll i = 0; i < N; ++i) {
    ll Ai;
    cin >> Ai;
    A.pb(Ai);
  }

  ll m0 = 0;
  for (ll i = 0; i < N; ++i) {
    if(i % 2 == 0) m0 += A[i];
    else m0 -= A[i];
  }

  cout << m0 << " ";

  vi sol;
  sol.pb(m0);
  for(ll i = 1; i < N; ++i){
    ll mi = 2*A[i - 1] - sol[i-1];
    cout << mi << " ";
    sol.pb(mi);
  }


}


Measured memory_bytes: 3316