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

int main(){
	int a, b; // a:N-S b:E-W
	std::cin >> a >> b;

	while(a != 0 || b != 0){
		int n; // n:work place
		std::cin >> n;
		std::vector<std::vector<int>> work;
		work.resize(b);

		int buf_x, buf_y;
		for(int i = 0; i < n; ++i){
			std::cin >> buf_x >> buf_y;
			work.at(buf_y - 1).push_back(buf_x - 1);
		}

		std::vector<int> way;
		way.resize(a);
		way[0] = 1;
		for(int i = 0; i < b; ++i){
			for(int j = 0; j < a; ++j){
				if(std::find(work[i].begin(), work[i].end(), j)	== work[i].end()){
					if(j != 0) way[j] += way[j-1];
				}else{
					way[j] = 0;
				}
			}
		}

		std::cout << way[a-1] << std::endl;

		std::cin >> a >> b;
	}


	return 0;
}

Measured memory_bytes: 1212
#include <bits/stdc++.h>
#define FOR(i, a, n) for(ll i = (ll)a; i < (ll)n; i++)
#define FORR(i, n) for(ll i = (ll)n - 1LL; i >= 0LL; i--)
#define rep(i, n) FOR(i, 0, n)
#define ALL(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
template <typename T> using V = vector<T>;
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, m, q;

void sum2D(V<V<int>> &v) {
    int h = v.size(), w = v[0].size();
    rep(i, h) FOR(j, 1, w) v[i][j] += v[i][j - 1];
    rep(j, w) FOR(i, 1, h) v[i][j] += v[i - 1][j];
}

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

    cin >> n >> m >> q;
    V<V<int>> sum1(n + 1, V<int>(m + 1)), sum2 = sum1, sum3 = sum1;

    FOR(i, 1, n + 1) {
        FOR(j, 1, m + 1) {
            char c;
            cin >> c;
            sum1[i][j] = c - '0';
            if(sum1[i][j] && sum1[i - 1][j]) sum2[i][j] = 1;
            if(sum1[i][j] && sum1[i][j - 1]) sum3[i][j] = 1;
        }
    }

    sum2D(sum1);
    sum2D(sum2);
    sum2D(sum3);

    while(q--) {
        int a, b, c, d;
        cin >> a >> b >> c >> d;
        int ans;
        ans = sum1[c][d] + sum1[a - 1][b - 1] - sum1[a - 1][d] - sum1[c][b - 1];
        ans -= sum2[c][d] + sum2[a][b - 1] - sum2[a][d] - sum2[c][b - 1];
        ans -= sum3[c][d] + sum3[a - 1][b] - sum3[a - 1][d] - sum3[c][b];
        cout << ans << "\n";
    }

    return 0;
}

Measured memory_bytes: 49024
#include<bits/stdc++.h>
using namespace std;
int n,k;
string s;
int dp[200009][2];
int main()
{
    cin>>n>>s;
    for(int i=n-1;i>=0;i--)
    {
        if(s[i]=='.')
        {
            dp[i][0]=min(dp[i+1][0],dp[i+1][1]);
            dp[i][1]=1+dp[i+1][1];
        }
        else if(s[i]=='#')
        {
            dp[i][0]=1+min(dp[i+1][0],dp[i+1][1]);
            dp[i][1]=dp[i+1][1];
        }
    }
    cout<<min(dp[0][0],dp[0][1]);
}


Measured memory_bytes: 2180
a, b, c = map(int, input().split())

if a <= b:
    if b <= c:
        print("{0} {1} {2}".format(a, b, c))
    elif c <= a:
        print("{0} {1} {2}".format(c, a, b))
    else:
        print("{0} {1} {2}".format(a, c, b))

else:
    if a <= c:
        print("{0} {1} {2}".format(b, a, c))
    elif c <= b:
        print("{0} {1} {2}".format(c, b, a))
    else:
        print("{0} {1} {2}".format(b, c, a))

Measured memory_bytes: 6724
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
typedef long long ll;
int main() {
  int a,b;
  cin>>a>>b;
  if(a>=2*b)cout<<a-2*b;
  else cout<<0;
}


Measured memory_bytes: 3636
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <functional>
#include <vector>
#define nmax_def 110
using namespace std;
typedef long long ll;


