akhauriyash/Code-Regression huggingface dataset:
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author aajisaka
 */

#include<bits/stdc++.h>

using namespace std;

void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

#define SPEED ios_base::sync_with_stdio(false);cin.tie(nullptr)
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

using ll = long long;
using P = pair<ll, ll>;

constexpr double PI = 3.14159265358979323846;
mt19937_64 engine(chrono::steady_clock::now().time_since_epoch().count());

class CLower {
public:
    void solve(istream& cin, ostream& cout) {
      SPEED;
      int n; cin >> n;
      vector<int> h(n);
      rep(i, n) {
        cin >> h[i];
      }
      int ans = 0;
      int now = 0;
      rep(i, n-1) {
        if (h[i] >= h[i+1]) {
          now++;
          chmax(ans, now);
        } else {
          now = 0;
        }
      }
      cout << ans << endl;
    }
};

signed main() {
  CLower solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  solver.solve(in, out);
  return 0;
}

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

string A, B;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin >> A >> B;
    bool flag = false;
    if(A.size()>B.size()){
        cout << "GREATER" << endl;
        flag = true;
    }else if(A.size()<B.size()){
        cout << "LESS" << endl;
        flag = true;
    }else{
        for(int i=0; i<(int)A.size(); i++){
            if(A[i]>B[i]){
                flag = true;
                cout << "GREATER" << endl;
                break;
            }else if(A[i]<B[i]){
                flag = true;
                cout << "LESS" << endl;
                break;
            }
        }
    }
    if(!flag) cout << "EQUAL" << endl;
    return 0;
}


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

#define rep(i,n) for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
#define NP next_permutation
#define pb push_back
#define eb emplace_back
#define lb(v,k) (lower_bound(all(v),k)-v.begin())
#define ub(v,k) (upper_bound(all(v),k)-v.begin())
#define fi first
#define se second
#define pi M_PI
typedef long long ll;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> PP;
typedef multiset<ll> S;
typedef priority_queue<ll> PQ;
typedef priority_queue<P,vector<P>,greater<P>> SPQ;
using vi=vector<ll>;
using vvi=vector<vi>;
using vvvi=vector<vvi>;

const ll inf=1001001001001001;
const int INF=1001001001;
const int mod=1000000007;

template<class T> bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class T> bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T> void decimal(T a){cout<<fixed<<setprecision(a);}
template<class T> void out(T a){cout<<a<<endl;}
template<class T> void outp(T a){cout<<'('<<a.fi<<','<<a.se<<')'<<endl;}
template<class T> void outvp(T v){rep(i,v.size())outp(v[i]);}
template<class T> void outv(T v){rep(i,v.size()){if(i)cout<<' ';cout<<v[i];}cout<<endl;}
template<class T> void outvv(T v){rep(i,v.size()){rep(j,v[i].size()){if(j)cout<<' ';cout<<v[i][j];}cout<<endl;}}

void YesNo(bool a){if(a) out("Yes"); else out("No");}
void yesno(bool a){if(a) out("yes"); else out("no");}
void YESNO(bool a){if(a) out("YES"); else out("NO");}
ll GCD(ll a,ll b){if(b==0) return a; return GCD(b,a%b);}
ll LCM(ll a,ll b){return(a/GCD(a,b))*(b/GCD(a,b))*GCD(a,b);}
ll POW(ll a,ll b){ll c=1; while(b>0){if(b&1){c=a*c %mod;}a=a*a %mod;b>>=1;}return c;}
vi calc(ll x){vi res; while(x>0){res.eb(x%10);x/=10;}reverse(all(res)); return res;}

vi x(200005,0);

void solve() {
  ll n; cin>>n;
  vi a(n); rep(i,n) cin>>a[i];
  rep(i,n) x[a[i]]++;
  ll p=0;
  rep(i,200005) p+=x[i]*(x[i]-1)/2;
  rep(i,n){
    out(p-(x[a[i]]-1));
  }
}

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


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

#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 fill0(n)  setfill('0') << right << setw(n)
#define all(x)  (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define LONGMAX 1e18
#define intMAX 1000000000
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod = 1e9+7;

int n,m;

int main(){
  cin >> n >> m;
  vector<int>p(m);
  vector<vector<int>>s(m);

  for(int i = 0; i < m; i++){
    int k;cin >> k;
    vector<int>v(k);
    for(int j = 0; j < k; j++){
      cin >> v[j];
      v[j]--;
    }
    s[i] = v;
  }
  for(int i = 0; i < m; i++)cin >> p[i];

  int ans = 0;
  for(int i = 0; i<(1 << n); i++){
    bool check = true;

    for(int j = 0; j < m; j++){ //switch j についての点灯状況を判断
      int c = 0;
      for(int k = 0; k < s[j].size(); k++){
        if((i >> s[j][k]) & 1)c++;
      }
      // cout <<"イテレーション: "<<i<<" スイッチ: "<<j+1 <<" ついている個数: " <<c << endl;
      c %= 2;
      if(c != p[j]) check = false;
    }
    if(check)ans++;
  }

  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cstdlib>
using namespace std;
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; }

const long long INF = 1e10;


// 入力
int N;
long long h[100010];

// DP テーブル
long long dp[100010];

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

    // 初期化 (最小化問題なので INF に初期化)
    for (int i = 0; i < 100010; ++i) dp[i] = INF;

    // 初期条件
    dp[0] = 0;

    // ループ
    for (int i = 1; i < N; ++i) {
        chmin(dp[i], dp[i - 1] + abs(h[i] - h[i - 1]));
        if (i > 1) chmin(dp[i], dp[i - 2] + abs(h[i] - h[i - 2]));
    }

    // 答え
    cout << dp[N-1]<< endl;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;
typedef long long ll;
using namespace std;
const ll mod=1000000007,mod9=1000000009;
template <class T>inline T lcm(T a,T b){return (a*b/__gcd(a,b));}
bool solve(ll n){
    ll index=2;
    while(n>1){
        if(index>500){
            return false;
        }
        if(n%index==0){
            n/=index;
            if(n%index==0){
                n/=index;
            }
            else{
                return false;
            }
        }
        else{
            index++;
        }
    }
    return true;
}
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,d;
    cin>>n>>d;
    ll a[n][d];
    for(int i=0;i<n;i++){
        for(int j=0;j<d;j++){
            cin>>a[i][j];
        }
    }
    ll ans=0;
    ll num;
    for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
            num=0;
            for(int k=0;k<d;k++){
                num+=(a[i][k]-a[j][k])*(a[i][k]-a[j][k]);
            }
            if(solve(num)){
                ans++;
            }
        }
    }
    cout << ans<<endl;
    return 0;
}




