akhauriyash/Code-Regression huggingface dataset:
//g++ -std=c++14 test.cpp -o test.out

#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <iomanip>
#include <vector>
#include <queue>
#include <stack>
#include <map> 
#include <unordered_map> 
#include <utility>
#include <limits.h>
#include <bitset>
#include <set>
using namespace std;
 
#define LL long long int
const LL INF = (1LL<<60);
const int INF_INT = 2147483647-1e6-1;
const LL mod = 1000000007ll;
const int mod_int = 1000000007;

LL N;
LL stone[3];
string S[100000];

string ans = "No";
vector<char> method;

void solve(){
	LL sum = stone[0]+stone[1]+stone[2];
	if(sum==0) return;
	if(sum==1){
		for(int i=0;i<N;i++){
			if(stone[S[i][0]-'A']==1 || stone[S[i][1]-'A']==1){
				if(stone[S[i][0]-'A']>stone[S[i][1]-'A']){
					stone[S[i][0]-'A']--;
					stone[S[i][1]-'A']++;
					method.push_back(S[i][1]);
				}else{
					stone[S[i][0]-'A']++;
					stone[S[i][1]-'A']--;
					method.push_back(S[i][0]);
				}
			}else return;
		}
	}
	if(sum==2){
		for(int i=0;i<=N-2;i++){
			if(stone[S[i][0]-'A']==0 && stone[S[i][1]-'A']==0) return;
			if(stone[S[i][0]-'A']==1 && stone[S[i][1]-'A']==1){
				if(S[i+1][0]==S[i][0] || S[i+1][1]==S[i][0]){
					stone[S[i][0]-'A']++;
					stone[S[i][1]-'A']--;
					method.push_back(S[i][0]);
				}else if(S[i+1][0]==S[i][1] || S[i+1][1]==S[i][1]){
					stone[S[i][0]-'A']--;
					stone[S[i][1]-'A']++;
					method.push_back(S[i][1]);
				}
			}
			else{
				if(stone[S[i][0]-'A']>stone[S[i][1]-'A']){
					stone[S[i][0]-'A']--;
					stone[S[i][1]-'A']++;
					method.push_back(S[i][1]);
				}else{
					stone[S[i][0]-'A']++;
					stone[S[i][1]-'A']--;
					method.push_back(S[i][0]);
				}
			}
		}

		if(stone[S[N-1][0]-'A']==0 && stone[S[N-1][1]-'A']==0) return;
		if(stone[S[N-1][0]-'A']>stone[S[N-1][1]-'A']){
			stone[S[N-1][0]-'A']--;
			stone[S[N-1][1]-'A']++;
			method.push_back(S[N-1][1]);
		}else{
			stone[S[N-1][0]-'A']++;
			stone[S[N-1][1]-'A']--;
			method.push_back(S[N-1][0]);
		}
	}
	if(sum>=3){
		if(stone[S[0][0]-'A']>=1 || stone[S[0][1]-'A']>=1){
			if(stone[S[0][0]-'A']>stone[S[0][1]-'A']){
				stone[S[0][0]-'A']--;
				stone[S[0][1]-'A']++;
				method.push_back(S[0][1]);
			}else{
				stone[S[0][0]-'A']++;
				stone[S[0][1]-'A']--;
				method.push_back(S[0][0]);
			}
		}else return;
		for(int i=1;i<N;i++){
			if(stone[S[i][0]-'A']>stone[S[i][1]-'A']){
				stone[S[i][0]-'A']--;
				stone[S[i][1]-'A']++;
				method.push_back(S[i][1]);
			}else{
				stone[S[i][0]-'A']++;
				stone[S[i][1]-'A']--;
				method.push_back(S[i][0]);
			}
		}
	}
	ans = "Yes";
}

int main(){
    cin >> N >> stone[0] >> stone[1] >> stone[2];
    for(int i=0;i<N;i++) cin >> S[i];

    solve();

    cout << ans << endl;
    if(ans=="No") return 0;
    for(int i=0;i<method.size();i++) cout << method[i] << endl;
    return 0;
}

Measured memory_bytes: 5608
#!/usr/bin/env python3

from collections import defaultdict

scores = defaultdict(int)

N = int(input())
for _ in range(N):
    S = input()
    assert(S in ['AC', 'WA', 'TLE', 'RE'])
    scores[S] += 1

print(f"AC x {scores['AC']}")
print(f"WA x {scores['WA']}")
print(f"TLE x {scores['TLE']}")
print(f"RE x {scores['RE']}")

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

int dp[11][101];

int main(){
  int n,m;
  for(int i=0;i<11;i++)for(int j=0;j<101;j++)dp[i][j]=0;
  for(int i=0;i<=9;i++)dp[1][i]=1;
  for(int i=2;i<=10;i++){
    for(int j=1;j<=100;j++){
      if(j-i>=0)dp[i][j]+=dp[i][j-i];
      if(j-(i-1)>=0)dp[i][j]+=dp[i-1][j-(i-1)];
      if(j>9)dp[i][j]-=dp[i-1][j-10];
    }
  }
  while(cin>>n>>m){
    if(n==0&&m==0)break;
    cout<<dp[n][m]<<endl;
  }
  return 0;
}

Measured memory_bytes: 1164
//
// Created by GGG1235 on 2019/11/24.
//

#include <bits/stdc++.h>

#pragma GCC optimize(3)

using namespace std;

typedef long long LL;

int main(int argc,const char **argv,const char **envp) 
{
    int nN;
    cin >> nN;
    cout << (nN * 800) - ((nN / 15) * 200) << endl;
    return 0;
}

Measured memory_bytes: 256
object Main extends App {

  val sc = new java.util.Scanner(System.in) 
  val n, k, q = sc.nextInt()
  val a = Array.fill(q)(sc.nextInt()).groupBy(identity).map{ case (k, v) => (k, v.size)}
  (1 to n).foreach(i => if (k + a.get(i).getOrElse(0) - q > 0) println("Yes") else println("No"))
}

Measured memory_bytes: 79464
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, x, n) for (int i = x; i < (n); i++)
#define all(n) begin(n), end(n)
struct cww
{
    cww()
    {
        ios::sync_with_stdio(false);
        cin.tie(0);
    }
} star;
const long long INF = numeric_limits<long long>::max();
typedef long long ll;
typedef vector<int> vint;
typedef vector<char> vchar;
typedef vector<vector<int>> vvint;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef unsigned long long ull;
template <class T>
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }

template <typename T, typename... Ts>
auto make_v(size_t a, Ts... ts)
{
    return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template <typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T &t, const V &v) { t = v; }

