akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Collections;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.IO;
using System.Reflection;
using static System.Math;
using System.Numerics;
static class Program{
	const int mod=(int)1e9+7;
	static void Main(){
		Sc sc=new Sc();
		var s=sc.Ia;
		for(int i = 1;i<100000;i++) {
			if(s[0]==Floor(i*0.08)&&s[1]==i/10){
				Console.WriteLine(i);
				return;
			}
		}
		Console.WriteLine("{0}",-1);
	}
}
public class Sc{
	public int I{get{return int.Parse(Console.ReadLine());}}
	public long L{get{return long.Parse(Console.ReadLine());}}
	public double D{get{return double.Parse(Console.ReadLine());}}
	public string S{get{return Console.ReadLine();}}
	public int[] Ia{get{return Array.ConvertAll(Console.ReadLine().Split(),int.Parse);}}
	public long[] La{get{return Array.ConvertAll(Console.ReadLine().Split(),long.Parse);}}
	public double[] Da{get{return Array.ConvertAll(Console.ReadLine().Split(),double.Parse);}}
	public string[] Sa{get{return Console.ReadLine().Split();}}
	public object[] Oa{get{return Console.ReadLine().Split();}}
	public int[] Ia2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),int.Parse);}}
	public int[] Ia3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),int.Parse);}
	public int[] Ia3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),int.Parse);}
	public long[] La2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),long.Parse);}}
	public long[] La3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),long.Parse);}
	public long[] La3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),long.Parse);}
	public double[] Da2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),double.Parse);}}
	public double[] Da3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),double.Parse);}
	public double[] Da3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),double.Parse);}
	public T[] Arr<T>(int n,Func<T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f();}return a;}
	public T[] Arr<T>(int n,Func<int,T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i);}return a;}
	public T[] Arr<T>(int n,Func<string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(Console.ReadLine().Split());}return a;}
	public T[] Arr<T>(int n,Func<int,string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i,Console.ReadLine().Split());}return a;}
}

Measured memory_bytes: 13268
#include <bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
  string s;
  cin>>s;
  for (int i=0;i<s.length();i++)
  {
    if (s.at(i)=='?')
      cout<<'D';
    else
      cout<<s.at(i);
  }
  return 0;
}

Measured memory_bytes: 3724
#include <iostream>
#include <string>
#include <cctype>
#include <cstring>
#include <algorithm>
using namespace std;
typedef long long ll;
const ll MOD = ll(1e9 + 7);
string A, B, C;

int N;
ll dp[51][2];

int main() {
	while(cin >> A, A != "0") {
		cin >> B >> C;
		reverse(A.begin(), A.end());
		reverse(B.begin(), B.end());
		reverse(C.begin(), C.end());

		N = A.size();
		memset(dp, 0, sizeof dp);
		dp[0][0] = 1;
		for(int i = 0; i < N; i++) {
			for(int c = 0; c < 2; c++) {
				//cerr << i << " " << c << " " << le << " " << dp[i][c][le] << endl;

				if(dp[i][c] == 0) continue;

				int fixa = -1, fixb = -1;
				if(isdigit(A[i])) fixa = A[i] - '0';
				if(isdigit(B[i])) fixb = B[i] - '0';
				for(int a = 0; a < 10; a++) {
					if(fixa != -1 && a != fixa) continue;
					if(i == N - 1 && a == 0) continue;
					for(int b = 0; b < 10; b++) {
						if(fixb != -1 && b != fixb) continue;
						if(i == N - 1 && b == 0) continue;

						int s = a + b + c;
						int x = s % 10;

						//cerr << "\t" <<  a << " " << b << " " << x << endl;
						if(isdigit(C[i]) && C[i] - '0' != x) continue;

						int ncarry = s / 10;

						dp[i + 1][ncarry] += dp[i][c];
						dp[i + 1][ncarry] %= MOD;
					}
				}
			}
		}

		cout << dp[N][0] << endl;
	}
	return 0;
}

Measured memory_bytes: 3076
#include<bits/stdc++.h>
#define REP(x,y,z) for(int x=y;x<=z;x++)
#define FORD(x,y,z) for(int x=y;x>=z;x--)
#define MSET(x,y) memset(x,y,sizeof(x))
#define FOR(x,y) for(__typeof(y.begin()) x=y.begin();x!=y.end();x++)
#define F first
#define S second
#define MP make_pair
#define PB push_back
#define SZ size()
#define M 100005
void RI(){}
template<typename... T>
void RI( int& head, T&... tail ) {
  scanf("%d",&head);
  RI(tail...);
}
using namespace std;
typedef long long LL;
int ar[M];
int main()
{  
	LL sum = 0;
	int n, neg = 0, mi = 1e9;
	cin >> n;
	for(int i = 0; i < n; i++) {
		cin >> ar[i];
		if(ar[i] < 0) neg++;
		sum += abs(ar[i]);
		mi = min(mi, abs(ar[i]) );
	}
	if(neg&1) sum -= (2*mi);
	cout << sum << endl;
  return 0;
}


Measured memory_bytes: 640
import sys
from heapq import*
r=sys.stdin.readline
def g(n,E,S,G):
 F=[1e7]*-~n;F[S]=0
 H=[(0,S)]
 while H:
  c,u=heappop(H)
  if u==G:return c
  for f,v in E[u]:
   t=c+f
   if t<F[v]:
    F[v]=t
    heappush(H,(t,v))
 return-1
def s(n,k):
 E=[[]for _ in[0]*-~n]
 for _ in[0]*k:
  f=r()
  if'0'==f[0]:print(g(n,E,*map(int,f[2:].split())))
  else:
   c,d,e=map(int,f[2:].split())
   E[c]+=[(e,d)];E[d]+=[(e,c)]
if'__main__'==__name__:
 for e in iter(r,'0 0\n'):s(*map(int,e.split()))


Measured memory_bytes: 6312
function main(input) {
    input = input.trim().split(" ");
    var a = parseInt(input[0], 10);
    var b = parseInt(input[1], 10);
    var c = parseInt(input[2], 10);

    if (a+b+c >= 22) {
        console.log("bust");
    } else {
        console.log("win");
    }
  }
   
  main(require("fs").readFileSync("/dev/stdin", "utf8"));



