akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
#include<cmath>
#include<cstdlib>
#include<vector>
#include<map>
#include<set>
#include<algorithm>

using namespace std;
int n,m;
string s[60];

int x[4] = {0,1,0,-1};
int y[4] = {1,0,-1,0};

bool valid(int x, int y){
  if((x>=0) && (x<y))return true;
  return false;
}

int main(){

  cin>>n>>m;
  for(int i=0;i<n;i++)cin>>s[i];

  int f = 1;
  for(int i=0;i<n;i++){
    for(int j=0;j<m;j++){
      if(s[i][j] == '#'){
        int tmp = 0;
        for(int k=0;k<4;k++){
          if(valid(i+x[k],n)){
            if(valid(j+y[k],m)){
              if(s[i+x[k]][j+y[k]]=='#'){
                tmp = 1;
              }
            }
          }
        }
        f = f & tmp;
      }
    }
  }

  if(f) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;

  return 0;
}

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

int main(void)
{
	int W, H, N;
	cin >> W >> H >> N;

	int top = 0, bottom = H, left = 0, right = W;
	for(int i=0; i<N; i++)
	{
		int x, y, a;
		cin >> x >> y >> a;

		switch(a)
		{
			case 1:
				left = max(left, x); break;
			case 2:
				right = min(right, x); break;
			case 3:
				top = max(top, y); break;
			case 4:
				bottom = min(bottom, y); break;
		}
	}

	cout << max(0, right-left) * max(0, bottom-top) << endl;

	return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        Random rand = new Random();
        //ArrayList<Integer> list;
        String name1 = sc.next();
        String name2 = sc.next();
        int ball1 = sc.nextInt();
        int ball2 = sc.nextInt();
        String unstocked_ball = sc.next();

        if(name1.equals(unstocked_ball)){
            ball1 = ball1 -1;
        }else{
            ball2 = ball2 -1;
        }

        System.out.println(ball1 + " " + ball2);



    
	}
}

Measured memory_bytes: 21844
A, B, C, D = map(int,input().split())
t = 0
while A > 0 and C > 0:
    if t == 0:
        C -= B
        if C <= 0:
            print("Yes")
            exit(0)
        else:
            t = 1
    else:
        A -= D
        if A <= 0:
            print("No")
            exit(0)
        else:
            t = 0


Measured memory_bytes: 9212
#include<bits/stdc++.h>
#define int long long
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

const int INF=1e18;

void solve(int N)
{
    vector<int> x(N+1),t(N+1);
    x[0]=t[0]=0;
    for(int i=0;i<N;i++) cin>>x[i+1]>>t[i+1];

    vector<vector<int>> dp(N+1,vector<int>(4,INF));
    dp[0][0]=0;
    for(int i=0;i<N;i++) for(int j=0;j<=3;j++) if(dp[i][j]!=INF){
        int dx=abs(x[i]-x[i+1]);
        int dt=abs(t[i]-t[i+1]);
        if((j+1)*x[i]+x[i+1]<=dt){
            chmin(dp[i+1][1],dp[i][j]+x[i]+x[i+1]);
        }
        if(j<3){
            if((j+1)*dx<=dt){
                chmin(dp[i+1][j+1],dp[i][j]+dx);
            }
        }
    }
    /*
    for(int i=0;i<=N;i++){
        for(int j=0;j<=3;j++){
            if(dp[i][j]==INF) cout<<-1<<' ';
            else cout<<dp[i][j]<<' ';
        }
        cout<<endl;
    }
    */
    for(int i=1;i<=N;i++){
        int mn=INF;
        for(int j=0;j<=3;j++) chmin(mn,dp[i][j]);
        if(mn==INF){
            cout<<"NG"<<' '<<i<<endl;
            return;
        }
    }
    int ans=INF;
    for(int j=0;j<=3;j++) chmin(ans,dp[N][j]);
    cout<<"OK"<<' '<<ans+x[N]<<endl;
}

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

    while(true){
        int N; cin>>N;
        if(N==0) break;
        solve(N);
    }
    return 0;
}


Measured memory_bytes: 3124
import sys
stdin = sys.stdin

def li(): return [int(x) for x in stdin.readline().split()]
def li_(): return [int(x)-1 for x in stdin.readline().split()]
def lf(): return [float(x) for x in stdin.readline().split()]
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(ns())
def nf(): return float(ns())


MOD = 10**9+7

n = ni()
n_bit = len(bin(n)[2:])

dp = [[0]*4 for _ in range(n_bit+1)]
dp[0][0] = 1

for bit in range(n_bit):
    digit = int(bin(n)[2+bit:2+bit+1])
    
    if digit:
        dp[bit+1][0] = (dp[bit][0]) % MOD
        dp[bit+1][1] = (dp[bit][0] + dp[bit][1]) % MOD
        dp[bit+1][2] = (dp[bit][1]) % MOD
        dp[bit+1][3] = (dp[bit][1] + 3*dp[bit][2] + 3*dp[bit][3]) % MOD
        
    else:
        dp[bit+1][0] = (dp[bit][0] + dp[bit][1]) % MOD
        dp[bit+1][1] = (dp[bit][1]) % MOD
        dp[bit+1][2] = (dp[bit][1] + dp[bit][2]) % MOD
        dp[bit+1][3] = (2*dp[bit][2] + 3*dp[bit][3]) % MOD
        
print(sum(dp[n_bit]) % MOD)

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

int main() {
  int r, c;
  cin >> r >> c;

  int calc[r + 1][c + 1] = {0};

  for (int i = 0; i < r; i++) {
    for (int j = 0; j < c; j++) {
      cin >> calc[i][j];
    }
  }

  for (int i = 0; i < r; i++) {
    int tot = 0;
    for (int j = 0; j < c + 1; j++) {
      if (j != c) {
        cout << calc[i][j] << ' ';
        tot += calc[i][j];
      } else
        cout << tot;
    }
    cout << endl;
  }

  int ans = 0;
  for (int i = 0; i < c; i++) {
    int tot = 0;
    for (int j = 0; j < r + 1; j++) {
      if (j != r) {
        tot += calc[j][i];
      } else
        cout << tot << ' ';
    }
    ans += tot;
  }
  cout << ans << endl;
}


Measured memory_bytes: 3092
#include <bits/stdc++.h>
#define log(x) cout<<x<<endl
#define pb push_back
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
typedef long long lint;
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;

int gcd(lint x, lint y){
  return y==0 ? x:gcd(y,x % y);
}

int digsum(int n) {
  int res = 0;
  while(n > 0) {
    res += n%10;
    n /= 10;
  }
  return res;
}

int dignum(int n) {
  int res = 0;
  while(n > 0) {
    res++;
    n /= 10;
  }
  return res;
}

