akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N,K, x,num=0;
  cin >> N>>K;

  for(int i=0; i<N; i++){
    cin>>x;
    num += 2*min(x,abs(K-x));
  }
  cout << num << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<queue>
#include<vector>
#include<string.h>

using namespace std;

long long a[100000];
long long N,K,Q;

int main()
{
  cin >> N >> K >> Q;
  
  int i,j;
  for(i=0;i<N;i++)
  {
    a[i]=K-Q;
  }

  for(i=0;i<Q;i++)
  {
    cin >> j;
    j--;
    a[j]++;
  }
  
  for(i=0;i<N;i++)
  {
    if(a[i]>0)
    {
      cout << "Yes\n";
    }
    else
    {
      cout << "No\n";
    }
  }
    


 return 0; 
}

Measured memory_bytes: 1408
#include<stdio.h>
#include<algorithm>
#include<iostream>
#include<string.h>

using namespace std;
int a[55],n,sum;
int main()
{

    while(~scanf("%d",&n))
    {
        sum=0;
      for(int i=1;i<=n;i++)
        cin>>a[i];
    for(int i=1;i<n;i++)
        for(int j=i+1;j<=n;j++)
           sum+=a[i]*a[j];
    cout<<sum<<endl;
    }

       return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define max 100001
bool prime[max];
int p[max];
void pr()
{
    int sum=0;
    memset(prime,true,sizeof(prime));
    prime[0]=false;
    prime[1]=false;
    for(int p=2;p*p<=max;p++)
    {
        if(prime[p]==true)
        {
            for(int i=p*2;i<=max;i+=p)
            prime[i]=false;
        }
    }
    for(int i=0;i<max;i++)
    {
       if(prime[i]==true&&prime[(i+1)/2]==true) 
       sum++;
       p[i]=sum;
    }
}
int main() {
	// your code goes here
	int q,a,b,i,c;
	pr();
	cin>>q;
	while(q--)
	{
	    c=0;
	  cin>>a>>b;
	  cout<<p[b]-p[a-1]<<endl;
	}
	return 0;
}


Measured memory_bytes: 1152
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
typedef tree<ii,null_type,less<ii>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;

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

Measured memory_bytes: 256
N,Q = map(int, input().split())
S = str(input())

before = ''
i = 0
num = 0
data_list = {}
for s in S:
    if before == 'A' and s == 'C':
        num += 1
    before = s
    data_list[i] = num
    i += 1

ans = ''
for q in range(Q):
    r,l = map(int, input().split())
    ans += str(data_list[l-1]-data_list[r-1])+'\n'

print(ans.rstrip())

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

int n;
vector<int> p;

void solve() {
  int res = 0;
  for (int i = 1; i < n - 1; i++) {
    if ((p[i - 1] < p[i] && p[i] < p[i + 1]) ||
        (p[i - 1] > p[i] && p[i] > p[i + 1])) {
      res++;
    }
  }
  cout << res << '\n';
}

int main() {
  cin >> n;
  p.resize(n);
  for (int i = 0; i < n; i++) {
    cin >> p[i];
  }
  solve();
  return 0;
}


Measured memory_bytes: 256
# coding:utf-8

INF = float('inf')


N = int(input())
S = input()

num_E = S[:].count('E')
num_W = S[:].count('W')


e = num_E
w = num_W
ans = INF
for s in S:
    cost = 0
    if s == 'E':
        e -= 1
        cost = e + (num_W - w)
    else:
        w -= 1
        cost = e + (num_W - w - 1)
    ans = min(ans, cost)

print(ans)

Measured memory_bytes: 3708
#include <iostream>
#include <set>
#include <queue>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
#include <numeric>
#include <functional>

using namespace std;
#define ALL(x)              (x).begin(),(x).end()
typedef long long           ll;
#define REP(i, n)           for (ll i = 0 ; i < (ll)n ; ++i)
#define REPN(i, m, n)       for (ll i = m ; i < (ll)n ; ++i)
#define INF                 (ll)1e9
#define MOD                 (1000 * 1000 * 1000 + 7)
#define Ceil(x, n)          (((((x))+((n)-1))/n))
#define CeilN(x, n)         (((((x))+((n)-1))/n)*n)
#define FloorN(x, n)        ((x)-(x)%(n))
#define IsOdd(x)            (((x)&0x01UL) == 0x01UL)
#define IsEven(x)           (!IsOdd((x)))
#define M_PI                3.14159265358979323846
typedef pair<ll, ll>	    P;

/*-----------------------------------------------------------------------------
　処理
 -----------------------------------------------------------------------------*/
int main()
{
	ll N;
	cin >> N;
	vector<ll> A(N);
	REP(i, N) cin >> A[i];

	map<ll, ll> mpAdd;
	map<ll, ll> mpSub;
	REP(i, N) {
		mpAdd[i + 1 + A[i]]++;
		mpSub[i + 1 - A[i]]++;
	}

	ll ans = 0;
	for (auto itAdd = mpAdd.begin(); itAdd != mpAdd.end(); ++itAdd) {
		auto itSub = mpSub.find(itAdd->first);
		if (itSub != mpSub.end()) {
			ans += itSub->second * itAdd->second;
		}
	}

	cout << ans<< endl;
	return 0;
}


Measured memory_bytes: 27904
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define MOD1 1000000007
#define MOD2 998244353
#define LIMIT1 200002
#define LIMIT2 500002
typedef long long ll;
typedef long double ld;
typedef const void cv;
#define rep(i,n) for((i)=0;(i)<(n);(i)++)
#define per(i,n) for((i)=(n)-1;(i)>=0;(i)--)
#define max(a,b) ((a)>(b) ? (a) : (b))
#define min(a,b) ((a)<(b) ? (a) : (b))
#define zt(a,b) (max((a),(b))-min((a),(b)))
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll nPr(int n,int r){ll i,result=1;rep(i,r){result*=(ll)(n-i);}return result;}
ll nCr(int n,int r){ll i,result=1;if(n<r) return 0;rep(i,min(r,n-r)){result*=(ll)(n-i);result/=(ll)(i+1);}return result;}
#define nHr(n,r) nCr((int)((n)+(r)+1),(int)(r))
#define sankaku(x) (((x)*((x)+1))/2)
int dx[8]={1,0,-1,0,1,-1,-1,1};
int dy[8]={0,1,0,-1,1,1,-1,-1};
int upint(const void *a, const void *b) { return *(int *)a < *(int *)b ? -1 : *(int *)a > *(int *)b ? 1 : 0; }
int downint(const void *a, const void *b) { return *(int *)a < *(int *)b ? 1 : *(int *)a > *(int *)b ? -1 : 0; }
int upchar(const void* left, const void* right) {return strcmp((char *)left,(char *)right);}
int downchar(const void* left, const void* right) {return strcmp((char *)right,(char *)left);}
ll modpow(ll a, ll n, ll mod) {
    ll res = 1;
    while (n > 0) {
        if (n & 1){
            res *= a; if(mod>=1) res %= mod;
        }
        a *= a; if(mod>=1) a %= mod;
        n >>= 1;
    }
    return res;
}
void initialize(){
    
}
int main(void){
  initialize();
  ll n,m,i,j,k,result=0;
  int a[LIMIT2]={0},b[10]={0},c=0;
  
  scanf("%lld",&n);
  rep(i,n){
    scanf("%d",&a[i]);
    if(a[i]<3200) b[a[i]/400]++;
    else c++;
  }
  rep(i,10) if(b[i]>=1) result++;
  printf("%lld %lld",max(result,1),result+(ll)c);
  return 0;
}



Measured memory_bytes: 2176
var min,n,i,j,x,m,r,a1,b1,c1:longint;
	a:array[-5..205,-5..205] of longint;
	b:array[-5..205]of longint;
	f:array[-5..205]of boolean;
procedure main(s,pre,now:longint);
var i,j,k:longint;
begin
	if now=r then begin
		for i:=1 to r do if f[b[i]] then begin
			if s+a[pre,b[i]]<min then min:=s+a[pre,b[i]];
			break;
		end;	
	end else
	for i:=1 to r do if f[b[i]] then begin
		f[b[i]]:=false;
		main(s+a[pre,b[i]],b[i],now+1);
		f[b[i]]:=true;
	end;
end;

begin
	fillchar(f,sizeof(f),true);
	readln(n,m,r);
	fillchar(a,sizeof(a),1);
	for i:=1 to n do a[i,i]:=0;
	//writeln(a[1,2]);
	for i:=1 to r do read(b[i]);
	for i:=1 to m do begin
		readln(a1,b1,c1);
		a[a1,b1]:=c1;
		a[b1,a1]:=c1;
	end;

	for x:=1 to n do for i:=1 to n do for j:=1 to n do
	if a[i,j]>a[i,x]+a[x,j] then a[i,j]:=a[i,x]+a[x,j];
	//for i:=1 to n do for j:=1 to n do writeln(i:5,j:5,a[i,j]:5);

	min:=maxlongint div 3*2;
	for i:=1 to r do begin
		f[b[i]]:=false;
		main(0,b[i],2);
		f[b[i]]:=true;
	end;
	writeln(min);
end.

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

int main() {

	int N;
	cin >> N;
	vector<int> col(9,0);
	int a;
	REP(i, N) {
		cin >> a;
		col[min(a/400,8)]++;
	}
	int ans = 0;
	for(int i=0; i<8; i++) {
		if(col[i]>0)ans++;
	}
	if(ans==0 && col[8]!=0) cout << "1 " << col[8] << endl;
	else cout << ans << " " << ans+col[8] << endl;
}

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


int main() {
  
  int N,L;
  
  cin>>N>>L;
  
  int minx=300;
  int a=0;
  int b=0;
  
  for(int i=1;i<N+1;i++){
     a=a+L+i-1;
 //   cout<<a<<endl;
    if(L+i-1>=0){
     
      minx=min(minx,L+i-1);
      b=0;
    }else{
      minx=min(minx,1-L-i);
      b=1;
    }
  }
//  cout<<minx<<endl;
  
  if(b==0){
  cout<<a-minx<<endl;
  }else{
    cout<<a+minx<<endl;
  }
}


 
  
  
  

Measured memory_bytes: 256
#include <iostream>
using namespace std;
#include <algorithm>
#include <cstring>
#define INF 1000000

int flg[100];

bool check(int p){

	if (flg[p] == 1) return false;
	return true;
}

int main(void){

	int n;

	cin >> n;
	int u, k;
	int date[100][100]; //date[??????????????????][?????´?????????]
	int dis[100]; //0????????????????????????????????¢

	memset(date, INF, sizeof(date));
	memset(dis, INF, sizeof(dis));
	memset(flg, 0, sizeof(flg));
	date[0][0] = 0;
	dis[0] = 0;
	for (int i = 0; i < n; i++){

		cin >> u >> k;
		for (int j = 0; j < k; j++){

			int v, c;
			cin >> v >> c;
			date[u][v] = c;
		}
	}

	while(1){
		int mini = INF;
		int p = -1;
		for (int i = 0; i < n; i++){
			if (check(i) && mini > dis[i]){
				p = i;
				mini = dis[i];
			}
		}
		if (p == -1) break;
		flg[p] = 1;
		for (int i = 0; i < n; i++){
			if (check(i) && dis[i] > dis[p] + date[p][i]){
				dis[i] = dis[p] + date[p][i];
			}
		}
	}

	for (int i = 0; i < n; i++){
		cout << i << ' ' << dis[i] << endl;
	}
}

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

using namespace std;

int n,m,i,j,x,y,ans;
int a[300000];
int mem[300000],sum[300000];

map<int,int> magic;

int main() {
    scanf("%d%d",&n,&m);
    for (i=0 ; i<n ; i++) {
        scanf("%d",&a[i]);
        sum[a[i]]++;
    }
    
    for (i=0 ; i<=n ; i++) {
        for (j=0 ; j<sum[i] ; j++) {
            magic[i-j]++;
            if (magic[i-j] == 1 && i-j >= 1) ans++;
        }
    }
    
    for (i=0 ; i<m ; i++) {
        scanf("%d%d",&x,&y);
        
        magic[a[x-1]-sum[a[x-1]]+1]--;
        if (magic[a[x-1]-sum[a[x-1]]+1] == 0 && a[x-1]-sum[a[x-1]]+1 >= 1) ans--;
        sum[a[x-1]]--;
        
        
        
        a[x-1] = y;
        
        magic[a[x-1]-sum[a[x-1]]]++;
        if (magic[a[x-1]-sum[a[x-1]]] == 1 && a[x-1]-sum[a[x-1]] >= 1) ans++;
        sum[a[x-1]]++;
        
        printf("%d\n",n-ans);
    }
}

Measured memory_bytes: 21120
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <numeric>
#include <ctime>
#include <complex>
#include <bitset>
#include <random>
#include <stack>

using namespace std;

typedef long long ll;
typedef long double ld;

//#define int ll
#define double ld
#define loop(i, n) for(int i = 0; i < (int)n; ++i)
#define loop1(i, n) for(int i = 1; i <= (int)n; ++i)
#define F first
#define S second
#define pb push_back
#define pi pair <int, int>
#define all(x) begin(x), end(x)
#define ti tuple <int, int, int>
#define Point Vect
#define mkt make_tuple
#define no {cout << "No"; return;}

void solve() {
    int n; cin >> n;
    vector <int> s(1 << n);
    loop(i, (1 << n))
        cin >> s[i];
    sort(all(s), greater<int>());
    vector <bool> used(1 << n), pused(1 << n);
    pused[0] = 1;
    loop(i, n) {
        int L = 0, R = 0;
        while (L < (1 << n)) {
            while (R < (1 << n) && (s[L] == s[R] || pused[R]))
                ++R;
            if (R == (1 << n))
                no;
            used[L] = used[R] = 1; ++R; ++L;
            while (L < (1 << n) && !pused[L])
                ++L;
        }
        pused = used;
    }
    cout << "Yes";
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    //int t; cin >> t; loop(i, t)
    solve();
    return 0;
}

Measured memory_bytes: 4220
#include <bits/stdc++.h>
#define pt(sth) cout << sth << "\n"
#define chmax(a, b) {if(a<b) a=b;}
#define chmin(a, b) {if(a>b) a=b;}
#define moC(a, s, b) (a)=((a)s(b)+MOD)%MOD
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
static const ll INF=1e18;
static const ll MAX=101010;
static const ll MOD=1e9+7;

/*
 for(i=0; i<N; i++)
   cin >> a[i];
*/

ll N;

void rec(string s, char lc, ll l) {
  if(l>=N) {
    pt(s);
    return;
  }
  
  ll cnt[26]={};
  for(ll i=0; i<s.size(); i++) {
    cnt[s[i]-'a']++;
  }
  
  ll t=0;
  for(ll i=0; i<26; i++) if(cnt[i]) t++;
  
  for(char c='a'; c<='a'+t; c++) {
    rec(s+c, c, l+1);
  }
  
}

int main(void) {
  ll i, j, k;
  cin >> N;
  
  rec("a", 'a', 1);
  
}



Measured memory_bytes: 1536
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())

