akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <string>
#include <cmath>
using namespace std;
#define MOD 1000000007
#define INF 1<<30
#define LINF 1LL<<62
#define MAX 510000
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(ll i=(a); i<(b); i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll, ll> P;
typedef vector<pair<ll, ll>> vpl;
const int mod = 1e9 + 7;

vector<vpl> G(100005);
bool vvisit[100005];
bool evisit[100005];
vpl ans;
vl deg(100005,0);

bool dfs(ll u){
    vvisit[u] = true;
    ll res = 0;
    for(auto v : G[u]){
        if(vvisit[v.first]){
            if(evisit[v.second]) continue;
            else{
                evisit[v.second] = true;
                ans.emplace_back(u,v.first);
                res++;
            }
        }
        else{
            evisit[v.second] = true;
            if(deg[v.first]==1){
                ans.emplace_back(u,v.first);
                res++;
            }else{
                if(dfs(v.first)){
                    ans.emplace_back(v.first,u);
                }else{
                    ans.emplace_back(u,v.first);
                    res++;
                }
            }
        }
    }
    if(res % 2 == 1) return true;
    else return false;

}

int main(){
    ll n,m; cin >> n >> m;
    rep(i,m){
        ll a,b; cin >> a >> b;
        a--; b--;
        G[a].emplace_back(P(b,i));
        G[b].emplace_back(P(a,i));
        deg[a]++; deg[b]++;
    }
    if(m%2==1) puts("-1");
    else{
        dfs(0);
        for(auto i : ans){
            cout << i.first+1 << " " << i.second+1 << endl;
        }
    }
}

Measured memory_bytes: 17392
import Data.List
import qualified Data.ByteString.Char8 as BS
main=do
 n<-readLn;a<-map (read.BS.unpack).BS.words<$>BS.getLine
 print (f n (sort (map (\(i,a)->a-i) (zip [1..n] a))))
  where f n a = g a (m n a)
        m n a |odd n  = a!!(quot n 2)
              |even n = (\(x:y:s)->quot (x+y) 2) (drop ((quot n 2)-1) a)
        g a m = sum (map (\s->abs (s-m)) a)

Measured memory_bytes: 34172
#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 K;
  cin >> K;

  queue<ll> q;
  for(int i=1; i<=9; ++i) {
    q.push(i);
  }

  rep(i,K) {
    ll tmp = q.front();
    q.pop();
    if (i == K-1) {cout << tmp << endl; return 0;}

    int mo = tmp % 10;
    if (mo != 0) q.push(10*tmp + mo - 1);
    q.push(10*tmp + mo);
    if (mo != 9) q.push(10*tmp + mo + 1);
  }

  return 0;
}


Measured memory_bytes: 1792
#include<stdio.h>

static const int MAX = 500;
static const int INFTY = (1<<21);

int main(){
  int n,i,j,e,u,v,sum = 0,minv,M[MAX][MAX],d[MAX],p[MAX],vis[MAX];

  scanf("%d",&n);

  for(i = 0;i < n;i++){
    for(j = 0;j < n;j++){
      scanf("%d",&e);
      if(e == -1){
	M[i][j] = INFTY;
      }
      else{
	M[i][j] = e;
      }
    }
  }

  for(i = 0;i < n;i++){
    d[i] = INFTY;
    p[i] = -1;
    vis[i] = 0;
  }

  d[0] = 0;

  while(1){
    minv = INFTY;
    u = -1;

    for(i = 0;i < n;i++){
      if(minv > d[i] && !vis[i]){
	u = i;
	minv = d[i];
      }
    }

    if(u == -1) break;

    vis[u] = 1;

    for(v = 0;v < n;v++){
      if(!vis[v] && M[u][v] != -1){
	if(d[v] > M[u][v]){
	  d[v] = M[u][v];
	  p[v] = u;
	}
      }
    }
  }
  
  for(i = 0;i < n;i++){
    if(p[i] != -1){
      sum += M[i][p[i]];
    }
  }
  
  printf("%d\n",sum);

  return 0;
}
    



Measured memory_bytes: 2112
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
int n,i,x,y,l,ans;
char s[666666];

int main(){
	
	cin>>s;
	
	l=strlen(s); 
	for (i=0; i<l; i++){
		if (x==y){
			x++;
			if (s[i]=='p') ans--;
		}
		else {
			y++;
			if (s[i]=='g') ans++;
		}
	}
	
	cout<<ans<<endl;
		
	return 0;
}

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

int main(){
    
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    ll n,k;
    cin >> n >> k;
    
    vector<pair<ll, ll>> a(n);
    vector<ll> c(n);
    
    rep(i,n) cin >> a[i].first >> a[i].second;
    
    sort(a.begin(), a.end());
    
    c[0] = a[0].second;
    for(ll i = 1; i < n; i++){
        c[i] = c[i-1] + a[i].second;
    }
    
    ll itr = 0;
    for(ll i = 0; i < n; i++){
        if(k<=c[i]){
            itr = i;
            break;
        }
    }
    cout << a[itr].first << endl;
}


Measured memory_bytes: 2560
#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;cin >> n;
	vector<pii> r(n),b(n);
	rep(i,n) cin >> r.at(i).first >> r.at(i).second;
	rep(i,n) cin >> b.at(i).first >> b.at(i).second;
	sort(b.begin(),b.end());
	int ans=0;
	vector<bool> used(n,true);
	rep(i,n){
		int k=-1,cur=-1;
		rep(j,n){
			if(used.at(j) && r.at(j).first<b.at(i).first && r.at(j).second<b.at(i).second){
				if(r.at(j).second>cur){
					k=j;
					cur=r.at(j).second;
				}
			}
		}
		if(k>=0){
			ans++;
			used.at(k)=false;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        long input = scanner.nextLong();

        StringBuilder sbr = new StringBuilder();
        while ( input > 0 ){
            input -= 1;
            sbr.append( (char) ( 'a' + input % 26 ));
            input /= 26;
        }

        System.out.println( sbr.reverse().toString());
    }
}

Measured memory_bytes: 35804
#include<bits/stdc++.h>
using namespace std;
int main(){
  long long a, b, c, k; cin >> a >> b >> c >> k;
  if(k <= a) cout << k << endl;
  else{
    if(k <= (a + b)) cout << a << endl;
    else {
      cout << a - (k - a - b) << endl;
    }
  }
}

