akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define ALL(x) (x).begin(), (x).end()
#define REP(i ,n) for(int i = 0; i < (int)(n); i++)
#define pb push_back
typedef vector<int>vint;
typedef vector<ll>vll;
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

int main(){
    int N;
    cin >> N;
    vll A(N);
    cin >> A;
    sort(A.begin(),A.end(),greater<ll>());
    ll ans = A[0];
    int cnt=1;
    for(int i=1; i<N; i++){
        for(int j=0; j<2; j++){
            if(N-1 == cnt){
                cout << ans << endl;
                return 0;
            }
            ans += A[i];
            cnt++;
        }
    }
}

Measured memory_bytes: 4792
// In the name of Allah the Lord of the Worlds.

#include<bits/stdc++.h>

using namespace std;

typedef long long ll;

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

    string ar, br;
    cin >> ar >> br;
    int cnt = 0;
    for(int i=0;i<ar.size();i++){
        cnt+=ar[i]!=br[i];
    }
    cout << cnt << endl;

    return 0;
}


Measured memory_bytes: 3732
#include <iostream>
#include <string.h>
#include <algorithm>
#include <vector>
#include <queue>

using namespace std;
typedef long long ll;
const ll INF=1000000007LL;
typedef pair<int,int> P;
int main() {
	int n,z,w,a[2001];
	cin>>n>>z>>w;
	for(int i=0;i<n;++i)cin>>a[i];
	if(n==1)cout<<abs(a[0]-w)<<endl;
	else cout<<max(abs(a[n-1]-w),abs(a[n-2]-a[n-1]));
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <cmath> 
using namespace std;

int main(){
    int a,b;
    cin >> a >> b;
    if(a+b==15)
        cout << '+' << endl;
    else if(a*b==15)
        cout << '*' << endl;
    else
        cout << 'x' << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
using ll = long long;
using P = pair<int, int>;
#include<algorithm>
#include<math.h>
#include<map>
#include<queue>
// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const int mod = 1000000007;
//const int mod = 998244353;
struct mint {
    ll x; // typedef long long ll;
    mint(ll x = 0) :x((x% mod + mod) % mod) {}
    mint operator-() const { return mint(-x); }
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod - a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this; }
    mint operator+(const mint a) const { return mint(*this) += a; }
    mint operator-(const mint a) const { return mint(*this) -= a; }
    mint operator*(const mint a) const { return mint(*this) *= a; }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const { return pow(mod - 2); }
    mint& operator/=(const mint a) { return *this *= a.inv(); }
    mint operator/(const mint a) const { return mint(*this) /= a; }
};
istream& operator>>(istream & is, const mint & a) { return is >> a.x; }
ostream& operator<<(ostream & os, const mint & a) { return os << a.x; }
int main() {
	int n;
	cin >> n;
	mint ans=1;
	rep(i, n) {
        ans = ans * (i+1);
	}
    cout << ans;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
const int INF=1145141919,MOD=1e9+7;
const long long LINF=8931145141919364364,LMOD=998244353;
inline long long mod(long long n,long long m){return(n%m+m)%m;}
// const int dx[]={1,0,-1,0,1,1,-1,-1},dy[]={0,-1,0,1,1,-1,-1,1};

int main(){
    int a,b,q; cin>>a>>b>>q;
    vector<long long> s(a+4);
    vector<long long> t(b+4);
    s[0]=t[0]=-LINF/2;
    s[1]=t[1]=-LINF/4;
    rep(i,a) cin>>s[i+2];
    rep(i,b) cin>>t[i+2];
    s[a+2]=t[b+2]=LINF/4;
    s[a+3]=t[b+3]=LINF/2;
    while(q--){
        long long ans=LINF;
        long long x; cin>>x;
        // 神社先
            // 神社左
            {
                long long sh=*(lower_bound(all(s),x)-1);
                long long te=LINF;
                // 寺左
                te=*(lower_bound(all(t),sh)-1);
                ans=min(ans,abs(sh-x)+abs(sh-te));
                // 寺右
                te=*lower_bound(all(t),sh);
                ans=min(ans,abs(sh-x)+abs(sh-te));
            }
            // 神社右
            {
                long long sh=*lower_bound(all(s),x);
                long long te=LINF;
                // 寺左
                te=*(lower_bound(all(t),sh)-1);
                ans=min(ans,abs(sh-x)+abs(sh-te));
                // 寺右
                te=*lower_bound(all(t),sh);
                ans=min(ans,abs(sh-x)+abs(sh-te));
            }
        // 寺先
            // 寺左
            {
                long long te=*(lower_bound(all(t),x)-1);
                long long sh=LINF;
                // 神社左
                sh=*(lower_bound(all(s),te)-1);
                ans=min(ans,abs(te-x)+abs(sh-te));
                // 神社右
                sh=*lower_bound(all(s),te);
                ans=min(ans,abs(te-x)+abs(sh-te));
            }
            // 寺右
            {
                long long te=*lower_bound(all(t),x);
                long long sh=LINF;
                // 神社左
                sh=*(lower_bound(all(s),te)-1);
                ans=min(ans,abs(te-x)+abs(sh-te));
                // 神社右
                sh=*lower_bound(all(s),te);
                ans=min(ans,abs(te-x)+abs(sh-te));
            }
        cout<<ans<<endl;
    }
    return 0;
}


Measured memory_bytes: 2944
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#define PI 3.141592653589793
#define MOD 1000000007
//#define DEBUG

char numbers[8];
char op[8];
char ans[16];

//qsort用、昇順
int compare_int(const void *a, const void *b)
{
	return *(int*)a-*(int*)b;
}
//qsort(array, 10, sizeof(int), compare_int)

void search(int opnum)
{
	if(opnum == 3){
		int terms[8], sum=0;
		for(int i=0; i<4; i++){
			terms[i] = numbers[i] - '0';
		}
		sum += terms[0];
		for(int i=0; i<3; i++){
			if(op[i] == '+') sum += terms[i+1];
			else sum -= terms[i+1];
		}

		if(sum == 7){
			int j=1;
			ans[0] = terms[0] + '0';
			for(int i=0; i<3; i++){
				ans[j] = op[i];
				j++;
				ans[j] = terms[i+1] + '0';
				j++;
			}
		}
		return;
	}

	op[opnum] = '+';
	search(opnum+1);
	op[opnum] = '-';
	search(opnum+1);

	return;
}

int main(){
	scanf("%s", numbers);

	search(0);

	printf("%s=7\n", ans);
	
	return 0;
}


Measured memory_bytes: 1720
//marico el que lo lea
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <stdlib.h>
#include <assert.h>
using namespace std;

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

void fastIO() {std::ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);}

#define pb push_back
#define all(obj) obj.begin(), obj.end()
#define ms(obj, val) memset(obj, val, sizeof(obj))
#define ms2(obj, val, sz) memset(obj, val, sizeof(obj[0])*sz)

#define fst first
#define snd second

template<typename T, typename U> inline void mnze(T &x, U y) {if(y < x) x = y;}
template<typename T, typename U> inline void mxze(T &x, U y) {if(x < y) x = y;}

void _scan( int &x ) { scanf("%d",&x); }
void _scan( long long &x ) { scanf("%lld",&x); }
void _scan( double &x ) { scanf("%lf",&x); }
void _scan( char &x ) { scanf(" %c",&x); }
void _scan( char *x ) { scanf("%s",x); }
template<typename T>
void _scan( vector<T> &v ){
	for(int i=0; i<(int)v.size(); i++) _scan(v[i]);
}
void scan() {}
template<typename T, typename... U>
void scan( T& head, U&... tail ) { _scan(head); scan(tail...);}

template<typename T> void _dbg(const char* sdbg, T h)
	{ cerr<<sdbg<<"="<<h<<"\n"; }
template<typename T, typename... U> void _dbg(const char* sdbg, T h, U... t) {
	while(*sdbg != ',')cerr<<*sdbg++;
	cerr<<"="<<h<<","; _dbg(sdbg+1, t...);
}

#ifdef LOCAL
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#define debugv(x) {{cerr<<#x<<" = "; for(auto _i:x) cerr<<_i<<", ";cerr<<"\n";}}
#define debuga(x, sz) {{cerr<<#x<<" = ";for(int _i=0;_i<sz;_i++)cerr<<x[_i]<<", ";cerr<<"\n";}}
#else
#define debug(...) (__VA_ARGS__)
#define debugv(x)
#define debuga(x, sz)
#define cerr if(0)cout
#endif

ll MOD = 1e9+7;

inline ll Msum(ll x){return x;}
template<typename... Rest>
inline ll Msum(ll x, Rest... rest){ return (x + Msum(rest...)) % MOD; }

inline ll Mprod(ll x){return x;}
template<typename... Rest>
inline ll Mprod(ll x, Rest... rest){ return x * Mprod(rest...) % MOD; }

inline ll Mnorm(ll x){ return (x%MOD + MOD) %MOD; }
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////

const int MAXN = 2e5+5;

int n, a[MAXN];
int cnt[MAXN];

ll ways(ll x){
	return x*(x-1)/2;
}

int main(){
	scan(n);
	for(int i=0; i<n; i++){
		scan(a[i]); a[i]--;
		cnt[a[i]]++;
	}
	ll cur = 0;
	for(int i=0; i<n; i++) cur += ways(cnt[i]);
	for(int i=0; i<n; i++){
		cur = cur - ways(cnt[a[i]]) + ways(cnt[a[i]]-1);
		printf("%lld\n", cur);
		cur = cur + ways(cnt[a[i]]) - ways(cnt[a[i]]-1);
	}
}


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

int main() {
    int N;
    cin >> N;
    int sum = 0;
    for (int i = 0; i < N; i++) {
        int l,r;
        cin >> l >> r;
        sum += r - l + 1;
    }
    cout << sum << endl;
}

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

public class Main {
	public static void main(String[] args) {
		FastScanner sc = new FastScanner(System.in);
		String s = sc.next();
		char[] a = s.toCharArray();
		int q = sc.nextInt();
		int check = 0;
		ArrayList<String> front = new ArrayList<>(),
							back = new ArrayList<>();
		if(s.length() == 1) {
			front.add(s);
		}else {
			front.add(String.valueOf(a[0]));
			for(int i = 1; i < a.length; i++) {
				back.add(String.valueOf(a[i]));
			}
		}
		for(int i = 0; i < q; i++) {
			int t = sc.nextInt();
			if(t == 1) {
				check++;
			}else{
				int f = sc.nextInt();
				String x = sc.next();
				if((f== 1 && check % 2 == 0) || (f == 2 && check % 2 != 0)) {
					front.add(x);
				}else {
					back.add(x);
				}
			}
		}
		if(check % 2 == 0) {
			for(int i = front.size()-1; i >= 0; i--) {
				System.out.print(front.get(i));
			}
			for(String st : back) {
				System.out.print(st);
			}
		}else {
			for(int i = back.size()-1; i >= 0; i--) {
				System.out.print(back.get(i));
			}
			for(String st : front) {
				System.out.print(st);
			}
		}
	}
	
	static class FastScanner {
		private BufferedReader reader = null;
	    private StringTokenizer tokenizer = null;
	    public FastScanner(InputStream in) {
	        reader = new BufferedReader(new InputStreamReader(in));
	        tokenizer = null;
	    }

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

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

	        return tokenizer.nextToken("\n");
	    }

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

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

	    public double nextDouble() {
	         return Double.parseDouble(next());
	     }

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

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


Measured memory_bytes: 77204
//
// Dinic's maximum flow
// 
// Description:
//   Given a directed network G = (V, E) with edge capacity c: E->R.
//   The algorithm finds a maximum flow. 
//
// Algorithm:
//   Dinic's blocking flow algorithm.
//
// Complexity:
//   O(n^2 m), but very fast in practice.
//   In particular, for a unit capacity graph, 
//   it runs in O(m min{m^{1/2}, n^{2/3}}).
// 
// Verified:
//   SPOJ FASTFLOW
//
// Reference:
//   E. A. Dinic (1970):
//   Algorithm for solution of a problem of maximum flow in networks with power estimation.
//   Soviet Mathematics Doklady, vol. 11, pp. 1277-1280.
//
//   B. H. Korte and J. Vygen (2008):
//   Combinatorial Optimization: Theory and Algorithms.
//   Springer Berlin Heidelberg. 
//

#include <iostream>
#include <vector>
#include <cstdio>
#include <queue>
#include <algorithm>
#include <functional>

using namespace std;

#define fst first
#define snd second
#define all(c) ((c).begin()), ((c).end())

const long long INF = (1ll << 50);
struct Dinic {
  typedef long long flow_type;
  struct edge {
    int src, dst;
    flow_type capacity, flow;
    size_t rev;
  };
  int n;
  vector<vector<edge>> adj;
  Dinic(int n) : n(n), adj(n) { }
  void add_edge(int src, int dst, flow_type capacity) {
    adj[src].push_back({src, dst, capacity, 0, adj[dst].size()});
    adj[dst].push_back({dst, src, 0, 0, adj[src].size()-1});
  }
  flow_type max_flow(int s, int t) {
    vector<int> level(n), iter(n);
    function<int(void)> levelize = [&]() { // foward levelize
      level.assign(n, -1); level[s] = 0;
      queue<int> Q; Q.push(s);
      while (!Q.empty()) {
        int u = Q.front(); Q.pop();
        if (u == t) break;
        for (auto &e: adj[u]) {
          if (e.capacity > e.flow && level[e.dst] < 0) {
            Q.push(e.dst);
            level[e.dst] = level[u] + 1;
          }
        }
      }
      return level[t];
    };
    function<flow_type(int, flow_type)> augment = [&](int u, flow_type cur) {
      if (u == t) return cur;
      for (int &i = iter[u]; i < adj[u].size(); ++i) {
        edge &e = adj[u][i], &r = adj[e.dst][e.rev];
        if (e.capacity > e.flow && level[u] < level[e.dst]) {
          flow_type f = augment(e.dst, min(cur, e.capacity - e.flow));
          if (f > 0) {
            e.flow += f;
            r.flow -= f;
            return f;
          }
        }
      }
      return flow_type(0);
    };
    for (int u = 0; u < n; ++u) // initialize
      for (auto &e: adj[u]) e.flow = 0;

    flow_type flow = 0;
    while (levelize() >= 0) {
      fill(all(iter), 0);
      for (flow_type f; (f = augment(s, INF)) > 0; )
        flow += f;
    }
    return flow;
  }
};


int main(){

    int n, m; cin >> n >> m;
    Dinic g(n);
    for(int i = 0; i < m; i++){
        int u, v, c; cin >> u >> v >> c;
        g.add_edge(u, v, c);
        //g.add_edge(u - 1, v - 1, c);
    }
    
    cout << g.max_flow(0, n - 1) << endl;
    
    return 0;
}


Measured memory_bytes: 3256
package main

import (
	"fmt"
)

func main() {
	var a,b,c,d int
	fmt.Scan(&a,&b,&c,&d)
	
	areaAB := a * b
	areaCD := c * d
	
	if areaAB >= areaCD {
		fmt.Println(areaAB)
	} else {
		fmt.Println(areaCD)
	}
}

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

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

    int n;
    cin >> n;

    int res = 0;
    map<int, int> mp;
    vector<int> idx(n, -1);
    rep(i, n){
        int a;
        cin >> a;
        --a;
        if(idx[a] == i) ++res;
        idx[i] = a;
    }
    cout << res << endl;

    return 0;
}

Measured memory_bytes: 640
w_r, h_u, n = map(int, input().split())
xya = []
for i in range(n): xya.append(list(map(int, input().split())))

w_l = 0
h_l = 0
for x in xya:
    if x[2] == 1:
        w_l = max(x[0], w_l)
    elif x[2] == 2:
        w_r = min(x[0], w_r)
    elif x[2] == 3:
        h_l = max(x[1], h_l)
    else:
        h_u = min(x[1], h_u)

print(max((max(w_r-w_l, 0))*max((h_u-h_l), 0), 0))
        


Measured memory_bytes: 3064
# -*- coding: utf-8 -*-
# abc142/abc142_b
import sys

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [i2s() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

def main():
    N,K = i2nn()
    h = i2nn()
    print(len([x for x in h if x >= K]))
    return

main()


Measured memory_bytes: 12280
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize ("Ofast")
#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
 
 
#include <iostream>
#include <iomanip>
#include <sstream>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <set>
#include <map>
#include <valarray>
#include <iterator>
#include <functional>
#include <limits>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <cassert>
#include <unordered_map>
#include <unordered_set>
#include <stack>
using namespace std;
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
 
typedef int64_t ll;
 
#define endl '\n'
#define int ll
ll mod=1e9+7;
ll mod1=1e9+5;
ll power(ll a,ll b)
{
    if(b==0) return 1;
    else if(b%2==0)
        return power((((a%mod)*(a%mod))%mod),b/2)%mod;
    else return ((a%mod)*(power((((a%mod)*(a%mod))%mod),b/2)%mod))%mod;
}
ll mat[60][60];
void mult(ll mat1[60][60],ll mat2[60][60])
{

    ll res[51][51];
     for (int i = 0; i <= 50; i++) 
    { 
        for (int j = 0; j <=50; j++) 
        { 
            res[i][j] = 0; 
            for (int k = 0; k <=50; k++) 
                res[i][j]=(res[i][j]%mod +(mat1[i][k]%mod * mat2[k][j]%mod)%mod)%mod; 
        } 
    }
    for(int i=0;i<=50;++i)
    {
        for(int j=0;j<=50;++j)
            mat[i][j]=res[i][j];
    }
}
void expo(ll k)
{
    if(k==1)
        return ;
    else if(k%2==0)
    {
            mult(mat,mat);
            expo(k/2);
    }
    else
    {
        ll temp[60][60];
        for(int i=0;i<=50;++i)
            for(int j=0;j<=50;++j)
                temp[i][j]=mat[i][j];
            mult(mat,mat);
            
            expo(k/2);   
            mult(temp,mat);
    }
}
int32_t main()
{
    IOS
     
    

    int n,k;
    cin>>n>>k;
    memset(mat,0,sizeof(mat));
    for(int i=1;i<=n;++i)
    {
        for(int j=1;j<=n;++j)
            cin>>mat[i][j];
    }
    expo(k);
    int ans=0;
    for(int i=1;i<=n;++i)
    {
        for(int j=1;j<=n;++j)
            ans+=mat[i][j],ans%=mod;
    }
    cout<<ans;

}



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

#define int long long
#define double long double

using namespace std;

#define REP(i, a, b) for (int(i) = (a); i < (b); (i)++)
#define rep(i, n) REP(i, 0, n)
#define PER(i, a, b) for (int(i) = (a - 1); i >= (b); (i)--)
#define per(i, n) PER(i, n, 0)
#define each(i, n) for (auto &i : n)
#define clr(a) memset((a), 0, sizeof(a))
#define mclr(a) memset((a), -1, sizeof(a))
#define all(a) (a).begin(), (a).end()
#define dum(val) cerr << #val " = " << val << " ";
#define dump(val) cerr << #val " = " << val << endl;
#define FILL(a, v) fill(a, a + sizeof(a) / sizeof(*a), v)

typedef pair<int, int> P;
typedef tuple<int, int, int> T;

const int mod = 1e9 + 7;
const int INF = 1e9;

signed main() {
	map<int, int> mp;
	int n;
	cin >> n;
	rep(i, n) {
		int a;
		cin >> a;
		mp[a]++;
	}

	int cost = 0;
	each(i, mp) {
		if (i.first <= i.second) {
			cost += i.second - i.first;
		} else {
			cost += i.second;
		}
	}
	cout << cost << endl;

	return 0;
}


Measured memory_bytes: 6272
# coding: utf-8
# Your code here!

import math

a,b,h,m=map(int,input().split())
h=(h+1/60*m)*5
#print(h)
if(h>m):
    d=h-m
else:
    d=m-h
d*=6
c=a**2+b**2-2*a*b*math.cos(math.radians(d))
print('{:.23f}'.format(c**(1/2)))


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

int main(){
    int N, idx ;
    cin >> N ;
    vector <int> A(N);
    rep(i,N-1){
        cin >> idx ;
        A[idx-1]++ ;
    }
    rep(i,N) cout << A[i] << endl;
}

Measured memory_bytes: 4044
use proconio::*;

const K: i64 = 10;

fn main() {
    input! {
        d: usize,
        c: [i64; 26],
        s: [[i64; 26]; d],
    };

    let mut score = 0;
    let mut lasts = [-1; 26];
    let mut t = vec![26; d];
    let depth = 2;
    for i in 0..d {
        let mut max_score = -10000000;
        for j in 0..26 {
            let tmp = search(i, j, &c, &s, &mut lasts, depth, d, 0);
            if tmp > max_score {
                max_score = tmp;
                t[i] = j;
            }
        }
        score += max_score;
        lasts[t[i]] = i as i64;
    }

    for &a in &t {
        println!("{}", a + 1);
    }
}

fn calc_score(i: usize, j: usize, c: &Vec<i64>, s: &Vec<Vec<i64>>, lasts: &mut [i64; 26]) -> i64 {
    let mut res = s[i][j];
    let tmp = lasts[j];
    lasts[j] = i as i64;

    for j in 0..26 {
        let i = i as i64;
        let last = lasts[j];
        res -= c[j] * (i - last + K);
    }

    lasts[j] = tmp;
    res
}

fn search(
    i: usize,
    t: usize,
    c: &Vec<i64>,
    s: &Vec<Vec<i64>>,
    lasts: &mut [i64; 26],
    depth: usize,
    d: usize,
    cscore: i64,
) -> i64 {
    if depth == 0 || i == d - 1 {
        return calc_score(i, t, &c, &s, lasts) + cscore;
    }

    let mut max_score = -1000000;
    let tmp_last = lasts[t];
    lasts[t] = i as i64;
    let tmp_score = calc_score(i, t, &c, &s, lasts);
    for j in 0..26 {
        let tmp = search(i + 1, j, &c, &s, lasts, depth - 1, d, cscore + tmp_score);

        if tmp > max_score {
            max_score = tmp;
        }
    }

    lasts[t] = tmp_last;
    max_score + cscore
}


Measured memory_bytes: 2332
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <complex>
#include <math.h>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<long, long> PLL;
typedef long long LL;
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(long i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

const double EPS = 1e-9;
const double INF = 1e9;




int main(){
	double w;
	string res[]={"light fly","fly","bantam","feather","light","light welter","welter","light middle","middle","light heavy","heavy"};
	double we[]={48.00,51.00,54.00,57.00,60.00,64.00,69.00,75.00,81.00,91.00,INF};
	while(cin>>w){
		int cnt=0;
		REP(i,11){
			if(w<=we[i]+EPS){
				cnt=i;
				break;
			}
		}
		cout<<res[cnt]<<endl;
	}
	
	return 0;
}
/*

*/

Measured memory_bytes: 1228
#include<stdio.h>
#include<string.h>
int main()
{
	int input;
	scanf("%d",&input);
	if(input>=2800)
	{
		printf("AGC\n");
	}
	else if(input>=1200)
	{
		printf("ARC\n");
	}
	else printf("ABC");
}

Measured memory_bytes: 256
//#pragma warning(disable:4996)
//#pragma comment(linker, "/STACK:336777216")
//#pragma GCC optimize("Ofast")

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

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
#define int long long int
typedef complex<long double> cd;
const long double pi=acos(-1);
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <db, db> pdd;
typedef vector<int> vi;
typedef vector<vector<int> > matrix;

#define m1 make_pair
#define pb push_back
#define flush fflush(stdout)
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);
#define reset(x,v) memset(x,v,sizeof(x))

#define fi first
#define se second
#define endl "\n"
#define debug(x) (cerr << #x << ": " << x << "\n")
#define setbits(x) __builtin_popcount(x)
#define setbitsll(x) __builtin_popcountll(x)
#define all(x) x.begin(),x.end()
#define pii pair<int,int>

inline ll gcd(ll a,ll b){if(a==0) return b;return gcd(b%a,a);}
inline ll power(ll a,ll n,ll m){if(n==0)return 1;ll p=power(a,n/2,m);p=(p%m*p%m)%m;if(n%2) return (p%m*a%m)%m;else return p;}
const double EPS = 1e-9;
const ll MOD =998244353;
const ll hell=1000000000;
const int INF = 1e17;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
template<typename T>
using ordered_set=tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

auto seed = chrono::high_resolution_clock::now().time_since_epoch().count();
std::mt19937 rng(seed);

double startTime;
double getCurrentTime() {
    return ((double)clock() - startTime) / CLOCKS_PER_SEC;
}
const int dx[] = { -1, 0, 1, 0 };
const int dy[] = { 0, 1, 0, -1 };

const int N=200005;

void solve()
{
    ldb r;
    cin>>r;
    ldb c=(ldb)22/7;
    c=2.0*c*r;
    cout<<setprecision(10);
    cout<<c<<endl;
}


int32_t main()
{
    IOS;
    int t;
    t=1;
    // cin>>t;
    while(t--)
    {
        
        solve();
    }
    return 0;
}


Measured memory_bytes: 3812
#include <bits/stdc++.h>
 
using namespace std;
 
int main(){
	int N;
	int M;
	int i;
 
	cin >> N >> M;
	int p[M];
	string S[M];
	bool ok[N+1]={};
	int numofp[N+1]={};

	for(i =0;i<M;i++){
		cin >> p[i] >> S[i];
	}

	for(i=0;i<M;i++){
		if(S[i]=="AC"){
			ok[p[i]] = true;
		}else{
			if(ok[p[i]]==false){
				numofp[p[i]]++;
			}
		}
	}

	int numofok=0;
	int sumofp=0;
	for(i=1;i<=N;i++){
		if(ok[i]==true){
			sumofp+=numofp[i];
			numofok++;
		}
	}

	cout << numofok << " " << sumofp;


	return 0;
}

Measured memory_bytes: 6528
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
using vll = vector<vl>;
using Pll = pair<ll, ll>;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(v) v.begin(), v.end()
#define sz(x) ((int) x.size())
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define F first
#define S second
const int MOD = 1e9+7;
const ll INF = 2e15;
template<class T> void print(const T& t){ cout << t << endl; }
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 gcd(int a,int b){return b?gcd(b,a%b):a;}

int main(){
  ll n;
  cin >> n;
  ll m = n % 1000;
  if(m==0){
    print(0);
  }
  else{
    print(1000 - m);
  }
}

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

int main()
{
    int x,y;

    cin >> x >> y;

    int j = 0;
    for (int i = x; i >= 0 ; i--)
    {
        if ((i*2 + j*4) == y)
        {
            cout << "Yes" << endl;
            return 0;
        }
    j++;
    }

    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3636
import java.util.Arrays;
import java.util.Map;
import java.util.Scanner;
import java.util.TreeMap;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String n = sc.next();
		if(n.contentEquals("A")) {
			System.out.println("T");
		}else if(n.contentEquals("T")) {
			System.out.println("A");
		}else if(n.contentEquals("C")) {
			System.out.println("G");
		}else {
			System.out.println("C");
		}
		//System.out.println(ans);
		sc.close();
	}
}



Measured memory_bytes: 22868
#include <iostream>

using namespace std;

int main(void) {
  int n;
  int taro_cnt = 0, hanako_cnt = 0;
  string taro,hanako;
  cin >> n;
  for(int i = 0; i < n; i++) {
    cin >> taro >> hanako;
    if(taro > hanako)
      taro_cnt += 3;
    else if(taro < hanako)
      hanako_cnt += 3;
    else {
      taro_cnt += 1;
      hanako_cnt += 1;
    }
  }
  cout << taro_cnt << ' ' << hanako_cnt << endl;
  return 0;
}

Measured memory_bytes: 3120
var=input()
var=var.split()
a=int(var[0])
b=int(var[1])
if(-1000<a<1000 and -1000<b<1000):
    if(a>b):
        print("a > b")
    elif(a<b):
        print("a < b")
    else:
        print("a == b")


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


int main(){

    int N, A[100];
    cin >> N;
    for( int i = 0; i < N; i++ ) cin >> A[i];


    int diff = 0;
    for( int i = 0; i < N; i++ ){
        for( int j = 0; j < N; j++ ){
            diff = max( diff, abs(A[i] - A[j]) );
        }
    }
    
    cout << diff << endl;

    return 0;

}

Measured memory_bytes: 256
# include <bits/stdc++.h>
# define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
# define reps(i, n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
# define rrep(i, n) for(int i=((int)(n)-1); i>=0; --i)
# define rreps(i, n) for(int i=((int)(n)); i>0; --i)
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
# define optimize_cin() cin.tie(0); ios::sync_with_stdio(false)
# define MSG(x) std::cout << #x << " : " << x << "\n";
using namespace std;
using lint = long long;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

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

    for (int i = 0; i < 5; ++i)
    {
        cout << s[i];
    }
    cout << " ";
    for (int i = 5+1; i < 5+7+1; ++i)
    {
        cout << s[i];
    }
    cout << " ";
    for (int i = 5+7+2; i < 5+7+5+2; ++i)
    {
        cout << s[i];
    }
    cout << "\n";

    return 0;
}


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

