akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define rep(i,n) for (ll i = 0; i < (n); ++i)
#define vcout(v) rep(i,v.size()) cout << v[i] << " "; cout << endl
#define mcout(m) rep(j,m.size()){vcout(m[j]);}

void mainsolve(){

	ll n;
	cin >> n;
	vector<string> s(n);
	vector<ll> t(n);
	rep(i,n){
		cin >> s[i] >> t[i];
	}

	string ss;
	cin >> ss;

	ll start = 0;
	rep(i,n){
		if(ss == s[i]) start = i+1;
	}
	ll res = 0;
	rep(i,n){
		if(i >= start) res += t[i];
	}

	cout << res << endl;
	return;
}

int main(){
	
	//ll TC;cin>>TC;rep(I,TC){cout<<"case:"<<I+1<<"---"<<endl; // comment out!
		mainsolve();
	//} // comment out!
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
#define int long long
const int MAX = 2001;
const int MOD = 1000000007;
 
 



 
signed main(){
    int n,ok,ng,mid;
    cin>>n;
   int a[n];
   for(int i=0;i<n;i++)cin>>a[i];
   vector<int> k;
   k.push_back(a[0]);
   for(int i=1;i<n;i++){
       if(k[0]>=a[i]){
       ok =0;
       ng =k.size();
       while(abs(ok-ng)>1){
           mid =(ok+ng)/2;
           if(k[mid]>=a[i]){
               ok=mid;
           }else ng=mid;
       }
       if(ok>=k.size()-1)k.push_back(a[i]);
       else {
           k[ng]=a[i];
        ;}
       }else{
           k[0]=a[i];
       }
   }
   cout<<k.size();

    return 0;
}

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

#define CEIL(a,b) ((a) / (b) + ((a) % (b) == 0 ? 0 : 1))

using namespace std;
using ll = long long;
using pii = pair<int, int>;

constexpr int MOD = 1'000'000'007;
constexpr int INF = 1'000'000'001;
constexpr ll LLINF = 4'000'000'000'000'000'001;
// constexpr int INF = 2147483647; // 2 * 1e9
// constexpr ll LLINF = 9223372036854775807; // 9 * 1e18

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

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(10);
    int a, b;
    string s;
    cin >> a >> b;
    cout << (a < b ? 0 : 10) << "\n";
    return 0;
}

Measured memory_bytes: 256
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x = Integer.MAX_VALUE - 1;
		final String AMB= "ambiguous";
		final String NONE= "none";
		for (;;) {
			int N = sc.nextInt();
			if (N == 0)
				break;
			int[] a = new int[N];
			int[] b = new int[N];
			String ans = null;
			for (int i = 0; i < N; i++) {
				String s = sc.next();
				if (s.equals("x")) {
					a[i] = x;
				} else {
					a[i] = Integer.parseInt(s);
				}
				if (i >= 1 && a[i] == a[i - 1]) {
					ans = NONE;
				}
			}

			for (int i = 1; i < N; i++) {
				if (a[i] == x || a[i - 1] == x)
					continue;
				if (i % 2 == 0) {
					if (!(a[i - 1] > a[i])) {
						ans = NONE;
					}
				} else {
					if (!(a[i - 1] < a[i])) {
						ans = NONE;
					}
				}
			}

			if (ans != null) {
				System.out.println(ans);
				continue;
			}

			int max = Integer.MIN_VALUE;
			int min = Integer.MAX_VALUE;
			if (a[0] == x) {
				min = a[1] - 1;
			}

			if (a[a.length - 1] == x) {
				if ((a.length - 1) % 2 == 0) {
					min = a[a.length - 2] - 1;
				} else {
					max = a[a.length - 2] + 1;
				}
			}
			for (int i = 1; i < N - 1; i++) {
				if(a[i]!=x)continue;
				if (i % 2 == 0) {
					min = Math.min(min,Math.min(a[i - 1], a[i + 1]) - 1);
				} else {
					max= Math.max(max,Math.max(a[i - 1], a[i + 1]) + 1);
				}
			}
//			System.out.println(min +" "+max);
			if(max==Integer.MIN_VALUE || min == Integer.MAX_VALUE){
				System.out.println(AMB);
			} else if(max==min){
				System.out.println(max);
			} else if(max < min){
				System.out.println(AMB);
			} else {
				System.out.println(NONE);
			}
			
		}
	}

}

Measured memory_bytes: 46528
a, b, k = map(int, input().split())
l = list()
for i in range(a, a + k):
    if i <= b:
        l.append(i)
for i in range(b - k + 1, b + 1):
    if i >= a:
        l.append(i)
l = sorted(list(set(l)))
for i in range(len(l)):
    print(l[i])

Measured memory_bytes: 3060
/*
 * http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_8_C
 */
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

template <typename T_char>
T_char
ToLower(T_char c)
{
  return tolower(c);
}

int
main()
{
  ios::sync_with_stdio(false);

  vector<int> count(26);
  string line;
  while (getline(cin, line)) {
    transform(line.begin(), line.end(), line.begin(), ToLower<char>);
    for (string::iterator it = line.begin(); it != line.end(); it++) {
      count[*it - 'a']++;
    }
  }

  for (int i = 0; i < 26; i++) {
    cout << (char)('a' + i) << " : " << count[i] << endl;
  }

  return 0;
}

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

using namespace std;
int n;
long long int ar[200001];
long long int ans = LONG_MAX;
int main() {
    scanf("%d", &n);

    for (int i = 1; i <= n; i++) {
        scanf("%lld", &ar[i]);
        ar[i] += ar[i-1];
    }

    for (int i = 1; i < n; i++) {
        long int lsum = ar[i];
        long int rsum = ar[n] - lsum;
        if (abs(lsum-rsum) < ans)
            ans = abs(lsum-rsum);
    }
    printf("%lld\n", ans);

    //for (int i = 0; i <=n; i++)
    //    printf("%d ", ar[i]);


    return 0;
}

Measured memory_bytes: 1792
import java.util.*;

