akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using pll = pair<ll, ll>;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define rrep(i, m, n) for(ll i = m; i > n; i--)
#define Rep(i, m, n) for(ll i = m; i < n; i++)
#define all(vec) vec.begin(), vec.end()
#define lmax(x, y) max<ll>(x, y)
#define lmin(x, y) min<ll>(x, y)
#define tmax(x, y, z) lmax((x), lmax((y), (z)))
#define tmin(x, y, z) lmin((x), lmin((y), (z)))
#define MINUS(a) memset(a, 0xff, sizeof(a))
#define ZERO(a) memset(a, 0, sizeof(a))
const ll INF = 1LL << 60;
const ll MM = 1000000000; const ll MOD = MM + 7; const ll MMM=9223372036854775807;//2^63 -1
#define ADD(a,b) a = (a + ll(b)) % MOD
#define MUL(a,b) a = (a * ll(b)) % MOD
ll GCD(ll x, ll y){ if(y == 0) return x; else return GCD(y, x % y);}
ll LCM(ll x, ll y){ return x / GCD(x, y) * y;}
template<class T> inline bool chmin(T& a, T b){ if(a > b){ a = b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b){ if(a < b){ a = b; return true;} return false;}
template<typename A, size_t N, typename T> void FILL(A (&array)[N], const T &val){ fill( (T*)array, (T*)(array+N), val );}
// struct edge{ ll from, to, cost; };
// struct edge{ ll to, cost; };
// using Graph = vector<vector<ll>>;  // 重み無し
// using Graph = vector<edge>;  // 辺
// using Graph = vector<vector<edge>>;  // 重み付き
ll dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
ll ddx[8] = {1, 1, 0, -1, -1, -1, 0, 1}, ddy[8] = {0, 1, 1, 1, 0, -1, -1, -1};


int main(){
    ll l, r; cin >> l >> r;
    if((r-l+1) >= 2019){
        cout << 0 << endl;
        return 0;
    }
    // if(l%2019 > r%2019){
    //     cout << 0 << endl;
    //     return 0;
    // }
    if(l/2019 != r/2019){
        cout << 0 << endl;
        return 0;
    }
    ll ans = INF;
    Rep(i, l, r){
        Rep(j, i+1, r+1){
            chmin(ans, i*j%2019);
        }
    }
    cout << ans << endl;
}


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

int main(void){
  int k,s,count =0;
  cin >> k >> s;
  for(int i=0; i<k+1; i++){
    for(int j=0; j<k+1; j++){
      if(s-i-j >= 0 && s-i-j <= k) count++;
    }
  }
  cout << count << endl;
  return 0;
}

Measured memory_bytes: 3604
S = input()
T = input()

cnt = [0 for x in range(len(S)-len(T)+1)]
for i in range(len(S)-len(T)+1):
    target = S[i:i+len(T)]
    for j in range(len(T)):
        if target[j] != T[j]:
            cnt[i] += 1

print(min(cnt))


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

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

    int tens = 0;
    int sum = 0;
    int minv = 1e9;
    for(int i = 0; i < n; i++){
        int x;
        cin >> x;
        if(x % 10 == 0) tens += x;
        else {
            sum += x;
            minv = min(minv,x);
        }
    }
    if(sum == 0){
        cout << 0 << endl;
        return 0;
    }

    if(sum % 10 == 0) sum -= minv;
    cout << sum + tens << endl;

}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;


int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	int a, b, c, k, ans;
	cin >> a >> b >> c >> k;
	if (a < b) swap(a, b);
	if (a < c) swap(a, c);

	while (k--) {
		a *= 2;
	}

	ans = a + b + c;
	cout << ans << "\n";


	return 0;
}


Measured memory_bytes: 256
N = int(input())

a = sorted(map(int,input().split()))

a.reverse()

A = []
B = []

for x in range(0,N,2):
    A.append(a[x])
    
        
for y in range(1,N,2):
    B.append(a[y])
    
print(sum(A)-sum(B))
    

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

int main(){
  int n,d;
  cin >> n >> d;
  vector<int> p(n);
  for(int i=0;i<n;i++) cin >> p[i];
  sort(p.begin(), p.end());

  int ans = 0;
  for(int i=0;i<n-1;i++){
    if(p[i]-d > 0) ans += p[i]-d;
  }
  ans += p[n-1]-d;

  if(ans > 0) cout << ans << endl;
  else cout << "kusoge" << endl;
}

Measured memory_bytes: 3128
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner cin = new Scanner(System.in);
		int a = cin.nextInt();
		int b = cin.nextInt();
		if (b % a == 0) 
			System.out.println(a + b);
		else 
			System.out.println(b - a);
	}
}

Measured memory_bytes: 21844
//in the name of god
#include <bits/stdc++.h>
using namespace std;
#define ios ios::sync_with_stdio(0)
const int maxn=1e5+7;
const long long INF=1<<32;
int dp[maxn];
int n;
int h[maxn];

int32_t main(){
    ios;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>h[i];
    }
    dp[0]=0;
    dp[1]=abs(h[1]-h[0]);
    dp[2]=abs(h[2]-h[0]);
    int s,t;
    for(int i=3;i<n;i++){
        s=dp[i-2]+abs(h[i-2]-h[i]);
        t=dp[i-1]+abs(h[i-1]-h[i]);
        dp[i]=min(s,t);
    }
    cout<<dp[n-1];
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
string a;
void solve()
{
    int y=(a[0]-'0')*10+a[1]-'0',m=(a[2]-'0')*10+a[3]-'0';
    if (y>=1&&y<=12&&m>=1&&m<=12) cout<<"AMBIGUOUS";
    else if (y>=1&&y<=12&&(m>12||!m)) cout<<"MMYY";
    else if ((y>12||!y)&&m>=1&&m<=12) cout<<"YYMM";
    else cout<<"NA";
    cout<<endl;
}
int main()
{
    while(cin>>a)
        solve();
}

Measured memory_bytes: 256
#include <cstring>
#include <sstream>
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <iomanip>
#include <map>
#include <unordered_map>
#include <cmath>
#include <queue>
#include <set>
#include <numeric>
#include <stack>

