akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

const double PI = 3.14159265358979323846;
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
typedef pair<ll, ll> P;
const ll INF = 10e17;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
#define ret() return 0;

std::istream &operator>>(std::istream &in, set<ll> &o) {
    ll a;
    in >> a;
    o.insert(a);
    return in;
}

std::istream &operator>>(std::istream &in, queue<int> &o) {
    ll a;
    in >> a;
    o.push(a);
    return in;
}

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }

//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);

//const ll mod = 1e10;
//typedef priority_queue<P, vector<P>, greater<P> > PQ_ASK;

bool find_loop_dfs(
        int now,
        vector<vector<int>> &edges,
        vector<bool> &visited,
        vector<bool> &clear_edges
) {
    if (clear_edges[now]) return false;
    if (visited[now]) return true;

    visited[now] = true;
    for (int next : edges[now]) {
        bool b = find_loop_dfs(next, edges, visited, clear_edges);
        if (b) return true;
    }
    visited[now] = false;
    clear_edges[now] = true;
    return false;
}

int find_loop(vector<vector<int>> &edges) {
    int n = edges.size();
    vector<bool> visited(n, false);
    vector<bool> clear_edges(n, false);


    rep(i, n) if (find_loop_dfs(i, edges, visited, clear_edges)) return true;
    return false;
}

vector<vector<int>> create_edges(vector<vector<int>> &table) {
    int n = table.size();
    vector<vector<int>> m(n, vector<int>(n));

    int k = 0;
    for (int i = 0; i < n; i++) {
        for (int j = i + 1; j < n; j++) {
            m[i][j] = k;
            k++;
        }
    }

    vector<vector<int>> edges(k);

    auto to_id = [&](int i, int j) -> int {
        if (i > j) swap(i, j);
        return m[i][j];
    };

    rep(i, n) {
        rep(j, table[i].size() - 1) {
            int from = to_id(i, table[i][j]);
            int to = to_id(i, table[i][j + 1]);
            edges[from].push_back(to);
        }
    }

    return edges;
}

int dfs(int now, vector<vector<int>> &edges, vector<int> &memo) {
    if (memo[now] != -1) return memo[now];

    int ans = 0;
    for (int next : edges[now]) {
        cmax(ans, dfs(next, edges, memo) + 1);
    }

    memo[now] = ans;
    return ans;
}

int solve(vector<vector<int>> &edges) {
    int ans = 0;
    int n = edges.size();
    vector<int> memo(n, -1);
    rep(i, n) cmax(ans, dfs(i, edges, memo));
    return ans + 1;
}

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

    vector<vector<int>> table(n, vector<int>(n - 1));
    rep(i, n)rep(j, n - 1)cin >> table[i][j], table[i][j]--;

    vector<vector<int>> edges = create_edges(table);

    bool l = find_loop(edges);
    if (l) {
        cout << -1 << endl;
        ret();
    }

    int ans = solve(edges);

    cout << ans << endl;


}

Measured memory_bytes: 38444
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>

using namespace std;

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

	vector<long long> a(n, 0);
	long long abs_sum = 0;
	long long abs_min = 1e18;
	int n_minus = 0;
	for (int i = 0; i < n; i++) {
		cin >> a[i];

		if (a[i] < 0) {
			n_minus++;
		}

		abs_sum += abs(a[i]);
		abs_min = min(abs_min, abs(a[i]));
	}

	long long ans = abs_sum;
	if (n_minus % 2 == 1) {
		ans -= 2LL * abs_min;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 1024
using System;
using System.Collections.Generic;
using System.Linq;

namespace C
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] In = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
            int n = In[0];
            int m = In[1];
            var D = new Dictionary<long, int>();
            for(int i=0; i < n; i++)
            {
                int[] In2 = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
                int a = In2[0];
                int b = In2[1];
                if (D.ContainsKey(a)) D[a] += b;
                else D[a] = b;
            }
            var SD =D.OrderBy(x => x.Key);
            long sum = 0;
            foreach(var d in SD)
            {
                if (m <= d.Value)
                {
                    sum += d.Key * m;
                    break;
                }
                else
                {
                    m -= d.Value;
                    sum += (d.Key * d.Value);
                }
            }
            Console.WriteLine(sum);
        }
    }
}


Measured memory_bytes: 52396
def solve():
    from sys import stdin
    f_i = stdin
    
    N = int(f_i.readline())
    
    from string import ascii_lowercase
    next_line = {}
    S = {} # statements
    V = {} # values
    line = 0
    for i in range(N):
        stmt = f_i.readline().split()
        next_line[line] = stmt[0]
        line = stmt[0]
        op = stmt[1]
        if op == 'ADD' or op == 'SUB':
            v1, v2, v3 = stmt[2:]
            V[v1] = 0
            V[v2] = 0
            if v3 in ascii_lowercase:
                V[v3] = 0
            else:
                V[v3] = int(v3)
            S[line] = (op, v1, v2, v3)
        elif op == 'SET':
            v1, v2 = stmt[2:]
            V[v1] = 0
            if v2 in ascii_lowercase:
                V[v2] = 0
            else:
                V[v2] = int(v2)
            S[line] = (op, v1, v2)
        elif op == 'IF':
            v1, d = stmt[2:]
            V[v1] = 0
            S[line] = (op, v1, d)
        else:
            S[line] = (op,)
    next_line[line] = None
    
    v_num = 0
    for k in V:
        if k in ascii_lowercase:
            v_num += 1
    state_limit = len(S) * (16 ** v_num)
    
    nl = next_line[0]
    s = S[nl]
    cnt = 0
    while cnt < state_limit:
        cnt += 1
        op = s[0]
        if op == 'HALT':
            break
        elif op == 'ADD':
            v = V[s[2]] + V[s[3]]
            if v >= 16:
                break
            V[s[1]] = v
        elif op == 'SUB':
            v = V[s[2]] - V[s[3]]
            if v < 0:
                break
            V[s[1]] = v
        elif op == 'SET':
            V[s[1]] = V[s[2]]
        else:
            if V[s[1]]:
                nl = s[2]
                if nl in next_line:
                    s = S[nl]
                    continue
                else:
                    break
        nl = next_line[nl]
        if nl == None:
            break
        s = S[nl]
    
    if cnt == state_limit:
        print('inf')
    else:
        ans = []
        for k, v in V.items():
            if k in ascii_lowercase:
                ans.append(('{}={}'.format(k, v)))
        ans.sort()
        print('\n'.join(ans))

