akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

#define REP(i,n) for(int i=0;i<(int)(n);i++)

using namespace std;

typedef long double ld;
typedef complex<ld> P;
typedef vector<P> VP;
const ld eps = 1e-8, pi = acos(-1.0);

struct L{ P a, b; };

int main() {
  while(1){
    ld w, h;
    int n;
    cin>>w>>h>>n;
    if(!n) break;
    int N = 2*n;
    VP vp(N);
    REP(i,N) {
      ld x, y;
      cin>>x>>y;
      vp[i] = P(x,y);
    }
    VP vp2 = vp;
    vp2.emplace_back(w, 0);
    vp2.emplace_back(w, h);
    set<ld> ps;
    REP(i,N+2)REP(j,min(N, i)) {
      if (abs(real(vp2[i]) - real(vp[j])) < eps) continue;
      auto v = vp2[i]-vp[j];
      ld grad = imag(v) / real(v);
      ld ce = imag(vp2[i]) - grad * real(vp2[i]);
      if (ce >= 0 && ce <= h) ps.insert(ce);
    }
    vector<ld> p(1, 0);
    for (ld ce : ps) {
      if (ce - p.back() > eps) p.push_back(ce);
    }
    p.push_back(h);
    int m = p.size();
    ld sum = 0;
    REP(i, m-1) {
      ld mid = (p[i] + p[i+1]) / 2.0;
      P mp(0, mid);
      vector<ld> va;
      REP(j,N+2) {
        P v = vp2[j] - mp;
        va.push_back(arg(v));
      }
      sort(begin(va),end(va));
      ld upper = h;
      if (abs(pi/2 - va[n+1]) > eps) {
        upper = min(upper, mid + tan(va[n+1]) * w);
      }
      ld lower = 0;
      if (abs(-pi/2 - va[n]) > eps) {
        lower = max(lower, mid + tan(va[n]) * w);
      }
      if (upper > lower) {
        sum += ((p[i+1] - p[i]) / h) * ((upper - lower) / h);
      }
    }
    cout << setprecision(10) << fixed << sum << endl;
  }
  return 0;
}

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

typedef pair<int, int> p;

class UnionFind {
private:
	vector<ll> parents;
	vector<ll> ranks;

public:
	vector<ll> sizes;

	UnionFind(ll s): parents(s), ranks(s), sizes(s, 1) {
		for(ll i = 0; i < s; i++) parents[i] = i;
	}

	int find(ll x) {
		if(parents[x] == x) return x;
		else return parents[x] = find(parents[x]);
	}

	void unite(ll x, ll y) {
		x = find(x);
		y = find(y);
		if(x == y) return;

		if(ranks[x] < ranks[y]) {
			parents[x] = y;
			sizes[y] += sizes[x];
		} else {
			parents[y] = x;
			sizes[x] += sizes[y];
			if(ranks[x] == ranks[y]) ranks[x]++;
		}
	}

	bool same(ll x, ll y) {
		return find(x) == find(y);
	}
};

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

    int N, M;
    cin >> N >> M;

    vector<p> ab(M);

    for(int i = 0; i < M; i++) {
        int a, b;
        cin >> a >> b;
        ab[i] = make_pair(--a, --b);
    }

    int count = 0;

    for(int i = 0; i < M; i++) {
        UnionFind uf(N);
        for(int j = 0; j < M; j++) {
            if(i == j) continue;
            uf.unite(ab[j].first, ab[j].second);
        }
        if(uf.sizes[uf.find(0)] != N) count++;
    }

    cout << count << endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a),i##_len=(b);i<i##_len;++i)
#define MSVC_UNKO(x) x
#define rep(...) MSVC_UNKO(_overload3(__VA_ARGS__,repi,_rep,_rep)(__VA_ARGS__))
#define all(c) c.begin(),c.end()
#define write(x) cout<<(x)<<'\n'
using namespace std; typedef long long ll; template<class T>using vv = vector<vector<T>>;
template<class T>auto vvec(int n, int m, T v) { return vv<T>(n, vector<T>(m, v)); }
template<class T, class U>bool chmax(T& a, U&& b) { return a < b ? a = b, 1 : 0; }
template<class T, class U>bool chmin(T& a, U&& b) { return b < a ? a = b, 1 : 0; }
constexpr int INF = 1 << 29, MOD = 998244353; constexpr ll LINF = 1LL << 60;
struct aaa { aaa() { cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(10); }; }aaaa;

ll mpow(ll x, ll n) { ll y = 1; for (; n > 0; n /= 2) { y = n % 2 ? y * x % MOD : y; x = x * x % MOD; } return y; }

template<typename T = int, class F = std::plus<T>, class F_INV = std::minus<T>, const T E = T()>
struct BinaryIndexedTree {
    const F op = F(); const F_INV op_inv = F_INV();
    int n; vector<T> dat;
    template<class U = vector<T>> void build(U&& v) {
        n = v.size(); dat.assign(n, E); for (int i = 0; i < n; ++i) add(i, v[i]);
    }
    void add(int k, T v) { for (int i = k; i < n; i |= i + 1) dat[i] = op(dat[i], v); }
    void update(int k, T v) { add(k, op_inv(v, query(k, k + 1))); }
    T query(int a, int b) {
        if (a == b) return E;
        T ret = E; for (int i = b - 1; i >= 0; i = (i & (i + 1)) - 1) ret = op(ret, dat[i]);
        return op_inv(ret, query(0, a));
    }
};

int N;
vector<pair<int, int>> xy;

int main() {
    cin >> N;
    xy.resize(N);
    rep(i, N) {
        cin >> xy[i].first >> xy[i].second;
    }

    sort(all(xy));

    vector<int> ycmp(N);
    rep(i, N) ycmp[i] = xy[i].second;
    sort(all(ycmp));

    BinaryIndexedTree<int> L, R;
    L.build(vector<int>(N, 0));
    R.build(vector<int>(N, 1));

    ll ans = 0;
    rep(i, N) {
        int yindex = lower_bound(all(ycmp), xy[i].second) - ycmp.begin();

        ll cnt1 = R.query(yindex + 1, N);
        ll cnt2 = L.query(yindex + 1, N);
        ll cnt3 = L.query(0, yindex);
        ll cnt4 = R.query(0, yindex);

        // center
        ans = (ans + mpow(2, N - 1)) % MOD;

        // diagonal
        ans = (ans + (mpow(2, cnt1) - 1) * (mpow(2, cnt3) - 1) % MOD * (mpow(2, cnt2) + mpow(2, cnt4) - 1 + MOD) % MOD) % MOD;
        ans = (ans + (mpow(2, cnt2) - 1) * (mpow(2, cnt4) - 1) % MOD * (mpow(2, cnt1) + mpow(2, cnt3) - 1 + MOD) % MOD) % MOD;
        ans = (ans + (mpow(2, cnt1) - 1) * (mpow(2, cnt2) - 1) % MOD * (mpow(2, cnt3) - 1) % MOD * (mpow(2, cnt4) - 1)) % MOD;

        L.add(yindex, 1);
        R.add(yindex, -1);
    }

    write(ans);
}

