akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define all(x) x.begin(),x.end()
#define pll  pair <long long,long long>
#define ss second
#define ff first
#define inf 9223372036854775807
#define maa 1000000007
#define ld long double
#define fast  ios_base::sync_with_stdio(false);cin.tie(NULL);
#define bug(x) cout << #x <<": " << x << '\n';
const ll N=100001 ;
int main()
{
   fast ;
   ll n ;
   cin>>n ; cout<<(n*n*n) ;

}




Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
using namespace std;
using namespace __gnu_pbds;
typedef tree<
int,
null_type,
less<int>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
string s;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin>>s;
    int lg=0,ans=0;
    for(int i=0;i<s.size();i++)
    {
        if(s[i]=='R')
            lg++;
        if(s[i]=='S'||i==2)
        {
            ans=max(ans,lg);
            lg=0;
        }
    }
    cout<<ans;
    return 0;
}




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

int main() {
	int a,b,c,d;
	cin >> a >> b >> c >> d;
	if (a + b <= c + d) {
		if (a + b == c + d) {
			cout << "Balanced" << endl;
		}
		else{
			cout << "Right" << endl;
		}
	}
	else {
		cout << "Left" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define WHOLE(v) (v).begin(), (v).end()
#define REV_WHOLE(v) (v).rbegin(), (v).rend()
using i64 = int64_t;
using namespace std;
template<class F>auto recursive(F f){return[f](auto...a){return f(f,a...);};}
template<class I,class V=typename I::value_type>V sum_up(const I&l,const I&r){V v;for(I i=l;i!=r;i++)v=i==l?*i:v+*i;return v;}
template<class I,class T=iterator_traits<I>>I operator+(I it,int n){for(int i=0;i<n;i++)it++;return it;}
template<class I,class T=iterator_traits<I>>I operator-(I it,int n){for(int i=0;i<n;i++)it--;return it;}
template<class T>using rev_priority_queue=priority_queue<T,vector<T>,greater<T>>;
template<class T>using vector2d=vector<vector<T>>;
struct fixprec{int p;fixprec(int p):p(p){}};
ostream&operator<<(ostream&o,fixprec f){return o<<fixed<<setprecision(f.p);}
void R_YESNO(bool p){cout<<(p?"YES":"NO")<<endl;}
void R_YesNo(bool p){cout<<(p?"Yes":"No")<<endl;}
int main() {
    int S, W;
    cin >> S >> W;
    if(W >= S) cout << "unsafe" << endl;
    else cout << "safe" << endl;
    return 0;
}



Measured memory_bytes: 3588
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;
#define rep(i,x) for(int i = 0; i < x; i++)
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> ivec;
const ll N = 1e9+7;

// const ll N = 1e9+7;
const ll M = 2*1e5+5;
ll dp[M], invdp[M], inv[M];

ll modinv(ll a, ll m){
    ll b = m, u = 1, v = 0;
    while(b){
        ll t = a/b;
        a -= t * b; swap(a,b);
        u -= t * v; swap(u,v);
    }
    u %= m;
    if(u < 0) u += m;
    return u;

}

void expo(){
    dp[0] = 1;
    invdp[0] = 1;
    inv[0] = 1;
    rep(i,M){
        dp[i+1] = dp[i] * (i + 1) % N;
        inv[i+1] = N - inv[N%(i+1)] * (N/(i+1)) % N;
        invdp[i+1] = modinv(dp[i+1], N);
    }
}


ll conv(ll x, ll y){
    ll ans;
    if(y > 0) ans = dp[x] * (invdp[y] * invdp[x-y] %N) % N;
    else ans = 1;
    // cout << dp[x] << " " << invdp[y] << " " << invdp[x-y] << " " << ans << endl;
    return ans;
}


int main(){
    int n,k; cin >> n >> k;
    int red = n-k;
    int kaijou[red];
    // kaijou[0] = 1;
    // for(int i = 1;i < red;i++){
    //     kaijou[i] = i * kaijou[i-1] % N ;
    // }
    expo();
    int convination[k];
    int amari[k];
    rep(i,k){
        convination[i] = conv(k-1,i);
        amari[i] = red - i;
    }
    // convination[k] = 1;
    // amari
    rep(i,k){
        int ans = 0;
        ans = convination[i] * conv(amari[i]+i+1,i+1) % N;
        cout << ans << endl;
    }

    return 0;

}

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

int main(){
  int n; cin>>n;
  bool x=false;
  for(int i=0;i<=25;i++){
    for(int j=0;j<=14;j++){
      if(4*i+7*j==n){
        x=true;
      }
    }
  }
   if(x){
        cout<<"Yes"<<endl;
     }
   else{
        cout<<"No"<<endl;
      }
  return 0;
}


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

int main() {
    char b;
    cin >> b;
    if(b == 'A')    cout << "T\n";
    if(b == 'T')    cout << "A\n";
    if(b == 'G')    cout << "C\n";
    if(b == 'C')    cout << "G\n";
    return (0);
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {
    private static FastReader fr = new FastReader();
    private static PrintWriter out=new PrintWriter(System.out);

    public static void main(String[] args) throws IOException {
        StringBuilder sb = new StringBuilder();
        // code goes here
        long a = fr.nextLong();
        long b = fr.nextLong();
        long c = fr.nextLong();
        long d = fr.nextLong();

        long a1 = b*d;
        long a2 = a*c;
        long a3 = a*d;
        long a4 = b*c;

        sb.append(Math.max(a1, Math.max(a2, Math.max(a3, a4))));
        System.out.print(sb.toString());
    }

    static class FastReader{
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st=new StringTokenizer("");

        public String next() {
            while (!st.hasMoreTokens())
                try {
                    st=new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            return st.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public int[] nextIntArray(int n) {
            int[] a=new int[n];
            for (int i=0; i<n; i++) a[i]=nextInt();
            return a;
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public long[] nextLongArray(int n) {
            long[] a=new long[n];
            for (int i=0; i<n; i++) a[i]=nextLong();
            return a;
        }
    }

    static class Pair<A, B>{
        A first;
        B second;
        public Pair(A first, B second){
            this.first = first;
            this.second = second;
        }
    }
}


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

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define forn(i , n) for(int i=0;i<n;i++)


int main(){
    int a;
    int b;
    int c;
    
    cin >> a >> b >> c;
    
    string str = (a < b && b < c) ? "Yes" : "No";
    cout << str << endl;
    return 0;
}

Measured memory_bytes: 3184
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>
#define MAX 10000
#define NI -1

typedef struct node{
    int p,l,r;
}Node;

Node T[MAX];
int n;

void preParse(int u){
    if(u==NI){
        return;
      }
    printf(" %d",u);
    preParse(T[u].l);
    preParse(T[u].r);
}

void inParse(int u){
    if(u==NI){
        return;
      }
    inParse(T[u].l);
    printf(" %d",u);
    inParse(T[u].r);
}

void postParse(int u){
    if(u == NI){
        return;
      }
    postParse(T[u].l);
    postParse(T[u].r);
    printf(" %d",u);
}

int main(void){
    int i,v,l,r,rt;
    scanf("%d",&n);

    for(i=0;i<n;i++){  T[i].p=NI;}
    for(i=0;i<n;i++){
        scanf("%d %d %d",&v,&l,&r);
        T[v].l=l;
        T[v].r=r;
        if(l != NI){  T[l].p=v;}
        if(r != NI){T[r].p=v;}
    }

    for(i=0;i<n;i++){
        if(T[i].p == NI){rt=i;}
        }
    puts("Preorder");
    preParse(rt);
    puts("");
    puts("Inorder");
    inParse(rt);
    puts("");
    puts("Postorder");
    postParse(rt);
    puts("");

    return 0;
}





Measured memory_bytes: 2080
while int(input()):
  l=sorted(map(int,input().split()))

  ll=range(len(l))
  m=[0 for _ in ll]
  m[1]=abs(l[0]-l[1])
  for i in ll[2:]:
    m[i]=min(m[i-1],abs(l[i]-l[i-1]))
  print(m[-1])


Measured memory_bytes: 5644
import java.util.Scanner;
import java.util.Arrays;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int [] n = new int[3];
        n[0] = in.nextInt();
        n[1] = in.nextInt();
        n[2] = in.nextInt();

        Arrays.sort(n);

        System.out.println(n[0] + " " + n[1] + " " + n[2]);
    }
}

Measured memory_bytes: 26188
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
#include <queue>
#include <stack>
#include <cmath>
#include <unordered_set>

using namespace std;

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

const ll mod = 1000000007;

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

  int t;
  cin >> t;
  vector<ll> n(t), a(t), b(t), c(t), d(t);
  for (int i = 0; i < t; i++) cin >> n[i] >> a[i] >> b[i] >> c[i] >> d[i];

  vector<ll> ans(t, (ll) 9e18);
  for (int i = 0; i < t; i++) {
    priority_queue<pair<ll, ll>, vector<pair<ll, ll> >, greater<pair<ll, ll> > > que;
    unordered_set<ll> visited;
    que.emplace(0, n[i]);
    while (!que.empty()) {
      auto now = que.top();
      que.pop();
      if (visited.find(now.second) != visited.end()) continue;
      visited.insert(now.second);
      if (now.second == 0) {
        ans[i] = now.first;
        break;
      }
      for (ll j = -5; j <= 5; j++) {
        if (now.second + j < 0) continue;
        if (now.second + j == 0) {
          que.emplace(now.first + d[i] * abs(j), 0);
          continue;
        }
        if ((now.second + j) % 2 == 0) {
          if (abs(now.second - ((now.second + j) / 2)) * d[i] < d[i] * abs(j) + a[i] && now.second < (ll) 2e9) que.emplace(now.first + abs(now.second - ((now.second + j) / 2)) * d[i], (now.second + j) / 2);
          else que.emplace(now.first + d[i] * abs(j) + a[i], (now.second + j) / 2);
        }
        if ((now.second + j) % 3 == 0) {
          if (abs(now.second - ((now.second + j) / 3)) * d[i] < d[i] * abs(j) + b[i] && now.second < (ll) 2e9) que.emplace(now.first + abs(now.second - ((now.second + j) / 3)) * d[i], (now.second + j) / 3);
          else que.emplace(now.first + d[i] * abs(j) + b[i], (now.second + j) / 3);
        }
        if ((now.second + j) % 5 == 0) {
          if (abs(now.second - ((now.second + j) / 5)) * d[i] < d[i] * abs(j) + c[i] && now.second < (ll) 2e9) que.emplace(now.first + abs(now.second - ((now.second + j) / 5)) * d[i], (now.second + j) / 5);
          else que.emplace(now.first + d[i] * abs(j) + c[i], (now.second + j) / 5);
        }
      }
    }
  }

  for (auto &x: ans) cout << x << endl;

  return 0;
}


Measured memory_bytes: 8912
#include <stdio.h>
#include <math.h>

int main(void){
    int a, b;
    scanf("%d%d", &a, &b);
    int n = b + a * pow(10, 1 + (b / 10 != 0) + (b / 100 != 0));
    int m = sqrt(n);
    printf("%s\n", (m*m == n) ? "Yes": "No");
    return 0; 
}


Measured memory_bytes: 256
<?php
while(fscanf(STDIN,"%d %d",$n,$x)){
    if($n===0 and $x===0)break;
    $cnt=0;
    for($i=1;$i<=$n;$i++){
        for($j=$i+1;$j<=$n;$j++){
            $c=$x-$i-$j;
            if($c>$j and $c<=$n){
                $cnt++;
            }
        }
    }
    echo $cnt,PHP_EOL;
}

Measured memory_bytes: 15324
#include<bits/stdc++.h>
using namespace std;
long long dp(int i,int sum,int cnt);
int n,a;
int x[59];
long long memo[51][2501][51];

int main(){
  memset(memo,-1,sizeof(memo));
  cin>>n>>a;
  for(int i=0;i<n;i++)cin>>x[i];
  cout<<dp(0,0,0)<<endl;
  return(0);
}

long long dp(int i,int sum,int cnt){
  long long rec=0;
  if(memo[i][sum][cnt]!=-1)return memo[i][sum][cnt];
  if(i==n){
    if(cnt!=0&&sum==a*cnt)return 1;
    else return 0;
  }
  rec+=dp(i+1,sum,cnt);
  rec+=dp(i+1,sum+x[i],cnt+1);
  return memo[i][sum][cnt]=rec;
}


Measured memory_bytes: 51072
import sys
sys.setrecursionlimit(10 ** 5)

N = int(input())
right_A = 0
left_B = 0
B_to_A = 0
AB_count = 0

for _ in range(N):
    target = input()
    AB_count += target.count('AB')
    if target[0] == 'B' and target[-1] == 'A':
        B_to_A += 1
    elif target[0] == 'B':
        left_B += 1
    elif target[-1] == 'A':
        right_A += 1

def recursive(x, y, z):
    if z == 0:
        return min(x, y)
    elif x == y == 0:
        return z - 1
    else:
        return recursive(x, y, z-1) + 1

print(recursive(right_A, left_B, B_to_A) + AB_count)


Measured memory_bytes: 47784
#include <stdio.h>
 
using namespace std;
 
int main(){
    int a,b;
    double a_d,b_d;
    scanf("%d %d",&a,&b);
    a_d = static_cast<double>(a);
    b_d = static_cast<double>(b);
    printf("%d %d %.5f\n",a/b,a%b,a_d/b_d);
}


Measured memory_bytes: 2724
using LIB;
using System;
using System.Linq;
using System.Text;
using System.Collections.Generic;

class Program
{
    static void Main(string[] args)
    {
        Dictionary<char, int> memo = new Dictionary<char, int>();
        for (char c = 'a'; c  <= 'z'; c++) { memo[c] = 0; } 
        string s = "";
        int n = 0;
        while(true) {
            n = Console.Read();
            if (n < 0) { break; }
            s += Convert.ToChar(n);
        }
        s = s.ToLower();
        foreach (char c in s)
        {
            if (c >= 'a' && c <= 'z') { memo[c]++; }
        }
        foreach (char c in memo.Keys)
        {
            io.w(c + " : " + memo[c]);
        }
        io.wflush();
    }
}

namespace LIB
{
    public class io
    {
        private const int WMAX = 1000;
        private static StringBuilder S = new StringBuilder();
        public static T r<T>() { return util.parse<T>(r()); }
        public static T[] r<T>(char s = ' ') { return r().Split(s).Select(util.parse<T>).ToArray(); }
        public static T[] r<T>(int l) { T[] r = new T[l]; for (int i = 0; i < l; i++) { r[i] = r<T>(); } return r; }
        public static T[][] r<T>(int l, char s = ' ') { T[][] r = new T[l][]; for (int i = 0; i < l; i++) { r[i] = r<T>(s); } return r; }
        private static string r() { return Console.ReadLine(); }
        public static void w(object v, bool lf = true) { S.Append(util.parse<string>(v)); if (lf == true) { S.Append('\n'); } if (S.Length >= WMAX) { wflush(); } }
        public static void wflush() { Console.Write(S.ToString()); S.Length = 0; }
    }
    public class util
    {
        public static T parse<T>(object value) { return (T)(Convert.ChangeType(value, typeof(T))); }
    }
    public class memo<Key, Result>
    {
        private Dictionary<Key, Result> R;
        public memo() { R = new Dictionary<Key, Result>(); }
        public Result exec(Key k, Func<Key, Result> f) { Result r; if (R.ContainsKey(k)) { r = R[k]; } else { r = f(k); R.Add(k, r); } return r; }
    }
}

Measured memory_bytes: 9956
# -*- coding: utf-8 -*-

[N, M] = [int(i) for i in input().split()]

answer = []
for i in range(M):
    [p, S] = [i for i in input().split()]
    answer.append((int(p), S))

matome = []
for i in range(N):
    matome.append([0, 0])

for (p, S) in answer:
    if S == 'AC':
        matome[p-1][0] = 1
    elif S == 'WA':
        if matome[p-1][0] == 0:
            matome[p-1][1] += 1

# 正答数とペナルティ
correct = 0
penalty = 0
for [ac, wa] in matome:
    if ac == 1:
        correct += 1
        penalty += wa

print('{} {}'.format(correct, penalty))

Measured memory_bytes: 29100
import java.io.*;
import java.util.*;
import java.lang.Math.*;

class Main{

    static int[][] dp = new int[3001][3001];

    public static void main(String[] args){

        Scanner sc = new Scanner(System.in);
    
        String s = new String();
        String t = new String();

        s = sc.next();
        t = sc.next();

        int sLen = s.length();
        int tLen = t.length();

    
        for(int i = 0; i < 3001; i++){
            dp[0][i] = 0;
            dp[i][0] = 0;
        }

        for(int i = 1; i <= sLen; i++){
            for(int j = 1; j <= tLen; j++){
                if(s.charAt(i-1) == t.charAt(j-1)){
                    dp[i][j] = dp[i-1][j-1] + 1;
                }
                else{
                    dp[i][j] = Math.max( dp[i-1][j], dp[i][j-1] );
                }
            }
        }
        
        //stvaranje stringa
        String mRes = new String("");
        
        int i = sLen;
        int j = tLen;
        
        while(i!=0 && j!=0){
            //if( dp[i][j] == 0 ) break;
            if(s.charAt(i-1) == t.charAt(j-1)){
                mRes = s.charAt(i-1) + mRes;
                i--;
                j--;
            }
            else if(dp[i][j] == dp[i-1][j]){
                i--;
            }
            else if(dp[i][j] == dp[i][j-1]) j--;
        
        }
        System.out.println(mRes);        

        sc.close();
    }
}
















Measured memory_bytes: 94036
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <limits>

using namespace std;
typedef long long int ll;
void sayYes() { cout << "Yes" << endl; };
void sayNo() { cout << "No" << endl; };
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }                   // 最大公約数
ll lcm(ll a, ll b) { return a * b / gcd(a, b); };                      // 最小公倍数
ll getDigit(ll num) { return log10(num) + 1; }                         // 桁数
ll digitSum(ll n) { return (n < 10) ? n : digitSum(n / 10) + n % 10; } // 各桁の和
#define rep(i, n) for (ll i = 0; i < n; i++)

void Main()
{
    // int n;
    // cin >> n;
    // vector<int> a(n);
    // rep(i, n)
    // {
    //     cin >> a[i];
    // }
    int n;
    cin >> n;
    cout << n * 2 * M_PI;
    return;
}

signed main(void)
{
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 3864
#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 ld           long double
#define vi           vector<int>
#define pii          pair<int,int>
#define pb           push_back
#define mp           make_pair
#define ff           first
#define ss           second
#define endl         '\n'
#define rep(i,s,e)   for(int i=(s);i<=(e);i++)
#define brep(i,s,e)  for(int i=(s);i>=(e);i--)
#define all(x)       (x).begin(),(x).end()
#define ball(x)      (x).rbegin(),(x).rend()
#define sz(x)        (int)x.size()
#define mem(x,y)     memset(x,(char)y,sizeof(x))
#define milf(x)      x.reserve(1LL<<14LL); x.max_load_factor(0.25); // less_equal
#define pbds         tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
mt19937              rng(chrono::steady_clock::now().time_since_epoch().count());
#define int          long long
const int INF = 0x3F3F3F3F3F3F3F3F;
const int MOD = 1e9+7;
ld EPS = 1e-12;


short rain()
{
    // int t;cin>>t;rep(test,1,t)
    {
        int a;
        cin >> a;
        cout << (a+a*a+a*a*a) << endl;
    }

    return 0;
}

signed main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    // freopen("ip.txt","r",stdin);
    // freopen("op.txt","w",stdout);
    int tt = 1000*clock()/CLOCKS_PER_SEC;
    cout<<fixed<<setprecision(15);rain();
    cerr<<1000*clock()/CLOCKS_PER_SEC-tt<<"ms\n";
}

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

using namespace std;

inline int get_int() {
    int res, c, t = 1;
    while(!isdigit(c = getchar())) if(c == '-') t = -1;
    for(res = c - '0'; isdigit(c = getchar()); )
        res = res * 10 + c - '0';
    return res * t;
}

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

typedef long long LL;
typedef pair<int, int> pii;
typedef long double ld;
typedef unsigned int uint;

const int INF = 0x3f3f3f3f;
const double EPS = 1e-7;
const double PI = acos(-1);

const int MAXN = 100;

int n, m, BU[3];
vector<int> G[MAXN + 10];

bool dp1[105][MAXN + 2][MAXN + 2];

void getDp1() {
    for(int i = 1; i <= n; i++) dp1[0][i][i] = 1;

    for(int len = 0; len <= 101; len++) {
        for(int u = 1; u <= n; u++) {
            for(int v = 1; v <= n; v++) {
                if(dp1[len][u][v]) {
                    rep(i, G[v].size()) {
                        int w = G[v][i];
                        dp1[len + 1][u][w] = 1;
                    }
                }
            }
        }
    }

}
int getDp3() {
    static int dp[MAXN + 10];
    static int da[MAXN + 10], db[MAXN + 10], dc[MAXN + 10];
    memset(dp, -1, sizeof(dp));
    dp[n] = 0;

    queue<int> q;
    q.push(n);

    while(!q.empty()) {
        int u = q.front();
        q.pop();
        for(int v = 1; v <= n; v++) if(dp[v] == -1) {
            if(!da[v] && dp1[BU[0]][v][u]) da[v] = dp[u] + 1;
            if(!db[v] && dp1[BU[1]][v][u]) db[v] = dp[u] + 1;
            if(!dc[v] && dp1[BU[2]][v][u]) dc[v] = dp[u] + 1;
            if(da[v] && db[v] && dc[v])
                dp[v] = max(da[v], max(db[v], dc[v])), q.push(v);
        }
    }


    /*for(int T = 1; T <= n*2; T++) {
        for(int u = 1; u <= n; u++) if(dp[u] == -1) {
            int Max = 0;
            for(int it = 0; it < 3; it++) {
                int step = BU[it];
                int Min = INF;
                for(int v = 1; v <= n; v++) if(dp1[step][u][v] && dp[v] != -1)
                    Min = dp[v]+1;
                Max = max(Max, Min);
            }
            if(Max != INF)
                dp[u] = Max;
        }
    }
*/
    return dp[1];
}

int main() {

    scanf("%d%d%d%d%d", &n, &m, &BU[0], &BU[1], &BU[2]);
    rep(i, m) {
        int u, v;
        cin >> u >> v;
        G[u].push_back(v);
    }

    getDp1();
    int ans = getDp3();
    if(ans == -1) puts("IMPOSSIBLE");
    else cout << ans << endl;

    return 0;
}

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

int main() {
  int N, M, X, Y;
  cin >> N >> M >> X >> Y;
  vector<int> Xes(N);
  vector<int> Yes(M);
  for(int i = 0; i < N; i++){
    cin >> Xes.at(i);
  }
  for(int i = 0; i < M; i++){
    cin >> Yes.at(i);
  }
  //最大値を.at(0)に
  sort(Xes.begin(), Xes.end());
  reverse(Xes.begin(), Xes.end());
  sort(Yes.begin(), Yes.end());
  // Yes.at(0)が最小
  
  if(X < Y && Xes.at(0) < Y && Yes.at(0) > X && Xes.at(0) < Yes.at(0)){
    cout << "No War" << endl;
  }
  else {
    cout << "War" << endl;
  }
  
  //cout << Xes.at(0) << Yes.at(0) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define in(x) freopen(x, "r", stdin)
#define out(x) freopen(x, "w", stdout)
using namespace std;

const long long base = (int)(1e9 + 7);

int n, ans;
int fact[(int)(1e6 + 100)], obr[(int)(1e6 + 100)];

long long mul(long long x, long long y) {
    return (x * 1ll * y) % base;
}

long long add(long long x, long long y) {
    x += y;
    if (x >= base)
        x -= base;
    return x;
}

long long sub(long long x, long long y) {
    x -= y;
    if (x < 0)
        x += base;
    return x;
}

long long bin_pow(long long x, long long st) {
    long long res = 1;
    while (st) {
        if (st & 1)
            res = mul(res, x);
        x = mul(x, x);
        st >>= 1;
    }

    return res;
}

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
                
    #ifndef _LOCAL          
    #endif // _LOCAL

    cin >> n;
    
    if (n < 2) {
        cout << "0\n";
        return 0;
    }

    fact[0] = obr[0] = 1;
    for (int i = 1; i <= n; ++i)
        fact[i] = mul(fact[i - 1], i), obr[i] = bin_pow(fact[i], base - 2);

    long long st = 4;
    for (int i = 2; i <= n; ++i) {
        long long cur = sub(st, 2);
        cur = mul(cur, mul(fact[n], mul(obr[i], obr[n - i])));
        cur = mul(cur, bin_pow(8, n - i));
        ans = add(ans, cur);
        st = mul(st, 2);
    }
    cout << ans << "\n";

    return 0;
}

Measured memory_bytes: 11448
#include<iostream>
#include <fstream>
#include <vector>

#define LOCAL  1
#define UPLOAD 2

using namespace std;

int main()
{
#if ENVIRONMENT == LOCAL
    std::ifstream in("input.txt");
    std::cin.rdbuf(in.rdbuf());
#endif

    int N;
    vector<int> V(N);
    vector<int> C(N);

    cin >> N;

    for(int i=0;i<N;i++){
        cin >> V[i];
    }
    for(int i=0;i<N;i++){
        cin >> C[i];
    }

    int ret = 0;
    for(int i=0;i<N;i++){
        if(V[i] > C[i]){
            ret += V[i] - C[i];
        }
    }

    cout << ret << endl;

    return 0;
}


Measured memory_bytes: 512
#include <stdio.h>
int main(void) {
  int n;
  int a[100];
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    if (a[i] % 2 == 0) {
      if (a[i] % 3 != 0) {
        if (a[i] % 5 != 0) {
          puts("DENIED");
          return 0;
        }
      }
    }
  }
  puts("APPROVED");
  return 0;
}


Measured memory_bytes: 128
#include<cstdio>

#define MOD 1000000007
typedef long long int lli;

lli dp[200][20];
lli dp0buf[100];

int main(void) {
    lli *dp0 = dp0buf+50;

    dp0[0] = 1;
    dp0[1] = 1;
    dp0[2] = 2;
    for(int i=1; i<15; i++) {
        dp0[i+2] = dp0[i] + dp0[i+1];
    }

    int h,w,k;
    scanf("%d%d%d",&h,&w,&k);
    k--;

    dp[0][0] = 1;
    for(int i=0; i<h; i++) {
        for(int j=0; j<w; j++) {
            dp[i+1][j] += dp[i][j] * dp0[j] * dp0[w-j-1];
            if(j>0) {
                dp[i+1][j] += dp[i][j-1] * dp0[j-1] * dp0[w-j-1];
                dp[i+1][j] %= MOD;
            }
            if(j<w-1) {
                dp[i+1][j] += dp[i][j+1] * dp0[j] * dp0[w-j-2];
                dp[i+1][j] %= MOD;
            }
        }
    }

    printf("%lld\n", dp[h][k]);

}


Measured memory_bytes: 128
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    long[] a = new long[n];
    int p = 0;
    int ki = 0;
    long s = 0;
    long mi = Long.MAX_VALUE;
    for(int i = 0; i < n; i++) {
      a[i] = sc.nextLong();
      if(a[i] == 0) p++;
      if(a[i] < 0) ki++;
      s += Math.abs(a[i]);
      mi = Math.min(mi, Math.abs(a[i]));
    }
    long ans = 0;
    if(p > 0) {
      ans = s;
    } else {
      if((ki % 2) == 0) {
        ans = s;
      } else {
        ans = s - 2 * mi;
      }
    }
    System.out.println(ans);
  }
}

