akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define F first
#define S second
#define PB push_back
#define EB emplace_back
#define ALL(a) a.begin(), a.end()
#define RALL(a) a.rbegin(), a.rend()
#define REP(i, a) for (int i(0), _##i(a); i < _##i; ++i)
#define FOR(i, a, b) for (int i(a), _##i(b); i <= _##i; ++i)

#ifdef LOCAL
#define _NTH_ARG(_1, _2, _3, _4, _5, _6, N, ...) N
#define _FE_1(_CALL, x) _CALL(x)
#define _FE_2(_CALL, x, ...) _CALL(x) _FE_1(_CALL, __VA_ARGS__)
#define _FE_3(_CALL, x, ...) _CALL(x) _FE_2(_CALL, __VA_ARGS__)
#define _FE_4(_CALL, x, ...) _CALL(x) _FE_3(_CALL, __VA_ARGS__)
#define _FE_5(_CALL, x, ...) _CALL(x) _FE_4(_CALL, __VA_ARGS__)
#define _FE_6(_CALL, x, ...) _CALL(x) _FE_5(_CALL, __VA_ARGS__)
#define FOR_EACH_MACRO(MACRO, ...)                                             \
  _NTH_ARG(__VA_ARGS__, _FE_6, _FE_5, _FE_4, _FE_3, _FE_2, _FE_1)              \
  (MACRO, __VA_ARGS__)
#define watch(x) cerr << "\033[1;32m" #x " = \033[1;34m" << (x) << "\033[0m; ";
#define debug(...)                                                             \
  cerr << "\033[2;31mLine " << __LINE__ << ": \033[0m";                        \
  FOR_EACH_MACRO(watch, __VA_ARGS__)                                           \
  cerr << endl
#else
#define debug(...)
#endif

using namespace std;

template <class T1, class T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) {
  return os << '{' << p.first << ", " << p.second << '}';
}

template <class T, class = decltype(begin(declval<T>())),
          class = enable_if_t<!is_same<T, string>::value>>
ostream &operator<<(ostream &os, const T &c) {
  os << '[';
  for (auto it = begin(c); it != end(c); ++it)
    os << (it == begin(c) ? "" : ", ") << *it;
  return os << ']';
}
using ll = long long;

#define off(b, th) (b & ~(1 << th))

void solve() {
  int n;
  cin >> n;
  vector<vector<int>> a(n, vector<int>(n));
  REP(i, n) REP(j, n) cin >> a[i][j];

  const ll MOD = 1e9 + 7;

  vector<vector<ll>> dp(n, vector<ll>(1 << n, -1));
  
  function<ll(int,int)> bt = [&](int i, int state) -> ll {
    if (i == n){
      return 1ll;
    }
    ll &res = dp[i][state];
    if (res != -1) return res;
    res = 0;
    REP(j, n){
      if (a[i][j] && (state >> j & 1)){
        res = (res + bt(i + 1, off(state, j))) % MOD;
      }
    }
    return res;
  };

  int state = (1 << n) - 1;
  ll ans = bt(0, state);
  cout << ans << "\n";
}

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

  int T = 1;
  // cin >> T;
  while (T--) {
    solve();
  }
}


Measured memory_bytes: 360832
#include<bits/stdc++.h>
using namespace std;
typedef long long llint;
const llint MOD = 1e9 + 7;

int main() {
    llint A, B;
    cin >> A >> B;
    llint curr = 1, rez = 0;
    while(curr < B) {
        curr += A - 1;
        rez++;
    }
    cout << rez;
}

Measured memory_bytes: 256
#include <iostream>
#include <stack>
   
int main(){
    std::stack<u_int> train;
    u_int num;
    while(std::cin >> num){
        if(num == 0){
            std::cout << train.top() << std::endl;
            train.pop();
        }else{
            train.push(num);
        }
    }
    return 0;
}

Measured memory_bytes: 3008
import java.util.*;
import java.util.regex.*;

public class Main {
	
	public static void main(String... args) {
		System.out.println(countTakahashi(scanInt(), scanInt()));
	}
	
	private static int countTakahashi(int a, int b) {
		return a - ((b < a) ? 1 : 0);
	}

	
	private static final Scanner SC = new Scanner(System.in);

	private static int scanInt() {
		return SC.nextInt();
	}

	private static  String scanString() {
		return SC.next();
	}
}


Measured memory_bytes: 22612
#include <iostream>

using namespace std;

int solve(int K)
{
	int x = 0;
	for (int i = 1; i <= K; ++i) {
		x = (10 * x + 7) % K;
		if (x == 0) {
			return i;
		}
	}
	return -1;
}

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

	cout << solve(K) << endl;
}


Measured memory_bytes: 3572
loop {
	n = gets.to_i
	break if n == 0

	points = [[0, 0]] + (1..n).map{ gets.split.map(&:to_i) }.sort
	route = []

	loop {
		path = [points[0]]
		(1..points.size-1).each{|i|
			if path.size >= 2
				x1, y1 = path[-2]
				x2, y2 = path[-1]
				x3, y3 = points[i]

				if x1 != x2
					if x2 == x3 || (y2 - y1).to_f / (x2 - x1) < (y3 - y2).to_f / (x3 - x2) 
						path.pop
						redo
					end
				end
			end
			path << points[i]
		}

		if path.size == points.size
			route += path
			break
		end

		path.pop
		route += path
		points -= path
		points.reverse!
	}

	total_dist = route.each_cons(2).map{|u, v|
		x1, y1 = u
		x2, y2 = v
		Math.sqrt((x1-x2)**2 + (y1-y2)**2)
	}.inject(:+)
	printf("%.1f\n", total_dist)
}

Measured memory_bytes: 6296
#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>
typedef long long ll;
using namespace std;
void Palace() {
	int N,T,A;
	cin >> N;
	cin >> T >> A;
	double a = 1000000;
	int res = 0;
	for (size_t i = 0; i < N; i++)
	{
		int h;
		cin >> h;
		double t = T - h * 0.006;
		if (abs(t - A) < a) {
			a = abs(t - A);
			res = i;
		}
	}
	cout << (res + 1)<< endl;
}
int main() {
	Palace();
	return 0;
}

Measured memory_bytes: 256
n = int(input())
d = []
for i in range(n):
    d1,d2 = map(int, input().split())
    d.append([d1,d2])

