akhauriyash/Code-Regression huggingface dataset:
N = int(input())
m,a,r,c,h = 0,0,0,0,0
for i in range(N):
  s = input()
  if s[0] == "M":
    m += 1
  if s[0] == "A":
    a += 1
  if s[0] == "R":
    r += 1
  if s[0] == "C":
    c += 1
  if s[0] == "H":
    h += 1
A = [m,a,r,c,h]
ans = 0
for i in range(5):
  for j in range(min(i+1,5),5):
    for k in range(min(j+1,5),5):
      ans += A[i]*A[j]*A[k]
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
int dp[3][110];
int a[3][110], n;
int main(void) {
    while(cin >> n) {
        for(int i = 1; i <= 2; ++i)
            for(int j = 1; j <= n; ++j) cin >> a[i][j];
        memset(dp, 0, sizeof dp);
        dp[1][1] = a[1][1];
        for(int i = 1; i <= 2; ++i) {
            for(int j = 1; j <= n; ++j) {
                dp[i][j] = max(dp[i - 1][j], dp[i][j - 1]) + a[i][j];
            }
        }
        printf("%d\n", dp[2][n]);
    }
}


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

#define rep(a,b) for(int a = 0;a < b;a++)
#define REP(i, x, n) for(int i = x; i < n; i++)
#define P(a) cout << a << endl
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
#define ssort(v) sort(v.begin(),v.end())
#define rev(v) reverse(v.begin(),v.end())
#define vP(v) for(int i = 0;i < v.size();i++){cout << v[i];if(i != v.size()-1)cout << endl;}
#define vcin(v,n) rep(i,n){int a;cin >> a;v.pb(a);}

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
int dx[] = { 1, -1 , 0 , 0 };
int dy[] = { 0,  0,  1, -1 };
ll MOD = 1000000007;

void solve(){
	string a,b;
	cin >> a >> b;
	P((a < b ? "<" : a == b ? "=" : ">"));
}

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


Measured memory_bytes: 256
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <assert.h>

using namespace std;

typedef long long ll;

#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define per(i,a,b) for(ll i=b-1LL;i>=(a);--i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(c) string(1,c)
#define print(x) cout<<#x<<" = "<<x<<endl;

#define MOD 1000000007

long long gcd(long long a, long long b){
  return b == 0LL ? a : gcd(b, a % b);
}

long long lcm(long long a, long long b){
  return a / gcd(a, b) * b;
}

int main(){
  ll x;
  cin>>x;
  ll a = lcm(360,x);
  cout << a/x << endl;
  return 0;
}

Measured memory_bytes: 3640
#include <iostream>
#include <string.h>
#include <vector>
using namespace std;
int n;
char c[3005];
const int mod=1e9+7;
int main() {
    vector<vector<int>>dp(3005,vector<int>(3005));
    vector<vector<int>>p(3005,vector<int>(3005));
	scanf("%d %s",&n,c);
	dp[1][1]=1;
	for(int len=2;len<=n;len+=1){
	    for(int b=1;b<len;b+=1){
	        p[len-1][b]=(p[len-1][b-1]+dp[len-1][b])%mod;
	    }
	    for(int b=1;b<=len;b+=1){
	        int l,r;
	        if(c[len-2]=='<'){
	            l=1,r=b-1;
	        }
	        else{
	            l=b,r=len-1;
	        }
	        if(l<=r){
	            dp[len][b]=(dp[len][b]+p[len-1][r]-p[len-1][l-1]+mod)%mod;
	        }
	     }
	}
	int ans=0;
	for(int i=1;i<=n;i+=1){
	    ans=(ans+dp[n][i])%mod;
	}
	printf("%d",ans);
	return 0;
}


Measured memory_bytes: 71040
#include <algorithm>
#include <iostream>
#include <math.h>
#include <cstdio>
#include <string.h>
#include <vector>
#include <functional>
#include <stack>
#include <queue>
#include <string>
#include <list>
using namespace std;
typedef long long ll;
/* prototype */
int EDSum(ll);//各桁の和
vector<int> SOE(int,int);//素数 (Min,Max)
int MinCM(int,int);//最小公倍数(num1,num2)
int MaxCD(int,int);//最大公約数(num1,num2)
vector<int> igets(int);//cin * N
ll nPr(ll,ll); //(n,r)
ll nE(ll); //(n)
ll nCr(ll,ll); //(n,r)

void solve(){
    //START
  	int i;
  	cin >> i;
  	int ans = 0;
  	for(int j = 1;j <= i;++j)ans+=j;
    cout << ans << endl;
}

int main(void){cin.tie(0);ios::sync_with_stdio(false);solve();}
/*FUNC*/
//各桁の和
int EDSum(ll number){
    int ans=0;
    while(1){
        ans += number % 10;
        number /= 10;
        if(number == 0) break;
    }
    return ans;
}

//エラトステネスのふるい(素数発見アルゴリズム)
vector<int> SOE(int min, int max)
{
    //0,1は含まれない
    if (min < 2) min = 2;
    //探索リスト作成
    vector<int> int_array;
    for (int i = min; i <= max; i++) int_array.push_back(i);
    //素数リスト
    vector<int> sosu;
    //√max
    double stop = sqrt(max);
    //計算
    while (true)
    {
        //素数リストに追加
        sosu.push_back(int_array.front());
        int_array.erase(int_array.begin());
        //停止
        if (stop < (double)(sosu.back())) break;
        //ふるい
        for (int i = 0; i < (int)int_array.size(); i++)
        {
            if (int_array[i] % sosu.back() == 0)
                int_array.erase(int_array.begin() + i);
        }
    }
    sosu.insert(sosu.end(), int_array.begin(), int_array.end());
    return sosu;
}

//最小公倍数
int MinCM(int a, int b)
{
    int c = a * b;
//入れ替え
    if (a < b)
        swap(a, b);
    int r = a % b;
    while (r != 0)
    {
        a = b;
        b = r;
        r = a % b;
    }
    return c / b;
}

//最大公約数
int MaxCD(int a, int b)
{
//入れ替え
    if (a < b)
        swap(a, b);
    int r = a % b;
    while (r != 0)
    {
        a = b;
        b = r;
        r = a % b;
    }
    return b;
}
//iget cin int 2 vector
vector<int> igets(int N){
    vector<int> A;
    int temp;
    for (int i = 0; i < N; ++i) {
        cin >> temp;
        A.push_back(temp);
    }
    return A;
}

ll nPr(ll n,ll r) {
    ll ans=1;
    r=n-r;
    while(n!=r) {
        ans*=n;
        --n;
    }
    return ans;
}

ll nE(ll n) {
    return nPr(n,n);
}

