akhauriyash/Code-Regression huggingface dataset:
#include <iostream> 
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mk make_pair
#define MAX 1000001
ll prime[MAX];
#define mod 1000000007

ll rec(vector<vector<ll> >& dp,vector<ll>& arr,int n,int i,int k,int w)
{
  ll ans=0;
  if(i>=n)
    return 0;

  if(dp[i][k]!=-1)
    return dp[i][k];


  if(k!=0)
  ans=max(rec(dp,arr,n,i+1,w,w),arr[i]+rec(dp,arr,n,i+1,k-1,w));
  else
  ans=max(rec(dp,arr,n,i+1,k,w),rec(dp,arr,n,i+1,w,w));

  return dp[i][k]=ans;

}

ll t[400008];
void build(vector<ll>& a, int v, int tl, int tr) {
    if (tl == tr) {
        t[v] = a[tl];
    } else {
        int tm = (tl + tr) / 2;
        build(a, v*2, tl, tm);
        build(a, v*2+1, tm+1, tr);
        t[v] = max(t[v*2] ,t[v*2+1]);
    }
}

ll maxi(int v, int tl, int tr, int l, int r) {
    if (l > r) 
        return 0;
    if (l == tl && r == tr) {
        return t[v];
    }
    int tm = (tl + tr) / 2;
    return max(maxi(v*2, tl, tm, l, min(r, tm)) ,maxi(v*2+1, tm+1, tr, max(l, tm+1), r));
}



void update(int v, int tl, int tr, int pos, ll new_val) {
    if (tl == tr) {
        t[v] = new_val;
    } else {
        int tm = (tl + tr) / 2;
        if (pos <= tm)
            update(v*2, tl, tm, pos, new_val);
        else
            update(v*2+1, tm+1, tr, pos, new_val);
        t[v] = max(t[v*2] ,t[v*2+1]);
    }
}

int main() { 

  int n,m;
  ll k;
cin>>n>>m>>k;
  ll a[n],b[m];


ll seqa[n+1]={0},seqb[m+1]={0};
  for(int i=0;i<n;i++)
    {cin>>a[i];
      seqa[i+1]=a[i]+seqa[i];
    }
  for(int j=0;j<m;j++)
    {cin>>b[j];
      seqb[j+1]=b[j]+seqb[j];
    }



ll ans=0;
int i=0,j=m;

while(i<=n&&j>=0)
{
  //cout<<seqa[i] + seqb[j]<<"\n";
  if(seqa[i] + seqb[j]<=k)
  {
    ll t=i+j;
    ans=max(ans,t);
    i++;
  }
  else
  {
    j--;
  }
}
cout<<ans;
return 0;
}


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

using namespace std;

int main(void) {
    long long H, W, N;
    cin >> H >> W >> N;
    int a[N], b[N];
    for (int i = 0; i < N; ++i) {
        cin >> a[i] >> b[i];
    }

    vector<pair<int, int>> rectangle;
    for (int i = 0; i < N; ++i) {
        for (int k = 0; k < 3; ++k) {
            for (int l = 0; l < 3; ++l) {
                if (1 <= a[i] - k && a[i] - k <= H - 2 && 1 <= b[i] - l && b[i] - l <= W - 2) {
                    pair<int, int> push;
                    push.first = a[i] - k, push.second = b[i] - l;
                    rectangle.push_back(push);
                }
            }
        }
    }

    sort(rectangle.begin(), rectangle.end());
//    for (int i = 0; i < rectangle.size(); ++i) {
//        cout << rectangle[i].first << " " << rectangle[i].second << endl;
//    }

    long long sum[10] = {};
    long long cnt = 1;
    for (int i = 0; i < rectangle.size(); ++i) {
        if (rectangle[i] == rectangle[i + 1]) {
//            cout << "same" << endl;
            cnt++;
        } else {
//            cout << "deff" << endl;
            sum[cnt]++;
            cnt = 1;
        }
    }

    long long sumzero = (H - 2) * (W - 2);
    for (int i = 1; i < 10; ++i) {
        sumzero -= sum[i];
    }

    cout << sumzero << endl;
    for (int i = 1; i < 10; ++i) {
        cout << sum[i] << endl;
    }
    return 0;
}

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

using namespace std;

#define pb push_back
#define mp make_pair
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
typedef long long LL;
typedef pair<int, int> PII;

const LL INF = LL(1e18);

int n;
int a[5000];
LL d[5000][2][5001];
LL e[2][5001];
int sz[5000];
vector<int> g[5000];

inline void upd(LL &x, LL y) {
    x = min(x, y);
}

void solve(int v, int par) {
    sz[v] = 1;
    if (a[v] > 0) {
        d[v][0][0] = a[v];
        d[v][1][0] = INF;
    } else {
        d[v][1][0] = a[v];
        d[v][0][0] = INF;
    }
    for (int to : g[v]) if (to != par) {
        solve(to, v);
        forn(i, sz[v] + sz[to]) {
            e[0][i] = INF;
            e[1][i] = INF;
        }
        forn(i, sz[v]) forn(j, sz[to]) {
            if (d[v][0][i] != INF && d[to][0][j] != INF) {
                upd(e[0][i + j], d[v][0][i] + d[to][0][j]);
                upd(e[0][i + j + 1], d[v][0][i]);
            }

            if (d[v][0][i] != INF && d[to][1][j] != INF) {
                upd(e[1][i + j], d[v][0][i] + d[to][1][j]);
                if (d[to][1][j] < 0) {
                    upd(e[0][i + j + 1], d[v][0][i]);
                }
            }

            if (d[v][1][i] != INF && d[to][0][j] != INF) {
                upd(e[1][i + j], d[v][1][i] + d[to][0][j]);
                upd(e[1][i + j + 1], d[v][1][i]);
            }

            if (d[v][1][i] != INF && d[to][1][j] != INF) {
                upd(e[1][i + j], d[v][1][i] + d[to][1][j]);
                if (d[to][1][j] < 0) {
                    upd(e[1][i + j + 1], d[v][1][i]);
                }
            }
        }
        sz[v] += sz[to];
        forn(i, 2) forn(j, sz[v]) {
            d[v][i][j] = e[i][j];
        }
    }
}

int main() {
//    freopen("input.txt", "r", stdin);
    scanf("%d", &n);
    forn(i, n) scanf("%d", a + i);
    forn(i, n - 1) {
        int from, to;
        scanf("%d%d", &from, &to), --from, --to;
        g[from].pb(to);
        g[to].pb(from);
    }
    solve(0, -1);
    int best = n - 1;
    forn(i, n) {
        if (d[0][0][i] != INF) {
            best = i;
            break;
        }
        if (d[0][1][i] < 0) {
            best = i;
            break;
        }
    }
    cout << best << endl;
    return 0;
}


