akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
using namespace std;

int main()
{
  string w;
  int m, h, tmp;
  
  for (;;) {
    cin >> w;
    if (w == "-") break;
    cin >> m;
    h = 0;
    for (int i = 0; i < m; i++) {
      cin >> tmp;
      h = (h + tmp) % w.length();
    }
    cout << w.substr(h) + w.substr(0, h) << endl;
  }
  return 0;
}



Measured memory_bytes: 3216
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std;

typedef long long ll;
const int MAX=1e5+10;
const int mod=1e9+7;
const int inf=0x3f3f3f3f;
const int d[4][2]={{1,0},{-1,0},{0,1},{0,-1}};

bool Check(int k,const int l,const string& s,char* ans){
    if(k>1){
        if(ans[k-1]=='S'&&(s[k-1]=='o'^ans[k-2]==ans[k])||ans[k-1]=='W'&&(s[k-1]=='o'^ans[k-2]!=ans[k]))
            return false;
        if(k==l-1){
            for(int i=0;i<2;i++){
                if(ans[(k+i+l)%l]=='S'&&(s[(k+i+l)%l]=='o'^ans[(k+i-1+l)%l]==ans[(k+i+1+l)%l])||ans[(k+i+l)%l]=='W'&&(s[(k+i+l)%l]=='o'^ans[(k+i-1+l)%l]!=ans[(k+i+1+l)%l]))
                    return false;
            }
        }
    }
    return true;
}

void solve(int depth,const int l,const string& s,bool& f,char* ans,const string& t){
    if(depth==l){
        f=true;
        return;
    }
    for(int i=0;i<2;i++){
        ans[depth]=t[i];
        if(Check(depth,l,s,ans)){
            solve(depth+1,l,s,f,ans,t);
            if(f) return;
        }
    }
}

int main(){
    int l;
    string s,t="SW";
    while(cin>>l>>s){
        bool f=false;
        char ans[100002]={0};
        solve(0,l,s,f,ans,t);
        if(f) puts(ans);
        else puts("-1");
    }
    return 0;
}


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

int main() {
    int n, ans = 0, brick_number = 1;
    bool satisfied = false;
    cin >> n;
    for (int i = 0; i < n; i++) {
        int a;
        cin >> a;
        if (a == brick_number)
            brick_number += 1;
        if (a == 1)
            satisfied = true;
    }
    if (satisfied) cout << n - brick_number + 1 << endl;
    else cout << -1 << endl;
}

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

void insert(int _value);
void delete(int _value);
void deleteFirst(void);
void deleteLast(void);

struct Node{

  struct Node* next;
  struct Node* prev;
  int value;

};

struct Node* head;
struct Node* tail;
main(){

  int i;
  int n;
  int tmpValue;
  char str[20];
  struct Node* node;

  head = (struct Node*)malloc(sizeof(struct Node));
  tail = (struct Node*)malloc(sizeof(struct Node));
  head->next = tail;
  head->prev = NULL;
  tail->next=NULL;
  tail->prev=head;
  head->value = 0;
  tail->value=0;

  scanf("%d",&n);

  for(i=0; i<n; i++){
    scanf("%s",str);
    if(!strcmp(str,"insert")){
      scanf("%d",&tmpValue);
      insert(tmpValue);
    }else if(!strcmp(str,"deleteFirst")){
      deleteFirst();
    }else if(!strcmp(str,"deleteLast")){
      deleteLast();
    }else if(!strcmp(str,"delete")){
      scanf("%d",&tmpValue);
      delete(tmpValue);
    }
  }

  for(node=head->next; node != tail; node=node->next){
    printf("%d",node->value);
    if(node->next!=tail){
      printf(" ");
    }
  }
  printf("\n");

  return 0;

}

void insert(int _value){

  struct Node* newNode;
  struct Node* tmpNode;

  newNode = (struct Node*)malloc(sizeof(struct Node));

  tmpNode = head->next;
  if(tmpNode != NULL){
    tmpNode->prev = newNode;
  }
  head->next = newNode;
  newNode->next = tmpNode;
  newNode->prev = head;

  newNode->value = _value;

}

void delete(int _value){

  struct Node* node;
  struct Node* tmpNode;
  for(node=head->next; node != NULL; node=node->next){
    if(node->value == _value){
      tmpNode = node->prev;
      if(tmpNode != NULL){
	tmpNode->next = node->next;
      }
      if(node->next != NULL){
	node->next->prev = tmpNode;
      }
      break;
    }
  }

}

void deleteFirst(){

  struct Node* node;
  //  struct Node* tmpNode;
  node=head->next;

  //  tmpNode = node->prev;
  //tmpNode = head;

  if(head != NULL){
    //tmpNode->next = node->next;
    head->next= node->next;
  }
  if(node->next != NULL){
    //   node->next->prev = tmpNode;
    node->next->prev = head;
  }
  free(node);

}

void deleteLast(){

  //struct Node* node;
  //  struct Node* tail;

  struct Node* tmpNode;

  //  for(node=head->next; node->next != NULL; node=node->next){}//node==tail
  // for(tail=head->next; tail->next != NULL; tail=tail->next){}//node==tail

  /* tmpNode = tail->prev;

  if(tmpNode != NULL){
    tmpNode->next = NULL;
  }
  if(tail->next != NULL){
    tail->next->prev = tmpNode;
    }*/
  tmpNode=tail->prev;
  tail->prev=tmpNode->prev;
  tmpNode->prev->next=tail;

  free(tmpNode);

}

Measured memory_bytes: 11000
#include <iostream>
#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;

int main(){
  long n;
  cin >> n;
  long long a[n];
  rep(i,n){
    cin >> a[i];
    if(a[i] == 0){
      cout << 0;
      return 0;
    }
  }
  
  for(int i=1; i<n; i++){
    if(1000000000000000000/a[0] < a[i]){
      cout << -1;
      return 0;
    }
    a[0] = a[0] * a[i];
  }
  
  cout << a[0] << endl;
  
  return 0;
}


Measured memory_bytes: 4344
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <set>
#include <map>
using namespace std;

int h;
int w;
int a;
int b;

typedef long long ll;

ll MOD = 1e9 + 7;

