akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <list>
#include <utility>
#include <tuple>
#include <cstdio>
#include <set>
#include <queue>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#include <cmath>
#include <limits>
#include <iomanip>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<(n);++i)
using namespace std;
const long long INF = 1LL << 60;
typedef long long ll;
int main() {
    int h;
	cin >> h;
	int w;
	cin >> w;
	vector<string> a(h);  // ここで二次元リスト構造にせず一次元配列でstringを用いるのも一つの技
	for (int i = 0; i < h; i++) {
		cin >> a[i];
	}

	vector<bool> row(h, false);
	vector<bool> col(w, false);  // true false の配列を作ることも一つのテクニックとしてしっかりと習得すること
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			if (a[i][j] == '#') {
				row[i] = true;
				col[j] = true;
			}
		}
	}

	for (int i = 0; i < h; i++) {
		if (row[i]) {
			for (int j = 0; j < w; j++) {
				if (col[j]) {
					cout << a[i][j];
				}
			}
			cout << endl;
		}
	}
}

Measured memory_bytes: 3644
#include<stdio.h>
#include<iostream>
#include<vector>
#include<math.h>
#include<queue>
#include<map>
#include<algorithm>
#include<string.h>
#include<functional>
#include<limits.h>
#include<stdlib.h>
#include<string>
#include<unordered_map>
#include <iomanip>
using namespace std;
 
#define intmax INT_MAX
#define lmax LONG_MAX
#define uintmax UINT_MAX
#define ulmax ULONG_MAX
#define llmax LLONG_MAX
#define ll long long
#define rep(i,a,N) for((i)=(a);(i)<(N);(i)++)
#define rrp(i,N,a) for((i)=(N)-1;(i)>=(a);(i)--)
#define llfor ll i,j,k
#define sc(a) cin>>a
#define pr(a) cout<<a<<endl
#define pY puts("YES")
#define pN puts("NO")
#define py puts("Yes")
#define pn puts("No")
#define pnn printf("\n")
#define sort(a) sort(a.begin(),a.end())
#define push(a,b) (a).push_back(b)
#define llvec vector<vector<ll>>
#define charvec vector<vector<char>>
#define sizeoof(a,b) (a,vector<ll>(b))
#define llpvec vector<pair<ll,ll>>
/*繰り上げ除算*/ll cei(ll x,ll y){ll ans=x/y;if(x%y!=0)ans++;return ans;}
/*最大公約数*/ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}
/*最小公倍数*/ll lcm(ll x,ll y){return x/gcd(x,y)*y;}
/*n乗*/ll llpow(ll x,ll n){ll i,ans=1;rep(i,0,n)ans*=x;return ans;}
/*階乗*/ll fact(ll x){ll i,ans=1;rep(i,0,x)ans*=(x-i);return ans;}
/*nCr*/ll ncr(ll n,ll r){return fact(n)/fact(r)/fact(n-r);}
/*nPr*/ll npr(ll n,ll r){return fact(n)/fact(n-r);}
/*primejudge*/bool prime(ll a){if(a<=1)return false;ll i;for(i=2;i*i<=a;i++){if(a%i==0)return false;}return true;}
ll ans=0;llfor;///////////////////////////////////////////////////////////
int main(){
  string S,X="consonant";
  cin>>S;
  if(S=="a"||S=="i"||S=="u"||S=="e"||S=="o") X="vowel";
    cout<<X;
return 0;}


Measured memory_bytes: 3600
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define int long long
using namespace std;
typedef vector<int>   vint;
typedef pair<int,int> pint;

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define ll long long
using ull = unsigned long long;
using namespace std;
const int INF = 1e10;
const int MOD = 1e9 + 7;
#define dump(x)                             \
    if (dbg) {                              \
        cout << #x << " = " << (x) << endl; \
    }
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define FORR(i, a, b) for (int i = (a); i <= (b); ++i)
#define pb push_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(), (v).end()
#define SZ(x) ((int)(x).size())
#define P pair<int, int>
#define V vector<int>
#define S set<int>
#define itn int
bool dbg = false;
int N;
void solve() {
    int ans = -1;
    FOR(i, 0, 50000) {
        int t, t2;
        t = 108 * i;
        t /= 100;
        if (t == N) {
            ans = i;
            break;
        }
    }
    if (ans == -1) {
        cout << ":(" << endl;
    } else {
        cout << ans << endl;
    }
}

signed main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cin >> N;
    solve();
    return 0;
}


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

int main(){
  int N;
  string S;
  cin>>N>>S;
  if(N%2!=0) cout<<"No"<<endl;
  else{
    if(S.substr(N/2,N)==S.substr(0,N/2)) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
  }
return 0;
}


Measured memory_bytes: 256
S=str(input())
S1=int(S[0]+S[1])
S2=int(S[2]+S[3])

if S1>0 and S1<13:
  if S2>0 and S2<13:
    print("AMBIGUOUS")
  else:
    print("MMYY")
else:
  if S2>0 and S2<13:
    print("YYMM")
  else:
    print("NA")

Measured memory_bytes: 3060
# -*- coding: utf-8 -*-
# get a integer
a = raw_input()

list = a.split()

left = int(list[0])+int(list[1])
right = int(list[2])+int(list[3])

if left < right:
  print("Right")
elif left > right:
  print("Left")
else:
  print("Balanced")

Measured memory_bytes: 2568
#pragma region template
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const long long MOD = 1e9 + 7, MAX = 1e18, larg = 1e5, INF = -1e9;
long long A, B, C, D, E, F, G, H, I, J, K, L, N, M, O, P, Q, R, S, T, U, V, W;
typedef long long ll;
typedef pair<ll, ll> Pa;

bool IsExist[100000];
int main() {
	cin >> N;
	rep(i, 100000) {
		IsExist[i] = false;
	}
	int cnt = 0;
	rep(i, N) {
		cin >> A; A--;
		if (!IsExist[A]) IsExist[A] = true;
		else cnt++;
	}
	cout << N - (cnt + 1) / 2 * 2;
}


