akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main()
{
  string S; cin >> S;
  int n = S.size();
  bool map[26];
  for(char i = 'a'; i <= 'z'; ++i) map[i] = false;
  //集計
  rep(i,n) map[S[i]] = true;
  //結果
  bool check = false;
  char ans = 'z';
  for(char i = 'a'; i <= 'z'; ++i)
  {
    if(map[i] == false)
    {
      if(i <= ans) ans = i; check = true;
    }
  }
  if(check) cout << ans << endl;
  else cout << "None" << endl;
}

Measured memory_bytes: 512
while True:
    try:
        ls=list(map(float,input().split()))
        xok=(ls[0]<=ls[4] and ls[4]<=ls[2])or (ls[0]<=ls[6] and ls[6]<=ls[2])or(ls[4]<=ls[0] and ls[2]<=ls[6])
        yok=(ls[1]<=ls[5] and ls[5]<=ls[3])or (ls[1]<=ls[7] and ls[7]<=ls[3])or(ls[5]<=ls[1] and ls[3]<=ls[7])
        if xok and yok:print('YES')
        else :print('NO')
    except:
        break

Measured memory_bytes: 7396
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <limits>

using namespace std;

//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(); }

//math
//-------------------------------------------
template<class T> inline T sqr(T x) { return x * x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1)
#define SORT(c) sort((c).begin(),(c).end())

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const LL MOD = (LL)1000000007;//10^9+7
const LL INF2 = (LL)100000000000000000;//10^18

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

	int mx = min(a, b);
	int mi = max(b - (n - a),0);

	cout << mx<<" "<<mi << endl;

	return 0;
}

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

int main(){
  int N, l, r, S = 0;
  cin >> N;
  
  for (int i = 0; i < N; i++){
    cin >> l >> r;
  	S += r - l + 1;
  }
  cout << S << endl;
}
  
  
  
  
  
  
    

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

const long long MOD = 1000000007;

int main() {
	long long n, k, result = 0;
	cin >> n >> k;
    long long factorial[n + 1], ifactorial[n + 1], inv[n + 1];
    factorial[0] = 1;
    ifactorial[0] = 1;
    inv[1] = 1;
    factorial[1] = 1;
    ifactorial[1] = 1;
    for (long long i = 2; i <= n; i++) {
        factorial[i] = factorial[i - 1] * i % MOD;
        inv[i] = (-MOD / i + MOD) * inv[MOD % i] % MOD;
        ifactorial[i] = ifactorial[i - 1] * inv[i] % MOD;
    }
    auto C = [&](long long n, long long k)->long long {
    	return factorial[n] * ifactorial[n - k] % MOD * ifactorial[k] % MOD;
    };
	for (long long i = 0; i <= min(n - 1, k); i++) {
		result = (result + C(n, i) * C(n - 1, i) % MOD) % MOD;
	}
	cout << result;
	return 0;
}


