akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

int main() {
  int N,K;
  int ans = 0;
  int min = 999;
  cin >> N;
  for (int i= 0; N > i; i++){
    cin >> K;
    int ans = 0;
    while (K%2 == 0){
      K /= 2;
      ans += 1;
    }
    if (ans < min)
      min = ans;
  }
  cout << min << endl;
}

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

int main() {
  //宣言
  int N, K, iX;
  int ans = 0;
  
/*  int sa(int a, int b){
    if (a-b >= 0)return a-b;
    else return b-a;
  }
*/  
  //入力
  cin >> N >> K;
  
  //処理
  for(int i =0 ; i < N ; i++){
    cin >> iX;
    ans += min(iX,K-iX)*2;
  }
  
  //出力
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <sstream>
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define rep(i,a,b) for(ll i = a; i <= b; ++i)
#define fo(i,a,b) for(int i = a; i<= b; ++i)
#define ull unsigned long long int
#define ll long long
#define all(a) a.begin(),a.end()
using namespace std;
typedef vector<ll> vi;
typedef pair<ll,ll> pi;
ll MD=1000000007;
ll md=998244353;
ll exp(ll a,ll b){ll r=1ll;while(b>0){if(b&1){r=r*(a%md);r=(r+md)%md;}b/=2;a=(a%md)*(a%md);a=(a+md)%md;}return (r+md)%md;}//put b as bmod(md-1) if md is prime}
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll pow_2(ll a, ll b)
{
    ll res = 1;
    while(b)
    {
        if(b & 1)
            res = (res * a);
        a = (a * a);
        b >>= 1;
    }

    return res;
}
bool isPrime(ll a)
{
    for(ll i=3; (i*i)<=a; i+=2)
    {
        if( (a%i)==0 )
            return false;
    }
    if( ( a!=2 ) && ( (a%2)==0 ) )
        return false;
    if( a==1 )
        return false;

    return true;
}
string decToBinary(int n)
{
    // Size of an integer is assumed to be 32 bits
    string s="";
    for (int i = 31; i >= 0; i--) {
        int k = n >> i;
        if (k & 1)
            //cout << "1";
            s=s+"1";
        else
            //cout << "0";
            s=s+"0";
    }
    return s;
}
int decimalToBinary(int N)
{

    // To store the binary number
    ull B_Number = 0;
    int cnt = 0;
    while (N != 0) {
        int rem = N % 2;
        ull c = pow(10, cnt);
        B_Number += rem * c;
        N /= 2;

        // Count used to store exponent value
        cnt++;
    }

    return B_Number;
}
string toString(ull num)
{
    std::string number;
    std::stringstream strstream;
    strstream << num;
    strstream >> number;
    return number;
}
const double PI = acos(-1);
int main()
{
    ios_base::sync_with_stdio(false);
	cin.tie(NULL);cout.tie(NULL);
    int n;
    cin>>n;
    vector<int> vec[n];
    int x;
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<3;j++)
        {
            cin>>x;
            vec[i].PB(x);
        }
    }
    int dp[n][3];
    dp[0][0]=vec[0][0];
    dp[0][1]=vec[0][1];
    dp[0][2]=vec[0][2];;
    for(int i=1;i<n;i++)
    {
        dp[i][0]=max(dp[i-1][1]+vec[i][0],dp[i-1][2]+vec[i][0]);
        dp[i][1]=max(dp[i-1][2]+vec[i][1],dp[i-1][0]+vec[i][1]);
        dp[i][2]=max(dp[i-1][0]+vec[i][2],dp[i-1][1]+vec[i][2]);
    }
    cout<<max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2]))<<endl;
return 0;}




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

#define pb         push_back

typedef long long ll;
const ll INF = 1000000000000000000ll;
const ll MOD = 1000000007ll;
const double EPS = 1e-8;

ll getDigit(ll num){
	ll cnt = 0;
	while(num > 0){
		num /= 10;
		cnt++;
	}
	return cnt;
}

int main(void) {
	//ios_base::sync_with_stdio(false);
	//cin.tie(0);
	
	ll n;
	cin >> n;

	ll ans = INF;
	for(ll i=1; i*i <= n; i++){
		if(n % i == 0){
			ans = min(ans, max(getDigit(i), getDigit(n/i)));
		}
	}
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

/**
 * @author kawakami
 *
 */
class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner as = new Scanner(System.in);
		
		String str,copy,dam;
		String chg = "";
		
		str = as.nextLine();
		char line[];
		char hika[];
		line = new char[str.length()];
		hika = new char[str.length()];
		
		copy = str;
		copy = copy.toLowerCase();
		
		for(int i=0;i<str.length();i++){
			
			line[i] = str.charAt(i);
			hika[i] = copy.charAt(i);
			
			
		}
		
		for(int i=0;i<str.length();i++){
			
			if(line[i] != hika[i]){
				
				dam = String.valueOf(line[i]);
				dam = dam.toLowerCase();
				chg = chg + dam;
				
			}
			else{
				
				dam = String.valueOf(line[i]);
				dam = dam.toUpperCase();
				chg = chg + dam;
				
			}
			
			
			
		}
		
		System.out.println(chg);

	}

}

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