int main() {
  int a, b, c, k;
  cin >> a >> b >> c >> k;
  
  for (int i = 0; i < k; i++) {
    if (b <= a)
      b *= 2;
    else if (c <= b)
      c *= 2;
  }
  
  if (c > b && b > a)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

Measured memory_bytes: 3592
#include <iostream>
#include <cstdio>
#include <vector>
#include <stack>
#include <math.h>

using namespace std;

typedef long long int ll;
typedef long double ld;

#define rep(i,n) for(int i = 0; i < (n); ++i)
#define vsort(a) sort(a.begin(), a.end())
#define rev(a) reverse(a.begin(), a.end())


// a,bの最小公倍数
ll LCM(ll a, ll b){ll lcm = a * b; ll r = a % b;while(r != 0){a = b; b = r; r = a % b;}return lcm /= b;}
// a,bの最大公約数
ll GCD(ll a, ll b){ll r = a % b;while(r != 0){a = b; b = r; r = a % b;}return b;}


const int MOD = 1000000007;
const int INF = INT_MAX;



int main(){



    int n;
    cin >> n;
    ll a[n];
    rep(i,n) cin >> a[i];

    int cnt = 0;
    rep(i,n){
        if (a[i]%2 == 1) cnt++;
    }

    if (cnt%2 == 0) cout << "YES" << endl;
    else cout << "NO" << endl;

    




}





//              g++ -std=c++1z


Measured memory_bytes: 1400
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,-1,sizeof(x))
const int INF = 1000000001;

