akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
// iostream is too mainstream
#include <cstdio>
// bitch please
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <cmath>
#include <iomanip>
#include <time.h>
#define dibs reserve
#define OVER9000 1234567890123456789LL
#define ALL_THE(CAKE,LIE) for(auto LIE =CAKE.begin(); LIE != CAKE.end(); LIE++)
#define tisic 47
#define soclose 1e-8
#define chocolate win
// so much chocolate
#define patkan 9
#define ff first
#define ss second
#define abs(x) ((x < 0)?-(x):x)
#define uint unsigned int
#define dbl long double
#define pi 3.14159265358979323846
using namespace std;
// mylittledoge

typedef long long cat;

#ifdef DONLINE_JUDGE
	// palindromic tree is better than splay tree!
	#define lld I64d
#endif

int main() {
	cin.sync_with_stdio(0);
	cin.tie(0);
	cout << fixed << setprecision(10);
	string S;
	cin >> S;
	cout << S.substr(0,S.length()-8) << "\n";
	return 0;}

// look at my code
// my code is amazing


Measured memory_bytes: 256
// 
#include<bits/stdc++.h>
#define pb push_back 
#define mp make_pair
using namespace std;

const int maxn=2e5+7;
typedef long long ll;

int n,m,ans[maxn];
struct node{
	int v,id;
}a[maxn];

bool operator<(const node &a,const node &b)
{
	return a.v<b.v;
}

int main()
{
	int i,j,k,T;
	cin>>n;
	for(i=1;i<=n;++i)
	{
		cin>>a[i].v;
		a[i].id=i;
	}
	
	sort(a+1,a+n+1);
	
	int l=n/2;
	
	for(i=1;i<=n;++i)
	{
		if(i<=l) ans[a[i].id]=a[l+1].v;
		else ans[a[i].id]=a[l].v;
	}
	
	for(i=1;i<=n;++i)
	{
		printf("%d\n",ans[i]);
	}
	
	return 0;
}


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

using namespace std;

typedef long long int ll;
const int INF = 1<<30;
const long long LINF = 1LL<<60;
const long long MOD = (long long)1e9 + 7;

map<ll, ll> memo;
ll n, a, b, c, d;

ll dfs(ll x){
    if(memo.find(x) != end(memo)){
        return memo[x];
    }
    if(x <= 1){
        return x * d;
    }
    ll res = LINF;
    if(x <= LINF / d){
        res = min(res, x * d);
    }
    res = min(res, dfs((x + 1) / 2) + a + d);
    res = min(res, dfs(x / 2) + a + (x % 2) * d);
    res = min(res, dfs((x + 3 - (x % 3)) / 3) + b + (3 - (x % 3)) * d);
    res = min(res, dfs(x / 3) + b + (x % 3) * d);
    res = min(res, dfs((x + 5 - (x % 5)) / 5) + c + (5 - (x % 5)) * d);
    res = min(res, dfs(x / 5) + c + (x % 5) * d);
    return memo[x] = res;
}

int main(){
    int t;
    cin >> t;
    for(int i = 0; i < t; i++){
        cin >> n >> a >> b >> c >> d;
        memo.clear();
        cout << dfs(n) << endl;
    }
    return 0;
}


Measured memory_bytes: 4616
#!/usr/bin/env python3

import sys

DEBUG = False

def read(t):
    return t(sys.stdin.readline().rstrip())


def read_list(t, sep = " "):
    return [t(s) for s in sys.stdin.readline().rstrip().split(sep)]


def dprint(*args, **kwargs):
    if DEBUG:
        print(*args, **kwargs)
    return


def main():
    x, y, z = read_list(str)
    x, y = y, x
    x, z = z, x
    print("%s %s %s" % (x, y, z))


if __name__ == "__main__":
    main()

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define pb push_back
#define powerof2 ()
#define mp make_pair
#define pi acos(-1)
using ll = long long;
const ll M = 1000000007;
const ll M1= 998244353;
using vl = vector<ll>;
using pll =  pair<ll,ll>;
ll power(ll x,ll y){
	if(y==0)
		return 1;
	ll res=power(x,y/2);
	res=(res*res);
	if(y&1)
		res=(res*x);
	return res;
}
 
ll powermod(ll x,ll y,ll mod){
	if(y==0)
		return 1;
	ll res=powermod(x,y/2,mod);
	res=(res*res)%mod;
	if(y&1)
		res=(res*x)%mod;
	return res;
}
/*ll binarysearch(ll va)
{
	ll n=1;
	ll l=va+1,u=n;
	ll st=num.order_of_key(va);
	while(l+1<u)
	{
		m=(l+u)/2;
		ll in=num.order_of_key(m);
		if(in-st==m-va)
		{
			l=m;
		}
		else
		{
            u=m;
		}
	}
	if(num1.find(l)==num1.end())
		return l;
	return u;
}*/
void solve(){
	int  a;
	cin>>a;
	cout<<a+a*a+a*a*a<<"\n";
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t=1;
    // cin>>t;
 
    for(int i=1;i<=t;i++)
    {//cout<<"Case #"<<i<<": ";
    solve();}
    return 0;
}

Measured memory_bytes: 3648
#include<stdio.h>
int main(void){
    int n,m,a[100][100],b[100],i,j,s;

    scanf("%d %d",&n,&m);
    //aの入力
    for(i=0;i<n;i++){
        for(j=0;j<m;j++){
            scanf("%d",&a[i][j]);
        }
    }
    //bの入力
    for(i=0;i<m;i++){
        scanf("%d",&b[i]);
    }
    //計算
    for(i=0;i<n;i++){
        s=0;
        for(j=0;j<m;j++){
            s+=a[i][j]*b[j];
            if(j==m-1){
                printf("%d\n",s);
            }
        }
        //ここにsの出力書いてもいい
    }

    return 0;
}


Measured memory_bytes: 2108
n=int(input())
h=list(map(int,input().split()))
dp=[0]*n
dp[1]=abs(h[1]-h[0])
for i in range(2,n):dp[i]=min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]))
print(dp[-1])

Measured memory_bytes: 13928
//i ll be the king
#include<bits/stdc++.h>
#define ll long long int
#define sync ios_base::sync_with_stdio(false); cin.tie(NULL) 
#define input(arr,n) for(ll i1=0;i1<n;i1++ )cin>>arr[i1]
#define rep(n) for(ll i2=0;i2<n;i2++)
#define vmp(v,a,b) v.push_back(make_pair(a,b))
#define si(a) scanf("%lld",&a)
#define pi(a) printf("%lld",a)
#define aset(a,n,k) for(ll i3=0;i3<n;i3++)a[i3]=k; 	
#define mod 1000000007
#define mp(a,b) make_pair(a,b)
#define f first
#define s second 
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<ll, null_type,greater_equal<ll>, rb_tree_tag,tree_order_statistics_node_update>//s.order_of_key(val) *s.find_by_orde(ind)
using namespace std;
int main()
{
	sync;
	ll n,k;
	cin>>n>>k;
	ll arr[k]={0};
	for(ll i=1;i<=n;i++)
	arr[i%k]++;
	ll ans=arr[0]*arr[0]*arr[0];
	if(k%2==0)
	ans+=arr[k/2]*arr[k/2]*arr[k/2];
	cout<<ans;
}

Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include<algorithm>
#include <cstdlib>

