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

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

#define MAXX 100005

#define PI 3.14159265358979323846264338327950

#define ll signed long long int

ll a[MAXX];
multiset<ll> ms;
multiset<ll>::iterator it;
signed main()
{
    FAST;
    string s;
    cin >> s;
    ll mn = 0;
    ll ans = 0;
    for(ll i = 0; i < s.size(); i++){
    	if(s[i] == 'A' || s[i] == 'C' || s[i] == 'G' || s[i] == 'T'){
    		mn ++;
		}
		else{
			ans = max(mn, ans);
			mn = 0;
		}
	}
	cout << max(ans, mn);
}

Measured memory_bytes: 256
/***
 @ Author       : RobsonChen
 @ Date         : 2020-09-20 19:35:23
 @ LastEditTime : 2020-09-20 22:35:57
 @ Got AC       : Σ(っ °Д °;)っ
*/
#include <bits/stdc++.h>

using namespace std;
typedef unsigned int INT;
typedef unsigned long long LONG;
typedef long long LL;
typedef pair<int, int> PII;
const int N = 1e5 + 10;
const int mod = 998244353;
#define debug(x) cerr << #x << ": " << (x) << '\n'
#define FW freopen("data2.txt", "w", stdout);

//快速读入输出，只适用于整数，使用时流同步打开，C语言不准关流
// getchar()<<cin(关流)<<scanf()<<cin
template <class T>
inline bool Read(T& ret)
{
    char c;
    int sgn;
    if (static_cast<void>(c = getchar()), c == EOF)
        return 0;
    while (c != '-' && (c < '0' || c > '9'))
        c = getchar();
    sgn = (c == '-') ? -1 : 1;
    ret = (c == '-') ? 0 : (c - '0');
    while (static_cast<void>(c = getchar()), c >= '0' && c <= '9')
        ret = ret * 10 + (c - '0');
    ret *= sgn;
    return 1;
}

//输出只能用于整数
template <class T>
inline void Write(T x)
{
    if (x < 0)
        putchar('-'), x = -x;
    if (x > 9)
        Write(x / 10);
    putchar(x % 10 + '0');
}

void slove(int qnum)
{
    int n;
    cin >> n;
    if (n)
        cout << 0;
    else
        cout << 1;
}

int main()
{
    int qnum = 1;
    // cin >> num;
    for (int i = 1; i <= qnum; ++i) {
        slove(i);
    }
    //system("pause");
    return 0;
}

Measured memory_bytes: 3632
using System;
class Program
{
    static void Main(string[] args)
    {
        var a = int.Parse(Console.ReadLine()); //標準入力
        string[] str = Console.ReadLine().Split(' ');//2つ以上のスペース区切り入力の取得
        string ans = "Yes";
        int tmp = -1;
        for (int i = str.Length - 1; i >= 0; i--)
        {
            if (tmp == -1)
            {
                tmp = int.Parse(str[i]);
                continue;
            }

            int x = int.Parse(str[i]);
            if (x <= tmp)
            {
                tmp = x;
                continue;
            }
            else if (x == tmp + 1)
            {
                continue;
            }
            else
            {
                ans = "No";
                break;
            }

        }
        Console.Write(ans);
    }
}

Measured memory_bytes: 22620
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

S = input()

print("Yes" if S[:4] == "YAKI" else "No")


Measured memory_bytes: 5328
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<string>
#include<cstdlib>
using namespace std;
unsigned long long k,a,b;
int ans;
int main(){
	cin>>k>>a>>b;
	if(a>=k){
		cout<<"1\n";
		return 0;
	}
	if(b>=a){
		cout<<"-1\n";
		return 0;
	}
	if((k-a)%(a-b)>=1) ans=1;
	cout<<((k-a)/(a-b)+ans)*2+1<<endl;
 	return 0;
}

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

int main(int argc, char *argv[]) {
  ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);

  int a,b,c;cin>>a>>b>>c;
  if(a==b)cout<<c<<endl;
  else if(a==c)cout<<b<<endl;
  else cout<<a<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
using namespace std;
int main(){
    while(1){
        int n,m,x,sum1=0,sum2=0,ans=100000,num,ax=0,ay=0;
        vector<int> N,M;
        cin >> n >> m;
        if(n==0&&m==0)  break;
        for(int i=n;i--;){
            cin >> x;
            sum1+=x;
            N.push_back(x);
        }
        for(int i=m;i--;){
            cin >> x;
            sum2+=x;
            M.push_back(x);
        }
        num = sum1 - sum2;
        //cout << sum1 << " " <<sum2 << endl;
        for(int i=0;i<n;i++){
            for(int j=0;j<m;j++){
                if(num == 2*(N[i]-M[j])&&ans>N[i]+M[j]){
                    ans = N[i]+M[j];
                    ax=N[i];
                    ay=M[j];
                }
            }
        }
        if(ax==0&&ay==0)    cout << "-1\n";
        else cout << ax << " " << ay << "\n";
    }
}

Measured memory_bytes: 3016
'use strict'

function main(input){
  const lines = input.split('\n');

  const ABCD = lines.shift().split('').map(x => parseInt(x));
  const A = ABCD[0];
  const B = ABCD[1];
  const C = ABCD[2];
  const D = ABCD[3];

  for(var i=0;i<8;i++){
    let operators = (8+i).toString(2).split('').map(function(x){if(x=='1'){return '+'}else{return '-'}}).slice(1,4)
    let seven = A;
    for(let j=0;j<3;j++){
      if(operators[j]=='+'){
        seven += ABCD[j+1]
      }else{
        seven += -1 *  ABCD[j+1]
      }
    }
    if(seven==7){
      let result = `${A}${operators[0]}${B}${operators[1]}${C}${operators[2]}${D}=7`;
      console.log(result);  

      return
    }
  }
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));


Measured memory_bytes: 9420
S = input()

flag = 0
for i in range(len(S)):
    if (i + 1) % 2 == 1:
        if S[i] == "L":
            flag = 1
    else:
        if S[i] == "R":
            flag = 1

if flag == 1:
    print("No")
else:
    print("Yes")

Measured memory_bytes: 2940
#include <bits/stdc++.h>
#include <math.h>
#include <cmath>

using namespace std;
using ll =long long;
using vi = vector<int>; 
using vvi = vector<vi>; 
using vl = vector<ll>; 
using vvl = vector<vl>; 
using vs = vector<string>;
using vvs = vector<vs>; 
using vc = vector<char>;
using vvc = vector<vc>; 
using vb = vector<bool>;
using vvb = vector<vb>; 