Measured memory_bytes: 7372
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; i++)
#define repr(i, n) for(int i = n; i >= 0; i--)
#define reps(i,a,b) for(int i= a; i < b; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main()
{
  int n, x, y;
  cin >> n >> x >> y;
  vector<int> vec(n, 0);
  reps(i, 1, n+1) {
    reps(j, i+1, n+1) {

      int a = abs(j - i);
      int b = abs(j-y) + 1 + abs(x-i);
      int c = abs(i-y) + 1 + abs(x-j);
      vec.at(min(a, min(b, c)))++;
      
    }
  }
  reps(i, 1, n) {
    cout << vec.at(i) << endl;
  }
  return 0;
}

Measured memory_bytes: 3608
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main
{
	public static void main(String[] args)
	{
		new Thread(null, new Runnable() {
			public void run() {
                solve();
            }
        }, "1", 1 << 26).start();
	}
	static void solve () {
		FastReader fr =new FastReader();	PrintWriter op =new PrintWriter(System.out);
 	
 		String s =fr.next() ;	boolean f =false ;
 		if (s.charAt(2)==s.charAt(3)) {
 			if (s.charAt(4)==s.charAt(5))	f =true ;
 		}
 		if (f)	op.println("Yes") ;
 		else 	op.println("No") ;
		op.flush();	op.close();
	}
	static class FastReader {
		BufferedReader br;
		StringTokenizer st;

		public FastReader() {
			br =new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st==null || (!st.hasMoreElements())) 
			{
				try
				{
					st =new StringTokenizer(br.readLine());
				}
				catch(IOException e)
				{
					e.printStackTrace();
				}
				
			}
			return st.nextToken();
		}

		String nextLine() {
			String str ="";

			try
			{
				str =br.readLine();
			}
			catch(IOException e)
			{
				e.printStackTrace();
			}

			return str;
		}

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

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

Measured memory_bytes: 24532
n, l = map(int, input().split())
taste = [l+i-1 for i in range(1, n+1)]
sm = sum(taste)
mn = 10**4
ans = 0
for i in range(n):
  if abs(sm - (sm-taste[i])) < mn:
    mn = abs(sm - (sm-taste[i])) 
    ans = sm-taste[i]
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
 
#ifndef LOCAL_
#define fprintf if( false ) fprintf
#endif // LOCAL_
#define dumpi(x1) fprintf(stderr, "#%s.%d (%s) = (%d)\n", __func__, __LINE__, #x1, x1);
#define dumpii(x1, x2) fprintf(stderr, "#%s.%d (%s, %s) = (%d, %d)\n", __func__, __LINE__, #x1, #x2, x1, x2);
#define dumpiii(x1, x2, x3) fprintf(stderr, "#%s.%d (%s, %s, %s) = (%d, %d, %d)\n", __func__, __LINE__, #x1, #x2, #x3, x1, x2, x3);
#define dumpl(x1) fprintf(stderr, "#%s.%d (%s) = (%ld)\n", __func__, __LINE__, #x1, x1);
#define dumpll(x1, x2) fprintf(stderr, "#%s.%d (%s, %s) = (%ld, %ld)\n", __func__, __LINE__, #x1, #x2, x1, x2);
#define dumpd(x1) fprintf(stderr, "#%s.%d (%s) = (%lf)\n", __func__, __LINE__, #x1, x1);
#define dumpdd(x1, x2) fprintf(stderr, "#%s.%d (%s, %s) = (%lf, %lf)\n", __func__, __LINE__, #x1, #x2, x1, x2);
 
struct S002 {
  int n;
  S002& operator > (long& x) {
    n = x;
    return *this;
  }
  S002& operator >= (long& x) {
    if( scanf("%ld", &x) <= 0 ) exit(0);
    return *this;
  }
  S002& operator >= (double& x) {
    if( scanf("%lf", &x) <= 0 ) exit(0);
    return *this;
  }
  S002& operator >= (std::string& s) {
    if( not (std::cin >> s) ) exit(0);
    return *this;
  }
  template<typename a>
  S002& operator >= (std::vector<a>& v) {
    v.resize(n);
    for(long i = 0; i < n; ++i) {
      *this >= v[i];
    }
    return *this;
  }
  template<typename a, std::size_t s>
  S002& operator >= (std::array<a, s>& x) {
    for(long i = 0; i < (long)s; ++i) {
      *this >= x[i];
    }
    return *this;
  }
};

struct Solver {
  long a, b, h;
  Solver() {
    S002 r;
    r >= a >= b >= h;
  }
  void solve() {
    long res = (a + b) * h / 2;
    printf("%ld\n", res);
  }
};
 
int main() {
  for(;;) std::unique_ptr<Solver>(new Solver())->solve();
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin>>n;
	vector<int>v(n);
	for(auto& p:v){
		cin>>p;
	}
	vector<int>b=v;
	sort(b.rbegin(),b.rend());
	for(int i=0;i<n;i++){
		if(v[i]==b[0])cout<<b[1]<<endl;
		else cout<<b[0]<<endl;
	}
	return 0;
}

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

int main()
{
  int N, cnt = 0, xa = 0, bx = 0, bxa = 0;
  string s;
  cin >> N;
  for (int i = 0; i < N; i++)
  {
    cin >> s;
    if (s.at(0) == 'B' && s.at(s.size() - 1) == 'A')
      bxa++;
    else if (s.at(0) == 'B')
      bx++;
    else if (s.at(s.size() - 1) == 'A')
      xa++;

    for (int j = 0; j < s.size() - 1; j++)
    {
      if (s.at(j) == 'A' && s.at(j + 1) == 'B')
      {
        cnt++;
      }
    }
  }
  cnt += min(bx, xa);
  if (bx > 0 || xa > 0)
  {
    cnt += bxa;
  }
  else if (bxa > 1)
  {
    cnt += bxa - 1;
  }
  cout << cnt << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <functional>
#include <string>
#include <cstdlib>
#include <numeric>
#include <cstdbool>
#include <map> 
using namespace std;

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

const long long INF = 1LL << 60;
int n[100];int k[50];
int main()
{
	int a, b, c;
	string ans = "NO";
	cin >> a >> b >> c;
	for (int i = 1; i <= b; i++) {
		int d = a * i;
		if (d%b == c) {
			ans = "YES";
			break;
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

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

    static final class DivisionorSubstraction {
        public void solve(int __, InputReader in, PrintWriter out) {
            long n = in.nextLong();
            long answer = n == 2 ? 1 : 2;
            long d;
            for (d = 2; d * d <= n; ++d) {
                long m = n;
                while (m % d == 0) {
                    m /= d;
                }
                if (m % d == 1) {
                    answer++;
                }
            }
            for (long k = 2; k * k <= n - 1; ++k) {
                if ((n - 1) % k == 0) {
                    if (k >= d) {
                        answer++;
                    }
                    if ((n - 1) / k >= d) {
                        answer++;
                    }
                }
            }
            out.println(answer);
        }

    }

    static class InputReader {
        private final BufferedReader reader;
        private StringTokenizer tokenizer;

        public InputReader(InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
        }

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

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                tokenizer = new StringTokenizer(readLine());
            }
            return tokenizer.nextToken();
        }

        public String readLine() {
            String line;
            try {
                line = reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
            return line;
        }

    }
}



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

int main() {
	int n;
	cin>>n;
	int a[n],i,count=0;
	for(i=0;i<n;i++)
	  {cin>>a[i];
	  	if(a[i]%2!=0)
	  	  {
	  	  	 cout<<"first"<<'\n';
	  	  	 return 0;
	  	  }
	  }
	 cout<<"second"<<'\n'; 
	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1e9+7;
int main() {
    ll N;
    cin >> N;
    ll a,b,c;
    for(ll i=1;i<=3500;i++){
        for(ll j=i;j<=3500;j++){
            if((4*i*j-i*N-j*N)>0){
                if((i*j*N)%(4*i*j-i*N-j*N)==0){
                    a=i,b=j;
                    c=(i*j*N)/(4*i*j-i*N-j*N);
                }
            }
        }
    }
    cout << a << " " << b << " " << c << endl;
}

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

typedef long long ll;

int main()
{
   ios::sync_with_stdio(false);
   cin.tie(0);
   
   int a,b;
   cin>>a>>b;
   cout<<(b-a)*(b-a-1)/2-a<< endl;
   return 0;
}


Measured memory_bytes: 256
#include<iostream>
int main()
{
	char val[2000][1001];
	int num;
	for(int i = 0;; i++)
	{
		std::cin >> val[i];
		if(val[i][0] == '0' && val[i][1] == '\0')
		{
			num = i;
			break;
		}
	}
	for(int i = 0; i < num; i++)
	{
		int sum = 0;
		for(int j = 0; val[i][j] != '\0'; j++)
		{
			sum += (int)val[i][j] - 48;
		}
		std::cout << sum << std::endl;
	}
	return 0;
}


Measured memory_bytes: 3124
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; ++i)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = int64_t;
using ld = long double;
using P = pair<int, int>;
using vs = vector<string>;
using vi = vector<int>;
using vvi = vector<vi>;
template<class T> using PQ = priority_queue<T>;
template<class T> using PQG = priority_queue<T, vector<T>, greater<T> >;
const int INF = 100010001;
const ll LINF = (ll)INF*INF*10;
template<typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) {return a < b && (a = b, true);}
template<typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) {return a > b && (a = b, true);}
template<typename T1, typename T2>
istream &operator>>(istream &is, pair<T1, T2> &p) { return is >> p.first >> p.second;}
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) { return os << p.first << ' ' << p.second;}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int D;
    cin >> D;
    vi c(26);
    rep(i, 26) cin >> c[i];
    vvi s(D, vi(26));
    rep(i, D) rep(j, 26) {
        cin >> s[i][j];
    }

    vi t(D);
    rep(i, D) cin >> t[i];
    vi last(26);
    int gh = 0;
    rep(d, D) {
        gh += s[d][t[d]-1];
        last[t[d]-1] = d+1;
        rep(j, 26) {
            gh -= c[j]*(d+1-last[j]);
        }
        cout << gh << '\n';
    }
}

