akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <bitset>
#include <complex>
#include <cstdio>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif

using namespace std;

#define rep(i, n) for(int i = 0; i < (int)n; ++i)
#define FOR(i, a, b) for(int i = a; i < (int)b; ++i)

typedef long long ll;

const int Inf = 1e9;
const double EPS = 1e-9;

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

int lcm(int a, int b) {
    return a * b / gcd(a, b);
}

int bitCount(long bits) {
    bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555);
    bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333);
    bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f);
    bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff);
    return (bits & 0x0000ffff) + (bits >>16 & 0x0000ffff);
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, ans;
    cin >> n;
    ans = lcm(n, 2);
    cout << ans << '\n';

    return 0;
}


Measured memory_bytes: 256
# abc168 D
from collections import deque

def bfs(graph, N, start):
    visited = [-1] * N
    visited[start] = 0
    que = deque([start])
    while que:
        node = que.popleft()
        for n in graph[node]:
            if visited[n] == -1:
                visited[n] = node
                que.append(n)
    return visited


## ----main
N, M = list(map(int,input().split()))
graph = [[] for _ in range(N)]

for _ in range(M):
    a,b = list(map(int,input().split()))
    a -= 1
    b -= 1
    graph[a].append(b)
    graph[b].append(a)

visited = bfs(graph,N,0)

if -1 not in visited[1:]:
    print("Yes")
    for v in visited[1:]:
        print(v+1)
else:
    print("No")

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

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

	int x1,y1,x2,y2;
	cin >> x1 >> y1 >> x2 >> y2;

	int dx = x2-x1; int dy = y2-y1;
	cout << x2-dy << " " << y2+dx << " " << x1-dy << " " << y1+dx;

	return 0;
}

Measured memory_bytes: 3612
#include "bits/stdc++.h"
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a),i##_len=(b);i<i##_len;++i)
#define MSVC_UNKO(x) x
#define rep(...) MSVC_UNKO(_overload3(__VA_ARGS__,repi,_rep,_rep)(__VA_ARGS__))
#define all(c) c.begin(),c.end()
#define mp make_pair
#define write(x) cout<<(x)<<"\n"
using namespace std; typedef long long ll;
typedef vector<int> vi; typedef vector<ll> vll; template<class T>using vv = vector<vector<T>>;
template<class T>vv<T> vvec(size_t n, size_t m, T v) { return vv<T>(n, vector<T>(m, v)); }
template<class T>bool chmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }
template<class T>bool chmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
constexpr int INF = 1 << 28, MOD = int(1e9) + 7; constexpr ll LINF = 1ll << 60;
struct aaa { aaa() { cin.tie(0); ios::sync_with_stdio(0); }; }aaaa;