int main(){

    long long sum = 0;
    string S;
    cin >> S;

    int n = S.size(); 
    for (int i = 0; i < pow(2, n-1);i++){
        long long  part = 0;
        for(int j = 0; j < n-1;j++){

            part *= 10;
            part += (int)(S[j] - '0');
            if((i & (int)pow(2, j)) != 0){
                sum += part;
                part = 0;
            }
        }
        part *= 10;
        part += (int)(S[n-1] - '0');
        sum += part;

    }

    cout << sum << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define F first
#define S second 
#define mp make_pair
#define pb push_back
#define pf push_front
#define speed_up ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define sz() (int)x.size()
#define all(x) x.begin(), x.end()
#define debug cerr << "OK\n";
#define ub upper_bound
#define lb lower_bound
#define treap_pair pair<treap*, treap*>
 
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<pii> vpii;
typedef set <int> si;
typedef set <ll> sll;
typedef multiset <int> msi;
typedef multiset <ll> msll;
typedef map <int, int> mi;
typedef map <ll, int> mll;
 
const int N = 2e5 + 2;
const int M = 1e5 + 2;
const int mod = 998244353;
const int inf = 1e9;
const ll INF = 1e16;

void data() {
	#ifdef PC
		freopen("d.in", "r", stdin);
		freopen("d.out", "w", stdout);
	#endif
}

int n, x, y, ans[N];

int main() {
	data();
	scanf("%d %d %d", &n, &x, &y);
	int len = y - x;
	int cyc = y - x + 1;
	for (int i = 1; i <= n; ++i) {
		for (int j = i + 1; j <= n; ++j) {	
			if (i < x && x <= j && j <= y)
				ans[min(j - i, x - i + min(cyc - (j - x), j - x))]++, cerr << "1 ";
			else if (i < x && j > y)
				ans[j - i - len + 1]++, cerr << "2 ";
			else if (x <= i && i <= y && j > y)
				ans[min(j - i, j - y + min(cyc - (y - i), y - i))]++, cerr << "3 ";
			else if (x <= i && i <= y && x <= j && j <= y)
				ans[min(j - i, cyc - (j - i))]++, cerr << "4 "; 
			else
				ans[j - i]++;
		}
	}
	for (int i = 1; i < n; ++i)
		printf("%d\n", ans[i]);

}

/*
	Timus: 288481RF
	CodeForces: fractal
*/

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

int main() {
    stack<int> s;
    string in, buf;
    getline(cin, in);
    stringstream ss(in);
    
    while(ss >> buf){
        if(buf == "+"){
            int a = s.top(); s.pop();
            int b = s.top(); s.pop();
            s.push(a+b);
        }else if(buf == "-"){
            int a = s.top(); s.pop();
            int b = s.top(); s.pop();
            s.push(b-a);
        }else if(buf == "*"){
            int a = s.top(); s.pop();
            int b = s.top(); s.pop();
            s.push(a*b);
        }else{
            s.push(atoi(buf.c_str()));
        }
    }
    
    cout << s.top() << endl;
    return 0;
}

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


public class Main {

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

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String[] parts = br.readLine().split(" ");
		int N = Integer.parseInt(parts[0]);
		int M = Integer.parseInt(parts[1]);

		int[] ac = new int[N];
		int[] wa = new int[N];

		while (M > 0) {
	
			parts = br.readLine().split(" ");
			int index = Integer.parseInt(parts[0])-1;
			
			if(parts[1].equals("AC")) {
				if(ac[index]==0) {
			
					ac[index]++;
		
				}
			}else {
				if(ac[index]==0) {
		
					wa[index]++;
			
				}
			}

			M--;
		}
		
		for (int i = 0; i < N; i++) {
			if(ac[i]==0) {
				wa[i] = 0;
			}
		}
		int sumAc = 0;
		int sumWa = 0;
		
		for (int i = 0; i < N; i++) {
			sumWa+=wa[i];
		}
		
		for (int i = 0; i < N; i++) {
			sumAc += ac[i];
		}
		
		System.out.println(sumAc+" "+sumWa);

	}

}


Measured memory_bytes: 48160
#include <iostream>

using namespace std;

int main(){
	int n,k;
	cin>>n>>k;
	int arr[n];
	for(int i=0;i<n;i++){
		cin>>arr[i];
	}
	int sum=0;
	while(k--){
		int min=9999,k;
		for(int i=0;i<n;i++){
			if(min>=arr[i]){
				min=arr[i];
				k=i;
			}
		}
		arr[k]=99999;
		sum+=min;
	}
	cout<<sum;
}


Measured memory_bytes: 3132
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("fma,avx,avx2")

#include <bits/stdc++.h>

using namespace std;

#define int long long
#define sz(a) (int) (a).size()
#define all(a) (a).begin(), (a).end()
#define x first
#define y second

const int inf = 1e9 + 10;

vector<int> a;

int cnt(int x) {
    int res = 0;
    for (auto &el : a) {
        res += (el + x - 1) / x - 1;
    }
    return res;
}

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

    int n, k;
    cin >> n >> k;
    a.resize(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    int l = 0, r = inf + 1, m;
    while (r - l > 1) {
        m = l + (r - l) / 2;
        if (cnt(m) <= k) {
            r = m;
        } else {
            l = m;
        }
    }
    cout << r << "\n";

    return 0;
}


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

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	int n,m;
	cin>>n>>m;
	int x=1;
	for(int i=0;i<m;++i)x*=2;
	cout<<((n-m)*100+1900*m)*x<<"\n"s;
}

Measured memory_bytes: 256
from collections import  deque
n = int(input())
lst = list(input().split())
reverse = False
b = deque()
for a in lst:
	if reverse:
		b.appendleft(a)
	else:
		b.append(a)
	reverse = not reverse

answer =[]
if reverse:
	while b:
		answer.append(b.pop())
else:
	while b:
		answer.append(b.popleft())

print(" ".join(answer))

Measured memory_bytes: 26692
#include <stdio.h>
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
#include <atcoder/all>

using ll = long long int;
const int INF = (1<<25);
const ll INFLL = (1ll<<60);
const ll MOD = 998244353ll;

#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	a = (a<MOD)?a:(a-MOD);
	b = (b<MOD)?b:(b-MOD);
	a += b;
	a = (a<MOD)?a:(a-MOD);
}

int main(void){
	int n,m,i,j;
	bool flag = false;
	std::cin >> n >> m;
	std::vector<int> a(n),b(m);
	for(i=0; i<n; ++i){
		std::cin >> a[i];
	}
	for(j=0; j<m; ++j){
		std::cin >> b[j];
	}
	auto ans = atcoder::convolution<998244353>(a,b);
	for(auto c: ans){
		std::cout << (flag?" ":"") << c;
		flag = true;
	}
	std::cout << std::endl;
	return 0;
}


Measured memory_bytes: 18980
import sys
sys.setrecursionlimit(20000000)

n = int(input())

graph = [[] for _ in range(n)]
for i in range(n-1):
    u, v, w = map(int, input().split())
    graph[u-1].append([v-1, w])
    graph[v-1].append([u-1, w])
# print(graph)

ans = [-1]*n

def dfs(node, dist):
    for next_node, edge_size in graph[node]:
        if ans[next_node] == -1:
            ans[next_node] = (dist+edge_size) % 2
            dfs(next_node, dist+edge_size)