int main() {
	int i, j;
	int N, Xcount = 0;
	string S, ansans;
	bool ans = true;
	cin >> S;
	N = S.length();
	for (i = 0; i < N; i++)
	{
		if (S[i] == 'x')
			Xcount++;
	}
	if (Xcount > 7)
		ans = false;
	ansans = (ans) ? "YES" : "NO";
	cout << ansans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<string>
#include<vector>
#include<set>
#include<cctype>
using namespace std;
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
const long long INF = 1LL << 60;

int main(void){
	ios::sync_with_stdio(false); cin.tie(0);
	
	
	string s;
	cin>>s;
	s[3]='8';
	cout<<s<<endl;
	
	
	return 0;
}

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

const int MOD = 1e9+7; //998244353;
inline int add(int a, int b){ return (a+b)%MOD; }
inline int sub(int a, int b){ return ((a-b)%MOD + MOD)%MOD; }
inline int mul(int a, int b){ return ((ll)a*b)%MOD; }

const int sz = 5e3+5;
int n, pwr[sz/2];
string s;

int getHash(int start, int end){
    int ans = 0;
    for(int i = start; i <= end; ++i){
        ans = add(mul(ans, 26), s[i]-'a');
    }
    return ans;
}

int roll(int hash, int newpos, int len){
    int oldpos = newpos-len;
    return add(mul(sub(hash, mul(pwr[len-1], s[oldpos]-'a')), 26), s[newpos]-'a');
}

bool works(int len){
    for(int gap = 0; gap <= n-len*2; ++gap){
        int hfront = getHash(0, len-1);
        int hback = getHash(len+gap, 2*len-1+gap);
        if(hfront == hback){
            if(s.substr(0, len) == s.substr(len+gap, len)){
                return true;
            }
        }
        for(int i = 2*len+gap; i < n; ++i){
            hfront = roll(hfront, i-len-gap, len);
            hback = roll(hback, i, len);

            if(hfront == hback){
                int frontstart = i-2*len+1-gap, backstart = i-len+1;
                if(s.substr(frontstart, len) == s.substr(backstart, len)){
                    return true;
                }
            }
        }
    }

    return false;
}

void solve(){
    cin >> n >> s;

    pwr[0] = 1;
    for(int i = 1; i <= n/2; ++i) pwr[i] = mul(pwr[i-1], 26);

    int lo = 1;
    int hi = n/2;
    int ans = 0;
    while(lo <= hi){
        int mid = (lo+hi)/2;
        if(works(mid)){
            ans = mid;
            lo = mid+1;
        }
        else hi = mid-1;
    }

    cout << ans << '\n';
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
    return 0;
}

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

int main(){
    int n;
    while(1){
        cin >> n;
        if(n==0) break;
        vector<double> s(n);
        double ave=0;
        for(int i=0; i<n; i++){
            cin >> s[i];
            ave+=s[i];
        }
        ave/=n;
        double sigma2=0;
        for(int i=0; i<n; i++){
            sigma2+=(s[i]-ave)*(s[i]-ave);
        }
        sigma2/=n;
        printf("%.12lf\n",sqrt(sigma2));
    }   
    return 0;
}


Measured memory_bytes: 3304
import sys
from collections import defaultdict, Counter, deque
from itertools import accumulate, permutations, combinations
from operator import itemgetter
from bisect import bisect_left, bisect_right, bisect
from heapq import heappop, heappush
from fractions import gcd
from math import ceil, floor, sqrt, cos, sin, pi
from copy import deepcopy

# If you use recursive call, uncomment this code
#sys.setrecursionlimit(10**6)

def main():
    a,b,h,m = map(int, input().split())
    theta = (m/60 - (60*h+m)/(60*12)) * 2 * pi
    print(sqrt(a**2+b**2-2*a*b*cos(theta)))

if __name__ == '__main__':
    main()


Measured memory_bytes: 10896
using System;
class AOJ
{
    public static void Main()
    {
  
        while (true)
        {
          
String[] st=Console.ReadLine().Split(' ');
            int a = int.Parse(st[0]);
int b=int.Parse(st[1]);
            if (a==0&&b == 0)
                break;
int oki;
if(a>b){
oki=a;
a=b;
b=oki;

}

            Console.WriteLine(a+" "+b);
        
}


    }

}

Measured memory_bytes: 9292
#include<cstdio>
#include<cmath>
#include<iostream>
#include<algorithm>
using namespace std;
int func(int x,int y,int depth){
    if(x<y)swap(x,y);
    if(depth%2==0){
        if(x<2&&y<2)return -1;
        int ma=-1;
        for(int i=1;i<=x/2;i++)ma=max(ma,func(x-i*2,y+i,depth+1));
        for(int i=1;i<=y/2;i++)ma=max(ma,func(x+i,y-i*2,depth+1));
        return ma;
    }
    else{
        if(x<2&&y<2)return 1;
        int mi=1;
        for(int i=1;i<=x/2;i++)mi=min(mi,func(x-i*2,y+i,depth+1));
        for(int i=1;i<=y/2;i++)mi=min(mi,func(x+i,y-i*2,depth+1));
        return mi;
    }
}
int main(){
    long long int N,M;
    cin>>N>>M;
    /*
    for(int i=0;i<=10;i++){
        for(int j=0;j<=10;j++){
            printf("[%d]",func(i,j,0));
        }
        cout<<endl;
    }
    */
    if(abs(N-M)<2)puts("Brown");
    else puts("Alice");
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;
#define ep emplace_back
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)
#define all(v) v.begin(), v.end()
#define revall(v) v.rbegin(), v.rend()
constexpr int mod=1000000007;
constexpr int mod1=998244353;
vector<int> dx={0,1,0,-1},dy={-1,0,1,0};
bool inside(int y,int x,int h,int w){ if(y<h && y>=0 && x<w && x>=0) return true; return false; }
template<class T> inline bool chmin(T& a, T b){ if(a > b){ a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b){ if(a < b){ a = b; return true; } return false; }






int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll a,b,k;cin >> a >> b >> k;
	ll t = max(a - k, 0LL);
	k -= a;
	a = t;
	if(k > 0) b = max(b - k, 0LL);
	cout << a << " " << b << endl;
}


Measured memory_bytes: 256
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
// #include <atcoder/all>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(a) (a).begin(), (a).end()
using namespace std;
// using namespace atcoder;
using ll = long long;
using P = pair<int, int>;
const int mod = 1e9 + 7;
// --------------------------------------------------------------------------------
void solve()
{
    int a, b;
    cin >> a >> b;
    for (int i = 0;; i++)
    {
        if (b == 1)
        {
            cout << 0 << endl;
            break;
        }
        if (b <= a * (i + 1) - i)
        {
            cout << i + 1 << endl;
            break;
        }
    }
}
// --------------------------------------------------------------------------------
int main()
{
    // srand((unsigned)time(NULL));
    // int bt = clock();
    solve();
    // double et = 1.0 * (clock() - bt) / CLOCKS_PER_SEC;
    // printf("Execution Time: %.4lf sec\n", et);
    return 0;
}

Measured memory_bytes: 3624
import java.util.*;
 
public class Main {
	public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
        for(int i = 1; i <= 5; i++){
        	int n = sc.nextInt();
            if(n == 0){
            	System.out.println(i);
                return;
            }
        }
    }
}

Measured memory_bytes: 35740
var
  a,b,s:int64;
  i:longint;
begin
  readln(a,b);
  if abs(a-b)>1 then begin writeln(0);exit;end;
  s:=1;
  if a=b then s:=s*2;
  for i:=1 to a do s:=s*i mod 1000000007;
  for i:=1 to b do s:=s*i mod 1000000007;
  writeln(s);
end.

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

#define ll long long
#define mod 1000000007
#define ffor(i,a,b) for(int i=a;i<b;i++)
#define bfor(i,a,b) for(int i=a-1;i>=b;i--)


int main()
{
	string s;
	cin>>s;
	int a=0,b=0;
	ffor(i,0,(int)s.size())
	{
		if(s[i]=='0') a++;
		else b++;
	}
	cout<<min(a,b)*2<<endl;
	return 0;
}


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

int main () {
  int A, B;
  cin >> A >> B;
  int sum = 0, i = A;
  while( i <= B){
  int a,b,c,d,e;
    a = A % 10;
    b = ((A - a) / 10) % 10;
    c = ((A - 10 * b - a) / 100) % 10;
    d = ((A - 100 * c - 10 * b - a) / 1000) % 10;
    e = ((A - 1000 * d - 100 * c - 10 * b - a) / 10000) % 10;
    i++;
    A++;
    if (a == e && b == d ){
      sum++;
    }
  }
  cout << sum << endl;
}


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

