akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <algorithm>
#include <cmath>
#include <cstring>

using namespace std;

#define REP(i,n) for(int i = 0; i < n; i++)
#define RREP(i,n) for(int i = n - 1; i >= 0; i--)

#define ALL(v) v.begin(),v.end()
#define pb push_back
#define mp make_pair
#define F first
#define S second

#define UNIQUE(v) do{sort(v.begin(), v.end()); v.erase( unique(v.begin(), v.end()), v.end() );} while(0)


#define y0 y3487465
#define y1 y8687969

#define m0(x) memset(x,0,sizeof(x))
#define m1(x) memset(x,63,sizeof(x))

typedef long long ll;
typedef pair<int,int> pi;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pi> vpi;
typedef vector<ll> vll;
typedef vector<vll> vvll;

double EPS = 1e-9;
int INFi = 1000000005;
long long INFll = 1000000000000000005ll;
double PI = acos(-1);
int dirx[8] = {-1,0,0,1,-1,-1,1,1};
int diry[8] = {0,1,-1,0,-1,1,-1,1};
ll MOD = 1000000007;

ll N, K;

int main(){
  cin >> N >> K;
  double ans = 0.0;
  REP(i, N) {
    int c = i + 1;
    int x = 0;
    while(K > c) {
      c *= 2;
      x++;
    }
    ans += pow(2, -x) / N ;
  }

  cout << std::setprecision(11) << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <iomanip> // cout<<setprecision(n)
#include <functional> // std::function<void(ll)>
using namespace std;
#define All(v) (v).begin(),(v).end()
typedef long long ll;
const ll mod = 1000000007;
const ll inf = mod*mod;
const ll d5 = 114514;
const double EPS = 1e-10;
const double INF = 1e+10;
const double PI = acos(-1.0);
int main(){
    int n;
    cin>>n;
    double res = 0;
    for(int i=0;i<n;i++){
        double k;
        cin>>k;
        res+=1/k;
    }
    cout<<setprecision(10)<<1/res<<endl;
}

Measured memory_bytes: 256
def solve(N,W,knap):
    dp=[-1]*(W+1)
    dp[0]=0
    for i in range(0,N):
        v,w=knap[i]
        for j in range(w,W+1):
            if dp[j-w]!=-1:
                dp[j]=max(dp[j],dp[j-w]+v)
    return max(dp)

N,W=map(int,input().split())
knap=[tuple(map(int,input().split())) for _ in range(N)]
print(solve(N,W,knap))


Measured memory_bytes: 5924
/* include c++ libraries */
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <unordered_map>
#include <map>
#include <queue>
#include <set>

/* include c-lang libraries */
#include <climits>
#include <cmath>

/* include my libraries */
//#include <show_vec.hh>

using namespace std;

#define LINE DEBUG{ printf("LINE : %d\n", __LINE__); }
#define DEBUG if(false)

using ll = long long;
template<class T> using vec = vector<T>;

const int MOD = 1000000007;

int main(){
  ll a, b, c, d;
  cin >> a >> b >> c >> d;
  ll X1, X2, X3, X4;
  X1 = b * d;
  X2 = b * c;
  X3 = a * d;
  X4 = a * c;

  ll Y1 = (X1<X2)?X2:X1;
  ll Y2 = (X3<X4)?X4:X3;
  ll Y = (Y1<Y2)?Y2:Y1;
  cout << Y << endl;

  return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n)    for(int i=0;i<n;i++)
 
int main(){
    int n,m,l;  cin>>n>>m>>l;
    long long int a[n][m],b[m][l],c[n][l];
    memset(c,0,sizeof(c));
    rep(i,n){
        rep(j,m){
            cin>>a[i][j];
        }
    }
    rep(i,m){
        rep(j,l){
            cin>>b[i][j];
        }
    }
    rep(i,n){
        rep(j,l){
            rep(k,m){
                c[i][j]+=a[i][k]*b[k][j];
            }
        }
    }
    rep(i,n){
        rep(j,l-1){
            cout<<c[i][j]<<" ";
        }
        cout<<c[i][l-1]<<endl;
    }
    return 0;
}

Measured memory_bytes: 1404
import java.math.BigDecimal;
import java.math.MathContext;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Scanner;
 
public class Main {
 
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a[] = new int[3];
        for (int i = 0;i < 3;++i){
            a[i] = sc.nextInt();
        }
        Arrays.sort(a);
        System.out.println(Math.abs(a[0] - a[2]));
    }
}

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

using namespace std;

typedef pair<int,int> P;

int H,W;
char s[50][51];

int d[50][50];

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

int bfs(){
  queue<P> que;

  for(int i = 0; i < H; i++){
    for(int j = 0; j < W; j++){
      d[i][j] = 100000;/*100000*/
    }
  }

  que.push(P(0,0));
  d[0][0] = 1;

  while(que.size()){
    P p = que.front();
    que.pop();
    if(p.first == H - 1 && p.second == W - 1) break;
    for(int i = 0; i < 4; i++){
        int nx = p.first + dx[i];
        int ny = p.second + dy[i];

        if(0 <= nx && nx < H && 0 <= ny && ny < W && s[nx][ny] != '#' && d[nx][ny] > 10000){
          que.push(P(nx,ny));
          d[nx][ny] = d[p.first][p.second] + 1;
        }
    }
  }

  return d[H - 1][W - 1];
}

int main(){
  cin >> H >> W;
  for(int i = 0; i < H; i++) cin >> s[i];
  int ans = H * W;

  for(int i = 0; i < H; i++){
    for(int j = 0; j < W; j++){
      if(s[i][j] == '#') ans--;
    }
  }

  int dis = bfs();

  if(dis > ans){
    cout << -1 << endl;
    return 0;
  }

  ans -= dis;

  cout << ans << endl;

  return 0;
}

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

int main(){
  int c[3][3];
  for(int i=0; i<3; i++){
    cin >> c[i][0] >> c[i][1] >> c[i][2];
  }
  for(int i=0; i<2; i++){
    for(int j=0; j<2; j++){
      if(c[i+1][j] - c[i][j] != c[i+1][j+1] - c[i][j+1]){
	goto LOOP_END;
      }
    }
  }
  cout << "Yes" << flush;
  return 0;
 LOOP_END:
  cout << "No" << flush;
}

Measured memory_bytes: 256
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        #[cfg(debug_assertions)]
        writeln!(&mut std::io::stderr(), concat!("[DEBUG] ", $(stringify!($a), "={:?} "),*), $($a),*);
    }
}

