akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class AtCoderA
{
    static void Main()
    {
        var sc = new Scanner();

        string s = sc.Next();
        long k = sc.NextLong();

        int length = s.Length;
        SortedSet<string> set = new SortedSet<string>();

        int left = 0;
        int right = 1;

        while (true)
        {
            string str = s.Substring(left, right - left);

            if (set.Count < k)
            {
                set.Add(str);
                right++;
                if (right > length)
                {
                    left++;
                    right = left + 1;
                }
            }
            else
            {
                var last = set.Last();
                if (string.Compare(last, str) == 1)
                {
                    if (!set.Contains(str))
                    {
                        set.Remove(last);
                        set.Add(str);
                    }
                    right++;
                    if (right > length)
                    {
                        left++;
                        right = left + 1;
                    }
                }
                else
                {
                    left++;
                    right = left + 1;
                }
            }

            if (right > length || left == length)
            {
                break;
            }
        }

        string answer = set.Last();

        Console.WriteLine(answer);
    }

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}


Measured memory_bytes: 32620
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#define yes "Yes\n"
#define no "No\n"

int n, c;
char s[51];

int main(void){
  scanf("%d %s", &n,s);

  for (int i = 0; i < n - 2; i++) {
    char buf[4];
    strncpy(buf, s + i, 3);
    if (strcmp(buf, "ABC") == 0) c++;
  }

  printf("%d\n", c);
  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const ll mod=1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b,const ll &mod) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b,const ll &mod) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b,const ll &mod) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b,const ll &mod) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
random_device rd;
mt19937 mt(rd());
uniform_int_distribution<int> dice(1,6);
uniform_real_distribution<double> score(0.0,10.0);

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

    int n; cin >> n;
    vi a(n); for(auto& e : a) cin >> e;

    const int inf = 1e5 + 2;
    vector<vi> tbl(2, vi(inf));
    rep(i, n){
        tbl[i % 2][a[i]]++;
    }

    vector<vi> idx(2, vi(2));
    vector<vi> val(2, vi(2));
    rep(i, 2){
        rep(j, 2){
            int k = idx[i][j] = max_element(_all(tbl[i])) - begin(tbl[i]);
            val[i][j] = tbl[i][k];
            tbl[i][k] = -1;
        }
    }
    int res = n;
    rep(j1, 2){
        rep(j2, 2){
            if(idx[0][j1] == idx[1][j2]) continue;
            chmin(res, n - val[0][j1] - val[1][j2]);
        }
    }

    cout << res << endl;

    return 0;
}


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

int main() {
	int g[3][3];
	for (int i = 0; i < 3; i++) {
		for (int j = 0; j < 3; j++) {
			cin >> g[i][j];
		}
	}

	if (g[0][0] + g[1][1] == g[0][1] + g[1][0] && g[0][0] + g[1][2] == g[0][2] + g[1][0] && g[0][0] + g[2][1] == g[0][1] + g[2][0] && g[0][0] + g[2][2] == g[0][2] + g[2][0]) {
		cout << "Yes" << endl;
	}
	else cout << "No" << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>

inline double func(const double x){
	return x * x;
}

int state_circles(const std::vector<double> &a, const std::vector<double> &b){
	double d;
	d = func(a[0] - b[0]) + func(a[1] - b[1]);
	if(func(a[2] + b[2]) < d)
		return 0;
		if(func(a[2] - b[2]) > d){
		if(a[2] > b[2])
			return 2;
		else 
			return -2;
	}
	
	else 
		return 1;
}

int main(){
	std::vector<double> a(3), b(3);
	int data_num;
	std::cin >> data_num;
	for(int i = 0; i < data_num; ++i){ 
		std::cin >> a[0] >> a[1] >> a[2] >> b[0] >> b[1] >> b[2];
		std::cout << state_circles(a, b) << std::endl;
	}
	
	return 0;
}
			

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

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

	if (a < b)
	{
		if (c < b)
		{
			if (a < c)
			{
				cout << a << " " << c << " " << b << endl;
			}
			else
			{
				cout << c << " " << a << " " << b << endl;
			}
		}
		else
		{
			cout << a << " " << b << " " << c << endl;
		}
	}
	else
	{
		if (c < a)
		{
			if (b < c)
			{
				cout << b << " " << c << " " << a << endl;
			}
			else
			{
				cout << c << " " << b << " " << a << endl;
			}
		}
		else
		{
			cout << b << " " << a << " " << c << endl;
		}
	}



	return 0;
}


Measured memory_bytes: 3096
#include <iostream>
#include <string>
using namespace std;
 
string WeatherPrediction(string s) {
	if(s == "Sunny") return "Cloudy";
  	if(s == "Cloudy") return "Rainy";
  	if(s == "Rainy") return "Sunny";
}
 
int main(){
    string s;
    cin >> s;
	
  	s = WeatherPrediction(s);
    
  	cout << s << "\n";
    return 0;
}

Measured memory_bytes: 256
n,m=map(int,input().split())
ans=0
a=[]
for i in range(n):
  a.append(list(map(int,input().split())))

a.sort()

i=0
while m>0:
  if m>=a[i][1]:
    m-=a[i][1]
    ans+=a[i][0]*a[i][1]
  else:
    ans+=a[i][0]*m
    m=0
  i+=1
print(ans)

Measured memory_bytes: 27884
#include <iostream>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>
#include <iomanip>
typedef long long ll;
using namespace std;

