akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
 
const double pi = 3.141592653589793238462643383279;
using namespace std;
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<long long, long long> PLL;
typedef pair<int, PII> TIII;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
 
 
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SQ(a) ((a)*(a))
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
 
 
//repetition
//------------------------------------------
#define FOR(i,s,n) for(int i=s;i<(int)n;++i)
#define REP(i,n) FOR(i,0,n)
#define MOD 998244353
 
 
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
 
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
 
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)

//ここから編集

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(5);
  
  ll N;

  cin >> N;
  vector<ll> v;
  REP(i,N){
    string s; cin >> s;
    int idx = -1;
    ll t = 0;
    for(int j=0; j<s.size(); j++){
      if(s[j] == '.'){
        idx = j;
      }
      if(s[j] != '.') t = t*10 + s[j]-'0';
    }
    if(idx == -1){
      
      for(int j=0; j<9; j++){
        t *= 10;
      }
      
    }else{
      for(int j=s.size()-idx; j<=9; j++){
        t *= 10;
      }  
    }
    v.push_back(t);
  }

  ll ans = 0;
  map<pair<int, int>, int> mp;
  vector<pair<int, int>> vp;
  for(int i=0; i<N; i++){
    ll a=0, b=0;
    ll t = v[i];
    while(t%2 == 0){
      a++;
      t /= 2;
    }
    t = v[i];
    while(t%5 == 0){
      b++;
      t /= 5;
    }
    mp[make_pair(a, b)]++;
    vp.push_back(make_pair(a, b));
  }

  for(int i=0; i<N; i++){
    auto p = vp[i];mp[p]--;
    for(auto e: mp){
      if(min(p.first +e.first.first, p.second + e.first.second)  >= 18){
        ans += e.second;
      }
    }
    
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 7956
#include <bits/stdc++.h>
using namespace std;
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
 
typedef long long ll;
#define FIN ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define forr(i, a, b) for(int i = (a); i < (int) (b); i++)
#define forn(i, n) forr(i, 0, n)
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(),(c).end()
#define DBG(x) cerr << #x << " = " << (x) << endl
#define DBGV(v,n) forn(i,n) cout << v[i] << " "; cout << endl
#define esta(x,c) ((c).find(x) != (c).end())
#define RAYA cerr << "===============================" << endl
 
ll solve(vector <int> &v, int n, int k)
{
	ll MAXN = 10000000000000000;
	vector <ll> dp(n,MAXN);
	dp[0]=0;
	forr(i,1,n)
	{
		for(int j=1; j<=k; j++)
		{
			if(i-j < 0) break;
			dp[i]=min(dp[i],dp[i-j]+abs(v[i]-v[i-j]));
		}
	}
	return dp[n-1];
}
 
int main()
{ 
	FIN;
	
	#ifdef input
		freopen("test1.txt", "r", stdin);
	#endif
	
	int n, k;
	cin >> n >> k;
	vector <int> v(n);
	forn(i,n) cin >> v[i];
	cout << solve(v,n,k) << endl;
	return 0;
}


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

int main() {
  int N,e=1000000000,f=0;
  cin >> N;
  for(; e!=1; e=e/10){
    f+=N%e/(e/10);
  }
  if(N%f==0){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
int n;
ll a[405],sum[405];
ll f[405][405];
int main(){
	cin>>n;
	for(int i=1;i<=n;++i){
		cin>>a[i];
		sum[i]=sum[i-1]+a[i];
	}
	for(int len=2;len<=n;++len){
		for(int L=1;L<=n-len+1;++L){
			int R=L+len-1;
			f[L][R]=(1ll<<60);
			for(int k=L;k<R;++k){
				f[L][R]=min(f[L][R],f[L][k]+f[k+1][R]+sum[R]-sum[L-1]);
			}
		} 
	}
	cout<<f[1][n]<<'\n';
	return 0;
}

Measured memory_bytes: 1536
class BinaryTree {
  constructor(n) {
    this.nodes = [];
    for (let i = 0; i < n; i++) this.nodes[i] = {id: -1, parentId: -1, leftId: -1, rightId: -1}
  }

  static get Node() {return _Node;}

  get root() { return this.nodes.find(n => n.parentId === -1); }

  add(id, leftId, rightId) {
    let n = this.nodes[id];
    [n.id, n.leftId, n.rightId] = [id, leftId, rightId];
    if (leftId !== -1) this.find(leftId).parentId = id;
    if (rightId !== -1) this.find(rightId).parentId = id;
  }

  find(id) { return this.nodes[id] || {}; }

  preorder(id = this.root.id) {
    if (id === -1) return;
    let n = this.find(id);
    process.stdout.write(` ${id}`);
    this.preorder(n.leftId);
    this.preorder(n.rightId);
  }

  inorder(id = this.root.id) {
    if (id === -1) return;
    let n = this.find(id);
    this.inorder(n.leftId);
    process.stdout.write(` ${id}`);
    this.inorder(n.rightId);
  }

  postorder(id = this.root.id) {
    if (id === -1) return;
    let n = this.find(id);
    this.postorder(n.leftId);
    this.postorder(n.rightId);
    process.stdout.write(` ${id}`);
  }
}

(function main(){
  const lines = require('fs').readFileSync('/dev/stdin', 'utf8').trim().split('\n');
  const n = Number(lines.shift());
  let tree = new BinaryTree(n);
  lines.map(l => l.split(' ').map(Number)).forEach(line => tree.add(...line));
  console.log('Preorder');
  tree.preorder();
  console.log('\nInorder');
  tree.inorder();
  console.log('\nPostorder');
  tree.postorder();
  console.log();
})();



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

int main() {
	int n;
	cin >> n;
	vector<int> d(n);
	for (int i = 0; i < n; i++) {
		cin >> d.at(i);
	}
	int ans = 0;
	for (int i = 0; i < n; i++) {
		for (int j = i + 1; j < n; j++) {
			ans += d[i] * d[j];
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>
int main(void){
  int n,i,j;
  scanf("%d",&n);
  for(i=n;i<=999;i++){
    char s[10]={'\0'};
    sprintf(s,"%d",i);
    if(s[0]==s[1]&&s[1]==s[2]){printf("%d",i);return 0;}
  }
  return 0;
}

Measured memory_bytes: 128
dic={
    '1':'.,!? ',
    '2':'abc',
    '3':'def',
    '4':'ghi',
    '5':'jkl',
    '6':'mno',
    '7':'pqrs',
    '8':'tuv',
    '9':'wxyz'
}

for i in range(int(input())):
    s=input().split('0')
    for c in s:
        if c=='':
            continue
        print(dic[c[0]][(len(c)-1)%len(dic[c[0]])],end='')
    print()


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

#include <iostream>
#include <fstream>

#include <iostream>
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>

#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <queue>
#include <unordered_map>
#include <unordered_set>

#define int long long
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPS(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF 1001001001001001001ll
#define fcout cout << fixed << setprecision(12)

using namespace std;

typedef pair<int, int> P;

class AServalVsMonster {
public:
    void solve(std::istream& cin, std::ostream& cout) {
        int H, A;
        cin >> H >> A;
        int num = (H + A - 1) / A;
        cout << num << endl;
    }
};


signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    std::istream& in(std::cin);
    std::ostream& out(std::cout);

    AServalVsMonster solver;
    solver.solve(in, out);
    return 0;
}


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


public class Main {

	public static void main(String[] a){

		Stack<String> arr = new Stack<String>();
		BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));

		String tmpString = null;
		try {
			while(null != (tmpString = bf.readLine())){
				if(tmpString.equals("0")){
					System.out.println(arr.pop());
				} else {
					arr.push(tmpString);
				}
			}
		} catch (IOException e) {
		} finally {
			try {
				bf.close();
			} catch (IOException e) {
			}
		}

	}

}

Measured memory_bytes: 9344
'use strict'

function Main(input) {
  const lines = input.split('\n').map(Number)
  const S = lines[0]

  const f = n => {
    if (n % 2 === 0) {
      return n / 2
    } else {
      return 3 * n + 1
    }
  }

  let arr = [S]
  for (let i = 1; ; i++) {
    const val = f(arr[i - 1])
    const exists = arr.some(v => v === val)
    if (exists) {
      console.log(i + 1)
      return
    }
    arr[i] = val
  }
}

Main(require('fs').readFileSync('/dev/stdin', 'utf8'))


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

using namespace std;

using ll = long long;

constexpr char newl = '\n';

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

    string s;
    cin >> s;
    cout << s.substr(0, 3) << newl;

    return 0;
}

Measured memory_bytes: 3632
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
#include <iomanip>

using namespace std;

typedef long long ll;
typedef long double ld;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;

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

#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define shandom_ruffle random_shuffle

const int MOD = 1000000007;
const ll INF = 1e18;
//             0123456789 - digits. check the limits, int vs long
const int MX = 100001;

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cout << std::setprecision(0);
    cout << std::fixed;
    // freopen("ex.in","r",stdin);
    // freopen("ex.out","w",stdout);
    int n;
    cin >> n;
    string s;
    cin >> s;
    char cur = s[0];
    int cnt = 1;
    for (int i = 0; i < s.length(); i++) {
        if (cur != s[i]) {
            ++cnt;
            cur = s[i];
        }
    }
    cout << cnt << "\n";
    return 0;
}

Measured memory_bytes: 512
using System;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] str = Console.ReadLine().Split(' ');//2?????\?????????????????????????????\????????????
            var a = int.Parse(str[0]);  //??°?????§????????????????????´??????????????????
            var b = int.Parse(str[1]);
            Console.WriteLine("{0} {1}", a * b, (a + b) * 2);
        }
    }
}