time_list = [A, B, C, D, E]
# 最後の一品以外は切り上げ時刻の和を取ることに等しい
time_list_upper = [(((time - 1)//10)+1)*10 for time in time_list]
# 最後の一品は1の位が1～9で最小のやつ。
time_list_ones = [(time - 1) % 10 for time in time_list]
smallest_idx = time_list_ones.index(min(time_list_ones))
smallest = time_list.pop(smallest_idx)
time_list_upper.pop(smallest_idx)

print(sum(time_list_upper) + smallest)

Measured memory_bytes: 3064
#include <stdio.h>
int main (void) {
  char s[100];
  scanf("%s",s);
  int x = 0;
  for (int i=0;i<4;i++){
  	for(int j=i+1;j<4;j++){
      if(s[i] == s[j]){
      	x++;
      }
    }
  }
  if(x == 2){
  	printf("Yes");
  }
  else{
  	printf("No");
  }
}

Measured memory_bytes: 128
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int area = a * b;
		int length = (a + b) * 2;
		System.out.printf("%d %d\n", area, length);
	}
}

Measured memory_bytes: 26292
#include <bits/stdc++.h>
using namespace std;
#define int long long
using ll=long long;
using vi=vector<int>;
using pii=pair<int,int>;
#define ALL(c) begin(c),end(c)
#define RALL(c) rbegin(c),rend(c)
#define ITR(i,b,e) for(auto i=(b);i!=(e);++i)
#define FORE(x,c) for(auto &x:c)
#define REPF(i,a,n) for(int i=a,i##len=(int)(n);i<i##len;++i)
#define REP(i,n) REPF(i,0,n)
#define REPR(i,n) for(int i=(int)(n);i>=0;--i)
#define SZ(c) ((int)c.size())
#define CONTAIN(c,x) (c.find(x)!=end(c))
#define OUTOFRANGE(y,x,h,w) (y<0||x<0||y>=h||x>=w)
#define dump(...)
const int DX[9]={0,1,0,-1,1,1,-1,-1,0},DY[9]={-1,0,1,0,-1,1,1,-1,0};
#define INF (1001001001)
#define INFLL (1001001001001001001ll)
template<class T> ostream& operator << (ostream &os,const vector<T> &v) {
    ITR(i,begin(v),end(v)) os << *i << (i==end(v)-1 ? "" : "\n"); return os; }
template<class T> istream& operator >> (istream &is,vector<T> &v) {
    ITR(i,begin(v),end(v)) is >> *i; return is; }
template<class T> istream& operator >> (istream &is, pair<T,T> &p) {
        is >> p.first >> p.second; return is; }
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;}
//------------------------------------------------------------------------------
struct before_main_function {
    before_main_function() {
        #ifdef int
            #undef INF
            #define INF INFLL
            #define stoi stoll
        #endif
        cin.tie(0);ios::sync_with_stdio(false);
        cout<<setprecision(15)<<fixed;
        // #define endl "\n"
    }
} before_main_function;
//------------------8<------------------------------------8<--------------------