using namespace std;

int main()
{
	string a, b, c;
	string yn[2] = { "YES","NO" };
	cin >> a >> b >> c;
	int x = 1,A=a.length()-1,B=b.length()-1;
	if (a[A] == b[0] && b[B] == c[0]) x = 0;
	cout << yn[x] << endl;
    return 0;
}



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

using namespace std;

int main() {
	int n; cin >> n;
	map <int , int> mp;
	int all = 0;

	for(int i = 0; i < n; i++){
		int rate;
		cin >> rate;
		if(rate < 400){
			mp[0]++;
		}else if(400 <= rate && rate < 800){
			mp[1]++;
		}else if(800 <= rate && rate < 1200){
			mp[2]++;
		}else if(1200 <= rate && rate < 1600){
			mp[3]++;
		}else if(1600 <= rate && rate < 2000){
			mp[4]++;
		}else if(2000 <= rate && rate < 2400){
			mp[5]++;
		}else if(2400 <= rate && rate < 2800){
			mp[6]++;
		}else if(2800 <= rate && rate < 3200){
			mp[7]++;
		}else{
			all++;
		}
	}
	int now_num = mp.size();
	if(now_num > 0){
		cout << now_num << " " << now_num + all << endl;
	}else{
		cout << "1" << " " << now_num + all << endl;
	}
}

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

#define lint long long
#define P pair<int, int>
#define LLP pair<long long, long long>
#define REP(i, x, n) for(int i = (x), i##_len = (int)(n) ; i < i##_len ; ++i)
#define rep(i, n) for(int i = 0, i##_len = (int)(n) ; i < i##_len ; ++i)
#define repr(i, n) for(int i = (int)(n) - 1 ; i >= 0 ; --i)
#define SORT(x) sort((x).begin(), (x).end())
#define SORT_INV(x) sort((x).rbegin(), (x).rend())

const int IINF = 1e9 + 100;
const long long LLINF = 2e18 + 129;
const long long MOD = 1e9 + 7;
const int dx4[] = {1, 0, -1, 0}, dy4[] = {0, 1, 0, -1};
const int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};
const double EPS = 1e-8;

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

    vector<int> deg(4);
    rep(i, 3){
        int a, b;
        cin >> a >> b;
        --a;
        --b;
        ++deg[a];
        ++deg[b];
    }

    int cnt = 0;
    rep(i, 4){
        cnt += deg[i] == 1;
    }
    if(cnt == 2){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using row = vector<ll>;
using matrix = vector<row>;

int main() {
  int n, m, l;
  cin >> n >> m >> l;

  matrix A(n, row(m)), B(m, row(l)), C(n, row(l));

  rep(i, n) rep(j, m) cin >> A[i][j];
  rep(i, m) rep(j, l) cin >> B[i][j];

  rep(i, n) rep(j, l) {
    rep(k, m) C[i][j] += A[i][k] * B[k][j];
  }

  rep(i, n) rep(j, l) printf("%lld%c", C[i][j], (j == l - 1) ? '\n' : ' ');
}


Measured memory_bytes: 3308
import java.util.*;
import static java.lang.System.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		A(sc);
	}
	
	public static void A(Scanner sc) {
		int a = sc.nextInt();
		int b = sc.nextInt();
		int t = sc.nextInt();
		int ret = ((int)(t+0.5)/a)*b;
		out.println(ret);
	}
}

Measured memory_bytes: 22228
#include<bits/stdc++.h>
using namespace std;
int dp[1005][1005];
string s[1005];
const int MOD = 1e9+7;
int h,w;
int main(){
    cin>>h>>w;
    for(int i=0;i<h;i++)
            cin>>s[i];
    dp[1][1]=1;

    for(int i=0;i<h;i++)
    for(int j=0;j<w;j++){
        if(s[i][j]=='#')
            dp[i+1][j+1]=0;
        else
            dp[i+1][j+1]=dp[i+1][j+1]+(dp[i+1][j]+dp[i][j+1]);
        dp[i+1][j+1]%=MOD;

    }


    cout<<dp[h][w];
}


Measured memory_bytes: 5248
/* BISMILLAHIR RAHMANIR RAHIM */
#include<bits/stdc++.h>
#define fast ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define s(v)       sort(v.begin(),v.end())
#define r(v)       reverse(v.begin(),v.end())
#define pf         printf
#define sf         scanf
#define GCD(x,y)   __gcd(x, y)
#define pb         push_back
#define ll         long long
#define vs         v.size()
#define ss         s.size()

using namespace std;
int main()
{
    int n,x,t,i=1,ans=0;
    cin>>n>>x>>t;
    while(1)
    {
        ans+=x;
        if(n<=ans) break;
        i++;
    }
    cout<<t*i<<endl;
   return 0;
}


Measured memory_bytes: 3616
#include "bits/stdc++.h"

using namespace std;
using LL = long long;

constexpr int N = 1e5 + 5;

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

    LL H, cnt = 1;
    cin >> H;
    LL result = 0;
    while (H > 0) {
        result += cnt;
        cnt *= 2;
        H /= 2;
    }
    cout << result << endl;
}

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

const ll INF = 1LL << 60;


int main() {
    long long X;
    scanf("%lld",&X);

    ll cnt = 0;
    ll target = 100;
    while (true) {
        if (target >= X) {
            cout << cnt << endl;
            return 0;
        }
        target *= 1.01;
        cnt++;
    }
}


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


typedef struct node {
    int key;
    struct node *left;
    struct node *right;
} Tree;

Tree *root = NULL;

Tree *make1node(int key) {
    Tree *tree = malloc(sizeof(struct node));
    tree->key = key;
    tree->left = NULL;
    tree->right = NULL;
    return tree;
}

void insert(Tree *tree) {
    Tree *x, *y;
    y = NULL;
    x = root;
    while (x != NULL) {
        y = x;
        if (tree->key < x->key) x = x->left;
        else x = x->right;
    }
    if (y == NULL) root = tree;
    else if (tree->key < y->key) y->left = tree;
    else y->right = tree;
}

void printleft(Tree *tree) {
    if (tree->left != NULL) printleft(tree->left);
    printf(" %d", tree->key);
    if (tree->right != NULL) printleft(tree->right);
}