Measured memory_bytes: 256
#include <stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
 
int main() {
    int n;
    scanf("%d",&n);
    int a[n],b[n];
    int i;
    for(i=0;i<=n-1;i++)scanf("%d %d",&a[i],&b[i]);
    long long int ans=0;
    for(i=n-1;i>=0;i--){
        if((a[i]+ans)%b[i]!=0)ans+=b[i]-(a[i]+ans)%b[i];
    }
    printf("%lld",ans);
    return 0;
}

Measured memory_bytes: 896
using System;
using System.Linq;
using static System.Math;

class F
{
	static void Main()
	{
		var div = 360;
		var d = 2 * PI / div;
		var n = int.Parse(Console.ReadLine());
		var vs = new int[n].Select(_ => Console.ReadLine().Split().Select(int.Parse).ToArray()).ToArray();

		var mi = -1;
		var ms = 0.0;
		var mvs = new int[0][];
		for (var i = 0; i < div; i++)
		{
			var a = i * d;
			var vs2 = vs.Select(v => new { v, x = v[0] * Cos(a) + v[1] * Sin(a) }).Where(_ => _.x > 0).ToArray();
			var s = vs2.Sum(_ => _.x);
			if (ms < s) { mi = i; ms = s; mvs = vs2.Select(_ => _.v).ToArray(); }
		}
		double mx = mvs.Sum(v => v[0]);
		double my = mvs.Sum(v => v[1]);
		Console.WriteLine(Sqrt(mx * mx + my * my));
	}
}


