akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <bitset>
#include <boost/multiprecision/cpp_int.hpp>
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstring>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <set>
#include <numeric>
#include <sstream>
#include <stdio.h>
#include <string>
#include <tuple>
#include <vector>
#include<iomanip>
namespace mp = boost::multiprecision;
using namespace std;
using ull = unsigned long long;
using ld = long double;
using lll = boost::multiprecision::cpp_int;
using ll = long long;
#define FOR(i, N) for(ll i = 0; i < N; ++i)

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
// using int = ll;
ll gcd(ll m, ll n) {
    if(n == 0)
        return abs(m);
    return (gcd(n, m % n));
}
void putYN(bool b) {
    if(b) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}
template<typename T>
void swap(T &a, T &b) {
    T tmp = a;
    a = b;
    b = tmp;
}
ll combi(ll n, ll k) {
    ll r = 1, rr = 1;
    for(ll i = 0; i < k; ++i) {
        r *= (n - i);
        rr *= (i + 1);
        // r %= 1000000007;
        // rr %= 1000000007;
    }
    r /= rr;
    // r %= 1000000007;
    return r;
}

int main() {
  string S;
  cin>>S;
  ll num=0;
  FOR(i,S.size()/2){
    if(S[i]!=S[S.size()-1-i]){
      num++;
    }
  }
  cout<<num<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cstdio>
#include <algorithm>
#include <cassert>
#include <utility>
#include <string>
#include <cmath>
#include <set>
#include <functional>
#include <map>
#include <queue>
#include <stack>
#include <iomanip>
#include <climits>
#include <unordered_map>
#include <numeric>
#include <cstring>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define show(x) cout << #x << " = " << (x) << endl;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<vector<int>> hoge;
int main(){
    map<int,int>mp;
    int n;
    cin >> n;
    rep(i,n){
        int x;
        cin >> x;
        mp[x]++;
    }
    int ans = 0;
    for(auto x:mp){
        ans += x.second%2;
    }
    cout << ans << endl;
}


Measured memory_bytes: 4864
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cassert>
#include <iostream>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <sstream>
#include <bitset>
#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)

using namespace std;
typedef long long ll;

ll gcd(ll a, ll b)
{
   if (a%b == 0)
   {
       return(b);
   }
   else
   {
       return(gcd(b, a%b));
   }
}

ll ds(ll Q){
        ll sum=0;
        ll dig;
        while(Q){
        dig = Q % 10;
        sum = sum + dig;
        Q = Q / 10;
        }
        return sum;
    }

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


    ll ans=0;
    ll anss =0;
    ll count=0;
    ll i,j,h;
  
    long double x;
    vector<ll> aa;

    ll Q,N,K;
    long double a, b;
    string S;
    cin  >>K;
    ll flag=0;
    ll t1=0;
    ll t2=0;
  	
    ll Q1=Q;

    ll temp=0;
    ll pl=1;

    
    for(i=1;i<K+1;i++){
        for(j=1;j<K+1;j++){
            for(h=1;h<K+1;h++){
                temp=gcd(i,j);
                ans+= gcd(temp,h);
            }
        }
    }
    cout<<ans<<endl;


    return 0;
}

Measured memory_bytes: 3640
#include<stdio.h>

int main(){
  int n,k,q;
  scanf("%d %d %d",&n,&k,&q);
  
  int a[q+1],b[n+1];
  for(int i=1;i<=q;i++){
    scanf("%d",&a[i]);
  }
  for(int i=1;i<=n;i++){
    b[i]=k-q;
  }
  
  for(int i=1;i<=q;i++){
    b[a[i]]+=1;
  }
  
  for(int i=1;i<=n;i++){
    if(b[i]>0){
      printf("Yes\n");
    }else{
      printf("No\n");
    }
  }
  return 0;
}

Measured memory_bytes: 1280
#include <iostream>
#include <vector>
#include <string>
#include <list>
#include <queue>
#include <algorithm>
#define rep(i, n) for(i = 0; i < (n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define MOD 1000000007
#define PI 3.14159265358979323846
#define INF 1ll << 60

using namespace std;
typedef long long ll;
typedef pair<int, int> pp;

ll judge(vector<int> & d, vector<int> & c, ll k, int s) {
	int i, p = d[s];
	ll sum = c[p], ans = c[p];
	vector<ll> b = { c[p] };
	for(i = 0; i < k && p != s; i++) {
		p = d[p];
		sum += c[p];
		chmax(ans, sum);
		b.push_back(ans);
	}
	if (i == k)
		return b[k - 1];
	ll a = k / b.size() * sum;
	if (k % b.size())
		a += max(0ll, b[k % b.size() - 1]);
	else
		chmax(a, a - sum + ans);
	return max(a, ans);
}

int main(void) {
	int num, i, k;
	ll ans = -INF;
	cin >> num >> k;
	vector<int> d(num), c(num);
	rep(i, num) {
		cin >> d[i];
		d[i]--;
	}
	rep(i, num)
		cin >> c[i];
	rep(i, num) {
		chmax(ans, judge(d, c, k, i));
	}
	cout << ans << "\n";
	return 0;
}

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

int main() {
  int a,b;
  cin >> a >> b;
  
  int kazu;
  
  for (int i=1; i<=999; i++){
    if (a+i == b) kazu = i;
  }
  
  int ans;
  int sum = 0;
  for (int i=1; i<=kazu; i++){
    sum += i;
  }
  
  ans = sum - b;
  
  cout << ans << endl;
  
}


Measured memory_bytes: 256
from sys import stdin


def main() -> None:
    h = next_int()
    w = next_int()
    a = [input() for _ in range(h)]

    for j in range(w - 1, -1, -1):
        flg = False
        for i in range(h):
            if a[i][j] == "#":
                flg = True

        if not flg:
            for i in range(h):
                a[i] = a[i][:j] + a[i][j + 1:]

    for i in range(h):
        if "#" in a[i]:
            print(a[i])


def next_int() -> int:
    return int(next_str())


def next_str() -> str:
    result = ""
    while True:
        tmp = stdin.read(1)
        if tmp.strip() != "":
            result += tmp
        elif tmp != '\r':
            break
    return result


if __name__ == '__main__':
    main()

Measured memory_bytes: 3064
s = ["A", "B", "C", "D", "E"]
while True:
  a, b = map(int, input().split())
  if a == 0 and b == 0:
    break
  else:
    m = [0 for i in range(5)]
    m[0] = a + b
    for i in range(1, 5):
      aa, bb = map(int, input().split())
      m[i] = aa + bb
    ans = 0
    mm = 0
    for i in range(5):
      if m[i] > mm:
        mm = m[i]
        ans = i
    print(s[ans], mm)


