akhauriyash/Code-Regression huggingface dataset:
import * as fs from "fs";

let input = (fs.readFileSync("/dev/stdin", "utf8") as string).split("\n");
const [n, m] = input[0].split(" ").map((x: string): number => +x);

const g: Array<Array<{ to: number, cost: number }>> = [];
for (let i = 0; i <= n; i++) g[i] = [];
for (let i = 0; i < m; i++) {
	const [from, to, cost] = input[i + 1].split(" ").map((x: string): number => +x);
	g[from].push({to, cost});
	g[to].push({to: from, cost: -cost});
}

const stack: Array<{ x: number, d: number }> = [];
const visited = new Array(n + 1).fill(false);
const dist = new Array(n + 1).fill(0);

let result = true;

top:
	for (let i = 1; i <= n; i++) {
		if (visited[i]) continue;
		stack.push({x: i, d: 0});

		while (stack.length > 0) {
			const {x, d} = stack.pop()!;

			if (visited[x]) {
				if (dist[x] !== d) {
					result = false;
					break top;
				}
				continue;
			}

			visited[x] = true;
			dist[x] = d;
			for (const {to, cost} of g[x]) {
				stack.push({x: to, d: d + cost});
			}
		}
	}


console.log(result ? "Yes" : "No");


Measured memory_bytes: 105696
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep2(i,a,b) for(int i=(a);i<(b);++i)

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

//vector出力
template <class T>ostream &operator<<(ostream &o,const vector<T>&v){
  o<<"{";
  for(int i=0;i<(int)v.size();i++) o << (i>0?", ":"") << v[i];
  o<<"}"<<endl;
  return o;
}

//逆元　a/b の modをとるとき -> a*modinv(b)%mod
long long modinv(long long a, long long m = 1e9+7) {
  long long b = m, u = 1, v = 0;
  while (b) {
    long long t = a / b;
    a -= t * b; swap(a, b);
    u -= t * v; swap(u, v);
  }
  u %= m; 
  if (u < 0) u += m;
  return u;
}
ll const mod = 1e9+7;

// combination
const int MAX = 510000;
const ll MOD = 1000000007;
 
long long fac[MAX], finv[MAX], inv[MAX];
 
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; 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;
    }
}
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main() {
  int L,R,d;
  cin >> L >> R >> d;
  int cnt=0;
  rep2(i,L,R+1) {
    if (i%d==0) cnt++;
  }
  cout << cnt  << endl;

}


Measured memory_bytes: 3596
#include<algorithm>
#include<cfloat>
using namespace std;

main(){
  double minv = FLT_MAX;
  double maxv = FLT_MIN;

  double x;
  while( cin >> x ){
    minv = min(minv, x );
    maxv = max(maxv, x );
  }

  printf("%.1lf\n", maxv - minv );
}

Measured memory_bytes: 0
#include <iostream>
using namespace std; 
/* run this program using the console pauser or add your own getch, system("pause") or input loop */

int main(int argc, char** argv) {
	string s;
	cin>>s;
	if(s[0]=='7'||s[1]=='7'||s[2]=='7')cout<<"Yes";
	else cout<<"No";
	return 0;
}

Measured memory_bytes: 3628
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;

public class Main {
    public void exec() throws IOException {
    	try(
    			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    			PrintWriter out = new PrintWriter(System.out);
    			){
            int n = Integer.parseInt(br.readLine());
            String[] s = br.readLine().split(" ");
            String[] s2 = new String[n];
            for(int i=0; i<n; i++) {
            	s2[i] = s[n-i-1];
            }
            out.println(String.join(" ",s2));
            out.flush();
    	}
    }
 
    public static void main(String[] args) throws IOException {
    	new Main().exec();
    }
}
 

Measured memory_bytes: 24352
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vs = vector<string>;
using msi = map<string, int>;
using mii = map<int, int>;
using psi = pair<string, int>;
using pii = pair<int, int>;
using vlai = valarray<int>;
#define rep(i,n) for(int i=0;i<n;i++)
#define range(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define INF 1E9
#define EPS 1E-9
#define MOD (ll)(1E9+7)
#define PI 3.1415926535897932384

template <class T>ostream &operator<<(std::ostream &o, const vector<T> &v)
{
	rep(i, v.size()) {
		o << (i > 0 ? " " : "") << v[i];
	}
	return o;
}


class info {
	public:
		int dis;
		int cost;
};
bool comp(info lh, info rh) {
	return lh.cost > rh.cost;
}
int main() {
	int road, money;
	while (cin >> road >> money, road) {
		vector <info> v(road);
		for (int i = 0; i < road; i++) {
			cin >> v[i].dis >> v[i].cost;
		}
		sort(v.begin(), v.end(), comp);
		/*
		for (auto c : v) {
			cout << c.dis << " " << c.cost << endl;
		}
		*/
		for (int i = 0; i < v.size(); i++) {
			if (v[i].dis <= money) {
				money -= v[i].dis;
				v[i].dis = 0;
			}
			else {
				v[i].dis -= money;
				money = 0;
			}
		}
		int ans = 0;
		for (int i = 0; i < v.size(); i++) {
			ans += v[i].cost*v[i].dis;
		}
		cout << ans << endl;
	}
}



Measured memory_bytes: 3220
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
#include<bits/stdc++.h>
#define inf 0x3f3f3f3f
const int maxn = 2e6+100;
using namespace std;
typedef long long ll;
int main()
{
	ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    string s;
    cin>>s;
    for(int i=0;i<s.size();i++){
    	if(s[i]!='?')
    	cout<<s[i];
    	else cout<<"D";
	}
	return 0;
}

Measured memory_bytes: 3744
#include <stdio.h>

int main(void)
{
	float x[3], y[3], xp, yp;
	float sM, s1, s2, s3;
	
	while (scanf("%f %f %f %f %f %f %f %f", &x[0], &y[0], &x[1], &y[1], &x[2], &y[2], &xp, &yp) != EOF){
		
		sM = ((x[1] - x[0]) * (y[2] - y[0]) - (x[2] - x[0]) * (y[1] - y[0])) / 2;
		if (sM < 0){
			sM *= -1;
		}
		
		s1 = ((xp - x[2]) * (y[1] - y[2]) - (x[1] - x[2]) * (yp - y[2])) / 2;
		if (s1 < 0){
			s1 *= -1;
		}
		
		s2 = ((xp - x[1]) * (y[0] - y[1]) - (x[0] - x[1]) * (yp - y[1])) / 2;
		if (s2 < 0){
			s2 *= -1;
		}
		
		s3 = ((xp - x[0]) * (y[2] - y[0]) - (x[2] - x[0]) * (yp - y[0])) / 2;
		if (s3 < 0){
			s3 *= -1;
		}
		
		if (sM == s1 + s2 + s3){
			printf("YES\n");
		}
		else {
			printf("NO\n");
		}
	}
	
	return (0);
}