int main() {
    ll K;
    cin >> K;
    
    int N = 50;
    ll base = N - 1 + K / N;
    vll a(N, base);

    K %= N;
    rep(i, N) {
        if (i < K) {
            a[i] += N - K + 1;
        }
        else {
            a[i] += -K;
        }
    }

    write(N);
    rep(i, N - 1) cout << a[i] << " ";
    write(a[N - 1]);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using ll = long long;
using itn = int;
using namespace std;
int GCD(int a, int b){
    return b ? GCD(b, a%b) : a;
}
int main() {
	int n,x;
	cin >> n >> x;
	int l[n];
	for(int i=0; i<n; i++){
		cin >> l[i];
	}
	int wa[x+1]={};
	for(int i=1; i<=n; i++){
		wa[i]+=wa[i-1]+l[i-1];
	}
	int cnt=0;
	for(int i=0; i<n+1; i++){
		if(wa[i]<=x){
			cnt++;
		}
	}
	cout << cnt << endl;
}


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

int main() {
    int n, z, w,a[2001]; cin >> n >> z >> w;
    rep(i,1,n+1){
        cin >> a[i];
    }
    if (n == 1) {
        cout << abs(a[1] - w) << endl;
    } else {
        cout << max(abs(a[n] - w), abs(a[n - 1] - a[n])) << endl;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long
signed main(){
  int n;
  cin>>n;
  vector<int> a(n);
  for(auto& i:a)cin>>i;
  sort(a.begin(),a.end());
  for(int i=1;i<n;++i)if(a[i]==a[i-1])return cout<<"NO",0;
  cout<<"YES";
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define rep(i, a) for(int i = 0; i < a; i++)
#define all(v) v.begin(), v.end()
#define int long long
using namespace std;
signed main() {
    string s;
    cin >> s;
    int a = 0;
    int b = 0;
    rep(i, (int)s.size()) {
        if(s[i] == '1')
            a++;
        else
            b++;
    }
    cout << a + b - abs(a - b) << endl;
    return 0;
}

Measured memory_bytes: 512
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <queue>
#include <vector>
#include <map>
#include <set>

using namespace std;

typedef pair<int , int> P2;
typedef pair<pair<int , int> , int> P3;
typedef pair<pair<int , int> , pair<int , int> > P4;
#define Fst first
#define Snd second
#define PB(a) push_back(a)
#define MP(a , b) make_pair((a) , (b))
#define M3P(a , b , c) make_pair(make_pair((a) , (b)) , (c))
#define M4P(a , b , c , d) make_pair(make_pair((a) , (b)) , make_pair((c) , (d)))
#define repp(i,a,b) for(int i = (int)(a) ; i < (int)(b) ; ++i)
#define repm(i,a,b) for(int i = (int)(a) ; i > (int)(b) ; --i)
#define repv(t,it,v) for(vector<t>::iterator it = v.begin() ; it != v.end() ; ++it)

int N;
int x[1010] , y[1010] , r[1010];
double d[1010][1010];
double ans[1010];
double INF = 1e12;
bool b[1010];

double dis(int a , int b){
	double w = 1. * (x[a] - x[b]);
	double z = 1. * (y[a] - y[b]);
	return max(0.0 , sqrt(w * w + z * z) - 1.*r[a] - 1.*r[b]);
}

int main(){
	scanf("%d%d%d%d%d" , x , y , x + 1 , y + 1 , &N);
	repp(i,2,N+2){
		scanf("%d%d%d" , x + i , y + i , r + i);
	}
	repp(i,0,N+2){
		repp(j,0,N+2){
			d[i][j] = dis(i,j);
		}
	}
	fill(ans,ans + 1010,INF);
	ans[0] = 0.0;
	b[0] = 1;
	int z = 0;
	repp(i,0,N+1){
		int w = 1009;
		repp(j,0,N+2){
			ans[j] = min(ans[j] , ans[z] + d[z][j]);
			if(!b[j] && ans[w] > ans[j]){
				w = j;
			}
		}
		z = w;
		b[w] = 1;
	}
	printf("%.13f\n" , ans[1]);
	return 0;
}


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

int main(){
    int a, b, c, d, e ,k;
    cin>>a>>b>>c>>d>>e>>k;
    if((e-a)<=k) {
        cout<<"Yay!"<<endl;
    }
    else{
        cout<<":("<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mset(a,b) memset(a,b,sizeof a)
#define mcpy(a,b) memcpy(a,b,sizeof b)
#define swap(a,b) a^=b^=a^=b
#define lb(x) ((x)&(-(x)))
#define inf 0x3f3f3f3f
#define N 300010
using namespace std;
typedef long long ll;
int n,head[N],nxt[N],to[N],val[N],cnt;
ll d[N];
inline void add(int a,int b,int c){to[++cnt]=b,val[cnt]=c,nxt[cnt]=head[a],head[a]=cnt;}
inline void dfs(int x,int p){for(int i=head[x];i;i=nxt[i])if(to[i]^p)d[to[i]]=d[x]+val[i],dfs(to[i],x);}
int main(){
	cin>>n;
	for(int i=1;i<n;i++){
		int a,b,c;scanf("%d%d%d",&a,&b,&c);
		add(a,b,c),add(b,a,c);
	}
	int q,k;
	cin>>q>>k;
	dfs(k,0);
	while(q--){
		int x,y;scanf("%d%d",&x,&y);
		printf("%lld\n",d[x]+d[y]);
	}
	return 0;
}

Measured memory_bytes: 9088
#AC済み
x,y,z,k=map(int,input().split())
a=sorted([int(i) for i in input().split()])
b=sorted([int(i) for i in input().split()])
c=sorted([int(i) for i in input().split()])
ab=sorted([a[i]+b[j] for j in range(y) for i in range(x)],reverse=True)
ab=ab[:k]
l=len(ab)
abc=sorted([ab[i]+c[j] for j in range(z) for i in range(l)],reverse=True)
for i in range(k):
    print(abc[i])


Measured memory_bytes: 143884
n=int(input())
a=list(map(int,input().split()))

x,y=0,0
for i in a:
 if i%4==0:
  x+=1
 if i%2==1:
  y+=1

z=n-y-x

if z==0:
 print('Yes' if y<=x+1 else 'No')
else:
 print('Yes' if y<=x else 'No')

Measured memory_bytes: 14252
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll INF=1LL<<60;
const double EPS = 1e-10;
const ll mod=1000000007;
//const ll mod=998244353;
int main(void){
  ll H,W;
  cin>>H>>W;
  if(H%3==0||W%3==0){
    cout<<0<<endl;
    return 0;
  }
  ll ans=min(H,W);
  ll w,h,b,M1,M2,x,y,z;
  for(ll i=0;i<=H;i++){
    x=i*W;
    y=(H-i)*(W/2);
    z=(H-i)*((W+1)/2);
    ans=min(ans,max({x,y,z})-min({x,y,z}));
  }
  swap(H,W);
  for(ll i=0;i<=H;i++){
    x=i*W;
    y=(H-i)*(W/2);
    z=(H-i)*((W+1)/2);
    ans=min(ans,max({x,y,z})-min({x,y,z}));
  }

  cout<<ans<<endl;
}

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

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

  priority_queue<ll, vector<ll>, greater<ll> > que;
  vector<ll> res;
  for (ll i=1; i<10; i++) {
    que.push(i);
    res.push_back(i);
  }
  int cnt=0;
  while (cnt<200000) {
    ll tmp=que.top(); que.pop();
    ll x=tmp*10LL+(tmp%10LL);
    if ((tmp%10)>0) {
      que.push(x-1LL);
      res.push_back(x-1LL);
    }
    que.push(x);
    res.push_back(x);
    if ((tmp%10)<9) {
      que.push(x+1LL);
      res.push_back(x+1LL);
    }
    cnt++;
  }
  sort(res.begin(), res.end());
  cout<<res[n-1]<<endl;
}


Measured memory_bytes: 14812
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<long long> vll;
typedef pair<int,int> pint;
typedef pair<long long, long long> pll;

#define MP make_pair
#define PB push_back
#define ALL(s) (s).begin(),(s).end()
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P) 
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P) 
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P) 
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s; }



int n;

void rec(vint vec, int rem) {
    if (rem == 0) {
        for (int i = 1; i < vec.size(); ++i) {
            cout << vec[i];
            if (i != vec.size()-1) cout << " ";
        }
        cout << endl;
    }
    
    int lim = vec.back();
    for (int i = lim; i >= 1; --i) {
        if (rem < i) continue;
        vint nvec = vec;
        nvec.PB(i);
        rec(nvec, rem-i);
    }
}

int main() {
    while (cin >> n) {
        if (n == 0) break;
        vint kara;
        kara.PB(n);
        rec(kara, n);
    }
    return 0;
}


Measured memory_bytes: 1228
#include<bits/stdc++.h>
#define fastio 	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long int
using namespace std;
int mod = 1e9 + 7;

int32_t main() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	fastio;

	int n;
	cin >> n;
	int arr[n];
	for (int i = 0; i < n; i++)
		cin >> arr[i];
	sort(arr, arr + n, greater<int>());
	int sum = 0, curr = 0;
	// 3 2 2 1
	for (int i = 0; i < n - 1; i++) {
		if (i & 1)
			curr++;
		sum += arr[curr];
	}
	cout << sum;
	return 0;
}

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

int main(void){
    long n, x;
    cin >> n >> x;
    vector<long> v(n);
    for(long i=0; i<n; i++){
        cin >> v[i];
    }
    std::sort(v.begin(), v.end());
    long h = 0;
    for(long i=0; i<n && x>0; i++){
        if(i==n-1 && x>v[i]){
            break;
        }
        if(v[i]<=x){
            x-=v[i];
            h++;
        }else{
            break;
        }
    }
    cout << h <<endl;
    return 0;
}


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

int main(){
    int S,h,m,s;
    cin >> S;
    h = S / 60 / 60;
    m = (S - h * 60 * 60) / 60;
    s = S - h * 3600 - m * 60;
    cout<<h<<":"<<m<<":"<<s<<endl;
    return 0;
}


Measured memory_bytes: 3104
/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		for(int i = 1; i <= 9; i++){
			for(int j = 1; j <= 9; j++){
				System.out.println(i + "x" + j + "=" + (i*j));
			}
		}
	}
}

Measured memory_bytes: 23984
#include <bits/stdc++.h>
#define watch(x) cerr << (#x) << " is " << (x) << endl


using namespace std;



