akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;

int main() {
  string s;
  cin >> s;
  int a = s[0] - '0';
  int b = s[1] - '0';
  int c = s[2] - '0';
  int d = s[3] - '0';
  for (int i = 0; i < 2; i++) {
    for (int j = 0; j < 2; j++) {
      for (int k = 0; k < 2; k++) {
        int ans = a;
        if (i == 0) {
          ans += b;
        } else {
          ans -= b;
        }

        if (j == 0) {
          ans += c;
        } else {
          ans -= c;
        }

        if (k == 0) {
          ans += d;
        } else {
          ans -= d;
        }

        if (ans == 7) {
          cout << a;
          cout << (i == 0 ? '+' : '-');
          cout << b;
          cout << (j == 0 ? '+' : '-');
          cout << c;
          cout << (k == 0 ? '+' : '-');
          cout << d << "=7" << endl;
          return 0;
        }
      }
    }
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n,m,c;
  cin >> n >> m >> c;
  vector<int> b(m);
  vector<vector<int>> a(n,vector<int>(m));
        
  for(int i=0;i<m;i++){
    cin >> b.at(i);
  }
  for(int i=0;i<n;i++){
    for(int j=0;j<m;j++){
      cin >> a.at(i).at(j);
    }
  }
  int cnt=0; //正答する回数
  for(int i=0;i<n;i++){
    int sum=0; // i個目のソースコードの判定式結果
    for(int j=0;j<m;j++){
      sum += ( a.at(i).at(j) * b.at(j) );
    }
    sum += c;
    if(sum > 0) cnt++;
  }
    
  cout << cnt << endl;

  return 0;
  
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#ifdef LOCAL_DEBUG
  #include "LOCAL_DEBUG.hpp"
#endif
#define int long long

signed main(){

  int h,w; cin >> h >> w;
  vector<string> a(h);
  for(int i = 0; i < h; i++){
    cin >> a[i];
  }

  int cnt = 0;
  for(int i = 0; i < h; i++){
    for(int j = 0; j < w; j++){
      if(a[i][j] == '#') cnt++;
    }
  }
  if(cnt == h+w-1){
    cout << "Possible" << endl;
  }else {
    cout << "Impossible" << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,b=0;
  char a[256];
  string t,d;
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>a[i];
    d+=a[i];
  }
  b=n/2;
  for(int i=0;i<b;i++){
    t+=a[i];
  }
  if(d==t+t){
    cout<<"Yes"<<'\n';
  }
  else{
    cout<<"No"<<'\n';
  }
  return 0;
}


Measured memory_bytes: 256
from collections import Counter


def ac(s):
    if s[0] != 'A':
        return False

    cs = Counter(s[2:-1])
    if cs['C'] != 1:
        return False

    cs.pop('C')
    return s[1].islower() and s[-1].islower() and all(c.islower() for c in cs.keys())


def main():
    s = input()
    if ac(s):
        print('AC')
    else:
        print('WA')


if __name__ == '__main__':
    main()


Measured memory_bytes: 3316
#include <iostream>
#include <vector>
#include <math.h>
#include <algorithm>
#include <string>
#include <map>
#include <iomanip>
#define rep(i,N) for(int i=0; i<N;i++)
using namespace std;

int main(){
    int N;
    cin >>N;
    string word;
    map<string, int> mp;
    rep(i,N){
        cin>>word;
        mp[word]++;
    }
    int count=0;
    for(auto itr = mp.begin(); itr != mp.end(); ++itr) {
        count ++;
    }
    cout <<count<<endl;


    return 0;
}



Measured memory_bytes: 19248
n,m=map(int,input().split())
a=[-1 for _ in range(n)]
f=0
if n!=1:
    
    for i in range(m):
        s,c=map(int,input().split())
        if a[s-1]==-1 or a[s-1]==c:
            a[s-1]=c
        if a[s-1]!=-1 and a[s-1]!=c:
            f=1
        if s==1 and c==0:
            f=1
    for q in range(n):
        if q!=0 and a[q]==-1:
            a[q]=0
        if q==0 and a[q]==-1:
            a[q]=1

    ans=0
    for t in range(n):
        ans+=a[n-t-1]*(10**t)
    print(ans if f==0 else -1)
else:
    for i in range(m):
        
        s,c=map(int,input().split())
        if i==0:
            d=c
        if d!=c:
            f=1
            
    if m!=0:
        
        print(c if f==0 else -1)
    if m==0:
        print(0)
        

    


Measured memory_bytes: 9188
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vi;
typedef vector<string> vs;
typedef pair<ll,ll> P;
typedef vector<P> vp;
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define REPR(i,n) for(int i=n-1;i>=0;i--)
#define FORR(i,n,m) for(int i=n-1;i>=m;i--)
#define all(in) in.begin(),in.end()
#define ALL(in,K) in,in+K
#define INF 1e18
#define MOD 100000007
#define SIZE 10005
#define PI 	3.14159265358979323846

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a,b,c;
    cin >> a >> b >> c;
    cout << ((a+b>=c)?"Yes":"No") << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
string s;
int len;
int main()
{
    cin>>s;
    len=s.size();
    for(int i=0;i<len;i++)
    {
        if(s[i]=='C')
        {
            for(int j=i+1;j<len;j++)
            {
                if(s[j]=='F')
                {
                    cout<<"Yes";
                    return 0;
                }
            }
        }
    }
    cout<<"No";
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

/**
 *
 * @author Ivan
 */
public class Main{
    
    static int[][] status;
    static int[][] dias;
    
    static int[] diff(int i){
        switch(i){
            case 0: 
                return new int[]{1, 2};
            case 1: 
                return new int[]{0, 2};
            case 2: 
                return new int[]{0, 1};
        }
        return null;
    }
    
    static int obtMax(int i, int j){
        //caso base
        if(status[i][j] != 0) return status[i][j];
        if(i == 0) return dias[0][j];
        
        int[] diffs = diff(j);
        int max = -1, maxTmp;
        for(int k = 0; k < diffs.length; k++){
            maxTmp = obtMax(i - 1, diffs[k]);
            if(maxTmp > max) max = maxTmp; 
        }
       
       return status[i][j] = max + dias[i][j];
    }
    
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int input = scan.nextInt();
        status = new int[input][3];
        dias = new int[input][3];
        for(int i = 0; i < input; i++){
            dias[i] = new int[]{scan.nextInt(), scan.nextInt(), scan.nextInt()};
        }
        int max0 = obtMax(input - 1, 0);
        int max1 = obtMax(input - 1, 1);
        int max2 = obtMax(input - 1, 2);
        int sout = Math.max(Math.max(max0, max1), max2);
        System.out.println(sout);
    }
    
}

Measured memory_bytes: 117972
#include <bits/stdc++.h>
#define int long long
#define uint unsigned lon1g long
#define double long double
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define sett(c) (c).resize(unique(all(c))-(c).begin())
#define sz(a) (int)(a).size()
#define hell 1000000007
#define pi pair<int,int>
#define vi vector<int>
#define vb vector<bool>
#define vpi vector<pair<int,int>>
#define x first
#define y second
#define endl '\n'
#define forn(i,n) for(int i = 0 ; i < n ; i++ )
#define for1(i,n) for(int i = 1 ; i < n ; i++ )
#define fore(i,a,b) for(int i = a ; (a>b)?(i>=b):(i<=b) ; (a>b)?(i--):(i++) )

using namespace std;

bool comp(const pi& a , const pi& b ){
        return a.y < b.y;
}

void task_A(){
        string s ;
        cin >> s;
        for(int i = 1 ; i < sz(s) ; i++ ){
                if(s[i] == s[i-1]){
                        cout << "Bad" << endl;
                        return ;
                }
        }
        cout << "Good" << endl;
}

void task_B(){

}

void tastk_C(){

}

void task_D(){

}

void task_E(){

}

int32_t main(){

        ios_base::sync_with_stdio(false);
        cin.tie(nullptr);
        cout.tie(nullptr);
        cout << fixed;
        cout.precision(10);

        int t = 1;
        //cin >> t ;
        while(t--){
                task_A();
                //task_B();
                //task_C();
                //task_D();
                //task_E();
        }

        return 0;
}


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

#define rep(i,n) for(int i=0; i<(n); i++)
#define lep(j,n) for(int j=0; j<(n); j++)
#define reps(i,n) for(int i=1; i<(n); i++)
#define leps(j,n) for(int j=1; j<(n); j++)
#define pii pair<int,int>
#define gsort(x,n) sort((x),(x)+(n),greater<int>())
#define all(x) (x).begin(), (x).end()
#define int long long
#define setout(n,x) setw(n) << setfill(x)
#define Fixed fixed << setprecision(10)
const long long mod = 1000000007;
using namespace std;

#define return(Z) re:(Z)

long long h[10000010],x[10000010],z[10000010];

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

  int a,b,c,cnt=0;
  cin>>a>>b>>c;

  cnt=b/c-a/c;
  if(a%c==0) cnt++;
  cout<<cnt<<'\n';
  re:(0);
}


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

long long N;
long long B[105];

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

	long long sumi = 0;
	for(long long i = 0; i < N; i++){
		if(i == 0){
			sumi += B[i];
		} else if(i < N - 1){
			sumi += min(B[i], B[i - 1]);
		} else {
			sumi += B[i-1];
		}
	}
	cout << sumi << endl;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int N,K;
	cin>>N>>K;
	int V[N];
	bool l[K+1];
	for(int i  = 0; i<N;i++)
	{
		cin>>V[i];
	}
	l[0] = false;
	for(int i = 1;i<K+1;i++)
	{
		int conta = 0;
		for(int j = 0;j<N;j++)
		{
			if(i-V[j]>=0)
			{
				if(l[i-V[j]] == false) conta = 1;
			}
		}
		if(conta == 1) l[i] = true;
		else l[i] = false;
	}

	if(l[K]) cout<<"First";
	else cout<<"Second";
}