Measured memory_bytes: 1036
#include <iostream>
using namespace std;
int main() {
	int a,b;
	cin>>a>>b;
	do{
	if (a!=0 || b!=0)
		for (int i=0;i<a;i++){
			if (i==0 || i==a-1)
				{
				for (int j=0;j<b;j++){
					cout<<"#";
				}
				cout<<endl;
			}
			else {
				cout<<"#";
				for (int j=0;j<b-2;j++){
					cout<<".";
				}
				cout<<"#"<<endl;
			}
		}
		cin>>a>>b;
		cout<<endl;
	}while(a!=0 || b!=0);
	return 0;
}


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

int main() {
  ll a, b, c, x, y;
  cin >> a >> b >> c >> x >> y;
  ll ans = LLONG_MAX;
  for(ll i = 0; i<=100000; i++) {
    if(x<0 && y<0) ans = min(ans, 2*i*c);
    else if(x<0) ans = min(ans,b*y+2*i*c);
    else if(y<0) ans = min(ans,a*x+2*i*c);
    else ans = min(ans,a*x+b*y+2*i*c);
    x--;
    y--;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <set>
#include <map>
#include <vector>
#include <locale>
#include <algorithm>
using namespace std;
bool compa(int i, int j){
	return (i>j);
}
int main(){
	long long N;
	cin>>N;
	long long valores;
	map<long long, long long> mapa;
	for (long long i = 0; i < N; i++)
	{
		cin>>valores;
		if(mapa.count(valores)){
			mapa[valores]++;
		}else{
			mapa[valores]=1;
		}
	}
	int remover = 0;
	for (auto i: mapa)
	{
		if(i.first < i.second){
			remover+= (i.second - i.first);
		}else if(i.first > i.second){
			remover += i.second;
		}
	}
	cout<<remover;
	
	return 0;
}

Measured memory_bytes: 6272
#include <iostream>
#include <string>
#include <cctype>
#include <cassert>

using namespace std;

typedef unsigned long long LL;
const LL MOD = 1000000007LL;

void skip(const string &s, int &pos) {
    while(pos >= 0 && s[pos] == ' ') --pos;
}

LL number(const string &s, int &pos) {
    skip(s, pos);
    LL val = 0;
    LL ord = 1;
    while(pos >= 0 && isdigit(s[pos])) {
        val += ord * (s[pos] - '0');
        ord *= 10;
        --pos;
    }
    return val;
}

LL expr(const string &s, int &pos) {
    skip(s, pos);
    LL val = 0;
    if(isdigit(s[pos])) {
        val = number(s, pos);
    } else if(s[pos] == '>') {
        --pos;
        val = expr(s, pos);
        val = (val*val) % MOD;
    } else {
        cerr << s << ' ' << pos << endl;
        assert(false);
    }
    skip(s, pos);
    if(pos >= 0) {
        if(s[pos] == '>' && s[pos-1] == '>') {
            pos -= 2;
            const LL lhs = expr(s, pos);
            if(val > 63) val = 0;
            else val = lhs >> val;
        } else if(s[pos] == '<') {
            --pos;
        } else {
            assert(false);
        }
    }
    //cout << val << "(" << pos << ")" << endl;
    return val;
}

bool solve() {
    string str;
    getline(cin, str);
    if(str == "#") return false;

    int pos = str.size()-1;
    for(char &c : str) {
        if(c == 'S') c = ' ';
    }
    cout << expr(str, pos) << endl;
    return true;
}

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

    while(solve()) ;
    return 0;
}

Measured memory_bytes: 2968
def fibonacci(n):
    dp = [1 for i in range(n)]
    for i in range(2,n):
        dp[i] = dp[i-2]+dp[i-1]
    return dp[n-1]

n,m = map(int, input().split())

b = -1

ans = 1
for i in range(m+1):
    a = b
    if i==m:
        b = n+1
    else:
        b = int(input())
    c = b-a-2
    if c == -1:
        print(0)
        exit()
    ans *=fibonacci(c+1)
    ans %= 10**9+7

print(ans)

Measured memory_bytes: 471348
a,b=list(map(int,input().split()))
X={1:2,2:5,3:5,4:4,5:5,6:6,7:3,8:7,9:6}
A=list(map(int,input().split()))
B=[v for k,v in X.items() if k in A]
#print(B)
DP=[0]+[[] for i in range(10**4+1)]
L=[[] for i in range(10**4+1)]
for i in range(10):
    if i in B:
        DP[i]=1
        L[i].append(i)
#print(DP)
for i in range(1,10**4+1):
    if [DP[i-j] for j in B if i-j>=0 and not DP[i-j]==[]]==[]:
        DP[i]=[]
    else:
#        print(i,[DP[i-j] for j in B if i-j>=0 and not DP[i-j]==[]])
        M=[DP[i-j] for j in B if i-j>=0 and not DP[i-j]==[]]
        DP[i]=max([DP[i-j] for j in B if i-j>=0 and not DP[i-j]==[]])+1
        l=[0]
        for t in B:
            if not DP[i-t]==[] and DP[i]==DP[i-t]+1:
                l=l+[k for k,v in X.items() if v==t and k in A]
                L[i]=L[i-t]+[max(l)]
L[a].sort(reverse=True)
s='0'
for i in L[a]:
    s+=str(i)
print(int(s))

Measured memory_bytes: 248692
import sys
n = int(input())
a = list(map(int, sys.stdin.readline().split()))
cnt = 1
up = False
down = False

for i in range(n - 1):
    if up == False and down == False:
        if a[i] < a[i + 1]:
            up = True
        elif a[i] > a[i + 1]:
            down = True
        else:
            pass
    elif up == True:
        if a[i] > a[i + 1]:
            cnt += 1
            up = False
    elif down == True:
        if a[i] < a[i + 1]:
            cnt += 1
            down = False

print(cnt)

Measured memory_bytes: 14172
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <assert.h>
     
using namespace std;
     
typedef long long ll;
     
#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define per(i,a,b) for(ll i=b-1LL;i>=(a);--i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(c) string(1,c)
#define print(x) cout<<#x<<" = "<<x<<endl;
     
#define MOD 1000000007

ll d[3010][3010];
ll dp[3010][3010][4];


int main(){
  clr(d,0);
  ll h,w,k;
  cin>>h>>w>>k;
  map<pair<ll,ll>,ll> ma;
  rep(i,0,k){
    ll a,b,c;
    cin>>a>>b>>c;
    a--;b--;
    d[a][b] = c;
  }
  dp[0][0][1] = d[0][0];
  rep(i,0,h){
    rep(j,0,w){
      ll a = d[i][j];
      rep(k,0,4){
        if(j-1>=0)dp[i][j][k] = max(dp[i][j][k],dp[i][j-1][k]);
        if(i-1>=0)dp[i][j][0] = max(dp[i][j][0],dp[i-1][j][k]);
        if(i-1>=0)dp[i][j][1] = max(dp[i][j][1],dp[i-1][j][k]+a);
        if(j-1>=0&&k+1<=3)dp[i][j][k+1] = max(dp[i][j][k+1],dp[i][j-1][k]+a);
      }
    }
  }
  ll mx = 0;
  rep(i,0,4){
    mx = max(mx,dp[h-1][w-1][i]);
  }
  cout << mx << endl;
}

Measured memory_bytes: 356444
n = int(input())
words = []
for i in range(n):
    words.append(input())

flag = True

for i in range(n-1):
    if words[i][-1] != words[i+1][0]:
        flag = False
        break

if len(set(words)) != n:
    flag = False

if flag:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3064
#include<stdio.h>

int main(){
  int i,j,n,k,tmp,sum;
  scanf("%d %d",&n,&k);
  int p[n];
  for(i=0;i<n;i++){
    scanf("%d",&p[i]);
  }
  
  for (i=0; i<n; ++i) {
    for (j=i+1; j<n; ++j) {
      if (p[i] > p[j]) {
        tmp =  p[i];
        p[i] = p[j];
        p[j] = tmp;
      }
    }
  }
  
  sum=0;
  for(i=0;i<k;i++){
    sum=sum+p[i];
  }
  
  printf("%d",sum);
  
  return 0;
}


Measured memory_bytes: 1688
#include <iostream>

using namespace std;

int main()
{
    long long h,w,s;
    cin >> h >> w;
    s = h*w/2;
    if(h*w%2 == 1) s++;
    if(h==1 || w==1) s=1;
    cout << s << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#define LEN 100005
#define MAX 100000

typedef struct pp{
  char name[100];
  int t;
}P;

P Q[LEN+1];
int head, tail, n;

void enqueue(P x){
  if(isFull()){
    printf("error(overflow)");
      }
  Q[tail] = x;
  if(tail + 1 == MAX) tail = 0;
  else tail++;
}

P dequeue(){
  P a;
  if(isEmpty()){
    printf("error(underflow)");
      }
  a = Q[head];
  if(head + 1 == MAX) head = 0;
  else head++;
  return a;
}
int isEmpty(void){
  if(head==tail)
  return 1;
  else return 0;
}
int isFull(void){
  if((head==tail+1)% MAX)
    return 1;
  else return 0;
}
  
int main(){
  int elaps = 0, c;
  int i, q;
  P u;
  scanf("%d %d", &n, &q);

  for ( i = 1; i <= n; i++){
    scanf("%s", Q[i].name);
    scanf("%d", &Q[i].t);
  }
  head = 1;
  tail = n +1;
  while(n != 0){
    u = Q[head];
    u.t = Q[head].t - q;
    if(u.t > 0){
      elaps = elaps + q;
      enqueue(u);
      Q[head]=dequeue();
    } else {
      elaps = elaps + Q[head].t;
      printf("%s %d\n",u.name,elaps);
      Q[head] = dequeue();
      n--;
    }
  }
  return 0;
}

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

#define fastio 			ios::sync_with_stdio(0);	cin.tie(0); cout.tie(0);  cout<<fixed;  cout<<setprecision(12);
#define randomINT 		mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define	newl 			cout<<"\n"
#define DISP(as)		for(auto it : as) cout<<it<<" ";newl;
#define all(x)         	(x).begin(),(x).end()
#define mset(x,val)    	memset(x,val,sizeof(x))
#define newl           	cout<<"\n"
#define pb             	push_back
#define mp             	make_pair
#define f 				first
#define s 				second
#define dline          cerr<<"///REACHED///\n";
#define deb1(x)        cerr<<#x<<" = "<<x<<'\n';
#define deb2(x,y)      cerr<<'['<<#x<<','<<#y<<"] = "<<'['<<x<<','<<y<<']'<<'\n';
#define deb3(x,y,z)    cerr<<'['<<#x<<','<<#y<<','<<#z<<"] = "<<'['<<x<<','<<y<<','<<z<<']'<<'\n';

typedef long long 				ll;
typedef long double 			ld;
typedef vector<ll> 				vll;
typedef pair<ll , ll> 			pll;
typedef pair<ld, ld> 			pld;
typedef unordered_map<ll, ll> 	um;
typedef vector<pll> 			vpll;

const ll 	MAX5 	= 	1e+5 + 7;
const ll 	MAX7 	= 	1e+7 + 7;
const ll 	MAXN 	= 	MAX7;
const ll   	INF   	=  	0x7f7f7f7f7f7f7f7f;
const int  	INFi 	=  	0x7f7f7f7f;
const ll 	MOD		=  	1e+9 + 7;


// <------------- Declare Variables Here ------------> //

ll T = 1;
ll n, x, m, y, k, z, N;
ll s, t, d;


// <------------- Implement Functions Here ----------> //



// <------------- Start of main() -------------------> //

void MAIN() {
	cin >> n >> m ;
	vpll a;
	ll cou = 0;
	for(ll i=0;i<n;i++) {
		cin >> x >> y;
		a.pb({x,y});
	}
	sort(all(a));
	for(ll i=0;i<n;i++) {
		if(m <= a[i].s) {
			cou+=m*a[i].f;
			break;
		}
		cou+=a[i].f*a[i].s;
		m-=a[i].s;
	}	
	cout<<cou;newl;
}

int main() {
	fastio; randomINT;
	//cin >> T;
	while (T--) {
		MAIN();
	}
	return 0;
}


Measured memory_bytes: 5320
#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef long long ll;
typedef long double ld;
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define mod 1000000007
#define autoit(x,it) for(auto it = x.begin(); it != x.end(); it++)
#define rep(n) for(ll i = 0; i < n; i++)

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 

#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 

using namespace std;


int main()
{
   FAST/**/
   
   ll n;
   cin>>n;
   
   ll arr[n];
   for(ll i=0;i<n;i++)
        cin>>arr[i]; 
   
   ll req = 1;
   for(ll i=0;i<n;i++)
   {
       if(arr[i] == req)
           req++;
   }
   
   if(n-req+1>n-1)
        cout<<-1;
   else
        cout<<n-req+1;
        
   
   return 0;        
}  
   

Measured memory_bytes: 1792
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cassert>
#include <functional>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
using namespace std;
using llong = long long;

llong x;
llong ans = 1;

int main() {
    cin >> x;

    for (int i = 0; i <= x; i++) {
        llong power = i;
        for (int j = 2; j <= x; j++) {
            power *= i;
            if (power > x) break;
            
            if (x - power < x - ans) {
                ans = power;
            }
        }
    }

    cout << ans << endl;

    return 0;
}


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

bool checkCount(int& index, int wantNum, vector<int> v) {
    int sumLength = 0;
    // cout << "index: " << v[index] << " wantNum = " << wantNum << endl;
    for (int i = index; i < v.size(); i++) {
        sumLength += v[i];
        // cout << sumLength << endl;
        if (sumLength >= wantNum) {
            if (sumLength == wantNum) {
                index = i + 1;
                return true;
            }
            return false;
        }
    }
}

int solve(vector<int> v) {
    int right = 0;
    int sumLength = 0;
    for (int left = 0; left < v.size(); ++left) {
        while (right < v.size() && (sumLength + v[right] <= 5)) {
            sumLength += v[right];
            right++;
        }
        if (sumLength == 5) {
            int index = right;
            if (checkCount(index, 7, v)) {
                if (checkCount(index, 5, v)) {
                    if (checkCount(index, 7, v)) {
                        if (checkCount(index, 7, v)) {
                            return left + 1;
                        }
                    }
                }
            }
        }
        if (right == left)
            ++right;
        else
            sumLength -= v[left];
    }

    return 0;
}

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

    while (1) {
        int N;
        cin >> N;
        if (!N) break;
        vector<int> tanku(N);
        for (int i = 0; i < N; i++) {
            string ku;
            cin >> ku;
            tanku[i] = ku.size();
        }
        cout << solve(tanku) << endl;
    }
}


Measured memory_bytes: 3200
#include<bits/stdc++.h>
using namespace std;
set<string> d;
void c(string s){
  if(d.count(s) || s.size()==1)return;
  string a = s.substr(0,s.size()/2), b = s.substr(s.size()/2);
  if(a == b)c(a);
  else{ d.insert(s); c(a); c(b); } 
}

int main(){
  int n; cin >> n;
  string s; cin >> s;
  c(s);
  cout << d.size() << endl;
}

Measured memory_bytes: 1240
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
typedef struct{
    int num;
    int p;
}list_t;
int p_comp(const void*a,const void*b){return ((list_t*)a)->p-((list_t*)b)->p;}
int compare_int(const void *a, const void *b)
{
    return *(int*)a - *(int*)b;
}

int main(void)
{
    int n;
    list_t pp[200000];

    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%d",&pp[i].p);
        pp[i].num=i;
    }
    qsort(pp,n,sizeof(list_t),p_comp);
    //for(int i=0;i<n;i++)printf("%d ",pp[i].p);
    //printf("\n");

    int min=pp[0].num;
    int cnt=0;
    for(int i=0;i<n;i++){
        //printf("p[i]=%d num=%d min=%d\n",pp[i].p,pp[i].num,min);
        if(min>pp[i].num||i==0){
            cnt++;
            //printf(">>%d\n",pp[i].p);
        }
        if(pp[i].num<min){
            min=pp[i].num;
        }
        
    }
    printf("%d\n",cnt);


}

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