Measured memory_bytes: 3700
from bisect import *
def alph_to_num(s):
  return ord(s)-ord('a')
def solve():
  ans = 0
  S = input()
  T = input()
  lis = [[] for _ in range(26)]
  for i,s in enumerate(S):
    lis[alph_to_num(s)].append(i)
  ind = -1
  for t in T:
    n = alph_to_num(t)
    if not len(lis[n]):
      return -1
    if ind>=lis[n][-1]:
      ans += len(S)
      ind = lis[n][0]
    else:
      ind = lis[n][bisect_right(lis[n],ind)]
  ans += ind+1
  return ans
print(solve())

Measured memory_bytes: 13492
import java.io.*;
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		String s = in.next();

		HashMap codeMap = new HashMap();
		for (int i=0; i<10; i++) {
			int index1 = s.indexOf('0' + i);
			if (index1 == -1)
				continue;
			for (int j=0; j<10; j++) {
				int index2 = s.substring(index1+1).indexOf('0' + j);
				if (index2 == -1)
					continue;
				for (int k=0; k<10; k++) {
					int index3 = s.substring(index1+1+index2+1).indexOf('0' + k);
					if (index3 == -1)
						continue;
					String key = "" + s.charAt(index1);
					key += s.charAt(index1+1+index2);
					key += s.charAt(index1+1+index2+1+index3);
					codeMap.put(key,"");
				}
			}
		}
		System.out.println(codeMap.size());
	}
}

Measured memory_bytes: 57172
N = int(input())
*A, = map(int, input().split())
colors = [False]*8
changeable = 0
for a in A:
    q, _ = divmod(a, 400)
    if q < 8:
        colors[q] = True
    else:
        changeable += 1
c = sum(colors)
print(c if c > 0 else 1, sum(colors) + changeable)

Measured memory_bytes: 3064
#include<stdio.h>
#include<math.h>

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

int lcm(int a,int b,int c){
	if(a*b<0)
    return pow(10,log10(a)+log10(b)-log10(c));
    else
    return a*b/c;
}
int main()
{
	int a,b;
	int temp;
	while(1){
		if(scanf("%d%d",&a,&b)==EOF) break;
	    if(a<b){
		    temp=a;
		    a=b;
		    b=temp;
	    }
		printf("%d %d\n",gcd(a,b),lcm(a,b,gcd(a,b)));
	}
}

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

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

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

using namespace std;

int main()
{
	string s, ans;
	cin >> s;
	for (int i = 0; i < s.size(); i++)
	{
		if (!(i & 1))
		{
			ans += s[i];
		}
	}
	cout << ans << '\n';
}