Measured memory_bytes: 4980
N = int(input())

freq = {}

for i in range(10):
    for j in range(10):
        freq[str(i)+str(j)] = 0
 
for i in range(1, N+1):
    i_str = str(i)

    head_str = i_str[0]
    tail_str = i_str[-1]
    freq[head_str+tail_str] += 1

ans = 0

for i in range(1, N+1):
    i_str = str(i)

    head_str = i_str[0]
    tail_str = i_str[-1]
    ans += freq[tail_str+head_str] 

print(ans)



Measured memory_bytes: 3064
#include <iostream>
#define ll long long
#define PER(i, n) for(long long i = (n); i >= (0); --i)

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

int main () {
  ll N, Y;
  std::cin >> N >> Y;
  PER(x, Y / 10000) {
      PER(y, (Y - x * 10000) / 5000) {
          ll z = N - x - y;
          if (x * 10000 + y * 5000 + z * 1000 == Y) {
              std::cout << x << " " << y << " " << z << std::endl;
              return 0;
          }
      }
  }
  std::cout << -1 << " " << -1 << " " << -1 << std::endl;
  return 0;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
int64_t gcd(int a,int b)
{
	int64_t tem;
	
	if(a<b)
		swap(a,b);
	if(a%b==0)
		return b;
	tem=a%b;
	return gcd(b,tem);

}

int main()
{
	int a=100000,b=99999;
	cin>>a>>b;
	int64_t g=gcd(a,b);
	 
	cout<<(int64_t)a*b/g<<"\n";
	
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String input = sc.next();
		int length = input.length();

		int total = 0;
		for (int i =  0; i<length; i++) {
			int k = Integer.parseInt(String.valueOf(input.charAt(i)));
			total = total + k;
		}
		String result = Integer.parseInt(input) % total == 0 ? "Yes" : "No";
		System.out.println(result);

	}
}


Measured memory_bytes: 21844
import Control.Applicative
import Control.Monad
import System.IO.Unsafe
import Control.Monad.ST
import Data.Functor
import Data.Function
import Data.Monoid
import Data.Maybe
import Data.List
import Data.Foldable (foldMap)
import Data.List.Split
import Data.Bits
import Data.Char
import Data.Ix
import Data.Ratio
import Data.Ord
import Data.Tuple
import Data.Array
import Data.Array.IO
import Data.Array.ST
import Data.IORef
import Data.STRef
 
readInt = read :: String -> Int
readDouble = read :: String -> Double
getInt = readLn :: IO Int
getInts = map readInt . words <$> getLine
getDouble = readLn :: IO Double
sjoin :: (Show a) => [a] -> String
sjoin = unwords . map show
cond :: a -> a -> Bool -> a
cond t f c = if c then t else f
apply2 :: (a -> a -> b) -> [a] -> b
apply2 f [x,y] = f x y
apply3 :: (a -> a -> a -> b) -> [a] -> b
apply3 f [x,y,z] = f x y z
fnBin :: (b -> c -> d) -> (a -> b) -> (a -> c) -> a -> d
fnBin op f g x = op (f x) $ g x
fnTuple :: (a -> b, a -> c) -> a -> (b, c)
fnTuple (f,g) a = (f a, g a)
replace :: (Eq a) => a -> a -> [a] -> [a]
replace x y = map (\z -> if z==x then y else z)
modifyArray :: (Ix i, MArray a e m) => a i e -> i -> (e -> e) -> m ()
modifyArray arr ix f = readArray arr ix >>= writeArray arr ix . f
-- end of templete

shuffle n 0 d = joint a b
  where
    (a, b) = splitAt n d
    joint [] [] = []
    joint (x:xs) (y:ys) = (x:y:joint xs ys)
shuffle n k d = b ++ a
  where
    (a, b) = splitAt k d

main = do
    n <- getInt
    m <- getInt
    ks <- replicateM m getInt
    mapM_ print $ foldl (\d k -> shuffle n k d) [1..2*n] ks

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

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

}

Measured memory_bytes: 256
import java.util.Scanner;
import java.lang.Math;

public class Main{
	public static void main(String [] args){
		Scanner sc = new Scanner(System.in);
		double r = sc.nextDouble();
		System.out.printf("%.6f %.6f\n",r*r*Math.PI,2*r*Math.PI);
		
	}
}

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

