akhauriyash/Code-Regression huggingface dataset:
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>
  
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
  
using namespace std;
  
typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;
  
const int INF=1<<29;
const double EPS=1e-9;
  
const int dx[]={1,0,-1,0,1,1,-1,-1},dy[]={0,-1,0,1,1,-1,-1,1};

int N;
std::vector<vector<int> > G;
std::vector<int> parent;
std::vector<int> depth;
std::vector<int> type;
std::vector<int> sibling;
std::vector<int> degree;
std::vector<int> height;

int dfs(int i, int d) {
    int h = 0;
    
    depth[i] = d;
    int deg = 0;
    
    for (int j = 0; j < G[i].size(); j++) {
        
        if (G[i][j] != -1) {
            h = max(h, dfs(G[i][j], d + 1) + 1);
            parent[G[i][j]] = i;
            deg++;
            sibling[G[i][j]] = G[i][1 - j];
        }
    }
    
    degree[i] = deg;
    
    if (G[i][0] == -1 && G[i][1] == -1) {
        type[i] = 0;
        height[i] = 0;
        return 0;
    } else {
        type[i] = 1;
        return height[i] = h;
    }
}

int main() {

    cin >> N;
    for (int i = 0; i < N; i++) {
        G.push_back(vector<int>());
        parent.push_back(-1);
        depth.push_back(0);
        type.push_back(0);
        sibling.push_back(-1);
        degree.push_back(-1);
        height.push_back(0);
    }
    std::vector<int> notroot(N, 0);

    for (int i = 0; i < N; i++) {
        int id;
        cin >> id;
        for (int j = 0; j < 2; j++) {
            int child;
            cin >> child;
    
            if (child != -1) notroot[child] = 1;
            G[id].push_back(child);
        }
    }

    int root;
    for (int i = 0; i < N; i++) {
        if (notroot[i] == 0) {
            root = i;
            break;
        }
    }

    dfs(root, 0);

    for (int i = 0; i < N; i++) {
        cout << "node " << i << ": ";
        cout << "parent = " << parent[i] << ", ";
        cout << "sibling = " << sibling[i] << ", ";
        cout << "degree = " << degree[i] << ", ";
        cout << "depth = " << depth[i] << ", ";
        cout << "height = " << height[i] << ", ";
        if (depth[i] == 0) {
            cout << "root";
        } else {
            if (type[i] == 0) {
                cout << "leaf";
            } else {
                cout << "internal node";
            }
        }
        cout << endl;
    }


    return 0;
}

Measured memory_bytes: 1220
N, K = map(lambda x: int(x), input().split())

def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )

for i in range(1, K+1):
    ans = cmb((N-K+1),i,mod) * cmb((K-1),i-1,mod)
    print(ans % mod)


