akhauriyash/Code-Regression huggingface dataset:
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

public class Main {
    private static final int[] ary = {
        100000,
        105000,
        111000,
        117000,
        123000,
        130000,
        137000,
        144000,
        152000,
        160000,
        168000,
        177000,
        186000,
        196000,
        206000,
        217000,
        228000,
        240000,
        252000,
        265000,
        279000,
        293000,
        308000,
        324000,
        341000,
        359000,
        377000,
        396000,
        416000,
        437000,
        459000,
        482000,
        507000,
        533000,
        560000,
        588000,
        618000,
        649000,
        682000,
        717000,
        753000,
        791000,
        831000,
        873000,
        917000,
        963000,
        1012000,
        1063000,
        1117000,
        1173000,
        1232000,
        1294000,
        1359000,
        1427000,
        1499000,
        1574000,
        1653000,
        1736000,
        1823000,
        1915000,
        2011000,
        2112000,
        2218000,
        2329000,
        2446000,
        2569000,
        2698000,
        2833000,
        2975000,
        3124000,
        3281000,
        3446000,
        3619000,
        3800000,
        3990000,
        4190000,
        4400000,
        4620000,
        4851000,
        5094000,
        5349000,
        5617000,
        5898000,
        6193000,
        6503000,
        6829000,
        7171000,
        7530000,
        7907000,
        8303000,
        8719000,
        9155000,
        9613000,
        10094000,
        10599000,
        11129000,
        11686000,
        12271000,
        12885000,
        13530000,
        14207000
    };

    public static void main(String args[]) throws IOException {
        //n週間の入力を取得
        int nWeeks = Integer.parseInt(new BufferedReader(new InputStreamReader(System.in)).readLine());
        System.out.println(ary[nWeeks]);

    }
} 

Measured memory_bytes: 17036
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll MOD = (1e+9)+7;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-11;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;
typedef pair<ld, ld> LDP;
int main() {
	int n; cin >> n;
	int a[100000], b[100000];
	rep(i, n) {
		cin >> a[i];
	}
	rep(i, n) {
		cin >> b[i];
	}
	sort(a, a + n); sort(b, b + n);
	ll dp[100001]; dp[0] = 1;
	rep(i, n) {
		if (a[i] < b[i]) {
			int le = lower_bound(b, b + n, a[i]) - b;
			dp[i + 1] = (ll)(i - le + 1)*dp[i] % MOD;
		}
		else {
			int le = lower_bound(a, a + n, b[i]) - a;
			dp[i + 1] = (ll)(i - le + 1)*dp[i] % MOD;
 		}
	}
	cout << dp[n] << endl;
	return 0;
}

Measured memory_bytes: 1792
arr = []
for i in range(2):
	arr += list(map(str,input().split()))
	
def reverce(org):
	ls_rev_org = []
	ls_org = list(org)
	for i in range(1,len(org)+1):
		ls_rev_org += ls_org[-i]
	return ''.join(ls_rev_org)

rev_org = reverce(arr[0])

if rev_org == arr[1]:
	print('YES')
else:
	print('NO')
	
	

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