signed main() {
    int n;
    cin>>n;
    vector<vector<pii>> g(n);
    REP(i,n-1) {
        int a,b,c;
        cin>>a>>b>>c;
        a--,b--;
        g[a].push_back({b,c});
        g[b].push_back({a,c});
    }
    int Q,k;
    cin>>Q>>k;
    k--;
    vector<int> dist(n,INF);
    queue<int> q;
    dist[k]=0;
    q.push(k);
    while(!q.empty()) {
        int v=q.front(); q.pop();
        FORE(x,g[v]) {
            if(dist[x.first]==INF) {
                dist[x.first]=dist[v]+x.second;
                q.push(x.first);
            }
        }
    }

    while(Q--) {
        int x,y;
        cin>>x>>y;
        x--,y--;
        cout<<dist[x]+dist[y]<<endl;
    }
    return 0;
}


Measured memory_bytes: 9984
from operator import itemgetter
n,q=map(int,input().split())
a=[]
s=[0]


for i in range(n-1):
    a.append([int(j) for j in input().split()])
    s.append(0)

a.sort(key=itemgetter(0))

for i in range(0,q):
    P,X=map(int,input().split())
    s[P-1]=s[P-1]+X


for j in range(0,n-1):
    s[a[j][1]-1]=s[a[j][1]-1]+s[a[j][0]-1]