int main() {
    int a, b, c;
    cin >> a >> b >> c;
    int x;
    cin >> x;

    int cnt = 0;
    for (int i = 0; i <= a; i++) {
        for (int j = 0; j <= b; j++) {
            for (int k = 0; k <= c; k++) {
                int sum = i * 500 + j * 100 + k * 50;
                if (sum == x) cnt++;
            }
        }
    }
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
#define all(v) (v).begin(), (v).end()
#define lp(i, n) for (int i = 0; i < (n) ; ++i)
#define sz(v) (ll)(v).size()
#define int long long
#define mod 1000000007

void solve() {
        string str; cin>> str;
        if (str[0]== '7'|| str[1]== '7'|| str[2]== '7') cout << "Yes";
        else cout << "No";
}

int32_t main(){
ios::sync_with_stdio(0), cin.tie(NULL), cout.tie(NULL);
        int t = 1;
        //cin >> t;
        while ( t-- ) {
                solve();
        }
return 0;
}


Measured memory_bytes: 3592
"""
    こんにちは。これはクシャルです
    
    Author : thekushalghosh (クシャル)
    Team   : CodeDiggers
 
    I prefer Python language over the C++ language :p :D
        
    Visit my website : thekushalghosh.github.io
"""
import sys,math,cmath,time
start_time = time.time()
##########################################################################
################# ---- THE ACTUAL CODE STARTS BELOW ---- #################

def solve():
    n = inp()
    a = inlt()
    q = inp()
    w = sum(a)
    qw = counter(a)
    for i in range(q):
        b,c = invr()
        w = w + ((c - b) * qw[b - 1])
        qw[b - 1],qw[c - 1] = 0,qw[c - 1] + qw[b - 1]
        print(w)
            
################## ---- THE ACTUAL CODE ENDS ABOVE ---- ##################
##########################################################################
 
def main():
    global tt
    if not ONLINE_JUDGE:
        sys.stdin = open("input.txt","r")
        sys.stdout = open("output.txt","w")
    t = 1
    for tt in range(t):
        solve()
    if not ONLINE_JUDGE:
        print("Time Elapsed :",time.time() - start_time,"seconds")
        sys.stdout.close()
    
#---------------------- USER DEFINED INPUT FUNCTIONS ----------------------#
def inp():
    return(int(input()))
def inlt():
    return(list(map(int,input().split())))
def insr():
    return(input().strip())
def invr():
    return(map(int,input().split()))
 
#------------------ USER DEFINED PROGRAMMING FUNCTIONS ------------------#
def counter(a):
    q = [0] * 100000
    for i in range(len(a)):
        q[a[i] - 1] = q[a[i] - 1] + 1
    return(q)
 
def string_counter(a):
    q = [0] * 26
    for i in range(len(a)):
        q[ord(a[i]) - 97] = q[ord(a[i]) - 97] + 1
    return(q)

#-----------------------------------------------------------------------#    
ONLINE_JUDGE = __debug__
if ONLINE_JUDGE:
    input = sys.stdin.readline
main()

Measured memory_bytes: 85532
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <numeric>
#include <utility>
#include <tuple>

#define REP(i, a, b) for (int i = int(a); i < int(b); i++)
using namespace std;
using ll = long long int;
using P = pair<ll, ll>;

// clang-format off
#ifdef _DEBUG_
#define dump(...) do{ cerr << __LINE__ << ":\t" << #__VA_ARGS__ << " = "; PPPPP(__VA_ARGS__); cerr << endl; } while(false)
template<typename T> void PPPPP(T t) { cerr << t; }
template<typename T, typename... S> void PPPPP(T t, S... s) { cerr << t << ", "; PPPPP(s...); }
#else
#define dump(...) do{ } while(false)
#endif
template<typename T> vector<T> make_v(size_t a, T b) { return vector<T>(a, b); }
template<typename... Ts> auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v(ts...))>(a, make_v(ts...)); }
template<typename T> bool chmin(T &a, T b) { if (a > b) {a = b; return true; } return false; }
template<typename T> bool chmax(T &a, T b) { if (a < b) {a = b; return true; } return false; }
template<typename T> void print(T a) { cout << a << endl; }
template<typename T, typename... Ts> void print(T a, Ts... ts) { cout << a << ' '; print(ts...); }
template<typename T> istream &operator,(istream &in, T &t) { return in >> t; }
// clang-format on

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n, x, t;
    cin, n, x, t;
    print((n + x - 1) / x * t);
    return 0;
}


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

#define ll long long



int main() {
	// your code goes here
	
	
    string s, t;
    cin>>s>>t;
    
    int dp[s.size()+1][t.size()+1];
    for(int i = 0; i <= t.size(); i++) dp[0][i] = 0;
	for(int i = 0; i <= s.size(); i++) dp[i][0] = 0;
	
	for(int i = 1; i <= s.size(); i++) {
	    for(int j = 1; j <= t.size(); j++) {
	        if(s[i-1] == t[j-1]) {
	               dp[i][j] = dp[i-1][j-1] + 1;     
	               continue;
	            
	        }
	        
	        
	        if(dp[i-1][j] >= dp[i][j-1])
	        dp[i][j] = dp[i-1][j];
	        else
	        dp[i][j] = dp[i][j-1];
	        
	        
	       
	    }
	}
	

	
	int index = dp[s.size()][t.size()];
    
    //cout<<"LEN "<<len<<endl;
    char ans[index+1];
    ans[index] = '\0';
    int i = s.size(),j=t.size();
    while(i>0 && j>0)
    {
        if(s[i-1]==t[j-1])
        {
            ans[index-1] = s[i-1];
            i--,j--,index--;
        }
        else if(dp[i-1][j]>dp[i][j-1])
            i--;
        else
            j--;
    }
    cout<<ans<<endl;

    
	return 0;
}


Measured memory_bytes: 35456
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
using namespace std;
typedef long long ll;
int INF = (1LL << 30) - 1;
int MOD = 1e9+7;
main(){
    int x1,y1,x2,y2;
    cin >> x1 >> y1 >> x2 >> y2;
    int dx = x2 - x1, dy = y2 - y1;
    cout << x2 - dy << " " << y2 + dx << " " << x1 - dy << " " << y1 + dx << endl;   
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <cstring>
#include <algorithm>
#include <cstdlib>
#include <ctime>
#include <cmath>
using namespace std;
typedef long long ll;

inline void Qread(int &x){
	char ch;x = 0;
	while(ch = getchar(), ch < '0' || ch > '9');x = ch - 48;
	while(ch = getchar(), ch >= '0' && ch <= '9')x = (x << 1) + (x << 3) + ch - 48;
}

const int maxn = 110;
int n;
char str[maxn], f[2][maxn];
inline bool Check(char *s, int len){
	for(int i = 1;i < len;++i){
		if(s[i] != s[i - 1])return 0;
	}
	return 1;
}
int Solve(char c){
	int res = 0, no = 0, la = 1, len = n;
	memcpy(f[no], str, sizeof(f[no]));
	while(!Check(f[no], len)){
		no ^= 1, la ^= 1;
		for(int i = 0;i < len - 1;++i){
			if(f[la][i] == c || f[la][i + 1] == c)f[no][i] = c;
			else f[no][i] = f[la][i];
		}
		if(f[la][len - 1] == c)f[no][len - 1] = c;
		else len--;
		res++;
	}
	return res;
}
int main(){
	scanf("%s", str);
	n = strlen(str);
	int ans = 1000000;
	for(char c = 'a';c <= 'z';++c){
		ans = min(ans, Solve(c));
	}
	cout<< ans << endl;
//	while(1);
	return 0;
}


Measured memory_bytes: 256
n, m = map(int, input().split())
divisor = []
for i in range(int(m ** 0.5)):
    if m % (i + 1) == 0:
        divisor.append(i + 1)
        divisor.append(m // (i + 1))
divisor.sort(reverse = True)
for i in divisor:
    if m // i >= n:
        print(i)
        break

Measured memory_bytes: 3060
import bisect
import sys
N, Q = [int(i) for i in input().split()]
S = input()
ind_ls = list()
for i in range(len(S) - 1):
    if S[i:i+2] == "AC":
        ind_ls.append(i)
        i += 1
        continue
    if S[i+1] != "A":
        i += 1
for i in range(Q):
    l, r = [int(i) for i in sys.stdin.readline().split()]
    l -= 1
    r -= 1
    print(bisect.bisect_left(ind_ls, r) - bisect.bisect_left(ind_ls, l))

Measured memory_bytes: 5904
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<stack>
#include<queue>
#define rep(i,n) for(int i=0;i<(n);i++)
typedef long long ll;
using namespace std;

int main() {
	int a, b;
	cin >> a >> b;
	if (a <= 8 && b <= 8) cout << "Yay!" << endl;
	else cout << ":(" << endl;
}


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;

public class Main {

	public static class Pair {
		long a, b;
		Pair(long a, long b) {
			this.a = a;
			this.b = b;
		}
	}

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long n = sc.nextLong();
		long k = sc.nextLong();
		Pair[] p = new Pair[(int)n];
		for(int i = 0 ; i < n ; i++) {
			long a = sc.nextLong();
			long b = sc.nextLong();
			p[i] = new Pair(a, b);
		}
		Arrays.sort(p, new Comparator<Pair>() {
			public int compare(Pair p1, Pair p2) {
				return (int)(p1.a - p2.a);
			}
		});
		for(int i = 0 ; i < p.length ; i++) {
			k -= p[i].b;
			if(k <= 0) {
				System.out.println(p[i].a);
				return;
			}
		}
	}
}


Measured memory_bytes: 90980
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 1000000000000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;



int main(){

	int K;
	scanf("%d",&K);

	int GU = 0,KI = 0;
	for(int i = 1; i <= K; i++){
		if(i%2 == 1){

			KI++;

		}else{

			GU++;
		}
	}

	printf("%d\n",GU*KI);

	return 0;
}


Measured memory_bytes: 3792
#include <bits/stdc++.h>
#define FOR(i, a, n) for(ll i = (ll)a; i < (ll)n; i++)
#define rep(i, n) FOR(i, 0, n)
#define ALL(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;

constexpr int Mod = 998244353;
constexpr int mod = 1e9 + 7;
constexpr ll inf = 1LL << 60;

template <typename T> constexpr bool chmax(T &a, const T &b) {
    if(a >= b) return false;
    a = b;
    return true;
}
template <typename T> constexpr bool chmin(T &a, const T &b) {
    if(a <= b) return false;
    a = b;
    return true;
}

/*-------------------------------------------*/

int N;
vector<int> A;

bool f(const int &x) {
    if(x <= 0) return false;
    int len = 0;
    map<int, int> mp;
    for(int a : A) {
        if(len >= a) {
            mp.erase(mp.upper_bound(a), mp.end());
            if(x <= 1) return false;
            int pos = a;
            while(mp[pos] == x - 1) {
                mp.erase(pos);
                pos--;
            }
            if(pos <= 0) return false;
            mp[pos]++;
        }
        len = a;
    }
    return true;
}

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

    cin >> N;
    A.resize(N);
    rep(i, N) cin >> A[i];

    int ng = 0, ok = N;
    while(ng + 1 < ok)
        (f(ng + ok >> 1) ? ok : ng) = ng + ok >> 1;
    cout << ok << endl;

    return 0;
}

