akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, n) for (int i = 1; i <= (int)(n); i++)

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

  vector<int> a(N);
  for (int i = 0; i < N; i++)
  {
    cin >> a.at(i);
  }

  sort(a.begin(), a.end());

  cout << a.at(a.size() - 1) - a.at(0)   << endl;
  
}

Measured memory_bytes: 3632
while True:
    a,op,b=input().split()
    a=int(a)
    b=int(b)
    if op=="?":
         break
    else:
        if op =="+":
                print(a+b)
        elif op =="-":
                 print(a-b)
        elif op =="*":
                 print(a*b)
        elif op=="/":
            if b==0:
                 pass
            else:
                 print(a//b)


Measured memory_bytes: 5596
import sys
input = sys.stdin.readline


N = int(input())
a = list(map(int, input().split()))


import collections

c = collections.Counter(a)

klist = list(c.keys())
vlist = list(c.values())

if len(klist) == 1 and klist[0] == 0:
    print('Yes')
    sys.exit()

if len(klist) == 2:
    if (klist[0] == 0 and vlist[0] == N/3) or (klist[1] == 0 and vlist[1] == N/3):
        print('Yes')
        sys.exit()

if not len(klist) == 3:
    print('No')
    sys.exit()

if not (vlist[0] == vlist[1] and vlist[1] == vlist[2]):
    print('No')
    sys.exit()

if not (klist[0] ^ klist[1] ^ klist[2] == 0):
    print('No')
    sys.exit()

print('Yes')



Measured memory_bytes: 14212
//2016.7.15
//ABC 067 (A)

#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
	int a,b;
	cin >> a >>b;
	//vector <int> A(n);
	if(a%3==0){cout << "Possible";}
  else if(b%3==0){cout <<"Possible";}
  else if((a+b)%3==0){cout <<"Possible";}
  else cout << "Impossible";




	return 0;
}


Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; ++i)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = int64_t;
using ld = long double;
using P = pair<int, int>;
using vs = vector<string>;
using vi = vector<int>;
using vvi = vector<vi>;
template<class T> using PQ = priority_queue<T>;
template<class T> using PQG = priority_queue<T, vector<T>, greater<T> >;
const int INF = 100010001;
const ll LINF = (ll)INF*INF*10;
template<typename T1, typename T2>
istream &operator>>(istream &is, pair<T1, T2> &p) { return is >> p.first >> p.second;}
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) { return os << p.first << ' ' << p.second;}

//Range Minimum Query
struct segment {
    int n;
    vector<int64_t> dat;
    // n_は範囲
    segment(int n_) { // nはn_以上の2^?
        n = 1<<(32-__builtin_clz(n_));
        if(n == 2*n_) n >>= 1;
        dat.assign(2*n-1, INT64_MAX);
    }
    //更新の手順
    inline int64_t theorem(int i) {
        int64_t chld = dat[i*2+1];
        int64_t chrd = dat[i*2+2];
        return min(chld, chrd);
    }
    inline int chld(int i) {return 2*i+1;}
    inline int chrd(int i) {return 2*i+2;}
    //初期化(初期状態はINT64_MAX)
    void init(const vector<int64_t> &vec) {
        int num = vec.size();
        rep(i, num) {
            dat[i+n-1] = vec[i];
        }
        rep(i, n-1) {
            dat[n-2-i] = theorem(n-2-i);
        }
    }
    // k番目の値をaに変更
    void update(int k, int64_t a) {
        // 葉の節点
        k += n-1;
        dat[k] = a;
        // 登りながら更新
        while(k>0) {
            k = (k-1)/2;
            dat[k] = theorem(k);
        }
    }
    //kは節点の番号, [l, r)に節点が対応
    // (a, b, 0, 0, .n)で呼ぶ
    int64_t query_(int a, int b, int k, int l, int r) {
        if(a>=r || l>=b) return INT64_MAX;
        if(a<=l && r<=b) return dat[k];
        else {
            int chl = k*2+1;
            int chr = k*2+2;
            int64_t vl = query_(a, b, chl, l, (l+r)/2);
            int64_t vr = query_(a, b, chr, (l+r)/2, r);
            return min(vl, vr);
        }
    }
};

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int h, w;
    cin >> h >> w;
    vvi c(h, vi(w));
    rep(i, h) rep(j, w) cin >> c[i][j];

    vvi field(h, vi(w));
    rep(i, h) {
        int now = 1;
        for(int j = w-1; j >= 0; j--) {
            if(c[i][j] != 0) now = 0;
            field[i][j] = now++;
        }
    }

    int ans = 0;
    rep(j, w) {
        int num = INF;
        int x = 0;
        segment segm(h);
        rep(i, h) {
            while(i+x < h) {
                if(min(num, field[i+x][j]) >= x+1) {
                    num = min(num, field[i+x][j]);
                    segm.update(i+x, field[i+x][j]);
                    x++;
                } else {
                    break;
                }
            }
            ans = max(ans, x);
            if(x > 1) num = segm.query_(i+1, i+x, 0, 0, segm.n);
            else num = INF;
            x--;
            if(x < 0) x = 0;
        }
    }

    cout << ans*ans << endl;
}


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

int GCD(int a, int b){
	return (b == 0) ? a:GCD(b, a%b);
}

char affine(int a, int b, char ch){
	int y = (int)(ch - 'a');
	return (char)((a*y+b)%26) + 'a';
}

