akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
int main(void)
{
	char str[10];
	int second;
	
	fgets(str, sizeof(str), stdin);
	sscanf(str, "%d", &second);
	printf("%d:", second / 3600 );
	printf("%d:", second % 3600 / 60 );
	printf("%d", second % 60);
	printf("\n");

	return 0;
}

Measured memory_bytes: 608
// C - Cat Snuke and a Voyage
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;

string solve(int N, vvi &T){
	for(int c:T[1])
		for(int goal:T[c]) if(goal==N) return "POSSIBLE";
	return "IMPOSSIBLE";
}

int main(){
	int N,M; cin>>N>>M;
	vvi T(N+1, vi());
	while(M--){
		int a,b; cin>>a>>b;
		T[a].push_back(b);
	}
	cout<< solve(N, T) <<endl;
}

Measured memory_bytes: 8576
#include<bits/stdc++.h>
#define F first
#define S second
#define int long long
#define double long double
using namespace std;
typedef pair<int,int> P;
typedef pair<int,P> iP;
typedef pair<P,int> Pi;
typedef pair<P,P> PP;
double eps=1e-8;
int mod=1e9+7;
int inf=1LL<<55;

priority_queue<P,vector<P>,greater<P> > pq;

template <typename T>
int Count(const vector<T> &v, T l,T r){
  //counting [l,r]
  auto L = lower_bound(v.begin(), v.end(), l );
  auto R = upper_bound(v.begin(), v.end(), r );
  // [l,r) change upper -> lower
  return R-L;
}

bool so[1000001];

int mod_pow(int x,int n){
  int res=1;
  while(n){
    if(n%2) res=res*x%mod;
    x=x*x%mod;
    n/=2;
  }
  return res;
}

int divi(int a,int b){
  return a * mod_pow(b,mod-2) % mod;
}

signed main(){
  int n,a[10000];
  vector<int> v;
  cin>>n;
  for(int i=0;i<n;i++)cin>>a[i];
 
  for(int i=2;i*i<=100000;i++)
    if(!so[i])for(int j=2;i*j<=1000000;j++)so[i*j]=1;
  for(int i=2;i<=1000000;i++)if(!so[i])v.push_back(i);

  map<int,int> mp;

  for(int i=0;i<n;i++){
    int p=a[i];
    for(int j=0;v[j]*v[j]<=a[i];j++){
      int tc=0;
      while(p%v[j]==0)tc++,p/=v[j];
      if(tc)mp[v[j]]=max(mp[v[j]],tc);
    }
    if(p!=1)mp[p]=max(mp[p],(int)1);
  }
  int sek=1;
  for(auto x:mp)sek=sek*mod_pow(x.first,x.second)%mod;
  
  int ans=0;
  for(int i=0;i<n;i++){
    int p=a[i],sss=sek;
    for(int j=0;v[j]*v[j]<=a[i];j++){
      while(p%v[j]==0)p/=v[j],sss=divi(sss,v[j]);
    }
    if(p!=1)sss=divi(sss,p);
    ans=(ans+sss)%mod;
  }

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


Measured memory_bytes: 2676
import sys
readline = sys.stdin.readline
from collections import defaultdict
dic = defaultdict(int)

N = int(readline())
for i in range(N):
  s = readline().rstrip()
  dic["".join(sorted(s))] += 1

ans = 0
for v in dic.values():
  ans += (v * (v - 1)) // 2
  
print(ans)


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

int main(){
    ll X;
    cin >> X;
    ll n = X/100;
    ll m = X - 100*n;
    if(m <= 5*n)cout << 1 << endl;
    else cout << 0 << endl;
    return 0;
}

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

const long long MOD = 1000000007;
map<char,ll> m;
void solve(long long N, std::string S){
    for(auto&& i : S)
    {
        if(m.count(i)){
            m[i]++;
        }else{
            m[i]=1;
        }
    }
    ll ans=1;
    for(auto&& i : m)
    {
        ans*=i.second+1;
        ans%=MOD;
    }
    cout<<ans-1<<endl;
    
}

int main(){
    long long N;
    scanf("%lld",&N);
    std::string S;
    std::cin >> S;
    solve(N, S);
    return 0;
}


Measured memory_bytes: 1020
using System;
using System.Collections.Generic;
using System.Linq;
using static AtCoder.Io;

namespace AtCoder
{
    class Program
    {
        static void Main()
        {
            var s = ReadString();
            Console.WriteLine(s.LastIndexOf('Z') - s.IndexOf('A') + 1);
        }
    }

    public static class Io
    {
        public static string ReadString() => Console.ReadLine();
        public static string[] ReadStringArray() => ReadString().Split(' ');
        public static int ReadInt() => int.Parse(ReadString());
        public static long ReadLong() => long.Parse(ReadString());
        public static int[] ReadIntArray() => ReadStringArray().ParseInt().ToArray();
        public static long[] ReadLongArray() => ReadStringArray().ParseLong().ToArray();
        public static IEnumerable<int> ParseInt(this IEnumerable<string> source) => source.Select(int.Parse);
        public static IEnumerable<long> ParseLong(this IEnumerable<string> source) => source.Select(long.Parse);
    }
}


Measured memory_bytes: 13664
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = a; i < n; i++)
#define repr(i, a, n) for (int i = n - 1; i >= a; i--)
using namespace std;
using ll = long long;
using P = pair<int, int>;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }

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

  int n;
  cin >> n;
  vector<vector<int>> f(n, vector<int>(10)), p(n, vector<int>(11));
  rep(i, 0, n) rep(j, 0, 10) cin >> f[i][j];
  rep(i, 0, n) rep(j, 0, 11) cin >> p[i][j];

  ll ans = -1e18;
  rep(i, 1, 1 << 10) {
    vector<int> v(n);
    rep(j, 0, 10) {
      if (i >> j & 1) {
        rep(k, 0, n) { v[k] += f[k][j]; }
      }
    }
    ll sumv = 0;
    rep(k, 0, n) { sumv += p[k][v[k]]; }
    chmax(ans, sumv);
  }

  cout << ans << endl;
}


Measured memory_bytes: 256
import sys
from collections import deque
def input():
    return sys.stdin.readline()[:-1]
n,q = map(int, input().split())
A = deque()
for _ in range(n):
    a,b = input().split()
    A.append([a,int(b)])

t = 0
while True:
    a,b = A.popleft()
    if b > q:
        b = b - q
        t += q
        A.append([a,b])
    else:
        t += b
        print(f'{a} {t}')
    if len(A)==0:
        break



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

