akhauriyash/Code-Regression huggingface dataset:
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.InputStream;
import java.io.PrintWriter;
import java.lang.reflect.Array;
import java.math.BigDecimal;
import java.math.MathContext;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.Deque;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Objects;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Random;
import java.util.Scanner;
import java.util.Set;
import java.util.Stack;
import java.util.TreeMap;
import java.util.TreeSet;

import static java.util.Comparator.*;

public class Main {
    public static void main(String[] args) {
        PrintWriter out = new PrintWriter(System.out);
        Solver solver = new Solver(System.in, out);
        solver.solve();
        out.close();
    }
}
class Solver {
	Scanner sc;
	PrintWriter out;
    public Solver(InputStream in, PrintWriter out) {
    	sc = new Scanner(in);
    	this.out = out;
    }
    // ======================================================================
    public void solve() {
    	char[] C = ns().toCharArray();
    	int b = 0, r = 0;
    	for (int i = 0; i < C.length; i++) {
			if(C[i] == '0')		r++;
			else				b++;
		}
    	out.println(r >= b ? b*2 : r*2);
    }
    // ------------------------------------------
    // 入力
    // ------------------------------------------
    public int ni() {
    	return sc.nextInt();
    }
    public long nl() {
    	return sc.nextLong();
    }
    public String ns() {
    	return sc.next();
    }
    public char[] nc() {
    	return sc.next().toCharArray();
    }
    public int[] ndi(int N) {
    	int[] ans = new int[N];
    	for (int i = 0; i < N; i++) {
			ans[i] = ni();
		}
    	return ans;
    }
    public long[] ndl(int N) {
    	long[] ans = new long[N];
    	for (int i = 0; i < N; i++) {
			ans[i] = nl();
		}
    	return ans;
    }
    public String[] nds(int N) {
    	String[] ans = new String[N];
    	for (int i = 0; i < N; i++) {
			ans[i] = ns();
		}
    	return ans;
    }
    public char[][] ndc(int N) {
    	char[][] ans = new char[N][];
    	for (int i = 0; i < N; i++) {
			ans[i] = nc();
		}
    	return ans;
    }
    public int[][] nddi(int N, int S) {
    	int[][] ans = new int[N][S];
    	for (int i = 0; i < N; i++) {
			for (int j = 0; j < S; j++) {
				ans[i][j] = ni();
			}
		}
    	return ans;
    }
}


Measured memory_bytes: 25892
#include <iostream>
#include <vector>
#include <algorithm>

typedef std::pair<int, int> P;

int main(){
	int a = 0, b = 0;
	while(std::cin >> a >> b, !std::cin.eof()){
		std::vector<P> v;
		while(a%b){
			a *= 10;

			if(std::find(v.begin(), v.end(), P(a%b, a/b)) != v.end())break;
			v.push_back(P(a%b, a/b));
			a %= b;
		}
		int first = std::find(v.begin(), v.end(), P(a%b, a/b)) - v.begin();

		for(int i=0;i<v.size();i++){
			std::cout << v[i].second;
		}std::cout << std::endl;

		if(a%b == 0)continue;
		for(int i=0;i<v.size();i++){
			if(i >= first)
				std::cout << "^";
			else
				std::cout << " ";
		}std::cout << std::endl;
	}
}

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

using namespace std;

using ll = long long;
using Vi = vector<int>;
using Vl = vector<ll>;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

constexpr int I_INF = INT_MAX;
constexpr ll L_INF = LLONG_MAX;

//===



ll dp[110][100100];



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

	int N, W; cin >> N >> W;
	Vl v(N), w(N);
	for (int i = 0; i < N; ++i) {
		cin >> w[i] >> v[i];
	}

	for (int i = 0; i <= N; ++i) {
		for (int j = 0; j <= 100000; ++j) {
			dp[i][j] = L_INF;
		}
	}
	dp[0][0] = 0;

	for (int i = 1; i <= N; ++i) {
		for (int j = 0; j <= 100000; ++j) {
			if (j - v[i - 1] >= 0 && dp[i - 1][j - v[i - 1]] != L_INF) {
				dp[i][j] = min(dp[i - 1][j], dp[i - 1][j - v[i - 1]] + w[i - 1]);
			}
			else {
				dp[i][j] = dp[i - 1][j];
			}
		}
	}

	ll ans = 0;
	for (int i = 1; i <= N; ++i) {
		for (int j = 0; j <= 100000; ++j) {
			if (dp[i][j] <= W) ans = max(ans, (ll)j);
		}
	}


	cout << ans << endl;


	return 0;
}