ll inv_mod( ll a, ll m = MOD )
{
  ll b, x, u, q, abs_m, tmp; 

  abs_m = ( m < 0 ) ? -m : m;
  b = m; x = 1; u = 0; 
  while ( b > 0 ) {
    q = a / b; 
    tmp = u; u = x - q * u; x = tmp;
    tmp = b; b = a - q * b; a = tmp;
  }

  return ( x < 0 ) ? abs_m + x : x;
}

ll fact[200010];

ll nCr(int n,int r)
{
	return fact[n] * inv_mod(fact[r]) % MOD * inv_mod(fact[n - r]) % MOD;
}

int main()
{
    fact[0] = 1;
    for(int i = 1;i <= 200000;i++)
    {
        fact[i] = (fact[i - 1] * i) % MOD;
    }

    cin >> h >> w >> a >> b;

    ll result = 0;

    for(int i = 0;i < h - a;i++)
    {
        result += nCr(i + b - 1,i) * nCr(h - i + w - b - 2,h - i- 1);
        result = result % MOD;
    }

    cout << result << endl;
    return 0;

}



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

int main(){
    unsigned long long a, b, x, A, B;
    cin >> a >> b >> x;
    if(a%x==0){
        cout << ((b/x)-(a/x)+1) << endl;
    }else{
        cout << ((b/x)-(a/x)) << endl;
    }
}

Measured memory_bytes: 256
dates = []
youbi = []

for i in range(1,13):
    if i == 1 or i == 3 or i == 5 or i == 7 or i == 8 or i == 10 or i == 12:
        for j in range(1,32):
            dates.append([i,j])
    elif i == 4 or i == 6 or i == 9 or i == 11:
        for j in range(1,31):
            dates.append([i,j])
    elif i == 2:
        for j in range(1,30):
            dates.append([i,j])

while True:
    x = map(int, raw_input().split(' '))
    if x == [0,0]:
        for yo in youbi:
            print yo
        break
    elif dates.index(x) % 7 == 0:
        youbi.append('Thursday')
    elif dates.index(x) % 7 == 1:
        youbi.append('Friday')
    elif dates.index(x) % 7 == 2:
        youbi.append('Saturday')
    elif dates.index(x) % 7 == 3:
        youbi.append('Sunday')
    elif dates.index(x) % 7 == 4:
        youbi.append('Monday')
    elif dates.index(x) % 7 == 5:
        youbi.append('Tuesday')
    elif dates.index(x) % 7 == 6:
        youbi.append('Wednesday')

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

int main() {
  double n, k;
  cin >> n >> k;
  double ans = 0;
  for (int i = 1; i <= n; i++) {
    int p = ceil(log2(k/(double)i));
    double tmp = 1/n;
    for (int j = 0; j < p; j++) {
      tmp /= 2.0;
    }
    ans += tmp;
  }
  printf("%.16lf\n", ans);
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
struct ii {
    int a, b;
    bool operator < (ii o) const {
        return tie(a, b) < tie(o.a, o.b);
    }
};
struct iii {
    int a, b, c;
    bool operator < (iii o) const {
        return tie(a, b, c) < tie(o.a, o.b, o.c);
    }
};

const int MOD = 1000000007;
const int INF = 1000000000;
const int MAXN = 3005;

ll R, C, K;
ll v[MAXN][MAXN], dp[MAXN][MAXN][5];

ll f(ll r, ll c, ll pr) {
    if (r == R && c == C) return pr == 3 ? 0 : v[r][c];
    ll &ret = dp[r][c][pr];
    if (ret == -1) {
        ret = 0;
        if (r < R) {
            ret = max(ret, f(r+1, c, 0));
            if (pr < 3) ret = max(ret, f(r+1, c, 0)+v[r][c]);
        }
        if (c < C) {
            ret = max(ret, f(r, c+1, pr));
            if (pr < 3) ret = max(ret, f(r, c+1, pr+1) + v[r][c]);
        }
    }
    return ret;
}

int main() {
    ios::sync_with_stdio(0); cin.tie(0);
    
    cin >> R >> C >> K;
    for (int i = 0; i < K; i++) {
        int r, c, k;
        cin >> r >> c >> k;
        v[r][c] = k;
    }
    memset(dp, -1, sizeof(dp));
    cout << f(0, 0, 0) << "\n";
    
}


Measured memory_bytes: 427056
import java.util.*

fun main(args:Array<String>){
    val n = readLine()!!.toInt()
    val s = mutableListOf<Triple<String, Int, Int>>()
    for(i in 1 .. n){
        val (a,b) = readLine()!!.split(" ")
        s.add(Triple(a, b.toInt(), i))
    }
    s.sortByDescending{it.second}
    s.sortBy{it.first}
    s.forEach{println(it.third)}
}


Measured memory_bytes: 37688
n,d = map(int, input().split(" "))
count = 0
values = []

for _ in range(n):
    values.append([int(x) for x in list(input().split(" "))])


for i in range(n-1):
    for j in range(i+1,n):
        total = 0
        for k in range(d):
            total += (values[i][k] - values[j][k])**2
        distance = total**(1/2)
        if distance%1 == 0:
            count += 1

print(count)

Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <cmath>
#include <string>
#include <sstream>
#include <iomanip>
#include <complex>
using namespace std;

#define ll long long
#define vvi vector< vector<int> >
#define vi vector<int>
#define All(X) X.begin(),X.end()
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back
#define pii pair<int,int>
#define mp make_pair
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;}

int main(){
	int H,W;
	while(1){
		cin >> H >> W;
		if(H==0&&W==0) break;
		REP(i,H){
			REP(j,W){
				if(i==0||i==H-1) cout << "#";
				else if(j==0||j==W-1) cout << "#";
					else cout << ".";
			}
			cout << endl;
		}
		cout << endl;
	}
}

Measured memory_bytes: 1152
//UnhappyHacking.cpp (B)
#include <iostream>
#include <string>
using namespace std;

int main(){
  string S,Ans;
  cin >> S;
  int l = S.size();
  Ans = "";
  for(int i = 0; i < l; i++){
    if(S[i] == '0') Ans += '0';
    else if(S[i] == '1') Ans += '1';
    else{
      if(Ans.size() != 0) Ans.pop_back();
    }
  }
  cout << Ans << endl;

}


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

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

  vector<int> a(n), b(n);
  for (int i = 0; i < n; ++i)
    cin >> a[i];
  for (int i = 0; i < n; ++i)
    cin >> b[i];

  ll sum_a = 0, sum_b = 0;
  for (int i = 0; i < n; ++i)
    sum_a += a[i];
  for (int i = 0; i < n; ++i)
    sum_b += b[i];

  ll cnt = sum_b - sum_a;

  ll cnt_1 = 0, cnt_2 = 0;
  for (int i = 0; i < n; ++i) {
    int x = b[i] - a[i];
    if (x < 0)
      cnt_1 += abs(x);
    else
      cnt_2 += (x + 1) / 2;
  }

  if (cnt >= cnt_1 && cnt >= cnt_2)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

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

