akhauriyash/Code-Regression huggingface dataset:
#include<iostream>

using namespace std;

int main(){

	int n;
	int k;

	while(1){
		cin>>n;
		if(n==-1) break;
		for(k=1;k*4<=n;k*=4);
		if(k!=0){
			while(1){
				if(k!=0) cout<<n/k;
				else break;
				n-=(n/k)*k;
				k/=4;
			}
		}
		else cout<<"0";
		cout<<endl;
	}

}

Measured memory_bytes: 1160
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <limits.h>
#include <math.h>
int acs(const void *a, const void *b) { return *(int *)a - *(int *)b; } /* 1,2,3,4.. */
int des(const void *a, const void *b) { return *(int *)b - *(int *)a; } /* 8,7,6,5.. */
int cmp_char(const void *a, const void *b)
{
  return *(char *)a - *(char *)b;
} /* a,b,c,d.. */
int cmp_str(const void *a, const void *b)
{
  return strcmp(*(const char **)a, *(const char **)b);
} /* aaa,aab.. */
#define min(a, b) (a < b ? a : b)
#define max(a, b) (a > b ? a : b)
#define rep(i, n) for (int i = 0; i < n; i++)
typedef long long ll;

int main(void)
{
  int n, l;
  scanf("%d %d", &n, &l);

  int have = min(max(1 - l, 1), n);
  int ans = (l - 1) * n + (1 + n) * n / 2 - (l + have - 1);
  printf("%d\n", ans);
  return 0;
}


Measured memory_bytes: 128
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<sstream>
#include<vector>
using namespace std;
using uint = unsigned int;
using ll = long long;
const int M = 1e9 + 7;
const ll MLL = 1e18L + 9;
#pragma unused(M)
#pragma unused(MLL)
#ifdef LOCAL
#include"rprint.hpp"
#else
template <class... T> void printl(T&&...){ }
template <class... T> void printc(T&&...){ }
template <class... T> void prints(T&&...){ }
template <class... T> void printd(T&&...){ }
template <class... T> void printArr(T&&...){ }
#endif

int main(){
    int a, b, c;
    cin >> a >> b >> c;
    int cnt = 0;
    while(a % 2 == 0 && b % 2 == 0 && c % 2 == 0){
        prints(a, b, c);
        int na = b / 2 + c / 2, nb = a / 2 + c / 2, nc = a / 2 + b / 2;
        a = na; b = nb; c = nc;
        cnt++;
        if(a == b && b == c){
            cout << -1 << '\n';
            return 0;
        }
    }
    cout << cnt << '\n';
    return 0;
}


Measured memory_bytes: 888
#include <bits/stdc++.h>
#define LL long long

const int mod = 1e9 + 7;

LL n, a, b, fac1 = 1LL, fac2 = 1LL, fac_a = 1LL, fac_b = 1LL;

LL qpow(LL base, LL power) {
	LL res = 1LL % mod;
	while (power) {
		if (power & 1) res = res * base % mod;
		base = base * base % mod;
		power >>= 1;
	}
	return res;
}

LL inv(LL x) { return qpow(x, mod - 2); }

int main() {
	scanf("%lld %lld %lld", &n, &a, &b);
	LL pre = (qpow(2, n) + mod - 1) % mod;
	for(LL i = n; i >= n - a + 1; --i) {
		fac1 = fac1 * i % mod;
	}
	for(LL i = 1; i <= a; ++i) {
		fac_a = fac_a * i % mod;
	}
	fac1 = fac1 * inv(fac_a) % mod;
	for(LL i = n; i >= n - b + 1; --i) {
		fac2 = fac2 * i % mod;
	}
	for(LL i = 1; i <= b; ++i) {
		fac_b = fac_b * i % mod;
	}
	fac2 = fac2 * inv(fac_b) % mod;
	
	printf("%lld", ((pre - fac1 - fac2) % mod + mod) % mod);
	
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <climits>
#define ll long long int
#define endl "\n"

using namespace std;

int main(){
    int N, K;
    cin>>N>>K;
    int arr[N+1];
    for(int i = 1;i<N+1;i++)
        cin>>arr[i];
    int dp[N+1];
    dp[0] = 0;
    dp[1] = 0;
    for(int i = 2;i<N+1;i++){
        int miner = INT_MAX;
        for(int j = 1;j<=K;j++){
            if(i-j>=1)
                miner = min(miner, dp[i-j]+abs(arr[i-j]-arr[i]));
            else
                break;
        }
        dp[i] = miner;
    }
    cout<<dp[N]<<endl;
    return 0;
}

Measured memory_bytes: 1024
#include<stdio.h>
#include<stdlib.h>
int main()
{
    int n,m,i;
    scanf("%d",&n);
    scanf("%d",&m);
    if(n>=m)
        for(i=0;i<n;i++)
            printf("%d",m);
    else
        for(i=0;i<m;i++)
            printf("%d",n);
}

Measured memory_bytes: 128
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ACB45A
{
    class Program
    {
        static void Main(string[] args)
        {
            int a, b, h, X;

            //            var word = Console.ReadLine().Split(' ');
            //            a = int.Parse(word[0]);
            //            b = int.Parse(word[1]);
            //            h = int.Parse(word[2]);

            a = int.Parse(Console.ReadLine());
            b = int.Parse(Console.ReadLine());
            h = int.Parse(Console.ReadLine());

            X = (a + b) * h / 2;
            {
                Console.WriteLine(X);
            }
            Console.ReadKey();

        }
    }
}


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


int main()
{
    long long n,h;
    std::cin >> n >> h;
    std::vector<std::pair<long long,long long>> a(n);
    std::pair<long long,long long> kiru;
    for(long long i = 0; i < n; i++)std::cin >> a[i].first >> a[i].second;
    std::sort(a.begin(),a.end());
    kiru = a.back(); //a.pop_back(); n--;
    long long cnt = 0;
    for(long long i = 0; i < n; i++)std::swap(a[i].first, a[i].second);
    std::sort(a.begin(),a.end(),std::greater<std::pair<long long,long long>>());

    for(long long i = 0; a[i].first > kiru.first && h > 0 && i < n; i++){
        h -= a[i].first;
        cnt++;
    }
    std::cerr << kiru.first << " : " << kiru.second << std::endl;

    if(h > 0)
    cnt += std::max(0LL,(h + kiru.first - 1) / kiru.first);
    
    std::cout << cnt << std::endl;
}

Measured memory_bytes: 1792
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

string solve(string s)
{
    int n = s.size();
    for(;;){
        for(int i=0; i<n; ++i){
            if('a' <= s[i] && s[i] <= 'z'){
                if(s[i] == 'z')
                    s[i] = 'a';
                else
                    ++ s[i];
            }
        }
        istringstream iss(s);
        string s1;
        while(iss >> s1){
            if(s1 == "the" || s1 == "this" || s1 == "that")
                return s;
        }
    }
}

int main()
{
    for(;;){
        string s;
        getline(cin, s);
        if(s == "")
            return 0;

        cout << solve(s) << endl;
    }
}

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

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

  bool ans = true;
  sort(a.begin(), a.end());
  for(int i=0; i<n; i++){
    if(a[i] == a[i+1]) ans = false;
  }

  if(ans) cout << "YES" << endl;
  else cout << "NO" << endl;
  
  return 0;
}