solve()


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

int main() {
  int N, L,R,sum;
  cin >> N;
  sum =0;
	
  // ここにプログラムを追記
  for(int i = 0;i<N;i++){
  	cin >> L>>R;
    int a = R-L+1;
    sum += a;
    }
  cout<<sum<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <map>
#include <numeric>
#include <set>
#define FOR(i, a, n) for (int i = (a); i < (n); i++)
#define REP(i, n) for(int i = 0; i < (n); i++)
using namespace std;



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

	vector<int> cuisine;
	vector<int> ltime;
	int tmp;

	REP(i, 5) {
		cin >> tmp;
		cuisine.push_back(tmp);
	}

	REP(i, 5) {
		tmp = 10 - (cuisine[i] % 10);
		if (tmp == 10)tmp = 0;
		ltime.push_back(tmp);
	}

	sort(ltime.begin(), ltime.end());

	tmp = accumulate(ltime.begin(), ltime.end() - 1,0);

	cout << accumulate(cuisine.begin(), cuisine.end(), tmp) << endl;

	return 0;
}

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

int main() {
  int A,P;
  cin >> A >> P;
  
  int ans = (A*3 + P) / 2;

  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3640
#include<iostream>
using namespace std;
int main()
{
  long long a,product,c;
  string b;
  cin>>a>>b;
  c=(b[0]-'0')*100+(b[2]-'0')*10+(b[3]-'0');

  product=(long long)(a*c);
   printf("%lld",product/100);
  return 0;
}

Measured memory_bytes: 3732
#include<iostream>
#include<cstdlib>
#include<vector>

using namespace std;

typedef long long ll;

int main() {
   int N, K;
   cin >> N >> K;
   int a[N];
   ll s[N + 1];
   s[0] = 0;
   for (int i = 0; i < N; i++) {
      cin >> a[i];
      s[i + 1] = s[i] + a[i];
   }

   vector<ll> part;

   for (int i = 0; i < N; i++) {
      for (int j = i; j < N; j++) {
         ll tmp = s[j + 1] - s[i];
         part.push_back(tmp);
      }
   }

   int N2 = N * (N + 1) / 2;
   ll ans = 0;

   for (int i = 40; i >= 0; i--) {
      int count = 0;
      for (int j = 0; j < N2; j++) {
         ll tmp1 = ans + (1ll << i);
         ll tmp2 = part[j];
         if ((tmp1 & tmp2) == tmp1) count++;
      }
      if (count >= K) {
         ans += (1ll << i);
      }
   }
   
   cout << ans << endl;
   return 0;
}


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

int main() {
  long long N, A, B;
  cin >> N;
  vector<long long> city(N+1);
  vector<long long> man(N);

  for (int i = 0; i < N + 1; i++) {
    cin >> city.at(i);    
  }
  for (int i = 0; i < N; i++) {
    cin >> man.at(i);    
  }
  
  long long cnt = 0;
  long long Astart = city.at(0);
  
  for (int i = 0; i < N; i++) {
    long long tempA = Astart;
    long long tempB = man.at(i);
    long long tempAnext = city.at(i+1);
    
    if (tempA >= tempB) {
      cnt += tempB;
      Astart = tempAnext;
      continue;
    }
    else {
      cnt += tempA;
      tempB -= tempA;
      if (tempAnext >= tempB) {
        cnt += tempB;
        tempAnext -= tempB;
        Astart = tempAnext;
        continue;
      }  
      else {
        cnt += tempAnext;
        Astart = 0;
        continue;
      }
    }
    
  }
  
  cout << cnt << endl;
  
}

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

using namespace std;

typedef long long int ll;
typedef pair<ll, ll> pll;

#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll) 1e15;

ll A[1005];
ll B[1005];

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N, M;
    cin >> N >> M;
    REP(i, N) {
        cin >> A[i];
    }
    REP(i, M) {
        cin >> B[i];
    }
    sort(A, A + N, greater<ll>());
    sort(B, B + M, greater<ll>());

    ll ai = 0, bi = 0;
    ll ans = 1;
    REP(i, N - 1) {
        if (A[i] == A[i + 1])
            ans = 0;
    }
    REP(i, M - 1) {
        if (B[i] == B[i + 1])
            ans = 0;
    }
    if (A[0] != N * M || B[0] != N * M)
        ans = 0;
    for (ll i = N * M; i > 0; --i) {
        if (A[ai + 1] == i)
            ai++;
        if (B[bi + 1] == i)
            bi++;

        ll n = ai + 1;
        ll m = bi + 1;
        if (A[ai] == i)
            n = 1;
        if (B[bi] == i)
            m = 1;

        ll p = n * m;
        if (A[ai] != i && B[bi] != i)
            p -= N * M - i;
        ans = (ans * p) % MOD;
    }

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;vector<int> L[2000];int N,M,E,C[2000],x[2000],y[2000];bool U[2000];bool D(int V){U[V]=true;for(int i=0;i<L[V].size();i++){int u=L[V][i],w=C[u];if(w<0||!U[w]&&D(w)){C[V]=u;C[u]=V;return 1;}}return 0;}int SM(){int r=0;memset(C,-1,8000);for(int j=0;j<N+M;j++){if(C[j]<0){memset(U,0,8000);if(D(j)){r++;}}}return r;}main(){while(1){for(int i=0;i<2000;i++){L[i].clear();}cin>>N>>M;if(!N){break;}for(int i=0;i<N;i++){cin>>x[i];}for(int i=0;i<M;i++){cin>>y[i];}for(int i=0;i<N;i++){for(int j=0;j<M;j++){if(__gcd(x[i],y[j])>1){L[i].push_back(j+N);}}}cout<<SM()<<endl;}return 0;}

Measured memory_bytes: 4112
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<(n); ++i)
#define REP(i, d, n) for(int i=(d); i<(n); ++i)
typedef long long ll;
const int mod = 1e9 + 7;

