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

#define REP(i,init, n) for(lli i=init;i<n;i++)
#define REPE(i,init, n) for(lli i=init;i<=n;i++)
#define REPIT(it,container) for(auto it = container.begin(); it != container.end(); it++)
#define REPIT_R(it,container) for(auto it = container.rbegin(); it != container.rend(); it++)

#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))

typedef long long int lli;
typedef pair<lli, lli> P;

int main() {
    string s;
    cin >> s;
    lli len = s.length();
    lli ans = 0;
    lli i = 0;
    lli a_count = 0;
    while (true) {
        if (i+2>= len)
            break;

        if (s[i] == 'A' && s[i+1] == 'B' && s[i+2] == 'C') {
            // チェンジしてインクリメント
            s[i] = 'B';
            s[i+1] = 'C';
            s[i+2] = 'A';
            ans += 1;
            //cout << "ans added" << ans << "(a_count: " << a_count << ")" << endl;
            ans += a_count;
            // Aを指している
            i += 2;
        }
        else if (s[i] == 'A' && s[i+1] == 'A') {
            a_count++;
            i++;
        }
        else {
            a_count = 0;
            i++;
        }
    }
    // REP(i, 0, len-2) {
    //     if (s[i] == 'A' && s[i+1] == 'B' && s[i+2] == 'C') {
    //         s[i] = 'B';
    //         s[i+1] = 'C';
    //         s[i+2] = 'A';
    //         ans++;
    //         //cout << "ans incremented: " << ans << endl;
    //         // 突入
    //         lli j = i+2;
    //         lli a_count = 1;
    //         while (true) {
    //             if (j+2>= len)
    //                 break;

    //             if (s[j] == 'A' && s[j+1] == 'B' && s[j+2] == 'C') {
    //                 // チェンジしてインクリメント
    //                 s[j] = 'B';
    //                 s[j+1] = 'C';
    //                 s[j+2] = 'A';
    //                 ans += a_count;
    //                 //cout << "ans added" << ans << "(a_count: " << a_count << ")" << endl;
    //                 a_count = 1;
    //                 // Aを指している
    //                 j += 2;
    //             }
    //             else if (s[j+1] == 'A') {
    //                 a_count++;
    //                 j++;
    //             }
    //             else {
    //                 break;
    //             }
    //         }
    //         i = j - 1;
    //     }
    // }
    cout << ans << endl;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vi;
typedef pair<ll,ll> pi;
typedef vector<pi> vpi;
typedef long double ld;
#define pb emplace_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define ALL(x) x.begin(), x.end()
#define SZ(x) (ll)x.size()
#define f first
#define s second
#define MAXN 100100

typedef pair<ll,pi> pip;

ll N,K;
ll b,l,u;
vector<pip> V;

bool cmp(pip a, pip b){
	// Choose the overall biggest
	return a.f*a.s.f + (K-a.f)*a.s.s > b.f*b.s.f + (K-b.f)*b.s.s;
}

bool mem[MAXN];
ll val[MAXN];
ll offset;

ll ask(ll X){
	ll num_complete = X/K;
	ll leftover = X%K;
	// cout<<num_complete<<'\n';

	if (num_complete >= N)return 1;

	memset(mem,0,sizeof(mem));
	ll cur = 0;

	for (ll i=0;i<num_complete;++i){
		auto x = V[i];
		cur += val[i];
		mem[i] = 1;
	}
	ll extra = val[num_complete];
	// cout<<cur<<' '<<extra<<'\n';
	ll res = -1e18;

	for (ll i=0;i<N;++i){
		auto x = V[i];
		ll of = x.f*x.s.f;
		ll tmp = 0;
		if (mem[i] == 1){
			tmp -= val[i];
			tmp += extra;
		}
		if (leftover > V[i].f){
			tmp += (leftover - x.f) * x.s.s + of;
		}else{
			tmp += leftover * x.s.f;
		}
		res = max(res, tmp);
	}

	cur -= offset;
	return cur+res;
}

int main(){
	cin>>N>>K;
	for (ll i=1;i<=N;++i){
		cin>>b>>l>>u;
		V.pb(b,mp(l,u));
	}
	sort(ALL(V), cmp);

	for (ll i=0;i<N;++i){
		auto x= V[i];
		val[i] = x.f*x.s.f + (K-x.f)*x.s.s;
		offset += x.f*x.s.f;
		// cout<<val[i]<<' '<<x.f*x.s.f<<'\n';
	}
	// cout<<'\n';cout<<'\n';

	ll lb = 0;
	ll ub = K*N;
	while (ub > lb){
		ll mid = (lb+ub)/2;
		ll t = ask(mid);
		// cout<<"query "<<mid<<' '<<t<<'\n';
		if (t >= 0)ub = mid;
		else lb = mid+1;
	}
	cout<<lb;
}

Measured memory_bytes: 4980
#include <bits/stdc++.h>
#define all(cont) cont.begin(), cont.end()
#define pb push_back
#define fi first
#define se second
#define DEBUG(x) cerr << (#x) << ": " << (x) << '\n'

using namespace std;

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef long long ll;
typedef unsigned long long ull;

template<class T> bool uin(T &a, T b) {return (a < b ? false : (a = b, true));}
template<class T> bool uax(T &a, T b) {return (a > b ? false : (a = b, true));}

//ifstream f(".in");
//ofstream g(".out");

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
#ifdef LOCAL_DEFINE
//  freopen(".in", "r", stdin);
#endif

  int n, m;
  cin >> n >> m;
  vector<vector<int>> adj(n + 2);
  vector<int> in_deg(n + 2);
  for (int i = 1; i <= m; ++i) {
    int x, y;
    cin >> x >> y;
    adj[x].push_back(y);
    ++in_deg[y];
  }
  int ans = 0;
  vector<int> dp(n + 2);
  vector<bool> vis(n + 2);
  function<void(int)> dfs = [&](int node) {
    if (in_deg[node] != 0 || vis[node]) {
      return;
    }
    vis[node] = true;
    for (int &x : adj[node]) {
      uax(dp[x], 1 + dp[node]);
      --in_deg[x];
      dfs(x);
    }
    uax(ans, dp[node]);
  };

  for (int i = 1; i <= n; ++i) {
    dfs(i);
  }

  cout << ans << '\n';

#ifdef LOCAL_DEFINE
  cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
  return 0;
}


