akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  
  int X = N;
  int R = 0;
  int sum = 0;
  while(X > 0){
    R = X%10;
    X = X/10;
    sum += R;
  }
  if(N%sum == 0) cout << "Yes" << endl;
  else cout << "No" <<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#define MAX_V 100
#define INF 1e9
using namespace std;
int cost[MAX_V][MAX_V];
int d[MAX_V];
bool used[MAX_V];
int V;
void dijkstra(int s) {
	for (int i = 0; i < V; i++) {
		d[i] = INF;
		used[i] = false;
	}
	d[s] = 0;
	while (true) {
		int v = -1;
		for (int u = 0; u < V; u++) {
			if (!used[u] && ((v == -1) || d[u] < d[v])) {
				v = u;
			}
		}
		//全ての頂点が到達済み
		if (v == -1) {
			break;
		}
		//集合に新たに頂点を追加
		used[v] = true;
		for (int u = 0; u < V; u++) {
			if (cost[v][u] != -1) {
				d[u] = min(d[u], d[v] + cost[v][u]);
			}
		}
	}
}

int main() {
	for (int i = 0; i < MAX_V; i++) {
		for (int j = 0; j < MAX_V; j++) {
			cost[i][j] = -1;
		}
	}
	cin >> V;
	for (int i = 0; i < V; i++) {
		int u;
		cin >> u;
		int k;
		cin >> k;
		for (int j = 0; j < k; j++) {
			int v;
			cin >> v;
			int c;
			cin >> c;
			cost[u][v] = c;
		}
	}
	dijkstra(0);

	for (int i = 0; i < V; i++) {
		cout << i << " " << d[i] << endl;
	}
	return 0;
}



Measured memory_bytes: 3124
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i = 0; i < (N); i++)
#define repo(i,N) for(int i = 1; i < (N); i++)
#define pb push_back
#define mp make_pair
#define ll long long
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
//#define num 1000000007
#define pi acos(-1.0)
//cout << fixed << setprecision (20);   小数点以下2０桁まで
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'大文字'+=32;    で小文字に
//string s = to_string(int数);
//int n = stoi(string文字列);
//桁数に注意 long long　にする

int main() {
  int a,b,c,d;
  cin >> a >> b >> c >> d;
  
  cout << ((a+d-1)/d>=(b+c-1)/b?"Yes":"No") << endl;
  
}


Measured memory_bytes: 3616
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String line;
		try {
			line = br.readLine();
		} catch (IOException e) {
			System.err.println("The input is missing. " + e.getMessage());
			return;
		}

		int s;
        try {
        	s = Integer.parseInt(line);
        } catch(Throwable e) {
			System.err.println("The input is in an illegal form. " + line);
			return;
        }

        StringBuilder b = new StringBuilder();
        b.append(s / 3600).append(':');

        s %= 3600;
        b.append(s / 60).append(':');

        s %= 60;
        b.append(s);

        System.out.println(b.toString());
    }
}

Measured memory_bytes: 17028
import java.util.*;
public class Main{
    static Scanner kbd = new Scanner(System.in);
    public static void main(String[] args){
	while(kbd.hasNext()){
	    int n = kbd.nextInt();
	    if(n!=0){
		int[] p = new int[n];
		int i;
		for(i=0; i<n; i++){
		    p[i] = kbd.nextInt();
		}

		int s = 0;
		i=0;
		while(i<n){
		    while(i+1<n && p[i]+1 == p[i+1]) i++;
		    if(s==i)
			System.out.print(p[s]);
		    else
			System.out.print(p[s]+"-"+p[i]);
		    i++;
		    s = i;
		    if(i<n) System.out.print(" ");
		}
		System.out.println();
	    }
	}
    }
}

Measured memory_bytes: 12000
list = Array.new(3, 0)
10.times {
    t = gets.to_i
    
    ex = false
    list.each { |a|
        ex = true if t > a
    }
    
    if ex
        list.unshift(t).pop
        list.sort!.reverse!
    end
}
list.each { |t| puts t }

Measured memory_bytes: 8608
#include<iostream>
#define _USE_MATH_DEFINES
#include<math.h>
#include<vector>
#include<array>
#include<algorithm>
#include<numeric>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<set>
#include<cstdio>
#include<cstring>
#include<string>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<ll> vec;
typedef vector<vector<ll>> mat;
typedef pair<ll,ll> P;
typedef map<ll,ll> MP;
typedef priority_queue<ll> PQ;
typedef stack<ll> ST;
typedef queue<ll> QUE;
#define pb push_back
#define st first
#define nd second
#define SZ(x) ((int)(x).size())
#define FOR(i,s,n) for(int i=(int)(s); i< (int)(n); i++)
#define rep(i,n) FOR(i,0,n)
#define all(x) (x).begin(),(x).end()
#define each(x,c) for(auto x: (c))
#define LB(x,a) lower_bound(all(x), a)
#define UB(x,a) upper_bound(all(x), a)
const ll mod=1e9+7;
const ll INF=1e18;
const double EPS=1.0e-10;
const double PI=M_PI;

