akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define llu unsigned long long
#define ld double
#define llu unsigned long long
#define rep(i,x,y)  for(ll i=x;i<y;++i)
#define For(i,x,y)  for(ll i=x;i<=y;++i)
#define FOr(i,x,y)  for(ll i=x;i>=y;--i)
#define pi acos(-1)
#define mk make_pair<ll,ll>
#define pa pair<ll,ll>
#define lf else if
#define max(x,y)    ((x)<(y)?(y):(x))
#define min(x,y)    ((x)<(y)?(x):(y))
#define sqr(x)      ((x)*(x))
#define abs(x)      ((x)>0?(x):-(x))
#define Mul(x,y)    ((x)=1LL*(x)*(y)%mod)
#define Add(x,y)    ((x)=((x)+(y))%mod)
#define Max(x,y)    ((x)=((x)<(y)?(y):(x)))
#define Min(x,y)    ((x)=((x)>(y)?(y):(x)))
#define E(x)        return writeln(x),0
#define p(x)        printf("~%lld~\n",x)
#define pp(x,y)     printf("~~%lld %lld~~\n",x,y)
#define ppp(x,y,z)  printf("~~~%lld %lld %lld~~~\n",x,y,z)
#define pppp(a,b,c,d)	printf("~~~%lld %lld %lld %lld\n",a,b,c,d)
#define f_in(x)     freopen(x,"r",stdin)
#define f_out(x)    freopen(x,"w",stdout)
#define open(x)     f_in(x".in"),f_out(x".out")
#define fi first
#define se second
typedef complex<double> E;
namespace SHENZHEBEI{
#define NEG 1
#ifdef LOCAL
    struct _{_(){freopen("cf.in","r",stdin);}}_;
#endif 
#if NEG
    inline ll read(){    ll x=0,f=1; char ch=getchar();   for (;!isdigit(ch);ch=getchar()) if (ch=='-') f=-1;  for (;isdigit(ch);ch=getchar())  x=x*10-48+ch;   return x*f; }
    inline void write(ll x){    if (x<0) putchar('-'),x=-x;  if (x>=10)   write(x/10);    putchar(x%10+'0');  }
#else
    inline ll read(){    ll x=0; char ch=getchar();   for (;!isdigit(ch);ch=getchar());    for (;isdigit(ch);ch=getchar())  x=x*10-48+ch;   return x;   }
    inline void write(ll x){    if (x>=10)   write(x/10);    putchar(x%10+'0');  }
#endif
    inline char readchar(){ char ch=getchar();   for(;isspace(ch);ch=getchar());  return ch;  }
    inline ll readstr(char *s){ char ch=getchar();   int cur=0;  for(;isspace(ch);ch=getchar());      for(;!isspace(ch);ch=getchar())  s[cur++]=ch;    s[cur]='\0';    return cur; }
    inline void writeln(ll x){  write(x);   puts("");   }
    inline ld getreal(){    static ld lbc;  scanf("%lf",&lbc);  return lbc; }
}using namespace SHENZHEBEI;
char s[310];ll f[310][310][310],n,m;
int main(){
	n=readstr(s+1),m=read();
	memset(f,60,sizeof f);
	For(i,0,n+1){
		memset(f[i][i],0,sizeof f[i][i]);
		if (i)memset(f[i][i-1],0,sizeof f[i][i-1]);
	}
	For(len,2,n){
		For(i,1,n){
            ll j=i+len-1;
            if (j>n)break;
            For(k,0,m){
                if (k)	f[i][j][k]=f[i+1][j-1][k-1];
                if (s[i]==s[j])Min(f[i][j][k],f[i+1][j-1][k]);
                Min(f[i][j][k],f[i+1][j][k]+1);
                Min(f[i][j][k],f[i][j-1][k]+1);
            }
        }
    }
    writeln(n-f[1][n][m]);
}

Measured memory_bytes: 233088
import sys
#import copy
#import numpy as np
#import itertools
#import collections
#from collections import deque
#from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson
#from scipy.sparse import csr_matrix
import functools

sys.setrecursionlimit(10**6)
readline = sys.stdin.readline
#read = sys.stdin.buffer.read

mod = 1000000007

def gcd(nums):
    return functools.reduce(euclid, nums)

def euclid(a, b):
    if b > a:
        a, b = b, a
    if b == 0:
        return a
    else:
        return euclid(b, a%b)

def main():
    # input
    N, K = map(int, readline().split())

    ans = 0
    count = [0] * K
    for X in range(K,0,-1):
        #tmp = ((K // X) ** N) % mod
        tmp = pow(K//X, N, mod)
        diff = count[X-1::X][1:]
        if len(diff) != 0:
            tmp = (tmp - sum(diff)) % mod
        count[X-1] = tmp

    ans = sum([((x+1)*count[x])%mod for x in range(K)])%mod
    #for X in range(K):
    #    ans = (ans + (X+1) * count[X]) % mod

    #print("end")
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 16688
/*      Author : Kaustubh Gangwar
        Institute : IIITA        */
#include <bits/stdc++.h>
using namespace std;
#define modo 1000000007
#define F first
#define S second 
#define pb push_back
#define gcd __gcd
#define vi vector<int>
#define vll vector<long long>
#define all(x) (x).begin(),(x).end()
#define f(i,a,b) for(int i=a;i<b;i++)
#define fe(i,a,b) for(int i=a;i<=b;i++)
#define CODING ios_base::sync_with_stdio(false); 
#define SAMRAT cin.tie(0),cout.tie(0);
#define mii map<int,int>
#define nl '\n'
typedef long long  ll;
typedef pair<int,int> pii;
 
ll bpow(ll a, ll b) {
    a=a; ll ans = 1;
    while(b){
        if (b & 1)
        ans = ans * a;
        a = a * a;
        b >>= 1;
    }
    return ans;
}

int32_t main()
{ 
   CODING SAMRAT
   int test=1;
 //  cin>>test;
   while(test--)
   {
    ll n;
    cin>>n;
    if(n>29)
    cout<<"Yes\n";
    else cout<<"No\n";
   }

return 0;
}

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

#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = (n)-1; i >= 0; i--)
#define rep1(i,n) for(int i = 1; i <= (n); i++)
#define rrep1(i,n) for(int i = (n); i > 0; i--)

#define ll long long
#define pi pair<int, int>
#define pll pair<ll, ll>

#define MOD 1000000007
#define INF 1000000000000000LL

using namespace std;

int main(){
  string s;cin>>s;
  if(s=="ABC")cout<<"ARC";
  else cout<<"ABC";
  return 0;
}

Measured memory_bytes: 3624
#include <stdio.h>
#include <stdlib.h>
#define MAX 100
int top;
void push(int);
int pop(void);
int S[MAX];

int a,b,sum;
int main(){
  char inputc[100];
  int inputi,i=0;

  while(1){
    if(scanf("%s",inputc)==EOF)break;
    if(inputc[0]!=' '){  
      if(inputc[0]=='+'){
	a=pop();
	b=pop();
	sum=a+b;
	push(sum);
      }
      else if(inputc[0]=='-'){
	a=pop();
	b=pop();
	sum=b-a;
	push(sum);
      }
      else if(inputc[0]=='*'){
	a=pop();
	b=pop();
	sum=a*b;
	push(sum);
}
      else {
	inputi=atoi(inputc);
	push(inputi);
      }
    }
  }
  printf("%d\n",S[1]);
  
  return 0;
}


void push(int x){
    top++;
    S[top]=x;

}

int pop(void){

    top--;
    return S[top+1];
}

Measured memory_bytes: 548
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <math.h>

int main(void) {
    int N;
    int A[80];
    long long money = 1000;
    long long trade = 0;

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

    for(int i = 0; i < N - 1; i++) {
        if( A[i] < A[i+1] ) {
            trade += money / A[i];
            money %= A[i];
        }
        else if( A[i] > A[i+1] ) {
            money += trade * A[i];
            trade = 0;
        }
    }

    money += trade * A[N - 1];
    printf("%lld\n", money);

    return 0;
}


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

int main()
{
    ll n;
    cin>>n;
    ll a[n];
    ll b[n];
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        b[i] = a[i];
    }
    sort( a , a+n);
    ll max = a[n-1];
    ll countmax =0;
    ll second = 0;
    for(int i=n-1;i>=0;i--)
    {
        if( a[i] != max)
        {
            second = a[i];
            break;
        }
        else countmax++;
    }
    for(int i =0;i<n;i++ )
    {
        if( b[i] == max) {
            if( countmax > 1)
                cout<<max<<endl;
            else if( second !=0)
            cout << second << endl;
            else cout<<max<<endl;
        }
        else cout<<max<<endl;

    }
}


