akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int z[10000][3];
int main(){
    int n;cin>>n;
    vector<int> a;
    int ans = 0;
    int siz = 0;
    for(int i = 0; n > i; i++){
        a.clear();
        for(int j = 0; 3 > j; j++){
            int tmp;cin>>tmp;
            a.push_back(tmp);
        }
        sort(a.begin(),a.end());
        int l = 0;
        bool add = true;
        while(true){
            bool doui = true;
            if(l == siz){
                break;
            }
            for(int g = 0; 3 > g; g++){
              //cout << "!!" << l << " " << g << " " << z[l][g] << " " << a[g] << endl;
                if(z[l][g] != a[g]){
                    doui = false;
                    break;
                }
            }
            if(doui){
                //cout << siz << endl;
                add = false;
                break;
            }
            l++;
        }
        if(add){
            for(int g = 0; 3 > g; g++){
                //cout << ":" << siz  << " "<< z[siz][g] << " " << a[g] << endl;
                z[siz][g]=a[g];
            }
            siz++;
        }else{
          ans++;
        }
      
    }
    cout << ans << endl;
}



Measured memory_bytes: 3160
/*input
7
1 7 8
-2 4 9
3 -8 -5
9 2 -14
6 7 5
-8 -9 3
3 8 10
*/
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<double,double> pdd;
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define F first
#define S second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define pb push_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
template<typename T1,typename T2>
ostream& operator<<(ostream& out,pair<T1,T2> P){
	out<<'('<<P.F<<','<<P.S<<')';
	return out;
}

//}}}
const ll maxn=100005;
const ll maxlg=__lg(maxn)+2;
const ll INF64=8000000000000000000LL;
const int INF=0x3f3f3f3f;
const ll MOD=ll(1e9+7);
const double PI=acos(-1);
//const ll p=880301;
//const ll P=31;

ll mypow(ll a,ll b){
	ll res=1LL;
	while(b){
		if(b&1) res=res*a%MOD;
		a=a*a%MOD;
		
		b>>=1;
	}
	return res;
}
ll n;
vector<int> v;
int BIT[maxn];
int low(int i){return i&(-i);}
void mdf(int n,int d){
	for(int i=n;i<maxn;i+=low(i)) BIT[i]+=d;
}
int query(int n){
	int ret=0;
	for(int i=n;i>0;i-=low(i)) ret+=BIT[i];
	return ret;
}

ll cal(){
	ll ans=0;
	for(int i:v){
		ans+=query(i);
		mdf(i,1);
	}
	for(int i:v) mdf(i,-1);
	return n*(n-1)/2-ans;
}

ll a[maxn],b[maxn],c[maxn];

vector<int> idx;
vector<pair<double,int>> intersect;
bool cmp(int i,int j){
	return (double) a[i]/b[i] < (double) a[j]/b[j];
}
void go(){
	idx.clear();
	REP(i,n) idx.pb(i);
	sort(ALL(idx),cmp);
	// for(int i:idx) cout<<a[i]<<' '<<b[i]<<' '<<c[i]<<'\n';;

	double l=-1e10,r=1e10;
	REP(iter,100){
		double mid=(l+r)/2;

		intersect.clear();

		REP(i,n){
			intersect.pb(MP( (c[idx[i]] - a[idx[i]]*mid) / b[idx[i]], i));
		}
		sort(ALL(intersect));
		v.clear();
		REP(i,n) v.pb(intersect[i].S+1);

		// cout<<"===\n";
		// cout<<mid<<'\n';
		// for(auto i:intersect) cout<<i<<' ';
		// cout<<'\n';

		ll tmp=cal();
		// cout<<tmp<<'\n';
		// cout<<"==\n";
		if(tmp+tmp<n*(n-1)/2) l=mid;
		else r=mid;
	}
	cout<<fixed<<setprecision(12)<<r;
}

int main()
{
	cin>>n;
	REP(i,n) cin>>a[i]>>b[i]>>c[i];

	go();
	cout<<' ';
	REP(i,n) swap(a[i],b[i]);
	go();
	cout<<'\n';
	return 0;
}


Measured memory_bytes: 2676
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
using namespace std;
#define int long long
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define all(a) a.begin(),a.end()
#define rall(c) (c).rbegin(),(c).rend()
#define mp make_pair
#define endl '\n'
typedef long long ll;
typedef pair<ll,ll> pll;
typedef long double ld;
const ll inf=1e9+7;
const ll mod=998244353;
double length(double a,double b,double c,double d){
    return sqrt((a-c)*(a-c)+(b-d)*(b-d));
}
double hero(double a,double b,double c){
    double s=(a+b+c)/2.0;
    return sqrt(s*(s-a)*(s-b)*(s-c));
}
double center_of_incircle(double a,double b,double c){
    double s=(a+b+c)/2.0;
    return hero(a,b,c)/s;
}
signed main(){
    double x1,y1,x2,y2,x3,y3;
    cin>>x1>>y1>>x2>>y2>>x3>>y3;
    double r1,r2,r3;
    double l1=length(x1,y1,x2,y2);
    double l2=length(x2,y2,x3,y3);
    double l3=length(x3,y3,x1,y1);
    double r=center_of_incircle(l1,l2,l3);
    r1=l1*r/(2.0*r+l1);
    r2=l2*r/(2.0*r+l2);
    r3=l3*r/(2.0*r+l3);
    cout<<fixed<<setprecision(10)<<max(r1,max(r2,r3))<<endl;
}

Measured memory_bytes: 256
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

s = input()

if s[0] == s[-1]:
	if len(s)%2 == 0:
		print("First")
	else:
		print("Second")
else:
	if len(s)%2 == 0:
		print("Second")
	else:
		print("First")