int main(){
  rep(i, 3){
    char a;
    cin >>a;
    if(a=='1') printf("9");
    else printf("1");
  }
  printf("\n");
}

Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <algorithm>
#include <vector>
using namespace std;

void solve();

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

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

long long X, Y;
void solve() {
	cin >> X >> Y;
	long long count = 1;
	while (Y >= 2*X) {
		X *= 2;
		count++;
	}
	cout << count << endl;
	return;
}

Measured memory_bytes: 256
Sd=input()
T=input()


i=len(Sd)-len(T)
j=0
ans=[]
flag=False
while(1):
    if i<0:
        #print('not find')
        break
    #print('searching',i,j,Sd[i],T[j])
    if Sd[i]==T[j] or Sd[i]=='?':
        #print('find',i,j,Sd[i],T[j])
        if j==len(T)-1:
            ans.append((Sd[:i-j]+T+Sd[i-j+len(T):]).replace('?','a'))
            i-=j+1
            j=0
            flag=True
            continue
        j+=1
        i+=1
    else:
        i-=j+1
        j=0

if flag:
    ans.sort()
    print(ans[0])
else:
    print('UNRESTORABLE')

Measured memory_bytes: 3064
#include <algorithm>
#include <cmath>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
const int INT_INF = 500000000;
const long long LONG_LONG_INF = (long long)pow(10, 18);
const int MOD = pow(10, 9) + 7;
/* contest template */
int n;
long long fib[45];