int main(){

    int n;
    cin >> n;
    vector<pair<int, int>> p;
    rep(i, n){
        int x, l;
        cin >> x >> l;
        p.emplace_back(x+l, x-l);
    }

    sort(p.begin(), p.end());

    int ans = 1;
    vector<pair<int, int>> v;
    v.emplace_back(p[0].first, p[0].second);
    REP(i, 1, n){
        if(v.back().first <= p[i].second){
            v.emplace_back(p[i].first, p[i].second);
            ans++;
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 2548
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    ll n;
    cin>>n;
    ll a[n][3];
    ll has[n][3];
    for(ll i=0;i<n;i++)
    {
        has[i][0]=has[i][1]=has[i][2]=0;
        cin>>a[i][0]>>a[i][1]>>a[i][2];
    }
    has[n-1][0]=a[n-1][0];
    has[n-1][1]=a[n-1][1];
    has[n-1][2]=a[n-1][2];
    for(ll i=n-2;i>=0;i--)
    {
        has[i][0]=a[i][0]+max(has[i+1][1],has[i+1][2]);
        has[i][1]=a[i][1]+max(has[i+1][0],has[i+1][2]);
        has[i][2]=a[i][2]+max(has[i+1][0],has[i+1][1]);
    }
    cout<<max(has[0][0],max(has[0][1],has[0][2]));
    return 0;
}

Measured memory_bytes: 4992
using System;

public class Hello
{
    public static void Main()
    {
        int n = int.Parse(Console.ReadLine());

        if(n % 10 == 3)
        {
            Console.WriteLine("bon");
        }
        else if(n % 10 == 0 || n % 10 == 1 || n % 10 == 6 || n % 10 == 8)
        {
            Console.WriteLine("pon");
        }
        else
        {
            Console.WriteLine("hon");
        }
    }
}

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

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a, b;
  cin >> a >> b;
  if (abs(a - b) <= 1) {
    cout << "Yay!" << endl;
  } else {
    cout << ":(" << endl;
  }
  return 0;
}


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

int main(){
  vector<int> X(5);
  for(int i = 0; i < 5; i++){
    cin >> X.at(i);
  }
  int k;
  cin >> k;
  
  for(int i = 0; i < 4; i++){
    for(int j = 1 + i; j < 5; j++){
      int D;
      D = X.at(j) - X.at(i);
      if(D > k){
        cout << ":(";
        return 0;
      }
    }
  }
  cout << "Yay!";
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,b;
	cin>>a>>b;
	if(a+b==15)
		cout<<"+"<<endl;
	else if(a*b==15)
		cout<<"*"<<endl;
	else cout<<"x"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define IOS ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define add push_back
#define endl "\n"
const double PI = acos(-1);
using ll = long long;
using namespace std;

int n;
int main() {
    cin >> n;
    int ans = n;
    for (int i = 1; i < 3; ++i) {
        ans *= n;
    }
    cout << ans << endl;

    return 0;
}




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

int main(){

  int x = 0, y = 0, top = 0;
  char c[100];
  int s[100];

  while(scanf("%s", c) != EOF){
    if(c[0] == '+'){
      x = s[top-2];
      y = s[top-1];
      s[top-2] = x+y;
      top--;
    }else if(c[0] == '-'){
      x = s[top-2];
      y = s[top-1];
      s[top-2] = x-y;
      top--;
    }else if(c[0] == '*'){
      x = s[top-2];
      y = s[top-1];
      s[top-2] = x*y;
      top--;
    }else{
      s[top] = atoi(c);
      top++;
    }
  }
  printf("%d\n", s[top-1]);

  return 0;
}
    



Measured memory_bytes: 2108
#!/usr/bin/env python3

import itertools
import math


def main():
    w, h, t = map(int, input().split())
    p = int(input())
    fert = []
    for _ in range(p):
        x, y, _ = map(int, input().split())
        fert.append((y, x))
    stage = [list(map(int, input().split())) for _ in range(h)]
    for r, c in itertools.product(range(h), range(w)):
        if stage[r][c] == 0:
            stage[r][c] = float("inf")
        elif stage[r][c] == 1:
            stage[r][c] = 0
    for r, c in fert:
        stage[r][c] += 1
    ans = sum(sum(filter(lambda x: x != float("inf"), row)) for row in stage)
    print(ans)


if __name__ == '__main__':
    main()

Measured memory_bytes: 7880
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <deque>
#include <stack>
#include <queue>
#include <bitset>
#include <cstdio>
#include <string>
#include <vector>
#include <random>
#include <chrono>
#include <utility>
#include <numeric>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <sstream>
#include <assert.h>
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <unordered_map>
using namespace std;

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(bool x) {cerr << (x ? "true" : "false");}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}

template<typename T, typename V> void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i : x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";} void _print() {cerr << "]\n";}
template <typename T, typename... V>void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifdef HOME
#warning CHECK int:ll::INT_MAX:LLONG_MAX
#define maxn 20
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define maxn 2000006
#define gcd __gcd
#define debug(x...)
#endif

#define ff first
#define endl '\n'
#define ss second
#define inf 0x3f3f3f3f
#define MOD 1000000007
#define PI 3.14159265358979323846264338327950L
#define f(i,x,n) for(int i=x;i<=n;i++)
#define fr(i,x,n) for(int i=x;i>=n;i--)
struct _ { ios_base::Init i; _() { ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL); } } _;

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


int main() {

	int n; cin >> n;
	vector<int> a(n + 1, 0), dp(n + 1, -1); for (int i = 1; i <= n; i++) cin >> a[i];
	dp[0] = 0;

	for (int i = 1; i <= n; i++) {
		if (dp[a[i] - 1] != -1) dp[a[i]] = dp[a[i] - 1] + 1;
	}
	debug(dp);
	int x = *max_element(dp.begin() + 1, dp.end());
	if (x == -1) cout << x;
	else cout << n - x;


	return 0;
}

Measured memory_bytes: 4780
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int d[] = new int[n];
    for(int i=0;i<n;i++){
      d[i] = sc.nextInt();
    }
    Arrays.sort(d);
    if(d[(n/2)-1]==d[(n/2)]){
      System.out.println(0);
    }else{
      System.out.println(d[(n/2)]-d[(n/2)-1]);
      
      
    }
  }
  
  //最大公約数・最小公倍数（セットで使う）
static int gcd (int a, int b) {return b>0?gcd(b,a%b):a;}
static int lcm (int a, int b) {return a*b/gcd(a,b);}


//素数判定
static boolean isPrime (int n) {
	if (n==2) return true;
	if (n<2 || n%2==0) return false;
	double d = Math.sqrt(n);
	for (int i=3; i<=d; i+=2) if(n%i==0){return false;}
	return true;
}


//倍数判定（10進数以外のときに有用）
static boolean isMultiple (String s, int base, int m) {
	int temp = 0;
	for (int i=0; i<s.length(); i++) {
		temp = (temp*base+Character.getNumericValue(s.charAt(i)))%m;
	}
	if (temp==0) {return true;}
	return false;
}


