akhauriyash/Code-Regression huggingface dataset:
import java.util.*;

class Main {
	Scanner sc;
	int N, M;
	List<Integer>[] to;
	int[] marker;

	public Main() {
		sc = new Scanner(System.in);
	}
	
	@SuppressWarnings("unchecked")
	private void calc() {
		N = sc.nextInt();
		M = sc.nextInt();
		to = new ArrayList[N];
		for (int i = 0; i < N; i++) to[i] = new ArrayList<>();
		for (int i = 0; i < M; i++) {
			int a = sc.nextInt() - 1;
			to[a].add(sc.nextInt()-1);
		}
		marker = new int[N];
		
		Deque<Integer> ans = null;
		for (int s = 0; s < N; s++) {
			if (marker[s] == 2) continue;
			Deque<Integer> b = dfs(s);
			if (b == null) continue;
			ans = b;
			break;
		}
		if (ans == null) {
			System.out.println(-1);
			return;
		}
		
		int s = ans.size();
		while ( (ans = shrink(ans)).size() < s ) { s = ans.size(); }
		
		System.out.println(s);
		for (int v : ans) System.out.println(v+1);
	}
	
	private Deque<Integer> dfs(int sv) {
		Deque<Integer> track = new ArrayDeque<>();
		Deque<Integer> q = new ArrayDeque<>();
		q.push(sv);
		
		while (!q.isEmpty()) {
			int v = q.peek();
			marker[v] = 1;
			track.addLast(v);
			boolean stop = true;
			for (int next : to[v]) {
				if (marker[next] == 1) {
					int nv;
					while ( (nv = track.getFirst()) != next) {
						marker[nv] = 3;
						track.removeFirst();
					}
					return track;
				}
				if (marker[next] == 2) continue;
				stop = false;
				q.push(next);
			}
			if (stop) {
				q.pop();
				marker[v] = 2;
				int r = track.removeLast();
			}
		}
		return null;
	}
	
	private Deque<Integer> shrink(Deque<Integer> track) {
		int prev = track.getLast();
		int ev = -1;
	lp:
		for (int now : track) {
			for (int n : to[prev]) {
				if (marker[n] != 1 || n == now) continue;
				ev = n;
				break lp;
			}
			prev = now;
		}
		if (ev == -1) return track;
		for (int i = 0; i < N; i++) marker[i] = 4;
		Iterator<Integer> it = track.iterator();
		int v;
		while (true) {
			v = it.next();
			if (v == ev) break;
		}
		Deque<Integer> ans = new ArrayDeque<>();
		while (v != prev) {
			marker[v] = 1;
			ans.addLast(v);
			if (!it.hasNext()) it = track.iterator();
			v = it.next();
		}
		marker[v] = 1;
		ans.addLast(v);
		return ans;
	}
	
	public static void main(String[] args) {
		new Main().calc();
	}
}


Measured memory_bytes: 28136
[N,K,Q]=list(map(int,input().split()))
A=[""]*Q
for i in range(Q):
    A[i]=int(input())

point=[K]*N

for j in range(Q):
    point[A[j]-1]+=1
    #print("{} {}".format(A[j],point[A[j]]))
    #print(point)

point=list(map(lambda x:x-Q,point))

for k in range(N):
    if point[k]>0:
        print("Yes")
    else:
        print("No")

#print(point)



Measured memory_bytes: 13732
#include <iostream>
 
using namespace std;
 
int main(){
	long long N, M;
	cin >> N >> M;
 
	if (M % 2){
		for (int i = 0; i < M/2; i++){
			cout << i + 1 << " " << M - i << endl;
		}
		for (int i = 0; i < M/2 + 1; i++){
			cout << M + i + 1 << " " << 2 * M - i + 1 << endl;
		}
	} else {
		for (int i = 0; i < M/2; i++){
			cout << i + 1 << " " << M - i + 1 << endl;
			cout << M + i + 2 << " " << 2 * M - i + 1 << endl;
		}
	}
 
	return 0;
}

Measured memory_bytes: 3648
#include <cstdio>
#include <vector>
#include <algorithm>
#include <array>
#include <set>
#include <map>
#include <queue>
#include <tuple>
#include <unordered_set>
#include <unordered_map>
#include <functional>
#include <cassert>
#define repeat(i, n) for (int i = 0; (i) < int(n); ++(i))
using namespace std;

struct dice_t { // regular hexahedron group
    //       ______
    //      \      \      4
    //     / \   C  \    2156
    //    / A \______\    3 ^
    //    \ A /    B /   ^^ |
    //     \ /   B  /    ab bottom
    //      v__B___/
    int a, b; // in [1, 6]
    int c() const {
        static const int table[6][6] = {
            { 0, 3, 5, 2, 4, 0 },
            { 4, 0, 1, 6, 0, 3 },
            { 2, 6, 0, 0, 1, 5 },
            { 5, 1, 0, 0, 6, 2 },
            { 3, 0, 6, 1, 0, 4 },
            { 0, 4, 2, 5, 3, 0 },
        };
        assert (table[a-1][b-1] != 0);
        return  table[a-1][b-1];
    }
};
dice_t rotate_up(   dice_t dice) { return (dice_t) { dice.a, 7 - dice.c() }; }
dice_t rotate_right(dice_t dice) { return (dice_t) { 7 - dice.c(), dice.b }; }
dice_t rotate_down( dice_t dice) { return (dice_t) { dice.a, dice.c() }; }
dice_t rotate_left( dice_t dice) { return (dice_t) { dice.c(), dice.b }; }
bool operator == (dice_t x, dice_t y) { return x.a == y.a and x.b == y.b; }

const int dy[4] = { 1, -1, 0, 0 };
const int dx[4] = { 0, 0, 1, -1 };
int main() {
    while (true) {
        int n; scanf("%d", &n);
        if (n == 0) break;
        map<pair<int, int>, int> rank;
        map<pair<int, int>, int> value;
        while (n --) {
            int c, b; scanf("%d%d", &c, &b);
            dice_t dice = rotate_right((dice_t) { c, b });
            int y = 0;
            int x = 0;
            while (true) {
                int dir = -1;
                int num = -1;
                auto update = [&](int d, int n) {
                    if (not (n == 4 or n == 5 or n == 6)) return;
                    int ny = y + dy[d];
                    int nx = x + dx[d];
                    if (rank[make_pair(ny, nx)] >= rank[make_pair(y, x)]) return;
                    if (num < n) {
                        dir = d;
                        num = n;
                    }
                };
                update(0, 7 - dice.b);
                update(1, dice.b);
                update(2, 7 - dice.a);
                update(3, dice.a);
                if (dir == -1) break;
                y += dy[dir];
                x += dx[dir];
                dice =
                    dir == 0 ? rotate_up(dice) :
                    dir == 1 ? rotate_down(dice) :
                    dir == 2 ? rotate_right(dice) :
                               rotate_left(dice);
            }
            rank[make_pair(y, x)] += 1;
            value[make_pair(y, x)] = dice.c();
        }
        array<int, 6> result = {};
        for (auto it : value) {
            result[it.second - 1] += 1;
        }
        repeat (i, 6) {
            printf("%d%c", result[i], i + 1 < 6 ? ' ' : '\n');
        }
    }
    return 0;
}

