akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int i = 0;i < (n);i++)
#define FOR(i, a, b) for(int i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-6;

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;}

const int64 mod = 1e9+7;

int main(void){
	int64 a, b;
	cin >> a >> b;
	int64 res = (a-b)*100+b*1900;
	REP(i, b){
		res *= 2;
	}
	cout << res << endl;
}

Measured memory_bytes: 256
N,M = map(int,input().split())
mnr = []
mxr = []
for i in range(1,M+1):
  mn , mx = map(int,input().split())
  mnr.append(mn)
  mxr.append(mx)
x = max(min(mxr)-max(mnr) +1,0)
print(x)

Measured memory_bytes: 10996
#include<iostream>
#include<vector>
#include<cmath>
#define _GLIBCXX_DEBUG
using namespace std;
bool overlap(int a, int b, int c, int d){
  if ( d <= a ) return false;
  if ( b <= c ) return false;
  return true;
}
 
int main(){
  int a, b, s, f, n;
  cin >> a >> b >> n;
  for ( int i = 0; i < n; i++ ){
    cin >> s >> f;
    if ( overlap(a, b, s, f) ){
      cout << 1 << endl;
      return 0;
    }
  }
  cout << 0 << endl;
  return 0;
}


Measured memory_bytes: 3132
#include<bits/stdc++.h>
using namespace std;
main(void){
    int n;
    cin>>n;
    vector<string> v;
    set<string> st;
    for(int i=0;i<n;i++){
        string s;
        cin>>s;
        v.push_back(s);
        st.insert(s);
    }

    if(st.size()!=n){
        cout<<"No"; return 0;
    }else{
        for(int i=0;i<n-1;i++){
            //cout<<v[i].length()<<endl;
            if( v[i][ v[i].length()-1 ] != v[i+1][0] ){
                cout<<"No"; return 0;
            }
        }
        cout<<"Yes";
    }
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt(); in.nextLine();
        String[] tmp = in.nextLine().split(" ");
        long[] ary = new long[n];
        for( int i = 0; i < n; i++ ) ary[i] = Long.parseLong(tmp[i]);
        long ans = ary[0];
        for( long L : ary ) {
            ans = gcd(ans,L);
        }
        System.out.println(ans);
    }
    static long gcd(long a, long b) {
        if( b == 0 ) return a;
        return gcd(b,a%b);
    }
}

Measured memory_bytes: 63532
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double D;
typedef pair<ll,ll> P;
#define M 1000000007
#define F first
#define S second
#define PB push_back
#define INF 100000000000000000
ll n,m,dp[3005][3005];
char s[3005],t[3005];
vector<char>ans;
int main(void){
    cin>>s>>t;
    n=strlen(s);
    m=strlen(t);
    for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++){
            dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
            if(s[i-1]==t[j-1])dp[i][j]=max(dp[i][j],dp[i-1][j-1]+1);
        }
    }
    ll a=n,b=m;
    while(a&&b){
        if(s[a-1]==t[b-1]&&dp[a][b]==dp[a-1][b-1]+1){
            ans.PB(s[a-1]);
            a--,b--;
        }else if(dp[a][b]==dp[a-1][b])a--;
        else b--;
    }
    for(int i=ans.size()-1;i>=0;i--)printf("%c",ans[i]);
    printf("\n");
}


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

typedef long long ll;
typedef long double ld;
typedef vector<vector<int>> Graph;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
#define pi 3.14159265359
#define inf 2147483647
#define INF 9223372036854775807
#define mod 1000000007
#define mod2 998244353