#[allow(unused_imports)]
use std::cmp::{min, max};

#[allow(unused_imports)]
use std::io::Write;

fn main() {
    input!{
      n: usize,
      k: usize,
      xycs: [(usize, usize, String); n]
    }

    let mut sxy: Vec<Vec<usize>> = vec![vec![0; k*2+1]; k*2+1];
    let mut xys = vec![vec![0; k*2]; k*2];

    for &(x, y, ref s) in xycs.iter() {
        let x = x%(2*k);
        let mut y = y%(2*k);
        if *s == 'W'.to_string() {
            y = (y+k)%(2*k)
        }
        xys[x][y] += 1;
    }
    for x in 0..2*k {
        for y in 0..2*k {
            sxy[x+1][y+1] = sxy[x+1][y] + sxy[x][y+1] + xys[x][y] - sxy[x][y];
        }
    }

    let sum = |x: usize, lx: usize, y: usize, ly: usize| -> usize {
        sxy[x+lx][y+ly] + sxy[x][y] - sxy[x+lx][y] - sxy[x][y+ly]
    };

    let mut ans = 0;
    for x in 0..k {
        for y in 0..k {
            // (x+k-1),(y+k-1)
            // (x+k-1),(y-1)
            // (x-1),(y+k-1)
            // (x-1),(y-1)
            let mut s = sum(x, k, y, k);
            s += sum(x+k, k-x, 0, y);
            s += sum(0, x, y+k, k-y);
            s += sum(x+k, k-x, y+k, k-y);
            s += sum(0, x, 0, y);
            ans = max(ans, max(s, n-s));
        }
    }
    println!("{}", ans);
}

Measured memory_bytes: 90364
n = int(input())
A = [int(i) for i in input().split()]
dp = [0] * n

dp[1] = abs(A[1] - A[0])
for i in range(2, n):
    dp[i] = min(dp[i - 2] + abs(A[i] - A[i - 2]), dp[i - 1] + abs(A[i] - A[i - 1]))

print(dp[-1])

Measured memory_bytes: 13928
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<string>
#include<iostream>
#include<set>
using namespace std;
typedef long long ll;
int main()
{
	int num;
	scanf("%d", &num);
	ll mini = 1010101010, sum = 0;
	for (int i = 0; i < num; i++)
	{
		ll za, zb;
		scanf("%lld%lld", &za, &zb);
		sum += za;
		if (za > zb)mini = min(mini, zb);
	}
	if (mini == 1010101010)printf("0\n");
	else printf("%lld\n", sum - mini);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<string>
#include<cctype> 
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
 
int main(){
  int A,B,C;
  int p,q,r;  
  cin >> A >> B >> C;
  
  if(A>B){
    p=A;
    A=B;
    B=p;
  }
  if(B>C){
    q=B;
    B=C;
    C=q;
  }
  if(A>B){
    r=A;
    A=B;
    B=r;
  }
  
  cout << A+B << endl;
    

  return 0;
} 




Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

const int MAXN = 100;

char res[MAXN][MAXN];

int main() {
    int a,b; cin>>a>>b;

    fill((char*)res, (char*)(res + MAXN), '#');
    for(int i = 0; i < MAXN/2; ++i) {
        for(int j = 0; j < MAXN; ++j) {
            res[i][j] = '.';
        }
    }
    --a; --b;

    // ................ a
    // ................
    // ................
    // ################ b
    // .############### 50 * 100 = 5000
    // ################ 5000 / 2 / 2 = 1250 > 500

    for(int i = MAXN/2 + 1, j = 0; a > 0;) {
        res[i][j] = '.';
        --a;
        j += 2;
        if(j > MAXN-1) {
            i += 2; j = 0;
        }
    }

    for(int i = 0, j = 0; b > 0;) {
        res[i][j] = '#';
        --b;
        j += 2;
        if(j > MAXN-1) {
            i += 2; j = 0;
        }
    }

    cout << "100 100" << endl;
    for(int i = 0; i < MAXN; ++i) {
        for(int j = 0; j < MAXN; ++j) {
            cout << res[i][j] << flush;
        }
        cout << endl;
    }

    return 0;
}


Measured memory_bytes: 256
/* cerberus97 - Hanit Banga */

#include <iostream>
#include <iomanip>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>

using namespace std;

#define pb push_back
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL)

typedef long long ll;
typedef long double ld;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;

const int N = 1e5 + 10, inf = 1e9 + 42;

int main() {
	fast_cin();
	int n; cin >> n;
	vector<pii> r(n);
	for (int i = 1; i <= n; ++i) {
		int x, l;
		cin >> x >> l;
		r[i - 1] = {x + l, x - l};
	}
	sort(r.begin(), r.end());
	ll cur = -inf;
	int ans = 0;
	for (auto& robo : r) {
		if (robo.second < cur) {
			continue;
		} else {
			++ans;
			cur = robo.first;
		}
	}
	cout << ans << endl;
}

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

#define MAX_ELEMENTS 100

using namespace std;

int max(int a, int b) 
{ 
    return (a > b) ? a : b; 
} 

int main()
{
    int n, W, w, v;
    vector< vector<long long int> > dp;
    vector<long long int> wW;
    int weights[MAX_ELEMENTS];
    long long int values[MAX_ELEMENTS];

    cin >> n >> W; 

    for (int i = 0; i < n; i++)
    {
        cin >> w >> v;
        weights[i] = w; values[i] = v;
    }

    for(int i = 0; i <= n; i++)
    {   
        for (int j = 0; j <= W; j++)
            wW.push_back(0);
        dp.push_back(wW);
        wW.clear();
    }

    for (int i = 0; i <= n; i++)
    {
        for (int j = 0; j <= W; j++)
        {
            if (i == 0 || j == 0)
                dp[i][j] = 0;
            else
            {
                if (weights[i-1] <= j)
                    dp[i][j] = max(values[i-1] + dp[i-1][j - weights[i-1]], dp[i-1][j]);
                else
                    dp[i][j] = dp[i-1][j];
            }
        }
    }
    cout << dp[n][W];
}

Measured memory_bytes: 80372
N = int(raw_input())
min = int(raw_input())
max = int(raw_input())
dif = max - min
if max < min:
    min = max

for i in range(N - 2):
    R = int(raw_input())
    if R - min > dif:
        dif = R - min
    if R < min:
        min = R

print dif

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

