akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <cassert>
#include <chrono>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int, pii> pipii;
typedef vector<vector<ll>> matrix;

int n, k;
int mask[100005];
int util[100005];

ll sumOf(int match) {
  ll ret = 0;
  for(int i = 0; i < n; i++) {
    if((mask[i] & match) == mask[i]) ret += util[i];
  }
  return ret;
}

void solve() {
  cin >> n >> k;
  for(int i = 0; i < n; i++) cin >> mask[i] >> util[i];
  ll ret = sumOf(k);
  for(int bit = 1; bit < 30; bit++) {
    if(k&(1<<bit)) {
      int off = (1<<bit)-1;
      int nextM = k ^ (1<<bit) | off;
      ret = max(ret, sumOf(nextM));
    }
  }
  cout << ret << "\n";
}

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


Measured memory_bytes: 1152
#include<bits/stdc++.h>
#define rep(i,a,n) for(int i=a;i<=n;i++)
#define per(i,a,n) for(int i=n;i>=a;i--)
#define pb push_back
#define mp make_pair
#define FI first
#define SE second
#define maxn 30
#define mod 1000000007
#define inf 0x3f3f3f3f
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef double db;

int x[maxn+5],y[maxn+5],w[maxn+5];
int idx[20010],idy[20010];

vi lst[20][20];

int main()
{
    int N; scanf("%d",&N);
    int n=0,m=0;
    rep(i,1,N) scanf("%d%d%d",&x[i],&y[i],&w[i]);

    rep(i,1,N) rep(j,i+1,N) if(y[i]>y[j])
    {
        swap(x[i],x[j]);
        swap(y[i],y[j]);
        swap(w[i],w[j]);
    }

    vi A,B;
    rep(i,1,N) A.pb(x[i]);
    rep(i,1,N) B.pb(y[i]);
    sort(A.begin(),A.end()); A.erase(unique(A.begin(),A.end()),A.end());
    sort(B.begin(),B.end()); B.erase(unique(B.begin(),B.end()),B.end());
    for(auto xx: A) idx[xx+10000]=n++;
    for(auto yy: B) idy[yy+10000]=m++;

    rep(i,0,N) rep(j,0,(1<<i)-1) lst[i][__builtin_popcount(j)].pb(j);
    rep(k,0,N)
    {
        ll ans=1ll<<60;
        rep(i,0,k) 
        {
            for(auto s: lst[n][i]) 
            {
                //printf("!! %d\n",s);
                bool mark[20]={};
                vi X;
                rep(z,1,N) if(((s>>idx[x[z]+10000])&1)==0) mark[idy[y[z]+10000]]=1; else X.pb(x[z]);
                vector<pii> ch;
                rep(z,1,N) if(((s>>idx[x[z]+10000])&1)==0)
                {
                    int d=inf;
                    for(auto xx: X) d=min(d,abs(xx-x[z]));
                    ch.pb(mp(z,d));
                }
                vi Y;
                rep(j,0,m-1) if(mark[j]) Y.pb(B[j]);
                int M=(int)Y.size();
                if(M<=k-i) {ans=0; break;}
                //printf("# %d, %d\n",M,k-i);
                for(auto t: lst[M][k-i])
                {
                    //printf("??? %d\n",t);
                    vi tmp;
                    rep(j,0,M-1) if((t>>j)&1) tmp.pb(Y[j]);
                    ll sum=0;
                    int ptr=0;
                    for(auto it: ch)
                    {
                        int id=it.FI;
                        int d=min(abs(x[id]),abs(y[id]));
                        d=min(d,it.SE);
                        while(ptr<k-i && tmp[ptr]<y[id]) ptr++;
                        if(ptr!=0) d=min(d,abs(y[id]-tmp[ptr-1]));
                        if(ptr!=k-i) d=min(d,abs(y[id]-tmp[ptr]));
                        //for(auto xx: X) d=min(d,abs(x[id]-xx));
                    //rep(j,0,M-1) if((t>>j)&1) d=min(d,abs(Y[j]-y[id]));
                        //printf("?? %d %d\n",d,w[id]);
                        sum+=1ll*d*w[id];
                    }
                    ans=min(ans,sum);
                }
            }
        }
        printf("%lld\n",ans);
    }
    return 0;
}

Measured memory_bytes: 4048
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 M = long.Parse(str[1]);
		string ans = "No";
		if(N==M){
			ans = "Yes";
		}
		Console.WriteLine(ans);
	}
}

Measured memory_bytes: 13140
#include <stdio.h>

int main(void){
	int a,b;//??¶?????°????????°
	scanf("%d %d",&a,&b);
	int s[a];//??¶????????????
	int t[b];//???????????????
	
	int x=0;
	int y=0;
	int u[a];
	
	int i,j;
	for (i=0;i<a;i++){
		scanf("%d",&s[i]);
		u[i]=0;
	}
	for(i=0;i<b;i++){
		scanf("%d",&t[i]);
	}
	
	for (i=0;i<b;i++){
		for (j=0;j<a;j++){
			if (t[i]>=s[j]){
				break;
			}
		}
		u[j]++;
	}
	
	for (i=0;i<a;i++){
		if (x<u[i]){
			x=u[i];
			y=i;
		}
	}
	
	printf("%d\n",y+1);
	
	return 0;
}

Measured memory_bytes: 608
min_ = 10
ans = 0

for _ in range(5):
    t = int(input())
    a = t // 10
    b = t % 10
    if b == 0:
        ans += a * 10
    else:
        ans += (a + 1) * 10
        min_ = min(min_, b)

print(ans - 10 + min_)

Measured memory_bytes: 3060
def main():
    k = int(input())
    for n in range(50, 1, -1):
        clear = k // n + 1
        additional = n - k % n
        a = clear + n - 1
        if(a >= 0 and a <= 10**16 + 1000):
            lst = [a] * n
            for i in range(additional):
                m = max(lst)
                forbidden = -1
                for i, item in enumerate(lst):
                    if(item == m):
                        forbidden = i
                        lst[i] -= n
                        break
                for i in range(len(lst)):
                    if(i != forbidden):
                        lst[i] += 1
            print(n)
            print(' '.join([str(item) for item in lst]))
            return 0
main()


