akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>

int min(int* m, int N) {
  int min = 1000;
  for (int i = 0; i < N; i++) {
    if (m[i] < min) min = m[i];
  }
  return min;
}

int sum(int* m, int N) {
  int sum = 0;
  for (int i = 0; i < N; i++) {
    sum += m[i];
  }
  return sum;
}

int main(void) {
  int N, X;
  scanf("%d%d", &N, &X);
  int m[N];
  for (int i = 0; i < N; i++) {
    scanf("%d", &m[i]);
  }
  
  printf("%d\n", N + (X-sum(m, N))/min(m, N));
  
  return 0;
}


Measured memory_bytes: 128
<?php
$p='';
while(1){
  list($h,$w)=explode(' ',trim(fgets(STDIN)));
  if($h||$w){
    $l='';
    for($i=0;$i<$w;$i++){$l.='#';}
    $l.=PHP_EOL;

    $m='#';
    for($i=2;$i<$w;$i++){$m.='.';}
    $m.='#'.PHP_EOL;

    $p.=$l;
    for($i=2;$i<$h;$i++){$p.=$m;}
    $p.=$l;

    $p.=PHP_EOL;
  }
  else break;
}
print $p;

Measured memory_bytes: 15336
import java.util.Scanner;

public class Main {

	public static void main(String [] args) {
			
		Scanner in = new Scanner(System.in);
		int numSwaps = 0;
			
		int n = in.nextInt();
		int [] arr = new int [n];
		
			
		for(int i = 0; i < n; i++) {
				arr[i] = in.nextInt();
			}
		
		
			
		for(int j = 0; j < n; j++) {
			
			int minIndex = j;
			
			for(int h = j + 1; h < n; h++) {
				if(arr[h] <arr[minIndex]) {
					minIndex = h;
				}
			}
			
			if(j != minIndex) {
				int temp = arr[j];
				arr[j] = arr[minIndex];
				arr[minIndex] = temp;
				numSwaps++;
			}
		}
		for(int k = 0; k < n; k++) {
			System.out.print(arr[k]);
			
			if(k != n - 1) {
				System.out.print(" ");
			}
		}
		System.out.println("\n" + numSwaps);
	}
}



Measured memory_bytes: 26212
from collections import Counter
N = int(input())
S = input()
ans = 0
mod = 10 ** 9 + 7
c = Counter(S)
for k in S:
    n = 1
    for i in range(ord("a"), ord("z") + 1):
        i = chr(i)
        if i in c and i != k:
            n *= c[i] + 1
            n %= mod
    ans = (ans + n) % mod
    c[k] -= 1
print(ans)

Measured memory_bytes: 43372
#include <bits/stdc++.h>
#define MOD (long long)(1e9 + 7)
using namespace std;

template <int mod>
struct ModInt {
  int x;
  ModInt() : x(0) {}
  ModInt(int64_t y)
      : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}
  ModInt &operator+=(const ModInt &p) {
    if((x += p.x) >= mod) x -= mod;
    return *this;
  }
  ModInt &operator-=(const ModInt &p) {
    if((x += mod - p.x) >= mod) x -= mod;
    return *this;
  }
  ModInt &operator*=(const ModInt &p) {
    x = (int)(1LL * x * p.x % mod);
    return *this;
  }
  ModInt &operator/=(const ModInt &p) {
    *this *= p.inverse();
    return *this;
  }
  ModInt operator-() const { return ModInt(-x); }
  ModInt operator+(const ModInt &p) const {
    return ModInt(*this) += p;
  }
  ModInt operator-(const ModInt &p) const {
    return ModInt(*this) -= p;
  }
  ModInt operator*(const ModInt &p) const {
    return ModInt(*this) *= p;
  }
  ModInt operator/(const ModInt &p) const {
    return ModInt(*this) /= p;
  }
  bool operator==(const ModInt &p) const {
    return x == p.x;
  }
  bool operator!=(const ModInt &p) const {
    return x != p.x;
  }
  ModInt inverse() const {
    int a = x, b = mod, u = 1, v = 0, t;
    while(b > 0) {
      t = a / b;
      swap(a -= t * b, b);
      swap(u -= t * v, v);
    }
    return ModInt(u);
  }
  ModInt pow(int64_t n) const {
    ModInt ans(1), mul(x);
    while(n) {
      if(n & 1) ans *= mul;
      mul *= mul;
      n >>= 1;
    }
    return ans;
  }
  friend ostream &operator<<(ostream &os, const ModInt &p) {
    return os << p.x;
  }
  friend istream &operator>>(istream &is, ModInt &a) {
    int64_t t;
    is >> t;
    a = ModInt<mod>(t);
    return (is);
  }
  static int get_mod() { return mod; }
};

long long n;
vector<long long> cnt, edges[200005], par;
vector<bool> ch;

ModInt<MOD> solve();
long long rec(long long now);

int main() {
  cin >> n;
  for(int i = 0; i < n - 1; ++i) {
    int x, y;
    cin >> x >> y;
    --x, --y;
    edges[x].push_back(y);
    edges[y].push_back(x);
  }

  cout << solve() << endl;
  return 0;
}

ModInt<MOD> solve() {
  ModInt<MOD> res, two = 2;
  cnt.assign(n, 0);
  ch.assign(n, 0);
  par.assign(n, -1);
  ch[0] = 1;
  rec(0);
  for(int i = 0; i < n; ++i) {
    ModInt<MOD> now = 0;
    long long sum = 0;
    for(auto nowp : edges[i])
      if(par[i] != nowp) {
        sum += cnt[nowp];
        now += two.pow(cnt[nowp]) - 1;
      }
    if(par[i] != -1) now += two.pow(n - sum - 1) - 1;
    res += two.pow(n - 1) - 1 - now;
  }
  return res / two.pow(n);
}

long long rec(long long now) {
  long long res = 0;
  for(auto nextp : edges[now]) {
    if(!ch[nextp]) {
      ch[nextp] = 1;
      par[nextp] = now;
      res += rec(nextp);
    }
  }
  return cnt[now] = res + 1;
}


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

int main(){
   string s;
   cin>>s;
   int r=0, mx=0;
   rep(i, s.size()){
      if(s[i]=='R'){
         r++;
         mx=max(mx, r);
      }
      else r=0;
   }

   cout<<mx<<endl;
   return 0;
}


Measured memory_bytes: 3624
#include<bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep2(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep_inv(i, n, m) for(int i = (int)(n); i > (int)(m); i--)
using namespace std;
using ll = long long;
using vl = vector<ll>;
using vc = vector<char>;
using vvl = vector<vl>;
using vvc = vector<vc>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;

