akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <numeric>
#include <cstdlib>
#include <cmath>
#include <map>
#include <math.h>

using namespace std;

int main()
{
	int a, b, c;
	cin >> a >> b >> c;
	if (a == b & b == c) {
		cout << "Yes" << endl;
	}
	else {

		cout << "No" << endl;
	}
}

Measured memory_bytes: 256
#include <iostream>//約数だけ考えればよいですね。O(sqrt(n))で解けます。
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <cmath>
#include <complex>
#define rep(i,n) for(int i=0;i<n;i++)
using ll = long long;
using namespace std;
vector<ll> enumDivisor(ll n) {
	vector<ll> a;
	for (ll i = 2; i * i <= n; i++) {
		if (n % i != 0)continue;
		a.push_back(i);
		if (i * i != n)a.push_back(n / i);
	}
    if(n!=1)a.push_back(n);
	return a;
}
int main() {
	ll n,ans=0;
	cin >> n;
	for (ll x : enumDivisor(n)) {
		ll tmp = n;
		while (tmp % x == 0)tmp /= x;
		tmp %= x;
		if (tmp == 1)ans++;
	}
	ans += enumDivisor(n - 1).size();
	cout << ans;
}


Measured memory_bytes: 384
import sys
input = sys.stdin.readline

H, N = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(N)]
dp = [10**14]*(H+1)
dp[0] = 0
for a, b in AB:
    for i in range(H+1):
        if i < a:
            if dp[i] > b:
                dp[i] = b
        else:
            if dp[i] > dp[i-a]+b:
                dp[i] = dp[i-a]+b
print(dp[H])

Measured memory_bytes: 42092
const stdin = require('fs').readFileSync('/dev/stdin', 'utf8')

const n = Number(stdin.split('\n')[0])

const v = stdin
  .split('\n')[1]
  .split(' ')
  .map(Number)

const getHighFreqSeq = _ => {
  let euniqsObj = {}
  let euniqs = []
  let eseqs = []
  let emax = 0
  let emaxi = 0

  let ouniqsObj = {}
  let ouniqs = []
  let oseqs = []
  let omax = 0
  let omaxi = 0
  
  for (let i = 0; i < v.length; i++) {
    if (i % 2 === 0) {
      const euniqIdx = euniqsObj[v[i]]
      if (euniqIdx === undefined) {
        euniqs.push(v[i])
        euniqsObj[v[i]] = euniqs.length-1
        eseqs.push(1)
      } else {
        eseqs[euniqIdx]++
        if (eseqs[euniqIdx] > emax) {
          emax = eseqs[euniqIdx]
          emaxi = euniqIdx
        }
      }
    } else {
      const ouniqIdx = ouniqsObj[v[i]]
      if (ouniqIdx === undefined) {
        ouniqs.push(v[i])
        ouniqsObj[v[i]] = ouniqs.length-1
        oseqs.push(1)
      } else {
        oseqs[ouniqIdx]++
        if (oseqs[ouniqIdx] > omax) {
          omax = oseqs[ouniqIdx]
          omaxi = ouniqIdx
        }
      }
    }
  }

  return {
    e: {
      max: emax,
      maxi: emaxi,
      seqs: eseqs,
      uniqs: euniqs,
    },

    o: {
      max: omax,
      maxi: omaxi,
      seqs: oseqs,
      uniqs: ouniqs,
    },
  }
}

const res = _ => {
  const { e, o } = getHighFreqSeq()

  const eMIdx = e.maxi
  const oMIdx = o.maxi
  const eMaxFreq = e.uniqs[eMIdx]
  const oMaxFreq = o.uniqs[oMIdx]

  e.seqs.sort((a, b) => b - a)
  o.seqs.sort((a, b) => b - a)

  let esum = 0
  let esum2 = 0
  let osum = 0
  let osum2 = 0

  for (let i = 0; ; i++) {
    if (i !== 0 && e.seqs.length > i) {
      esum += e.seqs[i]
    }
    if (i !== 1 && e.seqs.length > i) {
      esum2 += e.seqs[i]
    }

    if (i !== 0 && o.seqs.length > i) {
      osum += o.seqs[i]
    }
    if (i !== 1 && o.seqs.length > i) {
      osum2 += o.seqs[i]
    }

    if (e.seqs.length <= i && o.seqs.length <= i) {
      break
    }
  }

  if (eMaxFreq === oMaxFreq) {
    return Math.min(esum + osum2, esum2 + osum)
  } else {
    return esum + osum
  }
}

console.log(res())


Measured memory_bytes: 33764
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#define REP(i,a) for (int i = 0;i < (a);++i)
#define FOR(i,a,b) for (int i = (a);i < (b); ++i)
#define FORR(i,a,b) for (int i = (a);i >= (b); --i)
#define ALL(obj) (obj).begin,(obj).end()
#define SORT(list) sort(ALL((list)));
using namespace std;
using ll = long long;
ll n,answer=0;

int dfs(ll num,ll three=0,ll five=0,ll seven=0){
    if(num > n)return 0;
    if(three && five && seven){
        answer++;
    }
    dfs(num*10+3,1,five,seven);
    dfs(num*10+5,three,1,seven);
    dfs(num*10+7,three,five,1);
    return 0;
}
int main(){
    cin >> n;
    dfs(0,0,0,0);
    cout << answer << endl;
    return 0;
}

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

int main()
{
    int64_t N, K;
    std::cin >> N >> K;
    std::vector<std::pair<int64_t, int64_t>> LR;

    for (size_t k = 0; k < K; ++k)
    {
        int64_t L, R;
        std::cin >> L >> R;
        LR.emplace_back(L, R);
    }

    std::vector<int64_t> V;
    V.resize(2 * 100000, 0);

    V[0] = 1;
    int64_t LRC[10];
    for (size_t i = 0; i < 10; ++i) {
        LRC[i] = 0;
    }

    for (int64_t i = 1; i < N; ++i)
    {
        for (int64_t j = 0; j < LR.size(); ++j)
        {
            if (i - LR[j].second - 1 >= 0) {
                LRC[j] -= V[i - LR[j].second - 1];
            }
            if (i - LR[j].first >= 0) {
                LRC[j] += V[i - LR[j].first];
            }
        }
        for (int64_t j = 0; j < LR.size(); ++j)
        {
            V[i] += LRC[j];
            V[i] %= 998244353;
        }
    }

    std::cout << (V[N-1] % 998244353) << std::endl;

    return 0;
}


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

