akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Linq;
using CompLib.Util;

public class Program
{

    public void Solve()
    {
        var sc = new Scanner();
        int n = sc.NextInt();
        int m = sc.NextInt();
        int x = sc.NextInt();

        int[] c = new int[n];
        int[][] a = new int[n][];
        for (int i = 0; i < n; i++)
        {
            c[i] = sc.NextInt();
            a[i] = new int[m];
            for (int j = 0; j < m; j++)
            {
                a[i][j] = sc.NextInt();
            }
        }

        long ans = long.MaxValue;

        var l = 1 << n;
        for (int i = 0; i < l; i++)
        {
            int tmp = i;
            var ar = new int[m];
            long sum = 0;
            for (int j = 0; j < n; j++)
            {
                if (tmp % 2 == 1)
                {
                    sum += c[j];
                    for (int k = 0; k < m; k++)
                    {
                        ar[k] += a[j][k];
                    }
                }
                tmp /= 2;
            }
            bool f = true;
            for (int j = 0; j < m; j++)
            {
                if (ar[j] < x)
                {
                    f = false;
                    break;
                }
            }
            if (f) ans = Math.Min(ans, sum);
        }

        Console.WriteLine(ans == long.MaxValue ? -1 : ans);
    }

    public static void Main(string[] args) => new Program().Solve();
}

namespace CompLib.Util
{
    using System;
    using System.Linq;

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}


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

