akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		long x = sc.nextLong();
		long y = sc.nextLong();
		sc.close();

		System.out.println(Math.abs(x - y) > 1 ? "Alice" : "Brown");
	}
}


Measured memory_bytes: 23764
#include<bits/stdc++.h>
#define all(vec) vec.begin(),vec.end()
using namespace std;
typedef long long ll;
typedef pair<int,pair<int,int>> P;
const ll MOD=1000000007;
const ll INF=1000000010;
const ll LINF=4000000000000000010;
const double EPS=1e-9;
int dx[5]={0,1,0,-1,0};
int dy[5]={1,0,-1,0,0};
int main(){
    int n;cin>>n;
    int ans=0;
    int a[119];
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            ans=max(ans,abs(a[i]-a[j]));
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
import sys
def input():
    return sys.stdin.readline()[:-1]
n,m=map(int,input().split())
a=list(map(int,input().split()))
from fractions import gcd
ans=a[0]
flag=[0,0]
kou=a[0]
for i in range(1,n):
    kou=gcd(kou,a[i])
    ans = ans * a[i] // gcd(ans, a[i])
    if ans//2>m:
        print(0)
        quit()
# print(kou)
for i in range(n):
    if a[i]//kou%2==0:
        print(0)
        quit()
ans//=2
if ans>m:
    print(0)
else:
    print((m-ans)//(ans*2)+1)

Measured memory_bytes: 78612
import java.util.ArrayList;
import java.util.Collections;
import java.util.PriorityQueue;
import java.util.Scanner;
class Main{


	static final int MOD = 1000000007;


	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);			//文字の入力
		int N = sc.nextInt();
		int M = sc.nextInt();
	
		int[] a = new int[N];
		

		PriorityQueue<Integer> queue = new PriorityQueue<Integer>(Collections.reverseOrder());
		
		
		for(int i = 0;i < N;i++){
			a[i] = sc.nextInt();
			queue.offer(a[i]);
		}
		
		for(int i = 0;i < M;i++){
			int num = queue.poll()/2;
			queue.add(num);
		}
		
		long ans = 0;
		for(int i=0;i < N;i++){
			ans += queue.poll();
		}
		System.out.println(ans);
		

		




	}

	static void sieve(ArrayList<Long> list){
		int n = 50000000;
		boolean[] is_prime = new boolean[n+1];
		int[] prime = new int[n];
		for(int i= 0;i <=n;i++){
			is_prime[i] = true;
		}
		list.add((long) 1);
		for(int i = 2;i <= n;i++){
			if(is_prime[i]){
				list.add((long)i);
				for(int j = 2*i;j <= n;j+=i){
					is_prime[j] = false;
				}
			}
		}



	}




	static int upperbond(int k,int min,int[] data){		//kより小さい最大の値をdataの中から探し、返す二分探索
		int max = data.length;
		//		if(min == data.length-1){
		//			if(data[min] > k){
		//				return min;
		//			}
		//		}

		while(max-min > 1){
			int mid = (max+min)/2;
			if(data[mid] >= k){
				max = mid;
			}else{
				min = mid;
			}
		}

		return max;
	}

	static int lowerbond(int k,int min,int[] data){		//kより大きい最小の値をdataの中から探し、返す二分探索
		int max = data.length;

		while(max-min > 1){
			int mid = (max+min)/2;
			if(data[mid] >= k){
				max = mid;
			}else{
				min = mid;
			}
		}
		return min;
	}



	static int gcd(int a,int b){				//最大公約数を返す
		if(b == 0){
			return a;
		}else{
			return gcd(b, a%b);
		}
	}
	static long gcd(long a,long b){
		if(b == 0){
			return a;
		}else{
			return gcd(b, a%b);
		}
	}



	static long lcm (long a, long b) {
		long g = gcd(a,b);
		return a/g*b;
	}




}


class Edge extends ArrayList<P>{

}

class P{
	int to;
	long cost;
	P(int to,long cost){
		this.to = to;
		this.cost = cost;
	}
}


class Pair implements Comparable{
	int from;
	int end;
	@Override
	public int compareTo(Object other) {
		Pair otherpair = (Pair)other;

		return   from- otherpair.from;
	}








}






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

