akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){cerr << name << " : " << arg1 << '\n';}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);}

const ll inf = 1e18 + 1;
const ll mod = 1e9 + 7;

void print(ll a[], ll n){for(ll i=0;i<n;i++){cout<<a[i]<<" ";}cout<<"\n";}
ll power(ll x, ll y, ll M = inf){
    ll ans = 1;
    x %= M;
    while(y){
        if(y&1)
            ans = (x * ans) % M;

        x = (x * x) % M;
        y >>= 1;
    }
    return ans;
}
ll modInverse(ll n) {return power(n, mod-2, mod);}
inline ll mul(ll a, ll b){ return (a * b) % mod; }
inline ll sub(ll a, ll b){ ll c = a - b; if(c < 0) c += mod; return c; }
inline ll add(ll a, ll b){ ll c = a + b; if(c > mod) c -= mod; return c; }
inline ll divi(ll a, ll b){ return mul(a, modInverse(b)); }

int main() {
	int a[3000][3000];
	pair<int, int>  mp[10000];
	int vs[5000] = {0};
	for(int i=0;i<3;i++){
		for(int j=0;j<3;j++)
		{
			cin>>a[i][j];
			vs[a[i][j]] = 1;
			mp[a[i][j]] = {i, j};
		}	
	}
	int yu[3000][3000];
	int n;
	cin>>n;
	int b[n];
	for(int i=0;i<n;i++){
		cin>>b[i];
		if(vs[b[i]])
		    yu[mp[b[i]].first][mp[b[i]].second] = 1;
	}
	int flag1=0;
	int flag2=0;
	int flag3=0;
	int flag4=0;
	int flag5=0;
	int flag6=0;
	int flag7=0;
	int flag8=0;
	for(int i=0;i<3;i++){
		if(yu[i][i] == 0){flag1=1;}
		if(yu[i][2-i] == 0){flag2=1;}
		if(yu[i][0] == 0){flag3=1;}
		if(yu[0][i] == 0){flag4=1;}
		if(yu[i][1] == 0){flag5=1;}
		if(yu[1][i] == 0){flag6=1;}
		if(yu[i][2] == 0){flag7=1;}
		if(yu[2][i] == 0){flag8=1;}
	}
	if(!flag1 || !flag2 || !flag3 || !flag4 || !flag5 || !flag6 || !flag7 || !flag8) cout<<"Yes\n";
	else cout<<"No\n";
	return 0;
}


Measured memory_bytes: 4480
#include <iostream>
using namespace std;
int main() {
  int H,W;
  while(1){
    cin >> H >> W;
    
    if(H==0 && W==0)
      break;
    
    for(int j=0;j<H;j++){
      for(int i=0;i<W;i++)
        cout << '#';
      cout << endl;
    }
    
    cout << endl;  
  }
}



Measured memory_bytes: 3068
n,m = map(int,input().split())
li,lia = [],[]
for i in range(m):
    a,b = map(int,input().split())
    li.append(a)
    lia.append(b)
if min(lia)-max(li)+1 <= 0:
    print(0)
else:
    print(min(lia)-max(li)+1)

Measured memory_bytes: 11016
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;

public class Main {

    int n;
    E[] g;

    void run() {
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        g = new E[n];
        for (int i = 0; i < n; i++) g[i] = new E();

        for (int i = 0; i < n - 1; i++) {
            int u = sc.nextInt() - 1, v = sc.nextInt() - 1, w = sc.nextInt();
            g[u].add(new P(v, w));
            g[v].add(new P(u, w));
        }

        P st = dfs(0, new boolean[n]);
        P ed = dfs(st.t, new boolean[n]);

        boolean[] ans = new boolean[n];
        draw(ed.t, 0, new boolean[n], ans);

        PrintWriter out = new PrintWriter(System.out);
        for (int i = 0; i < n; i++) {
            out.println(ans[i] ? 0 : 1);
        }
        out.flush();
    }

    void draw(int p, long c, boolean[] visited, boolean[] color) {
        visited[p] = true;
        color[p] = c % 2 == 0;

        for (P next: g[p]) if (!visited[next.t]) {
            draw(next.t, c + next.w, visited, color);
        }
    }

    P dfs(int p, boolean[] visited) {
        visited[p] = true;

        P c = new P(p, 0);

        for (P next: g[p]) if (!visited[next.t]) {
            P tmp = dfs(next.t, visited);
            tmp.w += next.w;
            if (c.w < tmp.w) {
                c = tmp;
            }
        }

        return c;
    }

    class P implements Comparable<P> {
        int t;
        long w;
        P(int t, long w) {
            this.t = t;
            this.w = w;
        }

        @Override
        public int compareTo(P o) {
            return (w - o.w > 0) ? 1 : -1;
        }
    }

    class E extends ArrayList<P> {}

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

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


Measured memory_bytes: 127256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define sz(x) int(x.size())
#define pb push_back
#define eb emplace_back
using ll=long long;
using P = pair<int,int>;
#define chmax(x,y) x = max(x,y)
#define chmin(x,y) x = min(x,y)
const ll MOD=1000000007;

//二項係数
const int MAX = 3000;
long long fac[MAX], finv[MAX], inv[MAX];
// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main() {
    ll N,K;
    cin>>N>>K;
    COMinit();
    if(N==K){
        cout<<1<<endl;
        rep(i,K-1)cout<<0<<endl;
        return 0;
    }
    for(int i=1;i<=K;i++){
        ll ans=0;
        ans+=COM(N-K-1,i)*COM(K-1,i-1)%MOD;
        ans+=COM(N-K-1,i-1)*COM(K-1,i-1)%MOD;
        ans%=MOD;
        ans+=COM(N-K-1,i-1)*COM(K-1,i-1)%MOD;
        ans%=MOD;
        if(i>=2)ans+=COM(N-K-1,i-2)*COM(K-1,i-1)%MOD;
        ans%=MOD;
        cout<<ans<<endl;
    }
}

Measured memory_bytes: 384
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main(void)
{
	int i,n,a,b,l,p;
	vector<int> h,m,k,g,x;
	cin>>n;
	for(i=0;i<n;i++)
	{
       int tp1,tp2;
       cin>>tp1>>tp2;
       h.push_back(tp1);
       m.push_back(tp2);
       p = h[i] * 100 + m[i];
       x.push_back(p);
    }
	cin>>l;
	for(i=0;i<l;i++)
	{
       int tp1,tp2;
       cin>>tp1>>tp2;
       k.push_back(tp1);
       g.push_back(tp2);
         p = k[i] * 100 + g[i];
       x.push_back(p);
       
    }
    
    sort(x.begin(),x.end());
    
    for(i=0;i<n+l-1;i++)
    {
		a = x[i]/100;
		b = x[i]%100;
		if(x[i] != x[i+1])
		{
			if(b<10)
		    cout<<a<<":0"<<b<<" ";
		    else
		    cout<<a<<":"<<b<<" ";
		}
	}
		a = x[l+n-1]/100;
	b = x[l+n-1]%100;
	{
			if(b<10)
		    cout<<a<<":0"<<b<<endl;
		    else
		    cout<<a<<":"<<b<<endl;
		}
	
    
	
	return 0;
}



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