using namespace std;
using ll = long long;



int main()
{
    int n,h,w;
    cin >> n >> h >> w;
    int cnt = 0;

    for(int i = 0; i < n; i++){
        int a,b; cin >> a >> b;
        if(a >= h && b >= w)cnt++;
    }
    cout << cnt << endl;
}

Measured memory_bytes: 256
H = int(input())
A = [0] + list(map(int, input().split()))

def maxHeapify(A, i):
    l = i*2
    r = i*2 + 1

    if l <= H and A[l] > A[i]:
        largest = l
    else:
        largest = i

    if r <= H and A[r] > A[largest]:
        largest = r  

    if largest != i:
        A[largest], A[i] = A[i], A[largest]
        maxHeapify(A, largest)

for x in range(H//2, 0, -1):
    maxHeapify(A, x)

print("", *A[1:])

 
    


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

using namespace std;

int main(){
	int n,x;
	int count = 0;
	int min_m = 1e5;
	cin >> n >> x;
	int m[n];
	bool j = true;
	for(int i = 0; i<n; i++){
		cin >> m[i];
		min_m = min(min_m,m[i]);
		x -= m[i];
		if(x<0){
			j = false;
			break;
		}
		count++;
	}
	while(true){
		if(j == false) break;
		x -= min_m;
		if(x<0){
			j = false;
			break;
		}
		count++;
	}
	cout << count << endl;
}

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

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

  map<int, int> m;
  int x;
  rep (i, n){
    cin >> x;
    if (m[x] == 0) m[x] = 1;
    else m[x] = 0;
  }
  int count = 0;
  for (P p : m){
    if (p.second == 1) ++count;
  }
  cout << count << endl;
  return 0;
}

Measured memory_bytes: 8096
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
  Name:- OMHARI 
  Institution:- UNIVERSIT OF CALCUTTA(INFORMATION TECHNOLOGY)
  Email:- omharicu@gmail.com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
#include<bits/stdc++.h>
using namespace std; 

#define F               first
#define S               second
#define ull             unsigned long long
#define ll              long long
#define db              long double
#define ST              string
#define pb              push_back
#define mp              make_pair
#define el              "\n"
#define vll             vector <ll>
#define vi              vector <int>
#define pii             pair <int, int>
#define pll             pair <ll, ll>
#define vec(v)          vector <v>
#define all(v)          (v.begin(), v.end()) 
#define rall(v)         (v.rbegin(), v.rend()) 
#define is_sort(v)      is_sorted all(v)
#define max_of(v)       *max_element all(v)
#define min_of(v)       *min_element all(v)
#define itos(s)         to_string(s)
#define cntone(x)       __builtin_popcountll(x)
#define cntzro(x)       __builtin_clz(x)
#define clr(x,y) 		memset(x, y, sizeof(x))
#define For(i, a, b)    for(int i=a; i<b; i++)
#define Forr(i, a, b)   for(int i=a; i>=b; i--)
const ll mod = 1e9+7;

void solve()
{
    ll n, nn, nnn;
    cin>>n;
    nn=n;
    nnn=n;

    if(n==1)
    {
        cout<<0;
        return;
    }

    //n-=2;
    ll ans=1;
    // nn=nn*(nn-1)/2;
    // ans*=nn;
    // ans*=2;
    // ans%=mod;
    ll ans1=1, ans2=1;
    while(n>0)
    {
        ans*=10;
        ans%=mod;
        //ans=((ans%mod)*10)%mod;
        n--;
    }
    while(nn>0)
    {
        ans1*=8;
        ans1%=mod;
        //ans=((ans%mod)*10)%mod;
        nn--;
    }

    while(nnn>0)
    {
        ans2*=9;
        ans2%=mod;
        //ans=((ans%mod)*10)%mod;
        nnn--;
    }
    ans2*=2;
    ans=(ans+ans1-ans2+2*mod)%mod;
    
    cout<<ans;
}

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

    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    /***************-Code starts from here-***************/
    // int t;
    // cin>>t;
    // while(t--)
    solve();
    return 0; 
} 

Measured memory_bytes: 3624
#include<iostream>
#include<algorithm>
#include<math.h>
#include<vector>
#include<map>
#include<set>
#include<iomanip>

using namespace std;
using ll = long long;

const int MOD = 1e9 + 7;
const int MAX = 1e9;
const ll LLMAX = 1e18;
const int INF = numeric_limits<int>::max();
const ll LLINF = numeric_limits<ll>::max();
const double PI = acos(-1.0);

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

int main() {
    char c[3]; cin >> c;

    int ans = 0;
    if (c[0] == '1') ans++; 
    if (c[1] == '1') ans++;
    if (c[2] == '1') ans++;

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


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

public class Main {

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

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String input = br.readLine();

        char[] str = input.toCharArray();

        for(int i = 0; i < str.length; i++){
            if(Character.isUpperCase(str[i])){
                str[i] = Character.toLowerCase(str[i]);
            }else{
                str[i] = Character.toUpperCase(str[i]);
            }
        }
        System.out.println(str);
    }
}

Measured memory_bytes: 24296
import java.io._

object Main extends App {

  val out = new PrintWriter(System.out)
  val buf = StringBuilder.newBuilder
  var sb = StringBuilder.newBuilder
  var isContinue = true

  while(isContinue) {
    sb.append(io.StdIn.readLine)
    if(sb.toString != "-") {

      val cnt = io.StdIn.readInt
      for(_ <- 1 to cnt) {
        val h = io.StdIn.readInt
        buf.append(sb.substring(h)).append(sb.substring(0,h))
        sb.clear
        sb.append(buf)
        buf.clear
      }

      out.println(sb)
      sb.clear
    }
    else isContinue = false
  }
  out.flush
}



Measured memory_bytes: 43936
/*
	submission # - User: herp_sy
	https://atcoder.jp/contests/
*/

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <stdbool.h>

#define _CRT_SECURE_NO_WARNINGS
#define TLong long long
#define TBMod 1000000007

int main(int argc, char const *argv[])
{
	int n;
	int cnt[256] = { 0 };
	int vcnt = 0;
  	char s;
  	
	scanf("%d",&n);
	for (int i = 0; i < n; ++i)
	{
		scanf(" %c",&s);
		++cnt[(int)s];
	}
	for (int i = 0x30; i <= 0xFF; ++i)
	{
		if(cnt[i] > 0)	++vcnt;
	}
	switch(vcnt){
	  case 3:
	    puts("Three");
	    break;
	   case 4:
	    puts("Four");
	    break;
	}
	return 0;
}