Measured memory_bytes: 52452
///Bismillahir Rahmanir Rahim
#include<bits/stdc++.h>

#define                           int                         long long
#define                           fi                          first
#define                           si                          second
#define                           mp                          make_pair
#define                           pb                          push_back
#define                           pi                          pair<int,int>
#define                           clr(x)                      memset(x,0,sizeof(x));
#define                           f(i,l,r)                    for(int i=l;i<=r;i++)
#define                           rf(i,r,l)                   for(int i=r;i>=l;i--)
#define                           done(i)                     cout<<"done = "<<i<<endl;
#define                           fast                        ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);




using namespace std;

const int inf=1e18;
const int mod=1e9+7;
const int M=100009;

inline int bigmod(int B,int P){int R=1;while(P>0){if(P&1){R=(R*B)%mod;}P>>=1;B=(B*B)%mod;}return R;}
inline int ad(int x,int y){int ret=(x%mod+y%mod)%mod;if(ret<0){ret+=mod,ret=ret%mod;}return ret;}
inline int sub(int x,int y){int ret=((x%mod)-(y%mod)+mod)%mod;if(ret<0){ret+=mod,ret=ret%mod;}return ret;}
inline int gun(int x,int y){int ret=((x%mod)*(y%mod))%mod;if(ret<0){ret+=mod,ret=ret%mod;}return ret;}


 main()