Measured memory_bytes: 3064
#include<iostream>
using namespace std;
int main(){
    int menu;
    int los=0,ten=0;
    int last=0;
    for(int i=1;i<=5;i++){
        cin >> menu;
        ten += menu/10;
        if(menu/10*10<menu){
            ten++;
        }
        if(last < 10 - menu%10 && menu%10!=0){
            last  =  10 - menu%10;
        }
    }
    cout << ten*10 - last << endl;
}

Measured memory_bytes: 256
import sys
import itertools
# import numpy as np
import time
import math
 
sys.setrecursionlimit(10 ** 7)
 
from collections import defaultdict
 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N = int(readline())
A = list(sorted(map(int, readline().split())))

amax = max(A)
dp = [True] * (amax + 1)
count = [0] * (amax + 1)

for a in A:
    count[a] += 1
    b = 2 * a
    while b <= amax:
        dp[b] = False
        b += a

ans = 0
for a in A:
    if count[a] > 1:
        continue
    if dp[a]:
        ans += 1
print(ans)


Measured memory_bytes: 34556
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

int main() {
	map<ll,ll>ch;
	for(ll i=0;i<3;i++){
		ll now;
		cin>>now;
		ch[now]++;
	}
	for(auto itr=ch.begin();itr!=ch.end();itr++){
		ll val=itr->first;
		ll num=itr->second;
		if(num==2){
			cout <<"Yes";
			return 0;
		}
	}
	cout << "No";
	// your code goes here
	return 0;
}

Measured memory_bytes: 3596
#include <iostream>

using namespace std;

int main()
{
  int N, M;
  cin >> N >> M;
  
  int ans = -1;
  for (int i = 1; i * i <= M; i++) {
    if (M % i == 0) {
      int tmp = M / i;
      if (M / i >= N) ans = max(ans, i);
      if (M / tmp >= N) ans = max(ans, tmp);
    }
  }
  cout << ans << endl;
  
  return 0;
}


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

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

  vector<int> a(1, x);
  for (int i=0; i<n; i++) {
    int t;
    cin >> t;
    a.push_back(t);
  }

  
  vector<int> b(1, y);
  for (int i=0; i<m; i++) {
    int t;
    cin >> t;
    b.push_back(t);
  }
  
  if (*max_element(a.begin(), a.end())<*min_element(b.begin(), b.end())) cout << "No War";
  else cout << "War";
}

Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <string>

using namespace std;

class Dice {
	public:
		map<char, int> dice;
		Dice(int _I, int _II, int _III, int _IV, int _V, int _VI);
		int GetNumber(char c);
		void roll_E();
		void roll_N();
		void roll_S();
		void roll_W();
		void turn_R();
		void turn_L();
};

Dice::Dice(int _I, int _II, int _III, int _IV, int _V, int _VI) {
	dice['T'] = _I;
	dice['S'] = _II;
	dice['E'] = _III;
	dice['W'] = _IV;
	dice['N'] = _V;
	dice['B'] = _VI;
}

int Dice::GetNumber(char c) {
	return dice[c];
}

void Dice::roll_E() {
	map<char, int> tmp = dice;	
	dice['T'] = tmp['W'];
	dice['E'] = tmp['T'];
	dice['W'] = tmp['B'];
	dice['B'] = tmp['E'];
}

void Dice::roll_N() {
	map<char, int> tmp = dice;	
	dice['T'] = tmp['S'];
	dice['S'] = tmp['B'];
	dice['N'] = tmp['T'];
	dice['B'] = tmp['N'];
}

void Dice::roll_S() {
	map<char, int> tmp = dice;	
	dice['T'] = tmp['N'];
	dice['S'] = tmp['T'];
	dice['N'] = tmp['B'];
	dice['B'] = tmp['S'];
}

void Dice::roll_W() {
	map<char, int> tmp = dice;	
	dice['T'] = tmp['E'];
	dice['E'] = tmp['B'];
	dice['W'] = tmp['T'];
	dice['B'] = tmp['W'];
}

void Dice::turn_R() {
	map<char, int> tmp = dice;	
	dice['S'] = tmp['W'];
	dice['E'] = tmp['S'];
	dice['W'] = tmp['N'];
	dice['N'] = tmp['E'];
}

void Dice::turn_L() {
	map<char, int> tmp = dice;	
	dice['S'] = tmp['E'];
	dice['E'] = tmp['N'];
	dice['W'] = tmp['S'];
	dice['N'] = tmp['W'];
}