int main()
{
    string s;
    cin >> s;
    if((s[0]==s[1] and s[1]==s[2]) or (s[1]==s[2] and s[2]==s[3])) cout << "Yes";
    else cout << "No";
}



Measured memory_bytes: 3592
s=input()
t=input()

len_s=len(s)
len_t=len(t)

DP=[[0 for j in range(len_t+1)] for i in range(len_s+1)]


for i in range(1,len_s+1):
    for j in range(1,len_t+1):
        if s[i-1]==t[j-1]:
            DP[i][j]=DP[i-1][j-1]+1
        else:
            DP[i][j]=max(DP[i-1][j],DP[i][j-1])
            
        
x,y=len_s,len_t
ANS=""

while x>0 and y>0:
    if x>0 and DP[x-1][y]==DP[x][y]:
        x-=1
    elif y>0 and DP[x][y-1]==DP[x][y]:
        y-=1
    else:
        ANS+=s[x-1]
        x-=1
        y-=1

print(ANS[::-1])

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

using namespace std;

string substr(string a, int l, int r) {
	string res = "";
	for (int i = l ; i <= r; i++)
		res += a[i];
	return res;
}

bool used[30];

int main() {
	
	string s;
	cin >> s;
	for (auto x : s) {
		used[ x - 'a' ] = true;
	}
	
	for (int i = 0; i < 26; i++) {
		if (!used[i] ) {
			cout << s << (char)('a' + i) << endl;
			return 0;
		}
	}
	
	string best;
	bool no_sol = true;
	
	for (int i = 0; i < s.size(); i++) {
		for (int j = i+1; j < s.size(); j++) {
			string tmp = substr(s,0,i-1) + s[j];
			if (tmp > s) {
				if (no_sol or tmp < best) {
					best = tmp;
					no_sol = false;
				}
			}
			
		}
	}
	
	if (no_sol)
		cout << -1 << endl;
	else
		cout << best << endl;
}


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

using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;


#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))

int dx4[4] = {1,0,-1,0}, dy4[4] = {0,1,0,-1};


int main()
{
    vector<int> a(3);
    for (int i = 0; i < 3; i++)
    {
        cin>>a[i];
    }
    bool ok=false;
    for (int i = 0; i < 3; i++)
    {
        if(a[i%3]==a[(i+1)%3]&& a[i%3]!=a[(i+2)%3])
        {
            ok=true;
        }
    }
    if(ok) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    
    return 0;
}

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

