akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <cctype>
#include <algorithm>
//#define gc() getchar()
#define MAXIN 200000
#define gc() (SS==TT&&(TT=(SS=IN)+fread(IN,1,MAXIN,stdin),SS==TT)?EOF:*SS++)
const int N=2005;

int sp[N][N],sr[N][N]/*crosswise*/,sc[N][N]/*lengthways*/;
bool mp[N][N];
char IN[MAXIN],*SS=IN,*TT=IN;

inline int read()
{
	int now=0;register char c=gc();
	for(;!isdigit(c);c=gc());
	for(;isdigit(c);now=now*10+c-'0',c=gc());
	return now;
}

int main()
{
	int n=read(),m=read(),Q=read();
	for(int i=1; i<=n; ++i)
	{
		register char c=gc(); for(;!isdigit(c);c=gc());
		mp[i][1]=c-'0';
		for(int j=2; j<=m; mp[i][j++]=gc()-'0');
	}
	for(int i=1; i<=n; ++i)
		for(int j=1; j<=m; ++j)
		{
			if(mp[i][j])
				sp[i][j]=sp[i-1][j]+sp[i][j-1]-sp[i-1][j-1]+1,
				sc[i][j]=sc[i-1][j]+sc[i][j-1]-sc[i-1][j-1]+mp[i-1][j],
				sr[i][j]=sr[i-1][j]+sr[i][j-1]-sr[i-1][j-1]+mp[i][j-1];
			else
				sp[i][j]=sp[i-1][j]+sp[i][j-1]-sp[i-1][j-1],
				sc[i][j]=sc[i-1][j]+sc[i][j-1]-sc[i-1][j-1],
				sr[i][j]=sr[i-1][j]+sr[i][j-1]-sr[i-1][j-1];
		}
	for(int x,y,x2,y2; Q--; )
	{
		x=read(),y=read(),x2=read(),y2=read();
		int p=sp[x2][y2]-sp[x-1][y2]-sp[x2][y-1]+sp[x-1][y-1],
			e=sr[x2][y2]-sr[x-1][y2]-sr[x2][y]+sr[x-1][y]+sc[x2][y2]-sc[x][y2]-sc[x2][y-1]+sc[x][y-1];
		printf("%d\n",p-e);
	}
	return 0;
}

Measured memory_bytes: 52864
import math

N, K = map(int, input().split())
N_ = 1 / N
ans = 0
coin_continue = 0
for j in range(1, N+1):
    tmp = math.ceil(math.log2(K / j))
    if tmp > 0:
        coin_continue = tmp
    else:
        coin_continue = 0
    # print(coin_continue)
    ans += (1 / 2) ** coin_continue
print(ans * N_)

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

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
typedef long long ll;
using namespace std;

int main() {
    int n, a, b;
    cin >> n;
    vector<int> p(n), q(n), v(n);

    rep(i, n) cin >> p[i];
    rep(i, n) cin >> q[i];
    iota(v.begin(), v.end(), 1);

    int cnt = 0;
    do {
        if (p == v) a = cnt;
        if (q == v) b = cnt;
        cnt++;
    } while (next_permutation(v.begin(), v.end()));

    cout << abs(a - b) << endl;

    return 0;
}

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

void call(int n){
	int i=1, x;
	do{
		x = i;
		if(x % 3 == 0){
			cout << " " << i;
		}else{
			do{
				if(x % 10 == 3){
					cout << " "<< i;
					break;
				}
				x /= 10;
			}while(x);
		}
	}while(++i <= n);
	cout << endl;
}

int main()
{
	int n;
	cin >> n;
	call(n);
	return 0;
}

Measured memory_bytes: 3088
#include <bits/stdc++.h>
 
using namespace std;
 
int main()
{
  int score;
  cin >> score;
  
  if (score < 1200){
    cout << "ABC" << endl;
  }else if (score < 2800){
    cout << "ARC" << endl;
  }else{
    cout << "AGC" << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <string.h>
using namespace std;
int n, m;
char c[55][55];
int check(int i, int j) {
    if (j - 1 >= 1 && c[i][j - 1] == '#') return 1;
    if (j + 1 <= m && c[i][j + 1] == '#') return 1;
    if (i - 1 >= 1 && c[i - 1][j] == '#') return 1;
    if (i + 1 <= n && c[i + 1][j] == '#') return 1;
    return 0;
}
int main() {
    //freopen("input.txt", "r", stdin);
    cin >> n >> m;
    for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) cin >> c[i][j];
    int cnt = 0;
    for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++)
    if (c[i][j] == '#' && check(i, j) == 0) cnt++;
    if (cnt == 0) cout << "Yes"; else cout << "No";
    return 0;
}

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

int K, L;
string str;
vector<string> A;

int main()
{
	
	cin >> str;
	cin >> K;
	L = str.length();
	for (int i = 1; i <= K; ++i) {
		for (int l = 0; l + i <= L; ++l) {
			A.push_back(str.substr(l, i));
		}
	}
	sort(A.begin(), A.end());
	//	for (auto i : A) cout << i << endl;
	auto iter = unique(A.begin(), A.end());
	cout << A[K - 1] << endl;
	return 0;
}


Measured memory_bytes: 1660
using System;
using System.Collections.Generic;
using System.Linq;
using static Input;

public class Prog
{
    public struct Pair { public int x, y; public Pair(int x, int y) { this.x = x; this.y = y; } }
    public static void Solve()
    {
        int N = NextInt();
        int ans = 0;
        for (int i = 1; i <= N; i++) {
            if (i.ToString().Length % 2 == 1) ans++;
        }
        Console.WriteLine(ans);
    }
    public static void Main()
    {
        var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
        Console.SetOut(sw);
        Solve();
        Console.Out.Flush();
    }