Measured memory_bytes: 128
#include<stdio.h>

int main(){
    int N,K;
    scanf("%d%d", &N, &K);

    int i,j; 
    int ans=0,a,d;
    int A[100+1] = {0};
    for( i = 1; i <= K; i++ ){
        scanf("%d", &d);
        for( j = 1; j <= d; j++ ){
            scanf("%d", &a);
            A[a] += 1;
        }
    }

    for( i = 1; i <= N; i++ ){
        if( A[i] == 0 ) ans++;
    }

    printf("%d\n", ans);

    return 0;
}



Measured memory_bytes: 1736
#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>;

int main() {
    int X,Y;
    cin >> X >> Y;

    rep(i,X+1){
        if((i * 2 + (X-i) * 4) == Y){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}

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

using namespace std;

typedef long long ll;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;

#define INF 1000000000
#define F first
#define S second
#define forn(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)

using namespace std;

int deg[1234567];

int main(){
	int n,m;
	scanf("%d %d", &n, &m);
	rep(i,m){
		int a, b;
		scanf("%d %d", &a, &b);
		deg[a]++;
		deg[b]++;
	}
	rep(i,n){
		if(deg[i]%2==1){
			printf("NO\n");
			return 0;
		}
	}
	printf("YES\n");
	return 0;
}


Measured memory_bytes: 512
#include<stdio.h>

int main(void){

	int n,i,x;

	scanf("%d",&n);

	for(i=1;i<=n;i++){

		x = i;

		if(x%3 == 0){
			printf(" %d",i);
		}
		else{

			while(x){

				if(x%10 == 3){
					printf(" %d",i);
					break;
				}
				x/=10;
			}
		}

	}

	puts("");

	return 0;

}

Measured memory_bytes: 608
#include <bits/stdc++.h>
#define rep(i,n)    for(long long i = 0; i < (n) ; ++i)
#define orep(i,n)   for(long long i = 1; i <= (n); ++i)   // one rep
#define drep(i,n)   for(long long i = (n)-1; i >= 0; --i) // down rep
#define srep(i,s,t) for(long long i = (s); i < (t); ++i)  // set rep
#define rng(x)  (x).begin(),(x).end()

  // range
#define rrng(a) (a).rbegin(),(a).rend() // reverse range
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define ru(x,y) (((x)+(y)-1)/(y)) // round up
#define fi first
#define se second
#define eb emplace_back
#define fcout cout << fixed << setprecision(15)


using namespace std;
using ll  = long long;
using P   = pair<int,int>;
using vi  = vector<int>;
using vvi = vector<vi>;
using vp  = vector<P>;
using vl  = vector<ll>;

template<typename T> void Yes(T flag) {
  cout << (flag ? "Yes" : "No") << endl;
}

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

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

template<typename T> void pv2(vector<vector<T>> vec) {
  for(auto& v : vec) pv(v);
}

int main() {
  int n,k;
  cin >> n >> k;
  vi o(n,0);
  rep(i,k) {
    int d;
    cin >> d;
    rep(j,d) {

      int a;
      cin >> a;
      a--;
      o.at(a)++;
    }
  }
  int ans = 0;
  rep(i,n) {
    if(o.at(i)==0) ans++;
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3632
n,k = map(int, input().split())
x = list(map(int, input().split()))

s = 10**9
for i in range(n-k+1) :
  f1 = x[i]
  f2 = x[i+k-1]
  m = min(abs(f1) +abs(f2 - f1) , abs(f2) + abs(f2 - f1))
  if s >m :
    s = m
print(s)



Measured memory_bytes: 14224
def main():
    n = int(input())
    a, b = list(map(int, input().split()))
    P = list(map(int, input().split()))
    ans = [[] for _ in range(3)]
    for p in P:
        if p <= a:
            ans[0].append(p)
        elif a + 1 <= p <= b:
            ans[1].append(p)
        else:
            ans[2].append(p)
    print(min(list(map(len, ans))))

if __name__ == '__main__':
    main()


Measured memory_bytes: 8992
#include <stdio.h>

#define N 100000
#define Q 100000

int n, a[N], q, b[Q], c[Q];
int list_a[N+1]={0};

int main(){
    scanf("%d",&n);
    for (int i = 0; i < n; i++){
        scanf("%d",&a[i]);
        list_a[a[i]] = list_a[a[i]] + 1;
    }  
    scanf("%d",&q);
    for (int i = 0; i < q; i++){
        scanf("%d %d",&b[i], &c[i]);
    }

//    for (int i = 1; i <= n; i++){
//        printf("%d ",list_a[i]);
//    } printf("\n");

    long long sum=0;
    for (int i = 0; i < n; i++){
        sum += a[i];
    }

    for (int i = 0; i < q; i++){
        if (list_a[b[i]]==0){
//            printf("%d\n",i);
            printf("%lld\n", sum);
            continue;
        }
        sum += (c[i]-b[i])*list_a[b[i]];
        list_a[c[i]] = list_a[c[i]] + list_a[b[i]];
        list_a[b[i]] = 0; 
        printf("%lld\n", sum);
//        for (int i = 1; i <= n; i++){
//            printf("%d ",list_a[i]);
//        } printf("\n");
    }
    return 0;
}


Measured memory_bytes: 3280
import java.util.*;
public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String todayWeather = sc.next();
        if(todayWeather.equals("Sunny")){
            System.out.println("Cloudy");
        }else if(todayWeather.equals("Cloudy")){
            System.out.println("Rainy");
        } else{
            System.out.println("Sunny");
        }
    }
}

Measured memory_bytes: 19668
import itertools
n=int(input())
p=list(map(int,input().split()))
q=list(map(int,input().split()))
l=[]
for i in range(1,n+1):
    l.append(i)
n_lst=list(itertools.permutations(l,n))
a=n_lst.index(tuple(p))
b=n_lst.index(tuple(q))
print(abs(a-b))

Measured memory_bytes: 8052
fun main(args: Array<String>) {
    val (M, K) = readLine()!!.split(" ").map(String::toInt)
    var s = 0
    for (i in 0..Math.pow(2.0, M.toDouble()).toInt() - 1) {
        s = s.xor(i)
    }
    if (K == 0) {
        for (i in 1..Math.pow(2.0, M.toDouble()).toInt() - 1) {
            print("$i ")
        }
        print("$K $K ")
        for (i in (1..Math.pow(2.0, M.toDouble()).toInt() - 1).reversed()) {
            print("$i ")
        }
        println()
    } else if (K >= Math.pow(2.0, M.toDouble()) || s.xor(K) != K) {
        println(-1)
    } else {
        print("0 $K 0 ")
        for (i in 1..Math.pow(2.0, M.toDouble()).toInt() - 1) {
            if (i != K) {
                print("$i ")
            }
        }
        print("$K ")
        for (i in (1..Math.pow(2.0, M.toDouble()).toInt() - 1).reversed()) {
            if (i != K) {
                print("$i ")
            }
        }
        println()
    }
}

Measured memory_bytes: 47020
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        char[] S = sc.next().toCharArray();
        char[] T = sc.next().toCharArray();
        StringBuilder sb = new StringBuilder();
        for(int i = 0; i < n; i++) {
            sb.append(S[i]);
            sb.append(T[i]);
        }
        System.out.println(sb.toString());
    }
}


