akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<limits>
#include<sstream> 
#include<unordered_map>      

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;

const int inf = numeric_limits<int>::max() >> 2;
const ll linf = numeric_limits<ll>::max() >> 2;
const ull ulinf = numeric_limits<ull>::max() >> 2;
const double pi = acos(-1);
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int dx8[8]={-1,0,1,-1,1,-1,0,1};
const int dy8[8]={-1,-1,-1,0,0,1,1,1};

#define p_queue(i) priority_queue<i> 
#define rp_queue(i) priority_queue<i, vector<i>, greater<i>> 
#define umap(i,j) unordered_map<i,j>
#define P(p) cout<<(p)<<endl
#define PS(p) cout<<(p)<< " "
#define PN cout << endl
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i = (n-1); i >= (int)(m); i--)
#define inrep(n,a) for(int i = 0; i < (int)(n); i++)cin >> a[i];
#define mod(i) ((i)%(ll)(1e9 + 7))
#define divm(a,b) (mod(a * modpow((ll)b,(ll)(1e9+5))))
#define rsort(a,b,c) sort(a, b, greater<c>())
#define vsort(v) sort(v.begin(), v.end())
#define rvsort(v,c) sort(v.begin(), v.end(), greater<c>()) 
#define ft first
#define sd second
#define pb push_back
#define it insert
#define sz(x) ((int)(x).size())
#define lb(a,n,k) (lower_bound(a,a+n,k) - (a)) 
#define vlb(a,k)  (lower_bound(a.begin(),a.end(),k) - a.begin())
#define ub(a,n,k) (upper_bound(a,a+n,k) - (a)) 
#define vub(a,k)  (upper_bound(a.begin(),a.end(),k) - a.begin())
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return

/*
ll modpow(ll i,ll j){ ll tmp=1; while(j){ if(j%2)tmp=mod(tmp*i);i=mod(i*i);j/=2;}return tmp;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
*/

/*
vector<string> split(const string &str, char sep){
    vector<string> v;
    stringstream ss(str);
    string buffer;
    while( getline(ss, buffer, sep) ) {
        v.push_back(buffer);
    }
    return v;
}
*/

/*
ll ncr[100][100];
ll nCr(int n, int r){if(n==r) ret ncr[n][r] = 1; if(r==0) ret ncr[n][r] = 1; if(r==1) ret ncr[n][r] = n;if(ncr[n][r]) ret ncr[n][r]; ret ncr[n][r] = nCr(n-1,r) + nCr(n-1,r-1);}

ll npr[100][100]={};
ll nPr(int n,int r){if(npr[n][r])ret npr[n][r];if(r==0)ret npr[n][r] = 1;if(r==1)ret npr[n][r] = n;ret npr[n][r] = n * nPr(n-1,r-1);}

ll nHr(int n,int r){ret nCr(n+r-1,r);}
*/

///////////////////////////////////////////////////////////////////////////

int main(){
    string s;
    cin >> s;
    if(s[1] == 'B')P("ARC");
    else P("ABC");
    
    return  0;
}


Measured memory_bytes: 3620
#include <iostream>
#include <stack>
#include <vector>

using namespace std;


vector<int> vertexes[100000];
stack<int> visiting;
bool discovered[100000];
int belong[100000];
int subgraph_id = 0;


void dfs(int v)
{
    visiting.push(v);
    discovered[v] = true;
    belong[v] = ++subgraph_id;

    while (!visiting.empty()) {
        int now = visiting.top();
        visiting.pop();


        for (vector<int>::iterator it = vertexes[now].begin(); it != vertexes[now].end(); it++) {
            if (!discovered[*it]) {
                discovered[*it] = true;
                belong[*it] = subgraph_id;
                visiting.push(*it);
            }
        }
    }
}


int main()
{
    int n, m;
    cin >> n >> m;
    for (int i = 0; i < m; i++) {
        int x, y;
        cin >> x >> y;
        vertexes[x].push_back(y);
        vertexes[y].push_back(x);
    }

    for (int i = 0; i < n; i++)
        if (!discovered[i])
            dfs(i);

    int q;
    cin >> q;
    for (int i = 0; i < q; i++) {
        int x, y;
        cin >> x >> y;
        if (belong[x] == belong[y])
            cout << "yes" << endl;
        else
            cout << "no" << endl;
    }
    return 0;
}


Measured memory_bytes: 9084
#include <bits/stdc++.h>
#include <iomanip>
#include <math.h>
//#include <unistd.h>
//#include <stdio.h>
#define rep(i,x) for(ll i = 0;i<x;i++)
#define all(a) (a).begin(),(a).end()
using ll = long long;
using ld = long double;
using namespace std;
using dou = double;
const ll inf = 2147483647;
const ll INF = 1LL << 60;
const ll mod = 1000000007;
const ld pi = 3.14159265358;
typedef pair<ll,ll> P;
using graph = vector<vector<ll>>;
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;}
ll gcd(ll a,ll b){
    if(a < b)swap(a,b);
    if(a % b == 0)return b;
    else return gcd(b,a%b);
}
//素数判定O(sqrt(N))
bool isp(ll n){
    bool res = true;
    if(n == 1)return false;
    else{
        for(ll i = 2;i * i <= n;i++){
            if(n % i == 0){
                res = false;
                break;
            }
        }
        return res;
    }
}

ll fac[510000], finv[510000], inv[510000];

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

// 二項係数計算
ll COM(ll n, ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}
//nのm乗をMODで割ったあまりO(logN)
ll modpow(ll n,ll m,ll MOD){
    ll res = 1;
    while(m){
        if(m & 1)res = (res * n) % MOD;
        m >>= 1;
        n *= n;
        n %= MOD;
    }
    return res;
}

//printf("%.10f\n", N);
/*  vector<ll> vec = {1,2,5,6,8,9,10};
    cout << binary_search(all(vec),5) << endl; -> true*/
/*
    vector<ll> vec = {1,2,5,6,8,9,10};
    auto n = upper_bound(all(vec),4);
    cout << *n << endl; -> 5*/