Measured memory_bytes: 390272
#include <iostream>
	#include <string>
	using namespace std;
	
	int main() {
			
		string ans, s;
		cin >> ans;
		int a;
		
		int c = 0;
		for (int i = 0; s != "END_OF_TEXT"; i++) {
			if (s == "END_OF_TEXT") {
				break;
			}
			cin >> s;
			a = 0;
			
			for (int j = 0; j < s.size(); j++) {
				if ((ans.size()) != (s.size())) break;
				if ((s[j] == ans[j])||(s[j] == (ans[j]-32))) {
					a++;
					if (a > ans.size()) break;
					if (a == ans.size()) {
						c++;
					}
				}
			}
		}
		cout << c << endl;
			
		return 0;
	}


Measured memory_bytes: 3184
#include<bits/stdc++.h>
using namespace std;
     
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define int  long long
#define rep(i,a,b)    for(int i=a;i<b;i++)
#define repn(i,a,b)   for(int i=a;i>=b;i--)
#define F first
#define S second
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<pii>
#define pb push_back
#define mp  make_pair
#define all(v) (v).begin(), (v).end()
#define mod 1000000007  
#define mod2 998244353 
const int N = 100001; 


void solve(){
    int n,k;cin>>n>>k;
    int ans=0;
    vi a(n);
    rep(i,0,n)cin>>a[i];
    sort(all(a));
    rep(i,0,k)ans=ans+a[i];
    cout<<ans;
    return;
}
     
signed main(){
IOS;
    int t=1;
    // cin>>t;
    rep(i,0,t){
        solve();
        cout<<"\n";
    //   cout<<" * "<<t<<"\n";
    }
//    return 0;
}

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

int main(){
	int M, K;
	cin >> M >> K;
	int t = 1;
	for(int i=0; i<M; i++) t = t * 2;
	int a[2*t];
	if(M > 1){
		if(0 <= K && K < t){
			a[t-1] = K;
			int cnt = 0;
			for(int i=0; i<t; i++){
				if(i != K){
					a[cnt] = i;
					a[2*t-2-cnt] = i;
					cnt++;
				}
			}
			a[2*t-1] = K;
			for(int i=0; i<2*t; i++) cout << a[i] << " ";
		}else{
			cout << -1 << endl;
		}
	}else{
		if(M == 0){
			if(K == 0) cout << 0 << " " << 0 << endl;
			else cout << -1 << endl;
		}else{
			if(K == 0) cout << 0 << " " << 0 << " " << 1 << " " << 1 << endl;
			else cout << -1 << endl;
		}
	}
	return 0;
}


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

using namespace std;
using ll = long long;
using P = pair<int, int>;

const ll INF64 = 1LL << 60;
const int INF32 = 1 << 30;
const ll MOD = 1000000007;

ll dp[101010];

bool hasElement(const vector<int>& vec, int target){
    return binary_search(vec.begin(), vec.end(), target);
}

int main() {
#ifdef MYLOCAL
    ifstream in("input.txt");
    cin.rdbuf(in.rdbuf());
#endif

    int a, b; cin >> a >> b;

    int ans = 0;
    if(a >= 13){
        ans = b;
    }
    else if(a <= 5){
        ans = 0;
    }
    else{
        ans = b/2;
    }
    cout << ans << endl;

    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int MOD = (int)1e9 + 7;

int H, W, K;
int amidakuji[8][8];
ll dp[110][10];

//各棒の間を0(横棒なし)と1(横棒あり)で表現
bool isAmidakuji(int bit, int w) {
  for (int i = 0; i < w - 1; i++) {
    if (bit & (1 << i) && bit & (1 << (i + 1))) {
      return false;
    }
  }
  return true;
}

//各jについて，ある段から次の段の位置jへ行く方法の総数を求める
void make_amida() {
  for (int i = 0; i < W; i++) {
    for (int j = 0; j < W; j++) {
      amidakuji[i][j] = 0;
    }
  }
  for (int bit = 0; bit < (1 << (W - 1)); bit++) {
    if (!isAmidakuji(bit, W)) {
      continue;
    }
    bool check[8][8] = {false};
    for (int i = 0; i < W - 1; i++) {
      if (bit & (1 << i)) {
        amidakuji[i][i + 1]++;
        amidakuji[i + 1][i]++;
        check[i][i] = check[i + 1][i + 1] = true;
      }
    }
    for (int i = 0; i < W; i++) {
      if (!check[i][i]) {
        amidakuji[i][i]++;
      }
    }
  }
  return;
}

void solve() {
  for (int i = 0; i <= H; i++) {
    for (int j = 1; j <= W; j++) {
      dp[i][j] = 0;
    }
  }
  dp[0][0] = 1;
  make_amida();
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      ll tmp = 0;
      for (int k = 0; k < W; k++) {
        tmp += amidakuji[k][j] * dp[i][k];
      }
      dp[i + 1][j] = tmp;
      dp[i + 1][j] %= MOD;
    }
  }

  cout << dp[H][K - 1] % MOD << "\n";
  return;
}

int main() {
  cin >> H >> W >> K;
  solve();
  return 0;
}

Measured memory_bytes: 256
// #include {{{
#include <iostream>
#include <cassert>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <ctime>
#include <queue>
#include <set>
#include <map>
#include <stack>
#include <string>
#include <bitset>
#include <vector>
#include <complex>
#include <algorithm>
using namespace std;
// }}}
// #define {{{
typedef long long ll;
typedef double db;
typedef pair<int,int> pii;
typedef vector<int> vi;
#define de(x) cout << #x << "=" << x << endl
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define per(i,a,b) for(int i=(b)-1;i>=(a);--i)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define fi first
#define se second
// }}}

int n , K , a;

int main(){
  scanf("%d%d",&n,&K);
  map<int,int> times;
  rep(i,0,n) {
    scanf("%d",&a);
    times[a]++;
  }
  vi v;
  for(auto e : times) v.pb(e.se);
  sort(all(v));
  int del = max(0 , sz(v) - K);
  int ans = 0;
  rep(i,0,del) ans += v[i];
  printf("%d\n",ans);
  return 0;
}


Measured memory_bytes: 10748
def main():
    N = int(input())
    A = [int(_) for _ in input().split()]

    _accum = 0
    accum = []
    for a in A:
        _accum += a
        accum.append(_accum)
    
    upper = 0
    bottom = 2
    result = 10 ** 18
    for middle in range(1, N-2):
        while True:
            if upper == middle -1:
                break
            up = accum[upper]
            btm = accum[middle] - accum[upper]
            if abs(up - btm) > abs((up+A[upper+1])-(btm-A[upper+1])):
                upper += 1
            else:
                break
        while True:
            if bottom == N - 2:
                break
            up = accum[bottom] - accum[middle]
            btm = accum[N-1] - accum[bottom]
            if abs(up - btm) > abs((up + A[bottom+1]) - (btm-A[bottom+1])):
                bottom += 1
            else:
                break
        li = [accum[middle] - accum[upper], accum[bottom] - accum[middle], accum[upper], accum[N-1] - accum[bottom]]
        li = [abs(_) for _ in li]
        result = min(result, max(li)-min(li))
    print(result)