int main() {
  cin >> n;
  fib[0] = 1;
  fib[1] = 1;
  for (int i = 2; i <= 44; i++) {
    fib[i] = fib[i - 1] + fib[i - 2];
  }
  cout << fib[n] << endl;
  return 0;
}


Measured memory_bytes: 3084
def cut(h,w):
    d = 10 ** 9
    for i in range(1,h):
        s1 = i * w
        hh = h - i
        if hh > 1:
            j = hh // 2
            s2 = j * w
            s3 = (hh - j) * w
            smax = max(s1,s2,s3)
            smin = min(s1,s2,s3)
            if smax - smin < d:
                d = smax - smin
        
        if w >= 2:
            k = w // 2
            s2 = k * hh
            s3 = (w - k) * hh
            smax = max(s1,s2,s3)
            smin = min(s1,s2,s3)
            if smax - smin < d:
                d = smax - smin
    return d

x,y = map(int,input().split())
ans1 = cut(x,y)
ans2 = cut(y,x)
print(min(ans1,ans2))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define int long long
#define pb push_back
#define sz(i) (int)(i.size())
#define F first
#define S second
#define L long double
#define P pair<int, int>
const int inf = 0x3f3f3f3f3f3f3f3LL;
const int mod = (int)1e9 + 7;
using namespace std;
#if LOCAL
#include "../../tr.h"
#else
#define tr(...)
#define endl '\n'
#endif
template<class T> void smin(T& a, T val) {if (a > val) a = val;}template<class T> void smax(T& a, T val) {if (a < val) a = val;}
const int N = 1e3 + 100;