int main(){
  vvl A(3, vl(3));
  rep(i, 3){
    rep(j, 3) cin >> A[i][j];
  }
  ll N;
  cin >> N;
  vl b(N);
  rep(i, N) cin >> b[i];

  vvl hit(3, vl(3, 0));

  rep(t, N){
    rep(i, 3){
      rep(j, 3){
	if(b[t] == A[i][j]) hit[i][j] = 1;
      }
    }
  }

  rep(i, 3){
    if((hit[i][0] == 1) && (hit[i][1] == 1) && (hit[i][2] == 1)){
      cout << "Yes\n";
      return 0;
    }
  }

  rep(j, 3){
    if((hit[0][j] == 1) && (hit[1][j] == 1) && (hit[2][j] == 1)){
      cout << "Yes\n";
      return 0;
    }
  }

  if((hit[0][0] == 1) && (hit[1][1] == 1) && (hit[2][2] == 1)){
    cout << "Yes\n";
    return 0;
  }

  if((hit[0][2] == 1) && (hit[1][1] == 1) && (hit[2][0] == 1)){
    cout << "Yes\n";
    return 0;
  }

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


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

namespace AtCoder.Abc
{
    //https://atcoder.jp/contests/abc141/tasks/abc141_a
    public class QuestionA
    {
        public static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            // 整数の入力
            var n = long.Parse(Console.ReadLine());

            string result = "Christmas";

            if (n == 22) {
                result += " Eve";
                n++;
            }

            if (n == 23) {
                result += " Eve";
                n++;
            }

            if (n == 24) {
                result += " Eve";
            }

            Console.WriteLine(result);

            Console.Out.Flush();
        }
    }
}


Measured memory_bytes: 11092
N, M = map(int, input().split())
xs = [[] for _ in range(8)]
for j in range(N):
    a, b, c = map(int, input().split())
    for i in range(2**3):
        t = []
        for k in range(3):
            t.append(1-2*((i>>k)%2))
        xs[i].append(a*t[0] +b*t[1]+c*t[2])
print(max(sum(sorted(xs[i])[-M:]) for i in range(2**3))*(M!=0))


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

#define maxn 100005

using namespace std;
typedef long long ll;

vector < int > ans;

int n;
ll a[maxn];

bool sub() {
  int id = 1;
  for (int i = 1; i <= n; ++i)
    if (a[id] < a[i])
      id = i;

  if (a[id] > 0)
    return 0;

  cout << a[id] << '\n';
  cout << n - 1 << '\n';
  for (int i = 1; i < id; ++i)
    cout << "1\n";

  for (int i  = id; i < n; ++i)
    cout << n - i + 1 << '\n';
}

ll sum(int i) {
  ll s = 0;

  for (; i <= n; i += 2)
    s += max(a[i], 0ll);

  return s;
}

void Delete(int i) {
  ans.push_back(i);

  if (i == 1) {
    n--;
    for (; i <= n; ++i)
      a[i] = a[i + 1];
    return;
  }

  if (i == n) {
    n--;
    return;
  }

  a[i - 1] += a[i + 1];

  n -= 2;
  for (; i <= n; ++i)
    a[i] = a[i + 2];
}

int main(){
  #define TASK "ABC"
 // freopen(TASK".inp", "r", stdin); freopen(TASK".out", "w", stdout);
  ios_base::sync_with_stdio(0);

  cin >> n;

  for (int i = 1; i <= n; ++i)
    cin >> a[i];

  if (sub())
    return 0;

  if (sum(1) < sum(2))
    Delete(1);

  cout << sum(1) << '\n';

  int ok = 1;

  while (n > 1) {
    bool flag = 0;

    for (int i = 1; i <= n; ++i)
      if (i % 2 == ok && a[i] < 0) {
        if (i == 1)
          ok = 0;

        Delete(i);
        flag = 1;
        break;
      }

    if (flag) continue;

    for (int i = 1; i <= n; ++i)
      if (i % 2 != ok) {
        if (i == 1)
          ok = 1;
        Delete(i);
        break;
      }
  }

  cout << ans.size() << '\n';
  for (auto i : ans)
    cout << i << '\n';

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>

using namespace std;
int main(void){
    int n, m, t;
    while (cin>>n>>m && n) {
        vector<int> h, w;
        h.push_back(0);
        w.push_back(0);
        for (int i = 0; i < n; i++) {
            cin >> t;
            h.push_back(h[i] + t);
        }
        for (int i = 0; i < m; i++) {
            cin >> t;
            w.push_back(w[i] + t);
        }
        
        vector<int> a, b;
        for (int i = 0; i < h.size()-1; i++) {
            for (int j = i+1; j < h.size(); j++) {
                t = h[j] - h[i];
                a.push_back(t);
            }
        }
        for (int i = 0; i < w.size()-1; i++) {
            for (int j = i+1; j < w.size(); j++) {
                t = w[j] - w[i];
                b.push_back(t);
            }
        }
        sort(a.begin(), a.end());
        sort(b.begin(), b.end());
        //for (int i = 0; i < h.size(); i++) cout << h[i] << " "; cout << endl;
        //for (int i = 0; i < w.size(); i++) cout << w[i] << " "; cout << endl;
        //for (int i = 0; i < a.size(); i++) cout << a[i] << " "; cout << endl;
        //for (int i = 0; i < b.size(); i++) cout << b[i] << " "; cout << endl;
        
        int bi = 0, ans = 0;
        for (int ai = 0; ai < a.size(); ai++) {
            int c = 1;
            while (1) {
                if (a[ai] == a[ai+1] && ai+1 < a.size()) {
                    ai++;
                    c++;
                }
                else break;
            }
            while (1) {
                if (b[bi] < a[ai] && bi+1 < b.size()) bi++;
                else break;
            }
            if (a[ai] == b[bi]) {
                int d = 1;
                while (1) {
                    if (b[bi] == b[bi+1] && bi+1 < b.size()) {
                        bi++;
                        d++;
                    }
                    else break;
                }
                //printf("a[ai]=%d b[bi]=%d ans+=%d*%d\n",a[ai],b[bi],c,d);
                ans += c * d;
            }
        }
        cout << ans << endl;
    }
}

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

using namespace std;

typedef long long ll;

const int INF = 1e9;
const ll LLINF = 1e18;
const ll MOD = (ll)1e9 + 7;

ll cal(ll b, ll val)
{
  ll ret = 0;
  while (val > 0) {
    ret += (val % b);
    val /= b;
  }
  return ret;
}

int main()
{
  ll N, S; scanf("%lld %lld", &N, &S);

  ll ans = -1;
  for (ll b = 2; b * b <= N; ++b) {
    if (cal(b, N) == S) {
      printf("%lld\n", b);
      return 0;
    }
  }

  ans = (cal(N + 1, N) == S) ? N + 1 : LLINF;
  for (ll q = 1, val = N - S; q * q <= val; ++q) {
    if (val % q != 0) { continue; }
    ll b = val / q + 1;
    if (b > sqrt(N) and cal(b, N) == S) {
      ans = min(ans, b);
    }
  }
  printf("%lld\n", ans == LLINF ? -1 : ans);
  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 if(a == b) cout << "a == b" << endl;

  return 0;
}


Measured memory_bytes: 3072
#include <bits/stdc++.h>
#include <numeric>
using namespace std;
#define ll long long
#define mod107 1000000007
#define rep(i, n) for (int i = 0; i < n; ++i)
#define Graph vector<vector<int>>;
#define grepq priority_queue<double, std::vector<double>, std::greater<double>>
#define all(v) v.begin(), v.end()
#define PI acos(-1)
#define inf 1000000321
int dx[4] = {0,1,0,-1};
int dy[4] = {1,0,-1,0};

ll dp[201000];

int main(){
    int N,M;
    cin >> N >> M;
    vector<bool> S(N);
    for(int i = 0;i < M;i++){
        int a;
        cin >> a;
        S[a] = true;
    }
    ll ans = 0;
    dp[0] = 1;
    if(!S[1])dp[1] = 1;
    
    for(int i = 2;i <= N;i++){
        if(!S[i-2])dp[i] += dp[i-2];
        if(!S[i-1])dp[i] += dp[i-1];
        dp[i] %= mod107;
    }

    cout << dp[N] % mod107 << endl;
}

Measured memory_bytes: 4408
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int H, W;
    cin >> H >> W;
    vector<vector<char>> table(H, vector<char>(W));
    for (int i = 0; i < H; i ++){
        for (int j = 0; j < W; j ++){
            cin >> table.at(i).at(j);
        }
    }
    vector<bool> row(H, false);
    vector<bool> col(W, false);
    for (int i = 0; i < H; i ++){
        for (int j = 0; j < W; j ++){
            if (table.at(i).at(j) == '#'){
                row.at(i) = true;
                col.at(j) = true;
            }
        }
    
    }
    for (int i = 0; i < H; i ++){
        for (int j = 0; j < W; j ++){
            if (row.at(i) && col.at(j)){
                cout << table.at(i).at(j);
            }
        }
        cout << endl;
    }
}

