akhauriyash/Code-Regression huggingface dataset:
c=(1..3).map{gets.split.map &:to_i}
b0, b1, b2=(0..2).map{|i|c[0][i]}

puts (1..2).any?{|i|
    x, y, z=b0-c[i][0], b1-c[i][1], b2-c[i][2]
    x!=y || y!=z || z!=x
} ? :No : :Yes

Measured memory_bytes: 1788
#include <stdio.h>
#include <string.h>

int main()
{
	int cnt = 0;
	char s[200001], t[200001];
	scanf("%s", s);
	scanf("%s", t);
	for(int i = 0; i < strlen(s); i++){
		if(s[i] != t[i]){
			cnt++;
		}
	}

	printf("%d", cnt);
}


Measured memory_bytes: 2080
#include<bits/stdc++.h>
#define mt make_tuple
#define mp make_pair
#define pu push_back
#define INF 1000000001
#define MOD 1000000007
#define EPS 1e-6
#define ll long long int
#define ld long double
#define fi first
#define se second
#define all(v) v.begin(),v.end()
#define pr(v) { for(int i=0;i<v.size();i++) { v[i]==INF? cout<<"INF " : cout<<v[i]<<" "; } cout<<endl;}
#define t1(x)                cerr<<#x<<" : "<<x<<endl
#define t2(x, y)             cerr<<#x<<" : "<<x<<" "<<#y<<" : "<<y<<endl
#define t3(x, y, z)          cerr<<#x<<" : " <<x<<" "<<#y<<" : "<<y<<" "<<#z<<" : "<<z<<endl
#define t4(a,b,c,d)          cerr<<#a<<" : "<<a<<" "<<#b<<" : "<<b<<" "<<#c<<" : "<<c<<" "<<#d<<" : "<<d<<endl
#define t5(a,b,c,d,e)          cerr<<#a<<" : "<<a<<" "<<#b<<" : "<<b<<" "<<#c<<" : "<<c<<" "<<#d<<" : "<<d<<" "<<#e<<" : "<<e<<endl
#define t6(a,b,c,d,e,f)          cerr<<#a<<" : "<<a<<" "<<#b<<" : "<<b<<" "<<#c<<" : "<<c<<" "<<#d<<" : "<<d<<" "<<#e<<" : "<<e<<" "<<#f<<" : "<<f<<endl
#define GET_MACRO(_1,_2,_3,_4,_5,_6,NAME,...) NAME
#define t(...) GET_MACRO(__VA_ARGS__,t6,t5, t4, t3, t2, t1)(__VA_ARGS__)
#define _ cerr<<"here"<<endl;
#define __ {ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);}

using namespace std;
template<class A, class B> ostream& operator<<(ostream& out, const pair<A, B> &a){ return out<<"("<<a.first<<", "<<a.second<<")";}
template <int> ostream& operator<<(ostream& os, const vector<int>& v) { os << "["; for (int i = 0; i < v.size(); ++i) { if(v[i]!=INF) os << v[i]; else os << "INF";if (i != v.size() - 1) os << ", "; } os << "]\n"; return os; } 
template <typename T> ostream& operator<<(ostream& os, const vector<T>& v) { os << "["; for (int i = 0; i < v.size(); ++i) { os << v[i]; ;if (i != v.size() - 1) os << ", "; } os << "]\n"; return os; } 

ll min(ll x, ll y)
{
  if(x<y) return x;
  return y;
}

