akhauriyash/Code-Regression huggingface dataset:
# -*- coding: utf-8 -*-

def main(N,A):
    count4 = count2 = count = 0
    for a in A:
        if(a%4==0):
            count4 += 1
        elif(a%2==0):
            count2 += 1
        else:
            count += 1
            
    if(count2==0):
        if(count-1<=count4):
            print("Yes")
        else:
            print("No")
    else:
        if(count<=count4):
            print("Yes")
        else:
            print("No")
            
if __name__ == '__main__':
    N = int(input())
    A = [int(a) for a in input().split()]
    main(N,A)

Measured memory_bytes: 14252
#include<stdio.h>
#include<string>
#include<utility>
#include<iostream>
#include<queue>
#include<math.h>
#include<algorithm>
#include<vector>
#include<map>
#include<stack>
#include<bitset>
#include<tuple>

using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0;i<(int)(n);i++)

int main(){
    int n;
    int a[105]={};
    double wa=0;
    double seki=1;
    scanf("%d",&n);
    REP(i,n){
        scanf("%d",&a[i]);
        seki*=a[i];
    }
    REP(i,n){
        wa+=seki/a[i];
    }
    double ans=seki/wa;
    printf("%.10lf\n",ans);
    return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,no-stack-protector,fast-math")
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define IO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
using namespace std;
const int N = 1e5 + 5, M = 2 * N + 5;

int mx;
vector<int> a;
int n, m, q, x[N][4];

int check(){
    int ret = 0;

    for(int i = 0 ; i < q ; ++i)
        if(a[x[i][1]] - a[x[i][0]] == x[i][2])
            ret += x[i][3];

    return ret;
}

void f(int i, int lst){
    if(i == n)return mx = max(mx, check()), void();
    for(int j = lst ; j <= m ; ++j){
        a.emplace_back(j);
        f(i + 1, j);
        a.pop_back();
    }
}

int main(){
#ifndef ONLINE_JUDGE
    freopen("input.in", "r", stdin);
#endif
    scanf("%d %d %d", &n, &m, &q);

    for(int i = 0 ; i < q ; ++i)
        for(int j = 0 ; j < 4 ; ++j)
            scanf("%d", x[i] + j);

    a.emplace_back(0);
    f(0, 1);

    printf("%d\n", mx);
}

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

class ST_RMinQ
{
public:
    int n;
    vector<int> dat;

    // 管理する数列のsizeを与える
    // 内部では2の冪の配列で管理
    ST_RMinQ(int size) {
        n = 1;
        while (n < size) {
            n *= 2;
        }

        dat.resize(2 * n - 1);
        
        // 全ての値をINT_MAXで初期化
        for (size_t i = 0; i < 2 * n - 1; i++)
        {
            dat[i] = INT_MAX;
        }
    }

    // k番目(0-indexed)の値をaに変更
    void update(int k, int a) {
        k += n - 1;     // n-1を足すとセグメント木の一番下の節点を表すインデックスになる
        dat[k] = a;
        // 登りながら更新
        while (k > 0) {
            k = (k - 1) / 2;
            dat[k] = min(dat[k * 2 + 1], dat[k * 2 + 2]);
        }
    }   

    // [a, b)の区間(0-indexed)の最小値を求める
    int query(int a, int b) {
        return query_sub(a, b, 0, 0, n);
    }

private:

    // [a, b)の最小値を求める
    // 後ろの引数は簡単のための引数
    // kは節点番号、l,rはその節点が[l, r)に対応していることを表す
    int query_sub(int a, int b, int k, int l, int r) {
        if (r <= a || b <= l) {
            return INT_MAX;
        }

        // [a, b)が[l, r)を完全に含んでいればその値
        if (a <= l && r <= b) {
            return dat[k];
        } else {
            // そうでなければ、2つの子の最小値
            int vl = query_sub(a, b, k * 2 + 1, l, (l + r) / 2);
            int vr = query_sub(a, b, k * 2 + 2, (l + r) / 2, r);
            return min(vl, vr);
        }
    }
};

int N, q;
int com, x, y;

int main()
{
    cin >> N >> q;
    
    ST_RMinQ st(N);

    for (size_t i = 0; i < q; i++)
    {
        cin >> com >> x >> y;
        if (com == 0) {
            st.update(x, y);
        } else {
            cout << st.query(x, y + 1) << endl;
        }
    }
    
}


Measured memory_bytes: 3888
#include <bits/stdc++.h>
using namespace std;
int a[100010], b[100010];
int main()
{
	int n, m, s = 0, c = 0, mx = -1;
	
	scanf("%d%d", &n, &m);
	for (int i = 0; i < n; i++) {
		scanf("%d%d", &a[i], &b[i]);
		mx = max(a[i], mx);
	}
	sort(b, b + n);
	for (int i = n - 1; i >= 0; i--) {
		if (b[i] < mx) break;
		s += b[i];
		c++;
		if (s >= m) {
			break;
		}
	}
//	printf("%d\n", c);
	if (s < m) {
		c += (m - s + mx - 1) / mx;
//		printf("%d\n", c);
	}
	printf("%d\n", c);
}


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

void solve() 
{
    int a[]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    int k;cin>>k;k--;
    cout<<a[k]<<endl;

}

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

Measured memory_bytes: 256
'use strict'
function Main(input) {
    // 入力の取得・整形
    input = input.trim().split("\n")
    input = input.map(elem => {
        // 'x y'といった文字列を配列[x, y]に変換する
        return elem.split(' ').map(str => parseInt(str))
    })
    const N = input[0][0]
 
    // 配列a,bの共通区間を求める関数
    const makeInterval = (a, b) => {
        const start = a[0] > b[0] ? a[0] : b[0]
        const end = a[1] > b[1] ? b[1] : a[1]
        return [start, end]
    }
 
    // 全区間の共通区間を求めていく
    const resultArr = input.reduce((accum, current, index) => {
      if(index === 0) {
          // 最初は[N, M]だからスキップする
          return accum
      }
      return makeInterval(accum, current) 
    }, [1, N])
 
    // [6, 3]のように、開始のほうが大きくなってる場合は0を返す。そうでない場合区間に含まれる数の個数を返す
    const result = (resultArr[0] > resultArr[1]) ? 0 : resultArr[1] - resultArr[0] + 1
 
    console.log(result)
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"))

Measured memory_bytes: 50436
/* 
   AOJ 2300
   Calender Calors
   2016/1/6
*/

#include<stdio.h>
#include<math.h>
#define COLOR_N_MAX 21

struct color
{
  double l, a, b;
};

struct color colors[COLOR_N_MAX];
double dis[100000];
double max;


void calc_sum(int* com, int k)
{
  int i, j;
  double sum = 0;
  for(i = 0; i < k; i++)
    {
      for(j = i + 1; j < k; j++)
	{
	  sum += dis[com[i] * 100 + com[j]];
	}
    }
  if(max < sum)
    {
      max = sum;
    }
}



void combination(int l, int r, int k, int* com, int index)
{
  int i;
  if(l > r + 1) return;
  else if(index > k) return ;
  else if(index == k)
    {
      calc_sum(com, k);
      return ;
    }
 
  for(i = l; i <= r; i++)
    {
      com[index] = i;
      combination(i + 1, r, k, com, index + 1);
    }
}

void answer(int color_n, int member_n)
{
  int i, j;
  double l_dis, a_dis, b_dis;
  
  for(i = 0; i < color_n; i++)
    {
      for(j = i + 1; j < color_n; j++)
	{
	  l_dis = fabs(colors[i].l - colors[j].l);
	  a_dis = fabs(colors[i].a - colors[j].a);
	  b_dis = fabs(colors[i].b - colors[j].b);
	  dis[i * 100 + j] = l_dis * l_dis + a_dis * a_dis + b_dis * b_dis;
	}
    }
  
  int com[member_n];
  combination(0, color_n - 1, member_n,com, 0);
}

int main(void)
{
  int i, color_n, member_n;

  scanf("%d %d", &color_n, &member_n);

  for(i = 0; i < color_n; i++)
    {
      scanf("%lf %lf %lf", &colors[i].l, &colors[i].a, &colors[i].b);
    }

  answer(color_n, member_n);

  printf("%lf\n", max);

  return 0;
}

Measured memory_bytes: 672
#include <cstdio>

using namespace std;

void rec(int n, int w, int &v, int &rw,
        const int W, const int N,
        const int lv[], const int lw[])
{
    v = rw = 0;
    if (n == N) {
        // not remain any treasure
        v = 0;
        rw = w;
    } else if (w < lw[n]) {
        // cannot pack treasure[n]
        rec(n + 1, w, v, rw, W, N, lv, lw);
    } else {
        int v1, v2, w1, w2;

        // through treasure[n]
        rec(n + 1, w        , v, rw, W, N, lv, lw);
        v1 = v;
        w1 = rw;
        // pack treasure[n]
        rec(n + 1, w - lw[n], v, rw, W, N, lv, lw);
        v2 = v + lv[n];
        w2 = rw - lw[n];

        // which is good
        if (v1 > v2) {
            v = v1;
            rw = w1;
        } else if (v1 < v2) {
            v = v2;
            rw = w2;
        } else {
            if (w1 >= w2) {
                v = v1;
                rw = w1;
            } else {
                v = v2;
                rw = w2;
            }
        }
    }
    // printf("  (%d, %d, %d, %d) -> (%d, %d)\n", n, w, v, rw, v, rw);
}

#define SIZE 1001
int dp_v[SIZE][SIZE];
int dp_rw[SIZE][SIZE];

void rec_dp(int n, int w, int &v, int &rw,
        const int W, const int N,
        const int lv[], const int lw[])
{
    // memo'd
    if (dp_v[n][w] != -1 && dp_rw[n][w] != -1) {
        v = dp_v[n][w];
        rw = dp_rw[n][w];
        return;
    }

    v = rw = 0;
    if (n == N) {
        // not remain any treasure
        v = 0;
        rw = w;
    } else if (w < lw[n]) {
        // cannot pack treasure[n]
        rec_dp(n + 1, w, v, rw, W, N, lv, lw);
    } else {
        int v1, v2, w1, w2;

        // through treasure[n]
        rec_dp(n + 1, w        , v, rw, W, N, lv, lw);
        v1 = v;
        w1 = rw;
        // pack treasure[n]
        rec_dp(n + 1, w - lw[n], v, rw, W, N, lv, lw);
        v2 = v + lv[n];
        w2 = rw;

        // which is good
        if (v1 > v2) {
            v = v1;
            rw = w1;
        } else if (v1 < v2) {
            v = v2;
            rw = w2;
        } else {
            if (w1 >= w2) {
                v = v1;
                rw = w1;
            } else {
                v = v2;
                rw = w2;
            }
        }
    }
    // printf("  (%d, %d, %d, %d) -> (%d, %d)\n", n, w, v, rw, v, rw);
    dp_v[n][w] = v;
    dp_rw[n][w] = rw;
}

int main()
{
    for (int icase = 1;; ++icase) {
        int W, N;
        scanf("%d", &W);
        if (W == 0)
            break;
        scanf("%d", &N);

        int v[1000], w[1000];
        for (int i = 0; i < N; ++i)
            scanf("%d,%d", &v[i], &w[i]);

        int retv, retw;
        for (int i = 0; i < SIZE; ++i)
            for (int j = 0; j < SIZE; ++j)
                dp_v[i][j] = dp_rw[i][j] = -1;
        rec_dp(0, W, retv, retw, W, N, v, w);

        printf("Case %d:\n%d\n%d\n", icase, retv, W - retw);
    }

    return 0;
}

Measured memory_bytes: 8984
import sys
input=sys.stdin.readline

def main():
    h,n=map(int,input().split())
    m=0
    AB=[]
    for _ in range(n):
        a,b=map(int,input().split())
        AB.append((a,b))
        m=max(m,a)
    DP=[float('inf')]*(h+m+1)
    DP[0]=0
    for i in range(h+m):
        for a,b in AB:
            if i-a<0:
                continue
            DP[i]=min(DP[i],DP[i-a]+b)
    print(min(DP[h:]))
    
if __name__=='__main__':
    main()

Measured memory_bytes: 42220
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <unordered_map>
using namespace std;
typedef long long ll;

ll mod = 1e9+7;

int main(){
    string s;
    cin >> s;
    const int n = 13;
    vector<vector<ll> > dp(s.length()+1,vector<ll>(n));
    dp[s.length()][0] = 1;
    int dig = 1;
    for (int i=s.length()-1;i>=0;i--){
        if (s[i]=='?'){
            for (int j=0;j<10;j++){
                for (int k=0;k<n;k++){
                    dp[i][((j*dig)+k)%n] += dp[i+1][k];
                    dp[i][((j*dig)+k)%n] %= mod;
                }
            }
        } else {
            for (int k=0;k<n;k++){
                dp[i][((((int)s[i]-'0')*dig)+k)%n] += dp[i+1][k];
                dp[i][((((int)s[i]-'0')*dig)+k)%n] %= mod;
            }
        }
        dig *= 10;
        dig %= n;
    }
    cout << dp[0][5] << endl;
}

Measured memory_bytes: 13696
import java.util.*;

class Main{
	
	public static void main(String args[]){

		Scanner sc = new Scanner(System.in);
		String st = sc.next();

		int cnt = 0;
		for(int n=0;n<st.length();n++){
			if(st.charAt(n) == '+') cnt++;
			else cnt--;
		}

		System.out.println(cnt);

	}
}

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

using ll = long long;

ll dp[3002][3002][4];

int main() {
    int r, c, k, x, y, v;
    cin >> r >> c >> k;
    vector <vector <ll> > grid(r + 1, vector <ll> (c + 1, 0));
    for (int i = 0; i < k; ++i) {
        cin >> x >> y >> v;
        grid[x][y] = v;
    }
    memset(dp, -1, sizeof(dp));
    function <bool(int, int)> isValid = [&](int x, int y) {
        return (x >= 1 && x <= r && y >= 1 && y <= c);
    };
    function <ll(int, int, int)> solve = [&](int x, int y, int taken) {
        if (!isValid(x, y)) return 0LL;
        if (dp[x][y][taken] != -1) return dp[x][y][taken];
        ll ret = 0LL;
        ret = solve(x + 1, y, 0) + ((taken < 3) ? grid[x][y] : 0LL);
        if (taken < 3) ret = max(ret, solve(x, y + 1, taken + 1) + grid[x][y]);
        ret = max(ret, solve(x, y + 1, taken));
        return dp[x][y][taken] = ret;
    };
    cout << solve(1, 1, 0) << endl;
    return 0;
}

Measured memory_bytes: 356204
lines = []
while line = gets
  lines << line.chomp.split(' ').map(&:to_i)
end
lines.delete_at(lines.length - 1)

lines.each do |line|
  if line[0] <= line[1]
    puts "#{line[0]} #{line[1]}"
  else
    puts "#{line[1]} #{line[0]}"
  end
end


Measured memory_bytes: 6864
#include<stdio.h>

int main(){
int W,H,x,y,r;
scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);

if((x-r)<0 || (y-r)<0 || (x+r)>W || (y+r)>H){
printf("No\n");
}else{
printf("Yes\n");
}


return 0;
}

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

int main() {
    int N;
    cin >> N;
    vector<int> ans(N + 1, 0);
    for(int x = 1; x * x < N; x++) {
        for(int y = 1; y * y < N; y++) {
            for(int z = 1; z * z < N; z++) {
                int n = x * x + y * y + z * z + x * y + y * z + z * x;
                if(n <= N)
                    ans[n]++;
            }
        }
    }
    for(int i = 0; i < N; i++) {
        cout << ans[i + 1] << endl;
    }
}

Measured memory_bytes: 3588
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <cstdlib>
#include <ctime>
#include <stdio.h>

using namespace std;

int main()
{
	double a,b,c,d,e,f,x,y;
	double ex;
	while(scanf("%lf%lf%lf%lf%lf%lf",&a,&b,&c,&d,&e,&f)!=EOF){
		x=(c*e-b*f)/(a*e-b*d);
		y=(a*f-c*d)/(a*e-b*d);

		if(x==-x) x=0.0;
		if(y==-y) y=0.0;

		printf("%.3f %.3f\n",x,y);
	}
	
	return 0;

}

Measured memory_bytes: 0
def solve(n, m, war):
    # section scheduling (greedy)
    # 0 ~ n-1
    destroyed = -1
    ans = 0
    for b, a in war:
        if destroyed < a:
            destroyed = b-1
            ans += 1

    return ans


if __name__ == '__main__':
    n, m = map(int, input().split())
    war = []
    for _ in range(m):
        a, b = map(int, input().split())
        a, b = a-1, b-1
        war.append((b, a))
    war.sort()
    print(solve(n, m, war))


Measured memory_bytes: 17004
import sys

n = int(input())
A = list(map(int,input().split()))
product = 1

if 0 in A:
    print(0)
    sys.exit()
else:
    for x in range(n):
        product = product*A[x]
        if product > 10**18:
            print(-1)
            sys.exit()

print(product)

Measured memory_bytes: 21580
#include<bits/stdc++.h>
using namespace std;
int main()
{


    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int a,b,c;
    cin>>a>>b>>c;
    cout<<(a+b+c>=22?"bust":"win")<<"\n";




    return 0;
}



Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <complex>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;


#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 100010


int main(){
  int n;

  scanf("%d", &n);

  int ans = 0;
  int counter = 0;
  int prev = -1;

  for(int i=0;i<n;i++){
    int a;
    scanf("%d", &a);

    if(a != prev){
      ans += counter/2;
      counter = 1;
    }else{
      counter++;
    }

    prev = a;
  }

  ans += counter/2;

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



Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
int main(){
	char a[100],b[100];
	memset(a,0,sizeof(a));
	memset(b,0,sizeof(b));
	scanf("%s\n%s",a,b);
	int s=strlen(a),s1=strlen(b),i=0,j=0;
	while(i<s&&j<s1){
		printf("%c",a[i++]);
		printf("%c",b[j++]);
	}
	for(;i<s;i++)
		printf("%c",a[i]);
	return 0;
}

Measured memory_bytes: 128
#include<iostream>
using namespace std;
int n;
int A[255];
int main()
{
  int res=0;
  cin>>n;
  for(int i = 0;i<n;i++)
    cin>>A[i];

  
  
  k:for(int i = 0;i<n;i++)
  {
    if(A[i]%2==1)
    { 
      cout<<res<<endl;
      return 0;
    } 
 
  }
   for(int i = 0;i<n;i++)
  {
    A[i]/=2;
     if(i==n-1)
     {
       res++;
       goto k;
     }
  }
  
  cout<<res<<endl;
  return 0;
}

Measured memory_bytes: 256
//include
//------------------------------------------
#include <string>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>

#include <numeric>
#include <utility>
#include <complex>

#include <sstream>
#include <iostream>
#include <iomanip>

#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <ctime>

// namespace
using namespace std;

// type alias
using ll = long long;
using ull = unsigned long long;
using comp = complex<double>;

// constant
static const ll MOD = 1000000007LL;
static const double PI = 3.14159265358979323846;

// conversion
inline ll toint(string s) { ll v; istringstream sin(s); sin >> v; return v; }
template<class t> inline string tostring(t x) { ostringstream sout; sout << x; return sout.str(); }

// print
#define RET(x) return cout << x << endl, 0;

// for loop
#define REP(i, a, b) for ((i) = (ll)(a);(i) < (ll)(b);(i)++)
#define REPD(i, a, b) for (ll i = (ll)(a);(i) < (ll)(b);(i)++)
#define REPI(v, vs) for (auto v : vs)

//debug
#define DUMP(x)  cerr << #x << " = " << (x) << endl
#define DEBUG(x) cerr << #x << " = " << (x) << " (l" << __LINE__ << ")" << " " << __FILE__ << endl

int solve() {
	ll n;
	cin >> n;

	vector<ll> as(n);
	REPD(i, 0, n) cin >> as[i];
	vector<ll> values(n + 1);
	values[0] = 1000;
	REPD(i, 0, n) {
		values[i + 1] = values[i];
		REPD(j, 0, i) {
			ll val = values[j + 1] % as[j] + as[i] * (values[j + 1] / as[j]);
			values[i + 1] = max(values[i + 1], val);
		}
	}

	cout << values[n] << endl;

	return 0;
}

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

	solve();

	return 0;
}


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

map<char, int> mp;

int main(){
	string s;
	cin >> s;
	for(auto &i : s){
		mp[i]++;
	}
	if((mp['N'] && !mp['S']) || (!mp['N'] && mp['S'])) puts("No");
	else if((mp['E'] && !mp['W']) || (!mp['E'] && mp['W'])) puts("No");
	else puts("Yes");
}

Measured memory_bytes: 256
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <algorithm>
#include <cassert>
#include <cfloat>
#include <complex>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>



#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define repLRE(i, l, r) for (ll i = (l); i <= (r); ++i)
#define rrepLRE(i, l, r) for (ll i = (l); i >= (r); --i)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define Lower_bound(v, x) \
  distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) \
  distance(v.begin(), upper_bound(v.begin(), v.end(), x))