int stringcount(string s, char c) {
  return count(s.cbegin(), s.cend(), c);
}

int lcm(lint x, lint y){
  return x/ gcd(x, y) * y;
}

int combi(int n, int r){
  int num = 1;
  for(int i = 1; i <= r; i++){
    num = num * (n - i + 1) / i;
  }
  return num;
}

int main(){
  const lint inf=1LL<<60;
  bool is=true;
  lint n,k;cin>>n>>k;
  int count=0;
  vector<int> r;
  while(is){
    if(n==0&&k==0) break;
    lint a[101000],s[101000];
    rep(i,n){
      cin>>a[i];
    }
    s[0]=0;
    rep(i,n){
      s[i+1]=s[i]+a[i];
    }
    lint result=-inf;
    for(int i=0;i<=n-k;i++){
      lint sum=s[k+i]-s[i];
      if(result<sum) result=sum;
    }
    r.pb(result);
    cin>>n>>k;
  }
  for(int i=0;i<r.size();i++){
    cout<<r[i]<<endl;
  }
  
}


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

def main():
    n,k = map(int,input().split())
    a = list(map(int, input().split()))
    ans = [0 for _ in range(n+1)]
    for _ in range(k):
        ans = [0 for _ in range(n+1)]
        for i in range(n):
            [l,r] = [max(0,i-a[i]),min(n-1,i+a[i])]
            ans[l] += 1
            ans[r+1] -= 1
        for i in range(n):
            ans[i+1] += ans[i]
        a = ans
        if ans[0] >= n and ans[n-1] >= n:
            print(*[n for _ in range(n)])
            return
    x = []
    for i in range(n):
        x.append(ans[i])
    print(*x)


if __name__ == "__main__":
    main()

Measured memory_bytes: 168236
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <iostream>
#include <fstream>

#include "bits/stdc++.h"

#define REP(i,x,y) for(int i=(x);i<(y);i++)
#define RREP(i,x,y) for(int i=(y)-1;i>=(x);i--)
#define all(x) (x).begin(),(x).end()
//#define int long long

using namespace std;

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

#ifdef LOCAL
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#define dump(x)  cerr << #x << " = " << (x) << endl
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl
#else
#define eprintf(...)
#define dump(x)
#define debug(x)
#endif

typedef long long ll;

const ll MOD = 1e9 + 7;

class AXORCircle {
public:
	void solve(std::istream& in, std::ostream& out) {
	    int N;
	    in >> N;
        vector<int> a(N);
        REP(i,0,N) in >> a[i];

	    unordered_map<int, int> count;
	    REP(i,0,N) count[a[i]]++;

	    bool answer;
	    if (count.size() == 1) {
	         answer = count[0] == N;
	    } else if (count.size() == 2) {
	        answer = true;
	        for (const auto pair : count) {
	            if (!(pair.first == 0 && pair.second == N / 3 || pair.first != 0 && pair.second == 2 * N / 3)) {
	                answer = false;
	                break;
	            }
	        }
	    } else if (count.size() == 3) {
            answer = true;
            for (const auto pair : count) {
                if (pair.second != N / 3) {
                    answer = false;
                    break;
                }
            }
            if (answer) {
                int tmp = 0;
                for (const auto pair : count) {
                    tmp ^= pair.first;
                }
                answer = tmp == 0;
            }
	    } else {
	        answer = false;
	    }
	    out << (answer ? "Yes" : "No") << "\n";
	}
};


