akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
#define tii tuple<int,int,int>
#define Priq priority_queue<int,vi,greater<int>>
#define pb push_back
#define mp make_pair
signed main(){
  int N,K; cin>>N>>K;
  vector<double> A(N);
  rep(i,0,N){
    cin>>A[i];
    A[i]=(A[i]+1)*1.0/2;
  }
  double sum=0;
  double ans=0;
  rep(i,0,K) sum+=A[i];
  ans=sum;
  rep(i,K,N){
    sum-=A[i-K];
    sum+=A[i];
    ans=max(ans,sum);
  }
  printf("%.10lf\n",ans);
  }



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

int main()
{
    int n, q;
    int cnt = 0;                            //カウント

    cin >> n;                               //数列sの入力処理
    int s[n];
    for( int i = 0; i < n; i++ )
        cin >> s[i];                        //ここまで

    cin >> q;                               //数列tの入力処理
    int t[q];
    for( int i = 0; i < q; i++ )
        cin >> t[i];                        //ここまで

    for( int i = 0; i < n; i++ )
    {
        for( int j = 0; j < q; j++ )
        {
            if( s[i] == t[j] )
            {
                cnt++;
                t[j] = -1;                  //同じ数字は数えない
                break;
            }
        }
    }

    cout << cnt << endl;

    return 0;
}


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

void trace(int A[], int N) {
        int i;
        for (i = 0; i < N; i++) {
                if (i > 0) cout << " ";
                cout << A[i];
        }
        cout << endl;
}       

void insertionSort(int A[], int N) {
        int j, i, v;
        for(i = 1; i < N; i++) {
                v = A[i];
                j = i - 1;
                while (j >= 0 && A[j] > v) {
                        A[j + 1] = A[j];
                        j--;
                }
                A[j + 1] = v;
                trace(A, N);
        }
}

int main() {
        int A[100], N, i, j;
        cin >> N;
        for(i = 0; i < N; i++) cin >> A[i];
        trace(A, N);
        insertionSort(A, N);
        return 0;
}       

Measured memory_bytes: 3088
/**
 *  author: Behradm
 *  Created: 2020.06.21 16:15:45
 *  In The Name Of God
**/
#include <bits/stdc++.h>

using namespace std;

int main() {   
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }    

  sort(a.begin(), a.end());
  long long res = 0;
  for (int i = 0; i < k; i++) {
    res += a[i];
  }

  cout << res << '\n';
  return 0;
}


Measured memory_bytes: 3668
#include <bits/stdc++.h>
#include <complex>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define fi first
#define se second
#define mp make_pair
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,K,Q,A,B,C,L,R;
string S,T;
const ll MOD = (1e+9) + 7;
const ll INF = 1LL << 60;
const long double EPS = 1e-9;
typedef pair<ll,ll> P;

typedef vector<P> vp;
typedef vector<vp> matP;

int main()
{
    // �����̓���
    string S;
    
    cin >> S;
    
    int renzoku = 0;
    int ans = 0;
    
    S += "0";
    for (int i = 1; i < S.length(); ++i) {
        if (S[i] == S[i - 1]){
            renzoku++;
        } else {
            int res = renzoku % 3;
            int q   = renzoku / 3;
            
            if (res == 2){
                ans += q * 2 + 2;
            } else if (res == 1){
                ans += q * 2 + 1;
                if (i < S.length() - 1){
                    i++;
                    ans++;
                }
            } else {
                ans += q * 2 + 1;
            }
            //fprintf(stderr, "i = %d, renzoku = %d, ans = %d\n", i, renzoku + 1, ans);
            renzoku = 0;
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 640
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
#include <string>
#include <cmath>
#include <set>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
const int INF = 1<<29;

typedef pair<int,int> pii;
int main() {
  int n,m;
  while(cin >> n >> m,n||m) {
    vector<int> v[n];
    while(m--) {
      int a, b;
      cin >> a >> b;
      a--;b--;
      v[a].push_back(b);
      v[b].push_back(a);
    }
    set<int> se;
    se.insert(0);
    FOR(it,v[0]) {
      se.insert(*it);
      FOR(jt, v[*it])
        se.insert(*jt);
    }
    cout << se.size()-1 << endl;
  }
}

Measured memory_bytes: 0
#define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, m, n) for(int i=(m); i<(n); ++i)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define Cout(x) cout << (x) << endl
#define dump(x) cerr << #x << " = " << (x) << endl;
typedef long long LL;
typedef vector<int> VI;
typedef vector<long long> VL;
typedef vector<string> VS;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
const int inf = (int)1e9;
const long long mod = (long long)1e9 + 7;
const double pi = acos(-1.0);
//文字列分割
vector<int> split(string str, char del) {
	vector<int> re; string sub;
	for (char c : str) {
		if (c == del) re.push_back(stoi(sub)), sub.clear();
		else sub += c;
	}
	re.push_back(stoi(sub));
	return re;
}

int main() {
	string S;
	while (cin >> S) {
		VI vec = split(S, ',');
		VI l(10); rep(i, 10)l[i] = vec[i];
		VI v(2); rep(i, 2)v[i] = vec[i + 10];

		int sum = accumulate(all(l), 0);
		double a = (double)sum / (v[0] + v[1]) * v[0];
		int ans = 0;
		rep(i, 10) {
			if (a <= l[i]) { ans = i + 1; break; }
			a -= l[i];
		}
		Cout(ans);
	}
}


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

int main() {
  int N;
  cin >> N;
  vector<int> vec(N);
  for (int i = 0; i < N; i++) {
    cin >> vec.at(i);
  }
  sort(vec.begin(), vec.end());
  cout << vec[N-1] - vec[0] << endl;

}


Measured memory_bytes: 256
n,k=map(int,input().split())
A=list(map(int,input().split()))
cnt=0
s=1
M=[0]
B=[0]*(n+1)
while cnt<n:
    s=A[s-1]
    if B[s-1]==0:
        B[s-1]+=1
    else:
        imp=s-1
        break
    M.append(s-1)
    cnt+=1
x=M.index(imp)
y=len(M)-x

if k<=x:
    print(M[k]+1)
else:
    N=M[x:]
    print(N[(k-x)%y]+1)

Measured memory_bytes: 32400
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		int Y = scan.nextInt();
		
		for(int x=0;x<=N;x++) {
			for(int y=0;y<=N-x;y++) {
				int total = x*10000 + y*5000 + 1000*(N-x-y);
				if(total==Y) {
					System.out.println(x+" "+y+" "+(N-x-y));
					return;
				}
			}
		}
		System.out.println("-1 -1 -1");
	}
}

Measured memory_bytes: 39276
using System;
using static System.Console;
using System.Collections.Generic;
using System.Linq;

namespace Atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = InputNum();
            WriteLine(800 * n - 200 * (n / 15));
        }

        static int InputNum()
        {
            return int.Parse(ReadLine());
        }
        static List<int> InputNumList()
        {
            return ReadLine().Split(' ').Select(int.Parse).ToList();
        }
    }
}



