akhauriyash/Code-Regression huggingface dataset:
#pragma region include
#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <iterator>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <tuple>
#include <bitset>

#include <queue>
#include <complex>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <fstream>
#include <random>
//#include <time.h>
#include <ctime>
#pragma endregion //#include
/////////
#define REP(i, x, n) for(int i = x; i < n; ++i)
#define rep(i,n) REP(i,0,n)
#define ALL(X) X.begin(), X.end()
/////////
#pragma region typedef
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
typedef std::pair<LL,LL> PLL;//
typedef std::pair<int,int> PII;//
#pragma endregion //typedef
////定数
const int INF = (int)1e9;
const LL MOD = (LL)1e9+7;
const LL LINF = (LL)4e18+20;
const LD PI = acos(-1.0);
const double EPS = 1e-9;
/////////
using namespace::std;

void solve(){
	int N;
	cin >> N;
	int temp = N;
	int res = 0;
	while(temp){
		res += temp%10;
		temp /= 10;
	}
	if( N%res == 0){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}
}

#pragma region main
signed main(void){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	

	solve();
}
#pragma endregion //main()

Measured memory_bytes: 384
#include <stdio.h>

#define N 30

/** Application main entry point. */
int main (
  int     argc,
  char  * argv[ ]
  )
{
  int h[ N + 1 ] = { 0 };
  int i;

  for ( i = 0; i < 28; ++i )
  {
    int t;

    scanf ( "%d", &t );
    h[ t ] = 1;
  }

  for ( i = 1; i <= N; ++i )
  {
    if ( !h[ i ] )
    {
      printf ( "%d\n", i );
    }
  }

  return ( 0 );
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define ll long long
#define FAST cin.tie(0)->sync_with_stdio(0);cout.tie(0)->sync_with_stdio(0);
using namespace std;

map<ll,ll> dp;
ll N,a,b,c,d;
ll solve_dp(ll n)
{
    if(n==0) return 0;
    if(n==1) return d;
    if(dp.find(n)!=dp.end()) return dp[n];
    ll x,y,z,w=(ll)1e18,yr,zr,xr;
    x=d*(n%2)+solve_dp(n/2)+a;
    xr=d*(2-n%2)+solve_dp((n+1)/2)+a;
    y=d*(n%3)+solve_dp(n/3)+b;
    yr=d*(3-n%3)+solve_dp((n+2)/3)+b;
    z=d*(n%5)+solve_dp(n/5)+c;
    zr=d*(5-n%5)+solve_dp((n+4)/5)+c;
    if(n<(ll)1e18/d) w=d*n;
    return dp[n]=min(min(min(x,y),min(z,w)),min(min(xr,yr),zr));
}
void solve()
{
    dp.clear();
    cin>>N>>a>>b>>c>>d;
    cout<<solve_dp(N)<<endl;
}
int main() {
    FAST
    int t;cin>>t;
    while(t--) solve();
}


Measured memory_bytes: 4408
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;

template<class T> struct FordFulkerson {
  struct Edge { int to, rev; T cap; };
  const T inf = numeric_limits<T>::max();
  const int n;
  VV<Edge> g;
  V<bool> used;
  FordFulkerson(int n) : n(n), g(n), used(n) {}
  void add_edge(int from, int to, T cap) {
    assert(from != to);
    assert(cap >= 0);
    if (!cap) return;
    g[from].emplace_back(Edge{to, (int)g[to].size(), cap});
    g[to].emplace_back(Edge{from, (int)g[from].size() - 1, 0});
  }
  T dfs(int v, int t, T f) {
    if (v == t) return f;
    used[v] = true;
    for (auto&& e : g[v]) {
      if (used[e.to] or !e.cap) continue;
      T d = dfs(e.to, t, min(f, e.cap));
      if (d > 0) {
        e.cap -= d;
        g[e.to][e.rev].cap += d;
        return d;
      }
    }
    return 0;
  }
  T max_flow(int s, int t) {
    assert(s != t);
    T res = 0;
    while (true) {
      fill(begin(used), end(used), false);
      T f = dfs(s, t, inf);
      if (f == 0) return res;
      res += f;
    }
  }
};

struct UnionFind {
  const int n;
  V<> t; // root ? -sz : par
  UnionFind(int n) : n(n), t(n, -1) {}
  int find(int v) { return t[v] < 0 ? v : t[v] = find(t[v]); }
  void unite(int u, int v) {
    if ((u = find(u)) == (v = find(v))) return;
    if (-t[u] < -t[v]) swap(u, v);
    t[u] += t[v];
    t[v] = u;
  }
  bool same(int u, int v) { return find(u) == find(v); }
  int size(int v) { return -t[find(v)]; }
};

int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);
  int n, m; cin >> n >> m;
  V<> x(m), y(m);
  for (int i = 0; i < m; ++i) {
    cin >> x[i] >> y[i], --x[i], --y[i];
  }

  auto mn = [&]() -> int {
    UnionFind uf(m);
    for (int i = 0; i < m; ++i) for (int j = 0; j < m; ++j) {
      if (x[i] != x[j] and y[i] != y[j]) continue;
      uf.unite(i, j);
    }
    set<int> se;
    for (int i = 0; i < m; ++i) {
      se.insert(uf.find(i));
    }
    return se.size();
  };

  auto mx = [&]() -> int {
    int S = 2 * n, T = S + 1;
    FordFulkerson<int> g(T + 1);
    for (int r = 0; r < n; ++r) {
      g.add_edge(S, r, 1);
    }
    for (int c = 0; c < n; ++c) {
      g.add_edge(n + c, T, 1);
    }
    for (int i = 0; i < m; ++i) {
      g.add_edge(x[i], n + y[i], 1);
    }
    return g.max_flow(S, T);
  };

  cout << m - mx() << ' ' << m - mn() << '\n';
}


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

using namespace std;

typedef long long int ll;
typedef pair<ll, ll> pll;

#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll) 1e15;

ll A[505][505];

struct Data {
    pll a, b;
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll H, W;
    cin >> H >> W;
    REP(i, H) {
        REP(j, W) {
            cin >> A[i][j];
        }
    }

    vector<Data> v;
    REP(i, H) {
        REP(j, W) {
            if (A[i][j] % 2 == 0)
                continue;
            pll nxt = pll(i + 1, j + 2);
            if (nxt.second > W)
                nxt = pll(i + 2, j + 1);
            if (nxt.first > H)
                break;
            Data d;
            d.a = pll(i + 1, j + 1);
            d.b = nxt;
            v.push_back(d);
            A[nxt.first - 1][nxt.second - 1]++;
        }
    }
    cout << v.size() << endl;
    REP(i, v.size()) {
        cout << v[i].a.first << " " << v[i].a.second << " " << v[i].b.first << " " << v[i].b.second << endl;
    }
    return 0;
}

