akhauriyash/Code-Regression huggingface dataset:
N, M = map(int, input().split())

s = []
for i in range(M):
    i = list(map(int, input().split()))
    s.append(i[1:])

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

ans = 0
# i=0,1,2,...,2**N-1
# 全てのスイッチの場合の数
for i in range(2**N):
    flag = True

    # 各条件について
    for j in range(len(s)):
        # sのうち、ONになっているスイッチの数
        cnt = 0
        # 各スイッチについて
        for k in range(N):
            # そのスイッチがsに含まれる　かつ　ONになっている場合
            if (k + 1) in s[j] and ((i >> k) & 1):
                cnt += 1
        # 一つでも条件を満たさなかった時点でそのiで全点灯は不可能
        if cnt % 2 != p[j]:
            flag = False
            break

    if flag:
        ans += 1

print(ans)


Measured memory_bytes: 9168
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<utility>
#include <functional>
#include <set>
#include <map>
#include <queue>
#include <cmath>
#include <stack>

using namespace std;


int main() {
	int a, b;
	string s;
	cin >> a;
	cin >> s;
	cin >> b;
	if (s[0] == '+')cout << a+ b;
	if (s[0] == '-')cout << a - b;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a;
  cin>>a;
  if (a%3==0){
    if(a==0){
      cout<<0<<endl;
    }
    else{
      cout<<3<<endl;
    }
  }
  else{
  cout<<a%3<<endl;
  }
}

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

int main(){
    ll h;
    cin >> h;
    ll cnt = 1;
    ll ans = 0;
    while(h > 0){
        h /= 2;
        ans += cnt;
        cnt *= 2;        
    }    
    cout << ans << endl;    
    return 0;
}

Measured memory_bytes: 3644
S = input()

n = len(S)

ans_l = []

for i in range(2 ** (n-1)):
  l = []
  start = n - 1 
  end = n
  #print(bin(i))
  if i != 0:
    for j in range(n-1):
      if ((i >> j) & 1):
        #print(start,end)
        l.append(int(S[start:end]))
        end = start
      start -= 1
    l.append(int(S[0:end]))
    ans_l.append(sum(l))
  else:
    ans_l.append(int(S))
  
        
#print(ans_l)
  
print(sum(ans_l))

Measured memory_bytes: 3064
N = int(input())
output_list = []
for i in range(N):
    output_list.append(input())

print("AC", "x", output_list.count("AC"), "\n",
     "WA", "x", output_list.count("WA"), "\n",
     "TLE", "x", output_list.count("TLE"), "\n",
     "RE", "x", output_list.count("RE"), "\n",)

Measured memory_bytes: 16140
n = gets.chomp.to_i

cnt = Array.new(n+1,0)
max = Math.sqrt(n)
(1..max).each do |x|
    (1..max).each do |y|
        (1..max).each do |z|
            ans = x**2 + y**2 + z**2 + x*y + y*z + z*x
            if ans <= n
                cnt[ans] += 1
            end
        end
    end
end

(1..n).each do |i|
    #puts "N=#{i}のとき"
    puts cnt[i]
end

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

#define endl '\n'



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

    int n, v;
    set <int> s;
    cin >> n;

    for(int i = 0; i < n; i++) {
        cin >> v;
        s.insert(v);
    }
    cout << s.size();

    return 0;
}

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

const int MXN=100010;

int n;
unsigned long long a[MXN];

int main()
{
  cin>>n;
  for(int i=0;i!=n;++i)
    cin>>a[i];
  unsigned long long res=0,val=1;
  int p=0;
  while(p<n)
    {
      while((p<n) && (a[p]<val))
	++p;
      if(p>=n)
	break;
      res+=(a[p]-1)/val;
      if((val==1) || (a[p]==val)) ++val;
      //if(a[p]%val==0)
      //++val;
      ++p;
    }
  cout<<res<<endl;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int>pii;
const int N=605;
int n,D1,D2,i,j,k,l,c[N][N],ct,ctt[2];
bool b[N][N];
vector<pii>v[2],dt;
int ZZ=0,Z2=0;
void dfs(int x,int y,int o){
	if(x<0 || x>=n*2 || y<0 || y>=n*2 || c[x][y]!=-1)return;
	v[o].push_back(pii(x,y));c[x][y]=o;ctt[o]+=b[x][y];
	for(pii z:dt){
		int i=z.first,j=z.second;
		dfs(x+i,y+j,!o);
		dfs(x-j,y+i,!o);
		dfs(x-i,y-j,!o);
		dfs(x+j,y-i,!o);
	}
}
int main(){
	scanf("%d%d%d",&n,&D1,&D2);
	memset(b,1,sizeof b);
	for(i=1;i<N;++i)for(j=0;j<N;++j)if(i*i+j*j==D1)dt.push_back(pii(i,j));
	memset(c,-1,sizeof c);
	for(k=0;k<n*2;++k)for(l=0;l<n*2;++l)if(c[k][l]==-1){
		ctt[0]=ctt[1]=0;
		v[0].clear(),v[1].clear(),dfs(k,l,0);
		if(ctt[0]>ctt[1])swap(v[0],v[1]);
		for(pii u:v[0])b[u.first][u.second]=0;
	}
	dt.clear();
	for(i=1;i<N;++i)for(j=0;j<N;++j)if(i*i+j*j==D2)dt.push_back(pii(i,j));
	memset(c,-1,sizeof c);
	for(k=0;k<n*2;++k)for(l=0;l<n*2;++l)if(c[k][l]==-1){
		ctt[0]=ctt[1]=0;
		v[0].clear(),v[1].clear(),dfs(k,l,0);
		if(ctt[0]>ctt[1])swap(v[0],v[1]);
		for(pii u:v[0])b[u.first][u.second]=0;
	}
	k=n*n;
	for(i=0;i<n*2;++i)for(j=0;j<n*2;++j)if(b[i][j] && k)--k,printf("%d %d\n",i,j);
assert(!k);
	return 0;
}

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

long long N;
long long A[100005];

int main(){
	cin >> N;
	for(long long i = 0; i < N; i++){
		cin >> A[i];
	}

	for(long long i = 0; i < N; i++) {
		if(A[i] == 0) {
			cout << 0 << endl;
			return 0;
		}
	}

	long long ans = 1;
	for(long long i = 0; i < N; i++) {
		if((long long)1e18/ans < A[i]) {
			cout << -1 << endl;
			return 0;
		}
		ans *= A[i];
	}
	cout << ans << endl;
}

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

int main()
{
    string b;
    cin >> b;
    if (b == "A")
        cout << "T" << endl;
    else if (b == "T")
        cout << "A" << endl;
    else if (b == "C")
        cout << "G" << endl;
    else
        cout << "C" << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

class Main {

  public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);
    int numV = scan.nextInt();
    int[] adjMat = new int[numV*numV];
    for(int i=0; i< numV; i++){
      int u = scan.nextInt();
      int numA = scan.nextInt();
      for(int j=0; j<numA; j++){
        int v = scan.nextInt();
        adjMat[(u-1)*numV+(v-1)] = 1;
      }
    }
    String str = "";
    for(int i=0; i<numV; i++){
      for(int j=0; j<numV; j++){
        str += adjMat[i*numV+j];
        if(j!=numV-1)
        str += " ";
        if(j==numV-1 && i!=numV-1 ){
            str += "\n";
        }
      }
    }
    System.out.println(str);
  }
}


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