cnt = 0
for i in range(n-2):
    if d[i][0] == d[i][1] and d[i+1][0] == d[i+1][1] and d[i+2][0] == d[i+2][1]:
        print("Yes")
        exit()
print("No")

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

int main() {
  std::string s;
  std::cin >> s;
  int l = s.size();
  for(int i = 0; i < l/2; ++i) if(s[i] != s[l-1-i]) {
    std::cout << "No";
    return 0;
  }
  for(int i = 0; i < l/2; ++i) if(s[i] != s[l/2+1+i]) {
    std::cout << "No";
    return 0;
  }
  std::cout << "Yes";
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define All(V) V.begin(), V.end()
typedef long long int ll;
typedef pair<int, int> P;
const ll MOD = 1e9+7, INF = 1e9;

int main()
{
  ll n, m;cin >> n >> m;
  ll sum = 0;
  rep(i, m){
    int a; cin >> a;
    sum += a;
  }
  if(sum > n)cout << -1 << endl;
  else cout << n-sum << endl;

  system("pause");
}


Measured memory_bytes: 3700
#include "bits/stdc++.h"
#include <set>

using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define all(i) (i).begin(), (i).end()
#define rall(i) (i).begin(), (i).end(), greater<int>()
#define int long long
#define elif else if
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define fst first
#define sec second
#define mod 1000000007
#define INF 10e10
template <typename T>

void print(T x)
{
	std::cout << x << " ";
}

template <typename T>

void println(T x)
{
	std::cout << x << "\n";
}


signed main(void) {
	int n;
	cin >> n;
	vector<int>name(5);
	string march = "MARCH";
	rep(i, n) {
		string s;
		cin >> s;
		rep(i, 5) {
			if (s[0] == march[i]) name[i]++;
		}
	}
	int ans = 0;
	for (int bit = 0; bit < (1 << 5); ++bit) {
		vector<int> a;
		for (int i = 0; i < 5; ++i) {
			if (bit & (1 << i)) {
				a.push_back(i);
			}
		}
		if (a.size() != 3)continue;
		ans += name[a[0]] * name[a[1]] * name[a[2]];
	}
    cout<<ans<<endl;
}

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

int64_t mod = 1000000007;
int64_t large = 9223372036854775807;
double PI = 3.141592653589793;

int main()
{
    int r, g, b;
    cin >> r >> g >> b;
    if ((g * 10 + b) % 4 == 0)
        cout << "YES";
    else
        cout << "NO";
}

Measured memory_bytes: 256
while 1:
    n,m=map(int,input().split())
    if n==m==0:
        break
    A=sorted(map(int,input().split()))
    def f():
        j=n-1
        yield 0
        for i in range(n):
            while j >=0 and m<A[i]+A[j]:
                j-=1
            if j <=i:
                break
            if j >=0:
                yield A[i]+A[j]
    print(max(f())or"NONE")


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

int main(){
  int x;
  cin >> x;
  if(x >= 30) cout << "Yes" << endl;
  else cout << "No" << endl;
}


Measured memory_bytes: 3572
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#include<map>
#include<iomanip>
#include<queue>
#include<stack>
#include<time.h>
#define rep(i,n)for(ll i=0;i<n;i++)
#define ll long long
#define ggr getchar();getchar();return 0;
#define prique priority_queue
#define inf 1145141919364364
#define double long double
using namespace std;
typedef pair<ll, ll>P;
ll gcd(ll x, ll y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
ll lcm(ll x, ll y) {
	return x * y / gcd(x, y);
}
ll a[114];
ll memo[114];
signed main() {
	ll n, ans = inf;
	cin >> n;
	rep(i, n)cin >> a[i];
	memo[0] = a[0];
	for (int i = 1; i < n; i++)memo[i] = memo[i - 1] + a[i];
	rep(i, n) {
		ans = min(ans, abs(memo[i] - (memo[n - 1] - memo[i])));
	}
	cout << ans << endl;
	ggr
}


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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;

#define MOD 1000000007
#define REP(i, N) for (int i = 0; i < N; ++i)
#define REP1(i, N) for (int i = 1; i <= N; ++i)
#define RREP(i, N) for (int i = N - 1; i >= 0; --i)
#define ALL(a) a.begin(), a.end()

int main() {
  int N;
  cin >> N;
  int A[N][N];
  bool cand[N][N];
  REP(i, N) REP(j, N) {
    cin >> A[i][j];
    cand[i][j] = true;
  }
  REP(k, N) REP(i, N) REP(j, N) {
    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] && 0 < A[i][k] && 0 < A[k][j]) {
      cand[i][j] = false;
    }
  }
  ll ans = 0;
  REP(i, N) REP(j, N) {
    if (cand[i][j]) ans += A[i][j];
  }
  cout << ans / 2 << endl;
  return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <numeric>
#include <string>
#include <cmath>

#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
	int x, y;
	int amari;
	int max,min;
	cin >> x >> y;

	amari = y % 2;
	if (amari >= 1) { cout << "No"; return 0; }
	if (x == 1 and (y == 2 or y == 4)) { cout << "Yes"; return 0; }

	max = x * 4;
	min = x * 2;
	if (x >= 2 and (max >= y and min <= y) ){
		cout << "Yes";
	}
	else {
		cout << "No";
	}


	return 0;
}


Measured memory_bytes: 3620
import itertools

N,M = (int(i) for i in input().split())
li = [[None]*N for i in range(N)]
cnt = 0

for i in range(N):
  li[i][i] = 1

for j in range(M):
  a,b = (int(i)-1 for i in input().split())
  li[a][b] = 1
  li[b][a] = 1

for i in itertools.permutations(range(1,N)):
  if li[i[0]][0] == 1:
    flag = True
    for j in range(1,N-1):
      if li[i[j]][i[j-1]] == None:
        flag = False
        break
    if flag:
      cnt += 1

print(cnt)

Measured memory_bytes: 3064
#include <stdio.h>
#define N 47

int a[N];
int fib(int n)
{
  if(a[n]==0){
    if(n<2) a[n]=1;
    else a[n]=fib(n-1)+fib(n-2);
  }
  return a[n];
}

int main()
{
  int n;
  scanf("%d",&n);
  printf("%d\n",fib(n));
  return 0;
}

