akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <cstdio>
#include <cstdlib>

#ifdef _MSC_VER
#include <Windows.h>
#else
#include <unistd.h>
#endif

using namespace std;

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

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

//typedef
//------------------------------------------
typedef pair<int, int> PII;
typedef pair<long, long> PLL;
typedef long long LL;
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort((c).begin(),(c).end())

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

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD=(LL)1e9+7;
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

#define INF 1LL << 50

int N;string s;
string res="";

bool f(){
    FOR(i,1,N-1){
        if(s[i]=='o'&&res[i]=='S'&&res[i-1]=='S'){
            res+='S';
        }else if(s[i]=='o'&&res[i]=='W'&&res[i-1]=='S'){
            res+='W';
        }else if(s[i]=='o'&&res[i]=='S'&&res[i-1]=='W'){
            res+='W';
        }else if(s[i]=='o'&&res[i]=='W'&&res[i-1]=='W'){
            res+='S';
        }else if(s[i]=='x'&&res[i]=='S'&&res[i-1]=='S'){
            res+='W';
        }else if(s[i]=='x'&&res[i]=='W'&&res[i-1]=='S'){
            res+='S';
        }else if(s[i]=='x'&&res[i]=='S'&&res[i-1]=='W'){
            res+='S';
        }else if(s[i]=='x'&&res[i]=='W'&&res[i-1]=='W'){
            res+='W';
        }
    }
    bool flag1,flag2;
    if(s[N-1]=='o'){
        if(res[N-1]=='S'){
            flag1=res[N-2]==res[0];
        }else if(res[N-1]=='W'){
            flag1=res[N-2]!=res[0];
        }
    }else{
        if(res[N-1]=='S'){
            flag1=res[N-2]!=res[0];
        }else if(res[N-1]=='W'){
            flag1=res[N-2]==res[0];
        }
    }

    if(s[0]=='o'){
        if(res[0]=='S'){
            flag2=res[N-1]==res[1];
        }else if(res[0]=='W'){
            flag2=res[N-1]!=res[1];
        }
    }else{
        if(res[0]=='S'){
            flag2=res[N-1]!=res[1];
        }else if(res[0]=='W'){
            flag2=res[N-1]==res[1];
        }
    }
    if(flag1&&flag2)return true;
    return false;
}

int main(){
    cin>>N;cin>>s;
    res="SS";
    if(f()){
        cout<<res<<endl;return 0;
    }
    res="SW";
    if(f()){
        cout<<res<<endl;return 0;
    }
    res="WS";
    if(f()){
        cout<<res<<endl;return 0;
    }
    res="WW";
    if(f()){
        cout<<res<<endl;return 0;
    }
    cout<<-1<<endl;
    return 0;
}

Measured memory_bytes: 640
#include "iostream"
#include "string"
#include "vector"
#include "algorithm"
#include "functional"
#include "cmath"
#include "iomanip"
#include "map"

struct city_t {
    int id;
    int pref;
    int year;
    int order;
};

bool compare_city_by_year(const city_t &a, const city_t &b) {
    return a.year < b.year;
}

bool compare_city_by_id(const city_t &a, const city_t &b) {
    return a.id < b.id;
}

void print_city(city_t *city){
    std::cout << std::setfill('0') << std::setw(6) << city->pref;
    std::cout << std::setfill('0') << std::setw(6) << city->order;
    std::cout << std::endl;
}

int main() {
    // get values from input
    int n, m;
    std::vector<city_t> cities;
    std::map<int, int> city_count_in_prefs;

    std::cin >> n >> m;
    for (int i = 0; i < m; ++i) {
        int p_i, y_i;
        std::cin >> p_i >> y_i;
        cities.push_back(city_t { i, p_i, y_i, -1 });
        city_count_in_prefs[p_i] = 0;
    }

    // main procedure
    std::sort(cities.begin(), cities.end(), compare_city_by_year);
    for (int i = 0; i < m; ++i) {
        city_count_in_prefs[cities[i].pref] += 1;
        cities[i].order = city_count_in_prefs[cities[i].pref];
    }

    std::sort(cities.begin(), cities.end(), compare_city_by_id);

    // output
    for (int i = 0; i < m; ++i) {
            print_city(&cities[i]);
    }
    return 0;
}

Measured memory_bytes: 7792
# 2019/04/13
# AtCoder Beginner Contest 124 - C

# Input
s = input()

cnt_a = 0
cnt_b = 0
# Case 0101.../ 1010...
for i in range(len(s)):
    # When Even
    if (i % 2) == 0:
        if s[i] == "1":
            cnt_a += 1
        else:
            cnt_b += 1
    # When Odd
    else:
        if s[i] == "0":
            cnt_a += 1
        else:
            cnt_b += 1

# Output
print(min(cnt_a, cnt_b))


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

int main(){
  std::vector<int> A(3);
  std::cin >> A.at(0) >> A.at(1) >> A.at(2);
  sort(A.begin(), A.end());
  if(A.at(0) == 5 && A.at(1) == 5 && A.at(2) == 7) std::cout << "YES" << std::endl;
  else std::cout << "NO" << std::endl;
}

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

int main() {
	ll n; cin>>n;
	ll t;
	ll flag = false,sum=0;
	for(ll i=1;i<=n;i++){
		if(i%3 !=0 && i%5 !=0){
			sum += i;
		}
	}
	cout<<sum;
}

Measured memory_bytes: 3632
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        int i,j,k=0;
        int harr[][][]=new int[4][3][10];
        Scanner sc= new Scanner(System.in);
        int n= sc.nextInt();
        for(i=0;i<n;i++){
            int b=sc.nextInt(); 
            int f=sc.nextInt(); 
            int r=sc.nextInt(); 
            int v=sc.nextInt(); 
            harr[b-1][f-1][r-1]+=v;
        }

        for(i=0;i<4;i++){
            for(j=0;j<3;j++){
                for(k=0;k<10;k++){
                    System.out.printf(" %d",harr[i][j][k]);
                }
                System.out.println();
            }
            if(i!=3){
                System.out.println("####################");
            }
        }
        sc.close();
    }    
}


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

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
//#define int long long
#define ll long long
#define REP(i,a,b) for (int i=a; i<(b); i++)

using namespace std;
typedef vector<int> vi;
typedef pair<int,int> pi;