template <typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T &t, const V &v)
{
    for (auto &e : t)
        fill_v(e, v);
}
int main()
{
    ll X, Y, Z, K;
    cin >> X >> Y >> Z >> K;
    vll A(X), B(Y), C(Z);
    vll sumAB;
    for (size_t i = 0; i < X; i++)
    {
        cin >> A[i];
    }
    for (size_t i = 0; i < Y; i++)
    {
        cin >> B[i];
    }
    for (size_t i = 0; i < Z; i++)
    {
        cin >> C[i];
    }
    for (size_t i = 0; i < X; i++)
    {
        for (size_t j = 0; j < Y; j++)
        {
            sumAB.push_back(A[i] + B[j]);
        }
    }
    sort(all(sumAB), greater<ll>());
    vll sum;
    for (size_t i = 0; i < K and i<X*Y; i++)
    {
        for (size_t j = 0; j < Z; j++)
        {
            sum.push_back(sumAB[i]+C[j]);
        }
        
    }
    sort(all(sum),greater<ll>());
    for (size_t i = 0; i < K and X*Y*Z; i++)
    {
        cout<<sum[i]<<endl;
    }
    
    return 0;
}

Measured memory_bytes: 43368
import java.util.*;
public class Main {
	static int cnt=0;
	static int n;
	static int bfs(int a,int b,int day){
		int cnt=0;
		if(day==n+1){//もしたどり着けたら1を返す。
			return 1;
		}
		if(m[day][a][b]>-1)return m[day][a][b];//メモしていたらそれを返す。
		if(hyou[day]>0){//指定してある場合
			if(hyou[day]==a&&a==b){//全部一緒だったら0を返す。
				return 0;
			}else{
				return bfs(b,hyou[day],day+1)%10000;//違ったら日にち足して次の日に再帰。
			}
		}
		for(int i=1;i<=3;i++){
			if(a==i&&b==a)continue;
			cnt+=bfs(b,i,day+1)%10000;
		}
		m[day][a][b]=cnt%10000;
		return cnt%10000;
	}
	static int m[][][]=new int[101][4][4];
	static int hyou[]=new int[101];
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		n = in.nextInt();
		int k = in.nextInt();
		for(int s=0;s<101;s++){
			hyou[s]=0;
			for(int i=0;i<4;i++){
				for(int z=0;z<4;z++)m[s][i][z]=-1;
			}
		}
		for(int i=0;i<k;i++){
			int w = in.nextInt();
			hyou[w]=in.nextInt();
		}
		int ans = bfs(0,0,1);
		System.out.println(ans);
	}
}

Measured memory_bytes: 19852
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <string>
#include <cstdlib>
#include <stack>
#include <queue>
#include <cmath>

#define rep(i,j,k) for(int i=(int)j;i<(int)k;i++)
#define vc vector;

const int INF = 100000000;

using namespace std;

void p(int x) {
	cout << x << endl;
}

void pp(string s) {
	cout << s << endl;
}

int main() {
	while (1) {
		int x, y, s;
		cin >> x >> y >> s;
		if (x == 0 && y == 0 && s == 0)break;

		int maxx = 0;
		for (int i = 1; i < s; i++) {
			for (int j = s - 1; j > 0; j--) {
				if ((i*(100 + x)) / 100 + (j*(100 + x)) / 100 == s) {
					maxx = max(maxx, (i*(100 + y)) / 100 + (j*(100 + y)) / 100);
				}
			}
		}

		cout << maxx << endl;
	}

	return 0;
}

Measured memory_bytes: 3028
#include <bits/stdc++.h>
#define R register
#define MN 100005
inline int read(){
	R int x; R bool f; R char c;
	for (f=0; (c=getchar())<'0'||c>'9'; f=c=='-');
	for (x=c^'0'; (c=getchar())>='0'&&c<='9'; x=(x<<1)+(x<<3)+(c^'0'));
	return f?-x:x;
}
int n,a[MN],b[MN],aa[MN],bb[MN],f[MN],vn,ans;bool ud[MN];
inline int gf(int x){return f[x]?f[x]=gf(f[x]):x;}
int main(){
	n=read();for (R int i=1; i<=n; ++i) a[n+1]^=(aa[i]=a[i]=read());
	for (R int i=1; i<=n; ++i) b[n+1]^=(bb[i]=b[i]=read());
	aa[++n]=a[n];bb[n]=b[n];std::sort(aa+1,aa+n+1);std::sort(bb+1,bb+n+1);
	for (R int i=1; i<=n; ++i) if (aa[i]!=bb[i]) return 0*puts("-1");
	vn=std::unique(aa+1,aa+n+1)-aa-1;for (R int i=1,x,y; i<=n; ++i)
		if (i==n||a[i]!=b[i]){
			if (i<n) ++ans;
			x=std::lower_bound(aa+1,aa+vn+1,a[i])-aa;
			y=std::lower_bound(aa+1,aa+vn+1,b[i])-aa;
			ud[x]=ud[y]=1;x=gf(x),y=gf(y);if (x!=y) f[x]=y;
		}for (R int i=1; i<=vn; ++i) if (ud[i]&&!f[i]) ++ans;
	if (!ans) return 0*puts("0");printf("%lld\n",ans-1);return 0;
}

Measured memory_bytes: 3328
#include<iostream>
#include<map>
#include<unordered_map>
#include<set>
#include<vector>
#include<algorithm>
#include<cmath>
#include<string>
#include<queue>
using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef long double ld;
#define mp make_pair
#define pb push_back
// const ll mod = 1000000007;
const ll mod = 998244353;

const ll LLMAX = numeric_limits<long long>::max();

void sayNo() {
	cout << "No" << endl;
}

void sayYes() {
	cout << "Yes" << endl;
}


int main() {
	ll A, B;
	cin >> A >> B;

	string imp = "IMPOSSIBLE";

	ll K = A + B;

	if (K % 2 == 1) {
		cout << imp << endl;
	}
	else {
		cout << K / 2 << endl;
	}

	return 0;
}

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


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

