akhauriyash/Code-Regression huggingface dataset:
import std.stdio, std.conv, std.string, std.bigint;
import std.math, std.random, std.datetime;
import std.array, std.range, std.algorithm, std.container;
string read(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }

void main(){
	long n = read.to!long;
	long[] as = readln.chomp.split.to!(long[]);
	
	long ans;
	foreach(a; as) while(a % 2 == 0) a /= 2, ans += 1;
	
	ans.writeln;
	}

Measured memory_bytes: 2684
#include<bits/stdc++.h>
#define LL long long
using namespace std;
const int MAXN = 2e5 + 5;
struct edge{
	int u, v;
	LL l;
}e[MAXN*2];
int n, q, np;
LL ans;
int Fa[MAXN];
LL f[MAXN];
bool cmp(edge x, edge y){
	return x.l < y.l;
}
int Find(int x){
	return x == Fa[x] ? x : Fa[x] = Find(Fa[x]);
}
inline LL read(void){
	LL num = 0, f = 1;
	char ch;
	while(!isdigit(ch=getchar())) if(ch == '-') f = -1;
	while(isdigit(ch)) num = num*10 + ch-'0', ch = getchar();
	return num * f;
}
int main()
{
	n = read(), q = read();
	memset(f, 63, sizeof(f));
	while(q--){
		int A = read()+1, B = read()+1;
		LL C = read();
		f[A] = min(f[A], C + 1);
		f[B] = min(f[B], C + 2);
		e[++np] = (edge){A, B, C};
	}
	for(int i = 2; i <= n; i++)
		f[i] = min(f[i-1] + 2, f[i]);
	f[1] = min(f[n] + 2, f[1]);
	for(int i = 2; i <= n; i++)
		f[i] = min(f[i-1] + 2, f[i]);
	f[1] = min(f[n] + 2, f[1]);
	for(int i = 2; i <= n; i++)
		e[++np] = (edge){i-1, i, f[i-1]};
	e[++np] = (edge){n, 1, f[n]};
	sort(e+1, e+np+1, cmp);
	for(int i = 1; i <= n; i++) Fa[i] = i;
	for(int i = 1; i <= np; i++){
		int f1 = Find(e[i].u), f2 = Find(e[i].v);
		if(f1 != f2){
			ans += e[i].l;
			Fa[f1] = f2;
		}
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 18348
package main

import (
	"fmt"
)

func main() {
	var n, b, f, r, v int
	fmt.Scan(&n)

	p := newProperty()
	for i := 0; i < n; i++ {
		fmt.Scan(&b)
		fmt.Scan(&f)
		fmt.Scan(&r)
		fmt.Scan(&v)
		p.register(b, f, r, v)
	}
	p.print()
}

type property struct {
	buildings []building
}

func (p property) print() {
	for i, b := range p.buildings {
		if i != 0 {
			fmt.Println("####################")
		}
		b.print()
	}
}

func (p *property) register(b, f, r, v int) {
	now := p.buildings[b-1].floors[f-1].rooms[r-1]
	p.buildings[b-1].floors[f-1].rooms[r-1] = now + v
}

func newProperty() property {
	var bs []building
	for i := 0; i < 4; i++ {
		bs = append(bs, newBuilding())
	}
	return property{buildings: bs}
}

type building struct {
	floors []floor
}

func (b building) print() {
	for _, f := range b.floors {
		f.print()
	}
}

func newBuilding() building {
	var fs []floor
	for i := 0; i < 3; i++ {
		fs = append(fs, newFloor())
	}
	return building{floors: fs}
}

type floor struct {
	rooms []int
}

func (f floor) print() {
	for _, r := range f.rooms {
		fmt.Printf(" %d", r)
	}
	fmt.Println()
}

func newFloor() floor {
	var rs []int
	for i := 0; i < 10; i++ {
		rs = append(rs, 0)
	}
	return floor{rooms: rs}
}



Measured memory_bytes: 1176
n=int(input())
s=input()
if n%2==0:
    m=n//2-1
    #print(s[0:m+1])
    #print(s[(m+1):n])
    if s[0:m+1]==s[(m+1):n]:
        print("Yes")
    else:
        print("No")
else:
    print("No")


Measured memory_bytes: 2940
#include<cstdio>
#include<functional>
#include<algorithm>
using namespace std;
int main(void)
{
	int a,b,n,s,f,i,j,fl;
	int flg[1001];
	scanf("%d %d",&a,&b);
	scanf("%d",&n);
	for(i=1;i<=1000;i++)	flg[i]=0;
	for(i=0;i<n;i++)	{
		scanf("%d %d",&s,&f);
		for(j=s;j<f;j++)	{
			flg[j]=1;
		}
	}
	fl=0;
	for(i=a;i<b;i++)	{
		if(flg[i]==1)	{
			fl=1;	break;
		}
	}
	printf("%d\n",fl);
	return 0;
}


Measured memory_bytes: 2748
n, m, x, y = map(int, input().split())
xl = list(map(int, input().split()))
yl = list(map(int, input().split()))
xl.append(x)
yl.append(y)
xl.sort()
yl.sort()
if yl[0] > xl[-1]:
    print('No War')
else:
    print('War')


Measured memory_bytes: 3060
import sys
K = int(input())

L = 9 * K

if K % 7 == 0:
    L //= 7

power = 1

for i in range(1, 10 ** 6):
    power *= 10
    power %= L
    if power == 1:
        print(i)
        sys.exit()

print(-1)

Measured memory_bytes: 9188
n = gets.to_i
s = gets.strip

count = 0

0.upto(n-2) do |i|
  (i+1).upto(n-1) do |j|
    k = 2 * j - i
    next if k >= n

    if s[i] != s[j] && s[i] != s[k] && s[j] != s[k]
      count += 1
    end
  end
end

r = 0
g = 0
b = 0

s.chars.each do |c|
  if c == 'R'
    r += 1
  elsif c == 'G'
    g += 1
  else
    b += 1
  end
end

puts r * g * b - count

Measured memory_bytes: 14332
# ABC135D - Digits Parade
# digit DP
def main():
    S = input().rstrip()
    ans, MOD = [0] * 13, 10 ** 9 + 7
    ans[0] = 1
    for c in S:
        dp = [0] * 13
        for i in range(13):
            dp[(i * 10) % 13] = ans[i] % MOD
        dp += dp
        if c == "?":
            for i in range(13):
                ans[i] = sum(dp[i + 4 : i + 14])
        else:
            x = int(c)
            for i in range(13):
                ans[i] = dp[i + 13 - x]
    print(ans[5] % MOD)


if __name__ == "__main__":
    main()

Measured memory_bytes: 3188
#include <stdio.h>

int fib[45];

int main(void){
    int n;
    scanf("%d", &n);
    for(int i=0; i<=n; i++){
        if(i <= 1)
            fib[i] = 1;
        else
            fib[i] = fib[i-1] + fib[i-2];
    }
    printf("%d\n", fib[n]);
}


Measured memory_bytes: 2112
def main():
    N = int(input())

    eightN = 8 ** N

    Num = 10 ** N
    Num_not_0_9 = eightN
    Num_not_0_or_9 = 9 ** N - eightN

    answer = (Num - Num_not_0_or_9 * 2 - Num_not_0_9) % (10 ** 9 + 7)

    print(answer)

if __name__ == "__main__":
    main()

Measured memory_bytes: 11520
#include<bits/stdc++.h>
using namespace std;
#define int long  long
#define double long double
int t,n,a[200005],ans,pnt,tmp;
signed main()
{
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    t=1;
  //  cin>>t;
    while(t--)
    {
        cin>>n;
        for(int i=0;i<n;i++)
        {
            cin>>a[i];
        }
        sort(a,a+n);
        ans=a[n-1];
        pnt=n-2;
        tmp=n-2;
        while(1)
        {
            if(tmp==0) break;
            tmp--;
            ans+=a[pnt];
            if(tmp==0) break;
            ans+=a[pnt--];
            tmp--;
        }
        cout<<ans<<endl;
    }
}


Measured memory_bytes: 5200
n,k,q = map(int, input().split())
a = [int(input()) for i in range(q)]

point = [0]*n

for i in range(q):
    point[a[i]-1] += 1

for i in range(n):
    if point[i] > q-k:
        print('Yes')
    else:
        print('No')

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

int main(){
    int sx, sy, tx, ty;
    cin >> sx >> sy >> tx >> ty;
    int p = tx - sx;
    int q = ty - sy;
    string ans;
    for (int i=0; i<p; i++) ans += "R";
    for (int i=0; i<q; i++) ans += "U";
    for (int i=0; i<p; i++) ans += "L";
    for (int i=0; i<q; i++) ans += "D";

    ans += "D";
    for (int i=0; i<p+1; i++) ans += "R";
    for (int i=0; i<q+1; i++) ans += "U";
    ans += "L";
    ans += "U";
    for (int i=0; i<p+1; i++) ans += "L";
    for (int i=0; i<q+1; i++) ans += "D";
    ans += "R";
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3656
#include <bits/stdc++.h>
 
using namespace std;
 
#define PB(x)	push_back(x)
#define ALL(x)	(x).begin(), (x).end()
#define ALLR(x) (x).rbegin(), (x).rend()
#define MP(x)	make_pair(x);
    
#define debug(x) 		cerr << #x << '=' << x << endl;
#define debug2(x, y)	cerr << #x << '=' << x << ' ' << #y << '=' << y << endl;
#define debugn(_a)		cerr << #_a << ": "; for (auto _x: _a) cerr << _x << ' '; cerr << endl;
#define debugm(a) 		cerr << #a << ":\n"; \
						for (auto v: a) { for(auto x: v) cout << x << ' '; cerr << "\n"; }
 
#define FAST_IO ios::sync_with_stdio(false); cin.tie(0)

#define int long long
 
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<pair<int, int>> vii;
typedef vector<string> vs;
typedef unsigned long long ull;
 
const int INF  = LONG_LONG_MAX;
const int NINF = LONG_LONG_MIN;
const int mmod = 998244353;

int32_t main()
{
	FAST_IO;
	
	int a, b;
	cin >> a >> b;
	
	int g = __gcd(a, b);
	cout << (a*b)/g << endl;
}


// g++ -Wall -Wextra -Wshadow -fsanitize=undefined 


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <sstream>
#include <utility>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <cmath>
#include <functional>
#include <chrono>
#include <cstring>

using namespace std;
typedef long long lint;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef vector<lint> vl;
typedef pair<lint,lint> pll;

#define mpr make_pair


int main()
{
    ios_base::sync_with_stdio(0);    cin.tie(NULL);    cout.tie(NULL);
    int s, w;
    cin>>s>>w;
    if (w>=s) cout<<"unsafe\n";
    else cout<<"safe\n";

}


Measured memory_bytes: 3640
#include<iostream>
#include<math.h>
using namespace std;
int main()
{
	int i,n,d,res=1,x,c1=0,j;
	cin>>n;
	int a[n],c[n];
	for(i=1;i<=n;i++)
	{
		cin>>a[i];
		c[i]=0;
	}
	d=n/2;
	int q=1000000007;
	i=d;
	while(i--)
	{
		res=(res*2)%q;
	}
	for(i=1;i<=n;i++)
	{
		x=a[i];
		if(x==0)
		{
			c[1]++;
		}
		else
		{
			c[x]++;
		}
	}
	i=n-1;
	c1=0;
	if(n%2==0)
	{
		j=n/2;
		while(j--)
		{
			if(c[i]==2)
			{
				c1++;
				i=i-2;
			}
		}
		if(c1==d)
		{
			cout<<res<<endl;
		}
		else
		{
			cout<<0<<endl;
		}
	}
	else
	{
		j=n/2;
		while(j--)
		{
			if(c[i]==2&&i!=0)
			{
				c1++;
				i=i-2;
			}
		}
		if(c[1]==1)
		{
			c1++;
		}
		d=d+1;
		if(c1==d)
		{
			cout<<res<<endl;
		}
		else
		{
			cout<<0<<endl;
		}
	}
}

Measured memory_bytes: 1024
#include<stdio.h>

int main(){
    int A,B,C,X,ans,frag = 0;
    scanf("%d", &A);
    scanf("%d", &B);
    scanf("%d", &C);
    scanf("%d", &X);
    //scanf("%d %d %d %d",&A,&B,&C,&X);
    for(int a = 0; a <= A; a++){
        //ans = 500 * a;
        for(int b = 0; b <= B; b++){
            //ans += 100 * b;
            for(int c = 0; c <= C; c++){
                //ans += 50 * c;
                ans = 500*a + 100*b + 50*c;
                if (ans == X)
                {
                    frag++;
                }
                
            }
        }
    }
    printf("%d",frag);
    return 0;
}

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

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


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

class Main {

	public static void main(final String[] args) throws Exception {

		try {

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

			final String[] intputStringList = br.readLine().split(" ");

			final StringBuilder contestName = new StringBuilder();
			contestName.append(intputStringList[0].substring(0, 1))
			           .append(intputStringList[1].substring(0, 1))
					   .append(intputStringList[2].substring(0, 1));

			System.out.println(contestName);

		} catch (IOException | NumberFormatException e) {
			e.printStackTrace();
			System.exit(0);
		} catch (final Exception e) {
			e.printStackTrace();
			System.exit(0);
		}

	}
}

Measured memory_bytes: 20436
import java.util.*;
import java.lang.*;
import java.math.*;
import java.io.*;

import static java.lang.Math.*;
import static java.util.Arrays.*;

public class Main{

	Scanner sc;

	static final int INF=1<<28;
	static final double EPS=1e-9;

	void run(){
		sc=new Scanner(System.in);
		Stack<Integer> stack=new Stack<Integer>();
		for(; sc.hasNext();){
			int n=sc.nextInt();
			if(n==0)
				println(""+stack.pop());
			else
				stack.push(n);
		}
		sc.close();
	}

	void print(String s){
		System.out.print(s);
	}

	void println(String s){
		System.out.println(s);
	}

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

Measured memory_bytes: 12000
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
    int N;
    cin >> N;
    int len = to_string(N).size();

    ll ans = 0;
    for ( int l = 3; l <= len; l++ ) {
        int m = 1;
        for ( int i = 0; i < l; i++ ) m *= 3;
        for ( int i = 0; i < m; i++ ) {
            int x = 0, k = 1;
            int j = i;
            bool u3 = false, u5 = false, u7 = false;
            for ( int h = 0; h < l; h++ ) {
                int t = 0;
                if ( j % 3 == 0 ) t = 3, u3 = true;
                else if ( j % 3 == 1 ) t = 5, u5 = true;
                else if ( j % 3 == 2 ) t = 7, u7 = true;
                x += t * k;
                k *= 10;
                j /= 3;
            }
            if ( x <= N && u3 && u5 && u7 ) ans ++;
        }
    }
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
typedef pair<ll,ll> P;
#define M 1000000007
#define all(a) (a).begin(),(a).end()
#define rep(i,n) reps(i,0,n)
#define reps(i,m,n) for(int i=(m);i<(n);i++)
int main(){
while(1){
  int h,w,n,a,b;cin>>h>>w>>n;
  if(h==0&&w==0)break;
  vector<vector<int>> dp(h+1,vector<int>(w+1,0));
  rep(i,n){
    cin>>a>>b;
    dp[a][b]=-1;
  }
  reps(i,1,h+1){
    reps(j,1,w+1){
      if(i==1&&j==1)dp[i][j]=1;
      else if(dp[i][j]==-1)dp[i][j]=0;
      else dp[i][j]=dp[i][j-1]+dp[i-1][j];
    }
  }
  cout<<dp[h][w]<<endl;
}
}


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

int main()
{
	string s;
	cin >> s;
	int sz = s.size();
	bool isYes = true;
	for (int i = 1; i <= sz; i++)
	{
		if (i % 2 == 1 && s[i - 1] == 'L')
		{
			isYes = false;
			break;
		}
		else if (i % 2 == 0 && s[i - 1] == 'R')
		{
			isYes = false;
			break;
		}
	}
	if (isYes)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}



Measured memory_bytes: 3604
#include <stdio.h>
int main(){
    int a, b, c, n;
    scanf("%d %d %d", &a, &b, &c);
    if(a > b){
        n = a;
        a = b;
        b = n;
    }
    if(a > c){
        n = a;
        a = c;
        c = n;
    }
    if(b > c){
        n = b;
        b = c;
        c = n;
    }
    printf("%d %d %d\n",a, b, c);
    return 0;
}

Measured memory_bytes: 1796
#include <bits/stdc++.h>
#include <cmath>
#include <numeric>
#include <iomanip>
// #include <regex> //正規表現
using namespace std;
#define rep(i,a,b) for(int i=(a); i<(b); ++i) // a ≦ i < b 
#define Rrep(i,a,b) for(int i=(a);i>=(b);--i) // reverse repeat. a から b まで減少．
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend() //逆イテレータ
#define RANGE(a,b,c) (a).begin()+b,(a).begin()+c // コンテナ a の 要素 b から c へのイテレータ
#define MOD 1000000007ll
#define INF 1000000000
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<PII> VP;
// グリッドグラフの移動ベクトル
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

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

int64_t N, L; cin >> N >> L;
vector<int64_t> a(N); rep(i, 0, N) cin >> a[i];

rep(i, 0, N - 1){
    if (a[i] + a[i + 1] >= L){
        cout << "Possible" <<  "\n";
        rep(j, 1, i+1) cout << j << "\n";
        Rrep(j, N - 1, i + 1) cout << j << "\n";
        return 0;
    }
}

cout << "Impossible" <<  "\n";


}

// 境界，出力文字列 チェック



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

int main() {
    string S;
    int K;
    cin >> S >> K;
    vector<string>vec;
    for(int i = 0; i < S.size(); i++) {
        for(int j = 0; j <= K; j++) {
            vec.push_back(S.substr(i,j+1));
        }
    }
    sort(vec.begin(), vec.end());
    vec.erase(unique(vec.begin(), vec.end()), vec.end());
    cout << vec[K-1] << endl;
}

Measured memory_bytes: 1916
#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cmath>
#include <set>
#include <queue>
#include <vector>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
using namespace std;

int main()
{
	int count[2] = { 0,0 };
	for (auto i = 0; i < 3; ++i)
	{
		int temp;
		cin >> temp;
		if (temp == 5)
		{
			++count[0];
		}
		else if (temp == 7)
		{
			++count[1];
		}
	}

	if (count[0] == 2 && count[1] == 1)
	{
		cout << "YES" << endl;
	}
	else
	{
		cout << "NO" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <math.h>
#include <set>
#include <algorithm>

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

using namespace std;

inline int max(int a, int b) {
	if (b > a) swap(a, b);
	return a;
}

inline int min(int a, int b) {
	if (a > b) swap(a, b);
	return a;
}


int main() {
	int n;

	cin >> n;
	vector<pair<string, int>> s(n);
	vector<int> p(n);

	rep(i, n) {
		cin >> s[i].first >> p[i];
		s[i].second = i;
	}

	sort(s.begin(), s.end(), [](auto & x, auto & y) {return x.first < y.first; });

	int i = 0;
	while (i < n) {
		if (i + 1 >= n) {
			cout << s[i].second + 1 << endl;
			break;
		}
		if (s[i].first != s[i + 1].first) {
			cout << s[i].second + 1 << endl;
			i++;
		}
		else {
			int j = i;
			vector<vector<int>> tmp;
			tmp.emplace_back(vector<int>{s[j].second, p[s[j].second]});
			while (j + 1 < n) {
				if (s[j].first != s[j + 1].first) break;
				j++;
				tmp.emplace_back(vector<int>{s[j].second, p[s[j].second]});
			}
			i = j + 1;
			sort(tmp.begin(), tmp.end(), [](auto & x, auto & y) {return x[1] > y[1]; });
			for(auto a: tmp){
				cout << a[0] + 1 << endl;
			}
		}
	}

	return 0;
}

Measured memory_bytes: 256
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(1000000)
N,Q = map(int,readline().split())
abpx = list(map(int,read().split()))
ab = iter(abpx[:N+N-2])
px = iter(abpx[N+N-2:])
dic = {}
dic2=[0]*(N+1)
dic3=[0]*N

for i in range(N):
    dic[i+1] = []
for a,b in zip(ab,ab):
    dic[a].append(b)
    dic[b].append(a)
for p,x in zip(px,px):
    dic2[p] += x
def rec(now_node,prevval):
    nowval = prevval + dic2[now_node]
    dic3[now_node-1] = nowval
    tg_list = dic[now_node][:]
    for elem in tg_list:
        dic[elem].remove(now_node)
        rec(elem,nowval)
rec(1,0)
res = [str(dic3[i-1]) for i in range(1,N+1)]
print(' '.join(res))


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


#define REP(i,n) for(int i=0; i<n; i++)
#define FOR(i,a,b) for(int i=a; i<b; i++)

long long dp[310][310];
long long in[310][310];


int main() {
	int n;
	cin >> n;
	REP(i, n) REP(j, n) cin >> dp[i][j], in[i][j] = dp[i][j];
	REP(k, n) REP(i, n) REP(j, n) dp[i][j] = min(dp[i][j], dp[i][k] + dp[k][j]);
	bool same = true;
	REP(i, n) {
		REP(j, n) {
			same &= dp[i][j] == in[i][j];
		}
	}
	if(same) {
		long long res = 0;
		REP(i, n) {
			REP(j, i) {
				bool tyuke = false;
				REP(k, n) {
					if(i != k && j != k) {
						tyuke |= dp[i][j] == (dp[i][k] + dp[k][j]);
					}
				}
				if(!tyuke) {
					res += dp[i][j];
				}
			}
		}
		cout << res << endl;
	}
	else {
		cout << -1 << endl;
	}
}

Measured memory_bytes: 1664
N = int(input())

cnt = 0
check = False
for _ in range(N):
  d1,d2 = map(int,input().split())
  if d1 == d2:
    cnt += 1
  else:
    cnt = 0
    
  if cnt == 3:
    check = True
    break
    
print("Yes" if check else "No")

Measured memory_bytes: 9168
n,m=map(int,input().split())
# print
# v=[]
for i in range(n+2):
    s=""
    if i==0 or i==n+1:
        s="#"*(m+2)
        
    else:
        a=input()
        s="#"+a+"#"
    print(s)
    # v.append(s)
    
    
# for i in v:
#     print(i)
    

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(i, n, m) for (int i = (int)(n); i < (int)(m); i++)
#define repr(i, n, m) for (int i = (int)(n) - 1; i >= (int)(m); i--)
using namespace std;
using ll = int64_t;
const int MOD = 1000000007; // 10^9+7

int main() {
    ll a, b, v, w, t;
    cin >> a >> v >> b >> w >> t;

    if (v <= w) {
        cout << "NO" << endl;
        return 0;
    }

    ll diff = abs(a - b);
    ll dist = (v - w) * t;
    if (dist >= diff) cout << "YES" << endl;
    else cout << "NO" << endl;

    // if (a > b)  {
    //     b = -w * t + b;
    //     a = -v * t + a;
    //     if (a < b) cout << "YES" << endl;
    //     else cout << "NO" << endl;
    // } else {
    //     b = w * t + b;
    //     a = v * t + a;
    //     if (a > b) cout << "YES" << endl;
    //     else cout << "NO" << endl;
    // }
}


Measured memory_bytes: 3596
#include<iostream>

using namespace std;

int main(){
    long long N = 10000000;
    int A,B; cin >> A >> B;
    int ans;

    double tmp;

    for(ans = 0;ans < N; ans++){
        tmp = (double)(A - 1) * (ans-1) + A; //電源の数を表示

        
        if(tmp >= B){
          //  cout << "残りの電源の数は" << tmp << "です" << endl;
            break;
        }

    } 

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
import scala.io.{StdIn => in}

object Main extends App {
  val s = in.readLine

  val ans = (0 until s.size)./:((0L, 0)) { case ((acc,cnt),i) =>
    if(s(i) == 'W') (acc+(i-cnt), cnt+1)
    else (acc, cnt)
  }._1

  println(ans)
}

Measured memory_bytes: 37972
CARD_A = 'a'
CARD_B = 'b'
CARD_C = 'c'


def main():
    each_cards = {
        CARD_A: [card for card in input()],
        CARD_B: [card for card in input()],
        CARD_C: [card for card in input()],
    }

    next = CARD_A
    while True:
        if len(each_cards[next]) == 0:
            print(next.upper())
            return
        next = each_cards[next].pop(0)

main()


Measured memory_bytes: 3060
H, W = map(int, input().split())

grid = [list(input()) for _ in range(H)]
num = [[0] * W for _ in range(H)]

for i in range(H):
    for j in range(W):
        if grid[i][j] == '#':
            for di in [-1, 0, 1]:
                for dj in [-1, 0, 1]:
                    ni = i + di
                    nj = j + dj
                    if 0 <= ni < H and 0 <= nj < W:
                        if grid[ni][nj] == '#':
                            num[ni][nj] = '#'
                        else:
                            num[ni][nj] += 1

for i in range(H):
    print(*num[i], sep='')


Measured memory_bytes: 3444
////////////////////////////////////////////
///                                      ///
///         Template ver. 1 rapel        ///
/// Fear is Temporary, Regret is Forever ///
///          Must Try and Get AC         ///
///                                      ///
////////////////////////////////////////////
#include <stdio.h>
#include <iostream>
#include <sstream>
#include <iomanip>

#include <algorithm>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <utility>

#include <math.h>
#include <complex>

#include <assert.h>
#include <time.h>
//#include <chrono>
//#include <random>

#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <list>
#include <bitset>

#define FI first
#define SE second
#define MP make_pair
#define PB push_back
#define PF push_front
#define POB pop_back
#define POF pop_front
#define endl '\n'
using namespace std;

typedef long long LL;
typedef unsigned long long ULL;

void desperate_optimization(int precision){
  	ios_base::sync_with_stdio(false);
  	cin.tie(0);
  	cout.tie(0);
  	cout.setf(ios::fixed);
  	cout.setf(ios::showpoint);
  	cout.precision(precision);
}

void hora(int tc) {
	int n,k;
	cin>>n>>k;
	if(k == 1) cout<<0<<endl;
	else cout<<n - k<<endl;
}

int main(){
	desperate_optimization(10);
	int ntc = 1;
	//cin>>ntc;
	for(int tc = 1;tc <= ntc;tc++) hora(tc);
	return 0;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
ll X , Y;
int main()
{
        cin >> X >> Y;
        ll len = 0;
        ll cure = X;
        while(cure <= Y && cure > 0)
        {
                len++;
                cure = cure*2;
        }
        cout << len << endl;
        return 0;
}


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

int main(){
  int N,M;
  cin >> N >> M;
  vector<int> vec(M);
  for(int i = 0;i < M; i++){
    cin >> vec.at(i);
  }
  
  int sum = 0;
  for(int i = 0; i < M; i++){
    sum += vec.at(i);
  }
  int P = 0;
  if(N < sum){
    P = -1;
  }
  else{
    P = N - sum;
  }
  cout << P << endl;
}

Measured memory_bytes: 3648
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <stack>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <list>
#include <string.h>
#include <functional>
#include <unordered_set>
#include <unordered_map>
#include <array>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>
#include <utility>
#include <memory>
#include <sstream>
#include <complex>
#include <cassert>
#include <bitset>
#define rep(i, n) for(int i = 0; i < n; i++)
#define fi first
#define se second
//#include <Windows.h>
//#include "Library.h"
//#include "Math.h"
//#include "Othello.h"
using namespace std;
typedef long long int ll; typedef pair <int, int> P; typedef vector <int> vecint; typedef pair<int, P> P1; typedef pair<P1, int> P2;
const int inf = 1000000000;
const ll INF = 9000000000000000000;
const double EPS = 10e-9;
int grid[2][101];
int dp[2][103];
int main()
{
	int n; cin >> n;
	rep(j, 2)
		rep(i, n)
		cin >> grid[j][i];
	rep(i, 2)
		dp[i][0] = 0;
	rep(i, n)
		dp[0][i] = 0;
	for(int i = 1; i < 3; i++)
		for(int j = 1; j <= n; j++)
	{
			dp[i][j] = max(dp[i][j], dp[i - 1][j] + grid[i - 1][j - 1]);
			dp[i][j] = max(dp[i][j], dp[i][j - 1] + grid[i - 1][j - 1]);
	}
	cout << dp[2][n] << endl;
	return 0;
}


Measured memory_bytes: 256
awk -M '\
{
    A=$1+0
    B=int($2*100+0.01);
    ans =A*B;
    if(ans<100){print 0;exit}
    for(i=1;i<=length(ans)-2;i++){
        printf"%d",substr(ans,i,1)
    }
    printf"\n"
}'

Measured memory_bytes: 4496
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
    
        Scanner sc = new Scanner(System.in);
        
        int N = sc.nextInt();
        int[] A = new int[N];
        for(int i = 0; i < N; i++){
            A[i] = sc.nextInt() - (i+1);
        }
        
        Arrays.sort(A);
        
        long ans = 0;
        for(int i = 0; i < N; i++){
            ans += Math.abs( A[i] - A[N/2] );
        }
        
        System.out.println( ans );
    }
}


Measured memory_bytes: 64780
#include <iostream>
#include <string>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <map>
#include <cmath>
#include <queue>
#include <utility>
#include <functional>
#include <deque>
#include <cctype>
#include <stack>
#include <bitset>

using ll = long long;
typedef unsigned long long ull;
typedef std::pair<ll, ll>p;
struct edge { int to, cost; };
std::vector<int>G[100000];
std::vector<int>I[100000];

ll min(ll a, ll b) {
	if (a >= b)return b;
	else return a;
}
ll max(ll a, ll b) {
	if (a >= b)return a;
	else return b;
}
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a%b);
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}

const ll Z = 1000000007;
const ll INF = 1 << 30;
const ll INF2 = 9000000000000000000LL;
bool flag = true;
bool fl = false;
bool f = false;
int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };

int main() {
	ll ans = 0;
	std::string s, t;
	std::cin >> s;
	t = s;
	for (int i = 0;i < s.size() - 1;i++) {
		if (flag) {
			if (s[i + 1] - '0' != 9) {
				int a = s[i] - '0' - 1;
				s[i] = a + '0';
				s[i + 1] = '9';
			}
			else s[i + 1] = '9';
		}
		else s[i + 1] = '9';
		if (s < t)flag = false;
	}
	for (int i = 0;i < s.size();i++) {
		ans += s[i] - '0';
	}
	std::cout << ans << std::endl;
}

Measured memory_bytes: 4992
N = int(input())
S = input()
L = []
L.append(0)
for i in range(N):
  if S[i] == 'W':
    L.append(L[i] + 1)
  else:
    L.append(L[i])
R = []
R.append(0)
for i in range(N):
  if S[N-1-i] == 'E':
    R.append(R[i] + 1)
  else:
    R.append(R[i])
#print(L)
#print(R)
M = []
for i in range(N):
  M.append(L[i] + R[N-i-1])
print(min(M))


Measured memory_bytes: 29908
use proconio::{fastout, input};
use std::cmp;

#[fastout]
fn main() {
    input! {
        a: i64,
        b: i64,
        n: i64,
    }
    let mut ans = 0;
    let mut l = 0;
    let mut r = cmp::min(n, b - 1);

    // // fail
    // for i in 1..(n + 1) {
    //     let x = a * i / b - a * (i / b);
    //     if x > ans {
    //         ans = x;
    //     }
    //     println!("{}", x);
    // }

    // bin search
    // while (r - l).abs() > 1 {
    //     // println!("test");
    //     let m = (r - l) / 2;
    //     let x = a * (m % b) - (a * m % b);
    //     println!("{} {}", m, x);
    //     if x > ans {
    //         l = m;
    //         ans = x;
    //     } else if x < ans {
    //         r = m;
    //     }
    // }
    let x = cmp::min(n, b - 1);
    let ans = a * x / b - a * (x / b);
    println!("{}", ans);
}


Measured memory_bytes: 2124
#![allow(unused_imports)]
#![allow(non_snake_case, unused)]

use std::cmp::*;
use std::collections::*;
use std::ops::*;

// https://atcoder.jp/contests/hokudai-hitachi2019-1/submissions/10518254

macro_rules! eprint {
	($($t:tt)*) => {{
		use ::std::io::Write;
		let _ = write!(::std::io::stderr(), $($t)*);
	}};
}
macro_rules! eprintln {
	() => { eprintln!(""); };
	($($t:tt)*) => {{
		use ::std::io::Write;
		let _ = writeln!(::std::io::stderr(), $($t)*);
	}};
}
macro_rules! dbg {
	($v:expr) => {{
		let val = $v;
		eprintln!("[{}:{}] {} = {:?}", file!(), line!(), stringify!($v), val);
		val
	}}
}

macro_rules! mat {
	($($e:expr),*) => { Vec::from(vec![$($e),*]) };
	($($e:expr,)*) => { Vec::from(vec![$($e),*]) };
	($e:expr; $d:expr) => { Vec::from(vec![$e; $d]) };
	($e:expr; $d:expr $(; $ds:expr)+) => { Vec::from(vec![mat![$e $(; $ds)*]; $d]) };
}

macro_rules! ok {
	($a:ident$([$i:expr])*.$f:ident()$(@$t:ident)*) => {
		$a$([$i])*.$f($($t),*)
	};
	($a:ident$([$i:expr])*.$f:ident($e:expr$(,$es:expr)*)$(@$t:ident)*) => { {
		let t = $e;
		ok!($a$([$i])*.$f($($es),*)$(@$t)*@t)
	} };
}

pub fn readln() -> String {
	let mut line = String::new();
	::std::io::stdin().read_line(&mut line).unwrap_or_else(|e| panic!("{}", e));
	line
}

macro_rules! read {
	($($t:tt),*; $n:expr) => {{
		let stdin = ::std::io::stdin();
		let ret = ::std::io::BufRead::lines(stdin.lock()).take($n).map(|line| {
			let line = line.unwrap();
			let mut it = line.split_whitespace();
			_read!(it; $($t),*)
		}).collect::<Vec<_>>();
		ret
	}};
	($($t:tt),*) => {{
		let line = readln();
		let mut it = line.split_whitespace();
		_read!(it; $($t),*)
	}};
}

macro_rules! _read {
	($it:ident; [char]) => {
		_read!($it; String).chars().collect::<Vec<_>>()
	};
	($it:ident; [u8]) => {
		Vec::from(_read!($it; String).into_bytes())
	};
	($it:ident; usize1) => {
		$it.next().unwrap_or_else(|| panic!("input mismatch")).parse::<usize>().unwrap_or_else(|e| panic!("{}", e)) - 1
	};
	($it:ident; [usize1]) => {
		$it.map(|s| s.parse::<usize>().unwrap_or_else(|e| panic!("{}", e)) - 1).collect::<Vec<_>>()
	};
	($it:ident; [$t:ty]) => {
		$it.map(|s| s.parse::<$t>().unwrap_or_else(|e| panic!("{}", e))).collect::<Vec<_>>()
	};
	($it:ident; $t:ty) => {
		$it.next().unwrap_or_else(|| panic!("input mismatch")).parse::<$t>().unwrap_or_else(|e| panic!("{}", e))
	};
	($it:ident; $($t:tt),+) => {
		($(_read!($it; $t)),*)
	};
}

pub fn main() {
	let _ = ::std::thread::Builder::new().name("run".to_string()).stack_size(32 * 1024 * 1024).spawn(run).unwrap().join();
}

const MOD: usize = 1_000_000_007;
const INF: i64 = std::i64::MAX/2;

fn solve() {
    let (a,b,n) = read!(i64,i64,i64);
    let mut ans = 0;
    if a>b {
        let mut x = (n+1)/b*b-1;
        ans = a*x/b - a*(x/b);
        x = n;
        ans = max(ans, a*x/b - a*(x/b));
    }
    else {
        let mut x = min(n,b-1);
        ans = a*x/b - a*(x/b);
        x = n;
        ans = max(ans, a*x/b - a*(x/b));
    }
    println!("{}", ans);
}

fn run() {
    solve();
}


Measured memory_bytes: 2208
#include <iostream>
#include <stdio.h>
#include <cstdio>
#include <cstdlib>
#include <istream>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <algorithm>
#include <functional>
#include <map>
#include <cmath>
#include <string>
#include <complex>

#define make_pair MP

using namespace std;
//---------------------------------------------------------------------------//
long long a,b,c;
int main(){
        cin>>a>>b>>c;
        if(a%2==0 || b%2==0 || c%2==0) {
                cout<<0<<endl;
                return 0;
        }else{
                cout<<min(min(a*b,a*c),b*c)<<endl;

        }

}


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

int main(void){
  int n;
  while(cin >> n, n != 0){
    int a = 0;
    int b = 0;    
    for(int i = 0; i < n; i++){
      int ta,tb;
      cin >> ta >> tb;
      int sum = ta + tb;
      if(ta > tb) a += sum;
      if(ta < tb) b += sum;
      if(ta == tb){
	a += ta; b += tb;
      }
    }
    cout << a << " " << b << endl;
  }

  return 0;
} 

Measured memory_bytes: 1160
d,n=input().split()
d=int(d)
n=int(n)

if d==0:
	if n==100:
		print(101)
	else:
		print(n)
elif d==1:
	if n==100:
		print(10100)
	else:
		print(n*100)
else:
	if n==100:
		print(1010000)
	else:
		print(n*10000)

Measured memory_bytes: 3060
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<stack>
#include<math.h>
#include<queue>
#include<cstdio>
#include<unordered_set>
using namespace std;

int main()
{
	int k, t, i, j, result;
	int aaa[110];
	cin >> k >> t;
	result = 0;
	for (i = 0; i < t; i++) {
		cin >> aaa[i];
         }
        for (i = 0; i < t; i++) {
		if (aaa[i] > (k + 1) / 2) {
			result = aaa[i] * 2 - k - 1;
                   break;
		}
	}
	cout << result << endl;
	return 0;
}

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

int al[26];

int main(){
    string w; cin >> w;
    bool okay = true;
    int n = w.length();
    for(int i = 0; i < n; i++) al[w[i]-'a']++;
    for(int i = 0; i < 26; i++){
        if(al[i]%2) okay = false;
    }
    cout << ((okay)? "Yes" : "No") << endl;
    return 0;
}


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

int main(){
	int E,Y;
	cin>>E>>Y;
	
	if(E==0){
		int i=0;
		
		if(1868<=Y&&Y<=1911){
			while(Y!=1868+i)
				i++;
			cout<<"M"<<++i<<endl;
		}
		
		if(1912<=Y&&Y<=1925){
			while(Y!=1912+i)
				i++;
			cout<<"T"<<++i<<endl;
		}
		
		if(1926<=Y&&Y<=1988){
			while(Y!=1926+i)
				i++;
			cout<<"S"<<++i<<endl;
		}
		
		if(1989<=Y&&Y<=2016){
			while(Y!=1989+i)
				i++;
			cout<<"H"<<++i<<endl;
		}
	
	}
	
	if(E==1)
		cout<<1868+(--Y)<<endl;
	if(E==2)
		cout<<1912+(--Y)<<endl;
	if(E==3)
		cout<<1926+(--Y)<<endl;
	if(E==4)
		cout<<1989+(--Y)<<endl;
	
	return 0;

}

Measured memory_bytes: 3096
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n;
    cin >> n;
    ll a[n];
    for(ll i = 0;i < n;i++){
    	cin >> a[i];
    }
    ll dp[n];
    dp[0] = 0;
    for(ll i = 1;i < n;i++){
    	dp[i] = dp[i-1]+abs(a[i]-a[i-1]);
    	if(i >= 2){
    		dp[i] = min(dp[i],dp[i-2]+abs(a[i]-a[i-2]));
    	}
    }
    cout << dp[n-1] << endl;
}


Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <cmath>
#include <climits>
#include <iomanip>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
int main(){
  ll n = 0;
  cin >> n;
  for(int i = 0;i < 30;i++){
    for(int j = 0;j < 30;j++){
      if(4*i + 7*j == n){
        cout << "Yes" << endl;
        return 0;
      }
    }
  }
  cout << "No" << endl;
}




Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define rep(i, a, b) for(ll i = ll(a); i < ll(b); i++)
#define rer(i, a, b) for(ll i = ll(a) - 1; i >= ll(b); i--)
#define sz(v) (int)(v).size()
#define pb push_back
#define sc second
#define fr first
#define sor(v) sort(v.begin(),v.end())
#define rev(s) reverse(s.begin(),s.end())
#define lb(vec,a) lower_bound(vec.begin(),vec.end(),a)
#define ub(vec,a) upper_bound(vec.begin(),vec.end(),a)
#define uniq(vec) vec.erase(unique(vec.begin(),vec.end()),vec.end())
using namespace std;
typedef long long int ll;
typedef pair <int, int> P;

