akhauriyash/Code-Regression huggingface dataset:
# from itertools import accumulate, permutations, combinations, combinations_with_replacement, groupby, product
# import math
import numpy as np
import sys
sys.setrecursionlimit(10 ** 5 + 10)
# input = sys.stdin.readline

def resolve():

    G=np.array([list(map(int,input().split())) for _ in range(3)])
    G[1]-=G[0]
    G[2]-=G[0]
    if len(set(G[1]))==1 and len(set(G[2]))==1:
        print('Yes')
    else:
        print('No')


resolve()

Measured memory_bytes: 12512
#include <iostream>
#include <string>
#include <queue>
#include <utility>
#include <algorithm>
#include <numeric>
#include <set>
#include <climits>
#include <map>

using namespace std;

long long a[2000];
long long min_a_cost[2000];
int main(){
  int N;
  long long x;
  cin >> N >> x;
  for(int i = 0; i < N; i++){
    cin >> a[i];
    min_a_cost[i] = a[i];
  }

  long long ans = LLONG_MAX;
  for(int i = 0; i < N; i++){
      for(int j = 0; j < N; j++){
        min_a_cost[j] = min(min_a_cost[j], a[((j - i) % N + N) % N]);
      }
      long long tmp_ans = accumulate(min_a_cost, min_a_cost + N, (long long) 0) + (long long) i * x;
      ans = min(ans, tmp_ans);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.*;

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

		String s = sc.nextLine();
		
		System.out.print(String.valueOf(s.charAt(0)) + (s.length()-2) + String.valueOf(s.charAt(s.length()-1)));
		
		sc.close();
	}
}

Measured memory_bytes: 23764
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,x,y,t;
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        cin>>t>>x>>y;
        if(t<x+y||(t-x-y)%2==1)
        {
            cout<<"No"<<endl;
            return 0;
            
        }
    }
    cout<<"Yes"<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include<cstdlib>
#include<queue>
#include<set>
#include<vector>
#include<string>
#include<algorithm>
#include<stack>
#include<map>
#include<cstdio>
using namespace std;
#define rep(i,a) for(int i=0;i<a;i++)
#define mp make_pair
#define pb push_back
#define P pair<int,int>
#define ll __int64
//#define ll long long
int n;
int a[111111];
map<int,int>t;