int main() {
	AXORCircle solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 4004
n,m=map(int,input().split())
a=[list(map(int,input().split())) for _ in range(n)]
b=[0 for _ in range(m)]
for i in range(n):
  for j in range(1,a[i][0]+1):
    b[a[i][j]-1] += 1
print(b.count(n))

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

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

Measured memory_bytes: 3996
#include <vector>
#include <queue>
#include <functional>
#include <utility>

using namespace std;

//  E[i]: vertexes which can be reased from i
//  W[i]: their weight
template<class T>
vector<T> dijkstra(vector<vector<int>> E, vector<vector<T>> W, int s, T inf)
{
    int n = (int)E.size();

    vector<T> D(n, inf);
    typedef pair<T,int> P;
    priority_queue<P,vector<P>,greater<P>> Q;

    D[s] = T();
    Q.push(make_pair(D[s], s));

    while (!Q.empty())
    {
        T d = Q.top().first;
        int p = Q.top().second;
        Q.pop();
        if (d > D[p])
            continue;
        for (int i=0; i<(int)E[p].size(); i++)
        {
            int t = E[p][i];
            if (d+W[p][i] < D[t])
                D[t] = d+W[p][i],
                Q.push(make_pair(D[t], t));
        }
    }
    return D;
}

#include <iostream>

int main()
{
    int N, M, S;
    cin>>N>>M>>S;
    vector<long long> U(M), V(M), A(M), B(M);
    for (int i=0; i<M; i++)
    {
        cin>>U[i]>>V[i]>>A[i]>>B[i];
        U[i]--;
        V[i]--;
    }
    vector<long long> C(N), D(N);
    for (int i=0; i<N; i++)
    {
        cin>>C[i]>>D[i];
    }

    vector<vector<int>> E((100*N+1)*N);
    vector<vector<long long>> W((100*N+1)*N);
    for (int i=0; i<M; i++)
    {
        for (int j=A[i]; j<=100*N; j++)
        {
            E[j*N+U[i]].push_back((j-A[i])*N+V[i]);
            E[j*N+V[i]].push_back((j-A[i])*N+U[i]);
            W[j*N+U[i]].push_back(B[i]);
            W[j*N+V[i]].push_back(B[i]);
        }
    }
    for (int i=0; i<N; i++)
    {
        for (int j=0; j<100*N; j++)
        {
            E[j*N+i].push_back(min(j+C[i], (long long)100*N)*N+i);
            W[j*N+i].push_back(D[i]);
        }
        for (int j=1; j<=100*N; j++)
        {
            E[j*N+i].push_back((j-1)*N+i);
            W[j*N+i].push_back(0);
        }
    }

    long long oo = 0xfff'ffff'ffff'ffffLL;
    vector<long long> X = dijkstra(E, W, min(S, 100*N)*N, oo);
    for (int i=1; i<N; i++)
    {
        long long a = oo;
        for (int j=0; j<=100*N; j++)
            a = min(a, X[j*N+i]);
        cout<<a<<endl;
    }
}


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

int main() {
  int D;
  cin >> D;

  vector<int> C(26);
  rep(i, 26) {
    cin >> C.at(i);
  }

  vector<int> T(D);
  rep(i, D) {
    int max = 0;
    rep(j, 26) {
      int s;
      cin >> s;
      if (max <= s) {
        max = s;
        T.at(i) = j + 1;
      }
    }
  }

  rep(i, D) {
    cout << T.at(i) << endl;
  }
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define reprrev(i,a,b) for(int i=b-1;i>=a;i--) // [a, b)
#define reprev(i,n) reprrev(i,0,n)
typedef long long ll;
typedef unsigned long long ull;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
    sizeは(int)とキャストしよう
    cin.tie(0);
    ios::sync_with_stdio(false);<- これら、printfとかと併用しない方が良さそう

*/

const ll mod = 1e9+7;

void chmod(ll &M){
    if(M >= mod) M %= mod;
    else if(M < 0){
        M += (abs(M)/mod + 1)*mod;
        M %= mod;
    }
}

ll modpow(ll x, ll n){
    if(n==0) return 1;
    ll res=modpow(x, n/2);

    if(n%2==0) return res*res%mod;
    else return res*res%mod*x%mod;
}

int getl(int i, int N) { return i==0? N-1:i-1; };
int getr(int i, int N) { return i==N-1? 0:i+1; };


// 線分 ab の偏角 返り値は[-π, π]
double argument(const pair<double, double> &a, const pair<double, double> &b){
    double ax=a.first, ay=a.second, bx=b.first, by=b.second;
    return atan2(by-ay, bx-ax);
}

/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */

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

    int N; cin >> N;

    for(int i=1; i<=50000; ++i){
        double d = i*1.08;
        int c = d / 1;
        if(c == N) { cout << i << endl; return 0; }
    }
    cout << ":(" << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
//#include <atcoder/all>
//using namespace atcoder;
template <typename T> bool chmax(T &u, const T z) { if (u < z) {u = z; return true;} else return false; }
template <typename T> bool chmin(T &u, const T z) { if (u > z) {u = z; return true;} else return false; }
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
typedef pair<ll, ll> P;
const ll INF = 1LL << 60;
const int MOD = 1000000007;
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }

int main(){
    long long a,b,c,d;
    cin>>a>>b>>c>>d;
    ll saidai=-INF;
    saidai=max(saidai,a*c);
    saidai=max(saidai,a*d);
    saidai=max(saidai,b*c);
    saidai=max(saidai,b*d);
    cout<<saidai<<endl;
    return 0;
}

Measured memory_bytes: 3668
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
const LL inf=0x3f3f3f3f3f3f3f3f;
const LL N=19;
LL n,a[N],t[N];
inline LL solve(LL l,LL r){
	if(l==r-1)return 0;
	LL ans=inf;
	for(LL i=l+1; i<r; ++i){
		t[i]=t[l]+t[r];
		ans=min(ans,solve(l,i)+solve(i,r)+t[i]*a[i]);
		t[i]=0;
	}
	return ans;
}
int main(){
	scanf("%lld",&n);
	for(LL i=1; i<=n; ++i)scanf("%lld",&a[i]);
	t[1]=t[n]=1;
	printf("%lld",a[1]+a[n]+solve(1,n));
	return 0;
}

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


int n, m, q, p[509][509];
int main(){
    cin >> n >> m >> q;

    for(int i=1; i<=m; ++i) { int l, r; cin >> l >> r; ++p[l][r]; }
    for(int i=1; i<=n; ++i) for(int j=1; j<=n; ++j) p[i][j] += p[i][j-1];
    for(int i=1; i<=n; ++i) for(int j=1; j<=n; ++j) p[i][j] += p[i-1][j];

    for(int i=1; i<=q; ++i){
        int l, r; cin >> l >> r;
        cout << p[r][r] + p[l-1][l-1] - p[l-1][r] - p[r][l-1] << endl;
    }
}

Measured memory_bytes: 1920
n=int(input())
w_list=[input() for _ in range(n)]

if len(w_list)!=len(set(w_list)):
    print("No")
    exit()

for i in range(1,n):
    if w_list[i-1][-1]!=w_list[i][0]:
        print("No")
        exit()
print("Yes")

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstring>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <functional>
#include <sstream>
#include <complex>
#include <climits>
using namespace std;

#define REP(i,a,n) for(int i=(a);i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define mp make_pair
#define all(x) x.begin(),x.end()
#define EPS 1e-8

string chipher(string s, int a, int b){
	rep(i,s.size())if( 'a'<=s[i] && s[i]<='z' ){
		s[i] = ((a*(s[i]-'a') + b)%26)+'a';
	}
	return s;
}
int gcd(int x, int y){
	return y ? gcd(y,x%y) : x;
}
int main(){
	int t;
	scanf("%d ",&t);
	while(t--){
		string in,ans; getline(cin,in);
		bool f = false;
		//cout << in << endl;
		for(int a=1; a<26; a++)if( gcd(a,26)==1 ){
			for(int b=1; b<=26; b++){
				string tmp = chipher(in,a,b);
				//printf("(%d,%d)::%s\n",a,b,tmp.c_str());
				if( tmp.find("that")!=string::npos || tmp.find("this")!=string::npos ){
					f = true; ans = tmp; break;
				}
			}
			if( f ) break;
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
const int INF = 1001001001;

int main() {
int64_t A,B;
cin >> A >> B;
if (abs(A-B) % 2== 1) cout << "IMPOSSIBLE" << endl; 
else {
int K;
for (K = 0;K <INF;K++) {
    if (abs(A-K) == abs(B-K)) {
        cout << K << endl;
        return 0;
    }
}
}


return 0;
}


Measured memory_bytes: 256
main(m,n,i,j,k,a){for(;a=1,scanf("%d",&m),m;puts(a?"OK":"NG")){int d[300],g[300][300]={0};scanf("%d",&n);for(i=1;i<=n;)scanf("%d",d+i++);for(i=0;i<=n;i++)for(j=1;j<=m;j++)k=i+j+d[i+j],(k=k<0?0:n+1<k?n+1:k),g[i][k]=1;for(k=0;k<n+2;k++)for(i=0;i<n+2;i++)for(j=0;j<n+2;j++)g[i][k]&&g[k][j]?g[i][j]=1:0;for(i=0;i<=n;i++)g[0][i]&&!g[i][n+1]?a=0:0;}return 0;}

Measured memory_bytes: 944
#include "bits/stdc++.h"
using namespace std;

int main() {
	long long N, ans = 0;
	cin >> N;
	for (int i = 1; i < sqrt(N); i++) {
		if (N % i == 0) {
			ans += N / i - 1;
		}
	}
	for (long long i = 0; i <= sqrt(N); i++) {
		if (i * (i + 1) == N) ans -= i;
	}
	cout << ans;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var (
	keys = []string{"AC", "WA", "TLE", "RE"}
	m    = make(map[string]int)
)

func main() {
	readVariables()
	for _, k := range keys {
		fmt.Printf("%s x %v\n", k, m[k])
	}
}

func readVariables() {
	N := nextInt()
	for i := 0; i < N; i++ {
		key := nextStr()
		m[key]++
	}
}

/* Template */

var scanner *bufio.Scanner

func init() {
	Max := 1001001
	scanner = bufio.NewScanner(os.Stdin)
	scanner.Buffer(make([]byte, 0, Max), Max)
	scanner.Split(bufio.ScanWords)
}

//nextInt converts next token from stdin and returns integer value.
//nextInt panics when conversion into an integer fails.
func nextInt() int {
	if !scanner.Scan() {
		panic("No more token.")
	}
	num, err := strconv.Atoi(scanner.Text())
	if err != nil {
		panic("nextInt(): cannot convert to int: " + scanner.Text())
	}
	return num
}

func nextStr() string {
	if !scanner.Scan() {
		panic("No more token.")
	}
	return scanner.Text()
}

// MinInt returns minimum argument
func MinInt(x, y int) int {
	if x < y {
		return x
	} else {
		return y
	}
}

//MaxInt returns maximum argument
func MaxInt(x, y int) int {
	if x < y {
		return y
	} else {
		return x
	}
}

//AbsInt returns |x| for x
func AbsInt(x int) int {
	if x < 0 {
		return -x
	}
	return x
}

//ModPow calculates integer power with modulo operation
//if modulo <= 1, it powers w/o module operation
//if base < 0, return value might be negative too.
func ModPow(base, exponent, modulo int) (result int) {
	result = 1
	for exponent > 0 {
		if exponent%2 == 1 {
			result *= base
			if modulo > 1 {
				result %= modulo
			}
		}
		base *= base
		if modulo > 1 {
			base %= modulo
		}
		exponent /= 2
	}
	return
}

//Gcd
func Gcd(vals ...int) (result int) {
	if len(vals) == 0 {
		return
	}
	result = vals[0]
	for i := 1; i < len(vals); i++ {
		result = gcd(result, vals[i])
	}
	return
}

func gcd(x, y int) int {
	x, y = AbsInt(x), AbsInt(y)
	for y > 0 {
		x, y = y, x%y
	}
	return x
}

//Lcm
func Lcm(vals ...int) (result int) {
	if len(vals) == 0 {
		return
	}
	result = vals[0]
	for i := 1; i < len(vals); i++ {
		result = lcm(result, vals[i])
	}
	return
}

func lcm(x, y int) int {
	return x * y / gcd(x, y)
}


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

int n,h,w;
int n1,n2,n3;

int main(){
cin>>n>>h>>w;
for(int i=1;i<=n;i++){
int x;
cin >> x;
if(x<=h) n1++;
else if(x<=w) n2++;
else n3++;
}
cout << min(n1,min(n2,n3)) <<endl;
return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define SORT(x) sort((x).begin(), (x).end())
#define RSORT(x) sort((x).rbegin(), (x).rend())
#define ALL(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < n; i++)
#define reps(i, m, n) for (ll i = m; i < n; i++)
#define repr(i, m, n) for (ll i = m; i >= n; i--)
#define de(x) cout << #x << "=" << x << endl;
#define SP << " " <<
template <class T> bool maxi(T &a, const T &b) {
    if (a < b) { a = b; return 1;} return 0;}
template <class T> bool mini(T &a, const T &b) {
    if (b < a) { a = b; return 1;} return 0;}
#define dame {cout<< "-1" <<"\n"; return;}
#define INF2 1000000000000000037
#define INF  1000000007
#define MOD  1000000007
using namespace std;
using ll = long long;
using ld = long double;
using P  = pair<ll,ll>;
//--GLOBAL---------------------------------

//--MAIN-----------------------------------
void Main() {
    ll N,M;
    cin>>N>>M;
    cout<< N*(N-1)/2+M*(M-1)/2<<"\n";
}

//--START----------------------------------
int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
}
//-----------------------------------------


Measured memory_bytes: 256
#include<iostream>
using namespace std;
using ll = long long int;

int main(){
    ll n, d;
    cin >> n >> d;
    int ans = 0;
    for(int i = 0; i < n; i++){
        ll x, y;
        cin >> x >> y;
        if (x * x + y * y <= d * d)ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3192
import java.io.*;

class Main{
    public static void main(String[] args) throws IOException
    {
        InputStreamReader is = new InputStreamReader(System.in);
        BufferedReader br = new BufferedReader(is);
        int[] data = makeIntArray(br);
        int r = data[0], c = data[1];
        int[][] exl = new int[r + 1][c + 1];
        int i, j;
        for(i = 0; i < r; i++){
            data = makeIntArray(br);
            exl[i][c] = 0;
            for(j = 0; j < c; j++){
                exl[i][j] = data[j];
                exl[i][c] += data[j];
            }
        }
        for(j = 0; j <= c; j++){
            exl[r][j] = 0;
            for(i = 0; i < r; i++){ exl[r][j] += exl[i][j]; }
        }
        for(i = 0; i <= r; i++){ show(exl[i]); }
    }
    public static void show(int[] a){
        int n = a.length;
        for(int i = 0; i < n - 1; i++){ System.out.print(a[i] + " "); }
        System.out.println(a[n - 1]);
    }
    public static int[] makeIntArray(BufferedReader br) throws IOException
    {
        String[] str = br.readLine().split(" ");
        int n = str.length;
        int[] a = new int[n];
        for(int i = 0; i < n; i++){ a[i] = Integer.parseInt(str[i]); }
        return a;
    }
}


Measured memory_bytes: 30780
#include<iostream>
#include<cstdio>
using namespace std;
int main(){
	double gpa1[100000],list1[4001]={};
	int N,win[100000]={},list2[4001]={},gpa2[100000];
	cin >> N;
	for(int i=0;i<N;i++){
		scanf("%lf",&gpa1[i]);
	//	cout << gpa1[i]<<"    ";
		gpa1[i]+=0.0001;
		gpa2[i]=gpa1[i]*1000;
	//	cout << gpa2[i] << "\n";
	}
	for(int i=0;i<N;i++){
		if(list1[gpa2[i]]==1){
			win[i]=list2[gpa2[i]];
		}
		else{
			for(int j=0;j<N;j++){
				if(gpa2[i]>gpa2[j])	win[i]+=3;
				else if(gpa2[i]==gpa2[j])	win[i]++;
			}
			
			list1[gpa2[i]]=1;
			list2[gpa2[i]]=win[i];
		}
		cout << (win[i]-1) << "\n";
	}
	return 0;
}

Measured memory_bytes: 4692
import java.util.Scanner;

public class Main{
  public static void main(String[] args){
    Scanner scanner = new Scanner(System.in);
    int n = Integer.parseInt(scanner.next());
    long[] a = new long[n];
    long[] b = new long[n];
    for(int i = 0; i < n; i++){
      a[i] = scanner.nextInt();
      b[i] = scanner.nextInt();
    }
    
    long c = 0;
    for(int i = n - 1; i >= 0; i--){
      a[i] += c;
      if(a[i] % b[i] == 0){
        continue;
      }else{
        c += b[i] - (a[i] % b[i]);
      }
    }
    
    System.out.println(c);
  }
}


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

int main(){
    int a[2],b[2];
    cin >> a[0] >> b[0] >> a[1] >> b[1];
    sort(a,a+2);
    sort(b,b+2);
    if(a[1] >= b[0])cout << 0;
    else cout << b[0]-a[1];
    
}

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

int main()
{
  int x,y;

  cin >> x >> y;

  if (x > y)
    {
      cout << "a" << " > " << "b" << endl;
    }
  else if (x < y)
    {
      cout << "a" << " < " << "b" << endl;
    }
  else if (x = y)
    {
      cout << "a" << " == " << "b" << endl;
    }
}



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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int n;
  cin >> n;
  
  vector<int> p(n);
  for(int i = 0; i < n; i++) cin >> p.at(i);
  
  vector<int> a(n), b(n);
  for(int i = 0; i < n; i++){
    a.at(i) = 20001 * (i + 1);
    b.at(i) = 20001 * (n - i);
  }
  
  for(int i = 0; i < n; i++){
    b.at(p.at(i) - 1) += i + 1;
  }
  
  // 出力
  for(int i = 0; i < n; i++){
    if(i) cout << " ";
    cout << a.at(i);
  }
  cout << '\n';
  for(int i = 0; i < n; i++){
    if(i) cout << " ";
    cout << b.at(i);
  }
  cout << '\n';
}

Measured memory_bytes: 896
#include<iostream>
#include<algorithm>

#define inf 1000000000

using namespace std;

int main(){
	while(1){
		int n;
		int in1[100];
		int in2[100];
		int in3[100];
		cin>>n;
		if(n==0)break;
		for(int i=0;i<n;i++){
			cin>>in1[i]>>in2[i]>>in3[i];
		}
		int maxi=0;
		for(int i=0;i<n;i++){
			maxi=max(maxi,in1[i]);
			maxi=max(maxi,in2[i]);
		}
		
		
		int m=maxi+1;
		
		int C[100][100];
		for(int i=0;i<100;i++){
			for(int j=0;j<100;j++){
				C[i][j]=inf;
			}
		}
		for(int i=0;i<n;i++){
			C[in2[i]][in1[i]]=C[in1[i]][in2[i]]=in3[i];
		}
		
		for(int k=0;k<m;k++){
			for(int i=0;i<m;i++){
				for(int j=0;j<m;j++){
					C[i][j]=min(C[i][j],C[i][k]+C[k][j]);
				}
			}
		}
		
		
		int maxo;
		int maxn=inf;
		int ans[100];
		for(int i=0;i<m;i++){
			ans[i]=0;
			for(int j=0;j<m;j++){
				ans[i]+=C[i][j];
			}
			ans[i]-=C[i][i];
			if(maxn>ans[i]){
				maxn=ans[i];
				maxo=i;
			}
		}
		
		printf("%d %d\n",maxo,maxn);
	}
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
#define L long long
using namespace std;
int n,m,a,b,c,d;
char s[1010][1010];
inline void orz1(int i,int j)
{
    if(a)
      {
       a--;
       s[i][j]='<';
       s[i][j+1]='>';
      }
}
inline void orz2(int i,int j)
{
    if(b)
      {
       b--;
       s[i][j]='^';
       s[i+1][j]='v';
      }
}
int main()
{
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	int i,j;
	scanf("%d%d%d%d",&n,&m,&a,&b);
	for(i=1;i<=n;i++)
	  for(j=1;j<=m;j++)
	    s[i][j]='.';
	if(n&1)
	  for(i=1;i<m;i+=2)
	    orz1(n,i);
	if(m&1)
	  for(i=1;i<n;i+=2)
	    orz2(i,m);
	for(i=1;i<n;i+=2)
	  for(j=1;j<m;j+=2)
	    if(a>=2 || a==1 && (!b || b==1 && !(i==n-2 && j==m-2)))
	      {
           orz1(i,j);
           orz1(i+1,j);
          }
        else if(b>=2 || b==1 && (!a || a==1 && !(i==n-2 && j==m-2)))
          {
           orz2(i,j);
           orz2(i,j+1);
          }
        else if(a==1 && b==1 && i==n-2 && j==m-2)
          {
           a++;
           b++;
           orz1(i,j);
           orz1(i+2,j+1);
           orz2(i+1,j);
           orz2(i,j+2);
          }
    if(!a && !b)
      {
       printf("YES\n");
       for(i=1;i<=n;i++)
         printf("%s\n",s[i]+1);
      }
    else
      printf("NO\n");
	return 0;
}


Measured memory_bytes: 2176
from sys import stdin


def main() -> int:
    n = next_int()
    m = next_int()
    dic = [0] * n

    for _ in range(m):
        a, b = map(lambda x: int(x) - 1, input().split())

        dic[a] += 1
        dic[b] += 1

    [print(v) for v in dic]

    return 0


def next_int() -> int:
    return int(next_str())


def next_str() -> str:
    result = ""
    while True:
        tmp = stdin.read(1)
        if tmp.strip() != "":
            result += tmp
        elif tmp != '\r':
            break
    return result


if __name__ == '__main__':
    main()

Measured memory_bytes: 3064
//Satyam Chaudhary https://github.com/satyam3976
#include <bits/stdc++.h>
using namespace std;
typedef vector<long long> vll;
typedef long l;
#define mp make_pair
#define pb push_back
#define long long int
#define f(i,s,n) for(l i=s;i<n;i++)
#define fe(i,s,n) for(l i=s;i<=n;i++)
#define fr(i,s,n) for(l i=s;i>n;i--)
#define fre(i,s,n) for(l i=s;i>=n;i--)
const int maxn = 2e6 + 10;

int32_t main()
{
    int a,b,c;
    cin>>a>>b>>c;
    if(c-(a-b)>=0)
        cout<<c-(a-b)<<endl;
    else
        cout<<0<<endl;
}

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

    return 0;
}


Measured memory_bytes: 128
import java.util.Scanner;


public class Main {
    public static void main(String args[]){
        Scanner scanner = new Scanner(System.in);
        int y = scanner.nextInt();
        int x = scanner.nextInt();
        int count = 0;
        while (true){
          if(scanner.next().equals("snuke")){
              int a = count % x + 1;
              int b = count / x + 1;
              byte c[] = new byte[1];
              c[0] = (byte)(a + 64);
              System.out.println(new String(c) + b);
              break;
          }
            else{
              ++count;
          }

        }
    }
}

Measured memory_bytes: 9684
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
#define ROF(i,a,b) for(int i=a;i>=b;i--)
#define per(i,a) ROF(i,a,0)
#define pb push_back
using namespace std;
using ll=long long;
using ld=long double;
using ch=char;
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<P> vP;
typedef vector<ch> vc;
typedef vector<vc> vvc;
const ll MOD=1000000007;
const ll MOD2=998244353;
const ld PI=acos(-1);
const ll INF=1e18;
struct edge{ll to,cost;};
struct edge2{ll from,to,cost;};

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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N,M;
    cin >> N >> M;
    vP p(M);
    rep(i,M){
        cin >> p[i].second >> p[i].first;
    }
    sort(p.begin(),p.end());
    ll cnt=1;
    ll nowmx=p[0].first;
    rep(i,M){
        if(nowmx<=p[i].second){
            nowmx=p[i].first;
            cnt++;
        }
    }
    cout << cnt << endl;
}
/*
overflow checked?
corner case checked?
boundary checked?
not TLE in worst case checked?
*/


Measured memory_bytes: 4768
#pragma target("avx")
#pragma optimize("O3")
#include<bits/stdc++.h>
using ll = int_fast64_t;
using P = std::pair<ll,ll>;
using PP = std::pair<ll,P>;
using V = std::vector<ll>;
template<typename T> using pq = std::priority_queue<T>;
template<typename T> using rpq = std::priority_queue<T, std::vector<T>, std::greater<T>>;

#define REP(i,b,e) for(ll i=b; i<e; i++)
#define ALL(vec) vec.begin(),vec.end()
#define PRINT(vec) printf("[ ");for(auto &i:vec)printf("%ld ",i);puts("]");
#define SCAN(vec) for(auto &i:vec)scanf("%ld",&i)
#define fi first
#define se second

const int MOD = 1e9+7;
const ll INF = 1e18;
int dx[] = {0, 1, 0, -1, 1, 1, -1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};

int main(){
        ll n, x, t;
        scanf("%ld %ld %ld", &n, &x, &t);
        printf("%ld\n", (n+x-1)/x * t);
        return 0;
}

Measured memory_bytes: 3712
def main():
    x, y = map(int, input().split())

    for i in range(x + 1):
        kame = (x - i) * 4
        turu = i * 2

        if (kame + turu) == y:
            print("Yes")
            exit(0)

    print("No")


if __name__ == "__main__":
    main()


Measured memory_bytes: 9172
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long int
#define rep(i, n) for(int i = 0; i < n; i++)
#define repp(i, n) for(int i = 1; i <= n; i++)
#define sort(v) sort((v).begin(), (v).end())
#define pb push_back
#define mp make_pair
#define riverse(v) reverse((v).begin(), (v).end())
using vi = vector<int>;
using vs = vector<string>;
using vvi = vector<vi>;
using vll = vector<ll>;
const ll MOD = 1e9+7;
vi alphabet = {'a','b','c','d','e','f','g','h','i','j','k','l','m',
               'n','o','p','q','r','s','t','u','v','w','x','y','z'};

int main() {
	int N,Y;
  	cin >> N >> Y;
  	bool frag=false;
  	int x,y,z;
  	for(int i=0;i<=N;i++){
    	for(int j=0;i+j<=N;j++){
        	if(10000*i+5000*j+1000*(N-i-j) == Y){
            	frag=true;
              	x=i;
              	y=j;
              	z=N-i-j;
              	break;
            }
          	if(frag) break;
        }
      	if(frag) break;
    }
  	if(frag) cout<<x<<" "<<y<<" "<<z<<endl;
  	else cout <<"-1 -1 -1"<<endl;
}

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

int main() {
    string S;
    cin >> S;
    bool flag = false;
    bool ans = false;
    for (int i=0; i<S.size(); i++) {
        char c = S[i];
        if (flag==false) {
            if (c=='C') flag = true;
            continue;
        }
        if (flag) {
            if (c=='F') {
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
(defun solve (card numbers)
  (dolist (num numbers)
    (dotimes (j 3)
      (dotimes (i 3)
        (when (= (aref card j i) num)
          (setf (aref card j i) -1)))))
  (if (or (= -1
             (aref card 0 0)
             (aref card 1 0)
             (aref card 2 0))
          (= -1
             (aref card 0 1)
             (aref card 1 1)
             (aref card 2 1))
          (= -1
             (aref card 0 2)
             (aref card 1 2)
             (aref card 2 2))
          (= -1
             (aref card 0 0)
             (aref card 0 1)
             (aref card 0 2))
          (= -1
             (aref card 1 0)
             (aref card 1 1)
             (aref card 1 2))
          (= -1
             (aref card 2 0)
             (aref card 2 1)
             (aref card 2 2))
          (= -1
             (aref card 0 0)
             (aref card 1 1)
             (aref card 2 2))
          (= -1
             (aref card 0 2)
             (aref card 1 1)
             (aref card 2 0)))
      "Yes"
      "No"))

#-swank
(let* ((card (make-array '(3 3) :element-type 'fixnum :initial-element 0)))
  (dotimes (j 3)
    (dotimes (i 3)
      (setf (aref card j i) (read))))
  (let* ((n (read))
         (numbers (loop repeat n collect (read))))
    (format t "~A~%" (solve card numbers))))


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

using namespace std;

int A(int N, int M) {
	 return N * (N - 1) / 2 + M * (M - 1) / 2;
}

int main() {
	int N, M;
	cin >> N >> M;
	cout << A(N, M);
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<map>
#include<algorithm>
using namespace std;
int main(){
  int n,m;
  while(cin >>n>>m,n||m){
    vector<pair<int,pair<int, int> > > bridge;
    bool city[101] = {false};
    int cost = 0;
    for(int i=0; i<m; i++){
      int x,y,z;
      cin >>x>>y>>z;
      bridge.push_back(make_pair(z,make_pair(x,y)));
    }
    sort(bridge.begin(),bridge.end());
    city[bridge[0].second.first] = true;
    city[bridge[0].second.second] = true;
    cost+=bridge[0].first;
    for(int i=1; i<n; i++){
      for(int j=0; j<m; j++){
	if(city[bridge[j].second.first] && (!city[bridge[j].second.second])){
	  cost+=bridge[j].first;
	  city[bridge[j].second.second] = true;
	  break;
	}
	if((!city[bridge[j].second.first]) && city[bridge[j].second.second]){
	  cost+=bridge[j].first;
	  city[bridge[j].second.first] = true;
	  break;
	}
      }
    }
    cout <<cost<<endl;
  }
  return 0;
}

Measured memory_bytes: 1204
//JAI SAI RAM Trying to solve harder problems first
//atcoder seems better than codechef might or might not be...
// message me on codeforces if you want anything related to competitive coding my codeforces handle is @AM_I_Learning.
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{  
     ll i,j,k,l,m,n,o,p,q,r,s,t,a[100001],b[100001];
     string ss;
     cin>>ss;
     if(ss=="hi"||ss=="hihi"||ss=="hihihi"||ss=="hihihihi"||ss=="hihihihihi")
     {
         cout<<"Yes\n";
     }
     else 
     {
         cout<<"No\n";
     }
    return 0;
}


Measured memory_bytes: 256
open System

[<EntryPoint>]
let main argv =
    let N =stdin.ReadLine()|>int
    match N with
    |1 -> stdout.WriteLine "Hello World"
    |2 -> [for i in [0..1] do yield (stdin.ReadLine()|>int)]|>List.sum|>stdout.WriteLine
    |_ -> stdout.WriteLine ""
    0


Measured memory_bytes: 11348
#include "bits/stdc++.h"

using namespace std;
using ll=long long;
using ull=unsigned long long;

typedef pair<int,int>Pi;
typedef pair<long long,long long>P;
typedef pair<long long,P>PP;
typedef pair<P,P>PPP;

const long long MOD=1e9+7;
const long long INF=5e18;
const int di[4]={1,0,-1,0};
const int dj[4]={0,1,0,-1};

#define fr first
#define sc second
#define pb push_back
#define eb emplace_back
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()

int n,a[200010];
int l,r,mid;
map<int,int>mp;

bool check(int lim){
	if(lim==1)return is_sorted(a,a+n);
	for(int i=1;i<n;i++){
		if(a[i-1]<a[i])continue;
		mp.erase(mp.upper_bound(a[i]),mp.end());
		int now=a[i];
		while(true){
			if(mp[now]){
				if(mp[now]==lim-1&&now==1)return false;
				else if(mp[now]==lim-1)mp.erase(now),now--;
				else {
					mp[now]++;
					break;
				}
			}
			else{
				mp[now]++;
				break;
			}
		}
	}
	return true;
}

void input(){
	cin>>n;
	for(int i=0;i<n;i++)cin>>a[i];
	return;
}

void solve(){
	r=n;
	while(r-l>1){
		mid=(l+r)/2;
		if(check(mid))r=mid;
		else l=mid;
		mp.clear();
	}
	cout<<r<<endl;
	return;
}

int main(){
	input();
	solve();
	return 0;
}


Measured memory_bytes: 1024
# -*- coding: utf-8 -*-

N, X = map(int, input().split())

min = 10000
moto_nokori = X

m = 0
for i in range(N):
	m = int(input())
	moto_nokori -= m
	if min > m:
		min = m

res = N + moto_nokori // min

print(res)

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

int  s[50][26];
int ans[26];

int main(){
    int n;
    cin >> n;

    for(int i=0; i < n; i++){
        string temp;
        cin >> temp;
        for(int j=0; j < (int)temp.size(); j++){
            s[i][temp[j] - 'a'] += 1;
        }
    }

/*
    for(int i=0; i < n; i++){
        int tmp = 99999;
        for(int j=0; j < n; j++){
            tmp = min(tmp, s[j][i]);
        }
        ans[i] = tmp;
    }



    for(int i=0; i < 26; i++){
        for(int j=0; j < ans[i]; j++){
            char alph = i + 'a';
            cout << alph;
        }
    }
    cout << endl;
*/
    for(int i=0; i < 26; i++){
        int mi = s[0][i];
        for(int j=0; j < n; j++){
            mi = min(mi, s[j][i]);
        }
        for(int k=0; k < mi; k++){
            char alph = i + 'a';
            cout << alph;
        }
    }
    cout << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 9223372036854775807;
const ll half_inf = 0x3f3f3f3f;
const ll inf = 0x7fffffff;
const ll mod = 1e9 + 7;
const ll maxn = 200005;

int main(){  
	cin.tie(0);
    ios::sync_with_stdio(false);
	int n,m,k;
	scanf("%d%d",&n,&m);
	
	
	
	printf("%d",(n+m)*(n+m-1)/2-m*n);
	
    return 0;
}




Measured memory_bytes: 256
// Slimes.cpp : This file contains the 'main' function. Program execution begins and ends there.
///  by farah 1/3/2020

#include <iostream>
using namespace std;
int main()
{
	string s;
	int n , count = 0;

	cin >> n;
	cin >> s;
	
	char prevChar = s[0] , curChar;

	for (int i = 1; i < s.size(); i++) {
		curChar = s[i];
		if (prevChar == curChar) {
			s.erase(i, 1);
			i--;
		}
		else {
			prevChar = curChar;
		}
	}
	cout << s.size();
}


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

using namespace std;

void init(vector<int>& v){
  int n = 0;
  int input;
  cin >> n;
  for(int i = 0; i < n; i++){
    cin >> input;
    v.push_back(input);
  }
  sort(v.begin(), v.end());
  v.erase( unique(v.begin(), v.end()), v.end() );
}

int linearsearch(int key, vector<int> t, int count){
  int i = 0;
  t.push_back(key);
  while(t[i]!=key){
    i++;
  }
  if(t.size()-1!=i) return count+1;
  else return count;
}

int main(int argc, char* argv[]){
  vector<int> a, b;
  int count = 0;
  init(a);
  init(b);
  for (auto i : a) count = linearsearch(i, b, count);
  cout << count << endl;
}

Measured memory_bytes: 3132
from math import cos, radians, sqrt
A, B, H, M = list(map(int, input().split()))
H = H%12
Adegree = (H*60+M)/2
Bdegree = M*6
theta = abs(Adegree - Bdegree)
print(sqrt(A*A + B*B - 2*A*B*cos(radians(theta))))

Measured memory_bytes: 9444
import java.util.Scanner;

public class Main {
	
	public static final int MAX = 8;
	
	public static boolean ok(int x, int y){
		if(x < 0 || x >= MAX || y < 0 || y >= MAX){
			return false;
		}
		
		return true;
	}
	
	public static int check_dir(int x, int y, int color, int dx, int dy, int[][] board){
		if(board[y][x] != color){
			return Integer.MIN_VALUE;
		}
		
		int count = 0;
		while(true){
			x += dx;
			y += dy;
			
			if(!ok(x, y)){
				return Integer.MIN_VALUE;
			}else if(board[y][x] == color){
				return count;
			}else if(board[y][x] == 0){
				return Integer.MIN_VALUE;
			}
			
			count++;
		}
	}
	
	public static void do_dir(int x, int y, int color, int dx, int dy, int[][] board){
		if(board[y][x] != color){
			return;
		}
		
		while(true){
			x += dx;
			y += dy;
			
			if(!ok(x, y)){
				return;
			}else if(board[y][x] == color){
				return;
			}else if(board[y][x] == 0){
				return;
			}
			
			board[y][x] = color;
		}
	}
	
	public static boolean do_it(int color, int[][] board){
		int max = 0;
		int m_x = -1, m_y = -1;
		
		for(int y = 0; y < MAX; y++){
			for(int x = 0; x < MAX; x++){
				if(board[y][x] != 0){
					continue;
				}
				
				board[y][x] = color;
				int sum = 0;
				
				for(int dy = -1; dy <= 1; dy++){
					for(int dx = -1; dx <= 1; dx++){
						if(dy == 0 && dx == 0){
							continue;
						}
						
						final int cur = check_dir(x, y, color, dx, dy, board);
						if(cur > 0){
							sum += cur;
						}
					}
				}
				
				if(color == 1){
					if(max < sum){
						max = sum;
						m_x = x;
						m_y = y;
					}
				}else if(sum > 0){
					if(max <= sum){
						max = sum;
						m_x = x;
						m_y = y;
					}
				}
				
				board[y][x] = 0;
			}
		}
		
		if(m_x != -1 && m_y != -1){
			board[m_y][m_x] = color;
			
			for(int dy = -1; dy <= 1; dy++){
				for(int dx = -1; dx <= 1; dx++){
					if(dy == 0 && dx == 0){
						continue;
					}
					
					if(check_dir(m_x, m_y, color, dx, dy, board) > 0){
						do_dir(m_x, m_y, color, dx, dy, board);
					}
				}
			}
			
			return true;
		}else{
			return false;
		}
	}
	
	public static void draw(int[][] board){
		for(int i = 0; i < MAX; i++){
			for(int j = 0; j < MAX; j++){
				System.out.print(board[i][j] == 1 ? 'o' : board[i][j] == -1 ? 'x' : '.');
			}
			System.out.println();
		}
	}
	
	public static void main(String[] args) {

		final Scanner sc = new Scanner(System.in);

		int[][] board = new int[MAX][MAX];
		
		for(int i = 0; i < MAX; i++){
			char[] input = sc.next().toCharArray();
			
			for(int j = 0; j < MAX; j++){
				if(input[j] == 'o'){
					board[i][j] = 1;
				}else if(input[j] == 'x'){
					board[i][j] = -1;
				}else{
					board[i][j] = 0;
				}
			}
		}
		
		int turn = 1;
		boolean before_skip = false;
		while(true){
			if(!do_it(turn, board)){
				if(before_skip){
					break;
				}else{
					before_skip = true;
				}
			}else{
				before_skip = false;
			}
			
			turn = -turn;
			//draw(board);
			//System.out.println("--------");
		}
		
		draw(board);
	}

}

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

public class Main {

	public static void main(String[] args) throws NumberFormatException,
			IOException {
		BufferedReader reader = new BufferedReader(new InputStreamReader(
				System.in));

		String s;
		while ((s = reader.readLine()) != null) {
			int a = Integer.parseInt(s);
			System.out.println(getPrime(a));

		}

	}

	public static int getPrime(int a) {
		int count = 0;
		for (int i = 2; i <= a; i++) {
			if (isPrime(i))
				count++;
		}
		return count;
	}

	private static boolean isPrime(int i) {
		if (i == 2)
			return true;
		else if (i % 2 == 0)
			return false;
		else if (i < 8)
			return true;
		else if (i % 3 == 0)
			return false;
		else {
			for (int j = 5; j * j <= i; j += 6) {
				if (i % j == 0) {
					return false;
				} else if (i % (j + 2) == 0)
					return false;
			}
			return true;
		}
	}

}

Measured memory_bytes: 18664
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while (sc.hasNext()) {
			long a = sc.nextLong();
			long b = sc.nextLong();
			long gcd = gcd(a, b);
			long lcm = (a * b) / gcd;
			System.out.println(gcd + " " + lcm);
		}
		sc.close();
	}

	static long gcd(long a, long b) {
		return b == 0 ? a : gcd(b, a % b);
	}
}

Measured memory_bytes: 26192
N, K, S = map(int, input().split())
L = []
for i in range(N):
    if i < K:
        L.append(str(S))
    else:
        L.append(str(10**9 - 1))
print(' '.join(L))

# S S S S S ... N個続くとき
# Sとなるl, rが (1, 1), (2, 2), ... , (N, N) とN個ある

# X + Y = S
# X Y X Y X Y ... N個続くとき
# Sとなるl, rが (1, 2), (2, 3), ..., (N - 1, N) と N - 1個ある

# 100 100 100 100 : K=N
# 100 100 100 0   : K=N-1
# 100 100 0   0   : K=N-2


Measured memory_bytes: 13464
#include<stdio.h>
int main()
{
    int a,b,i;
    scanf("%d %d",&a,&b);
    if(a<b)
    {
        for(i=0;i<b;i++)
            printf("%d",a);
    }
    else if(b<a)
        {
        for(i=0;i<a;i++)
            printf("%d",b);
    }
    else{
        for(i=0;i<b;i++)
            printf("%d",a);
    }
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int main()
{
//	freopen("test_.inp","r",stdin);
//	freopen("test_.out","w",stdout);
	ios::sync_with_stdio(0);
	cin.tie(NULL);
	int a,b;
	cin>>a>>b;
	if ((a > 0)&&(b > 0))
		{
			cout<<"Positive";
			return 0;
		}
	if ((a == 0)||(b == 0))
		{
			cout<<"Zero";
			return 0;
		}
	if ((a <= 0)&&(b >= 0))
		{
			
			cout<<"Zero";
			return 0;
		}
	a=b-a;
	if (a%2 == 0)
		{
			cout<<"Negative";
			return 0;
		}
	cout<<"Positive";
	return 0;
}

Measured memory_bytes: 256
#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)
#define ALL(vec) vec.begin(), vec.end()
#define rALL(vec) vec.rbegin(), vec.rend()
using namespace std;
using ll = long long;
// ------------------------------

int main() {
    int N, K;
    cin >> N >> K;
    cout << ((N + 1)/2 >= K ? "YES" : "NO") << endl;
    return 0;
}

Measured memory_bytes: 3624