akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"

using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
	REP(i, v.size()) { if (i)os << " "; os << v[i]; }return os;
}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
	REP(i, v.size()) { if (i)os << endl; os << v[i]; }return os;
}

const ll V = 100000;
const ll INF = 1LL << 60;
using P = pair<ll, ll>;
vector<P> G[V];	//pair<辺の距離, 行き先の頂点>
ll dist[V]; //dist[i]はsから頂点iへの最短距離が入る
bool used[V];
void dijkstra(ll s) {	//s : 始点
	//初期化
	fill_n(dist, V, INF);
	fill_n(used, V, false);

	priority_queue<P, vector<P>, greater<P>> q;
	q.push(P(0, s));
	while (!q.empty()) {
		ll d;	//d : sからの距離
		ll t;	//t ; 行き先
		tie(d, t) = q.top();
		q.pop();
		if (used[t]) {	//もう探索済みか
			continue;
		}
		used[t] = true;
		dist[t] = d;
		for (P e : G[t]) {
			if (dist[e.second] <= d + e.first) {	//枝刈り
				continue;
			}
			q.push(P(d + e.first, e.second));
		}
	}
}

int main() {
	ll n;

	cin >> n;

	REP(i, n - 1) {
		ll a, b, c;
		cin >> a >> b >> c;
		G[a - 1].push_back(make_pair(c, b - 1));
		G[b - 1].push_back(make_pair(c, a - 1));
	}

	ll q, k;

	cin >> q >> k;

	dijkstra(k - 1);

	REP(i, q) {
		ll x, y;
		cin >> x >> y;
		cout << dist[x - 1] + dist[y - 1] << endl;
	}
}

Measured memory_bytes: 11248
#include<iostream>
#include<vector>
#include<queue>
using namespace std;
int N,M;
vector<int>G[1000];
int cnt[1000];
main()
{
	cin>>N>>M;
	for(int i=0;i<M;i++)
	{
		int u,v;cin>>u>>v;u--,v--;
		G[u].push_back(v);
		cnt[v]++;
	}
	queue<int>P;
	for(int i=0;i<N;i++)
	{
		if(cnt[i]==0)P.push(i);
	}
	int sz=0;
	while(!P.empty())
	{
		sz++;
		int u=P.front();P.pop();
		for(int v:G[u])
		{
			if(--cnt[v]==0)P.push(v);
		}
	}
	cout<<-(sz==N)<<endl;
}

Measured memory_bytes: 3668
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
using namespace std;
typedef long long ll;
const double PI = acos(-1.0);
 
int main()
{
  int n;
  cin >> n;
  vector<int> d(n+1);
  d[0] = -1;
  for(int i = 1; i <= n; i++) {
   cin >> d[i]; 
  }
  sort(d.begin(), d.end());
  cout << d[n/2+1] - d[n/2] << endl;
  return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <tuple>
#include <stack>
#include <bitset>
#include <utility>
#include<iomanip>
// #include <numeric>
using namespace std;



typedef unsigned long ul;
typedef unsigned long long ull;
typedef long long ll;
typedef vector<ll> vint;
typedef vector<vector<ll>> vvint;
typedef vector<string> vstring;
typedef vector<vector<string>> vvstring;
typedef vector<char> vchar;
typedef vector<vector<char>> vvchar;
typedef vector<long double> vdouble;
typedef vector<vector<long double>> vvdouble;
typedef vector<vector<vector<long double>>> vvvdouble;
typedef pair<ll,ll> pint;
typedef vector<pint> vpint;

#define rep(i,n) for(ll i=0;i<n;i++)
#define repf(i,f,n) for(ll i=f;i<n;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define INT_MAX 2147483647
#define LLONG_MAX 9223372036854775807
#define vmax(vec) *max_element(vec.begin(), vec.end())
#define vmin(vec) *min_element(vec.begin(), vec.end())
#define vsort(vec) sort(vec.begin(), vec.end())
#define vsortgr(vec) sort(vec.begin(), vec.end(), greater<ll>())
#define DIVIDER 1000000007


//
// struct Node{
//   vint children;
//   ll index;
//   ll prop;
// };
// struct edge{ll to; ll cost;};



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

// ll X,Y,Z,K;
// ll pmax = 30000000000;
// vint A,B,C;




// int binary_search(int key){
//  //isOKを満たす要素のうち最小のインデックスを返す。（要ソート）
//   int left = -1;
//   int right = N;
//
//   while(right - left > 1){
//     int mid = left + (right - left)/2;
//
//     if(isOK(mid, key)) right=mid;
//     else left=mid;
//   }
//
//   return right;
// }

// ll gcd(ll m, ll n){
//   if(m<n) swap(m,n);
//   if(n==0) return m;
//   return gcd(n, m%n);
// }

// ll get_pow(ll x, ll y){
//   ll ret=0;
//   ll temp = y;
//   while(true){
//     if(x<=temp) break;
//     ret++;
//     temp *= 2;
//   }
//   return ret;
// }






int main() {
  cout<<fixed<<setprecision(10);

  ll N,A,B,C,D;cin>>N>>A>>B>>C>>D;
  A--;B--;C--;D--;
  string S;cin>>S;

  // vvint dp(N, vint(N,0));
  vint space(N+1,0);
  vint rock(N+1,0);
  rep(i,N){
    if(S[i]=='.'){
      space[i+1]=space[i]+1;
      rock[i+1]=0;
    }else{
      space[i+1]=0;
      rock[i+1]=rock[i]+1;
    }
  }

  // queue<pint> q;
  // q.push(mp(A,B));
  // dp[A][B] = 1;
  bool flag = true;

  if(C<D){
    flag = *max_element(rock.begin()+A+1, rock.begin()+C+2)<=1 && *max_element(rock.begin()+B+1, rock.begin()+D+2)<=1;
  }else{//D<C
    flag = flag && *max_element(rock.begin()+A+1, rock.begin()+C+2)<=1 && *max_element(rock.begin()+B+1, rock.begin()+D+2)<=1;
    space[B]--;space[B+1]--;
    flag = flag && *max_element(space.begin()+B,space.begin()+D+3)>=3;

  }



  string ans;
  if(flag) ans="Yes";
  else ans="No";



  cout << ans << endl;

}

















//


Measured memory_bytes: 3588
#include <stdio.h>
#include <ctype.h>

int main(void){

    char s;

    while(1){
        scanf("%c",&s);
        if(islower(s)){
            printf("%c",toupper(s));
        }else if(isupper(s)){
            printf("%c",tolower(s));
        }else{
            printf("%c",s);
        }
        if(s=='\n'){
            break;
        }
    }
}


Measured memory_bytes: 2148
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int ans = 0;

        if (a <= b) {
            ans = a;
        } else {
            ans = a - 1;
        }

        System.out.println(ans);
        sc.close();
    }    
}


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

