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

using namespace std;

#define pb push_back
#define ppb pop_back
#define pf push_front
#define ppf pop_front
#define mmp make_pair
#define st first
#define nd second
#define rd third
#define ll long long
#define pii pair <int, int>
#define tri pair <pii, int>
#define itr pair <int, pii>
#define PQ priority_queue
#define all(v) (v).begin(), (v).end()
#define REP(i, n) for (int (i) = 0; (i) < (int)(n); i++)
#define FOR(i, a, n) for (int (i) = (a); (i) < (int)(n); i++)
#define FORN(i, a, n) for (int (i) = (a); (i) > (int)(n); i--)
#define Rep(i, n) for (int (i) = 0; (i) <= (int)(n); i++)
#define For(i, a, n) for (int (i) = (a); (i) <= (int)(n); i++)
#define Forn(i, a, n) for (int (i) = (a); (i) >= (int)(n); i--)
#define FORD(i, n) for (int (i) = (int)(n) - 1; i>= 0; i--)
#define rep(i, n) for (int (i) = 1; (i) <= (int)(n); i++)
#define EACH(it, a) for (__typeof(a.begin()) it = a.begin(); it != a.end(); it++)

#define DEBUG(x) cout << #x << " = " << (x) << endl;
#define PR(a, n) {cout << #a << " = "; FOR(_, 1, n) cout << a[_] << ' '; puts(""); }
#define PRO(a, n) { cout << #a << " = "; REP(_, n) cout << a[_] << ' '; puts(""); }
#define pi 3.1415926535897932384626433832795028841971
//#define LOCAL

const int INF = 1 << 30;
const int N = 1005;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};

inline ll read()
{
	ll x = 0; int f = 1, c = getchar();
	for (; !isdigit(c); c = getchar()) if (c == '-') f = -f;
	for (; isdigit(c); c = getchar()) x = (x << 3) + (x << 1) + (c ^ 48);
	return x * f;
}

string s; 

int main()
{
	#ifdef LOCAL
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif
	
	cin >> s; 
	REP(i, s.size()) printf("x"); 
	puts(""); 
	
	return 0;
}


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

int main()
{
	ll n;
	cin>>n;
	
	ll a[3][n+1];
	ll dp[3][n+1];
	
		for(int i=0;i<=2;i++){
		for(int j=0;j<=n;j++)
			dp[i][j]=0;
	}
	
	for(int i=1;i<=2;i++){
		for(int j=1;j<=n;j++)
			cin>>a[i][j];
	}
	
	for(int i=1;i<=2;i++){
		for(int j=1;j<=n;j++){
			dp[i][j]=max(dp[i][j-1],dp[i-1][j]);
			dp[i][j]+=a[i][j];
		}
	}
	
		cout<<dp[2][n];
	
	
		
	
}




Measured memory_bytes: 3640
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define endl "\n"
#define speed(); ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define sz(x) (int)(x).size()
#define _USE_MATH_DEFINES
using namespace std;
typedef long long int lli;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

int main() {
    speed();
    int n, m, c;
    cin >> n >> m >> c;
    int B[m], A[n][m];
    rep(i, 0, m) cin >> B[i];
    int cnt = 0;
    rep(i, 0, n) {
        int sum = 0;
        rep(j, 0, m) {
            cin >> A[i][j];
            sum += (A[i][j] * B[j]);
        }
        if (sum+c > 0)
            cnt++;
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 256
import numpy as np
a = list(map(int,input().split(' ')))
b = list(map(int,input().split(' ')))
c = list(map(int,input().split(' ')))
x = [a,b,c]
hit = []
zero = np.zeros((3,3))
count = int(input())
for i in range(count):
  hit.append(int(input()))

  
#print(x,hit)
flag = np.zeros((3,3))
for j in hit:
  for n,i in enumerate(x):
    if j in i:
      one = i.index(j)
      zero[n][one] = 1


#print(zero)
point = np.sum(zero,axis=0)
point2 = np.sum(zero,axis=1)
apoint =      np.append(point,point2,)
hnaname = zero[0][0]+zero[1][1]+zero[2][2] 
mnaname = zero[0][2]+zero[1][1]+zero[2][0] 
apoint = np.append(apoint,hnaname)
apoint = np.append(apoint,mnaname)
#print(apoint)       
if 3 in apoint:
  print('Yes')
else:
  print('No')



Measured memory_bytes: 12504
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "math.h"
#include "utility"
#include "string"
#include "map"
#include "unordered_map"
#include "iomanip"
#include "random"

using namespace std;
const long long int MOD = 1000000007;

long long int D;

int BinarySearch(vector<int> s,int place,int num) {
	int l = 0;
	int r = num;
	while (r - l > 1) {
		int mid = (r + l) / 2;
		if (s[mid] == place)return 0;
		if (s[mid] > place)r = mid;
		else l = mid;
	}
	return min(s[r] - place, place - s[l]);
}

int main() {
	ios::sync_with_stdio(false);
	cin >> D;
	while (D) {
		long long int ans = 0;
		int N, M;
		cin >> N >> M;
		vector<int>shop(N + 1);
		vector<int>cus(M);
		for (int i = 1; i < N; i++)cin >> shop[i];
		for (int i = 0; i < M; i++)cin >> cus[i];
		shop[N] = D;
		stable_sort(shop.begin(), shop.end());
		for (int i = 0; i < M; i++) {
			ans += BinarySearch(shop, cus[i], shop.size() - 1);
		}
		cout << ans << endl;
		cin >> D;
	}
	return 0;
}

Measured memory_bytes: 3752
#include <iostream>
using namespace std;
int main(){
	int n,ans=0;
	while(cin >> n){
	for(int i = 0; i < 10; i++){
		for(int j = 0; j < 10; j++){
			for(int k = 0; k < 10; k++){
				for(int l = 0; l < 10; l++){
					if(i+j+k+l==n)ans++;
				}
			}
		}
	}
	cout << ans << endl;
	ans=0;
	}
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(begin, i, end) for (int i = begin; i < (int)(end); i++)
#define all(v) v.begin(), v.end()
const int MOD = 1000000007;

int main()
{
    int N, A;
    cin >> N >> A;
    if (N % 500 > A)
    {
        cout << "No" << endl;
    }
    else
    {
        cout << "Yes" << endl;
    }
}

Measured memory_bytes: 256
from math import ceil
x=int(input())
i=0
if x<=2:
  print(2)
elif x==3:
  print(3)
elif x==4:
  print(5)
else:
  while 1:
    ok=True
    n=ceil((x+i)**0.5)
    for j in range(2,n):
      if (x+i)%j==0:
        ok=False
        break
    if ok:
      print(x+i)
      exit()
    i+=1


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

    #define ll long long
    #define pb push_back
    #define mod 1000000007
    #define mk make_pair


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

      ll a;
      string s; cin>>a>>s;
      if(a<3200)cout<<"red";
      else cout<<s;

      return 0;
      
      }

Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main(){
    int n, i;
    int h[100000]; //マス
    cin >> n;
    for(i = 0; i < n; i++){
        cin >> h[i];
    }
    for(i = n - 1; i > 0; i--){
        if(h[i] >= h[i - 1]) continue;
        else if(h[i] == h[i - 1] - 1) h[i - 1]--;
        else break;
    }
    if(i == 0) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}

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

typedef long long       ll;
const int MAX=3009;
const int MOD=998244353;
int n, a[MAX], s;
ll save[MAX][MAX];

ll dp(int i, int rest) {
    if (rest==0)        return n-i+1;
    if (i==n)           return 0;

    ll& ret=save[i][rest];
    if (ret!=-1) {
        return ret;
    }

    ret=dp(i+1, rest);
    if (rest>=a[i]) {
        ret%=MOD;

        ll prod=(rest==s ? i+1 : 1);
        ret+=dp(i+1, rest-a[i])*prod;
    }

    return ret%MOD;
}

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

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

    memset(save, -1, sizeof save);
    cout << dp(0, s);

    return 0;
}


Measured memory_bytes: 71168
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define FOR(i, N) for (long i = 0; i < (N); i++)

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

    if (S == "RRR") {
        cout << 3 << endl;
    } else if ((S == "SRR") || (S == "RRS")) {
        cout << 2 << endl;
    } else if (((S == "SSR") || (S == "SRS")) || ((S == "RSS") || (S == "RSR"))) {
        cout << 1 << endl;
    } else {
        cout << 0 << endl;
    }

    return 0;
}


