akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cstdio>
#include<cstring>
//#include<vector>
#include<algorithm>
#include<vector>
#include<queue>


#ifdef L_JUDGE
#pragma warning(disable:4996)
#endif

using namespace std;
const int MAXN=70;

char G[MAXN][MAXN];
bool vis[MAXN][MAXN];
int H,W;
queue<pair<int,int> > Q;
const int dir[4][2]={-1,0,1,0,0,1,0,-1};

bool InMap(int x,int y){
    return x>=0&&x<H&&y>=0&&y<W;
}

int BFS(int sx,int sy,int ex,int ey){
    while(!Q.empty())Q.pop();
    memset(vis,false,sizeof(vis));
    int k=sx*W+sy;
    Q.push(make_pair(k,1));
    vis[sx][sy]=true;
    while(!Q.empty()){
         pair<int,int> node=Q.front();
         Q.pop();
         int x=node.first/W;
         int y=node.first%W;
         int cnt=node.second;
         if((x==ex)&&(y==ey)){
             return cnt;
         }
         for(int di=0;di<4;di++){
              int tx=x+dir[di][0];
              int ty=y+dir[di][1];
              if((!InMap(tx,ty))
                      ||G[tx][ty]=='#'
                      ||vis[tx][ty]){
                  continue;
              }
              vis[tx][ty]=true;
              Q.push(make_pair(tx*W+ty,cnt+1));
         }
    }
    return -1;
}


int main(){
	#ifdef L_JUDGE
		freopen("in.txt","r",stdin);
//		freopen("out.txt","w",stdout);
	#endif
        while(EOF!=scanf("%d%d",&H,&W)){
            int cnt=0;
            for(int i=0;i<H;i++){
                scanf("%s",G[i]);
                for(int j=0;j<W;j++){
                    if(G[i][j]=='.')cnt++;
                }
            }

            int ret=BFS(0,0,H-1,W-1);
            if(ret==-1)cout<<-1<<endl;
            else cout<<cnt-ret<<endl;
        }

	#ifdef L_JUDGE
		fclose(stdin);
		fclose(stdout);
//		system("out.txt");
	#endif

	return 0;
}


Measured memory_bytes: 256
N = int(input())
As = list(map(int, input().split()))
As.append(As[0])
Rs = [0 for _ in range(N)]
for i in range(0, N):
    Rs[0] += As[i] * (1 if i % 2 == 0 else -1)
for i in range(1, N):
    Rs[i] = As[i - 1] * 2 - Rs[i - 1]
for i in range(0, N - 1):
    print(Rs[i], end=" ")
print(Rs[N - 1])

Measured memory_bytes: 65380
#include <algorithm>
#include <array>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <sstream>
#include <unordered_map>
#include <vector>


#define INF 1000000002486618624LL
#define MOD 1000000007
#define ALL(x) std::begin(x), std::end(x)


int main(int argc, char** argv)
{
  std::cin.tie(0);
  std::ios_base::sync_with_stdio(0);

  std::cout << std::fixed << std::setprecision(6);

  int N, M, a, b;

  std::cin >> N >> M;

  std::vector<int> set1, set2, set3;

  for (int i = 0; i < M; i ++) {
    std::cin >> a >> b;

    if (a > b)
      std::swap(a, b);

    if (a == 1)
      set1.push_back(b);

    if (b == N)
      set2.push_back(a);
  }

  std::sort(ALL(set1));
  std::sort(ALL(set2));

  std::set_intersection(ALL(set1), ALL(set2), std::back_inserter(set3));

  std::cout << (! set3.empty() ? "POSSIBLE" : "IMPOSSIBLE") << std::endl;

  return 0;
}


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

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int ans=0;
    int a,b;
    cin>>a>>b;
    int cu=1;
    while(cu<b){
        ans++;
        cu+=a-1;
    }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
  int floor[4][3][10]={{{}}},n,b,f,r,v;
  cin >> n;
  for(int i=0;i<n;i++){
    cin >> b >> f >> r >> v;
    floor[b-1][f-1][r-1] += v;
  }
  for(int i=0;i<4;i++){
    for(int j=0;j<3;j++){
      for(int k=0;k<10;k++){
    cout << " " << floor[i][j][k];
      }
      cout << endl;
    }
    if(i!=3)
    cout << "####################" << endl;
  }
}


Measured memory_bytes: 3112
a,b,c=map(int,input().split())
if a>b:
  n=a
  a=b
  b=n
else:
  pass
if b>c:
  n=b
  b=c
  c=n
else:
  pass
if a>b:
  n=a
  a=b
  b=n
else:
  pass
print(a,b,c)


Measured memory_bytes: 5596
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list
#from itertools import combinations # (string,3) 3回
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#

mod = 10**9 + 7

def readInts():
  return list(map(int,input().split()))
def main():
    n = int(input())
    LIST = []
    for i in range(n):
        LIST.append(int(input()))
    s_L = sorted(LIST,reverse=True)
    ma_1 = s_L[0]
    ma_2 = s_L[1]

    for i in range(n):
        if LIST[i] != ma_1:
            print(ma_1)
        else:
            print(ma_2)

if __name__ == '__main__':
  main()


Measured memory_bytes: 14112
import sys
from collections import defaultdict
from heapq import heappop, heappush
from itertools import permutations
from operator import itemgetter


# ある条件に当てはまらない限り、i番目に置く数字 xi は、
# それまで使ってない中で最も小さい数字か、
# またはその次に小さい数字（x[i-1]の右に最も小さい数字を置けない場合）
#
# ある条件: 以下の条件を満たす、未使用の数 k がある
# 残っているk以外の全ての数字が、kを共通して右側に置けない数として指定している
#   ＝kを先頭に持ってこない限り、kを置ける機会が無い
#
# ただし残りが少なく（3以下）なってくると例外的なものが出てくるため、それ以降は全探索

def fill_remainings(ans, aaa, x, remainings):
    """
    xを先頭にして残りを昇順に追加
    ただしxの次の要素のみ、aaa[x]で禁止されていた場合はその次と入れ替える
    remainingsにはxを含め3要素以上残っていることが前提
    """
    ans.append(x)
    i = len(ans)
    while remainings:
        k = heappop(remainings)
        if k != x:
            ans.append(k)
    if aaa[x] == ans[i]:
        ans[i], ans[i + 1] = ans[i + 1], ans[i]


