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

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

typedef long long ll;
using namespace std;
int mod = 1000000007;

int penalty[50];
int wa[50][10];
bool valid[50][10];
int num_pr[50];

void init(){
    rep(i, 50){
        penalty[i] = 0;
        num_pr[i] = 0;
        rep(j, 10){
            wa[i][j] = 0;
            valid[i][j] = false;
        }
    }
}

int main(void){
    int T, P, R;
    while(true){
        init();
        cin >> T >> P >> R;
        if(T == 0) break;
        rep(i, R){
            int team, pr, tm; string msg;
            cin >> team >> pr >> tm >> msg;
            team--; pr--;
            if(msg == "CORRECT"){
                valid[team][pr] = true;
                num_pr[team]++;
                penalty[team] += tm;
            }
            else{
                wa[team][pr]++;
            }
        }

        //問題数(大がいい), ペナルティ(小がいい), チーム番号(小がいい)
        pair<int, pair<int, int>> res[T];
        rep(i, T){
            res[i].first = -num_pr[i];
            res[i].second.first = penalty[i];
            rep(j, P) res[i].second.first += 1200*wa[i][j]*valid[i][j];
            res[i].second.second = i+1;
        }
        sort(res, res+T);
        for(int i = 0; i < T; i++){
            cout << res[i].second.second << " " << -res[i].first << " " << res[i].second.first << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 3156
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
#define sz(x) int(x.size())
using ll = long long;
using P = pair<int,int>;
const ll LLINF = numeric_limits<long long>::max();
const int mod = 1000000007;
const int INF = 1001001001;

int main()
{
    int h1,m1,h2,m2,k;
    cin >> h1 >> m1 >> h2 >> m2 >> k;
    h1 *= 60;
    h2 *= 60;
    h1 += m1;
    h2 += m2;

    int ans = h2 - h1 - k;
    cout << max(0,ans);  

    return 0;
}

Measured memory_bytes: 3612
#include <algorithm>
#include <iostream>
#include <vector>
#include <iomanip>
using namespace std;
template <class T>
inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}

typedef long long ll;
ll MOD = 1000000007;

// a^p
// 2^3 = 2 * 2^2
// 2^2 = 2 * (2^1)
// 2^1 = 2
ll modpow(ll a, ll p, ll mod) {
  if (p == 0) return 1;

  if (p % 2 == 0) {
    ll half = modpow(a, p / 2, mod) % mod;
    return half * half % mod;
  } else {
    return a * modpow(a, p - 1, mod) % mod;
  }
}

// nCa を求める
ll modCombination(ll n, ll a, ll mod) {
  if (n - a < a) {
    return modCombination(n, n - a, mod);
  }

  ll denominator = 1;  // 分母
  ll numerator = 1;    // 分子

  for (ll i = 0; i < a; i++) {
    denominator *= a - i;
    numerator *= n - i;
    denominator %= mod;
    numerator %= mod;
  }

  return numerator * modpow(denominator, mod - 2, mod) % mod;
}

class UnionFind {
 private:
  vector<ll> parents;

 public:
  UnionFind(ll n) : parents(n, -1) {}

  bool issame(ll x, ll y) { return root(x) == root(y); }

  bool merge(ll x, ll y) {
    if (issame(x, y)) return false;

    ll rx = root(x);
    ll ry = root(y);
    if (parents[rx] > parents[ry]) swap(rx, ry);
    // サイズ情報を更新
    parents[rx] += parents[ry];
    // yの親を更新
    parents[ry] = rx;

    return true;
  }

  ll size(ll x) { return -parents[root(x)]; }

 private:
  ll root(ll x) {
    if (parents[x] < 0) return x;
    // 根の親の値に木の(-)サイズの情報を入れる
    return parents[x] = root(parents[x]);
  }
};

void dfs(const vector<vector<ll>> &G, vector<ll> &points, vector<bool> &seen,
         ll p) {
  seen[p] = true;
  for (auto g : G[p]) {
    if (seen[g] == false) {
      points[g] += points[p];
      dfs(G, points, seen, g);
    }
  }
}

int main() {
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);

  ll N, Q;
  cin >> N >> Q;

  vector<vector<ll>> G(N, vector<ll>());

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

  vector<ll> points(N, 0);
  vector<bool> seen(N, false);
  for (ll i = 0; i < Q; i++) {
    ll p, x;
    cin >> p >> x;
    p--;
    points[p] += x;
  }

  dfs(G, points, seen, 0);
  for (auto p : points) {
    cout << p << " ";
  }
  cout << endl;

  return 0;
}


Measured memory_bytes: 30592
t=[list(map(int, input().split())) for i in range(3)]

a=t[1][0]-t[0][0]
b=t[2][0]-t[1][0]
c=t[0][1]-t[0][0]
d=t[0][2]-t[0][1]

flag=0

if t[1][1]-t[0][1]!=a or t[1][2]-t[0][2]!=a:
    flag=1
elif t[2][1]-t[1][1]!=b or t[2][2]-t[1][2]!=b:
    flag=1
elif t[1][1]-t[1][0]!=c or t[2][1]-t[2][0]!=c:
    flag=1
elif t[1][2]-t[1][1]!=d or t[2][2]-t[2][1]!=d:
    flag=1

if flag==0:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
#!/usr/bin/python3
# -*- coding: utf-8 -*-

w, h, n = [int(i) for i in input().split()]
x1 = 0
x2 = w
y1 = 0
y2 = h
for i in range(n):
    xi, yi, ai = [int(i) for i in input().split()]
    if ai == 1:
        x1 = max(x1, xi)
    elif ai == 2:
        x2 = min(x2, xi)
    elif ai == 3:
        y1 = max(y1, yi)
    else:
        y2 = min(y2, yi)

if x2 > x1 and y2 > y1:
    s = (x2 - x1) * (y2 - y1)
else:
    s = 0
print(s)


Measured memory_bytes: 3064
val = input().split()
count = 0
a = int(val[0])
b = int(val[1])
c = int(val[2])
d = int(val[3])
r = int(val[4])

if a-c >= r:
    count += 1
if c >= r:
    count += 1
if d >= r:
    count += 1
if b-d >= r:
    count += 1
if count == 4:
    print("Yes")
if count < 4:
    print("No")


Measured memory_bytes: 5596
#include <iostream>
#include <vector>
#include <bitset>
using namespace std;

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

  int x, y;
  cin >> x >> y;

  vector<int> dx, dy;
  int runlength = 0;
  bool isx = true;

  for (char c : s) {
    if (c == 'F') {
      ++runlength;
      continue;
    }
    if (isx) {
      dx.push_back(runlength);
    } else {
      dy.push_back(runlength);
    }
    runlength = 0;
    isx = !isx;
  }

  if (isx) {
    dx.push_back(runlength);
  } else {
    dy.push_back(runlength);
  }

  const int geta = 8000;

  bitset<16010> dpx, dpy;
  dpx.set(dx[0] + geta);
  dpy.set(0 + geta);

  dx.erase(dx.begin());
  for (int d : dx) {
    dpx = (dpx << d) | (dpx >> d);
  }

  for (int d : dy) {
    dpy = (dpy << d) | (dpy >> d);
  }

  bool res = dpx[x + geta] && dpy[y + geta];

  cout << (res ? "Yes" : "No") << endl;

  return 0;
}


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