int main(){
	cin>>n;
	rep(i,n)cin>>a[i];
	rep(i,n){t[a[i]]++;}
	int ans=0;	
	for(map<int,int>::iterator i=t.begin();i!=t.end();i++){
		int a=(*i).first,b=(*i).second;
		if(a>b){
			ans+=b;	
		}
		else if(b>a)ans+=b-a;

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


Measured memory_bytes: 5120
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
#define REP(var, a, b) for (int var = (a); var < (b); var++)
#define rep(var, n) for (int var = 0; var < (n); ++var)
#define ALL(c) (c).begin(), (c).end()
#define rALL(c) (c).rbegin(), (c).rend()
ll MOD = 1000000007;
const ll INF = 1LL << 62;
int main() {
  //
  ll n;
  cin >> n;
  vl a(3 * n);
  rep(i, 3 * n) { cin >> a[i]; }
  vl fsum(3 * n, 0), ssum(3 * n, 0);
  priority_queue<ll, vl, greater<ll>> first;
  priority_queue<ll> second;
  ll firstsum = 0;
  rep(i, n) {
    first.push(a[i]);
    firstsum += a[i];
  }
  fsum[n - 1] = firstsum;
  // cerr << firstsum << endl;
  for (int i = n; i <= 2 * n; i++) {
    first.push(a[i]);
    ll remove = first.top();
    first.pop();
    firstsum = firstsum + a[i] - remove;
    fsum[i] = firstsum;
  }
  ll secondsum = 0;
  for (int i = 3 * n - 1; i >= 2 * n; i--) {
    secondsum += a[i];
    second.push(a[i]);
  }
  ssum[2 * n] = secondsum;
  for (int i = 2 * n - 1; i >= n; i--) {
    second.push(a[i]);
    ll remove = second.top();
    second.pop();
    secondsum = secondsum + a[i] - remove;
    ssum[i] = secondsum;
  }
  // rep(i, 3 * n) { cerr << sum[i] << " "; }
  // cerr << endl;
  // rep(i, 3 * n) { cerr << fsum[i] << " "; }
  // cerr << endl;
  // rep(i, 3 * n) { cerr << ssum[i] << " "; }
  // cerr << endl;
  ll ans = fsum[n - 1] - ssum[n];
  for (int i = n + 1; i <= 2 * n; i++) {
    // ll f = sum[i - 1] - fsum[i - 1];
    // ll s = sum[3 * n - 1] - sum[i - 1] - ssum[i];
    ans = max(ans, fsum[i - 1] - ssum[i]);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 9588
#include<bits/stdc++.h>
using namespace std;
 
int calc(int x){
  int ret = 0;
  while(x % 100 == 0){
    x /= 100;
    ret++;
  }
  return ret;
}
 
int main(){
  int D , N ;
  cin >> D >> N;
  int cnt =0,val =0;
  while(cnt < N){
    ++val;
    if(calc(val) == D) ++cnt;
  }
  cout << val << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define LL long long
#define sigma_size 30
#define max_size (int)(1e6+50)
#define MAX (int)(1e5+7)
int qread()
{
	char c; int s=0,t=1; while ((c=getchar())<'0' || c>'9') (c=='-' && (t=-1));
	do s=s*10+c-'0'; while ((c=getchar())>='0' && c<='9'); return s*t;
}

int mark[max_size];
LL pri[max_size] , cnt = 1;
void get_pri()
{
	for ( int i = 2 ; i < 1e6+10 ; i++ )
	{
		if ( !mark[i] ) pri[cnt++] = i;
		for ( int j = 1 ; j <= cnt && i*pri[j] < 1e6+10 ; j++ )
		{
			mark[i*pri[j]] = 1;
			if ( i % pri[j] == 0 ) break;
		}
	}
}



int main ()
{
	LL A , B ;
	cin >> A >> B ;
	get_pri();
	LL g = __gcd ( A , B );
	int cnt = 1;
	for ( int i = 1 ; pri[i]*pri[i] <= g ; i++ )
	{
		if ( g % pri[i] ) continue;
		cnt++;
		while ( g % pri[i] == 0 )	g /= pri[i];
	}
	if ( g > 1 ) cnt++;
	cout << cnt << endl;
}

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

#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;

typedef long long ll;

const int INF = 1 << 30;
const ll LLINF = 1LL << 60;

int mod = 1000000007;

int main(void){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N; cin >> N;
    bool ok = true;
    int pret=0,prex=0,prey=0;
    rep(i, N){
        int t, x, y; cin >> t >> x >> y;
        int need_time = abs(prex-x) + abs(prey-y);
        if(t-pret < need_time || (t-pret-need_time) % 2 == 1) ok = false;
        pret = t; prex = x; prey = y;
    }

    if(ok) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdint>

int const MAXN=100;
int const MAXW=100000;

int N, W;

uint32_t w[MAXN];
uint64_t v[MAXN];

uint64_t dp[MAXN+1][MAXW+1];

int main() {
  std::cin >> N >> W;
  for(int i = 0; i < N; ++i) std::cin >> w[i] >> v[i];

  for(int i = 0; i <= W; ++i) dp[0][i] = 0;
  for(int i = 0; i < N; ++i) {
    for(int ww = 0; ww < w[i]; ++ww) dp[i+1][ww] = dp[i][ww];
    for(int ww = w[i]; ww <= W; ++ww) {
      dp[i+1][ww] = std::max(dp[i][ww], dp[i][ww-w[i]]+v[i]);
    }
  }
  std::cout << dp[N][W] << std::endl;
  return 0;
}


Measured memory_bytes: 79104
n = int(input())
r = [int(input()) for i in range(n)]
start = r[0]
score = r[1] - r[0]
for i in range(1,n):
    if r[i] - start > score: 
        score = r[i] - start
    if r[i] < start: 
        start = r[i]
print(score)



Measured memory_bytes: 13596
#pragma GCC optimize("O3")
#include<bits/stdc++.h>
#define rc(x) return cout<<x<<endl,0
#define pb push_back
#define in insert
#define er erase
#define fd find
#define fr first
#define sc second
typedef long long ll;
const ll INF=0x3f3f3f3f3f3f3f3f;
const ll llinf=(1LL<<61);
const int inf=(1<<30);
const int nmax=2e5+50;
const int mod=1e9+7;
using namespace std;
int n,i;
ll ans,a[nmax];
int main()
{
	//freopen("sol.in","r",stdin);
	//freopen("sol.out","w",stdout);
	ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0);
	cin>>n;
	for(i=1;i<=n;i++)
	{
		cin>>a[i];
		if(a[i] && i==1)rc(-1);
		if(a[i]>n-1)rc(-1);
		if(a[i]-a[i-1]>1 && i>1)rc(-1);
	}
	for(i=2;i<=n;i++)
	{
		if(a[i]==a[i-1]+1)ans++;
		else ans+=a[i];
	}
	cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,n-1,0)
#define all(v) v.begin(), v.end()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n; cin >> n;
  vector<ll> L(n+1);
  L[0] = 2, L[1] = 1;
  for(int i=2; i<=n; i++) L[i] = L[i-1] + L[i-2];
  cout << L[n] << "\n";
  return 0;
}


Measured memory_bytes: 3640
#include<iostream>
#include<string>
#include<map>

int main(){
    int N, L;
    std::cin >> N >> L;
    std::map<std::string, int> mp;
    for(int i = 0; i < N; i++){
        std::string S;
        std::cin >> S;
        mp[S]++;
    }

    
    for(auto s : mp){
        for(int i = 0; i < s.second; i++){
            std::cout << s.first;
        }
    }

    std::cout << std::endl;
    return 0;
}


Measured memory_bytes: 256
int main(void){
    int n, i, *h;
    scanf("%d", &n);
    h = calloc(n, sizeof(int));
    for ( i = 0; i < n; i++ ) {
        scanf("%d", &h[i]);
    }

    int highest = 0, ans = 0;
    for ( i = 0; i < n; i++ ) {
        if ( h[i] >= highest ) {
            highest = h[i];
            ans++;
        }
    }
    printf("%d\n", ans);
    free(h);
    return 0;
}

Measured memory_bytes: 128
c=[list(map(int,input().split())) for _ in range(3)]

ans = "Yes"
for i in range(2):
    # print("i =",i)
    if c[0][i] - c[0][i+1] != c[1][i] - c[1][i+1]:
        # print("check1")
        # print(c[0][i], "-", c[0][i+1], "!=", c[1][i], "-", c[1][i+1])
        ans = "No"
    elif c[1][i] - c[1][i+1] != c[2][i] - c[2][i+1]:
        # print("check2")
        # print(c[1][i], "-", c[1][i+1], "!=", c[2][i], "-", c[2][i+1])
        ans = "No"
    elif c[i][0] - c[i+1][0] != c[i][1] - c[i+1][1]:
        # print("check3")
        # print(c[i][0], "-", c[i+1][0], "!=", c[i+1][1], "-", c[i+1][1])
        ans = "No"
    elif c[i][1] - c[i+1][1] != c[i][2] - c[i+1][2]:
        # print("check4")
        # print(c[i][1], "-", c[i+1][1], "!=", c[i+1][2], "-", c[i+1][2])
        ans = "No"
print(ans)

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

int main(){
    int A, B;
    cin >> A >> B;

    int res = 0;

    for(int num = A; num <= B; ++num){
        int digits[5];
        int num_tmp = num;

        for(int i = 0; i < 5; ++i){
            digits[i] = num_tmp % 10;
            num_tmp /= 10;
        }
        if(digits[0] == digits[4] and digits[1] == digits[3]) res++;
    }

    cout << res << endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
 
typedef long long ll;
#define int ll
#define fi first
#define se second
#define SORT(a) sort(a.begin(),a.end())
#define rep(i,n) for(int i = 0;i < (n) ; i++) 
#define REP(i,n) for(int i = 0;i < (n) ; i++) 
#define MP(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define INF LLONG_MAX/2
#define all(x) (x).begin(),(x).end()
#define debug(x) cerr<<#x<<": "<<x<<endl
#define debug_vec(v) cerr<<#v<<":";rep(i,v.size())cerr<<" "<<v[i];cerr<<endl
using namespace std;
int MOD = 1000000007;
    
signed main(){
    int n,k;
    cin >> n >> k;
    int v[51];
    rep(i,n)cin >> v[i];
    int l[51] = {0},r[51] = {0};
    rep(i,n){
        l[i+1] = l[i] + v[i];
        r[i+1] = r[i] + v[n-1-i];
    }
    int ans = 0;
    rep(i,min(k,n)+1){
        rep(j,i+1){
            vector<int> g;
            rep(t,j)g.pb(v[t]);
            rep(t,i-j)g.pb(v[n-1-t]);
            SORT(g);
            int res = 0;
            rep(t,i){
                if(t <= k-i-1 && g[t] < 0)res += 0;
                else res += g[t];
            }
            ans = max(res,ans);
        }   
    }
    cout << ans << endl;
    

    
    return 0;
}

// g++ -std=c++14 code1.cpp
// rm -r -f test;oj dl https://cf17-final-open.contest.atcoder.jp/tasks/cf17_final_a
// rm -r -f test;oj dl http://abc128.contest.atcoder.jp/tasks/abc128_a

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define fi first
#define se second
#define PI (acos(-1))

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;
}
template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){
	int len=d.size();
	rep(i,len){
		s<<d[i];if(i<len-1) s<<" ";
	}
	return s;
}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){
	int len=d.size();
	rep(i,len){
		s<<d[i]<<endl;
	}
	return s;
}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){
	s<<"{ ";
	for(auto itr=v.begin();itr!=v.end();++itr) {
		if (itr!=v.begin()) {s<< ", ";}
		s<<(*itr);
	}
	s<<" }";
	return s;
}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){
	s<<"{"<<endl;
	for(auto itr=m.begin();itr!=m.end();++itr){
		s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;
	}
	s<<"}"<<endl;
	return s;
}