dfs(0, 0)
print(*ans, sep='\n')


Measured memory_bytes: 87100
import collections

def primes(n):
  cnt=collections.defaultdict(int)
  for i in range(2,int(n**0.5)+1):
    if n%i==0:
      while n%i==0:
        cnt[i]+=1
        n//=i
  if n!=1:
    cnt[n]+=1
  return cnt

n=int(input())
cnt=primes(n)
ans=0
for key in cnt.keys():
  val=cnt[key]
  for i in range(100):
    if (i*(i+1))//2>val:
      ans+=i-1
      break
print(ans)

Measured memory_bytes: 9724
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<math.h>
#include<queue>
#include<deque>
#include<stack>
#include<cstdio>
#include<utility>
#include<set>
#include<list>
#include<cmath>
#include<stdio.h>
#include<string.h>
#include<iomanip>
#include<cstdio>
#include<cstdlib>
#include<cstring>
using namespace std;
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define REP(i, n) FOR(i, 0, n - 1)
#define NREP(i, n) FOR(i, 1, n)
using ll = long long;
using pii = pair<int, int>;
using piii = pair<pii, pii>;
const ll dx[4] = { 0, -1, 1, 0 };
const ll dy[4] = { -1, 0, 0, 1 };
const int INF = 1e9 + 7;
int gcd(int x, int y) {
	if (x < y)swap(x, y);
	if (y == 0)return x;
	return gcd(y, x%y);
}
void mul(ll a, ll b) {
	a = a * b % INF;
}
using Graph = vector<vector<int>>;
///////////////////////////////////////



int main() {
	int N; cin >> N;
	int a[200100];
	set<int>v;
	REP(i, N) {
		cin >> a[i];
		if (v.count(a[i])!=0) {
			cout << "NO" << endl;
			return 0;
		}
		v.insert(a[i]);
	}
	cout << "YES" << endl;
	return 0;
}