Measured memory_bytes: 5604
import heapq
n, m = map(int, input().split())
a = list(map(int, input().split()))
num = [list(map(int, input().split())) for _ in range(m)]

heapq.heapify(a)
num.sort(key=lambda x: x[1], reverse=True)
s = sum(a)
for i in range(m):
    for j in range(num[i][0]):
        heapq.heappush(a, num[i][1])
        k = heapq.heappop(a)
        if k == num[i][1]:
            print(s)
            exit()
        s += num[i][1] - k
print(s)

Measured memory_bytes: 99096
#include <bits/stdc++.h>
using namespace std;
int main(){
  int X;
  cin >> X;

  int a=X%100;
  int b=0;
  if(a%5!=0){
    b++;
  }
  b+=a/5;
  if(X>b*100){
    cout << 1 << endl;
  }
  else{
    cout << 0 << endl;
  }
}

Measured memory_bytes: 256
#include <stdio.h>

int main(int argc, char const *argv[])
{
    int N,T;
    int c[1000],t[1000];
    int c_temp,t_temp;
    int i;

    scanf("%d %d\n",&N,&T);

    i=0;
    c_temp=10000;
    t_temp=10000;

    while(i<N){
        scanf("%d %d\n",&c[i],&t[i]);
        i++;
    }

    i=0;

    while(i<N){
        if(t[i]<=T){
            if(c[i]<c_temp){
                t_temp=t[i];
                c_temp=c[i];
            }
        }
        i++;
    }

    if(i==N && t_temp>T){
        printf("TLE\n");
    }
    else{
        printf("%d\n",c_temp);
    }
    
    return 0;
}



Measured memory_bytes: 128
//q014.cpp
//Sun Aug  9 11:16:16 2020

#include <iostream>
#include <string>
#include <queue>
#include <map>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <math.h>
#include <set>
#include <bitset>
#define INTINF 2147483647
#define LLINF 9223372036854775807
#define MOD 1000000007
#define rep(i,n) for (int i=0;i<(n);++i)

using namespace std;
using ll=long long;
typedef pair<int,int> P;

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

	ll a[n];
	rep(i,n) cin >> a[i];

	ll ans = LLINF;
	rep(i,1<<(n-1)){
		ll height = a[0];
		ll cost = 0;
		if (bitset<32>(i).count()!=k-1){
			continue;
		}
		rep(j,n-1){
			if (i>>j&1){
				cost+=max(height-a[j+1]+1,0LL);
				height=max(a[j+1],height+1);
			}else {
				height = max(height,a[j+1]);
			}
		}
		ans = min(ans,cost);
	}

	cout << ans << endl;
//	printf("%.4f\n",ans);
}

Measured memory_bytes: 3548
#include<bits/stdc++.h>
//std::ios::sync_with_stdio(false);
using namespace std;
typedef long long ll;
ll n,m;
ll sx;
ll sy;
ll mod=1e9+7;
ll x[200000],y[200000];
int main()
{
    cin>>n>>m;
    for(ll i=1;i<=n;i++)
    {
        cin>>x[i];
    }
    for(ll i=1;i<=m;i++)
    {
        cin>>y[i];
    }
    for(ll i=1;i<=n;i++)
    {
        sx+=((i-1)*x[i]-(n-i)*x[i])%mod;
        sx%=mod;
    }
    for(ll i=1;i<=m;i++)
    {
        sy+=((i-1)*y[i]-(m-i)*y[i])%mod;
        sy%=mod;
    }
    cout<<sx%mod*sy%mod<<endl;
    return 0;
}

Measured memory_bytes: 1792
x, y, a, b, c = map(int, input().split())
p = sorted(map(int, input().split()))
q = sorted(map(int, input().split()))
r = sorted(map(int, input().split()))
ans = 0
z = 0
while x + y + z > 0:
    if p[-1] > max(q[-1], r[-1]) and x:
        x -= 1
        ans += p.pop()
        if not p or not x:
            p.append(-1)
    elif q[-1] > r[-1] and y:
        y -= 1
        ans += q.pop()
        if not q or not y:
            q.append(-1)
    else:
        z -= 1
        ans += r.pop()
        if not r:
            r.append(-1)
print(ans)


Measured memory_bytes: 23328
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <vector>
const int MAXN = 100010;
using namespace std;

int N, K, Ans = 0;
bool vis[MAXN];
int fa[MAXN], dep[MAXN], seq[MAXN];
vector<int> G[MAXN];

void dfs(int u) {
	int i, v;
	for(i = 0; i < G[u].size(); i++) {
		v = G[u][i];
		dep[v] = dep[u] + 1, dfs(v);
	}
}
void dfsvis(int u) {
	int i, v;
	vis[u] = 1;
	for(i = 0; i < G[u].size(); i++) if(!vis[v = G[u][i]])
		dfsvis(v);
}

inline bool cmpdep(int x, int y) { return dep[x] > dep[y]; }
int main() {
	int u, i;
	scanf("%d%d", &N, &K);
	for(i = 1; i <= N; i++) scanf("%d", &fa[i]);
	for(i = 2; i <= N; i++) G[fa[i]].push_back(i);
	if(fa[1] != 1) Ans++;

	dfs(1);

	for(i = 1; i <= N; i++) seq[i] = i;
	sort(seq + 1, seq + N + 1, cmpdep);
	for(i = 1; i <= N; i++) if((u = seq[i]), (!vis[u] && dep[u] > K)) {
		for(int k = 1; k <= K - 1; k++) u = fa[u];
		dfsvis(u);

		Ans++;
	}
	printf("%d", Ans);
	return 0;
}


Measured memory_bytes: 11648
import java.util.Scanner;

public class Main {
	static Scanner sc = new Scanner(System.in);
	static int K, R, L;
	static double P, E, T;

	public static void main(String[] args) {
		K = sc.nextInt();
		R = sc.nextInt();
		L = sc.nextInt();
		P = sc.nextDouble();
		E = sc.nextDouble();
		T = sc.nextDouble();
		System.out.printf("%.6f\n", rec(R, L, 0, 1));
	}

	static double rec(double r, double l, int k, double p) {
		if (l < T - E) return 0;
		if (T + E < r) return 0;
		if (T - E <= r && l <= T + E) return p;
		double h = (r + l) / 2;
		if (k == K) {
			return h < T - E || T + E < h ? 0 : p;
		}
		double ret = 0;
		ret += rec(r, h, k + 1, p * (h < T ? P : 1 - P));
		ret += rec(h, l, k + 1, p * (h < T ? 1 - P : P));
		return ret;
	}

}

