akhauriyash/Code-Regression huggingface dataset:
n, m = gets.split.map(&:to_i)
l = gets.split.map(&:to_i)
a = [0]*n
l.each_cons(2){|s, t| s,t = t,s if s > t; a[s-1] += 1; a[t-1] -= 1 }
(1...n-1).each{ |i| a[i] += a[i-1] }
sum = 0
(n-1).times do |i|
  p, q, r = gets.split.map(&:to_i)
  sum += [p*a[i],q*a[i]+r].min
end
p sum

Measured memory_bytes: 17632
N, M = [int(_) for _ in input().split()]
A = [int(_) for _ in input().split()]
cumsum = 0
count = {}
for i in range(N):
    cumsum += A[i]
    cumsum %= M
    count[cumsum] = count.get(cumsum, 0) + 1
ans = count.get(0, 0)
for k in count:
    n = count[k]
    ans += (n * (n - 1)) // 2
print(ans)

Measured memory_bytes: 14424
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"

using namespace std;

const long long int MOD = 1000000007;

long long int N, M, K, H, W, L, R;


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

	cin >> N >> M;
	for (int i = N; i <= M; i++) {
		if (i % 10 == 0) {
			continue;
		}
		string v = to_string(i);
		string u = v;
		reverse(u.begin(), u.end());
		if (v == u) {
			K++;
		}
	}
	cout << K << endl;
	return 0;
}

Measured memory_bytes: 384
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class AtCoderB
{
    static void Main()
    {
        var sc = new Scanner();

        int n = sc.NextInt();
        int[] v = sc.IntArray();
        int[] c = sc.IntArray();

        int answer = 0;
        for (int i = 0; i < n; i++)
        {
            if (c[i] < v[i])
            {
                answer += v[i] - c[i];
            }
        }

        Console.WriteLine(answer);
    }

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}

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

#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define mp make_pair
#define pb push_back
#define fs first
#define sc second
#define fr(i, a, b) for(int i = a ; i < b ; i++)
#define frr(i, a, b) for(int i = a ; i >= b ; i--)
#define tr(it, var) for(__typeof(var.begin()) it = var.begin(); it != var.end(); it++)
#define trr(rit, var) for(__typeof(var.rbegin()) rit = var.rbegin(); rit != var.rend(); rit++)
#define its(x) static_cast< ostringstream & >( ( ostringstream() << dec << x ) ).str() // int to string
#define boost ios_base::sync_with_stdio(false); cin.tie(NULL)
#define deb(x) cout << #x" = " << x << '\n'
#define has(cont, x) ((cont).find((x)) != (cont).end())
#define sz(x) ((int)(x).size())

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;

int main() {
//    freopen("input.in", "r", stdin);
	int k, s;
	ll res = 0;
	scanf("%d %d", &k, &s);
	fr(i, 0, k+1) {
		fr(j, 0, k+1) {
			int to = s-(i+j);
//			deb(to);
			if(to >= 0 && to <= k)
				if(i+j+to == s) res++;
		}
	}
	cout << res << '\n';
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define ALL(x) x.begin(), x.end()
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
using ll = long long;
using lld = long double;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<ll>;
using VVL = vector<VL>;
using PII = pair<int, int>;
random_device rnd;
mt19937 mt(rnd());

const int IINF = 1 << 30;
const ll INF = 1ll << 60;
const ll MOD = 1e9 + 7;

int main()
{
    //N+1!!!!!!!!!!!!!!!!!!!
    int n;
    cin >> n;
    VL v(n + 1);
    VL num(n + 1, 0);
    rep(i, n + 1)
    {
        cin >> v[i];
    }
    ll cur = 0;
    for (int i = n; i >= 0; i--)
    {
        cur += v[i];
        num[i] += cur;
    }
    cur = 1;
    ll ans = 0;

    rep(i, n)
    {
        ans += min(cur, num[i]);
        cerr << min(cur, num[i]) << endl;
        cur -= v[i];
        if (cur <= 0)
        {
            cout << -1 << endl;
            return 0;
        }
        chmin(cur, num[i] - v[i]);
        if (cur < (1ll << 50))
            cur *= 2;
    }
    if (cur < v[n])
    {
        cout << -1 << endl;
        return 0;
    }
    cerr << num[n] << " " << cur / 2 << endl;
    ans += num[n];
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 4784
N=int(input())
t=[]
x=[]
y=[]
#t.append(0)
#x.append(0)
#y.append(0)
t_cur=0
x_cur=0
y_cur=0

for i in range(N):
  plan=input().split(' ')
  t.append(int(plan[0]))
  x.append(int(plan[1]))
  y.append(int(plan[2]))

for i in range(N):
  t_gap=t[i]-t_cur
  x_gap=abs(x[i]-x_cur)
  y_gap=abs(y[i]-y_cur)

  dist=x_gap+y_gap

#  print("trip=",t[i],x[i],y[i])
#  print("t_gap=",t_gap)
#  print("dist=",dist)
  if (t_gap-dist)>=0 and (t_gap-dist)%2==0:
    t_cur=t[i]
    x_cur=x[i]
    y_cur=y[i]
  else:
    print("No")
    exit()
print("Yes")

Measured memory_bytes: 11736
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<string>

#define fast_io ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

using namespace std;

//inline int read(){int t = 0;int neg=1;char c;while((c=getchar_unlocked())!='\n'&&c!=' '&&c!=EOF){if(c=='-'){neg=-1;continue;}t=t*10+c-48;}return neg*t;}
//inline int readl(){long long t = 0;long long neg=1ll;char c;while((c=getchar_unlocked())!='\n'&&c!=' '&&c!=EOF){if(c=='-'){neg=-1ll;continue;}t=t*10+c-48;}return neg*t;}

#define debug(x) cout<<(#x)<<"="<<(x)<<", ";
#define debug1(x) debug(x) cout<<'\n';
#define debug2(x1, x2) debug(x1) debug(x2) cout<<'\n';
#define debug3(x1, x2, x3) debug(x1) debug(x2) debug(x3) cout<<'\n';
#define debug4(x1, x2, x3, x4) debug(x1) debug(x2) debug(x3) debug(x4) cout<<'\n';
#define debug5(x1, x2, x3, x4, x5) debug(x1) debug(x2) debug(x3) debug(x4) debug(x5) cout<<'\n';

typedef long long int lli;
typedef unsigned long long int ulli;
typedef pair<int,int> pi;
typedef pair<lli,lli> plli;
typedef vector<int> vi;
typedef vector<lli> vlli;
typedef vector<pi> vpi;
typedef vector<plli> vplli;
const lli M=1000000007ll;

int main(){
	fast_io 
	int n,k,x,y,ans;
	cin>>n>>k>>x>>y;
	if(n<=k) ans=n*x;
	else ans=k*x+(n-k)*y;
	cout<<ans<<'\n';
	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <list>
#include <algorithm>
#include <cmath>
#include <stack>
#include <set>
using namespace std;

#define REP(i,n) for(int (i)=0; (i)<(n); (i)++)
#define FOR(i,a,b) for(int (i)=(a); (i)<(b); (i)++)
#define PUSH(n,v) for(int i=0; i<(n); i++) {int j; cin >> j; v.push_back(j);}
#define ALL(v) v.begin(), v.end()

void rot1(string &s) {
    string t = "";
    REP(i,s.size()) {
        if (s[i] >= 'a' && s[i] <= 'z') {
            if (s[i] == 'a') t += "z";
            else t += s[i] - 1;
        }else {
            t += s[i];
        }
    }
    s = t;
}

int main() {
    string s;
    while(getline(cin, s)) {
        while(s.find("the") == string::npos && s.find("this") == string::npos && s.find("that") == string::npos) {
            rot1(s);
        }
        cout << s << endl;
    }
    return 0;
}

Measured memory_bytes: 1192
#include <bits/stdc++.h>
using namespace std;
int main(){
  int X;
  cin >> X;
  int res = 0;
  if (X < 4){
    cout << 1;
  } else {
    for (int b = 2; b < X; b++){
      int R = b * b;
      if (R > X) break;
      while (R * b <= X) R*=b;
      res = max(res,R);
    }
    cout << res;
  }
}

Measured memory_bytes: 256
using System;

namespace abc131A
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            string A = Console.ReadLine();
            string B = A.Substring(0, 1);
            string C = A.Substring(1, 1);
            string D = A.Substring(2, 1);
            string E = A.Substring(3, 1);
            if(B == C)
            {
                Console.WriteLine("Bad");
            }
            else if(C == D)
            {
                Console.WriteLine("Bad");
            }
            else if(D == E)
            {
                Console.WriteLine("Bad");
            }
            else
            {
                Console.WriteLine("Good");
            }
        }
    }
}


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

