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

using namespace std;
using ll = long long;

vector<vector<pair<int,int>>> G;
vector<vector<double>> dp;

bool solve() {
    int n,m,p,a,b;
    cin>>n>>m>>p>>a>>b;
    --a;
    --b;
    if(n==0)return false;

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

    G.resize(m);

    for(int i = 0;i < p;++i) {
        int x,y,z;
        cin>>x>>y>>z;
        --x,--y;
        G[x].emplace_back(y,z);
        G[y].emplace_back(x,z);
    }

    //sort(tic.begin(),tic.end());
    dp.assign(1<<n,vector<double>(m,1000000.0));

    dp[0][a]=0;

    for(int bit = 0;bit < 1<<n;++bit) {
        for(int i = 0;i < n;++i) {
            if((bit&(1<<i))==0)continue;
            for(int j = 0;j < m;++j) {
                for(auto e:G[j]) {
                    dp[bit][e.first]=min(dp[bit][e.first],dp[bit-(1<<i)][j]+(double)e.second/tic[i]);
                }
            }
        }
    }
    double ans=1000000.0;
    for(int i=0;i<(1<<n);i++){
        ans=min(ans,dp[i][b]);
    }
    if(ans!=1000000.0)cout<<ans<<endl;
    else cout<<"Impossible"<<endl;

    G.clear();
    return true;
}

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



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

vector<vector<int>> to;
vector<int>ans;

void dfs(int v, int p = -1){
  for(auto u :to[v]){
    if(u==p) continue;
    ans[u] += ans[v];
    dfs(u,v);
  }
}

int main() {
  int n, q;;
  cin >> n >> q;
  to.resize(n);
  rep(i,n-1){
    int a, b;
    cin >> a >> b;
    --a; --b;
    to[a].push_back(b);
    to[b].push_back(a);
  }
  ans.resize(n);
  rep(i,q){
    int p, x;
    cin >> p >> x;
    --p;
    ans[p]+=x;
  }
  dfs(0);
  rep(i,n) {
    cout << ans[i] << endl;
  }
  return 0;
}


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

using ll = long long;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define ddrep(i, n) for (int i = n; i > 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define ssrep(i, s, t) for (int i = s; i <= t; ++i)

#define rng(a) a.begin(), a.end()
#define rrng(a) a.rbegin(), a.rend()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second

#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))

using pi = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vs = vector<string>;
using vvs = vector<vs>;
using ld = long double;

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
    os << "(" << p.first << "," << p.second << ")";
    return os;
}

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
    os << "{";
    rep(i, (int)v.size()) {
        if (i)
            os << ",";
        os << v[i];
    }
    os << "}";
    return os;
}

template <typename T, size_t S> void printArray(const T (&array)[S]) {
    for (auto val : array)
        std::cout << val << ", ";
    std::cout << "\n";
}

const int mod = 1e9 + 7;
const int inf = 1e9 + 5;

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

    int l, r, d; std::cin >> l >>r >> d;
    int ans = 0;
    srep(i, l, r+1) {
        ans += (i % d == 0);
    }
    std::cout << ans << "\n";
}


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


int main() {
  int N,K;
  int n = 1;
  cin >> N >> K;
  for(int i=0;i<N;i++){
    if((2*n)>(n+K)){
        n += K;
    }
    else{
        n *= 2;
    }
  }
  cout << n << endl;
 }

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ff        first
#define ss        second
#define ll        long long
#define int       long long
#define inf       ((ll)1e18)
#define mod       1000000007
#define double    long double
#define ull       unsigned long long
#define vi        vector<ll>
#define ppi       pair<int,int>
#define pii       pair<pair<int,int>,int>
#define pb        push_back
#define pi        2*acos(0.0)
#define rev       greater<int>()
#define pr(a,x,y) for(int i=x;i<y;i++){cout<<a[i]<<" ";}
#define sp(x,y)   fixed<<setprecision(y)<<x
#define w(x)      ll x; cin>>x; while(x--)
#define all(v)    v.begin(), v.end()
#define rall(v)   v.rbegin(), v.rend()
#define test      cout<<"This is test"<<endl;
#define str       string
#define endl      '\n'
#define e         cout<<'\n';
void kehsihba(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	/*#ifndef ONLINE_JUDGE
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif*/
}
/*ll get(ll *arr,ll low,ll high,ll n){
	int mid=low+(high-low)/2;
	if((mid==0 or arr[mid-1]<=arr[mid]) and (mid==(n-1) or arr[mid+1]<=arr[mid])){
		return arr[mid];
	}
	else if(mid>0 and arr[mid-1]>arr[mid]){
		return get(arr,low,mid-1,n);
	}
	else{
		return get(arr,mid+1,high,n);
	}
}*/
/*ll get(int *arr,int n,int left,int i){
	if(i==n){return 1;}
	int curr=arr[i];
	int right=get(arr,n,arr[i]*left,i+1);
	arr[i]=left*right;
	return curr*right;
}*/
/*ll get(int *arr,int n){
	int low=0,high=n-1;
	while(low<=high){
		int mid=low+(high-low)/2;
		int prev=(mid-1+n)%n;
		int next=(mid+1)%n;
		if(arr[mid]<=arr[prev] and arr[mid]<=arr[next]){
			return mid;
		}
		else if(arr[low]<=arr[mid]){
			low=mid+1;
		}
		else if(arr[high]>=arr[mid]){
			high=mid-1;
		}
	}
}*/
/*void get(map<str,int>&m,str s,str ans=""){
	if(s.size()==0){cout<<ans;e;return;}
	for(int i=1;i<=(int)s.size();i++){
		str x=s.substr(0,i);
		if(m[x]){
			get(m,s.substr(i),ans+" "+x);
		}
	}
}*/
void solve(){
	ll n;cin>>n;
	ll arr[n];
	ll x=0;
	for(int i=0;i<n;i++){
		cin>>arr[i];
		x+=arr[i];
	}
	int product=0;
	int sum=arr[n-1];
	for(int i=n-2;i>=0;i--){
	product = ((product%mod) + ((arr[i]%mod)*(sum%mod))%mod)%mod;
	sum = sum + arr[i];
	}
	cout<<product;
}
int32_t main(){
	kehsihba();
	//init();
	ll t=1;
	//cin>>t;
	for(int k=1;k<=t;k++){
		//cout<<"Case #"<<k<<": ";
		solve();
		//e;
	}
}


