akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <cstring>
#include <queue>
using namespace std;

typedef int Weight;
struct Edge{
    int src,dst,weight;
    Edge(int s,int d,int c) : src(s), dst(d), weight(c) {;}
};

bool operator<(const Edge &e,const Edge &f) {
    return e.weight != f.weight ? e.weight > f.weight :
    e.src != f.src ? e.src < f.src : e.dst < f.dst;
}

typedef vector<Edge> Edges;
typedef vector<Edges> Graph;
const int INF = 1<<30;

int dist[101][1001],prev[101][1001];
int n,m;

void dijkstra(const Graph &g) {
    int n = g.size();
    memset(prev, -1, sizeof(prev));
    for(int i=0; i<n; ++i) for(int j=0; j<m; ++j) dist[i][j] = INF;
    dist[0][0] = 0;

    priority_queue<Edge> Q;
    for(Q.push(Edge(-2, 0, 0)); !Q.empty(); ) {
        Edge e = Q.top();
        Q.pop();

        int dst = e.dst/m,k = e.dst%m;
        if(prev[dst][k] != -1) continue;
        prev[dst][k] = e.src;
        for(Edges::const_iterator it = g[dst].begin(); it != g[dst].end(); ++it) {
            if(dist[it->dst][k] > e.weight + it->weight) {
                dist[it->dst][k] = e.weight + it->weight;
                Q.push(Edge(e.dst, (it->dst)*m+k, e.weight + it->weight));
            }
            if(k <= n+1 && dist[it->dst][k+1] > e.weight) { //skip path
                dist[it->dst][k+1] = e.weight;
                Q.push(Edge(e.dst, (it->dst)*m+k+1, e.weight));
            }
        }
    }
}

void add_edge(Graph &g,int f,int t,int c) {
    g[f].push_back(Edge(f,t,c));
}

int main() {
    int c;
    while(cin>>n>>m>>c, n) {
        int f,t,ct;
        Graph g(n);

        for(int i=0; i<m; ++i) {
            cin>>f>>t>>ct;
            f--,t--;
            add_edge(g,f,t,ct);
        }

        dijkstra(g);

        for(int i=0; i<=m; ++i) {
            if(dist[n-1][i] <= c) {
                cout<<i<<endl;
                break;
            }
        }
    }
}

Measured memory_bytes: 1884
#include <algorithm>
#include <cassert>
#include <iostream>
#include <map>
#include <vector>

static const int IINF = 1 << 30;
static const long long LINF = 1LL << 60;
static const long long MOD = 1.0e+9 + 7;

template <typename T> std::vector<T> vectors(std::size_t n, T val) {
  return std::vector<T>(n, val);
}

template <typename T, typename... Args>
auto vectors(std::size_t n, Args... args) {
  return std::vector<decltype(vectors<T>(args...))>(n, vectors<T>(args...));
}

template <class T> inline bool chmin(T &a, const T &b) {
  return (a > b) ? a = b, true : false;
}

template <class T> inline bool chmax(T &a, const T &b) {
  return (a < b) ? a = b, true : false;
}

template <class T> inline void chadd(T &a, const T &b) {
  a += b, a %= MOD;
  // TODO minus case
}

template <class T>
std::ostream &operator<<(std::ostream &s, const std::vector<T> &v) {
  if (v.empty())
    return s;
  s << *v.begin();
  for (auto iter = v.begin() + 1; iter != v.end(); ++iter)
    if (std::is_fundamental<T>::value)
      s << " " << *iter;
    else
      s << std::endl << *iter;
  return s;
}