using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(ll i = n - 1; i >= 0; i--)
#define repone(i, n) for(ll i = 1; i <= (ll)(n); i++)
#define each(i, mp) for(auto i:mp)
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll mod = 1000000007;
const ll inf = ll(1e9);
const ll half_inf = ll(1e5);
const ll ll_inf = ll(1e9) * ll(1e9);
typedef unordered_map<ll, ll> ump;
typedef pair<ll, ll> P;

ump mp;

int main() {
#ifdef MY_DEBUG
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wmissing-noreturn"
    while (true) {
        mp = ump();
#pragma clang diagnostic pop
#endif
        ll n;
        cin >> n;
        vector<ll> p(n); // index
        rep(i, n) {
            ll tmp;
            cin >> tmp;
            p[tmp - 1] = i;
        }

        ll res = 0;
        rep(i, n) {
            ll tmp = 1;
            while (i + 1 < n && p[i] < p[i + 1]) {
                i++;
                tmp++;
            }
            res = max(tmp, res);
        }
        cout << n - res << endl;


#ifdef MY_DEBUG
    }
#endif
    return 0;
}

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


public class Main {

	private static Scanner sc;
	private static Printer pr;

	private static void solve() {
		int n = sc.nextInt();

		int x = 800 * n;
		int y = (n / 15) * 200;

		pr.println(x - y);
	}

	// ---------------------------------------------------
	public static void main(String[] args) {
		sc = new Scanner(System.in);
		pr = new Printer(System.out);

		solve();

		pr.close();
		sc.close();
	}

	private static class Printer extends PrintWriter {
		Printer(PrintStream out) {
			super(out);
		}
	}
}


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

int main() {
  int L, R;
  cin >> L >> R;

  if (R - L >= 2019) {
    cout << 0 << endl;
    return 0;
  }

  int min_remainder = 2018;

  for (int i = L; i < R; i++) {
    for (long long j = i + 1; j <= R; j++) {
      int remainder = (i * j) % 2019;
      min_remainder = min(min_remainder, remainder);
    }
  }

  cout << min_remainder << endl;
}

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

typedef long long ll;

int main() {
	string S;
	cin >> S;
	map<char,int> m;
	for (int i = 0; i < S.length(); i++) {
		m[S[i]]++;
	}

	bool f=false;
	if (m.size() == 2) {
		if(m['N']>0 && m['S']>0) f=true;
		if(m['E']>0 && m['W']>0) f=true;
	} 
	else if(m.size()==4) f=true;

	cout << (f?"Yes":"No") << endl;
}


Measured memory_bytes: 256
<?php
fscanf(STDIN,"%d",$n);
$num = trim(fgets(STDIN));
$num = explode(" ",$num);
$total = [];
for ($i=1; $i<=100; $i++) {
    $t = [];
    foreach($num as $person) {
        $t[] = pow($person - $i,2);
    }
    $total[]=array_sum($t);
    
}
echo min($total);
?>

Measured memory_bytes: 4604
import sys
# from collections import defaultdict
# from collections import Counter
# from queue import Queue
import math

def main():
    N = int(input())

    As = [int(s) for s in input().split()]
    logsum = 0
    prod = 1
    for a in As:
        if a == 0:
            print('0')
            return

        logsum += math.log10(a)
        # sys.stderr.write('{}\n'.format(logsum))


    if logsum > 18.2:
        print('-1')
        return

    for a in As:
        prod *= a

    if prod > 10 ** 18:
        print('-1')
        return
    print(prod)

    # As = []
    # for i in range(N):
    #     tmp = int(input())
    #     As.append(tmp)

    return 0

if __name__ == '__main__':
    sys.exit(main())


Measured memory_bytes: 22080
#include<bits/stdc++.h>
using namespace std;
int main(){

     double a,b,c,d,e,f,i,j,k,x,y;
     vector<int> v;
     vector<int> v1;
     vector<int> v2;
     vector<int>::iterator it;
     cin>>a>>b;
     cout<<ceil(a/b);




    return 0;
}



Measured memory_bytes: 256
N = int(input())
S = (input())
K = int(input())
s=[]
s1=""
for i in range(N):
    if S[i]==S[K-1]:
        s.append(S[i])
    else:
        s.append("*")
for i in range(N):
    s1 += s[i]
print(s1)

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

int main() {
  int n,m;cin>>n>>m;
  int cnt1=0,cnt2=0;
  map<int,int>ac,wa;
  rep(i,m){
    int p;string s;cin>>p>>s;
    if(s=="WA")wa[p]++;
    else {
      if(ac[p]==0){
        cnt2+=wa[p];
        cnt1++;
        ac[p]++;
      }
    }
  }
  cout<<cnt1<<" "<<cnt2<<endl;
}

Measured memory_bytes: 12852
#include<bits/stdc++.h>
using namespace std;
///Welcome to Nasif's Code
#define bug printf("bug\n");
#define bug2(var) cout<<#var<<" "<<var<<endl;
#define co(q) cout<<q<<endl;
#define all(q) (q).begin(),(q).end()
typedef long long int ll;
typedef unsigned long long int ull;
const int MOD = (int)1e9+7;
const int MAX = 1e6;
#define pi acos(-1)
#define inf 1000000000000000LL
#define FastRead    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int arr[MAX];
int used[MAX];
int main()
{
    FastRead
    //freopen("output.txt", "w", stdout);
    int n,k;
    cin>>n>>k;
    vector<pair<int,int> >v;
    for(int i=0; i<n; i++)
    {
        int t,d;
        cin>>t>>d;
        v.push_back({d,t});
    }
    sort(all(v));
    reverse(all(v));
    priority_queue<pair<int,int> >cur,l;
    map<int,int>mp,tot_var;
    ll sz=0,var=0,ans=0,sum=0;
    for(int i=0; i<n; i++)
    {
        int x=v[i].second;
        if(mp[x])
        {
            continue;
        }
        if(sz<k)
        {
            used[i]=1;
            var++;
            sz++;
            tot_var[v[i].second]++;
            sum+=v[i].first;
            cur.push({v[i].first*-1,x});
            mp[x]=1;
        }
        if(sz==k)
            break;
    }
    for(int i=0; i<n; i++)
    {
        if(!used[i])
        {
            tot_var[v[i].second]++;
            sum+=v[i].first;
            cur.push({v[i].first*-1,v[i].second});
            sz++;
            used[i]=1;
        }
        if(sz==k)
            break;
    }
    for(int i=0;i<n;i++){
        if(!used[i]){
            l.push({v[i].first,v[i].second});
        }
    }
    ans=sum+(var*var);
    while(!l.empty())
    {
        int x=l.top().first;
        int y=l.top().second;
        l.pop();
        int a=cur.top().first*-1;
        int b=cur.top().second;
        cur.pop();
        tot_var[b]--;
        if(tot_var[b]==0)
            var--;
        sum-=a;
        tot_var[y]++;
        if(tot_var[y]==1)
            var++;
        sum+=x;
        ans=max(ans,sum+(var*var));
        cur.push({x*-1,y});
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 11852
using System;
using System.Linq;

namespace Atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            //入力受け取ってやる
            String str = Console.ReadLine();
            int ans = 0;
            for (int i =0;i<4;i++){
                if(str[i] == '+'){
                    ans++;
                } else{
                    ans--;
                }
            }
            Console.WriteLine(ans);
        }
    }
}


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

