akhauriyash/Code-Regression huggingface dataset:
import heapq

n = int(input())
xy = [list(map(int, input().split())) for _ in range(n)]
ixy = [(i, x, y) for i, (x, y) in enumerate(xy)]

# Get edges with cost along both x, y
edges = [[] for i in range(n)]
for x_or_y in [1, 2]:
    xy_sorted = sorted(ixy, key = lambda a: a[x_or_y])
    for i in range(n-1):
        i1 = xy_sorted[i][0]
        i2 = xy_sorted[i+1][0]
        cost = xy_sorted[i+1][x_or_y] - xy_sorted[i][x_or_y]
        edges[i1].append((i2, cost))
        edges[i2].append((i1, cost))

# Calculate minimum Spanning tree (Prim algorithm)
distinct = [False]*n
ans = 0
pque = []
heapq.heappush(pque, (0, 0))
while len(pque) > 0:
    # print(pque)
    cost, v = heapq.heappop(pque)
    if distinct[v]: continue
    
    ans += cost
    distinct[v] = True

    for v_next, cost_next in edges[v]:
        if not distinct[v_next]:
            heapq.heappush(pque, (cost_next, v_next))

print(ans)

Measured memory_bytes: 86116
N = int(input())
T, A = map(int, input().split())

H = list(map(int, input().split()))

min_i, min_d = None, 10 ** 6
for i, hi in enumerate(H):
    d = abs(A - (T - 0.006 * hi))
    if d < min_d:
        min_i = i + 1
        min_d = d
        if d == 0:
            break

print(min_i)


Measured memory_bytes: 3060
#include<stdio.h>
#include<iostream>
#include<string>
using namespace std;

int main(){
    string W; cin >>  W;
    for (int i = 0; i < W.size(); i++)
    {
        if ('A' <= W[i] && W[i] <= 'Z')
        {
            W[i] = W[i] + 32;
        }
        
    }
    
    int count; count = 0;
    string d;


    while(true){
        cin >> d;
        if (d == "END_OF_TEXT") break;
        for (int i = 0; i < d.size(); i++)
        {
            if ('A' <= d[i] && d[i] <= 'Z')
            {
                d[i] = d[i] + 32;
            }
        
        }
        if (W == d)
        {
            count++;
        }
        
    }
    cout << count << endl;
    return 0;

}


Measured memory_bytes: 3216
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int R;
  cin >>R;
  
  if(R<1200)cout<<"ABC"<<endl;
  else if(1200<=R&&R<2800)cout<<"ARC"<<endl;
  else cout<<"AGC"<<endl;
}
  
  

Measured memory_bytes: 256
//
// Created by yamunaku on 2019/07/30.
//

#include <bits/stdc++.h>

using namespace std;

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repl(i, l, r) for(int i = (l); i < (r); i++)
#define per(i, n) for(int i = ((n)-1); i >= 0; i--)
#define perl(i, l, r) for(int i = ((r)-1); i >= (l); i--)
#define all(x) (x).begin(),(x).end()
#define MOD9 998244353
#define MOD1 1000000007
#define IINF 1000000000
#define LINF 1000000000000000000
#define SP <<" "<<
#define CYES cout<<"Yes"<<endl
#define CNO cout<<"No"<<endl
#define CFS cin.tie(0);ios::sync_with_stdio(false)
#define CST(x) cout<<fixed<<setprecision(x)

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vector<int>> mti;
typedef vector<ll> vl;
typedef vector<vector<ll>> mtl;

