akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <type_traits>
using namespace std;

using ll = long long;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define ddrep(i, n) for (int i = n; i > 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define ssrep(i, s, t) for (int i = s; i <= t; ++i)

#define rng(a) a.begin(), a.end()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second

#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))

using pi = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using ld = long double;

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "{";
  rep(i, (int)v.size()) {
    if (i)
      os << ",";
    os << v[i];
  }
  os << "}";
  return os;
}

template <typename T, size_t S> void printArray(const T (&array)[S]) {
  for (auto val : array)
    std::cout << val << ", ";
  std::cout << "\n";
}

const int mod = 1e9 + 7;
const int inf = 1e9 + 5;

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

  int n, m; std::cin >> n >> m;
  vi s(m), c(m);
  rep(i, m) std::cin >> s[i] >> c[i];
  int ma = 1; rep(i, n) ma *= 10;
  int ans = -1;
  auto check = [&](int x) {
    vi digits;
    if (x == 0) digits.pb(0);
    else while (x) digits.pb(x%10), x /= 10;
    if (digits.size() != n) return false;
    reverse(rng(digits));
    bool ok = true;
    rep(i, m) {
      if (digits[s[i]-1] != c[i]) ok = false;
    }
    return ok;
  };
  rep(x, ma) {
    if (!check(x)) continue;
    ans = x;
    break;
  }
  std::cout << ans << "\n";
}


Measured memory_bytes: 256
#include <ios>
#include <iomanip>
#include <iostream>
#include <functional>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <climits>
 
using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007
#define INF (1e9)

#define PI (acos(-1))
#define print(x) cout << x << endl
 
ll gcd(ll a, ll b) { return b ? gcd(b,a%b) : a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
typedef pair <ll,ll> P;

int main()
{
    ll N;
    cin >> N;
    vector<ll> V(N);
    rep(i, N) cin >> V[i];
    vector<ll> C(N);
    rep(i, N) cin >> C[i];
    ll sum = 0;
    rep(i, N) {
        if (V[i] - C[i] > 0) {
            sum += V[i] - C[i];
        }
    }
    print(sum);
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <cstdlib>  // abs() for integer 絶対値求めやつ
#include <cmath>    // abs() for float, and fabs()
#include <algorithm>
#include <vector>
#include <string>
#include<iomanip>//浮動小数点数を出力する制度の指定
//使い方　数値をnumとして　cout<<setprecision(n)<<num ;nは桁数
#define rep(i,n) for(int i = 0; i < (n);i++)
#define SORT(a) sort((a).begin(),(a).end())
#define REV(a) reverse((a).begin(),(a).end())
using namespace std;
using ll =long long;
#define INF 2000000000
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; }
#define che(a,string) cout<<"//"<<string <<"=="<<(a)<<"//" <<endl;
bool IsInt(double a){int b = a/1;if(a==b){return true;}else {return false;}}
/*覚えてないことメaモ
数値型から文字列に変換　to_string(number);これは簡単
文字列から数値型に変換　stoi(number)
文字列からllに変換　stoll(number)*/

//ここから書き始める
int main(){
	int n ;
	cin >> n;
	vector<int> a(n);
	vector<int> b(n);
	vector<int> c(n-1);
	rep(i,n) cin>>a[i];
	rep(i,n) cin>>b[i];
	rep(i,n-1) cin>>c[i];

	ll ans = 0;
	rep(i,n){
		int A = a[i]-1; //i番目に食べる
		ans += b[A];//

		if(i!=0&&A==a[i-1]){
			ans +=c[A-1];
		}
	}
	cout << ans << endl;

}


Measured memory_bytes: 256
#include <stdio.h>

int main(void){
  int n, t;
  int c[101];
  int d[101];

  scanf("%d %d", &n, &t);

  int i, minc=1001;
  for(i=0;i<n;i++){
    scanf("%d %d", &c[i], &d[i]);
    if(d[i]<=t && c[i]<minc){
      minc = c[i];
    }
  }
  if(minc == 1001){
    printf("TLE\n");
  }else{
    printf("%d\n", minc);
  }

  return 0;
}

Measured memory_bytes: 128
N, A, B = map(int, input().split())


def getSum(i):
    a = [int(x) for x in str(i)]
    sum = 0
    for x in a:
        sum += x
    return sum


ans = 0

for i in range(N+1):
    if A <= getSum(i) and getSum(i) <= B:
        ans += i

print(ans)


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


int main(){


    long long n, w, i, j, f, l, t, s, x;

    long long k = 0;

    long long m = 0;


 
    cin >> n >> w;


    vector<long long> w0(n);

    vector<long long> w1(n);

    vector<long long> w2(n);

    vector<long long> w3(n);


    cin >> x >> s;

    w0.at(0) = s;


    for( i = 0 ; i < n - 1 ; i = i + 1 ){

         cin >> t >> s;

         if( t - x == 0 ) w0.at(i + 1) = s;

         else if( t - x == 1 ) w1.at(i) = s;

         else if( t - x == 2 ) w2.at(i) = s;

         else if( t - x == 3 ) w3.at(i) = s;

         }


    sort( w0.rbegin(), w0.rend() );

    sort( w1.rbegin(), w1.rend() );

    sort( w2.rbegin(), w2.rend() );

    sort( w3.rbegin(), w3.rend() );



    vector<long long> s0(n + 1);

    vector<long long> s1(n + 1);

    vector<long long> s2(n + 1);

    vector<long long> s3(n + 1);



    for( i = 0 ; i < w0.size() + 1 ; i = i + 1 ){

         if( i == 0 ) s0.at(i) = 0;

         else s0.at(i) = s0.at(i - 1) + w0.at(i - 1);

         }

    for( i = 0 ; i < w1.size() + 1 ; i = i + 1 ){

         if( i == 0 ) s1.at(i) = 0;

         else s1.at(i) = s1.at(i - 1) + w1.at(i - 1);

         }

    for( i = 0 ; i < w2.size() + 1 ; i = i + 1 ){

         if( i == 0 ) s2.at(i) = 0;

         else s2.at(i) = s2.at(i - 1) + w2.at(i - 1);

         }

    for( i = 0 ; i < w3.size() + 1 ; i = i + 1 ){

         if( i == 0 ) s3.at(i) = 0;

         else s3.at(i) = s3.at(i - 1) + w3.at(i - 1);

         }


    for( i = 0 ; i < s0.size() ; i = i + 1 ){ 

         for( j = 0 ; j < s1.size() ; j = j + 1 ){ 

              for( f = 0 ; f < s2.size() ; f = f + 1 ){ 

                   for( l = 0 ; l < s3.size() ; l = l + 1 ){

                        if( x * i + ( x + 1 ) * j + ( x + 2 ) * f + ( x + 3 ) * l <= w ){

                            k += s0.at(i) + s1.at(j) + s2.at(f) + s3.at(l);

                            m = max(k, m);

                            k = 0;

                            }

                        }

                   }

               }

          }


    cout << m << endl;


    return 0;


    }

Measured memory_bytes: 256
#include<cstdio>
int t;
long long a[90];
int main(){
	a[0]=2,a[1]=1;
	scanf("%d",&t);
	for(int i=2;i<=t;i++) a[i]=a[i-1]+a[i-2];
	printf("%lld",a[t]);
	return 0;
}

Measured memory_bytes: 128
#include <algorithm>
#include <cmath>
#include <vector>
#include <functional>
#include <cstdlib>
#include <map>
#include <set>
#include <iostream>
#include <string>
#include <ctype.h>
#include <climits>
#include <queue>
using namespace std;
typedef long long ll;
#define REP(i, n) for(ll i = 0; i < (ll)(n); ++i)
#define FOR(i, a, b) for(ll i=(a); i < (ll)(b); ++i)
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;}