Measured memory_bytes: 384
#include<stdio.h>
int t(int);
int dp[100001],h[100001];
int main()
{
	int n,k,i,j;
	scanf("%d %d",&n,&k);
	for(i=0;i<n;i++) scanf("%d",&h[i]);
	for(i=0;i<=n;i++) dp[i]=1000000000;
	dp[0]=0;
	for(i=0;i<n-1;i++){
		for(j=i+1;j<i+k+1;j++){
			if(j<n&&t(h[i]-h[j])+dp[i]<dp[j]){
				dp[j]=t(h[i]-h[j])+dp[i];
			}
		}
	}
	printf("%d\n",dp[n-1]);
	return 0;
}
int t(int x){
	if(x<0) x=-x;
	return x;
}

Measured memory_bytes: 2508
#pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
using namespace std;
void *wmem;
template<class S, class T> inline S min_L(S a,T b){
  return a<=b?a:b;
}
template<class T> inline void walloc1d(T **arr, int x, void **mem = &wmem){
  static int skip[16]={0, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1};
  (*mem) = (void*)( ((char*)(*mem)) + skip[((unsigned long long)(*mem)) & 15] );
  (*arr)=(T*)(*mem);
  (*mem)=((*arr)+x);
}
inline void rd(int &x){
  int k, m=0;
  x=0;
  for(;;){
    k = getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
inline void wt_L(char a){
  putchar_unlocked(a);
}
inline void wt_L(int x){
  char f[10];
  int m=0, s=0;
  if(x<0){
    m=1;
    x=-x;
  }
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  if(m){
    putchar_unlocked('-');
  }
  while(s--){
    putchar_unlocked(f[s]+'0');
  }
}
int Prime_L(int N, int res[], void *mem=wmem){
  bool *isprime;
  const int r=23000;
  int a, b, i, *sf, ss=1, sz=1;
  walloc1d(&isprime, r, &mem);
  walloc1d(&sf, r, &mem);
  isprime = (bool*)mem;
  sf = (int*)(isprime + r);
  N /= 2;
  res[0] = 2;
  b =min_L(r, N);
  for(i=(1);i<(b);i++){
    isprime[i] = 1;
  }
  for(i=(1);i<(b);i++){
    if(isprime[i]){
      res[sz++] = 2*i+1;
      sf[ss] = 2*i*(i+1);
      if(sf[ss] < N){
        while(sf[ss] < r){
          isprime[sf[ss]] = 0;
          sf[ss] += res[ss];
        }
        ss++;
      }
    }
  }
  for(a=r; a<N; a+=r){
    b =min_L(a + r, N);
    isprime -= r;
    for(i=(a);i<(b);i++){
      isprime[i] = 1;
    }
    for(i=(1);i<(ss);i++){
      while(sf[i] < b){
        isprime[sf[i]] = 0;
        sf[i] += res[i];
      }
    }
    for(i=(a);i<(b);i++){
      if(isprime[i]){
        res[sz++] = 2*i+1;
      }
    }
  }
  return sz;
}
char memarr[96000000];
int N;
int ps;
int p[5637];
int main(){
  int i, s=0;
  wmem = memarr;
  ps =Prime_L(55556, p);
  for(i=0;i<(ps);i++){
    if(p[i]%5==1){
      p[s++] = p[i];
    }
  }
  rd(N);
  {
    int Lj4PdHRW;
    if(N==0){
      putchar_unlocked('\n');
    }
    else{
      for(Lj4PdHRW=0;Lj4PdHRW<(N-1);Lj4PdHRW++){
        wt_L(p[Lj4PdHRW]);
        wt_L(' ');
      }
      wt_L(p[Lj4PdHRW]);
      wt_L('\n');
    }
  }
  return 0;
}
// cLay varsion 20190827-1

// --- original code ---
// int N;
// int ps, p[5637];
// {
//   int i, s = 0;
//   ps = Prime(55556, p);
//   rep(i,ps) if(p[i]%5==1) p[s++] = p[i];
// 
//   rd(N);
//   wt(p(N));
// }


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ROOP(i, N) for(int i=0; i++; i<N)
#define RVROOP(i, N) for(int i=N; i--; i>=0)
#define ALL(v) v.begin(), v.end()
const int INF = 1e9;
const int MAX = 510000;
const int MOD = 1000000007;
using namespace std;
typedef long long ll;

/*DP使ったほうがよくない？？WOWWOW*/
int main(){
  int N; cin>>N;
  int A[N];
  bool ans=true;
  for(int i=0; i<N; i++){
    int a; cin>>a;
    if(a%2==0 && a%3!=0){
      if(a%5!=0){
        ans=false;
        break;
      }
    }
  }
  if(ans){
    cout<<"APPROVED"<<endl;
  }
  else{
    cout<<"DENIED"<<endl;
  }
}


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

int main() {
	string s, t;
	cin >> s >> t;
	set<int> st[26];
	for (int i = 0; i < s.size(); i++) {
		st[s[i]-'a'].insert(i);
	}
	long long ans = 0, p = 0;
	for (int i = 0; i < t.size(); i++) {
		int x = t[i] - 'a';
		if (st[x].empty()) {
			cout << -1 << endl;
			return 0;
		}
		auto itr = st[x].lower_bound(p);
		if (itr == st[x].end()) {
			ans += s.size() - p;
			p = 0;
			p += *st[x].begin() + 1;
			ans += p;
		} else {
			ans += *itr - p + 1;
			p = *itr + 1;
		}

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

Measured memory_bytes: 8488
#include <stdio.h>

int main(int argc, char *argv[])
{
  int n, x;
  int i, j, k;
  int ct;

  while (1) {
    scanf("%d %d", &n, &x);
    if (n == 0 && x == 0) break;

    ct = 0;

    for (i = 1; i <= n - 2; i++) {
      for (j = i + 1; j <= n - 1; j++) {
        for (k = j + 1; k <= n; k++) {
          if (i + j + k == x) ct++;
        }
      }
    }

    printf("%d\n", ct);
  }

  return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
using namespace std;
typedef int int__;
#define int long long
#define pb push_back
#define pi pair<int,int>
#define vpi vector<pi>
#define vi vector<int>
#define vvi vector<vi>
#define fi first
#define se second
#define forn(i, n)for(int i=0;i<int__(n);i++) 
#define sz(a)int__(a.size())
template <class A, class B> ostream& operator << (ostream& out, const pair<A, B> &a){return out << "(" << a.first << ", " << a.second << ")";}
template<class A>ostream& operator<<(ostream& out,const vector<A>&v){out<<"[";forn(i,sz(v)){if(i)out<<", ";out<<v[i];}return out<<"]";}
const int MAX = 1e5 + 100;
#define fast ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
int Mod(int x){const int mm=998244353;x%=mm;if(x<0)x+=mm;return x;}
int Pow(int x,int n){if(n==0)return 1;int t=Pow(x,n/2);t=Mod(t*t);if(n&1)t=Mod(t*x);return t;}
#define watch(x) cout << #x << " : " << x << endl;
int gcd(int a,int b){if(b==0)return a;return gcd(b,a%b);}

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

	if(n%2){
		cout << 0; return 0;
	}
	int ans=0;
	n /= 2;

	while(n>0){
		ans += n/5;
		n /= 5;
	}

	cout << ans;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mem(i,j) memset(i,j,sizeof(i))
#define pl (p<<1)
#define pr (p<<1)|1
#define int long long
using namespace std;
inline int read(){
	char ch=' ';int res=0,f=1;
	while(!isdigit(ch)){ch=getchar();if(ch=='-')f=-1;}
	while(isdigit(ch)){res=res*10+ch-'0';ch=getchar();}
	return res*f;
}
int _min(int x,int y){return x<y?x:y;}
int _max(int x,int y){return x>y?x:y;}
const int N=1e6+5;
int k,vis[N];
struct node{
	int x,ans;
};
#undef int
int main() {
	/*freopen("magic.in","r",stdin);
	freopen("magic.out","w",stdout);*/
	k=read();
	deque<node>q;
	q.push_front({1,1});
	while(!q.empty()){
		node kk=q.front();
		q.pop_front();
		if(vis[kk.x])continue;
		vis[kk.x]=1;
		if(!kk.x){
			printf("%lld\n",kk.ans);
			return 0;
		}
		q.push_front({(kk.x*10)%k,kk.ans});
		q.push_back({(kk.x+1)%k,kk.ans+1});
	}
	return 0;
}

Measured memory_bytes: 2688
# 解説放送
def dfs(x):
    if x > N: return 0
    res = 1 if all(c in str(x) for c in '753') else 0
    for v in 3, 5, 7:
        res += dfs(10 * x + v)
    return res


N = int(input())
print(dfs(0))


Measured memory_bytes: 2940
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <cmath>
#include <climits>
#include <iomanip>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
// 返り値: a と b の最大公約数
// ax + by = gcd(a, b) を満たす (x, y) が格納される
long long extGCD(long long a, long long b, long long &x, long long &y) {
    if (b == 0) {
        x = 1;
        y = 0;
        return a;
    }
    long long d = extGCD(b, a%b, y, x);
    y -= a/b * x;
    return d;
}
int main(){
    ll m;
    cin >> m;
  m *= 2;
    ll copy = m;
    map<ll,ll> odd;
    ll even = 1;
    for(int i = 2;i <= sqrt(copy);i++){
        while(m % i == 0){
            if(i == 2)even *= 2;
            else odd[i]++;
            m /= i;
        }
    }
    if(m > 1)odd[m]++;
    ll k = odd.size();
    ll res = pow(10,18);
    for(int i = 0; i < (1<<k); i++){
      ll a = even;
      ll b = 1;
      ll it = 0;
      for(auto item:odd){
          if(i & (1<<it))a *= pow(item.first,item.second);
          else b *= pow(item.first,item.second);
          it++;
      }
      ll x,y;
      extGCD(a,-1*b,x,y);
      if(a * x > 1)res = min(res,a * x);
      extGCD(b,-1*a,x,y);
      if(b * x > 1)res = min(res,b * x);
    }
    if(res == pow(10,18))res = copy;
    else res++;
    cout << res - 1 << endl;
}


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

#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

using namespace std;

typedef long long ll;
typedef vector<ll> vll;
typedef pair<ll, ll> pll;
typedef long double ld;

const ll mod = (ll)1e9 + 7;
const ll mxN = 200200;

void solve() {
	ll a,b;
	cin>>a>>b;
	if(a*b<=0) cout<<"Zero\n";
	else if(a>0) cout<<"Positive\n";
	else puts((min(b,-1LL)-a+1)%2==0?"Positive":"Negative");

}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.precision(20);
	cout << fixed;

	//ll t;cin>>t;while(t--)
	solve();

}


Measured memory_bytes: 256
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

n=int(input())
a=factorization(n)
b=[ele[1] for ele in a]

ans=0

for num in b:
    now=num
    for cnt in range(1,101):
        if cnt<=now:
            now-=cnt
            ans+=1
        else:
            break

if n==1:
    print(0)
else:
    print(ans)

Measured memory_bytes: 9500
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace _0080
{
    public class Program

    {
        public static void Main(string[] args)
        {
            while (true)
            {
                double q = RInt();
                if (q == -1) break;

                double x = q / 2;
                while (Math.Abs(Math.Pow(x, 3) - q) >= 0.00001*q)
                {
                    x = x - (Math.Pow(x, 3) - q) / (3 * Math.Pow(x, 2));
                }
                Console.WriteLine(x);
            }
        }

        static string RSt() { return Console.ReadLine(); }
        static int RInt() { return int.Parse(Console.ReadLine().Trim()); }
        static long RLong() { return long.Parse(Console.ReadLine().Trim()); }
        static double RDouble() { return double.Parse(Console.ReadLine()); }
        static string[] RStAr(char sep = ' ') { return Console.ReadLine().Trim().Split(sep); }
        static int[] RIntAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => int.Parse(e)); }
        static long[] RLongAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => long.Parse(e)); }
        static double[] RDoubleAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => double.Parse(e)); }
        static string WAr<T>(IEnumerable<T> array, string sep = " ") { return string.Join(sep, array.Select(x => x.ToString()).ToArray()); }
    }

}