Measured memory_bytes: 12800
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
#define int long long
constexpr long long INF = numeric_limits<long long>::max() / 2;
constexpr int MOD = 1000000007;
using Graph = vector<vector<int>>;



signed main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
   int N,K;
   cin>>N>>K;

   int l[N];
    rep(i,N){
        cin>>l[i];
    }
   sort(l,l+N);
   reverse(l,l+N);
   int ans=0;
   rep(i,K){
       ans+=l[i];
   }
   cout << ans << endl;



}


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

#include <iostream>
using namespace std;


int main() {

	int n, r;
	cin >> n >> r;

	if (n >= 10) {
		cout << r;
		return 0;
	} 

	int x = r + 100 * (10 - n);
	cout << x;
}

Measured memory_bytes: 256
N,K=map(int,input().split())
p=0
for i in range(1,N+1):
    c=0
    while i<K:
        i*=2
        c+=1
    if c!=0:
        p+=((1/2)**c)*(1/N)
if N>=K:
    p+=(N-K+1)/N
print(p)

Measured memory_bytes: 9348
import sys
input = sys.stdin.readline
N, A, B, C, D = map(int, input().split())
S = list(input())[: -1]
tri = 0
for i in range(min(A, B) - 1, max(C, D) - 1):
  if S[i] == "#" and (S[i + 1] == "#"):
    print("No")
    exit(0)
for i in range(max(A, B) - 1, min(C, D)):
  if S[i] == "." and (S[i - 1] == ".") and (S[i + 1] == "."): tri = 1
if C <= D:
  print("Yes")
else:
  if tri: print("Yes")
  else: print("No")


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

const int MAX_N = 100001;
int par[MAX_N], uniteRank[MAX_N];

void uniteInit(int n){
    for (int i = 0; i < n; i++) {
        par[i] = i;
        uniteRank[i] = 0;
    }
}

int root(int x){
    return par[x] == x ? x : par[x] = root(par[x]);
}

bool same(int x, int y){
    return root(x) == root(y);
}

void unite(int x, int y){
    x = root(x);
    y = root(y);
    if(x == y) return;
    if(uniteRank[x] < uniteRank[y]){
        par[x] = y;
    } else {
        par[y] = x;
        if(uniteRank[x] == uniteRank[y]){
            uniteRank[x]++;
        }
    }
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N, M;
    cin >> N >> M;
    vector<pii> edges;
    for(int i = 0; i < M; i++)
    {
        int A, B;
        cin >> A >> B;
        edges.emplace_back(A, B);
    }
    uniteInit(N + 1);
    vector<ll> answers(M);
    vector<ll> sizes(N + 1, 1);//rootしか更新しない、各まとまりのサイズ
    answers.at(M - 1) = N * (N - 1) / 2;

    for(int i = M - 1; i > 0; i--)
    {
        int curA, curB;
        tie(curA, curB) = edges.at(i);
        int rootA, rootB;
        rootA = root(curA);
        rootB = root(curB);
        if(rootA == rootB){
            answers.at(i - 1) = answers.at(i);
            continue;
        }
        ll sizeA = sizes.at(rootA);
        ll sizeB = sizes.at(rootB);
        answers.at(i - 1) = answers.at(i) - sizeA * sizeB;
        unite(curA, curB);
        sizes.at(root(curA)) = sizeA + sizeB;
    }
    for(ll answer: answers){
        cout << answer << endl;
    }
    return 0;
}


Measured memory_bytes: 4596
N,M = map(int,input().split())
A = [input() for _ in range(N)]
B = [input() for _ in range(M)]

for i in range(N-M+1):
    for j in range(N-M+1):
        for k in range(M):
            for l in range(M):
                if B[k][l] != A[k+i][l+j]:
                    break
            else:
                continue
            break
        else:
            print("Yes")
            break
    else:
        continue
    break
else:
    print("No")


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

using namespace std;

void __print(int x) { cerr << x; }

void __print(long x) { cerr << x; }

void __print(long long x) { cerr << x; }

void __print(unsigned x) { cerr << x; }

void __print(unsigned long x) { cerr << x; }

void __print(unsigned long long x) { cerr << x; }

void __print(float x) { cerr << x; }

void __print(double x) { cerr << x; }

void __print(long double x) { cerr << x; }

void __print(char x) { cerr << '\'' << x << '\''; }

void __print(const char *x) { cerr << '\"' << x << '\"'; }

void __print(const string &x) { cerr << '\"' << x << '\"'; }

void __print(bool x) { cerr << (x ? "true" : "false"); }

template<typename T, typename V>
void __print(const pair<T, V> &x) {
    cerr << '{';
    __print(x.first);
    cerr << ',';
    __print(x.second);
    cerr << '}';
}

template<typename T>
void __print(const T &x) {
    int f = 0;
    cerr << '{';
    for (auto &i: x) cerr << (f++ ? "," : ""), __print(i);
    cerr << "}";
}

void _print() { cerr << "]\n"; }

template<typename T, typename... V>
void _print(T t, V... v) {
    __print(t);
    if (sizeof...(v)) cerr << ", ";
    _print(v...);
}