Measured memory_bytes: 596
import sys
s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in ss]
ss2nnn = lambda ss: [s2nn(s) for s in ss]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [sys.stdin.readline().rstrip() for _ in range(n)]
ii2sss = lambda n: [list(sys.stdin.readline().rstrip()) for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))
from collections import deque  # 双方向キュー
from collections import defaultdict  # 初期化済み辞書
from heapq import heapify, heappush, heappop, heappushpop  # プライオリティキュー
from bisect import bisect_left, bisect_right  # 二分探索
sys.setrecursionlimit(int(1e+6))
MOD = int(1e+9) + 7
#import numpy as np  # 1.8.2
#import scipy  # 0.13.3

def main():
    N = i2n()
    A = i2nn()
    B = i2nn()
    n = 0   # 倒すモンスター数
    for i in range(N):
        t = min(A[i], B[i])
        n += t
        A[i] -= t
        B[i] -= t
        t = min(A[i+1], B[i])
        n += t
        A[i+1] -= t
        B[i] -= t
    print(n)
    #print(A)
    #print(B)

main()


Measured memory_bytes: 77856
#include <iostream>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <limits>
#include <string>
#include <algorithm>
#include <bitset>
#include <unordered_set>
#include <unordered_map>
#include <map>
#include "math.h"
#include "assert.h"

using namespace std;

#define BUFF ios::sync_with_stdio(false)
#define epsilon 1e-07
#define pi 2 * acos(0.0);
#define mod 1000000007   // 1e9+7
#define ll long long
#define cerr if(false)cerr
#define watch(x) cerr << #x << " = " << x << endl;

int main() {
	ll n;
	cin >> n;
	vector<string> v(n); 
	for(ll i=0; i<n; i++) {
		cin >> v[i];
		sort(v[i].begin(), v[i].end());
	}
	sort(v.begin(), v.end());

	ll atual = 0;
	ll ans = 0;
	v.push_back("@");
	for(ll i=1; i<n+1; i++) {
		if (v[i] != v[i-1]) {
			ll k = i - atual;
			ans += k * (k-1) /2;
			atual = i;
		}
	}
	cout << ans << endl;

}


Measured memory_bytes: 8064
#include <iostream>
#include <iomanip>
#include <string>
#include <cmath>
#include <numeric>
#include <climits>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <functional>
#include <utility>
#include <cctype>
#include <iterator>
////////////////////////////////////////////////
#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++)
#define REPvec(itr, mp) for (auto itr = mp.begin(); itr != mp.end(); itr++)
#define REPe(e, mp) for (auto& e : mp)
#define all(x) x.begin(), x.end()
#define MOD 1000000007  // 1e9+7
using namespace std;
using ll = long long int;
using vecint = vector<int>;
using vecll = vector<ll>;
using vec2int = vector<vector<int>>;
using P = pair<int, int>;
////////////////////////////////////////////////
void chmax(int& a, int b) {
  if (a < b) a = b;
}
////////////////////////////////////////////////
int main() {
  ////////////////////////////////////////////////
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  ////////////////////////////////////////////////
  int n;
  cin >> n;
  vecint a(n, 0);
  REPe(e, a) cin >> e;
  ll x = 0;
  ll y = 1000;
  REP(i, n - 1) {
    if (a[i] < a[i + 1]) {
      ll k = y / a[i];
      y -= k * a[i];
      y += k * a[i + 1];
    }
  }
  cout << y << endl;
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
using i64 = long long;

int main() {
    int n, m;
    std::cin >> n >> m;
    std::vector<int> a(n);
    for (auto &e : a) std::cin >> e;
    const int s = std::accumulate(a.begin(), a.end(), 0);
    const int cnt = std::count_if(a.begin(), a.end(), [=](int t) { return t * 4 * m >= s; });
    std::cout << (cnt >= m ? "Yes" : "No") << std::endl;

    return 0;
}


Measured memory_bytes: 256
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        #[cfg(debug_assertions)]
        writeln!(&mut std::io::stderr(), concat!("[DEBUG] ", $(stringify!($a), "={:?} "),*), $($a),*);
    }
}

#[allow(unused_imports)]
use std::cmp::{min, max};

#[allow(unused_imports)]
use std::io::Write;

fn main() {
    input!{
      n: usize,
      a: usize1,
      b: usize1,
      c: usize1,
      d: usize1,
      s: chars
    }
    // 2マスNGが続いてはならない
    for i in a+1..c+1 {
        if s[i] == '#' && s[i-1] == '#' {
            println!("{}", "No");
            return;
        }
    }

    for i in b+1..d+1 {
        if s[i] == '#' && s[i-1] == '#' {
            println!("{}", "No");
            return;
        }
    }

    if c > d {
        //逃げ場チェック
        for i in b-1..d {
            if i + 2 < n  {
                if s[i] == '.' && s[i+1] == '.' && s[i+2] == '.' {
                    println!("{}", "Yes");
                    return;
                }
            }
        }
        return println!("{}", "No");
    }
    println!("{}", "Yes");
}


Measured memory_bytes: 4352
#include<stdio.h>

int main(void) {
	int x, y, r, i,work;

	scanf("%d %d", &x, &y);

	if (x < y) {
		work = x;
		x = y;
		y = work;
	}

	while (y > 0) {
		r = x%y;
		x = y;
		y = r;
	}

	printf("%d\n", x);

	return 0;
}


Measured memory_bytes: 2736
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.Map.Entry;

import java.util.PriorityQueue;
import java.util.StringTokenizer;
import java.util.TreeSet;

public class Main {
	
	public static class Move {
		int fx, fy, gx, gy;
		
		public Move(int fx, int fy, int gx, int gy) {
			this.fx = fx;
			this.fy = fy;
			this.gx = gx;
			this.gy = gy;
		}
		
		public String toString() {
			return this.fy + " " + this.fx + " " + this.gy + " " + this.gx;
		}
	}
	
	public static int[][] move_dirs = {{0, 1}, {0, -1}, {1, 0}, {-1, 0}};
	public static boolean in_range(int x, int y, int W, int H) {
		return 0 <= x && x < W && 0 <= y && y < H;
	}
	