Measured memory_bytes: 2740
import java.util.*;

class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    long A = sc.nextLong();
    long B = sc.nextLong();
    long K = sc.nextLong();
    if (A >= K) {
      A = A - K;
    } else {
      if (B >= (K-A)){
        B = B - (K - A);
        A = 0;
      } else {
        B = 0;
        A = 0;
      }
    }
    System.out.println(A + " " + B);
  }
}


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

#define rep(i, n) for ( ll i = 0; i < (n); ++i )
#define reps(i, n) for ( ll i = 1; i <= (n); ++i )
#define _rep(i, n) for ( ll i = (n) - 1; i >= 0; --i )
#define _reps(i, n) for ( ll i = n; i > 0; --i )
#define all(x) (x).begin(), (x).end()
#define _all(x) (x).rbegin(), (x).rend()

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

#define POW5(x) ((x) * (x) * (x) * (x) * (x))

int main( void )
{
	ll x;
	cin >> x;

	for( ll a = -118; a <= 119; a++ ) {
		for( ll b = -119; b <= 118; b++ ) {
			if ( (POW5(a) - POW5(b)) == x ) {
				cout << a << " " << b << endl;
				return 0;
			}
		}
	}

	return 0;
}


Measured memory_bytes: 3596
#include<bits/stdc++.h>
using namespace std;
#define ll long long
char s[1002],t[1002];