int main() {
    long long a, b, x;
    cin >> a >> b >> x;
    if ( a == 0 ) {
        cout << b/x + 1 << endl;
    }
    else {
        cout << b/x - (a-1)/x << endl;
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <stdio.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
#include <sstream>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define FOR(i,a,b) for(int i=a; i<(int)(b); i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort(ALL(x))
#define CLR(a) memset((a), 0 ,sizeof(a))
#define PB push_back
#define MP make_pair
#define SP << " " <<
const int INF = 1001001001;
const ll LINF = 100100100100100100;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

__attribute__((constructor))
void initial(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}

int h,w;
string s[50];
int visited[50][50];
int dx[4]={1,0,-1,0}, dy[4]={0,1,0,-1};

int dfs(int x, int y){
  // visited[y][x] = cnt;
  int cnt = visited[y][x]+1;
  rep(i,4){
    int nx=x+dx[i], ny=y+dy[i];
    if(nx<0||nx>=w||ny<0||ny>=h) continue;
    if(s[ny][nx]=='.'){
      if(visited[ny][nx]<=cnt) continue;
      visited[ny][nx] = cnt;
      dfs(nx,ny);
    }
    // if(nx==w-1&&ny==h-1){
    //   visited[h-1][w-1] = cnt;
    //   return visited[h-1][w-1];
    // }
  }
  return visited[h-1][w-1];
}

signed main(){
	cin>>h>>w;
  rep(i,h) cin>>s[i];
  int sub = 0;
  rep(i,h){
    rep(j,w){
      if(s[i][j]=='.') sub++;
      visited[i][j] = INF;
    }
  }
  visited[0][0] = 1;
  int ans = dfs(0,0);
  if(ans!=INF) cout << sub-ans << endl;
  else cout << -1 << endl;
	return 0;
}


Measured memory_bytes: 512
// I need some holiday
// But I don't wish that everyday is holiday
// Because I didn't bear the pain
// Because it wasn't a true freedom
//         ——『イヤホンと蝉時雨』·Orangestar

#include <bits/stdc++.h>

using namespace std;

typedef long long LL;
typedef unsigned int UI;
typedef pair<int, int> pii;

#define DEBUG(...) fprintf(stderr, __VA_ARGS__)
#define MP make_pair
#define fst first
#define snd second
#define SZ(u) ((int) (u).size())
#define ALL(u) (u).begin(), (u).end()

inline void proc_status()
{
	ifstream t("/proc/self/status");
	cerr << string(istreambuf_iterator<char>(t), istreambuf_iterator<char>()) << endl;
}

template<typename T> inline int chkmin(T &a, const T &b) { return b < a ? a = b, 1 : 0; }
template<typename T> inline int chkmax(T &a, const T &b) { return b > a ? a = b, 1 : 0; }
template<typename T> inline T sqr(const T &val) { return val * val; }

namespace fastIO
{
	const int MAX_BUFFER_SIZE = 1 << 16;

	char buffer[MAX_BUFFER_SIZE], *cur = buffer, *ed = buffer;

	inline char getc() { return cur == ed && (ed = (cur = buffer) + fread(buffer, 1, MAX_BUFFER_SIZE, stdin), cur == ed) ? EOF : *cur++; }
}
using fastIO::getc;

template<typename T> inline T read()
{
	register T sum(0), fg(1);
	register char ch(getc());
	for(; !isdigit(ch); ch = getc()) if(ch == '-') fg = -1;
	for(;  isdigit(ch); ch = getc()) sum = sum * 10 - '0' + ch;
	return sum * fg;
}

inline char *read_str(char *s)
{
	register char ch(getc());
	while(!isgraph(ch)) ch = getc();
	for(; isgraph(ch); ch = getc()) *s++ = ch;
	*s = '\0';
	return s;
}

// END tpl.

const int MAXN = 300;

int n, m;

int a[MAXN + 5][MAXN + 5];

inline void input()
{
	n = read<int>(), m = read<int>();
	for(int i = 1; i <= n; ++i)
		for(int j = 1; j <= m; ++j)
			a[i][j] = read<int>();
}

inline void solve()
{
	static int cnt[MAXN + 5], p[MAXN + 5], ban[MAXN + 5];

	for(int i = 1; i <= n; ++i) ++cnt[a[i][1]], p[i] = 1;

	int ans = *max_element(cnt + 1, cnt + m + 1);
	for(int k = 1; k < m; ++k)
	{
		int pos = max_element(cnt + 1, cnt + m + 1) - cnt;
		ban[pos] = 1;
		for(int i = 1; i <= n; ++i) while(ban[a[i][p[i]]]) --cnt[a[i][p[i]]], ++cnt[a[i][++p[i]]];
		chkmin(ans, *max_element(cnt + 1, cnt + m + 1));
	}
	printf("%d\n", ans);
}

int main()
{
#ifdef K_ON
	freopen("B.in", "r", stdin);
	freopen("B.out", "w", stdout);
#endif

	input();
	solve();

	return 0;
}




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

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

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

    return arr

n = int(input())
if n == 1:
    print(0)
    exit()

a = factorization(n)
#print(a)

ans = 0
for i in range(len(a)):
    check = 1
    while a[i][1] >= check:
        a[i][1] = a[i][1] - check
        ans = ans + 1
        check = check + 1

print(ans)

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

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

	int W, H, x, y, r;
	cin >> W >> H >> x >> y >> r;
	if ((x < r) || (y < r)) cout << "No" << "\n";
	else if(((x+r) > W)||((y+r) > H))cout << "No" << "\n";
	else cout << "Yes" << "\n";
	return 0;
}


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

int main(){
  struct test{
    int Math;
    int English;
    int Japanese;
  };

  int n;
  double total;
  test student;

  while(1){
    total=0;
    cin >> n;
    if(n==0)break;

    for(int i=0;i<n;i++){
      char rank='A';
      while(1){
	cin >> student.Math >> student.English >> student.Japanese;
	if(student.Math==100||student.English==100||student.Japanese==100)break;
	total=student.Math+student.English;
	total=total/2;
	if(total>=90)break;
	total=student.Math+student.English+student.Japanese;
	total=total/3;
	if(total>=80)break;
	
	rank='B';
	if(total>=70){
	  break;
	}
	if(total>=50&&(student.Math>=80||student.English>=80))break;
	
	rank='C';
	if(1)break;
      }
      cout << rank << endl;
    }
  }
  return 0;
}

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


int main()
{
    int n, t, a, h; cin >> n >> t >> a;

    vector<pair<double,int>>x(n);
    for(int i = 0;i < n;i++)
    {
        cin >> h;
        x.at(i).first = abs(t - h * 0.006 - a);
        x.at(i).second = i + 1;
    }

    sort(x.begin(), x.end());
    cout << x.at(0).second << endl;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp make_pair
#define pb push_back
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)



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

  ll tmin=a[0];
  ll tpro=0;
  ll c=0;
  ll fac=1LL;
  rep1(i,n-1){
    if(a[i]-tmin>tpro){
      c=1LL*fac;
      tpro=a[i]-tmin;
    }
    else if(a[i]-tmin==tpro){
      c+=fac;
    }
    else if(tmin > a[i]){
      tmin=a[i];
      fac=1LL;
    }
    else if(tmin == a[i]){
      fac++;
    }
  }
  cout << c << endl;
  return 0;

}


Measured memory_bytes: 1024
n, k = map(int, input().split())
arr = []
for _ in range(n):
    arr.append(int(input()))

def check(x):
    cnt, tmp = 0, 0
    for i in range(n):
        if x < arr[i]:
            return False
        elif tmp + arr[i] > x:
            tmp = arr[i]
            cnt += 1
        else:
            tmp += arr[i]
        if i == n - 1 and tmp > 0:
            cnt += 1
    return cnt <= k

l, r = 1, int(1e9 + 1)
while l < r:
    mid = (l + r) >> 1
    if check(mid):
        r = mid
    else:
        l = mid + 1
print(l)


Measured memory_bytes: 9572
n = int(input())
s = input()
res = 0

for i in range(1, n):
#    print(s[:i] + '---' +s[i:])

    count = 0
    for c in set(s[:i]):
        if c in s[i:]:
            count += 1

    res = max(res, count)
    
print(res)


Measured memory_bytes: 3064
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <string>
#include <cmath>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <list>
#include <iostream>
#include <climits>
#include <cfloat>


using namespace std;

int main()
{
	int n;
	while (scanf("%d", &n), n)
	{
		int hoge[2][32];
		for (int i = 0; i < n; ++i)
		{
			int t;
			scanf("%d", &t);
			hoge[0][i] = t;
		}

		for (int i = 0; ; ++i)
		{
			int* cur = hoge[i & 1];
			int* next = hoge[(i+1) & 1];
			map<int, int> c;
			for (int j = 0; j < n; ++j)
				++c[cur[j]];

			for (int j = 0; j < n; ++j)
				next[j] = c[cur[j]];

			bool eq = true;
			for (int j = 0; eq && j < n; ++j)
				eq = cur[j] == next[j];

			if (eq)
			{
				printf("%d\n", i);
				for (int j = 0; j < n; ++j)
				{
					printf("%d", cur[j]);
					if (j != n-1)
						printf(" ");
					else
						printf("\n");
				}
				break;
			}
		}
	}

	return 0;
}

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

int pertition(int*, int, int);

main(){
  int n, i, r, *A;

  scanf("%d", &n);
  A = malloc(sizeof(int)*n);
  for(i=0; i<n; i++) scanf("%d", A+i);

  r = partition(A, 0, n-1);

  for(i=0; i<n; i++){
    if(i==r) printf("[%d]", A[i]);
    else printf("%d", A[i]);

    if(i != n-1) printf(" ");
    else printf("\n");
  }

  free(A);
  return 0;
}