public class Main{
    static int[][] D;
    static int min = Integer.MAX_VALUE;
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        
        int N = sc.nextInt();
        int M = sc.nextInt();
        int R = sc.nextInt();
        int[] r = new int[R];
        for(int i = 0; i < R; i++)
            r[i] = sc.nextInt();
        String rr = "";
        for(int i = 0; i < R; i++){
            rr += (char)r[i];
        }
        D = new int[N][N];
        for(int i = 0; i < N; i++){
            for(int j = 0; j < N; j++){
                if(i != j)
                    D[i][j] = 1000000000;
            }
        }
        int[][] A = new int[3][M];
        for(int i = 0; i < M; i++){
            A[0][i] = sc.nextInt();
            A[1][i] = sc.nextInt();
            A[2][i] = sc.nextInt();
            D[A[0][i]-1][A[1][i]-1] = A[2][i];
            D[A[1][i]-1][A[0][i]-1] = A[2][i];
        }
        sc.close();
        for(int k = 0; k < N; k++){
            for(int i = 0; i < N; i++){
                for(int j = 0; j < N; j++){
                    D[i][j] = Math.min(D[i][j], D[i][k]+D[k][j]);
                }
            }
        }

        permutation(rr, "");
        System.out.println(min);
        
    }
    public static void permutation(String q, String ans){
        // Base Case
        if(q.length() <= 1) {
            String s = ans + q;
            int tmp = 0;
            for(int i = 0; i < s.length()-1; i++){
                tmp += D[(int)s.charAt(i)-1][(int)s.charAt(i+1)-1];
            }
            min = Math.min(min, tmp); 
        }
        // General Case
        else {
            for (int i = 0; i < q.length(); i++) {
                permutation(q.substring(0, i) + q.substring(i + 1),
                        ans + q.charAt(i));
            }
        }
    }
}

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

#solve
def solve():
    k = II()
    a = LI()
    if a[-1] == 2:
        tmp = [2, 3]
        for ai in a[::-1]:
            tmp0, tmp1 = tmp
            if tmp1 // ai > (tmp0 - 1) // ai:
                tmp = [((tmp0 - 1) // ai + 1) * ai, (tmp1 // ai+1) * ai  - 1]
            else:
                print(-1)
                return
        print(*tmp)
    else:
        print(-1)

    return


#main
if __name__ == '__main__':
    solve()


Measured memory_bytes: 60144
implicit none
integer(16) N
read*,N
print"(i0)",dfs(.false.,.false.,.false.,0_16)

contains

recursive function dfs(a,b,c,num)result(res)
  implicit none
  logical,intent(in)::a,b,c
  integer(16),intent(in)::num
  integer::res
  res=0
  if(num<=N)then
    if(a.and.b.and.c)res=1
    res = res + dfs(.true., b, c, num*10 + 7)
    res = res + dfs( a,.true., c, num*10 + 5)
    res = res + dfs( a, b,.true., num*10 + 3)
  endif
  return
end function
end

Measured memory_bytes: 256
from sys import stdin

score = [
    0, # Taro
    0  # Hanako
]

n = int(stdin.readline().rstrip())
for i in range(n):
    card_pair = stdin.readline().rstrip().split()
    if card_pair[0] > card_pair[1]:
        score[0] += 3
    elif card_pair[0] < card_pair[1]:
        score[1] += 3
    else:
        score[0] += 1
        score[1] += 1

print(*score)


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

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            string S = Console.ReadLine();

            if (S == "Sunny") Console.WriteLine("Cloudy");
            if (S == "Cloudy") Console.WriteLine("Rainy");
            if (S == "Rainy") Console.WriteLine("Sunny");


        }
    }
}


Measured memory_bytes: 11092
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/adaptor/indexed.hpp>

using namespace std;
using namespace boost::adaptors;
using namespace std::string_literals;
using ll = int64_t;
using vecint = vector<int>;
using vecll = vector<ll>;
using boost::irange;

int main()
{
  string s;
  cin>>s;
  int n=s.size();
  ll ans = 0;
  for(int i:irange(0,1<<(n-1))) {
    ll sum = 0;
    ll cur = s[0] - '0';
    for(int j:irange(0,n-1)) {
      if((i>>j)&1) {
        sum += cur;
        cur = 0;
      } else {
        cur *= 10;
      }
      cur += s[j+1] - '0';
    }
    sum += cur;
    ans += sum;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
int main()
{
	int m,n;
	std::cin >> n >> m;
	int a[200][200]={0};
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<m;j++)
		{
			std::cin >> a[i][j];
		}
	}
		for(int j=0;j<m;j++)
	{
		a[n][j] = 0;
		for(int i=0;i<n;i++)
		{
			a[n][j] += a[i][j];
		}
	}
	
	for(int i=0;i<n+1;i++)
	{
		a[i][m] = 0;
		for(int j=0;j<m;j++)
		{
			a[i][m] += a[i][j];
		}
	}
		for (int i=0; i< n+1; i++)
		{
			for ( int j=0; j < m+1 ; j++)
	{
			if ( j < m )
		{
		std::cout << a[i][j] << " ";
		}
		else
		{
		std::cout << a[i][j];
		}
	}
		std::cout << "\n";
		}
	return 0;
}


Measured memory_bytes: 3292
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<set>
#include<regex>
using namespace std;

int main() {
	string s;
	cin >> s;
	
	s = regex_replace(s, regex("BC"), "D"); // BC -> D　に書き換え

	long long ans = 0;
	int a = 0;

	for (auto x : s) {
		if (x == 'A') ++a;
		else if (x == 'D') ans += a;
		else a = 0;
	}
	
	cout << ans << endl;
}

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