Measured memory_bytes: 19172
#include <algorithm>
#include <climits>
#include <iostream>
#include <string>
#include <utility>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <iomanip>
#include <cmath>
#include <stack>
#define rep(i,n) for (int i=0; i<(n); ++i)
using namespace std;
using ll = long long int;

template <class T> ostream &operator<<(ostream &os, vector<T> &v) {
  for (auto i = v.begin(); i != v.end(); i++) {
    os << *i << " ";
  }
  return os;
}


ll inf = pow(10, 18);
void solve(long long N, std::vector<long long> A){
  ll ans = 1;
  sort(A.begin(), A.end());
  rep(i,N) {
    if(ans == 0) break;
    if(inf / ans < A[i]) {
      ans = -1;
      break;
    }
    ans *= A[i];
  }
  if(ans > inf)
    std::cout << -1 << std::endl;
  else
    std::cout << ans << std::endl;
}

int main(){
  long long N;
  scanf("%lld",&N);
  std::vector<long long> A(N);
  for(int i = 0 ; i < N ; i++){
    scanf("%lld",&A[i]);
  }
  solve(N, std::move(A));
  return 0;
}



Measured memory_bytes: 4076
n,l,t=map(int,raw_input().split())
l*=2
t*=2
x=[None]*(2*n)
w=[None]*(2*n)
for i in xrange(n):
    ex,ew=map(int,raw_input().split())
    x[i]=ex*2;x[i+n]=ex*2+l
    w[i]=ew;w[i+n]=ew
pos=[]
start=-1
check=False
for i in xrange(n):
    if w[i]==1:
        check=True
        start=i
        pos.append((x[i]+t)%l)
    else:
        pos.append((x[i]-t+l)%l)
if not check:
    for i in xrange(n):
        print pos[i]/2
    exit()
"""
for i in xrange(len(w1)):
    if pos.count(pos[w1[i]])==1:
        start=w1[i]
        break
"""
#print start
ans=[-1]*n
cnt=0
sx=x[start]
for i in xrange(start,start+n):
    if w[i]==2:
        nokori=t-(x[i]-sx)/2
        if nokori<0:continue
        cnt+=nokori/(l/2)+1
idx=(start+cnt)%n
#print idx
ans[idx]=pos[start]
pos.sort()
for i in xrange(n-1,-1,-1):
    if pos[i]==ans[idx]:
        now=i
        break
for i in xrange(1,n):
    ans[(idx+i)%n]=pos[(now+i)%n]
for i in xrange(n):
    print ans[i]/2

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

int main(){
	string str, dataset[10];
	int m, n, count = 0;

	for(int i = 0; i < 10; i++){
		cin >> str;
		if(str.find("-") != string::npos) break;
		cin >> m;
		for(int j = 0; j < m; j++){
			cin >> n;
			str = str.substr(n, str.length() - n) + str.substr(0, n);
		}
		dataset[i] = str;
		count++;
	}

	for(int i = 0; i < count; i++){
		cout << dataset[i] << endl;
	}
	return 0;

}


Measured memory_bytes: 3240
N, K = map(int, input().split())
V = list(map(int, input().split()))
ans = 0
for i in range(min(N, K) + 1):
    for j in range(i + 1):
        for k in range(K - i + 1):
            ans = max(ans, sum(sorted(V[:i - j] 
                                      + list(reversed(V))[:j])[k:]))
print(ans)

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

using namespace std;

typedef long long LL;

const int nmax = 200005; const LL inf = 2e18; const int mod = 1000000009;

LL N;


int main(){
//   #ifndef GLOBAL_JUDGE
//      freopen("txt.in","r",stdin);
//      freopen("txt.out","w",stdout);
//   #endif // GLOBAL_JUDGE
   int i,j,k;
   cin >> N;
   int x = N%11;
   LL p = (N/11)*2;
   if(x){
   if(x <= 6)++p;
   else p+=2;
   }
   cout << p << '\n';
   return 0;
}


Measured memory_bytes: 256
//#include <tourist>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int INF = 1e9;
const ll LINF = ll(1e18);
const int MOD = 1000000007;
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define rep(i, n) for (int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define debug(v)          \
    cout << #v << ":";    \
    for (auto x : v)      \
    {                     \
        cout << x << ' '; \
    }                     \
    cout << endl;
template <class T>
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
//cout<<fixed<<setprecision(15);有効数字15桁
//-std=c++14
//-std=gnu++17
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];
    sort(ALL(a), greater<ll>());
    ll ans = a[0];
    int j = 1;
    bool b = false;
    //debug(a);
    rep(i, n - 2)
    {
        if (!b)
        {
            ans += a[j];
            b=true;
        }
        else
        {
            ans += a[j];
            j++;
            b = false;
        }
    }
    cout<<ans<<"\n";
}


Measured memory_bytes: 4784
package main

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

var sc = bufio.NewScanner(os.Stdin)

func nextString() string {
	if !sc.Scan() {
		panic("failed scan string")
	}
	return sc.Text()
}

func nextInt() int {
	if !sc.Scan() {
		panic("failed scan int")
	}
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	n := nextInt()
	s := []byte(nextString())

	max := 0
	for i := 0; i < n; i++ {
		k := count(i, s)
		if k > max {
			max = k
		}
	}
	fmt.Println(max)
}

func count(i int, s []byte) int {
	s1 := s[:i]
	s2 := s[i:]

	m1 := map[byte]bool{}
	m2 := map[byte]bool{}

	for _, k := range s1 {
		m1[k] = true
	}
	for _, k := range s2 {
		m2[k] = true
	}

	var c int
	for k, _ := range m1 {
		if _, ok := m2[k]; ok {
			c++
		}
	}

	return c
}


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

#define int long long

int dx[] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[] = {0, 1, 0, -1, 1, 1, -1, -1};

int N, x;
int a[100000];

signed main() {
    cin >> N >> x;
    for (int i = 0; i < N; i++) {
        cin >> a[i];
    }
    int ans = 0;
    if (a[0] > x) {
        ans += a[0] - x;
        a[0] = x;
    }
    for (int i = 0; i < N - 1; i++) {
        if (a[i] + a[i + 1] > x) {
            ans += a[i] + a[i + 1] - x;
            a[i + 1] = x - a[i];
        }
    }
    cout << ans << endl;
    return 0;
}


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

typedef long long ll;

