akhauriyash/Code-Regression huggingface dataset:
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author silviase
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ABeginner solver = new ABeginner();
        solver.solve(1, in, out);
        out.close();
    }

    static class ABeginner {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            int r = in.nextInt();
            out.println(n >= 10 ? r : r + 100 * (10 - n));
        }

    }
}



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

int main()
{
    int A, B, C;
    cin >> A >> B >> C;
    if (A == B) {
        cout << C << endl;
    } else if (A == C) {
        cout << B << endl;
    } else {
        cout << A << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <math.h>
#include <algorithm>
#include <set>
#include <iostream>
#include <vector>
#include <queue>
#include <map>
#include <string>
#include <cstring>
#include <functional>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <chrono>
#include <climits>
#include <bitset>
using namespace std ;
#define ld long double
#define int long long
#define ii pair<int,int>
#define FAST_IO ios_base::sync_with_stdio(false) ;cin.tie(NULL);cout.tie(NULL); clock_t beg = clock()
#define dbg(x) cerr << #x << " is " << x << endl;
#define ms(x,a) memset(x,(int)(a),sizeof(x))
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define vi vector<int >
#define pb push_back
#define endl '\n'
#define ff first
#define ss second
//const int N = 3e5+7 ;
//const int INF = 1e18 ;
const int MOD = 1e9 + 7 ;
int solve(int base,int exponent,int mod){
    int ans=1;
    while(exponent!=0){
        if(exponent&1) ans=(1LL*ans*base)%mod;
        base=(1LL*base*base)%mod;
        exponent>>=1;
    }
    return ans%mod;
}


void solve(){
	int n , k ;
	cin >> n >> k ;
	vi a(k+1) ;
	int ans = 0 ;
	for(int i = k ; i >= 1 ; i--){
		a[i] = k/i ;
		a[i] = solve(a[i],n,MOD) ;
		for(int j = 2*i ; j <= k ; j+=i){
			a[i] = (a[i]-a[j]+MOD)%MOD ;
		}
		ans = (ans+(a[i]*i)%MOD)%MOD ;
	}
	cout << ans ;
}

int32_t main(){
	FAST_IO ;
	int t = 1 ;
//	cin >> t ;
	while(t--){
		solve() ;
	}
    cerr << "\nExecution time: " << (clock() - beg) / 1000 << '\n';
}


Measured memory_bytes: 4056
import java.util.*;

public class Main {

  public static void main (String[] args) {

    Scanner sc = new Scanner(System.in);

    String S = sc.next();

    sc.close();

    for (int i = 2; i < S.length(); i = i + 2) {
      String s = S.substring(0, (S.length() - i) / 2);
      String s2 = s + s;
      if (S.indexOf(s2) != -1) { 
        System.out.println(s2.length());
        break;
      }
    }
    
  }

}

Measured memory_bytes: 22996
#include<bits/stdc++.h>
using namespace std;
long long n,a[202020][7],ans;
int main()
{
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i][0]>>a[i][1];
	}
	for(int i=0;i<4;i++)
	{
		long long mx=-3e9,mn=3e9;
		for(int j=1;j<=n;j++)
		{
			long long nw=0;
			for(int k=0;k<2;k++)
			{
				if((i>>k)&1)
				{
					nw+=a[j][k];
				}
				else
				{
					nw-=a[j][k];
				}
			}
			mx=max(mx,nw);
			mn=min(mn,nw);
		}
		ans=max(ans,mx-mn);
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 14564
// https://atcoder.jp/contests/jsc2019-qual/tasks/jsc2019_qual_a

package main

import "fmt"
import "bufio"
import "os"
import "strconv"

var _sw = bufio.NewScanner(os.Stdin)

func main() {
	M := nextInt()
	D := nextInt()

	cnt := 0
	for m := 1; m <= M; m++ {
		for d := 22; d <= D; d++ {
			if d%10 >= 2 && (d/10)*(d%10) == m {
				cnt++
			}
		}
	}
	fmt.Println(cnt)
}

func init() {
	_sw.Split(bufio.ScanWords)
}

func nextInt() int {
	if _sw.Scan() == false {
		panic(_sw.Err())
	}
	i, e := strconv.Atoi(_sw.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func nextString() string {
	if _sw.Scan() == false {
		panic(_sw.Err())
	}
	return _sw.Text()
}

func max(x, y int) int {
	if x > y {
		return x
	}
	return y
}

func min(x, y int) int {
	if x > y {
		return y
	}
	return x
}


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

int main() {
    int N, M;
    cin >> N >> M;
    vector<int> a(M), b(M);
    for (int i = 0; i < M; i++) {
        cin >> a.at(i) >> b.at(i);
    }
    vector<int> perm(N - 1);
    for (int i = 0; i < N - 1; i++) perm.at(i) = i + 2;
    int count = 0;
    do {   
        int okCount = 0;
        for (int j = 0; j < N - 1; j++) {
            int now, next;
            if (j == 0) {
                now = 1;
                next = perm.at(j);
            } else {
                now = perm.at(j - 1);
                next = perm.at(j);
            }
            for (int k = 0; k < M; k++) {
                if ((a.at(k) == now && b.at(k) == next)
                || (b.at(k) == now && a.at(k) == next)) okCount++;
            }
        }
        if (okCount == N - 1) count++;
    } while(next_permutation(perm.begin(), perm.end()));
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 3636
#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
*this << "[";
for (auto it = d.b; it != d.e; ++it)
*this << ", " + 2 * (it == d.b) << *it;
ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define cool ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define int  long long int
#define pb push_back
#define fe first
#define lb lower_bound 
#define ub upper_bound
#define pii pair<pair<int,int>,pair<int,int> >
#define se second
#define endl "\n"
#define pi pair<int, int>
#define mi          map<int,int>
#define mii         map<pi,int>
#define vi vector<int> 
#define vvi vector<vi>
#define bs   binary_search
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rep1(i,a,b) for(int i=a;i<=b;i++)	
#define all(c) (c).begin(),(c).end()
#define sz(x)       (int)x.size() 
#define PI 3.14159265358979323846

 const int N=2e5+5;

 int mod= 2019;
 int dx[4]={0,0,+1,-1};
 int dy[4]={+1,-1,0,0};  
 
 
int po(int a, int b) {
	a %= mod;
	int res = 1;
	while (b > 0) {
		if (b & 1)
			res = (res * a) % mod;
		a =(a*a) % mod;
		b >>= 1;
	}
	 return res;	
   }
  

   
 void solve() {
	   string s;
	   cin>>s;
	   int len=sz(s);
	   mi mp;
	   int cur=0;
	   mp[0]=1;
	   rep(i,0,len) {
		      cur*=10;
		      cur%=mod;
		      cur+=s[i]-'0';
		      int val=po(10,len-i)*cur%mod;
		      mp[val]++; 
		      
		   }
		   int sm=0;
		   for(auto to:mp) 
		     sm+=(to.se*(to.se-1))/2;
		     cout<<sm<<endl; 		
						   
 }

    
int32_t main() {
	cool;
	int t=1;
	//cin>>t;
	while(t--)
	solve();


return 0;	   
}


Measured memory_bytes: 3748
#include<stdio.h>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<cmath>
#include<iostream>
#include<queue>
#include<string>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<long long,long long> pll;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define rep(i,j,k)  for(register int i=(int)(j);i<=(int)(k);i++)
#define rrep(i,j,k) for(register int i=(int)(j);i>=(int)(k);i--)

ll read(){
	ll x=0,f=1;char c=getchar();
	while(c<'0' || c>'9'){if(c=='-')f=-1;c=getchar();}
	while(c>='0' && c<='9'){x=x*10+c-'0';c=getchar();}
	return x*f;
}

const int mod=998244353;
int k,n;
ll C[4444][4444];

int main(){
	C[0][0]=1;
	for(int i=1;i<=4000;i++){
		C[i][0]=C[i][i]=1;
		for(int j=1;j<i;j++){
			C[i][j]=(C[i-1][j]+C[i-1][j-1])%mod;
		}
	}
	int k=read(),n=read();
	for(int i=2;i<=2*k;i++){
		ll ans = 0, cur = 1;
		int cnt = std::max(std::min(i >> 1, k) - std::max(i - k, 1) + 1, 0), x = k - (cnt << 1);
	//	 printf("%d %d %d\n", i, cnt, x);
		// fflush(stdout);
		for (int j = 0; j <= cnt; j++)
		{
			(ans += C[cnt][j] * cur % mod * C[n + x - 1][x + j - 1]) %= mod;
			cur = cur * 2 % mod;
		}
		printf("%lld\n", ans);
	}
	return 0;
}


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

using namespace std;

string s;

int main() {
    ios_base::sync_with_stdio(false);
    cin >> s;
    int len = s.length();
    for (int i = 0; i < len; ++i) {
        if (i % 2 == 0) {
            cout << s[i];
        }
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 592
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll (i) = 0; (i) < (n); (i)++)
#define rep1(i, n) for(ll (i) = 1; (i) <= (n); (i)++)
#define rrep(i, n) for(ll (i) = (n) - 1; (i) >= 0; (i)--)
#define rrep1(i, n) for(ll (i) = (n); (i) >= 1; (i)--)
const ll INF = 1145141919;
const ll MOD = 1000000007;
template<class T> void chmax(T &a, const T &b){if(a < b){a = b;}}
template<class T> void chmin(T &a, const T &b){if(a > b){a = b;}}

int main(){

    ll ans = 0;
    char lst = '@';
    ll N;
    cin >> N;
    rep(i, N){
        char c;
        cin >> c;
        if(c != lst){
            lst = c;
            ans++;
        }
    }
    cout << ans << endl;

    return 0;
}

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

const ll INF    = 1e16;
ll dp[110][101010];

int main(){
    ll n, W;
    cin >> n;
    cin >> W;
    vector<ll>w(n);
    vector<ll>v(n);
    rep(i, n)   cin >> w[i] >> v[i];
    //DPtable
    ll maxV = n*1000;
    for(int i = 0; i <= n; i++) for(int j = 0; j <= maxV; j++){
        dp[i][j] = INF;
    }
    dp[0][0] = 0;
    rep(i, n){
        for(int j = 0; j <= maxV; j++){
            /*
            if(j >= v[i]){   //i番目を入れる
                dp[i+1][j] = min(dp[i][j], dp[i][j-v[i]]+w[i]);
            }else{
                dp[i+1][j] = dp[i][j];
            }
            */
            dp[i+1][j] = min(dp[i+1][j], dp[i][j]);
            dp[i+1][j+v[i]] = min(dp[i+1][j+v[i]], dp[i][j]+w[i]);
        }
        //debug
      	/*
        printf("   |");
        for(int j = 0; j <= 18; j++)    printf("%3d", j);
        printf("\n---+");
        for(int j = 0; j <= 18; j++)    printf("---");
        printf("\n");
        rep(i, 8){
            printf("%3d|", i);
            for(int j = 0; j <= 18; j++){
                if(dp[i][j] == INF){
                    printf("INF");
                }else{
                    printf("%3lld", dp[i][j]);
                }
            }
            printf("\n");
        }
        sleep(1);
        printf("\n");
        */
    }
    ll ans = 0;
    for(ll i = 0; i <= maxV; i++){
        if(dp[n][i] <= W)   ans = max(ans, i);
    }
    cout << ans << endl;
}


Measured memory_bytes: 80128
#include<stdio.h>
#include<math.h>
#include<stdlib.h>
int d[111];
int main()
{
	int n;
	scanf("%d", &n);
	int c = 0;
	for (int i = 0; i < n; i++)scanf("%d", &d[i]), c += d[i];
	int maxi = 1000000000, rr = -1;
	for (int i = 0; i < n; i++)if (maxi>abs(c - d[i] * n))maxi = abs(c - d[i] * n), rr = i;
	printf("%d\n", rr);
}

Measured memory_bytes: 128
#include<iostream>
#include<string>
#include<vector>
#include<cmath>
#include<queue>
#include<stack>
#include<set>
#include<algorithm>
#include<utility>
#include<map>
using namespace std;
int main() {
	int n; cin >> n;
	if (n % 10 == 9 || n / 10 == 9) cout << "Yes" << endl;
	else cout << "No" << endl;
 	return 0;
}

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

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

    vector<int> h(N + 1);
    for (int i = 0; i < N; i++) {
        cin >> h.at(i);
    }
    h.at(N) = 0;

    int ans = 0;
    for (int i = 0; i < N; i++) {
        int down = h.at(i) - h.at(i + 1);
        if (down > 0) {
            ans += down;
        }
    }
    cout << ans << endl;
}

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

int main(){
	string s;
	cin >> s;
	string ans = "";
	for(char i : s){
		// cout << ans << endl;
		if(i == '0' || i == '1'){
			ans += i;
		}
		else{
			if(ans != ""){
				ans = ans.substr(0, ans.size() - 1);
			}
		}
	}
	cout << ans << endl;
	return 0;
}

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

const char NL = '\n';
const int MOD = 1e9 + 7;

void solve()
{
    int n, k; cin >> n >> k;
    vector<int> v;
    for (int i = 0; i < n; ++i) {
        int h; cin >> h;
        v.push_back(h);
    }
    vector<int> dp(n, 0);
    for (int i = 1; i < n; ++i) {
        int minCost = INT_MAX;
        for (int j = max(0, i - k); j < i; ++j) {
            int cost = dp[j] + abs(v[i] - v[j]);
            minCost = min(minCost, cost);
        }
        dp[i] = minCost;
    }
    cout << dp[n - 1] << NL;
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    solve();
    return 0;
}

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

typedef long long int ll;
typedef vector<long long>lve;
typedef vector<pair<ll,ll> > lvp;

#define sp         ' '
#define endl       '\n'
#define F          first
#define S          second
#define pp         pop_back`
#define pb         push_back
#define mp         make_pair 
#define GCD(x,y)   __gcd(x,y)
#define PI         2*acos(0.0)
#define lb         lower_bound
#define bs         binary_search
#define all(x)     x.begin(),x.end()
#define LCM(x,y)   ((x*y)/__gcd(x,y))
#define btpc       __builtin_popcountll
#define spc(x)     cout<<fixed<<setprecision(x)

const   long long  cs=2e5+5;
const   long long  inf=1e18;
const   long long  mod=1e9+7;
void solve()
{
    int64_t t,n,m,a,b,c,d,e,i,j,k,x,y,cnt=0,cnt1=0;
    bool flag = false;   
    
    cin>>a>>b>>c;
    n=b+c;
    if(n<=a) cout<<'0'<<endl;
    else cout<<n-a<<endl;
}
int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);    cout.tie(NULL);

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

    // int32_t tc;
    // cin>>tc;
    // while(tc--)
    solve();

    return 0;
}


Measured memory_bytes: 3636
import java.io.*;
import java.util.*;
class Main
{
    static BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
	static FastScanner sc=new FastScanner(br);
    static PrintWriter out=new PrintWriter(System.out);
	static Random rnd=new Random();
	static int maxn=(int)1e5+5;
	static Node[] tree;
	
	static Node merge(Node n1,Node n2)
	{
		if(n1.val>n2.val)
		{
			return new Node(n1.idx,n1.val);
		}
		return new Node(n2.idx,n2.val);
	}
	
	static void update(int node,int s,int e,int l,int r,int val)
	{
		if(s>e || l>e || r<s)
		{
			return;
		}
		if(s==e)
		{
			tree[node].val+=val;
		}
		else
		{
			int mid=(s+e)>>1;
			update(node<<1,s,mid,l,r,val);update(node<<1|1,mid+1,e,l,r,val);
			tree[node]=merge(tree[node<<1],tree[node<<1|1]);
		}
	}
	
	static Node query(int node,int s,int e,int l,int r)
	{
		if(s>e || l>e || r<s)
		{
			return new Node(-1,0);
		}
		if(l<=s && r>=e)
		{
			return tree[node];
		}
		else
		{
			int mid=(s+e)>>1;
			Node n1=query(node<<1,s,mid,l,r),n2=query(node<<1|1,mid+1,e,l,r);
			return merge(n1,n2);
		}
	}
	
	static void build(int node,int s,int e)
	{
		if(s>e)	
		{
			return;
		}
		if(s==e)
		{
			tree[node]=new Node(s,0);
		}
		else
		{
			int mid=(s+e)>>1;
			build(node<<1,s,mid);build(node<<1|1,mid+1,e);
			tree[node]=merge(tree[node<<1],tree[node<<1|1]);
		}
	}
	
    public static void main(String args[]) throws Exception
    {
		int n=sc.nextInt();int[] a=new int[n];tree=new Node[4*maxn];build(1,0,maxn-1);
		for(int i=0;i<n;i++)
		{
			a[i]=sc.nextInt();update(1,0,maxn-1,a[i],a[i],1);
		}
		boolean check=true;int res=0;
		while(check)
		{
			Node curr=query(1,0,maxn-1,0,maxn-1);
			if(curr.val<=1)
			{
				check=false;break;
			}
			else
			{
				Node curr2=merge(query(1,0,maxn-1,0,curr.idx-1),query(1,0,maxn-1,curr.idx+1,maxn-1));
				//out.println(curr.idx+" "+curr2.idx);
				update(1,0,maxn-1,curr.idx,curr.idx,-1);
				update(1,0,maxn-1,curr2.idx,curr2.idx,-1);
			}
		}
		for(int i=1;i<maxn;i++)
		{
			res+=Math.max(0,query(1,0,maxn-1,i,i).val);
		}
		out.println(res);out.close();
    }
}
class Node
{
	int idx,val;
	public Node(int idx,int val)
	{
		this.idx=idx;this.val=val;
	}
}
class FastScanner
{
    BufferedReader in;
    StringTokenizer st;

    public FastScanner(BufferedReader in) {
        this.in = in;
    }
	
    public String nextToken() throws Exception {
        while (st == null || !st.hasMoreTokens()) {
            st = new StringTokenizer(in.readLine());
        }
        return st.nextToken();
    }
	
	public String next() throws Exception {
		return nextToken().toString();
	}
	
    public int nextInt() throws Exception {
        return Integer.parseInt(nextToken());
    }

    public long nextLong() throws Exception {
        return Long.parseLong(nextToken());
    }

    public double nextDouble() throws Exception {
        return Double.parseDouble(nextToken());
    }
}

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

namespace ConsoleApp43 {
    class Program {
        static void Main(string[] args) {
            var st = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();

            int A = st[0];
            int B = st[1];
            int C = st[2];

            if (A <= C && C <= B) {
                Console.WriteLine("Yes");
            } else {
                Console.WriteLine("No");
            }

            
        }

    }
}


Measured memory_bytes: 13268
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define _GLIBCXX_DEBUG
#define all(v) v.begin(), v.end()
#include <cmath>
int main() {
    static const double pi = acos(-1);
    int A, B, H, M;
    cin >> A >> B >> H >> M;

    //double x = 2 * pi * (H*60 + M)   /720.0;
    //型変換を行わないとint/intの計算で切り捨てられてしまう
    //⇒誤差
    double y = 2 * pi * (H*30 + M/2.0) /360;
    //ここの部分で 30H + M/2とすると桁落ちする？
    //printf("%.20f\n",x);
    //printf("%.20f\n",y);

    double th = y;
    double tm = 2 * pi * M / 60;
    double theta  = th - tm;
    double ans;
    ans = sqrt(A * A + B * B - 2 * A * B * cos(theta));

    printf("%.10f\n",ans);
      
    return 0;
}


Measured memory_bytes: 4100
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

typedef long long ll;
constexpr double PI = 3.141592653589793;
constexpr ll INF = 1e18 + 10;
template <class T>
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}

using namespace std;
//    cout << setprecision(20) << ans << "\n";

vector<pair<ll, ll>> primeFactorize(ll N)
{
    vector<pair<ll, ll>> res;
    for (ll a = 2; a * a <= N; ++a)
    {
        if (N % a != 0)
            continue;
        ll ex = 0;

        while (N % a == 0)
        {
            ++ex;
            N /= a;
        }
        res.push_back({a, ex});
    }

    if (N != 1)
        res.push_back({N, 1});
    return res;
}

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

    int n, k;
    cin >> n >> k;
    vector<int> p(n);
    for (int i = 0; i < n; i++)
    {
        cin >> p[i];
    }
    sort(p.begin(), p.end());

    int sum = 0;
    for (int i = 0; i < k; i++)
    {
        sum += p[i];
    }

    cout << sum << "\n";

    return 0;
}


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



Measured memory_bytes: 2128
N, K = map(int, input().split())

N = N % K
# print(N)
ans_candidate_list = [N]
while True:
    N = abs(N - K)
    # print(N)
    # print(ans_candidate_list)
    if N not in ans_candidate_list:
        ans_candidate_list.append(N)
    else:
        break

print(sorted(ans_candidate_list)[0])


Measured memory_bytes: 2940
#include <iostream>
#include <algorithm>

using namespace std;

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

    for (int i = 0; i <= N; i++){
        int six = i, nine = N-i, wd = 0;
        while (six ) wd += six  % 6, six  /= 6;
        while (nine) wd += nine % 9, nine /= 9;
        faster = min(faster, wd);
    }   cout << faster << endl;

    return 0;
}