int main()
{
    char s[200010];
    char t[200010];

    fgets(s, sizeof(s), stdin);
    fgets(t, sizeof(t), stdin);

    int len_s=strlen(s);

    int count=0;
    for (int i = 0; i < len_s; i++)
    {
        if(s[i] != t[i])
            count++;
    }
    printf("%d",count);
}

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

public class Main {

	public static final int BIG_NUM = 2000000000;
	public static final int MOD = 1000000007;

	public static void main(String[] args) {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		try {
		   int N = Integer.parseInt(br.readLine());

		   String input_str[] = br.readLine().split("\\s+");
		   int table[] = new int[input_str.length];

		   for(int i = 0; i < input_str.length; i++){

			   table[i] = Integer.parseInt(input_str[i]);
		   }

		   int ans = 0;
		   int work = 0;

		   for(int base = 0; base < table.length-1; base++){
			   for(int loc = table.length-1; loc > base; loc--){

				   if(table[loc] < table[loc-1]){

					   work = table[loc-1];
					   table[loc-1] = table[loc];
					   table[loc] = work;

					   ans++;
				   }
			   }
		   }

		   System.out.printf("%d", table[0]);

		   for(int i = 1; i < table.length; i++){

			   System.out.printf(" %d", table[i]);
		   }
		   System.out.println();
		   System.out.println(ans);

		} catch (NumberFormatException | IOException e) {
			// TODO 自動生成された catch ブロック
			e.printStackTrace();
		}
	}
}


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

int main(){
  int S, L, R;
  cin >> S;
  L = S / 100;
  R = S % 100;
  
  if(1 <= L && L <= 12){
    if(1 <= R && R <= 12){
      cout << "AMBIGUOUS" << endl;
    }else{
      cout << "MMYY" << endl;
    }
  }else{
    if(1 <= R && R <= 12){
      cout << "YYMM" << endl;
    }else{
      cout << "NA" << endl;
    }
  }
  
  return 0;
}

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

using namespace std;
typedef long long ll;
typedef pair<int, int> i_i;
typedef pair<ll, ll> l_l;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define int ll
//const ll mod = 1000000007;

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

    bool is_good = true;
    char temp = s[1];
    for (auto &c:s) {
        if (c == temp) is_good = false;
        temp = c;
    }

    cout << (is_good? "Good":"Bad") << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cmath>

#define PI 3.14159265358979323846264338327950L

using namespace std;



int main(){
	int a, b, h, m;
	cin>>a>>b>>h>>m;
	long double angleB=(60*h+m)/12.0/60.0;
	long double angleA=m/60.0;
	//3.14159265358979323846264338327950Lcout<<angleA<<" "<<angleB<<"\n";
	long double angle=2*PI*min(abs(angleA-angleB), 1.0-abs(angleA-angleB));
	long double ans=sqrtl(a*a+b*b-2*a*b*(cosl(angle)));
	printf("%.20Lf\n",ans);
}



Measured memory_bytes: 4148
#include <cstdio>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <utility>
#include <bitset>
#include <climits>

using namespace std;
typedef long long ll;

int main(){

    int N, M, st, A, B, C, D, X1, X2, Y1, Y2;
    int K[20][20];
    for(int i=0;i<20;++i){
        for(int j=0;j<20;++j){
            K[i][j] = INT_MAX / 2;
        }
    }
    scanf("%d%d", &N, &M);
    {

        for(int i=0;i<M;++i){
            scanf("%d,%d,%d,%d", &A, &B, &C, &D);
            K[A-1][B-1]=C;
            K[B-1][A-1]=D;
        }
        scanf("%d,%d,%d,%d", &X1, &X2, &Y1, &Y2);
        for(int k=0;k<N;++k){
            for(int i=0;i<N;++i){
                for(int j=0;j<N;++j){
                    K[i][j] = min(K[i][j], K[i][k] + K[k][j]);
                }
            }
        }
    }
    cout << (Y1-Y2-K[X1-1][X2-1]-K[X2-1][X1-1]) << endl;
    return 0;
}

Measured memory_bytes: 3120
#include <cstdio>
#include <iostream>
#include <cassert>
#include <string>
#include <algorithm>
#include <cstring>
#include <utility>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cmath>
#include <deque>
#include <unordered_map>
using namespace std;
typedef long long LL;
typedef pair<int, int> pii;
typedef pair<LL, LL> pll;
const int MAXN = 12345;
vector<int> G[MAXN];
int c[MAXN];
bool visit[MAXN];
int deg[MAXN], ans[MAXN];

int main() {
    int N;
    scanf("%d", &N);
    for (int i = 0; i < N - 1; i++) {
        int a, b;
        scanf("%d %d", &a, &b);
        G[a].push_back(b);
        G[b].push_back(a);
    }
    for (int i = 0; i < N; i++) scanf("%d", &c[i]);
    for (int i = 1; i <= N; i++) deg[i] = (int)G[i].size();
    deg[N + 1] = N;
    sort(c, c + N);
    int sum = 0;
    for (int i = 0; i < N; i++) {
        int idx = N + 1;
        for (int j = 1; j <= N; j++) {
            if (visit[j]) continue;
            if (deg[idx] >= deg[j]) idx = j;
        }
        ans[idx] = c[i];
        sum += c[i] * deg[idx];
        visit[idx] = 1;
        for (int j : G[idx]) deg[j]--;
    }
    printf("%d\n", sum);
    for (int i = 1; i <= N; i++) printf("%d ", ans[i]);
    puts("");

    return 0;
}


Measured memory_bytes: 1024
import sys

input = sys.stdin.readline

def main():
    n = int(input())
    sl = input()
    q = int(input())
    kl = tuple(map(int,input().split()))

    for k in kl:
        # i文字目までのdとmとdmの数

        d = m = dm = ans = 0
        for i in range(n):
            if i - k >= 0:
                if sl[i-k] == "D":
                    d -= 1
                    dm -= m
                if sl[i-k] == "M":
                    m -= 1
            if sl[i] == "D":
                d += 1
            if sl[i] == "M":
                m += 1
                dm += d
            if sl[i] == "C":
                ans += dm

        print(ans)

if __name__ == "__main__":
    main()







Measured memory_bytes: 61164
#include <set>
#include <bits/stdc++.h>
using namespace std;
int main()
{
  string S;
  cin>>S;
  
  if (S.at(0)==S.at(1)&&S.at(1)==S.at(2)){
    cout << "No" <<endl;
  }
  else{
    cout <<"Yes" <<endl;
  }
}
  

Measured memory_bytes: 256
H,W,K = map(int,input().split())
mod = 10**9+7
dp = [[0]*W for i in range(H+1)]

