akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cstring>
#include <map>
#include <queue>
#include <cmath>
#include <complex> // complex<double> a(1.2 , 2.3);// real(): 1.2, imag()2.3
using namespace std;

#define MOD 1000000007
#define ll long long
#define ld long double
#define FOR(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rmsame(a) sort(all(a)),a.erase(unique(all(a)), a.end())
#define rmvector(a,b) rep(i,a.size())rep(j,b.size())if(a[i]==b[j]){a.erase(a.begin()+i);i--;break;}
#define first_more_idx(ve, num) upper_bound(all(ve), num)-ve.begin() // idx = first_more_idx(ve,num); if(idx = ve.size()) , then not exist
#define first_lessequal_idx(ve, num) lower_bound(all(ve), num)-ve.begin()
#define pq_pair_tB priority_queue <pair<ll,ll>, vector<pair<ll,ll> > , greater<pair<ll,ll> > >
#define pq_pair_ts priority_queue <pair<ll,ll> > // only sort first param
template<typename X> bool exist(vector<X> vec, X item){return find(all(vec), item)!=vec.end();}
ll gcd(ll a, ll b){if(b==0)return a;return gcd(b,a%b);}
ll lcm(ll a, ll b){return a/gcd(a,b)*b;}
ll power(ll x, ll n){if(n == 0) return 1;return  (n%2)? x*power(x, n-1)%MOD : power(x*x%MOD, n/2);}

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

    ll N  ;
    cin >> N ;
    vector<ll> A;
    
    ll now = 0;
    rep(i, N){
        ll inp;
        cin >> inp;
        now += inp;
        A.pb(now);
    }
    
    ll ans = now;
    rep(i, N){
        ll a = A[i];
        ll b = now - A[i];
        ans = min(ans, abs(a-b));
    }
    cout << ans << endl;

    //cout << fixed << setprecision(16) << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,i,an,t,a[111111],b[111111];
int main(){
	scanf("%d",&n);
	for(i=1;i<=n;i++)scanf("%d",&a[i]);
	for(i=1;i<=n;i++)if(a[i]!=a[i-1])b[++t]=a[i];
	for(i=3;i<=t;i++){
		if(b[i]>b[i-1]&&b[i-1]<b[i-2]||b[i]<b[i-1]&&b[i-1]>b[i-2])an++,i++;
	}
	printf("%d\n",an+1);
}

Measured memory_bytes: 1024
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int cnt = 0;
        for (int i = a; i <= b; i++) {
            if (c % i == 0) {
               cnt++;
            }
        }
        System.out.println(cnt);
    }
}


Measured memory_bytes: 26352
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, s, n) for(int i = s; i < (int)n; i++)
#define per(i, n) for(int i = n; i >= 0; i--)
#define ROF(i, s, n) for(int i = s; i >= (int)n; i--)
#define FORIT(i, A) for (auto i : A)
#define PRINT(x) cout << (x) << "\n"
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define MP make_pair
#define EACH(i, n) for (__typeof((n).begin()) i = (n).begin(); i != (n).end(); ++i)
#define SZ(a) int((a).size())
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define CLR(a) memset((a), 0 ,sizeof(a))
#define NCLR(a) memset((a), -1 ,sizeof(a))
#define dump(x) cout << #x << " = " << (x) << "\n";
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << "\n";
#define sq(n) (n) * (n)
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef priority_queue<int> maxpq;
typedef priority_queue< int, vector<int>, greater<int> > minpq;
static const double EPS = 1e-10;
static const double PI = acos( -1.0 );
static const int mod = 1000000007;
static const int INF = 1 << 25;
static const LL LL_INF = 1152921504606846976;
static const int dx[] = { -1, 0, 1, 0, 1, -1, 1, -1 };
static const int dy[] = { 0, -1, 0, 1, 1, 1, -1, -1 };

int a, b, c, ans;


int solve( int now, int many, int p ) {
	if ( now == b ) {
		return many == c;
	}
	int res = 0;
	for ( int i = p + 1; i <= a; i++ ) {
		res += solve( now + 1, many + i, i );
	}
	return res;
}


int main() {
	while ( ~scanf( "%d %d %d", &a, &b, &c ) && a && b && c ) {
		ans = solve(0, 0, 0);
		printf( "%d\n", ans );
	}
	return 0;
}

Measured memory_bytes: 1188
A,B,K = map(int, input().split())

if (B-A)>=2*K:
    for i in range(A,A+K,1):
        print(i)
    for j in range(B-K+1,B+1,1):
        print(j)