int main(){
    
	int k, s,ans = 0; cin >> k >> s;
	for (int i = 0; i <= k; i++) {
		for (int j = 0; j <= k; j++) {
			if (s - (i + j) <= k && s - (i + j) >= 0) { ans++; }
		}
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstring>

#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define vi vector<int>
#define VS vector<string>
#define all(x) x.begin(),x.end()
#define mp make_pair
#define pb push_back

using namespace std;

vector<pair<int, float> > other;

bool pairCompare(const std::pair<int, double>& firstElem, const std::pair<int, double>& secondElem) {
    return firstElem.second > secondElem.second;
}

int main(){
    for(int j=0; j < 3; j++){
        vector<pair<int, double> > timer;
        for(int i=0; i < 8; i++){
            int n; double t;
            cin >> n >> t;
            timer.push_back(mp(n, t));
        }
        sort(timer.begin(), timer.end(), pairCompare);

        printf("%d %.2f\n",timer[timer.size()-1].first, timer[timer.size()-1].second);
        printf("%d %.2f\n",timer[timer.size()-2].first, timer[timer.size()-2].second);

        timer.pop_back(); timer.pop_back();
        for(int i=0; i < timer.size(); i++){
            other.push_back(timer[i]);
        }
        timer.clear();
    }
    sort(other.begin(), other.end(), pairCompare);
    printf("%d %.2f\n",other[other.size()-1].first, other[other.size()-1].second);
    printf("%d %.2f\n",other[other.size()-2].first, other[other.size()-2].second);

}

Measured memory_bytes: 1256
using System;

namespace ABC095_b
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] array1 = Console.ReadLine().Split(' ');
            int n = int.Parse(array1[0]);
            int x = int.Parse(array1[1]);

            int[] ms = new int[n];
            int sum = 0;
           
            int min = 1000000;
            int ans = 0;
            for(int i = 0; i < n; i++)
            {
                ms[i] = int.Parse(Console.ReadLine());
                sum += ms[i];
                
                if(ms[i] < min)
                {
                    min = ms[i];
                }
                ans = n + (x - sum) / min;
            }
            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 11092
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define vi vector<int>
#define vll vector<ll>
#define vvll vector<vll>
#define vvi vector<vector<int>>
#define vvb vector<vector<bool>>
#define vb vector<bool>
#define pii pair<int, int>
#define vpli vector<pair<long long, int>>
#define deb(x) cout << "deb " << #x << " " << x << endl
#define all(x) x.begin(), x.end()
#define endl "\n"

void solve()
{
    int n;
    ll d;
    cin>>n>>d;
    d = d*d;
    ll x,y;
    int cnt = 0;
    for(int i=0;i<n;i++)
    {
        cin>>x>>y;
        if(x*x +y*y<=d)
        {
            cnt++;
        }
    }
    cout<<cnt<<endl;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    //pre();
    int t = 1;
    //cin >> t;
    //cout<<__gcd(-5,0)<<endl;
    while (t--)
        solve();
    return 0;
}


Measured memory_bytes: 3636
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <stack>
#include <iomanip>
#include <queue>
#include <set>
#include <bitset>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
 
#define ll long long
#define uint unsigned int
#define ull unsigned ll
#define mp make_pair
#define pb push_back
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()
#define speedhack() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define do(x) for(int i = 1; i <= x; i++){ solve(); }
#define sz(x) (int)x.size()
#define pii pair < int, int >
using namespace std;
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
 
const ll MAXN = 1e18;
const ll SIZE = 5e4+2; //are u sure?
const ll mod = 1e9+7;


void solve(){
	int n, k; cin >> n >> k;
	int r, s, p; cin >> r >> s >> p;
	string path; cin >> path;
	string rep = "";
	ll res = 0;
	for(int i = 0; i < k; i++){
		if(path[i] == 'r'){
			res += p;
			rep += 'p';
		}else if(path[i] == 's'){
			res += r;
			rep += 'r';
		}else if(path[i] == 'p'){
			res += s;
			rep += 's';
		}
	}
	for(int i = k; i < n; i++){
		if(path[i] == 'r'){
			if(rep[i - k] != 'p'){
				res += p;
				rep += 'p';
			}else{
				rep += 'c';
			}
		}else if(path[i] == 's'){
			if(rep[i - k] != 'r'){
				res += r;
				rep += 'r';
			}else{
				rep += 'c';
			}
		}else if(path[i] == 'p'){
			if(rep[i - k] != 's'){
				res += s;
				rep += 's';
			}else{
				rep += 'c';
			}
		}
	}
	cout << res << endl;

}


int main(){
	speedhack()
	// int it; cin >> it;
	int it = 1;
	do(it);
	return 0;
}

Measured memory_bytes: 640
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String a = sc.nextLine();
        if(a.equals("a") || a.equals("b") || a.equals("c") || a.equals("d") || a.equals("e") || a.equals("f") || a.equals("g") || a.equals("h") || a.equals("i") || a.equals("j")
        || a.equals("k") || a.equals("l") || a.equals("m") || a.equals("n") || a.equals("o") || a.equals("p") || a.equals("q") || a.equals("r") || a.equals("s") || a.equals("t")
        || a.equals("u") || a.equals("v") || a.equals("w") || a.equals("x") || a.equals("y") || a.equals("z"))
        System.out.println("a");
        else if(a.equals("A") || a.equals("B") || a.equals("C") || a.equals("D") || a.equals("E") || a.equals("F") || a.equals("G") || a.equals("H") || a.equals("I") || a.equals("J")
        || a.equals("K") || a.equals("L") || a.equals("M") || a.equals("N") || a.equals("O") || a.equals("P") || a.equals("Q") || a.equals("R") || a.equals("S") || a.equals("T")
        || a.equals("U") || a.equals("V") || a.equals("W") || a.equals("X") || a.equals("Y") || a.equals("Z"))
        System.out.println("A");
    }
}