ll nCr(ll n,ll r) {
    if(r==0)return -1;
    else{
        if(0!=n-r&&n-r<r)r=n-r;
        return nPr(n,r)/nE(r);
    }
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
    int N,i,max,sum=0;
    int p[100];
    scanf("%d",&N);
    for(i=0;i<N;i++){
        scanf("%d",&p[i]);
        if(i==0)max=p[i];
        sum+=p[i];
        if(max<p[i])max=p[i];
    }
    sum-=max/2;
    printf("%d\n",sum);
}

Measured memory_bytes: 128
//----------BHAVIK DIWANI(PICT_COMP)---------------
#include<bits/stdc++.h>
#include<stdlib.h>
#include<stdio.h>
#define test ll t; cin>>t; while(t--)
#define FOR(p,n) for(ll i=p;i<(ll)n;i++)
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define mod 1000000007
#define ll long long
#define int long long
#define ull unsigned long long
#define MAX 1000005
#define pb push_back
#define mkp make_pair
#define vi vector<int>
#define pii pair<int,int>
#define endl '\n'
#define vs vector<string>
#define mii map<int,int>
#define msi map<string,int>
#define vpii vector< pair<int, int > >
#define vpsi vector< pair< string ,int > >
#define forci(p,q) for(int i=p;i<q;i++)
ll gcd(ll a,ll b){ if(b==0) return a;    return gcd(b,a%b);}
ll lcm(ll a,ll b) { return (a/gcd(a,b)*b);}
ull power(ull a, ull b) {a %= mod;  ull res = 1;  while (b > 0) { if (b & 1) res = res * a % mod;  a = a * a % mod;  b >>= 1; }  return res%mod; }
ll modmul(ll x, ll y){return (x*y)%mod;}
ll modadd(ll x, ll y){return (x+y)%mod;}
ll modsub(ll x, ll y){return (x-y+mod)%mod;}
ll fact[1000007]={0};
void facto() {fact[0]=1;fact[1]=1;for(int i=2;i<100007;i++)fact[i]=(fact[i-1]*i)%mod;}
ll ncr(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(power(fact[r],mod-2)))%mod; res=(res*(power(fact[n-r],mod-2)))%mod; return res;}
ll npr(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(power(fact[n-r],mod-2)))%mod; return res;}
inline long long toint(const std::string &s) {std::stringstream ss; ss << s; long long x; ss >> x; return x;}
inline std::string tostring(long long number) {std::stringstream ss; ss << number; return ss.str();}
inline std::string tobin(long long x) {return std::bitset<63>(x).to_string();}
/*bool prime[MAX];
ull sieve(){memset(prime,true,sizeof(prime));for(ull p=2;p*p<MAX;p++){if(prime[p]==true){for(ull i=2*p;i<MAX;i+=p){prime[i]=false;}}}prime[0]=0;prime[1]=0;
}*/
using namespace std;
void solve()
{
	int k;
	cin>>k;
	string s;
	cin>>s;
	int n=s.length();
	if(n<=k)
		cout<<s<<endl;
	else
	{
		string x=s.substr(0,k);
		cout<<x<<"...";
	}
}
signed main()
{
	fastio;
	solve();
}












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

#define INF (1<<30)

#define Rep0(i, n)  for (int i=0; i<n; i++)
#define Rep1(i, n)  for (int i=1; i<=n; i++)

int F(const int &n, vector<int> c, vector<int> &DP) {
    if (INF!=DP.at(n))
        return DP.at(n);
    int S=INF;
    Rep0(i, c.size())
        if (n>=c.at(i))
            S=min(S, F(n-c.at(i), c, DP)+1);
    DP.at(n)=S;
    return S;
}

int main() {
    int n, m;
    cin >>n >>m;
    vector<int> c(m, 0);
    Rep0(i, m)
        cin >>c.at(i);
    vector<int> DP(n+1, INF);
    DP.at(0)=0;
    cout << F(n, c, DP) <<endl;
    return 0;
}


Measured memory_bytes: 14888
import sys
t = input()

flont = []
back = []

if len(t) == 1:
    flont = [t[0]]
else:
    flont = list(reversed(t[:-1]))
    back = [t[-1]]
q = int(input())
for i in range(q):
    s = input().split()
    if int(s[0]) == 1:
        sw = flont
        flont = back
        back = sw
    else:
        f = int(s[1])
        c = s[2]
        if f == 1:
            flont.append(c)
        else:
            back.append(c)
[sys.stdout.write(i) for i in list(reversed(flont))]
[sys.stdout.write(i) for i in back]
print("")

Measured memory_bytes: 85108
x = int(input())

def prime_check(n):
    f = 3
    while f * f <= n:
        if n % f == 0:
            return False
        else:
            f += 2
    else:
        return True

if x != 2:
    if x % 2 == 0:
        x += 1
    while 1:
        if prime_check(x) == True:
            print(x)
            break
        else:
            x += 2
else:
    print(2)

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

final class Solver {
	static final Solver INSTANCE = new Solver();

	void solve(Iterator<String> sc) {
		int K = Integer.parseInt(sc.next());
		int S = Integer.parseInt(sc.next());
		int sum = 0;
		for (int x = 0; x <= K && x <= S; x++) {
			int remaining = S - x;
			sum += Math.max(Math.min(remaining, K) - Math.max(remaining - K, 0) + 1, 0);
		}
		System.out.println(sum);
	}
}

class Main {
	public static void main(String... args) {
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		Solver.INSTANCE.solve(new Iterator<String>() {
			private StringTokenizer tokenizer;

			public boolean hasNext() {
				return true;
			}

			public String next() {
				if (tokenizer == null || !tokenizer.hasMoreTokens()) {
					try {
						tokenizer = new StringTokenizer(reader.readLine());
					} catch (IOException e) {
						throw new UncheckedIOException(e);
					}
				}
				return tokenizer.nextToken();
			}
		});
	}
}

Measured memory_bytes: 22868
#include <bits/stdc++.h>
char v[1000];
char stiv[1000];
int main() {
    FILE * fi, * fout;
    int i,n;
    //fi = fopen("A.in" ,"r");
    //fout = fopen("A.out" ,"w");
    fi=stdin;
    fout=stdout;
    fscanf(fi,"%d " ,&n);
    fscanf(fi,"%s" ,&v);
    int cnt=-1;
    int b=0,e=0;
    for(i=0;i<n;i++){
       if(cnt>-1){
           if(v[i]==')'&&stiv[cnt]=='(')
             cnt--;
           else{
             stiv[++cnt]=v[i];
             if(v[i]==')')
                b++;
           }
       }
       else{
           stiv[++cnt]=v[i];
           if(v[i]==')')
              b++;
       }
    }
    for(i=0;i<=cnt;i++)
      if(stiv[i]=='(')
        e++;
    for(i=0;i<b;i++)
      fprintf(fout,"(");
    for(i=0;i<n;i++)
       fprintf(fout,"%c" ,v[i]);
    for(i=0;i<e;i++)
       fprintf(fout,")");
    fprintf(fout,"\n");
    //fclose(fi);
    //fclose(fout);
}