else:
    for k in range(A,B+1,1):
        print(k)




Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define SIZE 200005
#define INF 1000000005LL
#define MOD 1000000007
using namespace std;
typedef long long int ll;
typedef pair <int,int> P;
int main(){
  int k,x;
  cin >> k >> x;
  if(k*500>=x){
      cout << "Yes" << endl;
  }else{
      cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
/*
ID: learnin7
TASK: test
LANG: C++                 
*/
/* LANG can be C++11 or C++14 for those more recent releases */
#include<bits/stdc++.h>

/*  Macros from Endagorion */
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)

using namespace std;

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<i64, i64> pi64;
typedef double ld;


int main(){
        
    ios_base::sync_with_stdio(0);
    
    //ofstream fout ("test.out");
    //ifstream fin ("test.in");
    //fin >> a >> b;
    //fout << a+b << endl;
    char c;
    cin>>c;
    cout<<char(c+1)<<endl;
    return 0;
}



Measured memory_bytes: 256
N = int(input())
max_counter = 0
ans = 1

for i in range(N+1):
    counter = 0
    ans_i = i
    for j in range(7):
        if i % 2 == 0:
            counter += 1
            i = i / 2
        else:
            if counter > max_counter:
                 max_counter = counter
                 ans = ans_i
            break

print(ans)


Measured memory_bytes: 2940
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<map>
const int N=1e5+5;
using namespace std;
typedef long long ll;
int a[N];
int main()
{
    int n;
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
        scanf("%d",&a[i]);
    ll ans=0;
    for(int i=1;i<=n;i++){
        int z=min(a[i],a[i-1]);
        ans+=z;
        a[i-1]-=z;
        a[i]-=z;
        if(a[i]>=2){
            ans+=a[i]/2;
            a[i]%=2;
        }
    }
    printf("%lld\n",ans);
}


Measured memory_bytes: 512
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <deque>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <ctime>
#include <iterator>
#include <bitset>
#include <numeric>
#include <list>
#include <iomanip>
#include <cassert>
#include <array>
#include <tuple>
#include <initializer_list>
#include <unordered_set>
#include <unordered_map>
#include <forward_list>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i = 0; i < (int)(n); ++i)

int main() {
    string s;
    while (cin >> s) {
        bool ok = false;
        for (int i = 0; i < s.size(); i++) {
            for (int j = i + 1; j < s.size(); j++) {
                if (s[i] == 'C' && s[j] == 'F') {
                    ok = true;
                }
            }
        }
        puts(ok ? "Yes" : "No");
    }
}

Measured memory_bytes: 256
#include<cstdio>

using namespace std;

int main(){
    int n;
    scanf("%d", &n);
    int num = 0;
    int a = n;
    while(true){
        if (a != 0){
            num += a % 10;
            a /= 10;
        }else break;
    }
    // printf("%d\n", num);
    if(n % num == 0) puts("Yes");
    else puts("No");
}

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

int main(){

	std::string str;
	while (std::cin >> str){
		if (str == "-")break;

		int m;
		std::cin >> m;

		for (int i = 0; i < m; i++){
			int h;
			std::cin >> h;
			std::string str2;
			str2 = str.substr(0, h);
			str.erase(0, h);
			str += str2;
		}

		std::cout << str << std::endl;
	}
	return 0;
}


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


#define int long long
#define ct(n) cout << n << endl;
#define cts(n) cout << n << " ";
#define cte cout << endl;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define repo(i,o,n) for(int i=o;i<n;i++)
#define repm(i,n) for(int i=n-1;i>=0;i--)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define sperase(v,n) (v).erase(remove(all(v), n), (v).end());
#define vdelete(v) (v).erase(unique(all(v)), (v).end());
#define vcopy(v1,v2) copy((v1).begin(), (v1).end(), back_inserter((v2)));
#define pb(n) push_back(n);

int n,a[2][100],dp[2][100];

main() {
    cin >> n;
    rep(i,2) rep(j,n) cin >> a[i][j];
    dp[0][0] = a[0][0];
    dp[1][0] = dp[0][0] + a[1][0];
    rep1(i,n-1) dp[0][i] = dp[0][i-1]+a[0][i];
    rep1(i,n-1) dp[1][i] = max(dp[1][i-1],dp[0][i])+a[1][i];
    ct(dp[1][n-1])
}



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

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


bool comp2(pair<pair<int,int>,int>a,pair<pair<int,int>,int>b){
    int x = a.first.first;
    int y = a.first.second;
    int w = b.first.first;
    int z = b.first.second;
    if(x*z==y*w){
        return 1;
    }
    if(x*z>y*w){
        return 0;
    }
    if(x*z<y*w){
        return 0;
    }
}

bool comp(pair<pair<int,int>,int>a,pair<pair<int,int>,int>b){
    int x = a.first.first;
    int y = a.first.second;
    int w = b.first.first;
    int z = b.first.second;
    if(x*z==y*w){
        return 0;
    }
    if(x*z>y*w){
        return 1;
    }
    if(x*z<y*w){
        return 0;
    }
}

int main(){
    int h,w;
    cin >> h >> w;
    vector<string>v(h);
    rep(i,h)cin >> v[h-i-1];
    rep(i,h)v[i].push_back('.');
    rep(i,h)v[i] = "."+v[i];
    string ssss;
    rep(i,w+2)ssss.push_back('.');
    v.push_back(ssss);
    vector<pair<pair<int,int>,int> > p;
    for(int i=0;i<h;i++){
        for(int j=0;j<w+1;j++){
            if(v[i][j]=='#'&&v[i][j+1]=='#'&&v[i+1][j]=='.'&&v[i+1][j+1]=='#'){
                p.push_back(make_pair(make_pair(i+1,j),-1));
            }
            if(v[i][j]=='.'&&v[i][j+1]=='.'&&v[i+1][j]=='#'&&v[i+1][j+1]=='.'){
                p.push_back(make_pair(make_pair(i+1,j),-1));
            }
            if(v[i][j]=='#'&&v[i][j+1]=='.'&&v[i+1][j]=='#'&&v[i+1][j+1]=='#'){
                p.push_back(make_pair(make_pair(i+1,j),1));
            }
            if(v[i][j]=='.'&&v[i][j+1]=='#'&&v[i+1][j]=='.'&&v[i+1][j+1]=='.'){
                p.push_back(make_pair(make_pair(i+1,j),1));
            }
        }
    }
    sort(p.begin(),p.end(),comp);
    int mx = 2;
    int cnt = 1;
    // rep(i,h+1){
    //     rep(j,w+2){
    //         cout << v[i][j];
    //     }
    //     cout <<endl;
    // }
    for(int i=0;i<p.size();i++){
        //cout << p[i].first.first << " " << p[i].first.second << " " << p[i].second << " " << cnt<< endl;
        if(i==p.size()-1){
            cnt += p[i].second;
            mx = max(mx,cnt);
        }else{
            if(!comp2(p[i],p[i+1])){
                cnt += p[i].second;
                mx = max(mx,cnt);
            }else{
                cnt += p[i].second;
            }
        }
    }
    cout << mx << endl;
    return 0;
}


Measured memory_bytes: 5196
N, A, B, C, D, E = [int(input()) for _ in range(6)]

transportations = [A, B, C, D, E]

bottleneck = min(transportations)
bottleneck_way = transportations.index(bottleneck)

print(-(-N // bottleneck) + bottleneck_way + 4 - bottleneck_way)

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

int main()
{
  int n;
  cin >> n;
  vector<vector<int>> a(2, vector<int>(n));
  for(auto& i : a){
    for(auto& j : i){
      cin >> j;
    }
  }
  int ret = 0;
  int tempsum = 0;
  for(int i = 0; i < n; ++i){
    tempsum += a[0][i];
    int tempret = tempsum;
    for(int j = i; j < n; ++j){
      tempret += a[1][j];
    }
    ret = max(ret, tempret);
  }
  cout << ret << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
typedef long long ll;
typedef long double ld;
#define mod 1000000007
ll powmod(ll a, ll b)
{
    ll res = 1;
    while (b) {
        if (b&1) {
            res *= a;
            res %= mod;
        }
        b >>= 1;
        a = (a * a) % mod;
    }
    return res;
}
 unordered_map<ll,ll>facti;
 ll fact(ll n)
 {
	if(n==0)return 1;
	if(n<=1)return 1;
	if(facti[n]!=0)return facti[n];
	return facti[n]=(n*fact(n-1))%mod;
 }
  ll ncr(ll n,ll r)
  {
        ll h=fact(n);
	ll v=fact(r);
	ll j=fact(n-r);
	v=v*j;
	v%=mod;
	v=powmod(v,mod-2);
	return (h*v)%mod;
 }
 ll getit(ll num,vector<ll>v)
 {
     ll start = 0; 
    ll end = v.size() - 1; 
    ll ans = -1; 
    ll mid; 
  
    while (start <= end) { 
        mid = (start + end) / 2; 
        if (v[mid] >= num) { 
            end = mid - 1; 
            ans = mid; 
        } 
        else { 
            start = mid + 1; 
        } 
    } 
    return ans; 
 }
void solve()
{
 ll a,b;
 cin>>a>>b;
 set<ll>s;
  s.insert(1);
  s.insert(2);
  s.insert(3);
  s.erase(s.find(a));
  s.erase(s.find(b));
  cout<<*(s.begin());
}
int main()
{
    
        solve();
    
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main()
{
    int n, m, l, i, j, k, a[100][100], b[100][100];
    long long tmp;

    scanf("%d%d%d", &n, &m, &l);
    for(i = 0; i < n; i++) {
        scanf("\n");
        for(k = 0; k < m; k++) {
            scanf("%d", &a[i][k]);
        }
    }
    for(k = 0; k < m; k++) {
        scanf("\n");
        for(j = 0; j < l; j++) {
            scanf("%d", &b[k][j]);
        }
    }

    for(i = 0; i < n; i++) {
        for(j = 0; j < l; j++) {
            tmp = 0;
            for(k = 0; k < m; k++) {
                tmp += a[i][k] * b[k][j];
            }
            if(j < l - 1) printf("%lld ", tmp);
            else printf("%lld\n", tmp);
        }
    }
}



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

int main() {
  int N, A, x, y, a;
  cin >> N;
  
  for (int i = 0; i < N; i++) {
    cin >> A;
    a = A % 2;
    x = 0;
    if (a != 1) {
      while (a != 1) {
        a = A % 2;
        A /= 2;
        a = A % 2;
        x++;
      }
    }
    if (i == 0) {
      y = x;
    }
    if (i >= 1 && x < y) {
      y = x;
    }
  }
  cout << y << endl;
}


Measured memory_bytes: 256
from math import gcd
n=int(input())
sum1=0
for i in range(1,n+1):
	for j in range(1,n+1):
		gcd1=gcd(i,j)
		for k in range(1,n+1):
			gcd2=gcd(gcd1,k)
			sum1+=gcd2
print(sum1)


Measured memory_bytes: 9172
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int INF = 1e9;
const int MOD = 1e9 + 7;

int main()
{
  int n;
  cin >> n;
  vector<ll> a(n);
  for (auto &e : a)
    cin >> e;

  sort(a.begin(), a.end(), greater<ll>());

  for (int i = 0; i < n - 1; ++i)
  {
    if (a[i] > a[i + 1] * 2)
    {
      if (a[i] > 2 * accumulate(a.begin() + i + 1, a.end(), 0))
      {
        cout << i + 1 << endl;
        return 0;
      }
    }
  }
  cout << n << endl;

  return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<numeric>
#include<utility>

using namespace std;

typedef long long int ll;
const int INF = 1<<30;
const long long LINF = 1LL<<60;

long long gcd(long long x, long long y){
    if(y == 0)return x;
    return gcd(y, x % y);
}

long long lcm(long long x, long long y){
    return x / gcd(x, y) * y;
}

int main(){
    ll n, m, ans = 0;
    cin >> n >> m;
    vector<ll> a(n);
    for(int i = 0; i < n; i++){
        cin >> a[i];
        a[i] /= 2;
    }
    bool f = true;
    ll g = 1;
    for(int i = 0; i < n; i++){
        g = lcm(g, a[i]);
        if(g > m){
            f = false;
            break;
        }
    }
    if(f){
        for(int i = 0; i < n; i++){
            if((g / a[i]) % 2 == 0){
                f = false;
                break;
            }            
        }
    }
    if(f){
        ans = (m / g + 1) / 2;
        cout << ans << endl;
    }else{
        cout << 0 << endl;
    }
    return 0;
}


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

#define vec(v) vector<int>(v)
#define be(v) (v).begin(), (v).end()
#define pb(q) push_back(q)
#define mapci(mp) map<char*,int>(mp)
#define mapcc(mp) map<char*,char*>(mp)
typedef long long ll;
using namespace std;

int main() {
    int n;
    scanf("%d",&n);
    ll a[n],b[n],m,ans=0;
    for(int i=0;i<n;i++){
        scanf("%lld %lld",&a[i],&b[i]);
    }
    for(int i=n-1;i>=0;i--){
        m=(a[i]+ans)%b[i];
        if(m!=0){
            ans+=b[i]-m;
        }
    }
    cout << ans<<endl;
    return 0;
}


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

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #ifdef DEBUG
        freopen("in.txt", "r", stdin);
    #endif
    
    int a, b, c; cin >> a >> b >> c;
    cout << min(b / a, c) << '\n';
    
    return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<random>
#include<array>
#include<cassert>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())


//int dp[101][101][]
int dp[500000];

int n,W;
int _w[100],_v[100];
vector<long long> v[4];
long long minw;


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

	minw=1<<30;
	
	cin>>n>>W;
	rep(i,n){
		cin>>_w[i]>>_v[i];
	}
	minw = *min_element(_w,_w+n);
	rep(i, 4)v[i].push_back(0);
	rep(i,n){
		v[_w[i]-minw].push_back(_v[i]);
	}
	rep(i,4){
		sort(v[i].begin()+1,v[i].end(),greater<long long>());
		rep(j,v[i].size()-1){
			v[i][j + 1] += v[i][j];
		}
	}
	long long ans=0;
	rep(i,v[0].size())rep(j,v[1].size())rep(k,v[2].size())rep(h,v[3].size()){
		long long w = (minw)*i + (minw + 1)*j + (minw + 2)*k + (minw+3)*h;
		if (w > W)break;
		ans = max(ans, v[0][i]+v[1][j]+v[2][k]+v[3][h]);

	}
	cout<<ans<<endl;



	return 0;
}

Measured memory_bytes: 256
using System;

class Range
{
    public static void Main()
    {
        String[] str = Console.ReadLine().Split(' ');
        int a = int.Parse(str[0]);
        int b = int.Parse(str[1]);
        int c = int.Parse(str[2]);
        if (a < b && b < c)
        {
            Console.WriteLine("Yes");
        }
        else
        {
            Console.WriteLine("No");
        }
    }
}


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

unsigned long xor128() {
    static unsigned long x=123456789,y=362436069,z=521288629,w=88675123;
    unsigned long t;
    t=(x^(x<<11));x=y;y=z;z=w; return( w=(w^(w>>19))^(t^(t>>8)) );
}

int main()
{
    int n;
    cin >> n;
    vector<string> s(n);
    int win = -1;
    for(int i=0; i<n; ++i){
        cin >> s[i];
        if(count(s[i].begin(), s[i].end(), 'o') == n-1)
            win = i+1;
    }

    if(win != -1){
        for(int i=0; i<1000; ++i)
            cout << win << endl;
    }else{
        for(int i=0; i<1000; ++i)
            cout << (xor128()%n+1) << endl;
    }

    return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
typedef long long  ll;
#define FOR(i,a,n) for(ll i=(ll)a;i<(ll)n;i++)
#define RFOR(i,a,n) for(ll i=(ll)n-1;i >= (ll)a;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,0,n)
#define ALL(v) v.begin(), v.end()
#define bra(first,second) '(' << first << ',' << second << ')'
ll MOD = 1000000007;
//ll INF = 21474836470000000;
ll INF = 1001001001001001001;
long double EPS = 1e-11;
long double PI = 3.141592653589793238;
template<typename T>
void remove(std::vector<T>& vector, unsigned int index){
    vector.erase(vector.begin() + index);
}

using Graph = vector<vector<pair<ll,ll>>>;

int main(){
    ll N;
    cin >> N;
    vector<ll> P(N),A(N),B(N),C(N);
    rep(i,N) cin >> P[i];
    rep(i,N){
        C[P[i]-1] = i+1;
    }
    rep(i,N){
        A[i] = 40000 * (i+1);
        B[i] = 40000 * (N-i-1) + C[i];
    }
    rep(i,N) cout << A[i] << ' ';
    cout << endl;
    rep(i,N) cout << B[i] << ' ';
    cout << endl;
}


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

using namespace std;

void solve() {
    long double N, K;
    cin >> N >> K;

    long double ans;
    ans = 0;
    for (int i = 1; i <= N; i++)
    {   
        if (i < K)
        {
            ans += powl(0.5, ceil(log2(K/i)));
        }
        else
        {
            ans += 1;
        }
        
    }
    ans = ans / N;
    cout << fixed << setprecision(15) << ans << endl;
}

int main() {
    solve();
    return 0;
}

Measured memory_bytes: 3824
#include<stdio.h>
int main()
{
  int k,n,s=0;
  scanf("%d%d",&n,&k);
  int a[n];
  for(int i=0;i<n;++i)
    scanf("%d",&a[i]);
  for(int i=0;i<n;++i)
  {
   	for(int j=0;j<n-1-i;++j)
   	{
    	if(a[j]>a[j+1])
    	{
    		int t=a[j];
        	a[j]=a[j+1];
        	a[j+1]=t;
    	}
   	}
}
for(int i=0;i<k;++i)
  s+=a[i];
  printf("%d",s);
  return 0;
}

Measured memory_bytes: 1736
#include<cstdio>
#include<algorithm>
using namespace std;
int n,m,P[100100],D[100100];
int find(int x)
{
    if (x != P[x]) {
        int r = P[x];
        P[x] = find(P[x]);
        D[x] += D[r];
    }
    return P[x];
}

int main()
{
    scanf("%d %d", &n, &m);
    for (int i=1; i<=n; i++) P[i] = i;

    for (int i=0; i<m; i++) {
        int l,r,d; scanf("%d %d %d",&l,&r,&d);
        int L = find(l);
        int R = find(r);
        if (L != R) {
            P[R] = L;
            D[R] = d + D[l] - D[r];
        } else {
            if (D[r] - D[l] != d) {
                puts("No");
                return 0;
            }
        }
    }
    puts("Yes");
    return 0;
}


Measured memory_bytes: 896
#include <iostream>
#include <vector>
#include <algorithm>
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
#define REP(i, n) for(int i = 1; i < (int)(n); ++i)
using namespace std;

int main() {
    int N;
    cin >> N;
    if (N % 10 == 3) cout << "bon\n";
    else if (N % 10 == 1 || N % 10 == 6 || N % 10 == 8 || N % 10 == 0) cout << "pon\n";
    else cout << "hon\n";
    return 0;
}



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

struct P {
	int x;
	int y;
};

int maxstep(P start, vector<vector<string>> field)
{
	vector<P> move = {
		{-1, 0},
		{1, 0},
		{0, -1},
		{0, 1},
	};

	vector<vector<int>> step(field.size(), vector<int>(field[0].size(), -1));

	queue<P> q;
	q.push(start);
	step[start.x][start.y] = 0;
	int r = 0;
	while (!q.empty())
	{
		P cur = q.front(); q.pop();
		for (auto m : move)
		{
			P next = P{ cur.x + m.x, cur.y + m.y };
			if (next.x < 0 || field.size() <= next.x || next.y < 0 || field[0].size() <= next.y)
			{
				continue;
			}
			if (field[next.x][next.y] == "#")
			{
				continue;
			}
			if (step[next.x][next.y] >= 0)
			{
				continue;
			}
			step[next.x][next.y] = step[cur.x][cur.y] + 1;
			q.push(P{ next.x, next.y });

			r = max(r, step[next.x][next.y]);
		}
	}

	return r;
}

int main() {
	int h, w;
	cin >> h >> w;

	vector<vector<string>> field(h, vector<string>(w));
	for (int i = 0; i < h; ++i)
	{
		string s;
		cin >> s;
		for (int j = 0; j < w; ++j)
		{
			field[i][j] = s[j];
		}
	}

	int r = 0;
	for (int i = 0; i < h; ++i)
	{
		for (int j = 0; j < w; ++j)
		{
			if (field[i][j] == "#") {
				continue;
			}

			int mstep;
			mstep = maxstep(P{ i, j }, field);
			r = max(r, mstep);
		}
	}

	cout << r;
}


Measured memory_bytes: 256
// AOJ 2819 Country in Distortion
// 2019.4.6 bal4u

#include <stdio.h>
#include <stdlib.h>

//// 高速入力
#if 1
#define gc() getchar_unlocked()
#else
#define gc() getchar()
#endif
int in()
{
	int n = 0, c = gc();
//	while (isspace(c)) c = gc();
	do n = 10 * n + (c & 0xf), c = gc(); while (c >= '0');
	return n;
}


//// 優先度付きキュー（ダイクストラ法のため）
#define MAX 500000
typedef struct { int n; long long s; char v, f; } QUE;
QUE que[MAX]; int qsize;

#define PARENT(i) ((i)>>1)
#define LEFT(i)   ((i)<<1)
#define RIGHT(i)  (((i)<<1)+1)

void min_heapify(int i)
{
	int l, r, min;
	QUE qt;

	l = LEFT(i), r = RIGHT(i);
	if (l < qsize && que[l].s < que[i].s) min = l; else min = i;
	if (r < qsize && que[r].s < que[min].s) min = r;
	if (min != i) {
		qt = que[i]; que[i] = que[min]; que[min] = qt;
		min_heapify(min);
	}
}

void deq()
{
	que[0] = que[--qsize];
	min_heapify(0);
}

void enq(int n, int v, long long s, int f)
{
	int i, min;
	QUE qt;

	i = qsize++;
	que[i].n = n, que[i].v = v, que[i].s = s, que[i].f = f;
	while (i > 0 && que[min = PARENT(i)].s > que[i].s) {
		qt = que[i]; que[i] = que[min]; que[min] = qt;
		i = min;
	}
}


//// 本問題関連
int N;
int hi[505], to[505][505], tm[505][505];
char vis[505][50][2];
int v0, a, b, c;

long long dijkstra(int start, int goal)
{
	int i, n, v, f, nx, nv;
	long long s;

	enq(start, v0, 0, 0);
	while (qsize) {
		n = que[0].n, v = que[0].v, s = que[0].s, f = que[0].f, deq();

		if (n == goal) f = 1;
		else if (n == start) { if (f == 1) return s; }

		if (vis[n][v][f]) continue;
		vis[n][v][f] = 1;

		nv = (a*v + b) % c;
		for (i = 0; i < hi[n]; i++) {
			nx = to[n][i];
			if (!vis[nx][nv][f]) enq(nx, nv, s + (long long)v * tm[n][i], f);
		}
	}
	return -1LL;
}

int main()
{
	int k, M, x, y, t;

	N = in(), M = in();
	while (M--) {
		x = in() - 1, y = in() - 1, t = in();
		k = hi[x]++, to[x][k] = y, tm[x][k] = t;
		k = hi[y]++, to[y][k] = x, tm[y][k] = t;
	}
	v0 = in();
	a = in(), b = in(), c = in();
	printf("%lld\n", dijkstra(0, N - 1));
	return 0;
}


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


int main() {
  string S; cin >> S;
  int a = 0;

  for(int i=0; i<4; i++){
    if(S[i] == '+') a++;
    else if(S[i] == '-') a--;
  }

  cout << a << endl;

  return 0;
}


Measured memory_bytes: 256
import java.util.*;
class Main {
    public static void main (String[] args) {
        Scanner sc = new Scanner (System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int temp;
        
        if (b < a){
            temp = a;
            a = b;
            b = temp;
        }
        if (c < a){
            temp = a;
            a = c;
            c = temp;
        }
        if (c < b){
            temp = b;
            b = c;
            c = temp;
        }
        System.out.println (a + " " + b + " " + c);
    }
}


Measured memory_bytes: 26392
nums = list(map(int, input().split()))
if nums[0] > nums[1]:
	if nums[1] != 1:
		print('Alice')
	else:
		print('Bob')
elif nums[0] < nums[1]:
	if nums[0] == 1:
		print('Alice')
	else:
		print('Bob')
else:
	print('Draw')

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

using namespace std ;
typedef long long ll;
typedef string str;
typedef pair<int, int> pii;
typedef pair<ll,ll> pll ;
typedef vector<int> vint;
typedef vector<double> vdou ;
typedef vector<ll> vll;
typedef vector<vint> vvint;
typedef vector<str> vstr;
typedef vector<pii> vpii ;
typedef vector<pll> vpll ;

#define REP(i, n) for (ll (i) = 0; (i) < (ll)(n); i++) 
#define FOR(i, a, b) for(ll (i) = a; (i) < (ll)b; i++)
#define ALL(v) (v).begin(),(v).end()
#define MOD 1000000007
#define CHI 1000000000000000003
#define NIL -1
#define FI first
#define SE second
#define MP make_pair
#define PB push_back
#define PF push_front
#define TS to_string
#define NP next_permutation
#define SZ(x)  (ll)x.size()
#define SP(x)  setprecision((ll)x)

const int INF = 1e9;
const ll LINF = 1e18;
const double EPS = 1e-9;
const double PI = M_PI;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
ll gcd(ll a, ll b) {return b ? gcd(b, a % b) : a;} //最大公約数
ll lcm(ll a, ll b) {return a / gcd(a, b) * b;} //最小公倍数

void yes(){
  cout <<"Yes"<<endl ;
}
void no(){
  cout <<"No"<<endl ;
}
//-----------------------------------------










//-----------------------------------------
int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n, m ;
  cin >> n >> m ;
  priority_queue<int, vector<int>, less<int>> que;
  REP(i,n){
    ll a ;
    cin >> a ;
    que.push(a) ;
  }
  vector<pair<ll,ll>> vec(m) ;
  REP(i,m){
    ll b, c ;
    cin >> b >> c ;
    vec[i] = MP(c,b) ;
  }
  sort(ALL(vec)) ;
  reverse(ALL(vec)) ;
  int cnt = 0 ;
  int i = 0 ;
  while(i<m){
    REP(j,vec[i].SE){
      que.push(vec[i].FI) ;
      cnt++ ;
      if(cnt==n){
        break ;
      }
    }
    if(cnt==n){
      break ;
    }
    i++ ;
  }
  
  ll ans = 0 ;
  
  REP(i,n){
    ans += que.top() ;
    que.pop() ;
  }
  
  cout << ans <<endl ;
    
  
    
    
  
  return 0 ;
}




Measured memory_bytes: 2936
#include <bits/stdc++.h>
using namespace std;
const int INF = 1001001001;

int main() {
int N;
cin >> N;
vector<int> V(N);
vector<int> C(N);
for (int i = 0;i < N;i++) cin >> V.at(i);

for (int i = 0;i < N;i++) cin >> C.at(i);

int X = 0,Y = 0;
for (int i = 0;i < N;i++) {
    if (V.at(i) > C.at(i)) {
        X += V.at(i);
        Y += C.at(i);
    }
}

cout << X-Y << endl;


return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repi(i, s, n) for (int i = (s); i < (n); i++)
#ifdef LOCAL
#define INPUT_FILE                   \
  ifstream in("atcoder-problems/abc142_b.txt"); \
  cin.rdbuf(in.rdbuf());
#define print_vec(v) \
rep(l, v.size()) { cout << v[l] << " "; } \
cout << endl;
#else
#define INPUT_FILE
#define print_vec(v)
#endif
#define CIN_OPTIMIZE \
  cin.tie(0);        \
  ios::sync_with_stdio(false);
typedef pair<int, int> P;
typedef long long ll;
typedef pair<ll, ll> pl;
const int INF = 100100100;
const ll LINF = 1e18+100;
const int MOD = 1e9 + 7;

int main() {
  INPUT_FILE CIN_OPTIMIZE;

  int N, K;
  cin >> N >> K;

  vector<int> c(N);
  rep(i, N) { cin >> c[i]; }

  ll ans = 0;
  rep(i, N) {
    if (c[i] >= K) ans++;
  }

  cout << ans << endl;
}

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

#define int             long long int
#define ld              long double
#define ff              first
#define ss              second
#define pb              push_back

#define vi              vector <int>
#define pii             pair <int, int>
#define vpii            vector <pii>
#define mii             map <int, int>

#define loop(i,s,e)     for(int i=s;i<e;i++)
#define rloop(i,e,s)    for(int i=e;i>=s;i--)
#define mset(a,f)       memset(a,f,sizeof(a))

#define endl            "\n"
#define M               1000000007
#define sz(x)           ((int) x.size())

#define all(p)          p.begin(), p.end()
#define que_max         priority_queue <int>
#define que_min         priority_queue <int, vi, greater<int>>

#define bug(...)        __f (#__VA_ARGS__, __VA_ARGS__)
#define print(a)        for (auto x : a) cout << x << " ";cout << endl
#define Print(a,x,y)    for (int i=x; i<y; i++) cout<< a[i]<< " "; cout << endl

inline int power(int a, int b)
{
	int x = 1;
	while (b)
	{
		if (b & 1) x *= a;
		a *= a;
		b >>= 1;
	}
	return x;
}

template <typename Arg1>
void __f (const char* name, Arg1&& arg1) { cout << name << " : " << arg1 << endl; }
template <typename Arg1, typename... Args>
void __f (const char* names, Arg1&& arg1, Args&&... args)
{
	const char* comma = strchr (names + 1, ',');
	cout.write (names, comma - names) << " : " << arg1 << " | "; __f (comma + 1, args...);
}

const int N = 2e5 + 3;

void solve()
{
	int n;
	cin >> n;
	//cout << n;
	while (n)
	{
		int x = n % 10;
		//bug(x);
		if (x == 7)
		{
			cout << "Yes";
			return;
		}
		n /= 10;
	}
	cout << "No";

	return;
}

int32_t main()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);



	//cout << setprecision(9) << fixed;
	clock_t z = clock();
	int t = 1;
	//cin >> t;
	while (t--)
	{
		solve();
	}
	cerr << "Total Time : " << ((double)(clock() - z) / CLOCKS_PER_SEC);

	return 0;
}


Measured memory_bytes: 3808
#include <bits/stdc++.h>
#define err(args...) {}
#ifdef DEBUG
#include "_debug.cpp"
#endif
using namespace std;
using ll = long long;
using ld = long double;
template <typename T> using lim = numeric_limits<T>;
template <typename T> istream& operator>>(istream& is, vector<T>& a) { for(T& x : a) { is >> x; } return is; }
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n;
    ll k;
    cin >> n >> k;
    vector<ll> a(n);
    cin >> a;
    ll x = 0;
    for(int i = 40; i >= 0; i--) {
        int count0 = 0, count1 = 0;
        for(ll ai : a) {
            count0 += not bool(ai & (1ll << i));
            count1 += bool(ai & (1ll << i));
        }
        ll y = x | (ll(count0 > count1) << i);
        if(y <= k) {
            x = y;
        }
    }
    ll ans = 0;
    for(ll ai : a) {
        ans += x ^ ai;
    }
    cout << ans << endl;
    return 0;
}


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

int main() {
  int n,m;
  cin>>n>>m;
  string vec[n],vecb[m];
  for(int i=0;i<n;i++){
    cin>>vec[i];
  }
  for(int i=0;i<m;i++){
    cin>>vecb[i];
  }
  int a=0;
  for(int i=0;i<n-m+1;i++){
    for(int j=0;j<n-m+1;j++){
      for(int k=0;k<m;k++){
        for(int l=0;l<m;l++){
          if(vec[i+k][j+l]!=vecb[k][l]){
            a++;
          }
        }
      }
      if(a==0){
        cout<<"Yes"<<endl;
        return 0;
      }
      a=0;
    }
  }
  cout<<"No"<<endl;
  return 0;
}

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

int main()
{
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	int k, x;
	cin >> k >> x;
	for (int i = x - (k - 1); i <= x + (k - 1); ++i)
		cout << i << ' ';
	return 0;
}

Measured memory_bytes: 256
#define _DEBUG 1
#define _GLIBCXX_DEBUG

#include <bits/stdc++.h>
using namespace std;

using ll = long long;

#ifdef _DEBUG
#define dump(x) cerr << #x << "=" << x << endl
#define dump2(x, y) cerr << #x << "=" << x << "," << #y << "=" << y << endl
#define dump3(x, y, z)                                                         \
  cerr << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z     \
       << endl
#define check(s) cerr << s << endl
#else
#define dump(x)
#define dump2(x, y)
#define dump3(x, y, z)
#define check(s)
#endif

#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 all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define unique(v) v.erase(unique(v.begin(), v.end()), v.end());

const ll LINF = 2e18;
const int INF = 1e9;

void seeQueue(queue<ll> q) {
  cerr << "{ ";
  while (!q.empty()) {
    ll v = q.front();
    q.pop();
    cerr << v << " ";
  }
  cerr << "}" << endl;
  return;
}

void solve(ll K) {
  queue<ll> q;
  FOR(i, 1, 10) { q.push(i); }

  ll answer;
  for (ll i = 1; i <= K; i++) {
    ll x = q.front();
    if (i == K) {
      answer = x;
      break;
    }
    q.pop();

    ll v = 10 * x + (x % 10);
    if (x % 10 != 0) {
      q.push(v - 1);
    }
    q.push(v);
    if (x % 10 != 9) {
      q.push(v + 1);
    }
  }

  cout << answer << endl;
  return;
}

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


Measured memory_bytes: 1792
#include <iostream>
#include <vector>

using namespace std;

typedef vector<int> V;

int main() {
    V v = V(5);
    for (int i = 0; i < 5; i++) {
        cin >> v[i];
    }
    int k;
    cin >> k;
    for (int i = 0; i < 5; i++) {
        for (int j = i + 1; j < 5; j++) {
            if (abs(v[i] - v[j]) > k) {
                cout << ":(" << "\n";
                return 0;
            }
        }
    }
    cout << "Yay!\n";
}

Measured memory_bytes: 384
#include <iostream>
#include <sstream>
#include <string>
#include <queue>
using namespace std;

struct process {
  int time;
  string name;
};

int main() {
  int n; // num_of_process
  int q; // quantum

  queue<process> que;
  cin >> n >> q;
  for(int i=0;i<n;i++) {
    process p;
    cin >> p.name >> p.time;
    que.push(p);
  }

  int ms = 0; // time count
  while(!que.empty()) {
    process p = que.front();
    que.pop();
    if(p.time > q) {
      p.time = p.time - q;
      ms += q;
      que.push(p);
    }
    else {
      ms += p.time;
      cout << p.name << " " << ms << endl;
    }
  }
}

Measured memory_bytes: 4404
#include<stdio.h>
#include<stdlib.h>

int acs(const void *p, const void *q){
    return *(int *)p - *(int *)q;
}

int main(){
    int N;
    int i, j, k;
    int L[300];
    int ans=0;
    
    scanf("%d", &N);
    for(i=0; i<2*N; i++){
        scanf("%d", &L[i]);
    }

    qsort(L, 2*N, sizeof(int), acs);

    for(i=0; i<2*N; i=i+2){
        ans+=L[i];
    }
    printf("%d", ans);

    return 0;
}

Measured memory_bytes: 128
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<functional>
#include<iomanip>
#include<iostream>
#include<list>
#include<map>
#include<queue>
#include<random>
#include<set>
#include<stack>
#include<string>
#include<utility>
#include<vector>

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

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll>pll;

int main() {
	int X;
    cin>>X;
    if(X==3||X==5||X==7){
        cout<<"YES"<<endl;
    }
    else{
        cout<<"NO"<<endl;
    }



	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <queue>
#include <vector>
#define SORT(a) sort(a.begin(), a.end())
#define RSORT(a) sort(a.rbegin(), a.rend())
#define REP(i, n) for (int i = 0; i < n; i++)
#define RREP(i, n) for (int i = n; 0 <= i; i--)
#define FOR(i, start, end) for (int i = start; i < end; i++)
#define RFOR(i, start, end) for (int i = start; end <= i; i--)
#define ALL(a) a.begin(), a.end()
#define MOD(a) a %= 1'000'000'007
#define INF32 1'050'000'000
#define INF64 4'000'000'000'000'000'000
using ll = long long;
using namespace std;
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; }

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

    string S; cin >> S;
    int min = INF32;
    for (int i=0; i<S.size(); ++i){
        chmin(min, abs(stoi(S.substr(i, 3))-753));
    }
    cout << min << '\n';

    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;
const ll MOD = 1000000007LL;

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

    int mx_loss = 0;
    int sm = 0;
    for (int i = 0; i < 5; i++) {
        int time;
        cin >> time;
        sm += time + (10 - time % 10) % 10;
        mx_loss = max(mx_loss, (10 - time % 10) % 10);
    }

    cout << sm - mx_loss << "\n";
    return 0;
}

Measured memory_bytes: 888
#include <stdio.h>
#include <cstring>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <string>
using namespace std;
const int maxn = 2e5+10;
int son[maxn];
int main(){
    int n, a;
    memset(son, 0, sizeof(son));
    cin>>n;
    for(int i=2; i<=n; i++){
        cin>>a;
        son[a]++;
    }
    for(int i=1; i<=n; i++){
        cout<<son[i]<<endl;
    }
    return 0;
}


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

int main(){
  ll n,m,k;
  cin>>n>>m>>k;
  vector<ll> a(n),b(m);
  rep(i,n) cin>>a[i];
  rep(i,m) cin>>b[i];
  
  vector<ll> c(n+1),d(m+1);
  rep(i,n) c[i+1]=c[i]+a[i];
  rep(j,m) d[j+1]=d[j]+b[j];
  
  ll ans=0;
  rep(i,n+1){
    ll time=c[i];
    if(time>k) continue;
    int p=upper_bound(d.begin(),d.end(),k-time)-d.begin();
    if(p==m&&time+d[m]<=k) ans=max(ans,(ll)p+i);
    else ans=max(ans,(ll)p+i-1);
  } 
  cout<<ans<<endl;
}

Measured memory_bytes: 9552
N = int(input())
CSF = [list(map(int,input().split())) for i in range(N-1)]

for i in range(N):
  time = 0
  for j in range(i, N):
    if j == N-1:
      print(time)
      break ## (まあどうせここで処理終わりなんだけど、高速化のため)
    if time < CSF[j][1]:
      time = CSF[j][0] + CSF[j][1]
    elif time % CSF[j][2] == 0:
      time += CSF[j][0]
    else:
      time += CSF[j][0] + (CSF[j][2] - time % CSF[j][2])
    #print(i,j,time)
      

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

#define ll long long
#define ld long double
#define COIN const int
#define ite iterator
#define PII pair<int,int>
#define PSI pair<string,int>
#define PIS pair<int,string>

#define REP(i,n) for((i)=0;(i)<(int)(n);(i)++)
#define REPD(i,n) for((i)=(n)-1;(i)>=0;(i)--)

#define ALL(c) (c).begin(), (c).end()
#define sz(s) (s).size()
#define CLEAR(x) memset(x,0,sizeof x);

#define MP make_pair
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define X first
#define Y second

#define VI vector<int>
#define VS vector<string>
#define VII vector<PII>
#define VVI vector<VI>

#define PIII 3.1415926
#define PI 3.14
/*****************************************************************************/

using namespace std;

int main()
{
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	ll k,n,m=1,i; cin >>n >>k;
	for (i=1;;i++) {
		m*=k;
		if (m>n) {
			cout <<i; return 0;
		}
	}
}
/******************************************************************************
******************************************************************************/



Measured memory_bytes: 256
#!/usr/bin/env python3
import sys
import itertools as it

def solve(N: int, L: "List[int]"):
    a = 0
    L = sorted(L)
    for k in it.combinations(L,3):
        if (k[0] != k[1] != k[2]) and (k[0]+k[1]>k[2]):
            a+=1
    print(a)

    return


# Generated by 1.1.7.1 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
    L = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, L)

if __name__ == '__main__':
    main()


Measured memory_bytes: 9188
import math

a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

ra = math.ceil(a / 10) * 10 - a
rb = math.ceil(b / 10) * 10 - b
rc = math.ceil(c / 10) * 10 - c
rd = math.ceil(d / 10) * 10 - d
re = math.ceil(e / 10) * 10 - e

ans = a + b + c + d + e + ra + rb + rc + rd + re - max(ra, rb, rc, rd, re)

print(ans)

Measured memory_bytes: 38384
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#define lol(i,n) for(int i=0;i<n;i++)
#define mod 1000000007
typedef long long ll;
using namespace std;
#define N 200010
int main(){
    string s;
    vector<int> v[26];
    cin>>s;
    lol(i,s.size()){
	v[s[i]-'a'].push_back(i);
    }
    lol(i,26){
	v[i].push_back(-1);
	sort(v[i].begin(),v[i].end());
    }
    
    int surf[N];
    int p=s.size(),len=0;
    while(true){
	int mini=mod;
	lol(i,26){
	    int t=*(lower_bound(v[i].begin(),v[i].end(),p)-1);
	    mini=min(mini,t);
	}
	if(mini==-1)break;
	surf[len]=p=mini;
	len++;
    }
    
    len--;
    p=-1;
    for(;len>=0;len--){
	lol(i,26){
	    int t=*upper_bound(v[i].begin(),v[i].end(),p);
	    if(surf[len]<=t){
		char z=i+'a';
		cout<<z;
		p=t;
		break;
	    }
	}
    }
    lol(i,26){
	if(upper_bound(v[i].begin(),v[i].end(),p)==v[i].end()){
	    char z=i+'a';
	    cout<<z<<endl;
	    break;
	}
    }
    return 0;
}


Measured memory_bytes: 1412
import java.util.Scanner;

public class Main {



    public static void main(String args[]){



        Scanner src = new Scanner(System.in);

        int d = src.nextInt();
        int t = src.nextInt();
        int s = src.nextInt();

        System.out.println((double)t >= (double)d/(double)s ? "Yes":"No");
    }
}

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

template <class Abel> struct BIT {
    vector<Abel> dat[2];
    Abel UNITY_SUM = 0;                     // to be set
    
    /* [1, n] */
    BIT(int n) { init(n); }
    void init(int n) { for (int iter = 0; iter < 2; ++iter) dat[iter].assign(n + 1, UNITY_SUM); }
    
    /* a, b are 1-indexed, [a, b) */
    inline void sub_add(int p, int a, Abel x) {
        for (int i = a; i < (int)dat[p].size(); i += i & -i)
            dat[p][i] = dat[p][i] + x;
    }
    inline void add(int a, int b, Abel x) {
        sub_add(0, a, x * -(a - 1)); sub_add(1, a, x); sub_add(0, b, x * (b - 1)); sub_add(1, b, x * (-1));
    }
    
    /* a is 1-indexed, [a, b) */
    inline Abel sub_sum(int p, int a) {
        Abel res = UNITY_SUM;
        for (int i = a; i > 0; i -= i & -i) res = res + dat[p][i];
        return res;
    }
    inline Abel sum(int a, int b) {
        return sub_sum(0, b - 1) + sub_sum(1, b - 1) * (b - 1) - sub_sum(0, a - 1) - sub_sum(1, a - 1) * (a - 1);
    }
    
    /* debug */
    void print() {
        for (int i = 1; i < (int)dat[0].size(); ++i) cout << sum(i, i + 1) << ",";
        cout << endl;
    }
};

int main() {
    int N, Q; cin >> N >> Q;
    vector<int> a(N);
    for (int i = 0; i < N; ++i) cin >> a[i];

    vector<int> lefts(Q), rights(Q), ids(Q);
    for (int i = 0; i < Q; ++i) {
        cin >> lefts[i] >> rights[i];
        --lefts[i];
        ids[i] = i;
    }
    sort(ids.begin(), ids.end(), [&](int i, int j) {
            return rights[i] < rights[j];});

    BIT<int> bit(N+5);
    vector<int> prev(1100000, -1);
    vector<int> res(Q, 0);
    int r = 0;
    for (auto i : ids) {
        for (; r < rights[i]; ++r) {
            bit.add(prev[a[r]]+2, r+2, 1);
            prev[a[r]] = r;
        }
        int tmp = bit.sum(lefts[i]+1, lefts[i]+2);
        res[i] = max(res[i], tmp);
    }
    for (int i = 0; i < Q; ++i) cout << res[i] << endl;
}

Measured memory_bytes: 21732