akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
 
 
int main() {
    string S;
    cin >> S;
    bool a=true;
    for(int i=0;i<S.size()-1;i++){
        if(S.at(i)==S.at(i+1)) a=false;
    }
    if(a) cout << "Good" << endl;
    else cout << "Bad" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0,i##_max=(N);i<i##_max;++i)
#define repp(i,l,r) for(int i=(l),i##_max=(r);i<i##_max;++i)
#define per(i,N) for(int i=(N)-1;i>=0;--i)
#define perr(i,l,r) for(int i=r-1,i##_min(l);i>=i##_min;--i)
#define all(arr) (arr).begin(), (arr).end()
#define SP << " " <<
#define SPF << " "
#define SPEEDUP cin.tie(0);ios::sync_with_stdio(false);
#define MAX_I INT_MAX //1e9
#define MIN_I INT_MIN //-1e9
#define MAX_UI UINT_MAX //1e9
#define MAX_LL LLONG_MAX //1e18
#define MIN_LL LLONG_MIN //-1e18
#define MAX_ULL ULLONG_MAX //1e19
  typedef long long ll;
  typedef pair<int,int> PII;
  typedef pair<char,char> PCC;
  typedef pair<ll,ll> PLL;
  typedef pair<char,int> PCI;
  typedef pair<int,char> PIC;
  typedef pair<ll,int> PLI;
  typedef pair<int,ll> PIL; 
  typedef pair<ll,char> PLC; 
  typedef pair<char,ll> PCL; 

inline void YesNo(bool b){ cout << (b?"Yes" : "No") << endl;}
inline void YESNO(bool b){ cout << (b?"YES" : "NO") << endl;}
inline void Yay(bool b){ cout << (b?"Yay!" : ":(") << endl;}

int main(void){
  SPEEDUP
  cout << setprecision(15);
  int N; ll D,A;cin >> N >> D >> A;
  vector<PII> v(N);
  map<int,int> mp;
  rep(i,N){
    cin >> v[i].first >> v[i].second;
    mp[v[i].first] = 0;
  }
  int n = 0;
  for(const PII & p : mp){
    mp[p.first] = n++;
  }
  sort(all(v));

  vector<ll> dec(N+1,0);
  ll sum = 0;
  rep(i,N){
    dec[i+1] += dec[i];
    v[i].second -= dec[i+1] * A;
    if(v[i].second <= 0)continue;
    ll num = (v[i].second+A-1)/A;
    sum += num;
    dec[i+1]+=num;
    auto it = mp.upper_bound(v[i].first+2*D);
    if(it == mp.end())continue;
    dec[it->second+1] -= num;
  }
  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 12800
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String input = sc.next();
		Set<Character> charSet = new HashSet<>(); 
		for (int i = 0; i < input.length(); i++) {
			charSet.add(input.charAt(i));
		}
		if(charSet.size() == input.length()) {
			System.out.println("yes");
		} else {
			System.out.println("no");
		}
		sc.close();
	}
}


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

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

	ll N;
	cin>>N;

	ll sum1 = 0;

	for(int i = 1;i<=N;i++)
	{
		if(i%3 != 0 && i % 5 != 0)
			sum1 += i;
	}

	cout<<sum1<<endl;

	return 0;
}

Measured memory_bytes: 3648
using System;
using System.Collections.Generic;
namespace cs
{
  class Program
  {
    static void Main(string[] args)
    {
      int x = int.Parse(Console.ReadLine());
      int y = x;
      var ans = new List< int >();
      for (int p = 2; p * p <= x; p++) {
        while (x % p == 0) {
          x /= p;
          ans.Add(p);
        }
      }
      if (1 < x) {
        ans.Add(x);
      }
      ans.Sort();
      Console.WriteLine("{0}: {1}", y, string.Join(" ", ans));
    }
  }
}



Measured memory_bytes: 20088
function Main(input) {
  var W = parseInt(input[0], 10);
  var H = parseInt(input[1], 10);
  var x = parseInt(input[2], 10);
  var y = parseInt(input[3], 10);

  var menseki = W * H;
  var small = menseki / 2.0;

  var isMiddleTate = x === W / 2;
  var isMiddleYoko = y === H / 2;

  console.log(`${small} ${isMiddleTate && isMiddleYoko ? 1 : 0}`);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8").trim().split(/\n|\s/));

Measured memory_bytes: 7628
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author cksharma
 */

#include <bits/stdc++.h>
using namespace std;

struct Happiness {
    int a;
    int b;
    int index;
    Happiness(int a, int b, int index) : a(a), b(b), index(index) {}
};

class CDifferentStrokes {
public:
    void solve(istream& cin, ostream& cout) {
        ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
        cout.setf(ios::fixed); cout.precision(20);

        int n; cin >> n;
        vector<Happiness> A;
        vector<Happiness> B;
        for (int i = 0; i < n; ++i) {
            int a, b; cin >> a >> b;
            A.emplace_back(a, b, i);
            B.emplace_back(a, b, i);
        }

        sort(A.begin(), A.end(), [](const Happiness& lhs, const Happiness& rhs) {
            int diff1 = lhs.a - rhs.b;
            int diff2 = rhs.a - lhs.b;
            if ( diff1 > diff2 ) return true;
            return false;
        });

        sort(B.begin(), B.end(), [](const Happiness& lhs, const Happiness& rhs) {
            int diff1 = lhs.b - rhs.a;
            int diff2 = rhs.b - lhs.a;
            if ( diff1 > diff2 ) return true;
            return false;
        });

        set<int> visited; int aIndex = 0, bIndex = 0;
        long long ans = 0LL;
        while (aIndex < n && bIndex < n) {
            while (aIndex < n) {
                Happiness& h = A[aIndex];
                if (visited.find(h.index) != visited.end()) { aIndex++; continue; }
                ans += A[aIndex].a;
                aIndex++;
                visited.insert(h.index);
                break;
            }
            while (bIndex < n) {
                Happiness& h = B[bIndex];
                if (visited.find(h.index) != visited.end()) { bIndex++; continue; }
                ans -= B[bIndex].b;
                bIndex++;
                visited.insert(h.index);
                break;
            }
        }
        cout << ans << endl;
    }
};


int main() {
    CDifferentStrokes solver;
    std::istream& in(std::cin);
    std::ostream& out(std::cout);
    solver.solve(in, out);
    return 0;
}


Measured memory_bytes: 7340
#include<stdio.h>
#include<math.h>
main()
{
	long long int n, p, i;
	scanf("%lld", &n);
	printf("%lld:", n);
	for (i=2, p=n; i<=sqrt(n); )
	{
		if (n%i==0)
		{
			printf(" %lld", i);
			n=n/i;
			p=n;
		}
		else
		{
			if (i>2)
			{
				i++;
			}
			i++;
		}
	}
	printf(" %lld\n", p);
	return 0;
}


Measured memory_bytes: 2136
import java.sql.SQLOutput;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int[] a = new int[n];
        for (int i =0; i < n; i++) {
            a[i] = sc.nextInt();
        }

        int count = 0;

        for (int i = 0 ; i < n ; i++) {
            if (a[i]%2 == 0) {
                if (a[i]%3 == 0) {
                    count++;
                }
                else if (a[i]%5 == 0) {
                    count++;
                }
            }

            else {
                count++;
            }
        }

        if (count == n) {
            System.out.println("APPROVED");
        }
        else {
            System.out.println("DENIED");
        }
    }
}