#define MP make_pair

#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(v) v.begin(), v.end()

using namespace std;

int main() {
    string s;
    cin >> s;
    cout << s.substr(0, 4) << " " << s.substr(4) << endl;

    return 0;
}


Measured memory_bytes: 256
def c_One_stroke_Path(N, M, E):
    import itertools
    edge = [[] for j in range(N + 1)]
    for a, b in E:
        edge[a].append(b)
        edge[b].append(a)

    ans = 0
    route = itertools.permutations(range(2, N + 1), N - 1)
    for r in route:
        if not r[0] in edge[1]:
            # 頂点1からrが示す次の行き先に行くことができない
            continue
        count = 0
        for i in range(len(r)):
            if count == len(r) - 1:
                # すべての頂点を回れた
                ans += 1
                break
            if not r[i + 1] in edge[r[i]]:
                # 次の行き先に行くことができなかった
                break
            count += 1

    return ans

N,M = [int(i) for i in input().split()]
E = [[int(i) for i in input().split()] for j in range(M)]
print(c_One_stroke_Path(N, M, E))

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

int main() {
	int x;
	cin>>x;
	int i,j;
	bool found = false;
	for( i=-1000;i<=1000;i++)
	{
		for( j=-1000;j<=1000;j++)
		{	 int y=pow(i,5)-pow(j,5);
			if(y==x)
			{
				found = true;
				break;
			}
		}
		if(found)
		break;
	}
	cout<<i<<" "<<j;
	
	return 0;
}

Measured memory_bytes: 4064
#include<cmath>
#include<string>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
	char arr[100000];
	scanf("%s",&arr);
	int n=strlen(arr);
	int p=0,a,b;
	for(int i=0;i<n-2;i++)
	{
		if(arr[i]==arr[i+1])
		{
			p=1;
			a=i;
			b=i+1;
			break;
		}
		else if(arr[i]==arr[i+2])
		{
			p=1;
			a=i;
			b=i+2;
			break;
		}
	}
	if(arr[n-2]==arr[n-1])
	{
		p=1;
		a=n-2;
		b=n-1;
	}
	if(p)
	{
		cout<<a+1<<' '<<b+1;
	}
	else
	{
		cout<<"-1 -1";
	}
}

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

#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, j, n) for(int i=j;i<n;i++)
#define COUT(n) cout<<(n)<<"\n"

typedef long long ll;
const int INF = 1e9;

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

    int n; cin >> n;
    int a[n];
    int ma = 0, ma2 = 0;
    REP(i, n) {
        cin >> a[i];
        int tmp = ma;
        ma = max(ma, a[i]);
        if (ma == a[i]) ma2 = tmp;
        else if (ma2 <= a[i] && a[i] <= ma) ma2 = a[i];
    }
    REP(i, n){
        COUT(ma==a[i]?ma2:ma);
    }

    return 0;
} 

Measured memory_bytes: 2432
using System;
using System.Collections.Generic;
using System.Linq;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            //[summary]C - Cat Snuke and a Voyage
            var line = ReadLine();
            int n = line[0];
            int m = line[1];

            if (IsRegularService(n, m))
            {
                Console.WriteLine("POSSIBLE");
            }
            else
            {
                Console.WriteLine("IMPOSSIBLE");
            }
        }

        static bool IsRegularService(int n, int m)
        {
            var services = GetRegularServices(m);

            for(int i = 2; i < n; i++)
            {
                var route1 = String.Format("{0} {1}", 1, i);
                var route2 = String.Format("{0} {1}", i, n);

                if (services.ContainsKey(route1))
                {
                    if (services.ContainsKey(route2))
                    {
                        return true;
                    }
                }
            }

            return false;
        }

        static Dictionary<string,string> GetRegularServices(int m)
        {
            var dic = new Dictionary<string, string>();

            for(int i = 0; i < m; i++)
            {
                string line = Console.ReadLine();
                dic.Add(line, null);
            }

            return dic;
        }

        static List<int> ReadLine()
        {
            var line = Console.ReadLine().TrimEnd();
            var array = line.Split(' ');
            var numbers = new List<int>();

            foreach (var s in array)
            {
                int num = int.Parse(s);
                numbers.Add(num);
            }

            return numbers;
        }
    }
}

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

int main() {
    // 制約見て！！！デカかったらlong longにすること！
    int n;
    cin >> n;
    vector<long> a(n);
    rep(i, n) cin >> a[i];
    long m = INT64_MAX;
    long sum = 0;
    rep(i, n) sum += a[i];
    long left = a[0];
    long right = sum - left;
    m = abs(right - left);
    for(int i = 1; i < n; i++) {
        left += a[i];
        right -= a[i];
        m = min(m,abs(left - right));
    }
    cout << m << endl;
}

Measured memory_bytes: 4820
N = int(input())
T = []
for i in range(N):
    T.append(int(input()))


def gcd(x, y):
    while y:
        x, y = y, x % y
    return x


ans = 1
for i in range(N):
    ans *= T[i] // gcd(ans, T[i])