//階乗
static long factorial (int i) {
	if (i==1) {return 1;}
	else {return i*factorial(i-1);}
}


//進数変換
static String toNbase (String sm, int m, int n) {
	return Long.toString(Long.parseLong(sm,m),n);
}
  
}

Measured memory_bytes: 50904
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
struct node
{
    int op,vl;
}d[200010];
int n,h,a1,a2,ans;
int comp(const node&a,const node&b)
{
    return a.vl>b.vl;
}
inline int read()
{
    int jg=0,jk=getchar()-'0';
    while(jk<0||jk>9)    jk=getchar()-'0';
    while(jk>=0&&jk<=9)  jg*=10,jg+=jk,jk=getchar()-'0';
    return jg;
}
int main()
{
    //freopen("t.txt","r",stdin);
    n=read(),h=read();
    for(int i=1;i<=n;i++)
    {
        a1=read(),a2=read();
        d[i].op=1,d[i].vl=a1;
        d[i+n].vl=a2;        
    }
    sort(d+1,d+2*n+1,comp);
    for(int i=1;i<=2*n;i++)
    {
        if(!d[i].op)  
        {
            ans++;
            h-=d[i].vl;
        }
        else
        {
            ans+=(h-1)/d[i].vl+1;
            break;
        }
        if(h<=0)  break;
    }
    printf("%d",ans);
    //while(1);
    return 0;
}


Measured memory_bytes: 1792
(n, m) = [int(i) for i in input().split()]
A = []
b = []
for i in range(n):
    A.append([int(j) for j in input().split()])

for i in range(m):
    b.append(int(input()))

for i in range(n):
    s = 0
    for j in range(m):
        s += A[i][j] * b[j]
    print(s)

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


int main()
{
	
    

    ll n,i;
    cin>>n;
    set <ll> s;
    for(i=0;i<n;i++)
    {
        ll x;
        cin>>x;
        s.insert(x);
    }
    if(s.size()==n)
    {
        cout<<"YES"<<endl;
    }
    else
    {
        cout<<"NO"<<endl;
    }
    return 0; 

}


Measured memory_bytes: 9600
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <cstring>
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <cmath>
#include <numeric>
#include <float.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef unsigned long long ll;
// 最大公約数求める関数
int my_gcd(int n , int m){
  if(n < m){
    int tmp = n;
    n = m;
    m = tmp;
  }
  int l  = n % m;
  while(l != 0){
    n = m;
    m = l;
    l = n % m;
}
return m;
}

//char⇒int関数
 int ctoi(char c) {
 	switch (c) {
		case '0': return 0;
		case '1': return 1;
		case '2': return 2;
		case '3': return 3;
		case '4': return 4;
		case '5': return 5;
		case '6': return 6;
		case '7': return 7;
		case '8': return 8;
		case '9': return 9;
		default: return 0;
	}
}



int main(){
int N,M; cin >> N >> M;
set<int> s;
vector<int> cnt(N+1,0);
int ans = 0;
rep(i,M){
  int a;
  string b;
  cin >> a >> b;
  if(! s.count(a)){
    if(b == "AC"){
      s.insert(a);
    }
    else{
      cnt[a]++;
    }
  }
 }

  rep(i,N+1){
    if(! s.count(i)){
      cnt[i] = 0;
    }
    ans += cnt[i];
  }
  cout << s.size() << " " << ans << endl;
  }

Measured memory_bytes: 5376
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std;

int main() {
  
  int a,b,c,d,x;
  double da,db;
  string s,ss,sss;
  
  int ans = 0;
  string anss = "";
  
  cin >> s;
  
  int ab [] = {0 , 1 , 3 , 1 , 2 , 1 , 2 , 1 , 1 , 2 , 1 , 2 , 1};
  int result3 = std::max({a, b, c});
//--------------------------------------------------------------------------------
  
//  if(a+b > c+d) anss = "Left";
//  else anss = "Balanced";
  s[3] = '8';
  cout << s << endl;

}

Measured memory_bytes: 256
/*
数据不清空，爆零两行泪。
多测不读完，爆零两行泪。
边界不特判，爆零两行泪。
贪心不证明，爆零两行泪。
D P 顺序错，爆零两行泪。
大小少等号，爆零两行泪。
变量不统一，爆零两行泪。
越界不判断，爆零两行泪。
调试不注释，爆零两行泪。
溢出不 l l，爆零两行泪。
*/
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
const int N=500000;
int n;//|a| 
char a[N+5];//字符串 
int lcP[N+1],Lcs[N+1];//每个后缀与a的LCP、每个前缀与a的LCS 
int z[N+1];//z数组 
void z_init(){//对a跑Z算法 
	z[1]=n;
	int zl=0,zr=0;
	for(int i=2;i<=n;i++)
		if(zr<i){
			z[i]=0;
			while(i+z[i]<=n&&a[1+z[i]]==a[i+z[i]])z[i]++;
			if(z[i])zl=i,zr=i+z[i]-1;
		}
		else if(i+z[i-zl+1]<=zr)z[i]=z[i-zl+1];
		else{
			z[i]=zr-i+1;
			while(i+z[i]<=n&&a[1+z[i]]==a[i+z[i]])z[i]++;
			zl=i;zr=i+z[i]-1;
		}
}
bool Cyc[N+1],cyC[N+1]; 
int main(){
	cin>>a+1;
	n=strlen(a+1);
	bool ok=true;
	for(int i=1;i<n;i++)ok&=a[i]==a[i+1];//a的最小循环节是否为1 
	if(ok)return cout<<n<<"\n1",0;//特判最小循环节为1 
	z_init();
	for(int i=1;i<=n;i++)lcP[i]=z[i];//算lcP 
	reverse(a+1,a+n+1);//令a=a^r以算Lcs 
	z_init();
	for(int i=1;i<=n;i++)Lcs[i]=z[n-i+1];//算Lcs 
	ok=true;
	for(int i=1;i<n;i++)if(n%i==0&&lcP[i+1]==n-i)ok=false;//a是否循环 
	if(ok)return puts("1\n1"),0;//特判不循环 
	puts("2");//一定有分成2段的方式 
	for(int i=1;i<=n;i++){
		if(Cyc[i])continue;
		for(int j=2*i;j<=n;j+=i)
			if(lcP[i+1]>=j-i)Cyc[j]=true;
			else break;
	}
	for(int i=1;i<=n;i++){
		if(cyC[n-i+1])continue;
		for(int j=n-2*i+1;j>=1;j-=i)
			if(Lcs[n-i]>=n-j+1-i)cyC[j]=true;
			else break;
	}
	int ans=0;
	for(int i=1;i<n;i++)ans+=!Cyc[i]&&!cyC[i+1];
	cout<<ans;
	return 0;
}