#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

clock_t time_p = clock();

void rtime() {
    time_p = clock() - time_p;
    cerr << "Time Taken : " << (float) 1000 * (time_p) / CLOCKS_PER_SEC << "\n";
}

#define int long long
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

const int INF = 1e15;
const int MOD = 1e9 + 7;
const int N = 2e5 + 10;

signed main() {
//#ifndef ONLINE_JUDGE
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);
//#endif
    IOS;
    int t = 1;
//    cin >> t;
    while (t--) {
        int n, k;
        cin >> n >> k;
        int arr[n];
        int vis[n + 1];
        memset(vis, 0, sizeof(vis));
        for (int i = 1; i <= n; i++) {
            cin >> arr[i];
        }
        vector<int> cycle;
        int i = 1, len = 0;
        vis[i] = 1;
        while (true) {
            len++;
            cycle.push_back(i);
            int to = arr[i];
            if (vis[to] == 0) {
                i = to;
                vis[to] = 1;
            } else {
                i = to;
                break;
            }
        }
        int s = i;
        vector<int> ans;
        bool ok = false;
        int sub = -1;
        for (int i = 0; i < cycle.size(); i++) {
            if (!ok && cycle[i] == s) {
                sub = i;
                ok = true;
            }
            if (ok) {
                ans.push_back(cycle[i]);
            }
        }
        if (k < cycle.size()) {
            cout << cycle[k] << " ";
        } else {
            k -= sub;
            int move = k % ans.size();
//            debug(k,move);
            cout << ans[move] << "\n";
        }
    }
    return 0;
}