Measured memory_bytes: 1024
/*
 * cpp_filepath
 */

// C++ 14
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstring> // memset
#include <cassert>
using namespace std;
#define ll long long
#define loop(__x, __start, __end) for(int __x = __start; __x < __end; __x++)
template <class T> ostream & operator << (ostream & out, vector<T> const & v) {
  for (auto &&a: v) out << a << " "; out << endl; return out;
}
template <class T> void dump(T &a) { cout << a << endl; }
void solve();
int main() { solve(); return 0; }


#include <set>
void solve() {
  int n, m;
  cin >> n >> m;
  n += m;
  if (n >= 10) cout << "error" << endl;
  else cout << n << endl;
}


Measured memory_bytes: 256
n,m,c=map(int,input().split())
b=list(map(int,input().split()))

accept=0

for i in range(n):
    a=list(map(int,input().split()))
    check=0
    for k in range(m):
        check+=a[k]*b[k]
        
    if check+c>0:
        accept+=1
        
print(accept)
        

Measured memory_bytes: 3060
s = input()
f = False
C = 0
Upper = 0
for i in range(len(s)):
    if s[0] != "A":
        break
    if s[i].isupper():
        Upper += 1
    if 2 <=i and i<=len(s)-2:
        if s[i] == "C":
            C += 1
if Upper == 2 and C == 1:
    f = True
if f:
    print("AC")
else:
    print("WA")

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef pair<int,int> P;
int n,m,x,ans;
map<int,int>mp;
int cnt[100010][2];//[mod M] 1:pair
int main(){
	cin>>n>>m;
	rep(i,n){
		cin>>x;
		mp[x]++;
	}
	for(P p:mp){
		cnt[p.first%m][0]+=p.second%2;
		cnt[p.first%m][1]+=p.second-(p.second%2);
	}
	for(int i=0;i<=m/2;i++){
		if(i+i==m||i==0){
			ans+=(cnt[i][0]+cnt[i][1])/2;
		}
		else{
			if(cnt[i][0]+cnt[i][1]>=cnt[m-i][0]+cnt[m-i][1]){
				ans+=cnt[m-i][0]+cnt[m-i][1];
				ans+=min(cnt[i][1]/2,((cnt[i][0]+cnt[i][1])-(cnt[m-i][0]+cnt[m-i][1]))/2);
			}
			else{
				ans+=cnt[i][0]+cnt[i][1];
				ans+=min(cnt[m-i][1]/2,((cnt[m-i][0]+cnt[m-i][1])-(cnt[i][0]+cnt[i][1]))/2);
			}
		}
		
	}
	cout<<ans<<endl;
}
			


Measured memory_bytes: 5760
#include<bits/stdc++.h>
#define MAX 1e5+1
using namespace std;

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	vector<bool>sv(MAX,true); sv.at(0)=sv.at(1)=false;
	for(int i=2;i*i<MAX;++i){
		if(sv.at(i)){
			int j=i*i;
			while(j<MAX){
				sv.at(j)=false;
				j+=i;
			}
		}
	}
	vector<int>mp(MAX,0);
	for(int i=3;i<MAX;++i){
		mp.at(i)=mp.at(i-1);
		if((i&1)&&sv.at(i)&&sv.at((i+1)/2))++mp.at(i);
	}
	int q; cin>>q;
	for(int i=0;i<q;++i){
		int l,r; cin>>l>>r;
		cout<<mp.at(r)-mp.at(l-1)<<"\n"s;
	}
}

Measured memory_bytes: 1024
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <set>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cstring>
#include <iterator>
#include <bitset>
#include <unordered_set>
#include <unordered_map>
#include <fstream>
#include <iomanip>
#include <cassert>
//#include <utility>
//#include <memory>
//#include <functional>
//#include <deque>
//#include <cctype>
//#include <ctime>
//#include <numeric>
//#include <list>
//#include <iomanip>