Measured memory_bytes: 9128
import sys, bisect, math, itertools, string, queue, copy
import numpy as np
import scipy
from collections import Counter,defaultdict,deque
from itertools import permutations, combinations
from heapq import heappop, heappush
from fractions import gcd
input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(input())
def inpm(): return map(int,input().split())
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())
def inplm(n): return list(int(input()) for _ in range(n))
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return [list(map(int, input().split())) for _ in range(n)]
def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)])

a,b,c = inpm()
k = inp()

for i in range(k):
    if b <= a:
        b *= 2
    elif c <= b:
        c *= 2

if a < b < c:
    ans = 'Yes'
else:
    ans = 'No'

print(ans)


Measured memory_bytes: 31192
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"
#define watch(x); cout<<#x<<"="<<x<<endl;
#define watch2(x,y); cout<<#x<<"="<<x<<" "<<#y<<"="<<y<<endl;
#define int long long

int32_t main() 
{ 
    fast
    int n,k;
    cin>>n>>k;
    //n++;
    int ans=0;
    int mod=1e9+7;
    for(int i=k;i<=n+1;i++){
        int first=(i*(i-1))/2;
        int last=i*n-first;
        ans+=(last-first+1);
        ans%=mod;
    }
    cout<<ans;





    return 0; 
} 


Measured memory_bytes: 3644
#include <cstdio>
#include <algorithm>

template<typename T>
T gcd(T a, T b)
{
	if (a < b) return gcd(b, a);
	T r;
	while (r = a % b)
	{
		a = b;
		b = r;
	}
	return b;
}

int main()
{
  long long n, m;
  scanf("%lld%lld", &n, &m);
  char s[100001], t[100001];
  scanf("%s%s", s, t);
  long long g = gcd(n, m);
  for (long long i = 0; i < g; ++i)
  {
    if (s[i * (n / g)] != t[i * (m / g)])
    {
      puts("-1");
      return 0;
    }
  }
  printf("%lld\n", n / g * m);
  return 0;
}

Measured memory_bytes: 384
N = int(input())
A = []
a = []
for i in range(N):
    x = int(input())
    if x==0:
        b = a[:]
        A.append(b)
        a = []
    else:
        a.append(x)
A.append(a)
cnt = 0
for a in A:
    c = sum(a)
    cnt += c//2
print(cnt)

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

#define mp make_pair
#define pb push_back


typedef long long ll;
typedef long long llong;
typedef long double ld;

using namespace std;

template <typename T> void dprint(T begin, T end) {
    for (auto i = begin; i != end; i++) {
        cerr << (*i) << " ";
    }
    cerr << "\n";
}


int c1 = 0;
int n, p;

int main() {
    cin >> n >> p;
    for (int i = 0; i < n; ++i) {
        int x;
        cin >> x;
        if (x % 2 == 1)
            ++c1;
    }
    if (c1) {
        cout << (1ll << (n - 1)) << "\n";
    }
    else if (p == 0) {
        cout << (1ll << n) << "\n";
    }
    else {
        cout << 0 << "\n";
    }
    return 0;
}




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