ll max(ll x, ll y)
{
  if(x>y) return x;
  return y;
}

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

  ll k1 = a, k2 = b;
  if((a-b)%2 == 0) cout << abs((a-b))/2 << endl;
  else
  {
    // Go to 1
    ll min1 = 1e18;
    // a goes to 1
    ll t = 0;
    t += a-1;
    b -= a;
    t++;
    t += (b-1)/2;

    min1 = min(min1,t);

    // b goes to n, waits for a match

    a = k1;
    b = k2;
    t = 0;
    t = n-b;
    // t(a);
    a += (n-b);
    // t(a,n,b);
    a++;
    // t(a,t);
    t++;
    t += (n-a)/2;

    min1 = min(min1,t);

    cout << min1 << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include<cmath>
using namespace std;
int main(void){
    // Your code here!
   long long n,a,b, ans=0;
   cin>>n;
   
   cin>>a;
   n--;
   
   while(n--){
       cin>>b;
       if(b<a){
           ans+=(a-b);
       }else
            a=b;
   }
   cout<<ans;
   
}


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

int main(){
    int arr[20];
    for(int x = 0; x < 20; ++x){
        scanf("%d", arr+x);
    }
    sort(arr,  arr+10, greater<int>());
    sort(arr+10,  arr+20, greater<int>());
    printf("%d %d\n",  arr[0]+arr[1]+arr[2], arr[10]+arr[11]+arr[12]);
    return 0;
}

Measured memory_bytes: 1204
#include <iostream>
#include <vector>
#include <string>
#include <cstdlib>
#include<algorithm> 
#include <iomanip>

#define db double
#define vi vector<int>
#define pb push_back
#define fi first
#define se second
#define ll long long
#define maxn 5005
#define mod 998244353
using namespace std;


int main(){

 int n;
unsigned ll int x=1;
cin>>n;
//unsigned ll int op;
vector<unsigned ll int>sin(n);
for(int j=0;j<n;j++){
    cin>>sin.at(j);
    //cout<<op<<endl;
    if(sin.at(j)==0){
        cout<<"0"<<endl;
        return 0;
    }

}
sort(sin.begin(),sin.end());

for(int i=0;i<n;i++){
    
//unsigned ll int a=0;

//cin>>a;
//cout<<a<<endl;
if(x>=1000000000000000000)break;
unsigned ll hu=x;
x*=sin.at(i);
if(hu!=x/sin.at(i)){
    cout<<"-1"<<endl;
        return 0;
}

}

if(x>1000000000000000000)cout<<"-1"<<endl;
else cout<<x<<endl;



}

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

int to_i(string s){
  int ret = 0;
  for(int i = 0 ; i < s.size() ; i ++)
    ret = ret * 10 + s[i] - '0';
  return ret;
}

long long return_words(string s){
  int sm=0,l=0;
  int arys[10] = {0}, aryl[10] = {0};
  for(int i = 0 ; i < s.size(); i ++){
    arys[s[i]-'0']++;aryl[s[i]-'0']++;
  }
  for(int i = 0 ; i < 10 ; i ++){
    while(arys[i]){
      sm = sm * 10 + i;
      arys[i]--;
    }
    while(aryl[9-i]){
      l = l * 10 + 9-i;
      aryl[9-i]--;
    }
  }
  return l-sm;
}

string to_s(long long n){
  string ret = "";
  while(n){
    ret += char(n%10 + '0');
    n/=10;
  }
  reverse(ret.begin(),ret.end());
  return ret;
}
int main(void){
  string n;
  int t;
  unsigned long long ary[25] = {0};
  while(cin>>n>>t,t){
  int begin,min=1e9,length;
  ary[0] = to_i(n);
  for(int i = 0 ; i < 21 ; i ++){
    while(n.size()<t)n+="0";

    ary[i+1] = return_words(n);
    n = to_s(return_words(n));
  
  }
  int ii = 1e9,jj,ai;
  bool find = false;
  for(int i = 0 ; i < 21 ; i ++){
    for(int j = i+1 ; j < 21 ; j ++){
      if(ary[i] == ary[j] && i != j){
	if(ii > i){
	  ii = i;
	  jj = j;
	  ai = ary[i];
	}
      }
    }
  }
  //  if(ary[0] == ary[1])cout<<0<<" "<<ai<<" "<<abs(ii-jj)<<endl;
  cout<<ii<<" "<<ai<<" "<<abs(ii-jj)<<endl;
  }
}

Measured memory_bytes: 1216
import numpy as np

a, b = map(int, input().split())

def get_gcd(a, b):
  while b:
    a, b = b, a%b
  return a

GCD = get_gcd(a,b)

def sep_prime(n):
  res = list()
  for i in range(1, int(n**0.5)+1):
    if n%i == 0:
      res.append(i)
      if i*i != n:
        res.append(n//i)
  return res

primes = sorted(sep_prime(GCD))

def is_prime(n):
  if n==1:
    return True
  for i in range(2, int(n**0.5)+1):
    if n%i == 0:
      return False
  return True

# judge
count = 0
for p in primes:
  if is_prime(p):
    count += 1

print(count)


Measured memory_bytes: 12580
using System;
using System.Collections.Generic;
using System.IO.Pipes;
using System.Linq;
using System.Numerics;
using System.Threading;

namespace Atcoder
{
	class Program
	{
		//string s = Console.ReadLine();
		//int[] intArray = Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();
		//int H = intArray[0];
		//int W = intArray[1];
		//int N = int.Parse(Console.ReadLine());
		//List<int> A = new List<int>(Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray());
		//Boolean ok = false;

		//Console.WriteLine(ans);
		//Console.WriteLine("Yes");
		//Console.WriteLine("No");
		//Console.ReadKey();
		//Console.WriteLine(cnt);

		//string[] strArray = Console.ReadLine().Split(' ').ToArray();
		//string S = strArray[0];
		//string T = strArray[1];
		static void Main(string[] args)
		{
			int[] AB = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
			int A = AB[0];
			int B = AB[1];
			string sa = "";
			string sb = "";

			for (int i = 0; i < B; i++)
				sa += A + "";
			for (int i = 0; i < A; i++)
				sb += B + "";

			if (sa.CompareTo(sb) == -1)
				Console.WriteLine(sa);
			else
				Console.WriteLine(sb);
		}

		/// <summary>
		/// 回文
		/// </summary>
		/// <param name="Target"></param>
		/// <param name="len"></param>
		/// <returns></returns>
		static bool Palindrome(string Target , int len)
        {
			bool yes = true;

			for(int i = 0;i < len; i++)
            {
				if(Target[i] != Target[len - 1 - i])
                {
					yes = false;
					break;
                }
            }
			return yes;
        }

		/// <summary>
		/// アナグラム
		/// </summary>
		/// <param name="word1"></param>
		/// <param name="word2"></param>
		/// <returns></returns>
		static bool IsAnagramOf(string word1, string word2)
		{
			return word1.OrderBy(x => x).SequenceEqual(word2.OrderBy(x => x));
		}
		/// <summary>
		/// 最小公倍数
		/// </summary>
		/// <param name="a"></param>
		/// <param name="b"></param>
		/// <returns></returns>
		public static BigInteger Lcm(BigInteger a, BigInteger b)
		{
			return a * b / Gcd(a, b);
		}

		/// <summary>
		/// 最大公約数
		/// </summary>
		/// <param name="a"></param>
		/// <param name="b"></param>
		/// <returns></returns>
		public static BigInteger Gcd(BigInteger a, BigInteger b)
		{
			if (a < b)
				// 引数を入替えて自分を呼び出す
				return Gcd(b, a);
			while (b != 0)
			{
				var remainder = a % b;
				a = b;
				b = remainder;
			}
			return a;
		}
	}
}

Measured memory_bytes: 28496
import Control.Monad

main :: IO ()
main = do
  cs <- replicateM 3 $ map read . words <$> getLine
  let a1 = 0
  let b1 = (cs !! 0) !! 0 - a1
  let a2 = (cs !! 1) !! 0 - b1
  let b2 = (cs !! 0) !! 1 - a1
  let a3 = (cs !! 2) !! 0 - b1
  let b3 = (cs !! 0) !! 2 - a1
  let as = [a1, a2, a3]
  let bs = [b1, b2, b3]
  let res = all (==True) [(cs !! i) !! j == as !! i + bs !! j | i <- [0..2], j <- [0..2]]
  putStrLn $ if res then "Yes" else "No"

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

int main(void)
{
	int x,y,z,a,b,c;
	char s[4];
	scanf("%s",s);
	y = 700;
	for(x=0;x<3;x++) if (s[x] == 'o') y+=100;
	printf("%d",y);
	return 0;
}


Measured memory_bytes: 128
using System;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{
		string[] str = Console.ReadLine().Split();
		long N = long.Parse(str[0]);
		long A = long.Parse(str[1]);
		long B = long.Parse(str[2]);
		long ans = N/(A+B)*A+Math.Min(A,N%(A+B));
		Console.WriteLine(ans);
	}
}

Measured memory_bytes: 13140
n,m=map(int,input().split())
dic=[]
ans=[]
number=[1] * (10**5+2)

for i in range(m):
    p,y=map(int,input().split())
    dic.append((p,y,i))

dic.sort(key=lambda x:x[1])

for i in range(m):
    tmp=str(dic[i][0]).zfill(6)+str(number[dic[i][0]]).zfill(6)
    number[dic[i][0]]+=1
    ans.append((tmp,dic[i][2]))

ans.sort(key=lambda x:x[1])

for i in range(m):
    print(ans[i][0])


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

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n;
  cin >> n;
  vector<int> a(n);

  rep(i,n) cin >> a[i];
  vector<int> ok(1000010, 0);
  int g = a[0];
  for (int i = 1; i < n; i++) g = __gcd(g, a[i]);
  for (int i = 0; i < n; i++) ok[a[i]]++;
  int res = 1;

  for (int i = 2; i <= 1000000; i++) {
    int cnt = 0;
    for (int j = i; j <= 1000000; j += i) cnt += ok[j];
    if (cnt >= 2) res = 0;
  }

  if (res) cout << "pairwise coprime" << endl;
  else if (g == 1) cout << "setwise coprime" << endl;
  else cout << "not coprime" << endl;
  return 0;
}


Measured memory_bytes: 11056
#include <iostream>
#include <vector>
#include <array>
#include <algorithm>
using namespace std;

int main(void){
    int N, count, max;
    vector<int> H;
    cin >> N;
    for(int i=0; i < N; i++){
      	int a;
      	cin >> a;
        H.push_back(a);
    }
    
    max = 0;
    count = 0;
    for(int i=0; i<N; i++){
        if(max <= H[i]){
            count++;
            max = H[i];
        }
    }
    cout << count << endl;
}