//#if __cplusplus >= 201103L
//#include <array>
//#include <tuple>
//#include <initializer_list>
//#include <forward_list>
//
//#define cauto const auto&
//#else

//#endif

using namespace std;


typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
    v.assign(a, vector<T>(b, t));
}

template <class F, class T>
void convert(const F &f, T &t){
    stringstream ss;
    ss << f;
    ss >> t;
}

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define reep(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) reep((i),0,(n))
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define F first
#define S second
#define mkp make_pair
#define RALL(v) (v).rbegin(),(v).rend()
#define DEBUG
#ifdef DEBUG
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#else
#define dump(x) 
#define debug(x) 
#endif

#define MOD 1000000007LL
#define EPS 1e-8
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
#define maxs(x,y) x=max(x,y)
#define mins(x,y) x=min(x,y)


// Mod int
// const int MOD = 1000000007;
struct mint{
    ll x;
    mint():x(0){}
    mint(ll x):x((x%MOD+MOD)%MOD){}
    mint operator+=(const mint& a){ if((x+=a.x)>=MOD) x-=MOD; return *this;}
    mint operator-=(const mint& a){ if((x+=MOD-a.x)>=MOD) x-=MOD; return *this;}
    mint operator*=(const mint& a){ (x*=a.x)%=MOD; return *this;}
    mint operator+(const mint& a)const{ return mint(*this) += a;}
    mint operator-(const mint& a)const{ return mint(*this) -= a;}
    mint operator*(const mint& a)const{ return mint(*this) *= a;}
    bool operator==(const mint& a)const{ return x == a.x;}
    friend ostream& operator<<(ostream& os, const mint& mi)  
    {  
        os << mi.x;  
        return os;  
    }
};
map<ll,mint> ma;

mint f(ll x){
	if(x<2) return mint(x);
	if(ma.count(x)) return ma[x];
	if(x&1){
		return ma[x]=mint(2)*f(x/2)+f(x/2+1);
	}
	else{
		return ma[x]=mint(2)*f(x/2)+f(x/2-1);
	}
}


void mainmain(){
	ll n;
	cin>>n;
	cout<<f(n+1)<<endl;
}


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

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {

	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int upper_base, lower_base, height;
		cin >> upper_base >> lower_base >> height;

	int trapezoid_area = 0;
		trapezoid_area = ((upper_base + lower_base) * height / 2);

	cout << trapezoid_area << endl;


	return 0;
}

Measured memory_bytes: 3512
#include <cstdio>
#include <cstring>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <queue>
#include <set>
#include <vector>
#include <stack>
#include <map>
#define ri register
#define inf 0x7fffffff
#define E (1)
#define mk make_pair
#define int long long
using namespace std; const int N=600010;
inline int read()
{
	int s=0, w=1; ri char ch=getchar();
	while(ch<'0'||ch>'9') {if(ch=='-') w=-1; ch=getchar(); }
	while(ch>='0'&&ch<='9') s=(s<<3)+(s<<1)+(ch^48), ch=getchar(); return s*w;
}
void print(int x) {if(x<0) x=-x, putchar('-'); if(x>9) print(x/10); putchar(x%10+'0'); }
int X,Y,A,B,C,p[N],q[N],r[N],cnt;
inline bool cp(int x,int y) {return x>y; }
signed main()
{
	X=read(), Y=read();
	A=read(), B=read(), C=read();
	for(ri int i=1;i<=A;i++) p[i]=read();
	for(ri int i=1;i<=B;i++) q[i]=read();
	for(ri int i=1;i<=C;i++) r[i]=read();
	sort(p+1,p+1+A,cp), sort(q+1,q+1+B,cp);
	for(ri int i=1;i<=X;i++) r[C+(++cnt)]=p[i];
	for(ri int i=1;i<=Y;i++) r[C+(++cnt)]=q[i];
	sort(r+1,r+1+C+cnt,cp); int res=0;
	for(ri int i=1;i<=X+Y;i++) res+=r[i]; printf("%lld\n",res);
	return 0;
}

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