int main() {
  int n,m;
  cin>>n>>m;
  vector<int> l(m);
  vector<int> r(m);
  for (int i=0;i<m;++i) {
    cin>>l[i]>>r[i];
  }
  sort(l.begin(), l.end());
  sort(r.begin(), r.end());
  if (r[0]>=l[m-1]) {
    int num=r[0]-l[m-1]+1;
    cout<<num<<endl;
  } else {
    cout<<0<<endl;
  }
}


Measured memory_bytes: 1024
#include <algorithm>
#include <bits/stdc++.h>
#include <cstdint>
#include <iostream>
#include <iterator>
#include <vector>

// lib/util.hpp
#ifndef UTIL_HPP
#define UTIL_HPP


typedef std::int_fast64_t i64;

namespace tools {
  template <typename T>
  void read(std::vector<T>& vector, const typename std::vector<T>::size_type size) {
    vector.reserve(size);
    std::copy_n(std::istream_iterator<T>(std::cin), size, std::back_inserter(vector));
  }

  template <typename T, std::size_t N>
  void read(std::array<T, N>& array) {
    std::copy_n(std::istream_iterator<T>(std::cin), N, array.begin());
  }
}

#endif

// main.cpp

int main() {
  std::string s;
  i64 K;
  std::cin >> s >> K;

  const i64 n = s.size();
  std::set<std::string> substrings;
  for (i64 i = 1; i <= K; ++i) {
    for (i64 j = 0; j <= n - i; ++j) {
      substrings.insert(s.substr(j, i));
    }
  }

  std::set<std::string>::iterator it = substrings.begin();
  for (i64 i = 1; i < K; ++i) ++it;
  std::cout << *it << std::endl;
  return 0;
}

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

typedef long long ll;
const int N = 1e5 + 100;

ll n, a[N];

int main() {
	ios::sync_with_stdio(false), cin.tie(0);
	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> a[i];
	sort(a, a + n);
	for (int i = 1; i < n; i++)
		a[i] += a[i - 1];
	int bad = -1;
	for (int i = n - 2; i >= 0; i--)
		if (2 * a[i] < a[i + 1]) {
			bad = i;
			break;
		}
	int p = 0;
	for (int i = 0; i < n; i++) {
		p = max(p, i);
		while ((p + 1) < n && 2 * a[p] >= (a[p + 1] - a[p]))
			p++;
		if (p > bad) {
			cout << n - i << '\n';
			return 0;
		}
	}
}


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

int main()
{
	int n, m, d;
	cin >> n >> m >> d;
	if ( d == 0 ) {
		printf("%.10f\n", 1.0 / n * (m - 1));
	} else {
		printf("%.10f\n", (n - d) * 2.0 / n / n * (m - 1));
	}
	return ( 0 );
}


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

using namespace std;
typedef long long ll;

int main(){
  ll N, tmp;
  cin >> N;
  vector<ll> A;
  ll X = 0;
  for (ll i=0; i<N; i++){
    cin >> tmp;
    A.push_back(tmp);
    X ^= tmp;
  }
  for (int i=0; i<N; i++){
    cout << (X ^ A[i]) << " ";
  }
  cout << "\n";
  return 0;
}

Measured memory_bytes: 5360
n = int(input())
a = list(map(int, input().split()))
q = int(input())
bc = [ list(map(int, input().split()) ) for i in range(q) ]

from collections import Counter, defaultdict

ca = Counter(a)

suma = sum(a)
diff = 0
d = defaultdict(int)

for x in bc:
  d[x[0]] = d[x[1]]
  suma += ca[x[0]] * (x[1] - x[0])
  ca[x[1]] += ca[x[0]]
  ca[x[0]] = 0
  print(suma)

Measured memory_bytes: 115732
#include<iostream>
#include<cstdio>
#include<string>

using namespace std;

int main(void)
{
    int k;
    string s;
    cin>>k>>s;
    if(k>=s.length()) cout<<s<<endl;
    else
    {
        for(register int i=0;i<k;++i)
            putchar(s[i]);
        puts("...");
    }
    return 0;
}

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

int main(){
    int n;
    cin >> n;
    vector<int> d(n);
    rep(i, n) cin >> d[i];
    sort(d.begin(), d.end());
    cout << d[n/2] - d[n/2 - 1] << endl;
    return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
#define ff first
#define ss second
#define pb push_back
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
#define rep(i,a,b) for(int i=a;i<=b;++i)
#define rrep(i,a,b) for(int i=a;i>=b;--i)
#define fastio() ios::sync_with_stdio(0);cin.tie(0);
#define nl "\n"
#define wi(x) cerr << #x << " is " << x << nl

void solve(){
	ll n; cin>>n;
	char res[5000];
    int i = 0; 
  
    while (n > 0) { 
        int rem = n % 26; 
 
        if (rem == 0) { 
            res[i++] = 'z'; 
            n = (n / 26) - 1; 
        } 
        else 
        { 
            res[i++] = (rem - 1) + 'a'; 
            n = n / 26; 
        } 
    } 
    res[i] = '\0'; 
    reverse(res,res + strlen(res)); 
    cout << res; 
  
}

int main(){
	fastio()
	
	int T=1;
	//int T; cin>>T;
	while(T--) solve();

	return 0;
}


Measured memory_bytes: 3644
//#pragma GCC         optimize("O3")
#include            <bits/stdc++.h>
#include            <ext/pb_ds/assoc_container.hpp>
#include            <ext/pb_ds/tree_policy.hpp>
#define FastIO      ios_base::sync_with_stdio(0);cin.tie(0),cout.tie(0)
#define pb          push_back
#define eb          emplace_back
#define mp          make_pair
#define mem(x,i)    memset(x,i,sizeof(x))
#define ff          first
#define ss          second
#define popcount(x) __builtin_popcount(x)
#define all(x)      x.begin(),x.end()
#define Case(t)     for(int ks=1;ks<=t;ks++)
#define fileout     freopen("output.txt","w",stdout)
#define filein      freopen("input.txt","r",stdin)
#define D(x)        cerr<< __LINE__ <<": "<< #x << " = "<<(x) <<'\n';
#define E(x,y)      cerr<< __LINE__ <<": "<< #x << " = "<<(x)<<' '<< #y << " = "<<(y) <<'\n';
#define endl        '\n'
///Input-Output
#define si(x)       scanf("%d",&x)
#define sii(x,y)     scanf("%d%d",&x,&y)
#define sl(x)       scanf("%lld",&x)
#define sll(x,y)     scanf("%lld%lld",&x,&y)
///
using namespace std;
using namespace __gnu_pbds;

using ll  = long long;
using ld  = long double;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using pil = pair<int,ll>;


const int INF    = 0x3f3f3f3f;
const ll LL_INF  = 0x3f3f3f3f3f3f3f3f;
const double PI  = acos(-1.0);
const double eps = 1e-8;
const int mod    = 1e9+7;
const int mx     = 200005;
const int lg     = 26;

template <typename T>  using orderedSet =
    tree<T, null_type, less_equal<T>,
    rb_tree_tag, tree_order_statistics_node_update>;//find_by_order,order_of_key*/

/*------------------------------Graph Moves----------------------------*/
//const int fx[]= {+1,-1,+0,+0};
//const int fy[]= {+0,+0,+1,-1};
//const int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};   // Kings Move
//const int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};  // Kings Move
//const int fx[]={-2, -2, -1, -1,  1,  1,  2,  2};  // Knights Move
//const int fy[]={-1,  1, -2,  2, -2,  2, -1,  1}; // Knights Move
/*---------------------------------------------------------------------*/

//ll powmod(ll a,ll b){ll res=1;a%=mod;assert(b>=0);for(; b; b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
/*----------------------BitMask-----------------------------------------*/
//inline int setBit(int N,int pos){return N=N | (1<<pos);}
//inline int resetBit(int N,int pos){return N= N & ~(1<<pos);}
//inline bool checkBit(int N,int pos){return (bool) (N& (1<<pos));}


///----------------Start------------------///
vector<int>adj[100005];
bool vis[100005];
void dfs(int u)
{
    vis[u]=1;
    for(int v:adj[u])
    {
        if(!vis[v]) dfs(v);
    }
}
int main()
{
    int n,m;
    cin>>n>>m;
    for(int i=0;i<m;i++)
    {
        int u,v;
        sii(u,v);
        adj[u].pb(v);
        adj[v].pb(u);
    }
    int ans = 0;
    for(int i=1;i<=n;i++)
    {
        if(!vis[i])
        {
            ans++;dfs(i);
        }
    }
    cout<<ans-1<<endl;
}



Measured memory_bytes: 9740
#include<stdio.h>

int main(void){
	int a[32]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51},N;
	scanf("%d",&N);
	printf("%d",a[N-1]);
	return 0;
}

