akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <stdio.h>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <utility>
#include <tuple>
#include <math.h>
#include <set>
#include <map>
using namespace std ;
using ll = long long ;
using ld = long double ;
using vll = vector<ll> ;
using vvll = vector<vll> ;
using vc = vector<char> ;
using vvc = vector<vc> ;
using vb = vector<bool> ;
using vvb = vector<vb> ;
using pll = pair<ll,ll> ;
#define all(v) v.begin(),v.end() 
const ll INF = 1e18 ;
const ll mod = 1e9+7 ;
const double pie = acos(-1); 
vll dx4 = {-1,0,1,0} ;
vll dy4 = {0,-1,0,1} ;
vll dx8 = {-1,0,1,1,1,0,-1,-1} ;
vll dy8 = {-1,1,-1,0,1,1,1,0} ; 

void fix_cout(){cout << fixed << setprecision(20) ; }
ll gcd(ll a,ll b){if(b==0) return a ; return gcd(b,a%b) ; }
ll lcm(ll a,ll b){return a/gcd(a,b)*b ; }
void chmax(ll &a,ll b){if(a<b) a = b ; }
void chmin(ll &a,ll b){if(a>b) a = b ; }

int main(){
	ll n ; cin >> n ;
	map<string,int> m ;
	for(int i=0;i<n;i++){
		string s ; cin >> s ;
		m[s]++ ;
	}
	cout << "AC x " << m["AC"] << endl ;
	cout << "WA x " << m["WA"] << endl ;
	cout << "TLE x " << m["TLE"] << endl ;
	cout << "RE x " << m["RE"] << endl ;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll A, B, K;

int main(){
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    cin >> A >> B >> K;
    if (K <= A) cout << A - K << ' ' << B;
    else if (K <= A + B) cout << 0 << ' ' << (A + B) - K ;
    else cout << 0 << ' ' << 0;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vll = vector<long long>;
using vp = vector<pair<int, int>>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using vvll = vector<vector<long long>>;
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 (b<a) {a=b; return 1;} return 0;}

vector<vector<int>> to;
vi path;
vi path1ton;
int n, x, y;

void dfs(int v, int p=-1) {
    path.pb(v);
    if (path.front() == 0 and path.back() == n-1) path1ton = path;
    for (auto u : to[v]) {
        if (u == p) continue;
        dfs(u, v);
    }
    path.pop_back();
}

void dfs2(int v, int& sz, int p=-1) {
    sz++;
    for (auto u : to[v]) {
        if (u == p) continue;
        if ((v == x && u == y) || (v == y && u == x)) continue;
        dfs2(u, sz, v);
    }
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    cin >> n;
    to.resize(n);
    rep(i, n-1) {
        int a, b;
        cin >> a >> b;
        a--; b--;
        to[a].pb(b);
        to[b].pb(a);
    }
    dfs(0);
    int m = sz(path1ton);
    x = path1ton[(m+1)/2];
    y = path1ton[(m+1)/2 - 1];
    int fennec = 0, snuke = 0;
    dfs2(0, fennec);
    dfs2(n-1, snuke);
    if (fennec > snuke) cout << "Fennec" << endl;
    else cout << "Snuke" << endl;
}

Measured memory_bytes: 14456
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        gacha solver = new gacha();
        solver.solve(1, in, out);
        out.close();
    }

    static class gacha {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            Set<String> set = new HashSet<>();
            for (int i = 0; i < n; i++) {
                set.add(in.next());
            }
            out.append(String.valueOf(set.size()));
        }

    }
}



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

typedef struct{
    int k;
    int p;
    int l;
    int r;
}Node;

Node node[500002];
const int nil = -1;
int root = -1;
int z1 = 0;
int tmp = -1;

int treeMinimum(int x){
    while(node[x].l != nil){
        x = node[x].l;
    }
    return x;
}
int treeSuccessor(int x){
    if (node[x].r != nil)
        return treeMinimum(node[x].r); // case 1
    int y = node[x].p;
    while(y != nil && x == node[y].r){
        x = y;
        y = node[y].p;
    }
    return y; // case 2
}


void deleteee(int m){
    int y;
    int x;
    if(node[m].l==nil || node[m].r==nil)  y = m;
    else y = treeSuccessor(m);
    if (node[y].l != nil)
        x = node[y].l;
    else
        x = node[y].r;
    if (x != nil)
        node[x].p = node[y].p;

    if (node[y].p == nil)
        root = x;
    else
    {
        if (y == node[node[y].p].l)
            node[node[y].p].l = x;
        else
            node[node[y].p].r = x;
    }
    if (y !=m)
        node[m].k = node[y].k;
    node[y].r = tmp;
    tmp = y;
}

void insert(int k){
    int y = nil;
    int x = root;
    int z;
    if (tmp == nil) z=z1++;
    else
    {
        z = tmp;
        tmp = node[tmp].r;
    }

    node[z].k = k;
    node[z].l = nil;
    node[z].r = nil;

    while(x != nil){
        y = x;
        if(node[z].k < node[x].k){
            x = node[x].l;
        }
        else x = node[x].r;
    }
    node[z].p = y;
    if(y == nil){
        root = z;
    }
    else{
        if(node[z].k < node[y].k){
            node[y].l = z;
        }
        else node[y].r = z;
    }
}

void inorder(int ppp){
    if (ppp == nil) return;
    inorder(node[ppp].l);
    printf(" %d", node[ppp].k);
    inorder(node[ppp].r);
}

void preorder(int ppp){
    if (ppp == nil) return;
    printf(" %d", node[ppp].k);
    preorder(node[ppp].l);
    preorder(node[ppp].r);
}

int find(int a, int k){
    while(a!=nil && k!=node[a].k){
        if(k<node[a].k) a = node[a].l;
        else a = node[a].r;
    }
    return a;
}

int main()
{
    char cccc[20];
    int n;
    int a;
    scanf("%d", &n);
    for(int i=0; i<n; i++){
        scanf("%s", cccc);
        switch (cccc[0]){
            case 'f':
                scanf("%d", &a);
                if(find(root, a) != nil) printf("yes\n");
                else printf("no\n");
                break;
            case 'i':
                scanf("%d", &a);
                insert(a);
                break;
            case 'd':
                scanf("%d", &a);
                deleteee(find(root, a));
                break;
            default:
                inorder(root);
                printf("\n");
                preorder(root);
                printf("\n");
                break;
        }
    }
    return 0;
}



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