signed main() {
  IOS;
  int M,K;
  string S;
  cin >> M >> K;
  if (K == 0) {
    REP(i, 0, 1<<M) {
      cout << i << " " << i << " ";
    }
    cout << endl;
    return 0;
  }

  if (K > ((1<<M)-1)) {
    cout << -1 << endl;
    return 0;
  }

  int x = 0;
  REP(i, 0, 1<<M) {
    if (i == K) continue;
    x ^= i;
  }
  if (x == K) {
    for (int i = (1<<M)-1; i >= 0; i--) {
      if (i == K) continue;
      cout << i << " ";
    }
    cout << K << " ";
    REP(i, 0, 1<<M) {
      if (i == K) continue;
      cout << i << " ";
    }
    cout << K << " ";
    cout << endl;
  } else {
    cout << -1 << endl;
  }

  return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//namespace mp = boost::multiprecision;

using namespace std;

const double PI = 3.14159265358979323846;
typedef long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
typedef pair<ll, ll> P;
const ll INF = 10e17;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
#define ret() return 0;

double equal(double a, double b) {
    return fabs(a - b) < DBL_EPSILON;
}

std::istream &operator>>(std::istream &in, set<int> &o) {
    int a;
    in >> a;
    o.insert(a);
    return in;
}

std::istream &operator>>(std::istream &in, queue<int> &o) {
    ll a;
    in >> a;
    o.push(a);
    return in;
}

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }

//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);
//const ll mod = 1e10;

typedef priority_queue<ll, vector<ll>, greater<ll> > PQ_ASK;

struct Key {
    int match, price;
};

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

    vector<Key> keys(m);

    rep(i, m) {
        int a, b;
        cin >> a >> b;

        int match = 0;
        rep(_, b) {
            int c;
            cin >> c;
            c--;
            int next = 1 << c;
            match |= next;
        }

        keys[i] = {match, a};
    }

    vector<int> dp(1 << n, -1);
    dp[0] = 0;
    for (Key key : keys) {
        rep(i, 1 << n) {
            if (dp[i] == -1) continue;
            int next_match = i | key.match;
            int next_price = dp[i] + key.price;
            if (dp[next_match] == -1) dp[next_match] = next_price;
            else
                cmin(dp[next_match], next_price);
        }
    }

    cout << dp[(1 << n) - 1] << endl;

}


Measured memory_bytes: 3616
import heapq
X, Y, A, B, C = map(int, input().split())
P = sorted(list(map(int, input().split())), reverse=True)
Q = sorted(list(map(int, input().split())), reverse=True)
R = sorted(list(map(int, input().split())), reverse=True)

hq = P[:X] + Q[:Y]
heapq.heapify(hq)

for r in R:
    heapq.heappushpop(hq, r)

print(sum(hq))


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

#define PI 3.1415926535897932

int a[305][305], dp[305][305];
const int inf=(1ll<<30);

signed main(){
    int mod=1000000007;
    int n;
    scanf("%d",&n);
    for (int i=0;i<n;i++) for (int j=0;j<n;j++) {
        scanf("%d",&a[i][j]);
        dp[i][j]=a[i][j];
    }

    for (int k=0;k<n;k++) for (int i=0;i<n;i++) for (int j=0;j<n;j++) {
        if (k==i || k==j || i==j || dp[i][k]==inf || dp[k][j]==inf) continue;
        if (dp[i][k]+dp[k][j]==dp[i][j]) {
            dp[i][j]=inf;
        } else if (dp[i][k]+dp[k][j]<a[i][j]) {
            printf("-1\n");
            return 0;
        }
    }
    long long sum=0ll;
    for (int i=0;i<n;i++) for (int j=0;j<n;j++) if (dp[i][j]!=inf) sum+=dp[i][j];
    printf("%lld\n",sum/2);
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define OUT(s) cout << s << "\n";
#define length(ary) sizeof(ary) / sizeof(ary[0]);
using namespace std;

int N, K, tmp, a;
// vector<int> p;
vector<int> p;
// https://atcoder.jp/contests/abc171
void Main()
{
    sort(p.begin(), p.end());
    REP(i, K) {
        a = a + p[i];
    }
    OUT(a);

}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    // cout << fixed << setprecision(15);
    cin >> N >> K;
    REP(i, N) {
        cin >> tmp;
        p.push_back(tmp);
        // cin >> p[i];
    }
    Main();
    return 0;
}

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

int main(void)
{
    int n;
    cin >> n;
    vector<int> bn(n, 0);
    for(int i = 0; i < n-1; ++i)
    {
        int a;
        cin >> a;
        ++bn.at(a-1);
    }

    for(int i = 0; i < n; ++i)
    {
        cout << bn.at(i) << endl;
    }

    return 0;
}



Measured memory_bytes: 4048
// lcmとか__builtin_popcountとかはg++ -std=c++17 default.cppみたいなかんじで

#include <bits/stdc++.h>
#define mod 1000000007
#define INF LLONG_MAX
#define ll long long
#define ln cout<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
using namespace std;
ll dx[4]={1,0,-1,0};
ll dy[4]={0,1,0,-1};

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

    ll a,b,c,d,n,maxi=0,f=0,mini=INF,sum=0;
    cin>>n;
    vector<ll> v(n);
    rep(i,n) cin>>v[i];
    rep(i,n) sum+=v[i];
    sort(all(v));
    if(sum%10!=0){
        cout<<sum<<endl;
        return 0;
    }
    rep(i,n){
        if(v[i]%10!=0){
            cout<<sum-v[i]<<endl;
            return 0;
        }
    }
    cout<<0<<endl;
    
    return 0;
}


Measured memory_bytes: 3656
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <bitset>
#include <set>
#include <queue>

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

const float PI = 3.1415926;
static const int INFTY = (1<<30);

using namespace std;

typedef long long ll;
typedef long double ld;

int n, a, b, c;

int main() {
  cin >> n;
  rep(i,n){
    cin >> a >> b >> c;
    int tmp = max(max(a,b),c);
    if(a == tmp) a=c;
    if(b == tmp) b=c;
    if(a*a + b*b == tmp*tmp)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }

  return 0;
}

Measured memory_bytes: 1152
#include<stdio.h>

int main( ){

  int W,H,x,y,r;
 
 scanf("%d%d%d%d%d",&W,&H,&x,&y,&r);
 
 if (x-r<0||x+r>W||y-r<0||y+r>H){printf("No\n");
 }else if (x-r>=0&&x+r<=W||y-r>=0&&y+r<=H) {printf("Yes\n");
 }

  return 0;
}