int main() {
  int h, n;
  cin >> h >> n;
  bool ok = false;
  rep(i,n) {
    int a;
    cin >> a;
    h -= a;
    if(h<=0) ok = true;
  }

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


Measured memory_bytes: 256
#ifdef _MSC_VER
#include <__msvc_all_public_headers.hpp>
#undef min
#undef max
#else
#define NDEBUG
#include <bits/stdc++.h>
#endif

using namespace std;
using large = long long;

array<int, 100'005> A;
array<int, 100'005> leftgcd;
array<int, 100'005> rightgcd;

int main() {
    int n;
    cin >> n;
    for (auto i = 1; i <= n; ++i)
        cin >> A[i];

    leftgcd[0] = 0;
    leftgcd[1] = A[1];
    for (auto i = 2; i <= n; ++i) {
        leftgcd[i] = gcd(A[i], leftgcd[i - 1]);
    }
    leftgcd[n + 1] = 0;

    rightgcd[n + 1] = 0;
    rightgcd[n] = A[n];
    for (auto i = n - 1; i >= 1; --i) {
        rightgcd[i] = gcd(A[i], rightgcd[i + 1]);
    }
    rightgcd[0] = 0;

    auto max_possible = 0;
    for (auto pos = 1; pos <= n; ++pos) {
        auto left = leftgcd[pos - 1];
        auto right = rightgcd[pos + 1];

        if (left == 0)
            max_possible = max(max_possible, right);
        else if (right == 0)
            max_possible = max(max_possible, left);
        else
            max_possible = max(max_possible, gcd(left, right));
    }

    cout << max_possible << "\n";
    return 0;
}


Measured memory_bytes: 4708
#include <iostream>
using namespace std;
#define king 1000000007

int main(){
  long long m,n,sum=1;
  cin>>m>>n;
  while(n!=1){
    if(n%2==1){
      sum=sum*m%king;
    }
    m=m*m%king;
    n/=2;
  }
  m=m*sum%king;
  cout<<m<<endl;
  return 0;
}

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

int main()
{   int n,w;
    cin>>n>>w;
    vector<long long int> dp(w+1);
    for(int i=0;i<n;i++){
        int we,val;
        cin>>we>>val;
        for(int wa=w;wa>=we;wa--){
            dp[wa]=max(dp[wa],dp[wa-we]+val);
        }
        
    }
    cout <<dp[w]<< endl;
    return 0;
}


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

using namespace std;

#define ll long long




void solve() {

	int arr[3];
	for(int i = 0; i < 3; i++) {
		cin >> arr[i];
	}
	sort(arr, arr + 3);
	cout << arr[0] + arr[1];

	




	
}

int main() {

	ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	solve();

	return 0;
}

Measured memory_bytes: 3656
#include <iostream>
#include <cctype>
#include <cstdio>
#include <vector>
#include <iomanip>
#include <cstring>
#include <fstream>
#include <cmath>
#include <stack>
#include <algorithm>
#include <queue>
#include <iterator>
#include <limits>
#define PI 3.1415926535
#include <sstream>
#define MAX 100
#define swap(a,b,t) (t=a,a=b,b=t)
using namespace std;

bool isvalid(int N,int D)
{
     if(N>=0 && N<D)
     return true;
     return false;
}
     

int main()
        { 
        int c=0,d=0;
        string s;
        cin>>s;
        for(int i=1;i<s.length();i++)
        {
                if(i%2 && s[i]==s[0])
                c++;
                else if(i%2==0 && s[i]!=s[0])
                c++;
        }
        cout<<c;
        //system("pause");
        return 0;
        } 
        
        





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

#define int long long

#define Min(A, B) std::min(A, B)

using namespace std; 

const int Inf = 1e10;
const int MaxN = 2e5 + 10;
struct Node {
	int A, B;
};

std::vector<Node> F[MaxN], G[MaxN];

int N, M;

#define Swap(A, B) swap(A, B) 

bool CmpA(Node X, Node Y) {
	return X.A < Y.A;
}

bool CmpB(Node X, Node Y) {
	return X.B < Y.B;
}

int Mv[MaxN];
int Mid;

void Solve(vector <Node> &Ls, vector <Node> &Rs, vector <Node> &K) {
	if(Ls.size() > Rs.size()) Swap(Ls, Rs);
	int SzA = Ls.size(), SzB = Rs.size();
	std::sort(Ls.begin(), Ls.end(), CmpB); std::sort(Rs.begin(), Rs.end(), CmpA);
	Mv[0] = Rs[0].B;
	for(int i = 1; i < SzB; i++) Mv[i] = Min(Mv[i - 1], Rs[i].B);
	for(int i = 0, j = SzB - 1; i < SzA; i++) {
		while(j >= 0 && Ls[i].B + Rs[j].A > Mid) j -= 1;
		if(j >= 0) K.push_back((Node) {Ls[i].A, Mv[j]});
	}
	std::sort(Ls.begin(), Ls.end(), CmpA); std::sort(Rs.begin(), Rs.end(), CmpB);
	Mv[0] = Rs[0].A;
	for(int i = 1; i < SzB; i++) Mv[i] = Min(Mv[i - 1], Rs[i].A);
	for(int i = 0, j = SzB - 1; i < SzA; i++) {
		while(j >= 0 && Ls[i].A + Rs[j].B > Mid) j -= 1;
		if(j >= 0) K.push_back((Node) {Mv[j], Ls[i].B});
	}
}

void Check(int Now) {
	if(!F[Now].empty()) F[Now].clear();
	if(G[Now].empty()) {
		F[Now].push_back((Node) {0, 0});
		return;
	}
	for(int i = 0; i < G[Now].size(); i++) Check(G[Now][i].A);
	
	vector <Node> &Ls = F[G[Now][0].A];
	int Sz = Ls.size();
	for(int i = 0; i < Sz; i++) {
	    Ls[i].A += G[Now][0].B;
		Ls[i].B += G[Now][0].B;
	}
	vector <Node> &Rs = F[G[Now][1].A];
	for(int i = 0; i < Rs.size(); i++) {
		Rs[i].A += G[Now][1].B;
		Rs[i].B += G[Now][1].B;
	}
	Solve(Ls, Rs, F[Now]);
	Ls.clear(); Rs.clear();
}

main() {
	scanf("%lld", &N);
	for(int i = 1; i < N; i++) {
		int x, Val; scanf("%lld%lld", &x, &Val);
		G[x].push_back((Node) {i + 1, Val}); 
	}
	int L = 0, R = 1ll << 30, Ans = 1ll << 30;
	while(R - L >= 0) {
		Mid = (L + R) / 2;
		Check(1);
		if(F[1].empty()) L = Mid + 1;
		else R = Mid - 1, Ans = Mid;
 	}
 	printf("%lld", Ans);
}

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



int main(){
    ll a,b;
    cin >> a >> b;
    while(a%b != 0){
        ll temp = a%b;
        a = b;
        b = temp;
    }
    ll gcm = b;

    set<ll> s;
    s.insert(1);
    ll n = gcm;
    ll i = 2;
    while(i<sqrt(n)+1){
        if(n%i == 0){
            s.insert(i);
            n /= i;
            i = 1;
        }
        i += 1;
    }

    if(n != 1) s.insert(n);

    cout << s.size()<< endl;
}


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

int main() {
  // Input
  int N, M;
  cin >> N >> M;
  
  vector<int> L(M), R(M);
  for (int i = 0; i < M; i++) {
    cin >> L.at(i) >> R.at(i);
  }
  
  // Compute
  // 全てのiに対して　Li <= a <= Riを満たすaの数を求める
  // => Riの最小値 - Liの最大値 + 1 >= 0　を求める
  int L_max, R_min, ans;
  sort(L.begin(), L.end());
  L_max = L.at(M-1);
  sort(R.begin(), R.end());
  R_min = R.at(0);
  ans = R_min - L_max + 1;
  if (ans > 0) {
    cout << ans << endl;
  }
  else {
    cout << 0 << endl;
  }
}


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

namespace UOA_PCKWU_1043
{
    class Program
    {
        static void Main(string[] args)
        {
            string input;
            while( (input = Console.ReadLine()) != "0")
            {
                var count = Convert.ToInt32(input);
                var picked = new List<Team>();
                var list = Enumerable
                    .Range(0, count)
                    .Select(i => Console
                       .ReadLine()
                       .Split(' ')
                       .Select(s => Convert.ToInt32(s))
                       .ToList())
                    .Select(ia => new Team { Id = ia[0], Affiliation = ia[1], Score = ia[2], Penalty = ia[3] })
                    .ToList();
                list.Sort();
                list.ForEach(t =>
                {
                    var t2 = picked.Count(team => team.Affiliation == t.Affiliation);
                    if (picked.Count < 10 && t2 < 3) picked.Add(t);
                    else if (picked.Count < 20 && t2 < 2) picked.Add(t);
                    else if (picked.Count < 26 && t2 == 0) picked.Add(t);
                });
                picked.Sort();
                picked.ForEach(t => Console.WriteLine(t.Id));
            }
        }
    }

    public class Team : IComparable<Team>
    {
        public int Id { get; set; }
        public int Affiliation { get; set; }
        public int Score { get; set; }
        public int Penalty { get; set; }

        public int CompareTo(Team other)
        {
            if (this.Score != other.Score) return other.Score.CompareTo(this.Score);
            if (this.Penalty != other.Penalty) return this.Penalty.CompareTo(other.Penalty);
            return this.Id.CompareTo(other.Id);
        }
    }
}



Measured memory_bytes: 16464
#pragma warning(disable:4996)
#include <bits/stdc++.h>

using namespace std;

#define REP(i,n) for (int i = 0; i<n; i++)
#define ALL(a) begin(a), end(a)
#define TPL template
#define TNM typename

using ll = long long;
using ull = unsigned long long;
TPL<TNM T> using vec = vector<T>;
TPL<TNM T> using vec2 = vec<vec<T>>;
TPL<TNM T> using vec3 = vec<vec2<T>>;
TPL<TNM T> using vec4 = vec<vec3<T>>;
TPL<TNM T> using vec5 = vec<vec4<T>>;

TPL<TNM K, TNM V> using umap = unordered_map<K, V>;
TPL<TNM K, TNM V> using uset = unordered_set<K, V>;

struct pre_ { pre_() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(6); } } pre__;