int v[100002];

int main(){
	int n;
	cin >> n;
	vector<int> a(n);
	REP(i,n) cin >> a[i];
	
	REP(i,n){
		v[a[i]]++;
		v[a[i]+1]++;
		v[a[i]+2]++;
	}
	
	int ans=0;
	REP(i,100002){
		chmax(ans, v[i]);
	}
	
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 4016
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<queue>
#include<vector>
#include<map>
#include<list>
#include<cctype>
#include<climits>
#include<bitset>
#include<stack>

using namespace std;

typedef long long ll;

const int dx[4] = { 1, 0, -1, 0 }, dy[4] = { 0, 1, 0, -1 };
const int MAX = 19;
int W, H, fld[10][10];
int P, sx, sy;
map<pair<pair<int, int>, int>, int> memo;

inline int CountBit(int s)
{
	int res = 0;
	for (int i = 0; i < P; i++) res += (s >> i) & 1;
	return res;
}

inline bool IsInside(int x, int y)
{
	return 0 <= x && x < W && 0 <= y && y < H;
}

inline bool CanDown(int x, int y, int s, int noBits)
{
	if (x == sx && y == sy && noBits == P) return true;
	if (fld[y][x] == -1) return false;
	return ((s >> fld[y][x]) & 1) == 0;
}

int DFS(int x, int y, int s)
{
	int cnt = CountBit(s);
	if (x == sx && y == sy && cnt == P) return 1;
	pair<pair<int, int>, int> state = make_pair(make_pair(x, y), s);
	if (cnt < MAX)
	{
		map<pair<pair<int, int>, int>, int>::iterator itr = memo.find(state);
		if (itr != memo.end()) return itr->second;
	}
	int sum = 0;
	for (int i = 0; i < 4; i++)
	{
		int nx = x + dx[i], ny = y + dy[i];
		while (IsInside(nx, ny) && !CanDown(nx, ny, s, cnt))
			nx += dx[i], ny += dy[i];
		if (!IsInside(nx, ny)) continue;
		sum += DFS(nx, ny, s | (1 << fld[ny][nx]));
	}
	if (cnt < MAX && !(cnt >= 17 && sum == 0)) memo[state] = sum;
	return sum;
}

signed main()
{
	while (cin >> W >> H, W || H)
	{
		memo.clear();
		P = 0;
		for (int i = 0; i < H; i++)
		{
			for (int j = 0; j < W; j++)
			{
				cin >> fld[i][j];
				if (fld[i][j] == 0) fld[i][j] = -1;
				else if (fld[i][j] == 1) fld[i][j] = P++;
				else sx = j, sy = i, fld[i][j] = -1;
			}
		}
		printf("%d\n", DFS(sx, sy, 0));
	}
	return 0;
}

Measured memory_bytes: 48688
ho=input().split()
if(int(ho[0]) == int(ho[1]) == int(ho[2])):
    print(1)
elif (int(ho[0]) == int(ho[1]) or int(ho[1]) == int(ho[2]) or int(ho[2]) == int(ho[0])):
    print(2)
else:
    print(3)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
const int N = 504;
int a[N][N];
int H, W, h, w;
int main()
{
	cin >> H >> W >> h >> w;

	if(H % h == 0 && W % w == 0)
		return cout << "No", 0;

	
	cout << "Yes\n";

	for(int i = 0; i < H; i++)
	{
		for(int j = 0;j < W;j++)
		{
			if(H % h != 0)
			{
				if(i % h == 0)
					a[i][j] = 1000 * (h - 1) - 1;
				else
					a[i][j] = -1000;
			}

			else
			{
				if(j % w == 0)
					a[i][j] = 1000 * (w - 1) - 1;
				else
					a[i][j] = -1000;
			}
			
		}
	}

	for(int i = 0; i < H; i++)
	{
		for(int j = 0; j < W; j++)
		{
			cout << a[i][j] << ' ';
		}
		cout << '\n';
	}
}

Measured memory_bytes: 2688
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <ctime>
#include <cstring>
#include <functional>
#include <iostream>
#include <iomanip>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <regex>
#include <vector>

#define fix(n)          cout<<fixed<<setprecision(n)
#define rep(i,n)        for (int i = 0; i < (n); ++i)
#define sort(a)         sort((a).begin(), (a).end())
#define uniq(a)         sort(a);(a).erase(unique((a).begin(), (a).end()), (a).end())
#define reverse(a)      reverse((a).begin(), (a).end())
#define ctos(c)         string(1, (c))
#define out(d)          cout << (d)
#define outl(d)         std::cout<<(d)<<"\n"
#define YES()           cout << "YES" << endl
#define NO()            cout << "NO" << endl
#define Yes()           cout << "Yes" << endl
#define No()            cout << "No" << endl
#define ceil(x, y)      ((x + y - 1) / (y))
#define debug(x)        cerr << #x << ": " << (x) << '\n'
#define debug2(x, y)    cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << '\n'
#define debug3(x, y, z) cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << ", " << #z << ": " << (z) << '\n'
#define dbg(v)          for (size_t _ = 0; _ < v.size(); ++_){ cerr << #v << "[" << _ << "] : " << v[_] << '\n'; }

using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll,ll>;

const ll MOD = 1000000007; // 10^9 + 7

void solve() {
  ld a, b, c; cin >> a >> b >> c;
  ld d = c - a - b;
  if (d >= 0 && a + 2*sqrt(a*b) + b < c) Yes();
  else No();
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  srand((unsigned)time(NULL));
  fix(16);

  solve();
}


Measured memory_bytes: 384
package main

import (
	"fmt"
	"regexp"
)

type line struct {
	s string
}

func main() {
	var n int
	n = 1
	// fmt.Scan(&n, &m)

	lines := []line{}
	for i := 0; i < n; i++ {
		l := line{}
		fmt.Scan(&l.s)
		lines = append(lines, l)
	}
	// fmt.Println(lines)

	test := func(lines []line) string {
		for _, l := range lines {
			r := regexp.MustCompile("^(dream|dreamer|erase|eraser)*$")
			if r.MatchString(l.s) {
				return "YES"
			}
		}
		return "NO"
	}
	fmt.Println(test(lines))
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a,b;
  int x = 0;
  cin >> a >> b;
  if((a+b)%2*10/2 >= 5){
    x = 1;
  }
  cout << (a+b)/2 + x << endl;
  return 0;
}

Measured memory_bytes: 3576
#include<iostream>
using namespace std;
int main()
{
	long long int N,k,i,j,ans=0;
  	cin>>N>>k;
  	long long int start_value=0;
      	long long int end_value=0;
      	for(j=0;j<k;j++)
        {
        	start_value+=j;
          	end_value+=N-j;
          
        }
        ans+=end_value-start_value+1;
        start_value+=k;
        end_value=end_value+N-k;
    	 //ans=ans%1000000007;
    	 //cout<<start_value<<endl;
    	 //cout<<end_value<<endl;
  	
  	for(i=k+1;i<=N+1;i++)
    {
        ans+=end_value-start_value+1;
    	 ans=ans%1000000007;
    	start_value=start_value+i;
    	end_value=end_value+N-i;
      	
    	 //cout<<start_value<<endl;
    	 //cout<<end_value<<endl;
    	 //cout<<ans<<endl;
    }
   
  	cout<<ans<<endl;


	return 0;
}


Measured memory_bytes: 3632
from collections import deque

dic = {}
dic[(0,1,2,3,4,5,6,7)] = 0


swap_dic = {0:(1, 4), 1:(0, 2, 5), 2:(1, 3, 6), 3:(2, 7),
            4:(0, 5), 5:(1, 4, 6), 6:(2, 5, 7), 7:(3, 6)}

def swap(puz, i, j):
  new = [k for k in puz]
  new[i], new[j] = new[j], new[i]
  return tuple(new)

que = deque()
que.append((0, (0,1,2,3,4,5,6,7)))
while que:
  score, puz = que.popleft()
  score += 1
  z_ind = puz.index(0)

  for swap_ind in swap_dic[z_ind]:
    new_puz = swap(puz, z_ind, swap_ind)
    if not new_puz in dic:
      dic[new_puz] = score
      que.append((score, new_puz))

while True:
  try:
    print(dic[tuple(map(int, input().split()))])
  except EOFError:
    break


Measured memory_bytes: 9000
//package reedeka;
import java.util.*;
import java.lang.*;

public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int n, x;
		n = sc.nextInt();
		int i;
		long sum = 0;
		for(i=0; i<n; i++) {
			x = sc.nextInt();
			sum += (x-1);
		}
		System.out.println(sum);
	}
}


