akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i = 0; i < n; ++i)

int main(){
    string s; cin >> s;
    ll sum = 0LL;
    for(int bit = 0; bit < (1<<(s.size()-1)); ++bit){
        int cnt = 0;
        string tmp = "";
        while(cnt < s.size()){
            if(bit&(1<<cnt)){
                tmp += s[cnt];
                sum += stoll(tmp);
                tmp = "";
            }else tmp += s[cnt];
            cnt++;
        }
        sum += stoll(tmp);
    }
    cout << sum << endl;
}

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

int main()
{
    int X, Y;
    cin >> X >> Y;
    bool possible=false;
    for (int i=0; i<=X; i++)
    {
        int leg_num=2*i + 4*(X-i);
        if (leg_num==Y) possible=true;
        if (possible) break;
    }
    if (possible) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 3620
#include <iostream>
#include <queue>
#include <vector>
#include <cmath>
#include <algorithm>
#include <cstring>

using namespace std;

class Edge{
public:
	int p, q; double cost;
	Edge(int p, int q, double cost) : p(p), q(q), cost(cost) {}
	bool operator < (const Edge &e) const { return cost > e.cost; }
};

const int INF = 10000000;
int cap[202][202];
double cost[202][202];

int maximumFlow(int s, int t, int n, double upper){
	int res = 0;
	while(true){
		vector<int> prev(n,-1); prev[s] = 0;
		queue<int> qu; qu.push(s);
		while(!qu.empty()){
			int e = qu.front(); qu.pop();
			for(int i=0;i<n;i++){
				if(cost[e][i] > upper) continue;
				if(cap[e][i]>0&&prev[i]<0){
					prev[i] = e;
					qu.push(i);
				}
			}
		}
		if(prev[t]<0) return res;
		for(int i=t;i!=prev[i];i=prev[i]) cap[prev[i]][i]--, cap[i][prev[i]]++;
		res++;
	}
	return res;
}

int main(){
	int n, m;
	while(cin >> n >> m, n){
		int x[100], y[100], v[100], xx[100], yy[100];
		vector<double> dst;
		int capa[202][202];
		memset(capa, 0, sizeof(capa));
		for(int i=0;i<n;i++) cin >> x[i] >> y[i] >> v[i];
		for(int i=0;i<m;i++) cin >> xx[i] >> yy[i];
		for(int i=1;i<=n;i++) capa[0][i] = 1;
		for(int i=1;i<=n;i++){
			for(int j=n+1;j<=n+m;j++) capa[i][j] = 1;
		}
		for(int j=n+1;j<=n+m;j++) capa[j][n+m+1] = 1;
		for(int i=0;i<n+m+2;i++)
			for(int j=0;j<n+m+2;j++) cost[i][j] = 0;
		for(int i=0;i<n;i++){
			for(int j=0;j<m;j++){
				double dx = x[i]-xx[j];
				double dy = y[i]-yy[j];
				cost[i+1][n+j+1] = sqrt(dx*dx+dy*dy)/v[i];
				dst.push_back(cost[i+1][n+j+1]);
				cost[n+j+2][i+1] = -cost[i+1][i+j+2];
			}
		}
		sort(dst.begin(), dst.end());
		int L = 0, R = dst.size()-1;
		while(L!=R){
			int mid = (L+R)/2;
			memcpy(cap, capa, sizeof(capa));
			if(maximumFlow(0, n+m+1, n+m+2, dst[mid])==m) R = mid;
			else L = mid + 1;
		}
		printf("%.10lf\n",dst[L]); 
	}
}

Measured memory_bytes: 1796
#include <iostream>
#include <utility>
int main(int argc, char *argv[]) {
  int N;
  std::pair<int, int> max = {0, 0};
  std::cin >> N;
  for (int i = 1; i <= N; ++i) {
    int a = i, count = 0;
    while (true) {
      if (a % 2 == 0) {
        a /= 2;
        ++count;
        continue;
      }
      break;
    }
    if (max.second <= count)
      max = {i, count};
  }
  std::cout << max.first << std::endl;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
import sys
from math import *
from itertools import *
from collections import *
from functools import *
try:
    from math import gcd
except Exception:
    from fractions import gcd


def solve(N: int, A: "List[int]"):
    A = sorted([a - i for i, a in enumerate(A, 1)])
    b = A[len(A) // 2]
    return sum([abs(a - b) for a in A])


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
    A = [ int(next(tokens)) for _ in range(N) ]  # type: "List[int]"
    result = solve(N, A)
    print(result)

if __name__ == '__main__':
    main()


Measured memory_bytes: 44944
#include <stdio.h>
int main(void)
{
 int n,x,i,j,k,v;
 
while(1){
   scanf("%d %d",&n,&x);
   if(n==0 && x==0) break ;
   v=0;

       for (i=1; i<=n-2; i++){
          for (j=i+1; j<=n-1; j++ ){
             for (k=j+1; k<=n; k++ ){
                if(i+j+k==x)  v++;
   }
  }
 }
 
   printf("%d\n",v);
}

return 0;
}

Measured memory_bytes: 1756
#include <iostream>
#include <string>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <queue>
#include <stack>

using namespace std;

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define REPO(i, n) for(int i = 1;i <= n;i++)
#define ll long long
#define INF 1999999999
#define MINF -1999999999
#define INF64 1999999999999999999
#define ALL(n) n.begin(),n.end()
#define ABS(a,b) max(a,b) - min(a,b)

ll n, t, a, in[1111], ans,m = INF;
int main() {
	cin >> n >> t >> a;
	REP(i, n) {
		cin >> in[i];
		if (m > ABS(a * 1000, t * 1000 - in[i] * 6)) {
			m = ABS(a * 1000,t * 1000 - in[i] * 6);
			ans = i + 1;
		}
	}
	cout << ans << endl;
}
	


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

int& max(int& a, int& b) {
    return (a > b) ? a : b;
}

int main() {
    int a, b, ans;
    scanf("%d%d", &a, &b);
    for (int i = 0; i < 2; ++i) {
        ans += max(a, b);
        --max(a, b);
    }
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 128
import java.util.Scanner;

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

        int H = sc.nextInt();
        int W = sc.nextInt();
        int h = sc.nextInt();
        int w = sc.nextInt();
        int mass = (H - h) * (W - w);

        System.out.println(mass);
    }
}


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

int main() {
    int N, p[11], sum=0;
    cin >> N;
    for (int i=0;i<N;i++) cin >> p[i];
    sort (p,p+N,greater<int>());
    p[0] /= 2;
    for (int i=0;i<N;i++) sum += p[i];
    cout << sum << '\n';
}


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

using namespace std;

int main() {
  long long a, b, k, t;
  cin >> a >> b >> k;
  t = max(0LL, k - a);
  a = max(0LL, a - k);
  b = max(0LL, b - t);

  cout << a << " " << b << endl;

  return 0;
}

Measured memory_bytes: 256
#include <vector>
#include <iostream>
#include <utility>
#include <algorithm>
#include <string>
#include <deque>
#include <queue>
#include <tuple>
#include <queue>
#include <functional>
#include <cmath>
#include <iomanip>
#include <map>
#include <set>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
#include <complex>
#include <iterator>
#include <array>
#include <memory>
#include <stack>
#define vi vector<int>
#define vvi vector<vector<int> >
#define ll long long int
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define all(in) in.begin(), in.end()
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
#define MAX 9999999
using namespace std;
#define int ll
typedef pair<int, int> pii;
typedef pair<double,double>pdd;
double f(int x,int y){return sqrt(x*x+y*y);}
signed main(){
    int n;
    while(cin>>n,n){
        map<int, pii>mp;
        rep(i,n){
            int hoge; pii foo; cin>>hoge>>foo.first>>foo.second;
            mp[--hoge]=foo;
        }
        vector<vector<pii>>edge(n,vector<pii>());
        for(auto itr=mp.begin();itr!=mp.end();itr++){
            for(auto comp=mp.begin();comp!=mp.end();comp++){
                if(itr==comp)continue;
                double dis=f(abs(itr->second.first-comp->second.first),abs(itr->second.second-comp->second.second));
                if( dis<=50){
                    //cout<<itr->first<<" "<<comp->first<<endl;
                    edge[itr->first].push_back(pii(comp->first,dis));
                }
            }
        }
        int k; cin>>k;
        rep(_,k){
            int s,g; cin>>s>>g;
            --s,--g;
            priority_queue<pii,vector<pii>,greater<pii>>que;
            vector<int>prev(n,INF);
            vector<int>d(n,INF);
            d[s]=0;
            que.push(pii(0,s));
            while(!que.empty()){
                pii now=que.top(); que.pop();
                if(now.second==g)break;
                if(d[now.second]<now.first)continue;
                rep(i,edge[now.second].size()){
                    pii next=edge[now.second][i];
                    if(d[next.first]<d[now.second]+next.second)continue;
                    que.push(pii(d[now.second]+next.second,next.first));
                    d[next.first]=now.first+next.second;
                    prev[next.first]=now.second;
                }
            }
            if(edge[s].size()==0 ||edge[g].size()==0||d[g]==INF)cout<<"NA"<<endl;
            else {
                vi hoge;
                for(int v=g;; v=prev[v]){
                    hoge.push_back(v);
                    if(v==s)break;
                }
                reverse(all(hoge));
                rep(i,hoge.size())if(i)cout<<" "<<hoge[i]+1; else cout<<hoge[i]+1;
                cout<<endl;
            }
        }
    }
}

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

#define fast_io ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
#define cout_precision cout.setf(ios::fixed); cout.precision(32);
#define clr(a) memset(a,0,sizeof(a))
#define umap unordered_map
#define uset unordered_set
#define fr first
#define sc second
#define pb push_back
#define pf push_front
#define M int(1e9+7)
#define endl '\n'
#define largest(a,b,c) (a>b?(a>c? a:c):(b>c? b:c))
#define smallest(a,b,c) (a<b?(a<c? a:c):(b<c? b:c))

using ll = int64_t; using vll = vector<ll>; using vvll = vector<vll>;
using pll = pair<ll, ll>; using vpll = vector<pll>; using vvpll = vector<vpll>;

int n;
int arr[10000000];
string res = "not coprime";
bool isPrime[1000005];
vector <int> primes;
int spf[1000005];
int hash1[1000005] ={0};

void sieve(){
	/*for(int i=0; i<1000005; i++)	isPrime[i] = 1;
	isPrime[0]=isPrime[1] = 0;
	for(int i=2; i*i<1000005; i++){
		if(isPrime[i]){
			for(int j=i*i; j<=1000005; j+=i)	isPrime[j] = 0;
		}
	}
	for(int i=2; i<=1000005; i++)	if(isPrime[i])	primes.pb(i);
	return ;*/
	spf[1] = 1;
	for(int i=2; i<1000005; i++)	spf[i] = i;
	for(int i=4; i<1000005; i+=2)	spf[i] = 2;

	for(int i=3; i*i<1000005; i++){
		if(spf[i] == i){
			for(int j=i*i; j<1000005; j+=i){
				if(spf[j] == j)	spf[j] = i;
			}
		}
	}
}

void getFactorization(int x) 
{ 
    int temp; 
    while (x != 1) { 
        temp = spf[x]; 
        if (x % temp == 0) { 
            hash1[spf[x]]++; 
            x = x / spf[x]; 
        } 
        while (x % temp == 0) 
            x = x / temp; 
    } 
} 

bool check(int x) 
{ 
    int temp; 
    while (x != 1) { 
        temp = spf[x]; 
  
        if (x % temp == 0 && hash1[temp] > 1) 
            return false; 
        while (x % temp == 0) 
            x = x / temp; 
    } 
    return true; 
} 

void f1(){
	int g = arr[0];
	for(int i=1; i<n; i++)	g = __gcd(g,arr[i]);
	if(g != 1)	return ;

	bool flag = 1;
	
	for(int i=0; i<n; i++){
		getFactorization(arr[i]);
	}
	for(int i=0; i<n; i++){
		if(check(arr[i]) == 0){
			flag = 0;	break;
		}
	}

	/*for(int i=1; i<n; i++){
		if(__gcd(arr[0] , arr[i]) != 1){
			flag= 0;	break;
		}
	}*/


	if(flag)	res = "pairwise coprime";
	if(!flag )	res = "setwise coprime";
}


int main(){
	fast_io; cout_precision;
	clr(arr);
	sieve();
	cin >> n;
	for(int i=0; i<n; i++)	cin >> arr[i];
	
	f1();

	cout << res <<endl;

	return 0;
}


Measured memory_bytes: 50520
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
#include<string.h>

typedef struct node{
	char key[25];
	int data;
	int priority;
	struct node *left;
	struct node *right;
}node;

node * Delete(node **,char[]);
node * _delete(node **,char[]);

int find(node *p,char str[]){

	while(p!=NULL){
		if(strcmp(p->key,str)==0)return p->data;
		else if(strcmp(p->key,str)>0)p=p->left;
		else p=p->right;
	}
	
	return 0;
	
}

void update(node *p,char str[],int x){

	while(p!=NULL){
		if(strcmp(p->key,str)==0){
			p->data=x;
			return;
		}
		else if(strcmp(p->key,str)>0)p=p->left;
		else p=p->right;
	}
	
	return;
	
}


node * makenode(char key[],int x,int y){
	node *new=malloc(sizeof(node));
	strcpy(new->key,key);
	new->data=x;
	new->priority=y;
	new->left=NULL;
	new->right=NULL;
	return new;
}

node *rightRotate(node *p){
	node *q=p->left;
	p->left=q->right;
	q->right=p;
	return q;
}

node *leftRotate(node *p){
	node *q=p->right;
	p->right=q->left;
	q->left=p;
	return q;
}


node* insert(node **t,char key[],int x,int priority){
	node *new;
	
	if((*t)==NULL)
		return new=makenode(key,x,priority);
	if (strcmp((*t)->key,key)==0)
		return *t;
	
	if(strcmp(key,(*t)->key)<0){
		(*t)->left=insert(&(*t)->left,key,x,priority);
		if((*t)->priority < (*t)->left->priority)
			(*t)=rightRotate((*t));
	}
	else {
		(*t)->right=insert(&(*t)->right,key,x,priority);
		if((*t)->priority < (*t)->right->priority)
			(*t)=leftRotate((*t));
	}
	
	return *t;
}

node * Delete(node **t,char key[]){
	if((*t)==NULL)
		return NULL;
		
	if(strcmp(key,(*t)->key)<0)
		(*t)->left=Delete(&((*t)->left),key);
		
	else if(strcmp(key,(*t)->key)>0)
		(*t)->right=Delete(&((*t)->right),key);
		
	else return _delete(t,key);
	
	return *t;
}

node * _delete(node **t,char key[]){
	if((*t)->left==NULL && (*t)->right==NULL)
		return NULL;
	else if((*t)->left==NULL)
		(*t)=leftRotate(*t);
	else if((*t)->right==NULL)
		(*t)=rightRotate(*t);
	else {
		if((*t)->left->priority > (*t)->right->priority)
			(*t)=rightRotate(*t);
		else
			(*t)=leftRotate(*t);
	}
	return Delete(t,key);
}

int main(){
	int q,x,com;
	char str[25];
	node *root=NULL;
	srand((unsigned)time(NULL));
	
	scanf("%d",&q);
	
	for(int i=0;i<q;i++){
		scanf("%d %s",&com,str);
		
		if(com==0){
			scanf("%d",&x);
			if(!find(root,str)){
				root=insert(&root,str,x,rand()%200001);
			}
			else {
				update(root,str,x);
			}
		}
		else if(com==1){
			printf("%d\n",find(root,str));
		}
		
		else if(com==2){
			root=Delete(&root,str);
		}
		
	}
		
	return 0;
	
}


Measured memory_bytes: 14172
import sys,collections,math;sys.setrecursionlimit(10**7)
def Is(): return [int(x) for x in sys.stdin.readline().split()]
def Ss(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

n = S()
s = 0
for e in str(n):
    if e == "+":
        s += 1
    else:
        s -= 1
print(s)


Measured memory_bytes: 3436
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define rrep(i,n) for(int i=(int)n-1;i>=0;--i)
using namespace std;
using ll = long long;
template<typename T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<typename T> inline bool chmin(T& a,T b){if(b<a){a=b;return 1;}return 0;}
template<typename T> vector<T> make_vec(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>
auto make_vec(size_t a,Ts... ts){return vector<decltype(make_vec<T>(ts...))>(a,make_vec<T>(ts...));}
template<typename T,typename U,typename... V>
typename enable_if<is_same<T,U>::value>::type fill_v(U& u,const V... v){u=U(v...);}
template<typename T,typename U,typename... V>
typename enable_if<!is_same<T,U>::value>::type fill_v(U& u,const V... v){for(auto& e:u)fill_v<T>(e,v...);}

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

    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a[i];

    int ans = 0;
    for (int h = 1; h <= 100; ++h) {
        vector<int> v;
        v.push_back(a[0] >= h);
        rep(i, n) {
            if (v.back() != (a[i] >= h)) {
                v.push_back(a[i] >= h);
            }
        }
        int cnt = 0;
        rep(i, v.size()) if (v[i] == 1) cnt++;
        ans += cnt;
    }
    cout << ans << endl;
}


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

using namespace std;


int main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  
  if(abs(a-c)<=d){
    cout << "Yes" << endl; 
  }
  else if(abs(a-b)<=d && abs(b-c)<=d){
    cout << "Yes" << endl; 
  }
  else{
    cout << "No" << endl; 
  }
  
  return 0;
}


Measured memory_bytes: 3640
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<bitset>
#include<cstdio>
#include<cmath>
#include<map>
#include<numeric>
#include<set>
#include<sstream>
#include<string>
#include<utility>
#include<vector>

#define rep(i, a, n)  for(int i=a; i<n; ++i)
#define per(i, a, n)  for(int i=n-1; i>=a; --i)
#define fill0(n)  setfill('0') << right << setw(n)
#define all(x)  (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define INF 1000000007
using namespace std;
typedef long long ll;

int main(){
  string s; cin >> s;
  int ans = INF;
  int cnt = 0;
  rep(i, 0, s.length()){
    if(i%2 == 0 and s[i] != '0')  cnt++;
    if(i%2 == 1 and s[i] != '1')  cnt++;
  }
  ans = cnt;
  cnt = 0;
  rep(i, 0, s.length()){
    if(i%2 == 0 and s[i] != '1')  cnt++;
    if(i%2 == 1 and s[i] != '0')  cnt++;
  }
  ans = min(ans, cnt);
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 512
/**
*    created: 12.05.2020 09:33:35
**/
#include <bits/stdc++.h>
#define int long long
const int INF = 1e18L + 5;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using namespace std;

signed main() {

    cin.tie(0);
    ios_base::sync_with_stdio(false);

    int a, b, c; cin >> a >> b >> c;
    cout << min(min(a + b, b + c), (c + a)) << endl;
    return 0;
}

Measured memory_bytes: 256
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var Arr=(input.trim()).split("\n");
var arr0=Arr[0].split(" ").map(Number);
var a=arr0[0];
var b=arr0[1];
Arr.shift();
var nm=Arr.slice(0,a);
var m=(Arr.slice(a,Arr.length)).map(Number);

nm.forEach(function(v){
   var n=v.split(" ").map(Number);
   var sum=0;
   for(var i=0;i<b;i++)sum+=n[i]*m[i];
   console.log(sum);
});

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

int main() {
  int n;
  cin >> n;
  int ans = 0;
  int kari = 0;
 for(int x = 1;x<=n;x++){
  for(int i = 1;i<sqrt(x);i++){
    for(int j = 1;j<=i;j++){
      for(int k = 1;k<=j;k++){
        kari = pow(i,2)+pow(j,2)+pow(k,2)+i*j+j*k+k*i;
        if(kari == x){
          if((i == j) && (j == k)){
            ans = ans + 1;
          }else if((i != j) && (j != k) && (k != i)){
            ans = ans + 6;
          }else{
            ans = ans + 3;
          }
        }
      }
    }
  }
   cout << ans << endl;
   ans = 0;
 }
}


Measured memory_bytes: 3584
from scipy.special import comb
n, p, *A = map(int, open(0).read().split())
odd = sum(a%2 for a in A)
even = n - odd

if p:
  s = 0
  for i in range(1, odd+1, 2):
    s += comb(odd, i, exact=True)
  s *= pow(2, even)
  print(s)
else:
  s = 0
  for i in range(0, odd+1, 2):
    s += comb(odd, i, exact=True)
  s *= pow(2, even)
  print(s)

Measured memory_bytes: 42164
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		try {
			int N = sc.nextInt();
			long ans = 0;
			String[] retsu = new String[N + 1];
			for (int i = 1; i <= N; i++) {
				boolean three = false;
				boolean five = false;
				retsu[i] = String.valueOf(i);
				if (i % 3 == 0) {
					three = true;
					retsu[i] = "Fizz";
				}
				if (i % 5 == 0) {
					five = true;
					retsu[i] = "Buzz";
				}

				if (three & five) {
					retsu[i] = "FizzBuzz";
				}
			}
			for (int i = 1; i <= N; i++) {
				try {
					int num = Integer.parseInt(retsu[i]);
					ans += num;
				} catch (NumberFormatException e) {

				}

			}

			System.out.println(ans);
		} catch (Exception e) {

		} finally

		{
			sc.close();
		}
	}

}


Measured memory_bytes: 81000
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.StringTokenizer;
import static java.lang.Long.bitCount;

public class Main {

    public static void main(String[] args) {
        FastScanner in = new FastScanner();
        int a, b, v, w, t;
        a = in.nextInt();
        v = in.nextInt();
        b = in.nextInt();
        w = in.nextInt();
        t = in.nextInt();
        if(v-w<=0){
            System.out.println("NO");
            System.exit(0);
        }
        double got = v-w;
        double time = (Math.abs(a-b)*1.0)/got;
        if(time<=t) System.out.println("YES");
        else System.out.println("NO");
    }

    static void sort(int[] a) {
        ArrayList<Integer> l=new ArrayList<>();
        for (int i:a) l.add(i);
        Collections.sort(l);
        for (int i=0; i<a.length; i++) a[i]=l.get(i);
    }

    static class FastScanner {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st=new StringTokenizer("");
        String next() {
            while (!st.hasMoreTokens())
                try {
                    st=new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }
        int[] readArray(int n) {
            int[] a=new int[n];
            for (int i=0; i<n; i++) a[i]=nextInt();
            return a;
        }
        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }
    }
}


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

using namespace std;

typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;


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

    int n; scanf("%d", &n);
    ld ans = 0;
    for(int i=0;i<n;i++){
            ld x; string s;
            cin >> x >> s;
            if(s == "JPY") ans += x;
            else ans += x*380000.0;
    }
    cout << fixed << setprecision(10) << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<map>
#include<math.h>

typedef  long long ll;

#define rep(i,a,n) for(ll (i)=(a);(i)<(n);(i)++)
#define rrep(i,a,n) for(ll (i)=(a);(i)>=(n);(i)--)

#define INF ll 1 << 60
#define MOD 1000000007


using namespace std;

template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}