void printmid(Tree *tree) {
    printf(" %d", tree->key);
    if (tree->left != NULL) printmid(tree->left);
    if (tree->right != NULL) printmid(tree->right);
}

void printtree(Tree *tree) {
    printleft(tree);
    printf("\n");
    printmid(tree);
    printf("\n");
}

int main(void){
    int n, key, i;
    char command[7];
    
    scanf("%d", &n);
    
    for (i = 0; i < n; i++) {
        scanf("%s", command);
        if (!strcmp(command, "insert")) {
            scanf("%d", &key);
            insert(make1node(key));
        } else {
            printtree(root);
        }
    }
}


Measured memory_bytes: 17432
#include <iostream>
#include <map>
#include <algorithm>
using namespace std;

int main()
{
    int n;
    cin >>n;
    map <int , int> m;
    int x;
    int counter = 0;
    for (int i=0;i <n;i++) {
        cin >>x;
        if (m[x] > 0) {
            counter++;
        } else {
            m[x]++;
        }
    }
    if (counter % 2 == 1) {
        counter++;
    }
    cout << (n-counter) ;
    return 0;
}


Measured memory_bytes: 4992
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String input = sc.next();
        String[] check = {"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t"
                ,"u","v","w","x","y","z"};
        String result = "None";
        for(int i = 0; i < check.length; i++){
            if(!input.contains(check[i])){
                result = check[i];
                break;
            }
        }
        System.out.println(result);
    }

}

Measured memory_bytes: 23844
#include <stdio.h>
 
int main(void)
{
    int a, b;
 
    scanf("%d %d", &a, &b);
 
    if (a < b) {
        printf("a < b\n");
    } else if (a > b) {
        printf("a > b\n");
    } else {
        printf("a == b\n");
    }
    return 0;
}


Measured memory_bytes: 2104
#include <bits/stdc++.h>
using namespace std;
int main(){
  string a, b; cin >> a >> b;
  a += b;
  int v = 0;
  for(auto it : a) v = v * 10 + it - '0';
  int sq = sqrt(v);
  if(sq * sq == v) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define INF 2 << 29
#define MOD 1000000007
#define Yes(f) puts((f)? "Yes" : "No")
#define YES(f) puts((f)? "YES" : "NO")
int gcd(int a, int b) {
	if (b != 0)return gcd(b, a % b);
	return a;
}
int lcm(int a, int b) {
	return a / gcd(a, b) * b;
}

using Graph = vector<vector<int>>;

int main(){
	int n, y; cin >> n >> y;
	rep(i, n + 1){
		rep(j, n - i + 1){
			if(y - i * 10000 - j * 5000 == (n - i - j) * 1000){
				cout << i << " " << j << " " << n - i - j << endl;
				return 0;
			}
		}
	}
	cout << "-1 -1 -1" << endl;
}

Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var n int
	var s string
	fmt.Scan(&n)
	fmt.Scan(&s)
	x := 0
	max := 0
	for _, v := range s {
		if v == 'I' {
			x++
			if x > max {
				max = x
			}
		} else if v == 'D' {
			x--
		}
	}
	fmt.Println(max)
}

Measured memory_bytes: 512
from sys import stdin
import math
import fractions

n = int(stdin.readline().rstrip())

#cnt = 0
#for i in range(n):
#    for j in range(n):
#        for k in range(n):
#            a = math.gcd(i+1, j+1)
#            b = math.gcd(a, k+1)
#            cnt += b
#
#print(cnt)


cnt = 0
for i in range(n):
    if (i+1) % 3 == 0:
        continue
    elif (i+1) % 5 == 0:
        continue
    else:
        cnt += (i+1)

print(cnt)


Measured memory_bytes: 10476
#include <iostream>
using namespace std;
typedef long long ll;

int main() {
  int n, mid = 0;
  ll sum = 0, left = 0, right = 0;
  cin >> n;
  int a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    sum += a[i];
  }
  int i;
  for (i = 0; i < n; i++) {
    left += a[i];
    if (left > sum / 2) {
      left -= a[i];
      mid = a[i];
      break;
    }
  }
  for (i += 1; i < n; i++)
    right += a[i];
  if (left < right) left += mid;
  else right += mid;
  cout << (left < right ? right-left : left-right) << endl;
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; i++)
#define forep(i, k, n) for (int i = k; i < n; i++)
const int MOD = 1000000007;

ll modpow(ll m, ll n)
{
  ll res = 1;
  while (n > 0)
  {
    if (n & 1)
    {
      res = res * m % MOD;
    }
    m = m * m % MOD;
    n >>= 1;
  }
  return res;
}

int n;
vector<vector<int>> to(200000);

ll ans = 0;
int dfs(int v, int p)
{
  vector<int> ts; // Tからvを除いて得られる各部分木のサイズ
  int res = 1;    // vを根とする部分木のサイズ
  // vの子孫である部分木のサイズを計算
  for (int nv : to.at(v))
  {
    if (nv == p)
    {
      continue;
    }
    int t = dfs(nv, v);
    res += t;
    ts.push_back(t);
  }
  // vの祖先である部分木のサイズを計算
  if (p != -1)
  {
    ts.push_back(n - res);
  }
  int now = (modpow(2, n - 1) - 1 + MOD) % MOD;
  for (int t : ts)
  {
    now = (now - modpow(2, t) + 1 + MOD) % MOD;
  }
  ans = (ans + now) % MOD;
  return res;
}

int main()
{
  cin >> n;
  rep(i, n - 1)
  {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    to.at(a).push_back(b);
    to.at(b).push_back(a);
  }
  dfs(0, -1);
  ll invx = modpow(modpow(2, n), MOD - 2);
  cout << ans * invx % MOD << endl;
}

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

