akhauriyash/Code-Regression huggingface dataset:
def count_one(num):
  ret = 0
  while num:
    if num & 1: ret+=1
    num = num >> 1

  return ret

def solve():
  N,M = map(int, input().split())
  switches = []
  for _ in range(M):
    switches_pattern = list(map(int, input().split()))[1:]
    pattern_int = sum(2**(i-1) for i in switches_pattern)
    switches.append(pattern_int)
  ps = list(map(int, input().split()))

  switch_pattern_upper = 2**N

  def check(pattern):
    ret = True
    for i in range(M):
      bit_count = count_one(switches[i] & pattern)
      # print(switches[i] & pattern, bit_count)
      if bit_count % 2 != ps[i]:
        ret = False
        break
      
    return ret
    
  ret = 0
  # print(switches)
  for pattern in range(switch_pattern_upper):
    # print(pattern)
    if check(pattern): ret += 1

  print(ret)
  
solve()

Measured memory_bytes: 3064
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include<math.h>
#include<iomanip>
#include<functional>
using namespace std;

#define ll long long
using vt = ll; //ここで数値の型を変えられる
#define rep(i, n) for (vt i = 0; i < (vt)(n); i++)
#define reps(i, s, n) for(vt i = (vt) (s); i < (vt) (n); i++) 
#define all(v) v.begin(), v.end()
#define P pair<ll, ll>
const ll  MOD = 1000000007;

ll n;
ll ans = 0;

void check(string t) {
	int a = 0, b = 0, c = 0;
	rep(i, t.size()) {
		if (t.at(i) == '3') a = 1;
		else if (t.at(i) == '5') b = 1;
		else c = 1;
	}
	if (a + b + c == 3 && stoll(t) <= n) ans++;
}

void dfs(string s) {
	check(s);
	ll x = stoll(s);
	if (x <= n) {
		dfs(to_string(10 * x + 3));
		dfs(to_string(10 * x + 5));
		dfs(to_string(10 * x + 7));
	}
}

int main() {
	cin >> n;
	dfs("0");
	cout << ans;
	return 0;
}

Measured memory_bytes: 256
SA = input()
SB = input()
SC = input()

ca,cb,cc = 0,0,0
t = "a"
while ca <= len(SA) and cb <= len(SB) and cc <= len(SC):
    if t == "a":
        if ca == len(SA):
            print("A")
            exit()
        t = SA[ca]
        ca = ca + 1
        
    elif t == "b":
        if cb == len(SB):
            print("B")
            exit()
        t = SB[cb]
        cb = cb + 1
    else:
        if cc == len(SC):
            print("C")
            exit()
        t = SC[cc]
        cc = cc +1


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

using int32 = int_fast32_t;
using int64 = int_fast64_t;

const int32 INF = 1e9;
const int32 MOD = 1e9+7;
const int64 LLINF = 1e18;

#define YES(n) cout << ((n) ? "YES\n" : "NO\n"  )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n"  )
#define POSSIBLE cout << ((n) ? "POSSIBLE\n" : "IMPOSSIBLE\n"  )
#define ANS(n) cout << (n) << "\n"
#define REP(i,n) for(int64 i=0;i<(n);++i)
#define FOR(i,a,b) for(int64 i=(a);i<(b);i++)
#define FORR(i,a,b) for(int64 i=(a);i>=(b);i--)
#define ALL(obj) (obj).begin(),(obj).end()
#define pii pair<int32,int32>
#define pll pair<int64,int64>
#define pb(a) push_back(a)

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int32 a,b,c,d;
  cin >> a >> b >> c >> d;
  Yes((c+b-1)/b <= (a+d-1)/d);
  return 0;
}

Measured memory_bytes: 3660
#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def LS(): return list(map(list, input().split()))
def S(): return list(input().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = 1e10

#solve
def solve():
    a, b, c = LI()
    print(min(a * b * (c & 1), a * (b & 1) * c, (a & 1) * b * c))
    return


#main
if __name__ == '__main__':
    solve()


Measured memory_bytes: 39280
#define _GLIBCXX_DEBUG //GCC環境での[]デバッグ
#include <bits/stdc++.h> //全ての標準ライブラリ
#define rep(i,n) for(int i = 0;i < n;i++)
#define FOR(i, a, b) for (int i = a; i < b; i++)
using namespace std;
using ll = long long;
int sumVector (const std::vector<int>& v){ //int配列計算
    int sum = 0;
    rep(i, v.size()) sum += v.at(i);
    return sum; 
}
int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    ll sum = 0;
    rep(i,n+1){
        if(i == 0) continue;
 
        else if(i % 3 == 0 || i % 5 == 0){
            continue;
        }
        else {
            sum += i;
        }
    }
    cout << sum;
    
 
}