int main() {
  // Input
  int N, X;
  std::cin >> N >> X;

  std::vector<int> L(N);
  for (int i = 0; i < N; ++i)
    std::cin >> L[i];

  // Main
  int c = 0;
  int n = 1;

  for (int i = 0; i < N; ++i) {
    c += L[i];
    if (c <= X)
      n++;
  }

  // Output
  std::cout << n << std::endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <stack>
#include <cmath>
#include <queue>
#include <numeric>


int main()
{
	int n, a, b;

	std::cin >> n >> a >> b;

	std::cout << std::min(n*a, b) << std::endl;
	
	return 0;
}

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

public class Main {
    //-------------------------------------------------------------//
    public static final void main(String[] args) {
        new Main().solve();
    }
    //-------------------------------------------------------------//
    private final Scanner sc = new Scanner(System.in);
    void solve() {
        int N = sc.nextInt();
        long[] a = new long[N * 3];
        for (int i = 0; i < N * 3; i++) a[i] = sc.nextLong();
        Arrays.sort(a);
        int back = N * 3 - 1;
        long ans = 0L;
        for (int i = 0; i < N; i++) {
            back--;
            ans += a[back--];
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 99384
main(n,m,a,b,i){for(;scanf("%d%d",&n,&m),n|m;printf("%d\n",a)){int f[510][510]={0};for(i=m;i--;f[a][b]=f[b][a]=1)scanf("%d%d",&a,&b);for(a=i=0;i<=n;i++)if(f[1][i])for(f[505][i]=b=1;b<=n;b++)f[i][b]?f[505][b]=1:0;for(;--i>1;)f[505][i]?a++:0;}return 0;}

Measured memory_bytes: 0
#include <iostream>
using namespace std;
#define REP(i,a,n) for(int i = a; i < n ; i++)
#define rep(i,n) REP(i,0,n)

int main(){
  int n;
  int sum = 0;
  while( cin >> n){
    sum += n;
  }
  cout << sum << endl;
  
  return 0;
}

Measured memory_bytes: 1164
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <map>
#include <numeric>
#include <cmath>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <complex>
#include <string.h>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <iomanip>
#include <sys/time.h>
#include <tuple>
#include <random>
using namespace std;

#define endl '\n'
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define UNIQ(v) (v).erase(unique((v).begin(), (v).end()), (v).end())

typedef long long ll;
typedef long double ld;
typedef pair<ll, int> P;
typedef complex<double> comp;
typedef vector< vector<ld> > matrix;
struct pairhash {
public:
    template<typename T, typename U>
    size_t operator()(const pair<T, U> &x) const {
	size_t seed = hash<T>()(x.first);
	return hash<U>()(x.second) + 0x9e3779b9 + (seed<<6) + (seed>>2);
    }
};
const int inf = 1e9 + 9;
const ll mod = 1e9 + 7;
const double eps = 1e-8;
const double pi = acos(-1);

int n, k, c;
string s;

int a[200100], b[200100];

void solve() {
    int idx = 0, l = 0;
    while (l < k) {
        if (s[idx] == 'o') {
            a[l++] = idx;
            idx+=c;
        }
        idx++;
    }
    l = k-1;
    idx = n-1;
    while (l >= 0) {
        if (s[idx] == 'o') {
            b[l--] = idx;
            idx-=c;
        }
        idx--;
    }
    for (int i = 0; i < k; i++) {
        if (a[i] == b[i]) {
            cout << a[i]+1 << endl;
        }
    }
}

void input() {
    cin >> n >> k >> c >> s;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(15);

    input();
    solve();
}


Measured memory_bytes: 5272
N, K = list(map(int, input().split()))
b = list(map(int, input().split()))
c = []
d = 0
e = []

for i in range(len(b)):
    d = d + b[i]
    c.append(d)

for i in range(len(b) - K):
    e.append(c[i + K] - c[i] + K)
if N==K:
    print((sum(b) + K)/2)
else:    
    print(max(e)/2)


Measured memory_bytes: 25032
import math
import numpy as np
import re


def inputs(): return [int(s) for s in input().split()]


def main():
    s = input()
    cnt = 0
    s = s.replace('A', '1').replace('BC', '0')
    arr = re.split('[A-C]', s)
    arr = [list(x) for x in arr]
    flag = True
    while flag:
        flag = False
        for a in arr:
            tmp = 0
            for i in a:
                i = int(i)
                tmp += i
                if i is 0:
                    cnt += tmp

    return cnt


if __name__ == '__main__':
    print(main())


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

#define in cin
#define out cout

#define REP(i,n) for(int i=0; i<n; i++)
#define REP2(i,s,e) for(int i=s; i<e; i++)
#define REPE(i,s,e) for(int i=s; i<=e; i++)
#define REPR(i,s,e) for(int i=s; i>=e; i--)

#define all(v) v.begin(), v.end()
#define pb push_back

#define ll long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define rd(n) scanf("%d", &n)

#define x first
#define y second
#define intINF 2147483647
#define llINF 9223372036854775807LL
#define MOD 1000000007

int main()
{

    // 2 3 4 5 6 7 8 9 1

    int n; scanf("%d", &n);
    vector<pii> v;
    set<int> S;
    REP(i, n)
    {
        int x; scanf("%d", &x);
        v.push_back({x, i});
    } sort(all(v));

    ll res = 0;
    REP(i, n)
    {
        auto it = S.lower_bound(v[i].y);

        int p, q;
        if(it != S.begin())
        {
            it--;
            p = *it;
            it++;
        } else p = -1;

        if(it != S.end())
        {
            q = *it;
        } else q = n;

        S.insert(v[i].y);

        p++;
        q--;
        //out << p << " " << q << " " << 1LL * (i+1) * (q-v[i].y+1) * (v[i].y-p+1) << "\n";

        res += 1LL * (i+1) * (q-v[i].y+1) * (v[i].y-p+1);
    }
    printf("%lld\n", res);

    return 0;
}


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

int main() {
  int n, cnt = 0;
  cin >> n;
  int a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }

  while (true) {
    for (int i = 0; i < n; i++) {
      if (a[i] % 2 == 0) {
        a[i] = a[i] / 2;
      } else {
        cout << cnt << endl;
        return 0;
      }
    }
    cnt += 1;
  }
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
  int frag = 0;
  char str[100];
  scanf("%s",str);

  for(int i = 2;i < 5;i = i + 2){
    if(str[i] != str[i+1]){
      frag = 1;
      break;
    }
  }

  if(frag == 0){
    printf("Yes");
  }else{
    printf("No");
  }


  return 0;
}


Measured memory_bytes: 128
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;

public class Main {

	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		int K = sc.nextInt();//回数
		int A = sc.nextInt();//A枚で1円
		int B = sc.nextInt();//1円でB枚

		long bisket = 1;
		int gold = 0;

		if((B - A) <= 2) {
			//明らかに交換しないほうがお得なので
			bisket = bisket + K;
		}else {
			while(K > 0) {
				if(bisket >= A && K >= 2) {
					//ビスケット交換して、B枚増やす(Kが余計に減る)
					bisket = bisket - A + B;
					K--;
				}else {
					bisket++;
				}
				K--;
			}
		}

		System.out.println(bisket);
	}



}

class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }
    public double nextDouble() { return Double.parseDouble(next());}
}

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

using namespace std;

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

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

    vector<long int> s(n);
    s[0] = a[0];

    long int result = 0;
    long int temp = 0;

    for (int i = 1; i < n; i++) {
        if (a[i] < s[i - 1]) {
            temp = s[i - 1] - a[i];
            result += temp;
            s[i] = a[i] + temp;
        } else {
            s[i] = a[i];
        }
    }

    cout << result << endl;

    return 0;
}

Measured memory_bytes: 6376
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int INF = 0x3f3f3f3f;
const LL mod = 1e9 + 7;
const int N = 200005;

char s[N];
int main() {
    scanf("%s", s);
    int ans = 0;
    for (int i = 0; s[i]; i++) {
        ans += s[i] - '0';
    }
    puts(ans % 9 == 0 ? "Yes" : "No");
    return 0;
}


Measured memory_bytes: 3872
def main():
    n,m,k = map(int,input().split())
    friend = []
    block = []
    # Union-Find作る
    uf = UnionFind(n)
    #　iとすでに友達　iとブロックの数は最後に除外する
    exclude_i = [0] * n

    for _ in range(m):
        a,bb = map(int,input().split())
        # aとbを同じグループにする
        uf.union(a-1,bb-1)
        friend.append([a-1,bb-1])

    for _ in range(k):
        c,d = map(int,input().split())
        block.append([c-1,d-1])
        # CとDが友達候補（同じグループ）なら除外する　可哀想
        if uf.same(c-1,d-1):
            exclude_i[c-1] += 1
            exclude_i[d-1] += 1


    for i, f in enumerate(friend):
        # すでに友達ならそれは友達候補ではなく、もはや親友なんだよ（除外）
        if uf.same(f[0],f[1]):
            exclude_i[f[0]] += 1
            exclude_i[f[1]] += 1



    for i in range(n):
        # uf.sizeは自分を含んでるから、自分を除外する-1
        print(str(uf.size(i)-exclude_i[i]-1 ), end = " ")
    print("")