dp[0][0] = 1
for i in range(1,W):
    dp[0][i] = 0

for h in range(H):
    for w in range(W):
        
        for j in range((1<<W-1)):
            ok = True
            for k in range(1,W-1):
                if (j>>k)%2 == 1 and (j>>k-1)%2 == 1:
                    ok = False 
                    break
            if ok :
                #right
                if w < W-1 and (j>>w)%2 == 1:
                    dp[h+1][w+1] += dp[h][w]
                    dp[h+1][w+1] = dp[h+1][w+1]%mod
                #left
                elif w > 0 and (j>>w-1)%2 == 1:
                    dp[h+1][w-1] += dp[h][w]
                    dp[h+1][w-1] = dp[h+1][w-1]%mod
                else:
                    dp[h+1][w] += dp[h][w]
                    dp[h+1][w] = dp[h+1][w]%mod

print(dp[H][K-1]%mod)
            
             

Measured memory_bytes: 3064
#include <cstdio>
#include <cmath>
#include <algorithm>
using namespace std;

int a, b, c;

int main()
{
	scanf("%d%d%d", &a, &b, &c);
	if (a==b) printf("%d\n", c);
	else
		if (a==c) printf("%d\n", b);
	else
		printf("%d\n", a);
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mod(n, m) (((n)%(m)+(m))%(m))

const int X[] = {29, 31};
const int MOD[] = {(int) 1e9+7, (int) 1e9+9};
int xpow[2][105];

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

    for (int j = 0; j < 2; ++j) {
        xpow[j][0] = 1;
        for (int i = 1; i < 105; ++i) {
            xpow[j][i] = (int) mod(1LL * xpow[j][i-1] * X[j], MOD[j]);
        }
    }

    string s[2];
    cin >> s[0] >> s[1];
    int sz[2] = {(int) s[0].size(), (int) s[1].size()};
    int ans = 0;
    
    unordered_set<ll> hashes;
    for (int len = 1; len <= max(sz[0], sz[1]); ++len) {
        hashes.clear();

        for (int k = 0; k < 2; ++k) {
            int h[2] = {0, 0};
            for (int i = 0; i < sz[k]; ++i) {
                for (int j = 0; j < 2; ++j) {
                    int c = s[k][i] - 'a' + 1;
                    h[j] = (int) mod(1LL * h[j] + xpow[j][c], MOD[j]);
                    if (i >= len) {
                        c = s[k][i-len] - 'a' + 1;
                        h[j] = (int) mod(1LL * h[j] - xpow[j][c], MOD[j]);
                    }
                }
                if (i+1 >= len) {
                    ll val = ((1LL * h[0]) << 32LL) + (1LL * h[1]);
                    if (k == 0) {
                        hashes.insert(val);
                    } else if (hashes.count(val)) {
                        ans = max(ans, len);
                    }
                }
            }
        }
    }
    cout << ans << "\n";
}


Measured memory_bytes: 3332
#include <iostream>
#include <string>
#include <stack>
#include <queue>
#include <set>
#include <cstring>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <cstdlib>
#include <functional>
#include <map>
#include <numeric>
#define bogo_sort std::sort
#define bozo_sort std::stable_sort
#define alles(obj) obj.begin(), obj.end()
#define elif else if
#define unless(flg) if(!(flg))
#define elless(flg) else if(!(flg))
#define echo std::cout <<
#define read std::cin >>
#define endl std::endl
#define fin << '\n'
#define bash push_back
#define makePair std::make_pair
#define _ << ' ' <<
// type-define
#define Stack std::stack
#define Queue std::queue
#define Set std::set
#define PQueue std::priority_queue
#define Vector std::vector
#define Pair std::pair
#define Map std::map
#define Greater std::greater
using String = std::string;
using llong = long long;
using boolean = bool;
using Pii = Pair<int, int>;
using Vi = Vector<int>;
using Vii = Vector<Pii>;
// utils
constexpr int dx[] = {1, 0, -1, 0, 1, 1, -1, -1};
constexpr int dy[] = {0, 1, 0, -1, 1, -1, 1, -1};
constexpr int INF = 0x3f3f3f3f;
constexpr llong LINF = 0x3f3f3f3f3f3f3f3fLL;

namespace {
    llong power ( llong x, llong n, llong mod ) {
        llong ans = 1;
        while ( n > 0 ) {
            if ( n & 1 ) ans = ( ans * x ) % mod;
            x = ( x * x ) % mod;
            n >>= 1;
        }
        return ans;
    }
    llong power ( llong x, llong n ) { return power( x, n, 1000000007 ); }
    llong gcd ( llong x, llong y ) { return x % y ? gcd( y, x % y ) : y; }
    llong lcm ( llong x, llong y ) { return ( x / gcd(x, y) * y ); }
    llong abs ( llong n ) { return ( n < 0 ) ? -n : n; }
    boolean isMovable ( int x, int y, int w, int h ) { 
        return ( x >= 0 && y >= 0 && x < w && y < h ); }
}

namespace Rlyeh {

    int h[100100];
    int dp[100100];

    signed call_of_Cthulhu( signed datum ) {

        int n, k;
        read n >> k;
        for ( int i = 0; i < n; i++ ) {
            read h[i];
            dp[i+1] = INF;
        }
        for ( int i = 0; i < n; i++ ) {
            for ( int j = 1; j <= k; j++ ) {
                dp[i+j] = std::min( dp[i+j], dp[i]+abs(h[i]-h[i+j]));
            }
        }
        echo dp[n-1] fin;

        return 0;
    }
}

signed main(){std::cin.tie(0); std::ios::sync_with_stdio(false); int main_result = Rlyeh::call_of_Cthulhu(114514); return 0;}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <math.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rrep(i, n) for(int i = 0; i <= (n); i++)
using namespace std;
typedef long long ll;
 
const ll INF = 1LL<<60;
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; }
using Graph = vector<vector<int>>;

typedef pair<int, int> P;
typedef priority_queue<int, vector<int>, greater<int>> PQ;
const int MOD = 1000000007;

const int maxv = 100005;

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

    vector<vector<int>> dp(N+1, vector<int>(N+1,0));

    for(int i = N-1; i >= 0; i--){
        for (int j = N-1; j >=0; j--){
            if (S[i]==S[j]) dp[i][j] = dp[i+1][j+1]+1;
        }
    }

    int ans = 0;
    for(int i = 0; i < N; i++){
        for (int j = i+1; j < N; j++){
            int tmp = min(dp[i][j], j-i);
            ans = max(ans, tmp);
        }
    }

    cout << ans << endl;
    
}