{

    int n,x;
    int arr[100005];
    int a;
    //int c;
    cin >> n >> x;
for(int i =0;i<n;++i)
    cin >> arr[i];

    for(int i =0;i<n;++i)
        arr[i] = abs(arr[i] - x);
    int  c = gcd(arr[0], arr[1]);
    for(int i =1;i<n-1;++i)
    {
         c = gcd(c, arr[i]);
    }
cout << c;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = ll(1e12);
const ll mod = ll(1e9+7);
const double pi = acos(-1);
#define rep0(i,n) for(ll (i) = 0; (i) < (n); ++(i))
#define rrep0(i,n) for(ll (i) = (n) - 1; (i) >= 0; --(i))
#define rep1(i,n) for(ll (i) = 1; (i) <= (n); ++(i))
#define rrep1(i,n) for(ll (i) = (n); (i) >= 1; --(i))
#define nfor(i,a,b) for(ll (i) = (a); (i) < (b); ++(i))
#define pf(x) cout << (x) << endl
#define all(x) (x).begin(),(x).end()
#define yes pf("Yes")
#define no pf("No")
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
int dx[8]={1,0,-1,0,1,1,-1,-1};
int dy[8]={0,1,0,-1,1,-1,1,-1};

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

ll lcm(ll a,ll b){
    ll g = gcd(a,b);
    return a / g * b;
}

ll factorial(ll n){
    ll ans = 1;
    rep1(i, n){
        ans *= i;
        ans %= mod;
    }
    return ans;
}

ll power(ll a, ll b){
    ll ans = 1;
    a %= mod;
    while(b) {
        if(b & 1LL) ans = ans * a % mod;
        a = a * a % mod;
        b >>= 1;
    }
    return ans;
}

//modの値の確認をすること
int main(){
    ll n;
    cin >> n;
    n %= 10;
    if(n == 3)pf("bon");
    else if(n == 0 || n == 1 || n == 6 || n == 8)pf("pon");
    else pf("hon");
    return 0;
}


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

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string s,t;
    cin >> s >> t;
    int ans = 0;
    for(int i=0;i<3;i++) 
        if(s[i] == t[i]) ans++;
    cout << ans;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int n, A[21];

bool solve(int i, int m){
    if(m == 0)  return true;
    if(i >= n)  return false;
    return solve(i+1, m)||solve(i+1,m-A[i]);
}

int main(void){
    int q, m;
    cin >> n;
    for(int i=0; i<n; i++){
        cin >> A[i];
    }
    cin >> q;
    for(int i=0; i<q; i++){
        cin >> m;
        if(solve(0, m)) cout << "yes" <<endl;
        else    cout << "no" <<endl;
    }
    
    
    return 0;
}


Measured memory_bytes: 3080
#include<stdio.h>
int main(){
  int r,c,i,j,a=0;
  int score[101][101];
  int gyou[101];
  int retu[101];
  int total=0;

  /*初期化*/

  for(i=0;i<101;i++){
    gyou[i]=0;
    retu[i]=0;
  }

  for(i=0;i<101;i++){
    for(j=0;j<101;j++){
      score[i][j]=0;
    }
  }

  /*縦 横 入力*/

  scanf("%d%d",&r,&c);

  /*データ入力*/
  for(i=0;i<r;i++){
    for(j=0;j<c;j++){
      scanf("%d",&a);
      score[i][j]=a;
      gyou[i]=gyou[i]+a;
      retu[j]=retu[j]+a;

    }
     
  }

  /*出力*/
  for(i=0;i<r;i++){
    for(j=0;j<c;j++){
      printf("%d ",score[i][j]);
      if(j==c-1)
	printf("%d\n",gyou[i]);
    }

  }

 
  for(j=0;j<c;j++){
    printf("%d ",retu[j]);
    total= total+retu[j];
  }

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

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define endl "\n"
#define pb push_back
#define w(x) int x; cin>>x; while(x--)
#define f(i,n) for(ll i=0;i<n;i++)
#define f1(i,n) for(ll i=1;i<=n;i++)
#define ff first
#define ss second
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define me max_element
const int mod = 1e9 + 7;

void ganekasar() 
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}

void add_self(ll& a, ll b)
{
    a += b;

    if(a > mod)
        a -= mod;
}

int main() 
{
    string k;
    cin>>k;

    ll D;
    cin>>D;

    ll len = k.length();

    vvi dp(D, vi(2));

    dp[0][0] = 1;

    for(int here=0; here<len; here++)
    {
        vvi new_dp(D, vi(2));

        for(int sum=0; sum<D; sum++)
        {
            for(bool sm_already : {false, true})
            {
                for(ll digit=0; digit<10; digit++)
                {
                    if(digit > k[here] - '0' && !sm_already)
                        break;

                    add_self(new_dp[(sum+digit)%D][sm_already || (digit < k[here] - '0')], dp[sum][sm_already]);
                }
            }
        }

        dp = new_dp;
    }    

    ll answer = (dp[0][false] + dp[0][true])%mod;

    answer--;

    if(answer == -1)
        answer = mod-1;

    cout<<answer<<endl;

    return 0;
}


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

using namespace std;

int main() {
    int N;
    cin >> N;
    
    vector<long long int> X(N);
    for(int n=0; n<N; n++) {
        cin >> X[n];
    }
    
    long long int ans=1e9;
    long long int tmp;
    for(int x=1; x<=100; x++) {
        tmp=0;
        
        for(int n=0; n<N; n++) {
            tmp += (X[n]-x)*(X[n]-x);
        }
        if(tmp<ans) {
            ans = tmp;
        }
    }
    cout << ans << endl;


    return 0;
    
}

Measured memory_bytes: 256
S = input()

if S == "SUN":
  print(7)
if S == "MON":
  print(6)
if S == "TUE":
  print(5)
if S == "WED":
  print(4)
if S == "THU":
  print(3)
if S == "FRI":
  print(2)
if S == "SAT":
  print(1)

Measured memory_bytes: 3064
def isCLKWISE(ph) : return not ((ph[-1][0] - ph[-3][0])*(- ph[-3][1] + ph[-2][1]) - (ph[-2][0] - ph[-3][0])*(- ph[-3][1] + ph[-1][1] ) < 0)
      
def ConvexHullScan(P):
    P = sorted(P)
    phU = [P[0],P[1]]
    for p in P[2:]:
        phU.append(p)
        while(True):
            try :
                if isCLKWISE(phU) : break
                else : del phU[-2]
            except IndexError : break
    phL = [P[-1],P[-2]]
    for p in P[-3::-1]:
        phL.append(p)
        while(True):
            try :
                if isCLKWISE(phL) : break
                else : del phL[-2]
            except IndexError : break
    ph = phU + phL[1:-1]
    return ph
  
P = [[int(x) for x in input().split()] for _ in range(int(input()))]
P = ConvexHullScan(P)
P.reverse()
print(len(P))
idx = min([[x[1][1],x[1][0],x[0]] for x in enumerate(P)])[2]
for p in P[idx:] + P[:idx] : print(p[0],p[1])

Measured memory_bytes: 33208
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define pii pair<int,int>
const int mod=1e9+7;
 
int dx[]={-1, 0, 1, 0};
int dy[]={0, -1, 0, 1};



int32_t main()
{

ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);



int n,k;
cin>>n>>k;
vector<int>v(n);

for(int i=0;i<n;i++)cin>>v[i];

sort(v.begin(),v.end());
int ans=0;
for(int i=0;i<k;i++)ans+=v[i];
cout<<ans<<"\n";



}

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

int main() {
    long N, K, a, b;
    cin >> N >> K;
    long max_value = (int)pow(10, 5);
    long count = 0;
    vector<long> count_array(max_value, 0);
    for (long i = 0; i < N; i++){
        cin >> a >> b;
        count_array[a-1] += b;
    }
    for (long i = 0; i < max_value; i++){
        count += count_array[i];
        if (count >= K){
            cout << i + 1 << endl;
            break;
        }
    }
}