class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())


if __name__=='__main__':
    main()


Measured memory_bytes: 123736
import java.io._
import scala.io.StdIn.{readInt, readLine}
 
object Main {
  val out:BufferedWriter =
    new BufferedWriter(new OutputStreamWriter(new FileOutputStream(java.io.FileDescriptor.out), "ASCII"), 512)
  var count = 0
  class Node(var key:Int, var left:Node = null, var right:Node = null) { }
 
  def insert(tree:Node, keyNode:Node) = {

    def getNodeToInsert(node:Node):Node =
      if(node.key > keyNode.key) {
        if(node.left == null) node
        else getNodeToInsert(node.left)
      } else {
        if(node.right == null) node
        else getNodeToInsert(node.right)
      }
 
    val target = getNodeToInsert(tree)
 
    if(keyNode.key < target.key) target.left = keyNode
    else target.right = keyNode
  }
 
  def inOrder(tree:Node):Unit =
    if(tree == null) return
    else {
      inOrder(tree.left)
      out.write(" ")
      out.write(tree.key.toString)
      if(count<100) count += 1
      else {
        out.flush
        count = 0
      }
      inOrder(tree.right)
    }
 
  def preOrder(tree:Node):Unit =
    if(tree == null) return
    else {
      out.write(" ")
      out.write(tree.key.toString)
      if(count<100) count += 1
      else {
        out.flush
        count = 0
      }
      preOrder(tree.left)
      preOrder(tree.right)
    }
 
  def main(args:Array[String]) = {
    val n = readInt
    val tree = new Node(-1)
 
    for(i<-0 until n) {
      val s = readLine.split(" ")
      s(0) match {
        case "insert" =>
          if(tree.key == -1) tree.key = s(1).toInt
          else insert(tree, new Node(s(1).toInt))
        case _ => {
          inOrder(tree)
          out.write("\n")
          out.flush()
          preOrder(tree)
          out.write("\n")
          out.flush()
        }
      }
    }
  }
}

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

using namespace std;

#define endl '\n'

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

const int oo = 0x3f3f3f3f;
const double eps = 1e-9;
const int maxn = 100000 + 10;
const int mod = 1000000007;

void add(int &a, int b){
    a += b;
    if (a >= mod)
        a -= mod;
}

vector<int> pw2;

int solve11(string &s){
    int answer = 0;
    if (s[0] != '0' && s.back() != '0'){
        answer = 1;
        for (int i = 1; i + 1 < s.length(); ++i)
            if (s[i] == '?') add(answer, answer);
    }
    return answer;
}

int solve10(string s){
    if (s[0] == '0' || s.back() == '1') return 0;
    s[0] = '1';
    s.back() = '0';

    int total = 0;
    for (auto c : s) total += c == '?';

    int t = 1, a = 0;

    for (int i = 0; i < (int)s.length(); i += 2){
        char x = s[i], y = s[i + 1];
        if (x == '?') total--;
        if (y == '?') total--;

        if (x != '0' && y != '0')
            add(a, 1LL * t * pw2[total] % mod);

        int c = int(x != '1' && y != '1') + int(x != '0' && y != '1') + int(x != '1' && y != '0');
        t = 1LL * t * c % mod;
    }

    return a;
}

int solve00(string s){
    if (s[0] == '1' || s.back() == '1' || s.length() <= 3)
        return 0;

    s[0] = '0';
    s.back() =  '0';

    vector<int> suffix(s.length());
    int total = 0;

    for (int i = s.length() - 3; i >= 0; i -= 2){
        char x = s[i], y = s[i + 1];

        if (x != '0' && y != '0')
            suffix[i] = pw2[total];

        int c = int(x != '1' && y != '1') + int(x != '0' && y != '1') + int(x != '1' && y != '0');
        add(suffix[i], 1LL * c * suffix[i + 2] % mod);

        if (x == '?') total++;
        if (y == '?') total++;
    }

    int answer = 0, nonsolved = 1;

    for (int i = 1; i < s.length(); i += 2){
        char x = s[i], y = s[i + 1];

        if (x == '?') total--;
        if (y == '?') total--;

        if (x != '0' && y != '0'){
            int ways = 0;

            if (s[i + 2] != '0')
                add(ways, pw2[total - int(s[i + 2] == '?')]);

            if (s[i + 2] != '1')
                add(ways, suffix[i + 3]);

            add(answer, 1LL * nonsolved * ways % mod);
        }

        int c = int(x != '1' && y != '1') + int(x != '0' && y != '1') + int(x != '1' && y != '0');
        nonsolved = 1LL * nonsolved * c % mod;
    }

    return answer;
}

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

    string s;
    cin >> s;

    pw2 = vector<int>(s.length() + 1);
    pw2[0] = 1;
    for (int i = 1; i < pw2.size(); ++i){
        pw2[i] = pw2[i - 1];
        add(pw2[i], pw2[i]);
    }

    int answer = 0;

    add(answer, solve11(s));
    add(answer, solve00(s));
    add(answer, solve10(s));
    reverse(s.begin(), s.end());
    add(answer, solve10(s));

    cout << answer << endl;

    return 0;
}

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

using namespace std;

#define REP(var, n)  for (decltype(n) var = 0; var < (n); var++)
#define RREP(var, n)  for (auto var = n - 1; var != static_cast<decltype(var)>(-1); var--)
#define FOR(var, a, b)  for (auto var = (a); var < (b); var++)
#define RFOR(var, a, b)  for (auto var = b - 1; var != a; var--)

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

#define all(c) begin(c),end(c)

#define D(x) do { std::cerr << x << " "; } while (0)
#define D2(x) do { std::cerr << #x << ": " << x << std::endl; } while (0)


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


template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) {
    return os << '(' << p.first << ',' << p.second << ')';
}


template<class T>
bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

template<class T>
bool chmin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}