int n, a[N][N], ptr[N];
int days;

int32_t main(){_

   cin>>n;
      
   for (int i = 1; i <= n; ++i)
   {
      for (int j = 0; j < n-1; ++j)
      {
         cin >> a[i][j];
      }
   }

   int ans = 0;
   while(1){

      vector<int> nxt(n+1);

      for (int i = 1; i <= n; ++i)
      {
         tr(i, ptr[i]);
         nxt[i] = a[i][ptr[i]];
      }

      vector<int> visited(n+1);
      int cnt = 0;
      for (int i = 1; i <= n; ++i)
      {
         if(visited[i])
            continue;
         tr(i, nxt[i], nxt[nxt[i]]);
         if(nxt[nxt[i]] == i){
            cnt++;
            visited[i] = 1;
            visited[nxt[i]] = 1;
            ptr[i]++;
            ptr[nxt[i]]++;
         }
      }

      ans++;

      bool good = 1;
      for (int i = 1; i <= n; ++i)
      {
         good &= ptr[i] == n-1;
      }

      if (good){
         break;
      }

      if (cnt == 0){
         cout<<-1;
         exit(0);
      }
   }

   cout<<ans;

   return 0;
}

Measured memory_bytes: 8832
#include <iostream>
#include <queue>
#include <vector>
#include <functional>

