akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#include<string.h>
int main(){
    int i, r, n, n2, z, x;
    char moji1[201] = {}, tmp1, tmp2;

    for(;;){
        scanf("%s",moji1);
        if( moji1[0] == '-'){
            break;
        }
        scanf("%d", &n);

        for( i = 0; i < n; i++ ){
            scanf("%d", &n2);
            for( r = 0; r < n2; r++ ){
                for( z = 0; z < strlen( moji1 ); z++ ){
                   if( z == 0 ){
                    tmp1 = moji1[z];
                   }else if( z == strlen(moji1) - 1 ){
                        moji1[z - 1] = moji1[z];
                        moji1[z] = tmp1;
                    }else{
                        moji1[z - 1] = moji1[z];
                        tmp2 = moji1[z];
                   }
                }
            }
        }

        printf("%s\n", moji1);
    }
    return 0;
}

Measured memory_bytes: 584
import java.io.*;
import java.util.*;
class Main
{
  public static void main(String ar[])
  {
    Scanner sc=new Scanner(System.in);
    StringBuffer sb=new StringBuffer(sc.next());
    int q=sc.nextInt();
    int k=1,t=0;
    for(int i=0;i<q;i++)
    {
      t=sc.nextInt();
      if(t==1)
        k=k*(-1);
      else
      {
        int f=sc.nextInt()-1;
        if(f==0)f=-1;
        String c=sc.next();
        f=f*k;
      	if(f==1)
          sb.append(c);
        else
          sb.insert(0,c);
      }
    }
    if(k==-1)
    {
      sb.reverse();
    }
    System.out.println(sb);
  }
}

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

int main(){
    int x;
    scanf("%d", &x);
    int h, m, s;
    h = x/3600;
    m = x%3600/60;
    s = x%3600%60;
    
    printf("%d:%d:%d\n", h, m, s);
    
    return 0;
}


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

using namespace std;
#define ll long long
#define mod 1000000007

ll dp[401][401];
vector<ll> v, pre;

ll get(ll l, ll r) {
    return pre[r] - (l > 0 ? pre[l - 1] : 0);
}

ll f(ll l, ll r) {
    if (l == r) return 0;
    if (r - l == 1) return v[l] + v[r];

    if (dp[l][r] != -1) return dp[l][r];

    ll ans = -1;
    for (ll i = l; i < r; i++) {
        if (ans == -1) {
            ans = f(l, i) + f(i + 1, r) + get(l, i) + get(i + 1, r);
        } else {
            ans = min(ans, f(l, i) + f(i + 1, r) + get(l, i) + get(i + 1, r));
        }
    }
    dp[l][r] = ans;
    return ans;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    memset(dp, -1, sizeof(dp));

    ll n;
    cin >> n;
    v.resize(n);
    pre.resize(n);

    for (ll &i : v) {
        cin >> i;
    }

    pre[0] = v[0];
    for (ll i = 1; i < n; i++) {
        pre[i] = v[i];
        pre[i] += (i > 0) ? pre[i - 1] : 0;
    }

    cout << f(0, n - 1);
}


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

namespace AtCoder.Abc
{
    class QuestionB
    {
        public static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            // 整数の入力
            long n = long.Parse(Console.ReadLine());

            // 整数配列の入力
            var a = Console.ReadLine().Split(' ').Select(i => long.Parse(i)).ToArray();

            long ans = 0;
            for (int i = 0; i < n; i+=2)
            {
                if (a[i] % 2 == 1) ans++;
            }

            Console.WriteLine(ans);

            Console.Out.Flush();
        }
    }
}


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

class Program
{
    static void Main(string[] args)
    {
        var inputs = new int[10];
        foreach (var i in Enumerable.Range(0, inputs.Length))
        {
            inputs[i] = int.Parse(Console.ReadLine());
        }

        foreach (var x in inputs.OrderByDescending(x => x).Take(3))
        {
            Console.WriteLine(x);
        }


    }
}

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


#define pb push_back
#define mp make_pair
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define ren(i,a,b) for(int i=a;i>=b;i--)
#define ff first
#define ss second
#define pll pair<long long int,long long int>
#define pii pair<int,int>
#define vll vector<long long int>
#define vii vector<int>
#define gi(n) scanf("%d",&n)
#define gll(n) scanf("%lld",&n)
#define gstr(n) scanf("%s",n)
#define gl(n) cin >> n
#define oi(n) printf("%d",n)
#define oll(n) printf("%lld",n)
#define ostr(n) printf("%s",n)
#define ol(n) cout << n
#define os cout<<" "
#define on cout<<"\n"
#define o2(a,b) cout<<a<<" "<<b
#define all(n) n.begin(),n.end()
#define present(s,x) (s.find(x) != s.end())
#define cpresent(s,x) (find(all(s),x) != s.end())
#define tr(container, it) for(__typeof(container.begin()) it = container.begin(); it != container.end(); it++)
using namespace std;

typedef unsigned long long int ull;
typedef long long int ll;
typedef long double ld;
typedef vector<vector<ll> > mat;


int main()
{ios_base::sync_with_stdio(false);
int a[5];
rep(i,0,4)
{
	cin>>a[i];
	if(a[i]==0)
	{
		ol(i+1);
		break;
	}
}
return 0;
}



Measured memory_bytes: 3592
#include <stdlib.h> 
#include <stdio.h>
#include <iostream>
#include <string.h>
#include <math.h>

using namespace std; 

int main()
{
	string s,t;
	int counter = 0;
	
	cin>>s>>t;
	
	for( int i = 0 ; i < s.size(); i++)
		if(s[i] != t[i])counter++;
				
	cout<<counter;
	return 0;
}


Measured memory_bytes: 3820
#include<iostream>
#include<sstream>
#include<algorithm>
#include<string>
#include<vector>
using namespace std;
int main(){
    string InputString;
    int Num,Count=0;
    int Value[128][128];
    int CalcTable[128][128];

    while(getline(cin,InputString)){
        istringstream is(InputString);
        for(int i=0;is>>Num;++i){
            is.ignore();
            Value[Count][i]=Num;
        }
        Count++;
    }

    CalcTable[0][0]=Value[0][0];
    Count--;

    for(int i=1;i<=Count/2;++i){
        for(int j=0;j<=i;++j){
            if(!j)CalcTable[i][j]=Value[i][j]+CalcTable[i-1][j];
            else if(j==i)CalcTable[i][j]=Value[i][j]+CalcTable[i-1][j-1];
            else CalcTable[i][j]=Value[i][j]+max(CalcTable[i-1][j-1],CalcTable[i-1][j]);
        }
    }

    for(int i=Count/2+1;i<=Count;++i){
        for(int j=0;j<=Count-i;++j){
            CalcTable[i][j]=Value[i][j]+max(CalcTable[i-1][j],CalcTable[i-1][j+1]);
        }
    }

    cout<<CalcTable[Count][0]<<endl;

    return 0;
}

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

