akhauriyash/Code-Regression huggingface dataset:
def main():
    import sys
    sys.setrecursionlimit(10**7)
    input = sys.stdin.readline
    n = int(input())
    l = [list(map(int,input().split())) for i in range(n)]
    ans = 1
    count = [0]*n
    check = set()
    game = []
    for i in range(n):
        if count[i] >= n-1 or i in check:
            continue
        ind = l[i][count[i]]-1
        if ind in check:
            continue
        if l[ind].index(i+1) == count[ind]:
            check |= set([i,ind])
            game.append([i,ind])
            count[i] += 1
            count[ind] += 1
    while True:
        gamepre = game
        check = set()
        game = []
        for i,j in gamepre:
            ci = True
            cj = True
            if count[i] >= n-1 or i in check:
                ci = False
            if count[j] >= n-1 or j in check:
                cj = False
            if ci:
                ci = True
                ind = l[i][count[i]]-1
                if ind in check:
                    ci = False
                if ci and l[ind].index(i+1) == count[ind]:
                    check |= set([i,ind])
                    game.append([i,ind])
                    count[i] += 1
                    count[ind] += 1
            if cj:
                cj = True
                ind = l[j][count[j]]-1
                if ind in check:
                    cj = False
                if cj and l[ind].index(j+1) == count[ind]:
                    check |= set([j,ind])
                    game.append([j,ind])
                    count[j] += 1
                    count[ind] += 1
        if not check:
            if sum(count) != n*(n-1):
                print(-1)
                exit()
            else:
                print(ans)
                exit()
        ans += 1
if __name__ == "__main__":
    main()


Measured memory_bytes: 59740
import sys
import fractions

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

H, W = lr()
dp = [[0 for _ in range(W)] for _ in range(H)]
masu = [sr() for _ in range(H)]
dp[0][0] = 1 if masu[0][0] == "#" else 0
for h, m in enumerate(masu):
    for w, s in enumerate(m):
        if w == 0 and h == 0:
            continue
        if w == 0:
            if masu[h-1][w] != s and s == "#":
                dp[h][w] += dp[h-1][w] + 1
            else:
                dp[h][w] += dp[h-1][w]
            continue
        if h == 0:
            if masu[h][w-1] != s and s == "#":
                dp[h][w] += dp[h][w-1] + 1
            else:
                dp[h][w] += dp[h][w-1]
            continue
        if masu[h-1][w] != s and s == "#":
            cand1 = dp[h][w] + dp[h-1][w] + 1
        else:
            cand1 = dp[h][w] + dp[h-1][w]
        if masu[h][w-1] != s and s == "#":
            cand2 = dp[h][w] + dp[h][w-1] + 1
        else:
            cand2 = dp[h][w] + dp[h][w-1]
        dp[h][w] = min(cand1, cand2)
print(dp[H-1][W-1])


Measured memory_bytes: 5204
#include <iostream>
#include <vector>
#include <string>
#include <cstdlib>
using namespace std;

int main(void){
    int last , last1,sum;
    vector<int> v(5);
    vector<int> v1(5);
    last = 0;
    last1 = 9;
    sum = 0;
    for(int i=0;i < 5;i++){
        cin >> v[i];
        v1[i] = v[i] % 10;
        if (v1[i] < last1 && v1[i] != 0){
            last1 = v1[i];
            last = i;
        }
    }
    for(int i=0;i < 5;i++){
        if(last != i){
            sum += v[i];
        }
        if(sum % 10 != 0){
            sum += 10 - v1[i];
        }

    }
    sum += v[last];
    cout << sum << endl;
    return 0;
}


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

int N, a, qwq, now;
long long ans;