Measured memory_bytes: 256
N = int(input())
b = list(map(int, input().split()))
ans = [-1]*N
for i in range(N):
    for j in reversed(range(len(b))):
        if b[j] == j+1:
            ans[i] = b.pop(j)
            break

if len(b) == 0:
    for i in reversed(range(N)):
        print(ans[i])
else:
    print(-1)


Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <string>
#define flush fflush(stdout)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int mod = 1e9 + 7, INF = 1e9;


int main(void) {
    int r, g, b, n, i, j, re, ans;

    scanf("%d%d%d%d", &r, &g, &b, &n);

    ans = 0;
    for (i = 0; r * i <= n; i++) {
        for (j = 0; r * i + g * j <= n; j++) {
            re = n - r * i - g * j;
            if (re >= 0 && re % b == 0) {
                ans++;
            }
        }
    }

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

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define repl(i, l, r) for (ll i = (l); i < (r); i++)
#define rep(i, n) repl(i, 0, n)
#define CST(x) cout << fixed << setprecision(x)
using ll = long long;
const ll MOD = 1000000007;
const int inf = 1e9 + 10;
const ll INF = 4e18 + 10;
const int dx[9] = {1, 0, -1, 0, 1, -1, -1, 1, 0};
const int dy[9] = {0, 1, 0, -1, 1, 1, -1, -1, 0};
ll modpow(ll a, ll n) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * a % MOD;
		a = a * a % MOD;
		n >>= 1;
	}
	return res;
}
int main() {
	cin.tie(0);
	cout.tie(0);
	ios::sync_with_stdio(false);

	ll n;
	cin >> n;
	ll ans = (modpow(10, n) - (modpow(9, n) * 2 % MOD - modpow(8, n) + MOD) % MOD + MOD) % MOD;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3644
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
	static void Main()
	{
		var AB = Array.ConvertAll(Console.ReadLine().Split(new[] { ' ' }), number => int.Parse(number));
		var S = Console.ReadLine();

		var isWrite = true;
		if (S.Length == AB[0] + AB[1] + 1) {
			for (var i = 0; i < S.Length; ++i) {
				if (i == AB[0]) {
					if (S[i] != '-') {
						isWrite = false;
					}
				} else {
					if (S[i] < '0' || S[i] > '9') {
						isWrite = false;
					}
				}
			}
		} else {
			isWrite = false;
		}

		Console.WriteLine(isWrite ? "Yes" : "No");

		//デバッグ実行での確認用。そのまま提出しても問題なし
		Console.ReadKey();
	}
}


