akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;



namespace Test1 {

    class ClassMain {

        public static void Main(String[] args) {

            String line;
                
            while ((line = Console.ReadLine())!=null) {
                String[] strs = line.Split(' ');
                int n = int.Parse(strs[0]);
                int w = int.Parse(strs[1]);
                int h = int.Parse(strs[2]);
                int[] w_serve_dupli = new int[w+1];
                int[] h_serve_dupli = new int[h+1];
                //Information loading.
                for (int i = 0; i < n; i++) {
                    strs = Console.ReadLine().Split(' ');
                    int x = int.Parse(strs[0]);
                    int y = int.Parse(strs[1]);
                    int range = int.Parse(strs[2]);
                    w_serve_dupli[Math.Max(0, x - range)]++;
                    w_serve_dupli[Math.Min(w, x + range)]--;
                    h_serve_dupli[Math.Max(0, y - range)]++;
                    h_serve_dupli[Math.Min(h , y + range )]--;
                }
                
                //Console.WriteLine(string.Join(",", w_serve_dupli));
                //Console.WriteLine(string.Join(",", h_serve_dupli));
                //Console.ReadLine();

                //Judge. 
                bool perfectServe_flag = true;
                int dupli = 0;
                for (int i = 0; i < w; i++) {
                    dupli += w_serve_dupli[i];
                    if (dupli == 0) { perfectServe_flag = false; break; }
                }
                if (perfectServe_flag) { Console.WriteLine("Yes"); return; }
                
                perfectServe_flag = true;
                dupli = 0;
                for (int i = 0; i < h; i++) {
                    dupli += h_serve_dupli[i];
                    if (dupli == 0) { perfectServe_flag = false; break; }
                }
                if (perfectServe_flag) { Console.WriteLine("Yes"); return; }
                Console.WriteLine("No");
                break;

            }
        }

        
        
    }
}

Measured memory_bytes: 20956
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  long a[n];
  int i;
  for(i=0;i<n;i++){
    cin >> a[i];
  }
  long ans = 0;
  for(i=0;i<n;i++){
    while(a[i]%2==0){
      a[i]/=2;
      ans++;
    }
  }
  cout << ans;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,k,a[10001],sum=0;
	cin>>n>>k;
	for(int i=1;i<=n;i++) cin>>a[i];
	for(int i=1;i<=n-1;i++)
		for(int j=i+1;j<=n;j++)
		{
			if(a[i]<a[j]) swap(a[i],a[j]);
		}
	for(int i=1;i<=k;i++) sum+=a[i];
	cout<<sum<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define y1 __zzd001
using namespace std;
const int N=2005;
int n,d,v[N][N],s[3][N][N];
int S(int x1,int y1,int x2,int y2,int t){
	return s[t][x2][y2]-s[t][x2][y1-1]-s[t][x1-1][y2]+s[t][x1-1][y1-1];
}
int check(int x){
	int r=x%d;
	for (int i=1;i<=d;i++)
		for (int j=1;j<=d;j++){
			int x1=i,y1=j,x2=x1+r,y2=y1+r,x3=x1+d-1,y3=y1+d-1;
			if (!S(x1,y2+1,x3,y3,1)&&!S(x2+1,y1,x3,y3,1)&&!S(x2+1,y2+1,x3,y3,0))
				return 1;
		}
	return 0;
}
int main(){
	scanf("%d%d",&n,&d);
	memset(v,0,sizeof v);
	while (n--){
		int x,y;
		scanf("%d%d",&x,&y);
		v[x%d+1][y%d+1]++;
	}
	int Mx=0,t;
	for (int i=1;i<=d;i++)
		for (int j=1;j<=d;j++)
			v[i+d][j]=v[i][j+d]=v[i+d][j+d]=v[i][j],Mx=max(Mx,v[i][j]);
	for (t=0;(t+1)*(t+1)<Mx;t++);
	int l[3]={t*t+1,t*(t+1)+1,(int)1e9};
	for (int i=1;i<=d*2;i++)
		for (int j=1;j<=d*2;j++)
			for (int t=0;t<2;t++){
				s[t][i][j]=s[t][i-1][j]+s[t][i][j-1]-s[t][i-1][j-1];
				if (l[t]<=v[i][j]&&v[i][j]<l[t+1])
					s[t][i][j]++;
			}
	int L=t*d,R=t*d+d-1,ans=R,mid;
	while (L<=R)
		if (check(mid=(L+R)>>1))
			R=mid-1,ans=mid;
		else
			L=mid+1;
	cout << ans;
	return 0;
}

Measured memory_bytes: 48768
#include<iostream>
#include<vector>
#include<cstdio>
#include<string>
#include<cmath>
#include<math.h>
#include<algorithm>
#include<string.h>
#include <iomanip>
#include <sstream>
using namespace std;

int main() {
  int N;
  int ans = 0;

  cin >> N;

  ans = N*N*N;

  cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(n); ++i)
using namespace std;
using ll=long long;
int main(){
    int n;
    cin>>n;
    vector<int>a(n);
    rep(i,n)cin>>a[i];
    ll x=0;
    rep(i,n){
        if(i%2==0)x+=a[i];
        else x-=a[i];
    }
    vector<int>ans(n);
    ans[0]=x/2;
    rep(i,n-1){
        ans[i+1]=a[i]-ans[i];
    }
    rep(i,n)cout<<ans[i]*2<<" ";
    cout<<endl;
}