Measured memory_bytes: 8432
#include <iostream>

using namespace std;

int main(){
    int n;
    cin >> n;
    int ans=100000;
    for(int i=1;i<=n/2;i++){
        int a=i;
        int b=n-i;
        int sum=0;
        for(;a>0;a/=10){
            sum+=a%10;
        }
//        cout <<sum<<endl;
        for(;b>0;b/=10){
            sum+=b%10;
        }
        ans=min(ans,sum);
    }
    cout <<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,b) for(ll i=ll(a);i<ll(b);i++)
#define irep(i,a,b) for(ll i=ll(a);i>=ll(b);i--)
#define pb push_back
#define mp make_pair
#define F .first
#define S .second 
using ll=long long;
using ld=long double;
using namespace std;
const ll mod=1e9+7;

int main(){
  ll n;
  cin>>n;
  cout<<n*n;
}

Measured memory_bytes: 256
#pragma GCC optimize(3, "Ofast", "inline")
#include <bits/stdc++.h>
using namespace std;
   
typedef long long ll;
const int N = 200010;
const ll mod = 1e9 + 7;
 
int main()
{
    int a, b;
    cin >> a >> b;
    int p, ans = (int)2e9;
    p = b - a;
    if (p >= 0) ans = min(ans, p);
    p = b + a + 1;
    if (p >= 0) ans = min(ans, p);
    p = -b - a + 1;
    if (p >= 0) ans = min(ans, p);
    p = -b + a + 2;
    if (p >= 0) ans = min(ans, p);
    printf("%d\n", ans);
    return 0;
}

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

const int maxn=1e5+100;

int dp[3*maxn],n;
vector <int> v;

int main(){
	scanf("%d",&n);
	v.push_back(1);
	for(int i=6;i<maxn;i*=6) v.push_back(i);
	for(int i=9;i<maxn;i*=9) v.push_back(i);
	for(int i=0;i<3*maxn;i++) dp[i]=1e9+10;
	dp[0]=0;
	for(int i=0;i<maxn;i++){
		for(int j=0;j<v.size();j++){
			int m=i+v[j];
			if(dp[m]>dp[i]+1){
				dp[m]=dp[i]+1;
			}
		}
	}
	cout<<dp[n]<<endl;
	return 0;
}

Measured memory_bytes: 1408
/*

*/
#include <bits/stdc++.h>
using namespace std;
#define pi acos(-1.0)
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);cout << setprecision(12)
#define rep(i,a,n) for (ll i=a;i<n;i++)
#define per(i,a,n) for (ll i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((ll)(x).size())
#define cin1(x) cin >> x
#define cin2(x, y) cin >> x >> y
#define cin3(x, y, z) cin >> x >> y >> z
#define cin4(x, y, z, _) cin >> x >> y >> z >> _
#define cin5(x, y, z, p, q) cin >> x >> y >> z >> p >> q
#define cou(x) cout << x
#define cous(x) cout << x << " "
#define coul(x) cout << x << "\n"
#define ret(x) return x
#define MAX 5000001
#define start int main() {   fastio
#define finish ret(0); }
#define Test ll _t; cin1(_t); rep(w, 0, _t)
#define minv(v) *min_element(v.begin(),v.end())
#define maxv(v) *max_element(v.begin(),v.end())
#define cntv(v,a) count(v.begin(),v.end(),a)
struct point{    int x, y, ind;   char ch;  };
typedef long long ll;
typedef vector<ll> VI;
typedef pair<ll,ll> PII;
typedef double db;
//mt19937 mrand(random_device{}());
const ll mod=1000000007;
//ll rnd(ll x) { return mrand() % x;}
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}ret(res);}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
ll fact[13];
void factorial() {   fact[0]=1;  rep(i, 1, 12) fact[i]=(fact[i-1]*i);  }
vector <ll> sie; //for sieve function
ll spf[MAX+7];  //for sieve function
void sieve() {    rep(i, 2, MAX)  {  if (spf[i] == 0) {  spf[i] = i;   sie.pb(i);  }    for (ll j=0; j<SZ(sie) && i*sie[j] <= MAX && sie[j] <= spf[i]; j++)   spf[i * sie[j]] = sie[j]; }   }
bool cmp(point A, point B){   if(A.x != B.x) ret(A.x < B.x);  ret(A.y < B.y);   }
// head collected
// Don't use variable name as --> prev, time, _t, w, y1

ll x, y;

start;
    cin2(x, y);
    coul(x+y/2);
finish



/*



2 5 4 8 7 3 2 9 6
3 8 6 5 9 2 7 1 4
7 2 9 6 4 1 8 3 5
8 2 3 7 2 5 1 4 9
9 7 5 3 1 4 6 2 8
4 1 2 9 6 8 3 5 7
6 3 2 4 5 7 9 8 2
5 9 8 2 3 6 4 7 1
2 4 7 1 8 9 5 6 3






*/







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

// 総数を1000000007で割った余り
const long long mod = 1e9 + 7;

using ll  = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }

int func(long long n, std::vector<long long> a) {
    // cout << fixed << setprecision(5);

    // 累積和
    // 左右の端の場合はそのまま記録
    // それ以降のは2つの値のgcdを求めていく
    vll left(n + 1), right(n + 1);
    left[1]  = a[0];
    right[1] = a[n - 1];
    // なぜ１から入れているのか？
    // 累積和はleft[0]に0を入れることが重要な項目の一つ。
    // これは累積和の0と0の差分を取る時に必要となる。
    // なのでleft[1]にa[0]を right[1]にa[n-1]を代入している。
    rep(i, n) {
        left[i + 1]  = gcd(left[i], a[i]);
        right[i + 1] = gcd(right[i], a[n - 1 - i]);
    }

    ll ans = left[n];  //全体の最大公約数
    // ll ans = right[n];  //全体の最大公約数
    // 累積和はsum[i+1]=sum[i]+a[i]が基本
    // 	配列 a に対して累積和 s を求めると、配列 a の区間 [left, right) の総和が
    // s[right] - s[left]
    // で O(1) で求められる
    rep(i, n) {
        ll res;
        if (i == 0)  //左端
            res = right[n - 1];
        else if (i == n - 1)  //右端
            res = left[n - 1];
        else
            res = gcd(left[i], right[n - 1 - i]);
        ans = max(ans, res);
    }
    cout << ans << endl;

    return 0;
}

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

    long long N;
    scanf("%lld", &N);
    std::vector<long long> A(N);
    for (int i = 0; i < N; i++) {
        scanf("%lld", &A[i]);
    }
    func(N, std::move(A));
    return 0;
}