Measured memory_bytes: 80256
import sys
## io ##
def IS(): return sys.stdin.readline().rstrip()
def II(): return int(IS())
def MII(): return list(map(int, IS().split()))
def MIIZ(): return list(map(lambda x: x-1, MII()))
## dp ##
def DD2(d1,d2,init=0): return [[init]*d2 for _ in range(d1)]
def DD3(d1,d2,d3,init=0): return [DD2(d2,d3,init) for _ in range(d1)]
## math ##
def to_bin(x: int) -> str: return format(x, 'b') # rev => int(res, 2)
def to_oct(x: int) -> str: return format(x, 'o') # rev => int(res, 8)
def to_hex(x: int) -> str: return format(x, 'x') # rev => int(res, 16)
MOD=10**9+7
def divc(x,y) -> int: return -(-x//y)
def divf(x,y) -> int: return x//y
def gcd(x,y):
    while y: x,y = y,x%y
    return x
def lcm(x,y): return x*y//gcd(x,y)
def enumerate_divs(n):
    """Return a tuple list of divisor of n"""
    return [(i,n//i) for i in range(1,int(n**0.5)+1) if n%i==0]
def get_primes(MAX_NUM=10**3):
    """Return a list of prime numbers n or less"""
    is_prime = [True]*(MAX_NUM+1)
    is_prime[0] = is_prime[1] = False
    for i in range(2, int(MAX_NUM**0.5)+1):
        if not is_prime[i]: continue
        for j in range(i*2, MAX_NUM+1, i):
            is_prime[j] = False
    return [i for i in range(MAX_NUM+1) if is_prime[i]]
## libs ##
from itertools import accumulate as acc
from collections import deque, Counter
from heapq import heapify, heappop, heappush
from bisect import bisect_left
#======================================================#

def main():
    a, b = MII()
    if a <= 0 and 0 <= b :
        print('Zero')
        return None
    if a > 0:
        print('Positive')
        return None
    if b < 0:
        neg = a - b + 1
        if neg%2 == 0:
            print('Positive')
        else:
            print('Negative')

if __name__ == '__main__':
    main()

Measured memory_bytes: 3316
#include<stdio.h>
#include<stdlib.h>
#include<stdint.h>
#include<inttypes.h>

typedef int32_t i32;

void run (void) {
  i32 n;
  scanf ("%" SCNi32, &n);
  i32 phi = n;
  for (i32 k = 2; k * k <= n; ++k) {
    if (n % k != 0) continue;
    phi = phi - phi / k;
    while (n % k == 0) {
      n /= k;
    }
  }
  if (n > 1) {
    phi = phi - phi / n;
  }
  printf ("%" PRIi32 "\n", phi);
}

int main (void) {
  run ();
  return 0;
}


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

int main(void)
{

        int w = 0, y = 2004, h = 20, m = 0, d = 0;
        int r = 0;
        int a = 0, b = 0, c = 0;

        while(1)
        {


                scanf("%d %d", &m, &d);
                if(m == 0)
                {
                        break;

                }

                /*
                a = y / 4;
                b = h / 4;
                c = (13 * (m + 1) )/ 5;
                w = fabs(y + a + b - (2 * h) +  c + d);
                */


                if(m < 3)
                {
                        y--;
                        m += 12;
                }
                r = (y + y/4 - y/100 + y/400 + ( 13*m + 8 )/5 + d )%7;
                /*
                r = w % 7;
                */
                if(r == 1)
                {
                        printf("Monday\n");
                }
                else if(r == 2)
                {
                        printf("Tuesday\n");
                }
                else if(r == 3)
                {
                        printf("Wednesday\n");
                }
                else if(r == 4)
                {
                        printf("Thursday\n");
                }
                else if(r == 5)
                {
                        printf("Friday\n");
                }
                else if(r == 6)
                {
                        printf("Saturday\n");
                }
                else if(r == 0)
                {
                        printf("Sunday\n");
                }
                a = 0;
                b = 0;
                c = 0;
                w = 0;
                r = 0;
                m = 0;
                d = 0;
                y = 2004;

        }
                return 0;
}

Measured memory_bytes: 584
#include "bits/stdc++.h"
using namespace std;
#define int long long
#define REP(i,n) for(int i = 0;i < (int)(n);++i)
#define RREP(i,n) for(int i = (int)n-1;i >= 0;--i)
#define FOR(i,s,n) for(int i = s;i < (int)n;++i)
#define RFOR(i,s,n) for(int i = (int)n-1;i >= s;--i)
#define ALL(a) a.begin(),a.end()
#define IN(a, x, b) (a<=x && x<b)
template<class T>inline void out(T t){cout<<t<<"\n";}
template<class T,class... Ts>inline void out(T t,Ts... ts){cout<<t<<" ";out(ts...);}
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;}
constexpr int INF = 1e18;



signed main(){
	int N,R;
	cin >> N >> R;
	if(N >= 10)out(R);
	else{
		out(R+100*(10-N));
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define P pair<int,int>
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000000
#define MOD 1000000007
#define all(v) v.begin(),v.end()
#define pb push_back
int dx[]={0,1,0,-1},dy[]={1,0,-1,0};
int kaijo[200010];
struct edge{int to,cost;};
int gcd(int a,int b){
	if(b==0)return a;
	return gcd(b,a%b);
}
int lcm(int a,int b){
	return a/gcd(a,b)*b;
}
bool prime(int a){
	if(a==1)return false;
	for(int i=2;i*i<=a;i++){
		if(a%i==0)return false;
	}
	return true;
}
bool kosa(double ax,double ay,double bx,double by,double cx,double cy,double dx,double dy){//線分の交差判定
	double ta=(cx-dx)*(ay-cy)+(cy-dy)*(cx-ax);
	double tb=(cx-dx)*(by-cy)+(cy-dy)*(cx-bx);
	double tc=(ax-bx)*(cy-ay)+(ay-by)*(ax-cx);
	double td=(ax-bx)*(dy-ay)+(ay-by)*(ax-dx);
	return tc*td<0&&ta*tb<0;
}
void init_fact(int n){
	kaijo[0]=1;
	for(int i=1;i<=n;i++){
		kaijo[i]=kaijo[i-1]*i;
		kaijo[i]%=MOD;
	}
}
int modpow(int a,int b){
	if(b==0)return 1;
	if(b%2)return modpow(a,b-1)*a%MOD;
	int memo=modpow(a,b/2);
	return memo*memo%MOD;
}
int comb(int a,int b){
	if(b>a)return 0;
	if(a==b)return 1;
	return kaijo[a]*modpow(kaijo[a-b],MOD-2)%MOD*modpow(kaijo[b],MOD-2)%MOD;
}
int g(int x){
	x=modpow(x,MOD-2);
	return x;
}
string s;
signed main(){
	cin>>s;
	rep(i,s.size()){
		if(i%2==0&&s[i]=='L'){
			puts("No");
			return 0;
		}
		if(i%2==1&&s[i]=='R'){
			puts("No");
			return 0;
		}
	}
	puts("Yes");
	return 0;
}


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

int main() {
    int a, b;
    cin >> a >> b;
    if(a <= 0 && 0 <= b)cout << "Zero" << endl;
    else{
        if(a < 0){
            int c;
            if(b < 0)c = b - a + 1;
            else c = abs(a);
            if(c % 2 == 0)cout << "Positive" << endl;
            else cout << "Negative" << endl;
        }else{
            cout << "Positive" << endl;
        }
    }
    
}

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

using namespace std;

#define YES cout << "YES" << endl;
#define NO  cout << "NO"  << endl;
#define Yes cout << "Yes" << endl;
#define No  cout << "No"  << endl;
 
#define INF INT_MAX
#define MOD 1000000007
#define PI  acos(-1)

using ll  = long long;
using ull = unsigned long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

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

ll GCD(ll a, ll b) {
    if (a <= 0 || b <= 0) {
        return -1;
    }
    if (a > b) {
        if (a % b == 0) {
            return b;
        } else {
            GCD(b, a % b);
        }
    } else if (a < b) {
        if (b % a == 0) {
            return a;
        } else {
            GCD(a, b % a);
        }
    } else {
        return a;
    }
}

ll LCM(ll a, ll b) {
    return a / GCD(a, b) * b;
}

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

    ll A, B, C, D;
    cin >> A >> B >> C >> D;

    ll ans = 0;
    ll a = B/C;
    ll b = B/D;
    ll c = B/LCM(C, D);

    ll d = B - (a+b-c);
    
    A -= 1;
    ll e = A/C;
    ll f = A/D;
    ll g = A/LCM(C, D);

    ll h = A - (e+f-g);

    cout << d-h << endl;
    return 0;
}

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

int main(void) {
    string N;
    cin >> N;
    if((N[0] ^ 0x39) && (N[1] ^ 0x39)) {
        cout << "No\n";
    } else {
        cout << "Yes\n";
    }
    return 0;
}


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

class Stack {
public:
	long long data[1000];
	int tp;

	Stack(){
		tp = 0;
	}

	void push(long long x){
		tp++;
		data[tp] = x;
	}
	long long pop(){
		return data[tp--];
	}
};

int main()
{
	Stack stack;
	string input;
	long long a, b;
	while(cin >> input){
		if(input=="+"){
			b = stack.pop();
			a = stack.pop();
			stack.push(a+b);
		}else if(input=="-"){
			b = stack.pop();
			a = stack.pop();
			stack.push(a-b);
		}else if(input=="*"){
			b = stack.pop();
			a = stack.pop();
			stack.push(a*b);
		}else{
			stack.push(stoi(input));
		}
	}
	cout << stack.pop() << endl;
	return 0;
}




Measured memory_bytes: 3164
import java.util.Scanner;

public class Main{
    public static void main(String args[]){
        
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int t = sc.nextInt();
        int a = sc.nextInt();
        
        double min = a - (t - (sc.nextInt() * 0.006));
        min = min < 0 ? -1 * min : min;
        int result = 1;
        for(int i = 1; i < n; i++){
            double temp = a - (t - (sc.nextInt() * 0.006));
            temp = temp < 0 ? -1 * temp : temp;
            if(min > temp){
                min = temp;
                result = i + 1;
            }
        }
        
        System.out.println(result);
    }
}


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

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

  int ans = 1;
  rep(i,n-1){
    if (s.at(i) != s.at(i+1)) ans++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3716
# from collections import Counter,defaultdict,deque
import sys
# import bisect
# import math
# import itertools
# import string
import queue
# import copy
from heapq import heappop, heappush
input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7

def inp(): # n=1
    return int(input())
def inpm(): # x=1,y=2
    return map(int,input().split())
def inpl(): # a=[1,2,3,4,5,...,n]
    return list(map(int, input().split()))
def inpls(): # a=['1','2','3',...,'n']
    return list(input().split())
def inplm(n): # x=[] 複数行
    return list(int(input()) for _ in range(n))
def inpll(n): # [[1,1,1,1],[2,2,2,2],[3,3,3,3]]
    return sorted([list(map(int, input().split())) for _ in range(n)])
def sortx(x,n,k):
    if k == 0:x.sort(key=lambda y:y[1,n])
    else:x.sort(reversed=True, key=lambda y:y[1,n])
def graph():
    n=inp()
    g=[[] for _ in range(n)]
    for i in range(n):
        a=inp()
        a-=1
        g[i].append(a)
        g[a].append(i)
    return n,g
def graphm():
    n,m=inpm()
    g=[[] for _ in range(n)]
    for _ in range(m):
        a,b,w=inpm()
        a-=1
        b-=1
        g[a].append((b,w))
        g[b].append((a,w))
    return n,m,g

def dijkstra(s,n,g): # sからの最短距離 頂点数n
    s -= 1
    que = queue.Queue()
    d = [10**15 for _ in range(n)]
    d[s] = 0
    que.put( (0,s) )
    while not que.empty():
        p = que.get()
        v = p[1]
        if d[v] < p[0]:
            continue
        for i in range(len(g[v])):
            edge = g[v][i]
            if d[edge[0]] > d[v] + edge[1]:
                d[edge[0]] = d[v] + edge[1]
                que.put( (d[edge[0]] , edge[0]) )
    return d

def dijkstra1(s,n,g): # sからの最短距離 頂点数n
    s -= 1
    que = []
    d = [10**15 for _ in range(n)]
    d[s] = 0
    heappush( que,(0,s) )
    while len(que)>0:
        p =  heappop(que)
        v = p[1]
        if d[v] < p[0]:
            continue
        for i in range(len(g[v])):
            edge = g[v][i]
            if d[edge[0]] > d[v] + edge[1]:
                d[edge[0]] = d[v] + edge[1]
                heappush( que,(d[edge[0]] , edge[0]) )
    return d

def main():
    n,m,g=graphm()
    s=1
    for i in range(n-1):
        a=i+1
        b=i
        g[a].append((b,0))
    
    dis=dijkstra1(s,n,g)
    if dis[n-1]==10**15:
        print(-1)
    else:
        print(dis[n-1])
    
if __name__ == "__main__":
    main()




Measured memory_bytes: 77996
import math
def py():
    print("Yes")
def pn():
    print("No")
def iin():
    x = int(input())
    return x

neko = 0
nya = 0
nuko = 0

n = iin()
a = [int(x) for x in input().split()]
for i in range(n-1):
    a.sort()
    a[i + 1] = (a[i]+a[i + 1])/2
print(a[n-1])

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
long long n,ans=1e9,a[200005],sum[200005];
long search1(long l,long r){
	long idx1=l, idx2=r;
	while(l+1<r){
		long mid=(l+r)/2;
		if(sum[mid]-sum[idx1-1]<=sum[idx2]-sum[mid]){
			l=mid;
		}else{
			r=mid;
		}
	}
	if(sum[r]-sum[idx1-1]<=sum[idx2]-sum[r]){
		return r;
	}else{
		if(sum[l]-sum[idx1-1]<=sum[idx2]-sum[l]){
			return l;
		}else{
			return -1;
		}
	}
}
long search2(long l,long r){
	long idx1=l, idx2=r;
	while(l<r){
		long mid=(l+r)/2;
		if(sum[mid]-sum[idx1-1]>sum[idx2]-sum[mid]){
			r=mid;
		}else{
			l=mid+1;
		}
	}
	if(sum[l]-sum[idx1-1]>sum[idx2]-sum[l]){
		return l;
	}else{
		return -1;
	}
}
int main(){
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>a[i];
		sum[i]=sum[i-1]+a[i];
	}
	for(int i=2;i<=n-2;i++){
		long pos1=search1(1,i);
		long pos2=search2(1,i);
		long pos3=search1(i+1,n);
		long pos4=search2(i+1,n);
		if(pos1!=-1 && pos3!=-1){
			long long hah1=max(sum[pos1],max(sum[i]-sum[pos1],max(sum[pos3]-sum[i],sum[n]-sum[pos3])));
			long long hah2=min(sum[pos1],min(sum[i]-sum[pos1],min(sum[pos3]-sum[i],sum[n]-sum[pos3])));
			ans=min(ans,hah1-hah2);
		}
		if(pos1!=-1 && pos4!=-1){
			long long hah1=max(sum[pos1],max(sum[i]-sum[pos1],max(sum[pos4]-sum[i],sum[n]-sum[pos4])));
			long long hah2=min(sum[pos1],min(sum[i]-sum[pos1],min(sum[pos4]-sum[i],sum[n]-sum[pos4])));
			ans=min(ans,hah1-hah2);
		}
		if(pos2!=-1 && pos3!=-1){
			long long hah1=max(sum[pos2],max(sum[i]-sum[pos2],max(sum[pos3]-sum[i],sum[n]-sum[pos3])));
			long long hah2=min(sum[pos2],min(sum[i]-sum[pos2],min(sum[pos3]-sum[i],sum[n]-sum[pos3])));
			ans=min(ans,hah1-hah2);
		}
		if(pos2!=-1 && pos4!=-1){
			long long hah1=max(sum[pos2],max(sum[i]-sum[pos2],max(sum[pos4]-sum[i],sum[n]-sum[pos4])));
			long long hah2=min(sum[pos2],min(sum[i]-sum[pos2],min(sum[pos4]-sum[i],sum[n]-sum[pos4])));
			ans=min(ans,hah1-hah2);
		}
	}
	cout<<ans;
}

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

int main(){ 
    int n;
    cin >> n;
    double ans;
    if(n%2==0)  ans = 0.5;
    else  ans = (double)((n+1)*0.5 / n);
   printf("%.10f\n",ans);
   return 0;
}

Measured memory_bytes: 256
// Problem : B - Judge Status Summary
// Contest : AtCoder - AtCoder Beginner Contest 173
// URL : https://atcoder.jp/contests/abc173/tasks/abc173_b
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<long,long> pl;
typedef pair<ll,ll> pll;
typedef vector<long> vl;
typedef vector<bool> vb;
typedef vector<ll> vll;
typedef vector<vl> vvl;
typedef vector<vb> vvb;
typedef vector<vll> vvll;
typedef vector<pll> vpll;
typedef vector<string> vs;
typedef unordered_map<ll,ll> umll;

#define FOR(i,a,b) for(long long i=a;i<b;++i)
#define REV(i,a,b) for(long long i=a;i>=b;i--)
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define ub upper_bound
#define lb lower_bound
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define tc ll tests;cin>>tests;while(tests--)
#define io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define coutv(v) for(auto it: (v))cout<<it<<" ";newl;
#define cout2d(v) for(auto it: (v)) {for(auto j:it) cout<<j<<" ";newl;}
#define cinv(v,n) vll (v)(n);FOR(i,0,(n)){cin>>v[i];}
#define cinvg(v,n) (v).resize(n);FOR(i,0,(n)){cin>>v[i];}
#define cin2d(v,n,m) vvll (v)(n,vll(m,0));FOR(i,0,n){FOR(j,0,m){cin>>v[i][j];}}
#define cin2dg(v,n,m) (v).resize(n,vll(m));FOR(i,0,n){FOR(j,0,m){cin>>v[i][j];}}
#define newl cout<<"\n"
#define mod 1000000007
#define INF LLONG_MAX/2

int main()
{
    io;
    unordered_map<string,ll> m;
    ll n;
    cin>>n;
    FOR(i,0,n)
    {
    	string in;
    	cin>>in;
    	m[in]++;
    }
    cout<<"AC x "<<m["AC"];newl;
    cout<<"WA x "<<m["WA"];newl;
    cout<<"TLE x "<<m["TLE"];newl;
    cout<<"RE x "<<m["RE"];newl;
    return 0;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
    using namespace std;
     
   int main(){
     int N,K,sum=0;
     cin >> N >> K;
     vector<int> p(N);
     for (int i=0 ;i<N; i++){
       cin >> p.at(i);
     }
     sort(p.begin(),p.end());
     for (int i=0; i<K; i++){
       sum+=p.at(i);
     }
    cout << sum << endl;
   }


Measured memory_bytes: 3632
#include <cstdio>
int main() {
	int n,k,x,y;
	scanf("%d",&n);
	scanf("%d",&k);
	for(int i=0;i<k;i++) {
		scanf("%d %d",&x,&y);
		x=(x>(n-x+1))?(n-x+1):x;
		y=(y>(n-y))?(n-y+1):y;
		if(1<=x&&x<=y)
			printf("%d\n",(x-1)%3+1);
		else
			printf("%d\n",(y-1)%3+1);
	}
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i,n) for(ll i = 0; i<(ll)(n); i++)
#define REPS(i,n) for (ll i = 1; i<=(ll)(n); i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define pb push_back
#define MOD 1000000007
#define MOD2 998244353
#define PI 3.141592653
#define INF 1000000000000000000 //14
#define N 1100

vector<vector<ll>> tv(N,vector<ll>(2));

bool jud(ll x, ll n){
    ll p = tv[n-1][0]*x;
    ll q = tv[n-1][1]*x;
    FORD(i,n-2,0){
        ll pp = p/tv[i][0];
        ll qq = q/tv[i][1];
        if (pp==0||qq==0) return false;
        ll rr = min(pp,qq);
        p = rr*tv[i][0];
        q = rr*tv[i][1];
    }
    return true;
}

int main(){
    ll n; cin >> n;
    REP(i,n) cin >> tv[i][0] >> tv[i][1];
    ll right = 0;
    ll left = INF/max(tv[n-1][0],tv[n-1][1]);
    while (left-right>1){
        ll mid = (right+left)/2;
        if (jud(mid,n)) left = mid;
        else right = mid;
    }
    cout << left*(tv[n-1][0]+tv[n-1][1]) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define fi first
#define se second
typedef long long ll;
typedef pair<int,int> P;
#define MOD 1000000007
#define INF 1000000000
int gcd(int a,int b){
	if(b==0)return a;
	return gcd(b,a%b);
}
int lcm(int a,int b){
	return a/gcd(a,b)*b;
}
int modpow(int a,int b){
    if(!b)return 1;
    if(b%2)return modpow(a,b-1)*a%MOD;
    return modpow(a,b/2)*modpow(a,b/2)%MOD;
}
int fac(int a){
    int Ans=1;
    for(int i=1;i<=a;i++){
        Ans*=i;
        Ans%=MOD;
    }
    return Ans;
}//kaijo
int comb(int a,int b){
    return fac(a)*modpow(fac(a-b),MOD-2)%MOD*modpow(fac(b),MOD-2)%MOD;
}
int main(){
	int a;
	cin>>a;
	if(a%111)cout<<((a/111)+1)*111<<endl;
	else cout<<a<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int dp[81][81][6400 * 2 + 1];
// because max distance that we can travel is to first go form start, go to last column in first row and then in last column, go till last
// row till we reach our destination, all other path distance will be less as they kind of form diagnal path.
int find_it(int dif_sum , int i , int j , int &n , int &m , vector<vector<pair<int , int>>> & matrix){
    if(i == n - 1 && j == m - 1){
        return min(abs(dif_sum + matrix[i][j].first - matrix[i][j].second) , abs(dif_sum + matrix[i][j].second - matrix[i][j].first));
    }
    if(dp[i][j][dif_sum] != -1){
        return dp[i][j][dif_sum];
    }
    int minvalue = INT_MAX;
    int ff = abs(dif_sum + matrix[i][j].first - matrix[i][j].second);
    int ss = abs(dif_sum + matrix[i][j].second - matrix[i][j].first);
    if(i + 1 < n){
        minvalue = min(minvalue , find_it(ff , i + 1 , j , n , m , matrix));
        minvalue = min(minvalue , find_it(ss , i + 1 , j , n , m , matrix));

    }
    if(j + 1 < m){
        minvalue = min(minvalue , find_it(ff , i , j + 1 , n , m , matrix));
        minvalue = min(minvalue , find_it(ss , i , j + 1 , n , m , matrix));
    }
    return dp[i][j][dif_sum] = minvalue;

}
int main(){

	ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int n , m;
    cin >> n >> m;
    vector<vector<pair<int , int> > > matrix(n , vector<pair<int , int>> (m));

    for(int i = 0; i < n; ++i){
        for(int j = 0; j < m; ++j){
            cin >> matrix[i][j].first;
        }
    }
    for(int i = 0; i < n; ++i){
        for(int j = 0; j < m; ++j){
            cin >> matrix[i][j].second;
        }
    }
    memset(dp , -1 , sizeof(dp));
    cout << find_it(0 , 0 , 0 , n , m , matrix);


return 0;
}


Measured memory_bytes: 328576
/**
 * Exhaustive Search
 * http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_5_A&lang=ja
 */

#include<iostream>
#include<vector>
using namespace std;

// 長さ n の数列 A 
int n;
vector <int>A(20); // n≤20

bool solve(int total, int index, int m) {
  // 合計が等しい。つまりmを作れる
  if (total == m) {
    return true;
  }
  // 長さを超えてしまった時点で、mを作ることはできない
  if (index >= n) {
    return false;
  }

  // A[index]を選んで加算するケースと、選ばず加算されないケースの両方を試行し、次の要素へ進める
  return solve(total, index + 1, m) || solve(total + A.at(index), index + 1, m);
}

int main() {
  // 長さ n の数列 A 
  // int n;
  cin >> n;
  // vector <int>A(n);
  for (int i = 0; i < n; i++) {
    cin >> A.at(i);
  }

  // 質問として q 個の mi が与えれる
  int q;
  cin >> q;
  // vector <int>m(n);
  for (int i = 0; i < q; i++) {
    // 足し合わせて作りたいm
    int m;
    cin >> m;

    // 0番目の要素から判定をスタートし、mを作れるかどうか
    if (solve(0, 0, m)) {
      cout << "yes" << endl;
    } else {
      cout << "no" << endl;
    }
  }
}



Measured memory_bytes: 3092
#include<map>
#include<list>
#include<queue>
#include<iostream>
#include<unordered_set>
#include<set>
#include<vector>
#include<cmath>

#define ull unsigned long long
#define ll long long
#define mp make_pair
#define imei(...)   "[ "<< #__VA_ARGS__ <<" = "<< __VA_ARGS__ <<" ] "

using namespace std;

void solve(int t) {
    int n;
    cin >> n;
}

int main(int argc, char *argv[])
{
    int target, n;
    set<int> s;
    priority_queue<pair<int, int>> pq;
    cin >> target >> n;
    int mx = 1e9+5;
    int ans = target;

    if (!n) {
        cout << target <<endl;
        return 0;
    }

    for (int i = 0; i < n; i++) {
        int val;
        cin >> val;
        s.insert(val);
    }

    for (int i = -200; i <= 200; i++) {
        if (s.find(i) != s.end()) continue;
        if (abs(i-target) < mx) {
            ans = i;
            mx = abs(i-target);
        }
    }

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


Measured memory_bytes: 3640
#define _USE_MATH_DEFINES

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>

using namespace std;

//typedef pair<long long int, long long int> P;

long long int INF = 1e18;
long long int MOD = 1e9 + 7;

vector<pair<int, int> > v[110000];

int main(){
	
	int N, M;
	cin >> N >> M;
	
	for(int i = 0; i < M; i++){
		int P, Y;
		cin >> P >> Y;
		
		pair<int, int> p;
		p.first = Y;
		p.second = i;
		
		v[P].push_back(p);
	}
	
	pair<int, int> ans[110000];
	
	for(int i = 1; i <= N; i++){
		sort(v[i].begin(), v[i].end());
		for(int j = 0; j < v[i].size(); j++){
			
			int index = v[i][j].second;
			ans[index].first = i;
			ans[index].second = j;
			
		}
	}
	
	for(int i = 0; i < M; i++){
		printf("%06d%06d\n", ans[i].first, ans[i].second + 1);
	}
	
	return 0;
}


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

int solve(int,int,int,int *);

int main(){
	int n, q, m, i;
	int *A;

	scanf("%d", &n);
	A = (int *)malloc(sizeof(int) * n);
	for(i = 0; i < n; i++)
		scanf("%d", &A[i]);
	scanf("%d", &q);
	for(i = 0; i < q; i++){
		scanf("%d", &m);
		if(solve(0, m, n, A))
			printf("yes\n");
		else
			printf("no\n");
	}

	free(A);
	return 0;
}

int solve(int i, int m, int n, int *A){
	int res;

	if(m == 0)
		return 1;
	if(i >= n)
		return 0;
	res = solve(i+1, m, n, A) || solve(i+1, m-A[i], n, A);
	return res;
}


Measured memory_bytes: 2104
/*COMPETITIVE PROGRAMMING C++ TEMPLATE */

#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <string>
#include <cmath>
#include <iostream>
#include <stack>
#include <queue>
#include <climits>
#include <iomanip>

#define all(x) x.begin(), x.end()
#define MOD 998244353

const long double PI = 3.141592653589793236L;

typedef long long int ll;
typedef long double ld;

using namespace std;
  
void solve()
{
   int x, y;
   cin >> x >> y;

   if(y - 2 * x >= 0 && (y - 2 * x) % 2 == 0 && 4 * x - y >= 0 && (4 * x - y) % 2 == 0)
   {
       cout << "Yes\n";
       return;
   }

   cout << "No\n";
}

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

    int T = 1;
    //cin >> T;
    
    while (T--)
    {
        solve();
    }
    
    return 0;
}



Measured memory_bytes: 3668
# coding: utf-8
# Your code here!

n=int(input())
a=0
b=0
for i in range(n):
    A,B=map(str,input().split())
    if A > B :
        a+=3
    if A < B :
        b+=3
    if A == B :
        a+=1
        b+=1
print(a,b)


Measured memory_bytes: 5600
#include <stdio.h>
#include <math.h>
#include <string.h>

int main(void)
{
    int n[6];
    char M[101];
    int length;

    for(int i = 0; i < 6; i++){
        scanf("%d", &n[i]);
    }
    scanf("%s", M);
    length = strlen(M);

    for(int j = 0; j < length; j++){
        if(M[j] == 'E'){
            int temp = n[3];
            n[3] = n[5];
            n[5] = n[2];
            n[2] = n[0];
            n[0] = temp;
        }
        else if(M[j] == 'N'){
            int temp = n[5];
            n[5] = n[4];
            n[4] = n[0];
            n[0] = n[1];
            n[1] = temp;
        }
        else if(M[j] == 'S'){
            int temp = n[5];
            n[5] = n[1];
            n[1] = n[0];
            n[0] = n[4];
            n[4] = temp;
        }
        else if(M[j] == 'W'){
            int temp = n[5];
            n[5] = n[3];
            n[3] = n[0];
            n[0] = n[2];
            n[2] = temp;
        }
    }
    printf("%d\n", n[0]);

    return (0);
}



Measured memory_bytes: 2100
m, n = map(int, input().split())
X = list(map(int, input().split()))
Y = list(map(int, input().split()))
X.sort()
Y.sort()
mod = 10**9 + 7
ax = 0
ay = 0
for ix, (x, x_) in enumerate(zip(X, X[::-1])):
    if x >= x_:
        break
    ax += ((x_ - x) % mod) * (m - 2 * ix - 1) % mod
    ax %= mod
for iy, (y, y_) in enumerate(zip(Y, Y[::-1])):
    if y >= y_:
        break
    ay += ((y_ - y) % mod) * (n - 2 * iy - 1) % mod
    ay %= mod
print(ax * ay % mod)

Measured memory_bytes: 97924
from collections import deque

s = deque(input())
n = int(input())

point = 0
for i in range(n):
  q = input().split()
  if q.pop(0)=='1':
    point = (point+1)%2
  else:
    _q = int(q.pop(0))-1
    if (point+_q)%2 == 0:
      s.appendleft(q.pop(0))
    else:
      s.append(q.pop(0))

if point == 1:
  s.reverse()

print(''.join(s))

Measured memory_bytes: 8692
n = int(input())
a = list(map(int,input().split()))
a.sort()
#print(n,a)

ans = 0
if n == 3:
    if a[0]^a[1] == a[2]:
        ans = 1
    else:
        ans = 0
elif n == 4:
    if a[0]==0 and a[1]==0 and a[2]==0 and a[3]==0:
        ans = 1
    else:
        ans = 0
else:
    tmp = []
    cnt = []
    for i in range(n):
        if i == 0:
            tmp.append(a[i])
            cnt.append(1)
        else:
            if a[i-1] == a[i]:
                cnt[-1] += 1
            else:
                tmp.append(a[i])
                cnt.append(1)
    if n % 3 != 0:
        if tmp[0] == 0 and cnt[0] == n:
            ans = 1
    else:
        if len(tmp) == 3:
            if cnt[0] == cnt[1] and cnt[1] == cnt[2] and tmp[0]^tmp[1] == tmp[2]:
                ans = 1
        if len(tmp) == 2:
            if tmp[0] == 0:
                if cnt[0]*2 == cnt[1]:
                    ans = 1
        if len(tmp) == 1:
            if tmp[0] == 0:
                ans = 1
if ans == 1:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 60784
#include <bits/stdc++.h>
using namespace std;
int l[15], r[15];
int sum[200005], add[200005];
const int mod = 998244353;
int main(){
    int n, k;
    scanf("%d%d", &n, &k);
    for(int i=1;i<=k;i++){
        scanf("%d%d", &l[i], &r[i]);
    }
    sum[1] = 1;
    for(int i=1;i<=n;i++){
        add[i] = (add[i] + add[i-1])%mod;
        sum[i] = (sum[i] + add[i])%mod;
        if(sum[i] > 0){
            for(int j=1;j<=k;j++){
                int mx = min(i+r[j], n), mn = i+l[j];
                if(mn <= mx){
                    add[mn] = (add[mn] + sum[i])%mod;
                    add[mx+1] = (add[mx+1] - sum[i] + mod)%mod;
                }
            }
        }
    }
    printf("%d\n", sum[n]);
}

Measured memory_bytes: 5316
package main

import "fmt"

func main() {
	var N, Y int

	fmt.Scanf("%d %d", &N, &Y)

	if Y > 10000*N {
		fmt.Println("-1 -1 -1")
		return
	}

	for x := 0; x <= N; x++ {
		for y := 0; x+y <= N; y++ {
			z := N - (x + y)
			if 10*x+5*y+z == Y/1000 {
				fmt.Printf("%d %d %d", x, y, z)
				return
			}
		}
	}

	fmt.Println("-1 -1 -1")
}


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


using namespace std;


#ifdef zxc

#include <sys/resource.h>
#include "debug.h"

#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

using ll = int64_t;
using ld = long double;
const ld EPS = 1e-10;
const ll MOD = 998244353;
const ld PI = 3.141592653589793;
const int maxn = 300001;

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

struct pt {
    ld x, y;

    pt operator+(const pt &rhs) {
        return {x + rhs.x, y + rhs.y};
    }

    pt operator-(const pt &rhs) {
        return {x - rhs.x, y - rhs.y};
    }

    ld norm() {
        return hypotl(x, y);
    }

    pt operator*(ld v) {
        return {x * v, y * v};
    }
};

bool close_dbl(ld a, ld b) {
    return abs(a - b) < EPS;
}

bool less_dbl(ld a, ld b) {
    return a < b && !close_dbl(a, b);
}

bool less_equal_dbl(ld a, ld b) {
    return a < b || close_dbl(a, b);
}

int close_lg(int n) { return n > 1 ? 32 - __builtin_clz(n - 1) : 0; }

ll add(ll a, ll b) {
    a += b;
    if (a >= MOD) {
        a -= MOD;
    }
    return a;
}

ll mul(ll a, ll b, ll m) {
    return a * b % m;
}

ll pw(ll a, ll b, ll m) {
    ll res = 1;
    for (; b; b >>= 1) {
        if (b & 1) {
            res = mul(res, a, m);
        }
        a = mul(a, a, m);
    }
    return res;
}

int h[maxn];

signed main() {
#ifdef zxc
    struct rlimit rl;
    const rlim_t kStackSize = 512L * 1024L * 1024L;
    assert(!getrlimit(RLIMIT_STACK, &rl));
    rl.rlim_cur = kStackSize;
    assert(!setrlimit(RLIMIT_STACK, &rl));
    freopen("../kolya_input.txt", "r", stdin);
//    freopen("../kolya_output.txt", "w", stdout);
#else
    //    mt19937 mt(std::chrono::high_resolution_clock::now().time_since_epoch().count());
    //            freopen("", "r", stdin);
    //        freopen("hack.out", "w", stdout);
#endif
    fast_io();
    cout.precision(9);
    cout << fixed;
    auto start = chrono::steady_clock::now();
    int n;
    cin >> n;
    vector<int> a(n);
    for (int &el:a) {
        cin >> el;
    }
    vector<int> prv(n);
    prv[0] = -1;
    for (int i = 1; i < n; ++i) {
        int cur = i - 1;
        while (cur != -1 && a[cur] > a[i]) {
            cur = prv[cur];
        }
        prv[i] = cur;
    }
    vector<int> nxt(n);
    nxt[n - 1] = n;
    for (int i = n - 2; i >= 0; --i) {
        int cur = i + 1;
        while (cur != n && a[cur] > a[i]) {
            cur = nxt[cur];
        }
        nxt[i] = cur;
    }
    ll ans = 0;
    for (int i = 0; i < n; ++i) {
        int l = prv[i];
        int r = nxt[i];
        ans += 1ll * a[i] * (i - l) * (r - i);
    }
    cout << ans;
    auto end = chrono::steady_clock::now();

    debug("time", chrono::duration_cast<chrono::milliseconds>(end - start).count() / 1000.0);

}



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

using namespace std;

long bit[111111];
int siz;
void add(int a, int n) {
	for (a++; a <= siz; a += a & -a)
		bit[a] += n;
}
long sum(int a) {
	long r = 0;
	for (; a; a &= a - 1)
		r += bit[a];
	return r;
}
int main() {
	string s;
	cin >> s;
	int a[26] = {};
	for (auto c : s)
		a[c - 'a']++;
	vector<int> t, p[26];
	long r = 0;
	for (int i = 0, j = 0; i < s.length(); i++) {
		int c = s[i] - 'a';
		if (a[c] < 1) {
			t.push_back(c);
			continue;
		}
		if (a[c] == 1) {
			r += i - j;
			a[c]--;
			continue;
		}
		r += i - j;
		p[c].push_back(j++);
		a[c] -= 2;
	}
	if (t.size() != s.length() / 2) {
		cout << -1 << endl;
		return 0;
	}
	siz = s.length() / 2;
	for (auto i : t) {
		r += sum(p[i].back());
		add(p[i].back(), 1);
		p[i].pop_back();
	}
	cout << r << endl;
	return 0;
}


Measured memory_bytes: 2300
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace B
{
    public class Program
    {
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            Solve();
            Console.Out.Flush();
        }

        public static void Solve()
        {
            var n = int.Parse(Console.ReadLine());
            var ta = Console.ReadLine().Trim().Split(' ').Select(double.Parse).ToArray();
            var hi = Console.ReadLine().Trim().Split(' ').Select(double.Parse).ToArray();
            var min = 100000.0;
            var answer = 0;
            for (var i = 0; i < hi.Length; i++)
            {
                var tmp = Math.Abs(ta[1] - (ta[0] - hi[i] * 0.006));
                if (tmp < min)
                {
                    min = tmp;
                    answer = i + 1;
                }
            }
            Console.WriteLine(answer);
        }
    }
}


Measured memory_bytes: 13396
import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		double r1 = sc.nextInt();
		double r2 = sc.nextInt();
		System.out.println(1.0 / (1.0 / r1 + 1.0 / r2));
	}
}


Measured memory_bytes: 24020
// g++ -std=c++14

/*
     
    Today might be the chance to grasp the chance to let your talent bloom.
    May be tomorrow, the day after, or next year...
    May be even when you are 30. I'm not sure if physique has anything to do with it
    but if you think that it will never come, it probably never will.
     
    - Tooru Oikawa.
     
    */

#include <bits/stdc++.h>

typedef long long ll;
typedef long double lld;
using namespace std;

#define endl "\n"
#define fi first
#define se second
#define pb(x) push_back(x)
#define mp(x, y) make_pair(x, y)
#define MEMS(a, b) memset(a, b, sizeof(a))
#define _                             \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
#define __                            \
    freopen("input.txt", "r", stdin); \
    freopen("output.txt", "w", stdout);
#define all(c) c.begin(), c.end()
#define inf 1000000000000000001
#define pii pair<int, int>
#define tr(...)                                       \
    cout << __FUNCTION__ << ' ' << __LINE__ << " = "; \
    trace(#__VA_ARGS__, __VA_ARGS__)

template <typename S, typename T>
ostream &operator<<(ostream &out, pair<S, T> const &p)
{
    out << '(' << p.fi << ", " << p.se << ')';
    return out;
}

template <typename T>
ostream &operator<<(ostream &out, vector<T> const &v)
{
    ll l = v.size();
    for (ll i = 0; i < l - 1; i++)
        out << v[i] << ' ';
    if (l > 0)
        out << v[l - 1];
    return out;
}

template <typename T>
void trace(const char *name, T &&arg1) { cout << name << " : " << arg1 << endl; }

template <typename T, typename... Args>
void trace(const char *names, T &&arg1, Args &&... args)
{
    const char *comma = strchr(names + 1, ',');
    cout.write(names, comma - names) << " : " << arg1 << " | ";
    trace(comma + 1, args...);
}

#define int ll

void solve()
{
    int n;
    cin >> n;
    while(n) {
        int r = n % 10;
        n /= 10;
        if(r == 7) {
            cout << "Yes\n";return;
        }
    }
    cout << "No\n";

}
int32_t main()
{
    _
        ll t;
    // cin >> t;
    t = 1;
    while (t--)
        solve();
}

Measured memory_bytes: 3648
def find_index(l,x,default=-1):
    return l.index(x) if x in l else default

def base_10_to_n(X, n):
    if (int(X/n)):
        return base_10_to_n(int(X/n), n)+str(X%n)
    return str(X%n)


def main():
    n,A,B,C = map(int, input().split())
    l = [int(input()) for _ in range(n)]

    ans = 10**9
    for i in range(4**n):
        a = 0
        b = 0
        c = 0
        no_use = 0
        temp = 0
        status = base_10_to_n(i,4)
        status = status.zfill(n)
        status = list(map(int,list(status)))
        for j in range(n):
            if status[j] == 0:
                a += l[j]
                temp += 10
            if status[j] == 1:
                b += l[j]
                temp += 10
            if status[j] == 2:
                c += l[j]
                temp += 10
            if status[j] == 3:
                no_use += l[j]
        if a==0 or b==0 or c==0:
            continue
        temp += abs(A-a)+abs(B-b)+abs(C-c)-30
        ans = min(ans,temp)
    print(ans)


if __name__ == '__main__':
    main()


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

using namespace std;
using int64 = long long;

constexpr int DEBUG = 0;

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

  int n, m;
  cin >> n >> m;
  vector<int64> xs(n);
  for (int i = 0; i < n; i++) {
    cin >> xs[i];
  }

  priority_queue<int64> pq;
  for (int64 x : xs) pq.push(x);

  for (int i = 0; i < m; i++) {
    int64 x = pq.top();
    pq.pop();
    pq.push(x / 2);
  }

  int64 sum = 0;
  while (!pq.empty()) {
    sum += pq.top();
    pq.pop();
  }
  cout << sum << endl;
}

Measured memory_bytes: 2168
import sys
sys.setrecursionlimit(10**6)

class MergeFind:
    def __init__(self, N):
        self.par = list(range(N))
        self.num_sets = N

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

    def unite(self, x, y):
        rx = self.root(x)
        ry = self.root(y)
        if rx == ry:
            return
        else:
            self.par[rx] = ry
            self.num_sets -= 1

    def same(self, x, y):
        return self.root(x) == self.root(y)

    def get_num_sets(self):
        return self.num_sets

def solve3():
    N, M = [int(_) for _ in raw_input().split()]
    Tree = MergeFind(N)
    for i in range(M):
        Xi, Yi, Zi = [int(_) for _ in raw_input().split()]
        Xi -= 1
        Yi -= 1
        Tree.unite(Xi, Yi)
    print Tree.get_num_sets()

if __name__ == '__main__':
    solve3()


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

int main(){
    int A, B, K, i;

    cin >> A;
    cin >> B;
    cin >> K;

    for (i=1; i<=K; i++){
        if (i % 2){ // odd
            if (A % 2) A--;
            B += A / 2;
            A = A / 2;
        }
        else {
            if (B % 2) B--;
            A += B / 2;
            B = B / 2;
        }
    }

    cout << A << ' ' << B << '\n';

}

Measured memory_bytes: 256
<?php
	$n = fgets(STDIN);

	for ($i = 1; $i <= $n; $i++) {
		$x = $i;
		if ($x % 3 == 0) {
			echo " $i";
			continue;
		}

		for (; $x; $x /= 10) {
			if ($x % 10 == 3) {
				echo " $i";
				break;
			}
		}
	}

	print "\n";

Measured memory_bytes: 6552
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
const int INF=1e9,MOD=1e9+7,ohara=1e6+10;
const ll LINF=1e18;
using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout<<(x)<<endl
#define doublecout(a) cout<<fixed<<setprecision(15)<<a<<endl;
#define Cerr(x) cerr<<(x)<<endl
#define fi first
#define se second
#define P pair<ll,ll> 
#define m_p make_pair
#define V vector<ll> 
#define U_MAP unordered_map<ll,ll>

ll n,cnt,ans,a[ohara],b,c,d,tmp,tmpp,m,h,w,x,y,sum,pos,k;
ld doua;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
//int dy[]={-1,0,1,-1,1,-1,0,1};
//int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl;
struct edge{int to,cost;};

//-------------------------↓↓↓↓↓↓------------------------

//------ 自分を天才だと信じる ------

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

    cin>>n;
    rep(i,2*n)cin>>a[i];
    sort(a,a+2*n);
    for(int i=0;i<2*n;i+=2){
        ans+=a[i];
    }
    Cout(ans);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  vector <int>vec(3);
  for (int i = 0; i< 3;i++){
  cin >> vec.at(i);
  }
  sort(vec.begin(),vec.end());
  cout << vec.at(2) - vec.at(0);
}


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

int main() {
  int N;
  cin >> N;
  vector<vector<int>> F(N, vector<int>(10));
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < 10; j++) {
      cin >> F.at(i).at(j);
    }
  }
  vector<vector<int>> P(N, vector<int>(11));
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < 11; j++) {
      cin >> P.at(i).at(j);
    }
  }
  int ans = -1e9;
  for (int bit = 0; bit < 1 << 10; bit++) {
    if (__builtin_popcount(bit) == 0) continue;
    int tmp = 0;
    for (int i = 0; i < N; i++) {
      int cnt = 0;
      for (int j = 0; j < 10; j++) {
        if (bit >> j & 1 && F.at(i).at(j)) cnt++;
      }
      tmp += P.at(i).at(cnt);
    }
    ans = max(ans, tmp);
  }
  cout << ans << "\n";
}