#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define INF 999999999
#define size_t unsigned long long
#define ll long long
#define rep(i,a) for(int i=0;i<(a);i++)
#define repr(i,a) for(int i=(int)(a)-1;i>=0;i--)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define FORR(i,a,b) for(int i=(int)(b)-1;i>=a;i--)
#define ALL(a) a.begin(), a.end()
using namespace std;
int si() { int x; scanf("%d", &x); return x; }
long long sl() { long long x; scanf("%lld", &x); return x; }
string ss() { string x; cin >> x; return x; }
void pi(int x) { printf("%d ", x); }
void pl(long long x) { printf("%lld ", x); }
void pd(double x) { printf("%.15f ", x); }
void ps(const string &s) { printf("%s ", s.c_str()); }
void br() { putchar('\n'); }

const int MOD = 1e9 + 7;

struct mint {
    int n;
    mint(int n_ = 0) : n(n_) {}
};

mint operator+(mint a, mint b) { a.n += b.n; if (a.n >= MOD) a.n -= MOD; return a; }
mint operator-(mint a, mint b) { a.n -= b.n; if (a.n < 0) a.n += MOD; return a; }
mint operator*(mint a, mint b) { return (long long)a.n * b.n % MOD; }
mint &operator+=(mint &a, mint b) { return a = a + b; }
mint &operator-=(mint &a, mint b) { return a = a - b; }
mint &operator*=(mint &a, mint b) { return a = a * b; }

typedef pair<int, int> P;

const int N = 1e5+5;


vector<int> v[N];
map<P, int> mp;
// unsigned short c[N][N];
// pair<int, P> p[N];

void dfs(int i, int color) {
  for(int j=0; j<v[i].size(); j++) {
    mp[P(i,v[i][j])] = j+1>=color ? j+2 : j+1;
    dfs(v[i][j], j+1>=color ? j+2 : j+1);
  }
}

int main () {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n,a[N],b[N];
  cin >> n;
  rep(i,n-1) {
    cin >> a[i] >> b[i];
    v[a[i]].push_back(b[i]);
  }
  dfs(1,N);
  int result = 0;
  rep(i,n-1) result = max(result, mp[P(a[i],b[i])]);
  cout << result << endl;
  rep(i,n-1) cout << mp[P(a[i],b[i])] << endl;
}


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

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

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

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

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

	if (number2 > number1) {
		m = number2;
		n = number1;
	}
	long long int s = -1;
	while (s != 0) {
		s = m % n;
		m = n;
		n = s;
	}
	return m;
}
/*最大公倍数*/
long long int gcd(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;
	return m / lcm(m, n) * n;
}

// index が条件を満たすかどうか
int main() {
	int h, w;
	cin >> h >> w;
	int dp[30][30] = {};
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			char a;
			cin >> a;
			if (a == '.') {
				dp[i][j] = 0;
			}
			else {
				dp[i][j] = 1;
			}
		}
	}
	int ans = 0;
	int controlx[4] = {1,-1,0,0};
	int controly[4] = {0,0,1,-1};
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			for (int k = 0; k < h; k++) {
				for (int l = 0; l < w; l++) {
					if (dp[i][j] == 0 && dp[k][l] == 0) {
						int seen[30][30] = {};
						seen[i][j] = 1;
						queue<pair<int, int>> s;
						s.push(make_pair(i, j));
						while (s.size()) {
							pair<int, int> keys;
							keys = s.front();
							s.pop();
							for (int m = 0; m < 4; m++) {
								int ay = keys.first + controly[m];
								int ax = keys.second + controlx[m];
								if (0 <= ax && ax <= w - 1 && 0 <= ay && ay <= h - 1) {
									if (dp[ay][ax] == 0 && seen[ay][ax] == 0) {
										seen[ay][ax] = seen[keys.first][keys.second] + 1;
										s.push(make_pair(ay, ax));
									}
								}
							}
						}
						ans = max(ans, seen[k][l]);
					}
				}
			}
		}
	}
	cout << ans-1;
}

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

#if __cplusplus >= 201103L
#include <array>
#include <tuple>
#include <initializer_list>
#include <unordered_set>
#include <unordered_map>
#include <forward_list>

#define cauto const auto&
#define ALL(v) begin(v),end(v)
#else
#define ALL(v) (v).begin(),(v).end()
#endif

using namespace std;


namespace{
typedef long long LL;
typedef pair<int,int> pii;
typedef pair<LL,LL> pll;

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

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

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
	v.assign(a, vector<T>(b, t));
}
template <class T> inline T &chmin(T &x, const T &y){ return x = min(x, y); }
template <class T> inline T &chmax(T &x, const T &y){ return x = max(x, y); }
template <class F, class T>
void convert(const F &f, T &t){
	stringstream ss;
	ss << f;
	ss >> t;
}


#define REP(i,n) for(int i=0;i<int(n);++i)
#define RALL(v) (v).rbegin(),(v).rend()


#define MOD 1000000007LL
#define EPS 1e-8


void mainmain(){
	int n, m;
	scanf("%d%d", &n, &m);
	VV(int) G(n + 1);
	vector<int> cnt(n + 1);
	for(int i = 0; i < n - 1 + m; ++i){
		int a, b;
		scanf("%d%d", &a, &b);
		G[a].push_back(b);
		++cnt[b];
	}
	queue<int> q;
	for(int i = 1; i <= n; ++i){
		if(!cnt[i]){
			q.push(i);
			break;
		}
	}

	vector<int> ans(n + 1);
	while(!q.empty()){
		int u = q.front();
		q.pop();
		for(int v : G[u]){
			if(!--cnt[v]){
				q.push(v);
				ans[v] = u;
			}
		}
	}
	for(int i = 1; i <= n; ++i){
		printf("%d\n", ans[i]);
	}
}



}
int main() try{
//	ios::sync_with_stdio(false); cin.tie(0);
	cout << fixed << setprecision(10);
	cerr << fixed << setprecision(4);
	mainmain();
}
catch(...){}