int main()
{

        int N, M;
        cin >> N >> M;

        int wa_num[N];
        int Status[N];
        for (int i = 0; i < N; ++i) {
                Status[i] = 0;
                wa_num[i] = 0;
        }
        string str;
        int num;
        int fail = 0;
        int ok = 0;
        for (int i = 0; i < M; ++i) {
                cin >> num >> str;
                if (Status[num-1] != 1) {
                        if (str == "AC") {
                                Status[num-1] = 1;
                                ok++;
                                fail += wa_num[num-1];
                        }
                        else {
                                wa_num[num-1]++;
                        }
                }
        }
        cout << ok << " " << fail << endl;









}


Measured memory_bytes: 1024
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;typedef vector<ll> vll;
#define fill(a) memset(a, 0, sizeof (a))
#define all(v) (v).begin(),(v).end()
#define sp(k) cout<<setprecision(k)<<fixed;
#define rep(i,a) for(int i=0; i<a;i++)
#define rep1(i,a,b) for(int i=(a);i<=(b);++i)
#define irep(i,b,a) for(int i=(b);i>=(a);--i)
#define minv(v) *min_element(v.begin(),v.end())
#define maxv(v) *max_element(v.begin(),v.end())
#define each(it,s) for(auto it = s.begin(); it != s.end(); ++it)
#define unq(v) sort(all(v)),(v).erase(unique((v).begin(),(v).end()),(v).end())
#define getpos(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define _ios ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define ff first
#define ss second
#define pb push_back
#define sz(x) (int)x.size()

const double pi = acos(-1.0);
const int mod = 1000000007; // (int)1e9+7
const int maxn = 2000100;

int main(){
        _ios;

        int n;
        cin>>n;
        if(n%2)n++;
        cout<<n/2<<endl;




return 0;
}







Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ld = long double;
using P = pair<int, int>;

int N;
P A[500000];

bool comp(P a, P b) {
	return a.second < b.second;
}

ld closest_pair(P *a, int n) {
	if (n <= 1) return 100000000;
	int m = n / 2;
	ld x = a[m].first;
	ld d = min(closest_pair(a, m), closest_pair(a + m, n - m));
	inplace_merge(a, a + m, a + n, comp);
	vector<P> b;
	for (int i = 0; i < n; i++) {
		if (fabs(a[i].first - x) >= d) continue;
		for (int j = 0; j < (int)b.size(); j++) {
			ld dx = a[i].first - b[b.size() - j - 1].first;
			ld dy = a[i].second - b[b.size() - j - 1].second;
			if (dy >= d) break;
			d = min(d, sqrtl(dx * dx + dy * dy));
		}
		b.push_back(a[i]);
	}
	return d;
}

int main()
{
	cin.sync_with_stdio(false);
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> A[i].first >> A[i].second;
	}
	sort(A, A + N);
	ld dis = closest_pair(A, N);
	cout << (int)roundl(dis * dis) << endl;
	return 0;
}

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

int Y[3], X[3], C[3][3];

int main() {
    for (int i = 0; i < 3; i++) {
        for (int j = 0; j < 3; j++) scanf("%d", &C[i][j]);
    }
    bool flg = true;
    Y[0] = 0;
    for (int i = 0; i < 3; i++) X[i] = C[0][i];
    for (int i = 0; i < 3; i++) Y[i] = C[i][0] - X[0];
    for (int i = 0; i < 3; i++) {
        for (int j = 0; j < 3; j++) {
            if (Y[i] + X[j] != C[i][j]) flg = false;
        }
    }
    if (flg) printf("Yes\n");
    else printf("No\n");
    return 0;
}

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

int main(){
	int64_t n,sum=0;
    cin>>n;
    vector<int> p(100001,0);
    for(int i=0;i<n;i++){
    	int a;
        cin>>a;
        p[a]++;
        sum+=a;
    }
    int q;
    cin>>q;
    for(int i=0;i<q;i++){
    	int b,c;
        cin>>b>>c;
        sum=sum+(c-b)*p[b];
        p[c]+=p[b];
        p[b]=0;
        cout<<sum<<endl;
    }
}


Measured memory_bytes: 3680
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{

    static int max = 0;
    static void Main(string[] args)
    {
        //入力
        var n = crI();
        List<List<int[]>> inputList = new List<List<int[]>>();
        for(int i = 0; i < n; i++)
        {
            inputList.Add(mapInt(crI()));
        }
        

        for (int bit = 0; bit < (1 << n); bit++)
        {
            bool ans = true;
            var human = new (int k, int l)[n + 1];
            var count = 0;
            var ind = 0;
            for (int i = 0; i < n; i++)
            {
                if ((bit & (1 << i)) == 0)
                {
                    human[ind + 1].k = 1;
                    checkGo(1, human , inputList[ind]);
                    count++;
                }
                else
                {
                    human[ind + 1].l = 1;
                    //checkGo(0, human , inputList[ind]);
                }
                ind++;
            }
            foreach (var ele in human) if (ele.k == 1 && ele.l == 1) ans = false ;
            if (ans)
            {
                max = Math.Max(max, count);
            }
        }
        Console.WriteLine(max);
    }

   
    static void checkGo(int a , (int k , int l)[] human , List<int[]> input)
    {
        foreach(int[] ele in input)
        {
            var x = ele[0];
            var y = ele[1];
            if (a + y == 1) human[x].l = 1;
            else human[x].k = 1;
        }
    }



        //入力受け取り用
    static string crS() { return Console.ReadLine(); }
    static int crI() { return int.Parse(Console.ReadLine()); }
    static int[] arrInt(){return Console.ReadLine().Split(' ').Select(v => int.Parse(v)).ToArray();}
    static long[] arrLong(){ return Console.ReadLine().Split(' ').Select(v => long.Parse(v)).ToArray(); }
    static string[] arrStr(){return Console.ReadLine().Split(' ').ToArray();}
    static List<int[]> mapInt(int h)
    {
        List<int[]> mapInt = new List<int[]>();
        for (int i = 0; i < h; i++)
        {
            mapInt.Add(arrInt());
        }
        return mapInt;
    }
}

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