int main() {
	int N; cin >> N;
	vector<ll> A(N);
	vector<ll> sum(N);
	for(int i = 0; i < N; i++) {
		cin >> A[i];
		if(i == 0) sum[0] = A[i];
		else sum[i] = (sum[i - 1] + A[i]) % mod;
	}
	ll ans = 0;
	for(int i = 0; i < N; i++) {
		ll num = (sum[N - 1] - sum[i]) % mod;
		if(num < 0) num += mod;
		ans =  (ans + A[i] * num) % mod;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 6420
#include<iostream>
#include<cmath>
#include<algorithm>
using namespace std;

int main()
{
	int n, m, a[50], b[50], c[50], d[50], num;
	cin >> n >> m;
	for (int i = 0; i < n; i++) {
		cin >> a[i] >> b[i];

	}
	for (int j = 0; j < m; j++) {
		cin >> c[j] >> d[j];
	}
	for (int i = 0; i < n; i++) {
		int min = 1000000000;
		for (int j = 0; j < m; j++) {
			int man = abs(a[i] - c[j]) + abs(b[i] - d[j]);
			if (min > man) {
				min = man;
				num = j + 1;
			}
		}
		cout << num << endl;
	}
	return 0;
}

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

#define __STDC_FORMAT_MACROS
#define p64 PRId64

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)    FOR (i,0,n)
#define ALL(f,x,...) ([&](decltype((x)) ALL) {                          \
            return (f)(begin(ALL), end(ALL), ## __VA_ARGS__); })(x)

using namespace std;
using ll = int64_t;

template<class T> void gc(T &x)
{
    char c;
    int s = 0;
    x = 0;

    c = getchar_unlocked();

    if (c == '-') s = 1;
    else if ('0' <= c && c <= '9')  x = c - '0';

    while (true)
    {
        c = getchar_unlocked();

        if (c < '0' || '9' < c) break;
        x = x * 10 + (c - '0');
    }

    if (s) x = -x;
}

template<class T> void gc_string(T &x)
{
    x = "";
    int y = getchar_unlocked();

    char f = 'A';
    char t = 'z';

    while (y < f || t < y)
        y = getchar_unlocked();

    while (f <= y && y <= t)
    {
        x += (char)y;
        y = getchar_unlocked();
    }
}

int main()
{
    int N;

    gc(N);

    int X[5] = {};

    int P[10] = {0,0,0,0,0,0,1,1,1,2};
    int Q[10] = {1,1,1,2,2,3,2,2,3,3};
    int R[10] = {2,3,4,3,4,4,3,4,4,4};

    REP (i, N)
    {
        string S;
        gc_string(S);

        if (S[0] == 'M') X[0]++;
        else if (S[0] == 'A') X[1]++;
        else if (S[0] == 'R') X[2]++;
        else if (S[0] == 'C') X[3]++;
        else if (S[0] == 'H') X[4]++;
    }

    ll ans = (ll)0;

    REP (i, 10) ans += (ll)X[P[i]] * X[Q[i]] * X[R[i]];

    cout << ans << endl;
    return 0;
}


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

using namespace std;

int main(void)
{
	string s, t;
	cin >> s >> t;
	int slen = s.size();
	int tlen = t.size();
	string d0[tlen+1], d1[tlen+1];
	string *rd0 = d0;
	string *rd1 = d1;

	for (int i = 0; i < slen+1; i++) {
		for (int j = 0; j < tlen+1; j++) {
			string c0, c1, c2;
			if (i-1 >= 0)
				c0 = rd0[j];
				//c0 = d[i-1][j];
			if (j-1 >= 0)
				c1 = rd1[j-1];
				//c1 = d[i][j-1];
			if (i-1 >= 0 && j-1 >= 0 && i >= 1 && j >= 1) {
				if (s[i-1] == t[j-1])
					c2 = rd0[j-1] + s[i-1];
					//c2 = d[i-1][j-1] + s[i-1];
			}
			if (c0.size() >= c1.size() && c0.size() >= c2.size())
				rd1[j] = c0;
				//d[i][j] = c0;
			else if (c1.size() >= c0.size() && c1.size() >= c2.size())
				rd1[j] = c1;
			else
				rd1[j] = c2;
		}
		if (rd0 == d0) {
			rd0 = d1;
			rd1 = d0;
		} else {
			rd0 = d0;
			rd1 = d1;
		}
	}
	cout << rd0[tlen] << endl;
	return 0;
}

Measured memory_bytes: 8576
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#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 <bits/stdc++.h>
#include<queue>
#include <numeric>
#include<stdio.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;}
 template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
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(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define fore(i,a) for(auto &i:a)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
 
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
 
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
 

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

LL lcm(LL a, LL b){
    LL g = gcd(a,b);
    return a/g *b;
}

int main(){
    string S;
    cin >> S;
    string T;
    int L=S.length();
    for(int i=0;i<L;i=i+2) T+=S[i];
    cout << T;
    }

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

int main() {
  int D;
  cin >> D;
  if (D == 25) {
    cout << "Christmas" << endl;
  }
  else if (D == 24) {
    cout << "Christmas Eve" << endl;
  }
  else if (D == 23) {
    cout << "Christmas Eve Eve" << endl;
  }
  else {
    cout << "Christmas Eve Eve Eve" << endl;
  }
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


#define NUM 10001

int H,W,num_special,num_dog;
bool exist_dog[NUM];
vector<int> ODD[NUM],EVEN[NUM];


int main(){

	scanf("%d %d %d %d",&W,&H,&num_special,&num_dog);

	for(int row = 2; row <= H-1; row += 2)exist_dog[row] = false;

	int tmp_col,tmp_row;
	for(int loop = 0; loop < num_dog; loop++){

		scanf("%d %d",&tmp_col,&tmp_row);

		if(tmp_row%2 == 1)continue;

		if(tmp_col%2 == 1){

			ODD[tmp_row].push_back(tmp_col);

		}else{
			EVEN[tmp_row].push_back(tmp_col);
		}
		exist_dog[tmp_row] = true;
	}

	if(num_special < (W+1)/2){
		printf("-1\n");
		return 0;
	}

	num_special -= (W+1)/2;
	int num_cost_1 = ((H-1)/2)*((W+1)/2);
	int num_cost_2 = 0;
	int num_house,index,num_odd_order_dog;

	for(int row = 2; row <= H-1; row += 2){

		if(!exist_dog[row])continue;
		sort(ODD[row].begin(),ODD[row].end());

		EVEN[row].push_back(0);
		EVEN[row].push_back(W+1);
		sort(EVEN[row].begin(),EVEN[row].end());

		index = 0;

		for(int i = 1; i < EVEN[row].size(); i++){

			num_house = (EVEN[row][i]-EVEN[row][i-1])/2;
			if(num_house%2 == 0)continue;

			num_odd_order_dog = 0;

			while(index < ODD[row].size() && ODD[row][index] < EVEN[row][i-1])index++;
			while(index < ODD[row].size() && ODD[row][index] < EVEN[row][i]){

				if(((ODD[row][index]-EVEN[row][i-1])/2)%2 == 0){
					num_odd_order_dog++;
				}
				index++;
			}
			if(num_odd_order_dog == (num_house+1)/2)num_cost_2++;
		}
	}
	num_cost_1 -= num_cost_2;

	if(num_cost_2 < num_special){

		num_special -= num_cost_2;
		num_cost_2 = 0;
		num_cost_1 = max(0,num_cost_1-num_special);

	}else{

		num_cost_2 -= num_special;
	}

	printf("%d\n",num_cost_1+2*num_cost_2);

	return 0;
}



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

int main(){
    int n;
    cin >> n;
    switch (n%10)
    {
    case 2:
    case 4:
    case 5:
    case 7:
    case 9:
    puts("hon");
    break;
    case 0:
    case 1:
    case 6:
    case 8:
    puts("pon");
    break;
    case 3:
    puts("bon");
    break;
    }
    return 0;
}

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

public class Main {

    void run() {
        Scanner sc = new Scanner(System.in);
        long x = sc.nextLong();
        long y = sc.nextLong();
        int count = 0;
        while (x <= y) {
            count++;
            x = x * 2;
        }
        System.out.println(count);
    }

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

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


Measured memory_bytes: 21716
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0;i < (n);i++)
using ll = long long;
const ll MOD=1000000007;
const double pi=acos(-1);





int main() 
{
  int N,K,S; cin>>N>>K>>S;
  if(K==N)
  {
    rep(i,N)
    {
      if(i!=0) {cout<<" ";}
      cout<<S;
    }
    cout<<endl;
    return 0;
  }  
  rep(i,N)
  {
    if(i!=0) {cout<<" ";}
    if(i<K) {cout<<S; continue;}
    if(S==1000000000) {cout<<1; continue;}
    cout<<1000000000;
  }
  cout<<endl;
  return 0;
}


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

string S;
vector<long long> X;

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

    int K;
    cin >> S >> K;

    int curr = 1;

    for(int i=1; i<S.size(); i++)
    {
        if(S[i] == S[i-1])
            curr++;
        else
            X.push_back(curr), curr = 1;
    }

    X.push_back(curr);

    long long ans = 0;

    for(int i=1; i<X.size()-1; i++)
        ans += X[i] / 2 * K;
    
    if(X.size() == 1)
        ans += X[0] * K / 2;
    else if(S[0] == S.back())
        ans += (X[0] + X.back()) / 2 * (K-1) + X[0] / 2 + X.back() / 2;
    else
        ans += X[0] / 2 * K + X.back() / 2 * K;

    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define debug1(x) cerr<<#x<<" -> "<<x<<endl
#define debug2(x,y) cerr<<#x<<" -> "<<x<<" "<<#y<<" -> "<<y<<'\n'
#define debug3(x,y,z) cerr<<#x<<" -> "<<x<<" "<<#y<<" -> "<<y<<" "<<#z<<" -> "<<z<<'\n'

 
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
#define ordered_set tree<ll , null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>

const ll N = 1e5+7;
const ll MOD = 1e9+7;

ll dp[3005][3005];
ll pref[3005][3005];


int main(){
	fast;
	int n;
	cin>>n;
	string s;
	cin>>s;
	
	dp[0][1] = 1;
	
	for(int i = 1; i < n; i++){
		
		for(int j = 1; j <= i; j++){
			pref[i-1][j] = (pref[i-1][j-1] + dp[i-1][j])%MOD;
		}
		
		int nxt = i+1;
		for(int j = 1; j <= nxt; j++){
			if(s[i-1] == '<'){
				dp[i][j] = pref[i-1][j-1];
			} else {
				dp[i][j] = (pref[i-1][nxt-1] - pref[i-1][j-1] + MOD) % MOD;
			}
		}
	}
	
	ll ans = 0;
	
	for(int i=1;i<=n;i++){
		ans+=dp[n-1][i];
		if(ans > MOD) ans-=MOD;
	}
	
	cout<<ans<<'\n';
	
	return 0;
}


Measured memory_bytes: 139648
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define ll long long
int main(){
	int n; cin>>n;
	string s; cin>>s;
	for(char &c:s){
		int x=c-'A';
		x+=n;
		x%=26;
		cout<<(char)('A'+x);
	}
}


Measured memory_bytes: 3652
n = int(input())
a = [0]*n
x = [[] for i in range(n)]
y = [[] for i in range(n)]
for i in range(n):
    a[i] = int(input())
    for j in range(a[i]):
        tmp1,tmp2 = list(map(int,input().split()))
        x[i].append(tmp1-1)
        y[i].append(tmp2)

ans = 0
honest = [0]*n
for i in range(2**n): #bit全探索
    for j in range(n):
        if((i>>j)&1):
            honest[j] = 1
        else:
            honest[j] = 0
            
        f = True
        for k in range(n):
            for l in range(a[k]):
                if(honest[k]==1 and y[k][l]!=honest[x[k][l]]):
                    f = False
                    break
        if f:
            ans = max(ans,honest.count(1))

print(ans)

Measured memory_bytes: 49756
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll K=1000000007;
 
int main (){    
    int N;
    cin>>N;
    int Keta=0;
    int NN=N;
    while(NN>0){
        NN/=10;
        Keta ++;
    }
  	//cout<<Keta<<endl;
    vector<vector<ll>> Num(10, vector<ll>(10));
    for(int i=1; i<10; i++){
        for(int j=1; j<10; j++){
            int Kazu=0;
            if(i==j){
                if(i>N)continue;
                if(Keta==1){
                    Num[i][i]++;
                    continue;
                }
                if(Keta==2){
                    Num[i][i] ++ ;
                    if(N>=i*10+i)Num[i][i] ++;
                    continue;
                }
                Num[i][i] ++;
                int J=1;
                int KKeta=Keta;
                while(KKeta>2){
                    Num[i][i] +=J;
                    KKeta --;
                    J *=10;
                }
                while(i*pow(10, Keta-1)+i+Kazu*10<=N){
                    Num[i][i] ++;
                    Kazu ++;
                  	if(Kazu>=pow(10, Keta-2))break;
                }
                
            }
            else{
                if(i*10+j>N)continue;
                if(Keta==2){
                    if(N>=i*10+j)Num[i][j] ++;
                    continue;
                }
                
                int J=1;
                int KKeta=Keta;
                while(KKeta>2){
                    Num[i][j] +=J;
                    KKeta --;
                    J *=10;
                }
                while(i*pow(10, Keta-1)+ j +Kazu*10<=N){
                    Num[i][j] ++;
                    Kazu ++;
                  	if(Kazu>=pow(10, Keta-2))break;
                }
                
            }
        }
    }
    ll Ans=0;
    for(int i=1; i<10; i++){
        for(int j=1; j<i; j++){
            Ans+=Num[i][j]*Num[j][i]*2;
          	//cout<<Num[i][j]<<" ";
        }
      	//cout<<endl;
    }
    for(int i=1; i<10; i++){
        Ans += Num[i][i]*Num[i][i];
      	//cout<<Num[i][i]<<endl;
    }
    cout<<Ans;
  	//cout<<endl;
  	/*for(int i=1; i<10; i++){
        for(int j=1; j<10; j++){
           
          cout<<Num[i][j]<<" ";
        }
      	cout<<endl;
    }*/
  	
}

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

using namespace std;
typedef long long ll;

int main(){
    ll n;
    cin >> n;
    vector<ll> a(n);
    for(int i = 0; i < n; ++i){
        cin >> a.at(i);
    }
    sort(a.begin(), a.end());
    const ll mv = a.back();
    ll index = lower_bound(a.begin(), a.end(), (mv + 1) / 2) - a.begin();
    if(index != a.size() - 1 && index > 0){
        const ll d1 = a.at(index);
        const ll d2 = a.at(index - 1);
        if(mv % 2 == 0){
            if(abs(d1 - mv / 2) < abs(d2 - mv / 2)){
                cout << mv << ' ' << d1 << endl;
            }else{
                cout << mv << ' ' << d2 << endl;
            }
        }else{
            if(min(abs(d1 - mv / 2), abs(d1 - (mv + 1) / 2)) <
               min(abs(d2 - mv / 2), abs(d2 - (mv + 1) / 2))){
                cout << mv << ' ' << d1 << endl;
            }else{
                cout << mv << ' ' << d2 << endl;
            }
        }
    }else if(index == 0){
        cout << mv << ' ' << a.at(index) << endl;
    }else{
        cout << mv << ' ' << a.at(index - 1) << endl;
    }
    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <time.h>
#include <cstdlib>
#include <cmath>
#include <fstream>
 
int main(void) {
 
    //test???¨
    //std::ifstream in("test.txt");
    //std::cin.rdbuf(in.rdbuf());
 
    std::string W;
    std::cin >> W;
    std::transform(W.begin(), W.end(),W.begin(),tolower);
 
    int count = 0;
    std::string str;
    while (std::cin >> str) {
        if (W.length() == str.length()) {
            std::transform(str.begin(), str.end(), str.begin(), tolower);
            if (W == str) {
                count++;
            }
        }
    }
 
    std::cout << count << std::endl;
 
}

Measured memory_bytes: 3168
import java.util.*;
class Main{
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int k = scanner.nextInt();
        int r = scanner.nextInt();
        int s = scanner.nextInt();
        int p = scanner.nextInt();
        String ts = scanner.next();
        StringBuilder t = new StringBuilder(ts);
        int ans = 0;
        for(int i = 0; i < n; i++){
            if(i < k){
                ans += getMax(t.charAt(i), r, s, p);
            }else{
                if(t.charAt(i-k) != t.charAt(i)){
                    ans += getMax(t.charAt(i), r, s, p);
                }else{
                    //System.out.println(" t before : " + t);
                    t = t.replace(i, i+1, "?");
                    //System.out.println(" t after : " + t);
                }
            }
            //System.out.println(" char : " + t.charAt(i) + " ans : " + ans);
        }
        System.out.println(ans);
    }
    public static int getMax(char hand, int r, int s, int p){
        if(hand == 'r'){return p;}
        else if(hand == 's'){return r;}
        else{return s;}
    }
}



Measured memory_bytes: 26740
visited=set()
success=1
import sys
sys.setrecursionlimit(1000000)
def dfs(graph, node):
  global visited
  global b
  global success
  if node not in visited:
    visited.add(node)
    for counter in range(len(graph[node-1][0])):
      if b[graph[node-1][0][counter]-1]==10000000000000000000:
        b[graph[node-1][0][counter]-1]=b[node-1]+graph[node-1][1][counter]
      else:
        if  b[graph[node-1][0][counter]-1]!=b[node-1]+graph[node-1][1][counter]:
          success=0
      dfs(graph, graph[node-1][0][counter])
      
n,m=map(int,input().split())
a=[]
b=[10000000000000000000]*n
for i in range(n):
  a.append([[],[]])
done=[0]*n
for i in range(m):
  l,r,d=map(int,input().split())
  a[l-1][0].append(r)
  a[l-1][1].append(d)
  a[r-1][0].append(l)
  a[r-1][1].append(-d)
current=[1]
for i in range(n):
  if i+1 in visited:
    continue
  b[i]=0
  dfs(a,i+1)
if success==0:
  print('No')
else:
  print('Yes')

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

int memo[45], n;

void init(){
  for(int i = 0; i <= n; i++){
    memo[i] = -1;
  }
}

int fibo(int d){
  if(memo[d] >= 0) return memo[d];
  if(d == 0 || d == 1) return memo[d] = 1;
  return memo[d] = fibo(d - 1) + fibo(d - 2);
}

int main(void){
  cin >> n;
  init();
  cout << fibo(n) << endl;;
  return 0;
}

Measured memory_bytes: 1164
n = int(input())
p = [int(i) for i in input().split()]

ans = 0

for i in range(n-2):
    if p[i] > p[i+1] > p[i+2]:
        ans += 1
    elif p[i] < p[i+1] < p[i+2]:
        ans += 1

print(ans)


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

using namespace std;
using int64 = long long;

constexpr int DEBUG = 0;

using Complex = complex<double>;

vector<Complex> DFT(const vector<Complex>& p, int n, int sign = 1) {
  if (n == 1) return p;

  vector<Complex> q1(n / 2), q2(n / 2);
  for(int i = 0; i < n / 2; i++) {
    q1[i] = p[2 * i + 0];
    q2[i] = p[2 * i + 1];
  }

  auto r1 = DFT(q1, n / 2, sign);
  auto r2 = DFT(q2, n / 2, sign);

  vector<Complex> s(n);
  for(int i = 0; i < n; i++) {
    double theta = 2.0 * M_PI * i / n * sign;
    s[i] = r1[i % (n / 2)] + Complex(cos(theta), sin(theta)) * r2[i % (n / 2)];
  }
  return s;
}

vector<Complex> InvDFT(const vector<Complex>& p, int n) {
  auto q = DFT(p, n, -1);
  for(int i = 0; i < n; i++) {
    q[i] /= n;
  }
  return q;
}

// Verified: ATC001-C
vector<Complex> MultiplyFFT(
    const vector<Complex>& p1, const vector<Complex>& p2) {
  int d = p1.size() + p2.size() - 1;
  int n = 1;
  while(n < d + 1) n *= 2;

  auto q1 = p1;
  q1.resize(n);
  auto q2 = p2;
  q2.resize(n);
  auto r1 = DFT(q1, n);
  auto r2 = DFT(q2, n);

  vector<Complex> s(n);
  for(int i = 0; i < n; i++) {
    s[i] = r1[i] * r2[i];
  }
  return InvDFT(s, n);
}

constexpr int MAX_X = 100000;

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

  int n;
  int64 m;
  cin >> n >> m;
  vector<int64> xs(n);
  for (int i = 0; i < n; i++) {
    cin >> xs[i];
  }

  vector<Complex> ps(MAX_X + 1);
  for (int64 x : xs) {
    ps[x] += 1.0;
  }
  auto qs = MultiplyFFT(ps, ps);
  int64 ans = 0;
  for (int64 k = qs.size() - 1; k >= 0; k--) {
    int64 q = static_cast<int64>(round(qs[k].real()));
    if (m >= q) {
      ans += k * q;
      m -= q;
    } else {
      ans += k * m;
      m = 0;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 40508
n = int(input())
tmp = 0
li = []
for i in range(n):
    if i*(i+1)/2 >= n:
        tmp = i
        break
new_li = [x for x in range(1,tmp+1)]
#print(new_li)
if sum(new_li) - n > 0:
    new_li.remove(sum(new_li) - n)
if n == 1:
    print(1)
elif n == 2:
    print(2)
else:
    for n in new_li:
        print(n)

Measured memory_bytes: 3572
A, B, C, K = map(int, input().split())

ans = 0
if A > K:
  ans += 1*K
else:
  ans += 1*A
  K = K - A
  if B > K: 
    ans += 0*K
  else:
    ans += 0*B
    K = K - B
    if C > K:
      ans += -1*K
    else:
      ans += -1*C

print(ans)



Measured memory_bytes: 9188
from collections import defaultdict, deque
import sys

n, m = map(int, input().split())
dic = defaultdict(int)
for _ in range(m):
    s, c = map(int, input().split())
    
    if s==1 and c==0 and n != 1:
        print(-1)
        sys.exit()
    elif dic[s]==0 or dic[s] == c:
        dic[s] = c
    else:
        print(-1)
        sys.exit()
        

ans = ["0"]*n

for i in dic:
    ans[i-1] = str(dic[i])
if ans[0] == "0":
    ans[0] = "1"
sol = 0
for i in range(n):
    sol += int(ans[n-i-1])*(10**i)
if sol == 1 and dic[1] != 1:print(0)
else:
    print(sol)

Measured memory_bytes: 3316
import math


a,b,h,m = map(int,input().split())
theta_a = (h/12*2+m/60/12*2)*math.pi
theta_b = m/60*2*math.pi

a_x = math.cos(theta_a)*a
a_y = math.sin(theta_a)*a
b_x = math.cos(theta_b)*b
b_y = math.sin(theta_b)*b



res = math.sqrt((a_x-b_x)**2+(a_y-b_y)**2)
print(res)

Measured memory_bytes: 9516
N = int(input())
List=[list(map(int,input().split())) for i in range(N)]
A = []
b =[]
for i in range(N):
    for j in range(i):
        if List[i][0] > List[j][0]:
            a = [List[i][0]-List[j][0],List[i][1]-List[j][1]]
        elif List[i][0] < List[j][0]:
            a = [List[j][0]-List[i][0],List[j][1]-List[i][1]]
        else:
            if List[i][1] > List[j][1]:
                a = [List[i][0]-List[j][0],List[i][1]-List[j][1]]
            elif List[i][1] < List[j][1]:
                a = [List[j][0]-List[i][0],List[j][1]-List[i][1]]
        b.append(A.count(a))
        A.append(a)
if b == []:
    print(1)
else:
    print(N-max(b)-1)

Measured memory_bytes: 39152
#include<iostream>
#include<algorithm>
#include<cmath>

using namespace std;
typedef long long ll;
const ll limit = 1e6+2;
long long a[limit],b[limit];
long long n,temp=0,m,res=0,tp,mp;

int main()
{
    cin>>n;
    for(ll i=2;i<=n;i++)
        {cin>>a[i];b[a[i]]++;}
    for(ll i=1;i<=n;i++) cout<<b[i]<<endl;
}


Measured memory_bytes: 6280
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=1;i<=n;i++)
#define pb push_back
#define x0 gtmshb
#define y0 gtmsub
#define x1 gtmjtjl
#define y1 gtmsf
int a[100010],n;
char s[20];
int get(int x)
{
	printf("%d\n",x);
	fflush(stdout);
	scanf("%s",s);
	if(s[0]=='M')return 0;
	else if(s[0]=='F')return 1;
	else return -1;
}
int main()
{
	scanf("%d",&n);
	int l=0,r=n;
	a[l]=a[r]=get(l);
	if(a[l]==-1)return 0;
	for(;l<r-1;)
	{
		int mid=(l+r)>>1;
		a[mid]=get(mid);
		if(a[mid]==-1)return 0;
		if((mid-l+1)%2==a[l]^a[mid])r=mid;else l=mid;
	}
	return 0;
}

Measured memory_bytes: 852
def main():
    n,m = tuple([int(t)for t in input().split()])

    a = [int(t)for t in input().split()]

    votesum = sum(a)

    ans = 0
    for a_i in a:
        if a_i < votesum/4/m:
            pass
        else:
            ans+=1
    if ans>=m:
        print("Yes")
    else:
        print("No")


if __name__ == "__main__":
    main()

Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
#include <bitset>
#include <numeric>
#include <complex>
#include <cassert>
#include <random>
 
 
int main() {
	int n; std::cin >> n;
	std::vector<int> a(n);
	for (int i = 0; i < n; i++) std::cin >> a[i];
	std::sort(a.begin(), a.end());
	long long ans = 0;
	for (int i = 0; i < n; i++) {
		for (int j = i + 1; j < n; j++) {
			ans += std::lower_bound(a.begin() + j + 1, a.end(), a[i] + a[j])
				- (a.begin() + j + 1);
		}
	}
	std::cout << ans << std::endl;
	return 0;
}

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

int main(){
  int a, b;
  cin >> a >> b;
  if(a<b){
    cout << "a < b" << endl;
  }
  if(a>b){
    cout << "a > b" << endl;
  }
  if(a==b){
    cout << "a == b" << endl;
  }
}

Measured memory_bytes: 1156
#include<iostream>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<stdio.h>
#include<string.h>
using namespace std;
#define maxn 100010
typedef long long ll;


int n,m,k;
int a[10000];

int main()
{
//  int a,b,c;
  while(~scanf("%d",&n))
  {
   for(int i=0;i<n;i++)
    scanf("%d",&a[i]);
  sort(a,a+n);
  cout<<a[n-1]-a[0]<<endl;


  }



    return 0;
}


Measured memory_bytes: 256
import math
A,B,H,M=map(int,input().split())
角=abs(30*H+0.5*M-6*M)
if 角>180:
    角=360-角
角=math.radians(角)
Cos=math.cos(角)
AB=A**2+B**2-2*A*B*Cos
print(math.sqrt(AB))

Measured memory_bytes: 9564
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define rep1(i,n) for(int i=1;i<=(int)n;i++)
#define sp(n) cout << fixed << setprecision(n)
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; }
typedef long long ll;
using namespace std;
int main(void){
    string s;cin>>s;
    int tmp=0;
    ll res=0;
    rep(i,s.size()){
       if(s[i]=='W'){
           res+=i-tmp;
           tmp++;
       } 
    }
    cout<<res<<endl;
}

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

using namespace std;

int main()
{
    int a,b,c,x,y;
    cin>>a>>b>>c;
    if(a>b)
    {
        x=a-b;
        y=c-x;
        if(y>=0)
        {
            cout<<y;
        }
        else
        {
            cout<<"0";
        }
    }
    else
    {
        cout<<c;
    }
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<cstring>
#include<sstream>
using namespace std;
 
#define P(p) cout<<(p)<<endl
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define vsort(v) sort(v.begin(), v.end());
#define rvsort(v) sort(v.begin(), v.end(),greater<int>());
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return
#define C(i) cin>>i
#define C2(i,j) cin>>i>>j
#define C3(i,j,k) cin>>i>>j>>k
#define C4(i,j,k,m) cin>>i>>j>>k>>m
////////////////////////////////////////////////////////////

int main(){
	const int MAX_N = 200000, MAX_K = 200000;
	int n,k;
	cin >> n >> k;
	vector<int> v(MAX_K+1,0);
	set<int> s;
	rep(i,0,n){
		int a;
		cin >> a;
		v[a]++;
		s.insert(a);
	}
	
	if( s.size() <= k )
		P(0);
	else{
		vsort(v);
		long ans = 0;
		rep(i, MAX_N - s.size() + 1, MAX_N - s.size() + (s.size() - k) + 1 ){
			ans += v[i];
		}
		P(ans);
	}

	ret 0;
}

Measured memory_bytes: 10368
#include<stdio.h>
int main(void){
	int n,i,a[100];
	scanf("%d",&n);//回数を入力
	for(i=0;i<n;i++){
		scanf("%d",&a[i]);//配列に値を入力
	}
	for(i=n-1;i>=0;i--){//回数-１から０になるまで
		printf("%d",a[i]);//配列を出力
		if(i!=0){//もし０じゃないならば
			printf(" ");//空白を開ける
		}
	}
	printf("\n");
	return 0;
}


Measured memory_bytes: 2072
#! /usr/bin/env python
# -*- coding: utf-8 -*-

def main():
	n = int(input())
	n_list = list(map(int,input().split()))
	b_list = [0]*n
	for i in n_list:
		b_list[i-1] += 1
	
	for i in b_list:
		print (i)

if __name__ == '__main__':
	main()


Measured memory_bytes: 32308
use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {
        n: i64,
    }
    let nx = (n / 1000) * 1000;
    if nx == n {
        println!("{}", 0);
    } else {
        println!("{}", nx + 1000 - n);
    }
}


Measured memory_bytes: 2200
dic = {}
pat = ['S','H','C','D']
rank = [k for k in range(1,14)]

for k in pat:
    for j in rank:
        dic[(k,j)]=0

n = int(raw_input())
for k in range(n):
    p,r = raw_input().split()
    r = int(r)
    dic[(p,r)] +=1

for k in pat:
    for j in rank:
        if dic[(k,j)]==0:
            print '%s %d' % (k,j)

Measured memory_bytes: 4232
#include<iostream>
#include<cmath>
#define ll long long

using namespace std;

int n,k;
double num[200010];
double eps = 1e-6;

int can(double len)
{
	ll rul = 0;
	for(int i=0; i<n; i++)
	{
		ll t = num[i] / len;
		if(fabs(num[i] - t * len) > eps) t++;
		rul+=t-1;
		if(rul > k) return 0;
	}	
	return 1;
}

int main()
{
	cin>>n>>k;
	for(int i=0; i<n; i++) cin>>num[i];
	
	double l = 1e-9, r = 1e9, mid;
	
	while(l < r - eps)
	{
		mid = (l + r) / 2;
		if(can(mid)) r = mid;
		else l = mid;
	}
	printf("%.0lf",ceil(r));
	return 0;
}

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

vector<string> split(const string &s,char c=' '){
    vector<string> ret;
    stringstream ss(s);
    string t;
    while(getline(ss,t,c)){
        ret.push_back(t);
    }
    return ret;
}

int ans;
vector<int> G[1010];
bool f[1010];

void dfs(int now){
    if(f[now]) return;
    f[now] = true;
    // cout << " " << now << endl;
    rep(i, 0, G[now].size()){
        dfs(G[now][i]);
    }
}

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    while(cin >> n, n){
        map<string, int> mp;
        string root;
        rep(i, 0, 1010) G[i].clear();
        memset(f, false, sizeof(f));
        bool label[1010] = {};
        int id = 0;
        rep(i, 0, n){
            string s;
            cin >> s;
            s = s.substr(0, s.size() - 1);
            vector<string> ss = split(s, ':');
            vector<string> ss2 = split(ss[1], ','); 
            if(i == 0) root = ss[0];
            if(!mp.count(ss[0])){
                mp[ss[0]] = id++;
            }
            label[mp[ss[0]]] = true;
            rep(j, 0, ss2.size()){
                if(!mp.count(ss2[j])){
                    mp[ss2[j]] = id++;
                }
                G[mp[ss[0]]].push_back(mp[ss2[j]]);                
            }
        }
        dfs(mp[root]);
        ans = 0;
        rep(i, 0, 1010) if(f[i] && label[i] == false) ans++;
        cout << ans << endl;
    }
}


Measured memory_bytes: 3272
// C
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
// #include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif

using namespace std;
typedef long long int ll;
typedef unsigned long long ull;
typedef long double ld;
#define REP(i,n) for(ll i=0; i<(n); i++)
#define REPR(i, n) for(ll i = n;i >= 0;i--)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
#define ALL(n) begin(n),end(n)
#define IN(a, x, b) (a<=x && x<b)
#define INIT std::ios::sync_with_stdio(false);std::cin.tie(0);
template<class T> inline T CHMAX(T & a, const T b) { return a = (a < b) ? b : a; }
template<class T> inline T CHMIN(T & a, const T b) { return a = (a > b) ? b : a; }

const long double EPS = 1e-10;
const long long INF = 1e18;
const long double PI = acos(-1.0L);
const long long MOD = 1000000007;

int main(void){
    string s;
    cin >> s;
    if(s[0] == 'R' && s[1] == 'R' && s[2] == 'R'){
        cout << 3 << endl;
    }else if(   (s[0] == 'R' && s[1] == 'R') ||
                (s[1] == 'R' && s[2] == 'R' ) ){
                    cout << 2 <<endl;
                }else if( s[0] == 'R' || s[1] == 'R' || s[2] == 'R'){
                    cout << 1 << endl;
                }else{
                    cout << 0 <<endl;

                }
    return 0;
}

Measured memory_bytes: 3220
def n_n(n):
  c = 1
  for i in range(1,n+1):
    c = c * i
  return c
import itertools as itr
N = int(input())
n = n_n(N)

rr=[]
xy = [[0,0]] * (N)
for i in range(N):
  xy[i] = list(map(int,input().split()))
  
all = list(itr.permutations(xy))
for line in all:
  r = [0] * (N+1)
  x = [0]*(N+1)
  y = [0]*(N+1)
  for i in range(N-1):
    x[i+1] = line[i+1][0] - line[i][0]
    y[i+1] = line[i+1][1] - line[i][1]
    r[i+1] = (x[i+1]**2 + y[i+1]**2)**(1/2)
  rr.append(sum(i for i in r))
print(sum(i for i in rr)/n)

Measured memory_bytes: 9332
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef pair<int,int> pi;
typedef pair<ll,ll> pll;
#define Max 1000001
#define inf INT_MAX
#define llinf LONG_LONG_MAX
#define rep(i,a,b) for(i=a;i<=b;i++)
#define rrep(i,a,b) for(i=a;i>=b;i--)
#define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define pb push_back
#define pf push_front
#define F first
#define S second
#define ub upper_bound
#define lb lower_bound
#define all(v) v.begin(),v.end()
const ll N=2e5+5,mod=1000000007;
ll val[N]={0};
vector<ll> adj[N],change(N,0);
vector<ll> query[N];
void dfs(ll u,ll p,ll lvl,ll sum)
{
    for(auto q:query[u])
    {
        change[lvl]+=q;
    }
    sum+=change[lvl];
    val[u]=sum;
    for(auto v:adj[u])
    {
        if(v!=p)
        {
            dfs(v,u,lvl+1,sum);
        }
    }
    for(auto q:query[u])
    {
        change[lvl]-=q;
    }
}
signed main()
{
    fast;
    ll pro=1,temp,n,t,i,m,k,j,l,r,mid,x,y,z,rem,carry=0,ind,ans=0,mx=-llinf,mn=llinf,cnt=0,curr=0,prev,sum=0,flag=1,i1=-1,i2=-1;
    cin>>n>>t;
    rep(i,1,n-1)
    {
        cin>>x>>y;
        adj[x].pb(y);
        adj[y].pb(x);
    }
    while(t--)
    {
        cin>>x>>y;
        query[x].pb(y);
    }
    dfs(1,1,1,0);
    for(i=1;i<=n;i++)
    {
        cout<<val[i]<<' ';
    }
    return 0;
} 

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

using namespace std;

int main(void){
    char b;
    cin >> b;

    if(b=='A') cout << 'T' << endl;
    if(b=='T') cout << 'A' << endl;
    if(b=='G') cout << 'C' << endl;
    if(b=='C') cout << 'G' << endl;
}

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

int main(){
    int n;
    cin >> n;
    set<int> data;
    int ans=0;
    rep(i,n){
        int d;
        cin >> d;
        if(data.count(d)==0) {
            data.insert(d);
            ans++;
            }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define max(a,b) (a>b?a:b)
#define min(a,b) (a<b?a:b)
#define ll long long
#define INF 2000000000
#define INF2 2000000000000000000
 
using namespace std;

int main() {
    
    IOS;

   	int n;
   	cin >> n;
   	pair<int, int> arr[n+1];
   	for(int i = 1; i <= n; i++)
   		cin >> arr[i].first >> arr[i].second;
   	int len = 0;
   	for(int i = 1; i <= n; i++) {
   		if(arr[i].first == arr[i].second)
   			len++;
   		else
   			len = 0;
   		if(len == 3) {
   			cout << "Yes";
   			return 0;
   		}
   	}
   	cout << "No";

}

Measured memory_bytes: 3648
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;

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

int main(){
    int n, p;
    while( cin >> n >> p, n||p ){
        int np = p, st[50] = {};
        for(int i=0; i<1000000; i++){
            if( st[i%n] == p ){
                cout << i%n << endl;
                break;
            }
            if( np == 0 ){
                np = st[i%n];
                st[i%n] = 0;
            }else{
                st[i%n]++;
                np--;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 1156
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))

int main(){
	ll a,b;
	scanf("%lld%lld",&a,&b);
	puts(a*b%2==1?"Yes":"No");
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define fr(i,n) for(int i=0;i<(n);++i)
#define Fr(i,n) for(int i=1;i<=(n);++i)
#define ifr(i,n) for(int i=(n)-1;i>=0;--i)
#define iFr(i,n) for(int i=(n);i>0;--i)

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    istream& in(cin);
    ostream& out(cout);
    string s,t;
    in>>s>>t;
    sort(s.begin(),s.end());
    sort(t.rbegin(),t.rend());
    puts(s<t?"Yes":"No");
}

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

using namespace std;
typedef long long ll;
#define int ll

#define REP(i,n) for(int i=0;i<n;++i)
#define SORT(name) sort(name.begin(), name.end())
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))
#if 1
#  define DBG(fmt, ...) printf(fmt, ##__VA_ARGS__)
#else
#  define DBG(fmt, ...)
#endif

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const double DINF = std::numeric_limits<double>::infinity();
const int MOD = 1000000007;
#define MAX_N 100010

ll N;
vector<ll> A, B, C;
ll dp[MAX_N][4];

enum Before { None = 0, PlayA = 1, PlayB = 2, PlayC = 3 };

// 今 i 日目で、一つ前に prev で遊んだ時の最大値
ll dfs(ll i, ll prev) {
    if(i >= N) { return 0; }

    ll& ret = dp[i][prev];
    if(~ret) { return ret; }

    // A で遊ぶ
    if(prev != PlayA) { ret = max(ret, dfs(i+1, PlayA) + A[i]); }
    // B で遊ぶ
    if(prev != PlayB) { ret = max(ret, dfs(i+1, PlayB) + B[i]); }
    // C で遊ぶ
    if(prev != PlayC) { ret = max(ret, dfs(i+1, PlayC) + C[i]); }

    return ret;
}

signed main()
{
    cin >> N;
    A.assign(N, 0);
    B.assign(N, 0);
    C.assign(N, 0);
    REP(i, N) { cin >> A[i] >> B[i] >> C[i]; }
    MINUS(dp);
    printf("%lld\n", dfs(0, None));
    return 0;
}


Measured memory_bytes: 10368
N = int(input())
flg = False
i = 0
while 7 * i <= N:
    j = 0
    while 7 * i + 4 * j <= N:
        if 7 * i + 4 * j == N:
            flg = True
            break
        j += 1
    if flg:
        break
    i += 1
if flg:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3060
#include <stdio.h>
const int W=1e5+10;
long long int max(long long int a,long long int b){return a>b?a:b;}
int main(){
  int n,w,p,v;
  long long int a[W],ans=0;
  scanf("%d%d",&n,&w);
  for(int i=0;i<=w;i++)a[i]=0;
  for(int i=0;i<n;i++){
    scanf("%d%d",&p,&v);
    for(int j=w;j>=p;j--)a[j]=max(a[j],a[j-p]+v);
  }
  for(int j=w;j>=0;j--)ans=max(ans,a[j]);
  printf("%lld\n",ans);
}

Measured memory_bytes: 896
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC084A
{
    class Program
    {
        static void Main(string[] args)
        {
            int x, s;
            x = int.Parse(Console.ReadLine());

            s = 48 - x;

            Console.WriteLine(s);

            Console.ReadKey();
        }
    }
}


Measured memory_bytes: 11092
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
const int inf = 1e9 + 7;
const ll INF = 1e18;
#define abs(x) (x >= 0 ? x : -(x))
#define lb(v, x) (int)(lower_bound(all(v), x) - v.begin())
#define ub(v, x) (int)(upper_bound(all(v), x) - v.begin())
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template<typename T> T pow(T a, int b) { return b ? pow(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
const int mod = 1000000007;
ll modpow(ll a, int b) { return b ? modpow(a * a % mod, b / 2) * (b % 2 ? a : 1) % mod : 1; }
template<class T> ostream& operator<<(ostream& os, const vector<T>& vec) { rep(i, sz(vec)) { if (i) os << " "; os << vec[i]; } return os; }
template<class T, class U> ostream& operator<<(ostream& os, const pair<T, U>& p) { os << p.F << " " << p.S; return os; }
template<class T> inline void add(T &a, int b) { a += b; if (a >= mod) a -= mod; }



void solve();

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cout << fixed << setprecision(10);

  int T;
  // cin >> T;
  T = 1;

  while (T--) {
      solve();
  }
}



void solve() {
  int n;
  cin >> n;
  cout << (n + 1) / 2 << endl;
}


Measured memory_bytes: 256