akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include<iomanip>
#include<numeric>

using namespace std;
using ll = long long;
constexpr int mo = 1e9+7;
constexpr int  mod = mo;
constexpr int inf = 1<<30;
constexpr int mo2 = 998244353;
int main(){
    int n,k;
    cin>>n>>k;
    vector<int> v(n);
    for(auto &a : v) cin>>a;
    sort(v.begin(),v.end());
    int it = lower_bound(v.begin(),v.end(),k) - v.begin();
    cout << n-it << endl;
    return 0;
}



Measured memory_bytes: 640
c = [list(map(int, input().split())) for i in range(3)]
judge = 0

if c[0][0] - c[0][1] == c[1][0] - c[1][1] == c[2][0] - c[2][1]:
    judge += 1
if c[0][1] - c[0][2] == c[1][1] - c[1][2] == c[2][1] - c[2][2]:
    judge += 1
if c[0][0] - c[1][0] == c[0][1] - c[1][1] == c[0][2] - c[1][2]:
    judge += 1
if c[1][0] - c[2][0] == c[1][1] - c[2][1] == c[1][2] - c[2][2]:
    judge += 1
    
print("Yes" if judge == 4 else "No")

Measured memory_bytes: 3064
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<algorithm>
#include<set>
#include<cmath>
#include<stack>
using namespace std;
struct node
{
    int val;
    node* next;
};
/*
 99992149
      123
 */
int isSu(long long int x)
{
    long long int up = sqrt(x);
    for(int i = 2;i<=up;i++)
    {
        if(x%i==0)
            return 0;
    }
    return 1;
}
int main()
{
    int n,ans=1,len;
    string s;
    cin>>n;
    cin>>s;
    len=s.length();
    for(int i = 1;i < len;i++)
    {
        if(s.at(i)==s.at(i-1))
            continue;
        else
            ans++;
    }
    cout<<ans<<endl;
    return 0;
}



Measured memory_bytes: 512
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int a = s.nextInt();
		int b = s.nextInt();
		int c = s.nextInt();
		int an = 0;



		if (a >= b && b >= c) {
			an = c + b;
		} else if (a >= c && c >= b) {
			an = c + b;
		} else if (c >= a && a >= b) {
			an = a + b;
		} else if (b >= a && a >= c) {
			an = a + c;
		} else if (b >= c && c >= a) {
			an = a + c;
		} else if (c >= b && b >= a) {
			an = b + a;
		}
		System.out.println(an);
	}

}

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

constexpr int inf = 0x3f3f3f3f;
constexpr ll linf = 0x3f3f3f3f3f3f3f3fLL;

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

    int n; cin >> n;
    int c4 = 0, co = 0;
    for (int i = 0; i < n; i++) {
        int a; cin >> a;
        if (!(a & 3)) c4++;
        if (a & 1) co++;
    }
    if (c4 + co == n) {
        cout << ((c4 >= co - 1) ? "Yes" : "No") << endl;
    } else {
        cout << ((c4 >= co) ? "Yes" : "No") << endl;
    }
    return 0;
}

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

long long int gcd(long long int x, long long int y) {
	if (y == 0) return x;
	return gcd(y, x % y);
}

int main() {
	long long int A, B;
	cin >> A >> B;
	cout << (A * B) / gcd(A, B) << endl;
}

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

using namespace std;

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    set<int> s;
    for(int i = 0; i < n; i++) {
        cin >> a[i];
        if(a[i] % 2 == 0) {
            s.insert(a[i]);
        }
    }
    for(int ss : s) {
        if(ss % 3 != 0 && ss % 5 != 0) {
            cout << "DENIED";
            return 0;
        }
    }
    cout << "APPROVED";
    return 0;
}


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

using namespace std ;

#define N  10000010
#define ll long long int

//bool prime[N] ;
vector<bool>prime;

int main()
{
int n,m,ans;
cin >>n>>m;
n=n-1;
m=m-1;
ans=n*m;
cout <<ans<<endl;


}


Measured memory_bytes: 384
import java.util.*;

public class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        
        int num = Integer.parseInt(sc.next());
        
        int five_hund = num / 500;
        int five = (num - five_hund * 500) / 5;
        
        System.out.println(1000 * five_hund + 5 * five);
    }
}

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

