akhauriyash/Code-Regression huggingface dataset:
import java.io.PrintWriter;
import java.util.Scanner;

// MainT1P2018D
public class Main {

    public static void main(String[] args) {
        try (
                Scanner in = new Scanner(System.in);
                PrintWriter out = new PrintWriter(System.out))
        {
            final int N = in.nextInt();
            int d = 8*N + 1;
            int dr = (int)Math.sqrt(d);
            if (dr * dr != d) {
                out.println("No");
                return;
            }

            final int k = (1 + dr) / 2;

            final int[] startIdx = new int[k - 1];
            {
                int idx = 1;
                for (int i = 0; i < k - 1; ++i) {
                    startIdx[i] = idx;
                    idx += i + 1;
                }
            }

            out.println("Yes");
            out.println(k);
            {
                out.print(k - 1);
                for (int i = 0; i < k - 1; ++i) {
                    out.print(' ');
                    out.print(startIdx[i] + i);
                }
                out.println();
            }
            for (int i = 0; i < k - 1; ++i) {
                out.print(k - 1);
                for (int j = 0; j < i; ++j) {
                    out.print(' ');
                    out.print(startIdx[i] + j);
                }
                for (int j = i; j < k - 1; ++j) {
                    out.print(' ');
                    out.print(startIdx[j] + i);
                }
                out.println();
            }
        }
    }
}


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

using namespace std;

int main(){
    string s;
    int y,m,d;
    while(true) {
        cin >> s >> y >> m >> d;
        if (s == "#") break;
        if(y == 31 && m >= 5) cout << "? " << y - 30 << " " << m << " " << d << endl;
        else if( y >= 32) cout << "? " << y - 30 << " " << m << " " << d << endl;
        else cout << s << " " << y << " " << m << " " << d << endl;
    }
}


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

using namespace std;
typedef long long ll;

int main() {
	int n;
	cin >> n;
	map <string, int> mp;
	for(int i = 0; i < n; i++){
		string s;
		cin >> s;
		mp[s]++;
	}

	int max = 0;
	for(const auto & x : mp) {
		int value = x.second;
		if(value > max) max = value;
	}

	for (auto it = mp.begin(); it != mp.end(); it++){
		if(it -> second == max){
			cout << it->first << endl;
		}
	}
}

Measured memory_bytes: 25216
#include <bits/stdc++.h>
using namespace std;
const int N = 2000;

#define PI acos(-1)
typedef long long ll;
#define INF 0x3f3f3f3f
int mod = 1000000007;
typedef pair<int, int> pii;
int rec[1301];
int main()
{
	//freopen("in.txt", "r", stdin);
	// freopen("out.txt", "w", stdout);
	 // freopen("output.txt", "w", stdout);
	int a[3], k;
	while (cin >> a[0] >> a[1] >>a[2] >> k)
	{
		sort(a, a + 3);
		for (int i = 0; i < k; i++)
			a[2] *= 2;
		cout<<accumulate(a, a + 3, 0)<<endl;
	}
    return 0;
}

Measured memory_bytes: 256
"""
DP
"""
N, W = list(map(int, input().split()))
V = []
WEI = []

for i in range(N):
    v, w = list(map(int, input().split()))
    V.append(v)
    WEI.append(w)

# DP[i][j]: i番目以降の品物を使い、重さj以下にする場合の価値の最大
DP = []
for i in range(N+1):
    a = [None] * (W+1)
    DP.append(a)

for i in range(W+1):
    # N番目以降の品物を選ぶことはできない（品物が存在しない）
    DP[N][i] = 0

# N-1 から 0 まで（品物の番号）
for i in range(N-1, -1, -1):
    # 0 から W まで（重さ）
    for j in range(W+1):
        if j < WEI[i]:  # 商品iが使えない場合
            DP[i][j] = DP[i+1][j]
        else:
            DP[i][j] = max(DP[i+1][j], DP[i+1][j-WEI[i]] + V[i])

print(DP[0][W])


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

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

	vector<int> v(n);
	vector<int> c(n);

	REP(i, n) {
		cin >> v[i];
	}
	REP(i,n) {
		cin >> c[i];
	}

	int X, Y, maxi = -10000000;
	for (int i = 0; i < (1<<n); i++) {
		REP(j, n) {
			if (i>>j&1 == 1) {
				X += v.at(j);
				Y += c.at(j);
				
			}
		}
		maxi = max(maxi, X-Y);
		X = 0;
		Y = 0;
	}

	cout << maxi << endl;
}

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

int main() {
	// your code goes here
	int x,y;
	cin>>x>>y;
	if(y%2==0 && y<=(x*4) && y>=x*2 ){
		cout<<"Yes";
	}
	else cout<<"No";
	return 0;
}


Measured memory_bytes: 3620
#include <string>
#include <vector>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <map>
#include <list>
#include <set>
#include <numeric>
#include <queue>
#include <stack>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <climits>
#include <cfloat>
#include <ctime>
#include <complex>
#include <cassert>
#include <array>
#include <bitset> 
#include <unordered_map>
#include <random>

using namespace std;
typedef long long LL;
typedef pair<int,int> P;

char s[302][302];
int t[601][601];
int d0[601][601];
int d1[601][601];

int main() {
	int H,W;
	cin >> H >> W;
	for(int i=0;i<H;i++){
		cin >> s[i];
		for(int j=0;j<W;j++){
			if(s[i][j]=='#'){
				t[1+i+j][1+i+W-j]=1;
			}
		}
	}
	int S=W+H;
	for(int i=1;i<=S;i++){
		for(int j=1;j<=S;j++){
			d0[i][j]=d1[i][j]=t[i][j];
			d0[i][j]+=d0[i-1][j];
			d1[i][j]+=d1[i][j-1];
		}
	}
	int ret=0;
	for(int i=1;i<=S;i++){
		for(int j=1;j<=S;j++){
			if(!t[i][j])continue;
			for(int k=j+1;k<=S;k++){
				if(!t[i][k])continue;
				int d=k-j;
				if(i-d>=1){
					ret+=d1[i-d][k]-d1[i-d][j-1];
				}
				if(i+d<=S){
					ret+=d1[i+d][k]-d1[i+d][j-1];
				}
			}
			for(int k=i+2;k<=S;k++){
				if(!t[k][j])continue;
				int d=k-i;
				if(j-d>=1){
					ret+=d0[k-1][j-d]-d0[i][j-d];
				}
				if(j+d<=S){
					ret+=d0[k-1][j+d]-d0[i][j+d];
				}
			}
		}
	}

	cout << ret << endl;

	return 0;
}