using namespace std;

int n, m;
int x;

int cnt = 0;
int ans = INT_MAX;

vector <int> c;
vector <vector<int> > a;

int mymin(int g, int h){
  return (g < h) ? g : h;
}

int main(){

  
  cin >> n >> m >> x;
  cin.ignore();

  int status = 1 << n;

  int tmp;
  for(int i = 0; i < n; i++){
    cin >> tmp;
    c.push_back(tmp);
    vector <int> tv;
    for(int j = 0; j < m; j++){
      cin >> tmp;
      tv.push_back(tmp);
    }
    a.push_back(tv);
    cin.ignore();
  }
  // 全探索
  int pnt[12] = {0};
  tmp = 0;
  bool pos = false;
  for (int i = 0; i < status; i++){
    for (int j = 0; j < 12; j++){
      pnt[j] = 0;
    }
    tmp = 0;
    for(int j = 0; j < n; j++){
      if((1 << j) & i){
        tmp += c[j];
        for(int k = 0; k < m; k++){
          pnt[k] += a[j][k];
        }
      }
    }

    bool flg = true;
    for(int j = 0; j < m; j++){
      if(pnt[j] < x){
        flg = false;
      }
    }
    if(flg){
      ans = mymin(ans, tmp);
      pos = true;
    }
  }
  if(pos == true){
    cout << ans << endl;
    return 0;
  }

  cout <<"-1" << endl;
  return 0;
}
  


Measured memory_bytes: 3640
//In the name of ALLAH
#include <bits/stdc++.h>
#define pb push_back
#define X first
#define Y second
const bool DEBUG = false;
#define cerr if(DEBUG)cerr
using namespace std;

typedef long double ld;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;

const long long maxn = 4015 + 1;
const long long INF = 1e18 + 1;
const long long M = 1e9 + 7;
const int lg = 21;

ll n, now, a[maxn], p[2 * maxn], dp[maxn][maxn], w[maxn][maxn], b[maxn][maxn];

int main(){
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	cin >> n;
	for(int i = 1; i <= 2 * n; i++){
		char c;
		cin >> c >> a[i];
		if(c == 'B')
			a[i] += n;
		p[a[i]] = i;
	}
	for(int i = 2 * n; i >= 1; i--){
		for(int j = 1; j <= n + 1; j++){
			w[j][i] = w[j][i + 1] + bool(a[i] <= n and a[i] < j);			
		}
	}
	for(int i = 2 * n; i >= 1; i--){
		for(int j = 1; j <= n + 1; j++){
			b[j][i] = b[j][i + 1] + bool(a[i] >= n + 1 and a[i] - n < j);
		}
	}
	for(int i = 1; i <= n; i++)
		dp[i][0] = dp[i - 1][0] + w[i][p[i]], dp[0][i] = dp[0][i - 1] + b[i][p[i + n]];
	for(int i = 1; i <= n; i++){
		for(int j = 1; j <= n; j++){
			dp[i][j] = min(dp[i - 1][j] + w[i][p[i]] + b[j + 1][p[i]], dp[i][j - 1] + b[j][p[j + n]] + w[i + 1][p[j + n]]);
		}
	}
	cout << dp[n][n] << endl;
	return 0;
}


Measured memory_bytes: 192768
#include<iostream>

using namespace std;

int main()
{
  int x;
  cin >> x;
  if(x<=599)
    cout << 8 << endl;
  else if(x>=600 && x<=799)
    cout << 7 << endl;
  else if(x>=800 && x<=999)
    cout << 6 << endl;
  else if(x>=1000 && x<=1199)
    cout << 5 << endl;
  else if(x>=1200 && x<=1399)
    cout << 4 << endl;
  else if(x>=1400 && x<=1599)
    cout << 3 << endl;
  else if(x>=1600 && x<=1799)
    cout << 2 << endl;
  else if(x>=1800 && x<=1999)
    cout << 1 << endl;
  return 0;
}

Measured memory_bytes: 3620
using System;
using System.Linq;
using System.Collections.Generic;
using System.Numerics;

using E = System.Linq.Enumerable;

public class Program
{
    public static void Main()
    {
        var n = long.Parse(Console.ReadLine());

        var sum = BigInteger.Zero;
        for (int k = 1; k <= n; ++k)
        checked
        {
            var t = n / k;
            var s = t * (t + 1) / 2;
            sum += k * s;
        }

        Console.WriteLine(sum);
    }
}


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

#define pb push_back
#define mp make_pair

#define all(x) (x).begin(), (x).end()

#define fi first
#define se second

typedef long long ll;

using namespace std;

char s1[55][105];

char s2[55][105];

int a, b;

void solve() {
    scanf("%d %d", &a, &b);

    for (int i = 0; i < 50; ++i) {
        for (int j = 0; j < 100; ++j) {
            s1[i][j] = '.';
            s2[i][j] = '#';
        }
    }

    --a, --b;

    for (int i = 1; i < 49; i += 2) {
        for (int j = 1; j < 99; j += 2) {
            if (a > 0) {
                s2[i][j] = '.';
                --a;
            }

            if (b > 0) {
                s1[i][j] = '#';
                --b;
            }
        }
    }

    printf("100 100\n");

    for (int i = 0; i < 50; ++i) {
        printf("%s\n", s1[i]);
    }

    for (int i = 0; i < 50; ++i) {
        printf("%s\n", s2[i]);
    }
}

int main() {
    #ifdef BThero
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif // BThero

    int tt = 1;

    while (tt--) {
        solve();
    }

    return 0;
}

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