Measured memory_bytes: 256
#include<stdio.h>

int fibonacci(int);

int main(){

  int x,y;

  scanf("%d",&x);
  printf("%d\n",fibonacci(x));

  return 0;
}

int fibonacci(int n){

  int i,F[50] ;
  F[0] = 1;
  F[1] = 1;
  for(i = 2 ; i<=n ; i++){
    F[i] = F[i-2] + F[i-1];
}
  return F[n];
}



Measured memory_bytes: 2088
#include <bits/stdc++.h>
#define REP(a, b) for(int a = 0; a < b; a++)
#define FOR(i, a, b) for(int i = a; i <= b; i++)
#define mp make_pair
#define f first
#define s second
#define pb push_back
using namespace std;

typedef long long ll;
typedef pair<int, int> ii;
typedef pair<ll, ll> LL;
typedef vector<int> vi;

const ll INF = 1e9;
const ll MOD = 1e9 + 7;
const int MAXN = 1005;

int n;
pair<LL, LL> A[MAXN];
ll DP[MAXN][MAXN * 10];

ll rek(int pos, int sum) {
	if (sum >= 10001 || pos == n) return 0;
	ll &ret = DP[pos][sum];
	if (ret != -1) return ret;
	ret = rek(pos + 1, sum);
	if (A[pos].f.s >= sum) ret = max(ret, A[pos].s.s + rek(pos + 1, sum + A[pos].s.f));
	return ret; 
}

int main() {
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	ios::sync_with_stdio(0); cin.tie(0);
	cin >> n;
	REP(i, n) {
		cin >> A[i].s.f >> A[i].f.s >> A[i].s.s;
		A[i].f.f = A[i].f.s + A[i].s.f; 
	}
	sort(A, A + n);
	memset(DP, -1, sizeof DP);
	cout << rek(0, 0) << '\n';
}

Measured memory_bytes: 79232
//THIS IS THE AATMANIRBHAR SOLUTION I FOUND..!!!!!

#include<bits/stdc++.h>
using namespace std ;
// #define int double
#define int long long
#define pb push_back
#define mp make_pair
#define F first 
#define S second 
#define P push
#define vvi vector<vector<int>>
#define vi vector<int>
#define vf vector<float>
#define vc vector<char>
#define vs vector<string>
#define pii vector<pair<int, int>> 
#define sz(a) (int)a.size()
#define all(a) a.begin(),a.end()
#define s(v) sort(all(v))
#define rep(i,a,b) for(int i=a;i<b;i++)
#define per(j,a,b) for(int j=a-1;j>=b;j--) 
#define binod ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
const int N = 1e9 + 7 , N1 = 1e7 + 5 ;


void solve()
{
  int n;
  cin>>n;
  vi a(n);
  rep(i,0,n)
  cin>>a[i];
  int sum=0;
  rep(i,0,n-1)
  {
    if(a[i]>a[i+1])
    {
        sum+=a[i]-a[i+1];
        a[i+1]=a[i];
    }
  }
  cout<<sum;
}

signed main(){
    binod;
    int t1=1;  
    // cin>>t1;
    //cout<<fixed<<setprecision(6);
    while(t1--){ 
        solve();
        cout<<endl;
    }    
}
                                                                            
                                                                            //Don't judge me or anyone
                                                                            //this is life, 
                                                                            //not a reality show
                                                                            


Measured memory_bytes: 4744
#include <iostream>
#include<iomanip>
#include <cmath>
#include <climits>
#include <algorithm>
#include <stdio.h>
#include <vector>
#include <queue>
#include <tuple>
#include <map>
#include <list>
#include <string>
#include <numeric>
#include <utility>
#include <cfloat>
#include <set>

using namespace std;

int sqrtN = 512;
struct SqrtDecomposition{
    int N, K;
    vector <long long> data;
    vector <long long> bucketSum;
    
    SqrtDecomposition(int n){
        N = n;
        K = (N + sqrtN - 1) / sqrtN;
        data.assign(N, 0);
        bucketSum.assign(K, 0);
    }

    void add(int x, int y){
        data[x] += y;
        bucketSum[x / sqrtN] += y;
    }

    long long getSum(int x, int y){
        long long ans = 0;
        if(y - x < sqrtN){
            for(int i = x; i < y; i++){
                ans += data[i];
            }
            return ans;
        }
        for(int i = x / sqrtN + 1; i < y / sqrtN; i++){
            ans += bucketSum[i];
        }

        for(int i = x; i < (x / sqrtN + 1) * sqrtN; i++){
            ans += data[i];
        }
        for(int i = y / sqrtN * sqrtN; i < y; i++){
            ans += data[i];
        }
        return ans;
    }
    
};

int main(){
    int n;
    int q;
    cin >> n >> q;
    SqrtDecomposition sq(n);
    for(int i = 0; i < q; i++){
        int com;
        int x;
        int y;
        cin >> com >> x >> y;
        if(com == 0){
            sq.add(x - 1, y);
        } else {
            cout << sq.getSum(x - 1, y) << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 3620
using System;

namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] array = Console.ReadLine().Split(' ');


            int a = int.Parse(array[0]);

            int b = int.Parse(array[1]);

            int max;

            for (max = 0; max < 2; max++)
            {
                if (a < b)
                {
                    max = b;
                    b -= 1;
                    Console.WriteLine(max += b);
                }
                else if(a > b)
                {
                    max = a;
                    a -= 1;
                    Console.WriteLine(max += a);

                }
                else if(a == b)
                {
                    max = b;
                    Console.WriteLine(max += b);
                }
                
                
            }
                  
        }
    }
}


Measured memory_bytes: 13140
import java.util.Scanner;

public class Main {

     static Scanner scanner;

     public static void main(String[] args) {
         scanner = new Scanner(System.in);

         String s=gs();


         StringBuilder sb=new StringBuilder();
         int l=0;
         int r=s.length()-1;
         long ans=0;
         while(r-l>0) {
        	 char ch1=s.charAt(l);
        	 char ch2=s.charAt(r);
        	 if(ch1==ch2) {
        		 l++;
        		 r--;
        	 } else {
        		 if(ch1=='x') {
        			 ans++;
        			 l++;
        		 } else if(ch2=='x') {
        			 ans++;
        			 r--;
        		 } else {
        			 System.out.println(-1);
        			 return;
        		 }
        	 }
         }

         System.out.println(ans);
     }

     // 文字列として入力を取得
     public static String gs() {
          return scanner.next();
     }

     // intとして入力を取得
     public static int gi() {
          return Integer.parseInt(scanner.next());
     }

     // longとして入力を取得
     public static long gl() {
          return Long.parseLong(scanner.next());
     }