using ll = long long;
using ull = unsigned long long;
using P = pair<ll, ll>;
using T = tuple<ll, ll, ll>;
using vll = vector<ll>;
using vP = vector<P>;
using vT = vector<T>;
using vvll = vector<vector<ll>>;
using vvP = vector<vector<P>>;
using dqll = deque<ll>;

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

/* Macros reg. ends here */

const ll INF = 1LL << 50;

int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cout << fixed << setprecision(15);

  ll r, g;
  cin >> r >> g;

  cout << 2 * g - r << endl;

  return 0;
}


Measured memory_bytes: 256
using System;
using System.Text.RegularExpressions;

class Prog
{
	static void Main()
	{
		var r = new Regex( @"(.)\1*", RegexOptions.Compiled );
		var S = Console.ReadLine();
		
		var mc = r.Matches( S );
		long sum = 0;
		
		var lv = "";
		var lr = -1;
		
		for( int i=0 ; i<mc.Count ; i++ )
		{
			int left, right;
			
			Match m = mc[ i ];
			
			if( m.Value[ 0 ] == '<' )
			{
				right = m.Value.Length;
				
				for( int n=1 ; n<right ; n++ )
				{
					sum += n;
				}
				
				lr = right;
			}
			else
			{
				left = m.Value.Length;
				
				for( int n=1 ; n<left ; n++ )
				{
					sum += n;
				}
				
				if( lr >= 0 )
				{
					sum += Math.Max( lr, left );
				}
				else
				{
					sum += left;
				}
				
				lr = 0;
			}
			
			lv = m.Value;
		}
		
		if( lv[ 0 ] == '<' && lr > 0 )
		{
			sum += lr;
		}
		
		Console.WriteLine( sum );
	}
}