typedef long long ll;
typedef pair<int,int> P;
int dx[] = {-1, 1, 0,  0};
int dy[] = { 0, 0, 1, -1};

 
int main(){
  int a, b;
  cin >> a >> b;
  int ans;
  if(a==b) ans = 2*a;
  else ans = max(a,b) * 2-1;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3492
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<map>
#include <algorithm>
#include<cstdlib>
#include<cmath>
#include<deque>
#include <numeric>
#include<valarray>
typedef unsigned long long ull;
typedef  long long ll;

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


	std::vector<ll> AX;
	AX.resize(N + 1);

	ll answer = 0;


	for (int i = 0; i < N+1; i++)
	{
		std::cin >> AX[i];
	}

	for (int i = 0; i < N ; i++)
	{
		ll BX;
		std::cin >> BX;

		if (BX <= AX[i])
		{
			answer += BX;
		}
		else
		{
			answer += AX[i];
			ll rBX = BX - AX[i];

			if (rBX <= AX[i+1])
			{
				answer += rBX;
				AX[i + 1] -= rBX;
			}
			else
			{
				answer += AX[i+1];
				AX[i + 1] = 0;
			}
		}
	}

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

Measured memory_bytes: 1024
import java.io.PrintWriter

fun main(args: Array<String>) {
    PrintWriter(System.out).use { out ->
        solve(out)
        out.flush()
    }
}

fun solve(out: PrintWriter) {
    val (n, k) = readLongList()
    val tmp = n % k
    val ans = Math.min(n, Math.min(tmp, Math.abs(tmp - k)))
    println(ans)
}

fun readInteger() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readStringList() = readLine()!!.split(" ")
fun readIntegerList() = readStringList().map(String::toInt)
fun readLongList() = readStringList().map(String::toLong)
fun readDoubleList() = readStringList().map(String::toDouble)


Measured memory_bytes: 36068
#include <stdio.h>

int main(void) {
    int n, k;
    long count;
    int q;

    scanf("%d%d", &n, &k);

    q = n / k;
    count = (long)q * q * q;
    if (k % 2 == 0) {
        if (n % k >= k / 2) {
            count += (long)(q + 1) * (q + 1) * (q + 1);
        }
        else {
            count *= 2;
        }
    }

    printf("%ld\n", count);

    return 0;
}


Measured memory_bytes: 128
#include <stdio.h>
#include <math.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <numeric>
#include <string>
#include <map>
#include <bitset>
#include <stack>
#include <atcoder/scc>
//#include <bits/stdc++.h>
using namespace std;
typedef long long int lli;
using namespace atcoder;
#define urept(soeji, start, n) for (int soeji = start; soeji < n; soeji++)
#define drept(soeji, start, n) for (int soeji = start; soeji > n; soeji--)

template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return true;
    }
    return false;
}
template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return true;
    }
}

lli gcd2(lli x, lli y)
{
    lli t;
    while (y != 0)
        t = x % y, x = y, y = t;
    return (x);
}

lli lcm2(lli x, lli y)
{
    lli xy = x * y;
    if (xy < 0)
        xy = -xy;
    return (xy / gcd2(x, y));
}

int main(void)
{
    int N, M;
    cin >> N >> M;
    scc_graph graph(N);

    for (int i = 0; i < M; i++)
    {
        int a, b;
        cin >> a >> b;
        graph.add_edge(a, b);
    }
    auto x = graph.scc();
    cout << x.size() << endl;
    for (auto i : x)
    {
        cout << (int)(i.size());
        for (int j = 0; j < i.size(); j++)
        {
            cout << " " << (int)i[j];
        }
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 40100
inp = input()
count = 0
index = 0
for i in range(len(inp[2:-1])):
  if inp[2:-1][i] == "C":
      count += 1
      index = i
if inp[0] == "A" and count == 1 and (inp[1:2+index]+inp[3+index:]).islower():
  print("AC")
else: 
  print("WA")

Measured memory_bytes: 3064
#! env python
# -*- coding: utf-8 -*-

import os
import sys


# ac_py.main
# Date: 2020/06/08
# Filename: main 
# Author: acto_mini

def main():
    A = int(input())
    B = int(input())
    C = int(input())
    X = int(input())

    result = 0

    for i in range(A + 1):
        for j in range(B + 1):
            for k in range(C + 1):
                if (500 * i + 100 * j + 50 * k) == X:
                    result += 1
    print(result)
    return


if __name__ == '__main__':
    main()


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

int main(){
    ll n, k; cin >> n >> k;
    vector<pair<ll,ll>> a(n);
    rep(i,n){
        ll in1, in2;
        cin >> in1 >> in2;
        a[i] = make_pair(in1,in2);
    }

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

    for(long long i = 0; i < n; i++){
        k -= a[i].second;
        if(k <= 0){
            put(a[i].first);
            return 0;
        }
    }
}

Measured memory_bytes: 4824
N = int(input())
P = list(map(int, input().split()))

origin_p = P[:]
sorted_p = sorted(P[:])

#print(origin_p)
#print(sorted_p)

counter = 0
for a, b in zip(origin_p, sorted_p):
    if a == b:
        continue
    else:
        counter += 1
        
if counter <= 2:
    print('YES')
else:
    print('NO')

Measured memory_bytes: 3060
import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, core.stdc.string;

void main() {
    auto N = readln.chomp.to!int;
    auto AB = N.iota.map!(_ => readln.split.map!(to!long).array).array;
    AB.sort!((a,b) => a[0] + a[1] > b[0] + b[1]);

    long ans1 = 0;
    long ans2 = 0;

    foreach (i; 0..N) {
        if (i % 2 == 0) {
            ans1 += AB[i][0];
        } else {
            ans2 += AB[i][1];
        }
    }

    writeln(ans1 - ans2);
}


Measured memory_bytes: 12284
import math
n = int(input())
x = list(map(int,input().split()))
y = list(map(int,input().split()))
d=0
for i in range(n):
  d += max(x[i],y[i])-min(x[i],y[i])
print(float(d))

d=0
for i in range(n):
  d+=(x[i]-y[i])**2
print(math.sqrt(d))

d=0
for i in range(n):
  d+=(max(x[i],y[i])-min(x[i],y[i]))**3
print(math.pow(d,1/3))

d=[]
for i in range(n):
  d.append(max(x[i],y[i])-min(x[i],y[i]))
print(float(max(d)))


Measured memory_bytes: 5704
#include <stdio.h>

int n;
char id[100004];
int m;
char kouho[10];
int starNum;
int starPos[10];
char starMozi[10];

int getNonStarCheckSum(void) {
	int checkSum=0;
	int i;
	for(i=0;id[i];i++) {
		if(id[i]!='*') {
			int now=id[i]-'0';
			if((n-i)%2==0) {
				now*=2;
				if(now>=10)now=(now/10)+(now%10);
			}
			checkSum+=now;
		}
	}
	return checkSum;
}

int getStarCheckSum(void) {
	int checkSum=0;
	int i;
	for(i=0;i<starNum;i++) {
		int now=starMozi[i]-'0';
		if((n-starPos[i])%2==0) {
			now*=2;
			if(now>=10)now=(now/10)+(now%10);
		}
		checkSum+=now;
	}
	return checkSum;
}

int main(void) {
	int i;
	int nsc;
	int sc;
	int tansaku,tansakumax;
	int count;
	scanf("%d",&n);
	scanf("%s",id);
	scanf("%d",&m);
	for(i=0;i<m;i++) {
		char buf[4];
		scanf("%s",buf);
		kouho[i]=buf[0];
	}
	for(i=0;id[i];i++) {
		if(id[i]=='*')starPos[starNum++]=i;
	}
	nsc=getNonStarCheckSum();
	tansakumax=1;
	count=0;
	for(i=0;i<starNum;i++)tansakumax*=m;
	for(tansaku=0;tansaku<tansakumax;tansaku++) {
		int tansakubuf=tansaku;
		for(i=0;i<starNum;i++) {
			starMozi[i]=kouho[tansakubuf%m];
			tansakubuf/=m;
		}
		if((nsc+getStarCheckSum())%10==0)count++;
	}
	printf("%d\n",count);
	return 0;
}

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

using ll = long long int;

const int MAX_N = (int)(1e5 + 5);

int n;
ll m;
ll a[MAX_N];

ll acc_a[MAX_N];

unordered_map<ll, ll> mp;

ll ans;

int main(void) {
  // Here your code !
  scanf("%d %lld", &n, &m);
  for (int i = 1; i <= n; ++i) {
    scanf("%lld", &(a[i]));
  }

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

  ll whole = 0;
  for (int i = 0; i <= n; ++i) {
    // cout << i << ":" << (acc_a[i]) << "_" << (acc_a[i] % m) << endl;
    whole += ((acc_a[i] % m) == 0) ? 1 : 0;
    mp[(acc_a[i] % m)] += 1;
  }

  // cout << whole << endl;

  /*
  for (auto e: mp) {
    cout << e.first << "_" << e.second << endl;
  }
  */

  unordered_map<ll, ll> cur_mp;
  for (int i = 1; i <= n; ++i) {
    ll target = (acc_a[i] % m);

    cur_mp[target] += 1;

    ans += mp[target] - cur_mp[target];
  }

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

  /*
  ll tmp = 0;
  for (int i = 1; i <= n; ++i) for (int j = 1; j <= n; ++j) {
    if (i > j) continue;
    ll sum = acc_a[j] - acc_a[i - 1];

    if (sum % m == 0) {
      cout << i << "_" << j << endl;
    }
  }
  */

  return 0;
}


Measured memory_bytes: 8228
#include <bits/stdc++.h>
#define endl '\n';

typedef long long ll;

using namespace std;

const string YES = "";
const string NO  = "";

int gcd(int x, int y);

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

    int n;

    cin >> n;

    cout << 2 * n / gcd(n, 2) << endl;

    return 0;
}

int gcd(int x, int y)
{
    if (x % y == 0) {
        return y;
    } else {
        return gcd(y, x % y);
    }
}



Measured memory_bytes: 256
K = int(input())
N = 50
num = [i for i in range(N)]
for i in range(N):
    num[i] += K//N
r = K%N
for i in range(r):
    num[i] += N
    for j in range(N):
        if j != i:
            num[j] -= 1
print(N)
print(*num)


Measured memory_bytes: 38512
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int n,k,x,y;
  cin>>n>>k>>x>>y;
  int sum=0;
  if (n>k){
    sum = k*x +(n-k)*y;
  }
  else{
    sum =n*x;
  }
  cout<<sum<<endl;
}