Measured memory_bytes: 2048
import sys
sys.setrecursionlimit(10**6)
MOD=10**9+7
def facinv(N):
    fac,finv,inv=[0]*(N+1),[0]*(N+1),[0]*(N+1)
    fac[0]=1;fac[1]=1;finv[0]=1;finv[1]=1;inv[1]=1
    for i in range(2,N+1):
        fac[i]=fac[i-1]*i%MOD
        inv[i]=MOD-inv[MOD%i]*(MOD//i)%MOD
        finv[i]=finv[i-1]*inv[i]%MOD
    return fac,finv,inv

def PER(n,r):
    if n<r or r<0:
        return 0
    else:
        return (fac[n]*finv[n-r])

def dfs(v,p,dep):
    global res
    c=0
    for nv in G[v]:
        if nv==p:
            continue
        dfs(nv,v,dep+1)
        c+=1
    if dep==0:
        res=(res*PER(K-1,c)%MOD)
    else:
        res=(res*PER(K-2,c)%MOD)
    
N,K=map(int,input().split())
G=[[] for i in range(N)]
for i in range(N-1):
    a,b=map(lambda x:int(x)-1,input().split())
    G[a].append(b)
    G[b].append(a)
fac,finv,inv=facinv(max(K,N))
res=K
dfs(0,-1,0)
print(res%MOD)

Measured memory_bytes: 101552
#include <bits/stdc++.h>
using namespace std;
int dp[10001];
int main()
{
  int health,n;
  cin>>health>>n;
  int A[n],B[n];
  memset(dp,0x3f, sizeof(dp));
  dp[0]=0;
  for(int index=0;index<n;++index)
  {
    cin>>A[index]>>B[index];
    for(int j=0;j<health;++j)
    {
      dp[min(j+A[index],health)]=min(dp[min(j+A[index],health)],dp[j]+B[index]);
    }
  }
  cout<<dp[health]<<endl;
  return 0;
}


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

constexpr int Inf = std::numeric_limits<int>::max();

class SegTree {
public:
	explicit SegTree(int _n) {
		n = 1;
		while (n < _n)
			n *= 2;

		node = std::vector<int>(2 * n - 1, 0);
	}

	void update(int i, int x) {
		i += n - 1;

		node[i] += x;
		while (i > 0) {
			i = parent(i);
			node[i] += x;
		}
	}

	int query(int a, int b, int k = 0, int l = 0, int r = -1) {
		if (r == -1)
			r = n;

		if (r <= a || b <= l)
			return 0;
		if (a <= l && r <= b)
			return node[k];

		const auto c = children(k);
		return query(a, b, c.first, l, (l + r) / 2) + query(a, b, c.second, (l + r) / 2, r);
	}

private:
	int parent(int i) {
		return (i - 1) / 2;
	}
	std::pair<int, int> children(int i) {
		return { 2 * i + 1, 2 * i + 2 };
	}

	int n;
	std::vector<int> node;

};

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

	SegTree tree(n);
	for (int i = 0; i < q; ++i) {
		int com, x, y;
		std::cin >> com >> x >> y;

		if (com == 0)
			tree.update(x - 1, y);
		else
			std::cout << tree.query(x - 1, y) << std::endl;
	}
}

Measured memory_bytes: 3904
#include <iostream>
#include <string>
using namespace std;
int main() {
    int i,j,a,b;
    int count=0;
    string s;
    cin>>s;
    if(s[0]=='1')count++;
    if(s[1]=='1')count++;
    if(s[2]=='1')count++;
    cout<<count;
    return 0;
}

Measured memory_bytes: 256
import java.io.*;
import java.util.*;

public class Main {