Measured memory_bytes: 17996
using System;
using System.Windows;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;

class Program
{
    static void Main(string[] args)
    {
      //入力を受け取る
      var NX = Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray();
      var N = NX[0];
      var X = NX[1];
      var y = Console.ReadLine().Split(' ').Select(x => Math.Abs(long.Parse(x)-X)).ToArray();
      long res = y[0];
      
      for(long i = 1 ; i < N ; i++){
        res = gcd(res,y[i]);
      }
      
      Console.WriteLine(res);
    }
  
  static long gcd(long a,long b){
    long res =1;
    if(a<b){
      return gcd(b,a);
    }
    while(b != 0){
      res = b;
      b = a%b;
      a= res;
    }
    return res;
  }
  
}




Measured memory_bytes: 20832
#include <iostream>
#include <algorithm>
#include <cstring>
#include <queue>
#include <cstdio>
#include <stack>
#include <cmath>

using namespace std;

#define ll long long
const int maxn = 400;
const int mod = 998244353;

ll Map[maxn][maxn];
int n;

int main() {
    //freopen("input.txt", "r", stdin);
    ll ans = 0;
    cin >> n;
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= n; j++) {
            cin >> Map[i][j];
            ans += Map[i][j];
        }
    }
    int flag = 0;
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= n; j++) {
            for (int k = 1; k <= n; k++) {
                if (i != j && j != k && i != k) {
                    if (Map[i][j] == Map[i][k] + Map[k][j]) {
                        ans -= Map[i][j];
                        break;
                    }
                    if (Map[i][j] > Map[i][k] + Map[k][j]) flag = 1;
                }
            }
        }
    }
    if (flag) cout << -1 << endl;
    else cout << ans / 2 << endl;
    return 0;
}

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