Measured memory_bytes: 4608
#include<bits/stdc++.h>
using namespace std;
typedef long long int uli;
int main(){
  int n;
  string s;
  cin>>n>>s;
  int r=0,b=0;
  for(int i=0;i<n;i++){
    if(s[i]=='R')r++;
    else b++;
  }
  if(r>b)puts("Yes");
  else puts("No");
  return 0;

}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cmath>
#include <functional>
#include <algorithm>
#include <numeric>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <deque>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <boost/range/irange.hpp>
#include <boost/container/static_vector.hpp>
#include <boost/utility/string_ref.hpp>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/math/common_factor_rt.hpp>

class input
{
    std::istream& cin;

public:
    input() : cin(std::cin)
    {
        std::cin.tie(nullptr);
        std::ios::sync_with_stdio(false);
    }

    template <class T>
    inline input& operator>>(T& var)
    {
        cin >> var;
        return *this;
    }
    template <class T>
    inline input& operator,(T& var)
    {
        cin >> var;
        return *this;
    }

    template <class T>
    inline T read()
    {
        T var;
        cin >> var;
        return var;
    }

    template <class InputIterator>
    inline void read(InputIterator head, std::size_t n)
    {
        for (std::size_t i = 0; i < n; ++i) {
            cin >> *head;
            ++head;
        }
    }

    template <class T>
    inline std::vector<T> read(std::size_t n)
    {
        std::vector<T> res;
        res.reserve(n);

        for (std::size_t i = 0; i < n; ++i) {
            T tmp;
            cin >> tmp;
            res.emplace_back(tmp);
        }
        return res;
    }

    template <class T, class F>
    inline void online(std::size_t n, F&& f)
    {
        T var;
        for (std::size_t i = 0; i < n; ++i) {
            cin >> var;
            f(var);
        }
    }
};
template <class T, std::size_t n>
std::istream& operator>>(std::istream& in, std::array<T, n>& var)
{
    for (std::size_t i = 0; i < n; ++i) {
        in >> var[i];
    }
    return in;
}

class output
{
    std::ostream& cout;

    template <class T, class... Args>
    void impl(T&& v, Args&&... args)
    {
        cout << std::forward<T>(v) << ' ';
        impl(std::forward<Args>(args)...);
    }
    template <class T>
    void impl(T&& v)
    {
        cout << std::forward<T>(v);
    }

public:
    output() : cout(std::cout)
    {
        cout << std::fixed << std::setprecision(15);
    }

    template <class... Args>
    void operator()(Args&&... args)
    {
        impl(std::forward<Args>(args)...);
        cout << '\n';
    }
    template <class... Args>
    void noreturn(Args&&... args)
    {
        impl(std::forward<Args>(args)...);
    }

    template <class T>
    void print(const T& container)
    {
        bool first = true;
        for (auto&& x : container) {
            if (!first) {
                cout << ' ';
            }
            cout << x;
            first = false;
        }
        cout << '\n';
    }
};

void prog()
{
    input in;
    output out;

    int a, b;
    in >> a, b;
    for (int i : boost::irange(0, std::max(a, b))) {
        std::cout << std::min(a, b);
    }
}

int main()
{
    prog();
    return 0;
}


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

using namespace std;

#define LL long long

LL n,ans;

int main() {
    scanf("%lld",&n);
    ans = n * (n - 1) / 2;
    printf("%lld \n",ans);
    //system("pause");
    return 0;
}

Measured memory_bytes: 256
N = int(input())
As = list(map(int, input().split()))

i_plus_Ai = [0 for i in range(N)]
dict = {}
for i in range(N):
    i_plus_Ai[i] = i + As[i]
    tmp = i - As[i]
    if tmp not in dict:
        dict[tmp] = [i]
    else:
        dict[tmp].append(i)

count = 0
for i in range(N):
    if i_plus_Ai[i] in dict:
        kouho = dict[i_plus_Ai[i]]
        for j in range(len(kouho)):
            if kouho[j] > i:
                count += len(kouho) - j
                break

print(count)


Measured memory_bytes: 116384
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions,copy
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

n = inp()
ans = -1
res = 0
for i in range(1,n+1):
    cnt = 0
    tmp = i
    while True:
        if tmp%2:
            break
        tmp //= 2
        cnt += 1
    if cnt > ans:
        ans = cnt
        res = i
print(res)

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