typedef long long ll;
ll n, ans, s[20][20];
ll h(ll p) {
	while (p >= 10) p /= 10;
	return p;

}
int main()
{
	ll i, j;
	cin >> n;
	for (i = 1; i <= n; i++) {
		s[h(i)][i % 10]++;
	}
//	for (i =0; i <= 9; i++) {
//		for (j = 0; ; j++) {
//			if (j * 10 + i > n) break;
//			s[h(j)][i]++;
//		}
//	}
	for (i = 1; i <= n; i++) {
		j = i;
		while (j >= 10) {
			j /= 10;
		}
		ans += s[i % 10][j];
	}
	cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;

long long fact[100010];

void init(){

    fact[0] = 1;

    for(long long i = 1; i <= 100000; i++){
        fact[i] = fact[i - 1] * i;
        fact[i] %= MOD;
    }
}

int main(){

    init();

    long long n, m; cin >> n >> m;
    if((int)abs(n - m) > 1) return !printf("0\n");
    else if(n == m){
        //n! * m! * 2
        cout << (fact[n] * fact[m] * 2) % MOD << endl;
    }else{
        //n! * m!
        cout << (fact[n] * fact[m]) % MOD<< endl;        
    }
}

Measured memory_bytes: 1024
N, K = map(int, input().split())
p = list(map(int, input().split()))

r = 0
c = 0
pre = [None] * len(p)

for i, x in enumerate(p):
    a = (x + 1)/2
    pre[i] = a
    c += a
    if i - K >= 0:
        c = c - pre[i - K]
    if c > r:
        r = c
print(r)

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

int main(){
    int X;
    cin >> X;
    int joy = 0;
    while(X >= 500){
        X -= 500;
        joy += 1000;
    }
    while(X >= 5){
        X -= 5;
        joy += 5;
    }
    cout << joy << endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int n;
int k;
ll a[100005],b[100005];

ll get(int bit){
	ll ans=0;
	for(int i=0;i<n;i++){
		if((a[i]|bit)==bit)ans+=b[i];
	}
	return ans;
}

int main(void){
	scanf("%d%d",&n,&k);
	int sum=0;
	ll res=0;
	for(int i=0;i<n;i++){
		scanf("%lld%lld",&a[i],&b[i]);
		res+=b[i];
		sum=sum|a[i];
	}
	if(sum<=k){
		printf("%lld\n",res);
	}else{
		ll ans=get(k);
		for(int i=0;i<30;i++){
			if(k>>i & 1){
				int nbit=0;
				for(int j=0;j<30;j++){
					if((k>>j & 1) && i!=j)nbit+=(1<<j);
					else if(i>j)nbit+=(1<<j);
				}
				ans=max(ans,get(nbit));
			}
		}
		printf("%lld\n",ans);
	}
	return 0;
}

Measured memory_bytes: 1792
import math

menu = [int(input()) for i in range(5)]
sort_base = [1,2,3,4,5,6,7,8,9,0]
sort = []

for i in sort_base:
    for j in range(5):
        if menu[j] % 10 == i:
            sort.append(menu[j])

sort = sort[::-1]
time = 0

for i in range(4):
    time = time + (math.ceil(sort[i]/10) * 10)

time = time + sort[4]
print(time)


Measured memory_bytes: 3064
#include<cstdio>
#include<algorithm>
using namespace std;
#define MAXN 100010
#define MO 1000000007
#define LL long long
int n,cnt[26];
char s[MAXN];
int main()
{
	scanf("%d%s",&n,s);
	for(int i=0;i<n;i++) cnt[s[i]-'a']++;
	LL t1=0,t2=0;
	for(int i=0;i<8192;i++)
	{
		LL tmp1=1,tmp2=1;
		for(int j=0;j<13;j++)
			if((i>>j)&1) (tmp1*=cnt[j])%=MO,(tmp2*=cnt[j+13])%=MO;
		(t1+=tmp1)%=MO;(t2+=tmp2)%=MO;
	}
	t1=(t1*t2%MO-1+MO)%MO;
	printf("%lld\n",t1);
}

Measured memory_bytes: 256
N, T = list(map(int, input().split()))
t = list(map(int, input().split()))
if N == 1:
	print(T)
else:
	s = T
	for i in range(1, N):
		if t[i] - t[i - 1] >= T:
			s += T
		else:
			s += t[i] - t[i - 1]

	print(s)

Measured memory_bytes: 25200
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <numeric>
#include <cmath>
#include <tuple>
#include <bitset>

#define push emplace_back
#define each(i, x) for (auto i=0; i < x; i++)
using ull = unsigned long long;

using namespace std;
template <typename T> inline void dump(const T& x) { cout << "[" << x << "]" << endl; }
template <typename T> inline void dump(const vector<T>& x) { for (const auto v : x) { cout << v << " "; } cout << endl; }
template <typename T> inline void sort_asc(vector<T>& x) { std::sort(x.begin(), x.end()); }
template <typename T> inline void sort_desc(vector<T>& x) { std::sort(x.begin(), x.end(), greater<T>()); }

int main() {
  int n, m, c;
  vector<int> b;
  vector<vector<int>> a;
  cin >> n >> m >> c;

  each(i, m) {
    int tmp;
    cin >> tmp;
    b.push(tmp);
  }

  auto result = 0;
  each(i, n) {
    vector<int> ttt;

    auto r = 0;
    each(j, m) {
      int tmp;
      cin >> tmp;
      r += tmp * b[j];
    }

    if ((r + c) <= 0) {
    } else {
      result++;
    }
  }

  cout << result << endl;

  return 0;
}


Measured memory_bytes: 256
n=int(raw_input())
if n==1:
    print 1
    exit()
a=map(int,raw_input().split())
cnt=0
i=0
f=0
while i<n-1:
    if a[i]==a[i+1]:
        f=1
        i+=1
        continue
    elif a[i]<a[i+1]:
        while i<n-1 and a[i]<=a[i+1]:
            i+=1
    else:
        while i<n-1 and a[i]>=a[i+1]:
            i+=1
    f=0
    cnt+=1
    if i==n-2:
        cnt+=1
        break
    i+=1
if f==1:cnt+=1
print cnt


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

int main(){
int n,a,b;
cin >> n >> a >> b;
int ans =0;
for(int i=1;i<=n;i++){
    int k =i;
    int che =0;
    while(k>0){
        che+=k%10;
        k/=10;
    }
    if(che>=a&&che<=b)ans+=i;
}
cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for( int i = 0 ; i < n ; i++ )
typedef long long ll ;
int main() {
 
int N ;
cin >> N ;
vector<double> A(N) ;
  vector<string> S(N) ;
  double ans = 0 ;
rep(i,N){
  cin >> A.at(i) >> S.at(i) ;
  if(S.at(i) == "JPY" ) ans += A.at(i) ;
  else ans += (ll) 380000*A.at(i);
}
  cout << ans << endl;
  //rep(i,N) cout << A.at(i) << endl;
}

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

int main(){
  string S;
  cin>>S;
  for(int i=0;i<S.size()-1;i++){
    if(S[i]=='A'&&S[i+1]=='C'){
      cout<<"Yes"<<endl;
      return 0;
    }
  }
  cout<<"No"<<endl;
  return 0;
  
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#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 ALL(a) a.begin(), a.end()
#define pii pair<int,int>
#pragma GCC optimize("Ofast")
#define pcnt __builtin_popcount
#define buli(x) __builtin_popcountll(x)
#define pb push_back
#define mp make_pair
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
template<class T>bool chmax(T &a, const T &b) {if(a<b){a = b; return 1;} return 0; };
template<class T>bool chmin(T &a, const T &b) {if(a>b){a = b; return 1;} return 0; };
inline void IN(void){return;}
template <typename First, typename... Rest> void IN(First& first, Rest&... rest){cin >> first;IN(rest...);return;}
inline void OUT(void){cout << "\n";return;}
template <typename First, typename... Rest> void OUT(First first, Rest... rest){cout << first << " ";OUT(rest...);return;}
const double EPS = 1e-9;
const int mod = 1e9 + 7;
long long lcm(ll a, ll b){return a * b / __gcd(a,b);}
struct IoSetup { IoSetup() {
    cin.tie(nullptr);ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    cerr << fixed << setprecision(10);
} } iosetup;
template< int mod > struct ModInt {
    int x; ModInt() : x(0) {}
    ModInt(int64_t y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}
    ModInt &operator+=(const ModInt &p) {if((x += p.x) >= mod) x -= mod;return *this;}
    ModInt &operator-=(const ModInt &p) {if((x += mod - p.x) >= mod) x -= mod;return *this;}
    ModInt &operator*=(const ModInt &p) {x = (int) (1LL * x * p.x % mod);return *this;}
    ModInt &operator/=(const ModInt &p) {*this *= p.inverse();return *this;}
    ModInt operator-() const { return ModInt(-x); }
    ModInt operator+(const ModInt &p) const { return ModInt(*this) += p; }
    ModInt operator-(const ModInt &p) const { return ModInt(*this) -= p; }
    ModInt operator*(const ModInt &p) const { return ModInt(*this) *= p; }
    ModInt operator/(const ModInt &p) const { return ModInt(*this) /= p; }
    bool operator==(const ModInt &p) const { return x == p.x; }
    bool operator!=(const ModInt &p) const { return x != p.x; }
    ModInt inverse() const {int a = x, b = mod, u = 1, v = 0, t;
    while(b > 0) { t = a / b; swap(a -= t * b, b); swap(u -= t * v, v); }return ModInt(u);}
    ModInt pow(int64_t n) const {ModInt ret(1), mul(x); while(n > 0) {if(n & 1) ret *= mul;mul *= mul;n >>= 1;}return ret;}
    friend ostream &operator<<(ostream &os, const ModInt &p) { return os << p.x;}
    friend istream &operator>>(istream &is, ModInt &a) { int64_t t; is >> t; a = ModInt< mod >(t); return (is); }
    static int get_mod() { return mod; }
}; using modint = ModInt< mod >;
const string YES = "Yes";
const string NO = "No";

void solve(long long N, long long M){
    if(N == M) cout << YES << endl;
    else cout << NO << endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    scanf("%lld",&N);
    long long M;
    scanf("%lld",&M);
    solve(N, M);
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
 int N;
  //int a[300010];
  cin >> N;
  int a[3*N];
  for (int i = 0; i < 3*N; i++) cin >> a[i];
  sort(a, a+3*N, greater<int>());
  //reverse(a, a+3*N);
  long int sum = 0;
  for (int i = 0; i < N; ++i) {
    sum += a[i*2+1];
    //cout << a[i] << endl;
  }
  cout << sum << endl;
  
  return 0;
}

Measured memory_bytes: 1408
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;

vector<int> v[111111];
int dfs(int u,int fa)
{
	int i,s,sg;
	s=v[u].size();
	sg=0;
	for(i=0;i<s;i=i+1){
		if(v[u][i]!=fa)
			sg^=dfs(v[u][i],u);
	}
	return sg+1;
}

int main()
{
	int n,i,x,y;
	cin>>n;
	for(i=1;i<n;i=i+1){
		cin>>x>>y;
		v[x].push_back(y);
		v[y].push_back(x);
	}
	if(dfs(1,0)==1)
		cout<<"Bob\n";
	else
		cout<<"Alice\n";
	return 0;
}

Measured memory_bytes: 10624
n = int(input())

li = []
dire = 0

for i in range(n):
  x, y = map(int,input().split())
  li.append((x, y))
  
for j in range(n):
  for k in range(n):
    dire += ((li[j][0]-li[k][0]) ** 2 + (li[j][1]-li[k][1]) ** 2) ** 0.5

print(dire/n)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define dunk(a) cout << (a) << endl
#define rall(a) (a).rbegin(),(a).rend()
const int INF = 2e9;
using namespace std;
using Graph = vector<vector<int>>;
typedef pair<int,int> P;
typedef long long ll;

int main(){
    string s; cin >> s;

    bool jud = true;

    int left = (s.size()-1)/2;
    int right = (s.size()+3)/2;

    for(int i=0; i<= left - 1; i++){
        if(s[i] != s[left -1 -i]){
            jud = false;
        }
    }

    for(int i=right -1; i<s.size(); i++){
        if(s[i] != s[s.size() -1 -i]){
            jud = false;
        }
    }

    if(jud) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define all(v) v.begin(), v.end()
#define MOD 1000000009
const int INF = 1LL<<30;

int main() {
    string s;
    cin>>s;
    int n=s.size();

    rep(i,n){
        if(i+1>=n) continue;
        if(s[i]==s[i+1]){
            cout<<i+1<<" "<<i+2<<endl;
            return 0;
        }
        if(i+2>=n) continue;
        if(s[i]==s[i+2]){
            cout<<i+1<<" "<<i+3<<endl;
            return 0;
        }
    }

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

}

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

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl





using ll = long long;

const ll mod = 1e9+7;
const int maxn = 1e6 + 5;





int n, k;
int a[maxn], b[maxn];


int getf(int x) {
    int j=29;
    while (j>=0 && ((x>>j)&1)==0) j--;
    return j;
}

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

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

    assert(getf(5)==2);

    ll best = 0;

    {
	ll cur = 0;
	for (int i=0; i<n; i++) {
	    int x = a[i];
	    if ((x|k)==k) {
		cur += b[i];
	    }
	}

	best = max(best, cur);
    }

    

    {
	for (int j=getf(k); j>=0; j--) {
	    if (k>>j&1) {
		ll cur=0;
		for (int i=0; i<n; i++) {
		    if (getf(a[i])>getf(k) || (a[i]>>j&1)) {
			continue;
		    }
		    int mask = k>>(j+1);
		    int amask = a[i]>>(j+1);
		    if ((mask|amask)==mask) {
			cur += b[i];
		    }
		}
		best = max(best, cur);
	    }
	}
    }


    cout<<best<<endl;    
    return 0;
}


Measured memory_bytes: 4456
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
typedef double dd;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> ii;
typedef pair<ll, int> li;
typedef pair<int, ll> il;
typedef pair<ll , ll> lli;
typedef vector<ii> vii;
typedef vector<il> vil;
typedef vector<li> vli;
typedef vector<lli> vlli;
 
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define in insert
#define f0(b) for(int i=0;i<(b);i++)
#define f00(b) for(int j=0;j<(b);j++)
#define f1(b) for(int i=1;i<=(b);i++)
#define f11(b) for(int j=1;j<=(b);j++)
#define f2(a,b) for(int i=(a);i<=(b);i++)
#define f22(a,b) for(int j=(a);j<=(b);j++)
#define sf(a) scanf("%lld",&a)
#define sff(a,b) scanf("%lld %lld", &a , &b)
#define pf(a) printf("%lld\n",a)
#define pff(a,b) printf("%lld %lld\n", a , b)
#define PI 3.14159265359
#define bug printf("**!\n")
#define mem(a , b) memset(a, b ,sizeof(a))
#define front_zero(n) __builtin_clzll(n)
#define back_zero(n) __builtin_ctzll(n)
#define total_one(n) __builtin_popcountll(n)

const ll mod = (ll)1e9+7;
const ll maxn = (ll)2e5+5;
const int nnn = 1048590;
const int inf = numeric_limits<int>::max()-1;
//const ll INF = numeric_limits<ll>::max()-1;
const ll INF = 1e18;

ll dx[]={0,1,0,-1};
ll dy[]={1,0,-1,0};
ll dxx[]={0,1,0,-1,1,1,-1,-1};
ll dyy[]={1,0,-1,0,1,-1,1,-1};

void solve(){
	ll n;
	cin >> n;
	ll a[n+5];
	ll m = 0;
	f0(n) cin >> a[i] , m ^= a[i];
	for(ll i = 0; i < n; i++){
		ll ans= 0 ;
		for(ll j = 0; j <= 33; j++){
			if( ( (1LL << j) & a[i] ) != ( (1LL << j) & m  ) ) ans += (1LL << j);
		}
		cout << ans << ' ';
	}
	return;
}


int main() {
   
    ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
    ll T;
    T=1;
   // cin >> T;
    //scanf("%lld",&T);
    ll CT = 0;
    //work();
    while(T--){
    	//cout << "Case " << ++CT <<": " ;
    	//printf("Case %lld: ",++CT);
		solve();
	}
    
    return 0;
}


Measured memory_bytes: 5140
import java.util.*;
import java.io.*;
import java.math.*;
 
public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String s1 = sc.next();
        String s2 = sc.next();
        int k1 = sc.nextInt();
        int k2 = sc.nextInt();
        String s = sc.next();
        if(s.equals(s1)){
            System.out.println((k1-1) + " " + k2);
        }else{
            System.out.println(k1 + " " + (k2-1));
        }
    }
}

Measured memory_bytes: 22228
//#include <bits/stdc++.h>
//#include <stdio.h>
#include<iostream>
#include<cstdio>
#include<bitset>
#include<algorithm>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<string>
#include<string.h>
#include<cmath>
#include<utility>
#include<functional>
#include<map>
#include<set>
#include<cctype>
#include<fstream>


#define FOR(i, a, b) for( int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for( int i=(a);i>=(b);i--)
#define LFOR(i, a, b) for( long long int i=(a);i<=(b);i++)
#define LRFOR(i, a, b) for(long long int i=(a);i>=(b);i--)
#define MOD 1000000007
#define INF 1000000000 //2000000000
#define LLINF 1000000000000000000 //9000000000000000000
#define PI 3.14159265358979
#define MAXI 7500000

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

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



int main(void) {
	int a[5];
	int total = 0;
	int mini = 10;
	bool flag = false;

	FOR(i, 0, 4) {
		cin >> a[i];
		if (a[i] % 10 != 0) {
			mini = min(a[i] % 10, mini);
		}
		
	}

	FOR(i, 0, 4) {
		if (a[i] % 10 == mini && flag == false) {
			total += a[i];
			flag = true;
		}
		else {
			if (a[i] % 10 != 0) {
				total += a[i] + (10 - a[i] % 10);
			}
			else {
				total += a[i];
			}
		}

		//cout << total << endl;
	}

	cout << total << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>

using namespace std;

bool is_capital(char c) {
    return 'A' <= c && c <= 'Z';
}

string judge(string str) {
    string answer = "AC";
    if (str[0] != 'A' || is_capital(str[1]) || is_capital(str[str.size() - 1])) {
        answer = "WA";
    } else {
        int cnt = 0;
        for (int i = 2; i < str.size() - 1; ++i) {
            if (str[i] == 'C') {
                cnt++;
            } else if (is_capital(str[i]) || cnt > 1) {
                answer = "WA";
                break;
            }
        }
        if (cnt != 1) {
            answer = "WA";
        }
    }
    return answer;
}

int main() {
    string S; cin >> S; 
    cout << judge(S) << endl;
}


Measured memory_bytes: 256
// #pragma GCC optimize ("O3")
// #pragma GCC target ("sse4")

#include <bits/stdc++.h>
using namespace std;
const int INF = 1 << 29;
const int NINF = -1*INF;
const long long LLINF = 1ll << 60;
const long long LLNINF = -1*LLINF;

template <class Ch, class Tr, class Container>
basic_ostream <Ch, Tr> & operator << (basic_ostream <Ch, Tr> & os, Container const& x) {
    os << "{ ";
    for(auto& y : x) os << y << " ";
    return os << "}";
}

template <class X, class Y>
ostream & operator << (ostream & os, pair <X, Y> const& p) {
	return os << "[ " << p.first << ", " << p.second << "]" ;
}

typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int uint;
typedef long double ld;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<double> vd;
typedef vector<ld> vld;
typedef vector<pi> vpi;
typedef vector<pll> vpll;
typedef vector<vector<int>> vvi;
typedef vector<vll> vvll;
typedef vector<vd> vvd;
typedef vector<vld> vvld;
typedef uint_fast16_t fint16;
typedef uint_fast32_t fint32;
typedef uint_fast64_t fint64;
 
#define mp make_pair
#define pb push_back
#define pf push_front
#define all(x) x.begin(), x.end()
#define revAll(x) x.rbegin(), x.rend()
#define gcd(a, b) __gcd(a, b)
#define popcount(x) __builtin_popcount(x)
#define isize(x) (int)(x.size())
#define rep(i,n) for(int i = 0; i < n; i++)
#define exists(x,m) m.find(x) != m.end()
#define umap unordered_map
#define uset unordered_set
#define pq priority_queue

const ll MOD = 1e9 + 7;

struct DSU {
	int n;
	vi parent;
	vi size;

	DSU(int num_elements) {
		n = num_elements;
		size = vi(n, 1);
		parent = vi(n, 0);
		rep(i, n) parent[i] = i;
	}

	int find(int x) {
		if (parent[x] != x) {
			parent[x] = find(parent[x]);
		}
		return parent[x];
	}

	bool join(int x, int y) {
		int xs = find(x), ys = find(y);
		if (xs == ys) return false;
		if (size[xs] < size[ys]) swap(xs, ys);
		size[xs] += size[ys];
		parent[ys] = xs;
		return true;
	}

};

int main(){
	ios_base::sync_with_stdio(false);cin.tie(0);
	int n, m; cin >> n >> m;
	DSU dsu = DSU(n);
	rep(i, m) {
		int u, v; cin >> u >> v;
		u--, v--;
		dsu.join(u, v);
	}
	vi components = vi(n, 0);
	rep(city, n) {
		components[dsu.find(city)] = 1;
	}
	int num_components = 0;
	for (const int& c : components) num_components += c;
	cout << num_components - 1;
}

Measured memory_bytes: 4496
def solve()
  n = gets.to_i
  b = gets.split.map!(&:to_i)
  sum = 0
  arr = []
  arr.push(b[0])
  (1..n-2).each do |i|
    arr.push([b[i-1], b[i]].min)
  end
  arr.push(b[n-2])
  p arr.inject(:+)
end
solve()

Measured memory_bytes: 1788
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String S = sc.next();
    int A=Integer.parseInt(S.substring(0,1));
    int B=Integer.parseInt(S.substring(1,2));
    int C=Integer.parseInt(S.substring(2,3));
    int D=Integer.parseInt(S.substring(3,4));
    int tar=7-A;
    String cA=S.substring(0,1);
    String cB=S.substring(1,2);
    String cC=S.substring(2,3);
    String cD=S.substring(3,4);
    if(B+C+D==tar){
      System.out.println(cA+"+"+cB+"+"+cC+"+"+cD+"=7");
      return;
    }else if(B+C-D==tar){
      System.out.println(cA+"+"+cB+"+"+cC+"-"+cD+"=7");
      return;
    }else if(B-C+D==tar){
      System.out.println(cA+"+"+cB+"-"+cC+"+"+cD+"=7");
      return;
    }else if(B-C-D==tar){
      System.out.println(cA+"+"+cB+"-"+cC+"-"+cD+"=7");
      return;
    }else if(-B+C+D==tar){
      System.out.println(cA+"-"+cB+"+"+cC+"+"+cD+"=7");
      return;
    }else if(-B+C-D==tar){
      System.out.println(cA+"-"+cB+"+"+cC+"-"+cD+"=7");
      return;
    }else if(-B-C+D==tar){
      System.out.println(cA+"-"+cB+"-"+cC+"+"+cD+"=7");
      return;
    }else if(-B-C-D==tar){
      System.out.println(cA+"-"+cB+"-"+cC+"-"+cD+"=7");
      return;
    }
    
    
    

  }
    


  
}


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

using namespace std;
const int INF = 1e9 + 5;

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

	vector<int> h(n);

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

	vector<int> dp(n, INF);
	dp[0] = 0;

	for(int i = 0; i < n; i++)
	{
		for(int j : {i + 1, i + 2})
		{
			if(j < n)
			{
				dp[j] = min(dp[j], dp[i] + abs(h[i] - h[j]));
			}
		}
	}

	cout << dp[n - 1] << "\n";
}