int main() {
  int N;
  cin >> N;
  vector<int> botan(N);
  rep(i, N) {
    cin >> botan.at(i);
  }
  
  int j = 0;
  int count = 1;
  
  for (int i = 0; i < N; i++) {
    
    if (botan.at(j) == 2) {
      cout << count << endl;
      break;
    }
    else if (count == N) {
      cout << "-1" << endl;
      break;
    }
    else {
      j = botan.at(j) - 1;
    }
    count++;
  }
}


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

using namespace std;

template <typename A, typename B>string to_string(pair<A, B> p);

template <typename A, typename B, typename C> string to_string(tuple<A, B, C> p);

template <typename A, typename B, typename C, typename D> string to_string(tuple<A, B, C, D> p);

string to_string(const string& s) {return '"' + s + '"';}

string to_string(const char* s) {return to_string((string) s);}

string to_string(bool b) {return (b ? "true" : "false");}

string to_string(vector<bool> v) {
  bool first = true;
  string res = "{";
  for (int i = 0; i < static_cast<int>(v.size()); i++) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(v[i]);
  }
  res += "}";
  return res;
}

template <size_t N>
string to_string(bitset<N> v) {
  string res = "";
  for (size_t i = 0; i < N; i++) {
    res += static_cast<char>('0' + v[i]);
  }
  return res;
}

template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}

template <typename A, typename B>string to_string(pair<A, B> p) {return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";}

template <typename A, typename B, typename C>string to_string(tuple<A, B, C> p) {return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";}

template <typename A, typename B, typename C, typename D>string to_string(tuple<A, B, C, D> p) {return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";}

void debug_out() { cerr << endl; }

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}

#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

void test_case(){
}

int main(){	
	ios::sync_with_stdio(false);
	cin.tie(0);
	double d,t,s;
	cin >> d >> t >> s;
	double T = d/s;
	cout << (T > t ? "No":"Yes");
    return 0;
}












Measured memory_bytes: 3712
#include <map>
#include <queue>
#include <cmath>
#include <ctime>
#include <vector>
#include <cstdio>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <tr1/unordered_map>
#define mo 1000000007
#define num(x) (x>='0' && x<='9')
typedef unsigned long long ull;
typedef long long ll;
using namespace std::tr1;
using namespace std;
int read(){
    int p=0, q=1;
    char ch=getchar();
    while (!num(ch))
        (ch=='-'?q=-1:0),
        ch=getchar();
    while (num(ch)) p=p*10+ch-'0', ch=getchar();
    return p*q;
}
int power(ll a, int b){
	ll c=1;
	while (b){
		if (b&1) c=c*a%mo;
		a=a*a%mo;
		b>>=1;
	}
	return c;
}
char s[200005];
int main(){
	scanf("%s", s);
	int sum=0;
	for (int i=0;s[i];i++){
		sum+=s[i]-'0';
	}
	puts(sum%9==0?"Yes":"No");
    return 0;
}

Measured memory_bytes: 3948
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <utility>
#include <numeric>

using namespace std;

using ll = long long;
using ull = unsigned long long;

const ll inf = (ll)1e9;
const ll mod = (ll)1e9 + 7;

#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

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

	int res = 0;
	for (; s > 0; s /= 10)
	{
		if (s % 2 == 1)
		{
			res++;
		}
	}
	cout << res << endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main{

    Scanner sc = new Scanner(System.in);

    int h = sc.nextInt();
    int w = sc.nextInt();
    char[][] arr = new char[h][w];
    int max = 0;
    int[][] d = new int[h][w];
    int[] dx = {1, 0, -1, 0};
    int[] dy = {0, 1, 0, -1};

    public static void main(String[] args){
        new Main().run();
    }

    void run() {

        for (int i=0; i<h; i++) arr[i] = sc.next().toCharArray();

        for (int i=0; i<h; i++) {
            for (int j=0; j<w; j++) {
                if (arr[i][j] == '.') {
                    for (int a=0; a<h; a++) {
                        Arrays.fill(d[a], Integer.MAX_VALUE);
                    }
                    d[i][j] = 0;
                    bfs(new Pair(i, j));
                    int tMax = 0;
                    for (int a=0; a<h; a++) {
                        for (int b=0; b<w; b++) {
                            if (d[a][b] != Integer.MAX_VALUE) tMax = Math.max(tMax, d[a][b]);
                        }
                    }
                    max = Math.max(max, tMax);
                }
            }
        }

        System.out.println(max);

    }

    void bfs(Pair pair) {
        Queue<Pair> queue = new ArrayDeque<>();
        queue.add(pair);
        while (!queue.isEmpty()) {
            Pair p = queue.peek();
            int x = p.x;
            int y = p.y;
            for (int i=0; i<4; i++) {
                int nx = x + dx[i];
                int ny = y + dy[i];
                if (nx < 0 || h <= nx || ny < 0 || w <= ny) continue;
                if (arr[nx][ny] == '#') continue;
                if (d[nx][ny] > d[x][y] + 1) {
                    d[nx][ny] = d[x][y] + 1;
                    queue.add(new Pair(nx, ny));
                }
            }
            queue.poll();
        }
    }

    class Pair {
        int x;
        int y;
        public Pair(int x , int y) {
            this.x = x;
            this.y = y;
        }
    }

}


Measured memory_bytes: 24916
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<long long> vll;
typedef vector<pair<int,int>> vp;
typedef pair<int,int> pii;
#define INF (int)(1e9)
#define MAXX 1.1529215e+18
#define inf 999999
#define EPS (1e-7)
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define REP(i,n) for(int i=1;i<=(int)(n);i++)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define ALL(a)  a.begin(),a.end()
#define RALL(a) a.begin(),a.end(),greater<int>()
#define ROT(a) a.begin(),a.begin()+1,a.end()
#define RROT(a) a.begin(),a.end()-1,a.end()
#define PB push_back
#define MP make_pair
#define PI acos(-1.0)
#define sz(a) a.size()
const ll MOD = 1e9+7;
const int MAX = 10000000;
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }
//cout << 'H' << endl;
/*--------------------------------------------*/
vector< bool > prime_table(int n) {
  vector< bool > prime(n + 1, true);
  if(n >= 0) prime[0] = false;
  if(n >= 1) prime[1] = false;
  for(int i = 2; i * i <= n; i++) {
    if(!prime[i]) continue;
    for(int j = i + i; j <= n; j += i) {
      prime[j] = false;
    }
  }
  return prime;
}

int main(){
    //cout << fixed << setprecision(10)
    cin.tie(0);
    ios::sync_with_stdio(false);

    ll X;
    cin >> X;

    auto table = prime_table(ll(1e6));

    for(ll i = X;i < ll(1e6);i++){
        if(table[i]){
            cout << i << endl;
            return 0;
        }
    }


}


Measured memory_bytes: 384
#include<stdio.h>
#include<stdlib.h>

int main()
{
  int x,a,b;
  
  scanf("%d%d%d",&x,&a,&b);
  
  if(abs(x-a)<abs(x-b))
  {
    printf("A\n");
  }
  else
  {
    printf("B\n");
  }
  
  return 0;
}

Measured memory_bytes: 128
// 標準入力
var fs = require('fs'),
length = fs.fstatSync(process.stdin.fd).size,
buffer = new Buffer(length),
bytesRead = fs.readSync(process.stdin.fd, buffer, 0, length, 0),
input = buffer.toString('utf8', 0, bytesRead).split('\n');
main();
 
function main(){
  var read = 0;
  var resultCase = 1;
  while(true){
    var maxWeight = +input[read++];
    if(!maxWeight){
      break;
    }
     
    var treasures = +input[read++];
    var pdp = new Int16Array(maxWeight + 1);
    for(var i = treasures; i--;){
      var c = input[read++].split(",");
      var tv = +c[0];
      var tw = +c[1];
 
      var dp = new Int16Array(maxWeight + 1);
      for(var w = 1; w <= maxWeight; w++){
        var pdpw = pdp[w];
        dp[w] = pdpw;
        if(w - tw >= 0){
          dp[w] = max(pdp[w-tw] + tv, pdpw);
        }
      }
      pdp = dp;
    }
 
    var resultWeight = 1001;
    var resultCost = 0;
    for(var i = 0; i <= maxWeight; i++){
      var pdpi = pdp[i];
      if(pdpi > resultCost){
        resultCost = pdpi;
        resultWeight = i;
      }
    }
     
    console.log("Case " + resultCase++ + ":\n" + resultCost + "\n" + resultWeight);
  }
}
 
function max(a, b) {
  var t = a - b;
  return a - (t & (t >> 31));
}

Measured memory_bytes: 12388
#include <iostream>
#include <vector>
#include <cstdlib>
using namespace std;
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;
}