int main()
{
	#ifdef ME
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif

	int n; cin >> n;
	long long ans = 1; double lnn = 0;
	vector<long long> arr(n);
	for (long long &x : arr)
	{
		scanf("%lld", &x);

		if (x == 0)
		{
			cout << "0" << endl; 
			return 0;
		}
		lnn += log10(x);
		ans *= x;
	}

	if (lnn > 18.0)
		cout << "-1" << endl;

	else if (ans <= (long long)1e18)
		cout << ans << endl;

	else
		cout << "-1" << endl;

	return 0;
}

Measured memory_bytes: 4112
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"
using namespace std;

//#define int long long
#define DBG 1
#define dump(o) if(DBG){cerr<<#o<<" "<<o<<endl;}
#define dumpc(o) if(DBG){cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define each(it,c) for(auto it=(c).begin();it!=(c).end();it++)
#define all(c) c.begin(),c.end()
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9 + 7);
const int W = 0;const int G = 1;const int B = 2;
int n; vector<vector<int>>M;
int prim() {
	int u, minv;
	vector<int>d(n, INF), p(n, -1), color(n, W);
	d[0] = 0;
	while (1) {
		minv = INF;
		u = -1;
		rep(i, 0, n) {
			if (minv > d[i] && color[i] != B) {
				minv = d[i];
				u = i;
			}
		}
		if (u == -1)break;
		color[u] = B;
		rep(v, 0, n) {
			if (color[v] != B&&M[u][v] < d[v]) {
				d[v] = M[u][v];
				p[v] = u;
			}
		}
	}
	int sum(0);
	rep(i, 0, n) {
		if (p[i] != -1)sum += M[i][p[i]];
	}
	return accumulate(d.begin(), d.end(),0);

}
signed main() {
	cin >> n; M = vector<vector<int>>(n, vector<int>(n,INF));
	rep(i, 0, n) {
		rep(j, 0, n) {
			int e; cin >> e;
			M[i][j] = (e == -1) ? INF : e;
		}
	}
	cout << prim() << endl;
	return 0;
}

Measured memory_bytes: 3160
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
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 EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
const ll mod = 1000000007;
ll N, M;
ll Prev[605][605][2];
ll Next[605][605][2];

int main() {
    //cout.precision(10);
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> N >> M;
    Prev[1][0][0] = 1;
    ll minus;
    while(M--) {
        if(M == 0) minus = Prev[N][0][0] * N % mod;
        for(int i = 0; i <= N; i++) {
            for(int j = 0; j <= N; j++) {
                for(int k = 0; k <= 1; k++) {
                    Next[i][j][k] = 0;
                }
            }
        }
        for(ll i = 0; i <= N; i++) {
            for(ll j = 0; j <= N; j++) {
                Next[i][j][0] += Prev[i][j][0] * i;
                Next[i][j][1] += Prev[i][j][0] * j;
                Next[i][j+1][1] += Prev[i][j][0] * (N - i - j);
                Next[i+j][0][0] += Prev[i][j][1] * i;
                Next[i][j][1] += Prev[i][j][1] * j;
                Next[i][j+1][1] += Prev[i][j][1] * (N - i - j);
                Next[i][j][0] %= mod;
                Next[i][j][1] %= mod;
                Next[i][j+1][1] %= mod;
                Next[i+j][0][0] %= mod;
            }
        }
        swap(Next, Prev);
        /*
        cerr << endl;
        cerr << M << endl;
        for(int i = 0; i <= N; i++) {
            for(int j = 0; j <= N; j++) {
                cerr << i << " " << j << " " << Prev[i][j][0] << " " << Prev[i][j][1] << endl;
            }
        }
        */
    }
    cerr << minus << endl;
    cerr << Prev[N][0][1] << endl;
    //cout << (Prev[N][0][0] - minus + mod) % mod << endl;
    cout << (Prev[N][0][0] + mod) % mod << endl;
    return 0;
}


Measured memory_bytes: 11648
/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <iostream>

using namespace std;