int main()
{
    int n,m,i,j,ans,cnt;
    scanf("%s %s",s,t);
    n=strlen(s);
    m=strlen(t);
    ans=n;
    for(i=0; i<n; i++)
    {
        if(i+m<=n)
        {
            cnt=0;
            for(j=0; j<m; j++)
                if(t[j]!=s[i+j])cnt++;
            ans=min(ans,cnt);
        }
    }
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 3776
# AOJ 0218: Dividing Students
# Python3 2018.6.23 bal4u

while 1:
	n = int(input())
	if n == 0: break
	for i in range(n):
		pm, pe, pj = map(int, input().split())
		k = pm+pe+pj
		if pm == 100 or pe == 100 or pj == 100: print("A")
		elif pm + pe >= 90*2: print("A")
		elif k >= 80*3: print("A")
		elif k >= 70*3: print("B")
		elif k >= 50*3 and (pm >= 80 or pe >= 80): print("B")
		else: print("C")



Measured memory_bytes: 5608
import sys, math
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial
from bisect import bisect_left #bisect_left(list, value)
#from fractions import gcd
sys.setrecursionlimit(10**7)
enu = enumerate
MOD = 10**9+7
def input(): return sys.stdin.readline()[:-1]
def pri(x): print('\n'.join(map(str, x)))

S = input()
cnt = 0
for s in S:
    if s=='+':
        cnt += 1
    else:
        cnt -= 1
print(cnt)





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

using namespace std;

int main() {

    char c; cin >> c;

    if(c == 'a' || c =='b' || c =='c' || c =='d' || c =='e' || c =='f' || c =='g' || c =='h' || c =='i' || c =='j' || c =='k' || c =='l' || c =='m' || c =='n' || c =='o' || c =='p' || c =='q' || c =='r' || c =='s' || c =='t' || c =='u' || c =='v' || c =='w' || c =='x' || c =='y' || c =='z') cout << 'a' << endl;
    else cout << 'A' << endl;

    return 0;
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(s,i, n) for (int i = (int)s; i < (int)(n); i++)
#define pb push_back
typedef long long ll;
 
vector<int> x;
ll gcd(ll a, ll b)
{
    if (a%b == 0)
   {
       return(b);
   }
   else
   {
       return(gcd(b, a%b));
   }
}
 
ll lcm(ll a, ll b)
{
   return a * b / gcd(a, b);
}
bool primeNumber(ll n){
    if(n < 2) return false;
    else{
        for(ll i = 2; i * i <= n; i++){
            if(n % i == 0) return false;
        }
        return true;
    }
}
 
int main(){
    ll a,b;
    ll ans=1;
    cin>>a>>b;
    ll c=gcd(a,b);
    if(a==1 ||b==1){
        cout<<1<<endl;
        return 0;
    }

    if(!primeNumber(c)){
        ll k=c;
        for(ll i=2;i*i<=k;i++){
            bool check=true;
            while(c%i==0){
                c=c/i;
                if(check){
                    ans+=1;check=false;
                }
            }
            
        }if(c!=1)ans++;    
    }else{
        ans+=1;
    }
    
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
from itertools import accumulate
from bisect import bisect_left
N = int(input())
A = [0] + list(map(int, input().split()))


ans = float('inf')
A = list(accumulate(A))

for m in range(2, N - 1):
    Lx = A[m] // 2
    Li = bisect_left(A, Lx)
    if abs(Lx - A[Li]) > abs(Lx - A[Li - 1]):
        Li -= 1

    Rx = (A[-1] + A[m]) // 2
    Ri = bisect_left(A, Rx)
    if abs(Rx - A[Ri]) > abs(Rx - A[Ri - 1]):
        Ri -= 1

    P, Q, R, S = A[Li], A[m] - A[Li], A[Ri] - A[m], A[-1] - A[Ri]
    tmp_ans = max(P, Q, R, S) - min(P, Q, R, S)
    ans = min(ans, tmp_ans)


print(ans)


Measured memory_bytes: 24180
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <climits>
#include <random>
#include <iomanip>

using namespace std;
using P = pair<long, long>;

typedef long long int ll;

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

#define fillInt(xs, x)        \
  for (int i = 0; i < (x); i++) \
    scanf("%d", &xs[i]);
#define fillLong(xs, x)       \
  for (int i = 0; i < (x); i++) \
    scanf("%ld", &xs[i]);
#define fillString(xs, x)       \
  for (int i = 0; i < (x); i++) \
    cin >> xs[i];
#define sortv(xs) sort(xs.begin(), xs.end())
#define sortvinv(xs) sort(xs.begin(), xs.end(), std::greater<long>())
#define lbv(xs, x) lower_bound(xs.begin(), xs.end(), x) - xs.begin()
#define ubv(xs, x) upper_bound(xs.begin(), xs.end(), x) - xs.begin()
#define bs(xs, x) binary_search(xs.begin(), xs.end(), x)
#define index_of(as, x) \
  distance(as.begin(), lower_bound(as.begin(), as.end(), x))

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

const int mod = 1000000007;

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

  int n, k;
  cin >> n >> k;

  long res = 0;
  for(int i = k+1; i <= n; i++) {
    int x = i-k;
    int y = n/i;
    int z = n%i;
    res += x*y+max(z-max(0, k-1), 0);
  }

  cout << res << endl;
}


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

#define MP make_pair
#define PB push_back
#define ALL(x)      (x).begin(),(x).end()
#define REP(i,n)    for(int i=0;i<(n);i++)
#define REP1(i,n)   for(int i=1;i<(n);i++)
#define REP2(i,d,n) for(int i=(d);i<(n);i++)
#define RREP(i,n)   for(int i=(n);i>=0;i--)
#define CLR(a)      memset((a),0,sizeof(a))
#define MCLR(a)     memset((a),-1,sizeof(a))
#define RANGE(x,y,maxX,maxY) (0 <= (x) && 0 <= (y) && (x) < (maxX) && (y) < (maxY))

typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI > VVI;
typedef vector<string> VS;
typedef vector<LL> VLL;
typedef pair<int,int> PII;

const int INF = 0x3f3f3f3f;
const LL INFL = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-9;

const int DX[]={1,0,-1,0},DY[]={0,-1,0,1};


void solve(std::vector<long long> x, std::vector<long long> y){
    int x3 = x[1] - (y[1] - y[0]);
    int y3 = y[1] + (x[1] - x[0]);
    int x4 = x[0] - (y[1] - y[0]);
    int y4 = y[0] + (x[1] - x[0]);
    cout << x3 << " " << y3 << " " << x4 << " " << y4 << endl;
}

int main(){
    std::vector<long long> x(2);
    std::vector<long long> y(2);
    for(int i = 0 ; i < 2 ; i++){
        scanf("%lld",&x[i]);
        scanf("%lld",&y[i]);
    }
    solve(std::move(x), std::move(y));
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define  rep(i, n) for(int i = 0; i < n; i++) 
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  INF 1LL << 60
typedef long long int LL;
typedef long long int ll;
#define pll pair<ll, ll>
#define F first
#define S second
const int MOD = 1000000007;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }
//sort(all(x))とするとソートできるよ
// 10^x は pow(10,(x)) 
// 任意のlogは　対数の底の変換を使う    log(N) / log(任意の底)

void add(LL &a,LL b){
    a = (a+b) % MOD;
}

bool ng(int a,int b,int c){ //true で”AGC”
    return (a==1 && b==2 && c==3);
}

int main(){
    int N;cin >> N;
    // TAGC を0123 とする。
    LL dp[110][4][4][4];
    dp[0][0][0][0] = 1; // T のみからなる0文字の文字列の数として初期条件を置く。
    
    rep(i,N) rep(a,4) rep(b,4) rep(c,4) rep(d,4){   // i は n文字目まで、a,b,cは最後尾の左から1,2,3個の文字、dは後ろに付け足す文字
        // 3文字でNGの時 AGC, GAC, ACG
        if( ng(b,c,d) || ng(c,b,d) || ng(b,d,c) )continue;
        // 4文字でNGの時 AXGC, AGXC
        if( ng(a,b,d) || ng(a,c,d))continue;
        // dp遷移
        add(dp[i+1][b][c][d],dp[i][a][b][c]);
    }

    LL ans = 0;
    rep(a,4)rep(b,4)rep(c,4) add(ans,dp[N][a][b][c]);
    cout << ans << endl;

}


Measured memory_bytes: 256
// ConsoleApplication1.cpp : アプリケーションのエントリ ポイントを定義します。
//

//#include "stdafx.h"

#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <functional>

//067 B

using namespace std;
int main()
{
	int N, K, sum = 0;
	cin >> N >> K;
	int a[55];
	for (int i = 0; i < N; i++) cin >> a[i];

	sort(a, a + N, greater<int>());
	for (int i = 0; i < K; i++) {
		sum += a[i];
	}
	cout << sum << endl;

	return 0;
}



Measured memory_bytes: 764
#include <bits/stdc++.h>
//#define TASK "file"

#define F first
#define S second
#define ALL(x) (x).begin(), (x).end()

using namespace std;
typedef long long i64;
typedef long double dbl;
const dbl PI = acos(-1.0L);
const dbl EPS = 1e-12L;
mt19937 rng((uint32_t)chrono::steady_clock::now().time_since_epoch().count());

namespace task {
int n;
string s;

void rec(int k, char c = 'a') {
  if (k == 0) {
    cout << s << '\n';
    return;
  }
  for (char x = 'a'; x < c; ++x) {
    s += x;
    rec(k - 1, c);
    s.pop_back();
  }
  s += c;
  rec(k - 1, c + 1);
  s.pop_back();
}

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

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.precision(11);
  cout.setf(ios::fixed);
#ifdef _DEBUG
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#elif defined(TASK)
  freopen(TASK".in", "r", stdin);
  freopen(TASK".out", "w", stdout);
#endif
  return task::main();
}


Measured memory_bytes: 1536
#include<bits/stdc++.h>
#define int long long int
using namespace std;
int32_t main()
{
	int n;
	cin>>n;
	int a[n];
	for(int i=0; i<n; i++)
	{
		cin>>a[i];
	}
	int xz=0;
	for(int i=0; i<n; i++)
	{
		xz=xz^a[i];
	}
	for(int i=0; i<n; i++)
	{
		int k=xz^a[i];
		cout<<k<<" ";
	}
}

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

int main(){
  double a,b;
  cin >> a >> b;
  int x1=0;
  double x = 0;
  x1= (a+b)/2;
  x =(a+b)/2;
  double x2 = x-x1;
  if( x2>= 0.5) x1++;
  cout << x1;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<bitset>
#include<deque>
#include<functional>
#include<iterator>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<utility>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define a first
#define b second
#define sz(x) (ll)((x).size())
#define pb push_back
#define mp make_pair
#define bg begin()
#define ed end()
#define all(x) (x).bg,(x).ed
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rep1(i,n) for(ll i=1;i<=(n);i++)
#define rrep(i,n) for(ll i=(n)-1;i>=0;i--)
#define rrep1(i,n) for(ll i=(n);i>=1;i--)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
const ll MOD=1000000007;
const ll INF=1000000000000000;
template<class T> inline bool chmin(T& a, T b){if(a>b){a=b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b){if(a<b){a=b;return true;}return false;}
ll maxx(ll x,ll y,ll z){return max(max(x,y),z);}
ll minn(ll x,ll y,ll z){return min(min(x,y),z);}
ll gcd(ll x,ll y){if(x%y==0) return y;else return gcd(y,x%y);}
ll lcm(ll x,ll y){return x*(y/gcd(x,y));}
ll digsz(ll x){if(x==0) return 1;else{ll ans=0;while(x){x/=10;ans++;}return ans;}}
ll digsum(ll x){ll sum=0;while(x){sum+=x%10;x/=10;}return sum;}
vector<ll> pw2(62,1);vector<ll> pw10(19,1);

vector<ll> vectorprime(ll x){
    vector<bool> is_prime(x+1);
    vector<ll> prime;
    rep(i,x+1) is_prime[i]=true;
    is_prime[0]=is_prime[1]=false;
    for(ll i=2;i<=x;i++){
        if(is_prime[i]){
            prime.pb(i);
        }
        for(int j=i*2;j<=x;j+=i) is_prime[j]=false;
    }
    return prime;
}
map<ll,ll> prime_factor(ll x){
    map<ll,ll> m;
    ll sq=(ll)sqrt(x) + 1;
    vector<ll> v_prime=vectorprime(sq);
    
    ll tmp=x;
    rep(i,sz(v_prime)){
        ll count=0;
        while(tmp % v_prime[i] == 0){
            tmp /= v_prime[i];
            count++;
        }
        if(count != 0) m[v_prime[i]]=count;
        if(tmp==1) break;
    }
    
    if(tmp != 1) m[tmp]=1;
    return m;
}

int main(){
    {rep1(i,61) pw2[i]=2*pw2[i-1];}
    {rep1(i,18) pw10[i]=10*pw10[i-1];}
    
    ll N,P; cin>>N>>P;
    map<ll,ll> m=prime_factor(P);
    ll ans=1;
    for(auto it=m.bg;it!=m.ed;it++){
        ll tmp=(it->b)/N;
        rep(i,tmp) ans*=it->a;
    }
    cout<<ans<<endl;
}



Measured memory_bytes: 4440
package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)

	gochi := 1
	usa := 1
	for i := 0; i < n; i++ {
		var a int
		fmt.Scan(&a)
		gochi *= 3
		usa *= 2 - a%2
	}
	fmt.Println(gochi - usa)
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll GCD(ll x,ll y){
    if(y == 0) return x;
    else return GCD(y,x%y);
}
const int MOD = 1000000007;

int main() {
    int n; cin >> n;
    vector<int>vec(8);
    int b = 0;
    for(int i = 0;i < n;i++){
        int x; cin >> x;
        if(x < 400){
            vec.at(0)++;
        }else if(x < 800){
            vec.at(1)++;
        }else if(x < 1200){
            vec.at(2)++;
        }else if(x < 1600){
            vec.at(3)++;
        }else if(x < 2000){
            vec.at(4)++;
        }else if(x < 2400){
            vec.at(5)++;
        }else if(x < 2800){
            vec.at(6)++;
        }else if(x < 3200){
            vec.at(7)++;
        }else{
            b++;
        }
    }
    
    int cnt = 0;
    for(int i = 0;i < 8;i++){
        if(vec.at(i) > 0){
            cnt++;
        }
    }
    
    int ans1 = cnt;
    int ans2 = cnt+b;
    ans1 = max(1,ans1);
    cout<< ans1 << " " << ans2;
    
}




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

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		StringBuilder sb = new StringBuilder();
		int n = sc.nextInt();
		int h = sc.nextInt();
		int slash[] = new int[n];
		int thr[] = new int[n];
		int slashmax = Integer.MIN_VALUE;
		int throwmin = Integer.MAX_VALUE;
		int cnt = 0;
		for (int i = 0; i < n; i++) {
			slash[i] = sc.nextInt();
			thr[i] = sc.nextInt();
			slashmax = Math.max(slashmax, slash[i]);
			throwmin = Math.min(throwmin, thr[i]);
		}
		Arrays.sort(slash);
		Arrays.sort(thr);
		for (int i = n - 1; i >= 0; i--) {
			if (h <= 0) {
				break;
			}
			if (thr[i] > slashmax) {
				h = h - thr[i];
				cnt++;
			}
		}
		if (h > 0) {
			cnt += h / slashmax;
			if (h % slashmax != 0) {
				cnt++;
			}
		}
		System.out.println(cnt);
	}
}


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

int main(){
    int n, rank;
    char suit;
    bool cards[4][14];
    
    for ( int s = 0; s < 4; s++ ){
        for( int r = 1; r <= 13; r++ ){
            cards[s][r] = 0;
        }
    }
    
    cin >> n;
    for( int i = 0; i < n; i++ ){
        cin >> suit >> rank;
        if ( suit == 'S' ) cards[0][rank] = 1;
        if ( suit == 'H' ) cards[1][rank] = 1;
        if ( suit == 'C' ) cards[2][rank] = 1;
        if ( suit == 'D' ) cards[3][rank] = 1;
    }
    
    for ( int s = 0; s < 4; s++ ){
        for ( int r = 1; r <= 13; r++ ){
            if ( cards[s][r] ) continue;
            if ( s == 0 ) suit = 'S';
            if ( s == 1 ) suit = 'H';
            if ( s == 2 ) suit = 'C';
            if ( s == 3 ) suit = 'D';
            
            cout << suit << " " << r << endl;
        }
    }
    
    return 0;
}


Measured memory_bytes: 3092
# import sys
# sys.setrecursionlimit(10 ** 6)
# import bisect
# from collections import deque
# from decorator import stop_watch
#
#
# @stop_watch
def solve(N, K, h):
    h.sort()
    ans = 10 ** 9
    for i in range(K - 1, N):
        ans = min(ans, h[i] - h[i - (K - 1)])
    print(ans)


if __name__ == '__main__':
    N, K = map(int, input().split())
    h = [int(input()) for _ in range(N)]
    solve(N, K, h)

    # # test
    # from random import randint
    # from func import random_str
    # N, K = 10 ** 5, 10 ** 5 // 5
    # h = [randint(1, 10 ** 9) for _ in range(N)]
    # solve(N, K, h)


Measured memory_bytes: 13268
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
   // freopen("input.txt","r",stdin);
   // freopen("output.txt","w",stdout);
    string s;
    cin >> s;
    int l = s.size();
    char first = s[0];
    char last = s[l-1];

    if(first == last){
        cout << (l % 2 == 0 ? "First" : "Second") << endl;
    }
    else{
        if(l % 2 != 0)cout << "First" << endl;
        else cout << "Second" << endl;
    }
    return 0;
}