Measured memory_bytes: 512
#include <iostream>
#include <stdio.h>
using namespace std;
int main(){
	int H,W,i,j,k;
	for(k;;k++){	
	
	cin >> H >> W;	
		if(H==0 && W==0){
			break;
		}
		else{
		for(j=1;j<=H;j++){
			for(i=1;i<=W;i++){
				if(i%2==0 && j%2==0){
					cout << "#";
				}
				else if (i%2==1 && j%2==0){
					cout << ".";
				}
				else if (i%2==0 && j%2==1){
					cout << ".";
				}
				else if(i%2==1 && j%2==1){
					cout << "#";
				}
			}
		cout << endl;
		}
		cout << endl;
		}	
	}
	return 0;
}

Measured memory_bytes: 1152
import java.io.*;
public class Main {
	public static void main(String[] args)throws IOException {
		
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		String str = br.readLine();
		
		String[] i = str.split(" ");
		int a = Integer.parseInt(i[0]);
		int b = Integer.parseInt(i[1]);
		
		int d = a/b;
		int e = a%b;
		double f = (double)a/b;
		
		System.out.printf("%d %d %.5f",d,e,f);
				
	}

}

Measured memory_bytes: 17112
#include <bits/stdc++.h>
using namespace std;
#define int long long
int MAX=1000000007;


signed main() {
    int n;
    cin>>n;
    int s[n];
    for(int i =0;i<n;i++)cin>>s[i];
    int k[n];
    for(int i=0;i<n;i++)k[i]=s[i]+s[n-1-i];
    int ans=0,ans2=0,d=0,p=0;
    for(int i=1;i<n;i++){
        ans2=0;d=0;p=0;
        if((n-1)%i==0){
            d+=i;
            while(2*d<(n-1)){
                p+=k[d];
                if(p>0){
                    ans2+=p;
                    p=0;
                }
                d+=i;
            }
        }else{
            d+=i;
            while(d<n-1-i){
                p+=k[d];
                if(p>0){
                    ans2+=p;
                    p=0;
                }
                d+=i;

            }
        }
        ans=max(ans,ans2);
    }
    cout<<ans;


    return 0;


}


Measured memory_bytes: 1792
#include <iostream>
using namespace std;
int main()
{
	long long int H, W;
	cin >> H >> W;
	if (H == 1 || W == 1)
		cout << "1" << "\n";
	else if (H % 2 == 0)
		cout << H / 2 * W << "\n";
	else
		cout << H / 2 * W + W - W / 2 << "\n";
}

Measured memory_bytes: 3600
# https://onlinejudge.u-aizu.ac.jp/problems/1167


def porok(n):
    return n * (n+1) * (n+2) // 6


def dp_1(n):
    for j in poroks_odd:
        for i in range(j, n+1):
            tmp = dp[i-j] + 1
            if dp[i-j] + 1 < dp[i]:
                dp[i] = dp[i-j] + 1


def dp_2(n):
    for j in poroks_even:
        for i in range(j, n+1):
            tmp = dp[i-j] + 1
            if dp[i-j] + 1 < dp[i]:
                dp[i] = dp[i-j] + 1


if __name__ == "__main__":
    query_list = []
    ans_even = []
    while(True):
        n = int(input())
        if n == 0:
            break
        query_list.append(n)

    poroks = [i * (i + 1) * (i + 2) // 6 for i in range(1, 181)]
    poroks_odd = [
        porok_number for porok_number in poroks if porok_number % 2 == 1]
    poroks_even = [
        porok_number for porok_number in poroks if porok_number % 2 == 0]
    dp = [100] * (max(query_list)+1)
    dp[0] = 0

    dp_1(max(query_list))

    for q in query_list:
        ans_even.append(dp[q])

    dp_2(max(query_list))

    for i, q in enumerate(query_list):
        print('{} {}'.format(dp[q], ans_even[i]))



Measured memory_bytes: 13184
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
#include <tuple>
#define mkp make_pair
#define mkt make_tuple
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const ll MOD=1e9+7;
template<class T> void chmin(T &a,const T &b){if(a>b) a=b;}
template<class T> void chmax(T &a,const T &b){if(a<b) a=b;}

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

  int K;
  cin>>K;

  vector<ll> v;
  rep(i,9) v.push_back(i+1);

  if(K<=v.size()){
    cout<<v[K-1]<<endl;
    return 0;
  }
  K-=v.size();

  while(1){
    vector<ll> nx;
    for(int i=0;i<v.size();i++){
      for(int j=0;j<=9;j++){
        if(abs(v[i]%10-j)>1) continue;
        nx.push_back(v[i]*10+j);
      }
    }
    v=nx;
    if(K>nx.size()) K-=nx.size();
    else break;
  }
  sort(v.begin(),v.end());

  cout<<v[K-1]<<endl;

  return 0;
}


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

int main() {
  int N, M;
  scanf("%d%d", &N, &M);
  vector<bool> AC(N);
  vector<int> WA(N);

  int ac_num = 0;
  for (int i = 0; i < M; i++) {
    int p = 0;
    scanf("%d", &p);
    string S;
    cin >> S;
    if (S == "AC" && AC.at(p - 1) == false) {
      AC.at(p - 1) = true;
      ac_num++;
    } else if (S == "WA" && AC.at(p - 1) == false) {
      WA.at(p - 1)++;
    }
  }

  int penalty_num = 0;
  for (int i = 0; i < N; i++) {
    if (AC.at(i) == true) penalty_num += WA.at(i);
  }

  printf("%d %d", ac_num, penalty_num);
  return 0;
}


Measured memory_bytes: 640
import Foundation
 
let input_line = readLine()!
 
let split = input_line.componentsSeparatedByString(" ") //components(separatedBy:)と実質同じ
let P = Int(split[0])!
let Q = Int(split[1])!
let R = Int(split[2])!
 
let value1 = P + Q
let value2 = P + R
let value3 = Q + R

if value1 <= value2 && value1 <= value3 {
    print(value1)
} else if value2 <= value3 {
    print(value2)
} else {
    print(value3)
}

