akhauriyash/Code-Regression huggingface dataset:
// ---------- BEG ../defs.hpp BEG ----------
#ifndef atcoder_defs_hpp
#define atcoder_defs_hpp
#include <cstdio>
#include <cstdint>
#include <cinttypes>
#include <cmath>
#include <string>
#include <vector>
#include <iostream>
#include <utility>
#include <algorithm>
#include <numeric>
#include <functional>
using namespace std;
using i8t = std::int64_t;
using u8t = std::uint64_t;
using vi8t = std::vector<i8t>;
using vvi8t = std::vector<std::vector<i8t>>;
using vu8t = std::vector<u8t>;
#include <limits>
static const i8t i8t_max=numeric_limits<i8t>::max();
static const i8t i8t_min=numeric_limits<i8t>::min();
#include <unordered_map>
#include <unordered_set>
template<typename Key,typename Value> using map_t=std::unordered_map<Key, Value>;
template<typename Key> using set_t=std::unordered_set<Key>;
#define F3(i,i0,iN,step) for(i8t i=i0,i##_N=iN;i<i##_N;i+=step)
#define F2(i,i0,iN) F3(i,i0,iN,1)
#define F(i,N) F3(i,0,N,1)
#define FR(i,N) for(i8t i=N;i--;)
#define R(V) i8t V;std::cin>>V;
#define RV(V,N) std::vector<i8t> V;F(_i,N){R(_x)V.push_back(_x);}
#define RL1(line) std::getline(std::cin,line);
#define RL(line) std::string line;RL1(line)
#define RM(V,L,C) std::vector<char> V;F(_i,L){RL(_l)F(_j,C)V.push_back(_l[_j]);}
#define P(X) std::cout<<(X)<<std::endl;
template<typename T> T umax(T& ans,T const& value) {if(value>ans)ans=value;return ans;}
template<typename T> T umin(T& ans,T const& value) {if(value<ans)ans=value;return ans;}
template<typename T> struct identity { using type = T; };
#endif
// ---------- END ../defs.hpp END ----------

constexpr i8t mod = 998244353; //素数

int main() {
  R(N)R(S)RV(A,N);

  i8t ans=0;
  vi8t g(S+1,0);
  FR(l,N){
    FR(s,S+1){
      if(s-A[l]<0)continue;
      g[s]+=g[s-A[l]];
      g[s]%=mod;
    }
    g[0]++;
    g[0]%=mod;
    if(A[l]<=S){
      g[A[l]]++;
      g[A[l]]%=mod;
    }
    ans+=g[S];
    ans%=mod;
  }
  P(ans);
  return 0;
}


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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

#define lf double
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

int main(void)
{
	cin.tie(0);
	ios::sync_with_stdio(false);
    int n, m; cin>>n>>m;
    vector<vi> adj(n+1);
    rep(i, m){
        int a, b; cin>>a>>b;
        adj[a].pb(b);
    }

    vi ans;
    rep(i, n){
        queue<pi> que;
        que.emplace(i+1, 0);
        vi prev(n+1, 0);
        bool loop = false;
        while(que.size() && loop==false){
            int node, cost;
            tie(node, cost) = que.front(); que.pop();
            if (cost > n) break;
            for(auto e:adj[node]){
                if (prev[e] == 0){
                    prev[e] = node;
                    if (e == i+1){
                        loop = true;
                        break;
                    }
                    que.emplace(e, cost+1);
                }
            }
        }
        if (loop){
            vi temp;
            for(int j=prev[i+1]; j!=i+1; j=prev[j]){
                temp.pb(j);
            }
            temp.pb(i+1);
            if (ans.size() > temp.size() || ans.empty()) ans = temp;
        }
    }
    if (ans.size()){
        cout << ans.size() << "\n";
        for(auto e:ans){
            cout << e << "\n";
        }
    }else{
        cout << "-1\n";
    }
	return 0;
}

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

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

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

    int sum=0;
    for(int a=1;a<=K;a++){
        for(int b=1;b<=K;b++){
            for(int c=1;c<=K;c++){
                sum += GCD(GCD(a,b),c);
            }
        }
    }

    cout << sum <<endl;
    return 0;
}

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

int main() {
  int H, W;
  cin >> H >> W;
  vector<vector<char>> a(H, vector<char>(W));
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      cin >> a.at(i).at(j);
    }
  }

  vector<bool> isOutH(H), isOutW(W);
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      if (a.at(i).at(j) == '#') {
        isOutH.at(i) = true;
        break;
      }
    }
  }
  for (int j = 0; j < W; j++) {
    for (int i = 0; i < H; i++) {
      if (a.at(i).at(j) == '#') {
        isOutW.at(j) = true;
        break;
      }
    }
  }
  for (int i = 0; i < H; i++) {
    if (!isOutH.at(i)) {
      continue;
    }
    for (int j = 0; j < W; j++) {
      if (!isOutW.at(j)) {
        continue;
      }
      cout << a.at(i).at(j);
    }
    cout << endl;
  }
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>

struct node {
    int key;
    struct node *parent;
    struct node *left;
    struct node *right;
};
typedef struct node *NodePointer;

NodePointer root = NULL;

void initNode(NodePointer nd, NodePointer parent, int key) {
    nd->parent = parent;
    nd->key = key;
    nd->left = NULL;
    nd->right = NULL;
}

// キーを元に探し、含まれるノードを返します
// 無い場合は最後のノードを返します
// @param int key
// @return pointer
NodePointer search(int key) {
    NodePointer target = root;
    NodePointer result = NULL;

    while (target != NULL) {
        result = target;

        if (key < target->key) {
            target = target->left;
        } else if (key == target->key) {
            break;
        } else {
            target = target->right;
        }
    }
    return result;
}

NodePointer find(int key) {
    NodePointer result = search(key);
    return (result->key == key) ? result : NULL;
}

void insert(int key) {
    NodePointer nd = (NodePointer)malloc(sizeof(struct node));
    NodePointer parent = NULL;

    parent = search(key);
    initNode(nd, parent, key);

    if (root == NULL) {
        root = nd;
    }
    else if (key < parent->key) {
        parent->left = nd;
    }
    else {
        parent->right = nd;
    }

}

void inorder(NodePointer n){
    if(n == NULL){
        return;
    } else {
        inorder(n->left);
        printf(" %d", n->key);
        inorder(n->right);
    }
}