Measured memory_bytes: 3652
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
int main(void){
    int n,k;
    scanf("%d%d",&n,&k);
    char s[n+1];
    scanf("%s",s);
    s[k-1]+=32;
    printf("%s",s);
    return 0;
}

Measured memory_bytes: 128
N= input()
mae = int(N[0]+N[1])
ato = int(N[2]+N[3])
a = 0
b = 0
if 0<mae and mae<13:
  a = 1
if 0 < ato and ato < 13:
  b = 1
if a == 1:
  if b == 1:
    print('AMBIGUOUS')
  else:
    print('MMYY')
else:
  if b == 1:
    print('YYMM')
  else:
    print('NA')

Measured memory_bytes: 3064
#include <bits/stdc++.h> 
#include <ext/pb_ds/assoc_container.hpp> // Common file  
#include <ext/pb_ds/tree_policy.hpp>
#include <functional>
#include <unistd.h>
using namespace std; 
using namespace std::chrono; 
using namespace __gnu_pbds;
#define ll long long int 
//mp.reserve(1024);
//mp.max_load_factor(0.25);
typedef tree<int, null_type, less<int>, rb_tree_tag,  
                 tree_order_statistics_node_update>  
          ordered_set;  
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
            x += 0x9e3779b97f4a7c15;
            x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
            x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
            return x ^ (x >> 31);
        }

        size_t operator()(uint64_t x) const {
            static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
            return splitmix64(x + FIXED_RANDOM);
        }
};
 
void addEdge(vector<ll> adj[], ll u, ll v) 
{ 
   adj[u].push_back(v); 
   adj[v].push_back(u); 
} 
vector<ll> z_function(string s) {
    ll n = s.length();
    vector<ll> z(n);
    for (ll i = 1, l = 0, r = 0; i < n; ++i) {
        if (i <= r)
            z[i] = min (r - i + 1, z[i - l]);
        while (i + z[i] < n && s[z[i]] == s[i + z[i]])
            ++z[i];
        if (i + z[i] - 1 > r)
            l = i, r = i + z[i] - 1;
    }
    return z;
}
ll m=998244353;
ll power(ll x,ll y) 
{ 
    ll res = 1; // Initialize result 
  
    while (y > 0) { 
        // If y is odd, multiply x with result 
        if (y & 1) 
            res = ((res%m) * (x%m))%m; 
  
        // n must be even now 
        y = y >> 1; // y = y/2 
        x = ((x%m) * (x%m))%m; // Change x to x^2 
    } 
    return res; 
} 
int main() 
{ 
 	ios_base::sync_with_stdio(false);
   	cin.tie(NULL);
   	cout.tie(NULL);
    //freopen("input.txt", "r", stdin); 
    //freopen("output1.txt", "w", stdout); 
	ll n,k;
	cin>>n>>k;
	vector<ll>v;
	for(ll i=0,temp;i<n;i++){
		cin>>temp;
		v.push_back(temp);
	}	
	v.push_back(INT_MAX);
	v.push_back(INT_MAX);
	v.push_back(INT_MAX);
	ll dp[n+1];
	for(ll i=0;i<n;i++)
		dp[i]=INT_MAX;
	dp[0]=0;
	for(ll i=0;i<n;i++){
		for(ll j=1; j <= k;j++){
				if(i+j<n){
					dp[i+j]=min(dp[i+j],dp[i]+abs(v[i]-v[i+j]));
				}
		}
	}
	cout<<dp[n-1]<<endl;
    return 0; 
} 


Measured memory_bytes: 1908
# coding: utf-8
num = list(map(int,input().split()))

atama = num[0]
ashi = num[1]

a = 2*atama - ashi/2
b = ashi/2 - atama

if(a.is_integer() and b.is_integer() and a>=0 and b>=0):
    print('Yes')
else:
    print('No')

Measured memory_bytes: 9180
#include<bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb push_back
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repA(i,a,b) for(int i=a;i<=b;i++)
#define repD(i,b,a) for(int i=b;i>=a;i--)
#define fill(a,val) memset(a,val,sizeof(a))
#define f first
#define s second
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
int main()
{
    unordered_map<int,int>mp;
    for(int i=1;i<=5;i++)
    {
        int x;
        cin>>x;
        mp[x]=i;
    }
    cout<<mp[0]<<endl;
    
    return 0;
}

Measured memory_bytes: 3628
#include <iostream>
#include <vector>
#include <map>

using namespace std;

using ull = unsigned long long;
constexpr int MAX = 100000;
constexpr ull B = 100000007;

vector<int> G[MAX];
map<ull, ull> mp;

ull dfs(int v)
{
    ull res = 1;
    for (auto to : G[v]) {
        res += dfs(to) * B;
    }
    mp[res]++;
    return res;
}