int main(){
	bool ok;
	string str;
	getline(cin, str);
	while (getline(cin, str)) {
		ok = false;
		for (int a = 1; a < 100 && !ok; a++) {
			if(GCD(a, 26) != 1){
				continue;
			}
			for (int b = 0; b < 26 && !ok; b++) {
				for (int j = 0; j < str.size(); j++) {
					if('a' <= str[j] && str[j] <= 'z'){
						str[j] = affine(a, b, str[j]);
					}
				}
				if(str.find("that") != string::npos || str.find("this") != string::npos){
					cout << str << endl;
					ok = true;
				}
			}
		}
	}
	return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
void fastIO(){
  ios_base::sync_with_stdio(0); cin.tie(0);
}


int main(){
  fastIO();
  cout<<fixed;
  cout<<setprecision(10);
  double n;
  cin>>n;
  double tot = 0;
  for(int i=1;i<=n;i++){
  	if(i%2!=0){
  		tot++;
  	}
  }
  cout<<tot/n<<endl;
}





Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
	int a,b,rone=100000;
	cin>>a;
	for(int i=0;i<a;i++){
		rone *=1.05;
		b = rone % 1000;
		rone -= b;
		if(b>0){b=1000;
		rone += b;
		}
	}
	cout<<rone<<endl;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define sqr(a) ((a)*(a))
#define rsz resize
#define forr(i,a,b) for(int i=(a);i<(b);i++)
#define forn(i,n) forr(i,0,n)
#define dforn(i,n) for(int i=n-1;i>=0;i--)
#define forall(it,v) for(auto it=v.begin();it!=v.end();it++)
#define dforall(it,v) for(auto it=v.rbegin();it!=v.rend();it++)
#define sz(c) ((int)c.size())
#define zero(v) memset(v, 0, sizeof(v))
#define pb push_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define fst first
#define snd second
#define PI 3.1415926535897932384626

using namespace std;

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

int main()
{
	#ifdef REJUNTE
	freopen("input.in","r",stdin);
	//freopen("output.out","w",stdout);
	#endif
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	ll n,x,ans=0;
	map<ll,ll> m;
	cin >> n;
	forn(i,n)
	{
		cin >> x;
		m[x]++;
	}
	dforall(it,m)
	{
		ll aux=1,pot2=1;
		while(pot2<it->fst)
		{
			pot2=(1LL<<aux);
			aux++;
		}
		if(pot2==it->fst) ans+=it->snd/2;
		else
		{
			ll aux=min(it->snd,m[pot2-it->fst]);
			ans+=aux;
			m[pot2-it->fst]-=aux;
		}
	}
	cout << ans << '\n';
	return 0;
}

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

int main()
{
    int N;
    int p[10];
    int max = 0;
    int sum = 0;

    cin >> N;
    for(int i = 0; i < N; i++) {
        cin >> p[i];
        sum += p[i];
        if(max < p[i]) {
            max = p[i];
        }
    }
    cout << sum - max / 2 << endl;

    return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
using namespace std;

int main() {
	double xa,ya,xb,yb,xc,yc,xd,yd;
	vector<string> r;
	while(cin >> xa >> ya >> xb >> yb >> xc >> yc >> xd >> yd)
	{
		if ((xa-xb)*(xc-xd) + (ya-yb)*(yc-yd) == 0)
		{
			r.push_back("YES");
		} else {
			r.push_back("NO");
		}
	}
	for (int i=0; i<r.size(); i++)
	{
		cout << r[i] << endl;
	}
}

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


    

int main(){
    int n;
    cin >>n;
    if(n%10 == 2 || n%10 == 4|| n%10 ==5|| n%10 ==7 || n%10 ==9)cout << "hon" << endl;
    if(n%10 ==0 || n%10 == 1|| n%10 ==6|| n%10 ==8){
        cout << "pon" << endl;
    }
    if( n%10 ==3)cout << "bon" << endl;
    return 0;
}

Measured memory_bytes: 3620
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Linq;
using System.Diagnostics;
using System.Globalization;
using static System.Console;
using static System.Math;

namespace abc103_b
{
    class Program
    {
        static void Main(string[] args)
        {
            var s = Console.ReadLine();
            var t = Console.ReadLine();

            for(int i=0; i<s.Length; i++){
                if(s==t){
                    WriteLine("Yes");
                    return;
                }else{
                    var tmp = s.Remove(0,1);
                    s = tmp + s[0];
                }
            }
            WriteLine("No");
        }
    }
}

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

int main()
{
  int N,A,B;
  cin >> N >> A >> B;
  int H[100010];
  for(int i=0;i<N;i++){
    cin >> H[i];
  }
  sort(H,H+N);
  int isNG = 0;
  int isOK = (H[N-1]+B-1)/B;
  while(isOK-isNG>1){
    int mid = (isOK+isNG)/2;
    int need = 0;
    for(int i=0;i<N;i++){
      if(H[i]-B*mid>0){
        need+=(H[i]-B*mid+A-B-1)/(A-B);
        if(need>mid){
          isNG=mid;
          break;
        }
      }
    }
    if(isNG!=mid)
      isOK=mid;
  }
  cout << isOK << endl;
}


Measured memory_bytes: 640
a,b = map(int,input().split())

p = [["."]*100 for _ in range(20)]
q = [["#"]*100 for _ in range(21)]

for t in range(b-1):
  p[t//50*2][t%50*2] = "#"
for t in range(a-1):
  q[t//50*2+1][t%50*2] = "."
  
print(41, 100)
for l in p+q:
  print("".join(l))
  


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> P;
int main() {
  ll n,t,c,x;
  cin>>n>>t;
  ll ans=1e15;
  for(int i=0;i<n;i++){
    cin>>c>>x;
    if(x<=t)ans=min(ans,c);
  }
  if(ans==1e15)cout<<"TLE"<<endl;
  else cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scan = new Scanner(System.in);
		String X = scan.next();
		char x = X.charAt(0);
	
		String Y = scan.next();
		char y = Y.charAt(0);
		if(x>y){
			System.out.println(">");
		}else if(x == y){
			System.out.println("=");
		}else{
			System.out.println("<");
		}
		
	}

}

Measured memory_bytes: 23764
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i < (n);i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define SCANF(i) int i;scanf("%d",&i)
typedef long long ll;
using namespace std;
using P = pair<int,int>;
const long long INF = 1LL << 60;
const int IINF=100000000;
const int MOD = (int)1e9 + 7;
//約数列挙
vector<long long> divisor(long long n) {
    vector<long long> ret;
    for (long long i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            ret.push_back(i);
            if (i * i != n) ret.push_back(n / i);
        }
    }
    //sort(ret.begin(), ret.end()); // 昇順に並べる
    return ret;
}
vector<int> dx={1,0,-1,0};vector<int> dy={0,-1,0,1};

signed main () {
    ll n;cin >> n;
    vector<ll> inlist;
    REP(i,n){
        ll tmp;cin >> tmp;
        inlist.push_back(tmp);
    }
    sort(ALL(inlist),greater<ll>());
    ll ans = 0;
    ll cnt = 0;
    REP(i,n){
        ans+=inlist[i];
        cnt++;
        if(i!=0 && cnt < n-1){
            cnt++;
            ans+=inlist[i];
        }
        if(cnt>=n-1)break;
    }
    cout << ans << endl;
}//https://atcoder.jp/contests/abc173/tasks/abc173_d

Measured memory_bytes: 5376
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <climits>
#include <bitset>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<pair<int,int>> vpii;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvc;
typedef vector<vector<string>> vvs;
#define rep(i,n) for(int i=0;i<n;i++)
#define fin(ans) cout<<(ans)<<endl
#define P 1000000007
#define STI(s) atoi(s.c_str())//string to int
#define mp(p,q) make_pair(p,q)
#define Sort(a) sort(a.begin(),a.end())
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 int INF = INT_MAX;
const long long LLINF = 1LL<<60;
//g++ -std=c++1z temp.cpp
//./a.exe

int getrandom(int min,int max);

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

int n,count = 0;
string s;

cin >> n >> s;

for(int i = 1;i < n;i++){

    if (s[i] != s[i-1])
    {
        count++;
    }
}

cout << count+1 << endl;


//////////////////////////////////////////////////////
return 0;}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
/*{{{*/  //template
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
constexpr int INF = numeric_limits<int>::max()/2;
constexpr long long LINF = numeric_limits<long long>::max()/3;
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define sz(x) (int)(x).size()
#define debug(x) cerr<<#x<<":"<<x<<endl
#define debug2(x,y) cerr<<#x<<","<<#y":"<<x<<","<<y<<endl
//struct fin{ fin(){ cin.tie(0); ios::sync_with_stdio(false); } } fin_;
struct Double{ double d; explicit Double(double x) : d(x){} };
ostream& operator<<(ostream& os,const Double x){ os << fixed << setprecision(20) << x.d; return os; }
template<typename T> ostream& operator<<(ostream& os,const vector<T>& vec){ os << "["; for(const auto& v : vec){ os << v << ","; } os << "]"; return os; }
template<typename T,typename U> ostream& operator<<(ostream& os, const map<T,U>& mp){ os << "{"; for(auto& p : mp){ os << p << ","; } os << "}"; return os; }
template<typename T,typename U> ostream& operator<<(ostream& os,const pair<T,U>& p){ os << "(" << p.first << ","<< p.second <<")"; return os; }
template<typename T> ostream& operator<<(ostream& os,const set<T>& st){ os<<"{"; for(T v:st) os<<v<<","; os <<"}"; return os; }
template<typename T,typename U> inline void chmax(T &x,U y){ if(y>x) x = y; }
template<typename T,typename U> inline void chmin(T &x,U y){ if(y<x) x = y; }
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
ll gcd(ll a,ll b){ if(b==0) return a; else return gcd(b,a%b); }
//constexpr double eps = 1e-14; 
constexpr double eps = 1e-10; 
constexpr ll mod = 1e9+7;
const int dx[]={1,0,-1,0} ,dy[] = {0,1,0,-1};
/*}}}*/

int main(){
    int n; cin >> n;
    vector<vector<int>> G(n);
    for(int i=0;i<n-1;i++){
        int a,b; cin >> a >> b;
        a--;
        b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }

    vector<ll> c(n); rep(i,n) cin >> c[i];
    sort(all(c));
    reverse(all(c));

    int idx=0;
    vector<ll> vis(n,0);
    queue<int> que;
    que.push(0);
    vis[0] = c[idx++];
    ll ans = 0;
    while(!que.empty()){
        int v = que.front();
        que.pop();
        for(auto u : G[v]){
            if(vis[u] > 0) continue;
            vis[u] = c[idx++];
            ans+=vis[u];
            que.push(u);
        }
    }


    cout << ans << endl;
    for(int i=0;i<n;i++){
        cout << vis[i] << " ";
    }
    cout << endl;
}


Measured memory_bytes: 1152
import java.util.Scanner;
public class Main {
	public static void main(String[] args)throws Exception{
		Scanner stdIn=new Scanner(System.in);
		int K=stdIn.nextInt();
		long ans=0;
		for(int i=1;i<=K;i++){
			for(int j=1;j<=K;j++){
				for(int k=1;k<=K;k++){
					ans+=gcd(i,gcd(j,k));
				}
			}
		}
		System.out.println(ans);
	}
	private static int gcd(int m, int n) {
	    if(m < n) return gcd(n, m);
	    if(n == 0) return m;
	    return gcd(n, m % n);
	}
}


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

#define x first
#define y second
#define ndl '\n'
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define up_b upper_bound
#define low_b lower_bound
#define sz(x) (int)x.size()
#define bit __builtin_popcount
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()

using namespace std;
using namespace __gnu_pbds;

template<typename T> using indexed_set = tree <T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

typedef long long ll;
typedef long double ld;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
typedef pair<int, ll> pil;
typedef pair<ll, int> pli;
typedef pair<int, ull> piu;
typedef vector<vector<int>> matrix;

const ll INF = 1e18 + 123;
const ld EPS = 1e-9;
const int inf = 1e9 + 123;
const int MOD = 1e9 + 7;
const int N = 5e5 + 13;
const int M = 1e6 + 123;
const double pi = acos(-1.0);
const int dx[] = {0, 0, 1, -1};
const int dy[] = {1, -1, 0, 0};

ld x[N], pr[N];

int main(){
    #ifdef KAZAKH
        freopen("input.txt", "r", stdin);
    #endif
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n, k;
    cin >> n >> k;
    ld mx = 0;
    for (int i = 1; i <= n; i++){
        cin >> x[i];
        x[i] = (x[i]+1)/2;
        pr[i] = pr[i-1]+x[i];
        if (i >= k){
            mx = max(mx, pr[i] - pr[i-k]);
        }
    }
    cout <<fixed<< setprecision(6)<<mx;
    return 0;
}


Measured memory_bytes: 10496
n,x=map(int,input().split())
A=list(map(int,input().split()))
A=sorted(A)
if x>sum(A):
    print(len(A)-1)
if x==sum(A):
    print(len(A))
if x<sum(A):
    ans=0
    for i in range(len(A)):
        if x>=A[i]:
            x-=A[i]
            ans+=1
        else:
            print(ans)
            break

Measured memory_bytes: 9188
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int q = Integer.parseInt(br.readLine());

		List<Integer> sosuu = sosuuList(100000);
		Set<Integer> set = new HashSet<Integer>();
		set.addAll(sosuu);

		int[] sum = new int[1000001];
		int cnt = 0;
		for (int i = 1; i < sum.length; i++) {
			if (i % 2 == 1 && set.contains(i) && set.contains((i + 1) / 2)) {
				cnt++;
			}
			sum[i] = cnt;
		}

		for (int i = 0; i < q; i++) {
			String[] sa = br.readLine().split(" ");
			int l = Integer.parseInt(sa[0]);
			int r = Integer.parseInt(sa[1]);
			System.out.println(sum[r] - sum[l - 1]);
		}
		br.close();
	}

	static List<Integer> sosuuList(int n) {
		List<Integer> sosuu = new ArrayList<Integer>();
		for (int i = 2; i <= n; i++) {
			int r = (int) Math.sqrt(i);
			boolean flg = false;
			for (Integer o : sosuu) {
				if (r < o) {
					break;
				}
				if (i % o == 0) {
					flg = true;
					break;
				}
			}
			if (!flg) {
				sosuu.add(i);
			}
		}
		return sosuu;
	}
}