Measured memory_bytes: 13140
#include <iostream>
#include <string>
#include <cmath>
#include <vector>
using namespace std;

int main() {
    int n;
    cin >> n;
    vector<int> v(n);
    for(int i=0; i<n; ++i) {
        cin >> v[i];
    }
    int res = -1;
    for(int i=0; i<n; ++i) {
        for(int j=i+1; j<n; ++j) {
            int tmp = v[i]*v[j];
            string s = to_string(tmp);
            bool ok = true;
            for(int k=0; k<s.size()-1; ++k) {
                if(s[k]+1 != s[k+1]) {
                    ok = false;
                    break;
                }
            }
            if(ok) {
                res = max(res, tmp);
            }
        }
    }
    cout << res << endl;
}


Measured memory_bytes: 3288
#include<bits/stdc++.h>
using namespace std; 
#define ll long long int
#define pb push_back
#define mp make_pair
#define pll pair<ll,ll>
#define INF LLONG_MAX
#define PI acos(-1)
#define MOD 1e9 + 7
#define fir first
#define sec second
#define all(x) x.begin(),x.end()
#define mem(a,b) memset(a,b,sizeof(a))
#define rep(c,a,b) for(ll c=a;c<b;c++)
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
bool cmp(ll a,ll b)
{
	return (a>b);
}
ll w,h,white=0,black=0;
bool vis[600][600];
vector<string> a;

ll dx[4] = {0,0,1,-1};
ll dy[4] = {1,-1,0,0};
bool in(ll m,ll n)
{ 
	return (m>=0 && m<h && n>=0 && n<w);
}
void dfs(ll i,ll j)
{
	vis[i][j]=1;
	if(a[i][j]=='#')
		black++;
	else
		white++;
	for(ll k=0;k<4;k++)
	{
		ll ni=i+dx[k];
		ll nj=j+dy[k];
		
		if(!in(ni,nj))
			continue;
		if(a[i][j]==a[ni][nj])
			continue;
		if(vis[ni][nj])
			continue;
		dfs(ni,nj);
	}
}
int main()
{
	IOS
	cin>>h>>w;
	a.resize(h);
	ll i=0,j=0,ans=0;
	char ch;
	for(i=0;i<h;i++)
	{
		cin>>a[i];
	}
	for(i=0;i<h;i++)
	{
		for(j=0;j<w;j++)
		{
			black = 0;
			white = 0;
			if(vis[i][j])
			{
				continue;
			}
			dfs(i,j);
			ans+=white*black;
		}
	}
	cout<<ans;
}

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

const int MOD = 1000000007;
typedef pair<long long, long long> Pairs;

long long n;
map<Pairs, int> dp;

inline void Add(int &x, int a) {
	x += a; while (x >= MOD) x -= MOD;
}
inline int Calc(long long u, long long v) {
	if (v < 0) return 0;
	if (!v) return 1;
	if (dp.count(Pairs(u, v))) return dp[Pairs(u, v)];
	int res = 0;
	Add(res, Calc(u >> 1, v >> 1));
	Add(res, Calc((u - 1) >> 1, (v - 1) >> 1));
	if (v >= 2) Add(res, Calc(u >> 1, (v - 2) >> 1));
	return dp[Pairs(u, v)] = res;
}

int main(void) {
	cin >> n;
	cout << Calc(n, n) << endl;
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
#include <cmath>
#include <iomanip>
#include <deque>
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;i++)

using namespace std;
ll intpow(ll N, ll P){
    if(P==0) return 1;
    if(P%2==0){
        ll t = intpow(N, P/2);
        return t*t;
    }
    return N * intpow(N, P-1);
}
ll modpow(ll N, ll P,ll k){
    if(P==0) return 1;
    if(P%2==0){
        ll t = modpow(N, P/2,k)%k;
        return t*t%k;
    }
    return N * modpow(N, P-1,k)%k;
}
ll modkai(ll n,ll m,ll k){//n*(n-1)*(n-2)*...(m+1)%k
    if(n == m)return 1;
    return modkai(n-1,m,k)*n%k;
}
ll mod_cnb(ll n,ll m,ll k){//nCm%k,kは十分大きい素数
  int m_=modkai(m,0,k);
  return modkai(n,n-m,k)*modpow(m_,k-2,k)%k;
}
ll gcd(ll n,ll m){
    n = max(n,m);
    m = min(n,m);
    if(n%m == 0)return m;
    return gcd(m,n%m);
}
ll lcm(ll n,ll m){
    return n*m/gcd(n,m);
}
int main(){
    int n;cin>>n;
    vector<int> l;
    l.resize(n);
    rep(i,n)cin>>l[i];
    sort(l.begin(),l.end());
    int cnt=0;
    for(int i=n-1;i>1;i--){
        for(int j=i-1;j>0;j--){
            int d = distance(l.begin(),lower_bound(l.begin(),l.end(),l[i]-l[j]+1));
            if(d<j)cnt += j-d;
        }
    }
    cout << cnt << endl;
}

Measured memory_bytes: 256
n,k=map(int,input().split())
h=list(map(int,input().split()))
 
cost=[10**9]*n
cost[0]=0
for i in range(1,n):
  for j in range(1,min(i+1,k+1)):
    cost[i]=min(cost[i],cost[i-j]+abs(h[i]-h[i-j]))
print(cost[-1])

Measured memory_bytes: 84736
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author dyominov
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        AABC333 solver = new AABC333();
        solver.solve(1, in, out);
        out.close();
    }

    static class AABC333 {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int a = in.nextInt();
            int b = in.nextInt();
            out.print(a * b % 2 == 0 ? "No" : "Yes");
        }

    }

    static class InputReader implements AutoCloseable {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public void close() {
        }

    }
}