Measured memory_bytes: 128
import java.util.*;

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

        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++) {
                numbers[i][j] = sc.nextInt();
            }
        }

        int n = sc.nextInt();
        for (int i = 0; i < n; i++) {
            int b = sc.nextInt();
            for (int j = 0; j < 3; j++) {
                for (int k = 0; k < 3; k++) {
                    if (numbers[j][k] == b) {
                        numbers[j][k] = 0;
                        break;
                    }
                }
            }
        }

        // 横判定
        for (int i = 0; i < 3; i++) {
            if (numbers[i][0] == 0 && numbers[i][1] == 0 && numbers[i][2] == 0) {
                System.out.println("Yes");
                return;
            }
        }

        // 縦判定
        for (int i = 0; i < 3; i++) {
            if (numbers[0][i] == 0 && numbers[1][i] == 0 && numbers[2][i] == 0) {
                System.out.println("Yes");
                return;
            }
        }

        // 斜め判定
        if (numbers[0][0] == 0 && numbers[1][1] == 0 && numbers[2][2] == 0) {
            System.out.println("Yes");
            return;
        }
        if (numbers[2][0] == 0 && numbers[1][1] == 0 && numbers[0][2] == 0) {
            System.out.println("Yes");
            return;
        }

        System.out.println("No");
    }
}

Measured memory_bytes: 22612
#include <iostream>

using namespace std;