template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

int gcd(long long int a,long long int b){
    long long int r;
    if(a < b){
        int tmp;
        tmp = a;
        a = b;
        b = tmp;
    }
    while(r = a % b){
        a = b;
        b = r;
    }
    return a;
}


void ys(){
    cout << "Yes" << endl;
}

void yb(){
    cout << "YES" << endl;
}

void ns(){
    cout << "No" << endl;
}

void nb(){
    cout << "NO" << endl;
}

int dig(int d){
    int ans = 1;
    if(d == 0) return ans;
    while(d != 0){
        d--;
        ans*=100;
    }
    return ans;
}

ll divisors(ll n) {
    vector<ll> res;

    for(ll i = 1; i*i <= n; ++i) {
        if(n % i != 0) continue;
        res.push_back(i-1);
        if(n/i == i) continue;
        res.push_back((n/i)-1);
    }

    ll ans = 0;

    rep(i,0,res.size()){
        if(res[i] != 0)
        if(n/res[i] == n%res[i]) ans += res[i];
    } 
    return ans;
}


void solve(){
  int a,b;
  cin >> a >> b;
  int ans;
  if(a >=13)ans = b;
  else if(a >=6) ans = b/2;
  else ans = 0;

  
  cout << ans << endl;

}

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


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {

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

		int n = stdIn.nextInt();
		int[] l = new int[n];
		int count = 0;
		for (int i = 0; i < n; i++) {
			l[i] = stdIn.nextInt();
		}
		Arrays.sort(l);

		for (int i = 0; i < n - 2; i++) {
			for (int j = i + 1; j < n - 1; j++) {
				for (int k = j + 1; k < n; k++) {
					if (l[i] != l[j] && l[j] != l[k]) {
						if (l[k] < l[i] + l[j])
							count++;
					}
				}
			}
		}

		System.out.println(count);

		stdIn.close();
	}
}


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