int main(void)
{
    int n;
    string s;
    string front, back;
    cin >> n;
    cin >> s;
    if(s.size() <= 1)
    {
        cout << "No" << endl;
    }
    else
    {
        front = s.substr(0, n/2);
        back = s.substr(n/2);
        cout << (front == back ? "Yes": "No") << endl;
    }
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<vector>
#include<map>
#include<algorithm>
using namespace std;
int main() {
	map<string, vector<int> > D;
	string w;
	int n;
	while(cin >> w >> n) {
		D[w].push_back(n);
	}
	map<string, vector<int> >::iterator it = D.begin();
	for(; it != D.end(); it++) {
		cout << it->first << endl;
		int size = it->second.size();
		sort(it->second.begin(),it->second.end());
		for(int i = 0; i < size - 1; i++){
			cout << it->second[i] << " ";
		}
		cout << it->second[size-1] << endl;
	}
	return 0;
}

Measured memory_bytes: 1244
#include <iostream>
#include <string>
#include <cstring>
#include <cmath>
#include <cstdio>
#include <algorithm>
using namespace std;
#define ll long long
int main (){
    int n, m;
    string s[114514];
    int ans = 0;
    cin >> n;
    for (int i = 0; i < n; i++) cin >> s[i];
    cin >> m;
    for (int i = 0; i < m; i++) cin >> s[i+n];
    for (int i = 0; i < n+m; i++){
        int x = 0;
        for (int j = 0; j < n; j++){
            if (s[i] == s[j]) x++;
        }
        for (int j = n; j < m+n; j++){
            if (s[i] == s[j]) x--;
        }
        ans = max (ans, x);
    }
    cout << ans << endl;
    return 0;
}



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

int main() {
    int n;
    cin >> n;
    vector<int> v(n), c(n);
    for(auto &t : v) cin >> t;
    for(auto &t : c) cin >> t;
    int ans = 0;
    for(int i = 0; i < (1 << n); i++) {
        int curX = 0, curY = 0;
        for(int j = 0; j < n; j++) {
            if (i & (1 << j)) {
                curX += v[j];
                curY += c[j];
            }
        }
        ans = max(ans, curX - curY);
    }
    cout << ans << "\n";
    return 0;
}

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

#define rp(i,n) for(int i=0;i<n;i++)
#define rep(i,m,n) for(int i=m;i<=n;i++)
#define llrp(i,n) for(long long i=0;i<n;i++)
#define llrep(i,m,n) for(long long i=m;i<=n;i++)
#define sort(a) sort(a.begin(),a.end())
#define reverse(a) reverse(a.begin(),a.end())
#define pb push_back
#define elif else if
#define vcin(a); rp(i,a.size()){cin>>a[i];}
#define vcout(a); rp(i,a.size()){cout<<a[i]<<endl;}
typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector<string> vs;
typedef vector<char> vc;
typedef long long ll;
typedef string S;
typedef pair<int,int> P;

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

int binary_search(int key,vi a) {
    int left = -1;
    int right = (int)a.size();
    while (right - left > 1) {
        int mid = left + (right - left) / 2;
        
        if (isOK(mid, key,a)) right = mid;
        else left = mid;
    }
    return right;
}

int modpow(int a,int b,int p){
    if(b==0){
        return 1;
    }elif(b%2==0){
        return modpow((a*a)%p,b/2,p);
    }else{
        return (a*modpow(a,b-1,p))%p;
    }
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,e=0,o=0;
    cin >> n;
    vi a(n);
    rp(i,n){
        cin >> a[i];
        a[i]%=2;
        if(a[i]){
            o++;
        }else{
            e++;
        }
    }
    cout << (o%2==0?"YES":"NO") << endl;
    return 0;
}


Measured memory_bytes: 640
package main

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

func getNextLine(scanner *bufio.Reader) string {
	var buffer string
	for {
		line, isPrefix, _ := scanner.ReadLine()
		buffer += string(line)
		if isPrefix == false {
			break
		}
	}
	return buffer
}

func getIntList(scanner *bufio.Reader) []int {
	list := strings.Split(getNextLine(scanner), " ")
	l := len(list)
	result := make([]int, l)
	for i := 0; i < l; i++ {
		result[i], _ = strconv.Atoi(list[i])
	}
	return result
}

func main() {
	fp := os.Stdin
	if len(os.Args) > 1 {
		fp, _ = os.Open(os.Args[1])
	}

	scanner := bufio.NewReader(fp)
	writer := bufio.NewWriter(os.Stdout)

	var n, m int
	fmt.Sscan(getNextLine(scanner), &n, &m)

	sw := make([][]int, m)

	for i := 0; i < m; i++ {
		sw[i] = getIntList(scanner)
	}
	pp := getIntList(scanner)

	ans := 0
	for i := 0; i < 1<<uint(n); i++ {
		on := 0
		for ii := 0; ii < m; ii++ {
			bit := 0
			for iii := 1; iii <= sw[ii][0]; iii++ {
				if i&(1<<uint(sw[ii][iii]-1)) == 0 {
					bit ^= 0
					continue
				}
				bit ^= 1
			}
			if bit == pp[ii] {
				on++
			}
		}
		if on == m {
			ans++
		}
	}
	fmt.Fprintln(writer, ans)

	writer.Flush()
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
#define rep(i, n) for (int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
 
int main(void){
    int a, b, c, d;
    cin>>a>>b>>c>>d;
    int now = 0;
    while(a>0&&c>0){
        if(now%2==0){
            c-=b;
        }
        else a-=d;
        now++;
    }
    if(a<=0) cout<<"No"<<endl;
    else cout<<"Yes"<<endl;
    return 0;
}

Measured memory_bytes: 3620
N = int(input())
S = input()
ans = 0
for i in range(1000):
    num = str(i).zfill(3)
    flag2 = True
    start = 0
    for j in range(3):
        flag = False
        for k in range(start,N):
            if num[j] == S[k]:
                flag = True
                start = k+1
                break
        if flag == False:
            flag2 = False
            break    
    if flag2:
        ans+=1
    
print(ans)

Measured memory_bytes: 42076
#include <bits/stdc++.h>
using namespace std;
#define all(V) V.begin(),V.end()
#define ll long long
#define MOD 998244353

ll fc[200010];

ll stoi2(string S) {
	ll a = 1, ans = 0;
	reverse(all(S));
	for (char c : S) {
		if (c == '1')ans += a;
		a *= 2;
		ans %= MOD;
		a %= MOD;
	}
	return ans;
}

int main(){
	int N;cin >> N;
	string X;cin >> X;
	ll a, b, c;
	string S, T, bs;
	fc[0] = 0;
	for (int i = 1;i <= N;i++) {
		fc[i] = 0;
		if (X[i - 1] == '0')S += '0', T += '1';
		else S += '1', T += '0';

		if (N%i)continue;
		a = N / i;
		if ((a & 1) == 0)continue;

		b = stoi2(S);bs = "";
		for (int j = 0;j < a;j++) {
			if (j & 1)bs += T;
			else bs += S;
		}

		if (X >= bs)
			b++;

		c = i;
		for (int j = 3;j <= c;j += 2) {
			if (c%j)continue;
			b -= fc[c / j];
			if (b < 0)b += MOD;
		}
		fc[i] = b;
	}

	ll ans = 0;
	for (int i = 1;i <= N;i++) {
		ans += fc[i] * i * 2;
		ans %= MOD;
	}
	cout << ans << endl;
}

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

int main() {
  int A,B,C;
  cin >> A >> B;
 
  vector<int> v(3);
  v.at(0) = A + B;
  v.at(1) = A - B;
  v.at(2) = A * B;
  
  sort(v.begin(), v.end());
  reverse(v.begin(), v.end());
  
  cout << v.at(0) << endl;
}


Measured memory_bytes: 256
N = int(input())
A = [0] + list(map(int, input().split())) + [0]

len = []
for i in range(N+1):
    len.append(abs(A[i+1]-A[i]))

sum = sum(len)
ans = sum

for i in range(N):
    ans -= (len[i]+len[i+1])
    ans += abs(A[i+2]-A[i])
    print(ans)
    ans = sum


Measured memory_bytes: 20604
#include <bits/stdc++.h>  // g++ -std=c++14 -o a a.cpp

using namespace std;

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

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repto(i, n) for(int i = 0; i <= (n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007
#define DEBUG(x) cout << #x << ": " << x << endl;

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

__attribute__((constructor)) void initial() {
    cin.tie(0);
    ios::sync_with_stdio(false);
}

int main() {
    int N;
    cin >> N;
    int result = N / 2;
    if (N % 2 > 0) result++;
    cout << result << endl;
}

Measured memory_bytes: 256
#include"bits/stdc++.h"
using namespace std;
using ll = int64_t;

int main() {
    ll N, L;
    cin >> N >> L;
    ll sum = 0;
    for (ll i = 1; i <= N; i++) {
        sum += L + i - 1;
    }

    ll ans, diff = LLONG_MAX;
    for (ll i = 1; i <= N; i++) {
        ll curr = L + i - 1;
        ll others = sum - curr;
        if (abs(sum - others) < diff) {
            ans = others;
            diff = abs(sum - others);
        }
    }

    cout << ans << endl;
}

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

#define FAST ios_base::sync_with_stdio(false); cin.tie(0);
#define pb push_back
#define eb emplace_back
#define ins insert
#define f first
#define s second
#define cbr cerr << "hi\n"
#define mmst(x, v) memset((x), v, sizeof ((x)))
#define siz(x) ll(x.size())
#define all(x) (x).begin(), (x).end()
#define lbd(x,y) (lower_bound(all(x),y)-x.begin())
#define ubd(x,y) (upper_bound(all(x),y)-x.begin())
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());    //can be used by calling rng() or shuffle(A, A+n, rng)
inline long long rand(long long x, long long y) { return (rng() % (y+1-x)) + x; } //inclusivesss
string inline to_string(char c) {string s(1,c);return s;} template<typename T> inline T gcd(T a,T b){ return a==0?llabs(b):gcd(b%a,a); }

typedef long long ll; 
typedef long double ld;
#define FOR(i,s,e) for(ll i=s;i<=ll(e);++i)
#define DEC(i,s,e) for(ll i=s;i>=ll(e);--i)
typedef pair<ll,ll>pi; typedef pair<ll,pi>spi; typedef pair<pi,pi>dpi;

#define LLINF ((long long)1e18)
#define INF int(1e9+1e6)
#define MAXN (300006)
ll n,c[MAXN],have[3];
vector<int>v[MAXN];
void dfs(int x,int p){
	for(auto i:v[x]) if(i^p) {
		c[i]=!c[x], dfs(i,x);
	}
}
int main(){
	FAST
	cin>>n;
	FOR(i,0,n-2){
		ll a,b;cin>>a>>b;
		v[a].eb(b), v[b].eb(a);
	}
	c[1]=0, dfs(1,1);
	FOR(i,1,n) ++have[i%3];
	if(count(c+1,c+n+1,0) > count(c+1,c+n+1,1)) {
		FOR(i,1,n) c[i] ^= 1;
	}
	// less zeros, more ones
	if(count(c+1,c+n+1,0) <= have[0]) { // means only need add 2s and 0s to the 1s
		have[0] -= count(c+1,c+n+1,0);
		FOR(i,1,n) if(c[i]==1&&have[0]) c[i]=0, -- have[0];
		FOR(i,1,n) if(c[i]==1&&have[2]) c[i]=2, -- have[2];
		assert(have[0]==0&&have[2]==0); 
	}else{
		FOR(i,1,n) if(c[i]==0) c[i]=2;
		have[1] -= count(c+1, c+n+1, 1), have[1] *= -1;
		have[2] -= count(c+1, c+n+1, 2), have[2] *= -1;
		assert(have[1]>=0&&have[2]>=0);
		FOR(i,1,n)  if(have[c[i]]&&have[0]) -- have[c[i]], c[i]=0, -- have[0];
	}
	vector<vector<ll>> num(3, vector<ll>());
	FOR(i,1,n) num[i%3].eb(i);
	FOR(i,1,n) assert(c[i]<3), cout<<num[c[i]].back()<<' ', num[c[i]].pop_back();
}


Measured memory_bytes: 22892
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <stdio.h>
#include <time.h>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
# define ll int64_t
# define str string
# define rep(i,n) for(ll i=0;i<n;i++)
# define rrep(i,n) for(ll i=1;i<=n;i++)
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
# define mod 1000000007
# define PI 3.141592653589793
# define vec vector
#define dump(x) cerr<<#x<<"="<<x<<endl
using namespace std;



#define INF 2000000000
#define MAX_V 10



bool compare_by_b(pair<string,ll> a,pair<string,ll> b){
    if(a.second != b.second) return a.second<b.second;
    else return a.first<b.first;
}

bool my_compare(pair<string,ll> a,pair<string,ll> b){
    if(a.first != b.first) return a.first<b.first;
    if(a.second != b.second) return a.second>b.second;
    else return true;
}

ll modpow(ll a,ll n,ll mod1) {
    ll res=1;
    while(n>0){
        if(n&1) res=res*a%mod1;
        a = a*a%mod1;
        n >>= 1;
    }
    return res;
}

ll factorial(ll n){
    ll x=1;
    rrep(i,n) (x*=i)%=mod;
    return x;
}

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

ll lcm(ll a,ll b){
   return a/gcd(a,b)*b;
}
const ll MAX = 510000;
const ll MOD = 1000000007;
 
ll fac[MAX], finv[MAX], inv[MAX];
 
// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll 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;
    }
}
 
// 二項係数計算
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;
}