Measured memory_bytes: 13140
#include <bits/stdc++.h>
#include <iostream>
#include <boost/foreach.hpp>
#include <vector>
#include <algorithm>
using namespace std;

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

  vector<int> a_i(N);
  for (int i = 0; i < N; i++) {
    cin >> a_i.at(i);
  }
  std::sort(a_i.begin(), a_i.end());
  a_i.erase(std::unique(a_i.begin(), a_i.end()), a_i.end());
 
  cout << a_i.size()<< endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s, t; cin >> s >> t;
  sort(s.begin(), s.end());
  sort(t.begin(), t.end());
  reverse(t.begin(), t.end());

  if(s < t) cout << "Yes" << endl;
  else cout << "No" << endl;
}

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

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

    ll* a = new ll[n+1];
    map<ll,bool>visited;
    for(ll i=1;i<=n;i++){
        cin>>a[i];
        visited[i+1]=false;
    }

    ll src = 1;
    vector<ll>ans;
    while(1){
        ans.push_back(src);
        visited[src]=true;
        src = a[src];
        if(visited[src])
            break;
    }

    ll m = ans.size();
    ll pos = -1;
    for(ll i=0;i<m;i++){
        if(ans[i]==src){
            pos=i;
            break;
        }
    }
    ll cycle_length = m - pos;
    if(k<=pos){
        cout<<ans[k];
    }
    else{
        k-=pos;
        k%=cycle_length;
        cout<<ans[pos+k];
    }

    return 0;

}


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