Measured memory_bytes: 3968
#include<cstdio>
using namespace std;
const int maxm=4005;
const int maxv=2002;
const int maxn=200005;
const int mod=1000000007;
int n,ans;
int a[maxn],b[maxn];
int f[maxm][maxm],C[maxm][maxm];
int main(){
	scanf("%d",&n);
	for (int i=1;i<=n;i++) scanf("%d%d",&a[i],&b[i]);
	for (int i=1;i<=n;i++) f[maxv-a[i]][maxv-b[i]]++;
	for (int i=1;i<maxm;i++) C[i][0]=C[0][i]=1;
	for (int i=1;i<maxm;i++)
		for (int j=1;j<maxm;j++){
			f[i][j]=(f[i][j]+f[i-1][j]+f[i][j-1])%mod;
			C[i][j]=(C[i-1][j]+C[i][j-1])%mod;
		}
	for (int i=1;i<=n;i++){
		ans=(ans+f[maxv+a[i]][maxv+b[i]])%mod;
		ans=(ans-C[a[i]*2][b[i]*2]+mod)%mod;
	}
	ans=1LL*ans*(mod+1)/2%mod;
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 126976
#include<iostream>
#include<string>
#include<algorithm>
#include<bits/stdc++.h>
using namespace std;

int main(){
  string S;
  int A[4];
  cin >> S;
  for(int i=0; i<4; i++){
    A[i] = S[i] - '0';
  }
  if(A[0]+A[1]+A[2]+A[3]==7) cout << A[0] << '+' << A[1] << '+' << A[2] << '+' << A[3] << '=' << '7' << endl;
  else if(A[0]+A[1]+A[2]-A[3]==7) cout << A[0] << '+' << A[1] << '+' << A[2] << '-' << A[3] << '=' << '7' << endl;
  else if(A[0]+A[1]-A[2]+A[3]==7) cout << A[0] << '+' << A[1] << '-' << A[2] << '+' << A[3] << '=' << '7' << endl;
  else if(A[0]+A[1]-A[2]-A[3]==7) cout << A[0] << '+' << A[1] << '-' << A[2] << '-' << A[3] << '=' << '7' << endl;
  else if(A[0]-A[1]+A[2]+A[3]==7) cout << A[0] << '-' << A[1] << '+' << A[2] << '+' << A[3] << '=' << '7' << endl;
  else if(A[0]-A[1]+A[2]-A[3]==7) cout << A[0] << '-' << A[1] << '+' << A[2] << '-' << A[3] << '=' << '7' << endl;
  else if(A[0]-A[1]-A[2]-A[3]==7) cout << A[0] << '-' << A[1] << '-' << A[2] << '-' << A[3] << '=' << '7' << endl;
  else if(A[0]-A[1]-A[2]+A[3]==7) cout << A[0] << '-' << A[1] << '-' << A[2] << '+' << A[3] << '=' << '7' << endl;

}


Measured memory_bytes: 256
#include<cstdio>

using namespace std;

int main(){
    int n;
    scanf("%d", &n);
    int p[n];
    for(int i = 0; i < n; i++){
        scanf("%d", &p[i]);
    }

    int mn = 1000000;
    int ans = 0;
    for(int i = 0; i < n; i++){
        if (mn >= p[i]){
            ans++;
            mn = p[i];
        }
    }
    printf("%d\n", ans);
}

Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main(void){
    ll n,l,r; cin>>n;
    set <ll> st;
    vector <ll> d(200010);
    for(int i=0;i<n;i++){
        int a; cin>>a;
        d[a]=i;
    }
    ll ans=0;
    st.insert(-1);
    st.insert(n);
    for(ll i=1;i<=n;i++){
        l=*(--st.lower_bound(d[i]));
        r=*(st.lower_bound(d[i]));
        ans += i*(d[i]-l)*(r-d[i]);
        st.insert(d[i]);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 11136
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll,ll>;
using vl = vector<ll>;
using Map = map<ll,ll>;
using Tup = tuple<ll,ll,ll>;
using vvl = vector<vector<ll>>;
#define all(v) v.begin(), v.end()
#define prt(v) cout<<(v)<<"\n";
#define fl cout<<flush;
#define fi(v) get<0>(v)
#define se(v) get<1>(v)
#define th(v) get<2>(v)
#define endl "\n"
template <typename T> bool chmax(T &a, const T &b){if (a<b){a=b;return 1;}return 0;}
template <typename T> bool chmin(T &a, const T &b){if (a>b){a=b;return 1;}return 0;}
const ll INF=1LL<<60;
const ll MOD=1000000007;

signed main(void){
    cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    prt(N*2/__gcd(2LL,N))

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define reprrev(i,a,b) for(int i=b-1;i>=a;i--) // [a, b)
#define reprev(i,n) reprrev(i,0,n)
typedef long long ll;
typedef unsigned long long ull;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
    sizeは(int)とキャストしよう
    cin.tie(0);
    ios::sync_with_stdio(false);<- これら、printfとかと併用しない方が良さそう

*/

const ll mod = 1e9+7;

void chmod(ll &M){
    if(M >= mod) M %= mod;
    else if(M < 0){
        M += (abs(M)/mod + 1)*mod;
        M %= mod;
    }
}

ll modpow(ll x, ll n){
    if(n==0) return 1;
    ll res=modpow(x, n/2);

    if(n%2==0) return res*res%mod;
    else return res*res%mod*x%mod;
}

int getl(int i, int N) { return i==0? N-1:i-1; };
int getr(int i, int N) { return i==N-1? 0:i+1; };


// 線分 ab の偏角 返り値は[-π, π]
double argument(const pair<double, double> &a, const pair<double, double> &b){
    double ax=a.first, ay=a.second, bx=b.first, by=b.second;
    return atan2(by-ay, bx-ax);
}

/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */



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

    ll n; cin >> n;
    string ans = "";

    do{
        ans += to_string(abs(n%2));
        n -= abs(n%2);
        n /= -2;
    } while(n != 0);

    reverse(ans.begin(), ans.end());
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
N,A = map(int, input().split())
X = [int(x) for x in input().split()]

M = sum(X)
dp = [[[0]*(N+1) for _ in range(M+1)] for _ in range(N+1)]
    
for i in range(N+1):
    dp[i][0][0] = 1
    
for i in range(N):
    for j in range(M+1):
        for k in range(1, N+1):
            if j >= X[i]:
                dp[i+1][j][k] = dp[i][j][k] + dp[i][j-X[i]][k-1]
            else:
                dp[i+1][j][k] = dp[i][j][k]
        
ans = 0
for k in range(1, N+1):
    if k*A <= M:
        ans += dp[N][k*A][k]
            
print(ans)

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

using namespace std;

#define rep(i, n) for(int i = 0; i < (n); ++i)
#define eee(a) (cerr << (#a) << ": " << (a) << endl);
#define ppp(a) (cout << (a) << endl); 
#define cop(a) for(auto x:(a)){cout << x << endl;}

using ll = long long;
using pint = pair<int, int>;
using pll = pair<ll, ll>;
using mint = map<int, int>;

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

constexpr char sp = ' ';
constexpr char cmm = ',';
constexpr int MOD = 1e9+7;
constexpr int INF = 1e9;
constexpr ll LINF = 1e18;
constexpr double phi = (1+sqrt(5))/2;
constexpr double pi = 3.14159265358979323846264338327950288;

ll mod(ll a, ll b){return (a%b+b)%b;}
ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b){return a*b/gcd(a,b);}
inline void Yes(){puts("Yes");}
inline void No(){puts("No");}
inline void Judge(bool b){b?Yes():No();}
inline void YES(){puts("YES");}
inline void NO(){puts("NO");}
inline void JUDGE(bool b){b?YES():NO();}
inline ll powmod(ll b, ll e){ll r=1;while(e>0){if(e&1)r=(r%MOD)*(b%MOD)%MOD;b=(b%MOD)*(b%MOD)%MOD;e>>=1;}return r;}
inline double distance(ll x1, ll y1, ll x2, ll y2){return sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));}
inline double d2r(double d){return d*pi/180;}
inline double r2d(double r){return r*180/pi;}

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<typename T1, typename T2> ostream& operator<<(ostream& s, const pair<T1, T2>& p) {return s << "(" << p.first << ", " << p.second << ")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
    int len = v.size();
    s << '[';
    for (int i = 0; i < len; ++i) {
        s << v[i]; if (i < len-1) s << ", ";
    }
    s << ']';
    return s;
}

struct aaa{
    aaa(){
        // comment this out when you use scanf or printf
        // cin.tie(0); ios::sync_with_stdio(0);
        cout<<fixed<<setprecision(15);
    };
}fastio;


vector<int> dp(6060, 0);
int main(){
    int n, t;
    scanf("%d%d", &n, &t);
    vector<pint> ab(n);
    rep(i, n) scanf("%d%d", &ab[i].first, &ab[i].second);

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

    for(int i = 0; i < n; ++i) for(int j = t-1; j >= 0; --j) chmax(dp[j+ab[i].first], dp[j] + ab[i].second);
    ppp(*max_element(dp.begin(), dp.end()));

    
    return 0;
}


Measured memory_bytes: 256
import math

a, b, h, m = map(int, input().split())

rad_h = 2 * math.pi * (h / 12 + m / (60 * 12))
rad_m = 2 * math.pi * (m / 60)

rad_hm = rad_h - rad_m

l = math.sqrt(a**2 + b**2 - 2 * a * b * math.cos(rad_hm))
print(l)

Measured memory_bytes: 9444
package main

import (
	"bufio"
	"fmt"
	"os"
	//"strconv"
	"strings"
)

func main() {
	r := bufio.NewReader(os.Stdin)
	s, _ := r.ReadString('\n')
	s = strings.TrimRight(s, " \t\n")
	if 'A' <= s[0] && s[0] <= 'Z' {
		fmt.Println("A")
	} else if 'a' <= s[0] && s[0] <= 'z' {
		fmt.Println("a")
	}
}


Measured memory_bytes: 1772
#include <bits/stdc++.h>
using namespace std;
int main(void){
    
    /*
    int a, b;
    cin >> a >> b ;
    //*/

    char a;
    cin >> a ;

    a = a + 1;

    /*
    vector<int> vec(3);
    cin >> vec.at(0) >> vec.at(1) >> vec.at(2) ;

    sort(vec.begin(), vec.end());
    //*/
    
    /*
    if( a == b ){
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    //*/
    
    cout << a << endl;
    
    return 0; 
}


Measured memory_bytes: 3656
#include <stdio.h>

int main(void){
	int d;
	int i;
	int sum;

	while(scanf("%d", &d) != EOF){
		sum = 0;
		for(i=1; i < 600/d; i++){
			sum += (i*d)*(i*d) * d;
		}
		printf("%d\n", sum);
	}

	return 0;
}

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

int main() {
int N;
cin>>N;
vector<int> vec(N);
for(int i=0 ; i<N ; i++){
int a;
cin>>a;
while(a%2==0){
vec.at(i)++;
a/=2;
}
}
int result=vec.at(0);
for(int i=1 ;i<N ; i++){
if( result>vec.at(i)){
result=vec.at(i);
}
}
cout<<result<<endl;
}


Measured memory_bytes: 256
#include <stdio.h>
int main()
{
    int a,b;
    scanf("%d%d",&a,&b);
    if(a!=1&&b!=1)
    {
        if(a>b)
            printf("Alice");
        else if(b>a)
            printf("Bob");
        else
            printf("Draw");
    }
    if(a==1&&b!=1)
        printf("Alice");
    if(a!=1&&b==1)
        printf("Bob");
    if(a==1&&b==1)
        printf("Draw");
    return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
#include <stdio.h>
#include<math.h>
#include<string>
#include<vector>
#define rep(i,n) for(int i=0;i<n;i++)
#define ll long long
using namespace std;
int main(void){
  int N;
  cin >> N;
  int a[N];
  int maxn = 0;
  int maxn2 = 0;
  int sw;
  int sw2;
  rep(i,N){
    cin >> a[i];
  }
  rep(i,N){
    if(maxn<a[i]){
      sw=i;
      maxn=a[i];
    }
  }
  swap(a[sw],a[0]);
  for(int i=1;i<N;i++){
    if(maxn2<a[i]){
      sw2=i;
      maxn2=a[i];
    }
  }
  swap(a[sw2],maxn2);
  rep(i,N){
    if(i==sw){
      cout << maxn2 << endl;
    }else{
      cout << maxn << endl;
    }
  }
	return 0;
}


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

int main(){
    string str1,str2;
    cin>>str1>>str2;
    if(str1[0]==str2[2]&&str1[2]==str2[0]&&str1[1]==str2[1])cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
    return 0;
}

Measured memory_bytes: 3592
# ABC 088 D

from collections import deque

def resolve():
    WALL = -1
    UNVISITED = -2

    H, W = map(int, input().split())
    sy, sx = 0, 0
    gy, gx = H-1, W-1

    c = [[0] * W for _ in range(H)]

    num_aile = 0

    for i in range(H):
        tmp = input()
        for j in range(W):
            if tmp[j] == '.':
                c[i][j] = UNVISITED
                num_aile += 1
            else:
                c[i][j] = WALL

    que = deque([[sy, sx]])
    c[sy][sx] = 0

    def BFS(x, y):
        for i, j in [[x-1, y], [x+1, y], [x, y-1], [x, y+1]]:
            if i < 0 or H <= i or j < 0 or W <= j:
                continue
            if c[i][j] == UNVISITED:
                que.append([i, j])
                c[i][j] = c[x][y] + 1

    while len(que) > 0:
        p = que.popleft()
        BFS(p[0], p[1])

    if c[gy][gx] == -2:
        print(-1)
    else:
        print(num_aile - c[gy][gx] - 1)


if __name__ == "__main__":
    resolve()


Measured memory_bytes: 3444
#include <iostream>
#include <string>
#include <algorithm>
#include <math.h>
#include <vector>
#include <map>
using namespace std;
typedef long long int lo;
#define pb push_back
#define mp make_pair
#define st first
#define nd second
lo a,b,c,d,e,x,n,m,t,y,a1[100005],a2[100005],a3[100005],bir,sifir;
char c1,c2,c3,c4; 
string s1,s2,s3,s4,s[1005];
lo der[100]={60,90,108,120};
bool av=false;
// pair <lo, pair <lo, lo> > a3[105];
vector <pair<lo, lo> > v;
map <lo,lo> mp1;
int main() {
    // freopen("gir.gir","r",stdin);
    // freopen("cik.cik","w",stdout);
    cin>>s1;
    if(s1=="Sunny"){
        cout<<"Cloudy\n";
    }
    else if(s1=="Rainy"){
        cout<<"Sunny\n";
    }
    else{
        cout<<"Rainy\n";
    }
    return 0;
}
//54 + 40 = 94
//10 + 3 = 13

Measured memory_bytes: 256
def main():
    H, W = [int(i) for i in input().split()]
    grid = [list(input()) for _ in range(H)]
    grid = [l for l in grid if "#" in l]
    grid = list(zip(*grid))
    grid = [l for l in grid if "#" in l]
    grid = ["".join(l) for l in zip(*grid)]
    print(*grid, sep="\n")


if __name__ == "__main__":
    main()

Measured memory_bytes: 38384
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>

using namespace std;
int i,w;
string S;

vector<char> out(1001);

int main(){
  cin >> S >> w;
  for(i=0;i<S.length();i+=w){
    cout << S.at(i);
  }
  return 0;
}


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

int main(){
    int x;
    cin >> x;
    if(x >= 30) cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define typeof(x) __typeof__(x)
#define int long long int
#define double long double
#define mod(x) ((x % MOD) + MOD) % MOD
#define rep(i,a,b) for(int i=(a);i<(b);++i)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);--i)

#define ALL(c) (c).begin(),(c).end()
#define RALL(c) (c).rbegin(),(c).rend()
#define SZ(c) (int)((c).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define SORT(c) sort(ALL(c))
#define RSORT(c) sort(RALL(c))
#define LB(c,x) (int)(lower_bound(ALL(c),x)-(c).begin())
#define UB(c,x) (int)(upper_bound(ALL(c),x)-(c).begin())
#define COUNT(c,x) UB(c,x)-LB(c,x)
#define UNIQUE(c) SORT(c); (c).erase(unique(ALL(c)),(c).end());
#define COPY(c1,c2) copy(ALL(c1),(c2).begin())
#define EXIST(s,e) (s).find(e)!=(s).end()
#define PB push_back
#define MP make_pair
#define vec vector

#define dump(x)  cerr << #x << " = " << (x) << endl;

using namespace std;

typedef pair<int,int> P;
struct edge { int to, cost; };

const int INF = 1e18;
const int MOD = 1e9+7;

template<typename T> ostream& operator << (ostream& s, const vector<T>& v) {
   s << "[";
   for (int i = 0; i < v.size(); i++) { s << v[i]; if (i < v.size() - 1) s << " "; }
   s << "]";
   return s;
}
template<typename T1, typename T2> ostream& operator << (ostream& s, const pair<T1,T2>& p) {
   s << "(" << p.first << "," << p.second << ")";
   return s;
}

signed main()
{
   int N; cin >> N;
   int M = (int)(log(N)/log(2)) + 1;
   vec<vec<int>> dp(M+1, vec<int>(3, 0));

   dp[0][0] = 1;

   rep(i, 0, M) {
      if (N >> (M-1-i) & 1) {
         dp[i+1][0] = mod(  dp[i][0]             );
         dp[i+1][1] = mod(  dp[i][0] +   dp[i][1]);
         dp[i+1][2] = mod(2*dp[i][1] + 3*dp[i][2]);
      } else {
         dp[i+1][0] = mod(  dp[i][0] +   dp[i][1]);
         dp[i+1][1] = mod(  dp[i][1]             );
         dp[i+1][2] = mod(  dp[i][1] + 3*dp[i][2]);
      }
   }

   int ans = mod(dp[M][0] + dp[M][1] + dp[M][2]);
   cout << ans << endl;

   return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    static int n;
    static int[] a;
    static long[] dp;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        if (n%2==0) {
            System.out.println(n/2);
        } else {
            System.out.println(n/2+1);
        }
    }

}

Measured memory_bytes: 21460
#pragma region template
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using vld = vector<ld>;
using vvld = vector<vld>;
using vvvld = vector<vvld>;
using vs = vector<string>;
using pll = pair<ll, ll>;
using vp = vector<pll>;
template <typename T>
using pqrev = priority_queue<T, vector<T>, greater<T>>;
#define rep(i, n) for (ll i = 0, i##_end = (n); i < i##_end; i++)
#define repb(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repr(i, a, b) for (ll i = (a), i##_end = (b); i < i##_end; i++)
#define reprb(i, a, b) for (ll i = (b)-1, i##_end = (a); i >= i##_end; i--)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((ll)(x).size())
//*
constexpr ll MOD = 1e9 + 7;
/*/
constexpr ll MOD = 998244353;
//*/
constexpr ll INF = 1e+18;
constexpr ld EPS = 1e-12L;
constexpr ld PI = 3.14159265358979323846L;
constexpr ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
constexpr ll LCM(ll a, ll b) { return a / GCD(a, b) * b; }
template <typename S, typename T>
constexpr bool chmax(S &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename S, typename T>
constexpr bool chmin(S &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
#ifdef OJ_LOCAL
#include "dump.hpp"
#else
#define dump(...) ((void)0)
#endif
template <typename T>
bool print_(const T &a) {
  cout << a;
  return true;
}
template <typename T>
bool print_(const vector<T> &vec) {
  for (auto &a : vec) {
    cout << a;
    if (&a != &vec.back()) {
      cout << " ";
    }
  }
  return false;
}
template <typename T>
bool print_(const vector<vector<T>> &vv) {
  for (auto &v : vv) {
    for (auto &a : v) {
      cout << a;
      if (&a != &v.back()) {
        cout << " ";
      }
    }
    if (&v != &vv.back()) {
      cout << "\n";
    }
  }
  return false;
}
void print() { cout << "\n"; }
template <typename Head, typename... Tail>
void print(Head &&head, Tail &&... tail) {
  bool f = print_(head);
  if (sizeof...(tail) != 0) {
    cout << (f ? " " : "\n");
  }
  print(forward<Tail>(tail)...);
}
#pragma endregion

void Pr(bool f){
  cout << (f ? "Yes" : "No") << "\n";
  exit(0);
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  string s, t;
  cin >> s >> t;
  t.pop_back();
  Pr(s==t);
}


Measured memory_bytes: 3616
def ispossible(a):
    d = [a[i] - a[i-1] for i in range(1, len(a))]
    return not 1 in d


def main():
    N, M = map(int, input().split())
    a = [int(input()) for _ in range(M)]

    MOD = 10**9+7

    if not ispossible(a):
        print(0)
        return

    s = [1] * (N+1)

    a = set(a)

    for i in a:
        s[i] = -1

    for i in range(2, N+1):
        if i in a:
            continue

        s[i] = 0
        if i-1 not in a:
            s[i] += s[i-1]
            s[i] %= MOD
        if i-2 not in a:
            s[i] += s[i-2]
            s[i] %= MOD

    print(s[N] % MOD)


if __name__ == '__main__':
    main()

Measured memory_bytes: 9192
n = int(input())
ans = 0
if n < 10:
    ans = n
elif n < 100:
    ans = 9
elif n < 1000:
    ans = n-90
elif n < 10000:
    ans = 909
elif n < 100000:
    ans = n-9090
else:
    ans = 90909
print(ans)


Measured memory_bytes: 2940
#include <cstdio>
#include <climits>
#include <algorithm>
using namespace std;

void sort_count(int n, int *a, int *b, long long &count) {
  if(n <= 1) return;
  int m0 = n/2;
  int m1 = n-m0;
  sort_count(m0, a, b, count);
  sort_count(m1, a+m0, b+m0, count);
  int i = 0, j = 0;
  while(i < m0 || j < m1) {
    int ai = i < m0 ? a[i] : INT_MAX;
    int aj = j < m1 ? a[m0+j] : INT_MAX;
    if(ai <= aj) {
      b[i++ + j] = ai;
    } else {
      b[i + j++] = aj;
      count += m0 - i;
    }
  }
  copy(b, b+n, a);
}

int main() {
  for(int tci = 0; ; tci++) {
    int N; scanf("%d", &N);
    if(!N) break;
    int *a = new int[N];
    int *b = new int[N];
    for(int i = 0; i < N; i++) scanf("%d", a+i);
    long long count = 0;
    sort_count(N, a, b, count);
    printf("%lld\n", count);
    delete[] b;
    delete[] a;
  }
  return 0;
}

Measured memory_bytes: 1048
package main

import (
	"fmt"
	"sort"
	"strconv"
)

func main() {
	nums := make([]int, 3)
	for i := 0; i < 3; i++ {
		fmt.Scan(&nums[i])
	}
	sort.Sort(sort.Reverse(sort.IntSlice(nums)))
	n, _ := strconv.Atoi(strconv.Itoa(nums[0]) + strconv.Itoa(nums[1]))
	fmt.Println(n + nums[2])
}


Measured memory_bytes: 512
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <numeric>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int GCD(const int& a, const int& b){
   const int& _a = max(a,b);
   const int& _b = min(a,b);
   if(_a % _b == 0){
      return _b;
   }
   else{
      return GCD(_b, _a % _b);
   }
}

int LCM(const int& a, const int& b){
   const int& _a = max(a,b);
   const int& _b = min(a,b);
   return (_a*_b)/(GCD(_a, _b));
}

int main(){
   string s, t;
   cin >> s >> t;
   sort(s.begin(), s.end());
   sort(t.begin(), t.end(), greater<int>());

   cout << ((s < t) ? "Yes" : "No") << endl;

   return 0;
}

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

int main()
{
    int n;
    cin>>n;
    vector<int> t(n,0);
    for(int i = 1; i < n; i++)
    {
        int a;
        cin>>a;
        t[a-1]++;
    }
    for(int i = 0; i < t.size(); i++)
    {
        cout<<t[i]<<endl;
    }
    return 0;
}

Measured memory_bytes: 4052
#include<bits/stdc++.h>
using namespace std;
#define ll long long int 
#define ld long double
#define mod 1000000007
#define endl "\n"
#define pb push_back
#define mp make_pair
int main()
{
    ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll n,a;
	cin>>n;
	while(n--)
	{
		cin>>a;
		if(a%2==0)
		{
			if(a%3 && a%5)
			{
				cout<<"DENIED";
				return 0;
			}
		}
	}
	cout<<"APPROVED";
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>

int main(void){
    
    char a[100]={},b[100]={},c[100]={};
    
    scanf( "%s %s %s",a,b,c );
    
    int length_a = strlen(a);
    int length_b = strlen(b);
    int length_c = strlen(c);
    
    if( a[length_a -1] == b[0] && b[length_b -1] == c[0] ){
        printf("YES");
    }
    else printf("NO");
    
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <tuple>
#include <cstdio>
#include <bitset>
#include <sstream>
#include <iterator>
#include <numeric>
#include <map>
#include <cstring>

using namespace std;

#define DEBUG_ //!!提出時にコメントアウト!!
#ifdef DEBUG_
	#define dump(x)  cerr << #x << " = " << (x) << endl;
#else
	#define dump(x)  ; //何もしない文
#endif

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size()) //unsignedのサイズをint型に変換

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL; 

template <typename T>
std::string printVector(const std::vector<T> &data)
{
    std::stringstream ss;
    std::ostream_iterator<T> out_it(ss, ", ");
    ss << "[";
    std::copy(data.begin(), data.end() - 1, out_it);
    ss << data.back() << "]";
    return ss.str();
}

const int MOD = 1e9+7;
const LL LINF = 1001002003004005006ll;
const int INF = 1001001001;

//ここから書き始める
int main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);	
    int N;
    cin >> N;
    VI h(N);
    REP(i,N)
    {
        cin >> h[i];
    }
    int end = 0;
    int ans = 0;
    int start;

    while(1)
    {
        REP(i,N)
        {
            if(h[i] != 0) 
            {
                start = i;
                break;
            }
            if(i==N-1) end = 1;
        }
        if(end) break;
        FOR(i,start,N)
        {
            if(h[i] == 0) 
            {
                break;
            }
            h[i]--;
        }
        ans++;
    }
    cout << ans << endl;

}


Measured memory_bytes: 256
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();
		int C = sc.nextInt();
		int K = sc.nextInt();

		if (K < A) {
			System.out.println(K);
		} else if (K <= A + B) {
			System.out.println(A);
		} else if (K > A + B) {
			System.out.println(A - (K - (A + B)));
		}

	}

}

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

void Main()
{
    int n;
    cin >> n;
    vector<vector<int>> a(n, vector<int>(3));
    vector<vector<long>> happy(n, vector<long>(3));
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < 3; j++)
            cin >> a[i][j];
        for (int j = 0; j < 3; j++)
        {
            if(i==0){
                happy[i][j] = a[i][j];
            }else{
                long h = 0;
                for (int k = 0; k < 3; k++)
                {
                    if(j != k){
                        h = max(h, happy[i-1][k] + a[i][j]);
                    }
                }
                happy[i][j] = h;
            }
        }
    }

    long h = 0;
    for(auto i: happy[n-1]){
        h = max(h, i);
    }
    
    cout << h << endl;
}