ull solve()
{
    dfs(0);
    ull res = 0;
    for (auto x : mp) {
        if (x.second >= 2) {
            res += x.second * (x.second - 1) / 2;
        }
    }
    return res;
}

int main()
{
    int N;
    cin >> N;
    for (int i = 0; i < N - 1; i++) {
        int a, b;
        cin >> a >> b; a--; b--;
        G[a].emplace_back(b);
    }
    cout << solve() << endl;
    return 0;
}

Measured memory_bytes: 19492
#include<bits/stdc++.h>
#define Fst first
#define Snd second
#define RG register
#define mp make_pair
#define mem(a,b) memset(a,b,sizeof(a))
using namespace std;
typedef long long LL;
typedef long double LD;
typedef unsigned int UI;
typedef unsigned long long ULL;
template<typename T> inline void read(T& x) {
	char c = getchar();
	bool f = false;
	for (x = 0; !isdigit(c); c = getchar()) {
		if (c == '-') {
			f = true;
		}
	}
	for (; isdigit(c); c = getchar()) {
		x = x * 10 + c - '0';
	}
	if (f) {
		x = -x;
	}
}
template<typename T, typename... U> inline void read(T& x, U& ... y) {
	read(x), read(y...);
}
int n,L,T;
int G[100010];
//#define rua
int main() {
//	ios::sync_with_stdio(false);
#ifdef rua
	freopen("GG.in","r",stdin);
#endif
  read(n,L,T);
  LL rk=0;
  for(int i=0;i<n;++i) {
    int a,w; read(a,w);
    if(w==1) {
      G[i]=(a+T)%L;
      rk+=(a+T)/L;
    }
    else {
      G[i]=(a-T)%L;
      rk+=(a-T)/L;
      if(G[i]<0) G[i]+=L,--rk;
    }
  }
  rk=(rk%n+n)%n;
  sort(G,G+n);
  for(int i=rk;i<n;++i) printf("%d\n",G[i]);
  for(int i=0;i<rk;++i) printf("%d\n",G[i]);
  return 0;
}


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

int main() {

	int a,b;
	cin >> a>>b;
	char c[12];
	cin >> c;
	int d = 0;
	for (int i = 0;i < (a + b + 1);i++)
	{
		if (i == a)
		{
			if (c[i] != '-')
				d = 1;
		}
		else if (c[i] == '-')
			d = 1;

	}

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

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using static Input;

public class Prog
{
    private const int INF = 1000000007;
    private const long INFINITY = 9223372036854775807;
    private struct Pair { public int x, y; public Pair(int xx, int yy) { x = xx; y = yy; } }
    private static int[] dx = { 1, 0, -1, 0 };
    private static int[] dy = { 0, -1, 0, 1 };
    public static void Main()
    {
        int H = NextInt();
        int W = NextInt();
        int[,] map = new int[H, W];
        for (int i = 0; i < H; i++)
        {
            string box = NextString();
            //string box = "";
            //for (int j = 0; j < W; j++) box += ".";
            for (int j = 0; j < W; j++)
                map[i, j] = (box[j] == '#' ? 1 : 0);
        }
        //BFSの気持ち
        Queue<Pair> Black = new Queue<Pair>();
        for (int i = 0; i < H; i++)
            for (int j = 0; j < W; j++)
                if (map[i, j] == 1) Black.Enqueue(new Pair(j, i));

        if (Black.Count() == H * W) { Console.WriteLine(0); return; }

        Queue<Pair> nextBlack = Fac(Black, ref map, H, W);
        int ans = 1;
        while (nextBlack.Count() != 0)
        {
            nextBlack = Fac(nextBlack, ref map, H, W);
            if (nextBlack.Count() == 0) break;
            ans++;
        }
        Console.WriteLine(ans);
    }
    private static Queue<Pair> Fac(Queue<Pair> Black, ref int[,] map, int H, int W)
    {
        Queue<Pair> nextBlack = new Queue<Pair>();
        while (Black.Count() != 0)
        {
            Pair pos = Black.Dequeue();
            for (int i = 0; i < 4; i++)
            {
                if (pos.x + dx[i] < 0 || W <= pos.x + dx[i] ||
                    pos.y + dy[i] < 0 || H <= pos.y + dy[i]) continue;
                if (map[pos.y + dy[i], pos.x + dx[i]] == 0)
                {
                    nextBlack.Enqueue(new Pair(pos.x + dx[i], pos.y + dy[i]));
                    map[pos.y + dy[i], pos.x + dx[i]] = 1;
                }
            }
        }
        return nextBlack;
    }
}

public class Input
{
    private static Queue<string> q = new Queue<string>();
    private static void Confirm() { if (q.Count == 0) foreach (var s in Console.ReadLine().Split(' ')) q.Enqueue(s); }
    public static int NextInt() { Confirm(); return int.Parse(q.Dequeue()); }
    public static long NextLong() { Confirm(); return long.Parse(q.Dequeue()); }
    public static char NextChar() { Confirm(); return char.Parse(q.Dequeue()); }
    public static string NextString() { Confirm(); return q.Dequeue(); }
    public static double NextDouble() { Confirm(); return double.Parse(q.Dequeue()); }
    public static int[] LineInt() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); }
    public static long[] LineLong() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
    public static string[] LineString() { return Console.ReadLine().Split(' ').ToArray(); }
    public static double[] LineDouble() { return Console.ReadLine().Split(' ').Select(double.Parse).ToArray(); }
}


Measured memory_bytes: 35412
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdint>
#include <cstring>

#include <algorithm>
#include <functional>
#include <iostream>
#include <numeric>
#include <string>
#include <vector>

using namespace std;

using i32 = int32_t;
using u32 = uint32_t;
using f32 = float;
using f64 = double;
using i64 = int64_t; 
using u64 = uint64_t; 

#define SELECTER(_1, _2, _3, _4, _5, _6, _7, _8, SELECT, ...) SELECT

#define _FC1(func, type, _1)      func(type, _1);
#define _FC2(func, type, _1, ...) func(type, _1); _FC1(func, type, __VA_ARGS__);
#define _FC3(func, type, _1, ...) func(type, _1); _FC2(func, type, __VA_ARGS__);
#define _FC4(func, type, _1, ...) func(type, _1); _FC3(func, type, __VA_ARGS__);
#define _FC5(func, type, _1, ...) func(type, _1); _FC4(func, type, __VA_ARGS__);
#define _FC6(func, type, _1, ...) func(type, _1); _FC5(func, type, __VA_ARGS__);
#define _FC7(func, type, _1, ...) func(type, _1); _FC6(func, type, __VA_ARGS__);
#define _FC8(func, type, _1, ...) func(type, _1); _FC7(func, type, __VA_ARGS__);

