akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define maxn 100010
using namespace std;
int a[maxn];
multiset<int> S[2], nxt[2];
void solve()
{
	int t0 = S[0].size(), t1 = S[1].size();
	if (t0 == 0 || t1 == 0) return;
	nxt[0].clear(); nxt[1].clear();
	if (t0 == t1)
	{
		int pre = 0;
		for (int i = 1; i <= t0; i++)
		{
			int v1 = *S[0].begin(), v2 = *S[1].begin();
			S[0].erase(S[0].begin());
			S[1].erase(S[1].begin());
			if (pre == 0) {nxt[1].insert(v2 - v1); printf("%d %d\n", v2, v1);}
			else {nxt[0].insert(v1 - v2); printf("%d %d\n", v1, v2);}
			pre ^= 1;
		}
		swap(S[0], nxt[0]);
		swap(S[1], nxt[1]);
	}
	else
	{
		int pre = 0;
		if (t1 > t0) pre = 1;
		for (int i = 1; i <= t1 && i <= t0; i++)
		{
			int v1 = *S[0].begin(), v2 = *S[1].begin();
			S[0].erase(S[0].begin());
			S[1].erase(S[1].begin());
			if (pre == 0) {nxt[1].insert(v2 - v1); printf("%d %d\n", v2, v1);}
			else {nxt[0].insert(v1 - v2); printf("%d %d\n", v1, v2);}
			pre ^= 1;
		}
		if (t1 > t0) nxt[1].insert(*(S[1].begin()));
		else nxt[0].insert(*(S[0].begin()));
		swap(S[0], nxt[0]);
		swap(S[1], nxt[1]);
	}
	solve();
}
int main()
{
	int n, ch;
	scanf("%d", &n);
	for (int i = 1; i <= n; i++)
		scanf("%d", &a[i]);
	sort(a + 1, a + n + 1);
	if (a[n] < 0) ch = n;
	else if (a[1] > 0) ch = 2;
	else
	for (int i = 2; i <= n; i++)
		if (a[i] >= 0) {ch = i; break;}
	int now = 0, res = 0;
	for (int i = ch; i <= n; i++)
		res += a[i];
	for (int i = 1; i <= ch - 1; i++)
		res -= a[i];
	printf("%d\n", res);
	int en = ch - 1;
	if (ch != n)
	{
		printf("%d %d\n", a[ch - 1], a[ch]);
		now = a[ch - 1] - a[ch];
		for (int i = ch + 1; i <= n - 1; i++)
		{
			printf("%d %d\n", now, a[i]);
			now -= a[i];
		}
		printf("%d %d\n", a[n], now);
		now = a[n] - now;
		en = ch - 2;
	}
	else now = a[ch];
	for (int i = 1; i <= en; i++)
	{
		printf("%d %d\n", now, a[i]);
		now -= a[i];
	}
	return 0;
}

Measured memory_bytes: 2304
#include<cstdio>
#include<string>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
char a,b;
int main(){
    cin>>a>>b;
    if(a=='A'&&b=='A')cout<<"="<<endl;
    if(a=='A'&&b=='B')cout<<"<"<<endl;
    if(a=='A'&&b=='C')cout<<"<"<<endl;
    if(a=='A'&&b=='D')cout<<"<"<<endl;
    if(a=='A'&&b=='E')cout<<"<"<<endl;
    if(a=='A'&&b=='F')cout<<"<"<<endl;
    if(a=='B'&&b=='A')cout<<">"<<endl;
    if(a=='B'&&b=='B')cout<<"="<<endl;
    if(a=='B'&&b=='C')cout<<"<"<<endl;
    if(a=='B'&&b=='D')cout<<"<"<<endl;
    if(a=='B'&&b=='E')cout<<"<"<<endl;
    if(a=='B'&&b=='F')cout<<"<"<<endl;
    if(a=='C'&&b=='A')cout<<">"<<endl;
    if(a=='C'&&b=='B')cout<<">"<<endl;
    if(a=='C'&&b=='C')cout<<"="<<endl;
    if(a=='C'&&b=='D')cout<<"<"<<endl;
    if(a=='C'&&b=='E')cout<<"<"<<endl;
    if(a=='C'&&b=='F')cout<<"<"<<endl;
    if(a=='D'&&b=='A')cout<<">"<<endl;
    if(a=='D'&&b=='B')cout<<">"<<endl;
    if(a=='D'&&b=='C')cout<<">"<<endl;
    if(a=='D'&&b=='D')cout<<"="<<endl;
    if(a=='D'&&b=='E')cout<<"<"<<endl;
    if(a=='D'&&b=='F')cout<<"<"<<endl;
    if(a=='E'&&b=='A')cout<<">"<<endl;
    if(a=='E'&&b=='B')cout<<">"<<endl;
    if(a=='E'&&b=='C')cout<<">"<<endl;
    if(a=='E'&&b=='D')cout<<">"<<endl;
    if(a=='E'&&b=='E')cout<<"="<<endl;
    if(a=='E'&&b=='F')cout<<"<"<<endl;
    if(a=='F'&&b=='A')cout<<">"<<endl;
    if(a=='F'&&b=='B')cout<<">"<<endl;
    if(a=='F'&&b=='C')cout<<">"<<endl;
    if(a=='F'&&b=='D')cout<<">"<<endl;
    if(a=='F'&&b=='E')cout<<">"<<endl;
    if(a=='F'&&b=='F')cout<<"="<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>

int main() {
	int n, k;
	std::cin >> n >> k;
	int h[100000];
	for (int i = 0; i < n; i++) {
		std::cin >> h[i];
	}
	int dp[100000];
	for (int i = 1; i < n; i++) {
		dp[i] = -1;
	}
	dp[0] = 0;
	int temp;
	for (int i = 0; i < n - 1; i++) {
		for (int j = i + 1; j < i + k+1 && j < n; j++) {
			temp = abs(h[j] - h[i]) + dp[i];
			if (temp < dp[j] || dp[j] == -1) {
				dp[j] = temp;
			}
		}
	}
	std::cout << dp[n - 1] << std::endl;
}


Measured memory_bytes: 1024
#include <stdio.h>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <iostream>
#include <math.h>
#include <bitset>
#include <iomanip>
#include <queue>
#include <cstring>
using namespace std;

int main() {
	long long H, W; cin >> H >> W;
	if (H == 1 || W == 1)cout << 1 << endl;
	else cout << (H*W + 1) / 2 << endl;

}

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

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

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

	int first = -1, second = -1;
	for (int i = 0; i < n; ++i) cin >> arr[i];

	for (int i = 0; i < n; ++i) {
		if (arr[i] >= first) {
			second = first;
			first = arr[i];
		}
		else if (arr[i] >= second) {
			second = arr[i];
		}
	}

	for (int i = 0; i < n; ++i) {
		if (arr[i] == first) cout << second << '\n';
		else cout << first << '\n';
	}
}