Measured memory_bytes: 40456
from itertools import count
a,b,c=map(int,input().split())
g=set()
for n in count(0):
    p=(c+60*n)//(a+b)
    if ((a+b)*p-(c+60*n),(c+60*n)-((a+b)*p+a)) in g:
        n=-1
        break
    if (a+b)*p<=c+60*n<=(a+b)*p+a:
        break
    else:
        d=(a+b)*p-(c+60*n)
        e=(c+60*n)-((a+b)*p+a)
        g.add((d,e))
if n>=0:
    print(c+60*n)
else:
    print(n)



Measured memory_bytes: 5644
se = set([])
n = int(raw_input())
for i in range(n):
    s = raw_input().split()
    if s[0] == 'insert':
        se.add(s[1])
    elif s[0] == 'find':
        if s[1] in se:
            print 'yes'
        else:
            print 'no'

Measured memory_bytes: 57420
#include <bits/stdc++.h>
int main(){
    int n, m;
    scanf("%d %d", &n, &m);
    int a[n][m];
    int b[m];
    for(int i = 0; i < n; i++){
        for(int j = 0; j < m; j++) scanf("%d", &a[i][j]);
    }
    for(int i = 0; i < m; i++)scanf("%d", &b[i]);
    for(int i = 0 ; i < n; i++){
        int res = 0;
        for(int j = 0; j < m; j++){
            res += a[i][j] * b[j];
        }
        printf("%d\n", res);
    }
    return 0;
}


Measured memory_bytes: 3224
#include <iostream>
    using namespace std;
     
    char alpha;
     
    int main() {
     
    	cin>>alpha;
     
    	if (alpha>= 65 && alpha <=90){
    		cout<<"A"<<endl;
    	} else if(alpha>=97 && alpha<=122){
    		cout<<"a"<<endl;
    	}
    	return 0;
    }

Measured memory_bytes: 3648
#include<iostream>
#include<algorithm>
#include<bitset>
#include<climits>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<deque>
#include<climits>
#include<list>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<vector>
#include<iomanip>
#include<sstream>

using namespace std;
#define ll long long
inline ll read() {
    char ch = getchar(); ll x = 0, f = 1;
    while(ch < '0' || ch > '9') {
        if(ch == '-') f = -1;
        ch = getchar();
    } while('0' <= ch && ch <= '9') {
        x = x * 10 + ch - '0';
        ch = getchar();
    } return x * f;
}
int a[5000000];
int main(){
	int n=read();
	for (int i=1;i<=n;i++)
	  scanf("%d",&a[i]);
	sort(a+1,a+1+n);
	int now=a[1];
	for (int i=1;i<n;i++)
	if (abs(now*2-a[n])>abs(a[i]*2-a[n]))
		now=a[i];
	cout<<a[n]<<' '<<now;
}


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