#define _FCN(func, type, ...) SELECTER(__VA_ARGS__, _FC8, _FC7, _FC6, _FC5, _FC4, _FC3, _FC2, _FC1)(func, type, __VA_ARGS__);

constexpr const char *type2fmt(const char *fmt) {
  if(strcmp(fmt, "i32") == 0) return "%d";
  if(strcmp(fmt, "u32") == 0) return "%u";
  if(strcmp(fmt, "f32") == 0) return "%f";
  if(strcmp(fmt, "f64") == 0) return "%lf";
  if(strcmp(fmt, "i64") == 0) return "%lld";
  if(strcmp(fmt, "u64") == 0) return "%llu";
  return "";
}

#define _R(type, _1) type _1; { type _t; scanf(type2fmt(#type), &_t); _1 = _t; }
#define _P(type, _1) { const type _t = (_1); printf(type2fmt(#type), _t); putchar('\n'); }

#define RI(...)   _FCN(_R, i32, __VA_ARGS__);
#define RUI(...)  _FCN(_R, u32, __VA_ARGS__);
#define RF(...)   _FCN(_R, f32, __VA_ARGS__);
#define RD(...)   _FCN(_R, f64, __VA_ARGS__);
#define RLL(...)  _FCN(_R, i64, __VA_ARGS__);
#define RULL(...) _FCN(_R, u64, __VA_ARGS__);

#define PI(...)   _FCN(_P, i32, __VA_ARGS__);
#define PUI(...)  _FCN(_P, u32, __VA_ARGS__);
#define PF(...)   _FCN(_P, f32, __VA_ARGS__);
#define PD(...)   _FCN(_P, f64, __VA_ARGS__);
#define PLL(...)  _FCN(_P, i64, __VA_ARGS__);
#define PULL(...) _FCN(_P, u64, __VA_ARGS__);

#define REP(n) for (int _i = 0; _i < n; _i++)

const u64 mod = 1000000007;

int main() {
  RULL(A, B, C);

  if (B >= A * C) cout << C << endl;
  else cout << B / A << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
#include <float.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rrep(i, n) for(int i = 0; i <= (n); i++)
using namespace std;
typedef long long ll;
 
const ll INF = 1LL<<62;
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; }
// 多次元 vector 生成
template<class T>
vector<T> make_vec(size_t a){
    return vector<T>(a);
}
template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts){
  return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
const int MOD = 1000000007;
struct mint {
    ll x;
    mint(ll x=0):x((x%MOD+MOD)%MOD){}
    mint operator-() const { return mint(-x);}
    mint& operator+=(const mint a) {
        if ((x += a.x) >= MOD) x -= MOD;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += MOD-a.x) >= MOD) x -= MOD;
        return *this;
    }
    mint& operator*=(const mint a) {
        (x *= a.x) %= MOD;
        return *this;
    }
    bool operator==(const mint a){
        return (x == a.x);
    }
    mint operator+(const mint a) const {
        mint res(*this);
        return res+=a;
    }
    mint operator-(const mint a) const {
        mint res(*this);
        return res-=a;
    }
    mint operator*(const mint a) const {
        mint res(*this);
        return res*=a;
    }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }
    // for prime MOD
    mint inv() const {
        return pow(MOD-2);
    }
    mint& operator/=(const mint a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint a) const {
        mint res(*this);
        return res/=a;
    }
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}
// 2項係数を求める
struct combination {
    vector<mint> fact, ifact;
    combination(int n):fact(n+1),ifact(n+1) {
        assert(n < MOD);
        fact[0] = 1;
        for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
        ifact[n] = fact[n].inv();
        for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
    }
    mint operator()(int n, int k) {
        if (k < 0 || k > n) return 0;
        return fact[n]*ifact[k]*ifact[n-k];
    }
};

//nが非常に大きく、aが小さい場合
mint choose(int n, int a){
    mint x = 1, y = 1;
    rep(i,a){
        x *= n-i;
        y *= i+1;
    }
    return x/y;
}

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

    sort(A.begin(), A.end());

    combination c(N+2);
    // 最大値をすべて加算
    mint ans = 0;
    rep(i,N){
        mint now = c(i,K-1);
        ans += now*A[i];
    }

    sort(A.rbegin(),A.rend());
    // 最小値をすべて減算
    rep(i,N){
        mint now = c(i,K-1);
        ans -= now*A[i];
    }

    cout << ans << endl;



}

Measured memory_bytes: 5508
#include<stdio.h>

void func(unsigned long int* p, unsigned long int n){
    while(n>1 && *(p+n-1) > *(p+n/2-1)){
        unsigned long int buf = *(p+n-1);
        *(p+n-1) = *(p+n/2-1);
        *(p+n/2-1) = buf;
        n = n/2;
    }
}

void func2(unsigned long int* p, unsigned long int n){
    unsigned long int x = 1;
    while(x*2 <= n && (*(p+x-1) < *(p+x*2-1) || (*(p+x-1) < *(p+x*2)&&x*2+1<=n))){
        if(x*2+1<=n){
            if(*(p+x*2-1) >= *(p+x*2)){
                unsigned long int buf = *(p+x-1);
                *(p+x-1) = *(p+x*2-1);
                *(p+x*2-1) = buf;
                x = x*2;
            }else{
                unsigned long int buf = *(p+x-1);
                *(p+x-1) = *(p+x*2);
                *(p+x*2) = buf;
                x = x*2+1;
            }
        }else{
            unsigned long int buf = *(p+x-1);
            *(p+x-1) = *(p+x*2-1);
            *(p+x*2-1) = buf;
            x = x*2;
        }
    }
}

int main(){
    unsigned long int n, m;
    scanf("%lu%lu", &n, &m);
    unsigned long int a[n];
    for(unsigned long int i=1; i<=n; i++){
        unsigned long int buf;
        scanf("%lu", &buf);
        if(i==1){
            a[0] = buf;
        }else{
            a[i-1] = buf;
            func(a, i);
        }
    }
    while(m>0){
        a[0] = a[0]/2;
        func2(a, n);
        m--;
    }
    /*for(unsigned long int i=0; i<n; i++){
        printf("%lu ", a[i]);
    }
    printf("\n");*/
    unsigned long int ans = 0;
    for(unsigned long int i=0; i<n; i++){
        ans += a[i];
    }
    printf("%lu", ans);

    return 0;
}


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