Measured memory_bytes: 3580
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <vector>
#include <queue>
#include <iostream>
using namespace std;
#define lson l,(l+r)/2,rt<<1
#define rson (l+r)/2+1,r,rt<<1|1
#define dbg(x) cout<<#x<<" = "<< (x)<< endl
#define pb push_back
#define fi first
#define se second
int val[101000];
int fa[101000];
int size[101000];
bool used[101000];
int find(int x){
  return x==fa[x]?x:fa[x]=find(fa[x]);
}
priority_queue<pair<int,int>,vector<pair<int,int> > ,greater<pair<int,int> > > q[101000],wait;
int main(){
  int n,m;
  cin>>n>>m;
  for(int i=1;i<=n;i++){
    fa[i]=i;
    size[i]=1;
    scanf("%d",&val[i]);
  }
  for(int i=1;i<=m;i++){
    int u,v;
    scanf("%d %d",&u,&v);
    u++,v++;
    find(u);
    find(v);
    //dbg(fa[u]);
    //dbg(size[fa[u]]);
    //dbg(fa[v]);
    //dbg(size[fa[v]]);
    size[fa[v]]+=size[fa[u]];
    fa[fa[u]]=fa[v];
    //dbg(size[fa[v]]);
    //printf("---------\n");
  }
  int mxs=0;
  int mxi=0;
  for(int i=1;i<=n;i++){
    find(i);
    q[fa[i]].push({val[i],i});
    if(i==fa[i] && size[i]>mxs){
      mxs=size[i];
      mxi=i;
    }
  }
  long long res=0;
  for(int i=1;i<=n;i++){
    if(fa[i]!=mxi)wait.push({val[i],i});
  }
  while(wait.size()!=0 && q[mxi].size()!=0){
    while(wait.size() && find(wait.top().se)==mxi)wait.pop();
    while(wait.size() && used[wait.top().se])wait.pop();
    while(q[mxi].size() && used[q[mxi].top().se])q[mxi].pop();
    if(wait.size() && q[mxi].size()){
      res+=wait.top().fi+q[mxi].top().fi;
      used[wait.top().se]=1;
      used[q[mxi].top().se]=1;
      int x=find(wait.top().se);
      q[mxi].pop();
      wait.pop();
      while(q[x].size()){
        q[mxi].push(q[x].top());
        q[x].pop();
      }
      size[mxi]+=size[x];
      fa[x]=mxi;
    }
  }
  //dbg(size[mxi]);
  if(size[mxi]!=n){
    printf("Impossible");
  }else
  cout<<res;
  return 0;
}

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

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

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

    vector<vector<int>> dp(N + 1, vector<int>(T, 0));
    vector<vector<int>> ep(N + 1, vector<int>(T, 0));
    int a, b;
    for (int i = 0; i < N; i++)
    {
        a = A[i];
        b = B[i];
        for (int j = 0; j < T; j++)
        {
            if (dp[i + 1][j] + ep[i + 1][j] < dp[i][j] + ep[i][j])
            {
                dp[i + 1][j] = dp[i][j];
                ep[i + 1][j] = ep[i][j];
            }

            if (dp[i + 1][j] + ep[i + 1][j] < dp[i][j] + b)
            {
                dp[i + 1][j] = dp[i][j];
                ep[i + 1][j] = b;
            }

            if (a + j < T)
            {
                dp[i + 1][a + j] = dp[i][j] + b;
                ep[i + 1][a + j] = ep[i][j];
            }
        }
    }

    int ans = 0;
    for (int i = 0; i < T; i++)
    {
        ans = max(ans, dp.back()[i] + ep.back()[i]);
    }
    cout << ans << endl;
}


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