if __name__ == "__main__":
    main()

Measured memory_bytes: 90488
from itertools import accumulate
N,W = map(int,input().split())

w0,v0 = map(int,input().split())
W0,W1,W2,W3 = [],[],[],[]
W0.append(v0)
for i in range(1,N):
    w,v = map(int,input().split())
    if w == w0:
        W0.append(v)
    elif w == w0+1:
        W1.append(v)
    elif w == w0+2:
        W2.append(v)
    else:
        W3.append(v)

W0.sort(reverse=True)
W1.sort(reverse=True)
W2.sort(reverse=True)
W3.sort(reverse=True)
V0 = [0]+list(accumulate(W0))
V1 = [0]+list(accumulate(W1))
V2 = [0]+list(accumulate(W2))
V3 = [0]+list(accumulate(W3))

Ans = 0
for i0 in range(len(V0)):
    for i1 in range(len(V1)):
        for i2 in range(len(V2)):
            for i3 in range(len(V3)):
                if w0*i0 + (w0+1)*i1 + (w0+2)*i2 + (w0+3)*i3 <= W:
                    Ans = max(Ans,V0[i0]+V1[i1]+V2[i2]+V3[i3])

print(Ans)

Measured memory_bytes: 3064
n = int(input())
x = [list(map(int, input().split())) for _ in range(n)]
y = sorted(x)
z = sorted(x, key=lambda x: x[1])