Measured memory_bytes: 35700
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef pair<string , int> s_i;
typedef vector<ll> vel;
typedef vector<int> vei;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> ve_vel;
typedef vector<vector<int>> ve_vei;
typedef vector<vector<char>> ve_vec;
typedef vector<vector<bool>> ve_veb;
typedef vector<vector<string>> ve_ves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pub push_back
#define puf push_front
#define pob pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
//#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
typedef long long int64;
const int64 INF = 1LL << 58;
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 (a>b) { a=b; return 1; } return 0; }
template<typename T> void remove(T & vector, unsigned int index){vector.erase(vector.begin() + index);}

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

    string s; cin >> s;
    string t, p = "";

    int cnt = 0;

    rep(i,s.size()) {
        t += s[i];
        if(t == p) continue;
        p = t;
        t = "";
        cnt++;
    }

    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 720
from string import ascii_lowercase
from bisect import bisect_right
s = input()
t = input()
p = {c: [] for c in s}
for x, c in enumerate(s):
    p[c].append(x)
z = 0
l = -1
for c in t:
    if c not in p:
        print(-1)
        break
    x = bisect_right(p[c], l)
    if x == len(p[c]):
        x = 0
        z += 1
    l = p[c][x]
else:
    print(z * len(s) + l + 1)


Measured memory_bytes: 47216
using System;
using System.Collections.Generic;
using System.Linq;

public class ABC166B {
	private static void Main(string[] args) {
		var inputs = ReadIntsAsArray();
		var n = inputs[0];
		var k = inputs[1];
		var isTrickArray = Enumerable.Repeat(true, n).ToArray();

		for (var i = 0; i < k; i++) {
			var d = ReadInt();
			ReadIntsAsList().ForEach(x => isTrickArray[x-1] = false);
		}

		var answer = isTrickArray.Count(isTrick => isTrick);
		Console.WriteLine(answer);
	}

	private static int ReadInt() => int.Parse(Console.ReadLine().Trim());
	private static int[] ReadIntsAsArray() => Console.ReadLine().Trim().Split().Select(x => int.Parse(x)).ToArray();
	private static List<int> ReadIntsAsList() => Console.ReadLine().Trim().Split().Select(x => int.Parse(x)).ToList();
}

Measured memory_bytes: 28520
n=int(input())
l=[list(map(int,input().split())) for _ in range(n)]
l.sort(key=lambda x:x[0]+x[1],reverse=True)

print(sum([l[i][0] for i in range(n) if i % 2 == 0]) - sum([l[i][1] for i in range(n) if i % 2 == 1]))

Measured memory_bytes: 67416
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <numeric>
#include <functional>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <memory>
#include <thread>
#include <tuple>

using namespace std;

long long gcd(long long a, long long b) {
  while (b != 0) {
    long long t = a % b;
    a = b;
    b = t;
  }
  return abs(a);
}

long long lcm(long long a, long long b) {
  return a / gcd(a, b) * b;
}


int main() {
  int n;
  scanf("%d", &n);
  if (n == 2) {
    printf("2 5\n");
    printf("9 4\n");
    return 0;
  }
  vector<vector<long long>> matrix(n, vector<long long>(n));
  vector<bool> mark(10001);
  vector<int> primes;

  for (int i = 2; i <= 10000; i++) {
    if (mark[i]) continue;
    primes.push_back(i);
    for (int j = i * i; j <= 10000; j += i) {
      mark[j] = true;
    }
  }

  for (int i = 0; i < n; i++) {
    for (int j = 1-i%2; j < n; j += 2) {
      int diag1 = (i + j) / 2;
      int diag2 = (i + (n-j-1)) / 2;
      matrix[i][j] = primes[diag1] * primes[diag2 + 502];
    }
  }

  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (((i + j)&1) == 0) {
        long long l = 1;
        if (i > 0) l = lcm(l, matrix[i - 1][j]);
        if (j > 0) l = lcm(l, matrix[i][j - 1]);
        if (i + 1 < n) l = lcm(l, matrix[i + 1][j]);
        if (j + 1 < n) l = lcm(l, matrix[i][j + 1]);
        if (l + 1 > 1'000'000'000'000'000ll) {
          printf("Failed\n");
          return 1;
        }
        matrix[i][j] = l + 1;
      }
    }
  }

  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      printf("%lld%c", matrix[i][j], " \n"[j + 1 == n]);
    }
  }
  return 0;
}


Measured memory_bytes: 5120
# https://atcoder.jp/contests/abc075/tasks/abc075_b
h, w = map(int, input().split())
matrix = []
for _ in range(h):
    row = list(input())
    matrix.append(row)

for i in range(h):
    for j in range(w):
        # 上、右上、右、右下、下、左下、左、左上
        yd = [-1, -1, 0, 1, 1, 1, 0, -1]
        xd = [0, 1, 1, 1, 0, -1, -1, -1]
        if matrix[i][j] == '.':
            bomb = 0
            for k in range(8):
                y = i + yd[k]
                x = j + xd[k]
                if 0 <= y < h and 0 <= x < w and matrix[y][x] == '#':
                    bomb += 1
            matrix[i][j] = str(bomb)

for r in matrix:
    print(''.join(r))

Measured memory_bytes: 40176
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef long double ld;
#define rep(i, a, n) for (int i = a; i < n; i++)
#define per(i, a, n) for (int i = n - 1; i >= a; i--)
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define sz(x) ((int)(x).size())
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define INF 1000000000
#define MOD 1000000007

void solve() {
    int n, m, k;
    cin >> n >> m >> k;
    vll s1(n+1), s2(m+1);
    vi a(n), b(m);
    s1[0] = s2[0] = 0;
    rep(i, 0, n) {
        cin >> a[i];
        s1[i+1] = s1[i] + a[i];
    }
    rep(i, 0, m) {
        cin >> b[i];
        s2[i+1] = s2[i] + b[i];
    }
    ll ans = 0;
    for (int i = 0; i <= n && s1[i] <= k; ++i) {
        ll x = k - s1[i], tmp = i;
        auto it = upper_bound(all(s2), x);
        --it;
        tmp += it - s2.begin();
        ans = max(ans, tmp);
    }
    cout << ans << "\n";
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    int t = 1;
    // cin >> t;
    while (t--)
        solve();
    return 0;
}