Measured memory_bytes: 1152
#include <bits/stdc++.h>
#define mem(ar,num) memset(ar,num,sizeof(ar))
#define me(ar) memset(ar,0,sizeof(ar))
#define lowbit(x) (x&(-x))
#define Pb push_back
#define  FI first
#define  SE second
#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 IOS ios::sync_with_stdio(false)
#define DEBUG cout<<endl<<"DEBUG"<<endl;
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
const int    prime = 999983;
const int    INF = 0x7FFFFFFF;
const LL     INFF = 0x7FFFFFFFFFFFFFFF;
const double pi = acos(-1.0);
const double inf = 1e18;
const double eps = 1e-6;
const LL     mod = 1e9 + 7;
LL qpow(LL a, LL b) {LL s = 1; while (b > 0) {if (b & 1)s = s * a % mod; a = a * a % mod; b >>= 1;} return s;}
LL gcd(LL a, LL b) {return b ? gcd(b, a % b) : a;}
int dr[2][4] = {1, -1, 0, 0, 0, 0, -1, 1};
typedef pair<int, int> P;
const int maxn = 1e5 + 10;
int A[maxn];
int main(void)
{
	int n; cin >> n;
	for (int i = 1; i <= n; ++i)
		scanf("%d", &A[i]);
	int ans = 0;
	int  t = 1;
	for (int i = 2; i <= n; ++i) {
		if (A[i] <= A[i - 1])
			t++;
		else
			t = 1;
		ans = max(ans, t);
	}
	cout << max(ans - 1, 0) << endl;
	return 0;
}

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