Measured memory_bytes: 101192
#include <bits/stdc++.h>
using namespace std;
int main()
{
	string s;
	cin >> s;
	int len = s.size();
	int cnt = 0;
	for (int i = 0; i < len; i++) {
		if (s[i] != s[len - i - 1]) {
			cnt++;
		}
	}
	cout << cnt / 2;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int calcGCD(int a,int b){
	//??????????????????????????????
	int temp,i,r;
	//??????a???????????§???????????????????????????
	if(a < b){
		temp = a;
		a = b;
		b = temp;
	}
	while(1){
		r = a % b;
		if(r == 0) break;
		a = b; b = r;
	} 	
	return b;
}

long calcLCM(int a,int b){
	return ((long)a * b) / calcGCD(a, b);
}

int main(void){
    int a,b;
	
    while(scanf("%d %d", &a, &b) != EOF){	
        printf("%d %lu\n", calcGCD(a, b), calcLCM(a, b));
    }
	
	return 0;
}

Measured memory_bytes: 600
#include <iostream>
#include <string>

using namespace std;

void solve()
{
	string s;
	getline(cin, s);
	int n = s.size();
	for(int i = 0; i + 4 <= n; ++i)
	{
		if(s[i] == 'a')
		{
			if(s[i + 1] == 'p' && s[i + 2] == 'p' && s[i + 3] == 'l' && s[i + 4] == 'e')
			{
				s[i] = 'p';
				s[i + 1] = 'e';
				s[i + 2] = 'a';
				s[i + 3] = 'c';
				s[i + 4] = 'h';
			}
		}
		else if(s[i] == 'p')
		{
			if(s[i + 1] == 'e' && s[i + 2] == 'a' && s[i + 3] == 'c' && s[i + 4] == 'h')
			{
				s[i] = 'a';
				s[i + 1] = 'p';
				s[i + 2] = 'p';
				s[i + 3] = 'l';
				s[i + 4] = 'e';
			}
		}
	}
	cout << s << endl;
}

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

Measured memory_bytes: 0
#include <iostream>

using namespace std;

int const inf = 1000000000 + 5;

struct itm{
  int price, weight;
};

itm v[101];

int dp[101][100001];

int main() {

  int n, k;
  cin >> n >> k;
  //cerr << k << " <- ";
  for(int i = 1;i <= n;i++)
    cin >> v[i].weight >> v[i].price;

  for(int i = 0; i <= 100; i++)
    for(int j = 0; j <= 100000; j++)
      dp[i][j] = inf;

  dp[0][0] = 0;

  for(int i = 1;i <= n;i++){
    for(int j = 0;j <= 100000;j++){
      dp[i][j] = dp[i - 1][j];
      if(v[i].price <= j)
        dp[i][j] = min(dp[i][j], dp[i - 1][j - v[i].price] + v[i].weight);
    }
  }
  //cerr <<
  for(int j = 100000;j > 0;j--){
    if(dp[n][j] <= k && dp[n][j] != 0){
      cout << j;
      return 0;
    }
  }
  cout << 0;
  return 0;
}


Measured memory_bytes: 39680
#include <vector>
#include <algorithm>
#include <stdio.h>

typedef long long int llint;

using namespace std;

int main()
{
    int n,k;
    int h[200000];
    scanf("%d %d",&n,&k);
    for(int i=0;i<n;i++) scanf("%d",&h[i]);

    sort(h,h+n);
    llint sum=0;
    for(int i=0;i<n-k;i++) sum+=h[i];
    printf("%lld\n",sum);
}

Measured memory_bytes: 896
Module Module1

    Sub Main()
        'let
        Dim N As Long = Console.ReadLine()
        Dim A() As String = Console.ReadLine().Split()

        'var
        Dim ans As Long = Long.MaxValue

        For i As Long = 0 To N - 1
            Dim cnt As Long = 0
            Dim j As Long = CLng(A(i))

            While j Mod 2 = 0
                cnt = cnt + 1
                j = j \ 2
            End While

            ans = Math.Min(ans, cnt)
        Next

        Console.WriteLine(ans)

    End Sub

End Module

Measured memory_bytes: 11220
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <math.h>

#define rep(i,n) for(int i=0;(i)<(n);(i)++)
#define FOR(i,m,n) for(int i=(m);(i)<(n);(i)++)
#define ll long long
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

using namespace std;
const ll MOD = 998244353;
ll fact[300002];

ll bin_pow(ll a,ll n){
    ll retval=1;
    while(n){
        if(n&1){
            retval = retval*a%MOD;
        }
        a = a*a % MOD;
        n>>=1;
    }
    return retval;
}

ll comb(ll a,ll b){
    return fact[a] * bin_pow(fact[b],MOD-2) % MOD * bin_pow(fact[a-b],MOD-2) %MOD;
}

int main(){
    int n,a,b;
    ll ans=0,k;
    cin >> n >> a >> b >> k;
    fact[0]=1;
    for(ll i=1;i<=n;i++){
        fact[i]=fact[i-1] *1LL*i %MOD;
    }
    for(ll i=0;i<=n;i++){
        if((k-a*i)%b==0&&k-a*i>=0){
            ll B = (k-a*i)/b;
            if(B<=n)
            ans +=1LL*comb(n,i)*comb(n,B)%MOD;
        }
    }
    cout << ans%MOD << endl;

    return 0;
}

Measured memory_bytes: 2560
from sys import stdin,stdout
# n=int(stdin.readline())
n,k=list(map(int,stdin.readline().split()))
s=set()
for _ in range(k):
    x=input()
    for v in map(int,stdin.readline().split()):
        s.add(v)
ans=0
for i in range(1,n+1):
    if i not in s:ans+=1
print(ans)

Measured memory_bytes: 9132
#include <iostream>
#include <string>
#include <stdio.h>
#include <cmath>
#include <cfloat>
#include <algorithm>
#include <numeric>
#include <vector>
#include <iterator>
#include <set>
using namespace std;

const double PI=acos(-1);

int main(){
    string o, e, s = "";
    cin >> o >> e;
    for(int i = 0; i < o.length()+e.length(); i++){
        if(i%2 == 0){
            s += o[i/2];
        }else{
            s += e[i/2];
        }
    }
    cout << s << endl;
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <vector>

const int MaxN = 200000 + 5;
const int Mod = 1000000007;

int N, X, Y;
int A[MaxN], B[MaxN];
int Fac[MaxN];
std::vector<int> Col[MaxN];

inline int add(int x, int y) { return (x += y) >= Mod ? x - Mod : x; }
inline int sub(int x, int y) { return (x -= y) < 0 ? x + Mod : x; }
inline int mul(int x, int y) { return 1LL * x * y % Mod; }
inline int pw(int x, int y) { int z = 1; for (; y; y >>= 1, x = mul(x, x)) if (y & 1) z = mul(z, x); return z; }
inline int inv(int x) { return pw(x, Mod - 2); }
inline int sep(int x, int y) { return mul(x, inv(y)); }

void init() {
  scanf("%d %d %d", &N, &X, &Y);
  for (int i = 1; i <= N; ++i) {
    scanf("%d %d", &A[i], &B[i]);
    Col[A[i]].push_back(B[i]);
  }
  Fac[0] = 1;
  for (int i = 1; i <= N; ++i) Fac[i] = mul(Fac[i - 1], i);
}

inline bool cmp(int x, int y) {
  return Col[x][0] < Col[y][0];
}

void solve() {
  for (int i = 1; i <= N; ++i) {
    std::sort(Col[i].begin(), Col[i].end());
//    if (!Col[i].empty()) printf("Col[%d][0] = %d\n", i, Col[i][0]);
  }
  static int vec[MaxN]; int cntv = 0;
  for (int i = 1; i <= N; ++i)
    if (!Col[i].empty()) vec[++cntv] = i;
  std::sort(vec + 1, vec + 1 + cntv, cmp);

  int totSize = 0, ans = 1;
  for (int i = 1; i <= cntv; ++i) {
//    printf("%d + %d = %d\n", Col[vec[1]][0], Col[vec[i]][0], Col[vec[1]][0] + Col[vec[i]][0]);
    if (Col[vec[1]][0] + Col[vec[i]][0] > Y) break;
    int num = 1;
    for (int j = 1; j < (int) Col[vec[i]].size(); ++j) {
      int mnOutsize = 1;
      if (cntv != 1 && i == 1) mnOutsize = 2;
      if ((Col[vec[mnOutsize]][0] + Col[vec[i]][j] > Y || mnOutsize == i) && Col[vec[i]][0] + Col[vec[i]][j] > X) break;
      num++;
    }
    totSize += num;
    ans = mul(ans, Fac[num]);
  }
  ans = sep(Fac[totSize], ans);
  printf("%d\n", ans);
}

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

Measured memory_bytes: 12160
#include<iostream>
#include<vector>
#include<cstdint>
#include<cstdlib>
template<typename T>
void fin(T const& t){ std::cout << t << std::endl; exit(0); }

template<typename T>
std::vector<std::vector<T>> mk2d(size_t s1, size_t s2, T const& val) {
  std::vector<T> tmp(s2, val);
  return std::vector<std::vector<T>>(s1, tmp);
}


template<int64_t Prime>
struct mod_int {
  int64_t v_;
  mod_int(int64_t x=0) : v_(x) { normalize(); }
  void normalize() { ((v_ %= Prime) += Prime) %= Prime; }
  mod_int operator+=(mod_int const& r){ (v_ += r.v_) %= Prime; return *this; }
  mod_int operator-=(mod_int const& r){ (v_ += Prime - r.v_) %= Prime; return *this; }
  mod_int operator*=(mod_int const& r){ (v_ *= r.v_) %= Prime; return *this; }
  mod_int operator+(mod_int const& r) const { mod_int res(*this); return res += r; }
  mod_int operator-(mod_int const& r) const { mod_int res(*this); return res -= r; }
  mod_int operator*(mod_int const& r) const { mod_int res(*this); return res *= r; }
  mod_int pow(int x) const {
    int64_t res = 1, v = v_;
    while(x > 0) {
      if(x&1) (res *= v) %= Prime;
      x/=2; (v *= v) %= Prime;
    }
    return mod_int(res);
  }
  mod_int inv() const { return pow(Prime-2); }
};

int64_t const MOD = 998244353;
typedef mod_int<MOD> mint;

int main() {
  std::cin.tie(0); std::ios::sync_with_stdio(false);
  int A, B, C, D; std::cin >> A >> B >> C >> D;
  auto dp = mk2d(C+1, D+1, mint(0));
  dp[A][B] = 1;
  for(int a = A+1; a <= C; ++a) dp[a][B] = dp[a-1][B]*mint(B);
  for(int b = B+1; b <= D; ++b) dp[A][b] = dp[A][b-1]*mint(A);

  for(int a = A+1; a <= C; ++a) {
    for(int b = B+1; b <= D; ++b) {
      dp[a][b] = dp[a-1][b]*mint(b) + dp[a][b-1]*mint(a)
               - dp[a-1][b-1]*mint(a-1)*mint(b-1);
    } 
  }
  fin(dp[C][D].v_);
  return 0;
}


Measured memory_bytes: 74060
#include <iostream>
#include <vector>

int main()
{
    long long n, k;
    std::cin >> n >> k;

    std::vector<int> a(n);

    for (int i = 0; i < n; i++) {
        std::cin >> a[i];
    }

    const int mod = 1000000007;

    long long p = 0;
    for (int i = 0; i < n - 1; i++) {
        for (int j = i; j < n; j++) {
            if (a[i] > a[j]) {
                p++;
                p %= mod;
            }
        }
    }

    long long q = 0;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            if (a[i] > a[j]) {
                q++;
                q %= mod;
            }
        }
    }

    p *= k;
    p %= mod;

    q *= ((k * (k - 1) / 2) % mod);

    long long ans = p + q;
    ans %= mod;

    std::cout << ans << std::endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <bitset>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <cassert>
#include <queue>
#include <functional>

#define mp make_pair
#define pb push_back


typedef long long ll;
typedef long long llong;
typedef long double ld;

using namespace std;

#ifndef LOCAL
#define cerr _cer
struct _cert
{
    template <typename T> _cert& operator << (T) { return *this; }
};
_cert _cer;
#endif

template <typename T> void dprint(T begin, T end) {
    for (auto i = begin; i != end; i++) {
		cerr << (*i) << " ";
    }
    cerr << "\n";
}

int tmp[100];
int cc[100];
int n;

int main() {
    cin >> n;
    for (int i = 0; i < 26; ++i)
        cc[i] = 10000;
    for (int i = 0; i < n; ++i) {
        string s;
        cin >> s;
        for (int j = 0; j < 26; ++j)
            tmp[j] = 0;
        for (int j = 0; j < s.size(); ++j)
            ++tmp[s[j] - 'a'];
        for (int j = 0; j < 26; ++j)
            cc[j] = min(cc[j], tmp[j]);
    }
    for (int i = 0; i < 26; ++i) {
        for (int j = 0; j < cc[i]; ++j)
            cout << (char)('a' + i);
    }
    cout << "\n";
	return 0;
}




Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mp make_pair
#define ld long double
#define M 1000000000
void printprecise(double l,ll precision)
{
    std::cout << std::fixed;
    std::cout << std::setprecision(precision);
    std::cout << l;
}

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

void initialize(ll ar[],ll n)
{
	for(ll x=0;x<n;x++)
		ar[x] = x;
}

void printarray(ll ar[],ll n)
{
	for(ll x=0;x<n;x++)
		cout<<ar[x]<<" ";
	cout<<endl;
}

void printvector(vector <char> v)
{
	for(ll x=0;x<v.size();x++)
	{
		cout<<v[x]<<" ";
	}
	cout<<endl;
}

ll root(ll i,ll ar[])
{
	while(ar[i]!=i)
	{
		ar[i] = ar[ar[i]];
		i = ar[i];
	}
	return i;
}

void unione(ll a,ll b,ll ar[])
{
	ll p = root(a,ar);
	ll q = root(b,ar);
	ar[p] = ar[q];
}

ll bfs(ll n,ll vis[],vector <ll> v[],ll level[])
{
	list <ll> g;
	g.pb(n);
	vis[n]=1;
	level[n]=1;
	while(!g.empty())
	{
		ll a = g.front();
		g.pop_front();
		for(ll x=0;x<v[a].size();x++)
		{
			if(vis[v[a][x]]==1 && v[a][x] != a) 
			{
				return level[a]-level[v[a][x]]+1;
			}
			else
			{
				g.pb(v[a][x]);
				vis[v[a][x]]=1;
				level[v[a][x]] = level[a]+1;
			}
		}
	}
	return 10000000;
}


int main()
{


	ll n,k;
	cin>>n>>k;
	ll ar[n+1];
	for(ll x=1;x<=n;x++)
	{
		cin>>ar[x];
	}

	ll dp[n+1]={0};
	dp[1] = 0;
	dp[2] = abs(ar[2]-ar[1]);
	for(ll x=3;x<=n;x++)
	{
		ll m = 10000000000000;
		for(ll y=x-1;y>=max((ll)1,x-k);y--)
		{
			m = min(m,dp[y]+abs(ar[x]-ar[y]));
		}
		dp[x] = m;
	}
	cout<<dp[n];
}

	 	

Measured memory_bytes: 1792
from collections import deque
n = int(input())
L = list(map(int, input().split()))
d = deque()

# 偶数奇数で最終的な向きを決める
for i in range(n):
    if (i < 2):
        d.append(str(L[i]))
    else:
        if (i % 2 == 0):
            d.appendleft(str(L[i]))
        else:
            d.append(str(L[i]))

if (len(d) % 2 == 0):
    d.reverse()
    print(' '.join(d))
else:
    print(' '.join(d))


Measured memory_bytes: 37968
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define int ll
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define endl "\n"
#define pb push_back
#define all(a) (a).begin(),(a).end()
#define rev(a) (a).rbegin(),(a).rend()
#define pll pair<ll,ll>
#define rep(i,a,b) for(long long i = (a); i < (b); i++)
int dp[51][51][2501];
int c = 0;
int a, n;
int solve(int arr[], int index, int currCount, int sum){
        if(index == n)return 0;
        if(dp[index][currCount][sum] != -1)return dp[index][currCount][sum];
        int opt1 = solve(arr, index + 1, currCount + 1, sum + arr[index]);
        int opt2 = solve(arr, index + 1, currCount, sum);
        sum += arr[index];
        if(sum%(currCount+1) == 0 && sum/(currCount+1) == a){
           opt1++;
        }
        sum -= arr[index];
        dp[index][currCount][sum] = opt1 + opt2;
        return opt1 + opt2;
}
int32_t main(){
   cin>>n>>a;
   int arr[n];
   rep(i, 0, n){
       cin>>arr[i];
   }
   memset(dp, -1, sizeof(dp));
   cout<<solve(arr, 0, 0, 0)<<endl;
}


Measured memory_bytes: 51072
#include <iostream>
#include <iomanip>

using namespace std;

int main()
{
    int i,j,k;

    int buil[4][3][10]; //棟目, 階数, 部屋番号
    for(i=0;i<4;i++){
        for(j=0;j<3;j++){
            for(k=0;k<10;k++){
                buil[i][j][k] = 0;
            }
        }
    }

    int n,b,f,r,v;
    cin >> n;

    for(i=0;i<n;i++){
       cin >> b >> f >> r >> v; 
       buil[b-1][f-1][r-1] += v;
    }

    for(i=0;i<4;i++){
        for(j=0;j<3;j++){
            for(k=0;k<10;k++){
                cout << " " << buil[i][j][k];
                if(k==9){
                    cout << endl;
                }
            }
            if(j==2 && i!=3){
                cout << "####################" << endl;
            }

        }
    }
    return 0;
}



Measured memory_bytes: 3080
#include <stdio.h>
#include <limits.h>

int n;
int a[100];
int maxa = -100, mina = 100;

int main()
{
	scanf("%d",&n);
	for (int i = 0; i < n; ++i)
	{
		scanf("%d",a + i);
		if (a[i] > maxa)
		{
			maxa = a[i];
		}
		if (a[i] < mina)
		{
			mina = a[i];
		}
	}
	int minans = INT_MAX / 2;
	for (int que = mina; que <= maxa; ++que)
	{
		int ans = 0;
		for (int i = 0; i < n; ++i)
		{
			ans += (que - a[i]) * (que - a[i]);
		}
		if (minans > ans)
		{
			minans = ans;
		}
	}
	printf("%d\n",minans);
	return 0;
}

Measured memory_bytes: 128
#include<stdio.h>
#include<string.h>
char a[55][55],b[55][55];
int n,m;
int find(int x,int y)
{
	int i1,i2,j1,j2;
	for(i1=x,i2=0;i2<m;i2++,i1++)
	for(j1=y,j2=0;j2<m;j2++,j1++)
	if(a[i1][j1]!=b[i2][j2])
	return 0;
	return 1;
}
int main()
{
	int i,j,k,t;
	while(scanf("%d%d",&n,&m)!=EOF)
	{
		for(i=0;i<n;i++)
		scanf("%s",a[i]);
		for(i=0;i<m;i++)
		scanf("%s",b[i]);
		k=0;
		for(i=0;i<=n-m;i++)
		for(j=0;j<=n-m;j++)
		if(a[i][j]==b[0][0])
		{
			t=find(i,j);
			if(t==1)
			k=1;
		}
		if(k==1)
		printf("Yes\n");
		else
		printf("No\n");
	}
	return 0;
}

Measured memory_bytes: 128
import java.util.*;
import java.util.stream.Collectors;
import java.io.*;
import java.math.BigDecimal;
import java.nio.charset.StandardCharsets;

public class Main {

	public static void main(String[] args) throws IOException {
		InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
		BufferedReader in = new BufferedReader(reader);
		Main ins = new Main(in);
		ins.calc();
		ins.showResult();
	}

	int N;
	char[][] map;
	int[] map2;
	List<Integer> list;
	long[] memo;
	long MOD = 1000000007L;

	Main(BufferedReader in) throws IOException {
		N = Integer.parseInt(in.readLine());
		map = new char[2][N];
		for (int i = 0; i < 2; ++i) {
			String line = in.readLine();
			for (int j = 0; j < N; ++j) {
				map[i][j] = line.charAt(j);
			}
		}
		// mapを置き換え
		map2 = new int[N];
		for (int i = 0; i < N; ++i) {
			if (map[0][i] == map[1][i]) {
				// 縦
				map2[i] = 0;
			} else {
				map2[i] = 1;
			}
		}
		// さらに置き換え
		list = new ArrayList<>(N);
		for (int i = 0; i < N; ++i) {
			if (map2[i] == 0) {
				list.add(0);
			} else {
				list.add(1);
				++i;
			}
		}
		memo = new long[list.size()];
		Arrays.fill(memo, 0L);
	}

	void calc() {
		if (list.get(0) == 0) {
			memo[0] = 3;
		} else {
			memo[0] = 6;
		}
		for (int i = 1; i < list.size(); ++i) {
			if (list.get(i - 1) == 0) {
				if (list.get(i) == 0) {
					memo[i] = memo[i - 1] * 2L;
					memo[i] %= MOD;
				} else {
					memo[i] = memo[i - 1] * 2L;
					memo[i] %= MOD;
				}
			} else {
				if (list.get(i) == 0) {
					memo[i] = memo[i - 1];
				} else {
					memo[i] = memo[i - 1] * 3L;
					memo[i] %= MOD;
				}
			}
		}
		System.out.println(memo[list.size() - 1]);
	}

	void showResult() {
	}
}


Measured memory_bytes: 25048
#include <cstdio>

int N,X,Y,Z;
bool a[101]={false},b[101]={false},c[101]={false},p[101]={false};


int main(){
	scanf("%d",&N);
	scanf("%d",&X);
	int v;
	for(int i = 0; i < X; i++){
		scanf("%d",&v);
		a[v] = true;
	}
	scanf("%d",&Y);
	for(int i = 0; i < Y; i++){
		scanf("%d",&v);
		b[v] = true;
	}
	scanf("%d",&Z);
	for(int i = 0; i < Z; i++){
		scanf("%d",&v);
		c[v]= true;
	}
	int ans = 0;
	for(int i = 1; i <= N; i++){
		p[i] = (!a[i] && c[i]) || (b[i] && c[i]);
		if(p[i]){
			ans++;
		}
	}
	printf("%d\n",ans);
	return 0;
}



Measured memory_bytes: 2692
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		sc.close();

		String[] spl = s.split("");
		String ss = spl[0];
		if(spl[1].equals(ss)){
			if(spl[2].equals(ss)){
				//AAAS
				System.out.println("No");
				return;
			}else{
				if(spl[3].equals(ss)){
					//AASA
					System.out.println("No");
					return;
				}else{
					if(spl[2].equals(spl[3])){
						//AASS
						System.out.println("Yes");
						return;
					}else{
						//AASD
						System.out.println("No");
						return;
					}
				}
			}
		}else{
			if(spl[2].equals(ss)){
				if(spl[1].equals(spl[3])){
					//ASAS
					System.out.println("Yes");
					return;
				}else{
					//ASAD
					System.out.println("No");
					return;
				}
			}else if(spl[2].equals(spl[1])){
				if(spl[3].equals(ss)){
					//ASSA
					System.out.println("Yes");
					return;
				}else{
					//ASSD
					System.out.println("No");
					return;
				}
			}else{
				//ASD*
				System.out.println("No");
				return;
			}
		}
	}
}