Measured memory_bytes: 5172
#!/usr/bin/env python3
import sys
from heapq import heappush, heappop, heapify
from math import ceil
sys.setrecursionlimit(10**8)
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return [LIST() for _ in range(n)]


INF = float("inf")
MOD = 10**9 + 7
EPS = 1e-6


def main():
    H, W, K = MAP()
    x1, y1, x2, y2 = LIST()
    x1, y1, x2, y2 = x1 - 1, y1 - 1, x2 - 1, y2 - 1
    c = [[c for c in input()] for i in range(H)]
    dist = [[INF] * W for i in range(H)]
    dist[x1][y1] = 0

    # 0123: 上下左右
    stack = [(0, x1, y1, 0), (0, x1, y1, 1),
             (0, x1, y1, 2), (0, x1, y1, 3)]
    head = 0
    while head < len(stack):
        curr, x, y, d = stack[head]
        head += 1
        c[x][y] = "@"
        # print(curr, x, y, d, head)
        # print(stack)
        if d == 0:
            dx, dy = 1, 0
        elif d == 1:
            dx, dy = 0, 1
        elif d == 2:
            dx, dy = -1, 0
        else:
            dx, dy = 0, -1
        flag = True
        for i in range(1, K + 1):
            xx = x + i * dx
            yy = y + i * dy
            if not(0 <= xx < H) or not(0 <= yy < W) or c[xx][yy] == "@":
                flag = False
                break
            if (xx, yy) == (x2, y2):
                print(int(ceil(curr + 1 / K - EPS)))
                return
            if dist[xx][yy] > curr + 1:
                dist[xx][yy] = curr + 1
                stack.append((curr + 1, xx, yy, (d - 1) % 4))
                stack.append((curr + 1, xx, yy, (d + 1) % 4))
        if flag:
            if dist[xx][yy] >= curr + 1:
                stack.append((curr + 1, xx, yy, d))
    print(-1)
    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 443868
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
#include <iomanip>
#include <map>
using namespace std;

int main() {
    int a, b, c;
    cin >> a >> b >> c;
    int ans = b + c - a;
    if (ans < 0) cout << 0 << endl;
    else cout << ans << endl;
}


Measured memory_bytes: 256
n,k = map(int,input().split())
tel = [int(e)-1 for e in input().split()]

pl = [0]
for i in range(2*n+1000):
    nxt = tel[pl[-1]]
    pl.append(nxt)

if k < n + 1:
    print(pl[k]+1)
    exit()

loop_end = n
loop_start = n-1
while pl[loop_start] != pl[loop_end]:
    loop_start -= 1

#pl[loop_start] == pl[loop_end]
period = loop_end - loop_start

k %= period

while k < n:
    k += period

print(pl[k]+1)

Measured memory_bytes: 32320
import core.bitop;
import std.algorithm;
import std.ascii;
import std.bigint;
import std.conv;
import std.functional;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.random;
import std.typecons;
import std.container;

alias sread = () => readln.chomp();
ulong bignum = 1_000_000_007;
alias SugarWater = Tuple!(long, "swater", long, "sugar");

T lread(T = long)()
{
    return readln.chomp.to!T();
}

T[] aryread(T = long)()
{
    return readln.split.to!(T[])();
}

void scan(TList...)(ref TList Args)
{
    auto line = readln.split();
    foreach (i, T; TList)
    {
        T val = line[i].to!(T);
        Args[i] = val;
    }
}

void main()
{
    long n = lread(), ans;
    if(n >= 0)
        ans += min(10 - 1, n - 1 + 1);
    if(n >= 100)
        ans += min(1000 - 100, n - 100 + 1);
    if(n >= 10_000)
        ans += min(100_000 - 10_000, n - 10_000 + 1);
    
    ans.writeln();
}

Measured memory_bytes: 256
//#include <boost/multiprecision/cpp_dec_float.hpp>
//#include <boost/multiprecision/cpp_int.hpp>
#include <stdio.h>
#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <math.h>
#include <algorithm>
using namespace std;
//namespace mp = boost::multiprecision;
//using llll = mp::cpp_int;
// 仮数部が1024ビットの浮動小数点数型(TLEしたら小さくする)
//using Real = mp::number<mp::cpp_dec_float<1024>>;
using ll = long long;
const double EPS = 1e-10;
const ll MOD = 7+(1e+9);

