akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
  int n;
  cin >> n;
  vector<string> s(0);
  vector<int> p(0);
  rep(i, n) {
    string si;
    cin >> si;
    bool hit = false;
    rep(j, s.size()) {
      if (s.at(j) == si) {
        p.at(j)++;
        hit = true;
        break;
      }
    }
    if (!hit) {
      s.push_back(si);
      p.push_back(1);
    }
  }
  cin >> n;
  rep(i, n) {
    string si;
    cin >> si;
    rep(j, s.size()) {
      if (s.at(j) == si) {
        p.at(j)--;
        break;
      }
    }
  }
  int max = 0;
  rep(j, s.size()) if (p.at(j) > max) max = p.at(j);
  cout << max << endl;
}


Measured memory_bytes: 3604
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        String S = sc.next();

        int nWhited = 0;
        int nBlacked = 0;
        for (char s : S.toCharArray()) {
            nBlacked += s == '.' ? 1 : 0;
        }

        int nChanged = nBlacked;
        for (char s : S.toCharArray()) {
            if (s == '#') {
                nWhited += 1;
            } else {
                nBlacked -= 1;
            }

            if (nChanged > nWhited + nBlacked) {
                nChanged = nWhited + nBlacked;
            }
        }

        System.out.println(nChanged);
    }

}


Measured memory_bytes: 28524
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>

#define X first
#define Y second
#define MP make_pair
#define PB push_back

using namespace std;

typedef long long ll;
typedef pair < int, int> pii;
typedef pair < ll, ll> pll;
typedef pair < double, double > pdd;
typedef pdd pt;
typedef vector < int > vi;

const int N = 3e5 + 500;
const int M = 1e6 + 500;
const int INF = 0x3f3f3f3f;
const int MOD = 1e9 + 7;
const int LOG = 18;
const int OFF = (1 << LOG);

ll labs(ll x){
    if(x < 0) return -x;
    return x;
}

ll a[N], n;

ll check(ll x){
    ll sol = 0;
    for(int i = 0;i<n;i++){
        sol += abs(a[i] - (x + i));
    }
    return sol;
}

int main(){
    scanf("%d", &n);
    for(int i = 0;i<n;i++)
        scanf("%lld", a + i);

    ll lo = -1e9 - N, hi = 1e9 + N;
    ll ans = (ll)INF * INF;
    while(lo <= hi){
        ll mid = (lo + hi) / 2;
        if(check(mid) < check(mid + 1)){
            hi = mid - 1;
            if(check(mid) < ans){
                ans = check(mid);
            }
        }
        else{
            lo = mid + 2;
            if(check(mid + 1) < ans){
                ans = check(mid + 1);
            }
        }
    }
    printf("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 1792
#!/usr/bin/env python3
import sys


def solve(N: int, R: int):
    if N >= 10:
        print(R)
    else:
        print(R+100*(10-N))
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    R = int(next(tokens))  # type: int
    solve(N, R)

if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define countof(array) (sizeof(array) / sizeof(array[0]))
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,n,s) for(int i = s; i < (n); ++i)
#define rsrep(i,n,s) for(int i = (n)-1; i >= s; --i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define aall(a) (a), (a)+countof(a)//for array sorting
#define raall(a) (a), (a)+countof(a), greater<>()
#define show(x) cout<<#x<<" = "<<x<<endl;
#define vfind(v, a) find(all(v), a) != v.end()
#define yn(f) { if (f) puts("YES"); else puts("NO"); }
#define yns(f) { if (f) puts("Yes"); else puts("No"); }
#define show_ary(...) { cout<<#__VA_ARGS__<<" = "; for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define show_pair(...) cout<<#__VA_ARGS__<<" = "<<endl; for (const auto& x : (__VA_ARGS__)) { cout<<"  "<<x.fi<<" : "<<x.se<<endl; }
#define out_ary(...) { for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define argmax(v) distance((v).begin(), max_element(all(v)))
#define argmin(v) distance((v).begin(), min_element(all(v)))
#define vmax(v) *max_element(all(v))
#define vmin(v) *min_element(all(v))
typedef long long int ll;
typedef pair<int, int> P;
typedef vector<P> vpair;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<string> vstr;
typedef vector<bool> vbool;
typedef vector<vint> vvint;
typedef vector<vll> vvll;
typedef vector<vstr> vvstr;
typedef vector<vbool> vvbool;
const ll LINF = 2000000000000000000ll;
const int INF = 1000000100;
const ll MOD = 1e9+7;

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

    int ans = max(a - (b * 2), 0);

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import sys

while 1:
    H,W = map(int, raw_input().split())

    if H == 0 and W == 0:
        break

    for i in range(H):
        for j in range(W):
            if j == W-1:
                print "#"
            else:
                sys.stdout.write("#")

        if i == H-1:
            print ""

Measured memory_bytes: 6448
#include <iostream>
#include <set>

using namespace std;

int main() {
  int ans = 0;
  multiset<int> s;
  s.insert(-100);
  int N;
  cin >> N;
  for (int i = 0; i < N; i++) {
    int a;
    cin >> a;
    auto v = s.lower_bound(a);
    v--;
    if (*v == -100) {
      s.insert(a);
    } else {
      s.erase(v);
      s.insert(a);
    }
  }
  s.erase(s.begin());
  cout << s.size() << endl;
}


Measured memory_bytes: 4992
#include<bits/stdc++.h>
using namespace std;
 
 
 
int main(){
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  int x;
  cin>>x;
  
   for(int i=1;i<=180;i++){
    if((360*i)%x==0){
      cout<<(360*i)/x<<endl;
      i=181;
    }
    
   }

}
 
 
 

Measured memory_bytes: 3620
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.typecons;

class p{
	int n;
	int v;
}

p getMax(p[] plist) {
	p pmax = new p;
	foreach(ptmp; plist){
		if(pmax.v < ptmp.v) {
			pmax = ptmp;
		}
	}
	return pmax;
}

void main() {
	auto nq = readln().strip().split();
	int n = to!int(nq[0]);
	int q = to!int(nq[1]);

	p[] plist = new p[n];
	foreach(i; 0..n) {
		plist[i] = new p;
	}

	foreach(i; 0..n) {
		plist[i].n = i;
		plist[i].v = 0;
	}
	int b = max(1,to!int(sqrt(to!real(n))));
	p[] seg = new p[]((n+b-1)/b);
	foreach(i; 0..seg.length) {
		seg[i] = plist[i*b];
	}

	p maxp = getMax(seg);
	foreach(int i; 0..q) {
		auto av = readln().strip().split();
		int a = to!int(av[0]);
		int v = to!int(av[1]);
		plist[a-1].v += v;

		if(plist[a-1] == seg[(a-1)/b] && v < 0)
				seg[(a-1)/b] = getMax(plist[b*((a-1)/b)..min(n, b*((a-1)/b+1))]);
		else if(seg[(a-1)/b].v < plist[a-1].v || (seg[(a-1)/b].v == plist[a-1].v && seg[(a-1)/b].n > plist[a-1].n)) {
			seg[(a-1)/b] = plist[a-1];
		}

		if(plist[a-1] == maxp && v < 0)
			maxp = getMax(seg);
		else if(plist[a-1].v > maxp.v || (plist[a-1].v == maxp.v && plist[a-1].n < maxp.n)) {
			maxp = plist[a-1];
		}

		writefln("%d %d", maxp.n+1, maxp.v);
	}
}

Measured memory_bytes: 47532
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (n); ++i)
typedef long long ll;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}
const ll INF = 1LL << 60;