#define ll long long int

using namespace std;

int main() {
    ll a, b, x;
    cin >> a >> b >> x;
    if (a <= x && x <= (a+b)) {
        cout << "YES" << endl;;
    } else {
        cout << "NO" << endl;
    }
}


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

#define ll long long
#define ld long double
#define mod 1000000007LL
#define eps 1e-13
#define PI 3.141592653589793238L
#define INF 1000000011
#define INFLL 1000000000000000011LL
#define endl '\n'
#define vi vector<int>
#define vs vector<string>
#define vll vector<long long>
#define vc vector<char>
#define vs vector<string>
#define pii pair<int, int>
#define pll pair<long long, long long>
#define pil pair<int, long long>
#define pli pair<long long, int>
#define pcc pair<char, char>
#define pdd pair<double, double>
#define mp make_pair
#define F first
#define S second
#define pb(x) push_back(x)
#define fo(i,a,n) for(i = (a); i < (n); i++)
#define foi(i,a,n) for(i = (a); i <= (n); i++)
#define pd(x) cout<<x
#define sd(x) cin>>x
#define nl cout<<endl
#define gtl(x) getline(cin, (x))
#define flsh fflush(stdout)
#define sws ios_base::sync_with_stdio(false); cin.tie(0)
#define gcd __gcd
#define clr(x) memset(x,0,sizeof(x))
#define all(a) (a).begin(), (a).end()
#define foreach(i,a) for(__typeof((a).begin()) i = (a).begin(); i != (a).end(); ++i)
#define sz(a) (int)((a).size())
//int a[25]= { 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97 };
//int dw[4][2]={{0,1},{1,0},{0,-1},{-1,0}};
//int dw[8][2]={{0,1},{1,0},{0,-1},{-1,0},{1,1},{1,-1},{-1,1},{-1,-1}};
//ll fibonacci[2][2] = {{0,1},{1,1}};
//ll identity[2][2] = {{1,0},{0,1}};

int main() {
    sws;
	ll i,j,k;
	ll n,a,b;
	cin>>n>>a>>b;
	vll v(n+2);
	v[0] = 0; v[n+1] = (n+1);
	fo(i,1,n+1) cin >> v[i];
	vll dp(n+2,INFLL);
	dp[0] = 0;
	fo(i,1,n+2) {
		ll tmp = 0;
		for(j=i-1;j>=0;j--) {
			if (v[j] < v[i]) {
				dp[i] = min(dp[i],dp[j]+tmp);
				tmp += b;
			} else {
				tmp += a;
			}
		}
	}
	cout << dp[n+1] << endl;
	return 0;
}

Measured memory_bytes: 512
#include <algorithm>
#include <cstring>
#include <iostream>
#include <vector>
#include <cmath>
#include <math.h>
#include <stdio.h>
#include <iomanip>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <functional>
#define rep(i,n) for (int i = 0; i < (n); ++i)

using namespace std;
const int MOD = 1000000007;


typedef long long int ll; 
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;

void floatOutPutSetup(){
    cout << fixed;
    cout << setprecision(10);
}

int main(){
    int  n;
    cin >> n;
    int ans = 1000-(n%1000);
    if(ans == 1000){cout<<0;}else{cout<<ans;}
    return 0;
}

Measured memory_bytes: 3632
#include <iostream>
#include <algorithm>

#include <cmath>
#include <string>

using namespace std;

int main() {
  bool can = false;
  string S, T;

  cin >> S >> T;

  // sort(S.begin(), S.end(), greater<char>());
  sort(S.begin(), S.end(), less<char>());
  sort(T.begin(), T.end(), greater<char>());

  // cout << S << endl;
  // cout << T << endl;

  // for (unsigned int i = 0; i < S.length(); i++) {
  //   if (S[i] == T[i]) {
  //     if (i + 1 == S.length()) {
  //       if (S.length() < T.length()) {
  //         can = true;
  //         break;
  //       } else {
  //         can = false;
  //         break;
  //       }
  //     }
  //   } else if (S[i] < T[i]){
  //     can = true;
  //     break;
  //   } else {
  //     can = false;
  //     break;
  //   }
  // }

  if (S < T) cout << "Yes" << endl;
  else cout << "No" << endl;
  
  return 0;
}


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

using namespace std;

int main() {
    int n;
    cin >> n;
    set<int> lol;
    for (int i = 0; i < n; i++) {
        int x;
        cin >> x;
        lol.insert(x);
    }
    if (lol.size() == n) {
        cout << "YES";
    } else {
        cout << "NO";
    }
}

Measured memory_bytes: 12948
def gcd(a,b):
  while b!=0:
    a,b=b,a%b
  return a


N = int(input())
A = list(map(int, input().split()))

# 累積最大公約数的な
head = []
tail = []
head.append(A[0])
tail.append(A[-1])
for i, j in zip(A[1:], A[N-2::-1]):
    head.append(gcd(head[-1], i))
    tail.append(gcd(tail[-1], j))
ans = 0
for i in range(len(head)-2):
    tmp = gcd(head[i], tail[len(tail)-1-2-i])
    if ans < tmp:
        ans = tmp
print(max(head[-1], head[-2], tail[-2], ans))

Measured memory_bytes: 14076
// template version 1.2
using namespace std;
#include <iostream>
#include <bits/stdc++.h>

#define infile "../test/sample-1.in"
#define int long long
// #define INF 2147483647
#define INF 1000000000000000000LL
#define MOD 1000000007LL

// {{{ define basic macro
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _rrep(i,n) rrepi(i,0,n)
#define rrepi(i,a,b) for(int i=(int)(b-1);i>=(int)(a);--i)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)

#define foreach(x,a) for(auto& (x) : (a) )
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)

#define all(x) (x).begin(),(x).end()
#define sum(v) accumulate(all(v), 0LL)
#define sz(x) ((int)(x).size())
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define uni(x) sort(all(x));x.erase(unique(all(x)),x.end())
#define ten(n) ((int)1e##n)