Measured memory_bytes: 7864
#include<iostream>
#include<math.h>
using namespace std;
int main(void)
{
	int a, b;
	int sum = 0;
	cin >> a >> b;
	sum = (a + 1) / 2;
	if (sum >= b)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <vector>
#include <cstring>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <utility>
#include <queue>
#include <deque>
#include <stack>
#include <time.h>
#include <stdlib.h>
#include <algorithm>

#include <chrono>

#define INF 1e9
#define LL_INF 1e18

#define nmax 200010

#define fst first
#define snd second
#define pb push_back
#define SZ(x) ((int)(x.size()))

#define MOD 1000000007
#define MOD1 998244353
#define MOD2 666013
#define P1 255
#define P2 2059

using namespace std;

typedef long long int ll;

typedef pair<ll, ll> pll;
typedef pair<int, int> pii;

int n, max_sz;
int c[15][15];

int find_f(int x)
{
    int xx = 0;

    while (x > 0) {

        xx = x % 10; x /= 10;
    }

    return xx;
}

int main()
{
    scanf("%d", &n);

    for (int i = 1; i <= n; i++) c[find_f(i)][i % 10]++;

    ll sum = 0;

    for (int i = 0; i < 10; i++)
        for (int j = 0; j < 10; j++)
            sum = sum + 1LL * c[i][j] * c[j][i];

    printf("%lld", sum);

    // IMPORTANT!!!!!
    // Are you missing something????
    // check limits, int or ll

    return 0;
}

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

#define MOD (1000000007)
int ss[2][100001];

int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	string s;
	for (int j = 0; j < 2; ++j) {
		cin >> s;
		ss[j][0] = 0;
		for (int i = 1; i <= s.size(); ++i) {
			ss[j][i] = ss[j][i - 1] + 1;
			if (s[i-1] == 'B') ++ss[j][i];
		}
	}
	int q, a, b, c, d;
	cin >> q;
	for (int j = 0; j < q; ++j) {
		cin >> a >> b >> c >> d;
		if ((ss[0][a - 1] - ss[0][b] - ss[1][c - 1] + ss[1][d]) % 3) {
			cout << "NO" << endl;
		}
		else {
			cout << "YES" << endl;
		}
	}
	return 0;
}

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

int main(int argc, const char * argv[]) {
    int n;
    cin >> n;
    
    int minv;
    //Rj - Ri may be minus
    int maxv = -2000000000;
    cin >> minv;
    for (int j = 1; j < n; j++) {
        int x;
        cin >> x;
        maxv = max(maxv, x-minv);
        minv = min(minv, x);
    }
    cout << maxv << endl;
    return 0;
}

Measured memory_bytes: 3112
from itertools import combinations

s = list(input())

base = list("AKIHABARA")
idx = [i for i, e in enumerate(base) if e == "A"]

ans = "NO"
for i in range(len(idx) + 1):
    for pat in combinations(idx, i):
        word = base.copy()
        for e in pat[::-1]:
            word.pop(e)

        if word == s:
            ans = "YES"

print(ans)


Measured memory_bytes: 9116
#include <stdio.h>

#define NMAX 100000

#define D(x,y) (pos[(x)]-pos[(y)])

long long A[NMAX];
long long pos[NMAX*2];
int N;
long long L;

long long solve() {
    long long ret = 1;
    int p0 = 0, p1 = 0, p2 = 0;
    long d0 = 0, d1 = 0;
    while (p0 < N) {
        if (p1 <= p0) p1 = p0 + 1;
        while (p1 - p0 < N && D(p1, p0) <= ret) p1++;
        if (D(p1, p0) <= ret) goto L1;

        if (p2 <= p1) p2 = p1 + 1;
        while (p2 - p0 < N && D(p2,p1) < D(p1, p0)) p2++;
        if (D(p2, p1) < D(p1, p0)) goto L1;

        if (L - D(p2, p0) >= D(p1, p0)) {
            ret = D(p1, p0);
            if (ret >= L/3) return ret;
            continue;
        }
L1:
        p0 += 1;
        while (p2 > p1 && D(p2, p1) > D(p1, p0)) p2--;
    }
    return ret;
}

int main(void) {
    int i;
    scanf("%d", &N);
    for (i = 0; i < N; i++) {
        scanf("%lld", &A[i]);
        L += A[i];
    }
    for (i = 0; i < 2*N; i++) {
        pos[i] = pos[i-1] + A[(i-1)%N];
    }
    printf("%lld\n", solve());
    return 0;
}

Measured memory_bytes: 5052
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define fi first
#define se second
#define endl "\n"

template<typename T> inline bool chmax(T &a, T b){if(a<b){a=b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if(a>b){a=b;return true;}return false;}
template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){
	int len=d.size();
	rep(i,len){
		s<<d[i];if(i<len-1) s<<" ";
	}
	return s;
}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){
	int len=d.size();
	rep(i,len){
		s<<d[i]<<endl;
	}
	return s;
}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){
	s<<"{ ";
	for(auto itr=v.begin();itr!=v.end();++itr) {
		if (itr!=v.begin()) {s<< ", ";}
		s<<(*itr);
	}
	s<<" }";
	return s;
}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){
	s<<"{"<<endl;
	for(auto itr=m.begin();itr!=m.end();++itr){
		s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;
	}
	s<<"}"<<endl;
	return s;
}