int main() {
	int I, II, III, IV, V, VI;
	cin >> I >> II >> III >> IV >> V >> VI;
	Dice d1(I, II, III, IV, V, VI);
	cin >> I >> II >> III >> IV >> V >> VI;
	Dice d2(I, II, III, IV, V, VI);

	string r = "NNNNWNNNENNNENNNWNNNWNNN";
	for (unsigned int i = 0; i < r.size(); i++) {
		if (r[i] == 'S') {
			d2.roll_S();
		}
		if (r[i] == 'E') {
			d2.roll_E();
		}
		if (r[i] == 'W') {
			d2.roll_W();
		}
		if (r[i] == 'N') {
			d2.roll_N();
		}
		if (d1.dice['T'] == d2.dice['T'] and d1.dice['E'] == d2.dice['E'] and d1.dice['W'] == d2.dice['W'] and d1.dice['N'] == d2.dice['N'] and d1.dice['S'] == d2.dice['S'] and d1.dice['B'] == d2.dice['B']) {
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
	// std::cout << "\e[38;5;0m\e[48;5;40m --- end ---  \e[m" << std::endl; // debug
	return 0;
}



Measured memory_bytes: 3236
#include <bits/stdc++.h>
using namespace std;
int main(){
    int a,b;
    cin>>a>>b;
    int count=1;
    for(int i=1;i<1500;i++){
        int pre=i*0.08;
        int pro=i*0.1;
        if(pre==a && pro==b){
            cout<<i<<endl;
            count=0;
            break;
        }
    }
    if(count){
        cout<<"-1"<<endl;
    }
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.TreeMap;

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		int[] x = new int[n];
		int[] y = new int[n];
		for (int i = 0; i < n; i++) {
			String[] sa = br.readLine().split(" ");
			x[i] = Integer.parseInt(sa[0]);
			y[i] = Integer.parseInt(sa[1]);
		}
		br.close();

		double p2 = Math.PI * 2;
		for (int i = 0; i < n; i++) {
			TreeMap<Double, Double> map = new TreeMap<>();
			map.put(0d, p2);
			for (int j = 0; j < n; j++) {
				if (i != j) {
					double d = Math.atan2(y[j] - y[i], x[j] - x[i]);
					d += Math.PI / 2 + p2;
					d %= p2;
					if (d <= Math.PI) {
						double d2 = d + Math.PI;
						Double l = map.lowerKey(d);
						Double l2 = map.lowerKey(d2);
						if (l2 != null) {
							if (l != l2) {
								map.put(l2, Math.min(d2, map.get(l2)));
							}
						}
						if (l != null) {
							if (map.get(l) > d) {
								map.put(d, Math.min(d2, map.get(l)));
							}
							map.remove(l);
						}
						Double h2 = map.ceilingKey(d2);
						if (h2 != null) {
							map.remove(h2);
						}
					} else {
						double d2 = d - Math.PI;
						Double l = map.lowerKey(d);
						Double l2 = map.lowerKey(d2);
						Double h = map.ceilingKey(d);
						if (l != null) {
							if (l == l2) {
								if (map.get(l) > d) {
									map.put(d, Math.min(p2, map.get(l)));
								}
							} else {
								if (h == null) {
									if (map.get(l) > d) {
										map.put(d, Math.min(p2, map.get(l)));
									}
								}
								map.remove(l);
							}
						}
						if (l2 != null) {
							map.put(l2, Math.min(d2, map.get(l2)));
						}
					}
				}
			}
			double val = 0;
			for (Double d : map.keySet()) {
				if (map.get(d) < d) {
					throw new Exception();
				}
				val += map.get(d) - d;
			}
			System.out.println(val / p2);
		}
	}
}


Measured memory_bytes: 23988
n, k = map(int, input().split())
a = input().split()
d = [int(m) for m in a]
aset = set(a)
i = n
while True:
    k = list(str(i))
    klen = len(k)
    for j in range(klen):
        if k[j] in aset:
            i += 10 ** (klen - j - 1)
            i -= i % (10 ** (klen - j - 1))
            break
    else:
        print(i)
        exit()

Measured memory_bytes: 3064
import numpy as np

# 入力
#Alist = [input().split() for l in range(3)]
A = np.array([list(map(int,input().split())) for l in range(3)])

N = int(input())

b = [int(input()) for i in range(N)]

for bi in b:
    A = np.where(A==bi,0,A)

counter = 0

for i in range(3):
    if sum(A[i,:]) == 0:
        counter = 1

for i in range(3):
    if sum(A[:,i]) == 0:
        counter = 1

if np.trace(A) == 0 or np.trace(A[::-1]) == 0:
    counter = 1

if counter == 1:
    print("Yes")
else:
    print("No")
    

Measured memory_bytes: 12452
#include<iostream>
#include<algorithm>
#include<set>

using namespace std;

int main(){
  multiset<char> ms;
  char S[123];
  cin>>S;
  for(auto p=S;*p;p++){
    ms.insert(*p);
  }
  int ans=0;
  while(!ms.empty()){
    auto it=ms.begin();
    char c=*it;
    int cn=1;
    for(;;){
      ms.erase(it);
      it=ms.find(c+1);
      if(it==ms.end())break;
      c++;
      cn++;
    }
    ans+=min(3,cn);
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 1176
<?php
  $n = trim(fgets(STDIN));
  $a = explode(" " , trim(fgets(STDIN)));
  $cnt=array_fill(0,10**5+5,0);
  $total = 0;
  for($i=0; $i<$n; $i++){
      $cnt[$a[$i]]++;
      $total += $a[$i];
  }
  
  $q = trim(fgets(STDIN));
  for($i=0; $i<$q; $i++){
      fscanf(STDIN, "%d%d", $b, $c);
      $total -= $b*$cnt[$b];
      $total += $c*$cnt[$b];
      $cnt[$c] += $cnt[$b];
      $cnt[$b] = 0;
      echo $total."\n";
  }

Measured memory_bytes: 25788
#include <iostream>
#include <vector>
#include <string>
#include <math.h>
#include <algorithm>
#include <set>
#include <iomanip>
#include <stdio.h>
#include <sstream>
#include <string>
using namespace std;
int main(void){
  char a,b;
  cin>>a>>b;
  if(a=='H'){
    cout<<b<<endl;
  }else{
    if(b=='H'){
      cout<<'D'<<endl;
    }else{
      cout<<'H'<<endl;
    }
  }
}

Measured memory_bytes: 256
#include <cstdio>
#include <queue>

int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  std::vector<int> parent(n, -1);
  std::vector<std::vector<int>> edges(n);
  std::vector<int> deg(n);
  for (int i = 1; i < n + m; ++i) {
    int a, b;
    scanf("%d%d", &a, &b);
    --a, --b;
    deg[b]++;
    edges[a].push_back(b);
  }
  std::vector<int> queue;
  for (int i = 0; i < n; ++i) {
    if (deg[i] == 0) queue.push_back(i);
  }
  for (size_t i = 0; i < queue.size(); ++i) {
    int u = queue[i];
    for (auto &v: edges[u]) {
      parent[v] = u;
      if (--deg[v] == 0) queue.push_back(v);
    }
  }
  for (int i = 0; i < n; ++i) {
    printf("%d\n", parent[i] + 1);
  }
  return 0;
}


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

int main(){
	int n; cin>>n;
	vector<int> v(10001);
	for(int x=1; x<101; x++){
		for(int y=1; y<101; y++){
			for(int z=1; z<101; z++){
				int a=x*x+y*y+z*z+x*y+y*z+z*x;
				if (a<10001) v[a]+=1;
			}
		}
	}
	rep(i,n) cout<<v[i+1]<<endl;
}

Measured memory_bytes: 3640
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
long long n,ans,black;
char s[200005];
int main(){
    scanf("%s",s);
    n=strlen(s);
    for(int i=0;i<n;i++)
        if(s[i]=='B') black++;
        else ans+=black;
    printf("%lld\n",ans);
    return 0;
}

Measured memory_bytes: 384
S=input()
aa=int(S[:2])
bb=int(S[2:])

a=False
b=False

if aa!=0 and aa<=12:
    a=True

if bb!=0 and bb<=12:
    b=True
    
#print(a,b,bb)
    
if a and b:
    ans="AMBIGUOUS"
elif a and not b:
    ans="MMYY"
elif not a and b:
    ans="YYMM"
else:
    ans="NA"
    
print(ans)

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

public class Main {

	public static void main(String[] args) throws IOException {
		// TODO ?????????????????????????????????????????????
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		while(true){
			String input = br.readLine();
			
			if(input == null){
				break;
			}
			
			System.out.println(Solver.solve(input));
		}
	}

}

class Solver {
	
	public static String solve(String str){
		char[] inputCharArray = str.toCharArray();
		
		String newString = null;
		for(int i = 0; i < 26; i++){
			newString = makeNewString(inputCharArray, i);
			
			//System.out.println(newString);
			if(newString.contains("this ") || newString.contains("that ") || newString.contains("the ")
					|| newString.contains("this.") || newString.contains("that.") || newString.contains("the.")){
				break;
			}
		}
		
		return newString;
	}
	
	private static String makeNewString(char[] array, int n){
		char [] tmpArray = new char[array.length];
		for(int i = 0; i < array.length ;i++){
			if(Character.isAlphabetic(array[i])){
				tmpArray[i] = (char) (array[i] + n);
				if(tmpArray[i] > 'z'){
					tmpArray[i] -= 26;
				}
			}
			else {
				tmpArray[i] = array[i];
			}
		}
		
		return new String(tmpArray);
	}
}

Measured memory_bytes: 24224
#define _USE_MATH_DEFINES
#include<iostream>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<string>
#include<set>
#include<map>
#include<stdbool.h>
#include<math.h>
#include<sstream>
#include<math.h>
#include<vector>
#include<functional>
#include<queue>
#include<utility>
#include<bitset>
typedef long long ll;
#define N (1000000000+7)
#define INF 1e10
using namespace std;
typedef pair<ll, ll> P;
int dx[4] = { 1,0,-1,0 };
int dy[4] = { 0,1,0,-1 };
class UnionFind {
public:
	vector<int>par, rank, node;//親、木の高さ、連結成分の大きさ
	//Constructer
	UnionFind(int n) :par(n), rank(n, 0),node(n,1) {
		for (int i = 0;i < n;i++)par[i] = i;
	}
	void init(int n) {
		for (int i = 0;i < n;i++) {
			par[i] = i;
			rank[i] = 0;
			node[i] = 1;
		}
	}

	int find(int x) {
		return par[x] == x ? x : par[x] = find(par[x]);
	}

	bool same(int x, int y) {
		return find(x) == find(y);
	}

	void unite_tree(int x, int y) {
		x = find(x);
		y = find(y);
		if (x == y)return;
		if (rank[x] < rank[y]) {
			par[x] = y;
		}
		else {
			par[y] = x;
			if (rank[x] == rank[y])rank[x]++;
		}
	}
	int size(int x) {
		return node[find(x)];
	}

	void unite_node(int x, int y) {
		x = find(x);
		y = find(y);
		if (x == y)return;
		if (size(x) < size(y))swap(x, y);
		node[x] += node[y];
		par[y] = par[x];
	}
};

ll ans[100010];

int main(void){
	int a, b, c;
	cin >> a >>b >> c;
	if (a + b >= c)cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
#[allow(unused_imports)]
use std::io::{BufWriter, Write};

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

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

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

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

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

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

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

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

fn solve() {
    input!(
        n: usize,
        m: usize,
        c: i32,
        b: [i32; m],
        a: [[i32; m]; n],
    );


    let mut ans = 0;
    for i in 0..n {
        let mut tmp = c as i32;
        for j in 0..m {
            tmp += a[i][j] * b[j];
        }
        ans += if tmp > 0 {1} else {0};
    }
    println!("{}", ans);
}

fn main() {
    let stack_size = 1 << 28;
    let thd = std::thread::Builder::new().stack_size(stack_size);
    thd.spawn(|| solve()).unwrap().join().unwrap();
}


Measured memory_bytes: 8572
from math import sqrt

def digitsum(b,n):
    if b>n:
        return n
    else:
        return digitsum(b,n//b)+n%b

def divisors(M):#Mの約数列 O(n^(0.5+e))
    import math
    d=[]
    i=1
    while math.sqrt(M)>=i:
        if M%i==0:
            d.append(i)
            if i**2!=M:
                d.append(M//i)
        i=i+1
    d.sort()
    return d

n=int(input());s=int(input())
if 0>n-s:
    print(-1)
else:
    m=int(sqrt(n))
    for b in range(2,m+1):
        if digitsum(b,n)==s:
            print(b)
            break
    else:
        d=divisors(n-s)
        for i in d:
            if i>=m and s>=(n-s)//i and i+1>(s-(n-s)//i):
                print(i+1)
                break
        else:
            if n==s:
                print(n+1)
            else:
                print(-1)


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

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




Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define INF (1<<30)
#define INFLL (1ll<<60)
typedef pair<int, int> PII;
#define MOD (1000000007ll)

int main(void){
	char x,y;
	cin >> x >> y;
	if(x>y){
		cout << ">" << endl;
	}else if(x<y){
		cout << "<" << endl;
	}else{
		cout << "=" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int healthA = sc.nextInt();
        int attackB = sc.nextInt();
        int healthC = sc.nextInt();
        int attackD = sc.nextInt();
        
        boolean isTakahashiWin;
        while(true){
            healthC -= attackB;
            if(healthC <= 0){
                isTakahashiWin = true;
                break;
            }
            healthA -= attackD;
            if(healthA <= 0){
                isTakahashiWin = false;
                break;
            }
        }
        System.out.println(isTakahashiWin == true ? "Yes" : "No");
    }
}

Measured memory_bytes: 35820
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll INF = 100000000;
#define rep1(i, n) for (ll i=0; i<(n); i++) 
#define rep2(i, k, n) for (ll i=k; i<(n); i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }


int main() {
    ll h, w;
    cin >> h >> w;
    vector<vector<ll> > c(10, vector<ll>(10)), d(10, vector<ll>(10, INF));
    vector<vector<ll> > a(h, vector<ll>(w));
    rep1(i, 10) rep1(j, 10) cin >> c[i][j];
    ll change;
    rep1(k, 10) rep1(i, 10) rep1(j, 10){
        c[i][j] = min(c[i][j], c[i][k]+c[k][j]);
    }
    ll ans = 0;
    rep1(i, h) rep1(j, w){
        ll a;
        cin >> a;
        if (a==-1) continue;
        ans += c[a][1];
    }
    cout << ans << endl;
    //printf("%.12f", ans);
}

Measured memory_bytes: 3920
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const int mod = 1000000007;
ll ans;
vector<int> seen;
int n,k;

ll perm(ll a, ll b){
    ll x = 1;
    rep(i,b){
        (x*=a-i)%=mod;
    }
    return x;
}

void dfs(vector<vector<int>> &G,int p, int dep){
    seen[p] = dep;
    if(k-min(dep,2)<G[p].size()-min(dep-1,1)){ans = 0; return;}
    ans *= perm(k-min(dep,2),G[p].size()-min(dep-1,1));
    ans %= mod;
    for(int next:G[p]){
        if(seen[next]!=-1)continue;
        else dfs(G,next, dep+1);
    }
    return;
}

int main(){
    cin >> n >> k;
    vector<vector<int>> G(n);
    rep(i,n-1){
        int a, b;
        cin >> a >> b;
        a--;b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    ans = k;
    seen.resize(n,-1);
    dfs(G,0,1);
    cout << ans << endl;
    return 0;
}

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

using namespace std;

#define int long long
const double PI = 3.14159265358979323846;
typedef vector<int> vint;
typedef pair<int, int> pint;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
// cout << fixed << setprecision(20);

int N;
int A[220000];

signed main() {
    cin >> N;
    for (int i = 0; i < N; i++)cin >> A[i];
    for (int i = 1; i < N; i++)if (A[i - 1] >= A[i])goto aoba;
    cout << 1 << endl;
    return 0;
    aoba:;
    int lb = 1, ub = N + 1;
    while (ub - lb > 1) {
        int mid = (lb + ub) / 2;
        map<int, int> mp;
        for (int i = 1; i < N; i++) {
            if (A[i - 1] >= A[i]) {
                for (auto it = mp.upper_bound(A[i]);
                     it->first <= A[i - 1] && it != mp.end(); it = mp.upper_bound(A[i])) {
                    mp.erase(it);
                }
                for (int j = A[i]; j > 0; j--) {
                    if (mp[j] == mid - 1)mp.erase(j);
                    else {
                        mp[j]++;
                        goto umiko;
                    }
                }
                lb = mid;
                goto nene;
            }
            umiko:;
        }
        ub = mid;
        nene:;
    }
    cout << ub << endl;
}


Measured memory_bytes: 1792
using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
class Solve{
    bool[,] Map;
    List<int>[] G;
    List<int>[] O;
    public Solve(){}
    StringBuilder sb;
    public static int Main(){
        new Solve().Run();
        return 0;
    }
    void Run(){
        sb = new StringBuilder();
        Calc();
        Console.Write(sb.ToString());
    }
    void Calc(){
        string[] str = Console.ReadLine().Split(' ');
        int N = int.Parse(str[0]);
        int M = int.Parse(str[1]);
        G = new List<int>[N];
        O = new List<int>[N];
        for(int i=0;i<N;i++){
            G[i] = new List<int>();
            O[i] = new List<int>();
        }
        for(int i=0;i<M;i++){
            str = Console.ReadLine().Split(' ');
            int x = int.Parse(str[0]) - 1;
            int y = int.Parse(str[1]) - 1;
            G[x].Add(y);
            G[y].Add(x);
            O[x].Add(i);
            O[y].Add(i);
        }
        bool[] OK = new bool[N];
        Map = new bool[N,N];
        int count = 0;
        for(int i=0;i<N;i++){
            OK[i] = dfs(i,i,M);
        }
        for(int i=0;i<N;i++){
            if(!OK[i]){
                continue;
            }
            for(int j=i+1;j<N;j++){
                if(OK[j]){
                    bool b = true;
                    for(int k=0;k<N;k++){
                        b &= !Map[i,k] || !Map[j,k];
                    }
                    if(b){
                        count++;
                    }
                }
            }
        }
        sb.Append(count+"\n");
    }
    bool dfs(int p,int v,int c){
        Map[p,v] = true;
        bool b = true;
        for(int i=0;i<G[v].Count;i++){
            int t = G[v][i];
            if(O[v][i] < c){
                if(!Map[p,t]){
                    b &= dfs(p,t,O[v][i]);
                }
                else{
                    return false;
                }
            }
        }
        return b;
    }
}

Measured memory_bytes: 20252
a, b, k = gets.split.map(&:to_i)
k.times do |i|
  if i.even?
    a - 1 if a.odd?
    a /= 2
    b += a
  else
    b - 1 if b.odd?
    b /= 2
    a += b
  end
end
puts "#{a} #{b}"


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

int N, M;
int T[110], P[110], X[110];

int main() {
    cin >> N;
    for (int i = 0; i < N; ++i) cin >> T[i];

    cin >> M;
    for (int i = 0; i < M; ++i) cin >> P[i] >> X[i];

    for (int i = 0; i < M; ++i) {

        int t = 0;
        for (int j = 0; j < N; ++j) {
            if (j == P[i] - 1) {
                t += X[i];
            } else {
                t += T[j];
            }
        }

        cout << t << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#line 1 "/mnt/c/Users/leafc/dev/compro/lib/template.hpp"


#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) (v).begin(), (v).end()
#define coutd(n) cout << fixed << setprecision(n)
#define ll long long int
#define vl vector<ll>
#define vi vector<int>
#define MM << " " <<

using namespace std;

template <class T> void say(bool val, T yes = "Yes", T no = "No") { cout << (val ? yes : no) << endl; }

template <class T> void chmin(T &a, T b) {
  if (a > b)
    a = b;
}

template <class T> void chmax(T &a, T b) {
  if (a < b)
    a = b;
}


#line 2 "tmp.cpp"

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

  string n;
  cin >> n;
  say<string>(n.find("7") != string::npos);
  return 0;
}


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

int main() {
	string s;cin>>s;
	bool nu=false,ca=false,sm=false;
	for(char c:s){
		if('0'<=c&&c<='9')nu=true;
		if('a'<=c&&c<='z')sm=true;
		if('A'<=c&&c<='Z')ca=true;
	}
	if(nu&&sm&&ca&&s.size()>=6)puts("VALID");
	else puts("INVALID");
}

Measured memory_bytes: 3204
#include<vector>
#include<iostream>
#include<list>
#include<string>


using namespace std;

int ctoi(char c) {

	switch (c)
	{
	case'0':
		return 0;
	case'1':
		return 1;
	case'2':
		return 2;
	case'3':
		return 3;
	case'4':
		return 4;
	case'5':
		return 5;
	case'6':
		return 6;
	case'7':
		return 7;
	case'8':
		return 8;
	case'9':
		return 9;
	default:
		break;
	};
}
using ull = unsigned long long;
using ll =long long;

int main() {

	string s;
	cin >> s;
	unsigned long long sum = 0;
	for (char& c : s) {
		sum += ctoi(c);
	}
	cout << ((sum % 9 == 0) ? "Yes" : "No") << endl;
  return 0;
}


Measured memory_bytes: 3724
#include<bits/stdc++.h>
using namespace std;
typedef double db;
typedef long long ll;
#define w1 first
#define w2 second
#define ls (x<<1)
#define rs (x<<1|1)
#define pb push_back
#define mid ((l+r)>>1)
#define SZ(x) ((x).size())
#define All(x) (x).begin(),(x).end()
#define rep(i,a,b) for(int (i)=(a);(i)<=(b);(i)++)
#define rep2(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
#define per(i,a,b) for(int (i)=(a);(i)>=(b);(i)--)
#define Rep(p,x) for(int (p)=head[(x)];(p);(p)=nxt[(p)])
template<class T>void read(T&num){
	num=0;T f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9')num=num*10+ch-'0',ch=getchar();
	num*=f;
}
const int maxn=2e5+5;
int totlen;
ll l,r;
ll len[maxn];
int nxt[maxn];
char str[maxn];
struct val{
	ll cnt[26];
	val(){memset(cnt,0,sizeof cnt);}
	friend val operator+(val A,val B){
		val C;
		rep2(i,0,26)C.cnt[i]=A.cnt[i]+B.cnt[i];
		return C;
	}
	friend val operator-(val A,val B){
		val C;
		rep2(i,0,26)C.cnt[i]=A.cnt[i]-B.cnt[i];
		return C;
	}
	friend void Print(val A){
		rep2(i,0,26)printf("%lld ",A.cnt[i]);puts("");
	}
}v[105];
void getnxt(){
	int tmp=0;
	rep(i,2,totlen){
		while(tmp&&str[tmp+1]!=str[i])tmp=nxt[tmp];
		if(str[tmp+1]==str[i])tmp++;
		nxt[i]=tmp;
	}
	for(int i=nxt[totlen];;i=nxt[i])if(i<(totlen+1)/2){
		len[1]=totlen-i;
		break;
	}
	len[0]=len[1]-nxt[len[1]];
}
val Calc(int now,ll pos){
	val res;
	if(now==1){
		rep(i,1,pos)res.cnt[str[i]-'a']++;
		return res;
	}
	if(pos<=len[now-1])return Calc(now-1,pos);
	return v[now-1]+Calc(now-1,pos-len[now-1]);
}
int main(){
	scanf("%s",str+1);
	totlen=strlen(str+1);
	getnxt();
	rep(i,1,len[0])v[0].cnt[str[i]-'a']++;
	rep(i,1,len[1])v[1].cnt[str[i]-'a']++;
	read(l);read(r);
	int maxi=1;
	rep(i,2,100){
		len[i]=len[i-1]+len[i-2],v[i]=v[i-1]+v[i-2];
		if(len[i]>r){maxi=i;break;}
	}
	Print(Calc(maxi,r)-Calc(maxi,l-1));
	return 0;
}

Measured memory_bytes: 1280
def gcd(x, y)
  return (x % y == 0)? y: gcd(y, x%y)
end

N = gets.to_i
A = gets.chomp.split(' ').map{|x| x.to_i}


l = Array.new(N)
r = Array.new(N)
for i in 0...N
  l[i] = A[i]
  r[i] = A[i]
end

for i in 1...N
  l[i] = gcd(l[i-1], l[i])
  r[N-i-1] = gcd(r[N-i-1], r[N-i])
end

ans = 1
for i in 0...N
  if i == 0
    ans = [ans, r[i+1]].max
  elsif i == N-1
    ans = [ans, l[i-1]].max
  else
    ans = [ans, gcd(l[i-1], r[i+1])].max
  end
end
p ans
  
           





Measured memory_bytes: 13836
process.stdin.on("data",function(c,o,m){
	o={},n=0,s="";
	(c+"").trim().split(" ").some(function(a){
		n<(o[a=a.toLowerCase()]?++o[a]:(o[a]=1))&&(n=o[m=a]);
		s.length<a.length&&(s=a);
	});
	console.log(m+" "+s);
}).resume();

Measured memory_bytes: 7648
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
 
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
 
#define start_routine() int begtime = clock();
#define end_routine() int endtime = clock(); cerr << endl << "Time elapsed: " << (endtime - begtime)*1000/CLOCKS_PER_SEC << " ms"; return 0
#define speed() cin.tie(0), cout.tie(0), ios_base::sync_with_stdio(false)
// #define exit(a, b) return cout << a, b;
 
// debugger
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cout << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#define debug(stuff) cout << #stuff << ": " << stuff <<endl
#define debugc(stuff) cout << #stuff << ": "; for(auto x: stuff) cout << x << " "; cout << endl;
// 
 
#define loop(i,a,b) for(ll i=a;i<b;i++)
#define all(v) v.begin(), v.end() 
 
#define print(stuff) cout << stuff << endl
#define printc(stuff) for(auto x: stuff) cout << x << " "; cout << endl;
#define printPrec(stuff) cout << fixed << setprecision(15) << stuff << endl;
#define len length
#define ret0 return 0
#define ret return 
 
 
#define ll long long
#define ld long double
#define fi first
#define endl '\n'
#define se second
#define pb push_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define fill(ar, x) memset(ar, x, sizeof ar)
 
#define vl vector<ll> 
#define sl set<ll>
#define pll pair<ll, ll>
#define mll map<ll, ll> 
#define pq priority_queue<ll>
 
// typedef tree<ll,null_type,less<ll>,rb_tree_tag,
// tree_order_statistics_node_update> indexed_set;
 
#define inf (long long int) 1e18
#define eps 0.000001
#define mod 1000000007
#define mod1 998244353
#define MAXN (ll)2e5+5
#define N (1ll<<10)
#define pi 3.141592653589793238462643

void solve(){
    ll n, k;
    cin>>n>>k;
    ll ans = 0, a = 1;;
    while(a <= n){
        a = a*k;
        ans++;
    }
    print(ans);
}
 
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    
 
    ll t = 1;
    // cin>>t;
    while(t--){
        solve();
    }
        

}


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

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = mod * mod;
const int INF_N = 1e+9;
typedef pair<int, int> P;
// #define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-12;
const ld pi = acos(-1.0);
//typedef vector<vector<ll>> mat;
typedef vector<int> vec;

//繰り返し二乗法
ll mod_pow(ll a, ll n, ll m) {
	ll res = 1;
	while (n) {
		if (n & 1)res = res * a%m;
		a = a * a%m; n >>= 1;
	}
	return res;
}

struct modint {
	ll n;
	modint() :n(0) { ; }
	modint(ll m) :n(m) {
		if (n >= mod)n %= mod;
		else if (n < 0)n = (n%mod + mod) % mod;
	}
	operator int() { return n; }
};
bool operator==(modint a, modint b) { return a.n == b.n; }
modint operator+=(modint &a, modint b) { a.n += b.n; if (a.n >= mod)a.n -= mod; return a; }
modint operator-=(modint &a, modint b) { a.n -= b.n; if (a.n < 0)a.n += mod; return a; }
modint operator*=(modint &a, modint b) { a.n = ((ll)a.n*b.n) % mod; return a; }
modint operator+(modint a, modint b) { return a += b; }
modint operator-(modint a, modint b) { return a -= b; }
modint operator*(modint a, modint b) { return a *= b; }
modint operator^(modint a, int n) {
	if (n == 0)return modint(1);
	modint res = (a*a) ^ (n / 2);
	if (n % 2)res = res * a;
	return res;
}

//逆元(Eucledean algorithm)
ll inv(ll a, ll p) {
	return (a == 1 ? 1 : (1 - p * inv(p%a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }

const int max_n = 1 << 18;
modint fact[max_n], factinv[max_n];
void init_f() {
	fact[0] = modint(1);
	for (int i = 0; i < max_n - 1; i++) {
		fact[i + 1] = fact[i] * modint(i + 1);
	}
	factinv[max_n - 1] = modint(1) / fact[max_n - 1];
	for (int i = max_n - 2; i >= 0; i--) {
		factinv[i] = factinv[i + 1] * modint(i + 1);
	}
}
modint comb(int a, int b) {
	if (a < 0 || b < 0 || a < b)return 0;
	return fact[a] * factinv[b] * factinv[a - b];
}
using mP = pair<modint, modint>;

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




void solve() {
    int a, b; cin >> a >> b;
    if(a+b > 9) cout << "error" << endl;
    else cout << a+b << endl;
}

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  //cout << fixed << setprecision(10);
  //init_f();
  //init();
  //int t; cin >> t; rep(i, t)solve();
  solve();
//   stop
    return 0;
}


Measured memory_bytes: 7696
#include"bits/stdc++.h"

using namespace std;

int main() {
	string S;
	cin >> S;
	if (S[0] != S[1] && S[1] != S[2] && S[2] != S[0]) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main()
{
  int a,b,i;
  cin>>a>>b;
  string s[a];
  for(i=0;i<a;i++)
  {
      cin>>s[i];
  }
  sort(s,s+a);
  for(i=0;i<a;i++)
  {
      cout<<s[i];
  }








}


Measured memory_bytes: 3104
#include "bits/stdc++.h"
using namespace std;
#define lint long long
#define low lower_bound
#define upp upper_bound
#define rep(i, n) for (int i = 0; i < int(n); ++i)
#define Rep(i, n) for (int i = int(n); i >= 0; --i)
#define all(vec) (vec).begin(), (vec).end()
#define cend printf("\n");
#define prique(T) priority_queue<T, vector<T>, greater<T>>
#define prique2(T) priority_queue<T>

struct edge { int to; double cost; };
#define P pair<int, int>
#define D pair<double, double>
#define DI pair<double, int>
//const lint mod = 998244353LL;
const lint mod = 1000000007LL;
const lint inf = 3LL * mod * mod;

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;
}

lint modpow(lint x, lint n, lint m) {
	lint ans = 1;
	while (n > 0) {
		if (n & 1) {
			ans *= x;
			if (m <= ans) ans %= m;
		}
		x *= x;
		if (m <= x) x %= m;
		n >>= 1;
	}
	return ans;
}

lint fact[1000000];
void f_init(lint n) {
	if (1000000 <= n) return;
	fact[0] = fact[1] = 1;
	for (lint i = 2; i <= n; ++i) {
		fact[i] = i * fact[i - 1];
		if (mod <= fact[i]) fact[i] %= mod;
	}
	return;
}

lint inver[1000000]; bool inve[100000];
lint inv(lint x) {
	if (x == 0) return 0;
	else if (inve[x]) return inver[x];
	else {
		inve[x] = true;
		return inver[x] = modpow(x, mod - 2, mod);
	}
}

lint comb(lint n, lint r) {
	if (n < r) return 0;
	if (n == r) return 1;
	lint ans = fact[n] * inv(fact[n - r]) % mod * inv(fact[r]) % mod;
	if (ans < 0) return ans + mod;
	return ans;
}

lint nck[1010][1010];
void comb(lint n) {
	rep(i, n + 1) {
		rep(j, i + 1) {
			if (j == 0 || i == j) nck[i][j] = 1;
			else nck[i][j] = nck[i - 1][j - 1] + nck[i - 1][j];
		}
	}
}

lint gcd(lint a, lint b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}

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

bool pri(lint p) {
	for (lint i = 2; i * i <= p; i == 2 ? ++i : i += 2) if (p % i == 0) return false;
	return p > 1;
}

map<lint, lint> factring(lint n) {
	map<lint, lint>ans;
	for (lint i = 2; i * i <= n; ++i) {
		while (n % i == 0) {
			n /= i;
			++ans[i];
		}
	}
	if (n != 1) ++ans[n];
	return ans;
}

double dis(D a, D b) { return sqrt((a.first - b.first) * (a.first - b.first) + (a.second - b.second) * (a.second - b.second)); }

lint n, a, b, m;
int main() {
	cin >> n >> a >> b;
	m = n % 12;
	rep(i, m) {
		if (i & 1) b = a + b;
		else a = a - b;
	}
	cout << a << " " << b << endl;
	/*
	A B
	A-B B
	A-B A
	-B A
	-B A-B
	-A A-B
	-A -B
	-A+B -B
	-A+B -A
	B -A
	B -A+B
	A -A+B
	A B
	*/
}


Measured memory_bytes: 3112
import re
n, m = [int(x) for x in input().split()]
nm = ""
ss = ""
for _ in range(n):
    nm += input()
for i in range(m):
    ss += ".{{{}}}".format(n-m) if i>0 else ""
    ss += input().replace(".","\.")
print("Yes") if re.search(ss,nm) else print("No")


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

int main()
{
    long n;
    cin >> n;
    long m = n;
    long s[10] = {0,0,0,0,0,0,0,0,0,0};
    int i=0;
    long sum=0;
    if(n>0){
        while(n>0){
            s[i] = n%10;
            n = n/10;
            i++;
        }
        for(int j=0;j<10;j++){
            sum = sum + s[j];
        }
        if(sum == 0){
            cout << "No" << endl;
        }
        else if(m%sum == 0){
            cout << "Yes" << endl;
        }
        else{
            cout << "No" << endl;
        }
    }
    else{
        cout << "No" << endl;
    }
    return 0;
    
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <vector>
#include <algorithm>
#include <string>
#include <functional>
#include <numeric>
#include <ctype.h>
#include <cstdlib>
#include <string.h>
#include <math.h>


using namespace std;


int main()
{
	long double x1, x2, y1, y2;

	cin >> x1 >> y1 >> x2 >> y2;

	 long double distance = pow(x2 - x1, 2.0) + pow(y2 - y1, 2.0);
	 

	distance = sqrt(distance);

	cout << fixed << distance << endl;

	
}

Measured memory_bytes: 3284
#include<iostream>
#include<string.h>
#include<string>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<math.h>
#include<queue>
#include<set>
#include<map>
using namespace std;
typedef long long ll;
typedef long double db;
typedef pair<int,int> pii;
const int N=100000;
const db pi=acos(-1.0);
#define lowbit(x) (x)&(-x)
#define sqr(x) (x)*(x)
#define rep(i,a,b) for (register int i=a;i<=b;i++)
#define per(i,a,b) for (register int i=a;i>=b;i--)
#define go(u,i) for (register int i=head[u];i;i=sq[i].nxt)
#define fir first
#define sec second
#define mp make_pair
#define pb push_back
#define maxd 1000000007
#define eps 1e-8
map<ll,ll> f;

inline ll read()
{
    ll x=0;int f=1;char ch=getchar();
    while ((ch<'0') || (ch>'9')) {if (ch=='-') f=-1;ch=getchar();}
    while ((ch>='0') && (ch<='9')) {x=x*10+(ch-'0');ch=getchar();}
    return x*f;
}

ll calc(ll n)
{
	if (f[n]) return f[n];
	return f[n]=(calc(n>>1)+calc((n-1)>>1)+calc((n-2)>>1))%maxd;
}

int main()
{
	ll n=read();
	f[0]=1;f[1]=2;
	printf("%lld",calc(n));
	return 0;
}



Measured memory_bytes: 256
#if 1
  #include <bits/stdc++.h>
#else
  #include "../../../../bits/stdc++.h"
#endif

using namespace std;

//#define int long long

using ll = long long;
using pii =  pair<int, int>;

const int IINF =  0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fLL;
const int INF = sizeof(int) == sizeof(long long) ? LINF : IINF;
const ll MOD = 1e9+7;

#define for_(i,a,b) for(int i = (a);i < (b);i++)
#define rfor_(i,a,b) for(int i = (b)-1;i >= (a);i--)

#define rep(i,n) for_(i,0,n)
#define rrep(i,n) rfor_(i,0,n)

#define pb push_back
//#define eb emplace_back
#define mp make_pair
#define ft first
#define sd second

#define all(a) (a).begin(), (a).end()
#define sz(a) (int)(a).size()
#define rev(a) reverse(all(a))

#define endl '\n'

const int limit = 100007;



signed main(){
  cin.tie(0);
  cout.tie(0);
  ios_base::sync_with_stdio(false);
  
  int x, a, b;
  
  cin>>x>>a>>b;
  
  if(abs(a-x)<abs(b-x))cout<<'A'<<endl;
  else cout<<'B'<<endl;
  
  return 0;
}


Measured memory_bytes: 256
#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 Cerr(x) cerr<<(x)<<endl
#define fi first
#define se second

ll n,cnt,ans,a[ohara],b[ohara],c[ohara],tmp,tmpp,m,h,w,x,y,sum,pos,k,q,v[ohara],d[ohara],co[ohara];
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;};
vector<ll> g[ohara];
ll vi[ohara];
map<pair<ll,ll>,ll> mem;
ll d_st,v_st;

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

void f(ll dd,ll vv,ll cc){
    if(mem[{dd,vv}]!=0){
        if(co[vv]==0)co[vv]=cc;
        return;
    }
    if(co[vv]==0)co[vv]=cc;
    mem[{dd,vv}]=cc;
    if(dd==0)return;
    rep(i,Size(g[vv])){
        f(dd-1,g[vv][i],cc);
    }
    return;
}

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

    cin>>n>>m;
    rep(i,m)cin>>a[i]>>b[i];
    cin>>q;
    rep(i,q){
        cin>>v[i]>>d[i]>>c[i];
        v[i]--;
    }

    rep(i,m){
        a[i]--;b[i]--;
        g[a[i]].push_back(b[i]);
        g[b[i]].push_back(a[i]);
    }

    rrrep(i,q-1,0){
        f(d[i],v[i],c[i]);
    }
    rep(i,n)Cout(co[i]);
    return 0;
}


Measured memory_bytes: 102900
#include <iostream>
using namespace std;
int main(void){
    // Here your code !
 int x,y;
 while(1){
     cin>>x>>y;
     if(x==0&& y==0){
         break;
     }
     else if(x<=y){
         cout<<x<<" "<< y << endl;
     }else{
         cout<<y<<" "<<x<<endl;
     }
 }
 return 0;
}

Measured memory_bytes: 1160
from math import atan
from math import pi
a, b, x = map(int, input().split())
ans = 0
if 2 * x >= a*a*b:
    ans = atan((2 * (a*a*b - x)) / (a*a*a))
else:
    ans = atan((a*b*b) / (2*x))
print((ans*180) / pi)

Measured memory_bytes: 3060