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

int main() {
  int N, A, B;
  cin >> N >> A;
  B = N % 500;
  //cout << B << endl << A << endl;

  if ( A >= B) {
    cout << "Yes" << endl;
  }

  else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 3628
//Dragon_warrior7(IITK)
#pragma GCC optimize ("Ofast")
#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize ("-ffloat-store")
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
using namespace std;
//using namespace __gnu_pbds;
#define ll long long
#define pb push_back
#define nl cout << '\n'
#define sor(x) sort(x.begin(), x.end())
#define rev(v) reverse(v.begin(), v.end())
#define lb(v, temp) lower_bound(v.begin(), v.end(), temp)
#define ub(v, temp) upper_bound(v.begin(), v.end(), temp)
#define fi first
#define se second
#define llmax 1000000000000000000
#define pll pair<ll, ll> 
#define ull unsigned ll
#define vll vector<ll> 
#define rub cout << "\n------------------------------------\n"
#define deb(x) cout<<#x<<' '<<'='<<' '<<x<<'\n'
//typedef  tree < int ,  null_type ,  greater<int> ,  rb_tree_tag ,  tree_order_statistics_node_update > oset;
void read(vector<ll> &v)
{
	for (int i = 0; i < v.size(); i++)
		cin >> v[i];
}
// const int mod=1e9+7;
// ll power(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
// ll modInverse(ll a){return power(a,mod-2);}
ll n,m,a,b,c,k,temp,x,y;
void solveforthiscase(const int & test)
{//deb(test);
string s;
cin>>s;
deque<char> dq;
for(int i=0;i<s.size();i++)
{
    dq.pb(s[i]);
}
int q;
cin>>q;
int rev=0;
while(q--)
{
    cin>>temp;
    if(temp==1)
    rev=!rev;
    else
    {
        int f;
        cin>>f;
        char c;
        cin>>c;
        if(f==1)
        {
            if(!rev)
            dq.push_front(c);
            else
            dq.push_back(c);
            
            
            
        }
        else
        {
           if(!rev)
            dq.push_back(c);
            else
            dq.push_front(c); 
        }
    }
    
}
if(rev)
{
    while(!dq.empty())
    {
        cout<<dq.back();
        dq.pop_back();
    }
}
else
{
    while(!dq.empty())
    {
        cout<<dq.front();
        dq.pop_front();
    }
}







return ;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int test=1;
// 	cin>>test;
    for(int i=1;i<=test;i++)
    {
        solveforthiscase(i);
    }
}

Measured memory_bytes: 976
#pragma warning(disable: 4996)
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <random>
#include <unordered_map>
#include <functional>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <algorithm>
#include <vector>
#include <bitset>
#include <numeric>
#include <string>
#include <set>
#include <tuple>
#include <utility>
#include <regex>
using namespace std;

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

	int a, b;
	cin >> a >> b;
	int res = 1101;
	int ans = 1101;
	while (res > 0) {
		int c = res * 0.08,
			d = res * 0.1;
		if (c == a && d == b) ans = res;
		--res;
	}
	if (ans == 1101) cout << -1 << endl;
	else cout << ans << endl;
	return 0;
}

Measured memory_bytes: 384
// author-Shivam gupta

#include <bits/stdc++.h>


using namespace std;

#define MEM(a, b) memset(a, (b), sizeof(a))

#define FOREACH(it, l) for (auto it = l.begin(); it != l.end(); it++)

#define IN(A, B, C) assert( B <= A && A <= C)

#define MP make_pair
#define FOR(i,a) for(int i=0;i<a;i++)

#define FOR1(i,j,a) for(int i=j;i<a;i++)

#define EB emplace_back

#define INF (int)1e9

#define EPS 1e-9

#define PI 3.1415926535897932384626433832795

#define MOD 1000000007

#define read(type) readInt<type>()
#define max1 1000008
#define out(x) cout<<x<<'\n'
#define out1(x) cout<<x<<" "
#define END cout<<'\n'
typedef long int li;

typedef unsigned long int uli;

typedef long long int ll;

typedef unsigned long long int  ull;


void fast(){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
}
ll check(ll n,ll b){
  ll ans=0;
  while (n>0){
    ans+=n%b;
    n/=b;
  }
  return ans;
}
ull na(ull m, ull n)
{
    // We have to calculate m+n-2 C n-1 here
    // which will be (m+n-2)! / (n-1)! (m-1)!
    ull path = 1;
    for (ull i = n; i < (m + n - 1); i++) {
        path *= i;
        path /= (i - n + 1);
    }
    return path;
}

int main() {
string a,b,c;
cin>>a>>b>>c;
int i=0,j=0,k=0;
char curr='a';
while(1){
        if(curr=='a'){
            if(i==a.length()){cout<<'A';return 0;}
            else{

                curr=a[i];
                i++;
            }
        }
        else if(curr=='b'){
            if(j==b.length()){cout<<'B';return 0;}
            else{

                curr=b[j];
                j++;
            }}
            else{


            if(k==c.length()){cout<<'C';return 0;}
            else{

                curr=c[k];
                k++;
            }
            }

}}







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

using namespace std;

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}

#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

#define forn(i, n) for(int i = 0; i < n; i++)
#define forw(i, w) for(int i = n; i >= 0; i--)
#define dforn(i, a, b) for(int i = a; i < b; i++)
#define dforw(i, b, a) for(int i = b; i >= a; i--)
#define read(v) for(auto &i:v) cin >> i;
#define all(v) v.begin(), v.end()

typedef long long ll;
typedef vector<int> vi;
typedef vector<double> vd;
typedef pair<int, int> pii;

int n, k;
vi arr, dp;

int main(){
	ios_base::sync_with_stdio(0);
	cout.tie(0);cin.tie(0);
	
	cin >> n >> k;

	arr.assign(n, 0);
	dp.assign(n, 999999999);
	dp[0] = 0;
	read(arr);

	forn(i, n)
		for(int j = i+1; j < n && j < i+k+1; j++)
			dp[j] = min(dp[j], dp[i]+abs(arr[j]-arr[i]));

	cout << dp[n-1] << endl;	
	return 0;
}

