akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <sstream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <iterator>
#include <bitset>
#include <ctime>
using namespace std;

#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define RFOR(i,b,a) for (int i = (b)-1; i >= (a); i--)
#define ITER(it,a) for (__typeof(a.begin()) it = a.begin(); it != a.end(); it++)
#define FILL(a,value) memset(a, value, sizeof(a))

#define SZ(a) (int)a.size()
#define ALL(a) a.begin(), a.end()
#define PB push_back
#define MP make_pair

typedef long long LL;
typedef vector<int> VI;
typedef pair<int, int> PII;

const double PI = acos(-1.0);
const int INF = 1000 * 1000 * 1000 + 7;
const LL LINF = INF * (LL) INF;

const int MAX = 7 * 100 * 1000 + 47;
const double EPS = 1e-8;
const int MOD = 1000 * 1000 * 1000 + 7;

int X[MAX], D[MAX];


int main()
{
    int n, l, t;
    scanf("%d%d%d", &n, &l, &t);
    FOR(i, 0, n)
    {
        scanf("%d%d", X + i, D + i);
    }
    int pos = 0;
    FOR(i, 0, n)
    {
        if (D[i] == 1)X[i] = (X[i] + t);
        else X[i] = (X[i] - t);

        if (X[i] > 0)pos += X[i] / l;
        else if (X[i] < 0)pos += (X[i]+1)/l-1;

        X[i] = (X[i] % l + l) % l;
    }
    pos = (pos % n + n) % n;
    sort(X, X + n);
    FOR(i, 0, n)
        printf("%d\n", X[(pos+i)%n]);
}

Measured memory_bytes: 3584
import Control.Applicative ((<$>), (<*>))
import Control.Monad
import Data.List

main :: IO ()
main = do
  unwords . map show . solve <$> getl (wrds toInt) >>= putStrLn
  unwords . map show . solve <$> getl (wrds toInt) >>= putStrLn
  unwords . map show . solve <$> getl (wrds toInt) >>= putStrLn

solve :: [Int] -> [Int]
solve [h1,m1,s1,h2,m2,s2] = [dt `div` 3600, dt `mod` 3600 `div` 60, dt `mod` 60]
  where
    dt = 3600 * (h2 - h1) + 60 * (m2 - m1) + s2 - s1

toInt :: String -> Int
toInt = read

wrds :: (String -> a) -> String -> [a]
wrds f = map f . words

getl :: (String -> a) -> IO a
getl f = f <$> getLine

Measured memory_bytes: 3772
#include <iostream>
#include <string>

using namespace std;

int main(void){
	int p,c;

	for(int n,r;cin >> n >> r,n||r;){
		string card;

		for(int i=0;i<n;i++)
			card+=(n-i+0x30);

		for(int i=0;i<r;i++){
			cin >> p >> c;
			card = card.substr(p-1,c)+card.substr(0,p-1)+card.substr(p+c-1);
		}

		cout << (int)card[0]-0x30 << endl;
	}

	return 0;
}

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

using namespace std;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
template<class T> inline T sqr(T x) {return x*x;}

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;

#define all(a)  (a).begin(),(a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define pb push_back
#define mp make_pair
#define each(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define exist(s,e) ((s).find(e)!=(s).end())
#define range(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  range(i,0,n)
#define clr(a,b) memset((a), (b) ,sizeof(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

const double eps = 1e-10;
const double pi  = acos(-1.0);
const ll INF =1LL << 62;
const int inf =1 << 29;

//(襲われた数, 宿, 所持金)
typedef pair<int, pii> State;

#define F first
#define S second

int main(void){
    for(int n, m, l; cin >> n >> m >> l, n;){
        
        //(次の宿, 長さ, 刺客の数)
        vector<vector<pair<int, pii>>> edge(n);

        rep(i, m){
            int a, b, d, e; cin >> a >> b >> d >> e;
            a--, b--;

            edge[a].pb(mp(b, mp(d, e)));
            edge[b].pb(mp(a, mp(d, e)));
        }

        priority_queue<State, vector<State>, greater<State>> q;
        q.push(mp(0, mp(0, l)));

        //key: (宿, 所持金), val: (襲われた数)
        vvi minCost(n, vi(l + 1, inf));

        while(!q.empty()){
            int cur_cost = q.top().F;
            int cur_v = q.top().S.F;
            int cur_money = q.top().S.S;
            q.pop();

            if(minCost[cur_v][cur_money] != inf) continue;
            minCost[cur_v][cur_money] = cur_cost;

            for(pair<int, pii> e : edge[cur_v]){
                int next_v = e.F;
                int d_money = e.S.F;
                int d_cost = e.S.S;

                int next_money = cur_money;
                int next_cost = cur_cost + d_cost;
                rep(i, 2){
                    if(next_money < 0) break;

                    q.push(mp(next_cost, mp(next_v, next_money)));

                    next_money -= d_money;
                    next_cost -= d_cost;
                }
            }
        }

        int res = inf;
        for(int c : minCost[n - 1]){
            res = min(res, c);
        }

        cout << res << endl;
    }

	return 0;
}

Measured memory_bytes: 11880
#include <iostream>
#include <string>

using namespace std;