int main() {
	string s;cin>>s;
	int k;cin>>k;
	char ans='1';
	for(int i=0;i<k;i++){
		if(s[i]!='1'){
			ans=s[i];
			break;
		}
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <ctype.h>
#include <math.h>
#include <numeric>
using namespace std;


int main(){
    int64_t a,b,c;
    cin>>a>>b;
    for(int i=1;i<=b;i++){
        if((a*i)%b==0){
            c=a*i;
            break;
        }
    }
    cout<<c<<endl;
}


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

using namespace std;
#ifdef _DEBUG
#define _GLIBCXX_DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

#define int long long
#define ll long long
#define ll1 1ll
#define ONE 1ll
#define DBG 1
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define loop(n) rep(loop, (0), (n))
#define all(c) begin(c), end(c)
const int INF =
sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
const double PI = acos(-1);
const double EPS = 1e-9;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
using pii = pair<int, int>;
// template<class T> ostream &operator<<(ostream &os,T &t){dump(t);return os;}
template <typename T, typename S>
istream &operator>>(istream &is, pair<T, S> &p) {
  is >> p.first >> p.second;
  return is;
}
template <typename T, typename S>
ostream &operator<<(ostream &os, pair<T, S> &p) {
  os << p.first << " " << p.second;
  return os;
}

template <typename T> void printvv(const vector<vector<T>> &v) {
  cerr << endl;
  rep(i, 0, v.size()) rep(j, 0, v[i].size()) {
    if (typeid(v[i][j]).name() == typeid(INF).name() and v[i][j] == INF) {
      cerr << "INF";
    } else
      cerr << v[i][j];
    cerr << (j == v[i].size() - 1 ? '\n' : ' ');
  }
  cerr << endl;
}
/*
   typedef __int128_t Int;
   std::ostream &operator<<(std::ostream &dest, __int128_t value) {
   std::ostream::sentry s(dest);
   if (s) {
   __uint128_t tmp = value < 0 ? -value : value;
   char buffer[128];
   char *d = std::end(buffer);
   do {
   --d;
 *d = "0123456789"[tmp % 10];
 tmp /= 10;
 } while (tmp != 0);
 if (value < 0) {
 --d;
 *d = '-';
 }
 int len = std::end(buffer) - d;
 if (dest.rdbuf()->sputn(d, len) != len) {
 dest.setstate(std::ios_base::badbit);
 }
 }
 return dest;
 }

 __int128 parse(string &s) {
 __int128 ret = 0;
 for (int i = 0; i < s.length(); i++)
 if ('0' <= s[i] && s[i] <= '9')
 ret = 10 * ret + s[i] - '0';
 return ret;
 }
 */

#ifndef _DEBUG
#define printvv(...)
#endif
void YES(bool f) { cout << (f ? "YES" : "NO") << endl; }
void Yes(bool f) { cout << (f ? "Yes" : "No") << endl; }
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 (a > b) {
    a = b;
    return true;
  }
  return false;
}

signed main(signed argc, char *argv[]) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(12);

  int N; cin >> N;
  cout<<N/3<<endl;

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<stack>
#include<vector>
#include<cstring>
#include<algorithm>
#include<set>
#include<queue>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <complex>
#include <sstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cassert>
using namespace std;
typedef long long ll;
const ll inf =1e17;
typedef unsigned long long ull;
#define scn(a) scanf("%d",&a)
#define scd(a) scanf("%lf",&a)
#define scl(a) scanf("%lld",&a)
#define ptf(a) printf("%d\n",a)
#define mes(a,b) memset(a,b,sizeof(a))
#define fon(s,n) for(int i=s;i<=n;i++)
#define range(i,a,b) for(int i=a;i<=b;++i)
#define rerange(i,a,b) for(int i=a;i>=b;--i)
//#define N 100010
//const ll p =998244353;
//const int S=20;
ll gcd(ll a,ll b) { return b>0 ? gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
ll q_pow(ll a,ll b,ll mod)
{
	ll ans=1,res=a;
	while(b){
		if(b&1) ans=ans*res%mod;
		res=res*res%mod;
		b>>=1;
	}
	return ans%mod;
}
//ll a[100005];
//int cnt[105]={0};
//char s[1005];
//char t[1005];
ll a[200005];
ll an[200005];
const ll modp=1e9+7;
int main()
{
	//int a, b, c, d, n, t;
	//int t;
	// //double n,m,x,y;
	// scn(t);
	// while (t--)
	// {
	// 	int n;scn(n);
	// 	for(int i=0;i<n;i++) scl(a[i]);
	// 	sort(a,a+n);
	// 	ll ans1=a[n-1]*a[n-2]*a[n-3]*a[n-4]*a[n-5];
	// 	ll ans2=a[n-1]*a[n-2]*a[n-3]*a[1]*a[0];
	// 	ll ans3=a[n-1]*a[3]*a[2]*a[1]*a[0];
	// 	ll ans=max(ans1,ans2);
	// 	ans=max(ans,ans3);
	// 	printf("%lld\n",ans);
	// }
	int n;scn(n);
	ll ans=0;

	for(int i=0;i<n;i++)scl(a[i]);
	an[0]=a[0];
	for(int i=1;i<n;i++)an[i]=an[i-1]+a[i];
	for(int i=0;i<n;i++){
		ans+=(((an[n-1]-an[i])%modp)*(a[i]%modp))%modp;
	}
	ans%=modp;
	printf("%lld",ans);
	return 0;
}





Measured memory_bytes: 6952
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
def input(): return sys.stdin.readline().rstrip()

def main():
    N=int(input())
    W=[input() for i in range(N)]
    tmp=None
    s=set()
    for w in W:
        if tmp:
            if tmp[-1]!=w[0] or w in s:
                print('No')
                exit()
            else:
                tmp=w
                s.add(w)
        else:
            tmp=w
            s.add(w)
    print('Yes')
    

if __name__ == '__main__':
    main()


Measured memory_bytes: 38384
#include <stdio.h>
#include <algorithm>

using namespace std;

int main(){
	int N,M;
	scanf("%d %d",&N, &M);
	int small = 114514, ans = 0;;
	for(int i = 0; i < M; i++){
		int t, u;
		scanf("%d %d",&t, &u);
		if(t < N){
			ans += N - t;
			small = min(t, small);
		}
	}
	
	if(small != 114514) ans -= N - small;
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 2756
s = input()

if s[0]==s[1] and s[1]!=s[2] and s[2]==s[3]:#FFTT
    print("Yes")
elif s[1]==s[2] and s[2]!=s[3] and s[3] == s[0]:#FTTF
    print("Yes")
elif s[0]==s[2] and s[1]!=s[0] and s[1] == s[3]:#FTFT
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl; 
#define INF 1000000000
#define mod 1000000007
using ll=long long;
const ll LINF = 1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

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

    int h,w;cin>>h>>w;
    rep(i,h){
        rep(j,w){
            string s;cin>>s;
            if(s=="snuke"){
                cout<<(char)(j+65)<<1+i<<endl;
                return 0;
            }
        }
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <complex>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
#include <random>
typedef long long int ll;
typedef long double ld;
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
const ll MOD=1000000007;
const ll MAX_N=500010;
const ll INF=9999999999;
ll dp[MAX_N];
vector<vector<int> > G(MAX_N);

int rec(int v){
    if(dp[v]>=0) return dp[v];
    int res=0;
    for(int u:G[v]){
        res=max(res,rec(u)+1);
    }
    dp[v]=res;
    return res;
}

int main(){
    int n,m,ans=0;
    cin>>n>>m;
    for(int i=0;i<m;i++){
        int x,y;
        cin>>x>>y;
        x--;y--;
        G[x].push_back(y);
    }
    for(int i=0;i<n;i++) dp[i]=-1;
    for(int i=0;i<n;i++){
        ans=max(ans,rec(i));
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 17920
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#pragma comment(linker, "/stack:200000000")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef string str;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector <pii> vpii;
typedef vector <pll> vpll;
typedef map <str,int> mapsi;
typedef map <str,int> :: iterator mapsitr;
typedef map <int , int> mint;
typedef map <ll , ll> mll;
typedef set <int> si;
typedef set <ll> sll;
typedef si :: iterator sitr;
typedef si :: reverse_iterator rsitr;
typedef sll :: iterator sltr;
typedef sll :: reverse_iterator rsltr;
#define mset multiset

typedef mset <int> msi;
typedef mset <ll> msll;
typedef msi :: iterator msitr;
typedef msi :: reverse_iterator msritr;
typedef msll :: iterator msltr;
typedef msll :: reverse_iterator mslritr;

#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define mp make_pair
#define pb push_back
#define pob pop_back
#define pf push_front
#define pof pop_front
#define fi first
#define se second
#define fs first.second
#define ss second.second
#define ff first.first
#define sf second.first
#define newl '\n'
#define fbo find_by_order
#define ook order_of_key

char to_upper (char x){
    if( 97 <= int(x) && int(x) <= 122)return char(x-32);
    else if( 65 <= int(x) && int(x) <= 90)return x;
}
char to_lower (char x){
    if( 97 <= int(x) && int(x) <= 122)return x;
    else if( 65 <= int(x) && int(x) <= 90)return char(x+32);
}
int numerize (char x){
    if(48 <= int(x) && int(x) <= 57)return int(x-'0');
    else if( 97 <= int(x) && int(x) <= 122)return int(x-96);
    else if( 65 <= int(x) && int(x) <= 90)return int(x-64);
}
bool isect (int l1, int r1, int l2, int r2){
    pii p1,p2;
    p1 = mp(l1,r1); p2 = mp(l2,r2);
    if(p1>p2)swap(p1,p2);
    if(p2.fi <= p1.se)return true;
    else return false;
}
ll quickpow (ll num1, ll num2, ll MOD){
    if(num2==0)return 1;
    else if(num2==1)return num1;
    else{
        ll temp = quickpow (num1,num2/2,MOD); ll res = ((temp%MOD) * (temp%MOD))%MOD;
        if(num2%2==1) res = ((res%MOD)*(num1%MOD))%MOD; return res;
    }
}
ll invmod (ll num, ll MOD){return quickpow (num,MOD-2,MOD);}
ll gcd (ll num1, ll num2){
    if(num1 < num2) swap(num1,num2); ll num3 = num1 % num2 ;
    while(num3 > 0){ num1 = num2; num2 = num3; num3 = num1 % num2;}
    return num2;
}
ll lcm (ll num1 , ll num2){return (ll) (num1/__gcd(num1,num2))*num2;}
// end of Template
int a,b;
int main(){

//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    cin>>a>>b;
    if((1<=a && a<=9) && (1<=b && b<=9)) cout<<a*b<<newl;
    else cout<<-1<<newl;
}


Measured memory_bytes: 256
using System;

namespace Sample101
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = "";
            while ((n = Console.ReadLine()) != "-") {
                var m = int.Parse(Console.ReadLine());
                for (int i = 0; i < m; i++)
                {
                    var h = int.Parse(Console.ReadLine());
                    n = n.Substring(h, n.Length - h) + n.Substring(0, h);
                }
                Console.WriteLine(n);
            }
        }
    }
}


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

int main()
{
    int x,y;
    cin >> x >> y;

    if(y % 2 == 0)
    {
        if(x * 2 <= y && y <= x * 4)
        {
            cout << "Yes" << endl;
        }
        else
        {
            cout << "No" << endl;
        }
        
    }
    else
    {
        cout << "No" << endl;
    }
    
}


Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >>n;
  int t[111100],x[111100],y[111100];
  t[0]=x[0]=y[0]=0;
  bool a=true;
  for(int i=1;i<=n;i++)cin >> t[i] >> x[i] >> y[i];
  for(int i=1;i<=n;i++){
    int t1=t[i]-t[i-1];
    int a1=abs(x[i-1]-x[i])+abs(y[i-1]-y[i]);
    
    if(t1<a1){
      a=false;
    }
    if(t1%2!=a1%2){
      a=false;
    }
  }
  if(a)cout << "Yes" << endl;
  else cout << "No" << endl;
  
  return 0;
}

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


int main(){
    string s; cin>>s;
    if(s=="ABC") cout<<"ARC"<<endl;
    else cout<<"ABC"<<endl;
    return 0;
}

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

int main() {
    bool S[13] = {}, H[13] = {}, C[13] = {}, D[13] = {};
    int n; cin >> n;
    while (n--) {
        char c; cin >> c;
        int  x; cin >> x;
        if (c == 'S') S[x - 1] = true;
        if (c == 'H') H[x - 1] = true;
        if (c == 'C') C[x - 1] = true;
        if (c == 'D') D[x - 1] = true;
    }
    for (int i = 0; i < 13; ++i) if (!S[i]) {
        cout << 'S' << ' ' << i + 1 << endl;
    }
    for (int i = 0; i < 13; ++i) if (!H[i]) {
        cout << 'H' << ' ' << i + 1 << endl;
    }
    for (int i = 0; i < 13; ++i) if (!C[i]) {
        cout << 'C' << ' ' << i + 1 << endl;
    }
    for (int i = 0; i < 13; ++i) if (!D[i]) {
        cout << 'D' << ' ' << i + 1 << endl;
    }
    return 0;
}


Measured memory_bytes: 3140
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define pb push_back
#define F first
#define S second
//cout<<fixed<<setprecision(11);
const string nl="\n";
const ll MOD=1e9+7;
const ll ARR_MAX = 1e5+1;

void solve(){
    int r,c;cin>>r>>c;
    string s[r];
    for(int i=0;i<r;i++){
    	cin>>s[i];
    }
    int dp[r][c]={}; //dp[i][j]=number of ways to reach i,j modulo 1e9+7;
    dp[0][0]=1;
    bool f=1;
    for(int i=0;i<r;i++){
    	if(f && s[i][0]=='.'){
    		dp[i][0]=1;
    	}
    	else{
    		f=0;
    	}
    }
    f=1;
    for(int j=0;j<c;j++){
    	if(f && s[0][j]=='.'){
    		dp[0][j]=1;
    	}
    	else{
    		f=0;
    	}
    }
    for(int i=1;i<r;i++){
    	for(int j=1;j<c;j++){
    		if(s[i][j]=='#'){
    			dp[i][j]=0;
    		}
    		else{
    			dp[i][j]=dp[i-1][j]+dp[i][j-1];
    			dp[i][j]%=MOD;
    		}
    	}
    }
    cout<<dp[r-1][c-1]<<nl;
}

int main(){
    int t=1;
    // cin>>t;
    while(t--){
        solve();
    }
    return 0;
}

Measured memory_bytes: 5248
//Utkarsh.25dec
#include <bits/stdc++.h>
#include <chrono>
#include <random>
#define ll long long int
#define ull unsigned long long int
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define rep(i,n) for(ll i=0;i<n;i++)
#define loop(i,a,b) for(ll i=a;i<=b;i++)
#define vi vector <int>
#define vs vector <string>
#define vc vector <char>
#define vl vector <ll>
#define all(c) (c).begin(),(c).end()
#define max3(a,b,c) max(max(a,b),c)
#define min3(a,b,c) min(min(a,b),c)
#define deb(x) cerr<<#x<<' '<<'='<<' '<<x<<'\n'
using namespace std;
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
// ordered_set s ; s.order_of_key(val)  no. of elements strictly less than val
// s.find_by_order(i)  itertor to ith element (0 indexed)
typedef vector<vector<ll>> matrix;
ll power(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll modInverse(ll a){return power(a,mod-2);}
const int N=500023;
bool vis[N];
vector <int> adj[N];
ll par[N];
void dfs(int curr)
{
    vis[curr]=1;
    for(auto it:adj[curr])
    {
        if(vis[it])
            continue;
        par[it]=curr;
        dfs(it);
    }
}
void solve()
{
    ll n;
    cin>>n;
    rep(i,n-1)
    {
        ll a,b;
        cin>>a>>b;
        adj[a].pb(b);
        adj[b].pb(a);
    }
    vl v;
    rep(i,n)
    {
        ll c;
        cin>>c;
        v.pb(c);
    }
    int deg[n+1]={0};
    for(int i=1;i<=n;i++)
        deg[i]=adj[i].size();
    sort(all(v));
    ll ans=0;
    queue <int> q;
    for(int i=1;i<=n;i++)
    {
        if(deg[i]==1)
            q.push(i);
    }
    dfs(1);
    int indx=0;
    ll val[n+1];
    while(!q.empty())
    {
        int curr=q.front();
        q.pop();
        if(curr==1)
            continue;
        val[curr]=v[indx];
        ans+=v[indx];
        indx++;
        deg[par[curr]]--;
        if(deg[par[curr]]==1)
            q.push(par[curr]);
    }
    val[1]=v[n-1];
    cout<<ans<<'\n';
    for(int i=1;i<=n;i++)
        cout<<val[i]<<' ';
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int T=1;
    //cin>>T;
    int t=0;
    while(t++<T)
    {
        //cout<<"Case #"<<t<<":"<<' ';
        solve();
        //cout<<'\n';
    }
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
}

Measured memory_bytes: 16480
def main():
    import sys
    from collections import Counter
    sys.setrecursionlimit(10**6)
    input = sys.stdin.readline
    N = int(input())
    A = [int(x) for x in input().strip().split()]
    j_Aj = Counter([j-Aj for j, Aj in enumerate(A, start=1)])
    ans = 0
    for i, a in enumerate(A[:-1], start=1):
        if a > N:
            continue
        ans += j_Aj[a+i]

    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 42636
#include<bits/stdc++.h>
using namespace std;
int main(){
	double a,b;
	int A=0,B=0,C=0,D=0;
	int rA=0,rB=0,rC=0,rD=0;
	
	while(cin>>a>>b){
		if(a>=1.1){
			A++;
		}else if(a>=0.6){
			B++;
		}else if(a>=0.2){
			C++;
		}else{
			D++;
		}
		if(b>=1.1){
			rA++;
		}else if(b>=0.6){
			rB++;
		}else if(b>=0.2){
			rC++;
		}else{
			rD++;
		}
	}
		printf("%d %d\n",A,rA);
		printf("%d %d\n",B,rB);
		printf("%d %d\n",C,rC);
		printf("%d %d\n",D,rD);
}


Measured memory_bytes: 3116
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl; 
#define INF 1000000000
#define mod 1000000007
using ll=long long;
const ll LINF = 1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

struct  UndirectedGraph{
   vector<vector<int>> g;
   vector<int> clr;
   vector<int> dis;
   int V;
 
   UndirectedGraph(int V) : V(V),
   g(vector<vector<int>>(V)),
   clr(vector<int>(V,0))
   {}
 
   //don't add (v,u) after adding (u,v)
   void add_edge(int u,int v){
       g[u].push_back(v);
       g[v].push_back(u);
   }
 
 
   //二部グラフ判定
   bool dfs_nib(int v,int c){
       clr[v]=c;
       for(auto x:g[v]){
           if(clr[x]==c) return false;
           if(clr[x]==0 && !dfs_nib(x,-c) ) return false;
       }
       return true;
   }
   bool isNib(){
       bool ret=true;
       for(int i=0;i<V;i++)if(clr[i]==0){
           if(!dfs_nib(i,1)){
               ret=false;break;
           }
       }
       return ret;
   }
 
   //distance
   void bfs(int st){
       dis=vector<int>(V,INF);
       vector<bool> checked(V,false);
       dis[st]=0;checked[st]=true;
       queue<int> q;
       q.push(st);
       while(!q.empty()){
           auto now=q.front();q.pop();
           for(auto x:g[now]){
               if(checked[x]) continue;
               checked[x]=true;
               dis[x]=dis[now]+1;
               q.push(x);
           }
       }
   }
};

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

    ll n,m;cin>>n>>m;
    UndirectedGraph g(n);
    rep(i,m){
        int u,v;cin>>u>>v;u--,v--;
        g.add_edge(u,v);
    }
    if(g.isNib()){
        ll l=0,r=0;
        for(auto c:g.clr){
            if(c==-1) l++;
            else      r++;
        }
        cout<<l*r-m<<endl;
    }else{
        cout<<n*(n-1)/2-m<<endl;
    }
    return 0;
}


Measured memory_bytes: 6400
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		long s = sc.nextLong();
		int x1 = 0;
		int y1 = 0;
		int x2 = 0;
		int y2 = 0;
		int x3 = 0;
		int y3 = 0;
		long x2y3 = 0;
//		long x3y2 = 0;
		if (s <= 1000000000) {
			x2 = (int) s;
			y3 = 1;
		} else {
			x2 = (int) Math.ceil(Math.sqrt(s));
			y3 = x2;
			x2y3 = (long) x2 * y3;
			x3 = (int) (x2y3 - s);
			y2 = 1;
//			x3y2 = (long) x3 * y2;
		}
//		System.out.println("s     :" + s);
//		System.out.println("x2y3:" + x2y3);
//		System.out.println("x3y2:" + x3y2);
		System.out.println(x1 + " " + y1 + " " + x2 + " " + y2 + " " + x3 + " " + y3);
//		System.out.println("実S:" + Math.abs(x2y3 - x3y2));

		sc.close();
	}
}