Measured memory_bytes: 3652
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
#define speedX ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
using namespace std;
// #define ONLINE_JUDGE
#ifndef ONLINE_JUDGE
template<typename T>
void __p(T a) { cout << a << " "; }
template<typename T, typename F>
void __p(pair<T, F> a) { cout << "{ "; __p(a.first); __p(a.second); cout << "}"; }
template<typename T>
void __f(const char* s, T t) { cout << s << " : "; __p(t); }
template<typename T>
void __t(const char* s, const T &x) { cout << s << " : { "; for (auto it : x) __p(it); cout << "} ";}
template<typename T, typename ... F>
void __f(const char* s, T t, F ... f) {
	int i = 0; for (;; ++i) if (s[i] == ',') break;
	cout.write(s, i) << " : "; __p(t); cout << " | "; __f(s + i + 1, f...);
}
#define trace(...) { cout<<"LINE: "<<__LINE__<<" || "; __f(#__VA_ARGS__,__VA_ARGS__); cout<<"\n\n"; }
#define debug(...) { cout<<"LINE: "<<__LINE__<<" || "; __t(#__VA_ARGS__,__VA_ARGS__); cout<<"\n\n"; }
int begtime = clock();
#define end_time() cout << "\n\nTime of execution: " << (clock() - begtime)*1000/CLOCKS_PER_SEC << " ms\n\n";
#else
#define trace(...)
#define debug(...)
#define end_time()
#endif
#define int long long
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<pii, int> piii;
typedef vector<int> vi;
typedef vector<pii> vii;
inline bool equals(ld a, ld b) {return fabs(a - b) < 1e-9;}
inline int gcd(int a, int b) { a=abs(a); b=abs(b); while(a>0 && b>0) (a>b?a%=b:b%=a); return (a==0?b:a); }
inline int power(int x, int n, int m = LLONG_MAX)
    {  int res=1; x = (x%m + m)%m;
       while(n) { if(n&1) res=(res*x)%m;  x=(x*x)%m;  n >>= 1; }  return res;
    }
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define ff first
#define ss second
#define uset unordered_set
#define umap unordered_map
#define all(x) x.begin(), x.end()
#define mod 1000000007
void solve(){
	int n;
	cin>>n;
	vi v(pow(10,5),0);
	//memset(v,0,v.size());
	int sum=0;
	for(int i=0; i<n; i++) {
		int temp;  
		cin>>temp;
		sum+=temp;
		v[temp]++;
	}
	int q;
	cin>>q;
	vii p;
	for(int i=0; i<q; i++) {
		int f,s;
		cin>>f>>s;
		p.pb(mp(f,s));
	}
	int ans=sum;
	for(int i=0; i<q; i++) {
		int temp;
		temp = v[p[i].ff];
		ans = (ans-(temp*p[i].ff)+(temp*p[i].ss));
		v[p[i].ss]+=temp;
		v[p[i].ff]=0;
		cout<<ans<<"\n";
	}
}
signed main(){
	speedX;
	#ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
	int t=1;
	//cin>>t;
	for(int i=1;i<=t;++i) {
		//cout<<"Case #"<<i<<": ";
		solve();
	}
	end_time();
	return 0;
}

Measured memory_bytes: 6080
inf = float('inf')
mod = 10**9+7
from itertools import product, permutations, combinations, combinations_with_replacement
import bisect

H, W, D = map(int, input().split())
A = [list(map(int, input().split())) for i in range(H)]
Q = int(input())
LR = [list(map(int, input().split())) for i in range(Q)]

d = {}
for i,i2 in enumerate(A):
    for j,j2 in enumerate(i2):
        d[j2] = (i+1,j+1)

def listsub(t1,t2):
    return (abs(t1[0]-t2[0]),abs(t1[1]-t2[1]))

dp = [0]*((H*W)+1)

for i in range(D+1,(H*W)+1):
    dp[i] = dp[i-D] + sum(listsub(d[i-D], d[i]))

for L, R in LR:
    print(dp[R] - dp[L])

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

using Array = basic_string<pair<char, int>>;
Array a, b, c;

void input(Array &a){
    string c; int l;
    while(cin >> c, c[0] != '$'){
        cin >> l;
        a += make_pair(c[0], l);
    }
}

int main(){
    input(a);
    input(b);
    input(c);
    a = make_pair('0', 0) + a + make_pair('0', 0);
    if(b.size() == 1){
        for(int i = 0; i < (int)a.size(); ++i){
            if(a[i].first == b[0].first && a[i].second >= b[0].second){
                a[i].second -= b[0].second;
                a = a.substr(0, i) + c + a.substr(i);
                break;
            }
        }
    } else {
        for(int i = 1; i+b.size()-2 <= a.size(); ++i){
            if(b.substr(1, b.size()-2) == a.substr(i, b.size()-2)){
                if(a[i-1].first == b[0].first && a[i-1].second >= b[0].second &&
                    a[i+b.size()-2].first == b.back().first && a[i+b.size()-2].second >= b.back().second){
                    a[i-1].second -= b[0].second;
                    a[i+b.size()-2].second -= b.back().second;
                    a = a.substr(0,i) + c + a.substr(i+b.size()-2);
                    break;
                }
            }
        }
    }

    a.erase(remove_if(a.begin(), a.end(), [](pair<char,int> x){ return x.second == 0; }), a.end());
    for(int i = 0; i < (int)a.size(); ++i){
        int j = i + 1;
        while(j < (int)a.size() && a[i].first == a[j].first){
            a[i].second += a[j].second;
            a.erase(a.begin()+j);
        }
    }
    for(int i = 0; i < (int)a.size(); ++i){
        cout << a[i].first << ' ' << a[i].second << ' ';
    }
    cout << '$' << endl;
}

Measured memory_bytes: 3268
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#define INF 2e9
#define MOD 1000000007
#define MOD9 998244353
#define intMAX 51000;
#define PI 3.14159265359
using namespace std;
typedef long long llong;
// typedef long double ldouble;

using Graph = vector<vector<int>>;

// int ctoi(const char c){
//   if('0' <= c && c <= '9') return (c-'0');
//   return -1;
// }

// int gcd(int a, int b){
//   int ma = max(a,b);
//   int mi = min(a,b);
//   if(mi == 0) return ma;

//   return gcd(mi, ma%mi);
// }

// llong POW(llong a, llong b){
//   if(b == 0) return 1;
//   else{
//     if(b%2 == 0) return POW(a * a % MOD, b / 2) % MOD;
//     else return a * POW(a * a % MOD, b / 2) % MOD;
//   }
// }