const ll MOD=1000000007;
vector<int> p;
bool C(int x){
    int a[3];
    rep(i,0,3){
        a[i]=p[x+i];
    }
    sort(a,a+3);
    if(p[x+1]==a[1]) return 1;
    else return 0;
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin>>n;
    p.resize(n);
    rep(i,0,n) cin>>p[i];
    int cnt=0;
    rep(i,0,n-2){
        if(C(i)) cnt++;
    }
    cout <<cnt<<"\n";
}

Measured memory_bytes: 256
import java.util.*;
 
public class Main {
    public static void main (String[] args) {
        Scanner scanner = new Scanner(System.in);
        StringBuilder sb = new StringBuilder();

        String NString = scanner.nextLine();
        char[] arr = NString.toCharArray();
        int N = arr.length;
        int startIndex = (N/2) - 1;
        int endIndex = (N%2) == 0 ? (int)(N/2) : (int) (Math.ceil((float)N/2)) ;
        int count = 0;

        while(startIndex >= 0 && endIndex <= N - 1){
            if(arr[startIndex] == arr[endIndex]){
                
            }
            else
                count++;
          
            startIndex--;
            endIndex++;
        }

        sb.append(count);
        System.out.println(sb);
    }
}

Measured memory_bytes: 21844
import java.util.Scanner;