int main(){
  char s1, s2, s3, s4;
  int N = 0;
  cin >> s1 >> s2 >> s3 >> s4;
  if(s1=='+'){
    N++;
  }
  else{
    N--;
  }
  if(s2=='+'){
    N++;
  }
  else{
    N--;
  }
  if(s3=='+'){
    N++;
  }
  else{
    N--;
  }
  if(s4=='+'){
    N++;
  }
  else{
    N--;
  }
  cout << N << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define ar array
#define AC ios_base::sync_with_stdio(0); cin.tie(NULL);
using namespace std;
const int M = 1e9+7;
const int N = 5*1e5;

map<string, int> S;

int main(){
    AC
    int n;
    cin>>n;
    for(int i=0; i<n; i++){
        string s;
        cin>>s;
        S[s]++;
    }
    cout<<"AC x "<<S["AC"]<<endl;
    cout<<"WA x "<<S["WA"]<<endl;
    cout<<"TLE x "<<S["TLE"]<<endl;
    cout<<"RE x "<<S["RE"]<<endl;
}

Measured memory_bytes: 3660
n=int(input())
p=input().rstrip().split(' ')
C=list(p)
B=0;
C.sort(key=int)
for i in range(0,len(p)):
    if int(p[i])!=int(C[i]):
        B+=1;
if B<=2:
    print("YES")
else:
    print("NO")


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

using namespace std;
using ll=long long;
using ull=unsigned long long;
using pii=pair<int,int>;

#define INF LONG_MAX
#define MOD 1000000007
#define rng(a) a.begin(),a.end()
#define rrng(a) a.end(),a.begin()

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

  int K,S;
  cin>>K>>S;
  ll ans=0;
  for(int i=0;i<=K;i++){
    for(int j=0;j<=K;j++){
      if(0<=S-i-j&&S-i-j<=K)ans++;
    }
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
import bisect

keys=[]

q=int(input())
d={}

def find(x):
    index=bisect.bisect_left(keys,x)
    if index==len(keys):
        return -1
    if keys[index]==x:
        return index
    else:
        return -1


for _ in range(q):
    query=input().split(" ")
    if query[0]=="0":
        if find(query[1])!=-1:
            pass
        else:
            bisect.insort_left(keys, query[1])
        d[query[1]]=query[2]
    elif query[0]=="1":
        if find(query[1])!=-1:
            print(d[query[1]])
        else:
            print(0)



Measured memory_bytes: 43196
#include<bits/stdc++.h>
using namespace std;
char s[100100];
int n;
int m;
int main()
{
	scanf("%d",&m);
	scanf("%s",s+1);n=strlen(s+1);
	if(n<=m)
	{
		printf("%s\n",s+1);
		return 0;
	}
	for(int i=1;i<=m;++i)putchar(s[i]);
	puts("...");
	return 0;
}


Measured memory_bytes: 3764
s = str(input())
t = str(input())
result = 0
diff = len(s) - len(t) + 1
start = 0
end = len(t)
strimlist = []
diflist = []


for i in range(diff):
  strim = s[start:end]
  strimlist.append(strim)
  start += 1
  end += 1

for j in strimlist:
  index = 0
  difresult = 0
  for k in range(len(t)):
    if j[index] == t[index]:
      index += 1
    else:
      difresult += 1
      index += 1
  diflist.append(difresult)
  diflist.sort()
print(diflist[0])

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

int main() {
  int N, A;
  cin >> N >> A;
  
  if (N<=500 && A>=N) {
    cout << "Yes" << endl;
  }
  else if(N<=500 && A<N){
    cout << "No" <<endl;
  }
  else if (N>=500 && N%500<=A ){
    cout << "Yes" << endl;
  }
  else if (N>=500 && N%500>A){
    cout << "No" <<endl;
  }
  
  }

Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<queue>
#include<map>
#include<iomanip>
#define rep(index,num) for(int index=0;index<num;index++)
#define rep1(index,num) for(int index=1;index<=num;index++)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-7
#define mp(a1,a2) make_pair(a1,a2)
typedef long long ll;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=1e+18+1;
int INF=1e+9+1;
vint prime_factor_decomp(int n) {
    vint p;
	p.push_back(1);
    int m = n;
    for (int i = 2; i * i <= n&&m>1; i++) {
        if (m % i != 0) continue;
        while (m % i == 0) m /= i;
        p.push_back(i);
    }
    return p;
}
int main(){
	int N,a[200001];
	scan(N);
	rep1(i,N){
		scan(a[i]);
	}
	int flag=1;
	int M=0;
	int nowb[200001]={};
	int ans[200001]={};
	for(int k=N;k>=1;k--){
		if(a[k]^nowb[k]){
			nowb[k]^=1;
			ans[k]=1;
			if(k!=1) nowb[1]^=1;
			int m = k;
			for (int i = 2; i * i <= m; i++) {
				if(m%i==0){
					nowb[i]^=1;
					int j=m/i;
					if(j!=i) nowb[j]^=1;
				}
			}
		}
		//printf("k:%d nowb:",k);
		//rep1(i,N) printf("%d ",nowb[i]);
		//kaigyo;
	}
	rep1(i,N){
		if(ans[i]) M++;
	}
	prin(M);
	rep1(i,N){
		if(ans[i]) prin(i);
	}
	return 0;
}


Measured memory_bytes: 3328
N,M,C = map(int, input().split())
B = [int(i) for i in input().split()]
A = []
for i in range(N):
    A_next = [int(j) for j in input().split()]
    A.append(A_next)
count = 0
for i in range(N):
    if(sum([A[i][j]*B[j] for j in range(len(B))])+C > 0):
        count = count + 1
print(count)

Measured memory_bytes: 3064
#include<iostream>
#include<map>
#include<queue>
#include<string>

using namespace std;

int BFS(string);
int ok(string);
char change(char, char);


int main(){

  string s;
  while(1){
    cin >> s;
    if(s == "0") break;
    int res = BFS(s);
    if(res == -1) cout << "NA" << endl;
    else cout << res << endl;
  }
}


int BFS(string s){
  queue<string> Q;
  map<string, int> dist;
  Q.push(s);
  dist[s] = 1;
  while(!Q.empty()){
    string now = Q.front();
    Q.pop();
    if(ok(now) == 1) return dist[now]-1;
    for(int i = 0; i < now.length()-1; i++){
      char res = change(now[i], now[i+1]);
      if(res == '*') continue;

      string tmp = now;
      tmp[i] = tmp[i+1] = res;
      if(dist[tmp] == 0){
	dist[tmp] = dist[now] + 1;
	Q.push(tmp);
      }
    }
  }
  return -1;
}

int ok(string s){
  for(int i = 1; i < s.length(); i++){
    if(s[0] != s[i]) return 0;
  }
  return 1;
}

char change(char c1, char c2){
  string s = "rgb";
  if(c1 == c2) return '*';
    for(int i = 0; i < 3; i++){
      if(c1 != s[i] && c2 != s[i]) return s[i];
    }
}

Measured memory_bytes: 1872
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)
const int mod=1000000007;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n,m;cin >> n >> m;
	if(abs(n-m)>1){
		cout << 0 << endl;
		return 0;
	}
	ll sum1=1,sum2=1;
	for(int i=2;i<=n;++i){
		sum1*=i;
		sum1%=mod;
	}
	for(int i=2;i<=m;++i){
		sum2*=i;
		sum2%=mod;
	}
	ll ans=sum1*sum2;
	ans%=mod;
	if(n==m) cout << ans*2%mod << endl;
	else cout << ans << endl;
}

Measured memory_bytes: 256
h,w=map(int,input().split())
s=[]
for i in range(h):
    s.append(list(input()))

for i in range(h):
    for j in range(w):
        if s[i][j]=='.':
            continue
        flag=False
        if i>0:
            if s[i-1][j]=='#':
                continue
        if j>0:
            if s[i][j-1]=='#':
                continue
        if i<h-1:
            if s[i+1][j]=='#':
                continue
        if j<w+1:
            if s[i][j+1]=='#':
                continue
        break
    else:
        continue
    break
else:
    print('Yes')
    quit()
print('No')


Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <stdio.h>
#include <cmath>
#include <cfloat>
#include <algorithm>
#include <numeric>
#include <vector>
using namespace std;