Measured memory_bytes: 10696
#include <bits/stdc++.h>
using namespace std;
int main(){
  
  int n; cin >> n;
  vector<string> s(n);
  vector<int>    t(n);
  
  for(int i=0; i<n; i++){
    cin >> s[i] >> t[i];
  }
  
  string x; cin >> x;
  
  int fall;
  for(int i=0; i<n; i++){
    if(s[i].size()==x.size() && s[i]==x){
      fall = i;
      break;
    }
  }
  
  int ans = 0;
  
  for(int i=fall+1; i<n; i++){
    ans += t[i];
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int maxn=1e5+5;
const int inf=0x3f3f3f3f;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    //freopen(".in","r",stdin);
    //freopen(".out","w",stdout);
    int n;
    cin>>n;
    map<pair<int,int>,int> cnt;
    for(int i=1;i<=n;i++)
    {
    	double a;
    	cin>>a;
    	long long val=(long long)(a*1000000000.0+0.5);
    	long long cnt2=0,cnt5=0;
    	while(val%2==0)
    	{
    		cnt2++;
    		val/=2;
		}
		while(val%5==0)
		{
			cnt5++;
			val/=5;
		}
		cnt[make_pair(cnt2,cnt5)]++;
	}
	long long ans=0;
	for(const auto &pi:cnt) 
	{
        for(const auto &pj: cnt)  
		{
			if(pi.first.first+pj.first.first>=18&&pi.first.second+pj.first.second>=18)
			{
				if(pi==pj)
					ans+=pi.second*(pi.second-1ll);
				else
					ans+=pi.second*1ll*pj.second;
			}
		}
	}
	cout<<ans/2<<endl;
	return 0;
}


Measured memory_bytes: 3740
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<bool> vb;
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define INT(str) stoi((str), 0)
#define INTB(str) stoi((str), 0, 2) // 2進数の文字列を int に
 
int main() {
  int N;
  cin >> N;
  cout << (int) (ceil(N / 2.0)) << endl;
}

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

int main(){
	string s;	cin >> s;
	int n = s.size();
	bool isPal = true;
	for (int i = 0; i < n/2; ++i){
		if(s[i] != s[n-1-i]){
			isPal = false;
			break;
		}
	}

	int m = (n-1) / 2;
	for (int i = 0; i < m; ++i){
		if(s[i] != s[m-1-i]){
			isPal = false;
			break;
		}
	}

	m = (n+3)/2-1;
	for (int i = m; i < n; ++i){
		if(s[i] != s[n-1-i]){
			isPal = false;
			break;
		}
	}
	if(isPal)	puts("Yes");
	else		puts("No");
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <numeric>
#include <cmath>
#include <limits>
#include <stdio.h>
#include <iomanip>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;
using ll = long long;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
ll Max(ll(a), ll(b), ll(c)) {
	return max(max(a, b), c);
}
ll Min(ll(a), ll(b), ll(c)) {
	return min(min(a, b), c);
}





int main() {

	ll H, W;
	cin >> H >> W;
	vector<ll> HN(H);
	vector<ll> WN(W);
	vector<string> S(H);
	rep(i, H) {
		
		cin >> S.at(i);
		rep(j, W) {
			if (S.at(i).at(j) == '#') {
				
				HN.at(i) = 9;
				WN.at(j) = 9;
			}
		}

	}
	rep(i, H) {
		rep(j, W) {
			
			if (HN.at(i) == 9 && WN.at(j) == 9) {
				cout << S.at(i).at(j);
			}
		}
		if (HN.at(i) == 9) {
			cout << endl;
		}
		
	}


}



Measured memory_bytes: 3596
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = (ll)1e9 + 7;  
int main(){
  int n;
  cin >> n;

  bool flag =false;
  for (int x = 0; x <= n/4; x++)
  {
    for (int y = 0; y <= n/7; y++)
    {
        if(n==4*x+7*y) {
          flag = true;
          break;
        }
    }
    if(flag){
    	break;
    }
  }
  
  if(flag){
  	cout << "Yes";
  }else{
    
  	cout << "No";
  }
  
}
  
  

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


int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    
    int n,m;
    cin>>m>>n;
    
    vector<int> ans(1<<m,MOD);
    ans[0]=0;
    
    for(int i=0; i<n; i++){
        int a,b;
        cin>>a>>b;
        vector<int> v(b);
        for(int &j:v){
            cin>>j;
            j--;
        }
        int mask=0;
        for(int j:v) mask+=(1<<j);
        for(int j=0; j<(1<<m); j++){
            ans[j|mask]=min(ans[j|mask], ans[j]+a);
        }
        
        
    }
    
    cout<<(ans[(1<<m)-1]==MOD?-1:ans[(1<<m)-1]);
    
    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
public class Hello{
    public static void Main(){
        var a = new int[]{0,0,0,0,0,0,1,1,1,2};
        var b = new int[]{1,1,1,2,2,3,2,2,3,3};
        var c = new int[]{2,3,4,3,4,4,3,4,4,4};
        var list = new List<string>();
        var initial = new long[5];
        
        var N = int.Parse(Console.ReadLine());
        
        for(var i = 0;i < N;i++){
            list.Add(Console.ReadLine());
        }
        
        initial[0] = list.Count(x => x[0] == 'M');
        initial[1] = list.Count(x => x[0] == 'A');
        initial[2] = list.Count(x => x[0] == 'R');
        initial[3] = list.Count(x => x[0] == 'C');
        initial[4] = list.Count(x => x[0] == 'H');
        
        
        long ans = 0;
        for(var i = 0;i < 10;i++){
            ans += initial[a[i]] * initial[b[i]] * initial[c[i]];
        }
        Console.WriteLine(ans);
    }
}


Measured memory_bytes: 16096
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <vector>

using namespace std;

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

const int HASH = 3137;
const int MOD = 1000000007;

ll thash[1000005];
vector<int> to[500005];
int indeg[500005];
ll hashPow[500005];
int dp[500005];
bool visited[500005];
void solve() {
  string s, t;
  cin >> t >> s;
  hashPow[0] = 1;
  for(int i = 1; i <= s.size(); i++) {
    hashPow[i] = hashPow[i-1] * HASH;
    hashPow[i] %= MOD;
  }
  ll sHash = 0;
  for(int i = 0; i < s.size(); i++) {
    sHash *= HASH;
    sHash += s[i];
    sHash %= MOD;
  }
  int tSize = t.size();
  for(int i = 0; i <= 1000000; i++) {
    thash[i+1] = thash[i] * HASH + t[i%t.size()];
    thash[i+1] %= MOD;
  }
  for(int i = 0; i < t.size(); i++) {
    ll val = thash[i + s.size()] - thash[i] * hashPow[s.size()];
    val %= MOD;
    val += MOD;
    val %= MOD;
    if(val == sHash) {
      to[i].push_back((i+s.size())%t.size());
      indeg[(i+s.size())%t.size()]++;
    }
  }
  queue<int> q;
  for(int i = 0; i < t.size(); i++) {
    if(indeg[i] == 0) {
      q.push(i);
    }
  }
  while(!q.empty()) {
    int curr = q.front();
    visited[curr] = true;
    q.pop();
    for(int out: to[curr]) {
      if(--indeg[out] == 0) q.push(out);
      dp[out] = max(dp[out], dp[curr] + 1);
    }
  }
  int ret = 0;
  for(int i = 0; i < t.size(); i++) {
    ret = max(ret, dp[i]);
    if(!visited[i]) {
      cout << "-1\n";
      return;
    }
  }
  cout << ret << "\n";
}

void casesolve() {
  int t;
  cin >> t;
  for(int i = 1; i <= t; i++) {
    cout << "Case #" << i << ": ";
    solve();
  }
}

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


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


def factorization(n):
    arr = set()
    for i in range(2, int(n ** 0.5) + 1):
        if n % i == 0:
            arr.add(i)
            while n % i == 0:
                n //= i

    if n != 1:
        arr.add(n)

    if not arr:
        arr.add(n)

    arr.add(1)
    return arr


a = factorization(A)
b = factorization(B)
inter = a & b

print(len(inter))


Measured memory_bytes: 3064
#include <stdio.h>
int GCD(int,int);
int main(){
  int x,y,a;
  scanf("%d%d",&x,&y);
  a=GCD(x,y);
  printf("%d\n",a);
  return 0;
}

int GCD(int x,int y){
  int r,a;
  if(x<y){
    a=x;
    x=y;
    y=a;
  }
  while(y>0){
    r=x%y;
    x=y;
    y=r;
  }
  return x;
}


Measured memory_bytes: 2084
//https://atcoder.jp/contests/abc123/tasks/abc123_b
function setUp(input) {
  input = input.split("\n");
  a = Number(input[0]);
  b = Number(input[1]);
  c = Number(input[2]);
  d = Number(input[3]);
  e = Number(input[4]);
  main();
}
function main() {
  var total = ceil(a) + ceil(b) + ceil(c) + ceil(d) + ceil(e);
  var firstArray = [first(a), first(b), first(c), first(d), first(e)];
  var minFirst;
  debugger;
  firstArray.forEach(function (d, i) {
    if (d !== 0 && (!minFirst || minFirst > d)) {
      minFirst = d;
    }
  });
  if (minFirst) {
    total -= (10 - minFirst);
  }
  console.log(total);
}
function ceil(num) {
  return Math.ceil(num / 10) * 10;
}
function first(num) {
  var str = num.toString();
  return Number(str.substring(str.length - 1));
}
// setUp('10\n10\n10\n10\n10')
setUp(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
#include<bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
 
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#pragma GCC optimize("-ffloat-store")
 
#define int  long long
#define rep(i,begin,end) for(__typeof(end)i=(begin)-((begin)>(end));i!=(end)-((begin)>(end));i+=1-2*((begin)>(end)))
#define F first
#define S second
#define sz(x) ((int)x.size())
#define pb push_back
#define pf push_front
#define eb emplace_back
#define all(v) (v).begin(), (v).end()
#define mod 1000000007
#define what_is(x) cerr << #x << " is " << x <<"\n";
#define sortA(v) sort(v.begin(), v.end())
#define sortD(v) sort(v.rbegin(), v.rend())
#define PI 3.14159265358979323846
#define vout(a) for(auto x:a) cout<<x<<" ";
#define INF 10000000000000000 //1e16
 
// #define ordered_set tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>
 
 
// using namespace __gnu_pbds;
using namespace std;
 
using ll  = long long;
using vi  = vector<int>;
using pii = pair<int,int>;
using vii = vector<pii>;
using mi  = multiset<int>;
using mii = multiset<pii>;
 
int lcm(int a,int b) {return (a*(b/__gcd(a,b)));}



void solve()
{
    int t,n,m,i,k,r,l,u,v,w,j,s,sum=0,pos,flag=0,count=0;
    string S,T,U; 
    // int x,y;
    cin>>n;
    rep(i,1,n+1)
    {
        cin>>t;
        if((t%2)&&(i%2)) count++;
    }
    cout<<count;
}
 
 
signed main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int t=1;
    // cin>>t;
    while(t--)
    {
        solve();
        if(t)cout<<"\n";
    }
    return 0;
}


Measured memory_bytes: 3612
#include <iostream>
#include <cstdint>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int, int>> vpii;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvc;
typedef vector<vector<string>> vvs;
typedef vector<vector<ll>> vvll;

#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define rrep(i, n) for (ll i = 1; i <= (n); ++i)
#define irep(it, stl) for (auto it = stl.begin(); it != stl.end(); it++)
#define drep(i, n) for (ll i = (n)-1; i >= 0; --i)
#define mes(a) cout << (a) << endl
#define dmes(a, b) cout << (a) << " " << (b) << endl
#define re0 return 0
#define mp(p, q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define rSort(a) sort(a.rbegin(), a.rend())
#define Rev(a) reverse(a.begin(), a.end())
#define MATHPI acos(-1)
#define itn int
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
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;
}
struct io
{
    io()
    {
        ios::sync_with_stdio(false);
        cin.tie(0);
    }
};
const int INF = INT_MAX;
const ll LLINF = 1LL << 60;
const ll MOD = 1000000007;
const double EPS = 1e-19;


signed main() { 
    string s;
    ll q;
    cin >> s >> q;
    
    deque <char> dq(s.size());
    rep (i, (ll)s.size()) {
        dq[i] = s[i];
    }
    
    
    int rf = 0;
    int cmd;
    rep(i, q) {
        cin >> cmd;
        if (cmd == 1) rf = 1-rf;
        if (cmd == 2) {
            char c;
            cin >> cmd >> c;
            if ((cmd + rf) % 2 == 1) dq.push_front(c);
            if ((cmd + rf) % 2 == 0) dq.push_back(c);
        }
        
    }
    
    if (rf) Rev(dq);
    
    for (auto i: dq) {
        cout << i;
    }
    
    
    
}

Measured memory_bytes: 4048
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}
macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}
macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}
fn main() {
    input!{
        s: String,
        t: String,
    }
    println!("{}{}", t, s);
}

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