ll n;
ll a[333][333];
bool aa[333][333];

int main(){
    cin >> n;
    for(ll i=1;i<=n;i++){
        for(ll j=1;j<=n;j++) cin >> a[i][j];
    }
    for(ll k=1;k<=n;k++){
        for(ll i=1;i<=n;i++){
            for(ll j=1;j<=n;j++){
                if(a[i][j]>a[i][k]+a[k][j]){
                    cout << -1 << endl;
                    return 0;
                }
                if(a[i][j]==a[i][k]+a[k][j]&&a[i][k]>0&&a[k][j]>0){
                    aa[i][j]=true;
                }
            }
        }
    }
    ll res=0;
    for(ll i=1;i<=n;i++){
        for(ll j=1;j<=n;j++){
            if(!aa[i][j]) res+=a[i][j];
        }
    }
    cout << res/2 << endl;
}  


Measured memory_bytes: 4436
from math import gcd

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

L = [0] * N
L[0] = A[0]

#配列の左から順番に最大公約数を求める
for i, a in enumerate(A):
    L[i] = gcd(L[max(0, i-1)], a)

# print("L", L)
R = [0] * N
R[0] = A[-1]

#配列の右から順番に最大公約数を求める
for i, a in enumerate(A[::-1]):
    R[i] = gcd(R[max(0, i-1)], a)

# print("R", R)
ans = 0

for i in range(N):
    #一番左の数字を削除
    if i == 0:
        ans = max(ans, R[N-2])
    #一番右の数字を削除
    elif i == N-1:
        ans = max(ans, L[N-2])
    #i+1番目の数字を削除
    else:
        ans = max(ans, gcd(L[i-1], R[N-i-2]))
    
print(ans)


Measured memory_bytes: 21912
#include<stdio.h>

int main(void)
{
	int N;
	int A[210];
	int i;
	int cnt=0;
	int flag=0;
	
	scanf("%d",&N);
	for(i=0;i<N;i++){
		scanf("%d",&A[i]);
	}
	
	while(flag!=1){
		for(i=0;i<N;i++){
			if(A[i]%2==0){
				A[i] /=2;
			}else{
				flag =1;
				break;
			}
		}
		if(flag==0)cnt++;
	}
	printf("%d\n",cnt);
	
	return 0;
}

Measured memory_bytes: 128
import java.util.*;
public class Main{
    static Scanner sc = new Scanner(System.in);
    public static void main(String[] args){
    while(sc.hasNext()){
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = a+b;
        int m = 1;
        //System.out.println(c);
        while(c >= 10){
        m++;
        c = c/10;
        //System.out.println(c);
        }
        System.out.println(m);
    }
    }
}

Measured memory_bytes: 18592
#include <bits/stdc++.h>
using namespace std;
int main()
{
 long long i,j,k,a,b,c=0,n,x,y,d;
 cin>>x>>k>>d;
 x=abs(x);
 y=x/d;
 if(y>=k) cout<<x-(k*d)<<endl;
 else
 {
   k=k-y;
   if(k%2==0) cout<<x-(y*d)<<endl;
   else cout<<abs(x-(y+1)*d)<<endl;
 }
return 0;
}


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

int nth_bit(int64_t num, int n){
    return (num >> n) & 1;
}

void chmax(int64_t& a, int64_t b){
    a = max(a, b);
}