TPL<TNM V, TNM H> void resize(vector<V>& v, const H h) { v.resize(h); }
TPL<TNM V, TNM H, TNM ... T> void resize(vector<V>& v, const H& h, const T ... t) { v.resize(h); for (auto& _v : v) resize(_v, t ...); }
TPL<TNM V, TNM T> void fill(V& x, const T& val) { x = val; }
TPL<TNM V, TNM T> void fill(vector<V>& vec, const T& val) { for (auto& v : vec) fill(v, val); }

int main(void) {
	int a, b;
	cin >> a >> b;
	int c = a + b;
	cout << (c + 1) / 2 << endl;
	return 0;
}

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

int main()
{
    char moji[4];
    cin >> moji;

    int a=0, b=0, i;

    if(moji[0] == moji[1] && moji[1] != moji[2] && moji[2] == moji[3]){
        cout << "Yes" << endl;
    }else if(moji[0] == moji[2] && moji[0] != moji[1] && moji[1] == moji[3]){
        cout << "Yes" << endl;
    }else if(moji[0] == moji[3] && moji[1] != moji[0] && moji[1] == moji[2]){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep3(i, s, n, a) for (int i = (s); i < (int)(n); i += a)
#define rep2(i, s, n) rep3(i, s, n, 1)
#define rep(i, n) rep2(i, 0, n)

using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int, int>;

int main(){
    ll k, a, b;
    cin >> k >> a >> b;
    if(b - a <= 1){
        cout << k + 1 << endl;
    }else{
        if(k<=a){
            cout << k + 1 << endl;
        }else{
            k -= (a - 1);
            if(k%2){
                cout << a + (b - a) * (k / 2) + 1 << endl;
            }else{
                cout << a + (b - a) * (k / 2) << endl;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 3572
def solve():
  s = input()
  istwo = True
  array = [s[0],s[1],s[2],s[3]]
  array.sort()
  if array[0] != array[1]:
    istwo = False
  if array[1] == array[2]:
    istwo = False
  if array[2] != array[3]:
    istwo = False
  if istwo:
    print("Yes")
  else:
    print("No")
  
  
solve()

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#include <sys/stat.h>
using namespace std;
using ll = int64_t;

int main(int , char **)
{
#ifdef LOCAL_DEBUG
	struct stat sb;
	ifstream in("/dev/shm/input.txt");
	if (stat("/dev/shm/input.txt",&sb)==0){ cin.rdbuf(in.rdbuf()); }
#endif

	char S[51] = {};
	cin >> S;
	int lng = strlen(S);
	S[lng-8]='\0';
	printf("%s\n",S);


	return 0;
}


Measured memory_bytes: 256
program sample
    implicit none
    character(2000000)::s,t
    integer(8) :: i,j,k,m,n
    integer(8)::a,b,c,d
    integer(8),allocatable::x(:),y(:)
  
    read(*,*) s
    n=len_trim(s)
    do i=1,n
        if(s(i:i) .eq. 'A')then
            a=i
            exit
        end if
    end do
    do i=n,1,-1
        if(s(i:i) .eq. 'Z')then
            b=i
            exit
        end if
    enddo
    write(*,*)b-a+1
    stop
end program sample
  



Measured memory_bytes: 4964
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner reader = new Scanner(System.in);
        int[] array = new int[6];
        for (int i = 0; i < array.length; i++) {
            array[i] = reader.nextInt();
        }
        if (array[4] - array[0] <= array[5])
            System.out.println("Yay!");
        else {
            System.out.println(":(");
        }
    }
}

Measured memory_bytes: 23636
function main(input) {
  const s = input.trim();
  let result = "No";
  const indexC = s.indexOf("C");
  const indexF = s.lastIndexOf("F");
  if (indexC !== -1 && indexF !== -1 && indexC < indexF) {
    result = "Yes";
  }
  console.log(result);
}
main(require("fs").readFileSync("/dev/stdin", "utf8"));

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

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

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

    vector<ll> y = x;
    sort(x.begin(), x.end());
    ll median1 = x[n / 2 - 1];
    ll median2 = x[n / 2];

    for (int i = 0; i < n; ++i) {
        if (y[i] > median1) {
            cout << median1 << endl;
        } else {
            cout << median2 << endl;
        }
    }

    return 0;
}

Measured memory_bytes: 5376
#include <bits/stdc++.h>
 using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
 int main(){
 int n,m=0,x=0;
   long long ans=0;
   cin>>n;
   vector<int> a;
   rep(i,n){
   m++;
     if(m%3!=0&&m%5!=0){
     a.push_back(m);
      }
     else{
     a.push_back(0);
     }
   }
   
  rep(i,n)ans+=a.at(i);
   cout<<ans<<endl;
}


Measured memory_bytes: 7460
import numpy as np
n, m, c = map(int, input().split())
B = np.array(list(map(int, input().split())))
A = np.array([ list(map(int, input().split())) for _ in range(n) ])
D = np.sum(A*B, axis=1) + c
print(len(D[D > 0]))

Measured memory_bytes: 12504
using System;

class MyClass
{
    static void Main(string[] args)
    {
        int n = int.Parse(Console.ReadLine());
        int[] a = new int[n];
        string[] str = Console.ReadLine().Split(' ');
        for (int i = 0; i < n; i++)
        {
            a[i] = int.Parse(str[i]);
        }
        for (int i = 0; i < n; i++)
        {
            Console.Write((i == 0) ? "" : " ");
            Console.Write(a[n - i - 1]);
        }
        Console.WriteLine();
    }
}


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

int main() {

int h, w;
cin >> h >> w;

string defS = "";
for (int i = 0; i < w + 2; i++) defS = defS + ".";

vector<string> s(h + 2, defS);

for (int i = 1; i <= h; i++) {
    cin >> s.at(i);
    s.at(i) = "." + s.at(i) + ".";
}
string answer = "Yes";

for (int i = 1; i <= h; i++ ) {
    for (int j = 1; j <= w; j++) {
        if (s.at(i).at(j) == '#') {
            if (s.at(i - 1).at(j) == '.' && s.at(i).at(j - 1) == '.' && s.at(i + 1).at(j) == '.' && s.at(i).at(j + 1) =='.') {
                answer = "No";
                break;
            }
        }
    }
}

cout << answer << endl;

return 0;
}

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

int main(){
    ll x;
    cin>>x;
    ll now=100,y=0;
    while(now<x){
        now+=now/100;
        y++;
    }
    cout<<y<<endl;
    return 0;
}

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

using namespace std;

#define ll long long
#define pb push_back
#define rep(i, a, b) for(int i = a; i < b; i++)
#define Rep(i, a, b) for(int i = a; i > b; i--)
#define fastio ios_base::sync_with_stdio(); cin.tie(0); cout.tie(0);
typedef vector<int> vi;

vector<vi> tree;
vi p0, p1, check;

void dfs(int u, int state) {
	if(check[u] == -1) {
		check[u] = 1;
		if(state) p1.pb(u);
		else p0.pb(u);
	}
	rep(i, 0, (int)tree[u].size()) {
		int t = tree[u][i];
		if(check[t] == -1) dfs(t, 1 - state);
	}
}

signed main() {
	fastio;
	int n; cin >> n;
	tree.assign(n, vi()); check.assign(n, -1);
	int a, b;
	rep(i, 0, n - 1) {
		cin >> a >> b;
		a--; b--;
		tree[a].pb(b);
		tree[b].pb(a);
	}
	dfs(0, 0);
	int perm[n] = {0}, cur;
	if(p1.size() <= n / 3)
	{
		bool used[n + 1];
		rep(i, 0, n) used[i] = false;
		cur = 3;
		rep(i, 0, p1.size()) 
		{
			used[cur] = true;
			perm[p1[i]] = cur;
			cur += 3;
		}
		cur = 1;
		rep(i, 0, n) 
		{
			if(used[cur]) cur++;
			if (perm[i] == 0) 
			{
				perm[i] = cur;
				cur++;
			}
		}
	}
	else if(p0.size() <= n / 3) 
	{
		bool used[n + 1];
		rep(i, 0, n) used[i] = false;
		cur = 3;
		rep(i, 0, p0.size()) 
		{
			used[cur] = true;
			perm[p0[i]] = cur;
			cur += 3;
		}
		cur = 1;
		rep(i, 0, n) 
		{
			if(used[cur]) cur++;
			if (perm[i] == 0) 
			{
				perm[i] = cur;
				cur++;
			}
		}
	}
	else {
		cur = 1;
		rep(i, 0, (int)p0.size()) {
			perm[p0[i]] = cur;
			cur += 3;
			if(cur > n) 
				break;
		}
		cur = 2;
		rep(i, 0, (int)p1.size()) {
			perm[p1[i]] = cur;
			cur += 3;
			if(cur > n) 
				break;
		}
		cur = 3;
		rep(i, 0, n) {
			if(perm[i] == 0) {
				perm[i] = cur;
				cur += 3;
			}
		}
	}
	rep(i, 0, n) cout << perm[i] << " ";
	cout << endl;
	return 0;
}

Measured memory_bytes: 20468
#include<cstdio>
#include<cmath>

using namespace std;

const double PI=3.14159265358979323846264;
const double eps=1e-9;

struct Point{
	double x,y,z;
	Point(){}
	Point(double a,double b,double c):x(a),y(b),z(c){
//		printf("%f %f %f\n",x,y,z);
	}
};

Point getP(double e,double n)
{
	double theta=PI*e/180,phi=PI*n/180;
	double x1=cos(theta),y1=sin(theta);
	return Point(x1*cos(phi),y1*cos(phi),sin(phi));
}

double getAngle(Point p1,Point p2)
{
	double d=p1.x*p2.x+p1.y*p2.y+p1.z*p2.z;
	return acos(d);
}

double solve(double e1,double n1,double e2,double n2)
{
	Point p1=getP(e1,n1),p2=getP(e2,n2);
	double ang=getAngle(p1,p2);
//	printf("%f\n",ang);
	double res=6378.1*ang;
	return res;
}

int main()
{
	while(true)
	{
		double e1,n1,e2,n2;
		scanf("%lf%lf%lf%lf",&n1,&e1,&n2,&e2);
		if(e1==-1&&n1==-1&&e2==-1&&n2==-1) break;
		printf("%d\n",(int)(solve(e1,n1,e2,n2)+0.5));
	}
	return 0;
}

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

int main(){
    int flag=1;
    int n,x;
    int ans=0;

    cin >>n>>x;

    int d[n+2],l[n+1];
    
    d[0]=-999;
    d[1]=0;
    ans++;
    
    for (int i = 1; i <= n; i++){
        cin >>l[i];
        d[i+1] = d[i] + l[i];

        if(d[i+1] <= x)ans++;
    }
    
    cout << ans <<endl;
    //cout <<fixed<<setprecision(16)<< ans <<endl;

    //if(flag==1)cout << "Yes" <<endl;
    //else cout << "No" <<endl;
    
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int H = sc.nextInt();
        int W = sc.nextInt();
        int h = sc.nextInt();
        int w = sc.nextInt();
        System.out.println(H*W - (h*W + w*H - h*w));
    }
}

Measured memory_bytes: 23636
n=int(input())
dic={}
for i in range(n):
    s,p=input().split()
    if s in dic:
        dic[s].append([p,i+1])
    else:
        dic[s]=[[p,i+1]]
d=sorted(dic.items())
for i in range(len(d)):
    d[i]=list(d[i])
    d[i][1]=sorted(d[i][1],key=lambda x:-int(x[0]))
for i in d:
    for j in i[1]:
        print(j[1])
    

Measured memory_bytes: 3064
import java.util.*;
public class Main {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
    double a=Double.parseDouble(sc.next());
    double b=Double.parseDouble(sc.next());
    int c1=(int)(a/b);
    int c2=(int)(a%b);
    double c=a/b;
    
    System.out.print(c1+" "+c2+" ");
    System.out.printf("%.5f",c);System.out.println("");
}
}


Measured memory_bytes: 26464
#include<iostream>

int main(){
    int S, h, m, s;
    std::cin >> S;

    if(!(0 <= S <= 86400)) return 0;

    h = S / 3600;
    m = S / 60 - (h * 60);
    s = S - (m * 60) - (h * 3600);
    
    std::cout << h << ":" << m << ":" << s << std::endl;
    return 0 ;
}


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

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

        static void Method(string[] args)
        {
            int n = ReadInt();
            int[] array = ReadInts();
            int state = 0;
            int cnt = 0;
            for(int i = 1; i < n; i++)
            {
                if (array[i - 1] < array[i])
                {
                    if (state == 1)
                    {
                        cnt++;
                        state = 0;
                    }
                    else state = 2;
                }
                else if (array[i - 1] > array[i])
                {
                    if (state == 2)
                    {
                        cnt++;
                        state = 0;
                    }
                    else
                    {
                        state = 1;
                    }
                }
            }
            cnt++;
            Console.WriteLine(cnt);
        }

        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: 18528
#include <bits/stdc++.h>
using namespace std;

int main(){

  int H, W; 
  while(cin >> H >> W, H|W){
    for(int i=0; i<H; i++){
      for(int j=0; j<W; j++){
        if(i==0 || i==H-1 || j==0 || j==W-1){
          cout << '#';
        }else{
          cout << '.';
        }
      }
      cout << endl;
    }
    cout << endl;
  }

  return 0;
}

Measured memory_bytes: 2996
#include <stdio.h>
typedef long long ll;
ll dp[3000001]={1,};
const ll M = 1000000007;
ll inverse(ll x){
	ll ret = 1;
	for(int i=0;i<31;i++){
		if((M-2)&(1LL<<i)){
			ret=(ret*x)%M;
		}
		x=(x*x)%M;
	}
	return ret;
}
ll f(int a, int b){
	ll ret = dp[a+b];
	ret=(ret*inverse(dp[a]))%M;
	ret=(ret*inverse(dp[b]))%M;
	return ret;
}
ll g(int a, int b){
	return (f(a+1,b+1)+M-1)%M;
}
int main(){
	for(int i=1;i<=3000000;i++) dp[i] = (dp[i-1]*i)%M;
	int r1,c1,r2,c2;
	scanf("%d %d %d %d",&r1,&c1,&r2,&c2);
	printf("%lld",(2*M+g(r2,c2)-g(r1-1,c2)-g(r2,c1-1)+g(r1-1,c1-1))%M);
}

Measured memory_bytes: 23552
#include <stdio.h>
int last1,last2,f[100001];
int _min(int a,int b){return a<b?a:b;}
int _abs(int a){return a>0?a:-a;}

int main()
{
  int n;scanf("%d",&n);
  scanf("%d%d",&last2,&last1);
  f[1]=0;f[2]=_abs(last1-last2);
  for (int i=3;i<=n;++i)
  {
    int tmp;scanf("%d",&tmp);
    f[i]=_min(f[i-1]+_abs(tmp-last1) , f[i-2]+_abs(tmp-last2) );
    last2=last1;last1=tmp;
  }
  printf("%d\n",f[n]);
}
  

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

using namespace std;

#define REP(i, n)   for(int i = 0; i < (n); i++)
#define REPS(i, n)  for(int i = 1; i <= (n); i++)
#define RREP(i, n)  for(int i = (n)-1; i >= 0; i--)
#define RREPS(i, n) for(int i = (n); i > 0; i--)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define mp make_pair
#define mt make_tuple
#define pb push_back

using ll  = long long;
using pi  = pair<int, int>;
using pl  = pair<ll, ll>;
using vi  = vector<int>;
using vl  = vector<ll>;
using vs  = vector<string>;
using vb  = vector<bool>;
using vvi = vector<vi>;
using vvl = vector<vl>;

const int MOD = 1e9 + 7;
const int INF = 1e9 + 7;
const ll  INFL = 1e18;
const double PI = 3.141592653589793;
const double EPS = 1e-9;

template<class T> bool chmax(T &a, const T &b) { if(a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if(a > b) { a = b; return true; } return false; }

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

    string s; cin >> s;
    int n = (int)s.length();
    bool winTakahashi;
    if(s[0] == s[n-1])
    {
        if(n % 2 == 0) winTakahashi = true;
        else winTakahashi = false;
    }
    else
    {
        if(n % 2 == 0) winTakahashi = false;
        else winTakahashi = true;
    }
    if(winTakahashi) cout << "First" << endl;
    else cout << "Second" << endl;
}

Measured memory_bytes: 3768
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define ll long long
#define MAXN 2000005
using namespace std;
using namespace __gnu_pbds;  

int n,m,x;
vector<int> v;

void solve()
{
    cin>>n>>m;
    int cnt=0;
    for(int i=0;i<n;i++)
    {
        cin>>x;
        cnt+=x;
        v.pb(x);
    }
    int num=0;
    for(int i=0;i<n;i++)
    {
        if((v[i]*4*m)>=cnt) num++;
    }
    if(num>=m) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	cout.tie(NULL);
    solve();
}


Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <numeric>
#include <string>
using namespace std;
typedef long long int lli;
#define urept(soeji, start, n) for (int soeji = start; soeji < n; soeji++)
#define drept(soeji, start, n) for (int soeji = start; soeji > n; soeji--)
int main(void)
{
    int A, B, K;
    cin >> A >> B >> K;
    for (int i = 0; i < K; i++)
    {
        if (A % 2 == 1 && i % 2 == 0)
        {
            A -= 1;
            B += A / 2;
          	A /= 2;
        }
        else if (A%2==0 && i % 2 == 0)
        {
            B += A / 2;
          	A /= 2;
        }
        else if (B % 2 == 1 && i % 2 == 1)
        {
            B -= 1;
            A += B / 2;
          	B /= 2;
        }
        else if (B%2==0 && i % 2 == 1)
        {
            A += B / 2;
          	B /= 2;
        }
    }
    cout << A << " " << B << endl;
    return 0;
}

Measured memory_bytes: 256
n = int(input())
xyh = []
inf = 10 ** 10
for _ in range(n):
    x, y, h = map(int, input().split())
    xyh.append((x, y, h))
xyh.sort(key=lambda x:x[2], reverse=True)
for i in range(101):
    for j in range(101):
        x, y, h = xyh[0]
        H = h + abs(i-x) + abs(j-y)
        for x, y, h in xyh:
            if h != max(H - abs(i-x) - abs(j-y), 0):
                break
        else:
            ans = i, j, H
print(*ans)


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

using namespace std;

int main() 
{

    
    long long int k,a,b;
    cin>>k>>a>>b;
    int x=0;
    for(int i=a;i<=b;i++)
    {
        if((i%k)==0)x=1;

    }
    if(x==1)cout<<"OK"<<endl;
    else cout<<"NG"<<endl;
}

Measured memory_bytes: 3624
// #pragma GCC optimize("no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
// #pragma vector temporal
// #pragma simd
// #pragma GCC diagnostic ignored "-W"

#include<cassert>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<ctime>
#include<algorithm>
#include<iostream>
#include<iomanip>
#include<sstream>
#include<deque>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<vector>
#include<utility>
#include<functional>
#include<complex>
#include<climits>

// #include<ext/pb_ds/assoc_container.hpp>
// #include<ext/pb_ds/tree_policy.hpp>

using namespace std;
// using namespace __gnu_pbds;

#define ll long long
#define ld long double
#define X first
#define Y second
#define pb push_back
#define eb emplace_back
#define pii pair<int,int>
#define vint vector<int>
#define SS stringstream
#define PQ priority_queue
#define MS(x,v) memset((x),(v),sizeof(x))
#define RZUNI(x) sort(x.begin(),x.end()), x.resize(unique(x.begin(),x.end())-x.begin())
#define FLH fflush(stdout)
#define CPPinput ios_base::sync_with_stdio(0); cin.tie(0)
#define FIN(fname) freopen(fname,"r",stdin)
#define FOUT(fname) freopen(fname,"w",stdout)

#define tm Ovuvuevuevue
#define y1 Enyetuenwuevue
#define left Ugbemugbem
#define ws Osas
#define dec tetteterette
#define exp expexpexpexp
#define expl explexplexpl

#define YES cout<<"YES"<<endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl

#ifdef WEAK
#include"/home/edison/Coding/cpp/template/debug.cpp"
#define DEB(...) printf(__VA_ARGS__),fflush(stdout)
#define WHR() printf("%s: Line %d",__PRETTY_FUNCTION__,__LINE__),fflush(stdout)
#define LOG(...) printf("%s: Line %d ",__PRETTY_FUNCTION__,__LINE__),printf(__VA_ARGS__),fflush(stdout)
#define DEBUG 1
#define exit(x) cout<<"exit code "<<x<<endl, exit(0)
#else
#define PDE(...) ;
#define DEB(...) ;
#define WHR() ;
#define LOG(...) ;
#define DEBUG 0
#endif

#define lowbit(x) ((x)&(-(x)))

#if __cplusplus >= 201103L
#include<unordered_map>
#include<unordered_set>
#include<tuple>
#endif

void JIZZ(string output=""){cout<<output; exit(0);}

const ld PI=3.14159265358979323846264338327950288;
const ld eps=1e-13;
const ll mod=1e9+7;

int n;
set<int> st;
vector<int> a;

void dfs(int now,int p){
    for(int i=2;st.size()<n-1;++i){
        if(i%2==0 || i%3==0)st.insert(i);
    }
}

void check(int n){
    int sum=0;
    for(int i:a)sum+=i;
    int g=0;
    for(int i:a)g=__gcd(g,i);
    PDE(sum,g);
    for(int i:a){
        if(__gcd(sum-i,i)==1){
            PDE(i);
        }
    }
}

int main(){
    CPPinput;
    cin>>n;
    st.insert(3);
    dfs(0,2);
    PDE("fin dfs");
    for(int i:st)a.pb(i);
    int sum=0;
    for(int i:a)sum+=i;
    for(int i=2;i<=30000;++i){
        if(st.find(i)==st.end() && __gcd(sum,i)!=1 && __gcd(sum+i,2)==2 && __gcd(sum+i,3)==3){
            a.pb(i);
            break;
        }
    }
    for(int i:a)cout<<i<<" "; 
    cout<<endl;
    check(n);
}


Measured memory_bytes: 1536
#include <cstdio>
#include <set>
using namespace std; 
int main(){
	set<int> st;
	int n,a,count=0;
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		scanf("%d",&a);
		if(st.count(a)==0){
			st.insert(a);
			count++;
		}else{
			st.erase(a);
			count--;
		}
			
	}
	printf("%d",count);
	return 0; 
}