Measured memory_bytes: 7040
#include<bits/stdc++.h>
using namespace std;
int main()
{
   int k;
   string s;
   cin>>k;
   cin>>s;
   if(k>=s.size())
    cout<<s;
   else
   {

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




}


Measured memory_bytes: 3596
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#define DEBUG true
#ifdef ONLINE_JUDGE
#undef DEBUG
#define DEBUG false
#endif 

using namespace std;

#define MAXN ((int)2e5+5)
#define MOD ((int)1e9 + 7)
#define INF ((int)1e9 + 9)
#define ll long long
#define _ << " " <<
#define CLEAR(a, b) memset(a, b, sizeof(a))
#define TRACE(x) if(DEBUG) cerr << #x << " = " << x << endl;
#define TRACE2(x,y) if(DEBUG) cerr << #x << " = " << x << " | " << #y << " = " << y << endl;
#define pb push_back
#define all(x) x.begin(), x.end()
#define endl "\n"
#define pii pair<int,int>
#define mid ((l+r)/2)

int sum;
int n,l;
int minn = 1e8;
int ans;

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

	for (int i = 1; i <= n; ++i)
	{
		sum += l + i - 1;

		if(minn > abs(l+i-1))	
		{
			ans = l+i-1;
			minn = abs(ans);
		}
	}

	cout << sum - ans;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<n;++i)
typedef long long ll;
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;}
typedef pair<ll,ll> P;

int main(){
    int n; cin >>n;
    vector<int> a(n),b(n);
    rep(i,n)cin >> a[i];
    b=a;
    sort(b.begin(),b.end(),greater<int>());
    rep(i,n){
        if(b[0]==a[i])cout<<b[1]<<endl;
        else cout << b[0]<<endl;
    }
    return 0;
}


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

using namespace std;

typedef long long ll;

int n, m;
vector<int> pos[100000 + 100];
ll a[100000 + 100];

int main() {
	cin >> n >> m;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		pos[a[i]].push_back(i);
	}
	
	ll ans = 0, cur = 0;
	int shortcut = 0;
	for (int i = 1; i < n; i++) {
		if ((m + a[i] - a[i - 1]) % m >= ((m + a[i] - 1) % m) + 1) {
			if (a[i] == 1) {
				//x+1で外れるとき。
				cur += (m + a[i] - a[i - 1]) % m;
			}else shortcut++, cur += ((m + a[i] - 1) % m) + 1;
			ans += ((m + a[i] - 1) % m) + 1;
		}
		else {
			ans += (m + a[i] - a[i - 1]) % m;
			cur += (m + a[i] - a[i - 1]) % m;
		}
	}
	
	for (int x = 2; x <= m; x++) {
		cur -= shortcut;
		ans = min(ans, cur);
		//このxからショートカットをするとかかる時間がそのまま以下になるもの
		for (int i = 0; i < pos[x - 1].size(); i++) {
			int idx = pos[x - 1][i];
			if (idx != n - 1) {
				shortcut++;
			}
		}

		//このxから、ショートカットをするより、普通にやったほうが同じか以上になるもの
		for (int i = 0; i < pos[x].size(); i++) {
			int idx = pos[x][i];
			if (idx != 0) {
				shortcut--;
				cur += (m + a[idx] - a[idx - 1]) % m - 1;
			}
		}
	}

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

Measured memory_bytes: 5760
#include<vector>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
#include<stack>
#include<bitset>
#include<functional>
#include<ctime>
#include<queue>
#include<deque>
#include<complex>
#include<cassert>
using namespace std;
#define pb push_back
#define pf push_front
typedef long long lint;
typedef complex<double> P;
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
int main()
{
	string s;cin>>s;
	if(s[0]==s[1] && s[1]==s[2]) cout<<"Yes"<<endl;
	else if(s[2]==s[3] && s[1]==s[2]) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
}


Measured memory_bytes: 764
package main

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

var sc = bufio.NewScanner(os.Stdin)

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

func main() {
	buf := make([]byte, 0)
	sc.Buffer(buf, 1000000007)
	sc.Split(bufio.ScanWords)
	l, _ := strconv.Atoi(Scanner())
	fl := float64(l) / 3
	fmt.Println(fl * fl * fl)
}


Measured memory_bytes: 640
from operator import itemgetter

n = int(input())
r = [['', 0, 0]] * n

for i in range(n):
  s_input, p_input = input().split(' ')
  r[i] = [s_input, int(p_input), i+1]
# print(n)
# print(r)

s = sorted(r, key=itemgetter(1), reverse=True)
sorted_for_book = sorted(s, key=itemgetter(0))
# print(sorted_for_book)
for item in sorted_for_book:
  print(item[2])

Measured memory_bytes: 38384
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
// typedef __int128 ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define FR first
#define SE second
#define MP make_pair
#define PB push_back
#define vc vector
#define db double
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define bin(x) (1ll<<(x))
#define fo(i,l,r) for(int i=(l),I=(r);i<=I;i++)
#define fd(i,r,l) for(int i=(r),I=(l);i>=I;i--)
#define mem(x,val) memset(x,val,sizeof x)
#define Swap(a,b,n) for(int I=0;I<=n;I++) swap(a[I],b[I])
#define PC __builtin_popcountll
#ifdef DEBUG
	#define debug(A,args...) fprintf(stderr,A,##args)
#else
	#define debug(A,args...) printf("")