int main(){
    int n;
    cin >> n;
    map<int, int> mp;
    for(int i = 0; i < n; i++){
        int a;
        cin >> a;
        mp[a]++;
    }
    int cnt = 0;
    for(auto x : mp){
        if(x.first < x.second) cnt += x.second - x.first;
        else if(x.first > x.second) cnt += x.second;
    }
    cout << cnt << endl;

    return 0;
}

Measured memory_bytes: 4736
import math

def FindAllDivisors(x):
    divList = []
    y = 1
    while y <= math.sqrt(x):
        if x % y == 0:
            divList.append(y)
            divList.append(int(x / y))
        y += 1
    return divList

n = int(input())
a = FindAllDivisors(n)

b = 10000000000
for i in range(len(a)):
  if i%2==1:
    continue
  else:
    bb = a[i]+a[i+1]
    if b >= bb:
      b = bb

print(bb-2)

Measured memory_bytes: 3280
def solve(A, x):
    i = 0
    total = 0
    res = 0
    for j in range(N):
        total += A[j]
        while total > x:
            total -= A[i]
            i += 1
        res += j - i + 1
    return res

N, Q = map(int, input().split())
A = list(map(int, input().split()))
X = list(map(int, input().split()))

for x in X:
    print(solve(A, x))



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

int main()
{
    int D, N; cin >>D>>N;
    int ans;
    if (D == 0) {
        ans = N + int(N==100);
    } else {
        ans = (D == 1 ? 100 : 100*100) * (N + int(N==100));
    }
    
    cout << ans << endl;
}


Measured memory_bytes: 256
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def resolve():
    n,m=map(int,input().split())
    AB=[tuple(map(int,input().split())) for _ in range(n)]
    AB.sort()
    now=m
    score=0
    for a,b in AB:
        k=min(m,b)
        m-=k
        score+=a*k
        if(m==0):
            print(score)
            return
resolve()

Measured memory_bytes: 54876
import java.awt.*;
import java.util.*;
import java.io.*;

public class Main {
    public static void main(String[] args) throws Exception {
        FastReader sc = new FastReader();
        int n=sc.nextInt(),m=sc.nextInt();
        long s=0;
        for (int i=0;i<m;i++)s+=sc.nextInt();
        if (n-s<0) System.out.println(-1);
        else System.out.println(n-s);
    }
    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
}

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