{
    fast
    int n;
    cin>>n;
    int a[2*n+4];
    f(i,1,2*n)
    {
        cin>>a[i];
    }
    sort(a+1,a+2*n+1);
    int ses=0;
    for(int i=1;i<=2*n;i=i+2)
    {
         ses+=a[i];
    }
    cout<<ses<<endl;
    return 0;

}





































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

using namespace std;

typedef long long int ll;

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

  int n;
  cin >> n;
  vector < int > pos (n + 1);
  for (int i = 1; i <= n; i++) {
    int a; cin >> a;
    pos[a] = i;
  }

  ll ans = 0;
  multiset < int > s;
  s.insert (0); s.insert (0); s.insert (n + 1); s.insert (n + 1);
  for (int i = n; i >= 1; i--) {
    auto it = s.upper_bound (pos[i]);
    int y = *it, q = *(++it);
    --it;
    int x = *(--it), p = *(--it);
    s.insert (pos[i]);

    ans += (ll)(x - p) * (y - pos[i]) * i;
    ans += (ll)(pos[i] - x) * (q - y) * i;
  }

  cout << ans << '\n';
}


Measured memory_bytes: 8248
#include<bits/stdc++.h>
using namespace std;
typedef long long       ll;
#define MOD ((int)1e9+7)
#define N ((int)2e5+123)
void reads(string& x){ char kk[N]; scanf("%s",kk); x = kk;}