print(ans)


Measured memory_bytes: 2940
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <sstream>
#include <iostream>
#include <iomanip>
#define _USE_MATH_DEFINES
#include <cmath>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cfloat>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <cassert>
using namespace std;

#define EPS 1e-12
#define ull unsigned long long
#define ll long long
#define VI vector<ll>
#define PII pair<ll, ll> 
#define VVI vector<vector<ll> >
#define REP(i,n) for(int i=0,_n=(n);(i)<(int)_n;++i)
#define RANGE(i,a,b) for(int i=(int)a,_b=(int)(b);(i)<_b;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define ALLR(c) (c).rbegin(), (c).rend()
#define PB push_back
#define MP(a, b) make_pair(a, b)
#define POPCOUNT __builtin_popcount
#define POPCOUNTLL __builtin_popcountll
#define CLEAR(table, v) memset(table, v, sizeof(table));
#define PRINT1(table, D0) REP(d0, D0) cout<<table[d0]<<" "; cout<<"\n";
#define PRINT2(table, D0, D1) REP(d0, D0) { REP(d1, D1) cout<<table[d0][d1]<<" "; cout<<"\n"; }
#define PRINT3(table, D0, D1, D2) REP(d0, D0) { REP(d1, D1) { REP(d2, D2) cout<<table[d0][d1][d2]<<" "; cout<<"\n"; } cout<<"\n"; }
#define UNIFORM_DOUBLE(a, b) (((b-a)*(double)rand()/RAND_MAX)+a) // [a, b) 
#define UNIFORM_LL(a, b) (ll)UNIFORM_DOUBLE(a, b) // [a, b) 
#define IN(v, lo, hi) ((lo)<=(v) && (v)<(hi))
#define DD(v) cout<<#v<<": "<<v<<endl
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const map<T0, T1>& v) { for( typename map<T0, T1>::const_iterator p = v.begin(); p!=v.end(); p++ ){os << p->first << ": " << p->second << " ";} return os; }
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const pair<T0, T1>& v) { os << v.first << ": " << v.second << " "; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<T>& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << " "; } return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<vector<T> >& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << endl; } return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const set<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const deque<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }

#define MOD 1000000007LL
#define INF (1LL<<60)

/*
4⁄N=1⁄h+1⁄n+1⁄w

4hnw = N(nw+wh+hn)

w(4hn-Nn-Nh) = Nhn
for h, n:
	w = Nhn / (4hn-Nn-Nh)
*/
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll N;
	while(cin>>N) {
		ll M = 3501;
		bool done = 0;
		RANGE(h, 1, M) if(!done) RANGE(n, 1, M) if(!done) {
//			DD(N);DD(h);DD(n);
			ll B = 4*h*n-N*n-N*h;
			if(B==0) continue;
			ll w = N*h*n / B;
			if(w>0 && w * B == N*h*n) {
				cout<<h<<" "<<n<<" "<<w<<endl;
				done=1;
				break;
			}
		}
	}
	
	return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); ++i)
#define outl(x) cout<< (x) << '\n'
#define outl2(x,y) cout<< (x) << ' ' << (y) << '\n'
using pii = pair<int,int>;
using ll = long long;
template<class A, class B>inline bool chmax(A &a, B b){return b>a ? a=b,1 : 0;}
template<class A, class B>inline bool chmin(A &a, B b){return b<a ? a=b,1 : 0;}
static constexpr int INF = 0x3f3f3f3f;

#define fi first
#define se second

int H, W;
int mas[555][555];

int main()
{
    cin >> H >>W;
    rep(i, H) {
        rep(j, W) {
            cin >> mas[i][j];
        }
    }

    vector< pair<pii,pii> > ans;

    rep(i, H) {
        rep(j, W-1) {
            if (mas[i][j] & 1){
                ans.emplace_back(pii(i,j), pii(i,j+1));
                ++mas[i][j+1];
            }
        }
    }

    rep(i, H-1) {
        int j = W-1;
        if (mas[i][j] & 1) {
            ans.emplace_back(pii(i,j), pii(i+1, j));
            ++mas[i+1][j];
        }
    }

    outl(ans.size());
    for (const auto& e: ans)
    {
        const auto &s = e.first;
        const auto &t = e.second;
        printf("%d %d %d %d\n", s.fi+1, s.se+1, t.fi+1, t.se+1);
    }

    return 0;
}



Measured memory_bytes: 5232
// copied by Nurstan Duisengaliev
// skatal
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp> 
 
#define ll long long
#define all(x) x.begin(), x.end()
#define in insert
#define mp make_pair
#define F first
#define S second
#define ppf pop_front
#define pb push_back
#define ppb pop_back
#define pf push_front
#define pii pair <int, int>
#define boost() ios_base::sync_with_stdio(0), cin.tie(0)
#define sz(x) (int)x.size()
 
using namespace std;
//using namespace __gnu_pbds;

//template<typename T> using ordered_set = tree <T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;                         

const int N = (int)2e5 + 123;
const int mod = (int)1e9 + 7;
const ll INF = (ll)1e18 + 7;
int a[N], kol[(int)1e6 + 123];
bool used[(int)1e6 + 123];
void solve () {
	int n;
	cin >> n;
	for (int i = 1; i <= n; i ++) {
		cin >> a[i];
		used[a[i]] = 1;
		kol[a[i]] ++;
	}
	int K = (int)1e6;
	int ans = 0;
	for (int i = 1; i <= K; i ++) {
		if (used[i] == 1) {
			if (kol[i] >= 2) kol[i] = 2;
			for (int j = i + i; j <= K; j += i) {
				kol[j] ++;
				if (kol[j] >= 2) kol[j] = 2;
			}
		}	
	}
	for (int i = 1; i <= n; i ++) ans += (kol[a[i]] >= 2);
	cout << n - ans;
}   	
 
main () {
//	freopen (".in", "r", stdin);
//	freopen (".out", "w", stdout);
	boost ();
	int TT = 1;
//    cin >> TT;
	while (TT --) {
		solve ();
	}
	return 0;	
}