    public static long RepPow(long x, long p, long m = 1000000007)
    {
        if (p == 0) return 1;
        if (p == 1) return x % m;
        long b = RepPow(x, p / 2, m) % m;
        if (p % 2 == 0) { return (b * b) % m; }
        else { return (x * ((b * b) % m)) % m; }
    }
}
public class MinTree
{
    private List<int> table = new List<int>();
    private static int size = 1;
    private static int high = 1;
    public MinTree(int n, int k = 0)
    {
        while (size < n) size *= 2;
        high = (int)Math.Log(size, 2);
        for (int i = 0; i < 2 * size - 1; i++) table.Add(k);
    }
    public void Add(int x, int v)
    {
        x += size - 1;
        table[x] += v;
        table[x] = Math.Max(0, table[x]);
        while (x != 0)
        {
            x = (x % 2 == 0 ? x / 2 - 1 : x / 2);
            table[x] = table[x * 2 + 1] + table[x * 2 + 2];
        }
    }
    public int MLS(int k)
    {
        if (table.First() == 0) return -1;
        int index = 0;
        for (int y = 0; y < high; y++)
        {
            int left = index * 2 + 1;
            int right = index * 2 + 2;
            if (table[left] >= k) index = left;
            else { k -= table[left]; index = right; }
        }
        return index - size + 1;
    }
}
public class Input
{
    public const long MOD = 1000000007;
    public const int INF = 1000000007;
    private static Queue<string> q = new Queue<string>();
    private static void Confirm() { if (q.Count == 0) foreach (var s in Console.ReadLine().Split(' ')) q.Enqueue(s); }
    public static int NextInt() { Confirm(); return int.Parse(q.Dequeue()); }
    public static long NextLong() { Confirm(); return long.Parse(q.Dequeue()); }
    public static string NextString() { Confirm(); return q.Dequeue(); }
    public static double NextDouble() { Confirm(); return double.Parse(q.Dequeue()); }
    public static int[] LineInt() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); }
    public static long[] LineLong() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
    public static string[] LineString() { return Console.ReadLine().Split(' ').ToArray(); }
    public static double[] LineDouble() { return Console.ReadLine().Split(' ').Select(double.Parse).ToArray(); }
    public long Abs(long a, long b) => Math.Abs(a - b);
}


Measured memory_bytes: 13268
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx")

#include <iostream>
#include <sstream>
#include <vector>
#include <iterator>
#include <map>
#include <list>
#include <set>
#include <stack>
#include <queue>
#include <utility>
#include <algorithm>
#include <numeric>
#include <string>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <stdio.h>
#include <math.h>
#include <stdlib.h>

#define    ll          long long
#define    mp          make_pair
#define    pb          push_back
#define    vi          vector <int>
#define    vs          vector <string>
#define    maxx(a,b,c) max(a,max(b,c))
#define    minn(a,b,c) min(a,min(b,c))
#define    SORT(x)     sort(x.begin(),x.end())

using namespace std;

int main(){
    int a=1,b=2,c=3;
    int x,y;
    cin >> x >> y;
    if((x==1 && y==2) || (y==1 && x==2)) cout << "3" << endl;
    else if((x==1 && y==3) || (x==3 && y==1)) cout << "2" << endl;
    else if((x==2 && y==3) || (x==3 && y==2)) cout << "1" << endl;
    return 0;
}

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

int main() {
    int minPrice = 0, maxProfit = INT_MIN;
    int n;
    cin >> n;
    for (int t = 0; t < n; t++) {
        int price;
        cin >> price;
        if (t == 0) {
            minPrice = price;
        } else {
            maxProfit = max(maxProfit, (price - minPrice));
            minPrice = min(minPrice, price);
        }
    }
    cout << maxProfit << endl;
    return 0;
}



Measured memory_bytes: 3116
import java.util.*;

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

        S = S.replaceAll("eraser",  "-");
        S = S.replaceAll("erase",   "-");
        S = S.replaceAll("dreamer", "-");
        S = S.replaceAll("dream",   "-");
        S = S.replaceAll("-", "");
        if (S.length() == 0)
            System.out.println("YES");
        else
            System.out.println("NO");
    }
}

Measured memory_bytes: 28800
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,sqrt
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7
#s=input().rstrip()