Measured memory_bytes: 512
#include<stdio.h>

int main(){
	int n,c[9]={0},i,a,ans=0,ansmax=0,ansmin=0;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d",&a);
		if(a<3200)c[a/400]=1;
		else c[8]++;
	}
	for(i=0;i<8;i++)ans+=c[i];
		ansmin=ans;
		ansmax=ans+c[8];
	if(ans==0&&c[8]>=1)ansmin=1;
	printf("%d %d\n",ansmin,ansmax);
	return 0;
}


Measured memory_bytes: 128
import java.util.Scanner;

import java.util.Arrays;
import java.util.ArrayList;

public class Main {
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int r = sc.nextInt();
		int D = sc.nextInt();
		int x = sc.nextInt();
		

		
		for (int i = 0; i<10; i++) {
			x = r * x - D;
			System.out.println(x);
		}
	}
}	



Measured memory_bytes: 21844
#include <stdio.h>
#include <stdbool.h>

int main(){
   int i, j, n;
   char mark;
   char marks[4]={'S', 'H', 'C', 'D'};
   int num;
   bool cards[4][13]={false};

   scanf("%d ", &n);
   for(i=0;i<n;i++){
       scanf("%c %d ", &mark, &num);
       for(j=0;j<4;j++){
           if(mark==marks[j]){
               cards[j][num-1]=true;
               break;
           }
       }
   }
   for(i=0;i<4;i++){
       for(j=0;j<13;j++){
           if(!cards[i][j]){
               printf("%c %d\n", marks[i], j+1);
           }
       }
   }
   return 0;
}