int main(void){
  int counter=0;
  string S,T;
  cin >> S >> T;

  for(int i=0; i<S.size(); i++){
    if(S[i] == T[i]){
      counter++;
    }
  }
  if(counter == S.size()){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 3624
# coding: utf-8
# Your code here!
S=list(input())
K=int(input())

flag=True
for i in range(len(S)-1):
    if S[i+1]!=S[i]:
        flag=False
        break

if flag and K>1:
    S*=2
    for i in range(len(S)-1):
        if S[i+1]==S[i]:
            S[i+1]="?"
    temp=S.count("?")
    print(K//2*temp+(temp//2 if K%2==1 else 0))
    exit()

if K==1:
    for i in range(len(S)-1):
        if S[i+1]==S[i]:
            S[i+1]="?"
    print(S.count("?"))
    exit()

n=len(S)
S*=4
N=len(S)-1

for i in range(N):
    if S[i+1]==S[i]:
        S[i+1]="?"

l=[S[:n],S[n:2*n],S[2*n:3*n],S[3*n:]]

ans=[0]*4
for i in range(4):
    ans[i]=l[i].count("?")

print(ans[0]+ans[3]+ans[1]*(-(-(K-2)//2))+ans[2]*((K-2)//2))

#qqq 5



Measured memory_bytes: 3064
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        final Scanner scanner = new Scanner(System.in);
        scanner.nextLine();
        final Integer[] values = Arrays.stream(scanner.nextLine().split(" "))
                .map(Integer::parseInt).toArray(Integer[]::new);

        int absMin = Integer.MAX_VALUE;
        int negativeCount = 0;

        long sum = 0;
        for (int i = 0; i < values.length; i++) {
            if (values[i] < 0) {
                negativeCount++;
            }

            absMin = Math.min(absMin, Math.abs(values[i]));
            sum += Math.abs(values[i]);
        }

        if (negativeCount % 2 == 0) {
            System.out.println(sum);
        } else {
            System.out.println(sum - absMin * 2);
        }
    }
}



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

using namespace std;
using ll = long long;

const ll mod = 1e9 + 7;

int main()
{
	int n; string s; cin >> n >> s;
	map<char, int> mp; for(auto i : s)mp[i]++;

	ll res = 1;
	for(auto i : mp) {
		res *= (1 + i.second);
		res %= mod;
	}
	cout << ((res - 1) + mod ) % mod<< endl;
}	

Measured memory_bytes: 512
N = int(input())
S = [0] * N
for i in range(N):
    S[i] = int(input())
sorted_S = sorted(S)
res = sum(S)
if res % 10 == 0:
    not_10_over = None
    for i in range(N):
        if sorted_S[i] % 10 != 0:
            not_10_over = sorted_S[i]
            break

    if not_10_over:
        print(res - not_10_over)
    else:
        print(0)
else:
    print(res)


Measured memory_bytes: 38384
N,M = map(int,input().split())
pS = [[i for i in input().split()] for _ in range(M)]

# True -> AC済み
AC = [False] * N
WA_cnt = [0] * N

pena = 0
for p,S in pS:
    p = int(p) - 1

    if AC[p]:
        continue

    if S == "WA":
        WA_cnt[p] += 1
    else:
        AC[p] = True
        pena += WA_cnt[p]
    
ac = sum(AC)
print(ac,pena)

Measured memory_bytes: 27504
#include <iostream>
#include <string>

using namespace std;

int main() {
    string a, b;
    cin >> a >> b;

    if (a == b) {
        cout << "EQUAL" << endl;
    } else if (a.size() > b.size() || (a.size() == b.size() && a > b)) {
        cout << "GREATER" << endl;
    } else {
        cout << "LESS" << endl;
    }
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder
{

    static class Program
    {
        static void Main()
        {
            Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });
            //

            var N = GetInt();
            var sum = N.ToString().ToCharArray().Select(c => int.Parse(c.ToString())).Sum();
            var ans = YesNo(N % sum == 0);

            Console.WriteLine(ans);

            //
            Console.Out.Flush();
            Console.ReadKey();
        }

        static void Solve()
        {

        }

        static long GCD(long a, long b) { return b != 0 ? GCD(b, a % b) : a; }


        static public string GetStr() { return Console.ReadLine().Trim(); }
        static public int GetInt() { return int.Parse(Console.ReadLine()); }
        static public long GetLong() { return long.Parse(Console.ReadLine()); }
        static public string[] GetStrArray() { return Console.ReadLine().Split(' '); }
        static public int[] GetIntArray() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); }
        static public long[] GetLongArray() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
        static public char[] GetCharArray() { return Console.ReadLine().Split(' ').Select(char.Parse).ToArray(); }
        static public List<double> GetDoubleList() { return Console.ReadLine().Split(' ').Select(double.Parse).ToList(); }
        static public void WriteObjects<T>(IEnumerable<T> values) { foreach (var o in values) { Console.Write(o + " "); } }
        static string yesno(this bool b) { return b ? "yes" : "no"; }
        static string YesNo(this bool b) { return b ? "Yes" : "No"; }
        static string YESNO(this bool b) { return b ? "YES" : "NO"; }

        static bool eq<T, U>() => typeof(T).Equals(typeof(U));
        static T ct<T, U>(U a) => (T)Convert.ChangeType(a, typeof(T));
        static T cv<T>(string s) => eq<T, int>() ? ct<T, int>(int.Parse(s))
                           : eq<T, long>() ? ct<T, long>(long.Parse(s))
                           : eq<T, double>() ? ct<T, double>(double.Parse(s))
                           : eq<T, char>() ? ct<T, char>(s[0])
                                             : ct<T, string>(s);
        static void Multi<T>(out T a) => a = cv<T>(GetStr());
        static void Multi<T, U>(out T a, out U b)
        {
            var ar = GetStrArray(); a = cv<T>(ar[0]); b = cv<U>(ar[1]);
        }
        static void Multi<T, U, V>(out T a, out U b, out V c)
        {
            var ar = GetStrArray(); a = cv<T>(ar[0]); b = cv<U>(ar[1]); c = cv<V>(ar[2]);
        }
        static void Multi<T, U, V>(out T a, out U b, out V c, out V d)
        {
            var ar = GetStrArray(); a = cv<T>(ar[0]); b = cv<U>(ar[1]); c = cv<V>(ar[2]); d = cv<V>(ar[3]);
        }
    }
}

Measured memory_bytes: 13396
#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9+7;
const int INF = 0x3f3f3f3f;
const int N = 100005;
#define ll long long
char s[]= {'z','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};

ll n;
int tt[20];
int main(){
	cin >> n;
	int f=0;
	while(n){	
		if(n%26==0) {
			tt[f] = 26;
			n-=26;
		}
		else{
			tt[f]=n%26;
				
		}
		n/=26;	
		f++; 	
	}
	for(int i=f-1;i>=0;i--){
		cout << s[tt[i]];	
	}
	return 0;
}


//1000000000000001




Measured memory_bytes: 3600
def resolve():
    a, b, c, x = [int(input()) for _ in range(4)]
    ans = 0
    for _a in range(a + 1):
        for _b in range(b + 1):
            for _c in range(c + 1):
                total = 500 * _a + 100 * _b + 50 * _c
                if total == x:
                    ans += 1

    print(ans)

resolve()

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define rep(i,a,...) for(int i = (a)*(strlen(#__VA_ARGS__)!=0);i<(int)(strlen(#__VA_ARGS__)?__VA_ARGS__:(a));++i)
#define per(i,a,...) for(int i = (strlen(#__VA_ARGS__)?__VA_ARGS__:(a))-1;i>=(int)(strlen(#__VA_ARGS__)?(a):0);--i)
#define foreach(i, n) for(auto &i:(n))
#define pii pair<int, int>
#define pll pair<long long, long long>
#define all(x) (x).begin(), (x).end()
#define bit(x) (1ll << (x))
using ll = long long;
//const ll MOD = (ll)1e9+7;
const ll MOD = 998244353;
const int INF = (ll)1e9+7;
const ll INFLL = (ll)1e18;
using namespace std;
template<class t>
using vvector = vector<vector<t>>;
template<class t>
using vvvector = vector<vector<vector<t>>>;
template<class t>
using priority_queuer = priority_queue<t, vector<t>, greater<t>>;
template<class t, class u> bool chmax(t &a, u b){if(a<b){a=b;return true;}return false;}
template<class t, class u> bool chmin(t &a, u b){if(a>b){a=b;return true;}return false;}
#ifdef DEBUG
#define debug(x) cout<<"LINE "<<__LINE__<<": "<<#x<<" = "<<x<<endl;
#else
#define debug(x) (void)0
#endif

ll modpow(ll x, ll b){
  ll res = 1;
  while(b){
    if(b&1)res = res * x % MOD;
    x = x * x % MOD;
    b>>=1;
  }
  return res;
}

ll modinv(ll x){
  return modpow(x, MOD-2);
}

bool was_output = false;
template<class t>
void output(t a){
  if(was_output)cout << " ";
  cout << a;
  was_output = true;
}
void outendl(){
  was_output = false;
  cout << endl;
}
ll in(){
  ll res;
  scanf("%lld", &res);
  return res;
}

template<class t>
istream& operator>>(istream&is, vector<t>&x){
  for(auto &i:x)is >> i;
  return is;
}

template<class t, class u>
istream& operator>>(istream&is, pair<t, u>&x){
  is >> x.first >> x.second;
  return is;
}

ll merge(vector<ll> &line,int l,int m,int r){
  int as = m - l;
  int bs = r - m;
  vector<ll> A(as+1);
  vector<ll> B(bs+1);
  rep(i,as)A[i] = line[l+i];
  rep(i,bs)B[i] = line[m+i];
  A[as] = INT64_MIN;
  B[bs] = INT64_MIN;
  ll res = 0;
  int ap = 0;
  int bp = 0;
  rep(i,r-l){
    if(A[ap]<=B[bp]){
      line[l+i] = B[bp];
      ++bp;
      res += as-ap;
    }else{
      line[l+i] = A[ap];
      ++ap;
    }
  }
  return res;
}

ll merge_sort(vector<ll> &line,int l,int r){
  if(r-l==1)return 0;
  ll res = 0;
  int mid = (r+l) / 2;
  res += merge_sort(line,l,mid);
  res += merge_sort(line,mid,r);
  res += merge(line,l,mid,r);
  return res;
}
int main(){
  int n = in();
  ll k = in();
  vector<ll> line(n);
  foreach(i,line)i = in() - k;
  vector<ll> sums(n+1,0);
  rep(i,n)sums[i+1] = sums[i] + line[i];


  cout << merge_sort(sums,0,n+1) << endl;

  return 0;
}


Measured memory_bytes: 5064
#include <iostream>
#include <algorithm>
#include <cmath>
#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <string.h>
#include <stack>
#include <assert.h>
#include <bitset>
#define Endl endl
#define mp make_pair
#define ll long long 
#define ull unsinged long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define over(A) {cout<<A<<endl;exit(0);}
#define all(A) A.begin(),A.end()
#define ceil(a,b) ((a-1)/b+1)
#define srand() mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define rand(l,r) uniform_int_distribution<int>(l,r)(rng)
template <typename T1,typename T2> inline void chmin(T1 &x,T2 b) {if(b<x) x=b;}
template <typename T1,typename T2> inline void chmax(T1 &x,T2 b) {if(b>x) x=b;}
const int inf=1039074182;
const int mod=1e9+7;
using namespace std;
int dp[305][305][305];
int n,m;

namespace combinatorics
{
	int *fac;
	int *ifac;
	int __Tmod;
	inline int add(int a,int b)
	{
		return (a+b)%__Tmod;
	}
	inline int sub(int a,int b)
	{
		return (a-b+__Tmod)%__Tmod;
	}
	inline int mult(int a,int b)
	{
		return (1LL*a*b)%__Tmod;
	}
	inline int fastpow(int basic,int x)
	{
		if(x==0) return 1;
		int res=1;
		while(x)
		{
			if(x&1)	res=mult(res,basic);
			basic=mult(basic,basic);
			x>>=1;
		}
		return res;
	}
	inline int inv(int x)
	{
		return fastpow(x,__Tmod-2);
	}
	void init(int n,int tmod)
	{
		__Tmod=tmod;
		fac=new int[n+5];
		ifac=new int[n+5];
		fac[0]=1;
		for(int i=1;i<=n;i++)
		{
			fac[i]=mult(fac[i-1],i);
		}
		ifac[n]=inv(fac[n]);
		for(int i=n-1;i>=0;i--)
		{
			ifac[i]=mult(ifac[i+1],i+1);
		}
	}
	inline int C(int n,int m)
	{
		return mult(mult(fac[n],ifac[m]),ifac[n-m]);
	}
	inline int Cat(int x)
	{
		return mult(C(x*2,x),inv(x+1));
	}
};
using namespace combinatorics;

template <typename T1,typename T2> void upadd(T1 &a,T2 b) {a+=b;if(a>=mod) a-=mod;}

int main()
{
//	freopen("input.txt","r",stdin);
	cin>>n>>m;
	init(300,1e9+7);
	dp[0][1][1]=1;
	for(int i=0;i<m;i++)
	{
		for(int j=1;j<=min(i+1,n);j++)
		{
			for(int k=1;k<=j;k++)
			{
				int now=dp[i][j][k];
				upadd(dp[i+1][j][j],mult(now,k));
				upadd(dp[i+1][j][k],mult(now,j-k));
				upadd(dp[i+1][j+1][k],mult(now,n-j));
			}
		}
	}
	cout<<dp[m][n][n]<<endl;
	return 0;
}

Measured memory_bytes: 108800
import java.util.Scanner;

public class Main {

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

		int A = sc.nextInt();
		long sum = 0;
		for (int i = 1; i <= A; i++) {
			if (i % 15 >0 && i % 5 >0 && i % 3 >0) {
				sum += i;
			}
		}
		System.out.println(sum);
	}
}

Measured memory_bytes: 35612
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] prime = new int[55556];
		boolean[] isprime = new boolean[55556];
		for (int i = 0; i < isprime.length; i++) {
			isprime[i] = true;
		}
		int p = 0;
		isprime[0] = false; isprime[1] = false;
		for (int i = 2; i < isprime.length; i++) {
			if(isprime[i]) {
				prime[p] = i;
				p++;
				for(int j = 2*i;j < isprime.length; j += i) {
					isprime[j] = false;
				}
			}
		}
		int[] ans = new int[n]; int q = 0;
		for (int i = 0; i < n; i++) {
			while(q<p) {
				if(prime[q]%5==1) {
					ans[i] = prime[q];
					q++;
					break;
				}
				q++;
			}
		}
		for (int i = 0; i < n; i++) System.out.printf("%d ",ans[i]);
		sc.close();
	}
}

Measured memory_bytes: 21460
#include<iostream>
#include<cstdio>
#include<cstring>
#include <cstdlib>  
#include <math.h>
#include <cmath>
#include<complex>
#include<cctype>
#include<string>
#include<set>
#include<iomanip>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include<bitset>
#include <deque>
#include <climits>
#include <typeinfo>
#include <utility> 
using namespace std;
using Complex = complex<double>;
using ll = long long;
template<typename T>using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
const ll inf = 1145141919810364364LL;
double PI = acos(-1.0);
#define all(x) (x).begin(),(x).end()
#define puts(x) cout << x << endl
#define rep(i,m,n) for(ll i = m;i < n;++i)
#define pb push_back
#define fore(i,a) for(auto &i:a)
#define rrep(i,m,n) for(ll i = m;i >= n;--i)


struct edge { ll to, cap, rev; };

const int MAX_V = 100;
int used[MAX_V + 3];
vector<edge>G[MAX_V+3];
int fl = 0;

ll dfs(ll v, ll t, ll f) {
	if (v == t)return f;
	used[v] = 1;
	for (int i = 0; i < G[v].size(); i++) {
		edge e = G[v][i];
		if (used[e.to] == 0 && e.cap > 0) {
			ll d = dfs(e.to,t,min(f,e.cap));
			if (d > 0) {
				G[v][i].cap -= d;
				G[e.to][e.rev].cap += d;
				return d;
			}
		}
	}
	return 0;
}

void add_edge(ll from,ll to, ll cap) {
	edge fe = {to,cap,(int)G[to].size()};
	edge toe = { from,0,(int)G[from].size() };
	G[from].pb(fe);
	G[to].pb(toe);
}

ll max_flow(int s, int t) {
	ll flow = 0;
	while (1) {
		memset(used, 0, sizeof(used));
		ll f = dfs(s,t,inf);
		if (f == 0)return flow;
		flow += f;
	}
}

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

	int V, E;
	cin >> V >> E;
	for (int i = 0; i < E; i++) {
		int u, v, c;
		cin >> u >> v >> c;
		add_edge(u,v,c);
	}
	puts(max_flow(0, V - 1));
	
	return 0;
}