int ans, n, m, v[N],sum,q;

void solve(){
    scanf("%d%d", &n,&m);
    for(int i=0;i<n;i++){
        scanf("%d",v+i);
        sum+=v[i];
    }
    sum = (sum+4*m-1)/(4*m);
    for(int i=0;i<n;i++){
        q+=(v[i]>=sum);
    }
    if(q>=m)printf("Yes\n");
    else printf("No\n");
}

int main(){
    ios_base::sync_with_stdio(0);
    int t = 1; //scanf("%d",&t);
    for(int caso=1;caso<=t;caso++){
        solve();
    }
}

Measured memory_bytes: 3784
#define _USE_MATH_DEFINES

#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <utility>
#include <climits>
#include <vector>
#include <map>
#include <queue>
using namespace std;

#define ll long long
const int MOD = 1000000007;//10^9+7
const string SPACE = " ";

ll powsur(ll a, ll b, ll p) {

	if (b == 0) {

		return 1;

	}
	else if (b % 2 == 0) {

		ll d = powsur(a, b / 2, p);
		return ((d%p)*(d%p)) % p;

	}
	else {

		return ((a%p)*powsur(a, b - 1, p) % p) % p;

	}

}
//pは素数,aのb乗をpで割った余り

ll CMOD(ll n, ll r, ll p) {

	ll a = 1, b = 1, c = 1, re;
	for (int i = 1; i <= n; i++) {

		a *= i;
		a = a%p;

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

		b *= i;
		b = b%p;

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

		c *= i;
		c = c%p;

	}
	b = powsur(b, p - 2, p);
	c = powsur(c, p - 2, p);
	re = ((a%p)*(b%p)) % p;
	re = ((re%p)*c%p) % p;

	return re;

}
//pは素数,(nCr)%p