Measured memory_bytes: 256
#include<stack>
#include<map>
#include<set>
#include<cstdio>
#include<vector>
#include<iostream>
#include<string>
#include<algorithm> 
using namespace std;
int main(){
	int a,b,k;
	cin>>a>>b>>k;
	set<int> st;
	for(int i=a;(i<k+a && i<=b);i++){
		st.insert(i);
	}
	for(int i=b;(i>b-k && i>=a);i--){
		st.insert(i);
	}
	for(set<int>::iterator it = st.begin(); it != st.end(); it++){  
        cout << *it << endl;  
    }
	return 0;
}

Measured memory_bytes: 256
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map.Entry;
import java.util.Scanner;
import java.util.stream.Collectors;
import java.util.stream.IntStream;

public class Main{
	static final Scanner s=new Scanner(System.in);
	static int getInt(){
		return Integer.parseInt(s.next());
	}
	static IntStream REPS(int l){
		return IntStream.range(0,l);
	}
	public static void main(String[] __){
		HashMap<Character,Integer> hm=new HashMap<>(26);
		while(true){
			hm.clear();
			boolean f=false;
			int n=getInt();
			if(n==0) return;
			for(int i=n-1;i>=0;i--){
				if(!f){
					hm.merge(
							s.next().charAt(0),
							1,
							Integer::sum);
					List<Entry<Character,Integer>> hoge=hm.entrySet().stream()
							.sorted(Entry.comparingByValue(Comparator.reverseOrder()))
							.limit(2)
							.collect(Collectors.toList());
					Entry<Character,Integer> e=hoge.get(0);
					if((hoge.size()==1&&e.getValue()>i)||
							(hoge.size()>1&&e.getValue()>hoge.get(1).getValue()+i)){
						System.out.println(e.getKey()+" "+(n-i));
						f=true;
					}
				}else{
					s.next();
				}
			}
			if(!f){
				System.out.println("TIE");
			}
		}
	}
}

Measured memory_bytes: 73436
def resolve():
    wd6 = [46656, 7776, 1296, 216, 36, 6, 1]
    wd9 = [59049, 6561, 729, 81, 9, 1]
    def div6(n):
        ans = 0
        for i in wd6:
            if i <= n:
                ans += n//i
                n %= i
        return ans

    def div9(n):
        ans = 0
        for j in wd9:
            if j <= n:
                ans += n // j
                n %= j
        return ans
    n = int(input())

    wd = []
    for k in range(n+1):
        wd.append(div6(k) + div9(n-k))
    print(min(wd))
resolve()