int main(int argc, char **argv)
{
    Main();
    return 0;
}


Measured memory_bytes: 11136
N=int(input())
dp=[[0]*3 for i in range(N+1)]#今回は正の範囲で最大値をもとめたいので0で初期化
for i in range(N):
  a=list(map(int,input().split()))
  for j in range(3):
    for k in range(3):
      if k!=j:
        dp[i+1][j]=max(dp[i][k]+a[j],dp[i+1][j])
print(max(dp[-1]))

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

ll a, b, c, k;

inline ll read(){
	ll s = 0, w = 1;
	char ch = getchar();
	for (; ch < '0' || ch > '9'; ch = getchar()) w *= ch == '-' ? -1 : 1;
	for (; ch >= '0' && ch <= '9'; ch = getchar()) s = s * 10 + ch - '0';
	return s * w;
}

inline void work(){
	a = read(), b = read(), c = read(), k = read();
	if (a >= k) printf("%lld\n", k);
	else if (a + b >= k) printf("%lld\n", a);
		 else printf("%lld\n", a - k + a + b);
}

int main(){
	work();
	return 0;
}

Measured memory_bytes: 3764
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,l,r) for(long long i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define int long long
const int MOD=1e9+7;
const int INF=1e15;

signed main(){
    int A,B;cin>>A>>B;
    if(A%2==1&&B%2==1)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

Measured memory_bytes: 256
// CODE by Kazhybay Askar

//#include <ext/pb_ds/assoc_cont ainer.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
#include <bits/stdc++.h>

using namespace std;
//using namespace __gnu_pbds;

//#pragma comment(linker, "/stack:200000000")
//#pragma GCC    optimize("Ofast")
//#pragma GCC    target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define f      first
#define s      second
#define pb     push_back
#define pf     push_front
#define ppb    pop_back
#define ppf    pop_front
#define Speed  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define sz     size()
#define all(x) x.begin(),x.end()
#define cont   continue
#define r0     return 0
#define endl   '\n'

typedef long long ll;
typedef long double   ld;
typedef pair<ll,ll>   pll;
typedef pair<int,int> pii;
typedef pair<char,char> pcc;

const int MAXN  = 5e5  + 7;
const int MOD   = 1e9  + 7;
const int INF   = 1e9  + 7;
const ll  MINF  = 1e18 + 7;
const int EPS   = 1e-6;
const int dx[]  = {0, 0, 1, -1, -1, -1, 1, 1};
const int dy[]  = {1, -1, 0, 0, -1, 1, -1, 1};
const double pi = acos(-1.0);

int n,a[MAXN];

void solve(){
    cin >> n;
    int mx = -1;
    int mn = 10000000000;
    for(int i = 1; i <= n; i++){
        cin >> a[i];
        mx = max(mx, a[i]);
        mn = min(mn, a[i]);
    }
    if(2 <= mx - mn){
        cout << "No";
        return ;
    }
    if(mx == mn){
        bool cnt1 = 1, cnt2 = 1;
        for(int i = 1; i <= n; i++){
            if(2 * a[i] > n){
                cnt1 = 0;
            }
            if(n - 1 != a[i]){
                cnt2 = 0;
            }
        }
        if(cnt1 == 0 && cnt2 == 0){
            cout << "No";
            return ;
        }
        cout << "Yes";
        return ;
    }
    int x = 0;
    int y = 0;
    for(int i = 1; i <= n; i++){
        if(a[i] == mn){
            x++;
        }
        else{
            y++;
        }
    }
    if(x + 1 <= mx && mx <= x + y / 2){
        cout << "Yes";
        return ;
    }
    cout << "No";
}



int main(){
    Speed;
    ll T=1;
    //cin>>T;
    while(T--){
        solve();
    }
    r0;
}




Measured memory_bytes: 640
const int dx[]={1,0,0,1, 1,0, 0,1,-1,1, 1, 1, 1};
const int dy[]={0,1,0,1,-1,1, 1,0, 0,1, 1,-1,-1};
const int dz[]={0,0,1,0, 0,1,-1,1, 1,1,-1, 1,-1};
M[9][9][9],H[9][9],q[2];main(n,m,p,I,x,y,z,j,c,d,J){for(;scanf("%d%d%d",&n,&m,&p),n;){
	for(memset(M,I=0,sizeof(M)),memset(H,I=0,sizeof(H)),c=1;I++<p;c*=-1){
		scanf("%d%d",&x,&y);
		if(H[x][y]==0)H[x][y]=1;
		M[x][y][z=H[x][y]++]=c;
		for(d=0;d<13;d++){
			for(j=0;j<2;j++)for(q[j]=0;;q[j]+=2*j-1)if(M[x+dx[d]*q[j]][y+dy[d]*q[j]][z+dz[d]*q[j]]!=c)break;
			if(q[1]-q[0]-1>=m){printf(c==1?"Black %d\n":"White %d\n",I);goto next;}
		}
	}
	puts("Draw");
next:
	for(;I++<p;)scanf("%d%d",&x,&y);
}exit(0);}

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

int main() {
  int K;
  cin >> K;
  int a = 7;
  int ans = 1;
  for(int i = 2; i <= K; i++){
    if(i == 2 && a % K ==0){
      break;
    }
    a *= 10;
    a += 7;
    a = a % K;
    if(a == 0){
      ans = i;
      break;
    }
    if(i == K){
      ans = -1;
    }
  }
  
  cout << ans << endl;
}

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

int n;
int k;
int s;
int ans;

void Rec(int idx, int total, int num) {
  if (num == k) {
    if (total == s) ans++;
    return;
  }

  if (idx > n) return;

  for (int i=idx; i<=n; i++) {
    Rec(i+1, total+i, num+1);
  }
}

int main() {
  while (1) {
    scanf("%d%d%d", &n, &k, &s);
    if ((n|k|s) == 0) return 0;

    ans = 0;
    Rec(1, 0, 0);
    printf("%d\n", ans);
  }
}

Measured memory_bytes: 3104
#include <iostream>
#include <cstdio>
#include <cmath>
#define PI 3.1415926535898
#define EPS 1e-9
using namespace std;

double calc(double a1,double a2,double b1,double b2){
	return acos((a1 * b1 + a2 * b2) / sqrt(a1 * a1 + a2 * a2) / sqrt(b1 * b1 + b2 * b2)) * 180.0 / PI;
}

int main(){
	double x1,y1,x2,y2,x3,y3,x4,y4;
	while(scanf("%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf",&x1,&y1,&x2,&y2,&x3,&y3,&x4,&y4) != EOF){
		double c1,c2,c3,c4;
		c2 = calc(x1 - x2,y1 - y2,x3 - x2,y3 - y2);
		c3 = calc(x2 - x3,y2 - y3,x4 - x3,y4 - y3);
		c4 = calc(x3 - x4,y3 - y4,x1 - x4,y1 - y4);
		c1 = calc(x4 - x1,y4 - y1,x2 - x1,y2 - y1);
		if(abs(360.0 - (c1 + c2 + c3 + c4)) <= EPS) cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	return 0;
}

Measured memory_bytes: 3344
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Stack;

public class Main {

    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] array = br.readLine().split(" ");

        Stack<Integer> stack = new Stack<>();

        for (String s : array) {
            if (isOperator(s)) {
                int a = stack.pop();
                int b = stack.pop();
                int c = calculate(b, a, s);
                stack.push(c);
            } else {
                stack.push(Integer.parseInt(s));
            }
        }

        System.out.println(stack.pop());
    }

    private static boolean isOperator(String s) {
        switch (s) {
            case "+":
            case "-":
            case "*":
            case "/":
                return true;
            default:
                return false;
        }
    }

    private static int calculate(int a, int b, String op) {
        switch (op) {
            case "+":
                return a + b;
            case "-":
                return a - b;
            case "*":
                return a * b;
            case "/":
                return a / b;
            default:
                return 0;
        }
    }
}

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

using ll = long long;

constexpr ll MOD = 1e9+7;
constexpr ll INF = 1ll<<60;

#define FOR(i,a,b) for (ll i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()

int main(int argc, char **argv)
{
	ll N; cin >> N;
	N %= 10;
	if (N == 3)
		std::cout << "bon" << std::endl;
	else if (N == 0 || N == 1 || N == 6 || N == 8)
		std::cout << "pon"<< std::endl;
	else
		std::cout << "hon" << std::endl;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
 
#define PI acos(-1)
#define hell 1000000007
#define HELL 998244353
#define io ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define fix(n) cout << fixed << setprecision(n)
#define mset(a,n) memset(a,n,sizeof a)
#define rep(i,a,b) for (__typeof((b)) i=(a);i<(b);i++)
#define repp(i,a,b,p) for(__typeof((b)) i=(a);i<(b);i+=p)
#define ren(i,a,b) for(__typeof((a)) i=(a);i>=(b);i--)
#define renn(i,a,b,p) for(__typeof((a) i=(a);i>=(b);i-=p)
#define lbd lower_bound
#define ubd upper_bound
#define ll long long
#define ld long double
#define pb push_back
#define fi first
#define se second
#define vll vector<ll>
#define pll pair<ll,ll>
#define vpll vector<pll>
#define all(v) (v).begin(), (v).end()
#define sz(x) (ll)x.size()
#define endl "\n"
#define out(n) cout<<n<<" "
#define outl(n) cout<<n<<endl
#define line cout<<endl
#define bug(n) {outl(n);return;}
#define N 1005
ll a,b;
void solve(){
	cin>>a;
	for(int i=1;i<10;i++){
	    if(a%i==0&&a/i<10)bug("Yes");
	}
	bug("No");
}
void prep(){
	
}
int main(){
    io;
    ll t=1;
    // cin>>t;
    prep();
    fix(12);
    while(t--)
        solve();
    return 0;
}

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

int main(){
	int n;
	cin >> n;
	int a[n];
	for(int i = 0;i < n;i++){
		scanf("%d",&a[i]);
	}
	int f = 1;
	for(int i = n - 1;i >= 1;i--){
		if(a[i] < a[i-1]) a[i-1]--;
		if(a[i] < a[i-1]){
			f = 0;
			break;
		}
	}
	if(f) cout << "Yes" << endl;
	else cout << "No" <<endl;
    return 0;
}

Measured memory_bytes: 640
#!/usr/bin/env python

import sys
input = sys.stdin.buffer.readline
sys.setrecursionlimit(10**6)
INF = float("inf")

def main():
    N = int(input())
    A = list(map(int,input().split()))

    ans = 0
    for i in range(N):
        if i%2 == 0 and A[i]%2 == 1:
            ans += 1
    
    print(ans)

if __name__ == "__main__":
    main()

Measured memory_bytes: 9232
#include<queue>
#include<cstdio>

#define	mp	make_pair

using namespace std;

struct Info{
	int now,bef,sp;
	Info(int _now,int _bef,int _sp){
		now=_now;
		bef=_bef;
		sp=_sp;
	}
};

bool operator<(const Info &i1,const Info &i2){
	return true;
}

int main(){
	for(int n,m;scanf("%d%d",&n,&m),n;){
		static int adj[30][30],lim[30][30];
		for(int i=0;i<n;i++)for(int j=0;j<n;j++)	adj[i][j]=-1;

		int s,g;	scanf("%d%d",&s,&g);
		s--,g--;
		for(int i=0;i<m;i++){
			int x,y,d,l;	scanf("%d%d%d%d",&x,&y,&d,&l);
			x--,y--;
			adj[x][y]=adj[y][x]=d;
			lim[x][y]=lim[y][x]=l;
		}

		static bool visited[30][30][31];
		static double tmin[30][30][31];
		for(int i=0;i<n;i++)for(int j=0;j<n;j++)for(int k=0;k<=30;k++){
			visited[i][j][k]=false;
			tmin[i][j][k]=1<<30;
		}

		tmin[s][s][0]=0;
		double ans=-1;
		priority_queue< pair<double,Info> > pq;	pq.push(mp(0,Info(s,s,0)));
		while(!pq.empty()){
			pair<double,Info> a=pq.top();	pq.pop();
			int u=a.second.now,bef=a.second.bef,sp=a.second.sp;
			if(visited[u][bef][sp])	continue;
			visited[u][bef][sp]=true;
			if(u==g && sp==1){
				ans=tmin[u][bef][sp];
				break;
			}

			for(int v=0;v<n;v++){
				if(adj[u][v]==-1 || v==bef)	continue;
				for(int dv=-1;dv<=1;dv++){
					int nextsp=sp+dv;
					if(1<=nextsp && nextsp<=lim[u][v]){
						double nextt=tmin[u][bef][sp]+(double)adj[u][v]/nextsp;
						if(nextt<tmin[v][u][nextsp]){
							pq.push(mp(-nextt,Info(v,u,nextsp)));
							tmin[v][u][nextsp]=nextt;
						}
					}
				}
			}
		}

		if(ans<0)	puts("unreachable");
		else		printf("%f\n",ans);
	}

	return 0;
}

Measured memory_bytes: 1600
N, M = map(int, input().split())
lst = [list(map(int, input().split())) for _ in range(M)]

ans = [10] * N
for l in lst:
    if ans[l[0]-1] < 10 and ans[l[0]-1] != l[1]:
        print(-1)
        exit()
    ans[l[0]-1] = l[1]

if ans[0] == 10:
    if N == 1:
        ans[0] = 0
    else:
        ans[0] = 1
for i in range(1, N):
    if ans[i] == 10:
        ans[i] = 0

if N != 1 and ans[0] == 0:
    print(-1)
    exit()

ans = list(map(str, ans))
print("".join(ans))

Measured memory_bytes: 9164
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();

		for(int i = 1;i < 10;i++){
			for(int j = 1;j < 10;j++){
				if(a == i * j){
					System.out.println("Yes");
					return;
				}
			}
		}
		System.out.println("No");
	}

}