int main() {
    int H;
    int W;
    cin >> H;
    cin >> W;

    for (int i = 0; i < (W+2); i++) {
        if (i == W+1) {
            cout << '#' << endl;
        }
        else {
            cout << '#';
        }
     }

    for (int i = 0; i < H; i++) {
        cout << '#';
        for (int j = 0; j < W; j++) {
            char alpha;
            cin >> alpha;
            cout << alpha;
        }
        cout << '#' << endl;
    }
    for (int i = 0; i < (W+2); i++) {
        if (i == W+1) {
            cout << '#' << endl;
        }
        else {
            cout << '#';
        }
     }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> mp;
ll inf =  1e9;


int main(){
 ll n;
 string s;
 cin>>n>>s;
 ll r=0,g=0,b=0;
 for(ll i=0;i<n;i++){
  if( s[i] == 'R' ){
   r++;
  }else if( s[i] == 'G' ){
   g++;
  }else{
   b++;
  }
 }
 ll ans = r*g*b;

 for(ll i=1;i<=n/2;i++){
  for(ll j=0;j<n;j++){
   if( 2*i+j<n ){
    if( s[j] == s[i+j] || s[j] == s[j+2*i] || s[i+j] == s[j+i*2] ){

    }else{
     ans--;
    }
   }else{
    break;
   }
  }
 }
 cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 3608
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
a.sort();b.sort();c.sort()
a_pt=0;b_pt=0;c_pt=0
ci=0;bi=0;ai=0
while ci < len(c):
  cc=c[ci]
  while bi <len(b):
    bb=b[bi]
    if bb>=cc:
      break
    while ai<len(a):
      aa=a[ai]
      if aa>=bb:
        break
      a_pt+=1
      ai+=1
    b_pt+=a_pt
    bi+=1
  c_pt+=b_pt
  ci+=1

print(c_pt)

Measured memory_bytes: 29368
#include <cmath>
#include <iostream>
#include <cstdio>
#include <ctype.h>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <iomanip>
#include <set>
#include <stack>
#include <queue>
#include <vector>
#include <sstream>
 
 
using namespace std;
 
 
 
string shift_str(string str, int num)
{
    int ascii;
    string ret;
     
    for (int i=0; i<str.length(); i++)
    {
        ascii = str[i];
        //cout << "ascii = " << ascii << endl;
         
        if (!('a' <= ascii && ascii <= 'z'))
        {
            ret += ascii;
        } else {
            ascii += num;
            if (ascii > 'z')
            {
                ret += ((ascii - 'z') + 'a' - 1);
            } else {
                ret += ascii;
            }
        }
         
    }
     
    return ret;
}
//?°?????????±????????´?????????num??§?????¢???????????????
 
 
int main()
{
    string str;
    string ret;
     
    while (getline(cin, str))
    {
        for (int i=1; i<=26; i++)
        {
            ret = shift_str(str, i);
            if ( ret.find("the", 0) != -1
                || ret.find("this", 0) != -1
                || ret.find("that", 0) != -1 )
            {
                cout << ret << endl;
                break;
            }
        }
    }
     
    return 0;
}

Measured memory_bytes: 3052
def resolve():
    a, b, c, x, y = map(int, input().split())
    if a+b > c*2:
        com = min(x, y)
        if x >= y:
            if a > 2*c:
                ans = 2*c*x
            else:
                ans = 2*c*com + (x-y)*a
        else:
            if b > 2*c:
                ans = 2*c*y
            else:
                ans = 2*c*com + (y-x)*b
    else:
        ans = a*x + b*y

    print(ans)

if __name__ == '__main__':
    resolve()

Measured memory_bytes: 3064
// -*- coding:utf-8-unix -*-

use proconio::input;
use std::collections::BTreeSet;

fn main() {
    input! {
        k: u64,
    }

    let mut bts = BTreeSet::new();
    let mut m = 7 % k;
    let mut ans = 1;
    loop {
        if m == 0 {
            println!("{}", ans);
            break;
        } else if bts.contains(&m) {
            println!("-1");
            break;
        }

        bts.insert(m);
        m = (m * 10 + 7) % k;
        ans += 1;
    }
}


Measured memory_bytes: 18568
x,y = map(int,input().split())
a = [1,3,5,7,8,10,12]
b = [4,6,9,11]
c = [2]
if a.count(x)*a.count(y) == 1 or b.count(x)*b.count(y) == 1 or c.count(x)*c.count(y):
  print("Yes")
else:
  print("No")

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

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

	int* a = new int[N];
	bool* flag = new bool[N];
	for (int i = 0; i < N; i++) {
		cin >> a[i];
		flag[i] = false;
	}

	flag[0] = true;
	int count = 0;
	int index = a[0] - 1;
	bool loop = false;
	while (flag[1] != true) {
		if (!flag[index]) {
			flag[index] = true;
			//cout << "index " << index;
			index = a[index] - 1;
			//cout << " to " << index << endl;
			count++;
		}
		else {
			loop = true;
			break;
		}
	}

	if (!loop)
		cout << count;
	else
		cout << -1;
	
	return 0;
}

Measured memory_bytes: 768
def get_num(n, x):
    ans = 0
    for n3 in xrange(min(n, x - 3), (x + 2) / 3, -1):
        for n2 in xrange(min(n3 - 1, x - n3 - 1), (x - n3 + 1) / 2 - 1, -1):
            for n1 in xrange(min(n2 - 1, x - n3 - n2), 0, -1):
                if n3 == x - n1 - n2:
                    ans += 1
                    break
    return ans


while True:
    [n, x] = [int(m) for m in raw_input().split()]
    if [n, x] == [0, 0]:
        break
    if x < 3:
        print(0)
    else:
        print(get_num(n, x))

Measured memory_bytes: 6352
N, Q = map(int, input().split())
S = str(input())

num = [0] * N

pre = ''
n = 0
for i in range(N):
    if pre == 'A' and S[i] == 'C':
        n += 1
    num[i] = n

    pre = S[i]


for i in range(Q):
    l, r = map(int, input().split())
    if l == 1:
        print(num[r-1])
    else:
        if S[l-1] == 'C' and S[l-2] == 'A':
            print(num[r-1] - num[l-2] - 1)
        else:
            print(num[r-1] - num[l-2])





Measured memory_bytes: 7900
import std.stdio;
import std.algorithm;
import std.string;
import std.conv;
import std.math;

void main(){

    while(true){
	auto s = readln();
	if(stdin.eof()) break;
	auto t = split(s);
	real[] x,y;
	for(int i=0;i<4;i++){
	    x ~= to!real(t[2*i]);
	    y ~= to!real(t[2*i+1]);
	}
	real ax = to!real(t[0]) - to!real(t[2]);
	real ay = to!real(t[1]) - to!real(t[3]);
	real bx = to!real(t[4]) - to!real(t[6]);
	real by = to!real(t[5]) - to!real(t[7]);
	real m,m1;
	bool flg = false;
	if(ax==0){
	    if(bx!=0&&by==0) flg = true;
	}else if(bx==0){
	    if(ax!=0&&ay==0) flg = true;
	}else{
	    m = ay/ax;
	    m1 = by/bx;
	    if(m*m1 == -1) flg = true;
	}

	if(flg) writeln("YES");
	else writeln("NO");
    }

}

Measured memory_bytes: 2464
import java.io.*;
import java.util.*;

class Main{
	public void run(){
		String ans = "CODEFESTIVAL2016";
		int len = ans.length();
		String str = next();
		int n = 0;
		for(int i=0;i<len;i++){
			if(str.charAt(i) != ans.charAt(i)){
				n++;
			}
		}
		out.println(n);
	}

	private static PrintWriter out;
	public static void main(String[] args){
		out = new PrintWriter(System.out);
		new Main().run();
		out.flush();
	}

	public Main(){
	}

	int ni(){
		int num = 0;
		String str = next();
		boolean minus = false;
		int i = 0;
		if(str.charAt(0) == '-'){
			minus = true;
			i++;
		}
		int len = str.length();
		for(;i < len; i++){
			char c = str.charAt(i);
			if(!('0' <= c && c <= '9')) throw new RuntimeException();
			num = num * 10 + (c - '0');
		}
		return minus ? -num : num;	}

	long nl(){
		long num = 0;
		String str = next();
		boolean minus = false;
		int i = 0;
		if(str.charAt(0) == '-'){
			minus = true;
			i++;
		}
		int len = str.length();
		for(;i < len; i++){
			char c = str.charAt(i);
			if(!('0' <= c && c <= '9')) throw new RuntimeException();
			num = num * 10l + (c - '0');
		}
		return minus ? -num : num;
	}

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

	String next(){
		int c;
		while(!isAlNum(c = read()));
		StringBuilder build = new StringBuilder();
		build.append((char)c);
		while(isAlNum(c = read())){
			build.append((char)c);
		}
		return build.toString();
	}
	String nextLine(){
		int c;
		while(!isAlNumOrSpace(c = read()));
		StringBuilder build = new StringBuilder();
		build.append((char)c);
		while(isAlNumOrSpace(c = read())){
			build.append((char)c);
		}
		return build.toString();
	}
	private static byte[] inputBuffer = new byte[1024];
	private static int bufferLength = 0;
	private static int bufferIndex = 0;
	
	private static int read(){
		if(bufferLength < 0) throw new RuntimeException();
		if(bufferIndex >= bufferLength){
			try{
				bufferLength = System.in.read(inputBuffer);
				bufferIndex = 0;
			}catch(IOException e){
				throw new RuntimeException(e);
			}
			if(bufferLength <= 0) return (bufferLength = -1);
		}
		return inputBuffer[bufferIndex++];
	}
	
	private static boolean isAlNum(int c){
		return '!' <= c && c <= '~';
	}
	private static boolean isAlNumOrSpace(int c){
		return isAlNum(c) || c == ' ' || c == '\t';
	}
	void debug(Object... os){
		out.println(Arrays.deepToString(os));
	}
}

Measured memory_bytes: 8148
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include<iostream>
#include<cstdint>
#include<cstddef>
using namespace std;
using i32 = int_fast32_t;
using i64 = int_fast64_t;
using usize = uint_fast64_t;
#define rep(i, n) for (usize i = 0; i < (usize)(n); i++)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
using P = pair<i64,i64>;

int main(){
ios::sync_with_stdio(false);
std::cin.tie(nullptr);
i32 a;
cin >> a;
cout << (a ^ 1) << endl;
}

Measured memory_bytes: 3648
package main

import (
	"fmt"
)
func main() {
	flag:=0
	var temp int
	var counter int
	fmt.Scanf("%d",&temp)
	counter = temp
	arr:=make([] int,counter,1000)
	for i:=0;i<counter;i++ {
		fmt.Scanf("%d",&temp)
		arr[i] = temp
	}
	for i := 0;i< len(arr);i++ {
		for j := len(arr) - 1; j > i; j-- {
			if arr[j] < arr[j-1] {
				temp := arr[j]
				arr[j] = arr[j-1]
				arr[j-1] = temp
				flag++
			}
		}
	}
	putout(arr)
	fmt.Println(flag)
}
func putout(arr []int) {
	i:=0
	for i=0;i<len(arr)-1;i++ {
		fmt.Printf("%d ",arr[i])
	}
	fmt.Print(arr[i])
	fmt.Println()
}



Measured memory_bytes: 1136
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main( ) {
	// your code goes here
     ll t,i,j,n,m,k=0;
      
      ll r,g,b;
      cin>>r>>g>>b;
      cin>>m;
      while(r>=g && m)
      {
      	g*=2;
      	m--;
       
	  }
	  while(g>=b && m)
	  {
	  	b*=2;
	  	m--;
	  	
	  }
	  if(r<g && g<b)cout<<"Yes\n";
	  else cout<<"No\n";
	  
	return 0;
}



Measured memory_bytes: 3632
// C - Together
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
#define all(x) (x).begin(),(x).end()
#define rp(i,s,e) for(int i=(s);i<(e);++i)

int solve(int N, int MAX, vi &A){
	sort(all(A));
	vi C(MAX+1);
	rp(i, 0, N) C[A[i]]++;
	int a = C[0], b = C[1], c = C[2];
	int ans = a + b + c;
	rp(i, 3, C.size())
		if(C[i] != 0){
			a = b; b = c; c = C[i];
			ans = max(ans, a+b+c);
		}
	return ans;
}

int main(){
	int N; cin>>N;
	vi A(N);
	int MAX = 0;
	rp(i, 0, N){
		cin>>A[i];
		MAX = max(MAX, A[i]);
	}
	cout<< solve(N, MAX, A) <<endl;
}

Measured memory_bytes: 1024
n,m = map(int,input().split())
from collections import deque

links = [set() for _ in range(n+1)]
for _ in range(m):
    a,b = map(int, input().split())
    links[a].add(b)

def bfs(links, start):
    parent = [-1] * (n+1)
    selfdepth = 10**6
    d = deque()
    done = {start}
    d.append((start,0))
    while(d):
        edge,depth = d.popleft()
        for i in links[edge]:
            if(i == start):
                selfdepth = depth + 1
                parent[i] = edge
                return( selfdepth, parent )
            if(not i in done):
                parent[i] = edge
                d.append((i,depth+1))
                done.add(i)

    return ( selfdepth, parent )

k = 10**6
start = -1
for i in range(1,n+1):
    selfdepth, parent_tmp = bfs(links, i)
    if(k > selfdepth):
        k = selfdepth
        start = i
        parent_k = parent_tmp

if(start == -1):
    print(-1)
    exit()

print(k)
print(start)
now = parent_k[start]
cnt = 0
while(now != start):
    print(now)
    now = parent_k[now]

Measured memory_bytes: 48088
bingo = []
for _ in range(3):
    row = list(map(int,input().split()))
    bingo.append(row)

N = int(input())
bingo_flag = [[False] * 3 for _ in range(3)]
for _ in range(N):
    num = int(input())
    for i in range(3):
        for j in range(3):
            if bingo[i][j] == num:
                bingo_flag[i][j] = True

# print(bingo_flag)
is_bing = False
for i in range(3):
    if bingo_flag[i][0] and bingo_flag[i][1] and bingo_flag[i][2] or \
            bingo_flag[0][i] and bingo_flag[1][i] and bingo_flag[2][i]:
        is_bing = True
        break

if bingo_flag[0][0] and bingo_flag[1][1] and bingo_flag[2][2] or \
        bingo_flag[0][2] and bingo_flag[1][1] and bingo_flag[2][0]:
    is_bing = True

if is_bing:
    print("Yes")
else:
    print("No")


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

long long r, d, x;
long long memo[3005] = {0};

void solve();

int main() {
  cin >> r >> d >> x;
  memo[2000] = x;
  solve();
  for(int i = 1; i <= 10; ++i)
    cout << memo[i + 2000] << endl;
  return 0;
}

void solve() {
  for(int i = 2001; i <= 2010; ++i) {
    memo[i] = memo[i - 1] * r - d;
  }
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void){
    int a,b,d,r;
    double f;
    scanf("%d %d",&a,&b);
    d=a/b;
    r=a%b;
    f=(double)a/(double)b;
    printf("%d %d %.5f",d,r,f);
    return 0;
}



Measured memory_bytes: 2064
// CODE by Kazhybay Askar
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <bits/stdc++.h>

using namespace std;
using namespace __gnu_pbds;

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

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


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

ll a[MAXN],b[MAXN];
vector<int>g[MAXN],v;
bool used[MAXN];
int n,m,k,cnt=0,sum=0,ans=0,mx=0,mn=INF;
bool y=0;

void freopen(){
	freopen("A.in","r",stdin);
	freopen("A.out","w",stdout);
}


void solve(){
	cin>>n;
	cout<<fixed<<setprecision(10);

    if(n%2==0){
            double a=1;
        cout<<a*1/2;
    }
    else{
        double a=n,b=n/2;
        b++;
        cout<<b/a;
    }
}

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




Measured memory_bytes: 2560
x = int(input())
d = []
for i in range(-1000, 1000):
    d.append([i**5, i])

for j in range(len(d)):
    for i in range(len(d)):
        tmp = d[i][0] - d[j][0]
        if x == tmp:
            print(d[i][1], d[j][1])
            exit()


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

#define int long long 
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define pii pair<int,int> 

const int INF=2e9;
const int mod=998244353;


int32_t main(){
    int n;
    cin>>n;
    pii arr[n];
    int dp[n+1];
    for(int i=0;i<n;i++) cin>>arr[i].ff>>arr[i].ss;
    sort(arr,arr+n);
    dp[n]=1;
    stack<pii> s;
    s.push({n,INF});
    for(int i=n-1;i>=0;i--){
        pii mx=s.top();
        while(mx.ss<arr[i].ff+arr[i].ss){
            s.pop();
            mx=s.top();
        }
        //by coming here means now we have reached an index where we can't reach therefore 
        
        s.push({i,arr[i].ff});
        int j=mx.ff;
        dp[i]=(dp[i+1]+dp[j])%mod;

    }
    cout<<dp[0]<<endl;
}

Measured memory_bytes: 6528
#include <stdio.h>

int main()
{
	int N, K, n, i, j, cnt = 0, sum = 0, start = 0, max = 0, flag = 0, tc1 = 0, tc2 = 0, *T1, *T2;;
	char c, *S;

	scanf("%d %d", &N, &K);
	S = (char*)malloc(sizeof(char)*N);
	T1 = (int*)malloc(sizeof(int)*N);
	scanf("%s", S);
	
	c = S[0];
	cnt = 1;
	for (i = 1; i < N; i++) {
		if (c == S[i])
			cnt++;
		else {
			T1[tc1++] = cnt;
			cnt = 1;
			c = S[i];
		}
	}
	T1[tc1] = cnt;
	T1[++tc1] = 0;
	tc1 += (tc1 & 0x01);
	T1[tc1] = 0;

	T2 = (int*)malloc(sizeof(int)*tc1);
	T2[tc2] = 0;

	if (S[0] == '1') {
		start = 1;
	}
	for (i = start; i < tc1; i += 2) {
		for (j = 0; j < K; j++) {
			n = i + (j << 1);
			if (n > tc1) break;
			if (T1[n] == 0) break;
			T2[tc2] += T1[n + 0] + T1[n + 1];
		}
		if (i > 0) T2[tc2] += T1[i - 1];
		T2[++tc2] = 0;
	}

	for (i = 0; i < tc2; i++) {
		if (max < T2[i])
			max = T2[i];
	}

	printf("%d", max);

	return 0;
}


Measured memory_bytes: 896
#include <stdio.h>
#include <stdlib.h>
int compare_int(const void *a, const void *b)
{
    return *(int *)a - *(int *)b;
}
int a[5], b[5], count, i, gomi;
int main(void)
{
    count = 0;
    for (i = 0; i < 5; i++){
        scanf("%d",&a[i]);
    }
    for (i = 0; i < 5; i++){
        b[i] = (a[i] % 10)*1000+a[i];
    }
    gomi = -1;
    qsort(b, 5, sizeof(int), compare_int);
    //printf("%d\n",count);
    for (i = 0; i < 5; i++)
    {
       //printf("%d\n",count);
        if (b[i]/1000 == 0)
        {
            count += (b[i]%1000);
            gomi += 1;
        }
        else{
        gomi += 1;
        if (i == gomi)
        {
            count += b[i]%1000;
            gomi += 6;
        }
        else
        {
            count += b[i]%1000+(10-b[i]/1000);
        }
    }
    
}printf("%d", count);
return 0;
}

Measured memory_bytes: 128
#include"bits/stdc++.h"

using namespace std; 

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef pair<LL, LL> PLL;
typedef vector<PLL> VPLL;
typedef priority_queue<LL> PQ_DESC;
typedef priority_queue<LL, VL, greater<LL>> PQ_ASC;
typedef priority_queue<PII> PQ_DESC_PII;
typedef priority_queue<PII, vector<PII>, greater<PII>> PQ_ASC_PII;
typedef priority_queue<VL> PQ_DESC_VL;
typedef priority_queue<VL, vector<VL>, greater<VL>> PQ_ASC_VL;
typedef priority_queue<PLL> PQ_DESC_PLL;
typedef priority_queue<PLL, vector<PLL>, greater<PLL>> PQ_ASC_PLL;

#define ALL(c) (c).begin(),(c).end()
#define PB push_back
#define MP make_pair
#define SORT_ASC(c) sort(ALL(c))
//#define SORT_DESC(c) sort(ALL(c), greater<typeof(*((c).begin()))>())
#define SORT_DESC(c) sort((c).rbegin(),(c).rend())
#define REV(c) reverse((c).begin(), (c).end())
#define SIZE(a) int((a).size())

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

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int LARGE_INT = 1e9+100;
const int INF = 2e9+100;
const LL INF_LL = (LL)INF*(LL)INF;
const int MOD = 1e9+7;

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

LL modpow(LL a, LL n) {
    LL res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return res;
}

void Main()
{
    int H,W;cin>>H>>W;
    int h,w;cin>>h>>w;

    cout<<(H-h)*(W-w)<<endl;
    
	return;
}

int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
    return 0;
}