Measured memory_bytes: 47452
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define repone(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define Rep(j,n) for(int j=0;j<(int)(n);++j)
#define Repo(j,o,n) for(int j=o;j<(int)(n);++j)
#define Repone(j,n) for(int j=1;j<(int)(n);++j)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define int long long
#define pb(a) push_back(a)
#define eraser(v,i) (v).erase(v.begin()+(i))
#define pbpair(a,b) push_back(make_pair(a,b))
#define MOD 1000000007
const long long INF = 1LL<<60;
#define pairint pair<int,int>
signed main(){
  int x=0,y=0,z=0,w=0;
  string s;
  std::cin >> s;
  if(s[2]==s[3]&&s[4]==s[5])std::cout << "Yes" << '\n';
  else std::cout << "No" << '\n';
}


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
ll factorial(int i) {       //階乗
    if (i == 0) return 1;
    return (factorial(i - 1)) * i;
}

int main() { 
    int n;
    cin >> n;
    vector<string> s(n);
    rep(i, n) {
        string S;
        cin >> S;
        sort(S.begin(), S.end());
        s[i] = S;
    }
    sort(s.begin(), s.end());
    ll count;
    int j;
    ll ans = 0;
    rep(i, n) {
        count = 1;
        j = i + 1;
        while(s[i] == s[j]) {
            count++;
            j++;
        }
        ans += count * (count - 1) / 2;
        i = j - 1;
    }
    cout << ans << endl;
}

Measured memory_bytes: 6420
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <iomanip>
#define MOD 1000000007
#define pb push_back
#define ll long long
#define ld long double
using namespace std;

ll tree[800800];
int h[200200];
ll b[200200];
ll dp[200200];

void update(int idx, int l, int r, int pos, ll val) {
	if (l == r) {
		tree[idx] = val;
		//cout << "Updated idx: " << idx << endl;
	} else {
		int mid = (l + r) / 2;
		if (mid < pos) update(2 * idx + 2, mid + 1, r, pos, val);
		else update(2 * idx + 1, l, mid, pos, val);

		tree[idx] = max(tree[2 * idx + 1], tree[2 * idx + 2]);
	}
}

ll query(int idx, int l, int r, int tl, int tr) {
	if (l > r) return 0;
	if (l == tl && r == tr) {
		//cout << "Queried idx: " << idx << endl;
		return tree[idx];
	}

	int mid = (tl + tr) / 2;
	return max(query(2 * idx + 1, l, min(r, mid), tl, mid), query(2 * idx + 2, max(l, mid + 1), r, mid + 1, tr));
}

int main() {
	int n;
	cin >> n;
	
	int maxh = 0;
	for (int i = 0; i < n; i++) {
		cin >> h[i];
		maxh = max(h[i], maxh);
	}

	for (int i = 0; i < n; i++) cin >> b[i];

	for (int i = 0; i < n; i++) {
		//cout << "Query = " << query(0, 0, h[i] - 1, 0, maxh) << endl;
		dp[h[i]] = max(dp[h[i]], query(0, 0, h[i] - 1, 0, maxh) + b[i]);
		update(0, 0, maxh, h[i], dp[h[i]]);
		//cout << "i = " << i << " dp[i] = " << dp[h[i]] << endl;
	
		//cout << "Tree" << " ";
		//for (int i = 0; i < maxh * 4 + 4; i++) cout << tree[i] << " ";
		//cout << endl;
	}

	ll ans = 0;
	for (int i = 0; i <= n; i++) ans = max(ans, dp[h[i]]);

	cout << ans;

	return 0;
}

Measured memory_bytes: 8448
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func scanInt() int {
	sc.Scan()
	iv, _ := strconv.Atoi(sc.Text())
	return iv
}

func init() {
	sc.Split(bufio.ScanWords)
}

var graph map[int]map[int]bool

func initGraph(x int) {
	graph = make(map[int]map[int]bool, x)
}

func add(from, to int) {
	if _, ok := graph[from]; !ok {
		graph[from] = make(map[int]bool)
	}
	graph[from][to] = true
}

func main() {
	n, m := scanInt(), scanInt()
	h := make([]int, n)
	for i := range h {
		h[i] = scanInt()
	}

	initGraph(n)
	for i := 0; i < m; i++ {
		a, b := scanInt(), scanInt()
		add(a, b)
		add(b, a)
	}

	ans := 0
	for i := 0; i < n; i++ {
		isTop := true
		for k := range graph[i+1] {
			if h[k-1] >= h[i] {
				isTop = false
				break
			}
		}
		if isTop {
			ans++
		}
	}
	fmt.Println(ans)
}


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

int main() {
	int n;
	while( cin >> n ){
		for( int i = 0; n > 0; i++ ){
			if( n >> i & 1 ){
				n -= 1 << i;
				cout << (1 << i);
				if( n > 0 )
					cout << " ";
				else
					cout << endl;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 1164
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fst first
#define snd second
using namespace std;

typedef long long ll;
typedef double db;
typedef long double ldb;

template<class T> inline void checkmin(T &a,const T &b){if(b<a) a=b;}
template<class T> inline void checkmax(T &a,const T &b){if(b>a) a=b;}

const int inf=1e9+10;
const int maxn=2e5+10;

int dp[maxn],n,mx=0,k,c,l[maxn],r[maxn];
string s;

int main(){
	cin>>n>>k>>c>>s;
	for(int i=0;i<n;i++){
		if(s[i]=='o'){
			if(i-c>0) dp[i]=dp[i]+mx+1;
			else dp[i]=1; 
		}
		if(i-c>=0) mx=max(mx,dp[i-c]);
	}
	for(int i=0;i<maxn;i++) l[i]=inf;
	for(int i=0;i<n;i++) if(s[i]=='o'&&dp[i]<=k) 
		l[dp[i]]=min(i,l[dp[i]]);
	for(int i=0;i<maxn;i++) dp[i]=0; mx=0;
	for(int i=n-1;i>=0;i--){
		if(s[i]=='o'){
			if(i+c<n-1) dp[i]=dp[i]+mx+1;
			else dp[i]=1;
		}
		if(i+c<=n-1) mx=max(mx,dp[i+c]);
	}
	for(int i=0;i<n;i++) if(dp[i]<=k&&dp[i]>=1) 
		dp[i]=k-dp[i]+1;
	for(int i=0;i<maxn;i++) r[i]=0;
	for(int i=0;i<n;i++) if(s[i]=='o'&&dp[i]<=k) 
		r[dp[i]]=max(i,r[dp[i]]);
	for(int i=1;i<=k;i++) if(l[i]==r[i]) 
		cout<<l[i]+1<<endl;
	return 0;
}


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

int n, t[55];
string s[55], x;

int main() {
	cin >> n;
	for (int i = 1; i <= n; ++i) cin >> s[i] >> t[i];
	cin >> x;
	int p = find(s + 1, s + 1 + n, x) - s;
	int ans = 0;
	for (int i = p + 1; i <= n; ++i) ans += t[i];
	cout << ans << endl;
}


Measured memory_bytes: 256
//coded by pavitra_ag

#include<bits/stdc++.h>

#define ll long long int
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define sep(i,b,a) for(ll i=b-1;i>=a;i--)
#define vi vector <ll>
#define hell (ll)(1e9+7)
#define pii pair <ll,ll>
#define inf (ll)(1e16)
#define pb push_back

using namespace std;

void solve()
{
    ll a,b;
    cin>>a>>b;
    cout<<max(2*a-1,max(2*b-1,a+b));
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll t;
    //cin>>t;
    t=1;
    while(t--)
    {
        solve();
    }
    return 0;
}


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

int main()
{
  	double x1,x2,y1,y2,h,w;
  
 	cin >> x1 >> y1 >> x2 >> y2;
   	
  	h = abs(y1 - y2);
  	w = abs(x1 - x2);
  	
  	cout  << fixed << setprecision(8) << sqrt(h*h+w*w) << endl;
  
}


Measured memory_bytes: 3276
#include <stdio.h>

int main(){
	int a, b;
	scanf("%d" ,&a);
	scanf("%d" ,&b);
	if (a > b)
		printf("a > b\n");
	else if (a < b)
		printf("a < b\n");
	else printf("a == b\n", a, b);

	return 0;


	

}

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

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

  ld a,b,n;cin>>a>>b>>n;
  ll x = min(b-1, n);
  cout<< floor(a * x / b) - a * floor(x / b)<<endl;
  
  return 0;
}


Measured memory_bytes: 3804
#include <iostream>
#include <iomanip>
#include <string>
#include <string.h>
#include <math.h>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <algorithm>
#include <utility>
#include <deque>
#include <queue>
#include <functional>
//#include <boost/multiprecision/cpp_int.hpp>

#define rep(i, n) for(int i = 0; i < n; ++i)
#define REP(i, m, n) for(int i = m; i < n; ++i)
#define rrep(i,n) for(int i = n; i >= 0; --i)
#define RREP(i, m, n) for(int i = n; i >= m; --i)
#define llrep(i, n) for(ll i = 0; i < n; ++i)
#define llREP(i, m, n) for(ll i = m; i < n; ++i)
#define llrrep(i,n) for(ll i = n; i >= 0; --i)
#define llRREP(i, m, n) for(ll i = n; i >= m; --i)

using ll = long long;
using ull = unsigned long long;
using pii = std::pair<int, int>;
using pll = std::pair<long long, long long>;
using pil = std::pair<int, long long>;
using pli = std::pair<long long, int>;
using plpii = std::pair<long long, std::pair<int, int>>;
using pdd = std::pair<double, double>;

const long long INF = 1000000000000000001;
const long long _MOD = 1000000007;
const long long MOD = 998244353;
const int ALPHABET = 27;
const double pi = 3.14159265358979;

using namespace std;
//namespace mp = boost::multiprecision;

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

	int n, s;
	cin >> n >> s;
	int* a = new int[n];
	rep(i, n) cin >> a[i];

	ll* dp = new ll[s+1];
	ll* pre = new ll[s + 1];
	memset(dp, 0, sizeof(ll)*(s + 1));
	if (s >= a[0]) dp[a[0]] = 1;
	dp[0] = 2;
	REP(i, 1, n) {
		memcpy(pre, dp, sizeof(ll)*(s + 1));

		rep(j, s + 1) {
			dp[j] *= 2;
			dp[j] %= MOD;
		}

		RREP(j, a[i], s) {
			dp[j] += pre[j - a[i]];
			dp[j] %= MOD;
		}
	}

	cout << dp[s] << "\n";

	return 0;
}



Measured memory_bytes: 3708
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "ctime"

using namespace std;

constexpr long long int MOD = 1000000007;
//constexpr int MOD = 1000000007;
//constexpr int MOD = 998244353;
//constexpr long long int MOD = 998244353;
constexpr double EPS = 1e-8;

//int N, M, K, H, W, L, R;
long long int N, M, K, H, W, L, R;

struct Node{
	int bef,now,speed;
	double cost;
	Node(const int b,const int n,const int s,const double c){
		bef=b,now=n,speed=s,cost=c;
		return;
	}
	bool operator<(const Node&n)const{
		return cost>n.cost;
	}
};

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	while(cin>>N>>M,N){
		int st,gl;
		cin>>st>>gl;
		st--,gl--;
		vector<vector<double>>dis(N,vector<double>(N));
		vector<vector<double>>speed(N,vector<double>(N));
		for(int i=0;i<M;i++){
			cin>>L>>R;
			L--,R--;
			cin>>dis[L][R]>>speed[L][R];
			dis[R][L]=dis[L][R];
			speed[R][L]=speed[L][R];
		}
		vector<vector<vector<double>>>dp(N,vector<vector<double>>(N,vector<double>(31,MOD)));
		priority_queue<Node>PQ;
		for(int i=0;i<N;i++){
			dp[i][st][0]=0;
			PQ.push(Node(i,st,0,0));
		}
		while(!PQ.empty()){
			auto c=PQ.top();
			//cout<<c.bef<<" "<<c.now<<" "<<c.speed<<endl;
			PQ.pop();
			for(int i=0;i<N;i++){
				if(c.bef==i)continue;
				if(dis[c.now][i]==0)continue;
				for(int j=-1;j<=1;j++){
					int ns=c.speed+j;
					if(ns<=0)continue;
					if(ns>speed[c.now][i])continue;
					if(dp[c.now][i][ns]>c.cost+dis[c.now][i]/ns){
						dp[c.now][i][ns]=c.cost+dis[c.now][i]/ns;
						PQ.push(Node(c.now,i,ns,dp[c.now][i][ns]));
					}
				}
			}
		}
		double ans=MOD;
		for(int i=0;i<N;i++){
			ans=min(ans,dp[i][gl][1]);
		}
		if(ans>1e9){
			cout<<"unreachable"<<endl;
		}
		else{
			cout<<setprecision(20)<<ans<<endl;
		}
	}
}



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

using namespace std;

int main()
{
    long long x,y,a,b,div=0;

    cin>>x>>y;
    a=x;
    for(int i=1; i<=1000; i++){
        div=pow(2,i-1)*a;

        if(div>y){
            cout<<i-1<<endl;
            break;
        }
    }
    return 0;
}


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

int main(){
  int w,d,h1[10],h2[10];
  bool use[10];

  while(cin >> w >> d,w){
    int ans = 0;
    for(int i=0;i<w;i++)cin >> h1[i], ans += h1[i];
    for(int i=0;i<d;i++)cin >> h2[i], ans += h2[i], use[i] = false;

    for(int i=0;i<w;i++){
      for(int j=0;j<d;j++){
	if(!use[j] && h1[i] == h2[j]){
	  use[j] = true;
	  ans -= h1[i];
	  break;
	}
      }
    }

    cout << ans << endl;
  }
}

Measured memory_bytes: 1160
import bisect
import copy
import fractions
import math
import numpy as np
from collections import Counter, deque
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product


def resolve():
    h, w = map(int, input().split())
    A = [[_ for _ in input()] for _ in range(h)]
    B = [i for i in A if '#' in i]
    C = zip(*[i for i in zip(*B) if '#' in i])
    
    for i in C:
        print(*i, sep='')


resolve()

Measured memory_bytes: 14704
mod = 1000000007

S = input()
n = 1
a = 0
ab = 0
abc = 0
for s in S:
    if s in "A":
        a += n
    if s in "B":
        ab += a
    if s == "C":
        abc += ab
    if s in "?":
        n, a, ab, abc = 3 * n, 3 * a + n, 3 * ab + a, 3 * abc + ab
    n %= mod
    a %= mod
    ab %= mod
    abc %= mod

print(abc % mod)


Measured memory_bytes: 42348
s1 =set([1,3,5,7,8,10,12])
s2 =set([4,6,9,11])
s3 =set([2])
a,b =map(int,input().split())
for i in [s1,s2,s3]:
  if a in i and b in i:
    print("Yes")
    break
else:
  print("No")

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

flag=1

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

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
const long long INF = 1LL << 60;

int main(){
  int n;
  cin >> n;
  int a[n+1], b[n+1], c[n+1];
  int dp[n+1][3];
  for(int i = 1; i <= n; i++) cin >> a[i] >> b[i] >> c[i];
  for(int i = 0; i < 3; i++) dp[0][i] = 0;
  for(int i = 1; i <= n; i++){
    dp[i][0] = max(dp[i-1][1] + b[i], dp[i-1][2] + c[i]);
    dp[i][1] = max(dp[i-1][0] + a[i], dp[i-1][2] + c[i]);
    dp[i][2] = max(dp[i-1][0] + a[i], dp[i-1][1] + b[i]);
  }
  cout << max({dp[n][0], dp[n][1], dp[n][2]}) << endl;
}

Measured memory_bytes: 5948
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <bits/stdc++.h>
 
using namespace __gnu_pbds;
using namespace std;

#define double      	long double
#define int         	long long
#define pb          	push_back
#define pii         	pair<int,int>
#define vi          	vector<int>
#define vii         	vector<pii>
#define mi          	map<int,int>
#define mii         	map<pii,int>
#define all(a)      	(a).begin(),(a).end()
#define sz(x)       	(int)x.size()
#define endl        	"\n"
#define repp(i,a,b) 	for(int i=a;i<b;i++)
#define rep(i,a,b) 		for(int i=a;i<=b;i++)
#define brep(i,a,b)     for(int i=a;i>=b;i--)
#define deb1(x)      	cout << #x << "=" << x << endl
#define deb2(x, y)  	cout << #x << "=" << x << "," << #y << "=" << y << endl
#define deb3(x, y, z)  	cout << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z << endl
#define trace(v) 		for(auto it=v.begin();it!=v.end();it++)cout<<*it<<" ";cout<<endl;
#define tracearr(a,l,r) for(int iii=l;iii<=r;iii++)cout << a[iii] << " ";cout << endl;
#define PI          	3.1415926535897932384626
#define F 				first
#define S 				second
#define clr(x,y) 		memset(x, y, sizeof(x))
#define IOS         	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);


typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
// *s.find_by_order(1) - gives the 2nd samllest element in set
// s.order_of_key(x)   - gives the number of elements in the set which are strictly smaller than x


const int N=1e5 + 5;
const int MOD=1e9 + 7;

int32_t main()
{
	IOS;
	int T=1;
	//cin >> T;
	// int numOfSetBits = __builtin_popcountll(n);
	std::cout << std::fixed << std::setprecision(12);
	while(T--)
	{
		int n;
		cin >> n;
		int a[n+5];
		rep(i,1,n)
		{
			cin >> a[i];
		}
		int x = a[1];
		rep(i,2,n)
			x = x^a[i];
		rep(i,1,n)
		{
			int xx = x^a[i];
			cout << xx << " ";
		}
	}
}



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

using namespace std;
#define ok1 printf("ok1\n");
#define ok2 printf("ok2\n");
#define M 1000000000000000000LL
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);(i)--)
#define all(a) (a).begin(),(a).end()
#define reall(a) (a).rbegin(),(a).rend()
#define pb push_back
#define pf push_front
#define MIN(a,b) a=min((a),(b))
#define MAX(a,b) a=max((a),(b))
#define SIZE(v) (int)v.size()
const double pi = acos(-1.0);

typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef deque<ll> dll;
typedef pair<ll, ll> P;
#define mod 1e9 + 7;

int main(){
    ll q,h,s,d,n;
	cin >> q >> h >> s >> d >> n;
	cout << (n/2)*min(q * 8,min(h * 4, min(s * 2,d))) + ((n%2) * min(q * 4,min(h * 2,s))) << endl;
    return 0;
}  


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

// 0-indexed
template <class T>
struct Dinic {
  struct edge {
    int to;
    T cap;
    int rev;
  };
  vector<vector<edge>> lst;
  vector<int> completed;
  vector<int> dist;
  Dinic(int n = 1) {
    // if 1-indexed
    //++n;
    lst.resize(n);
    completed.resize(n);
    dist.resize(n);
  }
  bool add(int start, int goal, T capacity) {
    lst[start].push_back(
        (edge){goal, capacity, (int)lst[goal].size()});
    lst[goal].push_back(
        (edge){start, 0, (int)lst[start].size() - 1});
    return 1;
  }
  // dist = time from start to now number
  void distbfs(int start) {
    fill(dist.begin(), dist.end(), -1);
    queue<int> bfsqu;
    dist[start] = 0;
    bfsqu.push(start);
    while(bfsqu.size() > 0) {
      int now = bfsqu.front();
      bfsqu.pop();
      for(int i = 0; i < lst[now].size(); ++i) {
        edge* nowe = &lst[now][i];
        if(nowe->cap > 0 && dist[nowe->to] < 0) {
          dist[nowe->to] = dist[now] + 1;
          bfsqu.push(nowe->to);
        }
      }
    }
  }
  T pathdfs(int now, int goal, T nf) {
    if(now == goal) return nf;
    for(int& i = completed[now]; i < lst[now].size(); ++i) {
      edge* e = &lst[now][i];
      if(e->cap > 0 && dist[now] < dist[e->to]) {
        T ans = pathdfs(e->to, goal, min(nf, e->cap));
        if(ans > 0) {
          e->cap -= ans;
          lst[e->to][e->rev].cap += ans;
          return ans;
        }
      }
    }
    return 0;
  }
  T solve(int start, int goal) {
    T ans = 0, nf = 0;
    while(1) {
      // bfs
      distbfs(start);
      // cannnot go to goal from start
      if(dist[goal] < 0) return ans;
      // reset
      fill(completed.begin(), completed.end(), 0);
      while((nf = pathdfs(start, goal, inf)) > 0) ans += nf;
    }
    return -1;
  }
};