Measured memory_bytes: 23508
#import sys
MOD = 10 ** 9 + 7
INFI = 10**10
#input = sys.stdin.readline
import math
from collections import deque
import itertools
import heapq
#import bisect
from fractions import Fraction
import copy
from functools import lru_cache
from collections import defaultdict
import pprint

#oo=list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
# ko=list("abcdefghijklmnopqrstuvwxyz")

def sosuhante(n):
    for k in range(2, int(math.sqrt(n))+1):
        if n% k ==0:
            return False
    return True
def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

def kingaku(a,b,n):
    keta=len(str(n))
    return a*n+b*keta

def my_index(l, x, default=False):
    if x in l:
        return l.index(x)
    else:
        return default

#    h,w,a,b = map(int, input().split())
#    c = [[0 for j in range(n)] for i in range(n)]

def ret(a):
    c=[None]*(len(a)-1)
    if len(a)==1:
        return a[0]
    elif len(a)==0:
        return 0
    for i in range(1,len(a)):
        c[i-1]=abs(a[i]-a[i-1])
    return ret(c)

def soinsubunkai(n):
    a = []
    i = 1
    while i*i <= n:
        if n % i == 0 and i!=1:
            a.append(i)
            n=n//i

        if n% i !=0 or i==1:
            i += 1
    nokori=[n]
    return a + nokori