const double PI=acos(-1);

int main(){
    string a, b, c;
    cin >> a >> b;
    c = a + b;
    int d = stoi(c);
    if(pow((int)sqrt(d), 2) == d) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#define N 100000
#define Q 500

int LinearSearch(int);
int S[N];
int n;

int main() {
  int i, q, C = 0;
  int T[Q];

  scanf("%d", &n);
  for(i=0; i<n; i++) {
    scanf("%d", &S[i]);
  }

  scanf("%d", &q);
  for(i=0; i<q; i++) {
    scanf("%d", &T[i]);
  }

  for(i=0; i<q; i++) {
    if(LinearSearch(T[i])==1)
      C++;
  }

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

int LinearSearch(int key) {
  int j = 0;
  S[n] = key;
  while(S[j]!=key)
    j++;
  if( j==n ) return 0;
  else return 1;
}

Measured memory_bytes: 636
#include <iostream>

using namespace std;

int main() {
    int n,t,a;
    cin >> n >> t >> a;
    
    int ans;
    long long s = LONG_MAX;
    for (int i=0; i<n; i++) {
        long long h;
        cin >> h;
        int tmp = abs(1000*a - (t*1000 - h*6));
        if (s > tmp) {
            ans = i+1;
            s = tmp;
        }
    }

    cout << ans << endl;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES

#include <iostream>	//cin, cout
#include <vector>	//vector
#include <algorithm> //sort,min,max,count
#include <string>	//string,getline
#include <ios>		//fixed
#include <iomanip>	//setprecision
#include <utility> //swap, pair
#include <cstdlib>	//abs(int)
#include <cmath>	//sqrt,ceil,M_PI, pow, sin
#include <sstream>	//stringstream,getline
#include <numeric>	//gcd, accumlate
#include <deque>	//deque
#include <random>	//randam_device

using namespace std;

int main() {

	char a, b;
	cin >> a;

	for (int i = 0; i < 3; i++) {
		cin >> b;
		if (a == b) {
			cout << "Bad" << endl;
			return 0;
		}
		else {
			a = b;
		}
	}

	cout << "Good" << endl;

	return 0;

}

Measured memory_bytes: 3576
import collections
n = int(input())
a = list(map(int, input().split()))
a = collections.Counter(a)
ans = []
for i, j in a.items():
    if j >= 2:
        for _ in range(j):
            ans.append(i)
ans.sort(reverse=True)
if len(ans) <= 3:
    print(0)
else:
    print(ans[0]*ans[3])

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

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

const ll mod=1e9+7;
const ll inf=1ll<<61;
const int INF=1e9;

struct edge{
	ll from,to,cost;
};

ll d2[2510];
ll n,m,p;
edge es[5010];
bool negative[2510];

void shortest_path(ll s){
  rep(i,2510) d2[i]=inf;
d2[s]=0;
  rep(j,n-1){
		rep(i,m){
			edge e=es[i];
			if(d2[e.from]!=inf && d2[e.to]>d2[e.from]+e.cost){
					d2[e.to]=d2[e.from]+e.cost;
			}
		}
  }
}

void find_negative_loop(){
	for(int i=1;i<=n;i++) negative[i]=false;
	for(int i=1;i<=n;i++){
		for(int j=0;j<m;j++){
			edge e = es[j];
			if(d2[e.to]!=inf && d2[e.to]>d2[e.from]+e.cost){
				d2[e.to]=d2[e.from]+e.cost;
				negative[e.to]=true;
			}
			if(negative[e.from]) negative[e.to]=true;
		}
	}
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cin>>n>>m>>p;
	rep(i,m){
		ll a,b,c;
		cin>>a>>b>>c;
		a--,b--;
		es[i]={a,b,p-c};
	}
	shortest_path(0);
	find_negative_loop();
	if(negative[n-1]) cout<<-1<<endl;
	else{
		cout<<max(0ll,-d2[n-1])<<endl;
	}
}

Measured memory_bytes: 512
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        double n = s.nextInt();
        double k = s.nextInt();
        List<Integer>l=new ArrayList<>();
        for(int i=0;i<n;i++){
            l.add(s.nextInt());
        }
        double an=(n-1)/(k-1);
        System.out.print((int)Math.ceil(an));
    }
}

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


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





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

int main(){
    int n, x[100], y[100];
    cin >> n;
    for(int i = 0; i < n; i++) cin >> x[i];
    for(int i = 0; i < n; i++) cin >> y[i];
    
    double D[4];
    for(int i = 0; i < 4; i++) D[i] = 0.0;
    
    for(int p = 1; p < 4; p++){
        for(int i = 0; i < n; i++){
            D[p] += pow(fabs(x[i]-y[i]), p);
        }
        D[p] = pow(D[p], 1.0/p);
    }

    for(int i = 0; i < n; i++){
        D[0] = (D[0] < fabs(x[i]-y[i])?fabs(x[i]-y[i]): D[0]);
    }

    printf("%1f\n", D[1]);
    printf("%1f\n", D[2]);
    printf("%1f\n", D[3]);
    printf("%1f\n", D[0]);

    return 0;
}




Measured memory_bytes: 3344
#include <algorithm>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for(int i = 0; (i) < (n); (i)++)
#define FOR(i, m, n) for(int i = (m); (i) < (n); (i)++)
#define All(v) (v).begin(), (v).end()
#define MP make_pair
#define pb push_back
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1 << 30;
const ll LINF = 1LL << 61;
const int MOD = 1e9 + 7;

int main() {
    string s;
    cin >> s;
    int res = 0;
    rep(i, 3) {
        if(s[i] == '1')
            res++;
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#define MAX 2000000
using namespace std;

int nodes[MAX];
int n;

int left(int i){ return i*2; }
int right(int i){return i*2 + 1;}
int parent(int i){return i/2; }

void max_heapify(int key){
  int l = left(key);
  int r = right(key);
  int largest;
  if(l <= n && nodes[l] > nodes[key]){
    largest = l;
  }else{
    largest = key;
  }
  if(r <= n && nodes[r] > nodes[largest]){
    largest = r;
  }

  if(largest != key){
    swap(nodes[key],nodes[largest]);
    max_heapify(largest);
  }
}

void max_heapify_up(int key){
  if(key == 1) return;
  if(nodes[parent(key)] < nodes[key]){
    swap(nodes[parent(key)],nodes[key]);
    max_heapify_up(parent(key));
  }
}

void build_maxheap(){
  for(int i = n/2; i>=1; i--){
    max_heapify(i);
  }
}

void insert(int key){
  n++;
  nodes[n] = key;
  max_heapify_up(n);
}


int extract(){
  n--;
  int pop = nodes[1];
  nodes[1] = nodes[n+1];
  max_heapify(1);
  return pop;
}

int main(){
  n=0;
  string ope;

  while(1){
    cin>>ope;
    if(ope=="insert"){
      int key; cin>>key;
      insert(key);
    }else if(ope=="extract"){
      cout<<extract()<<endl;
    }else if(ope=="end"){
      break;
    }
  }
}

Measured memory_bytes: 6980
using System;

public class p0511{
	p0511 ()
	{
		string str;
		bool[] a = new bool[31];
		
		while ((str=Console.ReadLine()) != null) {
			for (int i = 0; i < 31; ++i)
				a [i] = true;
			a [int.Parse (str)] = false;
			
			for (int i = 0; i < 27; ++i)
				a [int.Parse (Console.ReadLine ())] = false;
			
			for (int i = 1; i < 31; ++i)
				if (a [i])
					Console.WriteLine ("{0}", i);
				
		}
	}
	
	public static int Main(string[] args){
		new p0511();
		return 0;
	}
}

Measured memory_bytes: 5568
#include<iostream>
#include<algorithm>
#include<vector>
 using namespace std;
 typedef long long ll;
 int main()
 {
 	ll n,a,b,ans=0;
 	cin>>n>>a>>b;
 	if(n%(a+b)==0) ans=(n/(a+b))*a;
 	else{
 		ans+=(n/(a+b))*a;
 		if(n%(a+b)>a) ans+=a;
 		else ans+=(n%(a+b)); 
	 }
	cout<<ans<<endl;
	return 0; 
 }

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const long long int INF = 1e12;

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

    vector<vector<long long int>> a(n, vector<long long int>(n));
    vector<pair<long long int, pair<int, int>>> data;
    for(int i=0; i<n; i++){
        for(int j=0; j<n; j++){
            cin >> a[i][j];
            if(i < j) data.push_back({a[i][j], {i, j}});
        }
    }
    sort(data.begin(),data.end());

    // Warshall-Floyd
    vector<vector<long long int>> d = a;// d[i][j] = shortest distances between i and j
    for(int k=0; k<n; k++){// potential relay points
        for(int i=0; i<n; i++){
            for(int j=0; j<n; j++){
                d[i][j] = min(
                    d[i][j],// without going through k
                    d[i][k] + d[k][j]// with going through k
                );
            }
        }
    }

    for(int i=0; i<n; i++){
        for(int j=i+1; j<n; j++){
            if(a[i][j] > d[i][j]){
                cout << -1 << endl;
                return 0;
            }
        }
    }

    long long int ans = 0;
    for(int i=0; i<n; i++){
        for(int j=i+1; j<n; j++){
            ans += a[i][j];
            for(int k=0; k<n; k++){// potential relay points
                if(i != k && j != k && d[i][j] == d[i][k] + d[k][j]){
                    ans -= a[i][j];
                    break;
                }
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 2428
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, n) for(ll i=0; i<(ll)n; i++)
#define REPR(i, n) for(ll i=(ll)n-1; i>=0; i--)
#define FOR(i, m, n) for(ll i=(ll)m; i<(ll)n; i++)
#define FORR(i, m, n) for(ll i=(ll)m-1; i>=(ll)n; i--)
#define ALL(x) (x).begin(), (x).end()
#define ASC(v) sort(ALL(v));
#define DESC(v) sort(ALL(v), greater<int>());
#define UNIQ(a) sort(ALL(a));(a).resize(unique(ALL(a)) - a.begin());
#define PRINTD(x, d) cout << fixed << setprecision(d) << x << "\n";
#define DEBUG(x) cout<<#x<<": "<<x<<"\n"
const double PI = acos(-1);
ll lcm(ll a, ll b) { return a / __gcd(a, b) * b; }
bool isprime(int x){ int i; if(x<2)return 0; else if(x==2) return 1; if(x%2==0) return 0; for(i=3; i*i<=x; i+=2) if(x%i==0) return 0; return 1; }
int digsum(int n) { int r=0; while(n>0) { r+=n%10; n/=10; } return r; }
vector<string> split(string s, char p){vector<string>v;stringstream m(s);string b;while(getline(m,b,p))v.push_back(b);return v;}
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a = b; return 1; } return 0; }
struct nya{ nya(){ cin.tie(0); ios::sync_with_stdio(false); } }nyan;

int main(){
    ll ABCD;
    cin >> ABCD;
    ll D = (ABCD % 10); ABCD /= 10;
    ll C = (ABCD % 10); ABCD /= 10;
    ll B = (ABCD % 10); ABCD /= 10;
    ll A = (ABCD % 10); ABCD /= 10;

    if      (A+B+C+D == 7) cout << A << "+" << B << "+" << C << "+" << D << "=7\n";
    else if (A+B+C-D == 7) cout << A << "+" << B << "+" << C << "-" << D << "=7\n";
    else if (A+B-C+D == 7) cout << A << "+" << B << "-" << C << "+" << D << "=7\n";
    else if (A+B-C-D == 7) cout << A << "+" << B << "-" << C << "-" << D << "=7\n";
    else if (A-B+C+D == 7) cout << A << "-" << B << "+" << C << "+" << D << "=7\n";
    else if (A-B+C-D == 7) cout << A << "-" << B << "+" << C << "-" << D << "=7\n";
    else if (A-B-C+D == 7) cout << A << "-" << B << "-" << C << "+" << D << "=7\n";
    else if (A-B-C-D == 7) cout << A << "-" << B << "-" << C << "-" << D << "=7\n";
}


Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <vector>
#include <algorithm>

using namespace std;

struct Point {
    int x, y;
    Point() {}
    Point(int x, int y) : x(x), y(y) {}
};
bool operator<(const Point& a, const Point& b) {
    return a.x == b.x ? a.y < b.y : a.x < b.x;
}

istream& operator>>(istream& is, Point& p) {
    return is >> p.x >> p.y;
}
ostream& operator<<(ostream& os, const Point& p) {
    return os << "(" << p.x << "," << p.y << ")";
}

template<class T>
ostream& operator<<(ostream& os, const vector<T>& xs) {
    if (xs.empty()) return os << "[]";
    os << "[" << xs[0];
    for (int i = 1; i < xs.size(); i++) os << " " << xs[i];
    return os << "]";
}

#define whole(xs) (xs).begin(),(xs).end()

struct UnionFind {
    int N;
    vector<int> P;
    UnionFind(int N) : N(N) {
        P.clear(); P.resize(N, -1);
    }
    int root(int x) {
        if (P[x] == -1) return x;
        return P[x] = root(P[x]);
    }
    int query(int x, int y) {
        return root(x) == root(y);
    }
    void merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return;
        P[x] = y;
    }
    int count() {
        vector<bool> u(N, false);
        int ret = 0;
        for (int i = 0; i < N; i++) {
            if (u[root(i)]) continue;
            u[root(i)] = true;
            ret++;
        }
        return ret;
    }
};

int N, W, H;
vector<Point> P;
int main() {
    cin >> N >> W >> H;
    P.clear(); P.resize(N);
    for (int i = 0; i < N; i++) cin >> P[i];

    UnionFind uf(N);
    int ans = 0;

    bool f = false;
    map<int, int> M;
    for (int i = 0; i < N; i++) {
        const Point& p = P[i];
        if (M.count(p.x)) {
            uf.merge(i, M[p.x]);
            ans++;
        } else {
            M[p.x] = i;
        }
        if (p.x == 1 || p.x == W) f = true;
    }
    M.clear();
    for (int i = 0; i < N; i++) {
        const Point& p = P[i];
        if (M.count(p.y)) {
            if (uf.query(i, M[p.y])) continue;
            uf.merge(i, M[p.y]);
            ans++;
        } else {
            M[p.y] = uf.root(i);
        }
        if (p.y == 1 || p.y == H) f = true;
    }

    if (uf.count() == 1) {
        cout << ans << endl;
    } else {
        ans--;
        if (f) ans--;
        vector<bool> u(N, false);
        for (int i = 0; i < N; i++) {
            if (u[uf.root(i)]) continue;
            u[uf.root(i)] = true;
            ans += 2;
        }
        cout << ans << endl;
    }

    return 0;
}

Measured memory_bytes: 3116
#include<stdio.h>

int main(){
    int a, b, c;
    int num = 0;
    scanf("%d %d %d", &a, &b, &c);
    for(int i = a; i <= b; i++){
        if(c % i == 0){
            num++;
        }
    }
    printf("%d\n", num);
    return 0;
}


Measured memory_bytes: 2096
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rep1(i,n) for(int i=1; i<=(n); ++i)
#define pb push_back
#define ALL(obj) (obj).begin(), (obj).end()
using namespace std;
typedef long long ll;
ll N,M;
int main(){
    cin >> N >> M;
    if(N >= M) cout << M/2 << endl;
    else cout << N + (M/2 - N)/2 << endl;
}

Measured memory_bytes: 256
{-# LANGUAGE OverloadedStrings #-}
import qualified Data.ByteString as SBS
import Data.ByteString.Lazy as LBS hiding(putStrLn)
import Control.Monad.State
import Data.Maybe
import Data.Word

main = do
  s <- LBS.fromStrict <$> SBS.getLine
  let remain = LBS.length $ execState (step s) LBS.empty
  putStrLn $ show (LBS.length s - remain)

step :: ByteString -> State ByteString ()
step "" = pure ()
step i = do
  let Just (x, xs) = uncons i
  st <- get
  if LBS.null st || LBS.head st == x
    then push x
    else pop
  step xs

push :: Word8 -> State ByteString ()
push x = modify (cons x)

pop :: State ByteString ()
pop = state (fromJust . uncons) >> pure ()


Measured memory_bytes: 16764
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <cstring>
#include <functional>
#include <queue>
#include <cmath>
#include <utility>

using namespace std;

#define int long long
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define rep1(i,n) for(int i=1;i<=(int)n;++i)

queue<int> q[1010];
bool finished[1010];
int counter[1010][1010];

struct Data {
	int day;
	pair<int, int> p;
	Data(int day, pair<int, int> p) : day(day), p(p) {}
	bool operator<(Data rhs) const {
		return day < rhs.day;
	}

	bool operator>(Data rhs) const {
		return day > rhs.day;
	}
};

signed main()
{
	int N; cin >> N;
	
	priority_queue<Data, vector<Data>, greater<Data>> pq;

	rep(i, N) {
		rep(j, N - 1) {
			int a; cin >> a;
			--a;
			q[i].push(a);
		}
	}

	rep(i, N) {
		int a = q[i].front();
		counter[i][a]++;
		counter[a][i]++;

		if (counter[i][a] == 2) {
			pq.push(Data(1, pair<int, int>(i, a)));
		}
	}

	int zan = N*(N-1);

	int ans = 0;

	while (not pq.empty()) {
		Data d = pq.top();
		pq.pop();

		zan -= 2;

		int day = d.day;
		pair<int, int> p = d.p;

		ans = day;

		counter[p.first][p.second] = counter[p.second][p.first] = 0;

		q[p.first].pop();
		q[p.second].pop();

		if (not q[p.first].empty()) {
			int op = q[p.first].front();
			counter[p.first][op]++;
			counter[op][p.first]++;

			if (counter[p.first][op] == 2) {
				pq.push(Data(day + 1, pair<int, int>(p.first, op)));
			} 
		}

		if (not q[p.second].empty()) {
			int op = q[p.second].front();
			counter[p.second][op]++;
			counter[op][p.second]++;

			if (counter[p.second][op] == 2) {
				pq.push(Data(day + 1, pair<int, int>(p.second, op)));
			}
		}
	}

	if (zan == 0) {
		cout << ans << endl;
	} else {
		cout << -1 << endl;
	}
}


Measured memory_bytes: 16896
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cstring>

#define mod 100000

using namespace std;

int dp[50][3001];

int main(){
	int n,m,s;
	while(scanf("%d %d %d",&n,&m,&s)){
		if(n==0&&m==0&&s==0)
		break;
		memset(dp,0,sizeof(dp));
		dp[0][0]=1;
		for(int i=1;i<=m;i++){
			for(int j=n*n;j>0;j--){
				for(int k=i;k<=s;k++){
					dp[j][k]=(dp[j][k]+dp[j-1][k-i])%mod;
				}
			}
		}
		printf("%d\n",dp[n*n][s]);
	}
}

Measured memory_bytes: 3736
n,k,q = gets.split.map(&:to_i)

point = []
n.times do |i|
  point[i] = k
end

a = []
q.times do |i|
  a[i] = gets.split[0].to_i
end

q.times do |i|
  point[a[i]-1] += 1
end

n.times do |i|
  if point[i]-q > 0
    point[i] = "Yes"
  else
    point[i] = "No"
  end
end

puts point


Measured memory_bytes: 10824
import java.util.Scanner;

public class Main {

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.nextLine());
		String a= sc.nextLine();
		String[] al = {"A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z",
				"A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"} ;
        String[] array = a.split("");
        n = n%26;

        for (int i = 0; i < array.length; i++) {
            for (int j = 0; j < 26; j++) {
            	if(array[i].equals(al[j])){
            		array[i] = al[j+n];
            		break;
            	}
            }
        }

        for (int i = 0; i < array.length; i++) {
        	System.out.print(array[i]);
        }

	}
}

Measured memory_bytes: 26144
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using P = pair <int, int>;
const double PI = acos(-1);
const ll MOD = 1000000007;

int main(){
  ll N;
  cin >> N;
  vector<ll> L(N+1);
  //ll mid = N/2+1;
  for (ll i = 1; i < N+1; i++){
    for(ll j = 0; j<N+1; j += i){
      L[j]++;
    }
  }
  ll ans = 0;
  rep(i, N+1) ans += i*L[i];

  cout << ans << endl;
}


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


#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()


using namespace std;
using namespace __gnu_pbds;

template<class T> using ordered_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;
using ll  = long long;

using point = complex<double>;


void err(istream_iterator<string> it) {cerr << endl;}
template<typename T, typename... Args>void err(istream_iterator<string> it, T a, Args... args) {cerr << *it << " = " << a << endl;err(++it, args...);}


const double EPS = 1e-8;
const long long mod = 1e9 + 7;

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

const int N = 1e5 + 5;


int n,k;
ll arr[N];
ll acc[N];
int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin >> n >> k;
    for(int i = 1; i <= n; ++i){
            cin >> arr[i];
            if(i >= 2)
                acc[i] = abs(arr[i - 1] - arr[i]) + acc[i - 1];
    }
    ll ans = LLONG_MAX;
    for(int i = 1; i+k-1 <= n; ++i){
        if(arr[i + k - 1] < 0){
                ans = min(ans,abs(arr[i]));
        }else if(arr[i] > 0){
                ans = min(ans,abs(arr[i + k - 1]));
        }else if(arr[i] <= 0 && arr[i + k - 1] >= 0){
                ans = min(ans,
                          abs(arr[i + k - 1]) + (abs(arr[i + k - 1] - arr[i])) );
                ans = min(ans, abs(arr[i]) + abs(arr[i + k - 1]-arr[i]));
        }

    }
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 1792
from sys import stdin
import math
import numpy as np
from numpy.linalg import norm

A, B, H, M = map(int, stdin.readline().rstrip().split())

two_pi = 2 * math.pi

hour_rad = - (two_pi / 12 * H + two_pi / (12 * 60) * M) + two_pi / 4
minute_rad = - (two_pi / 60) * M + two_pi / 4

hour = A * np.array([np.cos(hour_rad), np.sin(hour_rad)])
minute = B * np.array([np.cos(minute_rad), np.sin(minute_rad)])

div = hour - minute
print(norm(div))

Measured memory_bytes: 27272
import sys
input = sys.stdin.readline
while True:
  n, m, k, l = map(int, input().split())
  if n == 0:
    break
  ranking = []
  for _ in range(n):
    name, x = input().split()
    x = int(x)
    ranking.append([x, name])
  ranking.sort(key=lambda x:(-x[0], x[1]))
  
  favs = {input().strip() for _ in range(m)}
  favs_x = {}
  not_favs_x = {}
  for x, name in ranking:
    if name in favs:
      favs_x[name] = x
    else:
      not_favs_x[name] = x
  favs_ranking = sorted(favs_x.items(), key=lambda x:(-x[1], x[0]))
  not_favs_ranking = sorted(not_favs_x.items(), key=lambda x:(-x[1], x[0]))
  not_favs_length = len(not_favs_ranking)
  favs_length = len(favs_ranking)
  def check(num):
    not_favs_num = k - num
    if num > favs_length:
      return False
    if not_favs_num >= not_favs_length:
      return True
    target_name, target_x = not_favs_ranking[not_favs_num]
    need = 0
    for name, x in favs_ranking[:num]:
      if target_name > name:
        if target_x <= x:
          continue
        else:
          need += target_x - x
  
      else:
        if target_x < x:
          continue
        else:
          need += target_x - x + 1
    
    return (need <= l)
  
  left = 0
  right = min(k, favs_length) + 1

  while True:
    if right <= left + 1:
      break
    center = (left + right) // 2
    if check(center):
      left = center
    else:
      right = center
  print(left)


Measured memory_bytes: 79784
//
//  ABC042B.cpp
//  programing
//
//  Created by 毛利源 on 2019/01/29.
//

#include<iostream>
#include <algorithm>
using namespace std;

int main(){
    int N,L;
    std::cin >> N>>L;
    string S[N];
    for (int i = 0; i < N; i++) {
      std::cin >> S[i];
    }

    sort(S,S+N);
    for(int i=0;i<N;i++){
      std::cout << S[i];
    }
    std::cout << '\n';
    return 0;
}


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

int main(){
  int pos[] = {1, -1, 4, -4};
  queue<string> que;
  que.push("01234567");

  map<string, int> d;

  while(!que.empty()){
    string str = que.front();
    
    que.pop();
    int zero;
    for ( int i = 0; i < str.size(); i++ ) if ( str[i] == '0' ) zero = i;

    string str2;
    for ( int i = 0; i < 4; i++ ) {
      int next_z;
      next_z = zero + pos[i];
      if(next_z >= 0 && next_z <= 7 &&
	 !((zero == 3 && next_z == 4) || (zero == 4 && next_z == 3))){
	str2 = str;
	swap(str2[zero], str2[next_z]);

	if ( !d[str2] ) {
	  que.push(str2);
	  d[str2] = d[str] + 1;
	}
      }
    }
  }

  string num;
  char ch;
  while( cin >> ch ){
    num.clear();
    num += ch;
    for ( int i = 0; i < 7; i++ ) {
      cin >> ch;
      num += ch;
    }
    if ( num == "01234567" ) cout << 0 << endl;
    else cout << d[num] << endl;
  }
}

Measured memory_bytes: 3440
#include <iostream>
#include <random>
#include <chrono>
#include <algorithm>
#include <set>
#define rep(i, x) for(ll i = 0; i < x; i++)
#define CONCAT_(x,y) x##y
#define CONCAT(x,y) CONCAT_(x,y)
#define _v1 CONCAT(qyw1, __LINE__) // unique name in same line (otherwise use __COUNTER__)
#define _v2 CONCAT(qyw2, __LINE__)
#define forbits(i, m) for (int _v1 = m, i = __builtin_ctz(_v1); _v1 != 0; _v1 ^= _v1 & -_v1, i = __builtin_ctz(_v1))
#define forsubm(s, m) for (int s = m; s >= 0; s = !s ? -1 : m & (s - 1))
int __nextXZW(int v){int t=v|(v-1);int w=(t+1)|(((~t&-~t)-1)>>(__builtin_ctz(v)+1));return w;}
#define ksets(i, n, k) for (int i = (1u << k) - 1, max = i << (n - k); i <= max; i = __nextXZW(i))
using namespace std;
typedef long long ll;
const ll MOD = (ll)1e9+7;
const ll N = 5e5+5, inf = 1e9+5000;
ll add(ll x, ll y) { x += y; if (x >= MOD) return x - MOD; return x; }
ll sub(ll x, ll y) { x -= y; if (x < 0) return x + MOD; return x; }
ll mult(ll x, ll y) { return (x * y) % MOD; }
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
#include <atcoder/all>
using namespace atcoder;

int op(int x, int y) {
  return x + y;
}
int e() { return 0; }

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int n; cin >> n;
  vector<int> p(n);
  vector<int> order(n);
  rep (i, n) {
    int x, y; cin >> x >> y;
    x--, y--;
    p[x] = y;
    order[i] = x;
  }

  set<pair<int, int>> s;
  dsu DSU(n);

  rep (i, n) {
    auto it = s.lower_bound({p[i], -1});
    if (it == s.begin()) {
      s.insert({p[i], i});
    } else {
      for (auto itt = s.begin(); itt != it; itt++) 
        DSU.merge(itt->second, i);
      for (auto itt = ++s.begin(); itt != it; )
        itt = s.erase(itt);
    }
  }

  rep (i, n) cout << DSU.size(order[i]) << '\n';

  return 0;
}

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