Measured memory_bytes: 584
def main():
    N = int(input())
    v = [list(map(int,input().split())) for _ in range(N)]
    dp = [[0]*3 for _ in range(N+1)]
    for i in range(N):
        dp[i+1][0] = max(dp[i][1],dp[i][2]) + v[i][0]
        dp[i+1][1] = max(dp[i][0],dp[i][2]) + v[i][1]
        dp[i+1][2] = max(dp[i][0],dp[i][1]) + v[i][2]
    print(max(dp[N][i] for i in range(3)))
    
main()

Measured memory_bytes: 50364
#include<bits/stdc++.h>
using namespace std;
string s,t;
int main()
{
	cin >> s;
	cin >> t;
	bool flag=false;
	for(int i=0;i<s.length();i++)
	{
		int sum=0;
		for(int k=i;sum<s.length();k=(k+1)%s.length(),sum++)
		{
			if(s[sum]!=t[k])
				break;
		}
		if(sum==s.length())
		{
			flag=true;
			break;
		}
	}
	if(flag)
		printf("Yes\n");
	else
		printf("No\n");
	return 0;
}

Measured memory_bytes: 256
N, X, M = map(int, input().split())
A = [X]
S = [0, X]
Y = [-1] * M
f = 0
s = X
for i in range(1, M * 5 + 10):
    a = A[-1] ** 2 % M
    s += a
    A.append(a)
    S.append(s)
    if f == 0 and Y[a] >= 0:
        rp = i - Y[a]
        t = Y[a]
        f = 1
    Y[a] = i
if N < M * 5 * 0:
    print(S[N])
else:
    j = N % rp + (t // rp + 1) * rp
    print(S[j] + (S[t + rp] - S[t]) * (N - j) // rp)

Measured memory_bytes: 142852
H,W=map(int,input().split())
S=[input() for _ in range(H)]
ans=float("inf")

counter=[[999]*W for _ in range(H)]

def search(i,j,count):
    global ans

    if counter[i][j]!=999:
        ans=min(ans,count+counter[i][j])
        return(counter[i][j])

    dist=999

    if i==H-1 and j==W-1:
        ans=min(ans,count)
        return 0
    countj=count
    counti=count
    
    if j<W-1:
        if S[i][j]=="." and S[i][j+1]=="#":
            countj+=1
        dist=search(i,j+1,countj) + (S[i][j]=="." and S[i][j+1]=="#")
    if i<H-1:
        if S[i][j]=="." and S[i+1][j]=="#":
            counti+=1
        dist=min(dist,search(i+1,j,counti)+(S[i][j]=="." and S[i+1][j]=="#"))
    
    counter[i][j]=dist
    return dist
search(0,0,(S[0][0]=="#")*1)
print(ans)

Measured memory_bytes: 42844
use std::io::*;

fn main() {
    let mut s: String = String::new();
    std::io::stdin().read_to_string(&mut s).ok();
    let mut itr = s.trim().split_whitespace();
    let a: u64 = itr.next().unwrap().parse().unwrap();
    let b: u64 = itr.next().unwrap().parse().unwrap();
    let x: u64 = itr.next().unwrap().parse().unwrap();

    let mut y = b / x - a / x;
    if a % x == 0 {
        y += 1;
    }
    println!("{}", y);
}


Measured memory_bytes: 4352
N = int(input())
A = list(map(int,input().split()))
a = {}
for i in A:
    if i in a:
        a[i] += 1
    else:
        a[i] = 1
Q = int(input())
ans = sum(A)
for i in range(Q):
    B,C = map(int,input().split())
    if B in a:
        ans += (C-B) * a[B]
        if C in a:
            a[C] += a[B]
        else:
            a[C] = a[B]
        a[B] = 0
    print(ans) 

Measured memory_bytes: 20720
import math

def Koch(Px, Py, Qx, Qy, n) :
    if n == 0 :
        return
    else :
        Ax = (2 * Px + Qx) / 3
        Ay = (2 * Py + Qy) / 3
        Bx = (Px + 2 * Qx) / 3
        By = (Py + 2 * Qy) / 3
        Cx = Ax + (Bx - Ax) * math.cos(math.pi/3) - (By - Ay) * math.sin(math.pi/3) 
        Cy = Ay + (Bx - Ax) * math.sin(math.pi/3) + (By - Ay) * math.cos(math.pi/3)
        
        Koch(Px, Py, Ax, Ay, n-1)
        print(Ax, Ay)
        Koch(Ax, Ay, Cx, Cy, n-1)
        print(Cx, Cy)
        Koch(Cx, Cy, Bx, By, n-1)
        print(Bx, By)
        Koch(Bx, By, Qx, Qy, n-1)

n = int(input())
print(0, 0.00000000)
Koch(0.00000000, 0.00000000, 100.00000000, 0.00000000, n)
print(100.00000000, 0.00000000)



Measured memory_bytes: 5780
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
int N;
bool isOK(int idx, string key) {
    cout << idx << endl << flush;
    string S; cin >> S;
    if (S == "Vacant") exit(1);
    if (idx % 2 == 1 && key == S) return false;
    if (idx % 2 == 0 && key != S) return false;
    return true;
}

int binary_search(string key) {
    int ng = N;
    int ok = 0;

    /* ok と ng のどちらが大きいかわからないことを考慮 */
    while (abs(ok - ng) >= 1) {
        int mid = (ok + ng) / 2;
        if (isOK(mid, key)) ok = mid;
        else ng = mid;
    }
    return ok;
}

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> N;
    cout << 0 << endl << flush;
    string S; cin >> S;
    if (S == "Vacant") return 0;
    binary_search(S);
    //cout <<"*" << endl;

    return 0;
}


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

#define sync {ios_base ::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);}
#define ll long long int
#define mod 1000000007

int n;

void solve()
{
    cin>>n;
    ll a[n];
    for(int i=0;i<n;i++)
        cin>>a[i];
    
    int ans = 0;
    sort(a,a+n);
    for(int i=0;i<n;i++)
    {
        for(int j=i+1;j<n;j++)
        {
            for(int k=j+1;k<n;k++)
            {
                if(a[i]!=a[j] and a[j]!=a[k] and a[k]!=a[i] and a[i]+a[j]>a[k])
                    ans++;
            }
        }
    }
    cout<<ans;
}

int main()
{
    sync;
    int t = 1;
    //cin>>t;
    while(t--){
        solve();
        cout<<"\n";
    }
    return 0;
}







Measured memory_bytes: 3652
function myout(text){console.log(text);}//standard output
function Main(input) {
  
  var list = ["Sunny","Cloudy","Rainy"];
  var ind = list.indexOf(input) + 1;
  if(ind == 3){
     ind = 0;
  }
  myout(list[ind]);
  
}

Main(require("fs").readFileSync("/dev/stdin", "utf8").trim());


Measured memory_bytes: 7496
#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;
typedef long double ld;

const int MOD = 1000000007;
const int INF = 1e9;

const int mod = 1000000007;
const int inf = 1e9;
#define PI acos(-1);
int dx[4] = {1,-1,0,0};
int dy[4] = {0,0,1,-1};
int ddx[8] = {1,1,1,-1,-1,-1,0,0};
int ddy[8] = {0,1,-1,0,1,-1,1,-1};


int main(){
    int n, m;
    cin >> n >> m;
    vector<ll> x(n), y(m);
    for(int i = 0; i < n; i++) cin >> x[i];
    for(int i = 0; i < m; i++) cin >> y[i];
    ll sumx, sumy;
    sumx = sumy = 0;
    cout << endl;
    for(int i = 0; i < n; i++) {
        sumx += i * x[i] - (n-1-i) * x[i];
        sumx %= MOD;
        //cout << i*x[i] << " " << ((n-(i+1))*x[i]) << " ";
        //cout << sumx << "\n";
    } //cout << endl;
    for(int i = 0; i < m; i++) {
        sumy += i * y[i] - (m-1-i) * y[i];
        sumy %= MOD;
        //cout << i*y[i] << " " << ((n-(i+1))*y[i]) << " ";
        //cout << sumy << "\n";
    } //cout << endl;
    ll ans = sumx * sumy % MOD;
    cout << ans << endl;
}

/*
4 3
1 2 3 4
1 2 3

*/


Measured memory_bytes: 1792
import itertools
L,R = map(int,input().split())
if R-L >= 2018:
    ans = 0
else:
    a = min(L+2019, R+1)
    ij = [i%2019 for i in range(L, a)]
    ans = 2018
    for v in itertools.combinations(ij, 2):
        ans = min(ans, (v[0]*v[1])%2019)
print(ans)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#include <stdio.h>
#include <vector>
#include <algorithm> // sort
#include <map>
using namespace std;

int main(){
    int n;
    long long int k;
    cin>>n>>k;
    vector<int>a(n);
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    long long int b[2][n];
    for(int i=0;i<n;i++){
        b[0][i]=0;
        b[1][i]=0;
    }
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            if(j==i)continue;
            if(a[j]<a[i]){
                if(j>i){
                    b[0][i]++;
                    b[0][i]%(1000000000+7);
                }
                b[1][i]++;
                b[1][i]%(1000000000+7);
            }
        }
    }
    
    long long int c=0;
    for(int i=0;i<n;i++){
        for(int j=0;j<b[0][i];j++){
            c+=(k%(1000000000+7));
        }
        for(int j=0;j<b[1][i];j++){
            c+=((k-1)*k/2)%(1000000000+7);
        }
    }
    cout<<c%(1000000000+7)<<endl;;
}