using graph = vector<vector<ll>>;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    ll n,m;
    cin>>n>>m;
    vec<ll> k(m);
    vec<vec<ll>> s(m);
    vec<ll> p(m);
    rep(i,m){
        cin>>k.at(i);
        rep(j,k.at(i)){
            ll a;
            cin>>a;
            s[i].pb(a);
        }
    }
    
    rep(i,m) cin>>p[i];
    
    ll total=0;
    for(ll bit=0;bit<(1<<10);bit++){
        bitset<10> l(bit);
        rep(i,m){
            ll coun=0;
            rep(j,k[i]){
                if(l.test(s.at(i).at(j)-1)) coun++;
            }
            if(coun%2!=p.at(i)) break;
            if(i==m-1) total++;
        }
    }
    rep(i,10-n){
        total/=2;
    }
    cout<<total<<endl;
    return 0;
}


Measured memory_bytes: 256
N = int(input())
L = list(map(int,input().split()))

L.sort()
ans = 0
for i in range(0,N-2):
    for j in range(i+1,N-1):
        for k in range(j+1,N):
            if L[i] != L[j] and L[j] != L[k]:
                if L[i] + L[j] > L[k]:
                    ans += 1
print(ans)

Measured memory_bytes: 9148
package main

import "fmt"

const inf = 1 << 60