int main(void){
    int A, B;
    scanf("%d %d", &A, &B);
    int price = 0;

    if (A >= 13){
        price = B;
    }else if(A >= 6){
        price = B / 2;
    }else{;
        price = 0;
    }

    cout << price << endl;
}

Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")

#include <bits/stdc++.h>
using namespace std;
vector<long long> calc_n_maxs(vector<int> arr){
  // calculates for each index between n and 2 * n, the sum of the n maximum numbers
  int n = arr.size() / 3;
  vector<long long> sum(n + 1);
  set<pair<int, int>> current;

  for(int i = 0;i < n;i++){
    sum[0] += arr[i];
    current.insert({arr[i], i});
  }
  pair<int, int> min_max = *current.begin();
  for(int i = n;i < 2 * n;i++){
    pair<int, int> to_add = {arr[i], i};
    current.insert(to_add);
    sum[i - n + 1] = sum[i - n];
    if(to_add > min_max){
      sum[i - n + 1] += to_add.first - min_max.first;
      min_max = *current.upper_bound(min_max);
    }
  }
  return sum;
}
int main()
{
//  freopen("in.txt", "r", stdin);
//  freopen("out.txt", "w", stdout);
  int n;
  cin >> n;
  vector<int> arr(3 * n);
  for(int i = 0;i < 3 * n;i++)
    cin >> arr[i];

  vector<long long> first_half = calc_n_maxs(arr);
  reverse(arr.begin(), arr.end());
  for(int i = 0;i < 2 * n;i++)
    arr[i] *= -1;
  vector<long long> second_half = calc_n_maxs(arr);
  long long res = -1e18;
  for(int i = 0;i < n + 1;i++)
    res = max(res, first_half[i] + second_half[n - i]);
  cout << res;
}


Measured memory_bytes: 13548
#include <iostream>
#include <math.h>
#include <algorithm>
#include <vector>
#include <numeric>
#include <string>
using namespace std;
const double PI = acos(-1.0);
const string alp = "abcdefghijklmnopqrstuvwxyz";
const string ALP = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define SUM(c) accumulate((c).begin(),(c).end(),0)

int main(){
  long a,b,x;
  cin >> a >> b >> x;
  if (a%x==0) {
    cout << b/x-a/x+1;
    return 0;
  };
  cout << b/x-a/x;
  return 0;
}

Measured memory_bytes: 256
/////////////////////////////////////////////////////////
//
//  c/temp.cpp file
//  Last Updated: 2018-10-23 ...Maybe
//
//    I hope you adding this code to the setting file
//    alias g++='g++ -std=c++1y -DDEBUG_LOCAL'
//
/////////////////////////////////////////////////////////

#include <bits/stdc++.h>

using namespace std;

#define fi first
#define se second
#define mp make_pair
#define pb push_back

//#define int long long

#define _overload3(_1,_2,_3,name,...) name
#define _REP(i,n) REAP(i,0,n)
#define REAP(i,a,b) for(int i=int(a);i<int(b);++i)
#define REP(...) _overload3(__VA_ARGS__,REAP,_REP,)(__VA_ARGS__)

#define _REPR(i,n) REAPR(i,n,0)
#define REAPR(i,a,b) for(int i=int(a-1);i>=int(b);--i)
#define REPR(...) _overload3(__VA_ARGS__,REAPR,_REPR,)(__VA_ARGS__)

#define ALL(a) a.begin(),a.end()
#define rALL(a) a.rbegin(),a.rend()

#define coutALL(a) {int loop_coutALL=0;for(auto e:a) cout<<(loop_coutALL++?" ":"")<<e; cout<<endl;}

#define coutYN(a) cout<<((a)?"YES":"NO")<<endl;
#define coutYn(a) cout<<((a)?"Yes":"No")<<endl;
#define coutyn(a) cout<<((a)?"yes":"no")<<endl;

#define pcnt __builtin_popcount
#define buli(x) __builtin_popcountll(x)

const int INF=1145141919;
//const long long INF=114514191911451419;
const int MOD=(int)1e9+7;
const double EPS=1e-12;
const int dx[]={1,0,-1,0},dy[]={0,1,0,-1};
//const int dx[]={-1,-1,-1,0,1,1,1,0},dy[]={-1,0,1,1,1,0,-1,-1};

using vi=vector<int>;
using vvi=vector<vi>;
using vs=vector<string>;

typedef pair<int,int> pii;
typedef pair<int,string> pis;
typedef pair<string,int> psi;
typedef pair<string,string> pss;

typedef long long ll;

template<typename T> istream &operator >> (istream &is, vector<T> &v){for(T &x:v) is>>x;return is;}
template<typename T> ostream &operator << (ostream &os, vector<T> &v){int i=0;for(T &x:v) os<<(i++?" ":"")<<x;return os;}

ll rev(ll n){ll x=0;for(;n>0;){x=x*10+n%10;n/=10;}return x;}

ll upper(ll n,ll m){return (n+m-1)/m;};
ll rounding(ll n){return (long double)n+0.5;};

bool inG(ll x,ll n){return 0<=x && x<n;}
bool outG(ll x,ll n){return x<0 || n<=x;}

inline int qp(int a,ll b){if(!b)return 1;int ans=1;do{if(b&1)ans=1ll*ans*a;a=1ll*a*a;}while(b>>=1);return ans;}
inline int qp(int a,ll b,int mo){if(!b)return 1;int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}

inline ll fac(ll k,ll n){ll a=1;for(int i=0;i<n;i++)a*=k--;return a;}
inline ll fac(ll k,ll n,int mo){ll a=1;for(int i=0;i<n;i++)a*=k--,a%=mo;return a;}

inline int dsum(ll n){int a=0;for(;n;n/=10)a+=n%10;return a;}

struct Arithmetic{Arithmetic(){cin.tie(0);ios::sync_with_stdio(0);cout<<fixed<<setprecision(20);}};

//#define DEBUG_LOCAL

#ifdef DEBUG_LOCAL
template<typename T> void deb(T a){cerr<<"deb: "<<a<<"です"<<endl;}
#define debl {cerr<<"debug: "<<__LINE__<<"行目だ"<<endl;}
void what_cr(){cout<<__GCC_ATOMIC_CHAR16_T_LOCK_FREE<<" ←？"<<endl;}
//ori_func S