public class Main
{
	private static final int[] D = { -1, 0, 1 };
	
	private static int W, H;
	
	public static void main(String[] args)
	{
		Scanner sc = new Scanner(System.in);
		for(;;)
		{
			W = sc.nextInt();
			H = sc.nextInt();
			if (W==0 && H==0) break;
			
			boolean[][] map = new boolean[W][H];
			for (int y = 0; y < H; y++)
			{
				for (int x = 0; x < W; x++)
				{
					map[x][y] = sc.nextInt() == 1;
				}
			}
			System.out.println(count(map));
		}
	}
	
	private static int count(boolean[][] map)
	{
		int c = 0;
		for (int x = 0; x < W; x++)
		{
			for (int y = 0; y < H; y++)
			{
				if (map[x][y])
				{
					c++;
					rem(map, x, y);
				}
			}
		}
		return c;
	}
	
	private static void rem(boolean[][] map, int x, int y)
	{
		if (x < 0 || W <= x || y < 0 || H <= y || !map[x][y]) return;
		map[x][y] = false;
		for (int dx : D)
		{
			for (int dy : D)
			{
				if (dx == 0 && dy == 0) continue;
				rem(map, x + dx, y + dy);
			}
		}
	}
}

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

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

#define pb push_back
#define rep(i, a, n) for(int i = (a); i < (n); i++)
#define dep(i, a, n) for(int i = (a); i >= (n); i--)
#define mod 1e9+7

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