Measured memory_bytes: 21588
#include<bits/stdc++.h>
using namespace std;
typedef  long long ll;
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
//自作関数
template<class T> ll llpow(T x,T n){ll ans=1;while(n--){ans*=x;}return ans;}

#define rep(i,n) for(ll i=0;i<(ll)n;i++)
#define rep2(i, begin_i, end_i) for (ll i = (ll)begin_i; i < (ll)end_i; i++)

long long INF = 1LL<<60;
long long mi = -(1LL<<60);
int n;
int main(){
    cin>>n;
    int happiness[3][n];
    rep(i,n)rep(j,3)cin>>happiness[j][i];
    ll dp[3][n+10];
    rep(i,3)rep(j,n+5)dp[i][j]=mi;
    dp[0][0]=happiness[0][0];
    dp[1][0]=happiness[1][0];
    dp[2][0]=happiness[2][0];
    rep2(i,1,n){
        rep(j,3){
        if(j!=0)chmax(dp[j][i],dp[0][i-1]+happiness[j][i]);
        if(j!=1)chmax(dp[j][i],dp[1][i-1]+happiness[j][i]);
        if(j!=2)chmax(dp[j][i],dp[2][i-1]+happiness[j][i]);
        }
    }

    cout<<max({dp[0][n-1],dp[1][n-1],dp[2][n-1]})<<endl;
    return 0;
}




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

void hantei(vector<vector<int>> data) {
  int x = 0;
  
  for (int i = 0; i < 3; i++) {
    if (data.at(i).at(0) == 0 && data.at(i).at(1) == 0 && data.at(i).at(2) == 0) {
      x++;
      break;
    }
    else if (data.at(0).at(i) == 0 && data.at(1).at(i) == 0 && data.at(2).at(i) == 0) {
      x++;
      break;
    }
  }
  
  if (data.at(0).at(0) == 0 && data.at(1).at(1) == 0 && data.at(2).at(2) == 0) {
    x++;
  }
  else if (data.at(0).at(2) == 0 && data.at(1).at(1) == 0 && data.at(2).at(0) == 0) {
    x++;
  }
  
  if(x == 0) {
    cout << "No" << endl;
  }
  else {
    cout<< "Yes" << endl;
  }
}

  
int main() {
  vector<vector<int>> data(3, vector<int>(3, 0));
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
      cin >> data.at(i).at(j);
    }
  }
  
  int N, b;
  cin >> N;

  for (int k = 0; k < N; k++) {
    cin >> b;
    for (int i = 0; i < 3; i++) {
      for(int j = 0; j < 3; j++) {
        if (data.at(i).at(j) == b) {
          data.at(i).at(j) = 0;
        }
      }
    }
  }
  
  hantei(data);
}


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

#define int long long