Measured memory_bytes: 3288
N, K = map(int,input().split())
d = 0
A = []
ans = 0
for i in range (K):
    d = int(input())
    A.append(input().split())
for i in range(1,N+1):
    for j in range(len(A)):
        if str(i) in A[j]:
            break
        if j == len(A)-1:
            ans += 1
print(ans)

Measured memory_bytes: 9540
"use strict";
var input=require("fs").readFileSync("/dev/stdin","utf8");
var cin=input.split(/ |\n/),cid=0;
function next(){return +cin[cid++];}
function nextstr(){return cin[cid++];}
function nextbig(){return BigInt(cin[cid++]);}
function nexts(n,a){return a?cin.slice(cid,cid+=n):cin.slice(cid,cid+=n).map(a=>+a);}
function nextm(h,w,a){var r=[],i=0;if(a)for(;i<h;i++)r.push(cin.slice(cid,cid+=w));else for(;i<h;i++)r.push(cin.slice(cid,cid+=w).map(a=>+a));return r;}
function xArray(v){var a=arguments,l=a.length,r="Array(a["+--l+"]).fill().map(x=>{return "+v+";})";while(--l)r="Array(a["+l+"]).fill().map(x=>"+r+")";return eval(r);}

var myOut = main();
if(myOut !== undefined)console.log(myOut);