const ll mod=1e9+7;
const ll inf=1e15;
const int INF=1e9;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin>>n;
	vector<vector<int>> dp(n+1,vector<int>(3,0));
	vector<int> now(3);
	rep(i,n){
		rep(j,3) cin>>now[j];
		rep(j,3){
			chmax(dp[i+1][j],dp[i][(j+1)%3]+now[j]);
			chmax(dp[i+1][j],dp[i][(j+2)%3]+now[j]);
		}
	}
	cout<<max({dp[n][0],dp[n][1],dp[n][2]})<<endl;
}

Measured memory_bytes: 5760
from collections import deque
h,w=map(int,input().split())
ch,cw=map(lambda x:int(x)-1,input().split())
dh,dw=map(lambda x:int(x)-1,input().split())
tizu=[]
d=deque()
d.appendleft([ch,cw])
cost=[[-1 for i in range(w)]for j in range(h)]
dx=[1,0,-1,0,-2,-2,-2,-2,-2,-1,-1,-1,-1,0,0,1,1,1,1,2,2,2,2,2]
dy=[0,1,0,-1,-2,-1,0,1,2,-2,-1,1,2,-2,2,-2,-1,1,2,-2,-1,0,1,2]
for i in range(h):
    tizu.append(input())
cost[ch][cw]=0
while(d):
    x,y=d.popleft()
    for i in range(4):
        nx=x+dx[i]
        ny=y+dy[i]
        ####行ったことある、かつ、コストが手前より高い
        if(nx<0 or ny<0 or nx>=h or ny>=w):
            continue
        if(cost[nx][ny]>-1 and cost[nx][ny]<=cost[x][y]):
            continue
        if(tizu[nx][ny]=='.'):
            cost[nx][ny]=cost[x][y]
            d.appendleft([nx,ny])
    
    for i in range(4,24):
        nx=x+dx[i]
        ny=y+dy[i]
        if(nx<0 or ny<0 or nx>=h or ny>=w):
            continue
        if(cost[nx][ny]>-1):
            continue
        if(tizu[nx][ny]=='.'):
            cost[nx][ny]=cost[x][y]+1
            d.append([nx,ny])

print(cost[dh][dw])

Measured memory_bytes: 95392
#include <stdio.h>
int main(void){
    int i,n,x;
      
    scanf("%d",&n);
      
    for(i=1;i<=n;i++){
        x=i;
        if(x%3==0){
            printf(" %d",i);
        }else if(x%10==3){
            printf(" %d",i);
        }else{
            while(1){
                x/=10;
                if(x==0) break;
                if(x%10==3){
                    printf(" %d",i);
                    break;
                }
            }
        }
    }
    printf("\n");
    return 0;
}


Measured memory_bytes: 2064
#include "bits/stdc++.h"
using namespace std;
class CMyCalc
{
private:
    int number[100];
    int len;
public:
    CMyCalc()
    {
        memset(number,0,sizeof(number));
        len=0; 
    }
    CMyCalc(int n[],int l)
    {
        int i;
        memset(number,0,sizeof(number)); 
        for(i=0;i<l;i++)
            number[l-i-1]=n[i];
        len=l; 
    }
    CMyCalc(char n[])
    {
        int i,l=strlen(n);
        memset(number,0,sizeof(number)); 
        for(i=0;i<l;i++)
            number[l-i-1]=n[i]-'0';
        len=strlen(n);
    }
    CMyCalc operator +(const CMyCalc& n)
    {
        int i,t,c=0,l=0;
        CMyCalc tmp;
        l=(len>n.len?len:n.len);
        for(i=0;i<l;i++)
        {
            t=number[i]+n.number[i]+c;
            tmp.number[i]=t%10;
            c=t/10;
        }
        tmp.len=i;
        if(c!=0)
        {
            tmp.number[i]=c;
            tmp.len++;
        }
        return tmp;
    } 
    CMyCalc operator *(const CMyCalc& num)
    {
		CMyCalc c;  
		c.len = len + num.len;  
		for(int i = 0; i < len; i++)  
		{  
		    for(int j = 0; j < num.len; j++)  
		    {  
		        c.number[i+j] += number[i] * num.number[j];  
		    }  
		}  
		for(int i = 0; i < c.len; i++)  
		{  
		    c.number[i+1] += c.number[i]/10;  
		    c.number[i] %= 10;  
		}  
		while(c.len>1&&!c.number[c.len-1]) 
		{
		     c.len--;
		}    
		return c;
    }
    bool operator < (const CMyCalc &b)  
    {  
		int i;
        if(len!=b.len)
		{
			return len<b.len;
		}  
        for(i=len-1;i>=0;i--)  
        {  
            if(number[i]!=b.number[i])
			{
				return number[i]<b.number[i];
			}  
        }  
        return false;  
    }
    bool operator > (const CMyCalc &b)  
    {  
        if(len != b.len) return len > b.len;  
        for(int i = len-1; i >= 0; i--)  
        {  
            if(number[i] != b.number[i]) return number[i] > b.number[i];  
        }  
        return false;  
    }  
    bool operator == (const CMyCalc &b)  
    {  
        return !(*this > b) && !(*this < b);  
    }  
    bool operator <= (const CMyCalc &b)  
    {  
        return *this<b||*this==b;  
    }  
    void Display()
    {
        int i;
        for(i=len-1;i>=0;i--)
        {
            printf("%d",number[i]); 
		}
		printf("\n");
    }
}; 
int main()
{
	int count=0;
	char str1[20]={'\0'},str2[20]={'\0'};
	scanf("%s %s",str1,str2);
    CMyCalc x(str1),y(str2); 
    while(x<=y)
    {
		//x.Display();
		x=x*CMyCalc("2");
		count++;
	}
	printf("%d\n",count);
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<cmath>

using namespace std;

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

    int cnt = 0;
    for(int i=1;i<=n;i++){
        string s_num = to_string(i);
        int length = s_num.length();

        bool f_7,f_5,f_3;
        f_7 = f_5 = f_3 = false;
        for(int j=0;j<length;j++){
            if(s_num.at(j)=='7')f_7 = true;
            else if(s_num.at(j)=='5')f_5 = true;
            else if(s_num.at(j)=='3')f_3 = true;
            else{
                i += (int)powl(10,length-1-j) - 1;
                break;
            }

            if((j==length-1)&&f_7&&f_5&&f_3)cnt++;
        }
    }

    cout << cnt << endl;

    return 0;
}