//ori_func E
#else
template<typename T>void deb(T a){}
#define debl
void what_cr(){}void t_t(){}
#endif

signed main(){

  Arithmetic Exception;

  int k;
  string s;

  cin>>k>>s;

  cout<<s.substr(0,k)+("...\0"+(s.size()<=k)*4)<<endl;

  return 0;

}


Measured memory_bytes: 3608
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <limits>
#include <numeric>

using namespace std;
typedef long long int ll;
typedef long double ld;
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }                   // 最大公約数
ll lcm(ll a, ll b) { return a * b / gcd(a, b); };                      // 最小公倍数
ll getDigit(ll num) { return log10(num) + 1; }                         // 桁数
ll digitSum(ll n) { return (n < 10) ? n : digitSum(n / 10) + n % 10; } // 各桁の和
#define MOD 1e9 + 7
#define pb push_back
#define rep(i, n) for (ll i = 0; i < n; i++)
#define repn(i, n) for (ll i = 1; i <= n; i++)
#define repi(i, a, b) for (ll i = ll(a); i < ll(b); ++i)
#define all(x) (x).begin(), (x).end()
#define PI 3.14159265359

template <typename T>
void printVector(string name, vector<T> vec)
{
    cout << name << ": ";
    rep(i, vec.size())
    {
        cout << vec[i] << " ";
    }
    cout << endl;
}

// 割る数の初期値
ll a = 2;
vector<ll> cal(ll n)
{
    vector<ll> rtn;

    while (n >= a * a)
    {
        // a で割り切れたら、a は素因数
        // そして、割られる数を a で割る
        // a で割り切れなかったら、 a を 1 増加させる
        if (n % a == 0)
        {
            rtn.pb(a);
            n /= a;
        }
        else
        {
            a++;
        }
    }

    // 最後に残った n は素因数
    rtn.pb(n);
    return rtn;
}

void Main()
{
    int n, k;
    cin >> n >> k;
    string s;
    cin >> s;
    if (s[k - 1] == 'A')
        s[k - 1] = 'a';
    if (s[k - 1] == 'B')
        s[k - 1] = 'b';
    if (s[k - 1] == 'C')
        s[k - 1] = 'c';

    cout << s << endl;
    return;
}

signed main(void)
{
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 256
n = int(input())
st = input()
i = 0
le = len(st)
r = 0
b = 0
while i < le:
  if st[i] == "R":
    r += 1
  else:
    b += 1
  i += 1
if r > b:
  print("Yes")
else:
  print("No")
    


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

//INSERT ABOVE HERE
const Int MAX = 404;
const Int INF = 1e15;
Int n;
Int a[MAX],s[MAX];
Int dp[MAX][MAX];
Int dfs(Int l,Int r){
  if(l+1==r) return 0;
  Int &res=dp[l][r];
  if(~res) return res;
  res=INF;
  for(Int k=l+1;k<r;k++)
    chmin(res,s[r]-s[l]+dfs(l,k)+dfs(k,r));
  return res;
}
signed main(){
  cin>>n;  
  for(Int i=0;i<n;i++) cin>>a[i];
  s[0]=0;
  for(Int i=0;i<n;i++) s[i+1]=s[i]+a[i];
  memset(dp,-1,sizeof(dp));
  cout<<dfs(0,n)<<endl;
  return 0;
}


Measured memory_bytes: 1536
import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		char[] arr = sc.next().toCharArray();
		int len = arr.length;
		long total = 0;
		for (int i = 0; i < pow2(len - 1); i++) {
			ArrayList<Long> list = new ArrayList<>();
			long tmp = arr[0] - '0';
			for (int j = 1; j < len; j++) {
				int x = arr[j] - '0';
				if ((i / pow2(j - 1)) % 2 == 1) {
					tmp  = tmp * 10 + x;
				} else {
					list.add(tmp);
					tmp = x;
				}
			}
			long sum = tmp;
			for (long x : list) {
				sum += x;
			}
			total += sum;
		}
		System.out.println(total);
	}
	
	static int pow2(int x) {
		if (x == 0) {
			return 1;
		} else {
			return 2 * pow2(x - 1);
		}
	}
	
}


Measured memory_bytes: 21716
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
from collections import Counter
def main():
    n = int(input())
    d1 = {'AC':0, 'WA':0, 'TLE': 0,'RE':0}
    s = []
    for _ in range(n):
        s.append(input())
    sa = Counter(s)
    for k, v in sa.items():
        d1[k] += v
    print('AC x', d1['AC'])
    print('WA x', d1['WA'])
    print('TLE x', d1['TLE'])
    print('RE x', d1['RE'])

if __name__ == '__main__':
    main()


Measured memory_bytes: 16552
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;

#define CIN_ONLY if(1)
struct cww{cww(){
    CIN_ONLY{
        ios::sync_with_stdio(false);cin.tie(0);
    }
}}star;
#define fin "\n"
#define FOR(i,bg,ed) for(int i=(bg);i<(ed);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
#define pb push_back
#define DEBUG if(0)
#define REC(ret, ...) std::function<ret (__VA_ARGS__)>
template <typename T>inline void chmin(T &l,T r){l=min(l,r);}
template <typename T>inline void chmax(T &l,T r){l=max(l,r);}
template <typename T>
istream& operator>>(istream &is,vector<T> &v){
    for(auto &it:v)is>>it;
    return is;
}

int x[10123];
int y[10123];
LL t[10123];
typedef vector<LL> V;
typedef vector<V> VV;
int main(){

    int n,m;
    cin>>n>>m;
    VV g(n+1);
    REP(i,m){
        cin>>x[i]>>y[i]>>t[i];
        g[x[i]].pb(i);
        g[y[i]].pb(i);
    }
    int v0,a,b,c;
    cin>>v0;

    cin>>a>>b>>c;
    using T=tuple<LL,int,int,int>;
    priority_queue<T> que;
    const LL INF=1e12;
    vector<VV> D(n+1,VV(c,V(2,INF)));
    que.push(T(0,1,v0,0));
    D[1][v0][0]=0;
    while(que.size()){
        LL cost;int u,v,vis;
        
        tie(cost,u,v,vis)=que.top();que.pop();
        cost=-cost;
        //       cout<<u<<v<<vis<<cost<<endl;
        if(D[u][v][vis]<cost)continue;
        int nv=(v*a+b)%c;
        for(auto &e:g[u]){
            int nu=u^x[e]^y[e];
            int nvis=vis;
            LL ncost=cost+t[e]*v;
            if(nu==n)nvis=1;
            if(D[nu][nv][nvis]>ncost){
                D[nu][nv][nvis]=ncost;
                que.push(T(-ncost,nu,nv,nvis));
            }
        }
        
    }
    LL res=INF;
    REP(i,c)chmin(res,D[1][i][1]);
    cout<<res<<endl;
    return 0;
}

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