int main()
{
    int n;
    cin >> n;
    
    bool oddi = true;
    int ai;
    int ans = 0;
    while(n--){
        cin >> ai;
        
        if(ai&1 && oddi){ // ai odd dan index odd
            ans++;
        }
        oddi = !oddi;
    }
    
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3592
#include <bits/stdc++.h>
#include <stdlib.h>
using namespace std;
typedef long long ll;

int main() {
  int a,b,c,d;
  cin>>a>>b>>c>>d;
  if(a*b>=c*d) cout<<a*b<<endl;
  else cout<<c*d<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define LEN 100005

typedef struct pp{
    char name[100];
    int t;
}P;

P Q[LEN];
int head,tail,n;

void enqueue(P x){
    Q[tail] = x;
    tail = (tail + 1) % LEN;
}

P dequeue(){
    P x = Q[head];
    head = (head + 1) % LEN;
    return x;
}

int min(int a,int b) {return a < b ? a:b;}

int main(){
    int elaps = 0,c;
    int i,q;
    P u;
    scanf("%d %d",&n,&q);
    
    for(i = 1;i<= n;i++){
        scanf("%s",Q[i].name);
        scanf("%d",&Q[i].t);
    }
    head = 1;tail = n+1;
    
    while(head != tail){
        u = dequeue();
        c = min(q,u.t);
        u.t -= c;
        elaps += c;
        if(u.t > 0) enqueue(u);
        else{
            printf("%s %d\n",u.name,elaps);
        }
    }
    return 0;
}


Measured memory_bytes: 12912
package main

import (
	"bufio"
	"fmt"
	"log"
	"math"
	"os"
	"strconv"
	"strings"
)

func main() {
	scanner := makeWordScanner()
	n := eGetInt(scanner)
	m := eGetInt(scanner)
	ac := make(map[int]bool)
	wa := make([]int, n+1)
	for i := 0; i < m; i++ {
		p := eGetInt(scanner)
		s := eGetLine(scanner)
		if s == "AC" {
			ac[p] = true
		} else {
			// "WA"
			if !ac[p] {
				wa[p]++
			}
		}
	}
	accnt := 0
	for _, e := range ac {
		if e {
			accnt++
		}
	}
	wacnt := 0
	for i, e := range wa {
		if ac[i] {
			wacnt += e
		}
	}
	fmt.Printf("%d %d\n", accnt, wacnt)
}

////////////////////////////////////////////////////////////////////////////////
// ライブラリ
////////////////////////////////////////////////////////////////////////////////
func makeScanner(maxByte int) *bufio.Scanner {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Buffer(make([]uint8, 0, 8192), maxByte)
	return scanner
}
func makeCharScanner() *bufio.Scanner {
	scanner := makeScanner(8192)
	scanner.Split(bufio.ScanRunes)
	return scanner
}
func makeWordScanner() *bufio.Scanner {
	scanner := makeScanner(8192)
	scanner.Split(bufio.ScanWords)
	return scanner
}
func eGetLine(r *bufio.Scanner) string {
	if r.Scan() {
		return r.Text()
	}
	err := r.Err()
	if err != nil {
		log.Fatal(err)
	}
	// EOF
	return ""
}
func eGetInt(r *bufio.Scanner) int {
	line := eGetLine(r)
	return eAtoi(line)
}
func eGetInt64(r *bufio.Scanner) int64 {
	line := eGetLine(r)
	return eAtoInt64(line)
}
func eGetFields(r *bufio.Scanner) []string {
	line := eGetLine(r)
	return strings.Fields(line)
}
func eGetInts(r *bufio.Scanner) []int {
	fields := eGetFields(r)
	ints := make([]int, len(fields))
	for i := 0; i < len(ints); i++ {
		ints[i] = eAtoi(fields[i])
	}
	return ints
}
func eGetInt64s(r *bufio.Scanner) []int64 {
	fields := eGetFields(r)
	ints := make([]int64, len(fields))
	for i := 0; i < len(ints); i++ {
		ints[i] = eAtoInt64(fields[i])
	}
	return ints
}
func eGetChars(r *bufio.Scanner) []string {
	line := eGetLine(r)
	return strings.Split(line, "")
}
func eAtoi(s string) int {
	n, err := strconv.Atoi(s)
	if err != nil {
		log.Fatal(err)
	}
	return n
}
func eAtoInt64(s string) int64 {
	n, err := strconv.ParseInt(s, 10, 64)
	if err != nil {
		log.Fatal(err)
	}
	return n
}
func pow(a, n int) int {
	return int(math.Pow(float64(a), float64(n)))
}
func countBitOfOn(i, numbits int) int {
	count := 0
	var bit uint64
	for bit = 0; bit < uint64(numbits); bit++ {
		t := 1 << bit
		if i&t > 0 {
			count++
		}
	}
	return count
}


Measured memory_bytes: 4992
#include <bits/stdc++.h>
using namespace std;
long long b[5010];
long long c[5010];
int main()
{
	
	long long n;
	cin >> n;
	for(long long i = 0; i < n ;i++){
		int t;
		scanf("%d",&t);
		c[t]++;
	}
	for(long long i = 1000; i >= 0; i--){
		b[i] = b[i + 1] + c[i];
	}
	long long ans = 0;
	for(int i = 1; i <= 1000; i++){
		ans += c[i] * (c[i] - 1) * (c[i] - 2) / 6;	
		ans += c[i] * (c[i] - 1) / 2 * (b[0] - b[2 * i] - c[i]);
	}
	for(long long i = 1; i <= 1000; i++){
		for(long long j = i + 1; j <= 1000; j++){
			ans += c[i] * c[j] * (b[j + 1] - b[i + j]);
		}
	}
	cout << ans <<endl;
	return 0;
}

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

using ll = long long;
using pii = pair<int, int>;

#define vt          vector
#define sz(x)       (int)(x).size()
#define all(x)      (x).begin(), (x).end()
#define rall(x)     (x).rbegin(), (x).rend()
#define fi          first
#define se          second

struct Edge {
    int to, a, b;
};

struct Node {
    int v, s;
    ll dist;
    bool operator<(const Node &o) const {
        return dist > o.dist;
    }
};

const int maxn = 51, maxs = 2501;
const ll inf = 1ll << 60;
ll dist[maxn][maxs];
bool vis[maxn][maxs];

signed main() {
    ios::sync_with_stdio(0), cin.tie(0);

    int n, m, s;
    cin >> n >> m >> s;
    if (s >= maxs) s = maxs - 1;

    vt<vt<Edge>> adj(n);
    while (m--) {
        int u, v, a, b;
        cin >> u >> v >> a >> b;
        u--, v--;
        adj[u].push_back({v, a, b});
        adj[v].push_back({u, a, b});
    }

    vt<pii> ex(n);
    for (pii &i : ex) cin >> i.fi >> i.se;

    fill_n(*dist, maxn * maxs, inf);
    dist[0][s] = 0;
    priority_queue<Node> q;
    q.push({0, s, 0});
    while (!q.empty()) {
        Node cur = q.top();
        q.pop();

        if (cur.dist != dist[cur.v][cur.s]) continue;

        for (int i = 1, c = cur.s + ex[cur.v].fi;;
                i++, c += ex[cur.v].fi) {
            if (c >= maxs) c = maxs - 1;

            ll newDist = cur.dist + (ll)i * ex[cur.v].se;
            if (newDist < dist[cur.v][c]) {
                dist[cur.v][c] = newDist;
                q.push({cur.v, c, newDist});
            } else break;

            if (c == maxs - 1) break;
        }

        for (Edge &e : adj[cur.v]) {
            int newS = cur.s - e.a;
            if (newS < 0) continue;

            ll newDist = cur.dist + e.b;
            if (newDist < dist[e.to][newS]) {
                dist[e.to][newS] = newDist;
                q.push({e.to, newS, newDist});
            }
        }
    }

    for (int i = 1; i < n; i++) {
        ll ans = inf;
        for (int j = 0; j < maxs; j++) {
            ans = min(ans, dist[i][j]);
        }
        cout << ans << '\n';
    }
}


Measured memory_bytes: 37096
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var Arr=(input.trim()).split("\n").map(Number);
var arr=[];
for(var i=0;i<=100;i++)arr[i]=0;
var cnt=0;
Arr.forEach(function(v){
arr[v]++;
if(arr[v]>cnt)cnt=arr[v];
});
arr.forEach(function(v,i){
if(v==cnt)console.log(i);
});

Measured memory_bytes: 7648
#include <bits/stdc++.h>
#define N 5
using namespace std;
typedef long long ll;
bool used[N];
  
ll SumD(ll a,ll d,ll n){return (n*(2*a+(n-1)*d))/2;}
  
bool mark(ll n){
  bool res=1;
  for(ll i=1;i*i<=N;i++)res&=!used[i],used[i]=1;
  return res;
}
  
int main(){
  while(1){
    ll n,m,p[21];
    cin>>n>>m;
    if(!n&&!m)break;
    for(int i=0;i<m;i++)cin>>p[i];
    sort(p,p+m);
    
    ll sum=0,cnt=0;
    for(int i=0;i<m;i++){
      sum+=SumD(p[i],p[i],n/p[i]);
      cnt+=n/p[i];
      memset(used,0,sizeof(used));
      for(int j=0;j<i;j++){
    ll lcm=(p[i]/__gcd(p[i],p[j]))*p[j];
    if(!mark(lcm))continue;
    sum-=SumD(lcm,lcm,n/lcm);
    cnt-=(n/lcm);
      }
    }
    printf("%.8f\n",(1.0*SumD(1,1,n)-sum)/max(1LL,(n-cnt)));
  }
  return 0;
}

Measured memory_bytes: 3216
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define sz(x) ((int)x.size())
#define all(x) (x).begin(), (x).end()
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define mset(x,y) memset(x,y,sizeof(x))
#define rep(i,n) for(int i=0;i<int(n);i++)
#define per(i,n) for(int i=int(n)-1;i>=0;i--)
#define rng(i,a,b) for(int i=int(a);i<=int(b);i++)
#define gnr(i,b,a) for(int i=int(b);i>=int(a);i--)
using namespace std;
using namespace __gnu_pbds;
using ordered_set = tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>;
#ifdef LOCAL
#define dmp(...) _dmp(#__VA_ARGS__, __VA_ARGS__)
#else
#define dmp(...) (__VA_ARGS__)
#endif
template<class T> using vt=vector<T>;
template<class T> using vvt=vt<vt<T>>;
template<class TA,class TB> void chmax(TA&a,TB b){if(a<b)a=b;}
template<class TA,class TB> void chmin(TA&a,TB b){if(b<a)a=b;}
template<class TA,class TB>
ostream& operator<<(ostream& os,const pair<TA,TB>& p){
	return os<<"{"<<p.fi<<","<<p.se<<"}";
}
template<class T> ostream& operator<<(ostream& os,const vt<T>& v){
	os<<"{";for(auto& e:v)os<<e<<",";return os<<"}";
}
template<class TH> void _dmp(const char *sdbg, TH h){cout<<sdbg<<"="<<h<<endl;}
template<class TH, class... TA> void _dmp(const char *sdbg, TH h, TA...a){
while(*sdbg!=',')cout<<*sdbg++;cout<<"="<<h<<","; _dmp(sdbg+1, a...);
}
template<class T> void make_unique(vt<T>& v) {
	sort(all(v));v.erase(unique(all(v)),v.end());
}
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
int ri(){int x;cin>>x;return x;}
ll rll(){ll x;cin>>x;return x;}
vi rvi(int n){vi v;rep(i,n)v.pb(ri());return v;}
int n,a[3];
int b[100010],d[100010][2];
int f(int i) {
	if(d[i][0]==d[i+1][0]&&d[i][1]==d[i+1][1])return -1;
	if(d[i][0]==d[i+1][0]||d[i][0]==d[i+1][1])return 0;
	return 1;
}
void MAIN() {
	cin>>n;
	rep(i,3)cin>>a[i];
	rep(i,n) {
		string s;cin>>s;
		rep(j,2)d[i][j]=s[j]-'A';
	}
	rep(i,n) {
		int x=d[i][0],y=d[i][1];
		if(!a[x]&&!a[y]) {
			cout<<"No";
			return;
		}
		if(!a[x])b[i]=0;
		else if(!a[y])b[i]=1;
		else if(i==n-1)b[i]=0;
		else {
			int k=f(i);
			if(k==-1)b[i]=a[x]<a[y];
			else b[i]=k;
		}
		a[d[i][b[i]]]++;
		a[d[i][1-b[i]]]--;
	}
	cout<<"Yes\n";
	rep(i,n) {
		cout<<(char)(d[i][b[i]]+'A')<<'\n';
	}
}
int main() {
	ios::sync_with_stdio(false);cin.tie(0);
	int T=1;
	//cin>>T;
	for(int tt=1;tt<=T;tt++) {
		MAIN();
	}
	return 0;
}

Measured memory_bytes: 4832
n = int(input())
l = list(map(int, input().split()))

x = 0
maxside = 0
for i in range(n):
    if maxside < l[i]:
        maxside = l[i]
        x = i
del l[x]
sum = 0
for i in range(n - 1):
    sum += l[i]

if sum > maxside:
    print("Yes")
else:
    print("No")


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

# define REP(i,n) for (int i=0;i<(n);++i)
# define rep(i,a,b) for(int i=a;i<(b);++i)
# define p(s) std::cout << s ;
# define pl(s)  std::cout << s << endl;
# define printIf(j,s1,s2) cout << (j ? s1 : s2) << endl;
# define YES(j) cout << (j ? "YES" : "NO") << endl;
# define Yes(j) std::cout << (j ? "Yes" : "No") << endl;
# define yes(j) std::cout << (j ? "yes" : "no") << endl;
# define all(v) v.begin(),v.end()
# define showVector(v) REP(i,v.size()){p(v[i]);p(" ")} pl("")
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;}
typedef long long int ll;
typedef pair<ll,ll> P_ii;
typedef pair<double,double> P_dd;

template<class T>
vector<T> make_vec(size_t a){
    return vector<T>(a);
}

template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts){
  return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

template<typename T,typename V>
typename enable_if<is_class<T>::value==0>::type
fill_v(T &t,const V &v){t=v;}

template<typename T,typename V>
typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t,const V &v){
  for(auto &e:t) fill_v(e,v);
}