const long long INF = 1LL << 60;

int N;
long long a[100010][3];
long long dp[100010][3];

int main(){
    int N;
    cin >> N;
    for(int i = 0; i < N; i++) {
        for(int j = 0; j < 3; j++) {
            cin >> a[i][j];
        }
    }

// jは前のものを参照するため
// kは次のものを決めるため
    for(int i = 0; i < N; i++){
        for(int j = 0; j < 3; j++){
            for(int k = 0; k < 3; k++){
                //かぶったらだめ
                if(j == k){
                    continue;
                }
                chmax(dp[i + 1][k], dp[i][j] + a[i][k]);
            }
        }
    }
    
    long long ans = 0;
    
    for(int j = 0; j < 3; j++){
        chmax(ans, dp[N][j]);
    }

    cout << ans << endl;

}








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

const int MAXN = 1e5+10;
int dp[30][MAXN],x[MAXN],l,n;
int q;

int main()
{
    int i,j;
    cin >> n;
    for(int i = 1; i <= n; ++i)
        cin >> x[i];
    cin >> l;
    for(int i = 1; i < n; ++i)
        dp[0][i] = upper_bound(x+1,x+n+1,x[i]+l) - x - 1;
    for(i = 1; i < 30; ++i)
    {
        for(j = 1; j <= n; ++j)
            dp[i][j] = dp[i-1][dp[i-1][j]];
    }
    cin >> q;
    int a,b,res;
    while(q--)
    {
        res = 0;
        cin >> a >> b;
        if(a > b) swap(a,b);
        for(i = 29; i >= 0; --i)
        {
            if(dp[i][a] == 0) continue;
            if(dp[i][a] < b)
            {
                a = dp[i][a];
                res += (1<<i);
            }
        }
        cout << res+1 << endl;
    }
    return 0;
}


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

int main() {
    int K;
    cin >> K;
    vector<int> A(K);
    rep(i, K) cin >> A[i];

    bool ok = true;
    if (A.back() != 2) {
        ok = false;
    }

    ll low = 2, high = 3;

    for (int i = K - 2; i >= 0; --i) {
        ll nextLow = (low + A[i] - 1) / A[i] * A[i];
        ll nextHigh = high / A[i] * A[i] + A[i] - 1;

        if (nextLow > high || nextHigh < low) {
            ok = false;
        }

        low = nextLow;
        high = nextHigh;
    }

    if (ok) {
        cout << low << ' ' << high << endl;
    }
    else {
        write(-1);
    }
}