struct F {
	long long a, b;
	F() {}
	F(long long _a, long long _b) : a(_a), b(_b) {}
	F operator + (const F &f) {
		long long x = a * f.a, y = b * f.a + a * f.b;
		long long g = __gcd(x, y);
		return F(x / g, y / g);
	}
	F operator - (const F &f) {
		long long x = a * f.a, y = b * f.a - a * f.b;
		long long g = __gcd(x, y);
		return F(x / g, y / g);
	}
	F operator * (const F &f) {
		long long x = a * f.a, y = b * f.b;
		long long g = __gcd(x, y);
		return F(x / g, y / g);
	}
	F operator / (const F &f) {
		long long x = a * f.b, y = b * f.a;
		long long g = __gcd(x, y);
		return F(x / g, y / g);
	}
};
const double pi = acos(-1);
const double eps = 1e-8;
inline int sign(double a) {
	return a < -eps ? -1 : a > eps;
}
inline int cmp(double a, double b) {
	return sign(a - b);
}
double add(double a, double b) {
	if (abs(a + b) < eps * (abs(a) + abs(b))) return 0;
	return a + b;
}
typedef long long data;
struct P {
	data x, y;
	P() {}
	P(data x, data y) : x(x), y(y) {}
	P operator + (const P &p) { return P(x + p.x, y + p.y); }
	P operator - (const P &p) { return P(x - p.x, y - p.y); }
	P operator * (data d) { return P(x * d, y * d); }
	P operator / (data d) { return P(x / d, y / d); }
	data dot(const P &p) { return x * p.x + y * p.y; }
	data det(const P &p) { return x * p.y - y * p.x; }
	data disto(const P &p) { return (*this - p).abs(); }
	data alpha() { return atan2(y, x); }
	data abs() { return sqrt(abs2()); }
	data abs2() { return x * x + y * y; }
	P rot90() { P(-y, x); }
	P unit() { return *this / abs(); }
	bool operator < (P p) const {
		int c = cmp(x, p.x);
		if (c) return c == -1;
		return cmp(y, p.y) == -1;
	}
	friend istream& operator>>(istream &in, P &p) {
		in >> p.x >> p.y;
		return in;
	}
	friend ostream& operator<<(ostream& out, P &p) {
		out << p.x << ' ' << p.y;
		return out;
	}
};
P projection(P p1, P p2, P q) {
	P dir = p2 - p1;
	return p1 + dir * (dir.dot(q - p1) / dir.abs2());
}
P reflection(P p1, P p2, P q) {
	return projection(p1, p2, q) * 2 - q;
}
bool on_seg(P p1, P p2, P q) {
	return (p1 - q).det(p2 - q) == 0 && (p1 - q).dot(p2 - q) <= 0;
}
P intersection(P p1, P p2, P q1, P q2) {
	return p1 + (p2 - p1) * ((q2 - q1).det(q1 - p1) / (q2 - q1).det(p2 - p1));
}

int main() {
#ifdef LOCAL_DEFINE
	//freopen("data.in", "rt", stdin);
	//freopen("data.out", "w", stdout);
	auto _start = chrono::high_resolution_clock::now();
#endif

	ios::sync_with_stdio(false);
	cin.tie(0);
	cout << fixed << setprecision(15);
	int q;
	cin >> q;
	while (q--) {
		P p0, p1, p2, p3;
		cin >> p0 >> p1 >> p2 >> p3;
		if((p0 - p1).det(p2 - p3) == 0) {
			cout << "2\n";
		} else if((p0 - p1).dot(p2 - p3) == 0) {
			cout << "1\n";
		} else {
			cout << "0\n";
		}
	}

#ifdef LOCAL_DEFINE
	auto _end = chrono::high_resolution_clock::now();
	cerr << "elapsed time: " << chrono::duration<double, milli>(_end - _start).count() << " ms\n";
#endif
	return 0;
}


Measured memory_bytes: 3220
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int a = scan.nextInt();
		if (a < 1000) {
			System.out.println("ABC");
		} else {
			System.out.println("ABD");
		}
	}
}


Measured memory_bytes: 21844
#include <algorithm>
#include <functional>
#include <iostream>
#include <iomanip>
#include <vector>
#include <map>
#include <set>
#include <unordered_set>
#include <queue>
#include <numeric>
#include <bitset>
#include <cmath>

using namespace std;
using ll = long long;
// const ll mod =  998244353 ;
const ll mod =  1000000007 ;
const ll inf = 1e18;

#define REP(i, n) for (ll i = 0; i < (n); ++i)
#define REP_FROM(i, j, n) for (ll i = (j); i < (n); ++i)
#define all(x) (x).begin(),(x).end()
#define sz(x) int(x.size())

template<typename T> void print_vec(vector<T> a) {int n = a.size();REP(i, n) {cout >> a[i]; if(i!=n-1) cout << " "; else cout << endl;}}
ll power(ll base, ll exponent){ if(exponent % 2){ return power(base, exponent - 1) * base % mod; }else if(exponent){ ll root_ans = power(base, exponent / 2); return root_ans * root_ans % mod; }else{ return 1; }}
ll inverse(ll x){ return power(x, mod - 2);}
ll gcd(ll a, ll b) {if(a < b) gcd(b, a);ll r;while(r=a%b) {a=b;b=r;}return b;}
template<typename T> ll sum(T begin, T end) {return accumulate(begin, end, 0ll);}
struct combination{ vector<ll> fact, inv; combination(int sz) : fact(sz + 1), inv(sz + 1){ fact[0] = 1; for(int i = 1; i <= sz; i++){ fact[i] = fact[i - 1] * i % mod; } inv[sz] = power(fact[sz], mod - 2); for(int i = sz - 1; i >= 0; i--){ inv[i] = inv[i + 1] * (i + 1) % mod; } } ll C(int p, int q) const{ if(q < 0 || p < q) return 0; return (fact[p] * inv[q] % mod * inv[p - q] % mod); } };

struct Node {
  int a;
  int b;
  Node *child;
  Node(int _a, int _b) : a(_a), b(_b) {
    child = nullptr;
  }
  Node(int _a, int _b, Node *_child) : a(_a), b(_b), child(_child) {
  }
};

map<ll, ll> factorize(ll m) {
  map<ll, ll> ret;
  for (ll i = 2; i*i<=m; i++) {
    while(m % i == 0) {
      ret[i]++;
      m /= i;
    }
  }
  if(m != 1) {
    ret[m]++;
  }
  return ret;
}
signed main() {
  ios::sync_with_stdio(false);
  ll a, b;
  cin >> a >> b;
  ll d = gcd(a, b);
  
  
  cout << factorize(d).size() + 1 << endl;
  return 0;
}

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

const int mod = 1000000007;

int N;
string s;