#endif
#define deb debug("line %d\n",__LINE__)
namespace mine
{
	ll qread()
	{
		ll ans=0,f=1;char c=getchar();
		while(c<'0' or c>'9') {if(c=='-')f=-1;c=getchar();}
		while('0'<=c and c<='9') ans=ans*10+c-'0',c=getchar();
		return ans*f;
	}
	void write(ll num){if(num<0) putchar('-'),num=-num;if(num>=10) write(num/10);putchar('0'+num%10);}
	void write1(ll num){write(num);putchar(' ');}
	void write2(ll num){write(num);putchar('\n');}
	template<typename T>inline bool chmax(T&a,const T&b){return a<b?a=b,1:0;}
	template<typename T>inline bool chmin(T&a,const T&b){return a>b?a=b,1:0;}
	ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}
	bool IN(ll x,ll l,ll r){return l<=x and x<=r;}
	void GG(){puts("-1");exit(0);}
	
	const db eps=1e-8;
	const int INF=0x3f3f3f3f;
	const int MOD=1e9+7;
	int mm(const int x){return x>=MOD?x-MOD:x;}
	template<typename T> void add(T &x,const int &y){x=(x+y>=MOD?x+y-MOD:x+y);}
	ll qpower(ll x,ll e,int mod=MOD){ll ans=1;while(e){if(e&1)ans=ans*x%mod;x=x*x%mod;e>>=1;}return ans;}
	ll invm(ll x){return qpower(x,MOD-2);}
	const int MM=1e6+10;
	ll fac[MM],facinv[MM],Inv[MM];ll Comb(int n,int m){return n<0 or n<m?0:fac[n]*facinv[m]%MOD*facinv[n-m]%MOD;}
	void PRE()
	{
		fac[0]=1;fo(i,1,MM-1) fac[i]=fac[i-1]*i%MOD;
		facinv[MM-1]=invm(fac[MM-1]);fd(i,MM-1,1) facinv[i-1]=facinv[i]*i%MOD;
		Inv[1]=1;fo(i,2,MM-1) Inv[i]=(MOD-MOD/i)*Inv[MOD%i]%MOD;
	}
	const int N=1e6+10;
	//------------------FIXED------------------
	void main()
	{
		ll a=qread(),b=qread(),c=qread()-a-b;
		if( c>0 and 4*a*b<c*c ) puts("Yes"); else puts("No");
	}
};//变量重名！
signed main()
{
	#ifdef DEBUG
	//freopen("a.in","r",stdin);
	freopen("z.txt","r",stdin);
	//freopen("a.out","w",stdout);
	#endif
	srand(time(0));
	mine::PRE();
	mine::main();
	debug("\n------------------------------------------\nTime: %.2lf s",1.0*clock()/CLOCKS_PER_SEC);
}

Measured memory_bytes: 23680
cards = [[False for j in range(13)] for i in range(4)]
n = int(input())
for _ in range(n):
    ch, rank = input().split()
    if ch == 'S':
        cards[0][int(rank)-1] = True
    elif ch == 'H':
        cards[1][int(rank)-1] = True
    elif ch == 'C':
        cards[2][int(rank)-1] = True
    elif ch == 'D':
        cards[3][int(rank)-1] = True
for i in range(4):
    for j in range(13):
        if cards[i][j] == False:
            if i == 0:
                print('S', j+1)
            elif i == 1:
                print('H', j+1)
            elif i == 2:
                print('C', j+1)
            elif i == 3:
                print('D', j+1)


Measured memory_bytes: 5616
#include "bits/stdc++.h"
using namespace std;
#define REP(i, n) for(ll i = 0;i < n;i++)
#define ll long long
#define MOD 1000000007

int now,n,k;