const ll mod=1e9+7;
const ll inf=1e17;
const int INF=1e9;
const double PI=acos(-1);
const double EPS=1e-10;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n,k;
	cin>>n>>k;
	ll ans=0;
	while(n){
		ans++;
		n/=k;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int getSum(int i) {
    int sum = 0;
    while(i > 0) {
        sum += i%10;
        i = i/10;
    }
    return sum;
}
int main () {
    int N;
    cin >> N;
    
    int A, B;
    cin >> A >> B;

    int sum = 0;
    int bufSum = 0;
    for(int n=0; n<=N; n++){
        bufSum = getSum(n);
        if(bufSum >= A && bufSum <= B) {
            sum += n;
        }
    }
    cout << sum << 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 F0R(i, n) for (int i = 0; i < (n); i++)
#define print(x) cout << x << '\n'
#define watch(x) cout << (#x) << " is " << (x) << endl

typedef long long ll;
typedef pair<int, int> ii;
typedef pair<int, ii> iii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<iii> viii;

const int INF = 1e9 + 5;
const int MAX_N = 1e5 + 5;
int dp[MAX_N][3];

int main()
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  vector<vector<int>> days(n, vector<int> (3,0));
  for (vector<int>& i : days){
      for (int& j : i){
          cin >> j;
      }
  }
  for (int i = 0; i < 3; i++){
      dp[0][i] = days[0][i];
  }

  for (int i = 1; i < n; i++){
      for (int a : {0,1,2}){
          int p = (a+1) % 3;
          int q = (a+2) % 3;
          dp[i][a] = days[i][a] + max(dp[i-1][p], dp[i-1][q]);
      }
  }
  int ans = 0;
  for (int i = 0; i < 3; i++){
    if (dp[n-1][i] >ans) ans = dp[n-1][i];
  }
  cout <<ans;
  return 0;
}

Measured memory_bytes: 6912
#include <iostream>

using namespace std;

int main()
{
 int n,k;
 cin>>n;
 k=n%100;
 n/=100;
 if (k>0&&k<=12&&n>0&&n<=12){
  cout<<"AMBIGUOUS";
 }
 else if (k>0&&k<=12){
  cout<<"YYMM";
 }
 else if (n>0&&n<=12){
  cout<<"MMYY";
 }
 else {
  cout<<"NA";
 }
 return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <numeric>
using namespace std;
#define ll long long
#define mod107 1000000007
#define rep(i, n) for (int i = 0; i < n; ++i)
using Graph = vector<vector<int>>;
#define grepq priority_queue<double, std::vector<double>, std::greater<double>>
#define all(v) v.begin(), v.end()
#define PI acos(-1)

const ll INF = 10010001010;
const int inf = 1000034000;
typedef vector<ll> vecl;
typedef vector<int> veci;
typedef tuple<string, int, int> TUP;

const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
 
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    //cout << fixed << setprecision(15);
    int N, M;
    cin >> N >> M;
    vector<int> A(N);
     ll vote = 0;
    for (int i = 0; i < N; i++)
    {
        cin >> A[i];
         vote += A[i];
    }
    int count = 0;
    double D = (double)1 / (4 * M) * vote;
    for (int i = 0; i < N; i++)
    {
        if(D <= A[i]){
            count++;
        }
    }
    if(count >= M){
        cout << "Yes" << endl;
        //cout << count << endl;
    }
    else{
        cout << "No" << endl;
       // cout << count << endl;
    }
}


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

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

int main(){
	ll a,b,c;
	cin >> a >> b >> c;
	if(a<c){
		c -= a;
		if(b<c){
			cout << "0 0\n";
		}else{
			cout << 0 << ' ' << b-c <<'\n';
		}
	}else{
		cout << a-c << ' ' << b << '\n';
	}
	return 0;
}

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

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define inf 9e18
#define ceill(a, b) (a+b-1)/b
#define ok cout << "ok" << endl;
#define sp << " " <<
ll mod = 1e9+7;
void ans(bool b, ostream& out=cout){ out << (b ? "Yes" : "No") << endl; }
void ans2(bool b, ostream& out=cout){ out << (b ? "YES" : "NO") << endl; }
template<typename T> inline bool chmax(T &a, T b){ if(a<b){a=b; return true;} return false; }
template<typename T> inline bool chmin(T &a, T b){ if(b<a){a=b; return true;} return false; }
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val){fill((T*)array, (T*)(array+N), val);}
int dx[] = {1, 0, -1, 0, 1, -1, 1, -1};
int dy[] = {0, 1, 0, -1, 1, -1, -1, 1};

#ifndef INCLUDE_DEBUG_HPP
#define INCLUDE_DEBUG_HPP

class debug
{
public:
    template<typename T> void vdeb(T vec);
    template<typename T1, typename T2> void adeb(T1 *arr, T2 n);
    template<typename T> void mdeb(T mp);
};

#endif //INCLUDE_DEBUG_HPP

template<typename T> void debug::vdeb(T vec)
{
    cout << "#vector set debug" << endl;
    for(auto vv : vec) cout << vv << " ";
    cout << endl;
}

template<typename T1, typename T2> void debug::adeb(T1 *arr, T2 n)
{
    cout << "#adebug" << endl;
    for(int i=0; i<=n; i++) cout << arr[i] << " ";
    cout << endl;
}

template<typename T> void debug::mdeb(T mp)
{
    cout << "#map pair debug" << endl;
    for(auto const& m : mp) cout << m.first sp m.second << endl;
}
debug dbg;

class BTouitsu {
public:
	void solve(std::istream& in, std::ostream& out)
	{
	    int n;
	    in >> n;
	    string a, b, c;
	    in >> a >> b >> c;

	    int res = 0;
	    for(int i=0; i<n; i++){
	        if(a[i] == b[i] && b[i] != c[i]) res++;
	        if(b[i] == c[i] && a[i] != b[i]) res++;
	        if(a[i] == c[i] && a[i] != b[i]) res++;
	        if(a[i] != b[i] && b[i] != c[i] && c[i] != a[i]) res += 2;
	    }

	    out << res << endl;
	}
};