Measured memory_bytes: 384
n, m, x = map(int,input().split())
l = [list(map(int,input().split())) for i in range(n)]

def generate_n_bit(n):
    bins= []
    for i in range(2**n):
        bins.append(list(str(format(i,'b').zfill(n))))
    
    return bins

min_price = 10**9
bins = generate_n_bit(n)
bins = bins[1:]

for bin in bins:
    a = [0 for k in range(m)]
    price = 0
    for i in range(n):
        if bin[i] == '1':
            for j in range(m):
                a[j] += l[i][j+1]
            
            price += l[i][0]
    
   
    
    if min(a) >= x:
        min_price = min(price, min_price)
        

if min_price == 10**9:
    print(-1)
    exit()
    
print(min_price)

Measured memory_bytes: 9656
#include<stdio.h>
int main(){
int H=1,W=1,i=1,s=1,w=1;
 while(w == 1){
    scanf("%d%d",&H,&W);
    if(H == 0 && W == 0)break;
    for(i=0;i<W-1;i++)printf("#");
    printf("#\n");
    for(s=0;s<H-2;s++){ printf("#");
      for(i=0;i<W-2;i++)printf(".");
      printf("#\n");}
    for(i=0;i<W-1;i++)printf("#");
    printf("#\n");
printf("\n");}

  
  
  return 0;

}

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

using namespace std;

typedef pair <int, int> pii;

const int maxn = 1e5 + 10;
int n, a[maxn], cnt[maxn];
pii p[maxn], val[2][2];

int main(){
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	cin >> n;
	for (int i = 0; i < n; ++i)
		cin >> a[i];
	for (int i = 0; i < 2; ++i) {
		memset(cnt, 0, sizeof(cnt));
		for (int j = i; j < n; j += 2)
			cnt[a[j]]++;
		for (int j = 0; j < maxn; ++j)
			p[j] = {cnt[j], j};
		sort(p, p + maxn);
		reverse(p, p + maxn);
		for (int j = 0; j < 2; ++j)
			val[i][j] = p[j];
	}
	int ans = 0;
	for (int i = 0; i < 2; ++i)
		for (int j = 0; j < 2; ++j)
			if (val[0][i].second != val[1][j].second)
				ans = max(ans, val[0][i].first + val[1][j].first);
	ans = n - ans;
	cout << ans << '\n';
	return 0;
}


Measured memory_bytes: 1792
#include<stdio.h>
int main(void)
{
    int W=0,H=0,x=0,y=0,r=0;
    scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);
    if (x<r){
        puts("No");
    }
    else if (y<r){
        puts("No");
    }
    else if (W-r<x){
        puts("No");
    }
    else if (H-r<y){
        puts("No");
    }
    else{
        puts("Yes");
    }
    return 0;

}

Measured memory_bytes: 584
#include<bits/stdc++.h>
using namespace std;
const int inf = 1e9 + 7;
typedef long long ll;
using pii = pair<int, int>;
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rrep(i, st, n) for (int i = st; i < n; ++i)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
int dx[] = {0, 0, -1, 1};
int dy[] = {1, -1, 0, 0};
int main() {
    int n, m; cin >> n >> m;
    map<int, int> mp;
    rep(i, n) {
        int tmp; cin >> tmp;
        mp[tmp]++;
    }
    rep(i, m) {
        int b, c; cin >> b >> c;
        mp[c] += b;
    }
    ll cnt = 0;
    ll ans = 0;
    for (auto it = mp.end(); it != mp.begin(); --it) {
        if (it == mp.end()) continue;
        //cout << (*it).first << " " << (*it).second << endl;
        if (cnt + (*it).second <= n) {
            cnt += (*it).second;
            ans += (ll)(*it).first * (*it).second;
        } else {
            ans += (ll)(n - cnt) * (*it).first;
            cnt = n;
            break;
        }
        //cout << ans << endl;
    }
    auto it = mp.begin();
    //cout << cnt << endl;
    if (cnt < n) {
        ans += (ll)(n - cnt) * (*it).first;
    }
    cout << ans << endl;
}




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

int gcd(int a, int b) {
  int v0 = a, v1 = b, v2 = a % b;
  while (v2 != 0) {
    v0 = v1;
    v1 = v2;
    v2 = v0 % v2;
  };
  return v1;
}

int main() {
  int N,sum,i,j,k;
  cin >> N;
  sum = 0;
  for (i = 1;i <=N;i++) {
    for (j = 1;j <= N;j++) {
      for (k = 1;k <= N;k++) {
        sum += gcd(gcd(j,k),gcd(i,j));
      }
    }
  }
  cout << sum << endl;
}

Measured memory_bytes: 3608
import sys
input = sys.stdin.readline


def main():
    M1, D1 = [int(x) for x in input().split()]
    M2, D2 = [int(x) for x in input().split()]

    if M1 != M2:
        print(1)
    else:
        print(0)

if __name__ == '__main__':
    main()