int max(int a, int b); 

int lcs( char *X, char *Y, int m, int n ) 
{ 
	int L[m + 1][n + 1]; 
	for (int i = 0; i <= m; i++) 
	{ 
		for (int j = 0; j <= n; j++) 
		{ 
		if (i == 0 || j == 0) 
			L[i][j] = 0; 
	
		else if (X[i - 1] == Y[j - 1]) 
			L[i][j] = L[i - 1][j - 1] + 1; 
	
		else
			L[i][j] = max(L[i - 1][j], L[i][j - 1]); 
		} 
 } 
	
		
 
	int index =L[m][n];
  char lcsAlgo[index + 1];
  lcsAlgo[index] = '\0';

  int i = m, j = n;
  while (i > 0 && j > 0) {
    if (X[i - 1] == Y[j - 1]) {
      lcsAlgo[index - 1] = X[i - 1];
      i--;
      j--;
      index--;
    }

    else if (L[i - 1][j] > L[i][j - 1])
      i--;
    else
      j--;
  }
  
  cout << lcsAlgo << "\n";
 
}
int max(int a, int b) 
{ 
	return (a > b)? a : b; 
} 
int main() 
{ 
	char X[3000]; 
	char Y[3000];
	 
	cin>>X;
	cin>>Y;
	int m = strlen(X); 
	int n = strlen(Y); 
	
	
		lcs( X, Y, m, n ); 
	
	return 0; 
}  


Measured memory_bytes: 35456
#include <bits/stdc++.h>
#define ll long long
#define vi vector<int>
#define e "\n"
#define MaRiaMa { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); }
#define fix(n) cout << fixed << setprecision(n);
using namespace std;
int main()
{
	MaRiaMa;
	string s;
	cin >> s;
	int sum = 0;
	for (int i = 0; i < 3; i++)
	{
		if (s[i] == 'o')
			sum += 100;
	}
	
	cout << 700 + sum;
}




Measured memory_bytes: 3620
from itertools import*
n=int(input())
a=[list(map(int,input().split()))for _ in range(n)]
for k in range(n):
 b=a[k];b[3],b[4]=b[4],b[3]
def f():
 for d,e in list(combinations(a,2)):
  for p in([0,1,2,3,4,5],[1,5,2,0,4,3],[2,1,5,3,0,4],[3,0,2,5,4,1],[4,1,0,3,5,2],[5,1,4,3,2,0]):
   f=[d[k]for k in p]
   if f[0]==e[0]and f[5]==e[5]:
    f=f[1:5]*2
    for k in range(4):
     if f[k:k+4]==e[1:5]:return'No'
 return'Yes'
print(f())


Measured memory_bytes: 5992
#include <algorithm>
#include <iostream>
#include <string>
#include <map>
using namespace std;
typedef long long ll;

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

    for (int i = 0; i < N; i++) {
        if (A[i] % 2 == 0) {
            if (A[i] % 3 != 0 && A[i] % 5 != 0) {
                cout << "DENIED" << endl;
                return 0;
            }
        }
    }

    cout << "APPROVED" << endl;
    return 0;
}

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

#define int long long
#define rep(i,l,r) for(int i=(int)(l);i<(int)(r);i++)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)x.size())
template<class T>bool chmax(T &a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a,T b){if(a>b){a=b;return 1;}return 0;}

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;

const int inf = 1LL<<60;
const int mod = 1e9 + 7;
const double eps = 1e-9;

/*{
  }*/

signed main(){
  string s;
  int k;
  cin >> s >> k;
  int n = sz(s);

  if(n == 1){
    cout << k/2 << endl;
    return 0;
  }

  bool flag = true;
  rep(i, 0, n-1){
    if(s[i] != s[i+1]) flag = false;
  }
  if(flag){
    cout << n*k/2 << endl;
    return 0;
  }

  string t = s+s;
  int u = 0, v = 0;
  rep(i, 0, n-1){
    if(s[i] == s[i+1]){
      s[i+1] = '*';
      u++;
    }
  }
  rep(i, 0, sz(t)-1){
    if(t[i] == t[i+1]){
      t[i+1] = '*';
      v++;
    }
  }

  int ans = (v-u)*(k-1) + u;
  cout << ans << endl;

  return 0;
}



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

int riffleShuffle(const int &n, const int &r) {
    std::queue<int> deckA, deckB, deckC;

    for (int i = 0; i < n/2; i++) deckB.push(i);
    for (int i = n/2; i < n; i++) deckA.push(i);

    int c;

    for (int t = 0; t < r; t++) {

        if (t > 0) {
            for (int i = 0; i < n/2; i++) {
                deckB.push(deckC.front());
                deckC.pop();
            }
            for (int i = n/2; i < n; i++) {
                deckA.push(deckC.front());
                deckC.pop();
            }
        }

        std::scanf("%d", &c);
        int cnt = 0;

        while (!deckA.empty() || !deckB.empty()) {
            for (int i = 0; i < c && !deckA.empty(); i++) {
                deckC.push(deckA.front());
                deckA.pop();
            }
            for (int i = 0; i < c && !deckB.empty(); i++) {
                deckC.push(deckB.front());
                deckB.pop();
            }
        }
    }
    return deckC.back();

}

int main() {

    int n, r;
    while (scanf("%d %d",&n, &r)!=EOF) {
        std::cout << riffleShuffle(n, r) << std::endl;
    }
    return 0;
}



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

#define REPI(i, n) for(int i = 0; i < n; i++)
#define REPJ(j, n) for(int j = 0; j < n; j++)

using ll = long long;
using namespace std;

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

    int n; cin >> n;
    double sum = 0;
    REPI(i, n){
        double a; cin >> a;
        sum += 1/a;
    }cout << 1/sum;
}


Measured memory_bytes: 256
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections
import copy
import decimal

if __name__ == "__main__":
    a,b = input().split()
    a = decimal.Decimal(a)
    b = decimal.Decimal(b)
    print(int(a*b))

Measured memory_bytes: 10228
from itertools import groupby

s = input()
k = int(input())
n = len(s)