int main()
{
  int n; cin >> n;
  int max = 0;
  int ans;
  if (n == 1) {
    cout << 1 << endl;
    return 0;
  }
  for(int i = 1; i < n+1; i++) {
    int tmp = 0;

    int j = i;
    while (true) {
      if (j%2 == 0) {
        tmp ++;
        j /= 2;
      } else {
        break;
      }
    }

    if (tmp > max) {
      max = tmp;
      ans = i;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
a,b,c,k = map(int,input().split())

if abs(a-b) > 1000000000000000000:
    print('Unfair')
elif a == b:
    print(0)
elif k % 2 == 0:
    print(a-b)
elif k % 2 == 1:
    print(b-a)

Measured memory_bytes: 2940
#include<stdio.h>
#include<string.h>

#define M 10000000
#define Long 14

char H[M]; /*Hash Table*/
char str[Long]; //文字列

int getChar(char);//文字を数字
int getkey(void);//
int find(void);//検索
void insert(void);//代入

int main(){
  int i,n,h;
  char command[9];//命令

  scanf("%d",&n);//命令回数の入力

  for(i = 0;i < n;i++){//命令と文字列の入力
    scanf("%s %s",command,str);

    if(command[0] == 'i'){
      insert();
    }
    else{
      if(find()){
	printf("yes\n");
      }
      else{
	printf("no\n");
      }
    }
  }
  return 0;
}
int getChar(char ch){//各文字の数字を返す
  if(ch == 'A')return 1;
  else if(ch == 'C')return 2;
  else if(ch == 'G')return 3;
  else if(ch == 'T')return 4;
}

/*convert a string into an integer value*/
int getkey(){//文字列の合計数を返す
  int sum = 0, p = 1, i;
  for(i = 0;i < strlen(str);i++){
    sum += p*(getChar(str[i]));
    p *= 5;
  }
  return sum;
}


int find(){//合計数番目の配列に 1 があるかないか.
  int key = getkey();
  if(H[key]){//ある場合その文字列が存在する.
    return 1;
  }
  return 0;
}

void insert(){//合計数番目の配列に 1 を代入して存在を示す
  H[getkey()] = 1;
}

Measured memory_bytes: 8948
import math
n = int(input())
a = list(map(int,input().split()))

c = [0]*(10**6 + 3)
for i in a:
    c[i] += 1

pairwise = True
for i in range(2,10**6+1):
    if sum(c[::i])>1:
        pairwise = False

g = 0
for i in a:
    g = math.gcd(g,i)
if g == 1:
    setwise = True
else:
    setwise = False

if pairwise == True:
    print("pairwise coprime")
elif setwise == True:
    print("setwise coprime")
else:
    print("not coprime")


Measured memory_bytes: 126744
#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
#define REP3(i,x,n) for(int i=x; i>(n); i--)
#define zero_pad(num) setfill('0') << std::right << setw(num)
#define space_pad(num) setfill(' ') << std::right << setw(num)
#define ALL(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
const long long INF = numeric_limits<long long>::max();
int main(){
    ll H,i = 0;
    cin >> H;
    while(H>0){
        H/=2;
        i*=2;
        i++;
    }
    cout << i;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define rep(i, n) for (i = 0; i < n; i++)
#define rrep(i, n) for (i = n; i >= 0; i--)
#define max(a, b) (a > b ? a : b)
#define min(a, b) (a < b ? a : b)

int eq(char a[50][50], int x, int y, char b[50][50], int s) {
    int i, j;
    rep(i, s) rep(j, s) {
        if (a[x + i][y + j] != b[i][j]) return 0;
    }
    return 1;
}

int main() {
    int n, m;
    scanf("%d %d", &n, &m);
    getchar();

    char a[50][50], b[50][50];
    int i, j;
    rep(i, n) {
        rep(j, n) a[i][j] = getchar();
        getchar();
    }
    rep(i, m) {
        rep(j, m) b[i][j] = getchar();
        getchar();
    }

    rep(i, n - m + 1) rep(j, n - m + 1) {
        if (eq(a, i, j, b, m)) {
            puts("Yes");
            return 0;
        }
    }
    puts("No");
    return 0;
}

Measured memory_bytes: 128
s = input()
p = int(s[:2])
a = int(s[2:])

if 0 < p < 13 and 0 < a < 13:
    print("AMBIGUOUS")
elif 0 < p < 13 and 0 <= a < 100:
    print("MMYY")
elif 0 <= p < 100 and 0 < a < 13:
    print("YYMM")
else:
    print("NA")

Measured memory_bytes: 3060
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <string>
#include <utility>
#include <algorithm>
#include <stack>
#include <map>
#include <set>
#include <queue>
#include <functional>
using namespace std;
typedef long long ll;
int main(){
    int r,g,b,n;
    cin >> r >> g >> b >> n;
    int cnt = 0;
    for(int i = 0;i <= n;i++){
        for(int j = 0;j <= n;j++){
            if(i * r + j * g <= n && (n - i * r - j * g) % b == 0)cnt++;
        }
    }
    cout << cnt << endl;
}

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

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

    int sa;
    sa = b - a;

    int sums_pre = 0;
    int sums_af = 0;
    int temp;
    for (int i = 0; i <= b; i++)
    {
        temp = sums_af;
        sums_af += (sums_af - sums_pre) + 1;
        sums_pre = temp;
//        cout << sums_pre << ":" << sums_af << "!" << sa << endl;
        if(sa == (sums_af - sums_pre)){
            cout << sums_af -  b << endl;
            break;
        }
    } 
}

Measured memory_bytes: 256
//
//AtCoder Beginner Contest 163
//A - Circle Pond
//

#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define reAll(x) (x).rbegin(),(x).rend()
#define zero(a) memset(a, 0, sizeof(a))

using ll = long long;

const double PI=3.14159265358979323846;

int main()
{
    double r;

    cin >> r;

    cout << 2.0 * PI * r << endl;

    return 0;
}


Measured memory_bytes: 3788
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define printVec(v) printf("{"); for (const auto& i : v) { std::cout << i << ", "; } printf("}\n");
#define degreeToRadian(deg) (((deg)/360)*2*M_PI)
#define radianTodegree(rad) (((rad)/2/M_PI)*360)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using namespace std;
using P = pair<int,int>;
using ll = long long;
const ll INF = 1LL<<60;
const int MOD = 1e9 + 7;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

//cin.tie(0);ios::sync_with_stdio(false);
//cout << fixed << setprecision(15) << y << endl;

vector<pair<ll, ll>> prime_factorize(ll n) {
  vector<pair<ll, ll>> res;
  for (ll i = 2; i * i <= n; i++) {
    if (n % i != 0) continue;
    ll ex = 0;
    while (n % i == 0) {
      ++ex;
      n /= i;
    }
    res.push_back({i, ex});
  }
  if (n != 1) res.push_back({n, 1});
  return res;
}

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

  int cnt = 0;
  for (auto v : prime_factorize(N)) {
    //cout << v.first << " " << v.second << endl;
    int n = 1;
    while (v.second - n >= 0) {
      cnt++;
      v.second -= n;
      n++;
    }
  }

  cout << cnt << endl;
  return 0;
}


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

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

    vector<long long>h(n+1);
    rep(i,0,n){
        cin>>h[i];
    }
    h[n]=1000000000;

    int max=0;
    bool jdg=true;

    rep(i,0,n){
        if(h[i]>max){
            max=h[i];
        }
        if(max-h[i+1]>1){
            jdg=false;
        }

    }

    if(jdg){
        cout<<"Yes"<<endl;
    }
    else {
        cout<<"No"<<endl;
    }
}


Measured memory_bytes: 1024
#pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
using namespace std;
inline int my_getchar_unlocked(){
  static char buf[1048576];
  static int s = 1048576;
  static int e = 1048576;
  if(s == e && e == 1048576){
    e = fread_unlocked(buf, 1, 1048576, stdin);
    s = 0;
  }
  if(s == e){
    return EOF;
  }
  return buf[s++];
}
inline void rd(int &x){
  int k;
  int m=0;
  x=0;
  for(;;){
    k = my_getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = my_getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
struct MY_WRITER{
  char buf[1048576];
  int s;
  int e;
  MY_WRITER(){
    s = 0;
    e = 1048576;
  }
  ~MY_WRITER(){
    if(s){
      fwrite_unlocked(buf, 1, s, stdout);
    }
  }
}
;
MY_WRITER MY_WRITER_VAR;
void my_putchar_unlocked(int a){
  if(MY_WRITER_VAR.s == MY_WRITER_VAR.e){
    fwrite_unlocked(MY_WRITER_VAR.buf, 1, MY_WRITER_VAR.s, stdout);
    MY_WRITER_VAR.s = 0;
  }
  MY_WRITER_VAR.buf[MY_WRITER_VAR.s++] = a;
}
inline void wt_L(char a){
  my_putchar_unlocked(a);
}
inline void wt_L(const char c[]){
  int i=0;
  for(i=0;c[i]!='\0';i++){
    my_putchar_unlocked(c[i]);
  }
}
int X;
int Y;
int main(){
  int i;
  rd(X);
  rd(Y);
  for(i=(0);i<(X+1);i++){
    if(Y == 2*i + 4*(X-i)){
      wt_L("Yes");
      wt_L('\n');
      return 0;
    }
  }
  wt_L("No");
  wt_L('\n');
  return 0;
}
// cLay varsion 20200509-1

// --- original code ---
// int X, Y;
// {
//   rd(X, Y);
//   rep(i,X+1){
//     if(Y == 2*i + 4*(X-i)) wt("Yes"), return 0;
//   }
//   wt("No");
// }


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

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())

void solve(){
    int N;
    cin >> N;

    map<ll,ll> D;
    for (int i = 0; i < N; i++) {
        ll d;
        cin >> d;
        D[d]++;
    }

    int M;
    cin >> M;
    for (int i = 0; i < M; i++) {
        ll t;
        cin >> t;
        if (D[t] > 0) {
            D[t]--;
        }else{
            cout << "NO" << endl;
            return;
        }
    }

    cout << "YES" << endl;


    return;
}

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


Measured memory_bytes: 12800
#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
using namespace std;
typedef long long ll;
 
int main() {
  ll d, t, s; cin >> d >> t >> s;
  ll dist = t * s;
  
  if(dist >= d) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 3536
#include <iostream>
#include <string>

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

int main()
{
  int h, w;
  string s;
  cin >> h >> w;
  REP(i, h) {
    cin >> s;
    cout << s << endl;
    cout << s << endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
  
using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define repr(i, n) REPR(i, n, 0)
#define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--)
#define pb push_back
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;

int main(){
    string s;
    cin >> s;
    string t;
    int n = s.size();
    rep(i, n) {
        if(t.empty()) t+=s[i];
        else if(t.back() == 'B' && s[i] == 'C') t.back() = 'D';
        else t+=s[i];
    }
    int m = t.size();
    ll ans = 0LL;
    ll cnt = 0LL;
    rep(i, m) {
        if(t[i] == 'D') {
            ans += cnt;
        }
        else if(t[i] == 'A') ++ cnt;
        else cnt = 0;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 776
#include<bits/stdc++.h>
using namespace std;
 
int main(){
  long long N;
  cin >> N;
  vector<long long> a(3*N);
  long long ans = 0;
  long long cnt = 0;
  for(long long i = 0; i < 3*N; i++){
    cin >> a[i];
  }
  
  sort(a.begin(),a.end(),greater<long long>());
  
  for(long long i = 0; i < 3*N; i++){
    if(cnt == N){
       break;
     }
    if(i % 2 == 1){
    ans += a[i];
    cnt++;
    }
  }
  cout << ans << endl;
  }

Measured memory_bytes: 2560
#include<stdio.h>

#define MAX 100000

int main() {

	int i = 0, j = 0, k, n, tmp, arr[MAX];

	scanf("%d", &n);

	int m = n - 1;

	for (i = 0; i < n; i++)
		scanf("%d", &arr[i]);
	i = 0;
	while (1) {
		
			if (j == m)
			break;
			
		if (arr[j] <= arr[m]) {
			
			tmp = arr[i];
			arr[i] = arr[j];
			arr[j] = tmp;
			i++;
			j++;		
			
			continue;
		}
		
			
		else {
			
			j++;
					
			continue;
		}
			
	}
			tmp = arr[i];
		arr[i] = arr[m];
		arr[m] = tmp;
	
		for (k = 0; k < n; k++) {
	
				if( k == i ){
				
				printf("[%d] ",arr[k]);
				continue;
				}
			
			printf("%d", arr[k]);

			if (k != n - 1)
				printf(" ");
				
		}
			printf("\n");
			return 0;
	}

Measured memory_bytes: 996
# coding: utf-8
from fractions import gcd
N = int(input())
A = list(map(int, input().split()))
l1, l2 = [0] * N, [0] * N
# 左からGCD
for i in range(1, N):
    l1[i] = gcd(l1[i-1], A[i-1])
# 右からGCD
for i in range(N-1)[::-1]:
    l2[i] = gcd(l2[i+1], A[i+1])
ll = []
ans = 0
for i in range(N):
    ans = max(ans, gcd(l1[i], l2[i]))
print(ans)




Measured memory_bytes: 89580
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

X=int(input())
if X>=1800:
    print(1)
elif X>=1600:
    print(2)
elif X>=1400:
    print(3)
elif X>=1200:
    print(4)
elif X>=1000:
    print(5)
elif X>=800:
    print(6)
elif X>=600:
    print(7)
elif X>=400:
    print(8)

Measured memory_bytes: 61976
X, Y= gets.chomp.split.map(&:to_i)

flag = false

(X+1).times do |i|
  a = i
  b = X - i

  if 2 * a + 4 * b == Y
    # puts a
    # puts b
    flag = true
  end
end




puts flag ? 'Yes' : 'No'



Measured memory_bytes: 14380
import sys
x = []
for line in sys.stdin:
    h,w = line.split()
    h,w = int(h), int(w)
    if h == 0 and w== 0: break
    x.append([h,w])

for i in range(len(x)):
    h, w = x[i]
    s = '#' * w
    for j in range(h): print s
    print
    

Measured memory_bytes: 4224
#include<bits/stdc++.h>
using namespace std;
#define maxn 200005
#define mo 998244353
struct Node{
	int x,y;
	bool operator < (const Node &b)const{
		return x<b.x;
	}
}a[maxn];
int b[maxn],c[maxn],n,sum[maxn],lu[maxn],ld[maxn],ru[maxn],rd[maxn];long long pow2[maxn];
void read(){
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		scanf("%d%d",&a[i].x,&a[i].y),b[i]=a[i].x,c[i]=a[i].y;
	}
	sort(b,b+n),sort(c,c+n);
	for(int i=0;i<n;i++){
		a[i].x=lower_bound(b,b+n,a[i].x)-b+1;
		a[i].y=lower_bound(c,c+n,a[i].y)-c+1;
	}
}
inline int lowbit(int x){
	return x&(-x);
}
int Sum(int x){
	int ans=0;
	while(x)ans+=sum[x],x^=lowbit(x);
	return ans;
}
void add(int x){
	while(x<=n)sum[x]++,x+=lowbit(x);
}
int main(){
	read();sort(a,a+n);
	for(int i=0;i<n;i++)lu[i]=Sum(a[i].y),ru[i]=i-lu[i],add(a[i].y);
	memset(sum,0,sizeof(sum));
	for(int i=n-1;i>=0;i--)ld[i]=Sum(a[i].y),rd[i]=n-i-1-ld[i],add(a[i].y);
	pow2[0]=1;for(int i=1;i<=n;i++)pow2[i]=(pow2[i-1]<<1)%mo;
	int ans=0;
	for(int i=0;i<n;i++){
		ans+=(pow2[n]-1-pow2[lu[i]+ld[i]]-pow2[ru[i]+rd[i]]-pow2[lu[i]+ru[i]]-pow2[ld[i]+rd[i]]
		+pow2[lu[i]]+pow2[ld[i]]+pow2[ru[i]]+pow2[rd[i]])%mo;
		ans%=mo;
	}
	printf("%d",(ans+mo)%mo);
	return 0;
}

Measured memory_bytes: 8832
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vll = vector<long long>;
using vp = vector<pair<int, int>>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using vvll = vector<vector<long long>>;
template<class T> inline bool chmax(T &a, T b) { if (a<b) {a=b; return 1;} return 0;}
template<class T> inline bool chmin(T &a, T b) { if (b<a) {a=b; return 1;} return 0;}

const int INF = 1001001001;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int n;
    string s;
    cin >> n >> s;
    
    vi smw(n+1), smb(n+1);
    rep(i, n) {
        smw[i+1] = smw[i] + (s[i] == '.');
        smb[i+1] = smb[i] + (s[i] == '#');
    }
    int ans = INF;
    rep(i, n+1) {
        int now = 0;
        now += smb[i];
        now += smw[n] - smw[i];
        chmin(ans, now);
    }
    cout << ans << endl;
}

Measured memory_bytes: 2196
#![allow(
    non_snake_case,
    unused_variables,
    unused_assignments,
    unused_mut,
    dead_code
)]
use proconio::input;
use proconio::marker::Usize1;
//use proconio::marker::Chars;
//use std::collections::HashSet;
use std::cmp::*;

const INF: usize = 1000_000_000_000;
fn main() {
    input! {
        N: usize,
        M: usize,
        S: usize,
        mut UVAB: [(Usize1,Usize1,usize,u64);M],
        CD:[(usize,u64);N]
    }
    // g[i] = (j, a,b)なら、iからjへ、a円 b時間
    let mut g = vec![vec![]; N];
    for &(u, v, a, b) in UVAB.iter() {
        g[u].push((v, a, b));
        g[v].push((u, a, b));
    }
    // 銀貨最大値
    let w = 50 * 49;
    let mut dp = vec![vec![std::u64::MAX; w + 1]; N];
    // 都市0で銀貨S枚持つまでに0分かかる。
    dp[0][min(w, S)] = 0;
    let mut h = std::collections::BinaryHeap::new();
    // 謎。Heapに、逆順を指定したうえでタプルを加えている模様。
    h.push(Reverse((0, 0, min(w, S))));
    // hからpop出来る限り繰り返す。
    while let Some(Reverse((d, v, k))) = h.pop() {
        // heap は既に訪れた場所？
        // 既に訪れたHeapについて、dp[v][k]のより小さいものが見つかったとしたら、無視。
        // 最初は0,0,Sであり、dp[0][S]=0だから、if式はfalse。
        if d > dp[v][k] {
            continue;
        }
        for &(u, a, b) in g[v].iter() {
            // 移動可能な場所uへの運賃aが、所持金より多い場合、移動不可。
            if a > k {
                continue;
            }
            // そうでなければ移動。移動時間を加えたものをdとすると、
            // 所持金をa減らしてuに到着した場合の時刻dとなるので、
            // dが過去に計算されたdp[u][k-a]を更新できるなら、更新し、
            // hに、検査対象の (d,u,k-a)を追加する。
            let next_d = d + b;
            let next_k = k - a;
            if next_d < dp[u][next_k] {
                dp[u][next_k] = next_d;
                h.push(Reverse((next_d, u, next_k)));
            }
            // 以上を、vから移動可能な路線(u,a,b)のすべてについてチェックする。。
        }
        // 次に換金時間を足す。dは時刻、kは所持金
        let next_d = d + CD[v].1;
        let next_k = min(k + CD[v].0, w);
        if dp[v][next_k] > next_d {
            dp[v][next_k] = next_d;
            h.push(Reverse((next_d, v, next_k)));
        }
    }

    //println!("dp[0]={:?}", &dp[0][0..10]);
    //println!("dp[1]={:?}", &dp[1][0..10]);
    for v in 1..N {
        println!("{}", dp[v].iter().min().unwrap());
    }
}


Measured memory_bytes: 4600
//code by lynmisakura.wish to be accepted!
#include<bits/stdc++.h>
using namespace std;

typedef long long ll;

int main(void){
    int a,b,x;scanf("%d %d %d",&a,&b,&x);
    if(a <= x and x <= a+b){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }
}

Measured memory_bytes: 256
// C++ 14
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define loop(__x, __start, __end) for(int __x = __start; __x < __end; __x++)
//  cout.precision(15); cout << fixed;

// n = x^x + y^y + z^z + xy + yz + zx
// N = X^X + Y^Y + z^z + XY + zY + zX
// z^z + zY + zX = N - x^x - y^y - xy;
// 1000000000000
// 10000 
int main() {
  int n; cin >> n;
  vector<int> C(10001, 0);
  loop(x,1,101) {
    loop(y,1,101) {
      loop(z,1,101) {
        int v = x*x + y*y + z*z + x*y + y*z + z*x;
        if (v > n) continue;
        C[v]++;
      }
    }
  }
  
  loop(i,1,n+1) cout << C[i] << endl;
  return 0;
}


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

int main(){
    int n,a,b;cin>>n>>a>>b;
    string tmp;
    int ans=0;
    for(int i=1;i<=n;i++){
        tmp=str(i);int sum=0;
        for(char c:tmp)sum+=c-'0';
        if(a<=sum&&sum<=b)ans+=i;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 3668
#include <iostream>
#include <algorithm>
#include <cmath>
#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <string.h>
#include <stack>
#define Endl endl
#define mp make_pair
#define ll long long 
#define pii pair<int,int>
#define pll pair<ll,ll>
#define over(A) {cout<<A<<endl;exit(0);}
#define all(A) A.begin(),A.end()
#define ceil(a,b) ((a-1)/b+1)
#define srand() mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define rand(l,r) uniform_int_distribution<int>(l,r)(rng)
typedef unsigned long long ull;
const int inf=1039074182;
using namespace std;
int n;
int a[55];

int main()
{
//	freopen("input.txt","r",stdin);
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
	}
	sort(a,a+n);
	long double res=a[0];
	for(int i=1;i<n;i++)
	{
		res=(res+a[i])/2;
	}
	cout.precision(10);
	cout<<res<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
#define REP(i,n) for(int i=0;i<n;i++)
#define ALL(x) (x).begin(),(x).end()
using namespace std;

//素因数分解
vector<pair<ll,int>> factorize(ll n){
    vector<pair<ll,int>>res;
    for(ll i=2;i*i<=n;i++){
        if(n%i)continue;
        res.emplace_back(i,0);
        while (n%i == 0)
        {
        n /= i;
        res.back().second++;
        }
        
    }
    if(n != 1) res.emplace_back(n,1);
    return res;
}

void trace(int A[],int N){
    REP(i,N){
        if(i>0)printf(" ");
        printf("%d",A[i]);
    }
    printf("\n");
}


int main(){
    int A,B,C,D;
    cin >> A >> B >> C >> D;
    int left = A + B ,right = C + D;
    if(left > right)cout << "Left" << endl;
    else if(right > left)cout << "Right" << endl;
    else cout << "Balanced" << endl;
}

Measured memory_bytes: 256
//#include <tourist>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = 1e9;
const ll LINF = ll(1e18);
const int MOD = 1000000007;
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define rep(i, n) for (int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define debug(v)          \
    cout << #v << ":";    \
    for (auto x : v)      \
    {                     \
        cout << x << ' '; \
    }                     \
    cout << endl;
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;
}
//cout<<fixed<<setprecision(15);有効数字15桁
//-std=c++14
//-std=gnu++17
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a, b;
    cin >> a >> b;
    int sum = 0;
    for (int i = a; i <= b; i++)
    {
        string s = to_string(i);
        bool check = false;
        rep(j, s.size() / 2)
        {
            if (s[j] != s[s.size() - 1 - j])
                check = true;
        }
        if (!check)
            sum++;
    }
    cout << sum << "\n";
}


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

const int MAX_W = 8;
const int mod = 1e9+7;
LL dp[MAX_W];

bool get_bit(int mask, int j) {
	return ((mask>>j) & 1);
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int H, W, K;
	cin >> H >> W >> K;

	dp[0] = 1;
	for(int i=0; i<H; i++) {
		LL ndp[MAX_W] = {};
		for(int mask=0; mask<(1<<(W-1)); mask++) {
			bool ng = false;
			for(int b=0; b<W-2; b++)
				if(get_bit(mask, b) && get_bit(mask, b+1)) ng = true;
			if(ng) continue;
			for(int j = 0; j < W; j++) {
				if(j>0 && get_bit(mask, j-1)) (ndp[j-1] += dp[j]) %= mod;
				else if(j+1<W && get_bit(mask, j)) (ndp[j+1] += dp[j]) %= mod;
				else (ndp[j] += dp[j]) %= mod;
			}
		}
        swap(dp, ndp);
	}

	cout << dp[K-1] << endl;
	return 0;
}

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

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

	int N, Y;
	scanf("%d %d", &N, &Y);

	for (int i = 0; i <= N && i * 10000 <= Y; i++) {
		for (int j = 0; j <= N - i && j * 5000 <= Y - i * 10000; j++) {
			if (i * 10000 + j * 5000 + (N - i - j) * 1000 == Y) {
				cout << i << " " << j << " " << N - i - j;
				return 0;
			}
		}
	}

	cout << "-1 -1 -1";

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <random>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define repp(i,n,m) for (int i = m; i < (n); ++i)
#define repl(i,n) for (long long i = 0; i < (n); ++i)
#define reppl(i,n,m) for (long long i = m; i < (n); ++i)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using PL = pair<long long, long long>;
using Pxy = pair<double, double>;
using T = tuple<int, int, bool>;
const int INF = 1001001007;
const int mod = 1000000007;
const int MOD = 998244353;
const ll inf = 1e18;
template <typename AT>
void printvec(vector<AT> &ar){
    rep(i,ar.size()-1) cout << ar[i] << " ";
    cout << ar[ar.size()-1] << endl;
}
template <typename Q>
void printvvec(vector<vector<Q>> &ar){
    rep(i,ar.size()){
        rep(j,ar[0].size()-1) cout << ar[i][j] << " ";
        cout << ar[i][ar[0].size()-1] << endl;
    }
}
template <typename S>
bool range(S a, S b, S x){
    return (a <= x && x < b);
}

void yes(){
    cout << "Yes" << endl;
}

void no (){
    cout << "No" << endl;
}

ll cel (ll a, ll b){
    if (a % b == 0) return a / b;
    else return a / b + 1;
}

ll gcds(ll a, ll b){
    ll c = a % b;
    while (c != 0){
        a = b;
        b = c;
        c = a % b;
    }
    return b;
}

int main() {
    string s; cin >> s;
    ll ans = 0;
    rep(i,s.size()){
        int a = stoi(s.substr(i,1));
        ans += a;
    }
    if (ans % 9 == 0) yes();
    else no();
}

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

int main() {
    int ans = 0;
    int N;
    cin >> N;
    vector<int> d(N);
    for(size_t i = 0; i < N; i++) {
        cin >> d[i];
    }
    for(size_t i = 0; i < N; i++) {
        for(size_t j = i + 1; j < N; j++) {
            ans += d[i] * d[j];
        }
    }

    cout << ans << endl;
}

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

int main()
{
	int x, y;
	
	
	while( 1 ){
		cin >> x >> y;
		if(x == 0 && y == 0){
			 break;
		}
		
		if (x < y){
			cout << x << " " << y << endl;
		}else{
			cout << y << " " << x << endl;
		}
	}
	
	return 0;
}

Measured memory_bytes: 3004
#![allow(unused_imports)]

use std::{i32, i64, u32, u64, usize, f64};
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::io::{stdout, Write, BufWriter};
use std::mem::{swap};
use maplit::*;
use proconio::marker::{Isize1, Usize1, Bytes, Chars};

#[proconio::fastout]
fn main() {
    proconio::input!(
        x: i32,
    );
    let mut t = 0;
    for i in 0.. {
        if x <= t && x < t + i {
            println!("{}", i - 1);
            return;
        }
        t += i;
    }
}


Measured memory_bytes: 2176
#include <bits/stdc++.h>
using namespace std;
int main(){
  string A, B;
  cin >> A >> B;
  int nagasa = max(A.size(),B.size());
  vector<char> a(nagasa);
  vector<char> b(nagasa);
  for(int i=0; i<nagasa; i++){
    if(A.size()<B.size()){
      b.at(i) = B.at(i);
      if(i<B.size()-A.size()){
        a.at(i) = '0';
      }else{
        a.at(i) = A.at(i-(B.size()-A.size()));
      }
    }
    if(B.size()<A.size()){
      a.at(i) = A.at(i);
      if(i<A.size()-B.size()){
        b.at(i) = '0';
      }else{
        b.at(i) = B.at(i-(A.size()-B.size()));
      }
    }
    if(A.size() == B.size()){
      a.at(i) = A.at(i);
      b.at(i) = B.at(i);
    }
  }
  for(int i=0; i<nagasa; i++){
    if(a.at(i) > b.at(i)){
      cout << "GREATER" << endl;
      return  0;
    }
    if(a.at(i) < b.at(i)){
      cout << "LESS" << endl;
      return  0;
    }
    if(a.at(i) = b.at(i)){
      if(i == nagasa-1){
        cout << "EQUAL" << endl;
        return  0;
      }
    }
  }
}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
using namespace std;
int main(){
	double A,B,C,D;
	long long space1,space2;
cin>>A>>B>>C>>D;
	space1=A*B;
	space2=C*D;
	if(space1==space2)
	printf("%lld",space1);
	else if(space1>space2)	
	printf("%lld",space1);
	else if(space2>space1)
		printf("%lld",space2);}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
  int main(){
   char x[10000];
   int z[10000];
   gets(x);
   int y=strlen(x);
   int i;
   for(i=0;i<y;i++){
       z[i]=x[i]-'a';
        if(z[i]>=0){
           if(z[i]<=25){
             z[i] -= 32;
             x[i]=z[i]+'a';
}
}
}
puts(x);

return 0;
}
   

Measured memory_bytes: 524
#include<iostream>
#include<algorithm>
#include<string>
#include<queue>
#include<stack>
#include<vector>
#include<list>
#include<math.h>
using namespace std;

#define ll long long

int main(){
  string S;
  cin >> S;
  int mins=200000,maxs=0;
  for(int i=0;i<S.length();i++){
    if(S[i]=='A'){
      mins=min(mins,i);
    }
    if(S[i]=='Z'){
      maxs=max(maxs,i);
    }
  }
  cout << maxs - mins +1 << endl;
  return 0;
}

Measured memory_bytes: 640
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int a[][] = new int[2][n];
        for (int i = 0; i < 2; i++) {
            for (int j = 0; j < n; j++) {
                a[i][j] = sc.nextInt();
            }
        }
        for (int i = 0; i < 2; i++) {
            for (int j = 1; j < n; j++) {
                a[i][j] = a[i][j] + a[i][j - 1];
            }
        }
        int ans = a[0][0] + a[1][n - 1];
        for (int i = 1; i < n; i++) {
            int tmp = a[0][i] + a[1][n - 1] - a[1][i - 1];
            ans = Math.max(ans, tmp);
        }
        System.out.println(ans);
        sc.close();
    }
}


Measured memory_bytes: 21844
mod=10**9+7
n,m=map(int,input().split())
X=list(map(int,input().split()))
Y=list(map(int,input().split()))
Sx=0
for i,x in enumerate(X):
    Sx=(Sx+i*x%mod-(n-i-1)*x%mod)%mod
Sy=0
for j,y in enumerate(Y):
    Sy=(Sy+j*y%mod-(m-j-1)*y%mod)%mod
print(Sx*Sy%mod)

Measured memory_bytes: 18556
#include<bits/stdc++.h>
using namespace std;
long long attack(long long hp){
    if(hp>1){
        return 2*attack(hp/2)+1;
    }else if(hp==1){
        return 1;
    }else{
        return 0;
    }
}
int main(){
    long long  h;
    long long ans=0;
    cin >> h;
    ans = 2 * attack(h/2)+1;
    cout << ans << endl;
    return 0;
}

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

int main(){
	string n;
	cin>>n;
	int ans=0;
	for(unsigned int i=0;i<n.length();i++){
		ans+=n[i]-48;
    }
	int m;
	m=stoi(n);
	if(m%ans==0){
		cout<<"Yes"<<endl;
	}
	else
		cout<<"No"<<endl;
	return 0;
}

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



int main(){
	int L,R,d;
	
	scanf("%d%d%d",&L,&R,&d);
	int i,cnt=0;
	for(i=L;i<=R;i++){
		if(i%d==0)cnt++;
	}
	printf("%d\n",cnt);

	return 0;
}


Measured memory_bytes: 1728
#include "bits/stdc++.h"

using namespace std;
typedef long long int ll;
typedef pair<ll, ll > pi;  
typedef pair<pair<ll, ll >, ll > pii;  
vector<ll > vec;
vector<vector<ll > > vec2;
ll MOD = 1000000007;
ll INF = 11451419194545;

int main(){
    ll s; cin >> s;
    vector<ll > vec;
    vec.push_back(s);
    ll cn = 1;
    while(true){
        if(s % 2 == 0){
            vec.push_back(s/2);
        }else{
            vec.push_back(3 * s + 1);
        }
        s = vec[cn];
        for(ll i = 0; i < cn-1; i++){
            if(vec[i] == vec[cn]){
                cout << cn + 1 << endl;
                return 0;
            }
        }
        cn++;

        
        
    }
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define INF 100000000;

int main(){
    int n,k;cin>>n>>k;
    vector<int> p(n);
    for (int i=0;i<k;i++){
        int d;cin>>d;
        for (int j=0;j<d;j++){
            int a;cin>>a;
            p[a-1] = 1;
        }
    }
    int ans=0;
    for (int i=0;i<n;i++){
       if (p[i]==0){
           ans++;
       } 
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3604
n=int(input())
l=[]
for i in range(n):
  n1=int(input())
  l1=[]
  for j in range(n1):
    a,b=map(int,input().split())
    l1.append([a,b])
  l.append(l1)
num=2**n
bitlist=[]
for i in range(1,1+num):
  num1=num-i
  b1=[]
  while num1!=0 or len(b1)<n:
    b1.append(num1%2)
    num1//=2
  bitlist.append(b1)
#各b1の要素が1の時その人は正直者
ans=0
for i in range(num):
  b=bitlist[i]
  bool1=True
  for j in range(n):
    if not bool1:
      pass
    elif b[j]==0:
      pass
    else:#jは正直者だから発言は全て本当 整合性必要
      for k in l[j]:
        n1=k[0]
        n2=k[1]
        if b[n1-1]!=n2:
          bool1=False
  count=0
  if bool1:
    for j in b:
      if j==1:
        count+=1
    if count>ans:
      ans=count
print(ans)

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

public class Main {
	static PrintWriter out;
	static StringBuilder sb;
	static int mod = 998244353;
	static long inf = (long) 1e18 + 1;
	static int[] col;
	static int n, m;
	static ArrayList<Integer>[] ad;
	static long[][][] memo;
	static HashSet<Integer> h;
	static int[] a;
	static Integer[][] g;

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		out = new PrintWriter(System.out);
		int a=sc.nextInt();
		HashSet<String>s=new HashSet<>();
		while(a-->0)
			s.add(sc.nextLine());
		System.out.println(s.size());
		out.flush();
	}

	static long modPow(long a, long e)

	{
		long res = 1;
		while (e > 0) {
			if ((e & 1) == 1)
				res = (res * a) % mod;
			a = (a * a) % mod;
			e >>= 1;
		}
		return res;
	}

	static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream system) {
			br = new BufferedReader(new InputStreamReader(system));
		}

		public Scanner(String file) throws Exception {
			br = new BufferedReader(new FileReader(file));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public String nextLine() throws IOException {
			return br.readLine();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}

		public char nextChar() throws IOException {
			return next().charAt(0);
		}

		public Long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public int[] nextArrInt(int n) throws IOException {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		}

		public long[] nextArrLong(int n) throws IOException {
			long[] a = new long[n];
			for (int i = 0; i < n; i++)
				a[i] = nextLong();
			return a;
		}

		public boolean ready() throws IOException {
			return br.ready();
		}

		public void waitForInput() throws InterruptedException {
			Thread.sleep(3000);
		}
	}
}

Measured memory_bytes: 66412
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

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


int main()
{
    int H, W, K;
    cin >> H >> W >> K;
    vector<string> s(H);
    REP(i, H) cin >> s[i];

    // 行ごとのいちごの数をチェック
    int appear = 0;
    bool first_appear = false;
    vector<int> num_s(H, 0), sum_num_s(H, 0);
    REP(i, H){
        REP(j, W){
            if(s[i][j] == '#') ++num_s[i];
        }
        if(i == 0) sum_num_s[i] = num_s[i];
        else sum_num_s[i] = sum_num_s[i-1] + num_s[i];
        if(num_s[i] > 0 and !first_appear) appear = i;
        if(num_s[i] > 0) first_appear = true;
    }

    int num = 0;
    vector<vector<int>> ans(H, vector<int>(W));
    FOR(i, appear, H){
        if(num_s[i] == 0){
            REP(j, W) ans[i][j] = ans[i-1][j];
        }else if(num_s[i] == 1){
            ++num;
            REP(j, W) ans[i][j] = num;
        }else{
            ++num;
            REP(j, W){
                ans[i][j] = num;
                if(s[i][j] == '#' and sum_num_s[i] != num) ++num;
            }
        }
    }
    for(int i = appear-1; i >= 0; --i){
        REP(j, W) ans[i][j] = ans[i+1][j];
    }

    REP(i, H){
        REP(j, W) cout << ans[i][j] << " ";
        cout << endl;
    }

    return 0;
}

Measured memory_bytes: 1280