	public static void main(String[] args) throws IOException{
		Scanner scan = new Scanner(System.in);
		int n = Integer.parseInt(scan.nextLine());
		String[] str = new String[n];
		String az = "abcdefghijklmnopqrstuvwxyz";
		String ans = "";
		boolean judge = true;
		for(int i = 0; i < str.length; i++){
			str[i] = scan.nextLine();
		}
		for(int i = 0; i < az.length();){
			judge = true;
			for(int j = 0; j < n ; j++){
				if(!str[j].matches(".*" + az.substring(i, i + 1) + ".*")){
					judge = false;
					break;
				}else{
					str[j] = str[j].replaceFirst(az.substring(i, i + 1), "");
				}
			}
			if(judge == true){
				ans += az.substring(i, i + 1);
			}else{
				i++;
			}
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 29440
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;

ll min(ll a,ll b){
    if(a<b)return a;
    else return b;
}
ll max(ll a,ll b){
    if(a>b)return a;
    else return b;
}

int main() {
    ll n,m;cin>>n>>m;
    if(n==1){
        if(m==1){
            cout<<1<<endl;;
        }else{
            cout<<m-2<<endl;
        }
    }else{
        if(m==1){
            cout<<n-2<<endl;
        }else{
            cout<<(n-2)*(m-2)<<endl;
        }
    }
    
    
    return 0;
}


Measured memory_bytes: 256
#pragma warning (disable:4996)
#include <stdio.h>
#include <math.h>
#define PI 3.14159265

int main(void){
	double a, b, C, S, L, h;

	scanf("%lf %lf %lf", &a, &b, &C);
	S = a * b * sin(C * PI / 180) / 2;
	L = a + b + sqrt(pow(a, 2) + pow(b, 2) - 2 * a * b * cos(C * PI / 180));
	h = 2 * S / a;

	printf("%lf\n%lf\n%lf\n", S, L, h);

	return 0;
}

Measured memory_bytes: 676
#include<iostream>
#include<cstdio>
#include<vector>
#include<queue>
#include<algorithm>
#include<complex>
#include<cstdlib>
#include<cctype>

#define REP(i,n) for(int i = 0;i < (n);i++)
#define PB push_back
#define MP make_pair
#define SHOW1d(v,n) {for(int i = 0;i < (n);i++)cout << v[i] << ' ';cout << endl << endl;}
#define SHOW2d(v,i,j) {for(int a = 0;a < i;a++){for(int b = 0;b < j;b++)cout << v[a][b] << ' ';cout << endl;}cout << endl;}
#define ALL(v) v.begin(),v.end()

using namespace std;

typedef long long ll;
typedef vector<int> iv;
typedef vector<iv> ivv;


int main()
{
	int n,q;
	
	while(cin >> n >> q,n)
	{
		int sum[101] = {0};
		int conb[n][101] = {0};
		REP(i,n)
		{
			int m;
			cin >> m;
			REP(j,m)
			{
				int tmp;
				cin >> tmp;
				conb[i][tmp] = 1;
			}
		}
		
		REP(a,101)
		{
			REP(i,n)
			{
				sum[a] += conb[i][a];
			}
		}
		int ret = 0;
		int _max = 0;
		
		REP(i,101)
		{
			if(_max < sum[i])
			{
				ret = i;
				_max = sum[i];
			}
		}	
		
		if(_max < q)
			cout << 0 << endl;
		else
			cout << ret << endl;
		
	}
	
	return 0;
	
}

Measured memory_bytes: 3016
import sys
from collections import defaultdict
from queue import deque
readline = sys.stdin.buffer.readline
#sys.setrecursionlimit(10**8)


def geta(fn=lambda s: s.decode()):
    return map(fn, readline().split())


def gete(fn=lambda s: s.decode()):
    return fn(readline().rstrip())


def egcd(a: int, b: int):
    """
    A solution of ax+by=gcd(a,b). Returns
    (gcd(a,b), (x, y)).
    """
    if a == 0:
        return b, 0, 1
    else:
        g, x, y = egcd(b % a, a)
        return g, y - (b // a) * x, x


def modinv(a: int, mod: int = 10**9 + 7):
    """
    Returns a^{-1} modulo m.
    """
    g, x, y = egcd(a, mod)
    if g > 1:
        raise Exception('{}^(-1) mod {} does not exist.'.format(a, mod))
    else:
        return x % mod


def modpow(a: int, n: int, mod: int = 10**9 + 7):
    """
    Returns a^n mod m. (-inf < n < inf)
    """
    if a in [-1, 0, 1]:
        if a == -1:
            return 1 if n & 1 == 0 else mod - 1
        else:
            return a

    x, k = (a % mod, n) if n >= 0 else (modinv(a, mod), -n)

    ret = 1
    while k > 0:
        if k & 1 == 1:
            ret = ret * x % mod
        x = (x**2) % mod
        k = k >> 1

    return ret


def main():
    N = gete(int)

    d = dict()

    for _ in range(N):
        a, b = geta(int)
        if a == b == 0:
            if (0, 0) in d:
                d[(0, 0)] += 1
            else:
                d[(0, 0)] = 1
            continue

        if a != 0 and b != 0:
            g, _, _ = egcd(a, b)
            ai, bi = a // g, b // g
            if ai < 0:
                ai *= -1
                bi *= -1

            aj, bj = bi, -ai
            if aj < 0:
                aj *= -1
                bj *= -1
        elif a == 0:
            ai, bi = 0, 1
            aj, bj = 1, 0
        elif b == 0:
            ai, bi = 1, 0
            aj, bj = 0, 1

        if (ai, bi) in d:
            d[(ai, bi)][0] += 1
        elif (aj, bj) in d:
            d[(aj, bj)][1] += 1
        else:
            d[(ai, bi)] = [1, 0]

    mod = 1000000007
    ans = 1
    for k in d:
        if k != (0, 0):
            n = modpow(2, d[k][0], mod)
            m = modpow(2, d[k][1], mod)

            ans = ans * (n + m - 1) % mod
    if (0, 0) in d:
        ans = (ans + d[(0, 0)]) % mod

    print((ans - 1) % mod)


if __name__ == "__main__":
    main()

Measured memory_bytes: 137548
using System;
using System.Linq;

namespace _060_CardGame
{
	class Program
	{
		static void Main ( string[] args )
		{
			string inputStr;

			while ((inputStr = Console.ReadLine ()) != null)
			{
				int[] cards = inputStr.Split (' ').Select (int.Parse).ToArray ();

				int myHandSum = cards[0] + cards[1];
				int max = 20 - myHandSum;

				//?¶?????????????????????§???
				if (max < 10)
				{
					int notExistCount = 0;

					//?????¨???????????????????????????
					for (int i = 0; i < cards.Length; i++)
					{
						if (cards[i] <= max)
							notExistCount++;
					}

					double winPercent = (max - notExistCount) / 7.0;

					if (0.5 <= winPercent)
						Console.WriteLine ("YES");
					else
						Console.WriteLine ("NO");
				}
				//???????¶??????????20????¶???????????????§
				else
				{
					Console.WriteLine ("YES");
				}
			}
		}
	}
}

Measured memory_bytes: 9248
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[][] s = new int[n][26];
		for (int i = 0; i < n; i++) {
			char[] a = sc.next().toCharArray();
			for (int j = 0; j < a.length; j++) {
				s[i][a[j]-'a']++;
			}
		}
		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < 26; i++) {
			int min = 50;
			for (int j = 0; j < n; j++) {
				min = Math.min(min,s[j][i]);
			}
			for (int j = 0; j < min; j++) {
				sb.append((char)(i+'a'));
			}
		}
		System.out.println(new String(sb));
		sc.close();
	}
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
const int iinf = 1 << 28;
const long long llinf = 1ll << 60;
const double PI = 3.14159265;

void work() {
    ll N,A,B; cin>>N>>A>>B;
    ll nclusters = N / (A+B);
    ll ans = nclusters * A;
    ans += min(A, N % (A+B));
    cout << ans << endl;
}

int main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    work();
    return 0;
}


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

int main() {
  int H, W;
  cin >> H >> W;

  int i;
  vector<string> vec(H);

  for (i=0;i<H;i++){
    cin >> vec.at(i);
  }

  for (i=-1;i<W+1;i++){
    cout << "#";
  }
  cout << endl;
  for (i=0;i<H;i++){
    cout << "#" + vec.at(i) + "#" << endl;
  }
  for (i=-1;i<W+1;i++){
    cout << "#";
  }
  cout << endl;
}

Measured memory_bytes: 256
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::*;
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
#[allow(unused_imports)]
use std::f64::consts::*;

#[allow(unused)]
const INF: usize = std::usize::MAX / 4;
#[allow(unused)]
const M: usize = 1000000007;

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),* $(,)*) => {
        #[cfg(debug_assertions)]
        eprintln!(concat!($("| ", stringify!($a), "={:?} "),*, "|"), $(&$a),*);
    };
}

fn main() {
    input! {
        n: usize,
        q: usize,
        a: [usize; n],
        query: [(usize, usize, usize); q],
    }
    let mut bit = FenwickTree::new(n, 0);
    for i in 0..n {
        bit.add(i, a[i]);
    }
    for k in 0..q {
        if query[k].0 == 0 {
            let (_, p, x) = query[k];
            bit.add(p, x);
        } else {
            let (_, l, r) = query[k];
            println!("{}", bit.sum(l, r));
        }
    }
}
//https://github.com/rust-lang-ja/ac-library-rs

pub mod fenwicktree {
    // Reference: https://en.wikipedia.org/wiki/Fenwick_tree
    pub struct FenwickTree<T> {
        n: usize,
        ary: Vec<T>,
        e: T,
    }