typedef pair<ll, int> P;
const ll INF = 1e15;
struct edge { int to; ll cost; };

class Dijk {
public:
  vector<edge> G[100005];
  ll dist[100005];
  int used[100005];

  void dijk(int s, int V) {
    priority_queue<P,vector<P>,greater<P>> Q;
    rep(i, 0, V) dist[i] = INF;
    rep(i, 0, V) used[i] = 0;
    dist[s] = 0;
    Q.push({0, s});

    while(!Q.empty()) {
      P p = Q.top(); Q.pop();
      int v = p.second;
      if(used[v]) continue;
      used[v] = 1;
      for(auto &e : G[v]) {
        if(dist[e.to] > dist[v] + e.cost) {
          dist[e.to] = dist[v] + e.cost;
          Q.push({dist[e.to], e.to});
        }
      }
    }
  }
};


int main() {
  int N, Q, K;
  cin >> N;
  Dijk D;
  rep(i, 0, N - 1) {
    int a, b, c;
    cin >> a >> b >> c;
    a--, b--;
    D.G[a].push_back({b, c});
    D.G[b].push_back({a, c});
  }
  cin >> Q >> K;
  K--;
  D.dijk(K, N);
  while(Q--) {
    int x, y;
    cin >> x >> y;
    x--, y--;
    cout << D.dist[x] + D.dist[y] << "\n";
  }
  return 0;
}