int main(){
	int a, b; cin >> a >> b;
	if(a <= b) cout << a << endl;
	else cout << a - 1 << endl;
}


Measured memory_bytes: 384
#pragma GCC optimize (3)
#include<vector>
#include<stack>
#include<bitset>
#include<cstdlib>
#include<cmath>
#include<set>
#include<list>
#include<deque>
#include<map>
#include<queue>
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#define PII pair<int,int>
#define ll long long
#define ull unsigned long long
#define INFI 2147483647
#define INFL 9223372036854775807
#define INFU 18446744073709551615
using namespace std;
const double PI = acos(-1.0);
const double eps = 1e-6;
inline int read()
{
	int x = 0, f = 1;
	char ch = getchar();
	while (ch<'0' || ch>'9') {
		if (ch == '-') f = -1;
		ch = getchar();
	}
	while (ch >= '0' && ch <= '9') {
		x = x * 10 + ch - '0';
		ch = getchar();
	}
	return x * f;
}
char s1[100005][15];
map<string, int>mp;
int main()
{
	//ios_base::sync_with_stdio(false);
	//cin.tie(0);
	//cout.tie(0);
	int n = read();
	for (int i = 1; i <= n; i++) scanf("%s", s1[i] + 1);
	for (int i = 1; i <= n; i++) sort(s1[i] + 1, s1[i] + 1 + 10);
	string sss;
	for (int i = 1; i <= n; i++) {
		sss = "";
		for (int j = 1; j <= strlen(s1[i] + 1); j++) sss += s1[i][j];
		mp[sss]++;
	}
	map<string,int>::iterator iter = mp.begin();
	ll ans = 0;
	for (; iter != mp.end(); iter++) {
		string a = iter->first;
		ll cnt = mp[a];
		ans += cnt * (cnt - 1) / 2;
	}
	cout << ans;
	return 0;
}


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

using namespace std;
using ll = long long;
using ld = long double;

#define ALL(a) (a).begin(),(a).end()
#define CHMIN(a, b) a = min((a),(b))
#define CHMAX(a, b) a = max((a),(b))
const int INF = 1e9;
const int MOD = 1e9 + 7;

signed main() {
    int a, b, c;
    cin >> a >> b >> c;
    auto total = a + b + c;
    auto m = max(max(a, b), c);
    cout << total - m << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cmath>
#include <set>
#include <queue>
#include <vector>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;

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

	auto result = 0;
	auto right = (int)s.length() - 1;
	for (auto left = 0; left < right; ++left)
	{
		if (s[left] == s[right])
		{
			--right;
		}
		else if(s[left] == 'x')
		{
			++result;
		}
		else
		{
			while (s[right] == 'x')
			{
				++result;
				--right;
			}
			if (s[left] != s[right])
			{
				result = -1;
				break;
			}
			--right;
		}
	}

	cout << result << endl;

	return 0;
}

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

int main() {
  int K, A, B;
  cin >> K >> A >> B;
  
  if (A % K == 0) {
    cout << "OK" << endl;
  } else {
    int a, b;
    a = A / K;
    b = B / K;
    if (a != b) {
	  cout << "OK" << endl;
    } else {
      cout << "NG" << endl;
    }
  }
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
bool comp(string p,string q){
	return (p+q<q+p);
}
int main(){
	int n,l;
	cin>>n>>l;
	vector<string> v(n);
	for(int i=0;i<n;++i){
		cin>>v[i];
	}
	sort(v.begin(),v.end(),comp);
	for(int i=0;i<n;++i) cout<<v[i];
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define REP(i, n) FOR(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define bit(x) (1L << (x))
using ll = long long;
using namespace std;

template<typename T>
vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
 
template<typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v(ts...))>(a,make_v(ts...));
}

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

  auto dp = make_v(n+1, 2, n+1);

  dp[0][0] = 0; dp[0][1] = 0;
  REP(i, n){
    if(s[i] == '#'){
      dp[i+1][0] = dp[i][0] + 1;
      dp[i+1][1] = min(dp[i][1], dp[i][0]);
    } else {
      dp[i+1][0] = dp[i][0];
      dp[i+1][1] = dp[i][1] + 1;
    }
  }

  cout << min(dp[n][0], dp[n][1]) << endl;

  return 0;
}


Measured memory_bytes: 11396
#include <iostream>

using namespace std;

