akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef pair<int, int> pi;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<pi> vpi;

#define debugone(x) cerr << #x << " " << x << endl;
#define debugtwo(x) cerr << #x << "-------------" << endl;for(auto &it: x) cerr << it << " ";cerr << endl;
#define debugthree(x, i, j) cerr << #x << "------------" << endl;cerr << "from " << i << " to " << j << endl;for(int k=i; k<=j; k++) cerr << x[k] << " ";cout << endl;

const int mod = (int)1e9 + 7;


int main(int argc, char *argv[]){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	int r, d, x;
	cin >> r >> d >> x;
	for(int i = 0; i < 10; i++){
		cout << (x = (r * x - d)) << "\n";
	}
	
}	

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

signed main() 
{ 
	int N,M;
	priority_queue<int> A;
	cin>>N>>M;
    for(int i=0;i<N;i++){
    	int temp;
    	cin>>temp;
    	A.push(temp);
    }
    // Converting vector into a heap 
    // using make_heap() 
	for(int i=0;i<M;i++){
		int top = A.top();
		top /= 2;
		A.pop();
		A.push(top);
	}
	int sum = 0;
	for(int i=0;i<N;i++){
		sum += A.top();
		A.pop();
	}
    cout<<sum;
    return 0; 
} 

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


class UnionFind {
  public:
    // 親の番号
    // 自分が親の場合は-(その集合のサイズ)
    vector<int> Parent;

    // 最初はParentの値をすべて -1 にしておく
    // -1 は誰ともつながっていないことを示す
    UnionFind(int N){
      Parent = vector<int>(N, -1);
    }

    // A がどのグループに属しているかを調べる
    int root(int A) {
      if (Parent[A] < 0) {
        return A;
      }
      return Parent[A] = root(Parent[A]);
    }

    // 自分のいるグループの頂点数を調べる
    int size(int A) {
      return -Parent[root(A)];
    }

    // A と B をつなぐ
    bool connect (int A, int B) {

      // A と B を直接つなぐのではなく、
      // root(A) に root(B) をつなぐ
      A = root(A);
      B = root(B);
      
      if (A == B) {
        // すでにつながっているので、必要ない
        return false;
      }

      // 大きい方（A）に小さい方（B）をつなぎたいので、
      // 大小関係を確認する
      if (size(A) < size(B)) {
        swap (A, B);
      }

      // A のサイズを更新する
      Parent[A] += Parent[B];

      // B の親を A に変更する
      Parent[B] = A;

      return true;
    }

};


int main() {

  int N, M;
  cin >> N >> M;

  vector<int> A(M);
  vector<int> B(M);
  for (int i = 0; i < M; i++) {
    cin >> A[i] >> B[i];
    A[i]--;
    B[i]--;
  }

  vector<long long> answer(M);
  
  // 全部つながっていない場合 
  answer[M - 1] = (long long) N * (N - 1) / 2;

  UnionFind unionfind(N);

  for (int i = M - 1; 0 < i; i--) {
    
    answer[i - 1] = answer[i];

    // つながってなかったところがつながったとき
    if (unionfind.root(A[i]) != unionfind.root(B[i])) {
      answer[i - 1] -= unionfind.size(A[i]) * unionfind.size(B[i]);
      unionfind.connect(A[i], B[i]);
    }

  }

  for (int i = 0; i < M; i++) {
    cout << answer[i] << endl;
  }

  return 0;

}

Measured memory_bytes: 3328
#include <stdio.h>

int main(void){
 int n;
 int i = 1;
 int x;
 int i3f = 0;
 int f = 1;
 scanf("%d", &n);
 while(1){
  if(f){
   x = i;
   f = 0;
  }
  if (( x % 3 == 0) && (!(i3f))){
   printf(" %d", i);
  } else if (( x % 10 == 3) && (i3f) || ( x % 10 == 3)){
   i3f = 0;
   printf(" %d", i);
  } else {
   i3f = 0;
   x /= 10;
   if ( x ) i3f = 1;
  }
  if (!(i3f)){
   if ( ++i > n ) {
    break;
   } else {
    f = 1;
   }
  }
 }
 printf("\n");
 return (0);
}