Measured memory_bytes: 99068
// lcmとかはg++ -std=c++17 default.cppみたいなかんじで
//vector<vector<ll>> piyo(tate,vector<ll> (yoko));

#include <bits/stdc++.h>
#define mod 1000000007
#define INF 1000000000
#define ll long long
#define ln cout<<endl;
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define double long double
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
using namespace std;
ll target;

int main() {
    cin.tie(0);
   	ios::sync_with_stdio(false);
    //double mini=INF;
    ll maxi=0,f=0,sum=0,mini=INF;
    string str,str1,str2;
    ll i,w;
    double h;
    ll n,x,m;
    ll a,b,d,c;
    //multiset<pair<string,ll>> s;
    cin>>str;
    str.erase(str.length()-2);
    while(1){
        if(str.length()%2==0&&str.substr(0,(str.length())/2).compare(str.substr(str.length()/2))==0){
            cout<<str.length()<<endl;
            //cout<<str.substr(0,(str.length())/2)<<" "<<str.substr(str.length()/2)<<endl;
            return 0;
        }
        else str.erase(str.length()-1);
    }

    return 0;
}


Measured memory_bytes: 384
#include <stdio.h>

int main(void) {
	int H, W, l, p;
	
	while(1){

		scanf("%d %d", &H, &W);
		if(H==0 && W==0) break;

		
		for(l=0;l<H;l++){
			
			for(p=0;p<W;p++){
				if((l+p)%2 == 0) {
					printf("#");
					} else {
						printf(".");
					}
			}
			printf("\n");
			
		}
		printf("\n");
	}
	
	return 0;
	
}