template<class T> inline void chmax(T &a, const T &b) { if(a < b) a = b; }
template<class T> inline void chmin(T &a, const T &b) { if(a > b) a = b; }

template<typename A, size_t N, typename T> // n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

template <class T = int>
T in() {T x; cin>>x; return (x);}

struct Fast {
  Fast(){
    std::cin.tie(0);
    ios::sync_with_stdio(false);
  }
} fast;
// }}}
//{{{ dump macro
#ifdef PCM
  #include "dump.hpp"
#else
  #define dump(...) 42
  #define dump_1d(...) 42
  #define dump_2d(...) 42
#endif
//}}}
//{{{ others
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long double ld;
typedef pair<int,int> pii;
typedef tuple<int,int,int> iii;
template<typename T>
using PQ = priority_queue<T, vector<T>, greater<T>>;

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


int solve(){
  int n;cin>>n;

  int pos[n+1];
  int a[n];
  rep(i, n){
    cin>>a[i];
    pos[a[i]]=i;
  }

  set<int> x;  // index set
  x.insert(-1);
  x.insert(n);
  int res = 0;
  rep(i, 1, n+1){
    x.insert(pos[i]);
    auto it = x.find(pos[i]);
    int r,l;
    r = *(++it);
    --it;
    l = *(--it);
    dump(l,r, pos[i]);
    res += (r-pos[i]) * (pos[i]-l) * i;
  }

  cout << res << endl;

  return 0;
}

int test(){ //{{{
  return 0;
}
//}}}

signed main() { //{{{
#ifdef INPUT_FROM_FILE
  std::ifstream in(infile);
  std::cin.rdbuf(in.rdbuf());
#endif
#ifdef PCM
  test();
#endif
  solve();
  return 0;
} //}}}


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

# define C continue;
# define R return

# define D double
# define I insert
# define ll long long
# define ld long double

# define ull unsigned long long
# define ui unsigned int

# define pb push_back
# define pf push_front

# define vi vector < int >
# define vc vector < char >
# define vs vector < string >
# define vb vector < bool >
# define vd vector < D >
# define vll vector < ll >
# define vull vector < ull >
# define vld vector < ld >
# define PQ priority_queue

# define vvi vector < vector < int > >
# define vvb vector < vector < bool > >
# define vvc vector < vector < char > >
# define vvs vector < vs >
# define vvll vector < vector < ll > >
# define vvd vector < vector < D > >
# define vvld vector < vector < ld > >

# define all(v) (v).begin() , (v).end()
# define allrev(v) (v).rbegin() , (v).rend()
# define allcomp(v) v.begin() , v.end() , comp
# define allrevcomp(v) v.rbegin() , v.rend() , comp

# define pii pair < int , int >
# define pll pair < ll , ll >
# define pld pair < ld , ld >
# define pDD pair < D , D >

# define vpld vector < pld >
# define vpii vector < pii >
# define vpll vector < pll >
# define vpDD vector < pDD >

# define vvpii vector < vector < pii > >
# define F first
# define S second
# define mp make_pair

# define dist(a,b,p,q) sqrt((p-a)*(p-a) + (q-b)*(q-b))

# define pp(n) printf("%.10Lf",n);
# define line cout<<"\n";
# define fast ios_base::sync_with_stdio(false) ; cin.tie(0) ; cout.tie(0);