Measured memory_bytes: 256
import math

a,b,x=map(int,input().split())

if x<=a*a*b/2:
    n=2*x/(a*b)
    print(90-math.degrees(math.atan(n/b)))
else:
    trash=a*a*b-x
    n=2*trash/a**2
    print(math.degrees(math.atan(n/a)))


Measured memory_bytes: 2940
#include <stdio.h>
int main (void) {
  int i,j,num,a,b;
  char str[1001],tem[1001],com[20];
  scanf("%s",str);
  scanf("%d",&num);
  for(i=0;i<num;i++){
    scanf("%s %d %d",com,&a,&b);
    if(com[0]=='p'){
      for(j=a;j<=b;j++) 
      printf("%c",str[j]);
      printf("\n");
    }
    else if(com[2]=='p'){
      scanf("%s",tem);
      for(j=a;j<=b;j++) str[j]=tem[j-a];
    }
    else if(com[2]=='v'){
      for(j=a;j<=b;j++) tem[j]=str[j];
      for(j=a;j<=b;j++) str[j]=tem[b-(j-a)];
    }
  }
  return 0;
}



Measured memory_bytes: 2112
private fun readLn() = readLine()!!
private fun readInt() = readLn().toInt()
private fun readStrings() = readLn().split(" ")
private fun readInts() = readStrings().map(String::toInt)
private fun readStrings2() = readLn().split("").filter { it.isNotEmpty() }
private fun readInts2() = readStrings2().map(String::toInt)
private fun initArray(n:Int, v:String) = Array(n) { v }
private fun initIntArray(n:Int, v:Int) = IntArray(n) { v }

fun main(args: Array<String>) {
    val x = readInts()

    repeat(x.size) { idx ->
        if(x[idx] == 0) println("${idx + 1}")
    }
}

Measured memory_bytes: 36308
extern crate core;

use std::io::{self, Read};

#[macro_use]
mod parser {
    macro_rules! input {
    ($s:expr=>$($t:tt)*) => {
        let mut lines=$s.split("\n");
        $(
            line_parse!(lines,$t);
        )*
    };
    }

    macro_rules! line_parse {
    ($lines:expr,($($name:ident:$t:tt)*)) => {
        let mut line=$lines.next().unwrap().split_whitespace();
        $(value_def!(line,$name,$t);)*
    };

    //複数行
    ($lines:expr,{$n:expr;$name:ident:$t:tt}) => {
        values_def!($lines,$n,$name,$t);
    };
    }

    macro_rules! value_def {
        ($line:expr, $name:ident, $t:tt) => {
            let $name = value!($line, $t);
        };
    }

    macro_rules! values_def {
        ($lines:expr, $n:expr, $name:ident, $t:tt) => {
            let $name = {
                let mut vec = Vec::new();
                for i in 0..$n {
                    let mut next = $lines.next().unwrap().split_whitespace();
                    vec.push(value!(next, $t));
                }
                vec
            };
        };
    }

    macro_rules! value {
    //配列
    ($line:expr,[$t:tt]) => {
        $line.map(|x|{
        let mut iter=::std::iter::once(x);
        value!(iter,$t)
        }).collect::<Vec<_>>()
    };
    //タプル
    ($line:expr,($($t:tt),*)) => {
        ($(value!($line,$t),)*)
    };
    //文字列
    ($line:expr,#) => {
        $line.next().unwrap()
    };
    //単一値
    ($line:expr,$t:ty) => {
        $line.next().unwrap().parse::<$t>().unwrap()
    };
    }
}

fn main() {
    let mut input = String::new();
    io::stdin().read_to_string(&mut input).unwrap();
    let output = solve(input.trim().to_string());
    println!("{}", output);
}