int main(){
	int S;
	cin >> S;
	int top = S/100;
	int bottom = S%100;
	if(top==0 && bottom==0) cout << "NA" << endl;
	else if(top==0 && bottom<13) cout << "YYMM" << endl;
	else if(top==0 && bottom>12) cout << "NA" << endl;
	else if(top<13 && bottom==0) cout << "MMYY" << endl;
	else if(top>12 && bottom==0) cout << "NA" << endl;
	else if(top<13 && bottom <13) cout << "AMBIGUOUS" << endl;
	else if(top<13 && bottom > 12) cout << "MMYY" << endl;
	else if(top>12 && bottom<13) cout << "YYMM" << endl;
	else cout << "NA" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <tuple>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;

#define rep(i,n) for(int i = 0; i<n; ++i)
#define REP(i,n) for(int i = 1; i<=n; ++i)
#define all(x) begin(perm),end(perm)
#define showall(obj) for(auto x:obj)cout<<x<<endl;
typedef long long ll;
typedef pair<int,int> ip;
typedef pair<ll,ll> lp;
typedef vector<int> vint;
typedef vector<ll> vll;
const int inf = 537427207;
const ll INF = 1LL<<60;
const int MOD = (int)1e9 + 7;

int main(){
    int n; cin>>n;
    int sum = 0;
    vint t(n); rep(i,n){cin>>t[i]; sum += t[i];}
    int m; cin>>m;
    vector<ip> d(m); rep(i,m){cin>>d[i].first>>d[i].second; d[i].first--;}
    rep(i,m){
        cout<<sum-t[d[i].first]+d[i].second<<endl; 
    }   
}

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

int main(){
	/*入力*/
	int n;
	long int x;
	int o = 0;
	cin >> n >> x;
	int* l = new int [n];
	int* d = new int [n + 1]; 

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

	/*計算*/
	d[0] = 0;
	for(int i = 0; i < n + 1; i++){
		if(d[i] > x)	break;
		d[i+1] = d[i] + l[i];
		o++;
	}

	/*出力*/
	cout << o << endl;
	delete[] l;
	delete[] d;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0;i<(n);i++)
using namespace std;
int main(){
    string s;
    cin >> s;
    sort(s.begin(), s.end());
    if(s[0]==s[1]&&s[2]==s[3]&&s[1]!=s[2]){
        cout << "Yes" << endl;
        return 0;
    }
    cout << "No" << endl;
}

Measured memory_bytes: 256
n,m = [int(e) for e in input().split(" ")[:2]]

r_dic = {i+1: [] for i in range(n)}
for i in range(m):
	a,b = [int(e) for e in input().split(" ")[:2]]
	r_dic[a].append(b)
	r_dic[b].append(a)

m_dic = {i+1: None for i in range(1,n)}
search_flag_dic = {i+1: False for i in range(n)}

s_ls = [1]
while True:
	next_s_ls = []
	for s in s_ls:
		search_flag_dic[s] = True
		# 目的地の検索
		d_ls = r_dic[s]
		# 道しるべの書き込み
		for d in d_ls:
			if d == 1: continue
			if m_dic[d] is None: m_dic[d] = s
			next_s_ls.append(d)
	# 終了条件
	next_s_ls = list(set(next_s_ls))
	next_s_ls = [e for e in next_s_ls if search_flag_dic[e] is False]
	if len(next_s_ls) == 0: break
	s_ls = next_s_ls

result = "Yes" if len([k for k in m_dic if m_dic[k] is None]) == 0 else "No"
print(result)
if result == "Yes":
	for i in range(1,n):
		print(m_dic[i+1])

Measured memory_bytes: 63340
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        
        if(s.equals("ABC")){
            System.out.println("ARC");
        }
        else{
            System.out.println("ABC");
        }
        
    }
}

Measured memory_bytes: 35540
import java.util.Scanner;

class Main {

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        while (scan.hasNextInt()) {
            int n = scan.nextInt();
            int y = 0;
            
            for(int a = 0;a<10;a++){
            for(int b = 0;b<10;b++){
            for(int c = 0;c<10;c++){
            for(int d = 0;d<10;d++){
                if(a+b+c+d==n){
                    y++;
                }
                }
            }
            }
            }
                System.out.println(y);
        }
    }
    }