void preorder(NodePointer n) {
    if(n == NULL){
        return;
    } else {
        printf(" %d", n->key);
        preorder(n->left);
        preorder(n->right);
    }
}

int main() {
    int n, input, i;
    char command[10];

    scanf("%d", &n);

    for (i = 0; i < n; i++) {
        scanf("%9s", command);

        switch (command[0]) {
            case 'i':
                scanf("%d", &input);
                insert(input);
                break;
            case 'f':
                scanf("%d", &input);
                printf("%s\n", (find(input) == NULL) ? "no" : "yes");
                break;
            case 'p':
                inorder(root);
                printf("\n");
                preorder(root);
                printf("\n");
                break;
        }
    }
}


Measured memory_bytes: 20444
#include <iostream>
#include <stdio.h>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>
#include <set>
#include <math.h>
#include <utility>
#include <stack>
using namespace std;
typedef pair<int,int> P;
const int INF = (int)((unsigned int)-1>>1);

int main(){
    int taikaku[151][151];
    for(int i=1;i<=150;i++){
        for(int j=i+1;j<=150;j++){
            //jが横, iが縦
            taikaku[i][j] = i*i + j*j;
        }
    }

    while(1){
        int h,w;
        cin >> h >> w;
        if (h==0 && w==0) break;
        int input_taikaku = h*h + w*w;

        int ans_taikaku = 150*150;
        int ansh=150, answ=150;
        for(int i=1;i<150;i++){
            for(int j=i+1;j<150;j++){
                //jが横, iが縦
                if (input_taikaku < taikaku[i][j]){
                    if (ans_taikaku == taikaku[i][j]){
                        if (ansh > i){
                            ansh = i; answ = j;
                        }
                    }else if(ans_taikaku > taikaku[i][j]){
                        ans_taikaku = taikaku[i][j];
                        ansh = i; answ = j;
                    }
                }else if(input_taikaku == taikaku[i][j] && h < i){
                    if (ans_taikaku == taikaku[i][j]){
                        if (ansh > i){
                            ansh = i; answ = j;
                        }
                    }else if(ans_taikaku > taikaku[i][j]){
                        ans_taikaku = taikaku[i][j];
                        ansh = i; answ = j;
                    }
                }
            }
        }
        cout << ansh << " " << answ << endl;
    }
}

Measured memory_bytes: 1244
#include<cstdio>
#include<iostream>
using namespace std;
int a,b,c,p,ans,t;
void dfs(int x,int y,int z,int dep)
{
	if (dep==ans)
	{
		if (x==y&&y==z) p=1;
		return;
	}
	dfs(x+1,y+1,z,dep+1);if (p) return;
	dfs(x+1,y,z+1,dep+1);if (p) return;
	dfs(x,y+1,z+1,dep+1);if (p) return;
	dfs(x+2,y,z,dep+1);if (p) return;
	dfs(x,y+2,z,dep+1);if (p) return;
	dfs(x,y,z+2,dep+1);if (p) return;
}
int main()
{
	scanf("%d%d%d",&a,&b,&c);
	while (a+2<b||a+2<c) t++,a+=2;
	while (b+2<a||b+2<c) t++,b+=2;
	while (c+2<a||c+2<b) t++,c+=2;
	ans=0;
	for (;;ans++) {dfs(a,b,c,0);if (p) {printf("%d",ans+t);break;}}
} 

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

#define ll long long int
#define INFTY (1<<21)

using namespace std;

void printVector(vector<int> A, int N){
    for(int i = 0; i < N-1; i++)
        cout<<A[i]<<" ";
    cout<<A[N-1]<<endl;
}

void swap(int& a, int& b){
    int tmp = b;
    b = a;
    a = tmp;
}

void selectionSort(vector<int>& A, int N){
    int c = 0;
    for(int i = 0; i < N-1; i++){
        int minNumIdx = i;
        for(int j = i+1; j < N; j++)
            if(A[j]<A[minNumIdx])
                minNumIdx = j;
        if(i != minNumIdx){
            swap(A[i], A[minNumIdx]);
            c++;
        }
    }
    printVector(A, N);
    cout<<c<<endl;
}

int main(void){
    cin.sync_with_stdio(false);
    int N; cin>>N;
    vector<int> nums;
    for(int i = 0; i < N; i++){
        int tmp; cin>>tmp;
        nums.push_back(tmp);
    }

    selectionSort(nums, N);

    return 0;
}


Measured memory_bytes: 3236
using System;
using System.Collections.Generic;
using System.Linq;
using static Input;

public class Prog
{
    private const int INF = 1000000007;
    private const long INFINITY = 9223372036854775807;
    private struct Pair { public int x, y; }
    public static void Main()
    {
        int N = NextInt();
        int K = NextInt();
        int[] x = LineInt();
        bool[] dp = new bool[K + 1];
        for (int i = 0; i <= K; i++) dp[i] = false;
        for (int j = 1; j <= K; j++)
            for (int i = 0; i < N; i++)
                if (j >= x[i] && !dp[j - x[i]]) dp[j] = true;
        Console.WriteLine((dp[K] ? "First" : "Second"));
    }
}

public class Input
{
    private static Queue<string> q = new Queue<string>();
    private static void Confirm() { if (q.Count == 0) foreach (var s in Console.ReadLine().Split(' ')) q.Enqueue(s); }
    public static int NextInt() { Confirm(); return int.Parse(q.Dequeue()); }
    public static long NextLong() { Confirm(); return long.Parse(q.Dequeue()); }
    public static char NextChar() { Confirm(); return char.Parse(q.Dequeue()); }
    public static string NextString() { Confirm(); return q.Dequeue(); }
    public static double NextDouble() { Confirm(); return double.Parse(q.Dequeue()); }
    public static int[] LineInt() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); }
    public static long[] LineLong() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
    public static string[] LineString() { return Console.ReadLine().Split(' ').ToArray(); }
    public static double[] LineDouble() { return Console.ReadLine().Split(' ').Select(double.Parse).ToArray(); }
}


Measured memory_bytes: 13416
import java.util.*;
import java.math.BigDecimal;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int n = sc.nextInt();
        String a = sc.next();
        char[] bun = a.toCharArray();
        for(int i = 0; i < bun.length;i++){
          if((int)bun[i] + n > 90){
            bun[i] = (char)(((int)bun[i] + n - 90) + 64);
          }else{
            bun[i] = (char)((int)bun[i] + n);
          }
          
        }
        
      
        for(int i = 0; i < bun.length;i++){
          System.out.print(bun[i]);
        }
        System.out.println();
    }
}