using namespace std;

const int INF = 10000000;

int city[101][101];

int solve( int s, int d, int c, int n ){
	int dist[11][101];
	int history[101];

	for( int i = 0;i < 11;i++ ){
		for( int j = 1;j < 101;j++ ){
			dist[i][j] = INF;
		}
	}

	for( int i = 1;i < 101;i++ ){
		history[i] = 0;
	}

	for( int i = 0;i < 11;i++ ) dist[i][s] = 0;

	typedef pair<int,int> data;
	typedef pair<int,data> graph;
	priority_queue<graph,vector<graph>,greater<graph> > q;

	q.push( graph( 0, data( s, c ) ) );

	while( !q.empty() ){
		graph a = q.top();
		int u = a.second.first;
		int uc = a.second.second;
		q.pop();
		history[u] = 1;

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

			if( dist[uc][i] > dist[uc][u] + city[u][i] ){
				dist[uc][i] = dist[uc][u] + city[u][i];
				q.push( graph( dist[uc][i], data( i, uc ) ) );
			}

			if( uc && dist[uc - 1][i] > dist[uc][u] + city[u][i] / 2 ){
				dist[uc - 1][i] = dist[uc][u] + city[u][i] / 2;
				q.push( graph( dist[uc - 1][i], data( i, uc - 1 ) ) );
			}
		}
	}
	int answer = INF;
	for( int i = 0;i < 11;i++ ) answer = min( dist[i][d], answer );
	return answer;

}