Measured memory_bytes: 2704
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn main() {
    let n = read::<usize>();

    let mut ans = std::usize::MAX;
    
    for a in 1..(n as f64).sqrt().ceil() as usize +1{
        if n % a == 0 {
            ans = std::cmp::min(ans, n/a + a - 2);
        }
    }

    println!("{}", ans);

}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
int main() {
  int k, n, a; cin >> k >> n;
  int maxDist = 0;
  int first; cin >> first;
  int bef = first;
  for (auto i = 1; i < n; i++) {
    cin >> a;
    maxDist = max(maxDist, a - bef);
    bef = a;
  }
  maxDist = max(maxDist, first + k - a);
  cout << k - maxDist << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long 
#define pint pair<int,int>

const int MAX_N = 2e6;
const int inf = 1LL << 60;

vector<int> candi;
vector<int> odd;

int DPA[MAX_N],DPB[MAX_N];

void chmin(int &a, int b){ 
  if( a > b ){ swap(a,b);} return;
}

void init(){
  
  for(int i = 1; (i*(i+1)*(i+2))/6 < MAX_N; i++){
    int num = i*(i+1)*(i+2);
    num /= 6;
    candi.push_back(num);
    if(num%2){
      odd.push_back(num);
    }
  }
  
  
  int a = candi.size();
  int b = odd.size();
  
  
  for(int i = 0; i < MAX_N; i++){
    DPA[i] = inf; DPB[i] = inf;
  }
  
  for(int i = 0; i < a; i++){
    DPA[candi[i]] = 1;
  }
  
  for(int i = 0; i < b; i++){
    DPB[odd[i]] = 1;
  }
   
  DPA[0] = 0; DPB[0] = 0;
  
  for(int i = 1; i < MAX_N; i++){
   
    for(int j = 0; j < a; j++){ 
      if(i-candi[j] >= 0 ){ 
       chmin(DPA[i],DPA[i-candi[j]]+1);
      }
    }
    
  }
  
  for(int i = 1; i < MAX_N; i++){
    
    for(int j = 0; j < b; j++){
      if(i-odd[j] >= 0 ){
        chmin(DPB[i],DPB[i-odd[j]]+1);
      }
    }
  }
  
  return ;
}
  
    

signed main(void){
  int N; 
  init();
  while(cin >> N){
    if( N == 0 ){ return 0;}
    
    cout << DPA[N] << " " << DPB[N] << endl;
    
  }
  
  return 0;
} 


Measured memory_bytes: 34372
import java.util.*;

class Main{           
  
   public static void main(String[] args){
         Scanner sc = new Scanner(System.in);  
         
         while(true){
             
             int n = sc.nextInt();
             
             if(n==0){
                 break;
             }
             
             int array[] = new int[n];
             
             for(int i = 0;i < n;i++){
                 array[i] = sc.nextInt();
             }
             
             Arrays.sort(array);
             
             int sum  =0;
             
             for(int i = 1;i < array.length-1;i++){
                 sum += array[i];
             }
                                       
             System.out.println(sum/(n-2));                          
             
         }
        

   }         
         
 }
  

Measured memory_bytes: 29428
s = str(input())
l = ['a','b','c']
if s[0] == 'a' and s[1] == 'b' and s[2] == 'c':
  print("Yes")
elif s[0] == 'a' and s[1] == 'c' and s[2] == 'b':
  print("Yes")
elif s[0] == 'b' and s[1] == 'a' and s[2] == 'c':
  print("Yes")
elif s[0] == 'b' and s[1] == 'c' and s[2] == 'a':
  print("Yes")
elif s[0] == 'c' and s[1] == 'a' and s[2] == 'b':
  print("Yes")
elif s[0] == 'c' and s[1] == 'b' and s[2] == 'a':
  print("Yes")
  
else:
  print("No")

Measured memory_bytes: 3064
"""
author : halo2halo
date : 29, Jan, 2020
"""

import sys
import itertools

# import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

A, B, C = map(int, readline().split())
print(A if B==C else B if C==A else C)


Measured memory_bytes: 3060
k, n = gets.chomp.split.map(&:to_i)
As = gets.chomp.split.map(&:to_i)

spaces = As.map.with_index {|a, i|
  if i == 0
    nil
  else
    a - As[i-1]
  end
}.compact

spaces << ((k - As[-1]) + As[0])

puts k - spaces.max

Measured memory_bytes: 19844
N, K = map(int, input().split())
P = list(map(int, input().split()))
measuring = [sum(P[:K])]
for i in range(K, N):
    measuring.append(measuring[-1]+P[i]-P[i-K])
# print(measuring)

pointa = measuring.index(max(measuring))

tmp = P[pointa:pointa+K]
# print(tmp)
ans = 0
for t in tmp:
    ans += (t+1)/2
print(ans)


Measured memory_bytes: 24812
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;


int main(){
  ll r, D, x;
  cin >> r >> D >> x;

  rep(i,10){
    x = r * x - D;
    cout << x << endl;
  }
  
  return 0;
}


Measured memory_bytes: 256
# python3.4.2用
import math
import fractions
import bisect
import collections
import itertools
import heapq
import string
import sys
import copy
from decimal import *
from collections import deque
sys.setrecursionlimit(10**7)
MOD = 10**9+7
INF = float('inf') #無限大
def gcd(a,b):return fractions.gcd(a,b) #最大公約数
def lcm(a,b):return (a*b) // fractions.gcd(a,b) #最小公倍数
def iin(): return int(sys.stdin.readline()) #整数読み込み
def ifn(): return float(sys.stdin.readline()) #浮動小数点読み込み
def isn(): return sys.stdin.readline().split() #文字列読み込み
def imn(): return map(int, sys.stdin.readline().split()) #整数map取得
def imnn(): return map(lambda x:int(x)-1, sys.stdin.readline().split()) #整数-1map取得
def fmn(): return map(float, sys.stdin.readline().split()) #浮動小数点map取得
def iln(): return list(map(int, sys.stdin.readline().split())) #整数リスト取得
def iln_s(): return sorted(iln()) # 昇順の整数リスト取得
def iln_r(): return sorted(iln(), reverse=True) # 降順の整数リスト取得
def fln(): return list(map(float, sys.stdin.readline().split())) # 浮動小数点リスト取得
def join(l, s=''): return s.join(l) #リストを文字列に変換
def perm(l, n): return itertools.permutations(l, n) # 順列取得
def perm_count(n, r): return math.factorial(n) // math.factorial(n-r) # 順列の総数
def comb(l, n): return itertools.combinations(l, n) # 組み合わせ取得
def comb_count(n, r): return math.factorial(n) // (math.factorial(n-r) * math.factorial(r)) #組み合わせの総数
def two_distance(a, b, c, d): return ((c-a)**2 + (d-b)**2)**.5 # 2点間の距離
def m_add(a,b): return (a+b) % MOD
def lprint(l): print(*l, sep='\n')

N = iin()
A = iln()

c = [0 for _ in range(N+1)]
for i in range(N):
    c[i+1] = c[i] + A[i]

counter = collections.Counter(c)

ans = 0
for v in counter.values():
    ans += v*(v-1)//2
print(ans)




Measured memory_bytes: 43224
#include <stdio.h>

#define COOKIES 3

int main(){
	int a,b;

	scanf("%d %d", &a, &b);

	if(a % COOKIES == 0 || b % COOKIES == 0 || (a + b) % COOKIES == 0){
		printf("Possible\n");
	} else {
		printf("Impossible\n");
	}

	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
bool a[300001];
using namespace std;
int main(){
  int b,w,x,p=0,i;
  cin>>w>>b;
  for(i=0;i<w;i++){
    cin>>x;
    p=max(p,x);
    a[x]++;
  }
  while(b--){
    for(cin>>x,i=1;i<x;i++)
      for(int j=x-i;j<=p;j+=x)
        if(a[j])goto L;
    L:cout<<x-i<<endl;
  }
}

Measured memory_bytes: 3300
import sys, re
from math import ceil, floor, sqrt, pi, factorial, gcd
from copy import deepcopy
from collections import Counter, deque
from heapq import heapify, heappop, heappush
from itertools import accumulate, product, combinations, combinations_with_replacement
from bisect import bisect, bisect_left
from functools import reduce
# input = sys.stdin.readline 
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_list(N): return [s_list() for _ in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 6)
INF = float('inf')
MOD = 10 ** 9 + 7

def main():
    a, b, c, d, k  = i_map()

    h = c - a
    m = d - b

    ans = h * 60 + m

    print(ans-k)
            
if __name__ == '__main__':
    main()


Measured memory_bytes: 71428
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <numeric>
using namespace std;

int main(){

    int N;
    cin >> N;

    int candy;
    int sumUp[N] = {0};
    int sumBottom[N] = {0};

    cin >> candy;
    sumUp[0] = candy;
    for(int i = 1; i < N; i++){
        cin >> candy;
        sumUp[i] = sumUp[i-1] + candy;
    }

    cin >> candy;
    sumBottom[0] = candy;
    for(int i = 1; i < N; i++){
        cin >> candy;
        sumBottom[i] = sumBottom[i-1] + candy;
    }

    int candyMax = sumUp[0] + sumBottom[N-1]; 
    for(int i = 1; i < N; i++){
        if(sumUp[i] + sumBottom[N-1] - sumBottom[i-1] > candyMax){
            candyMax = sumUp[i] + sumBottom[N-1] - sumBottom[i-1];
        }
    }
    cout << candyMax << endl;

}

Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var a, b int
	fmt.Scan(&a,&b)
	
	if a % 3 == 0 || b % 3 == 0 || (a + b) % 3 == 0 {
		fmt.Println("Possible")
	} else {
		fmt.Println("Impossible")
	}
}

Measured memory_bytes: 512
#![allow(unused_imports)]
// use itertools::Itertools;
use proconio::{input, marker::*};

fn main() {
    input! {
        n: i64,
        m: i64
    };
    // k 番目までの期待値
    // Sum[i=1..k] (1 / (2^m)^i) * { 100*(n-m) + 1900*m }
    println!(
        "{}",
        (100 * (n - m) + 1900 * m) * 2i64.pow(m as u32)
    );
}


Measured memory_bytes: 2148
#include<bits/stdc++.h>
using namespace std;
#define cool ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long int
#define pb push_back
#define fe first
#define se second
#define pii pair<int,int>
#define PI  3.14159265358979323846
const int N=1e5+10;
const int INF=1e9+10;
int a[N];

void solve()
{  int n,k;
	cin>>n>>k;
	vector<int> dp(n+1,INF);
	for(int i=0;i<n;i++)
		cin>>a[i];
	dp[0]=0;
  for(int i=0;i<n;i++)
    {  int tot=0;
    	for(int j=i+1; ;j++ )
    	 {  tot++;
    	 	if(j<n)
    	 	  dp[j]=min(dp[j],dp[i]+abs(a[j]-a[i]));
    	 	 
    	 	 if(tot==k)
    	 	 	break; 	 
    	 }
    }  
  cout<<dp[n-1];

}


int main()
{  cool;
   int t=1;
   while(t--)   
     solve(); 

  return 0; 
}



Measured memory_bytes: 1024
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Math;

class MainClass
{
    static void Main()
    {
        long K = long.Parse(ReadLine());
        long N = 50;
        var Ans = new long[N];
        for (int i = 0; i < N; i++)
        {
            Ans[i] = (N - 1) + K / N-K%N;
        }
        for (int i = 0; i < K%N; i++)
        {
            Ans[i] += N + 1;
        }
        WriteLine(N);
        WriteLine(string.Join(" ",Ans));
    }
}


Measured memory_bytes: 27616
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const double EPS=1e-6;
const double PI=acos(-1.0);
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
char in[110];
string t[110];
int main(){
	int a,b;scanf("%d%d",&a,&b);
	for(int i=0;i<a;i++){
		scanf("%s",in);
		t[i]=in;
	}
	std::sort(t,t+a);
	for(int i=0;i<a;i++)printf("%s",t[i].c_str());printf("\n");
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)
#define VL vector<ll>
#define INF 100000000
typedef long long ll;

int main(){
    ll M;
    cin>>M;
    cout<<24+(24-M);
    return 0;
}

Measured memory_bytes: 256
import numpy as np
import sys

if __name__=="__main__":
   N, M = list(map(int, input().replace("\n","").split(" ")))
   a = [list(map(int, list(input().replace("\n","").replace(".", "1").replace("#", "0")))) for i in range(N)]
   a = np.array(a)
   b = [list(map(int, list(input().replace("\n","").replace(".", "1").replace("#", "0")))) for i in range(M)]
   b = np.array(b)


   for i in range(N - M + 1):
       for j in	range(N - M + 1):
           if((a[i:i+M,j:j+M] == b).all()):
               print("Yes")
               sys.exit(0)
   print("No")

Measured memory_bytes: 21768
#include<stdio.h>
#define max(a,b) ((a)>(b)?(a):(b))

int n,ww;
int w[110];
int v[110];
long long int c[110][100100];

int main(void){
    scanf("%d %d",&n,&ww);
    for(int i=0; i<n; i++){
        scanf("%d %d",w+i,v+i);
    }
    for(int i=1; i<n+1; i++){
        for(int j=1; j<ww+1 ; j++){
            if( j<w[i-1]){
                c[i][j]=c[i-1][j];
            }else{
                c[i][j]=max(c[i-1][j-w[i-1]]+v[i-1],c[i-1][j]);
            }
        }
    }
    printf("%lld",c[n][ww]);
}

Measured memory_bytes: 79232
import java.io.BufferedReader
import java.util.*
import kotlin.system.exitProcess

fun main() = abc135d()

@OptIn(ExperimentalStdlibApi::class)
fun abc135d() = SimpleFastIOWithToken_abc135d().exec {
    val s = readString()
    val mod = 1_000_000_007L
    val n = s.length

    // [seen i+1][rem] = patterns
    val dp = Array(n + 1) { LongArray(13) }.apply { this[0][0] = 1 }

    fun transition(i: Int, num: Int, mod: Long) {
        for (beforeRem in 0..12) {
            dp[i + 1][(beforeRem * 10 + num) % 13] += dp[i][beforeRem]
            dp[i + 1][(beforeRem * 10 + num) % 13] %= mod
        }
    }

    for ((i, c) in s.withIndex()) {
        if (c == '?') {
            for (num in 0..9) transition(i, num, mod)
        } else {
            val num = Character.getNumericValue(c)
            transition(i, num, mod)
        }
    }

    val answer = dp[n][5]

    println(answer)
}

// region kokokara template dayo (^o^)
@Suppress("unused", "HasPlatformType", "MemberVisibilityCanBePrivate", "ClassName")
private class SimpleFastIOWithToken_abc135d(private val separator: String = System.lineSeparator()) {
    private val br: BufferedReader = System.`in`.bufferedReader()
    private var st: StringTokenizer = StringTokenizer("")
    private val sb: StringBuilder = StringBuilder()
    private fun prepareNext() = run { if (!st.hasMoreTokens()) st = StringTokenizer(br.readLine()) }

    fun readString(): String = run { prepareNext() }.run { st.nextToken() }
    fun readInt(): Int = Integer.valueOf(readString())
    fun readLong(): Long = java.lang.Long.valueOf(readString())

    fun println(): Unit = run { sb.append(separator) }
    fun print(any: Any): Unit = run { sb.append(any) }
    fun println(any: Any): Unit = run { sb.append(any.toString() + separator) }

    fun exec(action: SimpleFastIOWithToken_abc135d.() -> Unit) = run {
        Thread(null, { action() }, "(^o^)", 128 * 1024 * 1024)
            .apply { setUncaughtExceptionHandler { _, e -> e.printStackTrace(); exitProcess(1) } }
            .apply { start() }.join()
    }.run { kotlin.io.print(sb) }

    fun readLine(): Nothing = error("readLine is disabled.")
}
// endregion kokomade template dayo (^o^)


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

long pow_(long a, long b, long modulo){
    if(b % 2 == 0){
        pow_(a*a % modulo, b/2, modulo);
    }
    else if(b != 1){
        return a * pow_(a, b-1, modulo) % modulo;
    }
    else{
        return a % modulo;
    }
}

long inv_mod(long a, long m){ //inv_mod(a, m) == a^-1 (mod m) m:prime
    return pow_(a, m-2, m);
}

long nCk(long n, long k, long modulo){
    long ans = 1;
    for(int i=0; i < k; ++i){
        ans *= (n-i);
        ans %= modulo;
    }
    for(int i=0; i < k; ++i){
        ans *= inv_mod(k-i, modulo);
        ans %= modulo;
    }
    return ans;
}

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

    long n_ = pow_(2, n, modulo);
    long a_ = nCk(n, a, modulo);
    long b_ = nCk(n, b, modulo);

    long ans = n_ -1 - a_ - b_;
    for(int i = 0; i < 2; ++i){
        if(ans < 0){
            ans += modulo;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
using ll = long long;

#define rep(i,n) for(ll i=0;i<ll(n);i++)
#define YESNO(T) if(T){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define yesno(T) if(T){cout<<"yes"<<endl;}else{cout<<"no"<<endl;}
#define YesNo(T) if(T){cout<<"Yes"<<endl;}else{cout<<"No"<<endl;}

const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;
const double pi = 3.14159265358979;



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

    ll a,b,c;
    cin >> a >> b >> c;

    bool ans;
    if (c-a-b < 0){
        ans = false;
    }
    else{
        ans = (c-a-b)*(c-a-b) > 4*a*b ? true : false;
    }

    YesNo(ans);
}

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

long long mem[100][21];
int N, V[100];

long long dp(int n, int r)
{
  if(n == N - 1)
  {
    if(r == V[n])
      return 1;
    return 0;
  }
  if(mem[n][r] != -1)
    return mem[n][r];
  long long ans = 0;
  if(r + V[n] <= 20)
    ans += dp(n + 1, r + V[n]);
  if(r - V[n] >= 0)
    ans += dp(n + 1, r - V[n]);
  mem[n][r] = ans;
  return ans;
}

int main()
{
  for(int i = 0; i < 100; i++)
    for(int j = 0; j < 21; j++)
      mem[i][j] = -1;
  cin >> N;
  for(int i = 0; i < N; i++)
    cin >> V[i];
  cout << dp(1, V[0]) << endl;
}

Measured memory_bytes: 1172
#include <bits/stdc++.h>
using namespace std;
#define mp(a,b) make_pair(a,b)
#define ff first
#define setp(a) setprecision(a)<<fixed
#define ss second
#define fori(v) for(ll i=0; i<v; i++)
#define forj(v) for(ll j=0; j<v; j++)
#define fork(v) for(ll k=0; k<v; k++)
#define forl(v) for(ll l=0; l<v; l++)
#define fort(v) for(ll t=0; t<v; t++)
#define forz(v) for(ll z=0; z<v; z++)
#define ll long long
#define ld long double
#define MAX (int)(7*pow(10,2) + 10)
#define pb(a) push_back(a)
// #define cout out
// #define cin in
ll inf = pow(10,9);
ll INF = inf;
ll modulo = inf;
double eps = 1e-10;
ifstream in;
ofstream out;
 
 
void deal(){
	ll a, b, c;
	cin>>a>>b>>c;
	string ans[2] = {"No", "Yes"};
	cout<<ans[((a==b)&&(b==c))];
}
 
 
 
int main(){
	cin.tie(0);
	ios_base::sync_with_stdio(0);
	deal();
}
 
 
 
/*
	
*/

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

#define MOD 1000000007
using namespace std;
typedef long long ll;

void comb(vector<vector <ll> > &v){
    for(int i = 0;i <v.size(); i++){
        v[i][0]=1;
        v[i][i]=1;
    }
    for(int k = 1;k <v.size();k++){
        for(int j = 1;j<k;j++){
            v[k][j]=(v[k-1][j-1]%MOD+v[k-1][j]%MOD);
        }
    }
}


int main(){
    ll n,k; cin>>n>>k;
    vector<vector<ll>> v(n+1,vector<ll>(n+1,0));
    comb(v);
    for(int i=1;i<=k;i++){
        cout<<(v[n-k+1][i]%MOD)*(v[k-1][i-1]%MOD)%MOD<<endl;
    }
    return 0;
}


Measured memory_bytes: 31616
N, K = map(int, input().split())
total_prob = 0
if N > K:
    total_prob = (N-K)/N
for i in range(1, min(N+1, K+1)):
    score = i
    prob = 1/N
    while score < K:
        prob *= 1/2
        score *= 2
    total_prob += prob
print(total_prob)

Measured memory_bytes: 3060
from heapq import heapify, heappushpop

N = int(input())
*A, = map(int, input().split())
INF = 10**16
first = A[:N]
heapify(first)
second = [-a for a in A[2*N:]]
heapify(second)
f = [0]*(N+1)
s = [0]*(N+1)
f[0] = sum(first)
s[N] = - sum(second)
for k in range(1, N+1):
    a = heappushpop(first, A[N-1+k])
    f[k] = f[k-1] + A[N-1+k] - a
for k in range(N-1, -1, -1):
    a = heappushpop(second, -A[N+k])
    s[k] = s[k+1] + A[N+k] + a
ans = -INF
for k in range(N+1):
    ans = max(ans, f[k] - s[k])
print(ans)

Measured memory_bytes: 40336
#include<bits/stdc++.h>
#define ALL(v) v.begin(), v.end()
#define ALLG(v) v.begin(), v.end() ,greater<int>()
typedef long long ll;
ll GCD(ll x, ll y) { return y ? GCD(y, x % y) : x; }
ll LCM(ll x, ll y) { return x * y / GCD(x, y); }

using namespace std;
int main() {

	double l = 0;
	cin >> l;


	double a = l / 3.0;

	


	cout << fixed;
	cout << setprecision(10) << (double)a*a*a << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <deque>
using namespace std;
 
#define ll long long

int main() {
    int N, Q, c[100010]; cin >> N >> Q;
	string S; cin >> S;
	c[0]=0;
	for(int i=1; i<N; ++i){
	    if(S.substr(i-1, 2)=="AC") c[i]=c[i-1]+1;
	    else c[i]=c[i-1];
	}
	for(int i=0; i<Q; ++i){
	    int l, r; cin >> l >> r;
	    cout << c[r-1]-c[l-1] << endl;
	}
	return 0;
}


Measured memory_bytes: 1408
#define _USE_NATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
#include <random>
#include <tuple>

using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
#define EPS 1e-9
const int INF = 1e9;
const ll MOD = 1e9 + 7;
const int MINF = -1e9;



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

	tuple<int, int,int> t[100010];
	rep(i, m) {
		int p, y;
		cin >> p >> y;
		t[i] = make_tuple(y,p,i);
	}
	sort(t, t+m);
	
	int cnt[100010];
	
	fill(cnt, cnt + n + 1, 0);

	pair<int, int> id[100010];

	rep(i, m) {
		int y, p, idx;
		tie(y, p, idx) = t[i];
		++cnt[p];
		id[idx] = make_pair(p, cnt[p]);
	}

	rep(i, m) {
		cout << setw(6) << setfill('0') << id[i].first;
		cout << setw(6) << setfill('0') << id[i].second << endl;
	}


	return 0;
}


Measured memory_bytes: 3840
#![allow(non_snake_case)]

use std::io::{stdin, Read};
use std::str::FromStr;
fn read_option<T: FromStr>() -> Option<T> {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok()
}
fn read<T: FromStr>() -> T {
    let opt = read_option();
    opt.expect("failed to parse token")
}

fn main() {
    let a: usize = read();
    let b: usize = read();
    let ans: String = if a < b {
        std::iter::repeat(a.to_string()).take(b).collect()
    } else {
        std::iter::repeat(b.to_string()).take(a).collect()
    };
    println!("{}", ans);
}


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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  string N;
  cin >> N;
  int s = N.size();
  bool flag = true;
  for(int i = 0; i <= s / 2; i++) {
    if(N[i] != N[s - 1 - i]) {
      flag = false;
      break;
    }
  }
  if(flag)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;

  return 0;
}

Measured memory_bytes: 256
for _ in range(int(input())):
    hour, minute = [int(item) for item in input().split(":")]
    angle1 = hour * 5 * 6 + minute * 0.5
    angle2 = minute * 6

    subtract = min(abs(angle1 - angle2), 360 - abs(angle1 - angle2))

    if subtract < 30.0:
        print("alert")
    elif 90.0 <= subtract:
        print("safe")
    else:
        print("warning")



Measured memory_bytes: 5616
n = int(raw_input())
ais,res = [0] + map(int, raw_input().split()) ,[0 for _ in range(n +1)]
for u in range(n, 0, -1):
	c,cumul = u,0
	while(c <= n):
		cumul += res[c]
		c += u
	if ais[u] != (cumul % 2):  res[u] = 1
s = sum(res)
print s
if s: print ' '.join([str(i) for i in range(len(res)) if res[i] == 1])

Measured memory_bytes: 56152
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
#define rep1(i,N) for(int i=1;i<int(N);++i)
#define all(a) (a).begin(),(a).end()
#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }
#define printpair(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<"{"<<_.first<<","<<_.second<<"}"<<", "; cerr<<"]"<<endl; }
#define dump(x) cerr<<#x<<": "<<x<<endl;
#define bit(k) (1LL<<(k))
#define Yes "Yes"
#define No "No"
#define YES "YES"
#define NO "NO"
typedef long long ll;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;
template< typename T1, typename T2 >
ostream &operator<<(ostream &os, const pair< T1, T2 >& p) {
  os << "{" <<p.first << ", " << p.second << "}";
  return os;
}
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

const int INF = (ll)1e9;
const ll INFLL = (ll)1e18+1;
const ll MOD = (ll)1e9+7;
const double PI = acos(-1.0);
/*
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const string dir = "DRUL";
*/

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    string S;
    cin >> S;
    reverse(all(S));
    int N = S.size();
    string a[] = {"maerd", "remaerd", "esare", "resare"};
    for(int i = 0; i < N;){
        bool ok = false;
        rep(j,4){
            int sz = a[j].size();
            if(S.substr(i, sz) == a[j]){
                i += sz;
                ok = true;
                break;
            }
        }
        if(!ok){
            cout << "NO" << endl;
            return 0;
        }
    }
    cout <<"YES" << endl;
}

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

