akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cstring>
#include<cstdio>
#include<iomanip>
using namespace std;
int main()
{
	int a,b;
	cin>>a>>b;
	if(a-b<0) cout<<0<<endl;
	else
	cout<<a-b<<endl;
	return 0;
}

Measured memory_bytes: 256
ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

class UnionFind:
    d = {}

    def __init__(self,n):
        self.d = {i:-1 for i in range(n)}

    def find(self, x):
        if(self.d[x] < 0):
            return x
        self.d[x] = self.find(self.d[x])
        return self.d[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if(x == y):
            return False
        if(self.d[x] > self.d[y]):
            x, y = y, x
        self.d[x] += self.d[y]
        self.d[y] = x
        return True

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def size(self,x):
        return -self.d[self.find(x)]


n,m,k = mi()

uf = UnionFind(n)

block = {}
friend = {}
for i in range(n):
    block[i] = []
    friend[i] = []

for i in range(m):
    ab = li()
    uf.union(ab[1]-1, ab[0]-1)
    friend[ab[0]-1].append(ab[1]-1)
    friend[ab[1]-1].append(ab[0]-1)

for i in range(k):
    cd = li()
    block[cd[0]-1].append(cd[1]-1)
    block[cd[1]-1].append(cd[0]-1)


for i in range(n):
    ans = uf.size(i) - 1 - len(friend[i])
    for j in block[i]:
        if(uf.same(i, j)):
            ans -=1
    
    print(ans)


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

#define IOS {ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);}
#define ll long long 

ll powermod(ll x,ll ex,ll md){ll ans=1ll;while(ex>0){if(ex&1ll) ans=(ans*x)%md; ex>>=1ll;x=(x*x)%md;}return ans;}
inline ll gcd(ll a,ll b) {if(b==0)return a;a%=b;return gcd(b,a);}
inline ll max(ll a,ll b) {return((a>b)?a:b);}
inline ll min(ll a,ll b) {return((a>b)?b:a);}


int main(){
        IOS;
        ll n;
        cin>>n;
        ll x[n],y[n];
        vector<pair<ll,ll>>sum(n) ,dif(n);
        for(ll i=0;i<n;i++){
                cin>>x[i]>>y[i];
                sum[i]=make_pair((x[i]+y[i]) , i);
                dif[i]=make_pair((x[i]-y[i]) , i);
        }
        sort(sum.begin() , sum.end());
        sort(dif.begin() , dif.end());

        ll ans=LLONG_MIN;

        ll index=sum[0].second;
        ll startx = x[index];
        ll starty = y[index];
        for(ll i=0;i<n;i++){
                ll index=sum[i].second;
                ll xx=x[index];
                ll yy=y[index];
                if(xx>=startx){
                        if(yy >= starty) ans=max(ans , abs(sum[i].first - sum[0].first));
                }
                else{
                        if(starty >= xx) ans=max(ans ,abs(sum[0].first - sum[i].first));
                }
        }

        index=sum[n-1].second;
        startx = x[index] , starty = y[index];
        for(ll i=0;i<n;i++){
                ll index=sum[i].second;
                ll xx=x[index];
                ll yy=y[index];
                if(xx>=startx){
                        if(yy >= starty) ans=max(ans , abs(sum[i].first - sum[n-1].first) );
                }
                else{
                        if(starty >= xx) ans=max(ans , abs(sum[n-1].first - sum[i].first) );
                }
        }

        index=dif[0].second;
        startx = x[index] , starty = y[index];
        for(ll i=0;i<n;i++){
                ll index=dif[i].second;
                ll xx=x[index];
                ll yy=y[index];
                if(xx>=startx){
                        if(yy < starty) ans=max(ans , abs(dif[i].first - dif[0].first));
                }
                else{
                        if(starty < xx) ans=max(ans , abs(dif[0].first - dif[i].first));
                }
        }

        index=dif[n-1].second;
        startx = x[index] , starty = y[index];
        for(ll i=0;i<n;i++){
                ll index=dif[i].second;
                ll xx=x[index];
                ll yy=y[index];
                if(xx>=startx){
                        if(yy < starty) ans=max(ans ,abs(dif[i].first - dif[n-1].first));
                }
                else{
                        if(starty < xx) ans=max(ans , abs(dif[n-1].first - dif[i].first));
                }
        }

        cout<<ans<<"\n";
}


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

using namespace std;

int main() {
	
	register int a , b;
	
	scanf("%d%d",&a,&b);
	
	if(a <= 0 && b >= 0)	puts("Zero");
	else {
		if(a < 0) {
			if((b-a+1) % 2 != 0)	puts("Negative");
			else	puts("Positive");
		}
		else	puts("Positive");
	}
	
	return 0;
	
}

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

#define rep1(i,N) for(int i=1;i<int(N);++i)

int main() {
	int A,B,C;
	cin>>A>>B>>C;
	string ans="NO";
	rep1(i,1e6){
		if((A*i)%B == C){
			ans = "YES";
			break;
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{

int h,a,s=0,k;
cin>>h>>a;
for(int i=0;i<a;i++)
{  cin>>k;
    s=s+k;
}
if(s>=h)
{
    cout<<"Yes"<<endl;
}
else
{
    cout<<"No"<<endl;
}
    return 0;


}


Measured memory_bytes: 3632
#[allow(unused_imports)]
use std::cmp::{Ordering};

#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};

#[allow(unused_imports)]
use std::io::{stdin, stdout, BufWriter, Write};

#[allow(unused_imports)]
use std::iter::FromIterator;

#[allow(unused_macros)]
macro_rules! min {
    ($x: expr) => ($x);
    ($x: expr, $($z: expr),+) => {{
        std::cmp::min($x, min!($($z),*))
    }}
}

#[allow(unused_macros)]
macro_rules! max {
    ($x: expr) => ($x);
    ($x: expr, $($z: expr),+) => {{
        std::cmp::max($x, max!($($z),*))
    }}
}

#[allow(unused_macros)]
macro_rules! get { 
    ([$t: ty]) => { 
        { 
            let mut line = String::new(); 
            stdin().read_line(&mut line).unwrap(); 
            line.split_whitespace().map(|t|t.parse::<$t>().unwrap()).collect::<Vec<_>>()
        }
    };
    ([$t: ty];$n: expr) => {
        (0..$n).map(|_|get!([$t])).collect::<Vec<_>>()
    };
    ($t: ty) => {
        {
            let mut line = String::new();
            stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t: ty),*) => {
        { 
            let mut line = String::new();
            stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            ($(iter.next().unwrap().parse::<$t>().unwrap(),)*)
        }
    };
    ($t: ty; $n: expr) => {
        (0..$n).map(|_|get!($t)).collect::<Vec<_>>()
    };
    ($($t: ty),*; $n: expr) => {
        (0..$n).map(|_|get!($($t),*)).collect::<Vec<_>>()
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        #[cfg(debug_assertions)]
        writeln!(&mut std::io::stderr(), concat!("[DEBUG] ", $(stringify!($a), "={:?} "),*), $($a),*).unwrap();
    }
}

const BIG_STACK_SIZE: bool = true;

#[allow(dead_code)]
fn main() {
    use std::thread;
    if BIG_STACK_SIZE {
        thread::Builder::new()
            .stack_size(32 * 1024 * 1024)
            .name("solve".into())
            .spawn(solve)
            .unwrap()
            .join()
            .unwrap();
    } else {
        solve();
    }
}

fn solve() {
    let n = get!(usize);
    let a = get!([usize]);
    let mut vec = vec![0; 100_001];

    for e in a {
        vec[e] += 1;
    }
    let nums = vec.into_iter().filter(|&e| e > 0).collect::<Vec<_>>();

    let mut sum = 0usize;
    let even_num = nums.iter().filter(|&e| e % 2 == 0).count();
    if even_num % 2 == 0 {
        sum += even_num;
    } else {
        sum += even_num + 1;
    }

    sum += nums.into_iter().map(|e| if e % 2 == 0 { e - 2 } else { e - 1 }).sum::<usize>();
    println!("{}", n - sum);
}


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

int main(){
  string S,T;
  cin  >> S >> T;
  int ans = 0;
  
  if(S.at(0) == T.at(0)){
    ans++;
  }
  if(S.at(1) == T.at(1)){
    ans++;
  }
  if(S.at(2) == T.at(2)){
    ans++;
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 256
fn main() {
    // stdinのロックを取得し、StdinReaderを作る。
    let stdin = std::io::stdin();
    let mut r = utils::StdinReader::new(stdin.lock());

    let count = r.readl::<usize>();  // 次の改行まで読む

    let mut xs: Vec<u32> = Vec::new();
    for i in 0..count - 1 {
        xs.push(r.reads::<u32>());
    }
    xs.push(r.readl::<u32>());
    xs.sort();

    println!("{:}",xs.last().unwrap() -  xs.first().unwrap());
}

mod utils {

    use std::io::BufRead;
    use std::str::{self, FromStr};

    pub struct StdinReader<R: BufRead> {
        reader: R,
        buf: Vec<u8>,
    }

    impl<R: BufRead> StdinReader<R> {
        pub fn new(reader: R) -> StdinReader<R> {
            StdinReader {
                reader: reader,
                buf: Vec::new(),
            }
        }

        // 区切り文字：スペース
        pub fn reads<T: FromStr>(&mut self) -> T {
            self.read_until(b' ')
        }

        // 区切り文字：改行
        pub fn readl<T: FromStr>(&mut self) -> T {
            self.read_until(b'\n')
        }

        pub fn read_until<T: FromStr>(&mut self, delim: u8) -> T {
            // self.bufに次のトークンをセットする
            loop {
                self.buf.clear();
                let len = self.reader
                    .read_until(delim, &mut self.buf)
                    .expect("failed reading bytes");
                match len {
                    0 => panic!("early eof"),
                    1 if self.buf[0] == delim => (), // 区切り文字だけなのでもう一度ループ
                    _ => {
                        // トークンが得られた
                        // 最後の文字が区切り文字なら削除
                        if self.buf[len - 1] == delim {
                            self.buf.truncate(len - 1);
                        }
                        break; // ループから脱出
                    }
                }
            }

            // 文字列をT型へパースする
            let elem = str::from_utf8(&self.buf).expect("invalid utf-8 string");
            elem.parse().unwrap_or_else(|_| panic!(format!("failed parsing: {}", elem)))
        }
    }

}

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

#define ll long long
#define pb push_back
#define f first
#define s second
#define mp make_pair
#define gg return 0;

using namespace std;

const int maxn = (int)2e5 + 7;
const int INF = (int)1e9;

ll a,b[maxn],c,d,cnt,e[(int)2e3 + 1][(int)2e3 + 1],cost[maxn],tout[maxn],mn = INF,p[maxn];

ll cntc;

vector < pair < ll, ll> > g[maxn];

vector <ll> ans;

string s,t;

int main()
{
    //freopen("island2.in" , "r" , stdin);
    //freopen("island2.out" , "w" , stdout);
    cin >> a >> c;
    if(a % c == 0){
    	cout << 0;
    }
    else{
    	cout << 1;
    }
    return 0;
}


Measured memory_bytes: 8448
import std.algorithm;
import std.array;
import std.conv;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

int solve (int n)
{
	readln;
	auto s = readln.strip;

	auto d = new int [n + 1];
	d[0] = 0;
	foreach (i; 0..n)
	{
		d[i + 1] = d[i] + (s[i] != 'E');
	}
	debug {writeln (d);}

	auto f = new int [n + 1];
	f[n] = 0;
	foreach_reverse (i; 0..n)
	{
		f[i] = f[i + 1] + (s[i] != 'W');
	}
	debug {writeln (f);}

	int res = n;
	foreach (i; 0..n)
	{
		res = min (res, d[i] + f[i + 1]);
	}
	return res;
}

void main ()
{
	int n;
	while (readf (" %s", &n) > 0)
	{
		writeln (solve (n));
	}
}


Measured memory_bytes: 4456
#include <stdio.h>

int main() {
	int i, j, n, taro_p = 0, hana_p = 0;
	char taro[101], hana[101];

	scanf("%d", &n);

	for (i = 0; i<n; i++) {
		scanf("%s %s", taro, hana);
		for (j = 0;; j++) {
			if (taro[j] > hana[j]) {
				taro_p += 3;
				break;
			}
			else if (taro[j] < hana[j]) {
				hana_p += 3;
				break;
			}
			else if (taro[j] + hana[j] == 0) {
				hana_p++;
				taro_p++;
				break;
			}
		}
	}
	printf("%d %d\n", taro_p, hana_p);

	return 0;
}


Measured memory_bytes: 2120
#include <stdio.h>
int main(void){
    int a,b,c,d;
    scanf("%d%d%d%d",&a,&b,&c,&d);
    
    if((a-b)*(a-c)*(a-d)*(b-c)*(b-d)*(c-d))
    {
        if(a==1 || a==4 || a==7 || a==9)
        {
        if(b==1 || b==4 || b==7 || b==9)
        {
        if(c==1 || c==4 || c==7 || c==9)
        {
        if(d==1 || d==4 || d==7 || d==9)
        {
            printf("YES");
            return 0;
        }
        }
        }
        }
    }
    printf("NO");
    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <math.h>
#include <string>
#include <numeric>
#include <queue>
#include <cstdio>
#include <cstring>
#define ll long long
#define rep(i,n) for(ll i=0;i<n;++i)
#define rep1(i,n) for(ll i=1;i<n;++i)
#define mrep(i,n) for(ll i=n;i>=0;--i)
#define all(a) (a).begin(),(a).end()
#define vl vector<ll>
#define vvl vector<vector<ll> >
#define vb vector<bool>
#define vvb vector<vector<bool> >
#define pl pair<ll,ll>
#define inf 1001001001001001000
//#define mod 1000000007
#define mod 998244353
#define pi 3.1415926535
using namespace std;
struct __INIT {
	__INIT() {
		cin.tie(0);
		ios::sync_with_stdio(false);
		cout << fixed << setprecision(15);
	}
}__init;



int main(void) {
    ll n,m;
    cin>>n>>m;
    vvb pitsu(n,vb(m,0));
    rep(i,n) rep(j,n){
        char c;
        cin>>c;
        pitsu[i][j] = (c == '#');
    }
    rep(i,n) rep(j,m){
        if(!pitsu[i][j]) continue;
        bool up = false;
        bool down = false;
        bool right = false;
        bool left = false;
        if(j-1 >= 0) left = pitsu[i][j-1];
        if(j+1 < m) right = pitsu[i][j+1];
        if(i-1 >= 0) up = pitsu[i-1][j];
        if(i+1 < n) down = pitsu[i+1][j];
        if(up||down||right||left) continue;
        else{
            cout<<"No"<<endl;
            return 0;
        }
    }
    cout<<"Yes"<<endl;
	return 0;
}


Measured memory_bytes: 3624
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
using namespace std;

int main(){
	char a, b;
	cin >> a >> b;
	if(a - b > 0) cout << ">" << endl;
	else if(a - b < 0) cout << "<" << endl;
	else cout << "=" << endl;
	return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
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__) << "] "
#define cool ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define int  long long int
#define pb push_back
#define fe first
#define lb lower_bound 
#define ub upper_bound
#define pii pair<pair<int,int>,pair<int,int> >
#define se second
#define endl "\n"
#define pi pair<int, int>
#define mi          map<int,int>
#define mii         map<pi,int>
#define vi vector<int> 
#define vvi vector<vi>
#define bs   binary_search
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rep1(i,a,b) for(int i=a;i<=b;i++)	
#define all(c) (c).begin(),(c).end()
#define sz(x)       (int)x.size() 
#define PI 3.14159265358979323846

 const int N=2e5+5;

 int mod= 1e9+7;
 int dx[4]={0,0,+1,-1};
 int dy[4]={+1,-1,0,0};  
 
 
int po(int a, int b) {
	a %= mod;
	int res = 1;
	while (b > 0) {
		if (b & 1)
			res = (res * a) % mod;
		a =(a*a) % mod;
		b >>= 1;
	}
	 return res;	
   }


void solve() {
    int n;
    cin>>n;
    if(n>=30) cout<<"Yes\n";
    else cout<<"No\n";     
}

    
int32_t main() {
	cool;
	int t=1;	

	//cin>>t;
	while(t--)
	  solve();

return 0;	   
}


Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define REP(i,m,n) for(int i=(int)(m);i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define SORT(i) sort((i).begin(),(i).end())
#define out(y,x,h,w) (y)<0||(x)<0||(y)>=(h)||(x)>=(w)
constexpr int INF = 2000000000;
constexpr int mod = 1000000007;

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

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int N; cin >> N;
	string s; cin >> s;
	if (N % 2 == 0) {
		if (s.substr(0, N / 2) == s.substr(N / 2, N))cout << "Yes" << "\n";
		else cout << "No" << "\n";
	}
	else cout << "No" << "\n";

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
typedef vector<ll> vl;
#define inf 1000000000
#define rep(i,a,b) for (int i = a; i <= b; i++)
#define rep1(i, a, b) for(int i =a; i >=b; i--)
#define f first
#define ss second
#define pb push_back

int n, m, ans=0;
vi  adj[1010], v;

int main(){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin >> n;
cin >> m;
int x, y;
rep(i, 1, m){
cin >> x >> y;
adj[x].pb(y);
adj[y].pb(x);
}

rep(i,1,n){
v.pb(i);
}

do{
    bool flag = true;
    if(v[0]!=1)continue;
    rep(i, 0, n-2){
    int a = v[i+1];
    bool f1=false;
    for(auto t: adj[v[i]]){
        if(t==a)f1=true;;
    }
    if(f1)continue;
    else flag = false;
    }
    if(flag)ans++;
}
while(next_permutation(v.begin(), v.end()));


cout << ans << endl;

return 0;}


Measured memory_bytes: 256
const input = require('fs').readFileSync('/dev/stdin', 'utf8').split(/[\s]/);
const nin=()=>{const r = input[0];input.shift();return Number(r)};
const nrin=(n)=>{const a:number[]=[];rep(n,()=>a.push(nin()));return a};
const sin=()=>{const r = input[0];input.shift();return String(r)}
const out=(...a)=>{console.log(...a)}
const floor=(a)=>{return Math.floor(a)}
const min=(...a)=>{return Math.min(...a)}
const max=(...a)=>{return Math.max(...a)}
const rep=(n, callback)=>{for(let i = 0;i < n; i++){callback()}}
const strrep=(s, i, v)=>{return s.slice(0, i)+v+s.slice(i+1);};
const main = ()=>{
  let [a, b] = [...nrin(2)];
  let ans = max(a,b);
  max(a,b)==a?a--:b--;
  out(ans + max(a,b));
}
main();

Measured memory_bytes: 7372
#include <iostream>
#include <vector>
#include <algorithm>
#include <string.h>
#include <iomanip>
#include <map>
using namespace std;
int main()
{
    int a;
    string ans;
    cin >> a;
    if (a < 1200)
    {
        ans = "ABC";
    }
    else if (a < 2800)
    {
        ans = "ARC";
    }
    else
    {
        ans = "AGC";
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
N,Y=map(int,input().split())

for a in range(N+1):
    if a*10000>Y:
        continue
    for b in range(N-a+1):
        c=N-a-b
        if a*10000+b*5000+1000*c==Y:
            print(a,b,c)
            exit()
print('-1 -1 -1')


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

int N,M;
int road[60];

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

    for (int i = 1; i <= N; i++)
    {
        road[i] = 0;
    }
    
    for (int i = 0; i < M; i++)
    {
        int a,b;
        cin>>a>>b;
        road[a]++;
        road[b]++;
    }
    
    for (int i = 1; i <= N; i++)
    {
        cout << road[i] << endl;
    }
        
    return 0;
}


Measured memory_bytes: 256
// AOJ ITP2_9_A Set Union
// 2019.3.8 bal4u

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#if 1
#define gc() getchar_unlocked()
#define pc(c) putchar_unlocked(c)
#else
#define gc() getchar()
#define pc(c) putchar(c)
#endif

int in(char *s)   // 非負整数の入力
{
	int n = 0, c;
	*s++ = c = gc();
	do n = 10 * n + (c & 0xf), *s++ = c = gc(); while (c >= '0');
	*(s - 1) = 0;
	return n;
}

void outs(char *s) { while (*s) pc(*s++); pc('\n'); }

#define INF 1000000001
int n, m;
int a[200002], b[200002];
char sa[200002][11], sb[200002][11];

int main()
{
	int i, j;

	n = in(sa[0]);
	for (i = 0; i < n; i++) a[i] = in(sa[i]);
	a[i] = INF;
	m = in(sb[0]);
	for (j = 0; j < m; j++) b[j] = in(sb[j]);
	b[j] = INF;
	i = j = 0; while (1) {
		while (a[i] < b[j]) outs(sa[i++]);
		while (b[j] < a[i]) outs(sb[j++]);
		if (a[i] == INF) break;
		if (a[i] == b[j]) outs(sa[i++]), j++;
	}
	return 0;
}


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

int N,K;
int DP[100005][3];
int A[100005][3];

int main(){
	cin>>N;
	for(int i=0;i<N;i++)
		for(int j=0;j<3;j++)
			cin>>A[i+1][j];

	for(int i=1;i<N+1;i++)
		for(int j=0;j<3;j++)
			DP[i][j]=max(DP[i-1][(j+1)%3],DP[i-1][(j+2)%3])+A[i][j];

	cout<<max(DP[N][0],max(DP[N][1],DP[N][2]));

}

Measured memory_bytes: 2560
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
typedef pair<double, long long> pdl;

const long double pi = 3.141592653589793;

#define debug(x) cerr << #x << " = " << (x) << endl;
#define rep(i, n) for(int i = 0;i < n;i++)
#define pb push_back
#define mp make_pair
#define mod 1000000007

void solve(ll n, vector<int>& answer) {
    if(n == 1) return;
    if(n%2 == 0) {
        solve(n/2, answer);
        int z = answer.size();
        answer.pb(z+1);
    } else {
        solve(n-1, answer);
        int z = answer.size();
        answer.pb(z+1);
        for(int i = z;i > 0;i--) answer[i] = answer[i-1];
        answer[0] = z+1;
    }
}

int main() {
  // freopen("input.in","r",stdin);
  // freopen("output.out","w",stdout);

  ll n;
  cin>>n;n++;

  vector<int> answer;
  solve(n, answer);
  cout<<2*answer.size()<<endl;
  rep(i, answer.size()) cout<<answer[i]<<" ";
  rep(i, answer.size()) cout<<i+1<<" ";

  return 0;
}


Measured memory_bytes: 256
# include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
using namespace std;
typedef long long ll;

int main(){
  int X;
  cin >> X;
  int q;
  q = X / 200;
  cout << 10-q;
  return 0;
}

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

int main(){

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	long long a,b,c,d;
	cin >> a >> b >> c >> d;

	cout << max(a*b,c*d) << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

#define MAX 10000
#define NIL -1

typedef struct { int parent, left, right;} Node;

Node T[MAX];
int n, D[MAX], H[MAX];

void setDepth(int u,int d) {
	if(u == NIL) return;
	D[u] = d;
	setDepth(T[u].left, d+1);
	setDepth(T[u].right,d+1);
}

int setHeight(int u) {
	int h1 = 0, h2 = 0;
	if(T[u].left != NIL)
		h1 = setHeight(T[u].left)  + 1;
	if(T[u].right != NIL)
		h2 = setHeight(T[u].right) + 1;
	return H[u] = (h1 > h2 ? h1 : h2);
}

// 接点 u の兄弟を返す
int getSibling(int u) {
	if(T[u].parent == NIL) return NIL;
	if(T[T[u].parent].left != u && T[T[u].parent].left != NIL )
		return T[T[u].parent].left;
	if(T[T[u].parent].right != u && T[T[u].parent].right != NIL )
		return T[T[u].parent].right;
	return NIL;
}

void print(int u) {
	int deg = 0;
	printf("node %d: ",u);
	printf("parent = %d, ",T[u].parent);
	printf("sibling = %d, ",getSibling(u));
	if(T[u].left  != NIL) deg++;
	if(T[u].right != NIL) deg++;
	printf("degree = %d, ",deg);
	printf("depth = %d, ",D[u]);
	printf("height = %d, ",H[u]);
	
	if(T[u].parent == NIL) {
		printf("root\n");
	} else if(T[u].left == NIL && T[u].right == NIL) {
		printf("leaf\n");
	} else {
		printf("internal node\n");
	}
}

int main(void) {
	int i, v, l, r, root = 0;
	scanf("%d",&n);
	for(i=0;i<n;i++) T[i].parent = NIL;
	for(i=0;i<n;i++) {
		scanf("%d %d %d",&v,&l,&r);
		T[v].left  = l;
		T[v].right = r;
		if(l != NIL) T[l].parent = v;
		if(r != NIL) T[r].parent = v;
	}
	
	for(i=0; i<n; i++)
	if(T[i].parent == NIL) root = i;
	
	setDepth(root,0);
	setHeight(root);
	
	for(i=0;i<n;i++) print(i);
	
	return 0;
}


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

int main() {
    int n, x, t;
    cin >> n >> x >> t;
    int cnt = 0, out=0;
    while(out<n){
      out += x;
      cnt+=t;
    }
    cout << cnt << endl;
    return 0;
}


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

int main() {
	int n;
	cin >> n;
	vector<int>ans(10001,0);
	for (int i = 1; i <= 100; i++) {
		for (int j = 1; j <= 100; j++) {
			for (int k = 1; k <= 100; k++) {
				int x = i * i + j * j + k * k + i * j + j * k + k * i;
				if(x<=10000)ans.at(x)++;
			}
		}
	}
	for (int i = 0; i < n; i++) {
		cout << ans.at(i+1) << endl;
	}
}

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

int n, m;
int mx[55], my[55], px[55], py[55];
int ans[55];

int main(){
  cin >> n >> m;
  rep(i,n) cin >> mx[i] >> my[i];
  rep(i,m) cin >> px[i] >> py[i];
  rep(i,n){
    int res = INT_MAX;
    rep(j,m){
      int X = abs(mx[i] - px[j]);
      int Y = abs(my[i] - py[j]);
      if(res > X+Y) {
        res = X + Y;
        ans[i] = j + 1;
      }
    }
  }
  rep(i,n) cout << ans[i] << endl;
}

Measured memory_bytes: 256
N = gets.to_i
a = gets.split.map(&:to_i)
count=0
	flag = true
	while flag
		flag = false
		(N-1).downto(1) do |j|
			if a[j] < a[j-1]
				tmp = a[j]
				a[j] = a[j-1]
				a[j-1] = tmp
				flag = true
				count+=1
			end

		end
	end

	N.times do |i|
		print("#{a[i]}")
		if(i<N-1)
			print(" ")
		end
	end
	print("\n")
	puts count

Measured memory_bytes: 8656
#include<bits/stdc++.h>
using namespace std;
#define mo 1000000007
#define M 400005
#define ll long long
int read() {
	int s=0,w=1;
	char ch=getchar();
	while(ch<'0'||ch>'9')
	{
		if(ch=='-') w=-1;
		ch=getchar();
	}
	while(ch>='0'&&ch<='9') s=(s<<3)+(s<<1)+(ch^48),ch=getchar();
	return s*w;
}
ll ksm(ll a,int k) {
	ll s=1;
	while(k)
	{
		if(k&1) s=s*a%mo;
		a=a*a%mo;
		k>>=1;
	}
	return s;
}
struct edge{
	int t,nxt;
}a[M*2],e[M*2];
int h1[M],t1,h2[M],t2,du[M];
void add(int st,int t) {
	a[++t1].nxt=h1[st],a[t1].t=t,h1[st]=t1;
	du[st]++,du[t]++;
}
void Add(int st,int t) {
	e[++t2].nxt=h2[st],e[t2].t=t,h2[st]=t2;
}
int n;
ll ans=1,jc[M];
int col[M];
void dfs1(int x,int fa) {
	if(col[x]) return ;
	col[x]=1;
	for(int i=h1[x];i;i=a[i].nxt)
	{
		int to=a[i].t;
		if(to==fa) continue ;
		dfs1(to,x);
	}
}
int findl;
int vis[M],sta[M],top,cir[M],tp[M],cnt,tol[M],cnt2;
void dfs2_2(int x) {
	vis[x]=1,tol[++cnt2]=x;
	for(int i=h1[x];i;i=a[i].nxt)
	{
		int to=a[i].t;
		if(vis[to]) continue ;
		dfs2_2(to);
	}
}
void dfs2(int x,int fa) {
	if(vis[x]&&!findl)
	{
		findl=1;
		int p=top;
		while(sta[p+1]!=x) cir[++cnt]=sta[p--],tp[cir[cnt]]=1;
		return ;
	}
	if(vis[x]) return ;
	vis[x]=1,sta[++top]=x;
	for(int i=h1[x];i;i=a[i].nxt)
	{
		int to=a[i].t;
		if(to==fa) continue ;
		dfs2(to,x);
		if(findl) return ;
	}
	vis[x]=0,top--;
}
int sz[M],dfn[M];
void dfs3(int x) {
	if(dfn[x]) return ;
	sz[x]=dfn[x]=1;
	for(int i=h2[x];i;i=e[i].nxt)
	{
		int to=e[i].t;
		dfs3(to);
		sz[x]+=sz[to];
	}
}
void dfs4(int x,int fa) {
	for(int i=h1[x];i;i=a[i].nxt)
	{
		int to=a[i].t;
		if(tp[to]||to==fa) continue ;
		if(fa>to) Add(x,to);
		dfs4(to,x);
	}
}
void clear() {
	for(int i=1;i<=cnt2;i++) h2[tol[i]]=dfn[tol[i]]=sz[tol[i]]=0;
	t2=0;
}
void link(int k) {
	if(!k) for(int i=1;i<=cnt;i++) dfs4(cir[i],cir[i+1]);
	else for(int i=1;i<=cnt;i++) dfs4(cir[i],cir[i-1]);
}
ll sol(int s) {
	findl=0;
	ll s1=1,s2=1;
	cnt=cnt2=0;
	dfs2_2(s);
	for(int i=1;i<=cnt2;i++) vis[tol[i]]=0;
	dfs2(s,0);
	cir[0]=cir[cnt],cir[cnt+1]=cir[1],cir[cnt+2]=cir[2];
	link(0);
	for(int i=2;i<=cnt+1;i++) if(cir[i+1]>cir[i-1]) Add(cir[i],cir[i-1]);
	for(int i=1;i<=cnt2;i++) dfs3(tol[i]);
	for(int i=1;i<=cnt2;i++) s1=s1*sz[tol[i]]%mo;
	clear();
	link(1);
	for(int i=2;i<=cnt+1;i++) if(cir[i+1]<cir[i-1]) Add(cir[i],cir[i+1]);
	for(int i=1;i<=cnt2;i++) dfs3(tol[i]);
	for(int i=1;i<=cnt2;i++) s2=s2*sz[tol[i]]%mo;
	clear();
	for(int i=1;i<=cnt;i++) tp[cir[i]]=0;
	for(int i=1;i<=cnt2;i++) vis[tol[i]]=0;
	top=0;
	s1=(ksm(s1,mo-2)+ksm(s2,mo-2))%mo;
	return s1;
}
void work() {
	for(int i=1;i<=n*2;i++)
		if(!col[i])
		{
			dfs1(i,0);
			ans=ans*sol(i)%mo;
		}
	ans=jc[n*2]*ans%mo;
	cout<<ans<<endl;
}
int main()
{
	//freopen("2.in","r",stdin);
	jc[0]=1;
	for(int i=1;i<M;i++) jc[i]=jc[i-1]*i%mo;
	n=read();
	for(int i=1,u,v;i<=n*2;i++)
	{
		u=read();v=read();
		add(u+n,v),add(v,u+n);
	}
	for(int i=1;i<=n*2;i++) if(!du[i]) {cout<<0<<endl;return 0;}
	work();
	return 0;
}

Measured memory_bytes: 30336
#include<iostream>
#include<map>
#include<set>

using namespace std;

int main(void){
  map<string, set<int> > m;
  map<string, set<int> >::iterator it;
  set<int>::iterator itr;
  string s;
  int n;

  while(cin>>s>>n){
    m[s].insert(n);
  }
  for(it=m.begin();it!=m.end();it++){
    cout <<(*it).first<<endl;
    for(itr=(*it).second.begin();itr!=(*it).second.end();itr++){
      cout<< *itr;
      itr++;
      if(itr!=(*it).second.end()){
	cout<<" ";
      }
      itr--;
    }
    cout <<endl;
  }
  
}

Measured memory_bytes: 3180
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<sstream>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<utility>
#include<numeric>
#include<algorithm>
#include<bitset>
#include<complex>

using namespace std;

typedef long long Int;
typedef vector<int> vint;
typedef pair<int,int> pint;
#define mp make_pair

template<class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cout << *i << " "; cout << endl; }
template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }
int in() { int x; scanf("%d", &x); return x; }

int m[200][200];

int main() {
	int t,n;
	while(cin>>t>>n,t){
		int i,j;
		for(i=0;i<200;i++){
			for(j=0;j<200;j++){
				m[i][j]=100100100;
			}
		}
		for(i=0;i<n;i++){
			int x,y;
			cin>>x>>y;
			x+=100;y+=100;
			m[y][x]=-1;
		}
		int sx,sy;
		cin>>sx>>sy;
		sx+=100;sy+=100;
		priority_queue<pair<int,pint> > q;
		q.push(mp(0,mp(sx,sy)));
		pair<int,pint> buf;
		int res=0;
		while(!q.empty()){
			buf=q.top();
			q.pop();
			if(m[buf.second.second][buf.second.first]<=buf.first)continue;
			if(buf.first>t)continue;
//cout<<buf.second.first<<" "<<buf.second.first<<" "<<buf.first<<endl;
			m[buf.second.second][buf.second.first]=buf.first;
			q.push(mp(buf.first+1,mp(buf.second.first+1,buf.second.second)));
			q.push(mp(buf.first+1,mp(buf.second.first-1,buf.second.second)));
			q.push(mp(buf.first+1,mp(buf.second.first,buf.second.second+1)));
			q.push(mp(buf.first+1,mp(buf.second.first,buf.second.second-1)));
			q.push(mp(buf.first+1,mp(buf.second.first+1,buf.second.second+1)));
			q.push(mp(buf.first+1,mp(buf.second.first-1,buf.second.second-1)));
		}
//for(i=90;i<110;i++){
//for(j=90;j<110;j++){
//cout<<j-100<<" "<<i-100<<" "<<m[i][j]<<endl;
//}
//}
		for(i=0;i<200;i++){
			for(j=0;j<200;j++){
				if(0<=m[i][j]&&m[i][j]<=t)res++;
			}
		}
		cout<<res<<endl;
	}
	return 0;
}

Measured memory_bytes: 1080
#include<cstdio>

int main(void){
  int n,i,j,k;
  int c[1000],s[1000],f[1000];
  int ans[1000]={};

  scanf("%d",&n);

  for(i=0;i<n-1;i++){
    scanf("%d %d %d",&c[i],&s[i],&f[i]);
  }
  c[i]=0;s[i]=0;f[i]=0;

  for(i=0;i<n-1;i++){
    ans[i]+=s[i];
    for(j=i;j<n-1;j++){
      k=0;
      while(ans[i]>s[j]+f[j]*k)
        k++;
      ans[i]=s[j]+f[j]*k+c[j];
    }
  }

  for(i=0;i<n;i++)
    printf("%d\n",ans[i]);

  return 0;
}


Measured memory_bytes: 128
#include<stdio.h>

int main(void){
    int n;
    scanf("%d", &n);
    int a[n];
    for(int i=0; i<n; i++) scanf("%d", &a[i]);
    for(int i=n-1; i>=0; i--){
        printf("%d", a[i]);
        if(i) printf(" ");
    }
    printf("\n");
    return 0;
}


Measured memory_bytes: 2040
H, W = map(int, input().split())
INF = 10000
G = [[INF] * 10 for _ in range(10)]
for i in range(10):
    G[i][i] = 0

for i in range(10):
    for j, n in enumerate(map(int, input().split())):
        G[i][j] = n

for k in range(10):
    for i in range(10):
        if G[i][k] == INF:
            continue
        for j in range(10):
            if G[k][j] == INF:
                continue
            G[i][j] = min(G[i][j], G[i][k] + G[k][j])

A = []
for h in range(H):
    A.append(list(map(int, input().split())))
# print(A)

# print(G)
magic = [INF] * 10
for i in range(10):
    magic[i] = G[i][1]
# print(magic)
ans = 0

for i in range(H):
    for j in range(W):
        if A[i][j] == -1:
            continue
        ans += magic[A[i][j]]
print(ans)


Measured memory_bytes: 3444
program main
     implicit none
     character*100 s,t
     integer i,a
     read(*,*)s
     read(*,*)t
     a=len_trim(s)
     do i=0,a
          if(i==0 .and. s(1:a)==t(1:a))then
               write(*,*)"Yes"
               goto 10
          endif
          
          if(i/=0 .and. s(i+1:a)==t(1:a-i).and. s(1:i)==t(a-i+1:a))then
               write(*,*)'Yes'
               goto 10
          endif
     enddo
     write(*,*)"No"
10 continue
end program main


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <queue>
#include <list>
#include <cmath>
#include <stack>
#include <deque>
#include <iomanip>

using namespace std;
typedef long long ll;
using Pll = pair<ll,ll>;

const ll INF = 1LL<<60;
const ll MOD = 1000000007;

//cout << fixed << setprecision(10);

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

    cout << N*N*N << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <stack> 
#include <map>
#include <queue>
#include <unordered_map>
#include <cassert>
#include <iomanip>
#include <cmath>
#include <cstring>
using namespace std;
#define pb 					push_back
#define FAST_IO          ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
template<typename T,typename S>
ostream& operator <<(ostream& os, pair<T, S> input) {
	os<<"("<<input.first<<", "<<input.second<<")";
	return os;
}
template<typename T>
ostream& operator <<(ostream& os, vector<T> input) {
	for(auto t: input)
		os << t <<"\n";
	return os;
}
template<typename T>
ostream& operator <<(ostream& os, set<T> input) {
	for(auto t: input)
		os << t <<"\n";
	return os;
}
long long a[200003];
int main() {
	//FAST_IO;
  	long long k, n;
	  cin >> k >> n;
  long long ans = 0;
  	for(int i=1; i<=n; i++) {
    	cin >> a[i];
    }
  for(int i=2; i<=n; i++)
    	ans = max(ans, a[i] - a[i-1]);
     ans= k- ans;
  ans = min(ans, a[n] - a[1]);
                  cout << ans<<"\n";
	return 0;
}


Measured memory_bytes: 1920
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int MOD = 1e9+7;
int32_t main() {
	ios::sync_with_stdio(0);cin.tie(0);
	int n;
	cin >> n;
	vector<int> arr(n);
	for(int i=0; i<n; i++) {
		cin >> arr[i];
	}
	int sum = accumulate(arr.begin(), arr.end(), 0ll) % MOD, ans = 0;
	for(int i=0; i<n; i++) {
		sum -= arr[i];
		sum += MOD;
		sum %= MOD;
		ans += arr[i] * sum;
		ans %= MOD;
	}
	cout << ans;
}

Measured memory_bytes: 4776
#include <bits/stdc++.h>
#define ll long long
#define re register
#define IL inline
using namespace std;
const int maxn=1e4+5;
const int maxd=100+5;
const int mod=1e9+7;
template<typename T> void fread(T &x){
	T f=1;x=0;
	char s=getchar();
	while(s<'0' || s>'9'){if(s=='-') f=-1;s=getchar();}
	while(s>='0' && s<='9'){x=(x<<3)+(x<<1)+s-48;s=getchar();}
	x*=f;
}
string s;
int d,pos[maxn];
ll dp[maxn][maxd];
ll dfs(int st,int sta,bool lim){
	if(st==s.size()) return dp[st][sta]=(sta==0);
	if(!lim && dp[st][sta]!=-1) return dp[st][sta];
	int up=lim?pos[st]:9;
	ll ret=0;
	for(re int i=0;i<=up;i++){
		(ret+=dfs(st+1,(sta+i)%d,lim&&(i==pos[st])))%=mod;
	}
	if(!lim) dp[st][sta]=ret;
	return ret;
}
int main(){
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	memset(dp,-1,sizeof dp);
	cin>>s>>d;
	for(re int i=0;i<s.size();i++) pos[i]=s[i]-'0';
	cout<<(dfs(0,0,1)-1+mod)%mod<<endl;
	return 0;
}


Measured memory_bytes: 12672
#include <iostream>
#include <algorithm>
using namespace std;
#define int long long

signed main() {
  int q, h, s, d;
  cin >> q >> h >> s >> d;
  int n;
  cin >> n;
  double v[4];
  v[0] = q / 0.25;
  v[1] = h / 0.5;
  v[2] = s / 1.0;
  v[3] = d / 2.0;
  int p = 0;
  for (int i = 1; i < 4; i++) {
    if (v[i] < v[p]) {
      p = i;
    }
  }
  int ans;
  if (p == 0) ans = n * q * 4;
  else if (p == 1) ans = n * h * 2;
  else if (p == 2) ans = n * s;
  else {
    ans = (n / 2) * d + (n % 2) * (min(q * 4, min(h * 2, s)));
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

n = int( input() )
fact = factorization(n)

cnt = 0
for f in fact:
  if f[0] == 1:
    continue
  fa = f[ 1 ]
  i = 1
  while fa > 0:
    fa -= i
    i += 1
    if fa >= 0:
      cnt += 1
    
print( cnt ) 

Measured memory_bytes: 9488
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <ctime>
#include <bitset>
#include <complex>
#include <chrono>
#include <random>
#include <functional>

using namespace std;

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

	int k;
	cin >> k;
	int c = 7 % k;
	for (int i = 1; i <= k; i++) {
		if (!c) {
			cout << i << '\n';
			return 0;
		}
		c *= 10;
		c += 7;
		c %= k;
	}
	cout << -1 << '\n';
}


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

using namespace std;

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

#define reps(i,f,n) for(int i = int(f); i <= int(n); i++)
#define rep(i,n) reps(i,0,int(n)-1)
#define rrep(i,n) for(int i = n-1; i >= 0; i--)

#define all(x) (x).begin(),(x).end()
#define X first
#define Y second

#define sz size()
#define eb emplace_back


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



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

#define rep(X,N) for(ll X = 0LL; X < (N); X++)
#define PI (acos(-1.0))
#define MODN 1000000007
#define MODN2 998244353
#define ALL(V) (V).begin(),(V).end()
#define INT_MAX_HALF (INT_MAX / 2)
#define EPS (1e-10)

using namespace std;
typedef long long ll;

int main(){

    string s;
    cin >> s;

    int ai, zi;

    rep(i, s.size()){
        if(s[i] == 'A'){
            ai = i;
            break;
        }
    }

    for(int i = s.size() - 1; i >= 0; i--){
        if(s[i] == 'Z'){
            zi = i;
            break;
        }
    }

    cout << zi - ai + 1 << endl;
    return 0;
}


Measured memory_bytes: 640
<?php

fscanf(STDIN,"%d",$N);
$a_list = array();

for($i=0;$i<$N;$i++){
    $a_list[] = explode(" ",trim(fgets(STDIN)));
}

$count_juge = 0;
$count = 0;

$people = $a_list[0][0];

$a_list[0][0] = "100000";

    for ($s = 1; $s <= $people; $s++) {
        for ($t = 0; $t < $N; $t++) {
            $a_list[$t][0] = "100000";
            if (in_array($a_list[0][$s], $a_list[$t])) {
                $count_juge++;
            }
        }
        if ($count_juge == $N) {
            $count++;
        }
        $count_juge =0;
    }


    echo $count."\n";

Measured memory_bytes: 4728
#![allow(unused_imports)]

use text_io::*;
use proconio::*;
use std::collections::*;
use std::process::exit;
use std::cmp::*;
use itertools::Itertools;
use num::*;


fn main() {
    input! {
    a:String,
    b:String,
  }
    let a=a.chars().collect_vec();
    let b=b.chars().collect_vec();
    let mut c=Vec::new();
    for i in 0..a.len()+b.len() {
        if i%2==0 {
            c.push(a[i/2])
        }
        else {
            c.push(b[i/2])
        }
    }
    let c:String=c.iter().collect();
    println!("{}",c)
}

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

int main(){
  int n,a;
  cin >>n>>a;
  vector<string> v(n);
  for(int i=0;i<n;i++){
    cin >> v.at(i);
  }
  sort(v.begin(),v.end());
  string ans="";
  for(int i=0;i<n;i++) ans +=v.at(i);
  cout << ans << endl;
}

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

using ll = long long;

int main() {
    ll a, n, m; cin >> a >> n >> m;
    int ans = 0;
    for(ll y = 1; ; ++y) {
        ll val = 1;
        for(int i = 0; val < m && i < n; ++i) val *= (y + a);
        if(val > m) break;
        int y2 = 0;
        while(val > 0) {
            y2 += val % 10;
            val /= 10;
        }
        ans += y == y2;
    }
    cout << ans << endl;
}



Measured memory_bytes: 3024
#include <bits/stdc++.h>
using namespace std;
#define dump(x) cout << (x) << '\n';
#define fi first
#define se second
typedef int64_t Int;
Int mod = 1e9+7;
Int INF = 1e9+7;

int main() {
    char a;
    bool end = false;
    stack<char> st;
    while (true) {
        a = getchar();
        
        if (a == '.') {
            if (end) {
                //dump("Yes");
                return 0;
            }
            else {
                dump(st.empty() ? "yes" : "no");
                end = true;
                while (!st.empty()) st.pop();
            }
        }
        else {
            if (a != '\n') end = false;
            if (a == '(') {
                st.push('(');
            }
            else if (a == '[') {
                st.push('[');
            }
            else if (a == ')') {
                if (!st.empty() && st.top() == '(') {
                    st.pop();
                    
                }
                else {
                    st.push(a);
                 //   dump("PO");
                }
            }
            else if (a == ']') {
                if (!st.empty() && st.top() == '[') {
                    st.pop();
                }
                else {
                    st.push(a);
                }
            }
        }
    }
    return 0;
} 


Measured memory_bytes: 3108
require "set"
x,n = gets.chomp.split(" ").map(&:to_i)
p_set = Set.new(gets.chomp.split(" ").map(&:to_i))

min = 999
diff = 999
(0..101).each do |i|
  next if p_set.include?(i)
  tmp_diff = (x - i).abs
  if tmp_diff < diff
    min = i
    diff = tmp_diff
  end
end

puts min


Measured memory_bytes: 14520
from itertools import combinations


def main():
    N = int(input())
    x = []
    y = []
    for _ in range(N):
        x_n, y_n = map(int, input().split())
        x.append(x_n)
        y.append(y_n)
    if N == 1:
        print(1)
        return
    comb = list(combinations([i for i in range(N)], 2))
    dic = {}
    for c in comb:
        i, j = c[0], c[1]
        dx = x[j] - x[i]
        dy = y[j] - y[i]
        if not (dx, dy) in dic.keys():
            dic[(dx, dy)] = 0
        if not (-dx, -dy) in dic.keys():
            dic[(-dx, -dy)] = 0
        dic[(dx, dy)] += 1
        dic[(-dx, -dy)] += 1
    dic_sorted = sorted(dic.items(), key=lambda x:x[1])[::-1]
    print(N - dic_sorted[0][1])
    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 3700
chr='abcdefghijklmnopqrstuvwxyz'
a=[0]*int(input())
while 1:
  print(''.join(chr[i]for i in a))
  if a==list(range(len(a))):break
  a[-1]+=1
  i=-1
  while a[i]-max(a[:i]+[0])>1:
    a[i]=0
    i-=1
    a[i]+=1

Measured memory_bytes: 4412
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <climits>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
#include <random>
#include <complex>
#include <regex>

using namespace std;

#define SHOW_VECTOR(v) {std::cerr << #v << "\t:";for(const auto& xxx : v){std::cerr << xxx << " ";}std::cerr << "\n";}
#define SHOW_MAP(v){std::cerr << #v << endl; for(const auto& xxx: v){std::cerr << xxx.first << " " << xxx.second << "\n";}}

constexpr int MAX_N = 100010;

struct edge {
    int to;
    int cost;
};

vector<edge> G[MAX_N];
constexpr int INF = INT_MAX;

void bfs(int v, vector<int> &dp, bool &good, int cost) {
    if (dp[v] != INF) {
        if (dp[v] != cost) good = false;
        return;
    }
    dp[v] = cost;
    for (int i = 0; i < G[v].size(); i++) bfs(G[v][i].to, dp, good, cost + G[v][i].cost);
}

int main() {

    int N, M;
    cin >> N >> M;

    for (int i = 0; i < M; i++) {
        int l, r, d;
        cin >> l >> r >> d;
        l--, r--;
        G[l].push_back({r, d});
        G[r].push_back({l, -d});
    }

    vector<int> dp(N, INF);
    bool good = true;
    for (int i = 0; i < N; i++) if (dp[i] == INF)bfs(i, dp, good, 0);

    cout << (good ? "Yes" : "No") << endl;

}













































Measured memory_bytes: 12928
#include <stdio.h>
#include <stdlib.h>
#define N 10000

int main()
{
  int i, j;
  int n, q;
  int nl[N], s;
  int count = 0;

  scanf("%d", &n);
  for(i = 0; i < n; i++)
    {
      scanf("%d", &nl[i]);
    }

  scanf("%d", &q);
  for(i = 0; i < q; i++)
    {
      scanf("%d", &s);
      for(j = 0; j < n; j++)
	{
	  if(s == nl[j]) 
	    {
	      count++;
	      break;
	    }
	}
    }
  printf("%d\n", count);

  return 0;
}

Measured memory_bytes: 640
import java.util.*;
import java.lang.*;
import java.io.*;

class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		Scanner scan = new Scanner(System.in);
    	String str = scan.next();

    	String[] strArraySub = str.split("");
    	int sval;
    	int val = strArraySub.length;
    	//System.out.println(val);
    	for (int i = 1; i <= val; i++) {
    		// "strArraySub"???1??????????????¨???
    		sval = val - i;
    		System.out.print(strArraySub[sval]);
    		
		}System.out.println("");
 
	}
}

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

using namespace std;

#define ll long long




void solve() {

	int n;
	cin >> n;
	int arr[n];	
	int cnt = 0;
	int mx = 0;
	for(int i = 0; i < n; i++) {
		cin >> arr[i];
	}
	for(int i = 1; i < n; i++) {
		if(arr[i] <= arr[i - 1]) {
			cnt++;
		}
		else {
			mx = max(mx, cnt);
			cnt = 0;
		}
	}
	mx = max(mx, cnt);
	cout << mx << "\n";
	




	
}

int main() {

	ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	solve();

	return 0;
}

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

int lcs(string s, string t){
        int a[s.size()+1][t.size()+1];
        for(int i=0;i<s.size()+1;i++) a[i][0]=0;
        for(int i=0;i<t.size()+1;i++) a[0][i]=0;
        for(int i=1;i<s.size()+1;i++){
                for(int j=1;j<t.size()+1;j++){
                        if(s[i-1]==t[j-1]) a[i][j] = a[i-1][j-1]+1;
                        else a[i][j] = max(a[i-1][j], a[i][j-1]);
                }
        }
        return a[s.size()][t.size()];
}

int main(){
        string s,t;
        int n;
        cin>>n;
        for(int i=0;i<n;i++){
                cin>>s>>t;
                cout<<lcs(s,t)<<endl;
        }
        return 0;
}


Measured memory_bytes: 6992
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const long long INF = 1LL << 60;

int main(){
    int N, x;
    cin >> N >> x;
    vector<int> a(N);
    for(int i=0; i<N; i++) cin >> a[i];
    ll count = 0;
    for(int i=0; i<N-1; i++) {
        if(a[i]+a[i+1] > x) {
            ll div = a[i]+a[i+1] - x;
            a[i+1] -= div;
            count += div;
            a[i+1] = max(0, a[i+1]);
        }
    }
    cout << count << endl;
}

Measured memory_bytes: 3712