Measured memory_bytes: 256
def check_h(x, y, xy_):
    difference_h = abs(x-xy_[0]) + abs(y-xy_[1])
    return difference_h

def main():
    n = int(input())
    xyh = [list(map(int, input().split())) for _ in range(n)]

    for x_, y_, h_ in xyh:
        if h_ != 0:
            X, Y, H = x_, y_, h_
            break

    for i in range(101):
        for j in range(101):
            xy = [i, j]
            h = H + check_h(X, Y, xy)
            if h >= H:
                if all(xyh[s][2]==max(h-check_h(xyh[s][0], xyh[s][1], xy), 0) for s in range(n)):
                    print(i, j, h)
                    break
    return 0

if __name__=="__main__":
    main()

Measured memory_bytes: 3064
a=[]
b=[]
n=int(input())
for i in range(n):
    j,k=map(int,input().split())
    a.append(j)
    b.append(k)
x=0
for i in range(n-1,-1,-1):
    n,m=a[i],b[i]
    y=(n+x)%m
    if y!=0:x+=m-y
print(x)

Measured memory_bytes: 11048
////////////////////////// Author
////////////////////////// Nasim Hossain Rabbi
////////////////////////// JU-CSE28
////////////////////////// CF - imnasim3.1415
////////////////////////// UVA - imnasim3.1415
////////////////////////// Mail - imnasim3.1415@gmail.com
#include<bits/stdc++.h>
using namespace std;
#define E end()
#define B begin()
#define sz size()
#define EM empty()
#define clr clear()
#define sqr(a) (a*a)
#define mk make_pair
#define pb push_back
string en="\n";
string t="hello";
string Y="YES\n";
string N="NO\n";
#define rep(i,n) for(i=0;i<n;i++)
#define Rep(i,n) for(i=1;i<=n;i++)
#define per(i,n) for(i=n-1;i>=0;i--)
#define peR(i,n) for(i=n;i>0;i--)
#define mem(a,b) memset(a,b,sizeof(a))
#define all(cont) cont.begin(),cont.end()
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL)
#define pi 3.1415926535897932384626433832795
#define vi vector<long long>
#define vs vector<string>
#define vp(vi,x) cin>>x; vi.pb(x);
#define srch(a,x) binary_search(all(a),x)
#define LB(a,x) (lower_bound(all(a),x)-a.B)
#define UB(a,x) (upper_bound(all(a),x)-a.B)
typedef long long LL;
typedef unsigned long long ULL;
bool isprm(LL a){for(LL i=2;i*i<=a;i++){if(a%i==0)return false;}return true;}
bool isVowel(char ch){ ch=toupper(ch); if(ch=='A'||ch=='U'||ch=='I'||ch=='O'||ch=='E') return true; return false;}
int toInt(string s){int sm;stringstream ss(s);ss>>sm;return sm;}
template<typename T>inline T gcd(T a,T b){if(a<0)return gcd(-a,b);if(b<0)return gcd(a,-b);return (b==0)?a:gcd(b,a%b);}
template<typename T>inline T lcm(T a,T b) {if(a<0)return lcm(-a,b);if(b<0)return lcm(a,-b);return a*(b/gcd(a,b));}
int main()
{
//    fast;
    LL i,j,k,n,m,l,s=0,x,y,tc=1,c=0;
    while(cin>>n)
    {
        vi a;
        s=-n;
        rep(i,n)
        {
            cin>>x;
            s+=x;
        }
        cout<<s<<en;
    }
}



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <complex>
#include <utility>

using namespace std;

typedef complex<double> Point;

bool inCircle(const Point &p, const Point &center, double radius) {
    double dist2 = norm(p-center);
    double rad2 = radius*radius;
    return dist2 < rad2+1e-9;
}

int check(const Point &center, const vector<Point> &points) {
    const int N = points.size();
    int cnt = 0;
    for(int i = 0; i < N; ++i) {
        if(inCircle(points[i], center, 1)) ++cnt;
    }
    return cnt;
}