func main() {
	const mod = 2019
	var l, r int
	fmt.Scan(&l, &r)

	ans := inf
	for i, x := l, 0; i <= r && x <= 2019; i, x = i+1, x+1 {
		for j, x := l, 0; j <= r && x <= 2019; j, x = j+1, x+1 {
			if i == j {
				continue
			}

			if tmp := i * j % mod; tmp < ans {
				ans = tmp
			}
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 512
# -*- coding: utf 8 -*-
# Queue
# 2019. 4/25

LEN = 100005
Q = [0] * LEN
head = 0
tail = 0

class Queue:
    def __init__(self):
        self.name = 0
        self.t = 0

def enqueue(x):
    global tail
    Q[tail] = x
    tail = (tail + 1) % LEN

def dequeue():
    global head
    x = Q[head]
    head = (head + 1) % LEN
    return x

if __name__ == '__main__':
    elaps = 0
    n, q = map(int, input().split())
    for i in range(1, n + 1):
        u = Queue()
        name , time = input().split()
        u.name = name
        u.t = int(time)
        Q[i] = u

    head = 1
    tail = n + 1

    while(head != tail):
        u = dequeue()
        c = min(q, u.t)
        u.t -= c
        elaps += c
        if( u.t > 0):
            enqueue(u)
        else:
            print("{} {}".format(u.name, elaps))



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

int main() {
  ll N; cin >> N;
  vector<ll> A(N),S(N);
  for (int i = 0; i < N; i++) cin >> A[i];
  for (int i = 0; i < N; i++) {
    if (i == 0) S[i] = A[i];
    else S[i] = S[i-1] + A[i];
  }
  
  unordered_map<ll, ll> count;
  for (int i = 0; i < N; i++) count[S[i]]++;
  
  ll ans = count[0];
  for (auto i : count) ans += (i.second) * (i.second-1) / 2;
  
  cout << ans << endl;
}

Measured memory_bytes: 11592
#include <iostream>
#include <iomanip>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <utility>
#include <string>
#include <cmath>
#include <cstdlib>
#include <cstring>

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;
typedef vector<s32> vs32;
typedef vector<u32> vu32;
typedef vector<s64> vs64;
typedef vector<u64> vu64;

const double PI=3.14159265358979323846;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

#define rep(i, N) for(int i = 0; i < N; ++i)

#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 1000000007ULL

#define IN(l, r, x) ((l) <= (x) && (x) < (r))

struct Point
{
    int x, y;
};

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

    int h, w, n;
    cin >> h >> w >> n;
    vector< string > field(h);
    rep (i, h) cin >> field[i];

    vector< Point > vp(n);
    Point s;
    rep (i, h)
    {
        rep (j, w)
        {
            if (field[i][j] == 'S')
            {
                s.y = i; s.x = j;
            }
            else if (field[i][j] != 'X' && field[i][j] != '.')
            {
                vp[field[i][j] - '1'] = Point{.x = j, .y = i};
            }
        }
    }

    int dy[] = {-1, 0, 1, 0};
    int dx[] = {0, -1, 0, 1};
    int ans = 0;
    rep (i, n)
    {
        queue< Point > q;
        q.push(s);
        vector< vs32 > d(h, vs32(w, (int)1e9));
        d[s.y][s.x] = 0;
        while (!q.empty())
        {
            Point p = q.front(); q.pop();
            rep (j, 4)
            {
                int ny = p.y + dy[j];
                int nx = p.x + dx[j];
                if (IN(0, h, ny) && IN(0, w, nx) && field[ny][nx] != 'X' && d[ny][nx] > d[p.y][p.x] + 1)
                {
                    q.push(Point{.x = nx, .y = ny});
                    d[ny][nx] = d[p.y][p.x] + 1;
                }
            }
        }
        ans += d[vp[i].y][vp[i].x];
        s.y = vp[i].y; s.x = vp[i].x;
    }

    cout << ans << "\n";
    return 0;
}



Measured memory_bytes: 7836
//abc131_d.cpp
//Sun Sep 22 10:03:24 2019

#include <iostream>
#include <string>
#include <queue>
#include <map>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <math.h>
#include <set>
#define INTINF 2147483647
#define LLINF 9223372036854775807
using namespace std;
using ll=long long;
typedef pair<ll,ll> P;

bool compare_by_b(P a, P b) {
	if(a.second != b.second){
		return a.second < b.second;
	}else{
		return a.first > b.first;
	}
}

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

	P work[n];
	for (int i=0;i<n;i++){
		ll a,b;
		cin >> a >> b;
		work[i] = make_pair(a,b);
	}

	sort(work,work+n,compare_by_b);

	ll accum = 0;
	for (int i=0;i<n;i++){
		accum += work[i].first;
		if (accum > work[i].second){
			cout << "No" << endl;
			return 0;
		}
	}

	cout << "Yes" << endl;
//	printf("%.4f\n",ans);
}

Measured memory_bytes: 3328
#include <iostream>
#include <string>
using namespace std;
char x;
char z[]={'a','e','u','i','o'};
int main(){
   cin>>x;
   int c=0;
   for(int i=0;i<=4;i++)
   {
        if (z[i]==x)
        {
            c += 1;
        }
    }
    if(c>0){
        cout<<"vowel"<<endl;
    } else {
        cout << "consonant" << endl;
    }

}

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

int main(){
  int n;
  cin >> n;
  vector<int> a(n+1);
  rep(i,n) cin >> a[i+1];
  vector<int> b(n+1);
  
  for(int i=n;i>=1;i--){
    int sum = 0;
    for(int j=i+i;j<=n;j+=i){
      sum ^= b[j];
    }
    b[i] = sum^a[i];
  }
  vector<int> ans;
  for(int i=1;i<=n;i++){
    if(b[i]) ans.push_back(i);
  }
  
  int s = ans.size();
  cout << s << endl;
  rep(i,s){
    printf("%d%c",ans[i],i+1==ans.size() ? '\n' : ' ');
  }
}


Measured memory_bytes: 3064
N, M = map(int, input().strip().split())
X = list(map(int, input().strip().split()))

if N >= M:
    print(0)
    exit(0)

diff_list = []
X.sort()
for i in range(M - 1):
    diff_list.append(X[i + 1] - X[i])

diff_list.sort(reverse=True)

sum_big_diff = 0
if M > 1:
    for i in range(N - 1):
        sum_big_diff += diff_list[i]

print(X[M - 1] - X[0] - sum_big_diff)


Measured memory_bytes: 13960
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <cmath>
using namespace std;
using ll = long long;

struct Graph {
    static constexpr ll INF = 1LL << 59;
    Graph(int n) : d(n, vector<ll>(n, INF)), n(n) {}
    void add_edge(int i, int j, int l) {
        d[i][j] = l;
    }
    void warshall_floyd() {
        for (int k = 0; k < n; k++)
            for (int i = 0; i < n; i++)
                for (int j = 0; j < n; j++)
                    d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
    }
    vector<vector<ll>> d;
    int n;
};

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

    int n, m, l;
    cin >> n >> m >> l;

    Graph g(n);
    for (int i = 0; i < m; i++) {
        int a, b, c;
        cin >> a >> b >> c;
        a--; b--;

        g.add_edge(a, b, c);
        g.add_edge(b, a, c);
    }
    g.warshall_floyd();

    Graph g1(n);
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            if (g.d[i][j] <= l) g1.add_edge(i, j, 1);
        }
    }
    g1.warshall_floyd();

    int q;
    cin >> q;

    for (int h = 0; h < q; h++) {
        int s, t;
        cin >> s >> t;
        s--; t--;

        ll x = g1.d[s][t];
        cout << (x == g1.INF ? -1 : x - 1) << '\n';
    }

    return 0;
}