long long dp[3009][3009];

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

    for(int j = 0; j < N; j++)
        dp[0][j] = 1;

    for(int i = 0; i < N - 1; i++) {
        // 累積和
        int sum[3009];
        sum[0] = 0;
        for(int j = 0; j < N - i; j++)
            if((sum[j + 1] = sum[j] + dp[i][j]) >= mod) sum[j + 1] -= mod;

        if(s[i] == '<') {
            for(int j = 0; j < N - i; j++)
                if((dp[i + 1][j] = sum[N - i] - sum[j + 1]) < 0)
                    dp[i + 1][j] += mod;
        }
        if(s[i] == '>') {
            for(int j = 0; j < N - i; j++)
                dp[i + 1][j] = sum[j + 1];
        }
    }

    cout << dp[N - 1][0] << endl;

    return 0;
}

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

using namespace std;

int N;
int d[100001];

int main(){
    int dd;
    cin >> N;
    for(int i=0;i<100001;i++) d[i] = 0;
    for(int i=0;i<N;i++){
        cin >> dd;
        d[dd]++;
    }
    vector<int> v,w;
    for(int i=0;i<100001;i++){
        if(d[i] != 0){
            v.push_back(i);
            w.push_back(d[i]);
        }
    }
    int s=-1,e=v.size();
    if(e==1){
        cout << 0 << endl;
        return 0;
    }
    int r=0,l=0;
    while(s+1 != e){
        if(l <= r){
            l += w[++s];
        }else{
            r += w[--e];
        }
    }
    if(l != r){
        cout << 0 << endl;
        return 0;
    }
     cout << v[e]-v[s] << endl;
    
    return 0;
}

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

#define endl "\n"
#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 all(c) c.begin(),c.end()
#define mp(x,y) make_pair(x,y) 
#define mem(a,val) memset(a,val,sizeof(a))
#define f first
#define s second

ll ncr(ll n,ll r){
	if(r==0){
		return 1;
	}
	else if( r==1){
		return n;
	}
	else if( r==2){
		return n*(n-1)/2;
	}
	else if( r==3){
		return n*(n-1)*(n-2)/6;
	}
}
 
int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);

	string s;
	cin>>s;
	ll k;
	cin>>k;
	ll n = s.size();
	ll ans=0;
	ll i;

	if(n<k){
		cout<<0;
		return 0;
	}
	for (i = 0; i < n && k; ++i)
	{
		if(s[i]!='0'){
			ans += pow(9,k)*ncr(n-i-1,k);
			if(s[i]-'0' - 1)
				ans += (s[i]-'0' - 1)*pow(9,k-1)*ncr(n-i-1,k-1);
		k--;
		}
	}
	if(n-i>0 || s[n-1]!='0') ans++;
	cout<<ans;


	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<string>
#include<set>
#include<map>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<algorithm>
#include<functional>
using namespace std;
#define LL unsigned long long
#define MOD 1000000007
#define inf 1999999999
#define PI 3.14159265358979



int main() {
	double a, b, x;
	cin >> a >> b >> x;
	double area = (double)x / (double)a;
	if (a*a*b / 2.0>x)cout << setprecision(20) << atan2(b, area*2.0 / b) / PI * 180.0 << endl;
	else {
		area = a * b - area;
		cout << setprecision(20) << 90.0 - (atan2(a, area*2.0 / a) / PI * 180.0) << endl;
	}
		return 0;
}


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

int main() {
  int N,K;
  cin>>N>>K;
  vector<int> p(N);
  for(int i=0;i<N;i++){
    cin>>p[i];
  }
  for(int i=K;i<N;i++){
    if(p[i-K]<p[i]){
      cout<<"Yes"<<endl;
    }
    else{
      cout<<"No"<<endl;
    }
  }
}



Measured memory_bytes: 4044
// ITP1_11_A Dice 1
import java.io.*;

public class Main {
   public static void main(String[] args) {
      BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
      Dice dice;

      try {
         String[] input = br.readLine().split(" ");
         int[] roll = new int[input.length];
         for (int i = 0; i < input.length; i++)
            roll[i] = Integer.parseInt(input[i]);
         dice = new Dice(roll[0], roll[1], roll[2], roll[3], roll[4], roll[5]);

         String instruction = br.readLine();
         for (int i = 0; i < instruction.length(); i++) {
            if (instruction.charAt(i) == 'N')
               dice.north();
            if (instruction.charAt(i) == 'E')
               dice.east();
            if (instruction.charAt(i) == 'W')
               dice.west();
            if (instruction.charAt(i) == 'S')
               dice.south();
         }

         System.out.println(dice.TOP);
      }

      catch (Exception e) {
         e.printStackTrace();
      }                      
   }
}

class Dice {
   static int TOP;
   static int FRONT; 
   static int RIGHT;
   static int LEFT;
   static int BACK;
   static int BOTTOM;
   static int work;

   public Dice(int top, int front, int right, int left, int back, int bottom) {
      this.TOP = top;
      this.LEFT = left;
      this.BACK = back;
      this.FRONT = front;
      this.RIGHT = right;
      this.BOTTOM = bottom;
   }

   static void north() {
      work = TOP;
      TOP = FRONT;
      FRONT = BOTTOM;
      BOTTOM = BACK;
      BACK = work;
   }
   static void east() {
      work = TOP;
      TOP = LEFT;
      LEFT = BOTTOM;
      BOTTOM = RIGHT;
      RIGHT = work;
   }
   static void west() {
      work = TOP;
      TOP = RIGHT;
      RIGHT = BOTTOM;
      BOTTOM = LEFT;
      LEFT = work;
   }
   static void south() {
      work = TOP;
      TOP = BACK;
      BACK = BOTTOM;
      BOTTOM = FRONT;
      FRONT = work;
   }
}

Measured memory_bytes: 17012
import java.util.*;

class Main{
  static Scanner sc = new Scanner(System.in);
  public static void main(String args[]){
    int h = sc.nextInt();
    int w = sc.nextInt();
    for(int i=0;i<=w;i++){
      System.out.print("#");
    }
    System.out.println("#");
    for(int i=0;i<h;i++){
      System.out.println("#"+sc.next()+"#");
    }
    for(int i=0;i<=w;i++){
      System.out.print("#");
    }
    System.out.println("#");
  }
}

Measured memory_bytes: 21712
#include <algorithm>
#include <cstring>
#include <deque>
#include <fstream>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
using ll = long long;
#define fst first
#define snd second