Measured memory_bytes: 1024
//auto 関数名 = [(&:ラムダ外の引数をとる時))](引数の型1 引数名1, 引数の型2, 引数名2, ...) { 関数の処理 }; //inside main() define function. take care of };
// for (int tmp = 0; tmp < (1 << ビット数); tmp++) {
//   bitset<ビット数> s(tmp);
//   // (ビット列sに対する処理)
// }
// sort(配列変数.begin(), 配列変数.end());
// do {
//   // 順列に対する処理
// } while (next_permutation(配列変数.begin(), 配列変数.end()));
//const double PI = acos(-1); M_PI
// cout << fixed << setprecision(10);
#include <bits/stdc++.h>
#include <regex> //正規表現
using namespace std;
#define _GLIBCXX_DEBUG /GCC環境下で[]による配列要素参照のエラーを出す
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end() //sort(all(vec)); ,reverse(all(vec));etc
int main(){
  int n;
  cin>>n;
  vector<bitset<15>>n1(n);
  vector<bitset<15>>n2(n);
  rep(i,n){
    bitset<15>t((1<<n)-1);
    n2.at(i)=t;
  }
  rep(i,n){
    int a;
    cin>>a;
    rep(j,a){
      int x,y;
      cin>>x>>y;
      n1.at(i).set(x-1,y);
      n2.at(i).set(x-1,y);
    }
  }
int ans=0;
int k;
  for(int tmp=0;tmp<(1<<n);tmp++){
    k=0;
    bitset<15>cnt(tmp);
    rep(i,n){
      //cout<<cnt<<endl;
      if(cnt.test(i)){
        //cout<<i<<" "<<cnt|n1.at(i)<<" "<<cnt&n2.at(i)<<endl;
        if((cnt|n1.at(i)).count()!=((cnt&n2.at(i)).count())){
          goto SKIP;
        }
      }
    }
    k=cnt.count();
    if(k>ans){
      ans=k;
    }
    SKIP:
    continue;
  }
cout<<ans<<endl;
}

  

Measured memory_bytes: 3636
#include<cstdio>
#include<iostream>
#include<cmath>
#include<cstdlib>
#include<algorithm>
#include<vector>
using namespace std;
#define rep2(x,from,to) for(int x=from;x<to;x++)
#define rep(x,to) rep2(x,0,to)
typedef long long ll;