int main(){
  int n;
  scanf("%d", &n);
  int last = n%10;
  if (last==2||last==4||last==5||last==7||last == 9) printf("hon");
  else if (last == 0 || last == 1 || last == 6 || last == 8) printf("pon");
  else printf("bon");
  return 0;
}


Measured memory_bytes: 3828
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  vector<int> A(N);
  vector<int> B(N);
  for(int i=0; i<N; i++){
    cin >> A.at(i);
  }
  for(int i=0; i<N; i++){
    cin >> B.at(i);
  }
  vector<int> sub(N);
  
  int64_t cnt = 0;
  int ans = 0;
  
  for(int i=0; i<N; i++){
    sub.at(i) = A.at(i) - B.at(i);
    if(sub.at(i) < 0){
      cnt += abs(sub.at(i));
      ans++;
    }
  }
  
  sort(sub.rbegin(),sub.rend());
  int j=0;
  while(cnt > 0){
    if(sub.at(j) < 0){
      ans = -1;
      break;
    }
    cnt -= sub.at(j);
    ans++;
    j++;
  }
  cout << ans << endl;
}

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

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vb = vector<bool>;
using vvb = vector<vb>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i, s, n) for(int i = (int)(s); i < (int)(n); i++)

ll INF = 1ll << 60;