    impl<T: Clone + std::ops::AddAssign<T>> FenwickTree<T> {
        pub fn new(n: usize, e: T) -> Self {
            FenwickTree {
                n,
                ary: vec![e.clone(); n],
                e,
            }
        }
        pub fn accum(&self, mut idx: usize) -> T {
            let mut sum = self.e.clone();
            while idx > 0 {
                sum += self.ary[idx - 1].clone();
                idx &= idx - 1;
            }
            sum
        }
        /// performs data[idx] += val;
        pub fn add<U: Clone>(&mut self, mut idx: usize, val: U)
        where
            T: std::ops::AddAssign<U>,
        {
            let n = self.n;
            idx += 1;
            while idx <= n {
                self.ary[idx - 1] += val.clone();
                idx += idx & idx.wrapping_neg();
            }
        }
        /// Returns data[l] + ... + data[r - 1].
        pub fn sum(&self, l: usize, r: usize) -> T
        where
            T: std::ops::Sub<Output = T>,
        {
            self.accum(r) - self.accum(l)
        }
    }

    #[cfg(test)]
    mod tests {
        use super::*;

        #[test]
        fn fenwick_tree_works() {
            let mut bit = FenwickTree::new(5, 0i64);
            // [1, 2, 3, 4, 5]
            for i in 0..5 {
                bit.add(i, i as i64 + 1);
            }
            assert_eq!(bit.sum(0, 5), 15);
            assert_eq!(bit.sum(0, 4), 10);
            assert_eq!(bit.sum(1, 3), 5);
        }
    }
}
use fenwicktree::*;


Measured memory_bytes: 37104
import sys
import math
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
H,W= LI()

if H == 1 or W == 1:
    print(1)
else:
    ans = (H*W+1)/2
    print(int(ans))

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