/* clang-format off */
template <class T, size_t D> struct _vec { using type = vector<typename _vec<T, D - 1>::type>; };
template <class T> struct _vec<T, 0> { using type = T; };
template <class T, size_t D> using vec = typename _vec<T, D>::type;
template <class T> vector<T> make_v(size_t size, const T& init) { return vector<T>(size, init); }
template <class... Ts> auto make_v(size_t size, Ts... rest) { return vector<decltype(make_v(rest...))>(size, make_v(rest...)); }
/* clang-format on */

const ll MOD = 998244353ll;

ll power(ll x, ll e) {
  ll v = 1;
  for (; e > 0; e >>= 1) {
    if (e & 1) {
      v = v * x % MOD;
    }
    x = x * x % MOD;
  }
  return v;
}

ll inverse(ll x) { return power(x, MOD - 2); }

vector<ll> fact, factInv;
void initFact(int N) {
  fact.resize(N + 1);
  factInv.resize(N + 1);
  fact[0] = 1;
  for (int i = 1; i <= N; i++) {
    fact[i] = fact[i - 1] * i % MOD;
  }
  factInv[N] = inverse(fact[N]);
  for (int i = N - 1; i >= 0; i--) {
    factInv[i] = factInv[i + 1] * (i + 1) % MOD;
  }
}

ll choose(int n, int k) {
  if (k > n) {
    return 0;
  } else {
    return fact[n] * factInv[k] % MOD * factInv[n - k] % MOD;
  }
}

ll multiChoose(int n, int k) {
  if (n == 0 && k == 0) {
    return 1;
  } else {
    return choose(n + k - 1, k);
  }
}

vector<ll> pw2;
vec<ll, 2> tbl;

ll solve(int K, int N, int S) {
  int pairs = 0;
  for (int i = 1; i < S - i; i++) {
    int j = S - i;
    if (j <= K) {
      ++pairs;
    }
  }
  int eq = S % 2 == 0 ? 1 : 0;
  int frees = K - pairs * 2 - eq;
  ll res = 0;
  for (int ox = 0; ox <= pairs; ox++) {
    int rem = N - ox;
    if (rem < 0) continue;
    int num = ox + frees;
    if (!eq) {
      res += choose(pairs, ox) * pw2[ox] % MOD * tbl[rem][num] % MOD;
      res %= MOD;
    } else {
      ll pairWays = choose(pairs, ox) * pw2[ox] % MOD;
      // 使わない
      res += pairWays * tbl[rem][num] % MOD;
      res %= MOD;
      // 使う
      if (rem > 0) {
        res += pairWays * tbl[rem - 1][num] % MOD;
        res %= MOD;
      }
    }
  }
  return res;
}

int main() {
  int K, N;
  while (cin >> K >> N) {
    initFact(3000);
    tbl = make_v(3000, 3000, 0ll);
    for (int j = 0; j < 3000; j++) tbl[0][j] = 1;
    for (int i = 1; i < 3000; i++) {
      for (int j = 1; j < 3000; j++) {
        tbl[i][j] = (tbl[i - 1][j] + tbl[i][j - 1]) % MOD;
      }
    }
    pw2.resize(3000);
    pw2[0] = 1;
    for (int i = 1; i < 3000; i++) pw2[i] = pw2[i - 1] * 2 % MOD;
    for (int i = 2; i <= 2 * K; i++) {
      cout << solve(K, N, i) << endl;
    }
  }
  return 0;
}


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

#define ll long long
#define pb push_back

#define rep(i,n) for(ll i=0;i<n;i++)
#define rrep(i,n) for(ll i=n-1;i>=0;i--)

void solve()
{
    int x,y;
    cin >> x >>y;
    int temp=x*2;
    int temp2=x*4;

    if(y>=temp && y<=temp2)
    {
        if(y%2==0)
            cout << "Yes" << "\n";
        else
            cout << "No" << "\n";
    }
    else
        cout << "No" << "\n";
}

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

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


Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
int main(){
  vector<int> n(3);
  cin >> n[0] >> n[2] >> n[1];
  sort(n.begin(), n.end());
  cout << n[0] << " " << n[1] << " " << n[2] << endl;
  return 0;
}


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

int main() {
    int64_t n, k; cin >> n >> k;
    int64_t ans = min(n%k,k-n%k);
    cout << ans << endl;
}


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

    int c=0,z;
    string n;
    cin>>n;
    z=n.size();
    for(int i=0;i<z;i++)
    {
        c=c+int(n[i]-'0');
    }
    if(c%9==0)
        cout<<"Yes";
    else
        cout<<"No";
    return 0;
}



Measured memory_bytes: 3744
//Love and Freedom.
#include<cmath>
#include<cstdio>
#include<cstring>
#include<algorithm>
#define ll long long
#define inf 20021225
#define id(x) (x>n?x-n:x)
#define N 400100
using namespace std;
int read()
{
	int s=0,f=1; char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-') f=-1; ch=getchar();}
	while(ch>='0'&&ch<='9') s=s*10+ch-'0',ch=getchar();
	return f*s;
}
void e(int x,int y){printf("%d %d\n",x,y==2?3:y);} 
int main()
{
	int n=read();// int lg=log(n)/log(2.0);
	if((n&-n)==n)	return puts("No"),0;
	puts("Yes");
	printf("1 2\n2 3\n3 %d\n%d %d\n%d %d\n",n+1,n+1,n+2,n+2,n+3);
	int top=n-1;
	for(int i=4;i<=top;i+=2)	e(i,1),e(i+1,i),e(n+i+1,1),e(n+i,n+i+1);
	if(!(n&1))
	{
		int x=n+1;
		for(int i=1;i<=20;i++)
			if(x&(1<<i))
			{
				int X=1<<i,Y=x-X;
				e(X,n),e(Y+n,n<<1);
				return 0;
			}
	}
	return 0;
}

Measured memory_bytes: 2304
#include <bits/stdc++.h>
using namespace std;
long long a[200013],n,ans,j,h;
int main()
{
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
	}
	for(int i=0;i<n;i++)
	{
		for(j;j<n;j++)
		{
			if((h xor a[j])!=h+a[j])break;else h=h+a[j],
			ans=ans+j-i+1;
		}
		h-=a[i];
	}
	cout<<ans;
}

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

#define rep(x,to) for(int x=0;x<to;x++)
#define rep2(x,from,to) for(x=from;x<to;x++)

using namespace std;