Measured memory_bytes: 640
#include <iostream>
#include <cstdio>
#include <stack>
using namespace std;
typedef long long ll;
ll n, k, c, lst;
bool flag;
string s;
ll cnt;
bool vis[200010];
stack<int> stk;
int main() {
    cin >> n >> k >> c;
    cin >> s;
    lst = -1;
    for (int i = 0; i < (int)(s.length()); i++) {
        if (s[i] == 'x' || lst >= i) continue;
        if (cnt >= k) {
            flag = 1;
            break;
        }
        lst = i + c;
        vis[i] = 1;
        cnt++;
    }
    if (flag) {
        return 0;
    }
    lst = s.length();
    for (int i = (int)s.length() - 1; i >= 0; i--) {
        if (s[i] == 'x' || lst <= i) continue;
        lst = i - c;
        if (vis[i]) {
            stk.push(i);
        }
    }
    while (!stk.empty()) {
        cout << stk.top() + 1 << endl;;
        stk.pop();
    }
    return 0;
} 



Measured memory_bytes: 2464
import java.io.BufferedReader
import java.io.InputStream
import java.io.InputStreamReader
import java.io.PrintWriter
import java.util.*

fun PrintWriter.solve(sc: FastScanner) {
    val n = sc.nextInt()
    println(2 * Math.PI * n)
}

fun main(args: Array<String>) {
    val writer = PrintWriter(System.out, false)
    writer.solve(FastScanner(System.`in`))
    writer.flush()
}

class FastScanner(s: InputStream) {
    private var st = StringTokenizer("")
    private val br = BufferedReader(InputStreamReader(s))

    fun next(): String {
        while (!st.hasMoreTokens()) st = StringTokenizer(br.readLine())

        return st.nextToken()
    }

    fun nextInt() = next().toInt()
    fun nextLong() = next().toLong()
    fun nextLine() = br.readLine()
    fun nextDouble() = next().toDouble()
    fun ready() = br.ready()
}


Measured memory_bytes: 34608
from collections import deque

H,W=map(int,input().split())
s=[list(input()) for _ in range(H)]


d=deque()
d.append([0,0,0])
s[0][0]="0"
mx=[1,0,-1,0]
my=[0,1,0,-1]
ans=0

white=0
for i in range(H):
    for j in range(W):
        if s[i][j]==".":
            white+=1

while len(d)>0:
    t,y,x=d.popleft()
    if [y,x]==[H-1,W-1]:
        break
    for m in range(4):
        if 0<=y+my[m]<H and 0<=x+mx[m]<W and s[y+my[m]][x+mx[m]]==".":
            d.append([t+1,y+my[m],x+mx[m]])
            s[y+my[m]][x+mx[m]]=str(t+1)

if s[-1][-1]==".":
    print(-1)
else:
    print(white-int(s[-1][-1]))

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

using namespace std;

int vle[512] = {0};

int main(){
	
	vle['I'] = 1;
	vle['V'] = 5;
	vle['X'] = 10;
	vle['L'] = 50;
	vle['C'] = 100;
	vle['D'] = 500;
	vle['M'] = 1000;

	string str;
	while(cin >> str, !cin.eof()){
		
		int sum = 0, tmp = 0, befv = 0;
		char befc = 0;
		
		for(int i=0; i<str.size(); ++i){
			
			char nowc = str[i];
			int nowv = vle[nowc];

			if(nowv < befv){
				befc = nowc;
				sum += tmp;
				tmp = befv = nowv;
			}
			else if(nowv == befv){
				tmp += befv;
			}
			else{
				befc = nowc;
				sum -= tmp;
				tmp = befv = nowv;
			}
		}
		
		sum += tmp;
		cout << sum << endl;

	}

	return 0;
}
		

Measured memory_bytes: 1180
#include <stdio.h>
#include <iostream>
#include <math.h>
#include <string>
#include <vector>
#include <algorithm>
#include <iomanip>

//#include <tuple>

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

int main() {
  int N, K;
  cin >> N >> K;
  if (N%K == 0) cout << 0 << endl;
  else cout << 1 << endl;
  
}


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

constexpr int digitCount(int64_t n) {
  int ret = 1;
  while (n >= 10) {
    n /= 10;
    ret++;
  }
  return ret;
}

constexpr int solve(int64_t n) {
  if (n == 1) {
    return 1;
  }
  for (int i = static_cast<int>(ceil(sqrt(n * 1.0)));; i--) {
    if (n % i == 0) {
      return std::max(digitCount(i), digitCount(n / i));
    }
  }
}