signed main() {
  int a[100005], b[100005];
  int n;
  cin >> n;
  rep(i, 0, n) {
    cin >> a[i] >> b[i];
  }

  ll sum = 0;
  dep(i, n - 1, 0) {
    if(((a[i] + sum) % b[i])) {
      sum += b[i] - ((a[i] + sum) % b[i]);
    }
  }
  cout << sum << endl;
}


Measured memory_bytes: 1024
import sys
import math
from itertools import permutations
from itertools import combinations

#input = sys.stdin.readline
sys.setrecursionlimit(10**7)
S = input()

cnt = 0
rS = S[::-1]
if len(S)%2:
    for a, b in zip(S[:len(S)//2], rS[:len(S)//2]):
        if a != b:
            cnt += 1
else:
    for a, b in zip(S[:len(S)//2], rS[:len(S)//2]):
        if a != b:
            cnt += 1
print(cnt)



Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <algorithm>
#include <string.h>
#include <math.h>
#include <map>
#include <iomanip>
#include <stdio.h>
#include <bitset>

typedef long long LL;

constexpr long long INFLL = 1e18;

using namespace std;

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

    return 0;
}

Measured memory_bytes: 3100
INF = 2**30
n, *$abc = gets.split.map(&:to_i)
$v = readlines.join.split.map(&:to_i)

def f(nn, p)
  if nn == 0 then
    cost, len = 0, [0, 0, 0]
    p.each_with_index do |x, i|
      next if x == -1
      len[x] += $v[i]
      cost += 10
    end
    (0...3).each do |i|
      return INF if len[i] == 0
      cost += ($abc[i] - len[i]).abs
    end
    return cost - 30
  end

  r = INF
  (-1...3).each do |i|
    p.push(i)
    r = [r, f(nn-1, p)].min
    p.pop()
  end
  r
end

puts f(n, [])

Measured memory_bytes: 1788
using System;
using System.Linq;
using System.Collections.Generic;

namespace C
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            // var a = Console.ReadLine().Split().Select(double.Parse).OrderBy(x=>x).ToArray();
            var a = Console.ReadLine().Split().Select(double.Parse).OrderBy(x => x).Distinct();

            Console.WriteLine(n == a.Count() ? "YES" : "NO");

            // Console.WriteLine(check(a));


        }

        private static string check(double[] a)
        {
            for (int i = 0; i < a.Length - 1; i++)
            {
                if (a[i] == a[i + 1])
                {
                    return "NO";
                }

            }

            return "YES";
        }
    }
}