fn solve(input: String) -> String {
    input!(input=>(x:i64 y:i64 z:i64));
    ((x - z) / (y + z)).to_string()
}

macro_rules! tests {
    ($($name:ident: $input:expr=>$output:expr,)*) => {
        mod tests {
            $(
                #[test]
                fn $name() {
                    assert_eq!($output.trim().to_string(),super::solve($input.trim().to_string()));
                }
            )*
        }
    }
}

tests! {
    test1: "13 3 1" => "3",
    test2: "12 3 1" => "2",
    test3: "100000 1 1" => "49999",
    test4: "64146 123 456" => "110",
    test5: "64145 123 456" => "109",
}


Measured memory_bytes: 4352
#include <iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<set>
#define maxn 9999
using namespace std;

int main()
{
    long long x,y;
    scanf("%lld%lld",&x,&y);
    int sum=0;
    while(x<=y)
    {
        x=x*2;
        sum++;
    }
    cout<<sum<<endl;
}


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

int main(){
  vector< vector<int> > c(3,vector<int>(3));
  for(int i=0;i<3;i++){
    for(int j=0;j<3;j++){
      cin >> c.at(i).at(j);
    }
  }
  vector<int> a(3),b(3);
  a.at(0)=0;
  for(int i=0;i<3;i++){
    b.at(i)=c.at(0).at(i);
  }
  for(int i=1;i<=2;i++){
    a.at(i)=c.at(i).at(0)-b.at(0);
  }
  for(int i=0;i<3;i++){
    for(int j=0;j<3;j++){
      if(a.at(i)+b.at(j)!=c.at(i).at(j)){
        cout << "No" << endl;
        return 0;
      }
    }
  }
  cout << "Yes" << endl;
  return 0;
}


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

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

    map<char, int> ms, mt;
    string ans = "Yes";
    for (int i = 0, n = s.size(), sid = 1, tid = 1; i < n; i++) {
        if (!ms[s[i]]) ms[s[i]] = sid++;
        if (!mt[t[i]]) mt[t[i]] = tid++;
        if (ms[s[i]] != mt [t[i]]) ans = "No";
    }

    cout << ans << endl;
}


Measured memory_bytes: 776
#include <bits/stdc++.h>
using namespace std;
#define int long long
constexpr int MOD = 1000000000 + 7;

// constexpr int N = 100;
// constexpr int fact(int n) { return n > 1 ? n * fact(n - 1) % MOD : 1; }
// constexpr int combi(int a, int b) { return fact(a) / fact(b) / fact(a - b) % MOD; }

const int MAX = 510000;
// const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit()
{
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; 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;
    }
}

// 二項係数計算
long long COM(int n, int k)
{
    if (n < k)
        return 0;
    if (n < 0 || k < 0)
        return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

signed main()
{
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << setprecision(10);

    COMinit();

    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());

    int ans = 0;

    for (int i = n - 1; i >= 0; i--)
    {
        // a[i]が最大のときの選び方を求める
        int s = i;
        int t = k - 1;

        if (s - t < 0)
            break;

        ans += a[i] * COM(s, t) % MOD;
    }

    for (int i = 0; i < n; i++)
    {
        // a[i]が最小のときの選び方を求める
        int s = n - i - 1;
        int t = k - 1;

        if (s - t < 0)
            break;

        ans -= a[i] * COM(s, t) % MOD;
    }

    cout << ans%MOD << endl;
}


Measured memory_bytes: 13056
n = int(input())
a,b,c=0,0,0
for i in range(n):
    t,x,y = map(int, input().split())
    sa = t-a
    if sa<abs(x-b)+abs(y-c):
        print("No")
        exit()
    else:
        tw = sa-abs(x-b)-abs(y-c)
        if tw%2!=0:
            print("No")
            exit()
    a,b,c=t,x,y
print("Yes")

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

using namespace std;

typedef long long lli;
typedef vector<lli> vll;
typedef vector<bool> vbl;
typedef vector<vector<lli>> mat;

lli n;
vll a;
vll s;
lli ans = 0;

int main(){
  cin >> n;
  a = vll(n);
  for(lli i = 0;i < n;i++) cin >> a[i];
  s = vll(n);
  while(true){
    for(lli i = 0;i < n;i++){
      s[i] = a[i]/n;
      a[i] = a[i]%n;
      a[i] -= s[i];
    }
    lli k = accumulate(s.begin(),s.end(),0ll);
    if(k == 0) break;
    ans += k;
    for(lli i = 0;i < n;i++){
      a[i] += k;
    }
  }
  cout << ans << endl;
  return 0;
}


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

int main()
{
	int highth[10] = { };
	int buf;

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

	for (int i = 0; i < 10; i++){
		for (int j = 0; j < 10; j++){
			if (highth[j] < highth[j + 1]){
				buf = highth[j + 1];
				highth[j + 1] = highth[j];
				highth[j] = buf;
			}
		}
	}

	cout << highth[0] << endl;
	cout << highth[1] << endl;
	cout << highth[2] << endl;
}

Measured memory_bytes: 1160
int t[1112];
main(x,y,z,m){
  for(;x<1112;x++)t[x]=x*x*x;
  while(scanf("%d",&z),z){
    for(m=x=1;x<z;x++){
      for(y=1;y<z;y++)
        if(t[x]+t[y]>t[z])break;
      y--;
      if(t[x]+t[y]>m)m=t[x]+t[y];
    }
    printf("%d\n",t[z]-m);
  }
exit(0);}

Measured memory_bytes: 604
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef long long ll;

typedef long double ld;
typedef pair<ll,ll> pp;
typedef tree<pp,null_type,less<pp>,rb_tree_tag,tree_order_statistics_node_update> super_set;

#define x1 dfds
#define y1 dsfdsfe
#define pb push_back
#define forn(i,n) for(ll i = 1;i<=n;++i)
#define fi first
#define sc second
#define endl '\n'
#define po(x) (1ll<<x)
#define log sdfdsfdsf

const ll DIM = 1E6+7;
const ll MOD = 1e9+7;

const ll INF = 1E17;
const ld eps = 0.00000000000001;
const ld PI = 3.14159265358979323846;
int getInt(int a = 0, int b = INT_MAX){
    static mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
    return uniform_int_distribution <int> (a, b)(rng);
}
ll dp[DIM];
int main(){
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    ll n;
    cin>>n;
    dp[0] = 1;
    forn(i,n){
        for(ll j = i-3;j>=0;--j){
            dp[i] = (dp[i]+dp[j])%MOD;
        }
    }
    cout<<dp[n]<<endl;
    return 0;
}