int main(){
    int N;
    int64_t K, A[100000];
    cin >> N >> K;
    for(int i=0; i<N; i++) cin >> A[i];

    int64_t dp[42][2];
    for(int d=41; d>=0; d--) for(int j=0; j<2; j++) dp[d][j] = -1e18;
    dp[41][0] = 0;

    for(int d=40; d>=0; d--){
        int64_t D = 1LL<<d;

        int num1 = 0;
        for(int i=0; i<N; i++) if(nth_bit(A[i], d)) num1++;
        int num0 = N - num1;

        if(nth_bit(K, d)){
            chmax(dp[d][0], dp[d+1][0] + D * num0);
            chmax(dp[d][1], dp[d+1][0] + D * num1);
        }else{
            chmax(dp[d][0], dp[d+1][0] + D * num1);
        }

        chmax(dp[d][1], dp[d+1][1] + D * max(num0, num1));
    }

    int64_t ans = max(dp[0][0], dp[0][1]);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <iostream>

using namespace std;

int main(){
    int N;
    int a[100000];
    cin >> N;
    int a_max = 0;
    int a_min = INT32_MAX;
    for(int i = 0; i < N; i++){
        cin >> a[i];
        a_max = max(a[i], a_max);
        a_min = min(a[i], a_min);
    }
    if(a_max > a_min+1){
        cout << "No" << endl;
    }else if(a_max == a_min){
        int m = a_min;
        if(N-1 == m){
            cout << "Yes" << endl;
        }else if(N >= 2*m){
            cout << "Yes" << endl;
        }else{
            cout << "No" << endl;
        }
    }else{
        int min_cnt = 0;
        int max_cnt = 0;
        for(int i = 0; i < N; i++){
            if(a[i] == a_min) min_cnt++;
            if(a[i] == a_max) max_cnt++;
        }
        if(2*(a_max - min_cnt) <= max_cnt && a_max - min_cnt > 0){
            cout << "Yes" << endl;
        }else if(a_max - min_cnt == max_cnt){
            cout << "Yes" << endl;
        }
        else{
            cout << "No" << endl;
        }
    }
}

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

int main() {
	long long N, A, B;
	cin >> N >> A >> B;
	long long ANS = min(B - 1, N - A);
	if (A % 2 == B % 2) ANS = min(ANS, (B - A) / 2);
	else {
		ANS = min(ANS, A + (B - A - 1) / 2);
		ANS = min(ANS, N - B + 1 + (B - A - 1) / 2);
	}
	cout << ANS << endl;
}

Measured memory_bytes: 256
from sys import stdin
import numpy as np
N,L = [int(x) for x in stdin.readline().rstrip().split()]
aji = [0] * (N)
for i in range(N):
    aji[i] = i + L
min_aji = 100000
min_ = 0
for k in aji:
    if abs(k) < min_aji:
        min_aji = abs(k)
        min_ = k
ans = sum(aji) - min_
print(ans)

Measured memory_bytes: 12400
import java.io.PrintWriter;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        int T = Integer.parseInt(sc.next());
        int[] t = new int[N];
        int pret = 0;
        int time = T;
        for (int i = 0; i < N; i++) {
            t[i] = Integer.parseInt(sc.next());
        }

        for (int i = 0; i < N; i++) {

            if ((t[i] - pret) < T) {
                time += t[i] - pret;
            } else {
                time += T;
            }
            pret = t[i];
        }

        PrintWriter out = new PrintWriter(System.out);
        out.println(time);

        sc.close();
        out.flush();
    }
}

Measured memory_bytes: 59896
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int h = in.nextInt(), w = in.nextInt();
        in.nextLine();
        char[][] board = new char[h][w];
        for (int i = 0; i < h; i++) {
            board[i] = in.nextLine().toCharArray();
        }
        int count = 0;
        for (int i = 0; i < h; i++) {
            for (int j = 0; j < w; j++) {
                if (board[i][j] == '#') {
                    count++;
                }
            }
        }
        if (count == h + w - 1) {
            System.out.println("Possible");
        } else {
            System.out.println("Impossible");
        }
    }
}


Measured memory_bytes: 23380
N, = list(map(int, input().split()))
A = list(map(int, input().split()))
b = set(A)
while len(b)>1:
  m = min(b)
  c = set((m,))
  for bi in b:
    if bi%m>0:
      c.add(bi%m)
  b = c
print(list(b)[0])

Measured memory_bytes: 15020
#include<bits/stdc++.h>
using namespace std; 
#define mod 1000000007
#define INF 0x3f3f3f3f
#define all(x) (x).begin(),(x).end()
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define endl "\n" 
#define pb push_back
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define mp make_pair
#define print(v); for(auto x:v) cout<<x<<" "; cout<<endl;
typedef long long int ll;
int main()
{
    fast;
    ll n;
    cin >> n;
    set<string> se;
    for(ll i = 0; i < n; i++){
        string str;
        cin >> str;
        se.insert(str);
    }
    cout << se.size() << endl;


    return 0;
}

Measured memory_bytes: 19144
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
using namespace std;
static const int M = 200000;

int main()
{
  int N;
  cin >> N;
  int a[20];
  for (int i = 0; i < N; i++) {
    cin >> a[i];
  }

  static double dp[20][M];
  for (int i = 0; i < N; i++) {
    fill_n(dp[i], M, 1e10);
  }
  for (int i = 1; i < M; i++) {
    dp[0][i] = fabs(a[0] - i)/double(a[0]);
  }
  for (int i = 0; i < N-1; i++) {
    for (int j = 1; j < M; j++) {
      for (int k = 1; k*j < M; k++) {
        dp[i+1][k*j] = min(dp[i+1][k*j], max(dp[i][j], fabs(a[i+1] - k*j)/double(a[i+1])));
      }
    }
  }

  double ans = 1e10;
  for (int i = 1; i < M; i++) {
    ans = min(ans, dp[N-1][i]);
  }
  printf("%.9f\n", ans);
  return 0;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
#define REP(i, n) for(int i=0; i<n; i++)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const ll MOD = 1e9+7;

ll DPX[20];
ll DPY[20];

int keta(ll n){
    int ret = 0;
    while(n > 0){
        ret += 1;
        n /= 10;
    }
    return ret;
}

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

    int K = keta(N);

    DPX[0] = 0;
    DPY[0] = -100000;

    for(int i = 0; i < K; i++){
        int t = K-1-i;
        //ll n = (N / pow(10, t));
        ll n = N;
        for(int m = 0; m < t; m++)
            n /= 10;
        n %= 10;

        DPX[i+1] = DPX[i] + n;
        if(n == 0) {
            DPY[i+1] = DPY[i] + 9;
        }
        else{
            DPY[i+1] = max(DPY[i] + 9, DPX[i] + n-1);
        }
    }

    ll ans;
    ans = max(DPX[K], DPY[K]);

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define read(x)	 freopen(x, "r", stdin);
#define write(x) freopen(x, "w", stdout);
 // #define xihaad

int main()
 {
#ifdef xihaad
	read("input.txt");
	// write("output.txt");
#endif

int x;
cin>>x;
if(x==0)
cout<<"1";
else
cout<<"0";


   return 0;

}


Measured memory_bytes: 3584
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
int min(int n1,int n2)
{
	if(n1>n2)
		return n2;
	else
		return n1;
}

long int reach (int i,int a[],int memo[])
{
	if(i<2)
		return 100000;
	if(i==2)
		return 0;
	if(memo[i]!=-1)
		return memo[i];
	else
	{
		memo[i]=min(fabs(a[i]-a[i-1])+reach(i-1,a,memo),fabs(a[i]-a[i-2])+reach(i-2,a,memo));
		return memo[i];
	}
}
int main()
{
	int memo[1000009],i,a[1000009],n;
	a[0]=0;a[1]=0;
	scanf("%d",&n);
	for(i=2;i<=n+1;i++)
	{
		scanf("%d",&a[i]);
		memo[i]=-1;
	}
	printf("%ld\n",reach(n+1,a,memo));
	return 0;
}
	
	


Measured memory_bytes: 7296
# 日立コン
import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)