Measured memory_bytes: 11504
#include "iostream"
#include "string"
#include "vector"
#include "algorithm"
#include "functional"
#include "cmath"

int main() {
    // get values from input
    std::string s;

    std::cin >> s;
    // main procedure
    int red_num = 0;
    int blue_num = 0;

    for (char c:s) {
        if (c == '0') {
            red_num++;
        } else if(c == '1') {
            blue_num++;
        }
    }

    // output
    std::cout << std::min(red_num, blue_num) * 2 << std::endl;

    return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <numeric>
#include <math.h>
#include <algorithm>
#include <float.h>
#include <limits>
#include <vector> 
#include <string.h>

#define rep(i,a,n) for(ll int (i) = (a);(i) < (n);(i)++)
#define urep(i,a,n) for(ll int (i) = (a);(i) > (n);(i)--)
#define MOD 1000000007
#define ll long long
#define asort(a) sort(a.begin(),a.end());

using namespace::std;

int jo(ll int jxo, ll int jyo){//累乗
	ll int jhogeo = 1;
	rep(jinto,0,jyo) jhogeo=jhogeo*jxo;
	return jhogeo;
}
char tobig(char toxbig){//char大文字化
  return (toxbig-0x20);
}
char tolow(char toxlow){//char小文字化
  return (toxlow+0x20);
}
int ctoi(char cctoi){//char->int
  if('0' <= cctoi && cctoi <= '9') return (cctoi-'0');
  return -1;
}
int gcd(int gcad, int gcbd) {//最大公約数
  if(gcad < gcbd) return gcd(gcbd, gcad);
  int gcrd;
  while ((gcrd=gcad%gcbd)) {
    gcad = gcbd;
    gcbd = gcrd;
  }
  return gcbd;
}
int lcm(int lcam, int lcbm){//最小公倍数
 return (lcam*lcbm)/gcd(lcam,lcbm);
}


int main(){
  int n;
  cin>>n;
  vector<int> a(n);
  int hoge;
  rep(i,0,n){
    cin>>hoge;
    a[hoge-1]=i+1;
  }
  rep(i,0,n) cout<<a[i]<<" ";

}
// int *p = new int[N];

//  vector<int> 変数名(要素数);
//  sort(変数名.begin(),変数名.end());//昇順ソート

// vector<vector<int>> 変数名(左の個数, vector<int>(右の個数));

//


Measured memory_bytes: 1152
#include<iostream>
#include<vector>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<long long> a(n);
  int i;
  bool f = true;
  for(i=0;i<n&&f;i++) {
    cin >> a[i];
    if(a[i]==0)f=false;
  }
  if(!f) {
cout << 0 << endl;
    return 0;
  }
  long long now=1;
i=0;
  while(f&&i<n) {
if((long long)1e18/now<a[i])f = false;
    else now *= a[i];
    i++;
  }
cout << (f?now:-1) << endl;
}