Measured memory_bytes: 23764
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <algorithm>

using namespace std;

int main() {
	int N, K;
	cin >> N >> K;
	int cnt = K;
	for (int i = 1; i < N; i++) {
		cnt = cnt *(K - 1);
	}
	cout << cnt << endl;
}

Measured memory_bytes: 256
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#endif

#include <bits/stdc++.h>

using namespace std;

mt19937 mrand(random_device{} ()); 

int rnd(int x) {
  return mrand() % x;
}

typedef long double ld;
typedef long long ll;

#ifdef DEBUG
#define eprintf(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#else
#define eprintf(...) ;
#endif

#define pb push_back
#define mp make_pair
#define sz(x) ((int) (x).size())
#define TASK "text"

const int inf = (int) 1.01e9;
const ld eps = 1e-9;
const ld pi = acos((ld) -1.0);

const int mod = (int) 1e9 + 7;

void add(int &x, int y) {
  if ((x += y) >= mod) {
    x -= mod;
  }
}

int mult(int x, int y) {
  return (long long) x * y % mod;
}

int myPower(int x, int pw) {
  int res = 1;
  for (; pw; pw >>= 1) {
    if (pw & 1) {
      res = mult(res, x);
    }
    x = mult(x, x);
  }
  return res;
}

void precalc() {
}