int main(int argc, char const* argv[])
{
	int c,n,m,s,d;

	while( cin >> c >> n >> m >> s >> d && c != 0 ){
		int a,b,f;
		for( int i = 1;i < 101;i++ ){
			for( int j = 1;j < 101;j++ ){
				city[i][j] = INF * 2;
			}
		}
		for( int i = 0;i < m;i++ ){
			cin >> a >> b >> f;
			city[a][b] = f;
			city[b][a] = f;
		}

		cout << solve( s, d, c, n ) << endl;
	}

	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
int n;
long long k;
long long a[105];
int main()
{
    int no_of_moves, no_of_stones;
    cin >> no_of_moves >> no_of_stones;

    vector <int> move(no_of_moves + 1);
    for(int i = 1; i <= no_of_moves; i++)
        cin >> move[i];

    vector <int> winner(no_of_stones + 1, 2);
    for(int i = 1; i <= no_of_stones; i++)
    {
        for(int j = 1; j <= no_of_moves; j++)
        {
            if(move[j] > i) continue;

            if(winner[i - move[j]] == 2)
                winner[i] = 1;
        }
    }

    cout << (winner[no_of_stones] == 1 ? "First\n" : "Second\n");
    return 0;
}


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

int main() {
	int D, N; 
	int S = 1;

	cin >> D >> N;

	for (int i = 0; i < D; i++) S *= 100;
	if (N <= 99) {
		cout << S * N << endl;
	}
	else {
		cout << S * 101 << endl;
	}
	return 0;
}

Measured memory_bytes: 256
n = int(input())
h = list(map(int, input().split()))


h[0] -= 1
for i in range(0, n-1):
    if h[i] <= h[i+1] -1:
        h[i+1] -= 1
    elif h[i] > h[i+1]:
        print('No')
        break
else:
    print('Yes')

Measured memory_bytes: 14396
#include <assert.h>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <algorithm>
#include <numeric>
#include <functional>
#include <iostream>
#include <string>
#include <array>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <complex>
#include <bitset>
typedef long long ll;
typedef unsigned long long ull;

# define INF 0x3f3f3f3f

#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define DEBUG(vec) for (auto v : vec) { cout << v << " "; } cout << endl;

using namespace std;

ll a[10010] = {};

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

  int N;
  cin >> N;
  ll ans = 0;
  REP(i, N) {
    ll a;
    cin >> a;
    while (a % 2 == 0) {
      a /= 2;
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
k = gets.chomp.to_i

def is_tri(a,b,c)
  if a**2 + b**2 == c**2 ||
    a**2 + c**2 == b**2 ||
    b**2 + c**2 == a**2

    return 0
  else
    return 1
  end
end

for i in 0..k-1
  n = gets.chomp.split
  a = n[0].to_i
  b = n[1].to_i
  c = n[2].to_i

  rsl = is_tri(a,b,c)
  if rsl == 0
    puts "YES"
  else
    puts "NO"
  end
end



Measured memory_bytes: 6872
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);
    int H = scan.nextInt();
    int N = scan.nextInt();
    int[] A = new int[N];
    for(int i=0; i<N; i++) {
      A[i] = scan.nextInt();
    }
    scan.close();

    int sum = 0;
    for(int i=0; i<N; i++) {
      sum += A[i];
    }

    System.out.println(H > sum ? "No" : "Yes");
  }
}

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

int n, k, r, s, p;
string t;

char get_kachite(char c){
  if(c == 'r') return 'p';
  if(c == 's') return 'r';
  if(c == 'p') return 's';
}

int get_kachiten(char c){
  if(c == 'r') return r;
  if(c == 's') return s;
  if(c == 'p') return p;
}