Measured memory_bytes: 3620
<?php
$A = trim(fgets(STDIN));
$B = trim(fgets(STDIN));
$C = trim(fgets(STDIN));
$X = trim(fgets(STDIN));
$cnt = 0;

for ($i = 0; $i < $A+1; $i++) {
    for ($j = 0; $j < $B+1; $j++) {
        for ($k = 0; $k < $C+1; $k++) {
            if ((500*$i+100*$j+50*$k)==$X){
                $cnt ++;
            }
        }
    }
}
print $cnt;

Measured memory_bytes: 4604
///not today

#include<bits/stdc++.h>
using namespace std;

#define SZ(x) (int)(x).size()
#define pb push_back
#define ll long long
#define xmax(x, y) (x) = max((x), (y))
#define xmin(x, y) (x) = min((x), (y))
#define F first
#define S second
#define pii pair<int, int>
#define pll pair<long long, long long>
#define int long long
#define pipii pair<int, pair<int, int> >
#define pf push_front

bool ans = false;
const int maxn = 1000* 100 + 5;
vector <int> aj[maxn];
bool mrk[maxn], r[maxn];
int pr[maxn];

void dfs(int v){
    mrk[v] = true;
    for(int i = 0; i < SZ(aj[v]); i ++){
        int u = aj[v][i];
        if(!mrk[u]){
            pr[u] = v;
            dfs(u);
        }
    }
    if(!r[v]){
        if(r[pr[v]] or v == 0)
            ans = true;
        else{
            r[pr[v]] = true;
            r[v] = true;
        }
    }
    return;
}

int32_t main(){
    int n;
    cin >>n;
    for(int i = 1; i < n; i ++){
        int u, v;
        cin >>u >>v;
        u --;
        v --;
        aj[u].pb(v);
        aj[v].pb(u);
    }
    dfs(0);
    if(ans)
        cout <<"First" <<endl;
    else
        cout <<"Second" <<endl;
}


Measured memory_bytes: 7296
//#define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"

#define rep(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007
#define INF (1LL<<60LL)
typedef long long ll;

using namespace std;


int main() {
	string s0, s1, s2; cin >> s0 >> s1 >> s2;
	ll len0 = s0.size();
	ll len1 = s1.size();
	ll len2 = s2.size();
	char turn = 'a';
	ll i = 0, j = 0, k = 0;
	while (1) {
		switch (turn){
		case 'a':
			if (i == len0) {
				cout << "A" << endl;
				exit(0);
			}
			turn = s0[i];
			i++;
			break;
		case 'b':
			if (j == len1) {
				cout << "B" << endl;
				exit(0);
			}
			turn = s1[j];
			j++;
			break;
		case 'c':
			if (k == len2) {
				cout << "C" << endl;
				exit(0);
			}
			turn = s2[k];
			k++;
			break;
		}
	}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define max(a,b) (a<b?b:a)
#define F(i,L,R) for (int i = L; i < R; i++)
#define FE(i,L,R) for (int i = L; i <= R; i++)
#define RF(i,L,R) for (int i = L; i > R; i--)
#define RFE(i,L,R) for (int i = L; i >= R; i--)
#define getI(a) scanf("%d", &a)
#define getII(a,b) scanf("%d%d", &a, &b)
#define getIII(a,b,c) scanf("%d%d%d", &a, &b, &c)
#define VgetI(n) int (n); scanf("%d",&(n))
#define VgetII(n,m) int (n),(m); scanf("%d %d",&(n),&(m))
#define VgetIII(n,m,k) int (n),(m),(k); scanf("%d %d %d",&(n),&(m),&(k))
#define ll long long
#define INF 1000000000000000005
#define nINF -2000000000
#define MOD 1e9+7
#define PI 3.1415926535897932384626
int mabs(int x){
	if(x<0) return (-x);
	return x;
}
int main(){
	int n;
	while(~getI(n)){
		int h[n],dp[n];
		F(i,0,n) getI(h[i]);
		dp[0]=0,dp[1]=mabs(h[1]-h[0]);
		F(i,2,n){
			int a1=dp[i-1]+mabs(h[i]-h[i-1]);
			int a2=dp[i-2]+mabs(h[i]-h[i-2]);
			dp[i]=min(a1,a2);
		}
		printf("%d\n",dp[n-1]);
	}
}


Measured memory_bytes: 1024
#include <iostream>
using namespace std;
int card[255][14]={{0}};
int main(void){
  int n;
  cin>>n;
  for(int i=0; i<n; i++){
      char c;
      int num;
      cin>>c>>num;
      card[(int)c][num]=1;
  }
  for(int i=1; i<=13; i++){
      if(card[(int)'S'][i]==0){
          cout<<"S "<<i<<endl;
      }
  }
  for(int i=1; i<=13; i++){
      if(card[(int)'H'][i]==0){
          cout<<"H "<<i<<endl;
      }
  }
  for(int i=1; i<=13; i++){
      if(card[(int)'C'][i]==0){
          cout<<"C "<<i<<endl;
      }
  }
  for(int i=1; i<=13; i++){
      if(card[(int)'D'][i]==0){
          cout<<"D "<<i<<endl;
      }
  }
}


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

int main() {
  string n;
  cin >> n;
  
  if(n[0] > n[1]) {
    n[1] = n[2] = n[0];
  }else if(n[0] < n[1]) {
    int x = n[0] + 1;
    n[1] = n[2] = n[0] = char(x);
  }else {
    if(n[1] > n[2]) {
      n[2] = n[1];
    }else if(n[1] < n[2]) {
      int x = n[0] + 1;
      n[0] = n[1] = n[2] = char(x);
    }
  }
  cout << n << endl;
  
  return 0;
}

Measured memory_bytes: 256
MAX = 1000000
K, X = map(int, input().split())
if X - K - 1 < MAX * -1:
    X -= X - K + MAX + 1

if X + K - 1 > MAX:
    X -= X + K - MAX - 1

print(' '.join(map(str,[x for x in range(X-K+1, X+K)])))

Measured memory_bytes: 2940
package main

import (
	"bufio"
	"fmt"
	"os"
)
var s string

func main()  {
	var reader = bufio.NewReader(os.Stdin)
	var writer = bufio.NewWriter(os.Stdout)
	defer writer.Flush()
	fmt.Fscanf(reader, "%s", &s)
	var could = false
	for _, ch := range s {
		if ch == '7' {
			could = true
		}
	}
	if could {
		fmt.Fprintf(writer, "Yes")
	} else {
		fmt.Fprintf(writer, "No")
	}
}


Measured memory_bytes: 1832
N = int(input())
H = list(map(int,input().split()))
C = [0]*N

C[1] = abs(H[0]-H[1])
for i in range(2,N):
    C[i] = min(abs(H[i]-H[i-1])+C[i-1],abs(H[i]-H[i-2])+C[i-2])

print(C[-1])

Measured memory_bytes: 13980
N = int(input())

L = list(map(int, input().split()))

count = 0
for i in range(0, N-2):
  for j in range(1, N-1):
    if L[i] == L[j]:
      continue
    for k in range(2, N):

      if i < j and j < k:
        if L[i] == L[k]:
          continue

        if L[j] == L[k]:
          continue

        if L[i] + L[j] > L[k] and L[j] + L[k] > L[i] and L[k] + L[i] > L[j]:
          count += 1

print(count)

Measured memory_bytes: 9212
#include <iostream>
#include <algorithm>
#include <map>
#include <vector>
#include <set>
#include <bitset>
#include <unordered_map>
#include <queue>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <cstring>

using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)