Measured memory_bytes: 2048
mod = 1000000007

def mul(a, b):
    return ((a % mod) * (b % mod)) % mod

def power(x, y):
    if y == 0:
        return 1
    elif y == 1:
        return x % mod
    elif y % 2 == 0:
        return power(x, y // 2) ** 2 % mod
    else:
        return power(x, y // 2) ** 2 * x % mod

def div(a, b):
    return mul(a, power(b, mod - 2))

def combination(n,r):
    bumbo = 1
    bunshi = 1
    for i in range(r):
        bumbo = (bumbo*(n-i)) % mod
    for i in range(1,r+1):
        bunshi = (bunshi*i) % mod
    return (div(bumbo, bunshi)) % mod


n, a, b = map(int, input().split())
print((power(2,n)-1-combination(n,a)-combination(n,b)) % mod)

Measured memory_bytes: 38640
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop

import collections

x,y = map(int,input().split())
cnt = 0
while True:
    a = x*2**cnt
    if a>y:
        break
    cnt+=1
print(cnt)

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

long long extGCD(long long a, long long b, long long &x, long long &y) {
    if (b == 0) {
        x = 1;
        y = 0;
        return a;
    }
    long long d = extGCD(b, a%b, y, x);
    y -= a / b * x;
    return d;
}

int main() {
    long long a,b,x,y;
    cin >> a >> b;
    extGCD(a,b,x,y);
    cout << x << ' ' << y << endl;
}


Measured memory_bytes: 3116
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for (int i=0;i<(n);i++)
#define MOD 1000000007
#define INF 1000000000009
typedef long long ll;
typedef pair<int,int> P;
#define YES(s) s?cout << "YES" << endl:cout << "NO" << endl
#define Yes(s) s?cout << "Yes" << endl:cout << "No" << endl
#define Taka(s) s?cout << "Takahashi" << endl:cout << "Aoki" << endl
#define int ll

int LIM =1000000000000000000;
signed main(void){
    int A,B,C,K;
    cin >> A >> B >> C >> K;
    if(K%2==0){
        if(A-B>LIM){
            cout << "Unfair" << endl;return 0;
        }
        cout << A-B << endl;
    }else{
        if(B-A>LIM){
            cout << "Unfair" << endl;return 0;
        }
        cout << B-A << endl;
    }
  return 0;
}


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

signed main(void){
  int N,K; cin>>N>>K;
  double ans;
  for(int i=1;i<=N;++i){
    int sco=i;
    double tmp=1/(double)N;
    while(sco<K){
      tmp*=0.5;
      sco*=2;
    }
    ans+=tmp;
  }
  cout<<fixed<<setprecision(15)<<ans;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int a[100005],b[100005];
int main()
{
    int n,i,j,k,sum,tmp,x,y,z;
    int h,c,d,e;
    cin>>n>>h;
    for(i=0;i<n;i++)
    {
        scanf("%d%d",&a[i],&b[i]);
    }
    sort(a,a+n);
    sort(b,b+n);
    for(i=n-1,sum=0;i>=0;i--){
        if(b[i]<a[n-1]){
            break;
        }
        if(h<=0){
            break;
        }
        h-=b[i];
        sum++;
    }
    if(h>0){
        //cout<<"sum="<<sum<<endl;
        tmp=h/a[n-1];
        if(h%a[n-1]!=0)
            tmp++;
        sum+=tmp;
    }
    printf("%d\n",sum);
    return 0;
}


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

public class Main {

	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String x = br.readLine();
		int a =Integer.parseInt(x);

		System.out.println(48-a);

	}
}

Measured memory_bytes: 23124
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <queue>
#include <stack>
#include <deque>
#include <set>
#include <unordered_set>
#include <map>
#define ll long long
#define endl '\n'
using namespace std;

int alpha[26];

int main(void)
{
    cin.tie(NULL); ios_base::sync_with_stdio(false); int N; cin >> N;
    string str; cin >> str;
    for(int i = 0; i < str.length(); i++)
        alpha[str[i] - 'a'] += 1;
    
    for(int i = 0; i < N - 1; i++)
    {
        cin >> str;
        auto temp = new int[26]();
        for(int j = 0; j < str.length(); j++)
            temp[str[j] - 'a'] += 1;
        for(int j = 0; j < 26; j++)
        {
            alpha[j] = min(alpha[j], temp[j]);
        }
        delete[] temp;
    }
    for(int i = 0; i < 26; i++)
    {
        while(alpha[i]--)
        {
            cout << (char)('a' + i);
        }
    }
    return 0;
}

Measured memory_bytes: 888
#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()); reverse(a.begin(), a.end());
  
  int alice = 0;
  int bob = 0;

  for (int i = 0; i < n; i++) {
    if(i % 2 == 0) {
      alice = alice + a.at(i); 
    }
    else {
      bob = bob + a.at(i);
    }
  }  
  cout << alice - bob << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ALL(c) (c).begin(),(c).end()
#define EACH(i,c) for(auto i=(c).begin();i!=(c).end();++i)
using namespace std;
#define int long long

signed main(){
	int A, B, C, X, Y;
	cin >> A >> B >> C >> X >> Y;
	int res = 0;
	if (A + B > 2 * C) {
		int m = min(X, Y);
		X -= m;
		Y -= m;
		res += C * m * 2;
	}

	if (A > C * 2) {
		res += C * X * 2;
	} else {
		res += A * X;
	}

	if (B > C * 2) {
		res += C * Y * 2;
	} else {
		res += B * Y;
	}

	cout << res << endl;

	return 0;
}


Measured memory_bytes: 256
import java.util.*;

class Main{
  static int[] dp;
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    int n=sc.nextInt();
    dp=new int[n+4];
    dp[1]=1; dp[2]=2; dp[3]=3;
    System.out.println(dp(n));
  }
  static int dp(int n){
    int ret=Integer.MAX_VALUE-1;
    if(n==0||dp[n]>0) return dp[n];
    for(int i=2;i<=3;i++){
      for(int j=3*i;j<=n;j*=3*i){
        ret=Math.min(ret, dp(n-j));
      }
    }
    return dp[n]=ret+1;
  }
}


Measured memory_bytes: 24916
import java.util.Scanner;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int[] x = new int[n];
    long sum = Long.MAX_VALUE;
    for(int i = 0; i < n; i++){
      x[i] = sc.nextInt();
    }
    for(int i = 1; i <= 100; i++){
    	long temp = 0;
      for(int j = 0; j < n; j++){
        temp += Math.pow(x[j]-i,2);
      }
      if(sum > temp){
        sum = temp;
      }
    }
    System.out.println(sum);
  }
}