Measured memory_bytes: 9148
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<ll>;
using vvi = vector<vector< ll > >;
using vpi = vector<pair<ll,ll> >;
using pi = pair<ll,ll>;
using st = set<ll>;
using kiwi = queue<ll>;
using mp = map<ll,ll>;
using ump = unordered_map<ll,ll>;
#define MOD 1000000007
const ll mx = 1e5+123;
#define REP(i,n) for (ll i=1;i<=n;++i)

#define fastio  ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
int main(){
    fastio;
    ///freopen("input.txt","r",stdin);
    ///freopen("output.txt","w",stdout);
    ll n, k; cin>>n>>k;
    vi V(n);
    for(auto& x:V)
        cin>>x;
    for(ll i=0;i<n-k;++i){
        if(V[i]<V[i+k]) cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
    }

return 0;
}


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


int main() {
	#ifndef ONLINE_JUDGE
    // for getting input from input.txt
    freopen("input.txt", "r", stdin);
    // for writing output to output.txt
    //freopen("output.txt", "w", stdout);
    #endif
	
	string s; cin >> s;
	for (int i=0; i<s.size(); i++) {
		if (s[i] == '?')
			s[i] = 'D';
	}
	cout << s;
}


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

typedef long long ll;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define each(itr,c) for(__typeof(c.begin()) itr=c.begin(); itr!=c.end(); ++itr)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second

// j番目のホテルから2^i日以内に到達可能な最も右のホテル番号
// 2^17 = 131072
int r[18][100000];

int main()
{
    int n,L;
    cin >>n;
    vector<int> x(n);
    rep(i,n) scanf(" %d", &x[i]);
    cin >>L;

    rep(i,n) r[0][i]=upper_bound(all(x), x[i]+L)-x.begin()-1;
    for(int i=1; i<18; ++i)rep(j,n) r[i][j]=r[i-1][r[i-1][j]];

    int Q;
    cin >>Q;
    rep(q,Q)
    {
        int a,b;
        scanf(" %d %d", &a, &b);
        --a;
        --b;
        if(a>b) swap(a,b);

        int ans=0;
        int now=a;
        for(int i=17; i>=0; --i)
        {
            if(r[i][now]<b)
            {
                now=r[i][now];
                ans+=1<<i;
            }
        }
        while(now<b)
        {
            now=r[0][now];
            ++ans;
        }

        printf("%d\n", ans);
    }

    return 0;
}


Measured memory_bytes: 8192
n = gets.chomp.to_i

s = []

c_0 = 0
c_1 = 0
c_2 = 0
c_3 = 0

for num in 0...n do
 s[n]=gets.chomp
 if(s[n] == "AC")
  c_0 = c_0 + 1
 elsif(s[n] == "WA")
  c_1 = c_1 + 1
 elsif(s[n] == "TLE")
  c_2 = c_2 + 1
 else
  c_3 = c_3 + 1
 end

end

puts "AC x #{c_0}"
puts "WA x #{c_1}"
puts "TLE x #{c_2}"
puts "RE x #{c_3}"


Measured memory_bytes: 15044
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N = int(input())
Hs = list(mapint())

ans = 0
tmp = 0
for i in range(1, N):
    if Hs[i]<=Hs[i-1]:
        tmp += 1
    else:
        ans = max(tmp, ans)
        tmp = 0
else:
    ans = max(tmp, ans)
print(ans)

Measured memory_bytes: 87476
#include <iostream>
#include <math.h>
using namespace std;
int main() {
    int n;
    cin >> n;
    int m = ceil(n/1.08);
    if (floor(m*1.08)==n) {
        cout << m << endl;
    } else {
        cout<< ":(" << endl;
    }
}

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

int main(){
        ll n;
        scanf("%lld", &n);

        vector<bool> used(n);
        used[0] = true;

        vector<P> toans(n-1);
        vector<vector<ll>> link(n, vector<ll>(0));

        for(int i=0; i<n-1; i++){
                ll a, b;
                scanf("%lld %lld", &a, &b);
                toans[i] = make_pair(a-1, b-1);
                link[a-1].push_back(b-1);
                link[b-1].push_back(a-1);
                used[i+1] = false;
        }


        map<P, ll> ans;
        queue<P> que;
        que.push(make_pair(0, 0));
        ll maxim = 0;

        while(!que.empty()){
                P tmp = que.front();
                ll m = tmp.first;
                ll col = tmp.second;
                que.pop();

                ll er = 1;
                for(ll v: link[m]){
                        if(!used[v]){
                                used[v] = true;
                                if(er==col) er++;
                                ans[make_pair(m,v)] = er;
                                ans[make_pair(v,m)] = er;
                                que.push(make_pair(v, er));
                                maxim = max(maxim, er);
                                er++;
                        }
                }
        }

        printf("%lld\n", maxim);
        for(P p: toans) printf("%lld\n", ans[p]);

        return 0;
}

Measured memory_bytes: 20608
from bisect import bisect_right
import sys
input=sys.stdin.readline
n=int(input())
A=[-int(input())-1 for _ in range(n)]
M=[0]*n
for a in A:
    idx=bisect_right(M,a)
    M[idx]=a
ans=0
for m in M:
    if m:
        ans+=1
print(ans)

Measured memory_bytes: 45404
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>	// require sort next_permutation count __gcd reverse etc.
#include <cstdlib>	// require abs exit atof atoi 
#include <cstdio>		// require scanf printf
#include <functional>
#include <numeric>	// require accumulate
#include <cmath>		// require fabs
#include <climits>
#include <limits>
#include <cfloat>
#include <iomanip>	// require setw
#include <sstream>	// require stringstream 
#include <cstring>	// require memset
#include <cctype>		// require tolower, toupper
#include <fstream>	// require freopen
#include <ctime>		// require srand
#define rep(i,n) for(int i=0;i<(n);i++)
#define ALL(A) A.begin(), A.end()

using namespace std;

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

ll stoll (string s )
{
	stringstream ss (s );
	ll res;
	ss >> res;

	return res;
}