Measured memory_bytes: 51224
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#define rep(i, n) for(int i=0;i<(int)(n);++i)
template <typename T> lint gcd(T a, T b) {return b?gcd(b, a%b):a;}
template <typename T> lint lcm(T a, T b) {return a * b / gcd(a, b);};
template <typename T> inline void chmin(T &a, const T& b){if(a>b)a=b;}
template <typename T> inline void chmax(T &a, const T& b){if(a<b)a=b;}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  if (n == m) cout << "Yes" << '\n';
  else cout << "No" << '\n';
}


Measured memory_bytes: 256
class AtCoder:
    def main(self):
        N, T = map(int, input().split())
        time = [int(t) for t in input().split()]

        ans = T
        before = time[0]
        for i in range(1, len(time)):
            ans += min(T, time[i] - before)
            before = time[i]
        print(ans)


if __name__ == '__main__':
    AtCoder().main()

Measured memory_bytes: 25836
// clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define forever for (;;)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
template<typename A> using V = std::vector<A>;
template<typename A> using F = std::function<A>;
template<typename A, typename B> using P = std::pair<A, B>;
using pii = P<int, int>;
using vi = V<int>;
using vd = V<double>;
using vs = V<std::string>;
using vpii = V<pii>;
using vvi = V<vi>;
using vvpii = V<vpii>;
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = 3.14159265358979;
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
constexpr bool odd(const int &n) { return n & 1; }
constexpr bool even(const int &n) { return ~n & 1; }
template<typename T> std::istream &operator>>(std::istream &is, std::vector<T> &v) { for (T &x : v) is >> x; return is; }
template<typename A, typename B> std::istream &operator>>(std::istream &is, std::pair<A, B> &p) { is >> p.first; is >> p.second; return is; }
using namespace std;
// clang-format on