Measured memory_bytes: 4992
A, B = map(int,input().split())
F1 = A
F2 = B + 1
if (F1 // 2) % 2 == 0:
  tmp1 = 0
else:
  tmp1 = 1
if F1 % 2 != 0:
  tmp1 ^= A - 1

if (F2 // 2) % 2 == 0:
  tmp2 = 0
else:
  tmp2 = 1
if F2 % 2 != 0:
  tmp2 ^= B
print(tmp1 ^ tmp2)

Measured memory_bytes: 3064
n,k=map(int,input().split())
mod=10**9+7
L=[i for i in range(n+1)]
RS=[0]*(n+1)
for i in range(n):
    RS[i+1]=RS[i]+L[i+1]
r=0
for i in range(k,n+1):
    r+=RS[n]-RS[n-i]-RS[i-1]+1
print((r+1)%mod)

Measured memory_bytes: 27104
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
using ll = long long;
int INF = 1000000009;
int main()
{
    int n;
    cin >> n;
    int sum = 0;
    int mx = 0;
    rep(i, n)
    {
        int a;
        cin >> a;
        mx = max(a,mx);
        sum += a;
    }
    sum -= mx;
    if(sum-mx>0){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <stdlib.h>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>

using namespace std;

long long gcd(long long a, long long b){
	if(a < b) return gcd(b,a);
	long long r;
	while((r = a%b)){
		a = b;
		b = r;
	}
	return b;
}

int main(int argc, char** argv){
	long long a,b,c,d,cd;
	cin >> a >> b >> c >> d;
	a--;
	cd = c / gcd(c,d) * d;
	long long r1,r2;
	r1 = a + a / cd - a / c - a / d;
	r2 = b + b / cd - b / c - b / d;
	cout << r2 - r1 << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

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

        int[] nums = new int[N];
        for (int i = 0; i < N; i++) {
            nums[i] = in.nextInt();
        }

        double sum = 0;
        for (int i = 0; i < N; i++) {
            sum += Math.pow(nums[i], -1);
        }

        System.out.println(Math.pow(sum, -1));
    }
}

Measured memory_bytes: 21844
#include<stdio.h>
int main(){
int n,x=0,max=0,i;
char a[101];
scanf("%d",&n);
scanf("%s",a);
for(i=0;i<n;i++){
if(a[i]=='I')
x++;
else
x--;
if(x>max)
max=x;
}
printf("%d",max);
return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<stdlib.h>
#include<vector>
#include<algorithm>
#include<stdio.h>

using namespace std;

int main(void) {
	int A, B, C;

	cin >> A;
	cin >> B;
	cin >> C;

	if (A == B && B == C)
		printf("Yes\n");
	else
		printf("No\n");



ProgramEndPointLabel:;

	system("pause");

	return 0;
}


Measured memory_bytes: 504
import java.util.*;

import static java.lang.System.*;

public class Main {
    static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        int N = ni();
        long[] A = nlarr(N);

        // 降順でdpする(そうしないと、未変更(ここで変更)のときの値が最大値にならない)
        Arrays.sort(A);

        // 0:未変更 1:未変更(ここで変更) 2: 変更済
        long[][] dp = new long[N][3];
        dp[N - 1][0] = A[N - 1];
        dp[N - 1][1] = 1_000_000_000L;
        dp[N - 1][2] = -1;
        for (int i = N - 2; i >= 0; i--) {
            dp[i][0] = gcd(dp[i + 1][0], A[i]);
            dp[i][1] = dp[i + 1][0];

            if (i + 1 == N - 1) {
                dp[i][2] = A[i];
            } else {
                dp[i][2] = Math.max(gcd(dp[i + 1][2], A[i]), gcd(dp[i + 1][1], A[i]));
            }
        }

        out.println(Math.max(dp[0][2], dp[0][1]));
    }

    //参考: https://www.suzushin7.jp/entry/2016/11/05/calculate-least-common-multiple-in-java/
    //最大公約数 ユークリッドの互除法 O(logN)
    public static long gcd(long m, long n) {
        if (m < n) return gcd(n, m);
        if (n == 0) return m;
        return gcd(n, m % n);
    }

    //最小公倍数lcm ユークリッドの互除法 O(logN)
    public static long lcm(long m, long n) {
        return m * (n / gcd(m, n));  //m*nでlong型のオーバフローを発生させないため、先に割り算から行う
    }

    static int ni() {
        return sc.nextInt();
    }

    static long nl() {
        return sc.nextLong();
    }

    static String ns() {
        return sc.next();
    }

    static int[] niarr(int N) {
        int[] a = new int[N];
        for (int i = 0; i < N; i++) {
            a[i] = sc.nextInt();
        }
        return a;
    }

    static long[] nlarr(int N) {
        long[] a = new long[N];
        for (int i = 0; i < N; i++) {
            a[i] = sc.nextLong();
        }
        return a;
    }
}

Measured memory_bytes: 58716
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
using Int = long long;
bool isPalindrome(string s) {
    string t(s);
    reverse(t.begin(), t.end());
    return s == t;
}
int solve() {
    string s;
    cin >> s;
    string t(s);
    t.erase(remove_if(t.begin(), t.end(), [](char c) { return c == 'x'; }), t.end());
    if (!isPalindrome(t)) return -1;
    vector<int> xNum;
    for (int i = 0, cnt = 0; i <= s.size(); i++) {
        if (i == s.size()) xNum.push_back(cnt);
        else {
            if (s[i] == 'x') cnt++;
            else {
                xNum.push_back(cnt);
                cnt = 0;
            }
        }
    }
    int ans = 0;
    for (int l = 0, r = xNum.size() - 1; l < xNum.size() / 2; l++, r--) {
        ans += max(xNum[l], xNum[r]) - min(xNum[l], xNum[r]);
    }
    return ans;
}
int main() {
    cout << solve() << endl;
}


Measured memory_bytes: 1144
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <fstream>
#include <sstream>
#include <iomanip>
#define ll long long

using namespace std;

long long MOD = 1000000007;

int main(){
    string S,T;
    cin >> S >> T;
    if((int)S.size()!=(int)T.size()-1){
        cout << "No" << endl;
        return 0;
    }
    for(int i=0; i<(int)S.size(); i++){
        if(S[i]!=T[i]){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
}

Measured memory_bytes: 3596
def divisor(n): 
    i = 1
    table = []
    while i * i <= n:
        if n%i == 0:
            table.append(i)
            table.append(n//i)
        i += 1
    table = list(set(table))
    return table

def isPrime(x):
    for i in range(2, int(x**0.5)+1):
        if x % i == 0:
            return False
    return True

a,b=map(int,input().split())
div_a=divisor(a)
div_b=divisor(b)
div_ab=[]
for aa in div_a:
    if aa in div_b:
        div_ab.append(aa)
ans=0
for ab in div_ab:
    if isPrime(ab):
        ans+=1
print(ans)



Measured memory_bytes: 4168
#include <bits/stdc++.h>
#include <cassert>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define ok() puts(ok?"Yes":"No");
#define chmax(x,y) x = max(x,y)
#define chmin(x,y) x = min(x,y)
using namespace std;
using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using ii = pair<int, int>;
using vvi = vector<vi>;
using vii = vector<ii>;
using gt = greater<int>;
using minq = priority_queue<int, vector<int>, gt>;
using P = pair<ll,ll>;
const ll LINF = 1e18L + 1;
const int INF = 1e9 + 1;
//clang++ -std=c++11 -stdlib=libc++ 

int main() {
  // abc74c
  int A,B,C,D,E,F;cin>>A>>B>>C>>D>>E>>F;
  vi water, salt;
  rep(a,F+1) rep(b, F+1) { 
    int w = 100*a*A+100*b*B;
    if (w > F) break;
    water.push_back(w);
  }
  rep(c,F+1) rep(d,F+1) {
    int s = c*C + d*D;
    if (s > F) break;
    salt.push_back(s);
  }
  double maxConc=0.0;
  int ansW=0, ansS=0;
  rep(i, water.size()) {
    rep(j, salt.size()) {
      int w = water[i];
      int s = salt[j];
      if (w+s > F) continue;
      int maxSalt = E*(w/100);
      if (maxSalt < s) continue;
      double c = 100*s/(double) (w+s);
      if (maxConc <= c) {
        ansW=w;
        ansS=s;
        chmax(maxConc, c);
      }
    }
  }
  printf("%d %d\n", ansW+ansS, ansS);
  return 0;
}

Measured memory_bytes: 4296
#include<iostream>

using std::cout;
using std::endl;
using std::cin;

void checkEvenOrOdd(int i, int j) {
    if ((i + j) % 2 == 0) {
            cout << "#";  
    } else {
            cout << ".";  
    }
    
}

void output(int h, int w) {
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            checkEvenOrOdd(i, j); 
        }
        cout << endl;
    }
    cout << endl;
    return;
}

int main(void) {
    int h;
    int w;

    cin >> h >> w;

    while (h != 0 && w != 0) {
        output(h, w);
        cin >> h >> w;
    }

    return 0;
}

Measured memory_bytes: 3112
<?php
  list($k, $s) = explode(" ", trim(fgets(STDIN)));

  $ans = 0;
  for($i=0; $i<=$k; $i++){
    for($j=0; $j<=$k; $j++){
      if($i + $j <= $s && $k >= $s - $i - $j){
        $ans++;
      }
    }
  }

  echo $ans;

Measured memory_bytes: 15840
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE TypeFamilies #-}
import           Data.Maybe
import           Data.Int
import           Data.List
import           Data.Char
-- import qualified Data.Vector.Unboxing as VU
import qualified Data.Vector as V
import qualified Data.Vector.Mutable as VM
import qualified Data.Vector.Unboxed as VU
import qualified Data.Vector.Unboxed.Mutable as VUM
import qualified Data.ByteString.Char8 as BS
import           Data.List (scanl')
import           Data.IORef
import           Control.Monad
import           Control.Monad.ST
import           Control.Monad.State.Strict
import           Control.Applicative
import           Debug.Trace
import           Text.Printf


readInt = BS.readInt . BS.dropWhile isSpace
getVector f = VU.unfoldr f <$> BS.getLine
getIntVector = getVector readInt
getBSVector = getVector BS.uncons
getInt = readLn :: IO Int
getIntTuple = (\vec -> (vec VU.! 0, vec VU.! 1, vec VU.! 2)) <$> getIntVector

main = do
  (n,a,b) <- getIntTuple
  print $ solve n a b

solve n a b = q*a + (min r a)
  where
    ab = a+b
    (q,r) = n `divMod` ab


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

int main(){
    string s, s_r;
    cin >> s;
    int n = s.size();
    reverse_copy(begin(s), end(s), back_inserter(s_r));

    if(s!=s_r){
        cout << "No" << endl;
        return 0;
    }
    if(s.substr(0, (n-1)/2) != s_r.substr(n/2+1, n)){
        cout << "No" << endl;
        return 0;
    }
    if(s.substr(n/2+1,n) != s_r.substr(0, (n-1)/2)){
        cout << "No" << endl;
        return 0;
    }
    cout << "Yes" << endl;
    return 0;

}

Measured memory_bytes: 256
using System;

namespace KitaSoftKoubouEnshuuMondai
{
    class Program
    {
        static void Main(string[] args)
        {
            for (int i = 1; ; i++)
            {
                int n = int.Parse(Console.ReadLine());
                if (n == 0) break;
                Console.WriteLine("Case " + i + ": " + n);
            }
        }
    }
}

Measured memory_bytes: 9372
#include <bits/stdc++.h>
#define pb push_back
#define fs first
#define sc second
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)x.size()
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef vector<pii> vpii;

const int INFTY=1e9;
const int N=20;

char f[N][N];

int main() {
    int i, j, h, w;
    scanf("%d%d", &h, &w);
    for(i=0; i<h; i++) scanf("%s", f[i]);
    i=j=0;
    while(i!=h-1 || j!=w-1) {
        f[i][j]='.';
        if(f[i+1][j]=='#') { i++; continue; }
        if(f[i][j+1]=='#') { j++; continue; }
        printf("Impossible\n");
        return 0;
    }
    f[i][j]='.';
    for(i=0; i<h; i++) for(j=0; j<w; j++) if(f[i][j]=='#') {
        printf("Impossible\n");
        return 0;
    }
    printf("Possible\n");
    return 0;
}

Measured memory_bytes: 256
#define first f
#define second s
#define ll long long
#define mp make_pair
#define pb push_back
#define pf push_front
#define lb lower_bound
#define ub upper_bound
#include <bits/stdc++.h>
#define pii pair<int,int>
#define mem(a,b) memset(a,b,sizeof(a))
using namespace std;
const int maxn=1e5+5;
const int MOD=1e9+7;
const double PI=acos(-1);
const double e=2.718281828459;


int main()
{
    ll n,a,b;
    scanf("%lld%lld%lld",&n,&a,&b);
    ll ans=n/(a+b)*a;
    ans+=min(a,n%(a+b));
    printf("%lld\n",ans);
    return 0;
}


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

#define int long long
#define ci(m)     for(int i=0;i<m;i++)
#define cj(m)     for(int j=0;j<m;j++)
#define ck(m)     for(int k=0;k<m;k++)
#define gcd            __gcd
#define endl           "\n"
#define pb             emplace_back
#define setbits(x)     __builtin_popcountll(x)
#define zrobits(x)     __builtin_ctzll(x)
#define mod            1000000007
#define mod2           998244353
#define maxe           *max_element
#define mine           *min_element
#define inf            1e18
#define deci(x, y)      fixed<<setprecision(y)<<x
#define w(t)           int t; cin>>t; while(t--)
#define nitin          ios_base::sync_with_stdio(false); cin.tie(NULL)
#define PI             3.141592653589793238
using namespace std;

int32_t main() {
    nitin;
    int s;
    cin>>s;
    cout<<0<<" "<<0<<" ";
    cout<<1000000000<<" "<<1<<" ";
    int p=(1000000000-s%1000000000)%1000000000;
    int x=p;
    int y=(s+x)/1000000000;
    cout<<x<<" "<<y;
    return 0;
}

Measured memory_bytes: 3592
s = input().strip()
x = [s[0]]
for i in range(1,len(s)):
    if s[i]=="C" and s[i-1]=="B":
        x.pop()
        x.append("T")
    else:
        x.append(s[i])
cnt = 0
ca = 0
for i in range(len(x)):
    if x[i]=="A":
        ca += 1
    elif x[i]=="T":
        cnt += ca
    elif x[i]=="B" or x[i]=="C":
        ca = 0
print(cnt) 

Measured memory_bytes: 59744
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
//using namespace boost::multiprecision;
typedef long long int ll;
typedef long double ld;
#define MOD 1000000007
#define ALL(obj) (obj).begin(),(obj).end()
template<class T>inline bool chmax(T& a,T b){if (a<b){a=b;return 1;}return 0;}
template<class T>inline bool chmin(T& a,T b){if (a>b){a=b;return 1;}return 0;}
const long long INF = 1LL << 60;
bool pairCompare(const pair<double,ll>& firstElof, const pair<double,ll>& secondElof){
    return firstElof.first < secondElof.first;
}
bool pairCompareSecond(const pair<double,ll>& firstElof, const pair<double,ll>& secondElof){
    return firstElof.second < secondElof.second;
}
//四方向への移動ベクトル
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

struct edge{//グラフに使うヤツ
    ll from,to,cost;
};

typedef vector<vector<edge> > G;
ll gcd(ll a,ll b){
    if (a%b==0)return(b);
    else return(gcd(b,a%b));
}


int main(){
    ll n,h,ans=0;
    cin >> n >> h;
    ll a[n],b[n];

    for (ll i=0;i<n;i++)cin >> a[i] >> b[i];
    sort(a,a+n);
    sort(b,b+n);
    for (ll i=0;i<n and h>0;i++){
        if (a[n-1]>b[n-1-i])break;
        ans++;
        h-=b[n-1-i];
    }
    if (h>0){
        ans+=h/a[n-1];
        if (h%a[n-1])ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 5208
import math
import sys
import itertools
import queue
from fractions import gcd

def lcm(a, b):
    return a * b // gcd(a, b)

def combination(n, r):
    return factorial(n) // (factorial(n - r) * factorial(r))

sys.setrecursionlimit(10000)

mod = 1000000007

"""
# 0埋め, 小数点出力桁指定時のときの出力
a = 100
b = 0.987654321
print("{0:06d}-{1:6f}".format(a,b))
000100-0.987654

# 文字列をリストに格納
char_list = list("abcd") # ["a","b","c","d"]

# 標準入力取得
## 文字列
    = sys.stdin.readline().rstrip()
    = list(sys.stdin.readline().rstrip())

## 数値
    = int(sys.stdin.readline())
    = map(int, sys.stdin.readline().split())
    = list(map(int, sys.stdin.readline().split()))
    = [list(map(int,list(sys.stdin.readline().split()))) for i in range(h)]  # 二次元配列入力　二次元マップみたいな入力のとき
"""

if __name__ == "__main__":
    N = int(sys.stdin.readline())
    L =[ int(sys.stdin.readline()) for _ in range(N)]
    m = max(L)
    print(sum(L) - int(m/2))

Measured memory_bytes: 5200
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
const int inf = 1001001001;
const int mod = 1000000007;
using pint=pair<ll,ll>;
 
// union by size + path having
class UnionFind {
public:
   vector <ll> par; // 各元の親を表す配列
   vector <ll> siz; // 素集合のサイズを表す配列(1 で初期化)
 
   // Constructor
   UnionFind(ll sz_): par(sz_), siz(sz_, 1LL) {
       for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身
   }
   void init(ll sz_) {
       par.resize(sz_);
       siz.assign(sz_, 1LL);  // resize だとなぜか初期化されなかった
       for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身
  }
 
   // Member Function
   // Find
   ll root(ll x) { // 根の検索
      while (par[x] != x) {
           x = par[x] = par[par[x]]; // x の親の親を x の親とする
       }
       return x;
  }
 
   // Union(Unite, Merge)
   bool unite(ll x, ll y) {
       x = root(x);
       y = root(y);
       if (x == y) return false;
       // merge technique（データ構造をマージするテク．小を大にくっつける)
       if (siz[x] < siz[y]) swap(x, y);
       siz[x] += siz[y];
       par[y] = x;
       return true;
  }
 
  bool same(ll x, ll y) { // 連結判定
       return root(x) == root(y);
  }
 
  ll size(ll x) { // 素集合のサイズ
      return siz[root(x)];
  }
};
 
ll modpow(ll x, ll n) {
   x = x%mod;
   if(n==0) return 1;  //再帰の終了条件
 
   else if(n%2==1) {
       return (x*modpow(x, n-1))%mod;  //nが奇数ならnを1ずらす
   }
   else return modpow((x*x)%mod, n/2)%mod;  //nが偶数ならnが半分になる
}
 
ll com(ll n, ll k) {
   ll x = 1;
   for(int i=n-k+1; i<=n; i++) {
      x = x*i%mod;
   }
 
   ll y = 1;
   for(int i=1; i<=k; i++) {
       y = y*i%mod;
   }
   y = modpow(y, mod-2);
 
   return x*y%mod;
}
 
int main(){

    long double n;
    cin >> n;
    for(long double i=1; i<=n; i++){
        if(floor(i*(1.08))==n){
            cout << i << endl;
            return 0;
        }
    }

    cout << ":(" << endl;

    
 
}

Measured memory_bytes: 512
#include<cstdio>
#include<iostream>
#include<algorithm>

using namespace std;

int main(void) {

	int a, b, c;

	cin >> a >> b >> c;

	if (c >= a + b)cout << b + min(a + b + 1, c) << "\n";
	else cout << c + b << "\n";

	return 0;
}

Measured memory_bytes: 256
N,K = map(int, input().split())
D = input().split()

for ans in range(N,N*10+1):
    ch_n = str(ans)
    cnt = 0
    for c in ch_n:
        cnt += 1
        if c in D:
            break
        if cnt == len(ch_n):
            print(ans)
            exit()


Measured memory_bytes: 2940
#include<cstdio>
#include<iostream>
#include<string>
#include<algorithm>
#include<stdio.h>
#include<locale.h>
#include<set>
#include<stack>
#include<queue>
using namespace std;

int s[5];

int ans=-1;
string x;
int flg=0;
void wf(int i,int w ,int z) //i文字目までの部分和w zで＋と－の状況を管理
{
  if(flg==1){return;}
  int g,h;
  //+を挿入した場合の処理
 g=w+s[i]; h=z*10+1; if(i!=4){wf(i+1,g,h);} if(i==4&&g==7){ans=h; flg=1; return;}
  //-を挿入した場合の処理
 g=w-s[i]; h=z*10; if(i!=4){wf(i+1,g,h);} if(i==4&&g==7){ans=h;flg=1; return;}
}
int main()
{
 cin>>x;
 for(int i=1;i<=4;i++)
 {
	s[i]=x[i-1]-'0';
 }
 wf(2,s[1],0);
 //ansを解読する作業
 int dx=100;
 for(int i=1;i<4;i++)
 {
	printf("%d",s[i]);
	if(ans>=dx){printf("+");ans=ans-dx;}
	else {printf("-");}
	dx=dx/10;
 }
 printf("%d=7",s[4]);
}

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

int main(){
  int m[3][3];
  for(int i=0;i<3;i++)
    for(int j=0;j<3;j++)
      cin>>m[i][j];
  
  int n;
  cin>>n;
  for(int i=0;i<n;i++){
   
    int x;
    cin>>x;
    
    for(int i=0;i<3;i++){
      
      for(int j=0;j<3;j++){
       if(m[i][j]==x)
         m[i][j]=-1;
      }
    
    }
  
  }
  
  if((m[0][0]==-1&&m[1][0]==-1&&m[2][0]==-1)||(m[0][1]==-1&&m[1][1]==-1&&m[2][1]==-1)||(m[0][2]==-1&&m[1][2]==-1&&m[2][2]==-1)||(m[0][0]==-1&&m[0][1]==-1&&m[0][2]==-1)||(m[1][0]==-1&&m[1][1]==-1&&m[1][2]==-1)||(m[2][0]==-1&&m[2][1]==-1&&m[2][2]==-1)||(m[0][0]==-1&&m[1][1]==-1&&m[2][2]==-1)||(m[0][2]==-1&&m[1][1]==-1&&m[2][0]==-1))
  cout<<"Yes"<<endl;
  else
  cout<<"No"<<endl;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int h, w;
  string s;
  while(1) {
    h = 0;
    w = 0;
    s = "";
    cin >> h >> w;
    if (h == 0 && w == 0) break;
    for (int i = 0; i < w; i++) {
      s = s + "#";
    }
    for (int j = 0; j < h; j++) {
      cout << s << endl;
    }
    cout << endl;
  }
}


Measured memory_bytes: 3180
#include <iostream>
using namespace std;
int a,b,c,d;
int ac,ab,bc;
int main()
{
	cin>>a>>b>>c>>d;
	if(a-c>=0)
	ac=a-c;
	if(a-c<0)
	ac=c-a;
	if(a-b>=0)
	ab=a-b;
	if(a-b<0)
	ab=b-a;
	if(b-c>=0)
	bc=b-c;
	if(b-c<0)
	bc=c-b;
	if(ac<=d)
	{
	cout<<"Yes";
	return 0;
	}
	if(ab<=d&&bc<=d)
	{
	cout<<"Yes";
	return 0;
	}
	else
	cout<<"No";
	return 0;
}

Measured memory_bytes: 256
/*||>>>> Praveen Ojha <<<<>>>> 10 June 2019 <<<<>>>> 00:55:52 <<<<||*/
// #pragma GCC optimize("Ofast") //(Very Fast but Inaccurate)
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") //(Small operations in many loops)
// #pragma GCC optimize("unroll-loops")
// #pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define F first
#define S second
#define mod 1000000007
#define inf 1e18+5
#define sz(x) (int)x.size()
#define PI 3.141592653589793238510
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define __ ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define vi vector<int>
#define vpii vector<pair<int,int> > 
#define vvi vector<vector<int> >
#define PRINT_TIME cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s." <<endl;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename   enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
typedef long double ld;
typedef pair<int,int> pii;
//Read Problems Carefully & Check for corner cases N=0,1 ?
///////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////

int32_t main(){__
	int a[3];
	for(int i=0;i<3;i++)
		cin>>a[i];
	sort(a,a+3);
	cout<<a[0]+a[1]<<"\n";
return 0;
}

Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#include <algorithm>
#define rep(i,n) for(int i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
using namespace std;
using Graph = vector<vector<int>>;
typedef long long ll;
//using Graph = vector<vector<pair<ll,ll>>>;
const int mod =1e+9+7;

const int dy[4]={0,1,0,-1};
const int dx[4]={1,0,-1,0};
const ll INF=1e10;

int main(){
    ll a,b; cin>>a>>b;
    a--;
    ll numa=(a+1)/2;
    if(a%2==0){
        if(numa%2==0)numa=a^0;
        else numa=a^1;
    }
    else{
          if(numa%2==0)numa=0;
        else numa=1;
    }
    ll numb=(b+1)/2;
    if(b%2==0){
        if(numb%2==0)numb=b^0;
        else numb=b^1;
    }
    else{
          if(numb%2==0)numb=0;
        else numb=1;
    }
    //cout<<numa<<endl;
    //cout<<numb<<endl;
    ll ans=numa^numb;
    cout<<ans<<endl;


}











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

int main()
{
    int n, m;
    cin >> n >> m;
    cout << n * (n - 1) / 2 + m * (m - 1) / 2 << "\n";

    return 0;
}


Measured memory_bytes: 256
/**
  * @brief atcoder
  * @author yao
  */
#include <cstdlib>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <utility>
#include <algorithm>
#include <functional>
#include <climits>
#define ft first
#define sd second
#ifdef DBG
#   define dbg_pri(x...) fprintf(stderr,x)
#else
#   define dbg_pri(x...) 0
#   define NDEBUG
#endif //DBG
#include <cassert>

typedef unsigned int uint;
typedef long long int lli;
typedef unsigned long long int ulli;

int main()
{
    int n;
    scanf("%d", &n);
    lli ans = (lli)n*(n+1)*(n+2)/6;
    for(int i=1;i<n;++i)
    {
        int u, v;
        scanf("%d%d", &u,&v);
        if(v<u) std::swap(u,v);
        ans -= (lli)u*(n-v+1);
    }
    printf("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 1736
#include <bits/stdc++.h>
using namespace std;
int main()
{
  int N;
  string S;
  cin >> N >> S;
  int cntW = 0, cntE = 0;
  for(int i = 1; i < S.size(); ++i)
  {
    if(S.at(i) == 'E')
    {
      ++cntE;
    }
  }
  int ans = cntE;
  for(int i = 1; i < S.size(); ++i)
  {
    if(S.at(i) == 'E')
    {
      --cntE;
    }
    if(S.at(i - 1) == 'W')
    {
      ++cntW;
    }
    ans = min(ans, (cntE + cntW));
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 900
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
template<class T> using vc = vector<T>;
template<class T> using vvc = vector<vector<T>>;

#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repe(i, l, r) for (ll i = (l); i < (r); i++)
#define reper(i, l, r) for (ll i = (r)-1; i >= (l); i--)
#define repa(i,n) for (auto& i: n)

template<class T> inline bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
void init() {cin.tie(0);ios::sync_with_stdio(false);cout << fixed << setprecision(15);}

#ifdef DEBUG
template <class T, class N> void verr(const T& a, const N& n) { rep(i, n) cerr << a[i] << " "; cerr << "\n" << flush; }
ll dbgt = 1; void err() { cerr << "passed " << dbgt++ << "\n" << flush; }
template<class H, class... T> void err(H&& h,T&&... t){ cerr<< h << (sizeof...(t)?" ":"\n") << flush; if(sizeof...(t)>0) err(forward<T>(t)...); }
#endif

const ll INF = 5e18;
const ld EPS = 1e-11;
const ld PI = acos(-1.0L);
// const ll MOD = 1e9 + 7;
const ll MOD = 998244353;
//--------------------------------------------------------------------------------//
ll dp[305][305][305];

int main() {
    init();
    string S;
    ll K;
    cin >> S >> K;

    vl A;
    ll cnt = 0, N = S.size();
    rep(i, N){
        if(S[i]=='0'){
            A.eb(cnt);
            cnt = 0;
        }else{
            cnt++;
        }
    }
    A.eb(cnt);
    ll an = A.size();
    reverse(all(A));

    K = min(accumulate(all(A), 0ll), K);
    dp[0][0][0] = 1;
    rep(i, an){
        rep(j, K+1){
            rep(k, K+1){
                rep(m, A[i] + 1)  if (j + m <= K)(dp[i + 1][j + m][k] += dp[i][j][k]) %= MOD;
                repe(m, 1, K - j + 1) if (k + m <= K)(dp[i + 1][j][k + m] += dp[i][j + m][k]) %= MOD;
            }
        }
    }

    ll ans = 0;
    rep(i, K + 1)(ans += dp[an][0][i]) %= MOD;

    cout << ans << endl;
}

Measured memory_bytes: 58000
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for(int(i) = 0; (i) < (n); (i)++)
#define FOR(i, m, n) for(int(i) = (m); (i) < (n); (i)++)
#define All(v) (v).begin(), (v).end()
#define pb push_back
#define MP(a, b) make_pair((a), (b))
typedef long long ll;
const int INF = 1 << 30;
const ll LINF = 1LL << 60;
const int MOD = 1e9 + 7;

ll dp[410][410];
bool flag[410][410];

ll f(int l, int r, vector<ll> const &a, vector<ll> const &sum) {
    if(flag[l][r])
        return dp[l][r];
    flag[l][r] = 1;
    if(l == r)
        return 0;
    ll res = LINF;
    for(int i = l; i <= r; i++) {
        res = min(res, f(l, i, a, sum) + f(i + 1, r, a, sum));
    }
    return dp[l][r] = res + (sum[r + 1] - sum[l]);
}

int main() {
    int N;
    cin >> N;
    vector<ll> a(N);
    rep(i, N) cin >> a[i];
    vector<ll> sum(N + 1);
    rep(i, N) { sum[i + 1] = sum[i] + a[i]; }
    // dp[l][r]:=区間[l,r]のスライムの合体に必要な最小コスト

    cout << f(0, N - 1, a, sum) << endl;
    return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <bitset>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>

using namespace std;

int main(){
	map<char, bool> cup;
	cup['A'] = true;
	cup['B'] = false;
	cup['C'] = false;

	while(true){
		pair<char, char> input;
		char c;
		cin >> input.first >> c >> input.second;

		if(cin.eof()) break;

		bool f = cup[input.first];
		cup[input.first] = cup[input.second];
		cup[input.second] = f;
	}
	
	for(map<char, bool>::iterator it = cup.begin(); it != cup.end(); it++){
		if(it->second){
			cout << it->first << endl;
			break;
		}
	}

	return 0;
}

Measured memory_bytes: 1168
import java.util.Scanner;
public class Main {
	public static void main(String[] args)throws Exception{
		Scanner stdIn=new Scanner(System.in);
		int N=stdIn.nextInt();
		String S=stdIn.next();
		String ans="";
		for(int i=0;i<S.length();i++){
			int a=S.charAt(i)-'A';
			a+=N;
			if(a>25)
				a-=26;
			ans+=(char)(a+'A');
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 147412
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define rep(i,b) FOR(i,0,b)
#define INF 1e9
#define dump(x) cerr<<#x<<"="<<x<<endl
#define all(a) (a).begin(),(a).end()
typedef pair<int,int> P;
template <class T> void chmin(T & a, T const & b) { if (b < a) a = b; }
template <class T> void chmax(T & a, T const & b) { if (b > a) a = b; }
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
using ll = long long;
const ll mod = LLONG_MAX;

int cnt;
int main(){
  int n;
  cin>>n;
  string s;
  cin>>s;
  rep(i,n){
    if(s[i]=='R')cnt++;
  }
  if(cnt>n/2){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }


}


Measured memory_bytes: 256
#include <iostream>
#include <math.h>
int main()
{
	int x, a[1500], max = 0;

	std::cin >> x;

	for(int i = 1; i <= x; i++)
	{
		if(pow(i, 2) <= x)
		{
			a[i] = pow(i, 2);
		}else{
			a[i] = 0;
		}
		
		for(int j = 3; j <= 100; j++)
		{
			if(pow(i, j) <= x)
			{
				a[i] = pow(i, j);
			}else{
				break;
			}
		}
		//std::cout << i << ":::" << a[i] << std::endl;
	}
	for(int i = 1; i <= x; i++)
	{
		if(max < a[i])
		{
			max = a[i];
		}
	}
	std::cout << max << std::endl;
}

Measured memory_bytes: 256
// AOJ 2834 Dimension travel
// 2018.4.14 bal4u

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define QMAX 500000
typedef struct { int t, s; } QUE;
QUE que[QMAX]; int qsize;

#define PARENT(i) ((i)>>1)
#define LEFT(i)   ((i)<<1)
#define RIGHT(i)  (((i)<<1)+1)

void min_heapify(int i)
{
	int l, r, min;
	QUE qt;

	l = LEFT(i), r = RIGHT(i);
	if (l < qsize && que[l].t < que[i].t) min = l; else min = i;
	if (r < qsize && que[r].t < que[min].t) min = r;
	if (min != i) {
		qt = que[i], que[i] = que[min], que[min] = qt;
		min_heapify(min);
	}
}

void deq()
{
	que[0] = que[--qsize];
	min_heapify(0);
}

void enq(int s, int t)
{
	int i, min;
	QUE qt;

	i = qsize++;
	que[i].s = s, que[i].t = t;
	while (i > 0 && que[min = PARENT(i)].t > que[i].t) {
		qt = que[i], que[i] = que[min], que[min] = qt;
		i = min;
	}
}

// バッファを経ずstdinから数値を得る
//#define getchar_unlocked()  getchar()
int in()
{
	int n = 0, c = getchar_unlocked();
	do n = 10*n + (c & 0xf), c = getchar_unlocked(); while (c >= '0');
	return n;
}

#define INF 0x50505050
int d[100002];
int hi[100002], *to[100002];
int dist[100002];

int dijkstra(int n, int start, int goal)
{
	int i, s, e, t, nt;

	memset(dist, INF, n << 2);
	qsize = 0;
	dist[start] = 0, enq(start, 0);
	while (qsize) {
		s = que[0].s, t = que[0].t, deq();
		if (s == goal) break;
		if (dist[s] < t) continue;
		for (i = 0; i < hi[s]; i++) {
			e = to[s][i], nt = t;
			if (e > s) nt = t + d[e];
			if (dist[e] <= nt) continue;
			dist[e] = nt, enq(e, nt);
		}
	}
	return t;
}

int main()
{
	int N, M, s, t, a, b, i, j;
	int *memo;

	N = in(), M = in(), s = in()-1, t = in()-1;
	if (s >= t) { puts("0"); return 0; }

	for (i = 0; i < N; i++) d[i] = in();
	memo = malloc(M << 3);
	j = 0; for (i = 0; i < M; i++) {
		memo[j++] = a = in()-1, memo[j++] = in()-1;
		hi[a]++;
	}
	for (i = 0; i < N; i++) to[i] = malloc((1+hi[i])<<2);
	for (i = 0; i < N; i++) hi[i] = 1, to[i][0] = i-1;
	j = 0; for (i = 0; i < M; i++) {
		a = memo[j++], b = memo[j++];
		to[a][hi[a]++] = b;
	}
	printf("%d\n", dijkstra(N, s, t));
	return 0;
}



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

using VS = vector<string>;    using LL = long long;
using VI = vector<int>;       using VVI = vector<VI>;
using PII = pair<int, int>;   using PLL = pair<LL, LL>;
using VL = vector<LL>;        using VVL = vector<VL>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
//#pragma GCC optimize ("-O3") 
#ifdef YANG33
#include "mydebug.hpp"
#else
#define DD(x) 
#endif
const int INF = 1e9;                          const LL LINF = 1e16;
const LL MOD = 1000000007;                    const double PI = acos(-1.0);
int DX[8] = { 0, 0, 1, -1, 1, 1, -1, -1 };    int DY[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };

/* -----  __MAKE_TIME__  Problem: __PROBLEM__ / Link: __CONTEST_URL__  ----- */
/* ------問題------



-----問題ここまで----- */
/* -----解説等-----



----解説ここまで---- */



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

	LL N, K; cin >> N >> K;
	VI no(10, 0);
	FOR(i, 0, K) {
		int a; cin >> a;
		no[a] = 1;
	}

	int ans = INF;
	FOR(i, N, 100001) {
		string s = to_string(i);
		int ok = 1;
		FOR(j, 0, SZ(s)) {
			if (no[s[j]-'0'])ok = 0;
		}
		if (ok) {
			ans = i;
			break;
		}
	}
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
<?php
list($n, $k) = ints();
for ($i = 0; $i < $n; ++$i) list($a[], $b[]) = ints();
array_multisort($a, SORT_ASC, $b);
$i = 0;
while ($k > 0) {
    $ans = $a[$i];
    $k -= $b[$i];
    $i++;
}
echo $ans;
function ints()
{
    return array_map('intval', explode(' ', trim(fgets(STDIN))));
}


Measured memory_bytes: 22132
//Apparat : drobucs, aleonov, vit_72
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <iomanip>
#include <algorithm>
#include <string>
#include <queue>
#include <numeric>
#include <stack>

//#pragma warning(disable : 4996)
//#pragma GCC optimize("O3")

using namespace std;

#define nptr nullptr
#define all(x) (x).begin(), (x).end()
#define drobucs ios_base::sync_with_stdio(0);cout.tie(0);cin.tie(0);
#define ff first
#define ss second
#define pb push_back
#define sz(x) (int)(x).size()

typedef  long long ll;

const int maxn = (int)1e6 + 13;
const ll INFL = 9223372036854775807;
const ll INF = 2147483647;
const ll MOD = (int)1e9 + 7, MOD2 = 998244353;//1e9 + 21, 1e9 + 33, 1e9 + 87, 1e9 + 93
const ll base = 101, base2 = 37;

ll c[20];
ll a[20][20];
ll test[20];
int main() {
	drobucs;
	
	ll n, m, x;
	cin >> n >> m >> x;
	for (int i = 1; i <= n; ++i) {
		cin >> c[i];
		for (int j = 1; j <= m; ++j)
			cin >> a[i][j];
	}
	ll ans = INF;
	for (int i = 0; i < (1 << n); ++i) {
		ll sum = 0;
		for (int j = 1; j <= m; ++j)test[j] = 0;
		for (int j = 0; j < n; ++j) {
			if (1 & (i >> j)) {
				sum += c[j + 1];
				for (int k = 1; k <= m; ++k)test[k] += a[j + 1][k];
			}
		}
		bool f = 1;
		for (int j = 1; j <= m; ++j)if (test[j] < x)f = 0;
		if (f)ans = min(ans, sum);
	}
	if (ans != INF)cout << ans << "\n";
	else cout << "-1\n";
	return 0;
}

Measured memory_bytes: 3668
PROGRAM AlterAltar
      IMPLICIT NONE
      INTEGER,PARAMETER :: p = 8
      integer(p) :: n, l,r, ans
      character(:),allocatable ::c 
      
      
      read*,n
      allocate( character(n) :: c )
      read*,c
      
      
      ans = 0
      l = 1
      r = n
      outer:&
      do while(.true.)
        do while( .true. )
          if( c(r:r)=='R' )then
            exit
          elseif( l>=r )then
            exit outer
          else
            r = r - 1
          end if
        end do
        
        do while( .true. )
          if( c(l:l)=='W' )then
            ans = ans + 1
            r = r - 1
            l = l + 1
            exit
          elseif( l>=r )then
            exit outer
          else
            l = l + 1
          end if
        end do
      !  print*,l,r
      end do outer
      
      
      print*,ans
      
      
      stop
      !debugg
      print*,'debugg'
      print*,n
      print*,c

      END PROGRAM

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

int main(){
	// int num = 1;
	// while(true){
	// 	int x; cin >> x;
	// 	if(x == 0)
	// 		break;
	// 	cout << num << " " << x << endl;
	// 	num++;
	// }

	for(int num=1; ; num++){
		int x; cin >> x;
		if(x == 0)
			break;
		cout << "Case " << num << ": " << x << endl;
	}

	return 0;
}



Measured memory_bytes: 3052
#include <cstdio>
#include <vector>
#include <algorithm>
#include <cstring>
#include <string>
#include <cctype>
#include <sstream>
#include <cmath>
#include <climits>
#include <set>
#include <iostream>
#include <map>
#include <functional>
#include <cstdlib>
#include <numeric>
#include <queue>
#include <complex>
#include <sstream>
#include <stack>

using namespace std;

#define reep(i, f, n) for (int i = f; i < n; ++i)
#define rep(i, n) reep(i, 0, n)


int main(){
    float x1,x2,x3,y1,y2,y3,gx,gy,G,Xc,Yc,r;
    int n;
    scanf("%d", &n);
    for (int i=0;i<n;i++) {
        scanf("%f %f %f %f %f %f", &x1, &y1, &x2, &y2, &x3, &y3);
        gx = (x1+x2+x3)/3;
        gy = (y1+y2+y3)/3;
        G = ( y2*x1-y1*x2 +y3*x2-y2*x3 +y1*x3-y3*x1 );
        Xc = ((x1*x1+y1*y1)*(y2-y3)+(x2*x2+y2*y2)*(y3-y1)+(x3*x3+y3*y3)*(y1-y2))/(2*G);
        Yc = -((x1*x1+y1*y1)*(x2-x3)+(x2*x2+y2*y2)*(x3-x1)+(x3*x3+y3*y3)*(x1-x2))/(2*G);
        r = hypot(x1-Xc, y1-Yc);
        printf("%.3f %.3f %.3f\n", Xc, Yc, r);
    }
}


Measured memory_bytes: 3252
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, a, b) for (int i = a; i < b; i++)
#define each(i, mp) for(auto& i:mp)

const int INF = 1001001001;

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

  ll ans = n*p;
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3596
#include <bits/stdc++.h>
#include <boost/foreach.hpp>
using namespace std;
#define pi 2*asin(1.0)
#define MAX 10000000
#define MOD 1000000007
#define _GLIBCXX_DEBUG
 
vector<long> fac(MAX);
vector<long> finv(MAX);
vector<long> inv(MAX);
vector<long> Primelist;
//template functions
/////////////////////////
void Prinit(){
long PR=10000001;
vector<long> P(PR,0);
for(long i=2;i*i<PR;i++){
    if(P.at(i)==0){
        long j=i;
      j+=i;
        while(j<PR){
            P.at(j)=1;
             j+=i;         
        }
    }
}

for(long i=2;i*i<PR;i++){//Primelist.size()=446
    if(P.at(i)==0){
        Primelist.push_back(i);
    }
}
}

void Cominit(){
  fac.at(0)=fac.at(1)=1;
  finv.at(0)=finv.at(1)=1;
  inv.at(1)=1;
  for(long i=2;i<MAX;i++){
      fac.at(i)=(fac.at(i-1)*i)%MOD;
      inv.at(i)=MOD-inv.at(MOD%i)*(MOD/i)%MOD;
      finv.at(i)=finv.at(i-1)*inv.at(i)%MOD;
  }
}

long facComb(long N,long M){// nCm%
if(N<M) return 0;
if(N<0||M<0) return 0;
return fac.at(N)*(finv.at(M)*finv.at(N-M)%MOD)%MOD;
}

long Comb(long N,long M){// nCm
long ans=1;
for(long i=N;i>N-M;i--){
    ans=ans*i;
}
for(long i=M;i>0;i--){
    ans=ans/i;
}
return ans;
}

long Perm(long N,long M){// nPm
long ans=1;
for(long i=N;i>N-M;i--){
    ans=ans*i;
}
return ans;
}

long GCM(long A,long B){
            long W,r;
    if(A<B){

        W=B;
        B=A;
        A=W;
    }
    while(A%B!=0){
        r=A%B;
        A=B;
        B=r;
    }
    return B;
}
long LCM(long A,long B){
    return (A*B)/GCM(A,B);
}

long upDiv(long a,long b){
  return (a+b-1)/b;
}

long strtolong(string str){
istringstream ss;
ss=istringstream(str);
long num;
ss>>num;
return num;
}

long chartolong(char ch){
long num;
num=ch-'0';
return num;
}

string longtostr(long N){
    string str;
    str=to_string(N);
    return str;
}









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


//Answer


int main() {
Prinit();
long A,B;
cin>>A>>B;
if(A<2*B){
    cout<<0<<endl;
}else{
    cout<<A-2*B<<endl;
}

}




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

using namespace std;

typedef long long int ll;
typedef long double ld;
typedef string str;
typedef vector<char> vc;
typedef vector<ld> vd;
typedef vector<str> vs;
typedef vector<ll> vll;

const ld PI = acos(-1.0);
const ll MAX = 9000000000000000000;
const ll MIN = -9000000000000000000;

#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define fin(ans) cout << (ans) << endl;
#define all(a) a.begin(), a.end()

template <typename T>
T Sum(vector<T> n, ll a = 0, ll b = 0)
{
  if (b == 0)
  {
    return (accumulate(n.begin() + a, n.end(), 0));
  }
  else
  {
    return (accumulate(n.begin() + a, n.begin() + b, 0));
  }
}
template <>
ld Sum(vector<ld> n, ll a, ll b)
{
  if (b == 0)
  {
    return (accumulate(n.begin() + a, n.end(), 0));
  }
  else
  {
    return (accumulate(n.begin() + a, n.begin() + b, 0));
  }
}

template <typename T>
void Sort(T &n, ll a = 0, ll b = 0)
{
  if (b == 0)
  {
    return (sort(n.begin() + a, n.end()));
  }
  else
  {
    return (sort(n.begin() + a, n.begin() + b));
  }
}

template <typename T>
void Reve(T &n, ll a = 0, ll b = 0)
{
  if (b == 0)
  {
    return (reverse(n.begin() + a, n.end()));
  }
  else
  {
    return (reverse(n.begin() + a, n.begin() + b));
  }
}

template <typename T>
void V(T &n)
{
  for (ll i = 0; i < n.size(); i++)
  {
    cin >> n[i];
  }
}

template <typename T, typename U>
void V2(T &n, U &m)
{
  for (ll i = 0; i < n.size(); i++)
  {
    cin >> n[i] >> m[i];
  }
}

template <typename T, typename U, typename W>
void V3(T &n, U &m, W &p)
{
  for (ll i = 0; i < n.size(); i++)
  {
    cin >> n[i] >> m[i] >> p[i];
  }
}

void fYn(bool a)
{
  if (a)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  exit(0);
}
//最大公約数
ll gcd(ll a, ll b)
{
  return b ? gcd(b, a % b) : a;
}
//最小公倍数
ll lcm(ll a, ll b)
{
  return a * b / gcd(a, b);
}
//複数個の最小公倍数
ll nlcm(vector<ll> numbers)
{
  ll res;
  res = numbers[0];
  for (ll i = 1; i < numbers.size(); i++)
  {
    res = lcm(res, numbers[i]);
  }
  return res;
}
//累乗(xのn乗%mod)
ll mod_pow(ll x, ll n, ll mod = MAX)
{
  ll res = 1;
  while (n > 0)
  {
    if (n & 1)
      res = res * x % mod;
    x = x * x % mod;
    n >>= 1;
  }
  return res;
}

//大文字->小文字(+32)
//少数はなるべく整数に

void Main()
{
  str s, t; cin >> s >> t;
  ll flag = 0;
  rep(i, 3) if(s[i] == t[i]) flag++;
  fin(flag)
}

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(20);
  Main();
  return 0;
}

Measured memory_bytes: 256
import Control.Applicative

main :: IO ()
main = do
  xs <- (map read . words) <$> getLine
  putStrLn $ solve xs

solve :: [Int] -> String
solve xs
  | 0 <= (x - r) && (x + r) <= w && 0 <= (y - r) && (y + r) <= h = "Yes"
  | otherwise = "No"
  where
    w = xs !! 0
    h = xs !! 1
    x = xs !! 2
    y = xs !! 3
    r = xs !! 4
    

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

class UnionFind {
  vector<int> parent;

public:
  UnionFind(int n) : parent(n, -1) {}

  int root(int n) {
    return parent.at(n) < 0 ? n : parent.at(n) = root(parent.at(n));
  }

  int size(int n) {
    return -1 * parent.at(root(n));
  }

  bool same(int a, int b) {
    return root(a) == root(b);
  }

  void unite(int a, int b) {
    if (!same(a, b)) {
      if (size(a) < size(b)) swap(a, b);
      int ra = root(a);
      int rb = root(b);
      parent.at(ra) += parent.at(rb);
      parent.at(rb) = ra;
    }
  }
};

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

  UnionFind uf(n);

  for (int i = 0; i < q; i++) {
    int t, u, v;
    cin >> t >> u >> v;
    if (t == 0) {
      uf.unite(u, v);
    } else {
      cout << (uf.same(u, v) ? 1 : 0) << endl;
    }
  }
}


Measured memory_bytes: 3824