int main(){
	scanf("%d", &N);
	for(int i=1; i<=N; i++){
		scanf("%d", &qwq);
		a=log2(qwq);
		if((1<<a)<qwq){
			if(now>a)	now=a;
			else		a++;
			
		}
		if(a>now)	ans+=(long long)a-now, now=a;
		if(a<now)	now=a;
	}
	printf("%lld", ans);
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <assert.h>
#define IOS ios::sync_with_stdio(false)
using namespace std;
#define inf (0x3f3f3f3f)
typedef long long int LL;


#include <iostream>
#include <sstream>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <string>
#include <bitset>
const int maxn = 2e5 + 20;
int fa[2][maxn];
int getFa(int u, int which) {
    if (fa[which][u] == u) return u;
    else return fa[which][u] = getFa(fa[which][u], which);
}
void toMerge(int x, int y, int which) {
    x = getFa(x, which);
    y = getFa(y, which);
    fa[which][y] = x;
}
map<pair<int, int>, int>al;
void work() {
    int n, k1, k2;
    scanf("%d%d%d", &n, &k1, &k2);
    for (int i = 1; i <= n; ++i) {
        fa[0][i] = fa[1][i] = i;
    }
    for (int i = 1; i <= k1; ++i) {
        int u, v;
        scanf("%d%d", &u, &v);
        toMerge(u, v, 0);
    }
    for (int i = 1; i <= k2; ++i) {
        int u, v;
        scanf("%d%d", &u, &v);
        toMerge(u, v, 1);
    }
    for (int i = 1; i <= n; ++i) {
        al[make_pair(getFa(i, 0), getFa(i, 1))]++;
    }
    for (int i = 1; i <= n; ++i) {
        cout << al[make_pair(getFa(i, 0), getFa(i, 1))] << " ";
    }
}

int main() {
#ifdef local
    freopen("data.txt", "r", stdin);
//    freopen("data.txt", "w", stdout);
#endif
    work();
    return 0;
}


Measured memory_bytes: 14592
# -*- coding: utf-8 -*-
import sys
import math
import os
import itertools
import _collections
import string
from functools import lru_cache
import heapq

class cin():
    def int():
        return int(sys.stdin.readline().rstrip())
    def string():
        return sys.stdin.readline().rstrip()
    def mapInt():
        return [int(x) for x in cin.string().split()]
    def stringList(n):
        return [input() for i in range(n)]
    def intListList(n):
        return [cin.mapInt() for i in range(n)]
    def intColsList(n):
        return [int(input()) for i in range(n)]
        
class Math():
    def gcd(a,b):
        if b == 0:
            return a
        return Math.gcd(b,a % b)
    def lcm(a,b):
        return (a * b) // Math.gcd(a,b)
    def roundUp(a,b):
        return -(-a // b)
    def toUpperMultiple(a,x):
        return Math.roundUp(a,x) * x
    def toLowerMultiple(a,x):
        return (a // x) * x
    def nearPow2(n):
        if n <= 0:
            return 0
        if n & (n - 1) == 0:
            return n
        ret = 1
        while(n > 0):
            ret <<= 1
            n >>= 1
        return ret
    def isPrime(n):
        if n < 2:
            return False
        if n == 2:
            return True
        if n % 2 == 0:
            return False
        d = int(n ** 0.5) + 1
        for i in range(3,d + 1,2):
            if n % i == 0:
                return False
        return True


MOD = int(1e09) + 7

def main():
    N = cin.int()
    A = cin.mapInt()
    A.sort()
    ans = 1
    for i in range(N % 2,N,2):
        if A[i] == A[i + 1] and A[i] == i + 1:
            ans *= 2
            ans %= MOD
        else:
            ans = 0
    print(ans)
    return

if __name__ == "__main__":
    main()


Measured memory_bytes: 52916
#include <bits/stdc++.h>
using namespace std;
int main(){
  long long n,A=0,B=0;
  cin >> n;
  long long a[n];
  for(int i=0;i<n;i++){
  	cin >> a[i];
  }
  sort(a,a+n);
  reverse(a,a+n);
  for(int i=0;i<n;i++){
  	if(i%2==0){
  		A+=a[i];
  	}else{
  		B+=a[i];
  	}
  }
  cout << A-B << endl;
  return 0;
}

Measured memory_bytes: 256
N, M = map(int, input().split())
N_list = [0] * N
N_set_list = [False] * N

for i in range(M):
  s, c = map(int, input().split())
  s -= 1
  
  if s > N -1 or (s == 0 and c == 0 and N != 1):
    print(-1)
    exit()

  elif N_set_list[s] and (N_list[s] != c):
    print(-1)
    exit()

  else:
    N_list[s] = c
    N_set_list[s] = True

if N_list[0] == 0 and N != 1:
  N_list[0] = 1

print(''.join(map(str, N_list)))


Measured memory_bytes: 3064
from collections import Counter

n = int(input())
A = Counter(list(map(int, input().split())))
A = sorted(A.most_common(), reverse=True)
rods = []
for a in A:
    if a[1] >= 4:
        rods.append(a[0])
        rods.append(a[0])
        break
    if a[1] >= 2:
        rods.append(a[0])
    if len(rods) == 2:
        break
if len(rods) >= 2:
    ans = rods[0]*rods[1]
else:
    ans = 0
print(ans)


Measured memory_bytes: 25920
#include <stdio.h>
#include <string.h>
#include <math.h>
#define lop(i, n) for(i=0; i<n; i++)

int max3(int a, int b, int c)
{
	int max = a;

	if (b > max) max = b;
	if (c > max) max = c;
	return max;
}

int main()
{
	int a, b, x,y,z;
	
	scanf("%d %d", &a, &b);
	x=a+b; y=a-b; z=a*b;
	
	printf("%d", max3(x, y, z));
	
	return 0;
}

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


int main() {
    int N, Q; cin >> N >> Q;
    string S; cin >> S;

    vector<int > numAC(N, 0);
    for(int i = 1; i < N; i ++){
        if (S.substr(i - 1, 2) == "AC") {
            numAC[i] = numAC[i - 1] + 1;
        } else {
            numAC[i] = numAC[i - 1];
        }
    }

    int l, r;
    for (int i = 0; i < Q; i++) {
        cin >> l >> r;
        cout << numAC[r - 1] - numAC[l - 1] << endl;
    }

    return 0;
}

Measured memory_bytes: 1408
#include <iostream>
#include <unordered_set>
#include <cstdint>
#include <vector>
#include <string>
#include <climits>
#include <set>
#include <algorithm>
#include <math.h>
#include <iomanip>
using namespace std;

int main()
{
	int a, b, c;
	cin >> a >> b >> c;
	unordered_set<int> niz{ a, b, c };

	if (niz.size() == 2)
		cout << "Yes";
	else cout << "No";
}

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

#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep1(i, n) for (ll i = 1; i <= (ll)(n); i++)
#define INF 1000000000000
#define MOD 1000000007
using ll = long long;
using Graph = vector<vector<int>>;

vector<int> dx = {1,0,-1,0};
vector<int> dy = {0,1,0,-1};

vector<int> seen;
void dfs(vector<int> &seen, Graph &Ge, Graph &Go, int v,int c){
  seen[v] = c;
  for(auto next_v: Ge[v]){
    if(seen[next_v]!=-1)continue;
    dfs(seen,Ge,Go,next_v,c);
  }
  for(auto next_v: Go[v]){
    if(seen[next_v]!=-1)continue;
    dfs(seen,Ge,Go,next_v,1-c);
  }
}

int main(){
  int n;
  cin >> n;
  Graph Ge(n+1),Go(n+1);//距離が偶数の隣接リスト。
  rep(i,n){
      int u,v,w;
    cin>>u>>v>>w;
    if(w%2==0){
      Ge[u].push_back(v);
      Ge[v].push_back(u);
    }else{
      Go[u].push_back(v);
      Go[v].push_back(u);
    }
  }
  
  seen.assign(n+1, -1);
  dfs(seen,Ge,Go,1,0);
  rep1(i,n)cout<<seen[i]<<endl;
  return 0;
  
}

Measured memory_bytes: 13440
#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>;
const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  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;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
int main() {
    ll n, k; cin >> n >> k;
    mint ans = 0;
    for(ll i=k;i<=n+1;i++) {
        ll left = (n)*(n+1)/2 - (n-i)*(n+1-i)/2;
        ll right = i*(i-1)/2;
        //printf("l:%lld r:%lld\n", left, right);
        ans += left - right+ 1;
    }
    cout << ans.x;
}


Measured memory_bytes: 3636
import sys
from string import ascii_lowercase as alph
from itertools import zip_longest

s,t=[list(l) for l in sys.stdin.read().split()]
d=dict((w,x) for w,x in zip(alph,range(26)))
d['?']=-1
s.sort(key=d.get)
t.sort(key=d.get, reverse=True)
for x,y in zip_longest(s,t,fillvalue='?'):
  if d[x]<d[y]:
      print('Yes')
      break
  elif d[x]>d[y]:
      print('No')
      break
else:
  print('No')


Measured memory_bytes: 9904
#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 N, M; cin >> N >> M;
    priority_queue<int> pq;

    int a;
    rep(i, N) {
        cin >> a;
        pq.push(a);
    }

    int x;
    while (M--) {
        x = pq.top();
        pq.pop();
        pq.push(x / 2);
    }

    ll ans = 0;
    while (!pq.empty()) {
        x = pq.top();
        pq.pop();
        ans += x;
    }

    cout << ans << endl;
}


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

/*
int main(){
    string s;
    cin >> s;
    int right = 1;
    map<int,int> map;
    for (int left = 0; left < s.size(); left++)
    {
        while (right < s.size() && stoull(s.substr(left,right - left))%2019 != 0)
        {
            cout << left << " " << right << " " << stoull(s.substr(left,right - left)) << endl;
            right++;
        }
        if(stoull(s.substr(left,right - left))%2019 == 0) map[left] = right;
        if (left == right)right++;
    }
    cout << map.size() << endl;
    return 0;
}
*/

/*
int main(){
    string s;
    cin >> s;
    map<int,int> map;
    for (int left = 0; left < (int)s.size(); left++)
    {
        for (int right = left + 4; right < (int)s.size() + 1; right++)
        {
            if(right - left < 20){
                //cout << left << " " << right << " " << stoull(s.substr(left,right - left)) << endl;
                if(stoull(s.substr(left,right - left))%2019 == 0) map[left] = right;
            }
        }
    }
    cout << map.size() << endl;
    return 0;
}
*/


/*
//combination: なんだこの短い関数！
int combi2(int x){
    return (x * (x - 1) )/ 2;
}


int main(){
    string s;
    cin >> s;
    map<unsigned long long, unsigned long long> amari; //Nihongo de oke
    for (int i = int(s.size() - 1); i >= 0 ; i--)
    {
        unsigned long long tmp = stoull(s.substr(i)) % 2019;
        if (amari.count(tmp)) amari[tmp]++;
        else                  amari[tmp] = 1;
    }

    
    //テスト出力
    for (auto &&i : amari)
    {
        cout << i.first << " appears " << i.second << "times\n";
    }
    

    unsigned long long ans = 0;
    for (auto &&i : amari)
    {
        if(i.second > 1) ans += combi2(i.second);
        if(i.first == 0) ans += i.second;
    }
    
    cout << ans << endl;
}


*/



int combi2(int x){
    return (x * (x - 1) )/ 2;
}


int xx10(int x){
    int ret = 1;
    for (int i = 0; i < x; i++)
    {
        ret *= 10;
    }
    return ret;
}



int main(){
    string s; cin >> s;
    vector<int> amari(s.size());
    int prev = 0;
    int prev_pow = 1;
    for (int i = s.size() - 1; i >= 0; i--)
    {
        amari.at(i) = (s.at(i) - '0') * prev_pow;
        amari.at(i) += prev;
        amari.at(i) %= 2019;
        prev = amari.at(i);
        prev_pow *= 10;
        prev_pow %= 2019; //この2つなんでいるのかまったくわからん。

    }
    
    map<int, int> mp;
    for (auto &&i : amari)
    {
        mp[i]++;
    }
    
    unsigned long long ans = 0;
    for (auto &&i : mp)
    {
        if(i.second > 1) ans += combi2(i.second);
        if(i.first == 0) ans += i.second;
    }
    
    cout << ans << endl;
    
    
    
}

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

int main() {
    int a,b,c;cin>>a>>b>>c;
    for(int i=1;i<=1000;++i){
        if((a*i)%b ==c){
            cout<<"YES"<<endl;
            return 0;
        }
    }
    cout<<"NO"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<cstdio>

using namespace std;

int main(){
  int n;
  long a,b,h[100000],l,r,mid,cnt;
  scanf("%d %ld %ld",&n,&a,&b);
  for(int i=0;i<n;i++)
    scanf("%ld ",&h[i]);
  l=0;
  r=1000000000;
  while(l<=r){
    mid=(l+r)/2;
    cnt=0;
    for(int i=0;i<n;i++)
      if(b*mid<h[i]){
        cnt+=(h[i]-b*mid)/(a-b);
        if((h[i]-b*mid)%(a-b)!=0)
          cnt++;
      }
    if(cnt<=mid)
      r=mid-1;
    else
      l=mid+1;
  }
  printf("%ld\n",l);
}

Measured memory_bytes: 896
using System;

public class Hello
{
    public static void Main()
    {
        string line;
        for (; (line = Console.ReadLine()) != null;)
        {
            var ans = -99;
            string[] a = line.Trim().Split('+', '=');
            if ((a[0].StartsWith("X") && a[0].Length >= 2) |
                (a[1].StartsWith("X") && a[1].Length >= 2) |
                (a[2].StartsWith("X") && a[2].Length >= 2)) ans = check(a, 1);
            else ans = check(a, 0);
            Console.WriteLine(ans == -1 ? "NA" : ans.ToString());
        }
    }
    public static int check(string[] a, int ooz)
    {
        var ok = false;
        for (int i = ooz; i <= 9; i++)
        {
            var a1 = a[0].Replace("X", i.ToString());
            var a2 = a[1].Replace("X", i.ToString());
            var a3 = a[2].Replace("X", i.ToString());
            if (getPlus(a1,a2) == a3) { ok = true;  return i; }
        }
        if (!ok) return -1;
        else return -99;
    }
    public static string getPlus(string a1, string a2)
    {
        var b1 = new int[126]; var b2 = new int[126]; var b3 = new int[126];
        var imax = Math.Max(a1.Length, a2.Length);
        var j = 0; var k = 0;
        for (int i = imax - a1.Length; i < imax; i++) b1[i] = int.Parse(a1[j++].ToString());
        for (int i = imax - a2.Length; i < imax; i++) b2[i] = int.Parse(a2[k++].ToString());
        for (int i = imax-1; i >=1; i--)
        {
            b3[i] += (b1[i] + b2[i]) % 10;
            b2[i - 1] += (b1[i] + b2[i]) / 10;
        }
        b3[0] += b1[0] + b2[0];
        var ret = "";
        for (int i = 0; i < imax; i++)
            ret += b3[i].ToString();
        return ret;
    }
}

Measured memory_bytes: 10004
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<cmath>
using namespace std;
int main() {
	int n, sum = 0, ans = 0;
	int test[1001] = { 0 };
	for (int h = 0; h < 3; h++) {
		cin >> n; test[h] = n;
	}
	for (int h = 0; h < 3; h++) {
		for (int i = h + 1; i < 3; i++) {
			ans += abs(test[h] - test[i]);
			sum = max(sum, abs(test[h] - test[i]));
		}
	}
	cout << ans - sum << endl;
	cin >> n;
}

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

using namespace std;

int main()
{
    ios_base::sync_with_stdio( false ), cin.tie( nullptr ), cout.tie( nullptr );

    int N, T, A, H, D, best, D_MIN = INT_MAX; cin >> N >> T >> A, A -= T, A *= 500;

    for( int i = 1; i <= N; i++ )
        if ( ( cin >> H, D = abs( A + 3 * H ) ) < D_MIN )
            D_MIN = D, best = i;

    cout << best;
}

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

using namespace std;

bool check[100001];
int a[100001];

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

    int n;

    cin >> n;

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

    int res = 0;

    memset(check,false,sizeof(check));

    for(int i=1;i<=n;i++)
    {
    	if(check[i]==true)
    	{
    		continue;
    	}
    	int j = a[i];
    	if((a[i]==j && a[j]==i))
    	{
    		check[i] = true;
    		check[j] = true;
    		res++;
    	}
    }

    cout << res << '\n';
    
    return 0;
}

Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi=vector<int>;
using vvi=vector<vi>;
using pii=pair<int,int>;
const ll LINF=0x1fffffffffffffff;
const int INF=0x3fffffff;
const int MOD=1000000007;
#define VAR(type,...) type __VA_ARGS__;in(__VA_ARGS__)
#define VEC(type,name,size) vector<type> name(size);each(x, name)in(x)
#define rep(i,a,b) for(int i=(a);i<(b);++i)
#define rrep(i,a,b) for(int i=(a-1);i>=(b);--i)
#define each(x,v) for(auto &x:(v))
#define all(x) (x).begin(),(x).end()
#define print(x) cout<<(x)<<endl
void in(){} template<class T,class... U> void in(T &t,U &...u){cin>>t;in(u...);}
void solve();
int main(){cin.tie(0);ios::sync_with_stdio(0);solve();}

void solve() {
  VAR(int, N);
  VEC(int, a, N);
  vi m(8);
  int free = 0;
  each(x, a) {
    if (x >= 3200) {
      free++;
    } else {
      m[x / 400] = 1;
    }
  }
  int sum = accumulate(all(m), 0);
  cout << max(sum, 1) << ' ' << sum + free << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
typedef pair<ll,ll> P;
#define pb push_back
#define mp make_pair
#define fr(i,n) for(int i=0;i<n;i++)
#define Fr(i,n) for(int i=0;i++<n;)
#define ifr(i,n) for(int i=n-1;i>=0;i--)
#define iFr(i,n) for(int i=n;i>0;i--)

int main(){
  string s,t;
  int q,a,b,c,d,n,m,S[100010]={},T[100010]={};
  cin>>s>>t>>q;
  n=s.length();
  m=t.length();
  fr(i,n){
    S[i+1]=S[i];
    if(s[i]=='A') S[i+1]++;
  }
  fr(i,m){
    T[i+1]=T[i];
    if(t[i]=='A') T[i+1]++;
  }
  fr(i,q){
    cin>>a>>b>>c>>d;
    if((((S[b]-S[a-1])*2+a-b-1)-((T[d]-T[c-1])*2+c-d-1))%3==0)
      cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
  }
}

Measured memory_bytes: 1664
import java.util.Scanner;

public class Main {


    public static void main(String[] args) {

    	Scanner sc=new Scanner(System.in);

    	int a=sc.nextInt();
    	int b=sc.nextInt();
    	int c=sc.nextInt();

    	if(a>c) {
    		System.out.println("NO");
    		return ;
    	}

    	if(a+b>=c) {
    		System.out.println("YES");
    		
    	}else {
    		System.out.println("NO");

    	}
    }


}







Measured memory_bytes: 21844
#include <iostream>
#include <stdio.h>
#include <cstring>
#include <cstdio>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string>
#include <stdlib.h>
#include <queue>
#include <stack>
#include <utility>
#include <fstream>
#include <random>
#include <map>
#include <unordered_map>
#include <cstdlib>
#include <functional>
#include <random>
#include <time.h>
#include <chrono>
#include <sstream>
#include <iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ll long long
#define INF 1000000001
#define mod 1000000007
#define sort(s) sort(s.begin(), s.end());
#define reverse(s) reverse(s.begin(), s.end());
int dx[4] = { 0,1,0,-1 };
int dy[4] = { 1,0,-1,0 };
using namespace std;
int POW(int x, int y) { return int(pow(double(x), double(y))); }
double log(double a, double b) {return log(b) / log(a);}

unsigned int randxor()
{
	static unsigned int x = 123456789, y = 362436069, z = 521288629, w = 88675123;
	unsigned int t;
	t = (x ^ (x << 11)); x = y; y = z; z = w; return(w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)));
}



int main() {
	int n, a, b;
	cin >> n >> a >> b;
	int p;
	int x = 0;
	int y = 0;
	int z = 0;
	rep(i, n) {
		cin >> p;
		if (p <= a) {
			x++;
		}
		else if (p <= b) {
			y++;
		}
		else {
			z++;
		}
	}
	cout << min(x, min(y, z)) << endl;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
string to2(string s) {
  string t="";
  for(int i=0; i<s.size(); i++) {
    int x;
    if(isdigit(s[i])) x=s[i]-'0';
    else x=s[i]-'a'+10;
    string r="";
    while(x) {
      r+='0'+x%2;
      x/=2;
    }
    while(r.size()<4) r=r+'0';
    reverse(r.begin(),r.end());
    t+=r;
  }
  return t;
}
 
string toN(string s) {
  int x=0,y=1;
  for(int i=s.size()-1; i>=0; i--) {
    if(s[i]=='1') x+=y;
    y*=2;
  }
  stringstream ss;
  string t;
  ss << x;
  ss >> t;
  return t;
}
string toD(string s) {
  int x=0,y=5000000;
  for(int i=0; i<s.size(); i++) {
    if(s[i]=='1') x+=y;
    y/=2;
  }
  stringstream ss;
  string t;
  ss << x;
  ss >> t;
  while(t.size()<7) t='0'+t;
  int i;
  for(i=t.size()-1; i>=1; i--) {
    if(t[i]!='0') break;
  }
  return t.substr(0,i+1);
}
 
int main() {
  int n;
  cin >> n;
  while(n--) {
    string s;
    cin >> s;
    s=to2(s);
    if(s[0]=='1') cout << '-';
    cout << toN(s.substr(1,24))+'.'+toD(s.substr(25)) << endl;
  }
  return 0;
}


Measured memory_bytes: 1236
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
const int INF=1145141919,MOD=1e9+7;
const long long LINF=8931145141919364364,LMOD=998244353;
// const int dx[]={1,0,-1,0,1,1,-1,-1},dy[]={0,-1,0,1,1,-1,-1,1};

int main(){
    int cnt5=0,cnt7=0;
    rep(i,3){
        int a; cin>>a;
        if(a==5) cnt5++;
        if(a==7) cnt7++;
    }
    if(cnt5==2&&cnt7==1) cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <numeric>
#include <stdio.h>
#include <iomanip>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)






int main() {
	int A, B, C;
	cin >> A >> B >> C ;
	string s = "Yes";
	if (A + B  < C) {
		s = "No";
	}
	cout << s << endl;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace tes
{
	class contest
	{
		static void Main(string[] args)
		{
			int input = int.Parse(Console.ReadLine());
            var digits = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
            int output = 10000000;

            for (int i = digits.Min(); i <= digits.Max(); i++)
            {
                
                int temp = digits.Sum(a=>(a-i)*(a-i));
                output = Math.Min(output, temp);
            }


            Console.WriteLine(output);
            
		}

	}
}

Measured memory_bytes: 3032
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>//sort,reverse
#include<utility>//pair
#include<queue>//queue,priority_queue
#include<deque>//double_ended queue
#include<map>//map
using namespace std;
typedef long long LL; 
typedef pair<LL,LL> P;//Pでpair<-,->を表す。
const LL MAX=2000010;
const LL MOD=1000000007;
typedef map<LL,LL>::iterator Itr;

int main()
{ 
    LL n;
    cin>>n;
    LL num[100010];
    for(int i=0;i<100010;i++){
        num[i]=0;
    }
    LL sum=0;
    for(int i=0;i<n;i++){
        LL x;
        cin>>x;
        num[x]++;
        sum=sum+x;
    }
    LL q;
    cin>>q;
    LL ans[q];
    for(int i=0;i<q;i++){
        LL b,c;
        cin>>b>>c;
        LL x=num[b];
        num[b]=0;
        num[c]=num[c]+x;
        sum=sum+x*(c-b);
        ans[i]=sum;
    }
    for(int i=0;i<q;i++){
        cout<<ans[i]<<endl;
    }
    return 0;
}

Measured memory_bytes: 5180
/*** author: yuji9511 ***/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using lpair = pair<ll, ll>;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i=(m);i<(n);i++)
#define rrep(i,m,n) for(ll i=(m);i>=(n);i--)
#define printa(x,n) for(ll i=0;i<n;i++){cout<<(x[i])<<" \n"[i==n-1];};
void print() {}
template <class H,class... T>
void print(H&& h, T&&... t){cout<<h<<" \n"[sizeof...(t)==0];print(forward<T>(t)...);}
ll get(ll n, ll s){
    return 5001 * n + s;
}
vector<lpair> tree[300010];

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N,M,S;
    cin >> N >> M >> S;
    ll U[110], V[110], A[110], B[110];
    ll C[55], D[55];
    rep(i,0,M){
        cin >> U[i] >> V[i] >> A[i] >> B[i];
        U[i]--; V[i]--;
    }
    rep(i,0,N){
        cin >> C[i] >> D[i];
    }

    rep(i,0,N){
        rep(j,0,5001){
            if(j - C[i] >= 0) tree[get(i, j-C[i])].push_back({get(i, j), D[i]});
        }
    }
    rep(i,0,M){
        rep(j,0,5001){
            if(j - A[i] >= 0) tree[get(U[i], j)].push_back({get(V[i], j-A[i]), B[i]});
            if(j - A[i] >= 0) tree[get(V[i], j)].push_back({get(U[i], j-A[i]), B[i]});
        }
    }

    ll dist[300010] = {};
    rep(i,0,300000) dist[i] = INF;
    priority_queue pq([](lpair l1, lpair l2){return l1 > l2;}, vector<lpair>());
    if(S >= 5000){
        dist[get(0,5000)] = 0;
        pq.push({0, get(0,5000)});
    }else{
        dist[get(0,S)] = 0;
        pq.push({0, get(0,S)});
    }
    while(!pq.empty()){
        lpair l1 = pq.top();
        pq.pop();
        if(dist[l1.second] < l1.first) continue;
        for(auto &e: tree[l1.second]){
            if(dist[e.first] > dist[l1.second] + e.second){
                dist[e.first] = dist[l1.second] + e.second;
                pq.push(make_pair(dist[e.first], e.first));
            }
        }
    }

    rep(i,1,N){
        ll ans = INF;
        rep(j,0,5001){
            ans = min(ans, dist[get(i, j)]);
        }
        print(ans);
    }

    

}

Measured memory_bytes: 46868
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
using namespace std;
using namespace __gnu_pbds;
#define ll long long
#define pp pair<ll,ll>
#define ppp pair<ll,pp >
#define trace(...) cout<<"Line:"<<__LINE__<<" "; __f(#__VA_ARGS__, __VA_ARGS__)
template<typename Arg1>
void __f(const char* name, Arg1&& arg1) {
	cout<<name<<" : "<<arg1<<endl;
}
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)<<" : "<<arg1<<" | ";
	__f(comma+1,args...);
}
typedef tree<pp,null_type,less<pp>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
#define ld long double
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define rep(i,a,b) for(ll i=a;i<b;i+=1)
#define sz(v) (ll)(v.size())
#define hell (ll)1000000007
#define slld(x) scanf("%lld",&x)
ll t=1, tt;
const ll N=505;
ll h[200005], dp[200004];
bool Q;
struct Line {
    mutable ll k, m, p;
    bool operator<(const Line& o) const {
        return Q ? p < o.p : k < o.k;
    }
};
struct LineContainer : multiset<Line> {
    const ll inf = LLONG_MAX;
    ll div(ll a, ll b){
        return a / b - ((a ^ b) < 0 && a % b);
    }
    bool isect(iterator x, iterator y) {
        if (y == end()) { x->p = inf; return false; }
        if (x->k == y->k) x->p = x->m > y->m ? inf : -inf;
        else x->p = div(y->m - x->m, x->k - y->k);
        return x->p >= y->p;
    }
    void add(ll k, ll m) {
        auto z = insert({k, m, 0}), y = z++, x = y;
        while (isect(y, z)) z = erase(z);
        if (x != begin() && isect(--x, y)) isect(x, y = erase(y));
        while ((y = x) != begin() && (--x)->p >= y->p)
            isect(x, erase(y));
    }
    ll query(ll x) {
        assert(!empty());
        Q = 1; auto l = *lower_bound({0,0,x}); Q = 0;
        return l.k * x + l.m;
    }
};
void solve(){
	ll n, k;
	cin>>n>>k;
	rep(i,1,n+1)cin>>h[i];
	LineContainer CHT;
	rep(i,1,n+1){
		if(i==1)dp[i]=0;
		else
			dp[i]=-CHT.query(h[i])+h[i]*h[i];
		ll m=-2*h[i], c=dp[i]+h[i]*h[i]+k;
		CHT.add(-m,-c);
	}
	cout<<dp[n];
}
signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
   	//cin>>t;
   	tt=t;
    while(t--){
        solve();
        if(t)cout<<"\n";
    }
    return 0 ;
}