Measured memory_bytes: 3572
#include<iostream>
#include<string>
using namespace std;
int main() {
	string b;
	cin >> b;
	if (b == "A") {
		cout << 'T' << endl;
	}
	else if (b == "T") {
		cout << 'A' << endl;
	}
	else if (b == "C") {
		cout << 'G' << endl;
	}
	else {
		cout << 'C' << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <cstring>
#include <string>
#include <cstdlib>
#include <iomanip>
#include <cmath>
using namespace std;
#define ll long long
 
int main(void){
    ll check[100001];
    check[1] = 0; check[2] = 1; check[3] = 1;
    ll aa[100001];
    bool a = true;
    for(ll i = 4; i <= 100000; i++){
        if(i%2 == 0) a = false;
        else if(i%2 != 0){
            for(ll j = 3; j <= sqrt(i); j+=2){
                if(i%j==0)
                    a = false;
            }
        }
        if(a==true) check[i] = 1;
        else if(a==false) check[i] = 0;
        a = true;
    }
    aa[0] = 0;
    for(ll i = 1; i <= 100000; i++){
        if(i%2==0) aa[i] = aa[i-1];
        else if(check[i]==1 && check[(i+1)/2]==1)
            aa[i] = aa[i-1]+1;
        else
            aa[i] = aa[i-1];
        //cout << i << " " << aa[i] << endl;
    }
    ll q, b, c;
    cin >> q;
    ll ans[q];
    for(ll i = 0; i < q; i++){
        cin >> b >> c;
        ans[i] = aa[c]-aa[b];
        if(aa[b]>aa[b-1])
            ans[i]++;
    }
    for(ll i = 0; i < q; i++)
        cout << ans[i] << endl;
    return 0;
}

Measured memory_bytes: 2944
#include <iostream>
#include <stdio.h>
#include <string>
#include <vector>
#include <stdlib.h>

using namespace std;

int main(void){
	//FILE* fp_in = freopen("data.txt", "r", stdin);

	while(1) {
		/*
			numは販売した券の総数
			divは優勝者への投票数
		*/
		int N, M, P, div, num = 0, ans;
		cin >> N >> M >> P;

		if( N == 0 && M == 0 && P == 0) break;

		for(int i = 0; i < N; i++) {
			int tmp;
			cin >> tmp;
			num += tmp;
			if(M == i + 1) div = tmp; 
		}
		if(div == 0) {
			cout << 0 << endl;
		} else {
			ans = 100 * num;	//総売り上げ
			ans -= P*ans/100;	//控除
			ans /= div;
			cout << ans << endl;
		}

	}

	//while(1){}
	return 0;
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
#include <ext/pb_ds/detail/standard_policies.hpp>


/* 
*    coder :: ATUL_PANDEY_2608
*        >>> INDIA <<<
*/
using namespace std;
using namespace __gnu_pbds;

// #define  part ..
#define pb(a) push_back(a)
#define all(a) a.begin(),a.end() 
#define mod 1000000007
//#define maxx 200006
#define ll long long 
#define quick    ios_base::sync_with_stdio(NULL),cin.tie(0);
#define listll vector< long long > 
#define listi vector< int> 
#define pii   pair<int , int> 
#define pll pair<long long , long long > 
#define minheap priority_queue<long long , vector< long long >, greater<long long > >
#define rep(i,a,b) for(int i=a;i<b;i++)
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
ll power( ll a, ll n, ll m){
  ll ans = 1;
  while(n){
  if(n&1)
  {
  ans *= a;
  ans%=m;
  }
  a*=a;
  n/=2;
  }
  return ans ;
} 


template < class T > using oset = tree< T , null_type, less  < T  > , rb_tree_tag , tree_order_statistics_node_update > ;


// end of #define 

// define globals ...
const int maxx = 2e5+26;

//write function from here ...







int Main(){


ll a,b,c,d;
cin>>a>>b>>c>>d;

if( a > b)
swap(a,b);

if( c> d)
swap(c,d);

ll ans ;

ans = a*c;
ans = max( ans , a*d);
ans = max( ans , b*d);
ans = max( ans , c*b);


cout<<ans<<endl;




return 0;

}






int main(){
 quick;
int t =1; 
//cin>>t;
while(t-- )
 Main();

 return 0;


}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
#define ALL(v) v.begin(), v.end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort((c).begin(),(c).end())
#define dbug(x) cout<<#x<<"="<<x<<endl
#define m0(x) memset(x,0,sizeof(x))
#define rep(i, n) for(int i = 0; i < n; i++)
#define repr(i, n) for(int i = n; i >= 0; i--)
#define reps(i, m, n) for(int i = m; i < n; i++)
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define ZYUZYO (10000000000)

using namespace std;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef long long ll;
typedef pair<ll, ll> pl;

template<typename T>
istream& operator >> (istream& is, vector<T>& vec){
  for(T& x: vec) is >> x;
  return is;
}

int main(){

  ll H,W,N;
  cin >> H >> W >> N;

  ll ans[10]={};
  ans[0]=(H-2)*(W-2);

  map<ll, ll> mp;

  ll key;


  rep(i,N){
    ll a,b;
    cin>>a>>b;

    rep(j,3){
      rep(k,3){
        if((a+j-1)<=1||(a+j-1)>=H||(b+k-1)<=1||(b+k-1)>=W) continue;
        key=(a+j-1)*ZYUZYO+(b+k-1);
        if(mp.count(key)==0){
          mp[key]=1;
          ans[1]+=1;
          ans[0]-=1;
        }
        else {mp[key]=mp[key]+1;
          ans[mp[key]]+=1;
          ans[mp[key]-1]-=1;
        }
      }
    }

  }

  rep(i,10) cout << ans[i] <<endl;
  return 0;
}


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

using namespace std;
// ascending order
#define vsort(v) sort(v.begin(), v.end())
// descending order
#define vsort_r(v) sort(v.begin(), v.end(), greater<int>())
#define vunique(v) unique(v.begin(), v.end())
#define mp make_pair
#define ts(x) to_string(x)
#define rep(i, a, b) for(int i = (int)a; i < (int)b; i++)
#define repm(i, a, b) for(int i = (int)a; i > (int)b; i--)
#define bit(a) bitset<8>(a)
#define des_priority_queue priority_queue<int, vector<int>, greater<int> >
#define all(v) (v).begin(), (v).end()
typedef long long ll;
typedef pair<int, int> P;
const ll INF = 1e18;

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

	int N, C;
	cin >> N >> C;
	int t_max = 101010;
	int v[30][101010];

	rep(i, 0, N) {
		int s, t, c;
		cin >> s >> t >> c;
		s--;
		c--;
		v[c][s]++;
		v[c][t]--;
	}

	rep(i, 0, C) {
		rep(j, 0, t_max - 1) v[i][j + 1] += v[i][j];
	}

	rep(i, 0, C) {
		rep(j, 0, t_max) {
			if(v[i][j]) v[i][j] = 1;
		}
	}

	int rsl = 0;
	rep(j, 0, t_max) {
		int cnt = 0;
		rep(i, 0, C) cnt += v[i][j];
		rsl = max(rsl, cnt);
	}

	cout << rsl << endl;

}


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

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<ll> vll;
// #define int long long
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000               // 2e9
#define LLINF 2000000000000000000ll  // 2e18 (llmax:9e18)
#define fi first
#define sec second
#define all(x) (x).begin(), (x).end()
#define sq(x) ((x) * (x))
#define dmp(x) cerr << #x << ": " << x << endl;

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

template <class T>
using MaxHeap = priority_queue<T>;
template <class T>
using MinHeap = priority_queue<T, vector<T>, greater<T>>;
template <class T>
vector<T> vect(int len, T elem) {
  return vector<T>(len, elem);
}

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << p.fi << ',' << p.sec;
  return os;
}
template <class T, class U>
istream &operator>>(istream &is, pair<T, U> &p) {
  is >> p.fi >> p.sec;
  return is;
}
template <class T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
  for (int i = 0; i < vec.size(); i++) {
    os << vec[i];
    if (i + 1 < vec.size()) os << ' ';
  }
  return os;
}
template <class T>
istream &operator>>(istream &is, vector<T> &vec) {
  for (int i = 0; i < vec.size(); i++) is >> vec[i];
  return is;
}
void fastio() {
  cin.tie(0);
  ios::sync_with_stdio(0);
  cout << fixed << setprecision(20);
}

#define endl "\n"

void solve() {
  int N;
  cin >> N;
  vector<ll> a(N);
  cin >> a;
  deque<ll> deq;
  for (int i = 0; i < N; i++) {
    if (i % 2 == 0)
      deq.push_front(a[i]);
    else
      deq.push_back(a[i]);
  }
  if (N % 2 == 0) reverse(all(deq));
  for (int i = 0; i < N; i++) {
    cout << deq[i];
    if (i + 1 < N)
      cout << ' ';
    else
      cout << endl;
  }
  return;
}

signed main() {
  fastio();
  solve();
  // int t; cin >> t; while(t--)solve();
  return 0;
}


Measured memory_bytes: 5376
from collections import deque
import sys
def input():
	return sys.stdin.readline()[:-1]

H, W = map(int, input().split())
m = ["#" * (W+2)] + ["#" + input() + "#" for _ in range(H)] + ["#" * (W+2)]
q = deque()
dx = [1, 0, -1, 0]
dy = [0, 1, 0, -1]