int a, b;

int read() {
  if (scanf("%d%d", &a, &b) < 2) {
    return 0;
  }
  return 1;
}

void solve() {
  if (a <= 0 && b >= 0) {
    printf("Zero\n");
    return;
  }
  if (a < 0 && ((b - a + 1) & 1)) {
    printf("Negative\n");
    return;
  }
  printf("Positive\n");
}

int main() {
  precalc();
#ifdef LOCAL
  freopen(TASK ".out", "w", stdout);
  assert(freopen(TASK ".in", "r", stdin));
#endif

  while (1) {
    if (!read()) {
      break;
    }
    solve();
#ifdef DEBUG
    eprintf("Time %.2f\n", (double) clock() / CLOCKS_PER_SEC);
#endif
  }
  return 0;
}


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

struct StExpr
{
  StExpr() : m_nPerson(0), m_nAttr(0) { }

  int m_nPerson;
  int m_nAttr;
};

void fnInput(vector<vector<StExpr>>& rvvoExpr)
{
  int nPersonSiz;
  cin >> nPersonSiz;
  rvvoExpr.resize(nPersonSiz + 1);

  for (int i = 1; i < rvvoExpr.size(); i++)
  {
    int nAttrSiz;
    cin >> nAttrSiz;
    rvvoExpr[i].resize(nAttrSiz);

    for (int j = 0; j < rvvoExpr[i].size(); j++)
      cin >> rvvoExpr[i][j].m_nPerson >> rvvoExpr[i][j].m_nAttr;
  }
}
  