string vow = "aeiou";
int month[] = {-1, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

const int dxhorse[] = {-2, -2, -1, -1, 1, 1, 2, 2};
const int dyhorse[] = {1, -1, 2, -2, 2, -2, 1, -1};

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

const ld pie = 3.1415926535897932384626 ;
const ll mod = 1e9 + 7 ;

/// Tip : If a and b are positive integers ; we may say - ceil (a/b) = 1 + floor ( (a-1)/b ) .

void solve ( int test_case )
{
    vi v ( 3 ) ;
    for ( int i=0 ; i < 3 ; i ++ )
        cin >> v[i] ;

    sort ( all ( v ) ) ;

    if ( v[0] == v[1] && v[0] != v[2] )
        cout << "Yes" ;

    else if ( v[0] != v[1] && v[1] == v[2] )
        cout << "Yes" ;

    else cout << "No" ;

    line ;
}

int main()
{
    int t = 1;
    // cin >> t;

    for ( int i=1 ; i <= t ; i ++ ) solve ( i ) ;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <tuple>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cassert>
#include <cstdint>
#include <cctype>
#include <numeric>
#include <bitset>
#include <functional>

using namespace std;

using ll =  long long;
using Pll = pair<ll, ll>;
using Pii = pair<int, int>;

constexpr int INF = 1 << 30;
constexpr ll LINF = 1LL << 60;
constexpr ll MOD = 1000000007;
constexpr long double EPS = 1e-10;
constexpr int dyx[4][2] = {
    { 0, 1}, {-1, 0}, {0,-1}, {1, 0}
};

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    int n;
    cin >> n;
    vector<ll> a(n);
    ll ans = 0LL;
    for(int i=0;i<n;++i) {
        cin >> a[i];
        if(i) {
            ans += max(0LL, a[i-1] - a[i]);
            a[i] +=max(0LL, a[i-1] - a[i]);
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 4728
#include<bits/stdc++.h>
using namespace std;
const bool debug =0;

inline void read(long long &x){
    char ch;
    bool flag=false;
    for (ch=getchar();!isdigit(ch);ch=getchar())if (ch=='-') flag=true;
    for (x=0;isdigit(ch);x=x*10+ch-'0',ch=getchar());
    x=flag?-x:x;
}

inline void write(long long x){
    static const long long maxlen=100;
    static char s[maxlen];
    if (x<0) {   putchar('-'); x=-x;}
    if(!x){ putchar('0'); return; }
    long long len=0; for(;x;x/=10) s[len++]=x % 10+'0';
    for(long long i=len-1;i>=0;--i) putchar(s[i]);
}


const long long MAXN = 3e5+100;

struct kt{
long long l,r,b;
long long cost;
}a[ MAXN ];

long long sum[ MAXN ];
long long n,x;

bool cmp_cost( kt A,kt B){
return A.cost > B.cost;
}


bool check(long long lim){
    long long cnt=min( n , lim/x );
    long long now=0;
    for (long long i=1;i<=cnt;i++)
        now += 1ll*(x-a[i].b)*a[i].r;

    for (long long i=cnt+1;i<=n;i++)
        now += (  0 - a[i].b ) *a[i].l;

    long long res=min( x , lim-1ll*cnt*x );
    long long MAX=0;
    for (long long i=cnt+1;i<=n;i++)
        MAX = max( MAX ,  max( 1ll*( res - a[i].b )*a[i].l , 1ll*( res - a[i].b )*a[i].r    ) - ( (0-a[i].b)*a[i].l ) );

    long long delt = 1ll*( x - a[cnt+1].b )*a[cnt+1].r  - ( 0-a[cnt+1].b)*a[cnt+1].l;
    if ( cnt<n )
        for (long long i=1;i<=cnt;i++)
            MAX = max( MAX ,  max( 1ll*( res - a[i].b )*a[i].l , 1ll*( res - a[i].b )*a[i].r    ) +  delt - (  1ll*(x-a[i].b)*a[i].r  )  );

    now += MAX;

    return now>=0;
}

int main(){
    read(n);read(x);
    for (long long i=1;i<=n;i++)
    {
        read(a[i].b);
        read(a[i].l);read(a[i].r);
        a[i].cost = 1ll*( x - a[i].b)*a[i].r - 1ll*( 0 - a[i].b )*a[i].l;
    }

    sort(a+1,a+n+1,cmp_cost);

    //cout<<check(10000)<<endl;
    //return 0;

    long long t=0,w=1e11,ans=0;
    while ( t<=w )
    {
        long long mid=(t+w)/2;
        if ( check(mid) )
        {
            ans=mid;
            w=mid-1;
        }
        else
            t=mid+1;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n,k;
    cin>>n>>k;
    int i;
    int a[n];
    for(i=0;i<n;i++)
    {
        cin>>a[i];
    }
    int c=0;
    while(n>0)
    {
        n-=k;
        c++;
        if(c==1)
        {
            k--;
        }
    }
    cout<<c<<endl;
}


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

int main(){
	int n, m, x;
	cin >> n >> m >> x;
	int t, less=0, more=0;
	for (int i=0; i<m; i++){
		cin >> t;
		if (t<x) less++;
		else more++;
	}
	cout << min(less, more) << "\n";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, from, to) for (int i = from; i < (to); ++i)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define pb push_back
using ll = long long;
using vin=vector<int>;
using vll=vector<ll>;
using vst=vector<string>;
using P = pair<ll,ll>;
const int inf=1e9+7;
const ll INF=9e18;
template <typename T> bool chmin(T &a, const T& b){if(a > b){a = b;return true;}return false;}
template <typename T> bool chmax(T &a, const T& b){if(a < b){a = b;return true;}return false;}
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };

int d,g;
vin p,c;

bool check(int y){
  
 bool ans=false;
  vin order(d);
  rep(i,0,d)order[i]=i;
  do{
    int x=y;
    int rest=g;
    
    rep(i,0,d){
      int now=order[i];
      if(x>=p[now]){
        rest-=p[now]*(now+1)*100;
        rest-=c[now];
        x-=p[now];
      }
      else{
        rest-=x*(now+1)*100;
        x=0;
        break;
      }
    }
    if(rest<=0)ans=1;
    
  }while(next_permutation(all(order)));
  
  return ans;
}


int main(){cout<<fixed<<setprecision(20);
		   //二分探索かな？
           //順列探索かな？
           //O(10^6*log1000)*10
           cin>>d>>g;
           p.resize(d);c.resize(d);
           rep(i,0,d)cin>>p[i]>>c[i];
           int ng=0,ok=1000;
           while(ok-ng>1){
            int mid=(ok+ng)/2;
             if(check(mid))ok=mid;
             else ng=mid;
           }
           cout<<ok<<endl;
}

Measured memory_bytes: 3640
#include <cstdio>
#include <cmath>
#include <iostream>

using namespace std;

static double CalcMinkowskiDistance(const int* x, const int* y, int n, int p) {
  long d = 0;
  for (int i = 0; i < n; ++i) {
    const long e = x[i] - y[i] >= 0 ? x[i] - y[i] : y[i] - x[i];
    long r = 1;
    for (int j = 0; j < p; ++j) {
      r *= e;
    }
    d += r;
  }
  return pow(static_cast<double>(d), 1.0 / static_cast<double>(p));
}

static double CalcManhattanDistance(const int* x, const int* y, int n) {
  long d = 0;
  for (int i = 0; i < n; ++i) {
    const long e = x[i] - y[i] >= 0 ? x[i] - y[i] : y[i] - x[i];
    d += e;
  }
  return static_cast<double>(d);
}

static double CalcEuclideanDistance(const int* x, const int* y, int n) {
  double d = 0.0;
  for (int i = 0; i < n; ++i) {
    d += static_cast<double>(x[i] - y[i]) * static_cast<double>(x[i] - y[i]);
  }
  return sqrt(d);
}

static double CalcChebyshevDistance(const int* x, const int* y, int n) {
  long d = 0;
  for (int i = 0; i < n; ++i) {
    const long e = x[i] - y[i] >= 0 ? x[i] - y[i] : y[i] - x[i];
    d = max(d, e);
  }
  return static_cast<double>(d);
}

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

  int x[100] = {0};
  int y[100] = {0};
  for (int i = 0; i < n; ++i) {
    cin >> x[i];
  }

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

  printf("%f\n", CalcManhattanDistance(x, y, n));
  printf("%f\n", CalcEuclideanDistance(x, y, n));
  printf("%f\n", CalcMinkowskiDistance(x, y, n, 3));
  printf("%f\n", CalcChebyshevDistance(x, y, n));
  return 0;
}

Measured memory_bytes: 1224
# -*- coding: utf-8 -*-
# AtCoder Beginner Contest


if __name__ == '__main__':
    n, k = list(map(int, input().split()))
    a = list(map(int, input().split()))
    ans = (n - 1) // (k - 1)

    if (n - 1) % (k - 1) == 0:
        print(ans)
    else:
        print(ans + 1)


Measured memory_bytes: 13812
#include <iomanip>
#include <iostream>
#define rep(i, n) for (int i = 0; i < (n); i++)
typedef long long ll;
using namespace std;

int main(void) {
  ios::sync_with_stdio(false);
  int A, B;
  cin >> A >> B;

  if ((1 <= A && A <= 9) && (1 <= B && B <= 9))
    cout << A * B << endl;
  else
    cout << -1 << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
int main(){
	int n;
	string s;
	cin >> n;
	cin.ignore();
	while(n--){
		getline(cin,s);
		while(s.find("Hoshino") !=string::npos)
		s.replace(s.find("Hoshino"),7,"Hoshina");
			cout<<s<<endl;
	}
}


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

using namespace std;

int main(int argc, char *argv[]) {
  string s;
  cin >> s;
  if (s[1] == s[2] && (s[0] == s[1] || s[3] == s[2])) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}


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

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

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;

int main()
{
  int N, M;
  cin >> N >> M;

  vector<std::pair<int, int>> cans(N);
  rep(i, N)
  {
    int a, b;
    cin >> a >> b;
    cans[i] = std::make_pair(a, b);
  }

  std::sort(cans.begin(), cans.end());

  long long sum = 0;
  rep(i, cans.size())
  {
    long long yen = cans[i].first;
    long long num = cans[i].second;
    if (M > num)
    {
      sum += num * yen;
      M -= num;
    }
    else
    {
      sum += M * yen;
      break;
    }
  }

  cout << sum << endl;

  return 0;
}


Measured memory_bytes: 1024
#include<iostream>
using namespace std;
#define ll long long

ll max(ll a, ll b)
{
    if(a > b) return a;
    else return b;
}

int main()
{
    ll n, x, abef, aaft, ans = 0;
    cin >> n >> x;
    cin >> abef;
    for(ll i = 1; i < n; i++){
        cin >> aaft;
        if(abef + aaft > x){
            ll k = abef + aaft - x;
            ans += k;
            aaft = max(0, aaft - k);
        }
        abef = aaft;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long LL;
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)

using namespace std;
LL p = 1000000007ll;

int main(void)
{
  LL n,m;
  cin >> n >> m;
  vector<set<LL> > parent(n+1);
  vector<set<LL> > child(n+1);
  REP(i,n+m-1) {
    LL a,b;
    cin >> a >> b;
    parent[b].insert(a);
    child[a].insert(b);
  }
  vector<LL> answer(n+1);
  queue<LL> q;
  FOR(i,1,n+1) {
    if(parent[i].size()==0) {
      q.push(i);
      answer[i]=0;
    }
  }
  while(!q.empty()) {
    LL p = q.front();
    q.pop();
    for(LL c:child[p]) {
      parent[c].erase(p);
      if(parent[c].size()==0) {
        q.push(c);
        answer[c]=p;
      }
    }
  }
  FOR(i,1,n+1) cout << answer[i] << endl;
  return 0;
}


Measured memory_bytes: 21248
#include<bits/stdc++.h>
using namespace std;
int main() {
	int N, M, Q; cin >> N >> M >> Q;
	int TrainMap[510][510] = {};
	for (int i = 0; i < M; i++) {
		int l, r; cin >> l >> r;
		TrainMap[l][r]++;
	}
	for (int i = 0; i < 510; i++) {
		for (int j = 1; j < 510; j++) {
			TrainMap[i][j] = TrainMap[i][j] + TrainMap[i][j - 1];
		}
	}
	for (int i = 0; i < Q; i++) {
        int c,d;cin>>c>>d;
		int ans = 0;
		for (int j = c; j <= d; j++) {
			ans += TrainMap[j][d] - TrainMap[j][c-1];
		}
		cout << ans << endl;
	}
}

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

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define copy(from, to) copy(from.begin(), from.end(), back_inserter(to))
#define sort(a) sort(a.begin(), a.end())
#define p(s) cout << (s) << endl

typedef long long ll;
using namespace std;

template<class T>
void load(vector<T> &v, int n) {
  for (int i = 0; i < n; ++i) {
    T t;
    cin >> t;
    v.push_back(t);
  }
}


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

  int c = 0;
  rep(i, 4) {
    if (n[i] == '2') {
      c++;
    }
  }

  p(c);
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<string>
#include<algorithm>
#include<stdio.h>
#include<locale.h>
#include<math.h>
#include<set>
#include<stack>
#include<queue>
using namespace std;
int main()
{
 string s;
 cin>>s;
 int ans=0,xt=0;
 if(s[0]=='R'){xt++;}
 if(s[1]=='R'){xt++;}
 if(s[1]=='S'){ans=xt; xt=0;}
 if(s[2]=='R'){xt++; ans=max(ans,xt);}
 if(s[2]=='S'){ans=max(ans,xt); xt=0;}
 printf("%d\n",ans);
}



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

int main() {
  int N;
  cin >> N;
  if (N / 100 == N % 10)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 3584
#include<iostream>  
#include <cstdio>  
#include <iostream>  
#include <cstring>  
#include <string>  
#include <cmath>  
#include <queue>  
#include <set>  
#include <map>  
#include <complex>  
#include <algorithm>  
#include <vector>  
using namespace std;
typedef double db;
typedef pair<int,int> pii;
typedef vector<int> vi;
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define rep(i,l,r) for(int i=l;i<r;i++)
#define de(x) cout<<#x<<" = "<<x<<endl;
#define dd(x) cout<<#x<<" = "<<x<<",";
int main()
{
	char s[10];
	cin>>s;
	rep(i,0,strlen(s) - 1){
		if(s[i] == 'A' && s[i + 1] == 'C'){
			printf("Yes\n");
			return 0;
		}
	}
	printf("No\n");
	return 0;
}

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

int main() {
  int n; cin>>n;
  int ans;
  vector<int> a(n), b(n), c(n);
  for(int i=0; i<n; i++) cin>>a[i]>>b[i]>>c[i];
  vector<vector<int>> dp(n,vector<int>(3,0));
  dp[0][0]=a[0];
  dp[0][1]=b[0];
  dp[0][2]=c[0];
  for(int i=1; i<n; i++) {
    dp[i][0] = max(dp[i-1][1]+a[i],dp[i-1][2]+a[i]);
    dp[i][1] = max(dp[i-1][0]+b[i],dp[i-1][2]+b[i]);
    dp[i][2] = max(dp[i-1][0]+c[i],dp[i-1][1]+c[i]);
  }
  ans = max({dp[n-1][0], dp[n-1][1], dp[n-1][2]});
  cout << ans << endl;
}


Measured memory_bytes: 9780
#include <stdio.h>
#include <iostream>
#include <stack>
#include <vector>
#include <utility>
#include <list>
#include <algorithm>
using namespace std;

#define N 1000000

class Hash
{
  private:
    list<string> *a;

    unsigned long long getChar(char ch)
    {
        switch (ch)
        {
        case 'A':
            return 1;
        case 'C':
            return 2;
        case 'G':
            return 3;
        case 'T':
            return 4;
        default:
            return 0;
        }
    }

    unsigned long long getKey(string str)
    {
        unsigned long long x = 0;
        for (unsigned int i = 0; i < str.length(); i++)
        {
            x += getChar(str[i]);
            x *= 5;
        }
        return x % N;
    }

  public:
    Hash()
    {
        a = new list<string>[N];
    }

    void insert(string str)
    {
        a[getKey(str)].push_back(str);
    }

    bool find(string str)
    {
        unsigned long long key = getKey(str);
        list<string>::iterator itr = a[key].begin();
        for (; itr != a[key].end(); itr++)
            if (str == *itr)
                return true;
        return false;
    }
};

int main()
{
    Hash H;
    int n;
    cin >> n;
    string str;
    for (int i = 0; i < n; i++)
    {
        //cout << i << "\n";
        cin >> str;
        if (str[0] == 'i')
        {
            cin >> str;
            H.insert(str);
        }
        else if (str[0] == 'f')
        {
            cin >> str;
            if (H.find(str))
                cout << "yes\n";
            else
                cout << "no\n";
        }
    }
}


Measured memory_bytes: 68204
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
static const int N = 1000;

int lcs(string X, string Y) {
	int c[N + 1][N + 1];
	int m = X.size();
	int n = Y.size();
	int maxl = 0;
	X = ' ' + X;
	Y = ' ' + Y;
	for (int i = 1; i <= m; i++)c[i][0] = 0;
	for (int j = 0; j <= n; j++)c[0][j] = 0;

	for (int i = 1; i <= m; i++) {
		for (int j = 1; j <= n; j++) {
			if (X[i] == Y[j]) {
				c[i][j] = c[i - 1][j - 1] + 1;
			}
			else {
				c[i][j] = max(c[i - 1][j], c[i][j - 1]);
			}
			maxl = max(maxl, c[i][j]);
		}
	}

	return maxl;
}

int main() {
	string s1, s2;
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> s1 >> s2;
		cout << lcs(s1, s2) << endl;
	}

	return 0;
}


Measured memory_bytes: 7136
# -*- coding: utf-8 -*-
"""
@author: H_Hoshigi
"""
def main():
    S = input()
    T = input()

    counter = 0
    for i in range(len(S)):
        if S[i] != T[i]:
            counter += 1
    print(counter)

if __name__ == "__main__":
    main()



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

# define x first    
# define y second
# define mp make_pair
// everything go according to my plan      
# define pb push_back
# define sz(a) (int)(a.size())
# define vec vector         
// shimkenttin kyzdary, dzyn, dzyn, dzyn...
# define y1    Y_U_NO_y1
# define left  Y_U_NO_left
# define right Y_U_NO_right  

using namespace std;

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

const int Mod = (int)1e9 + 7;
const int MX = 1073741822;
const ll MXLL = 4e18;
const int Sz = 1110111;
// a pinch of soul
inline void Read_rap () {
  ios_base :: sync_with_stdio(0);
  cin.tie(0); cout.tie(0);
}
inline void randomizer3000 () {
  unsigned int seed;
  asm ("rdtsc" : "=A"(seed));
  srand (seed);
}
void files (string problem) {   
  if (fopen ((problem + ".in").c_str(),"r")) {
    freopen ((problem + ".in").c_str(),"r",stdin);
    freopen ((problem + ".out").c_str(),"w",stdout);
  }
}
void localInput(const char in[] = "s") { 
  if (fopen (in, "r")) {
    freopen (in, "r", stdin);
  }
  else
    cerr << "Warning: Input file not found" << endl;
}
int f (int x, int y) {    
  if (x > y)
    return 2e9 + 1;
  else
    return abs (x - y);
}
int main()
{
  # ifdef Local
    //localInput();
  # endif
  Read_rap();
  int x, y;
  cin >> x >> y;
  cout << min (min(f(x, y), f(-x, y) + 1), min (f(x, -y) + 1, f(-x, -y) + 2));


  return 0;
}






// Coded by Z..



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

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

    int d;
    cin >> d;
    string res = "Christmas";
    for (int i = 0; i < 25 - d; ++i) {
        res += " Eve";    
    }
    cout << res << '\n';

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<string.h>
#include<cstdlib>
#include<map>
#include<fstream>
#include<string>
#include<sstream>
#include<iomanip>
#include<cmath>
#include<random>
#include<set>
#include<queue>

using namespace std;

long long dp[3][100100] = {};
const long long INF = 1LL << 60;
#define MOD 1000000007
#define Int int64_t
#define PI 3.14159265358979

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

/**
* @fn
* 最大値を取ります.Vector<int>を渡すこと.
*/
long long int imax(vector<int> a) {
	int MAX = -10000000;
	for (int i = 0; i < a.size(); i++) {
		if (MAX < a.at(i)) MAX = a.at(i);
	}
	return MAX;
}

/**
* @fn
* 最小値を取ります.Vector<int>を渡すこと.
*/
long long int imin(vector<int> a) {
	int MIN = 1000000000;
	for (int i = 0; i < a.size(); i++) {
		if (MIN > a.at(i)) MIN = a.at(i);
	}
	return MIN;
}

/**
* @fn
* 自然数について、桁数を求める
*/
Int getDigit(Int num) {
	return (Int)(log10(num)) + 1;
}


int get2Digit(Int num) {
	int cnt = 0;
	while (num > 0) {
		if (num % 2 != 0) {
			return cnt;
		}
		cnt++;
		num /= 2;
	}
}

long long int absmin(vector<int> a, long long int b) {
	int mini = 100000000;
	int d = 0;
	for (int i = 0; i < a.size(); i++) {
		if (mini > abs(a.at(i) - b)) {
			mini = abs(a.at(i) - b);
			d = i;
		}
	}
	return d;
}


long long int absmax(vector<int> a, long long int b) {
	int max = -100000000;
	int d = 0;
	for (int i = 0; i < a.size(); i++) {
		if (max < abs(a.at(i) - b)) {
			max = abs(a.at(i) - b);
			d = i;
		}
	}
	return d;
}

int gcd(int a, int b)
{
	if (a < b) swap(a, b);
	if (b < 1) return -1;
	if (a % b == 0) return b;
	return gcd(b, a % b);
}

void haerobatya(int start, int end, char level) {
	if (start > end) swap(start, end);
	for (int i = start; i <= end; i++) {
		if (i < 100) {
			cout << "https://atcoder.jp/contests/abc0" << i << "/tasks/abc0" << i << "_" << level << endl;
		}
		else {
			cout << "https://atcoder.jp/contests/abc" << i << "/tasks/abc" << i << "_" << level << endl;
		}
	}
}

long long int cntmod(long long int warareru, long long int mod) {
	long long int i = 0;
	for (i = 0; true; i++) {
		if (warareru % mod == 0 && warareru >= mod) {
			warareru /= mod;
		}
		else {
			return i;
		}
	}
}

void ansYes(bool a) {
	if (a == true) cout << "Yes" << endl;
	else cout << "No" << endl;
}

void ansYES(bool a) {
	if (a == true) cout << "YES" << endl;
	else cout << "NO" << endl;
}


Int euclidean_gcd(Int a, Int b) {
	while (true) {
		if (a < b) swap(a, b);
		if (!b) break;
		a %= b;
	}
	return a;
}

typedef pair<int, int> pai;


//ここまでライブラリ
//ここから本文

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


Measured memory_bytes: 256
import java.io.*;
import java.util.*;

public class Main
{
    PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));

    public void go() throws IOException
    {
        StringTokenizer tok = new StringTokenizer(in.readLine());
        int n = Integer.parseInt(tok.nextToken());
        int m = Integer.parseInt(tok.nextToken());
        ArrayList<Job> jobs = new ArrayList<>();
        for (int i = 0; i < n; i++)
        {
            tok = new StringTokenizer(in.readLine());
            jobs.add(new Job(Integer.parseInt(tok.nextToken()), Integer.parseInt(tok.nextToken())));
        }
        Collections.sort(jobs);
        PriorityQueue<Job> pq = new PriorityQueue<>((a, b) -> {
            if (a.reward == b.reward)
            {
                return -Integer.compare(a.time, b.time);
            }
            return Integer.compare(a.reward, b.reward);
        });
        long sum = 0;
        for (Job j : jobs)
        {
            if (m - pq.size() >= j.time)
            {
                pq.add(j);
                sum += j.reward;
            }
            else if (!pq.isEmpty())
            {
                if (j.reward > pq.peek().reward)
                {
                    sum -= pq.remove().reward;
                    pq.add(j);
                    sum += j.reward;
                }
            }
        }
        out.println(sum);

        out.flush();
        in.close();
    }

    public static void main(String[] args) throws IOException
    {
        new Main().go();
    }

    private class Job implements Comparable<Job>
    {
        int time, reward;

        public Job(int tm, int rw)
        {
            this.time = tm;
            this.reward = rw;
        }

        public int compareTo(Job other)
        {
            if (time == other.time)
            {
                return -Integer.compare(reward, other.reward);
            }
            return -Integer.compare(time, other.time);
        }
    }
}


Measured memory_bytes: 44756
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string s,t;
	bool flag=1;
	cin>>s>>t;
	if(s.size()+1==t.size())
	{
		for(int i=0;i<s.size();i++)
		{
			if(s[i]!=t[i])
			{
				flag=0;
				break;
			}
		}
		if(flag==1)
		cout<<"Yes";
		else
		cout<<"No";
	}
	else
	cout<<"No";
}

Measured memory_bytes: 3596
using System;
using System.Collections.Generic;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            // 各種変数の読み込み
            var s = Console.ReadLine().ToCharArray();
            var t = Console.ReadLine().ToCharArray();
            var count = 0;
            for (int i = 0; i < 3; i++)
            {
                if (s[i] == t[i])
                {
                    count++;
                }
            }
            Console.WriteLine(count);


#if DEBUG
            Console.ReadKey();
#endif
        }
    }
}