int main(void){

vector< int > su(5);

	rep(i,5) cin >> su[i];
	sort(su.begin(), su.end(), greater<int>());
	rep(i,5) cout << su[i] << (i<4 ? " ":"\n");

	
	return 0;
}

Measured memory_bytes: 1212
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <climits>

using namespace std;

//dp[i][j] = [i,j]をすべてまとめるときの最小コスト
int dp[128][100];

int solve(const vector<pair<int,int> > &v, int left, int right) {
    int &res = dp[left][right];
    if(res < INT_MAX) return res;
    for(int split = left; split < right; ++split) {
        const int lcost = solve(v, left, split);
        const int rcost = solve(v, split+1, right);
        const int cost = v[left].first*v[split].second * v[split+1].first*v[right].second;
        res = min(res, lcost+rcost+cost);
    }
    return res;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    int N;
    cin >> N;
    vector<pair<int,int> > v(N);
    for(int i = 0; i < N; ++i) {
        cin >> v[i].first >> v[i].second;
    }
    for(int i = 0; i < N; ++i) {
        for(int j = 0; j < N; ++j) {
            if(i == j) dp[i][j] = 0;
            else dp[i][j] = INT_MAX;
        }
    }
    cout << solve(v, 0, N-1) << endl;
    return 0;
}

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