int test(int a, int b, const vector<Point> &points) {
    const Point v(points[a]-points[b]);
    if(abs(v) >= 2) return 1;
    const double hlen = abs(v)/2;

    const double plen = sqrt(1 - hlen*hlen);
    Point perp = v*Point(0, 1);
    perp /= abs(perp);
    const Point mid = (points[a]+points[b]) / 2.0;
    return max(check(mid + perp*plen, points), check(mid - perp*plen, points));
}

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

    while(true) {
        int N;
        cin >> N;
        if(!N) break;

        vector<Point> points(N);
        for(int i = 0; i < N; ++i) {
            cin >> points[i].real() >> points[i].imag();
        }
        int ans = 0;
        for(int i = 0; i < N; ++i) {
            for(int j = 0; j < i; ++j) {
                ans = max(ans, test(i, j, points));
            }
        }
        if(N == 1) ans = 1;
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 1268
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <array>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;

int main() {
    const int n = 3;
    int p[3];
    for (int i = 0; i < n; i++) {
        cin >> p[i];
    }
    sort(p, p + n);

    int64_t r = (int64_t)p[0] * p[1];
    for (int i = 0; i < n; i++) {
        if (p[i] % 2 == 0) r = 0;
    }
    cout << r << endl;

    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
#include <deque>
#include <iomanip>
#include <limits>
#include <fstream>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N;cin>>N;
  int w[N];
  int mini = 2e9;
  map<int, int> mp;
  FOR(i,0,N){
    cin>>w[i];
    mini = min(mini, w[i]);
    mp[w[i]] = 0;
  }
  int k = 0;
  for(auto& m : mp) m.second = k++;
  bool done[N];
  CLR(done);
  int ans = 0;
  FOR(i,0,N){
    if(done[i]) continue;
    int cnt = 0, now = i, mi = 2e9, sum = 0;
    // 巡回
    while(!done[now]){
      cnt++;
      done[now] = true;
      mi = min(mi, w[now]);
      sum += w[now];
      now = mp[w[now]];
    }
    if(cnt <= 1) continue;
    ans += min(sum + mi * (cnt - 2), sum + mi + mini * (cnt + 1));
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 3244
a ,b = map(int,input().split())
ans = 100000000000

x = int(a / 0.08) #最小値を設定
y = int((b+10) / 0.1) #最大値を設定

z = 0

for i in range(x, y):
  if int(i * 0.08) == a and int(i * 0.1)  == b and i < ans:
    ans = i
    z = 1

if z == 1:
  print(ans)
else:
  print(-1)

Measured memory_bytes: 3064
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintStream;

class Main {

    public static void main(String[] args) throws IOException {
        doit(args, System.in, System.out);
    }

    static void doit(String[] args, InputStream in, PrintStream out)
            throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(in));
        String line = null;
        while ((line = reader.readLine()) != null) {
            if (line.isEmpty()) {
                continue;
            }
            int n = Integer.parseInt(line);
            for (int i = 0; i < n; i++) {
                reader.readLine();
                int[][] cells = new int[14][14];
                for (int j = 0; j < 8; j++) {
                    line = reader.readLine();
                    for (int k = 0; k < 8; k++) {
                        cells[j + 3][k + 3] = line.charAt(k) - '0';
                    }
                }
                int x = Integer.parseInt(reader.readLine()) + 2;
                int y = Integer.parseInt(reader.readLine()) + 2;
                solve(cells, x, y);
                out.println("Data " + (i + 1) + ":");
                for (int j = 0; j < 8; j++) {
                    for (int k = 0; k < 8; k++) {
                        out.print(cells[j + 3][k + 3] & 1);
                    }
                    out.println();
                }
            }
        }
    }

    private static void solve(int[][] cells, int x, int y) {
        cells[y][x] |= 2;
        if ((cells[y][x] & 1) == 0) {
            return;
        }
        cells[y][x] &= ~1;
        for (int[] flame : flames) {
            int fx = x + flame[0];
            int fy = y + flame[1];
            if ((cells[fy][fx] & 2) == 0) {
                solve(cells, fx, fy);
            }
        }
    }

    private static int[][] flames = { { 1, 0 }, { 2, 0 }, { 3, 0 }, { 0, 1 },
            { 0, 2 }, { 0, 3 }, { -1, 0 }, { -2, 0 }, { -3, 0 }, { 0, -1 },
            { 0, -2 }, { 0, -3 } };
}

Measured memory_bytes: 10000
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define pii pair<int,int>
const long long MOD=1e9+7;

int main() {
    int a,b;
    cin>>a>>b;
    cout<<max(max(a+b,a-b),a*b)<<endl;
    return 0;
}

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

int main()
{
  int h, w;
  cin >> h >> w;
  char s[h][w];
  for (int i = 0; i < h; i++){
    for (int j = 0; j < w; j++){
      cin >> s[i][j];
    }
  }
  int dx[] = {-1, 0, 1}, dy[] = {-1, 0, 1};
  int m[h][w];
  for (int i = 0; i < h; i++){
    for (int j = 0; j < w; j++){
      if (s[i][j] == '.'){
        int count = 0;
        for (int k = 0; k < 3; k++){
          for (int l = 0; l < 3; l++){
            int x = i + dx[k], y = j + dy[l];
            if (0 <= x && x < h && 0 <= y && y < w){
              if (s[x][y] == '#') count++;
            }
          }
        }
        m[i][j] = count;
      }else{
        m[i][j] = -1;
      }
    }
  }
  for (int i = 0; i < h; i++){
    for (int j = 0; j < w; j++){
      if (m[i][j] == -1) cout << '#';
      else cout << m[i][j];
      if (j == w - 1) cout << endl;
    }
  }
}

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

typedef pair<int,int> P;
#define ll long long
#define ld long double
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
#define sz(x) ((int)(x).size())
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)

const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;
int main()
{
    string s,t;cin >> s >> t;
    int sl = (int)s.length();
    bool result = true;
    for (int i = 0; i < sl; i++)
    {
        if(s[i]!=t[i])
        {
            result = false;
        }
    }
    if(result)
    {
        cout << "Yes" << endl;
        return 0;
    }else
    {
        cout << "No" << endl;
    }
    
    
}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

const long long INF=INT_MAX/4;
const long long MOD=1'000'000'007;
const double EPS=1e-14;
const bool DEBUG=true;

const string YES = "YES";
const string NO = "NO";
const string Yes = "Yes";
const string No = "No";

