akhauriyash/Code-Regression huggingface dataset:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7 
#mod = 998244353
from decimal import *
#import numpy as np
#decimal.getcontext().prec = 10

N, X = MAP()

L = [0]*(N+1) #レベルiバーガーの全体の層数
L[0] = 1
for i in range(1, N+1):
	L[i] = 2*L[i-1] + 3

P = [0]*(N+1) #レベルiバーガーのパティの数
P[0] = 1
for i in range(1, N+1):
	P[i] = 2*P[i-1] + 1

def solve(i, x): #レベルiバーガーの下からx個
	if i == 0:
		if x <= 0:
			return 0
		else:
			return 1
	if x <= L[i-1] + 1:
		ret = solve(i-1, x-1)
	else:
		ret = P[i-1] + 1 + solve(i-1, x - L[i-1] - 2)
	return ret


print(solve(N, X))

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

using namespace std;

const int N = 500 * 1000 + 17;
const int MOD = 1000 * 1000 * 1000 + 7;

int q;

bool read() {
    if (!(cin >> q))
        return false;

    return true;
}

void solve() {
    multiset<long long> L, R;
    auto sumL = 0ll;
    auto sumR = 0ll;
    auto B = 0ll;

    while (q --> 0) {
        int t;
        cin >> t;

        if (t == 1) {
            long long a, b;
            cin >> a >> b;
            B += b;

            if (L.empty() || a <= *L.rbegin()) {
                L.insert(a);
                sumL += a;
            } else {
                R.insert(a);
                sumR += a;
            }

            while (L.size() > 1 + R.size()) {
                auto x = *L.rbegin();
                L.erase(--L.end());
                sumL -= x;
                sumR += x;
                R.insert(x);
            }

            while (R.size() > L.size()) {
                auto x = *R.begin();
                R.erase(R.begin());
                sumR -= x;
                sumL += x;
                L.insert(x);
            }
        } else {
            auto x = *L.rbegin();
            auto ans = B;
            ans += x * L.size() - sumL;
            ans += sumR - x * R.size();
            cout << *L.rbegin() << ' ' << ans << endl;
        }
    }
}

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    while (read())
        solve();

    return 0;
}



Measured memory_bytes: 9600
#include<bits/stdc++.h>
using namespace std;
int main(){
    int a,b;
    cin>>a>>b;
    int i;
    for(i=10;i<=1000;i++){
        if(floor(i*0.08)==a&&floor(i*0.1)==b)break;
    }
    if(i!=1001)cout<<i<<endl;
    else cout<<-1<<endl;
    return 0;
}


Measured memory_bytes: 256
require 'pp'

n = gets.chomp!.to_i

tree = {}
tree_max = 0

index_memo = Array.new(n-1, nil)

(n-1).times do |i|
  a, b = gets.chomp!.split(" ").map(&:to_i)
  tree[a] ||= {}
  tree[b] ||= {}
  tree[a][b] = 0
  tree[b][a] = 0
  if tree[a].length > tree_max
    tree_max = tree[a].length
  end
  if tree[b].length > tree_max
    tree_max = tree[b].length
  end

  index_memo[i] = [a, b]
end

ng = Array.new(n-1, 0)
1.upto(n) do |num|
  count = 0
  tree[num].each do |k, _|
    if tree[num][k] == 0
      count += 1
      if ng[num] == count
        count += 1
      end
      ng[k] = count
      tree[num][k] = count
      tree[k][num] = count
    end
  end
end

#pp tree
#pp index_memo

puts tree_max
index_memo.each do |a, b|
  puts tree[a][b]
end


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

using namespace std;

using ll = long long;
using ld = long double;

using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vs = vector<string>;

#define all(v) v.begin(), v.end()

#define rep(i, n) for (ll i = 0; i < n; i++)
#define REP(i, n) for (ll i = 1; i < n; i++)