Measured memory_bytes: 3996
#include<stdio.h>
int main(){
int x,y=1,a;
while(1){
scanf("%d%d\n",&x,&y);
if(x==0 && y==0){break;}
else if(x>y)printf("%d %d\n",y,x);
else printf("%d %d\n",x,y);
}
return 0;
}


Measured memory_bytes: 1992
#include <bits/stdc++.h>
#define For(i, l, r) for(register int i = (l), i##end = (int)(r); i <= i##end; ++i)
#define Fordown(i, r, l) for(register int i = (r), i##end = (int)(l); i >= i##end; --i)
#define Set(a, v) memset(a, v, sizeof(a))
using namespace std;

inline bool chkmin(int &a, int b) {return b < a ? a = b, 1 : 0;}
inline bool chkmax(int &a, int b) {return b > a ? a = b, 1 : 0;}

inline int read() {
    int x = 0, fh = 1; char ch = getchar();
    for (; !isdigit(ch); ch = getchar()) if (ch == '-') fh = -1;
    for (; isdigit(ch); ch = getchar()) x = (x * 10) + (ch ^ 48);
    return x * fh;
}

void File() {
	freopen ("paint.in", "r", stdin);
	freopen ("paint.out", "w", stdout);
}

const int N = 300010;

int w, h, n;