Measured memory_bytes: 3988
#!/usr/bin/env python3

from sys import stdin, setrecursionlimit


def main():
    input = stdin.buffer.readline
    h, w, k = map(int, input().split())
    m = [list(input()[:-1].decode()) for _ in range(h)]
    ans = [[0] * w for _ in range(h)]
    num = 1
    for i in range(h):
        indexes = [j for j in range(w) if m[i][j] == '#']
        n = len(indexes)
        if n == 0:
            if ans[i - 1].count(0) == 0:
                ans[i] = ans[i - 1]
        else:
            for j in range(w):
                ans[i][j] = num
                if (j in indexes and indexes[-1] != j) or j == w - 1:
                    num += 1

    for i in reversed(range(h - 1)):
        if ans[i].count(0) == w:
            ans[i] = ans[i + 1]

    for i in range(h):
        if ans[i].count(0) == w:
            ans[i] = [1] * w

    for a in ans:
        print(*a)


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()


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

int main(){
  int N ;
  cin >> N ; 
  vector<int> A(N) ;
  
  for(int i = 0 ; i < N ; i++){
    cin >> A.at(i) ;
  }
  
  sort(A.begin(),A.end());
  
  for(int i = 1 ; i<=N-1 ; i++){
    if(A.at(i) == A.at(i-1) ){
      cout << "NO" << endl ; 
      return 0 ; 
    }
  }
  
       
  cout << "YES" << endl ; 
       
       
       
}

Measured memory_bytes: 4032
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i <(n); ++i)
#define REP2(i,x,n) for (int i = x; i <(n); ++i)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
using namespace std;
using ll = long long;
using P = pair<int,int>;
static const double PI = acos(-1);



int main(){
  string s, t;
  cin >> s >> t;

  bool ok = true;

  if(s[0] != t[2]) ok = false;
  if(s[1] != t[1]) ok = false;
  if(s[2] != t[0]) ok = false;

  if(ok) cout << "YES" << endl;
  else cout << "NO" << endl;

  return 0;
}


Measured memory_bytes: 3652
#include<iostream>

#include<cmath>
#include<string>
#include <algorithm> 
using namespace std;

int main()
{
    string a,b;
    cin >> a >> b;

    if (a>b) cout << ">" << endl;
    else if (a<b) cout << "<" << endl;
    else if (a==b) cout << "=" << endl;
}

Measured memory_bytes: 256
def main():
    N = int(input())
    A = list(map(int,input().split()))
    answer = "APPROVED"
    for a in A:
        if a % 2 == 0:
            if a % 3 == 0 or a % 5 == 0:
                pass
            else:
                answer = "DENIED"
        else:
            pass
    print(answer)

if __name__ == "__main__":
    main()

Measured memory_bytes: 38384
package main

import (
	"fmt"
)

func main() {
	var A, B, K int
	fmt.Scan(&A, &B, &K)
	if A >= K {
		fmt.Printf("%d %d\n", A-K, B)
	} else if K <= A+B {
		fmt.Printf("%d %d\n", 0, B-(K-A))
	} else {
		fmt.Printf("%d %d\n", 0, 0)
	}
}


Measured memory_bytes: 512
#include <iostream>
using namespace std;
int main(void){
    int num;
    int K;
    cin>>num>>K;
    
    int X[num];
    for(int i=0; i<num;i++){
        X[i]=i+1;
    }
    
    if(X[num-1]>=K){
        cout<<X[num-1]-(K-1)<<endl;
    }
    else cout<<0<<endl;
    
    return 0;
}


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

int way = -1;

void calc(int x, int y, int w, int h){
  double t;
  // 縦できる
  if ( 2.0 * y - h  == 0){
    if ( w == 2 * x){
      way ++;
    }
  }else {
  t = (2.0 * x - w) / (2.0 * y - h);
  double long_ = w - x + y * t;
  double short_ = w - x - ( h - y ) * t;
//  cout  << "t: " << t << endl;
//  cout << "long: " << long_ << " short: " <<  short_ << endl;
   if ( long_ <= w && long_ >=0 && short_ <= w && short_ >= 0){
    way ++;
  }
  }
}

int main(){
  long long w, h, x, y;
  cin >> w >> h >> x >> y;

  if ( (x == w && y == h) || ( x == 0 && y == h) || (x == w && y == 0) || ( x == 0 && y == 0)){
    way = 0;
  }else {
    calc(x, y, w, h);
    calc(y, x, h, w);
  }

  cout << w * h / 2.0 << " " << way << endl;


  return 0;
}

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

char pa[] = " .,-'?";

int main()
{
	map<string,char> m;
	m["101"     ] = ' ';
	m["000000"  ] = '\'';
	m["000011"  ] = ',';
	m["10010001"] = '-';
	m["010001"  ] = '.';
	m["000001"  ] = '?';
	m["100101"  ] = 'A';
	m["10011010"] = 'B';
	m["0101"    ] = 'C';
	m["0001"    ] = 'D';
	m["110"     ] = 'E';
	m["01001"   ] = 'F';
	m["10011011"] = 'G';
	m["010000"  ] = 'H';
	m["0111"    ] = 'I';
	m["10011000"] = 'J';
	m["0110"    ] = 'K';
	m["00100"   ] = 'L';
	m["10011001"] = 'M';
	m["10011110"] = 'N';
	m["00101"   ] = 'O';
	m["111"     ] = 'P';
	m["10011111"] = 'Q';
	m["1000"    ] = 'R';
	m["00110"   ] = 'S';
	m["00111"   ] = 'T';
	m["10011100"] = 'U';
	m["10011101"] = 'V';
	m["000010"  ] = 'W';
	m["10010010"] = 'X';
	m["10010011"] = 'Y';
	m["10010000"] = 'Z';

	string str,key;
	while(getline(cin,str))
	{
		string xxx;
		for(int i=0; i<str.size(); i++)
		{
			if('A'<=str[i] && str[i]<='Z')
			{
				int x=str[i]-'A';
				for(int j=0; j<5; j++)
				{
					xxx += ((x>>(4-j))&1) + '0';
				}
			}
			else
			{
				switch(str[i])
				{
					case ' ' : xxx+="11010"; break;
					case '.' : xxx+="11011"; break;
					case ',' : xxx+="11100"; break;
					case '-' : xxx+="11101"; break;
					case '\'': xxx+="11110"; break;
					case '?' : xxx+="11111"; break;
				}
			}
		}

		key="";
		for(int i=0; i<xxx.size(); i++)
		{
			key+=xxx[i];
			if(m.find(key)!=m.end())
			{
				cout << m[key];
				key="";
			}
		}
		cout << endl;
	}
}