Measured memory_bytes: 6756
#include <bits/stdc++.h>
#define int long long
#define endl '\n'
#define FOR(i, a, n) for (int i = (a); i < (n); ++i)
#define REP(i, n) FOR(i, 0, n)
using namespace std;

// z-algorithm
// LCP(S, S[i:]) を計算
template <typename T> vector<int> z_algorithm(const T& s) {
    const int n = s.size();
    vector<int> res(n);
    res[0] = n;
    int i = 1, j = 0;
    while (i < n) {
        while (i + j < n && s[j] == s[i + j]) ++j;
        res[i] = j;
        if (!j) { ++i; continue; }
        int k = 1;
        while (i + k < n && k + res[k] < j) {
            res[i + k] = res[k];
            ++k;
        }
        i += k; j -= k;
    }
    return res;
}

void _main() {
    int N;
    string S;
    cin >> N >> S;
    int ans = 0;
    REP (i, S.size()) {
        string T = S.substr(i);
        auto z = z_algorithm(T);
        FOR (j, 1, z.size()) ans = max(ans, min(j, z[j]));
    }
    cout << ans << endl;
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(10);
    _main();
    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#include <stdlib.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,ll> llP;

ll mod(ll a, ll b){
  ll ret=a%b;
  if(ret<0) ret+=b;
  return ret;
}

ll modpow(ll a,ll b,ll c){
  ll res=1;
  while(b>0){
    if(b&1) res=mod(res*a,c);
    a=mod(a*a,c);
    b>>=1;
  }
  return res;
}

int main() {
  ll MOD=1000000007;
  ll n,k;
  cin>>n>>k;
  ll ans=0;
  for(int i=k;i<=n+1;i++){
    ans+=mod(i*(n-i+1)+1,MOD);
    ans=mod(ans,MOD);
  }
  cout<<ans<<endl;
  return 0;
}



Measured memory_bytes: 3632
#include <iostream>
using namespace std;
int main(){
    
    int y,x;
    cin>>y>>x;
    string str[y];
   
    for (int i = 0; i < y ; i++){
        cin>>str[i];
    }
    for (int i = 0; i < x+2; i++)cout << "#";
    cout <<endl;
    for (int i = 0; i < y ; i++){
        cout << "#"<<str[i]<<"#"<<endl;
    }
    
    for (int i = 0; i < x+2; i++)cout << "#";
    
   }

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	var wtr = bufio.NewWriter(os.Stdout)

	var str string
	fmt.Scan(&str)
	q := len(str) - 2
	for {
		p := q / 2
		a := str[0:p]
		b := str[p:q]
		if a == b {
			break
		}
		q -= 2
	}
	fmt.Fprintln(wtr, q)
	_ = wtr.Flush()
}


Measured memory_bytes: 1844
import java.util.*;
import java.util.Map.Entry;

import javax.swing.text.Segment;
import javax.xml.ws.WebEndpoint;

import java.io.*;
import java.lang.reflect.Array;
import java.math.BigInteger;

import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
 
public class Main implements Runnable
{
//    static int dx[]={-1,0,1,0};
//    static int dy[]={0,-1,0,1};
    static long mod=1000000007;
    
    public static void main(String[] args) {        
        new Thread(null, new Main(), "", 200 * 1024 * 1024).start();        
    }

    public void run() {
        Reader sc = new Reader(System.in);
        PrintWriter out=new PrintWriter(System.out);

        long h=sc.nextInt();
        int n=sc.nextInt();
        long r=0;
        for (int i = 0; i < n; i++) {
			r+=sc.nextLong();
		}
        
        
        out.println(r<h?"No":"Yes");
     	out.flush();
    }

    static void ret(String ans) {
    	System.out.println(ans);
    	System.exit(0);
    }

    static void ret(long ans) {
    	System.out.println(ans);
    	System.exit(0);
    }
    
    static boolean validpos(int x,int y,int r, int c){
        return x<r && 0<=x && y<c && 0<=y;
    }

    static void db(Object... os){
        System.err.println(Arrays.deepToString(os));
    }
}

//class P {
//	int x,y; double d;
//	P(int  x, int y, double d) {
//	  this.x=x;
//	  this.y=y;
//	  this.d=d;
//	}
//}


class P implements Comparable<P>{
    int x,y;
    P(int x,int y) {
    	this.x=x;
    	this.y=y;
    }

    public int compareTo(P p){
        return y-p.y;
    }
}

class Reader
{ 
    private BufferedReader x;
    private StringTokenizer st;
    