int main() {

    int n, m;
    cin >> n >> m;
    vector<vector<int>> v(m);
    rep(i, m){
        int k;
        cin >> k;
        rep(j, k){
            int s;
            cin >> s;
            v[i].push_back(s);
        }
    }
    vector<int> p(m);
    rep(i, m){
        cin >> p[i];
    }

    int ans = 0;
    for(int bit = 0; bit < (1<<n); bit++){
        bool ok = true;
        rep(i, m){
            int cnt = 0;
            for(auto a : v[i]){
                if(bit & (1<<(a-1))){
                    cnt++;
                }
            }
            if(cnt%2 != p[i]){
                ok = false;
                break;
            }
        }
        if(ok)
            ans++;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<ll> vi;
typedef vector<vi> vvi;
#define INF (1e9)

int D = 365;
vi c, ans;
vvi s;

void input() {
  cin >> D;
  c = vi(26);
  s = vvi(D, vi(26));
  for (int i = 0; i < 26; i++) {
    cin >> c[i];
  }
  for (int i = 0; i < D; i++) {
    for (int j = 0; j < 26; j++) {
      cin >> s[i][j];
    }
  }
}

void output() {
  for (int i = 0; i < D; i++) {
    cout << ans[i] + 1 << endl;
  }
}

int simulate(vi a) {
  int sum = 0;
  vi last(26, 0);
  for (int i = 0; i < D; i++) {
    sum += s[i][a[i]];
    last[a[i]] = i + 1;
    for (int j = 0; j < 26; j++) {
      sum -= c[j] * (i - last[j] + 1);
    }
  }
  return (int)1e6 + sum;
  // return max((int)1e6 + sum, 0);
}

void solve() {
  int best = simulate(ans);

  // 周期
  for (int i = 0; i < 26; i++) {
    vi a(D);
    for (int j = 0; j < D; j++) {
      a[j] = (i + j) % 26;
    }

    int x = simulate(a);
    if (x > best) {
      best = x;
      ans = a;
    }
  }

  //
  srand((unsigned)time(NULL));
  int loop = 10;
  while (loop--) {
    vi a = ans;

    int change = D / 3;
    while (change--) {
      a[rand() % D] = rand() % 26;
    }

    for (int i = 0; i < D; i++) {
      vi b = a;
      int idx = 0, bst = simulate(b);
      for (int j = 0; j < 26; j++) {
        b[i] = j;
        int x = simulate(b);
        if (x > bst) {
          bst = x;
          idx = j;
        }
      }
      a[i] = idx;
    }
    int x = simulate(a);
    if (x > best) {
      best = x;
      ans = a;
    }
  }
}

int main() {
  input();
  ans = vi(D, 0);
  solve();
  output();
}


Measured memory_bytes: 3716
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define all(x) x.begin(),x.end()
#define dbg(x) cout<<#x<<":"<<x<<endl
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<ll,P> PP;

int main(){
  ll n,a[111111];
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  sort(a,a+n);
  ll sum=a[0];
  ll cnt=0;
  for(int i=1;i<n;i++){
    if(sum*2<a[i])cnt=i;
    sum+=a[i];
  }
  cout<<n-cnt<<endl;
  return 0;
}


Measured memory_bytes: 1024
L, R = [int(x) for x in input().split()]
MOD = 2019
if (R - L > 2017):
    print(0)
    exit()
L %= MOD
R %= MOD
if (L * R == 0 or R < L):
    print(0)
    exit()
elif (R-L == 1):
    print(L*R % MOD)
    exit()
i = L
ans = L*R % MOD
while(i != R):
    j = i+1
    while (j != R+1):
        if (ans > (i*j % MOD)):
            ans = i*j % MOD
        j += 1
    i += 1
print(ans)    


Measured memory_bytes: 40684
#include <cstdio>

long a[300010], s[64][300010][2];
int main()
{
    int n; scanf("%d", &n);
    for(int i=0; i<n; ++i) {
        scanf("%ld", a+i);
        for(int j=0; j<61; ++j) {
            int k=(a[i]>>j)&1;
            if (k==0) {
                s[j][i+1][0]=s[j][i][0]+1;
                s[j][i+1][1]=s[j][i][1];
            }
            else {
                s[j][i+1][0]=s[j][i][0];
                s[j][i+1][1]=s[j][i][1]+1;
            }
        }
    }

    const long mod=1e9+7;
    long res=0;
    for(int i=0; i<n; ++i) {
        for(int j=0; j<61; ++j) {
            int x=(a[i]>>j)&1;
            long t=s[j][n][!x]-s[j][i][!x];
            (t*=(1L<<j)%mod)%=mod;
            res+=t;
            if (res>=mod) res-=mod;
        }
    }
    printf("%ld\n", res);
}


Measured memory_bytes: 290176
#include<iostream>
#include<algorithm>
#include<math.h>
#include<cmath>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(n);i++)
typedef long long ll;
ll GCD(ll a, ll b) {
	if (b == 0)return a;
	return GCD(b, a%b);
}
ll LCM(ll a, ll b) {
	return a / GCD(a, b)*b;
}
ll c[51][51];
void comb(int n) {
	rep(i, 51) {
		rep(j, i + 1) {
			if (j == 0 || j == i)c[i][j] = 1;
			else c[i][j] = c[i - 1][j - 1] + c[i - 1][j];
		}
	}
}
ll n, a, b, v[50], cnt = 0, k = 0, s = 0, ans = 0;
int main() {
	cin >> n >> a >> b;
	rep(i, n)cin >> v[i];
	sort(v, v + n);
	reverse(v, v + n);
	rep(i, n)if (v[i] == v[a - 1])k++;
	rep(i, a)if (v[a - 1] == v[i])s++;
	rep(i, a)cnt += v[i];
	printf("%.12lf\n", 1.0*cnt / a);
	comb(n);
	if (v[0] == v[a - 1]) {
		for (int i = a; i <= min(b, k); i++)ans += c[k][i];
		cout << ans << endl;
	}
	else cout << c[k][s] << endl;
	return 0;
}


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

#define int long long
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<n;++i)
#define exrep(i, a, b) for(ll i = a; i < b; i++)
#define out(x) cout << x << endl
#define EPS (1e-7)
#define gearup ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<bool> > vvb;
typedef vector<vector<double> > vvd;
typedef vector<vector<string> > vvs;
typedef vector<ll> vl;
typedef vector<vector<ll> > vvl;
typedef vector<vector<vector<ll> > > vvvl;
ll MOD = 1000000007;
const long long L_INF = 1LL << 60;
const int INF = 2147483647; // 2^31-1
const double PI = acos(-1);
//cout<<fixed<<setprecision(10);

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template<class T> void debug(T v){rep(i,v.size()) cout<<v[i]<<" ";cout<<endl;}
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};
//以降 cin の入力元が 'input.txt' になる
//std::ifstream in("input.txt");
//std::cin.rdbuf(in.rdbuf());