void llchmax(ll &a, ll b){
  if(a < b)
    a = b;
}
void llchmin(ll &a, ll b){
  if(a > b)
    a = b;
}

int main(){
  ll n;
  cin >> n;
  ll mxz = -INF, mnz = INF, mxw = -INF, mnw = INF;
  
  rep(i, 0, n){
    ll x, y;
    cin >> x >> y;
    ll z = x + y, w = x - y;
    llchmax(mxz, z);
    llchmin(mnz, z);
    llchmax(mxw, w);
    llchmin(mnw, w);
  }
  
  ll ans = max(mxz-mnz, mxw-mnw);
  
  cout << ans << endl;
  
  return 0;
  
}

Measured memory_bytes: 3552
import sys

sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  #空白あり
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))  #空白なし
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())  #空白あり
def LS2(): return list(sys.stdin.readline().rstrip())  #空白なし

H,W,K = MI()
mod = 10**9+7

if W == 1:
    print(1)
    exit()

fib = [1,1,2,3,5,8,13,21,34]

dp = [[0]*(W+1) for _ in range(H+1)]
dp[0][1] = 1
for i in range(1,H+1):
    for j in range(1,W+1):
        if W == 2:
            if j == 1:
                dp[i][j] = dp[i-1][j] + dp[i-1][j+1]
                dp[i][j] %= mod
            else:
                dp[i][j] = dp[i-1][j] + dp[i-1][j-1]
                dp[i][j] %= mod
        else:
            if j == 1:
                dp[i][j] = dp[i-1][j+1]*fib[W-2] + dp[i-1][j]*fib[W-j]
                dp[i][j] %= mod
            elif j == W:
                dp[i][j] = dp[i-1][j-1]*fib[W-2] + dp[i-1][j]*fib[j-1]
                dp[i][j] %= mod
            else:
                dp[i][j] = dp[i-1][j-1]*fib[j-2]*fib[W-j] + dp[i-1][j+1]*fib[j-1]*fib[W-j-1] + dp[i-1][j]*(fib[W-j]*fib[j-1])
                dp[i][j] %= mod