int main() {
	BTouitsu solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


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


int main(){
    ll X; cin >> X;
    ll cnt = 0;
    ll Y = 100;
    while(1){
        cnt++;
        Y = Y*1.01;
        if(Y >= X) {cout << cnt << endl;
        return 0;
        }
    }
}


Measured memory_bytes: 3596
#![allow(dead_code)]
use std::io;

fn main() {
    solve_b();
}

fn solve_d() {
    let mut x = String::new();

    io::stdin().read_line(&mut x).unwrap();

    let v: Vec<i32> = x.trim()
        .split(' ')
        .map(|s| s.parse::<i32>().unwrap())
        .collect();

    let w = v[0];
    let h = v[1];
    let x = v[2];
    let y = v[3];
    let r = v[4];
    if x + r <= w && 0 <= x - r && 0 <= y - r && y + r <= h {
        println!("Yes");
    } else {
        println!("No");
    }
}

fn solve_c() {
    let mut x = String::new();

    io::stdin().read_line(&mut x).unwrap();

    let mut v: Vec<u32> = x.trim()
        .split(' ')
        .map(|s| s.parse::<u32>().unwrap())
        .collect();

    v.sort();
    println!("{} {} {}", v[0], v[1], v[2]);
}

fn solve_b() {
    let mut i = 1;
    loop {
        let mut x = String::new();
        io::stdin().read_line(&mut x).unwrap();
        let n = x.trim().parse::<u64>().unwrap();

        if n == 0 {
            break;
        } else {
            println!("Case {}: {}", i, n);
            i += 1;
        }
    }
}

fn solve_a() {
    for _i in 0..1000 {
        println!("Hello World");
    }
}



Measured memory_bytes: 5048
d = {}
n = int(input())
for i in range(n):
    s = input()
    c = d.get(s, 0)
    d[s] = c + 1
m = int(input())
for i in range(m):
    s = input()
    c = d.get(s, 0)
    d[s] = c - 1
co = 0
wo = ""
for k in d:
    if d[k] > co:
        co = d[k]
        wo = k
print(co if co > 0 else "0")

Measured memory_bytes: 3064
package main

import (
  	"bufio"
	"fmt"
	"os"
	"strconv"
	"sync"
)

func max(a, b int) int {
	if a < b {
		return b
	}
	return a
}

func maxt(a ...int) int {
	t := a[0]
	for _, x := range a {
		t = max(t, x)
	}
	return t
}

func main() {
	n := ReadInt()
	var dp [100001][3]int
	for i := 0; i < 3; i++ {
		dp[0][i] = 0
	}
	for i := 1; i <= n; i++ {
		a := ReadIntSlice(3)
		for j := 0; j < 3; j++ {
			dp[i][j] = max(dp[i-1][(j + 1) % 3], dp[i-1][(j + 2) % 3]) + a[j];
		}
	}
	fmt.Println(maxt(dp[n][0], dp[n][1], dp[n][2]))
}


var out chan string
var in *bufio.Scanner
var outWg *sync.WaitGroup
func ReadString() string {
	in.Scan()
	return in.Text()
}
func ReadStringSlice(n int) []string {
	s := make([]string, n)
	for i := 0; i < n; i++ {
		s[i] = ReadString()
	}
	return s
}
func ReadInt() int {
	intStr := ReadString()
	i, _ := strconv.ParseInt(intStr, 10, 32)
	return int(i)
}
func ReadIntSlice(n int) []int {
	arr := make([]int, n)
	for i := 0; i < n; i++ {
		arr[i] = ReadInt()
	}
	return arr
}
func init() {
	//set input
	in = bufio.NewScanner(os.Stdin)
	in.Buffer(make([]byte, 1024), int(2e+5))
	in.Split(bufio.ScanWords)
 
	//set output
	out = make(chan string, 16)
	outWg = &sync.WaitGroup{}
	outWg.Add(1)
 
	writer := bufio.NewWriterSize(os.Stdout, int(2e+5))
	go func(write *bufio.Writer) {
		defer outWg.Done()
		defer write.Flush()
 
		for line := range out {
			write.WriteString(line + "\n")
		}
	}(writer)
}

Measured memory_bytes: 7168
mod = 1000000007
N = int(input())
ruiseki = []
A = list(map(int, input().split()))
sum = 0

for i in range(N):
  sum += A[i]
  sum = sum%mod

ruiseki.append(sum - A[0])
if(ruiseki[0] < 0): ruiseki[0] += mod

for i in range(1,N-2):
  ruiseki.append(ruiseki[i-1] - A[i])
  if(ruiseki[i] < 0): ruiseki[i] += mod

ans = 0

for i in range(0,N-2):
  ans += A[i]*(ruiseki[i])%mod

ans += (A[N-2]%mod)*(A[N-1]%mod)%mod
ans = ans%mod
print(ans)

Measured memory_bytes: 30924
#include <bits/stdc++.h>
#pragma GCC optimize(2)
#define ll long long
#define ull unsigned long long

using namespace std;

int a[25], b[25], c[25], n;

inline ll in()
{
	ll Req = 0, wX = 0; char ch;
	while (!isdigit(ch)) {wX |= (ch == '-'); ch = getchar();}
	while (isdigit(ch)) {Req = (Req << 3) + (Req << 1) + (ch ^ 48); ch = getchar();}
	return wX ? -Req : Req;
}

inline void out(ll x)
{
	register short Pxn[20], Ry = 0;
	if (x == 0) putchar('0');
	if (x < 0) putchar('-'), x = -x;
	while (x != 0) Pxn[Ry] = x % 10, x /= 10, Ry++;
	for (int i = Ry - 1; i >= 0; i--) putchar(Pxn[i] + '0');
}

int main()
{

	n = in();
	for (int i = 0; i < n; i++) a[i] = in() - 1;
	for (int i = 0; i < n; i++) b[i] = in();
	for (int i = 0; i < n - 1; i++) c[i] = in();
	int ans = b[a[0]];
	for (int i = 1; i < n; i++)
	{
		ans += b[a[i]];
		if (a[i] == a[i - 1] + 1) ans += c[a[i - 1]];
	}
	out(ans);

  return 0;

}



Measured memory_bytes: 256
def getN():
    return int(input())


def getNM():
    return map(int, input().split())


def getList():
    return list(map(int, input().split()))

N = getN()
size = getList()

size.sort()

acc = 0
lim = 0
for i, si in enumerate(size[:-1]):
    acc += si
    if acc*2 < size[i+1]:
        lim = i+1

print(N-lim)


Measured memory_bytes: 14320
d1={
" ":"101",
"'":"000000",
",":"000011",
"-":"10010001",
".":"010001",
"?":"000001",
"A":"100101",
"B":"10011010",
"C":"0101",
"D":"0001",
"E":"110",
"F":"01001",
"G":"10011011",
"H":"010000",
"I":"0111",
"J":"10011000",
"K":"0110",
"L":"00100",
"M":"10011001",
"N":"10011110",
"O":"00101",
"P":"111",
"Q":"10011111",
"R":"1000",
"S":"00110",
"T":"00111",
"U":"10011100",
"V":"10011101",
"W":"000010",
"X":"10010010",
"Y":"10010011",
"Z":"10010000"}
d2={
"00000":"A",
"00001":"B",
"00010":"C",
"00011":"D",
"00100":"E",
"00101":"F",
"00110":"G",
"00111":"H",
"01000":"I",
"01001":"J",
"01010":"K",
"01011":"L",
"01100":"M",
"01101":"N",
"01110":"O",
"01111":"P",
"10000":"Q",
"10001":"R",
"10010":"S",
"10011":"T",
"10100":"U",
"10101":"V",
"10110":"W",
"10111":"X",
"11000":"Y",
"11001":"Z",
"11010":" ",
"11011":".",
"11100":",",
"11101":"-",
"11110":"'",
"11111":"?"}
while 1:
    try:
        s=raw_input()
    except EOFError:
        break
    s1,ans="",""
    for w in s:
        s1+=d1[w]
    if len(s1)%5!=0:
        s1+="0"*(5-len(s1)%5)
    for i in range(len(s1)/5):
        ans+=d2[s1[:5]]
        s1=s1[5:]
    print ans

Measured memory_bytes: 5732
n=int(input())
a=list(map(int,input().split()))

n_nega = sum(aa<0 for aa in a)
sumabs = sum(abs(aa) for aa in a)
if n_nega%2==0:
    print(sumabs)
else:
    mi=min( abs(aa) for aa in a)
    print(sumabs-mi*2)

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

int main()
{
    char *S = new char[3];
    for (int i = 0; i < 3; i++) cin >> S[i];
    char *T = new char[3];
    for (int i = 0; i < 3; i++) cin >> T[i];

    int count = 0;
    for (int i = 0; i < 3; i++) {
        if (S[i] == T[i]) {
            count++;
        }
    }

    cout << count << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define endl '\n'
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int mod=1e9+7;
//const int mod=998244353;
const double eps = 1e-10;
const double pi=acos(-1.0);
const int maxn=1e6+10;
const ll inf=0x3f3f3f3f;
const int dir[4][2]={{0,1},{1,0},{0,-1},{-1,0}};


int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    set<string> s;
    int n;
    cin>>n;
    for(int i=1;i<=n;i++){
        string x;
        cin>>x;
        s.insert(x);
    }
    cout<<s.size();
    return 0;
}



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

#define rep(i, a, b) for(int i = (a); i < int(b); ++i)
#define rrep(i, a, b) for(int i = (a) - 1; i >= int(b); --i)
#define trav(it, v) for(auto &it : (v))
#define all(v) (v).begin(), (v).end()
#define what_is(x) cerr << #x << " is " << x << endl;
#define sz(x) (int)(x).size()

typedef double fl;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;

int A[105];

int main(){
	ios::sync_with_stdio(0);
	int N;
	cin >> N;
	bool hasOne = 0;
	int P;
	cin >> P;
	rep(i,0,N){
		cin >> A[i];
		if(A[i]%2 == 1)
			hasOne=1;
	}
	ll numZero;
	if(hasOne)
		numZero = (1LL<<(N-1));
	else
		numZero = (1LL<<N);
	if(P){
		cout << (1LL<<N)-numZero << endl;
	}
	else
		cout << numZero << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key

typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef long double ld;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

const long long mod = 1000000007;
const long long inf = 1e18;

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    int n;
    cin>>n;
    int x=0,y=0,t=0;
    int ans=1;
    for(int i=0;i<n;i++){
        int t2,p,q;
        cin>>t2>>p>>q;
        if(abs(p-x)+abs(q-y)>t2-t){
            ans=0;
        }

        else{
            int k=abs(p-x)+abs(q-y)-t2+t;
            if((k&1)==1)
                ans=0;
        }
        t=t2;
        x=p;
        y=q;
    }
    ans==0?cout<<"No"<<endl:cout<<"Yes"<<endl;
    return 0;
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a) for(int i = 0; i < (a); i++)
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const int MOD = 1e9 + 7;

int main(){
	int x,a,b;
	cin >> x;
	cin >> a;
	cin >> b;
	cout << (x - a) % b << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>

int main() {

  int n, i, H, t = 0, h = 0, c = 0;
  char s1[101], s2[101];

  scanf("%d", &n);

  while(1) {
    if(c == n) break;
    c++;
    scanf("%s", s1);
    scanf("%s", s2);

   H = strcmp(s1,s2);
   if(H == 0) {
     t++;
     h++;
   } else if(H < 0) {
     h += 3;
   } else if(H > 0) {
     t += 3;
   }
  }

  printf("%d %d\n", t, h);

  return 0;
}

Measured memory_bytes: 604
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
// #define INF __INT32_MAX__
#define INF 1e9
#define LINF __LONG_LONG_MAX__

ll gcd(ll a, ll b) {
    if (b == 0) return a;
    else return gcd(b, a % b);
}

int main() {
    int N; cin >> N;
    vi A(N); rep(i, N) cin >> A[i];

    map<int, int> G;

    // 1
    bool ok = true;
    rep(i, N) {
        int x = A[i];
//  cout << "A[i]: " << A[i] << endl;
        for (int j = 2; j <= sqrt(A[i]); j++) {
            if (G[j] != 0 && G[j] != 1) {
                ok = false;
                break;
            }
            if (x == 1) break;
            if (x % j != 0) continue;
            while (x % j == 0) {
                x /= j;
            }
//  cout << "  x:" << x << endl;
            G[j]++;
        }
        if (!ok) break;
        if (x != 1) G[x]++;
    }

    for (auto x : G) {
// cout << x.first << " " << x.second << endl;
        if (x.second != 0 && x.second != 1) {
            ok = false;
            break;
        }

    }
    if (ok) {
        cout << "pairwise coprime" << endl;
        return 0;
    }

    // 2
    ok = true;
    int y = A[0];
    rep(i, N - 1) {
        y = gcd(y, A[i + 1]);
        if (y == 1) break;
    }
    if (y != 1) ok = false;
    if (ok) {
        cout << "setwise coprime" << endl;
        return 0;
    }

    cout << "not coprime" << endl;
}


Measured memory_bytes: 7436
#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define yesno(flg) if(flg){cout<<"Yes"<<endl;}else{cout<<"No"<<endl;}
#define vi vector<int>
#define pb(a) push_back(a)
using namespace std;

typedef long long ll;

typedef pair<int,int> P1;
typedef pair<int,P1> P2;
const int inf=1000000000;
struct edge{
	int myc,to,c,cost;
};
struct pos{
	int to,cost,color;
};
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

#define MAX_N 100002

map<int,int> dp[MAX_N];
vector<edge> G1[MAX_N],G2[MAX_N],G3[1000002];
int dp1[MAX_N];
priority_queue<P2,vector<P2>,greater<P2>> que;

int main() {
	string s;
	cin>>s;
	string w="CODEFESTIVAL2016";
	int t=0;
	rep(i,16){
		if(s[i]!=w[i])t++;
	}
	cout<<t<<endl;
	return 0;
}


Measured memory_bytes: 33024
#include <stdio.h>
#include <math.h>//????????¢??°
int main(int argc, const char * argv[]) {
    double r;//??????
    double area,line;//??¢???????????¨
    //double p;//?????¨????????\????????¨
    
    scanf("%lf",&r);//??????r???????????????
    
    //p = 3.1415926;//?????¨?????£??\
    
    area = r*r*M_PI;//??¢???????????????????????????????????????????????¨???
    line = 2*r *M_PI;//?????¨???????????´?????????????????¨???
    
    printf("%lf %lf\n",area,line);//???????????????
    
    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<27;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-11;
const ll mod=1e9+7;
//const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};
const int dx[13]={1,0,0,1,1,1,1,0,0,1,1,1,1};
const int dy[13]={0,1,0,1,-1,0,0,1,1,1,-1,1,-1};
const int dz[13]={0,0,1,0,0,1,-1,1,-1,1,1,-1,-1};

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	while(1){
		int n,m,p;
		cin>>n>>m>>p;
		if(n==0) break;
		vector<vvi> a(n,vvi(n,vi(n)));
		vvi b(n,vi(n));
		int flag=0,res;
		for(int i=0;i<p;i++){
			int x,y;
			cin>>x>>y;
			x--;y--;
			if(flag) continue;
			a[x][y][b[x][y]++]=(i%2==0?1:-1);
			for(int j=0;j<n;j++) for(int k=0;k<n;k++) for(int l=0;l<n;l++){
				for(int I=0;I<13;I++){
					int x=j,y=k,z=l;
					bool B=1;
					for(int J=0;J<m;J++){
						if(x<0||x>=n||y<0||y>=n||z<0||z>=n||a[x][y][z]!=(i%2==0?1:-1)){
							B=0;
							break;
						}
						x+=dx[I],y+=dy[I],z+=dz[I];
					}
					if(B){
						flag=(i%2==0?1:-1);
						res=i+1;
					}
				}
			}
		}
		if(flag==0) cout<<"Draw"<<endl;
		else cout<<(flag==1?"Black":"White")<<' '<<res<<endl;
	}
}


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

#define lli long long int
#define REP(i,s,l) for(lli i=s;i<l;i++)
#define DEBUG 0
#define INF (1LL<<50)
#define MOD 1000000007

bool comp(int a, int b){
    return (a<b);
}

int main(){
    int r; cin >> r;
    if(r<1200) cout << "ABC";
    else if(r<2800) cout << "ARC";
    else cout << "AGC";
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define rep(i,N) for(ll (i)=0;(i)<(N);(i)++)
const int mod = 1000000007;

int main(){
  int x = 0;
  int ans = 0;
  int n;
  string s;
  cin >> n >> s;
  rep(i, n){
    if(s[i] == 'I') x++;
    else x--;
    ans = max(x, ans);
  }
  cout << ans << endl;
}

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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;

#define faster ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define read freopen("in.txt", "r", stdin)
#define write freopen("out.txt", "w", stdout)
#define mem(x, n) memset(x, n, sizeof(x))
#define all(x) x.begin(), x.end()
#define endl "\n"

int main() {
	faster;

	ll n;
	cin >> n;
	ll ans = (n / 500) * 1000;
	n %= 500;
	ans += (n / 5) * 5;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3616