print(' '.join(map(str,s)))

Measured memory_bytes: 132684
//============================================================================
// Name        : LinkedList.cpp
// Author      : 
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <stdio.h>
#include <iostream>
#include <string.h>
#include <sstream>
#include <cstdlib>

using namespace std;

#define BUF_SIZE 1024

struct Node{
	int data;
	Node* prev;
	Node* next;
};

class ConnectedList{
public:
	ConnectedList(){
		motherNode = new Node();
		motherNode->data = -1;
		motherNode->prev = motherNode;
		motherNode->next = motherNode;
	};

	~ConnectedList(){
		Node* tmpNode = motherNode->next;
		Node* nextNode;
		while(tmpNode != motherNode){
			nextNode = tmpNode->next;
			delete tmpNode;
			tmpNode = nextNode;
		}
		delete motherNode;
	}

	void insertNode(int x){
		Node* tmpNode = motherNode->next;
		motherNode->next = new Node();
		motherNode->next->data = x;
		motherNode->next->next = tmpNode;
		motherNode->next->prev = motherNode;
		tmpNode->prev = motherNode->next;
	};

	void deleteNode(int x){
		Node* tmpNode = motherNode->next;
		while(tmpNode != motherNode && tmpNode->data != x){
			tmpNode = tmpNode->next;
		}
		if(tmpNode != motherNode){
		    tmpNode->prev->next = tmpNode->next;
		    tmpNode->next->prev = tmpNode->prev;
		    delete tmpNode;
		}
	}

	void deleteFirst(){
		Node* tmpNode = motherNode->next;
		if(tmpNode != motherNode){
		    motherNode->next = tmpNode->next;
		    tmpNode->next->prev = motherNode;
		    delete tmpNode;
		}
	}

	void deleteLast(){
		Node* tmpNode = motherNode->prev;
		if(tmpNode != motherNode){
			tmpNode->prev->next = motherNode;
			motherNode->prev = tmpNode->prev;
		}
		delete tmpNode;
	}

	void showList(){
		Node* tmpNode = motherNode->next;
		if(tmpNode != motherNode){
			cout << tmpNode->data;
			tmpNode = tmpNode->next;
		}
		while(tmpNode != motherNode){
			cout << " " << tmpNode->data;
			tmpNode = tmpNode->next;
		}
		cout << "\n";
	}

private:
	Node* motherNode;
};

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

	string line;
	getline(cin, line);
	int n_commands = stoi(line);

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

		string command;
		int data;
		cin >> command;
		if(command == "insert"){
			cin >> data;
			list.insertNode(data);
		}else if(command == "delete"){
			cin >> data;
			list.deleteNode(data);
		}else if(command == "deleteFirst"){
			list.deleteFirst();
		}else if(command == "deleteLast"){
			list.deleteLast();
		}
	}

	list.showList();

	return 0;
}



Measured memory_bytes: 34448
IDENTIFICATION DIVISION.
PROGRAM-ID. A-BEGINNER.
 
DATA DIVISION.
WORKING-STORAGE SECTION.
01 INP     PIC X(100).
01 IN-A     PIC 9.
01 IN-B     PIC 9.
01 IN-C     PIC 9.
 
PROCEDURE DIVISION.
MAIN-001.
  ACCEPT INP.
  UNSTRING INP DELIMITED BY ALL ' '
      INTO IN-A IN-B IN-C.
 
  IF (IN-A = IN-B) AND (IN-B NOT = IN-C) OR
     (IN-B = IN-C) AND (IN-C NOT = IN-A) OR
     (IN-C = IN-A) AND (IN-A NOT = IN-B)
     DISPLAY 'Yes'
  ELSE
     DISPLAY 'No'
  END-IF.
 
MAIN-EXIT.
  STOP RUN.


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

void fnInput(int& rnTarget, vector<int>& rvnForbid)
{
  int nForbidSiz;
  cin >> rnTarget >> nForbidSiz;
  rvnForbid.resize(nForbidSiz);

  for (int& rnForbid : rvnForbid)
    cin >> rnForbid;
}

int fnMinAbsNum(int nTarget, const vector<int>& cnrvnForbid)
{
  map<int, int> mpForbid;

  for (int nForbid : cnrvnForbid)
    mpForbid[ nForbid ]++;

  int nMore = nTarget;
  while (mpForbid[nMore] != 0)
    nMore++;

  int nLess = nTarget;
  while (mpForbid[nLess] != 0)
    nLess--;

  if (abs(nTarget - nMore) < abs(nTarget - nLess))
    return nMore;
  else
    return nLess;
}
  
int main()
{
  int nTarget;
  vector<int> vnForbid ;

  fnInput(nTarget, vnForbid);
  cout << fnMinAbsNum(nTarget, vnForbid) << endl;

  return 0;
}

Measured memory_bytes: 3648
//インクルード(アルファベット順)
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
//#include<unordered_map>//イテレータあるけど順序保持しないmap
//#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列
#include<valarray>//なんとなく追加
//メモ：表示桁数を大きくする　　cout << fixed << setprecision(20) << cm << endl;
using namespace std;
typedef long long ll;

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素
#define PI acos(-1.0)
#define answer(ans) cout<<ans<<endl;
#define input(N) cin >> N ;


signed main() {
	int ans=0,sizeT,sizeS,tmp;
	string  S, T;
	cin >> S >> T;
	sizeT = T.size();
	sizeS = S.size();
	for (int i = 0; i < sizeS - sizeT + 1; i++) {
		tmp = 0;
		for (int j = 0; j < sizeT; j++) {
			if (S.at(i + j) == T.at(j)) {
				tmp += 1;
			}
			if (tmp > ans) {
				ans = tmp;
			}
		}


	}
	ans = sizeT - ans;
	answer(ans);
	system("pause");
	return 0;
}

Measured memory_bytes: 3652
#include <array>
#include <bitset>
#include <iostream>
#include <random>
#include <string>
#include <vector>

using bs10 = std::bitset<1000>;
using bs3 = std::bitset<30>;

std::array<bs10, 30> key = {};

void init() {
  std::mt19937 gen(91);
  for (int i = 0; i != 30; i += 1) {
    for (int j = 0; j != 1000; j += 1) {
      if (gen() % 2) {
        key[i].set(j);
      }
    }
  }
}