Measured memory_bytes: 572
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
 
#include "bits/stdc++.h"
using namespace std;
 
#define pb push_back
#define F first
#define S second
#define f(i,a,b)  for(int i = a; i < b; i++)
 
using ll = long long;
using db = long double;
using ii = pair<int, int>;
 
const int N = 2e5 + 5, LG = 19, MOD = 1e9 + 7;
const int SQ =225;
const long double EPS = 1e-7;
vector<int>p;
struct unionfind{
	vector<int> p,s;
	int c;
	unionfind(int n):p(n,-1),s(n,1),c(n){}
	int find(int a){
		return p[a]==-1?a:(p[a]=find(p[a]));
	}
	//set b to a child of a
	bool unite(int a,int b){
		a=find(a);
		b=find(b);
		if(a==b)return false;
		p[b]=a;
		s[a]+=s[b];
		c--;
		return true;
	}
	bool same(int a,int b){
		return find(a)==find(b);
	}
	int sz(int a){
		return s[find(a)];
	}
};
int32_t main(){
#ifdef ONLINE_JUDGE
    ios_base::sync_with_stdio(0);
    cin.tie(0);
#endif
 
  int n, q;
  ll m;
 
  cin >> n >> m >> q;
  unionfind uf(n);
  vector<ii> nonBridges;
 
  f(i,0,q){
    int u, v, c;
    cin >> u >> v >> c;
    if(c)
      nonBridges.pb(ii(u,v));
    else
      uf.unite(u,v);
  }
 
  if(m == n - 1){
    if(nonBridges.size())
      cout << "No\n";
    else
      cout << "Yes\n";
    return 0;
  }
 
  for(auto x : nonBridges)
  if(uf.same(x.F,x.S)){
    cout << "No\n";
    return 0;
  }
  if(m <= n-uf.c + 1ll*(uf.c)*(uf.c-1)/2)
    cout<<"Yes\n";
  else
    cout<<"No\n";
 
 
  return 0;
}

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

ll modinv(ll a,ll m){
   ll b=m,u=1,v=0;
   while(b){
      ll t=a/b;
      a-=t*b; 
      swap(a,b);
      u-=t*v; 
      swap(u,v);
   }
   u%=m;
   if(u<0) u+=m;
   return u;
}

ll gcd(ll x,ll y){
   if(y==0) return x;
   else return gcd(y,x%y);
}
ll lcm(ll x,ll y){
   return x/gcd(x,y)*y;
}