Measured memory_bytes: 4864
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())
#define ll long long
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;
typedef vector<unsigned int>vec;
typedef vector<vec> mat;
typedef vector<vector<int>> Graph;

const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const int INF = 1000000000;
const ll LINF = 1000000000000000000;//1e18
const ll  MOD = 1000000007;
const double PI = acos(-1.0);
const double EPS = 1e-10;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline void add(T &a, T b){a = ((a+b) % MOD + MOD) % MOD;};


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vector<pair<int,bool>> A;
    REP(i,N){
        int a; cin >> a;
        A.push_back({a,false});
    }
    REP(i,N){
        int b; cin >> b;
        A.push_back({b,true});
    }
    ll ans = 1, cnt = 0;
    sort(A.begin(),A.end());
    REP(i,2*N){
        int d = (A[i].second ? 1 : -1);
        if(cnt != 0 && (cnt > 0 != A[i].second)){
            ans = (ans * abs(cnt)) % MOD;
        }
        cnt += d;
    }
    cout << ans << endl;
}

Measured memory_bytes: 2420
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <utility>
#include <vector>
#define REP(i, n) for(int i = 0; i < (n); ++i)
typedef long long ll;
const ll MOD = 1000000007;
using namespace std;

int main(){
    cout << 100 << " " << 100 << "\n";
    char grid[100][100];
    REP(i, 50) REP(j, 100) grid[i][j] = '#';
    for(int i = 50; i < 100; ++i) REP(j, 100) grid[i][j] = '.';
    int a, b; cin >> a >> b;
    REP(i, a-1) grid[i / 50 * 2][(2*i)%100] = '.';
    REP(i, b-1) grid[i / 50 * 2 + 51][(2*i)%100] = '#';
    REP(i, 100){
        REP(j, 100) cout << grid[i][j];
        cout << "\n";
    }
    return 0;
}