#define rep(i,n) ;for( int i =0; i < n ; i ++)
#define all(a) a.begin(),a.end()
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define f(i,a,b) for(int i=a;i<b;i++)
#define pri(a)  printf("%.14lf\n",a);
#define sz(a) ((int)a.size())
#define MOD 1000000007
bool is_int_lround(double x){
  return std::lround(x)==x;
}
ll keta(ll x){
  ll n=0;
  while(x>0){
    x /=10 ;
    n ++;
  }
  return n;
}

ll conbi(int n,int m){
  
  cin>>n>>m;
  vector<ll> a(100);
  a[0] =1;
  for(int i=0;i<14;i++){
    a[i+1]=a[i]*(i+1);
  }
  return a[n] /(a[m] *a[n-m]);
}

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;//繰り返し二乗法
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
ll kaijoMOD(ll x){
  ll z=1;
  if(x==0){
    return 1;
  }
  while(x>0){
    z *=x;
    z %=MOD;
    x--;
  }
  return z;
}
ll div_num(ll n){
  vl div(n+1,1);
  for(ll i=2;i*i<=n;i++){ 
    while(n%i==0){
      n /=i;
      div[i]++;
    }
  }
  if(n!=1)div[n]++;
  ll num=1;
  for(ll i=0;i<=n;i++){
    num*=div[i];
  }
  return num;
}
vector<ll> divisor(ll n) {
  vector<ll> ret;
  for(ll i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}

int keta_wa(int x){
  int tot=0;
  while(x>0){
    tot +=x%10;
    x/=10;
  }
  return tot;
}
long long lopow(ll a, long long n) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a ;
        a = a * a ;
        n >>= 1;
    }
    return res;
}


//vc alp ={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
//vc Alp ={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
//cout<<""<<endl;

int main(){
  int X;cin>>X;
  if(X>=1800)cout<<1<<endl;
  else if(X>=1600)cout<<2<<endl;
  else if(X>=1400)cout<<3<<endl;
  else if(X>=1200)cout<<4<<endl;
  else if(X>=1000)cout<<5<<endl;
  else if(X>=800)cout<<6<<endl;
  else if(X>=600)cout<<7<<endl;
  else if(X>=400)cout<<8<<endl;
}







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

using ll = long long;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int n;
  cin >> n;
  
  vector<ll> a(n + 1), b(n + 1);
  ll total_leaf = 0;
  for (int i = 0; i <= n; i++) {
    cin >> a.at(i);
    b.at(i) = a.at(i);
    total_leaf += a.at(i);
  }
  for (int i = n - 1; i >= 0; i--) b.at(i) += b.at(i + 1);
  
  if (n == 0) {
    if (a.at(0) == 1) cout << 1 << '\n';
    else cout << -1 << '\n';
    return 0;
  }
  
  if (a.at(0) > 0) {
    cout << -1 << '\n';
    return 0;
  }
  
  ll ans = 1, now_leaf = 1, floor_node = 1;
  for (ll i = 1; i <= n; i++) {
    if (a.at(i) > 2 * now_leaf) {
      cout << -1 << '\n';
      return 0;
    }
    
    if (b.at(i) <= 2 * now_leaf) {
      //cout << 111 << endl;
      ans += b.at(i);
      now_leaf = b.at(i) - a.at(i);
    }
    else {
      //cout << 222 << endl;
      ans += 2 * now_leaf;
      now_leaf = 2 * now_leaf - a.at(i);
    }
    //cout << now_leaf << endl;
  }
  
  cout << ans << '\n';
}

Measured memory_bytes: 4764
using System;
using System.Linq;

namespace _0641
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] x = Console.ReadLine().Split().Select(int.Parse).ToArray();
            Console.WriteLine(Math.Min((x[0] + x[1] - 1) / x[1] * x[2], (x[0] + x[3] - 1) / x[3] * x[4]));
        }
    }
}



Measured memory_bytes: 9588
N,K=gets.split.map &:to_i
l=N.times.map{gets.split.map(&:to_i)}
ans=10**21
k=K>=4 ?4:K
l.combination(k) do |a|
    b=a.transpose
    next if k != b[0].uniq.size || k != b[1].uniq.size
    ix,ax,iy,ay=b[0].minmax+b[1].minmax
    cnt=0
    l.each do |i|
        x,y=i
        cnt+=1 if ix<=x && x<=ax && iy<=y && y<=ay
    end
    s =(ax-ix)*(ay-iy)
    ans=ans>s ? s : ans if cnt>=K
end
p ans

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

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; }

using ll = long long;

const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int INF = 1<<30;
const ll mod = 1000000007LL;

int main() {
  ll A;
  string B;
  cin>>A>>B;
  B.erase(B.end()-3);
  reverse(B.begin(),B.end());
  ll C = 0LL;
  ll i = 1LL;
  for(auto x:B){
    C+=i*(ll)(x-'0');
    i*=10LL;;
  }
  cout<<(A*C)/100<<endl;
}


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

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
	~debug() { cerr << endl; }
	eni(!= ) cerr << boolalpha << i; ris;
}
eni(== ) ris << range(begin(i), end(i));
}
sim, class b dor(pair < b, c > d) {
	ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
	*this << "[";
	for (auto it = d.b; it != d.e; ++it)
		*this << ", " + 2 * (it == d.b) << *it;
	ris << "]";
}
#else
	sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

using ll = long long;

const int INF = 1e9 + 5;