    public Reader(InputStream in)
    {
        x = new BufferedReader(new InputStreamReader(in));
        st = null;
    }
    public String nextString()
    {
        while( st==null || !st.hasMoreTokens() )
			try {
				st = new StringTokenizer(x.readLine());
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
        return st.nextToken();
    }
    public int nextInt()
    {
        return Integer.parseInt(nextString());
    }
    public int[] nextIntArray(int size) {
        int r[] = new int[size];
        for (int i = 0; i < size; i++) {
            r[i] = this.nextInt(); 
        }
        return r;
    }
    public long[] nextLongArray(int size) {
        long r[] = new long[size];
        for (int i = 0; i < size; i++) {
            r[i] = this.nextLong(); 
        }
        return r;
    }
    public char[] getCharSet() {
        return this.nextString().toCharArray();
    }    
    public long nextLong()
    {
        return Long.parseLong(nextString());
    }
    public double nextDouble() throws IOException
    {
        return Double.parseDouble(nextString());
    }
}


Measured memory_bytes: 35856
#include <iostream>
using namespace std;
int main(int argc, const char * argv[])
{
    int x,sum=0,t;
    cin>>x;
    t=x;
    while(x>0)
    {
        sum+=x%10;
        x/=10;
    }
    if(t%sum==0)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 256
/*
diverta 2019 Programming Contest D
*/
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>

int main()
{
    unsigned long n, ans = 0;
    std::cin >> n;

    if (n != 1 && n / (n - 1) == n % (n - 1))
        ans += n - 1;

    for (int i = 2; i <= sqrt(n); i++)
    {
        if (n % i == 0)
        {
            if (n / (i - 1) == n % (i - 1))
                ans += i - 1;
            if (n / (n / i - 1) == n % (n / i - 1))
                ans += n / i - 1;
        }
    }
    std::cout << ans << std::endl;
    return 0;
}

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

#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i, m, n) for(int i = (m); i < (int)(n); ++i)
#define ALL(x) (x).begin(), (x).end()
#define INF 2000000000

#ifdef LOCAL
  #define eprintf(...) fprintf(stdout, __VA_ARGS__)
#else
  #define eprintf(...) 0
#endif

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef unsigned int uint;

int ctoi(char c) {
  return c - '0';
}

template <class C>
void printContainer(C &container, const char *delim=",") {
  for(const auto &e : container) {
    std::cout << e << delim;
  }
  std::cout << "\n";
}

// Greatest common divisor
template<class T>
T gcd(T x, T y) {
  if(x < y) {
    std::swap(x, y);
  }
  T r = x % y;
  while(r != 0) {
    x = y;
    y = r;
    r = x % y;
  }
  return y;
}

// Least common multiple
template<class T>
T lcm(T x, T y) {
  return (x*y)/gcd(x,y);
}

int main() {
  int a, b;
  cin >> a >> b;
  string ans;

  if(!(a%3) or !(b%3) or !((a+b)%3)) {
    ans = "Possible";
  }
  else {
    ans = "Impossible";
  }

  cout<<ans<<endl;

  return 0;
}


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

#define int long long
#define pb push_back
#define range(v) v.begin(),v.end()
#define mod (int)(1e9 + 7)
#define inf (int)(1e15)
#define N (int)(2e5 + 10)

using namespace std;


void solve() {
	int h, n;
	cin >> h >> n;
	vector<int> a(n), b(n);
	for (int i = 0; i < n; i++)
		cin >> a[i] >> b[i];

	vector<vector<int>> dp(n + 1, vector<int> (h + 1));

	for (int i = n; i >= 0; i--) {
		for (int ch = 0; ch <= h; ch++) {
			if (ch == 0) dp[i][ch] = 0;
			else if (i == n) dp[i][ch] = inf;
			else
				dp[i][ch] = min(dp[i + 1][ch], dp[i][max(ch - a[i], (int)0)] + b[i]);
		}
	}

	cout << dp[0][h] << endl;



}

int32_t main() {
	ios_base::sync_with_stdio(false), cin.tie(nullptr), cin.tie(nullptr);
	int t_c = 1;
//	cin >> t_c;
	while (t_c--)
		solve();
}

Measured memory_bytes: 81544
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)   // 0-indexed昇順

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


Measured memory_bytes: 3632
#include <iostream>
#include <bits/stdc++.h>
#include <math.h>

using namespace std;

int main(){
    int n,m;
    cin>>n>>m;
    vector<pair<int,int>> stu(n);
    vector<pair<int,int>> check(m);
    
    for(int i=0;i<n;i++) cin>>stu.at(i).first>>stu.at(i).second;
    for(int i=0;i<m;i++) cin>>check.at(i).first>>check.at(i).second;
    
    for(int i=0;i<n;i++){
        int nin=1;
        for(int j=0;j<m;j++){
            if(abs(stu.at(i).first-check.at(j).first)+abs(stu.at(i).second-check.at(j).second) < abs(stu.at(i).first-check.at(nin-1).first)+abs(stu.at(i).second-check.at(nin-1).second)){
                nin=j+1;
            }
        }
        
        cout<<nin<<endl;
    }
    
    return 0;
}

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

unsigned long long int GCD(unsigned long long int a,unsigned long long int b){
	unsigned long long int less = min(a,b), gcd = 1, i;
	for(i=1;i<=less;++i){
		if( a%i==0 && b%i==0 )gcd = i;
	}
	return gcd;
}

unsigned long long int LCM(unsigned long long int a,unsigned long long int b){
	return a*b/GCD(a,b);
}

unsigned long long int LCM(unsigned long long int a,unsigned long long int b,unsigned long long int c){
	return LCM(a,LCM(b,c));
}

int main() {
	unsigned long long int a1,a2,a3,m1,m2,m3;
	unsigned long long int x,y,z;
	unsigned long long int l,m,n;
	
	while(cin>>a1>>m1>>a2>>m2>>a3>>m3, a1||a2||a3||m1||m2||m3){
		x=y=z=1;
		l=m=n=0;
		
		do{
			x = (a1*x)%m1;
			++l;
		}while(x-1);
		do{
			y = (a2*y)%m2;
			++m;
		}while(y-1);
		do{
			z = (a3*z)%m3;
			++n;
		}while(z-1);
		
		cout << LCM(l,m,n) << endl;
	}
	return 0;
}

Measured memory_bytes: 1148
//
// Created by tac on 2016/10/23.
//

#include <cstdlib>
#include <iostream>

namespace {
const int ARRAY_SIZE = 100;
int array[ARRAY_SIZE];

void print_array(const int array[], const int n) {
    std::string sep {""};
    for (int i = 0; i < n; ++i) {
        std::cout << sep;
        std::cout << array[i];
        sep = " ";
    }
    std::cout << std::endl;
    return;
}

//1 insertionSort(A, N) // N??????????´??????????0-?????????????????????A
//2   for i ??? 1 ?????? N-1 ?????§
//3     v = A[i]
//4     j = i - 1
//5     while j >= 0 ?????? A[j] > v
//6       A[j+1] = A[j]
//7       j--
//8     A[j+1] = v
void sort_array(int array[], const int n) {
    print_array(array, n);
    for (int i = 1; i < n; ++i) {
        int v = array[i];
        int j = i - 1;
        while (j >= 0 && array[j] > v) {
            array[j + 1] = array[j];
            --j;
        }
        array[j + 1] = v;
        print_array(array, n);
    }
    return;
}

}

int main() {
    int n;
    int s;
    std::cin >> n;
    for (int i = 0; i < n; ++i) {
        std::cin >> s;
        array[i] = s;
    }
    sort_array(array, n);
    return EXIT_SUCCESS;
}

Measured memory_bytes: 3156
import java.util.Scanner;
public class Main {
	public static void main(String[] args) throws java.io.IOException {
		Scanner scan = new Scanner(System.in);
		int a[] = new int[7];
		int b[] = new int[7];
		for(int i = 0; i<7 ; i++){
			a[i] = scan.nextInt();
			b[i] = scan.nextInt();
		}
		for(int i = 0; i<7 ; i++){
			System.out.println(a[i]-b[i]);
		}
	}
}

Measured memory_bytes: 17176
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
typedef pair<int, int> P;
typedef long long ll;
int main() {
    int W, H;
    vector<P> v;
    cin >> W >> H;
    for(int i=0;i<W+H;i++){
        int p; cin >> p;
        v.push_back(P(p, i));
    }
    sort(v.begin(), v.end());
    ll ans = 0;
    ll w = W+1, h = H+1;
    for(int i=0;i<W+H;i++){
        ll p = v[i].first;
        if(v[i].second < W){
            w--;
            ans += h*p;
        }else{
            h--;
            ans += w*p;
        }
    }
    cout << ans << endl;
	return 0;
}

Measured memory_bytes: 2420
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <iomanip>
#include <bitset>
#include <set>
#include <map>
#include <stdio.h>
#include <numeric>
#include <cstring>

#define rep(i,n) for (int i = 0; i < (n); i++)
#define rep1(i,n) for (int i = 1; i < (n); i++)
#define FOR(i,a,b) for (int i=(a); i < (b); i++)
#define MOD 1000000007 //10^9+7
#define ALL(a)  (a).begin(),(a).end()
using namespace std;
using ll = long long;
using PII = pair<int, int>;
using PLL = pair<long long, long long>;
const int INF = numeric_limits<int>::max();
constexpr ll TEN(int n) { return (n==0) ? 1 : 10*TEN(n-1); }

// 負の数にも対応した % 演算
long long mod(long long val, long long m) {
    long long res = val % m;
    if (res < 0) res += m;
    return res;
}

//greatest common divisor
long long gcd(ll a, ll b) 
{
    if (a % b == 0) {
        return b;
    } else {
        return gcd(b, a % b);
    }
}

//least common multiple
long long lcm(ll a, ll b)
{
    return a / gcd(a, b) * b ;
}

bool is_prime(ll n) {
    for (ll i = 2; i * i <= n; i++) {
        if (n % i == 0) return false;
    }
    return n != 1;
}

int main()
{
    int n; cin >> n; string s; cin >> s;
    int ans = 0;
    for (int v = 0; v <= 999; v++) {
        int c[3] = {v/100, (v/10)%10, v%10};
        int f = 0;
        rep(i,n) {
            if (s[i] == '0' + c[f]) f++;
            if (f == 3)  break;
            }
        if (f == 3)
            ans++;
    }
    cout <<ans << endl;
    return 0;
}



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

using namespace std;

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