Measured memory_bytes: 3644
# https://atcoder.jp/contests/abc086/tasks/arc089_a

N = int(input())


def is_reachable(src, dst):
    can_go = True
    dt = dst[0] - src[0]
    dist = abs(dst[1] - src[1]) + abs(dst[2] - src[2])
    if dt < dist:
        can_go = False
    if dt % 2 != dist % 2:
        can_go = False
    return can_go


route = [list(map(int, input().split())) for _ in range(N)]
route.insert(0, [0, 0, 0])

# print(route)

reachable = True

for i in range(N):
    source = route[i]
    destination = route[i + 1]
    if not is_reachable(source, destination):
        reachable = False

if reachable:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 27324
import java.util.ArrayList;
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        String str =  scanner.next();
        int length_a = 0;
        int length_z = 0;
        int margin;

        String[] strArray = new String[str.length()];
        ArrayList<String> mojiArray = new ArrayList<String>();

        for(int i = 0; i < str.length(); i ++){
            char str2 = str.charAt(i);

            if(str2 == 'Z'){
                length_z = i;
            }
        }

        for(int i = 0; i < str.length(); i ++){
            char str3 = str.charAt(i);

            if(str3 == 'A') {
                length_a = i;
                break;
            }
        }
        margin = length_z - length_a + 1;
        System.out.println(margin);
    }
}