Measured memory_bytes: 22868
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
#define ALL(c) (c).begin(), (c).end()
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v, x) (std::find(v.begin(), v.end(), x) != v.end())

using namespace std;
using ll = long long;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
constexpr int INF = 1001001001;
constexpr long long INFL = (1LL<<60);
constexpr double eps = (1e-9);

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

  int a, b, c;
  cin >> a >> b >> c;
  int k;
  cin >> k;

  int num = 0;
  while (b <= a) {
    b *= 2;
    num++;
  }
  while (c <= b) {
    c *= 2;
    num++;
  }

  if (num <= k) puts("Yes");
  else puts("No");

  return 0;
}


Measured memory_bytes: 3640
def main():
    n, k = map(int, input().split())
    a =  list(map(int, input().split()))

    path = [1]
    for _ in range(n-1):
        path.append(a[path[-1]-1])

    if k > n:
        start = path.index(path[-1])
        index = (k - start) % (len(path) - start - 1) + start
        t = path[index]
    else:
        t = path[k]
    return print(t)

if __name__ == '__main__':
    main()


Measured memory_bytes: 32336
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(int (i) = (s);(i) <= (e);(i)++)

map<string,int> mp;

int n,m;

int main(){
    cin >> n;
    rep(i,0,n - 1){
        string s;
        cin >> s;
        mp[s]++;
    }
    cin >> m;
    rep(i,0,m - 1){
        string s;
        cin >> s;
        mp[s]--;
    }

    int ans = 0;

    for(auto ite = mp.begin();ite != mp.end();++ite)
        ans = max(ans,ite->second);
    cout << ans << endl;
}


Measured memory_bytes: 256
import qualified Data.ByteString.Char8 as BS
import qualified Data.Vector.Unboxed as V

main = do
  [n,m,c] <- map (read . BS.unpack) . BS.words <$> BS.getLine
  b <- V.fromListN m . map (read . BS.unpack) . BS.words <$> BS.getLine
  result <- V.replicateM n $ do
    a <- V.fromListN m . map (read . BS.unpack) . BS.words <$> BS.getLine
    return $ if (V.sum $ V.zipWith (*) a b) + c > (0 :: Int) then 1 else 0
  print $ (V.sum result :: Int)


Measured memory_bytes: 1020
//include
//------------------------------------------
#include <iostream>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
using namespace std;

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define FORR(i,a,b) for(int i=(a);i>(b);i--)
#define REP(i,n)  FOR(i,0,n)

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//debug
//-------------------------------------------
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define VISITED 1
#define NOT_VISITED 0
#define INF (1<<21)

//typedef
//-------------------------------------------
typedef long long ll;
int g[101][101];
int visited[101];
int d[101];
int n, m;

int prim() {
    d[0] = 0;

    while(true) {
        int min = INF;
        int u = -1;
        REP(i, n) {
            if (visited[i] != VISITED && d[i] < min) {
                min = d[i];
                u = i;
            }
        }
        if (u < 0) break;

        visited[u] = VISITED;

        REP(v, n) {
            if (visited[v] != VISITED && g[u][v] != INF) {
                if (g[u][v] < d[v]) {
                    d[v] = g[u][v];
                }
            }
        }
    }
    int sum = 0;
    REP(i, n) sum += d[i];
    return sum;
}

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

    while(true) {
        cin >> n >> m;
        if (!n && !m) break;
        REP(i, n) {
            visited[i] = NOT_VISITED;
            d[i] = INF;
        }
        REP(i, 101) REP(j, 101) g[i][j] = INF;
        REP(i, m) {
            int s, d, c;
            cin >> s >> d >> c;
            g[s][d] = c;
            g[d][s] = c;
        }
        cout << prim() << endl;
    }

    return 0;
}

Measured memory_bytes: 3148
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep2(i, m, n) for(int i=int(m); i<int(n); i++)
#define rep(i, n) rep2(i, 0, n)
#define all(a) a.begin(), a.end()
using ll = long long;
using ld = long double;
using V = vector<int>;
using Vll = vector<ll>;
using Vld = vector<ld>;
using VV = vector<V>;
using VVll = vector<Vll>;
using VVld = vector<Vld>;
using P = pair<int, int>;
using Pll = pair<ll, ll>;
using Pld = pair<ld, ld>;
const int INF = 1<<30;
const ll INFll = 1ll<<62;
const ld EPS = 1e-10;
const int MOD = int(1e9)+7;
template<typename T> inline bool chmin(T& a, T b) {if(a>b) {a=b; return true;} return false;}
template<typename T> inline bool chmax(T& a, T b) {if(a<b) {a=b; return true;} return false;}