int main()
{
	long long int x,a,b;
	cin >> x >> a >> b;
	
	if(b-a<=0){
		cout << "delicious" << endl;
	}else{
		if(b-a<=x){
			cout << "safe" << endl;
		}else{
			cout << "dangerous" << endl;
		}
	}
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <string>

using namespace std;

const int INF = 1e9;

int main() {
  ios::sync_with_stdio(false);
  string s;
  cin >> s;
  int a = s[0] - '0';
  int b = s[1] - '0';
  int c = s[2] - '0';
  int d = s[3] - '0';

  for (int i=0; i<8; i++) {
    int sum = a;
    char op[4] = "---";
    if (i & (1 << 2)) {
      sum += b;
      op[0] = '+';
    } else {
      sum -= b;
    }
    if (i & (1 << 1)) {
      sum += c;
      op[1] = '+';
    } else {
      sum -= c;
    }
    if (i & 1) {
      sum += d;
      op[2] = '+';
    } else {
      sum -= d;
    }
    if (sum == 7) {
      cout << a << op[0] << b<<op[1]<<c<<op[2]<<d<<"=7";
      break;
    }
  }
}

Measured memory_bytes: 504
#include<iostream>
#include <string>
#include<algorithm>
#include <set>
#include <cmath>
using namespace std;


int main(void){
	ios::sync_with_stdio(false);
	int N, M, i, j, k;
	cin >> N >> M;
	int X[M];
	for (i = 0; i < M; i++) cin >> X[i];
	sort(X, X + M);
	k = X[M - 1] - X[0];
	if (N >= M)cout << "0";
	else if (N == 1)cout << k;
	else {
		int dX[M - 1];
		for (i = 0; i < M - 1; i++) dX[i] = X[i + 1] - X[i];
		sort(dX, dX + M - 1, greater<int>());
		for (i = 0; i < N - 1; i++) {
			k -= dX[i];
		}
		cout << k;
	}
	return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <set>
#include <algorithm>
#include <vector>

using namespace std;

typedef pair<int, pair<int, int>> eve;

int main(){
    int N, Q;
    cin >> N >> Q;
    
    int S[N], T[N], X[N];
    for(int i=0; i<N; i++){
        cin >> S[i] >> T[i] >> X[i];
    }

    int ans[Q];
    vector<eve> el;
    for(int i=0; i<Q; i++){
        int d;
        cin >> d;
        eve a = make_pair(d, make_pair(1, i));
        el.push_back(a);
        ans[i] = -1;
    }

    for(int i=0; i<N; i++){
        eve a = make_pair(S[i]-X[i], make_pair(0, X[i]));
        eve b = make_pair(T[i]-X[i], make_pair(-1, X[i]));
        el.push_back(a);
        el.push_back(b);
    }
    sort(el.begin(), el.end());

    int j = 0;
    set<int>  s;
    for(auto it = el.begin(); it!=el.end(); it++){
        if((it->second).first == 0) s.insert((it->second).second);
        if((it->second).first == -1) s.erase((it->second).second);
        if((it->second).first == 1 && !s.empty()) {
            if(ans[(it->second).second] == -1){
                ans[(it->second).second] = *s.begin();
            }
        }
    }

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

    return 0;
}


Measured memory_bytes: 22504
function main(input) {
  input = input.trim();
  const a = input.split(' ');
  
  if(a[1]=='+'){
    console.log(parseInt(a[0])+parseInt(a[2]))
  }else if(a[1]=='-'){
    console.log(parseInt(a[0])-parseInt(a[2]))
  }
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));


Measured memory_bytes: 30588
#include <bits/stdc++.h>
#define fup(i,a,b) for(int i=a;i<=b;++i)
#define fdw(i,a,b) for(int i=a;i>=b;--i)
#define sync ios::sync_with_stdio(false);cin.tie(0)
#define cl(a) memset(a,0,sizeof(a))
#define gcd __gcd
#define fi first
#define se second
#define pb push_back
#pragma GCC optimize(2)
using namespace std;
typedef long long ll;
//ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
//ll ksm(ll a,ll b,ll mod){ll res=1;a%=mod;for(;b;b>>=1){if(b&1) res=res*a%mod;a=a*a%mod;}return res;}
//ll oula(ll n){ ll res=n;for(ll i=2;i*i<=n;i++){if(n%i==0){ res=res-res/i;while(n%i==0) n/=i;}}if(n>1) res=res-res/n;return res;}
//bool MRT(ll x){if(x==2)return true;fup(i,1,50){ll now=rand()%(x-2)+2;if(ksm(now,x-1,x)!=1)return false;}return true;}
//void shai(int n)fup(i,2,n){if(isprime[i]){v.push_back(i);for(int j=2*i;j<=10000;j+=i)isprime[j]=0;}}//"埃氏筛筛选素数"
const int mod=1e9+7;
const int inf=0x3f3f3f3f;
const double eps=1e-7;
const int N=4e5+10;
int main()
{

    sync;
    ll n,a,b;
    cin>>n>>a>>b;
    ll tmp=n/(a+b),tmp1=n%(a+b);
    ll ans=0;
    if(tmp1<=a)
    {
        ans=tmp*a+tmp1;
    }else ans=tmp*a+a;
    cout<<ans<<endl;
    return 0;
}

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

const int MAX_W = 1000;
const int INF = 1000000;
char map[MAX_W][MAX_W];
int costs[MAX_W][MAX_W];
int times[MAX_W][MAX_W];

int dx[] = {0,1,0,-1};
int dy[] = {-1,0,1,0};
struct State {
  int x;
  int y;
  int cost;
  State(int x, int y, int cost) : x(x), y(y), cost(cost) {}
  const bool operator< (const State& other) const {
    return cost > other.cost;
  }
  const bool operator> (const State& other) const {
    return cost < other.cost;
  }
};
int main() {
  int w, h;
  cin >> w >> h;
  for (int i = 0; i < h; i++) {
//    cin >> map[i];
    for (int j = 0; j < w; j++) {
      cin >> map[i][j];
      costs[i][j] = INF;
      times[i][j] = INF;
    }
  }
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    int x, y;
    cin >> x >> y;
    times[y][x] = min(times[y][x], i);
  }
  priority_queue<State> pq;
  pq.push(State(0, 0, 0));
  while (!pq.empty()) {
    State s = pq.top();
    pq.pop();
    if (costs[s.y][s.x] != INF) {
      continue;
    }
    
    costs[s.y][s.x] = s.cost;
//    cout << "cost=" << s.cost << ", xy=" << s.x << "," << s.y << endl;
    for (int i = 0; i < 4; i++) {
      int nextX = s.x + dx[i];
      int nextY = s.y + dy[i];
      if (0 <= nextX && nextX < w && 0 <= nextY && nextY < h) {
        if (map[nextY][nextX] == 't') {
          cout << s.cost << endl;
          return 0;
        }
        int time = map[nextY][nextX] == '#' ? times[nextY][nextX] : 0;
        int cost = max(time, s.cost);
        if (cost != INF) {
  //        cout << "push:" << cost << ", "<< i<<endl;
          pq.push(State(nextX, nextY, cost));
        }
      }
    }
  }
  cout << -1 << endl;
  return 0;
}

Measured memory_bytes: 28000
import java.util.*;
class Main {
    public static void main(String args[]){
    	Scanner sc = new Scanner(System.in);
      	int N = sc.nextInt();
      	int M = sc.nextInt();
      	for(int i = 0; i<M; i++){
        	N -= sc.nextInt();
        }
      	if (N<0){
          System.out.println(-1);
        }else System.out.println(N);
    
    }
}

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

using ll = long long;
using Pi = pair<int, int>;
using Pl = pair<ll, ll>;
using vint = vector<int>;
using vvint = vector<vint>;
using vvvint = vector<vvint>;
using vdouble = vector<double>;
using vvdouble = vector<vdouble>;
using vvvdouble = vector<vvdouble>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using uint = unsigned int;
using ull = unsigned long long;

template<typename T> using uset = unordered_set<T>;
template<typename T1, typename T2> using umap = unordered_map<T1, T2>;

constexpr int INF = (1 << 30) - 1;
constexpr ll LLINF = 1LL << 60;
constexpr int dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
constexpr int dx[] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr char el = '\n';
constexpr int mod = 1000000007;
constexpr int mod2 = 998244353;
template<typename T> T gcd(T a, T b) { return (b ? gcd(b, a % b) : a); }
template<typename T> T lcm(T a, T b) { return (a / gcd(a, b) * b); }
template<typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) { return (a > b && (a = b, true)); }
template<typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) { return (a < b && (a = b, true)); }
template<typename T>
bool isin(T y, T x, T h, T w) { return (0 <= y && 0 <= x && y < h && x < w); }
template<typename T>
bool isin1(T y, T x, T h, T w) { return (0 < y && 0 < x && y <= h && x <= w); }

template<typename T>
ostream& operator <<(ostream &os, vector<T> &v) {
	os << v[0];
	for (int i = 1; i < v.size(); i++) os << " " << v[i];
	return (os);
}

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

template<typename T1, typename T2>
istream& operator >>(istream &is, pair<T1, T2> &p) {
	return (is >> p.first >> p.second);
}