int main()
{
    int n,q; cin>>n>>q; int t[10000001]={0}; char a[10000001];
    for(int i=0;i<n;i++) cin>>a[i];
    t[0]=0;
    for(int i=1;i<n;i++)
    {
        if(a[i]=='C' and a[i-1]=='A') t[i]=t[i-1]+1;
        else t[i]=t[i-1];
    }
    for(int i=0;i<q;i++)
    {
        int l,r; cin>>l>>r;
        cout<<(t[r-1]-t[l-1])<<endl;
    }
}

Measured memory_bytes: 41984
#include<stdio.h>
#include<math.h>
int main(){
    double x[30], y[30], a, b, c, z, S = 0;;
    int i = 0;
    while ( scanf("%lf,%lf", &x[i], &y[i]) != EOF ) {
        if ( i >= 2 ) {
            a = sqrt((x[i - 1] - x[0]) * (x[i - 1] - x[0]) + (y[i - 1] - y[0]) * (y[i - 1] - y[0]));
            b = sqrt((x[i] - x[0]) * (x[i] - x[0]) + (y[i] - y[0]) * (y[i] - y[0]));
            c = sqrt((x[i] - x[i - 1]) * (x[i] - x[i - 1]) + (y[i] - y[i - 1]) * (y[i] - y[i - 1]));
            z = (a + b + c) / 2;
            S += sqrt(z * (z - a) * (z - b) * (z - c));
            /*printf("%lf %lf %lf %lf\n", a, b, c, S);*/
        }
        i++;
        /*printf("%lf\n", S);*/
    }
    printf("%lf\n", S);
    return 0;
}