Measured memory_bytes: 3644
#include <functional>
#include <algorithm>
#include <iostream>
#include <numeric>
#include <iomanip>
#include <utility>
#include <cstdlib>
#include <sstream>
#include <bitset>
#include <vector>
#include <cstdio>
#include <ctime>
#include <queue>
#include <deque>
#include <cmath>
#include <stack>
#include <list>
#include <map>
#include <set>

using namespace std;

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

#define dump(x)  cerr << #x << " = " << (x) << endl
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back


int main() {
    int h,w;
    while(cin>>h>>w){
        if(h==0 && w==0)break;
        
        char fie[200][200]={};
        rep(i,h) rep(j,w) cin>>fie[i][j];
        
        int y=0,x=0;
        bool visited[200][200]={};
        while(1){
            if(fie[y][x]=='.')break;
            else if(visited[y][x]){
                cout<<"LOOP"<<endl;
                goto next;
            }
            visited[y][x]=true;
            
            int here=fie[y][x];
            if(here=='>')x++;
            else if(here=='<')x--;
            else if(here=='^')y--;
            else if(here=='v')y++;
            else cout<<"error"<<endl;
            
        }
        cout<<x<<" "<<y<<endl;
        next:;
    }
    
    return 0;
}

Measured memory_bytes: 1244