int main(){
  cin >> n >> k >> r >> s >> p >> t;
  
  int res = 0;
  rep(m, k){
    char maenote = 'x';
    for(int i = m; i < n; i += k){
      char kachite = get_kachite(t.at(i));
      if(maenote == kachite){
        maenote = 'x';
        continue;
      }
      maenote = kachite;
      res += get_kachiten(kachite);
    }
  }
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 512
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <map>
#include <cstdio>
#include <string>
#include <cstdlib>
#include <cstring>
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
const long double EPS = 1e-9;
const ll mod = 1e9 + 7;
const ll INF = 1e9;

#define rep(i, n) for(ll i = 0; i < n ; i++ )
#define For(i, a, b) for(ll i = (a); i < (b) ; i++ )
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()

const ll MAX_N = 100000;

int main(void){
    ll A[6];
    ll ops[4];
    ll answers[2];
    double dense_max = 0.0;
    /*
    op1, op2: <= 30
    op3, op4: <= 3000
     */

    rep(i, 6) cin >> A[i];
    ops[0] = A[5] / (100 * A[0]);
    answers[0] = 0;
    answers[1] = 0;

    rep(a, ops[0] + 1){
        ops[1] = (A[5] - 100 * A[0] * ops[0]) / (100 * A[1]);
        rep(b, ops[1] + 1){
            ll w = 100 * (a * A[0] + b * A[1]);
            if (w == 0) continue;
            ll rest = min(A[5] - w, A[4] * (a * A[0] + b * A[1]));
            ops[2] = rest / A[2];
            rep(c, ops[2] + 1){
                ll rest_now = rest - c * A[2];
                ops[3] = rest_now / A[3];
                rep(d, ops[3] + 1){
                    ll s = c * A[2] + d * A[3];
                    double dense = double(s) / double(w);

                    if (dense_max <= dense){
                        dense_max = dense;
                        answers[0] = w + s;
                        answers[1] = s;
                    }
                }
            }
        }
    }

    cout << answers[0] << " " << answers[1] << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define arep(i,x,n) for(int i=int(x);i<(int)(n);i++)
#define rep(i,n) for(long long i = 0;i < n;++i)
#define pi 3.141592653589793
#define eps 0.00000001
#define INF 1e9+7  
using ll = long long; 
using P=pair<int,int>;
using lP=pair<ll,ll>;
using fP=pair<double,double>;

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

int main(){
    int n,x;
    cin>>n>>x;
    vector<int>d(n);
    rep(i,n){
        int y;
        cin>>y;
        d[i]=abs(x-y);
    }
    int a=d[0];
    arep(i,1,n){
        a=gcd(a,d[i]);
    }
    cout<<a<<endl;
    return 0;
}

Measured memory_bytes: 640
#include <algorithm>
#include <iostream>
#include <iterator>
#include <numeric>
#include <sstream>
#include <fstream>
#include <cassert>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <string>
#include <cstdio>
#include <vector>
#include <bitset>
#include <cmath>
#include <queue>
#include <tuple>
#include <deque>
#include <stack>
#include <list>
#include <map>
#include <set>
using namespace std;
typedef long long ll;
typedef pair<int,int> ii;
typedef pair<string,int> si;
typedef pair<int,ii> iii;
typedef vector <si> vsi;
typedef vector <ii> vii;
typedef vector <int> vi;
typedef vector <char> vc;
typedef vector <string> vs;
typedef map <string,vs> msvs;
typedef map <string,int> msi;
typedef map <string,string> mss;
#define INF 1000000000

int main(){
  ll a,b;
  cin>>a>>b;
  ll c = a-b;
  if(c<0) c=0;
  cout<<c<<endl;

  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll t1,t2,a1,a2,b1,b2;
int main()
{
    scanf("%lld%lld%lld%lld%lld%lld",&t1,&t2,&a1,&a2,&b1,&b2);
    ll a=a1-b1,b=a2-b2;
    if(a<0) a*=-1,b*=-1;
    ll k=t1*a+t2*b;
    if(k==0) {printf("infinity\n");return 0;}
    if(k>0){printf("0\n");return 0;}
    ll ans=a*t1/(-k)*2+(b*t2%k!=0);
    printf("%lld\n",ans);
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(100000)


def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


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


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(H, W, N, s, S, T):
    s_ = s
    lx = 0
    rx = W-1
    ly = 0
    ry = H-1
    for s, t in reversed(list(zip(S, T))):
        if t == 'R':
            lx = max(0, lx-1)
        elif t == 'L':
            rx = min(W-1, rx+1)
        elif t == 'D':
            ly = max(0, ly-1)
        elif t == 'U':
            ry = min(H-1, ry+1)

        if s == 'L':
            lx += 1
        elif s == 'R':
            rx -= 1
        elif s == 'U':
            ly += 1
        elif s == 'D':
            ry -= 1

        if lx > rx:
            return 'NO'
        elif ly > ry:
            return 'NO'

    s = s_
    # print(s, lx, rx, ly, ry)
    if not (lx <= s[1]-1 <= rx):
        return 'NO'
    elif not (ly <= s[0]-1 <= ry):
        return 'NO'
    return 'YES'


def main():
    H, W, N = read_int_n()
    s = read_int_n()
    S = read_str()
    T = read_str()
    print(slv(H, W, N, s, S, T))


if __name__ == '__main__':
    main()


Measured memory_bytes: 20424
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = 0


for i in range(n):
  if a[i] >= b[i]:
    c += b[i]
    
  elif a[i] < b[i]:
    c += a[i]
    d = a[i+1]
    a[i+1] = a[i+1] + a[i] - b[i]
    if a[i+1] < 0:
      a[i+1] = 0
      c += d
    else:
      c += (b[i] - a[i])
    
print(c)

Measured memory_bytes: 19156
#include<iostream>
#include<iomanip>
#include <math.h>
using namespace std;
int main(){
    double r, PI;
    PI = 3.14159265358979;
    cin >> r;
    cout << fixed << setprecision(6) << PI * r * r << " " << 2 * PI * r << endl;
    return 0;
}



Measured memory_bytes: 3232