int fnHonestCheck(const vector<vector<StExpr>>& cnrvvoExpr, 
                  const vector<int>& cnrvnHonest, int nMan)
{
  if (cnrvnHonest[nMan])               // Honest
  {
    for (int j = 0; j < cnrvvoExpr[nMan].size(); j++)
      if (cnrvvoExpr[nMan][j].m_nAttr  !=
          cnrvnHonest[ cnrvvoExpr[nMan][j].m_nPerson ] )
        return 0;

    return 1;
  }
  else                                 // UnKind
  {
    for (int j = 0; j < cnrvvoExpr[nMan].size(); j++)
      if (cnrvvoExpr[nMan][j].m_nAttr  !=
          cnrvnHonest[ cnrvvoExpr[nMan][j].m_nPerson ] )
        return 1;

    return 0;
  }
}
  
int fnMaxHonestGet(const vector<vector<StExpr>>& cnrvvoExpr)
{
  vector<int> vnHonest(cnrvvoExpr.size());
  int nMaxHonestCnt = 0;
  
  for (int n = 1; n < ( 1 << (cnrvvoExpr.size() - 1) ); n++)
  {
    int nHonestCnt = 0;

    for (int i = 0; i < cnrvvoExpr.size() - 1; i++)
      if (n & (1 << i))
      {
        vnHonest[i + 1] = 1;           // Honest
        nHonestCnt++;
      }
      else
        vnHonest[i + 1] = 0;           // UnKind

    bool bReslt = true;
    for (int nMan = 1; nMan < vnHonest.size(); nMan++)
      if (!fnHonestCheck(cnrvvoExpr, vnHonest, nMan))
      {
        bReslt = false;
        break;
      }

    if (bReslt) nMaxHonestCnt = max(nMaxHonestCnt, nHonestCnt);
  }
  return nMaxHonestCnt;
}
  