using namespace std;

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

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void __print(vector<bool> x){cerr<<"{";int f=x.size();for(auto i:x){cerr<<i;(--f !=0)?cerr<<",":cerr<<"";}cerr<<"}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
//void __print(vector<bool> x) {int f = 0; cerr << '{'; for (auto i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
//void _print() {cerr << "]\n";}

#ifndef ONLINE_JUDGE
#define ANTHRO(x...) cerr << "[" << #x << "] = [", _print(x)
#else
#define ANTHRO(x...)
#endif

template<typename... T>
void read(T&... args) {
	((cin >> args), ...);
}

template<typename... T>
void writ(T&&... args) {
	((cout << args << " "), ...);
}
#define ll long long
#define MOD 1000000007
#define INF (ll)1e18
#define EPS 1e-9
/*
	XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    No, nothing good starts in a getaway car
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
*/
#define PB push_back
ll n,m,q,l=-INF;
vector<ll> a,b,c,d;
void vecs(vector<ll> &v){
	if(v.size()==n){
		ll an=0;
		for(ll i=0;i<q;i++){
			if(v[b[i]]-v[a[i]]==c[i]) an+=d[i];
		}
		l=max(l,an);
		return;
	}
	ll s=1;
	if(v.size()) s=v.back();
	for(ll i=s;i<=m;i++){
		v.push_back(i);
		vecs(v);
		v.pop_back();
	}
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    read(n,m,q);
    ll ai,bi,ci,di;
    for(ll i=0;i<q;i++){
		read(ai,bi,ci,di);
		a.PB(ai);
		b.PB(bi);
		c.PB(ci);
		d.PB(di);
		a[i]--; b[i]--;
		//ANTHRO(a[i],b[i]);
	}
	vector<ll> v;
	vecs(v);
    writ(l);
    return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define repi(i,m,n) for(int i = m;i < n;i++)
#define drep(i,n,m) for(int i = n;i >= m;i--)
#define rep(i,n)repi(i,0,n)
#define rrep(i,n) repi(i,1,n+1)
typedef pair<int,int> P;
typedef pair<int, P> PP;
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(), v.rend()
#define fi first
#define se second
const int inf = 1e9+7;
int mod = 1e9+7;

int a[10000], b[10000][300], segn = 1;
P seg[20000];
/*-----------SegmentTree--------------*/
void init(int n){
	while(segn < n)segn *= 2;
	rep(i,2*n)seg[i] = P(0, 0);
}
void add(int k, int x){
	k += segn-1;
	seg[k] = P(x, k-(segn-1));
	while(k > 0){
		k = (k-1)/2;
		seg[k] = max(seg[k*2+1], seg[k*2+2]);
	}
}
P get(int a, int b, int k, int l, int r){
	if(b <= l || r <= a)return P(0, 0);
	if(a <= l && r <= b)return seg[k];
	P vl = get(a, b, k*2+1, l, (l+r)/2);
	P vr = get(a, b, k*2+2, (l+r)/2, r);
	return max(vl, vr);
}
/*-------------------------------------*/

int has[6000][6000];
void rui(int Y1, int Y2, int X1, int X2, int x){
	has[Y1][X1] += x;has[Y1][X2+1] -= x;
	has[Y2+1][X1] -= x;has[Y2+1][X2+1] += x;
}

void dfs(int l, int r, int k){
	if(l >= r)return ;
	P p = get(l, r, 0, 0, segn);
	rui(l+1, p.se+1, p.se+1, r, p.fi);
	dfs(l, p.se, k);
	dfs(p.se+1, r, k);
}

signed main(){
	int n, m;
	scanf("%lld%lld", &n, &m);
	repi(i,2,n+1)scanf("%lld", &a[i]);
	rrep(i,n)rrep(j,m)scanf("%lld", &b[i][j]);
	
	rrep(j,m){
		init(n);
		rrep(i,n)add(i-1, b[i][j]);
		dfs(0, n, j);
	}
	
	rrep(i,n)rrep(j,n)has[i][j] += has[i][j-1];
	rrep(i,n)rrep(j,n)has[i][j] += has[i-1][j];
	
	int ans = 0;
	rrep(i,n)a[i] += a[i-1];
	rrep(i,n)rrep(j,n){
		if(i > j)continue;
		int d = a[j]-a[i];
		ans = max(ans, has[i][j]-d);
	}
	printf("%lld\n", ans);
	return 0;
}


Measured memory_bytes: 249984
#include <stdio.h>
int main(void)
{
	int a;
	int b;
	int c;
	int d;
	int ab;
	int bc;
	int ac;
	int count= 0;
	scanf("%d", &a);
	scanf("%d", &b);
	scanf("%d", &c);
	scanf("%d", &d);
	ab = a - b;
	bc = b - c;
	ac = a - c;

	if (ab < 0){
		ab *= -1;
	}
	ab = a - b;
	if (bc < 0){
		bc *= -1;
	}
	if (ac < 0){
		ac *= -1;
	}
	
	if((ab <= d) && (bc <= d)){
		count++;
	}
	else if(ac <= d){
		count++;
	}
	if (count){
		printf("Yes\n");
	}
	else{
		printf("No\n");
	}
	return 0;
}
		
	 

Measured memory_bytes: 128
#include<iostream>
#include<map>
#include<vector>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<numeric>
#include<climits>
#include<ctime>
#include<cstring>
#include<sstream>
#define REP(i,p,n) for(int i=p;i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)
#define rep_split(tok,a_str,re) for(char *tok = strtok((char *)a_str.c_str(),re); tok != NULL; tok = strtok(NULL,re))
#define ALL(c) (c).begin(), (c).end()
#define dump(a) cerr << #a << "=" << (a) << endl
#define DUMP(list) cout << "{ "; for(auto nth : list){ cout << nth << " "; } cout << "}" << endl;
template<class T> void chmin(T &t, T f) { if (t > f) t = f; } //t=min
template<class T> void chmax(T &t, T f) { if (t < f) t = f; } //t=max
using namespace std;

int main() {
	int N = 0;
	int cnt=0;
	string a_str;
	string ashi_str[4] = {"lu","ru","ld","rd"};

	while(cin >> N) {
		bool is_up = false;
		vector<bool> ashi(2,false);
		cnt = 0;
		if (N == 0) { break; }
		rep(i,N) {
			cin >> a_str;
			if (a_str == ashi_str[0]) {
				ashi[0]=true; //left up
			}
			else if (a_str == ashi_str[1]) {
				ashi[1]=true; //right up
			}
			else if (a_str == ashi_str[2]) {
				ashi[0]=false; //left down
			}
			else if (a_str == ashi_str[3]) {
				ashi[1]=false; //right down
			}
			if (ashi[0]==true && ashi[1]==true && is_up==false) {
				is_up = true;
				cnt++;
			}
			if (ashi[0]==false && ashi[1]==false && is_up==true) {
				is_up = false;
				cnt++;
			}
			//cout << "D " << cnt << endl; 
		}
		cout << cnt << endl;
	}

	return 0;
}

Measured memory_bytes: 1220
#include<stdio.h>

int main() {
  int H, W, i, j;

  while (1) {
    scanf("%d %d", &H, &W);

    if (H == 0 && W == 0) {
      return 0;
    }
    
    for (i = 0; i < H; i++) {
      for (j = 0; j < W; j++) {
        if (i == 0 || i == H - 1 || j == 0 || j == W - 1) {
          printf ("#");
        } else {
          printf (".");
        }
      }
      printf ("\n");
    }
    printf ("\n");
  }
  return 0;
}


Measured memory_bytes: 2024
#include <bits/stdc++.h>
#include <vector>
#include <queue>
#include <iomanip>
#include <string>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;
const ll INF = 101010101000;
ll n, a, b;

int main(){
  ll ans;
  cin >> n >> a >> b;
  if((b-a)%2==0){
    ans = (b-a)/2;
    cout << ans << endl;
    return 0;
  }
  ans = min(n+(1-b-a)/2,(a+b-1)/2);
  cout << ans << endl;
}

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

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define FORD(i,b,a) for (int i = (int)(b) - 1; i >= a; --i)
#define REP(i,N) FOR(i,0,N)
#define st first
#define nd second
#define pb push_back

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

int A[222222];

int main() {
    int N;
    scanf("%d", &N);
    REP(i,N) scanf("%d", &A[i]);
    if (N == 1) {
      printf("YES\n");
      return 0;
    }
    LL sum = 0;
    REP(i,N) sum += A[i];
    LL one = N*(LL)(N+1)/2;
    if (sum % one) { printf("NO\n"); return 0; }
    LL cnt = sum / one;
    LL jumps = 0;
    REP(i,N) {
      LL after_diff = A[(i+1)%N] - A[i] - cnt;
      if (after_diff > 0 || after_diff % N) { printf("NO\n"); return 0; }
      jumps += -after_diff / N;
    }
    if (jumps == cnt) {
      printf("YES\n");
    } else {
      printf("NO\n");
    }
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
int main () {
  int H, W, D;
  cin >> H >> W >> D;
  vector<vector<long>> data(H * W, vector<long>(2));
  int a;
  for(int i = 0; i < H; i++){
    for(int j = 0; j < W; j++) {
      cin >> a;
      a--;
      data.at(a).at(0) = i + 1;
      data.at(a).at(1) = j + 1;
    }
  }
  vector<long> sub(H * W);
  for(int i = D; i < sub.size(); i++){
    sub.at(i) = abs(data.at(i).at(0) - data.at(i - D).at(0)) + abs(data.at(i).at(1) - data.at(i - D).at(1)) + sub.at(i - D);
  }
  long ans = 0, l, r, Q;
  cin >> Q;
  for(int i = 0; i < Q; i++){
    cin >> l >> r;
    ans = 0;
    l--;
    r--;
    cout << sub.at(r) - sub.at(l) << endl;
  }
  return 0;
}


Measured memory_bytes: 6784
line1 = input().split(" ")
line2 = input().split(" ")
line3 = input().split(" ")

result1 = []
result2 = []
result3 = []

for i in range(3):
  result1.append("0")
  result2.append("0")
  result3.append("0")

call_sum = int(input())

for j in range(call_sum):
  call_num = int(input())
  for i in range(3):
    if call_num == int(line1[i]):
      result1[i] = "1"
      break
    if call_num == int(line2[i]):
      result2[i] = "1"
      break
    if call_num == int(line3[i]):
      result3[i] = "1"
      break
while(1):
  if result1[0] == result1[1] == result1[2] == "1" or result2[0] == result2[1] == result2[2] == "1" or result3[0] == result3[1] == result3[2] == "1":
    print("Yes")
    break
  elif result1[0] == result2[1] == result3[2] == "1" or result1[2] == result2[1] == result3[0] == "1":
    print("Yes")
    break
  for j in range(3):
    end_flg = False
    if result1[j] == result2[j] == result3[j] == "1":
      print("Yes")
      end_flg = True
      break
  if end_flg:
    break
  print("No")
  break


Measured memory_bytes: 3064
import Data.List

test [] = "YES"
test str@('m':sx) = if isPrefixOf "maerd" str
                    then test $ drop 5 str
                    else "NO"
test str@('r':sx) = if isPrefixOf "remaerd" str
                    then test $ drop 7 str
                    else if isPrefixOf "resare" str
                         then test $ drop 6 str
                         else "NO"
test str@('e':sx) = if isPrefixOf "esare" str
                    then test $ drop 5 str
                    else "NO"
test _ = "NO"

main = do
  l <- getLine
  let o = test $ reverse l
  putStrLn o


Measured memory_bytes: 7548
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <algorithm>
#include <iomanip>
#include <math.h>
#include <string.h>

using ll = long long;

int fib(int n){
    if(n==1 || n==0){
        return 1;
    } else{
        return fib(n-1) + fib(n-2) ;
    }
}

int main(){
    int a,b;
    std::cin>> a >> b;
    int h = (b-a)*(b-a+1)/2;
    int ans = h-b;
    std::cout << ans << std::endl;   
}

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

int main() {
    int N;
    cin >> N;
    int originX = 0;
    int originY = 0;
    int origint = 0;
    int x, y, t;
    int yes = 1;
    for (int i = 0; i < N; i++) {
        cin >> t;
        cin >> x;
        cin >> y;
        if(abs(originX - x) + abs(originY-y) > t-origint || (t-origint)%2 != (abs(originX - x) + abs(originY-y))%2) {
            yes = 0;
        }
        originX = x;
        originY = y;
        origint = t;
    }
    yes ? cout << "Yes\n" : cout << "No\n";
}


Measured memory_bytes: 256
N, Y = map(int, input().split())
ans = 0
a = 0
b = 0
c = 0
flag = False
for a in range(N+1):
    for b in range(N-a+1):
        c = N - a - b
        if (a*10000 + b*5000 + c*1000) == Y:
            ans = 1
            x = a
            y = b
            z = c
            flag = True
            break
    if flag:
        break
if ans == 1:
    print(x,y,z)
else:
    print( '-1 -1 -1')

Measured memory_bytes: 3064
n,k = map(int,input().split())

d = []
a = []

for _ in range(k):
  d.append(int(input()))
  a.append(list(map(int,input().split())))
ans = [1] * n
for i in range(k):
  for j in range(d[i]):
    if ans[a[i][j]-1] == 1:
      ans[a[i][j]-1] = 0

print(sum(ans))

Measured memory_bytes: 8948
# python template for atcoder1
from math import log10
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

n = int(input())
ans = 0
l = log10(n)
if int(l) == l:
    ans = 10
else:
    while n > 0:
        ans += n % 10
        n //= 10
print(ans)


Measured memory_bytes: 3060
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

H, W = mapint()
S = [list(input()) for _ in range(H)]
ans = [['#']*W for _ in range(H)]
for i in range(H):
    for j in range(W):
        if S[i][j] == '#':
            continue
        cnt = 0
        for h in range(-1, 2):
            for w in range(-1, 2):
                nh = i + h
                nw = j + w
                if nh<0 or nh>=H or nw<0 or nw>=W:
                    continue
                if S[nh][nw]=='#':
                    cnt += 1
        ans[i][j] = str(cnt)

for a in ans:
    print(''.join(a))

Measured memory_bytes: 71924
package main

import (
	"bufio"
	"os"
	"strings"
	"fmt"
)

var sc = bufio.NewScanner(os.Stdin)

func main() {
	sc.Scan()
	s := sc.Text()
	e := strings.Split(s, " ")
	a, b, c := e[0], e[1], e[2]

	if (a[len(a)-1] == b[0]) && (b[len(b)-1] == c[0])  {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}


Measured memory_bytes: 640
import java.util.*;

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

    int answer = 0;

    for (int i = 0; i <= a; i++) {
      for (int j = 0; j <= b; j++) {
        for (int k = 0; k <= c; k++) {
          if (500 * i + 100 * j + 50 * k == x) {
            answer++;
          }
        }
      }
    }

    System.out.println(answer);
  }
}


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

#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define FOR(e, c) for (auto &e : c)
#define SORT(v, n) sort(v, v + n);
#define vsort(v) sort(v.begin(), v.end());
#define rvisort(v) sort(v.begin(), v.end(), greater<int>());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
// #define int long long
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) int(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using ul = unsigned long;

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

ll GCD(ll a, ll b) { return b ? GCD(b, a%b) : a; }
ll LCM(ll a, ll b) { return a / GCD(a, b)* b; }

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

inline bool inside(int y, int x, int H, int W) {
    return (y >= 0 && x >= 0 && y < H && x < W);
}

const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

const int maxw = 100005;
ll dp[105][maxw];

signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  int N, W; cin>>N>>W;
  vi w(N), v(N);
  rep(i,N) cin>>w[i]>>v[i];
  
  rep(i,N){
    for(int j=0; j<=W; j++){
      if(j+w[i]<=W) dp[i+1][j+w[i]]=max(dp[i][j+w[i]], dp[i][j]+v[i]);
      dp[i+1][j]=max(dp[i+1][j], dp[i][j]);
    }
  }
  cout<<dp[N][W]<<endl;
}


Measured memory_bytes: 79360
import java.util.*;
public class Main {
    Scanner sc = new Scanner(System.in);
    public static void main(String[] args){
        new Main().run();
    }
    void run() {
      int n = sc.nextInt();
      int x = sc.nextInt();
      int[] l = new int[n];
      for(int i = 0; i < n; ++i) {
        l[i] = sc.nextInt();
      }
      int a = 0;
      int c = 1;
      
      for (int j = 0; j < l.length; ++j) {
        a = a + l[j];
        if (a <= x) c++;
      }
      System.out.println(c);
    }
}


Measured memory_bytes: 27180
#include <iostream>
#include <cmath>
#include <algorithm>
using namespace std;

int main() {
	int walk, angle, na = 90;
	double x = 0, y = 0;
	char c;
	
	while(1){
		cin >> walk >> c >> angle;
		if(walk == 0 && angle == 0)break;
		
		double r = double(na / 180.0 * M_PI);
		x += walk * cos(r);
		y += walk * sin(r);
		
		na -= angle;
	}
	
	cout << (int)x << endl;
	cout << (int)y << endl;
	
	return 0;
}

Measured memory_bytes: 1164