ll a,b,c;
ll k;
int main()
{
    cin>>a>>b>>c>>k;
    if(a-b>1000000000000000000||b-a>1000000000000000000)
    {
        cout<<"Unfair"<<endl;
    }
    else
    {
        if(k%2==0)cout<<a-b<<endl;
        else cout<<b-a<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
function count(y,x){
   var dy=[0,1,1,1];
   var dx=[1,-1,0,1];
   var max=1;
   for(var i=0;i<4;i++){
      var cnt=1;
      for(var j=1;j<=n;j++){
         var yy=y+(dy[i]*j);
         var xx=x+(dx[i]*j);
         if(yy<0 || xx<0 || yy>=n || xx>=n)break;
         if(yx[yy][xx]!=1)break;
         cnt++;
      }
      max=Math.max(max,cnt);
      cnt=1;
   }
   return max;
}
  
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var Arr=(input.trim()).split("\n");
while(true){
   var n=Arr.shift()-0;
   if(n==0)break;
   var yx=[];
   for(var i=0;i<n;i++){
      yx[i]=(Arr.shift()).split("").map(Number);
   }
   var max=0;
   for(var i=0;i<n;i++){
      for(var j=0;j<n;j++){
         if(yx[i][j]==1)max=Math.max(max,count(i,j));
      }
   }
   console.log(max);
}

Measured memory_bytes: 18424
#[allow(unused_imports)]
use std::cmp::{Ordering};

#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};

#[allow(unused_imports)]
use std::io::{stdin, stdout, BufWriter, Write};

#[allow(unused_imports)]
use std::iter::FromIterator;

#[allow(unused_macros)]
macro_rules! min {
    ($x: expr) => ($x);
    ($x: expr, $($z: expr),+) => {{
        std::cmp::min($x, min!($($z),*))
    }}
}

#[allow(unused_macros)]
macro_rules! max {
    ($x: expr) => ($x);
    ($x: expr, $($z: expr),+) => {{
        std::cmp::max($x, max!($($z),*))
    }}
}

#[allow(unused_macros)]
macro_rules! get { 
    ([$t: ty]) => { 
        { 
            let mut line = String::new(); 
            stdin().read_line(&mut line).unwrap(); 
            line.split_whitespace().map(|t|t.parse::<$t>().unwrap()).collect::<Vec<_>>()
        }
    };
    ([$t: ty];$n: expr) => {
        (0..$n).map(|_|get!([$t])).collect::<Vec<_>>()
    };
    ($t: ty) => {
        {
            let mut line = String::new();
            stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t: ty),*) => {
        { 
            let mut line = String::new();
            stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            ($(iter.next().unwrap().parse::<$t>().unwrap(),)*)
        }
    };
    ($t: ty; $n: expr) => {
        (0..$n).map(|_|get!($t)).collect::<Vec<_>>()
    };
    ($($t: ty),*; $n: expr) => {
        (0..$n).map(|_|get!($($t),*)).collect::<Vec<_>>()
    };
}

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

const BIG_STACK_SIZE: bool = true;

#[allow(dead_code)]
fn main() {
    use std::thread;
    if BIG_STACK_SIZE {
        thread::Builder::new()
            .stack_size(32 * 1024 * 1024)
            .name("solve".into())
            .spawn(solve)
            .unwrap()
            .join()
            .unwrap();
    } else {
        solve();
    }
}

fn solve() {
    let s = get!(String).chars().collect::<Vec<_>>();
    if s[2]==s[3] && s[4]==s[5] {
        println!("Yes");
    } else {
        println!("No");
    }
}


Measured memory_bytes: 8572
import std.algorithm, std.conv, std.range, std.stdio, std.string;
import std.math;

void readV(T...)(ref T t){auto r=readln.splitter;foreach(ref v;t){v=r.front.to!(typeof(v));r.popFront;}}
void readA(T)(size_t n,ref T t){t=new T(n);auto r=readln.splitter;foreach(ref v;t){v=r.front.to!(ElementType!T);r.popFront;}}
void readM(T...)(size_t n,ref T t){foreach(ref v;t)v=new typeof(v)(n);foreach(i;0..n){auto r=readln.splitter;foreach(ref v;t){v[i]=r.front.to!(ElementType!(typeof(v)));r.popFront;}}}
void readS(T)(size_t n,ref T t){t=new T(n);foreach(ref v;t){auto r=readln.splitter;foreach(ref j;v.tupleof){j=r.front.to!(typeof(j));r.popFront;}}}

void main()
{
  int h, w, d; readV(h, w, d);
  auto a = new int[][](h, w); foreach (i; 0..h) readA(w, a[i]);

  auto hw = h*w, x = new int[](hw), y = new int[](hw);
  foreach (i; 0..h)
    foreach (j; 0..w) {
      x[a[i][j]] = i;
      y[a[i][j]] = j;
    }

  auto m = new int[](h*w+1);
  foreach (i; d+1..hw+1)
      m[i] = m[i-d] + (x[i]-x[i-d]).abs + (y[i]-y[i-d]).abs;

  int q; readV(q);
  foreach (_; 0..q) {
    int l, r; readV(l, r);
    writeln(m[r]-m[l]);
  }
}


Measured memory_bytes: 8316
def main():
    N = int(input())
    dp = [N] * (N+1)
    dp[0] = 0

    for i in range(1, N+1):
        j = 1
        while j <= N:
            dp[i] = min(dp[i], dp[i-j]+1)
            j *= 6
        j = 1
        while j <= N:
            dp[i] = min(dp[i], dp[i-j]+1)
            j *= 9
    
    res = dp[N]
    print(res)



if __name__ == "__main__":
    main()

Measured memory_bytes: 74312
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.io.Reader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.Collections;
import java.util.ArrayDeque;
import java.util.List;
import java.util.Queue;
import java.util.StringTokenizer;

/**
 * The Java template file for AtCoder online judge.
 */
public class Main {

  private static FastScanner scanner;
  private static PrintWriter printer;

  public static void solve() {
    int n = scanner.nextInt();
    int[] values = new int[n];
    for (int i = 0; i < n; i++) {
      values[i] = scanner.nextInt();
    }
    Long[][] cache = new Long[n][n];
    long result = recur(values, 0, n - 1, cache);
    printer.println(result);
  }

  private static long recur(int[] values, int low, int high, Long[][] cache) {
    if (low > high) {
      return 0;
    }
    if (low == high) {
      return values[low];
    }
    if (cache[low][high] != null) {
      return cache[low][high];
    }
    cache[low][high] = Math.max(
        values[low] - recur(values, low + 1, high, cache),
        values[high] - recur(values, low, high - 1, cache)
    );
    return cache[low][high];
  }

  public static void main(String[] args) {
    scanner = new FastScanner();
    printer = new PrintWriter(System.out);
    solve();
    printer.flush();
  }

  private static class FastScanner {
    BufferedReader br;
    StringTokenizer st;

    public FastScanner(Reader in) {
      br = new BufferedReader(in);
    }

    public FastScanner() {
      this(new InputStreamReader(System.in));
    }

    public String next() {
      while (st == null || !st.hasMoreElements()) {
        try {
          st = new StringTokenizer(br.readLine());
        } catch (IOException e) {
          e.printStackTrace();
        }
      }
      return st.nextToken();
    }

    public int nextInt() {
      return Integer.parseInt(next());
    }

    public long nextLong() {
      return Long.parseLong(next());
    }

    public double nextDouble() {
      return Double.parseDouble(next());
    }

    public String nextLine() {
      String str = "";
      try {
        str = br.readLine();
      } catch (IOException e) {
        e.printStackTrace();
      }
      return str;
    }

    public int[] readIntArray(int size) {
      int[] ret = new int[size];
      for (int i = 0; i < size; i++) {
        ret[i] = nextInt();
      }
      return ret;
    }
  }
}


Measured memory_bytes: 227848
IDENTIFICATION DIVISION.
      PROGRAM-ID. 149A.
      DATA DIVISION.
      WORKING-STORAGE SECTION.
      01 INP PIC X(300).
      01 S   PIC X(100).
      01 T   PIC X(100).
      01 OUT PIC X(200).
      
      PROCEDURE DIVISION.
      ACCEPT INP.
      UNSTRING INP DELIMITED BY " "
      INTO S T.
      
      STRING T S DELIMITED " "
      INTO OUT.
      
      DISPLAY FUNCTION TRIM(OUT).
      
      STOP RUN.

Measured memory_bytes: 384
import heapq
def dijkstra(v,s,path):
    inf = float('inf')

    # 距離をinfで初期化
    d = [inf for i in range(v)]
    d[s] = 0

    # sへの距離は0
    q = [[0,s]]
    heapq.heapify(q)

    # 距離が最小の頂点から更新していけば
    # p[1]から行ける
    while q:
        p = heapq.heappop(q)

        # 頂点p[1]までの距離がheapないのp[1]までの距離より小さい場合、continue
        if d[p[1]]<p[0]:
            continue

        # 頂点p[1]から伸びる、全ての辺の距離を確認
        for i in range(len(path[p[1]])):
            # 頂点p[1]から行ける頂点の距離がp[1]までの距離とp[1]からの距離の和より小さい場合 -> 距離を更新し、heapに追加
            if d[path[p[1]][i][1]] > d[p[1]] + path[p[1]][i][0]:
                d[path[p[1]][i][1]] = d[p[1]]+path[p[1]][i][0]
                heapq.heappush(q,[d[path[p[1]][i][1]], path[p[1]][i][1]])
    return d


n = int(input())
p = [[] for i in range(n)]

for i in range(n-1):
    a,b,c = map(int, input().split())
    a-=1
    b-=1
    p[a].append([c,b])
    p[b].append([c,a])

q,k = map(int,input().split())
k-=1

d = dijkstra(n,k,p)

for i in range(q):
    x,y = map(int, input().split())
    x-=1
    y-=1
    print(d[x]+d[y])


Measured memory_bytes: 111008
#include<bits/stdc++.h>
using namespace std;
int a[2000][2000];
void go(int x,int y,int z,int w){
    if((z-x+1)<=1||w-y+1<=1)return;
    a[(x+z)/2][(y+w)/2]=0;
    go(x,y,(x+z)/2-1,(y+w)/2-1);
    go(x,(y+w)/2+1,(x+z)/2-1,w);
    go((x+z)/2+1,y,z,(y+w)/2-1);
    go((x+z)/2+1,(y+w)/2+1,z,w);
}
int main(){
	int n,m;
  	scanf("%d %d",&n,&m);
  n=(1<<n)-1;
  m=(1<<m)-1;

    for(int i = 1;i<=n;i++){
    	for(int j=1;j<=m;j++){
        	a[i][j]=1;
        }
    }
    go(1,1,n,m);
  for(int i = 1;i<=n;i++){
  for(int j=1;j<=m;j++)printf("%d",a[i][j]);
    printf("\n");
  }
  /*for(int i = 1;i<=n;i++){
      for(int j=1;j<=m;j++){
          a[i][j]+=a[i-1][j]+a[i][j-1]-a[i-1][j-1];
      }
  }
  int sum=0;
  for(int i=0;i<n;i++){
      for(int j=0;j<m;j++){
          for(int k=i+1;k<=n;k++){
              for(int l=j+1;l<=m;l++){
                  if((a[k][l]-a[i][l]-a[k][j]+a[i][j])&1)
                    sum++;
              }
          }
      }
  }
  printf("%d\n",sum);*/
}

Measured memory_bytes: 9472
#include<stdio.h>
#include<stdlib.h>
#define MAX 20000  // スタックの最大値

typedef struct{
  int top;         // スタックポインタ(一番上の位置)
  int S[MAX];
}Stack;


// スタック st の初期化
void initialize(Stack *st)
{
  st->top = 0;
  st->S[st->top] = 0;
}

// スタック st が空かどうかを確認
int isEmpty(Stack *st)
{
  return st->top == 0;
}

// スタック st が一杯かどうかを確認
int isFull(Stack *st)
{  
  return st->top >= MAX - 1;
}

// スタック st に要素 x をプッシュ(一番上に要素を追加)
void push(int x, Stack *st)
{
  if (isFull(st)) 
    exit(1);

  st->top++;
  st->S[st->top] = x;
}

// スタック st から要素をポップ(一番上の要素を取り出す)
int pop(Stack *st) {
  if (isEmpty(st)) 
    exit(1);

  st->top--;
  return st->S[st->top+1];
}


int main(void)
{
  Stack st1;     // '\' の開始位置を格納するスタック
  Stack st2_j;   // 各水たまりの最も左の'\' の位置を格納するスタック
  Stack st2_a;   // 各水たまりの水量を格納するスタック

  // スタック初期化
  initialize(&st1);
  initialize(&st2_j);
  initialize(&st2_a);

  char c;
  int sum = 0;  // 水たまりの総水量
  int i=0;

  // 地形を読み込み，各水たまりの水量を計算
  for (i = 0; (c = getchar()) != EOF; i++) {
 
    if (c == '\\') {                                 // '\' が出た時の処理
      // 位置 i を st1 にプッシュ(write your code)
    	push(i, &st1);
    }
  	else if (!isEmpty(&st1) && c == '/') {          // '/' が出た時の処理
		// 水たまりの総水量 sum を更新(write your code)
		//くだりpush、のぼりpop、その差を総面積に追加する
  		int j = pop(&st1);
  		sum = sum + (i-j);
//  		printf("i=%d, j=%d, sum=%d\n", i ,j ,sum);
  		
      // st2_j と st2_a を用いて水たまりの水量を更新 
		int a = i - j;   // 更新する水たまりの水量を a に格納していく
//		printf("a=%d\n", a);
  		
      while (!isEmpty(&st2_j) && st2_j.S[st2_j.top] > j) {  // 最も左の '\' の位置が j よりも大きい場合，以下を繰り返す
        // 水たまりの水量を求めていく (write your code)
      	pop(&st2_j);
      	a =  a + pop(&st2_a);
//      	printf("*a=%d\n", a);
      }
      // 更新した水たまりの「最も左の'\' の位置」および「水量」を更新 (write your code)
  		push(j, &st2_j);
  		push(a, &st2_a);
    }
  }

	printf("%d\n", sum);       // 水たまりの総水量を出力
	printf("%d", st2_a.top);   // 水たまりの個数を出力

  // 各水たまりの水量を断面図の左から出力(スタックの底から出力)
  for (int i = 1; i <= st2_a.top; i++) 
    printf(" %d", st2_a.S[i]);  
  printf("\n");

  return 0;
}


Measured memory_bytes: 2108
while(1):
    m,f,r=map(int,input().split())
    if(m==f==r==-1):
        break
    sum=m+f
    if(m==-1 or f==-1):
        print("F")
    elif(80 <= sum):
        print("A")
    elif(65 <= sum < 80):
        print("B")
    elif(50 <= sum < 65):
        print("C")
    elif(30 <= sum < 50):
        if(50 <= r):
            print("C")
        else:
            print("D")
    else:
        print("F")


Measured memory_bytes: 5592
#include <stdio.h>
int main(){
	long long int n,p,memo;
	
	scanf("%lld%lld",&n,&p);
	if(n>=40)
	{
		printf("1");
		return 0;
	}
	if(n==1)
	{
		printf("%lld",p);
		return 0;
	}
	for(int i=1000000;i>0;i--)
	{
		memo=p;
		for(int j=1;j<=n;j++)
		{
			
			if(memo%i!=0)
			{
				break;
			}
			memo/=i;
			if(j==n)
			{
				printf("%lld",i);
              return 0;
			}
		}
	}
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define rep(i, l, r) for(register int i = l; i < r; i++)
#define hrp(i, l, r) for(register int i = l; i <= r; i++)
#define rev(i, r, l) for(register int i = r; i >= l; i--)
#ifdef LOCAL
#define D(x) cout<<"D: "<<#x<<'='<<x<<endl;
#define R(x, l) cout<<"R: Array "<<#x<<endl; rep(i, 0, l) cout<<' '<<i<<':'<<*(x+i)<<endl;
#else
#define D(x)
#define R(X, l)
#endif
#define pb push_back
#define int ll
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
template<typename tn> inline tn next(void);
template<typename tn> inline ostream& operator << (ostream& os, const vector<tn>& v);
inline int _max(int cnt, ...);
inline int _min(int cnt, ...);
signed main(void)
{
	#ifdef LOCAL
//		freopen("C:\\Users\\Joeon\\Desktop\\IN.txt", "r", stdin);
//		freopen("C:\\Users\\Joeon\\Desktop\\OUT.txt", "w", stdout);
	#endif
	ios::sync_with_stdio(false);
	cin.tie(0);
	string str = next<string>();
	rep(i, 0, str.length()) if (str[i] == '7') { puts("Yes"); return 0; }
	puts("No");
	return 0;
}
template<typename tn> inline tn next(void)
{
	tn k;
	cin>>k;
	return k;
}
template<typename tn> inline ostream& operator << (ostream& os, const vector<tn>& v)
{
	rep(i, 0, v.size()) os<<v[i]<<' ';
	return os;
}
inline int _max(int cnt, ...)
{
	int mx = -1e18;
	va_list l;
	va_start(l, cnt);
	while(cnt--) mx = max(mx, va_arg(l, int));
	va_end(l);
	return mx;
}
inline int _min(int cnt, ...)
{
	int mn = 1e18;
	va_list l;
	va_start(l, cnt);
	while(cnt--) mn = min(mn, va_arg(l, int));
	va_end(l);
	return mn;
}


Measured memory_bytes: 3644
#pragma region template 2.4
#include <bits/stdc++.h>
using namespace std;
template <typename T>
using pq_asc = priority_queue<T, vector<T>, greater<T>>;
typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll, ll> ii;
typedef vector<ii> vii;
typedef vector<string> vs;
#define REP(i, n) for (ll i = 0; i < (n); ++i)
#define REP1(i, n) for (ll i = 1; i <= (n); ++i)
#define FOR(i, a) for (auto &i : a)
#define CH(f, x, y) x = f(x, y)
#define IN(T, x) \
    T x;         \
    cin >> x;
#define AIN(T, a, n) \
    vector<T> a(n);  \
    FOR(i, a)        \
    cin >> i;
#define A2IN(T1, a, T2, b, n) \
    vector<T1> a(n);          \
    vector<T2> b(n);          \
    REP(i, n)                 \
    cin >> a[i] >> b[i];
#define OUT(x) cout << (x) << endl;
#define FOUT(x) cout << fixed << setprecision(15) << (x) << endl;
#define ALL(a) (a).begin(), (a).end()
#define SORT(a) sort(ALL(a))
#define RSORT(a) \
    SORT(a);     \
    reverse(ALL(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define DUMPA(a)          \
    cout << #a << " = {"; \
    JOUT(ALL(a), cout, ", ") << "}" << endl;

template <typename T>
ostream &JOUT(T s, T e, ostream &os = cout, string sep = " ")
{
    if (s != e)
    {
        os << *s;
        ++s;
    }
    while (s != e)
    {
        os << sep << *s;
        ++s;
    }
    return os;
}

ostream &YES(bool cond, string yes = "Yes", string no = "No", ostream &os = cout)
{
    if (cond)
    {
        os << yes << endl;
    }
    else
    {
        os << no << endl;
    }
    return os;
}

template <typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p)
{
    os << '(' << p.first << ", " << p.second << ')';
    return os;
}

template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v)
{
    os << '[';
    JOUT(ALL(v), os, ", ") << ']';
    return os;
}

const ll INF = 1e18;
const ll MOD = 1e9 + 7;
#pragma endregion template

int main()
{
    IN(ll, X);
    IN(ll, Y);
    IN(ll, A);
    IN(ll, B);
    IN(ll, C);
    AIN(ll, p, A);
    AIN(ll, q, B);
    AIN(ll, r, C);

    RSORT(p);
    RSORT(q);
    RSORT(r);
    vi s;
    REP(i, X)
    {
        s.push_back(p[i]);
    }
    REP(i, Y)
    {
        s.push_back(q[i]);
    }
    SORT(s);
    ll ans = 0;
    REP(i, X + Y)
    {
        if (i < C)
        {
            ans += max(s[i], r[i]);
        }
        else
        {
            ans += s[i];
        }
    }
    OUT(ans);
}

Measured memory_bytes: 4724
#include <bits/stdc++.h>
#include <boost/range/irange.hpp>

using namespace std;
using namespace boost;

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

    unordered_map<int64_t, int64_t> nums;
    for (auto i : irange(0L, n)) {
        int64_t a;
        cin >> a;

        ++nums[a];
    }

    if (nums.size() == 1) {
        if (nums.begin()->first == 0) {
            cout << "Yes" << endl;
        } else {
            cout << "No" << endl;
        }
    } else if (n % 3 > 0) {
        cout << "No" << endl;
    } else if (nums.size() == 2) {
        if (nums[0] != n / 3) {
            cout << "No" << endl;
        } else {
            cout << "Yes" << endl;
        }
    } else {
        array<int64_t, 3> m;
        int64_t i = 0;
        for (const auto& kv : nums) {
            if (kv.second != n / 3) {
                cout << "No" << endl;
                return 0;
            }
            m[i] = kv.first;
            ++i;
        }

        if ((m[0] ^ m[1]) != m[2]) {
            cout << "No" << endl;
        } else {
            cout << "Yes" << endl;
        }
    }
}

Measured memory_bytes: 3620
//Nihal Mittal - nihal_47
//Strike First , Strike Hard , No Mercy !!

/**⠀⠀⠀⠀⠀⠀⣀⣤⣤⣄⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⣠⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⣀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⣰⣿⣿⣿⣿⠿⠿⣿⣿⣿⣿⣿⣿⣿⣧⢀⠀⠀⠀⠀
⠀⠀⠀⣿⣿⣿⠋⠀⠀⠀⠀⠀⠙⠀⠙⣿⣿⣿⣷⢳⢀⠀⠀⠀
⠀⠀⣠⣿⣿⣿⢸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⣿⣿⣿⢀
⠀⠀⣸⣿⣿⣿⠸⠀⠀⠀⠒⠒⠒⠐⠀⠀⢿⣿⣿⣿⣿⣿⠀⠀
⠀⣴⣿⣿⣿⡿⠀⠒⣋⣙⡒⢰⠀⠤⣖⠒⢾⣿⣿⣿⣿⣧⠀⠀
⢺⣿⣿⣿⣿⢀⠀⠀⠉⠉⠉⠸⠀⡇⠉⠉⠀⢿⣿⣿⣿⣄⠀⠀
⠀⠙⣿⣿⣧⢻⠀⠀⠀⠀⠀⠠⠀⠰⠀⠀⠀⣸⠸⣿⣿⠿⠰⠀
⠀⠀⠀⠹⣿⣿⣿⣷⠀⡠⠙⣲⣔⣅⢡⣰⣷⣿⣿⣿⣧⠀⠀⠀
⠀⠀⠀⣼⣿⣿⣿⣿⠀⡿⠭⠭⠭⠭⢿⠀⣿⢻⣿⣿⠃⠀⠀⠀
⠀⠀⠀⠙⠛⣿⢻⠹⣿⠐⠙⠛⠟⠉⢀⣴⡟⢿⣿⡏⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⡟⠀⠀⠻⣦⣤⣶⠾⠋⠀⠀⠁⡦⢄⢀⠀⠀⠀
⠀⠀⠀⠀⡠⠁⡇⠑⢄⠀⠀⠀⠀⠀⠀⠔⠀⠀⠁⠀⠀⠀⠉⠁
⠀⠔⠊⠁⠀⠀⣇⠀⠀⠀⠑⡤⠤⢎⠁⠀⠀⡘⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⢢⠠⠀⡠⢆⠀⠀⡠⠙⢄⠀⡸⠀
**/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define ld long double
#define mk make_pair
#define pb push_back
#define in insert
#define se second
#define fi first
#define mod 1000000007
#define watch(x) cout << (#x) << " is " << (x) << "\n"
#define all(v) (v).begin(),(v).end()
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(0);
#define printclock cerr<<"Time : "<<1000*(ld)clock()/(ld)CLOCKS_PER_SEC<<"ms\n";
#define pii pair<ll,ll>
#define vi(x) vector<x>
#define maxn 100005
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
using namespace std;
using namespace __gnu_pbds;

signed main()
{
    fast;
   
    ll n,k,i,j;
    cin>>n>>k;
    ll a[n+2];
    for(i=0;i<n;i++)
    {
    	cin>>a[i];
    }
    

    for(i=k;i<n;i++)
    {
    	if(a[i]>a[i-k]) cout<<"Yes"<<"\n";
    	else cout<<"No"<<"\n";
    }
}

Measured memory_bytes: 5220
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashSet;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
//        String[] str = br.readLine().split(" ");
        int n = Integer.parseInt(br.readLine());
        HashSet<Long> set = new HashSet<>();
        for (int i = 0; i < n; i++){
            long num = Long.parseLong(br.readLine());
            if(set.contains(num)) set.remove(num);
            else set.add(num);
        }
        System.out.println(set.size());
    }
}