void main_()
{
    int N, K;
    vector<int> hs;
    cin >> N >> K;
    copy_n(istream_iterator<int>(cin), N, back_inserter(hs));
    sort(begin(hs), end(hs));
    vector<int> h_diffs;
    transform(
        begin(hs), end(hs) - K + 1,
        begin(hs) + K - 1,
        back_inserter(h_diffs),
        [](int a, int b) { return b - a; });

    cout << *min_element(begin(h_diffs), end(h_diffs)) << endl;
}
int main()
{
    cin.tie(nullptr);
    cout.tie(nullptr);
    ios_base::sync_with_stdio(false);
    main_();
    return 0;
}


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

#define Fast cin.tie(0), ios::sync_with_stdio(0)
#define All(x) x.begin(), x.end()
#define louisfghbvc int t; cin >> t; while(t--)
#define sz(x) (int)(x).size()
using namespace std;
typedef long long LL;
typedef pair<LL, LL> ii;
typedef vector<LL> vi;

template<typename T> istream& operator>>(istream &is, vector<T> &v) { for(auto &it : v) is >> it; return is; }
template<typename T> ostream& operator<<(ostream &os, const vector<T> &v) { os << '{'; string sep = ""; for(const auto &x : v) os << sep << x, sep = ", "; return os << '}'; }
template<typename A, typename B> ostream& operator<<(ostream &os, const pair<A, B> &p) { return os << '(' << p.first << ", " << p.second << ')'; }