if n % 2 == 1:
    print(z[n//2][1] - y[n//2][0] + 1)
else:
    a = y[n//2-1][0]
    b = y[n//2][0]
    c = z[n//2-1][1]
    d = z[n//2][1]
    e = (c + d) / 2
    f = (a + b) / 2
    print(int((e - f) * 2) + 1)

Measured memory_bytes: 115920
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <vector>
#include <algorithm>
#include <set>
using namespace std;

int main()
{
    string s;
    cin >> s;
    vector<bool> a(26,false);
    int i;
    for(i = 0;i < s.size();++i){
        if(a.at((int)s.at(i)-97)){
            cout << "no" << endl;
            return 0;
        }else{
            a.at((int)s.at(i)-97) = true;
        } 
    }
    cout << "yes" << endl;
    return 0;
}

Measured memory_bytes: 256
divider = "#" * 20
input = Hash.new(0)
gets.to_i.times do
  b, f, r, v = gets.split.map!(& :to_i)
  input["#{b} #{f} #{r}"] += v
end
1.upto(4) do |i|
  1.upto(3) do |j|
    1.upto(10) do |k|
      print " " + input["#{i} #{j} #{k}"].to_s 
    end
    puts
  end
  if (i != 4) then 
  	puts divider
  end 
end 

Measured memory_bytes: 8692
import java.util.*;
import java.io.*;
public class Main{
	static class node{
		int x,y,d;
		 node(int x1, int y1,int d1){x=x1;y=y1;d=d1;}
	}

public static long gcd(long a,long b){
	if(b==0){return a;}
	return gcd(b,a%b);
}

static int bfs(int[][] arr, int sx,int sy,int dx,int dy){
	int n=arr.length,m=arr[0].length;
	Queue<node> q=new LinkedList<>();
	boolean[][] b=new boolean[n][m];
	if(arr[sx][sy]!=0)q.add(new node(sx,sy,0));
	b[sx][sy]=true;
	while(!q.isEmpty()){
		node curr=q.poll();
		int x=curr.x,y=curr.y,d=curr.d;
		if(x==dx&&y==dy){return d;}
		if(y+1<m&&arr[x][y+1]!=0&&!b[x][y+1]){q.add(new node(x,y+1,d+1));b[x][y+1]=true;}
		if(y-1>=0&&arr[x][y-1]!=0&&!b[x][y-1]){q.add(new node(x,y-1,d+1));b[x][y-1]=true;}
		if(x+1<n&&arr[x+1][y]!=0&&!b[x+1][y]){q.add(new node(x+1,y,d+1));b[x+1][y]=true;}
		if(x-1>=0&&arr[x-1][y]!=0&&!b[x-1][y]){q.add(new node(x-1,y,d+1));b[x-1][y]=true;}
	}
	return -1;
}
public static void main(String[] args) throws FileNotFoundException, IOException{
       Scanner s=new Scanner(System.in);
       BufferedWriter out=new BufferedWriter(new OutputStreamWriter(System.out));
       int n=s.nextInt(),m=s.nextInt();
       s.nextLine();
       int[][] arr=new int[n][m];
       int[][][][] dp=new int[n][m][n][m];
       for(int i=0;i<n;i++){
       	String ss= s.nextLine();
       	for(int j=0;j<m;j++){
       		if(ss.charAt(j)=='.'){arr[i][j]=1;}
       	}
       }
       int res=0;
        for(int i=0;i<n;i++){
        	for(int j=0;j<m;j++){
        		for(int k=0;k<n;k++){
        			for(int l=0;l<m;l++){
        				if(dp[k][l][i][j]!=0){continue;}
        				dp[i][j][k][l]=bfs(arr,i,j,k,l);
        				res=Math.max(res,dp[i][j][k][l]);
        			}
        		}
        	}
        }
                out.write(res+" ");
        
        out.flush();
  }
}


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


#define rep(i, j) for(int i = 0; i < (int)(j); i++)
#define repeat(i, j, k) for(int i = (j); i < (int)(k); i++)
#define rrep(i, j) for(int i = (j); i >= 0; i--)
#define all(v) v.begin(), v.end()



//
// T : ????????????
// F : ?????????
// unit : f ?????????????????????
template<class T, class F, T unit>
class SegmentTree {
  public:
    int n;
    vector<T> data;
    F f;
    SegmentTree(int nn) : n(1) {
        while(n < nn) n *= 2;
        data.resize(2 * n - 1, unit);
    }
    //index k in [0, n) ????????? val ?????´??°
    void update(int k, T val) {
        assert(0 <= k and k < n);
        k += n - 1;
        data[k] = val;
        while(k > 0) {
            k = parent(k);
            data[k] = f(data[left_child(k)], data[right_child(k)]);
        }
    }
    // [a, b) 
    int query(int a, int b) {
        assert(0 <= a and a < b and b <= n);
        return query(a, b, 0, 0, n);
    }
  private:
    //[a, b) ????????¨???, now???????????´???, [l,r)?????????????????´???
    T query(int a, int b, int now, int l, int r){
        if( out_of_range(a, b, l, r) ) return unit;
        if( within_range(a, b, l, r) ) return data[now];
        else { // cross range
            T vleft = query(a, b, left_child(now), l, (l + r) / 2);
            T vright = query(a, b, right_child(now), (l + r) / 2, r);
            return f(vleft, vright);
        }
    }
    bool out_of_range(int a, int b, int l, int r) { return r <= a or b <= l; }
    bool within_range(int a, int b, int l, int r) { return a <= l and r <= b; }
    int left_child(int i) { return i * 2 + 1; }
    int right_child(int i) { return i * 2 + 2; }
    int parent(int i) { return (i - 1) / 2; }
};

// -----------------------------------------------------------------------

template <class T> struct Min {
    T operator() (const T& x, const T& y) const {return min(x, y);}
};
template <class T> struct Max {
    T operator() (const T& x, const T& y) const {return max(x, y);}
};


template<class T, T INF>
using RangeMinimumQuery = SegmentTree<T, Min<T>, INF>;

template<class T, T MINF>
using RangeMaximumQuery = SegmentTree<T, Max<T>, MINF>;

template<class T, T ZERO>
using RangeSumQuery = SegmentTree<T, plus<T>, ZERO>;



int main() {
    int n, q; cin >> n >> q;
    RangeMinimumQuery<long long, (1LL << 31) - 1> rmq(n);
    rep(i, q) {
        int com, x, y; cin >> com >> x >> y;
        if(com == 0) rmq.update(x, y);
        else cout << rmq.query(x, y + 1) << endl;
    }
    return 0;
}

Measured memory_bytes: 4864
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();

		long[] l=new long[87];

		for(int i=0;i<=n;i++){
			if(i==0){
				l[0]=2;
				continue;
			}
			if(i==1){
				l[1]=1;
				continue;
			}
			l[i]=l[i-1]+l[i-2];
		}

		System.out.println(l[n]);

	}

}


Measured memory_bytes: 21844
//
//  main.cpp
//  atcoder CODE FESTIVAL 2017 qual B problem A
//
//  Created by luras on 2017/10/8.
//  Copyright © 2017年 luras. All rights reserved.
//

#define ms(x, y) memset(x, y, sizeof(x))
#define mc(x, y) memcpy(x, y, sizeof(x))
#define lson o << 1, l, mid
#define rson o << 1 | 1, mid + 1, r
#define ls o << 1
#define rs o << 1 | 1
#include<stdio.h>
#include<string.h>
#include<math.h>
#include<queue>
#include<map>
#include<stack>
#include<vector>
#include<list>
#include<set>
#include<string>
#include<algorithm>
#pragma comment(linker,"/STACK:102400000,102400000")
template <class T> inline void gmax(T &a, T b){if(b > a) a = b;}
template <class T> inline void gmin(T &a, T b){if(b < a) a = b;}
using namespace std;
const int N = 1e5 + 10, M = 2e6 + 10, Z = 1e9 + 7, maxint = 2147483647, ms1 = 16843009, ms31 = 522133279, ms63 = 1061109567, ms127 = 2139062143;
const double PI = acos(-1.0), eps = 1e-8;
typedef long long LL;
void fre()
{
    freopen("/Users/luras/Desktop/in.txt", "r", stdin);
    freopen("/Users/luras/Desktop/out.txt", "w", stdout);
}
const int INF = 1e9;
int casenum, casei;


char s[100];

int main()
{
    while(~ scanf("%s", s)){
        int len = strlen(s);
        for(int i = 0; i < len - 8; i ++) printf("%c", s[i]); puts("");
    }
    return 0;
}

/*
 
 
 题意:
 
 类型:
 
 分析:
 
 优化:
 
 trick:
 
 数据:
 
 Sample Input
 
 Sample Output
 
 
 */






Measured memory_bytes: 128
#include <iostream>
#include <stdint.h>
#include <utility>
#include <limits.h>

using namespace std;

int32_t digits_sum(int32_t D)
{
  int32_t ans = 0;
  while (D > 0) {
    ans += D % 10;
    D /= 10;
  }
  return ans;
}

int main()
{
  int32_t N;

  cin >> N;

  int32_t A,B;

  int32_t min_sum = INT_MAX;

  for (A=1; A<N/2+1; ++A) {    
    B = N-A;
    min_sum = min(min_sum, digits_sum(A)+digits_sum(B));
  }
  
  cout << min_sum << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<utility>
#include<string>
#include<stack>
#include<queue>
#include<set>
#include<math.h>
#include <map>
using namespace std;
typedef long long int ll;
#define repi(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,a) repi(i,0,a)
#define all(u) u.begin(),u.end()
#define pl pair<ll,ll>
#define fi first
#define se second
#define mod 1000000007
#define mp(a,b) make_pair(a,b)
#define len(u,N) u.begin(),u.begin()+N

ll X,Y,Z,K;
vector<ll> A(3010);
vector<ll> B(3010);
vector<ll>C(3010);
vector<ll>AB(9000010);
vector<ll>ABC(9000010);

ll max(ll a, ll b){
    if (a > b) return a;
    else return b;
}

int main() {
    cin >> X >> Y >> Z >> K;
    rep(i,X) cin >> A[i];
    rep(i,Y) cin >> B[i];
    rep(i,Z) cin >> C[i];
    ll active = 0;
    rep(i,X){
        rep(j,Y){
            AB[active] = A[i]+B[j];
            active++;
        }
    }
    sort(len(AB,X*Y));
    reverse(len(AB,X*Y));
    active = 0;
    rep(i,K){
        rep(j,Z){
            ABC[active] = AB[i]+C[j];
            active++;
        }
    }
    sort(len(ABC,K*Z));
    reverse(len(ABC,K*Z));
    rep(i,K) cout << ABC[i] << endl;
   
    return 0;
    
    
}


Measured memory_bytes: 140928
#include<bits/stdc++.h>
using namespace std;
#define INF 1000000000
typedef long long ll;

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

    ll cost[N+K];
    for(int i=0; i<N+K; i++){
        cost[i] = INF;
    }
    cost[0] = 0;
    for(int i=0; i<N-1; i++){
        for(int j=1; j<=K; j++){
            cost[i+j] = min(cost[i+j], cost[i] + abs(h[i] - h[i+j]));
        }
    }
    cout << cost[N-1] << endl;
    return 0;
}

Measured memory_bytes: 1792
INF = 10 ** 100
h, n = gets.split.map(&:to_i)
damage_cost = []
n.times { damage_cost << gets.split.map(&:to_i) }
damage_cost.sort! { |a, b| a[0] <=> b[0] }
dp = Array.new(h + 1, INF)
1.upto(h) do |hp|
  damage_cost.each do |damage, cost|
    tmp_cost = hp <= damage ? cost : dp[hp - damage] + cost
    dp[hp] = tmp_cost if dp[hp] > tmp_cost
  end
end
puts dp.last


Measured memory_bytes: 1916
// Why I am so dumb? :c
#include <bits/stdc++.h>

#define pb push_back
#define mp make_pair

#define all(x) (x).begin(), (x).end()

#define fi first
#define se second

using namespace std;

typedef long long ll;

int n, ans;

int f(int x) {
    int ret = 0;

    while (x) {
        ret += (x % 10);
        x /= 10;
    }

    return ret;
}

void solve() {                   
    scanf("%d", &n);
    ans = 10000000;

    for (int a = 1; a < n; ++a) {
        ans = min(ans, f(a) + f(n - a));
    }

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

int main() {    
    int tt = 1;

    while (tt--) {
        solve();
    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int MAXN = 1e5 + 7;

int arr[MAXN];
int main()
{
    ios::sync_with_stdio(0);
    string s;
    cin>>s;
    int len = s.size();
    int r, l;
    memset(arr, 0, sizeof arr);
    for(int i = 0; i < len; i++)
    {
        l = 0, r = 0;
        if(s[i] == 'R')
        {
            r++;
            int x, y;
            for(int j = i+1; j < len; j++)
            {
                if(s[j] == 'R')
                    r++;
                else
                {
                    x = j;
                    break;
                }
            }
            for(int j = x; j < len; j++)
            {
                if(s[j] == 'L')
                    l++;
                if(s[j] == 'R' || j == len - 1)
                {
                    //cout<<r<<'\t'<<l<<endl;
                    arr[x] = arr[x-1] = (r+l)/2;
                    if(r>l && (r-l)%2 == 1)
                    {
                        if(l%2 == 1)
                            arr[x]++;
                        else arr[x-1]++;
                    }
                    else if(l>r && (l-r)%2 == 1)
                    {
                        if(r%2 == 1)
                            arr[x-1]++;
                        else arr[x]++;
                    }
                    y = j;
                    break;
                }
            }
            i = y-1;
            if(y == len - 1) i++;
        }
    }
    for(int i = 0; i < len; i++)
    {
        cout<<arr[i];
        if(i < len-1) cout<<' ';
        else cout<<endl;
    }

    return 0;
}


Measured memory_bytes: 1104
n, m = map(int, input().split())
alist = set([int(input()) for _ in range(m)])

MOD = pow(10, 9) + 7

if n == 1:
  if 1 in alist:
    print(0)
  else:
    print(1)
else:
  memo = [0 for _ in range(n)]
  memo[0] = 0 if 1 in alist else 1
  is_reach = True
  if 1 in alist and 2 in alist:
    is_reach = False
    memo[0] = 0
  elif 1 in alist:
    memo[1] = 1
  else:
    memo[1] = 2

  for i in range(2, n):
    if i+1 in alist:
      memo[i] = 0
    elif i in alist and i-1 in alist:
      memo[i] = 0
      is_reach = False
      break
    elif i in alist:
      memo[i] = memo[i-2]
    elif i-1 in alist:
      memo[i] = memo[i-1]
    else:
      memo[i] = (memo[i-1] + memo[i-2]) % MOD

  if is_reach:
    print(memo[-1])
  else:
    print(0)


Measured memory_bytes: 13216
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define countof(array) (sizeof(array) / sizeof(array[0]))
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = (n)-1; i >= 0; --i)
#define rep2(i,n) for(int i = 1; i <= (n); ++i)
#define rrep2(i,n) for(int i = (n); i > 0; --i)
#define srep(i,s,n) for(int i = s; i < (n); ++i)
#define rsrep(i,s,n) for(int i = (n)-1; i >= s; --i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define aall(a) (a), (a)+countof(a)//for array sorting
#define raall(a) (a), (a)+countof(a), greater<>()
#define show(x) cout<<#x<<" = "<<(x)<<endl;
#define vfind(v, a) find(all(v), a) != v.end()
#define yn(f) { if (f) puts("YES"); else puts("NO"); }
#define yns(f) { if (f) puts("Yes"); else puts("No"); }
#define show_ary(...) { cout<<#__VA_ARGS__<<" = "; for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define show_pair(...) cout<<#__VA_ARGS__<<" = "<<endl; for (const auto& x : (__VA_ARGS__)) { cout<<"  "<<x.fi<<" : "<<x.se<<endl; }
#define out_ary(...) { int n = (__VA_ARGS__).size(); rep(i, n) printf("%d%s", (__VA_ARGS__)[i], i != n-1 ? " " : "\n"); }
#define argmax(v) distance((v).begin(), max_element(all(v)))
#define argmin(v) distance((v).begin(), min_element(all(v)))
#define vmax(v) *max_element(all(v))
#define vmin(v) *min_element(all(v))
typedef long long int ll;
typedef pair<int, int> P;
typedef vector<P> vpair;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<string> vstr;
typedef vector<bool> vbool;
typedef vector<vint> vvint;
typedef vector<vll> vvll;
typedef vector<vstr> vvstr;
typedef vector<vbool> vvbool;
const ll LINF = 2000000000000000000ll;
const int INF = 1000000100;
const ll MOD = 1e9+7;


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

    int ans = k;
    srep(i, 1, n) ans *= k-1;

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

Measured memory_bytes: 256
#include<iostream>
int main(){
  int a,b,c,temp;
  std::cin >> a >> b >> c;
  if(a > b){
    temp = a;
    a = b;
    b = temp;
  }
  if(b > c){
    temp = b;
    b = c;
    c = temp;
  }
  if(a > b){
    temp = a;
    a = b;
    b = temp;
  }
  std::cout << a << " " << b << " " << c << std::endl;
}

Measured memory_bytes: 3128
#include<iostream>
#include<vector>
#include<queue>
using namespace std;

int main(){
    int n, m;
    cin >> n >> m;
    vector<int> v[n];
    while(m--){
        int a, b;
        cin >> a >> b;
        a--, b--;
        v[a].push_back(b);
        v[b].push_back(a);
    }
    vector<int> ret(n, -1);
    queue<int> q;
    q.push(0);
    while(!q.empty()){
        int x = q.front();  q.pop();
        for(int y : v[x]){
            if(ret[y]==-1){
                ret[y] = x;
                q.push(y);
            }
        }
    }
    cout << "Yes" << endl;
    for(int i = 1; i < n; i++)  cout << ret[i]+1 << endl;
    return 0;
}

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


#define _USE_MATH_DEFINES_
#define ll long long
#define ld long double
#define Accepted 0
#define pb push_back
#define mp make_pair
#define sz(x) (int)(x.size())
#define every(x) x.begin(),x.end()
#define F first
#define S second
#define For(i,x,y)  for (ll i = x; i <= y; i ++) 
#define FOr(i,x,y)  for (ll i = x; i >= y; i --)
#define SpeedForce ios_base::sync_with_stdio(0), cin.tie(0)
// ROAD to...                                                                                                                                                                                                                Red

using namespace std;

inline bool isvowel (char c) {
	c = tolower(c);
    if (c == 'a' || c == 'e' || c == 'i' || c == 'y' || c == 'o' || c == 'u') return 1;
    return 0;
}

const double eps = 0.000001;
const ld pi = acos(-1);
const int maxn = 1e7 + 9;
const int mod = 1e9 + 7;
const ll MOD = 1e18 + 9;
const ll INF = 1e18 + 123;
const int inf = 2e9 + 11;
const int mxn = 1e6 + 9;
const int N = 6e5 + 123;                                          
const int M = 22;
const int pri = 997;
const int Magic = 2101;

const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};
 
int n, m, k;
int sz[N];
ll ans;
vector < pair < int, int > > g[N];
vector < int > q;

void dfs (int v, int pr = 0) {
    sz[v] = 1;
    bool good = 1;
    for (auto to : g[v]) {
        if (pr == to.F) continue;
        dfs (to.F, v);
        sz[v] += sz[to.F];
        ans += 2ll * min(n - sz[to.F], sz[to.F]) * to.S;
        if (sz[to.F] > n / 2) good = 0;
    }
    if (n - sz[v] > n / 2) good = 0;
    //cout << v << ' ' << good << '\n'; 
    if (good) q.pb(v);
}

int main () {
    cin >> n;
    For (i, 2, n) {
        int l, r, c;
        cin >> l >> r >> c;
        g[l].pb(mp(r, c));
        g[r].pb(mp(l, c));
    }
    
    dfs (1);
    
    int mn = inf;
    for (auto to : g[q[0]]) {
        mn = min(mn, to.S);
        if (sz(q) > 1 && to.F == q[1]) ans -= to.S;
    }
    
    ans -= mn * (sz(q) == 1);
    cout << ans << '\n';
    
	return Accepted;
}

// Coded By OB

Measured memory_bytes: 26496
#include <bits/stdc++.h>
using namespace std;
int main()
{
  char s[4];
  cin >> s[0];
  cin >> s[1];
  cin >> s[2];
  cin >> s[3];
  if (s[0] == s[1]) {
    cout <<"Bad" << endl;
  } else if (s[1] == s[2]) {
    cout <<"Bad" << endl;
  } else if (s[2] == s[3]) {
    cout <<"Bad" << endl;
  } else {
    cout << "Good" << endl;
  }
}


Measured memory_bytes: 256
from math import factorial as fac
a, b = map(int, input().split())
if abs(a-b) > 1:
    print(0)
    exit()
af = fac(a)
bf = fac(b)
sosu = 10**9+7
if a==b:
    print((af*bf*2)%sosu)
else:
    print((af*bf)%sosu)

Measured memory_bytes: 5192
/**
 *  author: mahfuzz
 *  created: 30.04.2020
**/
 
#include <iostream>
#include <map>
using namespace std;
typedef long long ll;
#define trace(x) cout << #x << ':' << x << "\n"

int main(int argc, char* argv[]){
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    
    ll h, w; cin >> h >> w;
    if(h == 1 ||  w == 1){
        cout << "1\n";
        return 0;
    }
    
    ll x, y;
    x = (h + 1) / 2;
    y = h - x;
    
    
    cout << (((w + 1) / 2 ) * x) + ((w / 2 ) * y) << "\n";
    
    return 0;
}


Measured memory_bytes: 256
import Data.List

main :: IO ()
main = readLn >>= printRes . solve
    where
        printRes (b, xs)
            | b = putStrLn "Yes" >> (putStrLn . unlines . map (unwords . map show)) xs
            | otherwise = putStrLn "No"

solve :: Int -> (Bool, [[Int]])
solve n
    | b = (b, [k] : map ((k - 1) :) ss)
    | otherwise = (b, [])
    where
        (b, k) = check $ zip [2..] ns
        ns = scanl1 (+) [1..]
        
        check ((k, x) : xs)
            | x == n = (True, k)
            | n < x = (False, k)
            | otherwise = check xs

        ss = build 2 2 [[1], [1]]

        build len c acc
            | k < 3 = acc
            | len == k = acc
            | otherwise = build (len + 1) (c + len) $ add c acc
            where
                add c (x : xs) = (c : x) : add (c + 1) xs
                add c _ = [[(c - len)..(c - 1)]]

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

if A>=B and C>=D:
  print(B+D)
elif A<B and C>D:
  print(A+D)
elif A>B and C<D:
  print(B+C)
else:
  print(A+C)

Measured memory_bytes: 61800
#include<iostream>
using namespace std;
int main(void)
{
	int  a,b,c;
	cin >> a >> b >> c;
	int ans;
	ans=max(a*10+b + c , a+b*10+c);
	ans=max(ans,c*10+a+b);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long n = sc.nextLong();
		String str = "abcdefghijklmnopqrstuvwxyz";
		StringBuilder sb = new StringBuilder();
		int len = 1;
		for(int i=1; i<16; i++){
			if(Math.pow(26,i) < n){
				len++;
				n -= Math.pow(26,i);
				continue;
			}
			break;
		}
		n--;
		List<Integer> list = new ArrayList<>();
		do{
			long amari = n%26;
			n = n/26;
			list.add((int)amari);
		}
		while(n > 0);
		if(len>list.size()){
			int sa = len - list.size();
			for(int i = 0; i<sa; i++){
				list.add(0);
			}
		}
		for(int i=list.size()-1; i>=0; i--){
			sb.append(str.charAt(list.get(i)));
		}
		System.out.println(sb);
	}
}


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

#define forn(i, n) for (int i = 0; i < int(n); ++i)
#define for1(i, n) for (int i = 1; i <= int(n); ++i)
#define ms(a, x) memset(a, x, sizeof(a))
#define F first
#define S second
#define all(x) (x).begin(),(x).end()

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 0x3f3f3f3f;
mt19937 gen(chrono::steady_clock::now().time_since_epoch().count());
template<typename... Args> void rd(Args&... args) {((cin >> args), ...);}
template<typename... Args> void write(Args... args) { ((cout << args << " "), ...); cout<<endl;}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n,k;
    cin>>n>>k;
    int cnt[n+1]={};
    forn(i,k){
        int d;
        cin>>d;
        while(d--){
            int x;
            cin>>x;
            cnt[x]++;
        }
    }
    int ans=0;
    for1(i,n) ans+=cnt[i]==0;
    cout<<ans;
    return 0;
}



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

#define rep(i,n)  for(int i=0;i<n;++i)
#define per(i,n)  for(int i=n-1;i>=0;--i)
#define sc1(a)  scanf("%d",&a)
#define sc2(a,b)  scanf("%d %d",&a,&b)
#define sc3(a,b,c)  scanf("%d %d %d",&a,&b,&c)
#define sl1(a)  scanf("%lld",&a)
#define sl2(a,b)  scanf("%lld %lld",&a,&b)
#define sl3(a,b,c)  scanf("%lld %lld %lld",&a,&b,&c)
#define PI 3.1415926535897932

int lcm(int a,int b) { return a*b/__gcd(a,b); }
//long long lcm(ll a,ll b) { return a*b/__gcd(a,b); }

/**
 * sort(ar.begin(),ar.end())
 * int sum=accumulate(ar.begin(),ar.end(),0);
 **/


int main(){
    long long n,ans=0ll;
    sl1(n);
    for (long long  i=1;i<=n;i++) {
        for (long long j=i;j<=n;j++) {
            if (n-(i*j)>0) {
                ans++;
                if (i!=j) ans++;
            }else{
                break;
            }
        }
    }
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 3840
#include "bits/stdc++.h"

#define REP(i,n) for(ll i=0;i<ll(n);++i)
#define RREP(i,n) for(ll i=ll(n)-1;i>=0;--i)
#define FOR(i,m,n) for(ll i=m;i<ll(n);++i)
#define RFOR(i,m,n) for(ll i=ll(n)-1;i>=ll(m);--i)
#define ALL(v) (v).begin(),(v).end()
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());
#define INF 1000000001ll
#define MOD 1000000007ll
#define EPS 1e-9

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


using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

int gcd(int a, int b) {
	if (b == 0)return a;
	return gcd(b, a%b);
}
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n, x;
	cin >> n >> x;
	int v = -1;
	REP(i, n) {
		int a;
		cin >> a;
		if (v == -1)v = abs(x - a);
		else v = gcd(v, abs(x - a));
	}
	cout << v << endl;
}


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

using namespace std;

int main(int argc,char* argv[]){
	int N,X,L,count=0,D=0;
	bool flag = true;
	cin >> N >> X;
	for(int i=0;i<N;i++){
		if(D<=X) count++;
		else flag = false;
		cin >> L;
		if(flag) D+=L; 
	}
	if(D<=X) count++;
	cout << count << endl;
	return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);

    int age = sc.nextInt();
    int price = sc.nextInt();

    int pay = 0;

    if (age >= 13) {
      pay = price;
    } else if (age >= 6 && age <= 12) {
      pay = price / 2;
    } else if (age <= 6) {
      pay = 0;
    }

    System.out.println(pay);
  }
}