step = [[float("inf") for _ in range(W+2)] for _ in range(H+2)]

for h in range(1, H+1):
	for w in range(1, W+1):
		if m[h][w] == "#":
			q.appendleft([h, w])
			step[h][w] = 0

while q:
	label = q.pop()

	for i in range(4):
		h, w = label[0] + dx[i], label[1] + dy[i]
		if m[h][w] != "#" and step[h][w] > step[label[0]][label[1]] + 1:
			q.appendleft([h, w])
			step[h][w] = step[label[0]][label[1]] + 1

ans = 0
for h in range(1, H+1):
	for w in range(1, W+1):
		ans = max(ans, step[h][w])
print(ans)

Measured memory_bytes: 150492
#[allow(unused_imports)]
use itertools::Itertools;
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::*;

fn main() {
    input! {
        n: i64, k: i64,
    }
    if k == 1 {
        println!("0");
    } else {
        println!("{}", n - (k - 1) - 1);
    }
}


Measured memory_bytes: 2164
#!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1

h=int(input())
w=int(input())
n=int(input())
k=max(h,w)
print(math.ceil(n/k))


Measured memory_bytes: 38460
#include <bits/stdc++.h>
using namespace std;
int x, y;
int main() {
    cin >> x >> y;
    int sum = 0;
    if(x == 1 && y == 1) {
        sum += 400000;
    }
    if(x == 1) {
        sum += 300000;
    }else if(x == 2) {
        sum += 200000;
    }else if(x == 3) {
        sum += 100000;
    }

    if(y == 1) {
        sum += 300000;
    }else if(y == 2) {
        sum += 200000;
    }else if(y == 3) {
        sum += 100000;
    }

    cout << sum << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>

using namespace std;

int main() {
    int n;
  	cin >> n;
    vector<long long> v(3 * n);
  	for (int i = 0; i < 3 * n; ++i) cin >> v[i];
    vector<long long> ans(n + 1);
    long long left(0), right(0);
    priority_queue<long long> min_q;
    priority_queue<long long, vector<long long>, greater<long long>> max_q;
    for (int i = 0; i < n; ++i) {
        max_q.push(v[i]);
        min_q.push(v[i + 2 * n]);
        left += v[i];
        right += v[i + 2 * n];
    };
    ans[0] = left;
    ans.back() = -right;
    for (int i = n; i < 2 * n; ++i) {
        max_q.push(v[i]);
        left += v[i] - max_q.top();
        max_q.pop();
        ans[i-n+1] += left;
        min_q.push(v[3 * n - 1 - i]);
        right += v[3 * n - i - 1] - min_q.top();
        min_q.pop();
        ans[2 * n - i - 1] -= right;
    }
    long long res(-1e14);
    for (const long long& i: ans) res = max(res, i);
    cout << res;
    return 0;
};


Measured memory_bytes: 5108
import java.util.Scanner;

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

    public static void solve(Scanner sc) {
        int n = sc.nextInt();
        int a = sc.nextInt();

        System.out.println(n*n - a);
    }
}

Measured memory_bytes: 22612
////////////////////////////////////////////////////////////////////
// This source code is for Visual Studio
////////////////////////////////////////////////////////////////////
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <sstream>
#include <iterator>
#include <stack>
#include <functional>
#include <iomanip>
#include <string>
#include <cstring>
#include <deque>
#include <math.h>
#include <assert.h>

#define	numberof(a)	(sizeof(a) / sizeof(a[0]))
#define	INF32		INT32_MAX
#define	INF64		INT64_MAX
#define Rep(i,n) for(int i = 0; i < (n); ++i )

using namespace std;

typedef vector< vector<int> > MAT;
typedef pair<int, int> PINT;
typedef long long ll;
typedef uint32_t u32;
typedef uint64_t u64;
typedef int32_t s32;
typedef int64_t s64;

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);

// main function
int main()
{
	string S = "";
	ll ans = 1;
	ll zeros = 0;
	ll ones = 0;

	cin >> S;
	Rep(i, S.length()) {
		if (S[i] == '0') zeros++;
		else ones++;
	}
	ans = min(zeros, ones);
	ans *= 2;

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 512
D = int(input())
C = list(map(int, input().split()))
S = [list(map(int, input().split())) for _ in range(D)]
ans = [0]*D
for i in range(D):
    tmp = -float('inf')
    for k in range(26):
        manzoku_down = 0
        for j in range(26):
            last = 0
            for l in range(0,i+1):
                if ans[l] == j+1:
                    last = j+1
            manzoku_down += C[j]*((i+1)-last)
        if S[i][k]-manzoku_down >= tmp:
            tmp = S[i][k]-manzoku_down
            ans[i] = k+1
for i in ans:
    print(i)

Measured memory_bytes: 87200
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;
int main() {
	int n, m, tmp;
	cin >> n >> m;

	vector<vector<int>>s(n + 1);
	vector<int>p(m);
	vector<int>y(m);

	for (int i = 0; i < m; i++)
		cin >> p[i] >> y[i],
		s[p[i]].push_back(y[i]);

	for (int i = 0; i < n; i++)
		sort(s[i+1].begin(), s[i+1].end());

	for (int i = 0; i < m; i++)
		tmp = lower_bound(s[p[i]].begin(), s[p[i]].end(), y[i]) - s[p[i]].begin() + 1,
		printf("%06d%06d\n", p[i], tmp);

	return 0;
}

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

void countword(string s){
    map<string, int>m;
    stringstream ss(s);
    string word, maximum, maximum_l;
    int Max1 = 0, Max2 = 0;
    while(ss >> word){
        if(word.size() > Max1){
            Max1 = word.size();
            maximum_l = word;
        }
        m[word]++;
    }
    map<string, int>::iterator it;


        for(it = m.begin(); it != m.end(); it++){
        if(Max2 < it->second){
            Max2 = it->second;
            maximum = it->first;
        }
    }
    cout<<maximum<<" "<<maximum_l<<endl;
}


int main()
{
    string s;
    getline(cin, s);
    countword(s);
}



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

public class Main{
	public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			int w = Integer.parseInt(br.readLine());
			int n = Integer.parseInt(br.readLine());
			int hako[] = new int[w+1];
			int dami = 0;
			
			for(int i = 1;i <= w;i++){
				hako[i] = i;
			}
			
			for(int i = 0;i < n;i++){
				String line = br.readLine();
				int a[] = new int[2];
				String s[] = line.split(",",0);
				a[0] = Integer.parseInt(s[0]);
				a[1] = Integer.parseInt(s[1]);
				
				dami = hako[a[0]];
				hako[a[0]] = hako[a[1]];
				hako[a[1]] = dami;
			}
			
			for(int i = 1;i <= w;i++){
				System.out.println(hako[i]);
			}
	}
}