Measured memory_bytes: 7552
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        sc.close();
        String beforechar = "";
        int count = 0;

        for(int i = 0; i < S.length(); i++){
            if(i==0){
                beforechar = S.substring(i,i+1);
            }else{
                if(S.substring(i,i+1).equals(beforechar)){
                   count ++;
                   if(beforechar.equals("0")){
                        beforechar = "1";
                   }else{
                       beforechar = "0";
                   }
                }else{
                    beforechar = S.substring(i,i+1);
                }
            }
        }

        System.out.println(count);

    }
}

Measured memory_bytes: 39528
#include <bits/stdc++.h>
//#pragma GCC optimize(2)
//author wjl

using namespace std;
#define LL long long
#define Rint register int
#define U unsigned
#define forn(i,a,b) for(int i = a;i <= b;++i)
#define nfor(i,a,b) for(int i = a;i >= b;--i)
#define pii pair<int ,int>
#define MS0(X) memset(X,0,sizeof(X))
#define MSf(X) memset(X,false,sizeof(X))
#define MS1(X) memset(X,-1,sizeof(X))
#define BR printf("--------------------\n")
#define pb push_back
#define rep(i,a,b) for(Rint i=a;i<=b;++i)
#define DEBUG(x) std::cerr << #x << '=' << x << std::endl
const double PI=atan(1.)*4.;
const int maxn=1e6+5;
const int inf = 0x3f3f3f3f;
const int mod=1e9+7;
const double e=2.71828182845904523536;
int dirx[8]={1,0,-1,0,1,-1,-1,1};
int diry[8]={0,1,0,-1,1,1,-1,-1};

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin>>n;
    string s;
    cin>>s;
    if(n&1){cout<<"No";return 0;}
    bool ok=true;
    for(int i=0;i<n/2;i++)
    {
        if(s[i]!=s[i+n/2])
        {
            ok=false;
            break;
        }
    }
    if(ok)cout<<"Yes";
    else cout<<"No";
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define space putchar(' ')
#define enter putchar('\n')
#define eps 1e-10
#define MAXN 200005
//#define ivorysi
using namespace std;
typedef long long int64;
typedef unsigned int u32;
typedef double db;
template<class T>
void read(T &res) {
    res = 0;T f = 1;char c = getchar();
    while(c < '0' || c > '9') {
        if(c == '-') f = -1;
        c = getchar();
    }
    while(c >= '0' && c <= '9') {
        res = res * 10 +c - '0';
        c = getchar();
    }
    res *= f;
}
template<class T>
void out(T x) {
    if(x < 0) {x = -x;putchar('-');}
    if(x >= 10) {
        out(x / 10);
    }
    putchar('0' + x % 10);
}
int64 D;

int Len(int64 D) {
    int res = 0;
    while(D) {
        res++;
        D /= 10;
    }
    return res;
}
int64 pw[20];
int64 v[20],d[20];
int up;
int64 dfs(int64 rem,int dep) {
    if(dep == up) return !rem;
    int64 t = rem / v[dep];
    int64 res = 0;
    if(abs(t - 1) <= 9 && abs(rem - (t - 1) * v[dep]) < v[dep]) {
        int c = 0;
        if(t - 1 >= 0 && !dep) c = 1;
        res += (d[t - 1 + 9] - c) * dfs(rem - (t - 1) * v[dep],dep + 1);
    }
    if(abs(t) <= 9 && abs(rem - t * v[dep]) < v[dep]) {
        int c = 0;
        if(t >= 0 && !dep) c = 1;
        res += (d[t + 9] - c) * dfs(rem - t * v[dep],dep + 1);
    }
    if(abs(t + 1) <= 9 && abs(rem - (t + 1) * v[dep]) < v[dep]) {
        int c = 0;
        if(t + 1 >= 0 && !dep) c = 1;
        res += (d[t + 1 + 9] - c) * dfs(rem - (t + 1) * v[dep],dep + 1);
    }
    return res;
}
void Solve() {
    read(D);
    int Ld = Len(D);
    int64 ans = 0;
    pw[0] = 1;
    for(int i = 1 ; i <= 18 ; ++i) pw[i] = pw[i - 1] * 10;
    for(int i = 0 ; i <= 9 ; ++i) {
        for(int j = 0 ; j <= 9 ; ++j) {
            d[i - j + 9]++;
        }
    }
    for(int i = Ld ; i <= 2 * Ld ; ++i) {
        for(int j = 0 ; j <= i / 2 ; ++j) v[j] = pw[i - j - 1] - pw[j];
        up = i / 2;
        int64 tmp = dfs(D,0);
        if(i & 1) tmp *= d[0 + 9];
        ans += tmp;
    }
    out(ans);enter;
}
int main() {
#ifdef ivorysi
    freopen("f1.in","r",stdin);
#endif
    Solve();
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#define N 1000010
using namespace std;
typedef long long ll;
int mod=998244353;
int n,m,ans,sum,fac[N],inv[N];
void init()
{
	fac[0]=fac[1]=inv[0]=inv[1]=1;
	for (int i=2;i<=n+m;i++)
		fac[i]=(ll)fac[i-1]*i%mod,inv[i]=(ll)(mod-mod/i)*inv[mod%i]%mod;
	for (int i=2;i<=n+m;i++)
		inv[i]=(ll)inv[i]*inv[i-1]%mod;
}
int C(int m,int n)
{
	return ((((ll)fac[n]*inv[m])%mod)*(ll)inv[n-m])%mod;
}
main()
{
	scanf("%d%d",&n,&m);
	if (n<m) swap(n,m);
	ans=n;
	init();
	for (int i=1;i<=m;i++)
        sum=((ll)C(i,i<<1)*C(n-i,n+m-(i<<1))+sum)%mod;
    printf("%d\n", (((((ll)sum*inv[2]%mod)*inv[n+m]%mod)*fac[n]%mod)*fac[m]+ans)%mod);
}

Measured memory_bytes: 8064
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<n; i++)
#define check(e,f,g) if(sheet.at(e-1)==0 && sheet.at(f-1)==0 && sheet.at(g-1) ==0) bingo = "Yes"