int main(){
    string s;
    cin >> s;
    int n=s.length();
    vl dp(13,0);
    dp[0]=1;
    rep(i,n){
        vl ndp(13,0);
        if(s[i]=='?'){
            rep(c,10){
                rep(j,13){
                    ndp[(10*j+c)%13]=(ndp[(10*j+c)%13]+dp[j])%MOD1;
                }
            }
        }else{
            int c = s[i]-'0';
            rep(j,13){
                ndp[(10*j+c)%13]=(ndp[(10*j+c)%13]+dp[j])%MOD1;
            }
        }
        dp=ndp;
    }
    cout << dp[5] << endl;
    return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <algorithm>
#include <stdio.h>
using namespace std;

int bubble_sort(int *data, int n)
{
	int flag = 1;
	int count = 0;
	int i = 0;
	while(flag) {
		flag = 0;
		for(int j = n-1; j > i; j--) {
			if(data[j] < data[j-1]) {
				swap(data[j], data[j-1]);
				flag = 1;
				count++;
			}
		}
		i++;
	}
	return count;
}

int main(void)
{
	int *data;
	int n;
	cin >> n;

	data = new int[n];
	for(int i = 0; i < n; i++) {
		cin >> data[i];
	}

	int change = bubble_sort(data, n);

	for(int i = 0; i < n; i++) {
		if(i != 0) cout << ' ';
		cout << data[i];
	}
	cout << endl;
	cout << change << endl;

	delete data;	
	return 0;
}


Measured memory_bytes: 3100
# -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_4_C&lang=jp

"""
import sys
from sys import stdin
input = stdin.readline


def main(args):
    while True:
        ans = 0
        a, op, b = input().split()
        a = int(a)
        b = int(b)
        if op == '?':
            break
        elif op == '+':
            ans = a + b
        elif op == '-':
            ans = a - b
        elif op == '*':
            ans = a * b
        elif op == '/':
            ans = a // b

        print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])
    

Measured memory_bytes: 7776
package main

import (
	"fmt"
)

func main() {
	var N, K int
	fmt.Scanf("%d %d", &N, &K)

	var res float64
	for i := 1; i <= N; i++ {
		s := i
		tc := float64(float64(1) / float64(N))
		for s < K {
			s *= 2
			tc /= 2
		}
		res += tc
	}

	fmt.Println(res)
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
 
#define rep(i, n) for (int i = 0; i < (n); i++)
 
 
int main(){
    int X,Y,Z;
    cin >> X >> Y >> Z;
 
    cout << Z << " " << X << " " << Y;
 
    return 0;
}

Measured memory_bytes: 256
import copy
n, m, q = map(int, input().split())
score_list = [list(map(int, input().split())) for _ in range(q)]

a_list = []

def dfs(n, m, l):
    a = copy.copy(l)
    if a.count(0) == 0:
        a_list.append(a)
        return
    if a[0] == 0:
        for i in range(1, n+1):
            a[0] = i
            dfs(n, m, a)
        return
    for i in range(1, n):
        if a[i] == 0:
            for j in range(m-a[i-1]+1):
                a[i] = a[i-1] + j
                dfs(n, m, a)
            return

def get_score(l, score_list):
    score = 0
    for s in score_list:
        a = s[0]
        b = s[1]
        c = s[2]
        d = s[3]
        if l[b-1] - l[a-1] == c:
            score += d
    return score
dfs(n, m, [0 for _ in range(n)])
# print(a_list)
ans_list = [get_score(a, score_list) for a in a_list]
print(max(ans_list))


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

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

#define int                     long long int
#define ld                      long double
#define pb                      push_back
#define MOD                     1000000007
#define inf                     3e18
#define vi                      vector<int>
#define vld                     vector<ld>
#define pii                     pair<int,int>
#define mii                     map<int,int>
#define fi                      first
#define se                      second
#define fastIO                  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define db(...)                 __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) { cerr << " "<< name << " : " << arg1 <<'\n'; }
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
    const char* comma = strchr(names + 1, ',');
    cerr.write(names, comma - names) << " : " << arg1 << " | "; __f(comma + 1, args...);
}

typedef tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> pbds; 
		//order_of_key (k) : Number of items strictly smaller than k .
		//find_by_order(k) : K-th element in a set (counting from zero) (returns an iterator)           


void inp_out()
{
	#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	freopen("debug.txt", "w", stderr);
	#endif
}

int32_t main()
{
	fastIO
	inp_out();

	int n, ans = 0; 
	cin >> n; 
	vi a(n); 

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

	int cur = 0; 

	for(int i = 0; i < n; ++ i)
	{
		if(a[i] < cur)
		{
			ans += (cur - a[i]); 
		}
		else
			cur = a[i]; 
	}

	cout << ans; 

	return 0;
}

Measured memory_bytes: 4776
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;} return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;} return 0;}
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(vec) vec.begin(),vec.end()
typedef long long ll;
typedef pair<ll,ll> l_l;
typedef pair<int,int> i_i;
const ll mod=1e9+7;
const int inf=1<<30;

int n;
vector<vector<int> > to;
bool flag=0;
void dfs(int v,int p=-1,int d=0){
  rep(i,to[v].size()){
    int nv=to[v][i];
    if(nv==p) continue;
    if(d==1&&nv!=n-1) continue;
    if(nv==n-1) flag=1;
    if(!flag) dfs(nv,v,d+1);
  }
}

int main(){
  int m; cin >> n >> m;
  to.resize(n);
  rep(i,m){
    int a,b;
    cin >> a >> b;
    a--; b--;
    to[a].push_back(b);
    to[b].push_back(a);
  }
  dfs(0);
  if(flag) cout << "POSSIBLE" << endl;
  else cout << "IMPOSSIBLE" << endl;
}

Measured memory_bytes: 18160
#include<cstdio>
#include<cmath>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<queue>
#include<string>
#include<stack>
#include<list>
#include<set>

using namespace std;

#define DEBUG_FLAG

#define max(a,b) (a>b?a:b)
#define min(a,b) (a<b?a:b)
#ifdef DEBUG_FLAG
    #define dbgout(fmt, ...) fprintf(stderr, "\033[1;33mDEBUG(%s:%d):\t\033[0m" fmt, __func__, __LINE__, ##__VA_ARGS__)
#else
    #define dbgout(fmt, ...) 
#endif

const double eps = 1e-8;

double dis(double x,double y, double X,double Y){
	return sqrt((X-x)*(X-x)+(Y-y)*(Y-y));
}

struct meat
{
    double x,y,c;
};

vector<meat> meats;

vector<pair<double,double>> cal(double x1,double y1,double r1,double x2,double y2,double r2) {
    x1-=x2,y1-=y2;
    double S=x1*x1+y1*y1,a=(S+r2*r2-r1*r1)/2,D=S*r2*r2-a*a;
    if(D<0) return {};
    double A1=a*x1,B1=y1*sqrt(D);
    double A2=a*y1,B2=x1*sqrt(D);
    return {{(A1+B1)/S+x2,(A2-B2)/S+y2},{(A1-B1)/S+x2,(A2+B2)/S+y2}};
}

bool solve(double T, int K, int N)
{
    vector<pair<double,double> > jiaodians;
    double r[N];
    for (int i = 0; i < N; i++) r[i] = T / meats[i].c;
    for (int i = 0; i < N; i++) {
        jiaodians.push_back({meats[i].x, meats[i].y});
        for (int j = i+1; j < N; j++) {
            vector<pair<double, double>> vcal = cal(meats[i].x, meats[i].y, r[i], meats[j].x, meats[j].y, r[j]);
            for (pair<double, double> it:vcal) jiaodians.push_back(it);
        }
    }
    for (pair<double, double> it:jiaodians) {
        int cnt = 0;
        for (int i = 0; i < N; i++) {
            if (r[i] + eps >= dis(it.first, it.second, meats[i].x, meats[i].y)) cnt++;
        }
        if (cnt >= K) return true;
    }
    return false;
}

int main(void)
{
    int N, K;
    double l = 0, r = 1e7, mid;
    cin >> N >> K;
    for (int i = 0; i < N; i++) {
        meat t;
        cin >> t.x >> t.y >> t.c;
        meats.push_back(t);
    }
    bool flag = false;
    while (l + eps <= r)
    {
        mid = (l + r) / 2;
        if (solve(mid, K, N)) {
            r = mid;
            flag = true;
        } else {
            l = mid;
        }
    }
    if (!flag) {
        cout << -1 << endl;
    } else {
        printf("%lf\n", l);
    }
    return 0;
}

Measured memory_bytes: 384
#include <cstdio>

bool dp[100001];

int main()
{
  int n, k;
  scanf("%d%d", &n, &k);
  int a[100];
  for (int i = 0; i < n; ++i)
  {
    scanf("%d", a + i);
  }
  for (int i = 1; i <= k; ++i)
  {
    for (int j = 0; j < n; ++j)
    {
      if (i - a[j] >= 0)
      {
        dp[i] |= !dp[i - a[j]];
      }
    }
  }
  puts(dp[k] ? "First" : "Second");
  return 0;
}

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

int main(void) {
    int H,W;cin>>H>>W;
    char bobm[H+2][W+2];
    for (int j = 0; j <= W; j++) {
        bobm[0][j] = '.';
        bobm[H+1][j] = '.';
    }
    for (int i = 0; i <= H; i++) {
        bobm[i][0] = '.';
        bobm[i][W+1] = '.';
    }
    for (int i = 1; i <= H; i++) {
        string h;cin>>h;
        for (int j = 1; j <= W; j++) {
            bobm[i][j] = h[j - 1];
        }
    }
    // 結果出力
    for (int i = 1; i <= H; i++) {
        for (int j = 1; j <= W; j++) {
            char ch = bobm[i][j];
            if (ch == '#') cout << "#"; 
            else {
                vector<char> vc;
                vc.push_back(bobm[i-1][j]);
                vc.push_back(bobm[i-1][j-1]);
                vc.push_back(bobm[i-1][j+1]);
                vc.push_back(bobm[i][j-1]);
                vc.push_back(bobm[i][j+1]);
                vc.push_back(bobm[i+1][j-1]);
                vc.push_back(bobm[i+1][j]);
                vc.push_back(bobm[i+1][j+1]);
                cout << count(vc.begin(), vc.end(), '#');
            }
        }
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 256
{-# OPTIONS_GHC -O2 #-}
{-# LANGUAGE BangPatterns          #-}
{-# LANGUAGE CPP                   #-}
{-# LANGUAGE LambdaCase            #-}
{-# LANGUAGE MagicHash             #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE MultiWayIf            #-}
{-# LANGUAGE OverloadedStrings     #-}
{-# LANGUAGE TupleSections         #-}
{-# LANGUAGE TypeFamilies          #-}
{-# LANGUAGE ViewPatterns          #-}

import           Control.Applicative
import           Control.Exception
import           Control.Monad
import           Control.Monad.Primitive
import           Control.Monad.ST
import           Control.Monad.State.Strict
import           Data.Bool
import qualified Data.ByteString             as B
import qualified Data.ByteString.Builder     as B
import qualified Data.ByteString.Char8       as C
import qualified Data.ByteString.Unsafe      as B
import           Data.Char
import qualified Data.Foldable               as F
import           Data.Function
import qualified Data.IntMap.Strict          as IM
import qualified Data.IntSet                 as IS
import qualified Data.List                   as L
import qualified Data.Map.Strict             as M
import           Data.Monoid
import           Data.Ord
import           Data.Primitive.MutVar
import qualified Data.Set                    as S
import           Data.Tuple
import qualified Data.Vector                 as V
import qualified Data.Vector.Generic         as G
import qualified Data.Vector.Generic.Mutable as GM
import qualified Data.Vector.Unboxed         as U
import qualified Data.Vector.Unboxed.Mutable as UM
import           Debug.Trace
import           Foreign                     hiding (void)
import           GHC.Exts
import qualified System.IO                   as IO
import           Unsafe.Coerce

main :: IO ()
main = do
    [x,a] <- map read.words <$> getLine :: IO [Int]
    if x < a then print 0 else print 10

-------------------------------------------------------------------------------
type Parser a = C.ByteString -> Maybe (a, C.ByteString)

parseInt :: Parser Int
parseInt = C.readInt . C.dropWhile isSpace

parseInt2 :: Parser (Int, Int)
parseInt2 = runStateT $
    (,) <$> StateT (C.readInt . C.dropWhile isSpace)
        <*> StateT (C.readInt . B.unsafeTail)

parseInt3 :: Parser (Int, Int, Int)
parseInt3 = runStateT $
    (,,) <$> StateT (C.readInt . C.dropWhile isSpace)
        <*> StateT (C.readInt . B.unsafeTail)
        <*> StateT (C.readInt . B.unsafeTail)

parseInt4 :: Parser (Int, Int, Int, Int)
parseInt4 = runStateT $
    (,,,) <$> StateT (C.readInt . C.dropWhile isSpace)
        <*> StateT (C.readInt . B.unsafeTail)
        <*> StateT (C.readInt . B.unsafeTail)
        <*> StateT (C.readInt . B.unsafeTail)

Measured memory_bytes: 508
#include<stdio.h>
int adj[101][101];
int main()
{
  int i,j,n,u,k,l;

  scanf("%d",&n);
  for(i=0; i<n; i++) {
    scanf("%d%d",&u,&k);
    for(j=0; j<k; j++) {
      scanf("%d",&l);
      adj[u][l] = 1;
    }
  }

  for(i=1; i<=n; i++) {
    for(j=1; j<=n; j++) {
      if(j>1) printf(" ");
      printf("%d",adj[i][j]);
    }
    printf("\n");
  }
  return 0;
}
 

Measured memory_bytes: 640
// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

#define debug(...) fprintf(stderr, __VA_ARGS__)
#define int long long int
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
typedef pair<int, int> pii;
typedef long long ll;
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1001001001001001LL;
const ll MOD = 1000000007LL;

double dpn[110][510], dpc[110][510];
int can[510][110][2], exist[510], cnt[510];
signed main() {
    int H, N, P, M, K;
    cin >> H >> N >> P >> M >> K; P--;
    for(int i=0; i<M; i++) {
        int a, b; cin >> a >> b;
        a = H - a;
        exist[a] = true;
        can[a][b-1][1] = can[a][b][0] = true;
    }
    cnt[0] = H - M;
    for(int i=0; i<H; i++) cnt[i+1] = cnt[i] - !exist[i];

    dpc[P][0] = 1.0;
    for(int i=0; i<H; i++) {
        for(int k=0; k<=K; k++) {
            for(int j=0; j<N; j++) {
                // その行にすでに横線があるか
                // K 本全て引き終わった場合
                if(exist[i] or k == K) {
                    if(can[i][j][0]) dpn[j-1][k] += dpc[j][k];
                    else if(can[i][j][1]) dpn[j+1][k] += dpc[j][k];
                    else dpn[j][k] += dpc[j][k];
                }
                else {
                    // 横線を引く場合
                    // まだなにも横線が引かれてない行は cnt[i] 行
                    // 今の行に引かれる確率は (K - k) / cnt[i];
                    double p = 1.0 * (K - k) / cnt[i];
                    double r = 1.0, q = 1.0 / (N - 1);
                    if(j > 0) dpn[j-1][k+1] += dpc[j][k] * p * q, r -= q;
                    if(j+1 < N) dpn[j+1][k+1] += dpc[j][k] * p * q, r -= q;
                    dpn[j][k+1] += dpc[j][k] * p * r;
                    dpn[j][k] += dpc[j][k] * (1 - p);
                }
            }
        }
        fill(dpc[0], dpc[110], 0);
        swap(dpc, dpn);
    }
    double ans = 0.0;
    for(int i=0; i<N; i++) ans = max(ans, dpc[i][K]);
    printf("%.12f\n", ans);
    return 0;
}



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

bitset<2000*2000+1> S;

int main() {
	int n; scanf("%d", &n);
	int sum = 0;
	S[0] = 1;
	for (int i=1; i<=n; i++) {
		int x; scanf("%d", &x);
		S = S | (S << x); sum += x;
	}
	// sum /= 2;
	sum = (sum + 1) / 2;
	while (!S[sum]) ++sum;
	printf("%d\n", sum);
	return 0;
}


Measured memory_bytes: 2304
import sys
from math import ceil, floor, sqrt, sin, cos, pi
from itertools import accumulate, permutations, combinations
from fractions import gcd # 最大公約数
from collections import deque, Counter
from operator import itemgetter
from heapq import heappop,heappush
sys.setrecursionlimit(10**7)
def lcm(x, y): return ((x * y) // gcd(x, y)) # 最小公倍数
# list(map(int, input().split()))
# map(int, input().split())
# int(input())
# input().split()
# mojiretu = ','.join(str_list)
# sorted(input())

n = int(input())
now = 0
s = {}
for _ in range(n):
    a, b = map(int, input().split())
    if b in s:
        s[b] = s[b] + a
    else:
        s[b] = a
s = sorted(s.items())
for x in s:
    now += x[1]
    if now > x[0]:
        print('No')
        sys.exit()
print('Yes')

Measured memory_bytes: 43596
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
from bisect import bisect

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N, K = MAP()

ans = 0
for i in range(1, N+1):
	p = N//i
	r = N%i

	ans += p * max(0, i-K) + max(0, r-K+1)

if K == 0:
	ans -= N
print(ans)


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

#define int         long long
#define uint        unsigned int
#define ld          long double
#define showoff     ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pb          push_back
#define pii         pair<int,int>
#define FOR(i,a,b)  for(int i=a;i<b;++i)
#define RFOR(i,a,b) for(int i=a;i>b;--i)
#define f           first
#define se          second
#define maxn        200005
#define all(v)      v.begin(),v.end()
#define sz(x)       (int)x.size()
#define mod         1000000007
#define pqueue      priority_queue<int>
#define pdqueue     priority_queue< int,vector<int> ,greater< int >>

using namespace std;


//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());


int power(int a,int n)
{
    if(n == 1)return a;
    if(n == 0)return 1;
    if(n%2)return a*power(a*a,n/2);
    return power(a*a,n/2);
}
//const int md = 998244353;
//const int inf = (int) 1e18;

/*int inverse(int x){

    return power(x,mod-2)%mod;//little fermat....
}*/

int dp[20000];

signed main()
{
    showoff;
    int a,b,t;
    cin >> a >> b >> t;
    cout <<  (t/a)*b << "\n";
    return 0;
}
//*->for large size of matrix take int not long long if possible......
//*->always take maximum as inf for safer side ...    

Measured memory_bytes: 256
using System;
using static System.Console;
using static System.Math;

namespace Main
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] nums = ReadLine().Split(' ');
            int N = int.Parse(nums[0]);
            int M = int.Parse(nums[1]);
            WriteLine(N * (N - 1) / 2 + M * (M - 1)/2);
        }
    }
}

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

using namespace std;

typedef long long LL;
#define N 6000

const LL mod=998244353;
LL n,m,ans,fac[N],ifac[N];

LL inv(LL x){return x==1?1:(mod-mod/x)*inv(mod%x)%mod;}

void upd(LL &x,LL y){x=(x+y)%mod;}

LL C(LL x,LL y){
	return x<y||y<0?0:fac[x]*ifac[y]%mod*ifac[x-y]%mod;
}

int main(){
	scanf("%lld%lld",&n,&m);
	fac[0]=1; for (LL i=1;i<=n;++i) fac[i]=fac[i-1]*i%mod;
	ifac[n]=inv(fac[n]); for (LL i=n-1;~i;--i) ifac[i]=ifac[i+1]*(i+1)%mod;
	for (LL i=0;i<=n;++i){
		LL tmp=0;
		for (LL j=0;j<=m-1&&j<=i;++j)
			if (j*2>=m-1){
				LL k=i-j;
				if (i>=k){
					LL t=j-k,w=m-1-j-k;
					if (t<0){
						if (j*2==m-1) upd(tmp,1);
					}
					else upd(tmp,C(t,w));
				}
			}
		for (LL j=0;j<m-1;++j) upd(tmp,C(i,j-i));
		upd(ans,tmp*C(n,i));
	}
	printf("%lld\n",ans);
	
	return 0;
}
			

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>

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 namespace std;
#define int long long
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repr(i,n) for(ll i=n;i>=0;i--)
#define P pair<ll, ll>
#define sz(x) (ll)x.size()
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define VE vector<ll>
#define COUT(x) cout<<(x)<<endl
#define MA map<ll,ll>
#define SE set<ll>
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,VE,greater<ll>>
#define COUT(x) cout<<(x)<<endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define EPS (1e-10)


const long long MOD = 1000000007;
//const long long MOD = 998244353;
const long long INF = 1LL << 60;


long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	unsigned r;
	while ((r = a % b)) {
		a = b;
		b = r;
	}
	return b;
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a * g / b;
}
bool prime(ll n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}




const long double PI = 3.14159265359;
const int MAX_N = 100010;



signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n, k; cin >> n >> k;
	VE a(n); rep(i, n)cin >> a[i];
	int ans = INF;
	rep(i, n - k + 1) {
		int tmp = a[i + k - 1] - a[i];
		if (a[i + k - 1] > 0 && a[i] > 0) {
			tmp += a[i];
		}
		else if (a[i + k - 1] < 0 && a[i] < 0) {
			tmp += abs(a[i + k - 1]);
		}
		else {
			tmp += min(abs(a[i]), abs(a[i + k - 1]));
		}
		chmin(ans, tmp);

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

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

using namespace std;

#define REP(i, N) for (int i = 0; i < (int)N; i++)
#define RREP(i, N) for (int i =(int)N-1; i >= 0; i--)
#define FOR(i, a, b) for (int i = a; i < (int)b; i++)
#define ALL(x) (x).begin(), (x).end()
#define INF (1 << 30)
#define LLINF (1LL << 62)
#define DEBUG(...) debug(__LINE__, ":" __VA_ARGS__)

typedef long long ll;
typedef pair<int, int> Pii;
typedef pair<ll, ll> Pll;
typedef pair<string,int>Psi;

int main(){
  int n,q;
  string s;
  cin>>n>>q>>s;
  int v[n+1];
  memset(v,0,sizeof(v));
  REP(i,n-1){
    if(s[i]=='A'&&s[i+1]=='C'){
      s[i]='a';
      v[i+1]=v[i]+1;
    }else{
      v[i+1]=v[i];
    }
  }
  v[n]=v[n-1];
  REP(i,q){
    int r,l;
    cin>>l>>r;
    cout<<v[r-1]-v[l-1]<<endl;
  }
}


Measured memory_bytes: 1408
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

long long int Gauss_a_div_b_loop(long long int a, long long int b);
long long int Sigma_A_pow_B(long long int a, long long int n);

int main(void){
    long long int h;
    long long int a, n, i;

    scanf("%lld",&h);
    a = Gauss_a_div_b_loop(h,2);

    if(a!=1){
        a = Sigma_A_pow_B(2, a-1) + 1;
    }

    printf("%lld",a);
    return 0;
}

long long int Gauss_a_div_b_loop(long long int a, long long int b){
    long long int i;
    i = 1;

    while(a!=1){
        a = a/b;
        i += 1;
    }

    return i;
}

long long int Sigma_A_pow_B(long long int a, long long int n){
    //this function can use when a != 1
    //sigma : n = 1 to n = n
    long long int S;

    S = (pow(a, n+1) -a)/(a-1);

    return S;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
//型に気を付けよう
//a=0x61=97
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long  ll;
typedef long double  ld;
typedef pair<int,int> pairii;
typedef vector<int> veci;
const double pi=3.1415926535;
const ll  mod=1000000007;
//桁数指定　cout << fixed << setprecision(2)
int is_prime(int n){
  int ret=(n!=1);
  for(int i=2;i*i<=n+1;i++){
    if(!(n%i))ret=0;
    }
  return ret;
}
int main() {
  int x;
  cin>>x;
  while(!(is_prime(x)))x++;
  cout<<x;        
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<cstdio>

#define MAX_V 210
#define INF (1<<29)

using namespace std;

const double EPS=1e-10;

struct edge{int to,cap,rev;};

vector<edge> G[MAX_V];
bool used[MAX_V];

void add_edge(int from,int to,double cap){
  G[from].push_back((edge){to,cap,G[to].size()});
  G[to].push_back((edge){from,0,G[from].size()-1});
}

int dfs(int v,int t,int f){
  if(v==t)return f;
  used[v]=true;
  for(int i=0;i<G[v].size();i++){
    edge &e=G[v][i];
    if(!used[e.to] && e.cap>0){
      int d=dfs(e.to,t,min(f,e.cap));
      if(d>0){
        e.cap-=d;
        G[e.to][e.rev].cap+=d;
        return d;
      }
    }
  }
  return 0;
}

vector<double>cost[MAX_V];
int n,m;

int max_flow(double lim){

  for(int i=0;i<MAX_V;i++)G[i].clear();

  int s=n+m,t=n+m+1;
  for(int i=0;i<n;i++)add_edge(s,i,1);
  for(int i=0;i<m;i++)add_edge(i+n,t,1);

  for(int i=0;i<n;i++){
    for(int j=0;j<m;j++){
      if(cost[i][j]<lim+EPS){
        add_edge(i,j+n,1);
      }
    }
  }

  int flow=0;
  for(;;){
    fill(used,used+MAX_V,false);
    int f=dfs(s,t,INF);
    if(f==0)return flow;
    flow+=f;
  }
}

double dist(double x1,double y1,double x2,double y2){
  return sqrt(pow(x1-x2,2)+pow(y1-y2,2));
}
int main(void){

  while(cin >> n >> m,n|m){
    vector<double>nx(n),ny(n),nv(n),mx(m),my(m);

    for(int i=0;i<n;i++)
      cin >> nx[i] >> ny[i] >> nv[i];

    for(int i=0;i<m;i++)
      cin >> mx[i] >> my[i];

    for(int i=0;i<n;i++){
      cost[i].resize(m);
      for(int j=0;j<m;j++){
        cost[i][j]=dist(nx[i],ny[i],mx[j],my[j])/nv[i];
      }
    }

    double l=0,r=1e8;

    for(int i=0;i<1000;i++){
      double mid=(l+r)/2;
      int res=max_flow(mid);
      if(res==m)r=mid;
      else l=mid;
    }

    printf("%.8f\n",r);
  }

  return 0;
}

Measured memory_bytes: 1680
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include <limits>
#include <iomanip>

using namespace std;

int main(){
	int a,b;	
	
	cin >> a >> b;
	int temp=b-a+1;
	
	for(int i=0;i<(a-1)*2+1;i++){
		if( temp >= -1000000  && 1000000 >= temp){
			cout << temp << ' ';
		}
		temp++;
	}
	
	cout << endl;
	
	return 0;
}


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

int main()
{       
        
        int H, W, r, c;
        cin >> H >> W;
        while((H!=0) || (W!=0)){
                for(r = 0; r < H; r++) {
                        for(c = 0; c<W; c++) {
                                if((r+c)%2==0)
                                        cout<<"#";
                                else 
                                        cout<<".";
                        }
                        cout<<endl;
                }
                cout<<"\n";
                cin >> H >> W;
        }
}



Measured memory_bytes: 3104
#include <stdio.h>

int main(int argc, const char * argv[]) {
    int n, b, f, r, v;
    int c[4][3][10]={0};
    int i, j, k;
    
    scanf("%d", &n);
    
    for(i=0; i<n; i++){
        scanf("%d %d %d %d", &b, &f, &r, &v);
        c[b-1][f-1][r-1] += v;
    }
    
    for(i=0; i<4; i++){
        for(j=0; j<3; j++){
            for(k=0; k<10; k++){
                printf(" %d", c[i][j][k]);
            }printf("\n");
        }if(i<3){
            printf("####################\n");
        }
    }
    return 0;
}


Measured memory_bytes: 2036
#include<stdio.h>
#include<stdlib.h>
#define N 2000

int n,A[N];

int solve(int,int);


int main(){
  int m,q,i;

  while(1){
    scanf("%d",&n);
    if(n<=20) break;
  }
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
      }
  scanf("%d",&q);
  for(i=0;i<q;i++){
    scanf("%d",&m);
    if(m<1||m>2000) exit(2);
    if(solve(0,m)==1) printf("yes\n");
    else printf("no\n");
  }
  return 0;
}


int solve(int x,int m ){
  int res;
 
  if(m==0) return 1;
  if(x>=n) return 0;
 
  res = solve(x+1,m) || solve(x+1,m - A[x]);

  return res;
 
}



Measured memory_bytes: 2108
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int a[200];
	memset(a,0,sizeof(a));
	int n;
	cin>>n;
	while(n--)
	{
		int x;
		cin>>x;
		a[x]=1;
	}
	int ans=0;
	for(int i=0;i<200;i++)
		ans+=a[i];
	cout<<ans;
	return 0;
 } 

Measured memory_bytes: 256
import sys
import os
import math
import bisect
import collections
import itertools

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: x * y / math.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


def f(A, B, x):
    return math.floor(A * x / B) - A * math.floor(x / B)


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N = ii()
    A = collections.Counter(ii() for _ in range(N))

    print(sum(1 for v in A.values() if v % 2 != 0))


if __name__ == '__main__':
    main()


Measured memory_bytes: 15460
//#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4.1,sse4.2,avx,avx2,popcnt,tune=native")
//
//#include <immintrin.h>
//#include <emmintrin.h>

#include <bits/stdc++.h>
#pragma GCC optimize("O2")
#define vi vector<int>
#define pii pair<int, int >
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define LL long long
#define rep(i,a,n) for (int i=a;i<=n;i++)
#define per(i,a,n) for (int i=n;i>=a;i--)
#define all(x) (x).begin(), (x).end()
#define all2(x,n) (x+1), (x+1+n)
#define sz(x) ((int)(x).size())
#define mod(x) ((x)%MOD)
#define debug(x) cerr<<#x<<" : "<<x<<endl
#define mt make_tuple
#define eb emplace_back
#define o(X) (1<<(X))
#define oL(X) (1LL<<(X))
#define contain(S,X) (((S)&o(X))!=0)
#define containL(S,X) (((S)&oL(X))!=0)
#define ppt(x) __builtin_popcount(x)
using namespace std;
const int INF=0x3f3f3f3f,N=1e6+5,MOD=1e9+7;
const LL INF_LL=0x3f3f3f3f3f3f3f3fLL;
inline int getplc(int x,int y) { return (x>>y)&1; }
template<typename T>
T square(T x) {return x*x;}
LL qpow(LL a,LL b=MOD-2,LL _MOD=MOD){
  LL res=1;
  for(;b;b>>=1,a=a*a%_MOD){
    if(b&1)res=res*a%_MOD;
  }
  return res;
}
// Smax
//int Smax() { return -INF; }
template <typename T>
T Smax(T x) { return x; }
template<typename T, typename... Args>
T Smax(T a, Args... args) { return max(a, Smax(args...)); }
// Smin
template <typename T>
T Smin(T x) { return x; }
template<typename T, typename... Args>
T Smin(T a, Args... args) { return min(a, Smin(args...)); }
template <typename T>
// erro
#define errorl(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); errl(_it, args); }

void errl(istream_iterator<string> it) {}
template<typename T, typename... Args>
void errl(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << endl;
  errl(++it, args...);
}

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); cerr<<endl;}
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << "=" << a << " # ";
  err(++it, args...);
}
void Solve();
int main() {
#ifndef ONLINE_JUDGE
	freopen("in.txt","r",stdin);
//    freopen("o1.txt","w",stdout);
#endif
  ios::sync_with_stdio(false);cin.tie(0),cout.tie(0);
  Solve();
  return 0;
}

//////////////////////////////////////////////////////////////////


int a[N],b[N];
LL sum[N];
void Solve(){
  int n,m,k;
  cin>>n>>m>>k;
  rep(i,1,n)cin>>a[i];
  rep(i,1,m)cin>>b[i],sum[i]=b[i]+sum[i-1];
  LL cur=0;
  int ans=0;
  rep(i,0,n){
    cur+=a[i];
    if(cur>k)break;
    int tar=upper_bound(sum+1,sum+1+m,k-cur)-sum-1;
    ans=max(ans,i+tar);
  }
  cout<<ans<<endl;
}



Measured memory_bytes: 6744
#include <bits/stdc++.h>
#define rep(i, n) for(ll i = 0; i < n; i++)
#define repr(i, n) for(ll i = n; i >= 0; i--)
#define inf LLONG_MAX
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;


int main()
{
    ll n, k; cin >> n >> k;
    string s; cin >> s;
    s.insert(s.begin(), 'R');
    s.push_back('L');
    ll cnt = 0;
    ll unhappy = 0;
    for (int i = 1; i < n + 2; i++) {
        if (s[i] == 'L' && s[i-1] == 'R') {
            cnt++;
            if (i == 1 || i == n + 1) {
                unhappy++;
            } else {
                unhappy += 2;
            }
        }
    }
    if (cnt == 1) {
        cout << n - 1 << endl;
        return 0;
    }
    cout << min(n - 1, n - unhappy + 2 * (min(cnt - 1, k))) << endl;
    return 0;
}

Measured memory_bytes: 512
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()

from math import log10

def f(x):
    s=sum(int(c) for c in str(x))
    return x/s

def next(x):
    d=int(log10(x))
    A=list(str(x))
    res=-1
    score=INF
    for i in range(d,-1,-1):
        A[i]='9'
        tmp=int(''.join(A))
        if(score>f(tmp)):
            score=f(tmp)
            res=tmp
    return res

def resolve():
    k=int(input())
    if(k<10):
        for i in range(1,k+1):
            print(i)
        return
    for i in range(1,10):
        print(i)
    k-=9
    now=9
    for _ in range(k):
        now=next(now+1)
        print(now)
resolve()

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

using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<string> vs;
using pll = pair<ll, ll>;
using vl = vector<ll>;
using vll = vector<vl>;
using vpll = vector<pll>;
struct Edge {
	ll to;
 	ll cost;
 };
using Graph = vector<vector<Edge>>;

#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define ALL(a) (a).begin(), (a).end()
/***** define constant start *******/
const ll MOD = 1000000007;
const double PI = 2.0 * asin(1.0);
const ll INF = LLONG_MAX;
string abc = "abcdefghijklmnopqrstuvwxyz";
string ABC = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const ll MAX = 10000000;
/****** define constant end ********/
/****** define variable start ******/
ll n, m;
vl a, b;
vector<ll> sign;
/******* define variable end *******/
vector<bool> seen;
int solve() {
	cin >> n >> m;
	a.resize(m);
	b.resize(m);
	sign.resize(n);
	seen.resize(n);
	REP(i, n){
		sign[i] = INF;
	}
	vector<vector<ll>> G(n);
	REP(i, m){
		cin >> a[i] >> b[i];
		G[a[i]-1].push_back(b[i]-1);
		G[b[i]-1].push_back(a[i]-1);
	}

    // BFS のためのデータ構造
    vector<int> dist(n, -1); // 全頂点を「未訪問」に初期化
    queue<int> que;

    // 初期条件 (頂点 0 を初期ノードとする)
    dist[0] = 0;
    que.push(0); // 0 を橙色頂点にする

    // BFS 開始 (キューが空になるまで探索を行う)
    while (!que.empty()) {
        int v = que.front(); // キューから先頭頂点を取り出す
        que.pop();

        // v から辿れる頂点をすべて調べる
        for (int nv : G[v]) {
            if (dist[nv] != -1) continue; // すでに発見済みの頂点は探索しない

            // 新たな白色頂点 nv について距離情報を更新してキューに追加する
            dist[nv] = dist[v] + 1;
            sign[nv] = v;
            que.push(nv);
        }
    }

	bool flag = true;
	REP(i, n){
		if(dist[i] == -1){
			flag = false;
		}
	}
	if(flag){
		cout << "Yes" << endl;
		for(ll i = 1; i < n; i++){
			cout << sign[i] + 1<< endl;
		}
	}else{
		cout << "No" << endl;
	}
	return 0;
}

int main() {
	//clock_t start = clock();
	cout << std::fixed << std::setprecision(10);
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int end_solve = solve();
	/*
	clock_t end = clock();
	const double time = static_cast<double>(end - start) / CLOCKS_PER_SEC *
	1000.0; printf("time %lf[ms]\n", time);
	*/

	return end_solve;
}

Measured memory_bytes: 16308
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const int inf = 1001001001;
vector<int> dx = {1,0,-1,0};
vector<int> dy = {0,1, 0,-1};

int main(){
    int n,m;
    cin >> n >> m;
    vector<int> box(n,1), box_red(n,0);
    box_red.at(0) = 1;
    
    rep(i,m) {
        int x,y;
        cin >> x >> y;
        x--; y--;
        box.at(x)--;
        box.at(y)++;
        if(box_red.at(x) == 1) box_red.at(y) = 1;
        if(box.at(x) == 0) box_red.at(x) = 0;
    }
    
    int ans = 0;
    rep(i,n) {
        ans += box_red.at(i);
        //cout << box_red.at(i) << endl;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3988
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cassert>
#include <vector>
#include <string>
#include <cmath>
#include <map> 
#include <sstream>
#include <cstdio>
using namespace std;
  
const int MAX= 10000100;
 
#define loop(i,a,b) for(int i = a ; i < b ; i ++)
#define rep(i,a) loop(i,0,a)
#define all(a) (a).begin(),(a).end()
#define ll long long int
#define gcd(a,b) __gcd(a,b)
#define pb(a) push_back(a)
int GCD(int a, int b) {if(!b) return a; return gcd(b, a%b);}
int lcm(int a, int b) {return a*b / gcd(a, b);}
 
int n;
ll dp[101][21];
 
int main(void){
  int a;
  cin>>n;
  cin>>a;
  dp[0][a] ++;
 
  for(int i = 1 ; i < n - 1 ; i ++){
    cin>>a;
    for(int j = 0 ; j <= 20 ; j ++){
      if( j - a >= 0){
    dp[i][j-a] += dp[i-1][j];
      }
      if( j + a <= 20){
    dp[i][j+a] += dp[i-1][j];
      }
    }
  }
  cin>>a;
  cout<<dp[n-2][a]<<endl;
 
}

Measured memory_bytes: 1172
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxx = 1e5 + 7;
const int Inf = 1 << 30;
int a[maxx], b[maxx], c[maxx];
ll mp[maxx];
ll sumbk[maxx];
int n;
ll ans;

int main() {
	scanf("%d", &n);
	for(int i = 1; i <= n; i++) scanf("%d", &a[i]);
	for(int i = 1; i <= n; i++) scanf("%d", &b[i]);
	for(int i = 1; i <= n; i++) scanf("%d", &c[i]);
	sort(a + 1, a + n + 1);
	sort(b + 1, b + n + 1);
	sort(c + 1, c + n + 1);
	b[n + 1] = Inf, c[n + 1] = Inf;
	for(int i = 1; i <= n; i++) {
		mp[i] = n - (upper_bound(c + 1, c + n + 1, b[i]) - c) + 1;
	}
	sumbk[n + 1] = 0;
	for(int i = n; i >= 1; i--) {
		sumbk[i] = sumbk[i + 1] + mp[i];
	}
	for(int i = 1; i <= n; i++) {
		int pos = upper_bound(b + 1, b + n + 1, a[i]) - b;
		ans += sumbk[pos];
	}
	printf("%lld\n", ans);
}

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

using namespace std;

#define endl "\n"
#define lln long long int
#define IOS ios::sync_with_stdio(0);cin.tie(0);

int main(){
    IOS;

    int n;
    cin >> n;
    vector<int> a(n);
    for(int i=0;i<n;i++) cin >> a[i];
    lln ans = 0;
    for(int i=1;i<n;i++){
        if(a[i] < a[i-1]){
            ans = ans + a[i-1] - a[i];
            a[i] = a[i-1];
        }
    }
    cout << ans << endl;
    return 0;    
}


Measured memory_bytes: 3988
program prob26
    implicit none
    integer :: a,b
    read(*,*) a,b
    if(a <= 5) then
        write(*,*) "0"
    else if( a<= 12) then
        write(*,*) b/2
    else
        write(*,*) b
    end if


    stop
contains
end program prob26

Measured memory_bytes: 2796
#include <iostream>
#include <string>
#include <cctype>
#include <cassert>

using namespace std;

string S;
size_t cur = 0;

char readchar();
char peek();
int digit();
int number();
int expression();
int parse();

int main() {
	int count;
	cin >> count;
	for(int i=0;i<count;i++) {
		cur = 0;
		
		cin >> S;
		//cout << S << endl;
		S.resize(S.size()-1);
		int a = parse();
		cout << a << endl;
	}
	

}


// 1 ??????????????§ cur ????????????
// ??????:?¬???? readchar ??§???????¬???????????????????
char readchar() {
	assert(cur < S.size());
	char ret = S[cur];
	cur += 1;
	return ret;
// return S[cur++]; ??¨????????§???????????¨?????§??????
}
char peek() { // 1 ??????????????? cur ???????????????
	//assert(cur < S.size());
	return S[cur];
}

int digit() {
	assert(isdigit(peek())); // S[cur] ?????°?????§???????????¨????¢????
	int n = readchar() - '0'; // ???0??? ??? 0 ?????????
	return n;
}
int number() {
	int n = digit();
	while (cur < S.size() && isdigit(peek())) // ?¬??????°?????? 1 ????????????
	n = n*10 + digit();
	return n;
}
int expression();

int factor() {
	if (peek() != '(') return number();
	cur += 1;
	int n = expression();
	assert(peek() == ')');
	cur += 1;
	return n;
}

int term() {
	int a = factor();
	while (cur < S.size() && (peek() == '*' || peek() == '/')) {
		char op = readchar();
		int b = factor();
		if (op == '*') a *= b; else a /= b;
	}
	return a;
}

int expression() {
	int a = term();
	while(cur < S.size() && (peek() == '+' || peek() == '-')) {
		char op = readchar();
		int b = term();
		assert((op == '+') || (op == '-'));
		if(op == '+') {
			a+=b;
		} else {
			a-=b;
		}
	}
	return a;
}

int parse() {
	return expression();
}

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

const ll INF = 1ll << 60;

int main(int argc, char **argv)
{
	ll n, k;
	cin >> n >> k;
	vector<ll> h(n);
	for (ll i = 0; i < n; ++i) cin >> h[i];
	sort(h.begin(), h.end());
	
	ll res{INF};
	for (ll i = 0; i < n-k+1; ++i) res = min(res, h[i+k-1] - h[i]);
	std::cout << res << std::endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
struct Fast { Fast() { cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20);} } fast;

int main(){
    int n, k , min = 1000000;
    cin >> n >> k;
    vector<int>dp(n + 1, 1e9);
    vector<int>hs(n + 1);
    for (int i = 1; i < n + 1; i++){
        cin >> hs[i];
    }
    dp[1] = 0;
    for (int i = 2; i < n + 1; i++){
        for (int j = 1; j < k + 1; j++){
            if(i - j > 0){
                if(dp[i] > dp[i - j] + abs(hs[i] - hs[i - j])){
                    dp[i] = dp[i - j] + abs(hs[i] - hs[i - j]);
                }
            }   
        }
    }
    // for (int i = 1; i <= n; i++){
    //     cout << dp[i] << endl;
    // }
    cout << dp[n] << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using pii = pair<int,int>;

int main() {
  int n,m;
  cin >> n >> m;
  vector<vector<int>> s(m);
  for(int i=0;i<m;i++){
    int k;
    cin >> k;
    s.at(i) = vector<int>(k);
    for(int j=0;j<k;j++){
      cin >> s.at(i).at(j);
    }
  }
  vector<int> p(m);
  for(int i=0;i<m;i++){
    cin >> p.at(i);
  }
  int count = 0;
  for(int i=0;i<(1 << n);i++){
    bitset<10> b(i);
    bool flag = true;
    for(int j=0;j<m;j++){
      int count1 = 0;
      for(auto a:s.at(j)){
        if(b.test(a-1)){
          count1++;
        }
      }
      if(count1 %2 != p.at(j)){
        flag = false;
        break;
      }
    }
    if(flag){
      count++;
    }
  }
  cout << count << endl;
}

Measured memory_bytes: 3592
#include<iostream>
using namespace std;
int main()
{
  string str;
  cin>>str;
  int st=str.size();
  int n=st-1;
  st=st/2-1;
  int ans=0;
  for(int i=0;i<=st;i++){
    if(str[i]!=str[n-i])
      ++ans;
  }
  cout<<ans<<endl;
  
  return 0;
}

Measured memory_bytes: 256
import Control.Monad

-- 最小公倍数
lcm' a b = head [ x | let c = max a b, x <- [c,c+1..], mod x a == 0 && mod x b ==0]

main = do
  line <- readLn
  args <- replicateM line readLn
  print $ solve args

solve :: [Int] -> Int
solve args = foldr lcm 1 args

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

#define F first
#define S second
#define PB push_back

using namespace std;

typedef long long ll;

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

	int n;
	cin >> n;

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

	int cost[n];
	cost[0] = 0;
	cost[1] = abs(h[0] - h[1]);

	for(int i = 2; i < n; i++){
		cost[i] = min(cost[i-1] + abs(h[i] - h[i-1]), cost[i-2] + abs(h[i] - h[i-2]));
	}

	cout << cost[n-1] << "\n";

	return 0;
}

Measured memory_bytes: 1024
import java.util.Scanner;


public class Main {
    public static void main(String main[]) {
        //input should be grater than 2
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] arr = getIntArrayInput(n, sc);
        int[] dp = new int[n];

        int max = 0;
        for (int i = n - 2; i >= 0; i--) {
            int curr = arr[i];
            if (curr >= arr[i + 1]) {
                dp[i] = dp[i + 1] + 1;
                max = Math.max(dp[i], max);
            }

        }

        System.out.println((max - 1) > 0 ? max : 0);
    }


    static int[] getIntArrayInput(int length, Scanner scn) {
        int[] arr = new int[length];
        for (int i = 0; i < length; i++) {
            arr[i] = scn.nextInt();
        }
        return arr;
    }


}

Measured memory_bytes: 49984