def solve(n, aaa):
    if n == 2:
        return [-1]

    in_degrees = defaultdict(lambda: 0)
    for i, a in enumerate(aaa, start=1):
        in_degrees[a] += 1
    in_degrees = dict(in_degrees)

    # 少なくとも残り個数がこれ+1になるまでは「ある条件」には当てはまらない
    # ただし減少することはあるため、直前に再チェック必要
    curr_max = max(in_degrees.values())

    remainings = list(range(1, n + 1))

    aaa.insert(0, 0)

    ans = []
    banned = -1
    for i in range(n - 3):
        if curr_max == n - i - 1:
            curr_x, curr_max = max(in_degrees.items(), key=itemgetter(1))
            if curr_max == n - i - 1:
                fill_remainings(ans, aaa, curr_x, remainings)
                return ans
        top = heappop(remainings)
        if top == banned:
            ans.append(heappop(remainings))
            heappush(remainings, top)
        else:
            ans.append(top)
        banned = aaa[ans[-1]]
        # 確定した数字の入り次数を削減
        if banned in in_degrees:
            if in_degrees[banned] == 1:
                del in_degrees[banned]
            else:
                in_degrees[banned] -= 1
        in_degrees.pop(ans[-1], 0)

    remainings.sort()
    for i, j, k in permutations(remainings):
        if i != banned and j != aaa[i] and k != aaa[j]:
            ans += [i, j, k]
            break

    return ans


n, *aaa = map(int, sys.stdin.buffer.read().split())
print(*solve(n, aaa))


Measured memory_bytes: 21468
#include <iostream>
#include <cmath>

using namespace std;
typedef pair<double, double> P;

void solve()
{
	P p[4];
	int n;
	cin >> n;
	while(n--)
	{
		cin >> p[0].first >> p[0].second >> p[1].first >> p[1].second >> p[2].first >> p[2].second >> p[3].first >> p[3].second;
		if(p[0].first == p[1].first && p[2].first == p[3].first)
		{
			cout << "YES" << endl;
		}
		else if(p[0].first == p[1].first || p[2].first == p[3].first)
		{
			cout << "NO" << endl;
		}
		else
		{
			double a1 = (p[1].second - p[0].second) / (p[1].first - p[0].first);
			double a2 = (p[3].second - p[2].second) / (p[3].first - p[2].first);
			if(a1 == a2)
			{
				cout << "YES" << endl;
			}
			else
			{
				cout << "NO" << endl;
			}
		}
	}
}

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

Measured memory_bytes: 1224
#include<bits/stdc++.h>
#define ll long long int
#define INF 0x3f3f3f3f
#define pb push_back
#define se second
#define fi first
using namespace std;
const int N=2e5+5;
ll a[N],ans[N];

int main()
{
    ios_base::sync_with_stdio(false); cin.tie(0);
    int n; cin>>n;
    for(int i=0;i<n;i++) cin>>a[i];
    if(n&1){
        ans[n/2]=a[0];
        int l=n/2-1,r=n/2+1;
        for(int i=1;i<n;i++){
            if(i&1){
                ans[r]=a[i];
                r++;
            }
            else{
                ans[l]=a[i];
                l--;
            }
        }
    }
    else{
        ans[n/2]=a[0];
        int l=n/2-1,r=n/2+1;
        for(int i=1;i<n;i++){
            if(!(i&1)){
                ans[r]=a[i];
                r++;
            }
            else{
                ans[l]=a[i];
                l--;
            }
        }
    }
    for(int i=0;i<n;i++) cout<<ans[i]<<" ";
    return 0;
}


Measured memory_bytes: 5376
#include <iostream>
#include <stack>
#include <math.h>
#include <string.h>

using namespace std;

char S[100009];
long dp[100009][4];
long N = 1e9 + 7;

int main(int argc, char** argv) {
    cin >> S;
    int T = strlen(S);

    dp[0][0] = 1;
    dp[0][1] = 0;
    dp[0][2] = 0;
    dp[0][3] = 0;
    for (int i = 1; i <= T; i++) {
        if (S[i - 1] != '?')
            dp[i][0] = dp[i - 1][0];
        else
            dp[i][0] = 3 * dp[i - 1][0];
        dp[i][0] = dp[i][0] % N;
    }
    for (int i = 1; i <= T; i++) {
        for (int j = 1; j <= 3; j++) {
            if (S[i - 1] == 'A' + j - 1) {
                dp[i][j] = dp[i - 1][j - 1] + dp[i - 1][j];
            } else if (S[i - 1] == '?') {
                dp[i][j] = dp[i - 1][j - 1] + 3 * dp[i - 1][j];
            } else {
                dp[i][j] = 1 * dp[i - 1][j];
            }
            dp[i][j] = dp[i][j] % N;
        }
    }
    /*
    for (int i = 0; i <= T; i++) {
        for (int j = 0; j <= 3; j++) {
            cout << dp[i][j] << ",";
        }
        cout << endl;
    }
    */
    cout << dp[T][3] << endl;
}


Measured memory_bytes: 3456
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a, b, result;
  string op;
  cin>>a>>op>>b;
  result=a;
  
  if(op=="+"){
    result+=b;
  } else {
    result-=b;
  }
  
  cout<<result<<endl;
}

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

int main(){
	int n;
	long long m;
	std::vector<long long> aList;
	std::vector<int> numBit;
	std::vector<long long> dig;

	std::cin>>n;
	std::cin>>m;
	long long tmp=m;

	aList.resize(n);
	numBit.resize(40, 0);
	dig.resize(40,1);

	for(int i=1; i<40; i++)
		dig[i]= dig[i-1]*2;

	for(int i=0; i<n; i++)
		std::cin>>aList[i];

	for(int i=0; i<n; i++){
		for(int j=0; j<40; j++){
			if(aList[i]==0)
				break;

			if(aList[i]%2==1)
				numBit[j]++;

			aList[i]= aList[i]/2;
		}
	}

	int maxDig=0;
	for(int i=0; i<40; i++){
		if(m==0)
			break;

		if(m%2==1)
			maxDig=i;

		m= m/2;
	}

	long long ans1=0;
	long long ans2=0;

	for(int i=40; i>=0; i--){
		if(maxDig-1>= i)
			ans1 +=dig[i]* std::max(numBit[i], n-numBit[i]);
		else
			ans1 +=dig[i]* numBit[i];
	}

	for(int i= 40; i>=0; i--){
		if(maxDig>=i){
			if(tmp/dig[i]>=1){
				if(numBit[i]<n/2 + n%2){
					ans2+= dig[i]*(n-numBit[i]);
					tmp= tmp- dig[i];
				}else{
					ans2+= dig[i]* numBit[i];

				}

			}else{
				ans2+= dig[i]* numBit[i];
			}


		}
		else{
			ans2 +=dig[i]* numBit[i];

		}
	}

	if(ans1> ans2)
		std::cout<< ans1<<std::endl;
	else
		std::cout<< ans2<<std::endl;

	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
    int n;cin>>n;
    long long a[n];
    long long mini = 1e+9+9;
    long long res = 0;
    int minus = 0;
    for(int i=0;i<n;i++){
        cin>>a[i];
        if(a[i]<0){
            a[i]*=(-1);
            minus++;
        }
        mini=min(mini,a[i]);
        res+=a[i];
        //cout<<a[i]<<endl;
    }
    if(minus%2==1)res-=mini*2;
    cout<<res<<endl;
}