const int MOD = 1000000007;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;

void addM(long long &a, long long b) {
    a += b;
    if (a >= MOD) a -= MOD;
}

void mulM(long long &a, long long b) {
    a = ((a%MOD)*(b%MOD))%MOD ;
}

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

  vector<ll> a(n),b(n);
  REP(i, n) cin >> a[i];
  REP(i, n) cin >> b[i];

  ll ans=0;
  for(int d = 32; d >= 0; --d){
    REP(i,n) a[i] %= (1LL << (d + 1));
    REP(i,n) b[i] %= (1LL << (d + 1));
    sort(all(a));
    sort(all(b));

    ll cnt = 0;
    ll cur = 1LL << d;
    REP(i,n){
      if(a[i] >= cur) cnt += lower_bound(all(b), 2*cur-a[i]) - b.begin() + n - (lower_bound(all(b), 3*cur-a[i]) - b.begin());
      else cnt+=lower_bound(all(b), 2*cur-a[i])-lower_bound(all(b), cur-a[i]);
    }
    if(cnt % 2 == 1) ans += cur;
  }

  pl(ans)
  return 0;

}

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

int main(void) {
	int a, b, c, d, e, f,wa,su;
	double s_w,max = 0;
	scanf("%d %d %d %d %d %d", &a, &b, &c, &d, &e, &f);
	for (int i = 0; i <= f / (100 * a); i++) {
		for (int j = 0; j <= f / (100 * b); j++) {
			for (int k = 0; k <= (i * a + j * b) * e / c; k++) {
				for (int l = 0; l <= ((i * a + j * b) * e - (k * c)) / d; l++) {

					if ((i * a + j * b) * 100 + k*c + l*d > f || k*c + l*d > (i * a + j * b) * e ||
						(i == 0 && j == 0))continue;

					s_w = 100 * (k*c + l*d) / ((k*c + l*d) + ((i * a + j * b) * 100.0));
					if (max <= s_w) {
						max = s_w;
						wa = (i * a + j * b) * 100 + k*c + l*d;
						su = (k*c + l*d);
					}
				}
			}
		}
	}
	printf("%d %d\n", wa, su);
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int main() {
  long N;
  cin >> N;
  vector<int> A(N), ans(N);
  for(int i=0; i<N; i++) cin >> A.at(i);
  
  for(int i=0; i<N; i++)
  {
    ans.at( A.at(i)-1 ) = i+1;
  }
  
  /*
  for(int i=1; i<= N; i++)//登校順を1から検索
  {
    for(int j=0; j<N;j++){//生徒の出席番号を検索
      if(A.at(j) == i) ans.at(i-1) = j+1;
    }
  }
  */
  for(int i=0; i<N-1; i++){
    cout << ans.at(i) << " ";
  }
  cout << ans.at(N-1) << endl;
  //printf("%lf", ans);
 
}


Measured memory_bytes: 1536
#include<bits/stdc++.h>
#define ll long long
const int MAX=2e+5;
using namespace std;

int H, N;
int A[MAX];
int main(){
	cin>>H>>N;
	for(int i=0; i<H; ++i) cin>>A[i];
	ll step=0;
	if(N>=H){
		cout<<step;
		return 0;
	}
	sort(A, A+H);
	for(int i=0; i<H-N; ++i){
		step+=A[i];
	}
	cout<<step;
	return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define all(a) a.begin(), a.end()
using namespace std;

int N;
vector<int> h;
int res;
void grow(int &l, int &r){
    if(l >= N || r >= N) return;
  for(int i=l; i<=r; ++i)
    --h[i];
  ++res;
}

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> N;
  h.resize(N);
  for(int i=0; i<N; ++i) cin >> h[i];
  for(int i=1; i<=100; ++i){
    int j = 0, l = 0, r;
    while(j < N){
      while(l < N && h[l] <= 0) ++l;
      r = l;
      while(r+1 < N && h[r+1] > 0) ++r;
      grow(l, r);
      l = r + 1;
      ++j;
    }
  }
  cout << res << "\n";
  return 0;
}


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

int main(){
    string s;
    vector<int> num;
    vector<char> c(3);

    cin >> s;

    for(int i = 0; i < 4; i++){
        num.push_back(s[3 - i] - '0');
    }

    int ans = num.at(3);

    for(int bit = 0; bit < (1 << 3); bit++){
        for(int j = 0; j < 3; j++){
            if(bit & (1 << j)){
                ans = ans + num.at(j);
                c.at(j) = '+';
            }else{
                ans = ans - num.at(j);
                c.at(j) = '-';
            }
        }

        if(ans == 7){
            break;
        }

        ans = num.at(3);
    }

    cout << num.at(3) << c.at(2) << num.at(2) << c.at(1) << num.at(1) << c.at(0) << num.at(0) << "=7" << endl;
}

Measured memory_bytes: 3616
#include <iostream>
using namespace std;
 
int main() { int n,i,j;
            cin>>n;
            char a[n];
            for(i=0;i<n;i++)
              cin>>a[i];
            if(n%2==0)
       for(i=0;i<n/2;i++)
       {   if(a[i]!=a[i+n/2])
          { cout<<"No"<<endl;
           break;
          }
       }
            else
              cout<<"No"<<endl;
         if(i==n/2)
           cout<<"Yes"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>
#include <cstdio>
#include <stack>
#include <functional>
#include <set>
#include <map>
#include <cmath>
#include <climits>

using namespace std;
typedef long long ll;

#define ASIZE(arr) (sizeof(arr)/sizeof(arr[0])

//int dp[1000][1000];
//int n, W, w[1000], v[1000];
//void solve() {
//	for (int i = n - 1; i >= 0; i--)
//	{
//		for (int j = 0; j <= W; j++)
//		{
//			if (j < w[i]) {
//				dp[i][j] = dp[i + 1][j];
//			}
//			else {
//				dp[i][j] = max(dp[i + 1][j], dp[i + 1][j - w[i]] + v[i]);
//			}
//		}
//	}
//}

vector<ll> p = { 1 }, b = { 1 };

ll solve(ll n, ll x) {
	if (n == 0)return x <= 0 ? 0 : 1;
	else if (x <= 1 + b[n - 1]) return solve(n - 1, x - 1);
	else return p[n - 1] + 1 + solve(n - 1, x - 2 - b[n - 1]);
}

int main() {
	ll n, k;
	cin >> n >> k;
	vector<ll> x(n);

	for (ll i = 0; i < n; i++)
	{
		cin >> x[i];
	}

	ll ans = LLONG_MAX;

	for (ll i = 0; i <= n - k; i++)
	{
		ll temp = abs(x[i]) + x[i + k - 1] - x[i];
		ans = min(ans, temp);
	}
	
	for (ll i = n - 1; i >= k - 1; i--)
	{
		ll temp = abs(x[i]) + x[i] - x[i - k + 1];
		ans = min(ans, temp);
	}
	cout << ans << endl;
}

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

int n, q;
vector<int> v[200010];
int sum[200010];
int ans[200010];

int dfs(int x, int s, int p) {
	ans[x] = s + sum[x];
	for(auto i : v[x]) {
		if(i == p) continue;
		dfs(i, s + sum[x], x);
	}
}

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

	cin >> n >> q;

	for(int i=1; i<n; i++) {
		int a, b;
		cin >> a >> b;
		v[a].emplace_back(b);
		v[b].emplace_back(a);
	}

	for(int i=0; i<q; i++) {
		int p, x;
		cin >> p >> x;
		sum[p] += x;
	}

	dfs(1, 0, -1);

	for(int i=1; i<=n; i++) {
		cout << ans[i] << " ";
	}
}

Measured memory_bytes: 27264
import java.util.Scanner;
public class Main {

@SuppressWarnings("resource")
public static void main(String[] args) {
	Scanner sc =new Scanner(System.in);
	int N=sc.nextInt();
	String S2=sc.next();
	String S[]=S2.split("");
	long ans=0;
	if(N<=3) {
		System.out.println(0);
	}else {
		long Rnum=0;
		long Gnum=0;
		long Bnum=0;
		for(int i=0;i<N;i++) {
			if(S[i].equals("R")) {
				Rnum++;
			}else if(S[i].equals("G")) {
				Gnum++;
			}else {
				Bnum++;
			}
		}
		ans=Rnum*Gnum*Bnum;
		for(int j=1;j<N-1;j++) {
			for(int i=j-1,k=j+1;i>=0&&k<N;i--,k++) {
				if(!S[j].equals(S[i])&&!S[j].equals(S[k])&&!S[k].equals(S[i])) {
					ans--;
				}
			}
		}
		System.out.println(ans);


	}
	}
}


Measured memory_bytes: 37280
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<cstdlib>
using namespace std; 
bool cmp(int x,int y){
	return x<y;
}
int a[4];
int ans=0;
void solve(){
    int k=0;
    int b[4];
	for(int i=1;i<=3;i++) if(a[i]%2==0){
	  ++k;
      b[k]=i;
	}
	
	if(k==0||k==3){
		ans+=(a[3]-a[2])/2;
		ans+=(a[3]-a[1])/2;
	    return;
	}
	if(k==2){
		for(int i=1;i<=2;i++) a[b[i]]+=1;
		ans=1;
		ans+=(a[3]-a[2])/2;
		ans+=(a[3]-a[1])/2;
	    return;
	}
	if(k==1){
		a[b[1]]-=1;
		ans=1;
		ans+=(a[3]-a[2])/2;
		ans+=(a[3]-a[1])/2;
	    return;
	}
	return;
}
int main(){
	for(int i=1;i<=3;i++) scanf("%d",&a[i]);
	sort(a+1,a+4,cmp);
	
	solve();
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
struct node{
	int na,su;
}a[10];
int main()
{
	int n,i;
	for(i=1; i<=9; i++)
		cin>>a[i].na;
	cin>>n;
	int x;
	for(i=1; i<=n; i++)
	{
		cin>>x;
		for(int j=1; j<=9; j++)
			if(a[j].na==x)
				a[j].su++;
	}
	if(a[1].su==1 && a[2].su==1 && a[3].su==1)
		cout<<"Yes";
	else if(a[1].su==1 && a[5].su==1 && a[9].su==1)
		cout<<"Yes";
	else if(a[4].su==1 && a[5].su==1 && a[6].su==1)
		cout<<"Yes";
	else if(a[7].su==1 && a[8].su==1 && a[9].su==1)
		cout<<"Yes";
	else if(a[1].su==1 && a[4].su==1 && a[7].su==1)
		cout<<"Yes";
	else if(a[2].su==1 && a[5].su==1 && a[8].su==1)
		cout<<"Yes";
	else if(a[3].su==1 && a[6].su==1 && a[9].su==1)
		cout<<"Yes";
	else if(a[3].su==1 && a[5].su==1 && a[7].su==1)
		cout<<"Yes";
	else
		cout<<"No";
	return 0;
 } 

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

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

int main() {
  int H,W; cin>>H>>W;
  pair<int, int> start,goal,start2;
  cin>>start.first>>start.second;
  cin>>goal.first>>goal.second;
  start.first--;start.second--;goal.first--;goal.second--;
  vector<string> S(H);
  for(int i=0; i<H; ++i) cin>>S[i];
  // 二度塗りでどうだ
  // 最初に歩きパターンを見てから、次にワープパターンを見る
  vector<vector<int>> Graph(H,vector<int>(W,-1));
  vector<vector<bool>> isSeen(H,vector<bool>(W,false));
  int count = 0;
  queue<pair<int,int>> que,que2;
  Graph[start.first][start.second]=count;
  que.push(start);
  que2.push(start);
  isSeen[start.first][start.second]=true;
  while(!que.empty() || !que2.empty()) {
    while(!que.empty()) {
      auto v = que.front();
      que.pop();
      que2.push(v);
      for(int dir=0; dir<4; ++dir) {
        int nh=v.first+dx[dir];
        int nw=v.second+dy[dir];
        if(nh<0||nh>=H||nw<0||nw>=W) continue;
        if(S[nh][nw]=='#') continue;
        if(!isSeen[nh][nw]) {
          isSeen[nh][nw]=true;
          Graph[nh][nw]=count;
          que.push({nh,nw});
        }
      }
    }
    count++;
    while(!que2.empty()) {
      auto v = que2.front();
      que2.pop();
      for(int i=-2; i<=2; ++i) {
        for(int j=-2; j<=2; ++j) {
          int nh=v.first+i;
          int nw=v.second+j;
          if((abs(i)<=1 && j==0) || (abs(j)<=1 && i==0)) continue;
          else {
            if(nh<0||nh>=H||nw<0||nw>=W) continue;
            if(S[nh][nw]=='#') continue;
            if(!isSeen[nh][nw]) {
              Graph[nh][nw]=count;
              isSeen[nh][nw]=true;
              que.push({nh,nw});
              start2={nh,nw};
            }
          }
        }
      }
    }
  }
  cout << Graph[goal.first][goal.second] << endl;
}


Measured memory_bytes: 9608
#include <bits/stdc++.h>
using namespace std;
int main() {
  int A, B, C;
  cin >> A >> B >> C;
  if (A == B && B == C) {cout << "No" << endl;}
  else if (A == B || A == C || B == C) {cout << "Yes" << endl;}
  else {cout << "No" << endl;}
}

Measured memory_bytes: 3636
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <ctype.h>
#include <string.h>
#define ll long long

int main(void){
int N;
scanf("%d",&N);
int *a=(int*)malloc(sizeof(int)*N);
int i;
for(i=0;i<N;i++) scanf("%d",&a[i]);
int max=0;
for(i=0;i<N;i++)
if(max<a[i]) max=a[i];

for(i=0;i<N;i++)
if(a[i]!=max&&a[i]!=max-1) {printf("No\n");
return 0;
}

int count=0;
for(i=0;i<N;i++)
 if(a[i]!=max) count++;

if(count==0&&max+1==N){
printf("Yes\n");
return 0;
}

if((N-count)>=2*(max-count)&&(max-count)>0){
printf("Yes\n");
return 0;
}

printf("No\n");
return 0;
}

Measured memory_bytes: 512
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <time.h>

#define _CRT_SECURE_NO_WARNINGS
#define TLong long long
#define TBMod 1000000007

int main(int argc, char const *argv[])
{
	int a,b,c;
	int temp;
	scanf("%d%d%d",&a,&b,&c);
	if(a > b){
		temp = a;
		a = b;
		b = temp;
	}
	if(a < c && c < b)	puts("Yes");
	else puts("No");
	return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
#define INF 10000000
#define rep(i,a,b) for(ll (i)=a;(i)<(ll)(b);(i)++)
using ipair = pair<ll,ll>;

int main(){
    int N,K;
    cin >> N >> K;
    vector<int> p(N,0);
    for(int i=0;i<N;i++) cin >> p[i];
    sort(p.begin(),p.end());
    cout << accumulate(p.begin(),p.begin()+K,0) << endl;

}

Measured memory_bytes: 3628
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Scanner;
import java.util.stream.Collectors;
import java.util.stream.Stream;

public class Main {

	public static void main(String[] args) throws IOException {

		Scanner scan = new Scanner(System.in);

		int A, B;
		A = scan.nextInt();
		B = scan.nextInt();

		int coinCount = 0;

		if (A > B) {
			coinCount += A;
			A--;
		} else {
			coinCount += B;
			B--;
		}

		if (A > B) {
			coinCount += A;

		} else {
			coinCount += B;

		}

		System.out.println(coinCount);
	}

	//***********************以下共通関数************************************************
	/**
	 * 文字列を反転して返す
	 * @param pStr 文字列
	 * @return 反転した文字列
	 */
	public static String myReverse(String pStr) {
		if (pStr.length() < 1) {
			return "";
		}

		StringBuffer sb = new StringBuffer(pStr);
		return sb.reverse().toString();
	}

	/**
	 * 余りを求める。
	 * @param a
	 * @param b
	 * @return 余り。余りがマイナスの時はプラスで返す。
	 */
	public static long myMod(long a, long b) {
		long ret = 0;

		ret = a % b;

		if (ret < 0) {
			ret += b;
		}

		return ret;
	}

	/**
	 * 乗数を求める ※mod対応
	 * @param kisu 基数
	 * @param josu 乗数
	 * @param primeNumMod_0 法 mod値 使わない場合は「0」
	 * @return
	 */
	public static long myPowWithMod(long kisu, long josu, long primeNumMod_0) {

		long ans = 1;

		//乗数が0の場合→1
		if (josu == 0)
			return 1;

		if (primeNumMod_0 == 0) {
			//modを使わないとき

			while (josu > 0) {

				if (josu % 2 == 0) {
					//累乗が偶数の時

					kisu *= kisu;
					josu = josu / 2;
				} else {
					//累乗が奇数の時
					ans *= kisu;
					josu--;
				}
			}

			return ans;

		} else {
			//modを使うとき

			//初めに桁を落とす
			kisu = myMod(kisu, primeNumMod_0);

			while (josu > 0) {

				if (josu % 2 == 0) {
					//累乗が偶数の時

					kisu *= myMod(kisu, primeNumMod_0);
					josu = josu / 2;

				} else {
					//累乗が奇数の時
					ans *= myMod(kisu, primeNumMod_0);
					josu--;

				}
			}

			return myMod(ans, primeNumMod_0);

		}

	}

}


Measured memory_bytes: 23636
#include "bits/stdc++.h"
using namespace std;typedef long long lint;typedef vector<lint> liv;
#define rep(i,n) for(int i=0;i<n;++i)
#define all(v) v.begin(),v.end()
#define linf 1152921504606846976
#define MAXN 100010

int main(){
	lint a,b;cin>>a>>b;
	if((a<=0&&b>=0)||(a>=0&&b<=0)){ cout<<"Zero\n";return 0; }
	if(b<0&&((b-a)&1)==0){cout<<"Negative"<<endl;return 0;}
	cout<<"Positive"<<endl;
}

//sub-EOF


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

using namespace std;
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define sz(x) ll(x.size())
typedef long long ll;
//typedef pair<int, int> P;
typedef pair<ll, ll> P;
//const double INF = 1e10;
const ll INF = 10e10;
const ll MINF = -10e10;
//const int INF = INT_MAX;
#define mins(x, y) x = min(x, y)
#define maxs(x, y) x = max(x, y)

typedef priority_queue<P, vector<P>, greater<P> > PQ_ASK;
const int mod = 1000000007;
//ifstream myfile("C:\\Users\\riku\\Downloads\\01.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;

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


    int even = k / 2;
    int odd = (k + 1) / 2;

    cout << even * odd << endl;

}


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

using namespace std;

const int inf = numeric_limits<int>::max();

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

    int n, k;
    cin >> n >> k;
    int h[n], dp[n];
    for(int i = 0; i < n; i++) cin >> h[i];
    dp[0] = 0;
    for(int i = 1; i < n; i++){
        dp[i] = inf;
        for(int j = max(0, i - k); j < i; j++)
            dp[i] = min(dp[i], dp[j] + abs(h[j] - h[i]));
    }
    cout << dp[n - 1] << endl;
}

Measured memory_bytes: 1024
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author yosiiii
 */


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

class BMultiplication2 {
public:
	void solve(std::istream& in, std::ostream& out) {
        ll n;
        in >> n;
        vector<ll> a(n);
        bool f=false;
        rep(i,n){
            in >> a[i];
            if(a[i]==0)f=true;
        }
        if(f){
            out << 0 << endl;
            return ;
        }
        ll t=1L;
        rep(i,n){
            ll tt=t;
            t*=a[i];
            if(t<tt || 1000000000000000000<t) {
                out << -1 << endl;
                return ;
            }
        }
        out << t << endl;
	}
};


int main() {
	BMultiplication2 solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 4000
import java.util.*;

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

        int k = sc.nextInt();
        String s = sc.next();

        if(s.length() <= k){
            System.out.println(s);
        }else{
            System.out.println(s.substring(0, k) + "...");
        }

    }
}


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