function main(){
  var n = next();
  var ans = 1n;
  var mx = 1000000000000000000n;
  var a = nexts(n,1);
  for(var i = 0; i < n; i++){
    if(a[i] === "0")return 0;
  }
  for(var i = 0; i < n; i++){
    ans *= BigInt(a[i]);
    if(ans > mx)return -1;
  }
  return ans.toString();
}

Measured memory_bytes: 43672
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<cmath>
#include<string>

using namespace std;
typedef long long ll;

int main() {
  int x[5];
  for(int i=0;i<5;++i){
    cin >> x[i];
    if(x[i]==0) cout<<i+1<<endl;
  }
  
}

Measured memory_bytes: 3616
import sys
input = sys.stdin.readline
from operator import itemgetter

N=int(input())
R=[tuple(map(int,input().split())) for i in range(N)]
R2=[(x-y,x+y) for x,y in R]
R2.sort(key=itemgetter(1))

ANS=0
MAX=-1<<31

for l,r in R2:
    if l<MAX:
        ANS+=1
    else:
        MAX=max(MAX,r)

print(N-ANS)


Measured memory_bytes: 63964
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;

int main() {
    int h, w;
    cin >> h >> w;

    int p[26] = {};
    for (int i = 0; i < h * w; i++) {
        char a;
        cin >> a;
        a -= 'a';

        p[a]++;
    }

    int x = 0;
    for (int i = 0; i < 26; i++) {
        x += p[i] % 4;
    }
    int y = 0;
    for (int i = 0; i < 26; i++) {
        y += p[i] % 2;
    }

    int b = 0;
    if (h % 2 == 0 && w % 2 == 0) {
        b = x == 0;
    } else if (h % 2 == 0 && w % 2 != 0) {
        b = x <= h && y == 0;
    } else if (h % 2 != 0 && w % 2 == 0) {
        b = x <= w && y == 0;
    } else {
        b = x <= h + w - 1 && y == 1;
    }

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

    return 0;
}