void Main() {
	long double A, B; cin >> A >> B;
	cout << (ull)floor(A*B) << endl;
}

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


Measured memory_bytes: 3752
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

const (
	initialBufSize = 1e4
	maxBufSize     = 1e6 + 7
)

var buf []byte = make([]byte, maxBufSize)
var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(buf, maxBufSize)
}

func main() {
	N := nextInt()
	kinds := make(map[string]int)
	for i := 0; i < N; i++ {
		kinds[nextLine()]++
	}
	fmt.Println(len(kinds))
}

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}


Measured memory_bytes: 19376
import java.util.*;

public class Main {


    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int h = sc.nextInt();
        int w = sc.nextInt();
        int[] a = new int[h];
        int[] b = new int[h];

        for(int i=0; i<h; i++) {
            a[i] = sc.nextInt()-1;
            b[i] = sc.nextInt()-1;
        }

        TreeMap<Integer, Integer> map = new TreeMap<>();
        Counter counter = new Counter();

        for(int i=0; i<w; i++) {
            map.put(i, 0);
        }
        counter.map.put(0, w);
        counter.map.put(w, 1);
        for(int i=0; i<h; i++) {
            Integer key;
            int rmin = w;
            while((key = map.ceilingKey(a[i])) != null && key <= b[i]) {
                rmin = Math.min(rmin, map.get(key) + b[i]+1-key);
                counter.remove(map.get(key));
                map.remove(key);
            }
            if(b[i]+1<w) {
                if (map.containsKey(b[i] + 1)) {
                    counter.remove(map.get(b[i] + 1));
                    int num = Math.min(rmin, map.getOrDefault(b[i] + 1, w));
                    map.put(b[i] + 1, num);
                    counter.add(num);
                } else {
                    map.put(b[i] + 1, rmin);
                    counter.add(rmin);
                }
            }
            int min = counter.head();
            if(min == w) {
                System.out.println(-1);
            } else {
                System.out.println(min + i + 1);
            }
        }

    }

    static class Counter {
        TreeMap<Integer, Integer> map = new TreeMap<>();

        void add(Integer key) {
            map.put(key, map.getOrDefault(key, 0)+1);
        }
        void remove(Integer key) {
            int num = map.get(key);
            if(num == 1) {
                map.remove(key);
            } else {
                map.put(key, num-1);
            }
        }

        Integer head() {
            return map.firstKey();
        }
    }



}




Measured memory_bytes: 81172
def solve():
    N,K = [int(i) for i in input().split()]
    H = [int(i) for i in input().split()]

    if K >= len(H):
        print('0')
    else:
        sorted_H = sorted(H)
        alived = N - K
        print(sum(sorted_H[:alived]))

if __name__ == "__main__":
    solve()

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

using namespace std;

int main(void) {
    int n;
    cin >> n;
    vector<int> l(n);
    int count = 0;
    
    for(int i = 0; i < n; i++){
        cin >> l.at(i);
    }
    // sort(l.begin(), l.end());
    // l.erase(unique(l.begin(), l.end()), l.end());
    // for(int i = 0; i < (int)l.size(); i++){
    //     cout << l.at(i) << " ";
    // }
    // cout << "" << endl;

    for(int i = 0; i < n; i++){
        for(int j = i + 1; j < n; j++){
            for(int k = j + 1; k < n; k++){
                // cout << i << " " << j << " " << k << endl;
                if(l.at(i) + l.at(j) > l.at(k) && l.at(j) + l.at(k) > l.at(i) && l.at(k) + l.at(i) > l.at(j) && l.at(i) != l.at(j) && l.at(j) != l.at(k) && l.at(k) != l.at(i)){
                    // cout << i << " " << j << " " << k << endl;
                    count += 1;
                }
            }
        }
    }
    cout << count << endl;
    return 0;
}


Measured memory_bytes: 3624
lenght = int(input())
allNum = input().split()
denied = False
for i in allNum:
  i = int(i)
  if(i % 2 == 0):
    if(i % 3 == 0 or i % 5 == 0):
      continue
    else:
      denied = True
      break
if(denied):
  print("DENIED")
else:
  print("APPROVED")

Measured memory_bytes: 2940
//{{{
#include<algorithm>
#include<cmath>
#include<deque>
#include<fstream>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<random>
#include<set>
#include<sstream>
#include<sys/time.h>
#include<unordered_map>
#include<unordered_set>
#include<vector>
using ll = long long;
enum : int { M = (int)1e9 + 7 };
enum : ll { MLL = (ll)1e18L + 9 };
using namespace std;
#ifdef LOCAL
#include"rprint2.hpp"
#else
#define FUNC(name) template <ostream& out = cout, class... T> void name(T&&...){ }
FUNC(printde) FUNC(printdbe) FUNC(printdwe) FUNC(printdu);
#endif
template <template <class T, class = std::allocator<T>> class V, class E>
istream& operator >> (istream& in, V<E>& v){ for(auto& e : v){ in >> e; } return in; }
//}}}

int main(){
    cin.tie(0); ios::sync_with_stdio(false);
    ll a, b;
    cin >> a >> b;
    vector<ll> cs;
    cs.push_back(1);
    for(int i = 2; i <= 1e6; i++){
        if(a % i == 0 && b % i == 0){
            cs.push_back(i);
        }
        while(a % i == 0){
            a /= i;
        }
        while(b % i == 0){
            b /= i;
        }
    }
    if(a != 1 && a == b){
        cs.push_back(a);
    }
    printde(cs);
    cout << cs.size() << '\n';
}


Measured memory_bytes: 888
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class MainClass
{
	public const long Giri = 1000000007;
	
	public static void Main(string[] args)
	{
		int n = Console.ReadLine().ToInt();
		int max6 = (int)Math.Log(n, 6)+2;
		int max9 = (int)Math.Log(n, 9)+2;
		
		long[] dp = new long[n+2];
		for(int i = 0; i < n+1; i++)
			dp[i]=999999999;
		dp[0] = 0;
		//dp[i] = i会の操作で最小の回数
		for(int i = 0; i <= n;i++)
		{
			dp[i+1] = Math.Min(dp[i] + 1, dp[i+1]);
			int pow = 1;
			for(int j = 1; j < max6; j++)
			{
				pow *= 6;
				int k = pow;
				if(i+k>=n+1) break;
				dp[i+k] = Math.Min(dp[i] + 1, dp[i+k]);
			}
			pow = 1;
			for(int j = 1; j < max9; j++)
			{
				pow *= 9;
				int k = pow;
				if(i+k>=n+1) break;
				dp[i+k] = Math.Min(dp[i] + 1, dp[i+k]);
			}
		}
		Console.WriteLine(dp[n]);
	}
	
	static long GCD(long a, long b)
	{
		var v = new[] { a, b };
		while (v[1] != 0) { v = new[] { v[1], v[0] % v[1] }; }
		return v[0];
	}
	public static string[] Input() { return Console.ReadLine().Split(' '); }
	public static int Clamp(int val, int max, int min = 0) { return Math.Min(max, Math.Max(min, val)); }
}