print(dp[H][K])


Measured memory_bytes: 62800
#include <stdio.h>

int main()
{
    int red, green, blue;
    scanf("%d%d%d", &red, &green, &blue);
    if ((100 * red + 10 * green + blue) % 4 == 0)
        printf("YES\n");
    else
        printf("NO\n");
    return 0;
}


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

int main()
{
    int n, i, l;
    string s, t1, t2;

    cin >> n >> s;

    if(n % 2 == 1) cout << "No" << endl;
    else{
        l = n / 2;
        t1 = s.substr(0, l);
        t2 = s.substr(l, l);

        //cout << t1 << " " << t2 << endl;

        if(t1 == t2) cout << "Yes" << endl;
        else cout << "No" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const string ln = "\n";
constexpr int INF = 1001001001;
constexpr int MOD = 1000000007;

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

  ll n;
  cin >> n;

  string s = to_string(n);
  int keta = s.size();

  // dp[i][j] = 左からi桁目, jが1ならi桁目でn未満確定 0ならnピッタリ
  int dp[20][2];
  dp[0][0] = s[0] - '0';
  dp[0][1] = s[0] - '0' - 1;

  for (int i = 0; i < keta; i++) {
    int num = s[i + 1] - '0';

    dp[i + 1][0] = dp[i][0] + num;
    dp[i + 1][1] = dp[i][1] + 9;
  }

  cout << max(dp[keta - 1][0], dp[keta - 1][1]) << endl;

  return 0;
}

Measured memory_bytes: 256
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>
#include <cstdlib>
using namespace std;
#define Ma_PI 3.141592653589793
#define eps 0.00000000000000000000000001
#define LONG_INF 3000000000000000000
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define REP(i,n) for(long long i = 0;i < n;++i)                                                                             
#define seg_size 524288
int main() {
	string a, b;
	cin >> a >> b;
	for (int i = a.length() - b.length();i >= 0;--i) {
		for (int q = 0;q < b.length();++q) {
			if (a[i + q] != b[q] && a[i + q] != '?') goto failed;
		}
		for (int q = 0;q < b.length();++q) {
			a[i + q] = b[q];
		}
		for (int q = 0;q < a.length();++q) {
			if (a[q] == '?') a[q] = 'a';
		}
		cout <<a << endl;
		return 0;
	failed:;
	}
	cout << "UNRESTORABLE" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
    ll mod = 1000000007;
    ll H, W;
    cin>>H>>W;
    vector<vector<char>> in(H, vector<char>(W));
    for(ll i = 0; i < H; i++){
        for(ll j = 0; j < W; j++){
            cin>>in[i][j];
        }
    }
    vector<vector<ll>> dp(H + 1, vector<ll>(W + 1));
    dp[1][0] = 1;
    for(ll i = 0; i < H; i++){
        for(ll j = 0; j < W; j++){
            if(in[i][j] == '.'){
                dp[i + 1][j + 1] = (dp[i][j + 1] + dp[i + 1][j]) % mod;
            }
        }
    }

    cout<<dp[H][W]<<endl;
    
}

Measured memory_bytes: 9088
import sys
input=sys.stdin.readline
sys.setrecursionlimit(10 ** 6)
#from collections import defaultdict
#d = defaultdict(int)
#import fractions
#import math
#import collections
#from collections import deque
#from bisect import bisect_left
#from bisect import insort_left
#N = int(input())
#A = list(map(int,input().split()))
#S = list(input())
#S.remove("\n")
#N,M = map(int,input().split())
#S,T = map(str,input().split())
#A = [int(input()) for _ in range(N)]
#S = [input() for _ in range(N)]
#A = [list(map(int,input().split())) for _ in range(N)]
#import itertools
#import heapq
#import numpy as np
#INF = float("inf")
N = int(input())
A = list(map(int,input().split()))
A.sort()
s = A[0]
for i in range(1,N):
    s = (s+A[i])/2
print(s)

Measured memory_bytes: 3060
#include <algorithm>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <iostream>
#include <iterator>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#define FOR(i,k,n) for(int(i)=(k);(i)<(n);++(i))
#define rep(i,n) FOR(i,0,n)
#define all(v) begin(v),end(v)
#ifdef ONLINE_JUDGE
  #define debug(x)
  #define debug2(x,y)
  #define debug3(x,y,z)
  #define assert(e) if(!(e)){stod("");}
#else
  #define debug(x) std::cerr<<#x<<": "<<x<<"\n"
  #define debug2(x,y) std::cerr<<#x<<": "<<x<<", "<<#y<<": "<<y<<"\n"
  #define debug3(x,y,z) std::cerr<<#x<<": "<<x<<", "<<#y<<": "<<y<<", "<<#z<<": "<<z<<"\n"
#endif

using ll=long long;
using vi=std::vector<int>;
using vvi=std::vector<vi>;
using vll=std::vector<ll>;
using vvll=std::vector<vll>;
template<typename T> using vvec=std::vector<std::vector<T>>;
template<typename T>
auto make_v(size_t sz){return std::vector<T>(sz);}
template<typename T,typename... Ts>
auto make_v(size_t sz,Ts...ts){return std::vector<decltype(make_v<T>(ts...))>(sz,make_v<T>(ts...));}
template<typename T>
void fill_v(T&var,const T&x){var=x;}
template<typename V,typename T>
void fill_v(V&v,const T&x){for(auto&& w:v){fill_v(w,x);}}

template<typename T> std::ostream& operator<<(std::ostream&s,const std::vector<T>&v){
  int sz=v.size();s<<"\n";rep(i,sz){s<<v[i];if(i<sz-1){s<<"\t";}}s<<"\n";return s;}
template<typename T> std::ostream& operator<<(std::ostream&s,const std::vector<std::vector<T>>&v){
  for(auto&& w:v){s<<w;}return s;}
template<typename T> std::ostream& operator<<(std::ostream&s,const std::deque<T>&v){
  int sz=v.size();s<<"\n";rep(i,sz){s<<v[i];if(i<sz-1){s<<"\t";}}s<<"\n";return s;}
template<typename T> std::ostream& operator<<(std::ostream&s,const std::deque<std::deque<T>>&v){
  for(auto&& w:v){s<<w;}return s;}
template<typename T> std::ostream& operator<<(std::ostream&s, const std::set<T>&v){
  s<<"\n";for(auto&& elm:v){s<<elm<<"\t";}s<<"\n";return s;}

inline void scan(int&a){scanf("%d",&a);}
inline void scan(ll&a){scanf("%lld",&a);}
inline void scan(char&a){scanf(" %c",&a);}
inline void scan(double&a){scanf("%lf",&a);}
template<typename T>
inline void scan(std::vector<T>&v){for(auto&& sv:v){scan(sv);}}
template<typename First,typename...Args>
inline void scan(First&f,Args&...args){scan(f);scan(args...);}
inline void scan(std::string&s){char BUF[3000000];scanf(" %s",BUF);s=std::string(BUF);}
inline void print(int a){printf("%d\n",a);}
inline void print(ll a){printf("%lld\n",a);}
inline void print(double a){printf("%.12f\n",a);}
inline void print(std::string s){std::cout<<s<<"\n";}

using namespace std;

void solve() {
  int n;
  scan(n);
  int d = n % 10;
  string ans = "hon";
  if (d == 3) {
    ans = "bon";
  } else if (d == 0 || d == 1 || d == 6 || d == 8) {
    ans = "pon";
  }
  print(ans);
}

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


Measured memory_bytes: 3172
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
using u64 = unsigned long long;
#define REP(i, n) for (int i = 0; (i64)(i) < (i64)(n); ++i)

#ifdef ENABLE_DEBUG
template <typename T>
void debug(T value) {
  cerr << value;
}
template <typename T, typename... Ts>
void debug(T value, Ts... args) {
  cerr << value << ", ";
  debug(args...);
}
#define DEBUG(...)                              \
  do {                                          \
    cerr << " \033[33m (L" << __LINE__ << ") "; \
    cerr << #__VA_ARGS__ << ":\033[0m ";        \
    debug(__VA_ARGS__);                         \
    cerr << endl;                               \
  } while (0)
#else
#define debug(...)
#define DEBUG(...)
#endif

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  i64 N;
  cin >> N;
  string S;
  cin >> S;
  int Q;
  cin >> Q;

  vector<set<int>> ix(26);
  REP(i, N) {
    int ch = S[i] - 'a';
    ix[ch].insert(i);
  }

  REP(q, Q) {
    int tp;
    cin >> tp;
    if (tp == 1) {
      int iq;
      char cq;
      cin >> iq >> cq;
      iq--;
      int before = S[iq] - 'a';
      int after = cq - 'a';
      if (before != after) {
        ix[before].erase(iq);
        ix[after].insert(iq);
      }
      S[iq] = cq;
    } else {
      assert(tp == 2);
      int l, r;
      cin >> l >> r;
      l--;
      r--;
      int cnt = 0;
      REP(i, 26) {
        auto it = ix[i].lower_bound(l);
        if (it == ix[i].end()) continue;
        if (*it <= r) ++cnt;
      }
      cout << cnt << '\n';
    }
  }
}