using ll = long long;
using ull = unsigned long long;
using ld = long double;
#define REP(NAME, NUM) for (size_t NAME = 0; NAME < (NUM); ++NAME)
#define BREP(NAME, NUM) for (size_t NAME = (NUM)-1; NAME >= 0; --NAME)
#define ALL(NAME) (NAME).begin(), (NAME).end()
#define VEC(TYPE, A, NAME, INIT) vector<TYPE> NAME(A, INIT)
#define VEC2(TYPE, A, B, NAME, INIT) vector<vector<TYPE>> NAME(A, vector<TYPE>(B, (INIT)))

int main()
{
	ll n, a, b;
	cin >> n>>a>>b;
	VEC(ll,n,p,0);
	VEC(ll,n,q,0);
	REP(i,n)
	{
		cin>>p[i];
		q[p[i]-1] = i;
	}
	VEC2(ll,n+1,n,dp,0);

	REP(i,n) REP(j,n)
	{
		ll cost = 0;
		if( q[i] < j ) cost = a;
		else if( q[i] > j ) cost = b;
		dp[i+1][j] = j == 0
			? dp[i][j] + cost
			: min( dp[i+1][j-1], dp[i][j] + cost );
	}

	cout << dp[n][n-1] << endl;

	return 0;
}

Measured memory_bytes: 195968
// Author : Chi
// created :

//header files
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

//macros
#define ll 		    long long
#define ss          second
#define ff          first
#define vi          vector<int>
#define vll         vector<long long>
#define pb          push_back
#define TEST  	    int TesT;cin>>TesT;while(TesT--)solve();
#define TEST1       solve();
#define mod         998244353
#define r0n(i,n)    for(ll i = 0; i < n; ++i)
#define r1n(i,n)    for(ll i = 1; i <= n; ++i)
#define CHI         ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
//namespaces
using    namespace __gnu_pbds;
using    namespace std;

typedef tree <int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update > ordered_set;
typedef struct item{
    int a,b;
}I;
ll m[100001][100];
ll rec(I s[],int W,int in,int N){
    if(in == N || W <= 0)
        return 0;
    if(m[W][in]!=-1)
        return m[W][in];
    ll ans1=0;
    if( W-s[in].a >= 0)
        ans1=rec(s, W-s[in].a, in+1, N) + s[in].b;
    ll ans2=rec(s,W-0,in+1,N);
    return m[W][in]=max(ans1,ans2);
}
void solve(){
    int N,W;
    cin>>N>>W;
    I s[N];
    r0n(i,N)
        cin>>s[i].a>>s[i].b;
    memset(m,-1, sizeof m);
    cout<<rec(s,W,0,N);
}
// Driver Code
int main()
{
    TEST1
    return 0;
}




Measured memory_bytes: 78336
#include <iostream>
#include <string>
#include <queue>
#include <algorithm>
using namespace std;

int main(){
    int n, q, t;
    string name;
    queue<pair<string, int> > Q;

    cin >> n >> q;

    for (int i = 0; i < n; i++){
        cin >> name >> t;
        Q.push(make_pair(name, t));
    }

    pair<string, int> u;
    int elaps = 0, a;

    while( !Q.empty()){
        u = Q.front(); Q.pop();
        a = min(u.second, q); //qまたは必要な時間u.tだけ処理を行う
        u.second -= a;
        elaps += a;
        if ( u.second > 0){
            Q.push(u);
        }else{
            cout << u.first << " " << elaps << endl;
        }
    }

    return 0;
}


Measured memory_bytes: 6228
n = int(input())
a = list(map(int,input().split()))
m1 = 0
cnt1 = 0
f = 1
for i in range(n):
    f *= -1
    m1 += a[i]
    if f == 1:
        if m1 <= 0:
            cnt1 += f-m1
            m1 += f-m1
    else:
        if m1 >= 0:
            cnt1 += m1-f
            m1 -= m1-f
m2 = 0
cnt2 = 0
f = -1
for i in range(n):
    f *= -1
    m2 += a[i]
    if f == 1:
        if m2 <= 0:
            cnt2 += f-m2
            m2 += f-m2
    else:
        if m2 >= 0:
            cnt2 += m2-f
            m2 -= m2-f

print(min(cnt1, cnt2))

Measured memory_bytes: 14468
import java.util.Scanner;

class Main{
    public static void main(String[] args){
	Scanner scan = new Scanner(System.in);
	String st = scan.next();
	int a = Integer.parseInt(st);
	st = scan.next();
	int b = Integer.parseInt(st);
	st = scan.next();
	int c = Integer.parseInt(st);
	
	if((a < b) && (b < c))
	    {
		if(b < c) System.out.println("Yes");
		
	    }
	else System.out.println("No");
    }
}



Measured memory_bytes: 26116
#include<bits/stdc++.h>
#define ll          double
#define pb          push_back
#define eb          emplace_back
#define c(P)        cout<<P<<"\n"
#define pii         pair<ll,ll>
#define mi          map<ll,ll>
#define mii         map<pii,ll>
#define F           first
#define S           second
#define mp(x,y)     make_pair(x,y) 
#define mem(a,val)  memset(a,val,sizeof(a))
#define fr(i,a,n)   for(ll i=a;i<n;i++)
#define frr(i,a,n)  for(ll i=n-1;i>=a;i--)


const ll N   =  500005;
const ll mod = 1e9 + 7;

using namespace std;


void solve()
{
// string s;
  ll n,m,k,x=0,y=0,c=0,q,ans=0;
  cin>>n>>m>>x>>y;
  c = (n+m/2);
  if(x==n/2 and y==m/2)
  {
    cout<<setprecision(10)<<fixed<<(n*m)/2<<" ";
     cout<<1;
    return;
  }
  else
  {
     cout<<setprecision(10)<<fixed<<(n*m)/2<<" ";
     cout<<0;
  }

}