int main(){
    string S; cin>>S;
    if(S[2]==S[3] && S[4]==S[5])cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 256
N = gets.chomp.to_i
p = Array.new(N)
str = gets.split
for i in 0...N do
    p[i] = str[i].to_i
end

answer = 0
for i in 1...N-1 do
    if p[i] > p[i-1]
        if p[i] < p[i+1]
            answer += 1
        end
    else
        if p[i] > p[i+1]
            answer += 1
        end
    end
end

puts answer

Measured memory_bytes: 1788
Score = int(input())

Numero = 0

for i in range (1, 10000000):
	if i*(i+1)/2 >= Score:
		Numero = i
		break

K = Numero

P = []

for i in range (0, K):
	if Score >= (K-i):
		P.append(K-i)
		Score = Score - (K-i)

P = reversed(P)

print(*P, sep = "\n") 

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

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

using namespace std;

typedef long long ll;

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

  int n; cin >> n;
  vector<int> a(n);

  rep(i, n) { cin >> a[i]; }

  int ans = 1;
  // state value means as follow
  // 0 : none
  // 1 : increasing
  // 2 : decreasing
  int state = 0;

  rep(i, n) {
    if (i == 0) { continue; }
    int cur = a[i], prev = a[i-1];

    if (state == 0) {
      if ( cur < prev ) {
        state = 2;
      } else if ( cur > prev) {
        state = 1;
      }
    }
    if (state == 1) {
      if ( cur < prev ) {
        ans++;
        state = 0;
      }
    }
    if (state == 2) {
      if ( cur > prev ) {
        ans++;
        state = 0;
      }
    }
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 640
n = int(input())
x_y = []
for _ in range(n):
  x_y.append([int(i) for i in input().split()])
import itertools
import math
ans = 0.0
for x_yi in itertools.permutations(x_y, n):
  sum_ = 0.0
  for i in range(n-1):
    sum_ += math.sqrt((x_yi[i][0] - x_yi[i+1][0]) ** 2 +
                      (x_yi[i][1] - x_yi[i+1][1]) ** 2)
  ans += sum_ / math.factorial(n)
print(ans)

Measured memory_bytes: 9076
#ABC054C
import itertools
N, M=map(int,input().split())
a=[0]*0
b=[0]*0
order=list(itertools.permutations(range(N-1) ) )#0～N-2のN-1個の順列ができる。2を足すと、2～Nの配列。
c_patern=0
for i in range(M):
    a_tmp, b_tmp=map(int,input().split())
    a.append(a_tmp)
    b.append(b_tmp)
for i in range(len(order)):
    for j in range(N-1):
        flg = False
        if j==0:
            for k in range(M):
                if (a[k]==1 and b[k]==order[i][0]+2):
                    flg=True
                    break
        else:
            for k in range(M):
                if (a[k]==order[i][j-1]+2 and b[k]==order[i][j]+2) or (a[k]==order[i][j]+2 and b[k]==order[i][j-1]+2):
                    flg=True
                    break
        if flg==False:
            break
    if flg==True:
        c_patern+=1
print(c_patern)

Measured memory_bytes: 3572
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <queue>

using namespace std;

const int nmax = 1e9 + 7;
typedef long long ll;

int main(){
  int H, W; cin >> H >> W;

  int C[10][10];
  for (int i = 0; i < 10; i++){
    for (int j = 0; j < 10; j++){
      cin >> C[i][j];
    }
  }

  for (int k = 0; k < 10; k++){
    for (int i = 0; i < 10; i++){
      for (int j = 0; j < 10; j++){
        C[i][j] = min(C[i][j], C[i][k] + C[k][j]);
      }
    }
  }
  
  int ans = 0;
  for (int i = 0; i < H; i++){
    for (int j = 0; j < W; j++){
      int A; cin >> A;
      if (A != -1) ans += C[A][1];
    }
  }
  
  cout << ans << endl;

  
  return 0;
}


Measured memory_bytes: 256
import scala.io.StdIn.{readLine}

object Main extends App {
  def isPalindromic(s: String): Boolean = {
    val (src, dst) = s.splitAt(s.length / 2 + 1)
    val taked = src.take(dst.length)
    taked == dst.reverse
  }

  def nPalindromic(input: String): Int = {
    val ints = input.split(" ").map(_.toInt)
    nPalindromic(ints(0), ints(1))

  }

  def nPalindromic(start: Int, end: Int):Int = {
    (start to end).count(i => isPalindromic(i.toString))
  }

  println(nPalindromic(readLine()))
}

Measured memory_bytes: 40696
#include<iostream>
#include<string>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<vector>
#include<functional>
#include<iomanip>
#include<queue>
#include<cassert>
#include<tuple>
#include<set>
#include<map>
#include<list>
#include<bitset>

#define PB push_back
#define ALL(a)  (a).begin(),(a).end()
#define DWN(a)  (a).begin(),(a).end(), greater<int>()
#define rep(i, m) for (int i = 0; i < m; i++)
#define REP(i, n, m) for (int i = n; i < m; i++)

#define mod 1000000007

using namespace std;

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

const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };
const int INF = (int)1e9;

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int a, b;
	cin >> a >> b;
	if (a <= b) {
		cout << a << endl;
	}
	else {
		cout << a - 1 << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long n,ans,a[234234],b[234234],i,j;
int main()
{
  scanf("%lld",&n);
  for(i=1;i<=n+1;i++) scanf("%lld",&a[i]);
  for(i=1;i<=n;i++) scanf("%lld",&b[i]);
  for(i=1;i<=n;i++)
    {
	  if(b[i]>a[i]) b[i]-=a[i],ans+=a[i];
	  else ans+=b[i],b[i]=0;
	  if(b[i]>a[i+1]) ans+=a[i+1],a[i+1]=0;
	  else a[i+1]-=b[i],ans+=b[i];
	}
cout<<ans<<endl;
} 

Measured memory_bytes: 1792
#include <iostream>
#include <stack>
#include <string>
using namespace std;

int main() {
	stack<int> num;
	string str;
	int temp1,temp2;
	while(cin >> str) {
		if(str=="+") {
			temp1=num.top();
			num.pop();
			temp2=num.top();
			num.pop();
			num.push(temp1+temp2);
		} else if(str=="-") {
			temp1=num.top();
			num.pop();
			temp2=num.top();
			num.pop();
			num.push(temp2-temp1);
		} else if(str=="*") {
			temp1=num.top();
			num.pop();
			temp2=num.top();
			num.pop();
			num.push(temp1*temp2);
		} else {
			num.push(stoi(str));
		}
	}
	cout << num.top() << endl;
	return 0;
}

Measured memory_bytes: 3196
// #define DEBUGGING
#include <bits/stdc++.h>
#define endl '\n'
#define ALL(V) (V).begin(), (V).end()
#define ALLR(V) (V).rbegin(), (V).rend()
template <typename T> using V = std::vector<T>;
template <typename T> using VV = V<V<T>>;
using ll = std::int64_t;
using ull = std::uint64_t;
using PLL = std::pair<ll, ll>;
using TLL = std::tuple<ll, ll, ll>;
template <typename T> const T& var_min(const T &t) { return t; }
template <typename T> const T& var_max(const T &t) { return t; }
template <typename T, typename... Tail> const T& var_min(const T &t, const Tail&... tail) { return std::min(t, var_min(tail...)); }
template <typename T, typename... Tail> const T& var_max(const T &t, const Tail&... tail) { return std::max(t, var_max(tail...)); }
template <typename T, typename... Tail> void chmin(T &t, const Tail&... tail) { t = var_min(t, tail...); }
template <typename T, typename... Tail> void chmax(T &t, const Tail&... tail) { t = var_max(t, tail...); }
template <typename T> const T& clamp(const T &t, const T &low, const T &high) { return std::max(low, std::min(high, t)); }
template <typename T> void chclamp(T &t, const T &low, const T &high) { return t = clamp(t, low, high); }
namespace init__ { struct InitIO { InitIO() { std::cin.tie(nullptr); std::ios_base::sync_with_stdio(false); std::cout << std::fixed << std::setprecision(30); } } init_io; }
#define mv_rec make_v(init, tail...)
template <typename T> T make_v(T init) { return init; }
template <typename T, typename... Tail> auto make_v(T init, size_t s, Tail... tail) { return V<decltype(mv_rec)>(s, mv_rec); }
#undef mv_rec
using namespace std;
#ifdef DEBUGGING
#include "../../debug/debug.cpp"
#else
#define DEBUG(...) 0
#define DEBUG_SEPARATOR_LINE 0
#endif

int main() {
    ll N;
    cin >> N;
    string S, T;
    cin >> S >> T;
    for(ll i = 0; i < N; i++) cout << S[i] << T[i];
    cout << endl;
    return 0;
}


Measured memory_bytes: 256
def primes(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, n + 1):
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return [i for i in range(n + 1) if is_prime[i]]

N = 10 ** 5 
primelist = primes(10**5)
prime_add = [0] * (10**5+1)
idx = 0
i = 1
import bisect
L = len(primelist)

while idx < L:
    if i == primelist[idx]:
        tmp = bisect.bisect_right(primelist,(i+1)//2)
        if primelist[tmp-1] == (i+1)//2:
            prime_add[i] = prime_add[i-1] + 1
        else:
            prime_add[i] = prime_add[i-1]
        i += 1
        idx += 1
    else:
        prime_add[i] = prime_add[i-1]
        i += 1
while i < N+1:
    prime_add[i] = prime_add[i-1]
    i += 1
        

Q = int(input())
lr = [list(map(int,input().split())) for _ in range(Q)]

for l,r in lr:
    print(prime_add[r]-prime_add[l-1])
    
    

Measured memory_bytes: 29432
#include<iostream>
#include<string>
using namespace std;
int main(){
  string s;
  cin >> s;
  if(s.at(2)==s.at(3) && s.at(4)==s.at(5)){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
 
using namespace std;
 
#define PB push_back
#define MP make_pairA
#define REP(i,n) for(int i=0;i<(n);i++)
int main()
{
    string s;
    cin>>s;
    string y="YAKI";
    bool f=true;
    REP(i,y.size())if(y[i]!=s[i])f=false;
    if(f)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int MAXN=2e5+10,MAXM=2e6+10;
const int INF=INT_MAX,MOD=1e9+7;
const ll llINF=~(1ll<<63);


int main()
{
    ll t1,t2,a1,a2,b1,b2;
    cin>>t1>>t2>>a1>>a2>>b1>>b2;
    ll ans=(a1-b1)*t1+(a2-b2)*t2;
    if(!ans)return puts("infinity"),0;
    ll x1=t1*a1-t1*b1;
    if(!x1)return puts("infinity"),0;
    if((x1>0)==(ans<0))
    {
        ll p=x1+ans,res=0;
        if(abs(x1)%abs(ans))res++;
        printf("%lld",abs(x1/ans)*2+res);
    }
    else return puts("0"),0;
    return 0;
}


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

int main()
{
    long long N,K;
    cin >> N >> K;
    vector<ll> P(N,0);
    vector<ll> C(N,0);
    for(ll i=0;i<N;i++)
    {
        ll p;cin>>p;
        p--;
        P[i]=p;
    }
    for(ll i=0;i<N;i++)
    {
        cin>>C[i];
    }
    ll res=-1e18;
    for(ll start=0;start<N;start++)
    {
        ll x = start;
        ll total = 0;
        vector<ll> loop;
        while(true)
        {
            x = P[x];
            total+=C[x];
            loop.emplace_back(C[x]);
            if(x==start)break;
        }
        ll cur = 0;
        for(ll i=0;i<loop.size();i++)//ループのうちどこまで進めるか調べる（進まない方が得することがあるため）
        {
            cur+=loop[i];
            if(i+1>K)break;
            ll cutPoint=cur;
            if(0<total){
                ll e = (K-(i+1))/loop.size();//K回から進んだ回数を引く。ここで、iが0になっているので＋１する。
                cutPoint += total*e;
            }
            res=max(cutPoint,res);
        }
    }
    cout<< res <<endl;
}

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

int main(){
    int a,b,i;
    char s;
    cin >> a >> b;

    for(i=0; i<a+b+1; i++){
        cin >>s;
        if(i==a){
            if(s!='-'){
                cout << "No\n";
                return 0;
            }
        }else{
            if(s<'0' || '9'<s){
                cout << "No\n";
                return 0;
            }
        }
    }

    cout << "Yes\n";

    return 0;
}


Measured memory_bytes: 256
s=list(input())
s=list(map(int,s))

a=s[0]*10+s[1]
b=s[2]*10+s[3]

if (a==0 and b==0) or (a>=13 and b>=13) or (a==0 and b>=13) or (a>=13 and b==0):
  print("NA")
elif 0<a<=12 and 0<b<=12:
  print("AMBIGUOUS")
elif 0<a<=12:
  print("MMYY")
else:
  print("YYMM")
  
  

Measured memory_bytes: 61964
#include <bits/stdc++.h>
#define pb push_back
#define ff first
#define ss second
using namespace std;
using ll = long long;
using vi = vector<int>;
using pii = pair<ll, ll>;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  int s, w;
  cin >> s >> w;
  cout << (s <= w ? "unsafe" : "safe") << endl;
}

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

int func(int x,int p){
    return x * (100 + p) / 100;
}

void solve(int x,int y,int s){
    int ans = 0;
    for(int i = 1;i < s;i++){
        for(int j = 1;j < s;j++){
            if(func(i,x)+func(j,x) == s){
                ans = max(ans,func(i,y)+func(j,y));
            }
        }
    }
    cout << ans << endl;
}

int main(){
    int x,y,s;
    while(true){
        cin >> x >> y >> s;
        if(!x)return 0;
        solve(x,y,s);
    }
}


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

int main()
{
  int Q;
  scanf("%d",&Q);
  while(Q--){
    long long A,B,C,D;
    scanf("%lld%lld%lld%lld",&A,&B,&C,&D);
    C--,D--;
    bool ans[200];
    if(A==B||A==B+1){
      for(int i=C;i<=D;i++){
	ans[i-C]=(i%2==0?0:1);
      }
    }
    else if(B==A+1){
      for(int i=C;i<=D;i++){
	ans[i-C]=(i%2==0?1:0);
      }
    }
    else{
      long long d=(A+B)/(min(A,B)+1);
      long long X=(d*A-B+d-1)/(d*d-1),rA;
      if(X*(d*d-1)==d*A-B+d-1){
	rA=0;
      }
      else{
	rA=(d*(A-d*X+1)-(B-X))/d;
      }
      for(int i=C;i<=D;i++){
	int p=i-C;
	if(i<X*(d+1)){
	  ans[p]=(i%(d+1)==d?1:0);
	}
	else if(i<X*(d+1)+rA){
	  ans[p]=0;
	}
	else{
	  ans[p]=((A+B-i-1)%(d+1)==d?0:1);
	}
      }
    }
    for(int i=0;i<=D-C;i++){
      putchar(ans[i]?'B':'A');
    }
    putchar('\n');
  }
}



Measured memory_bytes: 384
#include<stdio.h>

int main(void)
{
	int c, d, e;
	scanf("%d %d %d", &c, &d, &e);

	if (c < d&&d < e)
	{
		printf("Yes\n");
	}
	else
	{
		printf("No\n");
	}
	return 0;
	
}

Measured memory_bytes: 580
import math


def main():
    A, B, H, M = map(int, input().split())

    alpha = 30.0 * (H + M / 60.0)
    beta = 6 * M
    theta = alpha - beta

    l = math.sqrt(A ** 2 + B ** 2 - 2.0 * A * B * math.cos(math.radians(theta)))

    print(l)


if __name__ == '__main__':
    main()


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

#define I inline
#define fi first
#define se second
#define R register
#define LL long long
#define mp make_pair
#define reg register int
#define pii pair<int,int>
#define fo(i, a, b) for(reg i = a; i <= b; i++)
#define fd(i, a, b) for(reg i = a; i >= b; i--)
#define cr const reg&
using namespace std;

I int _max(cr x, cr y) {return x > y ? x : y;}
I int _min(cr x, cr y) {return x < y ? x : y;}
I int read() {
	reg x = 0, f = 1; char ch = getchar();
	while(ch < '0' || ch > '9') {if(ch == '-') f = -1; ch = getchar();}
	while(ch >= '0' && ch <= '9') x = (x << 3) + (x << 1) + (ch ^ 48), ch = getchar();
	return x * f;
}
I void ptt(LL x) {if(x >= 10) ptt(x / 10); putchar(x % 10 + '0');}
I void put(LL x) {x < 0 ? putchar('-'), ptt(-x) : ptt(x);}
I void pr1(LL x) {put(x), putchar(' ');}
I void pr2(LL x) {put(x), puts("");}

char ss[21];

int main() {
	scanf("%s", ss + 1);
	if(strlen(ss + 1) < 4) puts("No");
	else {
		if(ss[1] == 'Y' && ss[2] == 'A' && ss[3] == 'K' && ss[4] == 'I') puts("Yes");
		else puts("No");
	}
	return 0;
}



Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
int a[100100],n,ans;
int main()
{
	scanf("%d",&n);
	for(int i = 1,t;i <= n;i++)
	{
		scanf("%d",&t);
		a[t]++;
	}
	for(int i = 1;i <= 99999;i++)
		ans = max(a[i - 1] + a[i] + a[i + 1],ans);
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 512
import itertools

n = int(input())
P = list(map(int, input().split()))
Q = list(map(int, input().split()))

N = [str(x) for x in range(1, n+1)]
All = []
for y in itertools.permutations(N):
    moji = ''
    for z in y:
        moji += z
    All.append(moji)

All = sorted(All)
p = ''
q = ''
for x in P:
    p += str(x)
for x in Q:
    q += str(x)

a = All.index(p)
b = All.index(q)
ans = abs(a-b)
print(ans)

Measured memory_bytes: 6296
#include <cstdio>
#include <algorithm>
using namespace std;

int main()
{
  char s1, s2;
  bool boll[3];
  boll[0] = true;
  boll[1] = boll[2] = false;
  while (~scanf("%c,%c\n", &s1, &s2))
    swap(boll[s1-'A'], boll[s2-'A']);

  int ans = 0;
  for (int i = 0; i < 3; ++i) {
    if (boll[i])
      ans = i;
  }
  printf("%c\n", ans+'A');
  return 0;
}

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

int dp[100000][4];


int func(int day,int n,int pact,int arr[][3])
{
    if(day==n)
    {
        return 0;
    }
    
    if(dp[day][pact]!=-1)
    {
        return dp[day][pact];
    }
    
    int a=0;
    int b=0;
    int c=0;
    if(pact!=1)
    {
        a=arr[day][0]+func(day+1,n,1,arr);
    }
    if(pact!=2)
    {
        b=arr[day][1]+func(day+1,n,2,arr);
    }
    if(pact!=3)
    {
        c=arr[day][2]+func(day+1,n,3,arr);
    }
    
    dp[day][pact]=max(a,max(b,c));

    return dp[day][pact];
}    

int main()
{
    int n;
    cin>>n;
    
    int arr[n][3];
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<3;j++)
        {
            cin>>arr[i][j];
            //cout<<arr[i][j]<<" ";
        }
        //cout<<endl;
    }
    
    int day=0;
    int pact=0;
    
    memset(dp,-1,sizeof(dp));
    cout<<func(day,n,pact,arr);
    
    
    return 0;
}

Measured memory_bytes: 10752
n,a,b=map(int,input().split())
c=a+b
s=input()
count1=0
count2=0
for i in s:
    if count1>=c:
        print("No")
        continue
    else:
        if i=="a":
            print("Yes")
            count1+=1
            continue
        if i=="b" and count2<b:
            print("Yes")
            count1+=1;count2+=1
            continue
        print("No")


Measured memory_bytes: 75536
N = int(input())
dn=list(map(int,input().split()[:N]))

dn1=sorted(dn,reverse=True)
dnlen=int(len(dn)/2)
if dn1[dnlen-1] == dn1[dnlen]:
    print(0)
else:
    print(dn1[dnlen -1]-dn1[dnlen])

Measured memory_bytes: 14152
#include <iostream>

using namespace std;

int main(){
	int N, x;
	while(cin >> N >> x){
		long long res = 0;
		int a, b; cin >> a;
		for(int i=1;i<N;i++){
			cin >> b;
			int over = max(0, (a+b)-x);
			int sb = min(b, over);
			res += sb + max(0, over-b);
			a = b - sb;
		}
		cout << res << endl;
	}
}


Measured memory_bytes: 256
n=int(input())
c0=0
c1=0
c2=0
c3=0
for c in range(n):
    s=input()
    if s=="AC":
        c0+=1
    elif s=="WA":
        c1+=1
    elif s=="TLE":
        c2+=1
    else:
        c3+=1
print("AC x "+str(c0))
print("WA x "+str(c1))
print("TLE x "+str(c2))
print("RE x "+str(c3))

Measured memory_bytes: 9228
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>
#include <cstring>
#include <cmath>
#include <stack>
#include <iomanip>
#include <tuple>
#include <functional>

#define int long long
#define CONTAINS(v,n) (find((v).begin(), (v).end(), (n)) != (v).end())
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define ARY_SORT(a, size) sort((a), (a)+(size))
#define MAX(a,b) (((a) > (b)) ? (a) : (b))
#define MIN(a,b) (((a) < (b)) ? (a) : (b))
#define REMOVE(v,a) v.erase(remove(v.begin(), v.end(), a), v.end())
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
using namespace std;


int a[200000];

signed main()
{
	int N;
	cin >> N;
	REP(i, N) cin >> a[i];

	int x = a[0];
	int y = 0;
	for (int i = 1; i < N; i++)
	{
		y += a[i];
	}

	int min = abs(x - y);

	for (int i = 1; i < N - 1; i++)
	{
		x += a[i];
		y -= a[i];
		int n = abs(x - y);
		if (min > n)
		{
			min = n;
		}
	}

	cout << min << endl;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const ll MOD = 998244353;
ll n;
ll calc (ll x) {
    ll res = 0;
    ll i = 1; ll sum = 0;
    while (res + i <= x) {
        res += i;
        i++; sum ++;
    }
    return sum;
}
int main () {
    ios::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    cin >> n;
    ll sum = 0;
    for (ll i = 2; i * i <= n; ++i) {
        if (n % i == 0) {
            ll cnt = 0;
            while (n % i == 0) {n /= i; cnt++;}
            sum += calc(cnt);
        }
    }
    if (n != 1) sum += calc(1);
    cout << sum << endl;
}

Measured memory_bytes: 3652
import java.io.*
import java.util.*
import kotlin.math.*

fun main(){
	val f = BufferedReader(InputStreamReader(System.`in`))

	val (n,m,x) = f.readLine().split(" ").map{it.toInt()}

	val board = Array(n){f.readLine().toCharArray()}

	var start = 0
	for(k in 0 until n){
		for(j in 0 until m){
			if(board[k][j] == '#') start++
		}
	}

	var answer = 0
	for(k in 0 until (1 shl n)){
		for(j in 0 until (1 shl m)){
			val cur = Array(n){r -> CharArray(m){c -> board[r][c]}}
			var cursum = start
			var ni = 0
			while(ni <= 6){
				if(k and (1 shl ni) == (1 shl ni)){
					for(h in 0 until m){
						if(cur[ni][h] == '#'){
							cur[ni][h] = '.'
							cursum--
						}
					}
				}

				if(j and (1 shl ni) == (1 shl ni)){
					for(h in 0 until n){
						if(cur[h][ni] == '#'){
							cur[h][ni] = '.'
							cursum--
						}
					}
				}
				ni++
			}
			if(cursum == x) answer++
		}


	}

	println(answer)
}


Measured memory_bytes: 39344
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Queue;
import java.util.Scanner;
 


public class Main {
	static int a1[]= {0,-1,0,1};
	static int b1[]= {-1,0,1,0};
	private static         Scanner sc = new Scanner(System.in);
	//result = Math.pow(num1, num3)
	//StringBuffer str = new StringBuffer(hoge1);
	//String hoge2 = str.reverse().toString();
	//map.containsKey(A)

	//Map<String, Integer> map = new HashMap<String, Integer>(n);
	/*for ( キーのデータ型 key : マップの名前.keySet() ) {
		データのデータ型 data = マップの名前.get( key );
		
		// keyやdataを使った処理;
	}*/
	//int i = Integer.parseInt(s);
	//Queue<String> qq=new ArrayDeque<>(); //add,poll,peek
	//Deque<String> qq=new ArrayDeque<>();//push,pop,peek
	//ArrayList<String> cc = new ArrayList<>(n);
	//Collections.sort(list);
	//Array.sort(list);   cc.contains(tmp)
	//Arrays.asList(c).contains("a")
	//list.set(1,"walk");//1 1 2 3 5
	static int K,N;
	static long mod =1000000007;
	public static void main(String[] args) {
		long N=sc.nextLong();
		ArrayList<Integer> cc = new ArrayList<>(10001);
		
		long ans=0;
		for(long i=1;i*i<=N;i++) {
			if(N%i==0) {
				if(ans==0)ans=(i-1)+(N/i)-1;
				else ans=Math.min(ans, (i-1)+(N/i)-1);
			}
		}
		p(ans);
		//System.out.println(cc);
	}
	//N==S
	//E==W
//83 S 
	//69E
	//78N
	//87W
	
	//static ArrayList<Integer> cc = new ArrayList<>(10001);
	
	static void p(String ans) {System.out.println(ans);};
	static void p(int ans) {System.out.println(ans);};
	static void p() {System.out.println();};
	static void p(long ans) {System.out.println(ans);};
	static void p(double ans) {System.out.println(ans);};
	public static int gcd(int a, int b) {
        return b == 0 ? a: gcd(b, a % b);
	}
	static String nextPermutation(String s) {
		ArrayList<Character> list=new ArrayList<>();
		for(int i=0;i<s.length();i++) {
			list.add(s.charAt(i));
		}
		int pivotPos=-1;
		char pivot=0;
		for(int i=list.size()-2;i>=0;i--) {
			if(list.get(i)<list.get(i+1)) {
				pivotPos=i;
				pivot=list.get(i);
				break;
			}
		}
		if(pivotPos==-1&&pivot==0) {
			return "Final";
		}
		int L=pivotPos+1,R=list.size()-1;
		
		
		
		int minPos=-1;
		char min =Character.MAX_VALUE;
		
		for(int i=R;i>=L;i--) {
			if(pivot<list.get(i)) {
				if(list.get(i)<min) {
					min=list.get(i);
					minPos=i;
				}
			}
		}
		
		Collections.swap(list, pivotPos, minPos);
		Collections.sort(list.subList(L, R+1));
		
		
		StringBuilder sb=new StringBuilder();
		for(int i=0;i<list.size();i++) {
			sb.append(list.get(i));
		}
		return sb.toString();
	}
}
	


Measured memory_bytes: 23764
/*author: hyperion_1724
  date: 
*/
#include <bits/stdc++.h>
using namespace std;
#define ll long long 
#define READ(X) cin>>X;
#define READV(X) long long X; cin>>X;
#define READAR(A,N) long long A[N]; for(int i=0;i<N;i++) {cin>>A[i];}
#define rz(A,N) A.resize(N);
#define sz(X) (long long)(X.size())
#define pii pair<int,int>
#define pll pair<long,long>
#define fi first
#define se second
#define trav(x,A) for(auto &x:A)
#define veci vector<int>
#define vecl vector<long long>
#define FORI(a,b,c) for(int a=b;a<c;a++)
#define FORD(a,b,c) for(int a=b;a>c;a--)
#define adj(N) vector<vector<int>> ADJ(N+1)


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

	READV(N);
	ll dp[N+1]={0};
	dp[0]=1;
	READV(M);
	bool S[N+1]={false};
	FORI(i,0,M)
	{
		READV(x);
		S[x]=true;
	}
	FORI(i,1,N+1)
	{
		if(S[i])
		{
			dp[i]=0;
		}
		else
		{
			ll a1=dp[i-1];
			if(i>1)
			{
				a1=(a1+dp[i-2])%1000000007;
			}
			dp[i]=a1;
		}
	}
	cout<<dp[N]<<endl;

	return 0;
}

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

#define REP(i, l, n) for(int i=(l), i##_len=(n); i<i##_len; ++i)
#define ALL(x) (x).begin(),(x).end()
#define pb push_back

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

const ll mod = 1e9 + 7;

ll RepeatSquaring(ll N, ll P){
    if(P==0) return 1;
    if(P%2==0){
        ll t = RepeatSquaring(N, P/2);
        return t*t % mod;
    }
    return ((N * RepeatSquaring(N, P-1)) % mod);
}


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

int main(){
    int n, k; cin >> n >> k;
    vector<ll> lis(k+1, 1);
    REP(i, 1, k+1){
        ll c = k / i;
        lis[i] = RepeatSquaring(c, n);
    }
    ll ans = 0;
    for(int i = k; i >= 1; i--){
        ll mid = lis[i];
        for(int l = i + i; l < k+1; l += i){
            mid = (mid - lis[l] + mod) % mod;
        }
        lis[i] = mid;
        ans = (ans + (mid * i % mod))%mod;
    }
    cout << ans << endl;
}

Measured memory_bytes: 4024
#define DEB
#include <map>
#include <set>
#include <iostream>
#include <vector>
#include <string>
#include <cassert>

#define REP(i,m) for(int i=0;i<(m);++i)
#define REPN(i,m,in) for(int i=(in);i<(m);++i)
#define ALL(t) (t).begin(),(t).end()
#define CLR(a) memset((a),0,sizeof(a))
#define pb push_back
#define mp make_pair
#define fr first
#define sc second

using namespace std;


#ifdef DEB
#define dump(x)  cerr << #x << " = " << (x) << endl
#define prl cerr<<"called:"<< __LINE__<<endl
#define dumpR(x) cerr<<"\x1b[31m"<<#x<<" = " <<(x)<<"\x1b[39m"<<endl
#define dumpY(x) cerr<<"\x1b[33m"<<#x<<" = " <<(x)<<"\x1b[39m"<<endl
#define dumpG(x) cerr<<"\x1b[32m"<<#x<<" = " <<(x)<<"\x1b[39m"<<endl
template<class T> void debug(T a,T b){ for(;a!=b;++a) cerr<<*a<<' ';cerr<<endl;}
#else
#define dump(x) ;
#define dumpR(x) ;
#define dumpY(x) ;
#define dumpG(x) ;
#define prl ;
template<class T> void debug(T a,T b){ ;}
#endif

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

typedef long long int lint;
typedef pair<lint,lint> pi;

namespace std{
    template<class S,class T>
    ostream &operator <<(ostream& out,const pair<S,T>& a){
        out<<'('<<a.fr<<','<<a.sc<<')';
        return out;
    }
}

//const int INF=5e8;


int main(){
    int x,y;
    cin>>x>>y;
    int res=max(4-x, 0) + max(4-y, 0);
    if(x==1 && y==1) res+=4;
    res*=100000;
    cout<<res<<endl;


    return 0;
}





Measured memory_bytes: 256
#include<bits/stdc++.h>
#define endl '\n'
#define PI 3.14159265358979323844
#define DECIMAL(n)  std::cout << std::fixed;std::cout << std::setprecision(n);
#define mp make_pair
#define pb push_back
#define mod 1000000007
#define int long long int 
#define forr(i,a,b) for (int i= a; i <b; ++i)
    using namespace std; 
 vector<int>g[100005];
 int dp[100005][2];
 int P(int source, int con , int parent){
     if(dp[source][con]!=-1)return dp[source][con];
     int ans=0; int w1=1; 
     for(auto neighbour : g[source]){
         if(neighbour!=parent ){
           w1=(w1*P(neighbour , 0 , source))%mod;
     }} int w2=1;
        if(con==0){
             for(auto neighbour : g[source]){
         if(neighbour!=parent )
             w2=(w2*P(neighbour , 1 , source))%mod;
         }
     }ans=w1;  if(con==0)ans+=w2;
     ans=ans%mod;
     return dp[source][con]=ans%mod;
 }
 signed main(){
 int n;cin>>n;
 memset(dp,-1,sizeof dp);
 forr(i,1,n){
     int a,b;cin>>a>>b;
     g[a].pb(b);
     g[b].pb(a);}
 cout<<P(1,0,1);}

Measured memory_bytes: 15616
#Union Find
import sys
input = sys.stdin.readline
 
n,m = map(int,input().split())

#根なら-size,子なら親の頂点
par = [-1]*n

#xの根を求める
def find(x):
    if par[x] < 0:
        return x
    else:
        par[x] = find(par[x])
        return par[x]
#xとyの属する集合の併合
def unite(x,y):
    x = find(x)
    y = find(y)
    
    if x != y:
        #sizeの大きいほうがx
        if par[x] > par[y]:
            x,y = y,x
        par[x] += par[y]
        par[y] = x

#xとyが同じ集合に属するかの判定
def same(x,y):
    return find(x) == find(y)

def size(x):
    return -par[find(x)]


edge = [tuple(map(int,input().split())) for i in range(m)]
edge = edge[::-1]
for i in range(m):
    edge[i] = (edge[i][0]-1,edge[i][1]-1)

res = []
for i in range(m):
    fi = find(edge[i][0])
    se = find(edge[i][1])
    if fi == se:
        res.append(0)
    else:
        res.append(size(fi)*size(se))
        unite(fi,se)
ass = 0
for i in range(m):
    ass += res[m-1-i]
    print(ass)

Measured memory_bytes: 22420
#include <iostream>
#include <string>
#include <algorithm>
#include <cassert>
#include <limits>
#include <numeric>
#include <type_traits>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <functional>
#include <utility>
#include <sstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <complex>
#include <climits>

using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef pair<ll, ll> P;
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define REP(i,n)  FOR(i,0,n)

ll gcd(ll a, ll b) {
  while (a && b) {
    if (a >= b) a %= b;
    else b %= a;
  }
  return a + b;
}
ll ketasum(ll n) { //桁の数字全ての和を返す 例: 112 -> 4
	ll sum=0;
	if (n<0) return 0;
	while (n>0) {
		sum += n%10;
		n /= 10;
	}
	return sum;
}

typedef pair<ll, ll> pair_t;

bool comp(const pair_t &a, const pair_t &b) {
        return a.first < b.first;
}

void sort2vectors(vector<ll> &av, vector<ll> &bv)
{ // ふたつの配列をまとめてそーと A[2,1] B[3,4] -> 1,4 2,3
        ll n = av.size();
        vector<pair_t> p(n);
        vector<ll> av2(n), bv2(n);
        for (ll i = 0; i < n; i++)
                p[i] = make_pair(av[i], bv[i]);
        sort(p.begin(), p.end(), comp);
        for (ll i = 0; i < n; i++) {
                av2[i] = p[i].first;
                bv2[i] = p[i].second;
        }
        av = av2;
        bv = bv2;
}
ll facctorialMethod(ll k){ //階乗
	ll s;
	if(k > 1){
		s = k*facctorialMethod(k-1);
	} else {
		s = 1;
	}
	return s;
}
vl primes(ll n){
	vl x(n);
	REP(i, n){
		x[i] = 0;
	}
	for(ll i = 2; i < sqrt(n) + 2; i++){
		while(n % i == 0){
			n /= i;
			x[i-1] += 1;
		}
	}
	if(n > 1){
		x[n-1] += 1;
	}
	return x;
}


void solve(){
	ll N;
	cin >> N;
	vl A(N);
	vl B(N);
	vl C(N-1);
	REP(i, N){
		cin >> A[i];
	}
	REP(i, N){
		cin >> B[i];
	}
	REP(i, N-1){
		cin >> C[i];
	}
	ll ans = 0;
	REP(i, N){
		ans += B[A[i]-1];
		if(i < N-1){
			if(A[i+1] == A[i] + 1){
				ans += C[A[i]-1];
			}
		}
	}
	cout << ans << endl;
}


const ll mod = 1000000007;
int main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	solve();
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){

char a,b,c;
  cin>>a>>b>>c;
  cout << a;
char d,e,f;
  cin>>d>>e>>f;
  cout << e;
char g,h,i;
  cin>>g>>h>>i;
  cout << i;
  
return 0;
  
}

Measured memory_bytes: 384
N = int(input())
Nstr = str(N)

def dfs(s):
  if(int(s) > N):
    return 0
  
  ret = 1 if all(s.count(c) > 0 for c in '753') else 0
  for c in '753':
    ret+=dfs(s+c)
    
  return ret

print(dfs('0'))

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

int func1( int n )
{
	return n;
}

int func2( int n )
{
	return 7 - n;
}

void output( char map[][ 8 ], int dir )
{
	int angle = dir * 90;
	int i, j;
	int *p1, *p2;
	int (*f1)(int), (*f2)(int);
	switch( dir ){
		case 1: f1 = &func2; f2 = &func1; p1 = &j; p2 = &i; break;
		case 2: f1 = &func2; f2 = &func2; p1 = &i; p2 = &j; break;
		case 3: f1 = &func1; f2 = &func2; p1 = &j; p2 = &i; break;

	}

	cout << angle << endl;
	for( i = 0; i < 8; ++i ){
		for( j = 0; j < 8; ++j ){
			cout << map[ f1( *p1 ) ][ f2( *p2 ) ];
		}
		cout << endl;
	}
}

int main()
{
	char map[ 8 ][ 8 ];

	for( int i = 0; i < 8; ++i ){
		for( int j = 0; j < 8; ++j ){
			cin >> map[ i ][ j ];
		}
	}

	output( map, 1 );
	output( map, 2 );
	output( map, 3 );

	return 0;
}

Measured memory_bytes: 1140
#include <bits/stdc++.h>
using namespace std;
 
int main() {
	double n, ans = 0;
	cin >> n;

	for(int i=0;i<n;i++){
		double a;
		cin >> a;
		ans += 1 / a;
	}
	cout << 1 / ans << endl;
}

Measured memory_bytes: 256
require 'prime'
require 'set'
require 'tsort'
include Math
ALP = ('a'..'z').to_a
INF = 0xffffffffffffffff
def max(a,b);              a > b ? a : b                              end
def min(a,b);              a < b ?  a : b                             end
def swap(a,b);             a, b = b, a                                end
def gif;                   gets.to_i                                  end
def gff;                   gets.to_f                                  end
def gsf;                   gets.chomp                                 end
def gi;                    gets.split.map(&:to_i)                     end
def gf;                    gets.split.map(&:to_f)                     end
def gs;                    gets.chomp.split.map(&:to_s)               end
def gc;                    gets.chomp.split('')                       end
def pr(num);               num.prime_division                         end
def pr?(num);              Prime.prime?(num)                          end
def digit(num);            num.to_s.length                            end
def array(s,ini=nil);      Array.new(s){ini}                          end
def darray(s1,s2,ini=nil); Array.new(s1){Array.new(s2){ini}}          end
def rep(num);              num.times{|i|yield(i)}                     end
def repl(st,en,n=1);       st.step(en,n){|i|yield(i)}                 end
puts 48-gif


Measured memory_bytes: 2556
#include <iostream>
#include <set>
#include <vector>

using namespace std;

#define MAX_M 200000

// 入力
int N, M;
int a[MAX_M], b[MAX_M];

bool from1[MAX_M + 1], toN[MAX_M + 1];

int main(void) {
    cin >> N >> M;
    for (int i = 0; i < M; ++i) {
        cin >> a[i] >> b[i];
    }

    for (int i = 0; i < M; ++i) {
        if (a[i] == 1) {
            from1[b[i]] = true;
        }
        if (b[i] == N) {
            toN[a[i]] = true;
        }
    }

    for (int j = 1; j <= MAX_M; ++j) {
        if (from1[j] && toN[j]) {
            cout << "POSSIBLE" << endl;
            return 0;
        }
    }
    cout << "IMPOSSIBLE" << endl;
    return 0;
}

Measured memory_bytes: 2176
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int c = 0;
        for (int i = 0 ; i < n ; i++) {
            int a = sc.nextInt();
            if (a % 2 == 1) {
                c++;
            }
        }
        
        System.out.println(c % 2 == 0 ? "YES" : "NO");
    }

}


Measured memory_bytes: 49732
H,W = map(int, input().split())

m = []

for _ in range(H):
    S = list(input())
    m.append(S)

a = []
b = [-1,1,0]

for i in range(len(b)):
    for j in range(len(b)):
        a.append([b[i],b[j]])

for i in range(H):
    for j in range(W):
        if m[i][j]=="#":
            continue
        count = 0
        for k in range(len(a)):
            x = a[k][0]
            y = a[k][1]
            if (x+j)<0 or (y+i)<0 or (x+j)>=W or (y+i)>=H:
                continue
            if m[y+i][x+j]=="#":
                count = count + 1
        m[i][j]=count

for i in range(H):
    print(*m[i],sep="")

Measured memory_bytes: 3444
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define INF 1e9
#define PI 3.14159265359
#define MOD 1000000007
#define ALL(v) v.begin(),v.end()
#define ALLR(v) v.rbegin(),v.rend()
typedef long long ll;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
//isPrime
//modpow modinv
//getDigit
int main() {
  cout << fixed << setprecision(10);
  int n;
  cin >> n;
  vector<int> d(n);
  rep(i,n){
    cin >> d.at(i);
  }
  sort(ALL(d));
  cout << d.at(n/2)-d.at(n/2-1) << endl;
}


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

int main(){
  int n;
  cin >> n;
  ll ans = 0, cnt = 0;
  for(int i=0; i<n; ++i){
    int x;
    cin >> x;
    if(x == 0){
      ans += cnt/2;
      cnt = 0;
    }
    else cnt += x;
  }
  ans += cnt/2;
  cout << ans << endl;
}

Measured memory_bytes: 3608
sx, sy, gx, gy = list(map(int, input().split()))
l = []
dx = gx - sx
dy = gy - sy
for i in range(dx):
	l.append('R')
for i in range(dy):
	l.append('U')
for i in range(dx):
	l.append('L')
for i in range(dy):
	l.append('D')
l.append('D')
for i in range(dx+1):
	l.append('R')
for i in range(dy+1):
	l.append('U')
l.append('L')
l.append('U')
for i in range(dx+1):
	l.append('L')
for i in range(dy+1):
	l.append('D')
l.append('R')
S = ''.join(l)
print(S)


Measured memory_bytes: 3188
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <array>
#include <vector>
#include <string>

using namespace std;

int main() {

  int t;
  cin >> t;
  array<array<char, 5>, 10> table{ { {}, { '.', ',', '!', '?', ' ' }, { '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' } } };
  array<int, 10> sizes = {0, 5, 3, 3, 3, 3, 3, 4, 3, 4};
  
  for (int i = 0; i < t; i++){
    string line;
    cin >> line;
    int counter = -1;
    int type = -1;
    for(const char& ch : line){
      if(ch == '0'){
	if (type >= 0) {
	  cout << table[type][counter % sizes[type]];
	  type = -1;
	  counter = -1;
	}
      } else {
	type = ch - '0';
	counter++;
      }
    }
    cout << endl;
  } 
}

Measured memory_bytes: 1200
#include <stdio.h>
#include <vector>
#include <map>
#include <string>
#include <iostream>
#include <limits.h>
#include <algorithm>

using namespace std;

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

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

    int c = 1;
    int m = H[0];
    for (int i = 1; i < N; i++)
    {
        if (m <= H[i]) {
            c++;
        }

        m = max(m, H[i]);
    }

    cout << c << endl;

    return 0;
}

Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Sagor
 */