Measured memory_bytes: 1680
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int N=105;
int n,m,K,M,dp[N][N][N][2],c[N][N],g1[N][N*N],g2[N][N][N];
int ksm(int x,int y){
	int ans=1;
	for (;y;y>>=1,x=x*x%M)
		if (y&1)(ans*=x)%=M;
	return ans;	
}
signed main(){
	scanf("%lld%lld%lld%lld",&n,&m,&K,&M);
	c[0][0]=1;
	for (int i=1;i<N;i++){
		c[i][0]=1;
		for (int j=1;j<=i;j++)c[i][j]=(c[i-1][j-1]+c[i-1][j])%M;
	}
	for (int i=0;i<N;i++)
		for (int j=0;j<N*N;j++)g1[i][j]=ksm(i,j);
	for (int i=0;i<N;i++)
		for (int j=0;j<N;j++)
			for (int k=0;k<N;k++)
				g2[i][j][k]=ksm((ksm(i,j)-(i==0?0:ksm(i-1,j))+M)%M,k);
	dp[0][0][0][0]=1;
	for (int k=0;k<K;k++){
		for (int j=0;j<=m;j++)
			for (int i=0;i<=n;i++)
				for (int p=0;p<=n-i;p++)
					(dp[i+p][j][k][1]+=dp[i][j][k][0]*c[n-i][p]%M*g1[K-k][j*p]%M*g2[k+1][m-j][p])%=M;
		for (int j=0;j<=m;j++)
			for (int i=0;i<=n;i++)
				for (int p=0;p<=m-j;p++)
					(dp[i][j+p][k+1][0]+=dp[i][j][k][1]*c[m-j][p]%M*g1[k+1][(n-i)*p]%M*g2[K-k][i][p])%=M;					
	}
	printf("%lld\n",dp[n][m][K][0]);
}

Measured memory_bytes: 35840
import sys
sys.setrecursionlimit(10**7) #再帰関数の上限,10**5以上の場合python
import math
from copy import copy, deepcopy
from copy import deepcopy as dcp
from operator import itemgetter
from bisect import bisect_left, bisect, bisect_right#2分探索
#bisect_left(l,x), bisect(l,x)#aはソート済みである必要あり。aの中からx未満の要素数を返す。rightだと以下
from collections import deque
#deque(l), pop(), append(x), popleft(), appendleft(x)
#q.rotate(n)で → にn回ローテート
from collections import Counter#文字列を個数カウント辞書に、
#S=Counter(l),S.most_common(x),S.keys(),S.values(),S.items()
from itertools import accumulate,combinations,permutations#累積和
#list(accumulate(l))
from heapq import heapify,heappop,heappush
#heapify(q),heappush(q,a),heappop(q) #q=heapify(q)としないこと、返り値はNone
#import fractions#古いatcoderコンテストの場合GCDなどはここからimportする
from functools import lru_cache#pypyでもうごく
#@lru_cache(maxsize = None)#maxsizeは保存するデータ数の最大値、2**nが最も高効率
from decimal import Decimal

def input(): 
    x=sys.stdin.readline()
    return x[:-1] if x[-1]=="\n" else x
def printl(li): _=print(*li, sep="\n") if li else None
def argsort(s, return_sorted=False): 
    inds=sorted(range(len(s)), key=lambda k: s[k])
    if return_sorted: return inds, [s[i] for i in inds]
    return inds
def alp2num(c,cap=False): return ord(c)-97 if not cap else ord(c)-65
def num2alp(i,cap=False): return chr(i+97) if not cap else chr(i+65)
def matmat(A,B):
    K,N,M=len(B),len(A),len(B[0])
    return [[sum([(A[i][k]*B[k][j]) for k in range(K)]) for j in range(M)] for i in range(N)]
def matvec(M,v):
    N,size=len(v),len(M)
    return [sum([M[i][j]*v[j] for j in range(N)]) for i in range(size)]
def T(M):
    n,m=len(M),len(M[0])
    return [[M[j][i] for j in range(n)] for i in range(m)]