Measured memory_bytes: 1024
#include<iostream>

using namespace std;

int main(){
    long long n, k, x, y;
    cin >> n >> k >> x >> y;

    long long ans = 0;
    if(n - k > 0){
    ans = k * x;
    ans += (n-k) * y;
    cout << ans << endl;
    return 0;
    }

    ans = n * x;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 888
#include <bits/stdc++.h>
#define REP(i,a,b) for(int i=(a);i<(b);i++)
#define RREP(i,a,b) for(int i=(a);i>=(b);i--)
#define pq priority_queue
#define P pair<int,int>
#define P2 pair<int,P>
#define P3 pair<int,P2>
typedef long long ll; typedef long double ld;
using namespace std;
const int INF=1e9, MOD=1e9+7, around[]={0,1,1,-1,-1,0,-1,1,0,0};
const ll LINF=1e18;
const ld PI=abs(acos(-1));
int n,a[55];

int main(){
	cin >> n;
	REP(i,0,n) cin >> a[i]; int ma=0;
	REP(i,0,n) if(abs(a[i])>abs(a[ma])) ma=i;
	
	cout << 2*n-1 << endl;
	REP(i,0,n) cout << ma+1 << " " << i+1 << endl;
	if(a[ma]>0){
		REP(i,1,n) cout << i << " " << i+1 << endl;
	}else{
		RREP(i,n,2) cout << i << " " << i-1 << endl;
	}
	return 0;
}


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


using namespace std;

#define int long long

void solve(){
    int n_sum=0;
    string n;
    cin>>n;
    for(int i=0;i<n.size();i++){
        n_sum+=(int)(n[i]-'0');
    }
    // cout<<n_sum<<endl;
    if(n_sum%9==0){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }

}


signed main(){
    int t=1;
    for (int i = 0; i < t; i++)
    {
        solve();
    }
    
    return 0;
}

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

template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return 1; } return 0;}
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return 1; } return 0;}

int main()
{
    int N;
    cin >> N;
    vector<ll> a(N);
    rep(i, N) cin >> a[i];

    int num_minus = 0;
    ll mi = 1LL<<60;
    ll sum = 0;

    for (int i = 0; i < N; i++) {
        if (a[i] < 0) num_minus++;
        chmin(mi, abs(a[i]));
        sum += abs(a[i]);
    }
    if (num_minus % 2 == 0) cout << sum << endl;
    else cout << sum - 2 * mi << endl;

    return 0;
}

Measured memory_bytes: 1024
#include<stdio.h>
#define max 250

int main(){
    int i,h[max],n;
      
    scanf("%d",&n);
    
    for(i=1;i<=n;i++) {
    	scanf("%d",&h[i]);
      }
      
    for(i=1;i<=n;i++){
        printf("node %d: key = %d, ",i,h[i]);
        
        if(i/2 != 0) {
        	printf("parent key = %d, ",h[i/2]);
        }
        if(2*i <= n){
        	 printf("left key = %d, ",h[2*i]);
        }
        if((2*i+1) <= n) {
        	printf("right key = %d, ",h[2*i+1]);
        }
        printf("\n");
        }
    return 0;
    }
   
    

Measured memory_bytes: 600
#include <iostream>
#include <algorithm>
#include <string>

using namespace std;

int main()
{
	string S;
	string S1;
	string S2;
	cin >> S;
	S1 = S;
	S2 = S;
	int answer1 = 0;
	int answer2 = 0;

		for(int j = 0; j < S1.size() - 1; j++)
		{
			if(S1.at(j) == S1.at(j + 1))
			{
				if(S1.at(j + 1) == '0')
				{
					S1.at(j + 1) = '1';
				}
				else
				{
					S1.at(j + 1) = '0';
				}
				answer1++;
			}
		}
	

		for(int j = S2.size()-1; j > 0; j--)
		{
			if(S2.at(j) == S2.at(j - 1))
			{

				if(S2.at(j - 1) == '0')
				{
					S2.at(j - 1) = '1';
				}
				else
				{
					S2.at(j - 1) = '0';
				}
				answer2++;
			}
	}

	cout << min(answer1, answer2) << endl;

	return 0;
}

Measured memory_bytes: 512
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include<set>
#include<map>
using namespace std;


int main() {
    int a, b, h;
    cin >> a >> b >> h;
    cout << (a+b)*h/2;
    cout << endl;
}


Measured memory_bytes: 256
import std.stdio;
import std.algorithm;
import std.string;
import std.range;
import std.array;
import std.conv;
import std.complex;
import std.math;
import std.ascii;
import std.bigint;
import std.container;
import std.typecons;

auto readInts() {
	return array(map!(to!int)(readln().strip().split()));
}
auto readInt() {
	return readInts()[0];
}
auto readLongs() {
	return array(map!(to!long)(readln().strip().split()));
}
auto readLong() {
	return readLongs()[0];
}

const real eps = 1e-10;

char decode(char c, int n) {
	while(n > 0) {
		switch(c) {
			case 'a':
				c = 'Z';
				break;
			case 'A':
				c = 'z';
				break;
			default:
				--c;
		}
		--n;
	}
	return c;
}

void main(){
	while(true) {
		auto n = readInt;
		if(n == 0) return;
		auto k = readInts;
		auto s = readln.chomp;
		foreach(i, c; s) {
			write(decode(c, k[i%n]));
		}
		writeln();
	}
}

Measured memory_bytes: 2508
#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  vector<int> mlt(4, 0);
  for (int i = 0; i < 3; i++) {
    int a, b;
    cin >> a >> b;
    mlt[--a]++;
    mlt[--b]++;
  }
  for (int i = 0; i < 4; i++) {
    if (mlt[i] == 3) {
      cout << "NO" << '\n';
      return 0;
    }
  }
  cout << "YES" << '\n';
  return 0;
}

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

