akhauriyash/Code-Regression huggingface dataset:
import java.util.*;
import java.lang.*;

public class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        Vector<Long> a = new Vector<>();
        
        int n = sc.nextInt();
        
        int query, p;
        long x;
        for (int i = 0; i < n; i++) {
            query = sc.nextInt();
            
            switch (query) {
                case 0:
                    x = sc.nextLong();
                    a.add(x);
                    break;
                case 1:
                    p = sc.nextInt();
                    System.out.println(a.elementAt(p));
                    break;
                case 2:
                    a.removeElementAt(a.size() - 1);
                    break;
            }
        }
    }
}


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

int main() {
    int x, y;
    while (1) {
        cin >> x >> y;
        if ((x == 0) && (y == 0)) {
            break;
        }
        cout << min(x,y) << " " << max(x,y) << endl;
    }
    return 0;
}



Measured memory_bytes: 3088
#include <bits/stdc++.h>
using namespace std;
#define sz(x) ((int) (x).size())
#define forn(i,n) for (int i = 0; i < int(n); ++i)
typedef long long ll;
typedef long long i64;
typedef long double ld;
const int inf = int(1e9) + int(1e5);
const ll infl = ll(2e18) + ll(1e10);

const int maxn = 100100;
int p[maxn];
ll da[maxn];
ll db[maxn];

int main() {
    #ifdef LOCAL
    assert(freopen("b.in", "r", stdin));
    #else
    #endif
    int n = 20000;
    //forn (i, n)
        //p[i] = i;
    cin >> n;
    forn (i, n) {
        cin >> p[i];
        --p[i];
    }
    
    db[0] = n;
    da[0] = 1;
    for (int i = 1; i < n; ++i)
        da[i] = 1, db[i] = -1;
    forn (i, n) {
        int p = ::p[i];
        da[p] += i;
        db[0] += i;
        db[p + 1] -= i;
    }

    ll x = 0;
    forn (i, n) {
        x += da[i];
        assert(x >= 1 && x <= ll(1e9));
        cout << x << ' ';
    }
    cout << '\n';
    x = 0;
    forn (i, n) {
        x += db[i];
        assert(x >= 1 && x <= ll(1e9));
        cout << x << ' ';
    }
    cout << '\n';
}


Measured memory_bytes: 1152
'use strict'

function sumCalc(f, t, prefix) {
  if (f === 0) {
    return prefix[t]
  }
  return prefix[t] - prefix[f-1]
}

function getPrefixSum(A) {
  var prefix = new Array(A.length)
  prefix[0] = A[0]
  for (var i = 1; i < A.length; i++) {
    prefix[i] = prefix[i-1] + A[i]
  }
  return prefix
}

function solve(N, A) {
  var dp = new Array(N).fill(0).map(e => new Array(N).fill(0))
  var prefix = getPrefixSum(A)
  var col = 1
  while (col < N) {
    var c = col
    for (var r = 0; r < N; r++) {
      if (c === N) {
        break
      }
      dp[r][c] = Number.MAX_SAFE_INTEGER
      for (var k = r; k < c; k++) {
        dp[r][c] = Math.min(dp[r][c], dp[r][k] + dp[k+1][c] + sumCalc(r, k, prefix) + sumCalc(k+1, c, prefix))
      }
      c++
    }
    col++
  }
  return dp[0][N-1]
}