int main(){
    int N,T;
    cin >> N >> T;
    int ans = 0;
    int dp[N+1][T];
    vector<pair<int,int> > dishes(N);
    rep(i,N){
        int a,b;
        cin >> a >> b;
        dishes[i] = make_pair(a, b);
    }

    sort(dishes.begin(), dishes.end());
    memset(dp, 0, sizeof(dp));
    rep(i,N-1){
        rep(j,T){
            dp[i+1][j] = max(dp[i][j], dp[i+1][j]);
            int nextj = j+dishes[i].first;
            if( T > nextj ){
                dp[i+1][nextj] = max(dp[i][j] + dishes[i].second, dp[i][nextj]);
            }
        }
        ans = max(ans, dp[i+1][T-1] + dishes[i+1].second);
    }
    cout << ans << endl;

}

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

using namespace std;

#define ll long long
#define pii pair<int, int>
#define pb push_back
#define pli pair<ll, int>
#define pil pair<int, ll>
#define clr(a, x) memset(a, x, sizeof(a))

const double pi = acos(-1.0);
const int INF = 0x3f3f3f3f;
const int MOD = 1e9 + 7;
const double EPS = 1e-9;

/*
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define TREE tree<pli, null_type, greater<pli>, rb_tree_tag, tree_order_statistics_node_update>
TREE T;
*/

int n, k, v[105];
int main() {
	scanf("%d%d", &n, &k);
	for (int i = 1; i <= n; ++i) scanf("%d", &v[i]);
	int ans = 0;
	for (int i = 0; i <= n; ++i) {
		for (int j = i + 1; j <= n + 1; ++j) {
			if (i + n - j + 1 > k) continue;
			vector<int> vec;
			for (int k = 1; k <= i; ++k) vec.pb(v[k]);
			for (int k = j; k <= n; ++k) vec.pb(v[k]);
			sort(vec.begin(), vec.end());
			int tmp = 0, q = max(0, k - (int)vec.size());
			for (int l = 0; l < min(q, (int)vec.size()); ++l) if (vec[l] > 0) tmp += vec[l];
			for (int l = q; l < vec.size(); ++l) tmp += vec[l];
			ans = max(ans, tmp);
		}
	}
	printf("%d\n", ans);
	return 0;
}


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

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

#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

using namespace std;

typedef long long ll;
typedef vector<ll> vll;
typedef pair<ll, ll> pll;
typedef long double ld;

const ll mod = (ll)1e9 + 7;
const ll mxN = 200200;




int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.precision(20);
	cout << fixed;
	
	ll a,b;
	cin>>b>>a;
	b--,a--;
	cout<<(a+b-1)/b<<"\n";


}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
  string s;
  cin >> s;

  if (s[0] == s[1] && s[1] == s[2] || s[1] == s[2] && s[2] == s[3]) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }

  return 0;
}


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

using namespace std;
using ll = long long;

#define all(c) (c).begin(), (c).end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)
#define fr first
#define sc second

const ll INF = 1e9;
const ll MOD = 1e9 + 7;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

int main() {
    int a, b, c, d;
    int p;
    cin >> a >> b >> c >> d;
    cin >> p;
    cout << min(a * p, b + max(0, p - c) * d) << endl;
    return 0;
}

Measured memory_bytes: 3056
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.Arrays;
import java.util.Comparator;
import java.util.PriorityQueue;
public class Main {
  public static void main(String[] args) {
    Main m = new Main();
    m.run();
  }
  private void run() {
    int n = 0;
    long[] a = new long[0];
    try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in));) {
      n = Integer.parseInt(br.readLine());
      a = Arrays.stream(br.readLine().split("\\s+"))
        .mapToLong(Long::parseLong).toArray();
    } catch (IOException e) {
      e.printStackTrace();
    }
    PriorityQueue<Long> npq = new PriorityQueue<>(Comparator.naturalOrder());
    PriorityQueue<Long> rpq = new PriorityQueue<>(Comparator.reverseOrder());
    long[] s = new long[n+1];
    long[] t = new long[n+1];
    long su = 0L;
    long tu = 0L;
    for (int i=0;i<n;i++) {
      npq.offer(a[i]);
      su += a[i];
      rpq.offer(a[3*n-1-i]);
      tu += a[3*n-1-i];
    }
    s[0] = su;
    t[n] = tu;
    for (int i=n;i<2*n;i++) {
      npq.offer(a[i]);
      su += a[i]-npq.poll();
      s[i-n+1] = su;
      rpq.offer(a[3*n-1-i]);
      tu += a[3*n-1-i]-rpq.poll();
      t[2*n-i-1] = tu;
    }
    long m = s[0]-t[0];
    for (int i=0;i<n+1;i++) {
      if (m < s[i]-t[i]) m = s[i]-t[i];
    }
    System.out.println(m);
  }
}

Measured memory_bytes: 97296
#include<iostream>
#include<complex>
using namespace std;
#define dff 1e-10
int main(){
  int n;
  cin >>n;
  while(n--){
    complex<double> a,b;
    double ar,br,dr;
    cin >>a.real()>>a.imag()>>ar>>b.real()>>b.imag()>>br;
    dr = abs(a-b);
    if(dr-ar-br>dff) cout <<"0"<<endl;
    else if(ar>br && dr-ar+br < -dff) cout <<"2"<<endl;
    else if(br>ar && dr-br+ar < -dff) cout <<"-2"<<endl;
    else cout <<"1"<<endl;
  }
  return 0;
}

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