int partition(int *A, int p, int r){
  int x = A[r];
  int i = p-1;
  int j, tmp;

  for(j=p; j<r; j++){
    if(A[j] <= x){
      i = i+1;
      tmp = A[i];
      A[i] = A[j];
      A[j] = tmp;
    }
  }
  tmp = A[i+1];
  A[i+1] = A[r];
  A[r] = tmp;

  return i+1;
}

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

int main() {
	int a, b;
	char op;
	
	while (1) {
		cin >> a >> op >> b;

		if (op == '?') break;
		else if (op == '+') cout << a + b << endl;
		else if (op == '-') cout << a - b << endl;
		else if (op == '*') cout << a * b << endl;
		else if (op == '/') cout << a / b << endl;
	}

	return 0;
}



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

int main(){
    int n;
    cin>>n;
    int a[100002];
    a[0]=0;
    for(int i=0; i<n; i++){
        cin>>a[i+1];
    }
    a[n+2-1]=0;

    int tc=0;
    for(int i=0; i<n+2-1; i++){
        tc+=abs(a[i]-a[i+1]);
    }
    for(int i=1; i<n+2-1; i++){
        int cc=abs(a[i-1]-a[i])+abs(a[i]-a[i+1])-abs(a[i-1]-a[i+1]);
        cout<<tc-cc<<endl;
    }


    return 0;
}


Measured memory_bytes: 1664
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,a[109],num=0;;
    cin>>n;
    for(int i=1;i<=n;i++)
        cin>>a[i];
    for(int i=1;i<=n;i+=2)
        if(a[i]%2)
        num++;
    cout<<num;
    return 0;
}


Measured memory_bytes: 3440
#include <bits/stdc++.h>
#define rep(i, a, n) for(int (i) = (int)(a);(i) < (int)(n);++(i))
#define repe(i, a, n) for(int (i) = (int)(a);(i) <= (int)(n);++(i))
#define repif(i, a, x) for(int (i) = (int)(a);(x);++(i))
#define repr(i, a, n) for(int (i) = ((int)(a)-1);(i) >= (int)(n);--(i))
#define reper(i, a, n) for(int (i) = (int)(a);(i) >= (int)(n);--(i))
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define SIZE(x) ((int)(x).size())
#define ALL(x) (x).begin(), (x).end()
#define RNG(x, a, n) &((x)[a]), &((x)[n])
#define ADD(a, b) ((((a+MOD)%MOD)+((b+MOD)%MOD))%MOD)
#define MUL(a, b) ((((a)%MOD)*((b)%MOD))%MOD)
#define CEIL(x) ((int)ceil(((double)x)))
#define POW(x, y) ((int)pow(x, y))
#define UNIQUE(x) (x).erase(unique(ALL((x))), (x).end())
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
#define yes cout << "yes" << endl;
#define no cout << "no" << endl;
#define fcout cout << fixed << setprecision(10)
#define pb push_back
#define pf push_front
#define mp make_pair
#define mt make_tuple
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define EPS (1e-10)
#define INF INT_MAX
#define INFLL LLONG_MAX
#define MOD 1000000007
using llint = long long;
using VI = std::vector<int>;
using PII = std::pair<int, int>;
using SI = std::set<int>;
using MII = std::map<int, int>;
using TIII = std::tuple<int, int, int>;
using MCI = std::map<char, int>;
using VPII = std::vector<PII>;
using namespace std;


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

	cout << min(N*A, B) << endl;

	return 0;
}

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

int main( void ) {
    
    int a, b, c;
    cin >> a >> b >> c;
    
    if( a % 2 == 0 || b % 2 == 0 || c % 2 == 0 )
        cout << 0;
    else
        cout << min( 1LL * a * b, min( 1LL * b * c, 1LL * a * c ) );
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vll = vector<long long>;
using vp = vector<pair<int, int>>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using vvll = vector<vector<long long>>;
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 (b<a) {a=b; return 1;} return 0;}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int a, b;
    cin >> a >> b;
    cout << max(a-b, 0) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
    int n;
    cin >> n;
    int minPage;
    if (n % 2 != 0){
        minPage = n / 2 + 1;
    }else if (n % 2 == 0){
        minPage = n / 2;
    }
    
    cout << minPage << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;
	cin>>N;
  vector<int> S(N);
	for(int i=0;i<N;i++) cin>>S[i];

  long ans;
	for(int i=1;i<N;i++){//進み幅を試す
		long now=0;
		int L=0,R=N-1;//始点と終点を動かしてみる
		while(R>i&&(R%i||L<R)){//Rがまだ移動できる AND (RがLで移動した点を通過しない OR  LとRが交差するほど進んでいない)
			ans=max(ans,now+=S[L]+S[R]);
			L+=i;R-=i;
		}
	}
	cout<<ans<<endl;
}

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

int main() {
    int N, K;
    string S;
    cin >> N ;
    // for (int i = 0; i < N; i++) {
    //     cin  >> S[i];
    // }
    cin >> S;
    cin >> K;
    for (int k = 0; k < N; k++){
        if (S[k] != S[K-1]) S[k] = '*';    // SのK番目と違うなら*にしちゃう
    }

    // for (int j = 0; j < N; j++) {
    //     cout << S[j] << endl;
    // }

    cout << S << endl;
}

Measured memory_bytes: 256
/*

                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                    prayer
*/

// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(long long i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) {rep(_,v.size())cout<<" "<<v[_];cout<<endl;}
#define show2d(v) {rep(__,v.size())show1d(v[__]);}
using namespace std;
//kaewasuretyuui
typedef long long ll;
#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
#define mt make_tuple
typedef tuple<int,int,int,int> tp;
typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
#define yes cout<<"Yes\n"
#define no cout<<"No\n"

template< typename T >
istream &operator>>(istream &is, vector< T > &v) {
  for(T &in : v) is >> in;
  return is;
}