Measured memory_bytes: 26852
#include<bits/stdc++.h>
using namespace std;
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  string s;
  cin >> n >> s;
  int c = s[0];
  long ans = 1;
  for(int i = 0; i < n; i++){
    if(s[i] != c){
      ans++;
      c = s[i];
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin >> s;
  int q;
  cin >> q;
  //string ans = s;
  deque<char> ans;
  for(char ch: s) ans.push_back(ch);
  bool flag = true;
  char c;
  for(int i = 0, temp; i < q; ++i){
    cin >> temp;
    //if(temp == 1) reverse(ans.begin(), ans.end());
    if(temp == 1) flag = !flag; 
    else if(temp == 2){
      cin >> temp >> c;
      if((temp == 1 && flag) || (temp == 2 && !flag)) ans.push_front(c);
      else if((temp == 2 && flag) || (temp == 1 && !flag)) ans.push_back(c);
    }
  }
  if(!flag) reverse(ans.begin(), ans.end());
  for(char ch: ans)cout << ch;
  cout << endl;
}


Measured memory_bytes: 896
w, h, n = map(int, input().split())

x = []
y = []
a = []

xmin = 0
xmax = w
ymin = 0
ymax = h

ans = 0

for i in range(n):
    x1, y1, a1 = map(int, input().split())
    x.append(x1)
    y.append(y1)
    a.append(a1)

for i in range(n):
    if a[i] == 1:
        if x[i] > xmin:
            xmin = x[i]
        
    elif a[i] == 2:
        if x[i] < xmax:
            xmax = x[i]

    elif a[i] == 3:
        if y[i] > ymin:
            ymin = y[i]

    else:
        if y[i] < ymax:
            ymax = y[i]

#print(xmax)
#print(xmin)
#print(ymax)
#print(ymin)

if (xmax - xmin) <= 0 or (ymax - ymin) <= 0:
    ans = 0
    
else:
    ans = (xmax - xmin) * (ymax - ymin)

print(ans)


Measured memory_bytes: 3064
#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>
using namespace std;
typedef long long ll;

int main() {
  int X, N; cin >> X >> N;
  if (N == 0) {
    cout << X << endl;
    return 0;
  }
  vector<int> p(N);
  for (int i = 0; i < N; i++) {
    cin >> p[i];
  }
  sort(p.begin(), p.end());
  map<int, int> MAP;
  int flag = 0;
  for (int i = -1000; i <= 1000; i++) {
    if (i == p[flag]) {
      flag++;
      continue;
    }
    MAP[i] = abs(i-X);
  }
  pair<int, int> ans;
  ans.first = -1;
  ans.second = 1e9;
  for (auto t : MAP) {
    if (t.second < ans.second) {
      ans = t;
    }
    else if (t.second == ans.second) {
      ans.first = min(t.first, ans.first);
    }
  }
  cout << ans.first << endl;
}

Measured memory_bytes: 3720
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
using namespace std;
#define rep(i,x) for(int i = 0; i < x; i++)
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<vector<vector<int>>> vvvi;
const ll MOD = 1e9+7;
const int n_max = 1e5+10;

int main(){
    ll n,k; cin >> n >> k;
    string s;cin >> s;

    auto judge = [](string str){
        ll res = 0;ll temp_cnt = 0;
        ll len = str.size();
        rep(i,len){
            if(i == 0)temp_cnt++;
            if(str[i] == str[i-1])temp_cnt++;
            else{
                res += temp_cnt-1;
                temp_cnt = 1;
            }
        }
        res += temp_cnt-1;
        return res;
    };

    // cout << judge(s) << endl;
    ll start = judge(s);
    int type;
    // if(s[0] == s[n-1] && s[0] == 'L')type = 1;
    // else if(s[0] == s[n-1] && s[0] == 'R')type = 2;
    // else type = 0;

    if(s[0] == 'L')type = 1;
    else type = 2;

    string rev;
    if(type <= 1)rev = "LR";
    else rev = "RL";

    bool ok;
    if(s[0] == s[n-1])ok = true;
    else ok = false;

    ll count = 0;
    rep(i,n-1){
        string temp = {s[i],s[i+1]};
        if(temp == rev)count++;
    }

    ll ans = 0;
    if(ok)ans = start + min(count, k)*2;
    else{
        if(k < count)ans = start + k*2;
        else ans = start + count*2 -1;
    }

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

Measured memory_bytes: 512
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main(){
    input!{
        s:String
    }

    let mut temp = 'a';
    let mut cnt = 0;

    for i in s.chars(){
        if i == temp{
            cnt += 1;
        }
        temp = i;
        //println!("{}",i);
    }

    if cnt>0{
        println!("Bad");
    }else{
        println!("Good");
    }
}

Measured memory_bytes: 4352
#include <stdio.h>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
#include <functional>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef vector<vector<int>> v2int;
typedef vector<ll> vll;
typedef vector<vector<ll>> v2ll;
typedef list<int> liint;
typedef pair<int, int> pint;
const int INF = int(2e9);
const ll LINF = ll(2e9) * ll(2e9);
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T, class C> void chmax(T& a, C b) { a > b ? : a = b; }
template<class T, class C> void chmin(T& a, C b) { a < b ? : a = b; }



int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int X, N;
    cin >> X >> N;
    vint p(N);
    rep(i, N) cin >> p[i];
    set<int> pset(p.begin(), p.end());
    int err = INF;
    int ans = -100;
    REP(x, -100, 201) {
        if (abs(x - X) < err && pset.count(x) == 0) {
            ans = x;
            err = abs(x - X);
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3656
N, M = gets.split(" ").map(&:to_i)
s = []
M.times do |i|
    s[i] = gets.split(" ").map(&:to_i)
    s[i].shift
end
p = gets.split(" ").map(&:to_i)
ans = 0

(2**N).times do |i|
    i = i.to_s(2)
    while i.length < N do
        i = "0" + i
    end
    ok = 0
    for j in (0...M) do
        count = 0
        s[j].each do |sw|
            count += 1 if i[sw - 1] == "1"
        end
        ok += 1 if count % 2 == p[j] #&& count > 0
    end
    #puts i if ok == M
    ans += 1 if ok == M
end

puts ans

Measured memory_bytes: 1788
#include <stdio.h>
int main(void) {
	int n;
	int a[100000];
	int q[100000];
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%d", &a[i]);
	}
	for (int i = 0; i < n; i++) {
		q[a[i]-1] = i + 1;
	}
	for (int i = 0; i < n; i++) {
		printf("%d ", q[i]);
	}
	return 0;
}


Measured memory_bytes: 1536
#include <bits/stdc++.h>
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n,m,s=0; cin >> n >> m;
    for(int i=0;i<m;i++){
        int x; cin >> x;
        s+=x;
    }
    n-=s;
    if(n<0) cout << -1;
    else cout << n;
}


Measured memory_bytes: 3656
{-# OPTIONS_GHC -O2 -funbox-strict-fields #-}
{-# LANGUAGE BangPatterns      #-}
{-# LANGUAGE CPP               #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TupleSections     #-}

import           Control.Applicative
import           Control.Monad
import           Control.Monad.Primitive
import           Control.Monad.ST
import           Control.Monad.State.Strict
import           Data.Bool
import qualified Data.ByteString.Char8       as B
import qualified Data.ByteString.Unsafe      as B
import           Data.Char
import           Data.Function
import qualified Data.IntMap.Strict          as IM
import qualified Data.IntSet                 as IS
import qualified Data.List                   as L
import qualified Data.Map.Strict             as M
import           Data.Monoid
import           Data.Ord
import           Data.Primitive.MutVar
import qualified Data.Set                    as S
import           Data.Tuple
import qualified Data.Vector                 as V
import qualified Data.Vector.Generic         as G
import qualified Data.Vector.Generic.Mutable as GM
import qualified Data.Vector.Unboxed         as U
import qualified Data.Vector.Unboxed.Mutable as UM
import           Debug.Trace
import           Foreign                     hiding (void)
import           Unsafe.Coerce

main :: IO ()
main = do
    !n <- readLn :: IO Int
    xs <- L.unfoldr (B.readInt.B.dropWhile isSpace) <$> B.getLine
    putStr.unwords.map show$solve n xs

solve :: Int -> [Int] -> [Int]
solve n xs = [m, res]
  where
    !(m:ys) = L.sortBy (flip compare) xs
    res = L.minimumBy (comparing $ \x -> abs $ 2 * x - m) ys


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

#define rep(i,s,n) for (int i = (int)s; i < (int)n; i++)
#define ll long long
#define pb push_back
#define All(x) x.begin(), x.end()
#define Range(x, i, j) x.begin() + i, x.begin() + j
#define lbidx(x, y) lower_bound(x.begin(), x.end(), y) - x.begin()
#define ubidx(x, y) upper_bound(x.begin(), x.end(), y) - x.begin()
#define BiSearchRangeNum(x, y, z) lower_bound(x.begin(), x.end(), z) - lower_bound(x.begin(), x.end(), y)

int main() {
  int N, D;
  cin >> N >> D;
  int ans = 0;
  int tmp = 0;
  while (tmp < N) {
    tmp += 2 * D + 1;
    ans++;
  }
  cout << ans << endl;
};


Measured memory_bytes: 256
import java.util.*;
public class Main {

  public static void main(String[] args) { 
      Scanner sc = new Scanner(System.in);
      int h = sc.nextInt();
      int w = sc.nextInt();
      char[][] grid = new char[h][w];
      for(int i = 0; i < h; i++)
        grid[i] = sc.next().toCharArray();
      
      int[][] cnt = new int[h][w];
      if(grid[0][0] == '#')
        cnt[0][0] = 1;
      
      for(int i = 1; i < w; i++) {
        if(grid[0][i] == '.')
          cnt[0][i] = cnt[0][i-1];
        else {
          if(grid[0][i-1] == '#')
            cnt[0][i] = cnt[0][i-1];
          else
            cnt[0][i] = cnt[0][i-1] + 1;
        }
      }

      for(int i = 1; i < h; i++) {
        cnt[i][0] = cnt[i-1][0];
        if (grid[i-1][0] == '.' && grid[i][0] == '#')
        	cnt[i][0]++;
      }

      for(int i = 1; i < h; i++) {
        for(int j = 1; j < w; j++) {
          if(grid[i][j] == '.') {
            cnt[i][j] = Math.min(cnt[i-1][j], cnt[i][j-1]);
          } else {
            int up = cnt[i-1][j];
            if(grid[i-1][j] == '.')
              up++;
            int left = cnt[i][j-1];
            if(grid[i][j-1] == '.')
              left++;
            cnt[i][j] = Math.min(up, left);
          }
        }
      }

      System.out.println(cnt[h-1][w-1]);
  }
}

Measured memory_bytes: 24020
#include <cstdio>
using namespace std;
int main() {
    int dp[31];
    int n;
    dp[0]=1;
    dp[1]=1;
    dp[2]=2;
    for(int i=3;i<=30;i++){
        dp[i]=dp[i-1]+dp[i-2]+dp[i-3];
    }
    while(true){
        scanf("%d",&n);
        if(n==0) break;
        int day=(dp[n]+9)/10;
        printf("%d\n",(day+364)/365);
    }
    return 0;
}

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

#define int long long
#define pii pair<int, int>
#define pb push_back
#define vi vector<int>

signed main() {
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    int n, m;
    cin >> n >> m;
    vi a(n + 1);
    for(int i = 1; i <= n; i++){
        cin >> a[i];
    }
    vi v[n + 1];
    for(int j = 0; j < m; j++) {
        int x, y;
        cin >> x >> y;
        v[x].pb(y);
        v[y].pb(x);
    }
    int ans = 0;
    for(int i = 1; i <= n; i++) {
        bool to = 1;
        for(auto x: v[i]) {
            to &= (a[i] > a[x]);
        }
        ans += to;
    }
    cout << ans << endl;


    return 0;
}



Measured memory_bytes: 9800
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		int num = Integer.parseInt(br.readLine());

		System.out.println(num*num*num);

	}

}

Measured memory_bytes: 24372
/************************************
	Name: 荆国浩 
	E-mail: 1839714778@qq.com 
************************************/
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <string>
#include <string.h>
#include <stdio.h>
#include <fstream>
#include <stack>
#define rep(N) for(int i=0;i<N;i++)
#define ll long long 
#define pii pair<int,int>
#define For(I,N) for(int I=0;I<N;I++)
using namespace std;

int main()
{
//	freopen("input.txt","r",stdin);
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	int e=min(b,d);
	int f=max(a,c);
	if(e-f>=0)
	{
		cout<<e-f<<endl;
	}
	else
	{
		cout<<0<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
#define pb push_back
int dy[]={0, 0, 1, -1, 1, 1, -1, -1};
int dx[]={1, -1, 0, 0, 1, -1, -1, 1};

#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define mp make_pair
#define fi first
#define sc second
int n;
char s[1000005];
int maxi = 0;
int main(){
    scanf("%s",s);
    n = strlen(s);

    REP(i,n){
        if(s[i] != 'O')
            continue;

        int si = i,ei = i;
        while(ei < n - 1 && s[ei + 1] == 'O')ei++;
        i = ei + 1;

        if(ei - si + 1 <= maxi)continue;

        int l = si;
        while(l - 1 >= 0 && s[l - 1] == 'J')l--;
        int r = ei;
        while(r + 1 < n && s[r + 1] == 'I')r++;
        if(min(si - l,r - ei) >= ei - si + 1)
            maxi = ei - si + 1;
    }
    printf("%d\n", maxi);
    return 0;
}

Measured memory_bytes: 4204
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define pb push_back
ll mygcd(ll a,ll b){
	if(b==0ll)return a;
	return mygcd(b,a%b);
}
int N;
ll A[100100];
vector<ll> ps;
int main(){
	cin >> N;
	for(int i=0;i<N;i++){
		cin >> A[i];
		if(A[i]!=1ll)ps.pb(A[i]);
	}
	for(ll i=2;i*i<=1000000000ll;i++){
		for(int j=0;j<N;j++){
			if(A[j]%i==0ll){
				ps.pb(i);
				break;
			}
		}
	}
	sort(ps.begin(),ps.end());
	ps.erase(unique(ps.begin(),ps.end()),ps.end());
	ll ans = 0ll;
	for(int i=0;i<ps.size();i++){
		ll sum = 0ll;
		for(int j=0;j<N;j++){
			if(A[j]%ps[i]==0ll)sum += A[j];
		}
		ans = max(ans,sum);
	}
	cout << ans << endl;
	return 0;
}




Measured memory_bytes: 3220
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); i++)
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define MOD 1000000007
using namespace std;
typedef long long ll;

int main(){
    int a, b, c;
    cin >> a >> b >> c;
    if(c >= a && c <=  b) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
void swap(int*a,int*b){int t=*a;*a=*b;*b=t;}
int main(void)
{
  int a,b,c;
  for(;;){
    scanf("%d%d",&a,&b); if(!a)break;c=0;
    if(a<b)swap(&a,&b);
    while(b){
      a=a%b;swap(&a,&b);c++;
    }printf("%d %d\n",a,c);
  }
  return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
#include<string.h>
#define ll long long 
#include<vector>
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
const int mod=1e9+7;
ll dp[3002][3002][2];
	int n;
	ll v[3002];
ll solve(int i, int j, int turn){
	if(i>j)
	return 0;
	if(dp[i][j][turn]!=-1)
	return dp[i][j][turn];
	if(turn==0)
	return dp[i][j][turn]=max(v[i]+solve(i+1,j,1),v[j]+solve(i,j-1,1));
	else
	return dp[i][j][turn]=min(solve(i+1,j,0),solve(i,j-1,0));
}
int main(){
	IOS;
	cin>>n;
	ll sum=0;
	for(int i=0;i<n;i++)
	{
	cin>>v[i];
	sum+=v[i];}
	memset(dp,-1,sizeof(dp));
	//dp[i][j][0] = max(a[i]+dp[i+1][j][1],a[j]+dp[i][j-1][1])
	//dp[i][j][1] = min(dp[i+1][j][0],dp[i][j-1][0])
	cout<<2*solve(0,n-1,0)-sum;
}

Measured memory_bytes: 144676
#include <bits/stdc++.h>
using namespace std;
const int N = 100205, _6 = 1000006;
#define pb push_back
typedef  long long ll;
ll gcd(ll f , ll s){if(s==0)return f;else return gcd(s,f%s);}

int main(){
	
	ll a , b , c , d;
	cin >> a >> b >> c >> d;
	ll temp = c + b, temp1 = a + c, tmep2 = a + b;
	if(d%2==0){
		if(abs(a-b) > 1e18)printf("%s\n", "Unfair");
		else
		printf("%lld\n", a-b);
	}
	else{
		if(abs(temp-temp1) > 1e18)printf("%s\n", "Unfair");
		else
		printf("%lld\n", temp-temp1);	
	}
	return 0 ;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i = (m); i <= (n); i++)
#define zep(i,m,n) for(ll i = (m); i < (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define printa(x,m,n) for(int i = (m); i <= n; i++){cout << (x[i]) << " ";} cout<<endl;

int main(){
	cin.tie(0); ios::sync_with_stdio(false);
	
	ll n, k; cin >> n >> k;
	ll a[n]; zep(i, 0, n)cin >> a[i];
	sort(a, a + n);
	
	ll ans = 0;
	zep(i, 0, k){
		ans += a[i];
	}
	print(ans)
	
	return 0;
}

Measured memory_bytes: 3676
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,b,a) for(int i=b;i>=a;i--)
#define fori(a) for(auto i : a )
#define all(a) begin(a), end(a)
#define set(a,b) memset(a,b,sizeof(a))
#define sz(a) a.size()
#define pi 3.14159
#define ll long long
#define ull unsigned long long
#define pb push_back
#define PF push_front //deque
#define mp make_pair
#define pq priority_queue
#define mod 1000000007
#define f first
#define s second
#define pii pair< int, int >
#define vi vector<int>
#define vpii vector<pii>
#define debug(v) for(auto i:v) cout<<i<<" ";
#define tc int t; cin >> t; while(t--)

using namespace std;
string repeat(string s, int n) {
    string s1 = "";
    for (int i=0; i<n;i++)
        s1+=s;
    return s1;
}
string getString(char x) {
    string s(1, x);
    return s;
}

void optimizeIO(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}
int gcd(int a, int b){
    if (a == 0)  return b;
    return gcd(b % a, a);
}
void  solve(){
	int x,y;
	cin>>x>>y;
	if(y>=x) cout<<x<<endl;
  else cout<<x-1<<endl;
}
int main(){
    optimizeIO();
    // tc
    { solve();
    }
}


Measured memory_bytes: 3580
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
const int INF=1e9,MOD=1e9+7,ohara=1e6+10;
const ll LINF=1e18;
using namespace std;
    
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout<<(x)<<endl
#define doublecout(a) cout<<fixed<<setprecision(15)<<a<<endl;
#define Cerr(x) cerr<<(x)<<endl
#define fi first
#define se second
#define P pair<ll,ll> 
#define m_p make_pair
#define V vector<ll> 
#define U_MAP unordered_map<ll,ll>
#define pq priority_queue<ll>
#define rpq priority_queue<ll,vector<ll>,greater<ll>>
#define p_b push_back
    
ll n,cnt,ans,a,b,c,d,tmp,tmpp,m,h,w,x,y,sum,pos,k,q;
ld doua;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
//int dy[]={-1,0,1,-1,1,-1,0,1};
//int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl;
struct edge{int to,cost;};
U_MAP mp;
    
//------ Believe yourself as a genius!!!!!! ------
    
int main(void){
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    
    cin>>n>>m;
    rep(i,n){
        cin>>a;
        rep(j,a){
            cin>>b;
            mp[b]++;
            if(mp[b]==n)ans++;
        }
    }
    Cout(ans);
    return 0;
}

Measured memory_bytes: 256
n = int(input())
A = list(map(int, input().split()))
x, y, z = 1000, 0, 1000
for a in A:
  s1, t1 = divmod(x, a)
  s2, t2 = divmod(z, a)
  s2 += y
  if s1 > s2:
    y, z = s1, t1
  elif s2 > s1:
    y, z = s2, t2
  else:
    y, z = s1, max(t1, t2)
  x = max(x, y*a+z)
ans = x
print(ans)

Measured memory_bytes: 61944
# 参考: https://atcoder.jp/contests/abc073/submissions/4399177
N, M, R = gets.chomp.split.map(&:to_i)
RS = gets.chomp.split.map(&:to_i)

dp = Array.new(N+1) { Array.new(N+1, Float::INFINITY) }
(1..N).each { |i| dp[i][i] = 0 }
M.times do
  a, b, c = gets.chomp.split.map(&:to_i)
  dp[a][b] = c
  dp[b][a] = c
end

(N+1).times do |k|
  (N+1).times do |i|
    (N+1).times do |j|
      cost = dp[i][k] + dp[k][j]
      dp[i][j] = cost if dp[i][j] > cost
    end
  end
end

ans = Float::INFINITY
RS.permutation(R).each do |paths|
  dist = 0

  paths.each_cons(2) do |from, to|
    dist += dp[from][to]
  end

  ans = dist if ans > dist
end
p ans

Measured memory_bytes: 2172
#include <bits/stdc++.h>
#define fup(i,a,b) for(int i=a;i<=b;++i)
#define fdw(i,a,b) for(int i=a;i>=b;--i)
#define sync ios::sync_with_stdio(false);cin.tie(0)
#define cl(a) memset(a,0,sizeof(a))
#define gcd __gcd
#define fi first
#define se second
#define pb push_back
#pragma GCC optimize(2)
using namespace std;
typedef long long ll;
//ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
//ll ksm(ll a,ll b,ll mod){ll res=1;a%=mod;for(;b;b>>=1){if(b&1) res=res*a%mod;a=a*a%mod;}return res;}
//ll oula(ll n){ ll res=n;for(ll i=2;i*i<=n;i++){if(n%i==0){ res=res-res/i;while(n%i==0) n/=i;}}if(n>1) res=res-res/n;return res;}
//bool MRT(ll x){if(x==2)return true;fup(i,1,50){ll now=rand()%(x-2)+2;if(ksm(now,x-1,x)!=1)return false;}return true;}
//void shai(int n)fup(i,2,n){if(isprime[i]){v.push_back(i);for(int j=2*i;j<=10000;j+=i)isprime[j]=0;}}//"埃氏筛筛选素数"
const int mod=998244353;
const int inf=0x3f3f3f3f;
const double eps=1e-7;
const int N=1e3+10;
int a[12],n;
void dfs(int bit,int mx)
{
    if(bit == n)
    {
        for(int i = 0; i < n; i++)
        {
            putchar('a'+a[i]);
        }
        putchar('\n');
        return;
    }
    for(int i = 0; i <= mx+1; i++)
    {
        a[bit] = i;
        dfs(bit+1,max(mx,i));
    }
}
int main()
{
    cin>>n;
    a[0] = 0;
    dfs(1,0);
    return 0;
}



Measured memory_bytes: 1536
#include<bits/stdc++.h>
using namespace std;
#define LL long long
LL k,n,cur,a[1000010];
set<LL>s;
int main()
{
	cin>>k;
	cur=7;n=1;
	a[cur%k]=1;
	if(cur%k==0)return printf("1\n"),0;
	while(true)
	  {
	  cur=cur*10+7,n++;
	  cur%=k;
	  if(cur==0)return printf("%lld\n",n),0;
	  if(a[cur%k])return printf("-1\n"),0;
	  a[cur%k]=1;
	  }
}

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

int main(){
int a,b,c,d,e;
int A,B,C,D,E;
cin>>a>>b>>c>>d>>e;
if(a>b){
A=a;
B=b;}
else{
A=b;
B=a;}
if(c<B){
C=c;}
else{
C=B;
if(c<A){
B=c;}
else{
B=A;
A=c;}}
if(d<C){
D=d;}
else{
D=C;
if(d<B){
C=d;}
else{
C=B;
if(d<A){
B=d;}
else{
B=A;
A=d;}}}
if(e<D){
	E=e;}
else{
E=D;
if(e<C){
D=e;}
else{
D=C;
if(e<B){
C=e;}
else{
C=B;
if(e<A){
B=e;}
else{
B=A;
A=e;}}}}
cout<<A<<" "<<B<<" "<<C<<" "<<D<<" "<<E<<endl;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
#define pf printf
#define sf scanf
typedef long long LL;
using namespace std;
int main()
{
    int t;

    /*while(t--)
    {

    }*/
    sf("%d",&t);
    int a=t%10;
    int b=t/10;
    if(a==9||b==9)
    {
        printf("Yes\n");
    }
    else
    {
        printf("No\n");
    }


    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int a,b,x,y;
  cin>>a>>b>>x>>y;
  int aa=max(a,x);
  int bb=min(b,y);
  if(bb<aa)cout<<0<<endl;
  else cout<<bb-aa<<endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<stack>
#include<cstdio>
#include<sstream>
#include<iomanip>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<int,pii> pip;
typedef vector<pip>vip;
const double PI=acos(-1);
const double EPS=1e-5;
const int inf=1e8;
struct UnionFind{
    vector<int> data;
    UnionFind(int size) : data(size, -1) {}
    bool unionSet(int x,int y){
        x=root(x);y=root(y);
        if(x==y)return 0;
        if(data[y]<data[x])swap(x,y);
        data[x]+=data[y],data[y]=x;
        return 1;
    }
    bool findSet(int x,int y){
        return root(x)==root(y);
    }
    int root(int x){
        return data[x]<0 ? x : data[x]=root(data[x]);
    }
    int size(int x){
        return -data[root(x)];
    }
};
int main(){
	int n,k,l;
	cin>>n>>k>>l;
	vp p(k),r(l);
	rep(i,k)cin>>p[i].first>>p[i].second;
	rep(i,l)cin>>r[i].first>>r[i].second;
	UnionFind uf1(n),uf2(n);
	rep(i,k){
		p[i].first--;p[i].second--;
		uf1.unionSet(p[i].first,p[i].second);
	}
	rep(i,l){
		r[i].first--;r[i].second--;
		uf2.unionSet(r[i].first,r[i].second);
	}
	vi a(n),b(n);
	int co1=0,co2=0;
	rep(i,n){
		if(uf1.data[i]<0){
			a[i]=co1;
			co1++;
		}
		if(uf2.data[i]<0){
			b[i]=co2;
			co2++;
		}
	}
	vp out(n),tmp;
	rep(i,n)out[i]=pii(a[uf1.root(i)],b[uf2.root(i)]);
	tmp=out;
	sort(all(out));
	rep(i,n){
		if(i)cout<<" ";
		cout<<(upper_bound(all(out),tmp[i])-lower_bound(all(out),tmp[i]));
	}
	cout<<endl;
}
	













Measured memory_bytes: 8448
#include <bits/stdc++.h>
#define PI 3.1415926535897
using namespace std;
typedef long long ll;
const int INF = 1000000000;
const ll LINF = 1000000000000000000; //1e18
const double EPS = 1e-10;

int main(void)
{
    int N;
    cin >> N;

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

    int sum;
    int mx = -1;
    for (int i = 0; i < N; i++)
    {
        sum = 0;
        for (int k = 0; k <= i; k++)
        {
            sum += upper[k];
        }
        for (int j = i; j < N; j++)
        {
            sum += lower[j];
        }
        mx = max(mx, sum);
    }
    int ans = mx;
    cout << ans << endl;
}

Measured memory_bytes: 256
import fractions
from functools import reduce

divisor = 10**9 + 7

def lcm(x,y):
    return (x*y // fractions.gcd(x,y))

def lcm_list(numbers):
    return reduce(lcm, numbers, 1)

N = int(input())
numbers = [int(i) for i in input().split()]

lowest_common_multiple = lcm_list(numbers)

cnt = 0
for i in numbers:
    cnt += lowest_common_multiple // i
    
print(cnt%divisor)

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

namespace ABC179
{
    using static Ex;
    public class Solve
    {
        public static void Main(string[] args)
        {
            new ABC_A();
        }
    }
    public class ABC_A
    {
        public ABC_A()
        {
            var s = Read;
            if (s.LastOrDefault() == 's') (s + "es").Cw();
            else (s + "s").Cw();
        }
    }
    public class ABC_B
    {
        public ABC_B()
        {
        }
    }
    public class ABC_C
    {
        public ABC_C()
        {
        }
    }

    public static class Ex
    {
        public static void Cw(this object s) { Console.WriteLine(s); }



        public static bool Mins<T>(ref T a, T b) where T : IComparable<T> { if (a.CompareTo(b) > 0) { a = b; return true; } return false; }
        public static bool Maxs<T>(ref T a, T b) where T : IComparable<T> { if (a.CompareTo(b) < 0) { a = b; return true; } return false; }
        public static void Swap<T>(ref T a, ref T b) { var t = b; b = a; a = t; }
        public static void Swap<T>(List<T> list, int i, int j) { T tmp = list[j]; list[j] = list[i]; list[i] = tmp; }

        public static long Lcm(int x, int y) { return x / Gcd(x, y) * y; }
        public static long Gcd(long m, long n) { if (n == 0) return m; return Gcd(n, m % n); }
        public static List<string> FastSort(this List<string> s) { s.Sort(StringComparer.Ordinal); return s.ToList(); }
        public static void yesno(this bool b) { (b ? "yes" : "no").Cw(); }
        public static void YesNo(this bool b) { (b ? "Yes" : "No").Cw(); }
        public static void YESNO(this bool b) { (b ? "YES" : "NO").Cw(); }

        public static string Read { get { return Console.ReadLine().Trim(); } }
        public static int ReadInt { get { return int.Parse(Read); } }
        public static long ReadLong { get { return long.Parse(Read); } }
        public static double ReadDouble { get { return double.Parse(Read); } }
        public static string[] ReadArray() { return Read.Split(' '); }
        public static int[] ReadIntArray() { return Read.Split(' ').Select(int.Parse).ToArray(); }
        public static long[] ReadLongArray() { return Read.Split(' ').Select(long.Parse).ToArray(); }
        public static string[] ReadArray(long N) { var v = new string[N]; for (long i = 0; i < N; ++i) v[i] = Read; return v; }
        public static int[] ReadIntArray(long N) { var v = new int[N]; for (long i = 0; i < N; ++i) v[i] = ReadInt; return v; }
        public static long[] ReadLongArray(long N) { var v = new long[N]; for (long i = 0; i < N; ++i) v[i] = ReadLong; return v; }

        public static (T, T) ToTpl2<T>(this T[] v) { return (v[0], v[1]); }
        public static (T, T, T) ToTpl3<T>(this T[] v) { return (v[0], v[1], v[2]); }
        public static (T, T, T, T) ToTpl4<T>(this T[] v) { return (v[0], v[1], v[2], v[3]); }
        public static (T, T, T, T, T) ToTpl5<T>(this T[] v) { return (v[0], v[1], v[2], v[3], v[4]); }
    }
}


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

#define pb push_back
#define fi first
#define se second
#define ll long long
#define ld long double
#define pii pair < int , int >
#define pll pair < long long, long long >

const int N = 200005;


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

    int n;
    cin >> n;
    int dp[n + 2][2][2][2] = {};
    int a1[n + 2][2][2][2] = {};

    for (int i = 0; i < n; ++i)
    {
        int a, b, c;
        cin >> a >> b >> c;
        if (!i)
        {
            dp[1][1][0][0] = a; a1[1][1][0][0] = 1;
            dp[1][0][1][0] = b; a1[1][0][1][0] = 2;
            dp[1][0][0][1] = c; a1[1][0][0][1] = 3;
            continue;
        }

        pii f = {dp[i][0][1][0], 2};
        if (f.fi < dp[i][0][0][1]) f = {dp[i][0][0][1], 3};

        pii s = {dp[i][1][0][0], 1};
        if (s.fi < dp[i][0][0][1]) s = {dp[i][0][0][1], 3};

        pii t = {dp[i][1][0][0], 1};
        if (t.fi < dp[i][0][1][0]) t = {dp[i][0][1][0], 2};

        dp[i + 1][1][0][0] = f.fi + a; a1[i + 1][1][0][0] = f.se;
        dp[i + 1][0][1][0] = s.fi + b; a1[i + 1][0][1][0] = s.se;
        dp[i + 1][0][0][1] = t.fi + c; a1[i + 1][0][0][1] = t.se;
//        cout<<f.fi + a<<" "<<s.fi + b<<" "<<t.fi + c<<endl;
    }

    int ans = dp[n][1][0][0];
    int now = 1;
    if (dp[n][0][1][0] > ans)
    {
        ans = dp[n][0][1][0];
        now = 2;
    }
    if (dp[n][0][0][1] > ans)
    {
        ans = dp[n][0][0][1];
        now = 3;
    }

    cout << ans << '\n';
    vector < char > v;
    for (int i = n; i >= 1; --i)
    {
        v.pb(char(now + 'A' - 1));
        if (now == 1) now = a1[i][1][0][0]; else
        if (now == 2) now = a1[i][0][1][0]; else
        if (now == 3) now = a1[i][0][0][1];
    }
//    reverse(v.begin(), v.end());
//    for (int i = 0; i + 1 < v.size(); ++i)
//        cout<<v[i]<<" ";
//    cout<<v.back()<<endl;

}


Measured memory_bytes: 6684