Measured memory_bytes: 0
import sys
sys.setrecursionlimit(10**6)
from math import floor,ceil,sqrt,factorial,log
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from operator import itemgetter
from fractions import gcd
mod = 10 ** 9 + 7
inf = float('inf')
ninf = -float('inf')
 
#整数input
def ii(): return int(sys.stdin.readline().rstrip()) #int(input())
def mii(): return map(int,sys.stdin.readline().rstrip().split())
def limii(): return list(mii()) #list(map(int,input().split()))
def lin(n:int): return [ii() for _ in range(n)]
def llint(n: int): return [limii() for _ in range(n)]
#文字列input
def ss(): return sys.stdin.readline().rstrip() #input()
def mss(): return sys.stdin.readline().rstrip().split()
def limss(): return list(mss()) #list(input().split())
def lst(n:int): return [ss() for _ in range(n)]
def llstr(n: int): return [limss() for _ in range(n)]

#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？
#https://atcoder.jp/contests/cf17-final-open/tasks/cf17_final_a
s=list(ss())
if len(list(s))>9:
    print("NO")
    exit()

ans =[]

kih=["K","I","H"]
b=["B"]
r=["R"]

chk=False
for i in list(product([0,1], repeat=4)):
    a1,a2,a3,a4=[],[],[],[]
    if i[0]==1:
        a1.append("A")
    if i[1]==1:
        a2.append("A")
    if i[2]==1:
        a3.append("A")
    if i[3]==1:
        a4.append("A")
    
    if s==a1+kih+a2+b+a3+r+a4:
        chk=True
    #print(a1+kih+a2+b+a3+r+a4)
if chk==True:
    print("YES")
else:
    print("NO")


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

using namespace std;

#define ll long long

int main() {
    int n;
    cin>>n;
    ll a[n];
    map<ll,int>cnt;
    set<ll>s;
    for(int i=0;i<n;i++) {
        cin>>a[i]; cnt[a[i]]++;
        s.insert(a[i]);
    }

    set<ll>::reverse_iterator it;
    ll l=0,b=0;
    for(it=s.rbegin();it!=s.rend();it++) {
        ll x=*it;
        if(l && b) break;
        if(cnt[x]>=2 ) {
            if(l==0) {
            l=x;
            if(cnt[x]>=4) b=x;
            }
            else {
                b=x;
            }
        }
    }
    cout<<l*b<<endl;


    return 0;
}


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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;
int n, k;
int a[105];
bool lose[100005];
void search(int now){
    lose[now] = true;
    for(int i = 1; i <= n; i++){
        int next = now - a[i];
        if(next < 0) continue;
        if(lose[next]){
            lose[now] = false;
            return;
        }
    }
}
int main() {
    //cout.precision(10);
    cin >> n >> k;
    for(int i = 1; i <= n; i++){
        cin >> a[i];
    }
    for(int i = 0; i <= k; i++){
        search(i);
    }
    string ans = "First";
    if(lose[k]) ans = "Second";
    cout << ans << endl;
    return 0;
}


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

using namespace std;

#define int long long
#define ll long long
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define endl '\n'
#define Endl '\n'
#define cont continue
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) a*b/__gcd(a,b)
#define pb push_back
#define mp make_pair
#define mem(x) memset(x, 0, sizeof(x))

const ll inf=1e18;
const int mod=1e9+7;
inline int bigmod(int B,int P){int R=1;while(P>0){if(P&1){R=(R*B)%mod;}P>>=1;B=(B*B)%mod;}return R;}
const int mxn = 2e5+10;

int Mod(int a) {
	return (a+mod)%mod;
}
int Mul(int a, int b) {
	return Mod(Mod(a) * Mod(b));
}
int Add(int a, int b) {
	return Mod(Mod(a) + Mod(b));
}
//ll fact[mxn];
//ll in_fact[mxn];
//fact[0] = 1;
//for(ll i = 1; i < mxn; i++) {
	//fact[i] = (i*fact[i-1])%mod;
//}
//in_fact[mxn-1] = bigmod(fact[mxn-1],mod-2);
//for(ll i = mxn-2; i >= 0; i--) {
	//in_fact[i] = (in_fact[i+1] * (i+1))%mod;
//}
//ll c(ll n,ll r) {
	//ll ans = (fact[n] * (in_fact[r] * in_fact[n-r]%mod))%mod;
	//return ans;
//}


signed main(){
    fast;
	//freopen ("input.txt", "r", stdin);
	//freopen ("output.txt", "w", stdout);
    int tt = 1;
    //cin>>tt;
    for(int tc = 1; tc <= tt; tc++) {
        int n;
        cin>>n;
        int a[n],b[n];
        for(int i = 0; i < n; i++) {
			cin>>a[i]>>b[i];
		}
		for(int i = 0; i < n-2; i++) {
			if((a[i] == b[i]) && (a[i+1] == b[i+1]) && (a[i+2] == b[i+2])) {
				cout<<"Yes";
				return 0;
			}
		}
		cout<<"No";
			
        
        
    }



return 0;
}


Measured memory_bytes: 3648
import numpy as np


def solve(N, K, A):
    E = np.arange(0, N)
    for _ in range(K):
        B = np.zeros(N + 1, dtype=np.int64)
        np.add.at(B, np.maximum(0, E - A), 1)
        np.add.at(B, np.minimum(E + A + 1, N), -1)
        A = np.cumsum(B)[:-1]
        if np.all(A == N):
            return A
    return A


N, K = map(int, input().split())
A = np.array(input().split(), dtype=int)
print(' '.join(map(str, solve(N, K, A))))

Measured memory_bytes: 50064
#include <algorithm>
#include <climits>
#include <complex>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>

// using
using namespace std;

// typedef
typedef long long ll;

// define
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REVERSE(c) reverse(ALL(c))
#define UNIQ(c) unique(ALL(c))
#define FOR(i, a, b, c) for (int i = (int)(a); i < (int)(b); i += (int)(c))
#define REP(i, n) FOR(i, 0, n, 1)
#define RFOR(i, a, b, c) for (int i = (int)(a); i >= (int)(b); i -= (int)(c))
#define RREP(i, n) RFOR(i, n, 0, 1)

