akhauriyash/Code-Regression huggingface dataset:
////////////////////////////////////////////////////////////////////
// This source code is for Visual Studio
////////////////////////////////////////////////////////////////////
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <sstream>
#include <iterator>
#include <stack>
#include <functional>
#include <iomanip>
#include <string>
#include <cstring>
#include <deque>
#include <math.h>
#include <assert.h>

#define	numberof(a)	(sizeof(a) / sizeof(a[0]))
#define	INF32		INT32_MAX
#define	INF64		INT64_MAX
#define Rep(i,n) for(int i = 0; i < (n); ++i )

using namespace std;

typedef vector< vector<int> > MAT;
typedef pair<int, int> PINT;
typedef long long ll;
typedef uint32_t u32;
typedef uint64_t u64;
typedef int32_t s32;
typedef int64_t s64;

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);

bool pair_comp(const pair<ll, ll> & p1, const pair<ll, ll> & p2)
{
	// sort(item.begin(), item.end(), throw_comp)のように使う
	if (p1.first != p2.first) {
		return p1.first < p2.first;
	}
	else {
		return p1.second > p2.second;
	}
}


// main function
int main()
{
	ll D, N = 0;
	ll ans = 0;

	cin >> D >> N;
	ll tmp = pow(100, D);
	if (N == 100) ++N;
	ans = tmp * N;

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
import java.util.*

val sc = Scanner(System.`in`)
val A: String = sc.next()
val B: String = sc.next()

fun main(args: Array<String>) {
    println(arrayOf("GREATER", "LESS", "EQUAL")[judge(A, B)])
}

fun judge(A: String, B: String): Int {
    when (A.length - B.length) {
        in 1..Int.MAX_VALUE -> {
            return 0
        }
        in Int.MIN_VALUE..-1 -> {
            return 1
        }
        0 -> {
            for (i in 0 until Math.max(A.length, B.length)) {
                if (i == A.length) {
                    return 1
                }
                if (i == B.length) {
                    return 0
                }
                when (A[i] - B[i]) {
                    in 1..Int.MAX_VALUE -> {
                        return 0
                    }
                    in Int.MIN_VALUE..-1 -> {
                        return 1
                    }
                }
            }
        }
    }
    return 2
}

Measured memory_bytes: 31388
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "ctime"

using namespace std;

constexpr long long int MOD = 1000000007;
//constexpr int MOD = 1000000007;
//constexpr int MOD = 998244353;
//constexpr long long int MOD = 998244353;
constexpr double EPS = 1e-12;

//int N, M, K, T, H, W, L, R;
long long int N, M, K, T, H, W, L, R;



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

	cin >> N;
	long long int a = 0, b = 0;
	for (int i = 0; i < N; i++) {
		char c;
		cin >> M >> c >> K;
		if (c == '(')a += K;
		else b += K;
		if (a == b)cout << "Yes\n";
		else cout << "No\n";
	}
}


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

#define ll long long
#define mod 1000000007
#define pll pair<long long,long long>
#define pdd pair<long double,long double>
#define vll vector<ll>
#define rep(i,j,n) for(int i=j;i<n;i++)
#define mp make_pair
#define pb push_back
#define pf push_front
#define inf 1e17
#define N 100010
priority_queue<pll,vector<pll>,greater<pll> >pq;
priority_queue<ll,vector<ll>,greater<ll> >pq1;

ll result(ll a, ll b, ll p){
    ll ans=1;
    if(b==(-1))
        b=p-2;
    while(b){
        if(b&1){
            ans=(ans*a)%p;
        }
        a=(a*a)%p;
        b>>=1;
    }
    return ans;
}

ll T = 1,n,m,k;