Measured memory_bytes: 256
n = int(input())
ab = []
now = 0
for i in range(n):
    ab.append(list(map(int, input().split())))
ab.sort(key=lambda x:x[1])
for i in ab:
    if i[0] + now > i[1]:
        print("No")
        exit()
    now += i[0]
print("Yes")


Measured memory_bytes: 53720
/********************************************//**
 ****** Handle: techno_phyle    *****************
 ***********************************************/

#include<bits/stdc++.h>
using namespace std;
#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
typedef long long ll;
#define mod 1000000007
#define N 100010
#define M 200010
#define db(a) cout << a << endl
#define db2(a,b) cout << a << " " << b << endl
#define dbp(a) cout << a.first << " " << a.second << endl
#define adb(a) for(auto it:a) cout << it << " "; cout << endl
#define adbp(a) for(auto it:a) cout << it.first << " " << it.second << endl
#define pb push_back
#define mp make_pair
#define endline "\n"
#define in(x) scanf("%d",&x);
const ll INF = 1e18L + 5;
const int inf = 1e9 + 5;
typedef pair<double, long> key;
struct comp {
	bool operator()(pair<int, int> p1, pair<int, int> p2) {
		if (p1.first < p2.first) return false;
		if (p2.first < p1.first) return true;
		return p1.second < p2.second;
	};
};
//greater<pair<int,int> , greater<int>>


int main() {
	fastIO;

	int test = 1;
	//cin >> test;
	while (test--) {
		int n ;
		cin >> n;
		int a[n];
		for (int i = 0; i < n; i++) cin >> a[i];
		sort(a, a + n);
		int cnt = 0;
		for (int i = 0; i < n; i++) {
			for (int j = i + 1; j < n; j++) {
				for (int k = j + 1; k < n; k++) {
					if (a[i] != a[j] && a[j] != a[k] && a[i] != a[k]) {
						if (a[i] + a[j] > a[k]) {
							cnt++;
						}
					}
				}
			}
		}
		cout << cnt << endl;
	}

	return 0;

}


Measured memory_bytes: 3652
#pragma GCC optimize(3)
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/priority_queue.hpp>
#define MAXN 200005
#define INF 1000000000
#define MOD 1000000007
#define F first
#define S second
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef pair<int,int> P;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
typedef __gnu_pbds::priority_queue<int,greater<int>,pairing_heap_tag> pq;
int n,c[MAXN];
int nxt[MAXN];
int leftmost[MAXN];
int dp[MAXN];
int solve(int i)
{
    if(i==n+1) return 1;
    if(dp[i]!=-1) return dp[i];
    int &ret=dp[i];
    ret=0;
    if(nxt[i]==n+1||nxt[i]==i+1) ret=solve(i+1);
    else 
    {
        ret=solve(nxt[i])+solve(i+1);
        if(ret>=MOD) ret-=MOD;
    }
    return ret;
}
int main()
{
    scanf("%d",&n);
    for(int i=1;i<=200000;i++) leftmost[i]=n+1;
    for(int i=1;i<=n;i++) scanf("%d",&c[i]);
    for(int i=n;i>=1;i--)
    {
        nxt[i]=leftmost[c[i]];
        leftmost[c[i]]=i;
    }
    memset(dp,-1,sizeof(dp));
    printf("%d\n",solve(1));
    return 0;
}