Measured memory_bytes: 2560
#include<iostream>//AT2652
#include<cstdio>
#include<cstring>
#include<string>
#include<iomanip>
#include <algorithm>
#include<cmath>
#include<vector>
#include<set>
using namespace std;
int main()
{
	int m,n;
	cin>>m>>n;
	if(m%3==0||n%3==0||(m+n)%3==0)cout<<"Possible";
	else cout<<"Impossible";
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ld double
#define ll long long
#define pb emplace_back
#define mk make_pair
#define mod 1000000007
#define ff first
#define ss second
#define sz(x) (int)x.size()
#define FIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define all(x) x.begin(),x.end()
ll power(ll a, ll b) {ll res = 1; a = a % mod; while (b) {if (b & 1)res = (res * a) % mod; a = (a * a) % mod; b /= 2;} return res;}
ll invmod(ll a) {return power(a, mod - 2);}
int main(void)
{
	FIO
	int t = 1;
	// cin >> t;
	while (t--)
	{
		int a, b;
		cin >> a >> b;
		cout << a*b << '\n';
	}
	return 0;
}

Measured memory_bytes: 3472
#include <iostream>
#include <string>
using namespace std;
int main() {
	string s;
	cin >> s;

	char ch[2] = { 0 };

	int a, b, c, d;

	ch[0] = s[0];
	a = atoi(ch);
	ch[0] = s[1];
	b = atoi(ch);
	ch[0] = s[2];
	c = atoi(ch);
	ch[0] = s[3];
	d = atoi(ch);
//	cout << a << " " << b << " " << c << " " << d;

	string op1 = "+";
	string op2 = "+";
	string op3 = "+";
	if (7 == a + b + c + d) {
	}
	else if (7 == a + b + c - d) {
		op3 = "-";
	}
	else if (7 == a + b - c - d) {
		op2 = "-";
		op3 = "-";
	}
	else if (7 == a - b + c - d) {
		op1 = "-";
		op3 = "-";
	}
	else if (7 == a - b - c - d) {
		op1 = "-";
		op2 = "-";
		op3 = "-";
	}
	else if (7 == a + b - c + d) {
		op2 = "-";
	}
	else if (7 == a - b - c + d) {
		op1 = "-";
		op2 = "-";
	}
	else if (7 == a - b + c + d) {
		op1 = "-";
	}

	cout << a << op1 << b << op2 << c << op3 << d << "=7" << endl;

	return 0;
}

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

using namespace std;
typedef long long int ll;
typedef pair<ll, ll > pi;  
typedef pair<pair<ll, ll >, ll > pii;  
vector<ll > vec;
vector<vector<ll > > vec2;
ll MOD = 1000000007;
ll INF = 1145141919454519;

ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b){return a/gcd(a,b)*b;}

int main() {

    ll A, B;
    cin >> A >> B;
    
    cout << lcm(A, B) << endl;
    

}

Measured memory_bytes: 256
from collections import Counter as C
N = int(input())
P=[]
M=[]
for i in range(N):
    a, b = map(int, input().split(" "))
    a += 2**35*3
    P.append (a+b)
    M.append (a-b)

k=P[0] % 2
if len(C([p%2 for p in P])) > 1:
    print (-1) 
else: 
    print (33-k)
    print (["1 ",""][k] + " ".join([str(2**i) for i in range(32)]))
    for i in range(N):
        a=bin(P[i])[6:]
        b=bin(M[i])[6:]
        print(''.join(['LDUR'[::[1,-1][i==0]][(int(a[i])*2+int(b[i]))] for i in range(33-k)])[::-1])

Measured memory_bytes: 3564
#include<stdio.h>
#include<iostream>
#include<vector>
#include<math.h>
#include<queue>
#include<map>
#include<algorithm>
#include<string.h>
#include<functional>
#include<limits.h>
#include<stdlib.h>
#include<cmath>
#include<cstring>
#include<set>
#include<climits>
using namespace std;

#define intmax INT_MAX
#define lmax LONG_MAX
#define uintmax UINT_MAX
#define ulmax ULONG_MAX
#define llmax LLONG_MAX
#define ll long long
#define rep(i,a,N) for((i)=(a);(i)<(N);(i)++)
#define rrp(i,N,a) for((i)=(N)-1;(i)>=(a);(i)--)
#define llfor ll i,j
#define sc(a) cin>>a
#define pr(a) cout<<a<<endl
#define pY puts("YES")
#define pN puts("NO")
#define py puts("Yes")
#define pn puts("No")
#define pnn printf("\n")
#define all(a) a.begin(),a.end()
//#define push(a,b) (a).push_back(b)
#define llvec vector<vector<ll>>
#define charvec vector<vector<char>>
#define size(a,b) (a,vector<ll>(b))
#define llpvec vector<pair<ll,ll>>
/*pi*/double pi=acos(-1);
/*繰り上げ除算*/ll cei(ll x,ll y){ll ans=x/y;if(x%y!=0)ans++;return ans;}
/*最大公約数*/ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}
/*最小公倍数*/ll lcm(ll x,ll y){return x/gcd(x,y)*y;}
/*n乗*/ll llpow(ll x,ll n){ll i,ans=1;rep(i,0,n)ans*=x;return ans;}
/*階乗*/ll fact(ll x){ll i,ans=1;rep(i,0,x)ans*=(x-i);return ans;}
/*nCr*/ll ncr(ll n,ll r){return fact(n)/fact(r)/fact(n-r);}
/*nPr*/ll npr(ll n,ll r){return fact(n)/fact(n-r);}
/*primejudge*/bool prime(ll a){if(a<=1)return false;ll i;for(i=2;i*i<=a;i++){if(a%i==0)return false;}return true;}
/*Fibonacci数列*/ll fib(ll x){ll i,fibo[x+10];fibo[0]=1;fibo[1]=1;fibo[2]=1;rep(i,3,x+1)fibo[i]=fibo[i-1]+fibo[i-2];return fibo[x];}
/*桁数*/ll dig(ll n){ll d=0,i=0;while(n/10>0){i++;d++;}return d;}
/*迷路移動*/const int dx[4]={1,0,-1,0};const int dy[4]={0,1,0,-1};
llfor;//ll ans=0;////////////////////////////////////////////////////////////
int main(){
 ll h,w;
 char s[30][30];
 cin>>h>>w;
 rep(i,0,h){
  rep(j,0,w){
   cin>>s[i][j];
  }
 }
 queue<ll>quex,quey;
 
 ll ans=0,x,y;
 ll u,v,k;
 bool visited[h][w];
 ll num[h][w];
 rep(i,0,h){
  rep(j,0,w){//スタート地点を決める
   if(s[i][j]=='#')continue;
   rep(x,0,h){
    rep(y,0,w){
     visited[x][y]=false;
     num[x][y]=0;
    }
   }
   quex.push(i);
   quey.push(j);
   visited[i][j]=true;
   while(!quex.empty()){
    u=quex.front();
    v=quey.front();
    quex.pop();quey.pop();
    rep(k,0,4){
     x=u+dx[k];
     y=v+dy[k];
     if(x>=h||y>=w||x<0||y<0)continue;
     if(visited[x][y]||s[x][y]=='#')continue;
     num[x][y]=num[u][v]+1;
     ans=max(ans,num[x][y]);
     //cout<<i<<" "<<j<<" "<<x<<" "<<y<<" "<<ans<<endl;
     visited[x][y]=true;
     quex.push(x);
     quey.push(y);
    }
     
   }
  }
 }
 pr(ans);
 return 0;}