int main(){
    if(fopen("input.txt", "r"))
    freopen("input.txt", "r", stdin),
    freopen("output.txt", "w", stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    
    cin >> n;
    string ans="";
    while(n){
        ll d=n%26;
        if(d==0){
            ans += 'z';
            n/=26;
            n--;
            continue;
        }
        char p=d-1+'a';
        ans += p;
        n/=26;
    }
    reverse(ans.begin(), ans.end());
    cout << ans;

    return 0;
}


Measured memory_bytes: 3656
#include <stdio.h>

int main(){
  long long a,b,c;
  scanf("%lld%lld%lld",&a,&b,&c);

  if(c<a+b+1){
	printf("%lld",b+c);
  }else{
    printf("%lld",a+2*b+1);
  }
}
  


Measured memory_bytes: 128
#pragma warning(disable:4996)
#include <stdio.h>

typedef long long int64;

int64 alladd(int* i,int v) 
{
	int64 a = 0;
	for (int j = 0; j != v; j++)
	{
		a += (int64)i[j];
	}
	return a;
}

int main()
{
	int n, m, a[10001];
	scanf("%d %d", &n, &m);
	for (int i = 0; i != m; i++) 
	{
		scanf("%d", &a[i]);
	}

	int64 b = alladd(a, m);

	b = n - b;
	if (b < 0) {
		b = -1;
	}
	printf("%lld", b);

	return 0;
}

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

using namespace std;

typedef long long int ll;
typedef pair<int,int> P;

#define rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=int(a);i<(b);i++)
#define repr(i,b,a) for(int i=int(b);i>=(a);i--)
#define all(x) x.begin(),x.end()

const ll mod = 1e9+7;
const ll INF = 1e9;

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
bool valid(int lx,int ux,int ly,int uy,int x,int y){
	return lx<=x&&x<ux&&ly<=y&&y<uy; 
}
ll power(ll x,ll p){
	if(p==0)return 1;
	ll res=power(x*x%mod,p/2);
	if(p%2==1)res=res*x%mod;
	return res;
}

int main()
{
	int n;
	cin>>n;
	vector<int> a(n);
	rep(i,n)cin>>a[i];

	sort(all(a));

	if(n==2){
		cout<<a[1]-a[0]<<endl;
		cout<<a[1]<<" "<<a[0]<<endl;
		return 0;
	}

	vector<P> ans;
	deque<int> b;
	if(a[0]>=0){
		ans.push_back(P(a[0],a[n-1]));
		a[0]-=a[n-1];
		rep(i,n-1)b.push_back(a[i]);
	}else if(a[n-1]<=0){
		ans.push_back(P(a[n-1],a[0]));
		a[n-1] -= a[0];
		repi(i,1,n)b.push_back(a[i]);
	}else{
		rep(i,n)b.push_back(a[i]);
	}

	int min_ = b.front();b.pop_front();
	int max_ = b.back();b.pop_back();

	for(auto x:b){
		if(x>0){
			ans.push_back(P(min_,x));
			min_ -= x;
		}else{
			ans.push_back(P(max_,x));
			max_ -= x;
		}
	}
	ans.push_back(P(max_,min_));
	cout<<max_ - min_<<endl;
	for(auto x:ans){
		cout<<x.first<<" "<<x.second<<endl;
	}


	return 0;
}

Measured memory_bytes: 3576
#include <bits/stdc++.h>
#define GET_MACRO(_1,_2,_3,_4,_5,_6,_7,_8,NAME,...) NAME
#define pr(...) cerr<< GET_MACRO(__VA_ARGS__,pr8,pr7,pr6,pr5,pr4,pr3,pr2,pr1)(__VA_ARGS__) <<endl
#define pr1(a) (#a)<<"="<<(a)<<" "
#define pr2(a,b) pr1(a)<<pr1(b)
#define pr3(a,b,c) pr1(a)<<pr2(b,c)
#define pr4(a,b,c,d) pr1(a)<<pr3(b,c,d)
#define pr5(a,b,c,d,e) pr1(a)<<pr4(b,c,d,e)
#define pr6(a,b,c,d,e,f) pr1(a)<<pr5(b,c,d,e,f)
#define pr7(a,b,c,d,e,f,g) pr1(a)<<pr6(b,c,d,e,f,g)
#define pr8(a,b,c,d,e,f,g,h) pr1(a)<<pr7(b,c,d,e,f,g,h)
using namespace std;
using Int = long long;
using ll = long long;
using Double = long double;
const Int INF = (1LL<<55)+1e9; // ~ 3.6 * 1e16
const Int mod = (1e9)+7;
const Double EPS = 1e-8;
const Double PI = 6.0 * asin((Double)0.5);
using P = pair<Int,Int>;
using T = tuple<Int,Int,Int>;
template<class T> T Max(T &a,T b){return a=max(a,b);}
template<class T> T Min(T &a,T b){return a=min(a,b);}
ostream& operator<<(ostream& o,P p){return o<<"("<<p.first<<","<<p.second<<")";}
ostream& operator<<(ostream& o,T t){return o<<"("<<get<0>(t)<<","<<get<1>(t)<<","<<get<2>(t)<<")";}
istream& operator>>(istream& i,P &p){return i>>p.first>>p.second;}
ostream& operator<<(ostream& o,vector<auto> &a){Int i=0;for(auto t:a)o<<(i++?" ":"")<<t;return o;}
istream& operator>>(istream& i,vector<auto> &a){for(auto &t:a)i>>t;return i;}
void prArr(auto a,string s=" "){Int i=0;for(auto t:a)cout<<(i++?s:"")<<t;cout<<endl;}


signed main(){
  srand((unsigned)time(NULL));
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  Int n,m,d;
  cin>>n>>m>>d;

  Double ans = (Double)(m-1)*(2*(n-d)) /(n * n);
  if(d == 0) ans /= 2;
  cout<<ans<<endl;
  
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = (int)(a); i <= (int)(n); ++i)
#define rrep(i, a, n) for (int i = (int)(a); i >= (int)(n); --i)
#define debug(x) cerr << #x << " = " << x << "\n"
#define debugv(x) \
  rep(f, 0, (x.size() - 1)) cerr << x[f] << (f == (x.size() - 1) ? "\n" : " ")
#define all(x) x.begin(), x.end()
#define int long long
using namespace std;
typedef pair<int, int> pii;
typedef vector<int> vi;
const int MX = 1e5 + 5, INF = 5 << 28, MOD = 1e9 + 7;

int N, M, K;
vi A, B;
string S, T;

void input() {
  int x, y, z;
  cin >> N >> M >> K;
  ;
}
void solve() {
  set<int> s;
  s = {N, M, K};
  cout << s.size() << endl;
  ;
  ;
}
signed main() {
  input();
  solve();
  return 0;
}

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

public class Main {
    static boolean x(int a[][]) {
        boolean tmp = false;
        for (int i = 0; i < 3; i++) {
            if (a[i][0] == 0 && a[i][1] == 0 && a[i][2] == 0) {
                tmp = true;
                break;
            }
        }
        return tmp;
    }

    static boolean y(int a[][]) {
        boolean tmp = false;
        for (int i = 0; i < 3; i++) {
            if (a[0][i] == 0 && a[1][i] == 0 && a[2][i] == 0) {
                tmp = true;
                break;
            }
        }
        return tmp;
    }

    static boolean c(int a[][]) {
        boolean tmp = false;
        if (a[0][0] == 0 && a[1][1] == 0 && a[2][2] == 0)
            tmp = true;
        else if (a[0][2] == 0 && a[1][1] == 0 && a[2][0] == 0)
            tmp = true;
        return tmp;
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a[][] = new int[3][3];
        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++) {
                a[i][j] = sc.nextInt();
            }
        }
        int n = sc.nextInt();
        int tmp = 0;
        for (int i = 0; i < n; i++) {
            tmp = sc.nextInt();
            for (int k = 0; k < 3; k++) {
                for (int j = 0; j < 3; j++) {
                    if (a[k][j] == tmp)
                        a[k][j] = 0;
                }
            }
        }
        boolean xa = x(a);
        boolean ya = y(a);
        boolean ca = c(a);
        String ans = "No";
        if (xa || ya || ca)
            ans = "Yes";
        System.out.println(ans);
        sc.close();
    }
}

Measured memory_bytes: 23124
import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
# def LF(): return [float(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  n,m=LI()
  l=[LI() for _ in range(m)]
  l=sorted(l,key=lambda x:x[1])

  ans=1
  kiru=l[0][1]-0.1
  for x,y in l[1:]:
    if x<kiru<y:
      continue
    ans+=1
    kiru=y-0.1

  return ans

# main()
print(main())


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

using namespace std;

#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define fin(ans) cout << (ans) << endl;
#define blank(ans) cout << (ans) << " ";
#define mp(p, q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()

typedef long long ll;
typedef long long lli;
typedef unsigned long long ull;
typedef long double ld;
typedef string str;

typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<ld> vd;
typedef vector<str> vs;
typedef vector<ll> vll;
typedef vector<pair<ll, ll>> vpll;
typedef vector<pair<ll, str>> vpls;
typedef vector<tuple<str, ll, ll>> vtsl;
typedef vector<vector<ll>> vvll;
typedef vector<vector<char>> vvc;
typedef vector<vector<str>> vvs;

