akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
#include<vector>
#include<deque>

#define REP(i,a,b) for(int i = (a); i < b; ++i)
#define inf 1e9+10
#define MOD 1000000007

using ll = long long;
using namespace std;

int main() {
	int h, w, sh, sw, gh, gw;
	int dx[4] = { 0,1,0,-1 };
	int dy[4] = { 1,0,-1,0 };
	cin >> h >> w >> sh >> sw >> gh >> gw;
	--sh, --sw, --gh, --gw;

	vector<string> s(h);

	REP(i, 0, h) cin >> s[i];

	vector<vector<int>> warp(h, vector<int>(w, inf));
	deque<pair<int, int>> q;

	warp[sh][sw] = 0;
	q.push_back({ sh,sw });
	while (!q.empty()) {
		int x = q.front().first, y = q.front().second;
		q.pop_front();

		// normal move
		REP(i, 0, 4) {
				int nx = x + dx[i], ny = y + dy[i];
				if (nx < 0 || ny < 0 || nx >= h || ny >= w) continue;
				if (s[nx][ny] == '#') continue;
				if (warp[nx][ny] > warp[x][y]) {
					warp[nx][ny] = warp[x][y];
					q.push_front({ nx,ny });
				}
		}

		// warp move
		REP(i, -2, 3) {
			REP(j, -2, 3) {
				int nx = x + i, ny = y + j;
				if (nx < 0 || ny < 0 || nx >= h || ny >= w) continue;
				if (s[nx][ny] == '#') continue;
				if(warp[nx][ny] > warp[x][y] +1){
					warp[nx][ny] = warp[x][y] + 1;
					q.push_back({ nx,ny });
				}
			}
		}
	}

	if (warp[gh][gw] == inf) {
		cout << "-1";
	}
	else {
		cout << warp[gh][gw];
	}

	return 0;
}


Measured memory_bytes: 9396
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
void fastIO(){
  ios_base::sync_with_stdio(0); cin.tie(0);
}


int main(){
  fastIO();
  int n,k,q;
  cin>>n>>k>>q;
  vector<int>x(n,k);
  for(int i=0;i<q;i++){
    int y;
    cin>>y;
    y--;
    x[y]++;
  }
  for(int i=0;i<n;i++){
    if(x[i]-q<=0){
      cout<<"No"<<endl;
    }else{
      cout<<"Yes"<<endl;
    }
  }
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define se second
#define fi first
#define ll long long
#define ld long double
#define pll pair<ll ,ll >
#define plll pair<ll,pll>
#define ppll pair<pll, pll>
#define pii pair<int, int> 
#define pb push_back
const ll inf = 2e18 + 7;
const ll mod = 1e9 + 7;
const ll N = 1e6 + 7;
const ld pi = 3.14159265358979;

void solve() {
    ll a;
    ld b;
    cin>>a>>b;
    setprecision(20);
    ld ans=(a*b*1.0);
    ll x=(ll)ans;
    cout<<x;
}
int main(void){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int t;
    t=1;
    // cin>>t;
    while(t--) {
        solve();
        // cout<<"\n";
    }
    return 0; 

}


Measured memory_bytes: 3764
def solve() :
  ar = raw_input().split()
  N = int(ar[0])
  A = int(ar[1])
  B = int(ar[2])

  if(A > B) : return 0
  if(N == 1 and A != B): return 0

  mn = A * (N-1) + B
  mx = A + B * (N-1)
  count = mx - mn + 1

  return count

if __name__ == '__main__' :
  print solve()

Measured memory_bytes: 2568
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = a; i < b; i++)
#define Rep(i, a, b) for(int i = a; i <= b; i++)
#define repr(i, a, b) for(int i = a; i >= b; i--)
#define _GLIBCXX_DEBUG
#define Vl vector<ll>
#define Vs vector<string>
#define Vp vector<pair<ll, ll>>
#define P pair<ll, ll>
using ll = long long;
#define ALL(v) (v).begin(),(v).end()
#define endl "\n"
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define co(x) cout << x << endl
#define coel cout << endl
#define pb push_back
#define sz(v) ((ll)(v).size())
using namespace std;  
const double pi = acos(-1.0);
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;
#define pp pair<ll, pair<ll, ll>> 
#define fi first
#define se second

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

ll v = 1000000000000000000;

int main() {
    ll n; cin >> n;
    Vl a(n);
    rep(i, 0, n){ 
        cin >> a[i];
    }
    rep(i, 0, n){
        if(a[i]==0){
            co(0);
            return 0;
        }
    }
    ll cnt = 0;
    rep(i, 0, n){
        if(a[i]>1000000000) cnt++;
    }
    if(cnt >= 2){
        co(-1);
        return 0;
    }
    ll seki = a[0];
    rep(i, 1, n){
        seki *= a[i];
        if(seki > v){
            co(-1);
            return 0;
        }
    }
    co(seki);

    return 0;
}


Measured memory_bytes: 3976
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define show(x)  cerr << #x << " = " << (x) << endl;
using namespace std;

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

class In{
	public:
		template<typename T> static T in(){
			T res;
			cin >> res;
			return res;
		}
		template<typename T> static vector<T> in(int n){
			vector<T> res(n);
			rep(i,n) cin >> res[i];
			return res;
		}
};

void solve(vector<int> a){
	cout << (a[0] - a[1]) - (a[0] - a[1]) / a[2] * a[2] << endl;
}

int main(){
	solve(In::in<int>(3));
}


Measured memory_bytes: 256
s=str(input())
l=len(s)
ans=0
conb=[]
for i in range(2**(l-1)):
    no=i
    x=[]
    for j in range(l-1):
        tar=no%2
        if tar==1:
            x.append(j)
        no=no//2
    conb.append(x)
def tasu(s,p):
    kosuu=len(p)
    count=0
    now=0
    for k in range(kosuu):
        count+=int(s[now:p[k]+1])
        now=p[k]+1
    return count
for k in range(len(conb)):
    p=conb[k]
    p.append(l)
    ans+=tasu(s,p)
print(ans)

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