Measured memory_bytes: 23764
let ans, a_s = ref 0, Array.init (read_int ()) @@ fun _ -> Scanf.scanf " %d" (+) 0
let f (p, c) a = a, if a <> p then (ans := !ans + if p > c then c else min c @@ c - p; 1) else c + 1
let _ = Array.(sort (-) a_s; f (fold_left f (a_s.(0), 0) a_s) 0) |> ignore; Printf.printf "%d\n" !ans

Measured memory_bytes: 5504
#include<iostream>
#include<string>
using namespace std;
int main(void){
	string right="yuiophjklnm";
	string a;
	while(1){
		cin>>a;
		if(a=="#")break;
		int b=0,c=0,ans=0;
		for(int i=0;i<a.size();i++){
			for(int j=0;j<right.size();j++){
				if(a[i]==right[j]){
					b=1;
				}
			}
			if(b!=1)b=-1;
			if(b!=c)ans++;
			c=b;
			b=-1;
		}
		cout<<ans-1<<endl;
	}
	return 0;
}


Measured memory_bytes: 3160
import java.util.Scanner;

public class Main {
    long patty[] = new long[51];
    long size[] = new long[51];

    public void main(Scanner sc) {
        int n = sc.nextInt();
        long x = sc.nextLong();

        patty[0] = 1;
        size[0] = 1;
        for (int i = 1; i <= 50; i++) {
            patty[i] = patty[i - 1] * 2 + 1;
            size[i] = patty[i] * 2 - 1;
        }

        System.out.println(calc(n, x));
    }

    private long calc(int level, long x) {
        if (x == 0) {
            return 0;
        }
        if (x >= size[level]) {
            return patty[level];
        }

        if (x * 2 > size[level]) {
            // 中央のパティより右
            return patty[level - 1] + 1 + calc(level - 1, x - size[level - 1] - 2);
        } else {
            // 中央のパティより左
            return calc(level - 1, x - 1);
        }
    }

    public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in)) {
            new Main().main(sc);
        } catch (Exception e) {
            throw e;
        }
    }
}