Measured memory_bytes: 2120
import java.util.Scanner;

public class Main {

	private static Scanner sc;

	public static void main(String[] args){
		sc = new Scanner(System.in);
		int r=sc.nextInt();
		int c=sc.nextInt();
		int m[][]=new int[r+1][c+1];
		for(int i=0;i<r;i++){
			for(int j=0;j<c;j++){
				m[i][j]=sc.nextInt();
			}
		}

		for(int i=0;i<r;i++){
			for(int j=0;j<c;j++){
				System.out.print(m[i][j]+" ");
				m[i][c]+=m[i][j];
			}
			System.out.println(m[i][c]);
		}
		for(int j=0;j<c+1;j++){
			for(int i=0;i<r;i++){
				m[r][j]+=m[i][j];
			}
			System.out.print(m[r][j]);
			if(j!=c)System.out.print(" ");
		}
		System.out.println();
	}
}

Measured memory_bytes: 41524
#include <bits/stdc++.h>
using namespace std;
#define dhoom ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);  
typedef long long ll;
typedef long double ld;
const ll inf = 1e18;
const int nax = 1e6 + 7;
const ll mod = 1e9 + 7;
//ll tree[4 * nax];
//9uS-22RSwk7gQqh
int color[nax];
vector< int > g[nax];
void dfs(int u , int p , int c){
	color[u] = c;
	for(auto v : g[u]){
		if(color[v] == c){
			cout << -1 << endl;
			exit(0);
		}
		if(color[v] == 0){
			dfs(v , u , 3 - c);
		}
	}
}
int main(){
	dhoom;
	string s;
	set< string > st;
	int n;
	cin >> n;
	for(int i = 0 ; i < n ; i++)
	{
		cin >> s;
		st.insert(s);	
	}
	cout << st.size() << endl;
}


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


int main() {

    long long A, B, C, K;
    cin >> A >> B >> C >> K;
    long long d;

    if (K%2 == 0)
    {
        d = A - B;
    }
    else
    {
        d = B - A;
    }

    if(abs(d) <= 1E18)
    {
        cout << d;
    }
    else
    {
        cout << "Unfair";
    }

    return 0;
}

Measured memory_bytes: 256
n = int(input())

g = [[] * n for i in range(n)]

for i in range(n):
  s = input()
  for j,si in enumerate(s):
    if si == '1':
      g[i].append(j)
      
from collections import deque

def bfs(s):
  que = deque()
  que.append((s,1))
  a[0].append(s)
  chk = [False]*n
  chk[s] =True
  cnt = 1
  while que:
      now,p = que.popleft()
      if cnt == n:
        break
      for i in g[now]:
          if not chk[i]:
            a[p].append(i)
            chk[i] = True
            cnt += 1
            que.append((i,p+1))
          
ans = -1
for i in range(n):
  a = [[] for i in range(n+1)]
  bfs(i)
  cc = 0
  b = False
  #print(a)
  for j in a:
    if j == []:
      ans = max(ans,cc)
      break
    cc += 1
    for k in j:
      #print(set(g[k]), set(j), j,i)
      if set(g[k]) & set(j) != set():
        b = True
        break
    if b:
      break
  
print(ans)

Measured memory_bytes: 3668
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<list>
#include<iomanip>
#include<cmath>
#include<cstring>
#include<functional>
using namespace std;

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define INF 2e9
#define MOD 1000003
//#define MOD 998244353
#define LINF (long long)4e18
#define jck 3.141592

using ll = long long;
using Pi = pair<int,int>;
using Pl = pair<ll,ll>;



int main(){
	int N; cin >> N;
	int cntB = 0;
	int cntA = 0;
	int cntBA = 0;
	int ans = 0;
	rep(i,N){
		string s; cin >> s;
		int M = s.size();
		if(s[0] == 'B' && s[M-1] != 'A') cntB++;
		if(s[0] != 'B' && s[M-1] == 'A') cntA++;
		if(s[0] == 'B' && s[M-1] == 'A') cntBA++;
		rep(j,M-1){
			if(s[j] == 'A' && s[j+1] == 'B') ans++;
		}
	}
	if(cntB == 0 && cntA == 0) ans += max(0,cntBA-1);
	else ans += min(cntB+cntBA,cntA+cntBA);
	cout << ans << endl;
}

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