Measured memory_bytes: 9600
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
//#include<bits/stdc++.h>
#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please


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


	int N;
	scanf("%d", &N);
	char S[100000], T[4][100000];
	scanf("%s", S);

	int A[4];
	rep(i, 4) A[i] = i;

	rep(i, N) {
		T[A[0]][i] = 'S';
		T[A[1]][i] = 'W';
		T[A[2]][i] = 'S';
		T[A[3]][i] = 'W';
		if (S[i] == 'o') {
			swap(A[1], A[2]);
			swap(A[2], A[3]);
		}
		else {
			swap(A[1], A[2]);
			swap(A[0], A[1]);
		}
	}
	rep(i, 4) if (A[i] == i) {
		fwrite(T[i], 1, N, stdout);
		return 0;
	}

	printf("-1");

	Would you please return 0;
}

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

#define vec                vector<int>
#define vecll              vector<ll>
#define vecd               vector<double>
#define vecst              vector<string>
#define vecb               vector<bool>
#define vec2(var, n, m)    vector<vector<int>> var(n, vector<int>(m, 0))
#define vecll2(var, n, m)  vector<vector<ll>> var(n, vector<ll>(m, 0))

#define rep(i,n)         for(ll i=(ll)0; i<(ll)n; i++)
#define REP(i,m,n)       for(ll i=(ll)m; i<(ll)n; i++)
#define arr(var, n)      vec var(n); rep(i,n){cin >> var[i];}
#define arrll(var, n)    vecll var(n); rep(i,n){cin >> var[i];}
#define arrst(var, n)    vecst var(n); rep(i,n){cin >> var[i];}
#define all(var)         (var).begin(), (var).end()
#define sortall(var)     sort(all(var))
#define uniqueall(v)     v.erase(unique(v.begin(), v.end()), v.end());
#define f_sum(var)       accumulate(all(var), 0)
#define f_sumll(var)     accumulate(all(var), 0LL)
#define chmin(v1, v2)    v1 = min(v1, v2)
#define chmax(v1, v2)    v1 = max(v1, v2)
#define pb(var)          push_back(var)
#define prt(var)         cout << (var) << "\n"
#define prtd(n, var)     cout << fixed << setprecision(n) << (var) << "\n"
#define prtfill(n, var)  cout << setw(n) << setfill('0') << (var);
#define prt2(v1, v2)     cout << (v1) << " " << (v2) << "\n"
#define prt3(v1, v2, v3) cout << (v1) << " " << (v2) << " " << (v3) << "\n"
#define prtall(v)        rep(i,v.size()){cout<<v[i]<<(i!=v.size()-1?" ":"\n");}
void prtok(bool ok){prt(ok ? "Yes" : "No");}
//----------------------------------------------------------------

int main(void) {
  int n;
  cin >> n;
  string s, t;
  cin >> s >> t;

  vecb is_2;
  rep(i,n){
    if(s[i]==t[i]){
      is_2.pb(false);
    } else {
      is_2.pb(true);
      i++;
    }
  }

  ll ans=1;
  rep(i,is_2.size()){
    if(i==0){
      if(is_2[i]) ans *= 6;
      else ans *= 3;
    } else {
      if(is_2[i-1] && is_2[i]) ans *= 3;
      if(!is_2[i-1] && is_2[i]) ans *= 2;
      if(!is_2[i-1] && !is_2[i]) ans *= 2;
    }
    ans %= MOD;
  }

  prt(ans);

}


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

#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x,y) x ## y

using i8  = int8_t;
using u8  = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;

using f32 = float;
using f64 = double;

#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPS(i, n) for(i64 i = 1; i <= n; ++i)
#define RREP(i, n) for(i64 i = n - 1; i >= 0 ; --i)
#define RREPS(i, n) for(i64 i = n; i >= 1; --i)

#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))

#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define pb push_back
#define mp make_pair
#define F first
#define S second

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

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }

template<typename T, size_t N>
i64 SIZE(const T (&)[N]) { return static_cast<i64>(N); }


struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;

    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;


#define MAX_N 50;
i64 N;
priority_queue<f64, vector<f64>, greater<f64> > que;


int main() {
  cin >> N;
  f64 v;
  REP(i, N) {
    cin >> v;
    que.push(v);
  }

  f64 v1, v2;
  while (que.size() > 1) {
    v1 = que.top(); que.pop();
    v2 = que.top(); que.pop();
    v = (v1 + v2) / 2;
    que.push(v);
  }
  cout << que.top() << endl;

  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main (void){
    int a,b,c,d;
    scanf("%d",&a);
    scanf("%d",&b);
    scanf("%d",&c);
    d=a-b;
    c=c-d;
    if(c<0){
        c=0;
    }
    printf("%d",c);
    return 0;

}

Measured memory_bytes: 128
extern crate core;

use std::io::{self, Read};

#[macro_use]
mod parser {
    macro_rules! input {
    ($s:expr=>$($t:tt)*) => {
        let mut lines=$s.split("\n");
        $(
            line_parse!(lines,$t);
        )*
    };
    }

    macro_rules! line_parse {
    ($lines:expr,($($name:ident:$t:tt)*)) => {
        let mut line=$lines.next().unwrap().split_whitespace();
        $(value_def!(line,$name,$t);)*
    };

    //複数行
    ($lines:expr,{$n:expr;$name:ident:$t:tt}) => {
        values_def!($lines,$n,$name,$t);
    };
    }

    macro_rules! value_def {
    ($line:expr,$name:ident,$t:tt) => {
        let $name=value!($line,$t);
    };
    }

    macro_rules! values_def {
    ($lines:expr,$n:expr,$name:ident,$t:tt) => {
        let $name={
        let mut vec=Vec::new();
        for i in 0..$n{
            let mut next=$lines.next().unwrap().split_whitespace();
            vec.push(value!(next,$t));
        }
        vec
        };
    };
    }

    macro_rules! value {
    //配列
    ($line:expr,[$t:tt]) => {
        $line.map(|x|{
        let mut iter=::std::iter::once(x);
        value!(iter,$t)
        }).collect::<Vec<_>>()
    };
    //タプル
    ($line:expr,($($t:tt),*)) => {
        ($(value!($line,$t),)*)
    };
    //文字列
    ($line:expr,#) => {
        $line.next().unwrap()
    };
    //単一値
    ($line:expr,$t:ty) => {
        $line.next().unwrap().parse::<$t>().unwrap()
    };
    }
}

fn main() {
    let mut input = String::new();
    io::stdin().read_to_string(&mut input).unwrap();
    let output = solve(input.trim().to_string());
    println!("{}", output);
}

fn solve(input: String) -> String {
    input!(input=>(a:i64 b:i64 x:i64));
    if a <= x && a + b >= x { "YES" } else { "NO" }.to_string()
}

macro_rules! tests {
    ($($name:ident: $input:expr=>$output:expr,)*) => {
        mod tests {
            $(
                #[test]
                fn $name() {
                    assert_eq!($output.trim().to_string(),super::solve($input.trim().to_string()));
                }
            )*
        }
    }
}

tests! {
    test1: "3 5 4" => "YES",
    test2: "2 2 6" => "NO",
    test3: "5 3 2" => "NO",
}


Measured memory_bytes: 4352
package main

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

func main() {
	N := uint64(nextInt())
	power := uint64(1)
	max := uint64(math.Pow10(9)) + 7
	for i := uint64(1); i <= N; i++ {
		power = power * i % max
	}

	fmt.Println(power)
}

// Input. ----------

var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Split(bufio.ScanWords)
}

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

	return i
}