Measured memory_bytes: 1024
namespace Test
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;

    public class Test
    {
        public static void Main(string[] args)
        {
            var t = new Test();
            var n = decimal.Parse(Console.ReadLine());
            decimal i = 100;
            var count = 0;
            while (true)
            {
                if (i >= n)
                {
                    break;
                }
                i = Math.Floor(1.01M * i);
                count++;
            }

            Console.WriteLine(count);

        }
    }
}

Measured memory_bytes: 17744
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll dp[45][45][45];
int G[45][45];
int main(){
	int n;
	scanf("%d",&n);
	n *= 2;
	for (int i = 0; i < n; i++){
        for (int j = 0; j < n; j++){
            char x;
            scanf(" %c",&x);
            G[i][j] = x-'0';
        }
	}
	for (int l = 0; l < n; l++){
        for (int s = 1; s+l < n; s++){
            int u = s+l;
            for (int t = s; t <= u; t++){
                if (s == u) dp[s][t][u] = 1;
                else if (s == t || t == u) dp[s][t][u] = 0;
                else{
                    for (int p1 = s; p1 < t; p1++){
                        for (int p2 = t+1; p2 <= u; p2++){
                            //printf("can take %d-%d\n",p1,p2);
                            for (int r1 = s; r1 <= p1; r1++){
                                for (int r2 = p2; r2 <= u; r2++){
                                    if (G[r1][r2] == 0) continue;
                                    //printf("+%lld*%lld*%lld\n",dp(s,r1,p1),dp(p1+1,t,p2-1),dp(p2,r2,u));
                                    ll num = dp[s][r1][p1]*dp[p1+1][t][p2-1]*dp[p2][r2][u];
                                    //printf("if take %d-%d: add %lld\n",r1,r2,num);
                                    dp[s][t][u] += num;
                                }
                            }
                        }
                    }
                }
            }
        }
	}
	ll ans = 0;
	for (int i = 1; i <= n-1; i++){
        if (G[0][i]){
            ans += dp[1][i][n-1];
            //printf("if take 0-%d, %lld\n",i,dp(1,i,2*n-1));
        }
	}
	printf("%lld",ans);
}


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

using namespace std;

using ll = long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vi = vector<int>;
using vl = vector<ll>;

using _loop_int = int;
#define REP(i,n) for(_loop_int i=0; i<(_loop_int)(n); i++)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a); i<(_loop_int)(b); i++)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1; i>=(_loop_int)(a); i--)

#define CHMIN(a,b) (a)=min((a),(b))
#define CHMAX(a,b) (a)=max((a),(b))
#define ALL(v) (v).begin(),(v).end()

#define DEBUG(x) cerr<<#x<<": "<<(x)<<endl
#define DEBUG_VEC(v) cerr<<#v<<": ";REP(__i,(v).size())cerr<<((v)[__i])<<", ";cerr<<endl

const ll MOD = 1000000007ll;

int n,s,t;

int query(int x, int y){
    printf("? %d %d\n",x,y); fflush(stdout);
    int ret;
    scanf("%d",&ret);
    return ret;
}

int main(){
    scanf("%d%d%d",&n,&s,&t);
    assert(n>=2);
    if(n==2){
        printf("! %d %d\n",s,t); fflush(stdout);
        return 0;
    }
    int len = query(s,t);
    set<pii> po;
    po.insert(pii(0,s));
    po.insert(pii(len,t));
    set<int> dists;
    dists.insert(0);
    dists.insert(len);
    FOR(v,1,n+1){
        if(v==s || v==t)continue;
        int p = query(s,v);
        int q = query(v,t);
        if(p+q != len)continue;
        if(dists.count(p))continue;
        auto it = po.lower_bound(pii(p,-1));
        pii T = *it;
        it--;
        pii S = *it;
        int x = query(S.second, v);
        int y = query(v, T.second);
        if(x+y != T.first-S.first)continue;
        dists.insert(p);
        po.insert(pii(p,v));
    }
    // out
    printf("!");
    for(pii P : po)printf(" %d",P.second);
    puts("");
    fflush(stdout);
    return 0;
}



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

#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <string>
#include <functional>
#include <math.h>
#include <map>
#include <queue>

typedef long long ll;
typedef unsigned long long ull;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,a,b) for(int i=(b-1);i>=(a);--i)
#define REP(i,n)   FOR(i,0,n)
#define RREP(i,n)   RFOR(i,0,n)

const double INF = 1e+05;
const int MOD = 1e9+7;

using namespace std;

template <typename _Ty>
ostream& operator << (ostream& ostr, const vector<_Ty>& v) {if (v.empty()) {ostr << "{ }"; return ostr;}
    ostr << "{" << v.front(); for (auto itr = ++v.begin(); itr != v.end(); itr++) {ostr << ", " << *itr;}
    ostr << "}";
    return ostr;}

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

int max_val = 30;
vector<vector<char>> maze;
int h, w;

int bfs(int sx, int sy, int gx, int gy){
typedef pair<int, int> P;
  queue<P> que;
  que.push(P(sx, sy));
  vector<vector<int>> dist(max_val, vector<int>(max_val, INF));
  dist[sx][sy] = 0;
  int dx[4] = {-1, 1, 0, 0};
  int dy[4] = {0, 0, -1, 1};
  while (que.size()){
    int x = que.front().first;
    int y = que.front().second;
    que.pop();
    if (x == gx and y == gy) break;
    REP(i, 4){
      int nx = x + dx[i];
      int ny = y + dy[i];
      if (0 <= nx and nx < h and 0<= ny and ny < w and maze[nx][ny] != '#' and dist[nx][ny] == INF){
        dist[nx][ny] = dist[x][y] + 1;
        que.push(P(nx, ny));
      }
    }
  }
  return dist[gx][gy];
}

int main(void){
  ios::sync_with_stdio(false);
  cin >> h >> w;
  maze = vector<vector<char>> (h, vector<char>(w));
  REP(i, h){
    REP(j, w){cin >> maze[i][j];}
  }
  vector<int> dis_vec;
  REP(st_x, h){
    REP(st_y, w){
      REP(g_x, h){
        REP(g_y, w){
          if (maze[st_x][st_y] != '#' and maze[g_x][g_y] != '#'){
            int val = bfs(st_x, st_y, g_x, g_y);
            dis_vec.push_back(val);
            /*
            cout << st_x << ' ' << st_y << ' ';
            cout << g_x << ' ' << g_y << ' ';
            cout << val << endl;
            */
          }
        }
      }
    }
  }
  int ans = 0;
  REP(i, int(dis_vec.size())){ans = max(ans, dis_vec[i]);}
  cout << ans << endl;


  return 0;
}



Measured memory_bytes: 1400
#include "stdio.h"

int day;
int border;
int num[2];