template<class T>
void debug(T head){
    if(DEBUG){
        cout<<head<<endl;
    }
}

template <class Head, class... Body>
void debug(Head head, Body... body){
    if(DEBUG){
        cout<<head<<" ";
        debug(body...);
    }
}

/////


void answer(){
    unsigned long long N;
    cin>>N;

    if(N==1){
        cout<<0<<endl;
        return;
    }else if(N==2){
        cout<<2<<endl;
        return;
    }



    unsigned long long pow10 = 1;
    unsigned long long pow9 = 1;
    unsigned long long pow8 = 1;
    for(int i=0; i<N; ++i){
        pow10 *= 10;
        pow10 %= MOD;
        pow9 *= 9;
        pow9 %= MOD;
        pow8 *= 8;
        pow8 %= MOD;
    }
    
    cout<<(pow10+pow8+MOD+MOD-pow9-pow9)%MOD<<endl;
    return;
}

/////

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

    answer();

    return 0;
}


Measured memory_bytes: 3580
a,b=map(int,input().split())
ans=0
for i in range(1,1000000000000):
    cnt=0
    if int(i*0.08) > 100:
        break
    if int(i*0.08) == a:
        if int(i*0.1) == b:
            cnt+=1
    if cnt == 1:
        print(i)
        ans+=1
        break

if ans==0:
    print(-1)

Measured memory_bytes: 38768
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
	int a,b,c,ta,tb;
	while(cin>>a>>b>>c){
		if(a%2==1 || b%2==1 || c%2==1){
				cout<<"0"<<endl;
			}
		else
		for(int i=1;;i++){

			ta=a;tb=b;
			a=b/2+c/2;
			b=ta/2+c/2;
			c=ta/2+tb/2;
			if(a%2==1 || b%2==1 || c%2==1){
				cout<<i<<endl;break;
			}
			if(i>1000){
				cout<<"-1"<<endl;break;
			}
		}
	}
	return 0; 
}

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

int main(){
    int h1 = 0, h2, v = 0, n, i, f = 0, s = 0;
    cin >> n;
    for(i=0; i<n; i++){
        h2 = h1;
        cin >> h1;
        if(h1 > h2){
            if(f == 0){
                f = 1;
            }
        }else if(h1 < h2){
            if(f == 1){
                s += h2 - v;
                f = 0;
            }
            v = h1;
        }
    }
    if(h1 > v){
        s += h1 - v;
    }
    cout << s;
    return 0;
}

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

typedef int32_t i32;
typedef int64_t i64;
typedef uint64_t u64;

void set_at (u64 *b, i32 k) {
  b[k >> 6] |= (u64) 1 << (k & 63);
}

i32 get_at (u64 *b, i32 k) {
  return (b[k >> 6] >> (k & 63)) & 1;
}

int func (u64 * restrict a, u64 * restrict b, u64 * restrict c, i32 l, i32 r) {
  const u64 t = ~(u64)0;
  if (l / 64 == r / 64) {
    return (((a[l / 64] & b[l / 64] & c[l / 64]) >> (l & 63)) & (t >> (64 - (r - l + 1)))) != 0;
  }
  i32 k = l / 64;
  u64 x = (a[k] & b[k] & c[k]) >> (l & 63);
  if (x) return 1;
  k = r / 64;
  x = (a[k] & b[k] & c[k]) & (t >> (63 - r));
  if (x) return 1;
  for (i32 i = (l + 64) / 64 * 64; i + 63 <= r; i += 64) {
    if ((a[i / 64] & b[i / 64] & c[i / 64]) != 0) {
      return 1;
    }
  }
  return 0;
}

void run (void) {
  i32 n;
  scanf ("%" SCNi32, &n);
  i32 len = (n + 63) / 64;
  u64 *array = (u64 *) calloc (3 * n * len, sizeof (u64));
  u64 **win = (u64 **) calloc (n, sizeof (u64 *));
  for (i32 i = 0; i < n; ++i) {
    win[i] = array;
    array += len;
  }
  char *s = (char *) calloc (n + 1, sizeof (char));
  for (i32 i = 1; i < n; ++i) {
    scanf ("%s", s);
    for (i32 j = 0; j < i; ++j) {
      if (s[j] == '0') {
        set_at (win[j], i);
      } else {
        set_at (win[i], j);
      }
    }
  }
  u64 **dpL = (u64 **) calloc (n, sizeof (u64 *));
  u64 **dpR = (u64 **) calloc (n, sizeof (u64 *));
  for (i32 i = 0; i < n; ++i) {
    dpL[i] = array;
    array += len;
    set_at (dpL[i], i);
    dpR[i] = array;
    array += len;
    set_at (dpR[i], i);
  }
  for (i32 len = 2; len <= n; ++len) {
    for (i32 l = 0; l + len - 1 < n; ++l) {
      i32 r = l + len - 1;
      if (func (win[l], dpR[l + 1], dpL[r], l + 1, r)) {
	set_at (dpL[r], l);
      }
      if (func (win[r], dpR[l], dpL[r - 1], l, r - 1)) {
	set_at (dpR[l], r);
      }
    }
  }
  i32 ans = 0;
  for (i32 i = 0; i < n; ++i) {
    ans += get_at (dpR[0], i) & get_at (dpL[n - 1], i);
  }
  printf ("%" PRIi32 "\n", ans);
}

int main (void) {
  run();
  return 0;
}


Measured memory_bytes: 1664
#include<bits/stdc++.h>
using namespace std;
#define INF 1000000000
int main(){
  int n;
  int a[100009];
  cin>>n;
  for(int i=1;i<=n;i++)cin>>a[i];
  int now=1;
  for(int i=0;i<=n;i++){
    if(now==2){
      cout<<i<<endl;
      return(0);
    }
    now=a[now];
  }
  cout<<-1<<endl;
  return(0);
}


Measured memory_bytes: 640
#AtCoder Beginner Contest 083 B Some Sums
n, a, b = map(int,input().split())


sums = 0

def sumStr(x):
    tmp = 0
    for i in range(len(str(x))):
        tmp += int((str(x))[i:i+1])
    return tmp

for i in range(n):
    sum = sumStr(i+1)
    if a <= sum  and sum <= b:
        sums = sums + i + 1


print(sums)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep1(i, n) for (int i = 1; i < (n); ++i)
using namespace std;
typedef long long ll;
const ll INF = 1LL << 60;

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

    ll h, w;
    cin >> h >> w;

    if(h==1 || w==1) cout << 1 << endl;
    else cout << h*w/2 + (h*w%2) << endl; 

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <math.h>
using namespace std;
 