Measured memory_bytes: 2940
#include <stdio.h>
#include <stdlib.h>
int main()
{
    int N,M,i,j,num[50];
    long int a[50],b[50],c[50],d[50],min[50]={},dis;
    scanf("%d %d",&N,&M);
    for(i=0;i<N;i++) scanf("%ld %ld",&a[i],&b[i]);
    for(i=0;i<M;i++){
        scanf("%ld %ld",&c[i],&d[i]);
        for(j=0;j<N;j++){
            dis=labs(a[j]-c[i])+labs(b[j]-d[i]);
            if (i==0) {
                min[j]=dis;
                num[j]=i;
            }
            else if(min[j]>dis){
                min[j]=dis;
                num[j]=i;
            }
        }
    }
    for(i=0;i<N;i++) printf("%d\n",num[i]+1);
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std ;
using V_2 = vector<vector<int>> ;
using ll = long long ;

int N ;

int main(){
  int count = 0 ;
  cin >> N ;
  int L[N] ;
  for(int i = 0 ; i < N ; i++) cin >> L[i] ;

  for(int i = 0 ; i < N ; i++){
    for(int j = i + 1 ; j < N ; j++){
      if(L[i] == L[j]) continue ;
      for(int k = j + 1 ; k < N ; k++){
        if(L[i] == L[k] || L[j] == L[k]) continue ;
        int len = L[i] + L[j] + L[k] ;
        int max_l = max(L[i],max(L[j],L[k])) ;
        if(len - max_l > max_l) count = count + 1 ;
        //cout << L[i] << " " << L[j] << " " << L[k] << " " << count << endl ;
      }
    }
  }
  cout << count << endl ;
}

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

int main() {
int A,B;
  cin >> A >> B;
  int count = 0;
  for(int i = 1; i <= 2000; i++){
	if(i * 8 / 100 == A && i / 10 == B){
    	cout << i << endl;
      count++;
      break;
    }
  }
  if(count == 0){
  cout << -1 << endl;
  }
}

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

using ll = long long;
using vi = vector<int>;

#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
#define PB push_back

struct edge{int to;};
using graph = vector<vector<edge>>;

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

    ll a, b, n;
    cin >> a >> b >> n;

    ll n1 = min(b - 1, n);

    cout << (a * n1) / b - a * (n1 / b) << endl;
    
    
}


Measured memory_bytes: 3640
#include<cstdio>
#define mod 1000000007
typedef long long ll;
using namespace std;

ll dp[1001][1001],kai[1001],inv[1001];

ll gyaku(ll x){
    ll res=1;
    ll y=x;
    for(int i=0;i<30;i++){
        if(((1<<i)&(mod-2))){
            res*=y;
            res%=mod;
        }
        y=y*y;
        y%=mod;
    }
    return res;
}

int main(){
    int n,a,b,c,d;
    ll x,y;
    scanf("%d %d %d %d %d",&n,&a,&b,&c,&d);
    kai[0]=1;
    for(int i=1;i<=n;i++){
        kai[i]=kai[i-1]*i;
        kai[i]%=mod;
    }
    inv[n]=gyaku(kai[n]);
    for(int i=n-1;i>=0;i--){
        inv[i]=inv[i+1]*(i+1);
        inv[i]%=mod;
    }
    dp[0][0]=1;
    for(int i=1;i<=b;i++){
        for(int j=0;j<=n;j++){
            dp[i][j]=dp[i-1][j];
            if(i>=a){
                y=1;
                for(int k=1;k<c;k++){
                    y*=inv[i];
                    y%=mod;
                }
                for(int k=c;k<=d&&j-k*i>=0;k++){
                    y*=inv[i];
                    y%=mod;
                    x=dp[i-1][j-i*k]*kai[n-j+i*k];
                    x%=mod;
                    x*=inv[n-j];
                    x%=mod;
                    x*=y;
                    x%=mod;
                    x*=inv[k];
                    x%=mod;
                    dp[i][j]+=x;
                    dp[i][j]%=mod;
                }
            }
        }
    }
    printf("%lld\n",dp[b][n]);
}

Measured memory_bytes: 7936
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <unordered_map>
#include <vector>
#include <string.h>
#include <set>

using namespace std;

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

template<class T> void printvec(const vector<T>& v) {
  for (auto x : v) { cout << x << " "; }
  cout << endl;
}
template<class T> void printtree(const vector< vector<T> >& tree) {
  for (long long i = 0; i < tree.size(); ++i) {
    cout << i + 1 << ": "; printvec(tree[i]);
  }
}
template<class T, class U> void printmap(const map<T, U>& mp) {
  for (auto x : mp) { cout << x.first << "=>" << x.second << endl; }
}

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; }

#define rep(i, n) for(ll i = 0; i < n; ++i)
#define all(s) s.begin(), s.end()
#define fr first
#define sc second
#define mp make_pair
#define pb push_back

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> triple;
typedef double D;

const ll INF = 1e9;
const ll MOD = 1000000007;  // 1e9 + 7

int main(int argc, char** argv) {
  cin.tie(NULL);
  cout.tie(NULL);
  ios_base::sync_with_stdio(false);
  //cout << setprecision(10) << fixed;

  ll n, k;
  cin >> n >> k;
  ll remain = n % k;

  ll ans = min(remain, k - remain);
  cout << ans << endl;
}


Measured memory_bytes: 384
def main():
    A, B, C = map(int, input().split())
    K = int(input())

    while K:
        if B <= A:
            B *= 2 
        else:
            if C <= B:
                C *= 2 
            else:
                break
        K -= 1 
    
    if B > A and C > B:
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()

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

void fnInput(vector<int>& rvnNum)
{
  string sNum;
  cin >> sNum;

  for (int i = 0; i < rvnNum.size(); i++)
    rvnNum[i] = sNum[i] - '0';
}

int fnBitFullSch(const vector<int>& cnrvnNum)
{
  for (int n = 0; n < (1 << 3); n++)
  {
    int nSum = cnrvnNum[0];
    for (int i = 0; i < 3; i++)
      if (n & (1 << i))  nSum += cnrvnNum[i + 1];
      else               nSum -= cnrvnNum[i + 1];

    if (nSum == 7)  return n;
  }
  return 7;
}
    
void fnResult(const vector<int>& cnrvnNum, int nRslt)
{
  cout << cnrvnNum[0];
  for (int i = 0; i < 3; i++)
  {
    if (nRslt & (1 << i))  cout << "+";
    else                   cout << "-";

    cout << cnrvnNum[i + 1];
  }
  cout << "=7" << endl;
}