Measured memory_bytes: 2432
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
        int N;
        cin >> N;
        vector<int> diff(100003);
        for(int i = 0; i < N; ++i){
                int a, b;
                cin >> a >> b;
                ++diff[a];
                --diff[b + 1];
        }
        int count = 1, answer = 1;
        for(int i = 2; i <= N + 1; ++i){
                count += diff[i];
                if(i <= count){
                        answer = max(answer, i);
                }
        }
        cout << answer - 1 << endl;
        return 0;
}

Measured memory_bytes: 1532
object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val n = sc.nextInt
  val cells = List.fill(n)(sc.nextLong())

  def Lower(in: List[Long]): Int = {
    @annotation.tailrec
    def f(inn: List[Long], max: Int, nowLength: Int, beforeH: Long): Int = inn match {
      case Nil => if (max > nowLength) max else nowLength
      case ::(h, tl) =>
        if (beforeH != -1 && beforeH >= h)
          f(tl, max, nowLength + 1, h)
        else
          f(tl, if (max > nowLength) max else nowLength, 0, h)
    }

    f(in, 0, 0, -1)
  }
  println(Lower(cells))
}

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

typedef long long ll;

#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define file() freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define tt int t; cin>>t; while(t--)
#define nl cout<<"\n";
#define sp cout<<" ";
#define rep(i, a, b) for(long long i=a; i<b; i++)

const int INF = 1e9 + 7;
const int MOD = 1e9 + 7;
double PI = 4*atan(1);

int main()
{
    optimize();
    int h, w;

    cin>> h>> w;
    char a[h+10][w+10];

    int r[h+1]= {}, c[w+1]={};


    for(int i=0; i<h; i++)
    {
        for(int j=0; j<w; j++)
        {
            cin>> a[i][j];

            if( a[i][j]=='#')
            {
                r[i]++;
                c[j]++;
            }
        }
    }


    for(int i=0; i<h; i++)
    {
        if(r[i]== 0)
            continue;
        for(int j=0; j<w; j++)
        {
            if(c[j]== 0)
            continue;

            cout << a[i][j];

        }
        nl;
    }




    return 0;
}




Measured memory_bytes: 3660
#include<stdio.h>
int main(void)
{
  int num,max1=0,max2=0,max3=0,sum[2],i,j;
  for(i=0;i<2;i++)
  {
    for(j=0;j<10;j++)
    {
      scanf("%d",&num);
      if(num>max1)
      {
        max3=max2;
        max2=max1;
        max1=num;
      }
      else if(num>max2)
      {
        max3=max2;
        max2=num;
      }
      else if(num>max3)
      {
        max3=num;
      }
    }
    sum[i]=max1+max2+max3;
    max1=0;max2=0;max3=0;
  }
  printf("%d %d\n",sum[0],sum[1]);
  return 0;
}



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

using namespace std;
long long seg[800000];

void update(long long val, int id, int l, int r, int index) {
    if(l > id or r < id) {
        return;
    }

    if(l == r) {
        seg[index] = val;
        return;
    }
    update(val, id, l, (l + r)/2, 2*index);
    update(val, id, (l + r)/2 + 1, r, 2*index + 1);

    seg[index] = max(seg[2*index], seg[2*index + 1]);
}

long long get(int L, int R, int l, int r, int index) {
    if(l > R or r < L) {
        return 0;
    }

    if(l >= L and r <= R) {
        return seg[index];
    }

    int mid = (l + r) /2;
    long long a = get(L, R, l, mid, 2*index);
    long long b = get(L, R, mid + 1, r, 2*index + 1);

    return max(a, b);
}


int main() {
    int n; cin >> n;
    int height[n], beauty[n];
    for(int i = 0; i < n; ++i) cin >> height[i];

    for(int j = 0; j < n; ++j)  cin >> beauty[j];

    for(int i = 0; i < n; ++i) {
        long long mx = get(1, height[i] - 1, 1, n, 1);

        update(mx + beauty[i], height[i], 1, n, 1);

    }
    cout << seg[1] << "\n";

}

Measured memory_bytes: 7936
n,m,xx,yy = [int(i) for i in input().split()]
x =  [int(i) for i in input().split()]
y =  [int(i) for i in input().split()]

max_x = max(x)
min_y = min(y)

for i in range(yy):
  if max_x < i and i <= min_y and xx<i<=yy:
    print("No War")
    break
else:
  print("War")

Measured memory_bytes: 3064
// Problem : C - Step
// Contest : AtCoder - AtCoder Beginner Contest 176
// URL : https://atcoder.jp/contests/abc176/tasks/abc176_c
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

/*

WINNERS NEVER QUIT AND QUITTERS NEVER WIN!!

*/

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<long,long> pl;
typedef pair<ll,ll> pll;
typedef vector<long> vl;
typedef vector<bool> vb;
typedef vector<ll> vll;
typedef vector<vl> vvl;
typedef vector<vb> vvb;
typedef vector<vll> vvll;
typedef vector<pll> vpll;
typedef vector<string> vs;
typedef unordered_map<ll,ll> umll;

#define FOR(i,a,b) for(long long i=a;i<b;++i)
#define REV(i,a,b) for(long long i=a;i>=b;i--)
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define ub upper_bound
#define lb lower_bound
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define tc ll tests;cin>>tests;while(tests--)
#define io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define coutv(v) for(auto it: (v))cout<<it<<" ";newl;
#define cout2d(v) for(auto it: (v)) {for(auto j:it) cout<<j<<" ";newl;}
#define cinv(v,n) vll (v)(n);FOR(i,0,(n)){cin>>v[i];}
#define cinvg(v,n) (v).resize(n);FOR(i,0,(n)){cin>>v[i];}
#define cin2d(v,n,m) vvll (v)(n,vll(m,0));FOR(i,0,n){FOR(j,0,m){cin>>v[i][j];}}
#define cin2dg(v,n,m) (v).resize(n,vll(m));FOR(i,0,n){FOR(j,0,m){cin>>v[i][j];}}
#define newl cout<<"\n"
#define mod 1000000007
#define INF LLONG_MAX/2