class BEL{
	public:
	struct edge{
		Def to,cost;
	};
	vector<vector<edge> >G;
	Def n;
	vector<Def>d;//distance
	BEL(Def size){
		n=size;
		G=vector<vector<edge> >(n);
	}
	void add_edge(Def a,Def b,Def c){
		edge e={b,c},ee={a,c};
		G[a].pb(e);
//		G[b].pb(ee);
	}
	int bel(Def s){// return 1 -> negative cycle
		d=vector<Def>(n,inf);
		d[s]=0;

		vi used(n);
		rep(i,2*n){
			rep(j,n)rep(k,G[j].size()){
				edge e=G[j][k];
				if(d[j]!=inf&&d[e.to]>d[j]+e.cost){
					d[e.to]=d[j]+e.cost;
					if(i>=n)used[e.to]=true;
				}
				if(used[j])used[e.to]=true;
			}
		}
		if(used[n-1])d[n-1]=inf;
		return d[n-1];
	}
};
signed main(){
	ios::sync_with_stdio(false);
	cin.tie(0);

	int n,m,p;
	cin>>n>>m>>p;
	BEL bel(n);
	rep(i,m){
		int a,b,c;
		cin>>a>>b>>c;
		a--;b--;
		bel.add_edge(a,b,-c+p);
	}
	ll a=bel.bel(0);
	if(a==inf)cout<<-1<<endl;
	else cout<<max(0ll,-a)<<endl;
}


Measured memory_bytes: 512
#![allow(unused_variables, dead_code, clippy::many_single_char_names, unused_imports, unused_macros)]
use std::{
    collections::{HashSet, HashMap, VecDeque},
    io::{stdin, stdout, StdinLock, StdoutLock, BufReader, BufWriter, prelude::*},
    str::FromStr,
};

struct Reader<'a> {
    stdin: BufReader<StdinLock<'a>>
}

trait Integers {
    fn read_int<T: FromStr>(&mut self, cap: usize) -> T;
}

impl<'a> Reader<'a> {
    fn new(stdin: BufReader<StdinLock<'a/*'*/>>) -> Self {
        Self {stdin}
    }

    fn read_str(&mut self, cap: usize) -> String {
        let mut s = String::with_capacity(cap);
        self.stdin.read_line(&mut s).unwrap();

        if s.ends_with('\n') {
            s.pop();
            if s.ends_with('\r') {
                s.pop();
            }
        }
        s
    }

    fn read_vec_u8(&mut self, cap: usize) -> Vec<u8> {
        let mut v = Vec::with_capacity(cap);
        self.stdin.read_exact(&mut v[..]).unwrap();

        v
    }
}

impl<'a> Integers for Reader<'a> {
    fn read_int<T: FromStr>(&mut self, cap: usize) -> T {
        match self.read_str(cap).parse::<T>() {
            Ok(n) => n,
            _ => panic!()
        }
    }
}


const M: usize = 1_000_000;

fn main() {
    let stdin = stdin();
    let stdout = stdout();
    
    solve(&mut Reader::new(BufReader::with_capacity(M, stdin.lock())), &mut BufWriter::with_capacity(M, stdout.lock()));
}

fn solve(r: &mut Reader, w: &mut BufWriter<StdoutLock>) {
    let input = r.read_str(20);
    let mut it = input.split(' ').map(|x| x.parse::<u32>().unwrap());
    let (d, t, s) = (it.next().unwrap(), it.next().unwrap(), it.next().unwrap());

    if t*s < d {
        write!(w, "No").unwrap();
    } else {
        write!(w, "Yes").unwrap();
    }
}


Measured memory_bytes: 2172
#include<bits/stdc++.h>
using namespace std;
int main(){
     long long t,i,n,x;
     int a[1000];
     int s=0,c1=0,c2=0,c=0,p=0,q=0;
     for(i=0;i<5;i++){
                  cin>>a[i];
     }
     for(i=0;i<5;i++){
                 if(a[i]==0) {
                           p=i;

                  break;
                 }
                 else c++;

     }
     cout<<p+1<<endl;

}






Measured memory_bytes: 3556
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;

#define rep(i,n) for(int i = 0; i<n; ++i)
#define REP(i,n) for(int i = 1; i<=n; ++i)
#define all(x) begin(x),end(x)
typedef long long ll;
typedef pair<int,int> ip;
typedef pair<ll,ll> lp;
const int inf = 1001001000;
const ll INF = 1LL<<60;
const int MOD = (int)1e9 + 7;

int main(){
	int N;
	cin>>N;
	vector<int> a(N+1);
	rep(i,N+1)cin>>a[i];
	//if(N==1){cout<<abs(a[1]-a[0])<<endl; return 0;}
	vector<int> dis(N);
	rep(i,N)dis[i] =abs( a[i+1]-a[i]);
	int ans = __gcd(dis[0],dis[1]);
	for(int i = 2; i<N; ++i)ans = __gcd(ans, dis[i]);
		cout<<ans<<endl;
	return 0;
}

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

using namespace std;

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

typedef long long ll;
typedef long double ld;

const int Inf = 1e9;
const double EPS = 1e-9;
const int MOD = 1e9 + 7;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(0);
    int a, b;
    cin >> a >> b;
    if (a < b) {
        rep (i, b) cout << a;
    } else {
        rep (i, a) cout << b;
    }
    cout << endl;
    
    return 0;
}



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

using namespace std;

int main() {
    cin.tie(0);
    cout.tie(0);
    ios_base::sync_with_stdio(0);

    int d, t, s;
    cin >> d >> t >> s;
    if(s * t >= d){
        cout << "Yes\n";
    } else
        cout << "No\n";

}

Measured memory_bytes: 3648
#[allow(unused_imports)]
use std::cmp;

fn run() {
    let (r, w) = (std::io::stdin(), std::io::stdout());
    let mut sc = IO::new(r.lock(), w.lock());

    let x: i64 = sc.read();
    let n: usize = sc.read();
    let p = sc.read_vec::<i64>(n);
    let mut v = vec![false; 102];
    for p in p.into_iter() {
        v[p as usize] = true;
    }
    let mut ans = 10000;
    let mut dif = 10000;
    for pp in 0..=101 {
        if v[pp] == false {
            let dif_p = (pp as i64 - x).abs();
            if dif_p < dif {
                dif = dif_p;
                ans = pp;
            }
        }
    }
    println!("{}", ans);
}

fn main() {
    std::thread::Builder::new()
        .name("run".into())
        .stack_size(256 * 1024 * 1024)
        .spawn(run)
        .unwrap()
        .join()
        .unwrap();
}

pub struct IO<R, W: std::io::Write>(R, std::io::BufWriter<W>);