def main():
    mod = 1000000007
    #w.sort(key=itemgetter(1),reversed=True)  #二個目の要素で降順並び替え

    N = int(input())
    #N, K = map(int, input().split())
    #A = tuple(map(int, input().split())) #1行ベクトル
    A = tuple(int(input()) for i in range(N)) #改行ベクトル
    #S = tuple(tuple(map(int, input().split())) for i in range(N)) #改行行列
    cur=1
    ans=0
    for i,a in enumerate(A):
        if i==0:
            ans+=a-1
            cur=2
            continue
        if a==cur:
            cur+=1
            continue
        d,x=divmod(a,cur)
        if x==0:
            a-=cur+1

            ans+=a//cur+1
        else:
            ans+=d

    print(ans)


        
        




if __name__ == "__main__":
    main()

Measured memory_bytes: 84688
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <limits>
#include <random>
#include <complex>
#include <cmath>
#include <cstdio>
#include <cstdlib>
using namespace std;

#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
typedef long long ll;

int main() {

	int N; cin >> N;

	ll ans = 1e9;
	ll sum = 0;
	REP(i,N) {
		ll A,B;
		cin >> A >> B;
		if (A > B) ans = min(ans, B);
		sum += A;
	}

	if (ans == 1e9) {
		cout << 0 << endl;
		return 0;
	}

	cout << sum - ans << endl;

	return 0;
}


Measured memory_bytes: 384
from copy import deepcopy
import math
import string
import collections
from collections import Counter
from collections import deque
from decimal import Decimal
import sys
import fractions
from operator import itemgetter
import itertools
import copy


def readints():
    return list(map(int, input().split()))


def nCr(n, r):
    return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))


def has_duplicates2(seq):
    seen = []
    for item in seq:
        if not(item in seen):
            seen.append(item)
    return len(seq) != len(seen)


def divisor(n):
    divisor = []
    for i in range(1, n+1):
        if n % i == 0:
            divisor.append(i)
    return divisor


# coordinates
dx = [-1, -1, -1, 0, 0, 1, 1, 1]
dy = [-1, 0, 1, -1, 1, -1, 0, 1]

n = int(input())
h = readints()
# print(h)
cnt = 0
ans = -1
for i in range(n-1):
    if h[i] >= h[i+1]:
        cnt += 1
    else:
        ans = max(cnt, ans)
        cnt = 0
print(max(ans, cnt))


Measured memory_bytes: 90644
/* ****mittal**** */
#include<bits/stdc++.h>
#define ll          long long int 
#define ld          long double
#define pb          push_back
#define endl        '\n'
#define pii         pair<long long int,long long int>
#define vi          vector<ll>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll )x.size()
#define hell        1000000007
#define jell        998244353
#define rep(i,a,b)    for(ll int i=a;i<b;i++)
#define repr(i,a,b)   for(ll int i=a;i>=b;i--)
#define lbnd    lower_bound
#define ubnd        upper_bound
#define mp          make_pair
#define DEC(N)  cout << std::fixed; cout << setprecision(N);
using namespace std;
ll add(ll x,ll y)
{
return (x%hell+y%hell)%hell;
}
ll mul(ll x,ll y)
{
return ((x%hell)*(y%hell))%hell;
}
ll sub(ll x,ll y)
{
return (x-y+hell)%hell;
}
#define N  100005
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll t=1;
  // cin>>t;
    for(int ok=1;ok<=t;ok++)
    {
        
     string s,tt;
     cin>>s>>tt;
     ll n=s.size(),m=tt.size();
     ll ans=hell;
     for(int i=0;i<n-m+1;i++)
     {
          ll cnt=0;
          for(int j=0;j<m;j++)
          {
              if(s[j+i]!=tt[j])
              	cnt++;
          }
          ans=min(ans,cnt);
     }
     cout<<ans;

     }
    return 0;
}

Measured memory_bytes: 3620
while True:
    num_list = []
    try:num_list.append(float(input()))
    except:break
    for i in range(1,10):
        #奇数の場合だけど0スタートなので偶数扱い
        if i % 2 == 1:
            num_list.append(num_list[i-1] * 2)
        #偶数の場合だけど0スタートなので奇数扱い
        else:
            num_list.append(num_list[i-1] / 3)
    print(sum(num_list))


Measured memory_bytes: 5584
import qualified Data.ByteString.Lazy.Char8 as B
import Data.Maybe
import Data.List

solve :: Int -> Int -> [Int] -> Int
solve n x as = if k < n then k
               else if sum as == x then n
                    else (n-1)
  where
    os = sort as
    sums = scanl1 (+) os
    k = length $ takeWhile (<= x) sums


bsReadInts :: B.ByteString -> [Int]
bsReadInts = map (fst . fromJust . B.readInt) . B.words

tmain :: B.ByteString -> Int
tmain cont =
  let n : x : as = bsReadInts cont
  in solve n x as

main = putStrLn . show . tmain =<< B.getContents


Measured memory_bytes: 508
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))

ans = 0
overpower = 0
for i in range(n):
    if a[i] >= overpower:
        ans += overpower
        enemy = a[i] - overpower
    else:
        ans += a[i]
        enemy = 0
    overpower = 0
    
    if enemy >= b[i]:
        ans += b[i]
    else:
        ans += enemy
        overpower = b[i]-enemy

if a[-1]>=overpower:
    print(ans+overpower)
else:
    print(ans+a[-1])  

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


int main() {
  int N;
  cin >> N;
  vector<int> T(N);//各テストを解く時間を格納する配列
  for(int i = 0;i<N;i++){
   cin >> T[i];
  }
  
  int sum = 0;
  for(int i = 0;i<N;i++){
    sum += T[i];
  }
  
  int M;
  cin >> M;
vector<pair<int,int>> drink(M);
  for(int i = 0;i<M;i++){
    int P,X;
    cin >> P >> X;
     drink[i].first = P;
     drink[i].second = X;
  }
  
  for(int i = 0;i<M;i++){
    cout << sum - T[drink[i].first-1] + drink[i].second <<endl;
  }
}

  

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define rep(i,n) for(ll i=0;i<n;++i)
#define ALL(a) (a).begin(),(a).end()
 
using namespace std;
using ll  = long long;
using pll = pair<ll, ll>;
 
const ll MOD  = 1e9+7;
const ll LINF = 1LL << 60;
const int INF = 1e9 + 7;

struct UnionFind {
    vector<ll> parent;
    vector<ll> usize;
 
    UnionFind(int n) : parent(n), usize(n, 1LL){
        rep(i, n)parent[i]=i;
    }
    