int main(){
  ll h,w;
  cin>>h>>w;
  vector<string>s(h);
  vector<vector<ll> >v(h,vector<ll>(w,0));
  for(ll i=0;i<h;i++){
    cin>>s[i];
    for(ll j=0;j<w;j++){
      if(s[i][j]=='#')v[i][j]=1;
    }
  }
  vector<vector<ll> >a(h,vector<ll>(w,0));
  vector<vector<ll> >b(w,vector<ll>(h,0));
  vector<vector<ll> >aa(h);
  vector<vector<ll> >bb(w);
  for(ll i=0;i<h;i++){
    ll tm=1;
    ll tmp=0;
    aa[i].push_back(0);
    for(ll j=0;j<w;j++){
      if(v[i][j]==0){
        tmp++;
        a[i][j]=tm;
      }
      else{
        if(tmp!=0){
          aa[i].push_back(tmp);
          tmp=0;
          tm++;
        }
      }
    }
    if(tmp!=0){
      aa[i].push_back(tmp);
      tmp=0;
      tm++;
    }
  }
  for(ll i=0;i<h;i++){
    for(ll j=0;j<w;j++){
      a[i][j]=aa[i][a[i][j]];
    }
  }
  for(ll i=0;i<w;i++){
    ll tm=1;
    ll tmp=0;
    bb[i].push_back(0);
    for(ll j=0;j<h;j++){
      if(v[j][i]==0){
        tmp++;
        b[i][j]=tm;
      }
      else{
        if(tmp!=0){
          bb[i].push_back(tmp);
          tmp=0;
          tm++;
        }
      }
    }
    if(tmp!=0){
      bb[i].push_back(tmp);
      tmp=0;
      tm++;
    }
  }
  for(ll i=0;i<w;i++){
    for(ll j=0;j<h;j++){
      b[i][j]=bb[i][b[i][j]];
    }
  }
  ll ans=0;
  for(ll i=0;i<h;i++){
    for(ll j=0;j<w;j++){
      ans=max(ans,a[i][j]+b[j][i]-1);
    }
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 116480
import java.util.*;

public class Main{
	
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
  	String s=sc.next(),test="";
    char[] ch=s.toCharArray();
    int n=9;
    if(s.length()>n){
      System.out.println("NO");
    }else if(s.length()==n){
      if(s.equals("AKIHABARA")){
        System.out.println("YES");
      }else{
        System.out.println("NO");
      }
    }else{
      for(int i=0;i<ch.length;i++){
        if(i==0){
          if(ch[i]=='K'){
            test+="A"+ch[i];
            
          }else{
            test+=ch[i];
          }
        }else if(i==ch.length-1){
          if(ch[i]=='A'){
            test+=ch[i];
          }else{
            test+=(ch[i]+"A");
          }
        }else{
          if(ch[i]=='K'){
            if(ch[i-1]=='A'){
              test+=ch[i];
            }else{
              test+=("A"+ch[i]);
            }
          }else if(ch[i]=='H'){
            if(ch[i+1]=='A'){
              test+=ch[i];
            }else{
              test+=(ch[i]+"A");
            }
          }else if(ch[i]=='B'){
            if(ch[i+1]=='A'){
              test+=ch[i];
            }else{
              test+=(ch[i]+"A");
            }
          }else if(ch[i]=='R'){
            if(ch[i+1]=='A'){
              test+=ch[i];
            }else{
              test+=(ch[i]+"A");
            }
          }else{
            test+=ch[i];
          }
        }
      }
      if(test.equals("AKIHABARA")){
        System.out.println("YES");
      }else{
        System.out.println("NO");
      }
    }
  }
}


Measured memory_bytes: 23764
// #pragma GCC optimize "trapv"
#include<bits/stdc++.h>
#define faster ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
using namespace std;
int f[100000];

int final(int *a,int i,int n)
{
    //if (i==n)
      //  return 10000000;
    if (f[i]!=-1)
       return f[i];
    f[i]= min(final(a,i+1,n)+abs(a[i]-a[i+1]),final(a,i+2,n)+abs(a[i]-a[i+2]));
    return f[i];
}

signed main()
{
   faster;
   //#ifndef ONLINE_JUDGE
     //freopen("ip.txt", "r", stdin);
     //freopen("op.txt", "w", stdout);
  // #endif
    //  int t;cin>>t;
    //  t=1;
     //while(t--)
     {
        int n;
        cin>>n;
        for (int i=0;i<n;i++)  f[i]=-1;
        int a[n];
        for (int i=0;i<n;i++)
            cin>>a[i];
            f[n-1]=0;
            f[n-2]=abs(a[n-1]-a[n-2]);
        cout<<final(a,0,n);

     }
}

Measured memory_bytes: 4992
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<math.h>
#include<queue>
#include<deque>
#include<stack>
#include<cstdio>
#include<utility>
#include<set>
#include<list>
#include<cmath>
#include<stdio.h>
#include<string.h>
#include<iomanip>
using namespace std;
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define REP(i, n) FOR(i, 0, n - 1)
#define NREP(i, n) FOR(i, 1, n)
using ll = long long;
using pii = pair<int, int>;
using piii = pair<pii, pii>;
const int dx[4] = { 0, -1, 1, 0 };
const int dy[4] = { -1, 0, 0, 1 };
const int INF = 1e9 + 7;
int gcd(int x, int y) {
	if (x < y)swap(x, y);
	if (y == 0)return x;
	return gcd(y, x%y);
}

template<class T1, class T2> void chmin(T1 &a, T2 b) { if (a>b)a = b; }

template<class T1, class T2> void chmax(T1 &a, T2 b) { if (a<b)a = b; }
template<class T>
void Add(T &a, const T &b, const T &mod = 1000000007) {
	int val = ((a % mod) + (b % mod)) % mod;
	if (val < 0) { val += mod; }
	a = val;
}
////////////////////////////////////////
ll N, Z, W;
vector<ll>a;
int main() {
	cin >> N >> Z >> W;
	a.resize(N);
	REP(i, N)cin >> a[i];
	if (N == 1) {
		cout << abs(a[0] - W) << endl;
	}
	else {
		cout << max(abs(a[N - 1] - W), abs(a[N - 1] - a[N - 2])) << endl;
	}

	return 0;
}


Measured memory_bytes: 256
import bisect


N, M = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(N)]
AB.sort(key=lambda x: x[1], reverse=True)
memo = [x for x in range(N)]
ans = 0
for a, b in AB:
    if M < a:
        continue
    Ma = M - a
    i = bisect.bisect_right(memo, Ma)
    if i > 0:
        del memo[i - 1]
        ans += b
print(ans)

Measured memory_bytes: 31884
# フェルマーの小定理
K = int(input())
S = input()

m = 1000000007


def make_factorial_table(n):
    result = [0] * (n + 1)
    result[0] = 1
    for i in range(1, n + 1):
        result[i] = result[i - 1] * i % m
    return result


def mcomb(n, k):
    if n == 0 and k == 0:
        return 1
    if n < k or k < 0:
        return 0
    return fac[n] * pow(fac[n - k], m - 2, m) * pow(fac[k], m - 2, m) % m


fac = make_factorial_table(len(S) - 1 + K)

result = 0
for i in range(K + 1):
    result += pow(26, K - i, m) * mcomb(len(S) - 1 + i, i) * pow(25, i, m)
    result %= m
print(result)


Measured memory_bytes: 107488
#include<iostream>
#include <bits/stdc++.h>
using namespace std;
int main()
{
   int a,b ;
   cin >> a >> b ;
  
  if(a+b>(a-b)){
    if(a+b>(a*b)){
         cout << a+b << endl ;
    }else{
         cout << a*b << endl ;
    }
  }else{
    if(a-b>a*b){
         cout << a-b << endl ;
    }else{
         cout << a*b << endl ;
    }
  }
  
     
    return 0;
}



Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <math.h>
#include <queue>
#include <stack>
#include <list>
#include <functional>

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

int N;
char S[1234];
int memo[1234][16];