int main() {
    string S, ans = "None";
    cin >> S;
    map<char, bool> mp;
    rep(i, S.size()) mp[S[i]] = true;
    rep(i, 26) {
        if (!mp[i + 'a']) {
            ans = i + 'a';
            break;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 512
import java.util.*;

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

        int count = 0;

        for(int i = 1; i <= N; i++){
            int val = String.valueOf(i).length();
            if(val % 2 == 1)
                count++;
        }

        System.out.println(count);
    }
}

Measured memory_bytes: 28372
N=int(input())
Alist=list(map(int,input().split()))
sum1=0
sum2=0
for i in range(N):
  sum1=sum1+Alist[i]
  sum2=sum2+(Alist[i])**2
ans=(sum1**2-sum2)//2
print(ans%(10**9+7))

Measured memory_bytes: 31588
// TOPSIC001_0

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

// mod
const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

// floating
typedef double Real;
const Real EPS = 1e-11;
#define EQ0(x) (abs(x)<EPS)
#define EQ(a,b) (abs(a-b)<EPS)
typedef complex<Real> P;

int main(){
    int A, B, K;

    cin >> A >> B >> K;

    for(int i = min(A, B) ; i > 0; i--){

        if(A % i == 0 && B % i == 0){
            K--;
        }

        if(K == 0){
            cout << i;
            return 0;
        }
    }

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <deque>
#include <map>
#include <cmath>
#include <cstring>

long eval(long n, long m) {
    long ret;

    // cをSにする数の期待値, 偶数である必要あり、正である必要もあり
    double ideal = (m - 2 * n) * 0.5;
    ideal = std::max(0.0, ideal);

    long rslts[2];
    for (int i = 0; i < 2; i++) {
        long nconvert = static_cast<long>(ideal + i*2) & (-2L);
        long nS = n + nconvert/2;
        long nC = m - nconvert;

        rslts[i] = std::min(nS, nC/2);
    }

    return std::max(rslts[0], rslts[1]);
}

int main(void) {
    long n;
    long m;
    long rslt;

    std::cin >> n;
    std::cin >> m;

    rslt = eval(n, m);

    std::cout << rslt << std::endl;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void){
    int input,top,bot;
    scanf("%d",&input);
    top=input/100;
    bot=input%100;
    if((top>12&&bot==0)||(top==0&&bot>12)||(top>12&&bot>12)){
        printf("NA\n");
    }else if(top<=12&&bot<=12&&top!=0&&bot!=0){
        printf("AMBIGUOUS\n");
    }else if(top<=12&&top!=0){
        printf("MMYY\n");
    }else if(bot!=0){
        printf("YYMM\n");
    }else{
        printf("NA\n");
    }
    return 0;
}

Measured memory_bytes: 128
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()


int main() {
  int n;
  cin >> n;
  map<int, int> mpa, mpb;
  rep(i, n) {
    int a;
    cin >> a;
    mpa[a]++;
  }
  int m;
  cin >> m;
  vector<int> B(m);
  rep(i, m) {
    int b;
    cin >> b;
    B[i] = b;
    mpb[b]++;
  }
  bool flag = true;
  rep(i, m) {
    if (mpb[B[i]] > mpa[B[i]]) {
      flag = false;
      break;
    }
  }
  if (flag) cout << "YES" << endl;
  else cout << "NO" << endl;
  return 0;
}

Measured memory_bytes: 19840
def north(list):
    List = []
    List.append(list[1])
    List.append(list[5])
    List.append(list[2])
    List.append(list[3])
    List.append(list[0])
    List.append(list[4])
    return List
 
def west(list):
    List = []
    List.append(list[2])
    List.append(list[1])
    List.append(list[5])
    List.append(list[0])
    List.append(list[4])
    List.append(list[3])
    return List
     
def south(list):
    List = []
    List.append(list[4])
    List.append(list[0])
    List.append(list[2])
    List.append(list[3])
    List.append(list[5])
    List.append(list[1])
    return List
 
def east(list):
    List = []
    List.append(list[3])
    List.append(list[1])
    List.append(list[0])
    List.append(list[5])
    List.append(list[4])
    List.append(list[2])
    return List
 
dice = list(map(int, input().split()))
x = str(input())
y = list(x)
for i in range(len(x)):
    if y[i] == 'N':
        dice[0:5] = north(dice)
    elif y[i] == 'W':
        dice[0:5] = west(dice)
    elif y[i] == 'S':
        dice[0:5] = south(dice)
    elif y[i] == 'E':
        dice[0:5] = east(dice)
print(dice[0])


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

int main(){
	bool isAccepted = true;
	int numC= 0;
	int numCap= 0;
	string s;
	cin>>s;

	if(s[0]!='A')
		isAccepted=false;

	for(int i=2; i< s.size()-1; i++)
		if(s[i]=='C')
			numC++;

	if(numC != 1)
		isAccepted= false;

	for(int i=0; i< s.size(); i++)
		if('Z'-s[i] >= 0)
			numCap++;

	if(numCap!= 2)
		isAccepted= false;

	if(isAccepted)
		cout<<"AC"<<endl;
	else
		cout<<"WA"<<endl;

	return 0;

}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cassert>
#include <string>
#include <algorithm>
#include <vector>
#include <valarray>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <iomanip>
#include <map>
#include <set>
#include <list>
#include <limits>
#include <numeric>
#include <utility>
#include <deque>
#include <unordered_set>
#include <unordered_map>
#include <regex>
#include <array>
#include <bitset>
#include <complex>
#include <tuple>
#include <random>

using namespace std;
using ll = long long;
const int INF = 1e9;
const ll MOD = 1e9 + 7;

int main()
{
  string s;
  cin >> s;
  bool flag = true;
  for (int i = 0; i < s.size(); ++i)
  {
    if (i % 2 == 0)
    {
      if (s[i] != 'h')
        flag = false;
    }
    else
    {
      if (s[i] != 'i')
        flag = false;
    }
  }
  if (flag && s.size() % 2 == 0)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;

  return 0;
}


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

int main() {
    long long  N, M;
    cin >> N >> M;
    long long p[100100];
    vector<string> S(100100);
    for (int i = 0; i < M; i++) {
        cin >> p[i];
        cin >> S[i];
    }

    vector<long long> WA(N);
    vector<bool> AC(N);
    for (int i = 0; i < N; i++) AC[i] = false;
    long long correct = 0, wrong = 0;

    for (int i = 0; i < M; i++) {
        if (S[i] == "WA" && !(AC[p[i]-1])) WA[p[i]-1] ++;
        else if (S[i] == "AC") AC[p[i]-1] = true;
    }

    for (int i = 0; i < N; i++) if (AC[i] == true) {
        correct ++;
        wrong += WA[i];
    }

    cout << correct << " " << wrong << endl;
    return 0;
}

Measured memory_bytes: 7296
#include <bits/stdc++.h>
/* Type alias */
using ll = long long;
using ld = long double;

using vec_i = std::vector<int>;
using vec_ll = std::vector<ll>;
using vec_ld = std::vector<ld>;

using set_i = std::set<int>;
using set_ll = std::set<ll>;
using set_ld = std::set<ld>;

using uset_i = std::unordered_set<int>;
using uset_ll = std::unordered_set<ll>;
using uset_ld = std::unordered_set<ld>;

/* IO macros */
#define in(i)            int i; std::cin >> i
#define in2(i, j)        int i, j; std::cin >> i >> j
#define in3(i, j, k)     int i, j, k; std::cin >> i >> j >> k
#define in_(i)           std::cin >> i
#define in2_(i, j)       std::cin >> i >> j
#define in3_(i, j, k)    std::cin >> i >> j >> k
#define in_ll(i)         ll i; std::cin >> i
#define in2_ll(i, j)     ll i, j; std::cin >> i >> j
#define in3_ll(i, j, k)  ll i, j, k; std::cin >> i >> j >> k
#define in_ll_(i)        std::cin >> i
#define in2_ll_(i, j)    std::cin >> i >> j
#define in3_ll_(i, j, k) std::cin >> i >> j >> k
#define in_ld(i)         ld i; std::cin >> i
#define in2_ld(i, j)     ld i, j; std::cin >> i >> j
#define in3_ld(i, j, k)  ld i, j, k; std::cin >> i >> j >> k
#define in_ld_(i)        std::cin >> i
#define in2_ld_(i, j)    std::cin >> i >> j
#define in3_ld_(i, j, k) std::cin >> i >> j >> k
#define in_c(i)          char i; std::cin >> i
#define in2_c(i, j)      char i, j; std::cin >> i >> j
#define in3_c(i, j, k)   char i, j, k; std::cin >> i >> j >> k
#define in_c_(i)         std::cin >> i
#define in2_c_(i, j)     std::cin >> i >> j
#define in3_c_(i, j, k)  std::cin >> i >> j >> k
#define in_str(s)        std::string s; std::cin >> s

#define vec_in(v, n)    auto v=vec_i(n); for(auto &x:v){std::cin>>x;}
#define vec_in_ll(v, n) auto v=vec_ll(n);for(auto &x:v){std::cin>>x;}
#define vec_in_ld(v, n) auto v=vec_ld(n);for(auto &x:v){std::cin>>x;}

#define print(x)   std::cout << x
#define println(x) std::cout << x << "\n"
#define print_fixed(x)   std::cout << std::fixed << x
#define println_fixed(x) std::cout << std::fixed << x << "\n"
#define print_vec(v) for (auto &x:v) { std::cout << x << " ";}
#define println_vec(v) for (auto &x:v) { std::cout << x << " ";} std::cout << "\n";
#define print_long_vec(v) for (auto &x:v) { std::cout << x << "\n";}
#define println_long_vec(v) for (auto &x:v) { std::cout << x << "\n";} std::cout << "\n";

/* Loops */
#define rep(i, n) for (auto i = 0; i < n; ++i)
#define rep2(i, m, n) for (auto i = m; i < n; ++i)

/* Vector manipulation */
#define vec_sort(v) std::sort(v.begin(), v.end())

using namespace std;
/* Code Starts Here*/
int main () {
    std::ios::sync_with_stdio(false);
    cin.tie(NULL);
    in(N);
    int n = N % 1000;
    if (n == 0) {
        println(0);
        return 0;
    }
    println(1000 - n);
    return 0;
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long long> vll;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef pair<int, int> pii;
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define vv(type, c, m, n, i) vector<vector<type>> c(m, vector<type>(n, i))
#define mat(type, c, m, n) vector<vector<type>> c(m, vector<type>(n));for(auto& r:c)for(auto& i:r)cin>>i;
#define rep(i,a,n) for(int i=(a), i##_len=(n); i<i##_len; ++i)
#define rrep(i,a,n) for(int i=(a), i##_len=(n); i>i##_len; --i)
#define each(x,y) for(auto &(x):(y))
#define var(type, ...)type __VA_ARGS__;Scan(__VA_ARGS__);
template<typename T> void Scan(T& t) { cin >> t; }
template<typename First, typename...Rest>void Scan(First& first, Rest&...rest) { cin >> first; Scan(rest...); }
#define vec(type, c, n) vector<type> c(n);for(auto& i:c) cin>>i;
#define len(x) ((int)(x).size())
#define mp make_pair
#define eb emplace_back
#define em emplace
#define pb pop_back
#define fi first
#define se second
#define get(a, i) get<i>(a)
#define bit_count __builtin_popcount
#define mt make_tuple
inline string zero(int a,string s,char c='0'){return string(a-len(s),c)+s;}
inline string zero(int a,int t,char c='0'){return zero(a, to_string(t), c);}
inline string zero(int a,ll t,char c='0'){return zero(a, to_string(t), c);}
#define mini min_element
#define maxi max_element
#define sum accumulate
#define chmax(a,b) if(a<b)a=b
#define chmin(a,b) if(a>b)a=b
template <class T> inline void print(T t){cout << t << '\n';}
template <class H, class... T> inline void print(H h, T... t){cout << h << " ";print(t...);}
ll powMod(ll n, ll p, ll mod) {
	ll res = 1;
	while (p) {
		if (p & 1) {
			res *= n; res %= mod;
		}
		n *= n; n %= mod;
		p >>= 1;
	}
	return res;
}
const constexpr ll mod = 1000000007;
ll n,x,h[200001],ans=0,r=1;
int main() {
	cin>>n;
	for (ll i = 1; i < n + 1; ++i) {
		h[i]=(h[i-1]+powMod(i,mod-2, mod))%mod;
	}
	for (ll i = 1; i < n + 1; ++i) {
		cin>>x;
		(ans+=x*(h[i]+h[n-i+1]-1+mod))%=mod;
		(r*=i)%=mod;
	}
	print(ans * r % mod);
	return 0;
}


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

int main(){
  ll x; cin >> x;
  ll res = x / 11 * 2 + 1;
  if(x % 11 > 6) ++res;
  if(x % 11 == 0) --res;
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <array>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <tuple>
#include <string>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <numeric>
#include <cassert>
#include <functional>
using namespace std;

typedef unsigned long long int llui;
typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<string, string> pss;
constexpr double pi = 3.141592653589793238462643383279502884L;

// TODO: Mod class

const int sz = 1e5;
const int mod = 1e9 + 7;

int main() {
  ios::sync_with_stdio(false);
  int n, m;
  cin >> n >> m;
  if (abs(n - m) > 1) {
    cout << 0 << endl;
    return 0;
  }
  ll p1 = 1;
  ll p2 = 1;
  for (int i = 1; i <= m; ++i) {
    p1 *= i;
    p1 %= mod;
  }
  for (int i = 1; i <= n; ++i) {
    p2 *= i;
    p2 %= mod;
  }
  p1 *= p2;
  p1 %= mod;
  if (n == m) {
    p1 *= 2;
    p1 %= mod;
  }
  cout << p1 << endl;
}


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

char s[105][105];

int main() {
    int n;
    scanf("%d %*d", &n);
    for(int i = 1; i <= n; ++i) {
        scanf("%s", s[i]);
    }

    for(int i = 1; i <= 2 * n; i++) {
        puts(s[(i + 1) / 2]);
    }
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
int a,b,c,d;
scanf("%d",&a);//價錢
scanf("%d",&b);//預算
scanf("%d",&c);//上限
d=b/a;
if(d>c)
printf("%d",c);
else
printf("%d",d);


return 0;

}

Measured memory_bytes: 128
H,W = map(int, input().split())
S = [input() for _ in range(H)]

inf = 10**6
L = [[inf]*W for _ in range(H)]
if S[0][0] == ".":
    L[0][0] = 0
else:
    L[0][0] = 1

for i in range(H):
    for j in range(W):
        n1 = inf
        n2 = inf
        if i > 0:
            if S[i-1][j] == "." and S[i][j] == "#":
                n1 = L[i-1][j] + 1
            else:
                n1 = L[i-1][j]
        if j > 0:
            if S[i][j-1] == "." and S[i][j] == "#":
                n2 = L[i][j-1] + 1
            else:
                n2 = L[i][j-1]
        L[i][j] = min(L[i][j], n1, n2)

print(L[-1][-1])

Measured memory_bytes: 3188
#include<iostream>
#include<sstream>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<complex>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cassert>

#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define mp make_pair
#define pb push_back
#define each(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define dbg(x) cerr<<__LINE__<<": "<<#x<<" = "<<(x)<<endl

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
const int inf = (int)1e9;
const double INF = 1e12, EPS = 1e-9;

typedef vector<double> P;
ostream& operator<<(ostream &os, const P &p){
	return os << "(" << p[0] << ", " << p[1] << ", " << p[2] << ")";
}
inline P operator+(const P &a, const P &b){
	P c(3);
	rep(i, 3) c[i] = a[i] + b[i];
	return c;
}
inline P operator-(const P &a, const P &b){
	P c(3);
	rep(i, 3) c[i] = a[i] - b[i];
	return c;
}
inline P operator*(double s, P a){
	rep(i, 3) a[i] *= s;
	return a;
}
inline double dot(const P &a, const P &b){
	double res = 0;
	rep(i, 3) res += a[i] * b[i];
	return res;
}
inline P cross(const P &a, const P &b){
	P c;
	c.pb(a[1] * b[2] - b[1] * a[2]);
	c.pb(b[0] * a[2] - a[0] * b[2]);
	c.pb(a[0] * b[1] - b[0] * a[1]);
	return c;
}
inline double norm(const P &a){ return dot(a, a); }
inline double abs(const P &a){ return sqrt(norm(a)); }

int n, m, r;
P s[2000], t[2000], o;
double sr[2000], tb[2000];
int flag[2000];

inline P projection(const P &a, const P &b, const P &p){
	double t = dot(p - a, a - b) / norm(a - b);
	return a + t * (a - b);
}
inline bool intersectSP(const P &a, const P &b, const P &p){
	if(abs(cross(a - b, p - b)) > EPS) return 0;
	double t = dot(p - b, a - b) / norm(a - b);
	return 0 <= t && t <= 1;
}
inline double distanceSP(const P &a, const P &b, const P &p){
	const P r = projection(a, b, p);
	if(intersectSP(a, b, r)) return abs(r - p);
	return min(abs(a - p), abs(b - p));
}
int calc(int bit){
	int res = 0;
	rep(i, n) flag[i] = 0;
	
	rep(i, m) if(bit & 1 << i){
		rep(j, n) if(!flag[j]){
			double x = abs(s[j] - t[i]), y = abs(s[j]);
			double mn = distanceSP(o, t[i], s[j]);
			if((mn < sr[j]) != (max(x, y) < sr[j])){
				flag[j] = 1;
				res++;
			}
		}
	}
	return res;
}

int main(){
	o.resize(3);
	while(scanf("%d%d%d", &n, &m, &r), n){
		rep(i, n){
			vector<double> v(3);
			scanf("%lf%lf%lf%lf", &v[0], &v[1], &v[2], sr + i);
			s[i] = v;
		}
		rep(i, m){
			vector<double> v(3);
			scanf("%lf%lf%lf%lf", &v[0], &v[1], &v[2], tb + i);
			t[i] = v;
		}
		P po(3);
		scanf("%lf%lf%lf", &po[0], &po[1], &po[2]);
		rep(i, n) s[i] = s[i] - po;
		rep(i, m) t[i] = t[i] - po;
		
		memset(flag, 0, sizeof(flag));
		rep(j, n) rep(i, m){
			double x = abs(s[j] - t[i]), y = abs(s[j]);
			double mn = distanceSP(o, t[i], s[j]);
			if((mn < sr[j]) != (max(x, y) < sr[j])) flag[j] |= 1 << i;
		}
		
		double ans = 0;
		rep(i, 1 << m){
			int cnt = 0;
			rep(j, n) if(flag[j] & i) cnt++;
			if(cnt > r) continue;
			
			double sum = 0;
			rep(j, m) if(i & 1 << j) sum += tb[j] / norm(t[j]);
			ans = max(ans, sum);
		}
		printf("%.9f\n", ans);
	}
	return 0;
}

Measured memory_bytes: 1456
# AGC024A - Fairness
def main():
    # a - b repeats: a - b (when even), -a + b (odd)
    a, b, c, k = tuple(map(int, input().rstrip().split()))
    ans = a - b if k % 2 == 0 else -a + b
    flg = ans <= 10 ** 18
    print(ans if flg else "Unfair")


if __name__ == "__main__":
    main()

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

Measured memory_bytes: 3064
#include <iostream>
#include <string.h>
using namespace std;

int main () {
  string h;
  cin >> h;
  if (h.size() % 2 == 1) {
    if (h[0] == h[h.size() - 1]) {
      cout << "Second" << endl;  
    }  
    else {
      cout << "First" << endl;  
    }
  }  
  else {
    if (h[0] == h[h.size() - 1]) {
      cout << "First" << endl;  
    }  
    else {
      cout << "Second" << endl;  
    }
  }
}

Measured memory_bytes: 512
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n";
int main()
{
    IOS;
    long long a,b,c,d,e,h,l,n,t,f,m,x,y,z,f1=0,flag=0,flag1=0,co=0,co1=0,co2=0,sum=0,sum1=0,ma=0,ma1=0,mi=1000000000000000001;
    long long g,co3=0,co4=0,co5=0,co6=0,co7=0,co8=0,mul=1,sum2=0,sum3=0,mu=1,mu1=1;
    double pi=2 * acos (0.0), dou;
    char ch,ch1,ch2;
    string str,str1,str2;
    cin>>str;
    cin>>str1;
    a=str.size();
    b=str1.size();
    for(int i=0; i<a-b+1; i++)
    {
        co=0;
        for(int j=i,k=0; j<i+b; j++,k++)
        {
            if(str[j]==str1[k])
            {
                co++;
            }
        }
        //cout<<endl;
        ma=max(ma,co);
    }
    cout<<str1.size()-ma<<endl;
    return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
using namespace std;
#define int ll 
#define FOR(i,s,e) for(ll i = s; i <= (ll)e; ++i)
#define DEC(i,s,e) for(ll i = s; i >= (ll)e; --i)
#define IAMSPEED ios_base::sync_with_stdio(false); cin.tie(0);
#define db(x) cerr << #x << "=" << x << "\n"
#define db2(x, y) cerr << #x << "=" << x << " , " << #y << "=" << y << "\n"
#define db3(a,b,c) cerr<<#a<<"="<<a<<","<<#b<<"="<<b<<","<<#c<<"="<<c<<"\n"
#define dbv(v) cerr << #v << ":"; for (auto ite : v) cerr << ite << ' '; cerr <<"\n"
#define dbvp(v) cerr << #v << ":"; for (auto ite : v) cerr << "{"  << ite.f << ',' << ite.s << "} "; cerr << "\n"
#define dba(a,ss,ee) cerr << #a << ":"; FOR(ite,ss,ee) cerr << a[ite] << ' '; cerr << "\n"
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define ll long long 
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define f first
#define s second
#define reach cerr << "LINE: " << __LINE__ << "\n";
typedef pair <ll, ll> pi;
typedef tuple<ll,ll,ll> ti3;
string cts(char x) {string t(1,x); return t;}
ll rand(ll a, ll b) { return a + rng() % (b-a+1); }
const int MOD = 1e9 + 7;
const int inf = (int)1e9 + 500;
const long long oo = (ll)1e18 + 500;
template <typename T> void chmax(T& a, T b) { a = max(a, b); }
template <typename T> void chmin(T& a, T b) { a = min(a, b); }
const int MAXN = 200005;
#ifndef LOCAL
#define cerr if(0)cout
#endif
struct ufds_ {
	int p[MAXN],sz[MAXN];
	ufds_(){
		FOR(i,0,MAXN-1)p[i]=i,sz[i]=1;
	}
	int find(int x) {
		if(x==p[x])return x;
		else return p[x] = find(p[x]);
	}
	void merge(int a, int b) {
		a = find(a), b = find(b);
		if(a == b) return;
		if(sz[a] > sz[b]) {
			sz[a] += sz[b];
			p[b] =a ;
		} else {
			sz[b] += sz[a];
			p[a] = b;
		}
	}
} ufds;
int n,m;
int32_t main() 
{
	IAMSPEED
	cin >> n >> m;
	FOR(i,1,m) {
		int a,b; cin >> a >> b;
		ufds.merge(a,b);
	}
	int mx = 0;
	FOR(i,1,n) {
		chmax(mx, ufds.sz[ufds.find(i)]);
	}
	cout << mx;
}



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

int func(int s)
{
  int n[10000] = {0};
  int ans = 1;
  n[s] = 1;

  while(true)
  {
    ans++;
    if(s%2 == 0)
    {
      s /=  2;
    }
    else
    {
      s = s * 3 + 1;
    }

    if(n[s] != 0)
    {
      return ans;
    }
    n[s]++;
  }
}

int main()
{
  int s;
  cin >> s;
  int ans = func(s);
  cout << ans << endl;
}

Measured memory_bytes: 3620
#include <iostream>
#include <cstring>
#define MOD 1000000007
using namespace std;

int n, arr[100010], cvp;

int main(void){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cin>>n;
	for(int i=0;i<n;i++)cin>>arr[i];
	for(int i=0;i<n;i++)arr[i]--;
	for (int i = 0; i < n; ++i){
		if(arr[i]<i)continue;
		if(arr[arr[i]]==i)cvp++;
	}
	cout<<cvp;
	return 0;
}

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

using namespace std;
using i64 = long long;

int main(){
    i64 a{},ans{};
    string s;
    cin>>s;
    for(i64 i=0;i<3;i++){
        if(s[i]=='R') a++;
        else {
            ans=(ans<a?a:ans);
            a=0;
        }
    }
    ans=(ans<a?a:ans);
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3624
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<cstring>
#include<map>
#include<vector>
#include<queue>
#include<climits>
#include<set>
#include<utility>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
const ll MOD=1e9+7;

int main(){

	ll a, b;
	cin >> a >> b;
	ll x=abs(a-b);
	if(a<=0 && 0<=b){
		cout << "Zero" << endl;
	} else if(a<0 && b<0){
		if(x%2==0){
			cout << "Negative" << endl;
		} else {
			cout << "Positive" << endl;
		}
	} else if(0<a && 0<b){
		cout << "Positive" << endl;
	}

	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <iostream>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;
 
#define NUM 2147483647
 
int N = 1;
int* data;
 
void init(int first_N){
    while(N < first_N)N *= 2;
}
 
void update(int update_left,int update_right,int new_value,int node_id,int node_left,int node_right){
    if(update_right < node_left || update_left > node_right)return;
    else if(update_left <= node_left && update_right >= node_right){
        data[node_id] = new_value;
    }else{
        if(data[node_id] >= 0){
            update(node_left,node_right,data[node_id],2*node_id+1,node_left,(node_left+node_right)/2);
            update(node_left,node_right,data[node_id],2*node_id+2,(node_left+node_right)/2+1,node_right);
            data[node_id] = -1;
        }
        update(update_left,update_right,new_value,2*node_id+1,node_left,(node_left+node_right)/2);
        update(update_left,update_right,new_value,2*node_id+2,(node_left+node_right)/2+1,node_right);
    }
}
 
int query(int search_left,int search_right,int node_id,int node_left,int node_right){
    if(search_right < node_left || search_left > node_right){
        return NUM;
    }else{
        if(data[node_id] != -1)return data[node_id];
        else{
            int left = query(search_left,search_right,2*node_id+1,node_left,(node_left+node_right)/2);
            int right = query(search_left,search_right,2*node_id+2,(node_left+node_right)/2+1,node_right);
            return min(left,right);
        }
    }
}
 
int main(){
    int first_N,Q;
    scanf("%d %d",&first_N,&Q);
 
    init(first_N);
 
    data = new int[270000];
 
    for(int i = 0; i <= 2*N-2; i++)data[i] = NUM;
 
    int command,left,right,value;
 
    for(int i = 0; i < Q; i++){
        scanf("%d",&command);
 
        if(command == 0){
            scanf("%d %d %d",&left,&right,&value);
            update(left,right,value,0,0,N-1);
        }else{
            scanf("%d %d",&left,&right);
            printf("%d\n",query(left,right,0,0,N-1));
        }
    }
 
}


Measured memory_bytes: 4224
#include<iostream>
#include<stdlib.h>
#include<stdio.h>
#include<bits/stdc++.h>
using namespace std;
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
/*---------------------DEBUGGING--------------------------------------------*/
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
/*-------------------------------------------------------------------------------------*/
//#define mp make_pair
#define pb push_back
#define ll long long
#define pii pair<int,int>
#define pcc pair<char,char>
#define F first
#define S second
#define int long long
#define pi 3.141592653589793238462643383279502
#define M  1000000007
#define rep(i,a,n) for(int i=a;i<n;i++)
#define INF 1000000000000000000
#define N 200005
#define vi vector<int>
#define all(v) v.begin(),v.end()
#define endl "\n"
//#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
signed main()
{
   ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
   int x;
   cin>>x;
   if(!x)
    cout<<1<<endl;
   else
    cout<<0<<endl;
}


Measured memory_bytes: 3608
#include <iostream>
using namespace std;
int main(){
  while(true){
    int n;
    cin>>n;
    if(n==0){
      break;
    }
    char c[100];
    for(int i=0;i<n;i++){
      cin>>c[i];
    }
    int cnt[26]={0};
    for(int i=0;i<n;i++){
      cnt[(int)(c[i]-'A')]++;

      int max1=-1;
      int max2=-1;
      for(int j=0;j<26;j++){
        if(cnt[j]>max1){
          max2=max1;
          max1=cnt[j];
        }
        else if(cnt[j]>max2){
          max2=cnt[j];
        }
      }
      if(max1-max2>n-(i+1)){
        for(int j=0;j<26;j++){
          if(cnt[j]==max1){
            cout<<(char)(j+'A')<<' ';
            break;
          }
        }
        cout<<(i+1)<<endl;
        break;
      }
      if(i==n-1){
        cout<<"TIE"<<endl;
        break;
      }
    }
  }
  return 0;
}

Measured memory_bytes: 2988
t1,n1=(int(x) for x in input().split())
t2,n2=(int(x) for x in input().split())
t3,n3=(int(x) for x in input().split())
t4,n4=(int(x) for x in input().split())

if t1==1:
    print(n1*6000)
elif t1==2:
    print(n1*4000)
elif t1==3:
    print(n1*3000)
else:
    print(n1*2000)
    
if t2==1:
    print(n2*6000)
elif t2==2:
    print(n2*4000)
elif t2==3:
    print(n2*3000)
else:
    print(n2*2000)

if t3==1:
    print(n3*6000)
elif t3==2:
    print(n3*4000)
elif t3==3:
    print(n3*3000)
else:
    print(n3*2000)

if t4==1:
    print(n4*6000)
elif t4==2:
    print(n4*4000)
elif t4==3:
    print(n4*3000)
else:
    print(n4*2000)


Measured memory_bytes: 5612
#include<iostream>
#include<algorithm>
using namespace std;main(){for(long long n,j[65001],a,s;cin>>n,n;cout<<a<<"\n"){for(s=a=0;a++<n;s+=*j)cin>>*j;for(;a-->2;)cin>>j[a-1];a=s*n;sort(j+1,j+n);for(;n-->0;a=max(a,s*n))s+=j[n];}}

Measured memory_bytes: 1676
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);
        int A = scanner.nextInt();
        int B = scanner.nextInt();

        double taxA = 0.08;
        double taxB = 0.10;

        int count = 0;
        while (true) {
            double zeinukiA = Math.floor(count * taxA);
            double zeinukiB = Math.floor(count * taxB);
            if (zeinukiA > A || zeinukiB > B) {
                break;
            }
            if (zeinukiA != A) {
                count++;
                continue;
            }
            if (zeinukiB != B) {
                count++;
                continue;
            }
            System.out.println(count);
            return;
        }
        System.out.println(-1);
    }
}


Measured memory_bytes: 23124
import sys

n = int(input())
task = []
for i in range(n):
    temp = list(map(int,input().split()))
    task.append(temp)
    
task = sorted(task, key=lambda x:(x[1],x[0]))
temp_time = 0
for i in range(n):
    if temp_time+task[i][0] <= task[i][1]:
        temp_time += task[i][0]
    else:
        print("No")
        sys.exit()
        
print("Yes")

Measured memory_bytes: 67816