Measured memory_bytes: 13652
#include <iostream>
using namespace std;
int main(void){
    string s;
    cin >>s;
    for(int i=0;i<s.length()-1;i++){
        for(int j=i+1;j<s.length();j++){
            if(s[i]==s[j]){
                cout <<"no"<<endl;
                return 0;
        
            }    
           
        }
    }
    cout <<"yes"<<endl;

    return 0;
    
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>
using namespace std;

int N, M;
long long TBD = -1e18;

bool dfs(int s, vector<long long>& x, vector<map<int, int>>& adj) {
    for (auto itr = adj[s].begin(); itr != adj[s].end(); ++itr) {
        int r = (*itr).first, d = (*itr).second;
        if (x[r] != TBD) {
            if (x[r] != x[s] + d) return false;
            continue;
        }
        x[r] = x[s] + d;
        if (!dfs(r, x, adj)) return false;
    }
    return true;
}

int main() {
    cin >> N >> M;
    vector<long long> x(N + 1, TBD);
    vector<map<int, int>> adj(N + 1);
    for (int i = 0; i < M; i++) {
        int l, r, d;
        cin >> l >> r >> d;
        adj[l][r] = d;
      	adj[r][l] = -d;
    }

    for (int i = 1; i <= N; i++) {
        if (x[i] != TBD) continue;
        x[i] = 0;
        bool flag = !dfs(i, x, adj);
        if (flag) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
}

Measured memory_bytes: 28160
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define sz(x) (int)(x).size()
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 1000000007;

int N;

void build(vi &segtree,int idx,int val) {
  int s = sz(segtree) - (N-idx);
  segtree[s] = val;
  while(1) {
    if(s == 0) break;
    s = (s-1)/2;
    segtree[s] = min(segtree[s*2+1],segtree[s*2+2]);
  }
}

int _query(vi &segtree,int a,int b,int idx,int l,int r) {
  if(a <= l && r <= b) return segtree[idx];
  if(r <= a || b <= l) return INF;
  int vl = _query(segtree,a,b,idx*2+1,l,(l+r)/2);
  int rl = _query(segtree,a,b,idx*2+2,(l+r)/2,r);
  return min(vl,rl);
}

int query(vi &segtree,int l,int r) {
  return _query(segtree,l,r+1,0,0,N);
}
  
int main() {
  int n,x;
  cin >> n >> x;
  vi a(n);
  rep(i,n) {
    cin >> a[i];
  }
  N = 1;
  int len = 1;
  while(N < n) {
    N *= 2;
    len += N;
  }
  vi segtree(len,INF);
  rep(i,n) {
    build(segtree,i,a[i]);
  }
  ll ans = LINF;
  rep(k,n) {
    ll sum = 0;
    rep(i,n) {
      if(k+i>=n) {
        int l = i;
        int r = n-1;
        int res = query(segtree,l,r);
        l = 0;
        r = (k+i)%n;
        res = min(res,query(segtree,l,r));
        sum += res;
      } else {
        sum += query(segtree,i,k+i);
      }
    }
    sum += 1ll * x * k;
    ans = min(ans,sum);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
X=int(input())
Day=["mon","tue","wed","thu","fri","sat","sun"]
a=X%7
if a==2 or a==3:
  print(Day[a+3])
elif a==4 or a==5 or a==6:
  print(Day[a-4])
elif a==0 or a==1:
  print(Day[a+3])
  



Measured memory_bytes: 5600
#include "stdio.h"

#define MAX 50
#define INIT -1

int dp[MAX];

int fibonacci(int n){
  if(n == 0 || n == 1){
    return dp[n] = 1;
  }

  if(dp[n] >= 0 ){
    return dp[n];
  }else{
    return dp[n] = fibonacci(n-1) + fibonacci(n-2);    
  }
}


int main(void){
  
  int N;
  scanf("%d", &N);
  
  for(int i=0;i<MAX;i++){
    dp[i] = INIT;
  }
    
  printf("%d\n", fibonacci(N));

  return 0;
}



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

#define EPS 1e-6
#define MOD 1000000007

#define fi first
#define se second
#define pb push_back
#define ende '\n'

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define mset(x, y) memset(&x, (y), sizeof(x))

using ll = long long;
using ii = pair<int, int>;
using vi = vector<int>;

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  
  int n;
  string s, t;
  cin >> n >> s >> t;
  for (int i = 0; i < n; i++) {
    cout << s[i] << t[i];
  }
  cout << ende;
  return 0;
}


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

int main(){
    char hoge[10];
    scanf("%s", hoge);

    if(strcmp(hoge, "Sunny") == 0){
        printf("Cloudy");
    }else if(strcmp(hoge, "Cloudy") == 0){
        printf("Rainy");
    }else{
        printf("Sunny");
    }
    return 0;
}

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

int main() {
  int N, K, S, M = 1e9-2007;
  cin >> N >> K >> S;
  for (int i = 0; i < K; i++) cout << S << "\n";
  for (int i = 0; i < N - K; i++) cout << M << "\n";
}

Measured memory_bytes: 1280
# コンビネーション
mod = 10**9+7
def cmb(n, r, mod=mod):
    ret = 1
    for k in range(1, r+1):
        ret = ret * (n-k+1) * mod_inv(k) % mod
    return ret

# modを取りながらべき乗する
def power_func(a,n,mod=mod):
    bi=str(format(n,"b"))#2進表現に
    res=1
    for i in range(len(bi)):
        res=(res*res) %mod
        if bi[i]=="1":
            res=(res*a) %mod
    return res

#互いに素なa,bについて、a*x+b*y=1の一つの解
def extgcd(a,b):
    r = [1,0,a]
    w = [0,1,b]
    while w[2]!=1:
        q = r[2]//w[2]
        r2 = w
        w2 = [r[0]-q*w[0],r[1]-q*w[1],r[2]-q*w[2]]
        r = r2
        w = w2
    #[x,y]
    return [w[0],w[1]]

# aの逆元(mod m)を求める。(aとmは互いに素であることが前提)
def mod_inv(a,m=mod):
    x = extgcd(a,m)[0]
    return (m+x%m)%m


import sys
input = sys.stdin.readline

N, A, B = map(int, input().split())
ans = (power_func(2, N) - 1 - cmb(N, A) - cmb(N, B))%mod
print(ans)

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

using namespace std;


int main(){
	long long W,H,x,y;
	cin>>W>>H>>x>>y;
	double s = (double)W*H/2;
	int b;
	
	if(W%2!=0||H%2!=0)
		b=0;
	if(W%2==0&&H%2==0)
	{
if(x==W/2&&y==H/2)
		b=1;
	else
	b=0;
	}
	printf("%.6f", s);
	cout <<" "<<b<<endl;
	
	return 0;
}
			

Measured memory_bytes: 256
n = int(input())
an= list(map(int, input().split()))
 
datas = [0] * (n+1)
for a in an:
    datas[a] += 1
 
ans = 0
for i in range(1,n+1):
    if datas[i] > 1:
        ans += datas[i] * (datas[i]-1)/2
ans = int(ans)
 
for k in range(0,n):
    if datas[an[k]] > 1:
        print(int(ans - datas[an[k]] * (datas[an[k]]-1)/2 + (datas[an[k]]-1) * (datas[an[k]]-2)/2))
    else:
        print(ans)

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


int main() {
    int x,n;
    int ans;
    vector<bool> v(199,false);

    cin >> x >> n;
    for (int i=0;i<n;i++) {
        int p;
        cin >> p;
        int tmp = p-x;
        if (tmp<0) tmp = (-2*tmp)-1;
        else tmp *= 2;
        v[tmp] = true;
    }
    for (int i=0 ; i<v.size(); i++){
        if (!v[i]) {
            // cout << i << endl;
            if (i%2 == 0){
                cout << x+i/2 << endl;
            } else {
                cout << x-(i+1)/2 << endl;
            }
            return 0;
        }
    }

    return 0;
}

Measured memory_bytes: 3628
using System;
using System.Globalization;

namespace AOJ0002
{
    class Program
    {
        static void Main()
        {
            string line;
            while ((line = Console.ReadLine()) != null)
            {
                var items = line.Split(' ');
                var a = int.Parse(items[0]);
                var b = int.Parse(items[1]);
                var apb = (a + b).ToString(CultureInfo.InvariantCulture);
                Console.WriteLine(apb.Length);
            }
        }
    }
}

Measured memory_bytes: 5636
//Love and Freedom.
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<cstring>
#define ll long long
#define inf 20021225
#define N 3100
#define mdn 1000000007
using namespace std;
int read()
{
	int s=0,t=1; char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')	t=-1; ch=getchar();}
	while(ch>='0' && ch<='9')	s=s*10+ch-'0',ch=getchar();
	return s*t;
}
int f[N][N],rt[N],sum[N],n,m;
char ch[N];
void upd(int &x,int y){x+=x+y>=mdn?y-mdn:y;}
int main()
{
	n=read(),m=read(); scanf("%s",ch+1);
	for(int i=1;i<=n;i++)	sum[i]=sum[i-1]+ch[i]-'0',rt[i]=i;
	rt[n+1]=n+1,sum[n+1]=sum[n];
	for(int i=1;i<=m;i++){int pos=read(); rt[pos]=max(read(),rt[pos]);}
	for(int i=1;i<=n;i++)	rt[i]=max(rt[i-1],rt[i]); f[1][sum[rt[1]]]=1;
	for(int i=1;i<=n;i++)	for(int j=0;j<n;j++)	if(f[i][j])
	{
		int l=rt[i]+1,r=rt[i+1],o=j,z=rt[i]+1-i-j;
		if(z)	upd(f[i+1][j+sum[r]-sum[l-1]],f[i][j]);
		if(o)	upd(f[i+1][j+sum[r]-sum[l-1]-1],f[i][j]);
	}
	printf("%d\n",f[n+1][0]);
	return 0;
}


Measured memory_bytes: 35712
#include <iostream>
#include <string>
#include <vector>

using namespace std;
int main(int argc, char const *argv[]) {
  string S;
  std::cin >> S;
  (stoi(S.substr(5, 2)) > 4)?std::cout << "TBD" << '\n':std::cout << "Heisei" << '\n';
  return 0;
}

Measured memory_bytes: 256
import java.io.*;

public class Main{
	public static void main(String[] args)throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] s = br.readLine().split(" ");
		int w = Integer.parseInt(s[0]);
		int h = Integer.parseInt(s[1]);
		int x = Integer.parseInt(s[2]);
		int y = Integer.parseInt(s[3]);
		int r = Integer.parseInt(s[4]);
		
		if(x-r<0||y-r<0||x+r>w||y+r>h)
			System.out.println("No");
		else
			System.out.println("Yes");
	}
}

Measured memory_bytes: 24388
#include <bits/stdc++.h>
using namespace std;
int main(){
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	if((a - 1) / d >= (c - 1) / b){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}
}

Measured memory_bytes: 3636
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Math;
public static class P
{
    public static void Main()
    {
        var nl = Console.ReadLine().Split().Select(int.Parse).ToArray();
        var n = nl[0];


        Console.WriteLine(string.Join("", Enumerable.Repeat(0, n).Select(_ => Console.ReadLine()).OrderBy(x => x)));
    }
}

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

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int n; cin>>n;
	vector<int> d(n);
	for (int i=0; i<n; i++) {
		cin>>d[i];
	}
	int ret=0;
	for (int i=0; i<n; i++) {
		for (int j=i+1; j<n; j++) {
			ret+=d[i]*d[j];
		}
	}
	cout<<ret<<endl;
	return 0;
}


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