Measured memory_bytes: 23764
import sys
sys.setrecursionlimit(10**6)
n, m = map(int, input().split())
ab = []
for _ in range(m):
    a, b = map(int, input().split())
    ab.append((a-1, b-1))

class UnionFind():
    def __init__(self, li):
        self.li = li
        self.cnt = [1]*len(li)
        self.ans = 0
    def root(self, x):
        if self.li[x]==x:
            return x
        self.li[x] = self.root(self.li[x])
        return self.li[x]
    def unite(self, x, y):
        rx = self.root(x)
        ry = self.root(y)
        if rx==ry:
            return self.ans
        self.li[ry] = rx
        self.ans -= self.cnt[rx]*(self.cnt[rx]-1)//2
        self.ans -= self.cnt[ry]*(self.cnt[ry]-1)//2
        self.cnt[rx] += self.cnt[ry]
        self.ans += self.cnt[rx]*(self.cnt[rx]-1)//2
        return self.ans
uf = UnionFind(list(range(n)))
ans = [n*(n-1)//2]
for a, b in ab[::-1][:-1]:
    ans.append(n*(n-1)//2-uf.unite(a, b))
for i in reversed(ans):
    print(i)

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

ll MOD = 1000000007;

ll mod_pow(ll x, ll n)
{
  ll ret = 1;
  while (n > 0)
  {
    if (n & 1)
      ret = ret * x % MOD;
    x = x * x % MOD;
    n >>= 1;
  }
  return ret;
}

vector<ll> fact;
vector<ll> ifact;

void mod_ifact(ll n)
{
  fact.resize(n + 1);
  fill(fact.begin(), fact.end(), 1);
  ifact.resize(n + 1);
  fill(ifact.begin(), ifact.end(), 0);
  for (ll i=1; i<n+1; i++)
    fact[i] = fact[i-1] * i % MOD;
  ifact[n] = mod_pow(fact[n], MOD - 2);
  for (ll i=n; i>0; i--)
    ifact[i-1] = ifact[i] * i % MOD;
}

ll mod_comb(ll n, ll k)
{
  if (k < 0 || k > n)
    return 0;
  return fact[n] * ifact[k] % MOD * ifact[n-k] % MOD;
}

int main()
{
  int x, y;
  cin >> x >> y;
  if ((x + y) % 3 != 0 || x < (x + y) / 3 || y < (x + y) / 3)
  {
    cout << 0 << endl;
    return 0;
  }
  int x2 = x - (x + y) / 3;
  mod_ifact((x + y) / 3);
  cout << mod_comb((x + y) / 3, x2) << endl;
  return 0;
}

Measured memory_bytes: 10624
from math import floor, ceil

def solve(X, D, lb, ub):
    # min abs(X + t * D) (lb <= t <= ub) (lb, ub, t are int)
    ts = [
        lb,
        ub,
        max(min(floor(-X / D), ub), lb),
        max(min(ceil(-X / D), ub), lb),
    ]
    return min([abs(X + t * D) for t in ts])

X, K, D = map(int, input().split())
if K % 2 == 0:
    ans = solve(X, D * 2, -(K // 2), +(K // 2))
else:
    ans1 = solve(X + D, D * 2, -((K + 1) // 2), +((K - 1)) // 2)
    ans2 = solve(X - D, D * 2, -((K - 1) // 2), +((K + 1)) // 2)
    ans = min(ans1, ans2)
print(ans)



Measured memory_bytes: 9152
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
class Program
{
    static void Main(string[] args)
    {
            // 入力
            string[] sS = System.Console.ReadLine().Trim().Split(' ');
            List<int> lstN = new List<int>();
            for (int i = 0; i < sS.Length; i++) { lstN.Add(int.Parse(sS[i])); }

            System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
            sw.Start();

            // 解析
            lstN.Sort();
            string sOut = "NO";
            string sN = "";
            for (int i = 0; i < lstN.Count; i++) { sN += lstN[i].ToString(); }
            if (sN == "1479") { sOut = "YES"; }

            // 出力
            System.Console.WriteLine("{0}", sOut.ToString().Trim());

            sw.Stop();
#if DEBUG
            Console.WriteLine();
            Console.WriteLine("{0}", sw.Elapsed.ToString());
            Console.WriteLine("続行するには何かキーを押してください．．．");
            Console.ReadKey();
#endif
    }

}


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

const long long mod = 1e9 + 7;

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }

int main(){
    int n, z, w;
    cin >> n >> z >> w;
    vi a(n);
    rep(i, n) cin >> a[i];
    if (n==1) cout << abs(w-a.back()) << endl;
    else cout << max(abs(w-a.back()), abs(a[n-2]-a.back())) << endl;
    return 0;
}


Measured memory_bytes: 3552
#include<stdio.h>
#define MAX 100
#define WHITE 0
#define GRAY 1
#define BLACK 2
#define INFTY 1000000

int n,M[MAX][MAX];

void dijkstra(){
  int u,j,i,min,num;
  int cost[MAX],color[MAX];

  for(i=0;i<n;i++){
    cost[i]=INFTY;
    color[i]=WHITE;
  }
  cost[0]=0;
  color[0]=GRAY;
  
  while(1){
    min=INFTY;
    u=-1;
    for(i=0;i<n;i++){
      if(min>cost[i]&&color[i]!=BLACK){
	u=i;
	min=cost[i];
      }
    }
    if(u==-1)break;
    color[u]=BLACK;
    for(j=0;j<n;j++){
      if(color[j]!=BLACK&&M[u][j]!=INFTY){
	if(cost[j]>cost[u]+M[u][j]){
	  cost[j]=cost[u]+M[u][j];
	  color[j]=GRAY;
	}
      }
    }
  }
  for(i=0;i<n;i++){
    printf("%d %d\n",i,cost[i]==INFTY?-1:cost[i]);
  }
}

int main(){
  int i,j,k,u,v,c;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      M[i][j]=INFTY;
    }
  }
  for(i=0;i<n;i++){
    scanf("%d%d",&u,&k);
    for(j=0;j<k;j++){
      scanf("%d%d",&v,&c);
      M[u][v]=c;
    }
  }
  dijkstra();
  return 0;
}



Measured memory_bytes: 2112
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr ll MOD = 1000000007;
constexpr ll INF = 1ll<<60;

int main(int argc, char **argv)
{
	string s; cin >> s;
	ll N = (ll)s.size();
	map<char, ll> m;
	for (auto &e : s)
		++m[e];

	string res{"YES"};
	if (m.size() == 1)
	{
		if (N == 1)
			res = "YES";
		else
			res = "NO";
	}
	else if (m.size() == 2)
	{
		if (N == 2)
			res = "YES";
		else
			res = "NO";
	}
	else 
	{
		ll mi{INF};
		for (auto &p : m)
			mi = min(mi, p.second);


		ll c0{0}, c1{0};
		for (auto &p : m)
		{
			p.second -= mi;
			if (p.second == 0) ++c0;
			if (p.second == 1) ++c1;
		}

		if (c0 + c1 == 3)
			res = "YES";
		else
			res = "NO";

	}

	std::cout << res << std::endl;
}


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

int main() {
    int k;
    string s;
    cin >> k >> s;
    if (s.size() <= k){
        cout << s << endl;
    }
    else{
        cout << s.substr(0,k) << "..." << endl;
    }
    return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
#include <iostream>
#include <cstring>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <string>
#include <utility>
#include <map>
#include <deque>

using namespace std;
#define rep(i,n) for(int i=1;i<=(int)(n);i++)
#define Rep(i,n) for(int i=0;i<=(int)(n-1);i++)
typedef long long ll;
typedef map<int,int> mint;
typedef pair<int,int> pint;
typedef pair<ll,ll> pll;
typedef deque<pair<ll,ll>> dep;
int dx[]={-1,0,1,0};
int dy[]={0,-1,0,1};
int inf=1e9+1000;
const int mod=1e9+7;
ll infi=1e18+100;

ll N,A,B;


int main(){
	cin>>N>>A>>B;
	if(A>B||(N==1&&A!=B)) cout<<0<<endl;
  else if(N==2) cout<<1<<endl;
	else{
	ll ans=((N-1)*B+A)-((N-1)*A+B)+1;
	cout<<ans<<endl;
	}

	  return 0;
  }


Measured memory_bytes: 256
class Mint:
    MOD = 1000000007  # Must be a prime
    CACHE_FACTORIALS = [1, 1]

    def __init__(self, v):
        if self.__isally(v):
            self.v = v.v
        else:
            self.v = v % self.MOD

    @property
    def inv(self):
        return Mint(self.__minv(self.v))

    @classmethod
    def factorial(cls, v):
        for i in range(len(cls.CACHE_FACTORIALS), int(v) + 1):
            cls.CACHE_FACTORIALS.append(cls.CACHE_FACTORIALS[-1] * i % cls.MOD)
        return Mint(cls.CACHE_FACTORIALS[int(v)])

    @classmethod
    def perm(cls, n, r):
        if n < r or r < 0:
            return 0
        return cls.factorial(n) // cls.factorial(n - r)

    @classmethod
    def comb(cls, n, r):
        if n < r or r < 0:
            return 0
        return cls.perm(n, r) // cls.factorial(r)

    @classmethod
    def __isally(cls, v) -> bool:
        return isinstance(v, cls)

    @classmethod
    def __minv(cls, v) -> int:
        return pow(v, cls.MOD - 2, cls.MOD)

    @classmethod
    def __mpow(cls, v, w) -> int:
        return pow(v, w, cls.MOD)

    def __str__(self):
        return str(self.v)
    __repr__ = __str__

    def __int__(self):
        return self.v

    def __eq__(self, w):
        return self.v == w.v if self.__isally(w) else self.v == w

    def __add__(self, w):
        return Mint(self.v + w.v) if self.__isally(w) else Mint(self.v + w)
    __radd__ = __add__

    def __sub__(self, w):
        return Mint(self.v - w.v) if self.__isally(w) else Mint(self.v - w)

    def __rsub__(self, u):
        return Mint(u.v - self.v) if self.__isally(u) else Mint(u - self.v)

    def __mul__(self, w):
        return Mint(self.v * w.v) if self.__isally(w) else Mint(self.v * w)
    __rmul__ = __mul__

    def __floordiv__(self, w):
        return Mint(self.v * self.__minv(w.v)) if self.__isally(w) else Mint(self.v * self.__minv(w))

    def __rfloordiv__(self, u):
        return Mint(u.v * self.__minv(self.v)) if self.__isally(u) else Mint(u * self.__minv(self.v))

    def __pow__(self, w):
        return Mint(self.__mpow(self.v, w.v)) if self.__isally(w) else Mint(self.__mpow(self.v, w))

    def __rpow__(self, u):
        return Mint(self.__mpow(u.v, self.v)) if self.__isally(u) else Mint(self.__mpow(u, self.v))


N, K = map(int, input().split())

for i in range(1, K + 1):
    print(Mint.comb(N - K + 1, i) * Mint.comb(K - 1, i - 1))


Measured memory_bytes: 49132
n = int(input())
t,a = map(int,input().split())
h = list(map(int,input().split()))
min = abs(a-(t-h[0]*0.006))
ans = 1
for i in range(1,n):
  kion = t-h[i]*0.006
  sa = abs(a-kion)
  if sa<min:
    min = sa
    ans = i+1
print(ans)
    
  

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<string>
#include<cstring>
#define ll long long
#define ull unsigned long long
#define inf 0x3f3f3f3f
#define mod 1000000007
#define PI acos(-1)
#define fi first
#define se second
#define lowbit(x) (x&(-x))
#define mp make_pair
#define pb push_back
#define ins insert
#define eps 1e-8
#define si size()
#define E exp(1.0)
#define fixed cout.setf(ios::fixed)
#define fixeds(x) setprecision(x)
#pragma GCC optimize(2)
using namespace std;
inline ll read(){ll s=0,w=1;char ch=getchar();
while(ch<'0'||ch>'9'){if(ch=='-')w=-1;ch=getchar();}
while(ch>='0'&&ch<='9') s=s*10+ch-'0',ch=getchar();return s*w;}
void put1(){ puts("Yes") ;}void put2(){ puts("No") ;}void put3(){ puts("-1"); }
ll qp(ll a,ll b, ll p){ll ans = 1;while(b){if(b&1){ans = (ans*a)%p;--b;}a =
(a*a)%p;b >>= 1;}return ans%p;}
const ull base=2333; const ull pp=19260811; const ull ppp=999998639;

const int manx=1e3+10;

ll c[500][500];
int main(){
    ll n=read(),m=read();
    for(int i=0;i<=n+m;i++){
        c[i][0]=c[i][i]=1;
	for(int j=1;j<i;j++)
		c[i][j]=(c[i-1][j]+c[i-1][j-1])%mod;
    }
    cout<<c[m][2]+c[n][2];
    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <string>
using namespace std;
int main() {
    int n;
    cin >> n;
    int t[n+1], x[n+1], y[n+1];
    t[0]=0; x[0]=0; y[0]=0;
    for(int i=1; i<=n; i++) cin >> t[i] >> x[i] >> y[i];

    for(int i=0; i<n; i++) {
        int ti = t[i+1]-t[i];
        int d = abs(x[i+1]-x[i]) + abs(y[i+1]-y[i]);

        if(ti<d || ti%2!=d%2) {
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 1408
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <iomanip>
#include <vector>
#include <string.h>
#include <string>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <math.h>
#include <algorithm>
#include <numeric>

using namespace std;

// マクロ&定数 ============================================================
typedef unsigned int uint;
typedef long long ll;
//typedef pair<int, int> P;

typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<bool> vbool;
typedef vector<string> vstring;

typedef vector<pair<int, int>> vpint;
typedef vector<pair<ll, ll>> vpll;
typedef vector<pair<double, double>> vpdouble;

typedef vector<vector<int>> vvint;
typedef vector<vector<ll>> vvll;
typedef vector<vpint> vvpint;
typedef vector<vpll> vvpll;
typedef vector<vector<double>> vvdouble;
typedef vector<vector<string>> vvstring;
typedef vector<vector<bool>> vvbool;

const int c_YET = -1;
const int INF = 1e9 + 1;
const ll LLINF = 1e17 + 1;
const int DX[9] = { 0,0,1,-1, 1, 1, -1, -1, 0 }; // 4;４近傍
const int DY[9] = { 1,-1,0,0, 1, -1, 1, -1, 0 }; // 8:８近傍 9:(0,0)を含む
const ll MOD = 1e9 + 7; //10^9 + 7
const ll MAX = 1e9;
const double PI = 3.14159265358979323846264338327950288;
//========================================================================



int main() {

	////==================================
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(30);
	////==================================


	ll A, B, C, D, E, F;
	cin >> A >> B >> C >> D >> E >> F;


	ll ans_weitht = min(A, B) * 100;
	ll ans_salt = 0;

	for (int a = 0; 100 * A * a <= F; a++)
	{
		for (int b = 0; 100 * A * a + 100 * B * b <= F; b++)
		{

			int water = 100 * A * a + 100 * B * b;
			int max_salt = min(F - water, (water / 100) * E);

			for (int c = 0; c * C <= max_salt; c++)
			{
				int nokori = max_salt - c * C;

				ll local_salt = c * C + nokori - nokori % D;

				if (double(ans_salt) / double(ans_weitht) < double(local_salt) / double(water + local_salt))
				{
					ans_weitht = water + local_salt;
					ans_salt = local_salt;
				}
			}


		}
	}



	cout << ans_weitht << " " << ans_salt << endl;









}





Measured memory_bytes: 256
#include <iostream>

using namespace std;

int n,w,d,p[101],s[101],hnum=0,buf;
typedef struct{
  int x;
  int y;
}Hako;
Hako hako[101],wake1,wake2;


int main(){
	
	
	
	cin>>n;
	cin>>w;
	cin>>d;
	
	while(n!=0 || w!=0 || d!=0){
		for(int lop=0;lop<101;lop++){
			p[lop]=0;
			s[lop]=0;
			hako[lop].x=0;
			hako[lop].y=0;
		}
		
		for(int lop=0;lop<n;lop++){
			cin>>p[lop];
			cin>>s[lop];
		}
		hnum=0;
		hako[0].x=w;
		hako[0].y=d;
		
		for(int lop=0;lop<n;lop++){
			s[lop]%=(hako[p[lop]-1].x+hako[p[lop]-1].y)*2;
			if(s[lop]-hako[p[lop]-1].x<0){
				wake1.x=s[lop];
				wake1.y=hako[p[lop]-1].y;
				wake2.x=hako[p[lop]-1].x-s[lop];
				wake2.y=hako[p[lop]-1].y;
			}else if(s[lop]-hako[p[lop]-1].x-hako[p[lop]-1].y<0){
				wake1.x=hako[p[lop]-1].x;
				wake1.y=s[lop]-hako[p[lop]-1].x;
				wake2.x=hako[p[lop]-1].x;
				wake2.y=hako[p[lop]-1].y-(s[lop]-hako[p[lop]-1].x);
			}else if(s[lop]-hako[p[lop]-1].x-hako[p[lop]-1].x-hako[p[lop]-1].y<0){
				wake1.x=s[lop]-hako[p[lop]-1].x-hako[p[lop]-1].y;
				wake1.y=hako[p[lop]-1].y;
				wake2.x=hako[p[lop]-1].x-(s[lop]-hako[p[lop]-1].x-hako[p[lop]-1].y);
				wake2.y=hako[p[lop]-1].y;
			}else{
				wake1.x=hako[p[lop]-1].x;
				wake1.y=s[lop]-(hako[p[lop]-1].x*2)-hako[p[lop]-1].y;
				wake2.x=hako[p[lop]-1].x;
				wake2.y=hako[p[lop]-1].y-(s[lop]-(hako[p[lop]-1].x*2)-hako[p[lop]-1].y);
			}
			//cout<<p[lop]-1<<"aaa"<<hnum<<endl;
			for(int lop2=p[lop]-1;lop2<hnum;lop2++){
				hako[lop2].x=hako[lop2+1].x;
				hako[lop2].y=hako[lop2+1].y;
			}
			if(wake1.x*wake1.y<wake2.x*wake2.y){
				hako[hnum].x=wake1.x;
				hako[hnum].y=wake1.y;
				hako[hnum+1].x=wake2.x;
				hako[hnum+1].y=wake2.y;
			}else{
				hako[hnum].x=wake2.x;
				hako[hnum].y=wake2.y;
				hako[hnum+1].x=wake1.x;
				hako[hnum+1].y=wake1.y;
			}
			hnum++;
			
			/*hako[p[lop]-1].x=wake1.x;
			hako[p[lop]-1].y=wake1.y;
			for(int lop2=0;lop2<hnum+1;lop2++){
				if(hako[lop2].x==0){
					hako[lop2].x=wake2.x;
					hako[lop2].y=wake2.y;
				}
			}*/
			
			
		}
		
		for(int lop=0;lop<hnum+1;lop++){
			for(int lop2=0;lop2<hnum;lop2++){
				if(hako[lop2].x*hako[lop2].y>hako[lop2+1].x*hako[lop2+1].y){
					
					buf=hako[lop2].x;
					hako[lop2].x=hako[lop2+1].x;
					hako[lop2+1].x=buf;
					
					buf=hako[lop2].y;
					hako[lop2].y=hako[lop2+1].y;
					hako[lop2+1].y=buf;
				}
			}
		}
		
		cout<<hako[0].x*hako[0].y;
		for(int lop2=1;lop2<hnum+1;lop2++){
			cout<<' '<<hako[lop2].x*hako[lop2].y;
		}
		cout<<endl;
		
		cin>>n;
		cin>>w;
		cin>>d;
	}
	
	
	
	return 0;
}

Measured memory_bytes: 3020
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
using namespace std;

#define pb         push_back
#define mp         make_pair
#define ll         long long
#define PI         acos(-1.0)
#define ALL(A)     ((A).begin(), (A).end())
#define vsort(v)   sort(v.begin(),v.end())
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)

int main(){
    int a,b,c;
    int sq=0,hishi=0;
    while(scanf("%d,%d,%d",&a,&b,&c)==3){
        if(a*a+b*b==c*c) sq++;
        if(a==b) hishi++;
    }
    cout << sq << endl;
    cout << hishi << endl;
}

Measured memory_bytes: 3140
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author NikuKyabe
 */

#include "bits/stdc++.h"
using namespace std;
#define int long long
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define REP(i,n)  FOR(i,0,(n))


class BCoins {
public:
	void solve(std::istream& in, std::ostream& out) {
    int a,b,c,x;
    in >> a >> b >> c >> x;
    int ans = 0;
    REP(i,a + 1) REP(j,b + 1) REP(k,c + 1){
      if(i * 500 + j * 100 + k * 50 == x){
        ans++;
      }
    }
    out << ans << endl;
	}
};


signed main() {
  ios::sync_with_stdio(false);
  cout.tie(0);
  cout << fixed;
	BCoins solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std ;
#define ll long long
inline int D(){
    int t ;
    scanf( "%d" , &t ) ;
    return t ;
}
inline ll LLD(){
    ll t ;
    scanf( "%lld" , &t ) ;
    return t ;
}


//#########################################

int main() {

int n=D(),m=D();
char a[n][n];
char b[m][m];
for(int i=0;i<n;i++){
   for(int j=0;j<n;j++){
   cin>>a[i][j];

   }

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

}



for(int i=0;i<n;i++){
   for(int j=0;j<n;j++){
int cnt=0;

     for(int ii=0;ii<m;ii++){
       for(int jj=0;jj<m;jj++){

       if(b[ii][jj]==a[i+ii][j+jj]){
       cnt++;

       }

       }





     }
     if(cnt==(m*m)){
     cout<<"Yes";
     return 0;
     }



   }

}
cout<<"No";

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
    int a,b;
    scanf("%d%d",&a,&b);
    if(a>=1&&a<=9&&b>=1&&b<=9)
        printf("%d",a*b);
    else
        printf("-1");
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
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 int64_t INF = 1LL << 60;

int main() {
  int x,y;
  cin>>x>>y;
  if(x%y==0){cout<<-1<<endl;}
  else{cout<<x<<endl;}
  return 0;
  }

Measured memory_bytes: 256
N, A, B = map(int, input().split())
M = A + B
S = input()

for s in S:
    if M <= 0:
        print("No")
    elif s == "a":
        print("Yes")
        M -= 1
    elif s == "b":
        if B <= 0:
            print("No")
        else:
            print("Yes")
            M -= 1
            B -= 1
    else:
        print("No")
        

Measured memory_bytes: 4016
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public final class Main {

    public static void main(String[] args) {
        final Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        final int n = Integer.parseInt(in.nextLine());
        Map<String, Integer> map = new HashMap<>();
        for (int i = 0; i < n; i++) {
            map.merge(in.nextLine(), 1, Integer::sum);
        }
        System.out.println("AC x " + map.getOrDefault("AC", 0));
        System.out.println("WA x " + map.getOrDefault("WA", 0));
        System.out.println("TLE x " + map.getOrDefault("TLE", 0));
        System.out.println("RE x " + map.getOrDefault("RE", 0));
    }
}


Measured memory_bytes: 59772
#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long int n,sum=0;
	cin>>n;
	long long int a[n];
	for(int i=0;i<n;i++)
	cin>>a[i];
	int x=a[0];
	for(long long int i=1;i<n;i++)
	{
		sum = (sum +((long long int )a[i]*x))%1000000007;
		x = (x+a[i])%1000000007;
	}
	cout<<sum<<endl;
	return 0;
}

Measured memory_bytes: 5208
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep_(i, n, m) for (int i = n; i < (int)(m); i++)
#define all(v) v.begin(), v.end()
#define int long long
#define stoi stoll
//#define _GLIBCXX_DEBUG

signed main() {
  int N; cin >> N;
  vector<int> x(N), y(N), t(N);
  rep(i, N) cin >> t[i] >> x[i] >> y[i];
  
  int X=0, Y=0, T=0;
  rep(i, N) {
    if(abs(X-x[i])+abs(Y-y[i]) > t[i]-T || (abs((abs(X-x[i])+abs(Y-y[i])-(t[i]-T))))%2 == 1) {
      cout << "No" << endl;
      return 0;
    }
    X = x[i];
    Y = y[i];
    T = t[i];
  }
  cout << "Yes" << endl;
  return 0;

}

Measured memory_bytes: 5632
use std::io::Read;

fn search(g : &Vec<Vec<usize>>, s: &[u8], pos : usize, prev : usize) -> (i32, i32, i32) {
    let mut res = (0, 0, 0);
    let mut child_res = Vec::new();
    for &t in &g[pos] {
        if t == prev { continue }
        let r = search(g, s, t, pos);
        res.0 += r.0;
        res.2 += r.0 + r.2;
        child_res.push((r.1 + r.0, r.2 + r.0));
    }
    res.1 = res.2 % 2;
    for p in child_res {
        res.1 = std::cmp::max(res.1, p.0 - (res.2 - p.1));
    }
    if s[pos] == b'1' { res.0 += 1 }
    res
}

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).ok();
    let mut it = buf.split_whitespace();
    let n = it.next().unwrap().parse::<usize>().unwrap();
    let s = it.next().unwrap().as_bytes();
    let mut g = vec![Vec::new(); n];
    for _ in 0..n-1 {
        let a = it.next().unwrap().parse::<usize>().unwrap() - 1;
        let b = it.next().unwrap().parse::<usize>().unwrap() - 1;
        g[a].push(b);
        g[b].push(a);
    }
    let mut res = None;
    for i in 0..n {
        let r = search(&g, s, i, n);
        if r.1 == 0 {
            if let Some(p) = res {
                res = Some(std::cmp::min(p, r.2/2));
            } else {
                res = Some(r.2/2);
            }
        }
    }
    println!("{}", res.unwrap_or(-1));
}


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

#define IOS                               \
	ios_base::sync_with_stdio(false); \
	cin.tie(0);                       \
	cout.tie(0);                      \
	cin.exceptions(cin.failbit);
#define int long long int //Comment when Unnecessary
#define ll long long
#define sz(a) (int)((a).size())
#define all(a) a.begin(), a.end()
#define rep(i, a, b) for (int i = a; i < (b); ++i)
#define trav(a, x) for (auto &a : x)
#define pii pair<int, int>
#define vi vector<int>
#define F first
#define S second
#define endl "\n" // Remove on Interactive

const int N = 300009;
const int mod = 1000000007;
int szi[N];

struct UF
{
	vi e;
	UF(int n) : e(n, -1) {}
	bool same_set(int a, int b) { return find(a) == find(b); }
	int size(int x) { return -e[find(x)]; }
	int find(int x) { return e[x] < 0 ? x : e[x] = find(e[x]); }
	bool join(int a, int b)
	{
		a = find(a), b = find(b);
		if (a == b)
			return false;
		if (e[a] > e[b])
			swap(a, b);
		e[a] += e[b];
		e[b] = a;
		return true;
	}
};

int n, m, k, a, b;

void pre()
{
}

int32_t main()
{
	IOS;
	pre();
	cin >> n >> m >> k;
	UF x(n);
	rep(i, 0, m)
	{
		cin >> a >> b;
		a--, b--;
		x.join(a, b);
		szi[a]++;
		szi[b]++;
	}
	int ans[N];
	rep(i, 0, n)
	{
		ans[i] = x.size(i) - szi[i] - 1;
		// cout << ans[i] << endl;
	}
	rep(i, 0, k)
	{
		cin >> a >> b;
		a--, b--;
		if (x.same_set(a, b))
		{
			ans[a]--, ans[b]--;
		}
	}
	rep(i, 0, n)
	{
		cout << ans[i] << " ";
	}
	cout << endl;
	return 0;
}


Measured memory_bytes: 3968
#include <bits/stdc++.h>
using namespace std;
#define FIN ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

int main() {FIN
    
    int a, b, c, d = 0;
    cin >> a >> b >> c;
    for (; a <= b; a++) {
        if (c % a == 0)
            d++;
    }
    cout << d << "\n";
    return 0;
}


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

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

int32_t main()
{
    IOS;

    string s, t, u;
    int a, b;
    cin >> s >> t;
    cin >> a >> b;
    cin >> u;
    if(u == s)
    {
        a--;
    }
    else if( u == t)
        b--;
    
    cout << a <<" " <<  b << endl;
    
    return 0;
}

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

int P,Q,R;
int main(void){
  cin>>P>>Q>>R;
  if(P>Q && P>R) cout<<Q+R<<endl;
  else if(Q>R) cout<<P+R<<endl;
  else cout<<Q+P<<endl;
  return 0;
}


Measured memory_bytes: 764
n=int(input())
l=list(map(int,input().split()))
l.reverse()
m=[2,3]
if l[0]!=2:
    print(-1)
    exit()
for i in range(1,n):
    p=l[i]
    s=-(-m[0]//p)*p
    e=(m[1]//p)*p+p-1
    if not m[0]<=s<=m[1]:
        print(-1)
        exit()
    m=[s,e]
print(*m)


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

int main() {
	// your code goes here
	long long dp[2005][2005]={0},sum[2005][2005]={0},mod=1000000007;
	int n,m,s[2005],t[2005],i,j,k;
	cin >> n >> m;
	for(i=1;i<=n;i++) cin >> s[i];
	for(i=1;i<=m;i++) cin >> t[i];
	for(i=1;i<=n;i++){
		for(j=1;j<=m;j++){
			if(s[i]==t[j]) dp[i][j]=(sum[i-1][j-1]+1)%mod;
			else dp[i][j]=0;
			if(i==1) sum[i][j]=(sum[i][j-1]+dp[i][j])%mod;
			else if(j==1) sum[i][j]=(sum[i-1][j]+dp[i][j])%mod;
			else sum[i][j]=(sum[i-1][j]+sum[i][j-1]-sum[i-1][j-1]+mod+dp[i][j])%mod;
		}
	}
	cout << (sum[n][m]+1)%mod << endl;
	return 0;
}


Measured memory_bytes: 63104
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define show(x)  cerr << #x << " = " << (x) << endl;
using namespace std;

const int MAX_N = 100005;

//[1, n]
int bit[MAX_N + 1] = {0};

int sum(int i){
    int s = 0;
    while(i > 0){
        s = max(s,bit[i]);
        i -= i & -i;
    }
    return s;
}

void add(int i, int x, int n){
    while(i <= MAX_N){
        //bit[i] += x;
        bit[i] = max(bit[i], x);
        i += i & - i;
    }
}

int main(){
    int n,m;
    while(cin >> n,n){
        memset(bit,0,sizeof(bit));
        pair<int, int> p[MAX_N];
        rep(i,n) cin >> p[i].first >> p[i].second;
        cin >> m;
        range(i,n,n + m) cin >> p[i].first >> p[i].second;

        rep(i,n + m) p[i].second *= -1;
        sort(p, p + n + m);
        rep(i,n + m) p[i].second *= -1;

        int dp[MAX_N] = {0};
        rep(i,n + m){
            dp[i] = sum(p[i].second - 1) + 1;
            add(p[i].second, dp[i], n + m);
        }
        cout << *max_element(dp, dp + MAX_N) << endl;
    }
}

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

namespace AtCoder.Abc
{
    public class QuestionA
    {
        public static void Main(string[] args)
        {
            // 文字列配列の入力
            string[] inputStrArray = Console.ReadLine().Split(' ');

            var number = inputStrArray[0] + inputStrArray[1] + inputStrArray[2];

            if((int.Parse(number) % 4) == 0) {
                Console.WriteLine("YES");
            } else {
                Console.WriteLine("NO");
            }
        }
    }
}

Measured memory_bytes: 11092
using System;
class Program
{
    static void Main(string[] args)
    {
        bool isyes = false;
        string str = Console.ReadLine();//2つ以上のスペース区切り入力の取得
        foreach (char a in str)
        {
            int s = int.Parse(a.ToString());
            if (s == 7)
            {
                isyes = true;

            }
        }
        if (isyes)
        {

            Console.Write("Yes");//改行なし出力
        }
        else
        {

            Console.Write("No");//改行なし出力
        }
    }
}




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

int main()
{
    set<int> s;
    int n, m;

    cin >> n;
   
    int a;

    for( int i = 0; i < n; i++ )
    {
        cin >> a;
        s.insert(a);
    }

    cin >> m;

    for( int i = 0; i < m; i++ )
    {    
        cin >> a;
        s.insert(a);
    }

    for( set<int>::iterator itr = s.begin(); itr != s.end(); itr++ )
        cout << *itr << endl;

    return 0;
}


Measured memory_bytes: 21788
#include <algorithm>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for(int(i) = 0; (i) < (n); (i)++)
#define FOR(i, m, n) for(int(i) = (m); (i) < (n); (i)++)
#define All(v) (v).begin(), (v).end()
#define pb push_back
#define MP(a, b) make_pair((a), (b))
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const int INF = 1 << 30;
const ll LINF = 1LL << 60;
const int MOD = 1e9 + 7;

int main() {
    ll N, K;
    cin >> N >> K;
    if(K % 2) {
        ll a = N / K;
        cout << a * a * a << endl;
    } else {
        ll a = N / K;
        ll b = a + ((a * K) + K / 2 <= N);
        cout << a * a * a + b * b * b << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){


  int a,b,c=0,d,i,j,n,array[5]={};
  long long min=10000000000;


  cin >> n;
 
  for(i=1;i<=n;i++){
    cin >> array[i];
    if(min>array[i]){
      min=array[i];
    }
  }

 cout << 1 << '\n';
  for(i=2;i<=min;i++){
    if (min%i==0){
      b=i;
      for(j=1;j<=n;j++){
	if(array[j]%b!=0){
	  c++;
	}
      }
      if(c==0){
	//	printf("%d\n",b);
	cout << b << '\n';
      }
    }
    c=0;
  }

  return 0;
}

Measured memory_bytes: 1160
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdbool.h>
#include <math.h>

int max(int a, int b){
    if(a > b){
        return a;
    }else{
        return b;
    }
}

int main(void){

    char S[100001];

    scanf("%s", S);

    int len = strlen(S);
    int ans = len;

    for(int i = 1; i < len; i++){
        if(S[i] != S[i-1]){
            if(ans > max(i, len-i)){
                ans = max(i, len-i);
            }
        }
    }

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

    return 0;
}

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

int main() {
    int n, t, a;
    cin >> n >> t >> a;
    int delta = 1 << 30;
    int point = -1;
    for (int i = 0; i < n; i++){
        int h;
        cin >> h;
        int temp = abs(1000 * t - 6 * h - a * 1000);
        if (temp < delta){
            delta = temp;
            point = i + 1;
        }
    }

    cout << point << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <limits>
#include <vector>

using namespace std;
int myPow(int x, int p) {
        if (p == 0) return 1;
        if (p == 1) return x;
        int tmp = myPow(x, p/2);
        if (p%2 == 0) return tmp * tmp;
        else return x * tmp * tmp;
}

bool isSufficient(vector<vector<int>> &A, int n, int m, int x, int bin) {
    int columnSum;
    int bin2;
    int i;
    for (int j = 0; j < m; j++) {
        bin2 = bin;
        i = 0;
      	columnSum = 0;
        while (bin2) {
            if (bin2 & 1) {
                columnSum += A[i][j];
            }
            bin2 >>= 1;
            i++;
        }
        if (columnSum < x) return false;
    }
    return true;
}

int sumPrice(int C[], int n, int bin) {
    int sum = 0;
    int i = 0;
    while (bin) {
        if (bin & 1) sum+= C[i];
        bin >>= 1;
        i++;
    }
    return sum;
}
int main() {
	int n, m, x;
    cin >> n >> m >> x;
    int C[n];
    vector<vector<int>> A(n, vector<int> (m, 0));
    for (int i = 0; i < n; i++) {
        cin >> C[i];
        for (int j = 0; j < m; j++) {
            cin >> A[i][j];
        }
    }
    int minSoFar = std::numeric_limits<int>::max();
    int currentPrice;
    for (int i = 0; i < myPow(2, n); i++) {
        if (isSufficient(A, n, m, x, i)) {
            currentPrice = sumPrice(C, n, i);
            if (minSoFar > currentPrice) {
                minSoFar = currentPrice;
            }
        }
    }
    if (minSoFar == std::numeric_limits<int>::max()) {
        cout << -1;
    } else {
        cout << minSoFar;
    }
}

Measured memory_bytes: 3116
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define endl "\n"
#define F first
#define S second
#define mod 1000000007
#define pb push_back
#define FOR(i,a,n) for(int i=a;i<n;i++)
#define REV(i,a,n) for(int i=a;i>=n;i--)
#define all(a) a.begin(),a.end()
const int NUM = 2e5 + 5;

int32_t main(){
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int num_tests=1; 
    //cin >> num_tests;
    while(num_tests-->0){
        int n,x,t; cin >> n >> x >> t;
        int ans = 0, make = 0;
        while(make < n){
            ans += t;
            make += x;
        }
        cout << ans;
    }    
}

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

using namespace std;

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

typedef long long ll;

const int Inf = 1e9;
const double EPS = 1e-9;

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

int lcm(int a, int b) {
    return a * b / gcd(a, b);
}

int bitCount(long bits) {
    bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555);
    bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333);
    bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f);
    bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff);
    return (bits & 0x0000ffff) + (bits >>16 & 0x0000ffff);
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;  cin >> n;
    double ans;
    vector<double> a(n);
    rep (i, n) {
      cin >> a[i];
    }
    double sum = 0;
    rep (i, n) {
      sum += 1 / a[i];
    }
    ans = 1 / sum;
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
s = input()
aa = s[:2]
bb = s[2:]
if 0 < int(aa) < 13 and 0 < int(bb) < 13:
    print('AMBIGUOUS')
elif 0 < int(aa) < 13:
    print('MMYY')
elif 0 < int(bb) < 13:
    print('YYMM')
else:
    print('NA')


Measured memory_bytes: 2940
N,M,C=map(int,input().split())
B=list(map(int,input().split()))
ans=0
for _ in range(N):
    A=list(map(int,input().split()))
    x=C
    for i in range(M):
        x+=A[i]*B[i]
    if x>0:
        ans+=1
print(ans)


Measured memory_bytes: 9108
n = int(input())
xys = [list(map(int, input().split())) + [i] for i in range(n)]
edges = []
xys.sort()
for i in range(n - 1):
    x1, y1, index1 = xys[i]
    x2, y2, index2 = xys[i + 1]
    edges.append((x2 - x1, index1, index2))

xys.sort(key=lambda x:x[1])
for i in range(n - 1):
    x1, y1, index1 = xys[i]
    x2, y2, index2 = xys[i + 1]
    edges.append((y2 - y1, index1, index2))

parent = [i for i in range(n)]
def find(x):
    if x == parent[x]:return x
    parent[x] = find(parent[x])
    return parent[x]

edges.sort()
ans = 0
for cost, index1, index2 in edges:
    p1, p2 = find(index1), find(index2)
    if p1 != p2:
        parent[p1] = p2
        ans += cost
print(ans)

Measured memory_bytes: 51956
import java.io.IOException;
import java.io.InputStream;
import java.math.BigInteger;
import java.util.*;
 class Main {

    public static void main(String[] args) throws IOException {
        FastR in = new FastR(System.in);
        StringBuilder st = new StringBuilder();
        int n = in.nextInt();
        int m = in.nextInt();
        ArrayList <Integer> fact = new ArrayList<>();
        for(int i=2;i*i<=m;i++) {
            if (m % i == 0) {
                fact.add(i);
                fact.add(m/i);
            }
        }
        int ans=0;
        if (n==1){

            ans =m;
        }
        else if(fact.size()==0) {
           ans =1;
        }




        else {
            Collections.sort(fact);

            for (int i = 0; i < fact.size(); i++) {
                if (fact.get(i) >= n) {
                    ans = m / fact.get(i);
                    break;
                }
            }
        }
                /*else{
                    ArrayList <Integer> sfact=new ArrayList<>();
                    boolean f = false;
                    int num = m/fact.get(i);
                    int p = fact.get(i);
                    for(int j=2;j*j<=num;j++){
                        if(num%j==0){
                            sfact.add(j);
                            sfact.add(num/j);
                        }

                    }
                    Collections.sort(sfact);
                    for(int j=0;j<sfact.size();j++)
                        if(sfact.get(j)*p<)
                    if(f)
                        break;
                }
            }
        }*/

        if(ans ==0)
            System.out.println(1);
        else
            System.out.println(ans);
    }
}

class FastR{

    byte[] buf = new byte[2048];
    int index, total;
    InputStream in;

    FastR(InputStream is) {
        in = is;
    }

    int scan() throws IOException {
        if (index >= total) {
            index = 0;
            total = in.read(buf);
            if (total <= 0) {
                return -1;
            }
        }
        return buf[index++];
    }

    String next() throws IOException {
        int c;
        for (c = scan(); c <= 32; c = scan());
        StringBuilder sb = new StringBuilder();
        for (; c > 32; c = scan()) {
            sb.append((char) c);
        }
        return sb.toString();
    }

    int nextInt() throws IOException {
        int c, val = 0;
        for (c = scan(); c <= 32; c = scan());
        boolean neg = c == '-';
        if (c == '-' || c == '+') {
            c = scan();
        }
        for (; c >= '0' && c <= '9'; c = scan()) {
            val = (val << 3) + (val << 1) + (c & 15);
        }
        return neg ? -val : val;
    }

    long nextLong() throws IOException {
        int c;
        long val = 0;
        for (c = scan(); c <= 32; c = scan());
        boolean neg = c == '-';
        if (c == '-' || c == '+') {
            c = scan();
        }
        for (; c >= '0' && c <= '9'; c = scan()) {
            val = (val << 3) + (val << 1) + (c & 15);
        }
        return neg ? -val : val;
    }
}

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

using namespace std;

int main()
{
    int n,i,fla=0;

    cin >> n;
    vector<int> h(n);

    cin >> h.at(0);

    for(i=1; i<n; i++){
        cin >> h.at(i);
        int k = h.at(i-1)- h.at(i);

        if(k >= 2){
            cout << "No" << endl;
            return 0;
        }else if(k == 1 && fla == 1){
            cout << "No" << endl;
            return 0;
        }else if(k == 1 && fla == 0){
            fla = 1;
        }else if(k < 0 && fla == 1){
            fla = 0;
        }
        
    }
    cout << "Yes" << endl;


    return 0;
}


Measured memory_bytes: 3780
#include <bits/stdc++.h>
using namespace std;
#define _overload3(_1,_2,_3,_4,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n,s) for (int i=a;s>0?i<n:i>n;i+=s)
#define rep(...) _overload3(__VA_ARGS__,per,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
const int inf = 1e9+10, mod = 1e9+7; const long long llinf = 1e18;
// head

int main(){
  int n,ans = 0;
  cin >> n;
  vector<int>A(n);
  rep(i,n) {cin >> A[i];A[i]--;}
  rep(i,n){
    int j = A[i];
    if(A[j] == i) ans++;
  }
  cout << ans/2 << endl;
}

Measured memory_bytes: 640
N,W=gets.split.map &:to_i
h={0=>0}
N.times{
	a,b=gets.split.map &:to_i
	h.to_a.each{|w,v|
		h[w+a]=[h[w+a]||0,v+b].max if w+a<=W
	}
}
p h.values.max

Measured memory_bytes: 2812
import sys
mod = 10**9+7
def main():
    n,m=map(int,input().split(' '))
    if m > 0:
        aaa = set(map(int,sys.stdin))
    else:
        aaa = set()

    dp = [0] * (n+1)
    dp[0] = 1
    dp[1] = 1 if 1 not in aaa else 0
    for i in range(2,n+1):
        if i in aaa:
            continue
        dp[i] = (dp[i-1]+dp[i-2])%mod

    print(dp[n])

main()

Measured memory_bytes: 11884