Measured memory_bytes: 23124
/*
ID: dorijan1
TASK: tu napisi ime zadatka molim te molim te ali samo ako si na usaco training
LANG: C++11
*/
#include <bits/stdc++.h>

using namespace std;

const int MOD=1000000007;
typedef long long int ll;
const ll LLINF=1ll<<60;

ll sti(string a)
{
	ll k=0;
	for (int i=0;i<a.size();++i)
	{
		k*=10;
		k+=a[i]-'0';
	}
	return k;
}

string its(ll k)
{
	string a;
	while (k)
	{
		a.push_back((k%10)+'0');
		k/=10;
	}
	reverse(a.begin(),a.end());
	return a;
}

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

template<class T,class K>
pair<T,K> mp(T a,K b)
{
	return make_pair(a,b);
}

ll mult(ll a,ll b)
{
	return (a*b)%MOD;
}

ll pot(ll n,ll k)
{
	if (k==0) return 1;
	ll a=pot(n,k/2);
	a=mult(a,a);
	if (k%2) return mult(a,n);
	else return a;
}

ll divide(ll a,ll b)
{
	return mult(a,pot(b,MOD-2));
}

ll sub(ll a,ll b)
{
	return (a-b+MOD)%MOD;
}

ll add(ll a,ll b)
{
	return (a+b)%MOD;
}