int dp(int i, int h) {
	if (memo[i][h] != -1) return memo[i][h];
	if (!((1 << S[i - 1]) & h)) return memo[i][h] = 0;
	if (i == 1) {
		if (1 & h) return memo[i][h] = 1;
		else return memo[i][h] = 0;
	}
	memo[i][h] = 0;
	rep(c, 8) {
		if ((!((1 << 0) & h) || ((1 << 0) & h && h & c)) &&
			(!((1 << 1) & h) || ((1 << 1) & h && h & c)) &&
			(!((1 << 2) & h) || ((1 << 2) & h && h & c))) {
			memo[i][h] += dp(i - 1, c);
		}
	}
	return memo[i][h] %= 10007;
}

int main() {

	memset(memo, 0xff, sizeof(memo));

	scanf("%d", &N);
	scanf("%s", S);

	rep(i, N) {
		switch (S[i]) {
		case 'J':
			S[i] = 0;
			break;
		case 'O':
			S[i] = 1;
			break;
		case 'I':
			S[i] = 2;
			break;
		}
	}

	int a = 0;

	rep(i, 8) {
		a += dp(N, i);
	}

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

	return 0;
}

Measured memory_bytes: 2796
import math

if __name__ == "__main__":
    N = int(input())
    f = {i: 0 for i in range(1, N + 1)}
    for x in range(1, int(math.sqrt(N)) + 2):
        for y in range(1, int(math.sqrt(N)) + 2):
            for z in range(1, int(math.sqrt(N)) + 2):
                try:
                    f[((x + y) ** 2 + (y + z) ** 2 + (z + x) ** 2) // 2] += 1
                except KeyError:
                    pass
    for i in range(1, N + 1):
        print(f[i])

Measured memory_bytes: 69236
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <climits>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <stack>
#include <queue>
#include <algorithm>
#include <iostream>
#include <string>

#define REP(i,n) for(int i=0;i<n;++i)
#define REPR(i,n) for(int i=n;i>=0;--i)
#define REPI(itr,v) for(auto itr=v.begin();itr!=v.end();++itr)
#define REPIR(itr,v) for(auto itr=v.rbegin();itr!=v.rend();++itr)
#define FOR(i,a,b) for(int i=a;i<b;++i)
#define SORT(v,n) sort(v, v+n)
#define SORTV(v) sort(v.begin(), v.end())
#define ALL(v) v.begin(),v.end()
#define llong long long
#define INF 999999999
#define SUR 1000000007
#define pb(a) push_back(a)
#define pf(a) push_front(a)
#define MP make_pair

int dx[] = {0, 0, -1, 1};
int dy[] = {1, -1, 0, 0};

using namespace std;

typedef pair<int,int> pii;

int table[30][100001];

int main(){

  int n, chan;
  vector<int> s, t, c;

  scanf("%d %d", &n, &chan);
  REP(i,n){
    int t1, t2, t3;
    scanf("%d %d %d", &t1, &t2, &t3);
    t1--; t3--;
    s.pb(t1);
    t.pb(t2);
    c.pb(t3);
  }

  REP(i,n){
    table[c[i]][s[i]]++;
    table[c[i]][t[i]]--;
  }

  FOR(i,1,100001){
    REP(j,chan){
      table[j][i] += table[j][i - 1];
    }
  }
    
  int ans = 0;
  REP(i,100001){
    int num = 0;
    REP(j,chan){
      if(table[j][i] > 0){
        num++;
      }
    }
    ans = max(ans, num);
  }

  printf("%d\n", ans);
  return 0;
}



Measured memory_bytes: 13420
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll, ll> Pll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repn(i, n) for (int i = 0; i <= (int)(n); i++)
#define srep(i, l, n) for (int i = l; i < (int)(n); i++)
#define srepn(i, l, n) for (int i = l; i <= (int)(n); i++)
#define pb push_back 
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

const int MOD = 1000000007;
const int INF = 1e9;
#define PI 3.14159265369;
int dx[4] = {1,-1,0,0};
int dy[4] = {0,0,1,-1};
int ddx[8] = {1,1,1,-1,-1,-1,0,0};
int ddy[8] = {0,1,-1,0,1,-1,1,-1};


int main(){
	int n, k;
	cin >> n >> k;
	vector<int> h(n);
	rep(i,n) cin >> h[i];
	sort(h.rbegin(), h.rend());

	ll ans = 0;
	rep(i,n){
		if(i < k) continue;
		ans += h[i];	
	}
	cout << ans << endl;
}

Measured memory_bytes: 1024
#include<iostream>
#include<stack>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
	string region;
	cin >> region;
	stack<int> S1;
	stack<pair<int,int>> S2;
	int sum = 0;
	for (int i = 0; i < region.length(); i++)
	{
		char c = region[i];
		if (c == '\\')
			S1.push(i);
		else if (c == '/' && !S1.empty())
		{
			int j = S1.top();
			S1.pop();
			sum += (i - j);
			int curArea = i - j;
			while (!S2.empty() && S2.top().first > j)
			{
				curArea += S2.top().second;
				S2.pop();
			}
			S2.push(make_pair(j, curArea));
		}
	}
	cout << sum << endl;
	vector<int> area;
	while (!S2.empty())
	{
		area.push_back(S2.top().second);
		S2.pop();
	}
	reverse(area.begin(), area.end());
	cout << area.size();
	for (int i = 0; i < area.size(); i++)
	{
		cout << " ";
		cout << area[i];
	}
	cout << endl;
}


Measured memory_bytes: 3252
package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)

	s := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&s[i])
	}

	var min int
	first := true
	for i := -100; i <= 100; i++ {
		cost := 0
		for _, v := range s {
			cost += (v - i) * (v - i)
		}

		if first {
			min = cost
			first = false
		}

		if min > cost {
			min = cost
		}
	}

	fmt.Println(min)
}


Measured memory_bytes: 1760
let n = read_int () in
let ans = ref max_int in
let rec sum n = if n <= 0 then 0 else n mod 10 + sum (n / 10) in
for a = 0 to 9 do
  for b = 0 to 9 do
    for c = 0 to 9 do
      for d = 0 to 9 do
        for e = 0 to 9 do
          let a_sum = a + b + c + d + e in
          if a_sum > 0 then
            let a' = 10000 * a + 1000 * b + 100 * c + 10 * d + e in
            if a' < n then ans := min !ans @@ a_sum + sum (n - a')
        done
      done
    done
  done
done;
Printf.printf "%d\n" !ans

Measured memory_bytes: 384
/*************************************************************************
     File Name: C.cpp
     ID: obsoles1
     PROG: 
     LANG: C++ 
     Mail: 384099319@qq.com 
     Created Time: 一  8/29 21:22:01 2016
 ************************************************************************/