a,b=MI()
u=int(str(a)+str(b))
if int(sqrt(u))==sqrt(u):
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3316
#include <bits/stdc++.h>
using namespace std;
int main() {
  int H, W;
  cin >> H >> W;
  vector<string> field(H);
  for(int i=0;i<H;i++) {
    cin >> field[i];
  }

  vector<vector<int> > bomb(H+2, vector<int>(W+2));

  for(int i=0;i<H;i++) {
    for(int j=0;j<W;j++) {
      if(field[i][j] == '#') {
        bomb[i][j]++;
        bomb[i][j+1]++;
        bomb[i][j+2]++;
        bomb[i+1][j]++;
        bomb[i+1][j+2]++;
        bomb[i+2][j]++;
        bomb[i+2][j+1]++;
        bomb[i+2][j+2]++;
      }
    }
  }

  for(int i=0;i<H;i++) {
    for(int j=0;j<W;j++) {
      if(field[i][j] == '.') {
        cout << bomb[i+1][j+1];
      } else {
        cout << '#';
      }
    }
    cout << endl;
  }
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using static System.Console;
using Pair = System.Collections.Generic.KeyValuePair<int, int>;
//using System.Numerics;
//using static System.Math;
 
class Program
{
    static void Main()
    {
        //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
        new Program().solve();
        Out.Flush();
    }
    Scanner cin = new Scanner();
    readonly int[] dd = { 0, 1, 0, -1, 0 };
    readonly int mod = 1000000007;
    readonly string alfa = "abcdefghijklmnopqrstuvwxyz";
    readonly string ALFA = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
 
    int N, M;
    void solve()
    {
        N = cin.nextint;
        var D = cin.scanint;
        Array.Sort(D);
        M = cin.nextint;
        var T = cin.scanint;
        Array.Sort(T);
 
        int now = 0;
        for (int i = 0; i < M; i++)
        {
            while (true)
            {
                if (now == N || D[now] > T[i])
                {
                    WriteLine("NO");
                    return;
                }
                if (D[now] == T[i])
                {
                    now++;
                    break;
                }
                else
                {
                    now++;
                }
            }
        }
        WriteLine("YES");
    }
 
}
 
class Scanner
{
    string[] s; int i;
    char[] cs = new char[] { ' ' };
    public Scanner() { s = new string[0]; i = 0; }
    public string[] scan { get { return ReadLine().Split(); } }
    public int[] scanint { get { return Array.ConvertAll(scan, int.Parse); } }
    public long[] scanlong { get { return Array.ConvertAll(scan, long.Parse); } }
    public double[] scandouble { get { return Array.ConvertAll(scan, double.Parse); } }
    public string next
    {
        get
        {
            if (i < s.Length) return s[i++];
            string st = ReadLine();
            while (st == "") st = ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            i = 0;
            return next;
        }
    }
    public int nextint { get { return int.Parse(next); } }
    public long nextlong { get { return long.Parse(next); } }
    public double nextdouble { get { return double.Parse(next); } }
}

Measured memory_bytes: 34876
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const ll N=2e5+1e3;

ll read()
{
	ll s=0;
	char c=getchar(),lc='+';
	while (c<'0'||'9'<c) lc=c,c=getchar();
	while ('0'<=c&&c<='9') s=s*10+c-'0',c=getchar();
	return lc=='-'?-s:s;
}
void write(ll x)
{
	if (x<0)
	{
		putchar('-');
		x=-x;
	}
	if (x<10) putchar(x+'0');
	else
	{
		write(x/10);
		putchar(x%10+'0');
	}
}
void print(ll x,char c='\n')
{
	write(x);
	putchar(c);
}
struct monsters
{
	ll p,h;
	bool operator <(const monsters &a)const
	{
		return p<a.p;
	}
}m[N];
ll p[N],a[N],Dec=0,ans=0;

int main()
{
	memset(a,0,sizeof(a));
	ll n=read(),l=2*read(),d=read();
	for (ll i=1;i<=n;i++)
	{
		m[i].p=read();
		m[i].h=read();
	}
	sort(m+1,m+1+n);
	for (ll i=1;i<=n;i++) p[i]=m[i].p;
	for (ll i=1;i<=n;i++)
	{
		Dec+=a[i];
		ll c=max(m[i].h-Dec,0ll)/d+(max(m[i].h-Dec,0ll)%d?1:0);
		ans+=c;
		Dec+=c*d;
		ll r=upper_bound(p+1,p+1+n,p[i]+l)-p;
		a[r]-=c*d;
	}
	print(ans);

	return 0;
}

Measured memory_bytes: 6528
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <iostream>

using namespace std;

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


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

#include <iostream>
#include <fstream>

#include <iostream>
#include "bits/stdc++.h"

using namespace std;
typedef unsigned long long ll;
typedef int                     integer;
#define int                     long long
#define ii                      pair<int,int>
#define vii                     vector<pair<int,int>>
#define vi                      vector<int>
#define vvi                     vector<vector<int>>
#define f(a,b,c)                for(int a=b;a<c;a++)
#define s(x)                    in>>x
#define s2(x,y)                 in>>x>>y
#define s3(x,y,z)               in>>x>>y>>z
#define s4(x,y,z,w)             in>>x>>y>>z>>w
#define p(x)                    out<<x<<endl
#define p2(x,y)                 out<<x<<' '<<y<<endl
#define p3(x,y,z)               out<<x<<' '<<y<<' '<<z<<endl
#define p4(x,y,z,w)             out<<x<<' '<<y<<' '<<z<<' '<<w<<endl
#define pl(x)                   out<<x
#define pll(x)                  out<<x<<' '
#define range(v)                v.begin(),v.end()
#define rst(x)                  memset(x, -1, sizeof(x))
#define UNVISITED               -1
#define VISITED                 0
#define EXPLORED                2

#define EACH(x, a) for (auto& x: a)
template<class T> void read_v(T& x, std::istream& in) {
    in >> (x);
}
template<class A> void read_vec(vector<A>& x, std::istream& in) {
    EACH(a, x)
        read_v(a, in);
}

bool sortpairbysec(const pair<int,int> &a,const pair<int,int> &b){return (a.second < b.second);}
template <typename T>
T factmod(T a, T modulus){ int res = 1, i; for (i = 2; i <= a; i++){ res *= i; res%=modulus;} return res; }
template <typename T>
int powmod(T a,T b,int m){ int ans=1; while(b>0){if(b&1){ans*=a;ans%=m;}a*=a;a%=m;b>>=1;} return ans; }
template <typename T>
int power(T a, T b){ int ans=1; while(b>0){if(b&1){ans*=a;}a*=a;b>>=1;}return ans;}


void ssolve(std::istream& in, std::ostream& out){
    int n; s(n);
    vi a(n);
    read_vec(a, in);
    int max_until_now = a[0];
    int ans = 0;
    f(i, 1, n){
        if (a[i]<max_until_now){
            ans += (max_until_now - a[i]);
        }else{
            max_until_now = a[i];
        }
    }
    p(ans);
    return;
}

class CStep {
public:
void solve(std::istream& in, std::ostream& out) {
    ios_base::sync_with_stdio(false);
    in.tie(nullptr);out.tie(nullptr);
    int t;
    int READ = 0;
    if(READ) s(t);
    else t = 1;
    while(t--){
        ssolve(in, out);
    }
}
};

integer main() {
    CStep solver;
    std::istream& in(std::cin);
     std::ostream& out(std::cout);
     solver.solve(in, out);
}

Measured memory_bytes: 4780
#include<bits/stdc++.h>
#include<boost/multiprecision/cpp_int.hpp>
using namespace std;
using namespace boost::multiprecision;
#define BEGIN ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define END return EXIT_SUCCESS
#define rep(I,N) for(auto I=0;I<(N);++I)
#define up(I,A,B) for(auto I=(A);I<=(B);++I)
#define dw(I,A,B) for(auto I=(A);I>=(B);--I)
#define all(C) (C).begin(),(C).end()
#define rall(C) (C).rbegin(),(C).rend()
#define ft first
#define sd second
#define mp make_pair
#define mt make_tuple
#define pf push_front
#define pb push_back
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define rs resize
typedef long long ll;
typedef unsigned long long ull;
template<class T>inline void                                      in(T &p){cin>>p;}
template<class T1,class T2>inline void                            in(T1 &p1,T2 &p2){cin>>p1>>p2;}
template<class T1,class T2,class T3>inline void                   in(T1 &p1,T2 &p2,T3 &p3){cin>>p1>>p2>>p3;}
template<class T1,class T2,class T3,class T4>inline void          in(T1 &p1,T2 &p2,T3 &p3,T4 &p4){cin>>p1>>p2>>p3>>p4;}
template<class T1,class T2,class T3,class T4,class T5>inline void in(T1 &p1,T2 &p2,T3 &p3,T4 &p4,T5 &p5){cin>>p1>>p2>>p3>>p4>>p5;}
template<class T>inline void                                      ins(T &p){for_each(all(p),in<decltype(p[0])>);}
template<class T>inline void                             out(T p){cout<<p<<endl;}
template<class T1,class T2>inline void                   out(T1 p1,T2 p2){cout<<p1<<" "<<p2<<endl;}
template<class T1,class T2,class T3>inline void          out(T1 p1,T2 p2,T3 p3){cout<<p1<<" "<<p2<<" "<<p3<<endl;}
template<class T1,class T2,class T3,class T4>inline void out(T1 p1,T2 p2,T3 p3,T4 p4){cout<<p1<<" "<<p2<<" "<<p3<<" "<<p4<<endl;}
inline                                              void out(double p){printf("%.10f\n",p);}
template<class T>inline                             void outs(T p){for_each(all(p),out<decltype(p[0])>);}

inline void solve(void){
  int A[3];
  in(A[0],A[1],A[2]);
  out((A[0]+A[1]+A[2]>=22)?"bust":"win");
}
int main(int argc,char**argv){
  BEGIN;
  solve();
  END;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define rep2(i,x,n) for(int i=x; i<(n); i++)
int main() {
    int a,b,c,x,ans=0;
    cin >> a >> b >> c >> x;
    rep(i,a+1){
        rep(j,b+1){
            rep(k,c+1){
                if(500*i + 100*j + 50*k == x) ans++;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;long long i,a,N,s,A=INT_MAX,l,r,S[100002];int main(){cin.tie(0);ios::sync_with_stdio(false);cin>>N>>s;for(;i<N;i++){cin>>a;S[i+1]+=S[i]+a;}for(;;){if(S[r]-S[l]>=s){A=min(A,r-l);l++;}else r++;if(r>N){if(A==INT_MAX)A=0;cout<<A<<endl;return 0;}}}

Measured memory_bytes: 3948
import std.stdio;
import std.string;
import std.conv;
import std.typecons;
import std.algorithm;
import std.functional;
import std.bigint;
import std.numeric;
import std.array;
import std.math;
import std.range;
import std.container;
import std.ascii;
import std.format;

void main()
{
	auto abbcca = readln.split.to!(int[]), ab = abbcca[0], bc = abbcca[1], ca = abbcca[2];
	writeln(ab * bc / 2);
}

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

#define ll long long
#define ull unsigned long long

using namespace std;

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

	vector <ll> H(N, 0);
	for (int ii = 0; ii < N; ++ii){
		cin >> H[ii];
	}

	H[0]--;
	for (int ii = 1; ii < N-1; ++ii){
		if (H[ii-1] < H[ii]){
			H[ii]--;
		}
	}

	bool ans = true;
	for (int ii = 0; ii < N-1; ++ii){
		if (H[ii] > H[ii+1]){
			ans = false;
		}
	}

	if (ans){
	cout << "Yes" << "\n";
	} else {
	cout << "No" << "\n";		
	}


	return 0;
}


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

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

using namespace std;

void PV(vector<int> pvv) {
	rep(i, pvv.size()) cout << pvv[i] SP;
	cout << endl;
}

int main(){

	int n, m, a, b, ans=0;
	vector<int> v, h;

	cin>> n >> m;
	v.resize(n, 1);
	h.resize(n);

	rep(i, n) cin >> h[i];

	rep(i, m) {
		cin >> a >> b;
		if (h[a - 1] <= h[b - 1]) v[a - 1] = 0;
		if (h[b - 1] <= h[a - 1]) v[b - 1] = 0;
	}

	rep(i, n) {
		if (v[i]) ans++;
	}

	cout<< ans << endl;

	return 0;
}


Measured memory_bytes: 4052
#include <stdio.h>
int main(){
    int n;
    scanf("%d",&n);
    int count=0;
    for(int a=1;a<=n;a++){
        int count2;
        int b;
        count2=0;
        b=1;
        while(a/b>=1){count2++;b*=10;}
        if(count2%2==1){count++;}
        else{}
    }
    printf("%d\n",count);
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using i64 = long long;
using std::cout;
using std::endl;
using std::cin;

int main() {
	std::string a, b, c; cin >> a >> b >> c;
	
	printf("%c%c%c\n", a[0], b[1], c[2]);
	return 0;
}


Measured memory_bytes: 256
def end_of_words?(cur)
  @lines[cur[0]].size == cur[1]
end

def last_line?(cur)
  cur[0] == @lines.size - 1
end

buf = ''
cur = [0, 0]
@lines = []
while l = gets.chomp
  break if l == 'END_OF_TEXT'
  @lines << l
end

while cmd = gets.chomp
  break if cmd == '-'
  case cmd
  when 'a'
    cur[1] = 0
  when 'e'
    cur[1] = @lines[cur[0]].size
  when 'p'
    cur[0] == 0 ? cur[1] = 0 : cur = [cur[0] - 1, 0]
  when 'n'
    last_line?(cur) ? cur[1] = 0 : cur = [cur[0] + 1, 0]
  when 'f'
    unless end_of_words?(cur)
      cur[1] += 1
    else
      unless last_line?(cur)
        cur = [cur[0] + 1, 0]
      end
    end
  when 'b'
    if cur[1] != 0
      cur[1] -= 1
    else
      if cur[0] != 0
        cur = [cur[0] - 1, @lines[cur[0] - 1].size]
      end
    end
  when 'd'
    unless end_of_words?(cur)
      @lines[cur[0]].slice!(cur[1])
    else
      unless last_line?(cur)
        l = @lines.delete_at(cur[0] + 1)
        @lines[cur[0]] += l
      end
    end
  when 'k'
    unless end_of_words?(cur)
      buf = @lines[cur[0]].slice!(cur[1]..-1)
    else
      unless last_line?(cur)
        l = @lines.delete_at(cur[0] + 1)
        @lines[cur[0]] += l
        buf = '\\n'
      end
    end
  when 'y'
    if buf == '\\n'
      @lines.insert(cur[0] + 1, @lines[cur[0]].slice!(cur[1]..-1))
      cur = [cur[0] + 1, 0]
    elsif buf != ''
      @lines[cur[0]].insert(cur[1], buf)
      cur[1] += buf.size
    end
  end
end

puts @lines

Measured memory_bytes: 8624
#include <bits/stdc++.h>
using i64 = long long;

int main() {
    std::string s;
    std::cin >> s;

    std::string t = "keyence";
    int i = 0;
    int n = s.size();
    while (i < 7 && s[i] == t[i]) i++;
    while (i < 7 && t[i] == s[n - (7 - i)]) i++;
    std::cout << (i == 7 ? "YES" : "NO") << std::endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define hackcyborg shresth_walia
#define ll long long
#define ld double
#define pb push_back
#define mod 1000000007
#define IO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<int,null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define int long long
ll binpow(ll a,ll b,ll m=mod)
{
    ll res=1;
    while(b>0)
    {
        if(b&1)
        res=(a*res)%m;
        a=(a*a)%m;
        b/=2;
    }
    return res;
}
main()
{
    IO
    string s;
    cin>>s;
    ll g=1;
    ll ans=0;
    for(int x=0;x<3;x++)
    {
        if(s[x]==s[x-1])++g;
        else
        {
            if(s[x-1]=='R')ans=max(ans,g);
            g=1;
        }
    }
    if(s[2]=='R')ans=max(ans,g);
    cout<<ans;
}


Measured memory_bytes: 3556
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll LINF = 1e18;
const int INF = 1e9;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main(){
    string S;
    cin>>S;
    vector<int> X;
    vector<int> Y;
    int gx,gy;
    cin>>gx>>gy;
    int firstlen=0;
    int len=0;
    bool even=true;
    bool flag=false;
    rep(i,S.length()){
        if(!flag){
            if(S[i]=='F')firstlen++;
            if(S[i]=='T'){
                flag=true;
                even=false;
            }
        }
        else if(flag){
            if(S[i]=='F')len++;
            if(S[i]=='T'||i==S.length()-1){
                if(even==true){
                    X.push_back(len);
                    len=0;
                    even=false;
                }
                else if(even==false){
                    Y.push_back(len);
                    len=0;
                    even=true;
                }
            }
        }
    }
    bool *dpx,*dpy,*dpx2,*dpy2;
    bool dummyx[17001],dummyy[17001],dummyx2[17001],dummyy2[17001];
    rep(i,16001){
        dummyx[i]=false;
        dummyy[i]=false;
        dummyx2[i]=false;
        dummyy2[i]=false;
    }
    dpx=dummyx+8500;
    dpy=dummyy+8500;
    dpx2=dummyx2+8500;
    dpy2=dummyy2+8500;
    dpx[firstlen]=true;
    dpy[0]=true;
    rep(i,X.size()){
        for(int j=-8500; j<8501; j++){
            if(j-X[i]<(-8500)&&j+X[i]>8500)dpx2[j]=false;
            else if(j-X[i]<(-8500)){
                if(dpx[j+X[i]]==false)dpx2[j]=false;
                else dpx2[j]=true;
            }
            else if(j+X[i]>8500){
                if(dpy[j-X[i]]==false)dpx2[j]=false;
                else dpx2[j]=true;
            }
            else if(dpx[j-X[i]]==true||dpx[j+X[i]]==true)dpx2[j]=true;
        }        
        for(int j=-8500; j<8501; j++){
            dpx[j]=dpx2[j];
            dpx2[j]=false;
        }
    }
    rep(i,Y.size()){
        for(int j=-8500; j<8501; j++){
            if(j-Y[i]<(-8500)&&j+Y[i]>8500)dpy2[j]=false;
            else if(j-Y[i]<(-8500)){
                if(dpy[j+Y[i]]==false)dpy2[j]=false;
                else dpy2[j]=true;
            }
            else if(j+Y[i]>8500){
                if(dpy[j-Y[i]]==false)dpy2[j]=false;
                else dpy2[j]=true;
            }
            else if(dpy[j-Y[i]]==true||dpy[j+Y[i]]==true)dpy2[j]=true;
        }        
        for(int j=-8500; j<8501; j++){
            dpy[j]=dpy2[j];
            dpy2[j]=false;
        }
    }
    if(dpx[gx]&&dpy[gy])cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}

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

using namespace std;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n - 1; ++i) {
        int f;
        cin >> f;
        f--;
        a[f]++;
    }
    for (int i = 0; i < n; ++i) {
        cout << a[i] << "\n";
    }
    return 0;
}



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

typedef long long ll;

const int MAX_N = 200010;
int par[MAX_N];
int rnk[MAX_N];
int siz[MAX_N];

void init(int n) {
    rep(i,n) {
        par[i] = i;
        rnk[i] = 0;
        siz[i] = 1;
    }
}

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

void unite(int x, int y) {
    x = find(x);
    y = find(y);
    if (x == y) return;
    int s = siz[x] + siz[y];
    if (rnk[x] < rnk[y]) {
        par[x] = y;
    } else {
        par[y] = x;
        if (rnk[x] == rnk[y]) rnk[x]++;
    }
    siz[find(x)] = s;
}

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

int size(int x) {
    return siz[find(x)];
}

int main() {
    int N, M, A, B;
    cin >> N >> M;
    init(N);
    rep(i, M) {
        cin >> A >> B;
        unite(A - 1, B - 1);
    }
    int ans = 0;
    rep(i, N) {
        ans = max(ans, size(i));
    }
    cout << ans << "\n";
}

Measured memory_bytes: 5948
#include <stdio.h>
int main()
{
	int a,b,c;
	scanf("%d %d %d",&a,&b,&c);
	if((a==b&&a!=c)||(a==c&&a!=b)||(b==c)&&a!=b)
	printf("Yes\n");
	else
	printf("No\n");
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; (i) < (int)(n); ++ (i))
#define REP3(i, m, n) for (int i = (m); (i) < (int)(n); ++ (i))
#define REP_R(i, n) for (int i = (int)(n) - 1; (i) >= 0; -- (i))
#define REP3R(i, m, n) for (int i = (int)(n) - 1; (i) >= (int)(m); -- (i))
#define ALL(x) begin(x), end(x)
using ll = long long;
using namespace std;

ll solve(int n, const vector<int> & p) {
    vector<int> order(n);
    iota(ALL(order), 0);
    sort(ALL(order), [&](int i, int j) { return p[i] > p[j]; });
    set<int> used;
    used.insert(-1);
    used.insert(n);
    ll ans = 0;
    for (int m : order) {
        used.insert(m);
        auto it = used.find(m);
        if (prev(it) != used.begin()) {
            ans += (ll)p[m] * (*prev(it) - *prev(prev(it))) * (*next(it) - m);
        }
        if (next(next(it)) != used.end()) {
            ans += (ll)p[m] * (*next(next(it)) - *next(it)) * (m - *prev(it));
        }
    }
    return ans;
}

int main() {
    int n; cin >> n;
    vector<int> p(n);
    REP (i, n) {
        cin >> p[i];
    }
    cout << solve(n, p) << endl;
    return 0;
}


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

int main() {

    int N;
    cin >> N;

    vector<int> A(N);
    A[0] = -1;
    for (int i = 1; i < N; i++) {
        cin >> A[i];
        A[i]--;
    }

    vector<int> numberOfBuka(N);
    fill(numberOfBuka.begin(), numberOfBuka.end(), 0);
    for (int i = N-1; i > 0; i--) {
        numberOfBuka[A[i]]++;
    }
    for (int i = 0; i < N; i++) {
        cout << numberOfBuka[i] << endl;
    }

    return 0;
}

Measured memory_bytes: 4768
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char const *argv[])
{
    unsigned long N;
    scanf("%lu", &N);

    char *c;
    c = malloc(sizeof(char) * (N + 1));

    unsigned cr = 0, cw = 0;
    scanf("%s", c);

    for (size_t i = 0; i < N; i++)
    {
        if (c[i] == 'R')
        {
            cr++;
        }
        else
        {
            cw++;
        }
    }

    unsigned count = 0;
    for (size_t i = 0; i < cr; i++)
    {
        if (c[i] == 'W')
        {
            count++;
        }
    }

    printf("%u\n", count);

    return 0;
}


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

ll a[90];

ll dfs(ll n) {
    if (a[n] != 0)
        return a[n];
    else
        a[n] = dfs(n - 1) + dfs(n - 2);

    return a[n];
}

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

    a[0] = 2;
    a[1] = 1;
    cout << dfs(n) << endl;
    return 0;
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
const int mod=1e9+7;
#define ll long long int

void add_self(ll& a,ll b){
   a+=b;
   if(a>=mod) a-=mod;
}

int main()
{
    int n;
    string s;
    cin>>n;cin>>s;
    //dp[i][j] represents the number of ways to arrange the number upto length i and last number is j
    vector<vector<ll>> dp(n+1,vector<ll>(n+1));
    dp[1][1]=1;
     for(int len=2;len<=n;len++){
            //calculation of prefix sum upto length len
            vector<ll> prefix_sum(n+1);
            for(int i=1;i<=len;i++){
                add_self(prefix_sum[i],(prefix_sum[i-1]+dp[len-1][i])%mod);
            }

        for(int b=1;b<=len;b++){
            int L,R;
            if(s[len-2]=='<'){
                L=1;R=b-1;
            }
            else{
                L=b;R=len-1;
            }
            if(L<=R)
            add_self(dp[len][b],(prefix_sum[R]-prefix_sum[L-1]+mod)%mod);
        }

     }
     ll answer=0;
     for(int i=1;i<=n;i++){
        add_self(answer,dp[n][i]);
     }
     cout<<answer;
}


Measured memory_bytes: 73656
import sys

while True:
    n = int(input())
    if n == 0:
        break;
    x = {}
    for i in range(n):
        k,v = input().split()
        x[k] = v
    y = []
    for i in range(int(input())):
        a = input()[0]
        if a in x:
            y.append(x[a])
        else:
            y.append(a)
    print(''.join(y))

Measured memory_bytes: 8680
# Author: cr4zjh0bp
# Created: Tue Mar 10 14:05:56 UTC 2020
import sys
 
stdin = sys.stdin
inf = 1 << 60
mod = 1000000007
 
ni = lambda: int(ns())
nin = lambda y: [ni() for _ in range(y)]
na = lambda: list(map(int, stdin.readline().split()))
nan = lambda y: [na() for _ in range(y)]
nf = lambda: float(ns())
nfn = lambda y: [nf() for _ in range(y)]
nfa = lambda: list(map(float, stdin.readline().split()))
nfan = lambda y: [nfa() for _ in range(y)]
ns = lambda: stdin.readline().rstrip()
nsn = lambda y: [ns() for _ in range(y)]
ncl = lambda y: [list(ns()) for _ in range(y)]
nas = lambda: stdin.readline().split()

S = ns()
ans = 0
for i in range(len(S)):
    if S[i] == '+':
        ans += 1
    elif S[i] == '-':
        ans -= 1

print(ans)

Measured memory_bytes: 3064
import java.util.*;

public class Main {

	public static long solve(final int n, final int k, int s, int g) {
		long ans = 0;
		if(s <= 0 && g >= n - 1)return 0;
		if(s == g) {
			ans = 1 + solve(n, k, s, g + k - 1);
			for(int i = 1; i < k; ++i) {
				long tmp = 1 + solve(n, k, s - i, g + k - i - 1);
				ans = Math.min(tmp,  ans);
			}
			return ans;
		}
		
		s += k - 2;
		g = n - 1 - g + k - 2;
		if(s < 0)s = 0;
		if(g < 0)g = 0;
		ans += (long)s / (long)(k - 1);
		ans += (long)g / (long)(k - 1);
		
		return ans;
	}
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt(), k = sc.nextInt();
		int a[] = new int[n];
		int p = 0;
		for(int i = 0; i < n; ++i) {
			a[i] = sc.nextInt();
			if(a[i] == 1)p = i;
		}
		sc.close();
		long ans = solve(n, k, p, p);
		System.out.println(ans);
	}

}


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

using namespace std;

int d4x[] = {0, 1, 0, -1};
int d4y[] = {-1, 0, 1, 0};

int W, H;
int reachable(vector<string>& map, int x, int y){
  //cout << x << "," << y << endl;
  map[y][x] = '#';
  int res = 0;
  rep(i, 4){
    int sx = d4x[i] + x, sy = d4y[i] + y;
    if(0 <= sx && sx < W && 0 <= sy && sy < H){
      if(map[sy][sx] != '#'){
        res += reachable(map, sx, sy);
      }
    }
  }
  return res + 1;
}

int main(){
  while(cin >> W >> H, W != 0){
    vector<string> map(H);
    rep(i, H) cin >> map[i];
    int gy, gx;
    rep(y, H) {
      rep(x, W) {
        if (map[y][x] == '@'){
          gy = y; gx = x;
          break;
        }
      }
    }
    //cout << "OK" << endl;
    cout << reachable(map, gx, gy) << endl;
  }
}

Measured memory_bytes: 3028
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
using ll = long long;

template<typename T>
struct edge {
  T cost, from, to;
  edge(T c, T f, T t) : cost(c), from(f), to(t) {};
};

#define INF 1e15
template<typename T>
vector<T> bellman_ford(vector<edge<T>> &edges, T V, T S, T G) {
  vector<T> costs(V, INF);
  costs[S] = 0;
  rep(i,V) for(edge<T> &e : edges) costs[e.to] = min(costs[e.to], costs[e.from] + e.cost);
  T ans = costs[G];
  rep(i,V) for(edge<T> &e : edges) costs[e.to] = min(costs[e.to], costs[e.from] + e.cost);
  vector<T> emp;
  return ans != costs[G] ? emp : costs;
}

signed main() {
  ll N, M;
  cin >> N >> M;
  vector<edge<ll>> edges;
  rep(i,M) {
    ll u, v, w;
    cin >> u >> v >> w;
    edges.emplace_back(-w, u-1, v-1);
  }
  auto costs = bellman_ford<ll>(edges, N, 0, N-1);
  if (costs.empty()) {
    cout << "inf" << endl;
  } else {
    cout << costs[N-1] * -1 << endl;
  }
}


Measured memory_bytes: 384
#include<stdio.h>
int main()
{
  char str[4];
  int flag=0;
  for(int i=0;i<4;i++)
  {
    scanf("%s",str);
  }
  for(int j=0;j<3;j++)
  {
    if(str[j]==str[j+1])
    {
      flag=1;
    }
  }
  if(flag!=0)
  {
    printf("Bad");
  }else if(flag==0)
  {
    printf("Good");
  }
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
using namespace std;

const int maxN = 310;

int a[maxN][maxN];
vector<pair<int, int> > rr;
int n;

long long process() {
    long long ans = 0;
    for(auto x : rr) {
        bool found = false;
        for(int i=1; i<=n; i++)
            if (i != x.first && i != x.second)
                if (a[x.first][i] + a[x.second][i] == a[x.first][x.second])
                    found = true;
                else if (a[x.first][i] + a[x.second][i] < a[x.first][x.second])
                    return -1;
        if (!found)
            ans += a[x.first][x.second];
    }
    return ans;
}

int main() {
    cin >> n;
    for(int i=1; i<=n; i++) 
        for(int j=1; j<=n; j++) {
            scanf("%d", &a[i][j]);
            if (i < j) 
                rr.push_back(make_pair(i, j));
        }
    sort(rr.begin(), rr.end(), [](pair<int, int> x, pair<int, int> y) -> bool {
            return a[x.first][x.second] < a[y.first][y.second];    
        });
    cout << process();
}


Measured memory_bytes: 1144
import java.util.Scanner;

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

	int a = scan.nextInt();
	int b = scan.nextInt();
	int c = scan.nextInt();
	int d = scan.nextInt();
	int e = scan.nextInt();
	int k = scan.nextInt();

	/*
	int max = 0;
	max = Math.max(Math.max(Math.max(a,b),Math.max(c,d)),e);
	int min = 0;
	min = Math.min(Math.min(Math.min(a,b),Math.min(c,d)),e);
	*/

	if(e-a <= k){
	    System.out.println("Yay!");
	}else{
	    System.out.println(":(");
	}
    }
}


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

int main(){
    ll x;
    cin >> x;
    ll root = pow(x, 1/5);
    
    ll ans_a = 0;
    ll ans_b = 0;
    bool flg = false;
    
    rep(i, 10000){
        rep(j, 10000){
            if(x>=pow(root+i, 5)-pow(j, 5) && x<=pow(root-i, 5)-pow(-j, 5))break;
            
            if(x==pow(root+i, 5)-pow(j, 5)){
                ans_a = root+i;
                ans_b = j;
                flg = true;
            }
            if(x==pow(root+i, 5)-pow(-j, 5)){
                ans_a = root+i;
                ans_b = -j;
                flg = true;
            }
            if(x==pow(root-i, 5)-pow(j, 5)){
                ans_a = root-i;
                ans_b = j;
                flg = true;
            }
            if(x==pow(root-i, 5)-pow(-j, 5)){
                ans_a = root-i;
                ans_b = -j;
                flg = true;
            }
            if(flg)break;
        }
        if(flg)break;
    }
    
    cout << ans_a << " " << ans_b << endl;
}

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

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

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

int main(){
    int n;
    cin >> n;
    ll ans = 0;
    for (int i=1; i<=n-1; ++i) {
        ans += (n-1) / i;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3632
n = int(input())
b = list(map(int,input().split()))
ans = 0
for i in range(n):
    if i == 0:
        ans += b[0]
    elif i == n - 1:
        ans += b[n-2]
    else:
        ans += min(b[i-1],b[i])
print(ans)

Measured memory_bytes: 3060
program main
  implicit none
  integer(8) :: ab, i
  character(6) :: sa, sb, sab
  read(*, *) sa, sb
  sab = trim(sa) // trim(sb)
  read(sab, *) ab
  if (nint(ab ** 0.5) ** 2 == ab) then
    write(*, "(a)") "Yes"
  else
    write(*, "(a)") "No"
  end if
end program main


Measured memory_bytes: 384
#include<iostream>

using namespace std;
int main()
{
  int k,a,b,s=0;
  cin>>k>>a>>b;
  for(int i=a;i<=b;i++)
  {
      if(i%k==0)
      {
          s=1;
          break;
      }

}
      if(s==1)
      {
          cout<<"OK"<<endl;
      }
      else
      {
          cout<<"NG"<<endl;
      }


    return 0;
}


Measured memory_bytes: 3596
import qualified Data.Text as T
import qualified Data.Text.IO as T
import qualified Data.Text.Read as T
import qualified Data.Array as A

main :: IO ()
main = do
  (n : _) <- map unsafeSignedDecimal . T.words <$> T.getLine :: IO [Int]
  xyss <- (sequence . replicate n $ (unsafeSignedDecimal <$> T.getLine) >>= \a -> (sequence . replicate a $ fmap (== 1) . unsafeListToTuple . map unsafeSignedDecimal . T.words <$> T.getLine)) :: IO [[(Int, Bool)]]
  let
    isConsistent :: [Bool] -> Bool
    isConsistent bs = isConsistent' bs' xyss'
      where
        bs' = A.listArray (1, n) bs
        xyss' = map snd . filter fst $ zip bs xyss
  print . maximum . map (length . filter id) . filter isConsistent . sequence . replicate n $ [True, False]

isConsistent' :: A.Array Int Bool -> [[(Int, Bool)]] -> Bool
isConsistent' bs' = all (all p)
  where
    p (x, y) = bs' A.! x == y
{-# INLINE isConsistent' #-}

unsafeListToTuple :: [Int] -> (Int, Int)
unsafeListToTuple (x : y : _) = (x, y)

unsafeSignedDecimal :: T.Text -> Int
unsafeSignedDecimal s = case T.signed T.decimal s of
  Right (n, _) -> n


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

int main(){
    int n, k;
    cin >> n >> k;
    string s;
    cin >> s;
    vector<int> sv;
    int cnt = 0;
    if ( s[0] == '0' ) sv.push_back(0);
    for ( int i = 0; i < s.size();) {
        int j = i;
        while(j<s.size() && s[j] == s[i] ) ++j;
        sv.push_back(j-i);
        i = j;
    }
    if ( s.back() == '0' ) sv.push_back(0);

    vector<int> sums(sv.size()+1, 0);
    rep(i, sv.size()) {
        sums[i+1] = sums[i] + sv[i];
    }

    int ans = 0;
    for ( int left = 0; left < sums.size(); left += 2 ) {
        int right = left + 2 * k + 1;
        if ( right >= sums.size() ) {
            right = (int)sums.size() - 1;
        }
        ans = max(ans, sums[right] - sums[left]);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1272
n = int(input())
b = list(map(int, input().split()))

ans = [0] * n
for i in range(1,n+1):
    num = -1
    for j in range(n+1-i):
        if(b[j] == j+1):
            num = j
    if(num == -1):
        print(-1)
        exit()
    ans[-i] = num + 1
    del b[num]

print('\n'.join(map(str, ans)))

Measured memory_bytes: 38684
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAX 2000000
#define INFTY (1<<30)
int H,A[MAX+1];
void maxHeapify(int);
void insert(int);
int increaseKey(int,int);
int extract();

void maxHeapify(int i){
  int l,r,largest,c;
  l=2*i;
  r=2*i+1;
  
  if(l<=H&&A[l]>A[i]) largest=l;
  else largest=i;
  if(r<=H&&A[r]>A[largest]) largest=r;

  if(largest!=i){
    c=A[i];
    A[i]=A[largest];
    A[largest]=c;
    maxHeapify(largest);
  }
}

void insert(int key){
  H++;
  A[H]=-INFTY;
  increaseKey(H,key);
}

int increaseKey(int i,int key){
  int n;
  if(key<A[i]) return 0;
  A[i]=key;
  while(i>1&&A[i/2]<A[i]){
    n=A[i];
    A[i]=A[i/2];
    A[i/2]=n;
    i=i/2;
  }
  return 0;
}

int extract(){
  int maxv;
  if(H<1) return -INFTY;
  maxv=A[1];
  A[1]=A[H--];
  maxHeapify(1);
  return maxv;
}

int main()
{
  int key;
  char com[10];

  while(1){
    scanf("%s",com);
    if(strcmp(com,"end")==0) break;
    if(strcmp(com,"insert")==0){
      scanf("%d",&key);
      insert(key);
    }
    else{
      printf("%d\n",extract());
    }
  }
  return 0;
}

Measured memory_bytes: 6572
N=int(input())
A=map(int,input().split())

T=[0,0,0]
for a in A:
    if a%2:
        T[0]+=1
    elif a%4:
        T[1]+=1
    else:
        T[2]+=1

if T[1]==0:
    if T[0]<=T[2]+1:
        print("Yes")
    else:
        print("No")
else:
    if T[0]<=T[2]:
        print("Yes")
    else:
        print("No")


Measured memory_bytes: 85112
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define YES cout<<"YES"<<endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define ANS cout << ans << endl
#define all(a) a.begin(),a.end()
#define SORT(a) sort(all(a))
#define REVERSE(a) reverse(all(a))
#define int long long
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define VIin(a) for(int i=0; i<a.size(); i++) cin >> a[i]
#define OUT(a) cout << a << endl
typedef vector<int> VI;
typedef vector<VI> VVI;
const int MOD=1e9+7;
const long long INF = 1LL << 60;
/*最大公約数*/int gcd(int x, int y) { return y ? gcd(y,x%y) : x;}
/*最小公倍数*/int LCM(int a, int b) { int g = gcd(a, b); return a / g * b; }
//----------------------------------------------
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout<<fixed<<setprecision(15);
    
    int n,k; cin >> n >> k;
    VI h(n); VIin(h);
    int ans = 0;
    rep(i,n) if(h[i] >= k) ans++;
    ANS;

    return 0;
}

Measured memory_bytes: 1152
#include <iostream>
#include <vector>

using namespace std;

typedef long long ll;

int main(){
    ll S;
    cin >> S;
    ll N = 1e9;
    ll X=(N-S%N)%N, Y = (S+X)/N;
    cout << "0 0 1000000000 1 " << X << " " << Y << endl;
}

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

int main() {
  long long D;
  cin >> D;
  
  string result;
  if (D == 22) {
    result = "Christmas Eve Eve Eve";
  } else if (D == 23) {
    result = "Christmas Eve Eve";
  } else if (D == 24) {
    result = "Christmas Eve";
  } else {
    result = "Christmas";
  }
  
  cout << result << endl;
  
  return 0;
}

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


int main(){
  int x1, y1, x2, y2;
  cin >> x1 >> y1 >> x2 >> y2;
  int dx = x2 - x1;
  int dy = y2 - y1;
  int x3 = x2 - dy;
  int y3 = y2 + dx;
  int x4 = x3 - dx;
  int y4 = y3 - dy;
  cout << x3 << " " << y3 << " " << x4 << " " << y4 << endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] nums  = new int[n];
        int x; 
        for (int i = 0; i < n-1; i++) {
           x = sc.nextInt();
           nums[x-1]++;
        }
        for (int i=0; i < n; i++) {
            System.out.println(nums[i]);
        }
    }
}


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

#define int long long
#define F first
#define S second
#define fast ios:: sync_with_stdio(false),cin.tie(nullptr);
const int N = 2005;
int dp[N][N];
int n;
vector<pair<int,int>>a;
int solve(int l , int r){
   if(l > r)   return 0;
   int &res = dp[l][r];
   if(res != -1)  return res;
   int id = n - (r - l + 1);
   int pos = a[id].S;
   int val = a[id].F;
   res = max(res , solve(l+1 , r) + abs(pos - l)*val);
   res = max(res , solve(l , r-1) + abs(pos - r)*val);
   return res;
}
int32_t main(){
   fast;
   cin >> n;
   a.resize(n);
   for(int i=0 ; i<n ; i++){
      cin >> a[i].F;
      a[i].S = i;
   }
   sort(a.rbegin() , a.rend());
   memset(dp , -1 , sizeof(dp));
   cout << solve(0 , n-1);
}

Measured memory_bytes: 35200