S = readline().strip().decode("utf-8")

s = S.replace("hi", "")
if s:
    print('No')
else:
    print('Yes')

Measured memory_bytes: 3060
#include<stdio.h>
#include<stdbool.h>


bool prime(int i) {
	int flag = 0;
	for (int j = 2; j < i; j++) {

		if (i%j == 0) {
			flag = 1;
		}	
	
	}
	if (flag == 1)return false;
	else return true;
}



int main() {
	int a;
	scanf("%d", &a);

	for (int k = 31; k < 55555; k += 30) {

	     bool cnt = prime(k);
		 if (cnt == true) {
			 a--;
			 printf("%d ", k);
		 }
		if (a == 0) {
			printf("\n");
			break;
		}
	}
}


Measured memory_bytes: 128
H,W=map(int,input().split())

S=[""]*H

for i in range(H):
    S[i]=input()

isWw=[0]*W
isWh=[0]*H

for i in range(H):
    for k in range(W):
        if(S[i][k]=='#'):
            isWw[k]=1
            isWh[i]=1


for i in range(H):
    if(isWh[i]==0):
        continue
    for k in range(W):
        if(isWw[k]==1):
            print(S[i][k],end='')
    print()


Measured memory_bytes: 4468
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		double[]c = new double[3];
		c[0] = scan.nextDouble();
		c[1] = scan.nextDouble();
		c[2] = scan.nextDouble();
		int q  =scan.nextInt();
		for(int i = 0; i < q; i++) {
			double[]p1 = {scan.nextDouble(), scan.nextDouble()};
			double[]p2 = {scan.nextDouble(), scan.nextDouble()};
			double[]ans = getCrossPoints(c, p1, p2);
			if(ans[0] > ans[2]) {
				System.out.printf("%10.8f %10.8f %10.8f %10.8f\n", ans[2], ans[3], ans[0], ans[1]);
			}else if(ans[0] == ans[2]) {
				if(ans[1] > ans[3]) {
					System.out.printf("%10.8f %10.8f %10.8f %10.8f\n", ans[2], ans[3], ans[0], ans[1]);
				}else {
					System.out.printf("%10.8f %10.8f %10.8f %10.8f\n", ans[0], ans[1], ans[2], ans[3]);
				}
			}else {
				System.out.printf("%10.8f %10.8f %10.8f %10.8f\n", ans[0], ans[1], ans[2], ans[3]);
			}
		}
		scan.close();
	}
	static double[] getCrossPoints(double[]c, double[]p1, double[]p2) {
		double[]p3 = {c[0], c[1]};
		double[]h = project(p1, p2, p3);
		double[]e = vec(p1, p2);
		double l = abs(e);

		double base = Math.sqrt(c[2] * c[2] - norm(vec(p3, h)));
		e[0] *= base / l;
		e[1] *= base / l;
		double[]a = {h[0] + e[0], h[1] + e[1], h[0] - e[0], h[1] - e[1]};
		return a;
	}
	static double[] project(double[]p1, double[]p2, double[]p3) {
		double[]base = vec(p1, p2);
		double[]u = vec(p1, p3);
		double r = dot(u, base) / norm(base);
		double x = p1[0] + base[0]  * r;
		double y = p1[1] + base[1]  * r;
		double[]h = {x, y};
		return h;
	}
	static double abs(double[]p) {
		return Math.sqrt(norm(p));
	}
	static double norm(double[]p) {
		return p[0] * p[0] + p[1] * p[1];
	}
	static double[] vec(double[]p1, double[]p2) {
		double[]u = {p2[0] - p1[0], p2[1] - p1[1]};
		return u;
	}
	static double dot(double[]u, double[]v) {
		return u[0] * v[0] + u[1] * v[1];
	}
	static double cross(double[]u, double[]v) {
		return u[0] * v[1] - u[1] * v[0];
	}
}


Measured memory_bytes: 32876
#include <cmath>
#include <iostream>

typedef long long int ll;