Measured memory_bytes: 63320
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<string>
#include<utility>
#define rep(i, n) for(int i=0;i<n;i++)
using namespace std;
int main(){
	char a,b;
	cin>>a;
	b=a+1;
	cout<<b<<endl;
	return 0;
}

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

int main(){
    int N;
    string A[200000];

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

    sort(A,A+N);
    string cp = A[0];
    int sum=0;
    for(int i=1;i<N;i++){
        if(A[i]==cp){
            sum += 1;
        }
        else{
            cp = A[i];
        }
    }

    cout << N-sum << endl;
    
    return 0;
}

Measured memory_bytes: 9888
#include <string>
#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <vector>
#include <cmath>
#define rep(i,n) for(int i = 0; i < (n); i++)
using namespace std;
int main()
{
    int n;
    cin >> n;
    string s;
    cin >> s;
    int start = 0, end = n-1;
    int cnt = 0;
    while(start <= end){
        while(start <= n-1 && s[start] == 'R') start++;
        while(end >= 0 && s[end] == 'W') end--;
        if(start > end) break;
        s[start] = 'R';
        s[end] = 'W';
        start++; end--;
        cnt++;
    }
    cout << cnt << endl;
}

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


void solve(long long A, long long B, long long C, long long K){
    long long ans = 0;
    if (K > 0) {
        ans += min(A, K);
        K -= min(A, K);
    }
    if (K > 0) {
        // ans += min(A, K);
        K -= min(B, K);
    }
    if (K > 0) {
        ans -= min(C, K);
        // ans += min(A, K);
        K -= min(C, K);
    }
    cout << ans << endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    long long C;
    scanf("%lld",&C);
    long long K;
    scanf("%lld",&K);
    solve(A, B, C, K);
    return 0;
}


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