int main()
{
  vector<vector<StExpr>> vvoExpr;

  fnInput(vvoExpr);
  cout << fnMaxHonestGet(vvoExpr) << endl;

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;
int main(void){
    double a, b, C, S, L, h;
    scanf("%lf%lf%lf", &a, &b, &C);
    double radian = acos(-1) * C / 180;
    S = a * b * sin(radian) / 2;
    double c = sqrt(a*a + b*b - 2*a*b*cos(radian));
    L = a + b + c;
    h = sin(radian) * b;
    printf("%f\n%f\n%f\n", S, L, h);
    return 0;
}

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

using namespace std;

vector<int> adj[300000];

int vis[300000] {0};
int d=0;

void dfs(int node)
{
	int i,tt;
	
	vis[node]=1;
		d++;
		
		for(i=0;i<adj[node].size();i++)
		{
			tt=adj[node][i];
			
			if(vis[tt]==0)
			{
				
				dfs(tt);
			}
			
			
			
		}
	
	
}


int main()
{
	int t1;
	t1=1;
	while(t1--)
	{
	 int n,m,i;
	 
	 cin>>n>>m;
	 
	 while(m--)
	 {
	 	
	 	int x,y;
	 	cin>>x>>y;
	 	adj[x].push_back(y);
	 	adj[y].push_back(x);
	 	
	 }
   int k=0;
   
     for(i=1;i<=n;i++)
     {
     	d=0;
     	
     	if(vis[i]==0)
     	{
     		dfs(i);
     		
     		k=max(k,d);
     		
		 }
     	
     	
	 }

cout<<k<<endl;
    
 	
}



}


Measured memory_bytes: 23892
#include <bits/stdc++.h>
#define inp_out_work ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define testCase    int T; cin>>T; while(T--)
#define fr(i,n) for(int i=0;i<n;i++)
#define fro(i,s,e) for(int i=s;i<=e;i++)
#define endl '\n'
#define debug(P) cout<<#P<<" = "<<P<<endl;
#define pb push_back
#define FILE freopen("in.txt","r",stdin); freopen("out.txt","w",stdout);


using namespace std;

typedef long long ll;

int main(){
    inp_out_work

    string s, t;
    cin>>s>>t;

    int n = s.length(), m = t.length();

    int dp[n+1][m+1];

    memset(dp, 0, sizeof(dp));

    for(int i = 1; i <= n; i++){
        for(int j = 1; j <= m; j++){
            if(s[i-1] == t[j-1]){
                dp[i][j] = dp[i-1][j-1] + 1;
            }
            else{
                dp[i][j] = max(dp[i-1][j], dp[i][j-1]);
            }
        }
    }



    int i = n, j = m;

    string ans = "";

    while(i && j){
        if(s[i-1] == t[j-1]){
            ans += s[i-1];
            i--, j--;
        }
        else{
            if(dp[i-1][j] > dp[i][j-1]){
                i--;
            }
            else{
                j--;
            }
        }
    }

    reverse(ans.begin(), ans.end());

    cout<< ans ;

}


Measured memory_bytes: 35456
import math
r=float(input())
print('{} {}'.format(math.pi*r*r,2*math.pi*r))
"""
import math
PI = math.pi

r = float(input())

print('{} {}'.format(PI * r ** 2, 2 * PI * r))


import math
r = float(input())
print(f'{math.pi*r*r:.12f} {2*math.pi*r:.12f}')
"""


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

const int N=3e3+100,mod=1e9+7,inv2=(mod+1)>>1;
int n,Q,a[N],f[N][N],fx[N],gx[N],Ans;
void Inc(int &x,int y) {x+=y, x=x>=mod?x-mod:x;}
int qpow(LL x,int y)
{
	LL ret=1;
	while(y)
	{
		if(y&1) ret=ret*x%mod;
		x=x*x%mod, y>>=1;
	}
	return ret;
}

int main()
{
	scanf("%d%d",&n,&Q);
	for(int i=1;i<=n;++i) scanf("%d",&a[i]);
	for(int i=1;i<=n;++i)
		for(int j=1;j<=n;++j)
			f[i][j]=(a[i]>a[j])?1:0;
	for(int q=1;q<=Q;++q)
	{
		int x,y; scanf("%d%d",&x,&y);
		if(x == y) continue;
		for(int i=1;i<=n;++i)
			fx[i]=1ll*inv2*(f[x][i]+f[y][i])%mod,
			gx[i]=1ll*inv2*(f[i][x]+f[i][y])%mod;
		fx[y]=1ll*inv2*(f[x][y]+f[y][x])%mod;
		for(int i=1;i<=n;++i)
			f[x][i]=fx[i], f[i][x]=gx[i],
			f[y][i]=fx[i], f[i][y]=gx[i];
		f[x][y]=f[y][x]=fx[y], f[x][x]=f[y][y]=0;
	}
	for(int i=1;i<=n;++i)
		for(int j=i+1;j<=n;++j) Inc(Ans,f[i][j]);
	Ans=1ll*Ans*qpow(2,Q)%mod; printf("%d",Ans);
	return 0;
}

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

#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define RFOR(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define LL long long
#define INF INT_MAX

const double EPS = 1e-14;
const double PI  = acos(-1.0);


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

  vector<int> v(n);
  REP (i, n) cin >> v[i];

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

  cout << v[n - 1] - v[0] << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <string.h>
#define _USE_MATH_DEFINES
#define ln long long
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
using namespace std;

int max(int *ary) {
	int max = 0;
	for (int i = 0; i < sizeof(ary) / sizeof(ary[0]); i++)
		if (max < ary[i]) max = ary[i];
	return max;
}

int nmax(int *ary) {
	int max = 0, num;
	for (int i = 0; i < sizeof(ary) / sizeof(ary[0]); i++)
		if (max < ary[i]) {
			max = ary[i];
			num = i;
		}
	return max, num;
}

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

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

#define rep(i,n) for(int i = 0; i < (n); i++)
#define ll long long

using namespace std;

int main(){
  ll n;cin>>n;
  vector<ll> a(n);
  rep(i,n)cin>>a[i];
  sort(a.begin(), a.end());

//cout<<a[0]<<' '<<a[n-1]<<endl;

  ll result = a[n-1], tmp_result = a[0];
  vector<ll> op;

  if(a[0]>0){
    result = a[0];
    rep(i, n-1){
      if(result-a[i+1] > a[i+1]-result)swap(result, a[i+1]);
      if(i==n-2)swap(result, a[i+1]);
      op.push_back(result);
      op.push_back(a[i+1]);
      result-=a[i+1];
    }
  }else if(a[n-1]<0){
    if(a[n-1]<0)sort(a.rbegin(), a.rend());
    result = a[0];
    rep(i, n-1){
      if(result-a[i+1] < a[i+1]-result)swap(result, a[i+1]);
      op.push_back(result);
      op.push_back(a[i+1]);
      result-=a[i+1];
    }
  }else{
    result = a[n-1];//plus or zero
    tmp_result = a[0];//minus or zero
    rep(i,n-2){
      if(a[i+1]>0){
        op.push_back(tmp_result);
        op.push_back(a[i+1]);
        tmp_result -= a[i+1];
      }else{
        op.push_back(result);
        op.push_back(a[i+1]);
        result-=a[i+1];
      }
    }
    op.push_back(result);
    op.push_back(tmp_result);
    result -= tmp_result;
  }

  cout<<result<<endl;
  rep(i,n-1)cout<<op[i*2]<<' '<<op[i*2+1]<<endl;

  return 0;
}

Measured memory_bytes: 4336