Measured memory_bytes: 256
/* Simplicity and Goodness */

#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>

using namespace std;
// using namespace __gnu_pbds;
// typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;

void my_dbg() { cout << endl; }
template<typename Arg, typename... Args> void my_dbg(Arg A, Args... B) { cout << ' ' << A; my_dbg(B...); }
#define dbg(...)  cout << "(" << #__VA_ARGS__ << "):", my_dbg(__VA_ARGS__)

#define scn(n) scanf("%d", &n)
#define lscn(n) scanf("%lld", &n)
#define pri(n) printf("%d ", (int)(n))
#define prin(n) printf("%d\n", (int)(n))
#define lpri(n) printf("%lld ", n)
#define lprin(n) printf("%lld\n", n)
#define rep(i,a,b) for(int i=a; i<(int)b; i++)
#define pb push_back
#define mp make_pair
#define F first
#define S second

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;

const int inf = INT_MAX;
const int ninf = INT_MIN;
const int mod = 1e9+7;
const int maxN = 2e5+2;


void solve()
{   
    int h, w, m;
    cin >> h >> w >> m;

    map<int, int> col, row;
    set<pair<int, int>> s;

    vi maxr, maxc;

    rep(i, 0, m) {
        int x, y;
        scn(x); scn(y);

        row[x] ++;
        col[y] ++;

        s.emplace(x, y);
    }

    int cm = 0, cr = 0;

    for(auto it : row) {
        if(it.S > cr) {
            maxr.clear();
            maxr.pb(it.F);
            cr = it.S;
        }

        if(it.S == cr) {
            maxr.pb(it.F);
        }
    }

    for(auto it : col) {
        if(it.S > cm) {
            maxc.clear();
            maxc.pb(it.F);
            cm = it.S;
        }

        if(it.S == cm) {
            maxc.pb(it.F);
        }
    }

    int ans = cr + cm - 1;

    rep(i, 0, maxr.size()) {
        rep(j, 0, maxc.size()) {
            if(!s.count({maxr[i], maxc[j]})) {
                ans = cr + cm;
                break;
            }
        }
    }

    prin(ans);
}