bs3 hash(const bs10 &x) {
  bs3 ret = 0;
  for (int i = 0; i != 30; i += 1) {
    if ((key[i] & x).count() % 2) {
      ret.set(i);
    }
  }
  return ret;
}

void aandb() {
  for (int i = 0; i != 100; i += 1) {
    std::string s;
    std::cin >> s;
    std::cout << hash(bs10(s));
  }
  std::cout << "\n";
}

void ch() {
  std::vector<bs3> a(100);
  {
    std::string x;
    std::cin >> x;
    for (int i = 0; i != 100; i += 1) {
      a[i] = bs3(x.substr(30 * i, 30));
    }
  }
  std::vector<bs3> b(100);
  {
    std::string y;
    std::cin >> y;
    for (int i = 0; i != 100; i += 1) {
      b[i] = bs3(y.substr(30 * i, 30));
    }
  }
  for (int i = 0; i != 100; i += 1) {
    std::string s;
    std::cin >> s;
    const bs3 c = hash(bs10(s));
    for (int x = 0; x < 100; x += 1) {
      for (int y = 0; y < 100; y += 1) {
        if ((a[x] ^ b[y]) == c) {
          std::cout << x + 1 << " " << y + 1 << "\n";
          x = 100;
          y = 100;
        }
      }
    }
  }
}

int main() {
  init();
  std::string s;
  std::cin >> s;
  if (s[0] == 'C')
    ch();
  else
    aandb();
  return 0;
}



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

#define f(i,a,b) for( ll i = a; i < b ; i++ )
#define af(i,a,b) for( ll i = a; i >= b ; i--)
#define rep(i,a,b,k) for(ll i = a; i < b ; i+= k )
#define arep(i,a,b,k) for( ll i = a; i >= b ; i-= k)
#define ones(x) (ll) __builtin_popcount(x)
#define fs first
#define sc second
#define pb push_back
#define po pop_back
#define mp make_pair  
#define sz(a) (ll) a.size()
#define all(a) a.begin(), a.end()
#define sor(a) sort( a.begin(), a.end() )
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL)
#define ller ios::sync_with_stdio(false);cin.tsie(nullptr);cout.tie(nullptr)
#define watch(x) cout << (#x) << " is " << (x) <<"#" <<endl
#define PI 3.1415926535
using namespace std;
typedef long long ll;
typedef long double ld; 
typedef pair<ll,ll> ii ;
typedef vector<ll>  vi ;
typedef vector<ii> vii ;
const ll mod = 998244353;
const ll MAX = 3e3+23;
const ll inf = 1e18+7;


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

Measured memory_bytes: 3604
#include<bits/stdc++.h>
using namespace std;
int N, M;
int A[10];
int dp[100001];

bool Check(int k)
{
  fill_n(dp, 100001, -1);
  dp[0] = 0;
  for(int i = 0; i < N; i++) {
    for(int j = 0; j <= M; j++) {
      if(dp[j] >= 0) {
        dp[j] = k;
      } else if(j < A[i] || dp[j - A[i]] <= 0) {
        dp[j] = -1;
      } else {
        dp[j] = dp[j - A[i]] - 1;
      }
    }
  }
  return(dp[M] >= 0);
}


int main()
{
  while(cin >> N >> M, N) {
    for(int i = 0; i < N; i++) {
      cin >> A[i];
    }
    sort(A, A + N);
    int low = 0, high = M;
    while(high - low > 0) {
      int mid = (low + high) >> 1;
      if(Check(mid)) high = mid;
      else low = mid + 1;
    }
    cout << low << endl;
  }
}

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

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

int cnt = 1;
int sum = 0;
for(int i = 0; i < N; i++){ 
    int x;
    cin >> x;
    sum += x;
    if(sum <= X) cnt++;     
}


cout << cnt << endl; 
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<set>
#include<string>
#include<cstring>
#include<sstream>
#include<cmath>
#include<iomanip>  


using namespace std;



int main(){

    string s;
    cin >> s;

    int cnt = 0;

    for(int i = 1; i < s.length(); i++){
           if(s[i] == s[i-1]){
                s[i] = (s[i] == '0')? '1': '0';
                cnt++;
             } 
      }
    

    cout << cnt;

    


   return 0;
 
}

Measured memory_bytes: 512
#include <cmath>
#include <iostream>
#include <numeric>
#include <vector>
using namespace std;
int main()
{
    vector<int>p(5);
    for(auto & x : p){
        cin >> x;
    }
    auto time = 0;
    auto d = 0;
    for(const auto & x : p){
        int t = ceil(x/10.) * 10;
        d = max(t - x, d);
        time += t;
    }
    time -= d;
    cout << time;
    return 0;
}

Measured memory_bytes: 256
n = int(input())
ab = [list(map(int, input().split())) for _ in range(n)]
flag = True
sortedab = sorted(ab, key=lambda x:x[1])
cleartime = [0]*n
cleartime[0] = sortedab[0][0]
if cleartime[0] > sortedab[0][1]:
    flag = False
else:
    for i in range(1, n):
        cleartime[i] = cleartime[i-1] + sortedab[i][0]
        if cleartime[i] <= sortedab[i][1]:
            continue
        else:
            flag = False
            break
if flag:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 91352
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        String s = sc.next();

        boolean[][] b = new boolean[4][n + 1];
        b[0][0] = true;
        b[2][0] = true;
        b[2][1] = true;
        b[3][1] = true;

        for (int i = 1; i < n; i++) {
            for (boolean[] bb : b) {
                if (s.charAt(i) == 'o') {
                    bb[i + 1] = bb[i] ? bb[i - 1] : !bb[i - 1];
                } else {
                    bb[i + 1] = bb[i] ? !bb[i - 1] : bb[i - 1];
                }
            }
        }

        for (boolean[] bb : b) {
            if (bb[0] == bb[n]) {
                for (int i = 0; i < n; i++) {
                    boolean b0 = i == 0 ? bb[n - 1] : bb[i - 1];
                    boolean b1 = bb[i];
                    boolean b2 = i == n - 1 ? bb[0] : bb[i + 1];
                    if (s.charAt(i) == 'o') {
                        if ((b1 && b0 != b2) || (!b1 && b0 == b2)) {
                            break;
                        }
                    } else {
                        if ((b1 && b0 == b2) || (!b1 && b0 != b2)) {
                            break;
                        }
                    }
                    StringBuilder sb = new StringBuilder();
                    for (int j = 0; j < n; j++) {
                        if (bb[j]) {
                            sb.append("S");
                        } else {
                            sb.append("W");
                        }
                    }
                    System.out.println(sb.toString());
                    return;
                }
            }
        }
        System.out.println("-1");
    }
}