int main()
{
  int n, k;
  cin >> n >> k;
  vector<int> p;
  for (int i = 0; i < n; i++)
  {
    int s;
    cin >> s;
    p.push_back(s);
  }
  sort(p.begin(), p.end());

  int ans = 0;
  for (int i = 0; i < k; i++)
  {
    ans += p[i];
  }
  cout << ans << endl;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define rep(i, z, n) for(int i = z; i < n; i++)
#define all(v) v.begin(), v.end()
typedef long long ll;
//const int INF = 1<<29;
//const int MODINF = 1000000007;
using namespace std;

int main(){
    int N, M, Q;
    cin >> N >> M >> Q;
    vector<int> a(Q), b(Q), c(Q), d(Q);
    rep(i, 0, Q) cin >> a.at(i) >> b.at(i) >> c.at(i) >> d.at(i);
    int ans_f = 0;
    queue<vector<int>> q;
    q.push({1});
    while(true){
        vector<int> x = q.front();
        if (x.size() >= N) break;
        q.pop();
        int y = x.at(x.size() - 1);
        rep(j, y, M + 1){
            vector<int> z = x;
            z.push_back(j);
            q.push(z);
        }
    }
    
    while(!q.empty()){
        int ans = 0;
        vector<int> x = q.front();
        q.pop();
        
        rep(i, 0, Q){
            if (x.at(b.at(i) - 1) - x.at(a.at(i) - 1) == c.at(i)){
                ans += d.at(i);
            }
        }
        ans_f = max(ans_f, ans);
    }
     
    cout << ans_f << endl;
}

Measured memory_bytes: 6604
#include <bits/stdc++.h>
using namespace std;
#define ll          long long
#define vl          vector<ll>
#define vi          vector<int>
#define pi          pair<int,int>
#define pl          pair<ll,ll>
#define all(a)      a.begin(),a.end()
#define mem(a,x)    memset(a,x,sizeof(a))
#define pb          push_back
#define mp          make_pair
#define F           first
#define S           second
#define endl 		"\n"
#define rep(i,a,b)  for(int i=a;i<b;i++)
#define fast_io     std::ios::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define trace(...) ZZ(#__VA_ARGS__, __VA_ARGS__);
template <typename Arg1> void ZZ(const char* name, Arg1&& arg1) {std::cerr << name << " = " << arg1 << endl;}
template <typename Arg1, typename... Args>void ZZ(const char* names, Arg1&& arg1, Args&&... args)
{
	const char* comma = strchr(names + 1, ',');
	std::cerr.write(names, comma - names) << " : " << arg1;
	ZZ(comma, args...);
}

void solve() {
	int n;
	cin >> n;
	vi a, b;
	rep(i, 0, n) {
		int x, y;
		cin >> x >> y;
		a.pb(x);
		b.pb(y);
	}
	rep(i, 0, n - 2) {
		if (a[i] == b[i] && a[i + 1] == b[i + 1] && a[i + 2] == b[i + 2]) {
			cout << "Yes";
			return;
		}
	}

	cout << "No";
}
int main() {
	fast_io;
	int t = 1;
	// cin>>t;
	while (t--) {
		solve();
	}
	// cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
	return 0;
}

Measured memory_bytes: 3612
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<unordered_map>
#include<array>
#include<map>
#include<iomanip>
//<< setprecision(5)
using namespace std;
typedef long long int llint;
typedef long double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
#define dme cout<<-1<<endl;return 0
const int mod=1000000007;
const int big=1e9;
const long double pai=3.141592653589793238462643383279502884197;
const long double eps=1e-7;
template <class T,class U>void mineq(T& a,U b){if(a>b){a=b;}}
template <class T,class U>void maxeq(T& a,U b){if(a<b){a=b;}}
llint gcd(llint a,llint b){if(a%b==0){return b;}else return gcd(b,a%b);}
llint lcm(llint a,llint b){return a/gcd(a,b)*b;}
int main(void){
	int i,j,n,l;cin>>n>>l;
	vector<string>str(n);
	vector<pair<string,string>>ans;
	string kai;
	for(i=0;i<n;i++){cin>>str[i];}
	for(i=0;i<n;i++){
		reverse(str[i].begin(),str[i].end());
		for(j=0;j<i;j++){
			if(str[i]!=str[j]){continue;}
			reverse(str[i].begin(),str[i].end());
			if(str[i]>str[j]){swap(str[i],str[j]);}
			ans.pub(mp(str[i],str[j]));
			str[i]="";
			str[j]="";
			break;
		}
		reverse(str[i].begin(),str[i].end());
	}
	sort(ans.begin(),ans.end());
	for(i=0;i<n;i++){
		if(str[i]==""){continue;}
		string iti=str[i];
		reverse(iti.begin(),iti.end());
		if(iti==str[i]){
			if(kai==""){kai=iti;}else{mineq(kai,iti);}
		}
	}
	for(i=0;i<ans.size();i++){cout<<ans[i].fir;}
	cout<<kai;
	for(i=ans.size()-1;i>=0;i--){cout<<ans[i].sec;}
	cout<<endl;
	return 0;
}

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

int64_t dp[200010][35];
int main() {
	const int64_t INF = 1e15;
	for(int i = 0; i < 200010; ++i) {
		for(int j = 0; j < 35; ++j) {
			dp[i][j] = INF;
		}
	}
	int n; cin >> n;
	int64_t T; cin >> T;
	int64_t a[n], b[n];
	vector<pair<double, int>> p;
	vector<int64_t> q;
	for(int i = 0; i < n; ++i) {
		cin >> a[i] >> b[i];
		if(a[i] > 0) {
			p.emplace_back((double)a[i] / (b[i] + 1), i);
		} else {
			q.emplace_back(b[i]);
		}
	}
	sort(p.begin(), p.end());
	reverse(p.begin(), p.end());
	int pn = p.size();
	dp[0][0] = 0;
	for(int i = 1; i <= pn; ++i) {
		int idx = p[i - 1].second;
		for(int j = 0; j < 35; ++j) {
			dp[i][j] = min(dp[i][j], dp[i - 1][j]);
			if(j - 1 >= 0 and dp[i - 1][j - 1] < T) {
				int64_t nxt = (dp[i - 1][j - 1] + 1) + (dp[i - 1][j - 1] + 1) * a[idx] + b[idx];
				if(nxt <= T) {
					dp[i][j] = min(dp[i][j], nxt);
				}
			}
		}
	}
	sort(q.begin(), q.end());
	int64_t ans = 0;
	int qn = q.size();
	for(int j = 0; j < 35; ++j) {
		if(dp[pn][j] > T) break;
		int64_t t = dp[pn][j];
		int64_t cnt = j;
		for(int i = 0; i < qn; ++i) {
			t += q[i] + 1;
			if(t > T) break;
			++cnt;
		}
		ans = max(ans, cnt);
	}
	cout << ans << '\n';
	return 0;
}

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

namespace easy_Atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] K = Array.ConvertAll(Console.ReadLine().Split(),int.Parse);
            Console.WriteLine(K[0]<10 && K[1]<10 ? K[0]*K[1]:-1);
        }
            // long[] NK = Array.ConvertAll(Console.ReadLine().Split(),long.Parse);
            // long N = NK[0];
            // long K = NK[1];
            // long K = long.Parse(Console.ReadLine());
            // int[] abc = Array.ConvertAll(Console.ReadLine().Split(),int.Parse);
            // string S = Console.ReadLine();
            // int x = int.Parse(Console.ReadLine());
            // int b = int.Parse(Console.ReadLine());
            // int N = int.Parse(Console.ReadLine());
            // float N = float.Parse(Console.ReadLine());
            // string c = Console.ReadLine();
            // string B = Console.ReadLine();
            // string[] s = Console.ReadLine().Split();
            // var s = (new string[] { Console.ReadLine(), Console.ReadLine(), Console.ReadLine() }).Select(float.Parse);
            // float[] a = Array.ConvertAll(Console.ReadLine().Split(),float.Parse);
            // var X = Console.ReadLine();
            // int[,] abcd = new int[NMQ[2],4];
            // int[] A = new int[NMQ[0]];
            // int[] A_num = new int[NMQ[0]];
            // long[] s=Array.ConvertAll(Console.ReadLine().Split(),long.Parse);
            // var hs=new Dictionary<long,long>();
            // for(int i=0;i<s[0];i++){
            //     long[] q=Array.ConvertAll(Console.ReadLine().Split(),long.Parse);
            //     if(hs.ContainsKey(q[0])){hs[q[0]]+=q[1];}
            //     else{hs.Add(q[0],q[1]);}
            // }
        
        // //最小公倍数
        // static long Lcm(long a, long b)
        // {
        //     return a/Gcd(a,b)*b;
        // }

        // //最大公約数
        // static long Gcd(long m, long n)
        // {
        //     if(n==0)return m;
        //     return Gcd(n,m%n);
        // }
    }
}


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

using namespace std;

long long kansu(long long b,long long n){
	if(n<b)return n;
	return (n%b)+kansu(b,n/b);
}


long long  calc(long long n,long long s){
	long long ans=0;
	long long k=sqrt(n-s);
	for(long long i=1;i<k+1;i++){
		if(((n-s)/i)*i==(n-s)&&((n-s)/i)+1>(s-i)&&s>=i){
			ans =i;
		}
	}
	return ans;
}