signed main()
{   
    gearup;
    ll n; cin >> n;
    out( (1000 - n % 1000) % 1000);
}

Measured memory_bytes: 3616
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧  
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     
　　　　／　　　＼　 　 |　|     
　　　 /　　 /￣￣￣￣/　　|  
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿  
　 　　　＼/＿＿＿＿/　（u　⊃  
---------------------------------------------------------------------------------------------------*/





int N, P[5010];
int dp[5010][4];
//---------------------------------------------------------------------------------------------------
void _main() {
    cin >> N;
    rep(i, 0, N) cin >> P[i];

    rep(idx, 0, 5010) rep(last, 0, 4) dp[idx][last] = inf;
    rep(last, 0, P[0] + 1) dp[0][last] = P[0] - last;

    rep(idx, 0, N - 1) rep(last, 0, 4) {
        rep(last2, 0, P[idx + 1] + 1) {
            int d = P[idx + 1] - last2;
            if (d < last) continue;

            chmin(dp[idx + 1][last2], dp[idx][last] + d * 2);
        }
    }

    int ans = inf;
    rep(last, 0, 4) chmin(ans, dp[N - 1][last] + last);
    cout << ans << endl;
}


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

#define ull unsigned long long
#define ul unsigned long
#define ll long long
#define size_t long long
// sort(&a[0], &a[4], [](auto& x, auto& y){return x[0] < y[0];});
//accumulate(&arr2[n], &arr2[m-1], 0);
using namespace std;

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

  double W,H,x,y; std::cin >> W >> H >> x >> y;
  std::cout << W*H/2 << " "<< (x==W/2 && y==H/2) << '\n';
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fo(i, k, n) for (int i = k; i <= n; ++ i)
#define fod(i, k, n) for (int i = k; i >= n; -- i)
template <typename T, typename U>
static inline void maxx (T &x, U y) {
  if (x < y) {
    x = y;
  }
}
template <typename T, typename U>
static inline void minn (T &x, U y) {
  if (x > y) {
    x = y;
  }
}
template<typename T>
void read (T &x) {
  x = 0;
  T neg = 1;
  register T c = getchar ();
  if (c == '-') {
    neg = -1;
  }
  while (c < 48 || c > 57) {
    c = getchar ();
  }
  for (; c < 48 || c > 57; c = getchar ());
  for (; c <= 57 && c >= 48; c = getchar ()) {
    x = (x << 3) + (x << 1) + (c & 15);
  }
  x *= neg;
}
template<typename T>
void write (T x) {
  bool neg = 0;
  if (x < 0) {
    x *= -1;
    neg = 1;
  }
  char snum[65];
  int i = 0;
  do {
    snum[++ i] = x % 10 + '0';
    x /= 10;
  }
  while (x);
  //-- i;
  if (neg) {
    putchar ('-');
  }
  while (i > 0) {
    putchar (snum[i --]);
  }
}
///declare
int n, a[21], b[21], c[21], res = 0;
int main () {
  if (fopen ("test.inp", "r")) {
    freopen ("test.inp", "r", stdin);
  }
//  else {
//    freopen(".inp", "r", stdin);
//    freopen(".out", "w", stdout);
//  }
  ios_base :: sync_with_stdio (0);
  cin.tie (nullptr);
  cout.tie (nullptr);
  read (n);
  fo (i, 1, n) {
    read (a[i]);
  }
  fo (i, 1, n) {
    read (b[i]);
  }
  fo (i, 2, n) {
    read (c[i]);
  }
  fo (i, 1, n) {
    res += b[a[i]];
    if (i >= 2) {
      if (a[i] - a[i - 1] == 1) {
        res += c[a[i]];
      }
    }
  }
  cout << res;
}


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

Measured memory_bytes: 256
#include <stdio.h>

void selectionSort(int* , int );
  
int main(){

  int i,j,k,N,A[100];

  scanf("%d",&N);
  for(i=0;i<N;i++) scanf("%d",&A[i]);

  selectionSort(A, N);
  
   

  return 0;
}