int main() {
  string s, t;
  cin >> s >> t;
  
  for (int i = 0; i < s.size(); i++) {
    if (s[i] != t[i]) {
      cout << "No" << endl;
      return 0;
    }
  }
  
  cout << "Yes" << endl;
}


Measured memory_bytes: 3628
l = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n"]
n = int(input())
ans = [[] for i in range(n)]
ans[0].append("a")

for i in range(1,n):
    
    for j in ans[i-1]:
        a = 0
        for k in j:
            a = max(a,ord(k)-ord("a"))
        for k in range(a+2):
            an = j + l[k]
            ans[i].append(an)
count = ans[-1]
count.sort()
for i in count:
    print(i)


Measured memory_bytes: 14532
#include <iostream>
#include <iomanip>
#include <math.h>
#include <cmath>
#include <vector>
using namespace std;

typedef struct Node {
    int id;
    int depth;
    int parent;
    char type; // r | i | l
    vector <int> childs;
    int childs_num;
} node;

int n;
int root;
node nodes[100000];
int parentOf[100000];

node newNode(int id, char type, int childs_num, vector<int> childs) {
    node N;
    N.id = id;
    N.type = type;
    N.depth = 0;
    N.childs = childs;    
    N.childs_num = childs_num;
    if (parentOf[id] != -1) {
        N.parent = parentOf[id];
    } else {
        N.parent = -1;
    }
    return N;
}

void init() {
    root = -1;
    for (int i = 0; i < n; i++) {
        parentOf[i] = -1;
    }
}

void store() {
    int id, k;
    for (int i = 0; i < n; i++) {
        cin >> id >> k;
        char type;
        if (k == 0) {
            type = 'l';
        } else {
            type = 'i';
        }
        vector <int> childs(k);
        int ch;
        for (int j = 0; j < k; j++) {
            cin >> ch;

            childs[j] = ch;
            parentOf[ch] = id;
        }
        
        nodes[id] = newNode(id, type, k, childs);
    }
}

void searchRoot() {
    for (int i = 0; i < n; i++) {
        if (parentOf[i] == -1) {
            nodes[i].type = 'r';
            root = i;
            return;
        }
    }
}

void solveParent() {
    for (int p = 0; p < n; p++) {
        node N = nodes[p];
        vector <int> childs = N.childs;
        int c_n = N.childs_num;
        for (int j = 0; j < c_n; j++) {
            nodes[childs[j]].parent = p;
        }
    }
}

