akhauriyash/Code-Regression huggingface dataset:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {
	
	static int MOD, N;
	static int[][] table;
	
	static int calc(int pos, int rem) {
		if (pos == N) return rem;
		int ret = table[pos][rem];
		if (ret != -1) return ret;
		ret = 0;
		int factor = Math.min(pos, N + 1 - pos);
		for (int i = 0; i < rem ; i+= factor) {
			ret += calc(pos + 1, rem - i);
			ret %= MOD;
		}
		return table[pos][rem]=ret;
	}
	
	
	public static void main(String[] args) throws IOException {
		MyScanner sc = new MyScanner();
		PrintWriter out = new PrintWriter(System.out);
		N = sc.nextInt();
		MOD = sc.nextInt();
		
		table = new int[N + 1][N + 1];
		for (int rem = 0; rem < N + 1 ; rem++) {
			table[N][rem] = rem;
		}
		for (int pos = N - 1; pos >= 1; pos--) {
			for (int rem = 0; rem < N + 1; rem++) {
				int factor = Math.min(pos, N + 1 - pos);
				for (int i = 0; i < rem ; i+= factor) {
					table[pos][rem] += table[pos + 1][rem - i];
					table[pos][rem] %= MOD;
				}
			}
		}
		out.println(calc(1, N));
		
		out.flush();
	}
	
	static class MyScanner {
		private BufferedReader br;
		private StringTokenizer tokenizer;
		
		public MyScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}
		
		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}
		
		public int nextInt() {
			return Integer.parseInt(next());
		}
		
		public long nextLong() {
			return Long.parseLong(next());
		}
	}
}


Measured memory_bytes: 166100
# -*- coding: utf-8 -*-
import sys
import math
from bisect import bisect_left
from bisect import bisect_right
import collections
import copy
import heapq
from collections import defaultdict
from heapq import heappop, heappush
import itertools
input = sys.stdin.readline
 
##### リストの 二分木検索 #####
# bisect_left(lists, 3)
# bisect_right(lists, 3)
 
##### プライオリティキュー #####
# heapq.heapify(a) #リストaのheap化
# heapq.heappush(a,x) #heap化されたリストaに要素xを追加
# heapq.heappop(a) #heap化されたリストaから最小値を削除＆その最小値を出力
 
# heapq.heappush(a, -x) #最大値を取り出す時は、pushする時にマイナスにして入れよう
# heapq.heappop(a) * (-1) #取り出す時は、-1を掛けて取り出すこと
 
##### タプルリストのソート #####
# sorted(ans) #(a, b) -> 1st : aの昇順, 2nd : bの昇順
# sorted(SP, key=lambda x:(x[0],-x[1])) #(a, b) -> 1st : aの昇順, 2nd : bの降順
# sorted(SP, key=lambda x:(-x[0],x[1])) #(a, b) -> 1st : aの降順, 2nd : bの昇順
# sorted(SP, key=lambda x:(-x[0],-x[1])) #(a, b) -> 1st : aの降順, 2nd : bの降順
 
# sorted(SP, key=lambda x:(x[1])) #(a, b) -> 1st : bの昇順
# sorted(SP, key=lambda x:(-x[1])) #(a, b) -> 1st : bの降順
 
def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))
 
def main():
    S = input()
    T = input()
    S = S[:-1]
    T = T[:-1]
    
    S_dict = {}
    T_dict = {}
    for i in range(len(S)):
        if S[i] in S_dict:
            S_dict[S[i]] += 1
        else:
            S_dict[S[i]] = 1
            
        if T[i] in T_dict:
            T_dict[T[i]] += 1
        else:
            T_dict[T[i]] = 1
            
    S_list = []
    T_list = []
    for k,v in S_dict.items():
        S_list.append(v)
    for k,v in T_dict.items():
        T_list.append(v)
        
    S_list.sort()
    T_list.sort()
    
    if S_list == T_list:
        print("Yes")
    else:
        print("No")
    #print(S_list)
    #print(T_list)
        
    
if __name__ == "__main__":
	main()


Measured memory_bytes: 42764
#include <bits/stdc++.h>
    #define rep(i,n) for(int i = 0; i < (n); i++)
     
    using namespace std;  
    
    int main() {
     cout<<fixed<<setprecision(12);
     double a,b;
     int c;
     const double pi = 3.14159265359;
     
     cin >> a >> b >> c;
     
     double sheta = pi*c/180;
     double h = b * sin(sheta);
     double s = (a*h) / 2;
     double d = b*cos(pi - sheta);
     
     cout <<fixed<<setprecision(6)<< s << '\n';
     cout <<fixed<<setprecision(6)<< sqrt(pow(a,2)+pow(b,2)-2*a*b*cos(sheta)) + a + b<< '\n';
     cout <<fixed<<setprecision(6)<< h << '\n';
      
     return 0;
    }
    


Measured memory_bytes: 3512
#include <stdio.h>
#include <string.h>
  
  
int main(){
    char str1[100], str2[100];
    int n, point[2] = {0}, tmp, i;
      
    scanf("%d", &n);
      
    for(i = 0; i < n;i++){
        scanf("%s %s", str1, str2);
        tmp = strcmp(str1, str2);
        if(tmp == 0)  point[0] += 1, point[1] += 1;
        if ( tmp > 0) point[0] += 3;
        if ( tmp < 0) point[1] += 3;
    }
      
    printf("%d %d\n", point[0], point[1]);
    return 0;
      
}

Measured memory_bytes: 604
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &Scanner{sc}
}

func (s *Scanner) nextStr() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *Scanner) nextInt() int {
	i, e := strconv.Atoi(s.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) nextFloat() float64 {
	f, e := strconv.ParseFloat(s.nextStr(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *Scanner) nextRuneSlice() []rune {
	return []rune(s.nextStr())
}

func (s *Scanner) nextIntSlice(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextInt()
	}
	return res
}

func max(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m < i {
			m = i
		}
	}
	return m
}

func min(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m > i {
			m = i
		}
	}
	return m
}

func abs(x int) int {
	if x > 0 {
		return x
	}
	return -x
}

func pow(x, y int) int {
	res := 1
	for i := 0; i < y; i++ {
		res *= x
	}
	return res
}