int main()
{
  vector<int> vnNum(4);
  vector<string> vsOpe(3);
  
  fnInput(vnNum);
  int nRslt = fnBitFullSch(vnNum);
  fnResult(vnNum, nRslt);

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll mod = 1000000007;

ll r(ll x, ll y) {
  if (y == 0) return 1;
  else if (y % 2 == 0) return r(x, y/2) * r(x, y/2) % mod;
  else return x * r(x, (y-1)/2) % mod * r(x, (y-1)/2) % mod;
}


int main() {
  int n, k;
  string s;
  cin >> n >> k >> s;
  vector<int> p(1, 0);
  if (s[0] == '1') p[0]++;
  else p[0]--;
  int c = 0;
  for (int i = 1; i < n; i++) {
    if (s[i] == '0') {
      if (p[c] < 0) p[c]--;
      else {
        c++;
        p.push_back(-1);
      }
    }
    else {
      if (p[c] > 0) p[c]++;
      else {
        c++;
        p.push_back(1);
      }
    }
  }
  
  int N = p.size();
  ll sum = 0;
  int K;
  if (p[0] > 0) {
    K = 2 * k + 1;
    for (int i = 0; i < min(K, N); i++) {
      sum += max(p[i], 0 - p[i]);
    }
  }
  else {
    K = 2 * k;
    for (int i = 0; i < min(K, N); i++) {
      sum += max(p[i], 0 - p[i]);
    }
  }
  
  if (K >= N) cout << sum <<endl;
  else {
    ll M = sum;
    int end = K - 1;
    int ini = 0;
    p.push_back(0);
    p.push_back(0);
    while (end < N) {
      if (p[ini] > 0) {
        sum -= p[ini];
        ini++;
      }
      else {
        sum += p[ini];
        ini++;
        end++;
        sum -= p[end];
        end++;
        sum += p[end];
        M = max(M, sum);
      }
    }
    cout << M <<endl;
  }   
}

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

template <typename T>
void print(const T &v);

int main()
{
    int n;
    cin >> n;
    for (int k = 0; k < n; k++)
    {
        string A, B;
        cin >> A >> B;
        int a = A.size();
        int b = B.size();
        vector<vector<int>> dp(b + 1, vector<int>(a + 1, 0));
        for (int i = 0; i < b; i++)
        {
            for (int j = 0; j < a; j++)
            {
                if (B[i] == A[j])
                {
                    dp[i + 1][j + 1] = dp[i][j] + 1;
                }
                else
                {
                    dp[i + 1][j + 1] = max(dp[i][j + 1], dp[i + 1][j]);
                }
            }
        }
        cout << dp[b][a] << endl;
    }
    return 0;
}

// Use For Debug
template <typename T>
void print(T const &v)
{
    for (int i = 0; i < v.size(); i++)
    {
        if (i)
            cout << ' ';
        cout << v[i];
    }
    cout << endl;
}


Measured memory_bytes: 6868
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int n,moto;
    cin>>n>>moto;
    int num=0;
    vector<int> v(n,0);
    for(int i=0;i<n;i++){
        cin>>v[i];
    }
    sort(v.begin(),v.end());
    for(int i=0;i<n;i++){
        moto-=v[i];
        if(moto<0){
            cout<<num<<endl;
            return 0;
        }
        num++;
    }
    for(int i=0;i<n;i++){
        while(moto>=v[i]){
            moto-=v[i];
            num++;
        }
    }
    cout<<num<<endl;
}


Measured memory_bytes: 256
N, K, L, *A = map(int, open(0).read().split())

def solve(X):
    s = -1; su = 0
    R = []
    res = 0
    for t, a in enumerate(A):
        if A[t] <= X:
            R.append(t)
        if len(R) >= K:
            res += R[-K]+1
    return res >= L

left = 0; right = N
while left+1 < right:
    mid = (left + right) >> 1
    if solve(mid):
        right = mid
    else:
        left = mid
print(right)


Measured memory_bytes: 27652
#include<bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
using namespace std;
typedef long long ll;
typedef pair<int,int>P;
const double eps = 1e-8;
const int NINF = 0xc0c0c0c0;
const int INF  = 0x3f3f3f3f;
const ll  mod  = 1e9 + 7;
const ll  N = 1e6 + 5;

ll mx1=-1e18,mx2=-1e18,mx3=-1e18,mx4=-1e18,mi1=1e18,mi2=1e18,mi3=1e18,mi4=1e18;
int n;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin>>n;
    for(int i=1;i<=n;i++){
        ll x,y;cin>>x>>y;
        ll u=x+y,v=x-y;
        mx1=max(mx1,u);
        mi1=min(mi1,u);
        mx2=max(mx2,v);
        mi2=min(mi2,v);
    }
    cout<<max({mx1-mi1,mx2-mi2})<<'\n';
    return 0;
}

Measured memory_bytes: 3644
s=list(input())

n=len(s)
judge=True
for i in range(n):
    if not s[i]=="D" or s[i]=="U":

        if not i%2==1 and s[i]=="L":
            judge=False
            break
        else:
            if not i%2==0 and s[i]=="R":
                judge=False
                break
if judge==True:
    print("Yes")
else:
    print("No")



Measured memory_bytes: 3060
import math
def lcm(a, b):
    return (a*b)//math.gcd(a, b)

a, b, c, d = map(int, input().split())
ans = (b-(a-1))-(b//c-(a-1)//c)-(b//d-(a-1)//d)+(b//lcm(c,d)-(a-1)//lcm(c,d))
print(ans)

Measured memory_bytes: 9148
X, Y = map(int, input().split())

tmp = max(X, Y)
Y = min(X, Y)
X = tmp
diff = X - Y

X -= 2 * diff
Y -= diff

if X < 0 or Y < 0 or X != Y or X % 3 != 0:
    print(0)
    exit()

c = X // 3

mod = 10**9+7 #出力の制限
P = 10**6
g1 = [1, 1] # 元テーブル 階乗
g2 = [1, 1] #逆元テーブル 逆元の階乗
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, P + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )

ans = g1[2*c + diff] * g2[c + diff] * g2[c] % mod

print(ans)
# print(c, diff)


Measured memory_bytes: 122048
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define all(obj) (obj).begin(),(obj).end()
#define debug(x) cerr << #x << ": " << endl
#define rep(i,n) for(int i=0; (i)<(n); ++(i))
#define rrep(i,n) for(int i=(n); (i)>=0; --(i))
#define reps(i,s,n) for(int i=(s); (i)<(n); ++(i))
#define maxi(v) distance(v.begin(), max_element(v.begin(), v.end()))
#define mini(v) distance(v.begin(), min_element(v.begin(), v.end()))
#define maxemt(v) *max_element(v.begin(), v.end())
#define minemt(v) *min_element(v.begin(), v.end())
#define lb(v,x) v[lower_bound(v.begin(), v.end(), x) - v.begin()]
#define ub(v,x) v[upper_bound(v.begin(), v.end(), x) - v.begin()]
template<class T> inline bool print(T& x){ cout << x << endl; return true; }
template<class T> inline bool print_(T& x){ cout << x << " "; return true; }
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; }
ll gcd(ll x, ll y){
  if(y==0) return x;
  else return gcd(y, x%y);
  }
ll lcm(ll x, ll y){
  return x / gcd(x,y) * y;
}
const int INF = 1e9;
const ll llINF = 1LL<<60;
const int MOD = 1e9+7;
const double EPS = 1e-9;
int main(){
  string s; cin >> s;
  int num; cin >> num;
  int n = (int)s.size();
  vector<string> ss(n*5);
  int cnt=0;
  rep(i,5){
    rep(j,n){
      rep(k,i+1){
        if(j+k == n) break;
        ss[cnt].push_back(s[j+k]);
      }
      cnt++;
    }
  }
  sort(all(ss));
  ss.erase(unique(all(ss)), ss.end()); 
  //rep(i,5) cout << ss[i] << endl;
  cout << ss[num-1];
  
  return 0;
}