Measured memory_bytes: 25912
nums = [int(e) for e in input().split()]

if nums[2]%nums[1] == 0:
    A = nums[2]//nums[1]
else:
    A = nums[2]//nums[1] + 1

if nums[0]%nums[3] == 0:
    T = nums[0]//nums[3]
else:
    T = nums[0]//nums[3] + 1
 
if A <= T:
    print('Yes')
else:
    print('No')

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

typedef long long ll;
typedef pair<int, int> P;

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

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

int main(){
    int n; cin>>n; 
    vector<int> imos(100010, 0);
    for(int i=0; i<n; i++){
        int l, r; cin>>l>>r;
        imos[l]++, imos[r+1]--;
    }

    int ans=0;
    for(int i=1; i<=100000; i++){
        imos[i]+=imos[i-1];
        if(imos[i]>0) ans++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 640
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}
 
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};
 
    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
    
    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}
 
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };
 
    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };
 
    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };
 
    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };
 
    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}
 
//
// # Examples
//
// # integers
// input! { n: usize, m: usize, ... }
//
// # array
// input! { n: usize, v: [i32; n], }
//
// # matrix
// input! { n: usize, m: usize, mat: [[]] }
//
// # string
// input! { s: chars }
//
// 3 4
// ####
// #..#
// .#.#
//
// input!{
//     h: usize,
//     w: usize,
//     board: [chars; h],
// }
 
// https://practice.contest.atcoder.jp/tasks/practice_1
fn main() {
    input! { mut a: i32, mut b:i32 }
    let mut ans = 0;
    for _ in 0..2 {
        if a < b {
            ans += b;
            b -= 1;
        } else {
            ans += a;
            a -= 1
        }
    }
    println!("{}", ans);
}

Measured memory_bytes: 4352
// clang-format off
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = 3.14159265358979;
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
bool odd(const int &n) { return n & 1; }
bool even(const int &n) { return ~n & 1; }
template<typename T> int len(const T &v) { return v.size(); }
template<typename T = int> T in() { T x; cin >> x; return x; }
template<typename T = int> T in(T &&x) { T z(forward<T>(x)); cin >> z; return z; }
template<typename T> istream &operator>>(istream &is, vector<T> &v) { for (T &x : v) is >> x; return is; }
template<typename A, typename B> istream &operator>>(istream &is, pair<A, B> &p) { return is >> p.first >> p.second; }
template<typename T> ostream &operator<<(ostream &os, const vector<vector<T>> &v) { int n = v.size(); rep(i, n) os << v[i] << (i == n - 1 ? "" : "\n"); return os; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &v) { int n = v.size(); rep(i, n) os << v[i] << (i == n - 1 ? "" : " "); return os; }
template<typename A, typename B> ostream &operator<<(ostream &os, const pair<A, B> &p) { return os << p.first << ' ' << p.second; }
template<typename Head, typename Value> auto vectors(const Head &head, const Value &v) { return vector<Value>(head, v); }
template<typename Head, typename... Tail> auto vectors(Head x, Tail... tail) { auto inner = vectors(tail...); return vector<decltype(inner)>(x, inner); }
// clang-format on

main() {
  int n = in();
  vector<int> a(n);
  cin >> a;
  int q = in();
  while (q--) {
    int b, e;
    cin >> b >> e;
    reverse(a.begin() + b, a.begin() + e);
  }
  cout << a << endl;
}



Measured memory_bytes: 3092
#include <bits/stdc++.h>
#include<vector>
#include<set>
#define ll long long
using namespace std;
 

ll gcd(ll a,ll 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; 
}
int main() {
	
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll t,a,b,c,d,n,m,k,sum=0,i,j;
       string str;
     
     cin>>n;
     map<ll,ll>dp;
      
     vector<ll>v(n);
     for(i=0;i<n;i++)
	 {
	 	cin>>k;
	 	
	 	dp[k]++;
	 	 
	 }
     
     for(map<ll,ll>::iterator it=dp.begin();it!=dp.end();it++)
     {
     	 //cout<<it->second<<endl;
     	sum+=it->second-1;
	 }
	 if(sum%2)cout<<n-(sum+1)<<endl;
	 else cout<<n-sum<<endl;
     
      
     
     
  return 0;
}


Measured memory_bytes: 10240
#include<cstdio>
#include<map>
#include<queue>
#include<functional>
#include<climits>
using namespace std;
int s,d,a[100][100];
int F()
{
	bool f[100]={0};
	int r=0,i;
	typedef pair<int,int>P;
	P p;
	priority_queue<P,vector<P>,greater<P> >q;
	q.push(P(0,0));
	while(!q.empty())
	{
		p=q.top();q.pop();
		if(f[p.second])continue;
		f[p.second]=1;
		r+=p.first;
		for(i=0;i<s+d;++i)if(a[p.second][i]!=INT_MAX)q.push(P(a[p.second][i],i));
	}
	return r;
}
int main()
{
	int i,j,x;
	while(scanf("%d%d",&s,&d),s)
	{
		for(i=0;i<s;++i)
		{
			for(j=0;j<d;++j)scanf("%d",&x),a[i][s+j]=a[s+j][i]=(x>0?x:INT_MAX);
			for(j=0;j<s;++j)a[i][j]=0,a[i][i]=INT_MAX;
		}
		for(i=0;i<d;++i)for(j=0;j<d;++j)a[i+s][j+s]=INT_MAX;
		for(i=0;i<d-1;++i)for(j=0;j<d-i-1;++j)scanf("%d",&x),a[s+i+j+1][s+i]=a[s+i][s+i+j+1]=(x>0?x:INT_MAX);
		printf("%d\n",F());
	}
	return 0;
}

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

int main(){
    int n;
    int cnt = 0;
    cin >> n;
    for(int i = 1 ; i <= n ; i++){
        string str = to_string(i);
        if(str.length()%2 == 1){
            cnt++;
        }
    }
    cout << cnt << endl;
    return 0;
}

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

int main()
{
    int n,cnt,i,j;
    int sieve[1000000];
    sieve[0]=sieve[1]=1;

    while(scanf("%d",&n)!=EOF){
        for(i=2;i<=n;i++) sieve[i]=0;

        for(i=2;i<=(int)sqrt(n);i++){
            if(sieve[i]==0){
                for(j=2;j<=n/i;j++){
                    sieve[j*i]=1;
                }
            }
        }

        cnt=0;
        for(i=2;i<=n;i++){
            if(sieve[i]==0) cnt++;
        }

        printf("%d\n",cnt);
    }

    return 0;
}