int main()
{
    int t = 1;
    // scn(t);
    
    while(t --) {
        solve();
    }
    return 0;
}

Measured memory_bytes: 49628
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
#include <algorithm>
#include <numeric>
#include <set>
struct Point {
	int x, y;
	int square_dist(const Point that) const {
		return (x - that.x) * (x - that.x) + (y - that.y) * (y - that.y);
	}
	bool operator<(const Point that) const {
		return y != that.y ? y < that.y : x < that.x;
	}
};
int main() {
	while (true) {
		int an, bn, r; std::cin >> an >> bn >> r;  if (an == 0 && bn == 0) break;
		std::vector<Point> fighter(an), ball(bn); 
		for (auto& p : fighter) std::cin >> p.x >> p.y;
		for (auto& p : ball) std::cin >> p.x >> p.y;
		std::sort(fighter.begin(), fighter.end(), [](const Point a, const Point b) {return a.x < b.x; });
		std::sort(ball.begin(), ball.end(), [](const Point a, const Point b) {return a.x < b.x; });
		std::set<Point> set;
		int count{ 0 };
		auto left = fighter.begin();
		auto right = fighter.begin();
		for (const auto p : ball) {
			while (left != fighter.end() && left->x + 4 * r < p.x) set.erase(*left++);
			while (right != fighter.end() && right->x <= p.x + 4 * r) set.insert(*right++);
			auto end = set.upper_bound(Point{ p.x, p.y + 4 * r });
			for (auto itr = set.lower_bound(Point{ p.x, p.y - 4 * r }); itr != end; ++itr) {
				if (itr->square_dist(p) <= 16 * r * r) {
					++count;
				}
			}
		}
		std::cout << count << '\n';
	}
}