#define MAX(x,y) ((x)>(y)?(x):(y))
#define MIN(x,y) ((x)<(y)?(x):(y))
#define EACH(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();++it)
#define ABS(x,y) ((x)>(y)?((x)-(y)):((y)-(x)))
#define MEM0(x) memset(x,0,sizeof(x))
#define MEM1(x) memset(x,-1,sizeof(x))
#define MEMX(x) memset(x,0x3f,sizeof(x))
#define pb push_back
#include<iostream>
#include<cstring>
using namespace std;
typedef long long LL;
const int N=60;
LL dp[N][N*N];
int x[N];

int main() {
  int n,m,i,j,k,tmp;
  ios::sync_with_stdio(0);
  while (cin>>n>>m) {
    for (i=1; i<=n; ++i) cin>>x[i];
    MEM1(dp);
    dp[0][0]=1;
    for (k=1,tmp=0; k<=n; ++k) {
      tmp+=x[k];
      for (i=k; i>=1; --i)
        for (j=tmp; j>=x[k]; --j) {
          if (dp[i-1][j-x[k]] == -1) continue;
          if (dp[i][j] == -1) dp[i][j]=0;
          dp[i][j]+=dp[i-1][j-x[k]];
          //cout<<"dp["<<i<<"]["<<j<<"]="<<dp[i][j]<<endl;
        }
    }
    LL ans=0;
    for (i=1; i<=n; ++i)
      if (dp[i][i*m] != -1)
        ans+=dp[i][i*m];
    cout<<ans<<endl;
  }
}


Measured memory_bytes: 1920
/***************************************************
 * Problem Name : C.cpp
 * Problem Link :
 * OJ           :
 * Verdict      : Trying
 * Date         : 2020-05-31
 * Problem Type :
 * Author Name  : Saikat Sharma
 * University   : CSE, MBSTU
 ***************************************************/
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <climits>
#include <cstring>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <list>
#include <unordered_map>
#include <unordered_set>
#include <cstdlib>
#include <deque>
#include <stack>
#include <bitset>
#include <cassert>
#include <map>
#include <set>
#include <cassert>
#include <iomanip>
#include <random>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

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

#define __FastIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define __FileRead freopen ("input.txt", "r", stdin)
#define __FileWrite freopen ("output.txt", "w", stdout)
#define SET(a,v) memset(a,v,sizeof(a))
#define SZ(v) (int)v.size()
#define pii pair<int,int>
#define pil pair <int, ll>
#define pli pair <ll, int>
#define pll pair <ll, ll>
#define debug cout <<"######\n"
#define debug1(x) cout <<"### " << x << " ###\n"
#define debug2(x,y) cout <<"# " << x <<" : "<< y <<" #\n"
#define nl cout << "\n";
#define sp cout << " ";
#define sl(n) scanf("%lld", &n)
#define sf(n) scanf("%lf", &n)
#define si(n) scanf("%d", &n)
#define ss(n) scanf("%s", n)
#define pf(n) scanf("%d", n)
#define pfl(n) scanf("%lld", n)
#define all(v) v.begin(), v.end()
#define rall(v) v.begin(), v.end()
#define srt(v) sort(v.begin(), v.end())
#define r_srt(v) sort(v.rbegin(), v.rend())
#define rev(v) reverse(v.rbegin(), v.rend())
#define Sqr(x) ((x)*(x))
#define Mod(x, m) ((((x) % (m)) + (m)) % (m))
#define max3(a, b, c) max(a, max(b, c))
#define min3(a, b, c) min(a, min(b, c))
#define pb push_back
#define mk make_pair
#define F first
#define S second
#define MAX 100005
#define INF 1000000009
#define MOD 1000000007

template<class T>
using min_heap = priority_queue<T, std::vector<T>, std::greater<T>>;
template<typename T>
using ordered_set  = tree<T, null_type, less<T>, rb_tree_tag,
      tree_order_statistics_node_update>;

template <typename T> string toString ( T Number ) {
    stringstream ss;
    ss << Number;
    return ss.str();
}
template<typename T> int toInt (T str) {
    stringstream ss;
    ss << str;
    int num;
    ss >> num;
    return num;
}
ll lcm ( ll a, ll b ) {
    return ( a / __gcd ( a, b ) ) * b;
}
/************************************ Code Start Here ******************************************************/

int main () {
    __FastIO;
    //~ cout << setprecision (10) << fixed;
    ull A;
    long double B;
    cin >> A >> B;
    ull sum = (ull)(A * B);
    cout << sum << "\n";
    return 0;
}


Measured memory_bytes: 3748
n=int(input())
a=[]
k=0

if n==0:
    print(0)

while k<1:
    if n==0:
        k=1
    else:
        if n%2==0:
            a.append(0)
            n=n/(-2)
        else:
            a.append(1)
            n=(n-1)/(-2)
            
for i in (reversed(a)):
    print(i,end="")

Measured memory_bytes: 3444
digitSum n
    | n < 10 = n
    | otherwise = r + digitSum q
  where (q, r) = divMod n 10

inRange x a b = a <= x && x <= b

main = do
    [n, a, b] <- map read . words <$> getLine :: IO [Int]
    print $ sum [i | i <- [1..n], inRange (digitSum i) a b]


Measured memory_bytes: 3872
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
const long long LINF = 1e18;
#define dump(x)  cout << 'x' << ' = ' << (x) << ` `;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
typedef long long ll;
using namespace std;
typedef pair<ll, ll> P;

template<typename T>
void print(const vector<T> &x) {
    int n = x.size();
    rep(i,n) {
        cout << x[i];
        if (i!=n-1) cout<<" ";
        else cout << endl;
    }
}

template<typename T>
void print(const vector<vector<T>> &x) {
    int n = x.size();
    rep(i,n) {
        rep(j,x[i].size()) {
            cout << x[i][j] << " ";
        }
        cout << endl;
    }
}

template<typename T>
void print(const vector<T> &x, int n) {
    rep(i,n) {
        cout << x[i];
        if (i!=n-1) cout<<" ";
        else cout << endl;
    }
}

template<typename T>
void print(const vector<vector<T>> &x, int n, int m) {
    rep(i,n) {
        rep(j,m) {
            cout << x[i][j] << " ";
        }
        cout << endl;
    }
}

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