Measured memory_bytes: 7780
#include <cstdio>
#define rep(i,j,k) for (i=j;i<=k;i++)
using namespace std;
const int N=3e3+5,mod=1e9+7;
int n,m,i,j,p,ans,f[N][N][2];
void updata(int &x,int y) { x+=y; if (x>=mod) x-=mod; }
int main()
{
//	freopen("piling.in","r",stdin);
//	freopen("piling.out","w",stdout);
	scanf("%d%d",&n,&m);
	f[0][0][1]=1;
	rep(i,1,n) f[0][i][0]=1;
	rep(i,0,m-1)
		rep(j,0,n)
			rep(p,0,1)
			if (f[i][j][p])
			{
				if (j) updata(f[i+1][j-1][p|(j==1)],f[i][j][p]);
				if (j) updata(f[i+1][j][p|(j==1)],f[i][j][p]);
				if (n-j) updata(f[i+1][j][p],f[i][j][p]);
				if (n-j) updata(f[i+1][j+1][p],f[i][j][p]);
			}
	rep(i,0,n)
		updata(ans,f[m][i][1]);
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 70656
A, B, C = gets.split.map(&:to_i)
K = gets.to_i
(K+1).times do |a|
    (K-a+1).times do |b|
        c = K - (a + b)
        x = a == 0 ? A : A*(2**a)
        y = b == 0 ? B : B*(2**b)
        z = c == 0 ? C : C*(2**c)
        if y > x && z > y
            puts 'Yes'
            exit
        end
    end
end
puts 'No'

Measured memory_bytes: 14196
#include <iostream>
#include <vector>
#include <string.h>
using namespace std;

typedef long long ll;
int N,M,P;
ll D[2510];
bool negative[2510];
ll inf = 1e18;
struct edge {int from,to; ll cost;};

vector<edge> v;

void shortest_path(int s){
	for(int i=1;i<=N;i++) D[i] = inf;
	D[s] = 0;
	for(int j=0;j<N-1;j++){
		for(int i=0;i<v.size();i++){
			edge e = v[i];
			if(D[e.from] != inf && D[e.to] > D[e.from] + e.cost){
				D[e.to] = D[e.from] + e.cost;
			}
		}
	}
}

void find_negative_loop(){
	for(int i=1;i<=N;i++) negative[i] = false;
	for(int i=1;i<=N;i++){
		for(int j=0;j<v.size();j++){
			edge e = v[j];
			if(D[e.to]!=inf && D[e.to] > D[e.from] + e.cost){
				D[e.to] = D[e.from] + e.cost;
				negative[e.to] = true;
			}
			if(negative[e.from]) negative[e.to] = true;
		}
	}
}

int main(){
	cin >> N >> M >> P;
	for(int i=0;i<M;i++){
		int a,b,c;
		cin >> a >> b >> c;
		v.push_back((edge{a,b,P-c}));
	}
	shortest_path(1);
	ll ans = max(-D[N],0LL);
	find_negative_loop();
    cout << (negative[N]? -1:ans) << endl;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define REP(i, s, n) for (int i = s; i < n; i++)
#define ALL(a) a.begin(), a.end()
#define MOD 1000000007
using namespace std;
typedef long long ll;

int N;

void generate(string S, char m) {
    if (S.size() == N) {
        cout << S << endl;
        return;
    }

    for (char c = 'a'; c <= m; c++) {
        generate(S + c, (c == m) ? m + 1 : m);
    }
}

int main() {
    cin >> N;
    generate("", 'a');
    return 0;
}

Measured memory_bytes: 1536
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

#define lli long long int
#define REP(i,n) for(int i=0;i<n;i++)
#define DEBUG 1

#define KABE -1
#define WHITE 0
#define BLACK 1

lli data[60][60];

lli abs2(lli a){
	if(a>=0)return a;
	else return -a;
}

lli isAroundBlack(lli nowI,lli nowJ){
	lli next[2][4] = {{-1,0,1,0},{0,1,0,-1}};
	lli ans = 0;
	for(lli i=0;i<4;i++){
		lli nextI = nowI + next[0][i];
		lli nextJ = nowJ + next[1][i];
		if(data[nextI][nextJ] == BLACK){
			ans = 1;
		}
	}
	return ans;
}

int main(){

	lli h,w;
	cin>>h>>w;
	string str;

	for(lli i=0;i<=h+1;i++){
		if( 1<=i && i <= h){
			cin>>str;
		}
		for(lli j=0;j<=w+1;j++){
			if(i==0 || i==h+1 || j==0 || j==w+1){
				data[i][j] = KABE;
			}
			else{
				if(str.at(j-1)=='.'){
					data[i][j] = WHITE;
				}
				else{
					data[i][j] = BLACK;
				}
			}
		}
	}

	/* 隣接している黒マスの数を数え上げる*/
	/* その数が1のものがあればOUT*/

	for(lli i=1;i<=h;i++){
		for(lli j=1;j<=w;j++){
			if(data[i][j] == 0)continue;

			lli flag = isAroundBlack(i,j);
			if(flag==0){
				cout<<"No"<<endl;
				return 0;
			}
		}
	}

	cout<<"Yes"<<endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <cstdlib>
#include <map>
#include <queue>
#include <algorithm>
#include <stack>
#include <functional>
#define rep(i,j,n) for(i=j;i<(n);i++)
#define rrep(i,j,n) for(i=j;i>(n);i--)
typedef long long int lli;
#define N 1000000007

using namespace std;

int main(){
    lli n,Min,a,b,c,d,e,ans;
    lli i,j;
    cin>>n>>a>>b>>c>>d>>e;
    Min=min({a,b,c,d,e});
    ans=((n+Min-1)/Min)+4;
//    if(n%Min!=0){
//        b++;
//    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
from collections import deque

class abc_158:
    
    def __init__(self):
        pass
    
    def A(self):
        S=input()
        if "BA" in S or "AB" in S:print("Yes")
        else:print("No")
    
    def B(self):
        NAB=list(map(int,input().split()))
        
        if NAB[0]<=NAB[1]:ans=NAB[0]
        elif NAB[0]<=NAB[1]+NAB[2]:ans=NAB[1]
        else:
            tail = NAB[0]%(NAB[1]+NAB[2]) if NAB[0]%(NAB[1]+NAB[2])<NAB[1] else NAB[1]
            ans=(int(NAB[0]/(NAB[1]+NAB[2]))*NAB[1])+tail
            
        print(int(ans))
            
    def C(self):
        AB=list(map(int,input().split()))
        ans=-1
        
        #A<B<100
        for i in range(1,1001):
            if AB[0]==int(i*0.08) and AB[1]==int(i*0.1):
                ans=i
                break
            else:continue
        print(ans)
            
    def D(self):
        S=input()
        Q=int(input())
        Q_list=[list(input().split()) for i in range(Q)]
        d=deque()
        top=True
        end=False
        count_revers=0
        
        d.append(S)
        for i in Q_list:
            if int(i[0])==1:
                count_revers+=1
                if top==True:
                    top=False
                    end=True
                else:
                    top=True
                    end=False
            else:
                if int(i[1])==1 :
                    if top==True:d.appendleft(i[2])
                    else:d.append(i[2])
                else :
                    if top==True:d.append(i[2])
                    else:d.appendleft(i[2])
                
        ans = "".join(list(d)) if count_revers%2==0 else  "".join(list(d))[::-1]
        print(ans)
        
    def E(self):
        pass
    
    def F(self):
        pass
    
    
if __name__=='__main__':
    obj=abc_158()
    obj.D()

Measured memory_bytes: 106968
/*01 02 03 12 13 23　と６回見ていくパターン 
for(int i=0;i<n-1;i++){
  for(int j=i+1;j<n;j++){
    }
  }
*/
//vector<vector<int>> data(3, vector<int>(4));//int型の2次元配列(3×4要素の)の宣言
//int64_t a;
//10のi乗pow(10, i);
/*string s; stringでの文字列を数字型に変える方法
  cin >> s;
  rep(i,s.size()-2) {
  int a= (s.at(i)-'0')*100 + (s.at(i+1)-'0')*10+ s.at(i+2) -'0';
    */
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
  
  int n;
  cin >> n;
  int sumcount=0;
  for(int i=1;i<=n;i=i+2){
    int count=0;
    for(int j=1;j<=n;j=j+2){
      if(i%j==0) count++;
    }
  if(count == 8){
    sumcount++;
   }
 }
  cout << sumcount <<endl;
} 

Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var n, W int
	fmt.Scanf("%d%d", &n, &W)

	ws := make([]int, n)
	vs := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scanf("%d%d", &ws[i], &vs[i])
	}

	dp := make([][]int, n+1)
	for i := range dp {
		dp[i] = make([]int, W+1)
	}

	for i := 1; i < n+1; i++ {
		for j := range dp[i-1] {
			if j-ws[i-1] >= 0 {
				dp[i][j] = max(dp[i][j], dp[i-1][j-ws[i-1]]+vs[i-1])
			}
			dp[i][j] = max(dp[i][j], dp[i-1][j])
		}
	}

	fmt.Println(dp[n][W])
}

func max(ns ...int) int {
	max := ns[0]
	for i := 1; i < len(ns); i++ {
		if max < ns[i] {
			max = ns[i]
		}
	}
	return max
}

// -----------------------------------------


Measured memory_bytes: 81792
#include <iostream>
#include <algorithm>
#define ll long long
#define MAXN 11
using namespace std;

pair<ll, ll> dp[MAXN];

pair<ll, ll> solve(string s, int ind, int N)
{
  if(ind >= N) return make_pair(0, 0);
  if(dp[ind].first == -1)
  {
    ll ways = N - ind <= 1 ? 0 : N - ind;
    ll value = 0;
    ll tot = 0;
    for(int i=ind; i<N; i++)
    {
      value *= 10;
      value += (ll)(s[i] - '0');
      pair<ll, ll> ris = solve(s, i+1, N);
      tot += (value * max(ris.second, 1LL) + ris.first);
      ways += max(ris.second-1, 0LL);
      //if(ind == 0) cout<<value<<" "<<ways<<" "<<ris.first<<" "<<ris.second<<endl;
    }
    //return make_pair(tot, ways);
    dp[ind].first = tot;
    dp[ind].second = ways;
  }
  return dp[ind];
}

int main()
{
  for(int i=0; i<MAXN; i++) dp[i] = make_pair(-1, -1);
  string s;
  cin>>s;
  cout<<solve(s, 0, s.length()).first;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <queue>
#include <map>
#include <cmath>
#include <numeric>
#include <iomanip>
#include <set>
#include <string.h>

using namespace std;

typedef long long ll;

#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define REP3(i,st,en) for(ll (i)=(st);(i)<(en);(i)++)

using P = pair<ll, ll>;
const int MOD = 1e9+7;
const ll INF = 1e+14;
const double PI = 3.14159265349;



int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  string N;
  ll K;
  cin >> N >> K;

  ll D = N.length();

  vector<vector<ll>> dp0(D,vector<ll>(4,0));  // lower than N
  vector<vector<ll>> dp1(D,vector<ll>(4,0));  // not decided to lower than N
  dp0[0][0] = 1;
  dp1[0][0] = 0;
  dp0[0][1] = N[0]-'0'-1;
  dp1[0][1] = 1;

  // devide from higer bit
  REP3(i,1,D){
    dp0[i][0] = 1;;
    ll d = N[i]-'0';
    // K=1 
    dp0[i][1] = dp0[i-1][0]*9 + dp1[i-1][0]*max(0ll,d-1); // 1~9
    dp0[i][1] += (d>0) ? dp0[i-1][1] + dp1[i-1][1] : dp0[i-1][1]; // 0
    dp1[i][1] = (d>0) ? dp1[i-1][0] : dp1[i-1][1];
    // K=2
    dp0[i][2] = dp0[i-1][1]*9 + dp1[i-1][1]*max(0ll,d-1); // 1~9
    dp0[i][2] += (d>0) ? dp0[i-1][2] + dp1[i-1][2] : dp0[i-1][2]; // 0
    dp1[i][2] = (d>0) ? dp1[i-1][1] : dp1[i-1][2];
    // K=3
    dp0[i][3] = dp0[i-1][2]*9 + dp1[i-1][2]*max(0ll,d-1); // 1~9
    dp0[i][3] += (d>0) ? dp0[i-1][3] + dp1[i-1][3] : dp0[i-1][3]; // 0
    dp1[i][3] = (d>0) ? dp1[i-1][2] : dp1[i-1][3];
  }

  ll ans = dp0[D-1][K] + dp1[D-1][K];
  cout << ans << "\n";
  return 0;
}


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

# 高さを全部0にするまで-1する
ans = 0
while True:
  # 最高高さが 0 だったらおしまい
  if max(H) == 0:
    break
  i = 0
  while i < N:
    if H[i] == 0:
      i += 1
    else:
      ans += 1 # 操作1回
      while i < N and H[i] > 0: # 1以上の連続した区間を操作する
        H[i] -= 1
        i += 1
print(ans)        
  

Measured memory_bytes: 3060
<?php

fscanf(STDIN, "%d", $n);
$A = explode(' ', trim(fgets(STDIN)));


/**
 * A[i] + A[j] = j - i (i < j)
 * 両辺にiとjが散らばっているのと考えづらいので
 * 式変形して左辺はi、右辺はjにする。これは定石らしい
 * i + A[i] = j - A[j]
 *
 * 探索するときはjを動かしていく
 * jを動かしていきi(<j)の中に条件を満たすものがないかを調べていく
 * ただし、ここでiをループで調べると実行時間オーバーする
 *
 * これまでの結果を持っておく配列を用意する。
 * この配列から調べる <==> i(<j)から調べる
 */

$map = [];
$cnt = 0;
for ($j = 0; $j < $n; ++$j) {
    $key = $j - $A[$j];

    $cnt += $map[$key];

    ++$map[$j + $A[$j]];
}

echo $cnt;


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

int main() {
  int n; cin >> n;
  while(n--) {
    int Y, M, D, res = 0;
    cin >> Y >> M >> D;
    while(Y != 1000 || M != 1 || D != 1) {
      ++res;
      int L = 20 - (M % 2 == 0 && Y % 3 != 0);
      if(D == L) {
        if(M == 10) {
          ++Y; M = D = 1;
        } else {
          ++M; D = 1;
        }
      } else {
        ++D;
      }
    }
    cout << res << endl;
  }
  return 0;
}

Measured memory_bytes: 1160
import java.util.*;
import java.io.*;

class Main {
    static int MAX = 10000;
    static int NIL = -1;
    static Node[] T = new Node[MAX];
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int v = 0;
        int l = 0;
        int r = 0;
        int root = 0;

        for (int i=0; i<n; i++){
            T[i] = new Node(NIL, NIL, NIL);
        }

        for (int i=0; i<n; i++){
            v = sc.nextInt();
            l = sc.nextInt();
            r = sc.nextInt();
            T[v].setL(l);
            T[v].setR(r);
            if(l != NIL) T[l].setP(v);
            if(r != NIL) T[r].setP(v);
        }

        for (int i=0; i<n; i++){
            if(T[i].getP() == NIL) root = i;
        }

        System.out.println("Preorder");
        preParse(root);
        System.out.println();
        System.out.println("Inorder");
        inParse(root);
        System.out.println();
        System.out.println("Postorder");
        postParse(root);
        System.out.println();
    }

    static void preParse(int u) {
        if (u == NIL) return;
        System.out.print(" " + u);
        preParse(T[u].getL());
        preParse(T[u].getR());
    }

    static void inParse(int u) {
        if (u == NIL) return;
        inParse(T[u].getL());
        System.out.print(" " + u);
        inParse(T[u].getR());
    }

    static void postParse(int u) {
        if (u == NIL) return;
        postParse(T[u].getL());
        postParse(T[u].getR());
        System.out.print(" " + u);
    }

public static class Node {
    private int p, l ,r;
    public Node(int p, int l, int r) {
        this.p = p;
        this.l = l;
        this.r = r;
    }
    int getP() {
        return p;
    }
    int getL() {
        return l;
    }
    int getR() {
        return r;
    }
    void setR(int r) {
        this.r = r;
    }
    void setL(int l) {
        this.l = l;
    }
    void setP(int p) {
        this.p = p;
    }
  }
}