Measured memory_bytes: 26544
//Zory-2019
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pr;
#define FR first
#define SE second
#define MP make_pair
#define PB push_back
#define vc vector
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define bin(x) (1ll<<(x))
#define fo(i,l,r) for(int i=(l),I=(r);i<=I;i++)
#define fd(i,r,l) for(int i=(r),I=(l);i>=I;i--)
#define Debug printf("Passing [%s] in LINE %d\n",__FUNCTION__,__LINE__)
#define debug(x) cerr<<#x<<'='<<x<<endl
namespace mine
{
    ll qread()
    {
        ll ans=0,f=1;char c=getchar();
        while(c<'0' or c>'9') {if(c=='-')f=-1;c=getchar();}
        while('0'<=c and c<='9') ans=ans*10+c-'0',c=getchar();
        return ans*f;
    }
    void write(ll num){if(num<0) putchar('-'),num=-num;if(num>=10) write(num/10);putchar('0'+num%10);}
    void write1(ll num){write(num);putchar(' ');}
    void write2(ll num){write(num);putchar('\n');}
    template<typename T> void chmax(T &x,const T y) {x=(x>y?x:y);}
    template<typename T> void chmin(T &x,const T y) {x=(x<y?x:y);}
    ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}

    const int INF=0x3f3f3f3f;
    const int MOD=998244353;
    int mm(const int x){return x>=MOD?x-MOD:x;}
    template<typename T> void add(T &x,const int &y){x=(x+y>=MOD?x+y-MOD:x+y);}
    ll qpower(ll x,ll e,int mod=MOD){ll ans=1;while(e){if(e&1)ans=ans*x%mod;x=x*x%mod;e>>=1;}return ans;}
    ll invm(ll x){return qpower(x,MOD-2);}
    const int N=1e6+10;


    void main()
    {
        ll T1=qread(),T2=qread(),A1=qread(),A2=qread(),B1=qread(),B2=qread();
        A1*=T1,B1*=T1,A2*=T2,B2*=T2;
        ll A=A1+A2,B=B1+B2;
        if(A==B) puts("infinity");
        else if(A1<=B1 and A2<=B2) puts("0");
        else if(A1>=B1 and A2>=B2) puts("0");
        else
        {
            if(A<B) swap(A1,B1),swap(A2,B2),swap(A,B);
            if(A1>B1)
            {
                puts("0");
                return;
            }
            ll x=(B1-A1)/(A-B);
            ll y=(-(A1-B1)-1)/(A-B);
            ll ans=x+y+1;
            write(ans);
        }
    }
};//(ans+MOD)%MOD
signed main()
{
    srand(time(0));
    mine::main();
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <chrono>
//#include<math.h>
using namespace std::chrono;
using namespace std;
#define fr(x,i,n) for(int x = i; x < n; ++x)
#define fb(x,i,n) for(int x = i; x >= n; --x)
#define pr pair<int,int>
#define ll long long int
#define ld long double
const ll mod=1e9+7;
//const ld M_PI=3.14159265358979323;

/*    auto start = high_resolution_clock::now();
    auto stop = high_resolution_clock::now();
    auto duration = duration_cast<microseconds>(stop - start);
    cout << "\nduration="<<duration.count()/1e6 << endl;
*/
ll f(ll x,ll n){
    ll r=1;
    while(n){
        if(n%2==1)
        r=(r*x)%mod;
        x=(x*x)%mod;
        n/=2;
    }
    return r;

}

vector<ll> fact(2e5+10,1),ifact(2e5+10);
void build(){
    for(ll i=2;i<fact.size();i++)
    fact[i]=(i*fact[i-1])%mod;
    fr(i,0,fact.size()){
        ifact[i]=f(fact[i],mod-2);
    }
}
ll C(int n, int r){
    if(n<r)
    return 0;
    return (((fact[n]*ifact[r])%mod)*ifact[n-r])%mod;
}

/*ll C[1001][1001];
void build(){
    memset(C,0,sizeof(C));
    fr(i,0,1001)
    C[i][i]=1;
    fr(i,0,1001)
    C[i][0]=1;
    fr(i,2,1001){
        fr(j,1,i){
            C[i][j]=(C[i-1][j]+C[i-1][j-1])%mod;
        }
    }
}*/
void solve(){
    ld a,b,h,m;
    cin>>a>>b>>h>>m;
    ld th=(h/12-m/60)*(2*M_PI);
    th+=(m/60)*(M_PI/6);
    th=abs(th);
    if(th>M_PI)
    th=2*M_PI-th;
    ld c=sqrt(a*a+b*b-2*a*b*cos(th));
    cout<<fixed<<setprecision(20);
    cout<<c;

}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
//    build();
    int t=1;
//    cin>>t;
    while(t--)
    solve();

}