#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define FORm(i, m) for (auto i = m.begin(); i != m.end(); i++)

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);

  ll n;
  string s;
  cin >> n >> s;

  vvll m(3);
  rep(i, n) {
    if (s[i] == 'R') {
      m[0].push_back(i);
    } else if (s[i] == 'G') {
      m[1].push_back(i);
    } else {
      m[2].push_back(i);
    }
  }

  ll ans = m[0].size() * m[1].size() * m[2].size();

  FORm(r, m[0]) {
    FORm(g, m[1]) {
      ll v = *r - *g;
      if (*r + v >= 0 && *r + v < n && s[*r + v] == 'B') {
        ans--;
      }
      if (*g - v >= 0 && *g - v < n && s[*g - v] == 'B') {
        ans--;
      }

      if (v % 2 == 0) {
        if (s[(*r + *g) / 2] == 'B') {
          ans--;
        }
      }
    }
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3668
def main():
    N = int(input())
    A = list(map(int, input().split()))
    total = [[0] * (N+1) for _ in range(2)]
    ans = [0] * 2
    for i in range(N):
        for n in range(2):
            total[n][i+1] = total[n][i] + A[i]
            if (i+n) % 2 == 0:
                if total[n][i+1] <= 0:
                    ans[n] += 1 - total[n][i+1]
                    total[n][i+1] = 1
            else:
                if total[n][i+1] >= 0:
                    ans[n] += total[n][i+1] + 1
                    total[n][i+1] = -1
    print(min(ans))


if __name__ == "__main__":
    main()


Measured memory_bytes: 63380
N = int(input())

sum_jpy = 0.0
sum_bit = 0.0
sum_all = 0.0
btc = 380000.0
for _ in range(N):
	x,u = map(str, input().split())
	if u == "JPY":
		sum_jpy += float(x)
	else:
		sum_bit += float(x)

sum_all = sum_jpy + btc * sum_bit

print(sum_all)

Measured memory_bytes: 3060
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby, product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    from math import floor, ceil
    #from operator import itemgetter

    #inf = 10**17
    #mod = 10**9 + 7

    s = input().rstrip()
    a = s[:2]
    b = s[2:]
    a = int(a)
    b = int(b)
    if 1<=a<=12 and 1<=b<=12:
        print('AMBIGUOUS')
    elif 1<=a<=12:
        print('MMYY')
    elif 1<=b<=12:
        print('YYMM')
    else:
        print('NA')

if __name__ == '__main__':
    main()

Measured memory_bytes: 3316
#include <iostream>

using namespace std;

void output(int a, int b) {
    cout << (a > b ? "GREATER" : a < b ? "LESS" : "EQUAL") << endl;
}

int main() {
    string a, b;
    cin >> a >> b;
    if (a.size() != b.size()) output(a.size(), b.size());
    else if (a == b) output(1, 1);
    else {
        for (int i = 0; i < a.size(); ++i) {
            if (a[i] == b[i]) continue;
            output(a[i], b[i]);
            return 0;
        }
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define MOD 998244353
#define ff first
#define ss second
typedef long long ll;
ll power(ll a, ll b){//a^b
    ll res=1;
    a=a%MOD;
    while(b>0){
        if(b&1){res=(res*a)%MOD;b--;}
        a=(a*a)%MOD;
        b>>=1;
    }
    return res;
}
ll fermat_inv(ll y){return power(y,MOD-2);}
ll gcd(ll a, ll b){return (b==0)?a:gcd(b,a%b);}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll t=1;
    //cin>>t;
    while(t--){
        ll n;
        cin>>n;
        string s="";
        while(n>0){
            char c='a'+((n+25)%26);
            s+=c;
            if(n%26==0)
                n--;
            n/=26;
        }
        int l=s.length()-1;
        for(int i=l;i>=0;i--)
            cout<<s[i];
    }
    return 0;
}

Measured memory_bytes: 3668
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
using namespace std;

const int MOD = 1000000007;
typedef long long ll;

bool notOK[1010];

int main(void) {
  int n;
  cin >> n;
  ll res = 1;
  for(int i = 2; i <= n; ++i) {
    if(notOK[i]) {
      continue;
    }
    int cnt = 1;
    for(int j = i + i; j <= n; j += i) {
      notOK[j] = true;
      for(int v = j; v % i == 0; v /= i) {
        ++cnt;
      }
    }
    res = (res * (cnt+1))%MOD;
  }
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ull unsigned long long
#define MOD (int)(1e9+7)
#define ceil(x, y) (x%y==0? (x/y) : (x/y+1))
#define FOR(i, N) for(int i = 0; i < N; ++i)
#define FOR1(i, N) for(int i = 1; i <= N; ++i)
#define vi vector <int>
#define pii pair <int, int>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define mset(a, v) memset(a, v, sizeof(a))
#define all(v) (v).begin(), (v).end()
#define INF 2e9
#define EPS 1e-9
#define int long long
/*#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
typedef cc_hash_table<int, int, hash<int>> ht; // while using, comment #define int long long  */

void __print(int 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 dbg(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define dbg(x...)
#endif
using namespace std;
#define MAX 5
set<int> leg;
int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #ifndef ONLINE_JUDGE
        freopen("in6.txt", "r", stdin);
        freopen("out.txt", "w", stdout);
    #endif
    int T = 1;
    // cin >> T;
    
    FOR1(tt, T){
        // cout << "Case #" << tt << ": ";
        int n; cin >> n;
        cout << 1-n;
        cout << '\n';
    }
    return 0;
}


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

int main()
{
    int n;
    cin>>n;
    string s;
    cin>>s;
    int ck=0;
    int cnt=0;
    for(int i=0; i<s.size(); i++)
    {
        if(s[i]=='R')
            cnt++;
    }

    int ans=cnt;
    int x=0;
     for(int i=0; i<s.size(); i++)
     {
         if(s[i]=='R' && i+1<=ans)
            x++;
     }
     cout<<ans-x<<endl;
}


Measured memory_bytes: 3744
#include <bits/stdc++.h>
using namespace std;
#define forn(i, n) for(int i = 0 ; (i) < (n) ; ++i)
#define forx(i, n) for(int i = 1 ; (i) <= (n) ; ++i)
#define ll long long
#define all(x) (x).begin(),(x).end()
#define sqr(x) (x) * (x)
#define debug(x) cout << #x <<" = " << x << endl
#define printvpair(v) for(auto x : v) cout << x.first  <<" " << x.second << endl;
#define printv(v) for(auto x : v) cout << x << " "; cout << endl;

const int N = 1e5 + 7;
int n,m;
vector<pair<int,int> > a;
int main() {
    cin >> n >> m;

    forn(i,m) {
        int x,y;
        cin >> x >> y;
        a.emplace_back(x,y);
    }

    sort(all(a));

    int l = INT_MIN;
    int r = INT_MAX;
    int ans = 1;
    for(auto x : a){
        l = max(l,x.first);
        r = min(r,x.second);

        if (l >= r){
            ans++;
            l = x.first;
            r = x.second;
        }
    }

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

Measured memory_bytes: 1400
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define ft first
#define sd second
#define fr(i,n) for(int i=0;i<(n);++i)
#define Fr(i,n) for(int i=1;i<=(n);++i)
#define ifr(i,n) for(int i=(n)-1;i>=0;--i)
#define iFr(i,n) for(int i=(n);i>0;--i)

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    ll n;
    cin>>n;
    vector<ll> x(n),y(n);
    set<pair<ll,ll>> st;
    fr(i,n){
        cin>>x[i]>>y[i];
        st.emplace(x[i],y[i]);
    }
    ll ans=n;
    fr(i,n){
        fr(j,i){
            ll p=x[i]-x[j],q=y[i]-y[j],ka=n;
            fr(k,n){
                if(st.count(make_pair(x[k]+p,y[k]+q))) --ka;
            }
            ans=min(ans,ka);
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long int
// #define lli long long int
#define ld long double
#define ff first
#define ss second
#define mp make_pair
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define pb push_back
#define eb emplace_back
#define pii pair<int, int>
#define endl '\n'
#define all(x) x.begin(),x.end()
#define f(i,j,l) for(i=j;i<l;i++)
// #if !defined(ONLINE_JUDGE)
// #include "debugging.h"
// #endif
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

// int const mod = 7340033;
int const mod = 1e9+7;
int power(int a,int b,int m){
    int res = 1;
    while(b){
        if(b&1){
            res = res*a;
            res %= m;
        }
        a=a*a;
        a%=m;
        b=b/2;
    }
    return res;
}
 
int inverse(int x){
    return power(x,mod-2,mod);
}

int const N = 1e5+5;
int const inf = 1e18;
int dp[10][10];
// int dp2[10][10];

void solve(){
    int i,j,l;
    int n;
    cin>>n;
    int ans = 0;
    vector<int> v;
    l = n;
    // int dp[10][10];
    for(i=1;i<=n;i++){
        j = i%10;
        l = i;
        while(l >= 10){
            l/=10;
        }
        dp[l][j]++;
    }

    for(i=1;i<=9;i++){
        for(j=1;j<=9;j++){
            ans += dp[i][j]*dp[j][i];
        }
    }
    cout<<ans<<endl;
}   

int32_t main(){
    IOS;
    int t;
    t = 1;
    // pre();
    // cin>>t;
    for(int tt=1;tt<=t;tt++){
        solve();
    }
    return 0;
}

/*

*/

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

const int DIM = 1e5 + 5;

int arr[DIM];

int main( void ) {
    
    int n, m;
    cin >> n >> m;
    
    for( int i = 1; i <= m; i ++ ) {
        int x, y;
        cin >> x >> y;
        
        if( x > y )
            swap( x, y );
        
        arr[x] ++; arr[y] --;
    }
    
    bool ok = true;
    for( int i = 1; i < n; i ++ ) {
        arr[i] += arr[i - 1];
        
        if( arr[i] % 2 == 1 )
            ok = false;
    }
    
    cout << ( (ok == true) ? "YES" : "NO" ) << endl;
    return 0;
}

Measured memory_bytes: 640
n = int(input())
a = input().split()
b = 0
is_include_zero = False
too_big = False
for i in a:
    if int(i) > 10 ** 18:
        print(-1)
        too_big = True
    if int(i) == 0:
        is_include_zero = True
if too_big:
    pass
elif is_include_zero:
    print(0)
else:
    for i in range(n):
        if b > 10 ** 18:
            break
        if i == 0:
            b = int(a[i])
        else:
            b = b * int(a[i])
    if b > 10 ** 18:
        print(-1)
    else:
        print(int(b))


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

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

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

template<typename T>
ostream& operator << (ostream& os, vector<T>& v){
	rep(i,v.size()){ os << v[i] << (i == v.size() - 1 ? "" : " "); } return os;
}
template<typename T>
istream& operator >> (istream& is, vector<T>& v){
	for(T& x: v){ is >> x; } return is;
}

const int M = 1000000007;


int power(int x, int n){
	if(n < 0) return 0;
	int res = 1;
	if(n > 0){
		res = power(x, n / 2);
		if(n % 2 == 0) res = (res * res) % M;
		else res = (((res * res) % M) * x ) % M;
	}
	return res;
}

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

	int lq = s.front() == '?', la = s.front() == 'A';
	int rq = 0, rc = 0;
	range(i,1,s.size()){
		if(s[i] == '?') rq++;
		if(s[i] == 'C') rc++;
	}

	int sum = 0;
	range(i,1,s.size() - 1){
		if(s[i] == '?') rq--;
		if(s[i] == 'C') rc--;

		//cout << lq << ' ' << la << ' ' << rq << ' ' << rc << endl;
		if(s[i] == '?' or s[i] == 'B'){
			//(sum += power(3,lq) * la % M * power(3,rq) % M * rc % M) %= M;
			(sum += power(3,lq) * la % M * power(3,rq) % M * rc % M) %= M;
			//show(sum)
			(sum += power(3,lq - 1) * lq % M * power(3,rq) % M * rc % M) %= M;
			//show(sum)
			(sum += power(3,lq) * la % M * power(3,rq - 1) % M * rq % M) %= M;
			//show(sum)
			(sum += power(3,lq - 1) * lq % M * power(3,rq - 1) % M * rq % M) %= M;
			//show(sum)
		}
		if(s[i] == '?') lq++;
		if(s[i] == 'A') la++;
	}
	cout << sum << endl;
}


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

void answer(int a[], int n) {
  int sum = 0;
  for(int i = 0;i < n;i++) sum+= a[i];
  cout << sum << endl;
}

int main() {
  cin.tie(0);
  int n;
  cin >> n;
  int b[n-1];
  for(int i = 0;i < n-1;i++) {
      cin >> b[i];
  }
  int a[n];
  a[0] = b[0];
  for(int i = 1;i < n-1;i++) {
    a[i] = min(b[i], b[i-1]);
  }
  a[n-1] = b[n-2];
  answer(a, n);
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <deque>
#include <cctype>
#include <cstdio>
#include <math.h>
#include <set>
using namespace std;
int main(void){
    vector<string> str(9);
    str[0]=".,!? ";
    str[1]="abc";
    str[2]="def";
    str[3]="ghi";
    str[4]="jkl";
    str[5]="mno";
    str[6]="pqrs";
    str[7]="tuv";
    str[8]="wxyz";
    int n;
    cin >> n;
    for(int i=0;i<n;i++){
        string x;
        string ans="";
        cin >> x;
        int count;
        if(x[0]!='0'){
            count=1;
        }else{
            count=0;
        }
        
        for(int j=1;j<x.length();j++){
            if(x[j]=='0'){
                if(x[j-1]!='0'){
                    if(count > str[(x[j-1]-'0')-1].length()){
                        count = count%str[(x[j-1]-'0')-1].length();
                        if(count == 0){
                            count =str[(x[j-1]-'0')-1].length();
                        }
                    }
                    ans+=str[(x[j-1]-'0')-1][count-1];
                }
                count=0;
            }else{
                count++;
            }
        }
        cout << ans << endl;
    }
}


Measured memory_bytes: 3160
# -*- coding:utf-8 -*-
H,W=map(int,input().split())
boxes=list()
pad=[0]*(W+2)
boxes.insert(0,pad)
for i in range(H):
  x=input()
  box=list()
  box.append(0)
  for j in range(W):
    if x[j]=='.':
      box.append(0)
    elif x[j]=='#':
      box.append(1)
  box.append(0) 
  boxes.insert(i+1,box)
boxes.insert(H+1,pad)
answers=list()
padd=[0]*W
for n in range(H):
  answer=list()
  for k in range(W):
    count=0
    if boxes[n][k]==1:
      count+=1
    if boxes[n][k+1]==1:
      count+=1
    if boxes[n][k+2]==1:
      count+=1
    if boxes[n+1][k]==1:
      count+=1
    if boxes[n+1][k+2]==1:
      count+=1
    if boxes[n+2][k]==1:
      count+=1
    if boxes[n+2][k+1]==1:
      count+=1
    if boxes[n+2][k+2]==1:
      count+=1
    if boxes[n+1][k+1]==1:
      count='#'
    else:
      count=str(count)
    answer.insert(k,count)
  answers.insert(n,answer)
for v in range(H):
  answe=''.join(answers[v])
  print(answe)

Measured memory_bytes: 3188
#include<bits/stdc++.h>   
using namespace std;    
int main(){
  int n;
  cin>>n;
  vector<int>l(n);
  for(int i = 0;i<n ;i++ ){
    cin>>l[i];
  }
  sort(l.begin(),l.end());

  int sum=0;
  for(int j=0 ;j < n -1;j++){
    sum = sum +l[j] ;
  }

  if(l[n-1]<sum){
    cout<<"Yes"<<endl;
  }

  else{
    cout<<"No"<<endl;
  }
}



  
  

Measured memory_bytes: 256
N=int(input())

from collections import defaultdict
cnt=defaultdict(int)
maxcnt=0
for i in range(N):
  S=input()
  cnt[S]+=1
  if maxcnt<cnt[S]:
    maxcnt=cnt[S]

out=[]
keys=cnt.keys()
for k in keys:
  if cnt[k]==maxcnt:
    out.append(k)
    
out.sort()
n=len(out)
for i in range(n):
  print(out[i])

Measured memory_bytes: 32488
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
int main() {
  ll a;
  cin>>a;
  vector<ll>vec(a-1);
  vector<ll>veco(a);
  
  for(ll i=0;i<a-1;i++){
    cin>>vec.at(i);
  }
  veco.at(a-1)=vec.at(a-2);
  for(ll i=a-2;i>=1;i--){
    veco.at(i)=min(vec.at(i),vec.at(i-1));
  }
  veco.at(0)=vec.at(0);
  ll b=0;
  for(ll i=0;i<a;i++){
    b+=veco.at(i);
  }
  cout<<b<<endl;
}
  
    


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

using namespace std;
#define int long long
#define double long double
#define rep(i, n) for(int i=0;i<(n);++i)
#define INF (1ll<<60)
#define FI first
#define SE second
typedef pair<int, int> pii;
#define l_b lower_bound
#define u_b upper_bound

int N, K;
int A[100100];
int B[100100];

signed main() {
    cin >> N >> K;
    rep(i, N) {
        cin >> A[i] >> B[i];
    }
    int maxval = 0;
    for (int r = 1; r <= K; r <<= 1) {
        if ((K & r) == 0)continue;
        int X = (K ^ r) | (r - 1);
        int val = 0;
        rep(i, N) {
            if ((A[i] | X) == X) {
                val += B[i];
            }
        }
        maxval = max(maxval, val);
    }
    int X = K;
    int val = 0;
    rep(i, N) {
        if ((A[i] | X) == X) {
            val += B[i];
        }
    }
    maxval = max(maxval, val);
    cout << maxval << endl;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define PI 				acos(-1)
#define mp				make_pair
#define pb				push_back
#define all(a)			(a).begin(), (a).end()
#define srt(a)			sort(all(a))
#define mem(a, h)		memset(a, (h), sizeof(a))
#define f 				first
#define s 				second
#define MOD				1000000007
#define MOD1			998244353
#define EPS				1e-9
#define fore(i, b, e)	for(int i = b; i < e; i++)
#define forg(i, b, e, m)	for(int i = b; i < e; i+=m)
int in(){int r=0,c;for(c=getchar();c<=32;c=getchar());if(c=='-') return -in();for(;c>32;r=(r<<1)+(r<<3)+c-'0',c=getchar());return r;}

using namespace std;
using namespace __gnu_pbds;

typedef long long 		ll;
typedef unsigned long long 		ull;
typedef pair<int, int>  ii;
typedef vector<int>     vi;
typedef vector<ii>      vii;
typedef vector<ll>      vll;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
const int tam = 10000010;
int n;
map<string, int> dp[300];
string add = "ACGT";
ll f(int pos, string s)
{
	if(s.substr(1) == "AGC" || s.substr(1) == "ACG" || s.substr(1) == "GAC")
		return 0;
	if(s[0] + s.substr(2) == "AGC" || s.substr(0, 2) + s[3] == "AGC")
		return 0;
	//cout<<pos<<' '<<s<<'\n';
	if(pos == n-1) return 1;
	if(dp[pos][s] != 0) return dp[pos][s];
	ll res = 0;
	fore(i, 0, 4)
		res = (res + f(pos + 1, (s + add[i]).substr(1))) % MOD;
	//cout<<pos<<' '<<s<<' '<<res<<'\n';
	return dp[pos][s] = res;
}
int main()
{
	ios::sync_with_stdio(0); cin.tie(0);
	//freopen("qwe.txt", "r", stdin);
	//freopen("asd.txt", "w", stdout);
	cin>>n;
	ll res = 0;
	fore(i, 0, 4)
	{
		string s = "   ";
		s += add[i];
		res = (res + f(0, s)) % MOD;
		//cout<<res<<"$\n";
	}
	cout<<res<<'\n';
	return 0;
}

// read the question correctly (is y a vowel? what are the exact constraints?)
// look out for SPECIAL CASES (n=1?) and overflow (ll vs int?) ARRAY OUT OF BOUNDSS2

Measured memory_bytes: 2688
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <map>
#include <vector>

#define REP(i,n) for(int i=0;i<(int)n;i++)
#define REP1(j,n) for(int j=0;j<(int)n;j++)
#define REPD(i,n) for(int i=n;i>=0;i--)
#define REPD1(j,n) for(int j=n;j=>0;j--)
#define REPS(i,n) for(int i=1;i<=(int)n;i++)
#define REPS1(j,n) for(int j=1;j<=(int)n;j++)
#define rep(i,a,n) for(int i=a;i<(int)n;i++)
#define SZ(x) ((int)(x).size())	//size() unsigned -> int
#define DescSort(a) sort(a.begin(),a.end(),std::greater<int>())

using namespace std;
typedef long long ll;

int main(void) {
	int a;
	cin >> a;
	int even = a / 2;
	int odd = a - even;
	cout << even * odd << endl;

	return 0;
}



Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>


int main(){
	int W,H,N;
	int W_0 =0;
	int H_0 =0;
	scanf("%d",&W);
	scanf("%d",&H);
	scanf("%d",&N);

	int x[N];
	int y[N];
	int a[N];

	int sq;

	for (int i = 0; i < N; i++){
		scanf("%d",&x[i]);
		scanf("%d",&y[i]);
		scanf("%d",&a[i]);
	}

	for(int i=0; i<N; i++){
		if(a[i] == 1){
			if(W_0 < x[i]){
				W_0 = x[i];
			}
		}
		else if(a[i] == 2){
			if(W > x[i]){
				W = x[i];
			}
		}
		else if(a[i] == 3){
			if(H_0 < y[i]){
				H_0 = y[i];
			}
		}
		else if(a[i] == 4){
			if(H > y[i]){
				H = y[i];
			}
		}
	}

	int Wide = W -W_0;
	int High = H -H_0;

	if(Wide < 0 || High < 0){
		sq = 0;
	}
	else{
		sq = Wide*High;
	}

	printf("%d\n",sq);

	return 0;
}

Measured memory_bytes: 128
while True:
    amount = int(input())

    if amount == 0:
        break

    efficiency_list = []

    for _ in range(amount):
        crop = input().split()
        time = sum(map(int, crop[2:7]))

        M = int(crop[9])
        if M > 1:
            for _ in range(1, M):
                time += int(crop[5]) + int(crop[6])

        fruits = M * int(crop[7])
        efficiency = (fruits * int(crop[8]) - int(crop[1])) / time

        efficiency_list.append((crop[0], efficiency))

    efficiency_list.sort(key=lambda x:(-x[1], x[0]))

    for element in efficiency_list:
        print(element[0])
    print("#")

Measured memory_bytes: 6732
def main():
    L, R, d = map(int,input().split())

    if L%d==0 and R%d==0:
        print(int((R-L)/d) + 1)
        return
    else:
        l = L - L % d
        r = R - R % d
        print(int((r - l)/d))
        return
    
if __name__=='__main__':
    main()


Measured memory_bytes: 9052
#include <bits/stdc++.h>
using namespace std;
int a[200005];
int main()
{
	int n;
	scanf("%d", &n);
	for (int i = 1; i < n; i++) {
		int t;
		scanf("%d", &t);
		a[t]++;
	}
	for (int i = 1; i <= n; i++) {
		printf("%d\n", a[i]);
	}
	return 0;
}

Measured memory_bytes: 4548
#include<bits/stdc++.h>
#define lint long long
#define st first
#define nd second
#define INF 0x3f3f3f3f

using namespace std;


int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
	int k; cin>>k;
	string s; cin>>s;
	for(int i=0; i<min(k, (int)s.size());i++)	cout<<s[i];
	
	if((int)s.size() > k)	
		cout<<"...";
	cout<<"\n";
	return 0;	
}


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

#define rep(i,s,n) for (int i = (int)s; i < (int)n; i++)
#define ll long long
#define pb push_back
#define eb emplace_back
#define All(x) x.begin(), x.end()
#define Range(x, i, j) x.begin() + i, x.begin() + j
#define lbidx(x, y) lower_bound(x.begin(), x.end(), y) - x.begin()
#define ubidx(x, y) upper_bound(x.begin(), x.end(), y) - x.begin()
#define llbidx(x, y, z) lower_bound(x.begin(), x.end(), z) - lower_bound(x.begin(), x.end(), y) // 二要素間の距離
#define deg2rad(deg) ((((double)deg)/((double)360)*2*M_PI))
#define rad2deg(rad) ((((double)rad)/(double)2/M_PI)*(double)360)
#define Find(set, element) set.find(element) != set.end()
#define Decimal(x) printf("%.10f\n", x) // 小数点を10桁まで表示
// debug用
#define PrintVec(x) for (auto elementPrintVec: x) { cout << elementPrintVec << " "; } cout << endl;

typedef pair<int, int> PI;
typedef pair<ll, ll> PLL;

int POWINT(int x, int n) {
  int ret = 1;
  rep(i, 0, n) ret *= x;
  return ret;
};

ll POWLL(int x, int n) {
  ll ret = 1;
  rep(i, 0, n) ret *= x;
  return ret;
};

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

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

vector<string> dp[11];

vector<char> T = { 'a', 'b', 'c', 'd', 'e',
                   'f', 'g', 'h', 'i', 'j',
                   'k', 'l', 'm', 'n', 'o',
                   'p', 'q', 'r', 's', 't',
                   'u', 'v', 'w', 'x', 'y', 'z'};

int main() {
  int N;
  cin >> N;
  dp[1].pb("a");
  rep(i, 2, 11) {
    for (auto s: dp[i - 1]) {

      int m = 0;
      for (char ch: s) {
        m = max((int) ch - 'a', m);
      }

      rep(j, 0, m+2) {
        dp[i].pb(s+T[j]);
      }
    }
  }

  // auto tmp = dp[N];

  sort(All(dp[N]));

  rep(i, 0, dp[N].size()) {
    cout << dp[N][i] << endl;
  }



  return 0;
};


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

typedef unsigned long long llint;
#define FOR(i, a, b) for(llint i = a; i <= b; ++i)
#define REP(i, n) for(llint i = 0; i < n; ++i)

const int maxN = 100000;

int x[maxN], n, K;

void run() {
    cin >> n >> K;
    int start = n;
    REP(i, n) {
        cin >> x[i];
        if (x[i] >= 0 && start > i) {
            start = i;
        }
    }

    int cnt = 0, ans = 2'000'000'000;

    for (int i = 0; i < n; ++i) {
        while (i - cnt + 1 > K) {
            cnt += 1;
        }

        if (i - cnt + 1 == K) {
            ans = min(ans, x[i] - x[cnt] + min(abs(x[i]), abs(x[cnt])));
        }
    }

    cout << ans << "\n";
}

int main() {
#ifdef LOCAL
    freopen("input", "r", stdin);
#endif
    ios::sync_with_stdio(0);
    cin.tie(0);
    run();
#ifdef LOCAL
    fclose(stdin);
#endif
    return 0;
}

Measured memory_bytes: 640
from math import floor,ceil,sqrt,factorial,log
from collections import Counter, deque
from functools import reduce
import itertools
def S(): return input()
def I(): return int(input())
def MS(): return map(str,input().split())
def MI(): return map(int,input().split())
def FLI(): return [int(i) for i in input().split()]
def LS(): return list(MS())
def LI(): return list(MI())
def LLS(): return [list(map(str, l.split() )) for l in input()]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def LLSN(n: int): return [LS() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]

N,K = MI()

A = LI()

for j in range(K, N+1):
    if j == K:
        continue
    if A[j-K-1] < A[j-1]:
        print("Yes")
    else:
        print("No")

Measured memory_bytes: 31992
import sys
import math
import cmath
sys.setrecursionlimit(1000000)

def dft_divide(f, l):
    if l == 1:
        return
    ll = l // 2
    f0 = [f[2 * i] for i in range(ll)]
    f1 = [f[2 * i + 1] for i in range(ll)]
    dft_divide(f0, ll)
    dft_divide(f1, ll)
    dft_solve(f, f0, f1, l)
    return

def dft_solve(f, f0, f1, l):
    ll = l // 2
    for i in range(l):
        z = cmath.exp(2j * i * cmath.pi / l)
        f[i] = f0[i % ll] + z * f1[i % ll]
    return

def idft_divide(f, l):
    if l == 1:
        return
    ll = l // 2
    f0 = [f[2 * i] for i in range(ll)]
    f1 = [f[2 * i + 1] for i in range(ll)]
    idft_divide(f0, ll)
    idft_divide(f1, ll)
    idft_solve(f, f0, f1, l)
    return

def idft_solve(f, f0, f1, l):
    ll = l // 2
    for i in range(l):
        z = cmath.exp(-2j * i * cmath.pi / l)
        f[i] = f0[i % ll] + z * f1[i % ll]
    return

def multiply(f, g):
    lf, lg = len(f), len(g)
    m = 2 ** (int(math.log2(lf + lg)) + 1)
    for i in range(m - lf):
        f.append(0)
    for i in range(m - lg):
        g.append(0)
    dft_divide(f, m)
    dft_divide(g, m)
    fg = [f[i] * g[i] for i in range(m)]
    idft_divide(fg, m)
    c = [round(fg[i].real / m) for i in range(m)]
    return c, m

n, m = map(int, input().split())
a = list(map(int, input().split()))
ma = max(a)
happiness1 = [0] * (ma + 1)
happiness2 = [0] * (ma + 1)
for i in a:
    happiness1[i] += 1
    happiness2[i] += 1
c, lc = multiply(happiness1, happiness2)
cnt = 0
ans = 0
for i in range(min(200000, lc - 1), -1, -1):
    if c[i] + cnt >= m:
        ans += (m - cnt) * i
        cnt += (m - cnt)
    else:
        ans += c[i] * i
        cnt += c[i]
    if cnt == m:
        break
print(ans)

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

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

typedef long long ll;

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

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

int dx[5] ={1,-1,0,0};
int dy[5] ={0,0,1,-1};
int h,w;
char maze[20][20];
int judge[20][20];
int ans =0;
int cnt[20][20];
void inite(){
	for(int i=0; i<20; i++){
		for(int j=0; j<20; j++){
			cnt[i][j] =INF;
			judge[i][j] =true;
		}
	}
}
void dfs(int y,int x){

/*	cout<<x<<" "<<y<<endl;*/
	for(int i=0; i<4; i++){
		int nx = x+dx[i];int ny = y+dy[i];

	if( nx>=0 && nx<w && ny>=0 && ny<h && maze[ny][nx] !='#' && judge[ny][nx] ){

		/*cnt[ny][nx] =min(cnt[ny][nx],cnt[y][x]+1);*/
		if(cnt[ny][nx]>cnt[y][x]+1){
			cnt[ny][nx] =cnt[y][x]+1;
		judge[ny][nx] =false;
		dfs(ny,nx);
		judge[ny][nx] =true;
		}


	}
	}

	return ;
}

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

	cin>>h>>w;

	for(int i=0; i<h; i++){
		for(int j=0; j<w; j++){
			cin>>maze[i][j];
		}
	}

	int ans =0;
	for(int i=0; i<h; i++){
		for(int j=0; j<w; j++){
			inite();
			if(maze[i][j] !='#'){
				cnt[i][j] =0;
				dfs(i,j);

				for(int i=0; i<h; i++){
					for(int j=0; j<w; j++){
						if(cnt[i][j] !=INF)ans = max(ans,cnt[i][j]);
					}
				}
			}

/*			cout<<i<<" "<<j<<endl;
			for(int i=0; i<h; i++){
				for(int j=0; j<w; j++){
					if(cnt[i][j] == INF){
						cout<<"#";
					}else{
					cout<<cnt[i][j];
					}
				}
				cout<<endl;
			}
			cout<<endl;*/
		}
	}

	writeln(ans);



}




Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <set>

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,j) FOR(i,0,j)
#define mp std::make_pair

typedef long long ll;
typedef unsigned long long ull;
typedef std::pair<int,int> P;
typedef std::pair<int,P> State;

const int INF = 1001001001;

// S N E W(南北東西)
const int dx[8] = {0, 0, 1, -1, 1, 1, -1, -1}, dy[8] = {1, -1, 0, 0, 1, -1, 1, -1};

struct Edge{
    int to, cost;
};

int N;
std::vector<Edge> G[20];
int d[20][20];

bool isEndPoint(int v){
    return G[v].size() == 1;
}

int dfs(int v, int p){
    int res = 0;
    for(auto &e : G[v]){
        if(e.to != p && !isEndPoint(e.to)){
            res += e.cost + dfs(e.to, v);
        }
    }

    return res;
}

int main(){
    while(std::cin >> N, N){
        REP(i, 20){
            G[i].clear();
        }
    
        REP(i, 20){
            REP(j, 20){
                if(i == j){d[i][j] = 0;}
                else{d[i][j] = INF;}
            }
        }

        REP(i, N-1){
            int from, to, cost;
            std::cin >> from >> to >> cost;
            --from; --to;
            G[from].push_back({to, cost});
            G[to].push_back({from, cost});
            d[from][to] = cost;
            d[to][from] = cost;
        }

        REP(k, N){
            REP(i, N){
                REP(j, N){
                    d[i][j] = std::min(d[i][j], d[i][k] + d[k][j]);
                }
            }
        }

        if(N == 2){
            printf("%d\n", G[0][0].cost);
        }else{
            int t = dfs(0, -1), min_t = INF;
            REP(i, N){
                if(!isEndPoint(i)){
                    min_t = std::min(min_t, 2*t - d[0][i]);
                }
            }

            // printf("t: %d\n", t);
            printf("%d\n", min_t);
        }
    }
}

Measured memory_bytes: 1184
#include <iostream>

using namespace std;

int main(){
	int k;
	int num = 7, ans = 1;
	cin >> k;
	if (k % 2 == 0){
		cout << "-1\n";
		return 0;
	}
	num %= k;
	while (num != 0){
		num = num * 10 + 7;
		num %= k;
		ans += 1;
		if (ans > k){
			cout << "-1\n";
			return 0;
		}
	}
	cout << ans << '\n';
	return 0;
}


Measured memory_bytes: 3568
import math
n,k = map(int,input().split())
ans = 0
for i in range(1,n+1):
    if i <= k-1:
        if math.log(k/i,2) == int(math.log(k/i,2)):
            ans += (1/n)*(0.5)**(int(math.log(k/i,2)))
        else:
            ans += (1/n)*(0.5)**(int(math.log(k/i,2))+1)
    else:
        ans += 1/n
print(ans)

Measured memory_bytes: 38896
import java.util.*;
 
public class Main {
	public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        String s= sc.next();
        if (a >= 3200) {
            System.out.println(s);
            System.exit(0);
        }
        System.out.println("red");
    }
}


Measured memory_bytes: 21716
n, l = map(int,input().split())
min = 10**5
ans = 0
for i in range(1, n + 1):
    tmp = n*(l-1) + n*(n+1)//2 - (l+i-1)
    if abs(l+i-1) < min:
        ans = tmp
        min = abs(l+i-1)
print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define pi 2*asin(1.0)
#define MAX 10000000
#define MOD 1000000007
 
 
vector<long> fac(MAX);
vector<long> finv(MAX);
vector<long> inv(MAX);
 
//template functions
/////////////////////////
void Cominit(){
  fac.at(0)=fac.at(1)=1;
  finv.at(0)=finv.at(1)=1;
  inv.at(1)=1;
  for(long i=2;i<MAX;i++){
      fac.at(i)=(fac.at(i-1)*i)%MOD;
      inv.at(i)=MOD-inv.at(MOD%i)*(MOD/i)%MOD;
      finv.at(i)=finv.at(i-1)*inv.at(i)%MOD;
  }
}

long facComb(long N,long M){// nCm%
if(N<M) return 0;
if(N<0||M<0) return 0;
return fac.at(N)*(finv.at(M)*finv.at(N-M)%MOD)%MOD;
}

long Comb(long N,long M){// nCm
long ans=1;
for(long i=N;i>N-M;i--){
    ans=ans*i;
}
for(long i=M;i>0;i--){
    ans=ans/i;
}
return ans;
}

long Perm(long N,long M){// nPm
long ans=1;
for(long i=N;i>N-M;i--){
    ans=ans*i;
}
return ans;
}

long GCM(long A,long B){
            long W,r;
    if(A<B){

        W=B;
        B=A;
        A=W;
    }
    while(A%B!=0){
        r=A%B;
        A=B;
        B=r;
    }
    return B;
}
long LCM(long A,long B){
    return (A*B)/GCM(A,B);
}

long upDiv(long a,long b){
  return (a+b-1)/b;
}

/////////////////////////


//Answer


int main() {
long N;
cin>>N;
long sum=0;
long long sq=0;
long long divsq=0;
long div=0;
vector<long> A(N);
for(long i=0;i<N;i++){
cin>>A.at(i);
sum+=A.at(i);
sq+=A.at(i)*A.at(i);
div+=sum/MOD;
sum=sum%MOD;
divsq+=sq/MOD;
sq=sq%MOD;
}
if((div-divsq)%2==0){
    cout<<((sum*sum-sq)/2)%MOD<<endl;
}else{
    cout<<((sum*sum-sq+MOD)/2)%MOD<<endl;
}



}



Measured memory_bytes: 239208
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <utility>
#include <boost/algorithm/string/split.hpp>
#include <boost/algorithm/string/classification.hpp> 
using namespace std; 

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

    int X, Y, Z;
    int tmp;
    cin >> X >> Y >> Z;
    swap(X, Y);
    swap(X, Z);
    cout << X << " " << Y << " " << Z << "\n";

    return 0;
}



Measured memory_bytes: 256
#include <stdio.h>
int main(){
    int n,x,i,m[1001],min=114514;
    scanf("%d%d",&n,&x);
    int cnt=n;
    for(i=0;i<n;i++){
        scanf("%d",&m[i]);
        if(m[i]<min)min=m[i];
        x-=m[i];
    }
    cnt+=x/min;
    printf("%d",cnt);
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int a[100001], dp[100001];
int main(){
    int n;
    scanf("%d", &n);
    for(int i=1;i<=n;i++){
        scanf("%d", &a[i]);
    }   
    for(int i=2;i<=n;i++){
        if(a[i] <= a[i-1]) dp[i] = 1;
    }
    int ans = 0, sum = 0;
    for(int i=1;i<=n;i++){
        if(dp[i] == 0) sum = 0;
        else sum++;
        ans = max(ans, sum);
    }
    printf("%d\n", ans);
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main() {
    int n;
    cin >> n;
    int ans=0;
    for(int i=1;i<=n;++i) {
        int cnt=0;
        for(int j=1;j<=n;++j) {
            if(i%j==0 && i%2==1) ++cnt;
        }
        if(cnt==8) ++ans;
    }
    cout << ans << endl;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); i++)
#define all(x) (x).begin(),(x).end()
#define dup(x,y) (((x)+(y)-1)/(y))
#define sz(x) (int)(x).size()
#define MOD 1000000007
#define pint pair<int,int>
#define pdouble pair<double,double>
using namespace std;
typedef long long ll;

int main(){
    int n;
    cin >> n;
    vector<pint> p(n);
    rep(i,n) cin >> p[i].second >> p[i].first;
    sort(all(p));
    ll t = 0;
    int f = 0;
    rep(i,n){
        t += p[i].second;
        if(t > p[i].first) f = 1;
    }
    if(f == 0) puts("Yes");
    else puts("No");
}

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

int main(){
  int N;
  cin >> N;
  if (N < 1200){
    cout << "ABC" << endl;
  }
  else if (N < 2800){
    cout << "ARC" << endl;
  }
  else {
    cout << "AGC" << endl;
  }
}

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

int main()
{
	int n;
	cin>>n;
	int mod=pow(10,9)+7;
	
	vector<int> arr;
	arr.resize(n,0);
	long long sum=0;
	for(int i=0;i<n;i++)
	{
		cin>>arr[i];
		sum=sum+arr[i];
	}
	sum=sum%mod;
	long long res=0;
	
	for(int i=0;i<n;i++)
	{
		sum=sum-arr[i];
		sum=(sum+mod)%mod;
		res=res+arr[i]*(sum%mod);
		res=res%mod;
	}
	cout<<res<<endl;
	return 0;
}

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

int main(void) {
  std::vector<char> v1, v2;
  for (int j = 0; j < 2; j++) {
    for (int i = 0; i < 3; i++) {
      char input;
      if(std::cin >> input) {
        if(j == 0)
          v1.push_back(input);
        else
          v2.push_back(input);
      }
    }
  }

  /*for(char c : v1) {
    std::cout << c << std::endl;
  }
  for(char c : v2) {
    std::cout << c << std::endl;
  }
  */

  if(v1[0] == v2[2] and v1[1] == v2[1] and v1[2] == v2[0])
    std::cout << "YES" << std::endl;
  else
    std::cout << "NO" << std::endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <numeric>
#include <limits>
#include <numeric>
#include <type_traits>
using namespace std;
typedef pair<int, int> P;

typedef long long ll;
const int MOD = 1000000007;

    bool cmp(const P &A, const P &B){
        return (A.second < B.second);
    }


int gcd(int a, int b){
    if(b == 0) return a;
    else gcd(b, a%b);
}

int main(){  
    int a,b,c;
    cin >> a >> b >> c;
    cout << min(c, b/a);
}


Measured memory_bytes: 256
// inputに入力データ全体が入る
function Main(input) {
	// 1行目がinput[0], 2行目がinput[1], …に入る
  input = input.split("\n");
  
  //スペース区切り　input[0] が tmp[0], tmp[1],...
	tmp = input[1].split(" ");
  
  //この時点では全部文字列（数値に変換しないといけない）

	//文字列から10進数に変換するときはparseIntを使います
	var a = parseInt(tmp[1], 10);
  
    if(a ==1){
      console.log('%d', 1);
    }else{
      console.log('%d', 0);
    }
  //%は符号付き10進数, %sは文字列
}

//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
   int n;
   cin>>n;
   vector<int> v(n+1);
   map<ll,ll> mp;
   for(int i=1;i<=n;i++)
   {cin>>v[i];
       mp[i-v[i]]++;
   }
   ll ans=0;
   for(int i=1;i<=n;i++)
   {
       ans+=mp[i+v[i]];
   }
   cout<<ans<<endl;
   return 0;
}

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

const int N = 1e5 + 100;

int main(){

    # ifdef FILEs
        freopen( "input.txt", "r", stdin );
        freopen( "output.txt", "w", stdout );
    # endif
    ios_base::sync_with_stdio( false );
    
    long long a, b;
    cin >> a >> b;
    cout << a * b / __gcd(a,b);
}

Measured memory_bytes: 256
"use strict";
var GET=(function(){function f(s){return new g(s);}function g(s){this._s=s.trim().split("\n");this._y=0;}g.prototype.a=function(f){var s=this._s, y=this._y, r;if(typeof s[y]==="string")s[y]=s[y].split(" ").reverse();r=s[y].pop();if(!s[y].length)this._y++;return f?r:+r;};g.prototype.l=function(f){var s=this._s[this._y++].split(" ");return f?s:s.map(a=>+a);};g.prototype.m=function(n,f){var r=this._s.slice(this._y,this._y+=n).map(a=>a.split(" "));return f?r:r.map(a=>a.map(a=>+a));};g.prototype.r=function(n,f){var r=this._s.slice(this._y,this._y+=n);return f?r:r.map(a=>+a);};return f;})();
var o=GET(require("fs").readFileSync("/dev/stdin","utf8"));
function xArray(v){var a=arguments,l=a.length,r="Array(a["+--l+"]).fill(0).map(x=>{return "+v+";})";while(--l)r="Array(a["+l+"]).fill(0).map(x=>"+r+")";return eval(r);}

console.log(main());
function main(){
  var a = o.a();
  var b = o.a();
  if(Math.max(a,b)>9)return -1;
  return a*b;
}

Measured memory_bytes: 22080
#include <bits/stdc++.h>
#define INF 1e12
using namespace std;

#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define ALL(a)  (a).begin(),(a).end()
#define endl "\n"

template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}
typedef long long ll;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}

void solve() {
    int N;
    cin >> N;
    vector<int> cds(N);
    REP(i,N) cin >> cds[i];
    vector<ll> sum(N);
    vector<ll> rsum(N,0);
    ll sm = 0;
    REP(i,N) {
        sm += cds[i];
        sum[i] = sm;
    }
    // rsum[N-1] N枚相手が取った時に自分の取る枚数。
    sm = 0;
    REPR(i,N-1) {
        rsum[i] = sm;
        sm += cds[i];
    }
    // for(auto it:sum) cerr << it << endl;
    // for(auto it: rsum) cerr << it << endl;

    ll ans = INF;
    REP(i,N-1) chmin(ans,abs(sum[i]-rsum[i]));


    cout << ans << endl;
}

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


Measured memory_bytes: 4096
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(ll i = 0; i<n; i++)
int main()
{
	vector<char> weath(3);

	rep(i,3){
		cin >> weath[i];

	}

	if(weath[1] == 'S'){
		if(weath[0] == 'S' && weath[2] == 'S')
			cout << 0;
		else
			cout << 1;
	}
	else{
		if(weath[0] == 'S' && weath[2] == 'S')
			cout << 1;
		else if(weath[0] == 'R' && weath[2] == 'R')
			cout << 3;
		else
			cout << 2;
	}

	cin >> weath[1];

	
	return 0;	
}


Measured memory_bytes: 3620
#include <iostream>
#include <string>
int main() {
  std::string s;
  std::cin >>s;
  while(s.size()) {
    if(s.substr(s.size()-5)=="erase"||s.substr(s.size()-5)=="dream"){s.erase(s.size()-5, 5);}
    else if(s.substr(s.size()-6)=="eraser"){s.erase(s.size()-6, 6);}
    else if(s.substr(s.size()-7)=="dreamer"){s.erase(s.size()-7, 7);}
    else {break;}
  }
  std::cout << (s.size()?"NO":"YES") << "\n";
}


Measured memory_bytes: 512
#include<iostream>
#include<stdio.h>
using namespace std;
int main(){
    int n,d,x,i;
    cin>>n>>d>>x;
    d--;
    int a[n];
    for(i=0;i<n;i++)
        cin>>a[i];
    for(i=0;i<n;i++)
        x+=((d/a[i])+1);
    cout<<x<<endl;
}

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

int main()
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin>>n;
  vector<int>x(n),dp(n,INT_MAX);
  int i=0;
  for(;i<n;i++)
    cin>>x[i];
  dp[0]=0;  
  for(i=0;i<n;i++)
  {
    if(i+1<n)
      dp[i+1]=min(dp[i+1],dp[i]+abs(x[i]-x[i+1]));
    if(i+2<n)
      dp[i+2]=min(dp[i+2],dp[i]+abs(x[i]-x[i+2]));
  }
  cout<<dp[n-1]<<"\n";
  return 0;
}


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

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

void solve(void) {
  int N; cin >> N;
  int arr[1010];
  rep(N, i) cin >> arr[i];

  rep(N, i) {
    if(arr[i] % 2 == 0){
      if((arr[i] % 3 != 0) && (arr[i] % 5 != 0)){
        cout << "DENIED" << endl;
        return;
      }
    }
  }
  cout << "APPROVED" << endl;
  return;
}

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

Measured memory_bytes: 256