Measured memory_bytes: 10368
#include <bits/stdc++.h>
#define WHOLE(v) (v).begin(), (v).end()
#define REV_WHOLE(v) (v).rbegin(), (v).rend()
using i64 = int64_t;
using namespace std;
template<size_t I,class H,class...T>struct TupleReaderWriter{static tuple<H,T...> r(istream&i){H v;i>>v;return tuple_cat(tuple<H>(v),TupleReaderWriter<sizeof...(T)-1,T...>::r(i));}static void w(ostream&o,tuple<H,T...>&t,string d){TupleReaderWriter<I-1,H,T...>::w(o,t,d);o<<d<<get<I>(t);}};
template<class H,class...T>struct TupleReaderWriter<0,H,T...>{static tuple<H,T...> r(istream&i){H v;i>>v;return tuple<H>(v);}static void w(ostream&o,tuple<H,T...>&t,string d){o<<get<0>(t);}};
template<class...T>istream&operator>>(istream&i,tuple<T...>&t){t=TupleReaderWriter<sizeof...(T),T...>::r(i);return i;}
template<class...T>ostream&operator<<(ostream&o,tuple<T...>&t){string delim=" ";TupleReaderWriter<sizeof...(T)-1,T...>::w(o,t,delim);return o;}
template<class T>istream&operator>>(istream&i,vector<T>&v){for(auto&x:v)i>>x;return i;}
template<class T>ostream&operator<<(ostream&o,vector<T>&v){string delim="";for(auto&x:v)o<<delim<<x,delim=" ";return o;}
template<class T>using rev_priority_queue=priority_queue<T,vector<T>,greater<T>>;
template<class T>using vector2d=vector<vector<T>>;
struct fixprec{int x;fixprec(int d):x(d){}};
ostream&operator<<(ostream&o,fixprec f){return o<<fixed<<setprecision(f.x);}
void R_YESNO(bool p) { cout << (p ? "YES" : "NO") << endl; }
void R_YesNo(bool p) { cout << (p ? "Yes" : "No") << endl; }
int main() {
    int X, Y;
    cin >> X >> Y;
    double a[3] = { 3e5, 2e5, 1e5 };
    int ans = 0;
    if(X == 1 && Y == 1) ans = 4e5;
    if(X < 4) ans += a[X - 1];
    if(Y < 4) ans += a[Y - 1];
    cout << ans << endl;
  	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <vector>
#include <stack>
#define LL long long
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define rep(i,n) for(int i=1;i<=n;i++)
#define repp(i,x,y) for(int i=x;i<=y;i++)
#define INF INT_MAX
using namespace std;
int n,ans;
int a[110];
int main(){
	cin>>n;
	for(int i=1;i<=n;i++)cin>>a[i];
	a[0]=INF;
	for(int i=1;i<=n;i++){
		if(a[i-1]==a[i]){
			ans++,a[i]=INF;
		}
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
import bisect,collections,copy,itertools,math,string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
def main():
    s = S()
    k = I()
    same = len(set(list(s)))==1
    ans = None

    if same:
        ans = len(s)*k//2
    else:
        if s[0]!=s[-1]:
            cnt = 0
            change = False
            for i in range(1,len(s)):
                if s[i] == s[i-1] and not change:
                    cnt += 1
                    change = True
                else:
                    change = False
            ans = cnt*k
        else:
            char = s[0]
            start = len(s)
            goal = -1
            cnt = 0
            while s[start-1] == char:
                start -= 1
            while s[goal+1] == char:
                goal += 1
            lenth = len(s)-start + goal+1
            cnt += lenth//2 * (k-1)

            ccnt = 0
            change = False
            for i in range(goal+1+1,start):
                if s[i] == s[i-1] and not change:
                    ccnt += 1
                    change = True
                else:
                    change = False
            cnt += ccnt * (k-2)

            ccnt = 0
            change = False
            for i in range(1,start):
                if s[i] == s[i-1] and not change:
                    ccnt += 1
                    change = True
                else:
                    change = False
            cnt += ccnt

            
            ccnt = 0
            change = False
            for i in range(goal+1+1, len(s)):
                if s[i] == s[i-1] and not change:
                    ccnt += 1
                    change = True
                else:
                    change = False
            cnt += ccnt
            ans = cnt
    print(ans)
                
main()


Measured memory_bytes: 74648
#include<bits/stdc++.h>
#define ll                 long long int
#define mod                1000000007
#define pi                 3.14159265358979323846264338327950288419716939937510
#define setbit(x)          __builtin_popcountll(x)
#define db                 double
#define pp(x)              pair<x,x>
#define ff                 first
#define ss                 second
#define FIO                ios_base::sync_with_stdio(false); cin.tie(NULL);
#define tc                 ll tc; cin>>tc; for(ll number = 1 ; number <= tc ; number ++ )
#define vv(x)              vector<x>
#define pb                 push_back
#define pob                pop_back
#define pf                 push_front
#define pof                pop_front
#define endl               "\n"
#define pq                 priority_queue
#define dbg(x)             { cout<< #x << ": " << (x) << endl; }
#define dbg2(x,y)          { cout<< #x << ": " << (x) << " , " << #y << ": " << (y) << endl; }
#define bp                 ll kkk; cin >>kkk;
#define dbgArr(a,n)        cout<<"Array "<<#a<<endl; for(ll i=0 ; i<n ; i++) cout<<a[i]<<" "; cout<<endl;
#define maxE(a,n)          *max_element(a,a+n);
#define minE(a,n)          *min_element(a,a+n);
#define forn(i,s,n)        for(ll i=s ; i<n ; i++)
#define fornr(i,e,s)       for(ll i=e-1 ; i>=s ; i--)
#define arr(a,n)           for(ll i=0;i<n;i++){ cin>>a[i]; }
#define arr1(a,n)          for(ll i=1;i<=n;i++){ cin>>a[i]; }
#define file freopen("input.txt","r",stdin); freopen("output.txt","w",stdout)
#define print cout<<"Case #"<<number<<": "
#define all(x) x.begin(), x.end()
ll power(ll x, ll b) {ll p = 1;while (b > 0) {if(b&1) {p = p * x; p %= mod;} b >>= 1; x *= x; x %= mod;} return p % mod;}
using namespace std;
# define INF 1e15
struct lex_compare {
    bool operator() (const pair<db,ll>  p1, const pair<db,ll> p2){
        return (p1.first ==  p2.first) ? p1.ss < p2.ss : p1.first > p2.first;
    }
};
#define MAXN 1005

int main(){
    FIO;
    ll n;
    cin >> n;
    ll x = ceil((db)(n)/1000);
    x *= 1000;
    cout << x- n << endl;
    return 0;
}


Measured memory_bytes: 3752
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <iomanip>
#include <string>
#include <cstring>
#include <cctype>
#include <ctime>
#include <climits>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <tuple>
#include <bitset>
#include <cmath>
#include <algorithm>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <complex>
#include <random>
#include <cassert>
#include <chrono>
#include <cstdint>
#include <functional>

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#ifndef M_PI
#define M_PI 3.141592653589793238462643383279
#endif

#define int long long

#define mp make_pair
#define mt make_tuple
#define fr first
#define sc second
#define pb push_back
#define pp pop_back
#define all(x) x.begin(), x.end()
#define get0 get<0>
#define get1 get<1>
#define get2 get<2>
#define get3 get<3>

#define debug(x) cerr << #x << " = " << x << ", line = " << __LINE__ << endl

typedef long long ll;
typedef long double ld;
typedef unsigned int ui;
typedef tuple<long long, long long, long long> tlll;
typedef tuple<int, int, int> tiii;
typedef tuple<int, int, int, int> tiiii;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

const int MOD = 1e9 + 7;

const int SZ = 4000;

int dp[SZ];


int32_t main()
{
#ifdef chikibambony
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#else
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#endif

    int s;
    cin >> s;
    dp[0] = 1;

    for (int i = 3; i <= s; ++i) {
        for (int j = 3; j <= i; ++j) {
            dp[i] = (dp[i] + dp[i - j]) % MOD;
        }
    }

    cout << dp[s];

    return 0;
}

Measured memory_bytes: 3656
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

/*** 0026 */
public class Main {

	/*** 紙 */
	private static int[][] paper;
	/*** インク滴「小」,「中」,「大」 */
	private static final int S = 1, M = 2, L = 3;
	/*** 文字型入力ストリーム（標準入力） */
	private static BufferedReader br;
	/*** 拡大する大きさ */
	private static int plus = 2;
	/*** 通常の紙の大きさ */
	private static int normal = 10;
	/*** 列, 行, インク滴の大きさ, 色のついていない部分, 最も色の濃い部分 */
	private static int x, y, size, blindNum, max;

	/*** 初期化 */
	static {
		int extention = normal + plus * plus; // 縦横ともに紙のサイズを拡大する（計算しやすくするため）
		paper = new int[extention][extention];
		br = new BufferedReader(new InputStreamReader(System.in));
	}

	/**
	 * メインメソッド
	 */
	public static void main(String[] args) throws IOException {

		String line; // 入力行

		while ((line = br.readLine()) != null && !line.isEmpty()) {
			setInput(line);
		}
		calcu();
		System.out.println(blindNum + "\n" + max);
	}

	/**
	 * 入力値の設定
	 */
	private static void setInput(String line) {
		StringTokenizer st = new StringTokenizer(line, ","); // カンマごとに分ける
		x = Integer.parseInt(st.nextToken()) + plus; // 紙を拡大した分マスを大きくする
		y = Integer.parseInt(st.nextToken()) + plus; // 紙を拡大した分マスを大きくする
		size = Integer.parseInt(st.nextToken());
		set(x, y, size); // インク滴を設定
	}

	/**
	 * 色のついていない部分のマス目の個数と１番濃いマス目の濃さを計算する。
	 */
	private static void calcu() {
		for (x = plus; x < normal + plus; x++) {
			for (y = plus; y < normal + plus; y++) {
				if (paper[x][y] == 0) // 色のついていない部分かどうか
					blindNum++;
				if (max < paper[x][y]) // １番濃いマス目かどうか
					max = paper[x][y];
			}
		}
	}

	/**
	 * 入力値に対応する場所にインキ滴を設定する
	 */
	private static void set(int x, int y, int size) {
		paper[x][y]++;
		if (size >= S) {
			paper[x - 1][y]++;
			paper[x + 1][y]++;
			paper[x][y - 1]++;
			paper[x][y + 1]++;
		}
		if (size >= M) {
			paper[x - 1][y - 1]++;
			paper[x - 1][y + 1]++;
			paper[x + 1][y - 1]++;
			paper[x + 1][y + 1]++;
		}
		if (size >= L) {
			paper[x - 2][y]++;
			paper[x + 2][y]++;
			paper[x][y - 2]++;
			paper[x][y + 2]++;
		}
	}
}

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

inline double absolute(double n){
	return (n > 0)?n:-n;
}

int main(){
	/*input*/
	int n;	cin >> n;
	int t, a;	cin >> t >> a;
	int* h = new int[n];
	for(int i = 0; i < n; i++){
		cin >> h[i];
	}
	/*calculation*/
	int ans = 1;
	double min = absolute(a - (t - h[0]*0.006));
	for(int i = 0; i < n; i++){
		if(min > absolute(a - (t - h[i]*0.006))){
			min = absolute(a - (t - h[i]*0.006));
			ans = i + 1;
		}
	}
	/*output*/
	cout << ans << endl;
	delete[] h;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <limits>
#include <math.h>
#include <cmath>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int> ;
using vi = vector<int> ;
using vvi = vector<vector<int>> ;
using vll = vector<long long>;
using vvll = vector<vector<long long >>;
#define PI 3.141592653
#define rep(i, n) for(int i = 0; i < n; i++)

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

  if(2 * n > m){
    ll ans = m/2;
    cout << ans << endl;
  }
  else{
    ll ans = n;
    m -= 2* n;
    ans += m/4;
    cout << ans << endl;
  }
}       

Measured memory_bytes: 256
//#pragma GCC optimize ("O3")
//#pragma GCC target ("sse4")
//#pragma GCC target ("avx,avx2,tune=native")
//#pragma GCC optimization ("unroll-loops")
#include "bits/stdc++.h"

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#include <ext/rope>

using namespace __gnu_pbds; 
using namespace __gnu_cxx;
using namespace std;
using ll = long long;

#define eb emplace_back
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define len(v) ((int)v.size())
#define all(v) v.begin(), v.end()
#define precision(n) fixed<<setprecision(n)

#ifdef LOCAL
    #include "debug.h"
#else
    #define debug(...) 42
#endif

void io(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);    
    #ifdef LOCAL
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
        freopen("output.txt","w",stderr);
    #endif
}
template<typename T> using oset = tree <T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update >;
template<typename T> using MinPriorityQueue = priority_queue <T, vector <T>, greater <T> >;
template<typename T> void done(T ans) {cout << ans << "\n"; exit(0);}

auto seed = chrono::high_resolution_clock::now().time_since_epoch().count();
mt19937_64 mt(seed);

clock_t time_p=clock();
void printTime(){
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
}

template <typename A>
istream& operator>>(istream& input,vector<A>& x) {
  for(auto& i:x)
    input>>i;
  return input;
}
 
template<typename A>
ostream& operator<<(ostream& output,vector<A>& x) {
  for(auto& i:x)
    output<<i<<' ';
  return output;
}


const int N = 2e5 + 5;

int main() {
    io();
    ll n;
    cin >> n;
    ll sum = n * (n  + 1);
    sum = sum / 2;
    int terms3 = n / 3;
    int terms5 = n / 5;
    int terms15 = n / 15;
    ll sum3 =   (6 + (terms3 - 1) * 3);
    sum3 *= terms3;
    sum3 /= 2;
    ll sum5 =   (10 + (terms5 - 1) * 5);
    sum5 *= terms5;
    sum5 /= 2;
    ll sum15 =   (30 + (terms15 - 1) * 15);
    sum15 *= terms15;
    sum15 /= 2;
    
    cout << (sum - sum3 - sum5 + sum15);
}




Measured memory_bytes: 3616
r, c, k = map(int, input().split())

dp = [[[0,0,0,0] for _j in range(c+1)] for _i in range(2)]
bord = [[0]*(c+1) for _i in range(r)]

for _i in range(k):
    _r, _c, _v = map(int, input().split())
    bord[_r-1][_c-1] = _v
            
for i in range(r):
    for j in range(c):
        dp[1][j][0] = max(dp[0][j])
        dp[1][j][1] = max(
            dp[1][j][0] + bord[i][j],
            dp[1][j-1][1],
            dp[1][j-1][0]+bord[i][j]
        )

        dp[1][j][2] = max(
            dp[1][j-1][2],
            dp[1][j-1][1]+bord[i][j],             
        )
        dp[1][j][3] = max(
            dp[1][j-1][3],
            dp[1][j-1][2]+bord[i][j],             
        )

    dp[0] = dp[1][::]

print(max(dp[1][c-1]))

Measured memory_bytes: 151040
//10.0.3.47 perfec
#include<set>
#include<map>
#include<cmath>
#include<stack>
#include<queue>
#include<vector>
#include<cstdio>
#include<cstring>
#include<climits>
#include<cstdlib>
#include<iostream>
#include<algorithm>
#define LL long long
#define ULL unsigned long long
using namespace std;
int read(){
	int f=0,x=0;char c=getchar();
	while(c<'0'||'9'<c){if(c=='-')f=1;c=getchar();}
	while('0'<=c&&c<='9') x=(x<<3)+(x<<1)+(c^48),c=getchar();
	return f?-x:x;
}
#define MAXN 500
#define MAXL 23000
#define INF 0x3f3f3f3f
bool vis[MAXL+5];
int pcnt,prime[MAXL+5];
void Prime(){
	for(int i=2;i<=MAXL;i++){
		if(!vis[i]) prime[++pcnt]=i;
		for(int j=1;j<=pcnt&&i*prime[j]<=MAXL;j++){
			vis[prime[j]*i]=1;
			if(i%prime[j]==0) break;
		}
	}
	return ;
}
bool f[MAXN+5];
int n,k,s,a[MAXN+5],b[MAXN+5];
bool check(int x){
	int cnt=0,L=1,R=n;
	while(L<=R){
		int dir=min(b[L],x-b[R]);
		cnt+=dir;
		b[L]-=dir;
		b[R]+=dir;
		if(b[L]==0) L++;
		if(b[R]==x) R--;
	}
	return cnt<=k;
}
int main(){
	Prime();
	n=read(),k=read();
	for(int i=1;i<=n;i++)
		a[i]=read(),s+=a[i];
	for(int i=1;i*i<=s;i++)
		if(s%i==0){
			int t=s/i;
			for(int j=1;j<=n;j++)
				b[j]=a[j]%t;
			sort(b+1,b+n+1);
			if(check(t)){
				printf("%d\n",t);
				return 0;
			}
		}
	for(int i=int(sqrt(s));i>=1;i--){
		if(s%i==0){
			for(int j=1;j<=n;j++)
				b[j]=a[j]%i;
			sort(b+1,b+n+1);
			if(check(i)){
				printf("%d\n",i);
				return 0;
			}
		}
	}
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <limits.h>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string>
#include <vector>
#include <cstdio>
#include <iomanip>
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#define REP(e,v) for(auto e:v)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pq priority_queue<int>
#define pqg priority_queue<int,vector<int>,greater<int>()>
#define pb push_back
#define vec vector<int>
#define vecvec vector<vector<int>>
#define vecll vector<ll>
#define vecvecll vector<vector<ll>>
#define bs binary_search
#define All(c) (c).begin(),(c).end()
#define mp make_pair
using namespace std;
int in(){int x;scanf("%d",&x);return x;}
string stin(){string s;cin>>s;return s;}
ll lin(){ll x;scanf("%lld",&x);return x;}
 struct UnionFind{
 vec par,size;//par[i]:iの親,size[i]:iの属する木の要素数
    int setNum;//木が何本あるか
    UnionFind(int n):par(n),size(n){
        rep(i,n){
            par[i]=i;
            size[i]=1;
        }
        setNum=n;
    }
    int root(int x){
        if(par[x]==x)return x;
        return root(par[x]);
    }
    void unite(int x, int y){
        int rx=root(x);
        int ry=root(y);
        if(rx==ry)return;
        if(size[rx]<size[ry]){
            par[rx]=ry;
            size[ry]+=size[rx];
            setNum--;
        }else{
            par[ry]=rx;
            size[rx]+=size[ry];
            setNum--;
        }
    }
    bool same(int x, int y){
        return root(x)==root(y);
    }
    int getSize(int x){
        return size[root(x)];
    }
   int getSetNum(){
   		return setNum;
   }
};
int main(){
    int n=in(),m=in();
    UnionFind tree(n);
    rep(i,m){
        int x=in()-1,y=in()-1,z=in();
        tree.unite(x,y);
    }
    cout<<tree.getSetNum()<<endl;
}

Measured memory_bytes: 1024
///
// File:  a.cpp
// Author: ymiyamoto
//
// Created on Tue Oct  3 20:06:36 2017
//

#include <cstdint>
#include <iostream>

using namespace std;

int32_t main()
{
  int64_t N, K, X, Y;
  cin >> N;
  cin >> K;
  cin >> X;
  cin >> Y;

  int64_t money = 0;
  for (int64_t i = 1; i <= N; i++) {
    if (i <= K) {
      money += X;
    } else {
      money += Y;
    }
  }

  cout << money << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int w,h;
char a[21][21];
int dfs(int i,int j){
    if(i==h||j==w||i<0||j<0)return 0;
    if(a[i][j]=='#')return 0;
    int s=1;
    a[i][j]='#';
    s+=dfs(i+1,j);
    s+=dfs(i-1,j);
    s+=dfs(i,j+1);
    s+=dfs(i,j-1);
    return s;
}
int main(){
    int i,j;
    while(cin>>w>>h,w!=0&&h!=0){
    for(i=0;i<h;i++)cin>>a[i];
    for(i=0;i<h;i++)for(j=0;j<w;j++)if(a[i][j]=='@')cout<<dfs(i,j)<<endl;
}}

Measured memory_bytes: 1180
using System;
using System.Diagnostics;
using System.IO;

namespace AtCoder.ABC118 {
    class B {
        static void Main() => CustomMain();

        static void Solve() {
            int n, m;
            ReadMulti(out n, out m);

            var f = new int[m];
            for (int i = 0; i < n; i++) {
                var a = ReadIntArray();

                for (int j = 1; j <= a[0]; j++) {
                    f[a[j] - 1]++;
                }
            }

            var ans = 0;
            foreach (var v in f) {
                if (v == n) ans++;
            }

            WriteAnswer(ans);
        }

        static void CustomMain() {
#if DEBUG
            // ファイルからテストケースを読み込む
            global::Common.ChangeStdIn();
            // 時間計測
            var stopwatch = new Stopwatch();
            stopwatch.Start();
#endif
            // 出力高速化
            var streamWriter = new StreamWriter(Console.OpenStandardOutput()) {AutoFlush = false};
            Console.SetOut(streamWriter);
            // 回答
            Solve();
#if DEBUG
            stopwatch.Stop();
            Console.WriteLine(stopwatch.Elapsed);
#endif
            Console.Out.Flush();
        }

        static string ReadString() => Console.ReadLine().Trim();
        static int ReadInt() => int.Parse(ReadString());
        static long ReadLong() => long.Parse(ReadString());
        static float ReadFloat() => float.Parse(ReadString());
        static double ReadDouble => double.Parse(ReadString());

        static string[] ReadStringArray() => ReadString().Split(' ');
        static int[] ReadIntArray() => Array.ConvertAll(ReadString().Split(' '), int.Parse);
        static long[] ReadLongArray() => Array.ConvertAll(ReadString().Split(' '), long.Parse);
        static float[] ReadFloatArray() => Array.ConvertAll(ReadString().Split(' '), float.Parse);
        static double[] ReadDoubleArray() => Array.ConvertAll(ReadString().Split(' '), double.Parse);

        static T TypeConversion<T>(string s) {
            if (typeof(T) == typeof(int)) {
                return (T) Convert.ChangeType(int.Parse(s), typeof(T));
            } else if (typeof(T) == typeof(long)) {
                return (T) Convert.ChangeType(long.Parse(s), typeof(T));
            } else if (typeof(T) == typeof(double)) {
                return (T) Convert.ChangeType(double.Parse(s), typeof(T));
            } else {
                return (T) Convert.ChangeType(s, typeof(T));
            }
        }

        static void ReadMulti<T, U>(out T a, out U b) {
            var str = ReadStringArray();
            a = TypeConversion<T>(str[0]);
            b = TypeConversion<U>(str[1]);
        }

        static void ReadMulti<T, U, V>(out T a, out U b, out V c) {
            var str = ReadStringArray();
            a = TypeConversion<T>(str[0]);
            b = TypeConversion<U>(str[1]);
            c = TypeConversion<V>(str[2]);
        }

        static void WriteAnswer(object ans) => Console.WriteLine(ans);

        static bool IsOdd(long num) {
            return (num & 1) == 1;
        }

        static bool IsEven(long num) {
            return (num & 1) == 0;
        }
    }
}

Measured memory_bytes: 13140
#include <iostream>
#include <cstring>

using namespace std;
const int N = 1010;


int main(){
    std::ios::sync_with_stdio(false);
    int a, b, c;
    int count = 0;
    cin >> a >> b >> c;


    while(! ((a == b) && (a == c) && (b == c))){
        if(b < a && c < a){
            b++;
            c++;
            count ++;
        }
        else if(a < b && c < b){
            a++;
            c++;
            count ++;
        }
        else if(a < c && b < c){
            a++;
            b++;
            count ++;
        }
        else if (a == b && c < a) {
            c += 2;
            count++;
        }
        else if (a == c && b < a) {
            b += 2;
            count++;
        }
        else if (c == b && a < c) {
            a += 2;
            count++;
        }
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int main(){

  int N,a[100],b=0,mini;
  
  cin >>N;
  
  for( int i=0 ; i < N ; i++ ){
    cin >>a[i];
  }
  
  for( int i=0 ; i < N-1 ; i++ ){
    mini=i;
    for( int j=i ; j < N ; j++ ){
      if( a[j] < a[mini] ){
	mini=j;
      }
    }
    if( i != mini ){
      swap(a[i],a[mini]);
      b++;
    }  
  }
  
  for( int i=0 ; i < N ; i++ ){
    if( i == N-1 ){
      cout <<a[i]<<endl;
    }else{
      cout <<a[i]<<" ";
    }
  }
  
  cout <<b<<endl;
  
  return 0 ;
  
}

Measured memory_bytes: 1164
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }

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

int main() {
	int N;
	cin>>N;
	vector<int> A(N);
	rep(i,N)cin>>A[i];
	vector<int> L(N);
	vector<int> R(N);
	L[0] = A[0];
	R[N-1] = A[N-1];
	rep(i,N-1){
		L[i+1] = gcd(L[i],A[i+1]);
	}
	for (int i = N-1; i > 0; i--){
		R[i-1] = gcd(R[i],A[i-1]);
	}
	int ans = 0;
	rep(i,N){
		if(i == 0){
			ans = max(ans, R[1]);
		}
		else if(i == N-1)ans = max(ans, L[N-2]);
		else{
			ans = max(ans, gcd(L[i-1],R[i+1]));
		}
	}
	print(A);
	print(L);
	print(R);
	cout<<ans<<endl;
}

Measured memory_bytes: 1408
using System;
using System.IO;

class Program
{
    static void Main(string[] args) {
        var scan = new Scanner();
        var writer = new StreamWriter(Console.OpenStandardOutput()) {AutoFlush = false};
        Console.SetOut(writer);
        Console.WriteLine(Solve(scan));
        Console.Out.Flush();
    }
    static object Solve(Scanner scan) {
        var N = Console.ReadLine();
        var K = scan.NextInt();
        var digits = N.Length;
        var dp = new long[digits + 1, 2, K + 1];
        dp[0, 0, 0] = 1;
        for (int d = 0; d < digits; d++) {
            var cur = N[d] - '0';
            for (int s = 0; s <= 1; s++) {
                for (int c = 0; c <= K; c++) {
                    var m = c == K ? 0 : s == 1 ? 9 : cur;
                    for (int n = 0; n <= m; n++) {
                        var isSmall = s == 1 || n < cur ? 1 : 0;
                        var count = c == K ? K : n != 0 ? c + 1 : c;
                        dp[d + 1, isSmall, count] += dp[d, s, c];
                    }
                }
            }
        }
        return dp[digits, 0, K] + dp[digits, 1, K];
    }
}

class Scanner
{
    string[] s;
    int i;
    public Scanner() {
        s = new string[0];
        i = 0;
    }
    public string Next() {
        if (i < s.Length) return s[i++];
        string str = Console.ReadLine();
        while (str == "") str = Console.ReadLine();
        s = str.Split(' ', StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return Next();
        i = 0;
        return s[i++];
    }
    public int NextInt() => int.Parse(Next());
}


Measured memory_bytes: 27540
#include <iostream>
#include <sstream>

using namespace std;


int main() {
    int w, h;

    while (1) {
        cin >> h >> w;
        if (!w && !h) {
            break;
        }
        stringstream ss;
        while (w) {
            ss << '#';
            --w;
        }
        string str = ss.str();
        while (h) {
            cout << str << endl;
            --h;
        }
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 1216
def main():
    s = input()


    if s[0] != "A":
        print("WA")
        exit()

    if s[2:-1].count("C") != 1:
        print("WA")
        exit()

    s=s.replace("A","")
    s=s.replace("C","")

    if s.islower() == False:
        print("WA")
        exit()

    print("AC")



if __name__ == "__main__":
        main()


Measured memory_bytes: 3060
package main

import (
  "fmt"
  "strconv"
)

func main() {
  var a, b int 
  fmt.Scan(&a, &b)
  cnt := 0
  for i := a; i <= b; i++ {
    j := strconv.Itoa(i)
    flag := true
    for k := 0; k < 2; k++ {
      if j[k] == j[4-k] {continue}
      flag = false; break
    }
    if flag {
      cnt++
    }
  }
  fmt.Println(cnt)
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <math.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rrep(i, n) for(int i = 0; i <= (n); i++)
using namespace std;
typedef long long ll;
 
const ll INF = 1LL<<60;
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; }
using Graph = vector<vector<int>>;

typedef pair<int, int> P;
typedef priority_queue<int, vector<int>, greater<int>> PQ;
const int MOD = 1000000007;

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

    rep(i,s.size()){
        if (i+1 < s.size() && s[i] == s[i+1]){
            cout << i+1 << " " << i+2 << endl;
            return 0;
        }
        if (i+2 < s.size() && s[i] == s[i+2]){
            cout << i+1 << " " << i+3 << endl;
            return 0;
        }
    }

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

}

Measured memory_bytes: 3708
import java.util.Scanner;

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

        sc.close();

        int ans = 0;

        for (int i = a; i <= b; i++) {
            StringBuilder work = new StringBuilder(String.valueOf(i));
            if (work.reverse().toString().equals(String.valueOf(i))) {
                ans++;
            }
        }

        System.out.println(ans);
    }
}

Measured memory_bytes: 38740
#include<bits/stdc++.h>
using namespace std;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); 
    int n,t=0,r;
    cin>>n;
    while(n){
        r=n%10;
        if(r==9)
         {cout<<"Yes";t++;break;}
        n=n/10;
    }
    if(t==0)
     cout<<"No";
    return 0;
}

Measured memory_bytes: 3588
def main():
    n = int(input())
    values = list(map(int,input().split()))

    sorted_values = sorted(values)
    ans = sorted_values[0]
    for i in range(1,n):
        ans = (ans + sorted_values[i]) / 2
    print(ans)



if __name__ == "__main__":
    main()


Measured memory_bytes: 3060
//#include <bits/stdc++.h>
#include<iostream>
#include<numeric>
#include<cstdio>
#include<string>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<ctype.h>
#include <fstream>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
using namespace std;
typedef long long ll;//int64
typedef unsigned long long ull;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
//----------program from here----------

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

int main(){
  int a=0,b=0;
  cin >> a >> b;
  cout << --a*--b << endl;
}

Measured memory_bytes: 256
import java.util.*;
public class Main{
    public static void main(String[] args){
	new Main().run();
    }
    Scanner sc = new Scanner(System.in);

    int[] parts;
    int[][] test;
    int n;

    void run(){
	while(sc.hasNext()){
	    int a = sc.nextInt() + sc.nextInt() + sc.nextInt();
	    if(a!=0){
		parts = new int[a+1];
		Arrays.fill(parts, 2);
		n = sc.nextInt();
		test = new int[4][n];
		solve();
	    }
	}
    }

    void solve(){
	for(int i=0; i<n; i++){
	    test[1][i] = sc.nextInt();
	    test[2][i] = sc.nextInt();
	    test[3][i] = sc.nextInt();
	    test[0][i] = sc.nextInt();
	    if(test[0][i]==1){
		for(int k=1; k<=3; k++)
		    parts[test[k][i]] = 1;
	    }
	}

	for(int i=0; i<n; i++){
	    if(test[0][i]==0){
		int tCount = 0;
		int fal = -1;
		for(int k=1; k<=3; k++)
		    if(parts[test[k][i]]==1)
			tCount++;
		    else fal = test[k][i];
		if(tCount==2 && fal!=-1)
		    parts[fal] = 0;
	    }
	}

	for(int i=1; i<parts.length; i++)
	    System.out.println(parts[i]);
    }
}

Measured memory_bytes: 28296
'use strict'
function main(input) {
  input = Number(input.trim())
  const check = n => {
    n = String(n)
    return ~n.indexOf('7') && ~n.indexOf('5') && ~n.indexOf('3')
  }
  const dfs = n => {
    if (n === '' || Number(n) <= input) {
      let r = check(n) ? 1 : 0
      r += dfs(Number(n + '7'))
      r += dfs(Number(n + '5'))
      r += dfs(Number(n + '3'))
      return r
    } else {
      return 0
    }
  }
  console.log(dfs(''))
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));


Measured memory_bytes: 23348
#include "bits/stdc++.h"

using namespace std;
using std::vector;

#define ll long long
#define vi vector<int>
#define vl vector<long long>
#define vvi vector<vi>
#define pi  pair<int,int>
#define mp  make_pair
#define pb  push_back
#define MOD int(1e9) + 7
#define PAI  3.1415926535
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define chmax(x, y) x = max(x,y)
#define chmin(x, y) x = min(x,y)
#define pr(x) cout << x << endl
#define Endl endl
#define rep(i, n) for(int i = 0 ; i < n; i++)

const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
const int ddx[8] = {-1,0,1,-1,1,-1,0,1};
const int ddy[8] = {-1,-1,-1,0,0,1,1,1};
const int inf = 99999999;
const ll linf = 1LL << 62;

ll gcd(ll a,ll b){
  if(a < b)swap(a , b);
  if(a % b != 0) gcd(b, a%b);
  return b;
}

ll lcm(ll a,ll b){
  if(a < b)swap(a , b);
  return (a / gcd(a , b)) * b;
}

int main(){
 
  int a, b; cin >> a >> b;
  pr(max(a + b, max(a- b, a*b)));

  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <vector>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define Sort(Array) sort(Array.begin(), Array.end())
#define Reverse(a) reverse(a.begin(), a.end())
#define out(ans) cout << ans << endl;
const int MOD = 1000000007;
const int INF = 2147483647;
const ld PI = 3.14159265358979323846;

//------------↓------------- M -------------- E ---------------- M --------------- O ---------------↓--------------//
// コンパイル 
// g++ -std=c++1z
//
// -------型変換--------
// int を string に変換
// string s = to_string(n);
// string を int に変換
// int n = stoi(s);
//
// -------二分探索---------
// k以上の値が最初に現れる時のイテレータ
// lower_bound(data.begin(), data.end(), k)
// kより大きい値が最初の現れる時のイテレータ O(logN)
// upper_bound(data.begin(), data.end(), k)
// kがdataに存在するかをtrue or falseで返す O(logN)
// binary_search(data.begin(), data.end(), k)
// 
//
//
//
//
//
// 
//------------↑------------- M -------------- E ---------------- M --------------- O ---------------↑--------------//







int main(void) {

    int s_x, s_y, t_x, t_y;
    cin >> s_x >> s_y >> t_x >> t_y;
    int dx = t_x - s_x;
    int dy = t_y - s_y;

    rep(i,dy) cout << 'U';
    rep(i,dx) cout << 'R';
    rep(i,dy) cout << 'D';
    rep(i,dx) cout << 'L';

    cout << 'L';
    rep(i,dy+1) cout << 'U';
    rep(i,dx+1) cout << 'R';
    cout << 'D';
    cout << 'R';
    rep(i,dy+1) cout << 'D';
    rep(i,dx+1) cout << 'L';
    cout << 'U';

    
    return 0;
}











Measured memory_bytes: 256