int main(void){
	ll a, b, n, res = 0, x;
	std::cin >> a >> b >> n;
	x = std::min(b-1, n);
	res = floor(a * x / b);

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


Measured memory_bytes: 3564
#include <bits/stdc++.h>
using namespace std;
int main(){
    int x;
    cin >> x;
    if(x<600){
        cout << 8 << endl;        
    }else if(x<800){
        cout << 7 << endl;        
    }else if(x<1000){
        cout << 6 << endl;        
    }else if(x<1200){
        cout << 5 << endl;        
    }else if(x<1400){
        cout << 4 << endl;        
    }else if(x<1600){
        cout << 3 << endl;        
    }else if(x<1800){
        cout << 2 << endl;        
    }else{
        cout << 1 << endl;        
    } 
    return 0;
}

Measured memory_bytes: 3632
macro_rules ! input { ( source = $ s : expr , $ ( $ r : tt ) * ) => { let mut iter = $ s . split_whitespace ( ) ; input_inner ! { iter , $ ( $ r ) * } } ; ( $ ( $ r : tt ) * ) => { let s = { use std :: io :: Read ; let mut s = String :: new ( ) ; std :: io :: stdin ( ) . read_to_string ( & mut s ) . unwrap ( ) ; s } ; let mut iter = s . split_whitespace ( ) ; input_inner ! { iter , $ ( $ r ) * } } ; }
macro_rules ! input_inner { ( $ iter : expr ) => { } ; ( $ iter : expr , ) => { } ; ( $ iter : expr , mut $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let mut $ var = read_value ! ( $ iter , $ t ) ; input_inner ! { $ iter $ ( $ r ) * } } ; ( $ iter : expr , mut $ var : ident $ ( $ r : tt ) * ) => { let mut $ var = $ iter . next ( ) . unwrap ( ) . parse ::< usize > ( ) . unwrap ( ) ; input_inner ! { $ iter $ ( $ r ) * } } ; ( $ iter : expr , $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let $ var = read_value ! ( $ iter , $ t ) ; input_inner ! { $ iter $ ( $ r ) * } } ; ( $ iter : expr , $ var : ident $ ( $ r : tt ) * ) => { let $ var = $ iter . next ( ) . unwrap ( ) . parse ::< usize > ( ) . unwrap ( ) ; input_inner ! { $ iter $ ( $ r ) * } } ; }
macro_rules ! read_value { ( $ iter : expr , ( $ ( $ t : tt ) ,* ) ) => { ( $ ( read_value ! ( $ iter , $ t ) ) ,* ) } ; ( $ iter : expr , [ $ t : tt ; $ len : expr ] ) => { ( 0 ..$ len ) . map ( | _ | read_value ! ( $ iter , $ t ) ) . collect ::< Vec < _ >> ( ) } ; ( $ iter : expr , chars ) => { read_value ! ( $ iter , String ) . chars ( ) . collect ::< Vec < char >> ( ) } ; ( $ iter : expr , usize1 ) => { read_value ! ( $ iter , usize ) - 1 } ; ( $ iter : expr , $ t : ty ) => { $ iter . next ( ) . unwrap ( ) . parse ::<$ t > ( ) . unwrap ( ) } ; }
#[derive(Debug)]
struct Rec {
    n: usize,
    graph: Vec<Vec<usize>>,
    top: Vec<usize>,
    visited: Vec<bool>,
}
impl Rec {
    fn new(n: usize) -> Rec {
        Rec {
            n: n,
            graph: vec![vec![]; n],
            top: vec![],
            visited: vec![false; n],
        }
    }
    fn add_edge(&mut self, a: usize, b: usize) {
        self.graph[a].push(b);
    }
    fn solve(&mut self) {
        self.visited = vec![false; self.n];
        for i in 0..self.n {
            if !self.visited[i] {
                self.visited[i] = true;
                self.dfs(i);
            }
        }
        let mut ans = vec![0; self.n];
        for &u in self.top.iter().rev() {
            for &v in self.graph[u].iter() {
                ans[v] = u + 1;
            }
        }
        for &u in &ans {
            println!("{}", u);
        }
    }
    fn dfs(&mut self, u: usize) {
        for i in 0..self.graph[u].len() {
            let v = self.graph[u][i];
            if !self.visited[v] {
                self.visited[v] = true;
                self.dfs(v);
            }
        }
        self.top.push(u);
    }
}
fn main() {
    input! { n, m, ab: [(usize1, usize1); n-1+m] };
    let mut rec = Rec::new(n);
    for &(a, b) in &ab {
        rec.add_edge(a, b);
    }
    rec.solve();
}


Measured memory_bytes: 22396
/******************************\
*  Everyone has a different way of thinking, so God Created us
Hope You Respect My Way..,Thank You ):  *
*                            *
*   Created by : Murad   *
\******************************/
//std::transform(s1.begin(), s1.end(), s1.begin(),::tolower);
#include<bits/stdc++.h>
using namespace std;
#define pi 3.1415926536
#define forn(i,a,b)for(int i=a;i<b;i++)
#define LL long long
#define MP make_pair
#define ff first
#define ss second
#define INF 2147483647
#define _INF -2147483647
#define pq priority_queue
#define MM multimap
#define PB push_back
#define ipair pair<int,int>
#define lpair pair<LL,LL>
#define MAXN 100004
#define El3zba ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define modd 1000000007
LL MMIN(LL a, LL b)
{
	if (a <= b)
		return a;
	else
		return b;
}
LL MMAX(LL a, LL b) {
	if (a >= b)
		return a;
	else
		return b;
}
int main()
{
	El3zba;
	int n;
	cin >> n;
	int sum = 0, ans = INF;
	vector<int>a(n);
	forn(i, 0, n) {
		cin >> a[i];
		sum += a[i];
	}
	int r = 0;
	for (int i = 0; i < n; i++) {
		r += a[i];
		sum -= a[i];
		ans = min(ans, abs(r - sum));
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
N = input()
numList = input().split(' ')
for num in numList:
  num = int(num)
  if num % 2 == 0:
    judge1 = num % 3 == 0
    judge2 = num % 5 == 0
    approve = judge1 or judge2
    if not approve:
      print('DENIED')
      exit()
print('APPROVED')

Measured memory_bytes: 2940
#include <stdio.h>

int main()
{
	int N;
	char s[100];
	int i;
	int rc = 0;
	int bc = 0;

	scanf("%d", &N);
	scanf("%s", &s);

	for(i=0;i<N;i++){
		if(s[i]=='R'){
			rc++;
		}
		else if(s[i]=='B'){
			bc++;
		}
	}

	if(rc > bc){
		printf("Yes\n");
	}else{
		printf("No\n");
	}

	return 0;
}

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

#define for_(i,a,b) for(int i=(a);i<(b);++i)
#define for_rev(i,a,b) for(int i=(a);i>=(b);--i)

string A, B;
int n, m;

bool check(int k) {
	if (k == 0) return true;
	
	vector< int > c(26, 0);
	for_(i,0,k) c[A[i] - 'a']++;
	
	set< vector< int > > vset;
	vset.insert(c);
	
	for_(i,k,n) {
		c[A[i-k] - 'a']--;
		c[A[i] - 'a']++;
		vset.insert(c);
	}
	
	c.assign(26, 0);
	for_(i,0,k) c[B[i] - 'a']++;
	
	if (vset.count(c)) return true;
	
	for_(i,k,m) {
		c[B[i-k] - 'a']--;
		c[B[i] - 'a']++;
		if (vset.count(c)) return true;
	}
	
	return false;
}

int main() {
	cin >> A;
	cin >> B;
	n = A.size();
	m = B.size();
	
	for_rev(i,min(n,m),0) {
		if (check(i)) {
			cout << i << endl;
			break;
		}
	}
}

Measured memory_bytes: 3844
/*
    BHAGWAN TUSSI GREAT HO! TOOFA KUBUL KARO XD
Hi! Stalker
█▀▀▄░░░░░░░░░░░▄▀▀█
░█░░░▀▄░▄▄▄▄▄░▄▀░░░█
░░▀▄░░░▀░░░░░▀░░░▄▀
░░░░▌░▄▄░░░▄▄░▐▀▀
░░░▐░░█▄░░░▄█░░▌▄▄▀▀▀▀█ 
░░░▌▄▄▀▀░▄░▀▀▄▄▐░░░░░░█
▄▀▀▐▀▀░▄▄▄▄▄░▀▀▌▄▄▄░░░█
█░░░▀▄░█░░░█░▄▀░░░░█▀▀▀
░▀▄░░▀░░▀▀▀░░▀░░░▄█▀
░░░█░░░░░░░░░░░▄▀▄░▀▄
░░░█░░░░░░░░░▄▀█░░█░░█
░░░█░░░░░░░░░░░█▄█░░▄▀
░░░█░░░░░░░░░░░████▀
░░░▀▄▄▀▀▄▄▀▀▄▄▄█▀
*/
#include<bits/stdc++.h>
#include<string.h>
#define ll long long int
#define fio ios_base::sync_with_stdio(false); cin.tie(NULL);
#define MAX_LIMIT 100000
using namespace std;
int main(){
    ll a,b,c,x=0,i;
    cin>>a>>b>>c;
    for(i=0;i<10;i++){
        x=a*c-b;
        cout<<x<<endl;
        c=x;
    }
}

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

const ll MOD = 1e9 + 7;

int mpow(int base, int exp);
typedef  vector<int> vi;
typedef  vector<ll> vll;
typedef  vector<pair<ll,ll>> vpll;
typedef  vector<pair<int, int>> vpii;
typedef  pair<int, int> pii;
typedef  pair<ll, ll> pll;
typedef  unordered_map<ll, ll> umpll;
typedef  unordered_map<int, int> umpii;
typedef  unordered_map<ll, int> umpli;
typedef  unordered_set<int> usi;
typedef  unordered_set<ll> usll;
typedef  set<int> si;
typedef  set<ll> sll;
typedef  set<pair<int, int>> spii;
typedef  set<pair<ll, ll>> spll;

#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define fo(i,n) for(i = 0;i < n; i++)
#define Fo(i,k,n) for(i = k;k < n ? i < n : i > n; k < n ? i += 1 : i -= 1)
#define deb(x) cout << #x << " = " << x << endl
#define deb2(x, y) cout << #x << " = " << x << ", " << #y << " = " << y << endl
#define deb3(x, y, z) cout << #x << " = " << x << ", " << #y << " = " << y << ", "<< #z << " = " << z << endl

ll randGen(ll lower, ll upper) { return (rand() % (upper - lower + 1)) + lower; }
ll dir[4][2] = {{1, 0}, {0, 1}, {-1, 0}, {0, -1}};
// cout << fixed;
// cout.precision(10);
//******************          Function here          *********************//

   void solve(){
      int n;
      cin >> n;
      ll a[n], sum[n];
      for(int i = 0; i < n; i++) {
         cin >> a[i];
         sum[i] = a[i];
      }
      for(int i = n - 2; i >= 0; i--) {
         sum[i] += sum[i + 1];
         sum[i] %= MOD;
      }
      ll ans = 0;
      for(int i = 0; i < n - 1; i++) {
         ans += (a[i] * sum[i + 1]) % MOD;
      }
      cout << (ans % MOD) << endl;
   }

//*********************************************************************//

int main()
{
    #ifndef ONLINE_JUDGE
      string inputFile, outputFile;
      inputFile = "input.txt";
      outputFile = "output.txt";
      freopen(inputFile.c_str(), "r", stdin);
      freopen(outputFile.c_str(), "w", stdout);
    #endif

    int t = 1;
    // cin>>t;
    while(t-- >0){
      solve();
    }
    return 0;
}



/**********************   Utility Functions  *****************************/
   int mpow(int base, int exp) {
     base %= MOD;
     int result = 1;
     while (exp > 0) {
       if (exp & 1) result = ((ll)result * base) % MOD;
       base = ((ll)base * base) % MOD;
       exp >>= 1;
     }
     return result;
   }
/***********************************************************************/


Measured memory_bytes: 6644
#include<iostream>
using namespace std;
#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: 3100
#include <bits/stdc++.h>
using namespace std;
#define rep(i, s, n) for (int i = (s); i < (int)(n); i++)

int main(){
    int a,b,ans,pl;
    cin >> a >> b;
    pl=1;
    for(ans=0;pl<b;ans++){
        pl += a-1;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3584
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, e) for (int i = (int)(s); i <= (int)(e); i++)
#define printYesNo(is_ok) puts(is_ok ? "Yes" : "No");
#define SORT(v) sort(v.begin(), v.end());
#define RSORT(v) sort(v.rbegin(), v.rend());
#define REVERSE(v) reverse(v.begin(), v.end());

int main()
{
    int A, B, Q;
    cin >> A >> B >> Q;
    vector<long long> s(A + 2), t(B + 2);
    vector<pair<long long, int>> x(Q);
    long long INF = INT64_MAX / 10;
    s[0] = -INF;
    t[0] = -INF;
    s.back() = INF;
    t.back() = INF;
    rep(i, A)
    {
        cin >> s[i + 1];
    }
    rep(i, B)
    {
        cin >> t[i + 1];
    }
    rep(i, Q)
    {
        cin >> x[i].first;
        x[i].second = i;
    }
    SORT(x);
    vector<long long> ans(Q);
    int i_A = 0, i_B = 0;
    rep(i, Q)
    {
        long long pos = x[i].first;
        while (!(s[i_A] < pos && pos < s[i_A + 1]))
            i_A++;

        while (!(t[i_B] < pos && pos < t[i_B + 1]))
            i_B++;

        long long LA = s[i_A], RA = s[i_A + 1], LB = t[i_B], RB = t[i_B + 1];

        long long dist0 = pos - min(LA, LB);
        long long dist1 = RA - LB + min(RA - pos, pos - LB);
        long long dist2 = RB - LA + min(RB - pos, pos - LA);
        long long dist3 = max(RA, RB) - pos;
        ans[x[i].second] = min({dist0, dist1, dist2, dist3});
    }
    rep(i, Q)
    {
        cout << ans[i] << endl;
    }
    return 0;
}

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

class Main {
	public static void main(String args[]) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		Solver solver = new Solver();
		solver.init();
		solver.readHead(in.readLine());
		// for (; solver.hasNext();) {
		// solver.readBody(in.readLine());
		// }
		// solver.solve();
		// }
	}
}

class Solver {
	int N;
	int cnt;

	public void init() {
		N = 0;
		cnt = 0;
	}

	public void readHead(String str) {
		String[] strArr = str.split(" ");
		N = Integer.parseInt(strArr[0]);
		// System.out.println(N);
		for (int i = 0; i < str.length(); i++) {
			if (str.charAt(i) == '9')
				System.out.print('1');
			else
				System.out.print('9');
		}

		System.out.println();
	}

	public boolean hasNext() {
		return cnt < N;
	}

	public void readBody(String str) {
		// System.out.println(str);
		cnt++;
	}

	public void solve() {

	}
}


Measured memory_bytes: 21204
#include <iostream>
#include <set>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;

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

int main() {
  int n;
  cin>>n;
  set<int> s0, s1;
  s0.insert(0);
  rep(i,n) {
    int a;
    cin>>a;
    set<int> p0, p1;
    swap(s0, p0);
    swap(s1, p1);
    for (int x : p0) {
      s0.insert(gcd(x, a));
      s1.insert(x);
    }
    for (int x : p1) {
      s1.insert(gcd(x, a));
    }
  }
  int ans = *(s1.rbegin());
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <numeric>
using namespace std;
typedef long long int ll;

#define EPS (1e-7)
#define INF 1e18
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define PI (acos(-1))

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


int main() {

    int a, b;

    cin >> a >> b;

    cout << (a + b / 2) << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long lint;

#define PI acos(-1)
#define INF64 1LL << 60
#define INF32 1 << 29
#define all(a) (a).begin(), (a).end()

using namespace std;

void execute()
{
	int N;
	string input;
	cin >> N;
	cin >> input;

	if (N & 1)
	{
		cout << "No" << endl;
		return;
	}
	for (int i = 0; i < N / 2; i++)
	{
		if (input[N / 2 + i] != input[i])
		{
			cout << "No" << endl;
			return;
		}
	}
	cout << "Yes " << endl;

	return;
}

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

	int stop;
	cin >> stop;

	return 0;
}

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

// 考える整数の最大値
const int MAX = 200;
// 今回採用する大きい素数を適当に設定
const int MOD = 1000000007;

// メモを保管する場所
ll fact[MAX], inv_fact[MAX], inv[MAX];

// メモを計算する
void init() {
    // 初期値設定と1はじまりインデックスに直す
    fact[0] = 1;
    fact[1] = 1;
    inv[0] = 1;
    inv[1] = 1;
    inv_fact[0] = 1;
    inv_fact[1] = 1;
    // メモの計算
    repi(i, 2, MAX){
        // 階乗
        fact[i] = fact[i - 1] * i % MOD;
        // 逆元
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        // 逆元の階乗
        inv_fact[i] = inv_fact[i - 1] * inv[i] % MOD;
    }
}

// 二項係数の実体
ll nCk(int n, int k) {
    ll x = fact[n]; // n!の計算
    ll y = inv_fact[n-k]; // (n-k)!の計算
    ll z = inv_fact[k]; // k!の計算
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return x * ((y * z) % MOD) % MOD;
}


int main(){
  init();
  int N, M;
  cin >> N >> M;
  cout << nCk(N, 2) + nCk(M, 2) << endl;
}

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

#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;

int main()
{
    int n;
    cin >> n;
    int ans = 0;
    for (ll i = 0; i <= 100000; i++)
    {
        if (i * i <= n)
            ans = i * i;
    }
    OP(ans);
    return 0;
}

Measured memory_bytes: 256
n = int(input())
X = [float(i) for i in input().split(' ')]
Y = [float(i) for i in input().split(' ')]
d1, d2, d3, di = 0,0,0,0
for x,y in zip(X,Y):
	d1 += abs(x-y)
	d2 += pow(abs(x-y), 2)
	d3 += pow(abs(x-y), 3)
	if di < abs(x-y): di = abs(x-y)
print(d1)
print(pow(d2, 1/2))
print(pow(d3, 1/3))
print(di)


Measured memory_bytes: 7828
#include<cstdio>

unsigned long long int x, ans, am;

int main(){

  scanf("%lld", &x);
  ans = x / 11;
  am = x % 11;
  if(am == 0){
    am = 0;
  }else if(am <= 6){
    am = 1;
  }else{
    am = 2;
  }
  printf("%lld", ans*2+am);
  /*
  for(unsigned long long int l = 0; ; l += 2){
    if(x <= 6){
      printf("%lld", l+1);
      break;
    }else if(x <= 11){
      printf("%lld", l+2);
      break;
    }
    x -= 11;
  }
  */

  return 0;

}


Measured memory_bytes: 128
(defun read-string () ;スペース区切りstring入力
  (let* ((str (read-line)))
    (labels ((instring (instring-str rt)
               (let* ((pos (position #\Space instring-str :test #'char=)))
                 (if pos
                     (instring (subseq instring-str (1+ pos))
                               (cons (subseq instring-str 0 pos) rt))
                     (cons instring-str rt)))))
      (reverse (instring str nil)))))

(let* ((n (read))
       (m (read))
       (lst (mapcar (lambda (k) (list (parse-integer (first k))
                                            (second k)))
                          (loop :repeat m :collect (read-string))))
       (arr (make-array (list (1+ n) 2) :initial-element 0 :element-type 'fixnum)))
  (mapcar (lambda (k) (if (string= (second k) "AC")
                          (setf (aref arr (first k) 1) 1)
                          (if (= (aref arr (first k) 1) 0)
                              (incf (aref arr (first k) 0))))) lst)
  (format t "~A ~A" (loop :for k :from 1 :upto n :count (= (aref arr k 1) 1))
          (loop :for k :from 1 :upto n :sum (if (= (aref arr k 1) 1) (aref arr k 0) 0))))


Measured memory_bytes: 72160
#include <bits/stdc++.h>
 
#define vi vector<int>
#define ll long long
#define pb push_back
#define mp make_pair
#define endl "\n"
#define ii pair<int,int>
#define qu queue <int>
#define qmax priority_queue <int>
#define qmin priority_queue <int, vector<int>,greater<int>>

using namespace std;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    int n,T,costMin=100000;

    cin>>n>>T;

    int c,t;

    for(int i=0; i<n; i++){
        cin>>c>>t;

        if(c <= costMin && t<= T){
            costMin = c;
            
        }
    }

    if(costMin!=100000)
        cout<<costMin<<endl;
    else
        cout<<"TLE"<<endl;
    return 0;
}

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

int main(){
  int cnt=0;
  string word,sen;
  cin >> word;
  while(1){
    cin >> sen;
    if(sen == "END_OF_TEXT")
    {
      break;
    }
  	string word1, sen1;
  	for(int i = 0; i < sen.size(); ++i)
    {
      sen1 += tolower(sen[i]);
    }
  	for(int i = 0; i < word.size(); ++i) 
    {
      word1 += tolower(word[i]);
    }
  	if(word1 == sen1)
    {
      cnt++;
    }
  }
  cout<<cnt<<endl;
}



Measured memory_bytes: 3160
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int a = in.nextInt();
		int b = in.nextInt();
		int ans = a * b;
		if (ans % 2 == 0) {
			System.out.println("Even");
		} else {
			System.out.println("Odd");
		}
	}

}

Measured memory_bytes: 21716
#include<iostream>
using namespace std;
int main(){
    int n;
    cin >>n;
    int cards[4][13]={0};
    for(int i=0;i<n;i++){
        char c;
        int x;
        cin >>c>>x;
        if(c=='S') cards[0][x-1]=1;
        else if(c=='H') cards[1][x-1]=1;
        else if(c=='C') cards[2][x-1]=1;
        else if(c=='D') cards[3][x-1]=1;
    }
    for(int i=0;i<4;i++){
        for(int j=0;j<13;j++){
            if(cards[i][j]==0){
                if(i==0) cout<<"S "<<j+1<<endl;
                else if(i==1) cout<<"H "<<j+1<<endl;
                else if(i==2) cout<<"C "<<j+1<<endl;
                else if(i==3) cout<<"D "<<j+1<<endl;

            }
        }
    }
}


Measured memory_bytes: 3076
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<list>
#include<iomanip>
#include<cmath>
#include<cstring>
#include<functional>
#include<cstdio>
#include<cstdlib>
using namespace std;

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define INF 2e9
#define MOD 1000000007
//#define MOD 998244353
#define LINF (long long)4e18
#define jck 3.141592

const double EPS = 1e-10;

using ll = long long;
using Pi = pair<int,int>;
using Pl = pair<ll,ll>;


int main(){
    int t1,t2; cin >> t1 >> t2;
    ll a1,a2,b1,b2; cin >> a1 >> a2 >> b1 >> b2;
    if(a1*t1+a2*t2 == b1*t1+b2*t2) cout << "infinity" << endl;
    else{
        if(a1 < b1){
            swap(a1,b1);
            swap(a2,b2);
        }
        if(a1*t1+a2*t2 > b1*t1+b2*t2) cout << 0 << endl;
        else{
            ll s = (b1-a1)*t1;
            ll t = (a1-b1)*t1+(a2-b2)*t2;
            ll k = s/t+1;
            ll ans = 2*k-1;
            if(s%t == 0) ans--;
            cout << ans << endl;
        }
    }
    
}


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

using namespace std;

void printArray(int n, vector<int> &a)
{
    for (int i = 0; i < n; i++)
    {
        cout << a[i];
        if (i != n - 1)
            printf(" ");
        else
            printf("\n");
    }
}

void bubbleSort(int n, vector<int> &a, int &cnt)
{
    int flag = 1; // 逆の隣接要素が存在する
    cnt = 0;
    while (flag)
    {
        flag = 0;
        for (int j = n - 1; j >= 1; j--)
        {
            if (a[j] < a[j - 1])
            {
                swap(a[j], a[j - 1]);
                flag = 1;
                cnt++;
            }
        }
    }
}

int main()
{
    int n, cnt = 0;

    scanf("%d", &n);

    vector<int> a(n);

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

    vector<int> &r = a;

    bubbleSort(n, r, cnt);
    printArray(n, r);
    printf("%d\n", cnt);

    return 0;
}



Measured memory_bytes: 3220
#include<stdio.h>

#define MAX 100005
#define NIL -1

struct Node{
    int p, l, r;
};

struct Node T[MAX];
int n, D[MAX];

void print(int u){
    int i, c;

    printf("node %d: parent = %d, depth = %d, ", u, T[u].p, D[u]);

    if(T[u].p == NIL) printf("root, ");
    else if(T[u].l == NIL) printf("leaf, ");
    else printf("internal node, ");

    printf("[");
    
    for(i=0, c=T[u].l; c!=NIL; i++, c=T[c].r){
        if(i!=0)printf(", ");
        printf("%d", c);
    }
    printf("]\n");
}

int rec(int u, int p){
    D[u] = p;
    if(T[u].r!=NIL) rec(T[u].r, p);
    if(T[u].l!=NIL) rec(T[u].l, p+1);
}

int main(){
    int i, j;
    int d, v, c, l, r;

    scanf("%d", &n);

    for(i=0; i<n; i++) T[i].p=T[i].l=T[i].r=NIL;

    for(i=0; i<n; i++){
        scanf("%d%d", &v, &d);
        for(j=0; j<d; j++){
            scanf("%d", &c);
            if(j==0) T[v].l=c;
            else T[l].r = c;
            l=c;
            T[c].p=v;
        }
    }

    for(i=0; i<n; i++){
        if(T[i].p == NIL) r=i;
    }

    rec(r, 0);

    for(i=0; i<n; i++) print(i);


    return 0;
}





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

#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef complex<double> point;
#define xx real()
#define yy imag()

#define REP(i, a, b) for(int i = (a); i < (int)(b); i++)
#define REPN(i, a, b) for(int i = (a); i <= (int)(b); i++)
#define FA(it, x) for(__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define SZ(x) (int)(x).size()
#define BE(x) (x).begin(), (x).end()
#define SORT(x) sort(BE(x))
#define _1 first
#define _2 second

#define x1 gray_cat_x1
#define y1 gray_cat_y1

template<class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }

#define file "cycle"

const double EPS = 1e-9;
const double PI = acos(-1.);
const int INF = 1e9;
const ll MOD = 1e9 + 7;

const int MAXN = 1e5 + 5;

int bad[10];

void solve(){
	int n, k, a;
	cin >> n >> k;
	REP(i, 0, k){
		cin >> a;
		bad[a] = 1;
	}
	for(; ; n++){
		int fl = 0;
		for(int v = n; v; v /= 10){
			if (bad[v % 10]){
				fl = 1;
				break;
			}
		}
		if (!fl){
			printf("%d\n", n);
			return;
		}
	}
}	

int main(){

	//freopen(file".in", "r", stdin); freopen(file".out", "w", stdout);
	int t = 1;
	//cin >> t;
	while(t--){
		solve();	
	}
}

Measured memory_bytes: 256