signed main(){
 
      ios_base::sync_with_stdio(false);   
      cin.tie(NULL);
      ll T=1;
      //cin>>T;
      while(T--)
      {
      solve();
      }
      return 0;
    }


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <unordered_map>
#include <unordered_set>
#define initdp(a, b)  for (int i = 0; i <= a; i++)   for (int j = 0; j <= b; j++) dp[i][j] = -1;
#define fi first
#define se second
#define pb push_back
#define pii pair<int, int>
#define ll long long
#define pll pair<ll, ll>
#define all(arr) arr.begin(), arr.end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repd(i, n) for (int i = n - 1; i >= 0; i--)
#define fo(i, l, r) for (int i = l; i <= r; i++)
#define inf 1000000001
#define inf1 1000000000000000001
#define mod 1000000007
#define pie 3.14159265358979323846
#define N 1000005
#define mid(l, r) l + (r - l) / 2
#define vec vector<int>
#define vecl vector<ll>
#define yes cout << "YES" << endl;
#define no cout << "NO" << endl;
#define umapi unordered_map<ll, ll>
#define umapc unordered_map<char, int>
#define endl "\n"
#define pui pair<int, pair<int,int> >
using namespace std;



/*
            ॐ
    || Jai Shree Ram ||  
 
 */

void solve(){
    
    vec arr(5);
    rep(i,5) {
        cin>>arr[i];
    }

    rep(i,5) {
        if(arr[i] == 0) {
            cout<<i+1;
            return;
        }
    }

}

 
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cout<<fixed<<setprecision(25);
    int t = 1;
    // //cin >> t;
    while (t--)
    {
        solve();
    }
}



Measured memory_bytes: 3652
n,c = gets.split.map(&:to_i)

t = []
n.times {t << gets.split.map(&:to_i)}
t.sort!{|a,b| a[0] <=> b[0]}

rec = []
ch_rec = Array.new(c+1)
t.each do |s,t,ch|
    if ch_rec[ch] && rec[ch_rec[ch]][0] <= s
        rec[ch_rec[ch]][0] = t
    else
        j = true

        rec.each_with_index do |rec_e,index|
            if rec_e[0] < s
                ch_rec[rec_e[1]] = nil
                ch_rec[ch] = index
                rec[index] = [t,ch]
                j = false
                break
            end
        end

        if j
            rec << [t,ch]
            ch_rec[ch] = rec.size - 1
        end
    end
end

puts rec.size

Measured memory_bytes: 10600
#include <stdio.h>

int main() {

	int n, i, j, k, ans[100] = {0},count = 0;
	int Y[100], M[100], D[100];

	scanf("%d", &n);

	for (i = 0; i < n; i++) {
		scanf("%d %d %d", &Y[i], &M[i], &D[i]);
	}
	
	for (i = 0; i < n; i++) {
		for (j = Y[i]; j < 1000; j++) {
			if (count == 0) {
				for (k = M[i]; k <= 10; k++) {
					if (j % 3 == 0 || k % 2 == 1)
						ans[i] += 20;
					else
						ans[i] += 19;
				}
			}
			else {
				for (k = 1; k <= 10; k++) {
					if (j % 3 == 0 || k % 2 == 1)
						ans[i] += 20;
					else
						ans[i] += 19;
				}
			}
			count++;
		}
		count = 0;
		
	}

	for (i = 0; i < n; i++)
		printf("%d\n", ans[i] - D[i] + 1);

	return 0;
}

Measured memory_bytes: 596
import java.util.Scanner;

public class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int ans = 0;
    while(true){
      int n = (a * ans) - (ans - 1);
      if(b <= n) break;
      ans++;
    }
    System.out.println(ans);
  }
}


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

int main(){

    int N; cin >> N;
    ll ans=0;
    int A[N+1],B[N];
    for(int i=0;i<N+1;i++) cin >> A[i];
    for(int i=0;i<N;i++) cin >> B[i];
    
    for(int i=0;i<N;i++){
        
        ans += min(A[i],B[i]);
        B[i] -= min(A[i],B[i]);
        if(B[i] > 0){ ans += min(A[i+1],B[i]); A[i+1] -= min(A[i+1],B[i]); }
    }
    
    cout << ans << endl;
} 

Measured memory_bytes: 4352
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main() {
int H, W;
cin >> H >> W;
vector<string> data(H);
for (int i = 0; i < H; i++) cin >> data[i];
for (int i = 0; i < H; i++) for (int k = 0; k < W; k++) if (data[i][k] == '.') {
int hoge =0;
for (int y = i-1; y <= i+1; y++) for (int x = k-1; x <= k+1; x++) {
if (y >= 0 && y < H && x >= 0 && x < W && data[y][x] == '#') hoge++;
}
data[i][k] = hoge+'0';
}
for (int i = 0; i < H; i++) cout << data[i] << endl;
return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <stdio.h>
using namespace std;

int main()
{
  double x1, x2, y1, y2, distance;

  cin >> x1 >> y1 >> x2 >> y2;
    
  distance = sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));

  printf("%f\n", distance);

  return 0;
}


Measured memory_bytes: 3204
import sys


def slove():
    input = sys.stdin.readline
    n = int(input().rstrip('\n'))
    s = [int(input().rstrip('\n')) for _ in range(n)]
    s.sort()
    sm = sum(s)
    if sm % 10 == 0:
        for i in range(n):
            if s[i] % 10 != 0:
                print(sm - s[i])
                exit()
        print(0)
    else:
        print(sm)


if __name__ == '__main__':
    slove()


Measured memory_bytes: 38256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
#define rep(i,n) for (ll i=0;i<n;++i)
const ll MOD=1000000007;
const ll INF=1000000000;

int main(){
    int N;
    string S;
    cin >> N >> S;
    map<char,int> m;
    rep (i,N){
        m[S[i]]++;
    }
    ll ans=1;
    for (auto x:m){
        ans=ans*(x.second+1)%MOD;
    }
    ans-=1;
    cout << ans%MOD << endl;
}