ll gcd(ll a, ll b) {

	if (a > b) {

		ll tmp = a;
		a = b;
		b = tmp;

	}
	ll r;
	r = b%a;
	if (r == 0)return a;
	else return gcd(r, a);

}
//最大公約数

ll lcm(ll a, ll b) {

	return (a / gcd(a, b))*b;

}
//最小公倍数

int main() {

	ll N;
	ll cnt[5];//MARCH/all
	string S[100005];
	ll ans = 0;

	for (int i = 0; i < 5; i++)cnt[i] = 0;

	cin >> N;
	for (int i = 0; i < N; i++) {

		cin >> S[i];
		switch (S[i][0]) {
		case 'M':
			cnt[0]++;
			break;
		case 'A':
			cnt[1]++;
			break;
		case 'R':
			cnt[2]++;
			break;
		case 'H':
			cnt[3]++;
			break;
		case 'C':
			cnt[4]++;
			break;
		}

	}

	for (int i = 0; i < 3; i++) {
		for (int j = i + 1; j < 4; j++) {
			for (int k = j + 1; k < 5; k++) {

				ans += cnt[i] * cnt[j] * cnt[k];

			}
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 6144
#define lp(i,n) for(int i=0;i<n;i++)
#define pau system("pause")
#include<bits/stdc++.h>

using namespace std;
int main(){
    int h,a,i;
    cin>>h>>a;
    for(i=0;h>0;i++){
        h-=a;
    }
    cout<<i<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define Hello ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define endl '\n'
#define ll long long

int main()
{
    Hello
    string s;
    cin >> s;
    for(int i = 0; i < s.size(); i++){
        if((i % 2 == 0 && (s[i] == 'R' || s[i] == 'U' || s[i] == 'D' )) ||
            (i % 2 == 1 && (s[i] == 'L' || s[i] == 'U' || s[i] == 'D' )))
            continue;
        else
            return cout << "No", 0;
    }
    cout << "Yes";
    return 0;
}


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

public class Main {

	public static void main(String[] args) throws IOException {
		// TODO ?????????????????????????????????????????????
		InputStreamReader isr = new InputStreamReader(System.in);
        BufferedReader br = new BufferedReader(isr);

        //???????????\???
        String[] input = br.readLine().split(" ");
        int n = Integer.parseInt(input[0]);

        //2???????????\???
        String[] input2 = br.readLine().split(" ");

        //??????
        for(int a = n - 1; 0 < a + 1; a--){

        	if(0 == a){
        		System.out.println(input2[a]);
        	}else{
            	System.out.print(input2[a] + " ");
        	}
        }
	}
}

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

using ll=long long;
int main(){
    int N,K;
    cin>>N>>K;
    vector<ll> a(N),b(N),c(N);
    if(2*K>N+1){
        cout<<-1<<endl;
        return 0;
    }
    if(N%2==1){
        int M=(N+1)/2;
        for(int k=0;k<M;k++){
            a[k]=2*M-1-k;
            b[k]=3*M-1+2*k;
            c[k]=5*M-2+k;
        }
        for(int k=0;k<M-1;k++){
            a[k+M]=3*M-2-k;
            b[k+M]=3*M+2*k;
            c[k+M]=6*M-2+k;
        }
        for(int i=0;i<N;i++){
            a[i]+=K-M;
            b[i]+=K-M;
            c[i]+=K-M;
        }
    }
    else{
        int M=N/2;
        for(int k=0;k<M;k++){
            a[k]=2*M-1-k;
            b[k]=3*M+2*k;
            c[k]=5*M+k;
        }
        for(int k=0;k<M;k++){
            a[k+M]=3*M-1-k;
            b[k+M]=3*M+1+2*k;
            c[k+M]=6*M+k;
        }
        for(int i=0;i<N;i++){
            a[i]+=K-M;
            b[i]+=K-M;
            c[i]+=K-M;
        }
    }

    for(int i=0;i<N;i++){
        cout<<a[i]<<" "<<b[i]<<" "<<c[i]<<endl;
    }
    return 0;
}


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

template<typename T>
ostream& operator<<(ostream &os, vector<T> &v){
	string sep = " ";
	if(v.size()) os << v[0];
	for(int i=1; i<v.size(); i++) os << sep << v[i];
	return os;
}

template<typename T>
istream& operator>>(istream &is, vector<T> &v){
	for(int i=0; i<v.size(); i++) is >> v[i];
	return is;
}

#ifdef DBG
void debug_(){ cout << endl; }
template<typename T, typename... Args>
void debug_(T&& x, Args&&... xs){
	cout << x << " "; debug_(forward<Args>(xs)...);
}
#define dbg(...) debug_(__VA_ARGS__)
#else
#define dbg(...)
#endif

int main() {
	ios_base::sync_with_stdio(false);
	cout << setprecision(20) << fixed;

	int n; cin >> n;
	ll k; cin >> k;
	vector<ll> a(n); cin >> a;

	ll s = 0;
	for(int i=0; i<n; i++) s += a[i]-1;
	if(s<=k){
		cout << 1 << endl;
		return 0;
	}

	ll lb = 1, ub = 1e18;
	while(ub - lb > 1){
		ll x = (lb+ub)/2;

		ll s = 0;
		for(int i=0; i<n; i++){
			s += (a[i]+x-1)/x-1;
		}
		if(s<=k){
			ub = x;
		} else {
			lb = x;
		}
	}

	cout << ub << endl;

	return 0;
}


Measured memory_bytes: 4756
#include<bits/stdc++.h>
using namespace std;
int dp[100010];
int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int N, K;
    cin >> N >> K;
    vector<int> H(N);
    for (int & h : H) cin >> h;
    for (int i = 1; i < N; ++i) {
        dp[i] = dp[i - 1] + abs(H[i - 1] - H[i]);
        for (int j = 2; j <= i && j <= K; ++j) {
            dp[i] = min(dp[i], dp[i - j] + abs(H[i - j] - H[i]));
        }
    }
    printf("%d\n", dp[N-1]);
    return 0;
}

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

#define ll     long long
#define fr     first
#define sec    second
#define rep(i,n)  for(i=0;i<n;i++)
#define vi     vector <int>
#define vc     vector <char>
#define vl     vector <ll>
#define vb     vector <bool>
#define pb     push_back
#define M      1000000007
#define ios    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define open   freopen("input.txt","r",stdin);
#define close  freopen("output.txt","w",stdout);
#define M_PI   3.14159265358979323846
#define pp     pair<int,int>
#define nn 100003

int main()
{
    ios;
    ll n,k,i,ans=0;
    cin>>n>>k;
    ll a[n];
    rep(i,n)
        cin>>a[i];
    sort(a,a+n);
    rep(i,k)
        ans+=a[i];
    cout<<ans;
    return 0;
}


Measured memory_bytes: 3632
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<string>
#include<tuple>
#include<utility>
#include<stack>
#include<queue>
#include<deque>
#include<set>
#include<iomanip>
#include<map>
using namespace std;
typedef long long int ll;          
typedef pair<int, int> P;
const int INF = 1e9 + 7;
int dx[8] = { 1,0,-1,0,1,1,-1,-1 };
int dy[8] = { 0,1,0,-1,1,-1,1,-1 };



int main() {

	int n, a, b ;
	cin >> n >> a >> b  ;

	cout << min(a * n, b) << endl;

	return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define gs(v) sort(v.begin(),v.end(),greater<int>())
main(){int n,h,s=0,i=0;cin>>n>>h;
 vector<int>a(n),b(n);for(;i<n;++i)cin>>a[i]>>b[i];
 gs(a),gs(b);for(i=0;i<n&&b[i]>a[0]&&s<h;++i)s+=b[i];
 cout<<i+(s<h)*(h-s+a[0]-1)/a[0];}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second

#define pb push_back
#define es erase
#define in insert

#define pii pair<int, int>
#define ll long long
#define lb long double

#define ioss                     \
    ios::sync_with_stdio(false); \
    cin.tie(0);                  \
    cout.tie(0);

#define m_p(i, j) make_pair(i, j)
#define mem(a, x) memset(a, x, sizeof(a))
#define endl "\n"
#define all(x) x.begin(), x.end()

int main()
{
    int a, b, c;
    cin >> a >> b >> c;
    if (a > b * c)
        cout << "No" << endl;
    else
        cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 3572
/******************************************
* AUTHOR : ARPIT *
* NICK : arpitfalcon *
* INSTITUTION : BIT MESRA *
* Ab m game m hu. *
******************************************/

#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007 -
#define vll vector<ll>
#define vvll vector<vll>
#define pll pair<ll, ll>
#define vpll vector<pll>
#define vin                    \
    ll n;                      \
    cin >> n;                  \
    vector<ll> x(n);           \
    for (ll i = 0; i < n; i++) \
    cin >> x[i]
#define vout                   \
    for (ll i = 0; i < n; i++) \
    cout << x[i] << " "
#define T     \
    ll t = 1; \
    cin >> t; \
    while (t--)
#define ain                    \
    ll n, k;                   \
    cin >> n >> k;             \
    ll a[n];                   \
    for (ll z = 0; z < n; z++) \
    cin >> a[z]
#define aout                   \
    for (ll i = 0; i < n; i++) \
    cout << a[i] << " "
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define endl "\n"
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define max3(a, b, c) max(a, max(b, c))
#define min3(a, b, c) min(a, min(b, c))
#define max4(a, b, c, d) max(a, max3(b, c, d))
#define min4(a, b, c, d) min(a, min3(b, c, d))
#define blink                \
    ios::sync_with_stdio(0); \
    cin.tie(0);              \
    cout.tie(0);
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
const double PI = 3.141592653589793238463;

#define forn(i, n) for (ll(i) = 0; (i) < (n); ++(i))
#define for1(i, n) for (ll(i) = 1; (i) <= (n); ++(i))
#define forr(i, n) for (ll(i) = (n)-1; (i) >= 0; --(i))
#define forab(i, a, b, c) for (ll(i) = a; (i) <= (b); (i) += (c))

/*
__builtin_ffs(x)
  Number of set bits: __builtin_popcount(x)
  Number of leading zeroes: __builtin_clz(x)
  Number of trailing zeroes : __builtin_ctz(x)
*/

int main()
{
    blink
#ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

    // your code goes here
    int ans = 0;
    string s;
    cin >> s;

    for (int i = 0; i < s.size(); i++)
    {
        if (s[i] == '+')
            ans++;
        else
            ans--;
    }

    cout << ans;
    return 0;
}

Measured memory_bytes: 3584
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=4e5+5;
int main()
{
	char s[10];
	scanf("%s",s);
	if(s[0]=='7'||s[1]=='7'||s[2]=='7')puts("Yes");
	else puts("No");
}

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

int max(int a,int b){
  if(a > b) return a;
  else return b;
}
int min(int a, int b){
  if(a < b) return a;
  else return b;
}

#define PI 3.14159265358979323846264338327950

int main(){

  int a,b,h,m;
  scanf("%d%d%d%d",&a, &b, &h, &m);

  double angle = ( ((double)h + (double)m/60.0) * 30.0 - (double)m * 6.0 );

  double rad = (angle /180.0)* PI;

  /*double rad = (( ((double)h + (double)m/60.0) * 30.0 - (double)m * 6.0 ) / 180.0) * M_PI;*/

  //printf("%.10f ",h);
  double ans = sqrt((double)a*a + (double)b*b -(double)2*a*b*cos(rad));
  printf("%.11f",ans);

  return 0;
}


Measured memory_bytes: 2648
d,g = map(int,input().split())
li = []

for i in range(d):
    p,c = map(int,input().split())
    li.append([p,c])

ans = 10**9
for i in range(1<<d):
    ttl = 0
    cnt = 0
    memo = [0 for i in range(d)]
    for j in range(d):
        if (i>>j)&1:
            ttl += li[j][1]+(j+1)*li[j][0]*100
            cnt += li[j][0]
            memo[j] = 1
    #print(memo,ttl)
    if ttl < g:
        memo2 = g- ttl
        for j in range(d-1,-1,-1):
            if memo[j] == 0:
                if memo2%(100*(j+1)) == 0:
                    cnt2 = min(memo2//(100*(j+1)),li[j][0]-1)
                    cnt += cnt2
                    ttl += cnt2*(100*(j+1))
                    #print(44444444)
                else:
                    cnt2 = min(((memo2//(100*(j+1)))+1),li[j][0]-1)
                    #print(((memo2//(100*(j+1)))+1))
                    cnt += cnt2
                    ttl += cnt2*(100*(j+1))
                break
    if ttl >= g:
        ans = min(ans,cnt)
"""   
    if ans == cnt:
        print(memo,ttl,111111)
"""   
    

print(ans)



Measured memory_bytes: 3064
#include <bits/stdc++.h>
    using namespace std; 
    double dp[3005][1505];
    int main() 
    {
    	int n;
    	cin>>n;
    	double a[n];
    	for(int i=0;i<n;i++)
    	cin>>a[i];
        dp[0][0]=1;
        for(int i=0;i<=n;i++)
        {
        	for(int j=0;j<=n/2;j++)
        	{
        		if(i==0 && j!=0)
        		dp[i][j]=0;
        		else if(j==0 && i!=0)
        		dp[i][j]=dp[i-1][j]*a[i-1];
        		else if(i==0 && j==0)
        		dp[i][j]=1;
        		else
        		dp[i][j]=a[i-1]*dp[i-1][j]+(1-a[i-1])*dp[i-1][j-1];
			}
		}
    	double z=0;
    	for(int i=0;i<=n/2;i++)
    	z+=dp[n][i];
		cout<<fixed<<setprecision(10);
    	cout<<z;
    }

Measured memory_bytes: 35584
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,i,j,count=0,sign=-1;
    cin>>n;
    while(n--)
    {
        cin>>i>>j;
        if(i==j)
        {
            count++;
            if(count>=3)
            {
                sign=1;
            }
        }
        else
        {
            count=0;
        }
    }
    if(sign==1)
    {
        cout<<"Yes"<<endl;
    }
    else
    {
        cout<<"No"<<endl;
    }
    return 0;
}


Measured memory_bytes: 3632
#include<iostream>
#include<iomanip>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<string>
#include<utility>
#include<numeric>
#include<algorithm>
#include<cmath>
#include<climits>
using namespace std;

using ll = long long;

class Stream{
public:
    Stream(){

    }
    //配列以外の入力を受け取る
    void read(){

    }
    template<typename First, typename... Rest>
    void read(First& first, Rest&... rest){
        cin >> first;
        read(rest...);
    }
    template<typename T>
    vector<T> read_vec(size_t n){
        vector<T> tmp(n);
        for(size_t i = 0; i < n; i++){
            cin >> tmp[i];
        }
        return tmp;
    }
    //配列を区切って出力する
    template<typename T>
    void write_vec(vector<T>& v, char divider){
        for(size_t i = 0; i < v.size(); i++){
            cout << v[i] << divider;
        }
    }
};

constexpr int MOD = 1000000007;

int main(){
    Stream io;

    int N, K;
    io.read(N, K);
    int ans = K;
    for(int i = 1; i <= N - 1; i++) ans *= K - 1;
    cout << ans;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    int a;
    cin >> a;
    for(int i = 1;i < 6;i++) if(a == pow(10, i)){// pow(a, b) はaのb乗を返します
        cout << 10;
        return 0;// return 0; でプログラムを終了します
    }
    cout << a / 100000 + a / 10000 % 10 + a / 1000 % 10 + a / 100 % 10  + a / 10 % 10 + a % 10;// 各桁の和を出力
}


Measured memory_bytes: 384
#include <stdio.h>

#define N_MAX 100

int main(void){
  int a[N_MAX];
  int n;
  int i;

  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  for (i = n - 1; i >= 0; i--) {
    printf("%d", a[i]);
    if (i != 0) printf(" ");
  }
  printf("\n");

  return (0);
}



Measured memory_bytes: 2120
#include <iostream>
#include<algorithm>
#include<string>
#include<vector>
#define _USE_MATH_DEFINES
#include <math.h>
#include <iomanip>
#include <stdio.h>
#include <numeric>
#include <cmath>
#include <limits>
using namespace std;


int main()
{
	int a,b;
	double check=0;
	string s;
	cin >> a >> b;
	s = to_string(b);
	check = pow((double)(a * pow(10, s.length()) + b), 0.5);
	cout << (ceil(check) == floor(check) ? "Yes" : "No")  << endl;
} 


Measured memory_bytes: 384
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
int main()
{
    char a; cin >> a;
    if(a == 'A')
        cout << "T\n";
    if(a == 'T')
        cout << "A\n";
    if(a == 'C')
        cout << "G\n";
    if(a == 'G')
        cout << "C\n";
    //double x; cin >> x; cout <<  fixed << setprecision(10) << ( (x * x * x) / 27.0 ) << '\n';
}


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

#define ld long double
#define ll long long
#define ALL(a)  (a).begin(),(a).end()
#define spa << " " <<
ll MOD = 1e9+7;
void chmin(ll &a, ll b) { if (a > b) a = b; }
void chmax(ll &a, ll b) { if (a < b) a = b; }

int main(){
  ll i, j, f, ib;
  string str;
  ll n, k;
  cin >> n >> k;
  cin >> str;
  char buf;
  buf = str[0];
  vector<ll> p(n + 3 * k + 3);
  for(i = 0, j = 0; i < n; i++){
    if(str[i] == buf)
      p[j]++;
    else{
      j++;
      p[j]++;
      buf = str[i];
    }
  }
  vector<ll> result;
  ll sumbuf = 0;
  i = 0;
  ll max = 0;
  if(str[0] == '0'){
    for(i = 0; i < 2 * k && i < p.size(); i++){
      sumbuf += p[i];
      //cout << sumbuf << endl;
    }
    
    chmax(max, sumbuf);
    i = 1;
  }
  for(j = 0, ib = 2;p[i] != 0 /*&& (p[ib] != 0 || p[ib - 2] != 0)*/; i += 2, ib += 2, j++){
    if(j == 0){
      sumbuf = 0;
      for(f = 0; f < 2 * k + 1; f++)
        sumbuf += p[i + f];
      chmax(max, sumbuf);
      ib = i + 2 * k;
    }
    else{
      sumbuf -= p[i - 1] + p[i - 2];
      sumbuf += p[ib] + p[ib - 1];
      chmax(max, sumbuf);
    }
  }
    
  cout << max << endl;
  //cout << p[0] spa p[1] spa p[2] << endl;

  return 0;
}

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

int main() {
	int n,q;
	cin >> n >> q;
	string s;
	cin >> s;
	vector <int> dp(n);
	dp[0]=0;
	for (int i=1; i<n; i++){
		dp[i]=dp[i-1];
		if (s[i]=='C' && s[i-1]=='A') dp[i]++;
	}
	for (int i=0; i<q; i++){
		int l,r;
		cin >> l >> r;
		cout << dp[r-1]-dp[l-1] << endl;
	}
	return 0;
}

Measured memory_bytes: 1408