struct Segment_Tree {
	int maxv[N << 2], add[N << 2];

	void Init() { Set(maxv, 0); Set(add, 0); }

	void Update(int o, int l, int r, int ul, int ur, int uv) {
		if (ul <= l && r <= ur) { maxv[o] += uv; add[o] += uv; return ; }
		int mid = (l + r) >> 1;
		if (ul <= mid) Update(o << 1, l, mid, ul, ur, uv);
		if (ur > mid) Update(o << 1 | 1, mid + 1, r, ul, ur, uv);
		maxv[o] = max(maxv[o << 1], maxv[o << 1 | 1]) + add[o];
	}
} T;

typedef pair<int, int> PII;
#define x first
#define y second
#define mp make_pair
PII lt[N];
PII sta[N], stb[N];
int topa, topb;

int ans = 0;

void Work() {
	sort(lt + 1, lt + 1 + n);

	T.Init();
	topa = topb = 0;

	For (i, 1, n - 1) {
		if (lt[i].y <= h / 2) {
			int Next = i - 1;
			while (topa && lt[i].y > sta[topa].y) {
				T.Update(1, 1, n, sta[topa].x, Next, sta[topa].y - lt[i].y);
				Next = sta[topa].x - 1; -- topa;
			}
			if (Next != i - 1) sta[++ topa] = mp(Next + 1, lt[i].y);
		} else {
			int Next = i - 1;
			while (topb && lt[i].y < stb[topb].y) {
				T.Update(1, 1, n, stb[topb].x, Next, lt[i].y - stb[topb].y);
				Next = stb[topb].x - 1; -- topb;
			}
			if (Next != i - 1) stb[++ topb] = mp(Next + 1, lt[i].y);
		}
		sta[++ topa] = mp(i, 0);
		stb[++ topb] = mp(i, h);

		T.Update(1, 1, n, i, i, h - lt[i].x);
		chkmax(ans, T.maxv[1] + lt[i + 1].x);
	}
}