Measured memory_bytes: 13140
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>
#define INT long long
#define oo 9876543210000000LL
using namespace std;

int h, w;
string m[10];
bool done()
{
    for(int i = 0 ; i < h ; i++ )for(int j = 0 ; j < w ; j++ )
        if( m[i][j] == '#' ) return false;
    return true;
}

bool go(int x, int y)
{
    m[x][y] = '.';
    if( x == h-1 and y == w-1 ) return done();
    bool ret = false;
    if( x+1 < h and m[x+1][y] == '#' ) ret = go(x+1, y);
    if( y+1 < w and m[x][y+1] == '#' ) ret |= go(x, y+1);
    m[x][y] = '#';
    return ret;
}

int main()
{
    cin>>h>>w;
    for(int i = 0 ; i < h ; i++ )
        cin>>m[i], m[i]+=".";
    cout<<(go(0, 0)?"Possible":"Impossible")<<endl;
    return 0;
}


Measured memory_bytes: 256
/*
これを入れて実行
g++ code.cpp
./a.out
 */

#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <cmath>
#include <tuple>
#include <iomanip>

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

int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};

const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;

bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}

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

//-----------------------ここから-----------


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

	if(a + b >= c){
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}
	
}



Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>
#include<complex>

using namespace std;

#define ll long long
#define ld long double
#define EPS 1e-9
#define INF 1e9
#define LINF (ll)INF*INF
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,a,n) for(int i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

#define int ll //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef pair<pii,int> ppi;
typedef pair<int,pii> pip;
typedef vector<pii> vp;
typedef vector<vi> vvi;

int gcd(int a, int b){if(b==0) return a;return gcd(b,a%b);}
int lcm(int a, int b){return a/gcd(a,b)*b;}


signed main(void) {
    int n;
    cin >> n;
    vi a(n,0);
    rep(i,n){
        int t;
        cin >> t;
        t--;
        a[t]++;
    }
    sort(all(a));
    vi sum = a;
    rep(i,n-1)sum[i+1] += sum[i];
    loop(k,1,n+1){
        int ok = 0, ng = n/k+1;
        while(ng - ok > 1){
            int mid = (ok + ng)/2;
            //Σmin(ai, mid) >= mid*k ならmidはok
            //aiは昇順なので、mid以上になるiを探す
            int ind = lower_bound(all(a),mid) - a.begin();
            int tmp = (n - ind)*mid;
            if(ind > 0)tmp += sum[ind-1];
            if(tmp >= mid*k)ok = mid;
            else ng = mid;
        }
        cout << ok << endl;
    }
}


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

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

using namespace std;

void waf(vector<vector<long>> &dist, long n) {
    rep(k, n) rep (i, n) rep (j , n) {
        dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
    }
}

int main(int argc, const char * argv[]) {
    // source code
    long n, m, l;
    cin >> n >> m >> l;
    vector<vector<long>> dist(n);
    rep (i, n) dist[i].assign(n, INT_MAX);
    rep (i, m) {
        long a, b, c;
        cin >> a >> b >> c;
        dist[--a][--b] = c;
        dist[b][a] = c;
    }
    waf(dist, n);
    rep (i, n) rep (j , n) {
        if (dist[i][j] <= l) dist[i][j] = 1;
        else dist[i][j] = INT_MAX;
    }
    waf(dist, n);
    long Q;
    cin >> Q;
    rep (i, Q) {
        long s, q;
        cin >> s >> q;
        if (dist[--s][--q] < INT_MAX) cout << dist[s][q] - 1 << "\n";
        else cout << -1 << "\n";
    }
    return 0;
}


Measured memory_bytes: 1280
n = int(input())
x = list(map(float, input().split()))
y = list(map(float, input().split()))
ans = [0]*4
for i in range(n):
	ans[0] += abs(x[i]-y[i])
	ans[1] += (abs(x[i]-y[i]))**2
	ans[2] += (abs(x[i]-y[i]))**3
	ans[3] = max(ans[3], abs(x[i]-y[i]))

ans[1] = ans[1]**(1/2)
ans[2] = ans[2]**(1/3)

for i in ans:
	print(i)




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

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

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <string>
using namespace std;

int main (){
  long long N,T,A,abs,near=100000000,ans,H[1000];
  cin >> N >> T >> A;
  T *= 1000;A*=1000;
  for(int i = 0;i<N;i++)cin >> H[i];
  for(int i = 0;i<N;i++){
    if (A >= (T - H[i]*6)){
      abs = A - (T - H[i]*6);
    }else{
      abs =(T - H[i]*6) - A;
    }
    if (abs < near){
      ans = i;near =  abs;
    }
  }
  cout << ans+1 <<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
constexpr ll mod = 1e9 + 7;
#define endl '\n'
 
void DFS(int from, vector<vector<int>>& adj, int& len, vector<bool>& visited) {
  ++len;
  for (auto& to : adj[from]) {
    if (visited[to]) continue;
    visited[to] = true;
    DFS(to, adj, len, visited);
  }
}

int main() {
  ios::sync_with_stdio(0); cin.tie(0);
 
  ll N,M;
  cin >> N >> M;
  vector<vector<int>> adj(N);
  for (int i = 0; i < M; ++i) {
    ll a,b;
    cin >> a >> b;
    --a,--b;
    adj[a].push_back(b);
    adj[b].push_back(a);
  }
  vector<bool> visited(N);
  int max_len = 0;
  for (int i = 0; i < N; ++i) {
    if (visited[i]) continue;
    visited[i] = true;
    int len = 0;
    DFS(i, adj, len, visited);
    max_len = max(max_len, len);
  }
  cout << max_len << endl;
     
  

}


Measured memory_bytes: 26656
import Data.List

main = do
	cs <- getLine
	let n = read cs :: Integer
	putStrLn $ showAnswer n

showAnswer :: Integer -> String
showAnswer n = concat $ intersperse ":" $ map (show . ($ n)) [hour, minute, second]

hour :: Integer -> Integer
hour = (`div` 3600)

minute :: Integer -> Integer
minute n = n `mod` 3600 `div` 60

second :: Integer -> Integer
second n = n `mod` 3600 `mod` 60


Measured memory_bytes: 3640
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws IOException {

		BufferedReader br =
				new BufferedReader(new InputStreamReader(System.in));
		String line = "", str = "";
		int sum = 0;
		while ((line = br.readLine()) != null) {
			str += line;
			line = null;
		}
		char[] c = str.toCharArray();
		int num = 0;
		for (int i = 0; i < c.length; i++) {
			if ((c[i] + "").matches("0|1|2|3|4|5|6|7|8|9")) {
				num = num == 0 ? c[i] - '0' : num * 10 + (c[i] - '0');
			} else {
				sum += num;
				num = 0;
			}
		}
		System.out.println(sum);
	}

}

Measured memory_bytes: 24348
#include <iostream>
#include <math.h>
#include <list>
#include <algorithm>
#include <string.h>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

#define endl '\n'
#define int long long
#define mod 1000000007

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

const int INF = 1e9+7;
const int maxVal = 1e5+1;

int32_t main() {
    
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	
	int n,W; cin>>n>>W;

	int w[n], val[n];

	forn(i,n) {
		cin>>w[i]>>val[i];
	}	

	int dp[maxVal];

	for(int i=0;i<maxVal;i++)
		dp[i]=INF;

	dp[0]=0;

	for(int i=0;i<n;i++) {
		for(int j=maxVal-1;j>=val[i];j--) {
			dp[j] = min(dp[j], w[i] + dp[j-val[i]]);
		}
	}

	int fl=0;

	for(int i=maxVal-1;i>0;i--) {
		if(dp[i]<=W) {
			fl=1;
			cout<<i<<endl;
			break;
		}
	}

	if(!fl) cout<<-1<<endl;

	return 0;
}

Measured memory_bytes: 4384