int main() {
  ll n; cin >> n;

  ll ans = 0;
  int x; cin >> x;
  ans += x-1;
  
  int d = 2;
  rep(i, n-1) {
    int x; cin >> x;
    if (x == d) d++;
    else ans += (x-1)/d;
  }

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


Measured memory_bytes: 256
class UnionFind:
    def __init__(self, n=1):
        self.parent = [i for i in range(n)]
        self.rank = [0] * n
    
    def find(self, x):
        if self.parent[x] == x:
            return x
        else:
            self.parent[x] = self.find(self.parent[x])
            return self.parent[x]
    
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x != y:
            if self.rank[x] < self.rank[y]:
                x, y = y, x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1
            self.parent[y] = x
    
    def is_same(self, x, y):
        return self.find(x) == self.find(y)

N, M = map(int, input().split())
uf = UnionFind(N)
s = [set() for m in range(M+1)]
for i in range(N):
  KL = list(map(int, input().split()))
  for l in KL[1:]:
    s[l].add(i)

for m in range(1, M+1):
  if s[m]:
    u = s[m].pop()
    for v in s[m]:
      uf.union(u, v)

par = [uf.find(i) for i in range(N)]
if min(par) == max(par):
  print('YES')
else:
  print('NO')

Measured memory_bytes: 39804
abacus = ["* = ****", "* =* ***", "* =** **", "* =*** *", "* =**** ",
          " *= ****", " *=* ***", " *=** **", " *=*** *", " *=**** "]
first = False

while 1:
    try:
        n = input()
    except EOFError:
        break

    if first:
        print()
    else:
        first = True

    n = n.zfill(5)
    nlist = list(n)

    ans = []
    for n in nlist:
        ans.append(list(abacus[int(n)]))

    ans_t = [list(x) for x in zip(*ans)]

    for i in range(8):
        print(''.join(a for a in ans_t[i]))


Measured memory_bytes: 5612
def main():
    N, M, K = map(int, input().split())
    A = list(map(int, input().split()))
    B = list(map(int, input().split()))
    cum_A = [0]
    for a in A:
        if a + cum_A[-1] <= K:
            cum_A.append(a + cum_A[-1])
        else:
            break
    cum_B = [0]
    for b in B:
        if b + cum_B[-1] <= K:
            cum_B.append(b + cum_B[-1])
        else:
            break

    ans = 0
    max_b_idx = len(cum_B) - 1
    for a_idx, a in enumerate(cum_A):
        if a <= K and a_idx > ans:
            ans = a_idx
        for b_idx in reversed(range(max_b_idx + 1)):
            if a + cum_B[b_idx] <= K:
                max_b_idx = b_idx
                if a_idx + b_idx > ans:
                    ans = a_idx + b_idx
                break
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 131516
#include <stdio.h>
 
int main(){
    int k,n,set_1=0,dice[100][7];
     
    scanf("%d",&n);
     
    for(int i=0;i<n;i++)
        for(int j=1;j<7;j++)
            scanf("%d", &dice[i][j]);
     
    for(int x=0;x<n-1;x++){
        for(int y=x+1;y<n;y++){
            for(int i=0;i<6;i++){
                if(dice[x][1]==dice[y][1])
                    for(int j=0;j<4;j++){
                         
                        //一致判定
                        for(k=1;k<7;k++)
                            if(dice[x][k]!=dice[y][k]) break;
                         
                        if(k==7)
                            set_1 = 1;
                         
                        //スピン
                        dice[y][0] = dice[y][2];
                        dice[y][2] = dice[y][3];
                        dice[y][3] = dice[y][5];
                        dice[y][5] = dice[y][4];
                        dice[y][4] = dice[y][0];
                         
                         
                    }
                 
                //回転
                 
                dice[y][0] = dice[y][1];
                 
                switch(i){
                         
                    case 2:
                        dice[y][1] = dice[y][3];
                        dice[y][3] = dice[y][6];
                        dice[y][6] = dice[y][4];
                        dice[y][4] = dice[y][0];
                        break;
                         
                    default:
                        dice[y][1] = dice[y][2];
                        dice[y][2] = dice[y][6];
                        dice[y][6] = dice[y][5];
                        dice[y][5] = dice[y][0]; 
                        break;
                         
                }
            }
        }
    }
     
    printf(set_1==1 ? "No\n" : "Yes\n");
    return 0;
}


Measured memory_bytes: 2112
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
#define yn {puts("Yes");}else{puts("No");}
#define MAX_N 200005

int main() {
    int n, k;
    cin >> n >> k;
    double p[n], e[n];
    rep(i, n)cin >> p[i];
    rep(i,n)e[i] = (p[i] + 1.0) / 2.0;
    double sum[n+1] = {};
    rep(i,n)sum[i+1] = sum[i] + e[i];
    double ans = 0;
    srep(i,k,n+1){
        ans = max(ans, sum[i] - sum[i-k]);
    }
    cout << fixed << setprecision(10) << ans << endl;
}
 
 


Measured memory_bytes: 4992
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <cstdio>	
#include <limits>
#include <vector>
#include <cstdlib>
#include <numeric>
#include <sstream>
#include <iostream>	
#include <algorithm>
#include <functional> 
#include <iomanip>
#include <unordered_map>
#include <fstream>
#include <cstdio>
#include <memory.h>

using namespace std;

int main(void)
{
	int dp[2][100] = { 0, };
	int a[2][100];
	int n;

	cin >> n;
	for (int i = 0; i < 2; i++)
	{
		for (int j = 0; j < n; j++)
		{
			cin >> a[i][j];
		}
	}
	dp[0][0] = a[0][0];
	for (int i = 1; i < n; i++)
	{
		dp[0][i] = a[0][i] + dp[0][i - 1];
	}
	dp[1][0] = a[1][0] + dp[0][0];
	for (int i = 1; i < n; i++)
	{
		dp[1][i] = max(dp[1][i - 1], dp[0][i]) + a[1][i];
	}

	cout << dp[1][n - 1] << '\n';

	return 0;
}

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

using namespace std;

#define MAX 100000
#define INF 2140000000
#define MOD 1000000007

int main() {
	vector<int> v(3);

	cin >> v[0] >> v[1] >> v[2];

	sort(v.begin(), v.end());

	if ((v[0] == v[1] && v[1] != v[2]) || (v[0] != v[1] && v[1] == v[2])) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

	return 0;
}

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


int gcd(int a,int b)
{
    if(b==0)
        return a;
    return gcd(b,a%b);
}
int gcd2(int a,int b)
{
    while(b!=0)
    {
        int temp=a;
        a=b;
        b=temp%a;
    }
    return a;
}
typedef long long LL;
LL LCM(int a,int b)
{
    int multi=gcd(a,b);
    return (LL)a*(b/multi);
}
int main()
{
    int a,b;
    while(~scanf("%d%d",&a,&b))
    {
        cout<<gcd(a,b)<<" "<<LCM(a,b)<<endl;
    }
    return 0;
}



Measured memory_bytes: 3140
#include <iostream>
#include <vector>
#include <math.h>  
using namespace std;
int main(void) {
	int K, s; cin >> K >> s;
	int ans = 0;
	for (int i = 0; i <=K; i++) {
		for (int j = 0; j<= K; j++) {
			int k = s -i-j;
			if (0<=k and k <= K) { ans = ans + 1; }
		}
	}
	cout << ans << endl;
}

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

#define allof(a) (a).begin(),(a).end()

using lint = long long;
using pii = pair< int, int >;
template< typename T > using Vec = vector< T >;

template< typename T > bool in_range(T x, T lb, T ub) { return lb <= x && x < ub; }
template< typename T > bool in_range(T x, T y, T lb, T ub) { return in_range(x, lb, ub) && in_range(y, lb, ub); }

template< typename T > void modAdd(T& a, T b, T mod) { a = (a + b + mod) % mod; }
template< typename T > void modMul(T& a, T b, T mod) { a = (a * b) % mod; }
template< typename T > void minUpdate(T& a, T b) { a = min(a, b); }
template< typename T > void maxUpdate(T& a, T b) { a = max(a, b); }

int bitCount(int x) { return __builtin_popcount(x); }
int bitCount(lint x) { return __builtin_popcountll(x); }

const int dx[4] = {0,1,0,-1}, dy[4] = {-1,0,1,0};
const int Dx[8] = {0,1,1,1,0,-1,-1,-1}, Dy[8] = {-1,-1,0,1,1,1,0,-1};
const double EPS = 1e-9;
const double PI = acos(-1);

//--------------8---------------->> coding space <<-----------------8-------------//

int N;

int main() {
	cin >> N;
	vector< int > b(N);
	for (int i=0; i<N; ++i) cin >> b[i];
	
	vector< int > ans;
	for (int i=0; i<N; ++i) {
		for (int j=N-i-1; j>=0; --j) {
			if (b[j] == j+1) {
				ans.push_back(j+1);
				b.erase(b.begin() + j);
				break;
			}
		}
	}
	
	if ((int)ans.size() == N) {
		for (int i=0; i<N; ++i) cout << ans[N-i-1] << endl;
	}
	else {
		cout << -1 << endl;
	}
}
//--------------8---------------->> coding space <<-----------------8-------------//


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#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(n) begin(n), end(n)
struct cww
{
    cww()
    {
        ios::sync_with_stdio(false);
        cin.tie(0);
    }
} star;
const long long INF = numeric_limits<long long>::max();
typedef long long ll;
typedef vector<int> vint;
typedef vector<char> vchar;
typedef vector<vector<int>> vvint;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef unsigned long long ull;
const int MAX = 510000;
const int 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()
{
    double H, W, N;
    cin >> H >> W >> N;
    double K = max(H, W);
    cout << ceil(N / K);
    return 0;
}

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

int main()
{
  int A, B, C, D;
  cin >> A >> B >> C >> D;

  float Tak = float(C) / float(B);
  int    TT = ceil(Tak);
  float Aok = float(A) / float(D);
  int    AA = ceil(Aok);

  if(TT <= AA) 
    cout << "Yes" << endl;
  else     
    cout << "No"   << endl;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 2e5 + 5, mod = 1e9 + 7;
struct e{
    int id, score;
    string s;
}a[105];
bool cmp(e a, e b){return a.s == b.s ? a.score > b.score : a.s < b.s;}
int main()
{
    ios::sync_with_stdio(0); cin.tie(0);
    int n;
    cin >> n;
    for (int i = 1; i <= n; ++i){
        cin >> a[i].s >> a[i].score;
        a[i].id = i;
    }
    sort(a + 1, a + 1 + n, cmp);
    for (int i = 1; i <= n; ++i){
        cout << a[i].id << '\n';
    }
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<array>
#include<algorithm>
#include<list>
#include<cmath>
#include<iomanip>
#include<queue>
#include<functional>
#include<climits>
#include<iterator>
#include<unordered_set>
#include<unordered_map>
#include<map>
#include<stack>
#include<set>
using namespace std;

const double pi=4*atan(1.0);

constexpr long long mod=static_cast<long long>(1e9+7);

using cWeightEdges=vector<vector<pair<int,int>>>;
using cEdges=vector<vector<int>>;

int main(){	
	string str1,str2;
	int n;
	cin>>n;
	cin>>str1>>str2;

	int num=-1;
	for(int i=0;i<str2.size();++i){
		if(str1.substr(i)==str2.substr(0,str2.size()-i)){
			num=i;
			break;
		}
	}
	if(num<0)cout<<2*n<<endl;
	else cout<<str1.size()+num<<endl;
	//system("pause");
	return 0;
}

Measured memory_bytes: 256