int main() {
  int n;
  cin >> n;
  
  int count = 0;
  int max = 1;
  
  for(int i = 1; i <= n; i++){
    int x = i;
    int cc = 0;
    while(x%2 == 0){
      x /=2;
      cc++;
    }
    if(count < cc){
      count = cc;
      max = i;
    }
  }
  cout << max << endl;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(){
    int N;
  　int A[3][3];
    int b[10];
    int bingo[4] = {};
    int Bingo = 0;

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

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

    for(int i=0;i<3;i++){
        for(int j=0;j<3;j++){
            for(int k=0;k<10;k++){
                if(A[i][j]==b[k]){
                    A[i][j] = 0;
                }
            }
        }
    }

    
    for(int i=0;i<3;i++){
        if(A[i][0]==0 && A[i][1]==0 && A[i][2]==0){
            bingo[0] = 1;
        }
    }

    for(int j=0;j<3;j++){
        if(A[0][j]==0 && A[1][j]==0 && A[2][j]==0){
            bingo[1] = 1;
        }
    }

    if(A[0][0]==0 && A[1][1]==0 && A[2][2]==0){
        bingo[2] = 1;
    }

    if(A[2][0]==0 && A[1][1]==0 && A[0][2]==0){
        bingo[3] = 1;
    }

    for(int i=0;i<4;i++){
        if(bingo[i]==1){
            printf("Yes");
            Bingo = 1;
            break;
        }
    }

    if(Bingo != 1){
        printf("No");
    }

    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define db(x) (cerr << #x << ": " << (x) << '\n')
#define cps CLOCKS_PER_SEC
#define tests(t) int t; cin >> t; while(t--)
#define iceil(n, x) (((n) + (x) - 1) / (x))
#define eb emplace_back
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define sz size()
#define all(v) (v).begin(), (v).end()
#define uni(v) sort(all(v)), (v).erase(unique(all(v)), (v).end())
#define fi first
#define se second
#define bitcount(x) __builtin_popcount(x)
#define bit(x) (1LL << x)
#define PI acos(-1.0)
#define EPS 1e-9

#define mod 1000000007
#define maxn 2005

using namespace std;

using namespace __gnu_pbds;
template<class key, class cmp = std::less<key>>
using ordered_set = tree<key, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
///All indexing is 0-based
///methods: find_by_order(k); & order_of_key(k);
///To make it an ordered_multiset, use pairs of (value, time_of_insertion)
///to distinguish values which are similar

typedef long long ll;
typedef double ld;
typedef pair<ll, ll> par;



int main()
{
    #ifdef acm
    freopen("a.in","r",stdin);
    #endif // acm
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    int N,M;
    cin >> N >> M;
    if(N == M)
        cout << "Yes\n";
    else
        cout << "No\n";







}



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


int main() {

  int N, M;
  cin >> N >> M;
  vector<int> ninki(N);

  int total = 0;

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

  sort(ninki.begin(),ninki.end());
  reverse(ninki.begin(),ninki.end());

  double kijun = (double)total/(4*M);

  int sentaku = 0;

  for(int i=0; i<=M; i++){
    if(ninki.at(i)<kijun){
      break;
    }else{
      sentaku++;
    }
    
    if(sentaku==M){
    	break;
    }
      
  }

  if(sentaku >=  M){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }

  return 0;

}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <functional>
#include <math.h>

using namespace std;
const int mod = 1000000007;
const double pi = 3.141592653589793238462643382795028841971;

int main() {
	string h;
	cin >> h;
	int ans = 99999999;
	for (int i = 2; i < h.length(); ++i) {
		int mon = stoi(h.substr(i - 2, 3));
		ans = min(ans, abs(mon - 753));
	}
	cout << ans << endl;
}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define ceiv(a, b) (1 + (int)((a) - 1)/(int)(b))
//#define int long long

signed main(){
    string s; cin >> s;
    int price = 700;
    rep(i,3) if(s[i]=='o') price += 100;
    cout << price << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double db;
const int N = 1e5+5;

int n,id[N];
db X[N],Y[N],ans;
pair<db,db> a[4];

void dfs(int w){
	static bool vis[4];
	if(w==4){
		db x=0,y=0;
		for(int i=0;i<4;++i)if(vis[i])x+=a[i].first,y+=a[i].second;
		ans=max(ans,sqrt(x*x+y*y));
		return;
	}
	for(int i=0;i<2;++i){
		vis[w]=i;dfs(w+1);
	}
}

bool cmp(int x,int y){
	return atan2(Y[x],X[x])<atan2(Y[y],X[y]);
}

int main(){
	cin>>n;
	for(int i=0;i<n;++i)cin>>X[i]>>Y[i],id[i]=i;
	sort(id,id+n,cmp);
	for(int i=0;i<n;++i){
		db x=0,y=0;
		for(int k=i,c=0;c<n;k=(k+1)%n,c++){
			int t=id[k];
			x+=X[t];y+=Y[t];
			ans=max(ans,sqrt(x*x+y*y));
		}
	}
	printf("%.20Lf\n",ans);
}

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

#define INF 1000010000
#define nl '\n'
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define fi first
#define se second
#define pii pair<int,int>
#define pdd pair<double,double>
#define all(c) (c).begin(), (c).end()
#define SORT(c) sort(all(c))
#define sz(c) (c).size()
#define rep(i,n) for( int i = 0; i < n; ++i )
#define repi(i,n) for( int i = 1 ; i <= n; ++i )
#define repn(i,n) for( int i = n - 1 ; i >= 0 ; --i )
#define repf(j,i,n) for( int j = i ; j < n ; ++j )
#define die(s) {std::cout << s << nl;}
#define dier(s) {std::cout << s; return 0;}
#define dbg(var) {std::cout << #var << "  = " << var << nl;}
#define vi vector<int>
typedef long long ll;

using namespace std;


int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.precision(0); 

	string s , t;
	cin >> s >> t;
	
	int ns = sz(s) , nt = sz(t);
	
	vector<vi> dp(ns + 1 , vi(nt + 1 , -INF));
	rep(i , ns + 1)
	{
		rep(j , nt + 1)
		{
			if(!(i && j))
			{
				dp[i][j] =  0;
				continue;
			}
			
			if(s[i - 1] == t[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[ns][nt] << endl;
	
	string ans { " " };
	while(ns && nt)
	{
		if(s[ns - 1] == t[nt - 1])
		{
			ans += s[ns - 1];
			--ns, --nt;
		}
		else
		{
			--(dp[ns - 1][nt] > dp[ns][nt - 1] ? ns : nt);
		}
	}
	
	reverse(all(ans));
	cout << ans << endl;

	return 0;
}

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

for i in range(n):
	if m > ary[i][1]:
		m -= ary[i][1]
		ans += ary[i][0] * ary[i][1]
	else:
		ans += m * ary[i][0]
		break
print (ans)

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

#include <iostream>
#include <string>
using namespace std;

int main(int argc, char* argv[]){
	cin.tie(0);
	ios::sync_with_stdio(false);

	int X, Y;
	cin >> X >> Y;

	int ans = 0;
	for(int a=0; a<=X; a++){
		int b = X - a;
		if( ((2 * a) + (4 * b)) == Y){
			ans = 1;
			break;
		}
	}
	if(ans == 1){
		printf("Yes\n");
	}
	else{
		printf("No\n");
	}
	return 0;
}

Measured memory_bytes: 3656
N,K=map(int,input().split())
 
a=list(map(int,input().split()))
tentou1=0
for i in range(N):
  for j in range(i+1,N):
    if a[i]>a[j]:
      tentou1+=1
stentou=0
for i in range(N):
  for j in range(N):
    if a[i]>a[j]:
      stentou+=1
answer= (tentou1*K) + (K*(K-1)//2*stentou)
print(answer%(10**9+7))



Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int w,a,b,x,y,xx,yy;
    cin>>w>>a>>b;
    x=a;
    y=a+w;
    xx=b;
    yy=b+w;
    if(yy>=x){
        if(xx>y)
            printf("%d\n",xx-y);
        else
            printf("0\n");
    }
    else{
        printf("%d\n",x-yy);
    }
}


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

using namespace std;

int main(){
  string a,b;
  cin>>a>>b;
  int count=0;
  for(int i=0;i<a.size();i++){
    if(a[i]==b[i]) ++count;
  }
  cout<<a.size()-count<<endl;
}

Measured memory_bytes: 3908
/*input

*/

#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i < b;i++)
#define rrep(i,b,a) for(int i=b ; i > a ; i--)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define endl '\n'
#define check1(a) cerr << a << endl
#define check2(a,b) cerr << a << "|" << b << endl
#define all(v) v.begin(),v.end()
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
/*----------------------------------------------*/
const int MAX = (int)5e5 + 10;
int n,m;
int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> n >> m;
    set<int> source,dest;
    rep(i,0,m){
    	int x,y;
    	cin >> x >> y;
    	if(x == 1){
    		source.insert(y);
    	}
    	else if(y == n){
    		dest.insert(x);
    	}
    }
    for(auto &z:source){
    	if(dest.find(z) != dest.end()){
    		cout << "POSSIBLE";
    		return 0;
    	}
    }
    cout << "IMPOSSIBLE";
}

Measured memory_bytes: 9600