int main() {
	int n, t;
	cin >> n >> t;
	vector<vector<int>>ct(0, vector<int>(2));
	for (int i = 0; i < n; i++) {
		int c1, t1;
		cin >> c1 >> t1;
		if (t1 <= t)ct.push_back({ c1,t1 });
	}
	if (ct.size() == 0) {
		cout << "TLE" << endl;
		return 0;
	}
	sort(ct.begin(), ct.end());
	cout << ct.at(0).at(0) << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
const long long MD=1000000000+7;
char a[1001][1001];
long long f[1001][1001];
int w,h;
long long fd(int x,int y){
    if ((x<=0) || (x>h) || (y<=0) || (y>w) || (a[x][y]=='#') )
        return 0;
    else return f[x][y];
}
int main()
{
    cin>>h>>w;
    for (int i=1;i<=h;++i)
        for (int j=1;j<=w;++j)
            cin>>a[i][j];
    f[1][1]=1;
    for (int i=1;i<=h;++i){
        for (int j=1;j<=w;++j){
            if (a[i][j]=='.'){
            f[i][j]=fd(i-1,j)+fd(i,j-1)+f[i][j];
            f[i][j]=f[i][j] % MD;}
        }
    }
    cout<<f[h][w]%MD;
}


Measured memory_bytes: 9088
#https://atcoder.jp/contests/abc089/tasks/abc089_c
import itertools
N = int(input())
S = [input() for _ in range(N)]
M,A,R,C,H = 0,0,0,0,0
ans = 0
for s in S:
    if s[0] == "M":
        M +=1
    if s[0] == "A":
        A +=1
    if s[0] == "R":
        R +=1
    if s[0] == "C":
        C +=1
    if s[0] == "H":
        H +=1

for i,j,k in itertools.combinations([M,A,R,C,H],3):
    ans += i*j*k
print(ans)

Measured memory_bytes: 9772
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define FORR(i, m, n) for (int i = (m); i >= (n); --i)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const ll mod2 = 998244353;

int main() {
  ll a, b;
  cin >> a >> b;
  if (a == b) {
    cout << a << endl;
    return 0;
  }
  ll ans = 0;
  if (a % 2 == 1) {
    ans ^= a;
    a++;
  }
  if (b % 2 == 0) ans ^= b;
  if (b % 2 == 1) b++;
  ans ^= ((b-a)/2) % 2;
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define rep2(i, s, n) for (ll i = s; i < (ll)(n); i++)
#define repr(i, n) for (ll i = n; i >= 0; i--)
#define pb push_back
#define COUT(x) cout << (x) << endl
#define COUTF(x) cout << setprecision(15) << (x) << endl
#define ENDL cout << endl
#define DF(x) x.erase(x.begin())  // 先頭文字削除
#define ALL(x) x.begin(), x.end()
#define SORT(x) sort(ALL(x))
#define REVERSE(x) reverse(ALL(x))
#ifdef _DEBUG
#define debug(x) cout << "[debug] " << #x << ": " << x << endl
#else
#define debug(x)
#endif
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
constexpr ll INF = 0x3f3f3f3f3f3f3f3f;
constexpr double PI = 3.141592653589793238462643383279;
ll getDigit(ll x) {
  return x == 0 ? 1 : log10(x) + 1;
}

signed main() {
  ll A, B, K;
  cin >> A >> B >> K;
  ll ansA = A;
  ll ansB = B;
  ansA = A - K;
  if (ansA < 0) {
    ansA = 0;
  }

  if (A < K) {
    ansB = B - (K - A);
    if (ansB < 0) {
      ansB = 0;
    }
  }

  cout << ansA << " " << ansB << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define ALL(a)  (a).begin(),(a).end()
#define PI 3.14159265358979
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const ll mod = 1e9+7LL;

int main() {
  int X, N; cin >> X >> N;
  int ans = 0;

  vector<int> p(N);
  vector<int> rp(N);
  rep(i, N){
    cin >> p.at(i);
    rp.at(i) = p.at(i);
  }

  sort(p.begin(), p.end());
  sort(rp.begin(), rp.end());
  reverse(rp.begin(), rp.end());

  int l = X;
  int s = X-1;
  rep(i, N){
    if(l==p.at(i)) l++;
    if(s==rp.at(i)) s--;
  }
  if(l-X==X-s) cout << s << endl;
  else if(l-X>X-s) cout << s << endl;
  else cout << l << endl;
}

Measured memory_bytes: 3632
#include <iostream>
#include <string>
#include <vector>
using ll=long long;
using namespace std;

int main(){
    int N,K;
    cin>>N>>K;

    int ans=0;
    while(N!=0){
        N/=K;
        ans++;
    }
    cout<<ans<<endl;

    return 0;
}

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

#define REPI(x) for(int i=0;i<x;i++)
#define REPJ(x) for(int j=0;j<x;j++)

#define NMAX 100001
#define MMAX 200001

using namespace std;

int main ()
{
    int N,M,Abuf,Bbuf,el,d;
    vector<list <int> > connected(NMAX);
    bool visited[NMAX];
    int depth[NMAX];
    int res[NMAX];
    queue<int> q;

    cin >> N >> M;
    
    REPI(NMAX)
    {
        visited[i] = false;
        res[i] = 0;
    }
        
    // make graph of cave
    REPI(M)
    {
        scanf("%d %d",&Abuf,&Bbuf);
        connected[Abuf].push_back(Bbuf);
        connected[Bbuf].push_back(Abuf);
    }

    q.push (1);
    q.push (0);
    depth[1] = 0;
    d = 0;
    
    while(!q.empty())
    {
        el = q.front ();
        q.pop ();

        if (el == 0)
        {
            if(q.empty ())
                break;
            d++;
            q.push (0);
            continue;
        }
        if(visited[el])
            continue;
        else
        {
            visited[el] = true;
            depth[el] = d;
            auto itr = connected[el].begin ();
            while (itr != connected[el].end())
            {
                q.push (*itr);
                itr++;
            }
        }
    }

    for (int i=1;i<=N;i++)
    {
        auto itr = connected[i].begin ();
        while (itr != connected[i].end ()){
            el = *itr;
            if (res[el] ==  0 && depth[el] - depth[i] == 1)
            {
                res[el] = i;
            }
            itr++;
        }
    }
    
    printf("Yes\n");    
    
    for (int i=2;i<=N;i++){
        printf("%d\n",res[i]);
    }
    
    return 0;
}

Measured memory_bytes: 20184
#include <bits/stdc++.h>
using namespace std;
#define ll          long long int
#define pb          push_back
#define pll         pair<ll,ll>
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define mod         1000000007
#define inf         1000000000000000000LL
#define vl          vector<ll>
#define F           first
#define S           second
#define db          long double
#define sz(x)       (ll)x.size()
#define fix(n)      cout<<fixed<<setprecision(n)
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define all(x)      x.begin(),x.end()
#define pi          3.14159265358979323



void solve()
{
      ll a, b;
      cin>>a>>b;
      ll grid[101][101];
      memset(grid, 0, sizeof grid);
      for(ll i=1; i<=50; i++) for(ll j=1; j<=100; j++) grid[i][j]=0;  // white
      for(ll i=51; i<=100; i++) for(ll j=1; j<=100; j++) grid[i][j]=1; // black
      ll ac=1, bc=1;
      swap(a, b);
      for(ll i=1; i<=49; i+=2)
      {
              for(ll j=1; j<=100; j++)
              {
                     if(ac>=a) break;
                     if(j & 1) { grid[i][j]=1; ac++; }
              }
              if(ac>=a) break;
      }
      for(ll i=52; i<=100; i+=2)
      {
             for(ll j=1; j<=100; j++)
             {
                    if(bc >= b) break;
                    if(j&1) { grid[i][j] = 0; bc++; }
             }
             if(bc >= b) break;
      }
      //cout<<ac<<" "<<bc<<endl;
      cout<<100<<" "<<100<<endl;
      rep(i,1,101)
      {
             rep(j,1,101)
             {
                    if(grid[i][j]==1) cout<<"#";
                    else cout<<".";
             }
             cout<<endl;
      }
}


int main()
{
       speed_up;
       ll T=1;
       //cin>>T;
       while(T--) solve();
	return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
const int MOD=1000000007;
const int INF=1000000000;
using namespace std;
typedef long long ll;
typedef tuple<ll,int,int> tup;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vp;
int main(int argc,char const* argv[])
{
  int N,A,B,C,D;
  int umatobi=999999;
  cin >> N >> A >> B >> C >> D;
  string s;
  cin >> s;
  int stop=1000000;
  for(int i=0;i<N-1;i++)
    {
      if(s[i]=='#' && s[i+1]=='#') 
	{
	  stop=i+1;
	  break;
	}
    }
  //cout << stop << endl;
  if((stop<=C && A<=stop) || (stop<=D && B<=stop))
    {
      cout << "No" << endl;
      return 0;
    }
  if(C>D)
    {
      int BF=B;
      int BB=B-2;
      //cout << BB << ' ' << BF << endl;
      if(s[BF]=='#' || s[BB]=='#')
	{
	  for(int i=B-1;i<N-2;i++)
	    {
	      if(s[i]=='.' && s[i+1]=='.' && s[i+2]=='.')
		{
		  umatobi=i+2;
		  break;
		}
	    }
	  //cout << umatobi << endl;
	  if(umatobi<=D)
	    {
	      cout << "Yes" << endl;
	      return 0;
	    }
	  else
	    {
	      cout << "No" << endl;
	      return 0;
	    }
	}
      else
	{
	  cout << "Yes" << endl;
	  return 0;
	}
    }
  else
    {
      cout << "Yes" << endl;
      return 0;
    }
}


Measured memory_bytes: 640
K,X = list(map(int, input().split()))

max_ = X + (K-1)
min_ = X - (K-1)

res = ""
for i in range(min_, max_+1):
    if i <= 1000000 and i >= -1000000:
        res += (str(i) + " ")

print(res[:-1])


Measured memory_bytes: 3060
//INCLUDE
//------------------------------------------
#include <bits/stdc++.h>
//DEFINE
//------------------------------------------
#define ll long long
#define ld long double
#define ALLv(a)  (a).begin(),(a).end()
#define ALL(a,n)  (a),(a)+n
#define vi vector<long long>
#define vd vector<long double>
#define vs vector<string>
//CONST
//------------------------------------------
#define INF 1010000000000000017LL
#define MOD 1000000007LL
#define EPS 1e-12
#define PI 3.14159265358979323846
//REPEAT
//------------------------------------------
#define   FOR(i,m,n) for(ll (i)=(m);   (i)<(n);  (i)++)
#define   REP(i,n)   for(ll (i)=0;     (i)<(n);  (i)++)
#define  REPS(i,x)   for(ll (i)=1;     (i)<=(x); (i)++)
#define  RREP(i,x)   for(ll (i)=(x)-1; (i)>=0;   (i)--)
#define RREPS(i,x)   for(ll (i)=(x);   (i)> 0;   (i)--)
#define  WREP(i,in,j,jn) REP(i,in)REP(j,jn)
//-----------------------------------------
#define dcml(n) fixed<<setprecision(n)
using namespace std;
int main(void){
    ll A,B,K;cin>>A>>B>>K;
    ll i=min(A,B);ll cnt=0;
    while(1){
        if(A%i==0&&B%i==0){cnt++;}
        if(cnt==K)break;
        i--;
    }
    cout<<i<<"\n";
}

Measured memory_bytes: 256
N,M = [int(hoge) for hoge in input().split()]
A = [int(hoge) for hoge in input().split()]
S = sum(A)
kijun = (S-1)//(4*M)#これ以下ならダメ
X = (sum([a>kijun for a in A]))
if X < M:
    print("No")
else:
    print("Yes")

Measured memory_bytes: 61712
#include <algorithm>
#include <bitset>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

typedef long long ll;

#define rep(i, a, b) for (ll i = a; i < (ll)b; ++i)
#define digit(a) to_string(a).size()
#define INF 10e12
#define MAX 51000
#define all(x) (x).begin(), (x).end()
#define MX(x) *max_element(all(x))
#define MN(x) *min_element(all(x))

using namespace std;

const long long MOD = 1e9 + 7;

int main(void)
{
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    ll n, m;
    cin >> n >> m;
    ll ans = 0;
    if (2 * n <= m)
        ans = n + (m - 2 * n) / 4;
    else
        ans = m / 2;
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <list>
#include <vector>
#include <string>
#include <map>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>

using namespace std;

typedef long long Board;

const int N = 9;
const Board GOAL = 0x087654321;

struct state {
    Board board;
    int count;
};

list<state> q;
map<Board,char> history;

inline void swap(int numpos, int spacepos, Board& board) {
    long long num = (board >> (numpos*4)) & 15;
    board |= num << (spacepos*4);
    board &= ~(15LL << (numpos*4));
}

inline int swap_and_check(int numpos, int spacepos, state s) {
    swap(numpos, spacepos, s.board);
    map<Board,char>::iterator it = history.find(s.board);
    if (it != history.end()) {
        return -1;
    }
    history.insert(make_pair(s.board, ' '));
//    for (list<state>::iterator it = q.begin(); it != q.end(); ++it) {
//        if (it->board == s.board) {
//            return -1;
//        }
//    }
    ++s.count;
    if (s.board == GOAL) {
        return s.count;
    }
    q.push_back(s);
    return -1;
}

void print(Board b) {
    for (int i = 0; i < N; ++i) {
        printf("%2lld", (b >> (i*4) & 15));
    }
    printf("\n");
}

int main(void) {

    Board board = 0;
    for (int i = 0; i < N; ) {
        char ch;
        scanf("%c", &ch);
        if (isdigit(ch)) {
            board |= static_cast<long long>((ch - '0')) << (i*4);
            ++i;
        }
    }

    if (board == GOAL) {
        printf("0\n");
        return 0;
    }

//    print(GOAL);
//    print(board);

    q.push_back({ board, 0 });
    int count = 0;
    while (!q.empty()) {
        state s = q.front();
        q.pop_front();
        // ?????????????????????
        int pos;
        for (pos = 0; pos < N; ++pos) {
            if (((s.board >> (pos*4)) & 15) == 0) {
                break;
            }
        }

        if (pos < 6) {
            if ((count = swap_and_check(pos + 3, pos, s)) > 0) {
                break;
            }
        }
        if (pos > 2) {
            if ((count = swap_and_check(pos - 3, pos, s)) > 0) {
                break;
            }
        }
        if (pos % 3 < 2) {
            if ((count = swap_and_check(pos + 1, pos, s)) > 0) {
                break;
            }
        }
        if (pos % 3 > 0) {
            if ((count = swap_and_check(pos - 1, pos, s)) > 0) {
                break;
            }
        }
    }

    printf("%d\n", count);

    return 0;
}

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

int N, X, a;
vector<vector<int> > adj;

void dfs0(int u, int p) {
    int cnt = 0;
    for(int i = 0; i < adj[u].size(); i++) {
        int v = adj[u][i];
        if(v == p) continue;
        cnt++;
        dfs0(v, u);
    }
    a -= cnt / 2;
    if(p != -1 && cnt % 2 == 0) a++;
}

int dfs(int u, int p) {
    multiset<int> st;
    vector<int> tmp;
    for(int i = 0; i < adj[u].size(); i++) {
        int v = adj[u][i];
        if(v == p) continue;
        int t = dfs(v, u);
        if(t == -1) return -1;
        if(t + 1 > X) return -1;
        st.insert(t + 1);
        tmp.push_back(t + 1);
    }

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

    if((p == -1) ^ (st.size() % 2)) {
        if(p != -1) {
            for(int i = 0; i < (int)tmp.size() - 1; i++) {
                if(tmp[i] + tmp[ (int)tmp.size() - 2 - i ] > X) return -1;
            }
        }
        else {
            for(int i = 0; i < (int)tmp.size(); i++) {
                if(tmp[i] + tmp[ (int)tmp.size() - 1 - i ] > X) return -1;
            }
        }
        while(st.size() >= 2) {
            multiset<int>::iterator it1 = st.end();
            it1--;
            int v = *it1;
            st.erase(it1);

            multiset<int>::iterator it2 = st.upper_bound(X - v);
            if(it2 == st.begin()) return v;
            it2--;
            st.erase(it2);
        }
        return st.size()? *st.begin() : 0;
    }
    else {
        if(p != -1) {
            for(int i = 0; i < (int)tmp.size() - 2; i++) {
                if(tmp[i] + tmp[ (int)tmp.size() - 3 - i ] > X) return -1;
            }
        }
        else {
            for(int i = 0; i < (int)tmp.size() - 1; i++) {
                if(tmp[i] + tmp[ (int)tmp.size() - 2 - i ] > X) return -1;
            }
        }
        int chk = 0;
        while(st.size() >= 2) {
            multiset<int>::iterator it1 = st.end();
            it1--;
            int v = *it1;
            st.erase(it1);

            multiset<int>::iterator it2 = st.upper_bound(X - v);
            if(it2 == st.begin()) {
                if(chk) return v;
                chk = 1;
                continue;
            }
            it2--;
            st.erase(it2);
        }

        return st.size()? *st.begin() : 0;
    }
}

bool f(int x) {
    X = x;
    return dfs(0, -1) != -1;
}

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

    adj.resize(N);
    for(int i = 0; i < N - 1; i++) {
        int u, v; scanf("%d %d", &u, &v);
        u--; v--;

        adj[u].push_back(v);
        adj[v].push_back(u);
    }

    a = 0;
    dfs0(0, -1);

    int s = 1, e = N, b;
    while(s <= e) {
        int m = (s + e)>>1;

        if(f(m)) {
            b = m;
            e = m - 1;
        }
        else s = m + 1;
    }
    printf("%d %d", a, b);
}


Measured memory_bytes: 20352
#define debug(x) cout<<#x<<": "<<x<<endl
#define rep(a, b) for(int unsafe_cnt=a; unsafe_cnt < b;unsafe_cnt++)
#define fn auto
#include <iostream>
#include <stdio.h>
#include <vector>
#include <math.h>
#include <algorithm>
#include <string>
using namespace std;

void newline() {cout << endl;}
template <typename T> void display(T input){cout << input;}
template <typename T> void put(T input){display(input); newline();}
void iput(int input) {put(input);}

int time(int n){
  if(n >= 24){
    return time(n-24);
  } else {
    return n;
  }
}

fn main() -> int {
  int a, b;
  cin >> a >> b;
  cout << time(a+b) << endl;
}

Measured memory_bytes: 256
def solve():
    Ass = [tuple(map(int, input().split())) for _ in range(3)]
    N = int(input())
    Bs = set([int(input()) for _ in range(N)])

    isOKss = [[0]*(3) for _ in range(3)]
    for i in range(3):
        for j in range(3):
            if Ass[i][j] in Bs:
                isOKss[i][j] = 1

    for i in range(3):
        for j in range(3):
            if not isOKss[i][j]:
                break
        else:
            return True

    for j in range(3):
        for i in range(3):
            if not isOKss[i][j]:
                break
        else:
            return True

    for i in range(3):
        if not isOKss[i][i]:
            break
    else:
        return True

    for i in range(3):
        if not isOKss[i][2-i]:
            break
    else:
        return True

    return False


if solve():
    print('Yes')
else:
    print('No')


Measured memory_bytes: 9228
#include <bits/stdc++.h>
#define ff first
#define ss second
#define endl '\n'
using namespace std;
const long long INF = (long long) 1e18;
const int mod = (int) 1e9+7;
const int MAXN = (int) 3e5+5;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
ll n;
ll arr[MAXN];
ll dp[MAXN];
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);cout.tie(nullptr);

    #ifdef Local
        freopen("../IO/int.txt","r",stdin);
        freopen("../IO/out.txt","w",stdout);
    #endif

    cin>>n;
    dp[1] = 0;
    cin>>arr[1];
    for(int i = 2; i <= n; i++){
        dp[i] = INF;
        cin>>arr[i];
        dp[i] = min(dp[i], dp[i - 1] + abs(arr[i] - arr[i - 1]));
        if(i > 2){
            dp[i] = min(dp[i], dp[i - 2] + abs(arr[i] - arr[i - 2]));
        }
    }
    cout<<dp[n]<<endl;

    #ifdef Local
        cout<<endl<<fixed<<setprecision(2)<<1000.0 * clock() / CLOCKS_PER_SEC<< " milliseconds ";
    #endif
}

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

int main(){
  string S;
  cin>> S;
  if(S=="Sunny"){
    cout<< "Cloudy"<< endl;
  }
  else if(S=="Cloudy"){
    cout<< "Rainy"<< endl;
  }
  else{
    cout<< "Sunny"<< endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <algorithm>
const int mod=1e9+7;
using LL=long long;
using std::cout;using std::endl;using std::cin;
using std::vector;using std::string;using std::set;using std::multiset;
using std::pair;using std::map;
using std::min;using std::max;
using std::make_pair;
std::ostream& operator<<(std::ostream& os,std::map<int,int>& obj){for(std::map<int,int>::iterator itr=obj.begin();itr!=obj.end();itr++){os<<itr->first<<"^"<<itr->second<<" ";}return os;}
std::ostream& operator<<(std::ostream& os,std::vector<std::map<int,int>>& obj){for(auto itr=obj.begin();itr!=obj.end();itr++){os<<*itr<<std::endl;}return os;}
std::ostream& operator<<(std::ostream& os,std::vector<int>& obj){for(auto itr=obj.begin();itr!=obj.end();itr++){os<<*itr<<endl;}return os;}

namespace ndifix{
template<class T>void sort(T &v){std::sort(v.begin(),v.end());}
}

int main(){
  int x;cin>>x;
  if(x==3||x==5||x==7)cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
  return 0;
}

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

ans = 1
prime = [2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997]

for p in prime:
	cnt = 0
	i = p
	while i <= n:
		cnt+=n // i
		i*=p
	ans = ans * (cnt + 1) % 1000000007

print(ans)

Measured memory_bytes: 3188
import sys
input = sys.stdin.readline
x = int(input())
if x <= 6:
    print(1)
    sys.exit()
elif x <= 11:
    print(2)
    sys.exit()
x_11 = x // 11
xmod11 = x % 11
if xmod11 == 0:
    print(2 * x_11)
elif xmod11 <= 6:
    print(2 * x_11 + 1)
else:
    print(2 * x_11 + 2)

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

int main(){
    string s,t;
    cin >> s >> t;
    int cnt=0;
    for(int i=0; i<s.size();i++){
        if(s.at(i) == t.at(i)){
            cnt=0;
        }
        else{
            cnt=1;
            break;
        }
    }

    if(cnt==0){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }

}

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

using namespace std;

int G[10][10];

struct point {
    int s;
    int cnt;
    bool g[10];
}p, pre, now;

queue<point> q;
int num;

int main() {
    int n, m;
    scanf("%d %d", &n, &m);
    int x, y;
    num = 0;
    for(int i = 0; i < m; i++) {
        scanf("%d%d", &x, &y);
        G[x][y] = 1;
        G[y][x] = 1;
    }
    for(int i = 1; i <= n; i++) p.g[i] = 1;
    p.s = 1;
    p.cnt = 1;
    p.g[1] = 0;
    q.push(p);
    while(!q.empty()) {
        pre = q.front();
        q.pop();
        int k = pre.s;
        //printf("%d\n", pre.cnt);
        for(int i = 1; i <= n; i++) {
            if(G[i][k] == 1 && pre.g[i] == 1) {
                if(pre.cnt == n - 1) {
                    num++;
                    continue;
                }
                now = pre;
                now.g[i] = 0;
                now.cnt++;
                now.s = i;
                q.push(now);
            }
        }
    }
    printf("%d\n", num);
    return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <cmath>
using namespace std;
int main(void){
    // Your code here!
    
    
    string S, T;
    cin >> S >> T;
    
    int ans = 0;
    for(int i = 0; i < S.size(); i++){
        if(S[i] != T[i]) ans++;
    }
    
    cout << ans << endl;
}


Measured memory_bytes: 3620
#include <iostream>
#include <vector>

using namespace std;

using ull = unsigned long long;

#define Rep(i, n) for(int i = 0; i < (int)(n); ++i)

int solve() {
  int N;
  cin >> N;

  vector<ull> A(N);
  Rep(n, N) cin >> A[n];

  string S;
  cin >> S;

  vector<ull> basis;
  for (int n = N - 1; n >= 0; n--) {
    ull a = A[n];
    for (auto b : basis) {
      a = min(a, a ^ b);
    }
    if (a != 0) {
      if (S[n] == '0') {
        basis.push_back(a);
      } else if (S[n] == '1') {
        return 1;
      } else {
        abort();
      }
    }
  }

  return 0;
}

int main() {
  int T;
  cin >> T;
  Rep(t, T) {
    cout << solve() << endl;
  }
  return 0;
}


Measured memory_bytes: 3604
import java.util.Scanner;

public class Main {
	void run(){
		Scanner s = new Scanner(System.in);
		int a = s.nextInt();
	    int b = s.nextInt();
	    int c = s.nextInt();
	    if(a < b && b < c) System.out.println("Yes");
	    else System.out.println("No");
	    
	}
	public static void main(String[] args) {
		
		new Main().run();
		
	}
}

Measured memory_bytes: 26352
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
 
/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
*/

int main(){
    int a,b; cin >> a >> b;
    cout << (a+b-1)/2 + 1 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define MOD 1000000009
#define inf 1e9
#define endl '\n'
#define zeros(x) ((x)&(-x))

using namespace std;

typedef long long ll;
typedef long double ld;

ll n, nr;
ld tot;
bool Taken[10];
vector<pair<ll, ll> > A;
pair<ll, ll> V[10];

ld dist(pair<ll, ll> a, pair<ll, ll> b)
{
    ld x = a.first-b.first;
    ld y = a.second-b.second;
    return sqrt(x*x+y*y);
}

ld compute() {
    ld d = 0;
    for (int i=0; i<A.size()-1; i++)
    {
        d += dist(A[i], A[i+1]);
    }
    return d;
}

void bkt(int lvl)
{
    if (lvl == n+1)
    {
        tot += compute();
        nr++;
        return;
    }

    for (int i=0; i<n; i++)
    {
        if (Taken[i] == 0)
        {
            A.push_back(V[i]);
            Taken[i]=1;
            bkt(lvl+1);
            Taken[i]=0;
            A.pop_back();
        }
    }
}

int main()
{
    //freopen("input.txt", "r", stdin);
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    cin>>n;
    for(int i=0; i<n; i++)
    {
        cin>>V[i].first>>V[i].second;
    }

    bkt(1);
    cout<<setprecision(12)<<fixed<<tot/nr;
    return 0;
}

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

using namespace std;

const int N = 3e5 + 50;

int n, m, a[N];

int main()
{
    ios::sync_with_stdio(false);

    cin >> n >> m;
    for (int i = 1; i <= n; i++)
        cin >> a[i];
    sort(a + 1, a + n + 1);
    long long ans = 0;
    for (int i = 1; i <= n - m; i++)
        ans += a[i];

    cout << ans;
}

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

string N;
int K, l;
ll d[105][4][2]{};

int main() {

    cin >> N >> K;
    l = N.length();

    d[1][0][1] = 1;
    d[1][1][0] = 1;
    d[1][1][1] = N[0] - '0' - 1;
    for (int i = 1; i < l; i++) {
        ll s = N[i] - '0';
        if (s == 0) {
            for (int j = 0; j < 3; j++) {
                d[i + 1][j][0] = d[i][j][0];
            }
            for (int j = 0; j < 4; j++) {
                d[i + 1][j][1] = d[i][j][1];
            }
            for (int j = 0; j < 3; j++) {
                d[i + 1][j + 1][1] += d[i][j][1] * 9ll;
            }
        } else {
            for (int j = 0; j < 3; j++) {
                d[i + 1][j + 1][0] = d[i][j][0];
            }
            for (int j = 0; j < 4; j++) {
                d[i + 1][j][1] = d[i][j][1] + d[i][j][0];
            }
            for (int j = 0; j < 3; j++) {
                d[i + 1][j + 1][1] += d[i][j][1] * 9ll + d[i][j][0] * (N[i] - '0' - 1);
            }
        }

        
    }
    ll ans = 0;
    if (d[l][K][0] >= 2) cout << "1\n";
    cout << d[l][K][0] + d[l][K][1] << "\n";
    return 0;
}

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

using namespace std;

#define pb push_back
#define mp make_pair
#define lli long long int
#define F first
#define S second
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define MAX1 998244353
#define MAX2 1000000007
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    std::cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');std::cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#define input(data,n,command) for(lli i=0;i<n;i++){lli tmp;cin>>tmp;data.pb(tmp);command}
#define sort(a) sort(a.begin(),a.end());
#define display(a) for(lli i = 0 ;i<a.size();i++){cout<<a[i]<<" ";} cout<<endl;
#define rep(i,n,p) for(lli i = 0;i<n;i= i +p)
#define endl "\n"

//Written By GHATAK...
/*--------------------------------------------------------------------*/
//vector<pair<lli,lli>>adj[300010];

int main()
{
    ios
    lli T=1;
    //cin>>T;
    while(T--)
    {
        //start from here
        lli a,b;
        cin>>a>>b;
        if((a>=1)&&(a<=9)&&(b>=1)&&(b<=9))
        {
            cout<<a*b;
        }
        else
        {
            cout<<"-1";
        }
    }
    return 0;
}
/*-----------------------------------------------------------------------*/
/*
--->  reverse(vec.begin(),vec().end());
*/

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
using P = pair<int,int>;
vector<int> ki[110000];
ll dp[110000][2];
int n;
const int mod = 1000000007;
void dfs(int now,int last = -1){
    dp[now][0] = dp[now][1] = 1;
    for(auto next :ki[now]){
        if(next == last)continue;
        dfs(next,now);
        dp[now][0] = dp[now][0] * ((dp[next][0]+dp[next][1])%mod)%mod;

        dp[now][1] = dp[now][1] * dp[next][0] %mod;

    }
}
int main()
{
    cin >> n;
    rep(i,n-1){
        int x,y;
        cin >> x >> y;
        x--;y--;
        ki[x].push_back(y);
        ki[y].push_back(x);

    }
    dfs(0);
    cout << (dp[0][0] + dp[0][1])%mod<< endl;
    return 0;
} 

Measured memory_bytes: 14464
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <fstream>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <bitset>
#include <array>
#include <vector>
#include <queue>
#include <set>
#include <cmath> // 変数名にy1が使えなくなるかも…。
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <limits>
#include <functional>
#include <string>

typedef __int128_t int128_t;
std::istream &operator>>(std::istream& input, int128_t& value) { // int128_tの入力。入力が64bitに収まる前提。
    long long tmp; input >> tmp; value = tmp;
    return input;
}
std::ostream &operator<<(std::ostream& output, const int128_t value) { // int128_tの出力。出力が64bitに収まる前提。
    output << (long long)value;
    return output;
}

#define rep(i, begin, end) for(int64_t i = (begin); i <= (end); i++)
#define rev(i, begin, end) for(int64_t i = (begin); (end) <= i; i--)

void printvec(const std::vector<int>& vec) {
    for (int i = 0; i < vec.size(); i++) { std::cout << vec[i] << " "; } std::cout << std::endl;
}

const int MAX_N = 2e5 + 10;
int N;
int128_t a[MAX_N];
std::vector<int> divi[MAX_N];
int tmp[MAX_N] = {};
int ret[MAX_N] = {};

int main(int argc, char **argv) {
    std::cin >> N;
    rep (i, 1, N) {
        std::cin >> a[i];
    }

    rep (i, 1, N) {
        for (int64_t j = 1; i*j <= N; j++) {
            divi[i*j].push_back(i);
        }
    }

    int M = 0;
    rev (i, N, 1) {
        if (tmp[i] % 2 != a[i]) {
            ret[i] = 1;
            M++;
            for (int j : divi[i]) {
                tmp[j]++;
            }
        }
    }

    std::cout << M << std::endl;

    if (M != 0) {
        rep (i, 1, N) {
            if (ret[i] == 1) {
                std::cout << i << " ";
            }
        }
        std::cout << std::endl;
    }

    return 0;
}

Measured memory_bytes: 26880
#include<bits/stdc++.h>
#define endl "\n"

using namespace std;
int n, m;
vector<pair<int, int>> veze;
vector<int> g[500000];
vector<int> sol;
vector<int> sol2;
bool bio[500000];
vector<int> k;
int gran1, gran2;
void f(){
    if (sol.size()==0 || gran1 != sol[sol.size()-1])sol.push_back(gran1);
    if (sol2.size()==0 || gran2 != sol2[sol2.size()-1])sol2.push_back(gran2);
    bool c = 0;
    bool d = 0;
    ///cout <<gran1 <<" " <<gran2 <<endl;
    for (int i = 0; i < g[gran1].size(); ++i){
        if (!bio[g[gran1][i]] && !c){
            ///cout <<"sdfsdfsdfsdf";
            c=1;
            bio[g[gran1][i]] = 1;
            gran1 = g[gran1][i];
            break;
        }
    }

    for (int i = 0; i < g[gran2].size(); ++i){
        if (!bio[g[gran2][i]] && !d){
            d=1;
            bio[g[gran2][i]] = 1;
            gran2 = g[gran2][i];
            break;
        }
    }
    ///cout <<gran1 <<" " <<gran2 <<" " <<c <<" " <<d <<endl;
    ///system("pause");
    if (!c && !d){
        return;
    }
    f();
}
int main()
{
    cin >>n >>m;
    for (int i = 0; i < m; ++i){
        int a, b;
        cin >>a >>b;
        veze.push_back({a, b});
        g[a].push_back(b);
        g[b].push_back(a);
    }
    gran1 = 1;
    gran2 = g[1][0];
    bio[gran1] = 1;
    bio[gran2] = 1;
    f();
    cout <<sol.size() + sol2.size() <<endl;
    reverse(sol.begin(), sol.end());
    for (int i = 0; i < sol.size(); ++i){
        cout <<sol[i] <<" ";
    }
    for (int i = 0; i < sol2.size(); ++i)cout <<sol2[i] <<" ";
return 0;
}


Measured memory_bytes: 17524
from collections import defaultdict
N = int(input())
Ds =  list(map(int,input().split(" ")))
M = int(input())
Ts =  list(map(int,input().split(" ")))

prob = defaultdict(lambda :0)
for d in Ds:
    prob[d] += 1

ans = "YES"
for t in Ts:

    if prob[t] == 0:
        ans = "NO"
    prob[t] -= 1
print(ans)


Measured memory_bytes: 41692
N = int(input())
S = list(input())

left = [0 for i in range(N)]
right = [0 for i in range(N)]
for i in range(1, N):
    if S[i-1] == "W":
        left[i] = left[i-1] + 1
    else:
        left[i] = left[i-1]
for i in range(N-1):
    if S[(N-1)-i] == "E":
        right[(N-2)-i] = right[(N-1)-i] + 1
    else:
        right[(N-2)-i] = right[(N-1)-i]

ans = left[0] + right[0]
for i in range(1, N):
    count = left[i] + right[i]
    if ans > count:
        ans = count
print(ans)

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

int main() {

	char s[10], t[10];
	int a, b;

	char u[10];

	scanf("%s %s", s, t);
	scanf("%d %d", &a, &b);
	scanf("%s", u);

	if(strcmp(u, s) == 0) {
		a--;
	}
	if(strcmp(u, t) == 0) {
		b--;
	}

	printf("%d %d", a, b);

	return 0;
}


Measured memory_bytes: 128
#include <iostream>
using namespace std;
int main(){
  int K,S,num = 0;
  cin >> K >> S;
  for(int i = 0;i < K + 1;++i){
    for(int j = 0;j  < K + 1;++j){
      int h = S - i - j;
      if(0 <= h && h <= K){
        ++num;
      }
    }
  }
  std::cout << num << std::endl;
}

Measured memory_bytes: 256
from collections import defaultdict

N = int(input())
ans = defaultdict(int)

for x in range(1, 101):
    for y in range(1, 101):
        for z in range(1, 101):
            t = x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x
            if t > 10**4:
                break
            ans[t] += 1

for i in range(1, N+1):
    print(ans[i])

Measured memory_bytes: 69976
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long A = sc.nextLong();
		long B = sc.nextLong();
		System.out.println(A*B/Main.d(A, B));
	}
	public static long d(long A,long B) {
		if (A<B) {
			return d(B,A);
		}
		if (B==0) {
			return A;
		}
		return d(A%B,B);
	}
}

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

using namespace std;

#define int long long
#define ff first
#define ss second
#define pii pair<int, int>
#define pb emplace_back
#define pf emplace_front
#define mp make_pair
#define ld long double
#define all(x) (x).begin(), (x).end()

const int maxn = 2e5 + 9;
int sum, cnt, n;

signed main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        int a, b;
        cin >> a >> b;
        sum += a * b;
        cnt += b;
    }
    cout << max(0ll, sum - 1) / 9 + cnt - 1;
}


Measured memory_bytes: 256
#include <stdio.h>

int main()
{
  int nq, q, i, j, count = 0;
  char buf[32];
  buf[31]='\0';
  buf[30]='\n';
  char array[64] = {0};
  unsigned long val, r;
  fgets(buf, 32, stdin);
  char *p = buf;
  for (nq=0; *p>='0'; p++)  nq = nq * 10 + *p - '0';
  while (nq-->0) {
    fgets(buf, 32, stdin);
    q = buf[0]-'0';
    switch (q) {
    case 0: // test(i)
      i = (buf[3]=='\n') ? buf[2]-'0' : (buf[2]-'0')*10+buf[3]-'0';
      fputs(array[i]?"1\n":"0\n", stdout);
      break;
    case 1: // set(i)
      i = (buf[3]=='\n') ? buf[2]-'0' : (buf[2]-'0')*10+buf[3]-'0';
      if (array[i]==0) {
	array[i] = 1;
	count++;
      }
      break;
    case 2: // clear(i)
      i = (buf[3]=='\n') ? buf[2]-'0' : (buf[2]-'0')*10+buf[3]-'0';
      if (array[i]) {
	array[i] = 0;
	count--;
      }
      break;
    case 3: // clip(i)
      i = (buf[3]=='\n') ? buf[2]-'0' : (buf[2]-'0')*10+buf[3]-'0';
      if (array[i]) {
	array[i] = 0;
	count--;
      } else {
	array[i] = 1;
	count++;
      }
      break;
    case 4: // all
      fputs(count==64?"1\n":"0\n", stdout);
      break;
    case 5: // any
      fputs(count>0?"1\n":"0\n", stdout);
      break;
    case 6: // none
      fputs(count?"0\n":"1\n", stdout);
      break;
    case 7: // count
      if (count==0) {
	fputs("0\n", stdout);
      } else {
	int v = count;
	for (j=29; v>0; j--, v/=10)   buf[j] = '0' + (v%10);
	fputs(buf+j+1, stdout);
      }
      break;
    case 8: // val
      if (count==0) {
	fputs("0\n", stdout);
      } else {
	val = array[0];
	r = 2;
	for (int j=1; j<64; j++,r<<=1)
	  val += array[j]*r;
	for (j=29; val>0; j--, val/=10)   buf[j] = '0' + (val%10);
	fputs(buf+j+1, stdout);
      }
    }
  }
  return 0;
}



Measured memory_bytes: 2104
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using VI = vector<int>;
using VL = vector<ll>;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);++(i))
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);++(i))
#define rFOR(i,a,n) for(int (i)=(n)-1;(i)>=(a);--(i))
#define erFOR(i,a,n) for(int (i)=(n);(i)>=(a);--(i))
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
#define END(a) {cout << (a) << "\n"; return 0;}
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
const long double pi = acos(-1);
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; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T>inline istream& operator>>(istream& input, vector<T>& v) { for (auto& elemnt : v)input >> elemnt; return input; }