Measured memory_bytes: 1664
#include<bits/stdc++.h>
#define int long long
#define x first
#define y second
#define pb push_back

#define speed ios_base::sync_with_stdio(0);cin.tie(0);
using namespace std;

signed main()
{
    speed
    int a,b,c;cin>>a>>b>>c;
    int tot=a-b;
    cout<<max(0ll,c-tot);
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <array>
#include <vector>

class Dice{
    /* left-hand dice      right-hand dice
            +---+                +---+    
            | 1 |                | 1 |    
    +---+---+---+---+    +---+---+---+---+
    | 5 | 3 | 0 | 2 |    | 5 | 2 | 0 | 3 |
    +---+---+---+---+    +---+---+---+---+
            | 4 |                | 4 |    
            +---+                +---+    
    */
    public:
    std::array<int, 6> state;
    Dice(std::array<int, 6> d, bool isRight=false):state(d){if(isRight){int tmp=state[2];state[2]=state[3];state[3]=tmp;}}
    Dice(const Dice& d):state(d.state){}
    void RollTo(int d){
        /*
            0
            |
        2 --#-- 1
            |
            3
        */
        std::array<int, 6> tmp(state);
        switch(d){
            case 0: state[0] = tmp[4]; state[1] = tmp[0]; state[4] = tmp[5]; state[5] = tmp[1]; break;
            case 1: state[0] = tmp[3]; state[2] = tmp[0]; state[3] = tmp[5]; state[5] = tmp[2]; break;
            case 2: state[0] = tmp[2]; state[2] = tmp[5]; state[3] = tmp[0]; state[5] = tmp[3]; break;
            case 3: state[0] = tmp[1]; state[1] = tmp[5]; state[4] = tmp[0]; state[5] = tmp[4]; break;
        }
    }
    void RollTo(char c){
        switch(c){
            case 'N': RollTo(0); break;
            case 'E': RollTo(1); break;
            case 'W': RollTo(2); break;
            case 'S': RollTo(3); break;
        }
    }
    void Rotate(int d){
        /* 90d degrees clockwise
         -> 0 ->
        ^   |   v
        2 --#-- 1
        ^   |   v
         <- 3 <-
        */
        d%=4;
        std::array<int, 6> tmp(state);
        switch(d){
            case 0: state[1] = tmp[1]; state[2] = tmp[2]; state[3] = tmp[3]; state[4] = tmp[4]; break;
            case 1: state[1] = tmp[3]; state[2] = tmp[1]; state[3] = tmp[4]; state[4] = tmp[2]; break;
            case 2: state[1] = tmp[4]; state[2] = tmp[3]; state[3] = tmp[2]; state[4] = tmp[1]; break;
            case 3: state[1] = tmp[2]; state[2] = tmp[4]; state[3] = tmp[1]; state[4] = tmp[3]; break;
        }
    }
    bool operator==(const Dice& r)const{
        Dice t(r);
        for(int i=0; i<=6; ++i){
            if(i&1) t.RollTo('E');
            else    t.RollTo('N');
            for(int j=0; j<4; ++j){
                t.Rotate(1);
                if(state == t.state){
                    return true;
                }
            }
        }
        return false;
    }
};  

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

    int n;
    std::cin >> n;
    std::vector<Dice> d;
    for(int i=0; i<n; ++i){
        std::array<int, 6> state;
        for(auto& j : state){
            std::cin >> j;
        }
        d.push_back(Dice(state));
    }
    for(int i=0; i<n; ++i){
        for(int j=i+1; j<n; ++j){
            if(d[i]==d[j]){
                std::cout << "No\n";
                return 0;
            }
        }
    }
    std::cout << "Yes\n";
    return 0;
}

Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
#define vv vector<lli>
#define vp vector<pair<lli,lli>>
#define vpp vector<pair<lli,pair<lli,lli>>>
#define lims(w) (w).begin(),(w).end()
#define rlims(w) (w).rbegin(),(w).rend()
#define pb push_back
#define mp make_pair
#define f(i,a,b) for(lli i=a;i<b;i++)
#define ff first
#define ss second
#define sz(a) (lli)(a.size())
lli inf = (1e18 + 2);

int main()
{
	lli d,s,t;
	cin>>d>>s>>t;

	if(d <= (s*t))
		cout<<"Yes"<<endl;
	else
		cout<<"No"<<endl;
	return 0;
}


Measured memory_bytes: 3632
#include <iostream>
#include<bits/stdc++.h>
#include<math.h>
#include<vector>
#include<stack>
#include<queue>
#include<set>
using namespace std;
#define ll long long int 
int main() {
	 ios_base::sync_with_stdio(false);
	 cin.tie(NULL);
	 cout.tie(NULL);
	 ll t;
	 //cin >> t;
	 //while(t--)
	 //{
	     string s;
	     cin >> s;
	     ll n=s.size(),i,j,x,y,c=0;
	     ll pre[n]={0},suf[n]={0};
	     if(s[0]=='<')
	     {
	         pre[0]=1;
	     }
	     if(s[n-1]=='>')
	     {
	         suf[n-1]=1;
	     }
	     for(i=1;i<n;i++)
	     {
	         if(s[i]=='<')
	         {
	             pre[i]=pre[i-1]+1;
	         }
	         else
	         {
	             pre[i]=0;
	         }
	     }
	     for(i=n-2;i>=0;i--)
	     {
	         if(s[i]=='>')
	         {
	             suf[i]=suf[i+1]+1;
	         }
	         else
	         {
	             suf[i]=0;
	         }
	     }
	     ll ans=0;
	     for(i=0;i<n;i++)
	     {
	         if(s[i]=='<')
	         {
	             ans+=pre[i];
	         }
	         else 
	         {
	             if(s[i-1]=='<')
	             {
	                 ans-=pre[i-1];
	                 ll k=max(pre[i-1],suf[i]);
	                 ans+=k;
	             }
	             else
	             {
	                 ans+=suf[i];
	             }
	         }
	     }
	     cout << ans << "\n";
	 //}
	return 0;
}

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

struct bit {
    int64_t size;
    vector<int64_t> v;

    bit(int64_t n): size(n+1), v(size) {}

    void add(int64_t a, int64_t w) {
        for (int64_t x = a; x <= size; x += x & -x) v[x] += w;
    }

    int sum(int64_t a) {
        int64_t res = 0;
        for (int64_t x = a; x > 0; x -= x & -x) res += v[x];
        return res;
    }
};