Measured memory_bytes: 6272
#include <iostream>
#include <vector>
#include <string>


using namespace std;

string S;

int main()
{

	cin >> S;

	bool ans = true;

	ans = !(S[0] == S[1] && S[0] == S[2]);


	cout << (ans?"Yes":"No")<< endl;

	return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <string>

using namespace std;

int main(){
	int a, b;
	string s;
	cin >> a >> b >> s;

	bool flag = true;
	int idx = 0;
	for(; idx < a; idx++){
		if(s[idx] < '0' || s[idx] > '9')
			flag = false;
	}
	if (s[idx++] != '-')
		flag = false;
	for(; idx < a + b + 1; idx++){
		if(s[idx] < '0' || s[idx] > '9')
			flag = false;
	}
	if (flag)
		printf("Yes\n");
	else
		printf("No\n");
	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++)
using ll = long long;

int main(){
  ll a, c; double b;
  cin >> a >> b;
  c = (ll)(b*100 + 0.1);
  cout << a*c/100 << endl;
  return 0;
}


Measured memory_bytes: 3724
from collections import deque
N = int(input())
stack = deque(["0"])
cnt = 0
while len(stack)>0:
    c = stack.pop()
    for s in "753":
        cs = c + s
        # print(cs)
        if int(cs)<=N:
            stack.append(cs)
            if cs.count("3")*cs.count("5")*cs.count("7")>0:
                cnt += 1
print(cnt)

Measured memory_bytes: 3316
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
#define ll long long
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define DUMP(x) cout << #x << " = " << (x) << endl
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef pair<int, int> PII;

int main() {
  int n; cin >> n;
  int m = n;
  int x = 0;
  while (m > 0) {
    x += m % 10;
    m /= 10;
  }
  cout << (n % x == 0 ? "Yes" : "No") << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int fx4[] = {1 , -1 , 0 , 0};
int fy4[] = {0 , 0 , 1 , -1};
int Kfx[]= {-2,-2,2,2,1,1,-1,-1}; ///knight move x - exis
int Kfy[]= {1,-1,1,-1,2,-2,2,-2}; ///knight move y- exis
int fx8[]= {1,1,1,0,0,-1,-1,-1};
int fy8[]= {0,1,-1,1,-1,0,1,-1};
#define ll long long int
#define pii pair<int,int>
#define llu unsigned long long
#define inf 1<<28
#define gama 0.57721566490
#define PI              acos(-1.0)
#define INF             0x7fffffff
#define MOD             1000000007
#define EPS             1e-7
#define all(r)(r).begin(),(r).end()
/*
bool status[mx];
void sieve(){
   long long int  i,j;
    for(i=2;i<=mx;i++)
    {
        status[i]=0;
    }
    for( i=2;i<=sqrt(mx);i++){
        if(status[i]==0)
        {
            for(j=i*i;j<=mx;j+=i){
                status[j]=1;
            }
        }
    }
}*/
ll BM( ll a , ll b , ll m )
{
    if ( b == 0 ) return 1 ;
    ll x = BM(a,b/2,m);
    x = (( x % m) * (x % m))%m;

    if( b % 2 ) x = (( x % m) * (a %m)) % m ;
    return x ;
}
#define dd double
#define sc scanf
#define pr printf
#define VI vector<int>
#define VS vector<string>
#define VC vector<char>
#define VLL vector<long long int>
#define FILE freopen("input.txt","rt",stdin); freopen("output.txt","w",stdout);
#define p_b push_back
#define mem(x,y) memset(x,y,sizeof(x))
#define F(i,a,b) for(i=a;i<=b;i++)
#define sc1(a) scanf("%d",&a)
#define scL1(a) scanf("%lld",&a)
#define scL2(a,b) scanf("%lld%lld",&a,&b)
#define sc2(a,b) scanf("%d%d",&a,&b)
#define sc3(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define scL3(a,b,c) scanf("%lld%lld%lld",&a,&b,&c)
#define fori(N)          for(int i = 0; i<(N); i++)
#define forj(N)         for(int j = 0; j<(N); j++)
#define fork(N)         for(int k = 0; k<(N); k++)
#define forl(N)         for(int l = 0; l<(N); l++)
#define ford(N)         for(int d = 0; d<(N); d++)
#define fori1(N)          for(int i = 1; i<=(N); i++)
#define forj1(N)         for(int j = 1; j<=(N); j++)
#define fork1(N)         for(int k = 1; k<=(N); k++)
#define ford1(N)         for(int d = 1; d<=(N); d++)
#define sqr(x)           (x)*(x)
#define TEST int test,te=0;cin>>test;
#define segment_tree int l=(n*2),r=(n*2)+1,mid=(l+r)/2
#define Mx 100005
#define mx 10005

int main()
{
ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);///Beware of use it, if u use it dont use scanf or printf
    ll n;
    cin>>n;
    if(n%2==1){
    	cout<<"0"<<endl;
	}
	
	else{
		ll ans=0;
			ll x=5;
		while(x<=n){
		
	
		ans+=((n/x)/2);
		x*=5;
	}
		cout<<ans<<endl;
	
}
}


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

struct UnionFind {
  vector<int> parent;
  int size;

  UnionFind(int N) : parent(N) {
    for (int i = 0; i < N; i++) parent[i] = i;
    size = N;
  }

  int root(int x) {
    if (parent[x] == x) return x;
    return parent[x] = root(parent[x]);
  }

  void unite(int x, int y) {
    int rx = root(x);
    int ry = root(y);
    if (rx == ry) return;
    parent[rx] = ry;
    size--;
  }

  bool same(int x, int y) {
    int rx = root(x);
    int ry = root(y);
    return rx == ry;
  }
};

int main()
{
  int N, M; cin >> N >> M;
  UnionFind tree(N);

  for (int i = 0; i < M; i++)
  {
    int X, Y, Z; cin >> X >> Y >> Z;
    X--; Y--;
    tree.unite(X, Y);
  }

  cout << tree.size << endl;
}

Measured memory_bytes: 640
import java.util.Arrays;
import java.util.Scanner;
 
class Main{
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int ans = 0;

    int n = sc.nextInt();
    int a = sc.nextInt();
    boolean check = true;
    if(n%500 <= a){
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }

    sc.close();
  }
}


Measured memory_bytes: 21588
import java.util.Scanner;

public class Main {

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

		char[] s1 = sc.next().toCharArray();
		char[] s2 = sc.next().toCharArray();
		int n = s1.length;
		int m = s2.length;

		int[][] dp = new int[2][m + 1];
		for (int i = 0; i <= n; i++) {
			for (int j = 0; j <= m; j++) {
				if (i == 0) {
					dp[i % 2][j] = j;
				} else if (j == 0) {
					dp[i % 2][0] = i;
				} else {
					if (s1[i - 1] == s2[j - 1]) {
						dp[i % 2][j] = Math.min(dp[(i - 1) % 2][j - 1], dp[(i - 1) % 2][j] + 1);
					} else {
						dp[i % 2][j] = Math.min(dp[(i - 1) % 2][j - 1] + 1, dp[(i - 1) % 2][j] + 1);
					}
					dp[i % 2][j] = Math.min(dp[i % 2][j], dp[i % 2][j - 1] + 1);
				}
			}
		}

		System.out.println(dp[n % 2][m]);
		
		sc.close();
	}
}

Measured memory_bytes: 19796