Measured memory_bytes: 27228
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <set>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cstring>
#include <iterator>
#include <bitset>
#include <unordered_set>
#include <unordered_map>
#include <fstream>
#include <iomanip>
#include <cassert>
//#include <utility>
//#include <memory>
//#include <functional>
//#include <deque>
//#include <cctype>
//#include <ctime>
//#include <numeric>
//#include <list>
//#include <iomanip>

//#if __cplusplus >= 201103L
//#include <array>
//#include <tuple>
//#include <initializer_list>
//#include <forward_list>
//
//#define cauto const auto&
//#else

//#endif

using namespace std;


typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()) {
	v.assign(a, vector<T>(b, t));
}

template <class F, class T>
void convert(const F &f, T &t) {
	stringstream ss;
	ss << f;
	ss >> t;
}

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define reep(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) reep((i),0,(n))
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define F first
#define S second
#define mkp make_pair
#define RALL(v) (v).rbegin(),(v).rend()
#define DEBUG
#ifdef DEBUG
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#else
#define dump(x)
#define debug(x)
#endif

#define MOD 1000000007LL
#define EPS 1e-8
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
#define maxs(x,y) x=max(x,y)
#define mins(x,y) x=min(x,y)

void mainmain() {
	int n, K;
	cin >> n >> K;
	vint cnt(26);
	rep(i, n) {
		string s;
		cin >> s;
		cnt[s[0] - 'A']++;
	}
	sort(ALL(cnt));
	reverse(ALL(cnt));
	ll m = INF/100;
	while(1) {
		int t = 0;
		rep(i, 26) {
			t += min(m, (ll)cnt[i]);
		}
		if(m * K <= t) {
			cout << m << endl;
			return;
		}
		m--;
	}
}