if n > 1:
    a = [len(list(g)) for _, g in groupby(s)]

    if len(a) == 1:
        print(n * k // 2)
    else:
        answer = sum([i // 2 for i in a]) * k

        if s[0] == s[-1] and a[0] % 2 == 1 and a[-1] % 2 == 1:
            answer += k - 1            

        print(answer)
else:
    print(k // 2)


Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>
#include <functional>
#include <stack>
#include <numeric>
typedef long long ll;
using namespace std;
const int MOD = (int)1e9 + 7;
const ll INF = (ll)1e18 + 7;
#define int long long
#define vint vector<int>
#define pint pair<int,int>
#define pb(a) push_back(a)
#define all(v) v.begin(),v.end()
#define dbg(x) cerr << #x << " = " << (x) << endl
#define yn(b) cout << ((b) ? "Yes" : "No") << endl
#define YN(b) cout << ((b) ? "YES" : "NO") << endl

int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};

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

	int N;
	int ans = 0;
	cin >> N;
	vint V(N), C(N),T(N);
	for (int i = 0; i < N; i++) {
		cin >> V[i];
	}
	for (int i = 0; i < N; i++) {
		cin >> C[i];
	}
	for (int i = 0; i < N; i++) {
		T[i] = V[i] - C[i];
		if(T[i]>0){
			ans += T[i];
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
### main

loop do
  n = gets.to_i
  break if n == 0

  pgs = gets.split.map(&:to_i)
  #p pgs

  ranges = []
  pr = nil

  for pg in pgs
    if pr.nil?
      pr = [pg, pg]
    elsif pr[1] + 1 == pg
      pr[1] = pg
    else
      ranges << pr
      pr = [pg, pg]
    end
  end
  ranges << pr if ! pr.nil?
  #p ranges

  puts ranges.map{|r| (r[0] == r[1]) ? r[0] : r.join('-')}.join(' ')
end

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

#define all(x) (x).begin(),(x).end()

#define MOD 1000000007

using namespace std;

int main(){
	string s;	cin >> s;

	if( s[1] == 'B' )	cout << "ARC" << endl;
	else	cout << "ABC" << endl;

	return 0;
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#define For(i,n) for(int i=0;i<n;i++)
#define mem(a,b) memset(a,b,sizeof(a))
#define int long long int
#define ld long double
#define pb push_back
#define mp make_pair
#define mod 2019
#define ld long double
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define MAXN 1000000
//int vv[MAXN];
int32_t main()
{
  #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
  string str;
  cin>>str;
  int n=str.size();
  int  sum=0,pt=1;
  map<int,int> mp;
  mp[0]++;
  int ans=0;
  for(int i=n-1;i>=0;i--)
  {
  	int digit=str[i]-'0';
  	sum=(sum+pt*digit)%mod;
  	pt=(pt*10)%mod;
  	ans+=mp[sum];
  	mp[sum]++;

  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3756
#include <stdio.h>

int main(){
	int K,X;
	int Yen = 500;
	
	scanf("%d %d", &K,&X);
	
	if(K*Yen>=X){
		printf("Yes");
	}
	else if(K*Yen<=X){
		printf("No");
	}
	return 0;
}

Measured memory_bytes: 3184
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(int i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(int i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(int i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define uniq(x) (x).erase(unique((x).begin(), (x).end()), (x).end())

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    int op = 1, to = 1;
    rep(i, n) {
        if (a[i] % 2 == 0) op *= 2;
        to *= 3;
    }
    cout << (to - op) << endl;
    return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<algorithm>
#include<cmath>
#include<queue>
#include<vector>
#include<stack>
using namespace std;

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

int main() {
	int a, b, c;
	cin >> a >> b >> c;
	cout << ((c>=a&&c<=b) ? "Yes" : "No") << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, a, n) for (long long i = (a); i < (long long)(n); ++i)
#define REPC(i, a, n) for (long long i = (a); i <= (long long)(n); ++i)
#define ALL(t) t.begin(), t.end()
#define RALL(t) t.rbegin(), t.rend()
#define MATINIT(type, row, col, init) \
  vector<vector<type>>(row, vector<type>(col, init));
#define Yes(cond) cout << (cond ? "Yes" : "No") << endl;
#define YES(cond) cout << (cond ? "YES" : "NO") << endl;
using namespace std;
using LL = long long;
using ULL = unsigned long long;
template <class T>
using VEC = std::vector<T>;
template <class T>
using MAT = std::vector<std::vector<T>>;
void DUMP() { cerr << endl; }
template <class Head, class... Tail>
void DUMP(Head &&head, Tail &&... tail) {
  cerr << head << ", ";
  DUMP(std::move(tail)...);
}
template <typename T>
ostream &operator<<(ostream &os, vector<T> &vec) {
  os << "{";
  for (auto v : vec) os << v << ",";
  os << "}";
  return os;
}
template <typename T>
ostream &operator<<(ostream &os, set<T> &s) {
  os << "{";
  for (auto p : s) os << p << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, map<T1, T2> &m) {
  os << "{";
  for (auto p : m) os << p << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, pair<T1, T2> p) {
  os << "[" << p.first << " " << p.second << "]";
  return os;
}
bool isPrime(int n) {
  if (n <= 3) return 1;
  for (int i = 2; i * i <= n; i += 1) {
    if (n % i == 0) {
      return 0;
    }
  }
  return 1;
}
long long gcd(long long a, long long b) { /* the greatest common divisor*/
  while (b != 0) {
    long long r = a % b;
    a = b;
    b = r;
  }
  return a;
}
long long lcm(long long a, long long b) { /*the least common multiple*/
  return (a / gcd(a, b)) * b;
}

int main() {
  int N;
  cin >> N;
  VEC<LL> A(N);
  REP(i, 0, N) { cin >> A[i]; }
  VEC<LL> Left(N), Right(N);
  Left[0] = A[0];
  Right[N - 1] = A[N - 1];
  REP(i, 1, N) {
    Left[i] = gcd(Left[i - 1], A[i]);
    Right[N - i - 1] = gcd(Right[N - i], A[N - i - 1]);
  }
  LL ans = 0;
  REP(i, 0, N) {
    LL l = i - 1 >= 0 ? Left[i - 1] : Right[i + 1];
    LL r = i + 1 < N ? Right[i + 1] : Left[i - 1];
    ans = max(ans, gcd(l, r));
  }
  cout<<ans<<endl;

  return 0;
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
int a,b,aa[60][60]={0};
char ab[60][60]={};
signed main(){
	cin>>a>>b;
	rep(i,a){
		rep(j,b){
			cin>>ab[i][j];
		}
	}
	rep(i,a){
		rep(j,b){
			if(ab[i-1][j-1]=='#')aa[i][j]++;
			if(ab[i-1][j]=='#')aa[i][j]++;
			if(ab[i-1][j+1]=='#')aa[i][j]++;
			if(ab[i][j-1]=='#')aa[i][j]++;
			if(ab[i][j+1]=='#')aa[i][j]++;
			if(ab[i+1][j+1]=='#')aa[i][j]++;
			if(ab[i+1][j]=='#')aa[i][j]++;
			if(ab[i+1][j-1]=='#')aa[i][j]++;
		}
	}
	rep(i,a){
		rep(j,b){
			if(ab[i][j]=='#'){
				cout<<'#';
			}else{
				cout<<aa[i][j];
			}
		}
		cout<<endl;
	}
}

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

int main() {
  int N;
  cin>>N;
  vector<vector<pair<int,int>>> g(N);
  for(int i=0;i<N-1;i++){
    int a,b,c;
    cin>>a>>b>>c;
    a--,b--;
    g.at(a).push_back(make_pair(b,c%2));
    g.at(b).push_back(make_pair(a,c%2));
  }
  vector<int> r(N,-1);
  r.at(0)=0;
  queue<int> q;
  q.push(0);
  while(!(q.empty())){
    int z=q.front();
    q.pop();
    for(pair<int,int> x:g.at(z)){
      if(r.at(x.first)==-1){
        q.push(x.first);
        r.at(x.first)=r.at(z)+x.second;
      }
    }
  }
  for(int i=0;i<N;i++){
    cout<<r.at(i)%2<<endl;
  }
}

Measured memory_bytes: 7808
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
ll xorsum(ll in) {
  if (in % 4 == 0)return in;
  if (in % 4 == 1)return in ^ (in - 1);
  if (in % 4 == 2)return in + 1;
  if (in % 4 == 3)return 0;
}

int main() {
  ll A, B;
  cin>>A>>B;
  cout<<(xorsum(B)^xorsum(A - 1))<< endl;
  return 0;
}

Measured memory_bytes: 256
/*
Problem

Category
DFS

URL:
http://judge.u-aizu.ac.jp/onlinejudge/submission.jsp#submit/ALDS1_11_B

考察:


Date: 2020/04/14
*/

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define int long long

/* ==== declarations ====== */
// functions
void solve();
void getInput();

// global variables
int n;
int counter = 1;
vector<vector<int>> ALL;
// vector<int> isVisited;
vector<int> d;
vector<int> f;
vector<int> visited;

/* ======================== */

signed main(){
    getInput();
    solve();
    return 0;
}

void getInput() {
    cin>>n;
    d.resize(n);
    f.resize(n);
    for(int i=0; i<n; ++i) {
        int u, k;
        cin>>u>>k;
        u--;
        vector<int> AL;
        for(int j=0; j<k; ++j) {
            int v;
            cin>>v;
            AL.push_back(--v);
        }
        ALL.push_back(AL);
    }
}

void dfs(int v) {    
    d[v] = counter++;
    visited.push_back(v);
    for(auto u: ALL[v]) {
        if (find(visited.begin(), visited.end(), u) == visited.end()) {
            dfs(u);
        }
    }
    f[v] = counter++;
}


void solve() {
    for(int u=0; u<n; ++u) {
        if (find(visited.begin(), visited.end(), u) == visited.end()) {
            dfs(u);
        }
    }
    for(int i=0; i<n; ++i ) {
        cout<<i+1<<" "<<d[i]<<" "<<f[i]<<endl;
    }
}





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

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //freopen("in.txt", "r", stdin);
	//freopen("out.txt", "w", stdout);
	int a,n,min,max;
	
	min=INT_MAX;
	max=INT_MIN;

	cin>>n;
	while(n--)
	{
		cin>>a;
		if(a<min)
			min=a;
		if(a>max)
			max=a;
	}

	cout<<abs(max-min);

    return 0;
}

Measured memory_bytes: 384
package main

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

func main() {
	n := getInt()
	s := make([]int, n)
	for i := range s {
		x, y := getInt()-1, i+1
		s[x] = y
	}

	for _, v := range s {
		fmt.Println(v)
	}
}

// -----------------------------------------

var sc = bufio.NewScanner(os.Stdin)

func init() {
	// buf := 200001
	// sc.Buffer(make([]byte, buf), buf)
	sc.Split(bufio.ScanWords)
}

func getInt() int {
	i, err := strconv.Atoi(getString())
	if err != nil {
		panic(err)
	}
	return i
}

func getIntSlice(n int) []int {
	is := make([]int, n)
	for i := range is {
		is[i] = getInt()
	}
	return is
}

func getString() string {
	sc.Scan()
	s := sc.Text()
	return s
}


Measured memory_bytes: 3328
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
#define int ll
using pint = pair<int,int>;
using Graph = vector<vector<int>>;
void YN(bool flg) {cout<<(flg?"YES":"NO")<<'\n';}
void Yn(bool flg) {cout<<(flg?"Yes":"No")<<'\n';}
void yn(bool flg) {cout<<(flg?"yes":"no")<<'\n';}
#define SORT(a) sort(a.begin(),a.end())
#define REVERSE(a) reverse(a.begin(),a.end())
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define out(n) cout << n << '\n'
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<VI> VVI;
const int MOD = 1000000007;
const long long INF = 1e10; //10^10
const double PI = acos(-1.0L);
/*mod逆元*/long long modinv(long long a, long long m) {long long b = m, u = 1, v = 0;while (b) {long long t = a / b;a -= t * b; swap(a, b);u -= t * v; swap(u, v);}u %= m;if (u < 0) u += m;return u;}
template< typename T >T mod_pow(T x, T n, T p=MOD) {T ret = 1;while(n > 0) {if(n & 1) (ret *= x) %= p;(x *= x) %= p;n >>= 1;}return ret;}
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T>auto MAX(const T& a) { return *max_element(a.begin(),a.end()); }
template<class T>auto MIN(const T& a) { return *min_element(a.begin(),a.end()); }
template<class T, class U>U SUM(const T& a, const U& v) { return accumulate(a.begin(),a.end(), v); }
template<class T, class U>U COUNT(const T& a, const U& v) { return count(a.begin(),a.end(), v); }
template<class T, class U>int LOWER(const T& a, const U& v) { return lower_bound(a.begin(),a.end(), v) - a.begin(); }
template<class T, class U>int UPPER(const T& a, const U& v) { return upper_bound(a.begin(),a.end(), v) - a.begin(); }
int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
int LCM(int a, int b) { int g = GCD(a, b); return a / g * b; }
int POW(int a, int n) { int r = 1; while (n > 0) { if (n & 1)r *= a; a *= a; n >>= 1; }return r; }
int isPrime(int n){if(n<2){return 0;}for(int i=2; i*i<=n; i++){if(n%i==0){return 0;}}return 1;}
/*素因数分解*/map< int, int >prime_factor(int n){map< int, int > ret;for(int i = 2; i * i <= n; i++) {while(n % i == 0) {ret[i]++;n /= i;}}if(n != 1) ret[n] = 1;return ret;}
/*約数列挙*/vector<int> divisor(int n){vector<int> v; for(int i=1; i*i<=n; i++){if(n%i==0){v.push_back(i);if(i!=n/i){v.push_back(n/i);}}}sort(v.begin(),v.end()); return v;}

//----------------ライブラリとか----------------

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout<<fixed<<setprecision(15);

    string s; cin >> s;
    Yn(s.substr(0,4)=="YAKI");

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<cmath>
using namespace std;
#define REP(i, limit) for(int i=0; i< limit; ++i)
#define FOR(i, j, limit) for(int i=j; i< limit; ++i)
#define DUMP(a) REP(d,a.size()){cout<<a[d];if(d!=a.size()-1)cout<<" ";else cout<<endl;}
#define ECHO(x) cout<<x<<endl;
#define MEMSET(a, n, x) REP(i, n) a[i]=x;
#define ARRIN(a, n) REP(i, n) cin>>a[i];
#define LL long long
int INF = 2147483647;
LL LINF = 9223372036854775807;
LL MOD = 1000000007;
typedef pair<int, int>P;
typedef pair<LL, LL>PL;
typedef vector<int> vi;
typedef vector<LL> vl;


int main(){
  int m, n;
  cin>>n>>m;
  LL dp[2020][2020]={};
  LL s[n], t[m];
  ARRIN(s, n);
  ARRIN(t, m);

  REP(i, n){
    REP(j, m){
      if(s[i]==t[j]){
        dp[i+1][j+1]=dp[i+1][j]+dp[i][j+1]+1;
        dp[i+1][j+1]%=MOD;
      }
      else{
        dp[i+1][j+1]=dp[i+1][j]+dp[i][j+1]-dp[i][j];
        dp[i+1][j+1]%=MOD;
      }
    }
  }/*
  REP(i, n+1){
    REP(j, m+1){
      cout<<dp[i][j]<<" ";
    }
    cout<<endl;
  }*/
  if(dp[n][m]<0) dp[n][m]+=MOD;
  cout<<dp[n][m]+1<<endl;


  return 0;
}


Measured memory_bytes: 32128
#include<bits/stdc++.h>
using namespace std;
int main(){
	int a,c=0;
	scanf("%d",&a);
	for(int i=1;i<=a;i++){
		int b=0;
		int t=i;
		while(t){
			b++;
			t=t/10;
		}
		if(b%2==1){
			c++;
		}
	}
	printf("%d",c);
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
int main(){
  int A,B,i;
  scanf("%d",&A);
  scanf("%d",&B);
  char text[A+B+1];
  scanf("%s",text);
  for(i=0;i<A;i++){
    if(text[i]=='-'){
      printf("No");
      exit(0);
    }
  }
  if(text[A]!='-'){
    printf("No");
    exit(0);
  }
  for(i=A+1;i<A+B+1;i++){
    if(text[i]=='-'){
      printf("No");
      exit(0);
    }
  }
  printf("Yes");
  return 0;
}


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

int main(){
  int A,B,N,x,y;
  cin>>N>>A>>B;
  string S;
  cin>>S;
x=0;
  y=0;
  for(int i=0;i<S.size();i++){
    if(S[i]=='a'){
      if(x+y<A+B){
        cout<<"Yes"<<endl;
        x++;
      }
      else{
        cout<<"No"<<endl;
      }
    }
    else if(S[i]=='b'){
            if(x+y<A+B&&y<B){
        cout<<"Yes"<<endl;
        y++;
      }
      else{
        cout<<"No"<<endl;
      }
    }
    else{
      cout<<"No"<<endl;
    }
  }
}


Measured memory_bytes: 896
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cstring>
#include <queue>
#include <vector>
#include <functional>
#include <map>
#include <set>
#include <cmath>
#include <string>
#define SIZE 200005
#define INF 1000000005LL
#define MOD 1000000007

using namespace std;
typedef long long int ll;
typedef pair <int,int> P;

int par[SIZE]; //親
int rnk[SIZE]; //木の深さ
//初期化(n要素0オリジン)
void init(int n){
	for(int i=0;i<n;i++){
		par[i] = i;
		rnk[i] = 0;
	}
}
//xの根を求める
int find(int x){
	if(par[x] == x){
		return x;
	}else{
		return par[x] = find(par[x]);
	}
}
//x,yの属する集合を併合
void unite(int x,int y){
	x = find(x);
	y = find(y);
	if(x == y)return;

	if(rnk[x] < rnk[y]){
		par[x] = y;
	}else{
		par[y] = x;
		if(rnk[x] == rnk[y])rnk[x]++;
	}
}
//xとyが同じ集合に属するか
bool same(int x,int y){
	return find(x) == find(y);
}

//最小全域木-Kruskal
struct edge{int u,v;ll cost;};
bool comp(const edge& e1,const edge& e2){
	return e1.cost < e2.cost;
}
edge es[SIZE];
int V,E; //頂点数・辺数
ll kruscal(){
	sort(es,es+E,comp);
	init(V+1); //Union-Find初期化
	ll res = 0;
	for(int i=0;i<E;i++){
		edge e = es[i];
		if(!same(e.u,e.v)){
			unite(e.u,e.v);
			res += e.cost;
		}
	}
	return res;
}

int N;
pair<ll,int> Xs[SIZE],Ys[SIZE]; //座標・番号
int main()
{
	scanf("%d",&N);
	ll x,y;
	for(int i=0;i<N;i++){
		scanf("%lld%lld",&x,&y);
		Xs[i] = P(x,i);
		Ys[i] = P(y,i);
	}
	sort(Xs,Xs+N);
	sort(Ys,Ys+N);
	E=0;
	V=N;
	for(int i=0;i<N-1;i++){
		ll a = Xs[i].first;
		ll b = Xs[i+1].first;
		int n = Xs[i].second;
		int m = Xs[i+1].second;
		//n-mにb-aの道
		es[E++] = (edge){n,m,b-a};
	}
	for(int i=0;i<N-1;i++){
		ll a = Ys[i].first;
		ll b = Ys[i+1].first;
		int n = Ys[i].second;
		int m = Ys[i+1].second;
		//n-mにb-aの道
		es[E++] = (edge){n,m,b-a};
	}
	printf("%lld\n",kruscal());

	return 0;
}


Measured memory_bytes: 10240
#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(){
  ll N,K;
  cin >> N >> K;
  vector<int> S(N,0);
  rep(i,K){
    int X;
    cin >> X;
    rep(j,X){
      int Y;
      cin >> Y;
      S.at(Y-1) ++;
    }
  }
  int counter=0;
  rep(i,N){
    if (S.at(i) == 0)
      counter ++;
  }
  cout << counter <<endl;
}

Measured memory_bytes: 3628
import sys,os,io
input = sys.stdin.readline
#input = io.BytesIO(os.read(0,os.fstat(0).st_size)).readline
N, M = map(int, input().split())
edge = [[] for _ in range(N)]
for i in range(M):
  a,b = map(int, input().split())
  edge[a-1].append(b-1)
  edge[b-1].append(a-1)
from collections import deque
cnts = [-1]*N
cnts[0] = 0
d = deque([(0,1)])
while len(d)>0:
  v,cnt = d.popleft()
  for w in edge[v]:
    if cnts[w]==-1:
      cnts[w] = cnt
    elif (cnt-cnts[w])%2==1:
      print(N*(N-1)//2-M)
      break
    elif w==0 or cnts[w]%2==1:
      continue
    d.append((w,cnt+1))
  else:
    continue
  break
else:
  n = sum(map(lambda x:x%2==1, cnts))
  ans = n*(N-n)-M
  print(ans)


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

using LL = long long;
constexpr int MAXN = 2e5 + 5;
int N, K, C, a[MAXN], b[MAXN];
string s;
int main(){
    cin >> N >> K >> C;
    cin >> s;
    int u = 0, v = K - 1;
    for (int i = 0; i < N; ++ i){
            if (s[i] == 'o') {a[u++] = i; i += C;}
            if (u == K) break;
    }
    for (int i = N - 1; i >= 0; -- i){
        if (s[i] == 'o') {b[v--] = i; i -= C;}
        if (v == -1) break;
    }
    for (int i = 0; i < K; ++ i){
        if (a[i] == b[i]) cout << a[i] + 1<< endl;
    }
    return 0;
}


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

int main() {
  int	N, H, h=0, i, s;
  // string	S;
  // int	i, j, l, ll;
  // char b;
  //  int N, K, KK, x, s=0;
  cin >> N >> h;
  for (s = i = 1; i < N; i++) {
    cin >> H;
    if (H >= h ) {
      s++;
      h = H;
    }
  }
  cout << s << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
#define FOR(i, x, y) for (decay<decltype(y)>::type i = (x), _##i = (y); i < _##i; ++i)
#define FORD(i, x, y) for (decay<decltype(x)>::type i = (x), _##i = (y); i > _##i; --i)
#ifdef zerol
#define dbg(x...) do { cout << "\033[32;1m" << #x << " -> "; err(x); } while (0)
void err() { cout << "\033[39;0m" << endl; }
template<template<typename...> class T, typename t, typename... A>
void err(T<t> a, A... x) { for (auto v: a) cout << v << ' '; err(x...); }
template<typename T, typename... A>
void err(T a, A... x) { cout << a << ' '; err(x...); }
#else
#define dbg(...)
#endif
// -----------------------------------------------------------------------------

const int N = 2E5 + 100;
int n, a[N], b[N];
LL dp[N][5];

int main() {
#ifdef zerol
    freopen("a.in", "r", stdin);
#endif
    cin >> n;
    FOR (i, 1, n + 1) {
        cin >> a[i];
        // deg[i - 1] += a[i];
        // deg[i] += a[i];
        if (a[i] == 0) b[i] = 0;
        else if (a[i] % 2 == 0) b[i] = 2;
        else b[i] = 1;
    }
    // FOR (i, 1, n + 1) {
    //     dp[i][0] = dp[i - 1][0] + a[i];
        
    //     // do not delete all
    //     FOR (k, 1, 4) {
    //         dp[i][k] = dp[i - 1][k - 1] + 
    //     }
    //     dp[i - 1][0] + 
    // }
    // // FORD (i, n, 0)
    // //     c[i] = c[i + 1] + (b[i] != 0);
    // // int ans = 1E9;
    FOR (i, 1, n + 1) {
        dp[i][0] = dp[i - 1][0] + a[i]; // turn into 0
        dp[i][1] = min(dp[i][0], min(dp[i - 1][0], dp[i - 1][1]) + abs(b[i] - 2)); // edge even
        dp[i][2] = min(dp[i][1], min(dp[i - 1][1], dp[i - 1][2]) + abs(b[i] - 1)); // make center odd
        dp[i][3] = min(dp[i][2], min(dp[i - 1][2], dp[i - 1][3]) + abs(b[i] - 2)); // edge even
        dp[i][4] = min(dp[i][3], min(dp[i - 1][3], dp[i - 1][4]) + a[i]);
        dbg(i, dp[i][0], dp[i][1], dp[i][2], dp[i][3], dp[i][4]);
    }
    cout << dp[n][4] << endl;
}


Measured memory_bytes: 9600
#pragma region Macros
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i, n) for(int i=(n); i>=0; --i)
#define FOR(i, n, m) for(int i=(m), i##_len=(n); i<i##_len; ++i)
#define EACH(i, v) for(const auto& i : v)
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
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; }
template<class Value>using vec = vector< Value >;
using ll = long long;
using P = pair< long long, long long >;
#define fi first
#define se second
#define el endl
#pragma endregion


void Main();
void solve(long long N);

int main(){
    std::cin.tie(nullptr);
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}

long double len(P a, P b){
    return sqrt(pow(a.fi - b.fi, 2) + pow(a.se - b.se, 2));
}

void Main(){
    ll N, Y;
    cin >> N >> Y;
    REP(x, Y/10000 + 1){
        REP(y, Y/5000 + 1){
            ll zY = Y - (x*10000 + y*5000);
            if(zY%1000 == 0){
                ll z = zY/1000;
                if(z >= 0 && x + y + z == N){
                    cout << x << " " << y << " " << z << el;
                    return;
                }
            }
        }
    }
    cout << "-1 -1 -1" << el;
}


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

int main(){
  int n;
  cin>>n;
  vector<int64_t> L(n+1);
  L.at(0)=2;
  L.at(1)=1;
  for(int i=2;i<=n;i++){
    L.at(i)=L.at(i-1)+L.at(i-2);
  }
  cout<<L.at(n)<<endl;
}


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



int main() {
    
	string s;
	long long d;
	cin>>s>>d;
	long long dp[s.size()+1][d][2];
	memset(dp,0,sizeof(dp));
	dp[0][0][1]=1;
	for(long long i=1;i<=s.size();i++){
	    for(long long j=0;j<d;j++){
            for(long long k=0;k<=1;k++){
                for(long long l=0;l<=(k?s[i-1]-'0':9);l++){
                    dp[i][(j+l)%d][k&(l==s[i-1]-'0')]=(dp[i][(j+l)%d][k&(l==s[i-1]-'0')]+dp[i-1][j][k])%1000000007;
              
                   
                }
            }
	    }
	}
/*	for(long long i=1;i<=s.size();i++){
	    for(long long k=0;k<=1;k++){
            for(long long j=0;j<d;j++){
                for(long long l=0;l<=(k? 9:s[i-1]-'0');l++){
                    dp[i][k | (l<s[i-1]-'0')][(j+l)%d]=(dp[i][k | (l<s[i-1]-'0')][(j+l)%d]+dp[i-1][k][j])%1000000007;
              
                   
                }
            }
	    }
	}*/
	cout<<(dp[s.size()][0][0]+dp[s.size()][0][1]-1+1000000007)%1000000007;
	
}


Measured memory_bytes: 15872
#include <algorithm>
#include <bitset>
#include <cmath>
#include <complex>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <vector>

const int MOD = 1e9 + 7;
const int iINF = 2147483647 / 2;
const long long int llINF = 9223372036854775807 / 2;

using namespace std;
using ll = long long int;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vvvl = vector<vector<vector<ll>>>;

typedef pair<ll, ll> pll;
bool paircomp(const pll &a, const pll &b) {
  if (a.first == b.first)
    return a.second < b.second;
  return a.first < b.first;
}

#define REP(i, n) for (ll i = 0; i < (n); i++)
#define RREP(i, n) for (ll i = (n)-1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define AUTO(i, m) for (auto &i : m)
#define ALL(a) (a).begin(), (a).end()
#define MAX(vec) *std::max_element(vec.begin(), vec.end())
#define MIN(vec) *std::min_element(vec.begin(), vec.end())
#define ARGMAX(vec)                                                            \
  std::distance(vec.begin(), std::max_element(vec.begin(), vec.end()))
#define ARGMIN(vec)                                                            \
  std::distance(vec.begin(), std::min_element(vec.begin(), vec.end()))
#define REV(T) greater<T>()
#define PQ(T) priority_queue<T, vector<T>, greater<T>>
#define VVL(a, b, c) vector<vector<ll>>(a, vector<ll>(b, c))
#define VVVL(a, b, c, d)                                                       \
  vector<vector<vector<ll>>>(a, vector<vector<ll>>(b, vector<ll>(c, d)))
#define SP(a) setprecision(a)
#define SQRT(a) sqrt((long double)(a))
#define DPOW(a, b) pow((long double)(a), (long double)(b))
#define UNIQUE(vec)                                                            \
  do {                                                                         \
    sort(ALL((vec)));                                                          \
    (vec).erase(std::unique(ALL((vec))), (vec).end());                         \
  } while (0)

ll POW(ll n, ll m) {
  if (m == 0) {
    return 1;
  } else if (m % 2 == 0) {
    ll tmp = POW(n, m / 2);
    return (tmp * tmp);
  } else {
    return (n * POW(n, m - 1));
  }
}

int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ll a, b;
  cin >> a >> b;
  // a=-1 b=-1
  if (a <= 0 && b >= 0) {
    cout << "Zero" << endl;
  } else if (a < 0 && b < 0) {
    if ((b - a + 1) % 2 == 0) {
      cout << "Positive" << endl;
    } else {
      cout << "Negative" << endl;
    }
  } else if (a < 0) {
    if (a % 2 == 0) {
      cout << "Positive" << endl;
    } else {
      cout << "Negative" << endl;
    }
  } else {
    cout << "Positive" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
fun main(args: Array<String>) {
    val (h, n) = readLine()!!.split(' ')
    val a = readLine()!!.split(' ').map { it.toInt() }

    var atk = 0L
    for (i in 0 until n.toInt()) {
        atk += a[i]
    }

    if (h.toLong() > atk) println("No")
    else println("Yes")
}


Measured memory_bytes: 48128
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for(int i=0;i<(int)n;i++)
#define PI acos(-1)
#define fast_io ios_base::sync_with_stdio(false) ; cin.tie(0); cout.tie(0);
ll mod=1e9+7;

ll rep_pow(ll a, ll b){//繰り返し2乗法
    if(b==0) return 1;
    else if(b%2==0){
        ll memo = rep_pow(a, b/2);
        return memo*memo%mod;
    }else{
        return rep_pow(a, b-1)*a%mod;
    }
}
ll nCr(ll n, ll r){//mod逆元使ったnCr
    ll ret=1;
    rep(i,r){
        ret *= n-i;//分子
        ret %= mod;
        ret *=rep_pow(r-i, mod-2);//mod逆元によりr!で割ると同値
        ret %= mod;
    }
    return ret;
}
ll gcd(ll a, ll b){if(b==0) return a; return gcd(b, a%b);}
bool isPrime(int x){
    if(x==1) return false;
    else if(x==2) return true;
    else if(x%2==0) return false;
    for(int i=3;i<=sqrt(x);i+=2){
        if(x%i==0){
            return false;
        }
    }
    return true;
}

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

    int ans=0;
    ll a=x;
    while(a<=y){
        a*=2;
        ans++;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
N, K, Q=(int(i) for i in input().split())
A=[int(input()) for _ in range(Q)]

p=[0]*N

for i in range(Q):
    p[A[i]-1]+=1

for i in range(N):
    if K-Q+p[i]>0:
        print("Yes")
    else:
        print("No")

Measured memory_bytes: 56536
#include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdio>
#define MN 100000
using namespace std;
inline int read()
{
    int x=0,f=1;char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9')x=x*10+ch-'0',ch=getchar();
    return x*f;
}
int n,K,a[MN+5];
long long s[MN+5],ans=0,S[MN+5];
int main()
{
    n=read();K=read();
    for(int i=1;i<=n;++i) s[i]=s[i-1]+(a[i]=read());
    for(int i=1;i<=n;++i) S[i]=S[i-1]+max(a[i],0);
    for(int i=1;i+K-1<=n;++i) ans=max(ans,max(s[i+K-1]-s[i-1],0LL)+S[i-1]+S[n]-S[i+K-1]);
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 2176
#include <bits/stdc++.h>
using namespace std;
#define ll long long
using  P=pair<ll,ll>;
int main(){
    int N,U,V;
    cin>>N>>U>>V;
    using Graph=vector<vector<int>>;
    Graph G(N);
    for(ll i=0;i<N-1;++i){
        ll a,b;
        cin>>a>>b;
        G[a-1].push_back(b-1);
        G[b-1].push_back(a-1);
    }
    vector<ll> distu(N,-1);//全頂点を「未訪問」に初期化
    queue<ll> queu;
    unordered_map<ll,ll> mpu;
    distu[U-1]=0;
    queu.push(U-1);
    while(!queu.empty()){
        ll v=queu.front();//キューから先頭頂点を取り出す
        queu.pop();
        //v から辿れる頂点をすべて調べる
        for(ll nv:G[v]){
            if(distu[nv]!=-1)continue;//すでに発見済みの頂点は探索しない
            //新たな白色頂点 nv について距離情報を更新してキューに追加する
            distu[nv]=distu[v]+1;
            mpu[nv]=v+1;
            queu.push(nv);
        }
    }
    vector<ll> distv(N,-1);//全頂点を「未訪問」に初期化
    queue<ll> quev;
    unordered_map<ll,ll> mpv;
    distv[V-1]=0;
    quev.push(V-1);
    while(!quev.empty()){
        ll v=quev.front();//キューから先頭頂点を取り出す
        quev.pop();
        //v から辿れる頂点をすべて調べる
        for(ll nv:G[v]){
            if(distv[nv]!=-1)continue;//すでに発見済みの頂点は探索しない
            //新たな白色頂点 nv について距離情報を更新してキューに追加する
            distv[nv]=distv[v]+1;
            mpv[nv]=v+1;
            quev.push(nv);
        }
    }
    int maximum=0;
    for(int i=0;i<N;i++){
      //cout<<i+1<<" "<<distu.at(i)<<" "<<distv.at(i)<<endl;
        if(distu.at(i)<distv.at(i) && maximum<distv.at(i)-1){
            maximum=distu.at(i);
            maximum+=(distv.at(i)-distu.at(i)-1);
        }
    }
    cout<<maximum<<endl;
    return 0;
}

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

int main(){
    int n;
    while(cin>>n){
        if(n==0) break;
        int k=24*60*60;
        int imos[k+1]={};
        for(int i=0;i<n;i++){
            string l;
            cin>>l;
            int a=((l[0]-'0')*10 + (l[1]-'0'))*60*60 + ((l[3]-'0')*10 + (l[4]-'0'))*60 + ((l[6]-'0')*10 + (l[7]-'0'));
            imos[a]++;
            //cerr<<a<<endl;
            cin>>l;
            a=((l[0]-'0')*10 + (l[1]-'0'))*60*60 + ((l[3]-'0')*10 + (l[4]-'0'))*60 + ((l[6]-'0')*10 + (l[7]-'0'));
            imos[a]--;
            //cerr<<a<<endl;
        }
        for(int i=0;i<k;i++){
            imos[i+1]+=imos[i];
        }
        int ans=0;
        for(int i=0;i<k;i++){
            ans=max(ans,imos[i]);
            
        }
        cout<<ans<<endl;
    }
    
}


Measured memory_bytes: 3404
A, B, K = map(int, input().split())
if B - A < 2 * K:
    # ans = [*range(A, B + 1)]
    ans = list(range(A, B + 1))
else:
    # ans = [*range(A, A + K), *range(B - K + 1, B + 1)]
    ans = list(range(A, A + K)) + list(range(B - K + 1, B + 1))
for v in ans:
    print(v)


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

int n, ans = 0;

bool solve (int x)
{
	for(int i = 2; i <= sqrt(x); i++) if(!(x % i)) return false;
	return true;
}
	
int main(){
	cin >> n;
	for(int i = 0; i < n; i++){
		int x;
		cin >> x;
		if(solve(x)) ans++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1160
from fractions import gcd
from collections import deque

N = int(input())
A = [int(a) for a in input().split()]
L = deque([0])
R = deque([0])

for i in range(N):
  L.append(gcd(L[i],A[i]))
for i in range(N)[::-1]:
  R.appendleft(gcd(R[0],A[i]))

ans = []
for i in range(N):
  ans += [gcd(L[i], R[i+1])]
print(max(ans))

Measured memory_bytes: 16152
import std.algorithm;
import std.array;
import std.bigint;
import std.bitmanip;
import std.conv;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

// 差の絶対値
@nogc @safe pure T diff(T)(const ref T a, const ref T b) { return a > b ? a - b : b - a; }

// 切り上げ除算
@nogc @safe pure T divCeil(T)(const ref T a, const ref T b) {
    return (a+b-1)/b;
}

T[] readToArray(T)() {
    return readln.split.to!(T[]);
}

void readInto(T...)(ref T ts) {
    auto ss = readln.split;
    foreach(ref t; ts) {
        t = ss.front.to!(typeof(t));
        ss.popFront;
    }
}

// 冪乗をmod取りつつ計算
@nogc @safe pure ulong modPow(ulong a, ulong n, ulong m) {
    ulong r = 1;
    while (n > 0) {
        if(n % 2 != 0) r = r * a % m;
        a = a * a % m;
        n /= 2;
    }
    return r;
}

// フェルマーの小定理から乗法逆元を計算
// 定理の要請により法は素数
@nogc @safe pure ulong modInv(ulong a, ulong m) {
    return modPow(a, m-2, m);
}

// mod取りつつ順列を計算
@nogc @safe pure ulong modPerm(ulong n, ulong k, ulong m) {
    if (n < k) return 0;

    ulong r = 1;
    for (ulong i = n-k+1; i <= n; i++) {
        r *= i;
        r %= m;
    }
    return r;
}

// mod取りつつ順列を計算
@nogc @safe pure ulong modFact(ulong n, ulong m) {
    return modPerm(n, n, m);
}

// mod取りつつ組み合わせを計算
// modInvを使っているので法は素数
@nogc @safe pure ulong modComb(ulong n, ulong r, ulong m) {
    return modPerm(n, r, m)*modInv(modFact(r, m), m) % m;
}

immutable ulong MOD = 1000000007;

void main() {
    ulong a, b;
    readInto(a, b);
    ulong ret;
    if ( (a + b) % 2 == 0) {
        writeln((a+b)/2);
    } else if (diff(a,b) % 2 == 0) {
        writeln(diff(a,b)%2);
    } else {
        writeln("IMPOSSIBLE");
    }
}


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

#define faster  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

#define sq(x)   (x)*(x)
#define PI      acos(-1.0)
#define all(x) x.begin(),x.end()
#define nl      '\n'

typedef long long int ll;
typedef unsigned long long int  llu;

int main()
{
    ll ans, n,d,x,y,cnt=0;
    cin>>n>>d;
    for(int i=0; i<n; i++)
    {
        cin>>x>>y;
        ans=x*x+y*y;
        if(ans<=d*d)
            cnt++;
    }
    cout<<cnt<<nl;
    return 0;
}


Measured memory_bytes: 3584
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
ll MOD = 1e9+7;

#define vec     vector<int>
#define vecll   vector<ll>
#define vec2    vector<vector<int>>
#define vec2ll  vector<vector<ll>>
#define vpair   vector<pair<int, int>>
#define vpairll vector<pair<ll, ll>>

#define rep(i,n)         for(ll i=(ll)0; i<(ll)n; i++)
#define REP(i,m,n)       for(ll i=(ll)m; i<(ll)n; i++)
#define arr(var, n)      vec var(n); rep(i,n){cin >> var[i];}
#define arrll(var, n)    vecll var(n); rep(i,n){cin >> var[i];}
#define all(var)         (var).begin(), (var).end()
#define sortall(var)     sort(all(var))
#define mpair(v1, v2)    make_pair(v1, v2)
#define pb(var)          push_back(var)
#define prt(var)         cout << var << "\n"
#define scn(var)         cin >> var;
#define pYes()           prt("Yes")
#define pNo()            prt("No")
#define prtd(n, var)     cout << fixed << setprecision(n) << var << "\n"
#define prt2(v1, v2)     cout << v1 << " " << v2 << "\n"
#define prt3(v1, v2, v3) cout << v1 << " " << v2 << " " << v3 << "\n"
#define prtall(var)      rep(i,var.size()){cout << var[i] << " ";} cout << "\n"
//----------------------------------------------------------------

int main(void) {
  int n, m;
  cin >> n >> m;
  arr(a,n);

  int k=0;
  int total=0;
  rep(i,n){
    total += a[i];
  }

  rep(i,n){
    double border = (double) total / (4*m);
    double tmp = a[i];
    if(tmp>=border) k++;
  }

  if(k>=m){
    prt("Yes");
  } else {
    prt("No");
  }

}


Measured memory_bytes: 256