Measured memory_bytes: 44128
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <stack>
#include <queue>
#include <tuple>
#include <cassert>
#include <functional>
#include <set>
#include <deque>
#include <list>
using namespace std;
typedef long long ll;
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};
#define LNF __LONG_LONG_MAX__
const ll MOD = 1000000007;
const int MAX = 200000;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
// 法mでのaの逆元を計算
long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
// a^n mod を計算する
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
//最大公約数
long long gcd(long long x, long long y){
    if(y==0) return x;
    else return gcd(y,x%y);
}
//最小公倍数
long long lcm(long long x, long long y){
    return x / gcd(x, y) * y;
}
// nが大きく,kが10^7程度の時の二項係数
long long com[200005];
void combination(long long n,long long k){
    com[0] = 1;
    for(int i=1;i<=k;i++){
        com[i] = (com[i-1]*(n-i+1)%MOD)*modinv(i,MOD)%MOD;
    }
}

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


Measured memory_bytes: 3588
#include <iostream>
#include <cstring>
#include <algorithm>
#include <map>
#include <stack>
#include <vector>
#include <queue>
#include <set>
#include <sstream>
#include <ostream>
#include <time.h>
#include <array>
#include <cstdlib>
typedef long long int ll;
using namespace std;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	string st;
	cin >> st;
	string c = "";
	for(ll i=0; st[i]; i++){
		if(st[i] != ',')
			c += st[i];
		else{
			cout << c << " ";
			c = "";
		}
	}
	cout << c;
	return 0;
}