Measured memory_bytes: 4428
//Date and time of submission: 
 
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const ll N=1e5+5;
ll k,a,b;
int main() {
	ios_base::sync_with_stdio(false); 
	cin.tie(NULL);
	cin>>k>>a>>b;
	if(b-a>=k)
	{
	    cout<<"OK";
	    return 0;
	}
	for(ll i=a;i<=b;i++)
	{
	    if(i%k==0)
	    {
	        cout<<"OK";
	        return 0;
	    }
	}
	cout<<"NG";
	return 0;
}


Measured memory_bytes: 3628
#include <stdio.h>
#include<math.h>
#include <algorithm>
using namespace std;

double calc(double height,double weight){
	return fabs(22.0 - (weight/((height*height)/10000)));
}

int main(){

	int n,best_index,tmp_index;
	double best_score,tmp_score,height,weight;

	while(true){
		scanf("%d",&n);
		if(n == 0)break;

		scanf("%d %lf %lf",&best_index,&height,&weight);
		best_score = calc(height,weight);

		if(n > 1){
			for(int i = 1; i < n; i++){
				scanf("%d %lf %lf",&tmp_index,&height,&weight);
				tmp_score = calc(height,weight);
				if(tmp_score < best_score){
					best_score = tmp_score;
					best_index = tmp_index;
				}else if(fabs(tmp_score-best_score) < 0.00000001){
					if(tmp_index < best_index){
						best_index = tmp_index;
					}
				}
			}
		}

		printf("%d\n",best_index);

	}

    return 0;
}

Measured memory_bytes: 2600
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int d = sc.nextInt();
        if(a * b <= c * d){
            System.out.println(c * d);
        }else{
        System.out.println(a * b);
        }

        }        
    }



Measured memory_bytes: 22996
#include<bits/stdc++.h>
#define mem(a,x) memset(a,x,sizeof(a))
using namespace std;
typedef long long ll;
typedef pair <int,int> PAIR;
const int maxn = 2e6 + 7;
const double pi = acos(-1);
const int mod = 1e9 + 7;
const double eps = 1e-6;
const int inf = 0x3f3f3f3f;
inline void print(ll n){
	if(!n) return ;
	ll p = n%26;
	
	if(p) print(n/26);
	else print((n-26)/26),p += 26;
	
	printf("%c",(p-1)+'a');
	return ;
}

int main()
{	
	ll n;
	scanf("%lld",&n);
	print(n);
	return 0;
}

Measured memory_bytes: 3808
n = int(input())

a = [0] * 100
for i in range(n+1):
    if i % 10 == 0:
        continue
    k = int(str(i)[0]) * 10 + i % 10
    a[k] += 1

result = 0
for i in range(11,100):
    if i % 10 != 0:
        result += a[i] * a[int(str(i)[::-1])]

print(result)


Measured memory_bytes: 3060
#include <stdio.h>
#include <string.h>

int main(void) {
	char s[7] = { 0 };
	int ans = 0;

	scanf("%s", &s);
	
	for (int i = 0; i < 6; i++) {
		if (s[i] == '1') ans++;
	}

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

	return 0;
}