     // doubleとして入力を取得
     public static double gd() {
          return Double.parseDouble(scanner.next());
     }
}

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

typedef unsigned long long uLL;
typedef long long int LL;
typedef pair <int,int> pii;
typedef pair <int,pii> piii;
typedef pair <long long,long long> pll;
typedef pair <long long,pll> plll;
const int N = 1e5 + 5;
const int inf = 1e9;
const long long INF = 1e18;
const double PI = acos(-1.0);
const double EPS = 1e-8;
const int MOD = 1000000007;

string s;
int d;
vector <int> V;
int len;
LL dp[ 2*N ][ 2 ][ 105 ];

LL go( int idx , int smaller , int sod  ) {
        if( idx >= len ) return sod%d == 0;
        if( dp[idx][smaller][sod] != -1 ) return dp[idx][smaller][sod];
        LL ret = 0;
        if( smaller ) {
                for( int i = 0; i <= 9; i++ ) {
                        ret += go( idx + 1 , 1 , (sod+i)%d );
                        ret %= MOD;
                }
        }
        else {
                for( int i = 0; i < V[idx]; i++ ) {
                        ret += go( idx + 1 , 1 , (sod+i)%d );
                        ret %= MOD;
                }
                ret += go( idx + 1 , 0 , (sod+V[idx])%d );
                ret %= MOD;
        }
        return dp[idx][smaller][sod] = ret%MOD;
}
LL solve( string s ) {
        V.clear();
        for( int i = 0; i < s.size(); i++ ) V.push_back( s[i]-'0' );
        len = V.size();
        memset( dp , -1 , sizeof( dp ) );
        return go( 0 , 0 , 0 );
}
int main( int argc , char const *argv[] ) {
        ios_base::sync_with_stdio( false ); cin.tie( NULL );
        cin >> s >> d;
        cout << ( solve( s ) - 1 + MOD )%MOD << endl;
        return 0;
}













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

constexpr int mod = 1e9 + 7, lim = 1e3;

bool prime[lim+1];

void init(){
  for(int i=2; i<=lim; i++) prime[i] = true;

  for(int i=2; i<=lim; i++){
    if(prime[i]){
      for(int j=2; i*j <= lim; j++){
        prime[i*j] = false;
      }
    }
  }
}

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

  init(); 

  ll bk[n+1];
  memset(bk, 0, sizeof(bk));

  for(int i=2; i<=n; i++){
    for(int j=2; j <= i; j++){
      int mul = i;
      if(prime[j]){
        while(mul % j == 0){
          mul /= j;
          bk[j]++;
          bk[j] %= mod;
        }
      }
    }
  } 
  
  ll ans = 1;
  for(int i=1; i<=n; i++){
    if(bk[i]){
      ans *= bk[i]+1;
      ans %= mod;
    }
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
n,k = map(int,input().split())
r,s,p = map(int,input().split())
t = [_ for _ in str(input())]
ans = 0
for i in range(n):
  if  i - k < 0:
    if t[i] == "r":
      ans += p
    elif t[i] == "s":
      ans += r
    elif t[i] == "p":
      ans += s
  else:
    if t[i] == "r" and t[i-k] != "r":
      ans += p
    elif t[i] == "s" and t[i-k] != "s":
      ans += r
    elif t[i] == "p" and t[i-k] != "p":
      ans += s
    else:
      t[i] = "a"
print(ans)

Measured memory_bytes: 10032
#include <stdio.h>

int main(void){
    long long int a, b, x;
    scanf("%lld %lld %lld", &a, &b, &x);
    
    if(x == 1){
        printf("%lld\n", b-a+1);
    }else{
        long long int lowerb, upperb = b / x;
        if(a % x == 0){
            lowerb = a / x;
        }else{
            lowerb = a / x + 1;
        }
        //printf("lowerb = %lld, upperb = %lld\n", lowerb, upperb);
        //printf("lowerb*x = %lld, upperb*x = %lld\n", lowerb*x, upperb*x);
        printf("%lld\n", upperb-lowerb+1);
    }
    return 0;
}

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

int main() {
	std::ios_base::sync_with_stdio(false);
	cin.tie(0);
	int k;
	string s;
	cin >> k >> s;
	if (s.size() > k) {
		cout << s.substr(0, k) << "...";
	} else {
		cout << s;
	}
}



Measured memory_bytes: 3612
#include <algorithm>
#include <cmath>
#include <iostream>
#include <vector>
using namespace std;
#define U(v) cerr << #v << ": " << (v) << endl

int main() {
    int n;
    cin >> n;
    vector<int> a(n), b(n), c(n);
    for (int i = 0; i < n; ++i) cin >> a[i];
    for (int i = 0; i < n; ++i) cin >> b[i];
    for (int i = 0; i < n; ++i) cin >> c[i];
    sort(a.begin(), a.end());
    sort(b.begin(), b.end());
    sort(c.begin(), c.end());
    vector<long long> d(n), e(n);
    vector<long long> f(n + 1, 0);
    for (int i = 0; i < n; ++i) {
        e[i] = n - (upper_bound(c.begin(), c.end(), b[i]) - c.begin());
        d[i] = n - (upper_bound(b.begin(), b.end(), a[i]) - b.begin());
    }
    for (int i = 1; i <= n; ++i)
        f[i] = f[i - 1] + e[i - 1];
    long long sm = 0;
    for (int i = 0; i < n; ++i)
        sm += f[n] - f[n - d[i]];
    cout << sm << endl;
    return 0;
}


Measured memory_bytes: 3712
a, b = gets.chomp.split.map(&:to_i)
n = gets.to_i

arr = Array.new(1001)
a.upto(b - 1){|x| arr[x] = true}

ok = true
n.times{
    s, f = gets.chomp.split.map(&:to_i)
    s.upto(f - 1){|x|
        if arr[x]
            ok = false
            break
        end
    }
}
puts ok ? 0 : 1


Measured memory_bytes: 8896
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)

int main(){
    ll N;
    cin >> N;
    vector<ll> A(N);
    rep(i, 0, N) cin >> A[i];
    ll ans = 0;
    rep(i, 0, N){
        if(A[i] % 2 == 1 && i != N-1){
            if(A[i+1] > 0){
                A[i+1]--;
                ans++;
            }
        }
        ans += A[i] / 2;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define SZ(X) ((int)(X).size())
#define endl "\n";
int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);
	int n;
	cin>>n;
	int a,min=10e9+1,max=0;
	for (int i = 0; i < n; ++i)
	{
		cin>>a;
		if(a>max){
			max=a;
		}
		if(a<min){
			min=a;
		}
	}
   cout<<max-min;


   return 0;
}


Measured memory_bytes: 3624
n, m = map(int, input().split())
a = list(map(int, input().split()))
su = 0
num = 0

for i in a:
    su += i

for i in a:
    if i >= su / (4*m):
        num += 1