int main(){
  int ans=0;
  
  string s;cin>>s;
  if (s[0]==s[1]){
    if (s[2]==s[3]){
      if (s[0]!=s[2])ans=1;
    }
  }
  if (s[2]==s[1]){
    if (s[0]==s[3]){
      if (s[0]!=s[2])ans=1;
    }
  }
  if (s[2]==s[0]){
    if (s[1]==s[3]){
      if (s[1]!=s[2])ans=1;
    }
  }

  
  
  if (ans==1){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;

  }
  
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h> //C++の標準ライブラリを一行で一括でインクルードする
#include <math.h> //数学関数と数学定数を利用する
#define rep(i,n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
template<class T> void chmax(T &a,T b) { if (a<b) a=b;}
template<class T> void chmin(T &a,T b) { if (a>b) a=b;}

string s;
int a,b,c,d;
char op[3];
string ans;

void check(){
  int sum = a;
  if(op[0] == '+'){
    sum += b;
  }else{
    sum -= b;
  }
  if(op[1] == '+'){
    sum += c;
  }else{
    sum -= c;
  }
  if(op[2] == '+'){
    sum += d;
  }else{
    sum -= d;
  }
  
  if(sum == 7){
    ans = to_string(a) + op[0] + to_string(b) + op[1] + to_string(c) + op[2] + to_string(d) + "=7";
  }
  return;
}

void rec(int pos){
  
  if(pos == 4){
    check();
    return;
  }
  op[pos] = '+'; rec(pos+1);
  op[pos] = '-'; rec(pos+1);
}

int main(){
  cin >> s;
  a = s[0] - '0'; b = s[1] - '0'; c = s[2] - '0'; d = s[3] - '0';
  rec(0);
  
  cout << ans;
  return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#define N 100
int head = 0, tail = 0, que[N], M[N][N] = {0}, n;
int INF = (1 << 21);

void bfs(void);
void push(int);
int pop(void);
int isEmpty(void);

int main(void){
	int u, k, v, i, j;

	for(i = 0; i < N; i++){
		que[i] = -1;
	}

	scanf("%d", &n);
	for(i = 0; i < n; i++){
		scanf("%d", &u);
		u--;
		scanf("%d", &k);
		for(j = 0; j < k; j++){
			scanf("%d", &v);
			v--;
			M[u][v] = 1;
		}
	}

	bfs();

	return 0;
}

void bfs(){
	int d[N], i = 0, u, v;
	while( i < N){
		d[i++] = INF;
    }

	d[0] = 0;
	push(0);

	while(!isEmpty()){
		u = pop();
		for(i = 0; i < n; i++){
			if(M[u][i] == 0) continue;
			if(d[i] != INF) continue;
			d[i] = d[u] + 1;
			push(i);
		}
	}

	for(i = 0; i < n; i++){
		printf("%d %d\n", i + 1, (d[i] == INF ? -1 : d[i]));
	}
}

void push(int a){
	que[tail++] = a;
}

int pop(){
	 int ret = que[head];
	 que[head++] = -1;
	 return ret;
}

int isEmpty(){
	return (head == tail);
}


Measured memory_bytes: 1948
<?php
fscanf(STDIN,"%d",$N);
// for文で$iを配列指定したいのでexplode
$A = explode(' ',trim(fgets(STDIN)));
$max = -100000;
for ($i = 0; $i < $N; $i++) {
//   echo $A[$i] . "\n";
 for($j=0;$j < $N; $j++){
    //  echo $A[$j] . "\n";
//   echo $A[$i] - $A[$j] . "\n";
$sum = $A[$i] - $A[$j] . "\n";
$sum_abs = abs($sum);
// echo $sum_abs . "\n";
$max = max($max,$sum_abs);
 }
}
echo $max;


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

using namespace std;

#define pb push_back
#define mp make_pair
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
typedef long long LL;
typedef pair<int, int> PII;

const int N = 200005;
const int INF = int(2e9);

struct Edge {
    int from, to, w;
    Edge(int from, int to, int w) : from(from), to(to), w(w) {}
};

inline bool cmp(const Edge &lhs, const Edge &rhs) {
    return lhs.w < rhs.w;
}

int n, q;
int best[N];
vector<Edge> e;

int par[N], ra[N];
void dsuInit() {
    forn(i, n) par[i] = i, ra[i] = 1;
}

int dsuParent(int v) {
    if (v == par[v]) return v;
    return par[v] = dsuParent(par[v]);
}

bool dsuMerge(int u, int v) {
    u = dsuParent(u);
    v = dsuParent(v);
    if (u == v) return false;
    if (ra[u] < ra[v]) swap(u, v);
    par[v] = u;
    ra[u] += ra[v];
    return true;
}

int main() {
    scanf("%d%d", &n, &q);
    forn(i, n) best[i] = INF;
    forn(i, q) {
        int a, b, c;
        scanf("%d%d%d", &a, &b, &c);
        e.pb(Edge(a, b, c));
        best[a] = min(best[a], c + 1);
        best[b] = min(best[b], c + 2);
    }
    forn(times, 3) {
        forn(i, n - 1) {
            best[i + 1] = min(best[i + 1], best[i] + 2);
        }
        best[0] = min(best[0], best[n - 1] + 2);
    }
    forn(i, n) {
        e.pb(Edge(i, (i + 1) % n, best[i]));
    }
    sort(e.begin(), e.end(), cmp);
    dsuInit();
    LL ans = 0;
    for (Edge ee : e) {
        //cerr << ee.from << ' ' << ee.to << ' ' << ee.w << endl;
        if (dsuMerge(ee.from, ee.to)) {
            ans += ee.w;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 7404
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
using P = pair<int, int>;
 
// 4近傍、8近傍
int dx[] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[] = {0, 1, 0, -1, 1, 1, -1, -1};
 
string acgt = "ACGT";
 
int main() {
  string s;
  cin >> s;
 
  int ans = 0;
  for (int i = 0; i < s.size(); i++) {
    int tmp = 0;
    for (int j = i; j < s.size(); j++) {
      if (acgt.find(s[j]) != string::npos) tmp++;
      else break;
    }
    ans = max(ans, tmp);
  }
 
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define DUMP(x)  cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define IFOR(i, m, n) for(int i = n - 1; i >= m; i-- )
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define FOREACH(x,a) for(auto& (x) : (a) )
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
const ll INF = 1LL << 60;
const int MOD = 1000000007;
/* テンプレートここまで */

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

  vector<int> b(4, 0);
  REP(i, N){
    int a;
    cin >> a;
    b[a] += 1;
  }

  vector<vector<vector<double>>> 
  dp(N+1, vector<vector<double>>(N+1, vector<double>(N+1, 0.0)));

  dp[0][0][0] = 0.0;

  FOR(k, 0, b[3] + 1){
    FOR(j, 0, b[2] + b[3] - k + 1 ){
      FOR(i, 0, b[1] + b[2] + b[3] - j - k + 1){
        if (i+j+k == 0) continue;
        // DUMP(i);
        // DUMP(j);
        // DUMP(k);
        double tmpi = i == 0 ? 0.0 : dp[i-1][j][k];
        double tmpj = j == 0 ? 0.0 : dp[i+1][j-1][k];
        double tmpk = k == 0 ? 0.0 : dp[i][j+1][k-1];
        dp[i][j][k] = 1.0 * ( N + i * tmpi
          + j * tmpj + k * tmpk) / (i+j+k);
        //DUMP(dp[i][j][k]);
      }
    }
  }

  cout << fixed << setprecision(13);
  cout << dp[b[1]][b[2]][b[3]] << endl;

}


Measured memory_bytes: 216832
n,m,c = map(int,input().split())
b = list(map(int,input().split()))
a = [list(map(int,input().split())) for i in range(n)]
cnt = 0
for i in range(n):
    d = c
    for j in range(m):
        d += a[i][j]*b[j]
    if d > 0:
        cnt += 1
print(cnt)

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

void solve() {
  string s;
  cin >> s;
  if (s == "Sunny") {
    cout << "Cloudy" << endl;
  } else if (s == "Cloudy") {
    cout << "Rainy" << endl;
  } else {
    cout << "Sunny" << endl;
  }
}

int main() {
  solve();
  return 0;
}


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


void solve(long long N, std::vector<long long> a){
    ll acc[N+1];
    acc[0] =0;
    for(int i=0;i<N;i++){
        acc[i+1] = acc[i] + a[i];
    }

    ll dp[N][N] = {};

    for(int w=0;w<N;w++){
        for(int l=0;l<N;l++){
            int r = l +w;
            if(r>=N){
                continue;
            }
            if(w==0){
                dp[l][r] = 0;
                continue;
            }
            if(w==1){
                dp[l][r] = a[l] + a[r];
                continue;
            }
            dp[l][r] = dp[l][l] + dp[l+1][r] + acc[r+1] -acc[l];
            for(int k=l+1;k<r;k++){
                dp[l][r] = min(dp[l][r], dp[l][k] + dp[k+1][r] + acc[r+1] -acc[l]);
                // cerr << "l =" << l << " r=" << r << "mid =" << k << "val = " << dp[l][k] + dp[k+1][r] + acc[r+1] -acc[l]<< endl;
                // cerr << "left =" << dp[l][k] << endl;
                // cerr << "right=" << dp[k+1][r] << endl;
                // cerr << "acc=" << acc[r+1] -acc[l]  << endl;
            }


        }
    }
    for(int i=0;i<N;i++){
        for(int j=i;j<N;j++){
            // cerr << "i=" << i <<" j=" << j << " val =" << dp[i][j] << endl;
        }
    }
    cout << dp[0][N-1] << endl;

}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> a(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&a[i]);
    }
    solve(N, std::move(a));
    return 0;
}


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

int main() {
    int N, a, b;
    cin >> N;
    vector<int>triangle(3);
    for(int i = 0; i < N; i++){
      for(int j = 0; j < 3; j++){
        cin >> triangle.at(j);
      }
      sort(triangle.begin(), triangle.end());

      int A, B, C;

      A = triangle.at(0);
      B = triangle.at(1);
      C = triangle.at(2);

      if(A * A + B * B == C * C){
        cout << "YES" << endl;
      }
      else{
        cout << "NO" << endl;
      }
    }
}



Measured memory_bytes: 3088
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std ;
#define int long long
#define fi first
#define se second
#define pb push_back
#define pii pair<int, int>
#define mod 1000000007

typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

int n ;
int arr[500005] ;
int suf[500005] ;
string str ;

void solve()
{
    cin >> n ;
    for(int i=1 ; i<=n ; i++)
        cin >> arr[i] ;
    for(int i=n ; i>=1 ; i--)
        suf[i] = (suf[i+1]+arr[i])%mod ;
    int ans = 0 ;
    for(int i=1 ; i<=n ; i++)
    {
        ans += (arr[i]*suf[i+1])%mod ;
        ans %= mod ;
    }
    cout << ans ;
}
int32_t main()
{
	ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
	int tt = 1;
	//cin >> tt ;
	while(tt--)
	{
	     solve() ;
	}
}


Measured memory_bytes: 6772
#include "bits/stdc++.h"
using namespace std;

#define DEBUG(x) cout<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cout<<#v<<":";for(int i=0;i<v.size();i++) cout<<" "<<v[i]; cout<<endl

typedef long long ll;
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
const int inf = 1000000001;
const ll INF = 2e18 * 2;
#define MOD 1000000007
#define mod 1000000009
#define pi 3.14159265358979323846
#define Sp(p) cout<<setprecision(15)<< fixed<<p<<endl;
int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };

int main() {
	int n, i, j;
	cin >> n;
	vi a(n*n);
	vector<pii> x(n);
	for (i = 0; i < n; i++) {
		cin >> x[i].first;
		x[i].first--;
		x[i].second = i + 1;
		if (a[x[i].first] != 0) {
			cout << "No" << endl;
			return 0;
		}
		else {
			a[x[i].first] = i + 1;
		}
	}
	sort(x.begin(), x.end());

	int stock = 0;
	j = 0;
	for (i = 0; i < n; i++) {
		int m = x[i].second;
		int cnt = m - 1;
		while (cnt > 0) {
			if (a[j] == 0) {
				a[j] = m;
				cnt--;
			}
			j++;
		}
	}
	for (i = 0; i < n; i++) {
		int m = x[i].second;
		int cnt = n - m;
		while (cnt > 0) {
			if (a[j] == 0) {
				a[j] = m;
				cnt--;
			}
			j++;
		}
	}
	vi num(n + 1);
	j = 0;
	for (i = 0; i < n*n; i++) {
		num[a[i]]++;
		if (x[j].first == i) {
			if (num[a[i]] != a[i]) {
				cout << "No" << endl;
				return 0;
			}
			j++;
		}
	}
	cout << "Yes" << endl;
	for (i = 0; i < n*n; i++) {
		cout << a[i] << " ";
	}
	cout << endl;


}

Measured memory_bytes: 2176
#include <bits/stdc++.h>
using namespace std;
using LL = long long;

int main(){
    
    // 1. 入力情報.
    LL a, b, c;
    scanf("%lld %lld %lld", &a, &b, &c);
    
    // 2. 評価.
    // -> 以下の2条件を確認.
    // c > a + b
    // (c - a - b) * (c - a - b) > 4 * a * b
    bool ok = c > (a + b);
    ok &= ((c - a - b) * (c - a - b)) > (4 * a * b);
    
    // 3. 出力.
    printf("%s\n", ok ? "Yes" : "No");
    return 0;
}

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

int main() {
    int numDays;
    cin >> numDays;
    vector<vector<int> > happiness(numDays, vector<int>(3));
    for(int i = 0; i < numDays; i++) {
        cin >> happiness[i][0];
        cin >> happiness[i][1];
        cin >> happiness[i][2];
    }

    vector<int> prevTotals(3, 0);
    vector<int> currentTotals(3);

    for(int i = 0; i < numDays; i++) {
        currentTotals[0] = max(prevTotals[1], prevTotals[2]) + happiness[i][0];
        currentTotals[1] = max(prevTotals[0], prevTotals[2]) + happiness[i][1];
        currentTotals[2] = max(prevTotals[0], prevTotals[1]) + happiness[i][2];
        prevTotals = currentTotals;
    }
    
    cout << *max_element(currentTotals.begin(), currentTotals.end());

    return 0;
}

Measured memory_bytes: 8372
#include <bits/stdc++.h>
using namespace std;
 
typedef unsigned long ul;
typedef unsigned long long ull;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
 
const ll MOD = 1e9+7;
const double PI  = 3.14159265358;
const double EPS = 1e-8;

#define INT_MX 2147483647
#define INF ((int)1e9)
#define LLINF ((ll)1e18)
#define F first
#define S second
#define MP(x,y) make_pair(x,y)
#define sz(v) ((int)v.size())
#define rs(n) resize(n)
#define ALL(v) v.begin(),v.end()
#define reset(v) memset((v),0,sizeof(v))
#define EB emplace_back
#define PB push_back
#define PF push_front
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define vec vector
#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);

void solve(){
	int hp, atk;
	
	cin >> hp >> atk;
	
	cout << ceil(double(hp) / atk) << '\n';
}

int main(){
	int t = 1;
	
	while(t--){
		solve();
	}
}




Measured memory_bytes: 256
H,W,N=gets.split.map &:to_i
y,x=gets.split.map &:to_i
S=gets
T=gets
yU=yD=y-1
xL=xR=x-1
N.times{|i|
S[i]=='L'&&xL-=1
S[i]=='R'&&xR+=1
S[i]=='U'&&yU-=1
S[i]=='D'&&yD+=1
(xL<0||xR>=W||yU<0||yD>=H)&&(puts "NO";exit)
T[i]=='L'&&xR>0&&xR-=1
T[i]=='R'&&xL<W-1&&xL+=1
T[i]=='U'&&yD>0&&yD-=1
T[i]=='D'&&yU<H-1&&yU+=1
}
puts "YES"

Measured memory_bytes: 2300
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define _GLIBCXX_DEBUG
#define rep(i, a, b) for(int i = a; i < b; i++)
#define ALL(v) v.begin(), v.end()

int main(){
    int a; string s;
    cin>>a>>s;
    if(a>=3200) cout<<s<<endl;
    else cout<<"red"<<endl;
}

Measured memory_bytes: 256
def read_input():
    n = int(input())
    slist = []
    for i in range(n):
        slist.append(int(input()))
    return n, slist

# return matrix initialized by zero
# shape = (n, m)
def make_2d_matrix(n, m):
    result = []
    for i in range(n):
        result.append([0]*m)

    return result


def submit():
    n, slist = read_input()
    total = sum(slist)
    dp = make_2d_matrix(len(slist) + 1, total + 1)

    # dp[0][0] = 1 , dp[0][not 0] = 0
    # dp[i][j]はi番目のsまででjになる/ならない
    # dp[i][j] =
    #       1 if dp[i - 1][j] == 1
    #       1 if dp[i - 1][j - xj] == 1

    dp[0][0] = 1
    for i in range(1, len(slist) + 1):
        for j in range(total + 1):
            if dp[i - 1][j] == 1:
                dp[i][j] = 1
            else:
                if j - slist[i - 1] >= 0:
                    if dp[i - 1][j - slist[i - 1]] == 1:
                        dp[i][j] = 1

    maxscore = 0
    for s in range(total + 1):
        if dp[len(slist)][s] == 1:
            if s % 10:
                if maxscore < s:
                    maxscore = s

    print(maxscore)


if __name__ == '__main__':
    submit()

Measured memory_bytes: 48816
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector<bool> vb;
#define pb push_back
#define fi first
#define se second
#define in insert
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int mod = 1e9 + 7;
void solve(){
    int a, b;
    cin >> a >> b;
    if (a == b) cout << "Draw";
    else if (a == 1) cout << "Alice";
    else if (b == 1) cout << "Bob";
    else if (a < b) cout << "Bob";
    else cout << "Alice";
}
int main(){
    speed;
    int t = 1;
    //cin >> t;
    for (int i = 1; i <= t; ++i) {
        solve();
    }
}

Measured memory_bytes: 256
#!/usr/bin/env python3

n = int(input())
S = [ sorted(input()) for _ in range(n) ]

ans = ""

for i in S[0]:
    flag = True
    for j in range(n):
        if i not in S[j]:
            flag = False
            break

    if flag:
        ans += i
        for j in range(n):
            S[j] = S[j][0:S[j].index(i)] + S[j][S[j].index(i)+1:]

print(ans)


Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <vector>
#include <cstdio>
#include <bits/stdc++.h>
#include <set>
#include <map>
#include <stdio.h>
#include <stack>
#include <queue>
#include <deque>
#include <numeric>
#include<bits/stdc++.h>
#include <utility>

#define ALL(obj) (obj).begin(), (obj).end()
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define RFOR(i,a,b) for(int i = (a); (b) <= i; i--)
#define REP(i,n) for(int i = 0; i < (n); i++)
#define RREP(i,n) for(int i = n; n <= i; i--)
#define ABS(a) ((a < 0) ? ((-1)*(a)) : (a))
#define elif else if
#define MOD 1000000007
#define INF (1<<29)

using namespace std;
using ll = long long;
map <int ,int> mpa,mpb;
typedef pair<ll, ll> P;
priority_queue<P, vector<P>, greater<P>> pque;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  int N,K;
  cin >> N >> K;
  cout << (N%K==0?0:1) << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define Imposter ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
#define ll long long int
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("O3")
using namespace __gnu_pbds;
#define ordered_set tree<ll, null_type,less_equal<ll>, rb_tree_tag,tree_order_statistics_node_update>//s.order_of_key(val) *s.find_by_order(ind)
using namespace std;
#define f(n) for(ll i=0;i<n;i++)
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define input(arr,n) for(ll i1=0;i1<n;i1++ )cin>>arr[i1]
#define endl "\n"
#define vll vector<ll>
#define vlll vector<vll>
#define all(x) x.begin(),x.end()
ll power(ll x, ll y, ll p) { 
    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; 
}
int main()
{
    Imposter
    
    int t=1;
    //cin>>t;
    while(t--)
    {
       ll a,b,c,d;
       cin>>a>>b>>c>>d;
       vll vb;
       vb.pb(a*c);
       vb.pb(b*d);
       vb.pb(a*d);
       vb.pb(b*c);
       ll p=ceil((double)(a+b)/2.0);
       ll q=ceil((double)(c+d)/2.0);
       vb.pb(p*q);
       vb.pb(p*c);
       vb.pb(p*d);
       vb.pb(q*a);
       vb.pb(q*b);
       sort(all(vb));
       cout<<vb[vb.size()-1];
        
    }
    return 0;
}

Measured memory_bytes: 3740
import java.util.Scanner;

public class Main {

    public static void main(final String[] args) {
        try (final Scanner sc = new Scanner(System.in)) {
            final int[] nums = new int[5];
            for (int i = 0; i < nums.length; i++) {
                nums[i] = sc.nextInt();
            }
            final int k = sc.nextInt();

            for (int i = 0; i < 5; i++) {
                for (int j = i + 1; j < 5; j++) {
                    if ((nums[j] - nums[i]) > k) {
                        System.out.println(":(");
                        return;
                    }
                }
            }
            System.out.println("Yay!");
        }
    }
}


Measured memory_bytes: 23252
#include <cstdio>
#include <cstring>
#include <cmath>
#include <utility>
#include <iostream>
#include <algorithm>
#include <vector>
#include <forward_list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#define rep(i, s, g) for ((i) = (s); (i) < (g); ++(i))
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const ll MOD = 1e9 + 7;
const ll INF = (1ll << 62) - 1;

int main(void)
{
    int n;

    cin >> n;

    cout << (n + 1) / 2 << endl;
}


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

int main(){
  string today;
  cin>>today;
  string week[7]={"SUN","MON","TUE","WED","THU","FRI","SAT"};
  for(int i=0;i<7;i++){
    if(week[i]==today){
      cout<<7-i<<endl;
    }
  }
}

Measured memory_bytes: 256
xs,yx,xt,yt = map(int,input().split())
N = int(input())
l = [[],[xs,yx,0],[xt,yt,0]]
for i in range(N):
  l.append(list(map(int,input().split())))
##距離リスト
d = [[0]*(N+3) for _ in range(N+3)]
for i in range(1,N+3):
  d[i][i] = 0
#O(10**6)
for i in range(1,N+3):
  for j in range(i+1,N+3):
    sa = (l[i][0]-l[j][0])**2 + (l[i][1]-l[j][1])**2
    kyori = max(0,sa**(1/2)-l[i][2]-l[j][2])
    d[i][j] = kyori
    d[j][i] = kyori

md = [float("inf")]*(N+3)
h = [i for i in range(1,N+3)]
for i in range(1,N+3):
  md[i]=d[1][i]
seen = [False]*(N+3)
seen[1] = True
while True:
  #vを出す
  v = -1
  for i in h:
    if seen[i] == False and v == -1:
      v = i
    elif seen[i] == False and md[i] < md[v]:
      v = i
  if v == -1:
    break
  seen[v] = True
  for j in range(1,N+3):
    md[j] = min(md[j],md[v]+d[v][j])
print(md[2])      

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

int main() {
	int X;
	cin >> X;
	int HP=0;
	int A;
	A = X / 500;
	HP = 1000 * A;
	X = X - 500 * A;
	HP = HP + X / 5 * 5;
	cout << HP;
}

Measured memory_bytes: 256
#n = int(input())
#n, x  = map(int, input().split())
#h = list(map(int, input().split()))
#s = list(str(input()))
n = 4
m = [0]*n
counter = 0
for i in range(n):
  m[i] = int(input())

for i in range(m[0]+1):
  for ii in range(m[1]+1):
    for iii in range(m[2]+1):
      if (m[3] == i*500+ii*100+iii*50):
        counter = counter + 1
        
print(counter)

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

#define rep(X,N) for(ll X = 0; X < (N); X++)
#define PI (acos(-1.0))
#define pback push_back
#define mpair make_pair
#define MODN 1000000007
#define ALL(V) (V).begin(),(V).end()
#define INT_MAX_HALF (INT_MAX / 2)
#define EPS (1e-10)

using namespace std;

typedef long long ll;

int main(){

    int n;
    cin >> n;

    vector<vector<string>> v(n + 1);

    v[1].pback("a");

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

        rep(j, v[i - 1].size()){
            string tmp = v[i - 1][j];

            int kind = 0;

            rep(k, tmp.size()){
                kind = kind | (1<<(tmp[k] - 'a'));
            }

            kind = __builtin_popcount(kind);

            rep(k, kind + 1){
                string tmp2 = tmp + (char)('a' + k);
                v[i].pback(tmp2);
            }
        }
    }

    sort(ALL(v[n]));

    rep(i, v[n].size()){
        cout << v[n][i] << endl;
    }

    return 0;
}


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

int B[100005];

int main() {
    int N, H, a = 0, x;
    scanf("%d %d", &N, &H);
    for (int i = 0; i < N; i++) {
        scanf("%d %d", &x, &B[i]);
        a = max(a, x);
    }
    sort(B, B + N, greater<int>());
    for (int i = 0; i < N - 1; i++) B[i+1] += B[i];
    int ans = 1000000005;
    for (int i = 0; i <= N; i++) {
        int h = H;
        int num = i;
        if (i > 0) h -= B[i-1];
        if (h > 0) num += (h - 1) / a + 1;
        ans = min(ans, num);
    }
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <iomanip>
#include <stack>
#include <queue>
#include <numeric>
#include <map>
#include <unordered_map>
#include <set>
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define pb push_back
#define mod 1000000007
using ll = long long;
using namespace std;

int main(){
  int a,b,h;
  cin >> a >> b  >> h;
  cout << (a+b) * h / 2 << endl;
  return 0;
}


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

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

    vector<int> g1(n), g2(n);
    g1[0] = a[0], g2[n - 1] = a.back();
    for(int i = 1; i < n; ++i) {
        g1[i] = __gcd(g1[i - 1], a[i]);
    }
    for(int i = n - 2; i >= 0; --i) {
        g2[i] = __gcd(g2[i + 1], a[i]);
    }

    int ans = 0;
    for(int i = 0; i < n; ++i) {
        const int gg1 = (i == 0 ? 0 : g1[i - 1]);
        const int gg2 = (i == n - 1 ? 0 : g2[i + 1]);
        ans = max(ans, __gcd(gg1, gg2));
    }
    cout << ans << endl;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
using intl = long long;
using ld = long double;
using namespace std;
#define rep(i, n) for(intl i = 0; i < (intl)(n); i++)
#define repd(i, n) for(intl i = (intl)(n); i >= 0; i--)
#define repi(i, a, b) for(intl i = (intl)(a); i < (intl)(b); i++)
#define repid(i, a, b) for(intl i = (intl)(a); i >= (intl)(b); i--)
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) < (b) ? (a) : (b))
#define all(x) (x).begin,(x).end()
#define m0(x) memset(x,0,sizeof(x))
#define m1(x) memset(x,1,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))
#define alength(a) (sizeof(a) / sizeof(a[0]))
#define cin(i, a) rep(i, alength(a))cin >> a[i]
#define ccin(i, j, a) rep(i, alength(a))rep(j, alength(a[i]))cin >> a[i][j]
#define debug(x) cout << #x << ":" << x << endl
#define rdebug(i,x) rep(i, alength(x))cout << #x << "[" << i << "]:" << x[i] << endl
#define sqrt sqrtl
#define int intl
#define itn intl
#define double ld
#define pb push_back
#define mp make_pair
const intl INF = 1e9;
const intl MOD = 1e9+7;
const ld eps = 1.0e-14;//-9
void fp(bool flag){
    if(flag)cout << "Yes" << endl;
    else cout << "No" << endl;
}
void fp(bool flag, string s, string t){
    if(flag)cout << s << endl;
    else cout << t << endl;
}
intl kai(intl k){
    intl a = 1;
    for(int i = 2; i <= k; i++){
        a *= i;
    }
    return a;
}
intl gcd(intl a, intl b){
    if(!b)return a;
    return gcd(b, a % b);
}
intl digit10(intl a){
    if(!a)return 1;
    intl b = 0;
    while(a){
        a /= 10;
        b++;
    }
    return b;
}
signed main(){
    cout << fixed << setprecision(10);
    intl n,m;
    cin >> n >> m;
    char s[n][n];
    ccin(i,j,s);
    string t = "";
    rep(i,m){
        string u;
        cin >> u;
        t += u;
    }
    //debug(t);
    bool f = false;
    rep(i,n - m + 1){
        rep(j,n - m + 1){
            string u = "";
            rep(k,m){
                rep(l,m){
                    u += s[i + k][j + l];
                }
            }
            if(t == u)f = true;
        }
    }
    fp(f);
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include<math.h>
#include<algorithm> 
#define rep(i,n) for (int i = 0; i < (n) ; ++i)
using namespace std;
using ll = long long ;
using P = pair<int, int> ;
#define PI 3.14159265358979323846264338327950
#define INF 1e18

int main() {
    int n, x ;
    cin >> n >> x ;
    vector<int> d (n) ;
    rep(i, n) cin >> d[i] ;
    int t = 0;
    int res = 0 ;
    rep(i, n){
        t = t + d[i] ;
        res++ ;
        if(t > x){
            break ;
        }
        if(i == (n - 1)){
            res++ ;
        }
    }
    cout << res << endl ;
}

Measured memory_bytes: 3620
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;

int main(){
    vector<int> in(3);
    cin >>in[0] >>in[1] >> in[2];
    sort(in.begin(),in.end());
    in[0] = in[2]- in[0];
    in[1] = in[2]-in[1];
    in[2] = 0;
    int ans = in[1];
    in[0] = in[0]-in[1];
    if(in[0]%2 == 1){
        ans += in[0]/2+2;
    }else{
        ans += in[0]/2;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256