Measured memory_bytes: 3520
N,x = map(int,input().split())
if x in (1, 2 * N - 1):
    print('No')
    exit()
print('Yes')
if N == 2 and x == 2:
    l = [1, 2, 3]
    print(*l, sep='\n')
elif x == 2:
    l = [4, 1, 2, 3]
    rest = list(range(5, 2 * N))
    m = len(rest) // 2
    l = rest[:m] + l + rest[m:]
    print(*l, sep='\n')
elif x == 2 * N - 2:
    l = [x - 2, x + 1, x, x - 1]
    rest = list(range(1, 2 * N - 4))
    m = len(rest) // 2
    l = rest[:m] + l + rest[m:]
    print(*l, sep='\n')
else:
    l = [x + 2, x - 1, x, x + 1, x - 2]
    rest = list(range(1, x - 2)) + list(range(x + 3, 2 * N))
    m = len(rest) // 2
    l = rest[:m] + l + rest[m:]
    print(*l, sep='\n')


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

int main(){
   int N;
   cin>>N;
   bool ans=false;
  
   for(int i=1;i<10;i++){
      for(int j=1;j<10;j++){
         if(i*j==N){
            ans=true;
            break;
         }
         if(ans==true){
            break;
         }
      }
   }
  
   if(ans==true){
      cout<<"Yes"<<endl;
   }
  
   if(ans==false){
      cout<<"No"<<endl;
   }
}