Measured memory_bytes: 22608
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
template <typename X> ostream& operator << (ostream& x,const vector<X>& v){for(ll i=0;i<v.size();++i) x<<v[i]<<" ";return x;}
template <typename X> ostream& operator << (ostream& x,const set<X>& v){for(auto it:v) x<<it<<" ";return x;}
template <typename X, typename Y> ostream& operator << (ostream& x, const pair<X,Y>& v) {x<<v.ff<<" "<<v.ss;return x;}
template <typename T, typename S> ostream& operator << (ostream& os, const map<T, S>& v) { for (auto it : v) os << it.first << "=>" << it.second << endl; return os; }
struct pair_hash {inline std::size_t operator()(const std::pair<ll, ll> & v) const {return v.first*31+v.second;}};
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC targett("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define speed ios_base::sync_with_stdio(false);cin.tie(NULL)
#define pb push_back
#define fr first
#define sc second
#define prnt(m) for(auto it = m.begin() ; it != m.end() ; ++it){cout<<*it<<endl;}
#define tra(it,m) for(auto it=m.begin();it!=m.end();++it)
#define DBG(x) cout<<"# # #     "<<x<<'\n';
#define fri(i,s,n) for(ll i=s;i<n;i++)
#define mod 1000000007LL
#define mod2 998244353
#define vct2 vector<vector<ll>>
#define vct vector<ll>
#define pll pair<ll,ll>
#define rz(n) resize(n)
#define all(v) v.begin(),v.end()
#define mkp make_pair
#define arrin(a,n) for(ll i = 0; i < n ; i++){cin>>a[i];}
#define arrout(a,n) for(ll i = 0;i < n; i++){cout<<a[i]<<" ";}
#define ex(s) cout<<s<<endl,exit(0);
#define inf 4e18
#define five 100005;
#define six 1000005;
#define printclock cerr<<"Time"<<1000*(ld)clock()/(ld)CLOCKS_PER_SEC<<"ms\n";
//___________________________________________________________________________________________

int main()
{
       string s;
       cin>>s;
       ll sum = 0;
       fri(i,0,s.size())
       {
              sum += (s[i]-'0');
       }
       if(sum % 9)
       {
              cout<<"No";
       }
       else
       {
              cout<<"Yes";
       }
}


Measured memory_bytes: 3724
package main

import (
	"fmt"
)

func main() {
	var n int

	fmt.Scan(&n)
	cnt := make([][]int, n)
	for i := 0; i < n; i++ {
		cnt[i] = make([]int, 26)
		var s string
		fmt.Scanln(&s)
		for j := 0; j < len(s); j++ {
			cnt[i][s[j]-'a']++
		}
	}

	dd := make([]rune, 0)
	for j := 0; j < 26; j++ {
		mini := cnt[0][j]
		for i := 1; i < n; i++ {
			if mini > cnt[i][j] {
				mini = cnt[i][j]
			}
		}
		for mini > 0 {
			dd = append(dd, rune('a'+j))
			mini--
		}
	}

	fmt.Println(string(dd))
}


Measured memory_bytes: 512
#include<cmath>
#include<algorithm>
#include<iostream>
#include<vector>
#include<cstdio>
 
using namespace std;
 
double EPS = 1e-10;
const double PI = acos(-1);
 
double add(double a, double b){
  if(abs(a+b) < EPS * (abs(a)+abs(b)))return 0;
  return a+b;
}
 
struct point{
  double x, y;
  point(){}
  point(double x,double y) : x(x) , y(y){}
 
  point operator + (point p){
    return point(add(x,p.x), add(y,p.y));
  }
 
  point operator - (point p){
    return point(add(x,-p.x), add(y,-p.y));
  }
 
  point operator * (double d){
    return point(x*d,y*d);
  }
 
  point operator / (double d){
    return point(x/d,y/d);
  }
   
  bool operator == ( const point &p ) const {
    return fabs(x-p.x) < EPS && fabs(y-p.y) < EPS;
  }
};
 
struct segment{
  point a,b;
};
 
double dot(point a, point b) {
  return (a.x * b.x + a.y * b.y);
}
 
double cross(point a, point b) {
  return (a.x * b.y - a.y * b.x);
}
 
double vec_abs(point a){
  return sqrt(a.x*a.x+a.y*a.y);
}
 
double dist(point a,point b){
  return sqrt(pow(a.x-b.x,2)+pow(a.y-b.y,2));
}
 
int ccw(point p0, point p1, point p2){
  point a = p1 - p0;
  point b = p2 - p0;
  if(cross(a,b)>0)return +1;
  if(cross(a,b)<0)return -1;
  if(dot(a,b)<0)return +2;
  if(a.x*a.x+a.y*a.y<b.x*b.x+b.y*b.y)return -2;
  return 0;
}

bool cmp_x(const point& p, const point& q){
  if(p.x != q.x)return p.x<q.x;
  return p.y < q.y;
}

vector<point>convex_hull(point* ps, int n){
  sort(ps,ps+n,cmp_x);
  int k=0;
  vector<point>qs(n*2);
 
  for(int i=0;i<n;i++){
    while(k>1&&cross(qs[k-1]-qs[k-2],ps[i]-qs[k-1])<0)k--;
    qs[k++]=ps[i];
  }
 
  for(int i=n-2,t=k;i>=0;i--){
    while(k>t&&cross(qs[k-1]-qs[k-2],ps[i]-qs[k-1])<0)k--;
    qs[k++]=ps[i];
  }
  qs.resize(k-1);
  return qs;
}

double areaPol(point* ps, int n){
  vector<point>t=convex_hull(ps,n);
  t.push_back(t[0]);
  int tsz=t.size();
  double area=0;
  for(int i=0;i<tsz-1;i++){
    area+=(t[i].x-t[i+1].x)*(t[i].y+t[i+1].y);
  }
  return abs(area)/2.0;
}
 
int main(void){
  point p[21];
  int n=0;
  double x,y;
  char k;
 
  while(cin>>x>>k>>y){
    if(cin.eof())break;
    p[n].x = x;
    p[n].y = y;
    n++;
 }
 
  printf("%.6f\n",areaPol(p,n));
 
  return 0;
}

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

int main(){
    
    // 1. 入力情報.
    int X, Y;
    scanf("%d %d", &X, &Y);
    
    // 2. 賞金の合計額.
    int ans = 0;
    if(X <= 3) ans += 100000;
    if(Y <= 3) ans += 100000;
    if(X <= 2) ans += 100000;
    if(Y <= 2) ans += 100000;
    if(X == 1) ans += 100000;
    if(Y == 1) ans += 100000;
    if(X == 1 && Y == 1) ans += 400000;
    
    // 3. 出力.
    printf("%d\n", ans);
    return 0;
    
}

Measured memory_bytes: 256
#include <bits/stdc++.h> //C++の標準ライブラリを一行で一括でインクルードする
#include <math.h> //数学関数と数学定数を利用する
#define rep(i,n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
template<class T> void chmax(T &a,T b) { if (a<b) a=b;}
template<class T> void chmin(T &a,T b) { if (a>b) a=b;}
int gcd(int a, int b){//ユークリッドの互除法
  if (a < b) gcd(b,a); //aの方がbよりでかいのが前提
  if (b == 0) return a; //aをbで割り切れたらreturn
  else gcd(b, a % b);
}

int main(){
  int n,k; cin >> n >> k;
  
  priority_queue<int> kind[n];
  rep(i,n){
    int t,d; cin >> t >> d;
    kind[t-1].push(d);
  }
  
  priority_queue<int> best,remain;
  
  rep(i,n){
    if(!kind[i].empty()){
      best.push(kind[i].top());
      kind[i].pop();
      while(!kind[i].empty()){
        remain.push(kind[i].top());
        kind[i].pop();
      }
    }
  }
  
  vector<ll> bsum = {0};
  vector<ll> rsum = {0};
  
  while(!best.empty()){
    bsum.push_back(bsum.back()+best.top());
    best.pop();
  }
  while(!remain.empty()){
    rsum.push_back(rsum.back()+remain.top());
    remain.pop();
  }
  
  ll ans = 0;
  for(ll x = 1; x <= k;x++){
    if(x >= bsum.size()) break;
    if(k-x >= rsum.size()) continue;
    ans = max(ans,bsum[x]+rsum[k-x]+x*x);
  }
  
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 8056
N=int(input())
A=list(map(int,input().split()))
C=[]
r=0
cnt=0
for a in A:
    aa=min(a//400,8)
    if aa in C:pass
    else:
        C.append(aa)
        cnt+=1
    if aa==8:r+=1
if r==0:print(cnt,cnt)
else:print(max(1,cnt-1),cnt+r-1)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
double kin[50],r[50],mx;
int main(void)
{
	int i,j,k,n,y,b[50],t[50],num;
	while(cin>>n&&n) {
		cin>>y;
		for(i=0;i<n;i++) {
			cin>>b[i]>>r[i]>>t[i];
		}
		for(i=0;i<n;i++) kin[i]=1;
		for(i=0;i<n;i++) {
			if(t[i]==1) {
				kin[i]=100*(1+y*r[i]/100);
			}
			else if(t[i]==2){
				for(j=0;j<y;j++) {
					kin[i]*=(1+r[i]/100);
				}
				kin[i]*=100;
			}	
		}
		mx=-1;
		for(i=0;i<n;i++) {
			if(mx<kin[i]) {
				mx=kin[i];
				num=b[i];
			}
		}
		cout<<num<<endl;
	}
}
	

Measured memory_bytes: 3128
N = int(input())
A = list(map(int, input().split()))

flag = 1

for a in A:
    if a % 2 == 1:
        continue
    
    if a % 3 == 0 or a % 5 == 0:
        flag *= 1
    else:
        flag *= 0

print('APPROVED' if flag==1 else 'DENIED')

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n,s[11];
	while(cin>>n,n){
		fill(s,s+10,0);int l=0;
		for(int i=0;i<n;i++){
			int y=0,t;
			for(int j=0;j<n;j++)cin>>t,y+=t,s[j]+=t,printf("%5d",t);
			printf("%5d\n",y);
		}
		for(int i=0;i<n;i++)printf("%5d",s[i]),l+=s[i];
		printf("%5d\n",l);
	}
}

Measured memory_bytes: 1160
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ld long double
#define al(a) (a).begin(),(a).end()
#define mk make_pair
#define check cout<<"?"<<endl;

ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;

int main(){
    string s; cin>>s;
    int ans=0;
    rep(i,s.size()-1)if(s[i]!=s[i+1]) ans++;
    cout<<ans<<endl;
}

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

/*  using namespace  */
using namespace std;

/*  local var  */
int a,b,n;		//input
int ans = 0;		//output
vector<int> g[100005];  //graph
int distance_Fennec[100005]; //Distance from ふぇねええええええええええええええええええええええええっく
int distance_Sunuke[100005]; //Distance from Snuke

/*  define  */
#define loop(i,j) for(int i = 0; i < j; i++)

/*  typedef  */
//None

/*  distance checker  */
void calc_distance(int r, int f, int d, int dist[]) {
	dist[r] = d;
	for(int x = 0; x < g[r].size(); x++)
		if (g[r][x] != f) calc_distance(g[r][x], r, d + 1, dist);
			
}

/*  main program  */
int main()
{
	cin>>n;

	for(int i = 0; i < n - 1; i++) {
		cin>>a>>b;
		a--,b--;
		g[a].push_back(b);
		g[b].push_back(a);
	}

	calc_distance(0  ,-1,0,distance_Fennec);
	calc_distance(n-1,-1,0,distance_Sunuke);

	for(int i = 0;i < n; i++){
		if(distance_Fennec[i] <= distance_Sunuke[i]) ans++;
		else ans--;
	}

	printf("%s\n",(ans > 0) ? "Fennec" : "Snuke");
}


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

using namespace std;
typedef long long LL;
template <typename F, typename S> std::ostream& operator<<(ostream& os, const pair<F,S>& p) {
    os << "(" << p.first << "," << p.second << ")"; return os; }
template <typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
    os << "["; for(const T& a: v){ os << a << ", "; } os << "]"; return os; }
template <typename K, typename V> ostream& operator<<(ostream& os, const map<K,V>& m) {
    os << "{"; for(const auto& p: m){ os << p.first <<":"<< p.second << ", "; } os << "}"; return os; }

void build(vector<LL>& cand){
    //cerr << "buld.." << endl;
    //cerr << cand << endl;
    for(LL i = 0; i < cand.size(); ++i){
        sort(cand.begin(), cand.end(), greater<LL>());
        for(LL j = 0; j < cand.size(); ++j){
            if(i == j) continue;
            if((cand[i] ^ cand[j]) < cand[j]) cand[j] ^= cand[i];
        }
        //cerr << cand << endl;
    }
}

LL sweepable(LL v, vector<LL>& cand){
    build(cand);
    for(LL v2: cand){
        if((v ^ v2) < v) v ^= v2;
    }
    return v == 0;
}


void solve(){
    LL n;
    cin >> n;
    vector<LL> a(n);
    for(LL i = 0; i < n; ++i){
        cin >> a[i];
    }
    string s;
    cin >> s;
    vector<LL> rest;
    for(LL i = 0; i < n; ++i){
        if(s[i] == '0') continue;
        vector<LL> cand;
        for(LL j = i+1; j < n; ++j){
            if(s[j] == '0') cand.push_back(a[j]);
        }
        if(!sweepable(a[i], cand)){
            cout << 1 << endl;
            return;
        }
    }
    cout << 0 << endl;
}

int main(){
    LL T;
    cin >> T;
    for(LL t = 0; t < T; ++t){
        solve();
    }
    return 0;
}



Measured memory_bytes: 3168
#include <stdio.h>

int main()
{
	int i, j, temp;
	int a[2];

	for (i = 0; i < 3000; i++)
	{
		for (j = 0; j < 2; j++)
			scanf("%d", &a[j]);
		if (a[0] == 0 && a[1] == 0)
			break;
		if (a[0] > a[1])
		{
			temp = a[1];
			a[1] = a[0];
			a[0] = temp;
		}
		printf("%d %d\n", a[0], a[1]);
	}

	return 0;
}


Measured memory_bytes: 2036
#include <cstdio>
#include <string>
#include <string.h>

using namespace std;

int main() {

  char s1[50], s2[50];

  scanf("%s", s1);
  scanf("%s", s2);


  for (int i=1; i<=strlen(s1)+strlen(s2); i++) {
    if (i % 2 == 1) {
      printf("%c", s1[i/2]);
    } else {
      printf("%c", s2[i/2-1]);
    }
  }
}

Measured memory_bytes: 128
S = input()
S = S[::-1]
a1= 'eraser'
a2= 'erase'
a3= 'dreamer'
a4= 'dream'
a1= a1[::-1]
a2= a2[::-1]
a3= a3[::-1]
a4= a4[::-1]

a = S.replace(a1, '').replace(a2, '').replace(a3, '').replace(a4, '')

if len(a) == 0:
  print("YES")
else:
  print("NO")

Measured memory_bytes: 3188
N,K = (int(i) for i in input().split())
P = [int(i) for i in input().split()]
P_expect_sum = [0 for i in range(N)]

P_pred = 0
for i in range(N):
  P_expect = (1+P[i])/2
  P_expect_sum[i] = P_pred + P_expect
  P_pred = P_expect_sum[i]

ans = P_expect_sum[K-1]
for i in range(K-1,N):
  ans = max(ans, P_expect_sum[i] - P_expect_sum[i-K])
print(ans)



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

using namespace std;

int gcd(int x, int y) {
    if(y == 0) return x;
    return gcd(y, x%y);
}

int main(){
    long long a, b;
    long long c, d;
    cin >> a >> b >> c >> d;
    long long ans = 0;

    long long lcm;
    lcm = c * d / gcd(c, d);

    ans = b - a + 1;
    ans -= b / c;
    ans += (a - 1) / c;
    ans -= b / d;
    ans += (a - 1) / d;
    ans += b / lcm;
    ans -= (a - 1) / lcm; 
    
    cout << ans << endl;
}

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

int main() {
  string S, T;
  int f=0;

  cin >> S >> T;

  for(int i=0; i<(int)S.length(); i++) 
    if(S[i] != T[i]) 
      f++;
  
  cout << f << endl;
  
  return 0;
}

Measured memory_bytes: 3920
n, k = map(int, input().split())
a = list(map(int, input().split()))

t = [1]
for i in range(n):
    t.append(a[t[-1] -  1])

t_sort = sorted(t)
for i in range(n):
    if t_sort[i] == t_sort[i + 1]:
        b = t_sort[i]
        break

count = 0
for i in range(n):
    if t[i] == b:
        if count == 0:
            count += 1
            s_first = i
        else:
            s_second = i
            break
s = s_second - s_first

for i in range(n - s + 1):
    if t[i] == t[i + s]:
        break

if k < i:
    print(t[k])
else:
    print(t[(k - i) % s + i])

Measured memory_bytes: 32384
#include <algorithm>
#include <iostream>
#include <climits>
#include <string>

using namespace std;
int main(void)
{
    int h, w;
    cin >> h >> w;
    int s[52][52] = { };
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            char c;
            cin >> c;
            s[i + 1][j + 1] = c;
        }
    }

    for (int i = 1; i < h + 1; i++) {
        for (int j = 1; j < w + 1; j++) {
            if (s[i][j] == '.') {
                int mines = 0;
                if (s[i - 1][j - 1] == '#') {
                    mines++;
                }
                if (s[i - 1][j] == '#') {
                    mines++;
                }
                if (s[i - 1][j + 1] == '#') {
                    mines++;
                }
                if (s[i][j - 1] == '#') {
                    mines++;
                }
                if (s[i][j + 1] == '#') {
                    mines++;
                }
                if (s[i + 1][j - 1] == '#') {
                    mines++;
                }
                if (s[i + 1][j] == '#') {
                    mines++;
                }
                if (s[i + 1][j + 1] == '#') {
                    mines++;
                }
                s[i][j] = '0' + mines;
            }
            cout << (char)s[i][j];
        }
        cout << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
using namespace std;
const long long Maxn=4000000+10;
long long n,k;
long long a[Maxn];
int main()
{
//	freopen("in.txt","r",stdin);
	cin>>n>>k;
	for(long long i=1;i<=n;++i)
	cin>>a[i];
	for(long long i=k+1;i<=n;++i)
	{
		if(a[i-k]<a[i])
		puts("Yes");
		else puts("No");
	}
	return 0;
}

Measured memory_bytes: 5196
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#define int long long
using namespace std;
signed main() {
	int n, k; cin >> n >> k;
	n -= 2;
	int ans = n / 11; n %= 11;
	ans *= 5;
	for (int i = 0; i < n; i++) {
		for (int j = i * 7 + 1; j < i * 7 + 6; j++) {
			if ((j * 9 + 6) % 11 == k)ans++;
		}
	}
	cout << ans << endl;
}

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

int main() {
    long long X;
    int ans;
    cin >> X;
    vector<long long> x(4001);
    x.at(0) = 100;
    ans = 0;
    rep(i, 4000){
        x.at(i+1) = x.at(i) + x.at(i) / 100;
        ans++;
        if(x.at(i+1) >= X){
            cout << ans << endl;
            return 0;
        }
    }
}


Measured memory_bytes: 3588
#include<iostream>
#include<math.h>
#include<vector>
#include<array>
#include<algorithm>
#include<numeric>
#include<map>
#include<queue>
#include<deque>
#include<set>
#include<cstdio>
#include<cstring>
#include<string>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vector<ll>> mat;

int main(){
    int N,M;cin>>N>>M;
    vec v(5,-1);
    for(int i=0;i<M;i++){
        int s,c;cin>>s>>c;
        if(v[s]==-1) v[s]=c;
        else{
            if(v[s]!=c){
                cout<<-1<<endl;
                return 0;
            }
        }
    }
    if(N==1 && (v[1]==0 || v[1]==-1)){
        cout<<0<<endl;
        return 0;
    }
    int ans;
    if(v[1]==-1) ans=1;
    else if(v[1]==0){
        cout<<-1<<endl;
        return 0;
    }
    else ans=v[1];
    for(int i=2;i<=N;i++){
        ans*=10;
        if(v[i]!=-1) ans+=v[i];
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <bitset>
#include <utility>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <stdio.h>

using namespace std;
typedef long long ll;

int main(){
  int n,p;
  cin >> n >> p;
  string s;
  cin >> s;

  ll ans=0;
  if(p==2 || p==5){
    for(int i=0;i<n;i++){
      if(((int)(s[i]-'0'))%p==0) ans+=i+1;
    }
  }else{
    vector<int> v(p,0);
    v[0]=1;
    int vi=1,si=0;
    for(int i=n-1;0<=i;i--){
      si+=vi*(s[i]-'0'); si%=p;
      v[si]++;
      vi*=10; vi%=p;
    }

    for(auto vv:v){
      ans+=(ll)vv*(vv-1)/2;
    }
  }

  cout << ans << endl;

  return 0;
}

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

#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a, 0, sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define SIZE(array) (sizeof(array) / sizeof(array[0]))

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

#define MAX_V 100000

#define MOD 1000000007L
#define INF 2147483647

signed main() {
	string s;
	cin >> s;
	int c = 0;
	for (size_t i = 1; i < s.size(); i++) {
		c += (s[i] != s[i - 1]);
	}
	cout << c << endl;
}


Measured memory_bytes: 512
use std::io;


fn main() {
    let (n, h, w) = {
        let i = read::<usize>();
        (i[0], i[1], i[2])
    };
    let mut ans = 0;
    for _ in 0..n {
        let (h_i, w_i) = {
            let i = read::<usize>();
            (i[0], i[1])
        };

        if h_i >= h && w_i >= w { ans += 1; }
    }

    println!("{}", ans);
}


#[allow(dead_code)]
fn read<T>() -> Vec<T>
where T:
    std::str::FromStr,
    T::Err: std::fmt::Debug {

    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.split_whitespace()
        .map(|s| s.trim().parse().unwrap())
        .collect()
}

#[allow(dead_code)]
fn read_one<T>() -> T
where T:
    std::str::FromStr,
    T::Err: std::fmt::Debug {

    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.trim().parse().unwrap()
}

Measured memory_bytes: 4352