akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

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

  int num = N%10;

  string ans = "hon";
  if(num==3) ans = "bon";
  if(num==0) ans = "pon";
  if(num==1) ans = "pon";
  if(num==6) ans = "pon";
  if(num==8) ans = "pon";

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

Measured memory_bytes: 3588
H,W,N = [ int(it) for it in input().split() ]

di = set()

for i in range(N):
  di.add( tuple( int(it) for it in input().split() ) )

po = set()
for a,b in di:
  for da in [-1,0,1]:
    for db in [-1,0,1]:
      if (1<=a+da and a+da<=H and 1<=b+db and b+db<=W):
        po.add( (a+da,b+db) )

li = [0]*10
for a,b in po:
  k = 0
  if ( a == 1 or a == H or b == 1 or b == W ):
    continue
  for da in [-1,0,1]:
    for db in [-1,0,1]:
      if ( (a+da,b+db) in di ):
        k+=1
  li[k]+=1
li[0] += (H-2)*(W-2) - sum(li)      
      
for i in range(10):
  print ( li[i] )

Measured memory_bytes: 126200
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;

import java.util.*;

public class Main {
    long MOD = (long) 1e9 + 7;

    InputStream in;
    OutputStream out;

    public Main() {
        this(System.in, System.out);
    }

    public Main(InputStream in, OutputStream out) {
        this.in = in;
        this.out = out;
    }

    int n;
    Edge[] g;

    void run() {
        Scanner sc = new Scanner(this.in);
        PrintWriter out = new PrintWriter(this.out);

        // write your code
        n = sc.nextInt();
        g = new Edge[n];

        for (int i = 0; i < n; i++) {
            g[i] = new Edge();
        }

        for (int i = 0; i < n - 1; i++) {
            int a = sc.nextInt() - 1, b = sc.nextInt() - 1;
            g[a].add(b);
            g[b].add(a);
        }

        LinkedList<P> q = new LinkedList<>();
        int b = 0, w = 0;
        q.addLast(new P(0, 0));
        q.addLast(new P(n - 1, 1));
        boolean[] visited = new boolean[n];
        while (!q.isEmpty()) {
            P cur = q.removeFirst();
            if (visited[cur.p]) continue;
            if (cur.c == 0) {
                b++;
            } else {
                w++;
            }
            visited[cur.p] = true;

            for (int next : g[cur.p]) {
                q.addLast(new P(next, cur.c));
            }
        }

        debug(b, w);

        out.println(w < b ? "Fennec" : "Snuke");

        out.flush();
    }

    class P {
        int c, p;
        P(int p, int c) {
            this.p = p;
            this.c = c;
        }
    }

    class Edge extends ArrayList<Integer> {}