void calcDepth(int id, int d) {
    nodes[id].depth = d;
    int c_n = nodes[id].childs_num;

    for (int i = 0; i < c_n; i++) {
        calcDepth(nodes[id].childs[i], d + 1);
    }
}

string printType(int id) {
    char t = nodes[id].type;
    if (t == 'r') {
        return "root";
    } else if (t == 'i') {
        return "internal node";
    } else {
        return "leaf";
    }
}

void printChild(int id) {
    vector <int> childs = nodes[id].childs;
    int c_n = nodes[id].childs_num;
    cout << "[";
    for (int i = 0; i < c_n; i++) {
        if (i != c_n - 1) {
            cout << childs[i] << ", ";
        } else {
            cout << childs[i];
        }
    }
    cout << "]" << endl;
}

void printNode(int id) {
    cout << "node " << id << ": parent = " << nodes[id].parent;
    cout << ", depth = " << nodes[id].depth << ", " << printType(id);
    cout << ", ";
    printChild(id);
}

void printTree() {
    for (int i = 0; i < n; i++) {
        printNode(i);
    }
}

int main() {     
    cin >> n;
    init();
    store();

    searchRoot();
    solveParent();
    calcDepth(root, 0);

    printTree();

    return 0;
}



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

int main(){
  int d,e;
  while(cin>>d>>e,d){
    double ans=100000.0;
    for(int x=1;x<=d;x++){
      int y=d-x;
      double z=abs(sqrt(x*x+y*y)-e);
      if(z<ans) ans=z;
    }
    printf("%.8f\n",ans);
  }
}


Measured memory_bytes: 1196
n=int(input())
a=[]
for _ in range(n):
  s=int(input())
  a.append(s)
  
sum1=sum(a)
a=sorted(a)
ch=0
if sum1%10!=0:
  print(sum1)
else:
  for x in range(n):
    if a[x]%10!=0:
      print(sum1-a[x])
      ch+=1
      break
  if ch==0:
    print(0)

Measured memory_bytes: 9076
/*
  Contest 080
  A - Parking
  Rakesh Kumar --> 13/09/2020
 */

#include <bits/stdc++.h>

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

    int n = 0, a = 0, b = 0;
    std::cin >> n >> a >> b;
    std::cout << std::min(n * a, b) << std::endl;

    return 0;
}


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

//template
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(v) (v).begin(),(v).end()
typedef long long int ll;
const int inf = 0x3fffffff; const ll INF = 0x1fffffffffffffff; const double eps=1e-12;
template<typename T>inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<typename T>inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<typename T=int>inline T get(){
   char c=getchar(); bool neg=(c=='-');
   T res=neg?0:c-'0'; while(isdigit(c=getchar()))res=res*10+(c-'0');
   return neg?-res:res;
}
template<typename T=int>inline void put(T x,char c='\n'){
   if(x<0)putchar('-'),x*=-1; int d[20],i=0;
   do{d[i++]=x%10;}while(x/=10); while(i--)putchar('0'+d[i]);
   putchar(c);
}
//end

typedef pair<int,int> P;
int n,m; vector<P> res;
void verify(){
   int match[110];
   rep(i,0,n)match[i]=-1;
   rep(i,0,m){
      match[res[i].first]=res[i].second;
      match[res[i].second]=res[i].first;
   }
   set<int> st[110];
   rep(i,0,n){
      rep(j,0,n){
         int x=j,y=match[(i+j)%n];
         if(y==-1)continue;
         if(st[x].count(y)){
            puts("-1"); exit(0);
         } st[x].insert(y);
      }
   } puts("0");
}

int main(){
   n=get(),m=get();
   int k=n/2; if(n%2==0)k--;
   int lb=(k+1)/2,rb=k/2;
   for(int i=lb-1,x=1;i>=0;i--,x+=2)res.push_back({i,i+x});
   for(int i=n-rb,x=2;i<=n-1;i++,x+=2)res.push_back({i,i-x});
   rep(i,0,m)printf("%d %d\n",res[i].first+1,res[i].second+1);
   //verify();
   return 0;
}

Measured memory_bytes: 4252
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

using namespace std;
using ll = long long;

int main() {
  int n;
  string s;
  cin >> n >> s;
  int rc = 0;
  int wc = 0;
  rep(i, s.size()) {
    if (s[i] == 'R')
      rc++;
    if (s[i] == 'W')
      wc++;
  }
  int count = 0;
  rep(i, rc) {
    if (s[i] == 'W') {
      count++;
    }
  }
  cout << count << endl;
  return 0;
}

Measured memory_bytes: 3748
// 基本テンプレート
 
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
using namespace std;
 
#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define int long long int
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
typedef pair<int, int> pii;
typedef long long ll;
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1001001001001001LL;
const ll MOD = 1000000007LL;

// Union-Find 木 (Verified: AtCoder Typical Contest 001 B)
struct UnionFind {
private:
    const int n;
    int __size;
    vector<int> uf;
public:
    // 初期化 UnionFind uni(n) のように宣言すれば良い
    UnionFind(int _n) : n(_n), __size(_n), uf(_n, -1) {}
    // find (木の根を求める)
    int find(int x) {return (uf[x] < 0) ? x : uf[x] = find(uf[x]);}
    // x と y が同じ集合に属するかどうか
    bool same(int x, int y) {return find(x) == find(y);}
    // x が属する集合の要素数
    int size(int x) {return -uf[find(x)];}
    // 集合はいくつあるか
    int size()      {return __size;}
    // x と y の属する集合を併合
    void unite(int x, int y) {
        x = find(x); y = find(y);
        if(x == y) return;
        __size--;
        if(uf[y] < uf[x]) swap(x, y);
        uf[x] += uf[y]; uf[y] = x;
    }
};
 