Measured memory_bytes: 26388
#include <stdio.h>

using namespace std;

int main(){
  int n, m, d;
  scanf("%d %d %d", &n, &m, &d);
  double nd, md, dd;
  nd = (double)n;
  md = (double)m;
  dd = (double)d;

  double num;
  double ans;
  if(d == 0){
    ans = (md - 1.0)/nd;
  }else{
    ans = (2*(md - 1.0)*(nd - dd))/(nd*nd);
  }


  printf("%.9lf\n", ans);
  
    
  return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<vector>
#include<algorithm>

typedef long long ll;

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

using namespace std;

int main(){
	string s1,s2,s3;
	cin >> s1 >> s2 >> s3;
	cout << 'A' << s2[0] << 'C'<< endl;
	
	return 0;
}

Measured memory_bytes: 256
/*
confirm 0LL and 1LL
confirm cornercases such as 0
confirm times of cin < 10^6
*/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
using Pld = pair<ld, ld>;
using Vec = vector<ll>;
using VecP = vector<P>;
using VecB = vector<bool>;
using VecC = vector<char>;
using VecD = vector<ld>;
using VecS = vector<string>;
using Graph = vector<VecP>;
template <typename T>
using Vec1 = vector<T>;
template <typename T>
using Vec2 = vector<Vec1<T> >;
#define REP(i, m, n) for(ll i = (m); (i) < (n); ++(i))
#define REPN(i, m, n) for(ll i = (m); (i) <= (n); ++(i))
#define REPR(i, m, n) for(ll i = (m)-1; (i) >= (n); --(i))
#define REPNR(i, m, n) for(ll i = (m); (i) >= (n); --(i))
#define rep(i, n) REP(i, 0, n)
#define repn(i, n) REPN(i, 1, n)
#define repr(i, n) REPR(i, n, 0)
#define repnr(i, n) REPNR(i, n, 1)
#define all(s) (s).begin(), (s).end()
#define pb push_back
#define fs first
#define sc second
template <typename T>
bool chmax(T &a, const T b){if(a < b){a = b; return true;} return false;}
template <typename T>
bool chmin(T &a, const T b){if(a > b){a = b; return true;} return false;}
template <typename T>
ll pow2(const T n){return (1LL << n);}
template <typename T>
void cosp(const T n){cout << n << ' ';}
void co(void){cout << '\n';}
template <typename T>
void co(const T n){cout << n << '\n';}
template <typename T1, typename T2>
void co(pair<T1, T2> p){cout << p.fs << ' ' << p.sc << '\n';}
template <typename T>
void co(const Vec1<T> &v){for(T i : v) cosp(i); co();}
template <typename T>
void co(initializer_list<T> v){for(T i : v) cosp(i); co();}
template <typename T>
void ce(const T n){cerr << n << endl;}
void sonic(){ios::sync_with_stdio(false); cin.tie(0);}
void setp(const ll n){cout << fixed << setprecision(n);}
constexpr int INF = 1e9+1;
constexpr ll LINF = 1e18+1;
constexpr ll MOD = 1e9+7;
//constexpr ll MOD = 998244353;
constexpr ld EPS = 1e-11;
const ld PI = acos(-1);

int main(void){
	ll k;
	cin >> k;
	string s;
	cin >> s;

	if(s.size() <= k) co(s);
	else{
		cout << s.substr(0, k) << "..." << endl;
	}

	return 0;
}


Measured memory_bytes: 3632
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<long long> vll;
typedef pair<int,int> pint;
typedef pair<long long, long long> pll;

#define MP make_pair
#define PB push_back
#define ALL(s) (s).begin(),(s).end()
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

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; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P) 
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P) 
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P) 
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s; }