Measured memory_bytes: 384
use nqp;

my \a = $*IN.get.split(" ");
for <0 1 2> {
  if nqp::cmp_s(a[nqp::mod_n(nqp::unbox_i($_),nqp::unbox_i(3))],a[nqp::mod_n(nqp::unbox_i($_+1),nqp::unbox_i(3))]) == nqp::unbox_i(0) {
      nqp::say(a[nqp::mod_n(nqp::unbox_i($_+2),nqp::unbox_i(3))])
  }
}


Measured memory_bytes: 66296
x = int(input())
def primes(n):
    #2~nまでの素数を列挙
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return [i for i in range(n + 1) if is_prime[i]]

y = primes(10**5*2)

from bisect import bisect_left
print(y[bisect_left(y,x)])


Measured memory_bytes: 5260
MOD = 1000000007

def pow(a, b):
	if not b:
		return 1
	c = pow(a, b // 2)
	if b % 2:
		c = a * c % MOD * c % MOD
	else:
		c = c * c % MOD
	return c

X, Y = map(int, input().split())
if (X * 2 - Y) % 3 or (Y * 2 - X) % 3:
	print(0)
else:
	a, b = (X * 2 - Y) // 3, (Y * 2 - X) // 3
	if a < 0 or b < 0:
		print(0)
	else:
		c = [1] * (a + b + 1)
		i = 1
		while i <= a + b:
			c[i] = c[i - 1] * i % MOD
			i += 1
		print(c[a + b] * pow(c[a], MOD - 2) % MOD * pow(c[b], MOD - 2) % MOD)

Measured memory_bytes: 29428
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please

//解説すごいみんなすごい

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


	int N, M;
	cin >> N >> M;
	int A[10] = {};
	int K[10] = { 0,2,5,5,4,5,6,3,7,6 };
	int B[10] = {};
	rep(i, M) {
		int a;
		cin >> a;
		A[a] = 1;
		B[K[a]] = 1;
	}

	int dp[10001];
	rep(i, 10001) dp[i] = -1;
	dp[0] = 0;
	rep1(i, N) {
		int kari = -1;
		rep1(j, 9) {
			if (B[j] && i - j >= 0) {
				kari = max(kari, dp[i - j]);
			}
		}
		if (kari != -1) {
			dp[i] = kari + 1;
		}
	}

	for (int i = 9; i > 0; i--) {
		if (A[i]) {
			while (N - K[i] >= 0 && dp[N] - dp[N - K[i]] == 1) {
				cout << i;
				N -= K[i];
			}
		}
	}
	cout << endl;

	Would you please return 0;
}

Measured memory_bytes: 256
/*huzaifa242 copyright*/
#include <bits/stdc++.h>
using namespace std;
#define PI 3.1415926535897932384626
#define mod 1000000007
#define MAX 100005
long long int n,dp[101][MAX],cc[MAX][2];
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #ifdef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);  
    #endif
    int i,j,ans=0,w;
    cin>>n>>w;
    memset(dp,0,sizeof(dp));
    for(i=0;i<n;i++)
    {
    	for(j=0;j<2;j++)
        cin>>cc[i][j];
    }
    for(i=0;i<n;i++)
    {
        for(j=0;j<=w;j++)
        {
            if(j<cc[i][0])
            {
                if(i==0)
                dp[i][j]=0;
                else
                dp[i][j]=dp[i-1][j];
            }
            else
            {
                if(i==0)
                dp[i][j]=cc[i][1];
                else
                dp[i][j]=max(dp[i-1][j],dp[i-1][j-cc[i][0]]+cc[i][1]);
            }
            //cout<<dp[i][j]<<" ";
        }
        //cout<<" ** "<<cc[i][0]<<"\n";
    }
    cout<<dp[n-1][w]<<"\n";
    return 0;
}