int main() {
	// your code goes here
	string a, b;
	cin >> a;
	cin >> b;
	int n = a.size(), m = b.size();
	vector<vector<int> > dp(n+1, vector<int>(m+1, 0));
	for(int i = 1; i <= n; ++i){
		for(int j = 1; j <= m; ++j){
			if(a[i-1] == b[j-1]) dp[i][j] = dp[i-1][j-1] + 1;
			else dp[i][j] = max(dp[i-1][j], dp[i][j-1]);
			// cout << dp[i][j] << " ";
		}
		// cout << endl;
	}
	// cout << endl;
	string res = "";
	int i = n, j = m;
	while(i >= 1 && j >=1){
		// cout << a[i-1] << " " << b[j-1] << endl;
		if(a[i-1] == b[j-1]) {
			res = a[i-1] + res;
			--i, --j;
		} else{
			if(dp[i-1][j] >= dp[i][j-1]) --i;
			else --j;
		}
	}
	cout << res;
	return 0;
}

Measured memory_bytes: 35584
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <iostream>
#include <set>
#include <map>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;

enum Type{
	Sente,
	Gote,
	Unknown,
};

int N,stone_num;
int me[10],enemy[10];
Type memo[2][10][8193];

Type recursive(Type turn,int rest_num,int index){

	if(memo[turn][index][rest_num] != Unknown)return memo[turn][index][rest_num];

	Type result;

	if(turn == Sente){

		if(rest_num == 1){
			return memo[turn][index][rest_num] = Gote;
		}

		result = Gote;

		for(int num = 1; num <= me[index] && rest_num-num >= 1; num++){
			if(recursive(Gote,rest_num-num,index) == Sente){
				result = Sente;
				break;
			}
		}

	}else{

		if(rest_num == 1){
			return memo[turn][index][rest_num] = Sente;
		}

		result = Sente;

		for(int num = 1; num <= enemy[index] && rest_num-num >= 1; num++){
			if(recursive(Sente,rest_num-num,(index+1)%N) == Gote){
				result = Gote;
				break;
			}
		}
	}

	return memo[turn][index][rest_num] = result;
}


void func(){
	scanf("%d",&stone_num);

	for(int i = 0; i < 2; i++){
		for(int k = 0; k < N; k++){
			for(int p = 0; p <= stone_num; p++){
				memo[i][k][p] = Unknown;
			}
		}
	}

	for(int i = 0; i < N; i++){
		scanf("%d %d",&me[i],&enemy[i]);
	}

	if(recursive(Sente,stone_num,0) == Sente){
		printf("1\n");
	}else{
		printf("0\n");
	}
}


int main(){

	while(true){
		scanf("%d",&N);
		if(N == 0)break;

		func();
	}

	return 0;
}

Measured memory_bytes: 3840
#include<bits/stdc++.h>
using namespace std;
#define INF 1e9
typedef struct{
  int cost;
  int to;
}edge;

int main(){
  int V,E,r;
  vector< edge >v[100000];
  cin>>V>>E>>r;
  for(int i=0;i<E;i++){
    int s;
    edge t;
    cin>>s>>t.to>>t.cost;
    v[s].push_back(t);
  }
  int d[100000];
  for(int i=0;i<V;i++)d[i]=INF;
  d[r]=0;
  priority_queue< pair<int,int> > q;
  q.push(make_pair(0,r));
  while(!q.empty()){
    int cost=-q.top().first;
    int to=q.top().second;
    q.pop();
    if(cost>d[to])continue;
    for(int j=0;j<v[to].size();j++){
      edge e=v[to][j];
      
      int ncost=e.cost+cost;
      if(ncost<d[e.to]){
	d[e.to]=ncost;
	q.push(make_pair(-d[e.to],e.to));
      }
    }
  }
  for(int i=0;i<V;i++){
    if(d[i]==INF)cout<<"INF"<<endl;
    else cout<<d[i]<<endl;
  }
  return 0;
}