Measured memory_bytes: 256
import java.io.*;
import java.util.*;

class Main {

	private static long gcd(long a, long b) {
		if (b == 0) return a;
		return gcd(b, a % b);
	}

	private static long lcm(long a, long b) {
		return a / gcd(a, b) * b;
	}

	public static void main(String[] args) throws Exception {
		final Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		long[] T = new long[N];
		for (int i = 0; i < N; i++) {
			T[i] = sc.nextLong();
		}

		long answer = 1;
		for (int i = 0; i < N; i++) {
			answer = lcm(answer, T[i]);
		}

		System.out.println(answer);
	}
}


Measured memory_bytes: 21972
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <utility>
#include <set>
#include <stack>
#include <climits>
#include <cmath>

#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define rep1(i,n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
#define reps(i,s,n) for(int i=s, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define MEMSET(v, h) memset((v), h, sizeof(v))
typedef long long ll;
const char sp = ' ';


using namespace std;

int possoS[4000];
int possoW[4000];

int main(void){
    ll A, B , C, D, E, F;
    cin>>A>>B>>C>>D>>E>>F;
    
    MEMSET(possoS, 0);
    rep(i, 3001){
        rep(j, 1501){
            if(i*C+j*D>F) break;
            else possoS[i*C+j*D]=1;
        }
    }
    rep(i, 3001){
        rep(j, 1501){
            if(i*A*100+j*B*100>F) break;
            else possoW[i*A*100+j*B*100]=1;
        }
    }
    ll ansS=0, ansW=100*A;
    rep(W, 3001){
        if(possoW[W]==0) continue;
        if(W==0) continue;
        ll Limit=min(F-W, W/100*E);
        //cout<<Limit<<sp;
        rep(S, Limit+1){
            if(possoS[S]==1) if(ansS*(S+W)<S*(ansW+ansS)){
                ansW=W;
                ansS=S;
            }
        }
    }
    cout<<ansW+ansS<<sp<<ansS<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(){
	int a;
	int b;
	int c;
	int d;
	int e;
	int k;
	int z[5];
	int f=0;
	int g=0;
	
	scanf("%d",&a);
	scanf("%d",&b);
	scanf("%d",&c);
	scanf("%d",&d);
	scanf("%d",&e);
	scanf("%d",&k);
	
	z[0]=a;
	z[1]=b;
	z[2]=c;
	z[3]=d;
	z[4]=e;
	
	 for(int i=0;i<5;i++){
		 for(int j=i+1;j<5;j++){
			  f=z[j]-z[i];
			      if(f>k){
			  	  printf(":(");
			  	  return 0;
			  }else{};
		}
	}
	
	printf("Yay!");
	return 0;
	
}

Measured memory_bytes: 128
size = STDIN.gets.to_i
matrix = (0...size).inject([]) do |result|
	result << STDIN.gets.split[0...size].map { |v| v == "-1" ? nil : v.to_i}
end

# プリムのアルゴリズム
MAX_WEIGHT = 2001
visited   = Array.new(size, false)
parent    = Array.new(size)
min_edges = Array.new(size, MAX_WEIGHT)
loop do
	min_edge = MAX_WEIGHT + 1
	vertex   = -1
	
	# 未訪問で最小の辺を捜す
	size.times do |i|
		if !visited[i] && min_edge > min_edges[i]
			vertex   = i
			min_edge = min_edges[i]
		end
	end
	break if vertex == -1

	visited[vertex] = true
	size.times do |i|
		# 訪問済み or 辺なしは対象外
		if visited[i] || matrix[vertex][i].nil?
			next
		end
		if min_edges[i] > matrix[vertex][i]
			min_edges[i] = matrix[vertex][i]
			parent[i] = vertex
		end
	end
end

puts parent.each_index.
	select { |i| !parent[i].nil? }.
	inject(0) { |r, i| r += matrix[i][parent[i]] }

Measured memory_bytes: 6132
import java.util.Scanner;

class Main {
    public static void main(String [] args){
         
        Scanner sc = new Scanner(System.in);
        
        int n = sc.nextInt();//????????° & ???????????°
        
        int tarou = 0;
        int hanako = 0;
        
        //String[] ba = new String[2];
       
        for( int i = 0 ; i < n ; i++ ){
        	
        	/*String tehuda = sc.nextLine();//?????????????????????????????±????????????????????????cat dog
        	
        	String[] ba = tehuda.split(" ");//????????§??????????????????????????????????´?
        	
        	if( ba[0].compareToIgnoreCase(ba[1]) > 0 ) {
        		tarou = tarou + 3;
        	}else if( ba[0].compareToIgnoreCase(ba[1]) < 0 ){
        		hanako = hanako + 3;
        	}else if( ba[0].compareToIgnoreCase(ba[1]) == 0 ){
        		tarou++;
        		hanako++;
        	}*/
        	
        	String[] ba = new String[2];
        	
        	for(int j = 0 ; j < 2 ; j++){
        		ba[j] = sc.next();
        	}
        	
        	if( ba[0].compareToIgnoreCase(ba[1]) > 0 ) {
        		tarou = tarou + 3;
        	}else if( ba[0].compareToIgnoreCase(ba[1]) < 0 ){
        		hanako = hanako + 3;
        	}else if( ba[0].compareToIgnoreCase(ba[1]) == 0 ){
        		tarou++;
        		hanako++;
        	}
        	
        }
        
        System.out.println(tarou + " " + hanako);
        
    }
}

Measured memory_bytes: 29724
fn main() {
    let mut buf = String::new();
    let handle = std::io::stdin();
    let info: Vec<isize> = {
        handle.read_line(&mut buf).unwrap();
        let tmp = buf.trim().split_whitespace().map(|a| a.parse().unwrap()).collect();
        buf.clear();
        tmp
    };
    println!("{}", info[0] * info[1] / 2);
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define REP(i,n,N) for(int i=n;i<N;i++)
#define p(S) cout<<S<<endl
using namespace std;


int main(){
	int N;
	while(cin>>N,N){
		set<int> know[101];
		vector<int> ans,rouei;
		bool flag=false;
		int a,M,K;
		REP(i,1,N+1){
			cin>>M;
			REP(j,0,M){
				cin>>a;
				know[i].insert(a);
			}
		}
		cin>>K;
		REP(i,0,K){
			cin>>a;
			rouei.push_back(a);
		}

		REP(i,1,N+1){
			flag=false;
			for(unsigned int j=0;j<rouei.size();j++){
				if(know[i].find(rouei[j])==know[i].end()){
					flag=true;
					break;
				}
			}
			if(!flag){
				ans.push_back(i);
			}
		}
		if(ans.size()==1){
			p(ans[0]);
		}else{
			p("-1");
		}
	}
	return 0;
}

Measured memory_bytes: 3496
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>
#include <bitset>
#include <time.h>
#include <tuple>
#include <iomanip>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = 1e12;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,N) for(int i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE (1LL << 20)
#define NIL -1

ll sq(ll num) { return num*num; }
ll mod_pow(ll x, ll n) {
	if (n == 0)return 1;
	if (n == 1)return x%MOD;
	ll res = sq(mod_pow(x, n / 2));
	res %= MOD;
	if (n % 2 == 1) {
		res *= x;
		res %= MOD;
	}
	return res;
}
ll mod_add(ll a, ll b) { return (a + b) % MOD; }
ll mod_sub(ll a, ll b) { return (a - b + MOD) % MOD; }
ll mod_mul(ll a, ll b) { return a*b % MOD; }

int n;

int main() {
	cin >> n;
	int tt = 0;
	int xx = 0, yy = 0;
	bool f = 1;
	rep(i, n) {
		int t, x, y;
		cin >> t >> x >> y;
		if (abs(x - xx) + abs(y - yy) > t - tt) {
			f = 0;
		}
		else if (abs(x + y) % 2 != t % 2) {
			f = 0;
		}
		tt = t;
		xx = x;
		yy = y;
	}
	if (!f) {
		cout << "No" << endl;
		return 0;
	}
	cout << "Yes" << endl;
}

Measured memory_bytes: 256
from operator import itemgetter

n, m = map(int, input().split())
ab = sorted([list(map(int, input().split())) for i in range(m)], key=itemgetter(1))
removed = -1
ans = 0
for a, b in ab:
    if a > removed:
        removed = b - 1
        ans += 1
print(ans)

Measured memory_bytes: 29920
n, m = map(int, input().split())
ans = ['-1'] * n

for _ in range(m):
    i, kk = input().split()
    i = int(i)
    if ans[i-1] == '-1' or ans[i-1] == kk:
        ans[i-1] = kk
    else:
        print(-1)
        exit()

if n == 1 and m == 0:
    print(0)
elif n != 1 and ans[0] == '0':
    print(-1)
else:
    ans[0] = '1' if ans[0] == '-1' else ans[0]
    for i in range(len(ans)):
        ans[i] = '0' if ans[i] == '-1' else ans[i]
    print(''.join(ans))

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

using namespace std; 
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>; 

#define INF INT_MAX;
#define MOD 1000000007
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()

int main(){
  int N;
  cin>>N;
  vector<string>s(N);
  for(int i=0;i<N;i++)cin>>s[i];
  int a=0,b=0,ab=0;
  ll ans=0;
  for(int i=0;i<N;i++){
    for(int j=0;j<s[i].size()-2;j++){
      if(s[i][j]=='A'&&s[i][j+1]=='B')ans++;
    }
  }
  for(int i=0;i<N;i++){
    string S=s[i];
    if(S[S.size()-1]=='A'&&S[0]=='B')ab++;
    else if(S[S.size()-1]=='A')a++;
    else if(S[0]=='B')b++;
  }
  if(a==0&&b==0)ans+=max(ab-1,0);
  else ans+=max(ab,0);
  int c=min(a,b);
  ans+=c;
  a-=c;
  b-=c;
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 768
#include <iostream>
#include <cstring>
using namespace std;
int main(){
  char s[12];
  int ans=0, res=0;
  cin >> s;
  for(int i=0; i<strlen(s); i++){
    if(s[i]=='A'||s[i]=='C'||s[i]=='G'||s[i]=='T')
      res++;
    else
      res=0;
    if(res>ans)
      ans=res;
  }
  cout << ans;
    
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  char c;
  cin >> c;
  if(c=='a' || c=='i' || c=='u' || c=='e' || c=='o'){
    cout << "vowel" << endl;
  }
  else{
    cout << "consonant" << endl;
  }
}

Measured memory_bytes: 256
//#include "debug.h"
#include <string.h>
#include <limits.h>
#include <map>
#include <set>
#include <vector>
#include <algorithm>
using namespace std;

#define MAXN 200000

int n;
int a[MAXN];

int input() {
	if (scanf("%d", &n) < 0) return 0;
	for (int i=0; i<n; i++) scanf("%d", &a[i]);
	return 1;
}

void init() {
}

int solve() {
	sort(a, a+n);
	int m = a[n-1], z = 0, t = 0;
	for (int i=0; i<n; i++) {
		int x = a[i];
		if (x > m-x) x = m-x;
		if (x > z) z = x, t = i;
	}
	printf("%d %d\n", m, a[t]);
	return 1;
}

void output(int ans) {
}

void cleanup() {
}

int main() {
	//int ca; scanf("%d", &ca);
	while (input()) {
		init();
		output(solve());
		cleanup();
		break;
	}
}




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

int main() {
	long n,m,i,j,k,ans,cur,res;
	string s,t;
	cin >> s >> t;
	t.pop_back();
	if(s==t){
		cout << "Yes\n";
	}else{
		cout << "No\n";
	}
	return 0;
}

Measured memory_bytes: 3596
n = int(input())
s = input()

sum = 0
box = []
for i in range(n-2):
    if s[i] not in box:
        box.append(s[i])
    elif len(box) == 10:
        break
    else:
        continue
    box_1 = []
    for j in range(i+1, n-1):
        if s[j] not in box_1:
            box_1.append(s[j])
        elif len(box_1) == 10:
            break
        else:
            continue
        box_2 = []
        for k in range(j+1, n):
            if s[k] not in box_2:
                box_2.append(s[k])
            elif len(box_2) == 10:
                break
            else:
                continue
        sum += len(box_2)

print(sum)

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

int main(){
	int h,w;
	int cnt=0;
	bool flag=true;
	cin>>h>>w;
	char s[h][w];
	rep(i,h)rep(j,w)cin>>s[i][j];

	/*rep(i,h){
		rep(j,w){
			cout<<s[h][w];
		}cout<<endl;
	}*/

	rep(i,h){
		rep(j,w){
			if(s[i][j]=='#'){
				if(s[i-1][j]=='.'&&s[i+1][j]=='.'&&s[i][j-1]=='.'&&s[i][j+1]=='.'){
					flag = false;
					//cout<<i<<j<<endl;
				}else{
					//cout<<i<<j<<endl;
				}
			}
		}
	}
	if(flag){
		cout<<"Yes"<<endl;
	}else{
		cout<<"No"<<endl;
	}

}


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

long long gcd(long x, long y)
{    if (y == 0)
        return x;
    return gcd(y, x % y);}
long long lcm(long x, long y){ return x * y / gcd(x, y);}

int ctoi(char c)
{
    if (c >= '0' && c <= '9')
    {
        return c - '0';
    }
    return 0;
}


int main()
{
    int N,A[100010]={},sum[100010]={};
    cin>>N;

    for(int i=0;i<N;i++){
        cin>>A[i];

        if(A!=0)sum[A[i]-1]++;
        sum[A[i]]++;
        sum[A[i]+1]++;

    }

    int ans=0;

    for(int i=0;i<=100001;i++){
        ans=max(ans,sum[i]);
    }

    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 1024
from functools import reduce
import math

def main():
    # 文字列の2進数を数値にする
    # '101' → '5'
    # 文字列の頭に'0b'をつけてint()にわたす
    # binary = int('0b'+'101',0)

    # 2進数で立っているbitを数える
    # 101(0x5) → 2
    # cnt_bit = bin(5).count('1')
    
    # N! を求める
    # f = math.factorial(N)
    
    # 切り捨て
    # 4 // 3
    # 切り上げ
    #-(-4 // 3)
    
    # 初期値用:十分大きい数(100億)
    INF = float("inf")
    
    # 1文字のみを読み込み
    # 入力:2
    # a = input().rstrip()
    # 変数:a='2'
    
    # スペース区切りで標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a, b, c, d = (int(_) for _ in input().split())  
    # 変数:a=2 b=4 c=5 d =7
    
    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a = list(int(_) for _ in input().split())
    # 変数:a = [2, 4, 5, 7]    

    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2457
    # a = list(int(_) for _ in input())
    # 変数:a = [2, 4, 5, 7]    
    N = int(input().rstrip())
    s = []
    for i in range(N):
        s.append(int(input().rstrip()))
    s.sort()
    ans = 0
    
    if sum(s) % 10 != 0:
        ans = sum(s)
        print(ans)
        exit()
    for i in range(N):
        if(s[i]%10 !=0 ):
            ans = sum(s) - s[i]
            break
    # dp = []
    # for i in range(N):
    #     dp.append([-1]*(100*100))
    # dp[0][s[0]] = 1
    # for i in range(1,N):
    #     for j in range(100*100):
    #         if(j == s[i] or (j-s[i]>=0 and dp[i-1][j-s[i]]==1)):
    #             dp[i][j] = 1
    #         else:
    #             dp[i][j] = dp[i-1][j]
    # ans = 0
    # for i in range(100*100-1,0,-1):
    #     if(i%10 != 0 and dp[N-1][i]==1):
    #         ans = i
    #         break
    print(ans)
if __name__ == '__main__':
    main()


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

int main() {
  int h, n;
  vector<int> a;
  cin >> h >> n;
  while (cin >> n) a.push_back(n);
  sort(a.begin(), a.end());
  reverse(a.begin(), a.end());
  int i = 0;
  while ((i < a.size()) && (h > 0)) {
    h -= a[i];
    i++;
  }
  cout << (h <= 0 ? "Yes" : "No") << '\n';
  return 0;}


Measured memory_bytes: 892
#include <iostream>

using namespace std;

int main(){
  int n;
  while(cin >> n){
    int a = 0, b = 0, c = 0, d = 0, m = 0;
    for(int i = 0; i < 10; i++){
      for(int j = 0; j < 10; j++){
	for(int k = 0; k < 10; k++){
	  for(int l = 0; l < 10; l++){
	    if(i+j+k+l == n) m++;
	  }
	}
      }
    }
    cout << m << endl;
  }
  return 0;
}

Measured memory_bytes: 1160
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>

using namespace std;

int main() {
	int N, K; cin >> K >> N;
	vector<int> CW(N);
	for (int i = 0; i < N; i++) {
		int temp; cin >> temp;
		CW[i] = temp;
	}

	int ans = CW[N-1]-CW[0];
	ans = min(ans, K - (CW[1] - CW[0]));
	for (int i = 1; i < N; i++) {
		ans = min(ans, K - (CW[i] - CW[i - 1]));
		ans = min(ans, K - ((i == N - 1 ? CW[0] : CW[i + 1]) - CW[i]));
	}

	cout << ans << endl;
}

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

bool isOneColor(const string &s) {
  for(int i = 1; i < s.size(); ++i)
    if(s[0] != s[i]) return false;
  return true;
}

int bfs(string src) {
  if(isOneColor(src)) return 0;
  const static string color = "rgb";
  map<string,int> cost;
  queue<string> que;
  cost[src] = 0;
  que.push(src);
  while(que.size()) {
    const string s = que.front();
    que.pop();
    for(int i = 0; i+1 < s.size(); ++i) {
      if(s[i] == s[i+1]) continue;
      string t = s;
      for(int j = 0; j < color.size(); ++j) {
        if(t[i] != color[j] && t[i+1] != color[j]) {
          t[i] = t[i+1] = color[j];
          break;
        }
      }
      if(cost.count(t)) continue;
      cost[t] = cost[s] + 1;
      que.push(t);
      if(isOneColor(t)) return cost[t];
    }
  }
  return -1;
}

int main() {
  string s;
  while(cin >> s && s != "0") {
    int res = bfs(s);
    if(res == -1) cout << "NA" << endl;
    else cout << res << endl;
  }
  return 0;
}

Measured memory_bytes: 2652
while True:
    (a, op, b) = [int(i) if i.isdigit() else i for i in input().split()]

    if op == '?':
        break
    elif op == '+':
        print(a + b)
    elif op == '-':
        print(a - b)
    elif op == '*':
        print(a * b)
    elif op == '/':
        print(a // b)

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

int main() {
  string a,b;cin>>a>>b;
  int x=a.size(),y=b.size();
  if(x>y)cout<<"GREATER"<<endl;
  else if(x<y)cout<<"LESS"<<endl;
  else {
    rep(i,x){
      if(a[i]<b[i]){
        cout<<"LESS"<<endl;
        return 0;
      }
      else if(a[i]>b[i]){
        cout<<"GREATER"<<endl;
        return 0;
      }
    }
    cout<<"EQUAL"<<endl;
  }
}

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

int main()
{
  string s,t;
  cin>>s>>t;
  if( s == t.substr(0,t.size()-1) && s.size() +1 == t.size()){
  	cout<<"Yes"<<endl;
  }else{
  	cout<<"No"<<endl;
  }
  
return 0;
}



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

#define Int long long int
#define REP(i,n) for(int i=0;i<(n);i++)
#define REAP(i,a,n) for(int i=(a);i<(n);i++)
#define YES cout<<"Yes"<<endl
#define NO cout<<"No"<<endl
#define fr first
#define sc second
#define pb push_back
#define All(v) v.begin(),v.end()

int main(){
    string s;
    cin >> s;
    sort(All(s));
    if(s=="abc")YES;
    else NO;
}


Measured memory_bytes: 256
//g++  5.4.0

#include <bits/stdc++.h>

using namespace std;

char arr[1001][1001];

const int mod = 1e9+7;

int main()
{
    int H,W; cin >> H >> W;
    
    for(int i =1; i <= H; i++){
        for(int j = 1; j <= W; j++)
            cin >> arr[i][j];
    }
    
    vector<vector<long long> > dp(H+1, vector<long long>(W+1,0));
    
    int j = 1;
    while(j <= W && arr[1][j] != '#') dp[1][j] = 1, j++;
    int i = 1;
    while(i <= H && arr[i][1] != '#') dp[i][1] = 1, i++;
    
    for(int i = 2; i <= H; i++){
        for(int j = 2; j <= W; j++){
             if(arr[i][j] == '.'){
                    dp[i][j] = (dp[i-1][j] + dp[i][j-1])%mod;
                }
        }
    }
    
    /*for(int i =1; i <= H; i++){
        for(int j =1; j <= W; j++) cout << dp[i][j] << " ";
        cout << endl;
    }*/
    
    cout << dp[H][W]<< endl;
    
}

Measured memory_bytes: 9088
#include<iostream>
using namespace std;
int main(){
	int a=0;
	int b=0;
	int s[10];
	int i=0;
	for(i=0;i<7;i++){
		cin>>a>>b;
		s[i]=a-b;
	}
	for(i=0;i<7;i++){
		cout<<s[i]<<endl;
	}
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define all(v) v.begin(),v.end()

using namespace std;
typedef long long ll;




int main()
{
    
    int N,A,B,C,D;
    string S;
    cin >> N >> A >> B >> C >> D >> S;
    
    if( B < C && C < D){
        int r = 0;
        int rr = 0;
        for (int i = A; i <= D; i++) {
            
            if(S[i-1] == '.'){
                r = max(r,rr);
                rr = 0;
                
            }else{
                rr++;
                if(i == D) r = max(r,rr);
            }
        }
        
        if(r < 2) cout << "Yes" << endl;
        else cout << "No" << endl;
        
    }else if(C < B){
        
        int r = 0;
        int rr = 0;
        for (int i = A; i <= C; i++) {
            
            if(S[i-1] == '.'){
                r = max(r,rr);
                rr = 0;
                
            }else{
                rr++;
                if(i == C) r = max(r,rr);
            }
        }
        
        if(r > 1){
            cout << "No" << endl;
            return 0;
        }
        
        r = 0;
        rr = 0;
        for (int i = B; i <= D; i++) {
            
            if(S[i-1] == '.'){
                r = max(r,rr);
                rr = 0;
                
            }else{
                rr++;
                if(i == D) r = max(r,rr);
            }
        }
        if(r < 2) cout << "Yes" << endl;
        else cout << "No" << endl;
        
        
    }else if(D < C){
        
        int r = 0;
        int rr = 0;
        for (int i = A; i <= C; i++) {
            
            if(S[i-1] == '.'){
                r = max(r,rr);
                rr = 0;
                
            }else{
                rr++;
                if(i == C) r = max(r,rr);
            }
        }
        
        if(r > 1){
            cout << "No" << endl;
            return 0;
        }
        
        int jj = 0;
        int j = 0;
        
        for (int i = B-1; i <= D+1; i++) {
            
            if(S[i-1] == '.'){
                jj++;

                if(i == D+1){
                    if(i >= B-1 && i <= D+1) j = max(j,jj);
                }
            }else{
                if(i >= B-1 && i <= D+1) j = max(j,jj);
                jj=0;
            }
            
        }
        if(j >= 3) cout << "Yes" << endl;
        else cout << "No" << endl;
        
        
        
    }
    
    
    return 0;
}



Measured memory_bytes: 640
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#define ft first
#define sd second
#define get(t, x) get<x>(t)
#define pb push_back
#define len length
#define dbgn(x) cerr << #x << ": " << x << '\n'
#define dbg(x) cerr << #x << ": " << x << ' '

using namespace std;
using namespace __gnu_pbds;

using lli = long long int;
using pli = pair<lli, int>;
using pii = pair<int, int>;
using mii = map<int, int>;
using ti3 = tuple<int, int, int>;
using pqpi_min = priority_queue<pii, vector<pii>, greater<pii>>;
using ost = tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>;

template<class T>
void print(T* a, int sz) {for(int i=0;i<sz;++i) cerr<<a[i]<<' ';cerr<<endl;}
istream &operator>>(istream &is, pii &p) {is >> p.ft >> p.sd;return is;}
ostream &operator<<(ostream &os, const pii &p) {os << "[" << p.ft << ", " << p.sd << ']'; return os;}
//int+string
//cin.ignore();

constexpr int MAX = 1100000;
constexpr int M = 1e9 + 7;
constexpr double PI = 3.14159265358979323846;

void solve()
{      
    int n,a,b;
    cin>>n>>a>>b;
    if ((b-a-1)%2 != 0) cout << "Alice";
    else cout << "Borys";
}

int main(int argc, char const *argv[])
{
    ios::sync_with_stdio(false);
    solve();
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>

using namespace std;

#define rep(i,n) for(int i=0; i<(n); i++)
#define repc(i,s,e) for(int i=(s); i<(e); i++)
#define pb(n) push_back((n))
#define mp(n,m) make_pair((n),(m))
#define all(r) r.begin(),r.end()
#define fi first
#define se second

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




const int INF = 1000000;
const int mod = 1e9 + 7;




int main() {
	int n, m;
	while (cin >> n >> m) {
		if (n == 0 && m == 0) break;
		vector<pii> v(n);
		rep(i, n) cin >> v[i].second >> v[i].first;
		sort(all(v));
		reverse(all(v));
		int ans = 0, d;
		rep(i, n) {
			d = min(m, v[i].second);
			m -= d;
			v[i].second -= d;
			ans += v[i].first*v[i].second;
		}
		cout << ans << endl;
	}
}

Measured memory_bytes: 1276
card = []
for i in range(3):
  card += list(map(int,input().split() )) 

N = int(input())

b_l = []
for i in range(N):
  b_l.append(int(input()) )

atari_l = []
for b in b_l:
  if b in card:
    atari_l.append( card.index(b)) 
  else:
    continue

#準備
def warusan(n):
  return n%3
atari = list(map(warusan,atari_l))

#斜め
if 0 in atari_l and 4 in atari_l and 8 in atari_l:
  print("Yes")
elif 2 in atari_l and 4 in atari_l and 6 in atari_l:
  print("Yes")

#横
elif 0 in atari_l and 1 in atari_l and 2 in atari_l:
  print("Yes")
elif 3 in atari_l and 4 in atari_l and 5 in atari_l:
  print("Yes")
elif 6 in atari_l and 7 in atari_l and 8 in atari_l:
  print("Yes")  


#縦
elif atari.count(0) == 3:
  print("Yes")
elif atari.count(1) == 3:
  print("Yes")
elif atari.count(2) == 3:
  print("Yes")

else:
  print("No")      



Measured memory_bytes: 3064
n = input()
a = int(n[0])
b = int(n[1])
c = int(n[2])
d = int(n[3])
if a+b+c+d==7:
  print(str(a)+"+"+str(b)+"+"+str(c)+"+"+str(d)+"=7")
elif a+b+c-d==7:
  print(str(a)+"+"+str(b)+"+"+str(c)+"-"+str(d)+"=7")
elif a+b-c+d==7:
  print(str(a)+"+"+str(b)+"-"+str(c)+"+"+str(d)+"=7")
elif a+b-c-d==7:
  print(str(a)+"+"+str(b)+"-"+str(c)+"-"+str(d)+"=7")
elif a-b+c+d==7:
  print(str(a)+"-"+str(b)+"+"+str(c)+"+"+str(d)+"=7")
elif a-b+c-d==7:
  print(str(a)+"-"+str(b)+"+"+str(c)+"-"+str(d)+"=7")
elif a-b-c+d==7:
  print(str(a)+"-"+str(b)+"-"+str(c)+"+"+str(d)+"=7")
else:
  print(str(a)+"-"+str(b)+"-"+str(c)+"-"+str(d)+"=7")

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define boost ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define mp make_pair
#define pb push_back
#define fp first
#define sp second
typedef long long int ll;
typedef pair<ll,ll> pp;
#define check(x, i) ((x>>i)&1LL)
#define set(x,i) (x|(1LL<<i))
#define unset(x,i) (x&~(1LL<<i))
#define INF LONG_MAX
#define MAX_N 20
#define MAX 4000005
#define mod 1000000007
#define REP(i,n) for(i=0;i<n;i++)
#define FOR(i,a,b) for(i=a;i<=b;i++)
#define RFOR(i,a,b) for(i=a;i>=b;i--)
#define len(i,s) for(i=0;s[i];i++)
#define T() ll t;cin>>t;while(t--)
ll gcd (ll a, ll b){return (a?gcd(b%a,a):b);}
ll pow1(ll a,ll b,ll MOD){ll ans=1;while(b!=0){if(b&1)ans=(ans*a)%MOD;a=(a*a)%MOD;b=b/2;}return ans;}
ll modInverse(ll a,ll p){return pow1(a,p-2,p);}
 


int main()
{
  boost
  #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);    
    freopen("output.txt", "w", stdout);
#endif

   
string s;
cin>>s;
int i,l=s.size();
REP(i,l)
{
    if(s[i]=='?')
        cout<<"D";
    else
        cout<<s[i];
}
}

Measured memory_bytes: 3788
#include<bits/stdc++.h>
#define int long long
using namespace std;
int n, m, dis[5007], num[5007][207], tmp[5007], sum[5007][5007], st[5007], tp, res;
int read()
{
	int num = 0;
	char c = getchar();
	while (c < '0' || c>'9')c = getchar();
	while (c >= '0' && c <= '9')num = num * 10 + c - '0', c = getchar();
	return num;
}
int add(int x1, int y1, int x2, int y2, int v)
{
	sum[x1][y1] += v;
	sum[x1][y2 + 1] -= v;
	sum[x2 + 1][y1] -= v;
	sum[x2 + 1][y2 + 1] += v;
	return 0;
}
signed main()
{
	n = read();
	m = read();
	for (int i = 2; i <= n; i++)
		dis[i] = dis[i - 1] + read();
	for (int i = 1; i <= n; i++)
		for (int j = 1; j <= m; j++)
			num[i][j] = read();
	for (int i = 1; i <= m; i++)
	{
		num[0][i] = num[n + 1][i] = 1e18;
		st[0] = tp = 0;
		for (int j = 1; j <= n; j++)
		{
			while (num[st[tp]][i] <= num[j][i])tp--;
			tmp[j] = st[tp];
			st[++tp] = j;
		}
		st[0] = n + 1, tp = 0;
		for (int j = n; j >= 1; j--)
		{
			while (num[st[tp]][i] < num[j][i])tp--;
			add(tmp[j] + 1, j, j, st[tp] - 1, num[j][i]);
			st[++tp] = j;
		}
	}
	for (int i = 1; i <= n; i++)
		for (int j = 1; j <= n; j++)
			sum[i][j] += sum[i][j - 1];
	for (int i = 1; i <= n; i++)
		for (int j = 1; j <= n; j++)
			sum[i][j] += sum[i - 1][j];
	for (int i = 1; i <= n; i++)
		for (int j = i; j <= n; j++)
			res = max(res, sum[i][j] - dis[j] + dis[i]);
	cout << res << endl;
	return 0;
}

Measured memory_bytes: 204288