main {
  int n;
  cin >> n;
  vi p(n);
  cin >> p;
  int mini = INF;
  rep(i, p[0] + 1) {
    vi q = p;
    int s = i;
    q[0] -= i;
    rep(j, n - 1) {
      s += q[j] * 2;
      q[j + 1] = max(0LL, q[j + 1] - q[j]);
    }
    s += q[n - 1];
    cmin(mini, s);
  }
  cout << mini << endl;
}

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

#define EPS (1e-10)
#define rep(i, a, b) for (int i = a; i < (int)(b); ++i)
#define rrep(i, a, b) for (int i = b - 1; i >= (int)(a); --i)
#define all(a) a.begin(), a.end()

using namespace std;
using ll = long long;
using vi = vector<int>;
using vb = vector<bool>;
using vll = vector<ll>;
using vd = vector<double>;
using vvi = vector<vi>;
using vvb = vector<vb>;

constexpr int MOD = 1000000007;

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

    string s;
    cin >> s;

    vi ans(s.size(), 0);
    int rpos = -1, rcnt = 0, lcnt = 0;
    bool r = true;

    rep(i, 0, s.size()) {
        if (r) {
            if (s[i] == 'R') {
                ++rcnt;
            } else {
                rpos = i - 1;
                r = false;
                ++lcnt;
            }
        } else {
            if (s[i] == 'L') {
                ++lcnt;
            } else {
                ans[rpos] = (rcnt + 1) / 2 + lcnt / 2;
                ans[rpos + 1] = rcnt / 2 + (lcnt + 1) / 2;
                r = true;
                rcnt = 1;
                lcnt = 0;
            }
        }
    }

    ans[rpos] = (rcnt + 1) / 2 + lcnt / 2;
    ans[rpos + 1] = rcnt / 2 + (lcnt + 1) / 2;

    rep(i, 0, s.size()) { cout << ans[i] << " "; }
    cout << endl;

    return 0;
}

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