public static class Smarter
{
	public static int ToInt(this string str) { return int.Parse(str); }
	public static long ToLong(this string str) { return long.Parse(str); }
	public static int[] ToInt(this string[] str)
	{
		int[] r = new int[str.Length];
		for(int i = 0; i < str.Length; i++) r[i] = str[i].ToInt();
		return r;
	 }
	
}

Measured memory_bytes: 13180
#![allow(non_snake_case, unused_imports)]

// Input
macro_rules! input { (source = $s:expr, $($r:tt)*) => { let mut iter = $s.split_whitespace(); let mut next = || { iter.next().unwrap() }; input_inner!{next, $($r)*} }; ($($r:tt)*) => { let stdin = std::io::stdin(); let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock())); let mut next = move || -> String{ bytes.by_ref().map(|r|r.unwrap() as char).skip_while(|c|c.is_whitespace()).take_while(|c|!c.is_whitespace()).collect() }; input_inner!{next, $($r)*} }; }
macro_rules! input_inner { ($next:expr) => {}; ($next:expr, ) => {}; ($next:expr, $var:ident : $t:tt $($r:tt)*) => { let $var = read_value!($next, $t); input_inner!{$next $($r)*} }; ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => { let mut $var = read_value!($next, $t); input_inner!{$next $($r)*} }; }
macro_rules! read_value { ($next:expr, ( $($t:tt),* )) => { ( $(read_value!($next, $t)),* ) }; ($next:expr, [ $t:tt ; $len:expr ]) => { (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>() }; ($next:expr, [ $t:tt ]) => { { let len = read_value!($next, usize); (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>() } }; ($next:expr, chars) => { read_value!($next, String).chars().collect::<Vec<char>>() }; ($next:expr, bytes) => { read_value!($next, String).into_bytes() }; ($next:expr, usize1) => { read_value!($next, usize) - 1 }; ($next:expr, $t:ty) => { $next().parse::<$t>().expect("Parse error") }; }

// Module
use std::cmp::{min,max};
use std::collections::{HashSet,HashMap,BTreeMap,VecDeque};

// Functions

// Main
fn main(){
    input!{
        Sa: chars,
        Sb: chars,
        Sc: chars,
    }

    let mut mapS = HashMap::new();
    mapS.insert('a',Sa);
    mapS.insert('b',Sb);
    mapS.insert('c',Sc);
    let mut mapI = HashMap::new();
    mapI.insert('a',0);
    mapI.insert('b',0);
    mapI.insert('c',0);

    let mut c = 'a';
    while mapI[&c] < mapS[&c].len(){
        *mapI.entry(c).or_insert(0) += 1;
        c = mapS[&c][*mapI.entry(c).or_insert(0) -1];
    }

    println!("{}", c.to_string().to_uppercase());
}


Measured memory_bytes: 4352
def partition(A, p, r):
    x = A[r][1]
    i = p - 1
    for j in range(p, r):
        if A[j][1] <= x:
            i += 1
            tmp = A[i]
            A[i] = A[j]
            A[j] = tmp
    tmp = A[i + 1]
    A[i + 1] = A[r]
    A[r] = tmp
    return i + 1


def quickSort(A, p, r):
    if p < r:
        q = partition(A, p, r)
        quickSort(A, p, q - 1)
        quickSort(A, q + 1, r)


def resolve():
    from collections import defaultdict, deque
    n = int(input())
    A = []
    chk = defaultdict(deque)
    for _ in range(n):
        a, b = input().split()
        b = int(b)
        A.append([a, b])
        chk[b].append(a)
    quickSort(A, 0, len(A) - 1)
    for a, b in A:
        if chk[b].popleft() != a:
            print("Not stable")
            break
    else:
        print("Stable")
    for a in A:
        print(*a)


resolve()



Measured memory_bytes: 35372
x = 0
y = 0
bd = 0

loop do
  step, dir = gets.chomp.split(',').map(&:to_i)

  break if step.zero? && dir.zero?

  rad = bd * Math::PI / 180
  x += step * Math.sin(rad)
  y += step * Math.cos(rad)
  bd += dir
end

puts x.to_i
puts y.to_i

Measured memory_bytes: 9012
#include <iostream>

template<std::size_t N, std::size_t... Rest>
struct Array_impl {
    static constexpr auto& value = Array_impl<N - 1, N * N * N, Rest...>::value;
};

template<std::size_t... Rest>
struct Array_impl<0, Rest...> {
    static constexpr std::size_t value[] = { 0, Rest... };
};

template<std::size_t... Rest>
constexpr std::size_t Array_impl<0, Rest...>::value[];

template<std::size_t N>
struct Array {
    static_assert(N >= 0, "N must be at least 0");
    static constexpr auto& value = Array_impl<N>::value;
    Array() = delete;
    Array(const Array&) = delete;
    Array(Array&&) = delete;
};

namespace {
constexpr std::size_t MAX_INPUT {100};
}

int main() {
	std::cout << ([=](void) -> std::size_t { std::size_t x; std::cin >> x; return Array<MAX_INPUT>::value[x]; }()) << std::endl;
	return 0;
}

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

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

  if( x%2 == 0){
    cout << "Even" << endl;
  }
  else {
    cout << "Odd" << endl;
  }
    
  // ここにプログラムを追記
}

Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <cmath>

using namespace std;
struct Type{
  int side1,side2,diagonal;
  Type(int s1,int s2,int d):side1(s1),side2(s2),diagonal(d){}
};
int main(){
  vector<Type> data;

  int s1,s2,d;
  char c;
  while(cin>>s1>>c>>s2>>c>>d)
    data.push_back(Type(s1,s2,d));

  int dianum=0,rectnum=0;
  for(auto t:data){
    if(pow(t.side1,2)+pow(t.side2,2)==pow(t.diagonal,2)){
      if(t.side1==t.side2){
        dianum++;
      }else{
        rectnum++;
      }
    }else{
      if(t.side1==t.side2)dianum++;
    }
    
  }
  cout<<rectnum<<endl;
  cout<<dianum<<endl;
}

Measured memory_bytes: 1192
N, M = map(int, input().split())
A = [int(input()) for _ in range(M)]

mod = int(1e9+7)

if N == 1:
  print(1)
  exit()

solver = [0]*(N+1)
solver[0] = 1

## 調べるべき階段のみ取り出す
stairs = set(range(2,N+1)) - set(A)

## 1段目の処理
if len(A) > 0 and A[0] == 1:
  solver[1] = 0
else:
  solver[1] = 1

for i in stairs: ## i段目の処理
    var = (solver[i-2] + solver[i-1]) % mod
    solver[i] = var
    
print(solver[-1])

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

set <string> s;

int main()
{
    int n,m;

    cin >> n;
    vector<int> buka(n+1);

    for (int i = 2;i <= n;++i) {
        cin >> m;
        ++buka[m];
    }

    for (int i = 1;i <= n;++i) {
        std::cout << buka[i] << endl;
    }

    return(0);
}


Measured memory_bytes: 4028
import java.util.Collections;
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {

	
	
	public static void main(String[] args) {
		try(Scanner sc = new Scanner(System.in)){
			PriorityQueue<Integer> Q = new PriorityQueue<Integer>(11, Collections.reverseOrder());
			
			while(sc.hasNext()) {
				String str=sc.next();
				if(str.equals("end")) {
					break;
				}
				if(str.equals("insert")) {
					int value=sc.nextInt();
					Q.add(value);
				}
				else {
					System.out.println(Q.poll());
				}
			}
			

		}
		
	}

}



Measured memory_bytes: 580716
#include<bits/stdc++.h>
using namespace std;
int main(){
    string s;
    cin >> s;
    
    int j;
    int i;
    for(i=0;i<s.size();i++){
        int h=0;
        for(j=0;j<s.size();j++){
            if(s.at(j)==s.at(i)){
                h++;
            }
        }
        if(h%2!=0){
        cout << "No" << endl;
        return 0;
        }
    }
    
    
        cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 256
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列
#define CO(a, b, c) ((a)?(b):(c))
#define rep(i, n) for(int i = 0; i < (n); ++i)

using namespace std;
typedef long long ll;

int main(void)
{
	int k;
	string s, ans="";

	cin >> k >> s;

	for (int i = 0; i < k && i < s.length(); i++)
	{
		ans += s[i];
	}
	if (k < s.length())
	{
		ans += "...";
	}
	
	cout << ans << endl;
	
	return 0;
	
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,n-1,0)
#define all(v) v.begin(), v.end()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, m; cin >> n >> m;
  vector<int> cnt(n, 1);
  vector<bool> red(n); red[0] = true;
  rep(i, m) {
    int x, y;
    cin >> x >> y;
    x--; y--;
    if(red[x]) {
      if(cnt[x] == 1) red[x] = false;
      red[y] = true;
    }
    cnt[x]--;
    cnt[y]++;
  }
  cout << accumulate(all(red), 0) << "\n";
  return 0;
}


Measured memory_bytes: 3704
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
constexpr int MOD = 1000000007;
constexpr int INF = 2147483647;
lint power(lint x, lint n, lint mod) {
  lint ret = 1;
  while(n > 0) {
    if(n & 1) (ret *= x) %= mod;
    (x *= x) %= mod;
    n >>= 1;
  }
  return ret;
}
int main()
{
    lint n, a, b;
    cin >> n >> a >> b;
    lint ans = power(2, n, MOD) - 1;
    lint t = 1;
    REP(i, a) {
        t = t * (n-i) % MOD * power(i+1, MOD-2, MOD) % MOD;
    }
    ans = (ans - t + MOD) % MOD;
    t = 1;
    REP(i, b) {
        t = t * (n-i) % MOD * power(i+1, MOD-2, MOD) % MOD;
    }
    ans = (ans - t + MOD) % MOD;
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
main(){
  long long a,b,x,y,r,gcd[1000],lcm[1000],i,n=0;
  while(1){
    scanf("%lld %lld",&a,&b);
    if(feof(stdin))break;
    x=a;
    y=b;
    while(x!=y){
      if(x>y){
	x=x-y;
      }else{
	y=y-x;
      }
    }
    gcd[n]=y;
    lcm[n]=(a*b)/(gcd[n]);
    n++;
  }
  for(i=0;i<n;i++){
    printf("%lld %lld\n",gcd[i],lcm[i]);
  } 
  return(0);
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define int long long
using namespace std;
typedef vector<int>   vint;
typedef pair<int,int> pint;

signed main()
{
    int N; cin>>N;
    vint a(N);
    REP(i,N){
        cin>>a[i];
        a[i]-=i+1;
    }
    sort(ALL(a));
    
    int ans=0;
    REP(i,N){
        ans+=abs(a[i]-a[N/2]);
    }
    cout<<ans<<endl;
    
}


Measured memory_bytes: 1792
import random as rng
import itertools as it
import collections as col
import heapq as hq
import sys
import copy as cp
sys.setrecursionlimit(10**9)
input = sys.stdin.readline


def dump_impl(*objects):
    print(*objects, file=sys.stderr)


def dump_dummy(*objects):
    pass


dump = dump_impl if "DEBUG" in sys.argv else dump_dummy


def odd(n): return n & 1


def even(n): return not odd(n)


def comb(n, m):
    r = 1
    for i in range(1, n+1):
        r *= i
    for i in range(1, m+1):
        r //= i
    for i in range(1, n-m+1):
        r //= i
    return r


if __name__ == '__main__':
    N, P = map(int, input().split())
    A = [int(n) % 2 for n in input().split()]
    cnt0 = len([a for a in A if a == 0])
    cnt1 = len([a for a in A if a == 1])
    ans = 0
    if odd(P):
        for i in range(cnt1 + 1):
            if odd(i):
                ans += comb(cnt1, i)
    else:
        for i in range(cnt1 + 1):
            if even(i):
                ans += comb(cnt1, i)
    ans *= pow(2, cnt0)
    print(ans)


Measured memory_bytes: 76724
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	private static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		int[] n = new int[4];
		for (int i = 0; i < 4; i++) {
			n[i] = sc.nextInt();
		}
		Arrays.sort(n);
		System.out.println(n[0] == 1 && n[1] == 4 && n[2] == 7 && n[3] == 9 ? "YES" : "NO");
	}
}

Measured memory_bytes: 21844