int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  string s;
  cin >> s;
  bool A = false;
  bool B = false;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == 'A') A = true;
    if (s[i] == 'B') B = true;
    if (A && B) {
      cout << "Yes\n";
      return 0;
    }
  }
  cout << "No\n";
  return 0;
}

Measured memory_bytes: 256
import java.io.*;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        MyScanner sc = new MyScanner();


        int n = sc.nextInt();
        double a = n % 2 == 0 ? n / 2.0 : (n+1) / 2.0;

        System.out.println(a / n);
    }

    static class MyScanner {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in), 1 << 15);
        StringTokenizer tokenizer;

        String next() {
            try {
                while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                    tokenizer = new StringTokenizer(reader.readLine());
                }
            } catch (IOException ignored) {
            }
            return tokenizer.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }
    }
}

Measured memory_bytes: 23124
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=1000000007,MAX=200003;
const ll INF=1LL<<62;

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int N;cin>>N;
    map<string,int> MA;
    int ma=0;
    
    for(int i=0;i<N;i++){
        string S;cin>>S;
        MA[S]++;
        ma=max(ma,MA[S]);
    }
    
    for(auto it=MA.begin();it!=MA.end();it++){
        if((*it).second==ma){
            cout<<(*it).first<<endl;
        }
    }
    
}



Measured memory_bytes: 23808
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        a: i64,
        b: i64,
    }

    let ans = if a >= 13 {
        b
    } else if a >= 6 {
        b / 2
    } else {
        0
    };

    println!("{}", ans);
}


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

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

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