Measured memory_bytes: 512
#include<iostream>
#include<cmath>
using namespace std;
int main() {
	int a, b, c; cin>>a>>b>>c;
	if(b>a) {
		if(c<b&&c>a)cout<<"Yes";
		else cout<<"No";
	}
	else if(a>b) {
		if(c>b&&c<a)cout<<"Yes";
		else cout<<"No";
	}
	cout<<endl;
	return 0;
}

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

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

  int a[n];

  for(int i = 0; i < n; i++)
  {
    cin >> a[i];
  }

  int dp[n];
  memset(dp, 0, sizeof(dp));

  for(int i = 0; i < n; i++)
  {
    if(i == 0)
      dp[i] = 0;
    else if(i == 1)
      dp[i] = abs(a[1] - a[0]);
    else
      dp[i] = min(dp[i-1] + abs(a[i] - a[i-1]), dp[i-2] + abs(a[i] - a[i-2]));
  }

  cout << dp[n-1];
  return 0;
}


Measured memory_bytes: 1024
#include<stdio.h>
int main(void){
  int i,j;
  int ymd[100][3],n,y3=590,date;
 
  scanf("%d", &n);
  for(i=0; i<n; i++) {
    for(j=0; j<3; j++) {
      scanf("%d", &ymd[i][j]);
    }
  }
 
  for(i=0;i<n;i++) {
    date = 0;
    date += ((ymd[i][0]-1)/3)*y3;
    switch(ymd[i][0]%3){
    case 2:
      date += 195;
      for(j=0;j<ymd[i][1]-1;j++) {
    j%2 ? (date += 19):(date += 20);
      }
      date += ymd[i][2];
      break;
       
    case 1:
      for(j=0;j<ymd[i][1]-1;j++) {
    j%2 ? (date += 19):(date += 20);
      }
      date += ymd[i][2];
      break;
       
    case 0:
      date += 390;
      for(j=0;j<ymd[i][1]-1;j++) {
    date += 20;
      }
      date += ymd[i][2];
      break;
    }
    printf("%d\n", 196471 - date);
  }
 
  return 0;
}
      

Measured memory_bytes: 596
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Numerics;

namespace AtCoderWorkspace
{
    public class Solver
    {
        public void Solve()
        {
            var cin = new Scanner();
            var s = cin.nextInt();
            var set = new HashSet<int>();
            set.Add(s);
            var count = 1;
            while (true)
            {
                if(s % 2 == 0)
                {
                    s = s / 2;
                }
                else
                {
                    s = 3 * s + 1;
                }
                count++;
                if (set.Contains(s))
                {
                    Console.WriteLine(count);
                    return;
                }
                
                set.Add(s);
            }
        }
    }

    class Scanner
    {
        string[] s;
        int i;

        char[] cs = new char[] { ' ' };

        public Scanner()
        {
            s = new string[0];
            i = 0;
        }

        public string next()
        {
            if (i < s.Length) return s[i++];
            string st = Console.ReadLine();
            while (st == "") st = Console.ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            if (s.Length == 0) return next();
            i = 0;
            return s[i++];
        }

        public int nextInt()
        {
            return int.Parse(next());
        }
        public int[] ArrayInt(int N, int add = 0)
        {
            int[] Array = new int[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextInt() + add;
            }
            return Array;
        }

        public int[] DPArrayInt(int N, int ex)
        {
            int[] Array = new int[N + ex];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextInt();
            }
            return Array;
        }

        public long nextLong()
        {
            return long.Parse(next());
        }

        public long[] ArrayLong(int N, long add = 0)
        {
            long[] Array = new long[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextLong() + add;
            }
            return Array;
        }

        public long[] DPArrayLong(int N, int ex)
        {
            long[] Array = new long[N + ex];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextLong();
            }
            return Array;
        }

        public double nextDouble()
        {
            return double.Parse(next());
        }


        public double[] ArrayDouble(int N, double add = 0)
        {
            double[] Array = new double[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextDouble() + add;
            }
            return Array;
        }
    }

    class Program
    {
        static void Main(string[] s) => new Solver().Solve();
    }
}


Measured memory_bytes: 13396
A = [1, 3, 5, 7, 8, 10, 12]
B = [4, 6, 9, 11]
C = [2]

x,y = gets.chomp.split(' ').map(&:to_i)

if A.include?(x) then
  x = 'A'
elsif B.include?(x) then
  x = 'B'
else
  x = 'C'
end

if A.include?(y) then
  y = 'A'
elsif B.include?(y) then
  y = 'B'
else
  y = 'C'
end

if x == y then
  puts 'Yes'
else
  puts 'No'
end

Measured memory_bytes: 1788
fun main(args: Array<String>) {
    val (a,b,k) = readLine()!!.split(' ').map{ it.toLong()}

    var aa = a-k
    if (aa < 0L) aa = 0L
    var kk = k-a
    if (kk < 0L) kk = 0L
    var bb = b-kk
    if (bb < 0L) bb = 0L
    println("$aa $bb")
}


Measured memory_bytes: 38132
#include <iostream>
#include <vector>
#include <cstring>
using namespace std;

#define MAXN 1500
#define MAXKIND 1000*MAXN
int h[MAXKIND], w[MAXKIND];

int main(int argc, const char * argv[]) {
    while(1){
        int n, m; cin >> n >> m;
        if(!n && !m) break;
        
        int hh[MAXN] = {0}, ww[MAXN] = {0};
        memset(h, 0, sizeof(h));
        for(int i = 0; i < n; i++){
            cin >> hh[i]; h[hh[i]]++;
        }
        for(int i = 0; i < n; i++){
            int height = hh[i];
            for(int j = i+1; j < n; j++){
                height += hh[j];
                h[height]++;
            }
        }
        
        memset(w, 0, sizeof(w));
        for(int i = 0; i < m; i++){
            cin >> ww[i]; w[ww[i]]++;
        }
        for(int i = 0; i < m; i++){
            int width = ww[i];
            for(int j = i+1; j < m; j++){
                width += ww[j];
                w[width]++;
            }
        }
        
        int cnt = 0;
        for(long i = 0; i < MAXKIND; i++){
            cnt += h[i] * w[i];
        }
        cout << cnt << endl;
    }
}

Measured memory_bytes: 12896
x,k,d = map(int,input().split())
if abs(x) >= k*d:
    if x>=0:
        print(x-k*d)
    else:
        print(-x-k*d)