int main() {
    int N, W, H;
    cin >> N >> H >> W;
    vector<int> vh(H + 1), vw(W + 1);
    for (int i = 0; i < N; i++) {
        int x, y, w;
        cin >> x >> y >> w;
        if (x - w < 0) vh[0]++;
        else vh[x - w]++;
        if (x + w > H) vh[H]--;
        else vh[x + w]--;
        if (y - w < 0) vw[0]++;
        else vw[y - w]++;
        if (y + w > W) vw[W]--;
        else vw[y + w]--;
    }

    bool res1 = true;
    for (int i = 0; res1 && i < H; i++) {
        if (vh[i] <= 0) res1 = false;
        else {
            if (i + 1 < H) vh[i + 1] += vh[i];
        }
    }
    bool res2 = true;
    for (int i = 0; res2 && i < W; i++) {
        if (vw[i] <= 0) res2 = false;
        else {
            if (i + 1 < W) vw[i + 1] += vw[i];
        }
    }

    cout << (res1 | res2 ? "Yes" : "No") << endl;

    return 0;
}

Measured memory_bytes: 3604
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstring>
#include<string>

using namespace std;
typedef long long ll; 
#define me(a,b) memset(a,b,sizeof(a))
char s[300];
int main()
{
	int n,i,j;
	string a[200005];
	cin>>n;
	int w=0;
	for(i=1;i<=n;i++)
	cin>>a[i];
	sort(a+1,a+1+n);
	int sum=1,maxx=1;
	i=1;j=1;
	while(1)
	{
		if(j>n)break;
		
		if(a[i]==a[j])
		{
			j++;
			
		}
		else 
		{
			maxx=max(maxx,j-i);
			i=j;
		}
	}
	maxx=max(j-i,maxx);
	sum=1;
	i=1;j=1;
	while(1)
	{
		if(j>n)break;
		
		if(a[i]==a[j])
		{
			j++;
			
		}
		else 
		{
			if(j-i==maxx)cout<<a[i]<<endl;
			i=j;
		}
	}if(j-i==maxx)cout<<a[i];
	return 0;
	
}

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

bool is_power_of_10(int n) {
  while (n > 1) {
    if (n % 10 != 0)
      return false;
    else {
      n /= 10;
    }
  }
  return true;
}