signed main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout << fixed << setprecision(20);
	mainmain();
}

Measured memory_bytes: 384
# N, M = map(int, input().split())
# nums = list(map(int, input().split()))
# nums_2d = [list(map(int, input().split())) for _ in range(N)]


def main():
    a, b = map(int, input().split())

    if a < b:
        ans = str(a) * b
    else:
        ans = str(b) * a

    return ans


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


Measured memory_bytes: 2940
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <cmath>
#include <numeric>

using namespace std;

int main()
{
    int n, m;
    cin >> n >> m;
    int a[n][m];

    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            cin >> a[i][j];
        }
    }

    int sum2 = 0;

    for (int i = 0; i < n; i++) {
        int sum1 = 0;
        for (int j = 0; j < m; j++) {
            sum1 += a[i][j];
            cout << a[i][j] << " ";
        }
        cout << sum1 << endl;
    }
    for (int j = 0; j < m; j++) {
        int sum1 = 0;
        for (int i = 0; i < n; i++) {
            sum1 += a[i][j];
            sum2 += a[i][j];
        }
        cout << sum1 << " ";
    }
    cout << sum2 << endl;
}





Measured memory_bytes: 3120
#include<iostream>
#include<map>
#include<algorithm>
#include<queue>

#define rep(i,n) for(int i=0;i<n;i++)
#define fs first
#define sc second
using namespace std;
typedef pair<int,int> P;
typedef pair<P,int> P2;

const int dy[] = {-1,-1,0,1,1,1,0,-1}, dx[] = {0,1,1,1,0,-1,-1,-1};
int sy,sx;
string b[20];
map<P,int> stone;

string bin(int x){
  string res;
  for(int i=0;i<20;i++){
    if(x&1)res += "1";
    else res += "0";
    x/=2;
  }
  return res;
}

int main(){
  for(int i=0;i<19;i++)cin >> b[i];

  int cnt = 0;
  for(int i=0;i<19;i++){
    for(int j=0;j<15;j++){
      if(b[i][j] == 'O'){sy = i; sx = j;}
      if(b[i][j] == 'X'){
	stone[P(i,j)] = cnt++;
      }
    }
  }

  P2 cur = P2(P(sy,sx),0);
  map<P2,int> d;
  d[cur] = 0;
  queue<P2> q;
  q.push(cur);

  int res = -1;
  while(q.size()){
    cur = q.front(); q.pop();
    int state = cur.sc;

    for(int i=0;i<8;i++){
      int ny = cur.fs.fs+dy[i], nx = cur.fs.sc+dx[i];
      int nstate = state;

      if(ny<0 || nx<0 || ny>=19 || nx>=15)continue;
      while(b[ny][nx] == 'X'){
	int id = stone[P(ny,nx)];

	if((nstate>>id)&1)break;

	nstate |= 1<<id;
        ny = ny+dy[i], nx = nx+dx[i];

	if(ny<0 || nx<0 || ny>=19 || nx>=15)break;
      }
      if(ny==cur.fs.fs+dy[i] && nx==cur.fs.sc+dx[i])continue;

      if(ny>=19){
	res = d[cur]+1;
	goto END;
      }
      
      if(ny<0 || nx<0 || nx>=15)continue;
      if(ny>=18){
	res = d[cur]+1;
	goto END;
      }

      P2 nxt = P2(P(ny,nx),nstate);
      if(d.find(nxt) == d.end()){
	q.push(nxt);
	d[nxt] = d[cur]+1;
      }
    }
  }
 END: cout << res << endl;
}

Measured memory_bytes: 6432
#import math
#import bisect
#import numpy as np
import sys
input = sys.stdin.readline
MOD = 10**9 + 7
INF = float('INF')

def main():
    s = input()
    p =['A', 'C', 'G', 'T']
    ans = 0
    cnt = 0

    for i in range(len(s)):
        if s[i] in p:
            cnt += 1
        else:
            cnt = 0
        ans = max(cnt, ans)

    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <string> 
#include <vector>
#include <iomanip>
#include <math.h>
using namespace std;