int main() {
    init();

    int n, m; cin >> n >> m;
    vector<pair<int, int>> key(m);
    FOR(i, 0, m) {
        int a, b, c = 0; cin >> a >> b;
        FOR(j, 0, b) {
            int in; cin >> in;
            --in;
            c |= (1 << in);
        }
        key[i] = make_pair(a, c);
    }

    vector<VI> dp(m + 1, VI(1 << n, INF));
    dp[0][0] = 0;
    FOR(i, 0, m)FOR(j, 0, 1 << n) {
        chmin(dp[i + 1][j], dp[i][j]);
        chmin(dp[i + 1][j | key[i].second], dp[i][j] + key[i].first);
    }

    cout << (dp[m][(1 << n) - 1] == INF ? -1 : dp[m][(1 << n) - 1]) << "\n";
}

Measured memory_bytes: 16384
#include <cmath>
#include <functional>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <list>
#include <time.h>
#include <math.h>
#include <random>
#include <deque>
#include <queue>
#include <cassert>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <bitset>
#include <sstream>
#include <chrono>
#include <cstring>

using namespace std;

typedef long long ll;

#ifdef iq
  mt19937 rnd(228);
#else
  mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count());
#endif

int main() {
#ifdef iq
  freopen("a.in", "r", stdin);
#endif
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  if (n == 3) {
    cout << "2 5 63\n";
    return 0;
  }
   auto gcd = [&] (ll a, ll b) {
      while (b) {
        ll cur = a % b;
        a = b;
        b = cur;
      }
      return a;
    };
  while (true)
  for (int rm = 1; rm <= 6; rm++)
  for (int mask = 0; mask < (1 << rm); mask++) {
    vector <int> a;
    for (int i = 1; i <= 30000; i++) {
      int rem = i % rm;
      if ((mask >> rem) & 1) {
        a.push_back(i);
      }
      if (a.size() == n) break;
    }
    if (a.size() < n) continue;
    ll s = 0;
    for (int x : a) s += x;
    set <int> q;
    for (int x : a)q.insert(x);
    int pos = rnd()%n;
    s -= a[pos];
    q.erase(a[pos]);
    int y = rnd() % 30000 + 1;
    int orz = 0;
    while (q.count(y) || gcd(y, s) == 1) {
      y = rnd() % 30000 + 1;
      orz++;
      if (orz > 30000) break;
    }
    if (orz > 30000) continue;
    s += y;
    a[pos] = y;
   
    int g = 0;
    bool good = true;
    for (int x : a) {
      g = gcd(g, x);
      if (gcd(x, s) == 1) good = false;
    }
    if (g == 1 && good) {
      for (int x : a) cout << x << ' ';
      return 0;
    }
  }
  assert(0);
}