bool prime(ll a)
{
	if (a==1) return 0;
	for (int i=2;i<=round(sqrt(a));++i)
	{
		if (a%i==0) return 0;
	}
	return 1;
}

int n,m;
ll h[100001],sol;
vector<int> ch[100001];
vector<ll> tr[100001];
vector<pair<ll,ll> > st;
vector<ll> nepr;
int trn;
bool bio[100001];

void dfs(int i)
{
	if (bio[i]) return;
	tr[trn].push_back(h[i]);
	bio[i]=1;
	for (int d: ch[i])
	{
		if (!bio[d]) dfs(d);
	}
}

int main()
{
	std::ios_base::sync_with_stdio(false);
	cin>>n>>m;
	for (int i=0;i<n;++i) cin>>h[i];
	for (int i=0;i<m;++i)
	{
		int a,b;
		cin>>a>>b;
		ch[a].push_back(b);
		ch[b].push_back(a);
	}
	for (int i=0;i<n;++i)
	{
		if (!bio[i])
		{
			dfs(i);
			++trn;
		}
	}
	//cout<<"DFS gotov."<<endl;
	for (int i=0;i<trn;++i)
	{
		sort(tr[i].begin(),tr[i].end());
		if (tr[i].size()>1) st.push_back({tr[i][1],tr[i][0]});
		else st.push_back({LLINF,tr[i][0]});
		for (int j=1;j<tr[i].size();++j) nepr.push_back(tr[i][j]);
	}
	sort(nepr.begin(),nepr.end());
	sort(st.begin(),st.end());
	if (st.size()>=2)
	{
		//for (int i=0;i<st.size();++i) cout<<st[i].second<<' '<<st[i].first<<endl;
		for (int i=0;i<st.size();++i) sol+=st[i].second;
		for (int i=0;i<st.size()-2;++i)
		{
			if (i>=nepr.size())
			{
				cout<<"Impossible"<<endl;
				return 0;
			}
			sol+=nepr[i];
		}
	}
	cout<<sol<<endl;
}