int n;
int a[25];

int main() {
    while (cin >> n) {
        if (n == 0) break;
        int sum = 0;
        for (int i = 0; i < n; ++i) {
            cin >> a[i];
            sum += a[i];
        }
        int res = 1<<29;
        for (int bit = 0; bit < (1<<n); ++bit) {
            int tmp = 0;
            for (int j = 0; j < n; ++j) if (bit & (1<<j)) tmp += a[j];
            chmin(res, abs(sum - tmp*2));
        }
        cout << res << endl;
    }
    return 0;
}


Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

int main() {
	ll n;
	vector<long double>a;
	cin>>n;
	for(ll i=0;i<n;i++){
		long double now;
		cin>>now;
		a.push_back(now);
	}
	sort(a.begin(),a.end());
	long double ans=a[0];
	for(ll i=1;i<n;i++){
		ans+=a[i];
		ans/=2;
	}
	printf("%.9Lf",ans);
	// your code goes here
	return 0;
}

Measured memory_bytes: 256
#pragma region template

#include <bits/stdc++.h>
using namespace std;
#define ll long long 
#pragma region random

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template <typename T> T randint(T a, T b) {
    return uniform_int_distribution<T>(a, b)(rng);
}

#pragma endregion

#pragma region debug
string to_string(string s) { return '"' + s + '"'; }