int main()
{
    int ans=0;
    string s;
    cin>>s;
    rep(i,4){
        if(s[i]=='+')ans++;
        else ans--;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define PI 3.141592653589793238462643383279502884L
#define lli long long int
#define d double
#define mx 100000
using namespace std;
bool vis[mx+1];
int in_degree[mx+1];
void dfs(vector<list<int>>&adjList,vector<int>&dp,int i){
	vis[i]=true;
	for(int nbs : adjList[i]){
		dp[nbs]=max(dp[nbs],1+dp[i]);
		in_degree[nbs]--;
		if(!vis[nbs] && in_degree[nbs]==0) dfs(adjList,dp,nbs);
	}
}
int main() {
	FIO;
	int n,m;
	cin>>n>>m;
	vector<list<int>> adjList(n+1);
	for(int i=1;i<=m;i++){
		int x,y;
		cin>>x>>y;
		adjList[x].push_back(y);
		in_degree[y]++;
	}
	memset(vis,false,sizeof(vis));
	vector<int> dp(n+1,0);
	for(int i=1;i<=n;i++){
		if(!vis[i] && in_degree[i]==0) dfs(adjList,dp,i);
	}
	
	int ans=*max_element(dp.begin(),dp.end());
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 10496
#include<cstdio>
using namespace std;
bool N,S,E,W;
int main(){
	char ch;
	do{
		ch=getchar();
		if(ch=='N') N=1;
		if(ch=='S') S=1;
		if(ch=='E') E=1;
		if(ch=='W') W=1;
	}while(~ch);
	if((N^S)||(E^W)) puts("No");else puts("Yes");
	return 0;
}

Measured memory_bytes: 384
#include<iostream>
#include<cstring>
#include<string>
#include<cmath>
#include<vector>
#include<algorithm>
#include<iterator>
#include<sstream>
#include<iomanip>
#include<map>

#define rep(i, n) for (ll i = 0; i < n; i++) 
#define rrep(i, n) for(ll i = n-1; i>=0; i--)
#define range(i, n, m) for (ll i = n; i < m; i++) 
#define rrange(i, n, m) for (ll i = n - 1; i => m; i--) 
#define MOD 1000000007
//#define MOD 998244353

typedef long long int ll;
typedef unsigned long long int ull;

using namespace std;

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

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

	ll A, B, T;

	cin >> A >> B >> T;

	ll ret = (T / A) * B;

	cout << ret << endl;







	



	
	return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {
            String[] date1 = Console.ReadLine().Split(' ');
            String[] date2 = Console.ReadLine().Split(' ');

            int month1, day1, month2, day2;
            month1 = int.Parse(date1[0]);
            day1 = int.Parse(date1[1]);
            month2 = int.Parse(date2[0]);
            day2 = int.Parse(date2[1]);

            int result = 0;
            if (month2 == month1 + 1 && day2 == 1) {
                result = 1;
            }

            Console.WriteLine(result);

        }
    }
}


Measured memory_bytes: 11092
#include <iostream>
#include <functional>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <climits>

using namespace std;
typedef long long int ll;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define MOD = 1000000007;
#define INF (1e9)
#define print(x) cout << x << endl;

ll gcd(ll a, ll b) { return b ? gcd(b,a%b) : a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
typedef pair <ll,ll> P;


int main()
{
    ll X, A, B;
    cin >> X >> A >> B;
    cout << (X-A) % B << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<algorithm>
using namespace std;
#define cool ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL) 
#define ll long long
int main()
{ 
    cool;
    long long int n;
    cin>>n;
    long long int a[n],b[n+1]={0},c[n+1][2],i,s1=0,s2=0;
    for(i=0;i<n;i++)
    {
    	cin>>a[i];
    	b[a[i]]++;
	}
	for(i=1;i<=n;i++)
	{
		c[i][0]=0;
		c[i][1]=0;
			}
	for(i=0;i<n;i++)
	{
		c[a[i]][0]=(b[a[i]]*(b[a[i]]-1))/2;
		c[a[i]][1]=((b[a[i]]-1)*(b[a[i]]-2))/2;
	}
	for(i=1;i<=n;i++)
	{
		s1+=c[i][0];
		s2+=c[i][1];
	}
	for(i=0;i<n;i++)
	{
		cout<<(s1-c[a[i]][0]+c[a[i]][1])<<"\n";
	}
    return 0;
}


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

#define ALL(a)  (a).begin(),(a).end()
#define FOR(i,a,b)  for(int i=(a);i<(b);++i)
#define rep(i,n)    FOR(i,0,n)
#define rep_one(i,n)    FOR(i,1,n+1)
#define rrep(i,n)   for(int i=n-1;i<=0;--i)
#define loop        while(true)
#define sl(n) scanf("%lld", &n)
#define si(n) scanf("%d", &n)
#define sd(n) scanf("%lf", &n)
typedef long long ll;
const ll INF = 1LL<<60;
const ll MOD = 1000000007;
const ll MAX = 10000000;
const ll MIN = 0;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
using pl = pair<ll, ll>;
using ps = pair<int, string>;

int main() {
    ll N, M, K;
    cin >> N >> M >> K;
    vector<ll> seq_A(N+1), seq_B(M+1);
    rep_one(i,N) sl(seq_A.at(i));
    rep_one(i,M) sl(seq_B.at(i));
    // 累積和を求める
    vector<ll> cum_A(N+1,0), cum_B(M+1,0);
    rep_one(i,N) cum_A.at(i) = cum_A.at(i-1) + seq_A.at(i);
    rep_one(i,M) cum_B.at(i) = cum_B.at(i-1) + seq_B.at(i);

    // 読む本が無かったら0
    ll ans = 0;
    for(ll i = 0; i <= N; i++) {
        if( cum_A.at(i) > K) break;
        ll c = upper_bound(cum_B.begin(), cum_B.end(),
                           K - cum_A.at(i)) - cum_B.begin() - 1;
        ans = max(ans, i+c);
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 9640
R , G , B , N = map(int,input().split())

sum = 0
R_G_B = [R,G,B]
R_G_B.sort()
for i in range(N // R_G_B[2] + 1):
	for j in range((N - i * R_G_B[2]) // R_G_B[1] + 1):
		if (N - R_G_B[2] * i - R_G_B[1] * j) % R_G_B[0] == 0:
			sum += 1
			
print(sum)

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

ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

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

  int ans = 0;
  for(int i = 1; i < n; ++i){
    vector<int> c1(26,0);
    vector<int> c2(26,0);
    int count = 0;
    for(int j = 0; j < i; ++j){
      c1[(int)(s[j]-'a')]++;
    }
    for(int j = i; j < n; ++j){
      c2[(int)(s[j]-'a')]++;
    }
    for(int j = 0; j < 26; ++j){
      if(c1[j] != 0 && c2[j] != 0){
        count++;
      }
    }
    ans = max(ans, count);
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
import java.util.*;
 
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int K = sc.nextInt();
        int Q = sc.nextInt();
        int[] man = new int[N];
        for (int i = 0; i < Q; i++) {
        	man[sc.nextInt() - 1]++;
        }
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < N; i++) {
        	if (man[i] <= Q - K) {
        		sb.append("No\n");
        	} else {
        		sb.append("Yes\n");
        	}
        }
        System.out.println(sb);
    }
}

Measured memory_bytes: 50428
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;

int func(int x)
{
	if(x<10)return x;
	else return x%10+func(x/10);
}

int main()
{
	int n,a,b,sum=0;
	cin>>n>>a>>b;
	for(int i=1;i<=n;i++)
	{
		if(func(i)>=a&&func(i)<=b)sum+=i;
	}
	cout<<sum<<endl;
	return 0;
}
	

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

int main()
{
	int x, n;
	scanf("%d %d", &x, &n);
	
	const int N = 100 + 7;
	bool was[N];
	fill(was, was + N, false);

	for (int i = 0; i < n; ++i)
	{
		int a;
		scanf("%d", &a);
		was[a] = true;
	}
	
	for (int d = 0; d <= 100; ++d)
	{
		if (!was[x - d])
			return printf("%d", x - d), 0;
		if (!was[x + d])
			return printf("%d", x + d), 0;
	}

	return 0;
}


Measured memory_bytes: 1736
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

M,K = map(int,read().split())

if M == 1:
    if K == 0:
        print(0,0,1,1)
    else:
        print(-1)
else:
    if K >= (1<<M):
        print(-1)
    else:
        other = list(range(1<<M)); other.remove(K)
        arr = other + [K] + other[::-1] + [K]
        print(' '.join(map(str,arr)))

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

template <typename T>
std::ostream &operator<<(std::ostream &out, const std::vector<T> &v) {
if (!v.empty()) {
    out << '[';
    std::copy(v.begin(), v.end(), std::ostream_iterator<T>(out, ", "));
    out << "\b\b]";
  }
  return out;
}
template <typename T1, typename T2>
std::ostream &operator<<(std::ostream &out, const std::pair<T1, T2> &p) {
    out << "[" << p.first << ", " << p.second << "]";
    return out;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a, b, c;
    cin >> a >> b >> c;
    if(a == 5 && b == 5 && c == 7){
        cout << "YES" << endl;
    }else if(a == 5 && b == 7 && c == 5){
        cout << "YES" << endl;
    }else if(a == 7 && b == 5 && c == 5){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <map>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <set>
#include <vector>
#include <queue>
#include <list>
#include <numeric>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <math.h>
#include <stack>
#include <climits>
#include <bitset>

using namespace std;
typedef long long ll;

//最小公倍数
ll gcd(ll x, ll y) {
  ll tmp = 0;
  if (x < y){
    tmp=x;
    x=y;
    y=tmp;
  }
  while (y > 0) {
    ll r = x % y;
    x = y;
    y = r;
  }
  return x;
}

//最大公倍数
ll lcm(ll x,ll y){
  return x/gcd(x,y)*y;
}

//階乗
ll kaijo(ll k){
    ll sum = 1;
    for (ll i = 1; i <= k; ++i)
    {
        sum *= i;
        sum%=1000000000+7;
    }
    return sum;
}

//for(int i = ; i < ; i++){}


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

  



Measured memory_bytes: 256
A, B, K = map(int, input().split())
l = list()
a = 0
c = 0
if A > B:
    c = A
else:
    c = B
for i in range(1, c + 1):
    if A % i == 0 and B % i == 0:
        l.append(i)
l.sort(reverse=True)
for i in range(len(l)):
    if i + 1 == K:
        a = l[i]
print(a)

Measured memory_bytes: 3060
#include<cstdio>
#include<string>
#include<cstring>
#include<utility>
#include<cmath>
#include<map>
#include<queue>
#include<set>
#include<algorithm>
#include<vector>
#include<iostream>
#define ll long long
#define pii pair<int,int>
#define mp make_pair
#define fi first
#define se second
#define inf 0x7fffffff
#define minn(x,y) x=min(x,y)
#define maxx(x,y) x=max(x,y)
using namespace std;
int b[200];
int main()
{
	int i,j,k,n,m,x,y,z;
	scanf("%d",&n);
	for(i=0;i<n-1;i++)
	{
		scanf("%d",&b[i]);
	}
	y=b[0]+b[n-2];
	for(i=1;i<=n-2;i++)
	{
		y+=min(b[i-1],b[i]);
	}
	printf("%d",y);
}


Measured memory_bytes: 256
## coding: UTF-8
from decimal import *
from itertools import permutations, combinations,combinations_with_replacement,product
import math
#from math import gcd

N = input()
#print(N[0])
#print(N[1])
#print(N[2])
ans = 'No'
for i in range(3):
    if(N[i] == '7'):
        ans = 'Yes'
print(ans)

Measured memory_bytes: 9732
n = gets.chomp.to_i
a = gets.chomp.split(" ").map(&:to_i);
a.sort!
if (n % 2 ==0)
  count = -1
  a.each_with_index do |i, j|
    count += 2 if j%2 == 0
        if count != i
      puts "0"
          exit 0
        end
  end
else
  count = 0
  a.each_with_index do |i, j|
    count += 2 if j%2 ==1
        if count != i
          puts "0"
          exit 0
        end
  end
end

puts (2 ** (n / 2)) % (10 ** 9 + 7)


Measured memory_bytes: 9472
import numpy as np


def check_pali(S):
    for i in range(0, len(S)):
        if S[i] != S[-1 * i + -1]:
            return False

        elif i > (len(S) / 2) + 1:
            break

    return True


S = input()

N = len(S)

short_N = (N - 1) // 2
long_N = (N + 3) // 2


if check_pali(S) & check_pali(S[0:short_N]) & check_pali(S[long_N-1:N]):
    print("Yes")
else:
    print("No")

Measured memory_bytes: 26568
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int MAX_N=100005;
int n,W,V;
int w[MAX_N],v[MAX_N];
LL dp[105][MAX_N];
int main()
{
	memset(dp,0x3f,sizeof(dp));
	cin>>n>>W;
	for(int i=1;i<=n;i++)cin>>w[i]>>v[i];
	for(int i=1;i<=n;i++)V+=v[i];
	dp[0][0]=0;
	for(int i=1;i<=n;i++)
	{
		for(int j=0;j<=V;j++)
		{
			if(j>=v[i])dp[i][j]=min(dp[i][j],dp[i-1][j-v[i]]+w[i]);
			dp[i][j]=min(dp[i][j],dp[i-1][j]);
		}
	}
	LL ans=0;
	for(int i=0;i<=V;i++)
	{
		if(dp[n][i]<=W)ans=i;
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 82304
const double = Float64
const int = Int64
const vint = Vector{int}
const vdouble = Vector{double}

int(x) = parse(int,x)

parseint(x) = parse(int, x)
readint() = map(parseint, split(readline()))

function main()
  n,k = readint()

  kasi = ones(int, n)
  for i in 1:k
    d = readint()
    A = readint()
    for a in A
      kasi[a] = 0
    end
  end
  println(sum(kasi))

end

main()

Measured memory_bytes: 225628
# -*- coding: utf-8 -*-
import sys
from operator import itemgetter
from fractions import gcd
from math import ceil, floor, sqrt
from copy import deepcopy
from collections import Counter, deque
import heapq
from functools import reduce
sys.setrecursionlimit(200000)
# local only
# if not __debug__:
#     fin = open('in_1.txt', 'r')
#     sys.stdin = fin
# local only
input = sys.stdin.readline
def ii(): return int(input())
def mi(): return map(int, input().rstrip().split())
def lmi(): return list(map(int, input().rstrip().split()))
def li(): return list(input().rstrip())
def debug(*args, sep=" ", end="\n"): print("debug:", *args, file=sys.stderr, sep=sep, end=end) if not __debug__ else None
def exit(*arg): print(*arg); sys.exit()
# template


def main():
    N = ii()
    A = lmi()
    B = lmi()
    C = lmi()
    ans = 0
    for i in range(N - 1):
        if A[i] + 1 == A[i + 1]:
            ans += C[A[i] - 1]
    ans += sum(B)
    print(ans)
    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 5716
import math
a, b, h, m = map(int, input().split())
 
rad_a = h * 30 + m * 0.5
rad_b = m * 6
 
rad = abs(rad_a - rad_b)
if rad > 180:
    rad = 360 - rad
 
cos_theta = math.cos(math.radians(rad))
L = a + b + math.sqrt(a*a + b*b - (2 * a * b * cos_theta))
print(L - a - b)

Measured memory_bytes: 9376
#include "bits/stdc++.h"
using namespace std;
using ll=long long;
#define rep(i, n) for(int i=0; i<n; i++)
#define repr(i, n) for(int i=n-1; i>=0; i--)

const int inf=1000000007;
const int MOD=1000000007;
const long long INF=1000000000000000007;

string s, t;
int pos[30][200200];

int main() {
  cin >> s;
  cin >> t;

  string ss = s + s;
  for (char c = 'a'; c - 'a' < 26; c++) {
    pos[c - 'a'][ss.length()] = inf;
    for (int i = ss.length() - 1; i >= 0; i--) {
      if (ss[i] == c) {
        pos[c - 'a'][i] = i;
      } else {
        pos[c - 'a'][i] = pos[c - 'a'][i+1];
      }
    }
  }

  int cur = 0;
  ll ans = 0;
  for (int i = 0; i < t.size(); i++) {
    int ch = t[i] - 'a';
    if (pos[ch][cur] == inf) {
      cout << "-1" << endl;
      return 0;
    }
    ans += pos[ch][cur] - cur + 1;
    cur = pos[ch][cur] + 1;
    if (cur >= s.size()) {
      cur -= s.size();
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 21248
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.Map;
import java.util.Map.Entry;

import java.util.PriorityQueue;
import java.util.Set;
import java.util.StringTokenizer;
import java.util.TreeSet;

public class Main {
	
	public static long calc(long A) {
		long answer = 0;
		
		for(int bit_index = 63; bit_index >= 0; bit_index--) {
			final long bit_value = (A & (1 << bit_index)) >> bit_index;
			
			if(bit_value == 0) { continue; }
			
			if(bit_index == 0) {
				answer ^= (A - 1);
			}else if(bit_index == 1) {
				answer ^= 1;
			}
		}
		
		return answer ^ A;
	}
	
	public static void main(String[] args) throws IOException {
		try(final Scanner sc = new Scanner(System.in)){
			final long A = sc.nextLong();
			final long B = sc.nextLong();
			
			System.out.println(calc(A - 1) ^ calc(B));
		}
	}

	public static class Scanner implements Closeable {
		private BufferedReader br;
		private StringTokenizer tok;

		public Scanner(InputStream is) throws IOException {
			br = new BufferedReader(new InputStreamReader(is));
		}

		private void getLine() throws IOException {
			while(!hasNext()){
				tok = new StringTokenizer(br.readLine());
			}
		}

		private boolean hasNext() {
			return tok != null && tok.hasMoreTokens();
		}

		public String next() throws IOException {
			getLine();
			return tok.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

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

		public int[] nextIntArray(int n) throws IOException {
			final int[] ret = new int[n];
			for(int i = 0; i < n; i++){
				ret[i] = this.nextInt();
			}
			return ret;
		}

		public long[] nextLongArray(int n) throws IOException {
			final long[] ret = new long[n];
			for(int i = 0; i < n; i++){
				ret[i] = this.nextLong();
			}
			return ret;
		}

		public void close() throws IOException {
			br.close();
		}
	}
}

Measured memory_bytes: 22612
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<functional>
#include<queue>
#include<algorithm>
#include<complex>
#include<cstdlib>
#include<cctype>

#define REP(i,n) for(int i = 0;i < (n);i++)
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {for(int i = 0;i < (n);i++)cout << v[i] << ' ';cout << endl << endl;}
#define SHOW2d(v,i,j) {for(int a = 0;a < i;a++){for(int b = 0;b < j;b++)cout << v[a][b] << ' ';cout << endl;}cout << endl;}
#define ALL(v) v.begin(),v.end()
#define DBG cout << '!' << endl;


using namespace std;

typedef long long ll;
typedef vector<int> iv;
typedef vector<iv> iiv;
typedef vector<string> sv;

string j(string str)
{
	
	string ret = "";
	ret.PB(str[str.size()-1]);
	REP(i,str.size()-1)
	{
		ret.PB(str[i]);
	}
	
	return ret;
	
}

string c(string str)
{
	
	string ret = "";
	
	for(int i = 1;i < str.size();i++)
	{
		ret.PB(str[i]);
	}
	ret.PB(str[0]);
	
	return ret;
	
}

string e(string str)
{
	int len = str.size()/2;
	//cout << len << endl;
	string tmp1 = str.substr(0,len);
	string tmp2 = str.substr(str.size()-len,str.size());
	string ret = "";
	ret += tmp2;
	if(str.size()%2 == 1)
	{
		ret += str[len];
	}
	ret += tmp1;
	
	return ret;
}

string a(string str)
{
	reverse(ALL(str));
	
	return str;
}

string p(string str)
{
	REP(i,str.size())
	{
		 if(isdigit(str[i]))
		 {
			 if(str[i] == '0')
				 str[i] = '9';
			 else
				 str[i]--;
		 }
	}
	
	return str;
}

string m(string str)
{
		REP(i,str.size())
	{
		 if(isdigit(str[i]))
		 {
			 if(str[i] == '9')
				 str[i] = '0';
			 else
				 str[i]++;
		 }
	}
	
	return str;

}

int main()
{
	
	int n;
	cin >> n;
	
	REP(aaa,n)
	{
		string messenger,str;
		cin >> messenger >> str;
		
		for(int i = messenger.size()-1;i >= 0;i--)
		{
			switch(messenger[i])
			{
				case 'J':str = j(str);break;
				case 'C':str = c(str);break;
				case 'E':str = e(str);break;
				case 'A':str = a(str);break;
				case 'P':str = p(str);break;
				case 'M':str = m(str);break;
			}
		}
		
		cout << str << endl;
		
	}
	
	return 0;
}

Measured memory_bytes: 3164
while true
  d = gets.chomp.split
  a,b,c = d.map(&:to_i)
  count = 0
  count_add = 0

  for x in a..b
    if ( d[2].to_i % x.to_i ) == 0
      count += 1
    end
  end

break
end

puts count


Measured memory_bytes: 6860
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
    int n,i,a=0,w=0,t=0,r=0;
    cin>>n;
    string s[n];
    for(i=0; i<n; i++)
    {
        cin>>s[i];
    }
    for(i=0; i<n; i++)
    {
        if(s[i] == "AC")
            a++;
        else if(s[i] == "TLE")
            t++;
        else if(s[i] == "WA")
            w++;
        else if(s[i] == "RE")
            r++;
    }
    cout<<"AC x "<<a<<endl;
    cout<<"WA x "<<w<<endl;
    cout<<"TLE x "<<t<<endl;
    cout<<"RE x "<<r<<endl;
 
 
 
    return 0;
}

Measured memory_bytes: 6724
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Main main = new Main();
		main.run();
	}

	public void run() {
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		int k=sc.nextInt();
		long sum[] = new long[200005];
		int p[] = new int[200005];

		long r[] = new long[1001];
		for(int i=1; i<=1000; i++) {
			r[i]=r[i-1]+i;
		}
		sum[0]=0;
		for(int i=0; i<n; i++) {
			p[i] = sc.nextInt();
			sum[i+1] = sum[i]+p[i];
		}
		long max = 0;
		int maxi = 0;
		for(int i=0; i<n-k+1; i++) {
			long tmp = sum[i+k] - sum[i];
			if(max<tmp) {
				max=tmp;
				maxi=i;
			}
		}
		double e = 0;
		for(int i=0; i<k; i++) {
			e+=(double)r[p[i+maxi]]/(double)p[i+maxi];
		}
		System.out.println(e);

		sc.close();
	}
}


Measured memory_bytes: 87272
#include <iostream>
#include <cstdio>
#include <string>
#include <set>
#include <vector>
#include <utility>
using namespace std;

set<string> Ws;
set<string> W;

const int dx[8] = {1, 1, 1, 0, 0, -1, -1, -1};
const int dy[8] = {1, 0, -1, 1, -1, 1, 0, -1};

typedef pair<int, string> spell;

int main() {
  int h, w;
  while (scanf("%d%d", &h, &w) != EOF && w) {
    Ws.clear();
    vector< vector<char> > table = vector< vector<char> >(h, vector<char>(w));
    for (auto i=0; i<h; i++) {
      for (auto j=0; j<w; j++) {
	scanf(" %c", &table[i][j]);
      }
    }
    string MS = "";
    int MSsize = 0;
    spell A = make_pair(-1*MSsize, MS);
    for (auto i=0; i<h; i++) {
      for (auto j=0; j<w; j++) {
	W.clear();
	for (auto d=0; d<8; d++) {
	  string S = "";
	  S += table[i][j];
	  vector< vector<bool> > visited 
	    = vector< vector<bool> >(h, vector<bool>(w, false));
	  visited[i][j] = true;
	  int ni, nj;
	  for (auto k=1; 
	       !visited[(ni = (h*w+i+dx[d]*k)%h)][(nj = (h*w+j+dy[d]*k)%w)];
	       k++) {
	    visited[ni][nj] = true;
	    S += table[ni][nj];
	    // cerr << S << endl;
	    W.insert(S);
	  }
	}
	for (auto k=W.begin(); k != W.end(); k++) {
	  string S;
	  if (Ws.find((S = *k)) != Ws.end()) {
	    spell t;
	    if ((t = make_pair(-1*(int)(S.size()), S)) < A) A = t;
	  } else {
	    Ws.insert(S);
	  }
	}
      }
    }
    cout << (A.second == "" ? "0" : A.second) << endl;
  }
  return 0;
}

Measured memory_bytes: 33716
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
long long a[120];
using namespace std;
int main()
{
	int n;
	cin>>n;
	a[0]=2;
	a[1]=1;
	a[2]=3;
	for(int i=3;i<=n;i++)
	a[i]=a[i-1]+a[i-2];
	cout<<a[n]<<endl;
	return 0;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline
N, M = (int(i) for i in input().split())
H = [int(x) for x in input().split()]
#roads = [[int(i) for i in input().split()] for i in range(N)]
ans = set()
for i in range(1, N+1):
    ans.add(i)

for i in range(M):
    A, B = (int(i) for i in input().split())
    if H[A-1] > H[B-1]:
        ans.discard(B)
    elif H[A-1] < H[B-1]:
        ans.discard(A)
    else:
        ans.discard(A)
        ans.discard(B)
    # print(ans)
# print(ans)
print(len(ans))


Measured memory_bytes: 91432
#include <bits/stdc++.h>
using namespace std;
constexpr int MAXN = 1e5 + 7;
constexpr int MAXM = 1e5 + 7;

int u[MAXN], nxt[MAXM], v[MAXM];
int dp[MAXN];

int dfs(int x)
{
    if (!dp[x])
        for (int i = u[x]; i; i = nxt[i])
            dp[x] = max(dp[x], dfs(v[i]) + 1);
    return dp[x];
}

int main()
{
    int n, m;
    scanf("%d%d", &n, &m);
    for (int i = 1; i <= m; ++i) {
        int a, b;
        scanf("%d%d", &a, &b);
        nxt[i] = u[a], v[i] = b;
        u[a] = i;
    }
    int ans = 0;
    for (int i = 1; i <= n; ++i)
        ans = max(ans, dfs(i));
    printf("%d\n", ans);
}

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

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

using namespace std;

int N,R,T,p[101],ok[1010],ng[1010];

int main() {
  cin >> N >> R >> T;
  rep(i,N) cin >> p[i];
  vector<int> cur(N,0);
  rep(_,T) {
    rep(i,N) {
      ( cur[i] += p[i] ) %= R;
      if( _ ) {
	++ng[cur[i]];
	if( ok[cur[i]] ) {
	  --ok[cur[i]];
	}
      }
    }
    rep(i,R) ok[i] += ng[i], ng[i] = 0;
  }
  int ans = 0;
  rep(i,R) ans += ok[i];
  cout << ans + N << endl;
  return 0;
}

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

  #define vi vector<int>
  #define all(v) v.begin(),v.end()
  #define ll long long int
  #define IOS ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
  #define D1(x) {cerr<<" [" <<#x<<": "<<x<<"]";cout << endl;}
  #define D2(x) {cerr<<" [" <<#x<<": ";for(auto it:x)cerr<<it<< " ";cerr<<"] ";cout << endl;}

  const ll MOD=1e9+7;

  void solve(){
    int n;
    cin >> n;
    map<string,int> mp;
    mp["AC"]=0;
    mp["TLE"]=0;
    mp["RE"]=0;
    mp["WA"]=0;
    for(int i=0;i<n;i++){
      string s;
      cin >> s;
      mp[s]++;
    }
    cout <<"AC" << " x " << mp["AC"] << '\n';
    cout << "WA" << " x " << mp["WA"] << '\n';
    cout << "TLE" << " x " << mp["TLE"] << '\n';
    cout << "RE" << " x " << mp["RE"] << '\n';
  }


  int main(){
    IOS
       solve();
       cerr <<endl <<"[ Time : " << (float)clock() / CLOCKS_PER_SEC << " secs ]" << endl;
  }
// integer overflow
// remember to clear visited array
// take input as vector<string> while using grid
// don't assign after modifying


Measured memory_bytes: 3856
/*
このコード、と～おれ!
Be accepted!
∧＿∧　
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
 　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
		  　　　　　　　　　　(¸.·´ (¸.·'* ☆
					*/

#include <stdio.h>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstring>
#include <vector>
#include <numeric>
#include <iostream>
#include <random>
#include <map>
#include <unordered_map>
#include <queue>
#include <regex>

#pragma GCC optimize("Ofast")
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define rep1(i, n) for(int i = 1; i <= (n); ++i)
#define rep2(i, n) for(int i = 2; i < (n); ++i)
#define repr(i, n) for(int i = n; i >= 0; --i)
#define reprm(i, n) for(int i = n - 1; i >= 0; --i)
#define printynl(a) printf(a ? "yes\n" : "no\n")
#define printyn(a) printf(a ? "Yes\n" : "No\n")
#define printYN(a) printf(a ? "YES\n" : "NO\n")
#define printin(a) printf(a ? "possible\n" : "inposible\n")
#define printdb(a) printf("%.50lf\n", a)//少数出力
#define printdbd(a) printf("%.16lf\n", a)//少数出力(桁少なめ)
#define prints(s) printf("%s\n", s.c_str())//string出力
#define all(x) (x).begin(), (x).end()
#define allsum(a, b, c) ((a + b) * c / 2)//等差数列の和、初項,末項,項数
#define pb push_back
#define priq priority_queue
#define rpriq priq<int, vector<int>, greater<int>>
#define deg_to_rad(deg) (((deg)/360.0)*2.0*PI)
#define rad_to_deg(rad) (((rad)/2.0/PI)*360.0)
#define Please return
#define AC 0

using ll = long long;

constexpr int INF = 1073741823;
constexpr int MINF = -1073741823;
constexpr ll LINF = ll(4661686018427387903);
constexpr ll MOD = 1000000007;
const double PI = acos(-1);

using namespace std;

void scans(string& str) {
	char c;
	str = "";
	scanf("%c", &c);
	if (c == '\n')scanf("%c", &c);//最初の改行対策
	while (c != '\n' && c != -1) {
		str += c;
		scanf("%c", &c);
	}
}

void scanc(char& str) {
	char c;
	scanf("%c", &c);
	if (c == -1)return;
	while (c == '\n') {
		scanf("%c", &c);
	}
	str = c;
}

double acot(double x) {
	return PI / 2 - atan(x);
}

/*-----------------------------------------ここからコード-----------------------------------------*/

int main() {
	
	int a[4] = {};
	int tmp;
	rep(i, 6) {
		scanf("%d", &tmp);
		++a[tmp - 1];
	}
	printYN(!(a[0] > 2 || a[1] > 2 || a[2] > 2 || a[3] > 2));

	Please AC;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, l, r) for(register int i = l; i < r; i++)
#define hrp(i, l, r) for(register int i = l; i <= r; i++)
#define rev(i, r, l) for(register int i = r; i >= l; i--)
#define ms(n, t) memset(n, t, sizeof(n))
#define U 10050
#define pb push_back
#define int ll
#ifndef JOEON
#define D(...)
#define R(x, l)
#define sp
#endif
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
template<typename tn> inline tn next(void);
template<typename tn> inline ostream& operator << (ostream& os, const vector<tn>& v);
signed main(void)
{
	#ifdef JOEON
//		freopen("C:\\Users\\Joeon\\Desktop\\IN.txt", "r", stdin);
//		freopen("C:\\Users\\Joeon\\Desktop\\OUT.txt", "w", stdout);
	#endif
	ios::sync_with_stdio(false);
	cin.tie(0);
	string str = next<string>();
	rep(i, 0, str.length()) if (str[i] == '?') str[i] = 'D';
	cout<<str<<endl;
	return 0;
}
template<typename tn> inline tn next(void)
{
	tn k;
	cin>>k;
	return k;
}
template<typename tn> inline ostream& operator << (ostream& os, const vector<tn>& v)
{
	rep(i, 0, v.size()) os<<v[i]<<' ';
	return os;
}

Measured memory_bytes: 3736
#include <iostream>
#include <string>
#include <algorithm>
#include <fstream>
#include <numeric>
#include <cmath>
#include <set>
#include <functional>
#include <vector>
#include <queue>

using namespace std;

#define ll long long
#define INF 2000000000
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define dum(x) cout<<#x<<'='<<x<<endl
#define darr(arr,n) rep(i,(n-arr)){cout<<*(arr+i)<<' ';}cout<<endl;

int a[100010];
int b[100010];
ll bc[100010];

int main() {
    ll N, K;
    cin >> N >> K;
    rep(i, N) {
        cin >> a[i] >> b[i];
        bc[a[i]] += b[i];
    }


    for (int i = 1; i < 100010; i++) {
        if (K <= bc[i]) {
            cout << i << endl;
            return 0;
        }
        K -= bc[i];
    }
}

Measured memory_bytes: 1792