int main(){
 int n,k;
 cin>>n>>k;

 vector<int> a(n);
 rep(i,n){
    cin>>a[i];
 }
 sort(a.begin(),a.end());

 int ans=0;
 rep(i,k){
    ans+=a[i];
 }
 cout<<ans;
   return 0;
}



Measured memory_bytes: 3524
#include <iostream>
#include <vector>
#include <algorithm> // sort
#include <map> // pair
#include <numeric> // accumulate(begin,end,初期値)

typedef long long ll;
using namespace std;

#define FALSE printf("false\n");
#define TRUE printf("true\n");
#define all(x) (x).begin(),(x).end()
#define print(x) cout<<x<<endl;
#define rep(i,n) for(ll i = 0;i < n;++i)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define SUM(vec) accumulate(all(vec),0);

const ll INF = 1e9+7;

// 各桁の和
template<typename T>
T digit(T num){
  T sum = 0;
  while(num){
    sum += num % 10;
    num /= 10;
  }
  return sum;
}

template<typename T>T gcd(T a,T b){
  if(b == 0)
    return a;
  return gcd(b,a%b);
}
template<typename T>T lcm(T a, T b){
  T g = gcd(a,b);
  return a/g*b; 
}

int main(){
  int w,a,b;cin>>w>>a>>b;
  int tmp = max(a,b);
  a = min(a,b);
  b = tmp;
  
  int ans = b - (a + w);
  if(ans < 0)ans = 0;
  print(ans)
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std; 
int n;
set<string> h;
int main()
{
	cin>>n;
	string str;
	while(n--)
	{
	    cin>>str;
	    h.insert(str);
	}
	int t=h.size();
	cout<<t<<endl;
	return 0;
}

Measured memory_bytes: 19164
n_ = 10**5 + 3
mod = 10**9+7
fun = [1]*(n_+1)
for i in range(1,n_+1):
    fun[i] = fun[i-1]*i%mod
rev = [1]*(n_+1)
rev[n_] = pow(fun[n_],mod-2,mod)
for i in range(n_-1,0,-1):
    rev[i] = rev[i+1]*(i+1)%mod
def nCr(n,r):
    if n <= 0 or r < 0 or r > n: return 0
    return fun[n]*rev[r]%mod*rev[n-r]%mod
  
n,k = map(int, input().split())
l = list(map(int, input().split()))
l.sort()
ma,mi = 0,0
for i,x in enumerate(l):
  ma += nCr(i,k-1)*x
  mi += nCr(n-i-1,k-1)*x
  ma %= mod; mi %= mod
print((ma-mi)%mod)

Measured memory_bytes: 22100
A, B, M = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]

x = [0] * M
y = [0] * M
c = [0] * M

ans = []
ans.append(min(a) + min(b))
for i in range(M):
    x[i], y[i], c[i] = [int(k) for k in input().split()]

for i in range(M):
    ans.append(a[x[i] - 1] + b[y[i] - 1] - c[i])

print(min(ans))

Measured memory_bytes: 27364
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int N = sc.nextInt();
		int X = sc.nextInt();
		int T = sc.nextInt();
		System.out.println((N+X-1)/X*T);
		
		sc.close();
	}
}


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

using namespace std;

int main(void) {
	int N;
	cin >> N;
	int now,prev;
	vector<int> check(N-1,0);
	for (int i = 0; i < N; ++i) {
		cin >> now;
		if (i > 0 && now == prev+1) {
			check[prev-1] = 1;
		}
		prev = now;
	}

	int res = 0;
	for (int i = 0; i < N; ++i) {
		cin >> now;
		res += now;
	}
	for (int i = 0; i < N-1; ++i) {
		cin >> now;
		if (check[i] == 1) {
			res += now;
		}
	}
	cout << res << endl;
	return 0;
}



Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    int x = 0; 
    int rank01 = 1;
    int rank02 = 2;
    int rank03 = 3;
    
    for(int i = 0; i < 10; i++){
        cin >> x;
        if(rank01 < x){
            rank03 = rank02;
            rank02 = rank01;
            rank01 = x;
        }
        else if(rank02 < x){
            rank03 = rank02;
            rank02 = x;
        }
        else if (rank03 < x){
            rank03 = x;
        }
    }
    
    std::cout << rank01 << std::endl<< rank02 << std::endl << rank03 << std::endl; 
    
    return 0;
}

Measured memory_bytes: 3044
#include <vector>
#include <iostream>
#include <string>
using namespace std;
using ll = long long;
int main(){
  ll N;
  ll res=0;
  cin >> N;
  for(ll i=1;i<N+1;i++){
    if(i%3==0)continue;
    if(i%5==0)continue;
    res+=i;
  }
  cout << res << endl;

}

Measured memory_bytes: 3596
from sys import stdin


class Main:

    @staticmethod
    def input():
        return stdin.readline()

    @staticmethod
    def solve(input_text):
        t, x = [int(x) for x in input_text.strip().split()]
        return t / x

    @staticmethod
    def main():
        print(Main.solve(Main.input()))


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

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

#define FOR(i,N) for(int i=0;i<N;i++)
#define ROF(i,N) for(int i=N-1;i>=0;i--)
#define ROF1(i,a,b) for(int i=(b);i>=(a);i--)
#define FOR1(i,a,b) for(int i=(a);i<=(b);i++)
#define FORi(i,a,b,c) for(int i=(a);i<=(b);i+=(c))

#define read freopen("IN.txt","r",stdin)
#define write freopen("OT.txt","w",stdout)
#define fastread {ios_base::sync_with_stdio(false);cin.tie(NULL);}
#define mem(a,b)          memset(a,b,sizeof(a))
#define EPS 1e-9
#define PI              acos(-1.0)
#define INF             2e16

#define ll              long long
#define ull             unsigned long long
#define ft              first
#define sd              second
#define bn              begin
#define en              end
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define pll             pair<LL,LL>
#define all(x) x.begin(), x.end()


#define dbg(args...) {cerr<<"-->";debugger::call(#args,args);cerr<<"\n";}
struct debugger {
    static void call(const char* it) {}
    template<typename T, typename ... aT>
    static void call(const char* it, T a, aT... rest) {
        string b;
        for (; *it&&*it != ','; ++it) if (*it != ' ')b += *it;
        cerr << b << "=" << a << " ";
        call(++it, rest...);
    }
};

int main()
{
#ifdef SunWalker
    //read;
   //write;
#endif

     ll n,c=0;
     string str;
     map<string,ll>hs;
     cin>>n;
     FOR(i,n)
     {
          cin>>str;
          sort(all(str));
          hs[str]++;
     }
     for(auto it:hs)
     {
          double x = it.sd;
          x--;
          c+=x*((1+x)/2.0);
     }
     cout<<c<<"\n";

return 0;
}