void dbg_out() { cerr << "\n"; }
template<typename Head, typename... Tail> void dbg_out(Head H, Tail... T) { cerr << ' ' << H; dbg_out(T...); }

const int mod = 1e9+7;
const int N = 22;
bool g[N][N];
LL dp[N][1<<N];

void solve(){
    int n;
    cin >> n;
    for(int i = 1; i <= n; ++i)
        for(int j = 0; j < n; ++j)
            cin >> g[i][j];

    memset(dp, 0, sizeof dp);
    dp[0][0] = 1;
    for(int i = 1; i <= n; ++i){
        for(int mask = 0; mask < (1<<n); ++mask){
            int cnt_woman = __builtin_popcount(mask);
            if(cnt_woman != i) continue;
            for(int j = 0; j < n; ++j){
                if(g[i][j] && (mask&(1<<j))){
                    int m2 = mask^(1<<j);
                    dp[i][mask] += dp[i-1][m2];
                    dp[i][mask] %= mod;
                }
            }
        }
    }
    cout << dp[n][(1<<n)-1] << "\n";
}

int main()
{
    Fast;
    //louisfghbvc{
        solve();
    //}
    return 0;
}


Measured memory_bytes: 724528
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//typedef pair<ll, pair<ll, ll> > P;
typedef pair<ll, ll> P;
typedef pair<int, int> i_i;