using namespace std;

using ll = long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vi = vector<int>;
using vl = vector<ll>;

using _loop_int = int;
#define REP(i,n) for(_loop_int i=0; i<(_loop_int)(n); i++)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a); i<(_loop_int)(b); i++)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1; i>=(_loop_int)(a); i--)

#define CHMIN(a,b) (a)=min((a),(b))
#define CHMAX(a,b) (a)=max((a),(b))
#define ALL(v) (v).begin(),(v).end()

#define DEBUG(x) cerr<<#x<<": "<<(x)<<endl
#define DEBUG_VEC(v) cerr<<#v<<": ";REP(__i,(v).size())cerr<<((v)[__i])<<", ";cerr<<endl

const ll MOD = 1000000007ll;

int n,k;
int v[52];

int main(){
    scanf("%d%d",&n,&k);
    REP(i,n)scanf("%d",v+i);
    int ans = 0;
    REP(l,n)FOR(r,l-1,n){
        int len = r-l+1;
        if(n-len > k)continue;
        int rest = k - (n-len);
        multiset<int> S;
        int tmp = 0;
        REP(i,n)if(i<l || i>r)S.insert(v[i]),tmp+=v[i];
        while(rest-->0 && S.size()>0 && *S.begin()<0){
            tmp -= *S.begin();
            S.erase(S.begin());
        }
        CHMAX(ans,tmp);
    }
    printf("%d\n",ans);
    return 0;
}


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

int main() {
 	int n; 
	cin >>n;
  	int ans = 0;
  
  int a,b;
  
  if(n%2 == 0)
  {
    for(int i=0; i<n/2; i++) 
 	 {
		cin >> a >> b;
      if(a % 2 != 0){ans ++;}
    }
  }
  else
  {
        for(int i=0; i<n/2+1; i++) 
 	 {
		cin >> a >> b;
      if(a % 2 != 0){ans ++;}
    }
  }
	cout << ans << endl;
}

Measured memory_bytes: 3560
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#define ll long long int
#define pb push_back
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
using namespace std;

int mx8[] = {0,0,1,-1,-1,1,-1,1};
int my8[] = {-1,1,0,0,-1,-1,1,1};
int mx4[] = {1,-1,0,0};
int my4[] = {0,0,-1,1};
const int MOD = 1000000007;

int main() {
    int n, m; cin >> n;
    map<int,int> d, t;
    rep(i,n) {
        int D; cin >> D;
        d[D]++;
    }

    cin >> m;
    rep(i,m){
        int T; cin >> T;
        if(d[T]) {
            d[T]--;
            continue;
        }else{
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;

}





Measured memory_bytes: 12872
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,y;
	long long s;
	cin>>n>>y;
	if(y%1000!=0)
	{
		cout<<-1<<' '<<-1<<' '<<-1;
		return 0;
	}
	for(int i=0;i<=y/10000;i++)
	{
		for(int j=0;j<=y/5000;j++)
		{
			int l=(y-i*10000-j*5000)/1000;
			if(l+i+j==n&&i*10000+j*5000+l*1000==y&&l>=0)
			{
				cout<<i<<' '<<j<<' '<<l;
				return 0;
			}
		}
	}
	cout<<-1<<' '<<-1<<' '<<-1;
}

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

using namespace std;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define itn int

typedef long long ll;
typedef pair<ll,ll> p;


int main()
{
  int k, t;
  cin >> k >> t;
  vector<int> v(t, 0);
  for (int i = 0; i < t; i++)
  {
    cin >> v[i];
  }

  sort(all(v));

  int maxv = v[t-1];
  int sum = 0;
  for (int i = 0; i < t-1; i++)
  {
    sum += v[i];
  }

  int res = 0;

  if(maxv > sum+1) res = maxv - sum -1;

  cout << res << endl;



}

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

using namespace std;
 
string str;
 
void C(int len){
    char tmp = str[0];
    for(int i = 1 ; i < len; i++){
        str[i-1] = str[i];
    }
    str[len-1] = tmp;
}
 
void J(int len){
    char tmp = str[len-1];
    for(int i = len-2; i >=0 ; i--){
        str[i+1] = str[i];
    }
    str[0] = tmp;
}
 
void E(int len){
    int div = len/2;
     
    if(len%2==0){
        string f = str.substr(0,div) , g = str.substr(div,len-1);
        str = "";
        str += g+f;
    }
    else{
        string f = str.substr(0,div), g = str.substr(div+1,len);
        string mid = str.substr(div,1);
        str = "";
        str += g+mid+f;
    }
}
 
void A(){
    reverse(str.begin(),str.end());
}
 
void M(int len){
    for(int i = 0 ; i < len ; i++){
        if('0' <= str[i] && str[i] <= '8'){
            str[i] += 1;
        }
        else if(str[i] == '9') str[i] = '0';
    }
}
 
void P(int len){
    for(int i = 0 ; i < len ; i++){
        if('1' <= str[i] && str[i] <= '9'){
            str[i] -= 1;
        }
        else if(str[i] == '0') str[i] = '9';
    }
}
 
int main(){
    int n;
    cin >> n;
    while(n--){
        string order;
        cin >> order >> str;
         
        int len = str.size();
        reverse(order.begin(),order.end());
         
        for(int i = 0 ; i < (int)order.size() ; i++){
            switch(order[i]){
	    case 'J':
		J(len);
		break;
                     
	    case 'C':
		C(len);
		break;
                     
	    case 'E':
		E(len);
		break;
                     
	    case 'A':
		A();
		break;
                     
	    case 'M':
		M(len);
		break;
                     
	    case 'P':
		P(len);
		break;
            }
        }
        cout << str << endl;
    }
    return 0;
}

Measured memory_bytes: 3140
#include <bits/stdc++.h>
#define REP(i,n) for(int i = 0; i < n; i++)
#define FOR(i,j,n) for(int i = j; i < n; i++)
#define RFOR(i,j,n) for(int i = j-1; i >= n; i--)
#define PREC(n) fixed << setprecision(n)
#define print_array(v) REP(__k, v.size()) { cout << v[__k]; if(__k != v.size()-1) cout << " "; else cout << endl; }
#define YesorNo(a) printf(a?"Yes\n":"No\n")
#define _LIBCPP_DEBUG 0
using namespace std;
int64_t MOD = 1000000007;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int w, h, x, y, r;
  cin >> w >> h >> x >> y >> r;
  bool ans = true;
  if(w - r < x) ans = false;
  if(h - r < y) ans = false;
  if(x - r < 0) ans = false;
  if(y - r < 0) ans = false;
  YesorNo(ans);
  return 0;
}
//templete by private_yusuke



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