using namespace std;
using ll = long long;

int main(){
    int n,m;
    cin >> n >> m;
    vector<int> h(n);
    for(int i = 0; i < n; i++) cin >> h[i];
    vector<bool> hb(n, true);
    for(int j = 0; j < m; j++){
        int a,b;
        cin >> a >> b;
        a--; b--;
        if(h[a] <= h[b]) hb[a] = false;
        if(h[a] >= h[b]) hb[b] = false;
    }
    int ans = 0;
    for(int i = 0; i < n; i++){
        if(hb[i]) ans++;
    }

    cout << ans << endl;
}

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

using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef vector< vector<int> > vvi;

#define INF 1000000000
#define MOD 1000000007
#define EPS 1e-9
#define DEBUG(x) cout<< '>' << #x << ':' << x << "\n";
#define all(x) (x).begin(), (x).end()
#define SORT(x) sort((x).begin(),(x).end())
#define UNIQUE(x) (x).erase(unique((x).begin(),(x).end()),(x).end())
#define tr(container, it) \
	for(typeof(container.begin()) it = container.begin(); it != container.end(); it++) 

// #define sz(a) int((a).size())
// #define pb push_back
// #define fill(a,v) memset(a,v,sizeof a)


#define trace(x) cout << '>' << #x << ':' << x << endl;
#define trace2(x,y) cout<< '>' << #x << ':' << x << " | " << #y << ':' << y << endl;

#define trace3(x,y,z) cout<< '>' << #x << ':' << x \
		<< " | " << #y << ':' << y <<" | " << #z << ':' << z << endl;

#define trace4(x,y,z,w) cout<< '>' << #x << ':' << x \
	<< " | " << #y << ':' << y <<" | " << #z << ':' << z << " | " << #w << ':' << w << endl;


inline int two(int n) { return 1 << n; }
inline int test(int n, int b) { return (n>>b)&1; }
inline void set_bit(int & n, int b) { n |= two(b); }
inline void unset_bit(int & n, int b) { n &= ~two(b); }
inline int last_bit(int n) { return n & (-n); }
inline int ones(int n) { int res = 0; while(n && ++res) n-=n&(-n); return res; }

const double pi = acos(-1);

/////////////////////////////////////////////////////////////////////

// bool sortbysec(const pair<int,int> &a,
//               const pair<int,int> &b)
// {
//     return !(a.first < b.first);
// }

ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; } // __gcd(0,0) gives exception


const int MAX_N = 1005;
 
int main(){
	int N;
	long long l,r,ans=0;
	scanf("%d",&N);
	for(int i=0;i<N;i++){
		scanf("%lld %lld",&l,&r);
		ans+=r-l+1;
	}
	printf("%lld\n",ans);
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
    #include <ext/pb_ds/assoc_container.hpp> 
    #include <ext/pb_ds/tree_policy.hpp> 
    using namespace std;
    using namespace __gnu_pbds; 
    #define lli long long int
    #define fr(i,a,b) for(lli i=a;i<b;i++)
    #define bfr(i,a,b) for(lli i=a;i>=b;i--)
    #define fio ios_base::sync_with_stdio(false); cin.tie(NULL),cout.tie(NULL);
    #define tc int t;cin>>t;while(t--)
    #define mod 1000000007LL
    #define mod2 998244353LL
    #define all(vec) vec.begin(),vec.end()  
    #define ld long double
    #define pb push_back

    #define ordered_set tree<lli, null_type,less<lli>, rb_tree_tag,tree_order_statistics_node_update> 


    int main()
    {
                           
             

             
                        
              fio

             lli a,b,c;
             cin>>a>>b>>c;
             swap(a,b);
             swap(a,c);
             cout<<a<<" "<<b<<" "<<c;




              
              
return 0;}

Measured memory_bytes: 256
package main

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

var sc = bufio.NewScanner(os.Stdin)

func Scanner() string {
	sc.Scan()
	return sc.Text()
}

func main() {
	buf := make([]byte, 0)
	sc.Buffer(buf, 1000000007)
	sc.Split(bufio.ScanWords)
	n, _ := strconv.Atoi(Scanner())
	ans := 0
	for i := 1; i <= n; i++ {
		for j := 1; j <= n; j++ {
			for k := 1; k <= n; k++ {
				ans += gcd(i, gcd(j, k))
			}
		}
	}
	fmt.Println(ans)
}
func gcd(a, b int) int {
	if b == 0 {
		return a
	}
	return gcd(b, a%b)
}


Measured memory_bytes: 1780
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
#include <utility>
#include <cmath>
#include <cstdlib>
#include <cstring>

#define INF_LL 9000000000000000000
#define INF 2000000000

#define REP(i, n) for(int i = 0;i < (n);i++)
#define FOR(i, a, b) for(int i = (a);i < (b);i++)

using namespace std;

typedef long long ll;
typedef pair<int, int> PII;
typedef pair<int, PII> PPII;
typedef pair<int, PPII> PPPII;

class Union_find{
private:
	vector<int> par;
	vector<int> rank;
	int n;

public:
	Union_find(int a){
		n = a;
		for(int i = 0;i < n;i++){
			par.push_back(i);
			rank.push_back(0);
		}
	}

	int find(int x){
		if(par[x] == x){
			return x;
		}else{
			return par[x] = find(par[x]);
		}
	}

	void unite(int x, int y){
		x = find(x);
		y = find(y);
		if(x == y) return;

		if(rank[x] < rank[y]){
			par[x] = y;
		}else{
			par[y] = x;
			if(rank[x] == rank[y]) rank[x]++;
		}
	}

	bool same(int x, int y){
		return find(x) == find(y);
	}
};

int main(void){
	int n;
	while(cin >> n && n){
		int m;
		int res = 0;
		string s;
		vector<int> ioi;
		cin >> m >> s;
		REP(i, s.size()){
			int cnt = 0;
			if(s[i] == 'O') continue;
			while(1){
				cnt++;
				if((cnt%2 == 0 && s[i+cnt] != 'I') || (cnt%2 == 1 && s[i+cnt] != 'O')){
					if(cnt%2 == 0) cnt--;
					if(cnt/2 > 0)
						ioi.push_back(cnt/2);
					i+=cnt-1;
					break;
				}
			}
		}
		REP(i, ioi.size()){
			if(ioi[i] >= n)
				res += ioi[i]-n+1;
		}
		cout << res << endl;
	}
}

Measured memory_bytes: 3900
#include<iostream>
#include<vector>
#include <queue>
#include<algorithm>
#define rep(i,n) for(int i(0);i<n;++i)
using namespace std;
typedef long long ll;

int main(){
    int n, m;
    cin >> n >> m;
    vector<vector<int>> jobs(m);
    rep(i,n){
        int a,b;
        cin >> a >> b;
        if(a>m) continue;
        jobs[m-a].push_back(b);
    }
    priority_queue<int> q;
    ll ans = 0;
    for(int i(m-1); i >=0; --i){
        for(int b : jobs[i]){
            q.push(b);
        }
        if(!q.empty()){
            ans += q.top();
            q.pop();
        }
    }
    cout << ans << endl;
    return 0;
}

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

using namespace std;

#define endl '\n'

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> pii;

ull mult_mod(ull a, ull b, ull M)
{
	ull q = (long double) a * (long double) b / (long double) M;
	ull r = a * b - q * M;
	return (r + 5 * M) % M;
}

ull pow_mod(ull a, ull n, ull m)
{
	ull ans = 1;
	while(n > 0)
	{
		if(n & 1)
			ans = mult_mod(ans, a, m);
		a = mult_mod(a, a, m);
		n >>= 1;
	}
	return ans;
}

bool witness(ull a, ull s, ull d, ull n)
{
	ull x = pow_mod(a, d, n);
	if (x == 1 || x == n - 1) return 0; 
	for(int i = 0; i < s - 1; i++)
	{
		x = mult_mod(x, x, n);
		if (x == 1) return 1; 
		if (x == n - 1) return 0; 
	}
	return 1;
}

bool miller_rabin(ull n) //return true if prime
{
	if (n < 2) return 0;
	if (n == 2) return 1;
	if (n % 2 == 0) return 0;
	ull d = n - 1, s = 0;
	while (d % 2 == 0) ++s, d /= 2;
	vector<ull> test = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 0};
	for (int i = 0; test[i] && test[i] < n; ++i)
		if (witness(test[i], s, d, n))
			return 0; 
	return 1;
}