#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define REP(i,n) reps(i,0,n)
#define ALL(v) v.begin(), v.end()
#define SZ(x) ((int)((x).size()))

const double PI  = acos(-1.0);
const double EPS = 1e-9;
const ll INF = 1e15+10;
const ll mod = 1e9+7;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
#define print(x) cerr << #x << " is " << x << endl;

ll A[200000], B[200000];
map<int, int> M;

int main() {
    ll N;
    
    cin >> N;
    rep(i, N){
        cin >> A[i];
        B[i] = A[i] + N - 1 - i;
        M[B[i]]++;
    }
    ll ans = 0;
    rep(i, N){
        
        M[B[i]]--;
        //fprintf(stderr, "i = %d, A = %d, B = %d, M[3] = %d\n", i, A[i], B[i], M[3]);
        ans += M[N - 1 - i - A[i]];
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 23680
a,b,c=map(int, input().split())
k = int(input())
magic = 0
while a >= b:
  b = b * 2
  magic = magic + 1
while b >= c:
  c = c * 2
  magic = magic + 1
if magic <= k:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 9176
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors[-1]


N = int(input())
a = make_divisors(N)
b = N // a

print(a + b - 2)

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

using namespace std;
using ll = long long;
using ld = long double;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define reps(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
const ll mod = 1e9 + 7;
const ll INF = 10000000000;

int main() {
	cin.sync_with_stdio(false);
	ll x, y;
	cin >> x >> y;
	if (x%y == 0) {
		cout << -1 << endl;
		return 0;
	}
	cout << x*(y - 1) << endl;
	return 0;
	return 0;
}


Measured memory_bytes: 764
import java.util.*;
 
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
        
        int n = sc.nextInt();
        int k = sc.nextInt();
        int h[] = new int[n];

        for (int i = 0; i < n; i++) {
            h[i] = sc.nextInt();
        }

        int count = 0;

        for (int i = 0; i < n; i++) {
            if (h[i] >= k) {
                count++;
            }
        }

        System.out.println(count);
	}
}


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

using namespace std;

#define pb push_back
#define mp make_pair
#define F first
#define S second

#define fo(i, n) for(int i = 1; i <= n; ++i)
#define rep(i, a, b) for(int (i) = (a); (i) < (b); ++(i))

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

const int N = 200200;
const int mod = 1e9 + 7;
const ll INF = 1e18;
int n,c,k,t[N];
int bus;

int main()
{
	ios::sync_with_stdio(0); cin.tie(0);
	cin>>n>>c>>k;
	fo(i,n)
		cin>>t[i];
	sort(t+1,t+n+1);
	for(int i=1;i<=n;)
	{
		int j=i;
		int can=c-1;
		while(j+1<=n&&t[j+1]<=t[i]+k&&can)
			j++,can--;
		bus++;
		i=j+1;
	}
	cout<<bus;
	return 0;	
}

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

#define ll long long

using namespace std;

ll combi(int n){
    if(n < 1) return 1;
    if(n == 1) return 2;
    if(n == 2) return 3;
    return combi(n - 1) + combi(n - 2);
}

int main(){
    int h,w,k;
    cin >> h >> w >> k;

    vector<vector<ll>> down;
    vector<vector<ll>> right;
    vector<vector<ll>> left;

    vector<ll> tmpv;
    tmpv.push_back(1);
    for(int i = 0; i < w - 1; i++) tmpv.push_back(0);
    down.push_back(tmpv);

    if(w != 1){

        for(int i = 0; i < h; i++){
            vector<ll> tmpr;
            vector<ll> tmpl;

            for(int j = 0; j < w - 1; j++){
                tmpr.push_back((down[i])[j]);
                tmpl.push_back((down[i])[j + 1]);
            }

            right.push_back(tmpr);
            left.push_back(tmpl);

            vector<ll> tmpv;
            tmpv.push_back((down[i][0] * combi(w - 2) + left[i][0] * combi(w - 3)) % 1000000007);
            for(int j = 0; j < w - 2; j++) tmpv.push_back((down[i][j + 1] * combi(j) * combi(w - j - 3) + right[i][j] * combi(j - 1) * combi(w - 3 - j) + left[i][j + 1] * combi(j) * combi(w - j - 4)) % 1000000007);
            tmpv.push_back((down[i][w - 1] * combi(w - 2) + right[i][w - 2] * combi(w - 3)) % 1000000007);

            down.push_back(tmpv);

        }

        cout << down[h][k - 1] << endl;

    }else cout << 1 << endl;

    return 0;
}

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

int main() {
    vector<int> A(3);
    for(auto &e : A) cin >> e;
    sort(A.begin(), A.end());
    int ans = 0;
    int dif = A[2] - A[1];
    ans += dif;
    dif = A[1] - A[0];
    ans += (dif + 1) / 2 + dif % 2;
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <set>
#include <map>
#include <algorithm>

#define int long long
#define MOD7 1000000007
#define MOD9 1000000009

#define rep(i, n) for (int i = 0; i < (n); i++)
#define REP(i, a, n) for (int i = (a); i <= (n); i++)
#define all(a) (a).begin(), (a).end()

using namespace std;

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

int nextInt() {int a; cin >> a; return a;}
char nextChar() {char a; cin >> a; return a;}
double nextDouble() {double a; cin >> a; return a;}
string nextString() {string a; cin >> a; return a;}

template<class T> void inputVector(vector<T>& v, int n) {
    v.resize(n);
    for (int i = 0; i < v.size(); i++) cin >> v[i];
}

signed main() {
    int K, S;
    cin >> K >> S;

    int ret = 0;

    rep(X, K + 1) {
	int T = S - X;
	rep(Y, min(K + 1, T + 1)) {
	    if (T - Y <= K) ret++;
	}
    }

    cout << ret << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <cstring>
#include <functional>
#include <cmath>
#include <complex>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
#define rep1(i,n) for(int i=1;i<=(n);++i)
#define all(c) (c).begin(),(c).end()
#define fs first
#define sc second
#define pb push_back
#define show(x) cout << #x << " " << x << endl
typedef long double D;
typedef pair<int,int> P;
typedef pair<D,P> E;
int N;
D a[200],b[200],c[200],d[200],e[200],f[200],g[200],h[200],en[200],eps=1e-7,ans[200];
bool is[200];
vector<E> es;
D s(D x){return x*x;}
void renew(int i,int j,D x){
	if(0<x&&x<en[i]&&x<en[j]){
		es.pb(E(x,P(i,j)));
	}
}
void fix(D &x){
	if(abs(x)<eps) x=0;
}
int main(){
	while(true){
		cin>>N;
		if(N==0) break;
		es.clear();
		rep(i,N) is[i]=1;
		rep(i,N) cin>>a[i]>>b[i]>>c[i]>>d[i]>>e[i]>>f[i]>>g[i]>>h[i];
		rep(i,N) en[i]=g[i]/h[i];
		rep(i,N) es.pb(E(en[i],P(i,i)));
		rep(i,N) rep(j,i){
			D A=s(d[i]-d[j])+s(e[i]-e[j])+s(f[i]-f[j]);
			D B=2*((d[i]-d[j])*(a[i]-a[j])+(e[i]-e[j])*(b[i]-b[j])+(f[i]-f[j])*(c[i]-c[j]));
			D C=s(a[i]-a[j])+s(b[i]-b[j])+s(c[i]-c[j]);
			A-=s(h[i]+h[j]);
			B+=2*(h[i]+h[j])*(g[i]+g[j]);
			C-=s(g[i]+g[j]);
			fix(A);
			fix(B);
			fix(C);
			if(A==0){
				if(B==0) continue;
				renew(i,j,-C/B);
			}else{
				D D=B*B-4*A*C;
				fix(D);
				if(D<0) continue;
				renew(i,j,(-B+sqrt(D))/(2*A));
				renew(i,j,(-B-sqrt(D))/(2*A));
			}
		}
		sort(all(es));
		rep(i,es.size()){
			if(!is[es[i].sc.fs]||!is[es[i].sc.sc]) continue;
			ans[es[i].sc.fs]=ans[es[i].sc.sc]=es[i].fs;
			is[es[i].sc.fs]=is[es[i].sc.sc]=0;
		}
		rep(i,N) printf("%.12f\n",(double)ans[i]);
	}
}

Measured memory_bytes: 1380
n,y = map(int,input().split())

for i in range(n+1):
    for j in range(n+1-i):
        k = n - i - j
        if (10000*i + 5000*j + 1000*k == y) and (i + j + k == n):
            print(i,j,k)
            exit()
print('-1 -1 -1')

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

int main() {
  int N, l, r, M;
  cin >> N;
  M = 0;
  for (int i = 0; i < N; i++) {
    cin >> l >> r;
    M = M + (r - l + 1);
  }
  cout << M << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
typedef long long LL;
typedef pair<int, int> pii;
 
#define fst first
#define snd second
#define pb push_back
#define REP(i, a, b)  for(int i = (a), i##end = (b); i < i##end; ++i)
#define DREP(i, a, b) for(int i=(a-1), i##end = (b); i >=i##end; --i)
 
template <typename T> bool chkmax(T& a, T b) { return a < b ? a = b, 1 : 0; }
template <typename T> bool chkmin(T& a, T b) { return a > b ? a = b, 1 : 0; }
 
const int oo = 0x3f3f3f3f;
const int maxn = 100000 + 5;
 
template<typename T> T read() {
    T n(0), f(1);
    char ch = getchar();
    for( ;!isdigit(ch); ch = getchar()) if(ch == '-') f = -1;
    for( ; isdigit(ch); ch = getchar()) n = n * 10 + ch - 48; 
    return n * f;
}

int n, k, flag;
int A[maxn], B[maxn];

int main() {
#ifdef Wearry
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
#endif 

    n = read<int>(); k = read<int>(); 
    for(int i = 1; i <= n; ++i) A[i] = read<int>(), B[i] = read<int>();

    flag = -1;
    for(int len = 0; len <= 29; ++len) if(k >> len & 1) {
        flag = len;
    }

    LL ans = 0;
    for(int i = 1; i <= n; ++i) if((k & A[i]) == A[i]) ans += B[i];

    for(int i = 0; i <= 29; ++i) if(k >> i & 1) {

        LL res = 0;
        for(int j = 1; j <= n; ++j) if(!(A[j] >> i & 1)) {
            if(((k >> i) & (A[j] >> i)) == (A[j] >> i)) res += B[j];
        }
        chkmax(ans, res);
    }
    printf("%lld\n", ans);

    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, A, B;
  cin >> N >> A;
 
  B = N-(N/500)*500;
  
  if (A >= B) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

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

// c.cpp
// author: Seong Yong-ju ( @sei40kr )
// Copyright (c) 2017 Seong Yong-ju

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

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

using namespace std;

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

  int a, b, c, d, e, f;
  cin >> a >> b >> c >> d >> e >> f;

  double m = -1;
  tuple<int, int> ans;
  FOR(p, 1, 31) {
    REP(q, 31) {
      int vw = (a * p + b * q) * 100;
      if (f < vw) {
        break;
      }
      REP(s, 3000) {
        REP(t, 3000) {
          int vs = c * s + d * t;
          if (f < vw + vs || vw / 100 * e < vs) {
            break;
          }
          double r = (double) vs / (vw + vs);
          if (m < r) {
            m = r;
            ans = make_tuple(vw, vs);
          }
        }
      }
    }
  }

  int vw, vs;
  tie(vw, vs) = ans;
  cout << (vw + vs) << ' ' << vs << endl;
}


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

void _main() {
    int N, M;
    while (cin >> N >> M, N) {
        vector<int> lb(N, 0), ub(N, 0);
        REP (i, M) {
            int S, k;
            cin >> S >> k;
            REP (j, k) {
                int c;
                cin >> c;
                c--;
                if (k == 1) lb[c] += S;
                ub[c] += S;
            }
        }
        int ans = 0;
        REP (i, N) REP (j, N) if (j != i) {
            ans = max(ans, ub[j] - lb[i] + 1);
        }
        cout << ans << endl;
    }
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(10);
    _main();
    return 0;
}


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

const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
inline bool valid(int x, int w) { return 0 <= x && x < w; }

void iostream_init() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.setf(ios::fixed);
    cout.precision(12);
}

class Knapsack {
    typedef long long LL;
    struct item {
        LL v, w;
    };

    LL W;
    vector<item> items;
    LL lv;

    LL solve_rec(size_t k, LL v, LL w) {
        if (w + items[k].w > W) return solve_rec(k+1, v, w);
        LL cv = v, cw = w;
        for (size_t i = k; i < items.size(); ++i) {
            if (cw + items[i].w <= W) {
                cw += items[i].w;
                cv += items[i].v;
            }
        }
        if (lv < cv) lv = cv;
        double fv = v, fw = w;
        for (size_t i = k; i < items.size(); ++i) {
            if (fw + items[i].w <= W) {
                fw += items[i].w;
                fv += items[i].v;
            } else {
                fv += items[i].v * (W - fw) / items[i].w;
                break;
            }
        }
        if (fv - lv < 1 || fv < lv) return lv;
        solve_rec(k+1, v+items[k].v, w+items[k].w);
        return solve_rec(k+1, v, w);
    }

    public:
    // 価値v, 重みwのアイテムを追加
    void add_item(LL v, LL w) {
        items.push_back({v, w});
    }

    // 重みの合計がW以下になるようにアイテムを選んだときの価値の和の最大値を返す．
    LL solve(LL W_) {
        if(items.empty()) return 0;
        W = W_;
        sort(items.begin(), items.end(), [](const item &a, const item &b) {
                return a.v * b.w > a.w * b.v;
                });
        lv = 0;
        return solve_rec(0, 0, 0);
    };
};

int main(){
    iostream_init();
    int N, W;
    cin >> N >> W;
    Knapsack dp;
    for (int i = 0; i < N; i++) {
        int w, v;
        cin >> w >> v;
        dp.add_item(v, w);
    }

    cout << dp.solve(W) << endl;
    return 0;
}



Measured memory_bytes: 256
using System;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            switch (Console.ReadLine())
            {
                case "A":
                    Console.WriteLine("T");
                    break;
                case "C":
                    Console.WriteLine("G");
                    break;
                case "G":
                    Console.WriteLine("C");
                    break;
                case "T":
                    Console.WriteLine("A");
                    break;
            }
        }
    }
}


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