Measured memory_bytes: 11136
#include <iostream>
//#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
//#include <utility>
//#include <set>
//#include <map>
//#include <queue>
//#include <deque>
//#include <bitset>
//#include <math.h>
using namespace std ;
using ll = long long ;
//using ld = long double ;
using vll = vector<ll> ;
//using vvll = vector<vll> ;
//using vc = vector<char> ;
//using vvc = vector<vc> ;
//using vb = vector<bool> ;
//using vvb = vector<vb> ;
//using pll = pair<ll,ll> ;

//ll mod = 1000000007 ;
//long double pie = acos(-1) ;

//string yorn(bool a){if(a) return"Yes" ; return "No" ;}
//string YorN(bool a){if(a) return"YES" ; return "NO" ;}
//ll gcd(long long a,long long b){if(b==0) return a ; return gcd(b,a%b) ;}
//ll lcm(long long a,long long b){return a/gcd(a,b)*b ;}
//ll sa(long long a,long long b){if(a>b) return a-b ; return b-a ;}
//void mysort(vector<long long> &a){sort(a.begin(),a.end()) ;}
//void myrev(vector<long long> &a){reverse(a.begin(),a.end()) ;}

int main(){
	ll n,k ;
	cin >> n >> k ;
	string s ; cin >> s ;
	ll r = 0 ;
	bool ok = false ;
	for(int i=0;i<n;i++){
		if(s.at(i)=='R'){
			if(!ok){
				ok = true ;
				r++ ;
			}
		}else{
			ok = false ;
		}
	}
	ll subr = min(r,k)*2 ;
	if(k==r-1){
		if(s.at(0)=='R'&&s.at(n-1)=='R') subr-- ;
	}
	if(k>=r){
		subr -= ((s.at(0)=='R')+(s.at(n-1)=='R')) ;
	}
	ll l = 0 ;
	ok = false ;
	for(int i=0;i<n;i++){
		if(s.at(i)=='L'){
			if(!ok){
				ok = true ;
				l++ ;
			}
		}else{
			ok = false ;
		}
	}
	ll subl = min(l,k)*2 ;
	if(k==l-1){
		subl -= (s.at(0)=='L'&&s.at(n-1)=='L') ;
	}if(k>=l){
		subl -= ((s.at(0)=='L')+(s.at(n-1)=='L')) ;
	}
	ll def = 0 ;
	for(int i=0;i<n;i++){
		if(s.at(i)=='L'){
			if(i!=0&&s.at(i-1)=='L') def++ ;
		}else{
			if(i!=n-1&&s.at(i+1)=='R') def++ ;
		}
	}
	cout << def+max(subr,subl) << endl ;
}


Measured memory_bytes: 512
#include<stdio.h>
#include<stdlib.h>

int main(void)
{
	int a, b = 1;
	while(1)
	{
		scanf("%d", &a);
		if(a == 0)break;		
		printf("Case %d: %d\n", b, a);
		b = b+1;		
	}		
} 


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

typedef long long ll;
const ll MOD = 1e9+7;

int main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int k;
    cin>>k;
    int even=0,odd=0;
    for(int i=1;i<=k;i++){
        if(i%2)odd++;
        else even++;
    }
    cout<<odd*even;
    return 0;
}


Measured memory_bytes: 256
M,D = map(int,input().split())
cnt = 0
for m in range(4,M+1):
    for d in range(1,D+1):
        if d>=20:
            d = str(d)
            if int(d[1])>=2:
                if m==int(d[0])*int(d[1]):
                    cnt += 1
print(cnt)

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

using namespace std;

int main(){
    int N, M, C;
    cin >> N >> M >> C ;
    int a[N][M];
    int b[M];
    int count = 0;
    int addresult = 0;

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

    for(int i = 0 ; i < N ; i++){
        addresult = C;
        for(int j = 0 ; j < M ; j++){
            cin >> a[i][j];
            addresult += a[i][j] * b[j] ;
        }

        if(addresult > 0) count++;
    }

    cout << count << endl;

    return 0;

}

Measured memory_bytes: 256
def main():
  import sys
  from collections import deque
  
  h,w=map(int,input().split())

  countWhite=0
  maze=[]
  maze+=[["#"]*(w+2)]
  for e in sys.stdin.readlines():
    maze+=[["#"]+list(e[:-1])+["#"]]
    countWhite+=e.count(".")
  maze+=[["#"]*(w+2)]
  
  xy=[(1,0),(-1,0),(0,1),(0,-1)]
  
  que=deque()
  que.append([1,1,1])
  shortestPath=0
  while(que):
    point=que.popleft()
    x,y,step=point[0],point[1],point[2]

    if (x,y)==(h,w):
      print(countWhite-step)
      break
    if maze[x][y]!=".":
      continue
    maze[x][y]=str(step)
    for i,j in xy:
      que.append([x+i,y+j,step+1])
  else:
    print(-1)

  
if __name__=="__main__":
  main()

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

map<int,int> rec;

int main()
{
    int n,num;
    scanf("%d",&n);
    for(int i = 0; i < n; ++i)
    {
        scanf("%d",&num);
        rec[num]++;
    }
    int m;
    bool flag = true;
    scanf("%d",&m);
    for(int i = 0; i < m; ++i)
    {
        scanf("%d",&num);
        if(rec[num] == 0)
            flag = false;
        else
            rec[num]--;
    }
    if(flag)
        printf("YES\n");
    else
        printf("NO\n");
    return 0;
}


Measured memory_bytes: 9600
import sys

input = sys.stdin.readline


def main():
    S = input().rstrip()
    T = input().rstrip()

    N = len(S)
    M = len(T)
    ans = "z" * N
    for i in range(N - M + 1):
        _S = S[i:i + M]
        is_ok = True
        for j in range(M):
            if _S[j] == "?":
                pass
            elif _S[j] == T[j]:
                pass
            else:
                is_ok = False
        if is_ok:
            candidate = S[:i] + T + S[i + M:]
            candidate = candidate.replace("?", "a")
            if candidate < ans:
                ans = candidate

    if ans == "z" * N:
        print("UNRESTORABLE")
    else:
        print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1000000007;
//cout << setprecision(20) << 

int main() {
    ll n, m; cin >> n >> m;
    ll a, b;
    vector<int> from1(n + 1, 0);
    vector<int> toN(n + 1, 0);
    for (int i = 0; i < m; ++i) {
        cin >> a >> b;
        if (a == 1 || b == 1) {
            if (a > b) swap(a, b);
            from1[b] = 1;
            if (toN[b] == 1) {
                cout << "POSSIBLE" << endl;
                return 0;
            }
        }
        if (a == n || b == n) {
            if (a > b) swap(a, b);
            toN[a] = 1;
            if (from1[a] == 1) {
                cout << "POSSIBLE" << endl;
                return 0;
            }
        }
    }
    cout << "IMPOSSIBLE" << endl;
}