func main() {
	sc := NewScanner()
	N := sc.nextInt()
	L := sc.nextIntSlice(N)
	sort.Ints(L)
	max := L[len(L)-1]
	sum := 0
	for i := 0; i < N-1; i++ {
		sum += L[i]
	}
	if sum > max {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


Measured memory_bytes: 640
#include <iostream>

using namespace std;

int main()
{
	int n;

	cin >> n;
	int a = 1;
	for (int i = 3; i <= n; i++) {
		if (i % 2 == 1) {
			a++;
		}
	}

	cout << ((double)a / n) << endl;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define endl "\n"
#define int long long

int32_t main()
{
      ios::sync_with_stdio(false);
      cin.tie(0); 
      int n;
      cin>>n;
      vector<int> h(n+1);
      for(int i = 0; i < n; i++) {
            cin>>h[i+1];
      }
      vector<int> dp(n+1);
      dp[1] = 0;
      dp[2] = abs(h[2]-h[1]);
      for(int i = 3; i < n+1; i++) {
            dp[i] = min(dp[i-1]+abs(h[i-1]-h[i]), dp[i-2]+abs(h[i-2]-h[i]));
      }
      cout<<dp[n]<<endl;


      return 0;
}

Measured memory_bytes: 1792
#include<stdio.h>

int main(void){
  int n;
  int a[100000];
  int dif[99999] = {0};
  scanf("%d", &n);
  for(int i=0; i<n; i++){
    scanf("%d", &a[i]);
    dif[a[i]] ++;
  }

  for(int i=(n+1)%2; i<n; i+=2){
    if(i == 0){
      if(dif[0] != 1){
        printf("%d\n", 0);
        return 0;
      }
    }else if(dif[i] != 2){
      printf("%d\n", 0);
      return 0;
    }
  }

  int ans = 1;
  for(int i=0; i<n/2; i++){
    ans *= 2;
    ans %= 1000000007;
  }

  printf("%d\n", ans);

  return 0;
}


Measured memory_bytes: 2496
#include<bits/stdc++.h>
#define fi first
#define se second
#define lc (x<<1)
#define rc (x<<1|1)
#define gc getchar()//(p1==p2&&(p2=(p1=buf)+fread(buf,1,size,stdin),p1==p2)?EOF:*p1++)
#define mk make_pair
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pb push_back
#define IT iterator
#define vi vector<int>
#define TP template<class o>
#define SZ(a) ((int)a.size())
#define all(a) a.begin(),a.end()
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
const int N=33,size=1<<20,inf=2e9;

//char buf[size],*p1=buf,*p2=buf;
template<class o> void qr(o &x) {
    char c=gc; x=0; int f=1;
    while(!isdigit(c)){if(c=='-')f=-1; c=gc;}
    while(isdigit(c)) x=x*10+c-'0',c=gc;
    x*=f;
}
template<class o> void qw(o x) {
    if(x/10) qw(x/10);
    putchar(x%10+'0');
}
template<class o> void pr1(o x) {
    if(x<0)x=-x,putchar('-');
    qw(x); putchar(' ');
}
template<class o> void pr2(o x) {
    if(x<0)x=-x,putchar('-');
    qw(x); putchar('\n');
}

ll n,ans;
ll p[N],tot,c[1<<16];

void exgcd(ll &x,ll &y,ll a,ll b) {
	if(!a) {x=0; y=1; return ;}
	exgcd(y,x,b%a,a); x -= b/a*y;
}
ll inv(ll a,ll b) {
	a=(2*b-a)%b;
	ll x,y; exgcd(x,y,a,b);
	return (x%b+b)%b;
}

void div(ll x) {
	for(ll i=2;i*i<=x;i++) if(x%i == 0) {
		p[tot]=x;
		while(x%i==0) x/=i;
		p[tot++] /= x;
	}
	if(x>1) p[tot++]=x;
}

int main() {
	qr(n); div(n*2); c[0]=1;
	for(int i=0;i<tot;i++) c[1<<i]=p[i];
	if(n==1) puts("1"),exit(0);
	if(n&1) ans=n-1;
	else ans=n;
	for(int i=1;i+1<(1<<tot);i++) {
		c[i]=c[i&(i-1)]*c[i&(-i)];
		ll x=c[i],y=2*n/x;
		ans=min(ans,x*inv(x,y));
	}
	pr2(ans);
}


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

using namespace std;

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


    for (int i = n; ; i++) {
        bool isValid = true;
        for (int j = 2; j <= sqrt(i); j++) {
            if (i % j == 0) {
                isValid = false;
                break;
            }
        }
        if (isValid) {
            cout << i;
            return 0;
        }
    }
}


Measured memory_bytes: 256
//IGNORANCE IS BLISS

#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define ll long long 
#define int ll
#define mod 1000000007
#define mod1 1000000006
#define modi 998244353
#define ff first
#define ss second
#define pb push_back
vector<ll> vi[300005];
int color[100005];
ll pa[500005];
ll si[500005];
#define pb push_back
bool visi[1000005]={false};
bool is[100005];
ll fac[10000001];
ll prime[400005];
ll bit[100005];
#define fio ios_base::sync_with_stdio(false); cin.tie(NULL);
 
 
void fact(){
    fac[0]=1;
    for(int i=1;i<=10000000;i++){
        fac[i]=(fac[i-1]*i)%mod;
    }
    return ;
}
void sieve(){
    prime[0]=0;
    prime[1]=0;
    for(int i=2;i<400005;i++){
        prime[i]=1;
    }
    for(int i=2;i*i<400005;i++){
        if(prime[i]==1){
            for(int j=i*i;j<400005;j+=i){
                prime[j]=0;
            }
        }
    }
    
}
 
ll power(ll n , ll p ){
    if(p==0)
        return 1;
    
    ll res = power((n*n)%mod,p/2);
    if(p%2==1)
        res = (n*res)%mod;
    
    return res;
}
 
 
void upd(ll i,ll val,ll n) {
    for(;i<=n;i+=i&(-i))
        bit[i]+=val;
}
 
ll qry(ll i) {
    ll sum=0;
    for(;i>0;i-=i&(-i))
        sum+=bit[i];
    return sum;
}
 
 
ll fin(ll u) {
    if(pa[u]==u)
        return u;
    return fin(pa[u]);
}
 
void uni(ll u,ll v) {
    ll p1=fin(u);
    ll p2=fin(v);
    if(p1==p2)
        return;
    if(si[p1]<si[p2])
        swap(p1,p2);
    si[p1]+=si[p2];
    pa[p2]=p1;
    return;
}
 
int32_t main() {
    fio

    int n,m;
    cin >> n >> m;
    
    if(n==1||m==1) {
        cout << 1 << endl;
    }
    
    
    else {
        cout << (n*m+1)/2 << endl;
    }

	return 0;
    
}


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

using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod =(1e9)+7;
using P = pair<ll,ll>;


int main(){
    ll a,b,c,k;cin >>a>>b>>c>>k;
    ll ans=0;
    if(a+b>=k)ans=min(a,k);
    else {
        ans+=min(a,k);
        k-=(a+b);
        ans-=min(c,k);
    }
    cout <<ans <<endl;
    return 0;
}

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

#define rep(i,n) for(ll i=0;i<n;i++)
#define REP(i,a,n) for(ll i=a;i<n;i++)

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef tuple<int,int,int> tiii;
typedef pair<ll, ll> pll;

const int INF = 100000000;
const ll LINF = 1e18+5;

int main() {
    ll N, M;
    cin >> N >> M;
    string S;
    cin >> S;
    ll Sn[100001] = {};
    rep(i,N+1) {
        Sn[i] = S[i] - '0';
    }
    ll pos = N;
    vector<ll> route;
    while(pos != 0) {
        bool dameflag = true;
        for(ll i = M; i>0; i--) {
            if(pos - i >= 0 && Sn[pos-i]==0) {
                pos -=i;
                route.push_back(i);
                dameflag = false;
                break;
            }
        }
        if(dameflag) {
            cout << -1 << endl;
            return 0;
        }
    }
    reverse(route.begin(), route.end());
    for(auto r : route) cout << r << " ";
    cout << endl;
    return 0;
}

Measured memory_bytes: 2296
function Main(input) {

	input = input.split(" ");
	
	var ages = parseInt(input[0]);
	var price = parseInt(input[1]);
	
	var show = 0;
	
	if(ages >= 13){
	    show = price;
	}else if(ages <= 12 && ages >= 6){
	    show = price/2;
	}else{
	    show = 0;
	}
	
    console.log(show);

}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef vector<int> vec;
//配列の添字ズレに注意
//=に注意
int main(){
  long k,now=0,ans=0,memo=-1; cin>>k;
  
  
  rep(i,100000000){
    now=(now*10+7)%k;
    if(now==0){memo=i+1; break;}
    
  }
  
  //string s; cin>>s;
  cout<<memo<<endl;
}

Measured memory_bytes: 3632
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
	"strings"
)

type Io struct {
	reader    *bufio.Reader
	writer    *bufio.Writer
	tokens    []string
	nextToken int
}

func NewIo() *Io {
	return &Io{
		reader: bufio.NewReader(os.Stdin),
		writer: bufio.NewWriter(os.Stdout),
	}
}

func (io *Io) Flush() {
	err := io.writer.Flush()
	if err != nil {
		panic(err)
	}
}

func (io *Io) NextLine() string {
	var buffer []byte
	for {
		line, isPrefix, err := io.reader.ReadLine()
		if err != nil {
			panic(err)
		}
		buffer = append(buffer, line...)
		if !isPrefix {
			break
		}
	}
	return string(buffer)
}

func (io *Io) Next() string {
	for io.nextToken >= len(io.tokens) {
		line := io.NextLine()
		io.tokens = strings.Fields(line)
		io.nextToken = 0
	}
	r := io.tokens[io.nextToken]
	io.nextToken++
	return r
}

func (io *Io) NextInt() int {
	i, err := strconv.Atoi(io.Next())
	if err != nil {
		panic(err)
	}
	return i
}

func (io *Io) NextInt64() int64 {
	i, err := strconv.ParseInt(io.Next(), 10, 64)
	if err != nil {
		panic(err)
	}
	return i
}


func (io *Io) NextFloat() float64 {
	i, err := strconv.ParseFloat(io.Next(), 64)
	if err != nil {
		panic(err)
	}
	return i
}

func (io *Io) PrintLn(a ...interface{}) {
	fmt.Fprintln(io.writer, a...)
}

func (io *Io) Printf(format string, a ...interface{}) {
	fmt.Fprintf(io.writer, format, a...)
}

func intMin(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func (io *Io) PrintBool(b bool, trueS, falseS string) {
	if b {
		io.PrintLn(trueS)
	} else {
		io.PrintLn(falseS)
	}
}

func intMax(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func absi(a int) int {
	if a > 0 {
		return a
	} else {
		return -a
	}
}

func b2i(b bool) int {
	if b {
		return 1
	}
	return 0
}

type Int64s []int64
func (f Int64s) Len() int {
	return len(f)
}
func (f Int64s) Less(i, j int) bool {
	return f[i] < f[j]
}

func (f Int64s) Swap(i, j int) {
	f[i], f[j] = f[j], f[i]
}


func abcInt(a int) int {
	if a > 0 {
		return a
	} else {
		return -a
	}
}

func gcdInt(a, b int) int {
	for a%b != 0 {
		a, b = b, a%b
	}
	return b
}

var (
	io *Io
)

type P struct {
	s string
	p int
	id int
}

type PS []P
func (f PS) Len() int {
	return len(f)
}
func (f PS) Less(i, j int) bool {
	if f[i].s != f[j].s {
		return f[i].s< f[j].s
	}
	return f[i].p > f[j].p
}

func (f PS) Swap(i, j int) {
	f[i], f[j] = f[j], f[i]
}

func solve() {
	a := io.NextInt()

	var vp PS
	for i := 0; i < a; i++ {
		vp = append(vp, P{io.Next(), io.NextInt(), i + 1})
	}
	sort.Sort(vp)
	for _, x := range vp {
		io.PrintLn(x.id)
	}
}

func main() {
	io = NewIo()
	f, err := os.Open("src/input")
	if err == nil {
		io.reader = bufio.NewReader(f)
	}
	defer io.Flush()

	solve()
}

Measured memory_bytes: 640
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())
    
n,m = map(int,input().split())
uf = UnionFind(n)
for i in range(m):
    x,y,z = map(int,input().split())
    uf.union(x-1,y-1)
print(uf.group_count())

Measured memory_bytes: 7856
#include <iostream>
#include <vector>
#define ll long long
using namespace std;

int main() {
  ll N, P;
  cin >> N >> P;

  if (N == 1) {
    cout << P << endl;
    return 0;
  }

  ll ans = 1, p = 2;
  while (P > 1 && p * p <= P) {
    int cnt = 0;
    while (P % p == 0) {
      P /= p;
      cnt++;
      if (cnt == N) {
        ans *= p;
        cnt = 0;
      }
    }
    p++;
  }

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


Measured memory_bytes: 256
K, N = map(int, input().split())
A = list(map(int, input().split()))

ans = A[N - 1] - A[0]
now = ans
for i in range(1, N):
  prior = A[i] - A[i - 1]
  if i == 1:
    #print(A[0], A[N - 1])
    next_ = A[0] + K - A[N - 1]
  else:
    next_ = A[i-1 ] - A[i -2] 
  
  now = now - prior + next_
  #print(i,ans, now, prior, next_)
  if ans > now:
    ans = now
print(ans)

Measured memory_bytes: 26444
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <climits>
#include <cmath>
#include <vector>
#include <string>
#include <set>

#define REP(i, n) for (int i=0;i<(n);i++)
#define FOR(i, a, b) for (int i=(a);i<(b);i++)

using namespace std;

int N;
int K;
int h[100001];


int main()
{
    scanf("%d %d", &N, &K);
    REP(i, N)
        scanf("%d ", &h[i]);
    if (K>=N-1) {
        cout << h[N-1]-h[0] << endl;
    } else {
        long long int dp[100001];
        REP(i, N)
            dp[i] = 100000000000;
        dp[0] = 0;
        FOR(i, 1, N) {
            FOR(j, 1, K+1) {
                if (i>=j)
                    dp[i] = min(dp[i-j]+abs(h[i]-h[i-j]), dp[i]);
            }
        }
        cout << dp[N-1] << endl;
    }
    return 0;
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace std;
using namespace __gnu_pbds;
const long long MOD  = 1000000007LL;
const long long MOD2 = 1012455881LL;
const long long MOD3 = 930446593LL;
const long long INF = 1e16;
const int INT_INF   = 1e8;
typedef tree<pair<int,int>, null_type, less<pair<int,int>>, rb_tree_tag,tree_order_statistics_node_update> ordered_set;
int GCD(int a, int b){return b == 0 ? a : GCD(b, a % b);}
long long fast_exp(long long base, long long exp, long long mod = MOD, long long tot = 1) {
    for(;exp > 0; exp >>= 1, base = base * base % mod) if((exp & 1) == 1) tot = tot * base % mod;
    return tot;
}
long long slow_mult(long long base, long long exp, long long mod = MOD, long long tot = 0) {
    for(;exp > 0; exp >>= 1, base = base * 2 % mod) if((exp & 1) == 1) tot = (tot + base) % mod;
    return tot;
}
struct chash {
    static uint64_t splitmix64(uint64_t x) {x += 0x8e3779b97f4a7c15; x = (x ^ (x >> 30)) * 0xbf54876d1ce4e5b9; x = (x ^ (x >> 27)) * 0x94d049bb133111eb; return x ^ (x >> 31);}
    size_t operator()(uint64_t x) const { static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count(); return splitmix64(x + FIXED_RANDOM);}
    size_t operator()(pair<uint64_t,uint64_t> x) const { static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count(); return splitmix64(x.first + FIXED_RANDOM)^(splitmix64(x.second + FIXED_RANDOM) >> 1);}
};

int main(){

    cin.sync_with_stdio(0); cin.tie(0); cout.tie(0);

    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    char c; cin >> c;
    cout << (char) (c+1) << endl;


    return 0;

}


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

#define pb push_back
#define mp make_pair
#define pf push_front
#define ff first
#define ss second
#define vll vector < ll >
#define vvll vector < vll >
#define vld vector < ld >
#define pll pair < ll,ll >
#define ppll pair < ll, pll > 
#define pld pair < ld,ld > 
#define vpll vector < pll >
#define vpld vector < pld >
#define all(X) X.begin(),X.end()
#define rall(X) X.rbegin(),X.rend()
#define endl "\n"
#define sz(x) ((ll)((x).size()))
vll emptyVector;
const ll MAX = 1e6 + 5;
const ll INF = 1e18;
const ll MOD = 1e9 + 7;
const ld pi = 3.141592653589793238462643383279502884197169399375105;

ll binaryExpo(ll x, ll n)
{
	if(n == 0)
		return 1;
	if(n % 2 == 0)
		return binaryExpo((x*x) % MOD, n/2);
	return (x*binaryExpo((x*x) % MOD, n/2)) % MOD;
}

ll gcd(ll a, ll b)
{
	if(b == 0)
		return a;
	return gcd(b, a % b);
}
/*-------------------------------------------		CODE STARTS FROM HERE		------------------------------------------*/


void solve(void)
{
	ll a;
	ld b;
	cin >> a >> b;
	ld ans = (ld)a*(ld)b;
	a = (ll)ans;
	cout << a << endl;


}

int main(void)
{
	// ios_base::sync_with_stdio(false);
	// cin.tie(NULL);


	// int t;
	// cin >> t;
	// while(t--)
	{
		solve();
	}


	return 0;
}

Measured memory_bytes: 3732
#include <bits/stdc++.h>
#define Int int64_t

using namespace std;

int main() {
	int N, T;
	cin >> N >> T;
	vector<int> A(N), B(N);
	vector<pair<int, int>> AB;
	for (int i = 0; i < N; ++i) {
		cin >> A[i] >> B[i];
		AB.emplace_back(A[i], B[i]);
	}
	sort(AB.begin(), AB.end());

	int sz = 6500;
	vector<vector<int>> dp(N, vector<int>(sz, -1));
	dp[0][0] = 0;
	dp[0][AB[0].first] = AB[0].second;
	for (int i = 1; i < N; ++i) {
		int a = AB[i].first, b = AB[i].second;
		for (int j = 0; j < sz; ++j) {
			dp[i][j] = max(dp[i][j], dp[i - 1][j]);
			if (j - a >= 0 && dp[i - 1][j - a] >= 0 && j - a < T) {
				dp[i][j] = max(dp[i][j], dp[i - 1][j - a] + b);
			}
		}
	}

	int ans = 0;
	for (int i = 0; i < N; ++i) {
		for (int j = 0; j < min(T + AB[i].first, sz); ++j) {
			ans = max(ans, dp[i][j]);
		}
	}
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 76672
#include<iostream>                                        
#include<cmath>                                           
#include<iomanip>                                         
using namespace std;                                      
                                                          
int main(void){                                           
                                                          
  double x1,y1,x2,y2;                                     
  double distance;                                        
                                                          
  cin >> x1 >> y1 >> x2 >> y2;                            
                                                          
  distance = sqrt(pow(x2-x1,2) + pow(y2-y1,2));           
                                                          
  cout << fixed << setprecision(8) << distance << endl;   
                                                          
  return 0;                                               
}                                                         
 

Measured memory_bytes: 3272
import sys

use_clipboard=True
bbn=1000000007
	
#+++++

		
def main():
	h, n = map(int, input().split())
	al=list(map(int, input().split()))
	ret = 'Yes' if sum(al)>=h else 'No'
	print(ret)
	
	
#+++++
isTest=False

def pa(v):
	if isTest:
		print(v)
		
class input_clipboard:
	def __init__(self,s):
		self.input_l=s.splitlines()
		self.ii=0
		
	def input(self):
		ret = self.input_l[self.ii]
		self.ii+=1
		return ret

if __name__ == "__main__":
	if sys.platform =='ios':
		if use_clipboard:
			import clipboard
			input_text=clipboard.get()
			ic=input_clipboard(input_text)
			input = lambda : ic.input()
		else:
			sys.stdin=open('inputFile.txt')
		isTest=True
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)

Measured memory_bytes: 14300
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned ll
#define uint unsigned
#define pii pair<int,int>
#define pll pair<ll,ll>
#define PB push_back
#define fi first
#define se second
#define For(i,j,k) for (int i=(int)(j);i<=(int)(k);i++)
#define Rep(i,j,k) for (int i=(int)(j);i>=(int)(k);i--)
#define CLR(a,v) memset(a,v,sizeof(a));
#define CPY(a,b) memcpy(a,b,sizeof(a));
using namespace std;
const int N=100005;
int n,Q,con,fa[N];
vector<pii> E;
ll m;
int get(int x){
	return x==fa[x]?x:fa[x]=get(fa[x]);
}
int main(){
	scanf("%d%lld%d",&n,&m,&Q); con=n;
	For(i,1,n) fa[i]=i;
	For(i,1,Q){
		int x,y,v;
		scanf("%d%d%d",&x,&y,&v);
		++x; ++y;
		if (v==0){
			x=get(x); y=get(y);
			if (x!=y) fa[x]=y,--con;
		}
		else
			E.PB(pii(x,y));
	}
	if (m==n-1){
		puts(E.size()?"No":"Yes");
		return 0;
	}
	For(i,0,E.size()-1){
		int x=get(E[i].fi);
		int y=get(E[i].se);
		if (x==y) return puts("No"),0;
	}
	ll up=1ll*con*(con-1)/2+n-con;
	puts(up>=m?"Yes":"No");
} 

Measured memory_bytes: 1784
from itertools import combinations

class Source:
  def __init__(self, S):
    self.S = S
    self.pos = 0

def peek(S):
  return S.S[S.pos] if S.pos < len(S.S) else a

def next(S):
  S.pos += 1
      
def expr(S):
  next(S)
  if peek(S) != '[':
    return num(S) // 2 + 1
    
  A = []
  while peek(S) != ']':
    A.append(expr(S))
    next(S)
  
  A.sort()

  return sum(A[:len(A) // 2 + 1])
  
def num(S):
  res = 0
  while '0' <= peek(S) <= '9':
    res = 10 * res + int(peek(S))
    next(S)
    
  return res
             
n = int(input())
for i in range(n):
  print(expr(Source(input())))



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

int main() {
	char c;
  	cin >> c;
  
  	if(c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u') {
    	cout << "vowel" << endl;
    } else {
    	cout << "consonant" << endl;
    }

}

Measured memory_bytes: 3632
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <math.h>
#include <limits>
#include <stdio.h>

template <typename T>
void vc(T t) {
    std::cout << t << " ";
}

template<typename T, typename... Args>
void vc(T t, Args... args) {
// recursive variadic function
    std::cout << t << " ";
    vc(args...) ;
}

const int N = 100000;

double mp[303][303][303];
double dpx(int c1, int c2, int c3, double n) {
  if (mp[c1][c2][c3] != -1) {
    return mp[c1][c2][c3];
  }
  mp[c1][c2][c3] = n / (c1 + c2 + c3);
  double n2 = c1 + c2 + c3;
  // vc("-", c1, c2, c3, mp[c1][c2][c3], "\n");
  if (c3 > 0) {
   mp[c1][c2][c3] += c3 / n2 * dpx(c1, c2 + 1, c3 - 1, n);
  }
  if (c2 > 0) {
   mp[c1][c2][c3] += c2 / n2 * dpx(c1 + 1, c2 - 1, c3, n);
  }
  if (c1 > 0) {
   mp[c1][c2][c3] += c1 / n2 * dpx(c1 - 1, c2, c3, n);
  }
  // vc("+", c1, c2, c3, mp[c1][c2][c3], "\n");
  return mp[c1][c2][c3];
}
void once() {
  int n;
  std::cin >> n;
  std::vector<int> vi(n + 1);
  std::vector<int> lx(5);
  for (int i = 1; i <= n; ++i) {
    int x;
    std::cin >> x;
    lx[x]++;
  }
  for (int i = 0; i < 303; ++i)
    for (int j = 0; j < 303; ++j)
      for (int k = 0; k < 303; ++k)
        mp[i][j][k] = -1;
  mp[0][0][0] = 0;
  double ans = dpx(lx[1], lx[2], lx[3], n);
  // std::cout << ans << std::endl;
  printf("%.10lf\n", ans);
}

int
main() {
  int n = 1;
  std::ios::sync_with_stdio(false);
  // std::cin >> n;
  while (n--) {
    once();
  }
}

Measured memory_bytes: 217728
#define _CRT_SECURE_NO_WARNINGS
#define __STDC_FORMAT_MACROS
#include <cinttypes>
#include <cstdio>

using namespace std;

int main()
{
    int64_t N;
    if (scanf("%" PRId64, &N) < 1) return 0;

    int64_t h, n, w;

    for (h = 1; h <= 3500; h++)
        for (n = 1; n <= 3500; n++)
        {
            int64_t x = N * h * n;
            int64_t y = 4 * h * n - N * n - N * h;
            if (0 < y && x % y == 0)
            {
                printf("%" PRId64 " %" PRId64 " %" PRId64 "\n", h, n, x / y);
                return 0;
            }
        }

    return 0;
}


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

typedef long long ll;

ll N;
ll Four, Even, Odd;

int main() {
  cin >> N;
  for (ll i = 0; i < N; ++i) {
    ll a;
    cin >> a;
    if (a % 4 == 0)
      ++Four;
    else if (a % 2 == 0)
      ++Even;
    else
      ++Odd;
  }
  cout << ((Even > 0 ? 1 : 0) + Odd <= Four + 1 ? "Yes" : "No") << endl;
  return 0;
}


Measured memory_bytes: 256
N = int(input())
ablist = []
for _ in range(N):
    ab = map(int, input().split())
    ablist.append(ab)
ans = 0
for a, b in ablist[::-1]:
    a += ans
    if a % b == 0:
        continue
    else:
        ans += (b - a % b)
print(ans)


Measured memory_bytes: 51188
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define invrepr(i,a,b) for(int i=b-1;i>=a;i--)
#define invrep(i,n) invrepr(i,0,n)
#define repitr(itr,a) for(auto itr=a.begin();itr!=a.end();++itr)
#define P pair<int,int>
const ll MOD=1e9+7;
const int INF=2e9;
const double PI=acos(-1);

const int MAX=200010;


struct UnionFind {
    vector<int> par;
    vector<int> siz;
    UnionFind(int N) : par(N), siz(N, 1) {
        for(int i = 0; i < N; i++) par[i] = i;
    }

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

    void unite(int x, int y) {
        int rx = root(x);
        int ry = root(y);
        if (rx == ry) return;
        if (siz[rx] < siz[ry]) swap(rx, ry);
        siz[rx] += siz[ry];
        par[ry] = rx;
    }

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

    int size(int x) {
        return siz[root(x)];
    }
};


int main() {
    ios_base::sync_with_stdio(false); 

    ll n,m;
    cin >> n >> m;
    vector<pair<ll,ll>> p(m);
    rep(i,m) {
        ll a,b;
        cin >> a >> b;
        p[i]={a-1,b-1};
    }
    ll cnt=n*(n-1)/2;
    vector<ll> ans(m);
    UnionFind tree(n);
    invrep(i,m) {
        ans[i]=cnt;
        ll s1=tree.size(p[i].first),s2=tree.size(p[i].second);
        if (!tree.issame(p[i].first,p[i].second)) {
            cnt-=s1*s2;
            tree.unite(p[i].first,p[i].second);
        }
    }
    rep(i,m) cout << ans[i] << endl;

    return 0;
}


Measured memory_bytes: 6428
// AOJ 0652 Social Game
// 2019.3.27 bal4u

#include <stdio.h>
#include <stdlib.h>

int main()
{
	int A, B, C, week, ans;

	scanf("%d%d%d", &A, &B, &C);
	week = (C-1) / (7*A+B);
	if (week * (7 * A + B) + 7 * A < C) ans = 7 * (week + 1);
	else ans = 7 * week + ((C - week * (7 * A + B) - 1) / A + 1);
	printf("%d\n", ans);
	return 0;
}


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

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

const ll INF = 1e17;


ll x,d,n;

map<ll,vector<pii> > segmen[2];

ll evaluate(vector<pii> &vec){
	sort(vec.begin(),vec.end());
	ll cur = -INF;
	ll ret = 0ll;
	for(int j=0;j<vec.size();j++){
//		cout << vec[j].first << " sampai " << vec[j].second << endl;
		if(cur < vec[j].first){
//			cout << "IN\n";
			ret += (vec[j].second - vec[j].first)/2ll + 1ll;
			cur = vec[j].second+2;
		} else if(cur >= vec[j].first && cur <= vec[j].second){
			ret += (vec[j].second - cur)/2ll + 1ll;
			cur = vec[j].second+2;
		}
//		cout << " >>> " << ret << endl;
	}
	return ret;
}

int main(){
	scanf("%lld %lld %lld",&n,&x,&d);
	ll total = ((ll)(n - 1) * (ll)n)/2ll;
	if(d == 0){
		if(x==0){
			printf("1\n");
			return 0;
		}
		printf("%lld\n",n+1ll);
		return 0;
	}
//	ll xperd = x/d;
//	total += xperd*(ll)n;
//	x = x%d;
//	cout << total << endl;
	ll mult = 0;
	ll baw = 0;
	ll at = 0;
	for(int i=0;i<=n;i++){
		ll base = (n-i-i) * x;
//		cout << base << " <<< " << endl;
		ll tam = base/d;
		base -= (d*tam);
		while(base < 0){
			if(d < 0){
				base-=d;
				tam++;
			} else {
				base+=d;
				tam--;
			}
		}
		while(base > d){
			if(d < 0){
				base += d;
				tam--;
			} else {
				base -= d;
				tam++;
			}
		}
//		cout << baw << " " << at << " tam " << tam << endl;
//		cout << "BASE JADI " << base <<endl;
		if(total-2ll*at+tam > total-2ll*baw+tam) {
			segmen[abs(total-2ll*at+tam)&1ll][base].push_back(make_pair(total-2ll*baw+tam,total-2ll*at+tam));
		} else {
			segmen[abs(total-2ll*at+tam)&1ll][base].push_back(make_pair(total-2ll*at+tam, total-2ll*baw+tam));
		}
//		cout << "FOR BASE " << base << " PUSH " << total-2*at+tam << " UNTIL " << total-2*baw+tam << endl;
		baw+=(ll)(i);
		at+=(ll)(n-i-1ll);	
	}
	ll ans = 0ll;
	for(int i=0;i<=1;i++){
		for(auto x : segmen[i]){
			ans += evaluate(x.second);
		}
	}
	printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 22144
import java.util.Scanner;

public class Main {

	public static void main(String args[])
	{
		Scanner scan=new Scanner(System.in);
		int n=scan.nextInt();
		long k=scan.nextLong();
//		System.out.println((1^0)+" "+(6^0)+" "+(3^0));
		long ar[]=new long[n];
		for(int i=0;i<n;i++)
		{
			ar[i]=scan.nextLong();
			
		}
		long now=0l;
		long ans=0l;
		for(int j=50;j>=0;j--)
		{
			if(((1L<<j)+now)>k)continue;
			int num=0;
//			System.out.println(j);
			for(int i=0;i<n;i++)
			{
				if((ar[i]&(1L<<(j)))>=1)num++;
				
			}
			if(num<=(n/2)) {
				now+=(1L<<j);
//				System.out.println("yes"+" "+num);
			}
		}
//		System.out.println(now);
		for(int i=0;i<n;i++)
		{
			ans+=(ar[i]^now);
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 52156
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
#define pb push_back
#define rsz resize
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
using pi = pair<int,int>;
#define fi firstS
#define mp make_pair

void setIO(string name = "") { 
    ios_base::sync_with_stdio(0); cin.tie(0);
}

int main(){
    setIO(); 
    ll n,k,ans = 0;
    cin >> n >> k;
    for(int i = 0; i < n;++i){
        ll a,b;
        cin >>a >> b;
        if(sqrt(abs(a)*abs(a) + abs(b)*abs(b)) <= k) ans++;
    }
    cout << ans;
    return 0;   
}


Measured memory_bytes: 3644
def sort_x(a):
    min = 100000
    min_num = 0
    n = len(a)
    A=[[0, 0] for i in range(n)]
    left_list = [1 for i in range(n)]

    for j in range(n):
        for i in range(n):
            if left_list[i]==1 and int(a[i][0]) < min:
                min = int(a[i][0])
                min_num = i
        left_list[min_num] = 0
        A[j] = a[min_num]
        min=100000
    return A

def sort_y(a):
    min = 100000
    min_num = 0
    n = len(a)
    A=[[0, 0] for i in range(n)]
    left_list = [1 for i in range(n)]

    for j in range(n):
        for i in range(n):
            if left_list[i]==1 and int(a[i][1]) < min:
                min = int(a[i][1])
                min_num = i
        left_list[min_num] = 0
        A[j] = a[min_num]
        min=100000
    return A

if __name__ == '__main__':
    n = int(input())
    a_ = [input().split() for i in range(n)]
    c_ = [input().split() for i in range(n)]
    a = [[0,0] for i in range(n)]
    c = [[0,0] for i in range(n)]
    c = sort_x(c_)
    a = sort_y(a_)
    
    frend_num = 0
    #print(a)
    #print(c)
    #min = 100000
    #min_index = 0
    filter_a = [1 for i in range(n)]
    for j in range(n):
        for i in reversed(range(n)):
            #print("---")
            #print("{} vs {}={}".format(a[i][0], c[j][0], a[i][0]<c[j][0]))
            #print("{} vs {}={}".format(a[i][1], c[j][1], a[i][1]<c[j][1]))
            if filter_a[i]==1:
                if int(a[i][0])<int(c[j][0]):
                    if int(a[i][1])<int(c[j][1]):
                        filter_a[i]=0
                        frend_num += 1
                        #print("{},{}".format(a,c))
                        #print("{}".format(filter_a))
                        #print("friend is detected")
                        break
    print(frend_num)


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


using namespace std;


int main()
{
	string str;

	while(1){
		cin >> str;
		if(str == "0")
			break;

		int sum = 0;
		for(int i = 0; i < str.length(); i++)
				sum += str[i] - 48;

		cout << sum << endl;
	}

	return 0;
}


Measured memory_bytes: 3156
#include<bits/stdc++.h>
#define maxn 105
using namespace std;
int arr[maxn];
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n;
	cin >> n;
	for(int i=1;i<=n;i++)
		cin >> arr[i];
	int ans = 123456789ll;
	for(int target=-100;target<=100;target++) {
		int sum = 0;
		for(int i=1;i<=n;i++)
			sum += (arr[i]-target) * (arr[i]-target);
		ans = min(ans,sum);
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
using namespace std;
int main(){
    char a[15];
    cin>>a;
    if(a[0]=='Y'&&a[1]=='A'&&a[2]=='K'&&a[3]=='I'){
        printf("Yes\n");
    }
    else{
        printf("No\n");
    }
    return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <string.h>


int main(void) {

	char str[1001] = { 0 };
	int q = 0;

	int a = 0;
	int b = 0;

	char p[1001] = { 0 };

	char result[100][1001];
	int printCount = 0;

	scanf("%1000s%*[^\n]%*c", &str);

	scanf("%d%*[^\n]%*c", &q);
	int i = 0;
	for (i = 0; i < q; i++) {
		char order[10] = { 0 };
		scanf("%s", &order);

		char tmpStr[1001] = { 0 };
		int copy_i = 0;
		for (; copy_i < strlen(str); copy_i++) {
			tmpStr[copy_i] = str[copy_i];
		}

		if (strcmp(order, "replace") == 0) {
			scanf("%d %d %s", &a, &b, &p);
			int replace_i = a;
			int replace_j = 0;
			for (; replace_i <= b; replace_i++, replace_j++) {
				str[replace_i] = p[replace_j];
			}
		}
		else {
			scanf("%d %d", &a, &b);
			if (strcmp(order, "reverse") == 0) {
				int reverse_i = a;
				int reverse_j = b;
				for (; reverse_i <= b; reverse_i++, reverse_j--) {
					str[reverse_i] = tmpStr[reverse_j];
				}
			}
			else { // print
				int print_i = 0;
				int print_j = a;
				for (; print_i < b - a + 1; print_i++, print_j++) {
					result[printCount][print_i] = str[print_j];
				}
				printCount++;

			}
		}

	}

	int output_i = 0;
	for (; output_i < printCount; output_i++) {
		printf("%s\n", result[output_i]);
	}
	return 0;
}


Measured memory_bytes: 2148
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (k); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define INF 1145141919
#define MOD 1000000007
#define ALL(a) begin(a),end(a)
#define MS(m,v) memset(m,v,sizeof(m))
#define D10  fixed<<setprecision(10)
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> P;
typedef long long ll;
struct edge
{
	int from, to, cost;
	bool operator < (const edge& e) const { return cost < e.cost; }
	bool operator >(const edge& e) const { return cost > e.cost; }
};
///*************************************************************************************///
///*************************************************************************************///
///*************************************************************************************///

int gcd(int a, int b)
{
	if (a < b) swap(a, b);
	return (a%b ? gcd(a%b, b) : b);
}

int main()
{
	string s;
	while (cin >> s)
	{
		if (s == "#") break;
		vi v;
		REP(i, s.size())
		{
			if (s[i] == 'n') 
			{
				v.push_back(0);
				i += 4;
			}
			else
			{
				v.push_back(1);
				i += 3;
			}
		}
		int n = 0; int t = -1;
		REP(i, v.size())
		{
			if (v[v.size() - i - 1] == 1)
			{
				n = n * 2 + 90;
			}
			else
			{
				n = n * 2 - 90;
				if (n < 0) n = 0;
			}
			t++;
		}
		if (n == 0)
		{
			cout << 0 << endl;
			continue;
		}
		t = 1 << t;
		int a = gcd(n, t);
		cout << n / a;
		if (t / a != 1) cout << '/' << t / a;
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 1212
import java.util.*;

class Main {
    public static void main(String args[]) {
        Scanner inp = new Scanner(System.in);
        int n = inp.nextInt();
        if (n == 1) {
            System.out.println("Hello World");
        }
        else {
            int a = inp.nextInt();
            int b = inp.nextInt();
            System.out.println(a + b);
        }
        inp.close();
    }
}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize ("Ofast")
#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;

typedef pair <int,int> pii;
typedef vector <pii> vpii;
typedef vector <int> vi;
typedef vector <vi> vvi;
typedef long long int lli;
typedef vector <lli> vlli;
typedef vector <vlli> vvlli;
typedef vector <string> vs;
typedef vector <bool> vb;

#define rep(i, n) for( i = 0; i < (n); ++i)
#define repA(i, a, n) for( i = a; i <= (n); ++i)
#define repD(i, a, n) for( i = a; i >= (n); --i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sortr(x) sort(x.begin(),x.end(),greater <int> ())
#define mod 1000000007
#define ff first
#define ss second
#define fill(a,c)  memset(a, c, sizeof (a))
#define formap(i,v) for(auto &i: v)
#define dbg(x) cout << #x << " = " << x << '\n'
#define dbg2(x,y) cout<<#x<<" = "<<x<<" & "<<#y<<" = "<<y<<endl;
#define dbgstl(v) cout<<#v<<" = \n"; { int c=0; formap(it,v) \
cout<<"    "<<#v<<"["<< ++c <<"] = "<<it<<endl;} cerr<<endl
#define dbgstlp(v) cout<<#v<<" = \n"; { int c=0; formap(it,v) \
cout<<"    "<<#v<<"["<< ++c <<"] = "<<it.first<<" , "<<it.second<<endl;} cerr<<endl
#define PI  3.14159265358979323846
#define pb push_back




int main() {
	cin.sync_with_stdio(0);cin.tie(0);
    cin.exceptions(cin.failbit);
    
    lli n,m,k,i,j,cnt=0;
    cin>>n>>m>>k;
    vlli a(n),b(m),c(1),d(1);
    rep(i,n)cin>>a[i];
    rep(i,m)cin>>b[i];
    a.pb(mod);b.pb(mod);
    c[0]=a[0],d[0]=b[0];
    for (i=1;i<=n;i++){
        c.pb(c[i-1]+a[i]);
    }
    for (i=1;i<=m;i++){
        d.pb(d[i-1]+b[i]);
    }
    n=c.size(),m=d.size();
    i=0,j=0;
    while (c[i]<=k)i++;
    cnt=i;
    
    while (i>=0){
        i--;
        while (c[i]+d[j]<=k)j++;
        cnt=max(cnt,j+i+1);
    }
    while (d[j]<=k)j++;
    cnt=max(cnt,j);
    cout<<cnt<<endl;
    
    
   
   
   
   
	return 0;
}


Measured memory_bytes: 11508
#include <algorithm>
#include <stdio.h>
using ll = long long;

int main() {
	int N, a, max = 0, min = 1000;
	scanf("%d", &N);
	for (int i = 0; i < N; i++) {
		scanf("%d", &a);
		max = std::max(max, a);
		min = std::min(min, a);
	}
	printf("%d\n", max - min);
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int main(){
  long long int x,y;
  cin >>x >>y;
  if(x%y==0)cout<< -1 <<endl;
  else{
    if(x>1E18)cout << -1 <<endl;
    else cout << x <<endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
int main(int argc, char *argv[])
{
	string a,b,t;
	cin>>a>>b;
	int len=a.length();
	for(int i=0;i<a.length();i++)
	{
		t=a.substr(len-1,1);
		t.append(a.substr(0,len-1));
		a=t;
		//cout<<t<<endl;
		if(b==a)break;
	}
	if(b==a)cout<<"Yes\n";
	else cout<<"No\n";
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,k,R,S,P;
  string t;
  cin>>n>>k>>R>>S>>P>>t;
  vector<int>point(n);
  vector<int>check(n,0);
  
  int sum=0;
  for(int i=0;i<n;i++){
    if(t[i]=='r')point[i]=P;
    else if(t[i]=='s')point[i]=R;
    else if(t[i]=='p')point[i]=S;
  }
  
  for(int i=0;i<n;i++){
    if(i<k){
      sum += point[i];
      check[i]=1;
    }else {
      if(t[i]==t[i-k]){
        if(check[i-k]==0){
          sum += point[i];
          check[i]=1;
        }
      }else{
          sum += point[i];
          check[i]=1;
      }
    }
  }
  //for(int i=0;i<n;i++)cout<<check[i]<<endl;
  cout<<sum<<endl;
}

Measured memory_bytes: 1280
n, k = map(int, input().split())

a = []

for i in range(1, n + 1):
    if k % 2 != 0:
        if i % k == 0:
            a.append(i)
    if k % 2 == 0:
        if i % int(k/2) == 0:
            a.append(i)

e = []
f = []
if k % 2 == 0:
    for j in range(len(a)):
        if a[j] % 2 != 0:
            e.append(a[j])
        if a[j] % 2 == 0:
            f.append(a[j])

if k % 2 != 0:
    print(len(a)**3)

if k % 2 == 0:
    if len(a) % 2 != 0:
        print(int(((len(a) + 1)/2) ** 3 + ((len(a) - 1)/2) ** 3))
    else:
        print(int((len(a)/2) ** 3 + (len(a)/2) ** 3))


Measured memory_bytes: 12752
#include <iostream>
#include <stdlib.h>
#include <math.h>
#include <string.h>

#define max(a,b) ((a>b)?(a):(b))
#define min(a,b) ((a<b)?(a):(b))
#define abs(x) (((x)<0)?(-(x)):(x))

using namespace std;


int main(){
    int N,K;
    long *h,*t;
    cin >> N >> K;
    h = new long[N];
    t = new long[N];
    for(int i=0;i<N;i++){
        cin >> h[i];
        t[i] = 0;
    }
    t[0]=0;
    for(int i=1;i<N;i++){
        long m = 1000000000;
        for(int k=max(0,i-K);k<i;k++){
            long c = t[k]+abs(h[k]-h[i]);
            if(c<m){ m = c; }
        }
        t[i] = m;
    }
    cout<<t[N-1];
    
    delete[] t;
    delete[] h;
    return 0;
}


Measured memory_bytes: 1792
#include "bits/stdc++.h"
#include <set>

using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define all(i) (i).begin(), (i).end()
#define rall(i) (i).begin(), (i).end(), greater<int>()
#define int long long
#define elif else if
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define fst first
#define sec second
#define mod 1000000007
#define INF 10e10
template <typename T>

void print(T x)
{
	std::cout << x << " ";
}
template <typename T>

void println(T x)
{
	std::cout << x << "\n";
}

signed main(void) {
	int n;
	cin >> n;
	vector<int>a(n);
	rep(i, n) {	
		cin >> a[i];
	}
	vector<int>l(n);//l[i]:i番目までのカードの合計価
	vector<int>r(n);//r[i]:i番目からN番目までのカードの合計値
	l[0] = a[0];
	r[n - 1] = a[n - 1];
	rep1(i, n) {
		l[i] = l[i - 1] + a[i];
		r[n - 1 - i] = r[n - i] + a[n - 1 - i];
	}
	int ans = INF;
	rep(i, n-1) {
		ans = min(ans, abs(l[i] - r[i + 1]));
	}
	print(ans);
}

Measured memory_bytes: 7904
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
typedef long long int ll;
using namespace std;

ll n, m, d, p[114514];
vector<ll> maxi;

ll find_larger_element(ll val, ll idx, ll dir){
  // 特殊処理
  if (idx < 0) return -1;
  if (n <= idx) return n;
  // idx の次から数えて最初に val より大きなインデクスを返す． 
  if (dir==1){
    idx++;
    for(;;idx++){
      if (n <= idx) return n;
      if (idx % m == 0){
        if (maxi[idx/m] <= val){
          idx += m - 1;
          if (n <= idx) return n;
        }
      }
      if (p[idx] > val) return idx;     
    }
  }else{
    idx--;
    for(;;idx--){
      if (idx < 0) return -1;
      if (idx % m == m - 1){
        if (maxi[idx/m] <= val){
          idx -= m - 1;
          if (idx < 0) return -1;
        }
      }
      if (p[idx] > val) return idx;     
    }    
  }  
  return 0;
}


int main(){
  cin >> n;
  for(int i=0;i<n;i++) cin >> p[i];
  m = (ll) sqrt(n);
  d = (n + m - 1) / m;
  maxi = vector<ll>(d);
  for(int i=0;i<n;i++){
    maxi[i/m] = max(maxi[i/m], p[i]);
  }
  
  ll ans = 0;
  for(int i=0;i<n;i++){
    ll a = find_larger_element(p[i], i, -1);
    ll b = find_larger_element(p[i], a, -1);
    ll c = find_larger_element(p[i], i, 1);
    ll d = find_larger_element(p[i], c, 1);
    // cerr << a << b << c << d << endl;
    ans += p[i] * ((i-a)*(d-c) + (c-i)*(a-b));
  }
  
  cout << ans << endl;
  
  return 0;
}


Measured memory_bytes: 1024