int main()
{
	int N, K;
	cin >> N >> K;
	vector<int> l(N);
	for (int i = 0; i < N; i++) {
		cin >> l[i];
	}
	sort(l.begin(), l.end());
	reverse(l.begin(), l.end());
	int ans = 0;
	for (int j = 0; j < K; j++) {
		ans += l[j];
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
 
typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef long double ld;
 
typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;
 
const int INF = 1e9 + 7;
const int MOD = 1e9 + 7;
const int MAXN = 1e6 + 3;
 
#define _  %  MOD
#define __ %= MOD
 
#define      each(it,s)        for(auto it = s.begin(); it != s.end(); ++it)
#define      sortA(v)          sort(v.begin(), v.end())
#define      sortD(v)          sort(v.begin(), v.end(), greater<auto>())
#define      fill(a)           memset(a, 0, sizeof (a))
 
#define      swap(a,b)        {a=a+b;b=a-b;a=a-b;}
#define      rep(i, n)         for(ll i = 0; i < (n); ++i)
#define      repA(i, a, n)     for(ll i = a; i <= (n); ++i)
#define      repD(i, a, n)     for(ll i = a; i >= (n); --i)
#define watch(x) cout << (#x) << " is " << (x) <<endl
 
#define fi first
#define se second
#define mp make_pair
#define pb push_back
 
#define fbo find_by_order
#define ook order_of_key
 
ll gcd(ll a,ll b){if(b==0) return a; else return gcd(b,a%b);}
ll power(ll x,ll y){ll res=1; while(y>0){if(y&1) res=res*x;y=y>>1;x=x*x;}return res;} // modular exponent
ll n;
ll ans=0;
const int N=1e5+5;
vector<ll> adj[N];
map<pair<ll,ll>,ll> m;
map<ll,ll> clr;
void dfs(ll u,ll par,ll parcol)
{
	ll childcol=(parcol+1)%ans;
	pair<ll,ll> edge=mp(min(u,par),max(u,par));
	clr[m[edge]]=childcol;
	for(auto v:adj[u])
	{
		if(v==par) continue;
		dfs(v,u,childcol);
		childcol=(childcol+1)%ans;
	}
	return ;
}
int main()
{
    ios_base::sync_with_stdio(false); // don't use printf and scanf
    cin.tie(NULL); // cout<<fixed<<setprecision
	cin>>n;
	m[mp(0ll,1ll)]=0ll;
	repA(i,1,n-1)
	{
		ll x,y;
		cin>>x>>y;
		if(x>y) swap(x,y);
		m[mp(x,y)]=i;
		adj[x].pb(y);
		adj[y].pb(x);
	}
	repA(i,1,n) ans=max(ans,(ll)adj[i].size());
	cout<<ans<<'\n';
	dfs(1,0,-1);
	for(auto it:clr)
	{
		if(it.fi==0) continue;
		cout<<it.se+1<<'\n';
	}
	return 0;
}
// JUST ASK YOURSELF DID YOU GIVE YOUR BEST ? ISSE ZYADA
// KUCH KAR BHI NAHI SAKTE !! ENJOY AND GIVE YOUR BEST!!



Measured memory_bytes: 22160
#include <bits/stdc++.h>
using namespace std;
int n;
int ans;
int vis[200000];
int main()
{
    cin >> n;
    while (n --)
    {
        int a;
        cin >> a;
        if (!vis[a]) ans ++, vis[a] = 1;
    }
    if (ans % 2 == 0) ans --;
    cout << ans;
}


Measured memory_bytes: 640
#include <stdio.h>
#include <math.h>
struct s{
  double x;
  double y;
};
void kock(int n,struct s p1,struct s p2);
int main(){
  int n;
  struct s p1={0,0};
  struct s p2={100,0};
  scanf("%d",&n);
  printf("%f %f\n",p1.x,p1.y);
  
  kock(n, p1, p2);
  printf("%f %f\n",p2.x,p2.y);
  return 0;
}
void kock(int n,struct s p1,struct s p2){
  struct s s,t,u;
    // p1, p2 ?????? s, t, u ????¨????
  if (n>0){
    s.x=(2*p1.x+p2.x)/3;
    s.y=(2*p1.y+p2.y)/3;
    
    t.x=(p1.x+2*p2.x)/3;
    t.y=(p1.y+2*p2.y)/3;
    
    u.x=fabs((t.x-s.x)/2-(t.y-s.y)*sqrt(3)/2+s.x);
    u.y=fabs((t.x-s.x)*sqrt(3)/2+(t.y-s.y)/2+s.y);
    
    kock(n-1, p1, s);
    printf("%f %f\n",s.x,s.y);
    kock(n-1, s, u);
    printf("%f %f\n",u.x,u.y);
    kock(n-1, u, t);
    printf("%f %f\n",t.x,t.y);
    kock(n-1, t, p2);
  }
}

Measured memory_bytes: 636
#include <iostream>
#include <vector>

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

    std::uint64_t ans = 0;
    std::uint64_t last = 0;
    for (auto index = 0; index < n; ++index)
    {
        std::uint64_t height;
        std::cin >> height;
        if (last == 0)
        {
            last = height;
            continue;
        }

        if (height < last)
        {
            ans += last - height;
        }
        else
        {
            last = height;
        }
    }

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

Measured memory_bytes: 3632
import java.util.Scanner

object Main {
  def main(args: Array[String]): Unit = {
    //nextLineとnextを同時に使ったら死ぬ
    val sc = new Scanner(System.in)

    val n = sc.nextInt()
    val as = Vector.fill(n)(sc.nextInt())

    val plus = as.zipWithIndex.map {
      case (height, index) => height + index + 1
    }

    val minus = as.zipWithIndex.map {
      case (height, index) => index + 1 - height
    }

    var mapPlus = Map[Int, Long]()
    var mapMinus = Map[Int, Long]()

    plus.foreach(
      i => mapPlus = mapPlus + (i -> (mapPlus.getOrElse(i, 0L) + 1L))
    )
    minus.foreach(
      i => mapMinus = mapMinus + (i -> (mapMinus.getOrElse(i, 0L) + 1L))
    )

    var ans = 0L

    mapPlus.foreach {
      case (x, amount) => ans += amount * mapMinus.getOrElse(x, 0L)
    }

    println(ans)
  }

  def debug(args: Any*): Unit = {
    Console.err.println(args.mkString(" "))
  }

  def printExecTime(process: => Unit): Unit = {
    val start = System.currentTimeMillis
    process
    debug("処理時間： " + (System.currentTimeMillis - start) + " ミリ秒")
  }

}


Measured memory_bytes: 109212
n = int(input())
t = [int(i) for i in input().split()]
v = [int(i) for i in input().split()]

m = [0]*(n+1)
z = [0]*(n+1)
for i in range(n-1,0,-1):
    m[i] = min(v[i], v[i-1], t[i] + m[i+1])
for i in range(1,n):
    z[i] = min(m[i], z[i-1]+t[i-1])

def dist(i):
    lspeed = z[i]
    rspeed = z[i+1]
    ta = v[i] - lspeed
    tb = v[i] - rspeed
    if ta + tb <= t[i]: # 山を押さえた形
        c = (lspeed+v[i])*ta/2 + v[i]*(t[i]-ta-tb) + (rspeed+v[i])*tb/2
    else: #山の形
        a = (rspeed+t[i]-lspeed)/2
        c = (2*lspeed+a)*a/2 + (lspeed+a+rspeed)*(t[i]-a)/2
    return c

ans=0
for i in range(0,n):
    ans += dist(i)

print(ans)    


Measured memory_bytes: 3064