// ---------- Input.

Measured memory_bytes: 640
Object.defineProperties(Array.prototype, {
    pInt: {
        value() {
            return this.map(i => i - 0);
        },
    },
    rot: {
        value() {
            var tmp = this[0].map(i => [i]);
            this.slice(1).forEach(ary => {
                ary.forEach((val, idx) => tmp[idx].push(val));
            });
            return tmp;
        }
    }
});
(i => {
    var n, m, l, a, b, out = [];
    i = i.replace(/\n/g, ',');
    [n, m, l] = i.split(/[ ,]/).pInt();
    [a, b]    = (lines => [
        lines.slice(0, n).map(i => i.split(' ').pInt()),
        lines.slice(n)   .map(i => i.split(' ').pInt())
    ])(i.split(',').slice(1));
    b = b.rot();
    for (i = 0; i < n; i++) {
        var line = [];
        for (j = 0; j < l; j++) {
            line.push(a[i].reduce((acc, cur, idx) => {
                return acc + cur * b[j][idx];
            }, 0));
        }
        out.push(line.join(' '));
    }
    console.log(out.join('\n'));
})(require('fs').readFileSync('/dev/stdin', 'utf8'));


Measured memory_bytes: 26028
//#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <queue>

using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<n;++i)
#define mod (ll)(1e9+7)
#define FIX(a) ((a)%mod+mod)%mod
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define fi first
#define se second
#define pb push_back
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin >> n;
    ll x = 1;
    while(x*x<=n){
        x++;
    }
    cout << (x-1)*(x-1) << endl;

    return 0;
}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 1; i <= (n); i++)
using namespace std;
typedef long long ll;

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

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

using namespace std;

typedef long long ll;

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

	ll sum = 0;
    vector<ll> imos(2 * m + 2, 0);
	for (int i = 1; i < n; i++) {
		sum += (a[i] - a[i - 1] + m) % m;
        int L = a[i - 1];
        int R = a[i] + m * (a[i - 1] > a[i]);
        if (L == R) continue;
        imos[L + 2]++;
        imos[R + 1] -= R - L;
        imos[R + 2] += R - L - 1;
	}

	for (int i = 1; i < 2 * m; i++) imos[i] += imos[i - 1];
    for (int i = 1; i < 2 * m; i++) imos[i] += imos[i - 1];

	ll d = 0;
	for (int i = 0; i < m; i++) {
		d = max(d, imos[i] + imos[i + m]);
	}
	cout << sum - d << endl;
	return 0;
}

Measured memory_bytes: 2176
A, B = map(int, input().split())
S =input()
accept = None

for i, c in enumerate(S):
    if i == A:
        if c != "-":
            accept = False
            break
    else:
        if c not in ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]:
            break
        elif i == A+B+1-1:
            accept = True
        else:
            accept = False

if accept:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
import sys
from io import StringIO
import unittest


def resolve():
    a, b, c, d = map(int, input().split())

    win = False

    while 1:
        c -= b

        if c <= 0:
            win = True
            break

        a -= d

        if a <= 0:
            break

    if win:
        print('Yes')
    else:
        print('No')

class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)
    def test_入力例_1(self):
        input = """10 9 10 10"""
        output = """No"""
        self.assertIO(input, output)
    def test_入力例_2(self):
        input = """46 4 40 5"""
        output = """Yes"""
        self.assertIO(input, output)

if __name__ == "__main__":
    # unittest.main()
    resolve()

Measured memory_bytes: 16200
import sys
sys.setrecursionlimit(12345678)
import itertools
from collections import Counter
from collections import defaultdict
from collections import deque
import bisect
from heapq import heappush, heappop


def main():
    a, b = input().split()
    if a == 'H':
        print(b)
    else:
        if b == 'H':
            print('D')
        else:
            print('H')


if __name__ == '__main__':
    main()


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

int main() {
	int n, m; cin >> n >> m;
	int a[100], b[100], c[100] = {0};

	for (int i = 0; i < m; i++) {
		cin >> a[i] >> b[i];
		c[a[i]-1]++;
		c[b[i]-1]++;
	}

	for (int i = 0; i < n; i++) {
		cout << c[i] << endl;
	}

	return 0;
}

Measured memory_bytes: 256
// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;
using ll = long long int;
using int64 = long long int;
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const int INF = 1LL << 29;
const ll LONGINF = 1LL << 60;
const ll MOD = 1000000007LL;