signed main() {
    int N, M; cin >> N >> M;
    UnionFind uf(N);

    vector<int> A(N);
    for(int i=0; i<N; i++) {
        cin >> A[i];
        A[i]--;
    }
    for(int i=0; i<M; i++) {
        int u, v; cin >> u >> v;
        u--; v--;
        uf.unite(u, v);
    }

    vector<int> v1[N], v2[N];
    for(int i=0; i<N; i++) {
        int f = uf.find(i);
        v1[f].push_back(i);
        v2[f].push_back(A[i]);
    }

    int ans = 0;
    for(int i=0; i<N; i++) {
        set<int> S;
        for(auto x : v1[i]) {
            S.insert(x);
        }
        for(auto x : v2[i]) {
            ans += S.count(x);
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 12800
// "header" {{{
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstring>
#include <string>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <deque>
#include <set>
#include <list>
#include <tuple>
#include <iomanip>
#include <climits>

using namespace std;

#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,n) for(int i=1;i<=(n);++i)
#define all(x) (x).begin(),(x).end()
#define pii pair<int,int> 
#define int int64_t
#define Fixed fixed << setprecision(10)
#define moke_pair make_pair
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const long long mod1 = 1000000007;
const long long mod2 = 998244353;


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

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

template <class T> using min_heap = priority_queue<T,vector<T>,greater<T> >;
template <class T> using max_heap = priority_queue<T>;
template <class T,class U> using umap = unordered_map<T,U>;

inline int64_t updiv(int64_t n,int64_t d){
    return ((n + d -1) / d);
}

inline int square(int a){ return a * a; }

inline double Sqrt( const double &x) 
{
	double         xHalf = 0.5 * x;
	int64_t  tmp   = 0x5FE6EB50C7B537AAl - ( *(int64_t*)&x >> 1);
	double         xRes  = * (double*)&tmp;

    xRes *= ( 1.5 - ( xHalf * xRes * xRes ) );
	xRes *= ( 1.5 - ( xHalf * xRes * xRes ) );
	xRes *= ( 1.5 - ( xHalf * xRes * xRes ) );
	xRes *= ( 1.5 - ( xHalf * xRes * xRes ) );
	xRes *= ( 1.5 - ( xHalf * xRes * xRes ) );
	xRes *= ( 1.5 - ( xHalf * xRes * xRes ) );
	xRes *= ( 1.5 - ( xHalf * xRes * xRes ) );
	xRes *= ( 1.5 - ( xHalf * xRes * xRes ) );
	
    return xRes * x;
}

// }}}

int n,m;
vector<vector<int> > g;
vector<int> dp;

int dfs(int now){
    int maxv = 0;
    if(dp[now] != -1) return dp[now] + 1;
    rep(i,g[now].size()){
        int next = g[now][i];
        chmax(maxv,dfs(next));
    }
    chmax(dp[now],maxv);
    return maxv + 1;
}

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

    g.resize(n+1);
    dp.resize(n+1,-1);

    rep(i,m){
        int x,y;
        cin >> x >> y;
        g[x].emplace_back(y);
    }

    int res = 0;

    reps(i,n){
        if(dp[i] == -1){
            dfs(i);
            chmax(res,dp[i]);
        }
    }


    cout << res << '\n';
    
    return 0;
}


Measured memory_bytes: 8576
#![allow(non_snake_case, unused)]
use std::cmp::*;
use std::collections::*;

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        s: chars,
    }
    let mut cnt = 0;
    for i in 0..(s.len() /2) {
        if s[i] != s[s.len()-1-i] {
            cnt += 1;
        }
    }
    println!("{}", cnt);
}


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