impl<R: std::io::Read, W: std::io::Write> IO<R, W> {
    pub fn new(r: R, w: W) -> IO<R, W> {
        IO(r, std::io::BufWriter::new(w))
    }
    pub fn write<S: std::ops::Deref<Target = str>>(&mut self, s: S) {
        use std::io::Write;
        self.1.write(s.as_bytes()).unwrap();
    }
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .0
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r' || b == b'\t')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r' && b != b'\t')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn read_vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn read_pairs<T: std::str::FromStr>(&mut self, n: usize) -> Vec<(T, T)> {
        (0..n).map(|_| (self.read(), self.read())).collect()
    }
    pub fn read_pairs_1_indexed(&mut self, n: usize) -> Vec<(usize, usize)> {
        (0..n)
            .map(|_| (self.read::<usize>() - 1, self.read::<usize>() - 1))
            .collect()
    }
    pub fn read_chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
    pub fn read_char_grid(&mut self, n: usize) -> Vec<Vec<char>> {
        (0..n).map(|_| self.read_chars()).collect()
    }
    pub fn read_matrix<T: std::str::FromStr>(&mut self, n: usize, m: usize) -> Vec<Vec<T>> {
        (0..n)
            .map(|_| (0..m).map(|_| self.read()).collect())
            .collect()
    }
}


Measured memory_bytes: 2276
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int64_t MOD=1000000007;
const long long INF = 1LL<<60;
const int B=10;
int main() {
  int64_t ans=-1*INF;
  int N; cin>>N;
  vector<vector<int64_t>> P(N,vector<int64_t>(11));
  vector<bitset<B>> S(N,0);
  rep(i,N){
    rep(j,10){
      int a; cin>>a;
      if(a==1) S.at(i).set(j,1);
    }
  }
  rep(i,N){
    rep(j,11){
      cin>>P.at(i).at(j);
    }
  }
  for(int i=1; i<(1<<B);i++){
    int64_t temp=0;
    bitset<B> s(i);
    rep(j,N){
      bitset<B> C=(S.at(j)&s);
      int c=C.count();
      temp+=P.at(j).at(c);
    }
    ans=max(temp,ans);
  }
  cout<<ans;
}


Measured memory_bytes: 3644
// #include <iostream>
// #include <cstdio>
// #include <algorithm>
// #include <cstring>
// #include <vector>
#include <bits/stdc++.h>
#define maxn 100001
#define ls x << 1
#define rs x << 1 | 1
#define inf 0x3f3f3f3f
#define inc(i) (++ (i))
#define dec(i) (-- (i))
#define mid ((l + r) >> 1)
// #define int long long
#define XRZ 1000000003
#define debug() puts("XRZ TXDY");
#define mem(i, x) memset(i, x, sizeof(i));
#define Next(i, u) for(register int i = head[u]; i ; i = e[i].nxt)
#define file(x) freopen(#x".in", "r", stdin), freopen(#x".out", "w", stdout);
#define Rep(i, a, b) for(register int i = (a) , i##Limit = (b) ; i <= i##Limit ; inc(i))
#define Dep(i, a, b) for(register int i = (a) , i##Limit = (b) ; i >= i##Limit ; dec(i))
int dx[10] = {1, -1, 0, 0};
int dy[10] = {0, 0, 1, -1};
using namespace std;
inline int read() {
    register int x = 0, f = 1; register char c = getchar();
    while(c < '0' || c > '9') {if(c == '-') f = -1; c = getchar();}
    while(c >= '0' && c <= '9') x = x * 10 + c - 48, c = getchar();
    return x * f;
} //long long Ans; int a[maxn], head[maxn];
// priority_queue<int> Q[maxn]; vector<int> s, qwq[maxn];
// struct node { int nxt, to;} e[maxn << 1];
// void add(int x, int y) { e[inc(cnt)] = (node) {head[x], y}; head[x] = cnt;}
// void merge(int x, int y) {
// 	if(Q[x].size() < Q[y].size()) swap(Q[x], Q[y]);
// 	while(Q[y].size()) {
// 		s.push_back(max(Q[x].top(), Q[y].top()));
// 		Q[x].pop(), Q[y].pop();
// 	} while(s.size()) Q[x].push(s.back()), s.pop_back();
// }
// void Dfs(int x) {
// 	Next(i, x) { int v = e[i].to; Dfs(v); merge(x, v);}
// 	Rep(i, 0, qwq[x].size() - 1) Dfs(qwq[x][i]), merge(x, qwq[x][i]);
// 	Q[x].push(a[x]);
// }
signed main() { int d = read(), t = read(), s = read();
	if(d > t * s) puts("No"); else puts("Yes");
	return 0;
}

Measured memory_bytes: 3632
#include<iostream>
using namespace std;
const long mod=1e9+7;
long power(long a,long b){return b?power(a*a%mod,b/2)*(b%2?a:1)%mod:1;}
int N,Q;
int P[1<<17];
long Ps[1<<17];
int cnt[41][1<<17];
long gcd(long a,long b){return b?gcd(b,a%b):a;}
main()
{
	cin>>N>>Q;
	for(int i=0;i<N;i++)cin>>P[i],P[i]--;
	for(int i=0;i<N;i++)
	{
		int c=0,now=i;
		int sum=0;
		do{
			c++;
			sum+=now+1;
			now=P[now];
		}while(now!=i);
		cnt[c][i+1]++;
		Ps[i+1]=sum*power(c,mod-2)%mod;
	}
	for(int i=0;i<N;i++)
	{
		(Ps[i+1]+=Ps[i])%=mod;
		for(int k=1;k<=40;k++)cnt[k][i+1]+=cnt[k][i];
	}
	for(int i=0;i<Q;i++)
	{
		int L,R;cin>>L>>R;
		L--;
		long X=1;
		for(int k=1;k<=40;k++)
		{
			if(cnt[k][R]>cnt[k][L])
			{
				X=X/gcd(X,k)*k;
			}
		}
		cout<<X%mod*(Ps[R]-Ps[L]+mod)%mod<<endl;
	}
}



Measured memory_bytes: 19972
X,Y=map(int, input().split())
MOD=10**9+7

if 2*Y<X or 2*X<Y or (2*Y-X)%3 or (2*X-Y)%3:
    print(0)
    exit()

i=(2*Y-X)//3
j=(2*X-Y)//3

def m_pow(n,m):
    ret = 1
    while m:
        if m&1:
            ret=ret*n%MOD
        n=n*n%MOD
        m>>=1
    return ret