Measured memory_bytes: 24164
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define sc(x) scanf("%lld",&x)
int main(){
    ll n, m, tmp = 0, ans = 0; sc(n),sc(m);
    vector<P> vec(n);
    for (int i = 0; i < n; i++) sc(vec[i].first), sc(vec[i].second);
    sort(vec.begin(), vec.end());
    for (int i = 0; i < n; i++){
        if (tmp+vec[i].second < m){
            tmp += vec[i].second;
            ans += vec[i].first * vec[i].second;
        }else{
            ans += vec[i].first * (m-tmp);
            break;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
#define rep1(i,n) for (int i = 1; i <= (n); i++)
#define repi(i,a,b) for (int i = (a); i < (b); i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using vc = vector<char>;
using vvc = vector<vc>;
using vs = vector<string>;

int main() {
  int N;
  cin >> N;
  
  cout << 800*N - 200*(N/15) << endl;
}

Measured memory_bytes: 256
def getIntList(inp):
	return [int(_) for _ in inp]


from sys import stdin
import sys

def getInputs():
	inputs=[]
	for line in stdin:
		line=line.split()
		inputs.append(line)
	return inputs


def main(inputs):
	n,blue,red=getIntList(inputs[0])
	s=blue+red
	ans=(n//s)*blue+min(n%s, blue)
	print(ans)

if __name__=="__main__":
	inputs=getInputs()
# 	inputs=simInputs()
	main(inputs)
	


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

int main()
{
    int n, m, x;
    cin >> n >> m >> x;
    vector<int> c(n);
    vector<vector<int>> a(n, vector<int>(m));
    rep(i,n) {
        cin >> c[i];
        rep(j,m) {
            cin >> a[i][j];
        }
    }

    int least_money = 100100100;
    for (int bit=0; bit<(1<<n);++bit) {
        vector<int> smart(m, 0);
        int current_money = 0;
        for (int i=0;i<n;++i) {
            if (bit & (1<<i)) {
                rep(j,m) {
                    smart[j] += a[i][j];
                }
                current_money += c[i];
            }
        }
        int ngflag = -1;
        rep(i,m) {
            if (smart[i] < x) {
                ngflag = 0;
            }
        }
        if (ngflag == -1) {
            if (current_money < least_money) {
                least_money = current_money;
            }
        }
    }
    if (least_money == 100100100) {
        cout << "-1" << endl;
    } else {
        cout << least_money << endl;
    }


    return 0;
}

Measured memory_bytes: 3648
import java.util.Scanner;

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

        String[] patternList = new String[] {"dreamer", "dream", "eraser", "erase"};
        for (int i = 0; i < 4; ++i) {
            patternList[i] = new StringBuilder(patternList[i]).reverse().toString();
        }

        S = new StringBuilder(S).reverse().toString();

        for (int i= 0; i< S.length();) {
            boolean exists = false;
            for (int k = 0; k < 4; k++) {
                if (i + patternList[k].length() - 1 >= S.length()) {
                    continue;
                }
                if (S.substring(i, i + patternList[k].length()).equals(patternList[k])) {
                    exists = true;
                    i += patternList[k].length();
                    break;
                }
            }
            if (!exists) {
                System.out.println("NO");
                return;
            }
        }
        System.out.println("YES");
    }
}


Measured memory_bytes: 28284
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {
	private static final int MOD = (int)Math.pow(10, 9);
	public static void main(String[] args) {
		FastReader sc = new FastReader();
		int n = sc.nextInt();
		int m = sc.nextInt();
		int[] loc = new int[m];
		for (int i = 0 ; i < m; i++) {
			loc[i] = sc.nextInt();
		}
		
		Arrays.sort(loc);
		
		// 1 <= i <= M - 1, distance[i] = |loc[i] - loc[i-1]|
		int[] distance = new int[m - 1];
		for (int i = 1; i < m; i++) {
			distance[i-1] = Math.abs(loc[i] - loc[i-1]);
		}
		
		Arrays.sort(distance);
		int res = 0;
		
		/* 以範例一為例： 入力例１を例として
		1 2 10 12 14
		 1 2  2  8  <= 如果陀螺只有一顆，得全走，陣列全部總和　コマがただ一つの場合には、最も左の場所から、最も右の場所まで移動します。
		 1 2  2  X  <= 如果陀螺有兩顆，其中一顆放距離最大那個，其他總和　コマが二つの場合には、一つのコマを一番長い距離の場所で置いて、
		 　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　もう一つのコマは最も左の場所から、最も右の場所まで移動します
		 1 2  X  X  <= 如果陀螺有三顆，其中兩顆放距離最大那兩個，其他總和　
		  1  X    X  X  <= 如果陀螺有四‘顆，其中三顆放距離最大那三個，其他總和
		*/
		for (int i = 0; i < m - n; i++) {
			res += distance[i];
		}
		System.out.println(res);
	}

    static class FastReader {
	    BufferedReader br;
	    StringTokenizer st;
	
	    public FastReader() {
	      br = new BufferedReader(new InputStreamReader(System.in));
	    }
	  
	    String next() { 
	      while (st == null || !st.hasMoreElements()) {
	        try {
	          st = new StringTokenizer(br.readLine());
	        } catch (IOException  e) {
	          e.printStackTrace();
	        }
	      }
	      return st.nextToken();
	    }
	
	    int nextInt() {
	      return Integer.parseInt(next());
	    }
	
	    long nextLong() {
	      return Long.parseLong(next());
	    }
	
	    double nextDouble() { 
	      return Double.parseDouble(next());
	    }
	
	    String nextLine() {
	      String str = "";
	        try{
	            str = br.readLine();
	        } catch (IOException e) {
	            e.printStackTrace();
	        }
	        return str;
	      }
	  }
}


Measured memory_bytes: 34136
#include <algorithm>  //min, max, sort, unique, fill
#include <iostream>
#include <numeric>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>  //pair, swap,
#include <vector>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
using VI = vector<ll>;

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

static const ll kIntMax = numeric_limits<ll>::infinity();
static const double kFloatMax = numeric_limits<double>::infinity();

vector<ll> vi;

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

  cout << ((s[0] != s[1] && s[1] != s[2] && s[2] != s[0]) ? "Yes" : "No")
       << endl;

  return 0;
}


Measured memory_bytes: 256
/*
    -ensure correct output format
    -ensure printing required output
    -reread the problem statement
  */

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll>pll;
typedef pair<ll,pair<ll,ll>>plll;
#define fastread() (ios_base:: sync_with_stdio(false),cin.tie(NULL));
#define vll(v) v.begin(),v.end()
#define all(x) x.rbegin(),x.rend()
#define min3(a, b, c)   min(a, min(b, c))
#define max3(a, b, c)   max(a, max(b, c))
#define F first
#define S second
#define in  freopen("input.txt", "r", stdin)
#define out  freopen("output.txt", "w", stdout)
#define minheap int,vector<int>,greater<int>
#define pb push_back
#define eb emplace_back
#define ischar(x)  (('a' <= x && x <= 'z') || ('A' <= x && x <= 'Z'))
#define isvowel(ch) ((ch=='a'||ch=='e'||ch=='i'||ch=='o'||ch=='u')||(ch=='A'|| ch=='E' || ch=='I'|| ch=='O'|| ch=='U'))
#define bug cout<<"BUG"<<endl;
const int Max = 2e6 + 10;
const int Mod = 1e9 + 7;
const double PI  =3.141592653589793238463;
bool compare(const pair<ll,ll> &a, const pair<ll,ll> &b)
{
       return (a.first > b.first);
}
ll lcm(ll a,ll b)
{
    if(a==0 || b==0)return 0;

    return a/__gcd(a,b)*b;
}

void input(ll ara[],ll n)
{
    for(ll i=0; i<n; i++)cin>>ara[i];
}
void print(ll ara[],ll n)
{
    for(ll i=0; i<n; i++)
        cout<<ara[i]<<" ";
    cout<<endl;
}


ll F(ll n)
{
    ll cnt=0;

    while(n>=1)
    {
        if(n%2==0)n/=2;

        else n=(3*n)+1;

        cnt++;
    }

    return cnt;
}


ll mp[Max];

ll ara[Max];
int main()
{

   fastread();

   ll i,j,n,m,p,a,sum=0,k,t,b,c,d,cnt=0,q,l,r,ans=0;

      bool flag=false;

      string str;



    cin>>a;



  ll s=a;

  mp[s]=1;

    for(i=2; ; i++)
    {
       if(s%2)s=(3*s)+1;

       else s/=2;

        if(mp[s])break;

       mp[s]++;

    }

    cout<<i<<endl;








}



Measured memory_bytes: 3664
n = int(input())
a = list(map(int, input().split()))
a_sorted = sorted(a)
b_sorted = sorted([abs(i) for i in range(-(n - 1), n, 2)])

if a_sorted == b_sorted :
    if n % 2 == 1:
        print((2 ** ((n - 1) // 2)) % (10 ** 9 + 7))
    elif n % 2 == 0 :
        print((2 ** (n // 2)) % (10 ** 9 + 7))
else :
    print(0)

Measured memory_bytes: 14008
import fractions
import numpy
import sys

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

a, b = map(int, input().split())
g = fractions.gcd(a, b)

if g == 1:
    print(1)
    sys.exit()

print(len(factorization(g)) + 1)

Measured memory_bytes: 13664
#include "bits/stdc++.h"
#define ed cout<<"\n";
#define speed ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long int
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define All(obj) (obj).begin(),(obj).end()

using namespace std;


int main() {
	speed;
	int n;
	cin >> n;
	pair<pair<string, int>, int>p[101];
	rep(i, n) {
		int P;
		string s;
		cin >> s >> P;
		p[i] = make_pair(make_pair(s, -P), i);
	}
	sort(p,p+n);
	vector<pair<int,int>>b;
	rep(i, n) {
		cout << p[i].second + 1;
		ed;
	}
	return 0;
}


Measured memory_bytes: 256
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False
"""
def nibu(x,n,r):
    ll = 0
    rr = r
    while True:
        mid = (ll+rr)//2

    if rr == mid:
        return ll
    if (ここに評価入れる):
        rr = mid
    else:
        ll = mid+1
"""

N,K = m()

a = l()


aaa = [0 for i in range(N+1)]
aaa[1] = a[0] % K
for i in range(1,N):
    aaa[i+1] = aaa[i] + a[i]

count = 0
ddd = dict()
ddd[0] = 1
if K == 1:
    print(0)
else:
    for i in range(1,N+1):
        ppp = (aaa[i] - i)%K
        count += ddd.get(ppp,0)
        ddd[ppp] = ddd.get(ppp,0) + 1
        if i - K + 1 >= 0:
            ddd[(aaa[i-K+1] - i + K - 1)%K] -= 1
    print(count)










Measured memory_bytes: 111388
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int INF = 0x3f3f3f;
int a[300][300];
int vis[300];	//标记是否访问过 
int path[300];	//从起点到该点的距离 
int n;
void Dijkstra(int s)
{
	int min,pos;
	
	memset(vis,0,sizeof(vis));
	
	path[s] = 0;
	vis[s]  = 1;
	
	for(int i = 0; i < n; i++)
	{
		path[i] = a[s][i];
	}
	
	for(int i = 1; i < n; i++)
	{
		min = INF;
		for(int j = 0; j < n; j++)
		{
			if( path[j] < min && !vis[j])
			{
				pos = j;
				min = path[j];
			}
		}
		
		vis[pos] = 1;
		
		for(int j = 0;j < n;j++)
		{
			if(path[pos] + a[pos][j] < path[j] && !vis[j])
			{
				path[j] = path[pos] + a[pos][j];
			}
		}
	}
}

int main()
{
	int m;
	while(scanf("%d",&n)!=EOF)
	{
		for(int i=0;i<n;i++)
		{
			for(int j=0;j<n;j++)
			{
				a[i][j] = INF;
			}
			
			a[i][i] = 0;
		}
		
		for(int i = 0;i<n;i++)
		{
			int x,y,k,l;
			scanf("%d%d",&x,&k);
			
			for(int j=0;j<k;j++)
			{
				scanf("%d%d",&y,&l);
				
				if(a[x][y] > l)
				{
					a[x][y] = l;
				//	a[y][x] = l;
				}
			}
		}
			
			
			
		Dijkstra(0);
		
		for(int i=0;i<n;i++)
		{
			printf("%d %d\n",i,path[i]);
		}
				
	}

}



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

using namespace std;

const int N = 2e5 + 5;
vector<int> adj[N];
int in[N] , sz[N] , nxt;

int dfs(int node , int par = -1) {
    in[node] = nxt++;
    sz[node] = 1;
    for (int child : adj[node])
        if (child != par)
            sz[node] += dfs(child  , node);
    return sz[node] ;
}

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

    int n , q;
    cin >> n >> q;

    for (int i = 0 ;i < n - 1 ;i++) {
        int u , v;
        cin >> u >> v;
        adj[u].push_back(v);
        adj[v].push_back(u);
    }

    dfs(1);

    vector<int> ans(n + 1 , 0);
    while (q--) {
        int u , inc;
        cin >> u >> inc;
        ans[in[u]] += inc;
        ans[in[u] + sz[u]] -= inc;
    }

    for (int i = 1 ;i < n ;i++)
        ans[i] += ans[i - 1];

    for (int i = 1 ;i <= n ;i++)
        cout << ans[in[i]] << ' ';
}


Measured memory_bytes: 29040
#include<bits/stdc++.h>
#include<algorithm>
#include<math.h>
#include<string>
#include<iostream>
#include<vector>
#include<cstdlib>
#include<stdio.h>
#include<cmath>
#include<limits>
#include<iomanip>

using namespace std;
 
template <class T> using V = vector<T>;
 
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
 
const long long INF = 1LL << 60;
 
using ll = long long;
using db = long double;
using st = string;
using ch = char;
using bl = bool;
using vll = V<ll>;
using vpll =V<pair<ll,ll>>;
using vst = V<st>;
using vdb = V<db>;
using vch = V<ch>;
using vbl = V<bl>;
using graph = V<V<int>>;
using pq = priority_queue<ll>;


 
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define rFOR(i,a,b) for(ll i=(a);i>=(b);i--)
#define oFOR(i,a,b) for(ll i=(a);i<(b);i+=2)
#define bgn begin()
#define en end()
#define SORT(a) sort((a).bgn,(a).en)
#define REV(a) reverse((a).bgn,(a).en)
#define M(a,b) max(a,b)
#define rM(a,b) min(a,b)
#define fi first
#define se second
#define sz size()
#define gcd(a,b) __gcd(a,b)
#define co(a) cout<<a<<endl;
#define pb(a) push_back(a);
  
 

ll Sum(ll n) {
ll m=0;
  while(n){
    m+=n%10;
    n/=10;
  }
  return m;
}
 
 
const int MAX = 510000;
const int MOD = 1000000007;
 
long long fac[MAX], finv[MAX], inv[MAX];
 
void Comuse() {
    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;
    }
}
 
 
#define comuse Comuse()
 
ll combi(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;
}

ll perm(int n,int k){
    if(n < k) return 0;
    if(n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] % MOD) % MOD;
}
 
 
ll lcm(ll a,ll b){
  ll n;
  n=a/gcd(a,b)*b;
  return n;
}


vll div(ll n){
  vll ret;
  for(ll i=1;i*i<=n;i++){
    if(n%i==0){
      ret.push_back(i);
      if(i*i!=n){
        ret.push_back(n/i);
      }
    }
  }
  SORT(ret);
  return (ret);
}

ll modpow(ll a,ll n,ll mod){
  ll ans=1;
  while(n>0){
    if(n&1){
      ans=ans*a%mod;
    }

    a=a*a%mod;
    
    n>>=1;
  }

  return ans;
}

void Solve();

signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<setprecision(20)<<fixed;
  Solve();
}


/****************************************\
| Thank you for viewing my code:)        |
| Written by RedSpica a.k.a. RanseMirage |
| Twitter:@asakaakasaka                  | 
\****************************************/

void Solve(){
  ll n;
    cin>>n;
  vll A(n);
  ll m=0;
  FOR(i,0,n){
    ll a;
      cin>>a;
    if(i==0&&a!=0){
      cout<<0<<endl;
      return;
    }
    A[a]++;
    chmax(m,a);
  }
  
  if(A[0]!=1){
    cout<<0<<endl;
    return;
  }
  
  ll mod=998244353;
  ll ans=1;
  FOR(i,1,m+1){
    ans*=modpow(A[i-1],A[i],mod);
    ans%=mod;
  }
  cout<<ans<<endl;
}

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

int main() {
	int n,sum1=0,sum2=-1,ans,input;
	cin>>n;
	for(int i=1;i<=n;i++){
		input=i;
		while(input%2==0){
			sum1++;
			input=input/2;
		}
		if(sum1>sum2){
			sum2=sum1;
			ans=i;
			
		}
		sum1=0;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
S = input()

num = len(S) - 2
s_list = []
for i in range(num):
    s = S[i: i + 3]
    s_list.append(int(s))

dif_list = []
for i in range(num):
    dif = abs(s_list[i] - 753)
    dif_list.append(dif)

print(min(dif_list))


Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <algorithm>
using namespace std;

typedef long long int ll;

//const double PI=3.14159265358979323846;

int main () {
    int a, b, c, d; cin >> a >> b >> c >> d;
    while (true) {
        c -= b;
        if (c <= 0){
            cout << "Yes" << endl;
            break;
        }

        a -= d;
        if (a <= 0) {
            cout << "No" << endl;
            break;
        }
    }

    return 0;
}

Measured memory_bytes: 3104
using System;
using System.Linq;
using System.Collections.Generic;

using E = System.Linq.Enumerable;

public class Program
{
    public static void Main()
    {
        var nk = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();
        var n = nk[0];
        var k = nk[1];

        var d = 1;
        while (n >= k)
        {
            ++d;
            n /= k;
        }
        
        Console.WriteLine(d);
    }
}


Measured memory_bytes: 13396
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <ctime>
#include <bitset>
#include <complex>
#include <chrono>
#include <random>
#include <functional>

using namespace std;

signed main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);

	int n, a, b;
	cin >> n >> a >> b;
	cout << min(a, b) << ' ' << max(0, a + b - n) << '\n';
}


Measured memory_bytes: 3160
#include "bits/stdc++.h"
// Custom Header {{{
#define all(x)      x.begin(), x.end()
#define rep(i,n)    for (i64 i = 0; i < (n); ++i)
#define reps(i,s,t) for (i64 i = (s); i <= (t); ++i)
#define repr(i,s,t) for (i64 i = (s); i >= (t); --i)
#define LF          '\n'

#ifdef DBG
#define trace(...) _trace(#__VA_ARGS__, __VA_ARGS__);
#else
#define trace(...)
#endif

using namespace std;
using i64 = int_fast64_t;
using pii = pair<i64, i64>;
template<class T, class U>inline bool chmax(T &a, const U &b){return b>a ? (a=b,1) : 0;}
template<class T, class U>inline bool chmin(T &a, const U &b){return b<a ? (a=b,1) : 0;}
constexpr int INF  = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;

template<class T>
ostream& operator<< (ostream &os, const vector<T> &vec) {
    rep(i, vec.size()) os << vec[i] << (i+1 == vec.size() ? "" : " ");
    return os;
}

template<class T, class U>
ostream& operator<< (ostream &os, const pair<T, U> &p) {
    return os << p.first << ' ' << p.second;
}

template <class T>
void _trace(const char *s, T&& x)
{
    clog << '{';
    while(*s != '\0' && *s != ',') clog << *(s++);
    clog << ":" << setw(3) << x << '}' << endl;
}

template <class Head, class... Tail>
void _trace(const char *s, Head&& head, Tail&&... tail)
{
    clog << '{';
    while(*s != ',') clog << *(s++);
    clog << ":" << setw(3) << head << "}, ";
    for (++s; !isgraph(*s); ++s);
    _trace(s, std::forward<Tail>(tail)...);
}
// }}}

signed main()
{
    // ios::sync_with_stdio(false); cin.tie(nullptr);
    string s;
    cin >> s;

    int w; cin >> w;

    string ans;
    for (int i = 0; i < s.length(); i += w) {
        ans += s[i];
    }

    cout << ans << endl;

    return 0;
}



Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var str string
	fmt.Scan(&str)
	arr := make([]string, 0)
	count := 0
	for _, i := range str {
		s := string(i)
		if len(arr) == 0 {
			arr = append(arr, s)
		} else {
			tail := arr[len(arr) - 1]
			if tail != s {
				arr = arr[:len(arr) - 1]
				count += 2
			} else {
				arr = append(arr, s)
			}
		}
	}
	fmt.Println(count)
}

Measured memory_bytes: 10496
#include<bits/stdc++.h>
#define long long long
using namespace std;
const int N=1e6;
int main()
{
  ios_base::sync_with_stdio(0);cin.tie(0);

  int n;cin>>n;multiset<int>st;
  for(int i=1;i<=n;i++)
  {
    int x;cin>>x;st.insert(x);
  }
  int ans=0;
  while(st.size())
  {
    int x=*st.rbegin();
    st.erase(st.find(x));

    for(int i=30;i>=0;i--)
    {
      int z=(1<<i)-x;
      if(z<0)break;
      if(st.find(z)!=st.end())
      {
        ans++;st.erase(st.find(z));
        break;
      }
    }
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 9600
#include <set>
#include <array>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <queue>
#include <vector>
#include <tuple>
#include <string>
#include <math.h>
#include <time.h>
#include <bitset>
#include <stdio.h>
#include <string.h>
#include <iostream>
#include <algorithm>
#include <limits>
#include <climits>
#include <numeric>

#define lnd '\n'
// #define reverse(i, n) for(ll i = n-1; i >= 0; --i)
#define from(i, n) for (ll i = 0; i < n; ++i)
#define REPN(i, n) for (ll i = 1; i <= n; ++i)
#define ALL(s) (s).begin(), (s).end()
#define rALL(s) (s).rbegin(), (s).rend()
#define sz(s) (int)(s).size()
#define mk make_pair
#define pb push_back
#define sqr(s) ((s) * (s))

using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef unsigned int ui;


void solution();

template <class T>
T GCD (T a, T b) {
  if(a == 0) return b;
  return GCD(b%a, a);
}

template <class T>
T modpow(T x, T p){
    T res = 1;
    while(p > 0){
        if(p&1) res *= x;
        x *= x;
        p /= 2;
    }
    return res;
}

template <class T>
void print(T a[], ll n){
    for (ll i = 0; i < n; i++) std::cout << a[i] << ' ';
    cout << endl;
}

template<class T>
void printc(T c){
    for(auto const& v: c) std::cout << v << ' ';
    cout << endl;
}

struct HASH{
  size_t operator()(const pair<long,long>&x)const{
    return hash<long long>()(((long long)x.first)^(((long long)x.second)<<32));
  }
};

bool pair_sort(const pair<int, int> &p1, const pair<int,int> &p2){
    if(p1.first != p2.first) return p1.first < p2.first;
    else return p1.second < p2.second;
}

const int INF = std::numeric_limits<int>::max();
const ll M_INF = std::numeric_limits<ll>::min();

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    solution();
    return 0;
}



void solution(){
    ll a, b, c;
    cin >> a >> b >> c;
    set<ll> nums;
    nums.insert(a);
    nums.insert(b);
    nums.insert(c);

    if(nums.size() == 2){
        cout << "Yes"  << endl;
    }else{
        cout << "No"  << endl;
    }
}   

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

using namespace std;

typedef long long ll;

bool check(ll a, ll b, ll c, ll d) {
  if (a < b || d < b) {
    return false;
  }
  ll g = __gcd(b, d), t = a % g - g;
  return t < c - b + 1;
}

int main() {
#ifdef wxh010910
  freopen("input.txt", "r", stdin);
#endif
  int T;
  scanf("%d", &T);
  while (T--) {
    ll a, b, c, d;
    scanf("%lld %lld %lld %lld", &a, &b, &c, &d);
    puts(check(a, b, c, d) ? "Yes" : "No");
  }
  return 0;
}


Measured memory_bytes: 764
use std::io;
use std::f32::consts::PI;

fn main() {
    let mut buf = String::new();
    let mut num: u32;
    io::stdin().read_line(&mut buf).expect("Failed to read line");
    num = buf.trim().parse().unwrap();
    num *= 2;
    println!("{}", (num as f32 * PI));
}


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

int main() {
    int n,a,b;
    cin >> n;
    vector<pair<int, int>> data(n);
    for (int i = 0; i < n; i++){
        cin >> a;
        data.at(i) = make_pair(a,i+1);
    }
      sort(data.begin(), data.end());
    for (int i = 0; i < n; i++){
         cout << data.at(i).second << " ";
    } 
    cout << endl;
}

Measured memory_bytes: 1536
// E - Crested Ibis vs Monster
#include <bits/stdc++.h>
using namespace std;
#define rp(i,s,e) for(int i=(s);i<(e);++i)
template<class T>bool chmin(T &a, const T &b){if(b<a){a=b;return 1;}return 0;}
int a, b, dp[10000+1], INF = INT_MAX>>2;
int H,N;

int main(){
	cin>>H>>N;
	rp(i,1,H+1) dp[i] = INF;
	dp[0] = 0;
	rp(i,0,N){
		cin>>a>>b;
		rp(j,1,H+1) chmin(dp[j], dp[max(0,j-a)] + b);
	}
	cout<< dp[H] <<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<map>
using namespace std;
#define REP(i, limit) for(int i=0; i< limit; ++i)
#define LINT long long
struct hashi{
  int a,b;
  bool operator<(const hashi &r)const{
    return b==r.b ? a>r.a : b<r.b;
  }
};

int main(){
  int N, M;
  cin>>N>>M;
  hashi h[M];
  REP(i, M)cin>>h[i].a>>h[i].b;
  sort(h, h+M);
  int ans=0, broken=0; //broken=落とした橋の直左の島の番号
  REP(i, M){
    if(!i || h[i].b != h[i-1].b){
      if(broken<h[i].a){
        ++ans;
        broken = h[i].b-1;
      }
    }
  }
  cout<<ans<<endl;


  return 0;
}


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

int main() {
    ll n,k;
  	cin>>n>>k;
    vector<ll> a(n),b;
  	b.push_back(1);
    for(int i=0; i<n; i++) cin>>a[i];
    vector<bool> c(n,false);
    c[0] = true;
    ll res = 0;
    for(int i=0; i<n; i++) {
        if(c[a[res]-1] == true) {
            b.push_back(a[res]);
            break;
        }
        else {
            c[a[res]-1] = true;
            b.push_back(a[res]);
            res = a[res]-1;
        }
    }
    n = b.size();
    for(int i=0; i<n; i++) {
        if(b[i] == b[n-1]) {
            res = i;
            b.pop_back();
            break;
        }
    }
    n--;
    if(res >= k) cout<<b[k];
    else {
        k -= res;
        k %= n - res;
        cout<<b[k + res];
    }
}

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


/* エイリアス */
#define ll long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vpi vector<pii>
#define vpll vector<pll>
#define endl '\n'

#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define em emplace


/* 関数マクロ */
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define rep2(i, n, m) for (ll i = n; i <= m; ++i)
#define rep3(i, n, m) for (ll i = n; i >= m; --i)
#define all(v) v.begin(), v.end()
#define si(v) int(v.size())
#define UNIQUE(v) sort(all(v)), v.erase(unique(all(v)),v.end())


/* 定数 */
const ll mod = 1e9 + 7;
const ll infll = (1LL << 62) - 1;
const ll inf = (1LL << 30) - 1;


/* その他 */
template<class S, class T> inline bool chmax(S &a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class S, class T> inline bool chmin(S &a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T> using pq = priority_queue<T>;
template<class T> using pqg = priority_queue<T, vector<T>, greater<T>>;



signed main()
{
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cout << fixed << setprecision(15);

  ll n, p; cin >> n >> p;
  ll ans = 1;

  if (n == 1) {
    cout << p << endl;
    return 0;
  }

  rep2(i, 2, sqrt(p)) {
    ll j = i;
    int cnt = 1;
    while (j <= p) {
      j *= i;
      ++cnt;
      if (cnt >= n && p % j == 0) chmax(ans, i);
    }
  }

  cout << ans << endl;
}

Measured memory_bytes: 3664
#include<iostream>
#include<cstring>
#include<cstdio>
#define MN 300
#define mod 1000000007
using namespace std;
inline int read()
{
	int x=0,f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}
int n,m,f[MN+5][MN+5],ans=1e9,ok[MN+5],num[MN+5];
int main()
{
	n=read();m=read();
	for(int i=1;i<=n;++i) for(int j=1;j<=m;++j) f[i][j]=read();
	for(int i=1;i<=m;++i)
	{
		memset(num,0,sizeof(num));
		for(int j=1;j<=n;++j) for(int k=1;k<=m;++k) 
			if(!ok[f[j][k]]) {++num[f[j][k]];break;}
		int mx=0,from=0;
		for(int i=1;i<=m;++i) if(!ok[i]&&num[i]>mx) mx=num[i],from=i;
		ans=min(ans,mx);ok[from]=1;
	}
	printf("%d",ans);
	return 0;
}



Measured memory_bytes: 640