ull pollard_rho(ull n) //n shouldn't be prime
{
	if(!(n & 1))
		return 2;

	if(miller_rabin(n))
		return n;

	while(1)
	{
		ull x = (ull)rand() % n, y = x;
		ull c = rand() % n;
		if(c == 0 || c == 2)
			c = 1;
		for(int i = 1, k = 2; ; i++)
		{
			x = mult_mod(x, x, n);
			if(x >= c)
				x -= c;
			else
				x += n - c;
			if(x == n)
				x = 0;
			if(x == 0)
				x = n - 1;
			else
				x--;
			ull d = __gcd(x > y ? x - y : y - x, n);
			if(d == n)
				break;
			if(d != 1)
				return d;
			if(i == k)
			{
				y = x;
				k <<= 1;
			}
		}
	}
	return 0;
}

map<ull, int> fact;

void factorize(ull n)
{
	if(n > 1)
	{
		ull x;
		while(!(x = pollard_rho(n)));

		if(x == n)
		{
			fact[n]++;
			return;
		}

		factorize(x);
		factorize(n / x);
	}
}

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

	ull n;
	cin >> n;
	factorize(n);
	cout << n << ":";
	for(auto cur : fact)
	{
		// cout << cur.first << "^" << cur.second << " ";
		for(int i = 0; i < cur.second; i++)
			cout << " " << cur.first;
	}
	cout << endl;
	
	
	return 0;
}

Measured memory_bytes: 1204
import java.util.Scanner;
 
public class Main
{
  public static void main(String args[])
  {
    Scanner std = new Scanner(System.in);
    int n = std.nextInt();
    
    while(true)
    {
      int count = 0;
        for(int i = 2; i < n; i++)
    	{
      		if(n % i == 0)
      		{
				count++;
      		}
    	}
      if(count == 0)
      {
        System.out.println(n);
        System.exit(0);
      }
      n++;
    }
  }
}

Measured memory_bytes: 22868
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <math.h>

using namespace std;

typedef long long ll;

string beautify(string str) {
	string ret = "";
	for (int i = 0; i < str.size(); ++i) {
		char c = str[i];
		if ('a' <= c && c <= 'z') ret += c;
		else if ('A' <= c && c <= 'Z') ret += (char)(c-'A'+'a');
	}
	return ret;
}

class Dice {
private:
	int v[6];

public:
	int GetTop() { return v[0]; }
 	int GetFront() { return v[1]; }
	int GetRight() { return v[2]; }
	int GetLeft() { return v[3]; }
	int GetBack() { return v[4]; }
	int GetBottom() { return v[5]; }
	void Rotate(char op) {
		int newV[6];
		switch (op) {
		case 'N':
			newV[0] = v[1];
			newV[1] = v[5];
			newV[2] = v[2];
			newV[3] = v[3];
			newV[4] = v[0];
			newV[5] = v[4];
			break;

		case 'S':
			newV[0] = v[4];
			newV[1] = v[0];
			newV[2] = v[2];
			newV[3] = v[3];
			newV[4] = v[5];
			newV[5] = v[1];
			break;

		case 'E':
			newV[0] = v[3];
			newV[1] = v[1];
			newV[2] = v[0];
			newV[3] = v[5];
			newV[4] = v[4];
			newV[5] = v[2];
			break;

		case 'W':
			newV[0] = v[2];
			newV[1] = v[1];
			newV[2] = v[5];
			newV[3] = v[0];
			newV[4] = v[4];
			newV[5] = v[3];
			break;
		}
		for (int i = 0; i < 6; ++i) v[i] = newV[i];
	}
	void Spin(char op) {
		switch (op) {
		case 'R':
			Rotate('N');
			Rotate('E');
			Rotate('S');
			break;

		case 'L':
			Rotate('N');
			Rotate('W');
			Rotate('S');
			break;
		}
	}
	Dice(int v1, int v2, int v3, int v4, int v5, int v6) {
		v[0] = v1;
		v[1] = v2;
		v[2] = v3;
		v[3] = v4;
		v[4] = v5;
		v[5] = v6;
	}
	Dice() {}