int main(){
  int N, b;
  vector<int> sheet(9);
  string bingo = "No";
  rep(i,9){
    cin >> sheet.at(i);
  }
  cin >> N;
  rep(i, N){
    cin >> b;
    rep(j, 9){
      if(b == sheet.at(j)) sheet.at(j) = 0;
    }
  }
  check(1,2,3);
  check(4,5,6);
  check(7,8,9);
  check(1,4,7);
  check(2,5,8);
  check(3,6,9);
  check(1,5,9);
  check(3,5,7);
  cout << bingo << endl;
}


Measured memory_bytes: 256
n=int(input())
f=[1]*(10**7+1)
f[0]=0
for i in range(2,n+1):
  tem = i
  while tem <= n:
      f[tem] += 1
      tem += i
ans=0
for i in range(1,n+1):
  ans+=i*f[i]
print(ans)

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

int main() {
  int a;

  cin >> a;
  
  int b,c,d;

  b = a/100;
  c = (a-b*100)/10;
  d = a-b*100-c*10;

  cout << b+c+d << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main() {
	int n, y, k10, k5, k1;

	scanf("%d%d", &n, &y), y /= 1000;
	for (k10 = 0; k10 * 10 <= y; k10++)
		for (k5 = 0; k10 * 10 + k5 * 5 <= y; k5++) {
			k1 = y - k10 * 10 - k5 * 5;
			if (k10 + k5 + k1 == n) {
				printf("%d %d %d\n", k10, k5, k1);
				return 0;
			}
		}
	printf("-1 -1 -1\n");
	return 0;
}


Measured memory_bytes: 128
import sys
input = sys.stdin.readline
n,m=map(int,input().split())
A=[input().strip() for _ in range(n)]
B=[input().strip() for _ in range(m)]
for i in range(n-m+1):
    for j in range(n-m+1):
        flg=True
        for k in range(m):
            #print(A[i+k][j:j+m],B[k])
            if A[i+k][j:j+m]!=B[k]:
                flg=False
        if flg:
            print("Yes")
            exit()

print("No")


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

using namespace std;
#ifdef _DEBUG
#define _GLIBCXX_DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

//#define int long long
#define DBG 1
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define loop(n) rep(loop, (0), (n))
#define all(c) begin(c), end(c)
const int INF =
    sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
const double PI = acos(-1);
const double EPS = 1e-9;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
using pii = pair<int, int>;
// template<class T> ostream &operator<<(ostream &os,T &t){dump(t);return os;}
template <typename T, typename S>
istream &operator>>(istream &is, pair<T, S> &p) {
  is >> p.first >> p.second;
  return is;
}
template <typename T, typename S>
ostream &operator<<(ostream &os, pair<T, S> &p) {
  os << p.first << " " << p.second;
  return os;
}

template <typename T> void printvv(const vector<vector<T>> &v) {
  cerr << endl;
  rep(i, 0, v.size()) rep(j, 0, v[i].size()) {
    if (typeid(v[i][j]).name() == typeid(INF).name() and v[i][j] == INF) {
      cerr << "INF";
    } else
      cerr << v[i][j];
    cerr << (j == v[i].size() - 1 ? '\n' : ' ');
  }
  cerr << endl;
}
/*
   typedef __int128_t Int;
   std::ostream &operator<<(std::ostream &dest, __int128_t value) {
   std::ostream::sentry s(dest);
   if (s) {
   __uint128_t tmp = value < 0 ? -value : value;
   char buffer[128];
   char *d = std::end(buffer);
   do {
   --d;
 *d = "0123456789"[tmp % 10];
 tmp /= 10;
 } while (tmp != 0);
 if (value < 0) {
 --d;
 *d = '-';
 }
 int len = std::end(buffer) - d;
 if (dest.rdbuf()->sputn(d, len) != len) {
 dest.setstate(std::ios_base::badbit);
 }
 }
 return dest;
 }

 __int128 parse(string &s) {
 __int128 ret = 0;
 for (int i = 0; i < s.length(); i++)
 if ('0' <= s[i] && s[i] <= '9')
 ret = 10 * ret + s[i] - '0';
 return ret;
 }
 */

#ifndef _DEBUG
#define printvv(...)
#endif
void YES(bool f) { cout << (f ? "YES" : "NO") << endl; }
void Yes(bool f) { cout << (f ? "Yes" : "No") << endl; }
template <class T> bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T> bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}

signed main(signed argc, char *argv[]) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(12);

  int N, M;
  cin >> N >> M;
  vector<vector<int>> g(N);
  vector<int> p(M), y(M);
  rep(i, 0, M) {
    cin >> p[i] >> y[i];
    p[i]--;
    g[p[i]].eb(y[i]);
  }
  map<pii, string> ans;
  rep(i, 0, N) {
    sort(all(g[i]));
    rep(j, 0, g[i].size()) {
      int v = g[i][j];
      auto s1 = to_string(i + 1), s2 = to_string(j + 1);
      while (s1.size() < 6) {
        s1 = "0" + s1;
      }
      while (s2.size() < 6) {
        s2 = "0" + s2;
      }
      ans[pii(i,v)]=s1+s2;
    }
  }
  rep(i,0,M){
    cout<<ans[pii(p[i],y[i])]<<endl;
  }

  return 0;
}


Measured memory_bytes: 18688
#include <bits/stdc++.h> 
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define all(vec) vec.begin(), vec.end()
#define tmax(x,y,z) max((x),max((y),(z)))
#define tmin(x,y,z) min((x),min((y),(z)))
typedef long long ll;ll MM = 1000000000;ll mod = MM + 7; ll MMM=9223372036854775807;//2^63 -1
ll GCD(ll x, ll y) {if (y == 0) return x;else return GCD(y, x % y);}
ll LCM(ll x, ll y) { return x / GCD(x, y) * y;}
//cout << fixed << setprecision(10);

int main(){
  ll n ; cin>>n  ;
  
  cout<< pow(n,3) <<endl;
}

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

int ri() {
	int n;
	scanf("%d", &n);
	return n;
}