#define pb push_back
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define debug(x)  cerr << #x << " = " << x << endl
using namespace std;

typedef long long ll;
typedef long double ld;
typedef string str;
typedef pair<ll, ll> pll;

const ld PI = 3.14159265359;

const ll MOD = (ll) 1e9 + 7;
const ll MAXN = (ll) 1e3 + 10;
const ll INF = (ll) 10000000000ll;
const ld EPS = (ld) 1e-8;

ll t[MAXN][MAXN], a[MAXN], b[MAXN];

int main(){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	ll n, m;
	cin >> n >> m;
	for(int i = 0; i < n; i++) cin >> a[i];
	for(int i = 0; i < m; i++) cin >> b[i];
	sort(a, a + n);
	sort(b, b + m);
	for(int i = 0; i < n; i++) for(int j = 0; j < n; j++) if(a[i] == a[j] and i !=j) return cout << 0, 0;
	for(int i = 0; i < m; i++) for(int j = 0; j < m; j++) if(b[i] == b[j] and i !=j) return cout << 0, 0;
	
	ll f, s,u = 0, ans = 1, r = m * n, p = 1;
	for(int i = n * m; i > 0; i--){
		f = lower_bound(a, a + n, i) - a;
		//debug((n - f));
		s = lower_bound(b, b + m, i) - b;
		//debug((m - s));
		p = 1;
		if(a[f] != i) p *= (n - f);
		if(b[s] != i) p *= (m - s);
		p = (p - ((a[f] == i or b[s] == i) ? 0 : u));
		//debug(u);debug(p);
		ans *= p;
		//debug(ans);
		u ++;
		ans %= MOD;
	}
	cout << ans;
	return 0;
}


/*
6
7 3 4 2 3 1
                                 ____              ,----..               ,----..
   ,---,                       ,'  , `.           /   /   \             /   /   \
  '  .' \                   ,-+-,.' _ |          /   .     :           /   .     :
 /  ;    '.              ,-+-. ;   , ||         .   /   ;.  \         .   /   ;.  \
:  :       \            ,--.'|'   |  ;|        .   ;   /  ` ;        .   ;   /  ` ;
:  |   /\   \          |   |  ,', |  ':        ;   |  ; \ ; |        ;   |  ; \ ; |
|  :  ' ;.   :         |   | /  | |  ||        |   :  | ; | '        |   :  | ; | '
|  |  ;/  \   \        '   | :  | :  |,        .   |  ' ' ' :        .   |  ' ' ' :
'  :  | \  \ ,'        ;   . |  ; |--'         '   ;  \; /  |        '   ;  \; /  |
|  |  '  '--'          |   : |  | ,             \   \  ',  /          \   \  ',  /
|  :  :                |   : '  |/               ;   :    /            ;   :    /
|  | ,'                ;   | |`-'                 \   \ .'              \   \ .'
`--''                  |   ;/                      `---`                 `---`
                       '---'

*/


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        final Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int n = in.nextInt();
        int m = in.nextInt();
        Map<Integer, List<Integer>> paths = new HashMap<>();
        int[] dp = new int[n];
        for (int i = 0; i < m; i++) {
            int from = in.nextInt();
            int to = in.nextInt();
            paths.compute(from - 1, (integer, integers) -> {
                if (integers == null) {
                    integers = new ArrayList<>();
                }
                integers.add(to - 1);
                return integers;
            });
        }
        boolean[] visited = new boolean[n];
        for (int i = 0; i < n; i++) {
            if (!visited[i]) {
                dfs(i, visited, paths, dp);
            }
        }

        int result = Integer.MIN_VALUE;
        for (int j = 0; j < n; j++) {
            result = Math.max(result, dp[j]);
        }
        System.out.println(result);
    }

    private static void dfs(int from, boolean[] visited, Map<Integer, List<Integer>> paths, int[] dp) {
        final List<Integer> tos = paths.getOrDefault(from, Collections.emptyList());
        for (Integer to : tos) {
            if (!visited[to]) {
                dfs(to, visited, paths, dp);
            }
        }
        for (Integer to : tos) {
            dp[from] = Math.max(dp[from], dp[to] + 1);
        }
        visited[from] = true;
    }
}


Measured memory_bytes: 113916
import java.util.*;

public class Main{

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

    long a1,a2=0,b1,b2=0;

    for(long i = 0;i < 1000000000;i++) {

      a1 = a-i;
      a2 = Math.abs(a1);
      b1 = b-i;
      b2 = Math.abs(b1);

      if(a2 == b2) {
        System.out.println(i);
        break;
      }

    }

    if(a2 != b2) {
      System.out.println("IMPOSSIBLE");
    }

  }

}

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