int main(){
	long long n,s,ans;
	vector<long long> v;
	cin >> n >> s;
	if(n==s) cout << n+1 <<endl;
	else{
		if(n<s) cout << -1 <<endl;
		else{
			long long a1,b1;
			a1 = calc(n,s);
			if(a1!=0){
				b1 = ((n-s)/a1)+1;
				v.push_back(b1);
			}
			for(long long i=2;i<400000;i++){
				if(kansu(i,n)==s){
					v.push_back(i);
				}
			}
			if(v.size()==0)cout << -1 << endl;
			else cout << *min_element(v.begin(),v.end()) <<endl;
		}
	}
	return 0;
}

Measured memory_bytes: 256
s_str = input()
s = list(map(int, s_str))
 
for i in range(2**(len(s)-1)):
    tmp = s[0]
    ans = s_str[0]
        
    for j in range(len(s)-1):
        if i&(2**j) != 0:
            tmp += s[j+1]
            ans += '+'+ s_str[j+1]
        else:
            tmp -= s[j+1]
            ans += '-'+ s_str[j+1]
    if tmp == 7:
        print(ans+'=7')
        exit()



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

int main(void) {
    int n;
    cin >> n;
    vector<int> p(n), r(n);
    rep(i,n){
        cin >> p.at(i);
        r.at(i) = i + 1;
    }
    bool flag = false;
    rep(i,n){
        rep(j,n){
            int swp = p.at(i);
            p.at(i) = p.at(j);
            p.at(j) = swp;
            if(p == r)flag = true;
            swp = p.at(i);
            p.at(i) = p.at(j);
            p.at(j) = swp;
        }
    }
    if(flag)cout << "YES" << endl;
    else cout << "NO" << endl;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb emplace_back
#define INF (1e9+1)
//#define INF (1LL<<59)

int main(){
    string s,t;
    cin>>s>>t;
    
    vector<int> cs(s.size()+1,0),ct(t.size()+1,0);
    
    rep(i,s.size()){
        if(s[i]=='A')cs[i+1]=1;
        else cs[i+1]=2;
    }
    rep(i,t.size()){
        if(t[i]=='A')ct[i+1]=1;
        else ct[i+1]=2;
    }
    rep(i,cs.size()-1)cs[i+1]+=cs[i];
    rep(i,ct.size()-1)ct[i+1]+=ct[i];
    
    int q;
    cin>>q;
    rep(i,q){
        int a,b,c,d;
        cin>>a>>b>>c>>d;
        a--,b--,c--,d--;
        
        int x=cs[b+1]-cs[a], y=ct[d+1]-ct[c];
        
        if(abs(x-y)%3==0)cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
    }
}

Measured memory_bytes: 1664
// This file is a "Hello, world!" in C++ language by GCC for wandbox.
#include <iostream>
#include <cstdlib>
#include <map>
#include <set>
#include <vector>
#include <queue>
using namespace std;
typedef long long ll;

int main()
{
    int X;
    cin >> X;
    
    int times = X / 100;
    
    int tmp = X % 100;
    int i = 0;
    while(true){
        if(i > times) break;
        if(tmp > 5) {
            tmp -= 5;
            i++;
        } else{
            i++;
            break;
        }
    }
    
    if(i <= times) cout << 1 << endl;
    else cout << 0 << endl;
    return 0;
}

// GCC reference:
//   https://gcc.gnu.org/

// C++ language references:
//   https://cppreference.com/
//   https://isocpp.org/
//   http://www.open-std.org/jtc1/sc22/wg21/

// Boost libraries references:
//   https://www.boost.org/doc/


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

#define ll long long
const int inf = 1e9+7;
const ll INF = 1e18+7;

using namespace std;

int m,n;
ll a[1000][3];
vector<ll> ans;
void solve(int A , int b , int c){
  vector<ll> tmp;
  for(int i =0; i < n; ++i){
    tmp.push_back(A*a[i][0]+b*a[i][1]+ c*a[i][2]);
  }
  sort(tmp.begin(),tmp.end());
  ll X = 0;
  for(int i =0; i < m; ++i)
    X += tmp[n-i-1];
  ans.push_back(X);
}

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

  cin >> n >>m;
  for(int i = 0; i < n; ++i){
    cin>>a[i][0]>>a[i][1]>>a[i][2];
  }
  solve(1,1,1);
  solve(1,1,-1);
  solve(1,-1,1);
  solve(1,-1,-1);
  solve(-1,1,1);
  solve(-1,1,-1);
  solve(-1,-1,1);
  solve(-1,-1,-1);
  ll t = -1e11;
  for(ll x : ans)
    t = max(x,t);
  
  cout<<t<<"\n";
}


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

const int INF  = 1e9;
const long long INFLL = 1e18;
const int NMAX = 100005;
const int MMAX = 100005;
const int KMAX = 1005;
const int MOD  = 1e9 + 7;
using namespace std;

// comment to disable debug functions
#define DEBUG

// frequently used macros

#if __cplusplus >= 201103L
#define ALL(v) begin(v),end(v)
#define SORT(v) sort(begin(v), end(v))
#define FIND(v,x) find(begin(v), end(v), (x))
#else
#define ALL(v) (v).begin(),(v).end()
#define SORT(v) sort(v.begin(), v.end())
#define FIND(v,x) find(v.begin(), v.end(), (x))
#endif

#define MEMNEXT(from, to) do{ memmove((to), (from), sizeof(from)); \
memset((from), 0, sizeof(from)); } while(0)
#ifdef DEBUG
#define DUMP(x) do{ std::cerr << (#x) << ": " << x << std::endl; }while(0)
#else
#define DUMP(x) do{}while(0)
#endif

// frequent used aliases
typedef long long ll;
typedef pair<int, int> p;
typedef pair<ll, int> lp;
typedef pair<ll, ll> llp;
typedef vector<int> vec;
typedef vector<ll> vecll;
typedef vector<vec> mat;
typedef vector<vecll> matll;

// frequently used constants
static const int di[] = {-1, 0, 1, -1, 1, -1, 0, 1};
static const int dj[] = {-1, -1, -1, 0, 0, 1, 1, 1};

// frequently used structs
struct edge{
  int to,cost;
};

// printf for debug
#ifndef DEBUG
void debug(const char* format, ...){}
#else
void debug(const char* format, ...){
  va_list arg;
  va_start(arg, format);
  vprintf(format, arg);
  va_end(arg);
}
#endif

// dump vector
#ifdef DEBUG
#define DUMPV(v, c) do{       \
  printf("%s: ", #v);         \
  for (int i = 0; i < (c); ++i) \
  {                           \
  cout << (v)[i] << " ";      \
  }                           \
  cout << endl;               \
} while(0)
#else
#define DUMPV(v,c)
#endif