Measured memory_bytes: 4708
S = str(input())
N = len(S) + 1
a = [0]*N
if '>' not in S or '<' not in S:
    print(N*(N-1)//2)
    exit()
res = 0
st = 1
if S[0] == '>':
    st = S.index('<')
    res += st*(st+1)//2
ed = 0
a = 0
b = 0
for i in range(st, N-1):
    if S[i-1] == '>' and S[i] == '<':
        if i != st:
            res += max([a+1,b]) + a*(a+1)//2 + b*(b-1)//2
        if i==N-2:
            ed = -2
            break
        a = 0
        b = 0
        ed = i
    elif i==N-2 and S[i] == '>':
        res += max([a+1,b+1]) + a*(a+1)//2 + b*(b+1)//2
        ed = i
    elif S[i] == '<':
        a += 1
    elif S[i] == '>':
        b += 1
if ed == -2:
    res += 1
elif ed != N-2:
    res += (N-1-ed)*(N-ed)//2
print(res)


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

int main() {
  long x;
  cin >> x;

  long a = 100;
  int year = 0;
  while (a < x) {
    year++;
    a = a * 1.01;
  }
  cout << year << endl;
  return 0;
}

Measured memory_bytes: 3632
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <tuple>
#include <cstring>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<long long, long long> P;
#define rep(i, n) for(long long i=0; i<n; i++)
#define reps(i, s, e) for(long long i=s; i<e; i++)
#define repr(i, n) for(long long i=n-1; i>=0; i--)
#define reprs(i, s, e) for(long long i=e-1; i>=s; i--)

template<typename T>
T gcd(T n, T m){

    if(m > n)  swap(n, m);

    if(m == 0) return n;

    T r = n % m;
    if(r == 0) return m;
    else       return gcd(m, r);
}

int main(){

    cin.tie(0);
    ios::sync_with_stdio(false);

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

    ll l[n+1] = {}, r[n+1] = {};
    
    l[0] = 0;
    r[n] = 0;

    rep(i, n){
        l[i+1] = gcd(a[i], l[i]);
    }

    repr(i, n){
        r[i] = gcd(a[i], r[i+1]);
    }

    // rep(i, n+1){
    //     cout << l[i] << " " << r[i] << endl;
    // }

    ll ans = 0;
    rep(i, n){
        ans = max(ans, gcd(l[i], r[i+1]));
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 2560
#include<stdio.h>
#include<math.h>

int main(){
  int n, x[100], y[100];
  int i, k, max = 0;
  double ans;

  scanf("%d", &n);
  
  for(i = 0; i<n; ++i){
    scanf("%d", &x[i]);
  }
  for(i = 0; i<n; ++i){
    scanf("%d", &y[i]);
  }

  for(i = 1; i<4; ++i){
    ans = 0;
    for(k = 0; k<n; ++k){
      ans += pow(fabs(x[k] - y[k]), i);
      if(max < fabs(x[k] - y[k])){
	max = fabs(x[k] - y[k]);
      }
    }
    ans = pow(ans, 1.0/i);

    printf("%lf\n", ans);
  }

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



Measured memory_bytes: 2108
#include <iostream>
#include <algorithm>
#include <cmath>
#include<iomanip>
using namespace std;
pair<double, double> matrix[10];
double dist(int i, int j){
    return sqrt(pow(matrix[i].first - matrix[j].first, 2) + pow(matrix[i].second - matrix[j].second, 2));
}

int fact(int n){
    if (n == 1) return 1;
    else{
        return n*fact(n-1);
    }
}

int main(){
    int n;
    cin >> n;
    for(int i = 1; i <= n; i ++){
        double x, y;
        cin >> x >> y;
        matrix[i] = {x, y};
    }
    double temp = 0;
    for (int i = 1; i <= n; i ++){
        for(int j = i + 1; j <= n; j ++){
            temp += dist(i, j);
        }
    }
    cout <<setprecision(100) << temp * 2/ n << endl;
    return 0;
}

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



int main() {

    int x,y;
    cin>>x>>y;
int a=0;
bool flag=false;
    for(int i=0;i<=x;i++)
        { //int j=x-i;
        a= 4*i +2*(x-i);
        if(a==y)
            flag=true;
        }
        
        
            if(flag==true)
        cout<<"Yes"<<endl;
            else if(flag==false)
        cout<<"No"<<endl;

        return 0;

}


Measured memory_bytes: 3620
#include <stdio.h>

int u(int ,int);

typedef unsigned long long int ULLI;

int main()
{
    int a=1, b=1, c=1, k;
    int temp;
    ULLI sum = 0;

    scanf("%d", &k);

    while (a <= k) {
        temp= u(a, b);
        temp = u(temp, c);
        sum += temp;

        c++;
        if (c > k) {
            c = 1;
            b++;
        }
        if (b > k) {
            b = 1;
            a++;
        }
    }

    printf("%llu\n", sum);

    return 0;
}

int u(int a, int b)
{
	int r, temp;

    if (a < b) {
        temp = a;
        a = b;
        b = temp;
    }

    r = a % b;
    while (r != 0) {
        a = b;
        b = r;
        r = a % b;
    }
    
    return b;
}

Measured memory_bytes: 1732
#include<iostream>
#include<list>
#include<string>
#include<cctype>
using namespace std;

bool checkString(int* key, string s);
void rotateChar(string* s, int i);

int main()
{
    string text;
	while( getline(cin, text) ){
		char ch;
		string s;
		list<string> table;
		for(int i=0; i<text.size(); i++){
			ch = text[i];
			if(ch!=' ')s.push_back(ch);
			else{ table.push_back(s), s.clear();}
		}		

		int key; // ずらす文字数
		list<string>::iterator i;
		for(i=table.begin(); i!=table.end(); i++){
			// cout << *i << " ";
			if( i->size() == 3 || i->size() == 4 )
				if( checkString(&key, *i) ) break;
		}
	
		for(int i=0; i<text.size(); i++){
			char ch = text[i];
			if(isalpha(ch)){
				char c = ch - 'a';
				ch = 'a' + (c+key)%26;
			}
			cout.put(ch);
		}
		cout << endl;
		text.clear();
	}
    return 0;
}

void rotateChar(string* s, int i) // iは何文字ずらしたいか
{

    for(int j=0; j<s->size(); j++){
        if(!isalpha(s->at(j))){continue;}
        char c = s->at(j) - 'a';
        s->at(j) = 'a' + (c+i)%26;
    }
}

bool checkString(int* key, string s)
{

    for(int i=0; i<26; i++){
        string tmp = s;
        rotateChar(&tmp, i);
        // cout << tmp << endl;
        if( tmp=="the" || tmp=="this" || tmp=="that" ){
            *key=i;
            return true;
        }
    }
    return false;
}
        

Measured memory_bytes: 1176
#include<stdio.h>
#include<ctype.h>
 
int main(void) {
  char a[12],b[12],c[12];
  int wa,wb;
  scanf("%s %s %s",a,b,c);
  for (wa = 0;wa < 12;wa++) {
    if(isalpha(a[wa]) == 0) {
      wa--;
      break;
    } 
  }
  for (wb = 0;wb < 12;wb++) {
    if(isalpha(b[wb]) == 0) {
      wb--;
      break;
    } 
  }
  if(a[wa] == b[0] && b[wb] == c[0]) {
    printf("YES\n");
  } else {
    printf("NO\n");
  }
  return 0;
}

Measured memory_bytes: 128
s = input()
odd = ['R','U','D']
even = ['L','U','D']
for i in range(len(s)):
    t = s[i]
    if(i%2 == 0):
        if(t not in odd):
            print('No')
            exit()
    else:
        if(t not in even):
            print('No')
            exit()
print('Yes')

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

using namespace std;

int main(){
	int h,w;
	while(cin>>h>>w){
	if(h==0 && w==0){
	break;
	}
	else{
	for(int i=1;i<=h;i++){
		for(int j=1; j<=w; j++){
			cout<<'#';
		}
		cout<<endl;
	}
	cout  << endl;
}
}
}


Measured memory_bytes: 3116
#pragma GCC target("avx2")
#pragma GCC optimization("O3")
#pragma GCC optimization("unroll-loops")
#include<bits/stdc++.h>
#define rc(x) return cout<<x<<endl,0
#define pb push_back
#define in insert
#define er erase
#define fd find
#define fr first
#define sc second
typedef long long ll;
typedef long double ld;
const ll INF=0x3f3f3f3f3f3f3f3f;
const ll llinf=(1LL<<62);
const int inf=(1<<30)+(1<<29);
const ll nmax=1e5+50;
const int mod=1e9+7;
using namespace std;
int n,k,i,j,t;
ll a[55],x,ans;
vector<ll>vc;
int main()
{
	//freopen("sol.in","r",stdin);
	//freopen("sol.out","w",stdout);
	//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
	ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0);
	cin>>n>>k;
	for(i=1;i<=n;i++)cin>>a[i];
	for(i=1;i<=min(n,k);i++)
	{
		for(j=0;j<=i;j++)
		{
			x=0;
			vc.clear();
			for(t=1;t<=j;t++)vc.pb(a[t]),x+=a[t];
			for(t=n;t>=n-(i-j)+1;t--)vc.pb(a[t]),x+=a[t];
			sort(vc.begin(),vc.end());
			for(t=0;t<min((int)vc.size(),k-i);t++)if(vc[t]<0)x-=vc[t];
			ans=max(ans,x);
		}
	}
	cout<<ans<<endl;
    return 0;
}

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

using namespace std;

//Nayeem Shahriar Joy,Applied Physics And Electronic Engineering,University of Rajshahi.


long int power(int x,int y)

{
    int temp;

    if(y==0)

    {
        return 1;
    }

    temp=power(x,y/2);

    if(y%2==0)

    {
        return temp*temp;
    }

    else

    {
        return x*temp*temp;
    }
}

int main(void)

{
    int n;
    cin>>n;
    cout<<power(n,3)<<endl;
    return 0;
}

Measured memory_bytes: 3056
if __name__ == '__main__':
    n, k = map(int, input().split())
    ans = 0

    for i in range(n,k+1):
        string = str(i)
        lenI = len(string)
        count = 0
        for j in range(lenI //2 ):
            if string[j] == string[lenI-j-1]:
                count +=1
            if count == lenI //2:
                ans +=1

    print(ans)

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

using namespace std;

typedef long long LL;
typedef vector<int> VI;
typedef pair<int, int> PI;

int main() {
	int h, w;
	while (cin >> h >> w) {
		if (h == 0 && w == 0)
			break;
		for (int i = 0; i < h; i++) {
			for (int j = 0; j < w; j++)
				cout << "#";
			cout << endl;
		}
		cout << endl;
	}
	return 0;
}


Measured memory_bytes: 3088
A, B, M = (int(i) for i in input().split())

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

P = [[int(i) for i in input().split()] for _ in range(M)]

ans = min(a) + min(b)

for i in range(M):
    ans = min(ans, a[P[i][0]-1]+b[P[i][1]-1]-P[i][2])
print(ans)


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

using ll = long long;
using ull = unsigned long long;

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	
	ll n,m,p,x,ans=0,pen=0,cnt=0,task_number=0;
	string s;
	unordered_map<ll,pair<ll,string>> hash;
	cin>>n>>m;
	while (cin>>p>>s)
	{
		auto it = hash.find(p);
		if(it!=hash.end())
		{
			if(hash[p].second!="AC")
			{
			hash[p].first++;
			hash[p].second=s;
			}
		}
		else
		{
			hash[p]=make_pair(0,s);
		}

	}
	for(const auto& m:hash)
	{
		if(m.second.second=="AC")
		{
			pen+=m.second.first;
			ans++;
		}
	}
	cout<<ans<<" "<<pen<<'\n';
    return 0;
}

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

using ll = long long;
using ull = unsigned long long;
using ld = long double;
#define REP(NAME, NUM) for (int NAME = 0; NAME < (NUM); ++NAME)
#define BREP(NAME, NUM) for (int NAME = (NUM)-1; NAME >= 0; --NAME)
#define ALL(NAME) (NAME).begin(), (NAME).end()

#define cMOD 1000000007ULL
#define cINF ((1ll<<62)-1)
#define cINFINT ((1<<30)-1)


int main()
{
	cin.tie( 0 ); ios::sync_with_stdio( false );
	string s;cin>>s;
	map<char, int> mp;
	REP(i,s.size()) mp[s[i]]++;
	
	bool is = true;
	for(auto& m : mp)
	{
		if(m.second != 2) is = false;
	}
	cout << (is?"Yes":"No") << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int x,y;
    cin>>x>>y;
    if(y%2==1)
        cout<<"No"<<endl;
    else if(y>4*x||y<2*x)
        cout<<"No"<<endl;
    else if((y-2*x)%2==1||(4*x-y)%2==1)
        cout<<"No"<<endl;
    else
        cout<<"Yes"<<endl;
}



Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = INT32_MAX;
const ll INFL = INT64_MAX;
const int mod = 1e9 + 7;

template <typename T>
void print_vec(vector<T> v) {
  for (T i : v) cout << i << " ";
  cout << endl;
}

int main() {
  int w, h, x, y;
  cin >> w >> h >> x >> y;
  double a = (double)w * h / 2;
  int b = (w == x * 2 && h == y * 2) ? 1 : 0;
  printf("%.10lf %d\n", a, b);
  return 0;
}

Measured memory_bytes: 256