void selectionSort(int *A, int N){
  int i,j,k=0,minj=0,tmp;

  for(i=0;i<N;i++){
    minj=i;
    for(j=i+1;j<N;j++){
      if (A[j] < A[minj]){
	minj = j;
      }
    }
	tmp=A[i];
	A[i]=A[minj];
	A[minj]=tmp;
	if(i!=minj)k++;
  }
  

  for(j=0;j<N-1;j++) printf("%d ",A[j]);
    printf("%d\n",A[N-1]);
    printf("%d\n",k);
}



Measured memory_bytes: 2048
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
ll draw[1000006]={0};
ll dp[1000006];
void update(ll node,ll start,ll end,ll idx,ll val)
{
	if(start==end)
	{
		dp[idx]=val;
		draw[node]=max(draw[node],val);
	}
	else
	{
		ll mid=(start+end)/2;
		if(start <= idx and idx <= mid)
            update(2*node, start, mid, idx, val);
        else
            update(2*node+1, mid+1, end, idx, val);
        draw[node] = max(draw[2*node],draw[2*node+1]);
	}
}
ll query(ll node, ll start, ll end, ll l, ll r)
{
    if(r < start or end < l)
   		return 0;
    if(l <= start and end <= r)
        return draw[node];
    ll mid = (start + end) / 2;
    ll p1 = query(2*node, start, mid, l, r);
    ll p2 = query(2*node+1, mid+1, end, l, r);
    return max(p1,p2);
}
int main()
{
	ll n,i;
	cin>>n;
	ll h[n];
	ll b[n];
	for(i=0; i<n; i++)
		cin>>h[i];
	for(i=0; i<n; i++)
		cin>>b[i];
	for(i=0; i<n; i++)
	{
		ll x=b[i]+query(1,0,n-1,0,h[i]-1);
		update(1,0,n-1,h[i],x);
	}
	ll ans=0;
	for(i=0; i<n; i++)
		ans=max(ans,dp[h[i]]);
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 11136
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); ++i)
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Pl = pair<long long,long long>;
using veci = vector<int>;
using vecl = vector<long long>;
using vecveci = vector<vector<int>>;
using vecvecl = vector<vector<long long>>;
const int MOD = 1000000007;
const double pi = acos(-1);

ll disit_sum(ll N) {
    ll ans = 0;
    while(N > 0) {
        ans += N%10;
        N /= 10;
    }
    return ans;
}

int main() {
    ll N; cin >> N;
    int cnt = 0;
    while(N > 0) {
        cnt += (N%10 == 2);
        N /= 10;
    }
    cout << cnt << endl;
}

Measured memory_bytes: 3452
def main():
    ans = 0
    n,m = map(int,input().split())
    s = []
    for i in range(m):
        tmp = [int(i) for i in input().split()]
        s.append(tmp)
    p = [int(i) for i in input().split()]
    for i in range(2**n):
        light = [0 for k in range(m)]
        for j in range(n):
            if (i>>j)&1 == 1:
                for x in range(m):
                    if j+1 in s[x][1:s[x][0]+1]:
                        light[x] += 1
        Flag = True
        for x in range(m):
            """
            if light[x]==0:
                Flag = False
                """
            if light[x]%2!=p[x]:
                Flag = False
        if Flag:
            ans += 1

    print(ans)

main()

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

#define rep(i, n) for (int i = 0; i < n; ++i)
#define all(x) (x).begin(),(x).end()
#define endl "\n"

using ll = long long;
using P = pair<int,int>;
using mp =  map<string,int>;

const int MOD = 1e9 + 7;

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

    int x, y, a, b, c;
    cin >> x >> y >> a >> b >> c;
  
    vector<int> A(a), B(b), C(c);
    rep(i, a) cin >> A[i];
    rep(i, b) cin >> B[i];
    rep(i, c) cin >> C[i];
    sort(all(A), greater<int>());
    sort(all(B), greater<int>()); 
    //sort(all(C), greater<int>());
  
    A.erase(A.begin() + x, A.end());
    B.erase(B.begin() + y, B.end());
  
    C.insert(C.end(), all(A));
    C.insert(C.end(), all(B));  
    
    sort(all(C), greater<int>());
  
    ll ans = 0;
    rep(i, x+y){
      ans += C[i];
     //cout << C[i]<< endl;
    }
  
    cout << ans << endl;
  
    return 0;
}

Measured memory_bytes: 2936
#include <bits/stdc++.h>
using namespace std;
int main(){
  int x;
  cin>>x;
  string s;
  cin>>s;
  if(s.substr(0,x/2)==s.substr(x/2,s.size()))
      cout<<"Yes";
  else 
      cout<<"No";
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <queue>
#include <cstring>
#include <vector>
#include <map>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <bitset>
#include <set>
#include <stack>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define all(i,n) (i),(i+n)

int dx4[4]={1,0,-1,0};
int dy4[4]={0,-1,0,1};
int dx8[8]={1,0,-1,1,-1,1,0,-1};
int dy8[8]={1,1,1,0,0,-1,-1,-1};
int dx9[9]={0,1,0,-1,1,-1,1,0,-1};
int dy9[9]={0,1,1,1,0,0,-1,-1,-1};

typedef pair<int, int> P;
typedef pair<string, int> SP;
typedef long long ll;
typedef pair<ll, ll> PLL;

const int INF = 1e9;
const ll LLINF = 1e18;
const int MAX_V = 1e6+1;
const ll mod = 1000000007;
// << fixed << setprecision
// --------------------------------------
int n;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  cin >> n;
  int ans = 0;
  REP(i, n) {
    int a;
    cin >> a;
    if((i + 1) % 2 == 1 && a % 2 == 1) ans++;
  }

  cout << ans << endl;
}


Measured memory_bytes: 3608
n = gets.chomp.to_i
a = gets.chomp.split(" ").map(&:to_i)

hash = Hash.new(0)

a.each do |e|
  hash[e] += 1
end

ans = 0

hash.each do |k, v|
  if v > k
    ans += v - k
  elsif v < k
    ans += v
  end
end

puts ans