int main() {
	std::string s;
	std::cin >> s;
	int n = s.size();

	int num[n][2];
	memset(num, 0, sizeof(num));
	for (int i = 0; i < n; i++) num[i][0] = 1;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < 2; j++) {
			if (s[i] == 'R') num[i + 1][j ^ 1] += num[i][j], num[i][j] = 0;
		}
	}
	for (int i = n - 1; i >= 0; i--) {
		for (int j = 0; j < 2; j++) {
			if (s[i] == 'L') num[i - 1][j ^ 1] += num[i][j], num[i][j] = 0;
		}
	}
	int res[n];
	memset(res, 0, sizeof(res));
	for (int i = 0; i + 1 < n; i++) {
		if (s[i] == 'R' && s[i + 1] == 'L') {
			res[i] += num[i][0]; //
			res[i + 1] += num[i][1];
		} else res[i] += num[i][0] + num[i][1];
	}
	for (int i = 0; i < n; i++) std::cout << res[i] << " ";
	std::cout << std::endl;
	return 0;
}


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

int X[100005];

int main() {

    ios::sync_with_stdio(0);
    cin.tie(NULL), cout.tie(NULL);

    int N, K;
    cin >> N >> K;
    
    for(int i=1; i<=N; i++)
        cin >> X[i];
    
    int ans = (int) 1e9 + 7;
    
    for(int i=K; i<=N; i++)
    {
        ans = min(ans, abs(X[i-K+1]) + abs(X[i] - X[i-K+1]));
        ans = min(ans, abs(X[i]) + abs(X[i] - X[i-K+1]));
    }
    
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
long long a,b,c,kk;
int main()
{
    cin>>a>>b>>c;
    if(b>=a)
    {
        cout<<1<<endl;
        exit(0);
    }
    if(c>=b)
    {
        cout<<-1<<endl;
        return 0;
    }
    if((a-b)%(b-c)>=1)kk=1;
    cout<<((a-b)/(b-c)+kk)*2+1<<endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	long long int a;
	scanf("%lld", &a);
	char bb[102];
	scanf("%s", bb);
	long long int b = 0;
	int i;
	for (i = 0; bb[i] != '\0'; i++)
	{
		if (bb[i] != '.')
		{
			b = 10 * b + bb[i] - '0';
		}
	}
	printf("%lld\n", a * b / 100);
	return 0;
}

Measured memory_bytes: 1736
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
#include <unordered_map>
#include <iomanip>
#include <functional>
#include <bitset>
#include <complex>
#include <stack>



#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);i++)
#define all(x) (x).begin(),(x).end()

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

typedef long long ll;

using namespace std;


int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n,w;cin>>n>>w;
  ll miw=1e9,maw=0;
  vector<vector<ll>>val(4),vsum(4);
  vector<ll>we(n),va(n);
  rep(i,n){
    cin>>we[i]>>va[i];
    chmin(miw,we[i]);
    chmax(maw,we[i]);
  }
  rep(i,n){
    val[we[i]-miw].push_back(va[i]);
  }

  rep(i,4)sort(all(val[i]),greater<ll>());
  rep(i,4)vsum[i].push_back(0);

  rep(i,4)rep(j,val[i].size())vsum[i].push_back(vsum[i][j]+val[i][j]);
  ll res=0;
  rep(i,vsum[0].size()){
    rep(j,vsum[1].size()){
      rep(k,vsum[2].size()){
        rep(l,vsum[3].size()){
          ll tw=i*miw+j*(miw+1)+k*(miw+2)+l*(miw+3);
          if(tw>w)continue;
          ll tv=vsum[0][i]+vsum[1][j]+vsum[2][k]+vsum[3][l];
          chmax(res,tv);

        }

      }

    }
  }
  cout<<res<<endl;
  



  return 0;

}


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

int main(){
  int n;
  
  while(cin>>n,n){
    int mp[101][101]={};
    for(int i=0;i<n;i++)
      for(int j=0;j<n;j++) cin>>mp[i][j];

    int flg[101][101]={};  
    for(int i=0;i<n;i++){
      int mnx=1e9,mxy=0;
      int xi,xj,yi,yj;
      for(int j=0;j<n;j++) {
	if(mnx>mp[i][j]) mnx=mp[i][j];
	if(mxy<mp[j][i]) mxy=mp[j][i];
      }
      for(int j=0;j<n;j++){
	if(mnx==mp[i][j])flg[i][j]++;
	if(mxy==mp[j][i])flg[j][i]++;
      }
    }
    
    int f=0,ans=0;
    for(int i=0;i<n;i++)
      for(int j=0;j<n;j++) if(flg[i][j]==2)ans=mp[i][j],f++;
    
    if(f) cout << ans<<endl;
    else cout <<0<<endl;
  }
  return 0;
}

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

using namespace std;

#define INF 210000000
#define int long long

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

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

bool cmp(int a,int b){
		return a > b;
}

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


Measured memory_bytes: 256
s=list(input())
t=list(input())

l=len(s)
r=len(t)

ans=10000000

for i in range(l-r+1):
  ch=0
  for j in range(r):
    if s[i+j]==t[j]:
      ch+=1
  ans=min(ans,r-ch)
  
print(ans)
  

Measured memory_bytes: 64976
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] strNumArrays = br.readLine().split(" ");
		String answer = "";
		Integer a = Integer.parseInt(strNumArrays[0]);
		Integer b = Integer.parseInt(strNumArrays[1]);
		answer += a / b;
		answer += " " + a % b;
		double dA = Double.valueOf(a);
		double dB = Double.valueOf(b);
		answer += " " + String.format("%.5f", dA / dB);
		System.out.println(answer);
	}

}

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

int main()
{
    int n,m;
    cin >> n >> m;
    vector<int> s,c;
    rep(i,m){
        int si,ci;
        cin >> si >> ci;
        s.push_back(si);
        c.push_back(ci);
    }
    rep(i,1000){
        int temp=i/10,k=1;
        vector<int> num(1,i%10);
        while(temp){
            k++;
            num.push_back(temp%10);
            temp/=10;
        }
        if(k!=n)continue;
        bool b=true;
        reverse(num.begin(),num.end());
        rep(j,m){
            if(num[s[j]-1]!=c[j]){
                b=false;
                break;
            } 
        }
        if(b){
            cout << i << endl;
            return 0;
        }
    }
    cout << -1 << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
    string s;
    int a[3]={0,0,0};
    cin >> s;

    a[s[0] - 'a']++;
    a[s[1] - 'a']++;
    a[s[2] - 'a']++;

    bool ok = true;
    for (int i = 0; i < 3;i++){
        if(a[i]!=1){
            ok = false;
        }
    }
    if(ok){
        cout << "Yes";
    }else{
        cout << "No";
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <math.h>
using namespace std;

int main()
{
	int days[13] = { 0,31,29,31,30,31,30,31,31,30,31,30,31};
	string ans[7] = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};

int month, date,day,p;

	//前月までの延べ日数に変換
	for( int i = 1; i < 13; i++ ) {
		days[i] += days[i-1];
	}

	while( 1) {
		cin >> month >> date;
		if( month == 0 )
			break;
		
		day = days[month-1] + date + 3;
		p = day %7;

		cout << ans[p] << endl;

	}
	return 0;
}

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

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

	string s; cin >> s;
	int n = s.size();
	int cnt = 0;
	int maxi = 0;
	REP(i, n) {
		if (s[i] == 'R') {
			cnt++;
			maxi = max(maxi, cnt);
		} else
			cnt = 0;
	}
	cout << maxi << '\n';
	return 0;
}