Measured memory_bytes: 1456
#include <bits/stdc++.h>
#define repr(i,from,to) for(int (i)=(from);(i)<(to);(i)++)
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
// const bool debug=true;
const bool debug=false;
#define DEBUG if(debug==true)
#define vprint(x) for(auto a:(x)) cout << x << endl;
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll MOD = 1000000007;

int main(void) {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;cin>>n;
    string s[n];
    rep(i,n){cin>>s[i];}
    ll res=0;
    rep(i,n){
        bool flg=true;
        rep(j,n){
            rep(k,n){
                if((j+i)%n==k){continue;}
                flg &= (s[(j+i)%n][k] == s[(k+i)%n][j]);
            }
        }
        if(flg){
            res += n;
        }
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
int main()
{
  int N;
  cin >> N;
  vector<string> s(N);
  map<string, int> mp;
  rep(i, N)
  {
    cin >> s[i];
    sort(s[i].begin(), s[i].end());
    mp[s[i]]++;
  }
  long long int ans = 0;
  for (auto &p : mp)
  {
    int s = p.second;
    ans += (long long)s * (s - 1) / 2;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 18176
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <iomanip>
#include <queue>
#include <climits> 
int main()
{
    std::string S;
    std::cin >> S;
    if(S[2]==S[3] && S[4]==S[5]){
        std::cout << "Yes" << std::endl;
    }else{
        std::cout << "No" << std::endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
 
using namespace std;
 
void load(void);
void calc(void);
void output(void);

int res = 0;
string S, T;

int main(){
	load();
	calc();
	output();
	return 0;
}
 
void load(void){
	cin >> S >> T;
}
 
void calc(void){
	int i;
	for(i = 0;i < 200000;i++){
		if(S[i] == '\0'){
			break;
		}else if(S[i] != T[i]){
			res++;
		}
	}
}
 
void output(void){
	cout << res << endl;
}

Measured memory_bytes: 3892
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#define rep(i,n) for(int i=0; i<n; i++)
typedef long long ll;
typedef pair<int,int> P;
const ll MOD = (int)1e9+7;
const ll INF = MOD*MOD;
const ll powll = 1LL<<1;

int n;

void f(string s){
  if(s.size() == n)
    cout << s << "\n";
  else{
    rep(i,s.size()+1){
      int pre = 0;
      rep(j,s.size()) pre = max(pre, s[j]-'a');
      if(s == "" || i-pre <= 1){
        string t = s + (char)('a'+i);
        f(t);
      }
    }
  }
}
int main(){
  cin >> n;
  f("");
  
}


Measured memory_bytes: 1536
import java.util.Scanner;
import java.util.ArrayList;
import java.util.List;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        if(x >= 30){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }

} 


Measured memory_bytes: 35544
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, s, n) for (int i = (s); i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main() {
  int x;
  cin >> x;
  if (x >= 30)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 3632