Measured memory_bytes: 13084
// #include <bits/stdc++.h>
#include<iostream>
#include<iomanip>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<set>
#include<map>
#include<queue>
#define rep(i,n) for(int i=0;i<n;i++)
#define reps(i,x,n) for(int i=x;i<n;i++)
#define breps(i,x,n) for(int i=x;i>=n;i--)
#define exrep(x,vec) for(auto&& x : vec);
#define PI 3.14159265358979323846264338327950288
const int MOD{ int(1e9 + 7) };	// = 1000000007
const int inf{ 2100000000 };	// = 2100000000 (MAX:2147483647)
typedef long long ll;
using namespace std;

/**
* ------------- ここからコード -------------
*/


int main(void) {

	ll N;
	cin >> N;
	vector<int> A(N);
	ll ans = 0;
	rep(i, N) {
		cin >> A[i];
		if (i == 0) continue;

		if (A[i - 1] > A[i]) {
			ans += A[i - 1] - A[i];
			A[i] = A[i - 1];
		}
	}

	cout << ans << endl;

	return 0;
}


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


int main() {
	int n; cin >> n;
	int p[50];
	int q[50];

	for (int i = 0; i < n; i++)cin >> p[i];
	for (int i = 0; i < n; i++)q[i] = p[i];
	sort(q, q + n);

	int w = 0;
	for (int i = 0; i < n; i++)
		if (p[i] != q[i]) w++;

	if (w <= 2) cout << "YES" << endl;
	else cout << "NO" << endl;

	return 0;
}


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

 
int main()
{
    int N;
    int  t[100002] ={};
    int x[100002] ={};
    int y[100002] ={};
   int kai;
   int i;
    int t_temp=0;
    int x_temp=0;
    int y_temp=0;
  
    t[0]=0;
    x[0]=0;
    y[0]=0;
  
 // 整数の入力
    scanf("%d", &N);
 // printf("%d\n",N);
    for(i = 1; i < N +1;i++){
      scanf("%d %d %d", &t[i],&x[i], &y[i]);      
//      printf("%d %d %d", t[i],x[i], y[i]);
      t_temp=t[i] - t[i-1];
/*      if(0 < x[i] - x[i-1]) x_temp=x[i] - x[i-1];
      else  x_temp=x[i-1] - x[i];
      if(0 < y[i] - y[i-1]) y_temp=y[i] - y[i-1];
      else  y_temp=y[i-1] - y[i];
 */
      x_temp=abs(x[i] - x[i-1]);
      y_temp=abs(y[i] - y[i-1]);
      
//      printf("%d %d %d\n", t_temp,x_temp, y_temp);
 //     printf("%d \n", abs((t_temp-(x_temp+y_temp))));
  //    printf("%d \n", t_temp-(x_temp+y_temp));
      if((0>(t_temp-(x_temp+y_temp))) || ((1==(t_temp-(x_temp+y_temp)) %2))){
//      if(0>(t_temp-(x_temp+y_temp))){
//        if(0 != abs((t_temp-(x_temp+y_temp)) ) %2 ){
        printf("No\n");
        return 0;
      }
    }
 
    printf("Yes\n");

return 0;
}


Measured memory_bytes: 1280
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

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

    string t;
    cin >> t;

    for (auto& c : t) {
        if (c == '?') c = 'D';
    }

    cout << t << endl;

    return 0;
}

Measured memory_bytes: 3740
if __name__ == "__main__":
    ABC=input().split(" ")
    A,B,C=int(ABC[0]),int(ABC[1]),int(ABC[2])
    K=input()
    K=int(K)
    cnt=0
    while(cnt<=K and B<=A):
        B*=2
        cnt+=1
    while(cnt<=K and C<=B):
        C*=2
        cnt+=1
    if(cnt<=K):
        print("Yes")
    else:
        print("No")

Measured memory_bytes: 9192
#include "bits/stdc++.h"
using namespace std;

int main()
{
	int64_t a, b;
	cin >> a >> b;

	int64_t num;
	int64_t large, small, amari;
	large = max(a, b);
	small = min(a, b);
	while (true) {
		amari = large % small;
		if (amari == 0) {
			num = small;
			break;
		} else {
			large = small;
			small = amari;
		}
	}

	vector<int64_t> yakusuu;
	for (int64_t i = 1; i * i <= num; i++) {
		if (num % i == 0) {
			yakusuu.push_back(i);
			if (num != i * i) {
				yakusuu.push_back(num / i);
			}
		}
	}

	sort(yakusuu.begin(), yakusuu.end());
	int size = yakusuu.size();
	int ans = 1;
	for (int i = 1; i < size; i++) {
		int cnt = 0;
		for (int j = 0; j <= i; j++) {
			if (yakusuu.at(i) % yakusuu.at(j) == 0) {
				cnt++;
			}
		}
		if (cnt == 2) {
			ans++;
		}
	}

	cout << ans << endl;
}


Measured memory_bytes: 384
package main

import (
	"fmt"
)

const MOD = 1000000007

func ModAdd(a, b int64) int64 {
	return (a + b) % MOD
}

func ModMul(a, b int64) int64 {
	return a * b % MOD
}

func ModSub(a, b int64) int64 {
	r := (a%MOD - b%MOD) % MOD
	if r < 0 {
		r += MOD
	}
	return r
}

func ModDiv(a, b int64) int64 {
	return a % MOD * ModInv(b) % MOD
}

func ModPow(a, n int64) int64 {
	var r int64 = 1
	for n > 0 {
		if n&1 == 1 {
			r = r * a % MOD
		}
		a = a * a % MOD
		n >>= 1
	}
	return r
}

func ModInv(a int64) int64 {
	var b, u, v int64 = MOD, 1, 0
	for b > 0 {
		t := a / b
		a -= t * b
		a, b = b, a
		u -= t * v
		u, v = v, u
	}
	u %= MOD
	if u < 0 {
		u += MOD
	}
	return u
}

type Q struct {
	idx, value int
	a, b       int
	index      int
}

type QS []*Q

func (p QS) Len() int           { return len(p) }
func (p QS) Less(i, j int) bool { return p[i].value > p[j].value }
func (pq QS) Swap(i, j int) {
	pq[i], pq[j] = pq[j], pq[i]
	pq[i].index = i
	pq[j].index = j
}