int main() {
  int N;
  cin >> N;
  if (is_power_of_10(N))
    cout << 10 << endl;
  else {
    int n = N;
    int sum = 0;
    while (n > 0) {
      sum += n % 10;
      n /= 10;
    }
    cout << sum << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using vi=vector<int>;
using vvi=vector<vi>;
using vs=vector<string>;
void bulk(){}template<class H,class...T>void bulk(H&h,T&...t){cin>>h;bulk(t...);}
#define rep(i,n) for(int i=0;i<n;i++)
#define all(i) i.begin(),i.end()
int main(void){
    int n;
    cin>>n;
    vector<int> shop(n,0);
    vvi c(n,vi(11));
    for(auto &i:shop){
        rep(j,10){
            int t;cin>>t;
            i=i*2+t;
        }
    }
    for(auto &l:c)for(auto &i:l)cin>>i;
    int ans=-1000000000;
    for(int i=1;i<1024;i++){
        int cost=0;
        rep(j,n){
            cost+=c[j][__builtin_popcount(i&shop[j])];
        }
        ans=max(ans,cost);
    }
    cout<<ans;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b) - 1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)

#define PB push_back
#define INF INT_MAX/3
#define ALL(a) (a).begin(),(a).end()
#define CLR(a) memset(a,0,sizeof(a))

typedef long long int ll;

using namespace std;

int main(){
    while(true){
	int n;
	cin >> n;
	if(n == 0) break;
	ll ans = 0;
	int m;
	REP(i,n){
	    int x,y,h,w;
	    cin >> x >> y >> h >> w;
	    int s = x + y + h;
	    m = 0;
	    if( s > 160) continue;
	    else if(s > 140) m = 1600;
	    else if(s > 120)  m = 1400;
	    else if(s > 100) m = 1200;
	    else if(s > 80) m = 1000;
	    else if(s > 60) m = 800;
	    else m = 600;

	    if(w > 25) continue;
	    else if(w > 20) m = max(m,1600);
	    else if(w > 15) m = max(m,1400);
	    else if(w > 10) m = max(m,1200);
	    else if(w > 5)  m = max(m,1000);
	    else if(w > 2)  m = max(m,800);
	    else m = max(m,600);
	    ans += m;
	}
	cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 1156
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
#define repr(i, n) for (int i = (int)n - 1; i >= 0; --i)
#define ALL(a) (a).begin(), (a).end()
const ll mod = 1e9 + 7;

int main() {
  int n, p = 200001, ans = 0;
  cin >> n;
  vector<int> a(n);
  rep(i, n) cin >> a[i];
  rep(i, n) {
    if (a[i] < p) {
      ans++;
      p = a[i];
    } else {
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define LL long long
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPA(i,n) for(int i=1;i<(n);++i)
#define PII pair<int,int>
#define PLI pair<long long, int>
#define PLL pair<long long, long long>
#define PDD pair<double, double>
#define MOD ((int)1e9 + 7)
#define INF ((int)1e9)
#define INFLL ((LL)1e18)
#define ALL(x) (x).begin(),(x).end()
#define ctoi(x) (x - 'a') 
#define CTOI(x) (x - 'A')
#define BIT(x) (1 << (x))
using namespace std;

LL modinv(LL a){
    LL b = MOD, u = 1, v = 0;
    while(b){
        LL t = a / b;
        a -= t * b;swap(a, b);
        u -= t * v;swap(u, v);
    }
    u%=MOD;
    if(u < 0) u += MOD;
    return u;

}

LL exp(LL a, LL b){
    LL res = 1;
    LL sum = a;
    while(b){
        if(b&1)res = (res * sum);
        sum = (sum * sum);
        b>>=1;
    }
    return res;
}

double exp(double a, LL b){
    double res = 1;
    double sum = a;
    while(b){
        if(b&1)res = (res * sum);
        sum = (sum * sum);
        b>>=1;
    }
    return res;
}

signed  main(){
    int A, B;
    cin >> A >> B;
    cout << (B%A?B-A:A+B) << endl;
    return 0;
}


Measured memory_bytes: 256
#include "stdio.h"

int main()
{
	int x,y,z;
	scanf("%d %d",&x,&y);
	z = (x*y) % 2;
	if (z == 0)
	{
		printf("Even");
	}
	else
	{
		printf("Odd");
	}

	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <utility>
#include <functional>

using namespace std;

int main() {
	int a, b, c;

	cin >> a >> b >> c;
	if (a <= c && c <= b) {
		cout << "Yes\n";
	}
	else {
		cout << "No\n";
	}

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<LL,LL> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const LL mod=1000000007;
const LL LINF=1LL<<61;
const int INF=1<<30;
int dx[]={1,0,-1,0,1,-1,1,-1};
int dy[]={0,1,0,-1,1,-1,-1,1};

string n;
LL dp[1000001][2];
LL rec(int k,bool f){
    if(k < 0){
        return f;
    }
    if(~dp[k][f]) return dp[k][f];
    if(f){
        if(n[k] == '9'){
            return dp[k][f] = rec(k-1, 1);
        }
        else{
            return dp[k][f] = min(rec(k-1, 0) + n[k] - '0' + 1, rec(k-1, 1) + 9 - (n[k] - '0'));
        }
    }
    else{
        return dp[k][f] = min(rec(k-1, 0) + n[k] - '0', rec(k-1, 1) + 10 - (n[k] - '0'));
    }
}


int main(){
    memset(dp,-1,sizeof(dp));
    cin >> n;
    auto p = n;
    cout << rec(n.length() - 1,0) << endl;
    return 0;
}


Measured memory_bytes: 64772
x,n = map(int,input().split(' '))

if n == 0:
    p = input()
    print(x)
else:
    p = [int(x) for x in input().split(' ')]
    s = set([x for x in range(102)])
    s -= set(p)
    for i in range(0,51):
        if x-i in s:
            print(x-i)
            break
        if x+i in s:
            print(x+i)
            break

Measured memory_bytes: 9212
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<cmath>
#include<queue>
#include<stack>
#include<map>

using namespace std;

template<typename A, typename B> bool chmin(A &a, const B &b){ return b < a && (a = b, true); }
template<typename A, typename B> bool chmax(A &a, const B &b){ return a < b && (a = b, true); }

int main(){
  int a,b,c,d;
  cin >> a >> b >> c >> d;
  if (a + b > c + d){
    cout << "Left\n";
  }
  if (a + b == c + d){
    cout << "Balanced\n";
  }
  if (a + b < c + d){
    cout << "Right\n";
  }
  return 0;
}

Measured memory_bytes: 256
n=int(input())
s=list(input())
q=int(input())

def ctoi(c):
  return ord(c)-97
class Bit:
  def __init__(self, n):
    self.size = n
    self.tree = [[0]*(n+1) for _ in range(26)]
  def query(self,a,i):
    r = 0
    while i > 0:
      r += self.tree[a][i]
      i -= i & -i
    return r
  def update(self,i,a,x):
    while i<=n:
      self.tree[a][i]+=x
      i+=i&(-i)
bi=Bit(n)
for i in range(n):
  bi.update(i+1,ctoi(s[i]),1)
  
for _ in range(q):
  a,b,c=input().split()
  a,b=int(a),int(b)
  if a==1 and s[b-1]!=c:
    bi.update(b,ctoi(s[b-1]),-1)
    bi.update(b,ctoi(c),1)
    s[b-1]=c
  elif a==2:
    c=int(c)
    right=[bi.query(i,c) for i in range(26)]
    left=[bi.query(i,b-1) for i in range(26)]
    ans=0
    for r,l in zip(right,left):
      if r-l>0:
        ans+=1
    print(ans)

Measured memory_bytes: 166940
#include <iostream>
using namespace std;
const int HW_MAX = 50;
int main (void) {
    int H;
    int W;
    string S[HW_MAX];

    cin >> H >> W;
    for (int i = 0; i < H; i++) cin >> S[i];

    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            if (S[i][j] == '#') continue;
            int cnt = 0;
            for (int x = -1; x <= 1; x++) {
                for (int y = -1; y <= 1; y++) {
                    int nx = j + x;
                    int ny = i + y;
                    if (x == 0 && y == 0) continue;
                    if (0 <= nx && nx < W && 0 <= ny && ny < H) {
                        if (S[ny][nx] == '#') cnt++;
                    }
                }
            }
            S[i][j] = cnt + '0';
        }
    }

    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            cout << S[i][j];
        }
        cout << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<map>
#include<algorithm>
#include<string>
using namespace std;
typedef long long ll;

int main()
{
    ll n ,counter=0;
    cin >> n;
    vector<ll> l(n);
    for(int i=0; i<n; i++){
        cin >> l[i];
    }
    sort(l.begin(), l.end());
    for(int i=0; i<n; i++){
        for(int j=0; j<i; j++){
            ll r = lower_bound(l.begin(), l.end(), l[i]+l[j]) - l.begin();
            ll l = i+1;
            counter += r-l;
          	//cout << counter << endl; 
        }
    }
    cout << counter << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Deque;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Queue;
import java.util.Scanner;
import java.util.Set;

public class Main {

	public static void main(String[] args) {
		execute20_3();
	}
	
	private static void execute20_3() {
		try (Scanner sc = new Scanner(System.in)) {
			int n = sc.nextInt();
			int x = sc.nextInt();
			int t = sc.nextInt();
				System.out.println((n+x-1)/x*t);
		}
	}
}

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

int main(){
  int n;
  cin >>n;
  vector<int> a(n);
  rep(i,n) cin >>a[i];
  int sum = 0;
  rep(i,n) sum += a[i];
  int curMin = 1e8;
  int ans = 0;
  rep(i,n){
    int cur = abs(sum-n*a[i]);
    if(curMin>cur){
      curMin = cur;
      ans = i;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<set>
#include<string>
#include<cstring>
using namespace std;

int main()
{
	char r1[26], r2[26];
	string s, t;
	cin >> s >> t;

	for (int i = 0; i < 26; i++) {
		r1[i] = '*';
		r2[i] = '*';
	}

	for (int i = 0; i < s.size(); i++) {
		if (r1[s[i] - 'a'] != '*') {
			if (r1[s[i] - 'a'] != t[i]) {
				cout << "No" << endl;
				return 0;
			}
		}
		if (r2[t[i] - 'a'] != '*') {
			if (r2[t[i] - 'a'] != s[i]) {
				cout << "No" << endl;
				return 0;
			}
		}
		if (r1[s[i] - 'a'] == '*') {
			r1[s[i] - 'a'] = t[i];
		}
		if (r2[t[i] - 'a'] == '*') {
			r2[t[i] - 'a'] = s[i];
		}
	}
	cout << "Yes" << endl;
}

Measured memory_bytes: 776
#!/usr/bin/env python3

from itertools import accumulate
n = int(input())
s = [0 if i == "E" else 1 for i in str(input())]

s_cumsum = list(accumulate(s))
s_cumsum_rev = list(accumulate(reversed(s)))

ans = 10**10

for i in range(1, n-1):

    a_1 = s_cumsum[i-1]
    a_0 = i - a_1
    b_1 = s_cumsum_rev[-2-i]
    b_0 = (n-1-i) - b_1

    # print(a_1+b_0)
    ans = min(ans, a_1+b_0)

ans = min(ans, s_cumsum[-2])
ans = min(ans, (n-1)-s_cumsum_rev[-2])
print(ans)


Measured memory_bytes: 35232
H,W = map(int,input().split())
S = ['#' * (W+2)]
for _ in range(H):
    S.append('#' + input() + '#')
S.append('#' * (W+2))

h = [[0] * (W+1) for _ in range(H+1)]
v = [[0] * (W+1) for _ in range(H+1)]

for y in range(1, H+2):
    l = 0
    r = 0
    for x in range(1, W+2):
        if S[y][x] == '.':
            if S[y][x-1] == '#':
                l = x
            r = x
        else:
            if S[y][x-1] == '.':
                for x1 in range(l,r+1):
                    h[y][x1] = r - l + 1

for x in range(1, W+2):
    t = 0
    b = 0
    for y in range(1, H+2):
        if S[y][x] == '.':
            if S[y-1][x] == '#':
                t = y
            b = y
        else:
            if S[y-1][x] == '.':
                for y1 in range(t,b+1):
                    v[y1][x] = b - t + 1

ans = 0
for x in range(1, W+1):
    for y in range(1, H+1):
        ans = max(ans, h[y][x]+v[y][x]-1)

print(ans)

Measured memory_bytes: 123992
#include<bits/stdc++.h>
 
#define rep(i,n) for(ll i = 0;i < n;++i)
#define all(v) v.begin(),v.end()
using namespace std;
using ll = long long;
typedef pair<int,int> P;
 
const int INF = 1001001001;
const long double PI = (acos(-1));
const int mod = 1e9+7;
const int vx[6] = {0,1,0,-1,1,-1};
const int vy[6] = {1,0,-1,0,1,1};




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

    ll n;
    cin >> n;
    vector<ll> a(n);
    ll sum = 0;
    rep(i,n){
        cin >> a[i];
    }
    rep(i,60){
        ll x = 0;
        rep(j,n){
            if(a[j]>>i & 1) x++;
        }
        ll ans = x*(n-x)%mod;
        rep(j,i){
            ans = ans*2 % mod;
        }
        sum += ans;
        sum %= mod;
    }
    cout << sum << endl;
    cout << endl;
    return 0;
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define FOR(i,l,r) for(i=l;i<r;i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(x) x.begin(),x.end()
#define P pair<ll,ll>
#define F first
#define S second
#define VEC vector
#define V VEC<ll>
ll solve(V&h,ll L,ll R){
  if(L==R)return 0;
  ll M=L,i,w;
  FOR(i,L,R)if(h.at(i)<h.at(M))M=i;
  w=h.at(M);
  FOR(i,L,R)h.at(i)-=w;
  return w+solve(h,L,M)+solve(h,M+1,R);
}
signed main(){
  ll N,i,ans=0;cin>>N;
  V h(N);
  REP(i,N)cin>>h.at(i);  
  cout<<solve(h,0,N)<<endl;
  return 0;
}

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

using namespace std;

#define _for(i,j,N) for(int i = (j);i < (N);i++)
#define _rep(i,j,N) for(int i = (j);i <= (N);i++)
#define ALL(x) x.begin(),x.end()
#define pb push_back
#define mk make_pair

typedef long long LL;
typedef pair<int,int> Interval;

template<typename T>
ostream& operator<<(ostream& os,const vector<T>& v) {
    _for(i,0,v.size()) os << v[i] << " ";
    return os;
}

template<typename T>
ostream& operator<<(ostream& os,const set<T>& v){
    for(typename set<T>::iterator it = v.begin();it != v.end();it++)
    os << *it <<" ";
    return os;
}

template<typename T1,typename T2>
ostream& operator<<(ostream& os,const pair<T1,T2>& v){
    os << v.first <<" "<<v.second<<endl;
    return os;
}

LL N,X;

int main()
{
    LL res = 1;
    LL d = 0;
    cin >> N >> X;
    _for(i,0,N){
        LL dis;
        cin >> dis;
        d += dis;
        if(d <= X) res++;
    }

    cout << res << endl;

    return 0;
}


Measured memory_bytes: 256
// https://ei1333.github.io/luzhiled/
// http://beet-aizu.hatenablog.com/entry/2017/01/04/113233
// http://www.prefield.com/algorithm/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
using vd = vector<ld>;
using vs = vector<string>;
using vb = vector<bool>;
using vvl = vector<vector<ll>>;
using vvd = vector<vector<ld>>;
using vvs = vector<vector<string>>;
using vvb = vector<vector<bool>>;
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
template<class T> using vc = vector<T>;
template<class T> using vvc = vector<vector<T>>;
using Graph = vector<vector<ll>>;
const ll INF = 1LL << 60;
void init() {cin.tie(0);ios::sync_with_stdio(false);cout << fixed << setprecision(15);}
const ll tl= 1'000'000'007;
#define REP(i, n) for (ll i = 0; i < n; i++)
#define REREP(i, n) for (ll i = n; i >= 0; i--)
#define FOR(i, a, n) for (ll i = a; i < n; i++)
#define REFOR(i, n, a) for (ll i = n; i >= a; i--)
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() ) //被り削除
#define debug cout << "line : " << __LINE__ << " debug" << endl;
#define ini(...) int __VA_ARGS__; in(__VA_ARGS__)
#define inl(...) long long __VA_ARGS__; in(__VA_ARGS__)
#define ind(...) long double __VA_ARGS__; in(__VA_ARGS__)
#define ins(...) string __VA_ARGS__; in(__VA_ARGS__)
#define inc(...) char __VA_ARGS__; in(__VA_ARGS__)
void in(){} template <typename T,class... U> void in(T &t,U &...u){ cin >> t; in(u...);}
void out(){cout << endl;} template <typename T,class... U> void out(const T &t,const U &...u){ cout << t; if(sizeof...(u)) cout << " "; out(u...);}
template<typename T>void die(T x){out(x); exit(0);}
#define in1(A) REP(i,A.size()) in(A[i]);
#define in2(A,B) REP(i,A.size()) in(A[i],B[i]);
#define in3(s,t,u) REP(i,sz(s)){in(s[i] , t[i] , u[i]);}
#define in4(s,t,u,v) REP(i,sz(s)){in(s[i] , t[i] , u[i] , v[i]);}
#define each(x,v) for(auto& x : v)
#define all(v) (v).begin(),(v).end()
#define sz(v) ((int)(v).size())
struct Point{ ld x,y; };
ld dist(Point a, Point b){return sqrt(abs(a.x-b.x)*abs(a.x-b.x)+abs(a.y-b.y)*abs(a.y-b.y));} // ２点間の距離 
ll gcd(ll a, ll b) { return b != 0 ? gcd(b, a % b) : a; }
ll lcm(ll a,ll b){ return a / gcd(a,b) * b;} 
ll fact(ll n){ if(n < 2) return 1; return (n * fact(n-1))%tl; } //階乗
inline ll updiv(ll a,ll b){ return (a + b - 1) / b; } //切り上げ
template<typename T,typename U>ll ceil(T a,U b){return (a + b - 1) / b;}
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }
//-------------------------------------------------------------------------------------------------
int main(){
    init();
    inl(n,m);
    // vl A(n); in1(A); 
    
    out((n-1)*(m-1));
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,ini,n) for(int i=ini;i<n;i++)
#define _rep(i,ini,n) for(int i=ini;i>=n;i--)
#define ToEnd(a) a.begin(),a.end()
uint64_t MOD=1000000007;

int main(){
    int N; cin>>N;
    map<int,int> mp;
    rep(n,0,N){
        int a; cin>>a;
        mp[a]++;
    }

    int ans=0;
    for(auto m:mp){
        if(m.first>m.second) ans+=m.second;
        else ans+=m.second-m.first;
    }

    cout<<ans<<endl;
}

Measured memory_bytes: 4736
#include <iostream>
#include <vector>
#include <limits>

using namespace std;

int main(){
    vector <int>v(5);
    for(size_t i = 0; i < v.size(); i++)
    {
        cin >> v[i];
    }
    
    int best_min = numeric_limits<int>::max();
    int ans = 0;
    for(size_t i = 0; i < 5; i++)
    {
        for(size_t j = 0; j < 5; j++)
        {
            if(i == j || v[j] % 10 == 0) ans += v[j];
            else ans += v[j] + 10 - (v[j] % 10);
        }
        best_min = min(best_min, ans);
        ans = 0;
    }
    cout << best_min << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define show(x)  cerr << #x << " = " << (x) << endl;
//const int INF = 1e8;
using namespace std;

struct RAQ{
	using T = long long;
	T operator()(const T &a, const T &b) { return a + b; };
	static constexpr T identity() { return 0; }
};

template<class Monoid>
class rangeAddQuery{
	private:
		using T = typename Monoid::T;
		Monoid op;
		const int n;
		vector<T> dat, lazy;
		T query(int a, int b, int k, int l, int r){
			if(b <= l || r <= a) return op.identity();
			else if(a <= l && r <= b) return dat[k] * (r - l) + lazy[k];
			else{
				T res = (min(b,r) - max(a,l)) * dat[k];
				res += query(a, b, k * 2, l, (l + r) / 2);
				res += query(a, b, k * 2 + 1, (l + r) / 2, r);
				return res;
			}
		}
		void add(int a, int b, int k, int l, int r, T x){
			if(a <= l && r <= b){
				dat[k] += x;
			}else if(l < b && a < r){
				lazy[k] += (min(b,r) - max(a,l)) * x;
				add(a, b, k * 2, l, (l + r) / 2, x);
				add(a, b, k * 2 + 1, (l + r) / 2, r, x);
			
			}
		}
		int power(int n){
			int res = 1;
			while(n >= res) res*=2;
			return res;
		}
	public:
		rangeAddQuery(int n) : n(power(n)), dat(4 * n, op.identity()), lazy(4 * n, op.identity()) {}
		rangeAddQuery(const vector<T> &v) : n(v.size()), dat(4 * n), lazy(4 * n, op.identity()){
			copy(begin(v), end(v), begin(dat) + n);
			for(int i = n - 1; i > 0; i--) dat[i] = op(dat[2 * i], dat[2 * i + 1]);
		}
		T query(int a, int b){ return query(a,b,1,0,n); }
		void add(int s, int t, T x){ add(s, t, 1, 0, n, x); }
		int get(int a){ return query(a, a + 1); };
		void out(){
			rep(i,n * 2){
				cout << dat[i + 1] << ' ';
			}
			cout << endl;
		}
};

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

	rangeAddQuery<RAQ> seg(n);
	rep(i,q){
		int com;
		cin >> com;
		if(not com){
			int s, t, x;
			cin >> s >> t >> x;
			//cout << s << ' ' << t << endl;
			seg.add(s - 1, t, x);
		}else{
			int s, t;
			cin >> s >> t;
			assert(seg.query(s - 1, t) >= 0);
			cout << seg.query(s - 1, t) << endl;
		}
		//seg.out();
	}
}



Measured memory_bytes: 9176
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) debug(x) debug(y);
#define repn(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, a) for(int i = 0; i < (int)(a); i++)
#define all(v) v.begin(), v.end() 
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define sq(x) ((x) * (x))
const int MOD = 1e9 + 7;

template<class T> T gcd(T a, T b){ return ((b == 0) ? a : gcd(b, a % b)); }

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	//freopen("input.in", "r", stdin);
	//freopen("output.out", "w", stdout);
	int n;
	ll k;
	cin >> n >> k;
	k--;
	vi a(n);
	rep(i, n) cin >> a[i];
	ll ans = 0;
	rep(i, n) rep(j, n) if(a[i] > a[j]){
		int f = (i < j);
		if(f) k++;
		(ans += (ll)(k * (k + 1)) / 2) %= MOD;
		if(f) k--;
	}
	cout << ans % MOD << endl;
	return 0;
}
/*
Things to look out for:
	- Integer overflows
	- Array bounds
	- Special cases
Be careful!
*/


Measured memory_bytes: 256
temp = []
l = []
a, b, k = map(int, input().split())

for i in range(1, a + 1):
    if a % i == 0:
        temp.append(i)

for i in range(1, b + 1):
    if b % i == 0 and i in temp:
        l.append(i)

print(l[k * -1])

Measured memory_bytes: 9184
#include <iostream>
#include <iomanip>
using namespace std;
using ll = long long;

int main(){
    int N;
    long double hen,sum;
    cin >> N;
    hen = N / 3.0000000000000000000000;
    
    sum = hen*hen*hen;
    cout << fixed << setprecision(12) << sum << endl;
    return 0;
}

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

#define fr(i,n) for(int i = 0; i<n; i++)
#define sz(v) (int)(v.size())
#define prin(a) cout << #a << " = " << a << endl
#define all(v) (v).begin(),(v).end()

typedef long long ll;

int main(){
	ll a, b, c, k;
	cin >> a >> b >> c >> k;
	
	ll ans = 0, nus = 0;
	
	ll add = min(k-nus,a);
	ans+=add;
	nus+=add;
	
	add = min(k-nus,b);
	nus+=add;
	
	add = min(k-nus,c);
	ans-=add;
	nus+=add;
	
	cout << ans << endl;
}

Measured memory_bytes: 3596
fun main(args: Array<String>) {
    val (D, G) = readLine()!!.split(" ").map { it.toInt() }
    val pc = (1..D).map { readLine()!!.split(" ").map { it.toInt() } }

    var ans = Int.MAX_VALUE
    for (bit in 0 until (1 shl D)) {
        var count = 0
        var sum = 0L
        for (i in 0 until D) {
            if (bit and (1 shl i) != 0) {
                sum += 100 * (i+1) * pc[i][0] + pc[i][1]
                count += pc[i][0]
            }
        }
        if (G <= sum) {
            ans = Math.min(ans, count)
        } else {
            for (i in D - 1 downTo 0) {
                if (bit and (1 shl i) != 0) {
                    continue
                } else {
                    for (j in 0 until pc[i][0]) {
                        if (G <= sum) {
                            break
                        }
                        count++
                        sum += 100 * (i+1)
                    }
                }
            }
            ans = Math.min(ans, count)
        }
    }
    println(ans)
}

Measured memory_bytes: 36780
#include <iostream>
#define llint long long
#define mod 1000000007

using namespace std;

llint b, w;

const int FACT_MAX = 200005;
llint fact[FACT_MAX], fact_inv[FACT_MAX];

llint modpow(llint a, llint n)
{
	if(n == 0) return 1;
	if(n % 2){
		return ((a%mod) * (modpow(a, n-1)%mod)) % mod;
	}
	else{
		return modpow((a*a)%mod, n/2) % mod;
	}
}

void make_fact()
{
	llint val = 1;
	fact[0] = 1;
	for(int i = 1; i < FACT_MAX; i++){
		val *= i;
		val %= mod;
		fact[i] = val;
	}
	fact_inv[FACT_MAX-1] = modpow(fact[FACT_MAX-1], mod-2);
	for(int i = FACT_MAX-2; i >= 0; i--){
		fact_inv[i] = fact_inv[i+1] * (i+1) % mod;
	}
}

llint comb(llint n, llint k)
{
	llint ret = 1;
	ret *= fact[n];
	ret *= fact_inv[k], ret %= mod;
	ret *= fact_inv[n-k], ret %= mod;
	return ret;
}

llint ans[200005];

int main(void)
{
	cin >> b >> w;
	make_fact();
	
	llint tmp;
	for(int i = 0; i <= w-1; i++){
		if(b-2+i >= 0 && b > 1){
			tmp = comb(b-2+i, i);
			tmp *= modpow(modpow(2, b+i), mod-2), tmp %= mod;
			ans[1] += tmp, ans[1] %= mod;
			ans[b+i] += mod - tmp, ans[b+i] %= mod;
		}
		
		//for(int j = 1; j <= b+w; j++) cout << ans[j] << " "; cout << endl;
		
		tmp = comb(b-1+i, i);
		tmp *= modpow(modpow(2, b+i), mod-2), tmp %= mod;
		ans[b+i] += tmp, ans[b+i] %= mod;
		ans[b+i+1] += mod - tmp, ans[b+i+1] %= mod;
		
		//for(int j = 1; j <= b+w; j++) cout << ans[j] << " "; cout << endl;
	}
	for(int i = 0; i <= b-1; i++){
		if(i > 0){
			tmp = comb(w-2+i, i-1);
			tmp *= modpow(modpow(2, w+i), mod-2), tmp %= mod;
			ans[1] += tmp, ans[1] %= mod;
			ans[w+i] += mod - tmp, ans[w+i] %= mod;
		}
		tmp = comb(w-1+i, w-1);
		tmp *= modpow(modpow(2, w+i), mod-2), tmp %= mod;
		ans[w+i+1] += tmp, ans[w+i+1] %= mod;
		ans[w+b+1] += mod - tmp, ans[w+b+1] %= mod;
		
		//cout << tmp << endl;
		//for(int j = 1; j <= b+w; j++) cout << ans[j] << " "; cout << endl;
	}
	
	llint sum = 0;
	for(int i = 1; i <= b+w; i++){
		sum += ans[i], sum %= mod;
		cout << sum << endl;
	}
	
	return 0;
}

Measured memory_bytes: 6144
N = int(input()) + 1
nums_count = 0
for i in range(1, N):
    if i % 2 == 0:
        continue
    count = 1
    for j in range(1, int(i / 2)):  # 8なら1,2,4,8で、1~4までやれば良い。最後に自分をたす あれ、もしかしてN/3?
        if i % j == 0:
            count += 1
    if count == 8:
        nums_count += 1

print(nums_count)


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


int main()
{
	int n;
	cin>>n;
	if(n%2)cout<<(n/2)*(n/2+1)<<endl;
	else cout<<(n/2)*(n/2)<<endl;
	return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;


class Segtree<T>
{
    int n;
    T[] tree;
    Func<T, T, T> f;
    T exnum;
    public Segtree(int m, Func<T, T, T> f, T ex)
    {
        this.f = f;
        this.exnum = ex;
        n = 1;
        while (n < m) n <<= 1;

        tree = new T[(n << 1) - 1];
        for (int i = 0; i < tree.Length; i++) tree[i] = ex;
    }
    public Segtree(int m, T ini, Func<T, T, T> f, T ex)
    {
        this.f = f;
        this.exnum = ex;
        n = 1;
        while (n < m) n <<= 1;

        tree = new T[(n << 1) - 1];
        for (int i = 0; i < tree.Length; i++) tree[i] = ini;
        for (int i = 0; i < m; ++i) update(i, ini);
    }
    public void update(int j, T x)
    {
        int i = j + n - 1;
        tree[i] = x;
        while (i > 0)
        {
            i = (i - 1) >> 1;
            tree[i] = f(tree[(i << 1) + 1], tree[(i << 1) + 2]);
        }
    }
    public T look(int i) { return tree[i + n - 1]; }

    // [s, t]
    public T run(int s, int t) { return query(s, t + 1, 0, 0, n); }
    T query(int s, int t, int k, int l, int r)
    {
        if (r <= s || t <= l) return exnum;
        if (s <= l && r <= t) return tree[k];

        return f(query(s, t, (k << 1) + 1, l, (l + r) >> 1), query(s, t, (k + 1) << 1, (l + r) >> 1, r));
    }
}

namespace Codeforces
{
    class Program
    {
        static void Main(string[] args)
        {
            string input = Console.ReadLine();
            for (int i = 0; i < input.Length; i++)
            {
                Console.Write(input[i]);
                if (i == 3) Console.Write(" ");
            }
            Console.WriteLine();


        }
    }
}

Measured memory_bytes: 2648
use std::str::FromStr;

fn get_one<T : FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    return s.trim().parse().ok().unwrap();
}

fn get_vec<T : FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    return s.trim().split_whitespace().map(|e| e.parse().ok().unwrap()).collect();
}

fn main() {
    let hn : Vec<i32> = get_vec();
    let v : Vec<i32> = get_vec();
    println!("{}", if v.iter().fold(0,|sm,e| sm + e) >= hn[0] {"Yes"} else {"No"});
}


Measured memory_bytes: 4352
n, m = map(int, input().split())
l = 0
r = n
for i in range(m):
    lt, rt = map(int, input().split())
    if (lt > l):
        l = lt
    if (rt < r):
        r = rt
if (r <l):
    print(0)
else:
    print(r-l+1)


Measured memory_bytes: 3060
import java.util.*;
 
public class Main {
 
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
		int ans=0,count=0;
		ans=n*800;
		count=n/15;
		System.out.print(ans-200*count);
    }
}

Measured memory_bytes: 23764
from operator import itemgetter


def main():
    n, m = map(int, input().split())
    li = []
    for i in range(m):
        a, b = map(int,input().split())
        li.append([a,b])
    li = sorted(li,reverse = True)
    count = 1
    mark = 0
    i = 0
    j = 0
    while m > 1:
        check = li[j][0]
        i = i + 1
        if check < li[i][1]:
            m = m - 1
        else:
            count = count + 1
            m = m - 1
            j = i
    print (count)

if __name__ == "__main__":
    main()


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

int main() {
    double n, k;
    cin >> n >> k;
    double ans;

    for(int i=1; i<n+1; i++){
        int score = 0;
        score += i;
        double m = 1/n;

        while(score<k){
            score*=2;
            m/=2;
        }
        ans += m;
    }
    // TIPS: setprecisionでdoubleの精度を調整できる
    cout << setprecision(12) << ans << endl;
    return 0;
}

Measured memory_bytes: 256
// clang-format off
	#include <bits/stdc++.h>
	using namespace std; using ll = long long; using uint = unsigned int; using ull = unsigned long long;
	#define SFINAE(x, ...)	template <class, class = void> struct x : false_type {}; template <class T> struct x<T, void_t<__VA_ARGS__>> : true_type {};
	SFINAE(DefaultIO, decltype(cout << declval<T &>()))
	SFINAE(IsTuple, typename tuple_size<T>::type)
	SFINAE(Iterable, decltype(begin(declval<T>())))
	template <class T> constexpr char Space(const T &) { return (Iterable<T>::value or IsTuple<T>::value) ? '\n' : ' '; }
	template <auto &os> struct Writer {
		template <class T> void Impl(T const &t) const {
			if constexpr (DefaultIO<T>::value) os << t;
			else if constexpr (Iterable<T>::value) { int i = 0; for (auto &&x : t) ((i++) ? (os << Space(x), Impl(x)) : Impl(x)); }
			else if constexpr (IsTuple<T>::value) apply([this](auto const &... args) { int i = 0; (((i++) ? (os << ' ', Impl(args)) : Impl(args)), ...);}, t);
			else static_assert(IsTuple<T>::value, "No matching type for print");
		}
		template <class F, class... Ts> auto &operator()(F const &f, Ts const &... ts) const { return Impl(f), ((os << ' ', Impl(ts)), ...), os << '\n', *this; }
	};
	template <auto &is> struct Reader {
		template <class T> auto& Rd(T &t) const {
			if constexpr (DefaultIO<T>::value) is >> t;
			else if constexpr (Iterable<T>::value) for (auto &x : t) Rd(x);
			else if constexpr (IsTuple<T>::value) apply([this](auto &... args) { (Rd(args), ...); }, t);
			else static_assert(IsTuple<T>::value, "No matching type for read");
			return *this;
		}
		template <class T> auto operator[](T t) const { Rd(t); return t; }
		template <class... Ts> auto operator()(Ts... ts) const { (Rd(ts), ...); return tuple{move(ts)...}; }
	};
	#ifdef NARUT_LOCAL
	#define Debug(...) cerr << "\033[0;31m", Writer<cerr>{}(__VA_ARGS__), cerr << "\033[0m\n"
	#define ASSERT(...) if(not(__VA_ARGS__)) throw runtime_error("local assertion failed")
	#else
	#define Debug(...) 0
	#define ASSERT(...) 0
	#endif
	[[maybe_unused]] constexpr Reader<cin> Cin; [[maybe_unused]] constexpr Writer<cout> Cout;
	#define FOR(i, j, n) for (int i = int(j); i < int(n); ++i)
	#define ROF(i, j, n) for (int i = int(n) - 1; i >= int(j); --i)
	#define let auto const

// clang-format on





auto Main() {
	let n = Cin[0];
	let L = Cin[vector<int> (n)];

	ll ans = 0;
	FOR(i,0,n) {
		FOR(j,i+1,n) {
			FOR(k,j+1,n) {
				array A = {L[i], L[j], L[k]};
				sort(begin(A), end(A));
				if(adjacent_find(A.begin(),A.end())!=A.end()) continue;
				if(A[0]+A[1] > A[2]) ans++;
			}
		}
	}
	cout<<ans;
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout << fixed << setprecision(10);
#ifdef NARUT_LOCAL
	assert(freopen("io/test.in", "r", stdin));
	cin.exceptions(cin.badbit | cin.failbit);
	cerr << fixed << setprecision(10);
#endif

	Main();
}


Measured memory_bytes: 3660
def c(p, g, lis):
    for e in lis:
        if p <= g:
            p += e
        else:
            p -= e
    return p == g


if __name__ == '__main__':
    s = input()
    gx, gy = map(int, input().split())

    s = s.split("T")
    s = [len(_) for _ in s]

    x_move = s[::2]
    y_move = s[1::2]

    x = x_move.pop(0)
    y = 0

    x_move.sort(reverse=True)
    y_move.sort(reverse=True)

    if c(x, gx, x_move) and c(y, gy, y_move):
        print("Yes")
    else:
        print("No")


Measured memory_bytes: 3188
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) throws NumberFormatException,
			IOException {
		BufferedReader reader = new BufferedReader(new InputStreamReader(
				System.in));
		StringBuilder builder = new StringBuilder();
		StringTokenizer to;
		int[] nums = new int[3];
		int a = Integer.parseInt(reader.readLine());
		for (int i = 0; i < a; i++) {
			to = new StringTokenizer(reader.readLine());
			for (int j = 0; j < 3; j++) {
				nums[j] = Integer.parseInt(to.nextToken());
			}
			Arrays.sort(nums);
			if (Math.pow(nums[0], 2) + Math.pow(nums[1], 2) == Math.pow(
					nums[2], 2))
				builder.append("YES\n");
			else
				builder.append("NO\n");
		}
		System.out.print(builder);

	}
}

Measured memory_bytes: 18384
#include <bits/stdc++.h>
#define pb push_back
#define int long long
#define mp make_pair
#define inf 1000000007
#define ll long long
using namespace std;
signed main(){
	string s;
	cin>>s;
	int a=0;
	if(s[0] == s[s.size()-1])a++;
	if( a != s.size()%2 ){cout<<"First"<<endl;}
	else cout<<"Second"<<endl;
	return 0;
}

Measured memory_bytes: 512