Measured memory_bytes: 11512
#include <stdio.h>

int main() {
  int a, b, c;
  scanf("%d %d %d", &a, &b, &c);
  if ( (a == b && b != c && a != c) || (a != b && b != c && a == c) || (a != b && b == c && a != c) ) puts("Yes");
  else puts("No");
  return 0;
}


Measured memory_bytes: 1644
def gcd(a, b):
    if b==0:    return a
    return gcd(b, a%b)



n=int(input())
A=list(map(int, input().split()))

ans=gcd(A[0], A[1])

for i in range(2, n):
    ans=gcd(ans, A[i])

print(ans)

Measured memory_bytes: 14252
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
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; }
#define all(x) (x).begin(),(x).end()
#define pll pair<ll,ll>
#define pii pair<int,int>
#define rep(i,n) for(int i=0;i<n;i++)
#define For(i,a,b) for(int i=a;i<b;i++)
#define sz(x) ((ll)(x).size())
#define pb push_back
#define mp make_pair
#define bit(n) (1LL<<(n))
#define F first
#define S second
#define debug(x) cerr << x << endl
#define Complex complex<double>
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
const ll INF = 1LL<<60;
const ll mod = (int)1e9 + 7;

int main() {
    string s;
    cin >> s;
    int k;
    cin >> k;
  	k--;
    int n=s.length();
    set<string> vec;
    rep(i,n){
        rep(j,5){
            if(i+j>=n)break;
            string t="";
            rep(h,j+1){
                t.pb(s[i+h]);
            }
            vec.insert(t);
        }
    }
    vector<string> v;
    for(auto t:vec)v.pb(t);
    sort(all(v));
    cout << v[k];
}

Measured memory_bytes: 1920
N=int(input())
L=list(map(int,input().split()))
tmp=0
for i in range(N):
	if i==0:
		continue
	if L[i]<L[i-1]:
		if L[i]<L[i-1]-1 or L[i-1]-1<tmp:
			print("No")
			exit()
		else:
			L[i-1]=L[i-1]-1
			tmp=L[i-1]

else:
	print("Yes")