Measured memory_bytes: 3612
import java.util.ArrayDeque

fun main() {
    val inf = Int.MAX_VALUE
    val d = arrayOf(0, 1, 0, -1)

    val (h, w) = readLine()!!.split(' ').map { it.toInt() }
    val (ch, cw) = readLine()!!.split(' ').map { it.toInt() - 1 }
    val (dh, dw) = readLine()!!.split(' ').map { it.toInt() - 1 }
    val grid = (0 until h).map { readLine()!!.toCharArray() }.toTypedArray()

    val visited = Array(h) { IntArray(w) { inf } }
    val deque = ArrayDeque<Pair<Int, Int>>()
    deque.add(ch to cw)
    visited[ch][cw] = 0

    while (deque.isNotEmpty()) {
        val (ih, iw) = deque.removeFirst()

        for (i in 0 until 4) {
            val jh = ih + d[i]
            val jw = iw + d[i xor 1]

            if (jh !in 0 until h || jw !in 0 until w) continue
            if (grid[jh][jw] == '#') continue
            if (visited[jh][jw] <= visited[ih][iw]) continue

            visited[jh][jw] = visited[ih][iw]
            deque.addFirst(jh to jw)
        }

        for (i in -2..2) {
            for (j in -2..2) {
                val jh = ih + i
                val jw = iw + j
                if (jh !in 0 until h || jw !in 0 until w) continue
                if (grid[jh][jw] == '#') continue
                if (visited[jh][jw] <= visited[ih][iw]) continue

                visited[jh][jw] = visited[ih][iw] + 1
                deque.addLast(jh to jw)
            }
        }

    }

    println(if (visited[dh][dw] == inf) -1 else visited[dh][dw])
}


Measured memory_bytes: 97428
#include <iostream>
#include <vector>

template <typename T>
auto move (T & a, int & x , int & y) -> bool
{
    while (true)
    {
        switch (a [y] [x])
        {
        case '>' :
            a [y] [x] = 'x';
            ++ x;
            break;
        case '<' :
            a [y] [x] = 'x';
            -- x;
            break;
        case '^' :
            a [y] [x] = 'x';
            -- y;
            break;
        case 'v' :
            a [y] [x] = 'x';
            ++ y;
            break;
        case '.' :
            return true;
        case 'x' :
            return false;
        }
    }
}

auto main () -> int
{
    int h , w;
    while (std::cin >> h >> w && h && w)
    {
        std::vector <std::vector <char>> a (h , std::vector <char> (w));
        for (auto && line : a)
        {
            for (auto && elem : line)
            {
                std::cin >> elem;
            }
        }

        int x = 0 , y = 0;
        if (move (a , x , y))
        {
            std::cout << x << ' ' << y << std::endl;
        }
        else
        {
            std::cout << "LOOP" << std::endl;
        }
    }
}

Measured memory_bytes: 3100
using System;
using System.Collections.Generic;
using System.Linq;

namespace ziyuutyou
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);

            if (N[1] % N[0] == 0)
            {
                Console.WriteLine(N[0] + N[1]);
            }
            else
            {
                Console.WriteLine(N[1] - N[0]);
            }
        }
    }
}


Measured memory_bytes: 13140
#include<bits/stdc++.h>
using namespace std;
int main(void){
  int n,m,WA[100000];
  bool AC[100000];
  int ACnum=0,WAnum=0;
  cin>>n>>m;
  for(int i=0;i<n;i++){
    WA[i]=0;
    AC[i]=false;
  }
  while(m--){
    int p;
    string str;
    cin>>p>>str;
    if(AC[p]){
      continue;
    }
    if(str=="AC"){
      AC[p]=true;
      ++ACnum;
      WAnum+=WA[p];
    }else if(str=="WA"){
      ++WA[p];
    }
  }
  printf("%d %d\n",ACnum,WAnum);
  return 0;
}

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

#ifdef LOCAL
    #define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
        #define eprintf(...) 42
#endif

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define all(x) (x).begin(),(x).end()
#define foreach(u,v) for(auto (u) : (v))
#define pb push_back
#define mp make_pair
#define mt make_tuple

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

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

/*
*/

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

  vi t(n+2, 0), v(n+2, 0);
  repi(i, 1, n+1){
    cin >> t[i];
    t[i] *= 2;
    t[i] += t[i-1];
  }
  t[n+1] = t[n];

  repi(i, 1, n+1){
    cin >> v[i];
    v[i] *= 2;
  }
  v[n+1] = 0;

  double ans = 0;
  int T = 0, V = 0;
  while(T < t[n]){
    int i;
    for(i = 1; i <= n; i++){
      if(t[i-1] <= T and T < t[i]) break;
    }

    int nextV = min(V+1, v[i]);
    repi(j, i, n+1){
      int tmp = v[j+1] + (t[j]-T-1);
      nextV = min(nextV, tmp);
    }

    ans += (V+nextV)/2.0/4.0;
//    printf("T: %d, i: %d, V: %d, nextV: %d, ans: %.3f\n", T, i, V, nextV, ans);
    V = nextV;
    T++;
  }

  printf("%.6f\n", ans);

  return 0;
}


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

using namespace std;

const int mod = 1e9 + 7;