int main() {
	vector<int> ar(5);
	int k;
	
	for (auto& i : ar)
		cin >> i;
	cin >> k;

	for (auto& i : ar) {
		if (i - *ar.begin() > k) {
			cout << ":(" << endl;
			return 0;
		}
	}
	cout << "Yay!" << endl;
	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define REPR(i,n) for (int i=(int)(n)-1;i>=0;--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define valid(y,x,h,w) (0<=y&&y<h&&0<=x&&x<w)
#define tpl(...) make_tuple(__VA_ARGS__)
const int INF = 0x3f3f3f3f;
const double EPS = 1e-8;
const double PI = acos(-1);
const int dy[] = {-1,0,1,0};
const int dx[] = {0,1,0,-1};
typedef long long ll;
typedef pair<int,int> pii;
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<typename Ch,typename Tr,typename C,typename=decltype(begin(C()))>basic_ostream<Ch,Tr>& operator<<(basic_ostream<Ch,Tr>&os,
const C& c){os<<'[';for(auto i=begin(c);i!=end(c);++i)os<<(i==begin(c)?"":" ")<<*i;return os<<']';}
template<class S,class T>ostream&operator<<(ostream &o,const pair<S,T>&t){return o<<'('<<t.first<<','<<t.second<<')';}
template<int N,class Tp>void output(ostream&,const Tp&){}
template<int N,class Tp,class,class ...Ts>void output(ostream &o,const Tp&t){if(N)o<<',';o<<get<N>(t);output<N+1,Tp,Ts...>(o,t);}
template<class ...Ts>ostream&operator<<(ostream&o,const tuple<Ts...>&t){o<<'(';output<0,tuple<Ts...>,Ts...>(o,t);return o<<')';}
template<class T>void output(T t,char z=10){if(t<0)t=-t,putchar(45);int c[20];
int k=0;while(t)c[k++]=t%10,t/=10;for(k||(c[k++]=0);k;)putchar(c[--k]^48);putchar(z);}
template<class T>void outputs(T t){output(t);}
template<class S,class ...T>void outputs(S a,T...t){output(a,32);outputs(t...);}
template<class T>void output(T *a,int n){REP(i,n)cout<<a[i]<<(i!=n-1?',':'\n');}
template<class T>void output(T *a,int n,int m){REP(i,n)output(a[i],m);}
template<class T>bool input(T &t){int n=1,c;for(t=0;!isdigit(c=getchar())&&~c&&c-45;);
if(!~c)return 0;for(c-45&&(n=0,t=c^48);isdigit(c=getchar());)t=10*t+c-48;t=n?-t:t;return 1;}
template<class S,class ...T>bool input(S&a,T&...t){input(a);return input(t...);}
template<class T>bool inputs(T *a, int n) { REP(i,n) if(!input(a[i])) return 0; return 1;}

int a[100005];
pii p[100005];

int main() {
  int n, m;
  while(cin>>n>>m) {
    inputs(a,n);
    sort(a,a+n);
    REP(i,m) {
      int b, c;
      input(b,c);
      p[i] = pii(c, b);
    }
    sort(p,p+m,greater<pii>());
    int index = 0;
    ll ans = 0;
    REP(i,n) {
      if (index < m) {
        ans += max(a[i], p[index].first);
        p[index].second--;
        if (p[index].second == 0) index++;
      }
      else ans += a[i];
    }
    cout << ans << endl;
  }
}


Measured memory_bytes: 1408
#include<stdio.h>
int main(void)
{
	char mass[3];
	int i,k=0;
	
	scanf("%s",mass);
	
	for(i=0;i<3;i++){
		if(mass[i]=='1'){
			k++;
		}
	}
	printf("\n%d\n\n",k);
	
	return 0;
}

Measured memory_bytes: 128
#pragma GCC optimize("03")
#include <bits/stdc++.h>
#define ll long long 
#define fi first
#define se second

using namespace std;

int h[100100], n, k;
ll dp[100100];

int main() {    
    // ifstream cin("tst.in");
    // ofstream cout("tst.out");
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);

    cin >> n >> k;
    for (int i = 1; i <= n; i++)
        cin >> h[i];

    for (int i = 1; i <= n; i++)
        dp[i] = 2e9;
    dp[1] = 0;

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

    cout << dp[n];

    return 0;
}

Measured memory_bytes: 1408
N, M = map(int, input().split())

A = []
for _ in range(M):
    A.append(int(input()))

step = [0 for _ in range(N+1)]

ptr = 0

step[0] = 1
step[1] = 1
if ptr < M and A[ptr] == 1:
    step[1] = 0
    ptr += 1

for i in range(2, N+1):
    if ptr < M and i == A[ptr]:
        ptr += 1
    else:
        step[i] = step[i-1] + step[i-2]


print(step[N] % (10**9+7))


Measured memory_bytes: 460056
#include <iostream>
#include <set>
#include <vector>
#include <string>
#include <algorithm>
#include <iterator>
#include <map>
#include <utility>
#include <list>
#include <climits>
#include <bitset>
#include <numeric>

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
#define repi(i, n) for(auto i = (n).begin(); i != (n).end(); i++)
#define in_arr(type, a, n) copy_n(istream_iterator<type>(cin), n, (a).begin());
#define ll long long int

int main(){
    int n, t;
    cin >> n >> t;
    int ans = INT_MAX;
    rep(i, n){
        int a, b;
        cin >> a >> b;
        if(b > t)
            continue;
        ans = min(ans, a);
    }
    cout << (ans == INT_MAX ? "TLE" : to_string(ans)) << endl;
    return 0;
}


Measured memory_bytes: 256
while 1:
    H,W=map(int,input().split())
    #0 0 ga input saretara owari
    if H==0 and W==0:
        break
    #loop de shikaku wo hyougen
    #H ga tate, W ga yoko
    for i in range(H):
        #'*' de mojiretu wo kurikaeseru
        print('#'*W)
    #tugi no sikaku nomaeni kaigyou
    print()
        
            



Measured memory_bytes: 5608
#include<iostream>
#include<string>
#include<string.h>
#include<map>
#include<set>
#include<vector>
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
using namespace std;
int main()
{
char a,b;
cin>>a>>b;
if(a==b)
cout<<"H";
else
cout<<"D";
system("pause");
return 0;
}


Measured memory_bytes: 504
using System;

namespace _0216
{
    class Program
    {
        static void Main(string[] args)
        {
            while (true)
            {
                int n = int.Parse(Console.ReadLine());
                if (n == -1)
                {
                    break;
                }
                int x = 1150;
                if (20 >= n && n > 10)
                {
                    x += (n - 10) * 125;
                }
                else if (30 >= n && n > 20)
                {
                    x += 1250;
                    x += (n - 20) * 140;
                }
                else if (n > 30)
                {
                    x += 1250;
                    x += 1400;
                    x += (n - 30) * 160;
                }
                Console.WriteLine(4280 - x);
            }
        }
    }
}

Measured memory_bytes: 9000
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <queue>

using namespace std;

void ABC064D()
{
	int N;
	cin >> N;
	string str;
	cin >> str;
	int ct = 0;
	int nLeft = 0;
	for (int i = 0; i < str.size(); ++i)
	{
		if (str[i] == ')')
			--ct;
		else if(ct < 0)
		{
			nLeft -= ct;
			ct = 1;
		}
		else
		{
			++ct;
		}
	}
	if (ct < 0)
	{
		nLeft -= ct;
		ct = 0;
	}
	string ret(nLeft, '(');
	ret += str;
	ret += string(ct, ')');
	cout << ret << endl;
}
int main()
{
	ABC064D();
	return 0;
}

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

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

  vector<int> v(n);
  for (int i = 0; i < n; i++) {
    cin >> v.at(i);
  }

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

  ll ans = 0;
  int t = n - 1;
  for (int i = 0; i < n; i++) {
    int lim = 2;
    if (i == 0) { lim = 1; }

    for (int j = 0; j < lim; j++) {
      if (t > 0) {
        ans += v.at(i);
        t--;
      }
    }
  }

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


Measured memory_bytes: 4028
def f(N,K,h):
    dp = [0]*N

    for i in range(1,N):
        dp[i] = min([dp[j] + abs(h[i] - h[j]) for j in range(max(0,i-K), i)])
    print(dp[-1])


N, K = map(int, input().split())
h = list(map(int, input().split()))
f(N,K,h)

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

  int a,b;
int main()
{
  cin>>a>>b;
  if (a>0||(b<0&&((a-b)&1))) puts("Positive");
  else
  if (b<0) puts("Negative");
  else
  puts("Zero");
  exit(0);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  for(int i=0;i<(n);++i)
#define REPr(i,n) for(int i=(n)-1;i>=0; --i)
#define FORq(i, m, n) for(int i = (m);i <= (n);++i)
#define rFORq(i, m , n) for(int i = (n);i >=(m);--i)
#define SCD(n) scanf("%d",&n)
#define SCD2(m,n) scanf("%d%d",&m,&n)
#define SCD3(m,n,k) scanf("%d%d%d",&m,&n,&k)
#define SCLLD(n) scanf("%lld",&n)
#define SCLLD2(m,n) scanf("%lld%lld",&m,&n)
#define SCLLD3(m,n,k) scanf("%lld%lld%lld",&m,&n,&k)
#define PB push_back
#define MP make_pair
#define ARSCD(A,N) REP(i,N){SCD(A[i]);}
#define ARSCD1(A,N) FORq(i,1,N){SCD(A[i]);}
#define VSCD(v,N) REP(i,N){int x; SCD(x); v.PB(x);}
#define VSCLLD(v,N) REP(i,N){long long x; SCLLD(x); v.PB(x);}
#define PRINTD(n) printf("%d\n",n)
#define PRINTLLD(n) printf("%lld\n",n)
#define DEBUG printf("%s\n","debug")
#define fst first
#define snd second
#define SIN(x,S) (S.count(x) != 0)
using namespace std;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector < VI > VVI;
typedef vector<long long> VL;
typedef long long ll;
typedef long long integer;
////////////////////////////////////////////////////////////////////
int main(){
    int X;
    SCD(X);

    if ((X==7) or (X==5) or (X==3)){
        printf("YES\n");
    }else{
        printf("NO\n");
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin>>N;
vector<int> A(N);
for(int i=0; i<N; i++){
    cin>>A[i];
}
double x=0;
for(int i=0; i<N; i++){
    x+=(1.0/A[i]);
}
cout<< 1.0/x <<endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>

#include <iostream>
#include <iomanip>
#include <sstream>
#include <fstream>
#include <stdint.h>
#include <string.h>

//#define _USE_MATH_DEFINES
//#include <math.h>

#include <vector>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <deque>
#include <string>

#include <algorithm>
#include <functional>
#include <bitset>
#include <functional>
#include <chrono>
#include <random>
#define sqr(x) (x) * (x)

typedef unsigned int u32;
typedef int i32;
typedef unsigned long long int u64;
typedef long long int i64;
typedef uint16_t u16;
typedef int16_t i16;
typedef uint8_t u8;
typedef int8_t i8;

using namespace std;
using namespace std::chrono;

//const i64 mod = 1000000007ll;
const i64 smod = 998244353ll;
const i64 inf = 1'000'000'000'000'000'000ll + 7;

const double eps = 1e-8;

i64 n;

int main(int argc, char* argv[]) {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cout.precision(15); cout.setf(ios::fixed);

    cin >> n;
    double pi = 3.141592653589;
    cout << 2 * pi * n << endl;

    return 0;
}

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

int N;
long long A[100000], B[100000];
long long res;

int main() {
  cin >> N;
  for(int i = 0; i < N; ++i) cin >> A[i] >> B[i];
  for(int i = N - 1; i >= 0; --i) {
    res = (A[i] + res + B[i] - 1) / B[i] * B[i] - A[i];
  }
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <cstdio>

int main()
{
    int t;
    std::cin >> t;
    int h = t / 3600;
    int m = (t % 3600) / 60;
    int s = t % 60;
    printf("%d:%d:%d\n", h, m, s);
    return 0;
}

Measured memory_bytes: 1144
//
//  main.cpp
//  Atcoder Beginner Contest 071 B
//
//  Created by luras on 2017/8/20.
//  Copyright © 2017年 luras. All rights reserved.
//

#define ms(x, y) memset(x, y, sizeof(x))
#define mc(x, y) memcpy(x, y, sizeof(x))
#define lson o << 1, l, mid
#define rson o << 1 | 1, mid + 1, r
#define ls o << 1
#define rs o << 1 | 1
#include<stdio.h>
#include<string.h>
#include<math.h>
#include<queue>
#include<map>
#include<stack>
#include<vector>
#include<list>
#include<set>
#include<string>
#include<algorithm>
#pragma comment(linker,"/STACK:102400000,102400000")
template <class T> inline void gmax(T &a, T b){if(b > a) a = b;}
template <class T> inline void gmin(T &a, T b){if(b < a) a = b;}
using namespace std;
const int N = 1e5 + 10, M = 2e6 + 10, Z = 1e9 + 7, maxint = 2147483647, ms1 = 16843009, ms31 = 522133279, ms63 = 1061109567, ms127 = 2139062143;
const double PI = acos(-1.0), eps = 1e-8;
typedef long long LL;
void fre()
{
    freopen("/Users/luras/Desktop/in.txt", "r", stdin);
    freopen("/Users/luras/Desktop/out.txt", "w", stdout);
}
const int INF = 1e9;
int casenum, casei;

char s[N];
int a[30];

int main()
{
    while(~ scanf("%s", s)){
        int len = strlen(s);
        for(int i = 0; i < len; i ++){
            a[s[i] - 'a'] ++;
        }
        for(int i = 0; i < 26; i ++){
            if(a[i] == 0){
                printf("%c\n", i + 'a');
                return 0;
            }
        }
        puts("None");
    }
    return 0;
}

/*
 
 
 题意:
 
 类型:
 
 分析:
 
 优化:
 
 trick:
 
 数据:
 
 Sample Input
 
 Sample Output
 
 
 */






Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll          long long int
#define lld          long double
#define pb          push_back
#define pii         pair<ll,ll>
#define mi          map<ll,ll>
#define vec         vector<ll>
#define all(a)     (a).begin(),(a).end()
#define F           first
#define S           second
#define mod         1000000007
#define rep(i,a,b)	for(ll  i=a;i<b;i++)
#define repi(i,a,b)	for(ll  i=a;i<=b;i++)
#define per(i,a,b)  for(ll i=a;i>=b;i--)
#define mp          make_pair
#define mit         map<ll,ll>::iterator
#define sit         set<ll>::iterator
#define pit         pair<ll,ll>::iterator
#define tr(container, it) for(__typeof(container.begin()) it = container.begin(); it != container.end(); it++)
using namespace std;
ll xo(ll x, ll y) 
{ 
   return (x | y) & (~x | ~y); 
}  
ll bin_Expo(ll x,ll n)
{
		if(x==0)
		return 0;
    if(n==0)
        return 1;
    else if(n%2 == 0)        //n is even
        return bin_Expo(x*x,n/2);
    else                             //n is odd
        return x*bin_Expo(x*x,(n-1)/2);
}
ll mod_Expo(ll x,ll n,ll M)
{
		if(x==0)
		return 0;
    if(n==0)
        return 1;
    else if(n%2 == 0)        //n is even
        return mod_Expo((x*x)%M,n/2,M);
    else                             //n is odd
        return (x*mod_Expo((x*x)%M,(n-1)/2,M))%M;

}
bool prime_check(ll x)
{
    bool prime = (x >= 2);
    for (ll i = 2; i * i <= x; i++) 
    {
        if (x % i == 0) 
        {
            prime = false;
            break;
        }
    }
    return prime;
}
ll logg(ll base,ll x) {
    return (ll)(log(x) / log(base));
}
ll a[200005], h[200005], dp[200005], tree[400005];
void build()
{
	repi(i,0,400005) tree[i]=0;
}
ll query(ll node, ll st, ll ed, ll l, ll r)
{
	if(st>r || ed<l) return -1*mod;
	if(st>=l && ed<=r) return tree[node];
	ll mid=(st+ed)/2;
	return max(query(2*node+1,st,mid,l,r),query(2*node+2,mid+1,ed,l,r));
}
void update(ll node, ll st, ll ed, ll idx, ll val)
{
	if(st==ed) tree[node]=val;
	else{
		ll mid=(st+ed)/2;
		if(idx>=st && idx<=mid) update(2*node+1,st,mid,idx,val);
		else update(2*node+2,mid+1,ed,idx,val);
		tree[node] = max(tree[2*node+1],tree[2*node+2]);
	}
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int TESTS=1;
//	cin>>TESTS;
    while(TESTS--)
    {
    	ll n,k,i,j,m,w;
    	cin>>n;
    	build();
    	rep(i,0,n) cin>>h[i];
    	rep(i,0,n) cin>>a[i];
    	repi(i,0,200000) dp[i]=0;
		m=0;
    	rep(i,0,n)
    	{
			m = query(0,0,n,0,h[i]-1);
			dp[h[i]] = m + a[i];
			update(0,0,n,h[i],dp[h[i]]);
		}
		repi(i,0,200000) m=max(m,dp[i]);
		cout<<m;
	}
	return 0;
}












Measured memory_bytes: 11488
N,M = map(int,input().split())
li = []
for i in range(N):
    li_element = list(map(int,input().split()))
    li.append(li_element)

li_sorted = sorted(li)
num_bought = 0
answer = 0
j=0
while(num_bought<M):
    if li_sorted[j][1]>M-num_bought:
        answer += li_sorted[j][0]*(M-num_bought)
    else:
        answer += li_sorted[j][0]*li_sorted[j][1]
    num_bought += li_sorted[j][1]
    j += 1
    
print(answer)

Measured memory_bytes: 62872
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
#define rep1(i,N) for(int i=1;i<int(N);++i)
#define all(a) (a).begin(),(a).end()		 //sort(all(vi S)) sort(all(string S))
#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }
#define printpair(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<"{"<<_.first<<","<<_.second<<"}"<<", "; cerr<<"]"<<endl; }

using P = pair<int, int>;		//P.first, P.second
typedef long long ll;
typedef vector<int> vi;
typedef set<int> seti;
typedef vector<string> vs;

const int MOD = 1e9+7;
const int INF = 1e9;
int main() {
    int a;
    cin>>a;
    string S;
    cin>>S;
    if(a>=3200){
        cout<<S<<endl;
        return 0;
    }
    cout<<"red"<<endl;
}

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

int main(void){
	int N,sum=0;
	cin >> N;
	int a[N];
	for(int i=0;i<N;i++){
		cin >>a[i];
		sum += a[i];
	}
	if(sum%N> N/2){
		sum = (sum+(N-1))/N;
	}else{
		sum /=N;
	}
	long long ans = 0;
	for(int i=0;i<N;i++){
		ans += (sum-a[i])*(sum-a[i]);
	}
	cout << ans;
}

Measured memory_bytes: 256
n=int(input())
l=list(map(int,input().split()))
ans=0
for i in range(1,n-1):
  if max(l[i-1],l[i],l[i+1])!=l[i] and min(l[i-1],l[i],l[i+1])!=l[i]:
    ans+=1
print(ans)

Measured memory_bytes: 3064
using System;

public class Hello
{
    public static void Main()
    {
        var a = Console.ReadLine().Trim();
        var b = Console.ReadLine().Trim();
        var res = "";
        if (a.Length == b.Length)
        {
            for (int i = 0; i < a.Length; i++)
                res += a[i].ToString() + b[i].ToString();
        }
        else
        {
            for (int i = 0; i < a.Length - 1; i++)
                res += a[i].ToString() + b[i].ToString();
            res += a[a.Length - 1];
        }
        Console.WriteLine(res);
    }
}

Measured memory_bytes: 11092
#include "bits/stdc++.h"
//#include <bits/stdc++.h>
#define _ ios_base::sync_with_stdio(0);cin.tie(0);
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <math.h>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair <ll, ll > pll;

bool comp(const pll& a, const pll& b) {
	return a.first < b.first;
}
std::vector<int> enum_div(int n)//nの約数を列挙
{
	std::vector<int> ret;
	for (int i = 1; i * i <= n; ++i)
	{
		if (n % i == 0)
		{
			ret.push_back(i);
			if (i != 1 && i * i != n)
			{
				ret.push_back(n / i);
			}
		}
	}
	return ret;
}


template<int N>
int factorial() {
	return factorial<N - 1>() * N;
}
ll nCr(ll n, ll r);//コンビネーション
int permutation(int n, int r);//nPk パーミュテーション
int factorial(int k);//階乗

template<>  /// 特殊化：factorial<N=”1”>だったら，値を返す
int factorial<1>() {
	return 1;
}
int main()
{
	//priority_queue<int> q;
	string s = {};
	ll h = 0, w = 0, k = 0, a = 0, b = 0, c = 0, d = 0, e = 0, f = 0, g = 0, ans = 0;
	ll x[100005] = {};
	ll y[100005] = {};
	//ll z[302][302] = {};
	cin >> a;
	for (int i = 0; i < a; i++)
	{
		cin >> x[i];
	}
	for (int i = 0; i < a; i++)
	{
		if (x[i]%2==0)
		{
			if (x[i] % 3 != 0&& x[i] % 5 != 0)
			{
				cout << "DENIED" << endl;
				return 0;
			}
		}
	}
	cout << "APPROVED" << endl;

	//return 0;

	/*cout << c << endl;
	cout << b << endl;*/
	//cout << fixed << setprecision(10) <<tmp << endl;
	//cout<<factorial<10><<endl;
	return 0;
}
//2つの組の数をソートしたりするやつ
//vector<pair<ll, ll> > hoges(a);
//for (int i = 1; i <= a; i++)
//{
//	cin >> h;
//	hoges[i - 1] = make_pair(h, i);
//}
//sort(hoges.begin(), hoges.end(), comp);
//for (int i = 0; i < a; i++)
//{
//	cout << hoges[i].second << endl;
//}

int permutation(int n, int r) {
	int n_sum, r_sum;
	int i;
	r = n - r;
	n_sum = factorial(n);
	r_sum = factorial(r);
	return n_sum / r_sum;
}

ll nCr(ll n, ll r) {
	ll ans = 1;
	for (ll i = n; i > n - r; --i) {
		ans = ans * i;
	}
	for (ll i = 1; i < r + 1; ++i) {
		ans = ans / i;
	}
	return ans;
}
int factorial(int k) {
	int sum = 1;
	for (int i = 1; i <= k; ++i)
	{
		sum *= i;
	}
	return sum;
}

Measured memory_bytes: 1024
#include <stdio.h>

int main(void) {
  int a, b, c, max=0;
  scanf("%d %d %d", &a, &b, &c);

  if (a>max) max=a;
  if (b>max) max=b;
  if (c>max) max=c;

  printf("%s\n", (a+b+c)-max==max ? "Yes": "No");
  return 0;
}

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

int main() {
  	string s;
  	cin >> s;
  	for (auto c : s) if (c == '7') {
    	cout << "Yes" << endl;
      return 0;
    }
  	cout << "No" << endl;
	return 0; 
}

Measured memory_bytes: 3592
#include<bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
using namespace std;

const int N = 1e5+10;
int a[N];

struct node{
    ll a,b;
    bool operator < (const node oth)const {
        return a+b < oth.a + oth.b;
    }
};
int main(){
    ll a;
    node cnode,tnode;
    cnode.a = 1LL<<60; cnode.b = 1LL<<60;
    cin >> a;
    for(ll i=1;i*i<=a;++i){
        if(a%i==0){
            tnode = (node){i,a/i};
            cnode = min(cnode,tnode);
        } 
    }
    cout << cnode.a + cnode.b  -2 << '\n';

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int T(int i,vector<int> C,vector<int> S,vector<int> F){
  int t = 0;
  while(i < C.size() - 1){
    if(t < S[i])t = S[i];
    while(t > S[i]){
      S[i] += F[i];
    }
    t = S[i] + C[i];
    i++;
  }
  return t;
}

int main(){
  int N;
  cin >> N;
  vector<int> C(N,0),S(N,0),F(N,0);
  for(int i = 0;i < N - 1;i++)cin >> C[i] >> S[i] >> F[i];
  for(int i = 0;i < N;i++)cout << T(i,C,S,F) << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(long long int i = 0; i < n; i++)
#define _rep(i, m, n) for(long long int i = m; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int N = 1000000;
const ll mod = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

ll gcd(ll A, ll B){
    if(B == 0)return A;
    return gcd(B, A % B);
}
ll lcm(ll A, ll B){
    return A * B / gcd(A, B);
}

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


int main(){
    ll a, b, c; cin >> a >> b >> c;
    int ans = 0;
    while(true){
        if(a % 2 != 0 or b % 2 != 0 or c % 2 != 0){
            cout << ans << endl;
            return 0;
        }
        if(a == b and b == c){
            cout << -1 << endl;
            return 0;
        }
        int d, e, f;
        d = b / 2 + c / 2;
        e = c / 2 + a / 2;
        f = a / 2 + b / 2;
        a = d, b = e, c = f;
        ans++;
    }
}

Measured memory_bytes: 256
A, B = map(int, input().split())
flag = False
for i in range(int(min(A, B)//0.08)-1000,int(max(A,B)//0.1)+1000):
    if int(i*0.08) == A and int(i*0.1) == B:
        flag = True
        ans = i
        break
if flag == True:
    print(ans)
else:
    print(-1)

Measured memory_bytes: 38768
#include<bits/stdc++.h>
using namespace std;
 
using lli = long long int;
using ll = long long;
using ld=long double;
 
 
int main(){
    string s;
    cin>>s;
    int n=s.length();
    int c01=0,c00=0,c10=0,c11=0;
    for(int i=0;i<n;i++){
        if(i%2==0){
            if(s[i]=='0')
            c00++;
            if(s[i]=='1')
            c01++;
        }
        if(i%2!=0){
            if(s[i]=='0')
            c10++;
            if(s[i]=='1')
            c11++;
        }
    }
    cout<<n-(max(c01,c11)+max(c00,c10));
    return 0;
}

Measured memory_bytes: 512
n = int(input())
a = list(map(int, input().split()))
a.sort()
ps = []
ms = []

cnt = 0
ans = 0
anss = []
for e in a:
  if e<0:
    cnt += 1
    ms.append(e)
  else:
    ps.append(e)
  ans += abs(e)
if cnt==n:
  ans += a[n-1]*2
elif cnt==0:
  ans -= a[0]*2
print(ans)

if cnt==0:
  cur = a[0]
  a.remove(cur)
  for i in range(n-2):
    print(cur, a[i])
    cur = cur-a[i]
  print(a[n-2], cur)
elif cnt==n:
  cur = a[n-1]
  a.remove(cur)
  for i in range(n-1):
    print(cur, a[i])
    cur = cur-a[i]
else:
  while len(ps)>1:
    t = ps.pop()
    print(ms[0], t)
    ms[0] -= t
  while len(ms):
    t = ms.pop()
    print(ps[0], t)
    ps[0] -= t

for e in anss:
  print(*e)


Measured memory_bytes: 14060
n, q = gets.chomp.split.map(&:to_i)
parent = (0...n).to_a
q.times{
    c, x, y = gets.chomp.split.map(&:to_i)

    px = x
    px = parent[px] while px != parent[px]
    py = y
    py = parent[py] while py != parent[py]

    case c
    when 0
        x, y = [px, py].minmax
        parent[y] = x
    when 1
        puts px == py ? "1" : "0"
    end
}



Measured memory_bytes: 6964
#include<iostream>
#include<algorithm>
#include<string>
#include<functional>
#include<utility>
#include<stack>
#include<queue>
#include<cmath>
#include<list>
#include<cstdint>
#include<vector>
#include<map>
#define rep(i,rept)	for(ll i = 0; i<rept;i++)
typedef long long ll;
using namespace std;
long long int a = 0, b = 0, c = 0,d=0, x = 0, y = 0, z = 0,n=0,m=0, maxy = 0, mini = 9999, counter = 0, s = 0, endp = 0, checker = 0;
std::vector <char> vec{}, vecsec{}, vecth{};
long long int iremono[1001][1001];
long long int iremono2[1001];
std::vector<unsigned long long int>kinds{}, ans{}, kaku{};
char moji, moji2;
bool okada = false, okada2 = false;
std::string output, output2, input, one, two;
char rev[100001];
unsigned long long int kakunou2[101][101] = {};
unsigned long long int M, A, R, C, H;

int ctoi(const char c) {
	if ('0' <= c && c <= '9') return (c - '0');
	return -1;
}
unsigned long long int LCM(unsigned long long int a, unsigned long long int b) {
	unsigned long long int i, j;
	i = a; j = b;
	while (true) {

		c = i % j;
		i = j;
		if (c != 0) {

			j = c;

		}
		else {
			break;
		}
	}
	return j * (a / j) * (b / j);
}
int kaizyo(int k) {
	int sum = 1;
	for (int i = 1; i <= k; ++i)
	{
		sum *= i;
	}
	return sum;
}
int main()
{
	cin >> input;
	rep(i, input.size()) {
		okada = true;
		counter = 0;
		rep(j, input.size() - i + 1) {
			if (okada) {
				
				if (input[i + j] == 'A' || input[i + j] == 'T' || input[i + j] == 'G' || input[i + j] == 'C') {
					counter++;
				}
				else {
					okada = false;
				}
			}
		}
		
		
		maxy = std::max(maxy, counter);
        
    }
	cout << maxy << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define db double
#define pii pair<int,int>
#define pli pair<ll,int>
#define pil pair<int,ll>
#define pll pair<ll,ll>
#define mat vector<vector<int>>
const int inf = 1 << 30;
const ll linf = 1e18;
const db EPS = 1e-7;
template<class T> void chmin(T& x, T y){if(x > y) x = y;}
template<class T> void chmax(T& x, T y){if(x < y) x = y;}


struct edge{
    int to, sil;
    ll cost;
};

struct node{
    int n, sil;
    ll cost;
    bool operator < (const node& n) const {
        return cost < n.cost;
    }
    
    bool operator > (const node& n) const {
        return cost > n.cost;
    }
};


int N, M, S;
ll d[60][6000];
vector<edge> G[60];
ll C[60], D[60];

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> N >> M >> S;
    for(int i = 0; i < M; i++){
        int U, V, A, B;
        cin >> U >> V >> A >> B;
        G[U].push_back(edge{V, A, B});
        G[V].push_back(edge{U, A, B});
    }
    for(int i = 1; i <= N; i++){
        cin >> C[i] >> D[i];
    }
    for(int i = 1; i <= N; i++){
        for(int j = 0; j <= 5010; j++){
            d[i][j] = linf;
        }
    }
    priority_queue<node, vector<node>, greater<node>> pq;
    pq.push(node{1, S, 0});
    d[1][min(S, 5001)] = 0;
    while(!pq.empty()){
        node n = pq.top();
        pq.pop();
        if(d[n.n][min(n.sil, 5001)] < n.cost) continue;
        int s = n.sil;
        if(s <= 5000){
            s += C[n.n];
            ll t = n.cost + D[n.n];
            chmin(s, 5001);
            if(d[n.n][s] > t){
                d[n.n][s] = t;
                pq.push(node{n.n, s, t});
            }
        }
        for(auto u : G[n.n]){
            int si = n.sil - u.sil;
            ll co = n.cost + u.cost;
            if(si >= 0 && d[u.to][min(si, 5001)] > co){
                d[u.to][min(si, 5001)] = co;
                pq.push(node{u.to, si, co});
            }
        }
    }
    for(int i = 2; i <= N; i++){
        ll ans = linf;
        for(int j = 0; j <= 5001; j++){
            chmin(ans, d[i][j]);
        }
        cout << ans << endl;
    }
    return 0;
}

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

#define MAX_NUM (1000000000 + 7)

typedef uint64_t u64;
typedef int64_t i64;
typedef uint32_t u32;
typedef int32_t i32;

using namespace std;

template <typename T>
static inline void ArrayInput(vector<T>& A) {
  for (auto itr = A.begin(); itr < A.end(); ++itr) cin >> *itr;
}

template <typename T>
static inline void ArrayPut(const vector<T>& A) {
  for (auto itr = A.begin(); itr < A.end(); ++itr) cout << *itr << " ";
  cout << endl;
}

bool Sec_compare(pair<uint64_t, uint64_t> a, pair<uint64_t, uint64_t> b) {
  if (a.second != b.second) {
    return a.second < b.second;
  } else {
    return a.first < b.first;
  }
}

u64 dec_dig(u64 num) {
  u64 res = 0;
  while (num > 0) {
    num /= 10;
    ++res;
  }
  return res;
}

u64 gcd(u64 a, u64 b) {
  if (a < b) {
    a ^= b;
    b ^= a;
    a ^= b;
  }

  return b ? gcd(b, a % b) : a;
}

int main() {
  cout << setprecision(18);
  u32 N, M;
  cin >> N >> M;

  cout << ((N * (N - 1)) / 2) + ((M * (M - 1)) / 2) << endl;

  return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<list>
#include<map>
#include<algorithm>

using namespace std;

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

    long long li2 = 2;
    long long li1 = 1;
    long long li = 1;

    for (int i = 2; i <= n; i++) {
        li = li1 + li2;
        li2 = li1;
        li1 = li;
    }

    cout << li << endl;

    return 0;
}



Measured memory_bytes: 256
import java.util.Scanner;

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

        String t = sc.next();

        for(int i=0; i<t.length(); i++){
            if(t.charAt(i) == '?'){
                System.out.print('D');
            }
            else{
                System.out.print(t.charAt(i));
            }
        }
        System.out.println("");
    }
}

Measured memory_bytes: 58044
#include<iostream>
using namespace std;
int W,H;
int t[20][20];
int c;
char ch;

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

bool inField(int y,int x){
  if( 0<=y && y<H && 0<=x && x<W ){
    return true;
  }else{
    return false;
  }
}

void visit(int y,int x){
  c++;
  t[y][x]=1;
  for(int i=0;i<4;i++){
    int ny=y+dy[i];
    int nx=x+dx[i];
    if( inField(ny,nx) && t[ny][nx]==0){
      visit(ny,nx);
    }
  }
}
int main(){
  while(1){
    cin>>W>>H;
    if(W==0&&H==0)break;
    int sy,sx;
    for(int i=0;i<H;i++){
      for(int j=0;j<W;j++){
        cin>>ch;
        if(ch=='.'){
          t[i][j]=0;
        }
        if(ch=='@'){
          sy=i;
          sx=j;
        }
        if(ch=='#'){
          t[i][j]=-1;
        }
      }
    }
    c=0;
    visit(sy,sx);
    cout<<c<<endl;
  }
  return 0; 
}




Measured memory_bytes: 3108
import java.io.*;
import java.util.*;
//import java.util.stream.*;
//import java.math.*;

public class Main {

    public static void main(String[] args) throws IOException {

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int x = sc.nextInt();
        long sum = 0, diff;
        int array[] = new int[n];
        for (int i = 0; i < n; i++) {
            array[i] = sc.nextInt();
        }
        if (array[0] > x) {
            sum += array[0] - x;
            array[0] -= array[0] - x;
        }
        for (int i = 1; i < n; i++) {
            diff = array[i] + array[i - 1] - x;
            if (diff > 0) {
                sum += diff;
                array[i] -= diff;
            }
        }
        System.out.println(sum);
        bw.flush();
    }
}


Measured memory_bytes: 52540
#include <bits/stdc++.h>
/*
#include<algorithm>
#include<array>
#include<cassert>
#include<cmath>
#include<cstdlib>
#include<functional>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<typeinfo>
#include<utility>
#include<vector>
*/
#define int long long int
#define double long double
using namespace std;
#define MOD 1000000007
#define INF 1000000000000000007
const int MAX_N = 1 << 17;
#define REP(i, n) for (int(i) = 0, i##_len = (n); (i) < i##_len; (i)++)
#define REPS(i, x) for (int(i) = 1; (i) <= (int)(x); (i)++)
#define RREP(i, x) for (int(i) = ((int)(x)-1); (i) >= 0; (i)--)
#define RREPS(i, x) for (int(i) = ((int)(x)); (i) > 0; (i)--)
#define FOR(i, a, b) for (int(i) = (a); (i) < (b); (i)++)
#define pb push_back
#define mp make_pair
#define BIT(n) ((int)(1) << (n))
#define ALL(x) (x).begin(), (x).end()
#define debug(x) std::cout << #x << ": " << (x) << std::endl
#define nint int
using namespace std;

int dy[] = {0, 0, 1, -1, 0};
int dx[] = {1, -1, 0, 0, 0};
typedef pair<int, int> pii;
typedef pair<double, double> dop;
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;
}
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
struct aaa {
    aaa()
    {
        cin.tie(0);
        ios::sync_with_stdio(0);
        cout << fixed << setprecision(20);
    };
} aaaaaaa;


signed main()
{
    int n;
    cin >> n;
    int sum = 0;
    for (int i = 1; i <= n; i++) {
        if (i % 5 != 0 && i % 3 != 0) {
            sum += i;
        }
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 3584
A=[list(map(int,input().split())) for _ in range(3)]
N=int(input())
bn=[int(input()) for _ in range(N)]
ans=False
for ver in zip(*A):
    if all(item in bn for item in ver):
        ans=True
for wide in A:
    if all(item in bn for item in wide):
        ans=True
if all(A[i][i] in bn for i in range(3)):
    ans=True
if all(A[i][3-i-1] in bn for i in range(3)):
    ans=True
if ans==True:
    print("Yes")
else:
    print("No")

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

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using WGraph = vector<vector<pair<int, ll>>>;

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

constexpr int dx[4] = {-1, 0, 0, 1}, dy[4] = {0, -1, 1, 0};
constexpr int INF = 1e9;
constexpr int MOD = 1e9 + 7;
constexpr long long LINF = 1e18;
constexpr double EPS = 1e-10;
constexpr double PI = M_PI;

void solve() {
    int H, W, K, x1, y1, x2, y2;
    cin >> H >> W >> K >> x1 >> y1 >> x2 >> y2;
    --x1, --y1, --x2, --y2;
    vector<string> pond(H);
    for (int i=0; i<H; ++i) cin >> pond[i];

    vector<vector<ll>> dis(H, vector<ll>(W, LINF));
    dis[x1][y1] = 0;
    queue<pair<int, int>> que;
    que.push({x1, y1});
    while (!que.empty()) {
        auto p = que.front(); que.pop();
        int x = p.first, y = p.second, d = dis[p.first][p.second];
        if (x == x2 && y == y2) break;
        for (int j=0; j<4; ++j) {
            for (int i=1; i<=K; ++i) {
                int nx = x + dx[j] * i, ny = y + dy[j] * i;
                if (nx < 0 || nx >= H || ny < 0 || ny >= W || pond[nx][ny] == '@') break;
                if (dis[nx][ny] <= d) break;
                if (d + 1 < dis[nx][ny]) {
                    dis[nx][ny] = d + 1;
                    que.push({nx, ny});
                }
            }
        }
    }
    cout << (dis[x2][y2] == LINF ? -1 : dis[x2][y2]) << '\n';
}

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

    solve();

    return 0;
}


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

typedef long long ll;


int main()
{
    string s;
    cin >> s;
    int cnt = 0;

    for (int i = 0; i < s.size(); i++) {
        if (s[i] == 'o') cnt++;
    }
    if (cnt + (15-int(s.size())) >= 8) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}


Measured memory_bytes: 256