int main()
{
    int num;
     
    for(int k=1;k<10;k++)
    {
        for (int i=1; i<10; i++)
        {
            num=k*i;
            cout << k << "x" << i << "=" << num << "\n";
        }
    }
    return 0;
}

Measured memory_bytes: 1112
import itertools

def main():

    data = []
    while True:
        n, x = map(int, input().split())
        if [n, x] == [0, 0]: break
        data.append([n, x])

    for [n, x] in data:
        _set = set(range(1, n+1))
        comb = set(itertools.combinations(_set, 3))
        print(sum((True if sum(i) == x else False) for i in comb))


main()

Measured memory_bytes: 45400
a, v = map(int,input().split())
b, w = map(int,input().split())
t = int(input())

f=False
if a == b:
    f=True
elif v - w > 0:
    if abs(b-a) <= (v-w)*t:
        f = True

if f:
    print('YES')
else:
    print('NO')

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

#define MAX_N 2000
int n;
int A[MAX_N][MAX_N];

class Node
{
    public:
        int cost = INT_MAX;;
        bool used = false;
};

int prim()
{
    int i, u, v, minv, sum = 0;
    Node *nodes = new Node[n];
    nodes[0].cost = 0;
    while (true) {
        u = -1; minv = INT_MAX;
        for (i = 0; i < n; i++) {
            if (nodes[i].cost < minv && !nodes[i].used) {
                u    = i;
                minv = nodes[i].cost;
            }
        }
        if (-1 == u) break;
        nodes[u].used = true;
        sum += nodes[u].cost;
        for (v = 0; v < n; v++) {
            if (!nodes[v].used && A[u][v] != -1) {
                nodes[v].cost = A[u][v] < nodes[v].cost ? A[u][v] : nodes[v].cost;
            }
        }
    }
    return sum;
}

int main()
{
    cin >> n;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            cin >> A[i][j];
        }
    }
    cout << prim() << endl;
    return 0;
}

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

#define REP(i,n) for (int i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()

using namespace std;

using ll = long long;

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

    int N, K;
    cin >> N >> K;
    K = min(K, 1000);
    vector<int> A(N + 1);
    REP(i, N) cin >> A[i];

    while (K-- > 0) {
        vector<int> B(N + 1);
        REP(i, N) {
            B[max(i - A[i], 0)] += 1;
            B[min(i + A[i] + 1, N)] -= 1;
        }
        REP(i, N) {
            B[i + 1] += B[i];
        }
        if (A == B) {
            break;
        }
        A = B;
    }

    REP(i, N) {
        cout << A[i] << " ";
    }
    cout << endl;

    return 0;
}


Measured memory_bytes: 4980
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 1e5+7;
const ll mod = 998244353;
#define afdafafafdafaf y1;
int ar[maxn], n, m;
int num[maxn];
ll my_pow(ll x, ll y){
    ll ans = 1;
    while(y > 0){
        if(y & 1){
            ans = ans * x % mod;
        }
        x = x * x % mod;
        y /= 2;
    }
    return ans;
}
int main()
{
    scanf("%d", &n);
    for(int i=1;i<=n;i++){
        scanf("%d", ar+i);
        num[ar[i]]++;
    }
    for(int i=1;i<=n;i++){
        if(i == 1 && ar[i] != 0){
            printf("0\n");
            return 0;
        }
        if(i != 1 && ar[i] == 0){
            printf("0\n");
            return 0;
        } 
    }
    int ins = 1;
    ll ans = 1;
    for(int i=1;i<maxn;i++){
        if(num[i] == 0)break;
        ins += num[i];
        ans = ans * my_pow(num[i-1], num[i]) % mod;
    }
    if(ins != n)ans = 0;
    printf("%lld\n", ans);


    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <map>

using namespace std;
typedef long long ll;

int main(){
    int n,k;
    cin>>n>>k;
    vector<int> p(n);
    for(int i=0;i<n;i++){
        cin>>p[i];
    }
    sort(p.begin(),p.end());
    int ans=0;
    for(int i=0;i<k;i++){
        ans+=p[i];
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
#define int long long

signed main (){
	int n, m, i, j = 0;
	bool f;
	
	cin >> n;
	int a[n];
	for (i = 0; i < n; i++) cin >> a[i];
	cin >> m;
	int b[m];
	for (i = 0; i < m; i++) cin >> b[i];
	i = 0;
	while(i < m){
		if (a[j] < b[i]){
			j++;
			f = 0;
		}
		else if (a[j] == b[i]){
			i++;
			j++;
			f = 1;
		}
		else {
			f = 0;
			break;
		}
	}
	cout << f << endl;
	return 0;
}



Measured memory_bytes: 6224
#define _USE_MATH_DEFINES
#include <iostream>
#include <stdio.h>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <functional>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <math.h>
#include <complex>
#include <cassert>
#define rep(i,a,b) for (int i = (a); i < (b); i++)
using namespace std;
typedef long long int ll;
typedef complex<double> com;
typedef pair<int, int> P;
const int mod = 1e9 + 7;
const int MOD = 998244353;
const ll INF = 4e18;



int main() {
	int n, m; cin >> n >> m;
	vector<int> a(m),b(m),c(m);
	rep(i, 0, m) {
		cin >> a[i] >> b[i] >> c[i];
		a[i]--; b[i]--; c[i] *= -1;
	}
	vector<ll> dist(n, INF);
	dist[0] = 0;
	rep(roop,0,n){
		bool update = false;
		rep(i, 0, m) {
			if (dist[a[i]] != INF && dist[b[i]] > dist[a[i]] + c[i]) {
				dist[b[i]] = dist[a[i]] + c[i];
				update = true;
			}
		}
		if (!update) break;
	}
	ll ans = dist[n - 1];
	vector<bool> neg(n, false);
	rep(roop, 0, n)rep(i, 0, m) {
		if (dist[a[i]] == INF) continue;
		if (dist[b[i]] > dist[a[i]] + c[i]) {
			dist[b[i]] = dist[a[i]] + c[i];
			neg[b[i]] = true;
		}
		if (neg[a[i]]) neg[b[i]] = true;
	}
	if (neg[n - 1]) printf("inf");
	else printf("%lld", -ans);
	return 0;
}


Measured memory_bytes: 256
N=int(input())
B=list(map(int, input().split(' ')))
A=[None for _ in range(N)]
#print(A)
A[0]=B[0]
A[N-1]=B[N-2]
for i in range(1,N-1):
    A[i] = min(B[i-1],B[i])

print(sum(A))

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

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

  vector<vector<int>> arr(n, vector<int>(d));
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < d; ++j) {
      cin >> arr[i][j];
    }
  }
  
  int cnt = 0;
  for (int i = 0; i < n; ++i) {
    for (int j = i + 1; j < n; ++j) {
      int distance = 0;
      for (int k = 0; k < d; ++k) {
        distance += (arr[i][k] - arr[j][k]) * (arr[i][k] - arr[j][k]);
      }
      int sqrt_distance = static_cast<int>(sqrt(distance) + 0.01);
      if (distance == sqrt_distance * sqrt_distance) ++cnt;
    }
  }
  
  cout << cnt << endl;
}