void input_init() {
    cin.tie(0); ios::sync_with_stdio(false);
}

int main(int argc, char const *argv[]) {
    int n; cin>>n;
    vector<ll> b(n-1);
    rep(i,n-1) cin>>b[i];

    ll ans = 0;
    ans += b[0];
    for (int i = 0; i < n-2; ++i) {
        ans += min(b[i],b[i+1]);
    }
    ans += b.back();

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

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <map>
#include <queue>
#include <list>
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,a,b) for(int i=int(a);i<int(b);++i)
#define crep(i) for(char i='a';i<='z';i++)
#define psortsecond(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.second<b.second;});
#define psortfirst(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.first<b.first;});
#define ALL(x) (x).begin(),(x).end()
int ctoi(const char c){
  if('0' <= c && c <= '9') return (c-'0');
  return -1;
}
using namespace std;
using pii  = pair<int,int>;
long long gcd(long long a, long long b){return (b == 0 ? a : gcd(b, a%b));}
long long lcm(long long a, long long b){return a*b/gcd(a,b);}
typedef long long ll;
#define MOD 1000000007
#define EPS 10e-8

int main(void){
  ll n;
  cin >> n;
  ll c[508], s[508], f[508];
  rep(i, n - 1){
    cin >> c[i] >> s[i] >> f[i];
  }

  rep(i, n){
    ll t = 0;
    for(int j = i; j < n - 1; j++){
      if(t < s[j]){
        t = s[j];
      }
      else if(t % f[j] == 0){
      }
      else {
        t += f[j] - t % f[j];
      }
      t += c[j];
    }
    cout << t << endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define IO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
int dp[3005][3005], n, k;
int arr[1005];
string a, b;
ll mod = 1e9 + 7;
int solve(int i, int j) {
	if (i >= a.size() || j >= b.size())
		return 0;
	if (~dp[i][j])
		return dp[i][j];
	if (a[i] == b[j])
		return dp[i][j] = 1 + solve(i + 1, j+1);
	return dp[i][j] = max(solve(i + 1, j), solve(i, j + 1));
}
void build (int i, int j){
	if (i >= a.size() || j >= b.size())
		return;
	if (solve(i, j) == 1 + solve(i + 1, j + 1) && a[i] == b[j]){
		cout << a[i];
		build(i + 1, j + 1);
	}
	else if (solve(i, j) == solve(i + 1, j)){
		build(i + 1, j);
	}
	else
		build(i, j + 1);
}
int main() {
	IO
	cin >> a >> b;
	memset(dp, -1, sizeof dp);
	solve(0, 0);
	build(0, 0);
	return 0;
}


Measured memory_bytes: 35968
#include "bits/stdc++.h"
using namespace std;

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

    string tmp = t;

    set< string > st;
    int n = s.size();
    int m = t.size();

    for (int i = 0; i + m - 1 < n; ++i) {
        string z = s;
        z.replace(i, m, t);

        bool ok = true;
        for (int j = 0; j < n; ++j) {
            if (s[j] == '?') continue;
            if (s[j] != z[j]) ok = false;
        }

        if (ok) {
            for (char &c : z) if (c == '?') c = 'a';
            st.emplace(z);
        }
    }

    if (m > n or st.empty()) puts("UNRESTORABLE");
    else cout << *st.begin() << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <tgmath.h>
#include <algorithm>
#include <iomanip>

using namespace std;

int main(){
    int N;
    cin >> N;
    vector<pair<int, int>> X(N);
    for(int i = 0; i < N; ++i){
        int x, y;
        cin >> x >> y;
        X[i] = make_pair(x, y);
    }
    sort(X.begin(), X.end());

    long double sumXY = 0;
    int ind = 0;
    do{
        ind++;
        for(int i = 0; i < N-1; ++i){
            long double x1 = X[i].first;
            long double x2 = X[i+1].first;
            long double y1 = X[i].second;
            long double y2 = X[i+1].second;
            sumXY += sqrtl(static_cast<long double>((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)));
        }
    }while(next_permutation(X.begin(), X.end()));

    long double Nkai = 1;
    for(int i = 2; i <= N; ++i){
        Nkai *= i;
    }
    // cout << ind << endl;
    cout << setprecision(10) << (sumXY)/Nkai << endl;
                 

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <iostream>
#include <queue>
#include <unordered_map>
#include <cmath>
#include <queue>
#include <string>
#include <random>
#include <stack>
#include <set>
#include <unordered_set>

#define bug(x) cout<<"zdongdebug: "<<x<<endl;
#define bug2(x, y) cout<<"zdongdebug: "<<x<<" "<<y<<endl;
using namespace std;
typedef long long ll;
const int maxn = 305;
const int mod = 1000000007;

int get(int x){
  if(x==1)return 300000;
  if(x==2)return 200000;
  if(x==3)return 100000;
  return 0;
}

int main() {
#ifdef suiyuan2009
  freopen("/Users/suiyuan2009/CLionProjects/icpc/input.txt", "r", stdin);
  //freopen("/Users/suiyuan2009/CLionProjects/icpc/output.txt", "w", stdout);
#endif
  int x,y;
  cin>>x>>y;
  int ret = get(x)+get(y)+(x+y==2?400000:0);
  cout<<ret<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
#define SUM(a)  accumulate((a).begin(),(a).end(),0)
#define SORT(a) sort(ALL(a))
#define REV(a) reverse(ALL(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
typedef long long ll;
const int INTINF = 1<<30;
const ll LLINF = 1LL<<62;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
const int DX[8]={ 0, 1, 0,-1, 1, 1,-1,-1};
const int DY[8]={ 1, 0,-1, 0, 1,-1, 1,-1};


int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll a,b,x;
  cin >> a >> b >> x;
  a += (x-(a%x))%x;
  if (b<a)cout << 0 << endl;
  else cout << (b-a) / x + 1<< endl;
}


Measured memory_bytes: 256
import java.util.*;
class Main{
	static Scanner sc;
	static String instr,outstr,tmpstr;
	static int tim;
	public static void main(String[]args){
		char[][] ch = { {},
									{' ', '.', ',', '!', '?'},
                  {'c', 'a', 'b'},
                  {'f', 'd', 'e'},
                  {'i', 'g', 'h'},
                  {'l', 'j', 'k'},
                  {'o', 'm', 'n'},
                  {'s', 'p', 'q', 'r'},
                  {'v', 't', 'u'},
                  {'z', 'w', 'x', 'y'} };
		sc=new Scanner(System.in);
		tim=sc.nextInt();
		for(int i=0;i<tim;i++){
			outstr="";
			instr=sc.next();
			while(instr.startsWith("0")){
				instr=instr.substring(1,instr.length());
			}
			
			while(instr.indexOf("0")>0){
				tmpstr=instr.substring(0,instr.indexOf("0"));
				instr=instr.substring(instr.indexOf("0")+1,instr.length());
				while(instr.startsWith("0")){
					instr=instr.substring(1,instr.length());
				}
				if(tmpstr.substring(0,1).equals("1")){
					outstr=outstr + ch[1][tmpstr.length()%5];
				}else if(tmpstr.substring(0,1).equals("7") || tmpstr.substring(0,1).equals("9")){
					outstr=outstr + ch[Integer.parseInt(tmpstr.substring(0,1))][tmpstr.length()%4];
				}else{
					outstr=outstr + ch[Integer.parseInt(tmpstr.substring(0,1))][tmpstr.length()%3];
				}
			}
			System.out.println(outstr);
		}
	}
}

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

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

		return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define all(x) x.begin(), x.end()

using namespace std;

typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
typedef long long ll;

template <typename T> void max_self(T& a, T b){
  a = max(a,b);
}

template <typename T> void min_self(T& a, T b){
  a = min(a,b);
}

void solve(){
  int n,m,x; cin>>n>>m>>x;
  vector<vi> a(n, vi(m));
  vi c(n);
  for(int i=0;i<n;i++){
      cin>>c[i];
      for(int j=0;j<m;j++)
        cin>>a[i][j];
  }
  int all = 1<<n;
  int ans = INT_MAX;
  for(int mask=0;mask<all;mask++){
    vi level(m);
    int cost = 0;
    for(int i=0;i<n;i++){
      if((mask>>i)&1){
        cost+=c[i];
        for(int j=0;j<m;j++){
          level[j] += a[i][j];
        }
      }
    }
    bool ok = true;
    for(int i=0;i<m;i++)
      if(level[i] < x) ok = false;
    if(ok)
      min_self(ans, cost);
  }
  if(ans == INT_MAX) cout<<-1<<endl;
  else
    cout<<ans<<endl;

}

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  //int t; cin >> t;
  //while(t--) solve();
  //
  solve();
  return 0;
}


Measured memory_bytes: 3648
isPrime :: Int -> Bool
isPrime num = null(filter (\x -> num `mod` x == 0) [2..floor(sqrt(fromIntegral num))])

main = do
    [x] <- map read . words <$> getLine
    let ans = head [a | a <- [2..2*x], a>=x, isPrime a ]
    putStrLn $ show ans

Measured memory_bytes: 508
#!/usr/bin/env python3
import sys


def solve(N: int, S: "List[str]"):
    print("Four" if "Y" in S else "Three")


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    S = [ next(tokens) for _ in range(N) ]  # type: "List[str]"
    solve(N, S)

if __name__ == '__main__':
    main()


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

using namespace std;

vector<int> adjList[51];

int main() {
    int N, M, A, B;
    cin >> N >> M;
    for (int i=0;i<M;i++) {
        cin >> A >> B;
        adjList[A].push_back(B);
        adjList[B].push_back(A);
    }
    for (int i=1;i<=N;i++) cout << adjList[i].size() << '\n';
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
char a;
bool b=false;
int main(){
  for(int i=0;i<3;i++){
    cin>>a;
    if(a=='7')b=true;
  }
    if(b)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}

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

typedef long long int ll;
ll MOD = 1000000007;
ll INFL = 1ll << 60;
ll INF = 1 << 28;

template <typename T>
ostream& operator<<(ostream& os, vector<T>& vec) {
  cout << "{";
  for (int i = 0; i < vec.size(); i++)
    os << vec[i] << (i + 1 == vec.size() ? "" : " ");
  cout << "}";
  return os;
}

// ====================================================================

int main() {
  int n, d;
  cin >> n >> d;
  vector<ll> v[n];
  ll x;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < d; j++) {
      cin >> x;
      v[i].push_back(x);
    }
  }

  set<ll> sq;
  for (int i = 0; i < 500; i++) {
    sq.insert(i * i);
  }

  // for (int i = 0; i < n; i++) {
  //   cout << v[i] << endl;
  // }

  ll ans = 0;
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      // cout << i << " " << j << endl;
      ll res = 0;
      for (int k = 0; k < d; k++) {
        res += pow(v[i][k] - v[j][k], 2);
        // cout << v[i][k] << " - " << v[i][k] << endl;
      }
      // cout << res << endl;
      ans += sq.count(res);
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
function Main(input) {
	input = input.trim().split("\n").map(function(x) { return x.split(" ")});
	let X = parseInt(input[0][0], 10);
	let Y = parseInt(input[0][1], 10);
	let ans = 'No';
	let tmp = 2*X;
	for (let i = 0; i <= X; i++) {
		if (tmp === Y) ans = 'Yes';
		tmp += 2;
	}
	console.log(ans);

}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 29652
n = int(input())
w = [list(input())  for i in range(n)]

past = []
flag = 0
for i in range(n):
    if i == 0:
        past.append(w[i])
    else:
        if w[i] in past:
            flag = 1
            break
        else:
            if w[i-1][-1] == w[i][0]:
                past.append(w[i])
            else:
                flag = 1
                break
if flag == 1:
    print("No")
else:
    print("Yes")

Measured memory_bytes: 38384
n=int(input())
A=list(map(int,input().split()))

if n==2:
    print(abs(A[0]-A[1]))
    print(*A)
    exit()
A.sort()
menos=[] ; plus=[]
for i in range(len(A)):
    if A[i]<0:
        menos.append(A[i])
    else:
        plus.append(A[i])
if menos==[]:
    print(sum(plus)-plus[0]*2)
    res=plus[0]
    for i in range(n-2):
        print(res, A[i+1])
        res=res-A[i+1]
    print(A[n-1], res);exit()
        
elif plus==[]:
    print(-sum(menos)+ menos[-1]*2)
    res=menos[-1]
    for i in range(n-1):
        print(res,menos[i])
        res=res-menos[i]
    exit()
    

print(sum(plus)-sum(menos))
m=len(menos); p=len(plus)
if p==1:
    res=plus[-1]
    for i in range(n-1):
        print(res,menos[i])
        res=res-menos[i]
    exit()
if m==1:
    res=menos[0]
    for i in range(n-2):
        print(res, plus[i])
        res=res-plus[i]
    print(plus[-1], res);exit()

Q= plus[1:]+ [menos[0]]
W= menos[1:]+[plus[0]] ;#print(Q,W)

res=W[-1]
for i in range(len(W)-1):
    print(res,W[i])
    res=res-W[i]
rec=Q[-1]
for i in range(len(Q)-1):
    print(rec, Q[i])
    rec=rec-Q[i]
print(res,rec)

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

namespace ConsoleApp111 {
    class Program {
        static void Main(string[] args)
        {
            string str = Console.ReadLine();
            List<int> inputInt = StringSplit(str);

            int ans = 0;
            if(inputInt[1] % inputInt[0] == 0)
            {
                ans = inputInt[0] + inputInt[1];
            }
            else
            {
                ans = inputInt[1] - inputInt[0];
            }

            Console.WriteLine(ans);
        }

        static List<int> StringSplit(string input)
        {
            string[] inputStr = input.Split(' ');
            int[] inputInt = new int[input.Length];
            List<int> inputList = new List<int>();

            foreach(string n in inputStr)
            {
                inputList.Add(int.Parse(n));
            }

            return inputList;
        }
        
    }
}

Measured memory_bytes: 13140
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using System.Text;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var AB = ReadInts();
            for (int i = 1; i <= 1009; i++)
            {
                if (Floor(i * 0.08) == AB[0])
                {
                    if (Floor(i * 0.1) == AB[1])
                    {
                        WriteLine(i);
                        return;
                    }
                }
            }
            WriteLine(-1);
        }

        private static string Read() { return ReadLine(); }
        private static string[] Reads() { return (Read().Split()); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


Measured memory_bytes: 13140
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;

const int dx[4] = {-1, 0, 0, 1};
const int dy[4] = {0, -1, 1, 0};

// Self settings
// clang-format off
#define MAX_N 100000
#define REP(i, N) for (int i = 0; i < (int)(N); ++i)
#define SLN(i,N) (i == N-1 ? "\n" : " ")
ll fact(ll n) { ll res = 1; for(ll i=2;i<=n;++i) res = res * i; return res;}
ll nCr(ll n, ll r) {return (fact(n)/fact(n-r)*fact(r)) ;}
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
const ll MOD = 1e9+7;
const ll INF = 1LL << 60;
const int inf = 1 << 31;
// clang-format on

int main(void)
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  string S;
  cin >> N >> S;

  int ans = 0;
  char prev = '*';
  for (int i = 0; i < N; i++) {
    if (prev != S[i]) {
      ans++;
    }
    prev = S[i];
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 1144
#include<iostream>
#include<cstdio>
#define MAX 101
using namespace std;
int main(){
  int N, K, d, A[MAX], x, count;
  count = 0;
  scanf("%d %d", &N, &K);
  for(int i = 0; i < N; i++){
    A[i] = 0;
  }
  for(int i = 0; i < K; i++){
    scanf("%d", &d);
    for(int j = 0; j < d; j++){
      scanf("%d", &x);
      if( A[x-1] == 0 ) A[x-1] = 1;
    }
  }
  for(int i = 0; i < N; i++){
    if(A[i] == 0) count++;
  }
  printf("%d\n", count);
  return 0;
  
}

Measured memory_bytes: 3224
N=int(input())
flist=[]

for i in range(0,N):
    t,a=map(int,input().split(" "))
    d=t+a
    flist.append([d,t,a])
#print(flist)

count=0
score=0
number=0
flist.sort(reverse=True)
#print(flist)

for count in range(0,N):
    if count%2==0:
        score+=flist[count][1]
    else:
        score-=flist[count][2]

    #print(score)
print(score)


Measured memory_bytes: 23260
/* ＵＴＦ－８ */
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <array>
#include <queue>
#include <stack>
#include <algorithm>
#include <tuple>
#include <numeric>
#include <type_traits>
#include <limits>

#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>

#define USE_COLORED 1

#ifdef USE_COLORED
static const char stdout_pre[]  = "\033[1m"; // bold black
static const char stderr_pre[]  = "\033[31;1m"; // bold red
static const char stdxxx_post[] = "\033[m";

// 当然ながら GCC(g++)/libstdc++ 依存
#include <ext/stdio_filebuf.h>
using stdio_filebuf = __gnu_cxx::stdio_filebuf<char>;
class colored_stdio_filebuf : public stdio_filebuf {
private:
	const char* const pre_;
	const char* const post_;

public:
	colored_stdio_filebuf(FILE* fp, const char* pre, const char* post) : stdio_filebuf(fp, std::ios_base::out), pre_(pre), post_(post)
	{
	}

protected:
	std::streamsize xsputn(const char* s, std::streamsize count) override
	{
		stdio_filebuf::xsputn(pre_, strlen(pre_));
		auto ret = stdio_filebuf::xsputn(s, count);
		stdio_filebuf::xsputn(post_, strlen(post_));
		return ret;
	}
};
#endif

int main()
{
#ifdef USE_COLORED
	if (getenv("DEBUG")) {
		std::cout.rdbuf(new colored_stdio_filebuf(stdout, stdout_pre, stdxxx_post));
		std::cerr.rdbuf(new colored_stdio_filebuf(stderr, stderr_pre, stdxxx_post));
	} else
#endif
	{
		int fd = open("/dev/null", O_WRONLY);
		dup2(fd, 2);
		close(fd);
	}

	int N;
	std::string S;
	std::cin >> N >> S;
	
	std::unordered_set<std::string> P1, P2, P3;

	for (char ch : S) {
		for (const auto& p : P2) {
			P3.insert(p + ch);
		}
		for (const auto& p : P1) {
			P2.insert(p + ch);
		}
		P1.insert(std::string(1, ch));
	}

	std::cout << P3.size() << "\n";
}


Measured memory_bytes: 384
#include "bits/stdc++.h"
using namespace std;


int main() {
    int n;
    cin >> n;
    for(int i = 0; i * 4 <= n; i++) {
        int k = n - 4 * i;
        if(k % 7 == 0) return !printf("Yes");
    }
    puts("No");
}

Measured memory_bytes: 256