Measured memory_bytes: 3636
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <stdio.h>
#include <string>
#include <vector>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <stack>
#include <utility>
#include <queue>
using namespace std;
typedef long long int lld;
typedef long double llf;
typedef pair<lld, lld> pii;


int main()
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n, m, A, B;
  cin >> n >> m >> A >> B;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      if ((i < B && j < A) || (i >= B && j >= A)) {
        cout << "1";
      } else {
        cout << "0";
      }
    }
    cout << "\n";
  }
  return 0;
}

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

int main()
{
	double n;
	double heavy[10] = { 48.0, 51.0, 54.0, 57.0, 60.0, 64.0, 69.0, 75.0, 81.0, 91.0};
	string grade[10] = {"light fly", "fly", "bantam", "feather", "light", "light welter", "welter", "light middle", "middle", "light heavy"};

	while (cin >> n){
		bool flag = true;

		for (int i = 0; i < 10; ++i){
			if (n <= heavy[i] && flag){
				cout << grade[i] << endl;
				flag = false;
			}
		}

		if (flag)
			cout << "heavy" << endl;
	}

	return 0;
}

Measured memory_bytes: 1240
A=int(input())
B=int(input())
C=int(input())
X=int(input())
total=[]
for a in range(A+1):
  for b in range(B+1):
    for c in range(C+1):
      total.append(sum([500*a,100*b,50*c]))
ans = [i for i in total if i == X]
print(len(ans))


Measured memory_bytes: 8344
#include<iostream>
#include<vector>
#include<queue>
using namespace std;
int MOD=1e9+7;
struct Node{
    int no;
    int par;
    long long white;
    long long black;
    vector<Node*> child;
    void build(int i){
        no=i;
        par=i;
        white=1;
        black=1;
    }
};
struct Tree{
    int n;
    vector<Node> node;
    Tree(int k){
        n=k;
        node.resize(n+1);
        for(int i=1;i<=n;++i){
            node[i].build(i);
        }
    }
    void input(int k){
        for(int i=0;i<k;++i){
            int a,b;cin>>a>>b;
            node[a].child.push_back(&node[b]);
            node[b].child.push_back(&node[a]);
        }
    }
    void BFS(int s){
        queue<Node> que;
        que.push(node[s]);
        while(!que.empty()){
            Node buf=que.front();que.pop();
            int num=buf.child.size();
            for(int i=0;i<num;++i){
                if(buf.child[i]->no!=buf.par){
                    buf.child[i]->par=buf.no;
                    que.push(*buf.child[i]);
                }
            }
        }
    }
    void DFS(Node& node){
        if(node.child.size()==1&&node.par!=node.no){
            return;
        }
        else{
            int num=node.child.size();
            for(int i=0;i<num;++i){
                if(node.child[i]->no!=node.par){
                    DFS(*node.child[i]);
                    node.white*=node.child[i]->white+node.child[i]->black;
                    node.black*=node.child[i]->white;
                    node.white%=MOD;
                    node.black%=MOD;
                }
            }
        }
    }
};
int main(){
    int n;cin>>n;
    Tree tree(n);
    tree.input(n-1);
    tree.BFS(1);
    tree.DFS(tree.node[1]);
    cout<<(tree.node[1].black+tree.node[1].white)%MOD<<"\n";
    return 0;
}

Measured memory_bytes: 17636
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define vi vector<int>
#define ff first
#define ss second
#define file_se_input  freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#define pp long long int
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define pb push_back
#define mp make_pair
#define pi 3.141592653589793238
#define eb emplace_back
#define rep(i,a,b) for (int i = a; i <= b; i++)
#define zip(i,a,b) for(int i=a;i<b;i++)
#define ll unsigned long long int
#define test long int t;cin>>t; while(t--)
#define um unordered_map
#define en '\n'
#define us unordered_set
#define mod 1000000007

bool check_prime(long long n)
{
	int flag = 0;
	for (long long i = 2; i * i <= n; i++)
	{
		if (n % i == 0)
		{
			flag = 1;
			break;
		}
	}
	if (n == 1)
		return false;
	else if (flag == 0 || n == 2 || n == 3)
	{
		return true;
	}
	else
	{
		return false;
	}

}

int BE(int x, int n, int m) //function to calculate x raise to power n modulo m
{
	int result = 1;
	while (n > 0)
	{
		if (n % 2 == 1)
			result = result * x % m;
		x = x * x % m;
		n = n / 2;
	}
	return result;
}
int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(0);
#ifndef ONLINE_JUDGE
	if (fopen("input.txt", "r"))
	{
		freopen ("input.txt" , "r" , stdin);
		freopen ("output.txt" , "w" , stdout);
	}
#endif
	//_______________________________-code starts-______________________________________________________________________________

	int n, k;
	cin >> n >> k;
	int sum = 0;
	int var1 = k * (k - 1) / 2;
	int var2 = n * (n + 1) / 2;
	//cout << var1 << " " << var2 << en;
	int ans = 0;

	for (int i = k; i <= n + 1; i++)
	{
		// int x = i * (i - 1) / 2;
		// int y = i * n - i * (i - 1) / 2;
		//cout << x << " " << y << en;
		//cout << n + 1 - i << en;
		int z = (i  * (n + 1 - i)  + 1) ;
		//cout << z << en;
		ans = (ans + z) % mod;
	}
	ans = ans % mod;
	cout << ans << en;
	//cout << ans % mod << en;

	// rep(i, var1, var2)
	// {
	// 	ans += (BE(10, 100, mod) + i % mod) % mod;
	// 	ans = ans % mod;
	// }

	//cout << ans << en;



	return 0;
}