    int root(int x){
        if(parent[x] == x) return x;
        else return parent[x] = root(parent[x]);
    }
    
    bool issame(int x, int y){
        return root(x) == root(y);
    }
    
    bool merge(int x, int y) {
        x = root(x);
        y = root(y);
 
        if(x == y)return false;
 
        if(parent[x] > parent[y]) swap(x, y);

        usize[x] += usize[y];
        parent[y] = x;
 
        return true;
    }
    
    int size(int x) {
        return usize[root(x)];
    }
};

double dist_a2b(vector<double> a, vector<double> b){
    double dif_x, dif_y, dif_z;

    dif_x = pow(a[0] - b[0], 2);
    dif_y = pow(a[1] - b[1], 2);
    dif_z = pow(a[2] - b[2], 2);

    return sqrt(dif_x + dif_y + dif_z);
}

double solve(ll n, vector<vector<double>> cell, vector<double> sphere){
    vector<double> dist;
    vector<pll> cell_pair;
    rep(i, n)rep(j, n){
        if(i == j)continue;
        dist.push_back(max(0.0, dist_a2b(cell[i], cell[j])-(sphere[i]+sphere[j])));
        cell_pair.push_back(make_pair(i, j));
    }

    vector<ll> ord(dist.size());
    iota(ALL(ord), 0);
    sort(ALL(ord), [&](ll x, ll y){
        return dist[x] < dist[y];
    });

    UnionFind uf(n);

    double res = 0.0;
    rep(i, dist.size()){
        if(!uf.issame(cell_pair[ord[i]].first, cell_pair[ord[i]].second)){
            res += dist[ord[i]];
            uf.merge(cell_pair[ord[i]].first, cell_pair[ord[i]].second);
        }
    }

    return res;
}

int main(){
    vector<double> ans;

    while(true){
        int n;
        cin >> n;

        if(n == 0)break;

        vector<vector<double>> cl(n, vector<double>(3));
        vector<double> sp(n);
        rep(i, n){
            cin >> cl[i][0] >> cl[i][1] >> cl[i][2] >> sp[i];
        }

        ans.push_back(solve(n, cl, sp));
    }

    rep(i, ans.size())printf("%.3f\n", ans[i]);
}


Measured memory_bytes: 3580
#include <iostream>

using namespace std;

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

    string res = "";
    res.append(1, a[0] - ('a' - 'A'));
    res.append(1, b[0] - ('a' - 'A'));
    res.append(1, c[0] - ('a' - 'A'));

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define eb emplace_back
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
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; }
const long long INF = 1LL<<60;
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}


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

int k,s;
cin >> k >> s;

int ans = 0;

for(int x = 0;x <= k;x++) {
    for(int y = 0;y <= k;y++){
        int z = s-x-y;
        if(z >= 0 && z <= k) ans++;
    }
}

cout << ans << endl;

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);
		String n = sc.next();
		char pn = n.charAt(0);
		boolean flag = false;
		for (int i = 1; i < 4; i++) {
			if (pn == n.charAt(i)) {
				flag = true;
				break;
			}
			pn = n.charAt(i);
		}
		if (flag) {
			System.out.println("Bad");
		} else {
			System.out.println("Good");
		}
	}
}


Measured memory_bytes: 22612
// Created by Kshitij Anand NSIT
#include <bits/stdc++.h>
//#include <ext/numeric>
//using namespace __gnu_cxx;


using namespace std;


#define int long long
#define pb push_back
#define P pair<int,int>
#define F first
#define S second
#define vi vector<int>
#define vc vector<char>
#define vb vector<bool>
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
#define mp(a, b) make_pair(a, b)
#define min3(a, b, c) min(min(a, b), c)
#define min4(a, b, c, d) min(min(a, b), min(c, d))
#define max3(a, b, c) max(max(a, b), c)
#define max4(a, b, c, d) max(max(a, b), max(c, d))
#define fill(arr,val) memset(arr,val,sizeof(arr))
#define inf 1e18
#define ps(x,y) fixed<<setprecision(y)<<x
#define db(x)  cout<<#x<<" : "<<x<<endl


const int N = 1000000007;

void solve(){

    int n,a,b,c, ans=0, count=0, sum=0;
    cin>>n;
    int arr[n + 1];
    for(int i=1;i<=n;i++){
        cin>>arr[i];
    }

    for(int i=1; i<=n; i++) {

        if(i%2 && arr[i]%2)
            count++;
    }

    cout<<count<<endl;  
}

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

  return 0;
}


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

int A, B;
vector<int> money;


int main(){
  cin >> A >> B;

  for(double c = 1; c <= 1000; c++){  //最高金額：1000
    if((int)(c * 0.08) == A && (int)(c * 0.10) == B)
      money.push_back(c);
  }

  if(money.size() == 0) cout << -1 << endl;
  else cout << (int)(money[0]) << endl;

  return 0;

}

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

using namespace std;

typedef pair<int,int> pii;
typedef long long ll;
typedef vector<int> vi;

int const MAXN = 2e5 + 10;
char arr[MAXN];
bool move_check(int init, int ending){
    if(init==ending) return true;
    while(true){
        init++;
        if(init==ending) break;
        if(arr[init]!='#') continue;
        init++;
        if(init==ending) break;
        if(arr[init]=='#') return false;
    }
    return true;
}

int main(){
    int n,a,b,c,d;
    cin >> n >> a >> b >> c >> d;
    a--;b--;c--;d--;
    for(int i=0;i<n;++i) cin >> arr[i];
    if(c>d){
        bool possible = false;
        int new_pos = 0;
        for(int i=1;i<n-1;++i){
            if(i<b) continue;
            if(arr[i-1]=='.' and arr[i]=='.' and arr[i+1]=='.' and i<=d){
                possible = true;
                arr[i] = '#';
                new_pos = i;
                break;
            }
        }
        if(!possible or !move_check(a,c) or !(move_check(b,new_pos) and move_check(new_pos,d))){
            cout << "No" << endl;
        }else{
            cout << "Yes" << endl;
        }
    }else{
        if(!move_check(b,d) or !move_check(a,c)) cout << "No" << endl;
        else cout << "Yes" << endl;
    }
}