int main() {
  int64_t N; cin>>N;
  vector<int64_t> A(N);
  rep(i,N) cin>>A.at(i);
  sort(A.begin(),A.end());
  reverse(A.begin(),A.end());
  int64_t ans=A.at(0);
  for(int i=1;i<=(N/2)-1;i++) ans+=2*A.at(i);
  if(N%2==1) ans+=A.at((N-1)/2);
  cout<<ans;
}


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

int main(){
    string s;
    int n, ans = 0;
    cin >> s;
    n = s.size();
    for(int i = 0; i < (n / 2); i++ ){
        if( s[i] != s[n-1-i]) ans++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const long double PI = acos(-1);
typedef long long ll;
typedef pair<int64_t,int64_t> pll;
typedef pair<int,int> pii;
typedef vector<int64_t> vl;
int dx[]={1,-1,0,0,1,-1,1,-1};
int dy[]={0,0,1,-1,1,-1,-1,1};
#define INF (2147483647)
#define mod (1000000007)
#define limit (7368791)
#define rep(i,a,b) for (int64_t i = (a); i < (b); i++)
#define REP(i,n) rep(i,0,n)
#define sz(s) (s).size()
#define ALL(a) begin(a),end(a)
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define fi first
#define se second


void solve()
{
    int n;cin>>n;
    if(n/100*5<n%100)cout<<0<<endl;
    else cout<<1<<endl;
}

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


Measured memory_bytes: 256
#include<algorithm>
#include<iostream>
#include<functional>
#include<cmath>
#include<iomanip>
using namespace std;
int main(){
  string s;
  int a=-1,b=-1;
  cin>>s;
  for(int i=0;i<s.size();i++){
    if(s[i]=='C'){
      a=i;
      break;
    }
  }
  for(int j=0;j<s.size();j++){
    if(s[j]=='F'){
      b=j;
    }
  }
  if(a==-1 or b==-1){
    cout<<"No"<<endl;
  }
  else if(a<b){
    cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }
}

Measured memory_bytes: 504
import java.util.Scanner;
public class Main {
    public static void main (String[] args) {
	Scanner scan = new Scanner(System.in);
	int n, a;
	long sum, max;
	while (true) {
	    n = Integer.parseInt(scan.nextLine());
	    if (n == 0) {
		break;
	    }
	    sum = 0;
	    max = Long.MIN_VALUE;
	    for (int i = 0; i < n; i++) {
		a = Integer.parseInt(scan.nextLine());
		sum = Math.max((sum + a), a);
		max = Math.max(sum, max);
	    }
	    System.out.println(max);
	}
    }
}

Measured memory_bytes: 39012
#include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>
#include<ctime>
#include<cmath>
#include<utility>
#include<cstdlib>
#include<bitset>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<iomanip>
using namespace std;                       

#define ll long long
#define pb push_back
#define mp make_pair
#define pii pair<int, int>

#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)

const ll M = 1e9 + 7;

ll add(ll a, ll b){
    (a += b)%=M;
    (a += M)%=M;
    return a;
}

ll mul(ll a, ll b){
    (a *= b)%=M;
    (a += M)%=M;
    return a;
}

ll fastpo(ll a, ll x){
    if(x == 0) return 1ll;
    if(x == 1) return a;
    ll y = fastpo(a, x/2);
    if(x%2 == 0){
        return y*y;
    }
    return y*y*a;
}

ll inv(ll a, ll M){
    return fastpo(a, M-2);
}

ll gcdExtended(ll a, ll b, ll *x, ll *y) 
{ 
    if (a == 0) 
    { 
        *x = 0, *y = 1; 
        return b; 
    } 
  
    ll x1, y1; 
    ll gcd = gcdExtended(b%a, a, &x1, &y1); 
  
    *x = y1 - (b/a) * x1; 
    *y = x1; 
  
    return gcd; 
}

ll modInverse(ll a, ll m) 
{ 
    ll x, y; 
    ll g = gcdExtended(a, m, &x, &y); 
    if (g != 1) 
        return -1; 
    else
    { 
        ll res = (x%m + m) % m; 
        return res;
    } 
}


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

ll lcm(ll a, ll b){
    return (a*b)/gcd(a, b);
}

void print(vector<int> &a){
    int n = a.size();
    for(int i=0; i<n; i++){
        cout<<a[i]<<" ";
    }
    cout<<endl;
}


int main(){
//    clock_t time_req;
//     time_req = clock();
    fastio;
    int n;
    double d;
    cin>>n>>d;
    int ans = 0;
    for(int i=0; i<n; i++){
        double x, y;
        cin>>x>>y;
        double r = sqrt(x*x + y*y);
        if(r <= d) ans++;
    }
    cout<<ans<<endl;
    // print(cost);
    // print(cost1);
    // time_req = clock()-time_req;
    // cout<<"Time taken: "<<(float)time_req/CLOCKS_PER_SEC<<"s"<<endl;
    return 0;
}

Measured memory_bytes: 3828
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from heapq import heapify, heappop, heappush
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

S = list(input())
c = Counter(S)
if c["a"] > 0 and c["b"] > 0 and c["c"] > 0:
    if c["a"] == c["b"] == c["c"]:
        print("Yes")
        exit()
print("No")


Measured memory_bytes: 3944
n,T=list(map(int ,input().split()))
l=[]
count=0
for i in range(0,n):
    c,t=list(map(int ,input().split()))
    if(t<T or t==T):
        l.append(c)
        
    else:
        count+=1
    
if(len(l)==0):
        print("TLE")
else:
    print(int(min(l)))


Measured memory_bytes: 9176
#include <bits/stdc++.h>
#define inf 0x3f3f3f3f3f3f3f3f
//#define inf 0x3f3f3f3f
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define inv(x) Power(x, mod - 2)
#define fi first
#define se second
#define MP make_pair
#define PB push_back
#define N 2000005

using namespace std;
typedef pair<int,int> Pair;
typedef long long ll;

const long double Pi = 3.14159265358979323846l;
const int mod = 1e9 + 7;
inline int add(int x, int y) { return (x += y) - (x >= mod ? mod : 0); }
inline void inc(int &x, int y) { (x += y) -= (x >= mod ? mod : 0); }
inline int mul(int x, int y) { return 1ll * x * y % mod; }
inline int Power(int x, int y) {
	int res = 1;
	while (y) {
		if (y & 1) res = mul(res, x);
		x = mul(x, x), y >>= 1;
	} return res;
}

template <class T> inline T	input() {
	T x; char ch; while (!isdigit(ch = getchar()));
	for (x = ch ^ 48; isdigit(ch = getchar()); x = x * 10 + (ch ^ 48));
	return x;
}

template <class T> inline void chkmin(T &x, T y) { x = x < y ? x : y; }
template <class T> inline void chkmax(T &x, T y) { x = x > y ? x : y; }

struct {
	inline operator int () { return input<int>(); }
	inline operator long long () { return input<long long>(); }
	template <class T> inline void operator () (T &x) { x = *this; }
	template<class T, class ...A> inline void operator () (T &x, A &...a)
	{ x = *this; this -> operator ()(a...); }
} read;

int n, Q, A, B;
ll x[N];

struct SegmentTree {
	ll Mina[N << 2], Minb[N << 2], add[N << 2];
	#define ls rt << 1
	#define rs rt << 1 | 1
	#define mid ((l + r) >> 1)
	SegmentTree() {
		memset(Mina, 0x3f, sizeof Mina);
		memset(Minb, 0x3f, sizeof Minb);
		memset(add, 0, sizeof add);
	}

	void Add(int rt, ll val) {
		Mina[rt] += val;
		Minb[rt] += val;
		add[rt] += val;
	}

	void pushdown(int rt) {
		if (!add[rt]) return void();
		Add(ls, add[rt]);
		Add(rs, add[rt]);
		add[rt] = 0;
	}

	void Modify(int rt, int l, int r, int pos, ll val) {
		if (l == r) {
			chkmin(Mina[rt], val - l);
			chkmin(Minb[rt], val + l);
			return void();
		}

		pushdown(rt);
		if (mid >= pos) Modify(ls, l, mid, pos, val);
		else Modify(rs, mid + 1, r, pos, val);
		Mina[rt] = min(Mina[ls], Mina[rs]);
		Minb[rt] = min(Minb[ls], Minb[rs]);
	}

	void Modify(int pos, ll val) { Modify(1, 1, n, pos, val); }

	ll query(int rt, int l, int r, int L, int R, int type) {
		if (L <= l && r <= R) return !type ? Mina[rt] : Minb[rt];
		ll res = inf; pushdown(rt);
		if (mid >= L) chkmin(res, query(ls, l, mid, L, R, type));
		if (mid < R) chkmin(res, query(rs, mid + 1, r, L, R, type));
		return res;
	}

	ll query(int L, int R, int type) {
		if (L > R) return inf;
		return query(1, 1, n, L, R, type);
	}
}St;

signed main() {
	scanf("%d%d%d%d", &n, &Q, &A, &B);
	x[0] = A, St.Modify(B, 0);

	for (int i = 1; i <= Q; ++i) {
		scanf("%lld", x + i);
		ll Min = min(St.query(1, x[i], 0) + x[i], St.query(x[i] + 1, n, 1) - x[i]);
		St.Add(1, abs(x[i] - x[i - 1]));
		St.Modify(x[i - 1], Min);
	}

	ll ans = inf;
	for (int i = 1; i <= n; ++i)
		ans = min(ans, St.query(i, i, 0) + i);
	printf("%lld\n", ans);
	return 0;
}


Measured memory_bytes: 190720
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
typedef long long ll;
typedef pair<ll,int> P;
int main(){
    int a,b,c;
    cin>>a>>b>>c;
    cout<<a*b/2<<endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

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

		for (int i=0; i<n; i++) {
			ary_b[i] = stdIn.next();
		}
		String[] ary_s = ary_b.clone();
		String[] cards = new String[9];
		Arrays.fill(cards,"");

		for (int i=0; i<n; i++) {
			cards[Integer.parseInt(""+ary_s[i].charAt(1))-1] += ary_s[i].charAt(0);
		}

		for (int i=0; i<ary_b.length; i++) {
			for (int j=ary_b.length-1; j>i; j--) {
				if (ary_b[j].charAt(1) < ary_b[j-1].charAt(1)) {
					swap(ary_b,j,j-1);
				}
			}
		}

		for (int i=0; i<ary_s.length; i++) {
			int mini = i;
			for (int j=i; j<ary_s.length; j++) {
				if (ary_s[j].charAt(1) < ary_s[mini].charAt(1)) {
					mini = j;
				}
			}
			swap(ary_s,i,mini);
		}

		int index = 0;
		boolean flag = true;
		for (int i=0; i<9; i++) {
			for (int j=0; j<cards[i].length(); j++) {
				if(cards[i].charAt(j) != ary_s[index].charAt(0))
					flag = false;
				index++;
			}
		}

		for (int i=0; i<n-1; i++) {
			System.out.print(ary_b[i]+" ");
		}
		System.out.println(ary_b[n-1]);
		System.out.println("Stable");

		for (int i=0; i<n-1; i++) {
			System.out.print(ary_s[i]+" ");
		}
		System.out.println(ary_s[n-1]);
		if(flag)
			System.out.println("Stable");
		else
			System.out.println("Not stable");
	}

	static void swap(String[] ary,int x,int y){
		String temp = ary[x];
		ary[x] = ary[y];
		ary[y] = temp;
	}
}

Measured memory_bytes: 17308
package main

import "fmt"
import "strings"
import "strconv"

func main() {
    var arr []string = strings.Split(scanString(), "/")
    var year, _ = strconv.Atoi(arr[0])
    var month, _ = strconv.Atoi(arr[1])
    var day, _ = strconv.Atoi(arr[2])
    if year < 2019 || year == 2019 && month < 4 || year == 2019 && month == 4 && day <= 30 {
        fmt.Println("Heisei")
    } else {
        fmt.Println("TBD")
    }
}

func scanInt() (num int) {
    fmt.Scan(&num)
    return
}
func scanInts(len int) (nums []int) {
    var num int
    for i := 0; i < len; i++ {
        fmt.Scan(&num)
        nums = append(nums, num)
    }
    return
}
func scanString() (str string) {
    fmt.Scan(&str)
    return
}
func scanStrings(len int) (strs []string) {
    var str string
    for i := 0; i < len; i++ {
        fmt.Scan(&str)
        strs = append(strs, str)
    }
    return
}

Measured memory_bytes: 640
/*   _/                _/                 _/_/_/   _/
  _/_/_/_/   _/_/   _/_/_/_/   _/_/    _/       _/_/
   _/     _/    _/   _/     _/    _/  _/_/_/     _/
  _/     _/    _/   _/     _/    _/  _/    _/   _/
   _/_/   _/_/       _/_/   _/_/      _/_/     _/ */
#include<iostream>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<set>
#include<map>
#include<queue>
#include<vector>
using namespace std;
using ll=long long;
const int MOD=1e9+7;
const double pi=3.14159265358979323846;
const int inf=2e9;
const ll INF=1e18;
using P=pair<int,int>;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
int main() {
  cin.tie(0),cout.tie(0);
  ios::sync_with_stdio(false);
  int x,ans=1;
  cin >> x;
  for(int i=2; i<32; i++) {
    int cnt=i*i;
    while(cnt<=x) {
      ans=max(ans,cnt);
      cnt*=i;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
n,k=map(int,input().split())
ans=0
mod=10**9+7
Min=0
Max=0
for i in range(k):
    Min+=i
    Max+=n-i
Min%=mod
Max%=mod
    
for i in range(k,n+2):
    ans+=Max-Min+1
    ans%=mod
    Min+=i
    Max+=n-i
print(ans)

Measured memory_bytes: 64084
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(signed i=0;i<n;++i)
#define repi(n) rep(i,n)
#define int long long
#define str string
#define vint vector<int>
#define pint pair<int,int>
#define pb(a) push_back(a)
#define all(v) v.begin(),v.end()
#define yn(b) cout<<((b)?"Yes":"No")<<endl
#define YN(b) cout<<((b)?"YES":"NO")<<endl
#define call(a) for(auto t:a)cout<<t<<" ";cout<<endl
#define ENDL printf("\n");
#define debg(a) cout<<#a<<":"<<a<<endl;
#define SORT(a) sort(all(a));
#define INF 1LL<<60
#define inf INF
#define out(i) cout<<i<<endl;
int min(int a,int b){if(a>b)return b;return a;}
int max(int a,int b){if(a>b)return a;return b;}

class unionFind{
public:  
  vector<int> parent;
  
  unionFind(int n){
    parent = vector<int>(n,-1);
  }

  int root(int a){
    if(parent[a]<0)return a;
    return (parent[a]=root(parent[a]));
  }

  int size(int a){
    return (-parent[root(a)]);
  }

  bool connect(int a,int b){
    a=root(a);
    b=root(b);
    if(a==b){return false;}
    if(size(a)<size(b))swap(a,b);
    parent[a]+=parent[b];
    parent[b]=a;
    return true;
  }
};

signed main(){
  int n,m;
  cin>>n>>m;
  vint a(m),b(m);
  rep(i,m){
    cin>>a[i]>>b[i];
    a[i]--;b[i]--;
  }
  int res=0;
  rep(i,m){
    unionFind uni(n);
    rep(j,m){
      if(i==j)continue;
      uni.connect(a[j],b[j]);
    }
    if(!(uni.root(a[i])==uni.root(b[i])))res++;
  }
  cout<<res<<endl;

  return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const ll mod = 1e9 + 7;
#define pival 3.14159265358979323846264338327950L
#define pll pair<ll,ll>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pqq priority_queue
#define all(a) a.begin(), a.end()
#define sz(a) (ll)(a.size())
#define endl '\n'
#define DEBUG
#ifdef DEBUG
#define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1)
    {
        cerr << name << " = " << arg1 << endl;
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args)
    {
        const char* comma = strchr(names + 1, ','); cerr.write(names, comma - names) << " = " << arg1 << " || ";
        __f(comma+1, args...);
    }
#else
#define debug(...)
#endif
template <class Ch, class Tr, class Container>
basic_ostream <Ch, Tr> & operator << (basic_ostream <Ch, Tr> & os, Container const& x) {
    os << "{ ";
    for(auto& y : x) os << y << " ; ";
    return os << "}";
}
template <class X, class Y>
ostream & operator << (ostream & os, pair <X, Y> const& p) {
    return os << "[ " << p.first << ", " << p.second << "]" ;
}
ll power(ll x, ll y, ll p)
{ 
    ll res = 1;  
    x = x % p;
    while (y > 0) { 
        if (y & 1) res = (res * x) % p; 
        y = y >> 1;
        x = (x * x) % p;   
    } 
    return res; 
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
 	string s, t;
 	cin >> s >> t;
 	ll ans = 1e18;
 	for (ll i = 0; i <= sz(s) - sz(t); i++) {
 		ll ct = 0;
 		for (ll j = i; j < i + sz(t); j++) if (s[j] != t[j - i]) ct++;
 		ans = min(ans, ct);
 	}	
 	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3524
def max(a,b); a > b ? a : b; end
  
A_MAX = 100000

N, M = gets.split.map(&:to_i)
A = gets.split.map(&:to_i)
C = Array.new(A_MAX + 10, 0) # C[x] := A.count{|a| a >= x }; C[x] - C[x + 1] := A.count{|a| a == x }
S = Array.new(A_MAX + 10, 0) # S[x] := A.select{|a| a >= x }.sum

A.each{|a| C[a] += 1 }
A_MAX.downto(0) do |i| 
  S[i] = C[i] * i + S[i + 1]
  C[i] += C[i + 1]
end

ANS = {}

xy_ = (1 .. 2 * A_MAX + 1).bsearch do |xy|
  m = 0
  s = 0
  A.each do |x|
    next if xy - x > A_MAX
    y = max(xy - x, 0)
    m += C[y]
    s += S[y] + C[y] * x
  end
  
  ANS[xy] = s + (M - m) * (xy - 1) if m <= M

  m <= M
end
puts ANS[xy_]


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

int main() {
string s;
cin >> s;
int ans=0;
if(s[0]=='2')ans++;
if(s[1]=='2')ans++;
if(s[2]=='2')ans++;
if(s[3]=='2')ans++;
cout << ans << endl;
}


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

public class Main {
    static StringTokenizer st;
    static BufferedReader br;  
    static PrintWriter out;
 
    public static void main(String[] args) throws IOException {
        br = new BufferedReader(new InputStreamReader(System.in));

        HashMap<String, Integer> Judge_Status1 = new HashMap<String, Integer>();
        HashMap<Integer, String> Judge_Status2 = new HashMap<Integer, String>();

        Judge_Status1.put("AC", 0);
        Judge_Status1.put("WA", 1);
        Judge_Status1.put("TLE", 2);
        Judge_Status1.put("RE", 3);

        Judge_Status2.put(0, "AC");
        Judge_Status2.put(1, "WA");
        Judge_Status2.put(2, "TLE");
        Judge_Status2.put(3, "RE");

        int Map[] = new int[4];

        int N = nextInt();
 
        for (int i=0; i<N; i++) {
            Map[Judge_Status1.get(next())] ++;
        }

       
        for (int i=0; i<4; i++) {
            System.out.println(Judge_Status2.get(i) + " x " + Map[i]);
        }
        
    }
    
      
    public static int nextInt() throws IOException {
        return Integer.parseInt(next());
    }
    public static long nextLong() throws IOException {
        return Long.parseLong(next());
    }

    public static double nextDouble() throws IOException {
        return Double.parseDouble(next());
    }

    static String next() throws IOException {
        while (st == null || !st.hasMoreTokens())
            st = new StringTokenizer(br.readLine().trim());
        return st.nextToken();
    }
}


Measured memory_bytes: 48140
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
using P = pair<int,int>;

int main(void){
    double d, t, s;
  cin >> d >> t >> s;
  if(d / s > t) cout << "No" << endl;
  else cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 3716
/*
confirm 0LL and 1LL
confirm cornercases such as 0
confirm times of cin < 10^6
*/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
using Vec = vector<ll>;
using VecP = vector<P>;
using VecB = vector<bool>;
using VecC = vector<char>;
using VecS = vector<string>;
using VecVec = vector<Vec>;
using Tree = vector<VecP>;
#define REP(i, m, n) for(ll (i) = (m); (i) < (n); ++(i))
#define REPN(i, m, n) for(ll (i) = (m); (i) <= (n); ++(i))
#define REPR(i, m, n) for(ll (i) = (m)-1; (i) >= (n); --(i))
#define REPNR(i, m, n) for(ll (i) = (m); (i) >= (n); --(i))
#define rep(i, n) REP(i, 0, n)
#define repn(i, n) REPN(i, 1, n)
#define repr(i, n) REPR(i, n, 0)
#define repnr(i, n) REPNR(i, n, 1)
#define all(s) (s).begin(), (s).end()
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fs first
#define sc second
template <typename T>
bool chmax(T &a, const T& b){if(a < b){a = b; return true;} return false;}
template <typename T>
bool chmin(T &a, const T& b){if(a > b){a = b; return true;} return false;}
template <typename T>
void co(const T n){cout << n << endl;}
template <typename T>
void cosp(const T n){cout << n << ' ';}
void coVec(const Vec &v){for(ll i : v) cosp(i); cout << endl;}
void sonic(){ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);}
void setp(const ll n){cout << fixed << setprecision(n);}
const ll INF = 1e9+1;
const ll LINF = 1e18+1;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const double PI = acos(-1);
const double EPS = 1e-9;

int main(void){
	ll n;
	cin >> n;
	Vec c(n);
	rep(i, n) cin >> c[i];
	sort(all(c));
	reverse(all(c));

	ll sum = 0;
	rep(i, n){
		sum += (i+2)*c[i];
		sum %= MOD;
	}
	rep(i, n*2-2){
		sum *= 2;
		sum %= MOD;
	}
	co(sum);

	return 0;
}


Measured memory_bytes: 1792
from itertools import combinations
n = int(input())

march = 'MARCH'
dic = {c:0 for c in march}
for i in range(n):  
  s = input()
  if s[0] in march:
    dic[s[0]] += 1

c = combinations(march,3)    
ans = 0
for v1,v2,v3 in c:
  ans += dic[v1]*dic[v2]*dic[v3]  

print(ans)

Measured memory_bytes: 3064
n,q=map(int,input().split())
s=input()
t=[0]*(n+1)

for i in range(0,len(s)):
    if s[i:i+2]=="AC":
        t[i+1]=t[i]+1
    else:
        t[i+1]=t[i]        

for i in range(q):
    l,r=map(int,input().split())   
    print(t[r-1]-t[l-1])

Measured memory_bytes: 6060
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
const ll MOD=1e9+7;
void solve()
{
	ll n;
	cin>>n;
	ll c=0;
	for(ll i=1;i<=n;i++)
	{
		ll x;
		cin>>x;
		if(i%2==0) continue;
		if(x%2==1) c++;
	}
	cout<<c<<"\n";
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll T=1;
	//cin>>T;
	while(T--)
	{
		solve();
	}
	return 0;
}

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

typedef long long int ll;
typedef unsigned long long int ull;
#define rep(i,n) for(auto i=0;i<(n);i++)
#define rep1(i,n) for(auto i=1;i<=(n);i++)
#define all(x) (x).begin(),(x).end()

using namespace std;


struct init{ init(){ cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20); }; }aaaaaaa;



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

  
  ll cnt = 0;
  rep(i, 3){
    if(s[i] == t[i]) cnt++;
  }

  cout << cnt << endl;


  return 0;
}


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

double r(double x1,double y1,double x2,double y2){
	return sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
	
	}

int main() {
	// your code goes here
int a[13];
a[1]=31;
a[2]=29;
a[3]=31;
a[4]=30;
a[5]=31;
a[6]=30;
a[7]=31;
a[8]=31;
a[9]=30;
a[10]=31;
a[11]=30;
a[12]=31;

int m,d,z,y;
cin>>m>>d;
while(m!=0){
	if(m==0) z=d;
	else{
		z=d;
		for(int i=1;i<m;i++){
			z=z+a[i];
		}
	}
	y=z%7;
	if(y==1){
		cout<<"Thursday"<<endl;
	}
		if(y==2){
		cout<<"Friday"<<endl;
	}
		if(y==3){
		cout<<"Saturday"<<endl;
	}
		if(y==4){
		cout<<"Sunday"<<endl;
	}
		if(y==5){
		cout<<"Monday"<<endl;
	}
		if(y==6){
		cout<<"Tuesday"<<endl;
	}
		if(y==0){
		cout<<"Wednesday"<<endl;
	}
	
	cin>>m>>d;
}
	
	return 0;
}

Measured memory_bytes: 1156
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {
		// TODO ?????????????????????????????????????????????
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		
		String[] tmpArray;
		Card[] cards = new Card[n];
		for(int i = 0; i < n ; i++){
			tmpArray = br.readLine().split(" ");
			cards[i] = new Card(i, tmpArray[0], Integer.parseInt(tmpArray[1]));
		}
		
		quickSort(cards, 0, cards.length - 1);
		
		if(isStable(cards)){
			System.out.println("Stable");
		}
		else{
			System.out.println("Not stable");
		}
		StringBuffer sb = new StringBuffer();
		for(int i = 0; i < n; i++){
			sb.append(cards[i].toString()+"\n");
		}
		System.out.print(sb);

	}
	
	static boolean isStable(Card[] cards){
		int currentNum = 0;
		
		for(int i = 1; i < cards.length; i++){
			if(cards[i].number == currentNum && cards[i].id < cards[i - 1].id){
				return false;
			}
			
			else if(cards[i].number != currentNum){
				currentNum = cards[i].number;
			}
		}
		return true;
	}
	
	static void quickSort(Card[] cards, int p, int r){
		if(p < r){
			int q = partition(cards, p, r);
			quickSort(cards, p, q - 1);
			quickSort(cards, q + 1, r);
		}
	}
	
	static int partition(int[] array, int p, int r){
		int x = array[r];
		int i = p - 1;
		for(int j = p ; j <= r -1 ;j++){
			if(array[j] <= x){
				i++;
				int tmp = array[i];
				array[i] = array[j];
				array[j] = tmp;
				
			}
		}
		int tmp = array[i + 1];
		array[i + 1] = array[r];
		array[r] = tmp;
		return i + 1;
	}
	
	static int partition(Card[] array, int p, int r){
		int x = array[r].number;
		int i = p - 1;
		for(int j = p ; j <= r -1 ;j++){
			if(array[j].number <= x){
				i++;
				Card tmp = array[i];
				array[i] = array[j];
				array[j] = tmp;
				
			}
		}
		Card tmp = array[i + 1];
		array[i + 1] = array[r];
		array[r] = tmp;
		return i + 1;
	}
}

class Card {
	int id;
	String mark;
	int number;
	
	public Card (int id, String mark, int number){
		this.id = id;
		this.mark = mark;
		this.number = number;
	}
	
	public String toString(){
		return mark + " "  + number;
	}
}

Measured memory_bytes: 70252
#include <bits/stdc++.h>
 
#define Set(a, b) memset(a, (b), sizeof(a))
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define repi(i, l, r) for (int i=l ; i <= (int)(r) ; ++i)
#define repd(i, l, r) for (int i=r ; i >= (int)(l) ; --i)
#define all(cont) cont.begin(), cont.end()
#define Sort(n) sort(all(n))
#define INF (int)1e9
#define EPS 1e-9
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
#define ll long long
#define ull unsigned long long

/* ASCII Table */
/* 48 == '0', 57 = '9', 65 == 'A', 90 == 'Z', 97 == 'a', 122 == 'z' */  

using namespace std;
 
int main()
{
    long n;

    cin >> n;

    if(n % 2)
        cout << (n/2) * ((n / 2) + 1);
    else
        cout << (n/2) * (n/2);

    cout << endl;

    return 0;
}
 
 
 
/* Source code dengan case
 
int main(){
    int T;
    cin >> T;
    for(int counterT = 1 ; counterT <= T ; T++){
         
        printf("%d\n", ans);
    }
    return 0;
}
 */
 
/* Source code dengan case
 
int main(){
    int T;
    cin >> T;
    for(int counterT = 1 ; counterT <= T ; T++){
         
        printf("Case #%d: %d\n", counterT, ans);
    }
    return 0;
}
 */

Measured memory_bytes: 256
N = int(input())
li = [list(input().split()) for _ in range(N)]

money = 0
for i in range(N):
    if li[i][1] == 'JPY':
        money += float(li[i][0])
    else:
        money += 380000.0 * float(li[i][0])

print(money)


Measured memory_bytes: 2940
N, M = map(int, input().split())
A = [int(input()) for _ in range(M)]
inf = float("inf")
dp = [0] * (N+1)
for i in A:
	dp[i] = inf
dp[0] = 1
if dp[1] != inf:
	dp[1] = 1
for i in range(2,N+1):
	if dp[i] == inf:
		continue

	a = dp[i-2] if dp[i-2] != inf else 0
	b = dp[i-1] if dp[i-1] != inf else 0

	dp[i] = (a + b) % 1000000007


print(dp[N])

Measured memory_bytes: 52568
#include <bits/stdc++.h>
using namespace std;
int main(){
  long long n;
  cin>>n;
  long long ans=1;
  for(long long i=2;i<=n;i++){
    ans*=i;
    ans%=1000000007;
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3

num2alpha = lambda c: chr(c+64)
# def num2alpha(c):
#     if c == 0:
#         return "z"
#     else:
#         return chr(c + 64)

n = int(input())

r_num = []
s = n
# r_num = [0]
while s > 0:
    new_r = s % 26
    new_s = s // 26

    if new_r == 0:
        new_s -= 1
        new_r = 26

    r_num.append(new_r)
    s = new_s


r = ""
for x in r_num[::-1]:
    r += num2alpha(x)

# print(r_num)
print(r.lower())

# print(num2alpha(0))s

Measured memory_bytes: 9124
n=input()
ans=0
anss=[]
for i in range(len(n)):
    
    if n[i] == "A" or n[i] == "T" or n[i] == "G" or n[i] == "C":
        ans += 1
        anss.append(ans)
    else:
        anss.append(ans)
        ans=0

import numpy as np
anss=np.array(anss)
print(anss.max())

Measured memory_bytes: 12500
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#include <limits.h>
#include <stdbool.h>

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

//qsort(str, n, sizeof(int), up_comp);
int up_comp(const void *a, const void *b){return *(int*)a - *(int*)b;}
int down_comp(const void *a, const void *b){return *(int*)b - *(int*)a;}
int int_sort( const void * a , const void * b ) {return strcmp(( char * )a , ( char * )b );}
int count_digit(int a){int i=0;while(a!=0){a=a/10;i++;}return i;}
int euclid( int a, int b ){int temp;if(a<b){temp=a;a=b;b=temp;}if(b<1)return -1;if(a%b==0) return b;return euclid(b,a%b);}

int main(void){
 
    int n, d, x[max], y[max];
    int ans=0;
    
    scanf("%d%d", &n, &d);
    rep(i, n){
        scanf("%d%d", &x[i], &y[i]);
        if (sqrt(pow(x[i], 2)+pow(y[i], 2))<=d) {
            ans++;
        }
    }
    
    printf("%d", ans);
    
    return 0;
}


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

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

  vector<string> a;

  for (int k = 0; k < (int)s.size(); k++) {
    for (int l = 1; l <= 5; l++) {
      a.push_back(s.substr(k, l));
    }
  }
  sort(a.begin(), a.end());
  unique(a.begin(), a.end());

  cout << a[pos-1] << endl;

  return 0;
}

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

int  main()
{
	long N,M;
	cin >> N >> M;
	vector<P> a(N);//student
	vector<P> c(M);//check point
	rep(i, N)
	{
		cin >> a[i].first >> a[i].second;
	}
	rep(i, M)
	{
		cin >> c[i].first >> c[i].second;
	}
	vector<long> ans;
	rep(i, N)
	{
		long min = LONG_MAX;
		long ord;
		rep(j, M)
		{
			if ((labs(a[i].first - c[j].first) + labs(a[i].second - c[j].second)) < min)
			{
				min = labs(a[i].first - c[j].first) + labs(a[i].second - c[j].second);
				ord = j + 1;
			}
		}
		ans.push_back(ord);
	}
	rep(i, N)
		cout << ans[i] << endl;
	return (0);
}


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

int main() {
  int N;
  cin>>N;
  vector<char> W(N);
  for (int i = 0; i < N; i++) {
    cin >> W.at(i);
  }
  int a=0;
  if(N%2==0){
    
    for (int i = 0; i < N/2; i++) {
      if (W.at(i)==W.at(N/2+i)){
      a++;
      } 
    }
    if(a==N/2){
      
    cout<<"Yes"<<endl;
    }
    else{
      cout <<"No"<<endl;
    }
  }
  else{
    cout<<"No"<<endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h> 
using namespace std;
const int maxn = 60;
int n, m, a[maxn][maxn];
int f(int x, int y) {
	if (x < 1 || y < 1 || x > n || y > m) return 0;
	if (a[x][y] == '#') return 1;
	return 0;
}
int main() {
	scanf("%d %d\n", &n, &m);
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= m; j++)
			a[i][j] = getchar();
		getchar();
	}
	for (int i = 1; i <= n; i++)
		for (int j = 1; j <= m; j++)
			if (a[i][j] == '.') {
				a[i][j] = 
					f(i + 1, j) +
					f(i - 1, j) +
					f(i, j + 1) +
					f(i, j - 1) +
					f(i + 1, j + 1) +
					f(i + 1, j - 1) +
					f(i - 1, j + 1) +
					f(i - 1, j - 1); 
			}
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= m; j++)
			if (a[i][j] == '#') putchar('#');
			else printf("%d", a[i][j]);
		puts("");
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ALL(A) A.begin(), A.end()
#define MEM(a, b) memset(a, b, sizeof(a))
#define FOR(n) for (int i = 0; i < n; ++i)
#define FOR_(n) for (int i = 1; i <= n; ++i)
#define FOR_J(n) for (int j = 0; j < n; ++j)
#define FOR_J_(n) for (int j = 1; j <= n; ++j)
#define IT_FOR(A) for (auto i = A.begin(); i != A.end(); ++i)
#define INF 0x3f3f3f3f
#define N ((int)1e6)
//#define max(_a,_b) (((_a) > (_b)) ? (_a) : (_b))
//#define min(_a,_b) (((_a) < (_b)) ? (_a) : (_b))
const int mod = 1000000007;
typedef long long ll;

inline int read() {
	int x = 0, w = 1;
	char ch = 0;
	while (ch < '0' || ch > '9') {
		if (ch == '-') w = -1;
		ch = getchar();
	}
	while (ch >= '0' && ch <= '9') {
		x = x * 10 + (ch - '0');
		ch = getchar();
	}
	return x * w;
}

int main()
{
	//freopen("in.txt", "r", stdin);
	//freopen("wa4.txt","w",stdout);
	int _ = 1;
	//_ = read();	
	while (_--) {
		int num[200000] = { 0 };
		int q, n, x;
		ll sum = 0;
		n = read();
		FOR(n) {
			x = read();
			num[x]++;
			sum += x;
		}
		q = read();
		while (q--){
			int a, b;
			a = read();
			b = read();
			num[b] += num[a];
			sum += num[a] * (b - a);
			num[a] = 0;
			printf("%lld\n", sum);
		}
	}
	return 0;
}

Measured memory_bytes: 4528
#include <bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define INF 1145141919
int dy[] = {0, 0, 1, -1};
int dx[] = {1, -1, 0, 0};
int ny, nx;
typedef long long int ll;
using namespace std;

int gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }

ll lcm(ll m, ll n)
{
    if ((0 == m) || (0 == n))
        return 0;
    return ((m / gcd(m, n)) * n);
}

ll llpow(ll x, ll y)
{
    ll ans = 1;
    REP(i, y)
    ans *= x;
    return ans;
}

int ctoi(char c)
{
    if (c >= '0' && c <= '9')
    {
        return c - '0';
    }
    return 0; 
}
////////////////////////////////////////////////////////////////////
int main(){

    int N; cin >> N;
    vector<int> A(N);
    REP(i,N) cin >> A[i];

    vector<int> L(N),R(N);
    int ans=1;

    for(int i=0; i<N-1; i++) L[i+1] = gcd(L[i],A[i]);
    for(int i=N-1; i>=1; i--) R[i-1] = gcd(R[i],A[i]);
    for(int i=0; i<N; i++) ans= max(ans,gcd(L[i], R[i]));

    cout << ans << endl;

    return 0;

}

Measured memory_bytes: 1408
import java.util.*;

public class Main {

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

    if(a * b % 2 != 0) {
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }
  }

}


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

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

Measured memory_bytes: 256
n, m = map(int, input().split())


def div(n):
    res = []
    for i in range(1, int(n ** 0.5) + 1):
        if n % i == 0:
            res.append((n // i, i))
            if n != i * i:
                res.append((i, n//i))
    return sorted(res)


d = div(m)
ans = 0
for x, y in d:
    if y >= n:
        ans = max(ans, x)

print(ans)


Measured memory_bytes: 3060
from collections import deque

MOD = 1000000007
n, k = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(n-1)]
edges = [set() for _ in range(n)]
visited = [False for _ in range(n)]
for a, b in AB:
    edges[a-1].add(b-1)
    edges[b-1].add(a-1)

def perm(n, r):
    if n < r or r < 0:
        return 0
    tmp = 1
    for i in range(n, n-r, -1):
        tmp *= i
        tmp %= MOD
    return tmp

q = deque([0])
visited[0] = True
first = True
ans = k
while q:
    v = q.popleft()
    visited[v] = True
    children = list(filter(lambda x: not visited[x], edges[v]))
    if first:
        ans *= perm(k-1, len(children))
        ans %= MOD
        first = False
    else:
        ans *= perm(k-2, len(children))
        ans %= MOD
    q.extend(children)
print(ans)


Measured memory_bytes: 63748
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define ALL(v) ((v).begin(),(v).end())
using namespace std;

int main(){
    int n=2;
    cin >> n;
    int a[n+1], b[n];
    REP(i,n+1) cin >> a[i];
    REP(i,n) cin >> b[i];

    int val;
    long long ans=0;
    REP(i,n){
        // i番目の勇者、i番目の街の敵
        val = min(b[i], a[i]);
        ans += val;
        b[i] -= val;

        // i番目の勇者の残りKill数、i+1番目の街の敵
        val = min(b[i], a[i+1]);
        ans += val;
        a[i+1] -= val;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include <queue>
#include <utility>
#include <map>
#include <set>
#include <deque>
using namespace std;

string YorN(bool P) { if(P)return "Yes"; else return "No"; }

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

    cout << YorN((N[0]==N[1]&&N[1]==N[2])|| (N[1] == N[2] && N[2] == N[3])) << endl;

    return 0;

}

Measured memory_bytes: 256
fun main(args: Array<String>) {
    val (X, Y, Z) = listOfInt()
    println("$Z $X $Y")
}


fun next() = readLine()!!
fun nextInt(delta: Int = 0) = Integer.parseInt(next()) + delta
fun nextLong() = next().toLong()
fun nextDouble() = next().toDouble()
fun listOfString() = next().split(" ")
fun listOfInt() = listOfString().map(String::toInt)
fun listOfLong() = listOfString().map(String::toLong)
fun listOfDouble() = listOfString().map(String::toDouble)
fun listOfInt(delta: Int = 0) = listOfString().map { Integer.parseInt(it) + delta }
fun listOfInt(vararg offset: Int) = listOfString().map { Integer.parseInt(it) }.mapIndexed { index, int -> int + offset[index % offset.size] }
fun listOfLong(delta: Long = 0L) = listOfString().map { java.lang.Long.parseLong(it) + delta }
fun listOfLong(vararg offset: Long) = listOfString().map { java.lang.Long.parseLong(it) }.mapIndexed { index, long -> long + offset[index % offset.size] }
fun listOfDouble(delta: Double = 0.0) = listOfString().map { java.lang.Double.parseDouble(it) + delta }
fun pairIntLong() = listOfLong().let { Pair(it[0].toInt(), it[1]) }
fun tripleIntIntLong() = listOfLong().let { Triple(it[0].toInt(), it[1].toInt(), it[2]) }
fun tripleIntLongLong() = listOfLong().let { Triple(it[0].toInt(), it[1], it[2]) }
fun pairIntLong(offset: Pair<Int, Long> = Pair(0, 0L)) = listOfLong().let { Pair(it[0].toInt() + offset.first, it[1] + offset.second) }
fun tripleIntIntLong(offset: Triple<Int, Int, Long> = Triple(0, 0, 0L)) = listOfLong().let { Triple(it[0].toInt() + offset.first, it[1].toInt() + offset.second, it[2] + offset.third) }
fun tripleIntLongLong(offset: Triple<Int, Long, Long> = Triple(0, 0L, 0L)) = listOfLong().let { Triple(it[0].toInt() + offset.first, it[1] + offset.second, it[2] + offset.third) }

//val ans = if (good) "Yes" else "No"




Measured memory_bytes: 38264
#include <stdio.h>
int main(void){
    // Your code here!
    int a,b,c=0;
    
    scanf("%d %d",&a,&b);
    
    if(a <= 5){
        c = b*0;
        printf("%d",c);
    } else if(13 <= a){
        printf("%d",b);
    }else {
        c = b/2;
        printf("%d",c);
    } 
    
    return 0;
}


Measured memory_bytes: 128
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt(); //荷物の個数
        int k = sc.nextInt(); //トラックの台数
        int[] w = new int[n]; //各荷物の重量
        int l = 0;
        for (int i=0; i<n; i++) {
            w[i] = sc.nextInt();
            l += w[i];
        }
        //二分探索を使う
        int left = 0;
        int right = l;
        int mid = 0;
        while(right-left>1) {
            mid = (left+right) / 2;
            int j = check(mid,k,w);
            if(j>=n) right = mid;
            else left = mid;
        }
        System.out.println(right);
    }

    static int check(int mid, int k, int[] w) {
        int sum = 0;
        int j = 0;
        for (int i=0; i<k; i++) {
            sum = 0;
            while(sum+w[j]<=mid) {
                sum+=w[j];
                j++;
                if(j==w.length) return w.length;
            }
        }
        return j;
    }
}



Measured memory_bytes: 71104
import java.util.Scanner;

public class Main {
	
    public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
    	
    	int N = sc.nextInt();
    	
    	double sum = 0;
    	for( int i = 0; i < N; i++ ) {
    		double x = sc.nextDouble();
    		String u  = sc.next();
    		if( u.equals("JPY") ) {
    			sum += x;
    		}
    		else {
    			sum += x * 380000.0;
    		}
    	}
    	System.out.println( sum );
    	sc.close();
    }
}

Measured memory_bytes: 22868
#include <bits/stdc++.h>
using namespace std;
using vi=vector<int>;
using vvi=vector<vi>;
using vs=vector<string>;
using msi=map<string,int>;
using pii=pair<int,int>;
using vlai=valarray<int>;
using ll=long long;
#define rep(i,n) for(int i=0;i<n;i++)
#define range(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()

int main(void){
    int n;cin>>n;
    map<int,int> v;
    rep(i,n){
        int p;cin>>p;
        if(v.find(p)==v.end())v[p]=0;
        v[p]++;
    }
    int ans=0;
    for(auto p : v){
        if(p.second>p.first){
            ans+=p.second-p.first;
        }
        if(p.second<p.first){
            ans+=p.second;
        }
    }
    cout<<ans;
}


Measured memory_bytes: 4736
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
int n,m,cnt[1005],grundy[1005],in[1005],sum[155];
vector<int>edge[1005];

int main(){
    cin>>n>>m;
    rep(i,n) cin>>cnt[i];
    rep(i,m){
        int a,b; cin>>a>>b;
        a--; b--;
        edge[a].push_back(b);
        in[b]++;
    }
    queue<int>que;
    vector<int>process;
    rep(i,n) if(!in[i]) que.push(i);
    while(!que.empty()){
        int q = que.front(); que.pop();
        process.push_back(q);
        rep(i,edge[q].size()){
            int to = edge[q][i];
            in[to]--;
            if(in[to] == 0) que.push(to);
        }
    }
    reverse(process.begin(),process.end());
    memset(grundy,-1,sizeof(grundy));
    //v's actual grundy number is 2^grundy[v]
    rep(i,process.size()){
        int cur = process[i];
        set<int>S;
        rep(j,edge[cur].size()){
            int to = edge[cur][j];
            S.insert(grundy[to]);
        }
        rep(i,150) if(S.find(i) == S.end()){
            grundy[cur] = i;
            break;
        }
    }
    rep(i,n){
        if(cnt[i]%2 == 1) sum[grundy[i]]++;
    }
    rep(i,155){
        if(sum[i]%2 == 1){
            puts("1"); return 0;
        }
    }
    puts("2");
}


Measured memory_bytes: 3300
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1e18

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

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

    ll func(ll h){
        if(h==1){
            return 1;
        }
        return 2*func(h/2)+1;
    }


int main(){
    ll h;
    cin >> h;

    if(h==1){
        cout << 1 << endl;
      //  cout << "manji" << endl;
    }
    else{
        cout << func(h) << endl;
    
    }

    return 0;
}

Measured memory_bytes: 3612