  vector<int> v(N);
  int sum = 0;
  int max = 0;
  for (int n = 0; n < N; n++) {
	cin >> v[n];
	sum += v[n];
	if (v[n] > max) {
	  max = v[n];
	}
  }

  if (max >= (sum - max)) {
	cout << "No" << endl;
  } else {
	cout << "Yes" << endl;
  }





  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
  int H,W;
  while(1)
  {
    scanf("%d %d",&H,&W);
    if(H==0&&W==0) break;

    for(int i=1;i<=H;i++)
      {
        for(int k=1;k<=W;k++)
          {
            if(i%2 != 0 && k%2 == 0)
              putchar('.');
            else if(i%2 !=0 && k%2 != 0)
              putchar('#');

            else if(i%2 == 0 && k%2 != 0)
              putchar('.');
            else if(i%2 == 0 && k%2 == 0)
              putchar('#');
          }
        printf("\n");
      }
      printf("\n");
  }
  return 0;
}

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

const int INF = 1e9;
const int mod = 1e9+7;
const double EPS = 1e-10;
const double PI = acos(-1.0);

int main()
{
    int x,y;
    cin >> x >> y;
    int ans;
    if(x > 0 && y > 0){
        if(x < y) ans = y - x;
        else ans = x - y + 2;
    }else if(x < 0 && y < 0){
        if(x < y) ans = y - x;
        else ans = x - y + 2;
    }else if(x > 0 && y < 0){
        if(x < -y) ans = -y-x+1;
        else ans = x+y+1;
    }else if(x < 0 && y > 0){
        if(-x < y) ans = x+y+1;
        else ans = -x-y+1;
    }else{
        ans = abs(x-y);
        if(x > 0 || y < 0) ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
constexpr long long INFL = 1LL << 60;
constexpr int INF = 1 << 30;

using namespace std;

using ll = long long;
using P = tuple<int, int>;
using iarr = valarray<int>;

int main()
{
    int K,S;
    cin >> K >> S;
    ll cnt = 0;
    for(int i = 0; i <= K; ++i){
        for(int j = 0; j <= K; ++j){
            if(i+j > S) break;
            if(i+j+K >= S) cnt++;
        }
    }
    cout << cnt << endl;
    return 0;
}



Measured memory_bytes: 256
from heapq import heappush, heappop, heapify
from typing import List, Tuple


if __name__ == "__main__":
    num_vertices = int(input())
    adj_list: List[List[Tuple[int, int]]] = [[] for _ in range(num_vertices)]

    for vertex in range(num_vertices):
        for adj, cost in enumerate(map(lambda x: int(x), input().split())):
            if -1 != cost:
                # Store values as (cost, adj) to aplly heapify to cost values.
                adj_list[vertex].append((cost, adj))

    visited: List[bool] = [False] * num_vertices
    # Set the root node.
    que = [(cost, adj) for cost, adj in adj_list[0]]
    visited[0] = True
    heapify(que)

    total_cost = 0
    while [] != que:
        cost, adj = heappop(que)
        if visited[adj]:
            continue
        visited[adj] = True
        total_cost += cost
        for n_cost, n_adj in adj_list[adj]:
            if visited[n_adj]:
                continue
            heappush(que, (n_cost, n_adj))

    print(total_cost)



Measured memory_bytes: 7984
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <numeric>
#include <string.h>
using namespace std;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<29;
const long long INFL = 1e18;
const int MOD = 1000000007;
const int MAX = 210000;
#define MAX_SIZE 5
long long N, min_num;
void solve() {
    cin  >> N;
    N = N - 1;
    min_num = INFL;
    vector<long long> array_p(MAX_SIZE);
    for (int i = 0; i < MAX_SIZE; i++) {
        long long tmp;
        cin >> tmp;
        min_num = min(tmp, min_num);
    }
    cout << (N / min_num) + 5 << endl; 
    return;
}
//逆元を求める関数
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++) {
      fac[i] = fac[i-1] * i % MOD;
      inv[i] = MOD - inv[MOD%i] * (MOD/i) % MOD;
      finv[i] = finv[i-1] * inv[i] % MOD;
    }
}
//組み合わせ
long long COM (int n, int k) {
    if(n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n-k] % MOD) % MOD;
}
int main(int args, char* argv[]) {
    solve();
}