// std::fill of multi dimensions
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
  std::fill( (T*)array, (T*)(array+N), val );
}

// binary search
ll BSearch(ll _begin, ll _end, bool (*f)(int)){
  ll mid;
  while(_end - _begin > 1LL) {
  mid = (_begin + _end) / 2LL;
  if(f(mid)) {
    debug("BSearch: f(%d) == true\n", mid);
    _end = mid;
  }
  else
  {
    debug("BSearch: f(%d) == false\n", mid);
    _begin = mid;
  }
  }
  return _end;
}


ll N,M,K,A,B,C,D,E;
int dp[NMAX] = {};

string S;
vec v;

string ans = {};

void solve(){
  // main algorithm
  for (int i = 0; i <= N; ++i)
  {
    for (int j = 0; j <= M ; ++j)
    {
      if (M * i + N * j - 2 * i * j == K)
      {
        ans = "Yes";
        return;
      }
    }
  }
  ans = "No";
}
void debug(){
  // output debug information

}
void answer(){
  // output answer
  cout << ans << endl;
}
int main(int argc, char const *argv[])
{
  // operate inputs

  // Fill(dp, -1);
  cin >> N >> M >> K;
  solve();
  #ifdef DEBUG
  debug();
  #endif
  answer();

  return 0;
}

Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
namespace AtCoder
{
    class Program
    {
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }

        static readonly long Mod = 1000000000 + 7;

        static void Main(string[] args)
        {
            //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            var N = Sarray()[0];
            var preW = ReadLine();
            var words = new HashSet<string>();
            words.Add(preW);
            for (var i = 1; i < N; ++i)
            {
                var w = ReadLine();
                if (w.First() != preW.Last())
                {
                    WriteLine("No");
                    return;
                }
                preW = w;
                if (words.Contains(w))
                {
                    WriteLine("No");
                    return;
                }
                words.Add(w);

            }
            WriteLine("Yes");
            //Out.Flush();
        }
    }
}

Measured memory_bytes: 13408
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define endl "\n"
#define pll pair<ll,ll>
#define vll vector<ll>
#define forn(i,n) for(ll i=0; i<n; ++i)
#define pb push_back
#define MOD 1000000007
#define range(c) c.begin() , c.end()
#define dbvec(a) for(auto it : a)cout << (it) <<" ";cout << endl;
#define test ll t;cin >> (t);while(t--)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) { cout << name << " : ";cout << arg1 <<" ";}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {const char *comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : ";
cout << arg1 <<" ";cout << " | ";__f(comma + 1, args...);}
char local ='O';
#define db(...) if(local=='L') {__f(#__VA_ARGS__, __VA_ARGS__); cout<<endl;}
//////////////////////////////////////////////////////////////
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
#ifndef ONLINE_JUDGE
    local = 'L';
#endif
    int n;
    cin >> n;
    ll a[n];
    forn(i,n)   cin >> a[i];
    ll ans = 0;
    sort(a, a+n);
    for(int i=0;i<n;i++)
    {
        for(int j=i+1;j<n;j++)
        {
            for(int k = j+1;k<n;k++)
            {
                if(a[i] != a[j] && a[j] != a[k] && a[i] != a[k])
                {
                    //int mi = min(a[i], a[j])
                    if(a[i] + a[j] > a[k])
                        ans++;
                }
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3660
#include <iostream>
#include <string>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <utility>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
using namespace std;
#define INF 1000000007
#define LINF 1000000000000000007
#define MOD 1000000007
#define int long long
#define rep(i, n) for (int i = 0; i < n; i++)
#define repb(i, n) for (int i = n - 1; i >= 0; i--)
#define MODE 1
#ifdef MODE
#define DEB(X) cout << #X << ": " << X << " ";
#define ARDEB(i, X) cout << #X << "[" << i << "]: " << X[i] << " ";
#define END cout << endl;
#else
#define DEB(X) \
    {          \
    }
#define ARDEB(i, X) \
    {               \
    }
#define END \
    {       \
    }
#endif
typedef pair<int, int> P;
struct edge{int to,cost;};
typedef long long ll;

int ans;
int n,c[11111];
vector<vector<int>> v(11111);
int j=0;
int p[11111],f[11111];
void dfs(int i){
    f[i]=1;
    p[i]=c[j];
    j++;
    for(auto x:v[i]){
        if(!f[x])dfs(x);
    }
}


signed main(){

    
    cin>>n;
    rep(i,n-1){
        int a,b;
        cin>>a>>b;
        v[a-1].push_back(b-1);
        v[b-1].push_back(a-1);
    }
    rep(i,n){
        cin>>c[i];
    }
    sort(c,c+n,greater<>());
    dfs(0);
    rep(i,n-1)ans+=c[i+1];
    cout<<ans<<endl;
    rep(i,n)cout<<p[i]<<" ";
    cout<<endl;

}


Measured memory_bytes: 1408
N,M = map(int,(input().split()))
          
if((N != 1)and(M != 1)):
  ans = (N-2)*(M-2)
elif((N == 1)and(M == 1)):
  ans = 1
elif(N == 1):
  ans = M-2
elif(M == 1):
  ans = N-2
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define INF 1000000
#define watch(x) cout << setw(10) << "[" << (#x) << ":] " << (x) 
#define FORE(i,v,n) for(int i=v;i<n;i++)
#define FORI(i,v,n) for(int i=v;i<=n;i++)
#define vi vector<int>;
#define pii pair<int, int>

using namespace std;
using namespace __gnu_pbds;

//typedef tree <int, null_type, less<int> rb_tree_tag, tree_order_statistics_node_update> indexed_set;

int const MOD = 1000000007;

int test_case(){
	int n,m;
	cin >> n >> m;
	int sum=0;
	vector<int > vote(n,0);
	FORE(i,0,n){
		cin >> vote[i];
		sum += vote[i];
	}
	//FORE(i,0,n){
		//cout << vote[i] << " ";
	//}
	float bar = sum/(4.0*m);
	//watch(bar);
	int count = 0;
	string answer = "No";
	FORE(i,0,n){
		if(vote[i] >= bar) count ++;
		//watch(count);
	}
	if(count >= m) answer = "Yes";
	cout << answer << endl;
	
	return 0;
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	int test=1;
	//cin >> test;
	for(int i=0;i<test;i++){
		test_case();
	}
	return 0;
}


Measured memory_bytes: 256
x, y = map(int, input().split())
a = [1,3,5,7,8,10,12]
b = [4,6,9,11]
c = [2]

def get_group(x):
    if x in a:
        return 'a'
    if x in b:
        return 'b'
    if x in c:
        return 'c'

if get_group(x) == get_group(y):
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3060