    void debug(Object... os) {
        System.err.println(Arrays.deepToString(os));
    }

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

Measured memory_bytes: 104024
#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <bitset>
#include <iomanip>
#include <deque>
#include <tuple>
#include <algorithm>

using namespace std;

int c[110], a[110][110];
int n, m, x;
long long int ans = 1000000100;

void bitfullsearch(int n) {
    for (int bit = 0; bit < (1<<n); bit++) {
        vector<int> s;
        long long int algo[110] = {};
        int cnt = 0;
        long long int sum = 0;

        for (int i = 0; i < n; i++) {
            if (bit & (1<<i)) {
                s.push_back(i);
            }
        }

        for (int i = 0; i < (int)s.size(); i++) { //bitが表す集合を出力
            for (int j = 0; j < m; j++) {
                algo[j] += a[s[i]][j];
            }
            
        }

        for (int i = 0; i < m; i++) {
            if (algo[i] >= x) {
                cnt++;
            }
        }

        if (cnt == m) {
            for (int i = 0; i < (int)s.size(); i++) {
                sum += c[s[i]];
            }
        }

        if (sum != 0 && ans > sum) {
            ans = sum;
        }
    }
}

int main()
{

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

    bitfullsearch(n);

    cout << (ans == 1000000100 ? -1 : ans) << endl;
}



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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

int H,W;
char fld[55][55];

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

int dist[26];
const int INF=1001001001;
signed main(){
    char a,b;
    cin>>H>>W>>a>>b;


    int s=a-'A';
    int t=b-'A';

    rep(i,H)cin>>fld[i];


    rep(i,H)rep(j,W){
        if(!isupper(fld[i][j]))continue;
        rep(d,4){
            int y=i,x=j;
            while(true){
                y+=dy[d];
                x+=dx[d];
                if(y<0||y>=H||x<0||x>=W)break;
                if(fld[y][x]=='.')break;
                if(isupper(fld[y][x])){
                    G[fld[i][j]-'A'].pb(fld[y][x]-'A');
                    break;
                }
                if(d%2&&fld[y][x]=='|')break;
                if(d%2==0&&fld[y][x]=='-')break;
            }
        }
    }


    fill_n(dist,26,INF);
    dist[s]=0;
    queue<int>que;
    que.push(s);
    while(que.size()){
        int v=que.front();
        que.pop();
        for(auto u:G[v]){
            if(dist[u]!=INF)continue;
            dist[u]=dist[v]+1;
            que.push(u);
        }
    }
    cout<<dist[t]<<endl;
    return 0;
}



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

#define ll long long
#define vi vector<int>
#define vl vector<ll>
#define pii pair<int,int>
#define pll pair<ll,ll>
// pll pp; -> (pp.first,pp.second)
// vector<vl> pp(n,vl(2)); sort(pp.begin(),pp.end(),[](vl a,vl b){return a[0]<b[0];});

#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define RREP(i,n) for(ll (i)=(n)-1;(i)>=0;(i)--)
#define DEBUG(x) cout << #x << ": " << x << endl
#define CHMAX(a,b) a=max((a),(b))
#define CHMIN(a,b) a=min((a),(b))
/*}}}*/
int main() {
  ll n;
  cin >> n;
  vector<string> s(n);
  ll ans = 0;
  ll ca = 0,cb = 0,cc = 0;
  REP(i,n) {
    cin >> s[i];
    REP(j,s[i].length()-1){
      if(s[i][j]=='A'&&s[i][j+1]=='B') ans++;
    }
    if(s[i][0]=='B') cb++;
    if(s[i][s[i].length()-1]=='A') ca++;
    if(s[i][0]=='B' && s[i][s[i].length()-1]=='A'){
      ca --;
      cb --;
      cc ++;
    }
  }
  if(cc>0){
    if(ca>0 && cb>0){
      ans += cc+1;
      ca --;
      cb --;
    }
    if(ca>0 && cb==0){
      ans += cc;
    }
    if(ca==0 && cb>0){
      ans += cc;
    }
    if(ca==0 && cb==0){
      ans += cc-1;
    }
  }
  ans += min(ca,cb);
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 768
#!/usr/bin/env python3
# n,m = map(int,sys.stdin.readline().split())
# a = list(map(int,sys.stdin.readline().split()))
# a = [sys.stdin.readline() for _ in range(n)]
# s = sys.stdin.readline().rstrip()
# n = int(sys.stdin.readline())
import sys,bisect,math,itertools
sys.setrecursionlimit(15000)

N,M,Q = map(int,sys.stdin.readline().split())
qs = [list(map(int,sys.stdin.readline().split())) for _ in range(Q)]
com = list(itertools.combinations_with_replacement(range(1,M+1), N))
m = 0
#print(qs)
#print(com)
for A in com:
    s = 0
    for a,b,c,d in qs:
        if A[b-1] - A[a-1] == c:
            s += d
    m = max(m,s)
print(m)

Measured memory_bytes: 85124
import java.util.*;

public class Main {
	public static void main(String[] args) {  
  		Scanner sc = new Scanner(System.in);
      	String s = sc.next();
      	String[] ary = s.split("", 0);
      	int count = 0;
      
      	for(int i = 0; i < ary.length; i++) {
        	if(ary[i].equals("1")) count++;  
        }
      	System.out.println(count);
    }
}

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

#define mod 1000000007

using namespace std;
 
int main(void){
	
	char S[4];
	
	cin >> S[0] >> S[1] >> S[2] >> S[3];
	
	sort(S, S+4);
	
	if(S[0] == S[1] && S[2] == S[3] && S[0] != S[2]){
		cout << "Yes";
		return 0;
	}
	
	cout << "No";
	
	return 0;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var coin_500 int
	var coin_100 int
	var coin_50 int
	var amount int

	fmt.Scanf("%d", &coin_500)
	fmt.Scanf("%d", &coin_100)
	fmt.Scanf("%d", &coin_50)
	fmt.Scanf("%d", &amount)

	var counter int
	for i := 0; i <= coin_500; i++ {
		for j := 0; j <= coin_100; j++ {
			for k := 0; k <= coin_50; k++ {
				result := 500*i + 100*j + 50*k
				if result == amount { counter++ }
			}
		}
	}
	fmt.Printf("%d\n", counter)
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
//#include<bits/extc++.h>
//using namespace __gnu_pbds;
using namespace std;
#define F(i,L,R) for (int i = L; i < R; i++)
#define FE(i,L,R) for (int i = L; i <= R; i++)
#define getI(a) scanf("%d", &a)
#define getII(a,b) scanf("%d%d", &a, &b)
#define getIII(a,b,c) scanf("%d%d%d", &a, &b, &c)
#define VgetI(n) int (n); scanf("%d",&(n))
#define VgetII(n,m) int (n),(m); scanf("%d %d",&(n),&(m))
#define VgetIII(n,m,k) int (n),(m),(k); scanf("%d %d %d",&(n),&(m),&(k))
#define pb push_back
#define pii pair<int,int>
#define ll long long
#define mp make_pair
#define INF 2000000000
#define PI 3.1415926535897932384626
const ll MOD=1e9+7;
int n,ans;
vector<pii> q[20];
int cond[20];
bool legal(){
	F(i,0,n) if(cond[i]){
	//	puts("HI");
		F(j,0,q[i].size()) if(q[i][j].second!=cond[q[i][j].first]) return 0;
	}
	return 1;
}
void dfs(int dep,int sum){
	if(dep==n){
//		F(i,0,n) printf("%d ",cond[i]);
//		puts("");
		if(sum>ans&&legal()) ans=sum;
		return;
	}
	cond[dep]=1;
	dfs(dep+1,sum+1);
	cond[dep]=0;
	dfs(dep+1,sum);
}
int main(){
	while(~getI(n)){
		F(i,0,n){
			VgetI(a);
			q[i].clear();
			while(a--){
				VgetII(x,y);
				q[i].pb(mp(x-1,y));
			}
		}
		/*F(i,0,n){
			printf("i:%d\n",i);
			F(j,0,q[i].size()) printf("%d %d\n",q[i][j].first,q[i][j].second);
			puts("---------------------------");
		}*/
//		cond[0]=cond[1]=cond[2]=1;
//		printf("ans:%d\n",legal());
		ans=0;
		dfs(0,0);
		printf("%d\n",ans);
	}
}



Measured memory_bytes: 256
import java.io.*;
import java.nio.CharBuffer;
import java.util.NoSuchElementException;

public class Main {

    public static void main(String[] args) {
        SimpleScanner scanner = new SimpleScanner(System.in);
        PrintWriter writer = new PrintWriter(System.out);

        int n = scanner.nextInt();
        boolean valid = true;
        int pre = -1;
        for (int i = 0; i < n; ++i) {
            int h = scanner.nextInt();
            if (h < pre) {
                valid = false;
                break;
            }
            if (h > pre)
                --h;
            pre = h;
        }
        writer.println(valid ? "Yes" : "No");
        writer.close();
    }

    private static class SimpleScanner {

        private static final int BUFFER_SIZE = 10240;

        private Readable in;
        private CharBuffer buffer;
        private boolean eof;

        SimpleScanner(InputStream in) {
            this.in = new BufferedReader(new InputStreamReader(in));
            buffer = CharBuffer.allocate(BUFFER_SIZE);
            buffer.limit(0);
            eof = false;
        }


        private char read() {
            if (!buffer.hasRemaining()) {
                buffer.clear();
                int n;
                try {
                    n = in.read(buffer);
                } catch (IOException e) {
                    n = -1;
                }
                if (n <= 0) {
                    eof = true;
                    return '\0';
                }
                buffer.flip();
            }
            return buffer.get();
        }

        void checkEof() {
            if (eof)
                throw new NoSuchElementException();
        }

        char nextChar() {
            checkEof();
            char b = read();
            checkEof();
            return b;
        }

        String next() {
            char b;
            do {
                b = read();
                checkEof();
            } while (Character.isWhitespace(b));
            StringBuilder sb = new StringBuilder();
            do {
                sb.append(b);
                b = read();
            } while (!eof && !Character.isWhitespace(b));
            return sb.toString();
        }

        int nextInt() {
            return Integer.valueOf(next());
        }

        long nextLong() {
            return Long.valueOf(next());
        }

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

Measured memory_bytes: 41156
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(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<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
const int mod = 1e9+7;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;

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; }

__attribute__ ((constructor))
void init() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << fixed << setprecision(10);
}

signed main(){
  int n;
  string s;
  cin >> n >> s;
  int cnt_r = 0;
  rep(i,int(s.size())){
    if(s[i] == 'R')
      cnt_r++;
  }
  int ans = 0;
  rep(i,cnt_r){
    if(s[i] == 'W')
      ans++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3752
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

using namespace __gnu_pbds;
using namespace std;

typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;

#define mp make_pair
#define pb push_back
#define pf push_front
#define ss second
#define ff first
#define sz(x) (int)x.size()
#define newl "\n"
#define vi vector<int>
#define pii pair<int, int>
#define vii vector<pii>
#define vl vector<ll>
#define pll pair<ll, ll>
#define vll vector<pll>
#define coutp cout << fixed << setprecision(12)
#define mem(x, val) memset(x, val, sizeof(x))
#define fastio                        \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
#define all(v) (v).begin(), (v).end()

const ld pi = 3.14159265359;
ll INF = 1e18 + 10;
ll MOD = 998244353;
ll mod = 1e9 + 7;

inline ll add(ll a, ll b, ll m)
{
    if ((a + b) >= m)
        return (a + b) % m;
    return a + b;
}

inline ll mul(ll a, ll b, ll m)
{
    if ((a * b) < m)
        return a * b;
    return (a * b) % m;
}

ll power(ll x, ll y, ll m)
{
    ll res = 1;
    x = x % m;
    if (x == 0)
        return 0;
    while (y > 0)
    {
        if (y & 1)
            res = (res * x) % m;
        y = y >> 1;
        x = (x * x) % m;
    }
    return res;
}

void solve()
{
    int n,k;
    cin>>n>>k;
    vl a(n),dp(n,INF);
    for(int i=0;i<n;i++) {
        cin>>a[i];
    }
    dp[0]=0;
    for(int i=1;i<n;i++) {
        for(int j=1;j<=k;j++) {
            if(i-j>=0) {
                dp[i] = min(dp[i], dp[i-j]+abs(a[i]-a[i-j]));
            }
        }
    }
    cout<<dp[n-1];
    
}

int main()
{
    fastio;
    int t;
    t = 1;
    //cin >> t;
    //int test=t;
    
    while (t-- > 0)
    {
        //cout<<"Case #"<<(test-t)<<": ";
        solve();
        cout << newl;
    }

    return 0;
}

Measured memory_bytes: 4752
#include <stdio.h>
int a[1010];

int main(){
	int n;
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		int t;
		scanf("%d",&t);
		if(a[t%(n-1)]){
			printf("%d %d\n",t,a[t%(n-1)]);
			return 0;
		}
		a[t%(n-1)]=t;
	}
}


Measured memory_bytes: 2144
# ABC075C - Bridge
# find the number of bridges in a given undirected connected graph
# bridge := an edge whose removal disconnects a graph
import sys
from copy import deepcopy

input = sys.stdin.readline
sys.setrecursionlimit(10 ** 9)


def dfs(v: int) -> None:
    seen[v] = 1  # make vertex v searched
    for u in g[v]:
        if not seen[u]:
            dfs(u)


def main():  # O(M(N + M))
    global g, seen
    N, M = tuple(map(int, input().split()))
    E = tuple(tuple(map(int, input().split())) for _ in range(M))
    G = [[] for _ in range(N + 1)]  # N+1: 1-idx
    for v, u in E:  # construct a undirected graph
        G[v] += [u]
        G[u] += [v]
    bridges = 0
    for v, u in E:
        g = deepcopy(G)  # subgraph of G except E(v, u)
        g[v].remove(u)
        g[u].remove(v)
        seen = [0] * (N + 1)
        dfs(1)  # search from vertex 1
        bridges += 1 if 0 in seen[1:] else 0
    print(bridges)


if __name__ == "__main__":
    main()

Measured memory_bytes: 3572
#include<stdio.h>

int main(){
	int n,k,d,a;
	int cnt[102];
	int result = 0;   
	scanf("%d %d", &n, &k);
	for (int i = 0; i < n; i++){
		cnt[i] = 0;
   }
	for (int i = 0; i < k; i++){
		scanf("%d", &d);
		for (int j = 0; j < d; j++){		
			scanf("%d", &a);
			cnt[a - 1]++;
		}
	}
	for (int i = 0; i < n; i++){
		if (cnt[i] == 0){
			result++;
      }
   }
	printf("%d\n", result);
   
	return 0;
}


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

using namespace std;

int main()
{
	int n;
	int i;
	int counter=0;
	int max=0;
	
	vector<int> a;
	int b;
	cin>>n;
	
	for(i=0;i<n;i++)
	{
		cin>>b;
		a.push_back(b);
	}	
		
	for(i=0;i<n;i++)
	{
		if(a[i]==1)
			counter++;
		else
		{
			if(max<counter)
				max=counter;
			counter=0;
		}
	}
	if(max<counter)
		max=counter;
		
		cout<<max+1<<endl;
}



Measured memory_bytes: 3172
#include <iostream>

using namespace std;

int main(void) {
	int n[20], s[20][100], sum[20], shift;
	int j = 0;
	while (1) {
		sum[j] = 0;
		cin >> n[j];
		if (n[j] == 0)
			break;

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

		// 昇順ソート
		for (int i = 0; i < n[j]; i++) {
			for (int t = i + 1; t < n[j]; t++) {
				if (s[j][i] > s[j][t]) {
					shift = s[j][i];
					s[j][i] = s[j][t];
					s[j][t] = shift;
				}
			}
		}
		for (int i = 1; i < n[j] - 1; i++) {
			sum[j] += s[j][i];
		}
		sum[j] = sum[j] / (n[j] - 2);
		cout <<  sum[j] << endl;
		j++;

	}
	return 0;
}



Measured memory_bytes: 2988
import math
#import numpy as np
import queue
from collections import deque,defaultdict
import heapq as hpq
from sys import stdin,setrecursionlimit
#from scipy.sparse.csgraph import dijkstra
#from scipy.sparse import csr_matrix
ipt = stdin.readline
setrecursionlimit(10**7)

def main():
    a,b,c = map(int,ipt().split())
    for i in range(10**18):
        if a%2 == 1 or b%2 == 1 or c%2 == 1:
            print(i)
            exit()
        elif a == b == c:
            print(-1)
            exit()
        pa = a
        pb = b
        pc = c
        a = (pb+pc)//2
        b = (pa+pc)//2
        c = (pa+pb)//2
    return

if __name__ == '__main__':
    main()


Measured memory_bytes: 38380
import math
x = int(input())

count = 0
buff = x
count = buff // 11
_buff = buff % 11
me = buff // 5.5
_fo = me / 2
_ba = me / 2
se = x - me * 5.5
if _buff >= 7:
    print(int(count*2+2))
    exit()
elif 7 >= se and se > 0:
    print(int(count*2+1))
    exit()
    
print(int(count*2))

Measured memory_bytes: 3064
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
using namespace std;
int a[15];

bool check(int n){
    while (n) {
        int x = n%10;
        if (a[x]) {
            return false;
        }
        n /= 10;
    }
    return true;
}

int main(int argc, const char * argv[]) {
    int n, k, d;
    scanf("%d%d", &n, &k);
    memset(a, 0, sizeof(a));
    for (int i = 0; i<k; i++) {
        scanf("%d", &d);
        a[d] = 1;
    }
    for (int i = n; ; i++) {
        if (check(i)) {
            printf("%d\n", i);
            break;
        }
    }
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long ans=0;
		int a=0;
		int b=0;
		int count=0;
		for(int i = 0; i<n; i++){
			boolean bb=false;
			boolean aa=false;
			String s = sc.next();
			for(int j=0; j<s.length(); j++){
				if(j==0){
					if(s.charAt(j)=='B'){
						b++;
						bb=true;
					}
				}
				if(j==s.length()-1){
					if(s.charAt(j)=='A'){
						a++;
						aa=true;
					}
					if(aa && bb){
						count++;
					}
					break;
				}
				if(s.charAt(j)=='A' && s.charAt(j+1)=='B'){
					ans++;
				}
			}
		}
		if(count==a && count==b && a>0){
			System.out.println(a-1+ans);
		}else{
		 	System.out.println(ans+Math.min(a,b));
		}
	}
}


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

using namespace std;

int main() {
    string input;
    int i, h, m, s;

    cin >> input;
    i = stoi(input);
    h = i / 3600;
    m = (i % 3600) / 60;
    s = floor(i % 60);
    cout << h << ':' << m << ':' << s << endl;
    return 0;
}


Measured memory_bytes: 3168
inf = 10**9+7
mod = 10**9+7
n,k = map(int, input().split())
a = [int(input()) for i in range(n)]
a.sort()
minh = inf
for i in range(n-k+1):
    minh = min(minh, a[i+k-1]-a[i])
print(minh)

Measured memory_bytes: 50264
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
typedef pair<int,int> P;
typedef pair<P,P> P2;

int dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
int d[1<<5][50][50][6],INF=1<<28,n,m,l;
bool check(int x, int y) {return x>=0&&x<n&&y>=0&&y<m;}

int main() {
  cin >> n >> m >> l;
  string s[n];
  for(int i=0; i<n; i++) cin >> s[i];
  int sx,sy,tx,ty;
  for(int i=0; i<n; i++) {
    for(int j=0; j<m; j++) {
      if(s[i][j]=='S') sx=i,sy=j;
      if(s[i][j]=='G') tx=i,ty=j;
      for(int t=0; t<(1<<5); t++) {
	for(int k=0; k<6; k++) d[t][i][j][k]=INF;
      }
    }
  }
  d[0][sx][sy][5]=0;
  int ans=-1;
  queue<P2> que;
  que.push(P2(P(sx,sy),P(5,0)));
  while(!que.empty()) {
    P2 p=que.front();que.pop();
    int nx=p.F.F,ny=p.F.S,k=p.S.F,t=p.S.S;
    if(nx==tx && ny==ty && k>=4) {
      ans=d[t][nx][ny][k];
      break;
    } 
    for(int i=0; i<4; i++) {
      int x,y,z,tt=t;
      if(!k) {
	if(!i) x=nx-l,y=ny,z=4;
	else if(i==1) x=nx,y=ny+1,z=0;
	else if(i==2) x=nx+1,y=ny,z=5;
	else x=nx,y=ny-1,z=0;
      } else if(k==1) {
	if(!i) x=nx-1,y=ny,z=1;
	else if(i==1) x=nx,y=ny+l,z=4;
	else if(i==2) x=nx+1,y=ny,z=1;
	else x=nx,y=ny-1,z=5;
      } else if(k==2) {
	if(!i) x=nx-1,y=ny,z=5;
	else if(i==1) x=nx,y=ny+1,z=2;
	else if(i==2) x=nx+l,y=ny,z=4;
	else x=nx,y=ny-1,z=2;
      } else if(k==3) {
	if(!i) x=nx-1,y=ny,z=3;
	else if(i==1) x=nx,y=ny+1,z=5;
	else if(i==2) x=nx+1,y=ny,z=3;
	else x=nx,y=ny-l,z=4;
      } else if(k==5) {
	if(!i) x=nx-1,y=ny,z=0;
	else if(i==1) x=nx,y=ny+1,z=1;
	else if(i==2) x=nx+1,y=ny,z=2;
	else x=nx,y=ny-1,z=3;
      } else if(k==4) {
	if(!i) x=nx-l,y=ny,z=2;
	else if(i==1) x=nx,y=ny+l,z=3;
	else if(i==2) x=nx+l,y=ny,z=0;
	else x=nx,y=ny-l,z=1;
      }
      if(z<4) {
	bool ck=1;
	for(int j=0; j<l; j++) {
	  int xx=x+dx[z]*j,yy=y+dy[z]*j;
	  if(!check(xx,yy) || s[xx][yy]=='#') {
	    ck=0;
	    break;
	  }
	  if(s[xx][yy]>='a' && s[xx][yy]<='e' && !(t&(1<<(s[xx][yy]-'a')))) ck=0;
	}
	if(!ck) continue;
      } else {
	if(!check(x,y)) continue;
	if(s[x][y]=='^' || s[x][y]=='#') continue;
	if(s[x][y]>='a' && s[x][y]<='e' && !(t&(1<<(s[x][y]-'a')))) continue;
	if(s[x][y]>='A' && s[x][y]<='E') tt=tt^(1<<(s[x][y]-'A'));
      }
      if(d[tt][x][y][z]<=d[t][nx][ny][k]+1) continue;
      d[tt][x][y][z]=d[t][nx][ny][k]+1;
      que.push(P2(P(x,y),P(z,tt)));
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 2324
#include<bits/stdc++.h>
using namespace std;
int h,w,v1[20],v2[20];
string s[20],c[20];
bool f;
void dfs2(int x,int r)
{
	if(f) return;
	if(x==w)
	{
		cout<<"YES";
		f=1;return;
	}
	else if(v2[x]!=-1) dfs2(x+1,r);
	else
	{
		for(int i=x+1;i<w;++i)
		{
			if(v2[i]!=-1) continue;
			bool ok=1;
			for(int j=0;j<h;++j)
			 if(s[v1[j]][i]!=s[j][x])
			  {ok=0;break;}
			if(ok)
			{
				v2[i]=x;v2[x]=i;
				dfs2(x+1,r);
				v2[i]=-1;v2[x]=-1;
			}
		}
		if(r)
		{
			bool ok=1;
			for(int j=0;j<h;++j)
			 if(s[v1[j]][x]!=s[j][x])
			  {ok=0;break;}
			if(ok)
			{
				v2[x]=x;
				dfs2(x+1,0);
				v2[x]=-1;
			}
		}
	}
}
void dfs1(int x,int r)
{
	if(x==h) dfs2(0,w%2);
	else if(v1[x]!=-1) dfs1(x+1,r);
	else
	{
		for(int i=x+1;i<h;++i)
		{
			if(v1[i]!=-1) continue;
			if(c[i]!=c[x]) continue;
			v1[i]=x;v1[x]=i;
			dfs1(x+1,r);
			v1[i]=-1;v1[x]=-1;
		}
		if(r)
		{
			v1[x]=x;
			dfs1(x+1,0);
			v1[x]=-1;
		}
	}
}
int main()
{
	cin>>h>>w;
	for(int i=0;i<h;++i)
	{
		cin>>s[i];c[i]=s[i];
		sort(c[i].begin(),c[i].end());
	}
	memset(v1,-1,sizeof(v1));
	memset(v2,-1,sizeof(v2));
	dfs1(0,h%2);
	if(!f) cout<<"NO";
	return 0;
}

Measured memory_bytes: 3616
S=input()
dp=[[0]*13 for i in range(len(S)+1)]
dp[0][0]=1
mod=10**9+7
for i in range(len(S)):
  if(S[i]=='?'):
    for j in range(13):
      for k in range(10):
        dp[i+1][(j*10+k)%13]=(dp[i+1][(j*10+k)%13]+dp[i][j])%mod
  else:
    k=int(S[i])
    for j in range(13):
      dp[i+1][(j*10+k)%13]=(dp[i+1][(j*10+k)%13]+dp[i][j])%mod
print(dp[len(S)][5])


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

struct Interval {
  int l;
  long long w;
  Interval(int l, long long w) : l(l), w(w) {}
  bool operator<(const Interval& oth) const { return l < oth.l; }
};


struct Seg {
  int l, m, r;
  Seg* ch[2] = {};
  long long ma = 0, tag = 0;
  void pull() {
    ma = max(ch[0]->ma, ch[1]->ma);
  }
  void push() {
    if (tag) {
      for (int i : {0, 1}) ch[i]->tag += tag, ch[i]->ma += tag;
      tag = 0;
    }
  }
  Seg(int l, int r) : l(l), r(r), m(l + r >> 1) {
    if (r - l > 1) {
      ch[0] = new Seg(l, m);
      ch[1] = new Seg(m, r);
    }
  }
  void add(int ql, int qr, long long v) {
    if (ql == qr) return;
    if (ql <= l and r <= qr) ma += v, tag += v;
    else {
      push();
      if (ql < m) ch[0]->add(ql, qr, v);
      if (m < qr) ch[1]->add(ql, qr, v);
      pull();
    }
  }
  long long query(int ql, int qr) {
    if (ql <= l and r <= qr) return ma;
    else {
      long long ans = 0;
      push();
      if (ql < m) ans = max(ans, ch[0]->query(ql, qr));
      if (m < qr) ans = max(ans, ch[1]->query(ql, qr));
      pull();
      return ans;
    }
  }
};

int main() {
  ios_base::sync_with_stdio(false); cin.tie(0);
  int n, m; cin >> n >> m;
  vector<vector<Interval>> lb(n + 1);
  for (int i = 0; i < m; ++i) {
    int l, r, w; cin >> l >> r >> w;
    lb[r].emplace_back(l - 1, w);
  }
  for (int i = 0; i <= n; ++i) sort(lb[i].begin(), lb[i].end());
  Seg dp(0, n + 1);
  for (int r = 1; r <= n; ++r) {
    dp.add(r, r + 1, dp.query(0, r));
    for (auto I : lb[r]) {
      dp.add(I.l + 1, r + 1, I.w);
    }
  }
  cout << dp.query(0, n + 1) << '\n';
}


Measured memory_bytes: 37120
#include <iostream>
#include <iomanip>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <utility>
#include <string>
#include <cmath>
#include <cstdlib>
#include <cstring>

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;
typedef vector<s32> vs32;
typedef vector<u32> vu32;
typedef vector<s64> vs64;
typedef vector<u64> vu64;

const double PI=3.14159265358979323846;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

#define rep(i, N) for(int i = 0; i < N; ++i)

#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 1000000007ULL


s64 gcd(s64 x, s64 y)
{
    if (x < y)
    {
        swap(x, y);
    }
    if (y == 0)
    {
        return x;
    }
    
    return gcd(y, x % y);
}

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

    s64 A, B;
    cin >> A >> B;
    s64 C = gcd(A, B);

    s64 ans = (A / C) * (B / C) * C;

    cout << ans << "\n";
    return 0;
}



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

int main(){
  int H,W;
  cin >> H >> W;
  vector<string> vs(H);
  vector< pair<int,int> > road;
  for(int i=0;i<H;i++){
    cin >> vs.at(i);
    for(int j=0;j<W;j++){
      if(vs.at(i).at(j)=='.'){
        road.push_back(make_pair(i,j));
      }
    }
  }
  vector<int> vx={1,-1,0,0};
  vector<int> vy={0,0,1,-1};
  int ans=0;
  for(int i=0;i<road.size();i++){
    queue< pair<int,int> > que;
    vector< vector<int> > t(H,vector<int>(W, 0));
    vector< vector<bool> > flag(H,vector<bool>(W, false));
    int ma=0;
    que.push(road.at(i));
    flag.at(road.at(i).first).at(road.at(i).second)=true;
    while(!que.empty()){
      int y,x;
      tie(y,x)=que.front();
      que.pop();
      for(int j=0;j<4;j++){
        int ny=y+vy.at(j);
        int nx=x+vx.at(j);
        if(ny==-1){
          continue;
        }
        if(nx==-1){
          continue;
        }
        if(ny==H){
          continue;
        }
        if(nx==W){
          continue;
        }
        if((vs.at(ny).at(nx)=='.')&&(!flag.at(ny).at(nx))){
          flag.at(ny).at(nx)=true;
          que.push(make_pair(ny,nx));
          t.at(ny).at(nx)=t.at(y).at(x)+1;
          if(ma<t.at(ny).at(nx)){
            ma=t.at(ny).at(nx);
          }
        }
      }
    }
    if(ans<ma){
      ans=ma;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
/************************************
/ AUTHOR : YATHARTH GOSWAMI         /  
/ ALIAS : hacker_yg                 /
/ INSTITUTE : IIT Kanpur            /
************************************/
//          TEMPLATE                //

#include <bits/stdc++.h>

#define ll long long
#define MOD 1000000007
#define pb push_back
#define mp make_pair
#define F first
#define S second

using namespace std;

int main(){
    ll n = 200000;
    vector <ll> dp(n+2);
    for (int i = 1; i <= 9; i++){
        dp[i] = i;
    }
    for (int i = 10; i <= n; i++){
        int d = (int)log10(i) + 1;
        int last = i%10;
        if (last == 0){
            dp[i] = dp[i-1];
            continue;
        }
        int first = i/((int)pow(10, d-1));
        if (first > last){
            dp[i] = dp[i-1] + (((int)pow(10, d-1) - 1)/9)*2;
        }
        else if (first < last){
            dp[i] = dp[i-1] + (((int)pow(10, d-2) - 1)/9)*2;
        }
        else {
            int flag = 1, temp = i;
            while (temp){
                if (temp%10 != last){
                    flag = 0;
                    break;
                }
                temp /= 10;
            }
            if (flag) {
                int num = (i%((int)pow(10, d-1))-last)/10;
                dp[i] = 2 + 2*(((int)pow(10, d-2)-1)/9) + 2*(num) + 1 + dp[i-1];
            }
            else {
                int num = (i%((int)pow(10, d-1)) - last)/10;
                dp[i] = dp[i-1] + 2*(num) + 1 + 2 + 2*(((int)pow(10, d-2)-1)/9);
            }
        }
    }
    int t;
    cin >> t;
    cout << dp[t];
    return 0;
}




Measured memory_bytes: 2176
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;

#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define range(i,a,n) for(int i=(a);i<(n);i++)

#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI 3.1415926535897932384

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

template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class S>S acm(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
void YN(bool b){cout<<(b?"YES":"NO")<<"\n";}
void Yn(bool b){cout<<(b?"Yes":"No")<<"\n";}
void yn(bool b){cout<<(b?"yes":"no")<<"\n";}

ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1; for(auto s:t){os<<(a?"":" ")<<s;a=0;} return os;}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n,l,sum=0;
	cin>>n>>l;
	vl v;
	rep(i,n)sum+=(l+i),v.push_back(abs(l+i));
	cout<<(sum+(l<0?1:-1)*(*min_element(all(v))));
}


Measured memory_bytes: 256
def main():
    n = int(input())
    X = list(map(int, input().split()))

    ans = [-1]*(n**2)
    left = []
    right = []
    for idx, x in enumerate(X):
        idx += 1
        ans[x-1] = idx
        left.append((x, idx-1, idx))
        right.append((x, n-idx, idx))

    left.sort(key=lambda x: -x[0])
    right.sort(key=lambda x: x[0])

    amt, cnt = 0, 0

    for i in range(n**2):
        if ans[i] != -1:
            continue
        while amt == 0 and cnt < n:
            cnt += 1
            x, amt, idx = left.pop()
        if amt == 0:
            break
        if x <= i:
            print("No")
            return
        amt -= 1
        ans[i] = idx

    amt, cnt = 0, 0

    for i in range(n**2-1, -1, -1):
        if ans[i] != -1:
            continue
        while amt == 0 and cnt < n:
            cnt += 1
            x, amt, idx = right.pop()
        if amt == 0:
            break
        if x > i:
            print("No")
            return
        amt -= 1
        ans[i] = idx
    print("Yes")
    print(*ans)


main()

Measured memory_bytes: 10996
#include <bits/stdc++.h>
using namespace std;
/* typedef */
typedef long long ll;
typedef pair<int, int> pii;
/* constant */
const int INF = 1 << 30;
const ll LINF = 1LL << 50;
const int NIL = -1;
const int MAX = 10000;
const int mod = 1000000007;
const double pi = 3.141592653589;
/* global variables */
/* function */
/* main */
int main(){
    int N;
    cin >> N;

    vector<vector<int> > G(N);
    map<pii, int> mp;
    int u, v;
    for (int i = 0; i < N - 1; i++) {
        cin >> u >> v;
        u--, v--;
        G[u].push_back(v);
        G[v].push_back(u);
        mp[pii(u, v)] = i;
        mp[pii(v, u)] = i;
    }

    vector<int> color(N - 1);
    vector<int> visited(N);
    queue<pii> q;
    q.push(pii(0, -1));
    visited[0] = 1;
    while (!q.empty()) {
        pii p = q.front();
        q.pop();
        int from = p.first, preColor= p.second;
        for (int i = 0, curColor = 1; i < G[from].size(); i++) {
            int to = G[from][i];
            if (visited[to]) continue;
            visited[to] = 1;
            if (curColor == preColor) curColor++;
            color[mp[pii(from, to)]] = curColor;
            q.push(pii(to, curColor));
            curColor++;
        }
    }

    cout << *max_element(color.begin(), color.end()) << '\n';
    for (int c : color) cout << c << '\n';
}


Measured memory_bytes: 19456
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define rrep2(ri,x,n) for(int ri = (int)(n-1); ri >= (int)(x); ri--)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(x) x.begin(), x.end()
using ll = long long;
using namespace std;

int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i, n) cin >> a.at(i);
  rep(i, n) a.at(i) -= (i+1);
  sort(ALL(a));
  int a1, a2;
  a1 = a2 = a.at(n/2);
  if(n % 2 == 0) a2 = a.at(n/2+1);
  cerr << a1 << " " << a2 << endl;
  ll ans1 = 0, ans2 = 0;
  rep(i, n){
    ans1 += abs(a.at(i) - a1);
    ans2 += abs(a.at(i) - a2);
  }
  cout << min(ans1, ans2) << endl;
  return 0;
}

Measured memory_bytes: 3988
import java.util.*;

public class Main {


    public static void main(String[] args) {



        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        int C = sc.nextInt();
        int ans = 0;
        if(B / A >= C){
            System.out.println(C);
        } else {
            System.out.println(B/A);
        }

    }


}


Measured memory_bytes: 22228
def main():
    n, m = map(int, input().split())
    a = set([int(input()) for _ in range(m)])
    if 1 < n:
        dp = [0 for _ in range(n + 1)]
        dp[1] = 0 if 1 in a else 1
        dp[2] = 0 if 2 in a else 1
        dp[2] += dp[1]
        for i in range(3, n + 1):
            if i - 1 not in a:
                dp[i] += dp[i - 1]
            if i - 2 not in a:
                dp[i] += dp[i - 2]
        print(dp[-1] % (10 ** 9 + 7))
    else:
        print(1 if 1 not in a else 0)


if __name__ == '__main__':
    main()



Measured memory_bytes: 462744
#include<bits/stdc++.h>
using namespace std;
const int N=1e5+5;
int n,x[N],l[N],i,j,f[N*2],a[N*2],xb;
vector<int>e[N*2];
int main(){
	scanf("%d",&n);
	for(i=1;i<=n;++i){
		scanf("%d%d",x+i,l+i);
		a[++xb]=x[i]-l[i];
		a[++xb]=x[i]+l[i];
	}
	sort(a+1,a+xb+1);xb=unique(a+1,a+xb+1)-a-1;
	auto find=[&](int x){return lower_bound(a+1,a+xb+1,x)-a;};
	for(i=1;i<=n;++i)e[find(x[i]-l[i])].push_back(find(x[i]+l[i]));
	for(i=1;i<=xb;++i){
		f[i]=max(f[i],f[i-1]);
		for(int j:e[i])f[j]=max(f[j],f[i]+1);
	}
	printf("%d\n",f[xb]);
}

Measured memory_bytes: 10368
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <iterator>
#include <numeric>
#include <cstdint>
#include <cmath>
#include <bitset>
#include <string>
#include <list>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>

#define N_TIMES(i, n)     for ( uint64_t i = 0;     i <  n; ++i )
#define N_TIMES_REV(i, n) for (  int64_t i = n - 1; i >= 0; --i )

using namespace std;

struct VectorItem
{
  int64_t key, val;
  VectorItem(int64_t key = 0, int64_t val = 0) : key(key), val(val) {}
  bool operator>(const VectorItem &item) const {
    return val > item.val;
  }
};

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

  vector<VectorItem> A(N);
  N_TIMES(n, N) {
    int64_t a;
    cin >> a;

    A[n] = VectorItem(n, a);
  }
  sort(A.begin(), A.end(), greater<VectorItem>());

  vector<vector<int64_t>> dp(N + 1, vector<int64_t>(N + 1, 0));
  for (int64_t n = 0; n < N; ++n) {
    for (int64_t x = 0; x <= n; ++x) {
      int64_t y = n - x;
      dp[x + 1][y] = max(dp[x + 1][y], dp[x][y] + A[n].val * (((N - 1) - x) - A[n].key));
      dp[x][y + 1] = max(dp[x][y + 1], dp[x][y] + A[n].val * (A[n].key - y));
    }
  }

  int64_t ans = 0;
  for (int64_t x = 0; x <= N; ++x) {
    int64_t y = N - x;
    ans = max(ans, dp[x][y]);
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 34684
import java.util.Scanner;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

class Main {

    public static void main(String[] args) {

        Pattern upperCase = Pattern.compile("[A-Z]");
        Pattern lowerCase = Pattern.compile("[a-z]");
        Scanner sc = new Scanner(System.in);
        String input = sc.nextLine();

        Matcher upperMatcher = upperCase.matcher(input);
        Matcher lowerMatcher = lowerCase.matcher(input);

        if(upperMatcher.find()){
            System.out.println("A");
        }else if(lowerMatcher.find()){
            System.out.println("a");
        }
        sc.close();
    }
}


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

#include <iostream>


#define MOD 1000000007

typedef unsigned long long ull;
typedef long long ll;

using namespace std;
auto f=[]()
{
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
};


ull power(ull base, ull p)
{
	if(p==0)return 1;

	ull local=(power(base,p>>1))%MOD;
	local=(local*local)%MOD;

	return !(p&1)?local:(base*local)%MOD;
}

const double EPSILON=0.001;
bool Same(double a, double b)
{
	return fabs(a-b)<EPSILON;
}


int main()
{
	f();
	double a,b;cin>>a>>b;


	for(int i=0;i<=1250;++i)
		if(Same(floor((double)i*0.08),a) && Same(floor((double)i*0.1),b)){
			cout<<i<<'\n';
			return 0;
		}

	cout<<-1<<'\n';

	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[] D = new int[K];
		for(int i = 0; i < K; i++)
			D[i] = sc.nextInt();
		int ans = N;
		while(true) {
			boolean ok = true;
			for(int i = 0; i < K; i++) {
				for(int j = 0; j < String.valueOf(ans).length(); j++) {
					if(D[i] == ans/(int)Math.pow(10, j)%10) {
						ok = false;
					}
				}
			}
			if(ok)
				break;
			ans++;
		}
		System.out.println(ans);
	}

}

Measured memory_bytes: 58904
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define enld '\n'
#define rep(i,n) for(int i=0; i<(n); i++)
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("Ofast")
constexpr ll INF = 1e18;
constexpr int inf = 1e9;
constexpr ll mod = 1000000007;
constexpr ll mod2 = 998244353;
const double PI = 3.1415926535897932384626433832795028841971;
const int dx[6] = {1, 0, -1, 0,1,1};
const int dy[6] = {0, 1, 0, -1,1,-1};
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; }
// ---------------------------------------------------------------------------


int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N,M;
    cin >> N >> M;
    vector<vector<int>> G(N);
    for(int i=0; i<M; i++){
        int a,b;
        cin >> a >> b;
        a--;b--;
        G[a].emplace_back(b);
        G[b].emplace_back(a);
    }
    queue<int> que;
    que.emplace(0);
    vector<int> par(N,-1);
    par[0] = 0;
    while(que.size()){
        int v = que.front();
        que.pop();
        for(int nv:G[v]){
            if(par[nv] != -1) continue;
            par[nv] = v;
            que.emplace(nv);
        }
    }
    bool can = true;
    for(int i=1; i<N; i++){
        if(par[i] == -1) can = false;
    }
    if(can){
        cout << "Yes" << enld;
        for(int i=1; i<N; i++){
            cout << par[i]+1 << enld;
        }
    }else{
        cout << "No" << enld;
    }
    return 0;
}


Measured memory_bytes: 10276
#define _USE_MATH_DEFINES

#include<stdio.h>
#include<iostream>
#include<iomanip>
#include<math.h>

using namespace std;

/* cout << fixed << setprecision(5); */

int main()
{	
	double S,L,r;

	cin >> r;

	S = r*r*M_PI;
	L = 2 * M_PI*r;

	cout << fixed << setprecision(5);

	cout << S << " " << L ;
	



	return 0;
}

Measured memory_bytes: 1288
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <iterator>
#pragma warning(disable:4996)
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define MOD 1000000007
using namespace std;


int main(int argc, char* argv[])
{
    long n;
    scanf("%ld", &n);

    set<long> xx;
    long i;
    for(i=0; i<n; i++) {
        long a;
        scanf("%ld", &a);
        auto it = xx.insert(a);
        if(!it.second) {
            xx.erase(it.first);
        }
    }
    printf("%ld\n", (long)xx.size());
  
    return 0;
}


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

int findmincost(int a[],int dp[],int k){
    if(dp[k]!=-1)
       return dp[k];
    if(k==1)
      dp[k]=findmincost(a,dp,k-1)+abs(a[k-1]-a[k]);
    else  
      dp[k]=min(findmincost(a,dp,k-1)+abs(a[k-1]-a[k]),findmincost(a,dp,k-2)+abs(a[k-2]-a[k])); 
    return dp[k];
}

int main() {
	int n;
	cin>>n;
	int a[n],i,dp[n];
	for(i=0;i<n;i++){
	   cin>>a[i];
	   dp[i]=-1;
	}
	dp[0]=0;
	findmincost(a,dp,n-1);
	cout<<dp[n-1];
	return 0;
}

Measured memory_bytes: 4992
#include <stdio.h>
      
int main(void) {
	int n, i, ans;
	int max = 0;
	char str[1000];
	
    scanf("%d%s", &n, str);
    
    ans = 0;
    for (i = 0; i < n; i++) {
    	if (str[i] == 'I') {
			ans++;
		} else if (str[i] == 'D') {
			ans--;
		}
		if (max < ans) {
			max = ans;
		}
	}
	
	printf("%d\n", max);
    
	return 0;

}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define SORT(x) sort((x).begin(), (x).end())
#define ALL(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < n; i++)
#define reps(i, m, n) for (ll i = m; i < n; i++)
#define repr(i, m, n) for (ll i = m; i >= n; i--)
#define de(x) cout << #x << "=" << x << endl;
template <class T>
bool maxi(T &a, const T &b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool mini(T &a, const T &b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}
#define INF2 1000000000000000037
#define INF 1000000007
#define MOD 1000000007
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
//--GLOBAL---------------------------------

//--MAIN-----------------------------------
void Main() {
    ll N; cin>>N;
    ll A[N];
    rep(i,N) cin>>A[i];

    ll ans=1;

    ll x=0,y=0,z=0;
    rep(i,N){
        ll ct=0;
        if(A[i]==x) ++ct;
        if(A[i]==y) ++ct;
        if(A[i]==z) ++ct;
        if(ct==0){
            cout<< 0 <<"\n"; return;
        }
        ans=ans*ct%MOD;
        if(A[i]==x) { ++x; continue; }
        if(A[i]==y) { ++y; continue; }
        if(A[i]==z) { ++z; continue; }
    }

    cout<< ans<<"\n";

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


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <numeric>
using namespace std;
#define rep(i,n) for(int i=1;i<=(int)(n);i++)
#define ll long long
#define BIT_FLAG_0 (1<<0) // 0000 0000 0000 0001
int gcd(int a, int b){
  if(a%b == 0){
    return b;
  }else{
    return gcd(b, a%b);
  }
}

int main(){
    int k;
    cin >> k;
    ll ans=0;
    rep(i,k){
        rep(j,k){
            rep(l,k){
                ans+=gcd(gcd(i,j),l);
            }
        }
    }  
    cout << ans << endl;  
}

Measured memory_bytes: 3616