Measured memory_bytes: 256
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <unordered_map>
#include <vector>

using namespace std;

typedef long long lint;

int main() {
  int a, b, ab, need_a, need_b;
  scanf("%d %d %d %d %d", &a, &b, &ab, &need_a, &need_b);
  int result = 0;
  if (2 * ab >= a + b) {
    result += need_a * a + need_b * b;
  } else {
    int get = min(need_a, need_b);
    result += get * 2 * ab;
    need_a -= get;
    need_b -= get;
    if (need_b > 0) {
      swap(a, b);
      swap(need_a, need_b);
    }
    result += need_a * min(a, 2 * ab);
  }
  printf("%d\n", result);
  return 0;
}


Measured memory_bytes: 256
N = int(input())
a = tuple(int(input()) for _ in range(N))
log = set()
i = 0
count = 1
while a[i] != 2:
  i = a[i] - 1
  if i in log:
    print(-1)
    break
  else:
    log.add(i)
    count += 1
else:
  print(count)

Measured memory_bytes: 21448
#include<bits/stdc++.h>
using namespace std;
#define ar array
#define endl '\n'
#define ll long long
#define in insert
#define pb push_back
#define vt vector
#define P_Q(x) priority_queue<x>
#define p_q(x) priority_queue<x, vector<x>, greater<x>>
#define Rep(i,a,b) for(int i=a;i<=b;i++)
#define Rev(i,a,b) for(ll i=a;i>=b;i--)
#define FOR(m) Rep(i,1,m)
#define For(m) Rep(i,0,m-1)
#define Rbl(x,a) for(auto &x : a)
#define FIO ios::sync_with_stdio(0);   cin.tie(0);
#define F first
#define S second
#define pii pair<int,int>
#define pll pair<ll,ll>
#define mp make_pair
#define vpii vector<pii>
#define vpll vector<pll>
#define all(x) (x).begin(),(x).end()
#define sz(x) (int) (x).size()
const ll INF = 0x3f3f3f3f3f3f3f3fll;
#define mod 1000000007
 
const int mxN = 1e5 + 1;
const array<ll, 2> A = {-1, -1};
ll dp[3001][3001] = {};
array<ll, 2> v[3001][3001];
array<ll, 2> p[3001][3001];
string s, t;
 
 
int main()
{
FIO
 
    cin >> s >> t;
    int n = s.length(), m = t.length();

    for(int i = 0; i <= n; i++)
    {
        for(int j = 0; j <= m; j++)
        {
            p[i][j] = A;
            v[i][j] = A;
        }
    }

    for(int i = n-1; i >= 0; i--)
    {
        for(int j = m-1; j >= 0; j--)
        {
            if(s[i] == t[j])
            {
                // dp[i][j] = max(max(dp[i][j+1], dp[i+1][j]) , dp[i+1][j+1] + 1);
                if(dp[i][j] < dp[i][j+1])
                {
                    v[i][j] = v[i][j+1]; 
                    dp[i][j] = dp[i][j+1];
                }
                if(dp[i][j] < dp[i+1][j])
                {
                    v[i][j] = v[i+1][j];
                    dp[i][j] = dp[i+1][j];
                }
                if(dp[i][j] < dp[i+1][j+1] + 1)
                {
                    v[i][j] = {i, j};
                    p[i][j] = v[i+1][j+1];
                    dp[i][j] = dp[i+1][j+1] + 1;
                }
            }
            else
            {
                // dp[i][j] = max(max(dp[i][j+1], dp[i+1][j]) , dp[i+1][j+1]);
                if(dp[i][j] < dp[i][j+1])
                {
                    v[i][j] = v[i][j+1]; 
                    dp[i][j] = dp[i][j+1];
                }
                if(dp[i][j] < dp[i+1][j])
                {
                    v[i][j] = v[i+1][j];
                    dp[i][j] = dp[i+1][j];
                }
                if(dp[i][j] < dp[i+1][j+1])
                {
                    v[i][j] = v[i+1][j+1];
                    dp[i][j] = dp[i+1][j+1];
                }
            }
        }
    }
    int i = 0, j = 0;
    string ans = "";
    while(true)
    {
        if(i == -1 || v[i][j] == A)
            break;
        int x = v[i][j][0];
        int y = v[i][j][1];
        ans += s[x];
        assert(s[x] == t[y]);
        i = p[x][y][0];
        j = p[x][y][1];
    }
    cout << ans << endl;
}


Measured memory_bytes: 355312
#include<bits/stdc++.h>
#define fast ios::sync_with_stdio(false);
using namespace std;
int main(){
	fast;
	long double ans=0;
	int n;
	double a;
	string s;
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>a>>s;
		if(s=="JPY")ans+=a;
		else ans+=a*380000;
	}
	cout<<ans;
}

Measured memory_bytes: 256
win=[0,2,3,1]
lose=[0,3,1,2]
while True:
    exist=[False for i in range(4)]
    h=[0 for i in range(5)]
    h[0] = int(input())
    exist[h[0]]=True
    if h[0] == 0 :
        break
    for i in range(1,5):
        h[i]=int(input())
        exist[h[i]]=True
    for i in range(5):
        if exist[win[h[i]]] and not exist[lose[h[i]]]:
            print(1)
        elif not exist[win[h[i]]] and exist[lose[h[i]]]:
            print(2)
        else:
            print(3)


Measured memory_bytes: 5608
#include<stdio.h>