int main()
{
//	cut here before submit 
//	freopen ("testcase.diff2", "r", stdin );
	int n;
	scanf ("%d", &n );
	
	rep (i, n ){
		string num;
		cin >> num;
		int m = num.length();
		vector<int> N (m, 0 );
		rep (j, m ) N[j] = (int)(num[j] - '0' );

		sort (ALL (N ) );
		string small = "";
		rep (j, m ) small += (char)(N[j] + '0');

		string large = "";
		sort (ALL (N), greater<int>() );
		rep (j, m ) large += (char)(N[j] + '0');

		ll s = stoll (small );
		ll l = stoll (large );

		cout << l - s << endl;

	} // end rep

	return 0;
}

Measured memory_bytes: 1292
#include <iostream>
#include <string>
#include <cstring>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <queue>
#include <stack>
#include <iomanip>
#include <fstream>
#include <unordered_set>

using namespace std;

#define REP(i, n) for(ll i = 0;i < n;i++)
#define REPR(i, n) for(ll i = n;i >= 0;i--)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
#define FORR(i, m, n) for(ll i = m;i >= n;i--)
#define REPO(i, n) for(ll i = 1;i <= n;i++)
#define ll long long
#define INF (ll)1ll << 60
#define MINF (-1 * INF)
#define ALL(n) n.begin(),n.end()
#define MOD 1000000007
#define P pair<ll, ll>


int main() {
	ll a, b;
	cin >> a >> b;
	REP(i, 100000) {
		if (i * 108 / 100 - i == a and i * 110 / 100 - i == b) {
			cout << i << endl;
			return 0;
		}
	}
	cout << -1 << endl;
}



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

typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
const int INF = int (1e9) + int (1e5);
const ll INFL = ll(2e18) + ll(1e10);
const ui MOD = 1E9 + 7;
const double EPS = 1e-9;
#define FOR(i,n) for (int i=0;i<(n);++i)
#define ROF(i,x) for(int i = (x) ; i >= 0 ; --i)
#define MP make_pair
#define ALL(a) (a).begin(),(a).end()
#define ODD(x) (((x)&1)==0?(0):(1))
#define sign(x) ((x > 0) - (x < 0))
std::mt19937_64  generator(std::chrono::system_clock::now().time_since_epoch().count());

inline ll powmod(ll a,ll b,ll mod) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a, ll b) { return a ? gcd(b%a, a): b; }
ll lcm(ll a, ll b) { return a / gcd(a,b) * b; }


void READ(bool _local){
    ios_base::sync_with_stdio(false); cin.tie(0);
#ifdef _DEBUG
    if (_local)
        freopen ("in.txt", "r", stdin);
#endif
}

const int N=2E5+2;
ll val[N];
vi g[N];

void add_edge(int u,int v){
    g[u].push_back(v);
    g[v].push_back(u);
}
void dfs(int node,int p=-1){
    for(int c:g[node]){
        if (c!=p){
            val[c] += val[node];
            dfs(c,node);
        }
    }    
    
}

int main() {
    READ(0);
    int n,q;cin>>n>>q;
    FOR(i,n-1){
        int x,y;cin>>x>>y;
        add_edge(x,y);
    }
    while(q--){
        int x,v;cin>>x>>v;
        val[x]+=v;
    }
    dfs(1);
    for(int i=1;i<=n;++i) cout << val[i] << " ";
    return 0;
}



Measured memory_bytes: 24320
#include <bits/stdc++.h>
#include <string>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <numeric>
using namespace std;

int main(){
    int N;
    cin >> N;
    string S,T;
    cin >> S >> T;
    string ans;
    for(int i = 0;i<N;i++){
        ans = ans + S.at(i);
        ans = ans + T.at(i);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
/*
Sharif Hasan - CSE, PUST
Sep 01,2019 06:05 PM
*/
#include<bits/stdc++.h>
#define br cout<<"\n"
#define FOR(i,n) for(i=0;i<n;i++)
#define FROM(a,i,n) for(i=a;i<n;i++)
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

using namespace std;
int main()
{
int cnt=0;
string s,t;
cin>>s>>t;
int i;
for(i=0;i<s.length();i++)
{
    if(s[i]==t[i]) cnt++;
}
cout<<cnt;
return 0;
}

Measured memory_bytes: 256
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cwchar>
#include <cwctype>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <codecvt>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define all(x) (x).begin(),(x).end()
#pragma GCC optimize("Ofast")
using namespace std;
typedef int64_t ll;
typedef long double ld;
const ll INF=(1LL<<60);
const ld pi=acosl((ld)1);
const ll mod = 1000000007;
const int dx[4]={0,1,0,-1};
const int dy[4]={1,0,-1,0};
const int ddx[8]={1,0,-1,-1,-1,0,1,1};
const int ddy[8]={1,1,1,0,-1,-1,-1,0};

bool solve(){
  ll a,b;cin>>a>>b;
  rep(i,pow(10,6)){
    ll x=i*8/100;
    ll y=i*10/100;
    if(x==a&&y==b){
      cout<<i<<endl;
      return false;
    }
  }
  cout<<-1<<endl;
  return false;
}


signed main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout<<fixed;
	cout<<setprecision(30);
	return solve();
}


Measured memory_bytes: 512
/*
 * b.cc: 
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>

using namespace std;

/* constant */

const int MAX_N = 100000;
const int MAX_Q = 50000;

/* typedef */

/* global variables */

int ss[MAX_N];

/* subroutines */

/* main */

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

  for (int i = 0; i < n; i++) cin >> ss[i];
  sort(ss, ss + n);

  int q;
  cin >> q;

  int cnt = 0;
  while (q--) {
    int ti;
    cin >> ti;

    int k = lower_bound(ss, ss + n, ti) - ss;
    if (k < n && ss[k] == ti) cnt++;
  }

  printf("%d\n", cnt);
  return 0;
}

Measured memory_bytes: 1548
# -*- coding: utf-8 -*-
import sys
from collections import deque, defaultdict
from math import sqrt, factorial, gcd
# def input(): return sys.stdin.readline()[:-1] # warning not \n
# def input(): return sys.stdin.buffer.readline().strip() # warning bytes
# def input(): return sys.stdin.buffer.readline().decode('utf-8')


def solve():
    n = int(input())
    ans = 0
    m = float('inf')
    for i in range(5):
        x = int(input())
        m = min(m, x)
    xd = (n + m - 1) // m
    print(xd + 4)



    




        
    

    
    