Measured memory_bytes: 5748
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const int MAX = (int)1e7;
bool prime[MAX + 1];

int main() {
	fill(prime, prime + MAX + 1, 1);
	for (int i = 2; i <= MAX; i++) {
		if (prime[i]) {
			for (int k = 2; i*k <= MAX; k++) {
				prime[i*k] = 0;
			}
		}
	}
	int n;
	int a;
	int cnt = 0;
	scanf("%d", &n);
	bool isPrime = 1;
	for (int i = 0; i < n; i++) {
		scanf("%d", &a);
		if (a <= (int)1e7) {
			cnt += prime[a];
		}
		else {
			int bd = sqrt(a)+1;
			isPrime = 1;
			for (int i = 2; i <= bd; i++) {
				if (a%i == 0) {
					isPrime = 0;
					break;
				}
			}
			cnt += isPrime;
		}
	}
	cout << cnt << endl;
}

Measured memory_bytes: 12964
#![allow(unused, non_snake_case, dead_code, non_upper_case_globals)]
use {
    proconio::{marker::*, *},
    std::{cmp::*, collections::*, mem::*},
};

#[fastout]
fn main() {
    input! {//
        n:usize,
    }
    let mut anss = vec![0; n + 1];
    for x in 1..=n {
        if x * x >= n {
            continue;
        }
        for y in 1..=n {
            if x * x + y * y + x * y > n {
                break;
            }
            // z*z + y*z + z*x = n
            // let z = n-x*x-y*y-x*y
            for z in 1..n {
                // if z * z + y * z + z * x + x * x + y * y + x * y == n {
                //     ans += 1;
                // }
                let s = x * x + y * y + z * z + x * y + x * z + y * z;
                if s > n {
                    break;
                } else {
                    anss[s as usize] += 1;
                }
            }
        }
    }
    for i in 1..=n {
        println!("{}", anss[i]);
    }
}


Measured memory_bytes: 2180
#include <iostream>
#include <algorithm>
#include <climits>
#include <vector>
#include <utility>
#include <functional>
#include <map>
#include <string>
#include <set>

using namespace std;

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

  int n;
  cin >> n;

  string s;
  cin >> s;

  int ans = 0;
  for (int i = 0; i < n; i++) {
    string left = s.substr(0, (i + 1));
    string right = s.substr(i + 1);

    set<char> l;
    for (int j = 0; j < left.size(); j++) {
      l.insert(left[j]);
    }

    set<char> r;
    for (int j = 0; j < right.size(); j++) {
      r.insert(right[j]);
    }

    int count = 0;
    for (auto x : l) {
      if (r.count(x) == 1) {
        count++;
      }
    }

    ans = max(ans, count);
  }

  cout << ans << endl;
}

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

int main(){
  int n; cin >> n;
  vector<int> p(n);
  for(int i=0; i<n; i++) cin >> p[i];
  int count=0, min_reg=INT_MAX;  
  for(int i=0; i<n; i++){
    min_reg = min(min_reg, p[i]);
    if(p[i]<=min_reg) count++;
  }
  cout << count << endl;
  return 0;
}

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

typedef long long ll;
typedef pair<ll, ll> P;

#define pb push_back
#define rep(i, n) for(int i = 0; i < (n); i++)
#define dep(i, a, n) for(int i = a; i >= (n); i--)
#define FOR(i, a, n) for(int i = a; i < (n); i++)
#define mod (ll)(1e9+7)
#define int ll
#define INF 100000000

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