int main()
{
    io;
    ll n,mx=0,ans=0;
    cin>>n;
    cinv(a,n)
    mx=a[0];
    FOR(i,1,n)
    {
    	if(a[i]<mx){ans+=mx-a[i];}
    	else{mx=max(mx,a[i]);}
    }
    cout<<ans;
    return 0;
}



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

int main()
{
    int r,d,x;
    cin >> r >>  d >> x;
    int ans[11];
    ans[0] = x;
    for(int i = 1; i <= 10; i++){
        ans[i] = r * ans[i - 1] - d;
        cout <<ans[i] << endl;
    }
    return 0;
}


Measured memory_bytes: 256
data class Process(val id: String, val time: Int)

class Queue<T>(private val maxSize: Int) {

    private val elements = arrayListOf<T>()

    fun isEmpty() = elements.size == 0

    fun isFull() = elements.size == maxSize

    fun enqueue(element: T) {
        if (isFull()) throw Exception("error")
        elements.add(element)
    }

    fun dequeue(): T {
        if (isEmpty()) throw Exception("error")
        return elements.removeAt(0)
    }
}

fun main(args: Array<String>) {
    val (n, q) = readLine()!!.split(" ").map(String::toInt)
    val queue = Queue<Process>(n)
    (1..n).forEach {
        val (id, t) = readLine()!!.split(" ")
        queue.enqueue(Process(id, t.toInt()))
    }

    var count = 0
    while (!queue.isEmpty()) {
        val process = queue.dequeue()
        if (process.time <= q) {
            count += process.time
            val id = process.id
            println("$id $count")
        } else {
            queue.enqueue(Process(process.id, process.time - q))
            count += q
        }
    }
}


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

int main() {
	int n,m,x;
	cin>>n>>m>>x;
	int cntr=0, cntl=0;
	rep(i,m){
		int a;
		cin>>a;
		if(a<x)cntl++;
		else cntr++;
	}
	cout<<min(cntr,cntl)<<endl;
}


Measured memory_bytes: 256
n=int(input())
prr=list(map(lambda x: int(x)-1,input().split()))
ans=0
brr=[]
for i in range(len(prr)):
    if i==prr[i]:
        brr.append(True)
    else:
        brr.append(False)
brr.append(False)
#print(brr)
isIn=False
cur=0
ans=0
for b in brr:
    if b and isIn:
        cur+=1
    elif b and not isIn:
        cur=1
        isIn=True
    elif not b and isIn:
        if cur%2==0:
            ans+=cur//2
        else:
            ans+=cur//2+1
        isIn=False
        cur=0
print(ans)


Measured memory_bytes: 14008
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int a = sc.nextInt();
		if(n % 500 <= a) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}

	}

}


Measured memory_bytes: 21844
/*
AizuOnline A1502
War
*/
#include <stdio.h>
#include <stdlib.h>
#define MAX(x,y) ((x)>(y))? (x):(y) 
int n;
int h[500];

int comp(void * x,void * y)
{
  return(*(int *)y - *(int *)x);
}
main()
{
  long long sum;
  int i,offset;

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

  qsort(h,n,sizeof(int),(__compar_fn_t)comp);
  sum = 1;offset=0;
  for(i=0;i<n;i++)
    {
      sum += MAX((h[i] - offset),0);
      if((i % 4)==3)
	offset++;
    }

  printf("%lld\n",sum);

return(0);
}

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

int a[7]={1,10,100,1000,10000,100000,1000000};
int ans;

int solve(int n){
    int res=0;
    if(n<10) return n;
    ans++;
    for(int i=0;a[i]<n;i++){
        res=max(res,(n/a[i])*(n%a[i]));
    }
    return solve(res);
}

int main(){
    int q;
    scanf("%d",&q);
    for(int i=0;i<q;i++){
        int n;
        ans=0;
        scanf("%d",&n);
        solve(n);
        printf("%d\n",ans);
    }
    return 0;
}

Measured memory_bytes: 1028
#include<iostream>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<limits>
#include<sstream> 
#include<unordered_map>      

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;

const int inf = numeric_limits<int>::max() >> 2;
const ll linf = numeric_limits<ll>::max() >> 2;
const ull ulinf = numeric_limits<ull>::max() >> 2;
const double pi = acos(-1);
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int dx8[8]={-1,0,1,-1,1,-1,0,1};
const int dy8[8]={-1,-1,-1,0,0,1,1,1};

#define p_queue(i) priority_queue<i> 
#define rp_queue(i) priority_queue<i, vector<i>, greater<i>> 
#define umap(i,j) unordered_map<i,j>
#define P(p) cout<<(p)<<endl
#define PS(p) cout<<(p)<< " "
#define PN cout << endl
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i = (n-1); i >= (int)(m); i--)
#define inrep(n,a) for(int i = 0; i < (int)(n); i++)cin >> a[i];
#define mod(i) ((i)%(ll)(1e9 + 7))
#define divm(a,b) (mod(a * modpow((ll)b,(ll)(1e9+5))))
#define rsort(a,b,c) sort(a, b, greater<c>())
#define vsort(v) sort(v.begin(), v.end())
#define rvsort(v,c) sort(v.begin(), v.end(), greater<c>()) 
#define ft first
#define sd second
#define pb push_back
#define it insert
#define sz(x) ((int)(x).size())
#define lb(a,n,k) (lower_bound(a,a+n,k) - (a)) 
#define vlb(a,k)  (lower_bound(a.begin(),a.end(),k) - a.begin())
#define ub(a,n,k) (upper_bound(a,a+n,k) - (a)) 
#define vub(a,k)  (upper_bound(a.begin(),a.end(),k) - a.begin())
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return

/*
ll modpow(ll i,ll j){ ll tmp=1; while(j){ if(j%2)tmp=mod(tmp*i);i=mod(i*i);j/=2;}return tmp;}
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; }
*/

/*
vector<string> split(const string &str, char sep){
    vector<string> v;
    stringstream ss(str);
    string buffer;
    while( getline(ss, buffer, sep) ) {
        v.push_back(buffer);
    }
    return v;
}
*/

/*
ll ncr[100][100];
ll nCr(int n, int r){if(n==r) ret ncr[n][r] = 1; if(r==0) ret ncr[n][r] = 1; if(r==1) ret ncr[n][r] = n;if(ncr[n][r]) ret ncr[n][r]; ret ncr[n][r] = nCr(n-1,r) + nCr(n-1,r-1);}

ll npr[100][100]={};
ll nPr(int n,int r){if(npr[n][r])ret npr[n][r];if(r==0)ret npr[n][r] = 1;if(r==1)ret npr[n][r] = n;ret npr[n][r] = n * nPr(n-1,r-1);}

ll nHr(int n,int r){ret nCr(n+r-1,r);}
*/

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