signed main(){

    int n;cin >> n;
    vector<int> x(n);
    vector<int> y(n);
    for(int i = 0, i_len = (int)n; i < i_len; ++i){
        cin >> x[i] >> y[i];
    }

    if(n == 1) {cout << 1 << endl; return 0;}

    int ans = n;
    for(int i = 0; i < n; ++i){
        for (int j = 0; j < n; ++j)
        {
            if(i == j) continue;
            int dx = x[j] - x[i], dy = y[j] - y[i];

            int cnt = 0;
            for (int m = 0; m < n; ++m)
            {
                for (int k = 0; k < n; ++k)
                {
                    if(m == k) continue;
                    if(dx == x[k] - x[m] && dy == y[k] - y[m]) ++cnt;
                }
                
            }
            ans = min(ans, n-cnt);
        }
        
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
int dp[100005];
int a[100005];
int n;
int func(int ind)
{
    if(ind==n-1)return 0;
    if(ind>=n) return INT_MAX;

    if(dp[ind]!=-1) return dp[ind];

    int left = abs(a[ind]-a[ind+1]) + func(ind+1);
    int right = INT_MAX;

    if(ind+2<n){
        right = abs(a[ind]-a[ind+2]) + func(ind+2);
    }
    return dp[ind] = min(left,right);
}

int main()
{
    memset(dp,-1,sizeof dp);
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    cout<<func(0);
    return 0;
}

///Alhamdulillah


Measured memory_bytes: 9088
n, m = gets.split.map(&:to_i)

MOD = 1_000_000_007

as = Array.new(n + 3, 0)
m.times do
  a = gets.to_i
  as[a] = -1
end

as[0] = 1

0.upto(n) do |i|
  next if as[i] == -1
  
  if as[i + 1] != -1
    as[i + 1] += as[i]
    as[i + 1] %= MOD
  end

  if as[i + 2] != -1
    as[i + 2] += as[i]
    as[i + 2] %= MOD
  end
end

p as[n]


Measured memory_bytes: 2812
#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#include <functional>
#include <map>
#include <iomanip>
#include <math.h> 
#include <stack>
#include <queue>
#include <bitset>
#include <cstdlib>
#include <tuple>
#include <cctype>
#include <ctype.h>
#include <set>

using namespace std;

int main() {
	int i, j, k;
	long n, x;
	vector<long>num;
	vector<long>sasa;

	cin >> n >> x;

	for (i = 0; i < n; i++) {
		long nn;
		cin >> nn;

		num.push_back(nn);
	}


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

	long minn = 99999999999;

	for (i = 0; i < n - 1; i++) {
		long sa = num[i + 1] - num[i];
		auto itr = find(sasa.begin(), sasa.end(), sa);
		if (itr == sasa.end()) {    
			sasa.push_back(sa);
		}
		minn = min(sa, minn);
	}

	sort(sasa.begin(), sasa.end());
	long minn2 = 9999999999;

	long saa1 = -1, saa2 = -1;

	if (x < num[0]) {
		saa1 = num[0] - x;
	}
	else if (x > num[n - 1]) {
		saa2 = x - num[n - 1];
	}
	else {

		for (i = 0; i < n; i++) {
			if (num[i] > x) {
				saa1 = x - num[i - 1];
				saa2 = num[i] - x;
				break;
			}
		}

	}

	for (i = 0; i < n; i++) {
		//long sa = abs(num[i] - x);
		long sa;

		if (num[i] >= x) {
			sa = num[i] - x;
		}
		else {
			sa = x - num[i];
		}

		if (sa == 0)continue;

		minn2 = min(sa, minn2);
	}

	minn2 = min(minn, minn2);
	bool flag2 = false;

	while (true) {

		flag2 = false;

		for (i = 0; i < sasa.size(); i++) {
			if (sasa[i] % minn2 != 0) {
				minn2--;
				flag2 = true;
				break;
			}

		}

		if (flag2 == false )break;
	}



	if (saa1 != -1 && saa2 == -1) {
		while (true) {
			bool flag3 = false;

			for (i = 0; i < n - 1; i++) {
				if (saa1 % minn2 != 0) {
					minn2--;
					flag3 = true;
					break;
				}

			}

			if (flag3 == false) break;
		}
	}
	else if (saa1 == -1 && saa2 != -1) {
		while (true) {
			bool flag3 = false;

			for (i = 0; i < n - 1; i++) {
				if (saa2 % minn2 != 0) {
					minn2--;
					flag3 = true;
					break;
				}

			}

			if (flag3 == false) break;
		}
	}
	else if (saa1 != -1 && saa2 != -1) {
		while (true) {
			bool flag3 = false;

			for (i = 0; i < n - 1; i++) {
				if (saa1 % minn2 != 0 || saa2 % minn2 != 0) {
					minn2--;
					flag3 = true;
					break;
				}

			}

			if (flag3 == false) break;
		}
	}


	cout << minn2 << endl;


	getchar();
	getchar();
	return 0;
}

Measured memory_bytes: 1400
n=int(input())
mark=["S","H","C","D"]
tbl=[[0 for i in range(13)]for j in range(4)]

def e(moji):
    for j in range(4):
        if moji==mark[j]:
            return j

for i in range(n):
    a=input().split()
    tbl[e(a[0])][int(a[1])-1]+=1
    
for i in range(4):
    for j in range(13):
        if tbl[i][j]==0:
            print(mark[i],j+1)


Measured memory_bytes: 5600
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
using namespace std;

#define ALL(v) begin(v),end(v)

typedef long long LL;
typedef vector<LL> vll;

int solve(){
	int n;
	cin >> n;
	vll as(n);
	for(int i = 0; i < n; ++i){
		cin >> as[i];
	}
	string s;
	cin >> s;
	vll bs;
	for(int i = n - 1; i >= 0; --i){
		LL a = as[i];
		for(LL x : bs){
			if((a ^ x) < a){ a ^= x; }
		}
		if(s[i] == '0'){
			if(a != 0){
				bs.insert(lower_bound(ALL(bs), a, greater<LL>()), a);
			}
		}
		else{
			if(a != 0){ return 1; }
		}
	}
	return 0;
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int t;
	cin >> t;
	for(int i = 0; i < t; ++i){
		cout << solve() << '\n';
	}
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl
typedef long long ll;
using namespace std;
int static fast = [](){
  ios::sync_with_stdio(false);
  cin.tie(0); cout.tie(0); return 0;
}();

int main() {
    string s;
    int ans = 0;
    cin >> s;
    int l = 0, r = s.size()-1;
    while (l < r)
        if (s[l++] != s[r--])
            ans += 1;
    cout << ans << endl;
    return 0;
}




Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
#include<iomanip>
#include<list>
#include<deque>
using namespace std;
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define END {}
#endif
typedef long long ll;
#define int ll
#define uset unordered_set
#define umap unordered_map
typedef std::pair<int,int> P;
struct edge{int to,cost;};
const int INF=100000000000000000;
const int INF2=9223372036854775807;
const int MOD=1000000007;
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define min(X,Y) (((int)(X)<(int)(Y))?(X):(Y))
#define max(X,Y) (((int)(X)>(int)(Y))?(X):(Y))
#define MAX(X,Y) (*max_element(X,Y))
#define MIN(X,Y) (*min_element(X,Y))
#define NP(X,Y) next_permutation(X,Y)
#define setp(X,Y) cout<<fixed<<setprecision(X)<<Y<<endl
int ceil2(int a,int b){if(a%b==0){return a/b;}else{return a/b+1;}}
int pow2(int a,int b){int r=1;for(int i=1;i<=b;i++){r*=a;}return r;}
int Log2(int a){int t=0;while(1){if(a==0||a==1){break;}a/=2;t++;}return t;}

int N;
int A[100010];
int num[100010];

int mod_pow(int b,int e,int m){
    if(e==0){
        return 1;
    }else{
        int sum = mod_pow(b,e/2,m);
        if(e%2==0){
            return (sum*sum)%m;
        }else{
            return (((sum*sum)%m)*b)%m;
        }
    }
}

signed main(){
	cin>>N;
	int cnt=0;
	REP(i,N){
		cin>>A[i];
		if(A[i]==0){
			cnt++;
		}
	}
	if(A[0]!=0||cnt>1){
		cout<<0<<endl;
		return 0;
	}
	REP(i,N){
		num[A[i]]=true;
	}
	int M=MAX(A,A+N);
	for(int i=0;i<=M;i++){
		if(num[i]==0){
			cout<<0<<endl;
			return 0;
		}
	}
	int s=1;
	int m=998244353;
	map<int,int> H;
	REP(i,N){
		H[A[i]]++;
	}
	int t=0;
	cnt=0;
	for(auto x:H){
		if(cnt>=1){
			s*=mod_pow(t,x.second,m);
			s%=m;
		}
		t=x.second;
		cnt++;
	}
	cout<<s<<endl;
	return 0;
}


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

int main(){
  int N,X;
  cin >> N >> X;
  vector<int> m(N);
  for(int i=0; i<N; i++){
    cin >> m.at(i);
  }

  sort(m.begin(),m.end());
  for(int i=1; i<N; i++){
    X -= m.at(i);
  }
  int cnt = (N-1) + (X/m.at(0));
  cout << cnt << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(ll i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(ll i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(ll i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((ll)(x).size())
#define len(x) ((ll)(x).length())

struct BinomialCoefficient  {
    BinomialCoefficient() {}
    BinomialCoefficient(int n) : fac(n + 2), finv(n + 2), inv(n + 2) {
        initialize(n, false);
    }
    
    void initialize(int n, bool resize = true) {
        if (resize) {
            fac.resize(n + 2);
            finv.resize(n + 2);
            inv.resize(n + 2);
        }
        fac[0] = fac[1] = 1;
        finv[0] = finv[1] = 1;
        inv[1] = 1;
        for (int i = 2; i <= n; i++) {
            fac[i] = fac[i - 1] * i % mod;
            inv[i] = mod - inv[mod % i] * (mod / i) % mod;
            finv[i] = finv[i - 1] * inv[i] % mod;
        }
    }
    
    ll factorial(int n) {
        return fac[n];
    }
    
    ll combination(int n, int r) {
        if ((n < r) || (n < 0) || (r < 0)) return 0;
        return fac[n] * (finv[r] * finv[n - r] % mod) % mod;
    }
    
    ll permutation(int n, int r) {
        if ((n < r) || (n < 0) || (r < 0)) return 0;
        return fac[n] * finv[n - r] % mod;
    }
    
private:
    int mod = 1e9 + 7;
    vector<ll> fac, finv, inv;
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // ifstream in("input.txt");
    // cin.rdbuf(in.rdbuf());
    ll n, m;
    cin >> n >> m;
    ll ans = 0;
    BinomialCoefficient bc(max(n, m));
    ans += bc.combination(n, 2);
    ans += bc.combination(m, 2);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
def main():
    n = int(input())
    num_list = list(map(int, input().split()))

    for i in range(n):
        if num_list[i] % 2 == 0:
            if num_list[i] % 3 == 0 or num_list[i] % 5 == 0:
                continue
            else:
                print('DENIED')
                exit()

    print('APPROVED')

if __name__ == '__main__':
    main()

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

template <class T> ostream &operator<<(ostream &os, vector<T> &v) {
  for (auto i = v.begin(); i != v.end(); i++) {
    os << *i << " ";
  }
  return os;
}

// -------------------------------------------


void solve(long long N, std::string S){
  int l = 0;
  int r = 0;
  for(auto c : S) {
    if(c == '(') l++;
    if(c == ')') {
      if(l > 0) l--;
      else r++;
    }
  }
  rep(i,r) std::cout << '(';
  std::cout << S;
  rep(i,l) std::cout << ')';
  std::cout << std::endl;
}

int main(){
    long long N;
  scanf("%lld",&N);
  std::string S;
  std::cin >> S;
    solve(N, S);
    return 0;
}


Measured memory_bytes: 256
def manhattan_distance(s, c):
    return abs(s[0]-c[0]) + abs(s[1]-c[1])


def main():
    n, m = map(int, input().split())

    student = []
    for _ in range(n):
        a, b = map(int, input().split())
        student.append([a, b])

    checkpoint = []
    for _ in range(m):
        c, d = map(int, input().split())
        checkpoint.append([c, d])

    for s in student:
        d = {}
        for i, c in enumerate(checkpoint):
            d[i] = manhattan_distance(s, c)
        print(sorted(d.items(), key=lambda x: x[1])[0][0]+1)
    


if __name__ == "__main__":
    main()

Measured memory_bytes: 3064
#include <vector>
#include <iostream>
#include <cmath>
#include <map>
#include <algorithm>
#include <fstream>
#include <unistd.h>
#include <string>
#include <numeric>
#include <queue>
#include <deque>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
typedef vector<P> vp;
typedef vector<PL> vpl;
typedef vector<vector<P>> vvp;
const int INF = 1001001001;
const ll LINF = 1e18;
const string endstr = "\n";
#define FOR(i, a, b) for(ll i = (a); i < b; i++)
#define REP(i, n) for(ll i = 0; i < n; i++)
#define FORMAP(it, m) for(auto it = m.begin(); it != m.end(); it++)

template <typename T>
T gcd(T a, T b) {
    return (a == 0) ? b : gcd(b%a, a);
}
template <typename T>
T lcm(T a, T b) {
    return a / gcd(a, b) * b;
}

bool p_comp_fs(const P p1, const P p2){ return p1.first < p2.first;};
bool p_comp_fg(const P p1, const P p2){ return p1.first > p2.first;};
bool p_comp_ss(const P p1, const P p2){ return p1.second < p2.second;};
bool p_comp_sg(const P p1, const P p2){ return p1.second > p2.second;};
template <typename T>
vector<T> uniquen(vector<T> vec){
    vec.erase(unique(vec.begin(), vec.end()), vec.end());
    return vec;
}


int main(){
    ll N; cin >> N; vl hs(N+1, 0); REP(i, N) cin >> hs[i+1];
    vl dp(N, 0); dp[1] = 0; dp[2] = abs(hs[2] - hs[1]);
    FOR(i, 3, N+1){
        dp[i] = min(dp[i-1] + abs(hs[i] - hs[i-1]), dp[i-2] + abs(hs[i] - hs[i-2]));
    }
    cout << dp[N] << endstr;
    return 0;
}


Measured memory_bytes: 1792
n=int(input());l=[0,1];a=0;b=c=1;p=998244353
for i in range(2,n):
 l+=[l[p%i]*(p-int(p/i))%p]
for i in range(n,n//2,-1):
 a+=b*c%p;b=2*b%p;c=c*i*l[n+1-i]%p
print((pow(3,n,p)-2*a)%p)

Measured memory_bytes: 191100
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
    int n, k;
    cin >> n >> k;
    vector<int> h(n);

    for (int i = 0; i < n; ++i) {
        cin >> h[i];
    }

    int ans = count_if(h.begin(), h.end(), [&](int i){ return k <= i; });

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <functional>
#include <set>
#include <map>
#define rep(i,n) for(int (i) = 0;(i) < (n);(i)++)

using namespace std;
typedef long long ll;

vector<int> G[100005];
vector<int> vertics;

int dfs(int v,int p){
    if(G[v].size()==4){
        return v;
    }
    for(int nv : G[v]){
        if(nv!=p){
            return dfs(nv,v);
        }
    }
    return -1;
}

int main(){
    int N,M;
    cin>>N>>M;
    int a,b;
    for(int i = 0;i < M;i++){
        cin>>a>>b;
        a--,b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    int count = 1;
    bool oversix=false;
    for(int i = 0;i < N;i++){
        if(G[i].size()%2==1||G[i].size()==0){
            cout<<"No"<<endl;
            return 0;
        }
        count += (G[i].size()-2)/2;
        if(G[i].size()>=4){
            vertics.push_back(i);
        }
    }
    if(count>=3){
        if(count==3&&vertics.size()==2){
            int start = vertics[0];
            int goal = vertics[1];
            int countgoal = 0;
            for(int next : G[start]){
                if(dfs(next,start)==goal){
                    countgoal++;
                }
            }
            if(countgoal==2){
                cout<<"Yes"<<endl;
            }else{
                cout<<"No"<<endl;
            }

        }else{
            cout<<"Yes"<<endl;
        }
    }else{
        cout<<"No"<<endl;
    }
}


Measured memory_bytes: 5760
import sys

a = input()

if a.count(a[0]) != 2:
  print("No")
  sys.exit()
if a[0] == a[1]:
  if a.count(a[2]) != 2:
    print("No")
    sys.exit()
else:
  if a.count(a[1]) != 2:
    print("No")
    sys.exit()
print("Yes")
    

Measured memory_bytes: 2940
/**
 * auther: moririn_cocoa
 */

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <bitset>
#include <stdio.h>
#include <stdlib.h>
using namespace std;

#define rep(i,n) for(int i=0;i<(n);i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define fi first
#define se second


int main(int argc, const char * argv[]) {
  
  int A;
  int B;
  
  cin >> A;
  cin >> B;
  
  if ( A % 3 == 0 ) {
    
    cout << "Possible" << endl;
  }
  
  else if ( B % 3 == 0 ) {
    
    cout << "Possible" << endl;
  }
  
  else if ( ( A + B ) % 3 == 0 ) {
    
    cout << "Possible" << endl;
  }
  
  else {
    
    cout << "Impossible" << endl;
  }
  
  return 0;
}


Measured memory_bytes: 3632
def ascan; gets.split.map(&:to_i); end
    
def trisearch(left, right, equal = nil, &block)
    99.times {
        l = right - (2 * right - 2 * left) / 3
        r = right - (right - left) / 3

        lval = block.call(l)
        rval = block.call(r)
        
        if (lval <= rval)
            right = r
        else
            left = l
        end
        
        return left if right - left <= 2
    }
    
    best = block.call(left);
    bestidx = left;
    (left+1).upto(right){|t|
        f = block.call(t)
        if best > f
            best = f; bestidx = t
        end
    }
    return nil if equal && equal != block.call(bestidx)
    return bestidx
end


K,A,B = ascan

if A+1 >= B
    # A
    p K+1
    exit
end

# yenに交換，bisに交換でB-A枚増加．
d = B-A

#step1．A枚作る．A-1ターン必要．
#step2．2*Tターン使ってA+d*T枚に増やす．

best = trisearch(0, (1e9.to_i+10000)) do |t|
    remT = K - (A-1 + 2*t)
    remT < 0 ? 0 : A+d*t+remT
end

p A+d*best + K - (A-1 + 2*best)



Measured memory_bytes: 1788
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<map>
#include<stack>
#include<queue>
#include<set>
using namespace std;
typedef long long ll;
const ll mod = 1e9+7;
struct st{
	char b;
	ll sm,f;
}c[200100];
char d[200100];
char e[200100];
char s[100100];
int main(){
	scanf("%s",&s);
	ll t;
	scanf("%lld",&t);
	ll ss=0;
	ll i,j;
	ll p=0,q=0,z=0;
	for(i=0;i<t;i++){
		ll x;
		scanf("%lld",&x);
		if(x==1)
			ss++;
		else{
			scanf("%lld %c",&c[z].f,&c[z].b);
			c[z++].sm=ss;
		}
	}
	for(i=0;i<z;i++){
		c[i].sm=ss-c[i].sm;
		if((c[i].f==1&&c[i].sm%2==0)||(c[i].f==2&&c[i].sm%2!=0))
			d[p++]=c[i].b;
		else
			e[q++]=c[i].b;
	}
	for(i=p-1;i>=0;i--)
		printf("%c",d[i]);
	if(ss%2==0)
		for(i=0;i<strlen(s);i++)
			printf("%c",s[i]);
	else
		for(i=strlen(s)-1;i>=0;i--)
			printf("%c",s[i]);
	for(i=0;i<q;i++)
		printf("%c",e[i]);
}


Measured memory_bytes: 5504
#include<stdio.h>

int main(){
    int n, q;
    long int sum=0, count[1<<19]={0}, p;
    scanf("%d", &n);
    for(int i=0; i<n; i++){
        scanf("%ld", &p);
        count[p]++;
        sum = sum + p;
    }
    scanf("%d", &q);
    int b[1<<19], c[1<<19];
    for(int i=0; i<q; i++){
        scanf("%d%d", &b[i], &c[i]);
        sum = sum + (c[i]-b[i])*count[b[i]];
        printf("%ld\n", sum);
        count[c[i]] = count[c[i]] + count[b[i]];
        count[b[i]] = 0;
    }
}





Measured memory_bytes: 6608
import numpy as np

N,M,X=map(int, input().split())
C=[]
A=[]

for i in range(N):
    Ctmp,*Atmp=map(int, input().split())
    C.append(Ctmp)
    A.append(np.array(Atmp))

sum = 0

arr=[]
tmpC=[]
tmpA=[]

for bit in range(1<<N): # 0(0b000)から7(0b111)まで
    tmpmon=0
    tmpX=np.array([0]*M)
    for i in range(N):
        mask = 1 << i
        if bit&mask: # 右からi番目にビットが立っているかどうか判定
            tmpmon+=C[i]
            tmpX+=A[i]
    tmpC.append(tmpmon)
    tmpA.append(tmpX)


ans = 9999999999
for i in range(len(tmpC)):
    if np.amin(tmpA[i]) >= X:
        if ans > tmpC[i]:
            ans=tmpC[i]

if ans == 9999999999:
    ans = -1

print(ans)
        




Measured memory_bytes: 28048
#include<bits/stdc++.h>
using namespace std;
#define int long long
string s;
signed main(){
  cin >>s;
  if(s[0]==s[1] || s[1]==s[2]|| s[2]==s[3] ||s[3]==s[4]) cout << "Bad" << endl;
  else cout << "Good" << endl;
  return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include<bitset>
#include<math.h>
using namespace std;
#define INF 110000000000
#define MOD 1000000007
typedef long long ll;
typedef pair<int,int> P;

int main(){
  bool hantei=false;
  int flag=0,count[3]={0,0,0},ans;
  string A[3];
  cin>>A[0]>>A[1]>>A[2];

  A[0].push_back('?');
  A[1].push_back('?');
  A[2].push_back('?');

  while(true){
    for(int i=0;i<3;i++){
      if(flag==i){
        if(A[i][count[i]]=='?'){
          ans=i;
          hantei=true;
          break;
        } 
        flag=A[i][count[i]++]-'a';
      }
    }
    if(hantei) break;
  }
  cout<<(char)(ans+'A')<<endl;
  
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
using namespace std;
int32_t main()
{
    cin.tie(0);cout.tie(0);
    ios_base::sync_with_stdio(0);
    int n,ans=0;cin>>n;
    multiset<int> s;
    int p[31];
    p[0]=1;
    for(int i=1;i<31;i++)
        p[i]=p[i-1]*2;
    int a[n];
    for(int i=0;i<n;i++)
        cin>>a[i];
    sort(a,a+n);
    for(int i=n-1;i>=0;i--)
    {
        int x=a[i],f=0;
        for(int j=30;j>=0;j--)
        {
            if(s.count(p[j]-x))
            {
                ans++;
                s.erase(s.find(p[j]-x));
                f=1;
                break;
            }
            
        }
        if(f==0)
        s.insert(x);
    }
    cout<<ans;
    
    
}

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

using namespace std ;

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

int n ; 
cin >> n  ;
vector<string> str(n); 
set<string> s; 
for (int i = 0 ; i < n ; i ++ ) {
	string sx;  
	cin >> sx; 
	s.insert(sx); 
}
cout << s.size() << endl ;

}


Measured memory_bytes: 25076
import math
def count(i,j,k):
    val= math.gcd(i,math.gcd(j,k))

    if i==j==k:
        return val
    else:
        if i==j or i==k or j==k:
            return 3*val
        else:
            return 6*val
n=int(input())+1
sum=0
for i in range(1,n):
    for j in range(i,n):
        for k in range(j,n):
            sum+=count(i,j,k)
print(sum)

Measured memory_bytes: 9196
#include<iostream>
#include<vector>

using namespace std;

int main(){
  int a[4] = {0};

  for(int i = 0; i< 3; i++){
    int b,c;
    cin >> b >> c;
    a[b-1]++;
    a[c-1]++;
  }
  int f1 = 0;
  int f2 = 0;
  for(int i =0 ; i < 4; i++){
    if(a[i] == 1) f1++;
    if(a[i] == 2) f2++;
  }
  if(f1 == 2 && f2 == 2) cout << "YES" << endl;
  else cout << "NO" << endl;
}


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

int main() {
	int t; cin >> t;
	while(t--) {
		int n, m, a, b; cin >> n >> m >> a >> b;
		cout << floor_sum(n, m, a, b) << '\n';
	}
	return 0;
}

Measured memory_bytes: 3604
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;

int main() {
    int n;
    cin >> n;
    vector<int> a(n), p(n);
    vector<int64_t> s(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        p[i] = i;
    }
    sort(a.begin(), a.end());
    s[0] = a[0];
    for (int i = 1; i < n; i++) {
        s[i] = s[i - 1] + a[i];
    }

    // 残りうる色か
    auto f = [&](int i) {
        for (;;) {
            int j = i;
            int64_t t = s[i] * 2;
            if (t >= 1000000000) return true;
            auto it = upper_bound(a.begin(), a.end(), (int)t);
            if (it == a.end()) return true;
            i = (int)(it - a.begin()) - 1;
            if (i == j) return false;
        }
    };

    for (int i = 0; i < n; i++) {
        if (f(i)) {
            cout << n - i << endl;
            quick_exit(0);
        }
    }

    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#include <stdio.h>
#include <algorithm>
#include <string>
#define rep(i,n) for(int i=0; i<n; ++i)

int main(){
    int A, B, C;
    std::cin >> A >> B >> C;

    std::string S;

    if(A == B){
        S = "Yes";
      if(B == C){
        S = "No";
      }
    }
    else if(B == C){
        S = "Yes";
    }
    else if(C == A){
        S = "Yes";
    }

    else{
        S = "No";
    }

    std::cout << S << std::endl;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.FileWriter;
import java.io.PrintWriter;
import java.nio.charset.StandardCharsets;
import java.io.BufferedWriter;
import java.io.FileReader;
import java.io.File;
import java.util.*;

public class Main {

    public static StringBuilder output = new StringBuilder();

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int length = in.nextInt();
        String arr[] = new String[n];
        for (int i = 0; i < n; i++) {
            arr[i] = in.next();
        }
        Solver solver = new Solver();
        solver.solve(arr);
        System.out.println(output);
    }

}

class Solver {
    public void solve(String arr[]) {
        String a = "";
        Arrays.sort(arr, (s1, s2) -> s1.compareTo(s2));
        for (String s : arr) {
            a = a.concat(s);
        }
        Main.output.append(a);

    }
}

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


int main(){
    int64_t A,B,C;
    cin>>A>>B>>C;
    if(C<A+B){
        cout<<"No"<<endl;
    }
    else if(4*A*B<(C-A-B)*(C-A-B)){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }
}


Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<iomanip>

int main(void)
{
	using namespace std;
	double a, b, c;
	double S, L, h;
	cin >> a >> b >> c;
	S = a * b * sin(c * M_PI / 180)/2;
	L = a + b + sqrt(a * a + b * b - 2 * a * b * cos(c * M_PI / 180));
	h = S*2/a;
	cout << fixed << setprecision(8) << S << endl << L << endl << h << endl;
}


Measured memory_bytes: 3508
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define all(x) (x).begin(), (x).end()
using ll = long long;
using namespace std;
template <typename T> using vec = std::vector<T>;

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

int main() {
    ll A, B;
    cin >> A >> B;

    cout << lcm(A,B) << endl; 

}


Measured memory_bytes: 3528
#include<bits/stdc++.h>
#include<string.h>
 
typedef long long int ll;
#define all(x) (x).begin(), (x).end()
 
using namespace std;

int nxt() {
    int x;
    cin >> x;
    return x;
}

ll nxtl(){
    ll x;
    cin>>x;
    return x;
}
 
void SieveOfEratosthenes(int n,vector <int> &primes) 
{ 
    // Create a boolean array "prime[0..n]" and initialize 
    // all entries it as true. A value in prime[i] will 
    // finally be false if i is Not a prime, else true. 
    bool prime[n+1]; 
    memset(prime, true, sizeof(prime)); 
  
    for (int p=2; p*p<=n; p++) 
    { 
        // If prime[p] is not changed, then it is a prime 
        if (prime[p] == true) 
        { 
            // Update all multiples of p greater than or  
            // equal to the square of it 
            // numbers which are multiple of p and are 
            // less than p^2 are already been marked.  
            for (int i=p*p; i<=n; i += p) 
                prime[i] = false; 
        } 
    } 
  
    // Print all prime numbers 
    for (int p=2; p<=n; p++) 
       if (prime[p]) 
          primes.push_back(p);
} 
 
ll max(ll a,ll b)
{
    if(a>b)
        return a;
    return b;
}
 
ll power(ll x, ll y,ll mod) 
{ 
    ll temp; 
    if( y == 0) 
        return 1; 
    temp = power(x, y/2,mod); 
    if (y%2 == 0) 
        return (temp*temp)%mod; 
    else
        return (((x*temp)%mod)*temp)%mod; 
} 

ll modPow(ll a, ll x, ll p) {
    //calculates a^x mod p in logarithmic time.
    ll res = 1;
    while(x > 0) {
        if( x % 2 != 0) {
            res = (res * a) % p;
        }
        a = (a * a) % p;
        x /= 2;
    }
    return res;
}

ll modInverse(ll a, ll p) {
    //calculates the modular multiplicative of a mod m.
    //(assuming p is prime).
    return modPow(a, p-2, p);
}
ll modBinomial(ll n, ll k, ll p) {
// calculates C(n,k) mod p (assuming p is prime).

    ll numerator = 1; // n * (n-1) * ... * (n-k+1)
    for (int i=0; i<k; i++) {
        numerator = (numerator * (n-i) ) % p;
    }

    ll denominator = 1; // k!
    for (int i=1; i<=k; i++) {
        denominator = (denominator * i) % p;
    }

    // numerator / denominator mod p.
    return ( numerator* modInverse(denominator,p) ) % p;
}

ll f[200001];
 
ll pow(ll a, ll b, ll MOD)
{
 ll x=1,y=a; 
 while(b > 0)
    {
        if(b%2 == 1)
    {
        x=(x*y);
        if(x>MOD) x%=MOD;
    }
    y = (y*y);
    if(y>MOD) y%=MOD; 
    b /= 2;
    }
 return x;
}
 
/* Modular Multiplicative Inverse
 Using Euler's Theorem
 a^(phi(m)) = 1 (mod m)
 a^(-1) = a^(m-2) (mod m) */
ll InverseEuler(ll n, ll MOD)
{
 return pow(n,MOD-2,MOD);
}
 
ll C(ll n, ll r, ll MOD)
{
 
 return (f[n]*((InverseEuler(f[r], MOD) * InverseEuler(f[n-r], MOD)) % MOD)) % MOD;
}
 


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n=nxt();
    int test=0;
    bool flag=1;
    for(int i=0;i<n;i++)
    {
        int x=nxt();
        if(flag&&x%2)
            test++;
        if(flag)
            flag=0;
        else
            flag=1;
    }
    cout<<test<<endl;


    return 0;   
}


 
 


Measured memory_bytes: 3640
<?php

$input = trim(fgets(STDIN));
$input = explode(" ", $input);

$n = (int)$input[0];
$m = (int)$input[1];
$x = (int)$input[2];
$y = (int)$input[3];

$x_array = [];
$y_array = [];

$input = trim(fgets(STDIN));
$input = explode(" ", $input);
foreach ($input as $value) {
	$x_array[] = (int)$value;
	if (count($x_array) >= $n) {
		break;
	}
}

$input = trim(fgets(STDIN));
$input = explode(" ", $input);
foreach ($input as $value) {
	$y_array[] = (int)$value;
	if (count($y_array) >= $m) {
		break;
	}
}

rsort($x_array);
sort($y_array);

if ($x_array[0] < $y && $y_array[0] > $x && $x < $y && $x_array[0] < $y_array[0]) {
	echo 'No War';
}else{
	echo 'War';
}

Measured memory_bytes: 4604
#include <bits/stdc++.h>
#define SZ(x) ((int)x.size())
#define ALL(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
typedef long double ld;
int a, b, c, x, y;
int main() {
	cin >> a >> b >> c >> x >> y;
	int res = 1e9;
	for(int i=0; i<=max(x, y); i++) {
		res = min(res, 2 * c * i + max(0, x - i) * a + max(0, y - i) * b);
	}
	cout << res;
	return 0;
}

Measured memory_bytes: 256
using System;

class Program
{
    static void Main(string[] args)
    {
        var A = Console.ReadLine();
        var B = Console.ReadLine();

        if (A == B)
        {
            Console.WriteLine("EQUAL");
        }
        else if (A.Length == B.Length)
        {
            if (0 < A.CompareTo(B))
            {
                Console.WriteLine("GREATER");
            }
            else
            {
                Console.WriteLine("LESS");
            }
        }
        else if (A.Length < B.Length)
        {
            Console.WriteLine("LESS");
        }
        else
        {
            Console.WriteLine("GREATER");
        }
    }
}


Measured memory_bytes: 13280
#include <iostream>

using namespace std;

int bubbleSort(int a[],int n){
  int flag=1;
  int cnt=0;
  while(flag){
    flag=0;
    for(int j=n-1;j>0;j--){
      if(a[j]<a[j-1]){
        swap(a[j],a[j-1]);
        cnt++;
        flag=1;
      }
    }
  }
  return cnt;
}

int main(){
  int n; cin >> n;
  int a[n];
  for(int i=0;i<n;i++) cin >> a[i];
  int ans=bubbleSort(a,n);
  for(int i=0;i<n;i++){
    if(i==n-1) cout << a[i] << endl;
    else cout << a[i] << " ";
  }
  cout << ans << endl;
}

Measured memory_bytes: 3096
N, K = list(map(int, input().split()))
val = 1
num = 0
ans = 0

x = 1
while x < K:
    x = 2 * x

for i in range(N):
    target = N - i
    tmp = val
    while tmp * target < K:
        num += 1
        tmp = 2 * tmp
    val = tmp
    ans += x // tmp
print('{:.10g}'.format(ans / (N * x)))




Measured memory_bytes: 3060