	public static void main(String[] args) throws IOException {
		try(final Scanner sc = new Scanner(System.in)){
			final int N = sc.nextInt();
			
			int[] xs = new int[N];
			int[] ys = new int[N];
			int[] hs = new int[N];
			for(int i = 0; i < N; i++) {
				xs[i] = sc.nextInt();
				ys[i] = sc.nextInt();
				hs[i] = sc.nextInt();
			}		
			
			final int H = 100 + 1;
			final int W = 100 + 1;
			for(int item = 0; item < N; item++) {
				for(int y = 0; y < H; y++) {
					LOOP: for(int x = 0; x < W; x++) {
						final int height = hs[item] + Math.abs(x - xs[item]) + Math.abs(y - ys[item]);
								
						for(int other = 0; other < N; other++) {
							final int h_ = Math.max(0, height - Math.abs(x - xs[other]) - Math.abs(y - ys[other]));
								
							if(h_ != hs[other]) { 
								continue LOOP;
							}
						}
						
						System.out.println(x + " " + y + " " + height);
						return;
					}	
				}
			}
		}
	}

	public static class Scanner implements Closeable {
		private BufferedReader br;
		private StringTokenizer tok;

		public Scanner(InputStream is) throws IOException {
			br = new BufferedReader(new InputStreamReader(is));
		}

		private void getLine() throws IOException {
			while(!hasNext()){
				tok = new StringTokenizer(br.readLine());
			}
		}

		private boolean hasNext() {
			return tok != null && tok.hasMoreTokens();
		}

		public String next() throws IOException {
			getLine();
			return tok.nextToken();
		}

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

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

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

		public int[] nextIntArray(int n) throws IOException {
			final int[] ret = new int[n];
			for(int i = 0; i < n; i++){
				ret[i] = this.nextInt();
			}
			return ret;
		}

		public long[] nextLongArray(int n) throws IOException {
			final long[] ret = new long[n];
			for(int i = 0; i < n; i++){
				ret[i] = this.nextLong();
			}
			return ret;
		}

		public void close() throws IOException {
			br.close();
		}
	}
}

Measured memory_bytes: 21332
#include<stdio.h>
#include<math.h>

int main(void){
	
	int a,b;
	char op;
	
	while(1){
		scanf("%d %c %d", &a, &op, &b);
		if( op == '?' ){
		break;
		}else if( op == '+' ){
			printf( "%d\n", a+b );
		}else if( op == '-' ){
			printf( "%d\n", a-b );
		}else if( op == '*' ){
			printf( "%d\n", a*b );
		}else if( op == '/' ){
			printf( "%d\n", a/b );
		}
	}
	
	return 0;
}


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

using namespace std;

int main()
{
    string s;
    cin>>s;
    int  flag=1;
    int n=s.size();
    for(int i=0;i<n/2 && flag;i++)
        if(s[i]!=s[n-1-i]) flag=0;
    int m=(n-1)/2;
    for(int i=0;i<m/2 && flag;i++)
        if(s[i]!=s[m-1-i]) flag=0;
    m=(n+3)/2;
    for(int i=m-1;i<n && flag;i++)
        if(s[i]!=s[n-1-i]) flag=0;
    flag?cout<<"Yes":cout<<"No";

    return 0;
}


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

int main(){
    int x, y;
    cin >> x >> y;
    for(int i = 0; i <= x; i++){
        if(i*2 + (x-i)*4 == y){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
}

Measured memory_bytes: 3632
#include<iostream>
#include<vector>
#define long long int
using namespace std;
int main()
{
  int m,n,q,i;
  vector<int>vec;
  
  cin>>q;
  while(q--){
    cin>>m;
    if(m==0){
      cin>>n;
      vec.push_back(n);
    }
    else if(m==2){
      vec.pop_back();
    }
    else if(m==1){
        cin>>n;
      cout<<vec[n]<<endl;
    }
  }

  return 0;
}


Measured memory_bytes: 3932
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)n; i++)
using P = pair<int,int>;
const int INF = 1e9;

int mod(int a, int b) {
  return ((a-b) % 2 + 2) % 2;
}

template <typename T>
class BIT {
  int n;
  vector<T> bit;
public:
  BIT(int _n) {
    n = _n;
    bit = vector<T>(n+1,(T)0);
  }
  T sum(int i) {
    T s = 0;
    while(i > 0){
    s += bit[i];
    i -= i & -i;
  }
  return s;
  }
  void add(int i, T x) {
    while(i <= n){
    bit[i] += x;
    i += i & -i;
    }
  }
};