Measured memory_bytes: 3648
#include<stdio.h>
#include<map>
#include<algorithm>
using namespace std;
int p[410000];
int q[410000];
int bit[410000];
int n;
int sum(int a,int b){
	if(a)return sum(0,b)-sum(0,a-1);
	int ret=0;
	for(;b>=0;b=(b&(b+1))-1)ret+=bit[b];
	return ret;
}
void add(int a,int b){
	for(;a<n;a|=a+1)bit[a]+=b;
}
int get(int a){
	int left=-1;
	int right=n+1;
	while(left+1<right){
		int M=(left+right)/2;
		if(sum(0,M)>a)right=M;
		else left=M;
	}
	return right;
}
int main(){
	int a,b;
	while(scanf("%d%d",&a,&b),a+b){
		map<int,int>m;
		for(int i=0;i<a;i++)scanf("%d%d",p+i,q+i);
		int sz=0;
		for(int i=0;i<a;i++){
			if(p[i]==0){
				m[q[i]]=i;
			}
		}
		n=a+1;
		for(int i=0;i<n;i++)bit[i]=0;
		for(int i=0;i<a;i++){
			if(p[i]==0){
				add(i,1);
				if(sum(0,a)>b)add(get(0),-1);
			}
			if(p[i]==1){
				q[i]--;
				int at=get(q[i]);
				add(at,-1);
			}
			if(p[i]==2){
				q[i]--;
				int at=get(q[i]);
				printf("%d\n",q[at]);
			}
			if(p[i]==3){
				int at=m[q[i]];
				add(at,-1);
			}
		}
		printf("end\n");
	}
}

Measured memory_bytes: 24332
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
#define sp(x) fixed << setprecision(x)
#define pb(x) push_back(x)
#define all(x) x.begin(), x.end()
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const int inf = 1e9;
const ll INF = 1e18;
const ld EPS = 1e-10;

int main(){
    int N, M;
    cin >> N >> M;
    int H[N];
    rep(i, N) cin >> H[i];
    vector<int> es[N];
    rep(i, M){
        int A, B; cin >> A >> B; A--, B--;
        es[A].pb(B), es[B].pb(A);
    }
    int ans = N;
    rep(i, N){
        for(auto &e: es[i]){
            if(H[e] >= H[i]){
                ans--;
                break;
            }
        }
    }
    cout << ans << endl;
}

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

int main(){
	string str;
	int length;
	int i,j;
	int check = 0;

	cin >> str;

	length = str.size();

	for(i=0; i<length; i++){
		if(str[i] == 'C'){
			check = 1;
			for(j=i; j<length; j++){
				if(str[j] == 'F'){
					check = 2;
				}
			}
		}
	}

	if (check == 2){
		cout << "Yes" << endl;
	} else{
		cout << "No" << endl;
	}

	return 0;
}


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

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

typedef long long ll;

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

  bool yes = true;

  for(int i=0; i<s.length(); i++){
    if((i+1) % 2 == 0){
      if(s[i] == 'L' || s[i] == 'U' || s[i] == 'D'){
        yes = true;
      }else {
        yes = false;
        break;
      }
    }
    else{
      if(s[i] == 'R' || s[i] == 'U' || s[i] == 'D'){
        yes = true;
      }else {
        yes = false;
        break;
      }
    }
  }

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

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <stdio.h>
using namespace std;
#define ll long long
const int maxi=2000000000;
const int maxq=1000000000;
const ll mod=1000000007LL;
#define f(i,a,b) for(ll  i=(a); i<(b);++i)
/*
unsigned int countSetBits(unsigned int n)
{
    unsigned int count = 0;
    while (n) {
        count += n & 1;
        n >>= 1;
    }
    return count;
}
*/

/*
const int maxx=9000000;
void SieveOfEratosthenes(vector<int> &primes){
    bool IsPrime[maxx+1];
    memset(IsPrime, true, sizeof(IsPrime));
    for(int p=2;p*p<=maxx ;p++){
        if(IsPrime[p]){
            for(int i=p*p;i<maxx ;i+=p) IsPrime[i]=false;
        }
    }
    f(p,2,maxx +1){
        if(IsPrime[p]) primes.push_back(p);
    }
    }
*/

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n,ac=0,wa=0,tle=0,re=0;
    cin>>n;
    string s;
    while(n--){
        cin>>s;
        if(s=="AC") ac++;
        else if(s=="WA") wa++;
        else if (s=="TLE") tle++;
        else re++;
    }
    cout<<"AC x "<<ac<<endl;
    cout<<"WA x "<<wa<<endl;
    cout<<"TLE x "<<tle<<endl;
    cout<<"RE x "<<re<<endl;
    return 0;
}




Measured memory_bytes: 3656
#include <bits/stdc++.h>
#include <iostream>
#include<math.h>
#include<cmath>
#include<string>
#include<iomanip>
#include <numeric>
#include <limits>
using namespace std;

int main()
{
int n,l; cin>>n>>l; vector<string>s(n);
for(int i=0;i<n;i++) cin>>s[i];
sort(s.begin(),s.end());
for(int x=0;x<n;x++)
    cout<<s[x];
return 0;
}


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

int main()
{
   float i,j,k,n,l,m;
	float p;
	string str1,str2;
	string str3;
	cin>>i>>j;
	p=ceil((i+j)/2);
	cout<<p<<endl;
	return 0;
}

Measured memory_bytes: 256
open System

// prelude
let readStr () = stdin.ReadLine()

let read f () = readStr() |> f
let reads f () = readStr().Split() |> Array.map f

let pair = function
| [|a; b|] -> (a, b)
| _ -> failwith "owatta"

let triple = function
| [|a; b; c|] -> (a, b, c)
| _ -> failwith "owatta"

let readPair f g () =
  let (a,b) = readStr().Split() |> pair
  (f a, g b)

let readTriple f g h () =
  let (a,b,c) = readStr().Split() |> triple
  (f a, g b, h c)

let inc n = n + 1
let dec n = n - 1

let inline flip f a b = f b a
let rec fix f = fun x -> (f (fix f)) x

module Option =
  let getOr defaultValue = function
  | Some x -> x
  | None -> defaultValue

module Array =
  let modify (arr: _ []) i f =
    arr.[i] <- f arr.[i]

module Array2D =
  let modify (arr: _ [,]) i j f =
    arr.[i, j] <- f arr.[i, j]

// start
match ((read int ()) % 10) with
| 3 -> "bon"
| 0 | 1 | 6 | 8 -> "pon"
| _ -> "hon"
|> printfn "%s"

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

const int MAXN = 1e5+10;
int dp[30][MAXN],x[MAXN],l,n;
int q;

int main()
{
    int i,j;
    cin >> n;
    for(int i = 1; i <= n; ++i)
        cin >> x[i];
    cin >> l;
    for(int i = 1; i < n; ++i)
        dp[0][i] = upper_bound(x+1,x+n+1,x[i]+l) - x - 1;
    for(i = 1; i < 30; ++i)
    {
        for(j = 1; j <= n; ++j)
            dp[i][j] = dp[i-1][dp[i-1][j]];
    }
    cin >> q;
    int a,b,res;
    while(q--)
    {
        res = 0;
        cin >> a >> b;
        if(a > b) swap(a,b);
        for(i = 29; i >= 0; --i)
        {
            if(dp[i][a] == 0) continue;
            if(dp[i][a] < b)
            {
                a = dp[i][a];
                res += (1<<i);
            }
            else if(dp[i][a] == b)
            {
                i--;
                break;
            }
        }
        res += 1<<(i+1);
        cout << res << endl;
    }
    return 0;
}