Measured memory_bytes: 256
N = int(input())
S = str(input()) + 'W'

cnt = S[1:].count('E')
ans = cnt
for i in range(1,N):
    if S[i-1] == 'W':
        cnt += 1
    if S[i] == 'E':
        cnt -= 1
    ans = min(ans, cnt)

print(ans)


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

#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 ALL(obj) (obj).begin(), (obj).end()
#define INF 1e9
#define LINF 1e18
typedef long long ll;


int main() {
    int N,K; cin >> N >> K;
    if((N-1)*(N-2)/2<K){
        cout << -1 << endl;
        return 0;
    }

    int cnt = (N-1)*(N-2)/2-K;

    cout << (N-1) + (N-1)*(N-2)/2 - K << endl;
    FOR(i,1,N){
        cout << 1 << " " << i+1 << endl;
    }

    bool ok = true;
    FOR(i,1,N-1){
        FOR(j,i+1,N){
            if(cnt<=0){
                ok = false;
                break;
            }
            cout << i+1 << " " << j+1 << endl;
            cnt--;
        }
        if(!ok) break;
    }
    

    return 0;
}

Measured memory_bytes: 3616
#include <iostream>
#include <iomanip>
#include <random>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <numeric>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <sstream>
#include <bitset>
#include <cassert>
#include <fstream>
#include <queue>

#define len(X) ((int)(X).size())

#ifdef __LOCAL
	#define DBG(X) cout << #X << "=" << (X) << '\n';
#else
	#define DBG(X)
#endif
 
using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld  = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

const int INT_INF = (int)(2e9);
const ll  LL_INF  = (ll)(2e18);

const int NIL = -1;
static mt19937 _g(time(nullptr));

inline ll randint(ll a, ll b) { ll w = (_g() << 31LL) ^ _g(); return a + w % (b - a + 1); }
inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T> inline T sign(T x) { return T(x > 0) - T(x < 0); }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for(auto el: v) cout << el << " "; return os; }
template<typename T> inline T fetch() { T ret; cin >> ret; return ret; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for(auto& elem: ret) cin >> elem; return ret; }

void solve() {
	int n = fetch<int>();
	auto s = fetch<string>();
	auto t = fetch<string>();

	for(int match = n; match >= 0; --match) {
		string answ = s;
		int ok = 1;

		for(int i = match; i < n; ++i) {
			answ.push_back(t[i]);
		}

		for(int i = 0; i < n; ++i) {
			if(s[i] != answ[i]) {
				ok = 0;
				break;
			}
		}

		for(int i = 1; i <= n; ++i) {
			if(t[n - i] != answ[len(answ) - i]) {
				ok = 0;
				break;
			}
		}

		if(ok) {
			cout << len(answ) << '\n';
			return;
		}
	}
}

int main() {
	fast_io();
	solve();

	return 0;
}


Measured memory_bytes: 256
_, L = input(), list(map(int, input().split()))
L = [l for l in L if l % 2 == 0]
M = [l for l in L if (l % 3 == 0) or (l % 5 == 0)]
if len(L)==len(M):
  print("APPROVED")
else:
  print("DENIED")

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


typedef long long int ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef vector<string>vst;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;

#define fastio ios_base::sync_with_stdio(false);cin.tie(0)
#define all(ct) ct.begin() , ct.end()
#define endl "\n"
#define fr(i,a) for(auto i:a)
#define f(i,a,b) for(int i=a;i<b;++i)
#define fd(i,a,b) for(int i=a;i>=b;--i)
#define pb push_back
#define in(d,v) d.find(v)!=d.end()
#define mp make_pair
#define size1(a) int(a.size())
#define FOR(n) for(int i= 0;i<n;i++)
#define FORR(n) for(ll i= 0;i<n;i++)



// adjacency list graph input

// vector<vector<int> > adj(n, vector<int>());
// for (size_t i = 0; i < m; i++) {
// 	int x, y;
// 	cin >> x >> y;
// 	adj[x - 1].push_back(y - 1);

//}

int main() {
	fastio;



	int  n ;
	cin >> n ;
//	vi h(3, 0 );
	vi dp(3, 0);
	for (int i = 0; i < n ; i++) {
		vi dp_new(3,  0 );
		vi h;
		for (int  j = 0 ; j < 3 ; j++) {
			int x ;
			cin >> x;
			h.pb(x);
		}
		//cout << int(h.size());
		//for (auto x : h) {cout << x << " ";}

		for (int j = 0 ; j < 3 ; j++) {
			for (int k = 0 ; k < 3 ; k++) {
				if (k != j) {
					dp_new[j] = max(dp_new[j], h[j] + dp[k]);
				}
			}
		}
		dp = dp_new;
	}
	cout << max({dp[0], dp[1], dp[2]});
	return 0;


}


Measured memory_bytes: 3592
#include<iostream>
using namespace std;
int main()
{
int n,x;
cin>>n;
for(int i=1;i<=n;i++)
{
x=i;
if(x%3==0)cout<<" "<<i;
else
{
while(x)
{
if(x%10==3)
{
cout<<" "<<i;
break;
}
x/=10;
}
}
}
cout<<endl;
return 0;
}

Measured memory_bytes: 3072
#!/usr/bin/env python3
import math

A, B, H, M = map(int, input().split())

db = M * 360 / 60
da = H *360/12 + db/12
dt = da-db

C2:float = A**2 + B**2 - 2*A*B*math.cos(math.radians(dt))
C = C2 ** 0.5

print(abs(C))