	bool IsLike(Dice& d);
};
bool operator ==(Dice& d1, Dice &d2) {
	return
		   d1.GetTop() == d2.GetTop()
		&& d1.GetFront() == d2.GetFront()
		&& d1.GetRight() == d2.GetRight()
		&& d1.GetLeft() == d2.GetLeft()
		&& d1.GetBack() == d2.GetBack()
		&& d1.GetBottom() == d2.GetBottom();
}
bool Dice::IsLike(Dice& d) {
	bool ret = false;
	for (int k = 0; k < 4; ++k) {
		for (int i = 0; i < 4; ++i) {
			for (int j = 0; j < 4; ++j) {
				if (*this == d) ret = true;
				Rotate('N');
			}
			Spin('R');
		}
		Rotate('E');
	}
	return ret;
}

Dice InputDice() {
	int v[6];
	for (int i = 0; i < 6; ++i) cin >> v[i];
	return Dice(v[0], v[1], v[2], v[3], v[4], v[5]);
}

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

	vector<Dice> v;
	for (int i = 0; i < n; ++i) v.push_back( InputDice() );

	bool ans = true;
	for (int i = 0; i < n; ++i) {
		for (int j = i+1; j < n; ++j) {
			if ( v[i].IsLike(v[j]) ) {
				ans = false;
			}
		}
	}

	cout << (ans ? "Yes" : "No") << endl;
}

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

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

#define pb push_back
#define in ,
#define rep(i, a, n) for(int i = (a); i < (n); i++)
#define dep(i, a, n) for(int i = (a); i >= (n); i--)
#define mod 1e9+7

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}


int main() {
  int n;
  while(cin >> n) {
    if(n == 0) return 0;
    double y;
    double mg = 0, mi;
    cin >> y;
    rep(i, 0, n) {
      double b, r, t;
      cin >> b >> r >> t;
      double l = r / 100;
      double s = 1;
      if(t == 1) s = 1 + y * l;
      else rep(i, 0, y) s *= 1 + l;
      if(s > mg) {
        mg = s;
        mi = b;
      }
    }

    cout << mi << endl;
  }
}

Measured memory_bytes: 3220
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;
using ll = long long;
using P  = pair<int,int>;
using vi = vector<int>;
using vv = vector<vi>;

int main(){
    int h,w,ch,cw,dh,dw;
    cin >> h >> w;
    cin >> ch >> cw >> dh >> dw;
    ch--; cw--; dh--; dw--;
    vector<string> s(h);
    rep(i,h)cin>>s[i];
    
    deque<P> q;
    q.push_front(P(ch,cw));
    vv check(h, vi (w,-1));
    check[ch][cw] = 0;
    
    while(!q.empty()){
        int pi = q.front().first;
        int pj = q.front().second;
        q.pop_front();
        
        for(int i=-2; i<=2; i++){
            for(int j=-2; j<=2; j++){
                if(!i && !j)continue;
                int ni = pi + i;
                int nj = pj + j;
                if(ni<0 || ni>=h || nj<0 || nj>=w)continue;
                if(s[ni][nj]=='#')continue;
                if(check[ni][nj]>=0 && check[ni][nj]<=check[pi][pj])continue;
                if(abs(i)+abs(j)==1){
                    check[ni][nj] = check[pi][pj];
                    q.push_front(P(ni,nj));
                }else{
                    if(check[ni][nj] == check[pi][pj]+1)continue;
                    check[ni][nj] = check[pi][pj]+1;
                    q.push_back(P(ni,nj));
                }
            }
        }
    }
    cout<<check[dh][dw]<<endl;
    return 0;
}

Measured memory_bytes: 9524
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a;
	cin>>a;
	int ans=1;
	for(int i=2;i<a;i++)
	{
		int b=i*i;
		while(b<=a)
		{
			if(ans<b)
			ans=b;
			b*=i;
		}
	}
	cout<<ans;
	return 0;
 } 

Measured memory_bytes: 256
x,k,d=input().split(" ")
x=int(x)
k=int(k)
d=int(d)
x=abs(x)
if x>k*d:
    print(x-k*d)
else:
    t=x//d
    x=x%d
    k-=t
    if k%2==1:
        print(d-x)
    else:
        print(x)

Measured memory_bytes: 61836
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i,n) for(int i=0, i##_len=(int)(n); i<i##_len; i++)
#define reps(i,n) for(int i=1 , i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;i--)
#define rreps(i,n) for(int i=((int)(n));i>0;i--)
#define repi(i,x) for(auto i=(x).begin(),i##_fin=(x).end();i!=i##_fin;i++)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define solve(a) ((a)?"Yes":"No")
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef pair<int , int> Pi;
typedef vector<Pi> VPi;
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long , long long> P;
typedef vector<P> VP;
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;}
const long long INFLL = 1LL<<60;
const int INF = 1<<30;
const double PI=acos(-1);
int main(){
	int a,b;
	int ans=0;
	cin >>a>>b;
	cout<<(a+b+1)/2<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int N = 100100;
const int mod = 1e9+7;
ll n,k;
vector<ll> edge[N];
//ll fa[N];
bool vis[N];
ll tot;
ll child[N]; 
bool flag;
void getbrother()
{
	child[1]=edge[1].size();
	for(int i=2;i<=n;i++)
		child[i]=edge[i].size()-1;
}
void dfs(int node, int depth)
{
	vis[node]=true;
	int brother = child[node]-1;
	int now = -1;
	for(int i=0;i<edge[node].size();i++)
	{
		ll v = edge[node][i];
		if(vis[v])	continue;
		dfs(v,depth+1);
		now++;
		if(!flag)	return;
		ll fa = depth==1? 1:2;
		if(k-brother-fa<0)
		{
			flag=false;
			return ;
		}	
		tot = (tot*(k-now-fa))%mod;
	}
	return ;
}
int main()
{
	scanf("%lld%lld",&n,&k);
	ll u,v;
	for(int i=1;i<n;i++)
	{
		scanf("%lld%lld",&u,&v);
		edge[u].push_back(v);
		edge[v].push_back(u);
	}
	memset(vis,false,sizeof(vis));
	tot = k;
	getbrother();
	flag=true; 
	dfs(1,1); 
	if(!flag)	printf("0\n");
	else printf("%lld\n",tot); 
	return 0;
}

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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define RFOR(i,n,m) for(int i=(int)(n); i>=(int)(m); i--)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

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

#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

struct Plane{
    int x,y;
    inline int sum(){return x+y;}
};

bool cmp1(const Plane &a, const Plane &b){return (a.y!=b.y)?(a.y<b.y):(a.x<b.x); }

bool cmp2(Plane &a, Plane &b){return (a.sum()!=b.sum())?(a.sum()<b.sum()):(a.x<b.x); }

const int INF = INT_MAX;
const int X_MAX = 200020;
const string str = "LDRU";
vector<Plane> ps[4];

void rotate(){
    rep(i,4)for(auto &p:ps[i]) swap(p.x, p.y), p.x=-p.x;
    rep(i,3) ps[3-i].swap(ps[2-i]);
}

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

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N; cin>>N;
    int ans=INF;
    rep(i,N){
        int x,y; string u; cin>>x>>y>>u;
        int idx = str.find(u);
        ps[idx].pb({x,y});
    }
    rep(i,4){
        int M=ps[0].size();
        if (M==0){rotate(); continue;}
        // L-R
        sort(all(ps[0]),cmp1); sort(all(ps[2]),cmp1);
        int j=0;
        for(auto p:ps[2]){
            while(j<M && cmp1(ps[0][j],p)) j++;
            if (j==M) break;
            if (ps[0][j].y!=p.y) continue;
            chmin(ans,(ps[0][j].x-p.x)*5);
        }
        // L-D
        j=0;
        sort(all(ps[0]),cmp2); sort(all(ps[1]),cmp2);
        for(auto p:ps[1]){
            while(j<M && cmp2(ps[0][j],p)) j++;
            if (j==M) break;
            if (ps[0][j].sum()!=p.sum()) continue;
            chmin(ans,(ps[0][j].x-p.x)*10);
        }
        rotate();
    }
    if (ans==INF){
        cout<<"SAFE\n";
    }else{
        cout<<ans<<endl;
    }
    return 0;
}