int n;
long long a[104] = {0};
long long sum = 0;
Dinic<long long> dn;

int main() {
  cin >> n;
  dn = Dinic<long long>(n + 2);
  for(int i = 0; i < n; ++i) cin >> a[i];
  for(int i = 0; i < n; ++i) {
    sum += max(0LL, a[i]);
    dn.add(0, i + 1, max(0LL, -a[i]));
    dn.add(i + 1, n + 1, max(0LL, a[i]));
    for(int j = 2; j * (i + 1) <= n; ++j)
      dn.add(i + 1, j * (i + 1), inf);
  }
  cout << sum - dn.solve(0, n + 1) << endl;
  return 0;
}


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

int main(){
	int n,a[100000],m[100000]={0};
	long long sum=1;
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		scanf("%d",&a[i]);
		m[a[i]]++;
	}
	if(n%2!=0){
		if(m[0]!=1){
			sum=0;
		}
		else{
			for(int i=2;i<n;i+=2){
            	if(m[i]!=2){
                	sum=0;
           		}
        	}
		}
	}
	else{
		for(int i=1;i<n;i+=2){
			if(m[i]!=2){
				sum=0;
			}
		}
	}
	if(sum==0){
		printf("0");
	} 
	else{
		for(int i=0;i<n/2;i++){
			sum=(sum*2)%1000000007;
		}
		
		printf("%lld",sum);
	}
}

Measured memory_bytes: 896
#include <iostream>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <vector>
#include <complex>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <bitset>
#include <ctime>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cassert>
#include <cstddef>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <sstream>
#include <fstream>

using namespace std;
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define FOR(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define RREP(i, a) for(int (i) = (a) - 1; (i) >= 0; (i)--)
#define FORR(i, a, b) for(int (i) = (a) - 1; (i) >= (b); (i)--)
#define DEBUG(C) cerr << #C << " = " << C << endl;
using LL = long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<LL>;
using VVL = vector<VL>;
using VD = vector<double>;
using VVD = vector<VD>;
using PII = pair<int, int>;
using PDD = pair<double, double>;
using PLL = pair<LL, LL>;
using VPII = vector<PII>;
template<typename T> using VT = vector<T>;
#define ALL(a) begin((a)), end((a))
#define RALL(a) rbegin((a)), rend((a))
#define SORT(a) sort(ALL((a)))
#define RSORT(a) sort(RALL((a)))
#define REVERSE(a) reverse(ALL((a)))
#define MP make_pair
#define FORE(a, b) for (auto &&a : (b))
#define FIND(s, e) ((s).find(e) != (s).end())
#define EB emplace_back
template<typename T>inline bool chmax(T &a,T b){if(a<b){a=b;return true;}return false;}
template<typename T>inline bool chmin(T &a,T b){if(a>b){a=b;return true;}return false;}

const int INF = 1e9;
const int MOD = INF + 7;
const LL LLINF = 1e18;

void init();
void last();

void init() {

}

void solve(int n, int m, int k) {
    vector<long long> dp(n * m + 10);
    dp[0] = 1;
    for (int i = 0; i < n; i++) {
        vector<long long> newdp(n * m + 10);
        for (int j = 0; j < n * m - m + 1; j++) {
            for (int dice = 1; dice <= m; dice++) {
                newdp[j + dice] += dp[j];
            }
        }
        dp = newdp;
    }
    double sum = 0;
    for (int i = 0; i < n * m + 10; i++) {
        LL inc = 0;
        if (i - k <= 0) inc = 1;
        else inc = i - k;
        sum += inc * dp[i];
    }
    printf("%.10lf\n", sum / pow(m, n));
}

void last() {
    exit(0);
}

int main(void) {
	int a, b, c, x, y, z, n, m, p, k;
	string s;
	while (cin >> n >> m >> k, n) {
		solve(n, m, k);
		//break;
	}
    last();
}

Measured memory_bytes: 3500
#include<bits/stdc++.h>
using namespace std;
int main(){
  string A;
  cin >> A;
  bool F;
  F = false;
  if(A.at(0) == A.at(1) && A.at(1) == A.at(2)) F = true;
  if(A.at(1) == A.at(2) && A.at(3) == A.at(2)) F = true;
  if(F) cout << "Yes" << endl;
  else cout << "No" << endl;
}

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

#define pp push_back
#define pf push_front
#define mp make_pair
#define fs first
#define sc second
#define sf scanf

using namespace std;

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

const int N = (int) 1e5;
const int INF = (int) 1e9 + 7;

int main(int argc, char *argv[])
{
	// ios_base::sync_with_stdio(false);
	// cin.tie(NULL);

	int k;
	sf("%d", &k);
	int a, b;
	sf("%d %d", &a, &b);

	bool ok = false;
	int x = k;
	while (x <= b) {
		if (x >= a) ok = true;
		x += k;
	}
	puts(ok ? "OK" : "NG");

	return 0;
}


Measured memory_bytes: 3764
#include<stdio.h>

int main(void) {
	int n, b, f, r, v,i,j,k,l=1;
	int count[5][4][11];

	for (i = 1; i < 5; i++) {
		for (j = 1; j < 4; j++) {
			for (k = 1; k < 11; k++) {
				count[i][j][k] = 0;
			}
		}
	}

	
	scanf("%d", &n);

	while (l <= n) {
		scanf("%d%d%d%d", &b, &f, &r, &v);
		count[b][f][r] += v;
		
		if (count[b][f][r] < 0) {
			count[b][f][r] = 0;
		}
		if (count[b][f][r] > 9) {
			count[b][f][r] = 9;
		}
		l++;
	}

	for (i = 1; i <5; i++) {
		for (j = 1; j <4; j++) {
			for (k = 1; k < 11; k++) {
				printf(" %d", count[i][j][k]);
			}
			printf("\n");
		}
		if (1 <= i&&i < 5-1) {
			printf("####################\n");
		}
	}
	return 0;
}


Measured memory_bytes: 2732
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

	// 繰り上げ金額の単位(円)
	private static final int ROUND_UNIT = 1000;

	// 利子
	private static final double LOAN_INTEREST = 1.05;

	/**
	 * 返済額計算実行
	 */
	public static void main(String[] args) throws Exception {

		// 標準入力
		BufferedReader reader = new BufferedReader(new InputStreamReader(
				System.in));

		// 返済額の計算
		new Main().calcAmountRepaid(Integer.parseInt(reader.readLine()));
	}

	/**
	 * 返済額計算
	 */
	private void calcAmountRepaid(int weekNum) {

		// 借金10万円を初期値とする
		int debt = 100000;

		// 週単位で返済額を計算
		for (int i = 0; i < weekNum; i++) {

			// 利子込みの返済額を計算
			debt *= LOAN_INTEREST;

			// 計算結果から1000円未満を切り上げ
			if (debt % ROUND_UNIT != 0) {
				debt = ROUND_UNIT * (debt / ROUND_UNIT + 1);
			} else {
				debt = ROUND_UNIT * (debt / ROUND_UNIT);
			}

		}

		// 結果出力
		System.out.println(debt);

	}

}