int main() {
    string a,b;
    cin >> a >> b;
    for(int i=0; i<a.size(); i++){
        if(a[i] != b[i]) cout << "No\n", exit(0);
    }
    cout << "Yes\n";
    return 0;
}

Measured memory_bytes: 3628
import java.util.Scanner;

public class Main {
    public static void main(String args[]) {
        try (Scanner in = new Scanner(System.in)) {
            int N = in.nextInt();
            int A = in.nextInt();
            int B = in.nextInt();
            int[] P = new int[N];
            for (int i = 0; i < N; i++) {
                P[i] = in.nextInt();
            }

            int[] count = new int[3];
            for (int i = 0; i < N; i++) {
                count[P[i] <= A ? 0 : P[i] <= B ? 1 : 2]++;
            }

            System.out.println(Math.min(count[0], Math.min(count[1], count[2])));
        }
    }
}


Measured memory_bytes: 21844
import java.util.*;

public class Main {
	public static void main(String[] args){
		Scanner in = new Scanner(System.in);
		ArrayList<Integer> list = new ArrayList<Integer>();
		while(true){
			String str = in.nextLine();
			if(str.equals(".")) break;
			char ch[] = str.toCharArray();
			boolean check = true;
			for(int i=0; i<str.length(); i++){
				String re = String.valueOf(ch[i]);
				if(re.equals("(")) list.add(1);
				else if(re.equals("[")) list.add(2);
				else if(re.equals(")")){
					if(list.size()==0 || list.get(list.size()-1)!=1){
						check = false;
					}else{
						list.remove(list.size()-1);
					}
				}else if(re.equals("]")){
					if(list.size()==0 || list.get(list.size()-1)!=2){
						check = false;
					}else{
						list.remove(list.size()-1);
					}
				}
				if(!check) break;
			}
			if(check && list.size()==0) System.out.println("yes");
			else System.out.println("no");
			list.clear();
		}
	}
}

Measured memory_bytes: 13000
#include <iostream>
#include <fstream>
#include <string> 
#include <cmath>  
#include <cstdlib>
#include <ctime>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <set>
#include <functional>

using namespace std;
using ll = long long;

#define FOR(i, m, n) for(int i = (m);i < (n);i++)
#define REP(i,n) for(int i = 0; i < int(n); i++)
#define VI vector<int>
#define VVI vector<vector<int>>
#define VVVI vector<vector<vector<int>>>
#define VL vector<ll>
#define PAIR pair<int,int>
#define MP make_pair
#define VP vector<pair<int,int>>
#define VS vector<string>
#define PQUE priority_queue<int> //5,5,4,3,3,2,...
#define REPQUE priority_queue<int, vector<int>, greater<int>> //1,1,2,3,4,4,5,...
#define SUM(obj) accumulate((obj).begin(), (obj).end(), 0)
#define SORT(obj) sort((obj).begin(), (obj).end()) // 1,2,3,4,5...
#define RESORT(obj) sort((obj).begin(), (obj).end(), greater<int>()) // 5,4,3,2,1...
#define UB(obj,n) upper_bound((obj).begin(), (obj).end(), n) //itr > n
#define LB(obj,n) lower_bound((obj).begin(), (obj).end(), n) //itr>= n

const ll MOD = (ll)1e9 + 7;