func (pq *QS) Push(x interface{}) {
	n := len(*pq)
	item := x.(*Q)
	item.index = n
	*pq = append(*pq, item)
}

func (pq *QS) Pop() interface{} {
	old := *pq
	n := len(old)
	item := old[n-1]
	old[n-1] = nil  // avoid memory leak
	item.index = -1 // for safety
	*pq = old[0 : n-1]
	return item
}

func main() {
	var N int
	fmt.Scanf("%d\n", &N)
	A := make([]int, N)
	for i := 0; i < N; i++ {
		var a int
		fmt.Scan(&a)
		A[i] = a
	}
	ok := true
	for i := N - 1; i > 0; i-- {
		curr := A[i]
		next := A[i-1]
		if curr >= next {
			continue
		}
		if curr+1 == next {
			A[i-1] -= 1
			continue
		}
		ok = false
	}
	if ok {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}

}


Measured memory_bytes: 5504
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
map<int,int> m;
int main()
{
    ll n,ans=0;
    string s,t;
    cin>>s;
    cin>>t;
    n=s.length();
    for(int i=0;i<n;i++)
    {
        if(s[i]!=t[i])
        {
            ans++;
        }
    }
    cout<<ans<<endl;
}

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

using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;
typedef vector < vector<ll> > Mat;

#define fi first
#define se second

const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll MOD3 = 1812447359;
const ll INF = 1ll << 62;
const double PI = 2 * asin(1);

void yes() {printf("yes\n");}
void no() {printf("no\n");}
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

ll N, M, ans = 1;