namespace AtCoderCore
{
    public class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int[] vs = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
            int[] cs = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
            int ans = 0;
            for (int i = 0; i < n; i++)
            {
                if(vs[i] - cs[i] > 0){
                    ans += vs[i] - cs[i];
                }
            }

            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 11348
#include<stdio.h>

int main(){
  int a, b, c, d, e, rec=0, dia=0;
  char c1, c2;

  while(scanf("%d %c %d %c %d", &a, &c1, &b, &c2, &c) != EOF){
    d = a*a + b*b;
    e = c*c;
    if(d == e) rec++;
    if(a == b) dia++;
  }

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

Measured memory_bytes: 0
{-# LANGUAGE PartialTypeSignatures #-}
module Main (main) where

import qualified Data.ByteString.Char8 as C8
import qualified Data.Char as C
import qualified Data.List as L

main :: IO ()
main = readInts >>= output . solve

solve :: [Int] -> _
solve [h,w]
  | h == 1 || w == 1 = 1
  | otherwise = let (p,q) = (h*w) `divMod` 2 in p+q

output :: _ -> IO ()
output = print

-- utils
readInts :: IO [Int]
readInts = L.unfoldr (C8.readInt . C8.dropWhile C.isSpace) <$> C8.getLine

Measured memory_bytes: 380
#include <iostream>

using namespace std;

int main(void){
    int a=0;
    int b=0;
    int c=0;
    int d=0;
    int sum=0;

    cin >> a >> b >>c >>d;

    if(a>=b)sum+=b;
    else if(a<=b)sum+=a;

    if(c>=d)sum+=d;
    else if(c<=d)sum+=c;

    cout << sum << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, n) for (int i = (int)(n); i >= 0; i--)
#define REP(i, m, n) for (int i = (int)(m); i < (int)(n); i++)
#define all(v) v.begin(), v.end()
typedef long long ll;

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

const long long INF = 1LL << 60;

int N;
double dp[310][310][310];

double rec(int i, int j, int k)
{
  if(dp[i][j][k] > 0) return dp[i][j][k];
  if(i==0 && j==0 && k==0) return 0;

  double res = N;
  if(i>0) res += rec(i-1, j, k) * i;
  if(j>0) res += rec(i+1, j-1, k) * j;
  if(k>0) res += rec(i, j+1, k-1) * k;
  res /= i+j+k;

  return dp[i][j][k] = res;
}

int main(){
  cin >> N;
  int one = 0;
  int two = 0;
  int three = 0;
  rep(i, N){
    int a; cin >> a;
    if(a == 1) one++;
    if(a == 2) two++;
    if(a == 3) three++;
  }

  cout << fixed << setprecision(10) << rec(one, two, three) << endl;

  return 0;
}


Measured memory_bytes: 225536
#include<cstdio>
#include<cstdlib>
#include<ctime>
#include<cmath>
#include<cstring>
#include<cctype>
#include<complex>
#include<iostream>
#include<sstream>
#include<algorithm>
#include<functional>
#include<vector>
#include<string>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<bitset>
using namespace std;
const int dx[] = {1,0,-1,0},dy[] = {0,1,0,-1};
#define INF 1e+8
#define EPS 1e-8
#define rep(i,j) for(int i = 0; i < (j); i++)
#define reps(i,j,k) for(int i = (j); i < (k); i++)
typedef long long ll;
typedef pair < int , int > Pii;
int main(){
	int m,n;
	while(scanf("%d%d",&n,&m),m){
		int stage[1024];
		rep(i,n){
			scanf("%d",&stage[i]);
		}
		int simulate = 0;
		int ans=m;
		bool flg = false;
		rep(i,m){
			int tmp;
			scanf("%d",&tmp);
			if(!flg){
				if(simulate >= n-1){
					ans = i;
					flg = true;
				}
				simulate+=tmp;
				simulate+=stage[simulate];
			}
		}
		printf("%d\n",ans);
	}
	return 0;
}

Measured memory_bytes: 1188
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll N, M;
ll happiness[100005];
ll psa[100005];

ll numberGreater(ll m){
    ll l = 0, r = N-1;
    ll ans = 0;
    while (l <= r){
        if (happiness[l] + happiness[r] >= m) {
            ans += 2*(r-l)+1;
            r--;
        }
        else l++;
    }
    return ans;
}

int main() {
    cin >> N >> M;
    for (int i=0; i<N; i++) scanf("%lld", &happiness[i]);
    sort(happiness, happiness+N);
//    for (int i=0; i<N; i++) cout << happiness[i] << " ";
//    cout << endl;
    for (int i=1; i<=N; i++) psa[i] = psa[i-1]+happiness[i-1];
    ll l = 0, r = 200001, m;
    while (l < r){
        m = (l+r)/2;
        if (numberGreater(m) < M) r = m;
        else l = m+1;
    }
    ll x = r-1;
    l = 0, r = N-1;
    ll ans = 0;

    while (l <= r){
        if (happiness[l] + happiness[r] >= x) {
            ans += (2*(r-l)+2)*happiness[r] + 2*(psa[r]-psa[l]);
            r--;
        }
        else l++;
    }
    if (numberGreater(x) > M) ans -= x*(numberGreater(x)-M);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1792
/******************************************************************************

                         بسم الله الرحمن الرحيم
                     Author: Mst: Mhamuda Khatun
                               RUCSE27

*******************************************************************************/

#include<bits/stdc++.h>
using namespace std;
#define ull unsigned long long
#define ll long long
#define pi 2*acos(0.0)
#define f first
#define s second
#define pb push_back
#define gap ' '
#define fastio {ios_base::sync_with_stdio(false);cin.tie(NULL);}
#define mod 1000000007
#define MAX 1000000000000
#define N 305

int main()
{
    fastio;
    int n,len,i,cnt=0;
    cin>>n;
    string x;
    for(i=1;i<=n;i++)
    {
        x=to_string(i);
        len=x.size();

        if(len%2==1)
            cnt++;
    }
    cout<<cnt;
    cout<<"\n";
    return 0;   //:D
}




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

//-----------------------
const int MOD = 1e4;
struct mint { int n; mint(int n = 0) : n(n) { } };
mint operator+(mint a, mint b) { return (a.n += b.n) >= MOD ? a.n - MOD : a.n; }
mint operator-(mint a, mint b) { return (a.n -= b.n) < 0 ? a.n + MOD : a.n; }
mint operator*(mint a, mint b) { return 1LL * a.n * b.n % MOD; }
mint &operator+=(mint &a, mint b) { return a = a + b; }
mint &operator-=(mint &a, mint b) { return a = a - b; }
mint &operator*=(mint &a, mint b) { return a = a * b; }
ostream &operator<<(ostream &os, mint a) { return os << a.n; }
istream &operator>>(istream &is, mint& a) { return is >> a.n; }
mint operator^(mint a, long long n) { mint r = 1;
    while (n) { if (n & 1) r *= a; a *= a; n >>= 1; } return r; }
mint inv(mint x) { long long a = x.n, b = MOD, u = 1, v = 0;
    while (b) { long long t = a/b; swap((a -= t*b), b); swap((u -= t*v), v); }
    return mint(u); }
bool operator<(const mint &a, const mint &b) { return a.n < b.n; }
//-----------------------

int main() {
    int n, k; cin >> n >> k;
    map<int, int> ma;
    while (k--) {
        int i; cin >> i; cin >> ma[i], ma[i]--;
    }
    #define nxt(j) ((j + 1) % 3)
    vector<vector<mint>> dp(3, vector<mint>(3, 0));
    if (ma.count(1)) {
        dp[ma[1]][1] = 1;
    } else {
        dp[0][1] = dp[1][1] = dp[2][1] = 1;
    }
    for (int i = 2; i <= n; i++) {
        vector<vector<mint>> dp2(3, vector<mint>(3, 0));
        for (int j = 0; j < 3; j++) {
            for (int k: {1, 2}) dp2[j][1] += dp[nxt(j)][k] + dp[nxt(nxt(j))][k];
            dp2[j][2] = dp[j][1];
        }
        swap(dp, dp2);
        if (!ma.count(i)) continue;
        for (int j = 0; j < 3; j++) if (ma[i] != j) dp[j][1] = dp[j][2] = 0;
    }
    mint ans = 0;
    for (int j = 0; j < 3; j++) ans += dp[j][1] + dp[j][2];
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3108
import java.io.IOException;
import java.util.*;

/**
 */
class Main {
	final static int N = 10;

	public static void main(String[] args) throws IOException {
		Scanner in = new Scanner(System.in);
		while(true) {
			int n = in.nextInt();
			int s = in.nextInt();
			if(n == 0 && s == 0) return;
			System.out.println(solve(n, s, 0));
		}
	}

    public static int solve(int n, int s, int d) {
		if(s < 0) return 0;
		if(n==0) {
			if(s == 0) return 1;
			else return 0;
		}
		if(d > 9) return 0;

		int ans = 0;
		ans += solve(n, s, d+1);
		ans += solve(n-1, s-d, d+1);
		return ans;
	}
}

Measured memory_bytes: 26204
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
using namespace std;
//typedef long long int LL;
typedef vector<int> ivec;
typedef vector<string> svec;

int beki(int x){
         if(x==0)return 1;
	 else return 2*beki(x-1);
}

string s[1000];
int MAP[600][600];
int yoko[600];
int tate[600];
int a[1000];
int main(){
    int n;
    int yokomax=0;
    int tatecomp=0;
    int ans=100000000;
    bool flag=0;
    cin>>n;
    int sum=0;
    for(int i=0;i<n;i++){
        cin>>s[i];
    }
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
	    if(s[i][j]=='#')MAP[i][j]=1,yoko[i]++,tate[j]++,flag=1;
	    else MAP[i][j]=0;
        }
	if(yokomax<yoko[i])yokomax=yoko[i];
    }	
    if(!flag){
       cout<<-1<<endl;
       return 0;
    }   
    for(int i=0;i<n;i++){
        if(tate[i]==n)tatecomp++;
    }
    for(int i=0;i<n;i++){
        if(tate[i]!=0)ans=min(ans,n-yoko[i]);
	if(tate[i]==0)ans=min(ans,n-yoko[i]+1);
	
    }
    //if(ans==100000000)cout<<-1<<endl;
    cout<<ans+n-tatecomp<<endl;
    return 0;
}

Measured memory_bytes: 1664
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.IO;
using System.Text;
using System.Diagnostics;

class Program
{
    static void Main()
    {
        string[] s = Console.ReadLine().Split(' ');
        int a = int.Parse(s[0]);
        int b = int.Parse(s[1]);
        int c = int.Parse(s[2]);
        int d = int.Parse(s[3]);
        int e = int.Parse(s[4]);
        int f = int.Parse(s[5]);

        double ans_concentration = 0.0;
        double max_concentration = 100.0 * ((double)e / (e + 100.0));
        int ans_sugar = 0;
        int ans_total = 100 * a;

        for (int i = 0; 100 * a * i <= f; i++)
        {
            for(int j = 0; 100 * b * j <= f; j++)
            {
                for(int k = 0; c * k <= f; k++)
                {
                    for(int l = 0; d * l <= f; l++)
                    {
                        int water = 100 * a * i + 100 * b * j;
                        int sugar = c * k + d * l;
                        int total = water + sugar;

                        if(i == 0 && j == 0)
                        {
                            continue;
                        }

                        if(total <= f && total >= 100 * a)
                        {
                            double concentration = 100.0 * (double)sugar / (double)total;
                            if (concentration <= (max_concentration + 1e-7) && concentration >= ans_concentration)
                            {
                                ans_concentration = concentration;
                                ans_sugar = sugar;
                                ans_total = total;
                            }
                        }
                    }
                }
            }
        }
        Console.WriteLine(ans_total + " " + ans_sugar);
    }
}

Measured memory_bytes: 11092
#include <cstdio>
#include <cctype>
#include <utility>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
using namespace std;

const auto gcu = getchar_unlocked;
const auto pcu = putchar_unlocked;
#define _T template <typename T>
#define _HT template <typename H, typename... T>
#define _il inline
#define _in _il int in
#define _sc _il bool scan
_T T in(int c){T n=0;bool m=false;while(isspace(c)){c=gcu();}if(c=='-')m=true,c=gcu();
	do{n=10*n+(c-'0'),c=gcu();}while(c>='0'&&c<='9');return m?-n:n;}
_in() {return in<int>(gcu());}
_T T scan(T &n){int c=gcu();return c==EOF?false:(n=in<T>(c),true);}
_sc(char &c){c=gcu();gcu();return c!=EOF;}
#ifdef _GLIBCXX_STRING
_sc(string &s){int c;s="";
	for(;;){c=gcu();if(c=='\n'||c==' ')return true;else if(c==EOF)return false;s+=c;}}
#endif
_HT _sc(H &h, T&&... t){return scan(h)&&scan(t...);}
#define _vo _il void out
#define _vl _il void outl
_vo(bool b) {pcu('0'+b);}
_vo(const char *s){while(*s)pcu(*s++);}
_vo(char c){pcu(c);}
#ifdef _GLIBCXX_STRING
_vo(string s){for(char c:s)pcu(c);}
#endif
_T _vo(T n){static char buf[20];char *p=buf;if(n<0)pcu('-'),n*=-1;
	if(!n)*p++='0';else while(n)*p++=n%10+'0',n/=10; while (p!=buf)pcu(*--p);}
_vl(){out('\n');}
#ifdef _GLIBCXX_VECTOR
_T _vo(vector<T> &v){for(T &x:v)out(&x == &v[0]?"":" "),out(x);outl();}
#endif
_HT _vo(H&& h, T&&... t){out(h);out(move(t)...);}
template <typename... T> _vl(T&&... t){out(move(t)...);outl();}

struct T { string s; int r; };

int main() {
	function<void()> f = [&]{f = []{outl();};};
	for (int n; (n = in());) {
		f();
		vector<T> v(n);
		for (T &x: v) {
			int w, l, d;
			scan(x.s, w, l, d);
			x.r = w * 3 + d;
		}
		stable_sort(v.begin(), v.end(), [](T a, T b){return a.r > b.r;});
		for (T x: v)
			outl(x.s, ',', x.r);
	}
}


Measured memory_bytes: 2476
#include <iostream>
#include <string>
#include <sstream>
#include <istream>
#include <vector>
using namespace std;


int main()
{
	string str;
	cin >> str;

	string ans = "No";

	if(str[2] == str[3] && str[4] == str[5]){
		ans = "Yes";
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static Scanner scanner = new Scanner(System.in);

	public static void main(String[] args) {

		Dice dice = new Dice(input());
		boolean bool = dice.match(input());

		if (bool) {

			System.out.println("Yes");

		} else {

			System.out.println("No");
		}

		close();

	}

	public static String input() {

		return scanner.nextLine();

	}

	public static void close() {

		if (scanner != null) {

			scanner.close();

		}
	}
}

class Dice {

	private int top;
	private int front;
	private int right;
	private int left;
	private int back;
	private int bottom;

	public Dice(String num) {

		String[] partsNum = num.split(" ");

		top = Integer.parseInt(partsNum[0]);
		front = Integer.parseInt(partsNum[1]);
		right = Integer.parseInt(partsNum[2]);
		left = Integer.parseInt(partsNum[3]);
		back = Integer.parseInt(partsNum[4]);
		bottom = Integer.parseInt(partsNum[5]);

	}

	public boolean match(String num) {

		String[] numList = num.split(" ");

		for (int i = 0; i < 7; i++) {

			if (i == 4) {

				this.roll("E");

			}

			if (Integer.parseInt(numList[1]) == this.front) {

				break;

			} else {

				this.roll("N");

			}
		}

		for (int j = 0; j < 4; j++) {

			if (Integer.parseInt(numList[0]) == this.top) {

				break;

			} else {

				this.roll("W");

			}
		}

		return (Integer.parseInt(numList[2]) == right &&
				Integer.parseInt(numList[3]) == left &&
				Integer.parseInt(numList[4]) == back &&
				Integer.parseInt(numList[5]) == bottom);

	}

	public void roll(String direction) {

		int temp;

		for (int i = 0; i < direction.length(); i++) {

			switch (direction.charAt(i)) {

			case 'E':

				temp = top;
				top = left;
				left = bottom;
				bottom = right;
				right = temp;
				break;

			case 'N':

				temp = top;
				top = front;
				front = bottom;
				bottom = back;
				back = temp;
				break;

			case 'S':

				temp = top;
				top = back;
				back = bottom;
				bottom = front;
				front = temp;
				break;

			case 'W':

				temp = top;
				top = right;
				right = bottom;
				bottom = left;
				left = temp;
				break;

			}
		}
	}
}

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

using ll = long long;

int signum(ll a) { return (a > 0) - (a < 0); }

int main() {
  int N; cin >> N;
  vector<ll> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  ll ans = 1e18;
  for (int z = -1; z <= 1; z += 2) {
    ll sum = 0;
    ll cost = 0;
    for (int i = 0; i < N; i++) {
      sum += A[i];
      int want = (i&1) ? -z : z;
      if (signum(sum) != want) { cost += abs(sum-want); sum = want; }
    }
    ans = min(ans, cost);
  }
  cout << ans << '\n';
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
int main(void){
    string s1,s2,s3;
    cin >> s1 >> s2 >> s3;
    char r1,r2,r3;
    r1 = s1[0] - 32;
    r2 = s2[0] - 32;
    r3 = s3[0] - 32;
    cout << r1 << r2 << r3 << endl;
}


Measured memory_bytes: 256
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N, *A = map(int, read().split())

# 減少中、増大中であるようなときの数列の個数のmin
dp = 1, 1
for i in range(1, N):
    if A[i] > A[i-1]:
        dp = min(dp)+1, min(dp[0]+1, dp[1])
    elif A[i] == A[i-1]:
        pass
    else:
        dp = min(dp[0], dp[1]+1), min(dp)+1

print(min(dp))

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

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int H[] = new int[N];
		String s = "Yes";

		for (int i = 0; i < N; i++) {
			H[i] = sc.nextInt();
		}
		sc.close();

		for (int i = 0; i < N - 1; i++) {
			if (H[i] < H[i + 1]) {
				H[i + 1]--;
			}
		}
		int h[] = new int[N];
		for (int i = 0; i < N; i++) {
			h[i] = H[i];
		}
		Arrays.sort(H);

		for (int i = 0; i < N; i++) {
			if (h[i] != H[i]) {
				s = "No";
			}
		}
		System.out.println(s);
	}

}


Measured memory_bytes: 51156
#include <cstdio>
#include <cstring>
#include <cmath>
#include <queue>
#include <vector>
#include <time.h>
#include <string>
#include <stack>
#include <set>
#include <map>
#include <iostream>
#include <algorithm>
using namespace std;
#define MP make_pair
#define PB push_back
typedef long long LL;
typedef pair<int, int> Pii;
const int inf = 0x3f3f3f3f;
const LL INF = (1uLL << 63) - 1;
const LL mod = 1000000007;
const int N = 2e5 + 5;
const double Pi = acos(-1.0);
const int maxn = 4e3 + 5;
LL fast_power(LL a,LL b){
    LL res = 1;
    while(b){
        if(b&1)res = res * a % mod;
        a = a * a % mod;
        b >>= 1;
    }
    return res;
}
LL fac[N];
LL inv[N];
void init(){
    fac[0] = 1;
    fac[1] = 1;
    for(int i = 2; i < N ; i++)fac[i] = fac[i-1] * i % mod;
    inv[N - 1] = fast_power(fac[N - 1], mod - 2);
    for(int i = N - 2; i >= 0; i--)inv[i] = inv[i + 1] * (i + 1) % mod;
}
LL cnt(int a,int b){
    a--;
    b--;
    a = a + b;
    return  fac[a] * inv[a - b] % mod * inv[b]  % mod;
}
int main() {
#ifdef local
    freopen("in", "r", stdin);
    //  freopen("w","w",stdout);
#endif
    ios::sync_with_stdio(false);
    cin.tie(0);
    init();
    int h,w,a,b;
    cin>>h>>w>>a>>b;
    LL res = 0;
    LL tmp = 0;
    LL last = 0;
    for(int i = w; i >= b + 1; i--){
        last = cnt(a + 1, w - i);
        tmp =  cnt(h - a,i) * (cnt(a + 1,w - i + 1) -  last + mod) % mod;
        res = (res + tmp) % mod;
    }
    cout<<res<<endl;
}


Measured memory_bytes: 3456
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <cmath>
#include <iomanip>
#define rep(i,n) for (int i=0; i < (n); ++i)
using namespace std;
typedef long long ll;

int main(){
    int ans=0;
    string s, t;
    cin >> s;
    cin >> t;
    int size = s.size();
    rep(i, size){
        if(s[i] != t[i]) ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3920
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <cstdio>
#include <ctime>
#include <assert.h>
#include <chrono>
#include <random>
#include <numeric>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
using namespace std;
typedef long long int ll;
typedef unsigned long long ull;

mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
ll myRand(ll B) {
    return (ull)rng() % B;
}

int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	int q; cin >> q;
	while(q--){
		int m,n; cin >> m >> n;
		int p=m*m+n*n;
		set<pair<int,int>> st;
		for(int i=1;i<=p;i++){
			if(p%i==0){
				int a=i,b=p/i;
				for(int x=0;x*x<=a;x++){
					int yy=sqrt(a-x*x);
					for(int y=yy-1;y<=yy+1;y++){
						if(x*x+y*y==a){
							if((x*m+y*n)%(x*x+y*y)==0&&(x*n-y*m)%(x*x+y*y)==0){
								st.insert(make_pair(x,y));
							}
						}
					}
				}
				for(int x=0;x*x<=b;x++){
					int yy=sqrt(b-x*x);
					for(int y=yy-1;y<=yy+1;y++){
						if(x*x+y*y==b){
							if((x*m+y*n)%(x*x+y*y)==0&&(x*n-y*m)%(x*x+y*y)==0){
								st.insert(make_pair(x,y));
							}
						}
					}
				}
			}
		}
		set<pair<int,int>> s;
		s.insert(make_pair(1,0));
		s.insert(make_pair(0,1));
		s.insert(make_pair(-1,0));
		s.insert(make_pair(0,-1));
		s.insert(make_pair(m,n));
		s.insert(make_pair(-n,m));
		s.insert(make_pair(-m,-n));
		s.insert(make_pair(n,-m));
		st.insert(make_pair(1,0));
		st.insert(make_pair(0,1));
		st.insert(make_pair(-1,0));
		st.insert(make_pair(0,-1));
		st.insert(make_pair(m,n));
		st.insert(make_pair(-n,m));
		st.insert(make_pair(-m,-n));
		st.insert(make_pair(n,-m));
		if(s.size()==st.size())printf("P\n");
		else printf("C\n");
	}
}



Measured memory_bytes: 3028
Xa, K, D = map(int, input().split())

X = abs(Xa)
Xs = X // D
Xm = X % D

if K < Xs:
#     print("A")
    print(abs(X-K*D))
elif Xa == 0:
    if K % 2 == 0:
        print(0)
    else:
        print(D)
elif Xm == 0:
    if K % 2 == 0:
        print(D)
    else:
        print(0)
elif ((K-Xs) % 2 == 0):
    print(abs(Xm))
else:
    print(abs(D-Xm))
# else:



Measured memory_bytes: 9100
#include<iostream>
using namespace std;
int r, g, b;
int main(){
  cin >> r >> g >> b;
  int n=0;
  n += r; n *= 10;
  n += g; n *= 10;
  n += b;
  if(n % 4 == 0) cout << "YES" << endl;
  else cout << "NO" << endl;
  return 0;
  }

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

int main() {
    int n; cin >> n;
    vector<int> h(n); for (int i = 0; i < n; ++i) cin >> h[i];

    int res = 0, t = 0;
    for (int i = 1; i < n; ++i) {
        if (h[i - 1] >= h[i]) {
            t += 1;
        } else {
            res = max(res, t);
            t = 0;
        }
    }
    res = max(res, t);

    cout << res << endl;
}

Measured memory_bytes: 640
#include <iostream>
#include <set>
#include <tuple>
#include <algorithm>

using namespace std;

typedef long long ll;

int main() {
	
	ll a, b, c;
	cin >> a >> b >> c;
	
	set<tuple<ll, ll, ll>> s;
	
	s.insert(make_tuple(a, b, c));
	
	int count = 0;
	
	while(a % 2 == 0 && b % 2 == 0 && c % 2 == 0) {
		count++;
		ll na = (b + c) / 2;
		ll nb = (a + c) / 2;
		ll nc = (a + b) / 2;
		
		if(na % 2 == 1 || nb % 2 == 1 || nc % 2 == 1) {
			break;
		}

		auto t = make_tuple(na, nb, nc);
		if(s.find(t) != s.end()) {
			count = -1;
			break;
		} else {
			s.insert(t);
		}
		a = na;
		b = nb;
		c = nc;
	}
	cout << count << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

int main(){
    int t,d,l;
    while(cin >>t >>d >>l,t){
        vector<int> s(t);
        rep(i,t){
            int x;
            cin >>x;
            if(x>=l){
                s[i]++;
                s[min(t-1,i+d)]--;
            }
        }
        rep(i,t-1) s[i+1] += s[i];

        int ans = 0;
        rep(i,t) ans += (s[i]>0);
        cout << ans << endl;
    }
    return 0;
}



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

#define __ ios::sync_with_stdio(0),  cin.tie(0);
#define dbg(a)  cerr << __LINE__ << ": " << #a << " = " << a << '\n'

typedef long long ll;

int main(){__
  string s; cin >> s;
  for (int i = 0; s[i]; ++i){
    if(s[i]=='?') s[i] = 'D';
  }
  cout << s << endl;
  return 0;
}

Measured memory_bytes: 3744
#include<cstdio>
#include<iostream>
#include<cmath>
#include<algorithm>
#include<string>
#include<cstring>
#include<cctype>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<iomanip>
#include<sstream>
#include<vector>
#include<cstdlib>
#include<ctime>
#include<list>
#include<deque>
#include<bitset>
#include<fstream>
#define ld double
#define ull unsigned long long
#define ll long long
#define pii pair<int,int >
#define iiii pair<int,pii >
#define mp make_pair
#define INF 1000000000
#define MOD 1000000007
#define rep(i,x) for(int (i)=0;(i)<(x);(i)++)
inline int getint(){
	int x=0,p=1;char c=getchar();
	while (c<=32)c=getchar();
	if(c==45)p=-p,c=getchar();
	while (c>32)x=x*10+c-48,c=getchar();
	return x*p;
}
using namespace std;
//ruogu
const int N=2e5+10;
int h,w,n,m,nn[4],sx,sy,mx[N][4];
char s0[N],s1[N];
map<char,int>Mp;
//
int P(){
	printf("NO\n");
	return 0;
}
int main(){
	h=getint();w=getint();
	n=getint();sx=getint();sy=getint();
	scanf("%s",s0);scanf("%s",s1);
	Mp['R']=0;Mp['U']=1;Mp['D']=2;Mp['L']=3;
	nn[2]=h-sx+1;nn[1]=sx;nn[0]=w-sy+1;nn[3]=sy;
	for(int i=n-1;i>=0;i--){
		int x=Mp[s0[i]],y=x;
		rep(j,4)mx[i][j]=mx[i+1][j];
		mx[i][x]=mx[i+1][x]+1;
		x=3-Mp[s1[i]];
		if(y!=x)mx[i][x]=max(0,mx[i][x]-1);
		else mx[i][x]=max(1,mx[i][x]-1);
	}
//	rep(i,n)rep(j,4)cout<<i<<" "<<j<<" "<<mx[i][j]<<endl;
	rep(i,n+1){
		if(i<n&&nn[Mp[s0[i]]]==1)return P();
//	cout<<i<<endl;
		if(mx[i][0]>=nn[0])return P();
		if(mx[i][3]>=nn[3])return P();
		if(mx[i][1]>=nn[1])return P();
		if(mx[i][2]>=nn[2])return P();
		int x=3-Mp[s1[i]];
		if(mx[i+1][x]>=nn[x])nn[x]++,nn[3-x]--;
	}
	printf("YES\n");
	return 0;
}


Measured memory_bytes: 3712
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N, M; cin >> N >> M;
  int min = 0, max = 999999999;
  for(int i = 0; i < M; i++){
    int L,R; cin >> L >> R;
    if(min < L) min = L;
    if(max > R) max = R;
  }
  if(max - min + 1 > 0)
  	cout << max - min + 1 << endl;
  else
    cout << 0 << endl;
}

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

dp = ["No"] * 101
dp[4] = "Yes"
dp[7] = "Yes"
for i in range(8, 101):
    if dp[i - 4] == "Yes":
        dp[i] = "Yes"
    elif dp[i - 7] == "Yes":
        dp[i] = "Yes"

print(dp[n])

Measured memory_bytes: 3060
var input = '';
var readable = process.stdin;
readable.resume();
readable.setEncoding( 'utf-8' );
readable.on( 'data', function( chunk ) {
  input += chunk;
});
 
readable.on( 'end', function() {
  var data = input.split( '\n' );
  var output = [];
  for( var index=0; index<data.length; index++ ) {
    var nums = data[index].split( ' ' ).map( Number );
    var n = nums[0];
    var x = nums[1];
    if( 0 == n && 0 == x ) { break; }
 
    var cnt = 0;
    var ave = x/3;
    for( var i=1; i<ave; i++ ) {
      var t = (x-i)/2;
      for( var j=i+1; j<t; j++ ) {
        var k = x-i-j;
        if( j < k && k <= n ) { cnt++; }
      }
    }
    output.push( cnt );
  }
  console.log( output.join( '\n' ) );
});

Measured memory_bytes: 8636
#include <stdio.h>

int func(int x, int y){
	return x*x+y*y;
}

int main(void){
	int h[101]={-1}, w[101]={-1};
	int l=0;
	int i,ih,iw;
	int mh,mw;

	do{
	scanf("%d", &h[l]);
	scanf("%d", &w[l]);
	}while(h[l++] != 0);

	for(i=0;i<l-1;i++){
	mh=150;
	mw=150;
		for(ih=150; ih>=1;ih--){
			for(iw=ih+1;iw<=150;iw++){
				if(ih == h[i] && iw == w[i])
					continue;
				if(func(mh,mw)<func(ih,iw))
					break;
				else if(func(h[i],w[i]) == func(ih,iw)){
					if(h[i] < ih){
						mh = ih;
						mw = iw;
						break;
					}
				}
				else if(func(h[i],w[i]) < func(ih,iw)){
					mh=ih;
					mw=iw;
					break;
				}
				
			}
		}
	printf("%d %d\n",mh, mw);
	}


	return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,o,n) for(long long i = o;i<n;i++)
#define oneforall ios::sync_with_stdio(false);cin.tie(0);
#define all(v) (v).begin(),(v).end()
#define ini(...) int __VA_ARGS__; in(__VA_ARGS__)
#define inl(...) long long __VA_ARGS__; in(__VA_ARGS__)
#define ins(...) string __VA_ARGS__; in(__VA_ARGS__)
const long long INF=1e18;
void in(){} template <typename T,class... U> void in(T &t,U &...u){ cin >> t; in(u...);}
void out(){cout << "\n";} template <typename T,class... U> void out(const T &t,const U &...u){ cout << t; if(sizeof...(u)) cout << " "; out(u...);}
typedef vector<int> vi;
typedef vector<long long> vl;
typedef long long ll;
typedef vector<pair<long,long>> vpll;
typedef vector<pair<int,int>> vpii;
int main() {
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall

	ini(x);
	ini(x1);
	double xdown = ceil(x/0.08);
	double xup = ceil((x+1)/0.08);
	for(double i = xdown;i<xup;i++){
		if(floor(i*0.1)== x1){
			out(i);
			return 0;
		}
	}
	out(-1);
	return 0;
}

Measured memory_bytes: 256