Measured memory_bytes: 79232
function rectAndPeri() {
    var Array = x.split(" ");
    var a = parseInt(Array[0]);
    var b = parseInt(Array[1]);
    var rect = a * b
    var peri = (a + b) * 2
    console.log(rect + " " + peri) ;
}

x = require('fs').readFileSync('/dev/stdin', 'utf8')

rectAndPeri(x)



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

int main(){
  int x1,y1,x2,y2;
  cin >>x1>>y1>>x2>>y2;
  
  int x3,y3,x4,y4;
  
  int xd = abs(x1-x2);
  int yd = abs(y1-y2);
  
  if(y1>y2){
    x3 = x2+yd;
    x4 = x1+yd;
  }else{
    x3 = x2-yd;
    x4 = x1-yd;
  }
  
  if(x1>x2){
    y3 = y2-xd;
    y4 = y1-xd;
  }else{
    y3 = y2+xd;
    y4 = y1+xd;
  }
  
  cout <<x3<<' '<<y3<<' '<<x4<<' '<<y4<<endl;
}

Measured memory_bytes: 256
#include<stdio.h>

#define MAX 9
#define MIN 0

int main(void)
{
        int a = 0, b = 0, c = 0, d = 0;

        int n = 0;
        int count = 0;



        while(scanf("%d",&n) != EOF)
        {
                for(a = MIN; a <= MAX; a++)
                {
                        for(b = MIN; b <= MAX; b++)
                        {
                                for(c = MIN; c <= MAX; c++)
                                {
                                        for(d = MIN; d <= MAX; d++)
                                        {
                                                if((a+b+c+d) == n)
                                                {
                                                        count++;
                                                }
                                        }
                                }
                        }
                }

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

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

long long calc(long long n, long long a, long long b) {


}

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

    long long diff = b - a;
    long long res = 0;

    if (a > b) {
        res = 0;
    } else if (n == 1) {
        if (a==b)
            res = 1;
        else
            res = 0;
    } else {
        res = diff * (n - 2) + 1;
    }

    cout << res << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<list>
#include<map>
#include<numeric>
#include<iomanip>
#define REP(i,m,n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)
#define ll long long

using namespace std;

//最大公約数
ll gcd(ll a, ll b) {
	if (b == 0) {
		return a;
	}
	return gcd(b, a % b);
}

//最小公倍数
ll lcm(ll a, ll b) {
	return a * b / gcd(a, b);
}

int main() {
	ll w, h, x, y;
	cin >> w >> h >> x >> y;
	
	double d_w = w;
	double d_h = h;
	double ans_area = (d_w / 2) * (d_h / 2) * 2;
	int ans_how;
	if (w % 2 == 0 && h % 2 == 0 && x == w / 2 && y == h / 2)ans_how = 1;
	else ans_how = 0;

	cout << fixed << setprecision(10) << ans_area << " ";
	cout << ans_how << endl;
	return 0;
}

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

const long MAX_NUM = 123456 * 2;

vector<bool> Prime;
void initPrime(long num) {
	Prime = vector<bool>(num + 1, true);
	Prime[1] = Prime[0] = false;
	long sq_num = sqrt((double)num);
	for (long i = 2; i < sq_num; i++) {
		if (Prime[i]) {
			for (long j = i + i; j <= num; j += i) {
				Prime[j] = false;
			}
		}
	}
}

int main(void) {
	initPrime(MAX_NUM);

	int N;
	while (cin >> N, N) {
		int num = 0;
		for (int i = N + 1; i <= N * 2; i++) {
			if (Prime[i]){
				num++;
			}
		}
		cout << num << endl;
	}
	return 0;
}

Measured memory_bytes: 1276
'use strict'
function main(input) {
    const tmp = input.split('\n');
    const NK = tmp.shift().split(' ').map((elem) => parseInt(elem, 10));
    const N = NK[0];
    const K = NK[1];

    let bucket = new Array(100001).fill(0);
    for (let ab of tmp) {
        const a = parseInt(ab.split(' ')[0], 10);
        const b = parseInt(ab.split(' ')[1], 10);
        bucket[a] += b;
    }


    let count = 0;
    for (let i = 0; i < bucket.length; i++) {
        count += bucket[i];
        if (count >= K) {
            console.log(i);
            break;
        }
    }
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 31040
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] d = new int[n];
        for (int i = 0; i < n; i++) {
            d[i] = sc.nextInt();
        }

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

        System.out.println(ans);

        sc.close();
    }

}


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

using namespace std;

int main(void)
{

  int K;
  cin >> K;

  string S;
  cin >> S;

  if (S.size() <= K) {
    cout << S << endl;
  } else {
    string ans = S.substr(0,K);
    ans.append("...");
    cout << ans << endl;
  }
  
}

Measured memory_bytes: 3632
from collections import defaultdict

class UnionFind:
    def __init__(self, n):
        self.par = [i for i in range(n + 1)]
        self.rank = [0] * (n + 1)
        self.size = [1] * (n + 1)

    def find(self, x):
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]

    def same_check(self, x, y):
        return self.find(x) == self.find(y)

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if self.rank[x] < self.rank[y]:
            if self.same_check(x, y) != True:
                self.size[y] += self.size[x]
                self.size[x] = 0
            self.par[x] = y
        else:
            if self.same_check(x, y) != True:
               self.size[x] += self.size[y]
               self.size[y] = 0
            self.par[y] = x
            if self.rank[x] == self.rank[y]:
               self.rank[x] += 1

    def siz(self, x):
        x = self.find(x)
        return self.size[x]

def getlist():
    return list(map(int, input().split()))

N, M = getlist()
U = UnionFind(N)
for i in range(M):
    X, Y, Z = getlist()
    U.union(X, Y)

D = defaultdict(int)


for i in range(1, N + 1):
    n = U.find(i)
    D[n] += 1

print(len(D))

Measured memory_bytes: 20972
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		String[] str = in.nextLine().split(" ",0);
		String[] st1 = str[0].split("",0);
		String[] st2 = str[1].split("",0);
		String[] st3 = str[2].split("",0);

		int s1Len = st1.length-1;
		int s2Len = st2.length-1;

		if((st1[s1Len].equals(st2[1])) && (st2[s2Len].equals(st3[1]))){
			System.out.println("YES");
		}else{
			System.out.println("NO");
		}

	}

}


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

int main(){
  
  int i,N,ct=0;
  string s,s_;
  string t,t_;
 
  cin>>N;
  cin>>s;
  cin>>t;
  
  for(i=0;i<N;i++){
    s_=s.substr(i);
    t_=t.substr(0,N-i);
	if(s_==t_){
      ct=N-i;
      break;
    }
  }
  cout<<2*N-ct<<endl;
  
}

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