Measured memory_bytes: 15492
/*COMPETITIVE PROGRAMMING C++ TEMPLATE */
 
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <string>
#include <cmath>
#include <iostream>
#include <stack>
#include <queue>
#include <climits>
#include <iomanip>
 
#define all(x) x.begin(), x.end()
#define MOD 1000000007
 
const long double PI = 3.141592653589793236L;
 
typedef long long int ll;
typedef long double ld;
 
using namespace std;
 
void solve()
{
    ll N;
    cin >> N;

    ll n = 1000000000000000000L;
    vector<ll> a(N);

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


    for(int i = 0; i < N; i++)
    {
        if(a[i] == 0)
        {
            cout << "0\n";
            return;
        }
    }
    
    ll product = 1;

    for(int i = 0; i < N; i++)
    {
        if(product > (n / a[i]))
        {
            cout << "-1\n";
            return;
        }
        product *= a[i];
    }

    cout << product << endl;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
 
    int T = 1;
    //cin >> T;
    
    while (T--)
    {
        solve();
    }
    
    return 0;
}


Measured memory_bytes: 3916
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)n; i++)
#define all(x) (x).begin(),(x).end()
typedef long long int ll;
using namespace std;
int main()
{
  int n;
  cin >> n;
  
  double ans = 0;
  double x;
  string u;
  REP(i, n){
    cin >> x >> u;
    if(u == "JPY"){
      ans += x;
    }else{
      ans += x*380000;
    }
  }
  cout <<setprecision(20)<< ans << endl;

}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		// ソート
		int maxv = a;
		int midv = b;
		int minv = c;
		int tmp;
		if (maxv < midv) {
			tmp = midv;
			midv = maxv;
			maxv = tmp;

		}
		if (midv < minv) {
			tmp = midv;
			midv = minv;
			minv = tmp;
		}
		if (maxv < midv) {
			tmp = midv;
			midv = maxv;
			maxv = tmp;
		}
		// 計測
		int cnt = 0;
		while (midv < maxv) {
			midv++;
			minv++;
			cnt++;
		}
		while(minv<midv) {
			minv+=2;
			cnt++;
		}
		if(minv>maxv) {
			maxv++;
			midv++;
			cnt++;
		}
		System.out.println(cnt);
	}
}


Measured memory_bytes: 23764
#include<bits/stdc++.h>
using namespace std;
int main(){
  string a,b,c;
  cin >> a >> b >> c;
  transform(a.begin(),a.end(),a.begin(),::toupper);
  transform(b.begin(),b.end(),b.begin(),::toupper);
  transform(c.begin(),c.end(),c.begin(),::toupper);
  cout << a[0] << b[0] << c[0] << endl;
  return 0;
}


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

int main()
{
    ios::sync_with_stdio(false);
 
    string s;
    cin >> s;

    long long all = 0, now = 0;

    for (char c: s)
        if (c == 'B') now++;
        else all += now;
    cout << all << endl;
}


Measured memory_bytes: 720
#include<iostream>

using namespace std;
using ll = long long;

int gcd(int a,int b,int c){
    int x = min (a,min(b,c)),ans;
    for(int i=x;i>0;i--){
        if(a%i == 0 && b%i == 0 && c%i == 0){
            ans = i;
          break;
        }
    }
    return ans;
}