else:
    if x>=0:
        count=x//d
        if (k-count)%2 == 0:
            print(x-d*count)
        else:
            print(d*(count+1)-x)
    else:
        count=abs(x)//d
        if (k-count)%2 == 0:
            print(-x-d*count)
        else:
            print(x+d*(count+1))
        
    

Measured memory_bytes: 61824
#include<bits/stdc++.h>
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define sz(x)  (long long)(x).size()
#define sqr(x) (x)*(x)
#define sof sizeof
#define ins insert
#define lowerB lower_bound
#define upperB upper_bound
#define mkp make_pair
#define mkt make_tuple
#define act(a,v) (get<(long long)a>(v))
#define mod 1000000007
#define mod1 998244353
#define N 1000003
#define inf 1e18
#define minf -1e18
#define min3(a,b,c) min(a,min(b,c));
#define max3(a,b,c) max(a,max(b,c));
#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 sumall(v) accumulate(all(v),(ll)0)
#define sum accumulate
#define FastIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define PRECISION std::cout.unsetf ( std::ios::floatfield );std::cout.precision(15)
#define PI M_PI
#define fi first
#define se second
#define here cout<<"RSSB"<<endl
#define showzero cout<<std::showpoint
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*b)/gcd(a,b)
#define br "\n"
#define sp " "
#define zero (ll)0
using namespace  std ;
typedef double db;
typedef long long ll ;
typedef vector<int>vi ;
//typedef vector<l>vl ;
typedef vector<ll>vll ;
typedef vector<vector<ll> >vvl ;
typedef pair<int,int> pii ;
typedef pair<ll,ll> pll ;
typedef vector<pll>vpll;
typedef vector<string>vstr;
typedef vector<bool>vbool ;
void READ(vll &v, ll n)
{
    ll a ;
    for(ll i=0 ; i<n ; i=i+1)
    {
        cin>>a ;
        v.pb(a) ;
    }
}
void PRINT(vll &v , ll a = 0)
{
    //ll a ;
    for(ll i=a ; i<v.size() ; i=i+1)
    {
        v[i] = max((ll)0,v[i]);
        cout<<v[i]<<" " ;
    }
    cout<<"\n" ;
}
/*vbool isprime(N,true);
vll spf(N,0);
vll prime;
void sieve()
{
    isprime[0] = isprime[1] = false;
    for(ll i = 2 ; i<N ; i++)
    {
        if(isprime[i])
        {
            for(ll j=2*i ; j<N ; j+=i)
            {
                isprime[j] = false;
                if(spf[j]==0)
                {
                    spf[j] = i;
                }
            }
            prime.pb(i);
        }
    }
}*//*
ll nck(ll n , ll k ,ll m=1e18+7)
{
    ll i , j,b=1,c=1 ;
    if(n-k<k)
    {
        k = n-k ;
    }
    while(k)
    {
        b*=n ;
        c*=k ;
        ll g = __gcd(b,c) ;
        b/=g ;
        c/=g ;
        n--;
        k-- ;
    }
    return(b) ;
}*//*
long long power(long long k , long long n , long long m=mod)
{
    long long res = 1;
    while(n)
    {
        if(n%2!=0)
        {
            res = (res*k)%m ;
        }
        k = (k*k)%m ;
        n = n/2 ;
    }
    return(res) ;
}*/
ll n,m,k,l,r;
bool ok = false;
int main()
{
    FastIO ;
    PRECISION ;
    ll a,b,c,d,i,j,t,x,y,z;//,x1,y1,z1,e,f;
    ll p,q,r,u,w ;
    char ch,chr ;
    string str,st,str1,str2,str3,str4;
    //ll a1=0,a2=0,b1=0,b2=0,c1=0 ;
    //cin>>str>>str1;
    cin>>a>>b>>c;
    cout<<c<<sp<<a<<sp<<b;
}

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

#include <boost/range/adaptors.hpp>
#include <boost/range/irange.hpp>

using namespace std;
using namespace boost;
using namespace boost::adaptors;

constexpr auto INVALID = 1L << 30;

bool calc_range(const vector<vector<int64_t>>& adjs, const vector<int64_t>& p,
                vector<pair<int64_t, int64_t>>& range, int64_t v,
                int64_t prev) {
    auto& r = range[v];
    if (p[v] != -1) {
        r.first = r.second = p[v];
    }

    for (auto u : adjs[v]) {
        if (u == prev) {
            continue;
        }

        if (!calc_range(adjs, p, range, u, v)) {
            return false;
        }

        const auto& r2 = range[u];
        if (r2.first != INVALID) {
            if (r.first == INVALID) {
                r.first = r2.first - 1;
                r.second = r2.second + 1;
            } else if ((r.first - (r2.first - 1)) % 2 != 0) {
                return false;
            } else {
                r.first = max(r.first, r2.first - 1);
                r.second = min(r.second, r2.second + 1);
            }
        }
    }

    return r.first <= r.second;
}

void assign_value(const vector<vector<int64_t>>& adjs,
                  const vector<pair<int64_t, int64_t>>& range,
                  vector<int64_t>& values, int64_t v, int64_t prev) {
    for (auto u : adjs[v]) {
        if (u == prev) {
            continue;
        }

        values[u] = values[v] - 1;
        if (range[u].first != INVALID && values[u] < range[u].first) {
            values[u] = values[v] + 1;
        }
        assert(range[u].second == INVALID || values[u] <= range[u].second);
        assign_value(adjs, range, values, u, v);
    }
}

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

    vector<vector<int64_t>> adjs(n);
    for (auto _ : irange(0L, n - 1)) {
        int64_t a, b;
        cin >> a >> b;
        --a;
        --b;
        adjs[a].push_back(b);
        adjs[b].push_back(a);
    }

    int64_t k;
    cin >> k;

    vector<int64_t> p(n, -1);
    for (auto _ : irange(0L, k)) {
        int64_t v;
        cin >> v;
        --v;
        cin >> p[v];
    }

    vector<pair<int64_t, int64_t>> range(n, make_pair(INVALID, INVALID));
    if (!calc_range(adjs, p, range, 0, -1)) {
        cout << "No" << endl;
        return 0;
    }

    vector<int64_t> ans(n);
    ans[0] = range[0].first;
    assign_value(adjs, range, ans, 0, -1);

    cout << "Yes" << endl;
    for (auto a : ans) {
        cout << a << "\n";
    }
}

Measured memory_bytes: 18944