// functions
template <class T> T ceil(T a, T b) {
    return (a + b - 1) / b;
}
template <class T> T round(T a, T b) {
    return (a + b / 2) / b;
}
template <class T> T gcd(T a, T b) {
    return b ? gcd(b, a % b) : a;
}
template <class T> T lcm(T a, T b) {
    return a * b / gcd(a, b);
}
template <class T> bool amax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> bool amin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}

// main
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    int cnt[9] = {};
    REP(i, N) {
        int a;
        cin >> a;
        a = min(a / 400, 8);
        cnt[a]++;
    }
    int res = 0;
    REP(i, 8) {
        if (cnt[i] > 0) {
            res++;
        }
    }
    cout << max(res, 1) << " " << res + cnt[8] << "\n";
    return 0;
}


Measured memory_bytes: 256
// Problem : R - Walk
// Contest : AtCoder - Educational DP Contest
// URL : https://atcoder.jp/contests/dp/tasks/dp_r
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

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

//Macros

#define ll long long
#define db long double
#define pb push_back
#define eb emplace_back
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<pii>
#define mi map<int,int>
#define mii map<pii,int>
#define fi first
#define se second
#define all(a) (a).begin(),(a).end()
#define sz(x) (int)x.size()
#define mod 1000000007
#define EPS 1e-9
#define io ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define inf 1e10
#define PI acos(-1.0)
#define int long long
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define N 52

//Solution

int n,k;

class matrix{
    public:
        // int d;
        int a[N][N];                             //N = max size 
        // matrix(int u) { d = u; }
        matrix operator * (matrix R){
            matrix res;
            for(int i=0;i<n;i++){                // declare n globally
                for(int j=0;j<n;j++){
                    res.a[i][j] = 0;
                    for(int k=0;k<n;k++){
                        res.a[i][j] = (res.a[i][j]+(a[i][k]*R.a[k][j])%mod)%mod;
                    }
                }
            }
            return res;
        }
};

matrix init(){
    matrix res;
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++) res.a[i][j] = 0;
        res.a[i][i] = 1;
    }
    return res;
}

matrix binpow(matrix mat, int p){
    matrix res = init();
    while(p){
        if(p&1) res = res*mat;
        mat = mat*mat;
        p /= 2;
    }
    return res;
}

matrix a,ans;

void solve(){
    cin>>n>>k;
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++) cin>>a.a[i][j];
    }
    ans = binpow(a,k);
    int res = 0;
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++) (res += ans.a[i][j]) %= mod;
    }
    cout<<res;
}

signed main(){
    io;
    //freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
    int tests;
    //cin>>tests;
    tests = 1;
    while(tests--){
        solve();
    }
    return 0;
}

Measured memory_bytes: 3796
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using ld=long double;
using st=string;
using ch=char;
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<P> vP;
typedef vector<ch> vc;
typedef vector<vc> vvc;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
#define ROF(i,a,b) for(ll i=a;i>=b;i--)
#define per(i,a) ROF(i,a,0)
const ll MOD=1000000007;
const ll MOD2=998244353;
const ld PI=acos(-1);
const ll INF=1e18;
st abc="abcdefghijklmnopqrstuvwxyz";
st ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
struct edge{ll to,cost;};

int main() {
  ll x,y,z;
  cin >> x >> y >> z;
  ll MX=max(x,max(y,z)),MN=min(x,min(y,z));
  if(MX!=MN&&(x+y+z==2*MX+MN||x+y+z==2*MN+MX)){
    cout << "Yes" << endl;
  }
     else{
       cout << "No" << endl;
     }
}

Measured memory_bytes: 256
#define REP(i, n) for(int i = 0; i < (int)(n); i++)

#include "bits/stdc++.h"
using namespace std;

int main() {
	long long int N, K;
	long long int cnt = 0;
	cin >> N >> K;

	cnt = K;

	REP(i, N - 1) {
		cnt *= K - 1; 
	}

	cout << cnt << endl;

	return 0;
}


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

int main(){
  int a,b,c;
  cin >> a >> b;
  c = pow(100,a);
  int ans = c*b;
  if(a == 0 && ans == 100){
    ans += 1;
  }
  if(a == 1 && ans == 10000) ans += 100;
  if(a == 2 && ans == 1000000) ans += 10000;
  cout << ans << endl;
  return 0;
}

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

int main() {
  long N, M;
  cin >> N >> M;
  vector<long> T(N);
  for (int i = 0; i < N; i++) cin >> T.at(i);
  long ans = 0;
  for (int i = 0; i + 1 < N; i++) {
    long tmp = T.at(i + 1) - T.at(i);
    ans += min(tmp, M);
  }
  cout << ans + M << "\n";
}

Measured memory_bytes: 4604
#include<bits/stdc++.h>
using namespace std;
int main(){
    int A, B, C, D, N, ans=0;
    char tmp;
    string S;
    cin >> A >> tmp >> B;

    // cout <<"A"<<S[1][0]<<"C"<<endl;
    
    if(tmp == '-')
    	cout << A-B<<endl;
    else
    	cout <<A+B<<endl;
    

    // string S;
    // cin >>S;
    // cout << S + "pp"<<endl;
    // if(A+B==C || B+C==A || C+A==B)
    // 	puts("Yes");
    // else
    // 	puts("No");
    	
}


Measured memory_bytes: 256
a = float(input())
b = float(input())
if a>b: a,b=b,a
ansa = (a+b)/2
ta = abs(a-ansa)
if ansa<0: ansa+=360.0

ansb = (a+b-360)/2
tb = abs(a-ansb)
if ansb<0: ansb+=360.0

if ta<tb: print(ansa)
else: print(ansb)