t = 1
# t = int(input())
for case in range(1,t+1):
    ans = solve()


"""

2 2 2 2 2

"""


Measured memory_bytes: 9468
# AOJ 0159 The Best Body
# Python3 2018.6.18 bal4u

GOAL = 22.0
EPS = 1e-5

while True:
	n = int(input())
	if n == 0: break
	id, vmin = 0, 1000000000.0;
	for i in range(n):
		p, h, w = list(map(int, input().split()))
		bmi = w/(h/100)**2
		diff = abs(bmi-GOAL)
		if abs(diff-vmin) < EPS:	# diff == vmin
			if p < id: id = p
		elif diff < vmin:
			id, vmin = p, diff
	print(id)


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

#define FOR(a,b,c) for (int a=(b);a<(c);++a)
#define REP(i,n) FOR(i,0,n)
#define ll long long
#define pii pair<int,int>
#define x first
#define y second
#define pb push_back
#define lf double

using namespace std;

const int MAX = (int)1e6 + 5;

const int mod = (int)1e9+7;

inline int add(int a,int b){ return a+b>=mod?a+b-mod:a+b;}
inline int sub(int a,int b){ return a-b<0?a-b+mod:a-b;}
inline int mul(int a,int b){ return (ll)a*b%mod;}

int pot(int a,int n){
	int ret=1;
	while(n){
		if (n&1) ret=mul(ret,a);
		a=mul(a,a);
		n/=2;
	}
	return ret;
}

int f[MAX];

int main(){
	int n,k;
	scanf ("%d%d",&n,&k);
	int ret=0;
	for (int i=k;i>0;--i){
		int d=k/i;
		int p=pot(d,n);
		for (int j=i*2;j<=k;j+=i){
			p=sub(p,f[j]);
		}
		f[i]=p;
	}
	FOR(i,1,k+1){
		ret=add(ret,mul(i,f[i]));
	}
	printf ("%d\n",ret);
	
	return 0;
}


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