Measured memory_bytes: 5792
str = gets.split
T1,T2 = str[0].to_i, str[1].to_i
str = gets.split
a1,a2 = str[0].to_i, str[1].to_i
str = gets.split
b1,b2 = str[0].to_i, str[1].to_i
if T1*a1 + T2*a2 == T1*b1 + T2*b2
    puts "infinity"
    exit
end
if (a1-b1) * (a2-b2) > 0
    puts 0
    exit
end
if a1 < b1
    swap = a1
    a1 = b1
    b1 = swap
    swap = a2
    a2 = b2
    b2 = swap
end
if a1*T1 + a2*T2 > T1*b1 + T2*b2
    puts 0
    exit
end
dif1 = T1*a1 - b1*T1
dif2 = T1*b1 + T2*b2 - a1*T1 - a2*T2
answer = (dif1/dif2)*2 + 1
if dif1%dif2 == 0
    answer -= 1
end
puts answer

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

using namespace std;

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

  string ret="Yes";
  int t[2]={0},x[2]={0},y[2]={0};
  for(int i=0;i<N;i++)
  {
    cin>> t[0]>> x[0]>> y[0];
    int ti=abs(t[0]-t[1]);
    int far=abs(x[0]-x[1])+abs(y[0]-y[1]);
    if(ti<far)ret="No";
    else
    {
      if((far-ti)%2)ret="No";
    }
    t[1]=t[0];
    x[1]=x[0];
    y[1]=y[0];
  }
  cout<< ret<< endl;

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<cstdlib>
#include<tuple>
#include<iomanip>
#include<map>
#include<queue>
#include<set>
#define int long long
using namespace std;
const int INF = 1e10;
const int ZERO = 0;

signed main() {
	int N;
	cin >> N;
	vector<int> vec;
	int cnt = 0;
	int cnt2;
	for(int i = 1;i <= N;i++) {
		cnt += i;
		if(cnt >= N) {
			cnt2 = i;
			break;
		}
	}
	if(cnt == N) {
		for(int i = 1;i <= cnt2;i++) {
			cout << i << endl;
		}
	}
	else {
		cnt = cnt - N;
		for(int i = 1;i <= cnt2;i++) {
			if(i == cnt) {
				continue;
			}
			cout << i << endl;
		}
	}
}

Measured memory_bytes: 256
// AOJ Volume 0 Problem 0054

#include <stdio.h>

int main(void)
{
    int a, b, n, s;
    
    while (scanf("%d%d%d", &a, &b, &n) != EOF){
        a %= b;
        
        s = 0;
        while (n > 0){
            s += a * 10 / b;
            a = (a * 10) % b;
            n--;
        }
    
        printf("%d\n", s);
    }

    return (0);
}

Measured memory_bytes: 0
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <vector>
#include <queue>
#include <iostream>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <stack>
#include <sstream>

using namespace std;

#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define PB push_back


typedef long long int ll;
typedef pair<int, int> Pii;
typedef pair<int, double> Pid;
typedef pair<double, int> Pdi;
typedef pair<double, double> Pdd;
typedef pair<ll, ll> P;
typedef pair<P, ll> PP;


const ll mod = 1e9+7;
const ll INF = 2e9;
const double epsilon = 1e-7;
const double PI = 3.1415926535;

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



int main(){
  int n;
  int m,x;
  vector<int> a;
  cin>>n;
  rep(i,n){
    cin>>m;
    if(m==0){
        cin>>x;
        a.PB(x);
    }else if(m==1){
        cin>>x;
        cout<<a[x]<<endl;
    }else{
        a.pop_back();
    }
  }
}



Measured memory_bytes: 3844
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <queue>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double

const double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;
const int mod=1000000007;


//mod演算ライブラリ
//mod=1000000007

LL add(LL a,LL b){
  return (a+b)%mod;
}

LL sub(LL a,LL b){
  return (a+mod-b)%mod;
}

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

LL power(LL x,LL y){//繰り返し二乗法 単品利用可
  if(y==0)return 1;
  else if(y==1)return x%mod;
  else if(y%2==0){
    LL tmp=power(x, y/2) % mod;
    return tmp*tmp%mod;
  }else {
    LL tmp=power(x, y/2) % mod;
    return ((tmp*tmp)%mod)*x%mod;
  }
}

LL dvs(LL a,LL b){
  return mul(a,power(b,mod-2));
}

const int SIZE_mod=200005;
int invfact[SIZE_mod];
int fact[SIZE_mod];

LL factset(int a){//aまでの階乗%mod表を作成
  fact[0]=1;
  FORQ(i,1,a){
    fact[i]=mul(fact[i-1],i);
  }
}

LL cmbset(int a){//1~aまでの階乗と階乗数の逆元のmod(mod)を用意 O(a)
  factset(a);
  invfact[a]=power(fact[a],mod-2);
  invfact[0]=1;
  FORD(i,a,1){
    invfact[i]=mul(invfact[i+1],i+1);
  }

}

LL cmb(int n,int r){//nCr%mod  (cmbset後に使用)
  if(n<r||r<0||n<0)return 0;
  return mul(fact[n],mul(invfact[r],invfact[n-r]));
}