int main ()
{
    int a, b;
    cin >> a >> b;

    int ans;
    if (a >= 13)
    {
        ans = b;
    }
    else if (a >= 6)
    {
        ans = b / 2;
    }
    else
    {
        ans = 0;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repr(i,n) for(int i = (int)(n); i >= 0; i--)
#define all(v) v.begin(),v.end()
typedef long long ll;

int main(){
    ll N;
    cin >> N;
    vector<pair<ll,ll> > x(N);
    rep(i,N){
        cin >> x[i].first >> x[i].second;
    }
    vector<ll> d1(N);
    rep(i,N){
        d1[i] = x[i].first + x[i].second;
    }
    vector<ll> d2(N);
    rep(i,N){
        d2[i] = x[i].first - x[i].second;
    }
    sort(all(d1));
    sort(all(d2));
    ll x1 = d1[N - 1] - d1[0];
    ll x2 = d2[N - 1] - d2[0];
    cout << max(x1, x2) << endl;
}

Measured memory_bytes: 9532
#include<bits/stdc++.h>
using namespace std;
using lint = long long;
template<class T>
using vec = vector<T>;

#define FOR(i,a,b) for(int i=((int)(a));i<((int)(b));i++)
#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define all(x) (x).begin(),(x).end()

int main(){
  int a,b,c,x;
  cin >>a >>b >>c >>x;

  int ans=0;
  REP(i,a+1){
    REP(j,b+1){
      REP(k,c+1){
        if(500*i+100*j+50*k == x) ++ans;
      }
    }
  }

  cout <<ans <<endl;
}


Measured memory_bytes: 256