int main(){
  
  int a , b;
  
  cin >> a >> b;
  
  if(a < b){
    
    cout << "a < b" << endl; 
  }
  
  if(a > b){
    
    cout << "a > b" << endl;
  }
  
  if(a == b){
    
    cout << "a == b" << endl;
  }
}


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

#define int long long
long long N;
long long A[100000], D[100000];

signed main() {
  cin >> N;
  long long s = 0;
  for (int i=0; i<N; i++) {
    cin >> A[i];
    s += A[i];
  }
  long long a = (long long)(N+1LL)*N / 2;
  if (s % a == 0) {
    D[0] = A[0] - A[N-1];
    for (int i=1; i<N; i++) {
      D[i] = A[i] - A[i-1];
    }

    long long t = s / a;
    for (int i=0; i<N; i++) D[i] = t - D[i];
    bool f = true;
    for (int i=0; i<N; i++) {
      if (D[i] < 0 || D[i] % N != 0) {
        f = false; break;
      }
    }
    if (f) cout << "YES\n";
    else cout << "NO\n";
  }
  else {
    cout << "NO\n";
  }
  return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define fi first
#define se second
#define mp make_pair
#define itrfor(itr,A) for(auto itr = A.begin(); itr !=A.end();itr++)
#define dame { printf("No\n"); return 0;}
template <class T> using reversed_priority_queue = priority_queue<T, vector<T>, greater<T> >;
typedef long long llong;
char moji[26]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
char moji2[26]={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
char moji3[10]={'0','1','2','3','4','5','6','7','8','9'};
#define Sort(a) sort(a.begin(),a.end());
#define Reverse(a) reverse(a.begin(),a.end());
#define print(a) cout << a << endl;
#define MOD llong(1e9+7)
#define MAX int(2 * 1e5 +5)
#define debug(x)  cout << #x << " = " << (x) << endl;
#define pi acos(-1.0)
#define int llong
#define INF llong(1e17)


signed main(){
    string s;
    cin >> s;
    int n;
    n = s.length();

    int dp[n+1][2];
    REP(i,n+1){
        REP(j,2) dp[i][j] = 0;
    }
    dp[n][0] = 1;

    REPR(i,n-1){
        if(s[n-1-i] == '1'){
            dp[i][1] = 3 * dp[i+1][1] + dp[i+1][0];
            dp[i][1] %= MOD;

            dp[i][0] = 2 * dp[i+1][0];
            dp[i][0] %= MOD;
        }
        if(s[n-1-i] == '0'){
            dp[i][1] = 3 * dp[i+1][1];
            dp[i][1] %= MOD;
            dp[i][0] = dp[i+1][0];
        }
    }
    cout << (dp[0][0] + dp[0][1]) % MOD << endl; 

}


Measured memory_bytes: 2048
#include<bits/stdc++.h>
using namespace std;
 
#define P(p) cout<<(p)<<endl
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define vsort(v) sort(v.begin(), v.end());
#define rvsort(v) sort(v.begin(), v.end(),greater<int>());
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return
#define lb(v,n) lower_bound(v.begin(),v.end(),n)
#define ub(v,n) upper_bound(v.begin(),v.end(),n)
#define mae(v) max_element(v.begin(),v.end())
#define mie(v) min_element(v.begin(),v.end())
#define INF 0x7FFFFFFF
#define mod 1000000007
#define mod9 1000000009
typedef long long ll;
////////////////////////////////////////////////////////////

//input:数 output:<素因数,乗数>のvector
vector<pair<long long, long long> > primeFactrize(long long n) {
		vector<pair<long long, long long> > res;
		for (long long p = 2; p * p <= n; ++p) {
				if (n % p != 0) continue;
				int num = 0;
				while (n % p == 0) { ++num; n /= p; }
				res.push_back(make_pair(p, num));
		}
		if (n != 1) res.push_back(make_pair(n, 1));
		return res;
}

long powMod( long a , long p ){
	if( p == 0 ) return 1;
	else if( p == 1 ) return a % mod;
	else if( p % 2 == 0 ){
		long tmp = powMod( a , p/2 );
		return (tmp * tmp) % mod;
	}
	else{
		long tmp = powMod( a , p/2 );
		return ((tmp%mod * tmp%mod) * a ) % mod;
	}
}

struct combLarge{
	typedef long int_type;
	vector<int_type> fact;
	vector<int_type> revFact;
	void init(int_type N){
		N++;
		fact.assign(N,0);
		revFact.assign(N,0);
		fact[0] = 1;
		for( int i = 1 ; i < N ; i++ ){
			fact[i] = fact[i-1] * i;
			fact[i] %= mod;
		}
		revFact[N-1] = powMod(fact[N-1] , mod - 2);
		for(int i = N-2 ; i >= 0 ; i-- ){
			revFact[i] = revFact[i+1] * (i+1);
			revFact[i] %= mod;
		}
	}
	int_type getC(int_type a , int_type b){
		return (((fact[a] * revFact[b]) % mod) * revFact[a-b] ) % mod;
	}
};

int main(){
	ll n,m;
	cin >> n >> m;
	auto v = primeFactrize(m);

	ll ans = 1;
	rep(i,0,v.size()){
		struct combLarge C;
		C.init(v[i].second+n-1);
		ans *= C.getC(v[i].second+n-1 , v[i].second );
		ans %= mod;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 1860
//*
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <time.h>
#include <stdlib.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <numeric>
#include <functional>
#define MOD 1000000007
#define MAX 0x3f3f3f3f
#define MAX2 0x3f3f3f3f3f3f3f3fll
#define ERR 1e-10
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#pragma warning(disable:4996)
using namespace std;

typedef long long ll;
typedef long double ldb;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;

ll sx, sy, ex, ey;
int n;
pll a[2000];
ll r[2000];

double d[1005][1005];

double sq(double x){return x*x;}

double dis(pll x, pll y)
{
	return sqrt(sq(x.first-y.first)+sq(x.second-y.second));
}

double rd[1005];
int check[1005];
typedef pair<double, int> pdi;
priority_queue<pdi, vector<pdi>, greater<pdi>> pq;

int main()
{
	int i, j, k, l;
	cin>>sx>>sy>>ex>>ey;
	cin>>n;
	for(i=0;i<n;i++) scanf("%lld%lld%lld", &a[i].first, &a[i].second, &r[i]);
	for(i=0;i<n;i++) for(j=0;j<n;j++)
	{
		if(i == j) d[i][j]=0;
		else
		{
			double dx=dis(a[i], a[j]);
			if(dx >= r[i]+r[j]) d[i][j]=dx-r[i]-r[j];
			else d[i][j]=0;
		}
	}
	for(i=0;i<n;i++)
	{
		double dx=dis(mp(sx, sy), a[i]);
		rd[i]=max(0., dx-r[i]);
		pq.emplace(rd[i], i);
	}
	while(pq.size())
	{
		int tar=pq.top().second;
		pq.pop();
		if(check[tar]) continue;
		check[tar]=1;
		for(i=0;i<n;i++)
		{
			if(!check[i] && rd[i] > rd[tar]+d[tar][i])
			{
				rd[i]=rd[tar]+d[tar][i];
				pq.emplace(rd[i], i);
			}
		}
	}
	double ans=dis(mp(sx, sy), mp(ex, ey));
	for(i=0;i<n;i++)
	{
		double dx=dis(mp(ex, ey), a[i]);
		ans=min(ans, rd[i]+max(0., dx-r[i]));
	}
	printf("%.20lf\n", ans);
	return 0;
}
//*/

Measured memory_bytes: 12400
#include<iostream>
#include<math.h>
#include<vector>

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

using namespace std;
typedef long long ll;


int main(){
    double n = 0, d = 0;
    cin >> n >> d;
    int cnt = 0;
    double x = 0, y = 0;
    rep(i, n){
        cin >> x >> y;
        if(sqrt(x*x + y*y) <= d) ++cnt;
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 3840
#include<iostream>
#include<algorithm>
#include<cmath>
#include<bitset>

using namespace std;

int main() {
	int a[4];
	unsigned short x;
	int i, j, s;

	cin >> s;

	for (i = 1000, j = 0; i > 0; i /= 10, j++) {
		a[j] = s / i;
		s -= a[j] * i;
	}

	for (x = 0b0000; x < 0b1000; x++) {
		if (x & 1 == 1) {
			s = a[0] + a[1];
		}
		else {
			s = a[0] - a[1];
		}
		for (i = 1; i < 3; i++) {
			j = (x >> i) & 1;
			if (j == 1) {
				s += a[i + 1];
			}
			else {
				s -= a[i + 1];
			}
		}
		if (s == 7) {
			cout << a[0];
			for (i = 0; i < 3; i++) {
				j = (x >> i) & 1;
				if (j == 1)
					cout << "+";
				else
					cout << "-";
				cout << a[i + 1];
			}
			cout << "=7";

			break;
		}
	}

	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#include<queue>
using namespace std;
inline int read()
{
	int x;char c;
	while((c=getchar())<'0'||c>'9');
	for(x=c-'0';(c=getchar())>='0'&&c<='9';)x=x*10+c-'0';
	return x;
}
#define MN 100000
int a[MN+5],r[MN+5],d[MN+5];
struct cmp{bool operator()(int a,int b){return d[a]>d[b];}};
priority_queue<int,vector<int>,cmp> pq;
int main()
{
	int n=read(),i;
	for(i=2;i<=n;++i)++r[a[i]=read()];
	for(i=1;i<=n;++i)if(!r[i])pq.push(i);
	while(pq.size())
	{
		i=pq.top();pq.pop();
		d[a[i]]=max(d[a[i]],d[i])+1;
		if(!--r[a[i]])pq.push(a[i]);
	}
	printf("%d",d[1]);
}

Measured memory_bytes: 1788
def resolve():
    import sys
    import statistics
    input = sys.stdin.readline
    n = int(input())
    a = [None] * n
    b = [None] * n
    for i in range(n):
        ai, bi = map(int, input().split())
        a[i] = ai
        b[i] = bi
    if n % 2 == 0:
        minmed = statistics.median_high(a) + statistics.median_low(a)
        maxmed = statistics.median_high(b) + statistics.median_low(b)
        print(maxmed - minmed + 1)
    else:
        print(statistics.median(b) - statistics.median(a) + 1)


if __name__ == '__main__':
    resolve()


Measured memory_bytes: 28840
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(long long i=0; i<(int)n; i++)
#define rep2(i,a,n) for(long long i=(a); i<(int)(n); i++)
#define all(vec) vec.begin(),vec.end()
using vi = vector<int>;
using vs = vector<string>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using psi = pair<string, int>;
const int dx[4] = {1, 0,-1, 0};
const int dy[4] = {0, 1, 0,-1};
const int mod = 1e9+7;
int gcd(int a, int b){if(a%b == 0){return(b);}else{return(gcd(b, a%b));}}
int lcm(int a, int b){return a * b / gcd(a, b);}

int N, M, K, H, W, L, R, X;
//string S, T;

signed main(){
  cin >> N >> M;
  int ans = N+M;
  if(ans>=24) ans -= 24;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3436
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    while(true) {
      int m = sc.nextInt();
      int f = sc.nextInt();
      int r = sc.nextInt();
      if(m == -1 && f == -1 && r == -1) {
        break;
      } else if(m == -1 || f == -1) {
        System.out.println("F");
      } else if(m + f >= 80) {
        System.out.println("A");
      } else if(m + f >= 65) {
        System.out.println("B");
      } else if(m + f >= 50) {
        System.out.println("C");
      } else if(m + f >= 30) {
        if(r >= 50) {
          System.out.println("C");
        } else {
          System.out.println("D");
        }
      } else {
        System.out.println("F");
      }
    }
  }
}



Measured memory_bytes: 26372
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;
using LLONG = long long;
const LLONG MOD = 1000000007;
const double PI = 3.14159265359;

int main()
{
    int a; cin >> a;
    cout << a + a * a + a*a*a << endl;
}


Measured memory_bytes: 3564
import kotlin.math.abs
import kotlin.math.max
import kotlin.math.min

//

fun main() {
    tenka1_2018c()
}

fun tenka1_2018c() {
    val n = readLine()!!.toInt()
    val a = LongArray(n)
    for (i in 0 until n) {
        a[i] = readLine()!!.toLong()
    }
    a.sort()
    var sum = 0L
    var left = a[0]
    var right = a[0]
    var i = 1
    var j = n - 1
    while (i <= j) {
        val leftMin = left < right
        val edgeMin = if (leftMin) left else right
        val edgeMax = if (leftMin) right else left
        val minSub = abs(edgeMin - a[j])
        val maxSub = abs(edgeMax - a[i])
        if (minSub > maxSub) {
            sum += minSub
            // edgeMin側をjで更新
            if (leftMin) left = a[j] else right = a[j]
            j--
        } else {
            sum += maxSub
            // edgeMax側をiで更新
            if (leftMin) right = a[i] else left = a[i]
            i++
        }
        
    }
    println(sum)
}

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

namespace A
{
    class Program
    {
        static void Main(string[] args)
        {
            var a = int.Parse(Console.ReadLine());
            var s = Console.ReadLine();
            Console.WriteLine(a >= 3200 ? s : "red");
        }
    }
}


Measured memory_bytes: 13140
#include <iostream>
#include <vector>
#include <utility>
#include <queue>
#include <stack>
#include <cstring>
#include <set>
#include <map>
#include <algorithm>
#include <cmath>
#include <iomanip>
#define ll long long
using namespace std;
ll mod=pow(10,9)+7;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll a,b,c;
    cin>>a>>b>>c;
    ll ans=b/c-a/c;
    if(a%c==0)
    {
      ++ans;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3648
#include<stdio.h>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long ll;
ll rui[1111];
int main()
{
	int num, kai;
	scanf("%d%d", &num, &kai);
	for (int i = 0; i < num; i++)scanf("%lld", &rui[i + 1]), rui[i + 1] += rui[i];
	ll now = 0;
	for (int i = 53; i >= 0; i--)
	{
		int c = 0;
		for (int j = 0; j < num; j++)
		{
			for (int k = j; k < num; k++)
			{
				ll t = rui[k + 1] - rui[j];
				if ((t&(now + (1LL << i))) == (now + (1LL << i)))c++;
			}
		}
		if (c >= kai)now += (1LL << i);
	}
	printf("%lld\n", now);
}

Measured memory_bytes: 128
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>

#include <algorithm>
#include <bitset>
#include <complex>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#include <cassert>
#include <functional>

typedef long long ll;
using namespace std;

#ifndef LOCAL
#define debug(...) ;
#else
#define debug(...) cerr << __LINE__ << " : " << #__VA_ARGS__ << " = " << _tostr(__VA_ARGS__) << endl;

template<typename T>
ostream &operator<<(ostream &out, const vector<T> &v);

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

template<typename T>
ostream &operator<<(ostream &out, const vector<T> &v) {
  out << '{';
  for (const T &item : v) out << item << ", ";
  out << "\b\b}";
  return out;
}

void _tostr_rec(ostringstream &oss) {
  oss << "\b\b \b";
}

template<typename Head, typename... Tail>
void _tostr_rec(ostringstream &oss, Head &&head, Tail &&... tail) {
  oss << head << ", ";
  _tostr_rec(oss, forward<Tail>(tail)...);
}

template<typename... T>
string _tostr(T &&... args) {
  ostringstream oss;
  int size = sizeof...(args);
  if (size > 1) oss << "{";
  _tostr_rec(oss, forward<T>(args)...);
  if (size > 1) oss << "}";
  return oss.str();
}
#endif

#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 200010

// A[i] + A[j] = j - i
// A[i] + i = j - A[j]

int main() {
  int N, A[SIZE];
  map<int, int> counter;
  ll ans = 0;

  scanf("%d", &N);

  for (int i = 0; i < N; i++) {
    scanf("%d", A + i);
    ans += counter[i - A[i]];
    counter[A[i] + i]++;
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 21512
using System;

namespace ALDS1_1_D
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            int min = 2000000001, max = -2000000001;
            while (n-- != 0)
            {
                var a = int.Parse(Console.ReadLine());
                if (a - min > max) max = a - min;
                if (a < min) min = a;
            }
            Console.WriteLine(max);
        }
    }
}

Measured memory_bytes: 9244
#include <iostream>
using namespace std;
int dp[3001][3001][2];
int main()
{
    int n, t;
    cin >> n >> t;
    int a[3004], b[3004];
    for(int i = 0; i < n; i++) cin >> a[i] >> b[i];
    for(int i = 1; i <= n; i++){
        for(int j = 0; j < t; j++){
            dp[i][j][0] = dp[i - 1][j][0];
            dp[i][j][1] = max(dp[i - 1][j][1], dp[i - 1][j][0] + b[i - 1]);
            if(j > 0){
                dp[i][j][0] = max(dp[i][j][0], dp[i][j - 1][0]);
                dp[i][j][1] = max(dp[i][j][1], dp[i][j - 1][1]);
            }
            if(j >= a[i - 1]){
                dp[i][j][0] = max(dp[i][j][0], dp[i - 1][j - a[i - 1]][0] + b[i - 1]);
                dp[i][j][1] = max(dp[i][j][1], dp[i - 1][j - a[i - 1]][1] + b[i - 1]);
            }
        }
    }
    cout << dp[n][t - 1][1] << endl;
}


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

template<typename T, typename U> bool chmin(T &a, const U &b) {
	return (a > b ? a = b, true : false);
}
template<typename T, typename U> bool chmax(T &a, const U &b) {
	return (a < b ? a = b, true : false);
}

typedef long long ll;

#define writeln(n) cout<<n<<"\n";

typedef pair<int, int> P;
typedef pair<string, int> Psi;


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

	map<string ,int> mp;

	string a,b,e;
	int c,d;
	cin>>a>>b>>c>>d>>e;

	mp[a] =c;mp[b]=d;

	mp[e]--;

	cout<<mp[a]<<" "<<mp[b]<<endl;




}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
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(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	map<int, int> cnt;
	rep(i, n){
		int a;
		cin >> a;
		if(cnt[a] > 0){
			cout << "NO" << endl;
			return 0;
		}
		cnt[a]++;
	}
	cout << "YES" << endl;
	return 0;
}

Measured memory_bytes: 9600
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = (ll)(1e+8) + 9;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;
typedef pair<ld, ld> LDP;
int n, m;
vector<int> a[1 << 17];
int p[1 << 17], y[1 << 17];
int main() {
	cin >> n >> m;
	rep(i, m) {
		cin >> p[i] >> y[i];
		a[p[i]].push_back(y[i]);
	}
	rep1(i, n) {
		sort(a[i].begin(), a[i].end());
	}
	rep(i, m) {
		int chk = lower_bound(a[p[i]].begin(), a[p[i]].end(), y[i]) - a[p[i]].begin();
		chk++;
		string ans = to_string(p[i]);
		while (ans.length() < 6)ans = "0" + ans;
		cout << ans;
		ans = to_string(chk);
		while (ans.length() < 6)ans = "0" + ans;
		cout << ans << endl;
	}
	//stop
	return 0;
}

Measured memory_bytes: 8448
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define fi first
#define se second
#define fr(i,l,r) for(int i=l;i<=r;i++)
signed main()
{   //freopen("input.txt", "r", stdin);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin>>n;

    double a[n+1];
    for(int i=1;i<=n;i++)cin>>a[i];

    double dp[n+1][n+1];

  
   for(int i=1;i<n+1;i++)
   {
    for(int j=0;j<n+1;j++)
    {
           if(j>i)dp[i][j]=0;
           else
           {  if(i==1 || j==0)
              {
                   if(i==1)
                   {
                      if(j==0)
                      dp[1][0]=(1-a[i]);
                      if(j==1)
                      dp[1][1]=a[i];  
                   }
                   else
                   {
                    dp[i][0]=dp[i-1][0]*(1-a[i]);
                   }
              }
             else 
            dp[i][j]=dp[i-1][j]*(1-a[i])+dp[i-1][j-1]*a[i];
           }
    }
   }
double ans=0;

for(int i=n/2+1;i<=n;i++)
ans+=dp[n][i];
cout<<setprecision(12)<<ans<<endl;
    return 0;
}

Measured memory_bytes: 70528
#include <stdio.h>
typedef long long ll;
const ll MOD = 1000000007;

ll mlpow(ll x, ll p) { //(x^p) % MOD
    ll tmp = 1;
    if(p == 0) return 1;
    while(p != 0) {
        if(p & 1) tmp = tmp*x % MOD;
        x = x*x % MOD;
        p = p >> 1;
    }
    return tmp;
}

int main() {
    ll m, n;
    scanf("%lld%lld", &m, &n);
    printf("%lld\n", mlpow(m, n));
}



Measured memory_bytes: 2080
#include <iostream>
int main(){
	while(1){
		std::string s[8];

		int x = 0,y = 0;
		for(int i=0;i<8;i++){
			std::cin >> s[i];
			if(std::cin.eof())return 0;
		}
		
		for(int i=0;i<64;i++)
			if(s[i/8][i%8] == '1'){x=i%8,y=i/8;break;}

		char res;
		if(y+1 < 8 && s[y+1][x] == '1'){
			if(x-1 >= 0 && s[y+1][x-1] == '1'){
				if(x+1 < 8 && s[y][x+1] == '1'){
					res = 'G';
				}
				else{
					res = 'D';
				}
			}
			else if(x+1 < 8 && s[y+1][x+1] == '1'){
				if(s[y][x+1] == '1'){
					res = 'A';
				}
				else{
					res = 'F';
				}
			}
			else{
				res = 'B';
			}
		}
		else{
			if(x+1 < 8 && y+1 < 8 && s[y+1][x+1] == '1'){
				res = 'E';
			}
			else{
			res = 'C';
			}
		}

		std::cout << res << std::endl;
	}
}

Measured memory_bytes: 0
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
#include<complex>
#include<numeric>
using namespace std;

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
constexpr ll mod = 1000000007;
const ll INF = mod * mod;
typedef pair<int, int>P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-12;
const ld pi = acos(-1.0);

void chmin(int &a, int b) {
	a = min(a, b);
}
void chmax(int &a, int b) {
	a = max(a, b);
}
ll mod_pow(ll a, ll n, ll m = mod) {
	a %= m;
	ll res = 1;
	while (n) {
		if (n & 1)res = res * a%m;
		a = a * a%m; n >>= 1;
	}
	return res;
}

struct modint {
	ll n;
	modint() :n(0) { ; }
	modint(ll m) :n(m) {
		if (n >= mod)n %= mod;
		else if (n < 0)n = (n%mod + mod) % mod;
	}
	operator int() { return n; }
};
bool operator==(modint a, modint b) { return a.n == b.n; }
modint operator+=(modint &a, modint b) { a.n += b.n; if (a.n >= mod)a.n -= mod; return a; }
modint operator-=(modint &a, modint b) { a.n -= b.n; if (a.n < 0)a.n += mod; return a; }
modint operator*=(modint &a, modint b) { a.n = ((ll)a.n*b.n) % mod; return a; }
modint operator+(modint a, modint b) { return a += b; }
modint operator-(modint a, modint b) { return a -= b; }
modint operator*(modint a, modint b) { return a *= b; }
modint operator^(modint a, int n) {
	if (n == 0)return modint(1);
	modint res = (a*a) ^ (n / 2);
	if (n % 2)res = res * a;
	return res;
}

ll inv(ll a, ll p) {
	return (a == 1 ? 1 : (1 - p * inv(p%a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }
const int max_n = 1 << 18;
modint fact[max_n], factinv[max_n];
void init_f() {
	fact[0] = modint(1);
	for (int i = 0; i < max_n - 1; i++) {
		fact[i + 1] = fact[i] * modint(i + 1);
	}
	factinv[max_n - 1] = modint(1) / fact[max_n - 1];
	for (int i = max_n - 2; i >= 0; i--) {
		factinv[i] = factinv[i + 1] * modint(i + 1);
	}
}
modint comb(int a, int b) {
	if (a < 0 || b < 0 || a < b)return 0;
	return fact[a] * factinv[b] * factinv[a - b];
}

int dx[4] = { 0,1,0,-1 };
int dy[4] = { 1,0,-1,0 };


void solve() {
	string s, t; cin >> s >> t;
	t.pop_back();
	if (s == t) {
		cout << "Yes\n";
	}
	else {
		cout << "No\n";
	}
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//init_f();
	//init();
	solve();
	stop
		return 0;
}


Measured memory_bytes: 7756
#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;
using namespace std;

template<typename T>
class Value{
	T value;
	public:
	Value() { }
	Value(T value) : value(value) { }

	Value<T> add(Value<T> a){ return Value<T>(value + a.get()); }
	Value<T> sub(Value<T> a){ return Value<T>(value - a.get()); }
	Value<T> pro(Value<T> a){ return Value<T>(value * a.get()); }
	Value<T> div(Value<T> a){ return Value<T>(value / a.get()); }
	Value<T> mod(Value<T> a){ return Value<T>(value % a.get()); }
	bool eq(Value<T> a){ return value == a.get(); }
	bool gt(Value<T> a){ return value > a.get(); }
	bool gtq(Value<T> a){ return value >= a.get(); }
	bool lt(Value<T> a){ return value < a.get(); }
	bool ltq(Value<T> a){ return value <= a.get(); }

	T get(){ return value; }
	void set(T v){ value = v; }
};

/* output */
template<typename T>
ostream& operator << (ostream& os, Value<T> t){
	os << t.get();
	return os;
}
void yn(bool b){
	cout << (b ? "Yes" : "No") << endl;
}
template<typename T> void out(Value<T> a){
	cout << a << endl;
}
template<typename T> void out(vector<T> a, bool space = true){
	rep(i,a.size()){
		cout << a[i] << (i + 1 == a.size() ? "\n" : (space ? " " : ""));
	}
}
template<typename T> void out(vector<vector<Value<T>>>& v){
	rep(i,v.size()){
		out(v[i]);
	}
}

/* 多重vector */
template <typename X, typename T>
auto vectors(X x, T a) {
	return vector<T>(x, a);
}

template <typename X, typename Y, typename Z, typename... Zs>
auto vectors(X x, Y y, Z z, Zs... zs) {
	auto cont = vectors(y, z, zs...);
	return vector<decltype(cont)>(x, cont);
}

/* input */
template<typename T>
istream& operator >> (istream& is, Value<T>& t){
	T res;
	is >> res;
	t.set(res);
	return is;
}

template<typename T> T in(){
	T res;
	cin >> res;
	return res;
}
template<typename T> vector<T> in(int n){
	vector<T> res(n);
	rep(i,n) res[i] = in<T>();
	return res;
}
template<typename T> vector<vector<T>> in(int h, int w){
	vector<vector<T>> res(h);
	rep(i,h) res[i] = in<T>(w);
	return res;
}





template<typename T>
void solve(T a){
	yn(a[0].add(a[1]).gtq(a[2]));
}

int main(){
	solve(in<Value<int>>(3));
}


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

int N, M, Q;
vector<int> G[100010];
int c[100010];
int dp[11][100010];

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> N >> M;
    for(int i = 0; i < M; i++){
        int a, b;
        cin >> a >> b;
        G[a].emplace_back(b);
        G[b].emplace_back(a);
    }
    cin >> Q;
    for(int i = 1; i <= Q; i++){
        int v, d;
        cin >> v >> d >> c[i];
        dp[d][v] = i;
    }
    for(int i = 10; i >= 1; i--){
        for(int j = 1; j <= N; j++){
            chmax(dp[i - 1][j], dp[i][j]);
            for(auto u : G[j]){
                chmax(dp[i - 1][u], dp[i][j]);
            }
        }
    }
    for(int i = 1; i <= N; i++){
        cout << c[dp[0][i]] << endl;
    }
    return 0;
}

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

int main(){
    int a,b,h,m;
    cin >> a >> b >> h >> m;
    double ar = (60*h+m)*0.5*2*M_PI/360;
    double br = m*6*2*M_PI/360;

    double x = a*cos(ar) - b*cos(br);
    double y = a*sin(ar) - b*sin(br);
    cout << fixed << setprecision(15) << sqrt(pow(x, 2)+pow(y,2)) << endl;
    return 0;
}

Measured memory_bytes: 4100
#include "bits/stdc++.h"
 
typedef long long ll;
#define int ll
#define fi first
#define se second
#define SORT(a) sort(a.begin(),a.end())
#define rep(i,n) for(int i = 0;i < (n) ; i++) 
#define REP(i,n) for(int i = 0;i < (n) ; i++) 
#define MP(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define INF LLONG_MAX/2

using namespace std;

int MOD = 1000000007;
int a[20010];
int b[20010];
int p[20010];

signed main(){
    int n;
    cin >> n;
    for(int i = 1; i <= n;i++){
        cin >> p[i];
        a[i] = 30000*i;
        b[i] = 30000*(n-i+1);
    }

    for(int i = 1;i <= n;i++){
        b[p[i]] += i;
    }

    for(int i = 1;i <= n;i++){
        cout << a[i] <<  " ";
    }
    cout << endl;
    for(int i = 1;i <= n;i++){
        cout << b[i] <<  " ";
    }
    cout << endl;


    
    
    return 0;
}
// g++ -std=c++14 code1.cpp
// rm -r -f test;oj dl 

Measured memory_bytes: 1152
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <sstream>
#include <algorithm>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <list>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <climits>
#include <bitset>
#include <functional>
#include <numeric>
#include <ctime>
#include <cassert>
#include <cstring>
#include <fstream>

using namespace std;

#define FOR(i, a, b) for(int (i)=(a);(i)<(b);(i)++)
#define IFOR(i, a, b) for(int (i)=(a);(i)<=(b);(i)++)
#define RFOR(i, a, b) for(int (i)=(a);(i)>=(b);(i)--)
#define REP(i, n) FOR((i), 0, (n))

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

template<class T>
void print_container(T &container, string delim=" ") {
    bool first = true;
    for(auto &t: container){
        if(!first){
            cout << delim;
        }
        first = false;
        cout << t;
    }
    cout << endl;
}

int main() {
    int a;
    cin >> a;
    string s;
    cin >> s;
    if(a >= 3200)
    cout <<s << endl;
    else{
        cout << "red" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
n, m, x, y = (int(i) for i in input().split())
x_list = [int(i) for i in input().split()]
y_list = [int(i) for i in input().split()]

x_list.append(x)
y_list.append(y)

x_max = max(x_list)
y_min = min(y_list)

if (x_max < y_min):
    print('No War')
else:
    print('War')


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


int main(){
  long long l,r;
  long long cal1,min1;
  cin >> l >> r;
  r=min(r,l+4038);

  min1=2018;
  cal1=0;

  for(long long i=l;i<=r;++i){
    for(long long j=i+1;j<=r;++j){
      cal1=(i*j)%2019;
      min1=min(min1,cal1);
    }
  }

  cout << min1 << endl;
  return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;
#define rep(i, begin, n) for (int i = begin; i < n; i++)
#define repe(i, begin, n) for (int i = begin; i <= n; i++)
#define repr(i, begin, n) for (int i = begin; i > begin - n; i--)
#define repre(i, begin, end) for (int i = begin; i >= end; i--)

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 int inf = INT_MAX;
const int MOD = 1000000007;
const long long INF = LLONG_MAX;

// -------------------------------------------------------

ll N;

int main() {
  cin >> N;
  ll last = 1;
  for (ll i = 1; i * i <= N; ++i) {
    if (N % i == 0) {
      last = i;
    }
  }

  ll q = N / last;

  ll ans = 0;
  while (q > 0) {
    ++ans;
    q /= 10;
  }
  cout << ans;
}


Measured memory_bytes: 3560
#include <stdio.h>

int main(void){
    char input[8];
    int i,cnt;
    scanf("%s",input);
    //printf("%s",input);
    cnt=0;
    for(i=0;i<3;i++)
    {
        if('o'==input[i])
        {
            cnt+=1;
        }
    }
    printf("%d",700+100*cnt);
    return 0;
}

Measured memory_bytes: 128
import sys
input = sys.stdin.buffer.readline

N = int(input())
a = []
for _ in range(N):
    a.append(int(input()))

p = 2
ans = a[0] - 1
for i in range(1, N):
    if a[i] == p:
        p += 1
    ans += ((a[i]-1)//p)

print(ans)


Measured memory_bytes: 44764
<?php /*atcoder.php*/

$at = new Atcoder();
$at->main();
unset($at);

class Atcoder{
	private function lineIn(){
		$buf = fgets(STDIN);
		return $this->killNewLine($buf);
	}
	private function killNewLine($buf = null){
		$buf = str_replace("\r\n", "", $buf);
		$buf = str_replace("\n", "", $buf);
		$buf = str_replace("\r", "", $buf);
		return $buf;
	}

	public function main(){

		$m = array();

		for($i = 0; $i < 5; $i++){
			$m[] = $this->lineIn();
		}

		$aa = array();

		for($i = 0; $i < 5; $i++){
			$buf = $m[$i] % 10;
			$buf = 0 == $buf ? 0 : abs(10 - $buf);
			$aa[] = $buf;
		}

		$lf = min($aa);
		$hf = max($aa);
		
		$sp = false;
		if($lf == $hf){
			$sp = true;
		}

		for($i = 0; $i < 5; $i++){
			if($sp){
				$m[$i] += $aa[$i];
			}else{
				if($hf != $aa[$i]){
					$m[$i] += $aa[$i];
				}
			}
		}

		if($sp){
			$m[0] -= $aa[0];
		}

		$ans = array_sum($m);
		echo $ans . "\n";
	}
}
?>


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

#define ll long long
#define vi vector<int>
#define vl vector<ll>
#define pii pair<int,int>
#define pll pair<ll,ll>
// pll pp; -> (pp.first,pp.second)
// vector<vl> pp(n,vl(2)); sort(pp.begin(),pp.end(),[](vl a,vl b){return a[0]<b[0];});

#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define RREP(i,n) for(ll (i)=(n)-1;(i)>=0;(i)--)
#define DEBUG(x) cout << #x << ": " << x << endl

ll MOD = 1000000000 + 7;
ll a[100001];
ll e[100001];

ll modpow(ll x,ll n){
  if(n==1) return x;
  ll ret = modpow(x*x%MOD,n/2);
  if(n&1) ret *= x;
  return ret%MOD;
}

int main() {
  ll n;
  ll comb = 1;
  cin >> n;
  REP(i,n){
    cin >> a[i];
    e[i] = modpow(i+1,MOD-2);
    //cout << "modpow(" << i+1 << ") = " << e[i] << endl;
    if(i>0) e[i] += e[i-1];
    comb = comb*(i+1)%MOD;
  }
  //REP(i,n) cout << e[i] << endl;

  ll ans=0;
  //DEBUG(comb);
  REP(i,n){
    ll ef = e[i] + e[n-1-i] - 1;
    //cout << "i:" << i << ",ef:" << ef << endl;
    ef %= MOD;
    ans += a[i]*ef%MOD;
    ans %= MOD;
  }
  ans = ans * comb % MOD;

  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1792