int main(void)
{
	int a;
	scanf("%d", &a);
	if (a == 111)
	{
		printf("999");
	}
	if (a == 119)
	{
		printf("991");
	}
	if (a == 191)
	{
		printf("919");
	}
	if (a == 199)
	{
		printf("911");
	}
	if (a == 911)
	{
		printf("199");
	}
	if (a == 919)
	{
		printf("191");
	}
	if (a == 991)
	{
		printf("119");
	}
	if (a == 999)
	{
		printf("111");
	}

	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define all(v) v.begin(), v.end()
#define MOD 1000000007
const int INF = 1LL<<30;

int a[15][15];

int main(){
    int n,m,x;
    cin>>n>>m>>x;
    vector<int> c(n);

    rep(i,n){
        cin>>c[i];
        rep(j,m) cin>>a[i][j];
    }

    int ans=INF;
    rep(bit,1<<n){
        vector<int> sc(m,0);
        int tmp=0;
        rep(i,n){
            if(bit & 1<<i){
                tmp+=c[i];
                rep(j,m) sc[j]+=a[i][j];
            }
        }
        bool ok=true;
        rep(i,m){
            if(sc[i]<x) ok=false;
        }
        if(ok) ans=min(ans,tmp);
    }

    if(ans==INF) ans=-1;
    cout<<ans<<endl;
}

Measured memory_bytes: 3576
#include <bits/stdc++.h>
#define ALL(obj) begin(obj), end(obj)
#define debug(x) cerr << #x << ": " << x << '\n'
using namespace std;

const int INF = 2100100100;
int main() {
    int N, K, C;
    string S;
    cin >> N >> K >> C >> S;
    vector<int> A;  // 左から貪欲
    for (int i = 0; i < N;) {
        if (S[i] == 'o') {
            A.push_back(i);
            i += C + 1;
        } else {
            i++;
        }
    }
    int d = (int)A.size();
    if (d > K) return 0;

    vector<int> B(K);  // 右から貪欲
    A.push_back(N);
    B.push_back(INF);
    for (int i = K - 1; i >= 0; i--) {
        for (int l = A[i + 1] - 1; l >= A[i]; l--) {
            if (S[l] == 'o' && l + C < B[i + 1]) {
                B[i] = l;
                break;
            }
        }
    }

    vector<int> ans;
    for (int i = 0; i < K; i++) {
        if (A[i] == B[i]) ans.push_back(A[i]);
    }
    for (auto i : ans) {
        cout << i + 1 << "\n";
    }
}


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

ll dp[20100];
ll a[1010],b[1010];
int main(){
	ll h,n;
	cin>>h>>n;
	ll ma=0;
	for(int i=0;i<n;i++){
		cin>>a[i]>>b[i];
		ma=max(ma,a[i]);
	}
	for(int i=1;i<=h+ma;i++)dp[i]=1e18;
	for(int i=1;i<=h+ma;i++){
		for(int j=0;j<n;j++){
			if(i<a[j])dp[i]=min(dp[i],b[j]);
			else dp[i]=min(dp[i],dp[i-a[j]]+b[j]);
		}
	}
	ll ans=1e18;
	for(int i=h;i<=h+ma;i++)ans=min(ans,dp[i]);
	cout<<ans;
	return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <algorithm>
#include <map>
#include <vector>
#include <string>
#include <bitset>

using namespace std;

typedef long long int lli;

// 約数の列挙O(√n)
map<lli, lli> prime_factor(lli n){
  map<lli, lli> res;
  for (lli i = 2; i * i <= n; i++) {
    while (n % i == 0) {
      ++res[i];
      n /= i;
    }
  }
  if (n != 1) res[n] = 1;
  return res;
}

int main(int argc, char const *argv[]) {
  lli n;
  cin >> n;
  vector<lli> pf;
  map<lli,lli> mp = prime_factor(n);
  for (auto x : mp) {
    for (size_t i = 0; i < x.second; i++) {
      pf.push_back(x.first);
    }
  }
  if (pf.size()==1) {
    pf.insert(pf.begin(),1);
  }
  int ans = 1<<10;
  for (size_t i = 0; i < 1<<pf.size(); i++) {
    bitset<64> bs64(i);
    lli a=1, b=1;
    for (int j = 0; j < pf.size(); j++) {
      if (bs64[j]==0) a*=pf[j];
      else b*=pf[j];
    }
    string as=to_string(a), bs=to_string(b);
    if (max(as.length(),bs.length())<ans) ans = max(as.length(),bs.length());
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main { //atcoder ABC128D -

	public static void main(String[] args) {
		Scanner seer = new Scanner(System.in);
		int n = seer.nextInt(); int k = seer.nextInt();
		long[] vals = new long[n];
		for(int i = 0; i < n; i++){
			vals[i] = seer.nextInt();
		}
		long max = 0;
		for(int i = 0; i <= k; i++){ //picking i jewels in total
			for(int j = 0; j <= i; j++){ // the rightmost from the left side is the jth one
				PriorityQueue<Long> q = new PriorityQueue<>();
				for(int s = 0; s < j && s < n; s++){
					q.add(vals[s]);
				}
				for(int s = 0; s < (i-j) && s+j < n; s++){
					q.add(vals[n-s-1]);
				}
				for(int s = 0; s < (k-i) && !q.isEmpty(); s++){
					long hey = q.poll();
					if(hey > 0) {
						q.add(hey); break;
					}
				}
				long curr = 0;
				for(long v: q){
					curr += v;
				}
				max = Long.max(max, curr);
			}
		}
		System.out.println(max);
	}
}


Measured memory_bytes: 31188
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  cin>>n;
  map<int,int>mp;
  vector<int>v(n);
  bool flag=true;
  for(int i=0;i<n;i++)
  {
    int k;cin>>k;
    if(mp[k]==1 && flag)
    {
      flag=false;
    }
    mp[k]++;
  }
  if(flag)
    cout<<"YES"<<endl;
  else
    cout<<"NO"<<endl;
}
    

Measured memory_bytes: 10368
#include<bits/stdc++.h>
using namespace std;
int dp[10005][103][7];
const int MOD=1e9+7;
string s;
int d;
inline int real(int x){
	x%=d;
	if(x<0)x+=d;
	return x;
}
int main(){
	
	cin>>s>>d;
	int sz=(int)s.size();
	for(int i=0;i<=s[0]-'0'-1;i++) dp[0][i%d][0]++;
	dp[0][(s[0]-'0')%d][1]=1;
	for(register int i=1;i<sz;i++){
		for(int j=0;j<d;j++){
			for(int k=0;k<=9;k++){
				dp[i][j][0]+=dp[i-1][real(j-k)][0];
				if(k<s[i]-'0') dp[i][j][0]+=dp[i-1][real(j-k)][1];
//				cout<<k<<" "<<dp[i-1][real(j-k)][0]<<endl;
				if(dp[i][j][0]>=MOD) dp[i][j][0]-=MOD;
			}
			dp[i][j][1]=dp[i-1][real(j-s[i]+'0')][1];
//			cout<<i<<" "<<j<<" "<<dp[i][j][0]<<" "<<dp[i][j][1]<<endl; 
		}
	}
	cout<<(dp[sz-1][0][0]+dp[sz-1][0][1]-1+MOD)%MOD;
}

Measured memory_bytes: 28416
// cities to vapori-
// corner cases // int vs ll // cin vs scanf // clear structures // statement // doublesz
#include <bits/stdc++.h>
#define pb push_back
#define fst first
#define snd second
#define sz(x) int(x.size())
#define fill(x,v) memset(x,v,sizeof(x))
#define REP(i,a,b) for(int i = int(a); i < int(b); ++i)
#define trace(x) cout << #x << " = " << x << endl
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
using namespace std;
typedef long long ll;
typedef pair<int,int> ii;

int main(){

	fastio;
	int x,y,a,b,c;
	cin >> x >> y >> a >> b >> c;
	vector<int> vred(a),vgreen(b);
	REP(i,0,a) cin >> vred[i];
	REP(i,0,b) cin >> vgreen[i];
	sort(vred.rbegin(),vred.rend());
	sort(vgreen.rbegin(),vgreen.rend());
	
	ll ans = 0;
	priority_queue<int,vector<int>,greater<int>> pq;
	REP(i,0,x){ ans += vred[i]; pq.push(vred[i]); }
	REP(i,0,y){ ans += vgreen[i]; pq.push(vgreen[i]); }

	vector<int> white(c);
	REP(i,0,c) cin >> white[i];
	sort(white.rbegin(),white.rend());
	for(int x : white){
		if(x > pq.top()){
			ans -= pq.top(); pq.pop();
			ans += x; pq.push(x);
		}
	}
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 2168
info=gets.chomp.split(" ").map(&:to_i)
b=gets.chomp.split(" ").map(&:to_i)
count=0
info[0].times do|i|
	a=gets.chomp.split(" ").map(&:to_i)
	result=0
	info[1].times do|j|
		result+=a[j]*b[j]
	end
	if(result+info[2]>0)
		count+=1
	end
end
p count

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

int main() {
	int n,m,k=0;
	cin >> n >> m;
	vector<int> x(m);
	for(int i=0;i<m;i++)
	{
		cin >> x.at(i);
	}
	sort(x.begin(),x.end());
	if(n >= m)
	{
		k=0;
	}
	else
	{
		vector<int> y(m-1);
		for(int i=0;i<m-1;i++)
		{
			y.at(i)=x.at(i+1) - x.at(i);
		}
		sort(y.begin(),y.end());
		for(int i=0;i<m-n;i++)
		{
			k+=y.at(i);
		}
	}
	cout << k << endl;
	return 0;
}


Measured memory_bytes: 3984
#include<bits/stdc++.h>
#define ll long long
#define MOD 1000000007
#define speedup    ios_base::sync_with_stdio(false),cin.tie(0)
using namespace std;
int main(int argc, char *a[])
{
    speedup;
    ll int n,m,i,j;
    char ch;
    cin>>n>>m;
    ll int ar[n][m];
    for(i=0;i<n;i++)
    {
        for(j=0;j<m;j++)
           { 
            cin>>ch;
            if(ch=='.')
                ar[i][j]=1;
            else
                ar[i][j]=0;
           }
    }
    ll int dp[n][m];
    memset(dp,0,sizeof(dp));
    dp[0][0]=1;
    for(i=1;i<n;i++)
    {   
        if(ar[0][i]==1){
        if(ar[0][i-1]==1)
            dp[0][i]=dp[0][i-1];
        }
        if(ar[i][0]==1){
        if(ar[i-1][0]==1)
            dp[i][0]=dp[i-1][0];
        }
        
    }
    for(i=1;i<n;i++)
    {
        for(j=1;j<m;j++)
        {
            if(ar[i][j]==1)
            {
                dp[i][j]=(dp[i-1][j]+dp[i][j-1])%MOD; 
            }
        }
           
                                                                                 
        
    }
    //  for(i=0;i<n;i++)
    // {
    //     for(j=0;j<m;j++)
    //     {
    //         cout<<dp[i][j]<<" ";
    //     }
    //     cout<<endl;
    // }
    cout<<dp[n-1][m-1]<<endl;
    //Write code here
}


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

char c[105][105];
set<int> xx, yy;

int main() {
  int x, y;
  cin >> x >> y;
  for (int i = 1; i <= x; i++) {
    for (int j = 1; j <= y; j++) {
      cin >> skipws >> c[i][j];
      if (c[i][j] == '#') {
        xx.insert(i), yy.insert(j);
      }
    }
  }
  for (int x : xx) {
    for (int y : yy)
      cout << c[x][y];
    cout << endl;
  }
}

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

int main(){
    long a,b,c,k;
    cin>>a>>b>>c>>k;
    long sum;
    long thre1=a,thre2=a+b;
    if(k<=thre1) sum=k;
    else if(thre1<k&&k<=thre2) sum=a;
    else sum=a-(k-a-b);
    cout<<sum<<endl;
}

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

int main() {
  int a, b, ans = -1;
  cin >> a >> b;
  rep(i, 1001) {
    if (i * 8 / 100 == a && i / 10 == b) {
      ans = i;
      break;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
/**
 *  author: Haunted_Cpp
**/
 
#include <bits/stdc++.h>
using namespace std;
 
#pragma GCC optimize("Ofast")
#pragma GCC target("fma,sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#pragma GCC optimize("unroll-loops")
 
template<typename T> ostream &operator << (ostream &os, const vector<T> &v) { os << '{'; string sep; for (const auto &x : v) os << sep << x, sep = ", "; return os << '}'; }
template<typename T, size_t size> ostream &operator << (ostream &os, const array<T, size> &arr) { os << '{'; string sep; for (const auto &x : arr) os << sep << x, sep = ", "; return os << '}'; }
template<typename A, typename B> ostream &operator << (ostream &os, const pair<A, B> &p) { return os << '(' << p.first << ", " << p.second << ')'; }
 
void debug_out() { cerr << endl; }
template<typename Head, typename... Tail> void debug_out(Head H, Tail... T) { cerr << ' ' << H; debug_out(T...); }
 
#ifdef LOCAL
#define debug(...) cerr << "(" << #__VA_ARGS__ << "):", debug_out(__VA_ARGS__)
#else
#define debug(...) 47
#endif

typedef long long i64;
typedef pair<long, long> pi64;

const int MAX_N = 1e6 + 5;
const i64 INF = 1e18;

i64 arr[MAX_N], dp[MAX_N];

i64 f(pi64 linha, int x) {
	return linha.first * x + linha.second;
}

struct LiChao {
	const int L;
	vector<pi64> seg;
	LiChao(int n) : L(n + 5) {
		seg.clear();
		seg = vector<pi64>(4 * L, {0, INF});
	}
	void add(pi64 linha, int l, int r, int node) {
		int mid = l + (r - l) / 2;
		bool left = f(linha, l) < f(seg[node], l);
		bool middle = f(linha, mid) < f(seg[node], mid); 
		if (middle) {
			swap(seg[node], linha);
		}
		if (r == l) {
			return;
		} else if (left != middle) {
			add(linha, l, mid, 2 * node + 1);
		} else {
			add(linha, mid + 1, r, 2 * node + 2);
		}	
	}
	i64 get(int l, int r, int where, int node) {
		int mid = l + (r - l) / 2;
		if (r == l) {
			return f(seg[node], where);
		} else if (where < mid) {
			return min(f(seg[node], where), get(l, mid, where, 2 * node + 1));
		} else {
			return min(f(seg[node], where), get(mid + 1, r, where, 2 * node + 2));
		}
	}
};

int main () {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n;
  i64 c;
  cin >> n >> c;
	for (int i = 0; i < n; i++) {
		cin >> arr[i];
	}
	LiChao hull(MAX_N);
	dp[0] = 0;
	hull.add({-2 * arr[0], dp[0] + arr[0] * arr[0]}, 0, MAX_N, 0);
	for (int i = 1; i < MAX_N; i++) dp[i] = INF;
	for (int i = 1; i < n; i++) {
		dp[i] = hull.get(0, MAX_N, arr[i], 0) + c + arr[i] * arr[i];
		hull.add({-2 * arr[i], dp[i] + arr[i] * arr[i]}, 0, MAX_N, 0);
	}
	cout << dp[n - 1] << '\n';
  return 0;
}


Measured memory_bytes: 74988
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#define P pair<ll,ll>
#define FOR(I,A,B) for(ll I = int(A); I < int(B); ++I)
#define FORR(I,A,B) for(ll I = int((B)-1); I >= int(A); --I)
#define TO(x,t,f) ((x)?(t):(f))
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin()) //xi>=v  x is sorted
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin()) //xi>v  x is sorted
#define NUM(x,v) (POSU(x,v)-POSL(x,v))  //x is sorted
#define REV(x) (reverse(x.begin(),x.end())) //reverse
ll gcd(ll a,ll b){if(a<b)swap(a,b);if(a%b==0)return b;return gcd(b,a%b);}
ll lcm(ll a,ll b){ll c=gcd(a,b);return ((a/c)*(b/c)*c);}//saisyo kobaisu
#define NEXTP(x) next_permutation(x.begin(),x.end())
const ll INF=1e18+7;
const ll MOD=1e9+7;


int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	string s;
	cin >> s;
	stack<char> st;
	FOR(i,0,s.size()){
		if(st.empty()){
			st.push(s[i]);
		}else{
			if(st.top()==s[i]){
				st.push(s[i]);
			}else{
				st.pop();
			}
		}
	}
	ll ans = s.size() - st.size();
	cout << ans << endl;
}

Measured memory_bytes: 512
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <queue>
#include <vector>
using namespace std;
using ll = int64_t;
#define rep(i, j, n) for (int i = j; i < (int)n; ++i)

template <typename T>
class convex_hull_trick {
  struct Line {
    T a, b;
    Line(T _a, T _b) : a(_a), b(_b) {}
    T get(T x) { return a * x + b; }
  };
  deque<Line> deq;

  bool check(Line f1, Line f2, Line f3) {
    return (f2.a - f1.a) * (f3.b - f2.b) >= (f2.b - f1.b) * (f3.a - f2.a);
  }

public:
  convex_hull_trick() = default;
  void insert(T a, T b) {
    Line line(a, b);
    while (deq.size() >= 2 && check(*(deq.end() - 2), *(deq.end() - 1), line))
      deq.pop_back();
    deq.push_back(line);
  }

  T query(T x) {
    while (deq.size() >= 2 && deq[0].get(x) >= deq[1].get(x)) deq.pop_front();
    return deq.front().get(x);
  }
};

constexpr ll INFL = 0x3f3f3f3f3f3f3f3fLL;

int main() {
  ll n, c;
  cin >> n >> c;
  vector<ll> h(n);
  for (ll& x : h) cin >> x;

  convex_hull_trick<ll> cht;
  vector<ll> dp(n + 1, INFL);
  dp[0] = 0;
  cht.insert(-2 * h[0], h[0] * h[0]);
  for (int i = 1; i < n; ++i) {
    // iより前の、最も低コストな場所コアラiに飛ぶ
    ll prev = cht.query(h[i]);
    dp[i] = prev + h[i] * h[i] + c;
    cht.insert(-2 * h[i], h[i] * h[i] + dp[i]);
  }
  cout << dp[n - 1] << endl;
  return 0;
}

Measured memory_bytes: 8348
#include <iostream>
 
int main()
{
int N=0;
 
std::cin >> N; 
 
int sum=0;
 
for(int i=1;i<N+1;i++)
{
sum+=800;
if(i % 15 == 0)
sum-=200;
}
 
std::cout << sum << std::endl;
 
return 0;
}

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

// def
#define debug(x) cout << #x << ": " << x << endl
#define out(x) cout << x << endl
typedef unsigned long long ll;
const int M = 1e9 + 7;
const int INF = 1e9;
const int MAX_V = 300 + 5;

// factorization O(sqrt(n))
map<int, int> prime_factor(int n) {
    map<int, int> res;
    for (int i = 2; i * i <= n; i++) {
        while (n % i == 0) {
            ++res[i];
            n /= i;
        }
    }
    if (n != 1) res[n] = 1;
    return res;
}

int MOD = 1e9 + 7;

long modpow(long m, long p) {
    if (p == 0) return 1;
    if (p % 2)
        return m * modpow(m, p - 1) % MOD;
    else {
        long res = modpow(m, p / 2);
        return res * res % MOD;
    }
}

long calcComb(int a, int b) {
    if (b > a - b) return calcComb(a, a - b);
    long mul = 1;
    long div = 1;
    for (int i = 0; i < b; i++) {
        mul *= (a - i);
        div *= (i + 1);
        mul %= MOD;
        div %= MOD;
    }
    long res = mul * modpow(div, MOD - 2) % MOD;
    return res;
}

int main() {
    int n, m;
    cin >> n >> m;
    map<int, int> primes = prime_factor(m);
    ll res = 1;
    for (auto p : primes) {
        if (p.second > 0) {
            int b = p.second;
            res *= calcComb(b + n - 1, b);
            res %= M;
        }
    }
    cout << res << endl;
}


Measured memory_bytes: 256
N = int(raw_input())
A = map(int, raw_input().split())
 
count = [0]*(N+1)
for i in range(N):
    id = A[i]
    count[id] = count[id]+1
 
sumN = long(0)
for i in range(N+1):
    sumN = sumN + long(long(count[i]*(count[i]-1))/2)
 
for i in range(N):
    id = A[i]
    sumz = sumN - (count[id] - 1)
    print(sumz)


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

using namespace std;

#pragma GCC optimize("O3")
static const auto __ = [] {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  return nullptr;
}();

double P[3001], DP[3001][3001];

double solve(int N) {
  for (int i {1}; i <= N; ++i) {
    cin >> P[i];
  }
  DP[0][0] = DP[0][1] = 1;
  for (int t {1}; t <= N; ++t) {
    DP[t][0] = (1 - P[t]) * DP[t - 1][0];
    for (int h {1}; h < t; ++h) {
      DP[t][h] = (1 - P[t]) * DP[t - 1][h] + P[t] * DP[t - 1][h - 1];
    }
    DP[t][t] = P[t] * DP[t - 1][t - 1];
  }
  return accumulate(DP[N] + (N / 2 + 1), DP[N] + N + 1, 0.0);
}

int main(int argc, char* argv[]) {
  int N;
  cin >> N;
  cout << setprecision(9) << solve(N) << '\n';
  return 0;
}

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

int main() {
  string a;
  cin>> a ;
  
  if(a=="a"||a=="i"||a=="u"||a=="e"||a=="o"){
  cout << "vowel" <<endl;
  }
    
  else{
  cout << "consonant" << endl;
  }
  
    

}

Measured memory_bytes: 256