#include <fstream>
#include <iostream>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std;
typedef long long int ll;
typedef double ld;

class t {
public:
	void solve(std::istream& in, std::ostream& out) {

	    int n,i,s=1,c=0;
	    in>>n;

        int a[n];

        for(i=0;i<n;i++)
        {
            in>>a[i];

            if(a[i]!=s)
            {
                c++;
            }
            if(a[i]==s)
            {
                s++;
            }
        }

       // out<<s<<endl;
      if(s==1)
          out<<-1<<endl;
      else
        out<<c<<endl;

	}
};


int main() {
    std::ios_base::sync_with_stdio(0);
    std::cin.tie(nullptr);
	t solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


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

struct dice {
	int top;
	int bottom;
	int north;
	int east;
	int south;
	int west;
};


class Dice {
	public:
		void init(int i, int j, int k, int l, int m, int n);
		void order(char order);
		void print_right(int i);
		char Thantei(int i);
		int Fhantei(int i);
	private:
		struct dice dice_s;
		void north();
		void east();
		void south();
		void west();
};

void Dice::init(int i, int j, int k, int l, int m, int n)
{
	dice_s.top = i;
	dice_s.bottom = n;
	dice_s.south = j;
	dice_s.east = k;
	dice_s.west = l;
	dice_s.north = m;

}

void Dice::order(char order)
{

		switch(order) {
			case 'E':
				east();
				break;
			case 'W':
				west();
				break;
			case 'N':
				north();
				break;
			case 'S':
				south();
				break;
			default:
				break;
		}

}

void Dice::east()
{
	int top = dice_s.top;
	int bottom = dice_s.bottom;
	int east = dice_s.east;
	int west = dice_s.west;

	dice_s.top = west;
	dice_s.bottom = east;
	dice_s.east = top;
	dice_s.west = bottom;


}
void Dice::west()
{
	int top = dice_s.top;
	int bottom = dice_s.bottom;
	int east = dice_s.east;
	int west = dice_s.west;

	dice_s.top = east;
	dice_s.bottom = west;
	dice_s.east = bottom;
	dice_s.west = top;


}
void Dice::north()
{
	
	int top = dice_s.top;
	int bottom = dice_s.bottom;
	int north = dice_s.north;
	int south = dice_s.south;

	dice_s.top = south;
	dice_s.bottom = north;
	dice_s.south = bottom;
	dice_s.north = top;

}
void Dice::south()
{
	int top = dice_s.top;
	int bottom = dice_s.bottom;
	int north = dice_s.north;
	int south = dice_s.south;

	dice_s.top = north;
	dice_s.bottom = south;
	dice_s.south = top;
	dice_s.north = bottom;

}

void Dice::print_right(int i)
{
	cout << i << '\n';

}

char Dice::Thantei(int i) 
{
	if (dice_s.top == i)
		return 'R';
	else if (dice_s.bottom == i)
		return 'B';
	else if (dice_s.north == i)
		return 'N';
	else if (dice_s.south == i)
		return 'S';
	else if (dice_s.east == i)
		return 'E';
	else if (dice_s.west == i)
		return 'W';
	else 
		return 'X';
}


int Dice::Fhantei(int front)
{
	if (front == dice_s.south)
		return (dice_s.east);
	else if (front == dice_s.north)
		return (dice_s.west);
	else if (front == dice_s.west)
		return (dice_s.south);
	else if (front == dice_s.east)
		return (dice_s.north);

}

int main()
{
	class Dice dice1;
	int first,second,third,forth,fifth,sixth,top,front;
	int order;
	char Top,Right;

	cin >> first >> second >> third >> forth >> fifth >> sixth;

	dice1.init(first, second, third, forth, fifth, sixth);

	cin >> order;

	for (int i = 0; i < order; i++) {
		cin >> top >> front;

		Top = dice1.Thantei(top);
			switch (Top) {

				case 'R':
					break;
				case 'B':
					dice1.order('S');
					dice1.order('S');
					break;
				case 'N':
					dice1.order('S');
					break;
				case 'S':
					dice1.order('N');
					break;
				case 'W':
					dice1.order('E');
					break;
				case 'E':
					dice1.order('W');
					break;
				default:
					break;

			}
		Right = dice1.Fhantei(front);


		dice1.print_right(Right);

	}


	return 0;
}


Measured memory_bytes: 3096
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    vector<int> a(n+1);
    for (int i=1; i<=n; i++)cin>>a[i];
    vector<int> res(n+1);
    // res[n] = a[n];
    for (int i=n; i>=1; i--){
        int cnt = 0;
        for (int j=2*i; j<=n; j+=i){
            cnt = cnt ^ res[j];
        }
        res[i] = cnt^a[i];
    }
    vector<int> x;
  	for (int i=1; i<=n; i++)if (res[i])x.push_back(i);
  	cout<<x.size()<<endl;
  	for (int i=0; i<x.size(); i++)cout<<x[i]<<" ";
}

Measured memory_bytes: 5396