auto solve() {
    int H, W;
    cin >> H >> W;
    vector<string> fi(H);
    for (auto &&e: fi) cin >> e;

    vector<vll> dp(H, vll(W, 0));
    dp[0][0] = 1;

    const int MOD = 1e9 + 7;

    REP(r, H) {
        REP(c, W) {
            if (r < H - 1 && fi[r + 1][c] != '#') {
                dp[r + 1][c] += dp[r][c];
                dp[r + 1][c] %= MOD;
            }
            if (c < W - 1 && fi[r][c + 1] != '#') {
                dp[r][c + 1] += dp[r][c];
                dp[r][c + 1] %= MOD;
            }
        }
    }

    return dp[H - 1][W - 1];
}


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

//    cout << (solve() ? "even" : "odd") << endl;
//    cout << (solve() ? "YES" : "NO") << endl;
    cout << solve() << endl;
//    solve();

    return 0;
}


Measured memory_bytes: 9216
#include <bits/stdc++.h>
 
using namespace std;
 
#define ALL(x) x.begin(), x.end()
 
typedef long long int lld;
typedef pair<int, int> pii;
 
int main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.precision(15);
	cout << fixed;
 
	int n, k;
	cin >> n >> k;

	vector<int> num(n);
	vector<int> div;

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

	lld sum = accumulate(ALL(num), 0);

	for (int i = 1; i * i <= sum; i++) {
		if (sum % i == 0)
			div.push_back(i), div.push_back(sum / i);
	}

	sort(ALL(div), greater<lld>());

	for (auto &d : div) {

		vector<int> mod(n);
		for (int i = 0; i < n; i++) {
			mod[i] = num[i] % d;
		}
		sort(ALL(mod));

		lld plus = accumulate(ALL(mod), 0);
		lld minus = 0;

		for (int i = n - 1; i >= 0; i--) {
			if (max(plus, minus) <= k) {
				cout << d << '\n';
				return 0;
			}
			plus -= mod[i];
			minus += (d - mod[i]);
		}
	}

	return 0;
}

Measured memory_bytes: 256
n=int(input())
data=[input() for _ in range(n)]
cnt=[0]*4

for d in data:
    if d == 'AC':
        cnt[0]+=1
    elif d == 'WA':
        cnt[1]+=1
    elif d == 'TLE':
        cnt[2]+=1
    elif d == 'RE':
        cnt[3]+=1

print(f'AC x {cnt[0]}')
print(f'WA x {cnt[1]}')
print(f'TLE x {cnt[2]}')
print(f'RE x {cnt[3]}')

Measured memory_bytes: 16192
#include <cmath>
#include <vector>
#include <map>
#include <functional>
#include <queue>
#include <iostream>
#include <string>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <cstdint>

using namespace std;

#define ll long long int
#define ti4 tuple<int,int,int,int>
#define pii pair<ll,ll>

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

string s[501];
char red[501][501];
char blue[501][501];