Measured memory_bytes: 128
#define _USE_MATH_DEFINES
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <string>
#include <vector>
#include <utility>
#include <complex>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>
#include <tuple>
#include <bitset>
#include <algorithm>
#include <random>
#include <regex>
using namespace std;
typedef long double ld;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
typedef complex<ld> compd;
#define reach(i,a)	for(auto i:a)
#define rep(i,n)	for(int i=0;i<(int)n;i++)
#define REP(i,n)	for(int i=0;i<=(int)n;i++)
#define srep(i,a,n)	for(int i=a;i<(int)n;i++)
#define SREP(i,a,n)	for(int i=a;i<=(int)n;i++)
#define rrep(i,n)	for(int i=n-1;i>=0;i--)
#define RREP(i,n)	for(int i=n;i>=0;i--)
#define all(a)	(a).begin(),(a).end()
#define mp(a,b)	make_pair(a,b)
#define mt	make_tuple
#define pb	push_back
#define fst	first
#define scn second
int bitcnt(ll x) {
	x = ((x & 0xAAAAAAAAAAAAAAAA) >> 1) + (x & 0x5555555555555555);
	x = ((x & 0xCCCCCCCCCCCCCCCC) >> 2) + (x & 0x3333333333333333);
	x = ((x & 0xF0F0F0F0F0F0F0F0) >> 4) + (x & 0x0F0F0F0F0F0F0F0F);
	x = ((x & 0xFF00FF00FF00FF00) >> 8) + (x & 0x00FF00FF00FF00FF);
	x = ((x & 0xFFFF0000FFFF0000) >> 16) + (x & 0x0000FFFF0000FFFF);
	x = ((x & 0xFFFFFFFF00000000) >> 32) + (x & 0x00000000FFFFFFFF);
	return x;
}
int bitcnt(int x) {
	x = ((x & 0xAAAAAAAA) >> 1) + (x & 0x55555555);
	x = ((x & 0xCCCCCCCC) >> 2) + (x & 0x33333333);
	x = ((x & 0xF0F0F0F0) >> 4) + (x & 0x0F0F0F0F);
	x = ((x & 0xFF00FF00) >> 8) + (x & 0x00FF00FF);
	x = ((x & 0xFFFF0000) >> 16) + (x & 0x0000FFFF);
	return x;
}
ll gcd(ll a, ll b) {
	return a%b == 0 ? b : gcd(b, a%b);
}
#define debug(x)	cout<<"case #" << x << ": " << endl
#define DEBUG 0
const ll inf = 1e18;
const ll mod = 1e9 + 7;
const ld eps = 1e-9;
const int dx[] = { 1,0,-1,0 };
const int dy[] = { 0,1,0,-1 };

int main() {
	int n;	ll l;	cin >> n >> l;
	deque<pair<ld, ld>> dq;
	ld fullt = 0, fullv = 0;
	rep(i, n) {
		ld t, v;	cin >> t >> v;
		while (!dq.empty() && dq.front().first > t) {
			ld tv = v + dq.front().second;
			ld tt = (t*v + dq.front().first*dq.front().second) / tv;
			if (tv - l > eps) {
				ld use = l - v;
				tt = (t*v + dq.front().first*use) / l;
				tv = l;
			}
			fullt -= dq.front().first*dq.front().second;
			fullv -= dq.front().second;
			dq.pop_front();	t = tt;	v = tv;
		}
		dq.push_front(mp(t, v));
		fullt += t*v;
		fullv += v;
		ld rett = fullt, retv = fullv;
		while (retv - l > eps) {
			if (fullv - dq.back().second < l) {
				ld remv = retv - l;
				rett -= remv*dq.back().first;
				retv = l;
				pair<ld,ld> tmp = dq.back();
			}
			else {
				pair<ld, ld> tmp = dq.back();	dq.pop_back();
				rett = fullt -= tmp.first*tmp.second;
				retv = fullv -= tmp.second;
			}
		}
		printf("%.15Lf\n", (ld)rett / l + eps);
	}
	return 0;
}

Measured memory_bytes: 29372
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const int INF = (1<<30);
const ll INFLL = (1ll<<60);
const ll MOD = (ll)(1e9+7);

#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	a = (a<MOD)?a:(a-MOD);
	b = (b<MOD)?b:(b-MOD);
	a += b;
	a = (a<MOD)?a:(a-MOD);
}

struct shop{
	string name;
	int point;
	int index;
};

vector<shop> v;

bool comp(shop a, shop b){
	return ((a.name==b.name)?(a.point > b.point):(a.name < b.name));
}

int main(void){
	int n,p,i;
	shop s;
	cin >> n;
	for(i=0; i<n; ++i){
		s.index = (i+1);
		cin >> s.name >> s.point;
		v.push_back(s);
	}
	sort(v.begin(),v.end(),comp);
	for(i=0; i<n; ++i){
		cout << v[i].index << endl;
	}
	return 0;
}


Measured memory_bytes: 256
// #pragma GCC optimize(3, "Ofast", "inline")
#include <bits/stdc++.h>
#define String std::string
#define fir first
#define sec second
#define mp std::make_pair
#define Pair std::pair<int, int>
#define Map std::map< int, int >
#define Vector std::vector<int>

typedef long long ll;
typedef unsigned long long ull;

const int N = 2e5 + 5;
const int MOD = 1e9 + 7;
const int dx[] = { 0, 1, -1, 0, 1, -1, 1, -1 };
const int dy[] = { 1, 0, 0, -1, 1, -1, -1, 1 };

ll n, k;
int power[25];
double ans;

int main() {
    scanf("%lld %lld", &n, &k);
    power[0] = 1;
    for (int i = 1; i <= 20; i++) power[i] = power[i - 1] * 2;
    for (ll i = 1; i <= n; i++) {
        for (int j = 0; j <= 20; j++) {
            if (i * power[j] >= k) {
                ans += pow(0.5, j);
                // printf("%lf\n", pow(0.5, j));
                break;
            }
        }
    }
    ans *= 1.0 / n;
    printf("%.13lf\n", ans);
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long

const int N=1e5+5;

int32_t main()
{
	IOS;
	int a, b, c;
	cin>>a>>b>>c;
	int ans=0;
	while(!(a%2 || b%2 || c%2))
	{
		ans++;
		int na=(b+c)/2;
		int nb=(a+c)/2;
		int nc=(a+b)/2;
		a=na, b=nb, c=nc;
		if(ans>=1000)
		{
			cout<<"-1";
			return 0;
		}
	}
	cout<<ans;
	return 0;
}


Measured memory_bytes: 256