#define pb push_back
using namespace std;

int main()
{
    ios_base::sync_with_stdio(0);

    string in;
    cin >> in;

    vector<string> s;

    int curr;

    for (int i = 0; i < in.length(); ++i) {
        if (in[i] == '0') {
            s.pb("0");
        } else if(in[i] == '1') {
            s.pb("1");
        } else if (in[i] == 'B' && s.size()) {
            s.pop_back();
        }
    }

    for (string ss : s) {
        cout << ss;
    }
}


Measured memory_bytes: 3592
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n) ; ++i)
#define FOR(i,a,b) for(int i = (a); i < (b); ++i)
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define emb emplace_back

using namespace std;
using ll = long long;
using P = pair<int,int>;

template<typename T> void pv(vector<T> vec) {
  cout << "[";
  for(auto& v : vec) { cout << v << ","; }
  cout << "]" << endl;
}

template<>
void pv(vector<P> vec) {
  cout << "[";
  for(auto& v : vec) {
    cout << "<" << v.fi << ","<< v.se << ">" << ",";
  }
  cout << "]" << endl;
}

int main() {
  string s;
  cin >> s;
  if(s == "AAA" or s == "BBB") cout << "No" << endl;
  else cout << "Yes" << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <vector>
#include <iostream>
#include<algorithm>
#include<string>
#include <map>
#include <queue>

using namespace std;

int main() {
    string S, T;
    cin >> S >> T;

    vector<vector<int>> lett(26),lett_t(26);
    for (int i = 0; i < S.size(); i++) {
        lett[S[i] - 97].push_back(i);
        lett_t[T[i] - 97].push_back(i);
    }
    /*
    for (int i = 0; i < 26; i++) {
        char moji = i + 97;
        cout << moji << "  ";
        cout << lett[i].size() << endl;
    }
    */
    int flag = 1;

    for (int i = 0; i < 26; i++) {
       // cout << "i=" << i << endl;
        //cout << lett[i].size() << endl;
        if (lett[i].size() >= 1) {
            for (int j = 0; j < lett[i].size() - 1; j++) {
                if (T[lett[i][j]] != T[lett[i][j + 1]]) {
                    flag = 0;
                    break;
                }
            }
        }
        if (flag == 0)break;
    }

    for (int i = 0; i < 26; i++) {
        //cout << "i=" << i << endl;
        //cout << lett[i].size() << endl;
        if (lett_t[i].size() >= 1) {
            for (int j = 0; j < lett_t[i].size() - 1; j++) {
                if (S[lett_t[i][j]] != S[lett_t[i][j + 1]]) {
                    flag = 0;
                    break;
                }
            }
        }
        if (flag == 0)break;
    }
    if (flag) cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 3080