Measured memory_bytes: 21844
#include <iostream>
#include <vector>

int main() {
  int sx, sy, tx, ty;
  std::cin >> sx >> sy >> tx >> ty;
  for (int i = sy; i < ty; i++) {
    std::cout << "U";
  }
  for (int i = sx; i < tx; i++) {
    std::cout << "R";
  }
  for (int i = sy; i < ty; i++) {
    std::cout << "D";
  }
  for (int i = sx; i < tx; i++) {
    std::cout << "L";
  }

  std::cout << "L";
  for (int i = sy; i <= ty; i++) {
    std::cout << "U";
  }
  for (int i = sx; i <= tx; i++) {
    std::cout << "R";
  }
  std::cout << "D";
  std::cout << "R";
  for (int i = sy; i <= ty; i++) {
    std::cout << "D";
  }
  for (int i = sx; i <= tx; i++) {
    std::cout << "L";
  }
  std::cout << "U" << std::endl;
}

Measured memory_bytes: 256
use proconio::*;

#[fastout]
#[allow(non_snake_case)]
fn main() {
    input! {
        K: usize,
        mut S: String,
    }
    if S.len() <= K {
        println!("{}", S);
    } else {
        S.truncate(K);
        println!("{}...", S);
    }
}


Measured memory_bytes: 2172
import std.conv, std.functional, std.range, std.stdio, std.string;
import std.algorithm, std.array, std.bigint, std.complex, std.container, std.math, std.numeric, std.regex, std.typecons;
import core.bitop;