#define int long long
#define double long double
#define rep(i, n) for (int i = 0; i < (n); i++)
#define reps(i, n) for (int i = 1; i <= (n); i++)
#define all(x) (x).begin(), (x).end()
#define uniq(x) (x).erase(unique(all(x)), (x).end())
#define bit(n) (1LL << (n))
#define dump(x) cerr << #x " = " << (x) << endl
using vint=vector<int>;
using vvint=vector<vint>;
using pint=pair<int, int>;
using vpint=vector<pint>;
template<typename T> using priority_queue_rev=priority_queue<T, vector<T>, greater<T>>;
constexpr double pi = 3.1415926535897932384626433832795028L;
constexpr int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int gcd(int a, int b) {
    while (b) { swap(a %= b, b); }
    return a;
}
int lcm(int a, int b) { return a / gcd(a, b) * b; }
template<typename T> void fin(T mes) {
    cout << mes << endl;
    exit(0);
}
template<typename T1, typename T2> bool chmax(T1 &a, const T2 &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template<typename T1, typename T2> bool chmin(T1 &a, const T2 &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &rhs) {
    os << "(" << rhs.first << ", " << rhs.second << ")";
    return os;
}
template<typename T> ostream &operator<<(ostream &os, const vector<T> &rhs) {
    os << "{";
    for (auto itr = rhs.begin(); itr != rhs.end(); itr++) {
        os << *itr << (next(itr) != rhs.end() ? ", " : "");
    }
    os << "}";
    return os;
}
struct setup {
    static constexpr int PREC = 20;
    setup() {
        cout << fixed << setprecision(PREC);
        cerr << fixed << setprecision(PREC);
    };
} setup;

template<typename T>
struct cumulative_sum {
    int n;
    T ZERO;
    std::vector<T> data;
    template<typename I> cumulative_sum(I begin, I end, T ZERO = T())
        : n(end - begin), ZERO(ZERO), data(n + 1, ZERO) {
        std::copy(begin, end, data.begin() + 1);
        for (int i = 0; i < n; i++) { data[i + 1] += data[i]; }
    }
    T get_sum(int l, int r) const {
        if (l >= r || l > n || r < 0) { return ZERO; }
        if (l < 0) { l = 0; }
        if (r > n) { r = n; }
        return data[r] - data[l];
    }
};

int N, K;
int a[1100];
signed main() {
    cin >> N >> K;
    rep(i, N) { cin >> a[i]; }
    cumulative_sum<int> cs(a, a + N);
    vint cand;
    for (int i = 0; i <= N; i++) {
        rep(j, i) { cand.push_back(cs.get_sum(j, i)); }
    }
    int ans = 0;
    for (int i = 40; i >= 0; i--) {
        sort(all(cand)), reverse(all(cand));
        int k;
        for (k = 0; k < cand.size(); k++) {
            if (cand[k] < bit(i)) { break; }
            cand[k] -= bit(i);
        }
        if (k >= K) {
            ans += bit(i);
            cand.resize(k);
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 6132
#[allow(dead_code)]
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

#[allow(dead_code)]
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

#[allow(dead_code)]
fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}

fn main() {
    let s = read::<String>();
    let toggled = s.chars().map(|c| {
        let i = c as u8;
        if 65 <= i && i <= 90 {
            (i + 32) as char
        } else if 97 <= i && i <= 122 {
            (i - 32) as char
        } else {
            c
        }
    }).collect::<String>();

    println!("{}", toggled);
}



Measured memory_bytes: 5020
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define For(i,n,k) for(int i=(n);i<(k);i++)
#define ALL(a)  (a).begin(),(a).end()
const ll INF = 1e18;
vector<vector<ll>> d(300,vector<ll> (300));
ll warshallFloyd(int n){
    bool flag=false;
    for (int k = 0; k < n; k++){
        for (int i = 0; i < n; i++) { 
            for (int j = 0; j < n; j++) { 
                if(d[i][j] > d[i][k] + d[k][j]){
                    d[i][j] = d[i][k] + d[k][j];
                    flag=true;
                }
            }
        }
    }
    if(flag) return -1;
    ll len=0;
    for (int i = 0; i < n; i++){
        for (int j = i + 1; j < n; j++) { 
            bool flagij=true;
            for (int k = 0; k < n; k++) {
                if(i == k||j == k) continue;
                if(d[i][j] == d[i][k] + d[k][j]){
                    flagij=false;
                }
            }
            if(flagij) len+=d[i][j];
        }
    }
    return len;
}
void Main(){
    int n;cin>>n;
    For(i,0,n){
        For(j,0,n) {
            cin >> d[i][j];
        }
    }
    cout << warshallFloyd(n) << endl;
}
int main(){
    Main();
    /*
    東方風神録は神が出てくるので当然神ゲー
    */
    return 0;
}

Measured memory_bytes: 1024
from itertools import product
N = int(input())
cnt = 0
for i in range(3, len(str(N))+1):
    for p in product(["7", "5", "3"], repeat = i):
        if "7" in p and "5" in p and "3" in p:
            p = int("".join(p))
            if p <= N:
                cnt += 1
print(cnt)

Measured memory_bytes: 3060
//libraries
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>

//namespace
using namespace std;
using namespace __gnu_pbds;

//typedef
//typedef tree<long long,null_type,less<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
//typedef tree<long long,null_type,greater<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set1;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<long,long> pll;

//define
//#define inp(X) cin>>X;
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define line cout<<"\n";
#define vst(A) sort(A.begin(),A.end());
#define rvst (A) sort(A.rbegin(),A.rend());
#define pbp(a,b) push_back.make_pair(a,b)
#define vect(A) vector<long long> A;
#define ivect(A,n,p) vector<long long> A(n,p);
#define forin(i,a,b) for(long long i=a;i<=b;i++)
#define forde(i,a,b) for(long long i=a;i>=b;i--)
#define fio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

const long long inf=(long long)1e18;
const long long mod=(long long)(1e9+7);

ll power(ll x, ll y, ll p) 
{ 
    ll res = 1;      // Initialize result 
  
    x = x % p;  // Update x if it is more than or 
                // equal to p 
  
    while (y > 0) 
    { 
        // If y is odd, multiply x with result 
        if (y & 1) 
            res = (res*x) % p; 
  
        // y must be even now 
        y = y>>1; // y = y/2 
        x = (x*x) % p; 
    } 
    return res; 
} 
ll modInverse(ll a,ll p)
{
   return power(a,p-2,p);
}

int main()
{
    /*
    #ifndef ONLINE_JUDGE
       freopen ("input.txt" , "r" , stdin);
		// freopen ("OUTPUT.txt" , "w" , stdout);
	#endif
    */
    fio;
    ll testcase=1;
    //cin>>testcase;
    while(testcase--)
    {
        ll n;
        cin>>n;
        ll a[n];
        ll e=0;
        forin(i,0,n-1)
        {
            cin>>a[i];
            if(a[i]%2==0)
            {
                if(a[i]%3==0 || a[i]%5==0)
                {

                }
                else
                {
                    e++;
                }
                
            }
        }
        if(e)
        cout<<"DENIED";
        else
        {
            cout<<"APPROVED";
        }
        line;
        
    }
    return 0;
}

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

int main(){
    ll r;cin>>r;

    cout<<2*r*3.14<<endl;
}

Measured memory_bytes: 3776
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(n);++(i))
#define all(x) (x).begin(),(x).end()
#define dump(x) cout << #x << " = " << (x) << endl

using namespace std;
using ll = long long;
const ll MOD = 1000000007;
ll dp[100005][13];

int main() {
    string s; cin >> s;
    int n = s.length();
    rep(i, n)rep(j, 13) dp[i][j] = 0;

    dp[0][0] = 1;

    rep(i, n) {
        int c;
        if (s[i] == '?') c = -1;
        else c = s[i] - '0';

        for (int j = 0; j < 10; ++j) {
            if (c != -1 && c != j) continue;
            for (int ki = 0; ki < 13; ++ki) {
                dp[i + 1][(ki * 10 + j) % 13] += dp[i][ki];
            }
        }
        for (int j = 0; j < 13; ++j) dp[i + 1][j] %= MOD;
    }

    cout << dp[n][5] << endl;
}

Measured memory_bytes: 10624
#include<iostream>
using namespace std;
int main(){
  int N;
  int A[200005];
  int B[200005];
  cin >> N;
  for(int i = 1; i <= N; ++i)B[i] = 0;
for( int i = 2; i <= N; ++i){
  cin >> A[i];
  int p = A[i];
  B[p] += 1;
}
for( int i = 1; i <= N; ++i)cout << B[i] << endl;
}


Measured memory_bytes: 5156
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (long long  i=a;i<n;i++)
#define sz(A) (int)(A.size())
#define all(x) (x).begin(),(x).end()
#define get(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
typedef long long ll;
typedef pair<int, int> PII;
typedef vector<int> VI;

//a(n) = Sum_{ k = 1..n } k / 2 * floor(n / k) * floor(1 + n / k).
void solve() {
	ll n;
	double ans = 0;
	cin >> n;
	rep(i, 1, n + 1) {
		ans += ((double)i / 2 * (n / i)*(1 + n / i));
	}
	cout << (ll)ans << endl;
}
int main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int T_ = 1;
	//cin >> T_;
	for (int i = 0; i < T_; i++)solve();
	return 0;
}







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

int main() {
  
  int N;
  cin >> N;
  
  vector<long double> x(N);
  vector<long double> y(N);
  
  for (int i = 0; i < N; i++) {
    cin >> x[i] >> y[i];
  }
  
  long double ans = 0;
  
  for (int i = 1; i < N; i++) {
    for (int j = 0; j < i; j++) {
      ans += sqrt((x[i] - x[j]) * (x[i] - x[j]) + (y[i] - y[j]) * (y[i] - y[j]));
    }
  }
  cout << fixed << setprecision(6);
  cout << ans * 2.0 / N << endl;
  
}

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

using namespace std;

#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define pb push_back
#define mp make_pair
#define int long long
#define all(c) (c).begin(),(c).end()
#define M 1000000007
#define INF LLONG_MAX
#define pr(...) dbs(#__VA_ARGS__, __VA_ARGS__)
template <class T> void dbs(string str, T t) {cerr << str << " : " << t << "\n";}
template <class T, class... S> void dbs(string str, T t, S... s) {int idx = str.find(','); cerr << str.substr(0, idx) << " : " << t << ", "; dbs(str.substr(idx + 1), s...);}
template <class S, class T>ostream& operator <<(ostream& os, const pair<S, T>& p) {return os << "(" << p.first << ", " << p.second << ")";}
template <class T>ostream& operator <<(ostream& os, const vector<T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class T>ostream& operator <<(ostream& os, const set<T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class S, class T>ostream& operator <<(ostream& os, const map<S, T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class T> void prc(T a, T b) {cerr << "["; for (T i = a; i != b; ++i) {if (i != a) cerr << ", "; cerr << *i;} cerr << "]\n";}
// Use pr(a,b,c,d,e) or cerr<<anything or prc(v.begin(),v.end()) or prc(v,v+n)
//  


int32_t main()
{
    fastio;
    string s;
    cin >> s;
    int ans= 0;
    int n = s.length();
    for(int i=0;i<(s.length())/2;i++)
    {
        if(s[i] != s[n-1-i])
            ans++;
    }
    cout << ans <<"\n";
    
    return 0;
}



Measured memory_bytes: 256
#include<stdio.h>

int main(void){
	long int a, b, c,d,e;
long int n,ans,min;

scanf("%ld%ld%ld%ld%ld%ld",&n,&a,&b,&c,&d,&e);

min=a;
if(min>b)
min=b;
if(min>c)
min=c;
if(min>d)
min=d;
if(min>e)
min=e;

ans=n/min;
if(n%min>0)
ans++;

ans+=4;

  printf("%ld\n",ans);
     
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <map>

using namespace std;
using ll = long long int;


int main() {
  int n;
  cin >> n;
  map<int, int> memo;
  ll sum_a = 0;
  for(int i = 0; i < n; i++) {
    int a;
    cin >> a;
    memo[a]++;
    sum_a += a;
  }
  int q;
  cin >> q;
  vector<ll> result;
  for(int i = 0; i < q; i++) {
    int b, c;
    cin >> b >> c;
    int b_num = memo[b];
    sum_a -= (ll)(b_num) * b;
    sum_a += (ll)(b_num) * c;
    memo[b] = 0;
    memo[c] += b_num;
    result.push_back(sum_a);
  }
  for(auto sum: result) cout << sum << endl;
}

Measured memory_bytes: 8320
#include<bits/stdc++.h>
using namespace std;
char a[100];
set<char>se;
int main()
{
string s;
cin>>s;
int len=s.size();
for(int i=0;i<len;i++)
{
    a[i]=s[i];
    se.insert(s[i]);
}
sort(a,a+len);
if(a[0]==a[1]&&a[2]==a[3]&&se.size()==2)
    puts("Yes");
else
    puts("No");


    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

const int N = 100;

int main()
{
    int n, c_num, row, column;
    int adj[N][N] = {};
    cin >> n;

    for (int i = 0; i < n; i++)
    {
        cin >> row >> c_num;
        for (int j = 0; j < c_num; j++)
        {
            cin >> column;
            adj[row-1][column-1] = 1;
        }
    }

    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            if(j != 0) cout << " ";
            cout << adj[i][j];
        }
        cout << endl;
    }
}


Measured memory_bytes: 3132
#include <iostream>
#include <iomanip>
#include <algorithm>
using namespace std;
#include <cstdio>
#include <tuple>
#include <string>
#include <vector> 
#include <set>
#include <string.h>
#include <map>
#include <cmath>
#include <deque>
using ll = long long;
using Graph = vector<vector<int>>;
#include <queue>
#include <stack>
#include <bitset>
#include <stdlib.h>


//動的計画
//最小化問題
// template<class T>
// bool chmin(T& a,T b){if(a >  b) {a = b;return true;}return false;}
template<class T> 
bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const int MAX_INDEX = 100010;
ll dp[MAX_INDEX];
const ll INF = 1LL << 60;
int main(){
    
    int N;
    int K;
    cin >> N >> K;

    long long h[MAX_INDEX];
    for(int i=0;i < N;i++) cin >> h[i];

    //初期化
    for(int i = 0;i < MAX_INDEX;i++) dp[i] = INF;

    //初期条件
    dp[0] =  0;

    for(int i = 1;i< N;i++){
        //隣同士の移動を入れる
        chmin(dp[i],abs(h[i] - h[i - 1]) + dp[i - 1]);

        for(int k = 2;k <= K;k++){
            //k個目の点からiに移動した場合。最短なら更新
             if(i > k - 1) chmin(dp[i],abs(h[i] - h[i - k]) + dp[i - k]);

        }

        
    
    }

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

    return 0;

}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define speed_up ios_base::sync_with_stdio(false); cin.tie(NULL)
#define ll long long
#define ara(A,N) sort(A,A+N)
#define rev(A,N) sort(A,A+N,greater<long long>())
using namespace std;
int main()
{
speed_up;
int n, k, i, j;
cin>>n>>k;
vector<int> vec;
vector<int>:: iterator it;
i = k;
while(k--)
{
    int a;
    cin>>a;
    vec.push_back(a);
}
while(1)
{
    int num = n, digit, st = 0;
    while(num>0)
    {
        digit = num%10;
        it = find(vec.begin(), vec.end(), digit);
        if(it != vec.end())
        {
            st++;
            break;
        }
        num = num/10;

    }
    if(st == 0)
    {
        cout<<n<<endl;
        return 0;
    }

    n++;

}



return 0;
}


Measured memory_bytes: 3612
# -*- coding: utf-8 -*-


class UnionFind(object):

    def __init__(self, node_count: int):
        self.parent_numbers = [-1 for _ in range(node_count)]

    def find_root(self, node) -> int:
        if self.parent_numbers[node] < 0:
            return node

        self.parent_numbers[node] = self.find_root(self.parent_numbers[node])
        return self.parent_numbers[node]

    def get_group_size(self, node) -> int:
        return -self.parent_numbers[self.find_root(node)]

    def connect(self, node_a, node_b) -> bool:
        a = self.find_root(node_a)
        b = self.find_root(node_b)

        if a == b:
            return False

        if self.get_group_size(a) > self.get_group_size(b):
            self.parent_numbers[a] += self.parent_numbers[b]
            self.parent_numbers[b] = a
        else:
            # swap
            self.parent_numbers[b] += self.parent_numbers[a]
            self.parent_numbers[a] = b
        return True


def main():
    n, m = map(int, input().split())
    ab = [tuple(map(lambda x: int(x) - 1, input().split())) for _ in range(m)]
    ans = [0 for _ in range(m)]
    ans[-1] = n * (n - 1) // 2
    uf = UnionFind(n)

    for i in range(m - 1, 0, -1):
        ans[i - 1] = ans[i]
        ai = ab[i][0]
        bi = ab[i][1]

        if uf.find_root(ai) != uf.find_root(bi):
            ans[i - 1] -= uf.get_group_size(ai) * uf.get_group_size(bi)
            uf.connect(ai, bi)

    print('\n'.join(map(str, ans)))


if __name__ == '__main__':
    main()


Measured memory_bytes: 29536
X,Y=map(int,input().split())
MOD=10**9+7
def comb1(n,k):
    if n<k:
        return 0
    if n<0 or k<0:
        return 0
    k=min(n-k,k)
    ans=1
    inv=[1]*(k+1)
    if k>=1:
        ans*=(n-k+1)%MOD
    for i in range(2,k+1):
        inv[i]=MOD-inv[MOD%i]*(MOD//i)%MOD
        ans=ans*(n-k+i)*inv[i]%MOD
    return ans
if (X+Y)%3==0 and X*2>=Y and X<=Y*2:
    p,q=(2*Y-X)//3,(2*X-Y)//3
    print(comb1(p+q,p))
else:
    print(0)

Measured memory_bytes: 16156
#[allow(unused_macros)]
macro_rules! scan {
    () => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().to_string()
        }
    };
    (;;) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().split_whitespace().map(|s| s.to_string()).collect::<Vec<String>>()
        }
    };
    (;;$n:expr) => {
        {
            (0..$n).map(|_| scan!()).collect::<Vec<_>>()
        }
    };
    ($t:ty) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty;;) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.split_whitespace()
                .map(|t| t.parse::<$t>().unwrap())
                .collect::<Vec<_>>()
        }
    };
    ($t:ty;;$n:expr) => {
        (0..$n).map(|_| scan!($t;;)).collect::<Vec<_>>()
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
                    scan!($t)
        ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
                    scan!($($t),*)
        ).collect::<Vec<_>>()
    };
}