string to_string(const char *s) { return to_string((string)s); }

string to_string(bool b) { return (b ? "true" : "false"); }

template <typename A, typename B> string to_string(pair<A, B> p) {
    return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A> string to_string(A v) {
    bool first = true;
    string res = "{";
    for (const auto &x : v) {
        if (!first)
            res += ", ";
        first = false;
        res += to_string(x);
    }
    res += "}";
    return res;
}

void debug_out() { cerr << endl; }

template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) {
    cerr << " " << to_string(H);
    debug_out(T...);
}

#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

#pragma endregion

#pragma endregion

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int a,n,k,q;
    cin>>n>>k>>q;
    vector<int> A(n,k);
    for(int i=0;i<q;i++)
    {
        cin>>a;
        a--;
        A[a]++;
    }
    for(int i=0;i<n;i++)
    {
        if(A[i]>q)
        cout<<"Yes\n";
        else
        cout<<"No\n";
    }
    return 0;
}

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

int main(){
  int n, a[20];
  cin >> n;
  rep(i, n) cin >> a[i];
  int cnt =0;
  for( int i = 1; i < n-1; i++ ){
    if( a[i-1] < a[i] && a[i] < a[i+1] ) cnt++;
    else if( a[i+1] < a[i] && a[i] < a[i-1] ) cnt++;
  }
  cout << cnt ;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using ld = long double;
const int INF = (1<<30)-1;
const long long LINF = (1LL<<62)-1;
const long double PI = acos(-1.0L);
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  while (n) {
    if (n%10 == 9) {
      cout << "Yes" << endl;
      return 0;
    }
    n /= 10;
  }
  cout << "No" << endl;
  return 0;
}

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

const int maxn = 225;
int a[maxn],b[maxn],c[maxn];
int last = -1, ans = 0, n;

int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++) scanf("%d",&a[i]);
	for(int i=1;i<=n;i++) scanf("%d",&b[i]);
	for(int i=1;i<n;i++) scanf("%d",&c[i]);
	for(int i=1;i<=n;i++){
		ans += b[a[i]];
		if(a[i] == last + 1) ans += c[last];
		last = a[i];
	}
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <array>
#include <vector>
#include <iomanip>
#include <string>
#include <cmath>
#include <algorithm>
#include <queue>
#include <map>
#include <set>

using namespace std;

typedef  pair<int,int> P;
typedef long long LL;

const LL INF=1<<30;
const LL MOD=1000000007;

LL gcd(LL a,LL b){
    if(b==0)return a;

    return gcd(b,a%b);
}


int main(){
    int n;
    cin>>n;
    int ans[9]={0};
    int anmi=0;
    int anma=0;
    for(int i=0;i<n;++i){
        int a;
        cin>>a;
        ans[min(a/400,8)]++;
    }
    for(int i=0;i<8;++i){
        if(ans[i]>=1){
            anma++;
            anmi++;
        }
    }
    if(anmi==0&&ans[8]>=1)anmi++;
    cout<<anmi<<" "<<anma+ans[8]<<endl;

}

Measured memory_bytes: 256
XS = open(0).read().split()
for i in range(0, len(XS), 3):
    a = XS[i + 0]
    op = XS[i + 1]
    b = XS[i + 2]
    if op == "?":
        break
    a = int(a)
    b = int(b)
    if op == "+":
        print(a + b)
    elif op == "-":
        print(a - b)
    elif op == "*":
        print(a * b)
    elif op == "/":
        print(a // b)
    else:
        print("?")


Measured memory_bytes: 5596
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <fstream>
#include <numeric>
using namespace std;
typedef unsigned long long int ll;

#define EPS (1e-7)
#define INF 1e18
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define PI (acos(-1))

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

int main() {
    ll X;
    cin >> X;
    ll ans = 100;
    ll i = 0;
    while (ans < X){
        i++;
        ans = (double)ans * 1.01;
    //cout << ans << endl;
        
    }
    cout << i << endl;

    return 0;
}

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

//# define int long

using namespace std;

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

	vector < int > a(n);

	string ans = "APPROVED";

	for ( auto &i: a ) {
		cin >> i;
		
		if ( i % 2 == 0 ) {
			if ( i % 3 != 0 && i % 5 != 0 ) {
				ans = "DENIED";
			}
		}  
	}
	cout << ans;
}

Measured memory_bytes: 256