Measured memory_bytes: 3648
/*
 * atcoder/abc122_2nd/c.cpp
 */

// C++ 14
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstring> // memset
#include <cassert>
using namespace std;
#define ll long long
#define loop(__x, __start, __end) for(int __x = __start; __x < __end; __x++)
template <class T> bool chmin(T &a, T b) { if (a > b) {a = b; return true; } return false; }
template <class T> bool chmax(T &a, T b) { if (a < b) {a = b; return true; } return false; }

const int MAX = 100100;
int N, Q;
string S;
int acc[MAX] = {0};

void solve() {
  cin >> N >> Q >> S;
  loop(n,1,N) {
    acc[n] = acc[n-1] + (S[n-1] == 'A' and S[n] == 'C');
  }
  int l, r;
  loop(q,0,Q) {
    cin >> l >> r;
    cout << acc[r-1] - acc[l-1] << endl;
  }
}
int main() {
  // cout.precision(15);
  // cout << fixed << double

  solve();

  return 0;
}


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

int main(){
  string a,b;
  cin>>a>>b;
  if(a.size()>b.size()) cout<<"GREATER";
  else if(a.size()<b.size()) cout<<"LESS";
  else if(a==b) cout<<"EQUAL";
  else{
    int i=0;
    while(a.at(i)==b.at(i)){
      i++;
    }if(a.at(i)>b.at(i)) cout<<"GREATER";
    else cout<<"LESS";
  }
  cout<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define For(i,n,k) for(int i=(n);i<(k);i++)
#define ALL(a)  (a).begin(),(a).end()
ll ans=0;
void calc(ll d,vector<ll> &list){
    ll n=list.size();
    for(ll i=n-1;list[i]>=d;i--){
        if(list[i]%10>0) list.push_back(list[i]*10+list[i]%10-1);
        if(list[i]%10<9) list.push_back(list[i]*10+list[i]%10+1);
        list.push_back(list[i]*10+list[i]%10);
    }
}
void Main(){
    ll k;cin>>k;
    vector<ll> list;
    For(i,1,10) list.push_back(i);
    For(i,10,100) if(abs(i%10-i/10)<=1) list.push_back(i);
    ll d=10;
    while(list.size()<k){
        calc(d,list);
        d*=10;
    }
    sort(ALL(list));
    //For(i,0,k) cout<<list[i]<<endl;
    cout<<list[k-1]<<endl;
}
int main(){
    Main();
    /*
    東方風神録は神が出てくるので当然神ゲー
    */
    return 0;
}

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

using namespace std;

int main(){

    ios_base::sync_with_stdio(0);
    cin.tie(0);

    int x, a;
    cin >> x >> a;

    if(x < a) cout << 0 << '\n';
    else cout << 10 << '\n';

    return 0;
}


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

using namespace std;

int mod = 1000000007;
long long dp[110][10];

int main() {
  int H, W, K;
  cin >> H >> W >> K;
  if (W == 1) {
    cout << 1 << endl;
    return 0;
  }
  dp[0][1] = 1;
  for (int i = 0; i < H; i++)
  for (int j = 0; j < (1 << (W - 1)); j++) {
    if (j & (j >> 1)) {
      continue;
    }
    for (int k = 1; k <= W; k++) {
      if (j & (1 << (k - 1))) {
        dp[i + 1][k + 1] += dp[i][k] % mod;
        dp[i + 1][k] += dp[i][k + 1] % mod;
        k++;
      } else {
        dp[i + 1][k] += dp[i][k] % mod;
      }
    }
  }
  cout << dp[H][K] % mod << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fast() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long int
using namespace std;

int ad(int a, int b){
    return a + b;
}

int su(int a, int b){
    return a - b;
}

int mu(int a, int b){
    return a * b;
}

int di(int a, int b){
    return a / b;
}

vector<int> decToBinary(int n) 
{ 
    // array to store binary number 
    int binaryNum[32]; 
    vector<int> p(32,0);
    // counter for binary array 
    int i = 0; 
    while (n > 0) { 
  
        // storing remainder in binary array 
        binaryNum[i] = n % 2; 
        n = n / 2; 
        i++; 
    } 
  
    // printing binary array in reverse order 
    for (int j = i - 1; j >= 0; j--) 
        {
            p[j]=binaryNum[j];
        }
        return p;
}


int main() {
    fast();
    ll n,m,x;
    cin>>n>>m>>x;
    ll c[n],a[n][m];
    for(int i=0;i<n;i++)
    {
        cin>>c[i];
        for(int j=0;j<m;j++)
        cin>>a[i][j];
    }
    ll ans=1e18;
    ll du=pow(2,n)-1;
    for(int i=1;i<=du;i++)
    {
        ad(1, 2);
        su(1, 2);
        mu(1, 2);
        di(1, 2);
        vector<int>k=decToBinary(i);
        ll sum=0,s[m]={0};
        for(int j=0;j<k.size()&&j<n;j++)
        {
            if(k[j]==1)
            {
                for(int y=0;y<m;y++)
                {
                    s[y]+=a[j][y];
                }
                sum+=c[j];
            }
           
        }
        int flag=1;
        for(int y=0;y<m;y++)
        {
            if(s[y]<x)
            flag=0;
        }
        if(flag)
        	ans=min(sum,ans);
    }
    ad(1, 2);
    su(1, 2);
    mu(1, 2);
    di(1, 2);
    if(ans==1e18)
    	cout<<-1;
    else
    	cout<<ans;
}

Measured memory_bytes: 4128
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    ios::sync_with_stdio(false);
    ll k,a,b;
    cin>>k>>a>>b;
    for(ll i=a;i<=b;i++)
    {
        if(i%k==0) return cout<<"OK",0;
    }
    return cout<<"NG",0;
}


Measured memory_bytes: 3668