int main() {
  int64_t n;
  std::cin >> n;
  std::cout << solve(n) << std::endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
string str[1001];
int main()
{
    int n,m;
    cin>>n>>m;
    for(int i=1;i<=n;i++)
        cin>>str[i];
    sort(str+1,str+1+n);
    for(int i=1;i<=n;i++)
        cout<<str[i];
    return 0;
}

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

#define FOR(i,l,r) for(int i = (int) (l);i < (int) (r);i++)
#define ALL(x) x.begin(),x.end()
template<typename T> bool chmax(T& a,const T& b){ return a < b ? (a = b,true) : false; }
template<typename T> bool chmin(T& a,const T& b){ return b < a ? (a = b,true) : false; }
typedef long long ll;

int N;

int main()
{
	scanf("%d",&N);
	vector<ll> A(N);
	FOR(i,0,N){
		scanf("%lld",&A [i]);
	}
	ll acc = accumulate(ALL(A),0ll);
	int idx = -1;
	vector< pair<ll,int> > v,w;
	FOR(i,0,N){
		if(idx == -1 || A [i] > A [idx]){
			idx = i;
			v.push_back({A [i],i});
		}
		else{
			w.push_back({A [i],i});
		}
	}
	sort(ALL(v));

	vector< pair<ll,ll> > ans(N);
	FOR(i,0,w.size()){
		auto x = upper_bound(ALL(v),pair<ll,int>(w [i].first,0));
		if(x == v.begin()){
			continue;
		}
		auto y = x;
		y--;
		ans [x->second].first += w [i].first - y->first;
		ans [y->second].second++;
	}

	for(int i = v.size() - 1;i > 0;i--){
		ans [v [i].second].second++;
		ans [v [i].second].first += ans [v [i].second].second * (v [i].first - v [i - 1].first);
		ans [v [i - 1].second].second += ans [v [i].second].second;
	}

	ll sum = 0;
	FOR(i,1,N){
		sum += ans [i].first;
	}
	ans [0].first = acc - sum;
	FOR(i,0,N){
		printf("%lld\n",ans [i].first);
	}

	return 0;
}


Measured memory_bytes: 5252
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cassert>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define rep(i,n) FOR(i,0,n)
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define vint vector<int>
#define vdouble vector<double>
#define vstring vector<string>
using namespace std;

#include<map>
#include<set>
#include<queue>

typedef long long ll;
typedef unsigned long long ull;

const int MAX_N = 1000000;
const int INFTY = (1 << 21); // 2097152
// const ll INFTY = (1LL << 60);
const ll MD = 1000000007LL;
// fprintf(stderr, "%d %lld \n", x, xll);


int N;
int main() {
	cin >> N;
	bool ret = (N % 10 == 9 || N / 10 == 9);
	cout << (ret ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <fstream>
#include <vector>
#include <algorithm>
#include <utility>
#include <set>
#include <queue>
#include <map>
#include <cmath>
#include <numeric>
#include <tuple>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;

const long long mod = 1e9 + 7;

vector<int> vx = {1, -1, 0, 0};
vector<int> vy = {0, 0, 1, -1};

long long modpow(const long long &v, const long long &n, const long long &mod)
{
    long long ret = 1;
    long long num = n;
    long long now = v;
    
    while (num > 0)
    {
        if (num & 1)
        {
            ret = ret * now % mod;
        }
        now = now * now % mod;
        num = num >> 1;
    }
    
    return ret;
}




int main() {
    
    
    ll n, k;
    
    cin >> n >> k;
    vector<ll> a(n);
    
    for (int i = 0; i < n; ++i)
    {
        cin >> a[i];
    }
    
    sort(a.begin(), a.end());
    
    vector<ll> fac(n + 1, 1);
    vector<ll> inv(n + 1, 1);
    for (int i = 1; i <= n; ++i)
    {
        fac[i] = fac[i - 1] * i % mod;
        inv[i] = modpow(fac[i], mod - 2, mod);
    }
    
    ll acmax = 0;
    ll acmin = 0;
    for (int i = 0; i < n; ++i)
    {
        ll curv = a[i];
        if (curv < 0)
        {
            curv += mod;
        }
        if (i >= k - 1)
        {
            ll c = fac[i] * inv[k - 1] % mod * inv[i - k + 1] % mod;
            acmax += (c * curv % mod);
            acmax %= mod;
        }
        if (n - i >= k)
        {
            ll c = fac[n - 1 - i] * inv[k - 1] % mod * inv[n - i - k] % mod;
            acmin += (c * curv % mod);
            acmin %= mod;
        }

    }
    
    if (acmax < acmin)
    {
        acmax += mod;
    }
    ll ret = acmax - acmin;
    
    cout << ret << endl;
    
    
    return 0;
}

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

int main() {
    int N;
    string S;
    cin >> N >> S;
    
    vector<int> white(N + 1, 0);
    for (int i = 1; i <= N; ++i) {
        white[i] = white[i - 1] + (S[i - 1] == '.' ? 1 : 0);
    }
    int ans = N;
    for (int i = 0; i <= N; ++i) {
        ans = min(ans, white[N] + i - 2 * white[i]);
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1412
n = int(input())
tree_lens = list(map(int, input().split()))
ans = 0
tree_lens.sort(reverse=True)
if n <= 2:
    print(ans)
else:
    for i in range(len(tree_lens)):
        for j in range(i + 1, len(tree_lens)):
            for k in range(j + 1, len(tree_lens)):
                if tree_lens[i] < tree_lens[j] + tree_lens[k] \
                        and tree_lens[i] != tree_lens[j] \
                        and tree_lens[j] != tree_lens[k]:
                    ans += 1
    print(ans)

Measured memory_bytes: 9204
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<set>

using namespace std;

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

	if (R < 1200) {
		cout << "ABC" << endl;
	}
	else if (R < 2800) {
		cout << "ARC" << endl;
	}
	else {
		cout << "AGC" << endl;
	}
}


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

char s[3];

int main(){
	scanf("%s", s);
	bool def = false;
	for(int i = 0; i < 2; i++){
		if(s[i] == '9') def = true;
	}
	if(def) printf("Yes\n");
	else printf("No\n");
	return 0;
}


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

int main() {
    string a;
    cin>>a;
    for (int i=0; i<(int)a.length(); i++) {
        if (i&1) {
            if (!(a[i]=='L' || a[i]=='U' || a[i]=='D')) {
                cout << "No" << endl;
                return 0;
            }
        } else {
            if (!(a[i]=='R' || a[i]=='U' || a[i]=='D')) {
                cout << "No" << endl;
                return 0;
            }
        }
    }
    cout << "Yes" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define int long long
using namespace std;
typedef vector<int>   vint;
typedef pair<int,int> pint;

int a[2][105];
int sum[2][105];

signed main()
{
    int N; cin>>N;
    REP(i,2) REP(j,N){
        cin>>a[i][j];
        sum[i][j+1]=sum[i][j]+a[i][j];
    }
    
    int ans=0;
    REP(j,N){
        int candy=sum[0][j+1]+(sum[1][N]-sum[1][j]);
        ans=max(ans,candy);
    }
    cout<<ans<<endl;

}


Measured memory_bytes: 256
H, W = map(int, input().split())

if H % 3 == 0 or W % 3 == 0:
    ans = 0
else:
    hp = [H//3, H//3+1]
    ans = H*W
    for h in hp:
        S1 = h*W
        if ((H-h)*W) % 2 == 0:
            ans = min(abs((H-h)*W//2 - S1), ans)
        else:
            S2 = (H-h-1)*W//2 
            S3 = (H-h+1)*W//2
            a = max([abs(S2-S1), abs(S1-S3), abs(S3-S2)])
            S4 = (H-h)*(W+1)//2
            S5 = (H-h)*(W-1)//2
            b = max([abs(S1-S4), abs(S4-S5), abs(S5-S1)])
            ans = min([ans, a, b])
    wp = [W//3, W//3+1]
    for w in wp:
        S1 = H*w
        if ((W-w)*H) % 2 == 0:
            ans = min(abs((W-w)*H//2 - S1), ans)
        else:
            S2 = (W-w-1)*H//2 
            S3 = (W-w+1)*H//2
            a = max([abs(S2-S1), abs(S1-S3), abs(S3-S2)])
            S4 = (W-w)*(H+1)//2
            S5 = (W-w)*(H-1)//2
            b = max([abs(S1-S4), abs(S4-S5), abs(S5-S1)])
            ans = min([ans, a, b])
print(ans)



Measured memory_bytes: 3064
#include<cstdio>
#include<algorithm>
using namespace std;
int main(void)
{
	int n,dp[1001][8]={0},mask[3]={4,2,1},p,a1,a2,i,j,k,sum;
	char s[1001];
	scanf("%d %s",&n,s);
	if(s[0]=='J')	p=mask[0];
	if(s[0]=='O')	p=mask[1];
	if(s[0]=='I')	p=mask[2];
	for(i=0;i<8;i++){
		a1=i&4;
		a2=i&p;
		if(a1!=0&&a2!=0){
			dp[0][i]=1;
		}
	}
	for(i=1;i<n;i++){
		if(s[i]=='J')	p=mask[0];
		if(s[i]=='O')	p=mask[1];
		if(s[i]=='I')	p=mask[2];
		for(j=1;j<8;j++){
			for(k=1;k<8;k++){
				a1=j&p;
				a2=j&k;
				if(a1!=0&&a2!=0){
					dp[i][j]+=dp[i-1][k];
				}
			}
			dp[i][j]%=10007;
		}
	}
	sum=0;
	for(i=1;i<8;i++){
		sum+=dp[n-1][i];
		sum%=10007;
	}
	sum%10007;
	printf("%d\n",sum);
	return 0;
}


Measured memory_bytes: 2736
import scala.io.StdIn.readLine

object Main extends App {

  for (_ <- 0 to 50) {
    var Array(m, f, r) = readLine.split(" ").map(_.toInt)
    if ((m, f, r) == (-1, -1, -1)) sys.exit()
    if (m == -1 || f == -1) println("F") else {
      m + f match {
        case score if score >= 80 => println("A")
        case score if score >= 65 => println("B")
        case score if score >= 50 || (score < 50 && score >= 30 && r >= 50) => println("C")
        case score if score >= 30 && r < 50 => println("D")
        case _ => println("F")
      }
    }
  }

}


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

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

    private static void solve(Scanner in) {
        int V = in.nextInt(), E = in.nextInt(), r = in.nextInt();
        EdgeWeightedGraph G = new EdgeWeightedGraph(V);
        for (int i = 0; i < E; i++) {
            G.addEdge(new DEdge(in.nextInt(), in.nextInt(), in.nextInt()));
        }
        BellmanFord bellman = new BellmanFord(G, r);
        if (bellman.hasNegativeCycle()) {
            System.out.println("NEGATIVE CYCLE");
        } else {
            for (int v = 0; v < G.V(); v++) {
                System.out.println(bellman.distTo(v));
            }
        }
    }
}

class BellmanFord {
    private static final double PINF = Double.POSITIVE_INFINITY;
    private static final double NINF = Double.NEGATIVE_INFINITY;

    private final double[] distTo;
    private boolean hasNegativeCycle;

    BellmanFord(EdgeWeightedGraph G, int r) {
        distTo = new double[G.V()];
        for (int v = 0; v < distTo.length; v++) {
            distTo[v] = v == r ? 0 : PINF;
        }
        for (int i = 0; i < G.V() - 1; i++) {
            for (DEdge e : G.edges()) {
                if (distTo[e.v] > distTo[e.u] + e.weight) {
                    distTo[e.v] = distTo[e.u] + e.weight;
                }
            }
        }
        for (DEdge e : G.edges()) {
            if (distTo[e.v] > distTo[e.u] + e.weight) {
                distTo[e.v] = NINF;
                hasNegativeCycle = true;
            }
        }
    }

    boolean hasNegativeCycle() {
        return hasNegativeCycle;
    }

    String distTo(int u) {
        return distTo[u] == PINF ? "INF" : String.valueOf((int) distTo[u]);
    }
}

class EdgeWeightedGraph {
    private final List<DEdge>[] adj;
    private int E;

    @SuppressWarnings("unchecked")
    EdgeWeightedGraph(int V) {
        adj = new List[V];
        for (int v = 0; v < adj.length; v++) {
            adj[v] = new ArrayList<>();
        }
    }

    int V() {
        return adj.length;
    }

    int E() {
        return E;
    }

    void addEdge(DEdge e) {
        adj[e.u].add(e);
        E++;
    }

    Iterable<DEdge> adj(int u) {
        return adj[u];
    }

    Iterable<DEdge> edges() {
        List<DEdge> edges = new ArrayList<>(E());
        for (int v = 0; v < V(); v++) {
            for (DEdge e : adj(v)) {
                edges.add(e);
            }
        }
        return edges;
    }
}

class DEdge {
    final int u, v, weight;

    DEdge(int u, int v, int weight) {
        this.u = u;
        this.v = v;
        this.weight = weight;
    }

    @Override
    public String toString() {
        return String.format("%d->%d(%d)", u, v, weight);
    }
}

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

ll choose2(ll n)
{
  return n * (n - 1) / 2;
}

int main()
{
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i, n) cin >> a[i];
  rep(i, n) a[i]--;
  vector<int> cnt(n);
  rep(i, n) cnt[a[i]]++;
  ll total = 0;
  rep(i, n)
  {
    total += choose2(cnt[i]);
  }

  rep(k, n)
  {
    ll ans = total - choose2(cnt[a[k]]) + choose2(cnt[a[k]] - 1);
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 4096
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a, b, c;
  cin >> a >> b;
  c=a*b%2;
  if (c==0){
    cout << "Even" << endl;
  }
  else {
    cout << "Odd" << endl;
  }
}

Measured memory_bytes: 3588
#include <stdio.h>

int main(){
  int n,m;
  m = 0;
  scanf("%d",&n);
  int d1[n],d2[n];
  for(int i = 0;i<n;i++){
    scanf("%d %d",&d1[i],&d2[i]);
  }
  for(int i = 0;i<n;i++){
    if(d1[i]==d2[i]){
      m++;
    }else{
      m=0;
    }
    if(m>=3){
      break;
    }
  }
  if(m>=3){
    printf("Yes\n");
  }else{
    printf("No\n");
  }
  return 0;
}

Measured memory_bytes: 1664