Measured memory_bytes: 9568
function Main(input) {
  var split = input.split(' ');
  var value = +split[0];
  var digit = +split[1];
  var result = '';
  while(value > 0) {
    result += value % digit;
    value = Math.floor(value / digit);
  }
  console.log(result.length);
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
x = int(input())

if 400 <= x < 600:
    print(8)
elif 600 <= x < 800:
    print(7)
elif 800 <= x < 1000:
    print(6)
elif 1000 <= x < 1200:
    print(5)
elif 1200 <= x < 1400:
    print(4)
elif 1400 <= x < 1600:
    print(3)
elif 1600 <= x < 1800:
    print(2)
elif 1800 <= x < 2000:
    print(1)


Measured memory_bytes: 9184
#include<bits/stdc++.h> 
#define AndIamIronMan ios::sync_with_stdio(false); cin.tie(0);cout.tie(0); 
#define M 1000000007 

#define int128 __int128
using namespace std; 
typedef  long long int lli; 

bool prime(lli );

int main(){
		
    AndIamIronMan;
	lli co=0,i,n,y,m,d,j,k,z,t,x=0,a,b,c;
//	cin>>t;
//	while(t--){
	cin>>n;
	if(n>=30)cout<<"Yes";
	else cout<<"No";
//	}
		
	return 0;
}

bool prime(lli n){
	bool x=true;
	int i;
	for(i=2;i<=sqrt(n);i++){
		if(n%i==0){
			x=false;
		}	
	}
	return x;
}

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

int main(){
    ll D,G;
    cin >> D >> G;
    vector<ll> p(D),c(D),f(D);
    vector<vector<ll>> S(D,vector<ll>(101,0));
    rep(i,D){
        cin >> p[i] >> c[i];
//        S[i] = (i+1)*100*p[i] + c[i];
    }
    rep(i,D){
        rep(j,p[i]){
            S[i][j] = (i+1)*100*(j+1);
        }
        S[i][p[i]-1] += c[i];
        for(int j=p[i];j<100;j++){
            S[i][j] = S[i][p[i]-1];
        }
    }
    /*
    ll sum = 0;//中途半端な状態は1つだけ
    bool flag = false;
    ll mm = 1e10;
    rep(i,D){
        if(S[i][p[i]-1] >= G){
            flag = true;
            mm = min(mm,p[i]);
        }
    }
    */
    bool flag2= false;
    ll cur = 0;
    /*if(flag){
        ll tmp=-1;
        rep(i,100){
            rep(j,D){
                if(S[j][i] >= G){
                    tmp = i+1;
                    flag2=true;
                    break;
                }
            }
            if(flag2){
                break;
            }
        }
        if(flag2){
            cout << tmp << endl;
        }else{
            cout << mm << endl;
        }
        return 0;
    }else{*/
        ll mini = 1e10;
        ll num = 0;
        ll rec = -1;
        cur = 0;
        for(int i=0; i < (int(1) << int(D));i++ ){
            num = 0;
            cur = 0;
            rep(j,D){
                if((i >> j)&1){
                    cur += S[j][p[j]-1];
                    num += p[j];
                }
            }
            //cout << num << " "<< cur<<endl;
            for(int j=D-1;j>=0;j--){
                if(((i>>j)&1) == 0){
                    int ind = 0;
                    while(G > cur && ind <p[j]){
                        cur += (j+1)*100;
                        num++;
                        ind++;
                    }
                    break;
                }
            }
            if(cur >= G){
                mini = min(num,mini);
            //cout << "a:"<<mini <<" "<< cur <<endl;;
            }
            
        }
        /*
        while(cur<G){
            double Mcosp = 0;
            rec = -1;
            rep(i,D){
                if(f[i] == 1)continue;
                if(Mcosp < S[i][p[i]-1]/double(p[i])){
                    Mcosp =  S[i][p[i]-1]/double(p[i]);
                    rec = i;
                }
            }
            if(rec != -1){
                cur += S[rec][p[rec]-1];
                f[rec] = 1;
                num += p[rec];
            }
        }
        cur -= S[rec][p[rec]-1];
        f[rec] = 0;
        ll num2 =num - p[rec];
        for(int i=D-1;i>=0;i--){
            if(f[i] == 1) continue;
            rep(j,p[i]){
                if(cur + S[i][j] >= G){
                    cout << num2 + j + 1 << endl;
                    return 0;
                }
            }

            break;
        }*/
        cout << mini << endl;
    //}



    
}

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

int main()
{
    int n; cin>>n;
    map<int, int> a;
    for(int i=0; i<n; ++i) {
        int t; cin>>t;
        ++a[t];
    }
    string res="YES";
    int m; cin>>m;
    for(int i=0; i<m; ++i) {
        int t; cin>>t;
        if (--a[t]<0) res="NO";
    }
    cout<<res<<endl;
}


Measured memory_bytes: 9600
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define str to_string
#define endl "\n"
#define PI 3.141592653589
using namespace std;
using lint = long long;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

//AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC
int main(){
    int n,a,b,c,d,x;cin>>n>>a>>b>>c>>d;
    a--;b--;c--;d--;x=max(c,d);
    string s,ans="Yes";cin>>s;
    for(int i=a;i<x;i++){
        if(s[i]=='#'&&s[i+1]=='#'){cout<<"No"<<endl;return 0;}
    }
    if(c>d){
        bool ev=false;
        for(int i=b;i<=d;i++){
            if(s[i-1]==s[i]&&s[i]==s[i+1]&&s[i]=='.'){ev=true;break;}
        }
        if(!ev)ans="No";
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 3724
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,m;
    cin>>n>>m;
    long long a[100001];
    long long sum=0;
    for(int i=0;i<m;i++){
        cin>>a[i];
        sum+=a[i];
    }
    if(sum>=n) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int a[4],ans;

int main()
{
	scanf("%d%d%d",&a[1],&a[2],&a[3]);
	sort(a+1,a+3+1);
	if(((a[1]&1)&&(a[2]&1)&&(a[3]&1))||(!(a[1]&1)&&!(a[2]&1)&&!(a[3]&1))){
	ans+=(a[3]-a[1])>>1;
	ans+=(a[3]-a[2])>>1;
	cout<<ans;
	return 0;
	}
	else{
		int cnt1=0,cnt2=0;
		for(int i=1;i<=3;++i)
		if(a[i]&1) cnt1++;
		else cnt2++;
		if(cnt1==1){
			ans++;
			for(int i=1;i<=3;++i)
			if(!(a[i]&1)) a[i]++;
			ans+=((a[3]-a[1])>>1);
			ans+=((a[3]-a[2])>>1);
		}
		else{
			ans++;
			for(int i=1;i<=3;++i)
			if(a[i]&1) a[i]++;
			ans+=((a[3]-a[1])>>1);
			ans+=((a[3]-a[2])>>1);
		}
		cout<<ans;
		return 0;
	}
}

Measured memory_bytes: 256