int main(){
    ll k,ans=0;
    cin >> k;
    k++;

    for(int i = 1; i<k;i++){
        for(int j=1;j<k;j++){
            for(int l=1;l<k;l++){
                ans += gcd(i,j,l);
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
typedef pair<double,int>Q;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
int main(){
	int a,b;cin>>a>>b;cout<<2*b-a<<endl;
}

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

int main(){
  string a,b,c;
  cin >> a >> b >> c;
  int dif = 'A'-'a';
  cout << char(a.at(0) + dif) << char(b.at(0) + dif) << char(c.at(0) + dif) << endl;
}

Measured memory_bytes: 256
module.exports=function(r){var t={};function e(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return r[n].call(o.exports,o,o.exports,e),o.l=!0,o.exports}return e.m=r,e.c=t,e.d=function(r,t,n){e.o(r,t)||Object.defineProperty(r,t,{enumerable:!0,get:n})},e.r=function(r){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(r,"__esModule",{value:!0})},e.t=function(r,t){if(1&t&&(r=e(r)),8&t)return r;if(4&t&&"object"==typeof r&&r&&r.__esModule)return r;var n=Object.create(null);if(e.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:r}),2&t&&"string"!=typeof r)for(var o in r)e.d(n,o,function(t){return r[t]}.bind(null,o));return n},e.n=function(r){var t=r&&r.__esModule?function(){return r.default}:function(){return r};return e.d(t,"a",t),t},e.o=function(r,t){return Object.prototype.hasOwnProperty.call(r,t)},e.p="",e(e.s=0)}([function(r,t,e){e(1)(e(3).readFileSync("/dev/stdin","UTF-8").split("\n"))},function(r,t,e){"use strict";function n(r,t){return function(r){if(Array.isArray(r))return r}(r)||function(r,t){var e=[],n=!0,o=!1,u=void 0;try{for(var i,f=r[Symbol.iterator]();!(n=(i=f.next()).done)&&(e.push(i.value),!t||e.length!==t);n=!0);}catch(r){o=!0,u=r}finally{try{n||null==f.return||f.return()}finally{if(o)throw u}}return e}(r,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var o=e(2);r.exports=function(r){var t=n(r[0].split(" ").map(function(r){return Number(r)}),2),e=t[0],u=t[1],i=o(e),f=o(u),a=new Map;for(var l in i)a[l]=1;var c=0;for(var s in f)1==a[s]&&c++;console.log(c+1)}},function(r,t,e){"use strict";r.exports=function(r){for(var t={},e=r,n=Math.ceil(Math.sqrt(r)),o=2;o<n+1;o++){for(var u=0;e%o==0;)e/=o,u++;if(u>0&&(t[o]=u),e<=0)break}return e>1&&(t[e]=1),t}},function(r,t){r.exports=require("fs")}]);

Measured memory_bytes: 21064
#include <bits/stdc++.h>
#define rep(i,n) for (ll i = 0; i < (n); ++i)
#define All(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()   //reverse
#define strall(v) (v).cbegin(),(v).cend() //const_itterator
#define IN(a, b, x) (a<=x&&x<b)
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<ll>>;
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
template<typename t, typename u, typename Comp=less<>>
bool chmax(t& xmax, const u& x, Comp comp={}) { if(comp(xmax, x)) { xmax = x; return true; } return false;}
template<typename t, typename u, typename Comp=less<>>
bool chmin(t& xmin, const u& x, Comp comp={}) { if(comp(x, xmin)) { xmin = x; return true;} return false;}
const int INF = 1e9;
const ll infl = ll(1e18)+5;
/*
*ios::sync_with_stdio(false);
*cin.tie(0);
*/
using pint = pair<int,int>;
using ppint = pair<pint,pint>;


int main(){
  int H,W;
  cin >> H >> W;
  vector<vector<int>> a(H, vector<int>(W,0));
  int odd = 0;
  for(int i=0;i<H;i++){
      for(int j=0;j<W;j++){
          cin >> a[i][j];
          if(a[i][j] & 1) ++odd;
      }
  }
  vector<ppint> res;
  int num = 0;
  int x=0,y=0;
  for(int iter = 0;iter<W*H;iter++){
      if(a[x][y] & 1) ++num;
      int nx = x,ny = y;
      if(x%2 == 0){
          if(ny == W-1) ++nx;
          else ++ny;
      }
      else{
          if(ny == 0) ++ nx;
          else --ny;
      }
      if(num & 1) if(num < odd )res.push_back(ppint(pint(x,y),pint(nx,ny)));
      x = nx,y = ny;
  }
  cout << res.size() << endl;
  for(auto p:res){
      cout << p.first.first+1 << " " << p.first.second+1 << " " <<p.second.first+1 << " " << p.second.second+1 << endl;
    }
}

Measured memory_bytes: 6344
#include <iostream>
#include <stdlib.h>
#include <math.h>
#include <stdio.h>

int main(){
int h,m,s,S;
scanf("%d",&S);
h=S/3600;
m=(S%3600)/60;
s=((S%3600)%60);
printf("%d:%d:%d\n",h,m,s);
return 0;
}

Measured memory_bytes: 3144
#include <iostream>
#include <cmath>
#include <algorithm>

using namespace std;

int main() {

	int N[3];

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

	sort(N, N + 3);

	cout << N[0] << " " << N[1] << " " << N[2] << endl;
	
	return 0;
}


Measured memory_bytes: 3156
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>


using namespace std;
using ll = long long;
using ull = unsigned long long;

const ll INF = 1e16;
const ll MOD = 1e9 + 7;

#define REP(i, n) for(ll i = 0; i < n; i++)




int main() {
    int n, s = 0;
    cin >> n;
    
    for(int i = n; i > 0; i /= 10){
        s += i % 10;
    }
    
    cout << ((n % s)? "No" : "Yes") << endl;
}


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

#define ll long long

using namespace std;

int num[300000];

int main()
{
	int N, n[4] = { 0 };
	char c[4];
	char ans[4] = { 'A', 'W', 'T', 'R' };
	scanf("%d", &N);
	while (N--) {
		scanf("%s", c);
		for(int i=0; i<4; i++)
			if (ans[i] == c[0]) {
				n[i]++;
				break;
			}
	}

	printf("AC x %d\n", n[0]);
	printf("WA x %d\n", n[1]);
	printf("TLE x %d\n", n[2]);
	printf("RE x %d\n", n[3]);


	return 0;
}


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

int main() {
  int N;
  cin >> N;
  vector<int> vec(N);
  int sum = 0;

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

  sort(vec.begin(), vec.end());
  reverse(vec.begin(), vec.end());
  for (int i = 0; i < N; i += 2) {
    sum += vec.at(i);
  }
  for (int i = 1; i < N; i += 2) {
    sum -= vec.at(i);
  }

  cout << sum << endl;
}


Measured memory_bytes: 256
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys
import collections

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

d = collections.deque()
def LI(): return list(map(int, sys.stdin.readline().split()))

A,B,C = LI()

if A == B and A != C or B == C and A != B or A == C and A != B:
    print("Yes")
else:
    print("No")

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

int main() {
    string S, T;
    cin >> S >> T;

    for (int i = 0; i < S.size(); i++) {
        char t = T[T.size() - 1];
        for (int j = T.size() - 1; j > 0; j--) {
            T[j] = T[j - 1];
        }
        T[0] = t;
        if (S == T) {
            cout << "Yes" << endl;
            return 0;
        }
    }

    cout << "No" << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <climits>
#include <cmath>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++ )
#define repf(i,m,n) for(int (i)=m;(i)<n;(i)++)
#define all(v) (v).begin(), (v).end()
#define ll long long
#define vec(num,init,name) vector<int> name((num),(init));
#define op(i) cout<<(i)<<endl;

int main(){
    ll n,m;
    ll a=1;
    cin>>n>>m;
    rep(i,n){
        a*=100;
    }
    cout<<(a*(m==100? 101 : m))<<endl;
    return 0;

}

Measured memory_bytes: 256
#include <iostream>
  #include <algorithm>
  #include <vector>
  #include <cmath>
  #include <set>
  #include <map>
  #include <unordered_map>
  #include <iomanip>
  #include <stack>
  #include <queue>
  #include <deque>
  using namespace std;
  const long long MAXN=2e6+2;
long long x[2000007];
  unordered_map<long long ,vector <long long> > mp;
  vector<long long> v;
  long long a[MAXN];
  unordered_map<long long,long long > t;
  long long n ;
  void upd(long long x,long long val){
      for(long long i=x;i<=1000000;i=(i|(i+1)))
          t[i]+=val;
  }
  long long get(long long x){
      long long res=0;
      for(long long i=x;i>=0;i=(i&(i+1))-1)
          res+=t[i];
      return res;
  }
  long long getlr(long long l,long long r){
      return get(r)-get(l);
  }
  int main()
  {
   //   freopen("inverse.in","r",stdin);
   //   freopen("inverse.out","w",stdout);
      ios_base::sync_with_stdio(0);
      cin.tie(0);
      cout.tie(0);
      long long a,b,c;
      cin>>a>>b>>c;
      long long ans=0;
      if(c<=b){
          cout<<b+c;
          return 0;
      }
      else{
          ans+=b+b;
          c-=b;
          ans+=min(a+1,c);
          cout<<ans;
          return 0;
      }
      return 0;
}


Measured memory_bytes: 2304
n,m,k=map(int,input().split())
A=[0]+list(map(int,input().split()))
B=[0]+list(map(int,input().split()))

for i in range(1,n+1):
    A[i]=A[i-1]+A[i]
for i in range(1,m+1):
    B[i]=B[i-1]+B[i]

ans,j=0,m
for i in range(n+1):
    if A[i]>k:break
    while B[j]>k-A[i]:
        j -=1
    ans=max(ans,i+j)
print(ans)

Measured memory_bytes: 114200
#include<bits/stdc++.h>
using namespace std;
int main (){
  int n,m;
  string a;
  cin >> n;
  int max = INT_MIN;
  map<string, int> s;
  for (int i=0;i<n;i++){
    cin >> a;
    s[a]++;
  }
  cin >> m;
  for (int i=0;i<m;i++){
    cin >> a;
    s[a]--;
  }
  for(auto itr = s.begin();itr!=s.end();itr++){
    if(max<itr->second){
      max = itr->second;
    }
  }
  if(max<0)max=0;
  cout << max << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i,n) for (int i = 0; i < (n); ++i)
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
int main(){
    int n,m;
    cin >> n >> m;
    vector<int > a(n);
    int sum = 0;
    REP(i,n){
      cin >> a[i];
      sum += a[i];
    }

    sort(a.begin(), a.end(), greater<int>());

    int f=0;
    REP(i,m){
        if((double )a[i] < (sum/(4.0*m))){
            f=1;
            break;
        }
    }
    
    if(f){
        cout << "No" << endl;
    }else{
        cout << "Yes" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define perl(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define pb push_back
#define ins insert
#define all(x) (x).begin(),(x).end()
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[8]={1,0,-1,0,1,1,-1,-1};
const ll dx[8]={0,-1,0,1,1,-1,1,-1};
using Graph = vector<vector<int>>;
const ll mod=1000000007;
const int MAX_N = 1000;         // n の最大値
 
double nCk(int n, int k) {
double res=1.0;
for(int i=0; i<n; i++){
res*=0.5;}
for(int i=0; i<k; i++){
res*=(double)(n-i);
res/=(double)(k-i);
}
return res;}
 
int main() {
ll n;
cin>>n;
string s[n]={};
ll a[n]={};
rep(i,n){
cin>>s[i]>>a[i];}
string t;
cin >>t;
ll ca=0;
rep(i,n){
if(s[i]==t){
ca=i;
break;}}
ll ans =0;
repl(i,ca+1,n){
ans+=a[i];}
cout << ans << endl;}
  


Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
int main()
{
    long long int n,m,i,j,k,o,p;
    char a[100001];
    scanf("%lld",&n);
    getchar();

    scanf("%c",&a[0]);
    for(i=1,k=1;i<n;i++)
    {
        scanf("%c",&a[i]);
        if(a[i-1]!=a[i]){k++;}
    }
    printf("%lld\n",k);




    return 0;
}


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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
 
int n,cnt=0;
cin>>n;
vector<int>a(n+1);
for(int i=1;i<=n;i++)
	cin>>a[i];
for(int i=1;i<=n;i++)
{
	if((i&1)&&(a[i]&1))
		cnt++;
}
cout<<cnt;
  return 0;
}




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

#define TRACE(x) x
#define WATCH(x) TRACE(cout << #x" = " << x << endl)
#define WATCHR(a, b) TRACE(for (auto it=a; it!=b;) cout << *(it++) << " "; cout << endl)
#define WATCHC(V) TRACE({cout << #V" = "; WATCHR(V.begin(), V.end());})

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

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vs = vector<string>;

mt19937_64 rng((unsigned int) chrono::steady_clock::now().time_since_epoch().count());

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

    int N, M;
    cin >> N >> M;

    vector<vb> adj(N, vb(N));
    for (int e = 0, u, v; e < M; e++) {
        cin >> u >> v;
        u--, v--;
        adj[u][v] = adj[v][u] = true;
    }

    vi diffs;

    vi color(N, -1);
    for (int i = 0; i < N; i++) if (color[i] == -1) {
        color[i] = 0;
        int bal = 1;
        for (queue<int> q({i}); !q.empty(); q.pop()) {
            int loc = q.front();
            for (int nbr = 0; nbr < N; nbr++) if (nbr != loc && !adj[loc][nbr]) {
                if (color[nbr] != -1 && color[nbr] == color[loc]) {
                    cout << -1 << endl;
                    return 0;
                }
                if (color[nbr] == -1) {
                    color[nbr] = !color[loc];
                    bal += color[nbr] ? -1 : 1;
                    q.push(nbr);
                }
            }
        }
        diffs.push_back(abs(bal));
    }

    vb make(2 * N + 3);
    make[N + 1] = true;

    for (int v : diffs) {
        vb upd(2 * N + 3);
        for (int i = 0; i < make.size(); i++) if (make[i]) {
            upd[i - v] = upd[i + v] = true;
        }
        make = upd;
    }

    for (int d = 0; d <= N; d++) {
        if (make[d + N + 1]) {
            int a = (N + d) / 2,
                b = (N - d) / 2;
            cout << (a * (a - 1)) / 2 + (b * (b - 1)) / 2 << endl;
            return 0;
        }
    }
}



Measured memory_bytes: 384