const ld PI = acos(-1.0);
const ll MAX = 9000000000000000000;
const ll MIN = -9000000000000000000;
const ld DMAX = 4500;
const ld DMIN = -4500;
const ll MOD = 1000000007;

//実行部
void Main()
{
  ll n; cin >> n;
  for(ll i = 1;i < 50001;i++)
  {
    ll ans = i * 1.08;
    if(ans == n)
    {
      fin(i)
      return;
    }
  }
  fin(":(")
  return;
}

//前処理
int main()
{
  //ios::sync_with_stdio(false);
  //cin.tie(0);
  cout << fixed << setprecision(20); //高精度少数表示
  Main();
  return 0;
}


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

using namespace std;
#define inputInt(a) int a; cin >> a; 
#define inputInt2(a,b) int a; int b; cin >> a >> b; 
#define inputInt3(a,b,c) int a; int b; int c; cin >> a >> b >> c;
#define inputLong(a) long a;cin >> a; 
#define inputIntArray(a,N) int a[N];for(int i=0;i<N;i++){cin >> a[i];}
#define inputLongArray(a,N) long a[N];for(int i=0;i<N;i++){cin >> a[i];}
#define inputIntArray2(a,b,N) int a[N]; int b[N]; for(int i=0;i<N;i++){cin >> a[i] >> b[i];}
#define output(answer) cout << answer << endl;
#define fN(i,N)    for(int i=0; i<N; i++)
#define fSE(i,s,e) for(int i=s; i<=e; i++)
#define ll long long
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define FOR(i,N) for(int i=0; i<N; i++)
#define cinv(v,N) vector<int> v(N); for(int i=0; i<N; i++){ cin >> v[i]; }
#define mt make_tuple
const ll MOD2 = 998244353;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

ll power(ll x, ll y){//繰り返し2乗法
  if(y < 0){
    return 0;
  }else if(y == 0){
    return 1LL;
  }else if(y%2 == 0){//偶数
    return power(x,y/2)*power(x,y/2);
  }else{//奇数
    return power(x,y-1)*x;
  }
}