fn main() {
    let mut vs = scan!(i64;5);
    vs.sort_by_key(|v| if v % 10 == 0 { 10 } else { v % 10 });
    let mut ans = 0;
    for (i, &v) in vs.iter().rev().enumerate() {
        if i == vs.len() - 1 {
            ans += v;
        } else {
            ans += (v + 9) / 10 * 10;
        }
    }
    println!("{}", ans)
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
 
using namespace std;
 
#define lli long long int
#define REP(i,s,l) for(lli i=s;i<l;i++)
#define DEBUG 0
#define INF (1LL<<50)
#define MOD 1000000007

signed main(){

	lli n,x;
	cin>>n>>x;

	lli a[n],c[n];

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

	for(lli t=1;t<n;t++){
		lli cost = t*x;
		for(lli i=0;i<n;i++){
			c[i] = min(c[i],a[(i+n-t)%n]);
			cost += c[i];
		}
		ans = min(ans,cost);
	}
	cout<<ans<<endl;

	return 0;
}

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

#define ub              upper_bound
#define lb              lower_bound
#define isrt            insert
#define clr             clear
#define rsz             resize
#define ff              first
#define ss              second
#define lli             long long int
#define pb              push_back
#define pf              push_front
#define mkp              make_pair
#define pii             pair<lli,lli>
#define vi              vector<int>
#define mii             map<lli,lli>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define INF             1e9
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define all(v)          v.begin(),v.end()
#define endl            "\n"
const double PI = acos(-1);

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

lli maxm(lli a, lli b)
{
  return (a >= b ? a : b);
}


lli minm(lli a, lli b)
{
  return (a <= b ? a : b);
}

lli power(lli x, lli y, lli p)
{
  lli res = 1;

  x = x % p;
  if (x == 0)
    return 0;

  while (y > 0)
  {

    if (y & 1)
      res = (res * x) % p;


    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}

lli nCrmodp(lli n, lli r, lli p)
{
  if (r == 0)
    return 1;
  if (r == 1)
    return n;


  lli pro = 1, k = n;
  while (k > r)
  {
    pro *= k;
    pro %= p;
    --k;
  }

  k = 2;
  while (k <= (n - r))
  {
    pro *= power(k, (p - 2), p);
    pro %= p;
    ++k;
  }

  return pro;
}


lli first_big(lli n, lli k, vector<lli> arr)
{
  lli l, r, ans = n;
  l = 0;
  r = n - 1;

  while (l <= r) {
    lli m = l + (r - l) / 2;

    if (arr[m] > k) {
      ans = m;
      r = m - 1;
    }

    else
      l = m + 1;
  }

  return ans;
}

lli last_small(lli n, lli k, vector<lli> arr)
{
  lli l, r, ans = -1;
  l = 0;
  r = n - 1;

  while (l <= r)
  {
    lli mid = (l + r) / 2;

    if (arr[mid] <= k)
    {
      ans = mid;
      l = mid + 1;
    }
    else
      r = mid - 1;
  }

  return ans;
}

void c_p_c()
{
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif
}

int main()
{
  c_p_c();

  lli n;

  cin >> n;
  lli pro = 1;
  pro = power(10, n, mod);
  pro += power(8, n, mod);
  pro %= mod;

  pro -= 2 * power(9, n, mod);
  pro %= mod;
  pro = (pro + mod) % mod;


  cout << pro << endl;
  return 0;
}

Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
#define fi first
#define se second
#define pb push_back
#define forn(i,n) for(int i=0;i<(n);i++)
#define for1(i,n) for(int i=1;i<=n;i++)
#define forr(i,n) for(int i=n;i>=0;i--)
#define all(x) x.begin(), x.end()
const int MAXN = 1e5 +5;

void fio(){
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}

int main(){
  fio();
  int a,b,c; cin>>a>>b>>c;
  set<int> s ={a,b,c};
  if(s.size()==2) cout<<"Yes\n";
  else cout<<"No\n";
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
typedef struct {
	int id, score;
} team_t;

int cmp(const team_t *x, const team_t *y) {
	return y->score - x->score;
}
int main() {
	team_t team[9999];
	int n, id, i, rank, prevscore;
	for(n=0; scanf("%d,%d", &team[n].id, &team[n].score),team[n].id; n++);
	qsort(team, n, sizeof(team_t), cmp);
	while(~scanf("%d",&id)) {
		rank=0;
		prevscore=-1;
		for(i=0;i<n;i++) {
			if(team[i].score != prevscore)
				rank++;
			prevscore = team[i].score;
			if(team[i].id == id) {
				printf("%d\n", rank);
				break;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 0
#include<iostream>
#include<math.h>
using namespace std;

int main(){
	int n,num;
	int i,j,k;
	int prime_count=0;//素数の個数
	
	//行数
	cin>>n;

	for(i=0;i<n;i++){
		cin>>num;
		if(num==2 || num==3){
			prime_count+=1;
		}else{
			j=sqrt(num);
			for(k=2;k<=j;k++){
				if(num%k==0){
					break;
				}
			}
			if(k==j+1){
				prime_count+=1;
			}
		}
	}
	cout<<prime_count<<endl;
	return 0;
}


Measured memory_bytes: 3076
#include <bits/stdc++.h>
#define mod 1000000007
#define sp ' '
#define intmax 2147483647
#define llmax 9223372036854775807
#define nyan "(=^･ω･^=)"
#define mkp make_pair
#define lP pair<ll, ll>
#define iP pair<int,int>
typedef long long ll;
using namespace std;

int N, A[3000], a, b, memo[3000];
vector<int>v[3000];

bool f(int x) {
	if (memo[x] != -1)return memo[x];
	memo[x] = 0;
	for (int i : v[x]) {
		if (A[i] < A[x] && !f(i)) {
			memo[x] = 1;
		}
	}
	return memo[x];
}

int main() {
	cin >> N;
	for (int i = 0; i < N; ++i) {
		cin >> A[i];
		memo[i] = -1;
	}
	for (int i = 1; i < N; ++i) {
		cin >> a >> b;
		--a;
		--b;
		v[a].push_back(b);
		v[b].push_back(a);
	}
	for (int i = 0; i < N; ++i) {
		if (f(i)) {
			cout << i + 1 << endl;
		}
	}
}

Measured memory_bytes: 512
s=input()
t=input()
if len(s)<len(t):
  print("UNRESTORABLE")
  exit()
L=[]
for i in range(len(s)-len(t)+1):
  k=s[i:i+len(t)]
  flag=True
  for j in range(len(t)):
    if t[j]!=k[j] and k[j]!="?":
      flag=False
  if flag:
    u=s[:i]+t+s[i+len(t):]
    L.append(u.replace('?','a'))
if len(L)!=0:
  print(min(L))
else:
  print("UNRESTORABLE")

Measured memory_bytes: 38256
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;


int main()
{
	int N, K;
	cin >> N >> K;
	vector<int> h(N);
	for (int i = 0; i < N; i++)
	{
		cin >> h[i];
	}

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

	int mn = 1e9;

	for (int i = 0; i <= N - K; i++)
	{
		if (h[i + K - 1] - h[i] < mn) mn = h[i + K - 1] - h[i];
	}

	cout << mn << endl;

	return 0;
}

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

int main(){
    int n;
    cin >> n;
    bool flag = false;
    vector<int> v(n+1);
    for(int i=1; i<=n; i++) cin >> v[i];

    int ind = 1;
    int cnt = 0;
    for(int i=0; i<n; i++){
        ind = v[ind];
        cnt++;
        if(ind == 2){
            flag = true;
            break;
        }
    }
    if(flag) cout << cnt << endl;
    else cout << -1 << endl;
    return 0;
}

Measured memory_bytes: 640
#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<algorithm>

using namespace std;

#define int long long
#define endl "\n"

const long long INF = (long long)1e18;
const long long MOD = 1'000'000'007; 

string yn(bool f){return f?"Yes":"No";}
string YN(bool f){return f?"YES":"NO";}



signed main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);
	
	int A, B, C;
	int X, Y, Z;
	int ans = INF;
	
	cin>>A>>B>>C;
	cin>>X>>Y;
	
	Z = max(X,Y)*2;
	
	for(int i = 0; i <= Z; i++){
		int a = max(0ll, X - i/2);
		int b = max(0ll, Y - i/2);
		int cost = i * C;
		// cout<<"i = "<<i<<" "<<a<<" "<<b<<endl;
		// cout<<"cost = "<<cost<<endl;
		
		cost += a * A;
		cost += b * B;
		
		// cout<<"cost = "<<cost<<endl;
		// cout<<"cost = "<<cost<<endl;
		ans = min(ans, cost);
	}
	
	cout<<ans<<endl;
	
	
	return 0;
}

Measured memory_bytes: 256
int main(){
	int m;//ÔXy[X
	int n;//ÔÌ
	int T;//»Ý
	int C[10][2];//ÔµÄ¢éÔ¼Ô([][0]:ãiA[][1]:ºi)
	int c;//ÔµÄ¢éä
	int d;//üÉ®¹ä
	int O[10][2];//oÉ\è
	int t,s,s1,s2,od,f;
	for(;scanf("%d%d",&m,&n),m;){
		T=0;
		memset(C,0,sizeof(C));
		c=0;
		d=0;
		f=0;
		for(;d<n||c;T++){
			//printf("T=%d",T);
			//oÉ
			for(s=0;s<m;s++){
				if(C[s][1]){
					if(O[s][1]==T){//ºiÌoÉ
						//printf(" OUT[%d]",C[s][1]);
						if(f)
							putchar(' ');
						f=printf("%d",C[s][1]);
						C[s][1]=0;
						c--;
					}
				}
				if(C[s][0]&&T>=O[s][0]&&!C[s][1]){//ãiÌoÉ
					//printf(" OUT[%d]",C[s][0]);
					if(f)
						putchar(' ');
					f=printf("%d",C[s][0]);
					C[s][0]=0;
					c--;
				}
			}
			//üÉ
			while(T>=d*10&&d<n&&c<m*2){//üÉvLè&&ÔXy[XLè
				scanf("%d",&t);
				s1=s2=-1;
				for(s=0;s<m;s++){
					if(C[s][0]==0){//1äàÔ³êÄ¢È¢ÌÅ±±ÌãiÉè
						//printf(" IN[%d,(%d,%d),O=%d]",d+1,s,0,T+t);
						C[s][0]=++d;
						O[s][0]=T+t;
						c++;
						goto Done;
					}else if(C[s][1]==0){//ºiªó¢Ä¢éÌÅ¢·é
						od=O[s][0]-(T+t);//ãiÆÌoÉÌ·
						if(od>=0){//ãiÌoÉª©ªÈ~Å é
							if(s1==-1||od<O[s1][0]-(T+t)){//·ªêÔ¬³¢ÌÅ±±É¼è
								s1=s;
							}
						}else{//ãiÌoÉª©ªæè¢
							if(s2==-1||od>O[s2][0]-(T+t)){//·ªêÔ¬³¢ÌÅ±±É¼è
								s2=s;
							}
						}
					}
				}
				s=(s1!=-1)?s1:s2;//±±ÌºiÉè
				//printf(" IN[%d,(%d,%d),O=%d]",d+1,s,1,T+t);
				C[s][1]=++d;
				O[s][1]=T+t;
				c++;
	Done:;
			}
			//puts("");
		}
		puts("");
	}
	exit(0);
}

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

using namespace std;

char chara_plus(char c, int n){
  char rtn = '\0';
  if(n > 'Z' - c){
    n -= 'Z' - c;
    rtn = 'A' + (char)(n - 1);
  } else {
    rtn = c + (char) n;
  }
  return rtn;
}
    
int main(){
  string s;
  int n;
  cin >> n;
  cin.ignore();
  cin >> s;
  cin.ignore();
  //cout << s << endl;
  for(int i = 0; i < s.length() ; i++){
    s[i] = chara_plus(s[i], n);
  }
  cout << s << endl;
  return 0;
}
  


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

using namespace std;

int main(void) {
    string n;
    cin >> n;
    long length = n.size();
    long add = 0;
    for(int i = 0; i < length; i++){
        add += (long)(n.at(i) - '0');
    }
    if((long)add % 9 == 0){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 3708
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String input = sc.next();
		if(input.indexOf('a') != -1 && input.indexOf('b') != -1 && input.indexOf('c') != -1) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
 
using namespace std;
typedef long long ll;
 
int main() {
	int n; cin >> n;
	int data[] = {100, 101, 102, 103, 104, 105};
    vector<int> S;
	
	for (int bit = 0; bit < 64; ++bit) {
            int sum = 0;
            for (int i = 0; i < 6; ++i) {
                if (bit & (1<<i)) { // i が bit に入るかどうか
                	sum += data[i];
                }
            }
            S.push_back(sum);
    }
 
    S.push_back(302);
    S.push_back(301);
 	
 	for(int j = n; j >= 100; j-= 100){
    for(int i = 1; i < S.size(); i++){
    	if(j % S[i] == 0){
    		cout << "1" << endl;
    		return 0;
    	}
    }
	}
    cout << "0" << endl;
}

Measured memory_bytes: 256