int main () {
	w = read(); h = read(); n = read();
	For (i, 1, n) {
		lt[i].x = read();
		lt[i].y = read();
	}
	lt[++ n] = mp(0, 0);
	lt[++ n] = mp(w, h);
	Work();

	For (i, 1, n)
		swap(lt[i].x, lt[i].y);
	swap(w, h);
	Work();

	printf ("%d\n", ans << 1);
    return 0;
}

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

int main()
{
  int N ;
  cin>>N ;
  string S=to_string(N) ;
  
  int sum_N=0 ;
  for(int i=0;i<S.size();i++) sum_N+=(S.at(i)-'0') ;
  
  if(N%sum_N==0) cout<<"Yes"<<endl ;
  else cout<<"No"<<endl ;
  
  return 0 ;
}


Measured memory_bytes: 256
#include <cstring>
#include <iostream>
using namespace std;
int a[1050],b[1050],p[1050];
int main()
{
	int n,m;
	cin >> n >> m;
	memset(p,0,sizeof(p));
	for(int i=1;i<=n;i++)
	{
		cin >> a[i];
	}
	for(int i=1;i<=m;i++)
	{
		cin >> b[i];
	}
	for(int i=1;i<=m;i++)
	{
		int c;
		for(int j=1;j<=n;j++)
		{
			if(a[j]>b[i])continue;
			c=j;
			break;
		}
		p[c]++;
	}
	int ans;
	int mx=-1;
	for(int i=1;i<=n;i++)
	{
		if(mx<p[i])
		{
			mx=p[i];
			ans=i;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1172
#include "bits/stdc++.h"
#define in std::cin
#define out std::cout
#define rep(i,N) for(int i=0;i<N;++i)
typedef long long int LL;

std::vector<std::vector<LL>>comb;
void make_comb(LL size)
{
	comb.resize(size + 1);
	rep(i, comb.size())
	{
		comb[i].resize(size + 1);
		comb[i][0] = 1;
		comb[i][i] = 1;
	}
	for (LL k = 1; k < comb.size(); ++k) for (LL j = 1; j < k; ++j) comb[k][j] = comb[k - 1][j - 1] + comb[k - 1][j];
}

int main()
{
	LL N, A, B;
	in >> N >> A >> B;
	std::vector<LL>v(N);
	rep(i, N) in >> v[i];

	std::map<LL, LL>sum;
	std::sort(v.begin(), v.end(), std::greater<LL>());
	rep(i, N) ++sum[v[i]];

	long double avg = 0;
	std::map<LL, LL>cnt;
	LL num = 0;
	rep(i, A)
	{
		avg += v[i];
		++cnt[v[i]];
	}
	avg /= A;
	make_comb(N);

	num += comb[sum[v[A - 1]]][cnt[v[A - 1]]];
	for (int i = A; i < B; ++i)
	{
		auto prev_avg = avg;
		avg *= i;
		avg += v[i];
		avg /= (i + 1);
		if (avg < prev_avg)
		{
			avg = prev_avg;
			break;
		}
		++cnt[v[i]];
		num += comb[sum[v[i]]][cnt[v[i]]];
	}

	out << std::fixed << std::setprecision(6);
	out << avg << std::endl << num << std::endl;
	return 0;
}


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

int main (void) {
    long long r, g, b, n;
    long long ans = 0;

    cin >> r >> g >> b >> n;
    for (int i = 0; i <= n; i += r) {
        for (int j = 0; j <= n; j += g) {
            if (i + j > n) break;
            if ((n - i - j) % b == 0) ans++;
        }
    }
    printf("%lld\n", ans);
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <cstring>

using namespace std;
int main() {
	int n;
	cin >> n;
	int p=0, w=0,y=0,g=0;
	for(int i=0; i<n; i++){
		char c;
		cin >> c;
		if(c == 'W') w=1;
		if(c == 'Y') y=1;
		if(c == 'P') p=1;
		if(c == 'G') g=1;
	}
	if(w+y+p+g == 3) cout << "Three" << endl;
	else cout << "Four" << endl;
	return 0;
}

Measured memory_bytes: 256
d,e=[list(map(int,input().split()))for _ in range(2)];e[3],e[4]=e[4],e[3]
t=0
for i in range(6):
 m={0:'012345',1:'152304',2:'215043',3:'310542',4:'402351',5:'513240'}[i]
 f=[d[int(j)]for j in m];f[3],f[4]=f[4],f[3]
 if f[0]==e[0]:
  f=f[1:5]*2
  for j in range(4):
   if f[j:j+4]==e[1:5]:t=1
print(('No','Yes')[t==1])

Measured memory_bytes: 5604
import math

x = input()
list = x.split()
list_i =[float(s) for s in list]

a = list_i[0]
b = list_i[1]
theta = list_i[2]

sintheta = math.sin(math.radians(theta))
costheta = math.cos(math.radians(theta))

S = 0.5 * a * b * sintheta
h = b * sintheta
l = a ** 2 + b ** 2 - 2 * a * b * costheta
l2 = l ** 0.5
L = a + b + l2

S = str(S)
L = str(L)
h = str(h)

k = " "
ans = S + k + L + k + h
print(ans)


Measured memory_bytes: 5716
#include<bits/stdc++.h>
// #include <boost/lexical_cast.hpp>
using namespace std;

#define ll long long int
#define vll vector<ll>
#define vllv vector<vector<ll>> 
#define vpii vector<pair<ll,ll>>
#define sz size()
#define pb push_back
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
#define allr(v) v.rbegin(),v.rend()
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
ll MOD=1000000000+7;


void solve()
{
	/*ll h,w,k;
	vector<string> s;
	for(ll i=0;i<n;i++)
		cin>>s;*/
	ll n;
	cin>>n;
	vll a(n);
	for(ll i=0;i<n;i++)
		cin>>a[i];
	sort(all(a));
	ll ans=0;
	ans+=a[n-1];
	
	ll k=n-2;
	
	ll c=n-2;
	while(1)
	{
		if(c==0)
			break;
		if(c>1)
		{
			// cout<<a[k]<<" ";
			ans+=(2*a[k]);
			k--;
			c-=2;
			if(c==0)
				break;
		}
		else if(c==1)
		{
			// cout<<a[k]<<" ";
			ans+=a[k];
			k--;
			break;
		}
		
	}
	cout<<ans;
	return;
}  
int main()
{
	fast;
    ll q;
    q=1;
    // cin>>q;
    while(q--)
    {
        solve();
    }
    return 0;
}

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

int main(void){
    int n;
    cin >> n;
    bool jud = true;
    for (int i = 0; i < n; i++) {
        int a;
        cin >> a;
        if (a % 2 == 0) {
            if (a % 3 != 0 && a % 5 != 0) {
                jud = false;
                break;
            }
        }
    }
    cout << (jud ? "APPROVED" : "DENIED") << endl;
}


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

const int MAX = 36;

struct poker {
	char suit;
	int value;
};

poker C[MAX];
poker D[MAX];
int N;

void BubbleSort(poker C[], int n)
{
	int isSorted = 0;
	bool flag = true;
	while (flag)
	{
		flag = false;
		for (int j = n - 1; j > isSorted; --j)
		{
			if (C[j].value < C[j - 1].value)
			{
				swap(C[j], C[j - 1]);
				flag = true;
			}
		}
		isSorted++;
	}
}

void SelectionSort(poker C[], int n)
{
	int minj;
	for (int i = 0; i < n - 1; ++i)
	{
		minj = i;
		for (int j = i + 1; j < n; ++j)
		{
			if (C[j].value < C[minj].value) minj = j;
		}
		if (minj != i) swap(C[minj], C[i]);
	}
}

void Print(poker C[], int n)
{
	for (int i = 0; i < n; ++i)
	{
		if (i) cout << ' ';
		cout << C[i].suit << C[i].value;
	}
	cout << endl;
}

int main()
{
	cin >> N;
	string p;
	bool isStable = true;
	for (int i = 0; i < N; ++i)
	{
		cin >> p;
		C[i].suit = p[0];
		C[i].value = stoi(p.substr(1));
		D[i].suit = p[0];
		D[i].value = stoi(p.substr(1));
	}
	BubbleSort(C, N);
	Print(C, N);
	cout << "Stable" << endl;
	SelectionSort(D, N);
	Print(D, N);
	for (int i = 0; i < N; ++i)
	{
		if (D[i].suit != C[i].suit) isStable = false;
	}
	if (isStable) cout << "Stable" << endl;
	else cout << "Not stable" << endl;

	return 0;
}


Measured memory_bytes: 3172
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REPLL(i, n) for (ll i = 0; i < (ll)(n); i++)
using namespace std;
template<class T>inline bool chmax(T &a, const T &b){if(a < b){a = b; return 1;}return 0;}
template<class T>inline bool chmin(T &a, const T &b){if(a > b){a = b; return 1;}return 0;}
typedef long long ll;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N, A, B; cin >> N >> A >> B;
  int ans = 0;
  REP(i, N+1){
    int tmp = i;
    int res = 0;
    while(tmp > 0){
      res += tmp%10;
      tmp /= 10;
    }
    if(res >= A && res <= B){
      ans += i;
    }
  }
  cout << ans << endl;
}


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

const int Maxn = 100005;

int n;
int dp[Maxn];

int main()
{
	scanf("%d", &n);
	for (int i = 1; i <= n; i++) {
		dp[i] = dp[i - 1] + 1;
		for (int j = 6; j <= i; j *= 6)
			dp[i] = min(dp[i], dp[i - j] + 1);
		for (int j = 9; j <= i; j *= 9)
			dp[i] = min(dp[i], dp[i - j] + 1);
	}
	printf("%d\n", dp[n]);
	return 0;
}

Measured memory_bytes: 640
#include "bits/stdc++.h"
#define REP(i, m, n) for(long long i = m; i < n; ++i)
#define CO(n) cout << n << endl
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

int N,K;
int p[200000];
ll ans[200000];

int main()
{
    ios::sync_with_stdio(false);
    cin >> N >> K;
    REP(i,0,N) cin >> p[i];
    REP(i,0,K) ans[0] = ans[0] + 1 + p[i];
    REP(i,0,N-K) ans[i+1] = ans[i] - p[i] + p[K+i];
    // REP(i,0,N-K+1) CO(ans[i]);
    ll M=0;
    REP(i,0,N-K+1) M = max(M, ans[i]);
    cout << fixed << setprecision(10) << M/(long double)2 << endl;
    return 0;
}

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


const int N = 3e5 + 20;
const double pi = 3.141592653;
void fast()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}

int main()
{
    fast();
//cout<<fixed<<setprecision(6);
    ll a,b,c,m=0;
    cin>>a>>b>>c;
    if(a==5&&b==5&&c==7)
    {
        m++;
    }
    else if(a==5&&b==7&&c==5)
    {
        m++;
    }
   else  if(a==7&&b==5&&c==5)
    {
        m++;
    }
    if(m>0)
    {
        cout<<"YES\n";
    }
    else
    {
        cout<<"NO\n";
    }


}

























Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
using namespace std;
typedef long long ll;
int INF = (1LL << 30) - 1;
int MOD = 1e9+7;
main(){
    int N,A,B;
    cin >> N >> A >> B;
    cout << min(A,B) << " ";
    if(N - A >= B)cout << 0 << endl;
    else cout << - N + A + B << endl;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{   int n,num;
    char m;

    bool cards[4][13];
    for(int i=0;i<4;++i){
        for(int j=0;j<13;++j){
            cards[i][j]=false;
        }
    }
    cin >> n;
    for (int k=0;k<n;++k){
        cin >> m >> num;
        if(m=='S'){
            cards[0][num-1]=true;
        }
        else if(m=='H'){
            cards[1][num-1]=true;
        }
        else if(m=='C'){
            cards[2][num-1]=true;
        }
        else if(m=='D'){
            cards[3][num-1]=true;
        }
    }
    for(int l=0;l<4;++l){
            for (int x=0;x<13;++x){
                if(cards[l][x]==false){
                    if(l==0){
                        cout << 'S' << " "<< x+1<<endl;
                    }
                    if(l==1){
                        cout << 'H'<< " "<< x+1<<endl;
                    }
                    if(l==2){
                        cout << 'C'<< " "<< x+1<<endl;
                    }
                    if(l==3){
                        cout << 'D'<< " "<< x+1<< endl;
                    }


                }
            }

    }
}



Measured memory_bytes: 3088
#include <stdio.h>
int main()
{
    int a, b, c;
    scanf("%d %d %d",&a,&b,&c);
    if (a < b) {
        if(b < c) {
            printf("%d %d %d\n",a,b,c);
        } else if (a < c && c < b) {
            printf("%d %d %d\n",a,c,b); 
        } else {
            printf("%d %d %d\n",c,a,b);
        }
    } else {
        if (a < c) {
            printf("%d %d %d\n",b,a,c);
        } else if (b < c && c < a) {
            printf("%d %d %d\n",b,c,a);
        } else {
            printf("%d %d %d\n",c,b,a);
        }
    }
    return 0;
}


Measured memory_bytes: 2716
#include<iostream>
#include<vector>
#include<set>
#include<queue>
#include<algorithm>
#define rep(i,n) for(int i=0;i<n;i++)
#define WHITE 0
#define GRAY 1
#define BLACK 2

using namespace std;

typedef vector< set<int> > nodeList;

vector< vector<int> > bfs(nodeList& nodes)
{
    vector< vector<int> > group;
    int groupNum = -1;
    vector<int> color(nodes.size(), WHITE);
    color[0] = -1;

    //i=1~nまで繰り返す
      //iをしてんとしてbfsで探索
    for (int i = 1; i < nodes.size(); i++)
    {
        queue<int> q;
        if (color[i] == BLACK)continue;
        group.emplace_back();
        groupNum++;

        q.push(i);
        while (!q.empty())
        {
            int u = q.front(); q.pop();
            for (auto v : nodes[u])
            {
                if (color[v] == BLACK)continue;
                q.push(v);
                group[groupNum].emplace_back(v);
                color[v] = BLACK;
            }
        }
    }
    return group;
}

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

    if (m == 0)
    {
        cout << 1 << endl;
        return 0;
    }

    nodeList nodes(n + 1);
    rep(i, m)
    {
        int a, b;
        cin >> a >> b;
        set<int>::iterator itr1 = nodes[a].find(b);
        if (itr1 == nodes[a].end())
        {
            nodes[a].insert(b);
        }

        set<int>::iterator itr2 = nodes[b].find(a);
        if (itr2 == nodes[b].end())
        {
            nodes[b].insert(a);
        }
    }

    //グループ分け
    vector< vector<int> > group = bfs(nodes);

    //グループで最も人数が多いのを出力
    int ans = 0;
    rep(i, group.size())
    {
        ans = max(int(group[i].size()), ans);
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 33220
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<map>
#include<numeric>

using namespace std ;

#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) (r).begin(),(r).end()
#define gsort(st,en) sort((st),(en),greater<int>())
#define vmax(ary) *max_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl

#define rep(i,n) for(int i = 0; i < (n);++i)
#define repc(i,a,b) for(int i = (a);i <(b);++i)
#define repa(n,array) for(auto n :(array))

typedef long long ll ;
typedef vector<int> vi ;
typedef vector<ll> vl ;
//template<class Value>
//using dict = std::map< string, Value >;
typedef map<char,int> dict ;

constexpr int imax = ((1<<30)-1)*2+1 ;
constexpr int inf = 100000000;
double eps = 1e-10 ;

template <typename T>
T out(vector < T > v)
{
  for(size_t i = 0; i < v.size(); i++)
  {
    debug(v[i]);
  }
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  dict m;
  m['I'] = 1, m['V'] = 5, m['X'] = 10, m['L'] = 50, m['C'] = 100, m['D'] = 500, m['M'] = 1000 ;
  string str;
  bool flag = true;
  vi v(100,0),v2(100,0) ;
  int N,M,y;
  while(cin >> str){
    /*v = v2;
    repc(i,1,str.size()){
      if(m[str[i-1]] > m[str[i]]){
        flag = true ;
      }
      if(m[str[i-1]] < m[str[i]]){
        flag = false ;
      }
      if(flag){
        v[i-1] = m[str[i-1]] ;
      }
      else{
        v[i-1] = -m[str[i-1]] ;
      }
    }
    if(m[str[str.size()-2]] != m[str[str.size()-1]])
    {
      flag =!flag ;
    }
    if(flag){
      v[str.size()-1] = m[str[str.size()-1]] ;
    }
    else{
      v[str.size()-1] = -m[str[str.size()-1]] ;
    }
    cout << accumulate(all(v),0) << endl;*/
  m['I'] = 1, m['V'] = 5, m['X'] = 10, m['L'] = 50, m['C'] = 100, m['D'] = 500, m['M'] = 1000 ;
    y = 0, M = 1001;
    rep(i,str.size()){
      if(str[i] == 'I') N = 1;
      else if(str[i] == 'V') N = 5;
      else if(str[i] == 'X') N = 10;
      else if(str[i] == 'L') N = 50;
      else if(str[i] == 'C') N = 100;
      else if(str[i] == 'D') N = 500;
      else if(str[i] == 'M') N = 1000;
      if(N>M) y -= M*2;
      y += N ;
      M = N ;
    }
    cout << y << endl;
  }
  return 0;
}

Measured memory_bytes: 1188
n, m = map(int, input().split())
a = list(map(int, input().split()))
bc = [list(map(int, input().split())) for _ in range(m)]


import heapq
aa = a.copy()
heapq.heapify(aa)

f = False
bc.sort(key=lambda x:x[1], reverse=True)
for b, c in bc:
    for _ in range(b):
        x = heapq.heappop(aa)
        if x < c:
            heapq.heappush(aa, c)
        else:
            heapq.heappush(aa, x)
            f = True
            break
    if f:
        break

print(sum(aa))


Measured memory_bytes: 33856
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll mod=1000000007;
int main() {
	ll i,j,k,l,m,n,t;
	ios_base::sync_with_stdio(false);
  cin.tie(NULL);

  cin>>n>>m;
  string a[n];
  vector<vector<ll> > dp(n, vector<ll>(m, 0));

  dp[0][0] = 1;
  for (i = 0; i < n; i++)
  {
    cin>>a[i];
  }

  for (i = 0; i < n; i++){
    for (j = 0; j < m; j++){
      if(a[i][j] == '#'){
        continue;
      }
      if(i<n-1){
        dp[i + 1][j] = (dp[i + 1][j] + dp[i][j]) % mod;
      }
      if(j<m-1){
        dp[i][j + 1] = (dp[i][j + 1] + dp[i][j]) % mod;
      }
    }
  }

  cout << dp[n - 1][m - 1] << endl;

  return 0;
}

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

#define NEW(p,n){p=malloc((n)*sizeof(p[0]));if(p==NULL){printf("not enough memory\n");exit(1);};}
//pの型の変数n個の要素分のメモリを確保し、そのアドレスをpに代入するマクロ

#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define SWAP(type, x, y) do { type tmp = x; x = y; y = tmp; } while (0)

#define MOD 1000000007 

//昇順
int asc(const void* a, const void* b){
    return *(int*)a-*(int*)b;
}

int main(void){
    int N,M;
    scanf("%d%d",&N,&M);

    int* A;
    NEW(A,M);
    int N1=0;
    int* B;
    NEW(B,M)
    int N2=0;
    for(int i=0;i<M;i++){
        int a,b;
        scanf("%d%d",&a,&b);
        if(a==1){
            A[N1]=b;
            N1++;
        }
        if(b==N){
            B[N2]=a;
            N2++;
        }
    }
    qsort(A,N1,sizeof(int),asc);
    qsort(B,N2,sizeof(int),asc);

    int flg=0;
    int s=0;
    int t=0;
    while(s<N1 && t<N2){
        if(A[s]==B[t]){
            flg=1;
            break;
        }
        else if(A[s]<B[t]) s++;
        else t++;
    }

    if(flg) printf("POSSIBLE\n");
    else printf("IMPOSSIBLE\n");

    return 0;
}

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

typedef long long ll;
typedef unsigned long long ull;

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

  vector<ll> l(n);
  for (ll i = 0; i < n; ++i) {
    cin >> l[i];
  }
  sort(l.begin(), l.end());
  
  ll ans = 0;
  for (ll i = 0; i < n; ++i) {
    for (ll j = i+1; j < n; ++j) {
      ll a = l[i];
      ll b = l[j];

      ll bottom = max(a-b+1, ll(0));
      bottom = max(b-a+1, bottom);
      ll top = a+b;
      if (bottom > top) continue;

      auto itr = lower_bound(l.begin(), l.end(), bottom);
      if (itr == l.end()) continue;
      ll bottomIdx = distance(l.begin(), itr);
      
      itr = lower_bound(l.begin(), l.end(), top);
      ll topIdx = n-1;
      if (itr != l.end()) {
        topIdx = distance(l.begin(), itr) - 1;
      }

      bottomIdx = max(bottomIdx, j+1);
      ans += max(topIdx-bottomIdx+1, ll(0));
    }
  }

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

Measured memory_bytes: 384
#include <iostream>
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <cctype>
#include <string>
#include <map>
#include <set>
#include <math.h>
#include <cmath>
#define ll long long
#define lli long long int

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

int main(){

  ll X, K, D;
  cin >> X >> K >> D;

  X = abs(X);
  ll toZero = X / D + 1;
  if(toZero == K){
    cout << abs(X - toZero*D) << endl;;
  }else if(toZero >= K){
    cout << abs(X - K*D) << endl;;
  }else{
    if((K-toZero) % 2 == 0){
      cout << abs(X - toZero*D) << endl;
    }else{
      cout << abs(X - (toZero-1)*D) << endl;
    }
  }

  return 0;
}

Measured memory_bytes: 3544