def m_fact(n):
    if n==0:
        return 1
    ret = 1
    for i in range(1,n+1):
        ret=ret*i%MOD
    return ret

def m_comb(n,k):
    return m_fact(n) * m_pow(m_fact(k), MOD-2) * m_pow(m_fact(n-k), MOD-2) %MOD

print(m_comb(i+j,min(i,j)))

Measured memory_bytes: 38384
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <climits>
using namespace std;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, K;
    cin >> N >> K;
    vector<int> A(N);
    for(int i=0; i<N; i++) cin >> A[i];
    vector<int> B(200001, 0);
    for(int i=0; i<N; i++) B[A[i]]++;
    sort(B.begin(), B.end(), greater<int>());
    long long ans = 0;
    for(int i=K; i<=200000; i++){
        ans += B[i];
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1792
#!/usr/bin/env python3
#ABC140 D

import sys
import math
import bisect
sys.setrecursionlimit(1000000000)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
#(n-1) - 異なっているグループの個数(グループの個数-1)
n,k = LI()
s = input()
cnt = 1
for i in range(1,n):
    if s[i] != s[i-1]:
        cnt += 1
ans = n-1 - max(0,(cnt-1)-2*k)
print(ans)


Measured memory_bytes: 39408
/*

    * * * *      *       *     * * *        * *      * * * *    * * * *
    *       *    *     *       *     *    *     *   *          *
    *       *    *   *         *     *   *       *  *          *
    * * * *      * *           * * *     *       *    * * *      * * *
    *      *     *   *         *     *   *       *          *          *
    *       *    *     *       *     *    *     *           *          *
    *        *   *       *     * * *        * *     * * * *    * * * *

*/

#include"bits/stdc++.h"
using namespace std;
typedef long long ll;
#define int               long long
#define ff                first
#define ss                second
#define md                1000000007
#define md1               998244353
#define inf               9000000000000000000
#define minf              -1000000000000000
#define pb                push_back
#define ppb               pop_back
#define in                insert
#define mkp               make_pair
#define mpll              map<ll,ll>
#define len(p)            (ll)p.size()
#define pll               pair<ll,ll>
#define all(v)            v.begin(),v.end()
#define mem(a,t)          memset(a,t,sizeof(a))
#define endl              "\n"
#define ar                array
#define vl                vector<ll>
#define vvl               vector<vl>
#define lb                lower_bound
#define ub                upper_bound
#define be()              begin()
#define en()              end()
#define vpll              vector<pair<ll,ll>>
#define f(i,yha,wha)      for(ll i=yha;i<wha;i++)
#define rf(i,wha,yha)     for(ll i=wha;i>=yha;i--)
#define f0(n)             for(ll i=0;i<n;i++)
#define f1(n)             for(ll i=1;i<=n;i++)
#define fg(i,yha,wha,gap) for(ll i=yha;i<wha;i+=gap)

void flash()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}


void solve()
{
    // cout << setprecision(20) << fixed ;
    // cin >> setprecision(20) >> fixed ;
    ll a;
    // double b;
    cin >> a;
    string b;
    cin >> b;
    ll ans = ((int)b[0] - 48) * a;

    ll val = ((int)b[2] - 48) * 10 + ((int)b[3] - 48);
    // cout << val << endl;

    ans = ans + (a * val) / 100;

    cout << ans << endl;
    // cout << b << endl;
    // double ans = a * b;
    // cout << (ll)ans << endl;


}

int32_t main()
{
    flash();
    int t;
    t = 1;
    // cin >> t;
    while (t--)
    {
        solve();
    }
    return 0;
}


Measured memory_bytes: 3676
#include <bits/stdc++.h>
const char nl = '\n';
using namespace std;
typedef long long ll;
typedef long double ld;
typedef complex<ld> pt;
const int MOD = 1e9 + 7;
const int INF = 0x3f3f3f3f;
const ll INFLL = 0x3f3f3f3f3f3f3f3fLL;
const int N = 404;

int n;
int a[N];
ll sum[N];
ll dp[N][N];

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 = 1; i <= n; i++) {
    sum[i] = sum[i-1] + a[i-1];
  }
  for (int sz = 1; sz < n; sz++) {
    for (int l = 0; l+sz < n; l++) {
      int r = l+sz;
      if (l+1 == r) {
        dp[l][r] = a[l] + a[r];
        continue;
      }
      dp[l][r] = INFLL;
      for (int i = l; i < r; i++) {
        dp[l][r] = min(dp[l][r], dp[l][i] + dp[i+1][r] + sum[r+1] - sum[l]);
      }
    }
  }
  cout << dp[0][n-1] << nl;
  return 0;
}


Measured memory_bytes: 1536
#include<iostream>
using namespace std;
int keta(int z){
  int ans = 0;
  while(z != 0){
    z = z/10;
    ans += 1;
  }
  return ans;
}
int main(){
  int n,i,count;cin >> n;count = 0;
  for (i=1;i<=n;i++){
    if (keta(i)%2==1) count += 1;
  }
  cout << count << endl;
}
  

Measured memory_bytes: 256
#include <stdio.h>

int main(void){

	int i = 1, j = 1;
	int month, days;
	int day[13][32];
	day[1][1] = 3;
	day[2][1] = 6;
	day[3][1] = 0;
	day[4][1] = 3;
	day[5][1] = 5;
	day[6][1] = 1;
	day[7][1] = 3;
	day[8][1] = 6;
	day[9][1] = 2;
	day[10][1] = 4;
	day[11][1] = 0;
	day[12][1] = 2;
	
	for( i = 1; i <= 12; i++) {
		for( j = 2; j <= 31; j++) {
			day[i][j] = ( day[i][j-1] + 1 ) % 7;
		}
	}

	while(1) {
		scanf( "%d%d", &month, &days );
		if( month == 0 ) break;
		if( day[month][days] == 0 )
			printf("Monday\n");
		else if( day[month][days] == 1 )
			printf("Tuesday\n");
		else if( day[month][days] == 2 )
			printf("Wednesday\n");
		else if( day[month][days] == 3 )
			printf("Thursday\n");
		else if( day[month][days] == 4 )
			printf("Friday\n");
		else if( day[month][days] == 5 )
			printf("Saturday\n");
		else
			printf("Sunday\n");
	}

	return 0;
}

Measured memory_bytes: 584