if m <= num:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3064
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<deque>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<climits>
#define MOD 1000000007
typedef long long ll;
using namespace std;

const int MAX = 55;

// num[i][j] S_iに含まれるj番目のアルファベットの個数
int num[MAX][26];

// mini[i] 全てのSに含まれるi番目のアルファベットの個数
int mini[26];
int main(){
  int n; cin >> n;
  for(int i=0;i<n;i++){
    string s; cin >> s;
    for(int j=0;j<s.size();j++){
      num[i][s[j]-'a']++;
    }
  }

  for(int i=0;i<26;i++) mini[i] = num[0][i];

  for(int i=0;i<26;i++){
    for(int j=0;j<n;j++){
      mini[i] = min(mini[i], num[j][i]);
    }
  }

  for(int i=0;i<26;i++){
    for(int j=0;j<mini[i];j++) cout << (char)('a'+i);
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner sc =  new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
      	if(a>b)
          System.out.println(a+(a-1));
      	else if(b>a)
          System.out.println(b+(b-1));
      	else
          System.out.println(a+b);
      sc.close();
	}
}

Measured memory_bytes: 21716
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FAST ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define ALL(a) a.begin(), a.end()
#define RALL(a) a.rbegin(), a.rend()
#define pb push_back
#define MOD 1000000007
#define sz5 100005
#define sz6 1000005
#define UP upper_bound
#define LB lower_bound
#define F first
#define S second
#define PI pair<int,int>
#define PL pair<ll,ll>
#define VI vector<int>
#define VL vector<ll>


int main() {
    FAST

    // #ifndef ONLINE_JUDGE
    //     freopen("in", "r", stdin);
    //     // freopen("out", "w", stdout);
    // #endif

    int n,k,la,lb;
    cin>>n>>k;
    
    bool mk[k+5]={0};
    mk[0]=false;
    int arr[n+5];
    
    for(la=1;la<=n;la++)
        cin>>arr[la];

    for(la=1;la<=n;la++)
        mk[arr[la]]=true;

    for(la=1;la<=k;la++){
        if(mk[la])
            continue;
        bool cur=true;
        for(lb=1;lb<=n;lb++)
        if(arr[lb]<=la)
            cur=min(cur, mk[la-arr[lb]]);
        
        if(!cur)
            mk[la]=true;
        else
            mk[la]=false;
    }

    if(mk[k])
        cout<<"First"<<endl;
    else
        cout<<"Second"<<endl;
    return 0;
}

Measured memory_bytes: 3776
#include <bits/stdc++.h>
#include <stdint.h>
#include <algorithm>
#include <vector>


using namespace std;