long long add(long long a, long long b) {
    long long res = a + b;
    if (res >= mod) res -= mod;
    return res;
}

long long sub(long long a, long long b) {
    long long res = a - b + mod;
    if (res >= mod) res -= mod;
    return res;
}

long long mul(long long a, long long b) {
    return (((a % mod) * (b % mod)) % mod);
}

long long gcd(long long x, long long y){
    if(y == 0){
        return x;
    }
    if(x > y){
         return gcd(y, x % y);
    }
    else{
         return gcd(x, y % x);
    }
}

/*bool good(vector<int> &v, int d, int mid){
    vector<int> p(v.size());
    p[0] = v[0] - mid;
    for(int i = 1;i < v.size();i++){
        p[i] = p[i - 1] + (v[i] - mid);
    }
    vector<int> m(v.size());
    m[0] = p[0];
    int mi = m[0];
    for(int i = 1;i < v.size();i++){
        mi = min(mi, p[i]);
        m[i] = mi;
    }
    for(int r = 0;r < v.size();r++){
        if(r - d > 0){
            if(m[r - d - 1] <= p[r]){
                L = r - d;
                R = r;
                return true;
            }
        }
    }
    return false;
}*/

int main(){
    double d, t, s;
    cin >> d >> t >> s;
    if(d / s <= t){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
     }















    /*int n, d;
    cin >> n >> d;
    vector<int> v(n);
    for(int i = 0;i < n;i++){
        cin >> v[i];
    }
    int l = -1,
        r = 101;
    while(r > l + 1){
        int mid = (l + r) / 2;
        if(good(v, d, mid)){
            l = mid;
        }
        else{
            r = mid;
        }
    }
    cout << L + 1 << " " << R + 1<< endl;
    cout << l << endl;*/
}
/*
5 2
-1 -2 -3 4 5
2 3
4

-3 -2 -1 4 5
2 3
5 + (-3) = 2
4 + -2 = 2
ans = 4

-3 -2 -1 4 5
3 2
5 + -3 = 2
4 + -1 = 3
ans = 5
*/


Measured memory_bytes: 3736
using System;

namespace ConsoleApplicationSample
{
    class Program
    {
        static void Main(string[] args)
        {
            int height, weight;
            string[] str = new string[2];

            while (true)
            {
                str = Console.ReadLine().Split(' ');
                height = int.Parse(str[0]);
                weight = int.Parse(str[1]);

                if (0 == height && 0 == weight) break;

                for (int i = 0; i < height; i++)
                {
                    for (int j = 0; j < weight; j++)
                    {
                        if ((0 != i && height-1 != i) && (0 != j && weight-1 != j))
                        {
                            Console.Write(".");
                        }
                        else
                        {
                            Console.Write("#");
                        }
                    }
                    Console.WriteLine("");
                }
                Console.WriteLine("");
            }
        }
    }

}

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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void solve() {
    ll A, B, N;
    cin >> A >> B >> N;
    auto f = [&](ll x) {
        return (A * x) / B - A * (x / B);
    };
    cout << f(min(B - 1, N)) << '\n';
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
    return 0;
}


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

const int N = 5e5 + 10;

int a[N];

int main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int n;
	cin >> n;
	int cnt = 1, ans = 0;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		if(a[i] == cnt)
			cnt++;
		else
			ans++;
	}
	if(ans == n)
			cout << -1 << endl;
	else
			cout << ans << endl;
}

Measured memory_bytes: 1024
import sys