Measured memory_bytes: 384
def insertionSort(a,n,g):
    for i in range(g,n):
        v = a[i]
        j = i - g
        while j >= 0 and a[j] > v:
            a[j+g] = a[j]
            j = j - g
            cnt[0] += 1
        a[j+g] = v
    return
    
def shellSort(a,n):
    h = 1
    while h <= n:
        g.append(h)
        h = 3*h + 1
    m[0] =  len(g)
    for i in range(m[0])[::-1]: insertionSort(a,n,g[i])
    return

if __name__ == "__main__":
    n = int(input())
    a = [int(input()) for _ in range(n)]
    g = []
    cnt = [0]
    m = [0]
    shellSort(a,n)
    print(m[0])
    print(" ".join(map(str,g[::-1])))
    print(cnt[0])
    print("\n".join(map(str,a)))


Measured memory_bytes: 125980
S=input()
from collections import Counter
c=Counter(S).most_common()
x=[i[1] for i in c]
l,k=len(S),len(c)
if k==1:
    y=[1]
elif k==2:
    y=[1,1]
else:
    y=[(l+2)//3,(l+1)//3,l//3]
print('YES' if x==y else 'NO')

Measured memory_bytes: 3444
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define ld long double
#define rep(i,a,n) for (ll i=a;i<n;i++)
#define per(i,a,n) for (ll i=n-1;i>=a;i--)
#define all(x) (x).begin(),(x).end()
#define sz(x) (ll)x.size()
#define pb push_back


///Input/Output macros!
#define gi(x) scanf("%d", &x)
#define gi2(x, y) scanf("%d%d", &x, &y)
#define gi3(x, y, z) scanf("%d%d%d", &x, &y, &z)
#define gill(x) scanf("%lld", &x)
#define gill2(x, y) scanf("%lld%lld", &x, &y)
#define gill3(x, y, z) scanf("%lld%lld%lld", &x, &y, &z)
#define pi(x) printf("%d\n", x)
#define pill(x) printf("%lld\n", x)


///Basic Debugging macros!
#define printVar(n) cout<<#n<<": "<<n<<endl
#define printArr(a,l) cout<<#a<<": ";for(ll __i__=0;__i__<l;__i__++){cout<<a[__i__]<<" ";}cout<<endl
#define print2dArr(a,r,c) cout<<#a<<":\n";for(ll __i__=0;__i__<r;__i__++){for(ll __j__=0;__j__<c;__j__++){cout<<a[__i__][__j__]<<" ";}cout<<endl;}

using namespace std;

///Power of 2 till 2^31!
ll pow2[32] = {1,2,4,8,16,32,64,128,256,512,1024,2048,4096,8192,16384,32768,65536,131072,262144,524288,1048576,2097152,4194304,8388608,16777216,33554432,67108864,134217728,268435456,536870912,1073741824,2147483648};

///Power function!
ll power(ll x,ll y)
{
        ll res = 1;
        while(y>0){
            if(y&1)
                res *= x;
            y>>=1;
            x*=x;
        }
        return res;
}

///Basic Sieve of Eratosthenes!
void Sieve(ll n)
{
    bool prime[n+1];
    memset(prime, true, sizeof(prime));
    for (ll p=2; p*p<=n; p++)
    {
        if (prime[p] == true)
        {
            for (ll i=p*p; i<=n; i += p)
                prime[i] = false;
        }
    }
    for (ll p=2; p<=n; p++)
       if (prime[p])
        cout<<p<<' ';
          //cout <<  << " ";
}

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

bool isPerfectSquare(ll x){ ll s = sqrt(x); return (s*s == x);}

bool isFibonacci(int n){return isPerfectSquare(5*n*n + 4) || isPerfectSquare(5*n*n - 4);}

bool isPrime(int n){if (n <= 1)return false;if (n <= 3)  return true;
    if (n%2 == 0 || n%3 == 0) return false;
    for (int i=5; i*i<=n; i=i+6) if (n%i == 0 || n%(i+2) == 0)return false;
    return true;
}

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;


const int MOD = 1000000007;
const long double PI = 4*atan((long double)1);
const ll INF = 1e18;

int main()
{
    ios::sync_with_stdio(false);
    int r;
    cin>>r;
    cout<<(r*r)<<'\n';
    return 0;
}


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

template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)

int main(){
    int n,k;
    cin>>n>>k;
    long double ans=0;
    rep(i,1,n+1){
        int j=i;
        int ctr=0;
        while(j<k){
            j=(j<<1);
            ++ctr;
        }
        ans+=(long double)1/(long double)((1<<ctr)*n);
    }
    cout<<setprecision(12)<<ans<<endl;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
REP(i,v.size()){if(i)os<<" ";os<<v[i];}return os;}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
REP(i,v.size()){if(i)os<<endl;os<<v[i];}return os;}

int main() {
    // Write Your Code Below
    
   int A, B, T;
   cin >> A >> B >> T ;
   cout << (T/A)*B << endl;
   

}


Measured memory_bytes: 256
while(n,_=gets.split)[i=j=0]>?0
m=(?1..n).map{gets}
h={}
while !h[k=[j,i]]&&?.<c=m[i][j]
h[k]=c<?^?(j+=c<?>?-1:1):(i+=c<?v?-1:1)end
puts h[k]?:LOOP:k*" "end

Measured memory_bytes: 6112
#include <bits/stdc++.h>
using namespace std;
int w,h,c[100][100],ans;
pair<int,int> movemy[8]={{0,1},{1,0},{1,1},{-1,0},{0,-1},{-1,1},{1,-1},{-1,-1}};


void land(int y,int x){
	if(y<0||y>h-1||x<0||x>w-1||c[y][x]==0)return;
	c[y][x]=0;
	for(int i=0;i<8;i++){
		land(y+movemy[i].first,x+movemy[i].second);
	}
}

int main(){
	while (1){
		ans=0;
		cin>>w>>h;
		if(w==0||h==0)break;
		for(int i=0;i<h;i++){
			for(int j=0;j<w;j++){
				cin>>c[i][j];
				//cout<<"AAA"<<endl;
			}
		}
		//cout<<"AAA"<<endl;
		for(int i=0;i<h;i++){
			for(int j=0;j<w;j++){
				if(c[i][j]){land(i,j);ans++;}
				
			}
		}
		cout<<ans<<endl;
	}
}



Measured memory_bytes: 3180