int main() {
	int N;
	cin >> N;
	bool ans = true;
	for (int i = 0; i < N; i++) {
		int a;
		cin >> a;
		if (a % 2 == 0 && a % 3 != 0 && a % 5 != 0) ans = false;
	}
	cout << (ans ? "APPROVED" : "DENIED") << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <utility>
#include <vector>

using namespace std;
using ll = long long;

constexpr ll infl = 10000000000000007LL;
constexpr int inf = 1000000007;

int main() {
    int a, b;
    cin >> a >> b;
    cout << 100 << " " << 100 << endl;
    for (int i = 0; i < 50; ++i) {
        for (int j = 0; j < 100; ++j) {
            if (i % 2 == 1 && j % 2 == 1 && a > 1) {
                cout << '.';
                --a;
            } else {
                cout << '#';
            }
        }
        cout << endl;
    }
    for (int i = 0; i < 50; ++i) {
        for (int j = 0; j < 100; ++j) {
            if (i % 2 == 1 && j % 2 == 1 && b > 1) {
                cout << '#';
                --b;
            } else {
                cout << '.';
            }
        }
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 256
fn main() {
    let a: i32 = read();
    let b: i32 = read();
    let c: i32 = read();
    let d: i32 = read();

    let s1 = a*b;
    let s2 = c*d;
    println!("{}", max(s1, s2));
}

// 以下関数

use std::io::*;
use std::str::FromStr;
pub fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

pub const MOD: u64 = 10e9 as u64 + 7;

pub fn is_prime(n: i32) -> bool {
    if n < 2 {
        return false;
    } else if n == 2 {
        return true;
    }
    let mut i = 2;
    while i * i < n {
        if n % i == 0 {
            return false;
        } else {
            i += 1;
            continue;
        }
    }
    true
}

pub fn lcm(mut n: i32, mut m: i32) -> i32 {
    n = if n > m { m } else { n };
    m = if n > m { n } else { m };
    let mut i = n;
    while i % m != 0 {
        i += n;
    }
    i
}

pub fn abs(n: i32) -> i32 {
    if n >= 0 {
        n
    } else {
        -n
    }
}

pub fn max(n: i32, m: i32) -> i32 {
    if n >= m {
        n
    } else {
        m
    }
}

pub fn min(n: i32, m: i32) -> i32 {
    if n <= m {
        n
    } else {
        m
    }
}

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

int cmp(int*,int*);
int main(){
  int n; scanf("%d",&n);
  long long a[n];
  for(int i=0; i<n; i++){
    scanf("%lld", &a[i]);
  }
  qsort(a,n,sizeof(long long),cmp);
  for(int i=0; i<n-1; i++){
    if(a[i+1]-a[i]==0){ printf("NO\n"); break;}
    else if(i==n-2) printf("YES\n");
  }
  return 0;
}

int cmp(int* a, int* b){
  if(*a>*b) return 1;
  else if(*a< *b) return -1;
  else return 0;
}

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

#define FOR(i,a,b) for(int i = (a); i < (b); ++i)
#define REP(i,n) FOR(i,0,n)
using ll = long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vvvi = vector<vector<vector<int>>>;
using mii = map<int, int>;
using msi = map<string, int>;
using pii = pair<int, int>;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << std::fixed << std::setprecision(10);
    
    int n; cin >> n;
    vi a(n); REP(i, n) cin >> a[i];
    int ans = 0;
    REP(i, n) {
        if(a[i] == 2) {
            ans++;continue;
        }
        if(a[i] % 2 == 0) continue;
        bool f = true;
        for(int j = 3; j * j <= a[i]; j += 2) {
            if(a[i] % j == 0) {
                f = false;
                break;
            }
        }
        if(f) ans++;
    }
    cout << ans << endl;
    

    return 0;
}


Measured memory_bytes: 3180
import math
N = int(input())
n = int(math.sqrt(N))

minFAB = len(str(N))

for i in range(1,n+1):
    l = len(str(i))
    m = len(str(N//i))
    if N%i == 0:
        minFAB = min(minFAB,max(l,m))

print(minFAB)    

Measured memory_bytes: 3060
/*@author Vipen Loka*/
#include <bits/stdc++.h>
#define endl '\n'
#define ff first
#define ss second
#define ll long long int
#define vi vector<int>
#define vll vector<ll>
#define vvi vector < vi >
#define pii pair<int,int>
#define pll pair<long long, long long>
#define mod 1000000007
#define inf 1000000000000000001;
#define deb(x) cout << #x << ':' << x << '\n';

using namespace std;

void solve(){
	int i,j;
	int r,c;
	cin >> r >> c;
	vector<vector<int>> m(r,vector<int>(c));
	for (int i = 0; i < r; ++i)
	{
		for (int j = 0; j < c; ++j)
		{
			char t;cin >> t;
			m[i][j]=t;
		}
	}
	vector<vector<ll>> dp(r,vector<ll>(c,0));
	dp[0][0]=m[0][0]=='.'? 1: 0;
	for (int i = 0; i < r; ++i)
	{
		for (int j = 0; j < c; ++j)
		{
			if(m[i][j]=='#')continue;

			if(i>0 && j>0){
				dp[i][j]=dp[i][j-1]+dp[i-1][j];
			}
			else if(i>0){
				dp[i][j]=dp[i-1][j];
			}
			else if(j>0){
				dp[i][j]=dp[i][j-1];
			}
			dp[i][j]%=mod;
		}
	}

	printf("%lld\n",dp[r-1][c-1]);

	
}


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


Measured memory_bytes: 15088
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cfloat>
#include <bitset>
#include <map>
using namespace std;

#define INF (1<<30)

class Edge{
public:
int to, cost;
Edge(int to0, int cost0){
to = to0;
cost = cost0;
}
};

int main()
{
    for(;;){
        int r, m, cap;
        string src, dest;
        cin >> r >> m >> cap >> src >> dest;
        if(r == 0)
            return 0;

        int n = 2;
        map<string, int> index;
        index[src] = 0;
        index[dest] = 1;

        vector<vector<Edge> > edges(2);
        for(int i=0; i<r; ++i){
            string s1, s2;
            int d;
            cin >> s1 >> s2 >> d;
            int j = 0;
            int k = 0;
            if(index.find(s1) == index.end()){
                index.insert(make_pair(s1, n));
                ++ n;
                edges.resize(n);
            }
            if(index.find(s2) == index.end()){
                index.insert(make_pair(s2, n));
                ++ n;
                edges.resize(n);
            }
            j = index[s1];
            k = index[s2];
            edges[j].push_back(Edge(k, d));
            edges[k].push_back(Edge(j, d));
        }

        vector<bool> station(n);
        for(int i=0; i<m; ++i){
            string s;
            cin >> s;
            station[index[s]] = true;
        }

        vector<int > check(n, -1);
        multimap<int, pair<int, int> > mm;
        mm.insert(make_pair(0, make_pair(0, cap*10)));
        bool ng = true;
        while(!mm.empty()){
            int cost = mm.begin()->first;
            int curr = mm.begin()->second.first;
            int rest = mm.begin()->second.second;
            mm.erase(mm.begin());

            if(rest <= check[curr])
                continue;
            check[curr] = rest;

            if(curr == 1){
                cout << cost << endl;
                ng = false;
                break;
            }

            for(unsigned i=0; i<edges[curr].size(); ++i){
                int cost1 = cost + edges[curr][i].cost;
                int next = edges[curr][i].to;
                int rest1 = rest - edges[curr][i].cost;
                if(rest1 >= 0){
                    if(station[next])
                        rest1 = cap*10;
                    if(rest1 > check[next])
                        mm.insert(make_pair(cost1, make_pair(next, rest1)));
                }
            }
        }

        if(ng)
            cout << -1 << endl;
    }
}

Measured memory_bytes: 0
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class MainClass
{
	public const long Giri = 1000000007;

	
	public static void Main(string[] args)
	{
		string t = Console.ReadLine();
		for(int i = 0; i < t.Length; i++)
		{
			char c = t[i];
			if((i%2==0) && ( c == 'R' || c=='U' || c=='D'))
			{
			
			}
			else if((i%2==1) && ( c == 'L' || c=='U' || c=='D'))
			{
			
			}
			else
			{
				Console.WriteLine("No");
				return;
			}
		}
		Console.WriteLine("Yes");
		
	}
	
	public static long GCD(long a, long b)
	{
		if(b == 1)
			return a;
		long p = b / a;
		return GCD(a, b - a*p);
	}
	
	public static string[] Input()
	{
		return Console.ReadLine().Split(' ');
	}

	
	public static int Clamp(int val, int max, int min = 0)
	{
		return Math.Min(max, Math.Max(min, val));
	}

}



Measured memory_bytes: 13140
#include <iostream>
#include <string>
#include <math.h>
#include <vector>
#include<stdio.h>
#include <functional>
#include<algorithm>
#define PI 3.14159265
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n)  FOR(i,0,n)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
#define SZ(x) ((int)(x).size())

using namespace std;



int main() {
	int n;
	int in;
	vector <int> a;
	cin >> n;
	REP(i, n) {
		cin >> in;
		a.push_back(in);
	}
	sort(a.begin(),a.end());
	cout << a[n-1] - a[0] << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
	
typedef long long ll;
typedef unsigned long long ull;
typedef long double db;
	
#define MOD 1000000007
#define mi 18446744073709551615
#define ff first
#define ss second
#define pb push_back
#define vii vector<int>
#define pii pair<int,int>
#define vpii vector<pii>

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	int T=1;
	//cin>>T;
	while(T--)
	{
		string s,t;
		cin>>s>>t;
		int n=s.size(),m=t.size(),ans=1001;
		for(int i=0;i+m<=n;i++)
		{
			int d=0;
			for(int j=0;j<m;j++)
			{
				if(s[i+j]!=t[j])
					d++;
			}
			ans=min(ans,d);
		}
		cout<<ans;
	}  
	return 0;
}

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

const int mod = 1e9 + 7;

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

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

int power (int a, int k) {
	int ans = 1;
	while (k >= 1) {
		if (k & 1) ans = mul (ans, a);
		a = mul (a, a);
		k >>= 1;
	}
	return ans;
}

int inverse (int a) {
	return power (a, mod - 2);
}

int main() {
	int h, w, n;
	cin >> h >> w >> n;
	int x = max (h, w);
	cout << (n + x - 1) / x << endl;
	return 0;
}



Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
using namespace std;
int main()
{
    int i,a[10];
    for(i=0;i<10;i++)
    scanf("%d",&a[i]);
    sort(a,a+10);
    printf("%d\n%d\n%d\n",a[9],a[8],a[7]);
    return 0;
}

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

int main(){
    int n,w; cin >> n >> w;
    vector<vector<ll>> data(n,vector<ll>(2)), dp(n,vector<ll>(w+1,0));
    rep(i,n) rep(j,2)  cin >> data[i][j];
    rep(j,w+1) if(j>=data[0][0]) dp[0][j]=data[0][1];
    rep2(i,n) rep(j,w+1){
        if(j-data[i][0]>=0){
            dp[i][j]=max(dp[i-1][j],dp[i-1][j-data[i][0]]+data[i][1]);
        } else dp[i][j]=dp[i-1][j];
    }
    cout << dp[n-1][w] << endl;
}

Measured memory_bytes: 79488
n,m = map(int, input().split())
list_ab = []
for i in range(m):
    list_ab.append(list(map(int, input().split())))
list1 = []
listn = []
for i in range(m):
    if list_ab[i][0] == 1:
        list1.append(list_ab[i][1])
for i in range(m):
    if list_ab[i][1] == n:
        listn.append(list_ab[i][0])

listn.sort()
def binarySearch(list_a, key):
    left = 0
    right = len(list_a)
    while left < right:
        mid = (left + right) // 2
        if list_a[mid] == key:
            return mid
            break
        elif key < list_a[mid]:
            right = mid
        else:
            left = mid+1
    else:
        return "NOT_FOUND"
ans = "IMPOSSIBLE"
for i in range(len(list1)):
    if binarySearch(listn, list1[i]) != "NOT_FOUND":
        ans = "POSSIBLE"
        break

print(ans)


Measured memory_bytes: 51712
n,q = map(int,raw_input().split(" "))
task = [raw_input().split(" ") for i in range(n)]
c= 0
while task:
    name,time = task.pop(0)
    e = int(time) - q
    if e > 0:
        c+= q
        task.append([name,e])
    else:
        c+= int(time)
        print name+" "+str(c)




Measured memory_bytes: 17872
fun main(args: Array<String>) {
    val N = nextInt()
    val P = listOfInt()
    var t = 0
    P.forEachIndexed { index, value -> if (index != value - 1) t += 1 }
    println(if (t == 0 || t == 2) "YES" else "NO")
}
fun next() = readLine()!!
fun nextInt(delta: Int = 0) = Integer.parseInt(next()) + delta
fun listOfString() = next().split(" ")
fun listOfInt() = listOfString().map(String::toInt)

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

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

   const double EPS = (1e-7);
   const ll INF =(1e13);
   const double PI = (acos(-1));
   const ll MOD = ll(1e9) + 7;

   #define REP(i, n) for(ll i = 0; i < (ll)(n); i++)
   #define REPR(i, n) for(ll i = n; i > -1; i--)
   #define FOR(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++)
   #define ALL(x) (x).begin(),(x).end()
   #define SORT(x) sort((x).begin(), (x).end())
   #define REVERSE(x) reverse((x).begin(), (x).end())
   #define SZ(x) ((ll)(x).size())
   #define pb push_back
   #define mp make_pair

   //chmax(a, b): a>bならaをbで更新　更新したときにtrueを返す
   //chmin(a, b): a<bならaをbで更新　更新したときにtrueを返す
   template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
   template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

   #define dump(x) cerr<< #x << "= " << (x) << endl;

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

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

const ll MAX_N = 1000;
ll N, T, A;
ll H[MAX_N];

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

    cin >> N >> T >> A;
    REP(i, N){
        cin >> H[i];
    }
    double temp = (double)INF;
    ll ans = 0;
    REP(i, N){
        if (chmin(temp, abs(T - 0.006 * H[i] - A))) ans = i + 1;
    }
    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 256
enki = list(input())
maxcount = 0
count = 0
for i in range(len(enki)):
    if enki[i] != "A" and enki[i] != "C" and enki[i] != "G" and enki[i] != "T":
        if maxcount < count:
            maxcount = count
        count = 0
    else:
        count = count + 1
        if i == len(enki) - 1:
            if maxcount < count:
                maxcount = count

print(maxcount)

Measured memory_bytes: 3064