Measured memory_bytes: 39072
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#include <queue>
#include <deque>
#include <map>
#include <stack>
#include<bitset>
#include<list>
#include<cassert>
#include<numeric>


using namespace std;

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

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mp make_pair
#define deb(x) cout<< #x << " " << x << "\n";
#define MAX 9223372036854775807
#define MIN -9223372036854775807
#define PI 3.141592653589
#define setbits(n) __builtin_popcountll(n)
const ll mod=1e9+7;

const int N=1e5+1;
ll dp[N][3],n;
vector<ll> a(N),b(N),c(N);

ll go(ll pos, ll prev){
    if(pos==n) return 0;
    if(dp[pos][prev]!=-1)
        return dp[pos][prev];
    ll ans=0;
    if(prev!=0) ans=max(ans,a[pos]+go(pos+1,0));
    if(prev!=1) ans=max(ans,b[pos]+go(pos+1,1));
    if(prev!=2) ans=max(ans,c[pos]+go(pos+1,2));
    return dp[pos][prev]=ans;
}

int main() {
    
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll T=clock();
    
    cin>>n;
    for(ll i=0;i<n;i++)
        cin>>a[i]>>b[i]>>c[i];
    memset(dp,-1,sizeof(dp));
    cout<<go(0,3);


    cerr<<"\n\nTIME: "<<(double)(clock()-T)/CLOCKS_PER_SEC<<" sec\n";
    T = clock();
    return 0;
}

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

typedef long long   signed int LL;
typedef long long unsigned int LU;

#define incID(i, l, r) for(int i = (l)    ; i <  (r); i++)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); i++)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); i--)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); i--)
#define  inc(i, n) incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define  dec(i, n) decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)

#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))

#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define UB upper_bound
#define LB lower_bound
#define PQ priority_queue

#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
#define  FOR(it, v) for(auto it =  v.begin(); it !=  v.end(); ++it)
#define RFOR(it, v) for(auto it = v.rbegin(); it != v.rend(); ++it)

template<typename T> bool   setmin(T & a, T b) { if(b <  a) { a = b; return true; } else { return false; } }
template<typename T> bool   setmax(T & a, T b) { if(b >  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } }
template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }

// ---- ----

// G13E_6.cpp

template<int N> void mat_prod(LL a[N][N], LL b[N][N], LL c[N][N], LL MOD) { // a = b * c;
	LL d[N][N];
	inc(i, N) {
	inc(j, N) {
		d[i][j] = 0;
		inc(k, N) {
			d[i][j] += b[i][k] * c[k][j];
		}
		d[i][j] %= MOD;
	}
	}
	
	inc(i, N) {
	inc(j, N) {
		a[i][j] = d[i][j];
	}
	}
}

template<int N> void mat_exp(LL a[N][N], LL b[N][N], LL c, LL MOD) { // a = b ^ c;
	LL cc = c, d = 0;
	while(cc) { cc >>= 1; d++; }
	
	LL t[60][N][N];
	inc(i, N) {
	inc(j, N) {
		t[0][i][j] = b[i][j];
	}
	}
	inc(i, d - 1) {
		mat_prod<N>(t[i + 1], t[i], t[i], MOD);
	}
	
	inc(i, N) {
	inc(j, N) {
		a[i][j] = 0;
	}
	}
	inc(i, N) { a[i][i] = 1; }
	inc(i, d) {
		if((c >> i) % 2 == 1) {
			mat_prod<N>(a, a, t[i], MOD);
		}
	}
}

// ----

LL n, m, x[100002];
const LL MOD = 1000000007;

int main() {
	cin >> n >> m;
	inc1(i, m) { cin >> x[i]; }
	x[0] = 0;
	x[m + 1] = n + 1;
	
	LL a[3][3] = { { 2, 1, 1 }, { 2, 1, 0 }, { 1, 1, 1 } };
	LL b[3][3] = { { 1, 0, 0 }, { 2, 1, 0 }, { 1, 1, 1 } };
	LL c[3][3] = { { 1, 0, 0 }, { 0, 1, 0 }, { 0, 0, 1 } };
	LL d[3][3];
	
	inc(i, m + 1) {
		if(i != 0) { mat_prod<3>(c, b, c, MOD); }
		mat_exp<3>(d, a, x[i + 1] - x[i] - 1, MOD);
		mat_prod<3>(c, d, c, MOD);
	}
	
	cout << c[2][0] << endl;
	
	return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define err(args...) {}
#ifdef DEBUG
#include "_debug.cpp"
#endif
using namespace std;
using ll = long long;
template <typename T> using lim = numeric_limits<T>;
template <bool Directed, typename TEdge> struct graph {
    using EType = TEdge;
    vector<TEdge> edges;
    vector<vector<int>> adj;
    graph(int n) : adj(n + 1) {}
    graph(int n, int m) : graph(n) { edges.reserve(m); }
    TEdge& operator()(int i) { return edges[i]; }
    vector<int>& operator[](int u) { return adj[u]; }
    int size() { return adj.size() - 1; }
    void add_edge(const TEdge& e) {
        adj[e.u].push_back(edges.size());
        edges.push_back(e);
        if(not Directed) {
            adj[e.v].push_back(edges.size());
            edges.push_back(e.reverse());
        }
    }
};
template <typename graph> int dfs(graph& g,
const function<void(int)>& pre_node = [](int) {},
const function<void(typename graph::EType&)>& pre_edge = [](typename graph::EType&) {},
const function<void(typename graph::EType&)>& pos_edge = [](typename graph::EType&) {},
const function<void(int)>& pos_node = [](int) {},
int root = 0) {
    vector<bool> vis(g.size() + 1);
    function<void(int)> dfs = [&](int u) {
        vis[u] = true;
        pre_node(u);
        for(int i : g[u]) if(not vis[g(i).v]) {
            pre_edge(g(i)), dfs(g(i).v), pos_edge(g(i));
        }
        pos_node(u);
    };
    if(root) {
        dfs(root);
        return 0;
    } else {
        int comp = 0;
        for(int u = 1; u <= g.size(); u++) if(not vis[u]) {
            comp++;
            dfs(u);
        }
        return comp;
    }
}
struct edge {
    int u, v;
    edge reverse() const { return {v, u}; }
};
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n, m;
    cin >> n >> m;
    graph<0, edge> g(n);
    for(int i = 1; i <= m; i++) {
        int x, y, z;
        cin >> x >> y >> z;
        g.add_edge({x, y});
    }
    cout << dfs(g) << endl;
    return 0;
}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;