class EOFException : Throwable { this() { super("EOF"); } }
string[] tokens;
string readToken() { for (; tokens.empty; ) { if (stdin.eof) { throw new EOFException; } tokens = readln.split; } auto token = tokens.front; tokens.popFront; return token; }
int readInt() { return readToken.to!int; }
long readLong() { return readToken.to!long; }
real readReal() { return readToken.to!real; }

bool chmin(T)(ref T t, in T f) { if (t > f) { t = f; return true; } else { return false; } }
bool chmax(T)(ref T t, in T f) { if (t < f) { t = f; return true; } else { return false; } }

int binarySearch(alias pred, T)(in T[] as) { int lo = -1, hi = cast(int)(as.length); for (; lo + 1 < hi; ) { const mid = (lo + hi) >> 1; (unaryFun!pred(as[mid]) ? hi : lo) = mid; } return hi; }
int lowerBound(T)(in T[] as, T val) { return as.binarySearch!(a => (a >= val)); }
int upperBound(T)(in T[] as, T val) { return as.binarySearch!(a => (a > val)); }




void main() {
  try {
    for (; ; ) {
      const N = readInt();
      const L = readLong();
      auto T = new long[N];
      foreach (i; 0 .. N) {
        T[i] = readLong();
      }
      
      real ansX = 0.0, ansY = 0.0, dnm = 0.0;
      foreach (i; 0 .. N) foreach (j; i + 1 .. N) {
        const th = PI * cast(real)(T[i] + T[j]) / cast(real)(L);
        const x = cos(th), y = sin(th);
        ansX += x * ((N + i - j - 1) - (j - i - 1));
        ansY += y * ((N + i - j - 1) - (j - i - 1));
        dnm += ((N + i - j - 1) - (j - i - 1));
      }
      ansX /= dnm;
      ansY /= dnm;
      writefln("%.20f %.20f", ansX, ansY);
    }
  } catch (EOFException e) {
  }
}


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