int main() {
	scanf("%d %d %d %d", &day, &border, &num[0], &num[1]);
	if (day <= border)printf("%d\n", day*num[0]);
	else printf("%d\n", border*num[0] + (day - border)*num[1]);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define str string
#define pll pair<ll, ll>
#define fi first
#define se second
#define pb push_back
#define SET(a, b) memset(a, b, sizeof(a))
#define pq priority_queue
using namespace std;
bool inp[100005];
bool output[100005];
int main () {
	ll a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q;
	str A;
	scanf("%lld", &a);
	cin >> A;
	for (i = 0; i < a; i++) {
		if (A[i] == 'o') inp[i + 1] = 0;
		else inp[i + 1] = 1;
	}
	b = 0;
	for (i = 0; i <= 1; i++) {
		output[1] = i;
		for (j = 0; j <= 1; j++) {
			output[2] = j;
			for (k = 3; k <= a; k++) {
				output[k] = inp[k - 1] ^ output[k - 1] ^ output[k - 2];
			}
			if (output[a - 1] == (inp[a] ^ output[a] ^ output[1]) 
				&& output[a] == (inp[1] ^ output[1] ^ output[2])
				&& output[a - 2] == (inp[a - 1] ^ output[a - 1] ^ output[a])) {
				b = 1;
				break;
			}
		}
		if (b) break;
	}
	if (!b) {
		printf("-1\n");
	} else {
		for (i = 1; i <= a; i++) {
			if (output[i]) printf("W");
			else printf("S");
		}
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
#define mp(a, b) make_pair(a, b)
typedef long long ll;
const ll mod = 1e9 + 7;
typedef pair<int, int> pii;
const int maxn = 2000 + 10;
const int maxb = 20;
int n, m;
struct Edge
{
	int u, v, w;
}e[maxn];
bool cmp(const Edge & i, const Edge & j) { return i.w < j.w;}
vector<pii> E[maxn];
int Max[maxn][maxb], dep[maxn], anc[maxn][maxb];
ll fac[maxn], inv[maxn], facinv[maxn], bin[maxn];
void pre()
{
	fac[0] = 1; for(int i = 1; i < maxn; ++i) fac[i] = fac[i - 1] * i % mod;
	inv[1] = 1; for(int i = 2; i < maxn; ++i) inv[i] = (mod - mod / i) * inv[mod % i] % mod;
	facinv[0] = 1; for(int i = 1; i < maxn; ++i) facinv[i] = facinv[i - 1] * inv[i] % mod;
	bin[0] = 1; for(int i = 1; i < maxn; ++i) bin[i] = bin[i - 1] * 2 % mod;
}
ll C(int n, int m) { return n < m ? 0 : fac[n] * facinv[m] % mod * facinv[n - m] % mod;}
int fa[maxn];
int getfa(int x) { return x == fa[x] ? x : fa[x] = getfa(fa[x]);}
ll kru()
{
	ll ret = 0;
	for(int i = 1; i <= n; ++i) fa[i] = i;
	sort(e + 1, e + m + 1, cmp);
	for(int i = 1; i <= m; ++i) 
	{
		int u = e[i].u, v = e[i].v, w = e[i].w;
		if(getfa(u) == getfa(v)) continue;
		ret += w;
		E[u].emplace_back(v, w);
		E[v].emplace_back(u, w);
		fa[getfa(u)] = getfa(v);
	}
	return ret;
}
void dfs(int x, int father)
{
	dep[x] = dep[father] + 1;
	for(auto e : E[x])
	{
		int v = e.first, val = e.second;
		if(v != father)
		{
			Max[v][0] = val;
			anc[v][0] = x;
			dfs(v, x);
		}
	}
}
void getanc()
{
	for(int j = 1; j < maxb; ++j)
		for(int i = 1; i <= n; ++i)
			anc[i][j] = anc[anc[i][j - 1]][j - 1], Max[i][j] = max(Max[i][j - 1], Max[anc[i][j - 1]][j - 1]);
}
int getmax(int u, int v)
{
	int ret = 0;
	if(dep[u] < dep[v]) swap(u, v);
	for(int j = maxb - 1; ~j; --j) if(dep[anc[u][j]] >= dep[v]) ret = max(ret, Max[u][j]), u = anc[u][j];
	if(u == v) return ret;
	for(int j = maxb - 1; ~j; --j) if(anc[u][j] != anc[v][j]) ret = max(ret, max(Max[u][j], Max[v][j])), u = anc[u][j], v = anc[v][j];
	return max(max(Max[u][0], Max[v][0]), ret);
}
int main()
{
	pre();
	scanf("%d%d", &n, &m);
	ll x; 
	scanf("%lld", &x);
	for(int i = 1; i <= m; ++i) scanf("%d%d%d", &e[i].u, &e[i].v, &e[i].w);
	ll sx = kru();
	if(sx > x) { puts("0"); return 0;}
	dfs(1, 0); 
	getanc();
	int cnt1 = 0, cnt2 = 0, cnt3 = 0;
	for(int i = 1; i <= m; ++i) 
	{
		ll cur = getmax(e[i].u, e[i].v) + x - sx;
		if(e[i].w < cur)
			++cnt1; 
		else if(e[i].w == cur)
			++cnt2;
		else
			++cnt3;
	}
	ll ans;
	if(!cnt1) ans = (bin[cnt2] - 2 + mod) * bin[cnt3] % mod;
	else ans = 2 * (bin[cnt2] - 1 + mod) % mod * bin[cnt3] % mod;
	printf("%lld\n", ans);
	return 0;
}

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

int main(){
	int x, n;
  	cin >> x >> n;
  	vector<int> d(102);
  	rep(i, n){
    	int p;
      	cin >> p;
      	d[p] = 1;
    }
  
  	P ans(999, -1);

  	for(int i= 0; i < 102; i++){
    	if(d[i] == 1) continue;
      	int dif = abs(x - i);
      	ans = min(ans, P(dif, i));
    }
  
  	cout << ans.second << endl;
}

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

using namespace std;

#define N 100

set<string> s;
string str[N + 1];

int main(){
	int n, i;

	cin >> n;

	for (i = 1; i <= n; i++){
		cin >> str[i];
	}

	s.insert(str[1]);

	for (i = 2; i <= n; i++){
		if (s.count(str[i]) or str[i - 1].back() != str[i][0]){
			break;
		}

		s.insert(str[i]);
	}

	if (i <= n){
		cout << "No\n";
	}
	else{
		cout << "Yes\n";
	}

	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(int argc, const char * argv[]) {
  int A, B, C, D;
  cin >> A >> B >> C >> D;

  int l = A * B, r = C * D;
  if (l < r) {
    cout << r << endl;
  } else if (l > r){
    cout << l << endl;
  } else {
    cout << l << endl;
  }
  return 0;
}


Measured memory_bytes: 256
/*
AuThOr Gwj
*/
#include<bits/stdc++.h>
#define rb(a,b,c) for(int a=b;a<=c;++a)
#define rl(a,b,c) for(int a=b;a>=c;--a)
#define LL long long
#define IT iterator
#define PB push_back
#define II(a,b) make_pair(a,b)
#define FIR first
#define SEC second
#define FREO freopen("check.out","w",stdout)
#define rep(a,b) for(int a=0;a<b;++a)
#define KEEP while(1)
#define SRAND mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define random(a) rng()%a
#define ALL(a) a.begin(),a.end()
#define POB pop_back
#define ff fflush(stdout)
#define fastio ios::sync_with_stdio(false)
#define debug_pair(A) cerr<<A.FIR<<" "<<A.SEC<<endl;
using namespace std;
const int INF=0x3f3f3f3f;
typedef pair<int,int> mp;
typedef pair<mp,mp> superpair;
int a,b;
const int MOD=1e9+7;
LL fact[2000000+2],rfact[2000000+2];
LL c(int x,int y){
	return fact[y]*rfact[x]%MOD*rfact[y-x]%MOD;
}
LL quick(LL A,LL B){
	if(!B){
		return 1ll;
	}
	LL tmp=quick(A,B>>1);
	tmp*=tmp;
	tmp%=MOD;
	if(B&1) tmp*=A;
	return tmp%MOD;
}
int main(){
	fastio;
	fact[0]=1;
	rb(i,1,2000000)
		fact[i]=fact[i-1]*i,fact[i]%=MOD;
	rfact[2000000]=quick(fact[2000000],MOD-2);
	rl(i,2000000-1,1){
		rfact[i]=rfact[i+1]*(i+1);
		rfact[i]%=MOD;
	}
	rfact[0]=1;
	cin>>a;
	string s;
	cin>>s;
	LL res=0;
	b=s.length();
	rb(i,b,a+b){
		res+=c(i,a+b)*quick(25,a+b-i)%MOD;	
//		cout<<i<<" "<<a+b<<" "<<c(i,a+b)<<endl; 
		res%=MOD;
	}
	cout<<res<<endl;
	return 0;
}
/*
2 aa
3851
*/


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

using namespace std;
#define ll long long
#define inf (int)1e5

int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	int n, a[inf], b[inf], c[inf];
	int dp[inf][3];
	cin>>n;
	for(int i=0; i<n; i++){
		cin>>a[i]>>b[i]>>c[i];
		if(i==0){
			dp[0][0]=a[0];
			dp[0][1]=b[0];
			dp[0][2]=c[0];
		}
	}

	for(int i=1; i<n; i++){

		dp[i][0]=a[i] + max(dp[i-1][1],dp[i-1][2]);

		dp[i][1]=b[i] + max(dp[i-1][0],dp[i-1][2]);

		dp[i][2]=c[i] + max(dp[i-1][0],dp[i-1][1]);
	}
	cout<<max(dp[n-1][0], max(dp[n-1][1], dp[n-1][2]));
	
}

Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
 
using ll = long long;
using pll = pair<ll, ll>;
#define all(x) (x).begin(), (x).end()
#define call(x) (x).cbegin(), (x).cend()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back
#define sz(x) ((x).size())
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define rep(i, a, b) for(ll i = ll(a); i < ll(b); i++)
const double PI = acos(-1);
const int mod = 1e9+7;
const long long INF = (1LL << 60);
const int dx[] = {0,1,0,-1,1,1,-1,-1};
const int dy[] = {1,0,-1,0,1,-1,-1,1};
ll gcd(ll a,ll b){return b ? gcd(b,a%b) : a;}
ll lcm(ll a,ll b){return a / gcd(a,b) * b;}
ll stringcount(string s, char c){return count(s.cbegin(), s.cend(), c);}
bool isInteger(double x){return floor(x) == x;}
ll ceil(ll a, ll b){return ((a)+(b)-1)/b;}
template<class T> inline bool chmax(T &a, const T &b){ if(a < b){ a=b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b){ if(a > b){ a=b; return 1; } return 0; }

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

  string s;
  cin >> s;
  ll n = sz(s);
  s.erase(s.end()-1);
  rep(i, 0, n){
    string t = s.substr(0, sz(s)/2);
    string u = s.substr(sz(s)/2);
    if(t == u){
      cout << sz(s) << endl;
      return 0;
    }else s.erase(s.end()-1);
  }

  return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <cmath>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <memory.h>
#include <iomanip>
#include <bitset>
#include <list>
#include <stack>
#include <deque>
#include <numeric>

using namespace std;

#define mod 1000000007

int main()
{
	int n;
	cin >> n;
	int l = 0, r = 5000;
	while(r - l > 1){
		int mid = (l + r) / 2;
		if(mid * (mid - 1) <= 2 * n) l = mid;
		else r = mid;
	}
	if(l * (l - 1) != 2 * n){
		cout << "No" << endl;
		return 0;
	}

	vector<vector<int> > ans;
	int max_used = 0;
	for(int i = 0; i < l; i++){
		vector<int> res;
		for(int j = 0; j < l - 1; j++){
			if(j < i){
				res.push_back(ans[j][i - 1]);
			}
			else {
				max_used++;
				res.push_back(max_used);
			}
		}
		ans.push_back(res);
	}
	cout << "Yes" << endl;
	cout << l << endl;
	for(int i = 0; i < ans.size(); i++){
		cout << ans[i].size() << " ";
		for(int j = 0; j < ans[i].size(); j++){
			cout << ans[i][j];
			if(j == ans[i].size() - 1) cout << endl;
			else cout << " ";
		}
	}
}

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

#define ll long long int
#define rep(i,a,n) for(ll i=(a); i<(n); i++)

using namespace std;

signed main() {
	ll N, X, x=0, ans=1;
	cin>>N>>X;
	vector<ll> v(N);
	rep(i,0,N) cin>>v[i];
	for (auto d: v) {
		x += d;
		if (x <= X) ans++;
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main()
{
	int H, W, N, sr, sc;
	string S, T;
	cin >> H >> W >> N >> sr >> sc >> S >> T;

	string ans = "YES";
	int nl = sc;
	int nr = sc;
	int nu = sr;
	int nd = sr;
	for( int i = 0; i < N; i++ ) {
		if( S[i] == 'L' ) nl--;
		else if( S[i] == 'R' ) nr++;
		else if( S[i] == 'U' ) nu--;
		else if( S[i] == 'D' ) nd++;
		if( nl < 1 || nr > W || nu < 1 || nd > H ) {
			ans = "NO";
			break;
		}
		if( T[i] == 'L' ) {
			if( nr > 1 ) nr--;
		}
		else if( T[i] == 'R' ) {
			if( nl < W ) nl++;
		}
		else if( T[i] == 'U' ) {
			if( nd > 1 ) nd--;
		}
		else if( T[i] == 'D' ) {
			if( nu < H ) nu++;
		}
	}

	cout << ans << endl;
}


Measured memory_bytes: 3892
h, w, k = gets.split.map(&:to_i)
field = h.times.map { gets.chomp.chars }
black = field.sum { |row| row.count('#') }

def fill(field, n)
  d = field[n].count('#')
  field[n] = [' '] * field[n].size
  d
end

answer = 0

0.upto((1 << h) - 1) do |i|
  current_black = black
  current_field = field.map { |i| i }
  0.upto(h - 1) do |k|
    current_black -= fill(current_field, k) if i & (1 << k) > 0
  end

  0.upto((1 << w) - 1) do |j|
    current_black2 = current_black
    current_field2 = current_field.map { |i| i }.transpose
    0.upto(w - 1) do |k|
      current_black2 -= fill(current_field2, k) if j & (1 << k) > 0
    end

    answer += 1 if current_black2 == k
  end
end

puts answer


Measured memory_bytes: 14424
from collections import Counter
n = int(input())
a = sorted(list(map(int, input().split())))
m = max(a)+1

numbers = [0] * m

for i in a:
    numbers[i] += 1

    if numbers[i] == 1:
        for j in range(2*i, m, i):
            numbers[j] += 2

print(numbers.count(1))

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

int main(){
  int N , M ; 
  cin >> N >> M ;
  vector<int> H(N) ;
  vector<int> A(M) ; 
  vector<int> B(M) , count(N) ; 
  int T = 0 ; 
  
  for(int i  = 0 ; i < N ; i++){
    cin >> H.at(i) ;
    count.at(i) = 0 ;
  }
  
  for(int i = 0 ; i < M ; i++){
    cin >> A.at(i) >> B.at(i) ; 
  }
  
  for(int i = 0 ; i < M; i++){
    if( H.at(A.at(i)-1) > H.at(B.at(i)-1) ){
      count.at(B.at(i)-1)++ ; 
    }
    else if(H.at(A.at(i)-1) == H.at(B.at(i)-1)){
      count.at(B.at(i)-1)++ ;
      count.at(A.at(i)-1)++ ;
    }
    else{
      count.at(A.at(i)-1)++ ; 
    }
  }
  
  for(int i = 0 ; i < N ; i++){
    if(count.at(i)==0)  T++ ; 
  }
  cout << T << endl ; 
}

Measured memory_bytes: 4844
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
#include <iomanip>
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF=1001001001;
vector<pair<int64_t,int64_t>>pppp(int64_t x){
  vector<pair<int64_t,int64_t>>p;
  for(int64_t i=2;i*i<=x;i++){
    int cnt=0;
    if(x%i==0){
    while(x%i==0){cnt++;x/=i;}
    p.push_back(make_pair(i,cnt));
    }
  }
  if(x!=1){p.push_back(make_pair(x,1));}
  return p; 
}
 
int main() {
  int64_t N;
  cin>>N;
  string k;
  while(N>0){
    N--;
    k=(char)(N%26+'a')+k;
    N/=26;
  }
  cout<<k<<endl;
  return 0;
}


Measured memory_bytes: 3632
function Main(input) {
  input = input.split("\n");
  tmp = input[0].split(" ");
  height = input[1].split(" ");
  var j=0;
  var step = [0];
  var answer = 0;
  for(var i=0; i<tmp[0]-1; i++){
    if(Number(height[i]) >= Number(height[i+1])){
      step[j]++;
    }else{
      if(step[j]>answer){
        answer = step[j];
      }
      j++;
      step[j] = 0;
    }
  }
  if(step[j]>answer){
    answer = step[j];
  }
  console.log(answer);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 28124
N = int(input())
A = list(int(i) for i in input().split())
B = list(int(i) for i in input().split())
C = list(int(i) for i in input().split())
A.sort()
B.sort()
C.sort()
sum = 0
for j in range(N):
    low = low2 = 0
    high = high2 = N
    b = B[j]
    mid = mid2 = 0
    #print(b)
    while(high>low):
        mid = (high + low)//2
        if b > A[mid]:
            low = mid +1
        else:
            high = mid
    acount = low
    while (high2>low2):
        mid2 = (high2 + low2)//2
        if b < C[mid2]:
            high2 = mid2
        else:
            low2 = mid2 + 1
    ccount=N-low2
    sum += acount*ccount
print(sum)

Measured memory_bytes: 24052
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] in = br.readLine().split(" ");
        int m = Integer.parseInt(in[0]);
        int dp[]= new int[m+1];
        long sum=0;
        in = br.readLine().split(" ");
        for(int i=0;i<m-1;i++){
            dp[Integer.parseInt(in[i])]++;
        }
        for(int i=1;i<=m;i++) {
            System.out.println(dp[i]);
        }
    }
}


Measured memory_bytes: 66660
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = n - 1; i >= 0; i--)
using namespace std;
using Graph = vector<vector<int>>;
#define MOD 1000000007
#define MOD2 998244353
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long ll;
typedef pair<ll, ll> P;


int main(){
    int n, k;
    cin >> n >> k;
    ll a[n];
    rep(i, n) cin >> a[i];

    cout << (n - 1 + k - 1 - 1) / (k - 1) << endl;

    return 0;
}

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

class prog{
  static void Main(){
    int N = int.Parse(Console.ReadLine());
    long[] A = Console.ReadLine().Split().Select(long.Parse).ToArray();
    
    for(int i = 0; i < N; i++){
      A[i] -= i + 1;
    }
    
    A = A.OrderBy(x => x).ToArray();
    long b = N % 2 == 0 ? (A[N / 2] + A[N / 2 - 1]) / 2 : A[N / 2];    
    
    long ans = 0;
    for(int i = 0; i < N; i++){
      ans += Math.Abs(A[i] - b);
    }
    
    Console.WriteLine(ans);
  }
}

Measured memory_bytes: 42628
import math
def main():

    N = int(input())
    primes = []
    def isprime(n):
        if n == 1: return False
        for i in range(2, int(math.sqrt(n))+1):
            if n % i == 0:
                return False
        return True

    primes = set()
    for i in range(1, int(math.sqrt(N))+1):
        if N % i == 0:
            if isprime(i):
                primes.add(i)
            if isprime(N//i):
                primes.add(N//i)
    if isprime(N):
        primes.add(N)

    ans = 0
    for p in primes:
        q = p
        while N % q == 0:
            ans += 1
            N //= q
            q *= p
        if N == 1:
            break
    return ans


if __name__ == '__main__':
    print(main())

Measured memory_bytes: 68324
import java.util.Scanner;


public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int k = sc.nextInt();
		String s = sc.next();
		
		if(s.length() <= k) {
			System.out.println(s);
		}else {
			System.out.println(s.substring(0, k) + "...");
		}

		sc.close();
	}

}

Measured memory_bytes: 38632
#include<stdio.h>
 
int p(int num) { 
  return num / 2; 
}
int l(int num) { 
  return 2 * num; 
}
int r(int num) { 
  return 2 * num+1; 
}
 
int main() {
  int hum, i, array[251];
 
  scanf("%d", &hum);
    for (i = 1; i < hum + 1; i++) scanf("%d", &array[i]);
     
    for (i = 1; i < hum + 1; i++) {

    printf("node %d: key = %d, ", i, array[i]);

    if (p(i) >= 1) printf("parent key = %d, ", array[p(i)]);

    if (l(i) <= hum) printf("left key = %d, ", array[l(i)]);

    if (r(i) <= hum) printf("right key = %d, ", array[r(i)]);
  
  printf("\n");

    }
    return 0;
}

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

public class MainClass
{
	public const long Giri = 1000000007;
	
	public static void Main(string[] args)
	{
		var p = Input().ToInt();
		var n = p[0];
		var k = p[1];
		var q = Input();
		var h = new long[n];
		long wa = 0;
		for(int i = 0; i < n; i++)
		{
			h[i] = q[i].ToLong();
		}
		if(n <= k)
		{
			Console.WriteLine(0);
			return;
		}
		Array.Sort(h);
		Array.Reverse(h);
		for(int i = k; i < n; i++)
		{
			wa += h[i];
		}
		
		Console.WriteLine(wa);
	}


	static long GCD(long a, long b)
	{
		var v = new[] { a, b };
		while (v[1] != 0) { v = new[] { v[1], v[0] % v[1] }; }
		return v[0];
	}
	public static string[] Input() { return Console.ReadLine().Split(' '); }
	public static int Clamp(int val, int max, int min = 0) { return Math.Min(max, Math.Max(min, val)); }
}

public static class Smarter
{
	public static int ToInt(this string str) { return int.Parse(str); }
	public static long ToLong(this string str) { return long.Parse(str); }
	public static int[] ToInt(this string[] str)
	{
		var r = new int[str.Length];
		for(int i = 0; i < str.Length; i++) r[i] = str[i].ToInt();
		return r;
	 }
}


Measured memory_bytes: 30556
A, B, C, D = [int(n) for n in input().split()]

counter = -1

while A > 0 and C > 0:
    counter += 1
    if counter % 2 == 0:
        C -= B
    else:
        A -= D

if counter % 2 == 0:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 9172
package main

import "fmt"

func main() {
	var s string
	fmt.Scan(&s)

	var ret int
	switch s {
	case "SUN":
		ret = 7
	case "MON":
		ret = 6
	case "TUE":
		ret = 5
	case "WED":
		ret = 4
	case "THU":
		ret = 3
	case "FRI":
		ret = 2
	case "SAT":
		ret = 1
	}
	fmt.Println(ret)
}


Measured memory_bytes: 512
#define _USE_MATH_DEFINES
#include <iostream>
#include <complex>
#include <algorithm>
#include <vector>
#include <stack>
#include <string>
#include <queue>
#include <cmath>
#include <math.h>
#include <numeric>
#include <list>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <climits>
#include <set>
#include <memory.h>
#include <memory>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cassert>
#include <map>
#include <cassert>
#include <time.h>

using namespace std;

typedef complex<double> xy_t;
typedef pair<xy_t, xy_t> line;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<int , P> PP;
typedef pair<int, string> Ps;
typedef vector<int> vec;
typedef vector<vec> mat;
const int INF= 1 << 30;
const double EPS = 1e-9;
const double PI = 3.1415926535897932384626433832795;

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

double cross(const xy_t &a, const xy_t &b){
	return imag(conj(a) * b);
}

double dot(const xy_t &a, const xy_t &b){
	return real(conj(a) * b);
}

xy_t projection(const line &l, const xy_t &p){
	double t = dot(p - l.first, l.first - l.second) / norm(l.first - l.second);
	return l.first + t * (l.first - l.second);
}

bool intersectSP(const line &l, const xy_t &p){
	return abs(l.first- p) + abs(l.second - p) - abs(l.first - l.second) < EPS;
}

double distanceSP(line s, xy_t p){
	const xy_t r = projection(s, p);
	if(intersectSP(s, r)) return abs(r - p);
	return min(abs(s.first - p), abs(s.second - p));
}

int main(){
	int n;
	cin >> n;
	ll sum = 0;
	ll num;
	rep(i, n){
		cin >> num;
		sum += num;
	}
	cout << sum / n << endl;
	return 0;
}

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

int main() {
  
  int D;
  int T;
  int S;
  
  cin >> D >> T >> S;
  
  if ( D > T * S ) {
    
    cout << "No" << endl;
  }
  
  else {
    
    cout << "Yes" << endl;
  }
  
}


Measured memory_bytes: 3592
#!/usr/bin/env python3
import sys


def solve(N: int, K: int, D: "List[int]"):
    
    while(True):
        nl = list(map(int,list(str(N))))
        f = True
        for i in range(len(nl)):
            if(nl[i] in D):
                f = False
        if(f):
            print(N)
            exit()
        else:
            N += 1

    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    D = [int(next(tokens)) for _ in range(K)]  # type: "List[int]"
    solve(N, K, D)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
def main():
    N = int(input())
    A, B = [], []
    for _ in range(N):
        a, b = map(int,input().split())
        A.append(a)
        B.append(b)
    A.sort()
    B.sort()

    if N % 2 != 0:
        ma = A[N//2]    
        mb = B[N//2]
        print(mb - ma + 1)
    else:
        ma = A[N//2-1] + A[N//2] # 中央値は/2がいるが、この場合は分子が分かればよい
        mb = B[N//2-1] + B[N//2]
        print(mb - ma + 1)


if __name__ == "__main__":
    main()



Measured memory_bytes: 98892
#include<bits/stdc++.h>
using namespace std;
int main(void)
{
    
    long long int n,m,k,i,ans=0,j=0;
    cin>>n>>m>>k;
    vector<long long int> a(n+1),b(m+1);
    for(i=1;i<=n;i++)
        {
            cin>>a[i];
            a[i]+=a[i-1];
        }
    for(i=1;i<=m;i++)
        {
            cin>>b[i];
            b[i]+=b[i-1];
        }
    for(i=0;i<=n;i++)
    {
        if(k-a[i]<0)
        break;
        int temp=upper_bound(b.begin(),b.end(),k-a[i])-b.begin();
        ans=max(ans,temp+i-1);
    }
    cout<<ans;
}

Measured memory_bytes: 6420
import itertools,collections
def make_divisors(n):
    divisors = []
    func = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
                func.append(len(str(n//i)))
            else:
                func.append(len(str(i)))

    divisors.sort()
    return func
def main():
    n = int(input())
    div = make_divisors(n)
    print(min(div))

if __name__ == '__main__':
    main()


Measured memory_bytes: 9488
from bisect import bisect_right as br
import sys
input=sys.stdin.readline
#s=input()
#l=list(map(int,input().split()))
N=int(input())
A=[int(input()) for i in range(N)]
s=[A[-1]]
for i in range(N-2,-1,-1):
    k=br(s,A[i])
    if len(s)==k:
        s.append(A[i])
    else:
        s[k]=A[i]
print(len(s))


Measured memory_bytes: 48860
import sys
from operator import itemgetter
input = sys.stdin.readline
n = int(input())
l = [tuple(map(int,input().split())) for _ in range(n)]
l.sort(key=itemgetter(1))
a = 0
flag = 0
for _ in range(n):
  a += l[_][0]
  if a > l[_][1]:
    print('No')
    flag = 1
    break
if flag == 0:
  print('Yes')

Measured memory_bytes: 31872
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
#define N 100010
typedef long long ll;
const ll inf=2e18;
inline int read(){
	int x=0,f=1;
	char c=getchar();
	while(c<'0'||c>'9'){
		if(c=='-')f=-1;
		c=getchar();
	}
	while(c>='0'&&c<='9'){
		x=(x<<1)+(x<<3)+c-'0';
		c=getchar();
	}
	return x*f;
}
ll ans;
int n,a[N];
ll s[N],res;
int main(){
	n=read();
	for(int i=0;i<=n;++i){
		a[i]=read();
	}
	for(int i=n;i>=0;--i){
		s[i]=s[i+1]+a[i];
	}
	if(!n){
		return !printf("%d\n",a[0]==1?1:-1);
	}
	else if(a[0]){
		return !printf("-1\n");
	}
	res=ans=1;
	for(int i=1;i<=n;++i){
		res=min(inf,(res-a[i-1])<<1);
		if(res<a[i]){
			return !printf("-1\n");
		}
		ans+=min(res,s[i]);
	}
	printf("%lld\n",ans);
	return 0;
}



Measured memory_bytes: 4924
#include <stdio.h>

int main(void) {

  char s[4];
  scanf("%s", s);
  if (s[0] == 'R' && s[1] == 'R' && s[2] == 'R') {
    printf("3\n");
  } else if (s[0] == 'R' && s[1] == 'R') {
    printf("2\n");
  } else if (s[1] == 'R' && s[2] == 'R') {
    printf("2\n");
  } else if (s[0] == 'S' && s[1] == 'S' && s[2] == 'S') {
    printf("0\n");
  } else {
    printf("1\n");
  }

  return 0;
}

Measured memory_bytes: 1624
#include <bits/stdc++.h> 
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vl;
typedef pair<ll,ll> pll;
#define vbi vector<bool> 
#define mod 1000000007
#define INF 1000000000
#define all(x) x.begin(),x.end()
#define mp make_pair
#define pb push_back
#define sd second
#define ft first
#define ms(x,v) memset(x,v,sizeof x)
#define endl '\n'
#define cnl cout<<endl;
#define frr(i,b) for(ll i=0; i<b;i++)
#define fb(i,b) for(ll i=b-1; i>=0; i--)
#define pi  3.141592653589793238
ll i,j,k;
void solve()
{
  ll a,b;cin>>a>>b;
  if(a>9 or b>9) cout<<-1<<endl;
  else cout<<(a*b)<<endl;
 
}
signed main(){
   
    solve();

  return 0;
}



Measured memory_bytes: 256
MOD=10**9+7
cnt=0; sum=0; prev=nil; can=true; h=Hash.new(0)
def gs() gets.chomp end
def gi() gets.to_i end
def gsmi() gets.chomp.split.map(&:to_i) end

def desc(ar) ar.sort!{|x,y|y<=>x} end
def min(a,b) a<=b ? a : b end
def max(a,b) a>=b ? a : b end
def sum(ar) ar.inject(:+) end

def bs(ar,eq,n) en=(eq==1 ? :>= : :>); ar.bsearch_index{|x|x.send(en,n)} end
def C(a,b) b==0||a==b ? 1 : (b=a-b if a/2<b;(a-b+1..a).inject(:*)/(1..b).inject(:*)) end

def puts_yesno(can) puts(can ? 'Yes' : 'No') end
def putsend(s) puts s; exit end
def debug(k,v) puts "#{k}:#{v}" end
########### ( ˘ω˘ )ｽﾔｧ… ###########
n = gi
a = gsmi

b = (1..n).to_a
a = a.zip(b).sort
puts a.map{|i|i[1]}.join(" ")


Measured memory_bytes: 21504
#include<bits/stdc++.h>
using namespace std;
int N, M;
int A[10];
int dp[100001];

bool Check(int k)
{
  fill_n(dp, 100001, -1);
  dp[0] = 0;
  for(int i = 0; i < N; i++) {
    for(int j = 0; j <= M; j++) {
      if(dp[j] >= 0) {
        dp[j] = k;
      } else if(j < A[i] || dp[j - A[i]] <= 0) {
        dp[j] = -1;
      } else {
        dp[j] = dp[j - A[i]] - 1;
      }
    }
  }
  return(dp[M] >= 0);
}


int main()
{
  while(cin >> N >> M, N) {
    for(int i = 0; i < N; i++) {
      cin >> A[i];
    }
    int low = 0, high = M / *min_element(A, A + N);
    while(high - low > 0) {
      int mid = (low + high) >> 1;
      if(Check(mid)) high = mid;
      else low = mid + 1;
    }
    cout << low << endl;
  }
}

Measured memory_bytes: 1548
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
using Graph = vector<vector<int>>;
const int INT_INF = 1001001001;
//stoi(s) : string→int stoll(s) :string→longlong  int→string to_string(i)
const double PI = acos(-1.0);
//小数点の表し方 cout << fixed << setprecision(5);

int main(){
    ll a,b,c;
    cin >> a >> b >> c; 
    if(c - a - b <= 0){
        cout << "No" << endl;
        return 0;
    }else{
        ll X = (c-a-b)*(c-a-b);
        ll Y = 4 * a * b;
        if(X > Y) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
}

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

int main(){
    int n,m[110]={},sum[110]={};
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>m[i];
        sum[i]=sum[i-1]+m[i];
    }
    int ans=10000000;
    for(int i=0;i<=n;i++){
        ans=min(abs(sum[n]-2*sum[i]),ans);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#define LL long long
using namespace std;
int n, i;
LL sum;
int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cin >> n;
	for (i = 1; i <= n; i++)
		if (i % 3 && i % 5)
			sum += i;
	cout << sum;
	return 0;
}

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


int main() {
	
	int N, M, mcnt=0;
	cin >> N;
	multiset<string> s1, t;
	set<string> s2;
	for(int i=0; i<N; i++){
		string r;
		cin >> r;
		s1.insert(r);
		s2.insert(r);
	}
	cin >> M;
	for(int i=0; i<M; i++){
		string r;
		cin >> r;
		t.insert(r);
	}
	for(auto i:s2){
		int cnt = 0;
		cnt += s1.count(i);
		cnt -= t.count(i);
		mcnt = max(cnt, mcnt);
	}
	cout << mcnt << endl;
	
	
	return 0;
}

Measured memory_bytes: 384