static const double EPS = 1e-8;
static const double PI = 4.0 * atan(1.0);
static const ll INF = 1023456789;

#define REP(i,n)	for(int i=0;i<n;++i)
#define REPR(i,n)	for(int i=n-1;i>=0;--i)
#define FOR(i,s,n)	for(int i=s;i<n;++i)
#define FORR(i,s,n)	for(int i=n-1;i>=s;--i)
#define ALL(c)		(c).begin(),(c).end()
#define CLEAR(v)	memset(v,0,sizeof(v))
#define MP(a,b)		make_pair((a),(b))
#define ABS(a)		((a)>0?(a):-(a))
#define F			first
#define S			second

ll d, g, p[10], c[10], s[10];

int main(int argc, char **argv) {
	cin >> d >> g;
	REP(i, d) cin >> p[i] >> c[i];
	REP(i, d) s[i] = (d-i)*100;
	reverse(p, p+d);
	reverse(c, c+d);
	ll res = INF;
	REP(i, 1<<d) {
		ll v = 0, cnt = 0;
		REP(j, d) if (i & (1<<j)) {
			v += s[j]*p[j] + c[j];
			cnt += p[j];
		}
		if (v < g) REP(j, d) if ((i & (1<<j)) == 0) {
			ll t = min(p[j], (g-v+s[j]-1)/s[j]);
			cnt += t;
			v += s[j]*t;
			break;
		}
		if (v >= g) res = min(res, cnt);
	}
	cout << res << endl;
	return 0;
}


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



int main() 
{
  ll N,K; cin>>N>>K;
  if(K==2) {cout<<N-1<<endl; return 0;}
  ll ans=N/(K-1);
  if(N%(K-1)>1) {ans++;}
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <stdio.h>
using namespace std;
#define ms(s, n) memset(s, n, sizeof(s))
#define rp(i,l,m) for(int i=l; i<m; ++i)
#define Rp(i,l,m) for(int i=l; i<=m; i++)
#define rpD(i,l,m) for(int i=m; i>l; i--)
#define RpD(i,m,l) for(int i=m; i>=l; i--)
#define all(a) (a).begin(), (a).end()
#define fi first
#define se second
#define pb push_back
#define pf push_front
#define sz(a) int((a).size())
#define is insert
#define mp make_pair
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
const int MOD = (int) 1e9 + 7;
const ld PI = acos((ld) -1);
inline ll gcd(ll a, ll b) {ll r; while (b) {r=a%b;a=b;b=r;} return a;}
inline ll lcm(ll a, ll b) {return a / gcd(a, b) * b;}
inline ll fpow(ll n, ll k, int p=MOD){ll r=1; for(;k;k>>=1){if(k&1)r=r*n%p;n=n*n%p;}return r;}
inline ll Pow(int n, int k){int r=1; for(;k;k>>=1){if(k&1)r=r*n;n=n*n;}return r;}
#define N 5005

int ans, r, b, n, g, s1, s2, s3;

inline void input(){
    cin >> r >> g >> b >> n;
}

inline void solve(){
    for(int i=0; i<=n/r; i++){
        s1=r*i;
        if(s1==n) {ans++; break;}
        if(s1>n) break;
        int s2;
        for(int j=0; j<=(n-s1)/g; j++){
            s2=s1+j*g;
            if(s2==n) {ans++; break;}
            if(s2>n) break;
            if ((n-s2)%b==0) ans++;
        }
    }
    cout << ans;
}
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    input();
    solve();
  return 0;
}












Measured memory_bytes: 256
//Achen
#include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdlib>
#include<vector>
#include<cstdio>
#include<queue>
#include<cmath>
#include<set>
#include<map>
#define For(i,a,b) for(int i=(a);i<=(b);i++)
#define Rep(i,a,b) for(int i=(a);i>=(b);i--)
const int N=2e5+7;
typedef long long LL; 
typedef double db;
using namespace std;
LL n,q;
LL a[N],cnt[N],ans[N];

template<typename T> void read(T &x) {
    char ch=getchar(); x=0; T f=1;
    while(ch!='-'&&(ch<'0'||ch>'9')) ch=getchar();
    if(ch=='-') f=-1,ch=getchar();
    for(;ch>='0'&&ch<='9';ch=getchar()) x=x*10+ch-'0'; x*=f;
}

LL sg[N<<2];
#define lc x<<1
#define rc ((x<<1)|1)
#define mid ((l+r)>>1)
void build(int x,int l,int r) {
	if(l==r) { sg[x]=a[l]; return ; }
	build(lc,l,mid); build(rc,mid+1,r);
	sg[x]=min(sg[lc],sg[rc]);
}

LL qry(int x,int l,int r,int ql,int qr,LL v) {
	if(ql>qr) return 0;
	if(l>=ql&&r<=qr) {
		if(sg[x]>v) return 0;
		if(l==r) return l;
		if(sg[rc]<=v) return qry(rc,mid+1,r,ql,qr,v);
		if(sg[lc]<=v) return qry(lc,l,mid,ql,qr,v); 
	}
	if(qr<=mid) return qry(lc,l,mid,ql,qr,v);
	LL rs=qry(rc,mid+1,r,ql,qr,v);
	if(rs) return rs; else return qry(lc,l,mid,ql,qr,v);	
}

LL cf[N];
void solve(int x,LL l,LL c) {
	if(!x||!l) {
		if(!x) cf[l]+=c;
		return ;
	}
	int y=qry(1,1,q,1,x-1,l);
	cnt[y]+=l/a[y]*c;
	solve(y,l%a[y],c);
}

//#define DEBUG
int main() {
#ifdef DEBUG
	freopen("1.in","r",stdin);
	//freopen(".out","w",stdout);
#endif
	read(n); read(q); a[0]=n;
	if(q==0) {
		For(i,1,n) puts("1");
		return 0;
	}
	For(i,1,q) read(a[i]);
	build(1,1,q); cnt[q]=1;
	Rep(i,q,1) if(cnt[i]) 
		solve(i,a[i],cnt[i]);
	ans[n+1]=cnt[0];
	Rep(i,n,1) ans[i]=ans[i+1]+cf[i];
	For(i,1,n) printf("%lld\n",ans[i]);
    return 0;
}