int main(){
  cin >> N >> M;
  if (abs(N - M) >= 2){
    cout << 0 << endl; return 0;
  }
  for (ll i = 1; i <= N; i++) ans *= i, ans %= MOD;
  for (ll i = 1; i <= M; i++) ans *= i, ans %= MOD;
  if (N == M) ans *= 2, ans %= MOD;
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3636
# coding: utf-8
# Your code here!
#########行列読み込み ##############################################
"""
from sys import stdin
n = int(stdin.readline().rstrip())
data = [stdin.readline().rstrip().split() for _ in range(n)]
print(data)
print(*data, sep='\n')
"""
##################################################################
#########入力系####################################################
"""
s =input()
s=list(input())
a=int(input())
x,y = map(int,input().split())	
li = input().split()	
li = list(map(int,input().split()))	
li = input().split('T')	
"""
##################################################################
s=list(input())
#print(s)
ans = []
for i in range(len(s)):
    print("x",end="")
    
    






Measured memory_bytes: 38384
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;

int main(){
    int N; cin >> N;
    vector<int> A(N+2, 0);
    for(size_t i = 1; i <= N; i++)
    {
        cin >> A[i];
    }
    int total = 0;
    for(size_t i = 1; i <= N+1; i++)
    {
        total += abs(A[i] - A[i-1]);
    }
    for(size_t i = 1; i <= N; i++)
    {
        cout << total - abs(A[i+1] - A[i]) - abs(A[i] - A[i-1]) + abs(A[i+1] - A[i-1]) << endl;
    }
    
    return 0;
}

Measured memory_bytes: 1664
#include "bits/stdc++.h"
using namespace std;
#define int long long
#define double long double
#define low lower_bound
#define upp upper_bound
#define rep(i,n) for (int i = 0; i < (int)(n); ++i)
#define Rep(i,n) for (int i = (int)(n); i >= 0; i--)
#define all(vec) vec.begin(), vec.end()
#define rever(vec) reverse(all(vec));
#define cend cout << endl;
#define prique(T) priority_queue<T, vector<T>, greater<T>>
#define prique2(T) priority_queue<T>
struct edge { int to, cost; };
using P = pair<int, int>;
using PP = pair<P, int>;
const int mod2 = 998244353;
const int mod = (int)1e9 + 7, inf = (int)1e16;

int modpow(int x, int n) {
	int ans = 1;
	while (n > 0) {
		if (n & 1) {
			ans *= x;
			if (mod <= ans) ans %= mod;
		}
		x *= x;
		if (mod <= x) x %= mod;
		n >>= 1;
	}
	return ans;
}

int fact[114514];
void f_init(int n) {
	fact[0] = fact[1] = 1;
	for (int i = 2; i <= n; ++i) {
		fact[i] *= fact[i - 1];
		if (mod <= fact[i]) fact[i] %= mod;
	}
	return;
}

int comb(int n, int r) {
	if (n < r) return 0;
	int ans = fact[n] * modpow(fact[n - r], mod - 2) % mod * modpow(fact[r], mod - 2);
	if (ans < 0) return ans + mod;
	return ans;
}

int perm(int n, int r) {
	if (n < r) return 0;
	if (n - r < r) r = n - r;
	int ans= fact[n] * modpow(fact[n - r], mod - 2) % mod;
	if (ans < 0) return ans + mod;
	return ans;
}

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

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

bool pri(int p) {
	for (int i = 2; i * i <= p; ++i) if (p % i == 0) return false;
	return p > 1;
}

map<int, int>factring(int n) {
	map<int, int>ans;
	for (int i = 2; i * i <= n; ++i) {
		while (n % i == 0) {
			n /= i;
			++ans[i];
		}
	}
	if (n != 1) ++ans[n];
	return ans;
}

P operator+(const P& a, const P& b) {
	return P(a.first + b.first, a.second + b.second);
}
P operator-(const P& a, const P& b) {
	return P(a.first - b.first, a.second - b.second);
}

int n, k;
int a[2222];
int ans;
signed main() {
	cin >> n >> k;
	rep(i, n) {
		cin >> a[i];
	}
	rep(i, n) {
		int cnt = 0, cnt1 = 0;
		for (int j = i + 1; j < n; j++) {
			if (a[i] > a[j]) cnt++;
		}
		rep(j, n) {
			if (i != j) if (a[i] > a[j]) cnt1++;
		}
		ans += k * cnt % mod + k * (k - 1) / 2 % mod * cnt1 % mod;
		ans %= mod;
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
s = input()
l = {"R":1,"L":2,"U":3,"D":4}

ans = "Yes"
for i,c in enumerate(s):
    if i%2 == 0 and c == "L":
        ans = "No"
    elif i%2 != 0 and c == "R":
        ans = "No"
        
print(ans)
        

Measured memory_bytes: 2940
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vin=vector<int>;
using vll=vector<long long>;
using vvin=vector<vector<int>>;
using vvll=vector<vector<long long>>;
using vstr=vector<string>;
using vvstr=vector<vector<string>>;
using vch=vector<char>;
using vvch=vector<vector<char>>;
using vbo=vector<bool>;
using vvbo=vector<vector<bool>>;
using vpii=vector<pair<int,int>>;
using pqsin=priority_queue<int,vector<int>,greater<int>>;
#define mp make_pair
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,s,n) for(int i=(s);i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define decp(n) cout<<fixed<<setprecision((int)n)
const int inf=1e9+7;

int main(){
    int n,m,q;cin>>n>>m>>q;
    vin a(q),b(q),c(q),d(q);
    rep(i,q)cin>>a[i]>>b[i]>>c[i]>>d[i];
    vvin t(100050,vin(10));
    int j=0;
    rep2(e,1,m+1)rep2(f,e,m+1)rep2(g,f,m+1)rep2(h,g,m+1)rep2(i,h,m+1)rep2(v,i,m+1)rep2(k,v,m+1)rep2(l,k,m+1)rep2(r,l,m+1)rep2(s,r,m+1){
        t[j][0]=e;
        t[j][1]=f;
        t[j][2]=g;
        t[j][3]=h;
        t[j][4]=i;
        t[j][5]=v;
        t[j][6]=k;
        t[j][7]=l;
        t[j][8]=r;
        t[j][9]=s;
        j++;
    }
    int sum;
    int M=0;
    rep(u,j){
        sum=0;
        rep(w,q){
            if(t[u][b[w]-1]-t[u][a[w]-1]==c[w])sum+=d[w];
        }
        M=max(M,sum);
    }
    cout<<M<<endl;
}

Measured memory_bytes: 13568
#include <bits/stdc++.h>
#define ll long long int
using namespace std;
 
int main() {
    int n,m; 
	cin>>n>>m;
 
    priority_queue<int> pq;
    
    for (ll i = 0; i < n; ++i) {
    	ll a;
        cin>>a;
        pq.push(a);
    }
 
    for (ll i = 0; i < m; ++i) {
        ll tmp=pq.top();
        pq.pop();
        tmp/=2;
        pq.push(tmp);
    }
 
    ll ans=0;
 
    while(!pq.empty()){
        ans+=(ll)pq.top();
        pq.pop();
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 892
#include<bits/stdc++.h>
using namespace std;
int main(void){
    int n;
    //int a[1000000001];
    vector<int> a;
    cin>>n;
    for(int i=0;i<n;i++){
        int s;
        cin>>s;
        a.push_back(s);
    }
    sort(a.begin(),a.end());
    int ans=0;
    int b=0;
    int i;
    for(i=1;i<a.size();i++){
        if(a[b]!=a[i]){
            if((i-b)%2!=0)ans++;
            b=i;
        }
    }
    if(((i-1)-b)%2==0)ans++;
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 892
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
from itertools import permutations, accumulate, combinations, combinations_with_replacement, groupby
from math import sqrt, ceil, floor, factorial, gcd
from bisect import bisect_left, bisect_right, insort_left, insort_right
from copy import deepcopy
from operator import itemgetter
from functools import reduce, lru_cache  # @lru_cache(None)
import sys  # def input(): return sys.stdin.readline().rstrip() # sys.setrecursionlimit(10**6)

n = int(input())
L = list(int(x) for x in input().split())
if n <= 2:
    print(0)
    exit()
ans = 0
for a, b, c in combinations(L, 3):
    if a != b and b != c and c != a:
        if a + b > c and b + c > a and c + a > b:
            ans += 1
print(ans)

Measured memory_bytes: 74684
parseInt(x) = parse(Int, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function main()
	k,x = readline() |> split |> parseMap
	for i in x-k+1:x+k-2
		print(i, " ")
	end
	println(k+x-1)
end

main()

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

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

    vector<int> A(N, 0);
    int64_t tmp = 0;
    int64_t sum = 0;
    int64_t MOD = 1000000007;

    for(int i = 0; i < N; i++) {
        cin >> A.at(i);
    }

    for(int i = N-1; i >= 1; i--) {
        tmp += A.at(i);
        sum += A.at(i-1) * tmp;
        tmp %= MOD;
        sum %= MOD;
    }
    
    cout << sum << endl;

    return 0;
    
}

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

using namespace std;

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

   temp = a;
   a = b;
   b = temp;

   temp = a;
   a = c;
   c = temp;

   cout << a << " " << b << " " << c;   
   

   }

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
#define show(x) {for(auto i: x){cout << i << " ";} cout << endl;}
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
    int X, N;
    cin >> X >> N;
    vector<int> A(102, 0);
    rep(i, N) {
        int p;
        cin >> p;
        A[p] = 1;
    }
    P ans(999, -1);
    for (int i = 0; i <= 101; i++) {
        if (A[i] == 1) continue;
        int diff = abs(i - X);
        ans = min(ans, P(diff, i));
    }
    cout << ans.second << '\n';
    return 0;
}

Measured memory_bytes: 3576
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
using namespace std;
#define rep(N) for(int i=0;i<N;i++)
#define rep2(N1,N2) for(int i=0;i<N1;i++)for(int j=0;j<N2;j++)
#define rep3(N1,N2,N3)for(int i=0;i<N1;i++)for(int j=0;j<N2;j++)for(int k=0;k<N3;k++)
#define For(i,N) for(int i=0;i<N;i++)
void yn(bool b) {
	if (b)printf("yes\n");
	else printf("no\n");
}

void Yn(bool b) {
	if (b)printf("Yes\n");
	else printf("No\n");
}

void YN(bool b) {
	if (b)printf("YES\n");
	else printf("NO\n");
}

int main(){
	int S, W;
	cin >> S >> W;
	if (S > W)
		cout << "safe";
	else
		cout << "unsafe";
}

Measured memory_bytes: 3672
#include<bits/stdc++.h>
#define int long long int
#define inf 1000000000000
#define hell (int)(1e9+7)

using namespace std;

void solve(){
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    int i=0;
    while(a>0&&c>0){
        if(i%2==0)
            c-=b;
        else
            a-=d;
        i++;
    }
    if(a>0)
        cout<<"Yes";
    else
        cout<<"No";
}

signed main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t;
    //cin>>t;
    t=1;
    while(t--){
        solve();
    }
    return 0;
}


Measured memory_bytes: 3652
// 失敗するからこそ そこから立ち向かって行く強さがあってそんな強さが本当の強さだと私は思うから
// ぜったいあきらめない
#if defined(DAIJOBU)
#include "/home/ichigo/includes.hpp"
#include "/home/ichigo/debug.hpp"
#define deb(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#include <bits/stdc++.h>
#define deb(x...)
#endif
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)

using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long lint;
typedef vector<lint> vlint;
typedef vector<vlint> vvlint;
typedef pair<lint, lint> plint;
typedef double ld;

template<class T> bool chmin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool chmax(T &a, T b) { return a < b ? (a = b, true) : false; }

int h(int x, int y){
	return x * x + 2 * x * y + x + 1;
}

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

	int a, b, c, d;
	cin >> a >> b >> c >> d;
	cout << min(a, b) + min(c, d) << '\n';
	return 0;
}



Measured memory_bytes: 256
input_line = input().split()
H = int(input_line[0])
W = int(input_line[1])

square = []
empty = []
for i in range(W+2):
    empty.append('.')
square.append(empty)

for i in range(H):
    line = list(input())
    line.append('.')
    line.insert(0, '.')
    square.append(line)

square.append(empty)
a = 0
for i in range(H):
    for j in range(W):
        if square[1 + i][1 + j] =='#':
            if square[i][1 + j] == '#' or square[i + 1][j] == '#'\
               or square[i +1][j+2] == '#' or square[i +2][j +1] =='#':
                continue
            else:
                a = 1
                break

if a == 0:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3064
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;

typedef long long ll;

#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define per(i,a,b) for(ll i=b-1LL;i>=(a);--i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(c) string(1,c)
#define print(x) cout<<#x<<" = "<<x<<endl;

#define MOD 1000000007

int main() {
  ll n;
  cin>>n;
  vector<ll> v;
  ll sum = 0;
  rep(i,0,n){
    ll a;
    cin>>a;
    v.pb(a*n);
    sum+=a*n;
  }
  ll p = sum/n;
  vector<pair<ll,ll> > vp;
  rep(i,0,v.sz){
    vp.pb(mp(abs(v[i]-p),i));
  }
  sort(all(vp));
  cout << vp[0].se << endl;
  return 0;
}

Measured memory_bytes: 256
s = input()
slen = len(s)

def keisan(s):
    smod = s
    wa = 0
    while smod.count("+") != 0:
        wa += int(smod[:smod.index("+")])
        smod = smod[smod.index("+")+1:]
    wa += int(smod)
    return wa

kotae = 0
for i in range(2**(slen-1)):
    ibin = bin(i)[2:]
    si = s
    for j in range(1, len(ibin)+1):
        if ibin[-j] == "1":
            si = si[:slen-j]+"+"+si[slen-j:]
        else:
            pass
    kotae += keisan(si)

print(kotae)

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

int main() {
	int N, sums = 0;
	cin >> N;
  	int culc = N;
  	while (culc > 0){
    sums += culc % 10;
    culc /= 10;
    }
    int hantei = N % sums;
	if (hantei != 0){
    	cout << "No" << endl;
    }
  	else {
    	cout << "Yes" << endl;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
ll gcd(ll a,ll b){return b!=0?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}

int main(){
    ll n,a=1;
    string s;
    char c;
    cin>>n>>s;
    c=s[0];
    for(ll i=1;i<n;i++){
        if(s[i]!=c){
            a++;
            c=s[i];
        }
    }
    cout<<a<<endl;
    return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define mst(a,b) memset(a,b,sizeof(a))
#define lowbit(x) ((x)&(-x))
#define X first
#define Y second
using namespace std;
using namespace __gnu_cxx;
using namespace __gnu_pbds;
typedef long long LL;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int inf = 0x3f3f3f3f;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const int maxn = 200000+10;
const int maxm = 200000+10;
const int mod = 1e9+7;
const double eps = 1e-9;
int main() {
#ifdef local
    freopen("in.txt", "r", stdin);
//    freopen("out.txt", "w", stdout);
#endif
    ios::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    ll ans=INF;
    int n,m; cin>>n>>m;
    if (n>=3){
        if (n%3) ans=min(ans,1ll*m); else ans=0;
    }
    if (m>=3){
        if (m%3) ans=min(ans,1ll*n); else ans=0;
    }
    for (int i=1;i<=n-1;i++){
        ll a=1ll*i*m,b=1ll*(m/2)*(n-i),c=1ll*(m-m/2)*(n-i);
        ans=min(ans,max({a,b,c})-min({a,b,c}));
    }
    for (int i=1;i<=m-1;i++){
        ll a=1ll*i*n,b=1ll*(n/2)*(m-i),c=1ll*(n-n/2)*(m-i);
        ans=min(ans,max({a,b,c})-min({a,b,c}));
    }
    cout<<ans<<"\n";
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#define N 101
#define INF 100000
#define WHITE 0
#define GRAY 1
#define BLACK 2

int n,mat[N][N];

int prim(){
  int u,minv,i,v;
  int d[N],p[N],color[N];

  for(i=0;i<n;i++){
    d[i]=INF;
    p[i]=-1;
    color[i]=WHITE;
  }

  d[0]=0;

  while(1){
    minv=INF;
    u=-1;
    for(i=0;i<n;i++){
      if(minv>d[i]&&color[i]!=BLACK){
        u=i;
        minv=d[i];
      }
    }
    if(u==-1) break;
    color[u]=BLACK;
    for(v=0;v<n;v++){
      if(color[v]!=BLACK&&mat[u][v]!=INF){
        if(d[v]>mat[u][v]){
          d[v]=mat[u][v];
          p[v]=u;
          color[v]=GRAY;
        }
      }
    }
  }
  int sum=0;
  for(i=0;i<n;i++){
    if(p[i]!=-1) sum+=mat[i][p[i]];
  }
  return sum;
}

int main(){
  int i,j,a;

  scanf("%d",&n);
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      scanf("%d",&a);
      //mat[i][j]=(a==-1)?INF:a;
      if(a==-1) mat[i][j]=INF;
      else mat[i][j]=a;
    }
  }
printf("%d\n",prim());
return 0;
}

Measured memory_bytes: 640