Measured memory_bytes: 16880
#include <bits/stdc++.h>
using namespace std;  
typedef long long ll;
typedef vector<ll> vint;
int main() {
  ll a,b,c,d,e,k;
  cin >> a>> b>>c>>d>>e>>k ;
  
  if (e-a<=k) {
    cout << "Yay!";
  }
  else {
    cout << ":(";
  }
}


Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;

namespace Algorithm
{
    class Program
    {
        static void Main(string[] args)
        {
            var l = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int N = l[0], K = l[1];
            var A = Console.ReadLine().Split().Select(int.Parse).ToArray();

            var G = A[0];
            for (var i = 1; i < N; i++)
                G = Gcd(A[i], G);

            Console.WriteLine(K % G == 0 && K <= A.Max() ? "POSSIBLE" : "IMPOSSIBLE");
        }

        static int Gcd(int a, int b)
        {
            if (b > a) return Gcd(b, a);
            if (b == 0) return a;
            return Gcd(b, (a % b));
        }
    }
}


Measured memory_bytes: 21728
#include <bits/stdc++.h>
using intl = long long;
using itnl = long long;
using itn = int;
using ld = long double;
using namespace std;
#define rep(i, n) for(intl i = 0; i < (intl)(n); i++)
#define rrep(i, n) for(intl i = (intl)(n); i >= 0; i--)
#define repi(i, a, b) for(intl i = (intl)(a); i < (intl)(b); i++)
#define rrepi(i, a, b) for(intl i = (intl)(a); i >= (intl)(b); i--)
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) < (b) ? (a) : (b))
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))
#define m1(x) memset(x,1,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))
#define alength(a) (sizeof(a) / sizeof(a[0]))
#define cin(i, a) rep(i, alength(a))cin >> a[i]
#define ccin(i, j, a) rep(i, alength(a))rep(j, alength(a[i]))cin >> a[i][j]
#define debug(x) cout << #x << ":" << x << endl
#define rdebug(i,x) rep(i, alength(x))cout << #x << "[" << i << "]:" << x[i] << endl
#define sqrt sqrtl
#define itn int
#define double ld
#define pb push_back
#define mp make_pair
const intl INF = 1e9;
const intl MOD = 1e9+7;
const ld eps = 1.0e-14;//-9
void fp(bool f){cout << (f ? "Yes" : "No") << endl;}
void fp(bool f, string s, string t){cout << (f ? s : t) << endl;}
intl kai(intl k){
    intl a = 1;
    for(int i = 2; i <= k; i++){
        a *= i;
    }
    return a;
}
intl gcd(intl a, intl b){
    if(!b)return a;
    return gcd(b, a % b);
}
intl lcm(intl a,intl b){
    return a / gcd(a, b) * b;
}
intl digit10(intl a){
    intl b = 0;
    do{
        a /= 10;
        b++;
    }while(a);
    return b;
}
signed main(){
    cout << fixed << setprecision(10);
    intl a,b,c;
    cin >> a >> b >> c;
    fp(a + b >= c);
    return 0;
}

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

using namespace std;

void skip(const string &str, int &pos, char c) {
    if(str[pos] != c) cerr << "Expected " << c << " but " << str[pos] << endl;
    ++pos;
}

string atom(const string &str, int &pos) {
    assert(isupper(str[pos]));

    string name = "";
    name += str[pos];
    ++pos;
    if(pos < str.size() && islower(str[pos])) {
        name += str[pos++];
    }
    return name;
}

int number(const string &str, int &pos) {
    assert(isdigit(str[pos]));

    int cur = 0;
    while(pos < str.size() && isdigit(str[pos])) {
        cur *= 10;
        cur += str[pos++]-'0';
    }
    return cur;
}

int molecule(const string &str, int &pos, map<string,int> &tbl) {
    int sum = 0;
    for(; pos < str.size(); ) {
        //cout << pos << ' ' << str[pos] << endl;
        if(str[pos] == '(') {
            skip(str, pos, '(');
            int w = molecule(str, pos, tbl);
            skip(str, pos, ')');
            int n = number(str, pos);
            sum += w*n;
        }
        else if(str[pos] == ')') {
            break;
        }
        else {
            string a = atom(str, pos);
            //cout << "atom " << a << endl;
            if(tbl.count(a) == 0) throw "UNKNOWN";

            int n = 1;
            if(pos < str.size() && isdigit(str[pos])) {
                n = number(str, pos);
            }
            //cout << "number " << n << ' ' << pos << endl;
            sum += tbl[a] * n;
        }
    }

    return sum;
}