int main() {
  int A, B, C;
  cin >> A >> B >> C;
  
  if (A == B && A != C){
    cout << "Yes" << endl;
  }
  else if (B == C && A != B){
    cout << "Yes" << endl;
  }
  else if (A == C && B != C){
    cout <<"Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}

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

n = int(input())
a = [int(x) for x in input().split()]
ans = set()
for i in range(n):
    j = a[i] - 1
    if (i not in ans) and (j not in ans) and a[j] == i + 1:
        ans.add(j)
print(len(ans))


Measured memory_bytes: 55068
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define db double
#define pii pair<int,int>
#define pli pair<ll,int>
#define pil pair<int,ll>
#define pll pair<ll,ll>
#define mat vector<vector<int>>
const int inf = 1 << 30;
const ll linf = 1e18;
const db EPS = 1e-7;
template<class T> void chmin(T& x, T y){if(x > y) x = y;}
template<class T> void chmax(T& x, T y){if(x < y) x = y;}

int R, C, N;

bool judge(int x, int y){
    return (x == 0 || x == R || y == 0 || y == C);
}

int culc_dist(int x, int y){
    if(x == 0) return y;
    if(y == C) return C + x;
    if(x == R) return C + R + (C - y);
    if(y == 0) return R * 2 + C * 2 - x;
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> R >> C >> N;
    vector<pii> dat;
    for(int i = 0; i < N; i++){
        int x1, y1, x2, y2;
        cin >> x1 >> y1 >> x2 >> y2;
        if(judge(x1, y1) && judge(x2, y2)){
            dat.emplace_back(pii{culc_dist(x1, y1), i});
            dat.emplace_back(pii{culc_dist(x2, y2), i});
        }
    }
    sort(dat.begin(), dat.end());
    stack<int> st;
    st.push(dat[0].second);
    for(int i = 1; i < dat.size(); i++){
        if(st.empty() || st.top() != dat[i].second) st.push(dat[i].second);
        else st.pop();
    }
    cout << (st.empty() ? "YES" : "NO") << endl;
    return 0;
}

Measured memory_bytes: 2420
#include <iostream>
#include <string>

using namespace std;

int a, b;
string s;

void solve()
{
    int ok = 1;
    for (int i = 0; i < a+b+1; i++) {
        if (i == a && s[i] != '-' || i != a && s[i] == '-') {
            ok = 0;
        }
    }

    if (ok) cout << "Yes" << endl;
    else cout << "No" << endl;
}

int main()
{
    cin >> a >> b >> s;

    solve();

    return 0;
}

Measured memory_bytes: 256
while True:
    n, x = map(int, input().split())
    if n == x == 0:
        break
    numbers = set()
    N = [i for i in range(1, n+1)]
    for i in N:
        for j in N:
            if i == j:
                break
            for k in N:
                if i == j or i == k or j == k:
                    break
                else:
                    numbers.add((i, j, k))
    count = 0
    numbers = list(numbers)
    for i in numbers:
        if i[0] + i[1] + i[2] == x:
            count += 1
    print(count)

Measured memory_bytes: 26096
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val n = sc.nextInt()
    val s = sc.next()
    val k = sc.nextInt()

    val c = s[k - 1]

    val ret = s.fold("") { acc, next ->
        if (next == c) acc + c else "$acc*"
    }

    println(ret)
}

Measured memory_bytes: 29352
s = list(input())

s_split = []
tmp = []
idx_all = []
l = -1
for i in range(len(s) - 1):
    tmp.append(s[i])
    if s[i] == 'R' and s[i + 1] == 'L':
        idx_all.append(i - l - 1)
    if s[i] == 'L' and s[i + 1] == 'R':
        s_split.append(tmp)
        tmp = []
        l = i
tmp.append(s[-1])
s_split.append(tmp)

out = ''
for a in range(len(s_split)):
    idx = idx_all[a]
    _split = s_split[a]

    if len(_split) % 2 == 0:
        r_int = len(_split) // 2
        l_int = len(_split) // 2

    else:
        if idx % 2 == 1:
            r_int = (len(_split) - 1) // 2
            l_int = (len(_split) + 1) // 2

        else:
            l_int = (len(_split) - 1) // 2
            r_int = (len(_split) + 1) // 2

    out += ' 0' * idx
    out += ' ' + str(r_int)
    out += ' ' + str(l_int)
    out += ' 0' * (len(_split) - idx - 2)

print(out[1:])


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

int main(){

    int x,y;
    cin >> x >> y;

    rep(i,x+1){
        if(i*4+(x-i)*2==y){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  for(int i=0;i<(n);++i)
#define REPr(i,n) for(int i=(n)-1;i>=0; --i)
#define FORq(i, m, n) for(int i = (m);i <= (n);++i)
#define FORqr(i, m , n) for(int i = (n);i >=(m);--i)
#define SCD(n) scanf("%d",&n)
#define SCD2(m,n) scanf("%d%d",&m,&n)
#define SCD3(m,n,k) scanf("%d%d%d",&m,&n,&k)
#define SCLLD(n) scanf("%lld",&n)
#define SCLLD2(m,n) scanf("%lld%lld",&m,&n)
#define SCLLD3(m,n,k) scanf("%lld%lld%lld",&m,&n,&k)
#define PB push_back
#define MP make_pair
#define ARSCD(A,N) REP(i,N){SCD(A[i]);}
#define ARSCD1(A,N) FORq(i,1,N){SCD(A[i]);}
#define VSCD(v,N) REP(i,N){int (x); SCD(x); v.PB(x);}
#define VSCLLD(v,N) REP(i,N){long long (x); SCLLD(x); v.PB(x);}
#define PRINTD(n) printf("%d\n",n)
#define PRINTLLD(n) printf("%lld\n",n)
#define DEBUG printf("%s\n","debug")
#define fst first
#define snd second
#define SIN(x,S) (S.count(x) != 0)
#define M0(x) memset(x,0,sizeof(x))
#define FILL(x,y) memset(x,y,sizeof(x))
#define MM(x) memset(x,-1,sizeof(x))
#define ALL(x) (x).begin(),(x).end()
using namespace std;
typedef pair<int,int> PII;
typedef pair<long long,long long> PLL;
typedef vector<int> VI;
typedef vector < VI > VVI;
typedef vector<long long> VL;
typedef long long ll;
typedef long long integer;
///////////////////////////////////////////////
const ll MOD = 1000000007;
ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}

template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
///////////////////////////////////////////////
vector<ll> S;
vector<ll> Z;
ll now = 1;
vector<ll> A;
ll N,K;
ll allzeroans = 0;

int main(){
	SCLLD2(N,K);

    REP(i,N){
        ll a;
        SCLLD(a);
        A.PB(a);
    }


    REP(i,50){
        ll count = 0;
        REP(j,N){
            if (A[j] % 2 == 1) count++;
            A[j] = A[j] / 2;
        }
        S.PB(now * max(N-count,count));
        Z.PB(now * (count));
        allzeroans = allzeroans + Z[i];
        now = now * 2;
    }


    ll k = 1; ll Kp = -1;
    while(k<=K){
        Kp++;
        k = k * 2;
    }
    ll ans = allzeroans;
    now = K;
    ll con = 1LL << Kp;
    while(now >= 0 && Kp >= 0){
        if ((S[Kp] != Z[Kp]) && (now >= con)){
            now = now - con;
            ans += (S[Kp] - Z[Kp]);
        }
        con = con / 2;
        Kp--;
    }
    PRINTLLD(ans);
/*     PRINTLLD(Kp);
    PRINTLLD(allzeroans); */


/*     REP(i,50){
        cout << S[i] << "\n";
    } */
}

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

int main(int argc, char const* argv[])
{
	int n, m, x;
	cin >> n >> m >> x;
	int count = 0;
	for(int i = 0; i < m; i++){
			int a;
			cin >> a;
			if(a < x)count++;
	}
	if(count < m - count)cout << count << endl;
	else cout << m - count << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
typedef long long ll;
typedef vector<int> VI;
ll mm=1000000000;ll MM=mm+7;
#define rep(i, n) for(int i=0;i<n;i++)
#define PI 3.141592653589793

int main(){
   int n;
   cin >> n;
   vector<string> s(n);
   rep(i,n)cin >> s.at(i);
   int cntac=0;
   int cntwa=0;
   int cnttle=0;
   int cntre=0;
   rep(i,n){
   if(s.at(i)=="AC")cntac++;
   if(s.at(i)=="WA")cntwa++;
   if(s.at(i)=="TLE")cnttle++;
   if(s.at(i)=="RE")cntre++;
   }
   cout << "AC" << " " <<  'x' << " " << cntac << endl; 
   cout << "WA" << " " << 'x' << " " << cntwa << endl;
   cout << "TLE" << " " << 'x' << " " << cnttle << endl;
   cout << "RE" << " " << 'x' << " " << cntre << endl;

}


Measured memory_bytes: 6428
import java.io.{BufferedOutputStream, BufferedReader, InputStreamReader, PrintWriter}

object Main {
  def main(args: Array[String]): Unit = {
    val in = new BufferedReader(new InputStreamReader(System.in))
    val out = new PrintWriter(new BufferedOutputStream(System.out))

    val as = Array.ofDim[Int](3, 3)

    for {
      i <- 0 until 3
    } {
      as(i) = in.readLine().split("\\s").map(_.toInt)
    }

    val n = in.readLine().toInt

    for {
      _ <- 0 until n
    } {
      val b = in.readLine().toInt
      for {
        i <- 0 until 3
        j <- 0 until 3
        if as(i)(j) == b
      } {
        as(i)(j) = -1
      }
    }

    for {
      i <- 0 until 3
    } {
      if (as(i).forall(_ == -1)) {
        out.println("Yes")
        out.flush()
        return
      }
    }

    for {
      j <- 0 until 3
    } {
      if (as.map(a => a(j)).forall(_ == -1)) {
        out.println("Yes")
        out.flush()
        return
      }
    }

    if (as(0)(0) == -1 && as(1)(1) == -1 && as(2)(2) == -1) {
      out.println("Yes")
      out.flush()
      return
    }

    if (as(0)(2) == -1 && as(1)(1) == -1 && as(2)(0) == -1) {
      out.println("Yes")
      out.flush()
      return
    }

    out.println("No")
    out.flush()
  }
}


Measured memory_bytes: 27340