int main() {
    int64_t n;
    cin >> n;
    vector<int64_t> a(n);
    for (auto& e : a) cin >> e;
    
    int64_t top = 1e9, bottom = 0;
    while (top - bottom > 1) {
        int64_t target = (top + bottom) / 2;
        
        bit b(n*2+2);
        b.add(n+1, 1);
        int64_t num = 0, sum = 0;
        for (int64_t i = 0; i < n; i++) {
            sum += (a[i] <= target ? 1 : -1);
            num += b.sum(sum+n);
            b.add(sum+n+1, 1);
        }

        (num > n * (n+1) / 4 ? top : bottom) = target;
    }

    cout << top << endl;
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, pii> pip;
const ll INF = 1ll<<29;
const ll MOD = 1000000007;
const double EPS = 1e-9;
//---------------------------------//

/*--------DEBUG-------------*/
ll debugans;
string to_str(ll x) {
	stringstream ss;
	ss << x;
	return ss.str();
}

bool queryk(ll n) {
	ll ans = debugans;
	
	bool res = false;
	if (n <= ans && to_str(n) <= to_str(ans)) res = true;
	if (n > ans && to_str(n) > to_str(ans)) res = true;
	
	puts(res ? "Y" : "N");
	return res;
}
/*---------------------*/

ll to_ll(string str) {
	stringstream ss(str);
	ll res;
	ss >> res;
	
	return res;
}


ll powe(ll x, ll n) {
	ll res = 1;
	REP(i, n) res *= x;
	return res;
	/*
	if (n == 0) return 1;
	ll res = powe(x * x, n / 2);
	if (n & 1) res = res * x;
	*/
	return res;
}

bool query(ll n) {
	cout << "? " << n << endl;

//return queryk(n); // --DEBUG--

	string ans; cin >> ans;
	
	return ans == "Y"; 
}

int askfl() {
	int one = -1;
	bool bef;
	
	REP(i, 10) {
		bool now = query(powe(10, i));
		if (i != 0 && bef != now) one = i;
		bef = now;
	}
	
	int nine = -1;
	FOR(i, 1, 11) {
		bool now = query(powe(10, i) - 1);
		if (i != 1 && bef != now) nine = i;
		bef = now;
	}
	
	int keta;
	
	ll l, r;
	if (one != -1) keta = one;
	else keta = nine;
	
	return keta;
}

int askdg(string num, int k) {
	int l = 0, r = 11;
	bool bef = false;
	
	while (r - l > 1) {
		int m = (r + l) / 2;
		if (m == 10) { l = m; continue; }
		
		num[k] = m + '0';
		bool now = query(to_ll(num.c_str()));
		
		if (now) r = m;
		else l = m;
		
		bef = now;
	}
	
	return l;
}

int main() {
	//cin >> debugans; // --DEBUG--
	
	int keta = askfl();
	
	string ans = "";
	REP(i, keta + 1) ans += "0";
	
	REP(i, keta + 1) {
		int num = askdg(ans, i);
		
		if (num == 0) {
			if (i == 0) ans[i] = '1';
			else ans[i] = '0';
		}
		else if (num == 10) {
			if (i == keta) {
				int p = keta - 1;
				while (p >= 0 && ans[p] == '9') p--;
				if (p >= 0) {
					ans[p]++;
					FOR(j, p + 1, keta + 1) ans[j] = '0';
				}
			}
			else ans[i] = '9';
		}
		else ans[i] = num + '0';
	}
	
	ans = ans.substr(0, (int)ans.size() - 1);
	
	ll N;
	if (ans.size() == 0) N = 1;
	else N = to_ll(ans);
	
	cout << "! " << N << endl;
	return 0;
}


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

int main(){
    
    int a, b;
    cin >> a >> b;
    
    if(a > b){
        cout << "a > b" << endl;
    }
    else if(a < b){
        cout << "a < b" << endl;
    }
    else{
        cout << "a == b" << endl;
    }
}


Measured memory_bytes: 3084
#include<iostream>
#include<cstdio>
#include<cstring>
#include<queue>
#include<stack>
#include<cmath>
#include<algorithm>
#include<map>
typedef long long ll;
using namespace std;
#define INF 0x3f3f3f3f
/**
*超时有可能是输入的问题
*注意边界
*仔细读题
*没思路试试逆向思维
**加油，奥利给！！！ 
**/
map<int,int>p;
/*struct knd{
	int x,y,z;
}s[200000];*/ 
int a[200000];
int main()
{
	int m,n,i,j,t,k;
	cin>>n;
	t=7; 
	for(i=1;i<=1000000;i++)
	{
		t%=n;
		if(t==0)
		{
			cout<<i;
			return 0;
		 } 
		t=t*10+7;
	 } 
	 cout<<-1;
 } 

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

int main() {
 int N , A , B;
  cin >> N >> A ;
  
  B=N%1000 ;
  
  if(A>=B) {
   cout << "Yes" << endl;
  }
  
  else {
    cout << "No" << endl;
  }
  
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
//lli p = 1000000007;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int n, m;
    cin>>n>>m;
    vector <int> graph[n];
    int a, b;
    for (int i=0;i<m;i++)
    {
        cin>>a>>b;
        a--;
        b--;
        graph[a].push_back(b);
        graph[b].push_back(a);
    }

    vector <bool> expl(n, false);
    queue<int> q;
    int max_ans = 1;
    for (int i=0;i<n;i++)
    {
        if (!expl[i])
        {
            q.push(i);
            expl[i] = true;
            int ans = 0;
            while (!q.empty())
            {
                int el = q.front();
                q.pop();
                ans++;
                for (int j=0;j<graph[el].size();j++)
                {
                    a = graph[el][j];
                    if (!expl[a])
                    {
                        q.push(a);
                        expl[a] = true;
                    }
                }
            }

            if (ans>max_ans) max_ans = ans;
        }
    }

    cout<<max_ans<<"\n";
}

Measured memory_bytes: 14896
import numpy as np

n, m = list(map(int, input().split()))

board = []
for i in range(n):
    l = list(input())
    board.append(l)
board = np.array(board, dtype='unicode')

tmp = []
for i in range(board.shape[0]):
    if sum(board[i, :] == '.') == board.shape[1]:
        tmp.append(i)
board = np.delete(board, tmp, axis=0)

tmp = []
for i in range(board.shape[1]):
    if sum(board[:, i] == '.') == board.shape[0]:
        tmp.append(i)
board = np.delete(board, tmp, axis=1)

for i in range(board.shape[0]):
    for j in range(board.shape[1]):
        print(board[i, j], end='')
    print()



Measured memory_bytes: 15832