//    cout << fixed << setprecision(15);


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll H,W;
    cin >> H >> W;
    ll cost[10][10];
    vector<vector<ll>> wall(H,vector<ll>(W));
    rep(i,10)
    rep(j,10)cin >> cost[i][j];
    rep(i,H)
    rep(j,W)cin >> wall[i][j];
    rep(k,10){
        rep(i,10){
            rep(j,10){
                cost[i][j] = min(cost[i][j],cost[i][k] + cost[k][j]);
            }
        }
    }
    ll ans = 0;
    rep(i,H){
        rep(j,W){
            if(wall[i][j] != -1){
                ans += cost[wall[i][j]][1];
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3736
#include <iostream>
#include <sstream>
#include <cstring>	// require memset 
//#include <fstream>

using namespace std;

const int N = 1000000;
bool prime[N+1];

void make_prime (void)
{
	int i,j;
	memset (prime, true , sizeof(prime) );

	prime[0] = false;
	prime[1] = false;

	for (j = 0; j <= N; ++j){
		if (prime[j]){
			int p = j;
			for (i = 2*p; i <= N; i += p ){
				if (prime[i] ){
					prime[i] = false;
				} // end if
			} // end for
		} // end if	
	} // end for
}

int main()
{
//	cut here before submit 
//	freopen ("testcase.goldbachII", "r", stdin);

	string str = "";
	make_prime();

	while (getline (cin, str ) ){
		int n;
		stringstream ss(str);
		ss >> n;
		if (n == 0 ){
			break;
		} // end if
		int res = 0;
		int i;

		for (i = 2; i <= n/2; ++i){
			if (prime[i] && prime[n-i] ){
				++res;
			} // end for
		} // end for
		cout << res << endl;
	} // end loop
		
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define debug(x) cerr << #x << " " << x << "\n"

using namespace std;
typedef long long ll ;
typedef pair <int,int>  pii;

int main() {
    string s;
    cin >> s;
    if(s[2] ==  s[3] && s[4] == s[5])
        cout << "Yes\n";
    else
        cout << "No\n";
    return 0;
}


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


public class my
{
	
	private static StringBuilder sb = new StringBuilder();
	
	public static void Main()
	{
		Console.ReadLine();
		var S = Console.ReadLine().Split(' ');
		S = S.Distinct().ToArray();
		Console.ReadLine();
		var T = Console.ReadLine().Split(' ');
		Array.Sort(S);
		
		
		var cnt = 0;
		foreach(var t in T) {
			foreach(var s in S) {
				if(t == s) {
					//Console.Write(s + " ");
					cnt++;
				}
			}
		}
		
		Console.WriteLine(cnt);
	}
	
	private static int CountChar(string s, char c)
	{
		return s.Length - s.Replace(c.ToString(), "").Length;
	}
	
	private static void Flush()
	{
		Console.Write(sb);
		sb.Length = 0;
	}
	
	private static void AppendLine(int v)
	{
		sb.AppendLine(v.ToString());
	}
	
	private static void AppendLine(long v)
	{
		sb.AppendLine(v.ToString());
	}
	
	private static void AppendLine(string[] v)
	{
		sb.AppendLine(string.Join(" ", v));
	}

	private static void Swap(ref string a, ref string b) 
	{
		string tmp = a;
		a = b;
		b = tmp;
	}
	
	private static void Swap(ref int a, ref int b) 
	{
		int tmp = a;
		a = b;
		b = tmp;
	}
	
	private static int[] GetIntArray()
	{
		return Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
	}
	
	private static void WriteArray(int[] a)
	{
		Console.WriteLine(string.Join(" ", Array.ConvertAll( a, x=>x.ToString() ) ) );
	}
	
	private static void WriteArray(long[] a)
	{
		Console.WriteLine(string.Join(" ", Array.ConvertAll( a, x=>x.ToString() ) ) );
	}
	
	private static int GetInt()
	{
		return int.Parse(Console.ReadLine());
	}
	
	private static long GetLong()
	{
		return long.Parse(Console.ReadLine());
	}
}

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

template<class Type>
Type modpow(Type a, Type n, Type mod)
{
	Type res = 1;
	while (0 < n) {
		if (n & 1) {
			res = res * a % mod;
		}
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}

template<class Type>
Type gcd(Type x, Type y)
{
	Type r;
	if (x < y) swap(x, y);

	while (0 < y) {
		r = x % y;
		x = y;
		y = r;
	}
	return x;
}

template<class Type>
Type lcm(Type x, Type y)
{
	return x * y / gcd(x, y);
}

template<class Type>
bool is_prime(Type x)
{
	if (x == 2) return true;
	if (x < 2 || x % 2 == 0) return false;

	for (Type i = 3; i <= sqrt(x); i += 2) {
		if (x % i == 0) return false;
	}
	return true;
}

template<class Type>
vector<bool> eratos(Type n)
{
	vector<bool> isPrime(n + 1, true);
	isPrime[0] = isPrime[1] = false;
	for (Type i = 2; i <= n; i++) {
		if (isPrime[i]) {
			Type j = i + i;
			while (j <= n) {
				isPrime[j] = false;
				j = j + i;
			}
		}
	}
	return isPrime;
}

bool binary_search_judge(vector<int> a, int index, int key)
{
	if (key <= a[index]) return true;
	else return false;
}

int binary_search(vector<int> a, int key)
{
	int ng = -1;
	int ok = a.size();
	while (1 < abs(ng - ok)) {
		int mid = (ng + ok) / 2;
		if (binary_search_judge(a, mid, key)) ok = mid;
		else ng = mid;
	}
	return a[ok] == key;
}

pair<int, int> i_to_pair(int x)
{
	int sentou = to_string(x)[0] - '0';
	int matubi = to_string(x)[to_string(x).size() - 1] - '0';
	return make_pair(sentou, matubi);
}

int main()
{
	int n;
	cin >> n;
	map<pair<int, int>, int> freq;
	for (int i = 1; i <= n; i++) {
		pair<int, int> sentou_matubi = i_to_pair(i);
		freq[sentou_matubi]++;
	}

	int ans = 0;
	for (int i = 1; i <= n; i++) {
		pair<int, int> sentou_matubi = i_to_pair(i);
		pair<int, int> matubi_sentou(sentou_matubi.second, sentou_matubi.first);
		ans += freq[matubi_sentou];
	}
	cout << ans << endl;
}

Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
#include <complex>
using namespace std;

typedef long long ll;
typedef uint64_t ull;
typedef pair<int, int> P;
constexpr double PI = 3.1415926535897932;   // acos(-1)
constexpr double EPS = 1e-9;
constexpr int INF = 1001001001;
constexpr int mod = 1000000007;
// constexpr int mod = 998244353;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)

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

    ll a, b, n;
    cin >> a >> b >> n;
    // for(int i = 0; i <= n; ++i){
    //     ll foo = a * i / b - a * (i / b);
    //     cerr << i << ' ';
    //     cerr << foo << '\n';
    // }
    
    ll ans = 0;
    if(n < b)   ans = a * n / b;
    else    ans = a * (b - 1) / b;
    cout << ans << endl;
}

Measured memory_bytes: 3608
<?php
while ($line = fgets(STDIN)) {
    $inputs[] = trim($line);
};
$n = array_shift($inputs);
$s = $inputs;

$ans = array();
for ($i = 0; $i < $n; $i++) {
    $ans[$s[$i]] = 1;
}
echo count($ans) . "\n";


Measured memory_bytes: 40740
import math
N,D = list(map(int,input().split()))
X = []
count = 0
for i in range(N):
    x = list(map(int,input().split()))
    X.append(x)
for i in range(N-1):
    for j in range(i+1,N):
        rec = 0
        for d in range(D):
            rec += abs(X[i][d] - X[j][d]) ** 2
        rec = math.sqrt(rec)
        if rec - math.floor(rec) == 0:
            count += 1
print(count)

Measured memory_bytes: 38256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int sum = a + b + c;

		int max = Math.max(a, b);
		max = Math.max(max, c);

		int ans = 0;

		int ded = max * 3;
		int ded2 = (max + 1) * 3;

		if (ded % 2 == sum % 2) {
			ans = (ded - sum) / 2;
		} else if (ded2 % 2 == sum % 2) {
			ans = (ded2 - sum) / 2;
		}

		System.out.println(ans);
	}
}


Measured memory_bytes: 23380
#include<iostream>
#include<vector>
#include<string>

using namespace std;

int main() {
	int N, K;
	string s;
	cin >> N >> K >> s;
	vector<int> hito;
	int length = 1;
	char bef = s[0];
	for (int i = 1; i < N; i++) {
		if (bef == s[i])length++;
		else {
			hito.push_back(length);
			length = 1;
			bef = s[i];
		}
	}
	hito.push_back(length);

	int ans = 0;
	for (int i = 0; i < hito.size(); i++) {
		if (hito[i] >= 2)ans += hito[i] - 1;
	}
	if (hito.size() % 2 == 0) {
		if (K >= hito.size() / 2) {
			ans += hito.size() - 1;

		}
		else {
			ans += K * 2;
		}
	}
	else {
		if (K >= (hito.size() - 1) / 2)ans += (hito.size() - 1);
		else ans += K * 2;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1020
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <queue>
#include <algorithm>
using namespace std;
typedef unsigned int uint;
typedef long long ll;
typedef pair<int, int> P;
const int c_INF = 111111111;
const int c_mINF = -111111111;
const int c_YET = -1;
const int c_Dx[4] = { 0,0,1,-1 };
const int c_Dy[4] = { 1,-1,0,0 };
const int c_div = 1000000007; //10^9 + 7


int main() {

	int A, B;
	scanf("%d%d", &A, &B);

	if (A > B) {
		printf("%d", A + A - 1);
	}
	if (A == B) {
		printf("%d", A + A);
	}
	if (A < B) {
		printf("%d", B + B - 1);
	}








}

Measured memory_bytes: 128
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctype.h>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>

using namespace std;
int cnt = 0;
void marge(int A[],int left,int mid,int right){
	int n1 = mid - left;
	int n2 = right - mid;
	int L[n1+1],R[n2+1];
	for(int i = 0;i < n1;i++){
		L[i] = A[left+i];
	}
	for(int j = 0;j < n2;j++){
		R[j] = A[mid+j];
	}
	L[n1] = 1000000001;
	R[n2] = 1000000001;
	int i = 0;int j = 0;
	for(int k = left;k < right;k++){
		cnt++;
		if(L[i] <= R[j]){
			A[k] = L[i];
			i++;
		}else{
			A[k] = R[j];
			j++;
		}
	}
}

void margesort(int A[],int left,int right){
	if(left + 1 < right){
		int mid = (left + right)/2;
		margesort(A,left,mid);
		margesort(A,mid,right);
		marge(A,left,mid,right);
	}
}

int main(){
	int n;
	cin >> n;
	int S[n];
	for(int i = 0;i < n;i++){
		cin >> S[i];
	}
	margesort(S,0,n);
	for(int j = 0;j < n;j++){
		cout << S[j];
		if(j != n-1){
			cout << " ";
		}
	}
	cout << "" << endl;
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 5068
use std::io::*;
use std::str::FromStr;

fn main() {
    let stdin = stdin();
    let mut stdinlock = stdin.lock();
    let mut str1 = String::new();
    stdinlock.read_line(&mut str1).unwrap();
    let mut iter = str1.trim().split_whitespace().map(|x| u32::from_str(x).unwrap());
    let a = iter.next().unwrap();
    let b = iter.next().unwrap();
    let c = (((a + b) as f32 / 2f32)).ceil();
    println!("{}", c as u32);
}


Measured memory_bytes: 4352
import static java.util.Arrays.deepToString;

import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		new Main().run();
	}
	void tr(Object... os) {
		System.err.println(deepToString(os));
	}

	Scanner sc = new Scanner(System.in);
	public void run() {
		while (sc.hasNext()) {
			String[] ss = sc.next().split(",");
			int num = Integer.parseInt(ss[0]);
			double w = Double.parseDouble(ss[1]);
			double h = Double.parseDouble(ss[2]);
			double BMI = w / (h * h);
			if (BMI >= 25) {
				System.out.println(num);
			}
		}
	}
	
}

Measured memory_bytes: 17148
#include <cstdio>
#define il inline
#define int unsigned
#define rgi register unsigned
#define sp putchar(32)
#define el putchar(10)
#define is_digit(o4) (o4>47&&o4<58)
using namespace std;
il int ri()
{
	register int o1=0;
	register char o3=getchar();
	while(!is_digit(o3))
		o3=getchar();
	while(is_digit(o3))
		o1=(o1<<1)+(o1<<3)+(o3^48),o3=getchar();
	return o1;
}
il void wi(rgi o1)
{
	rgi o2=o1/10;
	if(o2)
		wi(o2);
	putchar((o1-(o2<<1)-(o2<<3))^48);
}
const int maxn=55;
int n,a[maxn],ans;
signed main()
{
	n=ri();
	for(rgi i=1;i<=n;++i)
		a[i]=ri();
	for(rgi i=1;i<=n;++i)
		for(rgi j=i+1;j<=n;++j)
			ans+=a[i]*a[j];
	wi(ans);
	return 0;
}


Measured memory_bytes: 128
N = int(input())

def cakes_and_donuts(N=N):
  if N % 4 ==0 or N % 7 ==0:
    return 'Yes'  
  max_7_num = N//7
  max_4_num = N//4
  for i in range(max_7_num):
    for j in range(max_4_num):
      if 7*(i+1) + 4*(j+1) == N:
        return 'Yes'
  return 'No'

s = cakes_and_donuts(N)
print('{}'.format(s))

Measured memory_bytes: 3064
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7

n = INT()
count = [inf for _ in range(26)]
for _ in range(n):
    s = list(STR())
    ss = Counter(s)
    for i in range(26):
        ch = chr(ord('a') + i)
        count[i] = min(count[i], ss[ch])
ans = ''
for i in range(26):
    ans += chr(i + ord('a')) * count[i]
print(ans)

Measured memory_bytes: 5156
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#define mod (long long int)(2019)
#define pb push_back
#define ll long long int 
using namespace std;
typedef pair<int,int> pii;
 
int main(){
  ll l,r;
 
  cin>>l>>r;
  ll res=l*(l+1)%mod;
 
  for(ll i=l;i<r;i++){
    for(ll j=i+1;j<=r;j++){
      if(res==0) break;
      res=min(res,(i*j)%mod);
    }
  }
  
  cout<<res<<endl;
  return 0;
}

Measured memory_bytes: 256
n = int(input())
p = 0
f = 0
for i in range(n):
	d = input().split()
	if d[0] == d[1]:
		p += 1
	else:
		p = 0
	if p == 3:
		f = 1
if f == 1:
	print("Yes")
else:
	print("No")

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

#define dbg(x) cerr<<#x": "<<x<<"\n"
#define dbg_p(x) cerr<<#x": "<<x.first<<","<<x.second<<"\n"
#define dbg_v(x, n) do{cerr<<#x"[]: ";for(long long _=0;_<n;++_)cerr<<x[_]<<" ";cerr<<'\n';}while(0)
#define dbg_ok cerr<<"OK!\n"

#define st first
#define nd second

using namespace std;

const long long N = 100100;
long long n, k, x, a[N];
long long s;

template<class T>
ostream& operator<<(ostream& out, vector<T> v) {
	out << v.size() << '\n';
	for(auto e : v) out << e << ' ';
	return out;
}

template<class T1, class T2>
ostream& operator<<(ostream& out, pair<T1, T2> p) {
	return out << '(' << p.st << ' ' << p.nd << ')';  
}

int main() {
	ios_base::sync_with_stdio(false);
	cin >> n >> x;
	long long s = 0;
	for(long long i = 1; i <= n; i++)
		cin >> a[i], s += a[i];
	if(s == x) return cout << n << '\n', 0;
	sort(a + 1, a + n + 1);
	s = 0;
	long long ans = 0;
	for(long long i = 1; i <= n; i++) {
		s += a[i];
		if(x >= s)
			ans = i;
	}
	cout << min(ans, n - 1) << '\n';
}	

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
using db = double;
using pll = pair < ll, ll >;
 
#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template < typename Arg1 >
void __f(const char* name, Arg1&& arg1) {
    cerr << name << " : " << arg1 << std :: endl;
}
template < typename Arg1, typename... Args >
void __f(const char* names, Arg1&& arg1, Args&&... args) {
    const char* comma = strchr(names + 1, ',');
    cerr.write(names, comma - names) << " : " << arg1 << " | ";
    __f(comma + 1, args...);
}
#else
#define trace(...)
#endif
 
#define pb push_back
#define mp make_pair
#define fastIo() ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0)
 
const int MOD = 1e9 + 7, INF = INT_MAX, N = 1e5 + 10;
 
int main(){   
	ll x, y; cin >> x >> y;

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

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

int Area(int, int);
int Perimeter(int, int);


int main()
{
	int a, b;
	cin >> a >> b;
	
	printf("%d %d\n", Area(a, b), Perimeter(a, b));

	return 0;
}


int Area(int a, int b)
{
	return  a * b;
}

int Perimeter(int a, int b)
{
	return 2 * (a + b);
}

Measured memory_bytes: 1144
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <stdio.h>
#include <string>

using namespace std;

int main(){
  int N;
  int dollar4 = 0, dollar7 = 0;
  string result = "No";
  bool roop = true;
  cin >> N;
  for(int i = 0; i < N && roop; i++){
    for(int j = 0; j < N; j++){
      dollar4 = (i * 4);
      dollar7 = (j * 7);
      if(N - dollar4 - dollar7 == 0){
        result = "Yes";
        break;
        roop = false;
      }
    }
  }
  cout << result << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <math.h>
//const long long mod = 1000000007;
//const long long mod = 998244353;


int main() {
	int N;
	scanf("%d", &N);
	char*S = new char[N + 1];
	scanf("%s", S);
	bool t = true;
	if (N % 2 == 1)t = false;
	for (int i = 0; i < N / 2; i++) {
		if (S[i] != S[N / 2 + i])t = false;
	}
	printf(t ? "Yes" : "No");
	return 0;
}

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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int N;
map<int,int> Xs;
map<int,int> Ys;
int X[101010],Y[101010];

template<int um> class UF {
	public:
	vector<int> par,rank;
	UF() {rank=vector<int>(um,0); for(int i=0;i<um;i++) par.push_back(i);}
	int operator[](int x) {return (par[x]==x)?(x):(par[x] = operator[](par[x]));}
	int operator()(int x,int y) {
		if((x=operator[](x))==(y=operator[](y))) return x;
		if(rank[x]>rank[y]) return par[x]=y;
		rank[x]+=rank[x]==rank[y]; return par[y]=x;
	}
};
UF<500000> uf;

set<int> PX[101010],PY[101010];

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N;
	FOR(i,N) {
		cin>>X[i]>>Y[i];
		if(Xs.count(X[i])) uf(i,Xs[X[i]]);
		Xs[X[i]]=i;
		if(Ys.count(Y[i])) uf(i,Ys[Y[i]]);
		Ys[Y[i]]=i;
	}
	FOR(i,N) {
		PX[uf[i]].insert(X[i]);
		PY[uf[i]].insert(Y[i]);
	}
	ll ret=0;
	FOR(i,N) ret+=1LL*PX[i].size()*PY[i].size();
	cout<<ret-N<<endl;
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


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

int main() {
  int N;
  cin >> N;
  int ans = 0;
  for (int i=1; i<=9; i++) {
    ans += N%10;
    N /= 10;
  }
  if (ans == 1 ) {
    ans = 10;
  }
  
  cout << ans << endl;
  return 0;
}

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

#define int long long
#define MOD 1000000007

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

using namespace std;

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

struct Info{
	int x, y, h;
	Info(int x, int y, int h) : x(x), y(y), h(h) {
	}
};
 
signed main() {
	int N;
	cin >> N;

	vector<Info> infos;
	rep(i, N) {
		int x, y, h;
		cin >> x >> y >> h;
		infos.push_back(Info(x, y, h));
	}

	rep(y, 101) rep(x, 101) {
		int H;
		for (auto &info : infos) {
			if (info.h == 0) continue;
			H = info.h + abs(info.x - x) + abs(info.y - y);
			break;
		}

		bool ok = true;
		for (auto &info : infos) {
			if (max(H - abs(info.x - x) - abs(info.y - y), 0LL) != info.h) {
				ok = false;
				break;
			}
		}
		if (ok) {
			cout << x << " " << y << " " << H << endl;
			return 0;
		}
	}
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define until(x) while(!(x))
#define unless(x) if(!(x))
#define all(x) (x).begin(),(x).end()
#define F first
#define S second
#define pc __builtin_popcount

char t[100005];
int n,r,p,s,k;
bool win[100005];

int32_t main(){
	cin>>n>>k>>r>>s>>p>>t;
	int ans = 0;
	for(int i=0;i<n;i++){
		if(i<k || t[i]!=t[i-k] || !win[i-k]){
			if(t[i]=='r'){
				ans += p;
			}
			else if(t[i]=='p'){
				ans += s;
			}
			else {
				ans += r;
			}
			win[i]=1;
		}
	}
	cout<<ans;
}


Measured memory_bytes: 384
def min(a,b); a < b ? a : b; end
  
N,M,X = gets.split.map(&:to_i)
B = N.times.map{ gets.split.map(&:to_i) }
ans = Float::INFINITY

(1 << N).times do |s|
  u = Array.new(M, 0)
  cost = 0
  B.each_with_index do |b,i|
    next if s[i].zero?
    c,*a = b
    cost += c
    a.each_with_index do |up, m|
      u[m] += up
    end
  end
  ans = min(ans, cost) if u.all?{|x| x >= X }

end
puts ans > 1e8 ? -1 : ans


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

int main() {
  int W, H, N;
  cin >> W >> H >> N;

  int s = 0, t = 0;
  for (int i = 0; i < N; i++) {
    int x, y, a;
    cin >> x >> y >> a;

    if (a == 1) s = max(s, x);
    if (a == 2) W = min(W, x);
    if (a == 3) t = max(t, y);
    if (a == 4) H = min(H, y);
  }

  if (W <= s || H <= t) cout << 0 << endl;
  else cout << (W - s) * (H - t) << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;
#define ll long long
#define ld long double
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,(n)-1,0)
#define all(v) v.begin(), v.end()
#define endk '\n'
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;
const ld eps = 1e-10;
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b){if(a>b) a=b;}
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b){if(a<b) a=b;}

ll e() {
  return -1;
}
ll op(ll n, ll m) {
  return max(n, m);
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, q; cin >> n >> q;
  vector<ll> A(n); rep(i, n) cin >> A[i];
  segtree<ll, op, e> seg(A);
  rep(_, q) {
    int t; cin >> t;
    if(t == 1) {
      int x; ll v;
      cin >> x >> v;
      x--;
      seg.set(x, v);
    } else if(t == 2) {
      int l, r;
      cin >> l >> r;
      l--;
      cout << seg.prod(l, r) << endk;
    } else {
      int x; ll v;
      cin >> x >> v;
      x--;
      cout << seg.max_right(x, [&](ll u) { return v > u; }) + 1 << endk;
    }
  }
  return 0;
}


Measured memory_bytes: 9040
let () =
  let open Queue in
  let (n:int),(quantum:int) = Scanf.scanf "%d %d\n" (fun a b -> a,b) in
  let (q:(string * int) t) = create () in
  for i=1 to n do
    add (Scanf.scanf "%s %d\n" (fun a b -> a,b)) q
  done;
  let (sum:int ref) = ref 0 in
  while not (is_empty q) do
    let (p:string),(t:int) = take q in
    if t <= quantum then begin sum := !sum+t; Printf.printf "%s %d\n" p !sum end
    else begin add (p,t-quantum) q; sum := !sum+quantum end
  done

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

#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define REP(i, n)  for(int i=0;i<(n);++i)
#define REPr(i, n) for(int i=(n)-1;i>=0; --i)
#define FORq(i, m, n) for(int i = (m);i <= (n);++i)
#define FORqr(i, m, n) for(int i = (n);i >=(m);--i)
#define PB push_back
#define MP make_pair
#define DEBUG printf("%s\n","debug")
#define fst first
#define snd second
#define SIN(x, S) (S.count(x) != 0)
#define M0(x) memset(x,0,sizeof(x))
#define FILL(x, y) memset(x,y,sizeof(x))
#define MM(x) memset(x,-1,sizeof(x))
#define ALL(x) (x).begin(),(x).end()
using namespace std;
typedef pair<int, int> PII;
typedef pair<long long, long long> PLL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<long long> VL;
typedef long long ll;
typedef long long integer;
///////////////////////////////////////////////
const ll MOD = 1000000007;

ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }

template<class T>
inline bool chmin(T &a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}

template<class T>
inline bool chmax(T &a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}
///////////////////////////////////////////////
/*（๑•﹏•๑｀) */

int main() {
	int N; cin >> N;
	vector<ll> A(N);

	REP(i,N){
	    cin >> A[i];
	}

	sort(ALL(A));
	int L = 0;
	ll sum = 0;
	REP(i,N-1){
		if (2 * (sum + A[i]) >= A[i+1]){

		}else{
			L = i+1;
		}
		sum += A[i];
	}

	cout << N-L << endl;

}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int c[500005];
int d[500005];
int e[500005];
int a[500005];
int bit[500005];
vector<pair<int, int>> v[500005];
int n, q;
// 1 is true
// 0 is false

int esum(int l, int r) {
  int sum = 0;
  for (int i = l; i <= r; i++) {
    sum += e[i];
  }
  return sum;
}

void update(int i, int value) {
  for (; i <= n; i += i & -i) {
    bit[i] += value;
  }
}

int sum(int i) {
  int s = 0;
  for (; i > 0; i -= i & -i) {
    s += bit[i];
  }
  return s;
}

int main() {
  cin >> n >> q;
  for (int i = 1; i <= n; i++) {
    cin >> c[i];
  }
  for (int i = 1; i <= q; i++) {
    int l, r;
    cin >> l >> r;
    v[r].push_back({i, l});
  }

  for (int i = 1; i <= n; i++) {
    if (d[c[i]] != 0) {
      update(d[c[i]], -1);
    }
    d[c[i]] = i;
    update(i, 1);
    for (auto x : v[i]) {
      a[x.first] = sum(i) - sum(x.second - 1);
    }
    // for (int r = 1; r <= n; r++) {
    //   cout << c[r] << ' ';
    // }
    // cout << endl;
    // for (int r = 1; r <= n; r++) {
    //   cout << d[r] << ' ';
    // }
    // cout << endl;
    // for (int r = 1; r <= n; r++) {
    //   cout << e[r] << ' ';
    // }
    // cout << endl << "--------------------------------" << endl;
  }
  for (int i = 1; i <= q; i++) {
    cout << a[i] << endl;
  }
}


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

typedef long long ll;
const ll INF = 1010000000000000017LL;
const ll MOD = 1000000007LL;

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

//#define DEBUG(fmt, ...)
#define DEBUG(fmt, ...) fprintf(stderr, fmt "\n", ##__VA_ARGS__)

int main(){
    std::cout<<std::fixed<<std::setprecision(10);

    ll W, H, x, y;
    cin >> W >> H >> x >> y;

    cout << (double)(W*H)/2.0 << " ";

    if( 2*x == W && 2*y == H ){
        cout << "1";
    }else{
        cout << "0";
    }
    cout << endl;

}


Measured memory_bytes: 256
from collections import deque
t = int(input())

def bfs(cur, cost, a, b, c, d, target):
    memo = {0: float('inf')}
    stack = deque([(cur, cost)])
    while stack:
        cur, cost = stack.popleft()
        if cur in memo and memo[cur] <= cost:
            continue
        if cur > 2 * target:
            continue
        if cur < 0:
            continue
        memo[cur] = cost
        memo[0] = min(memo[0], cost + cur * d)
        stack.append((cur//5, cost + c + (cur % 5) * d))
        stack.append((cur//5 + 1, cost + c + (5 - cur % 5) * d))
        stack.append((cur//3, cost + b + (cur % 3) * d))
        stack.append((cur//3 + 1, cost + b + (3 - cur % 3) * d))
        stack.append((cur//2, cost + a + (cur % 2) * d))
        stack.append((cur//2 + 1, cost + a + (2 - cur % 2) * d))

    return memo[0]

for i in range(t):
    n, a, b, c, d = map(int, input().split())
    print(bfs(n, 0, a, b, c, d, n))
    
    


Measured memory_bytes: 179584
#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;

int main(){
    int n;

    cin >> n;

    int v[n];

    for(int i = 0; i < n; i++){
        v[i] = i+1;
    }

    int p[n], q[n];

    for(int i = 0; i < n; i++){
        cin >> p[i];
    }
    for(int i = 0; i < n; i++){
        cin >> q[i];
    }

    int a, b;
    int j = 1;
    do{
        bool flag_p = true;
        for(int i = 0; i < n; i++){
            if(v[i] != p[i]){
                flag_p = false;
                break;
            }
        }
        if(flag_p == true){
            a = j;
        }

        bool flag_q = true;
        for(int i = 0; i < n; i++){
            if(v[i] != q[i]){
                flag_q = false;
                break;
            }
        }
        if(flag_q == true){
            b = j;
        }

        j++;
    }while(next_permutation(v, v+n));

    cout << abs(a-b) << endl;

    return 0;

}

Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>

using namespace std;

struct player{
  int id;
  int sc;
};

void func(player a[], int n)
{
  player t;

  for(int i = n-1; i >= 0; i--){
    for(int j = 1; j <= i; j++){
      if(a[j].id < a[j-1].id){
	t = a[j];
	a[j] = a[j-1];
	a[j-1] = t;
      }
    }
  }

  for(int i = n-1; i >= 0; i--){
    for(int j = 1; j <= i; j++){
      if(a[j].sc > a[j-1].sc){
	t = a[j];
	a[j] = a[j-1];
	a[j-1] = t;
      }
    }
  }

  return ;
}


int main(int argc, char **argv)
{
  int n, s, t, u, *a;
  player pl[40];

  while(1){
    cin >> n;
    if(n == 0){
      break;
    }
    for(int j = 0; j < n; j++){
      cin >> pl[j].id;

      a = (int *)calloc(10, sizeof(int));
      pl[j].sc = 0;
      for(int i = 0; i < 9; i++){
	cin >> s;
	for(int k = 0; k < i; k++){
	  if(a[k] > 0){
	    a[k]--;
	    pl[j].sc += s;
	  }
	}
	if(s == 10){
	  a[i] = 2;
	  t = 0;
	} else {
	  cin >> t;
	  for(int k = 0; k < i; k++){
	    if(a[k] > 0){
	      a[k]--;
	      pl[j].sc += t;
	    }
	  }
	  if(s+t == 10){
	    a[i] = 1;
	  }
	}
	pl[j].sc += (s+t);
      }
      cin >> s >> t;
      if(s+t >= 10){
	cin >> u;
      } else {
	u = 0;
      }
      pl[j].sc += (s+t+u);
      for(int k = 7; k < 9; k++){
	if(a[k] > 0){
	  a[k]--;
	    pl[j].sc += s;
	}
	if(a[k] > 0){
	  a[k]--;
	  pl[j].sc += t;
	}
      }

      free(a);
    }
    func(pl, n);
    for(int i = 0; i < n; i++){
      cout << pl[i].id << " " << pl[i].sc << endl;
    }
  }

  return 0;
}

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

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


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <climits>
#include <cmath>
#include <algorithm>
#include <utility>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#define MAX 100
#define INFTY 1<<30 // 2^30
using namespace std;
typedef long long llong;
static const int NIL = -1;
static const int WHITE = 0;
static const int GRAY = 1;
static const int BLACK = 2;

int n, M[MAX][MAX];

void dijkstra()
{
  int minv;
  int d[MAX], color[MAX];

  for(int i = 0; i < n; i++)
  {
    d[i] = INFTY;
    color[i] = WHITE;
  }

  d[0] = 0;
  color[0] = GRAY;
  while(1)
  {
    minv = INFTY;
    int u = -1;
    for(int i = 0; i < n; i++)
    {
      if(minv > d[i] && color[i] != BLACK)
      {
        u = i;
        minv = d[i];
      }
    }
    if(u == NIL) break;
    color[u] = BLACK;
    for(int v = 0; v < n; v++)
    {
      if(color[v] != BLACK && M[u][v] != INFTY)
      {
        if(d[v] > d[u] + M[u][v])
        {
          d[v] = d[u] + M[u][v];
          color[v] = GRAY;
        }
      }
    }
  }
  for(int i = 0; i < n; i++)
    cout << i << " " << (d[i] == INFTY ? -1 : d[i]) << endl;
}

int main()
{
  cin >> n;
  for(int i = 0; i < n; i++)
    for(int j = 0; j < n; j++)
      M[i][j] = INFTY;
  int k, c, u, v;
  for(int i = 0; i < n; i++)
  {
    cin >> u >> k;
    for(int j = 0; j < k; j++)
    {
      cin >> v >> c;
      M[u][v] = c;
    }
  }
  dijkstra();
  return 0;
}

Measured memory_bytes: 1200
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <chrono>
#include <cmath>
#include <complex>
#include <cstring>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <vector>

using namespace std;

using int64 = long long;

#define all(_) begin(_), end(_)
#define rall(_) rbegin(_), rend(_)

template<class T>
std::map<T, int> prime_fact(T n){
  std::map<T, int> result;
  for (T i = 2; i * i <= n; ++i){
    if (n % i != 0) continue;
    int cnt = 0;
    while (n % i == 0){
      n /= i; ++cnt;
    }
    result[i] = cnt;
  }
  if (n != 1) result[n] = 1;
  return result;
}


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

  int n; cin >> n;
  map<int, int> mp = prime_fact(n);
  cout << n << ":";
  for (auto e : mp) {
    for (int i = 0; i < e.second; ++i) {
      cout << " " << e.first;
    }
  }
  cout << endl;

  return 0;
}



Measured memory_bytes: 3224
#include <iostream>
#include <fstream>
#include <string>
#include <algorithm>    // std::reverse
#include <vector>       // std::vector

using namespace std;


void exchange(int *x, int *y){
	int tmp = 0;
	if( *x % 2 != 0){
		*x = *x - 1;
	}
	tmp = *x/2;
	*x = *x - tmp;
	*y = *y + tmp;
}

int main(){

	int a,b,k;
	cin >> a >> b >> k;
	for(int i=0;i<k;i++){
		if(i%2 == 0){
			exchange(&a,&b);
		}else{
			exchange(&b, &a);	
		}
	}
	
	cout << a << " " << b << endl;
}


Measured memory_bytes: 256
#include"bits/stdc++.h"
using namespace std;
using ll=long long;
using ull=unsigned long long;
template<typename T>using pqg=priority_queue<T,vector<T>,greater<T>>;
constexpr auto inf=static_cast<ll>(1e18);
template<typename T=ll>inline T in(){T ret;cin>>ret;return ret;}
template<typename T=ll>inline vector<vector<T>>vec2(size_t h,size_t w,T v=T()){return vector<vector<T>>(h,vector<T>(w,v));}
inline void setp(int n){cout<<fixed<<setprecision(n);}
inline void delnl(){cin.ignore(numeric_limits<streamsize>::max(),'\n');}

int main()
{
    string s,t;cin>>s>>t;
    ll cnt=0;
    for(ll i=0;i<3;++i)if(s[i]==t[i])++cnt;
    cout<<cnt<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<algorithm>
using namespace std;
int main(){
	int h,w;
	cin>>h>>w;
	char ptr[150][150];
	int dp[150][150];
	for(int i=1;i<=h;i++){
		for(int j=1;j<=w;j++){
			cin>>ptr[i][j];
		} 
	}
	memset(dp,0x3f,sizeof(dp));
	dp[1][1]=(ptr[1][1]=='#');
	for(int i=1;i<=h;i++){
		for(int j=1;j<=w;j++){
			if(ptr[i][j+1]=='.'){//下一步，代表不要变 
				dp[i][j+1]=min(dp[i][j+1],dp[i][j]); 
			}else{//下一步代表要变 
				dp[i][j+1]=min(dp[i][j+1],dp[i][j]+(ptr[i][j]=='.')); 
			}
			if(ptr[i+1][j]=='.'){//下一步代表不要变 
				dp[i+1][j]=min(dp[i+1][j],dp[i][j]);
			}else{//下一步代表要变 
				dp[i+1][j]=min(dp[i+1][j],dp[i][j]+(ptr[i][j]=='.'));
			}
		}
	}
	cout<<dp[h][w]<<endl;
	return 0;
} 

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define loop(i,a,b) for(int i=a;i<b;i++)
#define test() int t;cin>>t;loop(test,1,t+1)
#define pb push_back
#define eb emplace_back
#define mkp make_pair
#define nl cout<<"\n"
#define sp cout<<" "
#define F first
#define S second
#define vi vector<int>
#define vl vector<ll>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vii vector<pii>
#define vll vector<pll>
#define MOD 1000000007
#define all(x) x.begin(),x.end()

template<class C> void min_self( C &a, C b ){ a = min(a,b); }
template<class C> void max_self( C &a, C b ){ a = max(a,b); }

ll mod( ll n, ll m=MOD ){ n%=m,n+=m,n%=m;return n; }

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }
    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

unordered_map<long long, int, custom_hash> safe_map;

const int MAXN = 1e5+5;
const int LOGN = 21;
const ll INF = 1e14;
int dx[] = {1,0,-1,0};
int dy[] = {0,1,0,-1};

int main() 
{
    fastio();

    string s;
    cin>>s;
    int n = s.size();

    int cnt = 0;
    for(int i=0;i<n;i++)
    {
        if( n-1-i <= i ) break;
        if( s[i] != s[n-1-i] )
            cnt++;
    }
    cout<<cnt,nl;

    return 0;
}

Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
manzoku = 0

for i in range(N):
    manzoku += B[A[i]-1]
    if i != 0 and A[i-1]+1 == A[i]:
        manzoku += C[A[i-1]-1]
print(manzoku)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define MOD 1000000007
 
using namespace std;

string s;

int main(){

cin>>s; 

int e=s.size();

if(e%2==0){
    if(s[0]==s[e-1]) puts("First");
    else puts("Second");
}else{
    if(s[0]==s[e-1]) puts("Second");
    else puts("First");
}

return 0;
 
}

Measured memory_bytes: 512
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		char tmp = sc.next().charAt(0);
		switch (tmp) {
			case 'A':
				System.out.println('T');
				break;
			case 'T':
				System.out.println('A');
				break;
			case 'C':
				System.out.println('G');
				break;
			case 'G':
				System.out.println('C');
				break;
		}
	}
}


Measured memory_bytes: 23124
h,w=map(int,input().split())
s=[]
for i in range(h):
    s.append(list(input()))

dp=[[99999999 for i in range(w)] for i in range(h)]


if(s[0][0]=='#'):
    dp[0][0]=1
else:
    dp[0][0]=0

for i in range(h):
    for j in range(w):

        if(s[i][j-1] != s[i][j]):
            left = dp[i][j-1]+1
        else:
            left = dp[i][j-1]

        if(s[i-1][j] != s[i][j]):
            top = dp[i-1][j]+1
        else:
            top = dp[i-1][j]

        dp[i][j] = min(dp[i][j],left,top)

print((dp[h-1][w-1]+1)//2)

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

int main() {
    long long A;
    string B;
    cin >> A >> B;
    long long B100 = (B[0]-'0')*100 + (B[2]-'0')*10 + (B[3]-'0');
    cout << A * B100 / 100 << endl;
}

Measured memory_bytes: 3636
n = int(input()) 
TXY = [[0,0,0]] + [list(map(int, input().split())) for _ in range(n)]
diff = [[t2 - t1, abs(x2 - x1), abs(y2 - y1)] for (t1, x1, y1), (t2, x2, y2) in zip(TXY, TXY[1:])]
if all([x + y <= t and (t - (x + y)) % 2 == 0 for t, x, y in diff]):
  print("Yes")
else:
  print("No")

Measured memory_bytes: 38028
/*
    Author: Nguyen Tan Bao
    Status:
    Idea:

*/

#include <bits/stdc++.h>
#define FI first
#define SE second
#define EPS 1e-9
#define ALL(a) a.begin(),a.end()
#define SZ(a) int((a).size())
#define MS(s, n) memset(s, n, sizeof(s))
#define FOR(i,a,b) for (int i = (a); i <= (b); i++)
#define FORE(i,a,b) for (int i = (a); i >= (b); i--)
#define FORALL(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define WHATIS(x) cout << #x << " is " << x << endl;
#define ERROR(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
//__builtin_ffs(x) return 1 + index of least significant 1-bit of x
//__builtin_clz(x) return number of leading zeros of x
//__builtin_ctz(x) return number of trailing zeros of x

using namespace std;
using ll = long long;
using ld = double;
typedef pair<int, int> II;
typedef pair<II, int> III;
typedef complex<ld> cd;
typedef vector<cd> vcd;

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cout << *it << " = " << a << endl;
    err(++it, args...);
}

const ll MODBASE = 1000000007LL;
const int MAXN = 100010;
const int MAXM = 200010;
const int MAXK = 110;
const int MAXQ = 200010;

int n, m, a[MAXN];
priority_queue<int> h;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(nullptr);
    cin >> n >> m;
    FOR(i,1,n) cin >> a[i];
    FOR(i,1,n) h.push(a[i]);
    FOR(i,1,m) {
        int r = h.top(); h.pop();
        h.push(r / 2);
    }
    ll res = 0;
    while (!h.empty()) {
        res += h.top();
        h.pop();
    }
    cout << res;
    return 0;
}


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

int main(){
	int N;
	cin>>N;
	int C[N-1],S[N-1],F[N-1];
	for(int i=0;i<N-1;++i){
		cin>>C[i]>>S[i]>>F[i];
	}
	int ans[N];
	for(int i=0;i<N;++i)ans[i]=0;
	for(int i=0;i<N-1;++i){
		ans[i]+=S[i]+C[i];
		for(int j=i+1;j<N-1;++j){
			if(ans[i]>S[j]){
				int num;
				if((ans[i]-S[j])%F[j]==0)num=(ans[i]-S[j])/F[j];
				else num=(ans[i]-S[j])/F[j]+1;
				ans[i]=S[j]+num*F[j]+C[j];
			}
			else{
				ans[i]=S[j]+C[j];
			}
		}
	}
	for(int i=0;i<N;++i){
		cout<<ans[i]<<endl;
	}
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <math.h>
#include <string.h>
#include <map>
#include <numeric>
using namespace std;

int main()
{
  int H,W;
  cin>>H>>W;
  for(int i=0;i<W+2;i++){
    cout<<'#';
  }
  cout<<endl;
  for(int i=0;i<H;i++){
    string t;
    cin>>t;
    cout<<'#'<<t<<'#'<<endl;
  }
  for(int i=0;i<W+2;i++){
    cout<<'#';
  }
  cout<<endl;
}


Measured memory_bytes: 256
// https://atcoder.jp/contests/abc159/tasks/abc159_c

#include <iostream>
#include <iomanip>
#include <cmath>

using namespace std;

double solve(int L) {
    return (L * L * L) / 27.0;
}

int main() {
    int L;
    cin >> L;
    cout << fixed << setprecision(7) << solve(L) << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<math.h>
#include<string>
#include<algorithm>
using namespace std;


int ans;

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

Measured memory_bytes: 256