def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]

def main():
    h,w,k2=map(int,input().split())
    c=[]
    for i in range(h):
        temp=list(input())
        c.append(temp)

    for i in range(h):
        for j in range(w):
            if c[i][j]==".":
                c[i][j]=0
            else:
                c[i][j]=1
#    print(c)
    count=0
    orig=copy.deepcopy(c)
    for i in itertools.product(range(2),repeat=h):
        for j in itertools.product(range(2), repeat=w):
            c=copy.deepcopy(orig)
            for l in range(h):
                for k in range(w):
                    if i[l]==1:
                        c[l][k]=0
                    if j[k]==1:
                        c[l][k]=0
            temp=0
            for l in range(h):
                temp+=sum(c[l])
            if temp==k2:
                count+=1
    print(count)


if __name__ == "__main__":

    main()

Measured memory_bytes: 77800
import sys


def check(newLine, index, row, col):
    count = 0

    # 左と右
    if index % col != 0:  # 0列でない
        if newLine[index - 1] == "#":
            count += 1
    if index % col != col - 1:  # 末列でない
        if newLine[index + 1] == "#":
            count += 1
    # 上と下
    if index >= col:  # 首行でない
        if newLine[index - col] == "#":
            count += 1
    if index < col * (row - 1):  # 末行でない
        if newLine[index + col] == "#":
            count += 1

    # 上の左と右 0 <= index + col + 1 < len(newLine) and
    if index >= col and index % col != 0:  # 首行でない かつ　0列でない
        if newLine[index - col - 1] == "#":
            count += 1
    if index >= col and index % col != col - 1:  # 首行でない かつ　末列でない
        if newLine[index - col + 1] == "#":
            count += 1
    # 下の左と右
    if index < col * (row - 1) and index % col != 0:
        if newLine[index + col - 1] == "#":
            count += 1
    if index < col * (row - 1) and index % col != col - 1:
        if newLine[index + col + 1] == "#":
            count += 1

    newLine[index] = str(count)
    return newLine


def main(row, col, lines):
    for index, value in enumerate(lines):
        if value == ".":
            lines = check(lines, index, row, col)
    for i in range(0, len(lines), col):
        print("".join(lines[i:i + col]))


if __name__ == '__main__':
    row, col = map(int, input().split())
    lines = list("".join(list(str(input()) for i in range(row))))
    main(row, col, lines)


Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL)
int main()
{
    fast;
    int n,k;cin>>n>>k;
    int a[n];
    for(int i=0;i<n;i++)cin>>a[i];
    int dp[n]{0};
    for(int i=n-2;i>=0;i--)
    {
        int v=INT_MAX;
        for(int j=i+1;j<=min(n-1,i+k);j++)
            v=min(v,abs(a[i]-a[j])+dp[j]);
        dp[i]=v;
    }
    cout<<dp[0]<<endl;
    return 0;
}


Measured memory_bytes: 1024