int main() {
	int N, A, B;
	cin >> N;
	cout << (24 - N) + 24 << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <numeric>
#include <iostream>
#include <sstream>
#include <vector>
#include <cstdio>
#include <map>
#include <set>
#include <functional>
#include <queue>
#include <string>
#include <bitset>
#include <cassert>
#include <algorithm>
#include <cmath>
#include <set>
#include <algorithm>
#include <tuple>
#include <sstream>

using namespace std;

#ifdef LOCAL
#define logv(a) {cerr << #a << " = "; for (auto& e : a) {cerr << e << " ";} cerr << "\n";}
#define logvp(a) {cerr << #a << " = "; for (auto& e : a) {cerr << "(" << e.first << ", " << e.second << ") ";} cerr << "\n";}
#define logvv(a) {cerr << #a << " = \n"; for (auto& r : a) { for (auto& e : r) {cerr << e << " ";} cerr << "\n";} }
#define logvf(a, field) {cerr << #a"."#field << " = \n"; for (auto& e : a) { cerr << e.field << " ";} cerr << "\n"; }
#define logs(a) cerr << #a << " = " << (a) << "\n";
#define logss(a, b) cerr << #a << " = " << (a) << ", " << #b << " = " << (b) << "\n";
#define logp(a) cerr << #a << " = " << "(" << a.first << ", " << a.second << ")" << "\n";
#define cond(pred, stmt) if (pred) { stmt }
#else
#define logv(a)
#define logvp(a)
#define logvv(a)
#define logvf(a, field)
#define logs(a)
#define logss(a, b)
#define logp(a)
#define cond(pred, stmt)
#endif

#define forn(a, e) for (int a = 0; a < (int)e; a++)
#define forr(a, s, e) for (int a = s; a < (int)e; a++)

using i64 = long long;

template<typename T>
using Pair = array<T, 2>;

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

    i64 n;
    while (cin >> n) {
        vector<int> b(n - 1);
        forn(i, n - 1) {
            cin >> b[i];
        }

        vector<int> a(n);
        a[0] = b[0];
        forr(i, 1, n - 1) {
            a[i] = min(b[i - 1], b[i]);
        }
        a[n - 1] = b[n - 2];

        i64 sum = 0;
        forn(i, n) {
            sum += a[i];
        }
        cout << sum << endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<n; ++i)
#define rep1(i, n) for (int i=1; i<=n; ++i)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
constexpr ll  MOD = (1e9+7);
constexpr int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
constexpr int lcm(int a, int b) { return a / gcd(a, b) * b; }

template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
ll factorial(ll n, ll m=2) {
    // calculate n!
    m = max(2LL, m);
    ll rtn = 1;
    for (ll i=m; i<=n; i++) {
        rtn = (rtn * i) % MOD;
    }
    return rtn;
}
ll modinv(ll a, ll m) {
    ll b = m, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b;
        swap(a, b);
        u -= t * v;
        swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
ll modpow(ll a, ll n) {
    ll res = 1;
    while (n > 0) {
        if (n & 1)
            res = res * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return res;
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int s; cin >> s;
    vector<ll> dp(s+1, 0);
    dp[0] = 1;
    for (int i=0; i<=s; ++i) {
        for(int j=0; j<=i-3; ++j) {
            dp[i] += dp[j] % MOD;
            dp[i] %= MOD;
        }
    }
    cout << dp[s] << endl;
    return 0;
}

Measured memory_bytes: 3640
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <type_traits>
#include <map>

using namespace std;



int main(int argc, const char * argv[]) {
    int n;
    cin >> n;
    vector<long long> c(n,0), s(n,0), f(n,0);
    for(int i = 0; i < n-1; i++){
        cin >> c[i] >> s[i] >> f[i];
    }
    
    for(int start = 0; start < n; start++){
        long long elapsed = s[start] + c[start];
        for(int i = start + 1; i < n-1; i++){
            elapsed = max(elapsed, s[i]);
            elapsed = f[i] * ceil(1.0 * elapsed/f[i]) + c[i];
            //cout << elapsed << endl << endl;;
        }
        cout << elapsed << endl;
        //cout << "----" << endl;
    }
    return 0;

}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <bitset>
typedef long long ll;
#define inc(i) (++ (i))
#define dec(i) (-- (i))
#define Rep(i , a , b) for(int i = (a) , i##Limit = (b) ; i <= i##Limit ; inc(i))
#define rep(i , a , b) for(int i = (a) , i##Limit = (b) ; i >= i##Limit ; dec(i))
using namespace std;

const int N = 2000 + 7 , M = 4000000 + 7;
int n , k , Sum , A[N] , B[N * 20] , tot;
bitset <M> Dp;

int main() {
	// scanf("%d%d" , &n , &k);
	scanf("%d" , &n) , k = 0;
	Rep(i , 1 , n) scanf("%d" , A + i) , Sum += A[i];
	if(k == 1) printf("%d\n%d" , Sum * (k + 1) / 2 , Sum * (k + 1) / 2);
	else {
		// printf("%d\n" , Sum * (k + 1) / 2);
		// Rep(i , 1 , n) Rep(j , 1 , k) B[inc(tot)] = A[i] * j;
		Dp[0] = 1;
		Rep(i , 1 , n) Dp |= Dp << A[i];
		int Now = (Sum + 1) * (k + 1) / 2;
		// rep(i , Now , 0) if(Dp[i]) return printf("%d" , i) , 0;
		Rep(i , Now , Sum * (k + 1)) if(Dp[i]) return printf("%d" , i) , 0;
	}
	return 0;
}

Measured memory_bytes: 1664
/*
 * iraira.cpp
 *
 *  Created on: 2018/05/02
 *      Author: J01003
 */
/*
 * taete.cpp
 *
 *  Created on: 2018/04/26
 *      Author: J01003
 */
#include<iostream>
#include<stdio.h>
using namespace std;

int main(){
    int a,b,r;
    double f1,f2;
    cin>>a>>b;
    f1 = a/b;
    r = a%b;
    f2= 1.00000*a/b;
    printf("%d %d %.10lf\n",a/b,a%b,f2);
	return 0;
}




Measured memory_bytes: 3212
#pragma GCC optimize(2)
#include<bits/stdc++.h>
#define ll long long
#define maxn 1000005
#define inf 1e9
#define pb push_back
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define per(i,a,b) for(int i=a;i>=b;i--)
using namespace std;

inline int read()
{
	int x=0,w=1; char c=getchar();
	while(c<'0'||c>'9') {if(c=='-') w=-1; c=getchar();}
	while(c<='9'&&c>='0') {x=(x<<1)+(x<<3)+c-'0'; c=getchar();}
	return w==1?x:-x;
}

int k,a,b;

int main()
{
	cin>>k>>a>>b;
	for(int i=a;i<=b;i++) if(i%k==0) {puts("OK"); return 0;}
	puts("NG");
	return 0;
}

Measured memory_bytes: 3640
# coding: utf-8
import sys
#from operator import itemgetter
sysread = sys.stdin.buffer.readline
read = sys.stdin.buffer.read
#from heapq import heappop, heappush
#from collections import defaultdict
sys.setrecursionlimit(10**7)
import math
#from itertools import product, accumulate, combinations, product
#import bisect
#import numpy as np
#from copy import deepcopy
#from collections import deque
#from decimal import Decimal
#from numba import jit

INF = 1 << 50
EPS = 1e-8
mod = 10 ** 9 + 7


def run():
    N = int(input())
    for h in range(1, 3501):
        if 4 * h - N <= 0:
            continue
        s = math.ceil(N * h / (4 * h - N))
        for n in range(s, 3501):
            v = N * h * n
            a = 4 * h * n - N * n - N * h
            if a <= 0:continue
            if not v % a:
                w = v // a
                print(f'{h} {n} {w}')
                return

if __name__ == "__main__":
    run()


Measured memory_bytes: 9148
import java.util.ArrayList;
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        long X = sc.nextLong();

        long prop = 100;
        int count = 0;
        double rate = 1.01;

        while(true){
            if(prop<X){
                prop *= rate; count++;
            } else { 
                break;
            }
        }

        System.out.println(count);

        sc.close();
    }
}

Measured memory_bytes: 35756
#include <cstdio>
#include <algorithm>
#include <vector>

using namespace std;

class Node  //??????
{
public:
    int location;
    int p,l,r;
    Node() {}
};

class Point
{
public:
    int id,x,y;
    Point() {}
    Point(int id, int x,int y):id(id),x(x),y(y) {}
    bool operator < (const Point& p)const {return id<p.id; }

    void print()
    {
        printf("%d\n",id);
    }
};

static const int MAX = 1000000;
static const int NIL = -1;

int N; //????????°???
Point P[MAX]; //??????????????????????????????
Node T[MAX]; //???????????????????????????????????????????????¶??????????°±???kd????????????
int np;
//??????????????¨??°????????°
bool lessX(const Point& x, const Point& y) {return x.x<y.x;}
bool lessY(const Point& x, const Point& y) {return x.y<y.y;}

int makeKDTree(int l,int r,int depth)
{
    if(l>=r) return NIL;
    int mid = (l+r)>>1;
    int t=np++; //????????????????¢?
    if(depth%2==0) //??¶??°???????????????x
       sort(P+l,P+r,lessX);
    else sort(P+l,P+r,lessY); //?\???°???????????????y
    T[t].location=mid;
    //?????????????????????????????????
    T[t].l=makeKDTree(l,mid,depth+1);
    T[t].r=makeKDTree(mid+1,r,depth+1); //mmp

    return t; //??°??????????????????????????????????????????
}

void find(int v,int sx,int tx,int sy,int ty,int depth,vector<Point> &ans)
{
    int x=P[T[v].location].x;
    int y=P[T[v].location].y;

    if(sx<=x && x<=tx && sy<=y && y<=ty)  ans.push_back(P[T[v].location]);

    if(depth%2==0) //??¶??°???????????????x??????????????????
    {
        if (T[v].l != NIL) {
            if (sx <= x) find(T[v].l, sx, tx, sy, ty, depth + 1, ans);
        }
        if (T[v].r != NIL) {
            if (x <= tx) find(T[v].r, sx, tx, sy, ty, depth + 1, ans);
        }
    }
    else  //?\???°???????????????y??????????????????
    {
        if(T[v].l!=NIL)
        {
            if(sy<=y) find(T[v].l,sx,tx,sy,ty,depth+1,ans);
        }
        if(T[v].r!=NIL)
        {
            if(y<=ty) find(T[v].r,sx,tx,sy,ty,depth+1,ans);
        }
    }
}

int main()
{
    int x,y;
    scanf("%d",&N);
    for(int i=0;i<N;i++)
    {
        scanf("%d %d",&x,&y);
        P[i]=Point(i,x,y); //create
        T[i].l=T[i].r=T[i].p=NIL; //init
    }

    np=0; //init
    int root=makeKDTree(0,N,0); //??????kd?????????????????????

    int q;
    scanf("%d",&q);
    int sx,tx,sy,ty;
    vector<Point> ans;
    for(int i=0;i<q;i++)
    {
        scanf("%d %d %d %d",&sx,&tx,&sy,&ty);
        ans.clear(); //init
        find(root,sx,tx,sy,ty,0,ans); //????????????????§??£??´¢
        sort(ans.begin(),ans.end());
        for(int j=0;j<ans.size();j++)
        {
            ans[j].print();
        }
        printf("\n");
    }

    return 0;
}

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

int main()
{
	int64_t S;
	cin >> S;

	int64_t x1, y1, x2, y2;

	x1 = 1e9;
	x2 = 1;

	y2 = (S + x1 - 1) / x1;
	y1 = x1*y2 - S;

	cout << "0 0 " << x1 << " " << y1 << " " << x2 << " " << y2 << endl;

	return 0;
}


Measured memory_bytes: 384
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<queue>
#include<map>
#include<iomanip>
#include<set>
#define rep(index,num) for(int index=0;index<num;index++)
#define rep1(index,num) for(int index=1;index<=num;index++)
#define brep(index,num) for(int index=num-1;index>=0;index--)
#define brep1(index,num) for(int index=num;index>0;index--)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-7
#define mp(a1,a2) make_pair(a1,a2)
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef long long ll;
typedef long double ld;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=1e+18+1;
int INF=1e+9+1;
int main(){
	ll N;
	scan(N);
	for(int i=(int)(sqrt(N)+eps);i>=1;i--){
		if(N%i==0){
			prin(N/i+i-2);
			return 0;
		}
	}
	return 0;
}


Measured memory_bytes: 256
fun main (args:Array<String>){
    val seqLen = readLine()!!.toInt()
    val seqList = mutableListOf<Int>(0, 0)
    val inputList = mutableListOf<Int>()
    var input = 0
    for(i in 1..seqLen){
        input = readLine()!!.toInt()
        inputList.add(input)
        if(seqList[0] < input) {
            seqList[0] = input
            continue
        }
        if(seqList[1] <= input){
            seqList[1] = input
        }
    }
    for(i in 0..seqLen-1){
        if(inputList[i] == seqList[0]){
            println(seqList[1])
        }
        else {
            println(seqList[0])
        }
    }
}

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

using namespace std;
#define int long long
int32_t main(int argc, char const *argv[])
{

	    
	int n;
	cin>>n;
	vector<string> a(n);
	for(auto &x: a)	cin>>x;
	map< vector<int> , int> m;
	for(int i=0;i<n;i++)
	{
		vector<int> t(256,0);
		for(int j=0;j<a[i].size();j++)
		{
			t[a[i][j]]++;
		}
		m[t]++;
	}
	int ans = 0;
	for(auto x: m)
	{
			ans += (x.second*(x.second-1))/2;
	}
	cout<<ans;
}

Measured memory_bytes: 216704
import java.util.Scanner;

public class Main {
    
    public static void main(String[] args) {
        Scanner scan=new Scanner(System.in);
        int H=0,W=0,i,j;
        while(true){
        	H=scan.nextInt();
        	W=scan.nextInt();
        	if(H==0 && W==0)break;
        	for(i=0;i<H;i++){
        		for(j=0;j<W;j++){
        			System.out.print("#");
        		}
        		System.out.println("");
        	}
        	System.out.println("");
        }
    }
}

Measured memory_bytes: 34416
#include <stdio.h>
#include <math.h>
 
int main(void)
{
    int n, i;
    int s[1000];
    double m, sum;
    double siguma;
     
    for(; ; ) {
        scanf("%d", &n);
        if(n==0) break;
        else {
            m=0; sum=0;
            for(i=0; i<n; i++) {
                scanf("%d", &s[i]);
                m+=s[i];
            }
            m=(double)m/n;
             
            for(i=0; i<n; i++)
                sum+=pow(s[i]-m, 2);
            sum/=n;
            siguma=sqrt(sum);
            printf("%f\n", siguma);
        }
    }
     
    return 0;
}



Measured memory_bytes: 2044
#include <bits/stdc++.h>
#define INF 1e18
#define int long long
#define Rep(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) Rep(i, 0, n)
#define all(a) (a).begin(), (a).end()
using namespace std;
typedef pair<int, int> P;
typedef pair<int, P> PP;
const int mod = 1000000007;

#define MAX_N 41
#define MAX_M 401

int n, ma, mb;
vector<int> a, b, c;
int dp[MAX_N][MAX_M][MAX_M];
bool vis[MAX_N][MAX_M][MAX_M];

int solve(int N, int A, int B)
{
    if (vis[N][A][B])
        return dp[N][A][B];
    vis[N][A][B] = true;
    if (N == n)
    {
        if (A != 0 && B != 0 && ma * B == A * mb)
            return dp[N][A][B] = 0;
        else
            return dp[N][A][B] = INF;
    }
    return dp[N][A][B] = min(solve(N + 1, A, B), solve(N + 1, A + a[N], B + b[N]) + c[N]);
}

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

    cin >> n >> ma >> mb;
    a.resize(n), b.resize(n), c.resize(n);
    rep(i, n) cin >> a[i] >> b[i] >> c[i];
    int ans = solve(0, 0, 0);
    if (ans >= INF)
        ans = -1;
    cout << ans << endl;
}

Measured memory_bytes: 56064