int main() {
	long long a,b;
	long c,d;
	
	cin >> a >> b >> c >> d;
	
	long ac = (long)b/c - (long)(a-1)/c;
	long ad = (long)b/d - (long)(a-1)/d;
	long long lcm = 1;
	long tmp;
	long long x = c * d;
	long tmpc = c;
	long tmpd = d;
	if ( c < d ) {
		tmp = c;
		c = d;
		d = tmp;
	}
	
	/*
	cout << a << ", " << b << ", " << c << ", " << d << endl;
	cout << "ac:" << ac << ", ad:" << ad << endl;
	*/
	
	int r = tmpc % tmpd;
	while(r != 0){
		tmpc = tmpd;
		tmpd = r;
		r = tmpc % tmpd;
	}
	
	
	lcm = x / tmpd;

	long alcm = b/lcm - (a-1)/lcm;
	
	//cout << "alcm:" << alcm << endl;
	
	long long ans = (b-a+1) - ac - ad + alcm;
	
	cout << ans << endl;


	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define endl "\n"
#define ull unsigned long long
#define ALL(v) ((v).begin()), ((v).end())
#define INCREASING(v) sort(ALL(v))
#define DECREASING(v) INCREASING(v), reverse(ALL(v))
#define SZ(v)   ((int)((v).size()))
#define LP(c,x,n)  for(int c=x;c<n;c++)
#define LO(c,n,x)  for(int c=n;c>=x;c--)
#define watch(x) cout << (#x) << " is " << (x) << endl
#define PB push_back
#define F first
#define S second
#define STP(x) setprecision(x)
#define MP make_pair
#define PI ( 2 * acos(0.0))
#define EPS 1e-8
#define INF 1.0/0.0
#define Yala_Besor3a ios_base::sync_with_stdio(0),ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define ReadFile freopen("coins.in","r",stdin);
#define WriteFile freopen("output.txt","w",stdout)
using namespace std;
const int OO = 0x3f3f3f3f,NegOO= -1*OO,N =1050,mod =1e9+7 ;

int main() {
    int n,m;
    cin>>n>>m;
    char arr[n][m];
    LP(c,0,n)LP(i,0,m)cin>>arr[c][i];
    LP(c,0,n+2)
    {
        LP(i,0,m+2)
        {
            if(c==0||i==0||c==n+1||i==m+1)cout<<'#';
            else cout<<arr[c-1][i-1];
        }
        cout<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Main {
    public static void main(String []args)
    {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        Scanner sc = new Scanner(System.in);
        int a=sc.nextInt();
        int b=sc.nextInt();
        System.out.println((a-1)*(b-1));

    }
}


Measured memory_bytes: 22996
"""
AtCoder
    :author: vierbein
"""
from __future__ import absolute_import, division, print_function

# import itertools as it
# import collections
import sys


def pp(*args, **kwargs):
    print(*args, file=sys.stderr, **kwargs)


def get_digits(n):
    res = 0
    while n > 0:
        res += 1
        n //= 10
    
    return res


N = int(input())
digits = get_digits(N)

if digits == 2:
    res = 9
elif digits == 4:
    res = 909
elif digits == 6:
    res = 90909
elif digits == 1:
    res = N
elif digits == 3:
    res = N - 99 + 9
elif digits == 5:
    res = N - 9999 + 909
else:
    res = -1

print(res)

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

using namespace std;
int i;
string s;
bool ans = true;

bool isKaibun(int begin, int end) {
    int m = end - begin;
    m = m%2 ? m/2 : (m+1)/2;
    for (i=0; i<m; i++) {
        if (s[begin+i] != s[end-i-1]) return false;
    }
    return true;
}

int main() {
    cin >> s;
    int n = s.length();
    ans = ans && isKaibun(0, n);
    ans = ans && isKaibun(0, (n-1)/2);
    ans = ans && isKaibun((n+3)/2-1, n);
    if (ans) printf("Yes\n");
    else printf("No\n");
}

Measured memory_bytes: 256
#include<stdio.h>
#define MAX 100000
#define SENTINEL 2000000000

struct Card{
  char suit;
  int value;
};

struct Card L[MAX / 2 + 2],R[MAX / 2 + 2];

void merge(struct Card A[],int n,int left,int mid,int right){
  int i,j,k,n1,n2;

  n1 = mid - left;
  n2 = right - mid;

  for(i = 0;i < n1;i++){
    L[i] = A[left + i];
  }
  
  for(i = 0;i < n2;i++){
    R[i] = A[mid + i];
  }

  L[n1].value = R[n2].value = SENTINEL;
  i = j = 0;
  
  for(k = left;k < right;k++){
    if(L[i].value <= R[j].value){
      A[k] = L[i++];
    }
    else{
      A[k] = R[j++];
    }
  }
}

void mergeSort(struct Card A[],int n,int left,int right){
  int mid;

  if(left + 1 < right){
    mid = (left + right) / 2;
    
    mergeSort(A,n,left,mid);
    mergeSort(A,n,mid,right);
    merge(A,n,left,mid,right);
  }
}

int partition(struct Card A[],int n,int p,int r){
  int i,j;
  struct Card t,x;

  x = A[r];
  i = p - 1;

  for(j = p;j < r;j++){
    if(A[j].value <= x.value){
      i++;
      t = A[i];
      A[i] = A[j];
      A[j] = t;
    }
  }

  t = A[i + 1];
  A[i + 1] = A[r];
  A[r] = t;

  return i + 1;
}

void quickSort(struct Card A[],int n,int p,int r){
  int q;

  if(p < r){
    q = partition(A,n,p,r);
    quickSort(A,n,p,q - 1);
    quickSort(A,n,q + 1,r);
  }
}

int main(){
  int n,i,v,stable = 1;
  struct Card A[MAX],B[MAX];
  char S[10];

  scanf("%d",&n);

  for(i = 0;i < n;i++){
    scanf("%s %d",S,&v);

    A[i].suit = B[i].suit = S[0];
    A[i].value = B[i].value = v;
  }

  mergeSort(A,n,0,n);
  quickSort(B,n,0,n - 1);

  for(i = 0;i < n;i++){
    if(A[i].suit != B[i].suit){
      stable = 0;
    }
  }
  
  if(stable == 1){
    printf("Stable\n");
  }
  else{
    printf("Not stable\n");
  }
  
  for(i = 0;i < n;i++){
    printf("%c %d\n",B[i].suit,B[i].value);
  }
}



Measured memory_bytes: 4068
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>
#include <string>
#include <cstdio>
#include <cstring>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <bitset>

typedef long long ll;
typedef unsigned long long ull;
using namespace std;

#define FALSE printf("false\n");
#define TRUE printf("true\n");
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i = 0;i < ((int)(n));++i)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define test(a) cout<<"line:"<<__LINE__<<"["<<(#a)<<": "<<(a)<<"]"<<endl

const int INF = 1e9+7;
const ll INFL = 9*1e18;
const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };

#define SUM(vec) accumulate(all(vec),0LL) // 配列の中身を全部足す
template<typename T>void print(T&& x){cout<<x<<endl;}// 改行付き出力
ll inline digit(ll num){int tmp = 0;while(num){tmp++;num/=10;}return tmp;} // 桁数
template<typename T>inline T digitSum(T num){T sum = 0;while(num){sum+=num%10;num/=10;}return sum;} // 各桁の和
template<typename T>inline T gcd(T a,T b){if(b == 0)return a;return gcd(b,a%b);} // 最大公約数
template<typename T>inline T lcm(T a, T b){T g = gcd(a,b);return a/g*b;} // 最小公倍数
template<typename T>inline T power(T a,T b){T tmp=1;rep(i,b){tmp*=a;}return tmp;} // 累乗
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
int ctoi(char c){return ('0' <= c && c <= '9')?(c - '0'):-1;}

// TODO: write
int main() {
  ll a,b,c,d;cin>>a>>b>>c>>d;
  a--;
  ll atmp = a - (a/c + a/d - a/lcm(c,d));
  ll btmp = b - (b/c + b/d - b/lcm(c,d));
  ll ans = btmp - atmp;
  print(ans);
  return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>                                           
 
#define int long long
//#pragma GCC optimize("Ofast")
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4")
 
 
#define file(s) freopen(s".in","r",stdin); freopen(s".out","w",stdout);
#define forev(i, b, a) for(int i = (b); i >= (a); --i)
#define forn(i, a, b) for(int i = (a); i <= (b); ++i)
#define all(x) x.begin(), x.end()
#define sz(s) (int)s.size()
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define s second
#define f first
 
 
using namespace std;
 
 
typedef pair < long long, long long > pll;    
typedef pair < int, int > pii;
typedef unsigned long long ull;         
typedef vector < pii > vpii;
typedef vector < int > vi;
typedef long double ldb;  
typedef long long ll;  
typedef double db;                             
 
 
const int dx[] = {1, -1, 0, 0}, dy[] = {0, 0, 1, -1}, block = 555;
const pii base = mp(1171, 3307), Mod = mp(1e9 + 7, 1e9 + 9);
const int inf = 1e9, maxn = 4e5 + 148, mod = 998244353, N = 1e6 + 21;
const db eps = 1e-12, pi = 3.14159265359;
const ll INF = 1e18;


int f[N], rf[N], n, m, k;

int binpow (int a, int n) {	
	int res = 1;
	while (n) {
		if (n % 2)
			res = res * a % mod;
		a = a * a % mod;
		n /= 2;				
	}

	return res;
}



void precalc () {
	f[0] = 1;
	for (int i = 1; i < N; ++i)
		f[i] = f[i - 1] * i % mod;

	rf[N - 1] = binpow(f[N - 1], mod - 2);
	for (int i = N - 2; i >= 0; --i)
		rf[i] = rf[i + 1] * (i + 1) % mod;	
}

int cnk (int n, int k) {
	return f[n] * rf[k] % mod * rf[n - k] % mod;
}


void add (int &x, int y) {  
	x += y;
	if (x < 0)
		x += mod;
	if (x >= mod)
		x -= mod;
}


main () {
	precalc();
	cin >> n >> m >> k;
	int ans = 0;
	for (int x = 0; x <= k; ++x) {
		add(ans, m * binpow(m - 1, n - 1 - x) % mod * cnk(n - 1, n - 1 - x) % mod);		
	}	

	cout << ans << endl;

}


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

#define FOR(i, a, b) for (int i = (a); i < (int)(b); i++)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(a) (a).begin(), (a).end()
#define allg(a) (a).begin(), (a).end(), greater<int>()

using vi = vector<int>;
using vvi = vector<vi>;
using vs = vector<string>;

const int INF = 1001001001;
const int MOD = 1000000007;
const long long INFL = (1LL << 60);
const double EPS = 1e-9;

int main() {
  int N, A, B;
  cin >> N >> A >> B;
  string res = "Draw";

  if ((B - A) % 2 == 1)
    res = "Borys";
  else
    res = "Alice";

  cout << res << endl;
}

Measured memory_bytes: 256
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <queue>
#include <string>
#include <set>
#include <map>
#define REP(i,n) for(ll i = 0; i < (ll)n; i++)
#define INF 1000000000000000
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;

int main(){
  ll d,n; cin >> d >> n;
  ll base;
  switch(d){
    case 0: base = 1; break;
    case 1: base = 100; break;
    case 2: base = 10000; break;
  }
  if(n!=100){
    cout << base * n << endl;
  }else{
    cout << base * 101 << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(){

int i,j,H,W,n,m;
char p[6];

scanf("%d %d",&H,&W);
for(i=0;i<H;i++){
  for(j=0;j<W;j++){
      scanf("%s",p);
 if(p[0]=='s'&&p[1]=='n'&&p[2]=='u'&&p[3]=='k'&&p[4]=='e'){
          n=j;
          m=i;
        }

  }
}

printf("%c%d\n",n+65,m+1);

return 0;
}

Measured memory_bytes: 128
def sums(st, en)
  return (en*(en+1)/2) - (st*(st-1)/2)
end
MOD = 10**9+7

n, k = gets.split.map(&:to_i)

ans = 0
for i in k..(n+1)
  ans = (ans + sums(n-i+1,n) - sums(0, i-1) + 1) % MOD
end
puts ans

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

int main()
{
	int n, k, t, m;

	cin >> n >> k;

	for (int i = 0; i < n; i++) {
		int s;
		cin >> s;
		if (s == 1) {
			t = i + 1;
			break;
		}
	}

	if (k == n)
		m = 1;
	else
		m = (n - 2) / (k - 1) + 1;

	cout << m << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long int ll;
using namespace std;
int check[100100],sum[100100];
int main(){
    check[0] = 1;
    check[1] = 1;
    for(int i=2;i<=100000;i++){
        if(!check[i]){

            for(int j=2;(i*j)<=100000;j++) check[j*i] = 1;
        }
    }
    for(int i=3;i<=100000;i++){
        sum[i] = sum[i-1];
        if(!(i%2)) continue;
        if(!check[i] && !check[(i+1)/2]) sum[i] += 1;
    }
    int q;
    cin >> q;
    for(int i=0;i<q;i++){
        int l,r;
        cin >> l >> r;
        printf("%d\n",sum[r]-sum[l-1]);
    }
    return 0;
}


Measured memory_bytes: 1408
#include <iostream>
#include <string>
#include <vector>
#include<algorithm>
#include <iomanip>
using namespace std;
typedef long long ll;
//定義場所//
int i, j, k, l, m, n;
////////////

int main()
{
	ll N;
	string S;
	cin >> N >> S;
	vector <int> WtoE(N);
	vector <int> EtoW(N);
	WtoE[0] = 0;
	for (i = 1; i < N; i++) {
		if (S[i - 1] == 'W') {
			WtoE[i] = WtoE[i - 1] + 1;
		}
		else {
			WtoE[i] = WtoE[i - 1];
		}
	}
	EtoW[N - 1] = 0;
	for (i = N-2; i >= 0; i--) {
		if (S[i + 1] == 'E') {
			EtoW[i] = EtoW[i + 1] + 1;
		}
		else {
			EtoW[i] = EtoW[i + 1];
		}
	}
	int ans = N;
	for (i = 0; i < N; i++) {
		ans = min(ans, EtoW[i] + WtoE[i]);
	}
	cout << ans;
}

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

#define fi first
#define se second
#define pb push_back
#define mod(n,k) ( ( ((n) % (k)) + (k) ) % (k))
#define forn(i,a,b) for(int i = a; i < b; i++)
#define forr(i,a,b) for(int i = a; i >= b; i--)
#define all(x) (x).begin(), (x).end()

typedef long long ll;
typedef long double ld;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;

int main(){
	ios_base::sync_with_stdio(0); cin.tie(0);
	int N; cin >> N;
	vi A(N);
	forn(i,0,N)cin >> A[i];
	int res = 0;
	forn(i,0,N){
		forn(j,i+1,N){
			forn(k,j+1,N){
				if(A[i] == A[j] || A[i] == A[k] || A[j] == A[k])continue;
				if(A[i]+A[j] > A[k] && A[i]+A[k] > A[j] && A[j]+A[k] > A[i]){
					res++;
				}
			}
		}
	}
	cout << res << '\n';
	return 0;
}
/*
__builtin_mul_overflow(x,y,&x)
-fsplit-stack
*/


Measured memory_bytes: 3648
#include <iostream>
#include <vector>
#include <queue>
#include <map>
#include<numeric>
using namespace std;
using P = pair<int, int>;
#define rep(i,n) for(int i=0; i<(n);i++)
typedef long long ll;


int main(){
    int h, n; cin >> h >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    sort(a.rbegin(), a.rend());
    rep(i,n) h -= a[i];
    if(h <= 0) cout << "Yes" << endl;
    else cout << "No" << endl;
	return 0;
}


Measured memory_bytes: 768
#include<stdio.h>
int main(){

	char s[6];
	int a=0;

	scanf("%s",s);

	for(int i = 0; i <= 6; i++){
		if(s[i] == '1'){
			a = a + 1;
		}
	}

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

	return 0;
}

Measured memory_bytes: 128
<?php
// C
fscanf(STDIN, '%d', $K);
$ans = 0;
for ($i = 1; $i <= $K; $i++) {
    for ($j = $i; $j <= $K; $j++) {
        $gcd[$i][$j] = $gcd[$j][$i] = gcd($i, $j);
    }
}
for ($i = 1; $i <= $K; $i++) {
    for ($j = $i; $j <= $K; $j++) {
        $gij = $gcd[$gcd[$i][$j]];
        for ($k = $j; $k <= $K; $k++) {
            $n = count(array_unique([$i, $j, $k]));
            if ($n === 3) $t = 6;
            elseif ($n === 2) $t = 3;
            else $t = 1;
            $ans += $gij[$k] * $t;
        }
    }
}
echo $ans;

// 最大公約数（2つ）
function gcd($m, $n)
{
    if (!$n) return $m;
    return gcd($n, $m % $n);
}

// 最大公約数（3つ以上）
function gcdAll($arr)
{
    $gcd = $arr[0];
    foreach ($arr as $a) {
        $gcd = gcd($gcd, $a);
    }
    return $gcd;
}

Measured memory_bytes: 18432
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;
const ll INF = 1LL << 60;
const ll MOD = (ll) 1e9 + 7;

int main(){
    ll a, b;
    cin >> a >> b;
    ll g = __gcd(a, b);
    cout << a * b / g << "\n";
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
using ll=long long;
using ld=long double;
#define inf INT_MAX  
const ll infll=1ll*inf*inf;
#define mode 998244353
#define mod 1000000007
const long double PI=3.141592653589793238462643383279502884197169399375105820974944;
#define pb push_back
#define mp make_pair
#define ub upper_bound 
#define lb lower_bound 
#define far(i,a,b) for (ll i = a; i <= b; i++)
#define rev(i,a,b) for (ll i = a; i >= b; i--)
#define all(v) v.begin(),v.end()
#define ff first
#define ss second
#define sz(a) int((a).size())
#define ftr(c,i) for(auto i = begin(c); i != end(c); i++)
#define rtr(c,i) for(auto i = rbegin(c); i != rend(c); i++)
#define pre(c,x) ((c).find(x) != (c).end())
#define cpre(c,x) (find(all(c),x) != (c).end())
#define mll map<ll,ll>
#define vs vector<string>
#define vi vector<int>
#define vl vector<ll>
#define pll pair<ll,ll>
#define pii pair<int,int>
#define vii vector<pii >
#define vll vector<pll >
#define vvl vector<vector<ll> >
#define vvi vector< vector<int > >
#define W(t) while(t --)
#define print(arr) for (auto it = arr.begin(); it != arr.end(); ++it) cout <<(ll)(it-arr.begin()) << ')' <<  *it << ' '; cout << endl;
#define printii(arr) for (auto it = arr.begin(); it != arr.end(); ++it) cout << it->ff<<' '<<it->ss << endl; cout << endl;
#define MID(i,j) ((i)+(j))/2
#define nl '\n' 
#define lcm(a,b) ((a)*(b))/gcd((a),(b))
ll max(ll a,ll b) {return (a>b? a:b);}
ll min(ll a,ll b) {return (a>b? b:a);}
ll gcd(ll a,ll b) {return (b==0)? a:gcd(b,a%b); }
ll gcd(ll a,ll b,ll & x,ll & y) {
    if (a == 0) {
        x = 0;
        y = 1;
        return b;
    }
    ll x1, y1;
    ll d = gcd(b % a, a, x1, y1);
    x = y1 - (b / a) * x1;
    y = x1;
    return d;
}
ll modinv(ll a,ll b){
	ll x,y;
	gcd(a, b, x, y);
	return (x%b + b)%b;
}
ll ceiling(ll a,ll b){ 
        if(a%b==0) return a/b;
        else return a/b+1;
}
ll bpow(ll a,ll b,ll m){
	a%=m;
	ll res=1;
	while(b>0){
		if(b&1) res=(res*a)%m;
		b>>=1;
		a=a*a%m;
	}
	return res;
}
vvl mat_mul(vvl mat1,vvl mat2,ll mod1){
        vvl res(sz(mat1),vl(sz(mat2[0]),0));
        far(i,0,sz(mat1)-1){
                far(j,0,sz(mat2[0])-1){
                        far(k,0,sz(mat1[0])-1){
                                res[i][j]=(res[i][j]+(mat1[i][k]*mat2[k][j])%mod1)%mod1;          
                        }   
        }   
        }   
        return res;
}
vvl mat_exp(vvl mat,ll p,ll mod1){ 
        vvl res(sz(mat),vl(sz(mat[0]),0));
        far(i,0,sz(mat)-1) res[i][i]=1;
        while(p>0){
                if(p&1) res=mat_mul(res,mat,mod1);   
                mat=mat_mul(mat,mat,mod1);
                p>>=1;
        }   
        return res;
}
const int N=1e6+5;
ll n,m,q,t,k,x,y,z;

int main()
{
	cin >> n >> m;
	cout << (3*n+m)/2 << nl;
}


Measured memory_bytes: 256
/* 
chirag11032000
Chirag Thakur
*/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

using ll = long long;
using db = double;
using pii = pair < int, int >;
using pll = pair < ll, ll >;

template < typename T > using OrderedSet = tree < T, null_type, less < T >, rb_tree_tag, tree_order_statistics_node_update >;
template < typename T > using MinPriorityQueue = priority_queue < T, vector < T >, greater < T > >;

#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template < typename Arg1 >
void __f(const char* name, Arg1&& arg1) {
	cerr << name << " : " << arg1 << std::endl;
}
template < typename Arg1, typename... Args >
void __f(const char* names, Arg1&& arg1, Args&&... args) {
	const char* comma = strchr(names + 1, ',');
	cerr.write(names, comma - names) << " : " << arg1 << " | ";
	__f(comma + 1, args...);
}
#else
#define trace(...)
#endif

#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define unique_sort(x) sort(all(x)), x.resize(distance(x.begin(), unique(all(x))))

const db PI = acos(-1);
const ll LINF = LLONG_MAX;
const int INF = INT_MAX, MOD = 1e9 + 7, N = 1e5 + 10;

void test_case();

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	test_case();
	cerr << "Time taken: " << int((clock() * 1000.) / CLOCKS_PER_SEC) << "ms\n";
	return 0;
}

void test_case() {
	int a, b, c;
	cin >> a >> b >> c;
	cout << min(c, b / a) << "\n";
}

Measured memory_bytes: 256
/*
 *  Created on: 24-October-2019
 *      Author: ankur314
 */
#include <bits/stdc++.h>
#define lli long long int
#define li long int
#define db double
#define ldb long double
#define vr vector
#define it iterator
#define fi(i,a,n) for(int i=a;i<n;i++)
#define fli(i,a,n) for(long int i=a;i<n;i++)
#define flli(i,a,n) for(long long int i=a;i<n;i++)
#define pb(n) push_back(n)
#define ppf() pop_front()
#define pii pair<int,int>
#define MOD 1000000007
 
#define debug1(x) cout<<x<<"\n"
#define debug2(x,y) cout<<x<<" "<<y<<"\n"
#define debug3(x,y,z) cout<<x<<" "<<y<<" "<<z<<"\n"
#define debug4(x,y,z,w) cout<<x<<" "<<y<<" "<<z<<" "<<w<<"\n"
 
using namespace std;

int main(){
    ios_base::sync_with_stdio(false);cin.tie(NULL);
    /*freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);*/
    int n; cin>>n;
    lli h[n+1];
    fi(i,1,n+1) cin>>h[i];
    lli dp[n+1];
    dp[0] = dp[1] = 0;
    fi(i,2,n+1) dp[i] = INT_MAX;
    fi(i,2,n+1)
    {
    	dp[i] = min(dp[i], dp[i-1] + abs(h[i] - h[i-1]));
    	if(i-2 > 0) dp[i] = min(dp[i], dp[i-2] + abs(h[i] - h[i-2]));
    }
    cout<<dp[n];
    return 0;
}

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

int main(void)
{
  ll A, B, x;
  cin >> A >> B >> x;
  ll min, max;
  
  min = A / x;
  if (A%x == 0){
    min -= 1;
  }
  max = B / x;
  
  cout << max - min << endl;
  return 0;
}


Measured memory_bytes: 256