Measured memory_bytes: 15872
import java.util.*;
class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        if(a+b==c || b+c==a ||a+c==b ){
            System.out.println("Yes");
        }else {
            System.out.println("No");
        }
    }
}

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

typedef long long ll;
const int INF = 1e9;
const ll LINF = 1e18;
const int mod = 1e9+7;

#define pi pair<int,int>
#define pl pair<lld,lld>

#define dump(x) cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define SANKOU(n,a,b) cout << ((n) ? (#a) : (#b) ) << endl

#define mem0(x) memset(x,0,sizeof(x))
#define fillnum(x,n) fill(begin(x),end(x),n)
#define asort(x) sort(x.begin(),x.end())
#define dsort(x,t) sort(x.begin(),x.end(),greater<t>())
#define vuniq(x) x.erase(unique(x.begin(), x.end()), x.end())

#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)

int main() {
    string N;
    cin >> N;
    ll cnt = 0;
    for (int i = 0; i < N.size(); i++) {
        cnt += N[i] - '0';
    }
    Yes(cnt%9 == 0);
}

Measured memory_bytes: 3732
x=int(input())

def sd(x1): # 素数判別関数_1なら素数、0なら素数じゃない 引数は奇数
    rx1=x1**(1/2)//1
    j=3
    ans=1
    while rx1>=j:
        if x1%j==0:
            ans=0
            break
        else:
            ans=1
        j+=2
    return ans