Measured memory_bytes: 11136
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
	    while(sc.hasNext()){
	    	double a[] = new double[6];
	        for(int i=0;i<6;i++)a[i]=sc.nextDouble();
	        double d = a[0]*a[4]-a[1]*a[3];
	        double x = (a[4]*a[2]-a[1]*a[5])/d;
	        double y = (a[0]*a[5]-a[2]*a[3])/d;
	        if(x==0)x=0;
	        if(y==0)y=0;
	        System.out.printf("%.3f %.3f\n", x, y);
	    }
	}
}

Measured memory_bytes: 12000
// Copyright 2020 yaito3014
#include <bits/stdc++.h>

int main() {
  using namespace std;
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int N, M, K;
  cin >> N >> M >> K;
  vector<long long> A(N + 1, 0), B(M + 1, 0);
  copy_n(istream_iterator<int>(cin), N, next(begin(A)));
  copy_n(istream_iterator<int>(cin), M, next(begin(B)));
  partial_sum(cbegin(A), cend(A), begin(A));
  partial_sum(cbegin(B), cend(B), begin(B));
  iterator_traits<decltype(B)::const_iterator>::difference_type ans = 0;
  auto last = upper_bound(cbegin(A), cend(A), K);
  for (auto iterA = cbegin(A); iterA != last; ++iterA) {
    auto iterB = upper_bound(cbegin(B), cend(B), K - *iterA);
    ans = max(ans, distance(cbegin(A), iterA) + distance(cbegin(B), iterB) - 1);
  }
  cout << ans << '\n';
}


Measured memory_bytes: 6336
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
typedef long long ll;
typedef unsigned int uint;
using namespace std;

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

    int n, k;
    cin >> n >> k;
    ll x[n], y[n], x2[n], y2[n];
    for (int i = 0; i < n; i++) {
        cin >> x[i] >> y[i];
        x2[i] = x[i], y2[i] = y[i];
    }

    sort(x2, x2+n);
    sort(y2, y2+n);

    ll ans = 2000000000LL * 2000000000LL;
    for (int xi = 0; xi < n; xi++) {
        for (int xj = xi+1; xj < n; xj++) {
            for (int yi = 0; yi < n; yi++) {
                for (int yj = yi + 1; yj < n; yj++) {
                    int count = 0;
                    ll xl = x2[xi];
                    ll xr = x2[xj];
                    ll yd = y2[yi];
                    ll yu = y2[yj];

                    for (int i = 0; i < n; i++) {
                        if (x[i]>=xl && x[i]<=xr && y[i]>=yd && y[i]<=yu) {
                            count++;
                        }
                    }

                    if (count >= k) {
                        ans = min(ans, (xr-xl)*(yu-yd));
                    }
                }
            }
        }
    }

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

Measured memory_bytes: 256
import sys
stdin = sys.stdin
 
sys.setrecursionlimit(10**5) 
 
def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

n = ni()
ans = 111
for i in range(10):
    if i*111 < n <= (i+1)*111:
        ans = (i+1)*111
        break
        
print(ans)

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

main()
{
  int a,b;
  int ans;
  cin >> a >> b;
  if((a+b)%2!=0)
    ans=(a+b)/2+1;
  else
    ans=(a+b)/2;
  
  printf("%d",ans);

  return (0);
}

Measured memory_bytes: 256
//#include <tourist>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <string>
#include <iomanip>
#include <limits>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <list>
#include <queue>
#include <tuple>
#include <deque>
#include <algorithm>
#include <numeric>
#include <iomanip>
#include <utility>
#include <complex>
#include <functional>
using namespace std;
const int MOD = 1000000007;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = (1 << 28);
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
//setprecision(15)有効数字15桁
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b)
{
    return a * b / gcd(a, b);
}
struct edge {
    int to, cost;
};
int n;
vector<ll> a;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n;
    ll len=0;
    for (int i = 0; i < n; i++)
    {
        ll tempa;
        cin >> tempa;
        a.push_back(tempa);
        len+=tempa;
    }
    ll l=0;
    for(int i=0;i<n;i++){
        if((l+a[i])*2<len){
        l+=a[i];
        }
        else if((l+a[i])*2==len){
            cout<<0<<"\n";
            return 0;
        }
        else{
            ll ans=0;
            cout<<min(2*(l+a[i])-len,len-2*l)<<"\n";
            return 0;
        }
    }
}



Measured memory_bytes: 2420
#include<iostream>
#include<math.h>
using namespace std;
typedef long long ll;
typedef long double ld;


ll gcd1(ll a, ll b){
  if (a == 0) {
    return b; 
  }   
  return gcd1(b % a, a); 
}

ll gcd2(ll c, ll d){
  if (c == 0) {
    return d; 
  }   
  return gcd2(d % c, c); 
}

int main(){
  ll n;
  cin >> n;
  ll ans=0;
  for (int i = 1; i <= n; i++)
  {
    for (int x = 1; x <= n; x++)
    {
      for (int y = 1; y <= n; y++)
      {
        ans+=gcd2(gcd1(i,x),y);
      }
    }
  }
  cout << ans;

}

Measured memory_bytes: 3192
#include <bits/stdc++.h>
#include <stdio.h>
#include <stdlib.h>
#include <cstdlib> 
#include <string>

using namespace std;