int main() {
	string s; cin >> s;
	int a,b = 0;
	for(int i = 0; i < 3; i++) {
		if(s[i] == 'A') a++;
		else b++;
	}
	if(a == 3 || b == 3) cout << "No\n";
	else cout << "Yes\n";
}

Measured memory_bytes: 3596
#include<iostream>
using namespace std;
int main(){
	while(1){
		int w = 0;
		cin >> w;
		if(w == -1) break;
		int nums[3] = {125,140};
		int ans = 1150;
		for(int i = 1;i <= 2;i++){
			if(w >= 10 * i) ans += min(w - (10 * i), 10) * nums[i - 1];
		}
		if(w >= 30) ans += (w - 30) * 160;
		cout << 4280 - ans << endl;
	}
	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <math.h>
#include <algorithm>
#include <queue>
#include <map>
#include <list>
//#include <bits/stdc++.h>


using namespace std;

#define FOR(i,a,b) for(int i=(a),i##formax=(b);i<i##formax;i++)
typedef long long ll;

int main(){
    int n;
    string s,all,ans;

    ans = "";    
    all = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
    
    cin >> n >> s;
    
    for(int i=0;i<(int) s.length();i++){
        char tmp = s[i];
         
        for(int j=0;j<26;j++){
            if(tmp == all[j]){
                int tp = (j + n) % 26;
                ans += all[tp];
            }
        }
    }

    cout << ans << endl; 

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <string>
#include <cstdlib>
#include <algorithm>
#define WMAX 10000
#define HMAX 10000

//コメントアウトするとdebug()を実行しない
#define DEBUG

using namespace std;
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

typedef pair<int ,int > P;

int K,S,ans = 0;
static const int dx[8] = {0,1,1,1,0,-1,-1,-1},
					dy[8] = {1,1,0,-1,-1,-1,0,1};

void solve(){
	for (int i = 0; i < K+1; ++i)
	{
		for (int j = 0; j < K+1; ++j)
		{
			if(S >= i + j && S <= i + j + K){
				ans++;
				// cout << i << " " << j << " " << S-i-j << "\n";
			}
		}
	}
}

void debug(){

}

void answer(){
	cout << ans << "\n";
}

int main(){
	ios::sync_with_stdio(false);
	cin >> K >> S;
	solve();
	#ifdef DEBUG
	debug();
	#endif
	answer();

	return 0;
}

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

using namespace std;

int main(){
	ios_base::sync_with_stdio(false);
	int h1, m1, h2, m2, k;
	cin >> h1 >> m1 >> h2 >> m2 >> k;
	const int t1 = h1 * 60 + m1;
	const int t2 = h2 * 60 + m2;
	const int answer = (t2 - t1) - k;
	cout << answer << endl;
	return 0;
}



Measured memory_bytes: 3636
n = int(input())
cnt = 0
for i in range(1, n+1):
    string = str(i)
    if i == 10**5:
        pass
    elif i >= 10** 4:
        cnt += 1
    elif i >= 10 **3:
        pass
    elif i >= 10 ** 2:
        cnt += 1
    elif i >= 10:
        pass
    else:
        cnt += 1
print(cnt)


Measured memory_bytes: 2940
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")

#include <bits/stdc++.h>

#define endl '\n'
#define F first
#define S second

typedef long long ll;
typedef unsigned long long ull;

using namespace std;

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

	string s;
	cin >> s;
	
	cout << s[0] << s[1] << s[2] << endl;
	
	return 0;
}




Measured memory_bytes: 3580
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<stdint.h>
#include<vector>
#include<cmath>
#include<algorithm>
using namespace std;
typedef pair<int ,int> pp;
typedef long long ll;
const ll MOD = 1000000007;

int main(){
    int n;
    string s;
    cin>>n;
    cin>>s;
    for(int i = 0; i < s.size(); i++){
        s[i] += n;
        if(s[i] > 90) s[i] -= 26;
    }
    cout<<s<<endl;
    return 0;
}

Measured memory_bytes: 256
import sys

h, w, m = map(int, input().split())
row = [0]*h
col = [0]*w
bomb = set()
for x in range(m):
    H, W = map(int, input().split())
    bomb.add((H-1, W-1))
    row[H-1] += 1
    col[W-1] += 1

maxrow = max(row)
maxcol = max(col)
ans = maxcol + maxrow - 1
p, q = [], []
for i in range(h):
    if row[i] == maxrow:
        p.append(i)
for i in range(w):
    if col[i] == maxcol:
        q.append(i)

for i in p:
    for j in q:
        if (i, j) not in bomb:
            print(ans + 1)
            exit()
print(ans)


Measured memory_bytes: 83576
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<algorithm>
//deque/functional/iterator/list/map/memory/numeric/queue/set/stack/utility/vector
//#include<bits/stdc++.h>
#define ll long long
using namespace std;

int main()
{
    ll a;
    while(~scanf("%lld",&a))
    {
        ll mod=11;
        ll output=a/mod*2;
        a%=mod;
        if(a>=1&&a<=6)output++;
        if(a>=7&&a<=10)output+=2;
        printf("%lld\n",output);
    }
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define rep(i,a,n) for(ll i=a;i<n;i++)
int main(){
  ll x,n;
  cin>>x>>n;
  ll flag[102];
  rep(i,0,102)flag[i]=0;
  ll p[n];
  rep(i,0,n){
    cin>>p[i];
    flag[p[i]]=1;
  }
  rep(i,0,105){
    if(flag[x-i]==0){
      cout<<x-i<<endl;
      return 0;
    }
    if(flag[x+i]==0){
      cout<<x+i<<endl;
      return 0;
    }
  }
}

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

vector<int> a(26),b(26);

int main()
{
  string s,t;
  cin>>s>>t;
  for(auto i:s)
    a[i-'a']++;
  for(auto i:t)
    b[i-'a']++;
  sort(a.begin(),a.end());
  sort(b.begin(),b.end());
  if(a==b)
    cout<<"Yes";
  else
    cout<<"No";
  
  
  return 0;
}


Measured memory_bytes: 776
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ii = pair<int, int>;
#ifdef XVENOM
	#define errp(...) fprintf(stderr, __VA_ARGS__)
	#define dbg(...) errp("[%s]: ", #__VA_ARGS__), dbg_str(__VA_ARGS__)
#else
	#define errp(...)
	#define dbg(...)
#endif
template <typename U, typename V> string to_string (pair<U, V>);
string to_string (const string& e_) { return "\"" + e_ + "\""; }
string to_string (char e_) { return "\'" + string(1, e_) + "\'"; }
string to_string (bool e_) { return e_ ? "true" : "false"; }
template <typename T> string to_string (T e_) {
	string s_ = "[ ";
	for (const auto& x_ : e_) s_ += to_string(x_) + " ";
	return s_ + "]";
}
template <typename U, typename V> string to_string (pair<U, V> e_) {
	return "(" + to_string(e_.first) + ", " + to_string(e_.second) + ")";
}
void dbg_str () { errp(" \n"); }
template <typename U, typename... V> void dbg_str (U u, V... v) {
	errp(" %s", to_string(u).c_str()); dbg_str(v...);
}
/* --- */
const int N = 100010;
int a[N], dp[N];
int mod = 1000000007;

int main () {
	ios_base::sync_with_stdio(0); cin.tie(0);
	/* --- */
	int n, m, x;
	cin >> n >> m;
	for(int i = 0; i < m; i++){
		cin >> x;
		a[x] = 1;
	}

	dp[0] = 1;
	if(a[1]) dp[1] = 0;
	else dp[1] = 1;

	for(int i = 2; i <= n; i++){
		if(!a[i]) dp[i] = (dp[i-1] + dp[i-2]) % mod;
		else dp[i] = 0;

	}
	cout << dp[n];
}	

Measured memory_bytes: 1024