Measured memory_bytes: 12928
SA = input()
SB = input()
SC = input()
A = -1
B = -1
C = -1
card = 'a'

try:
  while True:
    if card == 'a':
      A += 1
      card = SA[A]
    elif card == 'b':
      B += 1
      card = SB[B]
    elif card == 'c':
      C += 1
      card = SC[C]

except IndexError:
  if A == len(SA):
    print('A')
  elif B == len(SB):
    print('B')
  elif C == len(SC):
    print('C')

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
int main(){
  ll b,a;
  cin>>b>>a;
  vector<ll>vec(a);
  ll c=0;
  for(ll i=0;i<a;i++){
    cin>>vec.at(i);
    c+=vec.at(i);
  }
  if(b>c){
    cout<<"No"<<endl;
    return 0;
  }
  cout<<"Yes"<<endl;
}

Measured memory_bytes: 3988
#include <stdio.h>
#include <vector>

int judge( const int* number_table1 , const int* number_table2 )
{
	const int right_side_table[ 6 ][ 6 ] =
	{
		//front=
		// 1    2    3    4    5    6
		{ -1 ,  3 ,  5 ,  2 ,  4 , -1 },	//top=1
		{  4 , -1 ,  1 ,  6 , -1 ,  3 },	//2
		{  2 ,  6 , -1 , -1 ,  1 ,  5 },	//3
		{  5 ,  1 , -1 , -1 ,  6 ,  2 },	//4
		{  3 , -1 ,  6 ,  1 , -1 ,  4 },	//5
		{ -1 ,  4 ,  2 ,  5 ,  3 , -1 },	//6
	};

	for( int top = 0 ; top < 6 ; top++ )
	{
		for( int front = 0 ; front < 6 ; front++ )
		{
			int right = right_side_table[ top ][ front ] - 1;
			if( right < 0 )
			{
				continue;
			}
			if( number_table1[ 0 ] != number_table2[ top ] )
			{
				continue;
			}
			if( number_table1[ 1 ] != number_table2[ front ] )
			{
				continue;
			}
			if( number_table1[ 2 ] != number_table2[ right ] )
			{
				continue;
			}
			if( number_table1[ 3 ] != number_table2[ 5 - right ] )
			{
				continue;
			}
			if( number_table1[ 4 ] != number_table2[ 5 - front ] )
			{
				continue;
			}
			if( number_table1[ 5 ] != number_table2[ 5 - top ] )
			{
				continue;
			}
			return 1;
		}
	}
	return 0;
}

struct NumberTableEntry
{
	int table[ 6 ];
};
typedef std::vector<NumberTableEntry> NumberTable;

int main( int argc , char** argv )
{
	NumberTable number_table;

	int data_size;
	scanf( "%d" , &data_size );
	number_table.reserve( data_size );

	for( int i = 0 ; i < data_size ; i++ )
	{
		NumberTableEntry entry;
		scanf( "%d %d %d %d %d %d" ,
			&entry.table[ 0 ] ,
			&entry.table[ 1 ] ,
			&entry.table[ 2 ] ,
			&entry.table[ 3 ] ,
			&entry.table[ 4 ] ,
			&entry.table[ 5 ] );

		number_table.push_back( entry );
	}

	for( NumberTable::const_iterator itr = number_table.begin() ; itr != number_table.end() ; itr++ )
	{
		NumberTable::const_iterator itr2 = itr;
		itr2++;

		for( ; itr2 != number_table.end() ; itr2++ )
		{
			if( judge( &itr->table[ 0 ] , &itr2->table[ 0 ] ) )
			{
				printf( "No\n" );
				return 0;
			}
		}
	}
	printf( "Yes\n" );
	return 0;
}

Measured memory_bytes: 1016
ls = [list(map(int, input().split())) for _ in range(3)]
cnt = 0

for i in range(3):
    for j in range(3):
        if ls[i % 3][j % 3] - ls[i % 3][(j+1) % 3] == ls[(i+1) % 3][j % 3] - ls[(i+1) % 3][(j+1) % 3]:
            cnt += 1

print('Yes' if cnt == 9 else 'No')


Measured memory_bytes: 3060
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <vector>
#include <map>
#include <list>
#include <stack>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <queue>
#define mkp(a, b) make_pair(a, b)
#define pb(t) push_back(t)
#define ft first
#define sc second
#define pt(num) cout << num << "\n"
#define moC(a, s, b) (a)=((a)s(b)+MOD)%MOD
#define max(a, b) ((a)>(b) ? (a):(b))
#define min(a, b) ((a)<(b) ? (a):(b))
#define chmax(a, b) (a<b ? a=b : 0)
#define chmin(a, b) (a>b ? a=b : 0)
#define INF 1000000000000000000
#define MOD 1000000007LL
#define MAX 101010
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef map<ll, ll> Map;



int main(void) {
    ll a, b, c;
    cin >> a >> b >> c;
    pt(min(b/a, c));
    
}





Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Text;

namespace AtTest.EducationalDP
{
    class C
    {
        static void Main(string[] args)
        {
            Method(args);
            Console.ReadLine();
        }

        static void Method(string[] args)
        {
            int n = ReadInt();
            int[][] abcs = new int[n][];
            for(int i = 0; i < n; i++)
            {
                abcs[i] = ReadInts();
            }
            int[,] dp = new int[n, 3];
            dp[0, 0] = abcs[0][0];
            dp[0, 1] = abcs[0][1];
            dp[0, 2] = abcs[0][2];
            for(int i = 1; i < n; i++)
            {
                dp[i, 0] = Math.Max(dp[i - 1, 1], dp[i - 1, 2]) + abcs[i][0];
                dp[i, 1] = Math.Max(dp[i - 1, 2], dp[i - 1, 0]) + abcs[i][1];
                dp[i, 2] = Math.Max(dp[i - 1, 0], dp[i - 1, 1]) + abcs[i][2];
            }
            Console.WriteLine(
                Math.Max(Math.Max(dp[n - 1, 0], dp[n - 1, 1]), dp[n - 1, 2]));
        }

        private static string Read() { return Console.ReadLine(); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


Measured memory_bytes: 23744