Measured memory_bytes: 7456
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define irep(i, n) for (int i = n; i >= 0; i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = 1 << 30;
 
int main() {
	ll n; cin >> n;
	ll ans = n*(n-1)/2;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#a,b=map(int,input().split())
a = int(input())
b=input()
b = b.split()
b = [int(i) for i in b]
kazu = 1
for i in range(0,a-1):
    c= [b[i] for i in range(0,i+1)]
    if b[i+1]>=max(c):
        kazu +=1
print(kazu)

Measured memory_bytes: 3064
#include "bits/stdc++.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<P,ll> Pll;
typedef pair<P,P> PP;
#define rep(i,a,n) for(ll i = a;i < n;i++)
#define repr(i,a,n) for(ll i = n-1;i >= a;i--)
#define LINF (ll)1e17
#define INF (int)1e9
#define MOD (ll)1e9+7
#define sMOD 1e5
#define fs first
#define sc second

ll gcd(ll a,ll b){
	if(!b) return a;
	return gcd(b,a%b);
	
}



signed main(){
	ll n;
	cin >> n;
	
	rep(i,0,50000){
		if(n == floor((double)i*1.08)){
			cout << i << endl;
			break;
		}
		else if(i == 49999){
			cout << ":(" << endl;
		}
	}
	
	
    return 0;
}

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

const int mod = 1e9+7;

int main(){
    int N;
    cin >> N;

    long long ans = 1;

    for(int i=1; i<=N; ++i){
        ans *= i;
        ans %= mod;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
from collections import defaultdict
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inpl(): return list(map(int, input().split()))
def inpl_s(): return list(input().split())

N = int(input())
aa = inpl()
MAX = max(aa)
MIN = min(aa)
MAXind = aa.index(MAX)
MINind = aa.index(MIN)
ans_list = []

def calc_pl():
	global aa
	global ans_list

	for i in range(1,N):
		ba,na = aa[i-1],aa[i]
		if na >= ba:
			continue
		else:
			aa[i] += ba
			ans_list.append([i,i+1])

def calc_mn():
	global aa
	global ans_list

	for i in reversed(range(N-1)):
		ba,na = aa[i+1],aa[i]
		if na <= ba:
			continue
		else:
			aa[i] += ba
			ans_list.append([i+2,i+1])

if MIN<0 and 0<MAX:
	if abs(MIN) < abs(MAX):#正に揃える
		for i in range(N):
			if i == MAXind: continue
			ans_list.append([MAXind+1,i+1])
			aa[i] += MAX
		calc_pl()
	else:
		for i in range(N):
			if i == MINind: continue
			ans_list.append([MINind+1,i+1])
			aa[i] += MIN
		calc_mn()
elif 0 <= MIN:
	calc_pl()
elif MAX <= 0:
	calc_mn()

print(len(ans_list))
for azu,nyan in ans_list:
	print(azu,nyan)


Measured memory_bytes: 4324
#include <bits/stdc++.h>
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ll long long
using namespace std;

const ll P = 1000000007;
int gcd(int a, int b) { return b != 0 ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }


int main()
{
  ll N, K;
  cin >> N >> K;
  ll product = 1;
  for (ll i = 1; ;i++)
  {
    product *= K;
    if (N < product)
    {
      cout << i << endl;
      return 0;
    }
  }
}


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

int main()
{
    int n,i,j,q=1;
    int b[100];
    int c[100][100];
    char a[2100];
    for(i=0;i<6;i++)
    scanf("%d",&b[i]);
    for(i=0;i<5;i++)
    {
      for(j=0;j<5;j++)
      {
          c[i][j]=abs(b[i]-b[j]);
      }
    }
    for(i=0;i<5;i++)
      {
          if(q==0)break;
          for(j=0;j<5;j++)
        if(c[i][j]>b[5]){printf(":(\n");q=0;break;
        }
      }
      if(q==1)printf("Yay!\n");
    return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
#define For(i,l,r) for(int i = (l),i##end = (r);i <= i##end;i++)
#define Fordown(i,r,l) for(int i = (r),i##end = (l);i >= i##end;i--)
#define debug(x) cout << #x << " = " << x << endl

using namespace std;

typedef long long ll;

template <typename T> inline bool chkmin(T &x,T y) { return y < x ? x = y,1 : 0; }
template <typename T> inline bool chkmax(T &x,T y) { return x < y ? x = y,1 : 0; }

const int INF = 0x3f3f3f3f;
const int N = 1e5 + 10;

int a[N],b[N],vis[N];
int n,cnt;
ll Sum = 0;

struct node {
	int val,id,type;
	bool operator < (const node &rhs) const {
		return val < rhs.val;
	}
}tot[N << 1];

inline int read() {
	int x = 0,flag = 1;
	char ch = getchar();
	while(!isdigit(ch) && ch != '-')ch = getchar();
	if(ch == '-')flag = -1,ch = getchar();
	while(isdigit(ch))x = (x << 3) + (x << 1) + (ch - '0'),ch = getchar();
	return x * flag;
}

inline bool chk() {
	memset(vis,0,sizeof(vis));
	bool flag = false,check = true;
	vis[tot[1].id] = true;int Col = tot[1].type;
	Sum += tot[1].val;
	For(i,2,n) {
		if(vis[tot[i].id]) flag = true;
		if(tot[i].type != Col) check = false;
		vis[tot[i].id] = true;
		Sum += tot[i].val;
	}
	if(check == true) flag = true;
	return flag;
}

int main() {

	n = read(),cnt = 0;
	For(i,1,n) {
		a[i] = read(),b[i] = read();
		tot[++cnt] = (node){a[i],i,1};
		tot[++cnt] = (node){b[i],i,2};
	}
	sort(tot + 1,tot + cnt + 1);
	if(chk()) return printf("%lld\n",Sum),0;
	else {
		swap(tot[n + 1],tot[n]);
		Sum = 0;
		if(chk()) return printf("%lld\n",Sum),0;
		else {
			swap(tot[n + 1],tot[n]);
			Sum = 0;chk();
			printf("%lld\n",Sum + min(tot[n + 1].val - tot[n - 1].val,tot[n + 2].val - tot[n].val));
		}
	}
	return 0;
}

Measured memory_bytes: 3712
//const lli M=998244353ll;
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
#include<iomanip>

#define fast_io ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

using namespace std;

#define debug(x) cout<<(#x)<<"="<<(x)<<", ";
#define debug1(x) debug(x) cout<<'\n';
#define debug2(x1, x2) debug(x1) debug(x2) cout<<'\n';
#define debug3(x1, x2, x3) debug(x1) debug(x2) debug(x3) cout<<'\n';
#define debug4(x1, x2, x3, x4) debug(x1) debug(x2) debug(x3) debug(x4) cout<<'\n';
#define debug5(x1, x2, x3, x4, x5) debug(x1) debug(x2) debug(x3) debug(x4) debug(x5) cout<<'\n';

#define fcout cout<<fixed<<setprecision(15)
#define repp(i,j,k) for(int i=j; i<k; ++i)
#define rep(i,j) repp(i,0,j)
#define rrep(i,j,k) for(int i=j; i>=k; --i)
#define all(x) (x).begin(), (x).end()
#define sort(x) sort(x.begin(), x.end())
#define lb(x,val) lower_bound(x.begin(), x.end(), val)
#define ub(x,val) upper_bound(x.begin(), x.end(), val)
#define pb(x) emplace_back(x);

typedef long long int lli;
typedef pair<int,int> pii;
typedef pair<lli,lli> pll;
typedef vector<int> vi;
typedef vector<lli> vl;
typedef tuple<int, int, lli> tiil;

//const lli M=998244353ll;
const lli M=1000000007ll;
const double D=1.0;

int main(){
	fast_io
	vi a(3);
	for(int& i: a) cin>>i;
	sort(a);
	cout<<(a[0]*a[1])/2;
	
	return 0;
}

Measured memory_bytes: 256