int main(){
    int a,b;
    cin >> a >> b;
    
    string s,t;
    s = "";
    rep(i,0,b)s += (char)('0'+a);
    t = "";
    rep(i,0,a)t += (char)('0'+b);
    
    if(s < t)P(s);
    else P(t);
    return  0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <stdio.h>
using namespace std;
typedef long long LL;
int main(int argc, char* argv[])
{
	LL W,H,x,y;
	cin>>W>>H>>x>>y;
	double MaxA=0;
	double A=(W*H)/2.0;
	printf("%.6lf ",A);

	if (2*x==W && 2*y==H){
		cout<<1<<endl;
	}else{
		cout<<0<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
using System.Numerics;

namespace AtCoder
{
    class Program
    {
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }
        static public (T1 a, T2 b) Slice<T1, T2>()
        {
            var t = ReadLine().Split();
            return (
            (T1)Convert.ChangeType(t[0], typeof(T1)),
            (T2)Convert.ChangeType(t[1], typeof(T2)));
        }
        static long Mod = (long)1e9 + 7;
        static void Main(string[] args)
        {
            SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            Solve();
            Out.Flush();
            Read();
        }
        static void Solve()
        {
            var HWAB = Sarray();
            var H = HWAB[0];
            var W = HWAB[1];
            var A = HWAB[2];
            var B = HWAB[3];
            var cmb = new Combination(200010);
            var ans = 0L;
            for (var i = B; i < W; ++i)
                ans = (ans + cmb.nCk((int)(H - 1 - A + i), (int)i) * cmb.nCk((int)(A - 1 + W - 1 - i), (int)(W - 1 - i)) % Mod) % Mod;
            WriteLine(ans);
        }
        public class Combination
        {
            readonly long mod;
            readonly long[] fac, finv, inv;
            public Combination(long n, long mod = 1000000007)
            {
                long max = n + 1;
                this.mod = mod;
                fac = new long[max];
                finv = new long[max];
                inv = new long[max];
                fac[0] = fac[1] = 1;
                finv[0] = finv[1] = 1;
                inv[1] = 1;
                for (int i = 2; i < max; ++i)
                {
                    fac[i] = fac[i - 1] * i % mod;
                    inv[i] = mod - inv[mod % i] * (mod / i) % mod;
                    finv[i] = finv[i - 1] * inv[i] % mod;
                }
            }
            public long nCk(int n, int k)
            {
                if (n < k) return 0;
                if (n < 0 | k < 0) return 0;
                return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
            }
        }
    }
}

Measured memory_bytes: 33260
from collections import deque

if __name__ == "__main__":
    stacks = []
    for i in range(3):
        stacks.append(deque([x for x in input()]))
    winner = False
    turn = 0
    while not winner:
        turn = ord(stacks[turn].popleft()) - ord('a')
        if len(stacks[turn]) == 0:
            winner = chr(65 + turn)
    print(winner)


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

int n,  a[101010], ans;


int main(){

ios::sync_with_stdio(0);
cin.tie(0);

cin >> n;


rep(i, 1, n){

cin >> a[i];

}
a[n+1]=0;
a[0]=0;
rep(i, 0, n)
{
    ans+= abs(a[i]-a[i+1]);
}

rep(i, 1, n){

int tmp, t;
tmp = abs(a[i-1] -a[i]) + abs(a[i]- a[i+1]);

t = abs(a[i-1]- a[i+1]);

cout << ans-tmp + t << endl;

}


return 0;
}


Measured memory_bytes: 1664
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define MOD1 1000000007
#define MOD2 998244353
#define LIMIT1 200002
#define LIMIT2 500002
typedef long long ll;
typedef long double ld;
typedef const void cv;
#define rep(i,n) for((i)=0;(i)<(n);(i)++)
#define per(i,n) for((i)=(n)-1;(i)>=0;(i)--)
#define max(a,b) ((a)>(b) ? (a) : (b))
#define min(a,b) ((a)<(b) ? (a) : (b))
#define zt(a,b) (max((a),(b))-min((a),(b)))
#define absl(v) labs((v))
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll nPr(int n,int r){ll i,result=1;rep(i,r){result*=(ll)(n-i);}return result;}
ll nCr(int n,int r){ll i,result=1;if(n<r) return 0;rep(i,min(r,n-r)){result*=(ll)(n-i);result/=(ll)(i+1);}return result;}
#define nHr(n,r) nCr((int)((n)+(r)+1),(int)(r))
#define sankaku(x) (((x)*((x)+1))/2)
int dx[8]={1,0,-1,0,1,-1,-1,1},dy[8]={0,1,0,-1,1,1,-1,-1};
int upint(cv *a, cv *b) { return *(int *)a < *(int *)b ? -1 : *(int *)a > *(int *)b ? 1 : 0; }
int downint(cv *a, cv *b) { return *(int *)a < *(int *)b ? 1 : *(int *)a > *(int *)b ? -1 : 0; }
int upchar(cv *left, cv *right) {return strcmp((char *)left,(char *)right);}
int downchar(cv *left, cv *right) {return strcmp((char *)right,(char *)left);}
void tmpInit(int *c,ll m) {ll i;rep(i,m) c[i]=i;}
ll modpow(ll a, ll n, ll mod) {
  ll res = 1;
  while (n > 0) {
    if (n & 1){
      res *= a; if(mod>=1) res %= mod;
    }
    a *= a; if(mod>=1) a %= mod;
    n >>= 1;
  }
  return res;
}
void initialize(){
    
}
int main(void){
  initialize();
  ll n,m,i,j,k;
  ld result=0;
  ll a;
  ld b;
  char s[LIMIT1];
  
  scanf("%lld %llf",&a,&b);
  result = a*(ll)(b*100+0.1);
  result /= 100;
  printf("%lld",(ll)result);
  
  return 0;
}

Measured memory_bytes: 1756
#include<iostream>
#define rep(i,n) for(int i=0;i<n;i++)
#define ck(a,b) (0<=(a)&&(a)<b)
using namespace std;
int dx[]={-1,1,0,0},dy[]={0,0,-1,1};
char land[60][60];
int w,h;
int cked[2][60][60],own[2][60][60];
int ad(int y,int x,int c){
	cked[c][y][x]=1;
	int r=0,ny,nx;
	rep(d,4){
		ny=y+dy[d],nx=x+dx[d];
		if(!ck(ny,h)||!ck(nx,w)||cked[c][ny][nx])continue;
		if(land[ny][nx]==(c?'W':'B'))return 1;
	}
	rep(d,4){
		ny=y+dy[d],nx=x+dx[d];
		if(!ck(ny,h)||!ck(nx,w)||cked[c][ny][nx])continue;
		if(land[ny][nx]=='.')r=r||ad(ny,nx,c);
		if(r)return 1;
	}
	return r;
}
void fl(int y,int x,int c){
	own[c][y][x]=1;
	rep(d,4){
		int ny=y+dy[d],nx=x+dx[d];
		if(ck(ny,h)&&ck(nx,w)&&!own[c][ny][nx]&&land[ny][nx]=='.')fl(ny,nx,c);
	}
}
int main(){
	while(cin>>w>>h,w){
		rep(i,h)cin>>land[i];
		rep(i,h)rep(j,w)rep(k,2)cked[k][i][j]=own[k][i][j]=0;
		rep(i,h)rep(j,w)rep(k,2)
		if(!cked[k][i][j]&&land[i][j]=='.')if(ad(i,j,k))fl(i,j,k);
		int ans[2]={0};
		rep(i,h)rep(j,w)if(own[0][i][j]+own[1][i][j]==1)ans[own[0][i][j]]++;
		cout<<ans[1]<<" "<<ans[0]<<endl;
	}
	return 0;
}

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

int main() {
    string n;
    cin >> n;
    int counter = 0;
    if (n[0] == n[1] and n[1] == n[2]) ++counter;
    if (n[1] == n[2] and n[2] == n[3]) ++counter;
    if (counter == 0) cout << "No" << endl;
    else cout << "Yes" << endl;
}


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

// 基本テンプレート
#pragma region MACRO
#define P(x) cout << (x) << endl
#define p(x) cout << (x)
#define PED cout << "\n"
#define rep(i,n) for(int i=0; i<(int)n; ++i)
#define REP(i,x,n) for(int i=x; i<(int)n; ++i)
#define repi(i,n) for(int i=0; i<=(int)n; ++i)
#define REPI(i,x,n) for(int i=x; i<=(int)n; ++i)
#define ILP while(true)
#define FOR(i,c) for(__typeof((c).begin())!=(c).begin(); i!=(c).end(); ++i)
#define ALL(c) (c).begin(), (c).end()
#define mp make_pair
#pragma endregion

// 型
#pragma region TYPE_DEF
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<string, string> pss;
typedef pair<string, int> psi;
typedef pair<int, string> pis;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long double> vld;
typedef vector<long> vl;
typedef vector<long long> vll;
typedef vector<string> vs;
#pragma endregion

// Effective std
#pragma region ESTD
template<typename C, typename T> int count(C& c, T t) { return count(ALL(c), t); }
template<typename C, typename F> int count_if(C& c, F f) { return count_if(ALL(c), f); }
template<typename C, typename T> void erase(C& c, T t) { remove(ALL(c), t), c.end(); }
template<typename C> void remove(vector<C>& c, unsigned int index) { c.erase(c.begin()+index); }
template<typename C, typename T, typename U> void replace(C& c, T t, U u) { replace(ALL(c), t, u); }
template<typename C, typename F, typename U> void replace_if(C& c, F f, U u) { (ALL(c), f, u); }
template<typename C> void reverse(C& c) { reverse(ALL(c)); }
template<typename C> void sort(C& c) { sort(ALL(c)); }
template<typename C, typename Pred> void sort(C& c, Pred p) { sort(ALL(c), p); }
#pragma endregion

// 定数
#pragma region CONST_VAL
constexpr int PI = (2*acos(0.0));
constexpr int EPS = (1e-9);
constexpr int MOD = (int)(1e9+7);
constexpr int INF = 100000000;
#pragma endregion

string s, s2;
int n;
int a, b, c;

int main()
{
    cin >> s;
    P(s.substr(0,4) + " " + s.substr(4,8));
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <map>
#include <string>
#include <utility>
#include <algorithm>
#include <functional>
#include <climits>
#include <math.h>
#include <iomanip>
#include <fstream>
#include <random>
#include <set>
#include <queue>
#include <complex>
#include <stack>
#include <numeric>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
using namespace std;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    //std::ifstream in("input.txt");std::cin.rdbuf(in.rdbuf());
    int n;
    cin>>n;
    int a[n+2];
    a[0]=0;
    a[n+1]=0;
    rep(i,n){cin>>a[i+1];}
    int sum=0;
    int ans=0;
    rep(i,n+1){sum+=abs(a[i+1]-a[i]);}
    rep1(i,n){ans=sum-abs(a[i+1]-a[i])-abs(a[i]-a[i-1])+abs(a[i+1]-a[i-1]);
        cout<<ans<<endl;
    }
    //cout<<sum<<endl;
    return 0;
}

Measured memory_bytes: 1664
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;
typedef long double lb;
#define int long long
#define double long double
#define endn "\n"
typedef pair<int,int> P;
const int MOD = 1000000007;
const ll INF = 1e16;
const double EPS = 1e-10;
const double PI = 3.141592653589793;
template<class T> inline bool chmin(T& a, T b){if(a>b){a = b;return 1;}return 0;}
template<class T> inline bool chmax(T& a, T b){if(a<b){a = b;return 1;}return 0;}
const pair<int,int> fd[] = {make_pair(1,0),make_pair(-1,0),make_pair(0,1),make_pair(0,-1)}; 


////////////////////////////////////////////////////////////////////
template<typename T>
struct edge {
  int to, from;T cost;
  edge(int to) : from(-1), to(to), cost(-1) {}
  edge(int to, T cost) : from(-1), to(to), cost(cost) {}
  edge(int from, int to, T cost) : from(from), to(to), cost(cost) {}
};
template<typename T>
using edges = vector<edge<T>>;
template<typename T>
using graph = vector<edges<T>>;
template<typename T>
using matrix = vector<vector<T>>;

template<typename T>
bool compByCost(const edge<T>& left, const edge<T>& right){
  return left.cost < right.cost; 
}

template<typename T>
vector<T> dijkstra(int s, graph<T> &g){
  vector<T> dist(g.size()+10, INF);dist[s] = 0;
  priority_queue<pair<T, int>, vector<pair<T, int>>, greater<pair<T,int>>> que;que.push(P(0,s));
  while(!que.empty()){
    pair<T,int> p = que.top();que.pop();
    int v = p.second;
    if(dist[v] < p.first)continue;
    rep(i, g[v].size()){
      edge<T> e = g[v][i];
      if(dist[e.to] > dist[v] + e.cost){
        dist[e.to] = dist[v] + e.cost;
        que.push(make_pair(dist[e.to], e.to));
      }
    }
  }
  return dist;
}

  int n;
signed main(){
  cin>>n;int ans = 0;
  repd(i,1,n+1){
    if(i % 3 != 0 && i % 5 != 0)ans += i;
  }
  cout << ans << endl;
}


Measured memory_bytes: 3620
import java.util.*;
import java.io.*;

class Main {

  

  public static void main(String[] args) {
    Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
    
    int N = in.nextInt();
    long[] a = new long[N];
    for (int i = 0; i < N; i++) {
      a[i] = in.nextInt();
    }

    

    long[][] dp = new long[N][N];
    for (int i = 0; i < N; i++) {
      dp[i][i] = a[i];
    }

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

    for (int len = 2; len <= N; len++) {
      for (int i = 0; i < N; i++) {
        int j = i + len - 1; 
        if (j >= N) {break;}
        dp[i][j] = a[j] - (i == 0 ? 0 : a[i - 1]) - Math.min(dp[i + 1][j], dp[i][j - 1]);
      }
    }




    System.out.println(2 * dp[0][N - 1] - a[N - 1]);
  }

}


Measured memory_bytes: 131832
import * as fs from "fs";

const input = (fs.readFileSync("/dev/stdin", "utf8") as string).split("\n");

//const [n, m] = input[0].split(" ").map((x: string): number => +x);
//const a = input[1].split(" ").map((x: string): number => +x);

const [s, t] = input[0].split(' ');
const [a, b] = input[1].split(' ').map((x : string): number => +x);
const u = input[2];

if (u===s){
	console.log(a-1, b);
}else{
	console.log(a,b-1);
}


Measured memory_bytes: 7372
#include <bits/stdc++.h>
using namespace std;
#define sz(x) ((int) (x).size())

typedef long long ll;
const ll MOD = 998244353;
const int n = 2e5 + 10;

int N;
string X;
vector<int> D;
bool dPos[100];
bool S[n];
ll pw[n], C[n];
ll tmp[n];

int main(){
  cin >> N;
  cin >> X;
  for(int i=0; i<N; i++){
    S[i] = X[i] == '1';
  }
  pw[0] = 1;
  for(int i=1; i<=N; i++){
    pw[i] = pw[i-1] * 2;
    pw[i] %= MOD;
  }
  ll res = 0;
  for(int i=N; i>0; i--){
    if(N%i == 0 && N/i%2 == 1){
      D.push_back(i);
      dPos[sz(D)-1] = true;
    }
  }
  for(int x : D){
    C[x] = 2*x - tmp[x];
    for(int y : D){
      if(x%y == 0 && x != y){
        tmp[y] += C[x];
      }
    }
  }
  /*
  for(int x : D){
    cout << x << ": " << C[x] << endl;
  }
  */
  for(int i=0; i<N; i++){
    if(S[i]){
      for(int j=0; j<sz(D); j++){
        if(!dPos[j] || (D[j] <= i && !S[i-D[j]]))
          continue;
        int rem = max(0, D[j]-i-1);
        //cout << "rem " << D[j] << ": " << rem << " -> " << pw[rem] << " " << C[D[j]] << endl;
        res += pw[rem] * C[D[j]];
        res %= MOD;
      }
    }
    for(int j=0; j<sz(D); j++){
      if(i >= D[j]){
        dPos[j] &= S[i] != S[i-D[j]];
      }
    }
  }
  for(int j=0; j<sz(D); j++){
    if(dPos[j]){
      res += C[D[j]];
      res %= MOD;
    }
  }

  cout << res << endl;

  return 0;
}


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

public class Main {

	public static int count;

	public static void main(String[] args) throws NumberFormatException, IOException {
		// TODO 自動生成されたメソッド・スタブ

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int amount = Integer.parseInt(br.readLine());

		for (int i = 0; i < amount; i++) {
			String input = br.readLine();
			count_prod(input);
			System.out.println(count);
		}
	}

	public static void count_prod(String input) {
		int number = Integer.parseInt(input);
		count = 0;
		while (number > 9) {
			count++;
			number = prod(String.valueOf(number));
		}
	}

	public static int prod(String input) {
		int length = input.length();
		int max = 0;
		for (int i = 0; i < length - 1; i++) {
			int left, right;
			left = Integer.parseInt(input.substring(0, i + 1));
			right = Integer.parseInt(input.substring(i + 1));
			if (max < left * right) {
				max = left * right;
			}
		}
		return max;
	}

}



Measured memory_bytes: 27796
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    rr = []

    dd = [(-1,0),(1,0),(0,-1),(0,1),(-1,-1),(-1,1),(1,-1),(1,1)]

    while True:
        s = S()
        if s == '.':
            break
        mc = 0
        kc = 0
        f = True
        st = []
        for c in s:
            if c == '(':
                mc += 1
                st.append(1)
            elif c == ')':
                if mc < 1 or st[-1] == 0:
                    f = False
                    break
                mc -= 1
                st = st[:-1]
            elif c == '[':
                kc += 1
                st.append(0)
            elif c == ']':
                if kc < 1 or st[-1] == 1:
                    f = False
                    break
                kc -= 1
                st = st[:-1]
        if f and mc == 0 and kc == 0:
            rr.append('yes')
        else:
            rr.append('no')

    return '\n'.join(map(str, rr))


print(main())




Measured memory_bytes: 9092
#include <iostream>
#include <cstdlib>

using namespace std;

int main(){
  int a, b, c, d;
  cin >> a >> b >> c >> d;

  int sec = 0;
  if(a < c){
    if(b <= c) {
      sec = 0;
    } else {
      sec = min(b,d) - c;
    }
  } else {
    if (d <= a) {
      sec = 0;
    } else {
      sec = min(b,d) -a;
    }
  }
  cout << sec << endl;

  return 0;
}


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

#define ll long long
#define ull unsigned long long
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(a,b) for(int a=0;a<(b);++a)
#define REP1(i,n) for(int i=1;i<=(n);++i)
#define debug(x) cerr<<#x<<": "<<x<<'\n'
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair
#define INF (1<<29)
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

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

template<class T=int>
T in(){T x;cin>>x;return (x);}
template<class T>
void print(T& x){cout<<x<<'\n';}

const int MOD =(int)1e9+7;
const int MAX =510000;
ll fac[MAX],finv[MAX],inv[MAX];
void COMint(){
    fac[0]=fac[1]=1;
    finv[0]=finv[1]=1;
    inv[1]=1;
    for(int i=2;i<MAX;i++){
        fac[i]=fac[i-1]*i%MOD;
        inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;
        finv[i]=finv[i-1]*inv[i]%MOD;
    }
}
ll COM(int n,int k){
    if(n<k) return 0;
    if(n<0||k<0)return 0;
    return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD;
}
ll gcd(ll a,ll b){
    if(b==0)return a;
    if(a>b){
        swap(a,b);
    }
    return gcd(a,b%a);
}
ll lcm(ll a,ll b){
    ll g;g=gcd(a,b);
    return a*b/g;
}
bool compare_by_b(pair<int, int> a, pair<int, int> b) {
    if(a.second != b.second){
        return a.second < b.second;
    }else{
        return a.first < b.first;
    }
}

bool compare_by_a(pair<int, int> a, pair<int, int> b) {
    if(a.first != b.first){
        return a.first < b.first;
    }else{
        return a.second < b.second;
    }
}

vector<int>vec[8];
bool visited[8];
int dfs(int now,bool){

}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll N=in();
    ll ans;
    ans=(N-1)*N/2;
    print(ans);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(var, begin, end) for (int var = (begin); var <= (end); var++)
#define RFOR(var, begin, end) for (int var = (begin); var >= (end); var--)
#define REP(var, length) FOR(var, 0, length - 1)
#define RREP(var, length) RFOR(var, length - 1, 0)
#define EACH(value, var) for (auto value : var)
#define SORT(var) sort(var.begin(), var.end())
#define REVERSE(var) reverse(var.begin(), var.end())
#define RSORT(var) SORT(var); REVERSE(var)
#define OPTIMIZE_STDIO ios::sync_with_stdio(false);cin.tie(0);cout.precision(10);cout << fixed
#define endl '\n'

const ll MOD = 1e9 + 7;
struct mint {
    ll x;
    mint() : x(0) {}
    mint(ll x) : x((x % MOD + MOD) % MOD) {}
    mint& operator+=(const mint& r) { if ((x += r.x) >= MOD) { x -= MOD; } return *this; }
    mint& operator-=(const mint& r) { if ((x -= r.x) < 0) { x += MOD; } return *this; }
    mint& operator*=(const mint& r) { if ((x *= r.x) > MOD) { x %= MOD; } return *this; }
    mint& operator++() { if ((++x) >= MOD) { x -= MOD; } return *this; }
    mint operator++(int) { mint ret = x; if ((++x) >= MOD) { x-= MOD; } return ret; }
    mint& operator--() { if ((--x) < 0) { x += MOD; } return *this; }
    mint operator--(int) { mint ret = x; if ((--x) < 0) { x += MOD; } return ret; }
    mint operator+(const mint& r) { mint ret; return ret = x + r.x; }
    mint operator-(const mint& r) { mint ret; return ret = x - r.x; }
    mint operator*(const mint& r) { mint ret; return ret = x * r.x; }
    mint operator-() { return mint() - *this; }
    bool operator<(const mint& a) { return x < a.x; }
    bool operator>(const mint& a) { return x > a.x; }
    bool operator<=(const mint& a) { return x <= a.x; }
    bool operator>=(const mint& a) { return x >= a.x; }
    bool operator==(const mint& a) { return x == a.x; }
    bool operator!=(const mint& a) { return x != a.x; }
};
ostream& operator<<(ostream& os, const mint& r) { os << r.x; return os; }
ostream& operator>>(ostream& os, const mint& r) { os >> r.x; return os; }

void solve(istream& cin, ostream& cout) {
  int k, x;
  cin >> k >> x;
  if (500 * k >= x) cout << "Yes" << endl;
  else cout << "No" << endl;
}

#ifndef TEST
int main() {
  OPTIMIZE_STDIO;
  solve(cin, cout);
}
#endif


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
using namespace std;
typedef vector<vector<int>> graph;
typedef vector<int> vi;

vi s;
void dfs(const graph& g, int v, int color) {
  s[v] = color;
  for (int next_v : g[v]) {
    if (s[next_v] < 0)
      dfs(g, next_v, color);
  }
}

int main() {
  int n, k, l;
  cin >> n >> k >> l;
  graph g(n), h(n);
  for (int i = 0; i < k; i++) {
    int a, b;
    cin >> a >> b;
    g[a-1].push_back(b-1);
    g[b-1].push_back(a-1);
  }
  for (int i = 0; i < l; i++) {
    int a, b;
    cin >> a >> b;
    h[a-1].push_back(b-1);
    h[b-1].push_back(a-1);
  }

  s.assign(n, -1);
  for (int i = 0; i < n; i++) {
    if (s[i] < 0)
      dfs(g, i, i);
  }
  vi t(n);
  copy(s.begin(), s.end(), t.begin());
  s.assign(n, -1);
  for (int i = 0; i < n; i++) {
    if (s[i] < 0)
      dfs(h, i, i);
  }

  map<pair<int, int>, int> m;
  for (int i = 0; i < n; i++) {
    m[make_pair(t[i], s[i])]++;
  }
  for (int i = 0; i < n; i++) {
    pair<int, int> p = make_pair(t[i], s[i]);
    cout << m[p] << " ";
  }
  cout << endl;
}

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

int main(void){
  int R;
  cin >> R;
  if(R < 1200)
    cout << "ABC" << "\n";
  else if(R < 2800)
    cout << "ARC" << "\n";
  else
    cout << "AGC" << "\n";
  return 0;
}


Measured memory_bytes: 3552
#include <bits/stdc++.h>
#include <numeric>
#include <iomanip>
using namespace std;
    
#define int long long
#define pb push_back
#define ub upper_bound
#define lb upper_bound
#define mp make_pair
#define F first
#define S second
#define FOR(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define SORT(c) sort((c).begin(),(c).end())
#define ve vector
#define vi vector<int>
#define vp vector<pair<int,int>>
#define vvi vector<vector<int>>
    
using ll = long long;
const ll INF = LLONG_MAX - 100;
ll mod = 1e9 + 7;
int dx[] = {-1,0,1,0}, dy[] = {0,1,0,-1};
vector<ll> prime;
    
class fact {
public:
    int fmod = 1e9+7;
    vector<int> fac, inv;
    fact (int n, int Mod = 1e9+7) {
        fmod = Mod;
        fac = vector<int>(n,0);
        inv = vector<int>(n,0);
        fac[0] = 1; for (int i = 1; i < n; i++) fac[i] = fac[i-1] * i % fmod;
        for (int i = 0;i < n;i++) inv[i] = fact::POW(fac[i],fmod-2);
    }
    ll nCr(ll n, ll r) {return (fac[n] * inv[r] % fmod) * inv[n-r] % fmod;}
    ll POW(ll a, ll b) {ll c = 1; while (b > 0) {if (b & 1) {c = a * c%fmod;}a = a * a%fmod; b >>= 1;}return c;}
};
    
template <class T = ll> T in() {T x; cin >> x; return (x);}
void DEBUG(vector<int> a) {for(int i=0;i<a.size();i++)cout<<a[i]<<" ";cout<<endl;}
void EMP(int x) {cout<<"!!!"<<x<<"!!!"<<endl;}
ll GCD(ll a, ll b) {ll c; while (b != 0) {c = a % b; a = b; b = c;}return a;}
ll LCM(ll a, ll b) {return a * b / GCD(a, b);}
ll POW(ll a, ll b) {ll c = 1; while (b > 0) {if (b & 1) {c = a * c%mod;}a = a * a%mod; b >>= 1;}return c;}
void PRI(ll n) {bool a[n + 1LL]; for (int i = 0; i < n + 1LL; i++) {a[i] = 1LL;}for (int i = 2; i < n + 1LL; i++) {if (a[i]) {prime.pb(i); ll b = i; while (b <= n) {a[b] = 0; b += i;}}}}
template <typename T> T chmin(T& a, T b) {if(a>b)a=b;return a;}
template <typename T> T chmax(T& a, T b) {if(a<b)a=b;return b;}
bool isSqrt(ll a) {return pow(sqrt(a),2) == a ? 1 : 0;}
void YesNo(bool a) {if (a) cout << "Yes"; else cout << "No"; cout << endl;}
void yesno(bool a) {if (a) cout << "yes"; else cout << "no"; cout << endl;}
void YESNO(bool a) {if (a) cout << "YES"; else cout << "NO"; cout << endl;}
int poorpow(int b, int a) {
    int tmp = 1;
    REP (i,a) {
        tmp *= b;
    }
    return tmp;
}


bool solve() {
    int a,b,c; cin >> a >> b >> c;
    if (a <= c && c <= b) cout << "Yes" << endl;
    else cout << "No" << endl;
}

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


Measured memory_bytes: 256
N = int(input())
W = list(map(int, input().split()))
s1 = W[0]
s2 = sum(W[1:])
diff = abs(s1 - s2)

for i in range(1, N):
    s1 += W[i]
    s2 -= W[i]
    diff = min(diff, abs(s1 - s2))

print(diff)


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

#define int ll
#define rep(i,n) for(ll i=0,i##_cond=(n);i<i##_cond;++i)
#define pb push_back
typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
constexpr int inf = 1ll<<61;

struct edge {
  ll to, d;
  edge(ll _to, ll _d):to(_to),d(_d){}
};
class dijkstra{
public:
  ll ans;

  dijkstra(ll s,ll t,vector<vector<edge>> &g,vector<vector<edge>> &f){ // sからtへの最短経路
    vector<vector<vector<edge>>> G(2);
    G[0] = move(g);
    G[1] = move(f);
    vvi dist(2,vi(G[0].size(),inf));
    vector<vector<bool>> visit(2,vector<bool>(G[0].size(),false));
  
    vector<priority_queue<pii,vector<pii>,greater<pii>>> que(2);
    que[0].emplace(dist[0][s]=0,s);
    que[1].emplace(dist[1][t]=0,t);
    ll mu = inf;

    while(!que[0].empty() and !que[1].empty()){
      if(que[0].top().first + que[1].top().first >= mu) break;
      ll k = (que[0].top().first > que[1].top().first)?0:1;
      ll d,v; tie(d,v) = que[k].top();
      que[k].pop();

      if(visit[k^1][v]) goto L;
      visit[k][v] = true;

      rep(i, G[k][v].size()){
	auto n = G[k][v][i];
	ll tmp = d + n.d;
	if(dist[k][n.to] > tmp){
	  mu = min(mu, dist[k][v] + n.d + dist[k^1][n.to]);
	  dist[k][n.to] = tmp;
	  que[k].emplace(tmp,n.to);
	}
      }
    }
  L:
    g = move(G[0]);
    f = move(G[1]);

    ans = inf;
    rep(i,g.size()) ans = min(ans, dist[0][i]+dist[1][i]);
  }
};

main(){
  int k; cin >> k;
  vector<vector<edge>> g(k),f(k);
  rep(i,k){
    g[i].pb(edge((i+1)%k,1));
    g[i].pb(edge((i*10)%k,0));
    
    f[(i+1)%k].pb(edge(i,1));
    f[(i*10)%k].pb(edge(i,0));
  }
  dijkstra d(1,0,g,f);
  cout << d.ans+1 << endl;
}

Measured memory_bytes: 18416
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007

#A
def A():
    x, t = LI()
    print(max(0, x-t))
    return

#B
def B():
    s = S()
    print("".join(s[::2]))
    return

#C
def C():
    II()
    a = LI()
    lis = [0] * (max(a) + 3)
    for ai in a:
        lis[ai - 1] += 1
        lis[ai] += 1
        lis[ai + 1] += 1
    print(max(lis))
    return

#D
def D():
    return

#Solve
if __name__ == '__main__':
    C()


Measured memory_bytes: 52832
#include <bits/stdc++.h>
#define fi first
#define se second
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define space putchar(' ')
#define enter putchar('\n')
#define MAXN 40005
#define eps 1e-12
//#define ivorysi
using namespace std;
typedef long long int64;
typedef unsigned int u32;
typedef double db;
template<class T>
void read(T &res) {
	res = 0;T f = 1;char c = getchar();
	while(c < '0' || c > '9') {
		if(c == '-') f = -1;
		c = getchar();
	}
	while(c >= '0' && c <= '9') {
		res = res * 10 + c - '0';
		c = getchar();
	}
	res *= f;
}
template<class T>
void out(T x) {
	if(x < 0) {x = -x;putchar('-');}
	if(x >= 10) {
		out(x / 10);
	}
	putchar('0' + x % 10);
}
int N,M,K;
int main() {
#ifdef ivorysi
	freopen("f1.in","r",stdin);
#endif
	read(N);read(M);read(K);
	for(int i = 0 ; i <= N ; ++i) {
		for(int j = 0 ; j <= M ; ++j) {
			int res = i * (M - j) + (N - i) * j;
			if(res == K) {puts("Yes");return 0;}
		}
	}
	puts("No");
	return 0;
}


Measured memory_bytes: 256