LL prm(int n,int r){//nPr%mod
    return mul(cmb(n,r),fact[n]);
}

LL homo(int n,int r){//nHr%mod
  return cmb(n+r-1,r);
}


int main(){
	int n;
	cin>>n;
	string s;
	cin>>s;
	map<char,int> mp;
	FOR(i,0,n){
		mp[s[i]]++;
	}
	LL ans=1;
	for(const auto& x:mp){
		ans=mul(x.ND+1,ans);
	}
	ans=sub(ans,1);
	cout<<ans<<endl;


    return 0;
}


Measured memory_bytes: 512
package main

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

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

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

func main() {
	sc.Split(bufio.ScanWords)

	H := getInt()
	A := getInt()

	ans := H / A
	if H%A != 0 {
		ans++
	}
	out(ans)
}


Measured memory_bytes: 640
#include <algorithm>
#include <bitset>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/range/irange.hpp>
#include <cmath>
#include <map>
#include <numeric>
#include <iostream>
#include <string>
#include <vector>

using namespace std;
namespace mp = boost::multiprecision;
typedef long long ll;
const ll M = 1000000007;

int main(){
	int n=1;
	cin >> n;
	string s;
	cin >> s;

	// A = 65
	// Z = 90
	for (int i = 0; i < s.length(); ++i) {
		char c = s[i];
		if (c + n > 90) {
			cout << (char)((c + n - 90) + 64);
		} else {
			cout << (char)(c + n);
		}
	}

	return 0;
}


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

int dice[7];
void turn(int i, int j, int k, int l){
  int tmp=dice[l];
  dice[l]=dice[k];
  dice[k]=dice[j];
  dice[j]=dice[i];
  dice[i]=tmp;
}

int main(){
  while(1){
    int n;
    cin >> n;
    if(n==0) break;

    for(int i=1; i<=6; i++) dice[i]=i;
    int sum=1;
    for(int i=0; i<n; i++){
      string str;
      cin >> str;
      if(str=="North") turn(1,5,6,2);
      if(str=="East") turn(1,3,6,4);
      if(str=="West") turn(1,4,6,3);
      if(str=="South") turn(1,2,6,5);
      if(str=="Right") turn(2,4,5,3);
      if(str=="Left") turn(2,3,5,4);
      sum += dice[1];
    }
    cout << sum << endl;
  }
  return 0;
}

Measured memory_bytes: 3024
#include<iostream>
#include<vector>
using namespace std;
vector<long long> v;
int main(){
	int i=1,n;
	long long sum=0;
	while(1){
		if(v.size()==1000000)break;
		if(!(i%3==0||i%5==0))sum+=i,v.push_back(sum);
		else v.push_back(sum);
		i++;
	}
	cin>>n;
	cout<<v[n-1]<<'\n';
} 

Measured memory_bytes: 11496
#include <cstdio>
#include <string>
#include <iostream>
#include <math.h>

using namespace std;





int main(void){

    

    long n,k;
    cin >>n>>k;
    long ans;

    int *a = new int[n];
    int i;
    for(i = 0; i < n; i++) cin>>a[i];

    int c = 0;
    int *arr = new int[n];
    for(i = 0; i < n; i++) {
        arr[i] = -1;
    }
    arr[0] = 0;
    for(i = 0; i < k; i++) {
        c = a[c]-1;
        if(arr[c]!=-1) break;
        arr[c] = i+1;
    }
    int r,t;
    if(i!=k) {
        t = arr[c];
        r = (k-t)%(i+1-t);
    
        for(i = 0; i < r; i++) {
            c = a[c]-1;
        }
    }


    cout<< c+1;


    return 0;
}

Measured memory_bytes: 5156
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(v) v.begin(), v.end()
typedef long long ll;
 
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
 
#include <bits/stdc++.h>
using namespace std;

int gcd(int x,int y){
  int r;
  if(x<y) swap(x,y);
  
  while(y>0){
    r=x%y;
    x=y;
    y=r;
  }
  
  return x;
}
  
int main(){
  int x,y;
  cin>>x>>y;
  
  cout<<gcd(x,y)<<endl;
      
  return 0;
}


Measured memory_bytes: 3104
k['( '],n,a,b,i,m;z;p(int*x){z=*x-*1[&x];}main(c){for(scanf("%d%d%d%d",&n,&a,&b,&c);i<n;scanf("%d",k+i++));for(qsort(k,n,4,p);~i;a+=b,c+=k[--i])m=fmax(m,c/a);a=!printf("%d\n",m);}

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

int main() {
	int n, q; cin >> n >> q;
    vector<int> g[n];
    for (int i = 0; i < n - 1; i++)
    {
        int a, b; cin >> a >> b;
        a--, b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    vector<int> counter(n, 0);
    for (int i = 0; i < q; i++)
    {
        int p, x; cin >> p >> x; p--;
        counter[p] += x;
    }

    queue<int> que;
    vector<bool> seen(n, false);
    que.push(0);
    seen[0] = true;
    while (!que.empty())
    {
        int v = que.front(); que.pop();
        for (auto next_v : g[v])
        {
            if(seen[next_v]) continue;
            seen[next_v] = true;
            counter[next_v] += counter[v];
            que.push(next_v);
        }
    }

    for (int i = 0; i < n; i++)
    {
        cout << counter[i];
        if(i == n - 1) cout << endl;
        else cout << " ";
    }

	return 0;
}


Measured memory_bytes: 15604
import java.util.*

fun main(args: Array<String>) {
    val scanner = Scanner(System.`in`)
    val num = scanner.nextInt()
    val s = Array(num, {""})
    var sum = num
    for(i in 0..num-1) {
        s[i] = scanner.next()
    }
    s.sort()
    var count = 0
    for(i in 1..num-1) {
        //println(s[i])
        if(s[i] == s[i-1]) {
            count++
            continue
        }
        else{
          if(count != 0){
            sum -= count
            count = 0
          }
        }
    }
    println(sum-count)

}

Measured memory_bytes: 73712
import collections

n = int(input())
lst = [int(s) for s in input().split()]

is_success = True

if n % 2 == 1:
    is_success = lst.count(0) == 1

counters = collections.Counter(lst)

for i in range(n - 1, 0, -2):
    if counters[i] != 2:
        is_success = False
        break

if is_success:
    tmp = 1

    for _ in range(n // 2):
        tmp *= 2
        tmp %= 10 ** 9 + 7

    print(tmp)
else:
    print(0)


Measured memory_bytes: 14820