int main(){
  long long n;
  cin >> n;
  long long a[n],ans[n]={},sum=0;
  for(int i=0;i<n;i++){
    cin >> a[i];
    if(i%2==0){
      sum+=a[i];
    }else{
      sum-=a[i];
    }
  }
  ans[0]=sum;
  for(int i=1;i<n;i++){
    ans[i]=(a[i-1]-ans[i-1]/2)*2;
  }
  for(int i=0;i<n;i++){
    cout << ans[i] << " ";
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 2816
#include<stdio.h>

int main()
{
	int w, h, x, y, r;
	
	scanf("%d %d %d %d %d", &w, &h, &x, &y, &r);
	
	if((x + r <= w && x-r >= 0) && (y + r <= h && y - r >= 0))
	{
		printf("Yes\n");
	}
	else
	{
		printf("No\n");
	} 				
	return 0;
 } 


Measured memory_bytes: 2692
program main
    implicit none
    character(100) S
	integer N, i, j, k, l, ans, counter
	read(*, *) N
	read(*, *) S
	ans = 0
	do i = 1, N-1
	counter = 0
	    do j = 1, i
			do l = 1, j-1
				if (S(j: j) == S(l: l)) then
					goto 1
				end if
			end do
			do k = i+1, N
				if (S(j: j) == S(k: k)) then
					counter = counter + 1
					exit
				end if
			end do
1 continue
		end do
		ans = max(ans,counter)
	end do
	write(*, *) ans
end program main

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

tasks = []
for _ in range(n):
  a,b = list(map(int,input().split(" ")))
  tasks.append((a,b))

tasks = sorted(tasks,key = lambda x:x[1])

now_time = 0
flag = True
for a,b in tasks:
  if now_time + a > b:
    flag = False
    break
  now_time += a
if flag:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 33400
# https://atcoder.jp/contests/abc044/tasks/abc044_b

w = input()

w_dic = {}

for i in w:
    if i in w_dic:
        w_dic[i] += 1
    else:        
        w_dic[i] = 1

ans = [k for k, v in w_dic.items() if v % 2 != 0]

if len(ans) == 0:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3060
#include <iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<limits>
#include<string.h>
#include<vector>
#include<stack>
#include<queue>
using namespace std;


int main()
{
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	cout << (a - c)*(b - d) << endl;
    return 0;
}

Measured memory_bytes: 256
n, m = map(int, input().split())
h = [-1] + list(map(int, input().split()))
ab = [list(map(int, input().split())) for _ in range(m)]

link = [[] for _ in range(n + 1)]
for x in ab:
    a, b = x[0], x[1]
    link[a].append(b)
    link[b].append(a)

ans = [0] + [1] * n
for i in range(len(link)):
    for j in link[i]:
        if h[i] <= h[j]:
            ans[i] = 0

print(sum(ans))


Measured memory_bytes: 42832
q = int(input())
a_list = [0]*(q*2)
head = tail = q
for _ in range(q):
    com, *query = map(int, input().split())
    if com == 0:
        if query[0] == 0:
            a_list[head] = query[1]
            if head == tail:
                tail += 1
            head -= 1
        else:
            a_list[tail] = query[1]
            if head == tail:
                head -= 1
            tail += 1
    elif com == 1:
        print(a_list[query[0] + head + 1])
    else:
        if query[0] == 0:
            head += 1
        else:
            tail -= 1
            


Measured memory_bytes: 24404
n = int(input())
v = list(map(int, input().split(' ')))

approved = True
for val in v:
	if (val % 2 == 0):
		if (val % 3 != 0 and val % 5 != 0):
			approved = False
			
if (approved):
	print('APPROVED')
else:
	print('DENIED')


Measured memory_bytes: 2940
#include <cstdio>
#include <cstring>
#include <queue>
#include <iostream>
#include<bits/stdc++.h>
typedef long long int ll;
const int maxn=1e6+7;
using namespace std;

int main()
{

    ios::sync_with_stdio(false);

    int m,k;
    double n;
    cin>>m>>n>>k;
    double ans=m*1.0/k;
    if(ans>n)
    {
        printf("No\n");
    }
    else printf("Yes\n");
    return 0;
}

Measured memory_bytes: 3740
from heapq import heappop,heappush

N,M = map(int,input().split())
job = [tuple(map(int,input().split())) for _ in range(N)]

job.sort(key=lambda x:x[1],reverse=True)
job.sort(key=lambda x:x[0])

heap = []
ans = 0

j = -1
for i in range(M)[::-1]:
    while j < N-1 and job[j+1][0]+i <= M:
        j += 1
        heappush(heap,-job[j][1])
    if heap:
        ans += -heappop(heap)

print(ans)

Measured memory_bytes: 20932
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  
  int a,b;
  string op;
  
  cin >> a >> op >> b;
  
  if(op == "+"){
    cout << a + b << endl;
  }
  
  else if(op == "-"){
    cout << a - b << endl;
  }
  
  else{
    cout << "error" << endl;
  }
  
}

Measured memory_bytes: 256
n = int(input())
a = list(map(int,input().split()))

point = 0
point2 = 0

now = 0
now2 = 0

for i,j in enumerate(a):
    now += j
    now2 += j
    if i%2 == 0:
        if now <= 0:
            point += 1-now
            now = 1
        if now2 >= 0:
            point2 += 1+now2
            now2 = -1
    else:
        if now2 <= 0:
            point2 += 1-now2
            now2 = 1
        if now >= 0:
            point += 1+now
            now = -1

print(min(point,point2))

Measured memory_bytes: 14468
#include<iostream>

int main(){
    int A, B;
    std::cin >> A >> B;
    if(A >= 13) std::cout << B << std::endl;
    else if(A >= 6) std::cout << B / 2 << std::endl;
    else std::cout << 0 << std::endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    int i;
    int a[n+1],b[n+1];
    for(i=1;i<=n;i++)
    {
        cin>>a[i];
        b[i]=a[i];
    }
    sort(a+1,a+n+1);
    for(i=1;i<=n;i++)
    {
        if(a[n/2]==b[i])
        {
            cout<<a[n/2+1]<<endl;
        }
        else if(a[n/2+1]==b[i])
        {
            cout<<a[n/2]<<endl;
        }
        else
        {
            int pos=lower_bound(a+1,a+n+1,b[i])-(a);
            //cout<<pos<<endl;
            if(pos<=n/2)
            {
                cout<<a[n/2+1]<<endl;
            }
            else
            {
                cout<<a[n/2]<<endl;
            }
        }
    }
}


Measured memory_bytes: 3712
#define _GLIBCXX_DEBUG
#include <iostream>
#include <bits/stdc++.h>
    
    
using namespace std;
#define ll long long
#define ld long double
#define  P pair<ll,ll>
#define FOR(i,n,m) for(ll i=n; i<(ll)m;i++)
#define FORr(i,m,n) for(ll i=n; i>=(ll)m; i--)
#define FORm(i,m) for(auto i=m.begin();i!=m.end();i++)
#define REV(v) reverse(v.begin(),v.end())
#define sortAl(v) sort(v.begin(),v.end())
#define sortAlr(v) sort(v.begin(),v.end()); reverse(v.begin(),v.end())
#define cout(n) cout<<fixed<<setprecision(n)
#define dout(n) cout<<# n<<" = "<<n<<endl;
#define v1out(v) FOR(j,0,v.size()){cout<<v[j]; if(j!=(ll)v.size()-1)cout<<" ";else cout<<endl; }
#define v2out(v) FOR(i,0,v.size())v1out(v[i]);

ll func(ll a, ll n){
    ll x = n/a;
    return x*(1+x)*a/2;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin>>n;
    ll ans = 0;
    FOR(i,1,n+1){
        ans += func(i,n);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3632