Measured memory_bytes: 3632
-- {-# LANGUAGE BangPatterns #-}
-- {-# LANGUAGE ScopedTypeVariables #-}
-- {-# LANGUAGE FlexibleContexts #-}
-- {-# LANGUAGE ViewPatterns #-}
-- {-# LANGUAGE OverloadedStrings #-}

import qualified Data.Vector as V
import qualified Data.Vector.Unboxed as VU
import qualified Data.Vector.Unboxed.Mutable as VUM
-- import qualified Data.Vector.Algorithms.Merge as VAM
-- import qualified Data.Heap as HP
import qualified Data.ByteString.Char8 as BC
import qualified Data.Map as MP
import qualified Data.Set as ST
import qualified Data.Sequence as SQ
import Data.Array
import Data.Array.Unboxed
import Data.Array.ST
import Data.Array.IO
import Data.Maybe
import Data.Ratio
import Data.Char
import Data.Bits
import Data.List
import Data.Tuple
import Data.Functor
import Data.IORef
import Data.STRef
import Control.Applicative
import Control.Monad
import Control.Monad.ST
import Debug.Trace

--------------------------------------------------------------------------
solve x
    | (cnt * 5) < rest = 0
    | otherwise = 1
    where
        (cnt,rest) = divMod x 100

main = do
    x <- int
    print $ solve x
--------------------------------------------------------------------------

-- Input Util
int :: IO Int
int = readLn 

double :: IO Double
double = readLn 

str :: IO String
str = getLine

strBC :: IO BC.ByteString
strBC = BC.getLine

sLineToIntL :: IO [Int]
sLineToIntL = getLine >>= return . map read . words

sLineToDoubleL :: IO [Double]
sLineToDoubleL = getLine >>= return . map read . words

sLineToIntV :: Int -> IO (VU.Vector Int)
sLineToIntV n = BC.getLine >>= return . VU.unfoldrN n (BC.readInt . BC.dropWhile isSpace)

sLineToDoubleV :: Int -> IO (VU.Vector Double)
sLineToDoubleV n = BC.getLine >>= return . VU.fromList . map (read . BC.unpack) . BC.words

mLinesToIntL :: Int -> IO [Int]
mLinesToIntL n = replicateM n readLn

mLinesToDoubleL :: Int -> IO [Double]
mLinesToDoubleL n = replicateM n readLn

mLinesToIntV :: Int -> IO (VU.Vector Int)
mLinesToIntV n = VU.replicateM n readLn

mLinesToDoubleV :: Int -> IO (VU.Vector Double)
mLinesToDoubleV n = VU.replicateM n (BC.getLine >>= return . read . BC.unpack)

mLinesToTupleL :: Int -> IO [(Int, Int)]
mLinesToTupleL n = replicateM n (getLine >>= return . (\[a,b] -> (a,b)) . map read . words)

mLinesToTupleV :: Int -> IO (VU.Vector (Int, Int))
mLinesToTupleV n = VU.replicateM n $ do
    bs <- strBC
    let
        Just (a, bs') = BC.readInt $ BC.dropWhile isSpace bs
        Just (b, _) = BC.readInt $ BC.dropWhile isSpace bs'
    return (a,b)
    
mLinesToTripleV :: Int -> IO (VU.Vector (Int, Int, Int))
mLinesToTripleV n = VU.replicateM n $ do
    bs <- strBC
    let
        Just (a, bs') = BC.readInt $ BC.dropWhile isSpace bs
        Just (b, bs'') = BC.readInt $ BC.dropWhile isSpace bs'
        Just (c, _) = BC.readInt $ BC.dropWhile isSpace bs''
    return (a,b,c)

-- others
strToChr :: String -> Char
strToChr [x] = x

chrToStr :: Char -> String
chrToStr x = [x]

m1 :: Int -> Int
m1 x = subtract 1 x

toDouble :: Int -> Double
toDouble x = fromIntegral x

toInt :: Double -> Int
toInt x = floor x

Measured memory_bytes: 508
#include<bits/stdc++.h>
#include <cstdio>
using namespace std;
#define ll  long long
#define PB push_back
#define ld long double
#define ff first
#define ss second
# define st(v) (v).begin(),(v).end()
#define   pr pair<int,int>
using namespace std::chrono;
const int N = 1e5+4 , M=N,inf=(int)1e9;
const ll mod=1e9+7;
int fastAbs(int n) { return (n ^ (n >> 31)) - (n >> 31); }
ll multiply(ll a, ll b){ return ((a % mod) * (b % mod)) % mod; }
ll add(ll a, ll b) {     return ((a % mod) + (b % mod)) % mod; }
ll sub(ll a, ll b) { return ((a%mod) - (b % mod)+ mod) % mod ; }
int ans ;
map< pair<int,int> , int > mp;
const int dx[4] = {1,0,0,-1};
const int dy[4] = {0,-1,1,0};
void solve(){
    int n ;
    cin >> n ;
    string s;
    cin >> s;
    int k ;
    cin >> k ;
    k--;
    char c = s[k];
    for( int i = 0 ; i < n ; i++){
        if(s[i]!=c){
            cout <<"*";
        }
        else cout << s[k];
    }
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int q=1;
   // cin >> q;
    while(q--)
        solve();
}


Measured memory_bytes: 256
#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 <iomanip>
#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 main() {
  int N;
  cin >> N;
  vector<ll> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  vector<ll> acc(N + 1);
  for (int i = 0; i < N; i++) {
    acc[i + 1] = acc[i] + A[i];
  }

  ll ans = 1LL << 62;
  for(int j = 1; j < N - 2; j++) {
    int i1 = lower_bound(acc.begin(), acc.begin() + j + 1, acc[j + 1] / 2) - acc.begin() - 1;
    int i2 = i1 - 1;

    ll ss = acc[N] - acc[j + 1];
    int k1 = lower_bound(acc.begin() + j + 1, acc.end(), ss / 2 + acc[j + 1]) - acc.begin() - 1;
    int k2 = k1 - 1;
    
    vector<int> I, K;
    I.push_back(i1);
    K.push_back(k1);

    if (i2 >= 0) {
      I.push_back(i2);
    }

    if (k2 > j) {
      K.push_back(k2);
    }
    
    for(int u = 0; u < I.size(); u++) {
      for(int v = 0; v < K.size(); v++) {
        int i = I[u];
        int k = K[v];

        vector<ll> area;
        ll areaB = acc[i + 1];
        ll areaC = acc[j + 1] - acc[i + 1];
        ll areaD = acc[k + 1] - acc[j + 1];
        ll areaE = acc[N] - acc[k + 1];

        area.push_back(areaB);
        area.push_back(areaC);
        area.push_back(areaD);
        area.push_back(areaE);

        sort(area.begin(), area.end());
        ans = min(ans, area.back() - area[0]);
      }
    }

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

Measured memory_bytes: 3328
# -*- coding: utf-8 -*-
import sys
from operator import itemgetter
# gcd
from fractions import gcd
# 切り上げ，切り捨て
from math import ceil, floor
# リストの真のコピー（変更が伝播しない）
from copy import deepcopy
# 累積和。list(accumulate(A))としてAの累積和
from itertools import accumulate
# l = ['a', 'b', 'b', 'c', 'b', 'a', 'c', 'c', 'b', 'c', 'b', 'a']
# S = Counter(l)  # カウンタークラスが作られる。S=Counter({'b': 5, 'c': 4, 'a': 3})
# print(S.most_common(2))  # [('b', 5), ('c', 4)]
# print(S.keys())  # dict_keys(['a', 'b', 'c'])
# print(S.values())  # dict_values([3, 5, 4])
# print(S.items())  # dict_items([('a', 3), ('b', 5), ('c', 4)])
from collections import Counter
import math
from functools import reduce
sys.setrecursionlimit(200000)
# input関係の定義
input = sys.stdin.readline
def ii(): return int(input())
def mi(): return map(int, input().rstrip().split())
def lmi(): return list(map(int, input().rstrip().split()))
def li(): return list(input().rstrip())
def debug(x): print("debug: ", x, file=sys.stderr)
# template


# fin = open('in_1.txt', 'r')
# sys.stdin = fin
# # local only

MOD = 2019  # type: int


def solve(L: int, R: int):
    if R > L + 2040:
        R = L + 2040
    ans = 10**9
    for i in range(L, R+1):
        for j in range(i+1, R + 1):
            ans = min(ans, i * j % 2019)
    print(ans)


def iterate_tokens():
    for line in sys.stdin:
        for word in line.split():
            yield word


def main():
    tokens = iterate_tokens()
    L = int(next(tokens))  # type: int
    R = int(next(tokens))  # type: int
    solve(L, R)


if __name__ == '__main__':
    main()


Measured memory_bytes: 66156
#include<iostream>
#include<cstring>
#include<string>
#include<cmath>
#include<vector>
#include<algorithm>
#include<iterator>
#include<sstream>
#include<iomanip>
#include<map>

#define rep(i, n) for (ll i = 0; i < n; i++) 
#define rrep(i, n) for(ll i = n-1; i>=0; i--)
#define range(i, n, m) for (ll i = n; i < m; i++) 
#define rrange(i, n, m) for (ll i = n - 1; i => m; i--) 
#define MOD 1000000007
//#define MOD 998244353

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

using namespace std;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }

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

	ll N;
	cin >> N;
	vector <ll> V(N), C(N);

	rep(i, N) {
		cin >> V[i];
	}
	rep(i, N) {
		cin >> C[i];
	}

	ll ret = 0;

	rep(i, N) {
		if (V[i] - C[i] > 0) {
			ret += V[i] - C[i];
		}
	}


	cout << ret << endl;







	



	
	return 0;
}


Measured memory_bytes: 256
t=input()
n=0
s=0
w=0
e=0
for i in range(int(len(t))):
    if t[i] =="N":
        n=1
    if t[i] =="S":
        s=1
    if t[i] =="E":
        e=1
    if t[i] =="W":
        w=1
if (w+e)%2==0 and (n+s)%2==0:
    print("Yes")
else:
    print("No") 

Measured memory_bytes: 62168
#include <stdio.h>

int n, res;

int solve(int i, int *a, int m){
  if(m == 0)
    return 1;
  if(i >= n)
    return 0;
  res = solve(i+1, a, m) || solve(i+1, a, m-a[i]);
  return res;
}

int main(){

  int i, q;

  scanf("%d", &n);
  int a[n];
  for(i = 0; i < n; i++)
    scanf("%d", &a[i]);

  scanf("%d", &q);
  int m[q];
  for(i = 0; i < q; i++)
    scanf("%d", &m[i]);

  for(i = 0; i < q; i++){
    res = solve(0, a, m[i]);
    if(res == 1) printf("yes\n");
    else printf("no\n");
  }

  return 0;
}

Measured memory_bytes: 580
N,M = map(int,input().split())
L = []
for i in range(N):
  L.append(list(map(int,input().split())))
I = [0]*M
k = 0
for i in range(N):
  for j in range(1,L[i][0]+1):
    k = L[i][j]
    I[k-1] += 1
    k = 0
ans = 0
for i in range(M):
  if I[i] == N:
    ans += 1
print(ans)

Measured memory_bytes: 3064
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <memory.h>
#include <math.h>
#include <assert.h>
#include <queue>
#include <map>
#include <set>
#include <string>
#include <algorithm>
#include <iostream>
#include <functional>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <bitset>

using namespace std;
typedef pair<int, int> pii;
typedef long long ll;
#define Fi first
#define Se second
#define pb(x) push_back(x)
#define sz(x) ((int)(x).size())
#define rep(i, n) for(int i=0;i<n;i++)
#define all(x) (x).begin(), (x).end()
typedef tuple<int, int, int> t3;
typedef pair<ll, ll> pll;
typedef long double ldouble;
typedef pair<double, double> pdd;

int h, w;
int p[26];

void solve(){
	scanf("%d%d", &h, &w);
	rep(i, h) {
		char ch[220];
		scanf("%s", ch);
		rep(j, w) p[ch[j] - 'a']++;
	}
	int a = 0, b = 0, c = 0;
	a = (h / 2) * (w / 2);
	b = (h & 1) * (w / 2) + (w & 1) * (h / 2);
	c = (h & 1) * (w & 1);
	rep(i, 26) {
		while(p[i] >= 4 && a > 0) --a, p[i] -= 4;
		while(p[i] >= 2 && b > 0) --b, p[i] -= 2;
		while(p[i] >= 1 && c > 0) --c, p[i] --;
	}
	if(a == 0 && b == 0 && c == 0) {
		puts("Yes");
	}
	else puts("No");
}

int main(){
	int Tc = 1; //scanf("%d\n", &Tc);
	for(int tc=1;tc<=Tc;tc++){
		// printf("Case #%d: ", tc);
		solve();
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
using ll = long long;
using P = pair<int,int>;
using PP = pair<int,pair<int,int>>;
using T = tuple<string,int,int>;
const ll INF = 1LL<<60;

bool func(int x){
  int temp = x;
  int y = 0;
  while(temp){
    y += temp%10;
    temp /= 10;
  }
  if(x % y == 0) return true;
  return false;
}

int main(){
  string s,t; cin >> s >> t;
  sort(s.begin(), s.end());
  sort(t.begin(), t.end());
  reverse(t.begin(), t.end());

  if(s < t) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


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

int main() {
	int q=0;
	string a, b, c;
	cin >> a >> b >> c;
	if (a.at(a.size() - 1) == b.at(0) && b.at(b.size() - 1) == c.at(0)) {
		q = ++q;
	}
	if(q==0) {
		cout << "NO" << endl;
		return 0;
	}

	else {
		cout << "YES" << endl;
		return 0;
	}
}

Measured memory_bytes: 256
from collections import Counter
from math import ceil

N = int(input())
A = list(map(int, input().split()))

# a position where a person could be located.
possibility = ([0 for i in range(N)])

THE_NUM = 10**9 + 7

is_exist_liar = False
# testimony
for a in A:
  # to find the number of reordering, you can only count one side.
  place_left = (N - 1 - a) // 2
  if (N - 1 - a) % 2 == 0 and place_left >= 0:
    possibility[place_left] += 1
  else:
    is_exist_liar = True
    break

answer = 1
# there is no need to count the center.
for i in range(N // 2):
  if possibility[i] <= 2:
    answer *= possibility[i]
  else:
    is_exist_liar = True
    break

# it is consistent to have more than two numbers in the middle.
if is_exist_liar or N % 2 == 1 and possibility[N//2] >= 2:
  print(0)
else:
  print(answer % THE_NUM)

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

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

  int a[20], b[20], c[20], i;

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

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

  for (i = 0; i < n - 1; i++) {
    cin >> c[i];
  }

  int score = 0, pre = -1, dish;

  for (i = 0; i < n; i++) {
    if (i > 0) {
      pre = a[i - 1];
    }
    dish = a[i];

    score += b[dish - 1];

    if (dish - pre == 1) score += c[pre - 1];
  }

  cout << score << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <map>
#include <utility>
#include <list>
#include <string>
#include <vector>
#include <algorithm>
#include <set>

using namespace std;

#define LL long long


int main() {
    int h, w;
    cin >> h >> w;

    int total = h * w;
    int a, b;
    cin >> a >> b;

    cout << total - ((a * w) + (b * h) - a * b) << endl;


    return 0;
}


Measured memory_bytes: 256
#include<algorithm>
#include <bits/stdc++.h>
#include<stdio.h>
#include<math.h>
#include<string.h>
#include<stdlib.h>
#include<stdbool.h>
#include<ctype.h>
using namespace std;
#define pb push_back
#define S second
#define F first
#define f(i,n) for(ll i=0;i<n;i++)
#define f1(i,n) for(ll i=1;i<=n;i++)
#define fb(i,n) for(ll i=n-1;i>=0;i--)
#define fb1(i,n) for(ll i=n;i>0;i--)
#define end cout<<'\n';
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define vi vector<ll>
#define pii pair<ll,ll>
#define CASES  ll t;cin>>t;while(t--)
typedef long long ll;
typedef unsigned long long ull;
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
//typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
//*X.find_by_order()
//X.order_of_key()
int main()
{
fast;
    ll n;
    cin>>n;
    ll dp[n+1][3];
    ll a[n],b[n],c[n];
    f(i,n)
        cin>>a[i]>>b[i]>>c[i];
    memset(dp,0,sizeof(dp));
    f1(i,n)
    {
        dp[i][0]=max(dp[i][0],max(dp[i-1][1],dp[i-1][2])+a[i-1]);
        dp[i][1]=max(dp[i][1],max(dp[i-1][0],dp[i-1][2])+b[i-1]);
        dp[i][2]=max(dp[i][2],max(dp[i-1][0],dp[i-1][1])+c[i-1]);
    }
    cout<<max(dp[n][0],max(dp[n][1],dp[n][2]));
    return 0;
}

Measured memory_bytes: 4992
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Collections;
static class Extensions
{
    public static int ToInt(this string s) => int.Parse(s);
    public static long ToLong(this string s) => long.Parse(s);
    public static char ToChar(this string s) => char.Parse(s);
    public static double ToDouble(this string s) => double.Parse(s);
    public static int[] ToIntArray(this string s) => s.Replace(',', ' ').Split(' ').Select(x => x.ToInt()).ToArray();
    public static long[] ToLongArray(this string s) => s.Replace(',', ' ').Split(' ').Select(x => x.ToLong()).ToArray();
    public static double[] ToDoubleArray(this string s) => s.Replace(',', ' ').Split(' ').Select(x => x.ToDouble()).ToArray();
    public static Queue<T> ToQueue<T>(this IEnumerable<T> seq) => new Queue<T>(seq);
    public static Stack<T> ToStack<T>(this IEnumerable<T> seq) => new Stack<T>(seq);
}

class Program
{
    static string[] ReadLines(int n) => Enumerable.Range(0, n).Select(s => Console.ReadLine()).ToArray();

    static void Main()
    {
        string[] aa = new string[] { "00", "11", "22", "33", "44", "55", "66", "77", "88", "99" };

        string S = Console.ReadLine();

        if (aa.Any(a => S.Contains(a)))
        {
            Console.WriteLine("Bad");
        }
        else
        {
            Console.WriteLine("Good");

        }
    }
}

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

using ll = long long;

#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define pb push_back
#define mp make_pair
#define fill(x, y) memset(x, y, sizeof(x))
#define even(x) x % 2 == 0
#define odd(x) x % 2 != 0
#define all(x) x.begin(), x.end()
#define pcnt __builtin_popcount
#define buli(x) __builtin_popcountll(x)
#define F first
#define S second
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());

// these functions return the position of result of Binary Search.
#define LB(s, t, x) (int) (lower_bound(s, t, x) - s)
#define UB(s, t, x) (int) (upper_bound(s, t, x) - s)

ll qp(ll a, ll b, int mo) { ll ans = 1; do { if (b & 1) ans = 1ll * ans * a % mo; a = 1ll * a * a % mo; } while (b >>= 1); return ans; }
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

template <typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }
template <typename T, typename... Ts>
auto make_v(size_t a, size_t b, Ts... ts) { return vector<decltype(make_v<T>(b, ts...))>(a, make_v<T>(b, ts...)); }
template <typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T &t, const V &v) { t = v; }
template <typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T &t, const V &v) { for (auto &e : t) fill_v(e, v); }
// auto dp = make_v<int>(4, h, w);
// fill_v(dp, 0);

const ll INF_LL = (1ll << 60);
const int INF_INT = (int)1e9;
const ll MOD_CONST = (ll)(1e9 + 7);

template <class T>
bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template <class T>
bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }

inline tuple<ll, ll> rotate45(tuple<ll, ll> p) { ll x = get<0>(p), y = get<1>(p); return tuple<ll, ll>(x + y, x - y); }

bool comp(const std::string& lh, const std::string& rh) {
     // 文字列lhの長さが文字列rhより短かったらtrueを返す
	 if (lh.length() == rh.length())
	 	return lh > rh;
 else     return lh.length() > rh.length();
}

int main(void)
{
	cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(20);

	string s; cin >> s;
	ll N; cin >> N;

	char now = 'z';
	REP(i, s.size()) {
		chmin(now, s[i]);
	}
	set<string> ans;
	while (true) {
		REP(i, s.size()) {
			if (s[i] == now) {
				ans.insert(s.substr(i, 1));
				int cnt = 0;
				int num = min((int)s.size(), i + 5);
				FOR(j, i + 1, num) {
					ans.insert(s.substr(i, 2 + cnt));
					cnt++;
				}
			}
		}
		
			now++;
		if (ans.size() >= N) break;
	}

	auto itr = ans.begin();
	int cnt= 1;
	while (cnt < N) itr++, cnt++;
	cout << *itr<< endl;

	return 0;
}


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

int a, b, c, d;
vector<char> ops;

bool dfs(int i, vector<int> v) {
    if (i != 3) {
        vector<int> v1 = v;
        vector<int> v2 = v;
        v1.push_back(1);
        v2.push_back(-1);
        return dfs(i+1, v1) || dfs(i+1, v2);
    }
    else {
        if ((a + b*(v.at(0)) + c*v.at(1) + d*(v.at(2))) == 7) {
            for (int op : v) {
                if (op == 1) ops.push_back('+');
                else ops.push_back('-');
            }
        }
        return a + b*(v.at(0)) + c*v.at(1) + d*(v.at(2)) == 7;
    }
}

int main() {
    string s;
    cin >> s;
    a = stoi(s.substr(0, 1));
    b = stoi(s.substr(1, 1));
    c = stoi(s.substr(2, 1));
    d = stoi(s.substr(3, 1));
    vector<int> v;
    bool exist_7 = dfs(0, v);
    string ans;
    ans.push_back(char(s.at(0)));
    if (exist_7) {
        for (int i = 0; i < 3; i++) {
            ans.push_back(ops.at(i));
            ans.push_back(char(s.at(i+1)));
        }
    }
    cout << ans << "=7" << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cstdlib>
#include<bitset>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<queue>
#include<map>

using namespace std;

int read()
{
	int ans=0,f=1;
	char c=getchar();
	while(c>'9'||c<'0'){if(c=='-')f=-1;c=getchar();}
	while(c>='0'&&c<='9'){ans=ans*10+c-'0';c=getchar();}
	return ans*f;
}

int k,len;
char s[1005];

int main()
{
	k=read();
	scanf("%s",s+1);
	len=strlen(s+1);
	for(int i=1;i<=min(k,len);++i)
		printf("%c",s[i]);
	if(len>k) printf("...\n");
	return 0;
} 


Measured memory_bytes: 3164
# -*- coding: utf-8 -*-


def main():
    """Function."""
    n = int(input())
    t = list(map(int, input().split()))

    base = sum(t)

    m = int(input())
    for _ in range(m):
        num, rep = map(int, input().split())
        num = num - 1
        print(base - t[num] + rep)


if __name__ == "__main__":
    main()


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std; 
int main(){
    long long n,a,b;
    scanf("%lld %lld %lld",&n,&a,&b);
    if(n>1&&b>=a||n==1&&a==b) printf("%lld\n",(n-2)*(b-a)+1);
    else printf("0\n");
    return 0;
}

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

int main(){
  int n;
  cin >> n;
  
  int i=0;
  while(i*i <= n) i++;
  i--;
  cout << (i*i) << endl;
  
  return 0;
}

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

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

    int cnt=0,l=s.length();

    for(int i=0;i<l;i++)
    {
        if(s[i] != t[i])
        {
            cnt++;
        }
    }
    cout<<cnt<<endl;


    return 0;
}


Measured memory_bytes: 3912
#include<bits/stdc++.h>
#define fast ios::sync_with_stdio(false), cin.tie(0);
#define ll long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define endl '\n'

using namespace std;

main()
{
    fast;
    int n,x,y,i,j;
    cin>>n>>x>>y;
    int ans[n+1]={0},k;
    for (i=1;i<n;i++)
    {
        for (j=i+1;j<=n;j++)
        {
            if (j<=x && i>=y)
                k=j-i;
            else if (i<=x && j<=y)
                k=min(j-i,x-i+1+y-j);
            else if (i>=x && j<=y)
                k=min(j-i,i-x+y-j+1);
            else if (i>=x && j>=y)
                k=min(j-i,i-x+1+j-y);
            else if (i<=x && y<=j)
                k=min(j-i,j-i-(y-x)+1);
            ans[k]++;
        }
    }
    for (i=1;i<n;i++)
        cout<<ans[i]<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double lf;
typedef pair<ll,ll> ii;
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(ll i=1;i<=n;i++)
#define FOR(i,j,n,m) for(int i=j;i<n;i+=m)
#define RST(i,n) memset(i,n,sizeof i)
#define SZ(a) (int)a.size()
#define ALL(a) a.begin(),a.end()
#define X first
#define Y second
#define mkp make_pair
#define pb push_back
#define pob pop_back
#ifdef cold66
#define debug(...) do{\
    fprintf(stderr,"%s - %d (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
    _do(__VA_ARGS__);\
}while(0)
template<typename T>void _do(T &&_x){cerr<<_x<<endl;}
template<typename T,typename ...S> void _do(T &&_x,S &&..._t){cerr<<_x<<" ,";_do(_t...);}
template<typename _a,typename _b> ostream& operator << (ostream &_s,const pair<_a,_b> &_p){return _s<<"("<<_p.F<<","<<_p.S<<")";}
template<typename It> ostream& _OUTC(ostream &_s,It _ita,It _itb)
{
    _s<<"{";
    for(It _it=_ita;_it!=_itb;_it++)
    {
        _s<<(_it==_ita?"":",")<<*_it;
    }
    _s<<"}";
    return _s;
}
template<typename _a> ostream &operator << (ostream &_s,vector<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,set<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a,typename _b> ostream &operator << (ostream &_s,map<_a,_b> &_c){return _OUTC(_s,ALL(_c));}
template<typename _t> void pary(_t _a,_t _b){_OUTC(cerr,_a,_b);cerr<<endl;}
#define IOS()
#else
#define debug(...)
#define pary(...)
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0);
#endif // cold66
//}

template<class T> inline bool chkmax(T &a, const T &b) { return b > a ? a = b, true : false; }
template<class T> inline bool chkmin(T &a, const T &b) { return b < a ? a = b, true : false; }
template<class T> using MaxHeap = priority_queue<T>;
template<class T> using MinHeap = priority_queue<T, vector<T>, greater<T>>;

const ll MAXn=1e6+5,MAXlg=__lg(MAXn)+2;
const ll MOD=1000000007;
const ll INF=(ll)1e18;

int ok[1001];
vector<int> prime;
int d[MAXn];
int cnt[MAXn];
int main(){
  IOS();
  for(int i=2;i<1001;i++){
    if(!ok[i]) prime.pb(i);
    for(int j=0;i*prime[j]<1001 && j < SZ(prime);j++){
      ok[i*prime[j]] = true;
      if(i%prime[j]==0) break;
    }
  }
  int n;
  cin >> n;
  int gcd = -1;
  for (int i=0;i<n;++i) {
    cin >> d[i];
    if (gcd == -1) gcd = d[i];
    else gcd = __gcd(gcd,d[i]);
  }
  if (gcd != 1) return cout << "not coprime" << endl,0;
  for (auto p:prime) {
      int tmp = 0;
      for (int i=0;i<n;++i) {
          if (d[i] % p == 0) {
              tmp++;
              while (d[i] % p == 0) {
                  d[i] /= p;
              }
          }
      }
      if (tmp >= 2) return cout << "setwise coprime" << endl,0;
  }

  for (int i=0;i<n;++i) {
      if (d[i] == 1) continue;
      if (cnt[d[i]] != 0) return cout << "setwise coprime" << endl,0;
      cnt[d[i]]++;
  }
  cout << "pairwise coprime" << endl;
}



Measured memory_bytes: 7880
#include <stdio.h>

int main(void)
{
	int moti;
	int tuku;
	int len[51];
	int hon = 0;
	int nagasa = 0;
	int i;
	int max = 0;
	
	scanf("%d %d",&moti,&tuku);
	
	for (i = 0;i < moti;i++){
		scanf("%d",&len[i]);
	}
	
	while (hon != tuku){
		for(i = 0;i < moti;i++){
			if(max < len[i]){
				max = len[i];
			}
		}
		nagasa += max;
		for(i = 0;i < moti;i++){
			if(max == len[i]){
				len[i] = 0;
				break;
			}
		}
		max = 0;
		++hon;
	}
	printf("%d\n",nagasa);
	
	return(0);
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int main(){
    long long  a, b, c, d, e, f, g, h, x, y;
    cin >> a >> b >> c >> d;
    x=c-a;y=d-b;
    e=c-y;f=d+x;g=a-y;h=b+x;
    
    cout << e << " " << f << " " << g << " " << h <<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <string.h>
#include <math.h>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#define mem(a,b) memset(a,b,sizeof(a))
#define ll long long
#define ull unsigned long long
#define EPS 1e-8
using namespace std;
typedef pair<int,int> pii;
typedef pair<long,long> pll;
const double pi = acos(-1.0);
int read()
{
	int ret=0;char ch=getchar();
	while(ch<'0'||ch>'9') ch=getchar();
	for(;ch>='0'&&ch<='9';ch=getchar()) ret=ret*10+ch-'0';
	return ret;
}
const int MAX_N=55;
const int MAX_M=300;
struct Edge
{
	int next,to;
}edge[MAX_M];
int head[MAX_N],cnt;
void add_edge(int u,int v)
{
	edge[cnt].to=v;
	edge[cnt].next=head[u];
	head[u]=cnt++;
}
int DFN[MAX_N],low[MAX_N],ind;
bool vis[MAX_N];
int m,n,x,y,ans;
void tarjan(int x,int pre)
{
	vis[x]=true;
	DFN[x]=low[x]=++ind;
	for(int i=head[x];~i;i=edge[i].next)
	{
		int v=edge[i].to;
		if(v==pre)
			continue;
		if(!vis[v])
		{
			tarjan(v,x);
			low[x]=min(low[x],low[v]);
			if(low[v]>DFN[x])
			{
				ans++;
			}
		}
		else
		{
			low[x]=min(low[x],DFN[v]);
		}
	}
}
int main()
{
 	#ifdef TEST
	 	freopen("input.txt","r",stdin);
	#endif
	mem(head,-1);
	mem(DFN,0);
	mem(low,0);
	mem(vis,0);
	cnt=0;
	ind=0;
	ans=0;
	scanf("%d%d",&n,&m);
	for(int i=0;i<m;i++)
	{
		scanf("%d%d",&x,&y);
		add_edge(x,y);
		add_edge(y,x);
	}
	tarjan(1,1);
	printf("%d\n",ans);
	return 0;
}



Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef long long lint;
typedef pair<int,int> P;
const int    INF=(int)1e9;
const int    MOD=(int)1e9+7;
const double EPS=(double)1e-10;
const int    dx[]={-1,0,0,1};
const int    dy[]={0,-1,1,0};
struct Accelerate_Cin{
    Accelerate_Cin(){
        cin.tie(0);ios::sync_with_stdio(0);cout<<fixed<<setprecision(20);
    };
};



signed main(){
  int X,Y;cin>>X>>Y;
  cout<<X+Y/2<<endl;

  return 0;
}


Measured memory_bytes: 256
a = int(input())
b = int(input())
c = int(input())
x = int(input())

ans = 0
for count500 in range(a+1):
    for count100 in range(b+1):
        value = 500 * count500 + 100 * count100
        delta = x - value
        if delta < 0:
            break

        if delta % 50 == 0 and delta // 50 <= c:
            ans += 1

print(ans)

Measured memory_bytes: 3064
while True:
    x = input()
    x = x.split(" ")
    a = int(x[0])
    b = int(x[1])
    
    if(a==0 and b == 0):
        break
    
    if(a > b):
        x[0] = b
        x[1] = a
        
    
        
    print("{} {}".format(x[0],x[1]))


Measured memory_bytes: 5608
N,M=map(int,input().split())
A=list(map(int,input().split()))
k=0
l=0
for i in range(N):
    k+=A[i]
for i in range(N):
    if ((A[i]/k)>=(1/(4*M))):
        l+=1
if l>=M:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 61408
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <string>
#include <iomanip>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <complex>
#include <ctime>


using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef int itn;
const ll LINF = 1e18;
const int INF = 1e9;

//マクロ定義
#define vvint(vec,n,m,l) vector<vector<int>> vec(n, vector<int>(m,l));	// lで初期化
#define vvll(vec,n,m,l) vector<vector<ll>> vec(n,vector<ll>(m,l));
#define vint vector<int>
#define pint pair<int,int>
#define rep(i,a) for(int i=0;i<(a);i++)
#define all(x) (x).begin(),(x).end()
#define debug system("pause")				//デバッグ用
#define ret return 0

template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }

using Graph = vector<vector<ll>>;

#define ketasitei setprecision(15) //15桁表示

const ll MOD = 1000000007;
const double PI = 3.1415926535897932;



int main(void)

{
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << ketasitei;

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

	ll bit = (1LL << n) - 1LL;
	ll ans = LINF;
	while (bit)
	{
		ll sum = 0;
		vector<ll> in(m, 0);
		ll tmp = bit;
		ll p = 0;
		while (tmp)
		{
			if (tmp & 1)
			{
				sum += c[p];
				rep(i, m)
				{
					in[i] += a[p][i];
				}
			}
			p++;
			tmp >>= 1LL;
		}
		bool no = false;
		rep(i, m)
		{
			if (in[i] >= x)
				continue;
			else
				no = true;
		}
		if (!no)
		{
			ans = min(ans, sum);
		}
		bit--;
	}
    if(ans==LINF)
    {
        cout<<-1<<endl;
    }
    else
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3648
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
##############################

class UnionFind:
    def __init__(self, N):
        self.rank = [0] * N
        self.parent = [i for i in range(N)]
        self.n = N

    def find(self, x):
        if self.parent[x] == x:
            return x
        else:
            self.parent[x] = self.find(self.parent[x])
            return self.parent[x]

    def unite(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if (x == y):
            return

        if (self.rank[x] < self.rank[y]):
            self.parent[x] = y
        else:
            self.parent[y] = x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1

    def same(self, x, y):
        return self.find(x) == self.find(y)

# https://atcoder.jp/contests/abc049/submissions/3095247

from collections import Counter

N,K,L = map(int,input().split())
roads = [tuple(map(lambda x:int(x)-1,input().split())) for i in range(K)]
rails = [tuple(map(lambda x:int(x)-1,input().split())) for i in range(L)]

uf_road = UnionFind(N)
for a,b in roads:
    uf_road.unite(a,b)

uf_rail = UnionFind(N)
for a,b in rails:
    uf_rail.unite(a,b)

ctr = Counter()
for i in range(N):
    r1 = uf_road.find(i)
    r2 = uf_rail.find(i)
    ctr[(r1,r2)] += 1

ans = []
for i in range(N):
    r1 = uf_road.find(i)
    r2 = uf_rail.find(i)
    ans.append(ctr[(r1,r2)])

print(*ans)


Measured memory_bytes: 80424
#include <bits/stdc++.h>
//For ordered_set
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define MOD 1000000007
#define MOD2 998244353
#define test int t; cin>>t; while(t--)
#define init(arr,val) memset(arr,val,sizeof(arr))
#define loop(i,a,b) for(int i=a;i<b;i++)
#define loopr(i,a,b) for(int i=a;i>=b;i--)
#define loops(i,a,b,step) for(int i=a;i<b;i+=step)
#define looprs(i,a,b,step) for(int i=a;i>=b;i-=step)
#define ull unsigned long long int
#define ll long long int
#define P pair
#define PLL pair<long long, long long>
#define PII pair<int, int>
#define PUU pair<unsigned long long int, unsigned long long int>
#define L list
#define V vector
#define D deque
#define ST set
#define MS multiset
#define M map
#define UM unordered_map
#define mp make_pair
#define pb push_back
#define pf push_front
#define MM multimap
#define F first
#define S second
#define IT iterator
#define RIT reverse_iterator
#define FAST ios_base::sync_with_stdio(false);cin.tie();cout.tie();
#define FILE_READ_IN freopen("input.txt","r",stdin);
#define FILE_READ_OUT freopen("output.txt","w",stdout);
#define all(a) a.begin(),a.end()
#define ld long double
using namespace std;
// For ordered_set
using namespace __gnu_pbds;

template <typename T>
using ord_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;
const ll maxn = 1e5;
const ll inf = 1e9;
const double pi = acos(-1);

template<class T> ostream& operator<<(ostream &os, vector<T> V) {
    os << "[ ";
    for(auto v : V) os << v << " ";
    return os << "]";
}
template<class T> ostream& operator<<(ostream &os, set<T> S){
    os << "{ ";
    for(auto s:S) os<<s<<" ";
    return os<<"}";
}
template<class L, class R> ostream& operator<<(ostream &os, pair<L,R> P) {
    return os << "(" << P.first << "," << P.second << ")";
}
template<class L, class R> ostream& operator<<(ostream &os, map<L,R> M) {
    os << "{ ";
    for(auto m:M) os<<"("<<m.F<<":"<<m.S<<") ";
    return os<<"}";
}

ll nextLunlun(ll a) {
    if(a < 12) {
        return a+1;
    }
    int u = a%10;
    int t = (a/10)%10;;
    if(t < 9) {
        if(u < t+1) {
            return a+1;
        }
    } else {
        if(u < t) {
            return a+1;
        }
    }

    ll next = nextLunlun(a/10);
    t = next%10;
    if(t == 0) {
        u = 0;
    } else {
        u = t-1;
    }
    return next*10+u;

    return 0;
}

int main(){
    FAST;
    int n;
    cin >> n;
    ll ans = 1;
    loop(i, 1, n) {
        ans = nextLunlun(ans);
    }
    cout << ans << '\n';
    return 0;
}

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


#define li          long long int
#define uli         unsigned long long int
#define rep(i,to)   for(li i=0;i<((li)(to));i++)
#define repp(i,start,to)    for(li i=(li)(start);i<((li)(to));i++)
#define pb          push_back
#define sz(v)       ((li)(v).size())
#define bgn(v)      ((v).begin())
#define eend(v)     ((v).end())
#define allof(v)    (v).begin(), (v).end()
#define dodp(v,n)       memset(v,(li)n,sizeof(v))
#define bit(n)      (1ll<<(li)(n))
#define mp(a,b)     make_pair(a,b)
#define rin rep(i,n)
#define EPS 1e-12
#define ETOL 1e-8
#define MOD 1000000007
typedef pair<li, li> PI;

#define INF bit(60)

#define DBGP 1


#define idp if(DBGP)
#define F first
#define S second
#define p2(a,b)     idp cout<<a<<"\t"<<b<<endl
#define p3(a,b,c)       idp cout<<a<<"\t"<<b<<"\t"<<c<<endl
#define p4(a,b,c,d)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<endl
#define p5(a,b,c,d,e)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<endl
#define p6(a,b,c,d,e,f)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<endl
#define p7(a,b,c,d,e,f,g)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<endl
#define p8(a,b,c,d,e,f,g,h)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<endl
#define p9(a,b,c,d,e,f,g,h,i)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<endl
#define p10(a,b,c,d,e,f,g,h,i,j)        idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<"\t"<<j<<endl
#define foreach(it,v)   for(__typeof((v).begin()) it=(v).begin(); it!=(v).end(); ++it)
#define p2p(x)      idp p2((x).F, (x).S)
#define dump(x,n)   idp{rep(i,n){cout<<x[i]<<" ";}puts("");}
#define dump2(x,n)  idp{rep(i,n){cout<<"["<<x[i].F<<" , "<<x[i].S<<"] ";}puts("");}
#define dumpi(x)    idp{foreach(it, x){cout<<(*it)<<" ";}puts("");}
#define dumpi2(x)   idp{foreach(it, x){cout<<"["<<(it)->F<<" , "<<(it)->S<<"] ";}puts("");}

#define read2d(a,w,h)   rep(i,h)rep(j,w)cin>>a[i][j]
#define dump2d(a,w,h)   rep(i,h){rep(j,w)cout<<a[i][j]<<" ";puts("");}

typedef pair<li, li> PI;

using namespace atcoder;

int main() {
    li n, m;
    cin >> n >> m;
    dsu uf(n);
    rep(i, m) {
        li a, b;
        cin >> a >> b;
        a--;
        b--;
        uf.merge(a, b);
    }
    set<li> st;
    rin{
        st.insert(uf.leader(i));
    }
    cout << sz(st) - 1 << endl;

    return 0;
}


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

int main() {
  int A,B;
  cin >> A >> B;
  cout << A * B << endl;
  return 0;
}

Measured memory_bytes: 3620