signed main() {
	ll n, k, x[51], y[51], result = -1;
  cin >> n >> k;
  set<int> xx, yy;
  rep(i, n) {
    cin >> x[i] >> y[i];
    xx.insert(x[i]);
    yy.insert(y[i]);
  }
  for(auto minx : xx) {
    for(auto miny : yy) {
      for(auto maxx : xx) {
        for(auto maxy : yy) {
          if(minx < maxx && miny < maxy) {
            ll multi = (maxx - minx) * (maxy - miny);
            ll ch = 0;
            rep(i, n) {
              if(minx <= x[i] && maxx >= x[i] && miny <= y[i] && maxy >= y[i]) ch++;
              if(k <= ch) {
                if(result < 0) result = multi;
                result = min(result, multi);
              }
            }
          }
        }
      }
    }
  }
  cout << result << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pll;
typedef pair<int,pll> P;
struct edge{
  int to;
  int cost;
  edge(int t,int w) : to(t),cost(w){}
};
int main(){
  while(1){
    int n,m,i,j;
    cin >> n >> m;
    if(n==0 && m==0){
      return 0;
    }
    vector<vector<edge> > g(110);
    int ds[110][3],ns[110][3];
    const int INF=2000000000;
    priority_queue<P,vector<P>,greater<P> > que;
    for(i=0;i<m;i++){
      int a,b,c;
      cin >> a >> b >> c;
      a--,b--;
      g[a].push_back(edge(b,c));
      g[b].push_back(edge(a,c));
    }
    for(i=0;i<n;i++){
      for(j=0;j<=2;j++){
        ds[i][j]=INF,ns[i][j]=0;
      }
    }
    ds[0][0]=0,ns[0][0]=1;
    que.push(make_pair(0,pll(0,0)));
    while(!que.empty()){
      P p=que.top();
      int v=p.second.first,w=p.second.second;
      que.pop();
      for(i=0;i<g[v].size();i++){
        edge us=g[v][i];
        if(w==0 || w==2){
          if(ds[us.to][w]>ds[v][w]+us.cost && ns[us.to][w]==0){
            ds[us.to][w]=ds[v][w]+us.cost;
            que.push(make_pair(ds[us.to][w],pll(us.to,w)));
          }
        }
        if(w==0 || w==1){
          if(ds[us.to][w+1]>ds[v][w] && ns[us.to][w+1]==0){
            ds[us.to][w+1]=ds[v][w];
            que.push(make_pair(ds[us.to][w+1],pll(us.to,w+1)));
          }
        }
      }
      ns[v][w]=1;
    }
    cout << min(ds[n-1][0],ds[n-1][2]) << endl;
  }
}


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<LL,LL> P;
const LL mod=998244353;
const LL LINF=1LL<<62;




int main(){
    int n;cin >> n;
    LL x[n],y[n],h[n];
    for(int i=0;i<n;i++){
        cin >> x[i] >> y[i] >> h[i];
    }
    for(LL i=0;i<=100;i++){
        for(LL j=0;j<=100;j++){
            LL H=LINF,lim=LINF;
            for(int k=0;k<n;k++){
                LL t=abs(i-x[k])+abs(j-y[k]);
                if(h[k]==0) lim=min(lim,t);
                else{
                    if(H==LINF){
                        H=t+h[k];
                    }
                    else{
                        if(max(H-t,0LL)!=h[k]) break;
                    }
                }
                if(k==n-1&&H<=lim&&H>=1){
                    cout << i << " " << j << " " << H << endl;
                    return 0;
                }
            }
        }
    }
    return 0;
}


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

int main() {
  int s ;
   cin >> s ;
   int s1,s2,s3;
   s3=s%10;
   s2=(s%100-s3)/10;
   s1=(s-10*s2-s3)/100;
   int x= s1+s2+s3;
   
   cout <<  x << endl ;
  }

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //GCC5.4.1で配列の範囲外アクセスをエラーにする

//cmdで g++ test.cpp とするとコンパイルできる
//制限1秒なら10^6は余裕 10^7は多分間に合う 10^8はよほど単純でないと厳しい

#define ALL(x) x.begin(),x.end()
typedef long long ll; //long long
typedef pair<int,int> pii; //pair<int,int>
typedef pair<long long,long long> pllll; //pair<ll,ll>
typedef vector<int> vi; //vector<int>
typedef vector<vector<int>> vvi; //vector<vector<int>>
typedef vector<ll> vll; //vector<long long>
typedef vector<vector<ll>> vvll; //vector<vector<long long>>
typedef priority_queue<int, vector<int>, greater<int> > gpq; //逆順priority_queue
typedef priority_queue<int> pq;

//const int MOD=998244353;
const int MOD=1000000007; //10^9+7
const long double PI=3.1415926535897932;

int main(){
    vi ac(1000001,true);
    int N;
    cin>>N;
    vll A(N);
    for(int i=0;i<N;i++){
        cin>>A[i];
    }
    sort(ALL(A));
    int ans=0;
    for(int i=0;i<N;i++){
        bool mul=false;
        if(i>0){
            if(A[i-1]==A[i])mul=true;
        }
        if(i<N-1){
            if(A[i]==A[i+1])mul=true;
        }
        if((!mul)&&ac[A[i]]){
            ans++;
        }
        if(ac[A[i]]){
            for(int j=A[i];j<=1000000;j+=A[i]){
                ac[j]=false;
            }
        }
    }
    cout<<ans<<endl;
}


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

using namespace std;
typedef long long int ll;
#define debug(val) "[ " << #val " : " << (val) << " ]\n"
#define space " "
#define space " "
#define vi vector<int>
#define PI atan(1)*4
#define pb push_back
#define ff first
#define ss second
#define PI atan(1)*4

const int maxN = 1000 + 3 ;
char a[maxN][maxN] ;
int dp[maxN][maxN] ;
const int INF =  (int)2e9 ;
const int Mod = (int)1e9 + 7;

void solve() {
    int n , m ;
    cin >> n >> m ;
    for(int i=0;i<n;i++){
        string s ;cin >> s ;
        for(int j=0;j<m;j++){
            a[i][j] = s[j] ;
        }
    }

    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            dp[i][j] = 0 ;
        }
    }
    dp[0][0] = 1 ;
    for(int i=0;i<n;i++) {
        for(int j=0;j<m;j++){
            if(a[i][j] == '#'){
                dp[i][j] = -1 ;
                continue;
            }
            if((i+1 < n) && a[i+1][j] == '.'){
                dp[i+1][j] += dp[i][j] ;dp[i+1][j]%= Mod ;}
            if((j+1 < m) && a[i][j+1] == '.'){
                dp[i][j+1] += dp[i][j] ;dp[i][j+1] %= Mod ; }

        }
    }
//    for(int i=0;i<n;i++){
//        for(int j=0;j<m;j++){
//            cerr << dp[i][j] << space ;
//        }
//        cerr << endl;
//    }
    cout << dp[n-1][m-1] << endl;


}
int main() {
#ifdef _DEBUG // place in cmake-build-debug folder
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
#endif
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int q = 1;
    //cin >> q;
    for (int i = 1; i <= q; i++) {
        // cout << "Case #" << i << ": ";
        solve();
    }
}


Measured memory_bytes: 8564
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <complex>
#include <vector>
#include <limits>
#include <iomanip>
#include <cassert>

using namespace std;

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

#define debug(x) cout << #x << " = " << (x) << endl;
#define rep(i, n) for(int i = 0;i < n;i++)
#define repr(i, n) for(int i = n-1;i >= 0;i--)
#define pb push_back
#define mp make_pair
#define F first
#define S second

const long double pi = 3.141592653589793;
const int mod = 1e9 + 7;

int A[3333][3333], N, M, K, r, c, v;
ll dp[3333][3333][6];

int main() {

 // freopen("input.in","r",stdin);
 // freopen("output.out","w",stdout);

 ios_base::sync_with_stdio(false);
 cin.tie(nullptr);

 cin>>N>>M>>K;
 rep(i, K) {cin>>r>>c>>v;r--;c--;A[r][c] = v;}

 ll a, b, c;

 for(int i = 0;i < N;i++) {
   for(int j = 0;j < M;j++) {
     a = b = 0;
     if(i-1 >= 0) a = dp[i-1][j][3];
     if(j-1 >= 0) b = dp[i][j-1][0];
     dp[i][j][0] = max(a, b);

     for(int k = 1;k <= 3;k++) {
       if(i + j == 0) {dp[i][j][k] = A[i][j];continue;}
       a = b = c = 0;
       if(i-1 >= 0) a = dp[i-1][j][3] + A[i][j];
       if(j-1 >= 0) {
         b = dp[i][j-1][k];
         c = dp[i][j-1][k-1] + A[i][j];
       }
       dp[i][j][k] = max(a, max(b, c));
       dp[i][j][k] = max(dp[i][j][k], dp[i][j][k-1]);
     }
   }
 }

 cout << dp[N-1][M-1][3] << endl;

 return 0;
}


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

int main(){
	int x;
	cin >> x;
	if(x ==1 ) cout << 0 << endl;
	else cout << 1 << endl;
}

// cout << fixed << setprecision(15) <<  << endl;

Measured memory_bytes: 3620