int main(){
    int d,n;
    int count=1;
    cin >> d >> n;
    int num=pow(100,d);
    if(n==100) cout << num*101 << endl;
    else cout << num*n << endl;
    return 0; 

}

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

using namespace std;
using Int = long long int;
using UInt = unsigned long long int;
using VI = vector<long long int>;
using VVI = vector<vector<long long int> >;

// 二つの値の最大値を求める関数
Int Max(const Int a, const Int b) {
    if (a >= b) {
        return a;
    } else {
        return b;
    }
}

int main(void) {
    Int n;
    cin >> n;
    vector<Int> h(n);
    for (Int i = 0; i < n; ++i) {
        cin >> h[i];
    }
    vector<Int> CanMove(n);
    for (Int i = 0; i < n - 1; ++i) {
        if (h[i] >= h[i + 1]) {
            CanMove[i] = 1;
        } else {
            CanMove[i] = 0;
        }
    }
    CanMove[n - 1] = 0;
    Int maxMove = 0;
    Int tempMove = 0;
    for (Int i = 0; i < n - 1; ++i) {
        if (CanMove[i] == 1) {
            tempMove++;
            maxMove = Max(maxMove, tempMove);
        } else {
            tempMove = 0;
        }
    }
    cout << maxMove << endl;
    return 0;
}


Measured memory_bytes: 4768