int main() {
    map<string, int> tbl;
    while(true) {
        string atom;
        cin >> atom;
        if(atom == "END_OF_FIRST_PART") break;

        int weight;
        cin >> weight;
        tbl[atom] = weight;
    }

    while(true) {
        string exp;
        cin >> exp;
        if(exp == "0") break;

        try {
            int pos = 0;
            cout << molecule(exp, pos, tbl) << endl;
        } catch(const char *str) {
            cout << "UNKNOWN" << endl;
        }
    }

    return 0;
}

Measured memory_bytes: 0
#define _USE_MATH_DEFINES
#include<iostream>
#include<string>
#include<queue>
#include<cmath>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<stack>
#include<cstdio>
#include<cstring>
#include<bitset>
#include<unordered_map>
#include<climits>
#include<fstream>
#include<time.h>
#include<cassert>
#include<functional>
#include<numeric>
#include <tuple>

using namespace std;
using ll = long long;
using ld = long double;
#define int long long
#define all(a) (a).begin(),(a).end()
#define EPS (1e-13)
#define fs first
#define sc second
#define xx first
#define yy second.first
#define zz second.second
#define H pair<int, int>
#define P pair<int, pair<int, int>>
#define Q(i,j,k) mkp(i,mkp(j,k))
#define rep(i,n) for(int (i) = 0 ; (i) < (n) ; (i)++)
#define rng(i,s,n) for(int (i) = (s) ; (i) < (n) ; (i)++)
#define req(i,n) for(int (i) = (n) - 1 ; (i) >= 0 ; (i)--)
#define mkp make_pair
#define mem0(x) memset(x,0,sizeof(x))
#define vec vector
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define crdcomp(b) sort(all((b)));(b).erase(unique(all((b))),(b).end())
#define ssp(i,n) (i==n-1?"\n":" ")
#define ctoi(c) (int)(c-'A')
#define itoc(c) (char)(c+'A')
#define pb push_back
#define cauto const auto&
#define itn int
#define pri_que priority_queue
#define pp(x,y) pb(H{x,y})
#define ppp(x,y,z) pb(Q(x,y,z))
const int mod = 1e9 + 7;
const int Mod = 998244353;
const ll inf = 3 * 1e18;
const int Inf = 15 * 1e8;
template<class T>bool chmax(T & a, const T & b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T & a, const T & b) { if (b < a) { a = b; return 1; } return 0; }
ll read() { ll u, k = scanf("%lld", &u); return u; }
string reads() { string s; cin >> s; return s; }
ll gcd(ll i, ll j) { return j ? gcd(j, i % j) : i; }
ll mod_pow(ll x, ll n, ll p) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * x % p;
		x = x * x % p;
		n >>= 1;
	}
	return res;
}//x^n%p
ll bitcount(ll x) {
	int sum = 0; for (int i = 0; i < 60; i++)if ((1ll << i) & x) sum++;
	return sum;}
const int fn_ = 600000;
ll fact_[fn_], comp_[fn_];
ll comb(ll x, ll y, ll Mod = mod) {
	if (!fact_[0]) {
		fact_[0] = 1; comp_[0] = 1;
		for (int i = 1; i < fn_; i++) {
			fact_[i] = fact_[i - 1] * i % Mod;
			comp_[i] = mod_pow(fact_[i], Mod - 2, Mod);
		}
	}
	if (x < y) return 0;
	return fact_[x] * comp_[x - y] % Mod * comp_[y] % Mod;
}
//---------------------------------------------------------------
signed main() {
	char c;
	cin >> c;
	cout << itoc(ctoi(c) + 1) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N,K,P;
  long long answer=-1000000007;
  cin>>N>>K;
  vector<int> NV(N);
  vector<int> C(N);
  for(int i=0;i<N;i++){
    cin>>P;
    NV.at(i)=P-1;
  }
  for(int i=0;i<N;i++){
    cin>>C.at(i);
  }
  for(int i=0;i<N;i++){
    int roop=0,v1=i;
    long long roopValue=0,answerI=0;
    vector<int> visited1(N,0);
    while(visited1.at(v1)==0){
      visited1.at(v1)=1;
      v1=NV.at(v1);
      roop++;
      roopValue+=C.at(v1);
    }
    if(roopValue>0){
      if(K/roop==0){
        answerI=C.at(NV.at(i));
        int v2=i,count=1;
        long long memo=0;
        while(count<=min(roop,K)){
          count++;
          v2=NV.at(v2);
          memo+=C.at(v2);
          answerI=max(answerI,memo);
        }
      }
      else{
        answerI=(K/roop-1)*roopValue;
        int remain=K%roop+roop,v2=i,count=1;
        long long memo=answerI;
        if(K/roop==1 && remain==roop){
          answerI+=C.at(NV.at(i));
        }
        while(count<=remain){
          count++;
          v2=NV.at(v2);
          memo+=C.at(v2);
          answerI=max(answerI,memo);
        }
      }
    }
    else if(roopValue<0){
      answerI=C.at(NV.at(i));
      int v2=i,count=1;
      long long memo=0;
      while(count<=min(roop,K)){
        count++;
        v2=NV.at(v2);
        memo+=C.at(v2);
        answerI=max(answerI,memo);
      }
    }
    answer=max(answer,answerI);
  }
  cout<<answer<<endl;
}

Measured memory_bytes: 3692
line_one = raw_input().split()
n = int(line_one[0])
k = int(line_one[1])

l = []
#d = {}
for i in range(n):
    line_one2 = raw_input().split()
    a1 = int(line_one2[0])
    b1 = int(line_one2[1])
    l.append( ( a1, b1 ))
    #if a1 in l:
    #    #d[a1] += b1
    #    l[a1][1] += b1
    #else:
    #    l.append( ( a1, b1 ))
    #    #//d[a1] = b1

#l.sort()
l = sorted(l, key=lambda x: x[0])
count = 0
for item in l:
    count += item[1]
    if k <= count:
        print item[0]
        break


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

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define FORD(i,b,a) for (int i = (int)(b) - 1; i >= a; --i)
#define REP(i,N) FOR(i,0,N)
#define st first
#define nd second
#define pb push_back

typedef pair<int, int> PII;
typedef long long LL;

const int MOD = 1000000007;

LL DP[3000000];

int main() {
  int N;
  scanf("%d", &N);
  LL rolling_sum = 0;
  FORD(i,2*N+5,0) {
    if (i >= N) {
      DP[i] = 1;
      continue;
    } else if (i == N-1) {
      DP[i] = N;
      rolling_sum = 2*N;
      continue;
    }
    DP[i] = rolling_sum - DP[i+2] + (N-1)*(LL)(N-1);
    DP[i] %= MOD;
    // printf("%d %lld %lld\n", i, rolling_sum, DP[i]);

    rolling_sum += DP[i];
    rolling_sum -= DP[i+N+1];
  }

  LL result = (DP[0] + MOD) % MOD;
  printf("%lld\n", result);
}


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

int main(void){
  int A,B,C,D;
  cin>>A>>B>>C>>D;
  const int lower=max(A,C);
  const int upper=min(B,D);
  
  cout <<max(0,upper-lower)<<endl;
  
  return 0;
}


Measured memory_bytes: 256