int main()
{
  //input
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  ll N; cin >> N;
  
  //main
  if(N%2 == 1){ cout << 0 << endl; }
  else{
    ll ans = 0;
    for(ll i=1; i<=25; i++){
      ans += (N/2)/(power(5,i));
      //cout << ans << endl;
    }
    cout << ans << endl;
  }
  
  // output

  return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<climits>
#include<iostream>
#include<sstream>
#include<utility>
#include<map>
#include<vector>
#include<queue>
#include<algorithm>
#include<set>
#include<stack>
using namespace std;
typedef long long ll;
typedef pair<int,int>P;
int N;
vector<ll>A,S;
int main()
{
	cin>>N;
	for(int i=0;i<N;i++)
	{
		ll a;
		cin>>a;
		A.push_back(a);
		if(i==0)S.push_back(a);
		else S.push_back(S[i-1]+a);
	}
	ll r=abs(S[0]-(S[N-1]-S[0]));

	for(int i=0;i<N-1;i++)
	{
		r=min(r,abs(S[i]-(S[N-1]-S[i])));
	}
	cout<<r<<endl;
}


Measured memory_bytes: 3564
from collections import deque
N = int(input())
S = [input() for _ in range(N)]
S = [[int(S[i][j]) for j in range(N)] for i in range(N)]
m = N
i = -1
for j in range(N):
    if sum(S[j]) < m:
        i = j
        m = sum(S[j])

ans = -1
for i in range(N):
    nodes = [-1]*N
    nodes[i] = 0
    q = deque([])

    for j in range(N):
        if i == j:
            continue
        if S[i][j] == 1:
            nodes[j] = 1
            q.append(j)

    pos = True
    while q:
        i = q.popleft()
        for j in range(N):
            if S[i][j] == 1:
                if nodes[j] == -1:
                    nodes[j] = nodes[i]+1
                    q.append(j)
                elif abs(nodes[i]-nodes[j]) != 1:
                    pos = False
                    break
        if not pos:
            break
    if pos:
        ans = max(max(nodes)+1,ans)

print(ans)

Measured memory_bytes: 43372
#include <bits/stdc++.h>
using namespace std;
#define FAST_IO                \
  \   
  ios::sync_with_stdio(false); \
  cin.tie(0);
#define DEBUG
#ifdef DEBUG
#define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
#else
#define debug(...)
#endif
#define trace(c, x) for (auto& x : c)
int64_t p = 1e9 + 7;
int64_t power(int64_t x, int64_t y) {
  int64_t res = 1;
  if (x == 0) return 0;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
int64_t dp[2001][2001];
int64_t C(int64_t n, int64_t r) {
  r = min(r, n - r);
  if (r < 0) {
    return 0;
  }
  if (r == 0) {
    return 1;
  }
  if (r == 1) {
    return n;
  }
  if (dp[n][r] == 0) {
    dp[n][r] = (C(n - 1, r) + C(n - 1, r - 1)) % p;
  }
  return dp[n][r];
}
int main() {
  FAST_IO
  int64_t s;
  cin >> s;
  int64_t ans = 0;
  for (int i = 1; s - 3 * i >= 0; i++) {
    ans = (ans + C(s - 2 * i - 1, i - 1)) % p;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 15424
Y = 2019
L, R = [int(i) for i in input().split()]

L2, R2 = L % Y, R % Y
dist = (R - L) // Y

if L2 == 0 or R2 == 0 or R2 <= L2 or 1 <= dist:
    res = 0
else:
    mn = (L2 * (L2+1)) % Y
    for i in range(L2, R2+1):
        for j in range(i+1, R2+1):
            if (i*j%Y) < mn:
                mn = i*j % Y
    res = mn

print(res)

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

int main(void)
{
	char str[20];
	char str2[20];
	int len;
	int i;
	
	scanf("%s", str);

	len = strlen(str);

	i = 0;

	while (len != 0){
		str2[i] = str[len - 1];
		len--;
		i++;
	}
	 str2[i] = '\0';

	 printf("%s\n", str2);

	 return (0);
}

Measured memory_bytes: 944
#include<iostream>
#include<iomanip>
#include<math.h>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<string>
#define INF 1000000000ll
#define MOD 1000000007ll
#define EPS 1e-10
#define REP(i,m) for(long long i=0; i<m; i++)
#define FOR(i,n,m) for(long long i=n; i<m; i++)
#define DUMP(a) for(long long dump=0; dump<(ll)a.size(); dump++) { cout<<a[dump]; if(dump!=(ll)a.size()-1) cout<<" "; else cout<<endl; }
#define ALL(v) v.begin(),v.end()
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef long double ld;

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	string s;
	cin>>s;
	string t="AKIHABARA";
	REP(i,9) {
		if((ll)s.size()<(i+1)) {
			s.pb('A');
		}
		else if(s[i]!=t[i]) {
			if(i==0) s="A"+s;
			else {
				s=s.substr(0,i)+"A"+s.substr(i,((ll)s.size()-i ));
			}
		}
	}
	if(s==t) cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
}



Measured memory_bytes: 256
#include<stdio.h>

int main(){
  int a[9]; int n;
  for(int i=0; i<9; i++){
    scanf("%d",&a[i]);
  }
  scanf("%d",&n); int b[n];
  for(int k=0; k<n; k++){
    scanf("%d",&b[k]);
    for(int i=0; i<9; i++){
        if (b[k]==a[i]){
          a[i]=0;
        }
    }
  }
  if ((a[0]+a[1]+a[2]==0)||(a[3]+a[4]+a[5]==0)||(a[6]+a[7]+a[8]==0)
      ||(a[0]+a[3]+a[6]==0)||(a[1]+a[4]+a[7]==0)||(a[2]+a[5]+a[8]==0)
      ||(a[0]+a[4]+a[8]==0)||(a[2]+a[4]+a[6]==0))
    printf("Yes\n");
  else printf("No\n");
  
  return 0;
}

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

int main() {
  ll a, b;
  cin>> a >> b;
  
  if ((a <= 0 && b >= 0)) { //a,bが0をはさんでる
    cout << "Zero" << endl;
  }
  else if (b < 0) { // みんな負
    if ((b - a + 1)%2 == 1) {
      cout << "Negative" << endl;
    }
    else {
      cout << "Positive" << endl;
    }
  }
  else {
    cout << "Positive" << endl;
  }
}


Measured memory_bytes: 256
open Batteries
module EnumL = Enum.Labels
module ListL = List.Labels
module ArrayL = Array.Labels

let dbg0 x = Printf.eprintf "[debug]%s\n" @@ dump x
let dbg1 x = dbg0 x; x

let id = identity

let (++) n m = if n <= m then  List.range n `To m else []
let (++-) n m = if n >= m then List.range n `Downto m else []
let (++^) n m = if n < m then List.range n `To (pred m) else []

module ModOp = struct
  let prime = 1_000_000_007
  let (-) a b = (a + prime - b) mod prime
  let (+) a b = (a + b) mod prime
  let ( * ) a b = (a * b) mod prime

  let rec pow x n =
    if n = 0 then 1
    else if n mod 2 = 0 then pow (x*x) (n/2)
    else x * pow (x*x) (n/2)
end

let scan fmt = Scanf.sscanf (read_line ()) fmt

let scan_lines n fmt f =
  if n = 0 then []
  else List.map (fun _ -> scan fmt f) (1 ++ n)

let scan_list ?sep cnv =
  let line = read_line () in
  (match sep with
   | None -> List.map String.of_char @@ String.to_list line
   | Some sep -> String.split_on_char sep line)
  |> List.map cnv

let scan_array ?sep cnv = Array.of_list @@ scan_list ?sep cnv

let scan_matrix n m e ?sep conv =
  let arr = Array.make_matrix n m e in
  ListL.iter (0 ++^ n)
    ~f:(fun i -> arr.(i) <- Array.of_list @@ scan_list ?sep conv);
  arr

let atoi c = Char.code c - Char.code '0'
let itoa n = Char.chr (n + Char.code '0')

let rec powerset = function
  | [] -> [[]]
  | hd::tl ->
    let pws =  powerset tl in
    pws @ ListL.map pws ~f:(fun pw -> hd::pw)

let permutations l =
  let rec interleave x = function
    | [] -> [[x]]
    | (hd::tl) as l ->
      (x::l) :: (interleave x tl |> ListL.map ~f:(fun l -> hd::l)) in
  let rec aux = function
    | [] -> [[]]
    | a::rest ->
      aux rest |> ListL.map ~f:(interleave a) |> List.concat in
  aux l

let intersection l =
  EnumL.filter ~f:(fun x -> EnumL.exists ~f:((=) x) @@ Enum.clone l)

let zip l m =
  let n = min (List.length l) (List.length m) in
  List.combine (List.take n l) (List.take n m)

let lower_bound n f =
  let rec aux l u =
    if u - l > 1 then
      let m = (l + u) / 2 in
      if f m then aux l m
      else aux m u
    else u in aux (-1) n

let between n x m = n <= x && x < m

let s = scan "%s" id
let t = scan "%s" id

let () =
  ListL.map (0++^String.length s) ~f:(fun i ->
      if String.get s i = String.get t i then 0 else 1
    ) |> List.sum
  |> Printf.printf "%d\n"


Measured memory_bytes: 16984
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < (n); i++)
#define REPR(i, n) for(int i = (n); i >= 0; i--)
#define FOR(i, m, n) for(int i = (m); i < (n); i++)
#define INF 1e9
#define ALL(v) (v).begin(), (v).end()
#define debug(x) cerr << #x << ": " << x << endl;

using namespace std;
typedef long long ll;

signed main() {
  int n;
  cin >> n;
  if(n >= 30) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
    using namespace std;
    
    int main(){
        long a , b;
        cin >> a >> b;
        if(a % 3 == 0 || b % 3 == 0 || (a + b) % 3 == 0){
            cout << "Possible" << endl;
        }else{
            cout << "Impossible" << endl;
        }
        
        return 0;
    }

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define For(i,n,k) for(int i=(n);i<(k);i++)
#define ALL(a)  (a).begin(),(a).end()
ll N, K;
const ll MOD = 1000000007;
template <typename TYPE> vector<vector<TYPE>> multiple(vector<vector<TYPE>> A, vector<vector<TYPE>> B){
    vector<vector<TYPE>> C(N,vector<TYPE> (N,0));
    For(i,0,N){
        For(j,0,N){
            For(k,0,N){
                C[i][j] += A[i][k] * B[k][j];
                C[i][j] %= MOD;
            }
        }
    }
    return C;
}
void Main(){
    cin >> N >> K;
    vector<vector<ll>> prob(N,vector<ll> (N));
    For(i,0,N) For(j,0,N) prob[i][j] = (i==j);
    vector<vector<ll>> matrix(N,vector<ll> (N));
    For(i,0,N) For(j,0,N) cin >> matrix[i][j];
    while(K){
        if(K & 1){
            prob = multiple(prob,matrix);
        }
        matrix = multiple(matrix,matrix);
        K >>= 1;
    }
    ll ans = 0;
    For(i,0,N) For(j,0,N) ans = (ans + prob[i][j]) % MOD;
    cout << ans << endl;
}
int main(){
    Main();
    /*
    東方風神録は神が出てくるので当然神ゲー
    */
    return 0;
}

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

int main(){
  string s;
  int dif = 'a' - 'A'; 

  getline( cin,s );

  for( int i=0;i<s.length();i++ ){
    if( 'a'<= s[i] && s[i] <='z' )
      s[i] -= dif;
  }
  cout << s << endl;

  return 0;
}

Measured memory_bytes: 0
import sys

for line in sys.stdin:
    a = list(map(float, line.split()))
    x = (a[4] * a[2] - a[1] * a[5]) / (a[0] * a[4] - a[1] * a[3]) + 0.0
    y = (a[0] * a[5] - a[3] * a[2]) / (a[0] * a[4] - a[1] * a[3]) + 0.0
    print("{:>.3f}".format(x) +" " + "{:>.3f}".format(y))

Measured memory_bytes: 7368
import scala.io.StdIn.readLine

object Main{
  def f(n : Int): Int ={
    if(n % 2 == 0) n / 2
    else 3 * n + 1
  }
  def solve(s : Int): Int ={
    var lst : List[Int] = List.empty
    var nextInt : Int = s
    var k : Int = 1
    while(!lst.contains(nextInt)){
      lst = nextInt :: lst
      nextInt = f(nextInt)
      k += 1
    }
    k
  }
  def main(args : Array[String]): Unit ={
    val s : Int = readLine().toInt
    println(solve(s))
  }
}


Measured memory_bytes: 25416
arr = [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]
K = int(input())
print(arr[K-1])

Measured memory_bytes: 3060
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
char a[60],b[60];
int main()
{
	scanf("%s%s",a,b);
	int lb=strlen(b);
	for(int i=0;i<lb;i++) cout<<a[i]<<b[i];
	if(strlen(a)>lb) printf("%c",a[lb]);
	cout<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <deque>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <tuple>
#include <numeric>
#include <string>
#include <bitset>
#include <functional>

using ld = long double;
using vld = std::vector<ld>;
using vvld = std::vector<vld>;
using vvvld = std::vector<vvld>;
using ll = long long;
using vll = std::vector<ll>;
using vvll = std::vector<vll>;
using vvvll = std::vector<vvll>;
using pll = std::pair<ll, ll>;
using vpll = std::vector<pll>;
using str = std::string;
using vstr = std::vector<str>;

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

constexpr ld PI = 3.141592653589793L;
constexpr ld EPS = std::numeric_limits<ld>::epsilon();

ll gcd(ll n, ll m) { return m ? gcd(m, n % m) : n; }
ll lcm(ll n, ll m) { return n / gcd(n, m) * m; }
bool is_prime(ll n) {
    if (n == 1) return false;
    for (ll i = 2; i * i <= n; i++)
        if (n % i == 0) return false;
    return true;
}

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

void solve();

int main() {
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    std::cout << std::setprecision(15);

    solve();
}

void solve() {
    ll a, b, x;
    std::cin >> a >> b >> x;

    ll ans = b / x - std::max(0LL, a - 1) / x + (a == 0);

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


Measured memory_bytes: 3580
N = int(input())
T, A = map(int, input().split(" "))
H = list(map(int, input().split(" ")))
# print(H)
# H.sort()

minimum = 1000
point = 0
for i in range(N):
    Ti = T - (H[i]*0.006)
    if abs(Ti-A) < minimum:
        minimum = abs(Ti-A)
        point = i
print(point+1)

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

int main() {
	int a, b, c, d, p;
	cin >> a >> b >> c >> d >> p;
	int p1 = a * p;
	int p2 = max(p - c, 0) * d + b;
	cout << min(p1, p2) << '\n';
}

Measured memory_bytes: 3088
import heapq
n, m = map(int, input().split())
li = [list(map(int, input().split())) for _ in range(n)] + [[1000000, 1000000]]
li.sort()
idx = 0
hq = []
ans = 0
for i in range(m):
    while li[idx][0] <= i + 1:
        heapq.heappush(hq, -li[idx][1])
        idx += 1
    if hq:
        ans -= heapq.heappop(hq)
print(ans)


Measured memory_bytes: 73304
import math

a,b,h,m=map(int, input().split())

h_rad = 30*h
h_rad += m*0.5
m_rad = 6*m
diff1 = abs(h_rad-m_rad)

diff2 = 360-diff1

diff = min(diff1,diff2)


cos = math.cos(math.radians(diff))
ans = math.sqrt(a**2+b**2-(2*a*b*cos))
print(ans)

Measured memory_bytes: 9512
#include <bits/stdc++.h>
#define r(i, n) for (ll i=0;i<n;i++)
#define ll long long
#define llc(n) ll n; cin >> n;
using namespace std;
int main() {
  ll a,b,k;
  cin >> a >> b >> k;
  a=a-k;
  if(a<0) {
    b=b+a;
    a=0;
  }
  if(b<0) b=0;
  cout << a << " " << b << endl;
}


Measured memory_bytes: 256
n, m = list(map(int, input().split(' ')))
pairs = []

for i in range(m):
    pairs.append(list(map(int, input().split(' '))))

num = [-1 for i in range(n)]

for pair in pairs:
    s, c = pair

    if (num[s-1] != -1 and num[s-1] != c) or (s == 1 and c == 0 and n > 1):
        print(-1)
        exit(0)
    else:
        num[s-1] = c

for i in range(n):
    if num[i] == -1:
        num[i] = 0 if i != 0 or n == 1 else 1

print(''.join([str(i) for i in num]))

Measured memory_bytes: 3064
N,M=input().split(" ")

N=int(N)
M=int(M)

Ps=[]
Ss=[]

for i in range(M):
    p,s=input().split(" ")
    Ps.append(int(p))
    Ss.append(s)

#間違えたら-=1 ,正解したら=1 
cleared=[0]*(N+1)

AC_n=0
WA_n=0

for i in range(M):

    if Ss[i]=="WA":
        if not cleared[Ps[i]]==1:
            cleared[Ps[i]]-=1

    if Ss[i]=="AC":
        if cleared[Ps[i]]<=0:
            AC_n+=1
            WA_n-=cleared[Ps[i]]
            cleared[Ps[i]]=1

print(AC_n,WA_n)

Measured memory_bytes: 14168
w,h,n = map(int,input().split())
q = [[0],[w],[0],[h]]
for i in range(n):
    x,y,a = map(int,input().split())
    if a == 1 or a == 2:
        q[a-1].append(x)
    else:
        q[a-1].append(y)
if max(q[0]) >= min(q[1]) or max(q[2]) >= min(q[3]):
    print(0)
else:
    print((min(q[1])-max(q[0]))*(min(q[3])-max(q[2])))



Measured memory_bytes: 38256
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main(void){
  vector<int> A(3);
  cin >> A[0] >> A[1] >> A[2];

  sort(A.begin(), A.end());

  if(A[0] == A[1])
    if(A[1] != A[2])
      cout << "Yes" << endl;
    else
      cout << "No" << endl;
  else
    if(A[1] == A[2])
     cout << "Yes" << endl;
    else
      cout << "No" << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define ull long long
#define mod 1000000007
using namespace std;
ll binpow(ll x,ll y)/* (x^y)%p in O(log y) */{ll res=1;while (y > 0){if(y&1)res=(res*x);y = y>>1;x=(x*x);}return res;}
ll binpowmod(ll x,ll y,ll p)/* (x^y)%p in O(log y) */{ll res=1;x=x%p;while (y > 0){if(y&1)res=(res*x)%p;y = y>>1;x=(x*x)%p;}return res;}
ll mod_inverse(ll n,ll p)/* Returns n^(-1) mod p */{return binpowmod(n,p-2,p);}
ll gcd(ll x,ll y)
{
	if(y==0)
		return x;
	return gcd(y,x%y);
}
bool comp(int x,int y)
{
	return x>y;
}
bool isPowerOfTwo (ll x)  
{  
    /* First x in the below expression is for the case when x is 0 */
    return x && (!(x&(x-1)));  
}


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	int n,i;
	cin>>n;
	vector< vector<int> > abc(n,vector<int>(3));
	for(i=0;i<n;i++)
		cin>>abc[i][0]>>abc[i][1]>>abc[i][2];
	vector< vector<int> > ans(n,vector<int>(3));
	ans[0][0]=abc[0][0] , ans[0][1]=abc[0][1] , ans[0][2]=abc[0][2];
	for(i=1;i<n;i++)
	{
		ans[i][0]=abc[i][0]+max(ans[i-1][1],ans[i-1][2]);
		ans[i][1]=abc[i][1]+max(ans[i-1][0],ans[i-1][2]);
		ans[i][2]=abc[i][2]+max(ans[i-1][1],ans[i-1][0]);
	}
	cout<<max(ans[n-1][0],max(ans[n-1][1],ans[n-1][2]));
}


Measured memory_bytes: 11136
x, y, a, b, c = map(int, input().split())
apples = []
apples += sorted(list(map(int, input().split())), reverse=True)[:x]
apples += sorted(list(map(int, input().split())), reverse=True)[:y]
apples += list(map(int, input().split()))
apples.sort(reverse=True)
print(sum(apples[: x + y]))

Measured memory_bytes: 22584
n,m,X,Y = map(int,input().split())

x = list(map(int,input().split()))

y = list(map(int,input().split()))

a = max(x)+1

b = min(y)

c = [i for i in range(a,b+1)]

d = [i+1 for i in range(X,Y)]

ans = 'War'

for i in d:
	if i in c:
		ans = 'No War'

print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<long long> vll;
typedef pair<int,int> pint;
typedef pair<long long, long long> pll;

#define MP make_pair
#define PB push_back
#define ALL(s) (s).begin(),(s).end()
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

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; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P) 
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P) 
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P) 
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }




double r, x, y;
int n;

double p[25];
pair<double,double> co[25];

double prev[25];
double after[25];
int res[25];

double area(pair<double,double> a, pair<double,double> b) {
    double res =  a.first * b.second - a.second * b.first;
    return res/2;
}

int main() {
    while (cin >> r >> x >> y >> n) {
        double sum = 0.0;
        for (int i = 0; i < n; ++i) {
            cin >> p[i];
            prev[i] = r*r*M_PI * p[i] / 100;
            
            co[i] = make_pair( r * cos(M_PI/2 - sum*2.0*M_PI/100), r * sin(M_PI/2 - sum*2.0*M_PI/100) );
            sum += p[i];
            
            //cout << i << " : " << sum << " , " << co[i] << endl;
        }
        
        for (int i = 0; i < n; ++i) {
            pair<double,double> A = co[i], B = pair<double,double>(x, y), C = co[(i+1)%n];
            double sub = area(A, B) + area(B, C);
            
            //cout << i << " : " << sub << endl;
            
            after[i] = prev[i] + sub;
            res[i] = (int)(after[i] / prev[i] * 100);
        }
            
        for (int i = 0; i < n; ++i) {
            cout << res[i];
            if (i != n-1) cout << " ";
        }
        cout << endl;
    }
    
    return 0;
}


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

#define EPS (1e-10)
#define rep(i, a, b) for (int i = a; i < (int)(b); ++i)
#define rrep(i, a, b) for (int i = b - 1; i >= (int)(a); --i)
#define all(a) a.begin(), a.end()

using namespace std;
using ll = long long;
using vi = vector<int>;
using vb = vector<bool>;
using vll = vector<ll>;
using vd = vector<double>;
using vvi = vector<vi>;
using vvb = vector<vb>;

constexpr int MOD = 1000000007;

ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); }
ll gcd(ll a, ll b, ll c) { return gcd(a, gcd(b, c)); }

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

    int k;
    cin >> k;

    ll ans = 0;
    rep(i, 1, k + 1) {
        rep(j, 1, k + 1) {
            rep(l, 1, k + 1) {
                ans += gcd(i, j, l);
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3612
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
using namespace std;


int main(){
      int N, M, Q;
      vector <vector <int> > vvi;
      vector <vector <int> > vviac;
      vector <vector <int> > pq;
      int l, r;
      int count;

      cin >> N >> M >> Q;
      vvi = vector<vector<int> >(N, vector<int>(N, 0));
      vviac = vector<vector<int> >(N, vector<int>(N, 0));
      pq = vector<vector<int> >(Q, vector<int>(2, 0));
      
      for (int i=0; i<M; i++){
            cin >> l >> r;
            vvi[l-1][r-1] += 1;
      }
      for (int i=0; i<Q; i++){
            cin >> l >> r;
            pq[i][0] = l-1;
            pq[i][1] = r-1;
      }

      for (int i=0; i<N; i++){
            count = 0;
            for (int j=i; j<N; j++){
                  count += vvi[i][j];
                  vviac[i][j] = count;
            }
            //cout << count << endl;
      }
      
      for (int i=0; i<Q; i++){
            count = 0;
            l = pq[i][0];
            r = pq[i][1];
            for (int j=l; j<=r; j++)
                  count += vviac[j][r];
            cout << count << endl;
      }
            
      exit(0);
}




Measured memory_bytes: 8448
#include <bits/stdc++.h>
using namespace std;
int n, k;
//int a[n+1];
int main()
{   
 cin>>n;
 int a[n+1];
 long sum[n+1]={0};
 for(int i=1;i<=n;++i)
    {cin>>a[i]; sum[i]=sum[i-1]+a[i];}
 long dp[n+1][n+1]={0};
 for(int i=1;i<n;++i)
    dp[i][i+1]=a[i]+a[i+1];


 for(int i=3;i<=n;++i) 
 {   int m=1;
     for(int j=i;j<=n;++j)
        {   dp[m][j]=4000000000007;
            for(int k=m;k<j;++k)
            {
            dp[m][j] = min(dp[m][j],dp[m][k]+dp[k+1][j]+sum[j]-sum[m-1]);               
            } ++m;
        }
 }
cout<<dp[1][n];
/*
 for(int i=0;i<=n;++i) 
 {   
     for(int j=0;j<=n;++j)
 
     cout<<dp[i][j]<<" ";
     cout<<endl;
     
 }*/
}




Measured memory_bytes: 1536
#include <iostream>
using namespace std;
int main(){
	int A, B, C, X, Y;
	cin >> A >> B >> C >> X >> Y;
	int total=0;
	if (X < Y) {
		if (2 * C <= A + B)
			total += 2 * X * C;
		else total += (A + B) * X;
		
		if (2 * C <= B)
			total += 2 * (Y - X) * C;
		else total += (Y - X) * B;
	}
	else {
		if (2 * C <= A + B)
			total += 2 * Y * C;
		else total += (A + B) * Y;

		if (2 * C <= A)
			total += 2 * (X - Y) * C;
		else total += (X - Y) * A;
	}
	cout << total;
}

Measured memory_bytes: 3576
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Yulian
 */

#include <iostream>
#include <iostream>
#include <fstream>
#include <vector>
#include <set>
#include <cmath>
#include <queue>
#include <deque>
#include <string>
#include <algorithm>
#include <map>


#include <iostream>

#include <fstream>
#include <vector>
#include <set>
#include <cmath>
#include <queue>
#include <deque>
#include <string>
#include <algorithm>
#include <map>



int getTheAnswer() {
    return 42;
}

template< class InputIt>
void incAll(const InputIt &first, const InputIt &last){
  for(auto it = first; it != last; ++it){
    ++*it;
  }
}

template <class InputIt>
void printAll(const InputIt &first, const InputIt &last, std::ostream& out){
  for(InputIt it = first; it != last; ++it){
    out << *it << " ";
  }
}

// only for positive integers
int gcd(int a, int b){
  int tmp;
  if(a < b){
    tmp = a;
    a = b;
    b = tmp;
  }
  while(b != 0){
    tmp = a;
    a = b;
    b = tmp % b;
  }
  return a;
}

int lcm(int a, int b){
  return abs(a*b) / gcd(a, b);
}


using namespace std;
class TaskA {
public:
	void solve(std::istream& in, std::ostream& out) {
    ios::sync_with_stdio(false);
		int n;
		in >> n;
		n = n * 800 - (n / 15) * 200;
		out << n << endl;
	}
};


int main() {
	TaskA solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


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

using namespace std;

#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define FOR(i, a, b) for(int i=(a);i<(b);i++)
#define REP(i, n) FOR(i, 0, n)
#define RFOR(i, a, b) for(int i=(a);i>=(b);i--)
#define RREP(i, n) RFOR(i, n, 0)
#define MFOR(i, m) for(auto i=(m).begin();i!=(m).end();i++)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((int)(x).size())

typedef long long int ll;
typedef pair<int, int> P;
typedef pair<ll, ll> Pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vll> vvll;

const double eps = 1e-10;
const int MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1 << 30;

template<typename T>
void printv(vector<T> const& s) {
  REP(i, SZ(s)) {
    cout << s[i] << " ";
  }
  cout << endl;
}

int n, k;
int b[2002][2002];
int s[4002][4002];

int get(int x, int y) {
  return s[x+k-1][y+k-1] + s[x-1][y-1] - s[x-1][y+k-1] - s[x+k-1][y-1];
}

int main () {
  cin.tie(0);
  cout << setprecision(10);

  cin >> n >> k;
  REP(i, n) {
    int x, y; char c; cin >> x >> y >> c;
    if(c == 'W') {
      x += k;
    }
    b[x%(2*k)+1][y%(2*k)+1]++;
  }

  FOR(i, 1, 4*k+1) {
    FOR(j, 1, 4*k+1) {
      s[i][j] = s[i][j-1] + b[(i-1)%(2*k)+1][(j-1)%(2*k)+1];
    }
  }
  FOR(j, 1, 4*k+1) {
    FOR(i, 1, 4*k+1) {
      s[i][j] += s[i-1][j];
    }
  }

  int ans = 0;
  FOR(i, 1, 2*k+1) {
    FOR(j, 1, 2*k+1) {
      ans = max(ans, get(i, j) + get(i+k, j+k));
    }
  }

  cout << ans << endl;

}


Measured memory_bytes: 78464
// C++ 14
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define loop(__x, __start, __end) for(int __x = __start; __x < __end; __x++)

int main() {
  int n, m; cin >> n >> m;
  vector<int> H(n);
  loop(i,0,n) cin >> H[i];
  vector<set<int> > S(n);
  loop(i,0,m) {
    int a, b;
    cin >> a >> b;
    a--, b--;
    S[a].insert(b);
    S[b].insert(a);
  }
  
  int cnt = 0;
  loop(i,0,n) {
    if (S[i].size() == 0) {
      cnt++;
      continue;
    }
    
    int h = H[i];
    bool ok = true;
    for (auto&&v: S[i]) {
      ok &= h > H[v];
    }
    cnt += ok;
  }
  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 17784
#include<stdio.h>
int main(void){
  int k;
  char s[101]={0};
  scanf("%d",&k);
  scanf("%s", s);
  int i=0;
  while(i<k && s[i]!=0){
    printf("%c",s[i]);
    i++;
  }
  if(s[i]!=0){
    printf("...\n");
  }else{
    printf("\n");
  }
  return 0;
}


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

using namespace std;

using ll = long long;

bool judge(ll x) {
    bool f3 = false, f5 = false, f7 = false;
    while (x > 0) {
        ll d = x % 10;
        if (d == 3) f3 = true;
        else if (d == 5) f5 = true;
        else if (d == 7) f7 = true;
        else return false;
        x /= 10;
    }
    return f3 && f5 && f7;
}

ll dfs(ll cur, ll n) {
    if (cur > n) return 0;
    ll res = judge(cur);
    res += dfs(cur * 10 + 7, n);
    res += dfs(cur * 10 + 5, n);
    res += dfs(cur * 10 + 3, n);
    return res;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin >> n;
    cout << dfs(0, n) << endl;
    return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
import math
H, W = map(int, input().split())
if(H == 1 or W == 1):
  print('1')
elif (H%2!=0 and W%2!=0):
  print(int((H+1)/2) + int(H*(W-1)/2))
else:
  print(int(H*W/2))
    


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

int main(){
    int n;
    cin >> n;
    map<int, int> mp;
    for (int i = 1; i <= n; i++){
        int num = i;
        int f = 2;
        while(num>1){
            while(num%f==0){
                num /= f;
                mp[f]++;
            }
            f++;
        }
    }

    ll ans = 1;
    for (auto u: mp){
        ans *= u.second + 1;
        ans %= MOD;
    }


    cout << ans << endl;
    // printf("%d\n", N);
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <utility>
#include <tuple>
#include <cmath>
#include <map>
#include <climits>
using namespace std;
using Int = long long;
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,n,m) for(int i=n;i<m;i++)
int main()
{
    int N; cin >> N;
    int F[101][6][3] = {};
    int P[101][11] = {};
    FOR(i,1,N+1) FOR(j,1,6) FOR(k,1,3) cin >> F[i][j][k];
    FOR(i,1,N+1) FOR(j,0,11) cin >> P[i][j];
    int M = INT_MIN;
    FOR(i,1,1024) {
        int S = 0;
        FOR(j,1,N+1){
            int c = 0;
            FOR(k,1,6) {
                FOR(l,1,3){
                    if (i & (1 << ((k - 1) * 2 + (l - 1))) && F[j][k][l]) c++;
                }
            }
            S += P[j][c];
        }
        M = max(S, M);
    }
    cout << M << endl;
    return 0;
}

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

int frog_jump_2(int arr[], int n, int k) {
    int dp[n];
    dp[0] = 0;
    dp[1] = abs(arr[0] - arr[1]);

    for (int i = 2; i < n; i++) {
        dp[i]=INT_MAX;
        for(int j=1; j<=k; j++){
            if(i-j>=0){
                dp[i] = min(dp[i], (dp[i - j] + abs(arr[i] - arr[i - j])));
            }
        }
    }
    return dp[n - 1];
}

int main() {
    int n, k; cin>>n>>k;
    int arr[n];
    for (int i = 0; i < n; i++) {
        cin >> arr[i];
    }
    cout << frog_jump_2(arr, n, k) << endl;
    return 0;
}

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

typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int>> vvint;

#define rep(i,n) for(ll i=0;i<n;i++)
int main() {
  ll n; cin>>n;
  vint x(n); rep(i,n) cin>>x[i];

  ll ans = LLONG_MAX;

  rep(i,100){
    ll tmp = 0;
    ll p = i+1;
    rep(j,n){
      tmp += (x[j]-p)*(x[j]-p);
    }
    ans = min(ans, tmp);
  }
  cout<<ans<<endl;

  

}


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

#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>
#include<iomanip>
#include<complex>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

//typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<int, double> pid;
typedef pair<double, int> pdi;
typedef pair<double, double> pdd;
typedef vector< vector<int> > mat;

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

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

int modpow(int x, int n, const int mo) {
	int res = 1;
	while (n > 0) {
		if (n & 1) (res *= x) %= mo;
		(x *= x) %= mo;
		n >>= 1;
	}
	return res;
}

int get_gcd(int n, int m) {
	if (n < m) swap(n, m);
	while (m) {
		swap(n, m);
		m %= n;
	}
	return n;
}

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

	int N;
	cin >> N;

	map<pii, int> LM, RM;
	int A, B;

	int ans = 1;
	int zcnt[3] = { 0 };
	rep(i, 0, N)
	{
		cin >> A >> B;
		if (A == 0 || B == 0)
		{
			if (A == 0 && B == 0)zcnt[0]++;
			else if (A == 0)zcnt[1]++;
			else zcnt[2]++;
		}
		else
		{
			int t = get_gcd(abs(A), abs(B));
			A /= t, B /= t;
			pii l = mp(A, B), r = mp(B, A);
			if (l.second < 0)l.first *= -1, l.second *= -1;
			if (r.second < 0)r.first *= -1, r.second *= -1;
			LM[l]++;
			//RM[r]++;
		}
	}

	set<pii> used;
	for (auto p : LM)
	{
		if (used.find(p.first) != used.end())continue;
		pii r = mp(-p.first.second, p.first.first);
		if (r.second < 0)r.first *= -1, r.second *= -1;
		used.insert(r);
		if (LM.find(r) == LM.end())
		{
			ans *= modpow(2, p.second, MOD);
			ans %= MOD;
		}
		else
		{
			int res = modpow(2, p.second, MOD);
			res += modpow(2, LM[r], MOD);
			res %= MOD;
			res = (res - 1 + MOD) % MOD;
			ans *= res;
			ans %= MOD;
		}
	}

	ans *= (modpow(2, zcnt[1], MOD) + modpow(2, zcnt[2], MOD) - 1 + MOD) % MOD;
	ans %= MOD;
	ans += zcnt[0];
	ans %= MOD;

	ans = (ans - 1 + MOD) % MOD;
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 28568
//b
import java.util.Scanner;
public class Main{

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();

		int[] l = new int[n];

		int max = 0;

		int index = 0;

		for(int i=0;i<n;i++) {

			l[i] = sc.nextInt();

			if(max<l[i]) {

				max = l[i];

				index = i;
			}
		}

		int sum = 0;

		for(int i=0;i<n;i++) {

			if(i!=index)sum+=l[i];
		}

		if(max<sum)System.out.println("Yes");

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

	}

}


Measured memory_bytes: 23892