def main():
    N, Y = map(int, sys.stdin.readline().rstrip().split())

    for n in range(Y//10000+1):
        for m in range((Y-n*10000)//5000+1):
            l = N - n - m
            if l >= 0 and n*10000 + m*5000 + l*1000 == Y:
                print(n, m, l)
                return
    
    print(-1, -1, -1)


if __name__ == '__main__':
    main()

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

using namespace std;
int N,W;
long long w[105];
long long v[105];
long long dp[1000005];
int main() {
    cin >> N >> W; // n:总钱数 m:希望购买的物品数量
    memset(dp, 0, sizeof(dp));
    for (int i = 1; i <= N; ++i) {
        cin >> w[i] >> v[i];
    }
    for (int i = 1; i <= N; i++) {
        for (int j = W; j >= w[i]; j--) {
            dp[j] = max(dp[j], dp[j - w[i]] + v[i]);//dp
        }
    }
    cout << dp[W]<<endl;
    return 0;
}

Measured memory_bytes: 8064
// AOJ 1562: Divisor
// 2017.10.23 bal4u@uu

#include <stdio.h>

int ans[13] = { 0, 1, 2, 4, 6, 16, 12, 64, 24, 36, 48, 1024, 60 }; 

int main() 
{
	int n;

	scanf("%d", &n);
	printf("%d\n", ans[n]);
	return 0; 
}

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

template<typename T_char>
T_char ToUpper(T_char cX){return toupper(cX);}

int main(){
  int n;
  cin >> n;
  string w, cpw;
  string ans = "Yes";
  map<string, int> count;
  for(int i=0; i<n; ++i){
    cin >> w;
    if(i==0){
      cpw = w;
      count[w]++;
      continue;
    }
    int size = cpw.size();
    count[w]++;
    if(count[w]>1) ans = "No";
    if(w[0]!=cpw[size-1]) ans ="No";
    cpw = w;
  }

  cout << ans;

  return 0;
}

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

int main() {
    int n;
    cin >> n;
    int sum;
    bool f = false;
    rep(i, 25 + 1){
        rep(j, 17 + 1){
            sum = 4*i + 7*j;
            if(sum == n){
                f = true;
                break;
            }
        }
        if(f) break;
    }
    if(f) cout << "Yes" << endl;
    if(!f) cout << "No" << endl;
}

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

using namespace std;

#define F first
#define S second

typedef long long ll;
typedef pair<int,int> pii;

void init(){
    cin.tie(0);
    cin.sync_with_stdio(0);
}

const int N = 509, M = 1e5 + 9, OO = 0x3f3f3f3f;
const ll llOO = 0x3f3f3f3f3f3f3f3f;

int n, m, a[N][N];
vector<pair<pii, pii>> op;

int main(){
//    init();

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

    vector<pii> odd;
    for(int i = 0;i < n;i++)
        for(int j = 0;j < m;j++)
            scanf("%d", a[i] + j);


    for(int i = 0;i < n;i++){
        for(int j = 0;j < m - 1;j++){
            if(a[i][j] % 2 == 0)    continue;
            op.push_back({{i, j}, {i, j + 1}});
            a[i][j + 1]++;
        }
    }

    for(int i = 0;i < n - 1;i++){
        if(a[i][m - 1] % 2 == 0)    continue;
        op.push_back({{i, m - 1}, {i + 1, m - 1}});
        a[i + 1][m - 1]++;
    }

    printf("%d\n", op.size());
    for(auto &v : op){
        printf("%d %d %d %d\n", v.F.F + 1, v.F.S + 1, v.S.F + 1, v.S.S + 1);
    }
}

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

using namespace std;
static const int INF = 1e9;
typedef pair<int, int> P;

void solve()
{
	string s;
	cin >> s;
	vector< vector<int> > cnt(26);
	for (int i = 0; i < s.size(); ++i)
	{
		int alphabet = s[i] - 'a';
		if(cnt[alphabet].size() != 0)
		{
			int pos = 0;
			for (int j = 0; j < cnt[alphabet].size(); ++j)
			{
				if (i - cnt[alphabet][j] + 1 < 2 * (cnt[alphabet].size() + 1 - pos))
				{
					cout << cnt[alphabet][j] + 1 << " " << i + 1 << endl;
					return;
				}
				++pos;
			}
		}
		cnt[alphabet].push_back(i);
	}
	cout << -1 << " " << -1 << endl;
}

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

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

using namespace std;

#define FOR(i, a, b) for(ll i = (a); i < (b); ++i)
#define FORR(i, a, b) for(ll i = (a); i > (b); --i)
#define REP(i, n) for(ll i = 0; i < (n); ++i)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOREACH(x, a) for(auto &(x) : (a))
#define VECCIN(x)                                                              \
    for(auto &youso_ : (x)) cin >> youso_
#define mp make_pair
#define bitcnt __builtin_popcount
#define SZ(x) ((ll)(x).size())
#define All(a) (a).begin(), (a).end()
template <typename T = long long> inline T IN() {
    T x;
    cin >> x;
    return (x);
}
inline void CIN() {}
template <class Head, class... Tail>
inline void CIN(Head &&head, Tail &&... tail) {
    cin >> head;
    CIN(move(tail)...);
}
#define CINT(...)                                                              \
    int __VA_ARGS__;                                                           \
    CIN(__VA_ARGS__)
#define LCIN(...)                                                              \
    ll __VA_ARGS__;                                                            \
    CIN(__VA_ARGS__)
#define SCIN(...)                                                              \
    string __VA_ARGS__;                                                        \
    CIN(__VA_ARGS__)
#define Yes(a) cout << (a ? "Yes" : "No") << "\n"
#define YES(a) cout << (a ? "YES" : "NO") << "\n"

typedef long long ll;
typedef unsigned long long ul;
typedef vector<int> V;
typedef vector<ll> VL;
typedef pair<ll, ll> PL;
typedef priority_queue<ll> PQ;
typedef priority_queue<ll, V, greater<ll>> PQG;

const int INF = 1e9;
const int MOD = 1e9 + 7;
// const int MOD = 998244353;
const ll LINF = 1e18;

ll N, M;
vector<VL> G;
vector<bool> went;
ll ans = 0;

void dfs(ll now, ll cnt) {
    if(cnt == N) {
        ans++;
        return;
    }
    FOREACH(to, G[now]) {
        if(!went[to]) {
            went[to] = true;
            dfs(to, cnt + 1);
            went[to] = false;
        }
    }
}
signed main() {
    cin >> N >> M;
    G.resize(N);
    went.resize(N);
    REP(i, M) {
        LCIN(a, b);
        G[--a].emplace_back(--b);
        G[b].emplace_back(a);
    }
    went[0] = true;
    dfs(0, 1);
    cout << ans++ << "\n";
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>

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

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

	int alice = 0;
	int bob = 0;

	for(int i = 0; i < n; ++i){
		//search max
		int cand;
		auto candit = std::begin(a);;
		for(auto iter = std::begin(a), end = std::end(a); iter != end; ++iter){
			if(*iter > cand || iter == std::begin(a)){
				cand = *iter;
				candit = iter;
			}
		}

		if(i % 2 == 0){
			alice += cand;
		}
		else{
			bob += cand;
		}

		a.erase(candit);
	}

	std::cout << alice - bob << std::endl;

	return 0;
}


Measured memory_bytes: 256
#
# Written by NoKnowledgeGG @YlePhan
# ('ω')
#
#import math
#mod = 10**9+7
#import itertools
#import fractions
#import numpy as np
#mod = 10**4 + 7
"""def kiri(n,m):
  r_ = n / m
  if (r_ - (n // m)) > 0:
    return (n//m) + 1
  else:
    return (n//m)"""
  
def main():
  n = int(input())
  P = list(map(int,input().split()))
  
  ANS = sorted(P)
  
  for i in range(n-1):
    for j in range(i,n):
      DUMMY = P.copy()
      tmp = DUMMY[i]
      DUMMY[i] = DUMMY[j]
      DUMMY[j] = tmp
      #print(DUMMY)
      if DUMMY == ANS:
        print('YES')
        exit()
  print('NO')
  
if __name__ == '__main__':
  main()

Measured memory_bytes: 3064
def main():
  size = input()
  a = list(map(int, input().split()))
  a = merge_sort(a)
  
  alice_res = 0
  bob_res = 0
  
  for i in range(len(a)):
    if i%2 == 0:
      alice_res += a[i]
    else:
      bob_res += a[i]
 
  print(alice_res-bob_res)
  
 
def merge_sort(array):
  if len(array)<=1:
    return array
  
  spl_size = len(array)//2
  
  left_list = merge_sort(array[:spl_size])
  right_list = merge_sort(array[spl_size:])
  
  return merge_list(left_list, right_list)
 
 
def merge_list(left_list, right_list):
  left_index = 0
  right_index = 0
  sorted_list = []
  
  while left_index<len(left_list) and right_index<len(right_list):
    if left_list[left_index] < right_list[right_index]:
      sorted_list.append(right_list[right_index])
      right_index+=1
    else:
      sorted_list.append(left_list[left_index])
      left_index+=1
      
  if left_index == len(left_list):
    sorted_list.extend(right_list[right_index:])
  if right_index == len(right_list):
    sorted_list.extend(left_list[left_index:])
      
  return sorted_list
    
                          
main()

Measured memory_bytes: 3064
#include<cstdio>
#include<queue>
#define N 205
using namespace std;
queue<int> Q;
const int dx[5]={1,-1,0,0},dy[5]={0,0,1,-1};
int h,w,a[N][N],vis[N][N],x,y,ans,flag,cnt;
char ch;
struct he{
	int x,y,s;
}q[N*N];
int main(){
	scanf("%d%d",&h,&w);
	for(int i=1;i<=h;i++){
		for(int j=1;j<=w;j++){
			ch=getchar();
			while(!(ch=='.'||ch=='@'||ch=='%'||ch=='#'||ch=='$')) ch=getchar();
			if(ch=='.') a[i][j]=1;
			if(ch=='@') a[i][j]=2;
			if(ch=='%') a[i][j]=3,x=i,y=j;
			if(ch=='#') a[i][j]=4;
			if(ch=='$') a[i][j]=5;
		}
	}
	q[1].x=x;q[1].y=y;cnt=1;
	vis[x][y]=1;
	Q.push(1);
	while(!Q.empty()){
		int u=Q.front();Q.pop();
		int x0=q[u].x,y0=q[u].y;
		if(flag==1&&ans<=q[u].s) break;
		for(int i=0;i<4;i++){
			int x1=x0+dx[i];
			int y1=y0+dy[i];
			if(x1<1||x1>h||y1<1||y1>w) continue;
			if(a[x1][y1]==4||vis[x1][y1]) continue;
			if(a[x1][y1]==5){flag=-1;break;}
			if(a[x1][y1]==2) {flag=1;ans=q[u].s+1;}
			q[++cnt].x=x1;q[cnt].y=y1;
			vis[x1][y1]=1;
			q[cnt].s=q[u].s+1;
			Q.push(cnt);
		}
		if(flag==-1) break;
	}
	if(flag==1) printf("Yes\n");else printf("No\n");
}

Measured memory_bytes: 3008
#include <iostream>

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

using namespace std;

int main()
{
    int x,n,f[110];
    cin>>x>>n;
    rep(i,102){
        f[i]=0;
    }
    rep(i,n){
        int p;
        cin>>p;
        f[p]=1;
    }

    int l,r;
    l = x;
    r = x;
    while(l>=0 || r<=101){
        if(l>=0){
            if(f[l]==0){
                cout << l << endl;
                return 0;
            }
        }
        if(r<=101){
            if(f[r]==0){
                cout << r << endl;
                return 0;
            }
        }
        l--;
        r++;
    }


    return 0;
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
                    
                    
int main(){
    string S, T;
    cin >> S >> T;

    int A, B;
    cin >> A >> B;

    string U;
    cin >> U;

    if(U == S){
        A -= 1;
    }else if(U == T){
        B -= 1;
    }

    cout << A << " " << B << endl;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
string dat;
bool zz[100010];
int main(){
	long long n,i,j,k;
	cin>>n>>dat;
	for(i=0;i<=1;i++)
		for(j=0;j<=1;j++){
			zz[0]=i;
			zz[1]=j;
			for(k=1;k<=n-2;k++)
				zz[k+1]=zz[k-1]^zz[k]^(dat[k]=='x');
			if((dat[n-1]=='x')==(zz[n-2]^zz[n-1]^zz[0])&&(dat[0]=='x')==(zz[n-1]^zz[0]^zz[1])){
				for(k=0;k<=n-1;k++)cout<<(zz[k]?'W':'S');
				cout<<'\n';
				return 0;
			} 
		}
	cout<<-1<<'\n';
	return 0;
}


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

using namespace std;

const int MAX_N = 100000, INDEX = 1;

long long sgn(long long x) {
    if (x == 0) {
        return 0;
    }

    return x / abs(x);
}

int n, a[MAX_N + INDEX];

long long getAns(long long sgni) {
    long long ps = 0, res = 0;
    for (int i = 1; i <= n; i++) {
        ps += a[i];

        if (sgn(ps) != sgni) {
            res += abs(ps) + 1;

            ps = sgni;
        }

        sgni *= -1;
    }

    return res;
}

long long ans;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie();
    cout.tie();

    cin >> n;

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

    ans = min(getAns(1), getAns(-1));

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 640
#include <vector>
#include <algorithm>
#include <iostream>
#include <queue>
#include <limits>
#include <math.h>

using namespace std;

int main() {
  int a, b;
  cin >> a >> b;
  if (a > 0) {
    puts("Positive");
  } else if (b < 0) {
    if ((b - a) % 2 == 0) {
      puts("Negative");
    } else {
      puts("Positive");
    }
  } else {
    puts("Zero");
  }
  return 0;
}


Measured memory_bytes: 256
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#include <boost/lexical_cast.hpp>

#define FOR(i, a, b) for (int i = (a); i < int(b); ++i)
#define RFOR(i, a, b) for (int i = (b)-1; i >= int(a); --i)
#define REP(i, n) FOR(i, 0, n)
#define REP1(i, n) FOR(i, 1, int(n) + 1)
#define RREP(i, n) RFOR(i, 0, n)
#define RREP1(i, n) RFOR(i, 1, int(n) + 1)
#define ALL(c) begin(c), end(c)

int _ = (
#ifndef LOCAL
    std::cin.tie(nullptr), std::ios::sync_with_stdio(false),
#endif
    std::cout.precision(10), std::cout.setf(std::ios::fixed));

using ll = long long;
using ld = long double;
template <typename T> using vec = std::vector<T>;
using pii = std::pair<int, int>;
using namespace std;

struct solve {
  solve(int H, int W, const vec<vec<char>> &S, const vec<vec<int>> &C)
      : H(H), W(W), S(S), C(C) {
    exec();
  }
  ~solve() {
    REP(y, H) {
      REP(x, W) {
        cout << (C[y][x] == -1 ? '#' : boost::lexical_cast<char>(C[y][x]));
      }
      cout << endl;
    }
  }
  void exec() {
    REP(y, H) {
      REP(x, W) {
        if (S[y][x] == '#') {
          continue;
        }
        int cost = 0;
        REP(i, 8) {
          const int nx = x + dx[i], ny = y + dy[i];
          if (0 <= nx && nx < W && 0 <= ny && ny < H && S[ny][nx] == '#') {
            cost++;
          }
        }
        C[y][x] = cost;
      }
    }
  }
  int H, W;
  vec<vec<char>> S;
  vec<vec<int>> C;
  static constexpr array<int, 8> dx{-1, -1, -1, 0, 1, 1, 1, 0};
  static constexpr array<int, 8> dy{-1, 0, 1, 1, 1, 0, -1, -1};
};

int main() {
  int H, W;
  cin >> H >> W;
  vec<vec<char>> S(H, vec<char>(W));
  vec<vec<int>> C(H, vec<int>(W, -1));
  REP(y, H) {
    REP(x, W) { cin >> S[y][x]; }
  }
  solve res(H, W, S, C);
  return 0;
}


Measured memory_bytes: 3700
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<string>
#include<sstream>
#include<cmath>
#include<numeric>
#include<map>
#include<stack>
#include<queue>
#include<list>
using namespace std;
int inf = 1000000000;

int main(void) {

  int n;
  cin >> n;
  list<int> l;
  for(int i=0; i<n; i++){
    // string s;
    char s[50];
    int x;
    // cin >> s;
    scanf("%s", s);
    if( s[0] == 'd' && s[6] == 'L'){
      l.pop_back();
    }else if( s[0] == 'd' && s[6] == 'F' ){
      l.pop_front();
    }else if( s[0] == 'i' ){
      scanf("%d", &x);
      l.push_front(x);
    }else if( s[0] == 'd' ){
      scanf("%d", &x);
      for(list<int>::iterator a=l.begin(); a!=l.end(); a++){
        if( *a == x ){
          l.erase(a);
          break;
        }
      }
    }
  }
  for(list<int>::iterator a=l.begin(); a != l.end();){
    cout << *a;
    if(++a != l.end() ) cout << " ";
    else cout << endl;
  }

  return 0;
}


// EOF

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

using namespace std;

typedef long long int ll;

void solve()
{
	string s;
	cin >> s;
	cout << s.substr(0,3);
}

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



Measured memory_bytes: 3620
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
#define ALL(a) a.begin(), a.end()
#define fi first
#define se second
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,Q,K,A,B;
string S;
const ll MOD = 998244353;
//const ll MOD = (1e+9) + 7;
typedef pair<ll, ll> P;
const ll INF = (1LL<<58);

int main() {
    cin>>N;
    vec ans(0);
    S = "";
    while(N){
        --N;
        S.push_back(char('a' + (N%26)));
        N /= 26;
    }
    reverse(ALL(S));
    cout<<S<<endl;
}

Measured memory_bytes: 3640
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <set>
#include <sstream>
#include <numeric>
#include <bitset>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cctype>
#include <cassert>
using namespace std;

typedef long long ll;
static const double EPS = 1e-8;
static const double PI = 4.0 * atan(1.0);
bool ISINT(double x){return fabs(x-(int)x)<EPS;}
bool ISEQ(double x,double y){return fabs(x-y)<EPS;}
string itos(ll x){stringstream ss;ss<<x;return ss.str();}
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
#define EREP(i,a,b) for(int i=a;i<=b;i++)
#define erep(i,n) EREP(i,0,n)
#define foreach(itr,c) for(__typeof(c.begin()) itr=c.begin();itr!=c.end();itr++)

typedef pair<int,string> P;

int main(void){
  int n;

  while(cin>>n,n){
    string name[21];
    int m[21];
    int d[21][31];
    int cnt[31];
    memset(cnt,0,sizeof(cnt));

    rep(i,n){
      cin>>name[i]>>m[i];
      rep(j,m[i]){
        cin>>d[i][j];
        cnt[d[i][j]]++;
      }
    }

    string minName;
    int minScore = INT_MAX;

    rep(i,n){
      int sum = 0;
      rep(j,m[i]){
        sum += n - cnt[d[i][j]] + 1;
      }
      if(minScore > sum || minScore == sum && minName > name[i]){
        minScore = sum;
        minName = name[i];
      }
    }

    cout<<minScore<<" "<<minName<<endl;
  }
}

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

int main(){
	int N;
  	cin>>N;
	int a=N/111;int b=N%111;
  	if(a==0){cout<<"111"<<endl;return 0;}
  	else {
    	if(b==0)cout<<a*111<<endl;
    	else cout<<(a+1)*111<<endl;
    }return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>
#include <numeric>
#include <iomanip>

#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
/* const int MOD = 998244353; */
const int INF = 1e18;
const double PI = acos(-1);

using namespace std;
struct INIT { INIT(){
  cin.tie(0); ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
}}INIT;


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

  int ans = 0;
  for(int i = 1; i < N; i++){
    for(int j = 1; j*i < N; j++){
      ans++;
    }
  }

  cout << ans << "\n";

  return 0;
}


Measured memory_bytes: 3648
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

int main() {
	int n;
	std::vector<int> arr;

	std::cin >> n;

	if (n == 0) {
		std::cout << 0 << std::endl;
		return 0;
	}

	for (auto i = 0; i < n; i++) {
		int size;
		std::cin >> size;

		arr.push_back(size);
	}

	std::sort(arr.begin(), arr.end(), std::greater<int>());

	int cnt = 1;
	int prev = arr[0];
	for(auto i = 0; i < n; i++) {
		if (prev == arr[i]) {
			continue;
		}

		prev = arr[i];
		cnt++;
	}

	std::cout << cnt << std::endl;

	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<vector>
#include<string>
#include<algorithm>
#include<utility>

using namespace std;
int main()
{
  int x[5],count = 0;
  for(int i = 0; i < 5; i++)
  {
    cin >> x[i];
  }
  for (int j = 0; j < 5;j++)
  {
    count++;
    if(x[j] == 0)
    {
      cout << count << endl;
    }
  }
return 0;
}

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

bool check(char c){
  if(c=='A') return true;
  if(c=='C') return true;
  if(c=='G') return true;
  if(c=='T') return true;
  return false;
}

char S[15];
int main(void){
  cin>>S;
  int cnt=0, max=0;
  for(uint i=0;i<strlen(S);i++){
    if(check(S[i])) cnt++;
    else{
      if(max<cnt) max=cnt;
      cnt=0;
    }
  }
  if(max<cnt) max=cnt;
  cout<<max<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int k[100005];
int main(void)
{
	int n,m;
	int s;
	int a,b,c;
	int i,j;
	int cnt=0;
	
	k[0]=0;
	scanf("%d %d",&n,&m);
	for(i=1;i<n;i++){
		scanf("%d",&s);
		k[i]=k[i-1]+s;
	}
	b=0;
	for(i=0;i<m;i++){
		scanf("%d",&a);
		c=b+a;
		if(b<c){
			cnt+=k[c]-k[b];
		}
		else {
			cnt+=k[b]-k[c];
		}
		b=c;
		cnt=cnt%100000;
	}
	printf("%d\n",cnt);
	return 0;
}

Measured memory_bytes: 1412
while True:
    H,W=map(int,input().split())
    if H==0 and W==0:
        break
    for i in range(H):
        for j in range(W):
            if (i+j)%2==0:
                print("#",end="")
            else:
                print('.',end="")
        print()
    print()


Measured memory_bytes: 7004