#define INF (1e9+5)
using namespace std;
typedef long long ll;

int n;
vector<pair<int, int>> m;
vector<int> v;
double diff[10][10];

int main() {
  scanf("%d", &n);
  int x, y;
  for (int i=0; i<n; i++) {
    scanf("%d %d", &x, &y);
    v.push_back(i);
    m.push_back(make_pair(x, y));
  }

  for (int i=0; i<10; i++) {
    for (int j=0; j<10; j++) {
      diff[i][j] = -1.0;
    }
  }

  double d;
  for (int i=0; i<n; i++) {
    for (int j=i+1; j<n; j++) {
      ll dx = m[i].first - m[j].first;
      ll dy = m[i].second - m[j].second;
      d = sqrt(dx * dx + dy * dy);
      diff[i][j] = d;
      diff[j][i] = d;
    }
  }

  double ans = 0.0;
  int count = 0;
  do {
    count++;
    for (int i=0; i<n-1; i++) {
      ans += diff[v[i]][v[i+1]];
    }
  } while (std::next_permutation(v.begin(), v.end()));

  printf("%.10f\n", ans/count);
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <queue>
#include <climits>
#include <set>
#include <map>
#include <stack>
#include <iomanip>
#include <tuple>
#define ll long long
#define rep(i,s,n) for(ll i = (ll)(s); i < (ll)(n); i++)
#define all(a) (a).begin(),a.end()
using namespace std;
using graph =vector<vector<ll>>;
/*階乗*/
ll factorial(ll n){
    if(n==0){
        return 1;
    }
    else{
        return n*factorial(n-1);
    }
}

/* ユークリッドの互除法 最大公約数*/
ll gcd(ll a, ll b) {
	ll r;
	r = a % b;
	while (r != 0) {
		a = b;
		b = r;
		r = a % b;
	}
	return b;
}



/*最小公倍数*/

ll lcm(ll a,ll b){
	return a/gcd(a,b)*b;
}


/*二点間の距離*/
double dist(pair<double,double> a,pair<double,double> b){
	return sqrt(pow((a.first - b.first) ,2) + pow((a.second - b.second),2));
}

//繰り返し自乗法
double ism(double aa,ll p){
    double ap=aa;
    double ans=1;
    while(p>0){
        //cout<<"p="<<p<<",ap="<<ap<<endl;
        if(p&1){//奇数が真
            ans*=ap;
        }
        p/=2;
        ap=ap*ap;
    }
    return ans;

}
//繰り返し自乗法(アマリトリバージョン)
ll ismm(ll aa,ll p,ll m){
    ll ap=aa;
    ll ans=1;
    while(p>0){
        //cout<<"p="<<p<<",ap="<<ap<<endl;
        if(p&1){//奇数が真
            ans=(ans*ap)%m;    
        }
        p/=2;              
        ap=(ap*ap)%m;
    }
    return ans;

}
/*
ll solve(ll i,ll m,vector<ll>t,ll n){
    if(m==0){
        return 1;
    }
    if(i>=n){
        return 0;
    }
    
    
    cout<<i+1<<" "<<m<<endl;
    cout<<i+1<<" "<<m-t[i]<<endl;
    ll res=solve(i+1,m,t,n)||solve(i+1,m-t[i],t,n);
    return res;
}
*/

//小数点12桁
struct all_init
{
    all_init()
    {
        cout << fixed << setprecision(12);
    }
} All_init;


int main()
{
    ll n,m;
    cin>>n>>m;
    vector<ll>k(n);
    //vector<vector<ll>>a(n,vector<ll>(k(n));
    map<ll,ll>mp;
    rep(i,0,n){
        cin>>k[i];
        rep(j,0,k[i]){
            ll a;
            cin>>a;
            mp[a]++;
        }
    }
    ll count=0;
    rep(i,0,m+1){
        if(mp[i]==n){
            count++;
        }
    }
    cout<<count<<endl;

    

}


Measured memory_bytes: 256
/* ITP1_7_A */
#include <stdio.h>

#define FAILING_GRADE_NUM -1
#define GRADE_A_COND 80
#define GRADE_B_COND 65
#define GRADE_C_COND 50
#define GRADE_D_COND 30

/* ??????????????????????????? */
char get_grade_char(short m, short f, short r);

int main(void)
{
	// ??????????¨??????°
	short m = 0;
	// ??????????¨??????°
	short f = 0;
	// ???????¨??????°
	short r = 0;
	
	while( 1 )
	{
		// ??\????????????
		scanf("%hd %hd %hd", &m, &f, &r);
		
		// ???????????¶
		if( FAILING_GRADE_NUM == m && FAILING_GRADE_NUM == f && FAILING_GRADE_NUM == r ){
			break;
		}
		
		// ???????????????
		printf("%c\n", get_grade_char(m, f, r));
	}
	
	return 0;
}

/* ??????????????????????????? */
char get_grade_char(short m, short f, short r)
{
	// ??????????¨??????????????¨????????????????????¬????????????´????????????F
	if( FAILING_GRADE_NUM == m || FAILING_GRADE_NUM == f )
	{
		return 'F';
	}
	// ??????????¨???¨??????????¨????????¨??????°???80??\???????????°?????????A
	if( GRADE_A_COND <= (m + f))
	{
		return 'A';
	}
	// ??????????¨???¨??????????¨????????¨??????°???65??\???80??????????????°?????????B
	if( GRADE_B_COND <= (m + f) && GRADE_A_COND > (m + f) )
	{
		return 'B';
	}
	// ??????????¨???¨??????????¨????????¨??????°???50??\???65??????????????°?????????C
	if( GRADE_C_COND <= (m + f) && GRADE_B_COND >  (m + f) )
	{
		return 'C';
	}
	// ??????????¨???¨??????????¨????????¨??????°???30??\???50??????????????°?????????D
	if( GRADE_D_COND <= (m + f) && GRADE_C_COND > (m + f) )
	{
		//????????????????¨?????????°???50??\???????????°?????????C
		if( GRADE_C_COND <= r )
		{
			return 'C';
		}
		return 'D';
	}
	// ??????????¨???¨??????????¨????????¨??????°???30??????????????°?????????F
	if( GRADE_D_COND > (m + f) )
	{
		return 'F';
	}
	return 'F';
}

Measured memory_bytes: 600
//BISMILLAH
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int digit,n,sum=0;
    cin>>n;
    digit=n%10;
    if(digit==2 || digit==4 || digit==5 || digit==7 || digit==9) cout<< "hon"<<endl;
    else if(digit==3) cout<< "bon"<<endl;
    else
        cout<< "pon"<<endl;
    return 0;
}


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


Measured memory_bytes: 3236