if x%2==0 and x!=2:
    x+=1
while sd(x)==0:
    x+=2
print(x)

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

using namespace std;

typedef long long ll;

const int N = (int) 1e5 + 7;
int n, a[N];

int m;
pair <int, int> op[N];

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

        cin >> n >> m;
        for (int i = 1; i <= n; i++) {
                cin >> a[i];
        }
        sort(a + 1, a + n + 1);

        for (int i = 1; i <= m; i++) {
                cin >> op[i].second >> op[i].first;
        }

        sort(op + 1, op + m + 1);

        int i = 1;
        for (int j = m; j >= 1; j--) {
                int value = op[j].first, cnt = op[j].second;
                while (i <= n && cnt > 0 && a[i] < value) {
                        a[i] = value;
                        cnt--;
                        i++;
                }
        }

        ll res = 0LL;
        for (int i = 1; i <= n; i++) {
                res += a[i];
        }
        cout << res << "\n";
}


Measured memory_bytes: 1408
#include "bits/stdc++.h"
using namespace std;
const int MAX = 700000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
/*第二引数で第一引数を割ったときの切り上げの計算*/
long long int maxtime(long long int x, long long int y) {
	return(x + y - 1) / y;

}
/*最大公約数*/
long long int lcm(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;

	if (number2 > number1) {
		m = number2;
		n = number1;
	}
	long long int s = -1;
	while (s != 0) {
		s = m % n;
		m = n;
		n = s;
	}
	return m;
}
/*最大公倍数*/
long long int gcd(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;
	return m / lcm(m, n) * n;
}
long long int s[101][101];
int main() {
	int n;
	cin >> n;
	int x[1000];
	int y[1000];
	int h[1000];
	int high = 0;
	for (int i = 0; i < n; i++) {
		cin >> x[i]>> y[i] >> h[i];
	}
	
	for (int i = 0; i < 101; i++) {
		for (int j = 0; j < 101; j++) {
		    int H = 0;
			for (int k = 0; k < n; k++) {
				if (h[k] != 0) {
					H = h[k] + abs(x[k] - i) + abs(y[k] - j);
					break;
				}
			}
			for (int k = 0; k < n; k++) {
				long long int p = max(H - abs(x[k] - i) - abs(y[k] - j),0);
				if (p != h[k]) {
					break;
				}
				if (k == n - 1) {
					cout << i << " " << j <<" "<<H;
				}
			}
		}
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <queue>
#include <cmath>
#include <stdio.h>

#define _ << " " <<
#define debug(x) #x << " = " << x

#define ll long long
#define ull unsigned long long

int main() {
    std::ios::sync_with_stdio(false);

    std::string s;
    std::cin >> s;

    int l = 0, r = 1;

    int n= s.length();

    struct pos {
        int prev;
        int next;

        char val;
    };

    pos a[n * 2];
    for (int i = 0; i < n; i++) {
        a[i].prev = i - 1;
        a[i].next = i + 1;
        a[i].val = s[i];
    }
    for (int i = n; i < 2 * n; i++) a[i].prev = i - 1, a[i].next = i + 1;

    while(r < n) {
        //std::cout << debug(l) _ debug(r) << std::endl;
        //std::cout << debug(a[l].val) _ debug(a[r].val) << std::endl;
        if (a[l].val == 'S' && a[r].val == 'T') {
            a[l].val = a[r].val = 'X';

            if (a[l].prev == -1) {
                a[r].prev = -1;
                l = r;
                r = a[l].next;
            } else {
                l = a[l].prev;
                r = a[r].next;

                a[l].next = r;
                a[r].prev = l;
            }
        } else {
            l = r;
            r = a[r].next;
        }
    }

    int cnt = 0;
    for (int i = 0; i < n; i++) {
        if (a[i].val != 'X')
            ++cnt;
    }
    std::cout << cnt << std::endl;


    return 0;
}

Measured memory_bytes: 5268
from itertools import accumulate
from bisect import bisect_left
def main():
    n,m=map(int,input().split())
    A=list(map(int,input().split()))
    A.sort()
    
    def count(k):
        cnt=0
        for a in A:
            cnt+=bisect_left(A,k-a)
        return cnt
    
    ok=0
    ng=2*10**5+1
    while ng-ok>1:
        mid=(ok+ng)//2
        if count(mid)<n**2-m:
            ok=mid
        else:
            ng=mid
    border=ok
    
    k=n**2-count(border)
    Acc=[0]+list(accumulate(A))
    s=Acc[-1]
    ans=0
    for a in A:
        idx=bisect_left(A,border-a)
        ans+=a*(n-idx)+(s-Acc[idx])
    ans-=border*(k-m)
    print(ans)
    
if __name__=='__main__':
    main()

Measured memory_bytes: 60104
//Code by Mukul Totla
#include<bits/stdc++.h>
using namespace std;
#define ll long long
void sublime(){ 
	#ifndef ONLINE_JUDGE 
    freopen ("input.txt", "r", stdin);
    freopen ("output.txt", "w", stdout);
    #endif
    ios_base::sync_with_stdio(false);
	cin.tie(NULL);
      }
	
int main()
{   
   //sublime();
	  ll n,i;
	   ll d,t,s;
	   cin>>d>>t>>s;
	   double a= (double)d/ (double)s;
	   if(a<=t)
	    cout<<"Yes";
	    else
	    cout<<"No"; 
	   
	return 0;
}

Measured memory_bytes: 3632
#include <stdio.h>
#include <string.h>

int main() {
    char s[100001];
    scanf("%s", s);
    long l = strlen(s);
    while(1) {
        if (strncmp((s+l-5), "dream", 5) == 0) {
            s[l-5] = '\0';
            l -= 5;
        } else if (strncmp((s+l-7), "dreamer", 7) == 0) {
            s[l-7] = '\0';
            l -= 7;
        } else if (strncmp((s+l-5), "erase", 5) == 0) {
            s[l-5] = '\0';
            l -= 5;
        } else if (strncmp((s+l-6), "eraser", 6) == 0) {
            s[l-6] = '\0';
            l -= 6;
        } else 
            break;
    }
    if (l)
        puts("NO");
    else 
        puts("YES");
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main (){
  int A,B,C,D,E,time=0;
  scanf("%d\n%d\n%d\n%d\n%d",&A,&B,&C,&D,&E);
  if (A<0){
    A=A*(-1);
    time=time+A*C;
    A=0;
  }
  if(A==0){
    time=time+D;
  }
  time=time+E*(B-A);
  printf("%d\n",time);
  return 0;
}

Measured memory_bytes: 596
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <iomanip>
#include <vector>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <map>
#include <queue>
#include <climits>
#define rep(i,n) for (int i=0;i<(n);i++)

using namespace std;


int main() {
	int n;
	cin >> n;
	vector<int> a(n);
	vector<int> b(n);
	vector<int> c(n);
	for (int i = 0;i < n;i++) {
		cin >> a[i];
	}
	for (int i = 0;i < n;i++) {
		cin >> b[i];
	}
	for (int i = 0;i < n;i++) {
		cin >> c[i];
	}

	sort(a.begin(), a.end());
	sort(b.begin(), b.end());
	sort(c.begin(), c.end());

	long long ans = 0;
	for (int i = 0;i < n;i++) {
		long long _a = lower_bound(a.begin(), a.end(), b[i]) - a.begin();
		long long c_ = c.end() - upper_bound(c.begin(), c.end(), b[i]);
		ans += _a * c_;
	}


	cout << ans << endl;

	return 0;
}


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

int main() {
	char y[4], z[4];
	int count = 0;
	for (int i = 0; i < 3; i++) {
		cin >> y[i];
	}
	for (int i = 0; i < 3; i++) {
		cin >> z[i];
	}
	for (int i = 0; i < 3; i++) {
		if (y[i] == z[i]) {
			count++;
		}
	}
	cout << count << endl;
	return 0;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); i++)
#define ALL(a) a.begin(), a.end()
#define RALL(a) a.rbegin(), a.rend()
using namespace std;
using ll = long long;
const ll MOD = 1000000007;
const ll INF = MOD * MOD;
const int inf = (1<<29);

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

int main() {

    ll n, s, ans = 0;
    cin >> n >> s;
    
    for(int i = 0; i < n; i++) {
        ll x;
        cin >> x;
        ans = __gcd(ans, abs(s - x));
    }

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define END '\n'
#define int long long
#define pb push_back
#define pii pair<int, int>
#define ff first
#define ss second
#define trace(x) cerr<<x<<END;
#define loop(i, a, b) for(int i = (a); i < (b); i++)
#define loopb(i, b, a) for(int i = (b); i > (a); --i) 
const int mod = 1e9+7;
const int mod1 = 998244353;
const int inf = 92233720ll;
void solve()
 { 
   int a,b;
   cin>>a>>b;
   if(a<=9 && b<=9)
     cout<<(a*b);
   else
     cout<<-1;
 }
signed main()
 {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0); 
   /*int t;
   cin>>t;
   while(t--)*/
     solve();
  //cerr<<END<<1.0*clock();
  return 0;
} 

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

public class Main {

	static int m = 1000000007;

	public static void main(String[] args) throws IOException {
		Scanner scn = new Scanner(System.in);
		int n = scn.nextInt();
		int m = scn.nextInt();
		double a[] = new double[n];
		double s = 0;
		for (int i = 0; i < n; i++) {
			a[i] = scn.nextInt();
			s += a[i];
		}
		double v = s / (4 * m * 1.0);
		int c = 0;
		for (double v1 : a)
			if (v1 >= v)
				c++;
		if (c >= m)
			System.out.println("Yes");
		else
			System.out.println("No");
	}

	static class Scanner {

		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

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

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

Measured memory_bytes: 23252
import java.util.*;
public class Main{
 public static void main(String[] args){
   Scanner sc = new Scanner(System.in);
   char[] c = sc.next().toCharArray();
   boolean b = true;
   Arrays.sort(c);
   for(int i = 1;i<c.length;i++)
   {
     if(c[i]==c[i-1]) 
     {
       b = false;
       break;
     }
   }
   String ans;
   if(b) ans = "yes";
   else ans = "no";
   System.out.println(ans);
 }
}

Measured memory_bytes: 23764
#include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
using namespace std;
signed main(){
    string s;
    cin>>s;
    if(s[5]=='1'||(int)s[6]-(int)'0'>4)cout<<"TBD"<<endl;
    else cout<<"Heisei"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <vector>
#include <complex>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <bitset>
#include <ctime>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cassert>
#include <cstddef>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <sstream>
#include <fstream>

using namespace std;
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define FOR(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define RREP(i, a) for(int (i) = (a) - 1; (i) >= 0; (i)--)
#define FORR(i, a, b) for(int (i) = (a) - 1; (i) >= (b); (i)--)
#define DEBUG(C) cerr << #C << " = " << C << endl;
using LL = long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<LL>;
using VVL = vector<VL>;
using VD = vector<double>;
using VVD = vector<VD>;
using PII = pair<int, int>;
using PDD = pair<double, double>;
using PLL = pair<LL, LL>;
using VPII = vector<PII>;
#define ALL(a) begin((a)), end((a))
#define RALL(a) rbegin((a)), rend((a))
#define SORT(a) sort(ALL((a)))
#define RSORT(a) sort(RALL((a)))
#define REVERSE(a) reverse(ALL((a)))
#define MP make_pair
#define FORE(a, b) for (auto &&a : (b))
#define FIND(s, e) ((s).find(e) != (s).end())
#define EB emplace_back

const int INF = 1e9;
const int MOD = INF+7;
const LL LLINF = 1e18;

VPII a;

int main(void) {
    int K, T;
    cin >> K >> T;
    a.resize(T);
    int mi = INF;
    REP(i, T) {
        cin >> a[i].first;
        a[i].second = i;
    }
    if (T == 1) {
        cout << a[0].first - 1 << endl;
        return 0;
    }
    RSORT(a);
    int mae = -1;
    REP(i, K) {
        if (a.size() <= 1) break;
        if (a.size()>i%2 && mae != a[i%2].second){
            a[i%2].first--; mae = a[i%2].second;
        }else if (mae != a[i%2].second) {
            a[0].first--;mae = a[0].second;
        } else if (a.size()>2){
            a[1].first--;mae=a[1].second;
        }else break;
        if (a.size()>1&&a[i%2].first==0) {
            a.erase(a.begin() + i%2);
            if (a.size()>0&&a[0].first==0) a.erase(a.begin());
            RSORT(a);
        }else if (a.size()!=0&&a[0].first==0){
             a.erase(a.begin());
            RSORT(a);
        }
    }
    if (a.size() == 0) {
        cout << 0 << endl;
    } else {
        int ans = 0;
        FORE(el, a) ans += el.first;
        cout << ans-1 << endl;
    }
}


Measured memory_bytes: 256
#pragma GCC optimize ("O3")

#include <bits/stdc++.h>
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define bcnt __builtin_popcountll
#define dump(x)  cerr << #x << " = " << (x) << endl
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl

using namespace std;

typedef long long ll;
typedef pair<ll,ll> Pll;
typedef pair<int,int> Pin;

ll INF = 10e16;
int inf = 10e8;

template<typename T>
ostream& operator << (ostream& os, const vector<T>& vec) {
    os << "[ ";
    REP(i, vec.size()) {
        os << vec[i] << " ";
    }
    os << "]";

    return os;
}

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

    int E[N][N];
    REP(i, N) REP(j, N) {
        if (i == j) E[i][j] = 0;
        else E[i][j] = inf;
    }

    ll P[N][N];
    REP(i, N) REP(j, N) P[i][j] = 0;

    REP(i, N - 1) {
        int a, b;
        cin >> a >> b;
        --a; --b;
        E[a][b] = 1;
        E[b][a] = 1;
        P[a][b] = 1LL << i;
        P[b][a] = 1LL << i;;
    }

    REP(k, N) {
        REP(i, N){
            REP(j, N){
                if (E[i][j] > E[i][k] + E[k][j]){
                    E[i][j] = E[i][k] + E[k][j];
                    P[i][j] = P[i][k] | P[k][j];
                }
            }
        }
    }

    int M;
    cin >> M;

    int u[M], v[M];
    REP(i, M) {
        cin >> u[i] >> v[i];
        --u[i]; --v[i];
    }

    ll ans = 0;
    REP(i, 1 << M) {
        ll p = 0;

        int s = 0;
        for(int j=i, k=0; j > 0; j >>= 1, ++k) {
            if(j & 1) {
                p |= P[u[k]][v[k]];
                ++s;
            }
        }

        int cnt = bcnt(p);

        if (s % 2) ans -= pow(2, N - cnt -1);
        else ans += pow(2, N - cnt -1);
    }


    cout << fixed << setprecision(20) << ans << endl;

}


Measured memory_bytes: 384