int main()
{
    ll h, w;
    cin >> h >> w;
    for(int i = 0;i < h;i++)
    {
        cin >> s[i];
    }
    
    const char off = '.';
    const char on = '#';
    
    for(int y = 0;y < h; y++)
    {
        red[y][0] = on;
        blue[y][0] = off;
        red[y][w-1] = off;
        blue[y][w-1] = on;
        for(int x = 1;x < w-1;x++)
        {
            if(y % 2 == 0)
            {
                red[y][x] = on;
                blue[y][x] = off;
            }
            else
            {
                red[y][x] = off;
                blue[y][x] = on;
            }
        }
    }
    for(int y = 0;y < h;y++)
    {
        for(int x = 0;x < w;x++)
        {
            if(s[y][x] == on)
            {
                red[y][x] = on;
                blue[y][x] = on;
            }
        }
    }
    for(int y = 0;y < h;y++)
    {
        for(int x = 0;x < w;x++)
        {
            cout << red[y][x];
        }
        cout << endl;
    }
    cout << endl;
    for(int y = 0;y < h;y++)
    {
        for(int x = 0;x < w;x++)
        {
            cout << blue[y][x];
        }
        cout << endl;
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 1536
n=int(input())
# dic={1:'a',2:'b',3:'c',4:'d',5:'e',6:'f',7:'g',8:'h',9:'i',10:'j',11:'k',12:'l',13:'m',14:'n',15:'o',16:'p',17:'q',18:'r',19:'s',20:'t',21:'u',22:'v',23:'w',24:'x',25:'y',26:'z'}
def baseto26(num):

    if num <= 0:
        return ""
    elif num <= 26:
        return chr(96+num)
    else:
        return baseto26(int((num-1)/26))+chr(97+(num-1)%26)
print(baseto26(n))

Measured memory_bytes: 9176
#include <bits/stdc++.h>
using namespace std;
 
int main(){
 int n , count =0 , flag = 0 ;
  cin>>n;
  while(n--){
     int q, r;
    cin>>q>>r;
    if(q == r) count++;
    else count = 0 ;
  
  
  if(count >= 3){ cout<<"Yes"<<endl; flag++ ; break;}
   
}
 if(flag == 0) cout<<"No"<<endl; 
  
}

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

int main() {
	int n;
	cin >> n;
	vector<int> cnt(n+1,0);
	rep(i,n) {
		int a;
		cin >> a;
		cnt[a]++;
	}
	bool narabi = true;
	if (n%2) {
		if (cnt[0] != 1) narabi = false;
		for (int i=1;i<=n/2;i++) {
			if (cnt[2*i] != 2) narabi = false;
			if (cnt[2*i+1] != 0) narabi = false;
		}
	}
	else {
		for (int i=0;i<=n/2-1;i++) {
			if (cnt[2*i] != 0) narabi = false;
			if (cnt[2*i+1] != 2) narabi = false;
		}
	}
	ll ans = 1;
	ll m = 1e9+7;
	rep(i,n/2) ans = (ans * 2) % m;
	if (!narabi) ans = 0;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 640
import sys
from collections import defaultdict

sys.setrecursionlimit(500000)

def gcd(a,b):
    a,b = max(a,b),min(a,b)
    while a%b!=0:
        a,b = b,a%b
    return b

def frac(a,b):
    d = gcd(abs(a),abs(b))
    if a<0:
        a = -a
        b = -b
    return (a//d,b//d)

def inv(a,b):
    return frac(-b,a)

def input():
    return sys.stdin.readline()[:-1]

def main():
    N = int(input())

    vec = [list(map(int,input().split())) for i in range(N)]

    arg = defaultdict(int)
    zero = 0
    for v in vec:
        if v[0] == 0 and v[1] == 0:
            zero += 1
        elif v[1]==0:
            arg[float("inf")] += 1
            arg[0] += 0
        elif v[0]==0:
            arg[0] += 1
            arg[float("inf")] += 0
        else:
            arg[frac(v[0],v[1])] += 1
            arg[frac(-v[1],v[0])] += 0

    pair = []
    ll = lambda : False

    checked_list = defaultdict(ll)
    for key in arg:
        if not checked_list[key]:
            if key==0:
                pair.append([arg[0],arg[float("inf")]])
                checked_list[float("inf")] = True
            elif key==float("inf"):
                pair.append([arg[0],arg[float("inf")]])
                checked_list[0] = True

            else:
                #print(key)
                pair.append([arg[key],arg[inv(*key)]])
                #print(pair)
                checked_list[inv(*key)] = True

    mod = 1000000007

    ans = 1

    for p1,p2 in pair:
        ans *= pow(2,p1,mod) + pow(2,p2,mod) - 1
        ans %= mod

    ans += zero
    ans %= mod

    print((ans+mod-1)%mod)

if __name__ == '__main__':
    main()





Measured memory_bytes: 251448
#include <bits/stdc++.h>
  
using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define repr(i, n) REPR(i, n, 0)
#define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--)
#define pb push_back
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;

int main(){
    int a, b;
    cin >> a >> b;
    cout << a + b/2 << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
#define REP(i,n) for(int i=0;i<(int)(n);i++)
const int NMAX = 1024;
bool Map[NMAX][NMAX];
int sum[NMAX + 1][NMAX + 1];

void init(int n) {
  REP(y, n) {
    REP(x, n) {
      sum[x][y] = 0;
    }
  }
}

void accumulate(int n) {
  for (int y = 1; y <= n; y++) {
    for (int x = 1; x <= n; x++) {
      sum[x][y] = sum[x-1][y] + sum[x][y-1] - sum[x-1][y-1]
        + (Map[x-1][y-1] ? 1 : 0);
    }
  }
}

int asterisks(int xa, int ya, int xb, int yb) {
  xa++; ya++; xb++; yb++;
  return sum[xb][yb] - sum[xa-1][yb] - sum[xb][ya-1] 
    + sum[xa-1][ya-1];
}

bool contains_square(int n, int size) {
  if (size > n) return false;
  size--;
  REP(y, n - size) {
    REP(x, n - size) {
      if (!asterisks(x, y, x + size, y + size)) return true;
    }
  }
  return false;
}

int solve(int n) {
  if (not contains_square(n, 1)) return 0;
  int lb = 1, ub = n + 1;
  while (ub - lb > 1) {
    int mid = (lb + ub) / 2;
    if (contains_square(n, mid)) {
      lb = mid;
    } else {
      ub = mid;
    }
  }
  return lb;
}

int main() {
  int n;
  while (cin >> n and n) {
    init(n);
    REP(y, n) {
      string row;
      cin >> row;
      REP(x, n) {
        Map[x][y] = (row[x] == '*');
      }
    }
    accumulate(n);

    cout << solve(n) << endl;
  }
}

Measured memory_bytes: 6300
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define repit(it, li) for(auto it=li.begin(); it!=li.end(); it++)
using namespace std;
using ll = long long;
using P = pair<int,int>;

static ll dp[3000][4];
static int tem[3000][3000];

int main(){
   int r, c, k;
   cin>>r>>c>>k;
   rep(i, k){
      int ir, ic, ik;
      cin>>ir>>ic>>ik; ir--; ic--;
      tem[ir][ic]=ik;
   }

   rep(i, r) rep(j, 4) dp[i][j]=0;
   rep(i, r){
      rep(j, c){
         for(int k=4-1-1; k>=0; k--) dp[j][k+1]=max(dp[j][k+1], dp[j][k]+tem[i][j]);
         if(j!=c-1) rep(k, 4){
            dp[j+1][k]=max(dp[j+1][k], dp[j][k]);
         }
      }
      rep(j, c){
         for(int k=4-1-1; k>=0; k--) dp[j][k]=max(dp[j][k], dp[j][k+1]);
         for(int k=1; k<4; k++) dp[j][k]=0;
      }
   }

   cout<<dp[c-1][0]<<endl;
   return 0;
}


Measured memory_bytes: 38880
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// // 整数の入力
		// int a = sc.nextInt();
		// // スペース区切りの整数の入力
		// int b = sc.nextInt();
		// int c = sc.nextInt();
		// // 文字列の入力
		// String s = sc.next();
		// // 出力
    // System.out.println((a+b+c) + " " + s);
    int a = sc.nextInt();
    int b = sc.nextInt();
    System.out.println((a + b + 1) / 2);
	}
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 1e5+5;
int n, a[N];
int main() {
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
    sort(a+1, a+1+n);
    if (n%2 == 0) {
        ll ans = 0;
        for (int i = 1; i < n/2; i++) ans -= 2*a[i];
        ans -= a[n/2];
        ans += a[n/2+1];
        for (int i = n/2+2; i <= n; i++) ans += 2*a[i];
        cout << ans << endl;
    } else {
        ll ans = 0;
        ans -= a[n/2];
        ans -= a[n/2+1];
        for (int i = 1; i < n/2; i++) ans -= 2*a[i];
        for (int i = n/2+2; i <= n; i++) ans += 2*a[i];
        ll ans2 = 0;
        for (int i = 1; i <= n/2; i++) ans2 -= 2*a[i];
        ans2 += a[n/2+2];
        ans2 += a[n/2+1];
        for (int i = n/2+3; i <= n; i++) ans2 += 2*a[i];
      //  cout << ans << " " << ans2 << endl;
        ans = max(ans, ans2);
        cout << ans << endl;
    }
}


Measured memory_bytes: 640
from functools import reduce
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline

n, a, b = map(int, read().split())
MOD = 10 ** 9 + 7


def comb_mod(n, a):
    num = reduce(lambda x, y: x * y % MOD, range(n, n - a, -1))
    den = reduce(lambda x, y: x * y % MOD, range(1, a + 1))
    return num * pow(den, MOD - 2, MOD) % MOD


ans = pow(2, n, MOD) - comb_mod(n, a) - comb_mod(n, b) - 1
ans %= MOD

print(ans)


Measured memory_bytes: 3700
#include<iostream>
#include<iomanip>
#include<math.h>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<unordered_map>
#include<queue>
#include<stack>
#include<string>
#include<bitset>
#include<random>
#include<time.h>
#define MOD 1000000007ll
#define INF 1000000000ll
#define EPS 1e-10
#define REP(i,m) for(long long i=0; i<(ll)m; i++)
#define FOR(i,n,m) for(long long i=n; i<(ll)m; i++)
#define DUMP(a) for(long long dump=0; dump<(ll)a.size(); dump++) { cout<<a[dump]; if(dump!=(ll)a.size()-1) cout<<" "; else cout<<endl; }
#define ALL(v) v.begin(),v.end()
#define UNIQUE(v) sort(v.begin(),v.end()); v.erase(unique(v.begin(),v.end()),v.end());
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef long double ld;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll h,w;
	cin>>h>>w;
	vector<vector<char>> s(h,vector<char>(w));
	REP(i,h) REP(j,w) cin>>s[i][j];
	REP(i,h) REP(j,w) {
		if(s[i][j]=='#') {
			bool d=false;
			if(i>0&&s[i-1][j]=='#') d=true;
			if(i<h-1&&s[i+1][j]=='#') d=true;
			if(j>0&&s[i][j-1]=='#') d=true;
			if(j<w-1&&s[i][j+1]=='#') d=true;
			if(!d) {
				cout<<"No"<<endl;
				return 0;
			}
		}
	}
	cout<<"Yes"<<endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(){
	int a,b,i,n,z;
	
	scanf("%d %d",&a,&b);
	z=b;
	for(i=0;;i++){
		a=a*10;
		if(z/10==0) break;
		z=z/10;
	}
	n=a+b;
	for(i=1;i*i<=n;i++){
		if((n/i==i)&&(n%i==0)){
			printf("Yes");
			return 0;
		}
	}
	printf("No");
	return 0;
}

Measured memory_bytes: 128
$<.map{|i|a=i.split(?,).map(&:to_i).sort;b,c=a.uniq.map{|j|-a.count(j)}.sort;puts b<-3?"four card":b<-2?c>-2?"three card":"full house":b<-1?c>-2?"one pair":"two pair":a[4]-a[0]<5||a[1]>9?:straight: :null}

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


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

  if (op == "+") cout << a+b;
  else cout << a-b;
  cout << endl;
  return 0;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define N 2010
using namespace std;
const int INF = 1e9;
int K,C[N][N],NG[N][N];
vector<int> G[N];
int Max(int &a,int b){return a=max(a,b);}

int visited[N];
vector<int> g;
void dfs(int pos,int pre){
  g.push_back(pos);
  if(visited[pos]++) return;
  for(int nx:G[pos])if(nx!=pre){dfs(nx,pos);break;}
}

int dp1[2][2][N][N]; //flg,used,pos,cnt
void update(int flg,int i,int cnt){
  int pos = g[i];
  int pre = g[i-1];

  //pos???????????????
  if(!(pos==g[0] && flg == 1)){ //??????????????§????????????????????¨??????????????????????????£?????\???
    Max(dp1[flg][0][i][cnt],dp1[flg][0][i-1][cnt]); //??????????????£????????? 
    Max(dp1[flg][0][i][cnt],dp1[flg][1][i-1][cnt]); //??????????????£???
  }

  if(flg==0 && pos==g[0])return; //start??§?????????start????????£??????????????????????????¨?????????????????????
  int f = !(pos==g[0] && flg == 1); // ??????????????§???????????????????????§????????´???(flg==1)???cost???0?????????

  //pos????????????
  Max(dp1[flg][1][i][cnt+f],dp1[flg][0][i-1][cnt]); //??????????????£????????? 
  if(NG[pre][pos]==0)Max(dp1[flg][1][i][cnt+f],dp1[flg][1][i-1][cnt]+C[pre][pos]);//???????????£???
}

vector<vector<int> >D;
void DP1(){

  int n = g.size();
  for(int i=0;i<2;i++)
    for(int j=0;j<2;j++)
      for(int k=0;k<=n;k++)
	for(int l=0;l<=n;l++)dp1[i][j][k][l] = -INF;

  
  dp1[0][0][0][0] = 0;
  dp1[1][1][0][1] = 0;
  
  for(int i=1;i<n;i++)
    for(int j=0;j<=n;j++)update(0,i,j),update(1,i,j);
  
  vector<int> tmp;
  for(int i=0;i<=n;i++){
    int a = max(dp1[0][0][n-1][i],dp1[0][1][n-1][i]);
    int b = max(dp1[1][0][n-1][i],dp1[1][1][n-1][i]);
    tmp.push_back(max(a,b));
  }
  D.push_back(tmp);
}

int DP2(){
  int dp2[N]; //1??????????????§????????????????????????
  for(int i=0;i<=K;i++)dp2[i] = -INF; //?????????
  
  int n = D.size();
  dp2[0] = 0;
  for(int i=0;i<n;i++) //??£??????????????????????????§?????????
    for(int k=K,m=D[i].size();k>=0;k--) //???????????????????????????
      for(int j=0;j<m && k+j<=K;j++) //?¬?????????????????????????
	Max(dp2[k+j],dp2[k]+D[i][j]);

  return dp2[K];
}

int main(){
  int n,m;
  cin>>n>>m>>K;

  for(int i=0,a,b,c;i<m;i++){
    cin>>a>>b>>c;a--,b--;
    C[a][b] = C[b][a] = c;
    if(c==0)NG[a][b] = NG[b][a] = 1;
    G[a].push_back(b);
    G[b].push_back(a);
  }

  //?¬???°????????\???????????????????????????
  for(int i=0;i<n;i++)
    if(G[i].size()<=1 && visited[i]==0) g.clear(),dfs(i,-1),DP1(); 

  //?¬???°????????????????????????
  for(int i=0;i<n;i++)
    if(visited[i] == 0) g.clear(),dfs(i,-1),DP1();

  int ans = DP2();
  if(ans<-1e8) cout<<"Impossible"<<endl;
  else cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 79228
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector> 
#include<limits>
#include<numeric>
#include<type_traits>
#include<math.h>
using namespace std;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i = (int)(a); i < (int)(b); i++)
#define in(x) cin >> x
#define out(str) cout << str << endl

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

int A,B,C,X,cnt=0;

int main(){
    cin>>A>>B>>C>>X;
    rep(i,A+1){
        rep(j,B+1){
            rep(k,C+1){
                if(500*i+100*j+50*k==X)cnt++;
            }
        }
    }
    out(cnt);
}


Measured memory_bytes: 256
package main

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


func main() {
	var n int
	fmt.Scan(&n)

	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)

	v := make([]int, n)
	for i := 0; i < n; i++ {
		sc.Scan()
		v[i], _ = strconv.Atoi(sc.Text())
	}

	c := make([]int, n)
	for i := 0; i < n; i++ {
		sc.Scan()
		c[i], _ = strconv.Atoi(sc.Text())
	}

	ans := 0
	for i := 0; i< n;i++ {
		if v[i] - c[i] > 0 {
			ans += v[i] - c[i]
		}
	}
	fmt.Println(ans)

}



Measured memory_bytes: 1848
#include <bits/stdc++.h>
using namespace std;
#define Hello ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long
#define endl '\n'
void trace(int n, int arr[]){for(int i = 0; i < n; i++){cout << arr[i] << " ";} cout << endl << endl;}
ll lower(ll n){
    ll low = 0, high = 1e8, mid, ans = 0;
    while(low <= high){
        mid = (low + high)/2;
        if(((mid * (mid + 1))/2) <= n){
            low = mid + 1;
            ans = mid;
        }
        else
            high = mid - 1;
    }
    return ans;
}
ll factorize(ll n)
{
    ll final = 0, cntr = 0;
    for (ll i = 2; i * i <= n; i++)
    {
        cntr = 0;
        while(n % i == 0)
        {
            n /= i;
            cntr++;
        }
        final += lower(cntr);
        //if(cntr)
           // cout << "i " << i << " cntr " << cntr << " lower " << lower(cntr) << endl;
    }
    if (n > 1){
        final += lower(1);
        //cout << "n " << n << " cntr " << cntr << " lower " << lower(cntr) << endl;
    }
    return final;
}
int main()
{
    Hello
    ll n;
    cin >> n;
    cout << factorize(n);
    return 0;
}

Measured memory_bytes: 3640
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <vector>
using namespace std;
#define MAXSIZE 200
#define MAXL 100
typedef long long int lli;

int main(){
    string s;
    cin >> s;
    string ans;
    if(s[5] == '1'){
        ans = "TBD";
    }else{
        if(s[6] > '4'){
            ans = "TBD";
        }else{
            ans = "Heisei";
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
conv = {
  '0' => '* = ****',
  '1' => '* =* ***',
  '2' => '* =** **',
  '3' => '* =*** *',
  '4' => '* =**** ',
  '5' => ' *= ****',
  '6' => ' *=* ***',
  '7' => ' *=** **',
  '8' => ' *=*** *',
  '9' => ' *=**** '
}

has_prev = false

while line = gets
  stack = []

  num = sprintf('%05d', line.chomp)

  num.split('').each do |str|
    stack << conv[str].split('')
  end

  puts if has_prev

  for j in 0...8
    row = []
    for i in 0...num.length
      row << stack[i][j]
    end
    puts row.join
  end

  has_prev = true
end

Measured memory_bytes: 9588
#include <bits/stdc++.h>
#pragma gcc optimize("ofast")
using namespace std;

#define ll long long //data types used often, but you don't want to type them time by time
#define ull unsigned long long
#define ui unsigned int
#define mod 1000000007
#define us unsigned short
#define IOS ios_base::sync_with_stdio(0); //to synchronize the input of cin and scanf
#define INF LONG_MAX
#define PI 3.1415926535897932384626
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define rep(x,j,n)for(int x=j;x<n;x++)
typedef vector<pair<ll,ll>> vpi;
typedef vector<ll> vi;
typedef vector<vi> vvi;

ll modexp(ll a,ll b,ll m)
{
	ll r=1;
	a=a%m;
	while(b>0)
	{
		if(b&1)
		    r=(r*a)%m;
		b>>1;
		a=(a*a)%m;
	}
	return r%m;
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	double a,b; cin>>a>>b;
	ll x = b*10;
	//cout<<x<<endl;
	for(ll i = x;(floor(i*(.1))==b);i++)
    {
        if(floor(i*(.08))==a)
        {
            cout<<i<<endl;
            return 0;
        }
        //cout<<i<<endl;
    }
    cout<<-1<<endl;
    return 0;
}


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

bool isprime(int x){
  if(x == 2)
    return true;

  if(x<2 || x%2 == 0)
    return false;

  for (int i=3; i*i<=x;i+=2){
   if(x%i==0)
    return false;
 }
 
  return true;
}
    

int main() {
  int x;
  cin >> x  ;
  bool go = true ;
  
  while(go){
    if(isprime(x)){
      cout << x ;
      go = false;
    }
    else x++;
  }
  
}


Measured memory_bytes: 256
let mutable mass_num = stdin.ReadLine() |>int
let mutable G : ResizeArray<int> array = Array.zeroCreate mass_num
let mutable Fennec :int array = Array.zeroCreate mass_num
let mutable Kisuke :int array = Array.zeroCreate mass_num
let mutable mass = 0 |>int 
let mutable before = 0 |>int
let mutable dist = 0 |>int

for i in [0..mass_num-1]do
    G.[i] <-ResizeArray<int>()
done;;

let rec dfs_Fe(mass,before,dist) =
    Fennec.[mass]<-dist
    for i in [0..G.[mass].Count-1]do
    if(G.[mass].[i] <> before ) then dfs_Fe(G.[mass].[i],mass,dist+1);;

let rec dfs_Ki(mass,before,dist) =
    Kisuke.[mass]<-dist
    for i in [0..G.[mass].Count-1]do
    if(G.[mass].[i] <> before ) then dfs_Ki(G.[mass].[i],mass,dist+1);;

let mutable Fe_mass = 0
for i in [0..mass_num-2]do
let mutable IN = stdin.ReadLine().Split(' ') |> Array.map int
IN.[0]<-IN.[0]-1
IN.[1]<-IN.[1]-1
G.[IN.[0]].Add(IN.[1])
G.[IN.[1]].Add(IN.[0])
done;;
dfs_Fe(0,-1,0)  
dfs_Ki(mass_num-1,-1,0)  
for i in [0..mass_num-1]do
if Fennec.[i]<=Kisuke.[i] then Fe_mass<-Fe_mass+1
else Fe_mass<-Fe_mass-1
done;;
if Fe_mass > 0 then "Fennec" else "Snuke"
|>printfn "%s"


Measured memory_bytes: 60136
#include <iostream>
#include <string>
#include <string.h>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <stdio.h>
#include <vector>
#include <time.h>
#include <iomanip>
#include <thread>
#include <atomic>
#include <mutex>
#include <future>
#define double long double
#define int long long
#define low lower_bound
#define upp upper_bound
#define mod 1000000007 //10^9+7
#define inf 10000000000000000 //10^16
#define rep(i,n) for(int i=0;i<n;i++)
#define all(vec) vec.begin(),vec.end()
#define vsort(vec) sort(all(vec))
#define vrever(vec) reverse(all(vec));
#define vunsort(vec) vsort(vec); vrever(vec);
#define bisea binary_search
#define cend cout<<endl;
#define P pair<int,int>
#define prique priority_queue<P,vector<P>,greater<P>>
using namespace std;
signed main() {
	int n;
	string s;
	int k;
	cin >> n >> s >> k;
	char a = s[k - 1];
	rep(i, n) {
		if (s[i] != a) cout << "*";
		else cout << a;
	}
	cend;
}

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

int main(){
	int a = 0,v1,v2;
	int cnt = 0;
	char b;
	vector<int> data;
	while(~scanf("%d%c",&a,&b)){
		if(b == ','){
			cnt++;
			if(cnt == 11){
				v1 = a;
			}else{
				for(int i=0;i<a;i++){
					data.push_back(cnt);
				}
			}
		}else{
			v2 = a;
			v1 = ceil( v1 * (double)data.size() / (v1+v2) );
			cout << data[v1-1] << endl;
			cnt = 0;
			data.clear();
		}
	} 
}

Measured memory_bytes: 0
#include <stdio.h>
#include <string.h>


int main() {
	char s[5];

	scanf("%s", s);
	if (strlen(s) == 2) {
		printf("%s", s);
	} else {
		char x = s[0];
		s[0] = s[2];
		s[2] = x;
		printf("%s", s);
	}

	return 0;
}

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

#define fo(i,s,t) for(int i = s; i <= t; ++ i)
#define fd(i,s,t) for(int i = s; i >= t; -- i)
#define bf(i,s) for(int i = head[s]; i; i = e[i].next)
#define mp make_pair
#define fi first
#define se second
#define pii pair<int,int>
#define pb push_back
#define VI vector<int>
#define sf scanf
#define pf printf
#define fp freopen
#define SZ(x) ((int)(x).size())
#define MPS
typedef long long ll;
typedef double db;
typedef unsigned long long ull;
const int inf = 1<<30;
const ll INF = 1ll<<60;
const db Inf = 1e20;
const db eps = 1e-9;

void gmax(int &a,int b){a = (a > b ? a : b);}
void gmin(int &a,int b){a = (a < b ? a : b);}

const int maxn = 105;

int A[maxn][maxn], n, m;
ll ans;

int main()
{
	cin >> n >> m;
	if(n <= 9 && m <= 9)
	{
		fo(i,1,n) fo(j,1,m) fo(a,i-1,i+1) fo(b,j-1,j+1) A[a][b] ++;
		fo(i,1,n) fo(j,1,m) if(A[i][j]&1) ++ ans;
		cout << ans << endl;
	}
	else if(n == 1) cout << m-2 << endl;
	else if(m == 1) cout << n-2 << endl;
	else cout << (n-2)*1ll*(m-2) << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
#define ld long double
int main(){
	/*
	#ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
	#endif
	*/
	ios_base::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
	int n,d;
	cin>>n>>d;
	int a[n][d];
	for(int i=0;i<n;i++){
		for(int j=0;j<d;j++){
			cin>>a[i][j];
		}
	}
	
	int ans=0;
	for(int i=0;i<n;i++){
		for(int j=i+1;j<n;j++){
			int sum=0;
			for(int k=0;k<d;k++){
				sum+=pow( abs(a[i][k]-a[j][k]), 2 );
			}
			int g=sqrt(sum);
			if((g*g)==sum) ans++;
		}
	}
	cout<<ans;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<ll, P> P3;
typedef pair<P ,P> PP;
constexpr ll MOD = ll(1e9) + 7;
constexpr int IINF = INT_MAX;
constexpr ll LLINF = LLONG_MAX;
constexpr int MAX_N = int(1e5) + 5;
constexpr double EPS = 1e-9;
constexpr int di[] = {0, 1, 0, -1}, dj[] = {1, 0, -1, 0};
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i > 0; i--)
#define SORT(v) sort((v).begin(), (v).end())
#define SORTR(v) sort((v).rbegin(), (v).rend())
#define ALL(v) (v).begin(), (v).end()



int main() {
    int k, x;
    cin >> k >> x;
    for(int i=x-k+1;i<=x+k-1;i++){
        cout << i << " \n"[i==x+k-1];
    }
    return 0;
}


Measured memory_bytes: 256
r, g, b = input().split(' ')

n = int(input())

for i in range(0, n):
  if int(r) >= int(g):
    g = int(g) * 2
    continue
  if int(g) >= int(b):
    b = int(b) * 2
    continue
if int(r) < int(g) < int(b):
  print('Yes')
else:
  print('No')

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

const int MOD = 1000000007;
const int INF = 1001001001;

int main(){
    int n;cin>>n;
    
    int ans = 0;
    
    for(int i=3; i<=n; i+=2){
        int count = 0;
        for(int j=1; j<=i; j++){
            if(i%j==0)count++;
        }
        if(count==8)ans++;
    }
    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3632