int main() {
	string s;
	cin >>s;
	int w;
	cin >>w;
	for (int i = 0; i < s.length(); i+=w)
	{
		cout << s.at(i);

	}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define mem(a,x) memset((a),x,sizeof (a))
#define lson l,mid,rt<<1
#define rson mid+1,r,rt<<1|1
const LL LLINF = 0x3f3f3f3f3f3f3f3f;
int main() {
#ifdef _DEBUG
    freopen("data.in", "r", stdin);
#endif
    ios::sync_with_stdio(false);
    int a,b;
    while(cin>>a>>b){
        int s=a+b-1;
        cout<<a*b-s<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin>>N;
  vector<int> a(N);
  for(x:a) cin>>x;
  int cun;
  a.push_back(1000);
  sort(a.begin(),a.end());
  
  for(int i=0;i<N;i++){
    if(a[i]==a[i+1]){
      cun++;
    }
  }
  cout<<N-cun<<endl;
}


Measured memory_bytes: 256
t1, t2 = map(int, input().split())
a1, a2 = map(int, input().split())
b1, b2 = map(int, input().split())

if t1*a1+t2*a2 == t1*b1+t2*b2:
	print("infinity")
elif (a1-b1) * (t1*(a1-b1) + t2*(a2-b2)) > 0:
	print(0)
else:
	if a1 > b1:
		x = (a1-b1)*t1
		y = (b2-a2)*t2 - x
	else:
		x = (b1-a1)*t1
		y = (a2-b2)*t2 - x

	ans = 1 + (x//y)*2
	if x%y == 0:
		ans -= 1

	print(ans)


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

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

    for(int i=0; i<=N; i++){
        
        int count = 0;
        
        int t = i;
        while(t > 0){
            count += t % 6;
            t /= 6;
        }
        t = N-i;
        while(t > 0){
            count += t % 9;
            t /= 9;
        }
        if(min > count) min = count;
    }
    
    cout << min << endl;
    
}


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

int main(){
  int N ; 
  cin >> N ;
  vector<int> A(N+2); 
 
  long long S = 0 ; 
  A.at(0) = 0 ; 
  A.at(N+1) = 0 ; 
  for(int i = 1 ; i < N+1 ; i++){
    cin >> A.at(i) ;
  }
  


  for(int i = 1 ; i < N+2 ; i++){
    S += abs(A.at(i)-A.at(i-1)) ; 
  }
  
  for(int i =1 ; i < N+1 ; i++){
    cout << S + abs(A.at(i+1)-A.at(i-1))-abs(A.at(i-1)-A.at(i))-abs(A.at(i)-A.at(i+1)) <<endl ; 
  }
}

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

int main(){
    int H, N;
    cin >> H >> N;
    vector<int> A(N); 
    rep(i,N) cin >> A.at(i);
    int damage = 0;

    rep(i, N) damage += A.at(i);

    if (H <= damage)
    {
         cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
    return 0;

}

Measured memory_bytes: 640
# -*- coding: utf-8 -*-
# problem B
from collections import defaultdict

letters = str(input())

# defultdict(int)は登録されていないキーが呼び出された時に、自動的に{キー: 0}を登録してくれる
d = defaultdict(int) #int() = 0
for letter in letters:
    d[letter] += 1
    
k = 0
for values in d.values():
    if values % 2 == 0:
        k += 0
    else:
        k +=1

if k == 0:
    print('Yes')
else:
    print('No')
    

Measured memory_bytes: 3316
#include<iostream>
using namespace std;
int main()
{
    int a,b,c,d=0,e=0;
    cin>>a>>b>>c;
    if(a==5) d++;
    else if(a==7) e++;
    if(b==5) d++;
    else if(b==7) e++;
    if(c==5) d++;
    else if(c==7) e++;
    if(d==2 && e==1) cout<<"YES\n";
    else cout<<"NO\n";
}


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

using namespace std;



int main(int argc, char *argv[])
{
    

    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n;
    cin >> n;
    
    string s;
    cin >> s;
    
    int i = 0, cnt = 0;
    
    while (i < n - 2) {
        if (s.substr(i, 3) == "ABC") {
            cnt++;
            i += 3;
            continue;
        }
        i++;
    }
    
    cout << cnt << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
inline ll read() {
    ll x=0,f=1; char ch=getchar();
    for(;ch<'0'||ch>'9';ch=getchar())
        if(ch=='-')f=-f;
    for(;ch>='0'&&ch<='9';ch=getchar())
        x=x*10+ch-'0';
    return x*f;
}
inline void chkmin( int &a,int b ) { if(a>b) a=b; }
inline void chkmax( int &a,int b ) { if(a<b) a=b; }
#define _ read()
int n, a[105],b[105],pos[105],s[105],w[105],res;
inline void dfs( int dep ) {
	if ( dep>n ) {
		memset(s,0,sizeof(s));
		memset(w,0,sizeof(w)); 
		for ( int i = 1; i <= n; i++ ) {
			s[pos[i]] += b[i];
			++w[pos[i]];
		}
		if(s[1]&&s[2]&&s[3]); else return;
		for ( int i=1;i<=3; i++ ) {
			w[i]=10*(w[i]-1);
			w[i]+=abs(a[i] - s[i]);
		}
		chkmin(res,w[1]+w[2]+w[3]);
		return ;
	}
	for ( int i=0; i<=3; i++ ) pos[dep] = i, dfs( dep + 1 );
}
int main() {
	n=_; res=2e9;
	for ( int i=1;i<=3;i++ ) a[i]=_;
	for ( int i=1;i<=n;i++ ) b[i]=_;
	dfs(1);
	cout<<res<<"\n";
	return 0;
}


Measured memory_bytes: 256
S=input()
T=input()
l=len(S)
Rs=[0]*26
Rt=[0]*26
for i in range(l):
    Rs[ord(S[i])-ord('a')]+=1
    Rt[ord(T[i])-ord('a')]+=1
Rs.sort()
Rt.sort()
if Rs==Rt:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3760
import java.util.Scanner;

public class Main {

public static void main(String[] args) {

// 標準入力からデータを読み込む準備

Scanner sc = new Scanner(System.in);

// 最初の文字の固まりを整数値と想定して読み込む

int x = sc.nextInt();

int answer = x *x * x/* ここを変えて3乗しよう! */;

System.out.println(answer); 

}

}

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

int main() {
  ll n, ans = 0;
  cin >> n;
  vector<ll> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  map<ll, ll> p, q;

  for (int i = 0; i < n; i++) {
    p[i + a[i]]++;
    q[i - a[i]]++;
  }

  for (int i = 0; i < n; i++) {
    ans += p[i] * q[i];
  }

  cout << ans << endl;
}

Measured memory_bytes: 47400
#include "bits/stdc++.h"
using namespace std;

#define ll long long int
#define str string
#define ALL(a)  (a).begin(),(a).end()
#define P pair<ll,ll>

using Graph = vector<vector<int>>;

const int dy[] = { 0, 0, 1, -1 }, dx[] = { 1, -1, 0, 0 };
ll INFL = 1ll << 60, INF = 1 << 30, mod = 1e9 + 7, Min = INFL, Max = -1;
ll a, b, c ,n, sum, A[500010], B[500000],rui[500000],  dp[5000];
str S,T,U;bool check = true;	vector<ll> v;



int main() {
	//Code Line
cin >>S  >> T;
cin >> a >>  b;
cin >> U;

if(U == S)a --;
else b--;

cout << a <<" " << b << endl;


	return 0;
}


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

/* メモリ食い過ぎ注意 */
#define int long long

typedef long long ll;

ll gcd(ll a, ll b)
{
    if (a < b)
        gcd(b, a);
    if (b == 0)
        return a;
    int r;
    while ((r = a % b))
    {
        a = b;
        b = r;
    }
    return b;
}

/* define const */
const ll INF = (1ll << 60);
const ll MOD = (ll)1e9 + 7;
/* end defineing */

signed main()
{
    int r, g, b;
    cin >> r >> g >> b;

    int tmp = 0;
    tmp += (r * 100);
    tmp += (g * 10);
    tmp += (b);

    if (tmp % 4 == 0)
        cout << "YES" << endl;
    else
    {
        cout << "NO" << endl;
    }
}


Measured memory_bytes: 256
def maxHeapify(A, i):
  id = i + 1
  l = id * 2
  r = id * 2 + 1
  if l <= len(A) and A[l-1] > A[i]:
    largest = l - 1
  else:
    largest = i
  if r <= len(A) and A[r-1] > A[largest]:
    largest = r - 1

  if largest != i:
    v = A[i]
    A[i] = A[largest]
    A[largest] = v
    maxHeapify(A, largest)

def buildMaxHeap(A):
  H = len(A)
  for i in range(H//2):
    maxHeapify(A, H//2-1-i)

H = int(input())

A = list(map(int, input().split()))

buildMaxHeap(A)

print(" " + " ".join(list(map(str, A))))


Measured memory_bytes: 63700
// Contest: AtCoder Beginner Contest 157 (https://atcoder.jp/contests/abc157)
// Problem: B: Bingo (https://atcoder.jp/contests/abc157/tasks/abc157_b)


// region {{{ boilerplate
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <chrono>
#include <cstdint>
#include <deque>
#include <exception>
#include <forward_list>
#include <functional>
#include <initializer_list>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <limits>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#if __cplusplus >= 201703L
#   include <optional>
#   include <string_view>
#   include <variant>
#endif

using namespace std;

#if __cplusplus >= 201703L
#   define all(a)      begin(a),end(a)
#   define sz(x)       ((int)size(x))
#else
#   define all(a)      (a).begin(),(a).end()
#   define sz(x)       ((int)(x).size())
#endif

#define rep(a, b)      for(int a = 0; a < (b); ++a)
#define reps(a, b, c)  for(int a = (b); a < (c); ++a)
#define trav(a, b)     for(auto& a : b)

using ll = long long;
using ld = long double;
using u64 = uint64_t;
using u32 = uint32_t;

using pi = pair<int, int>;
using pl = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vpi = vector<pi>;

#if __cplusplus >= 201703L
#   define MAYBE_UNUSED [[maybe_unused]]
#else
#   define MAYBE_UNUSED
#endif

MAYBE_UNUSED static constexpr int INF = (int)1e9 + 5;
MAYBE_UNUSED static constexpr ll INFL = (ll)1e18 + 5;
MAYBE_UNUSED static mt19937 rng((u32)chrono::duration_cast<chrono::nanoseconds>(chrono::high_resolution_clock::now().time_since_epoch()).count());
//endregion }}}

template <class T, size_t... Is> struct arr_helper;
template <class T> struct arr_helper<T> { using type = T; };
template <class T, size_t I, size_t... Is>
struct arr_helper<T, I, Is...> { using type = array<typename arr_helper<T, Is...>::type, I>; };
template <class T, size_t... Is> using arr = typename arr_helper<T, Is...>::type;


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

    array<vpi, 101> f{};
    arr<bool, 3, 3> fi{};
    rep(i, 3) rep(j, 3) {
        int aij; cin >> aij;
        f[aij].emplace_back(i, j);
    }
    int n; cin >> n;
    rep(_, n) {
        int bi; cin >> bi;
        for (auto p : f[bi])
            fi[p.first][p.second] = true;
    }
    bool b = (fi[0][0] && fi[1][1] && fi[2][2]) || (fi[0][2] && fi[1][1] && fi[2][0]);
    rep(i, 3)
        b = b || (fi[i][0] && fi[i][1] && fi[i][2]) || (fi[0][i] && fi[1][i] && fi[2][i]);
    cout << (b ? "Yes\n" : "No\n");

    return 0;
}

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

using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define PRINT(item) cout << (item) << endl;
#define PRINT_VEC(V) \
    for (auto v : (V)) cout << v << ' '

int main() {
    int a, b, t;
    cin >> a >> b >> t;

    int generated_times = t/a;
    PRINT(generated_times*b);

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
    int A,B;
    cin >> A >> B;
    
    int coin = max(A,B);
    if(coin == A){
        A--;
    }else{
        B--;
    }
    coin += max(A,B);
    
    cout << coin << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>

#define num_points_max 100000

typedef struct
{
	int num_points;
	int time[num_points_max + 1];
	int rcdx[num_points_max + 1];
	int rcdy[num_points_max + 1];
} abc086c_t;

bool IsPossible (const abc086c_t * given_data)
{
	// local variables for this function
	int available_time;
	int displacement_rcdx;
	int displacement_rcdy;
	int displacement_sum;

	for (int iter = 1; iter <= (*given_data).num_points; ++iter)
	{
		available_time    = (*given_data).time[iter] - (*given_data).time[iter - 1];
		displacement_rcdx = (*given_data).rcdx[iter] - (*given_data).rcdx[iter - 1];
		displacement_rcdy = (*given_data).rcdy[iter] - (*given_data).rcdy[iter - 1];

		displacement_sum = abs(displacement_rcdx) + abs(displacement_rcdy);

		if (displacement_sum > available_time)
		{
			return false;
		}
		else if (displacement_sum % 2 != available_time % 2)
		{
			return false;
		}
		else
		{
			continue;
		}
	}

	return true;
}

void ABC086C (const abc086c_t * given_data)
{
	if   ( IsPossible(given_data) ) printf( "Yes\n" );
	else                            printf(  "No\n" );
}

int main (void)
{
	// variables for `main`
	abc086c_t given_data;
	int       retval_scanf;

	// STEP.01
	// read out the given data
	retval_scanf = scanf("%d", &given_data.num_points);

	given_data.time[0] = 0;
	given_data.rcdx[0] = 0;
	given_data.rcdy[0] = 0;

	for (int iter = 1; iter <= num_points_max; ++iter)
	{
		retval_scanf =
			scanf(
				"%d %d %d",
				&given_data.time[iter],
				&given_data.rcdx[iter],
				&given_data.rcdy[iter]
			);
	}

	// STEP.02
	// calculate & output the answer
	ABC086C(& given_data);

	// STEP.END
	return EXIT_SUCCESS;
}

Measured memory_bytes: 1280
#include <iostream>
#include <algorithm>
using namespace std;
int used[100][100] = { 0 }, m, n, dx[] = { -1,0,1,0 }, dy[] = { 0,1,0,-1 };

int dfs(int x, int y, int d) {
	int res = d;
	for (int i = 0; i < 4; i++) {
		int tx = x + dx[i];
		int ty = y + dy[i];
		if (1 <= tx&&tx <= m && 1 <= ty&&ty <= n&&used[tx][ty] == 1) {
			used[tx][ty] = 0;
			res = max(res, dfs(tx, ty, d + 1));
			used[tx][ty] = 1;
		}
	}
	return res;
}

int main() {
	while (1) {
		int ans = 0;
		cin >> m >> n;
		if (m == 0 && n == 0) return 0;
		for (int i = 1; i <= m; i++) {
			for (int j = 1; j <= n; j++) {
				cin >> used[i][j];
			}
		}
		for (int i = 1; i <= m; i++) {
			for (int j = 1; j <= n; j++) {
				if (used[i][j] == 1) {
					used[i][j] = 0;
					ans = max(ans, dfs(i, j, 1));
					used[i][j] = 1;
				}
			}
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 3120
N, A, B, C, D = map(int, input().split())
B -= A

ans = "NO"
for i in range(N):
    high = i * D - (N - i - 1) * C
    low = i * C - (N - i - 1) * D
    if low <= B <= high:
        ans = "YES"
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int n, k;
	cin >> n >> k;
	int ans = 0;
	while(n) {
		++ans;
		n /= k;
	}
	cout << ans << '\n';
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
using namespace std;
int a[100005],dp[100005];
int main(int argc, char** argv) {
	int n;
	cin >> n;
	for(int i=1;i<=n;i++)
		cin >> a[i];
	dp[1]=0;
	for(int i=2;i<=n;i++)
	{
		dp[i]=dp[i-1]+abs(a[i]-a[i-1]);
		if(i>2) dp[i]=min(dp[i],dp[i-2]+abs(a[i]-a[i-2]));
	}
	cout << dp[n];
	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
int main()
{
	int a;
	scanf("%d", &a);
	if(a % 10 == 7 || a / 100 == 7 || a / 10 - a / 100 * 10 == 7)
		printf("Yes\n");
	else
		printf("No\n");
	return 0;
}

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

int main(){
    int n; cin>>n;
    vector<int>v(n);
    vector<int>c(n);
    int t=0,ans=0;
    for(int i=0;i<n;i++){
        cin>>v.at(i);
        }
    for(int i=0;i<n;i++){
        cin>>c.at(i);
        t=v.at(i)-c.at(i);
        if(t>0){
            ans=ans+t;
            }
            }
        cout<<ans<<endl;
        }


Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// スペース区切りの整数の入力
		int natudays = sc.nextInt();
      	int ii=sc.nextInt();
      int[] hairetu=new int[ii];
      for(int i=0;i<ii;i++){
        hairetu[i]=sc.nextInt();
      }
      int k=0;
      for(int i=0;i<hairetu.length;i++){
        k+=hairetu[i];
      }
      int ans=natudays-k;
      if(ans<0){
        ans=-1;
      }
      System.out.println(ans);
	}
}

Measured memory_bytes: 46332
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
int main(){
    string s;
    cin >> s;
    int cnt=0;ll ans;
    bool hantei=false;
    if(s.size() == 1){
        cout << s <<endl;
        return 0;
    }
    for(int i=1; i<=s.size()-1; i++){
        if(s[i] == '9') cnt++;
        if(cnt == s.size()-1) hantei=true;
    }
    
    if(hantei){
        ans = s[0] -'0' + 9*(s.size()-1);
    }
    else{
        ans =s[0] -'0' + 9*(s.size()-1) -1;
    }
    cout << ans << endl;
    return 0;
}

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

int main() {

 int a,b;

 cin >> a >> b;

 if (a < b) {
  cout << "a < b" << endl;
 } else if (a > b) {
  cout << "a > b" <<endl;
 } else {
  cout << "a == b"<<endl;
 }

 return 0;
}

Measured memory_bytes: 1156
ans = 0
n, m, c = map(int, input().split())
b = list(map(int, input().split()))

for i in range(n):
    a = list(map(int, input().split()))
    tmp = sum([a_ * b_ for (a_, b_) in zip(a, b)]) + c
    if tmp > 0:
        ans += 1

print(ans)


Measured memory_bytes: 9108
#include <bits/stdc++.h>
#define boost ios_base::sync_with_stdio(0); cin.tie(); cout.tie()
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define endl '\n'
#define len(a) a.size()

using namespace std;

typedef long long ll;

int main()
{
    int a, b, c, k; cin >> a >> b >> c >> k;
    for (int i = 0; i <= k; i++) {
        for (int j = 0; j <= k - i; j++) {
            int q = (1 << i);
            int w = (1 << j);
            if (a < b * q && b * q < c * w) {
                cout << "Yes";
                return 0;
            }
        }
    }
    cout << "No";
    return 0;
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int N;
    cin >> N;
    string S;
    cin >> S;
    int i = 0, j = N - 1, p = 0;
    while (i < j)
    {
        while (S[i] != 'W' && i < N)
        {
            i++;
        }
        while (S[j] != 'R' && j > 0)
        {
            j--;
        }
        if (i >= j)
        {
            break;
        }
        swap(S[i], S[j]);
        p++;
    }
    cout << p << endl;
}

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

#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rrep(i, n) for (int i = n; i >= 0; --i)
#define ALL(x) (x).begin(), (x).end()
const int INF = 1'010'000'000'000'000'017LL;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
using vint = vector<int>;
using pint = pair<int, int>;

signed main() {
	int x, a;
	cin >> x >> a;
	if (x < a)
		cout << 0;
	else
		cout << 10;
	cout << endl;
}


Measured memory_bytes: 256