int main() {
	ll n; cin >> n;
	ll a[201000], b[201000];
	vector<pair<ll,ll>>v;
	for (int i = 0; i < n; ++i) {
		cin >> a[i] >> b[i];
		v.push_back({ b[i], i });
	}
	sort(v.begin(), v.end());
	ll now = 0;
	for (int i = 0; i < n; ++i) {
		now += a[v[i].second];
		if (now > b[v[i].second]) {
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 9584
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <cmath>
#include <iomanip>
#include <algorithm>
using namespace std;

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


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

int main() {
    int H,W;
    cin >> H >> W;
    char array[H][W];
    for (int i=0; i<H; i++) {
        for (int j=0; j<W; j++) {
            cin >> array[i][j];
        }
    }

    for (int i=0; i<H; i++) {
        bool flg = true;
        for (int j=0; j<W; j++) {
            if (array[i][j] == '#') {
                flg = false;
                break;
            }
        }
        if (flg) {
            for (int j=0; j<W; j++) {
                array[i][j] = ' ';
            }
        }
    }

    for (int j=0; j<W; j++) {
        bool flg = true;
        for (int i=0; i<H; i++) {
            if (array[i][j] == '#') {
                flg = false;
                break;
            }
        }
        if (flg) {
            for (int i=0; i<H; i++) {
                array[i][j] = ' ';
            }
        }
    }

    for (int i=0; i<H; i++) {
        bool flg = false;
        for (int j=0; j<W; j++) {
            if (array[i][j] != ' ') {
                cout << array[i][j];
                flg = true;
            }
        }
        if (flg)
            cout << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include "stdio.h"
#include "stdlib.h"
#include "iostream"
#include "math.h"
#include <string.h>
#include <stack>
#include <queue>
#include <map>
#include <string>
#include "algorithm"


using namespace std;
#define fori0(G) for(int i=0;i<G;i++)
#define fori1(G) for(int i=1;i<=G;i++)
#define forj0(G) for(int j=0;j<G;j++)
#define forj1(G) for(int j=1;j<=G;j++)
#define fork0(G) for(int k=0;k<G;k++)
#define fork1(G) for(int k=1;k<=G;k++)
int dx[] = { -1,0,1,0 ,0 }, dy[] = { 0,1,0,-1,0 };
#define nxnycon (0<=nx&&nx<h&&0<=ny&&ny<w) 
#define lo long long int

int a, b;




int main() {
	
	cin >> a>>b;
	cout << (int)((b - a)*(b - a - 1) / 2 - a);
	//system("pause");
	return 0;

}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int(i) = 0; (i) < (n); (i)++)
#define all(x) (x).begin(), (x).end()

int main()
{
    string s;
    cin >> s;
    vector<int> a(s.size(), 0);
    int count = 0;
    rep(i, s.size())
    {
        if (s[i] == 'A' || s[i] == 'C' || s[i] == 'G' || s[i] == 'T')
            count++;
        else
        {
            a.push_back(count);
            count = 0;
        }
    }
    a.push_back(count);

    sort(all(a));
    cout << a.back() << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
	Scanner sc=new Scanner(System.in);
	String s=sc.next();

	if(s.contains("eraser")) {
		s=s.replace("eraser", "");
	}
	if(s.contains("erase")) {
		s=s.replace("erase", "");
	}
	if(s.contains("dreamer")) {
		s=s.replace("dreamer", "");
	}
	if(s.contains("dream")) {
		s=s.replace("dream", "");
	}
	
	System.out.println(s.equals("")?"YES":"NO");
	}
}

Measured memory_bytes: 28620
#if 0
date +%Y.%m.%d

题解先咕着。
#endif
#include <cstdio>
#include <algorithm>
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define NO return puts("No"), 0
#define YES return puts("Yes"), 0

inline int input() { int x; scanf("%d", &x); return x; }

const int maxn = 100005;
int a[maxn], b[maxn];

int main() {
	int n = input();
	for(int i = 1; i <= n; i ++)
		a[i] = input();
	std::sort(a + 1, a + n + 1);
	if(n % 3 == 0) {
		int p = 1;
		for(int i = 1; i <= n; i += 3)
			b[i] = a[p ++];
		if(a[p - 1] != b[1])
			NO;
		for(int i = 2; i <= n; i += 3)
			b[i] = a[p ++];
		if(a[p - 1] != b[2])
			NO;
		for(int i = 3; i <= n; i += 3)
			b[i] = a[p ++];
		if(a[p - 1] != b[3])
			NO;
		if((b[3] ^ b[1]) != b[2])
			NO;
		YES;
	} else {
		if(a[1] == a[n] and a[1] == 0)
			YES;
		else
			NO;
	}
}

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

typedef long long ll;
using namespace std;

ll n;
ll a[200010];
ll sum[200010];
ll f[200010];
int main()
{
  cin >> n;
  for(int i = 1; i <= n; i++)
  {
    cin >> a[i];
  }
  sum[1] = a[1];
  for(int i = 2; i <= n; i++)
   {
		sum[i] = sum[i-2] + a[i];
   }
    for(int i = 2; i <= n; i++)
      {
        if(i & 1)
        {
				f[i] = max(f[i-2] + a[i], f[i-1]);
        }
        else
        {
			f[i] = max(f[i-2] + a[i], sum[i-1]);
        }
      }
      cout << f[n] << endl;
	return 0;
}

Measured memory_bytes: 8304
from collections import deque
 
N, Q = map(int, input().split())
Ki = [[] for _ in range(N)]
for _ in range(N-1):
    p, c = map(int, input().split())
    Ki[p-1].append(c-1)
    Ki[c-1].append(p-1)
S = [0]*N
for _ in range(Q):
    node, score = map(int, input().split())
    S[node-1] += score
 
stack = deque([0])
done = [0]*N
done[0] = 1
 
while len(stack) > 0:
    now = stack.pop()
    
    for new in Ki[now]:
        if done[new] == 0:
            done[new] = 1
            stack.append(new)
            S[new] += S[now]
    
print(*S)

Measured memory_bytes: 126380
#include <bits/stdc++.h>
#define int long long
#define endl '\n'
#define FOR(i, a, n) for (int i = (a); i < (n); ++i)
#define REP(i, n) FOR(i, 0, n)
using namespace std;

using T = double;
const T EPS = 1e-10;
T torad(int deg) {return (T)(deg) * M_PI / 180;}
T todeg(T ang) {return ang * 180 / M_PI;}

/* Point */
using P = complex<T>;
#define x real()
#define y imag()
template <typename T> inline bool eq(T p, T q) { return abs(p - q) < EPS; }
inline int sgn(T x) { return (T(0) < x) - (x < T(0)); }
inline T dot(P v, P w) { return (conj(v) * w).x; }
inline T cross(P v, P w) { return (conj(v) * w).y; }
inline bool isOrth(P v, P w) { return dot(v, w) == 0; }
inline bool isPara(P v, P w) { return cross(v, w) == 0; }
inline P translate(P p, P v) { return p + v; }
inline P scale(P p, P c, T k) { return c + (p - c) * k; }
inline P rot(P p, T a) { return p * polar(1.0, a); }
inline P rot90(P p) { return {-p.y, p.x}; }
inline T orient(P a, P b, P c) { return cross(b - a, c - a); }
istream& operator>>(istream& is, P& p) { T xx, yy; is >> xx >> yy; p = P(xx, yy); return is; }
bool cmpX(const P& a, const P& b) { return a.x != b.x ? a.x < b.x : a.y < b.y; }
namespace std {
    bool operator < (const P& a, const P& b) { return cmpX(a, b); }
}

/* Polygon */
vector<P> makeStandard(vector<P> p) {
    int n = p.size(), j = -1;
    for (int i = 0; i < n; ++i) {
        if (j == -1 || p[i].y < p[j].y) j = i;
    }
    vector<P> res;
    if (p[(j - 1 + n) % n].x <= p[j].x && p[j].x <= p[(j + 1) % n].x) {
        for (int i = 0; i < n; ++i) {
            res.push_back(p[(i + j) % n]);
        }
    } else {
        for (int i = 0; i < n; ++i) {
            res.push_back(p[(i - j + n) % n]);
        }
    }
    return res;
}
bool isConvex(vector<P> p) {
    p = makeStandard(p);    // p[0] has minimum y and p is counterclockwise
    for (int i = 0, n = p.size(); i < n; ++i) {
        P a = p[i], b = p[(i + 1) % n], c = p[(i + 2) % n];
        if (orient(a, b, c) < 0) return false;
        if (b.y != p[0].y && b.y < min(a.y, c.y)) return false;
        if (b.y != p[0].y && a.y == b.y && b.y == c.y && a.x <= b.x && b.x <= c.x) return false;
    }
    return true;
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int n;
    cin >> n;
    vector<P> ps(n);
    REP (i, n) cin >> ps[i];
    cout << isConvex(ps) << endl;
}


Measured memory_bytes: 3300
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main() {
  string s; cin >> s;
  ll K; cin >> K;
  ll x1;
  for (ll i = 0; i < s.size(); i++) {
    if (s[i] != '1') {x1 = i; break;}
  }
  if (K <= x1) {cout << 1 << endl;}
  else {cout << s[x1] << endl;}
}


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

using namespace std;

#define ll long long

int main()
{
	int a, b, w;
	int ans = 0;
	
	cin >> w >> a >> b;

	if (a < b) {
		if (a + w < b) ans = b - a - w;
	} else {
		if (b + w < a) ans = a - b - w;
	}
	cout << ans << endl;

	return (0);
}

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

#include <algorithm>
#include <queue>
#include <cctype>

using namespace std;

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

int N, W;
long long dp[103][100003];
long long w[103],v[103];

int main() {
    cin >> N >> W;
    rep(i, N) {
        cin >> w[i] >> v[i];
    }
    dp[0][0] = 0;
    rep(i, N) {
        rep(j, W+1) {
            if (j < w[i]) {
                dp[i+1][j] = dp[i][j];
            }
            else {
                dp[i + 1][j] = max(dp[i][j], dp[i][j - w[i]] + v[i]);
            }
        }
    }
    cout << dp[N][W] << '\n';
}

Measured memory_bytes: 79360
/*
　　こんにちは。あたしはｶｳｶﾞｰﾙ。
　　redcoderになるためAtCoderを巡る旅をしてます。

　　　 　 ＿_
　　　 ヽ|＿_|ノ　　　　ﾓｫ
　　　　||‘‐‘||ﾚ　　_)_, ―‐ 、
　　　　/(Ｙ (ヽ＿ /・ ヽ　　 ￣ヽ
　　　　∠ ＿ ゝ　 ｀^ヽ ﾉ.::::_(ノヽ
　　　　 _/ヽ　 　　  /ヽ￣￣/ヽ
*/

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define dump(x)  cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) << endl

#define rep(i, n) REP(i, 0, n)                              // 0, 1, ..., n-1
#define REP(i, x, n) for(int i = x; i < n; i++)             // x, x + 1, ..., n-1
#define FOREACH(x,a) for(auto& (x) : (a) )

#define ALL(v) (v).begin() , (v).end()
#define RALL(v) (v).rbegin(), (v).rend()

#define COUT(x) cout << (x) << endl

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

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

    int n; cin >> n;
    vector<int> X(n);
    vector<int> Y(n);
    set<P> st;
    rep(i, n) {
        cin >> X[i] >> Y[i];
        st.insert(P(X[i], Y[i]));
    }
    vector<P> vx;
    int ans = 0;
    rep(i, n) {
        rep(j, n) {
            if(i == j) continue;
            P p = P(X[i] - X[j], Y[i] - Y[j]);
            int cnt = 0;
            rep(k, n) {
                P q = P(p.first + X[k], p.second + Y[k]);
                if(st.count(q)) cnt++;
            }
            ans = max(ans, cnt);
        }
    }
    cout << n - ans << endl;
}


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

int map[101][101];
int d[101][101];

int main() {
    int n, m;
    cin >> m;
    n = 2;

    for (int i = 1; i <= n; i++)
        for (int j = 1; j <= m; j++)
            cin >> map[i][j];

    for (int i = 0; i <= n; i++) {
        d[i][0] = d[0][i] = 0;
    }

    for (int i = 1; i <= n; i++)
        for (int j = 1; j <= m; j++)
            d[i][j] = max(d[i - 1][j], d[i][j - 1]) + map[i][j];

    cout << d[n][m];
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cassert>
#include <iomanip>
#include <utility>
#include <cmath>
#include <numeric>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <queue>
#include <string>

using namespace std;

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

#define rep(i, n) for (int i = 0; i < n; i++)
#define repext(i, a, b) for (int i = a; i < b; i++)
#define reprev(i, n) for (int i = n - 1; i >= 0; i--)
#define repextrev(i, a, b) for (int i = b - 1; i >= a; i--)

#define repv(v, values) for (auto v : values)

#define vec_all(vec) vec.begin(), vec.end()
#define sum(vec) accumulate(vec_all(vec), 0)
#define srt(vec) sort(vec_all(vec))

// vectorデバッグ
template <typename T>
void dump_vec(vector<T> vec)
{
    rep(i, vec.size())
    {
        cout << i << ": " << vec[i] << endl;
    }
}

template <typename T, typename S>
void dump_dic(map<T, S> dic)
{
    for (auto v : dic)
    {
        cout << v.first << ": " << v.second << endl;
    }
}

// --- notice ---
// intの和はllにしろ

int main()
{
    vector<vector<int>> map(3, vector<int>(3));
    rep(i, 3) {
        rep(j, 3) {
            cin >> map[i][j];
        }
    }

    if ((map[0][0] - map[1][0] == map[0][1] - map[1][1]) && (map[0][1] - map[1][1] == map[0][2] - map[1][2]) &&
        (map[1][0] - map[2][0] == map[1][1] - map[2][1]) && (map[1][1] - map[2][1] == map[1][2] - map[2][2]) &&
        (map[0][0] - map[0][1] == map[1][0] - map[1][1]) && (map[1][0] - map[1][1] == map[2][0] - map[2][1]) &&
        (map[0][1] - map[0][2] == map[1][1] - map[1][2]) && (map[1][1] - map[1][2] == map[2][1] - map[2][2])) {
            cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
// Problem : C - Tsundoku
// Contest : AtCoder - AtCoder Beginner Contest 172
// URL : https://atcoder.jp/contests/abc172/tasks/abc172_c
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

//#pragma GCC optimize "trapv"//  WA to RE int!!
#include <bits/stdc++.h>
#define FOR(i,n) for(int i=0;i<n;i++)
#define FORR(i,n) for(int i=n;i>=0;i--)
#define pb push_back
#define vlli vector<int>
#define slli set<int>
#define mlli map<int,int>
#define int long long int 
#define test int tt1234; cin>>tt1234;while(tt1234--)
#define endl "\n"
#define all(zz) zz.begin(),zz.end()
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define error(x) cerr << #x <<" is " << x << endl;
#define Error(a,b) cerr<<"( "<<#a<<" , "<<#b<<" ) = ( "<<(a)<<" , "<<(b)<<" )\n";
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
#define fint fast;test
#define SI(a,n) int a[n];FOR(i,n) cin>>a[i];
#define input(a,n) int n;cin>>n; SI(a,n)
#define set(a,x) memset(a,x,sizeof(a))
#define L(x)	((x)<<1)
#define R(x)	(((x)<<1)+1)
#define ft first
#define se second
#define MOD 1000000007
using namespace std;

void solve(){
	int n1,n2,tot;
	cin>>n1>>n2>>tot;
	vlli arr(n1),arr2(n2);
	FOR(i,n1)cin>>arr[i];
	FOR(i,n2)cin>>arr2[i];
	int ans=0;
	int j=n2;
	rep(i,1,n1)arr[i]+=arr[i-1];
	rep(i,1,n2)arr2[i]+=arr2[i-1];
	arr.insert(arr.begin(),0);
	arr2.insert(arr2.begin(),0);
	FOR(i,n1+1){
		if(arr[i]>tot)break;
		while(j>=0 && arr2[j]>tot-arr[i])j--;
		ans=max(ans,i+j);
	}
	cout<<ans;
	return;	
}


int32_t main() {
    // fint{
    	fast;
    	solve();
    // }
    return 0;
}


Measured memory_bytes: 7944
#include<stdio.h>

int main(){

long N,A,B;
scanf("%ld%ld%ld",&N,&A,&B);

if (A==0)
{
  puts("0");
}else if(N%(A+B)>A){
  printf("%ld",N/(A+B)*A + A);
}else if(N%(A+B)<=A)
{
  printf("%ld",N/(A+B)*A + N%(A+B));
}

return 0;

}

Measured memory_bytes: 1732
#https://atcoder.jp/contests/keyence2019/tasks/keyence2019_c
#2019-01-13

N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
D = [A[i] - B[i] for i in range(N)]
D.sort(reverse = 1)

rakudai = 0
fusoku = 0
for i in range(N):
    if D[i] < 0 :
        rakudai += 1
        fusoku -= D[i]

if sum(A) < sum(B):
    print(-1)
elif rakudai == 0:
    print(0)
else:
    hitsuyou = [0, 0]
    for i in range(N):
        hitsuyou[0] += 1
        hitsuyou[1] += D[i]
        if hitsuyou[1] >= fusoku:
            print(rakudai + hitsuyou[0])
            break

Measured memory_bytes: 18356
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll dig[20];

ll dfs(int l,int r,ll d){
  if(l<=r) return d ? 0 : ((l==r)?10:1);
  ll t=(10-d%10)%10;
  ll v=d-dig[l-r]*t+t;
  return ((r?10:9)-t)*dfs(l-1,r+1,llabs(v)/10);
}

int countDigit(ll d){
  if(!d) return 0;
  return 1 + countDigit(d/10);
}

int countZero(ll d){
  if(d%10) return 0;
  return 1+countZero(d/10);
}

int main(){
  dig[0]=1;
  for(int i=1;i<19;i++)
    dig[i] = dig[i-1]*10;
  ll d;
  cin>>d;
  int cd=countDigit(d);
  int cz=countZero(d);
  ll ans = 0;
  for(int i=1;i<=cd*2;i++) {
    ans += dfs(i,0,d);
    //cout<<ans<<endl;
  }
  //cout<<endl;
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using static System.Console;
using static System.Math;

namespace Atcoder
{
    class Program
    {
        static StreamWriter sw = new StreamWriter(OpenStandardOutput()) { AutoFlush = false };
        static void Main(string[] args)
        {
            try
            {
                SetOut(sw);
                Solve.Answer();
                Out.Flush();
            }
            catch (Exception ex)
            {
                WriteLine(ex.ToString());
                Out.Flush();
            }
        }
    }

    public class Solve
    {
        public static void Answer()
        {
            var N = IO.RLong;
            var dic = new Dictionary<long, long>();
            for (int i = 0; i < N; i++)
            {
                var tmp = IO.RSInt;
                dic[tmp[0]] = tmp[1];
            }
            var ndic = dic.OrderBy(x => x.Key);
            long ans = 0;
            ans += ndic.First().Key - 1;
            ans += ndic.Last().Key - ndic.First().Key + 1;
            ans += ndic.Last().Value;
            WriteLine(ans);
        }
    }

    public class IO
    {
        #region Input
        public static int RInt => int.Parse(ReadLine());
        public static long RLong => long.Parse(ReadLine());
        public static double RDouble => double.Parse(ReadLine());

        public static string[] RSString => ReadLine().Split();
        public static int[] RSInt => ReadLine().Split().Select(s => int.Parse(s)).ToArray();
        public static long[] RSLong => ReadLine().Split().Select(s => long.Parse(s)).ToArray();
        public static double[] RSDouble => ReadLine().Split().Select(s => double.Parse(s)).ToArray();
        #endregion

        #region Output
        public static void OutJoinSpace<T>(IEnumerable<T> list) => WriteLine(string.Join(" ", list));
        public static void WriteLineYes_or_No(bool flag) => WriteLine(flag ? "Yes" : "No");
        public static void WriteLineYES_or_NO(bool flag) => WriteLine(flag ? "YES" : "NO");
        #endregion
    }

    public class Mod
    {
        #region
        private readonly static long M = 1000000007;

        public static long Add(long a, long b) => (a * b) % M;
        public static long Sub(long a, long b) => (a - b) % M >= 0 ? (a - b) % M : (a - b) % M + M;
        public static long Multi(long a, long b) => (a * b) % M;
        #endregion
    }
}

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

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

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int n; cin>>n;
	set<string> used;
	string prev,w;
	cin>>prev;
	used.insert(prev);
	for (int i=1; i<n; i++) {
		cin>>w;
		if(used.find(w)!=used.end()) {
			cout << "No" << endl;
			return 0;
		}
		used.insert(w);
		if(prev.back()!=w.front()) {
			cout << "No" << endl;
			return 0;
		}
		prev=w;
	}
	cout << "Yes" << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define len(v) ll(v.size())
#define fi first
#define se second

template <class T>
void cout_vec(const vector<T> &vec){
  for(auto itr:vec) cout<<itr<<' ';
  cout<<endl;
}

typedef pair<ll,ll> P;
const ll mod=1e9+7;
const ll inf=1e15;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  string s;
  cin>>s;
  rep(i,len(s)){
    if(i%2==0){
      if(s[i]!='R' && s[i]!='U' && s[i]!='D'){
        cout<<"No"<<endl;
        return 0;
      }
    }else{
      if(s[i]!='L' && s[i]!='U' && s[i]!='D'){
        cout<<"No"<<endl;
        return 0;
      }
    }
  }
  cout<<"Yes"<<endl;
}

Measured memory_bytes: 256
n = int(input())
txy = [[int(0)] * 3]
txy += ([list(map(int, input().split())) for i in range(n)])

for i in range(n):
    t_diff = txy[i+1][0] - txy[i][0]
    xy_diff = (txy[i+1][1] + txy[i+1][2]) - (txy[i][1] + txy[i][2])

    if t_diff % 2 != xy_diff % 2 or xy_diff > t_diff:
        print("No")
        exit()

print("Yes")

Measured memory_bytes: 28068
//Daniel Grzegorzewski
#include <bits/stdc++.h>

#define MP make_pair
#define PB push_back
#define ST first
#define ND second

using namespace std;

typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<PII> VII;
typedef long long LL;

void init_ios()
{
     ios_base::sync_with_stdio(0);
     cin.tie(0);
}

bool vis[4];

int main()
{
    init_ios();
    string s;
    cin >> s;
    for (int i = 0; i <  s.size(); ++i) {
    	if (s[i] == 'N')
    		vis[0] = true;
    	if (s[i] == 'W')
    		vis[1] = true;
    	if (s[i] == 'S')
    		vis[2] = true;
    	if (s[i] == 'E')
    		vis[3] = true;
    }
    if (vis[0] && !vis[2])
    	cout<<"No\n";
    else if (!vis[0] && vis[2])
    	cout<<"No\n";
    else if (vis[1] && !vis[3])
    	cout<<"No\n";
    else if (!vis[1] && vis[3])
    	cout<<"No\n";
    else
    	cout<<"Yes\n";
}

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

using namespace std;

typedef long long ll;

const int INF = 1e9;

class Die {
public:
  Die(vector<int> numbers) {
    vertical_ = vector<int>(4);
    horizontal_ = vector<int>(4);
    vertical_[0] = numbers[0];
    vertical_[1] = numbers[4];
    vertical_[2] = numbers[5];
    vertical_[3] = numbers[1];
    horizontal_[0] = numbers[0];
    horizontal_[1] = numbers[2];
    horizontal_[2] = numbers[5];
    horizontal_[3] = numbers[3];
  }

  int get_top() const { return vertical_[0]; }
  int get_right() const { return horizontal_[1]; }
  int get_front() const { return vertical_[3]; }
  void rotate_north()
  {
    rotate(vertical_.rbegin(), vertical_.rbegin() + 1, vertical_.rend());
    update(vertical_, horizontal_);
  }
  void rotate_south()
  {
    rotate(vertical_.begin(), vertical_.begin() + 1, vertical_.end());
    update(vertical_, horizontal_);
  }
  void rotate_east()
  {
    rotate(horizontal_.rbegin(), horizontal_.rbegin() + 1, horizontal_.rend());
    update(horizontal_, vertical_);
  }
  void rotate_west()
  {
    rotate(horizontal_.begin(), horizontal_.begin() + 1, horizontal_.end());
    update(horizontal_, vertical_);
  }

  int find_right(int top, int front)
  {
    if (find(horizontal_.begin(), horizontal_.end(), front) != horizontal_.end()) {
      while (get_top() != front) {
        rotate_east();
      }
    }
    while (get_front() != front) {
      rotate_north();
    }

    while (get_top() != top) {
      rotate_east();
    }
    return get_right();
  }

  bool operator==(const Die& rhs) const
  {
    Die d1 = rhs;
    for (int i = 0; i < 4; ++i) {
      Die d2 = d1;
      for (int j = 0; j < 4; ++j) {
        Die d3 = d2;
        for (int k = 0; k < 4; ++k) {
          Die d4 = d3;
          for (int l = 0; l < 4; ++l) {
            if (vertical_ == d4.vertical_ && horizontal_ == d4.horizontal_) {
              return true;
            }
            d4.rotate_west();
          }
          d3.rotate_south();
        }
        d2.rotate_east();
      }
      d1.rotate_north();
    }
    return false;
  }

  string dump() const
  {
    stringstream ss1, ss2;
    for (int i = 0; i < 4; ++i) {
      ss1 << vertical_[i] << ",";
      ss2 << horizontal_[i] << ",";
    }
    return ss1.str() + "|" + ss2.str();
  }

private:
  vector<int> vertical_, horizontal_;

  void update(vector<int>& from, vector<int>& to)
  {
    to[0] = from[0]; to[2] = from[2];
  }

};

int main()
{
  int n = 0;
  fscanf(stdin, "%d", &n);
  vector<Die> dice;
  vector<int> digits(6);
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < 6; ++j) {
      fscanf(stdin, "%d", &digits[j]);
    }
    dice.push_back(Die(digits));
  }
  // for (int i = 0; i < n; ++i) {
  //   fprintf(stderr, "DEBUG: %s\n", dice[i].dump().c_str());
  // }
  bool differ = true;
  for (int i = 0; i < n; ++i) {
    for (int j = i + 1; j < n; ++j) {
      if (dice[i] == dice[j]) {
        differ = false;
        break;
      }
    }
    if (!differ) { break; }
  }
  fprintf(stdout, "%s\n", differ ? "Yes" : "No");
  return 0;
}

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

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

int main(void)
{
	int N, K;
	cin >> N >> K;

	int ans = 1;
	Rep(i, N){
		if(ans * 2 < ans + K){
			ans *= 2;
		}else{
			ans += K;
		}
	}
	cout << (ans) << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll n,a,b;
    string s;
    ll yos = 0;
    ll kai=0;
    cin >> n >> a >> b >> s;
    for(int i=0;i<n;i++){
        if(s.at(i)=='b')kai++;

        if(s.at(i)=='a'&&yos<a+b){
            yos++;
            cout << "Yes" << "\n";
        }
        else if(s.at(i)=='b'&&yos<a+b&&kai<=b){
            yos++;
            cout <<  "Yes" << "\n";
        }
        else{
            cout << "No" << "\n";
        }
    }

    return 0;
}

Measured memory_bytes: 848
#include <bits/stdc++.h>
#define arep(a,i,n) for(int i=(a);i<(n);i++)
#define rep(i,n) for(int i=0;i<(n);i++)
#define cinf(x,n) for(int i=0;i<(n);i++)cin>>x[i];
#define coutf(x,n) for(int i=0;i<(n);i++)cout<<x[i]<<endl;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

using namespace std;

int main(){
	string s;
	cin >> s;
	ll n = s.length();
	rep(i,n){
		if(s[i]=='?'){
			s[i]='D';
		}
	}
	cout << s << endl;
}

Measured memory_bytes: 3724
#include <bits/stdc++.h>
 
using namespace std;
 
template <typename A, typename B>
string to_string(pair<A, B> p);
 
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);
 
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);
 
string to_string(const string& s) {
  return '"' + s + '"';
}
 
string to_string(const char* s) {
  return to_string((string) s);
}
 
string to_string(bool b) {
  return (b ? "true" : "false");
}
 
string to_string(vector<bool> v) {
  bool first = true;
  string res = "{";
  for (int i = 0; i < static_cast<int>(v.size()); i++) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(v[i]);
  }
  res += "}";
  return res;
}
 
template <size_t N>
string to_string(bitset<N> v) {
  string res = "";
  for (size_t i = 0; i < N; i++) {
    res += static_cast<char>('0' + v[i]);
  }
  return res;
}
 
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
 
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
 
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}
 
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}
 
void debug_out() { cerr << endl; }
 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
 
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#endif


typedef long long ll; 
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
typedef long double ld;
 
#define mp make_pair
#define pb push_back
#define all(a) a.begin(), a.end()

const int maxN = 502;

const double pi = 3.14159265359;

void solve() {
  double r;
  cin >> r;
  cout.precision(8);
  cout  << pi * r * 2 << endl;
}
 
int main() {
  ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    
  int t = 1;
  // cin >> t;
  while (t--) {
    solve();
  }
 
  return 0;
}

Measured memory_bytes: 3844