int main() {
    int N, ans = 0; cin >> N;
    set<int> S;
    for(int i=0; i<N; i++) {
        int v; cin >> v;
        if(i == 0 or S.lower_bound(v) == S.begin()) ans++;
        S.emplace(v);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 9600
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;
#define REP(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ALL(v) (v).begin(),(v).end()

int main() {

	ll N;
	cin >> N;
	V<ll> A(N);
	REP(i, N) cin >> A[i];

	V<ll> cnt(N+1, 0);
	for(ll a : A) cnt[a]++;
	bool f = true;
	if(N%2 == 0) {
		for(int i=0; i<=N; i++) {
			if(i%2==0 && cnt[i]==0) continue;
			if(i%2==1 && cnt[i]==2) continue;
			f = false;
			break;
		}
	} else {
		for(int i=1; i<=N; i++) {
			if(i%2==0 && cnt[i]==2) continue;
			if(i%2==1 && cnt[i]==0) continue;
			f = false;
			break;
		}
		if(cnt[0]!=1) f = false;;
	}
	ll ans = 1;
	ll mod = 1000000007;
	REP(i, N/2)ans = ((ans%mod)*2)%mod;
	cout << (f ? ans : 0) << endl;
}

Measured memory_bytes: 1792
input()
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
before_num = 1000
satisfuction = 0
for num in A:
    satisfuction += B[num - 1]
    if num == before_num + 1:
        satisfuction += C[before_num - 1]
    before_num = num

print(satisfuction)


Measured memory_bytes: 3060
#include <iostream>
#include <math.h>
using namespace std;
int main() {
	int n, t, a, ans = -1;
	double min = -1;
	cin >> n >> t >> a;
	t -= a;
	int h[1000];
	for (int i = 0; i < n; i++) {
		cin >> h[i];
		if (fabs(h[i] * 0.006 - (double)t) < min || ans == -1) {
			min = fabs(h[i] * 0.006 - (double)t);
			ans = i;
		}
	}
	cout << ans + 1;
	return 0;
}

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



int main() { 
  string s,t;
  cin >> s>>t;
  map<char ,char>a;
  for(int i=0;i<s.size();i++){
    char b=t.at(i);
    auto itr = a.find(b);
    if( itr != a.end()){
      if(itr->second==s.at(i) ) {
        continue;
      }
      else{
        cout << "No";
        return 0;
      }
    }
    else {
        a[b]=s.at(i);
    } 
  }
  map<char,char>c;
  for(int i=0;i<t.size();i++){
    char b=s.at(i);
    auto itr = c.find(b);
    if( itr != c.end()){
      if(itr->second==t.at(i) ) {
        continue;
      }
      else{
        cout << "No";
        return 0;
      }
    }
    else {
      c[b]=t.at(i);
    }    
  }
  cout << "Yes";
}

Measured memory_bytes: 776
st=input()
loop=int(input())
for _ in range(loop):
    order =input().split()
    if order[0] == "print":
        print(st[
            int(order[1]) :
            int(order[2])+1
            ])
    elif order[0] == "reverse":
        gyaku="".join(list(reversed(st[int(order[1]) : int(order[2])+1])))
        st=st[:int(order[1])]+gyaku+st[int(order[2])+1:]
    elif order[0] == "replace":
        st=st[:int(order[1])]+order[3]+st[int(order[2])+1:]



Measured memory_bytes: 5616
#include <bits/stdc++.h>
#include <cstring>
#include <map>
#include <set>
#define int long long int
#define cons 1000000007 
using namespace std;

signed main() {
 
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    
    #ifdef _DEBUG
    freopen("input.txt", "r", stdin);
    //  freopen("output.txt", "w", stdout);
    #endif
 
    int n, c=0;
    cin>>n;
    int nn=n;
    while(n!=0){
        c++;
        n=n/10;
    }
    n=nn;
    if(c%2==0){
        cout<<( pow(10, c)-1)/11<<endl;
    }
    else{
        cout<<(pow(10, c-1)-1)/11+n-pow(10, c-1)+1<<endl;
    }
}


Measured memory_bytes: 256
/*

author: @PearlYadav        

*/
#include<bits/stdc++.h>
using namespace std;

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

int main(){
    ibs
    int a,b,x,ans=1;
    cin>>a>>b;
    x = a-1;
    while(a<b){
        //3+2+2+2+2+2+2+2
        ans++;
        a+=x;
    }
    if(b==1)
        ans=0;
    cout<<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 ordered_set tree<int, null_type,less_equal<int>, rb_tree_tag,tree_order_statistics_node_update>
#define pb push_back
#define ff first
#define ss second
#define endl '\n'
#define fast ios::sync_with_stdio(false); cin.tie(NULL);
const double eps = 1e-6;

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

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

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

#define int long long


void solve(){

	int n , m;
	cin>>n>>m;

	if(n==m){

		cout<<"Yes\n";
		return ;
	}
	cout<<"No\n";
	return ;
}


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



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

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

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

			j = c;

		}
		else {
			break;
		}
	}
	return j * (a / j) * (b / j);
}
int kaizyo(int k) {
	int sum = 1;
	for (int i = 1; i <= k; ++i)
	{
		sum *= i;
	}
	return sum;
}
int main()
{
	cin >> a >> b >> c >> x;
	rep(i, a+1) {
		rep(j, b+1) {
			rep(k, c+1) {
				if (x == 50 * k + 100 * j + 500 * i) {
					counter++;
				}
			}
		}
	}
	cout << counter << endl;
}

Measured memory_bytes: 256
#include <cmath>
#include <cstdio>

#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <numeric>
#include <string>
#include <array>

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(x) x.begin(), x.end()

using namespace std;
typedef long long int ll;

int main(){
  ll a,b,c,k;

  ll n_a, n_b, n_c;
  cin >> a >> b >>c >>k;
  if(k%2==0)
    cout << a-b << endl;
  else
    cout << b-a << endl;
  return 0;
}

Measured memory_bytes: 256