int main(){
  int n;
  cin >> n;
  int a[n], b[n];
  rep(i,n) cin >> a[i];
  rep(i,n) cin >> b[i];
  int ans = INF;
  rep(i,1<<n) {
    vector<vector<P>> v(51);
    rep(j,n) {
      if((1<<j) & i) v[a[j]].push_back(P(j,0));
      else v[b[j]].push_back(P(j,1));
    }
    bool can = true;
    vector<int> p(n,2);
    int c = 0;
    rep(j,51) {
      sort(v[j].begin(),v[j].end());
      int l = v[j].size();
      int f = c, s = c+1;
  
      for(auto k : v[j]) {
        if(mod(c,k.first) == k.second) {
          if(f >= c+l) {
            can = false;
            break;
          }
          p[f] = k.first;
          f += 2;
        } else {
          if(s >= c+l) {
            can = false;
            break;
          }
          p[s] = k.first;
          s += 2;
        }
      }
      c += l;
    }
    if(can) {
      int res = 0;
      rep(j,n) {
        for(int l = j+1; l < n; l++) {
          if(p[j] > p[l]) res++;
        }
      }
      ans = min(ans,res);
    }
  }
  if(ans == INF) cout << -1 << endl;
  else cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
int a[19];
using namespace std;
signed main(){
    int n,k;
    cin>>n>>k;
    for(int i=0;i<k;i++){
        cin>>a[i];
    }
    int sum=0;
    for(int i=n;i<114514;i++){
        sum=0;
        int b=i%10;
        int c=(i%100)/10;
        if(i<10){
            c=114514;
        }
        int d=(i%1000)/100;
        if(i<100){
            d=1919;
        }
        int e=(i%10000)/1000;
        if(i<1000){
            e=810;
        }
        int f=(i%100000)/10000;
        if(i<10000){
            f=4545;
        }
        for(int j=0;j<k;j++){
            if(b==a[j]||c==a[j]||d==a[j]||e==a[j]||f==a[j]){
                sum++;
            }
        }
        if(sum==0){
            cout<<i<<endl;
            return 0;
        }
    }
}


Measured memory_bytes: 256
function myin(){return require("fs").readFileSync("/dev/stdin", "utf8").trim();}
function myout(t){console.log(t);}//standard output
function myerr(t){console.error(t);}//standard error
//[no]param
//0:何もしない  1:数値へ変換  2:半角SPで分割  3:改行で分割  4:半角SPで分割し、数値配列へ
//5:改行で分割し、数値配列へ  6:1文字に分割  7:1文字に分割し、数値配列へ
function myconv(i,no){switch(no){case 0:return i;case 1:return parseInt(i);case 2:return i.split(" ");case 3:return i.split("\n");case 4:return i.split(" ").map((a)=>Number(a));case 5:return i.split("\n").map((a)=>Number(a));case 6:return i.split("");case 7:return i.split("").map((a)=>Number(a));}}
function Main(input) {
  input = myconv(input,3);
  var N = myconv(input[0],1);
  var list = myconv(input[1],4);
  var output = Math.pow(3,N);
  var even = 1;
  for(var i = 0; i < N; i++){
    if(list[i] % 2 == 0){
       even *= 2;
    }
  }
  myout(output - even);
}
Main(myin());

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

int main(){
  string r, s, t;
  cin >> r >> s >> t;

  cout << 'A' << s[0] << 'C' << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <limits>
#include <algorithm>
#include <functional>

using namespace std;

template<typename value_type>
class extended_euclidean
{
public:
	value_type gcd;
	value_type lcm;
	value_type x0;
	value_type y0;

public:
	extended_euclidean(value_type a, value_type b)
		: gcd(0), lcm(0), x0(0), y0(0)
	{
		tie(gcd, x0, y0) = process(a, b);
		lcm = a * b / gcd;
	}

public:
	tuple<value_type, value_type, value_type> process(value_type a, value_type b)
	{
		if (a == 0) return make_tuple(b, 0, 1);

		value_type g, x, y;
		tie(g, x, y) = process(b % a, a);

		return make_tuple(g, y - (b / a) * x, x);
	}
};

//extended_euclidean<long long> ee(a, b);
//long long gcd = ee.gcd;
//long long lcm = ee.lcm;

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

	long long A, B, C, D;
	cin >> A >> B >> C >> D;
	A--;

	extended_euclidean<long long> ee(C, D);

	long long result1 = B - (B / C) - (B / D) + (B / ee.lcm);
	long long result2 = A - (A / C) - (A / D) + (A / ee.lcm);

	cout << result1 - result2;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <iterator>

using namespace std;

int main(void) {
    string S, T;
    cin >> S >> T;

    for (int i = 0; i < S.size(); i++) {
        S = S[S.size()-1] + S.substr(0, S.size()-1);
        if (S == T) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 256
use std::io::stdin;
use std::vec::Vec;

mod utils {
    use std::io::BufRead;
    use std::str::{self, FromStr};

    pub struct StdinReader<R: BufRead> {
        reader: R,
        buf: Vec<u8>,
    }

    impl<R: BufRead> StdinReader<R> {
        pub fn new(reader: R) -> StdinReader<R> {
            StdinReader {
                reader: reader,
                buf: Vec::new(),
            }
        }

        #[allow(unused)]
        #[inline]
        pub fn reads<T: FromStr>(&mut self) -> T {
            self.read_until(b' ')
        }

        #[allow(unused)]
        #[inline]
        pub fn readl<T: FromStr>(&mut self) -> T {
            self.read_until(b'\n')
        }

        #[allow(unused)]
        #[inline]
        pub fn read_vec<T: FromStr>(&mut self) -> Vec<T> {
            return self.read_until::<String>(b'\n').trim().split_whitespace().map(|c| c.parse().ok().unwrap()).collect();
        }

        #[inline]
        pub fn read_until<T: FromStr>(&mut self, delim: u8) -> T {
            loop {
                self.buf.clear();
                let len = self.reader
                    .read_until(delim, &mut self.buf)
                    .expect("failed reading bytes");
                match len {
                    0 => panic!("early eof"),
                    1 if self.buf[0] == delim => (),
                    _ => {
                        if self.buf[len - 1] == delim {
                            self.buf.truncate(len - 1);
                        }
                        break;
                    }
                }
            }

            let elem = unsafe { str::from_utf8_unchecked(&self.buf) };
            elem.parse().unwrap_or_else(|_| panic!(format!("failed parsing: {}", elem)))
         }
    }
}



fn main(){
    let stdin = stdin();
    let mut r = utils::StdinReader::new(stdin.lock());
    let n:usize = r.readl();
    let mut l:Vec<usize> = r.read_vec();
    l.sort();
    let mut ans = 0;
    for a_i in 0..(n-2) {
        for b_i in (a_i+1)..(n-1){
            for c_i in (b_i+1)..n{
                let a = l.get(a_i).unwrap();
                let b = l.get(b_i).unwrap();
                let c = l.get(c_i).unwrap();

                if c < &(a + b){
                    ans += 1;
                }
            }
        }
    }
    println!("{}",ans);
}


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

namespace ARC093C {
    class Program {
        static void Main(string[] args) {
            int N = int.Parse(Console.ReadLine());
            int[] input = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
            int allMoney = 0;
            int[] difs = new int[N];
            for (int i = 0; i < N; i++) {
                int prev = (i == 0) ? 0 : input[i - 1];
                int next = (i == N - 1) ? 0 : input[i + 1];
                allMoney += Math.Abs(input[i] - prev);
                difs[i] = Math.Abs(input[i] - prev) + Math.Abs(next - input[i]) - Math.Abs(next - prev);
            }
            allMoney += Math.Abs(input[N - 1]);
            for(int i = 0; i < N; i++) {
                Console.WriteLine(allMoney - difs[i]);
            }
        }
    }
}


Measured memory_bytes: 24412
#include <stdio.h>
int main(void){
	int i, j, n, suji;
	char cards[4][13] = { 0 }, mark;
	char suit[4] = { 'S', 'H', 'C', 'D' };

	scanf("%d", &n);
	for (i = 0; i < n; i++){
		scanf(" %c", &mark);
		scanf("%d", &suji);
		switch (mark)
		{
		case 'S':cards[0][suji - 1] = 1; break;
		case 'H':cards[1][suji - 1] = 1; break;
		case 'C':cards[2][suji - 1] = 1; break;
		case 'D':cards[3][suji - 1] = 1; break;
		}
	}
	for (i = 0; i<4; i++){
		for (j = 0; j < 13; j++){
			if (cards[i][j] == 0){
				printf("%c %d\n", suit[i], j+1);
			}
		}
	}
	return 0;
}

Measured memory_bytes: 1832
#include <iostream>
#include <vector>
#include <cstdlib>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <string>
#include <cmath>
using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
using vi = vector<int>; // intの1次元の型に vi という別名をつける
using vvi = vector<vi>; // intの2次元の型に vvi という別名をつける
using vl = vector<ll>;  // long longの1次元の型に vl という別名をつける
using vvl = vector<vl>; // long longの2次元の型に vvl という別名をつける
int MOD = 1000000007; //10^9 + 7

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; }

// 無限大の値
const ll  lINF = 1LL << 60;
const int iINF = 1 << 29;

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

  cout << (s.rfind('Z', s.size()) - s.find('A') + 1) << endl;
  return 0;
} 

Measured memory_bytes: 3700
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>
#include <stack>


using namespace std;
using ll = long long;
using ull = unsigned long long;

const ll INF = 1e16;
const ll MOD = 1e9 + 7;

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








int main() {
    char b;
    cin >> b;
    if(b == 'A') cout << "T" << endl;
    else if(b == 'C') cout << "G" << endl;
    else if(b == 'G') cout << "C" << endl;
    else cout << "A" << endl;
}


Measured memory_bytes: 256
package main

import (
        . "fmt"
)

func main() {
        var W, H, x, y, r int
        Scan(&W, &H, &x, &y, &r)
        if (0 <= x-r) && (x+r <= W) && (0 <= y-r) && (y+r <= H) {
                Println("Yes")
        } else {
                Println("No")
        }
}



Measured memory_bytes: 1160
#include<iostream>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<limits>
#include<sstream> 
#include<unordered_map>      

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;

const int inf = numeric_limits<int>::max() >> 2;
const ll linf = numeric_limits<ll>::max() >> 2;
const ull ulinf = numeric_limits<ull>::max() >> 2;
const double pi = acos(-1);
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int dx8[8]={-1,0,1,-1,1,-1,0,1};
const int dy8[8]={-1,-1,-1,0,0,1,1,1};

#define p_queue(i) priority_queue<i> 
#define rp_queue(i) priority_queue<i, vector<i>, greater<i>> 
#define umap(i,j) unordered_map<i,j>
#define P(p) cout<<(p)<<endl
#define PS(p) cout<<(p)<< " "
#define PN cout << endl
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i = (n-1); i >= (int)(m); i--)
#define inrep(n,a) for(int i = 0; i < (int)(n); i++)cin >> a[i];
#define mod(i) ((i)%(ll)(1e9 + 7))
#define divm(a,b) (mod(a * modpow((ll)b,(ll)(1e9+5))))
#define rsort(a,b,c) sort(a, b, greater<c>())
#define vsort(v) sort(v.begin(), v.end())
#define rvsort(v,c) sort(v.begin(), v.end(), greater<c>()) 
#define ft first
#define sd second
#define pb push_back
#define it insert
#define sz(x) ((int)(x).size())
#define lb(a,n,k) (lower_bound(a,a+n,k) - (a)) 
#define vlb(a,k)  (lower_bound(a.begin(),a.end(),k) - a.begin())
#define ub(a,n,k) (upper_bound(a,a+n,k) - (a)) 
#define vub(a,k)  (upper_bound(a.begin(),a.end(),k) - a.begin())
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return

/*
ll modpow(ll i,ll j){ ll tmp=1; while(j){ if(j%2)tmp=mod(tmp*i);i=mod(i*i);j/=2;}return tmp;}
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; }
*/

/*
vector<string> split(const string &str, char sep){
    vector<string> v;
    stringstream ss(str);
    string buffer;
    while( getline(ss, buffer, sep) ) {
        v.push_back(buffer);
    }
    return v;
}
*/

/*
ll ncr[100][100];
ll nCr(int n, int r){if(n==r) ret ncr[n][r] = 1; if(r==0) ret ncr[n][r] = 1; if(r==1) ret ncr[n][r] = n;if(ncr[n][r]) ret ncr[n][r]; ret ncr[n][r] = nCr(n-1,r) + nCr(n-1,r-1);}

ll npr[100][100]={};
ll nPr(int n,int r){if(npr[n][r])ret npr[n][r];if(r==0)ret npr[n][r] = 1;if(r==1)ret npr[n][r] = n;ret npr[n][r] = n * nPr(n-1,r-1);}

ll nHr(int n,int r){ret nCr(n+r-1,r);}
*/

///////////////////////////////////////////////////////////////////////////



int main(){
    int x;
    cin >> x;
    if(x >= 30)Yes;
    else No;
    
    return  0;
}


Measured memory_bytes: 3552
a=int(input())
if 400<=a<=599:
    print("8")
if 600<=a<=799:
    print("7")
if 800<=a<=999:
    print("6")
if 1000<=a<=1199:
    print("5")
if 1200<=a<=1399:
    print("4")
if 1400<=a<=1599:
    print("3")
if 1600<=a<=1799:
    print("2")
if 1800<=a<=1999:
    print("1")

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

#define INF 1e9
#define llINF 1e18
#define MOD 1e9+7
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
using namespace std;
int main(){
  int n,m;cin>>n>>m;
  vector<int>num(n);
  int po=0;
  for(int i=0;i<n;i++){
    cin>>num[i];
    if(num[i]==1)po=i;
  }
  if(po==n-1){
    ll ans=0;
    ans+=(n-1)/(m-1);
    if((n-1)%(m-1)!=0)
      ans++;
    cout<<ans<<endl;
    return 0;
  }else{
    //  if(po>n/2){po=n-po-1;reverse(num.begin(),num.end());}
    int numm=0;
    numm=(m-1)-(po%(m-1));
    po+=numm;
    if(po>=n){
      reverse(num.begin(),num.end());
      for(int i=0;i<n;i++){
	if(num[i]==1)po=i;
      }
      numm=(m-1)-po%(m-1);
      po+=numm;
    }
    //cout<<po<<endl;
    ll ans=po/(m-1);
    if(po%(m-1)!=0)
      ans++;
    
    //cout<<ans<<" "<<po<<endl;
    //cout<<ans<<endl;
    // cout<<po+1<<endl;
    if((n-(po+1))%(m-1)!=0)
      ans++;
    ans+=(n-(po+1))/(m-1);
    cout<<ans<<endl;
  }
  return 0;
}


Measured memory_bytes: 640
S = input()
ARR = ['A', 'C', 'G', 'T']

results = []
count = 0
for i in range(len(S)):
    if S[i] in ARR:
        count+=1
        results.append(count)
    else:
        results.append(count)
        count = 0

print(max(results))

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define X first
#define Y second
#define mp make_pair
#define pb push_back
#define rep(i,a,n) for(int i=(a);i<=(n);++i)
#define dep(i,a,n) for(int i=(a);i>=(n);--i)
#define eps 1e-8
#define pi 3.1415926535897
#define sqr(x) ((x)*(x))
#define MAX(a,b) a=max(a,b)
#define MIN(a,b) a=min(a,b)
#define SZ(x) ((int)(x).size())
#define CPY(a,b) memcpy(a,b,sizeof(a))
#define CLR(a) memset(a,0,sizeof(a))
#define POSIN(x,y) (1<=(x)&&(x)<=n&&1<=(y)&&(y)<=m)
#define all(x) (x).begin(),(x).end()
#define COUT(S,x) cout<<fixed<<setprecision(x)<<S<<endl
#define buli(x) (__builtin_popcountll(x))
#define bur0(x) (__builtin_ctzll(x))
#define bul2(x) (63-__builtin_clzll(x))
#define pw(x) ((ll(1))<<(x))
#define upmo(a,b) (((a)=((a)+(b))%mo)<0?(a)+=mo:(a))
#define mmo(a,b) (((a)=1ll*(a)*(b)%mo)<0?(a)+=mo:(a))
#define y0 y0z
#define y1 y1z
#define yn ynz
#define j0 j0z
#define j1 j1z
#define jn jnz
#define tm tmz
#ifdef LOCAL
#define debug(...) fprintf(stderr, __VA_ARGS__)
#else
#define debug(...) 
#endif
typedef long long ll;
typedef double lf;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<lf,lf> pff;
typedef complex<double> CD;
const int inf=0x3f3f3f3f;
const int mo=1000000007;
inline void gn(long long&x){
	int sg=1;char c;while(((c=getchar())<'0'||c>'9')&&c!='-');c=='-'?(sg=-1,x=0):(x=c-'0');
	while((c=getchar())>='0'&&c<='9')x=x*10+c-'0';x*=sg;
}
inline void gn(int&x){long long t;gn(t);x=t;}
inline void gn(unsigned long long&x){long long t;gn(t);x=t;}
inline void gn(double&x){double t;scanf("%lf",&t);x=t;}
inline void gn(long double&x){double t;scanf("%lf",&t);x=t;}
template<class T1,class T2>inline void gn(T1&r,T2&s){gn(r),gn(s);}
template<class T1,class T2,class T3>inline void gn(T1&r,T2&s,T3&t){gn(r),gn(s),gn(t);}
template<class T1,class T2,class T3,class T4>inline void gn(T1&r,T2&s,T3&t,T4&u){gn(r),gn(s),gn(t),gn(u);}
inline void gs(char *s){scanf("%s",s);}
inline void gc(char &c){while((c=getchar())>126 || c<33);}
inline void pc(char c){putchar(c);}
const int DX[]={1,0,-1,0},DY[]={0,1,0,-1};
ll powmod(ll a,ll b) {ll res=1;a%=mo;for(;b;b>>=1){if(b&1)res=res*a%mo;a=a*a%mo;}return res;}
ll powmod(ll a,ll b,ll mo) {ll res=1;a%=mo;for(;b;b>>=1){if(b&1)res=res*a%mo;a=a*a%mo;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
//*******************************************

const int N=111111,M=111111;
int l,m,n,t,C;
char s[2][N];
int main(){
#ifdef LOCAL
	freopen("D.in","r",stdin);//freopen("D.out","w",stdout);
#endif
	scanf("%d",&n);
	scanf("%s%s",s[0]+1,s[1]+1);
	ll ans=1;
	int p=2;
	if(s[0][1]==s[1][1])p=2,ans=3;
	else p=3,ans=6;
	rep(i,p,n)if(s[0][i]==s[1][i]){
		if(s[0][i-1]==s[1][i-1])mmo(ans,2);
	}else{
		if(s[0][i-1]==s[1][i-1])mmo(ans,2);
		else mmo(ans,3);
		++i;
	}
	printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 256
import math
import sys
from itertools import accumulate
from functools import reduce
import queue
from fractions import gcd

def lcm(a, b):
    return a * b // gcd(a, b)

def combination_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def permutations_count(n, r):
    return math.factorial(n) // math.factorial(n - r)

sys.setrecursionlimit(10000)

mod = 1000000007

"""
# 0埋め, 小数点出力桁指定時のときの出力
a = 100
b = 0.987654321
print("{0:06d}-{1:6f}".format(a,b))
000100-0.987654

# 文字列をリストに格納
char_list = list("abcd") # ["a","b","c","d"]

# 標準入力取得
## 文字列
    = sys.stdin.readline().rstrip()
    = list(sys.stdin.readline().rstrip())
    = [list(list(sys.stdin.readline().rstrip())) for i in range(h)] #文字列を分解して二次元配列入力

## 数値
    = int(sys.stdin.readline())
    = map(int, sys.stdin.readline().split())
    = list(map(int, sys.stdin.readline().split()))
    = [list(map(int,list(sys.stdin.readline().split()))) for i in range(h)]  # 二次元配列入力　二次元マップみたいな入力のとき
"""

if __name__ == "__main__":
    h,w = map(int, sys.stdin.readline().split())
    for i in range(h):
        s= input()
        print(s+"\n"+s)

Measured memory_bytes: 5120
import itertools

n = int(input())

def prime(n):
    number = [i+2 for i in range(n-1)]
    while len(number) > 0:
        yield min(number)
        number = [x for x in number if x % min(number) != 0]
p = {}
for i in prime(n):
    p.setdefault(i, 0)
for i in range(n):
    test = i + 1
    for j in p:
        while test % j == 0:
            p[j] += 1
            test //= j
c = [[75], [3, 25], [5, 15], [3, 5, 5]]
count = 0
for i in c:
    for j in itertools.permutations(p.keys(), len(i)):
        flag = True
        for k in range(len(i)):
            if p[j[k]] <= i[k] - 2:
                flag = False
                break
        if flag == True:
            if i == [3, 5, 5]:
                count += 0.5
            else:
                count += 1
print(int(count))

Measured memory_bytes: 3188
//#include "pch.h"
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>

#include <vector>
#include <set>
#include <map>
#include <iostream>
#include <utility>
#include <queue>
#include <algorithm>
#include <functional>
#include <string>

#define ll long long
#define fri(n) for(i=0;i<(n);i++)
#define frj(n) for(j=0;j<(n);i++)
#define min(p,q) ((p)<(q)?(p):(q))
#define max(p,q) ((p)>(q)?(p):(q))
#define swap(p,q) r=(p);(p)=(q);(q)=r
#define INF 1000000000000000000//10^18
#define INFINT 2000000001//2*10^9+1
#define MOD 1000000007
#define PI acos(-1)

using namespace std;



int main(void)
{
	//変数の宣言
	ll int n,d;
	static ll int a[200010];
	static ll int localmin[200010];
	static ll int road[200010][2];
	multiset<ll int> left;
	multiset<ll int> right;
	static int leftmin[200010];
	static int rightmin[200010];

	//よく使う変数
	int i,j,k,l;
	int flag=0;
	ll int ans=0;
	int count=0;
	ll int temp,temp1,temp2;
	int max,min;
	int len;
	int sum=0;


	//データの読み込み
	scanf("%lld %lld",&n,&d);
//	scanf_s("%lld %lld",&n,&d);

	fri(n){
		scanf("%lld",&a[i]);
//		scanf_s("%lld",&a[i]);	
	}

	fri(n){
		localmin[i]=-1;
	}

	//	printf("nは%dです\n", n);
	//	printf("データの読み込み終了\n");
	//実際の処理

	for(i=0;i<n;i++){
		leftmin[i]=0;
		rightmin[i]=0;
	}

	for(i=0;i<n;i++){
		left.insert(a[i]+d*i);
	}

	auto itr=left.begin();
	for(i=0;i<n;i++){
		itr=left.begin();
		temp=*itr;
		if(a[i]+d*i==temp){
			leftmin[i]=1;
			left.erase(itr);
		}else{
			itr=left.find(a[i]+d*i);
			left.erase(itr);
		}
	}


	for(i=n-1;i>=0;i--){
		right.insert(a[i]-d*i);
	}

	for(i=n-1;i>=0;i--){
		itr=right.begin();
		temp=*itr;
		if(a[i]-d*i==temp){
			rightmin[i]=1;
			right.erase(itr);
		}else{
			itr=right.find(a[i]-d*i);
			right.erase(itr);
		}
	}

	count=0;
	for(i=0;i<n;i++){
		if(leftmin[i]==1&&rightmin[i]==1){
			localmin[count]=i;
			count++;
		}
	}

	//	for(i=0;i<count;i++){
	//		printf("localmin[%d]=%lld\n",i,localmin[i]);
	//	}

	temp=0;
	for(i=0;i<count-1;i++){
		road[i][0]=localmin[i];
		road[i][1]=localmin[i+1];
		//		printf("i=%d,(%lld,%lld)\n",i,road[i][0],road[i][1]);
	}
	temp=count-1;
	temp1=-1;
	temp2=localmin[0];
	count=1;
	for(i=0;i<n;i++){
		if(temp1==-1){
			if(i<temp2){
				road[temp][0]=i;
				road[temp][1]=temp2;
				temp++;
			}else if(i==temp2){
				temp1=temp2;
				temp2=localmin[1];
			}
		}else if(temp2!=-1){
			if(i<temp2){
				if(a[temp1]+(i-temp1)*d<a[temp2]+(temp2-i)*d){
					road[temp][0]=temp1;
					road[temp][1]=i;
					temp++;
				}else{
					road[temp][0]=i;
					road[temp][1]=temp2;
					temp++;
				}
			}else if(i==temp2){
				temp1=temp2;
				temp2=localmin[count+1];
				count++;
			}
		}else{
			road[temp][0]=temp1;
			road[temp][1]=i;
			temp++;
		}
	}

	fri(temp){
		ans=ans+a[road[i][0]]+a[road[i][1]]+llabs(road[i][1]-road[i][0])*d;
//				printf("(%lld,%lld)",road[i][0],road[i][1]);
	}


	//	printf("計算部分終了\n");

	//出力

	printf("%lld",ans);


	//	printf("結果の出力終了\n");


	return 0;
}





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

int main() {
  int N, M;
  cin >> N;
  vector<string> str1(N), str2(M);
  for (int i = 0; i < N; i++)
    cin >> str1.at(i);
  cin >> M;
  for (int i = 0; i < M; i++)
    cin >> str2.at(i);
  int max = 0;
  for (int i = 0; i < N; i++){
    int score = 1;
    for (int j = i + 1; j < N; j++){
      if (str1.at(j) == str1.at(i))
        score++;
    }
    for (int j = 0; j < M; j++){
      if (str2.at(j) == str1.at(i))
        score--;
    }
    if (score > max)
      max = score;
  }
  cout << max << endl;
}
    

Measured memory_bytes: 4212
using System;

namespace DPL_1C_1{
    public class Program{
        public static void Main(string[] args){
            var input = Console.ReadLine().Split(' ');
            var n = int.Parse(input[0]);
            var w = int.Parse(input[1]);

            var dp = new int[n + 1, w + 1];
            for(var i = 1; i <= n; i++){
                var tmp = Console.ReadLine().Split(' ');
                var value = int.Parse(tmp[0]);
                var weight = int.Parse(tmp[1]);

                for(var j = 0; j <= w; j++){
                    if(j >= weight){
                        dp[i, j] = Math.Max(dp[i - 1, j - weight] + value, dp[i - 1, j]);
                    } else{
                        dp[i, j] = dp[i - 1, j];
                    }
                }
            }

            Console.WriteLine(dp[n, w]);
        }
    }
}

Measured memory_bytes: 13124
// Sky's the limit :)
#include<bits/stdc++.h>
using namespace std;
#define int long long

signed main()
{
    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    
    //int t=1 ; cin>>t ; while(t--)
    {
        int n, k;
        cin >> n>> k;
        int a[n];
        for(int i=0;i<n;i++)
        {
            cin >> a[i];
        }
        sort(a, a+n);

        int x = 0;
        for(int i=0;i<max(0LL,n-k);i++)
            x += a[i];
        
        cout << x << '\n';
    }
    
    cerr << "Time elapsed : " << 1.0 * clock() / CLOCKS_PER_SEC << " sec \n";
    return 0;
}



Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string s;
  cin >> s;
  
  int cnt = 0;
  if(s.at(0)=='1') cnt++;
  if(s.at(1)=='1') cnt++;
  if(s.at(2)=='1') cnt++;
  
  cout << cnt << endl;
}


Measured memory_bytes: 256