function main(input) {
  var lines = input.split("\n")
  var N = parseInt(lines[0])
  var A = lines[1].split(' ').map(l => parseInt(l))
  var ans = solve(N, A)
  console.log(ans)
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 21320
#include <bits/stdc++.h>
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
//#define int long long
typedef long long ll;
using namespace std;
const int MOD = 1000000007;
const int INF = 1010000000;
const double EPS = 1e-10;
const pair<int,int> fd[] = {make_pair(1,0),make_pair(-1,0),make_pair(0,1),make_pair(0,-1)}; 

signed main(){
  string s;cin>>s;string ans;
  rep(i,s.length()){
    if(s[i] == '0'){
      ans += s[i];
    }else if(s[i] == '1'){
      ans += s[i];
    }else if(ans.length()){
      ans = ans.substr(0,ans.length()-1);
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
// Optimise
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

// #define MULTI_TEST
#ifdef LOCAL
#define db(...) ZZ(#__VA_ARGS__, __VA_ARGS__);
#define pc(...) PC(#__VA_ARGS__, __VA_ARGS__);
template <typename T, typename U>
ostream &operator<<(ostream &out, const pair<T, U> &p)
{
    out << '[' << p.first << ", " << p.second << ']';
    return out;
}
template <typename Arg>
void PC(const char *name, Arg &&arg)
{
    while (*name == ',' || *name == ' ')
        name++;
    std::cerr << name << " { ";
    for (const auto &v : arg)
        cerr << v << ' ';
    cerr << " }\n";
}
template <typename Arg1, typename... Args>
void PC(const char *names, Arg1 &&arg1, Args &&... args)
{
    while (*names == ',' || *names == ' ')
        names++;
    const char *comma = strchr(names, ',');
    std::cerr.write(names, comma - names) << " { ";
    for (const auto &v : arg1)
        cerr << v << ' ';
    cerr << " }\n";
    PC(comma, args...);
}
template <typename Arg1>
void ZZ(const char *name, Arg1 &&arg1)
{
    std::cerr << name << " = " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void ZZ(const char *names, Arg1 &&arg1, Args &&... args)
{
    const char *comma = strchr(names + 1, ',');
    std::cerr.write(names, comma - names) << " = " << arg1;
    ZZ(comma, args...);
}
#else
#define db(...)
#define pc(...)
#endif

using ll = long long;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define f first
#define s second
#define pb push_back
#define all(v) v.begin(), v.end()
auto TimeStart = chrono::steady_clock::now();
auto seed = TimeStart.time_since_epoch().count();
std::mt19937 rng(seed);
template <typename T>
using Random = std::uniform_int_distribution<T>;

const int NAX = 2e5 + 5, MOD = 1000000007;

void solveCase(int caseNo)
{
    int n, m, p;
    cin >> n >> m;
    set<int> solved;
    map<int, int> SomeName;
    int count, penalty;
    count = penalty = 0;
    for (int i = 0; i < m; i++)
    {
        string status;
        int pNo;
        cin >> pNo >> status;
        if (solved.find(pNo) == solved.end())
        {
            if (status == "WA")
            {
                SomeName[pNo]++;
            }
            else
            {
                count++;
                penalty += SomeName[pNo];
                solved.insert(pNo);
            }
        }
    }
    cout << count << ' ' << penalty << '\n';
}

int main()
{
#ifndef LOCAL
    ios_base::sync_with_stdio(0);
    cin.tie(0);
#endif
    int t = 1;
#ifdef MULTI_TEST
    cin >> t;
#endif
    for (int i = 1; i <= t; ++i)
    {
        solveCase(i);
#ifdef TIME
        cerr << "Case #" << i << ": Time " << chrono::duration<double>(chrono::steady_clock::now() - TimeStart).count() << " s.\n";
        TimeStart = chrono::steady_clock::now();
#endif
    }
    return 0;
}


Measured memory_bytes: 9600
#include<iostream>
#include<string>
#include<cmath>
#include<math.h>
//#include<array>
#include<algorithm>
#include<queue>
#include<deque>
#include<vector>
//#include<utility>
//#include<set>
//#include<map>
//#include<list>
//#include<bitset>
//#include<iomanip>

using namespace std;
using LLI = long long int;
LLI N;

//配列,座標
/*array<int, 8>dir_x = { 0,0,1,1,1,-1,-1,-1 };
array<int, 8>dir_y = { 1,-1,1,0,-1,1,0,-1 };
array<int, 4>dir_x2 = { 0,0,1,-1 };
array<int, 4>dir_y2 = { 1,-1,0,0 };
char alp[] = { 'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z' };*/

//Union Find
/*class UnionFind {
public:
	vector<int>data;
	UnionFind(int size) :data(size, -1) {};
	bool unionset(int x, int y) {
		x = root(x), y = root(y);
		if (x != y) {
			if (data[y] < data[x]) {
				swap(x, y);
			}
			data[x] += data[y];
			data[y] = x;
		}
		return x != y;
	}
	bool findset(int x, int y) {
		return root(x) == root(y);
	}
	int root(int x) {
		return data[x] < 0 ? x : data[x] = root(data[x]);
	}
	int size(int x) {
		return -data[root(x)];
	}
};*/

//最大公約数,最小公倍数
/*LLI gcd(LLI x, LLI y) {
	LLI  r;
	if (x < y) {
		swap(x, y);
	}
	r = x % y;
	while (r != 0) {
		x = y;
		y = r;
		r = x % y;
	}
	return y;
}
LLI lcm(LLI x, LLI y) {
	return x / gcd(x, y) * y;
}*/

//組み合わせ
/*long nCr(int n, int r) {
	long ans = 1;
	for (int i = n; i > n - r; i--) {
		ans = ans * i;
	}
	for (int i = 1; i < r + 1; i++) {
		ans = ans / i;
	}
	return ans;
}
long nHr(int n, int r) {
	n = n + r - 1;
	return nCr(n, r);
}*/

//素数判定
/*bool IsPrime(int num)
{
	if (num < 2) return false;
	else if (num == 2) return true;
	else if (num % 2 == 0) return false;

	double sqrtNum = sqrt(num);
	for (int i = 3; i <= sqrtNum; i += 2)
	{
		if (num % i == 0)
		{
			// 素数ではない
			return false;
		}
	}

	// 素数である
	return true;
}*/

//サンプル
/*const int n_max = 8;
array<array<bool, n_max>, n_max>graph;
int dfs(int v,int N,array<bool,n_max>visited) {
	int ret = 0;
	bool all_visited = true;
	for (int i = 0; i < N;i++) {
		if (visited[i] == false) {
			all_visited = false;
		}
	}
	if (all_visited) {
		return 1;
	}
	for (int i = 0; i < N;i++) {
		if (graph[v][i] == false) {
			continue;
		}
		if (visited[i] == true) {
			continue;
		}
		visited[i] = true;
		ret += dfs(i,N,visited);
		visited[i] = false;
	}
	return ret;
}*/

//サンプル
/*vector<vector<int>>sub;
int dfs(int id) {
	if (sub[id].size() == 0) {
		return 1;
	}
	int minP = (int)1e9;
	int maxP = 0;
	for (int i : sub[id]) {
		int P = dfs(i);
		minP = min(minP, P);
		maxP = max(maxP, P);
	}
	return minP + maxP + 1;
}*/

//#define debug(x) cerr << #x << " : " << x << endl
//#define debugv(x) cerr << #x << " : "; for(auto i:x) cerr << i << ", "; cerr<<endl

int main(void) {
	LLI N,a,res = 1;
	vector<LLI>vec;
	cin >> N;
	for (int i = 0; i < N;i++) {
		cin >> a;
		vec.push_back(a);
	}
	for (int i = 0; i < N;i++) {
		if (vec[i] == res) {
			res++;
		}
	}
	if (res == 1) {
		cout << -1 << endl;
	}
	else {
		cout << N - (res - 1) << endl;
	}
}

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

int main(){
    int X;
    cin >> X;
    int n = 200000;
    vector<bool> is_prime(n+1);
    for(int64_t i=2; i<=n; i++) is_prime[i] = true;
    for(int64_t i=2; i<=n; i++){
        if(is_prime[i]){
            for(int64_t j=2*i; j<=n; j+=i) is_prime[j] = false;
        }
    }
    for(int i=X; ; i++) if(is_prime[i]){
        cout << i << endl;
        return 0;
    }
    return 0;
}


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

int main(){
  int n;
  cin >> n;
  n -= 2;
  cout << n * 180 << endl;
  return 0;
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
void alert(vector<int> vec){
  int64_t N = vec.size();
  for(int i=0; i<N-1; i++) cout << vec.at(i) << " ";
  cout << vec.at(N-1) << endl;
}

int main(){
  int X, Y, Z;
  cin >> X >> Y >> Z;
  cout << Z << " " << X << " " << Y << endl;
}

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

import fractions

##def lcm_base(x, y):
##    return (x * y) // fractions.gcd(x, y)

##def lcm_list(numbers):
##    return reduce(lcm_base, numbers, 1)

ans = A[0]
for i in range(1, N):
    ans = ans * A[i] // fractions.gcd(ans, A[i])

b = 0

for i in A:
##    b += lcm_list(A)/i
    b += ans//i
print(int(b)%(10**9+7))

Measured memory_bytes: 5612
#include <bits/stdc++.h>
#define PI 3.14159265358979323846
#define MAXINF (1e18L)
#define INF (1e9L)
#define EPS (1e-9)
#define MOD ((ll)(1e9+7))
#define REP(i, n) for(int i=0;i<int(n);++i)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define ALL(v) v.begin(),v.end()
#define FIND(v,x) (binary_search(ALL(v),(x)))
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(ALL(v));reverse(ALL(v))
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
#define YES(n) cout<<((n)?"YES":"NO")<<endl
#define pb push_back
#define fi first
#define se second
using namespace std;
template<class A>void pr(A a){cout << (a) << endl;}
template<class A,class B>void pr(A a,B b){cout << a << " "  ;pr(b);}
template<class A,class B,class C>void pr(A a,B b,C c){cout << a << " " ;pr(b,c);}
template<class A,class B,class C,class D>void pr(A a,B b,C c,D d){cout << a << " " ;pr(b,c,d);}
template<class T> inline bool chmin(T& a, T b){return a>b ? a=b, true : false;}
template<class T> inline bool chmax(T& a, T b){return a<b ? a=b, true : false;}
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll,ll> pll;

int main(void)
{
    string s;
    cin >> s;
    int n = s.length();
    REP(i, n-1){
        if(s[i]==s[i+1]){
            pr(i+1, i+2);
            return 0;
        }
        if(i!=n-2 && s[i]==s[i+2]){
            pr(i+1, i+3);
            return 0;
        }
    }

    pr(-1, -1);
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define lc 2 * v
#define rc 2 * v + 1
#define mid (s + e) / 2
#define ll long long
#define int long long
#define ld long double
#define pii pair <int , int>
#define pll pair <long long , long long>
#define FAST ios::sync_with_stdio(false);cin.tie(0);
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,avx,avx2")

const int maxn = 2e5 + 10 , N = 2e6 + 10 , SQ = 320 , base = 1999 , mod = 1e9 + 7 , INF = -1e18 , lg = 33;

int fac[maxn] , inv[maxn] , ans;

inline int power(int a , int b) {
    int res = 1;
    while(b) {
        if(b & 1) {
            res = (res * a) % mod;
        }
        b /= 2;
        a = (a * a) % mod;
    }
    return res;
}

int C(int a , int b) {
    int res = fac[a];
    res = ((res * inv[b]) % mod);
    res = ((res * inv[a - b]) % mod);
    return res;
}

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

    fac[0] = inv[0] = 1;
    for (int i = 1; i < maxn; ++i) {
        fac[i] = (fac[i - 1] * i) % mod;
        inv[i] = power(fac[i] , mod - 2);
    }
    for (int i = 1; i <= n; ++i) {
        if(3 * i > n) {
            break;
        }
        int val = n - (3 * i);
        ans = (ans + C(val + i - 1 , i - 1)) % mod;
    }
    cout << ans << '\n';
}


Measured memory_bytes: 6772
#include <cstdio>
#include <algorithm>

#define x first
#define y second

using namespace std;

const int p = 998244353;

typedef pair<int, int> pii;

pii a[202];

int ccw(pii u, pii v, pii w) {
	return (u.x - v.x) * (u.y - w.y) - (u.y - v.y) * (u.x - w.x);
}

int main() {
	int i, j, k, n, t, r = 0;
	scanf("%d", &n);
	for (i = 0; i < n; i++) {
		scanf("%d%d", &a[i].x, &a[i].y);
	}
	r = n + 1;
	for (i = 0; i < n; i++) for (j = 0; j < i; j++) {
		t = 1;
		for (k = 0; k < j; k++) if (ccw(a[i], a[j], a[k]) == 0) {
			t = (t << 1) % p;
		}
		r = (r + t) % p;
	}
	t = 1;
	for (i = 0; i < n; i++) t = (t << 1) % p;
	printf("%d\n", (t - r + p) % p);
}


Measured memory_bytes: 128
object Main {
  def main(args: Array[String]): Unit = {
    val sc = new java.util.Scanner(System.in)
    val n = sc.nextInt
    val a = List.fill(n)(sc.nextInt)

    val multipleOf4 = a.filter(_ % 4 == 0)
    val multipleOf2 = a.filter( i => i % 2 == 0 && i % 4 != 0)
    val ans = if (multipleOf4.length + multipleOf2.length / 2 >= n / 2) "Yes"
    else "No"

    println(ans)
  }
}

Measured memory_bytes: 56296
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include <bitset>
#include<cmath>
using namespace std;
#define INF 110000000000
#define MOD 1000000007
typedef long long ll;
typedef pair<int,int> P;



int main(){
  P a[110],b[110];
  int N,ans=0;
  cin>>N;

  for(int i=0;i<N;i++){
    cin>>a[i].first>>a[i].second;
    a[i].first*=(-1);
  }

  for(int i=0;i<N;i++){
    cin>>b[i].first>>b[i].second;
  }

  sort(a,a+N); sort(b,b+N);

  for(int i=0;i<N;i++){
    a[i].first*=(-1);
    int num=-1,temp=1000;
    for(int j=0;j<N;j++){
      if(b[j].first<=a[i].first) continue;
      if(a[i].second<b[j].second && temp>b[j].second){
        temp=b[j].second;
        num=j;
      }
    }
    if(num!=-1){
      ans++;
      b[num].first=-1000;
      //cout<<i<<" "<<num<<endl;
    }
  }
  cout<<ans<<endl;
}


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

int main(){
    string S;
    cin >> S;

    int l = S.length();
    int m = l / 2;
    int cnt = 0;
    for (int i = 0; i < m; i++){
        if (S[i] != S[l-i-1]){
            cnt++;
        }
    }
    cout << cnt << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int cnt[26]={};
  string s;cin>>s;
  for(char t:s) cnt[t-'a']++;
  string ans="Yes";
  for(int i=0;i<26;i++) ans=(cnt[i]%2?"No":ans);
  cout<<ans<<endl;
}


Measured memory_bytes: 256
import Data.List
import Data.Ord

solve :: [(Char, Char)] -> Ordering
solve [] = EQ
solve ((c1, c2):cs)
  | c1 < c2 = GT
  | c1 > c2 = LT
  | otherwise = solve cs

main :: IO ()
main = do
  s <- sort <$> getLine
  t <- sortOn Down <$> getLine
  let result = solve $ zip s t
  putStrLn $ if result == GT || (result == EQ && length s < length t)
             then "Yes"
             else "No"


Measured memory_bytes: 508
#include <bits/stdc++.h>
using namespace std;
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define in(x,y,h,w) x >= 0 && x < h && y >= 0 && y < w

#define int long long
//typedef    long long          ll;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      P;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
 
const int INF=1e+18;
const double EPS=1e-9;
const int MOD=1000000007;

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

signed main(){
	int n,s[100010],ma = 0;
	bool on[100010] = {};
	cin >> n;
	for(int i = 0;i < n;i++) cin >> s[i];
	for(int i = 1;i <= n / 2;i++){
		//cout << i << ":";
		int sum = 0;
		for(int j = 0;n - 1 - j > i;j += i){
			sum = sum + s[j] + s[n - 1 - j];
			//cout << sum << " ";
			on[j] = true;
			if(!on[n - 1 - j]) chmax(ma,sum);
			on[n - 1 - j] = true;
		}
		for(int j = 0;n - 1 - j > i;j += i){
			on[j] = false;
			on[n - 1 - j] = false;
		}
		//cout << endl;
	}
	cout << ma << endl;
}


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

int main(){
  int d, t, s;
  cin >> d >> t >> s;
  if(s*t >= d) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 3632
# 解説を参考に作成
# import sys
# sys.setrecursionlimit(10 ** 6)
# import bisect
# from collections import deque
# from decorator import stop_watch
# 
# 
# @stop_watch
def solve(N):
    if N % 2 == 1:
        print(0)
        return
    n = 10
    ans = 0
    while n <= N:
        ans += N // n
        n *= 5
    print(ans)


if __name__ == '__main__':
    N = int(input())
    solve(N)

    # # test
    # from random import randint
    # from func import random_str
    # solve()


Measured memory_bytes: 9004
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#define ll long long
using namespace std;
int N;
int main()
{
	scanf("%d",&N);
	for(ll i=1;i<=3500;i++)
	{
		for(ll j=1;j<=3500;j++)
		{
			if((4*i*j-N*i-N*j)>0&&(N*i*j)%(4*i*j-N*i-N*j)==0&&(N*i*j)/(4*i*j-N*i-N*j)>0)
			{
				printf("%lld %lld %lld",i,j,(N*i*j)/(4*i*j-N*i-N*j));
				return 0;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<stdint.h>
#include<malloc.h>
#include<math.h>


int my_gets(char *buf,int nBuf,FILE *fp){
    int ch;

    while(--nBuf >0){
        ch=getc(fp);
        if(ch==EOF || ch=='\n')
            break;
        *(buf++)=(char)ch;
    }
    *(buf)='\0';

    return nBuf;
}

int GetOddSum(char *buf){
    int ret=0;

    for(int i=0; i<7; i++)
        ret += buf[2*i+1] - '0';
    return ret;
}

int GetEvenSum(char *buf){
    int ret=0;

    for(int i=0; i<8; i++){
        int tmp =2*(buf[2*i] - '0');

        ret += (tmp>=10)?(tmp%10 +1):(tmp);
    }
    return ret;
}


int main(){
    int n,d;

    scanf("%d %d%*c",&n,&d);
    printf("%d\n", (n%(2*d+1)==0)?(n/(2*d+1)):((n/(2*d+1))+1) );
    
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
const ll MOD = 1000000007;

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

    vector<int> A(100000, 0);
    for(int i=0;i<N;i++){
        int a;
        cin >> a;
        A[a-1]++;
    }

    priority_queue<P> que;
    for(int i=0;i<100000;i++){
        if(A[i] == 0) continue;
        que.emplace(A[i], i);
    }

    while(que.size() >= 2 && que.top().first > 1){
        P p1 = que.top(); que.pop();
        P p2 = que.top(); que.pop();
        if(p2.first == 1){
            que.emplace(p1.first-1, p1.second);
        }else{
            que.emplace(p1.first-1, p1.second);
            que.emplace(p2.first-1, p2.second);
        }
    }

    cout << que.size() << endl;

    return 0;
}

Measured memory_bytes: 1784
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
using namespace std;

int main(void)
{
    vector<int> heights;
    for (int i = 0; i < 10; i++)
    {
        int h;
        cin >> h;
        heights.push_back(h);
    }
    sort(heights.begin(), heights.end(), greater<int>());
    for (int i = 0; i < 3; i++)
    {
        cout << heights[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 3148
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {
            var R = cin.ReadInt;
            WriteLine((double)R * 3.1415 * 2.0);
        }

    }


    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }

        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; i++)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }


        public string ReadLine { get { return _stream.ReadLine(); } }
        public int ReadInt { get { return int.Parse(Read); } }
        public long ReadLong { get { return long.Parse(Read); } }
        public double ReadDouble { get { return double.Parse(Read); } }
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
    }
}

Measured memory_bytes: 27984
#include<bits/stdc++.h>
using namespace std;
signed main()
{
  int n,a[60]={},b[60]={},c=0;
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>a[i];
    b[i]=a[i];
  }
  sort(b,b+n);
  for(int i=0;i<n;i++){
    if(a[i]!=b[i]){
      c=c+1;
    }
  }
    if(c>=3){
      cout<<"NO\n";
    }
    else{
      cout<<"YES\n";
    }
  return(0);
}


Measured memory_bytes: 256
void main()
{
    long h = rdElem;

    long cnt = 1;
    long result;
    while (h)
    {
        h >>= 1;
        result += cnt;
        cnt <<= 1;
    }

    result.writeln;
}

T rdElem(T = long)()
if (!is(T == struct))
{
    return readln.chomp.to!T;
}

alias rdStr = rdElem!string;
alias rdDchar = rdElem!(dchar[]);

T rdElem(T)()
if (is(T == struct))
{
    T result;
    string[] input = rdRow!string;
    assert(T.tupleof.length == input.length);
    foreach (i, ref x; result.tupleof)
    {
        x = input[i].to!(typeof(x));
    }
    return result;
}

T[] rdRow(T = long)()
{
    return readln.split.to!(T[]);
}

T[] rdCol(T = long)(long col)
{
    return iota(col).map!(x => rdElem!T).array;
}

T[][] rdMat(T = long)(long col)
{
    return iota(col).map!(x => rdRow!T).array;
}

void wrMat(T = long)(T[][] mat)
{
    foreach (row; mat)
    {
        foreach (j, compo; row)
        {
            compo.write;
            if (j == row.length - 1) writeln;
            else " ".write;
        }
    }
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.traits;
import std.container;
import std.functional;
import std.typecons;
import std.ascii;
import std.uni;

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define pi 3.1415  
#define ll long long
#define pii pair<int,int>
#define debug(a) cout<<a<<'\n'
#define maxn 100009
#define MOD 1000000007
#define INF (int)3000009
using namespace std;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n,k;
    cin>>n>>k;
    int ans=0;
    for(int i=0;i<n;i++){
        int a;
        cin>>a;
        if(a>=k)ans++;
    }
    cout<<ans<<endl;
    return 0;
}

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

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

#define RFOR(i, b, a) for(int(i)=(b); (i)>=(a); (i)--)
#define RREP(i, n) FOR((i), (n), 0)

#define pb push_back
#define mp make_pair 

using namespace std;

const int INF=INT_MAX/4;
const int MOD=1000000007;
const double EPS=1e-14;

const bool debug_flag=true;

void debug(string str){
	if(debug_flag){
		cout<<str<<endl;
	}
}

void debugs(string str){
	if(debug_flag){
		cout<<str;
	}
}

int main(int argc, char* argv[]){
	cin.tie(0);
	ios::sync_with_stdio(0);
	cout.precision(10);

	int N, M, x;
	cin>>N>>M;
	vector<vector<int> > g;
	g.resize(M);
	REP(i, N){
		cin>>x;
		g[x%M].pb(x);
	}

	int ans=0, s, t, S, T, cnt;
	FOR(i, 1, M/2.0){
		if(g[i].size()<g[M-i].size()){
			s=i;
			t=M-i;
			S=g[s].size();
			T=g[t].size();
		}else{
			s=M-i;
			t=i;
			S=g[s].size();
			T=g[t].size();
		}
		sort(g[t].begin(), g[t].end());
		cnt=0;
		REP(j, g[t].size()){
			if(g[t][j]==g[t][j+1] && cnt*2<=T-S-2){
				cnt++;
				j++;
			}
		}
		ans+=cnt+S;
	}

	ans+=g[0].size()/2;
	if(M%2==0){
		ans+=g[M/2].size()/2;
	}

	cout<<ans<<endl;

	return 0;
}



Measured memory_bytes: 5760
#include<iostream>
#include<cmath>
using namespace std;
typedef long long ll;


int main(){
	ll yu = 100;
	ll x;
	cin>>x;
	int ans = 0;
	while(yu < x)
	{
		yu += yu * 0.01;
		ans++;
	}
	
	cout<<ans<<endl;
	
	return 0;
}



Measured memory_bytes: 3172
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> v(n);
  for(int i=0; i<n; i++) {
      cin >> v[i];
  }
  int q;
  cin >> q;
  vector<int> vc(q);
  for(int i=0; i<q; i++) {
      cin >> vc[i];
  }
  for(int i=0; i<q; i++) {
      cout << (lower_bound(v.begin(),v.end(),vc[i])-v.begin()) << " ";
      cout << (upper_bound(v.begin(),v.end(),vc[i])-v.begin()) << endl;
  }
}


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

#ifdef LOCAL
#define DEBUG(...) debug(#__VA_ARGS__, __VA_ARGS__);
#else
#define DEBUG(...)
#endif

template<typename T, typename S> ostream& operator << (ostream &os, const pair<T, S> &p) {return os << "(" << p.first << ", " << p.second << ")";}
template<typename C, typename T = decay<decltype(*begin(declval<C>()))>, typename enable_if<!is_same<C, string>::value>::type* = nullptr>
ostream& operator << (ostream &os, const C &c) {bool f = true; os << "["; for (const auto &x : c) {if (!f) os << ", "; f = false; os << x;} return os << "]";}
template<typename T> void debug(string s, T x) {cerr << s << " = " << x << "\n";}
template<typename T, typename... Args> void debug(string s, T x, Args... args) {cerr << s.substr(0, s.find(',')) << " = " << x << " | "; debug(s.substr(s.find(',') + 2), args...);}

int a[200000], b[200000];

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    int n, m, k;
    cin >> n >> m >> k;
    for (int i=0; i<n; i++)
        cin >> a[i];

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

    int i = 0;
    while (i < n && tot + a[i] <= k)
        tot += a[i++];

    int ret = (tot <= k ? m + i : 0);
    for (int j=m-1; j>=0; j--) {
        tot -= b[j];
        while (i < n && tot + a[i] <= k)
            tot += a[i++];
        if (tot <= k)
            ret = max(ret, j + i);
    }

    cout << ret << "\n";

    return 0;
}


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

#define ALL(a) begin(a),end(a)
#define COUNTOF(a) (sizeof(a)/sizeof(a[0]))
#define SP << " " <<
#define FMT(a) #a<<":"<<a 
#define FMT2(a,b) #a<<":"<<a<<", "<<#b<<":"<<b 
#define FMT3(a,b,c) #a<<":"<<a<<", "<<#b<<":"<<b<<", "<<#c<<":"<<c 
#define FMT4(a,b,c,d) #a<<":"<<a<<", "<<#b<<":"<<b<<", "<<#c<<":"<<c<<", "<<#d<<":"<<d 
typedef long long ll;
template<class T> istream& operator >> (istream& s, vector<T>& v) {
  for (T& x: v) s >> x;
  return s;
}
inline void Yes(bool f=true){cout<<(f?"Yes":"No")<<endl;}
inline void YES(bool f=true){cout<<(f?"YES":"NO")<<endl;}
#define ANS(a) cout<<a<<endl

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

    int N; cin >> N;
    int x,y;
    x = 800*N;
    y = 200*(N/15);
    cout << x-y << endl;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
  double x[10]={0};
  double y[10]={0};
  int z[10]={0};
  string u[10];
  int N;
  cin >> N;
  for(int i=0;i<N;i++){
    cin >> x[i] >> u[i];
    if(u[i]=="BTC"){
      y[i] = x[i]*380000;
    }else{
      z[i] = x[i];
    }
  }
  cout << y[0]+y[1]+y[2]+y[3]+y[4]+y[5]+y[6]+y[7]+y[8]+y[9]+z[0]+z[1]+z[2]+z[3]+z[4]+z[5]+z[6]+z[7]+z[8]+z[9] << endl;
  return 0;
}


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

int main()
{
    int n;cin >> n;
    int sum=0;
    vector<int> kushi;
    for(int i=0;i<2*n;++i){
        int buff;cin>>buff;
        kushi.push_back(buff);
    }
    sort(begin(kushi),end(kushi));
    for(int i=0;i<n;++i)
        sum += kushi[i*2];
    cout << sum;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String T = sc.next();

		String[] ss = S.split("");
		String[] tt = T.split("");

		for (int i = 0; i < ss.length; i++) {
			String kaiten = "";
			kaiten += tt[ss.length - 1];
			for (int j = 0; j <= ss.length - 2; j++) {
				kaiten += tt[j];
			}
			if (kaiten.equals(S)) {
				System.out.println("Yes");
				return;
			}
			tt = kaiten.split("");
		}
		System.out.println("No");
	}
}


Measured memory_bytes: 26452
#include<iostream>
using namespace std;
using ll = long long;

ll fun(ll n, ll x){
	if (x > n)return 0;
	bool i3 = 0, i5 = 0, i7 = 0;
	for (ll i = x; i > 0; i /= 10){
		if (i % 10 == 3)i3 = 1;
		if (i % 10 == 5)i5 = 1;
		if (i % 10 == 7)i7 = 1;
	}
	ll res = fun(n, x * 10 + 3) + fun(n, x * 10 + 5) + fun(n, x * 10 + 7) + (i3 && i5 && i7);
	return res;
}

int main(){
	ll n, ans = 0;
	cin >> n;
	cout << fun(n,0) << endl;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
    public static int stack[], sp = 0;
    public static void push(int x){stack[sp++] = x;}
    public static int pop(){return stack[--sp];}

    public static void main(String args[] ) throws Exception {
        stack = new int[100];
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String line = br.readLine().trim();
        String[] arr = line.split(" ");
        for(String str : arr){
            switch(str){
            case "+":
            	push(pop() + pop());
                break;
            case "-":
                push(-1 * pop() + pop());
                break;
            case "*":
                push(pop() * pop());
                break;
            default:
                push(Integer.parseInt(str));
            }
        }
        System.out.println(pop());
    }
}



Measured memory_bytes: 24408
#include <iostream>
#include <set>

int main() {
    int a, b, c; std::cin >> a >> b >> c;
    std::set<std::tuple<int, int, int>> memo;

    int cnt = 0;

    while (true) {
        if ((a%2 == 1) || (b%2 == 1) || (c%2 == 1)) {
            break;
        }
        memo.insert(std::make_tuple(a, b, c));
        cnt++;
        int na = (b + c) / 2;
        int nb = (c + a) / 2;
        int nc = (a + b) / 2;
        if (memo.find(std::make_tuple(na, nb, nc)) != memo.end()) {
            std::cout << -1 << std::endl;
            return 0;
        }
        a = na; b = nb; c = nc;
    }

    std::cout << cnt << std::endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define all(V) V.begin(),V.end()

priority_queue<pair<int, int>> Q;
vector<int> G[100010];
int rt[100010], par[100010], out[100010];

void rf(int x, int c) {
	rt[x] = c;
	if (x != 0&&G[x].size() == 1)
		Q.push({ c,x });
	for (int i : G[x]) {
		if (rt[i]) {
			par[x] = i;
			continue;
		}
		rf(i, c + 1);
		out[x]++;
	}
}

int main() {
	int N, a, b, g;
	cin >> N;
	for (int i = 1;i < N;i++) {
		cin >> a >> b;
		a--;b--;
		G[a].push_back(b);
		G[b].push_back(a);
	}

	rf(0, 1);

	while (!Q.empty()) {
		tie(g, b) = Q.top();
		Q.pop();
		if (b == 0) {
			cout << "First" << endl;
			return 0;
		}
		a = par[b];
		if (a == 0)continue;
		if (out[a] == 1) {
			out[par[a]]--;
			if (out[par[a]] == 0) {
				Q.push({ g - 2,par[a] });
			}
		}
	}
	for (int i = 0;i < N;i++) {
		if (out[i] > 1) {
			cout << "First" << endl;
			return 0;
		}
	}
	cout << "Second" << endl;
	return 0;
}

Measured memory_bytes: 7676
//#include<bits/stdc++.h>
#include<cstdio>
#include<string>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please

const int cm = 1 << 17;
char cn[cm], * ci = cn + cm;
inline char getcha() {
	if (ci - cn == cm) { fread(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	char C = getcha();
	int A = C - '0';
	while ((C = getcha()) >= '0') A = A * 10 + C - '0';
	return A;
}

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


	int N = getint(), K = getint(), Q = getint();

	int P[100001];
	rep1(i, N) {
		P[i] = K - Q;
	}
	rep(i, Q) {
		P[getint()]++;
	}
	string S;
	rep1(i, N) {
		if (P[i] > 0) S += "Yes\n";
		else S += "No\n";
		if (i % 100 == 0) {
			printf("%s", S.c_str());
			S = "";
		}
	}
	printf("%s", S.c_str());

	Would you please return 0;
}

Measured memory_bytes: 1152
// ConsoleApplication1.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>
#include <vector>
#include <algorithm>
#include <unordered_set>
#include <unordered_map>
#include <sstream>

using namespace std;

void A();
void B();
void C();
void D();
void E();

int main()
{
	A();
}

void A() {
	int x, y, z;
	cin >> x >> y >> z;
	cout << z << " " << x << " " << y << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<vector>
#include<queue>
#include<cstdio>
#include<cmath>
#define ll long long
using namespace std;

const int maxn=1e4+5;
const ll INF=0x3f3f3f3f;
ll n,m;

int main(){
	cin>>n>>m;
	ll ans=n*m;
	if (n>m) swap(n,m);
	
	if (n==1){
		ans=m-2;
	}else{
		ans-=n*2+m*2-4;
	}
	
	if (ans<0) ans=0;
	
	if (n==1&&m==1) ans=1;
	
	cout<<ans;	
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <random>
#include <chrono>
#include <queue>
#include <ctime>
#include <cassert>
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
#define fs first
#define sc second
#define INF 1000000000
#define MOD 1000000007
#define EPS 0.00000001


int main() {
    string O = "RUD";
    string E = "LUD";
    string S; cin >> S;
    for(int i=0; i<(int)S.size(); i++){
        bool f = false;
        if(i%2==0){
            for(int j=0; j<3; j++){
                if(S[i]==O[j]) f = true;
            }
        }else{
            for(int j=0; j<3; j++){
                if(S[i]==E[j]) f = true;
            }
        }
        if(!f){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    cerr << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
import math

a,b,degree = map(float, input().split())

rad = degree * math.pi / 180.0

Square = a * b / 2 * math.sin(rad)

c = b / math.sin(rad)

L =  a + b + math.sqrt(a*a + b*b - 2.0*a*b*math.cos(rad) )

h = b * math.sin(rad)

print("%.6f"%Square)
print("%.6f"%L)
print("%.6f"%h)


Measured memory_bytes: 5692
#include<bits/stdc++.h>
using namespace std;
#define very_slow       ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int             long long int
int32_t main()
{   
	very_slow
//	no_of_test(x)
	{
      int k;
	  cin>>k;
	  vector<pair<int,int>>v;
	  for(int w=0;w<k;w++)
	  {  int x,y;
	    cin>>x>>y;
         v.push_back(make_pair(x,y));
	  }
	    int cnt=0;
	   bool flag=false;
	   for(auto itr=v.begin();itr!=v.end();itr++)
	   { 
		   if(itr->first==itr->second)
		   {
               cnt++;
               if(cnt>=3)
               {
                   flag=true;
               }
           }
           else
           {
             cnt=0;  
           }
           
			 
		   
	   } 
	   if(flag==true)
	   {
		   cout<<"Yes"<<endl;
	   }
	   else
	   {
		   cout<<"No"<<endl;
	   }
	   
 
	}
	return 0;
}

Measured memory_bytes: 3652
#include <stdio.h>
 
#define WHITE 0
#define BLACK 2
#define GRAY 1
#define INFTY 1000000
int color[100];
int M[100][100];
int d[100];
int p[100];
int n;
void prim(){
  int u,minv,total;
  int i;
 
  for(i=0;i<n;i++){
    color[i]=WHITE;
    d[i]=INFTY;
    p[i]=-1;
  }
  d[0]=0;
  while(1){
    minv=INFTY;
    u=-1;
    for(i=0;i<n;i++){
      if(minv>d[i] && color[i]!=BLACK){
        u=i;
        minv=d[i];
      }
    }
    if(u==-1) break;
    color[u]=BLACK;
    for(i=0;i<n;i++){
      if(color[i]!=BLACK && M[u][i]!=INFTY){
        if(d[i]>M[u][i]){
          d[i]=M[u][i];
          p[i]=u;
          color[i]=GRAY;
        }
      }
    }
  }
  total=0;
  for(i=0;i<n;i++){
    if(p[i]!=-1)
    total+=M[i][p[i]];
  }
  printf("%d\n",total);
}
 
int main(int argc, char const *argv[]) {
  int i,j,s;
  scanf("%d",&n);
  for (i = 0; i < n; i++) {
    for(j=0;j<n;j++){
      scanf("%d",&s);
      M[i][j]=(s==-1)? INFTY:s;
    }
  }
  prim();
  return 0;
}

Measured memory_bytes: 640
/*

    author : s@if

*/

#include<bits/stdc++.h>
using namespace std;
#define NIL -1
#define fi first
#define sec second
#define MAX INT_MAX
#define INF 99999999
#define ll long long
#define PI acos(-1.0)
#define MOD 1000000007
#define PLL pair<ll,ll>
#define PII pair<int,int>
#define triplell pair<pair<ll,ll> , ll>
#define triple pair<pair<int,int> , int>
#define For(i,n) for(int i=0;i<(int)n;i++)
#define Forn(i,a,b) for(int i=(int)a;i<=(int)b;i++)
#define forba(i,a,b) for(int i=(int)b;i>=(int)a;i--)

int dx[]={+1,-1,+0,+0};
int dy[]={+0,+0,+1,-1};
int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};
int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};
int hr[]={-2,-2,-1,+1,+2,+2,-1,+1};
int hc[]={+1,-1,+2,+2,-1,+1,-2,-2};

const int MAXN = (int)1e5+9;

const int N = 100000;

int main()
{
/*	freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);  */
    
    int i,j,k,l,m,n,c,p,q,r,tc,t;
    
    cin>>n>>m>>c;
    
    int ara[m+9];
    for(i=1;i<=m;i++)
    	cin>>ara[i];

	int cnt = 0;
	
	for(i=1;i<=n;i++)
	{
		int s = 0;
		
		for(j=1;j<=m;j++)
		{
			cin>>p;
			
			s+=p*ara[j];
		}
		s+=c;
		
		if(s>0)
			cnt++;
	}
	
	cout<<cnt<<endl;
	
//	main();
    return 0;
}

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

int main() {
	int N, M;
	cin >> N >> M;
	vector<int> vec(N, 0);
	int sum = 0;
	for (int i=0;i<N;i++) {
		cin >> vec[i];
		sum += vec[i];
	}
	sort(vec.rbegin(), vec.rend());
	if (sum>4*M*vec[M-1]) {
		cout << "No" << endl;
	} else {
		cout << "Yes" << endl;
	}
}

Measured memory_bytes: 256
n, x = map(int,input().split())
a = list(map(int,input().split()))
ans = 0
if a[0] > x:
    ans += a[0] - x
    a[0] = x
for i in range(n-1):
    if a[i] + a[i+1] >= x:
        ans += a[i+1] +a[i] - x
        a[i+1] = x - a[i]
print(ans)

Measured memory_bytes: 14252
#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<vector>
#include<queue>
#include<bitset>
#include<string>
#include<stack>
#include<set>
#include<unordered_set>
#include<map>
#include<unordered_map>
#include<cstring>
#include<complex>
#include<cmath>
#include<iomanip>
#include<numeric>
#include<algorithm>
#include<list>
#include<functional>
#include<cassert>
#define mp make_pair
#define pb push_back
#define X first
#define Y second
#define y0 y12
#define y1 y22
#define INF 987654321987654321
#define PI 3.141592653589793238462643383279502884
#define fup(i,a,b,c) for(int (i)=(a);(i)<=(b);(i)+=(c))
#define fdn(i,a,b,c) for(int (i)=(a);(i)>=(b);(i)-=(c))
#define MEM0(a) memset((a),0,sizeof(a));
#define MEM_1(a) memset((a),-1,sizeof(a));
#define ALL(a) a.begin(),a.end()
#define SYNC ios_base::sync_with_stdio(false);cin.tie(0)
using namespace std;
typedef long long ll;
typedef long double ld;
typedef double db;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int, int> Pi;
typedef pair<ll, ll> Pll;
typedef pair<ld, ld> Pd;
typedef vector<int> Vi;
typedef vector<ll> Vll;
typedef vector<double> Vd;
typedef vector<Pi> VPi;
typedef vector<Pll> VPll;
typedef vector<Pd> VPd;
typedef tuple<int, int, int> iii;
typedef tuple<int,int,int,int> iiii;
typedef tuple<ll, ll, ll> LLL;
typedef vector<iii> Viii;
typedef vector<LLL> VLLL;
typedef complex<double> base;
const int MOD = 998244353;
ll POW(ll a, ll b, ll MMM = MOD) {ll ret=1; for(;b;b>>=1,a=(a*a)%MMM)if(b&1)ret=(ret*a)% MMM; return ret; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll a, ll b) { if (a == 0 || b == 0)return a + b; return a*(b / gcd(a, b)); }
int dx[] = { 0,1,0,-1,1,1,-1,-1 }, dy[] = { 1,0,-1,0,1,-1,1,-1 };
int ddx[]={2,2,-2,-2,1,1,-1,-1},ddy[]={1,-1,1,-1,2,-2,2,-2};

int parent[100001],edge[100001];
int find(int x){
	if(parent[x]<0)return x;
	return parent[x]=find(parent[x]);
}
void merge(int a,int b){
	a=find(a),b=find(b);
	if(a==b)return;
	parent[a]+=parent[b];
	parent[b]=a;
}
int c[100001];
Vi v[100001];
bool bfs(int N)
{
	queue<int> q;
	q.push(N);
	c[N]=0;
	while(!q.empty())
	{
		int x=q.front();
		q.pop();
		for(int next:v[x])
		{
			if(c[next]==-1)
			{
				c[next]=1-c[x];
				q.push(next);
			}
			else if(c[next]==c[x])return 1;
		}
	}
	return 0;
}
int main(){
	MEM_1(c);
	MEM_1(parent);
	int n,m;
	scanf("%d%d",&n,&m);
	fup(i,1,m,1)
	{
		int x,y;
		scanf("%d%d",&x,&y);
		merge(x,y);
		v[x].pb(y);
		v[y].pb(x);
	}
	ll c1=0,c2=0,r=0;
	fup(i,1,n,1)
		if(find(i)==i)
	{
		if(-parent[i]==1)r++;
		else if(bfs(i))c2++;
		else c1++;
	}
	printf("%lld",2*c1*c1+(c1+c2)*(c1+c2)-c1*c1+2*r*n-r*r);
}

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

const int INF = 300000000;
int N,A,B,C;
int l[10];

int MP(int i, int sumA, int sumB, int sumC, int na, int nb, int nc, int value){
  if(i == N){
    if(na == 0 || nb == 0 || nc == 0) return INF;
    return value + abs(A-sumA) + abs(B-sumB) + abs(C-sumC) - 30;
  }
  int a = sumA + l[i], b = sumB + l[i], c = sumC + l[i];
  int m1 = min(MP(i+1,a,sumB,sumC,na+1,nb,nc,value+10),MP(i+1,sumA,b,sumC,na,nb+1,nc,value+10));
  int m2 = min(MP(i+1,sumA,sumB,c,na,nb,nc+1,value+10),MP(i+1,sumA,sumB,sumC,na,nb,nc,value));
  return min(m1, m2);
}

int main(){
  cin >> N >> A >> B >> C;
  for(int i = 0; i < N; i++){
    cin >> l[i];
  }
  cout << MP(0,0,0,0,0,0,0,0) << endl;
  return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize "-O3"
#pragma GCC target ("avx")
#define _USE_MATH_DEFINES
#include<bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define vi vector<int>
#define vvi vector<vi>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int>>
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define MEMSET(a) memset(a,0,sizeof(a))
#define inf (1ll<<60)
#define SORT(v) sort(all(v))
#define RSORT(v) sort(all(v),greater<int>())
#define erase(i) erase(i,1)
#define SPEED ios::sync_with_stdio(false);cin.tie(0);cout<<fixed<<setprecision(12)
signed gcd(int a, int b){return b?gcd(b,a%b):a;}
signed lcm(int a, int b){return a*b/gcd(a,b);}
bool isDigit(char c){return '0'<=c&&c<='9';}
template<typename T> void remove(std::vector<T>& vector,unsigned int index){vector.erase(vector.begin()+index);}
//priority_queue<int, vi, greater<int> > que;//昇順

using namespace std;

const int mod=1e9+7;

signed main()
{
    SPEED;
    string s;
    cin >> s;
    if(s == "Sunny")cout << "Cloudy" << endl;
    else if(s == "Cloudy") cout << "Rainy" << endl;
    else cout << "Sunny" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <iomanip>
#include <stdlib.h>
using namespace std;
int main(){
    int a,b;
	char op;
	while(true){
		cin>>a>>op>>b;
		if(op=='?')
			break;
		if(op=='+')
			cout<<a+b<<endl;
		if(op=='-')
			cout<<a-b<<endl;
		if(op=='*')
			cout<<a*b<<endl;
		if(op=='/')
			cout<<a/b<<endl;
	}
	return 0;
}

Measured memory_bytes: 1160
#include <iostream>
#include <vector>
#include <bitset>
#include <cmath>
#include <map>
#include <algorithm>
#include <queue>
#include <chrono>
#include <array>
#include <random>
#include <fstream>
#include <list>
typedef int long long ll;

using int64 = long long;
using namespace std;

int W, H;
char mas[500][500];
int min_cost[500][500];

int main(){
    
    ll n,y;
    cin>>n>>y;
    
    
    for(int i=0;i<=n;i++){
        for(int j=0;j<=n;j++){
            ll k=n-i-j;
            
            if(k>=0&&10000*i+5000*j+1000*k==y){
                cout<<i<<" "<<j<<" "<<k<<endl;
                return 0;
            }
            
            
        }
    }
    
    cout<<-1<<" "<<-1<<" "<<-1<<endl;
    

    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#define rep(i,a,n) for(int i = (a);i < (n);i++)
typedef unsigned long long ull;
typedef long long ll;
using namespace std;

int main(){
  	ull n,cnt = 0,memo = 0;
  	cin >> n;
  	ull a[n],sum[n+1];
  	sum[0] = 0;
  
  	rep(i,0,n){
      cin >> a[i];
      sum[i+1] = sum[i]+a[i];
    }
  	

	sort(sum,sum+n+1);

	rep(i,1,n+1){
      memo++;
      if(sum[i] != sum[i-1]){
        if(memo > 1){
          cnt += (memo)*(memo-1)/2;
        }
        memo = 0;
      }
    }
  	memo++;
  	if(memo > 1){
      cnt += memo*(memo-1)/2;
    }
  
  	cout << cnt << endl;
  	return 0;
}

Measured memory_bytes: 3328