Measured memory_bytes: 63856
a = list(map(int, input().split()))
th = a[0]
ta = a[1]
ah = a[2]
aa = a[3]

while 1 == 1:
    ah = ah - ta
    if ah <= 0:
        print('Yes')
        break
    th = th - aa
    if th <= 0:
        print('No')
        break

Measured memory_bytes: 9176
# Efficient python 3 program to find sum 
# pair products in an array. 
mod=1000000007
# required function 
def findProductSum(A, n): 
	
	# calculating array sum (a1 + a2 ... + an) 
	array_sum = 0
	for i in range(0, n, 1): 
		array_sum = array_sum + A[i] 

	# calcualting square of array sum 
	# (a1 + a2 + ... + an)^2 
	array_sum_square = array_sum * array_sum 

	# calcualting a1^2 + a2^2 + ... + an^2 
	individual_square_sum = 0
	for i in range(0, n, 1): 
		individual_square_sum += A[i] * A[i] 

	# required sum is (array_sum_square - 
	# individual_square_sum) / 2 
	return (array_sum_square -
			individual_square_sum) // 2

# Driver code 
if __name__ == '__main__': 
    n=int(input())
    a=input().split()
    for i in range(n):
        a[i]=int(a[i])
    ans=int(findProductSum(a,n))
    ans%=mod
    print(ans)

Measured memory_bytes: 96792
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <string>
#include <sstream>
#include <numeric>
#define rep(i, j) for(int i = 0; i < j; i++)
#define all(i) i.begin(), i.end()
using namespace std;
vector<bool> era(1000010, true);
void makePrimeTable(int n)
{
	era[0] = false; era[1] = false;
	for (int i = 2; i <= n; i++)
	{
		if (era[i]) { for (int j = i * 2; j <= n; j += i) { era[j] = 0; } }
	}
}
int main()
{
	makePrimeTable(200000);
	int N, P; while (cin >> N >> P && N != -1)
	{
		vector<int> dat(0);
		vector<int> prm(0);
		while (1)
		{
			N++;
			if (era[N]) { prm.push_back(N);}
			if (prm.size() == P) { break; }
		}
		for (int i = 0; i < P; i++) for (int j = i; j < P; j++) { dat.push_back(prm[i] + prm[j]); }
		sort(all(dat)); 
		printf("%d\n", dat[P - 1]);
	}
	return 0;
}

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

int n, m, s;
char c;
pair<int, char> cond[5];

int main()
{
    ios_base::sync_with_stdio(false);
    cin >> n >> m;
    for (int i = 0; i < m; i++)
    {
        cin >> s >> c;
        cond[i] = make_pair(s, c);
    }

    for (int i = 0; i < 1000; i++)
    {
        string number = to_string(i);
        if (number.size() == n)
        {
            bool flag = false;
            for (int k = 0; k < m; k++)
            {
                if (number[cond[k].first - 1] != cond[k].second)
                {
                    flag = true;
                }
            }
            if (flag)
            {
                continue;
            }
            cout << number;
            return 0;
        }
    }

    cout << -1;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

// 一行の文字列を読み込む
func nextLine() string {
	sc.Scan()
	return sc.Text()
}

// 数値（INT）を読み込む
func nextInt() int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i
}

func main() {
	sc.Split(bufio.ScanWords)
	n, k := nextInt(), nextInt()
	var h [100000]int
	for i := 0; i < n; i++ {
		h[i] = nextInt()
	}

	cnt := 0
	for i := 0; i < n; i++ {
		if h[i] >= k {
			cnt++
		}
	}
	fmt.Println(cnt)
}


Measured memory_bytes: 1792
#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 int long long

signed main(){
    int n, k;
    cin >> n >> k;
    cout << to_string(n % k != 0) << endl;
}

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

using namespace std;

int main()
{
	int A = 0, B = 0, C = 0, K = 0;
	cin >> A >> B >> C >> K;
	int result;
	if (K <= A)
		result = K;
	else if (K <= A + B)
		result = A;
	else
		result = A - (K - A - B);
	cout << result;
	return 0;
}

Measured memory_bytes: 3584
#include <bits/stdc++.h>
#define f first
#define s second
#define int long long
#define inf 1e18
using namespace std;
int n,ans=0;
int32_t main(){
	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);
	ios::sync_with_stdio(0),cin.tie(0);
	cin >> n;
	pair <int,int> v[n];
	map <int,int> m;
	for(int i=0;i<n;i++){
		cin >> v[i].f >> v[i].s;
		v[i].f+=v[i].s;
		v[i].s=v[i].f-2*v[i].s;
	}
	sort(v,v+n);
	m[-inf]=0;
	for(int i=0;i<n;i++){
		auto it=m.upper_bound(v[i].s);
		it--;
		m[v[i].f]=max(it->s+1,ans);
		ans=max(ans,m[v[i].f]);
	}
	cout << ans;
}


Measured memory_bytes: 8064
N = int(input())
L = list(map(int, input().split()))

count = 0
for i in range(N):
  for j in range(i + 1, N):
    for k in range(j + 1, N):
      if ((L[i] == L[j]) or (L[i] == L[k]) or (L[j] == L[k])):
        continue
      # a+b>c && b+c>a && c+a>b
      if (((L[i] + L[j]) > L[k])
          and ((L[j] + L[k]) > L[i])
          and ((L[k] + L[i]) > L[j])):
        #print(str(L[i]) + '  ' + str(L[j]) + '  ' + str(L[k]))
        count += 1

print(count)


Measured memory_bytes: 9192
#include <iostream>
#include <string>
#include <vector>
#include <cstring>
#include <climits>
#include <algorithm>
#include <map>

using namespace std;

const int INF = 1e9 + 1;
int n, a[100000], dp[100000];

int main() {
    cin >> n;
    for (int i=0; i<n; ++i) cin >> a[i];
    
    for (int i=0; i<n; ++i) dp[i] = INF;
    
    int res = 1;
    for (int i=0; i<n; ++i) {
        int k = lower_bound(dp, dp+n, a[i]) - dp;
        dp[k] = a[i];
        res = max(res, k+1);
    }

    cout << res << endl;
    
    return 0;
}

Measured memory_bytes: 3892
x,y=map(int,input().split())

mod=10**9+7
def C(n, r ,mod=10**9+7):
    if n-r<r: r=n-r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k]) %mod

    return result % mod

a=(-x+2*y)/3
b=(2*x-y)/3
if a<0 or b<0 : print(0) ; exit()
if a%1!=0 or b%1!=0:
    print(0) 
    exit()
a=int(a) ; b=int(b)
print(C(a+b,a))

Measured memory_bytes: 102156
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
 
using namespace std;
 
#define PB push_back
#define MP make_pair
#define REP(i,n) for(int i=0;i<(n);i++)
long long rec(long long a){
    if(a==1)return 1;
    return rec(a/2LL)*2LL+1;
}
int main()
{
    long long h;
    cin>>h;
    cout<<rec(h)<<endl;
}


Measured memory_bytes: 256