akhauriyash/Code-Regression huggingface dataset:
(defvar *n* (read))
(defvar *m* (read))
(defvar *x* (read))
(defvar *y* (read))

(defun set-lst (n)
  (loop for i from 1 to n
        collect (read)))

(defvar *x-n* (nth 0 (sort (set-lst *n*) #'>)))
(defvar *y-m* (nth 0 (sort (set-lst *m*) #'<)))

(defun calc (x y z)
  (cond ((and (< x z) (>= y z) (< *x* z) (>= *y* z))
         t)
        ((> z *y*)
         nil)
        (t (calc x y (1+ z)))))


(if (calc *x-n* *y-m* (1+ *x*))
    (princ "No War")
    (princ "War"))

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

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    long long n;
    cin >> n;
    vector<bool> seats(20);
    string first, last;
    long long l = 0, r = n-1;
    cout << 0 << endl;
    cin >> first;
    if(first == "Vacant") return 0;
    cout << n-1 << endl;
    cin >> last;
    if(last == "Vacant") return 0;
    long long rem = 18;
    while(rem > 0){
        long long pos = (l+r)/2;
        string tmp;
        cout << pos << endl;
        cin >> tmp;
        if(tmp == "Vacant") return 0;
        if((tmp == last) ^ ((r-pos)%2 == 0)){
            l = pos;
            first = tmp;
        }
        else{
            r = pos;
            last = tmp;
        }
        rem--;
    }
    return 0;
}

Measured memory_bytes: 852
d, g = map(int, input().split())
p, c = [], []
for _ in range(d):
  p_, c_ = map(int, input().split())
  p.append(p_)
  c.append(c_)

def solve(g, i):
    if i <= 0:
        return 1e9
    n = min(int(g / (100 * i)), p[i - 1])
    s = 100 * i * n
    if n == p[i - 1]:
        s += c[i - 1]
    if g > s:
        n += solve(g - s, i - 1)
    return min(n, solve(g, i - 1))

print(solve(g, d))

Measured memory_bytes: 3064
#include <stdio.h>		// standard input output
#include <iostream>		// input output stream, cin cout( console in console out)
#include <cmath>		// circle math ( sin, con, sinh
#include <string>
#include <vector>
#include <algorithm>
#include <iomanip>		// input output manipulation

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

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






int main() {
  string s,t; // 変数の宣言
  cin >> s >>t; // 標準入力
  int ans =0;
  rep(i,s.length()){
    if(s.at(i) != t.at(i)){
      ans++;
    }
  }
  cout << ans << endl; // 標準出力
}


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

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

  int p[20];

  for(int i=0;i<n;i++){
    cin>>p[i];
  }

  int count = 0;
for(int i =1;i < n-1;i++){
  if(p[i-1]<p[i]&&p[i]<p[i+1]||p[i-1]>p[i]&&p[i]>p[i+1]){
    count++;
  }
}
cout << count << endl;
}



Measured memory_bytes: 256
list = input().split()
N = int(list[0])
list2 = input().split()
x = 0
for i in range(N):
  x += int(list2[i])
x = x / N
x = round(x)
S = 0
for i in range(N):
  S += (int(list2[i]) - x)**2
print(S)



Measured memory_bytes: 3060
#include<iostream>
#include<math.h>
using namespace std;

int main()
{
  int a, b;
  cin >> a >> b;
  if (abs(a-b) % 2 == 1)
  {
  	cout << "IMPOSSIBLE";
    return 0;
  }
  int k = min(a,b) + abs(a-b)/2;
  cout << k;
  return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python
from collections import deque, defaultdict
import bisect
from math import factorial, sqrt

ALPHABETS = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j']

def generate_valid_strings(base):
    result = set()
    candidates = set(list(base))

    for c in candidates:
        string = base + c
        result.add(string)

    for c in ALPHABETS:
        if c not in candidates:
            string = base + c
            result.add(string)
            break

    return result


def main():
    #a, b, c = map(int, input().split())
    N = int(input())

    all_strings = defaultdict(set)

    x = 'a'
    all_strings[1].add(x)
    for i in range(1, N):
        new_strings = set()
        prev_strings = all_strings[i]
        for string in prev_strings:
            new_strings |= generate_valid_strings(string)
        all_strings[i+1] = new_strings

    result = sorted(all_strings[N])
    for string in result:
        print(string)


if __name__ == '__main__':
    main()


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

int main(){
  string S;
  cin>>S;
  if(S[0]==S[1])cout<<"Bad"<<endl;
  else if(S[1]==S[2])cout<<"Bad"<<endl;
  else if(S[2]==S[3])cout<<"Bad"<<endl;	
  else cout<<"Good"<<endl;
          
 return 0;
}

Measured memory_bytes: 256
using System;
class Program
{
    static void Main(string[] args)
    {
        int N = int.Parse(Console.ReadLine());
        string[] input = Console.ReadLine().Split(' ');
        int[] H = new int[N];
        for (var i = 0; i < N; i++)
        {
            H[i] = int.Parse(input[i]);
        }

        bool possible = true;
        for (var i = N-1-1; i >= 0; i--)
        {
            if (H[i] > H[i + 1])
            {
                if (H[i] > H[i+1]+1)
                {
                    possible = false;
                    break;
                }
                H[i] = H[i + 1];
            }
        }
        Console.WriteLine(possible ? "Yes" : "No");
    }
}


Measured memory_bytes: 25052
import queue
import math
import copy
"""
N = int(input())
#S = input()
# (N,M) = (int(i) for i in input().split(" "))
# A = [int(i) for i in input().split()]
A = []
for i in range(N):
	A.append(int(input()))

print(A)

"""
n = int(input())
pos = [[int(t[0]), int(t[1])]for t in [input().split() for i in range(n)]]
cand = [i for i in range(n)]
def saiki(c,p):
	if len(c) == 0:
		return 0
	ret = 0
	o = copy.copy(c)
	for t in c:
		o.remove(t)
		if p != None:
			ret += ((p[0]-pos[t][0])**2+(p[1]-pos[t][1])**2)**.5
		ret += saiki(o, pos[t])
		o.append(t)
	return ret/len(c)
print(saiki(cand, None))


Measured memory_bytes: 4080
#include <iostream>
#include <string>
#include <algorithm>
#include <math.h>
#define MOD 1000000007
using namespace std;

int main()
{
	long long int n,ans1,ans2;
	long long int a[100005],b[100005];
	cin >> n;
	int i;
	ans1 = 0;
	ans2 = 0;
	b[0] = 0;
	for (i = 0; i < n; i++){
		cin >> a[i];
	}
	for (i = 0; i < n; i++){
		if (i % 2 == 0){
			if (b[i] + a[i] <= 0){
				ans1 += 1 - b[i] - a[i];
				b[i + 1] = 1;
			}
			else{
				b[i + 1] = b[i] + a[i];
			}
		}
		else{
			if (b[i] + a[i] >= 0){
				ans1 += 1 + b[i] + a[i];
				b[i + 1] = -1;
			}
			else{
				b[i + 1] = b[i] + a[i];
			}
		}
	}
	b[0] = 0;
	for (i = 0; i < n; i++){
		if (i % 2 != 0){
			if (b[i] + a[i] <= 0){
				ans2 += 1 - b[i] - a[i];
				b[i + 1] = 1;
			}
			else{
				b[i + 1] = b[i] + a[i];
			}
		}
		else{
			if (b[i] + a[i] >= 0){
				ans2 += 1 + b[i] + a[i];
				b[i + 1] = -1;
			}
			else{
				b[i + 1] = b[i] + a[i];
			}
		}
	}
	cout << min(ans1, ans2) << endl;

	return 0;
}

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

using namespace std;


int main()
{
    ios_base::sync_with_stdio(false);cin.tie(NULL);
    int w,h,n,x,y,a;
    cin>>w>>h>>n;
    bool arr[w][h]={0};
    for (int i=0;i<n;i++){
        cin>>x>>y>>a;
        for (int j=0;j<w;j++){
            for (int k=0;k<h;k++){
                if (a==1){
                    if (j<x){
                        arr[j][k]=1;
                    }
                }else if (a==2){
                    if (j>=x){
                        arr[j][k]=1;
                    }
                }else if (a==3){
                    if (k<y){
                        arr[j][k]=1;
                    }
                }else if (a==4){
                    if (k>=y){
                        arr[j][k]=1;
                    }
                }
            }
        }
    }int q=0;
    for (int i=0;i<w;i++){
        for (int j=0;j<h;j++){
            if (arr[i][j])q++;
        }
    }cout<<(w*h)-q<<endl;
    return 0;

}

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


using namespace std;

int main() {
    int N, M;
    cin >> N >> M;
    
    vector<pair<int, int>> list(M);\
    
    for(int i = 0; i < M; ++i){
        cin >> list[i].second >> list[i].first;
    }
    sort(list.begin(), list.end());
    
    int cnt = 0;
    int pos = 0;
    
    
    while(true){
        ++cnt;
        int a = list[pos].first;
        while(list[pos].second < a){
            if(pos == M - 1){
                cout << cnt << endl;
                return 0;
            }
            ++pos;
        }
    }
}

Measured memory_bytes: 1024
import java.util.*;

public class Main implements Runnable {

    private static int MOD = 1_000_000_007;

    public static void main(String[] args) {
        // Run with 32MB stack
        Thread thread = new Thread(null, new Main(), "", 32 * 1024 * 1024);
        thread.start();
    }

    @Override
    public void run() {
        final Scanner scanner = new Scanner(System.in);
        solve(scanner);
    }

    static void solve(Scanner scanner) {
        int N = Integer.parseInt(scanner.nextLine());
        int[] n = Arrays.stream(scanner.nextLine().split(" ")).mapToInt(Integer::parseInt).toArray();
        int[] cnt = new int[100001];
        cnt[0] = 3;

        long ans = 1;
        for (int i = 0; i < N; i++) {
            ans *= cnt[n[i]];
            ans %= MOD;
            cnt[n[i]]--;
            cnt[n[i] + 1]++;
        }
        System.out.println(ans);
    }

}


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

string query(const vector<int64_t>& vec) {
    cout << "?";
    for (int64_t v : vec) {
        cout << " " << v;
    }
    cout << endl;
    string T;
    cin >> T;
    return T;
}

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

    int64_t first = 1, second = 1 + N;
    vector<int64_t> q(N);
    iota(q.begin(), q.end(), 1);
    string first_str = query(q);
    while (second - first != 1) {
        int64_t mid = (first + second) / 2;
        iota(q.begin(), q.end(), mid);
        string curr = query(q);
        (curr == first_str ? first = mid : second = mid);
    }

    int64_t change_index = second;

    //change_indexからN - 1個はB, Rが半々
    //そこ+1を問えば+1部分が特定可能
    q.clear();
    for (int64_t i = change_index; i < change_index + N - 1; i++) {
        q.push_back(i);
    }

    string ans;
    for (int64_t i = 0; i < 2 * N; i++) {
        ans.push_back('?');
    }

    for (int64_t i = 1; i <= 2 * N; i++) {
        if (change_index <= i && i < change_index + N - 1) {
            continue;
        }

        q.push_back(i);
        string T = query(q);
        q.pop_back();

        ans[i - 1] = (T == "Red" ? 'R' : 'B');
    }

    //確定したところからR, Bが半々の質問を構成して残りを問う
    q.clear();
    int64_t r_num = (N - 1) / 2, b_num = (N - 1) / 2;
    for (int64_t i = 0; i < 2 * N; i++) {
        if (ans[i] == 'R' && r_num > 0) {
            q.push_back(i + 1);
            r_num--;
        } else if (ans[i] == 'B' && b_num > 0) {
            q.push_back(i + 1);
            b_num--;
        }
    }

    for (int64_t i = change_index; i < change_index + N - 1; i++) {
        q.push_back(i);
        string T = query(q);
        q.pop_back();
        ans[i - 1] = (T == "Red" ? 'R' : 'B');
    }

    cout << "! " << ans << endl;
}

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

int main(){
    
    cin.tie(0);
    ios::sync_with_stdio(0);
    
    string s;
    cin >> s;
    
    int i = 0, n = s.size();
    vector<int> ans(n);
    
    while(i<n){
        int c, r = 0, l = 0;
        while(s[i] == 'R' and i < n){
            i++;
            r++;
        }
        c = i - 1;
        while(s[i]=='L' and i < n){
            i++;
            l++;
        }
        ans[c] = (r + 1) / 2 + l / 2;
        ans[c+1] = r / 2 + (l + 1) / 2;
    }
    
    
    rep(i,n) cout << ans[i] << endl;
}


Measured memory_bytes: 1104
#include <iostream>
#include<string.h>
using namespace std;


int main()
{
     int n;
     cin>>n;
     string d;
     cin>>d;
  int l=d.size();
    for(int i=0;i<l;i++)
    {
      int x=int(d[i])-65;
      x=(x+n)%26;
      d[i]=(char)(65+x);
    }
  cout<<d<<endl;
     

    return 0;
}


Measured memory_bytes: 3608
//#include"bits/stdc++.h"
#include<algorithm>
#include<cassert>
#include<cmath>
#include<climits>
#include<iostream>
#include<map>
#include<set>
#include<vector>
using namespace std;
#define ll long long
#define FOR(i, j, k, in) for (int i=j ; i<k ; i+=in)
#define rep(i, j) FOR(i, 0, j, 1)
#define MP make_pair
#define PB push_back
#define endl "\n"
#define MOD 1000000007
#define DEB(x) cout<<"##"<<x<<"##"<<endl
const int INF=(int)2e9+9;
const int SIZE=(int)2e5+5;
//Brute force answers(BINARY SEARCH) symmetry
//Change perspective
int main()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif
    int x;
    cin>>x;
    if(x>=30){
        cout<<"Yes";
    }
    else{
        cout<<"No";
    }
} 

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

public class Main {
    static FastScanner in;
    static PrintWriter out;
    static final long MOD = 1000000007;

    public static void main(String[] args) throws IOException {
        //        Scanner in = new Scanner(new File("input.txt"));
        //        Scanner in = new Scanner(System.in);
        //        System.setOut(new PrintStream(new BufferedOutputStream(new FileOutputStream("output.txt")), true));
        out = new PrintWriter(System.out);
        in = new FastScanner(System.in);
        //        in = new FastScanner("input.txt");
        int n = in.nextInt();
        Set<Integer> set = new HashSet<Integer>();
        for (int i = 0; i < n; i++) {
            int num = in.nextInt();
            set.add(num);
        }
        out.println(set.size());
        out.close();
    }
}

class Rect {
    int left;
    int right;
    int top;
    int bottom;

    public Rect(int left, int right, int top, int bottom) {
        this.left = left;
        this.right = right;
        this.top = top;
        this.bottom = bottom;
    }
}

class Pair {
    public double first; //first member of pair
    public double second; //second member of pair

    public Pair(double first, double second) {
        this.first = first;
        this.second = second;
    }

    public Pair() {

    }

    @Override
    public boolean equals(Object o) {
        if (this == o)
            return true;
        if (!(o instanceof Pair))
            return false;
        Pair p = (Pair) o;
        return first == p.first && second == p.second;
    }

    @Override
    public int hashCode() {
        int result = (int) first;
        result = 31 * result + (int) second;
        return result;
    }
}

class PairComparable implements Comparator<Pair> {

    @Override
    public int compare(Pair o1, Pair o2) {
        if (o1.second < o2.second)
            return -1;
        else if (o1.second > o2.second)
            return 1;
        else {
            return 0;
        }
    }
}

class FastScanner {

    BufferedReader br;
    StringTokenizer tokenizer;

    FastScanner(String fileName) throws FileNotFoundException {
        this(new FileInputStream(new File(fileName)));
    }

    FastScanner(InputStream is) {
        br = new BufferedReader(new InputStreamReader(is));
    }

    String nextLine() throws IOException {
        tokenizer = null;
        return br.readLine();
    }

    String next() throws IOException {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            String line = br.readLine();
            if (line == null) {
                return null;
            }
            tokenizer = new StringTokenizer(line);
        }
        return tokenizer.nextToken();
    }

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

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

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

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

Measured memory_bytes: 23380
#!/usr/bin/env python3
import sys
input = sys.stdin.readline
MOD = 998244353
 
MAX_N = 2 * 10**5 + 10
 
fac = [1] + [0] * MAX_N
for i in range(1, MAX_N+1):
    fac[i] = fac[i-1] * (i) % MOD
 
fac_inv = [1] + [0] * MAX_N
fac_inv[MAX_N] = pow(fac[MAX_N], MOD-2, MOD)
for i in range(MAX_N, 1, -1):
    fac_inv[i-1] = fac_inv[i] * i % MOD
 
def mod_nCr(n, r):
    if n < r or n < 0 or r < 0:
        return 0
    tmp = fac_inv[n-r] * fac_inv[r] % MOD
    return tmp * fac[n] % MOD
 
ans = 0
n, m, k = map(int, input().split())
 
for i in range(k + 1):
    orig = n - i
    cnt = m * pow(m - 1, orig - 1, MOD)
    cnt = cnt * mod_nCr(n-1, i)
    ans += cnt
    ans %= MOD
print(ans)

Measured memory_bytes: 26156
#[allow(unused_imports)]
use std::char::*;
#[allow(unused_imports)]
use std::cmp::*;
use std::io::*;
use std::str::FromStr;
#[allow(unused_imports)]
use std::collections::*;

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

#[derive(PartialEq, PartialOrd)]
pub struct Total<T>(pub T);

impl<T: PartialEq> Eq for Total<T> {}

impl<T: PartialOrd> Ord for Total<T> {
    fn cmp(&self, other: &Total<T>) -> std::cmp::Ordering {
        self.0.partial_cmp(&other.0).unwrap()
    }
}

//const MAX:usize = 100006;
//const INF:u64 = u64::max_value();

fn main() {
    let n:u32 = read();
    let h:u32 = read();
    let w:u32 = read();

    println!("{}", (n-h+1)*(n-w+1));

}


Measured memory_bytes: 4352
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<regex>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
typedef int long long ll;
using namespace std;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

int main(){
    ll n ,m;
    cin>>n>>m;
    vector<pair<ll,ll> > v;
     vector<pair<ll,ll> > vv;
    rep(i,n){
        int a,b;
        cin>>a>>b;
        v.push_back(make_pair(a,b));
    }
    ll ans[n];
    rep(k,m){
        ll c,d;
        cin>>c>>d;
        vv.push_back(make_pair(c,d));
    }
    //cout<<v[0].first<<endl;
    
    rep(i,n){
        
        ll mi=1000000001;
        ll mians=0;
        rep(j,m){
                    // int u=v[i].second;
           ll u=abs(v[i].first-vv[j].first)+abs(v[i].second-vv[j].second);
            if(u<mi){mians=j+1;mi=u;}
        }
        ans[i]=mians;
    }
    
    rep(i,n){
        cout<<ans[i]<<endl;
    }
    
    return 0;
}

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

int main() 
{
  int N = 0;
  cin >> N;

  int B[N - 1];

  int total = 0;
  int previous = 0;

  for (int i = 0; i < N - 1; i++) {
    cin >> B[i];
  }

  total += B[0];

  for (int j = 0; j < N - 2; j++) {
    if (B[j] <= B[j + 1]) {
      total += B[j];
    } else {
      total += B[j+1];
    }
  }

  total += B[N - 2];

  cout << total << endl;
  
  return 0;
}

Measured memory_bytes: 256
N = int(input())
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
if N < min(A,B,C,D,E):
    print(5)
elif min(A,B,C,D,E) !=1:
    print(5 + (N //min(A,B,C,D,E)))
else:
    print(5 + (N //min(A,B,C,D,E))-1)

Measured memory_bytes: 3064
#include<iostream>
#include<stdio.h>
//#include <bits/stdc++.h>
#include<vector>
#include<float.h>
#include<iomanip>
#include<algorithm>
#include<string>
#include<cstring>
#include<math.h>
#include<cmath>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include <cassert>
#include <cmath>
#include<cstdint>

#define INF 1e9
#define rep(i,n)for(int i=0;(i)<(int)(n);i++)
#define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
#define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
#define vec(type,n) vector<type>(n)
#define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))
#define ALL(a)  (a).begin(),(a).end()

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using P = pair<int,int>;

vector<int>bitSearch(int bit,int n){
    vector<int>S;
    rep(i,n)if(bit&(1<<i))S.push_back(i);
    return S;
}

int gcd(int a,int b){
    if(a%b==0)return b;
    else return gcd(b,a%b);
}

int main(){
    int n,k;cin>>n>>k;
    ll res;
    if(k%2==1){
        res = pow(n/k,3);
        cout<<res<<endl;
    }
    else {
        int l = k/2;
        ll cnt1 = 0;
        while(l<=n){
            cnt1++;
            l += k;
        }
        ll cnt2 = n/k;
        res = pow(cnt1,3)+pow(cnt2,3);
        cout<<res<<endl;
    }
}



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

int a[10000];

signed main(){

  int H,W,N;
  cin >> H >> W >> N;
  for(int i = 0; i < N; i++){
    cin >> a[i];
  }

  int ans[H][W] = {};
  int h = 0,w = 0;
  int cnt = 0,res = 0;
  for(int i = 0; i < N; i++){
    for(int j = 0; j < a[i]; j++){
      if(res%2 == 0){
        ans[h][w++] = i+1;
        cnt++;
        if(cnt%W == 0) res++,h++,w = 0;
      }
      else {
        ans[h][(W-1)-w] = i+1;
        w++;
        cnt++;
        if(cnt%W == 0) res++,h++,w = 0;
      }
    }
  }

  for(int i = 0; i < H; i++){
    for(int j = 0; j < W; j++){
      cout << ans[i][j] << " ";
    }
    cout << endl;
  }

  return 0;
}


Measured memory_bytes: 384
using System;

namespace AOJ
{
    class Program
    {
        static void Main(string[] args)
        {
            while (true)
            {
                var read = Console.ReadLine();
                var temp_string = read.Split(' ');

                int m = int.Parse(temp_string[0]), r = int.Parse(temp_string[1]), f = int.Parse(temp_string[2]);

                if(m==-1&&r==-1&&f==-1)
                {
                    break;
                }

                if(m==-1||r==-1||m+r<30)
                {
                    Console.WriteLine("F");
                }
                else if(m+r>=80)
                {
                    Console.WriteLine("A");
                }
                else if(m+r>=65)
                {
                    Console.WriteLine("B");
                }
                else if(m+r>=50)
                {
                    Console.WriteLine("C");
                }
                else if(m+r>=30)
                {
                    if(f>=50)
                    {
                        Console.WriteLine("C");
                    }
                    else
                    {
                        Console.WriteLine("D");
                    }
                }
            }

        }
    }
}

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

typedef unsigned long long ull;
typedef long long ll;
struct int128{
	ull hi,lo;
	int128(ull hi=0,ull lo=0):hi(hi),lo(lo){};
	bool operator < (const int128&a)const{
		if(hi!=a.hi)return hi<a.hi;
		return lo<a.lo;
	}
	int128 operator & (const int128&a)const{return int128(hi&a.hi,lo&a.lo);}
	int128 operator ^ (const int128&a)const{return int128(hi^a.hi,lo^a.lo);}
	int128 operator | (const int128&a)const{return int128(hi|a.hi,lo|a.lo);}
	int128 operator << (const int&n)const{
		if(!n)return *this;
		return n>=64?int128(lo<<(n-64),0):int128((hi<<n)|(lo>>(64-n)),lo<<n);
	}
	int128 operator >> (const int&n)const{
		if(!n)return *this;
		return n>=64?int128(0,hi>>(n-64)):int128(hi>>n,(hi<<(64-n))|(lo>>n));
	}
	
};
const int mod=998244353;


map<int128,int>mp;

int solve(int128 x,int len){
	if(!len)return 1;x=x^(x>>len<<len);
	int128 y=x|(int128(0,1)<<len);
	if(mp.count(y))return mp[y];
	int&ret=mp[y];
	ret=(((x>>(len-1)).lo+1)*solve(x,len-1))%mod;
	for(int i=1;i<len;++i){
		int128 tmp=x>>(len-i);
		for(int j=i+i;j<=len;j+=i){
			tmp=tmp&(x>>(len-j));
			ret=(ret+(ll)solve(tmp,i)*solve(x,len-j))%mod;
		}
	}
	return ret;
}
char s[1234];int n;
int main(){
	cin>>s;n=strlen(s);
	int128 x(0,0);
	for(int i=0;i<n;++i)x=(x<<1)|int128(0,s[i]-'0');
	cout<<solve(x,n)<<'\n';
	return 0;
}

Measured memory_bytes: 3072
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        int N;
        int result = 0;
        Scanner scan = new Scanner(System.in);

        N = scan.nextInt(); 
        List<Integer> V = new ArrayList<>(N);
        List<Integer> C = new ArrayList<>(N);

        for (int i = 0; i < N; i++) {
            V.add(scan.nextInt());
        }
        for (int i = 0; i < N; i++) {
            C.add(scan.nextInt());
            if (V.get(i) > C.get(i)) {
                result += V.get(i) - C.get(i);
            }
        }
        System.out.println(result);

    }
}

Measured memory_bytes: 25300
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long a,b,st=0,td=0;
    cin>>a;
    vector<long long>v;
    map<long long,long long>mp;
    map<long long,long long> :: iterator it;
    for(int i=0; i<a; i++)
    {
        cin>>b;
        mp[b]++;
    }
    for( it = mp.begin(); it != mp.end(); ++it)
    {
        long long abc=it->first;
        if(mp[abc]%2!=0)
        {
            v.push_back(abc);
        }


    }
    cout<<v.size();











}


Measured memory_bytes: 7676
#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <ctype.h>
#include <math.h>
#include <stack>
#include <string>
#include <string.h>
using namespace std;
double PI = 3.1415926535897932;
long mod = 1000000007;

const long INF = 1e9 + 1;

int main() {
  string s;
  cin >> s;
  for(int i = 0; i < 3; i++) {
    if(s[i] == '1') s[i] = '9';
    else s[i] = '1';
  }
  cout << s << endl;
}


Measured memory_bytes: 3528
#include <iostream>
#include <stdio.h>
#include <utility>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;
int dx[]={-1,0,0,1};
int dy[]={0,0,-1,0};
int main()
{
    int n;
	cin>>n;
	bool fir=true;
	while(n--){
		//if(!fir)cout<<endl;
		int panel[10]={};
		for(int i=0;i<10;i++){
			for(int j=0;j<10;j++){
				int tmp;
				cin>>tmp;
				panel[i]|=tmp<<j;
			}
		}
		for(int i=0;i<(1<<10);i++){//1??????ans?????????
			int ans[10]={};
			ans[0]=i;
			for(int j=0;j<9;j++){//????????????ans????¨????
				for(int k=0;k<10;k++){//?????????????????°???
					int tmp=0;
					for(int l=0;l<4;l++){
						int nx=k+dx[l],ny=j+dy[l];
						if(0<=nx&&nx<10&&0<=ny&&ny<9)tmp+=(ans[ny]>>nx)&1;
					}
					if((tmp+(panel[j]>>k)&1)%2)ans[j+1]|=1<<k;
				}
			}
			int check=ans[8];
			for(int j=0;j<10;j++){
				if((ans[9]>>j)&1){
					for(int k=-1;k<=1;k++){
						int x=j+k;
						if(0<=x&&x<10){
							if((check>>x)&1)check&=~(1<<x);
							else check|=1<<x;
						}
					}
				}
			}
			if(check==panel[9]){
				for(int y=0;y<10;y++){
					for(int x=0;x<10;x++){
						int tmp=(ans[y]>>x)&1;
						printf(x==9?"%d\n":"%d ",tmp);
					}
				}		
				break;
			}
		}
		fir=false;
	}
    return 0;
}

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

#define rep(l, r) for (int i = (l); i < (r); i++)

typedef long long ll;
 
using namespace std;

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

    int a[n];
    rep(0, n) cin >> a[i];

    sort(a, a+n);
    reverse(a, a+n);

    int alice = 0, bob = 0;
    rep(0, n) {
        if (i % 2 == 0) {
            alice += a[i];
        } else {
            bob += a[i];
        }
    }
    
    cout << (alice - bob) << endl;
}

int main() {
    solve();

    return 0;
}


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

#define MOD (1000000000+7)
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define all(x) x.begin(), x.end()
#define print(vec,l,r) for(int i = l; i <= r; i++) cout << vec[i] <<" "; cout << endl;
#define forf(i,a,b) for(int i = (a); i < (b); i++)
#define forr(i,a,b) for(int i = (a); i > (b); i--)
#define input(vec,N) for(int i = 0; i < (N); i++) cin >> vec[i];

// template starts
typedef long long int ll;

// template ends here

void solve(){
	// code starts from here
	ll N, ans = 0;
	cin >> N;
	vector<ll> vec(N);
	input(vec,N);
	sort(all(vec));
	
	unordered_set<ll> s;
	map<ll,ll> cnt;
	
	for(int i = 0; i < N; i++){
		cnt[vec[i]] = 0;
	}
	for(int i = 0; i < N; i++){
		cnt[vec[i]]++;
	}
	
	for(int i = 0; i < N; i++){
		if(cnt[vec[i]] > 1){
			s.insert(vec[i]);
			continue;
		}
		bool found = false;
		for(int j = 1; j*j <= vec[i]; j++){
			if(vec[i]%j == 0){
				ll f = j;
				ll f2 = vec[i]/j;
				if(s.find(f) != s.end() || s.find(f2) != s.end()){
					found = true;
					break;
				}
			}
		}
		s.insert(vec[i]);
		if(!found){
			ans++;
		}
	}
	//for(int i = N-1; i >= 0; i--){
		//for(int j = 2; j*j <= vec[i]; j++){
			//if(vec[i]%j == 0){
				//s.insert(j);
				//s.insert(vec[i]/j);
			//}
		//}
		//if(cnt[vec[i]] > 1){
			//s.insert(vec[i]);
			//continue;
		//}
		//if(s.find(vec[i]) == s.end()) ans++;
		//s.insert(vec[i]);
	//}
	cout << ans << endl;
}

int main(){
 	ios_base::sync_with_stdio(false);
    cin.tie(NULL);

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

	return 0;
}


Measured memory_bytes: 25308
#include<bits/stdc++.h>
#define ll long long
#define nl "\n"
#define pi acos(-1)
#define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define pcase printf("Case %d:\n",ca)
int ca=1;
using namespace std;

int main(){
    string a;
    cin>>a;
    int r = 0;
    int x = 0;
    for(int i =0;i<a.size();i++){
        if(a[i]=='R'){
            x++;
            for(int j = i+1;j<a.size();j++){
                if(a[j]=='R'){
                    x++;

                }else{
                    break;
                }

            }
            r = max(x,r);
        }
        x=0;

    }
    cout<<r<<nl;
  
} 

Measured memory_bytes: 3624
#include<cstdio>
#include<cstring>
#define LL long long
#define Set(s,v) memset(s,v,sizeof(s))
using namespace std;
inline LL read(){
    LL ans=0,f=1;char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-'){f=-1;}ch=getchar();}
    while(ch>='0'&&ch<='9'){ans=(ans<<3)+(ans<<1)+(ch^48);ch=getchar();}
    return ans*f;
}
void write(LL x){
    if(x<0){putchar('-');x=-x;}
    if(x>9){write(x/10);}
    putchar(x%10|48);
}
int n,m,k;
int sx,sy;
char opt1[200005];
char opt2[200005];
int dir1,dir2,dir3,dir4;
int main(){
    n=read();
    m=read();
    k=read();
    sx=read();
    sy=read();
    scanf("%s%s",opt1+1,opt2+1);
    //L
    int t=sy;
    for (int i=1;i<=k;i++){
        if(opt1[i]=='L'){
            if(t==1){
                puts("NO");
                return 0;
            }
            t--;
        }
        if(opt2[i]=='R'){
            t++;
            if(t==m+1){
                t=m;
            }
        }
    }
    //R
    t=sy;
    for (int i=1;i<=k;i++){
        if(opt1[i]=='R'){
            if(t==m){
                puts("NO");
                return 0;
            }
            t++;
        }
        if(opt2[i]=='L'){
            t--;
            if(t==0){
                t=1;
            }
        }
    }
    //U
    t=sx;
    for (int i=1;i<=k;i++){
        if(opt1[i]=='U'){
            if(t==1){
                puts("NO");
                return 0;
            }
            t--;
        }
        if(opt2[i]=='D'){
            t++;
            if(t==n+1){
                t=n;
            }
        }
    }
    //D
    t=sx;
    for (int i=1;i<=k;i++){
        if(opt1[i]=='D'){
            if(t==n){
                puts("NO");
                return 0;
            }
            t++;
        }
        if(opt2[i]=='U'){
            t--;
            if(t==0){
                t=1;
            }
        }
    }
    puts("YES");
    return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <regex>
#include <cmath>
#include <vector>
#include <queue>
#include <functional>
#include <numeric>
#include <iomanip>
#include <stack>
#include <string>
#include <map>
#include <set>
using namespace std;
typedef long long ll;

// セグ木(更新一点,評価複数)
template <typename T, typename E>
class SegTree {
public:
    typedef function<T(T, T)> F;
    typedef function<T(T, E)> G;
    int n;
    F f;
    G g;
    T d1;
    vector<T> dat;
    SegTree(int n_, F f, G g, T d1, vector<T> v=vector<T>()) {
        this->f = f;
        this->g = g;
        this->d1 = d1;
        init(n_);
        if(n_==(int)v.size())
            build(n_, v);
    }
    void init(int n_) {
        n = 1;
        while (n < n_) n *= 2;
        dat.clear();
        dat.resize(2 * n - 1, d1);
    }
    void build(int n_, vector<T> v) {
        for(int i = 0; i < n_; i++)
        {
            dat[i + n - 1] = v[i];
        }
        for(int i = n - 2; i >= 0; i--)
        {
            dat[i] = f(dat[2 * i + 1], dat[2 * i + 2]);
        }
    }
    void update(int k, E a) {
        k += n - 1;
        dat[k] = g(dat[k], a);
        while(k > 0) {
            k = (k - 1) / 2;
            dat[k] = f(dat[2 * k + 1], dat[2 * k + 2]);
        }
    }
    T query(int a, int b, int k, int l, int r) {
        if(r <= a || b <= l) return d1;
        if(a <= l && r <= b) return dat[k];
        T v1 = query(a, b, 2 * k + 1, l, (l + r) / 2);
        T v2 = query(a, b, 2 * k + 2, (l + r) / 2, r);
        return f(v1, v2);
    }
    T query(int a, int b) {
        return query(a, b, 0, 0, n);
    }
};

ll gcd(ll a, ll b)
{
	if (a < b)
	{
		a ^= b;
		b ^= a;
		a ^= b;
	}
	return b ? gcd(b, a % b) : a;
}

int main() {
    int N;
    cin >> N;
    SegTree<ll, ll> seg(
        N,
        [](ll a, ll b){return gcd(a, b);},
        [](ll a, ll b){return b;},
        0
    );
    for(int i = 0; i < N; i++)
    {
        ll a;
        cin >> a;
        seg.update(i, a);
    }
    ll ans = -INT64_MAX;
    for(int i = 0; i < N; i++)
    {
        ll g = gcd(seg.query(0, i), seg.query(i+1, N));
        ans = max(ans, g);
    }
    cout << ans << endl;
}


Measured memory_bytes: 2304
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <list>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <tuple>

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i <= (n); i++)
#define show(a, n) rep(i,n) {cout<<a[i]<<' ';} cout<<endl;

using namespace std;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef long long ll;
typedef vector<ll> vll;
typedef pair<long long, long long> pll;

const int INF = 1 << 30;
const long long INFL = 1LL << 62;
const int MOD = 1000000007;
const int MAX = 100000;
const int N = 100010;

int main() {
//	cout << fixed << setprecision(15);
	int n, m;
	cin >> n >> m;
	vector<vll> dp(m + 1, vll(1 << n, INFL));
	dp[0][0] = 0;
	vi tmp;
	rep(i, m) {
		int a, b;
		cin >> a >> b;
		int x = 0;
		rep(j, b) {
			int c;
			cin >> c;
			x |= (1 << (c - 1));
		}
		tmp.push_back(x);
		rep(j, (1 << n)) {
			dp[i + 1][j] = dp[i][j];
		}
		rep(j, (1 << n)) {
			dp[i + 1][j | x] = min(dp[i + 1][j | x], dp[i][j] + a);
		}
	}
	ll ans = dp[m][(1 << n) - 1];
	if(ans == INFL) ans = -1;
	cout << ans << endl;
}


Measured memory_bytes: 32384
/*
 * @Autor: valk
 * @Date: 2020-04-04 14:56:12
 * @LastEditTime: 2020-09-17 20:07:08
 * @Description: 如果邪恶  是华丽残酷的乐章 它的终场 我会亲手写上 晨曦的光 风干最后一行忧伤 黑色的墨 染上安详
 */

#include <algorithm>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string.h>
#include <string>
#include <vector>
#define emplace_back push_back
#define pb push_back
// #define fuck(a, b) cout << a << ' ' << b << ' ' << endl
// #define fuck(a, b, c) cout << a << ' ' << b << ' ' << c << ' ' << endl
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll mod = 1e9 + 7;
const ll seed = 12289;
const double eps = 1e-6;
const ll inf = 0x3f3f3f3f3f3f3f3f;
const int N = 2e3 + 10;

int main()
{
    int n;
    scanf("%d", &n);
    ll maxn1 = -inf, maxn2 = -inf, minn1 = inf, minn2 = inf;
    for (ll i = 1; i <= n; i++) {
        ll x, y;
        scanf("%lld%lld", &x, &y);
        ll sum = x + y;
        ll dis = x - y;
        maxn1 = max(maxn1, sum);
        minn1 = min(minn1, sum);
        maxn2 = max(maxn2, dis);
        minn2 = min(minn2, dis);
    }
    printf("%lld\n", max(maxn1 - minn1, maxn2 - minn2));
    return 0;
}

Measured memory_bytes: 3224
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef pair<int,int> pii;
typedef long long ll;
const long long MOD=1000000007;
#define rep(i,n) for(long long i=0;i<(n);i++)
#define rep2(i,m,n) for(long long i=(m);i<(n);i++)
#define ALL(v) v.begin(), v.end()
#define pb push_back







int main(){

    int n,k;
    cin>>n>>k;

    vi data(n+1);
    rep(i,n){
        int tmp;
        cin>>tmp;
        data.at(i+1)=tmp;
    }


    for (int i=k+1;i<=n;i++){


        if (data.at(i)>data.at(i-k)){
            cout<<"Yes"<<endl;
        }

        else {
            cout<<"No"<<endl;
        }
        
    }




}








            






Measured memory_bytes: 4048
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;cin>>n;
  int ans=0;
  string a;
  map<string,int> S;
  for(int i=0;i<n;i++){
    cin>>a;
    S[a]++;
  }
  for(auto itr=S.begin();itr!=S.end();itr++){
    if(itr->second>0)ans++;
  }
  cout<<ans<<endl;
}
  

Measured memory_bytes: 19232
num=int(input())
koma_n=input().split()
koma_n = [int(s) for s in koma_n]
times=int(input())
which=input().split()
which  = [int(s) for s in which]

for i in range(times):
    flag=0
    for j in range(which[i]-1,num):
        if koma_n[which[i]-1]+1==koma_n[j]:
          flag=1
          break
   
    if flag==0 and koma_n[which[i]-1]<=2018:
        koma_n[which[i]-1]+=1

for i in range(num):
    print(koma_n[i])


Measured memory_bytes: 5612
#include <bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb push_back
#define ll unsigned long long int
#define loop(i,a,b) for(int i=a;i<b;i++)

int main()
{
    int n;
    int h[100005];
    cin>>n;
    loop(i,0,n)
    cin>>h[i];
    ll dp[100005];
    loop(i,0,100005)
    dp[i]=-1;

    dp[0]=0;
    int i,j;

    for(i=0;i<n;i++)
    {
       for(j=i+1;j<=i+2;j++)
       {
       	dp[j] = min(dp[j], dp[i]+ abs(h[j]-h[i]));
       }
    }

    cout<<dp[n-1]<<endl;

    return 0;
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
string ALP = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
string alp = "abcdefghijklmnopqrstuvwxyz";
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}
void neg() {cout << -1 << endl;}

int main() {
  vector<int> a(3), cost(0);
  cin >> a.at(0) >> a.at(1) >> a.at(2);
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
      if (i == j) continue;
      for (int k = 0; k < 3; k++) {
        if (i == k || j == k) continue;
        int c = 0;
        c += max(a.at(j) - a.at(i), a.at(i) - a.at(j));
        c += max(a.at(j) - a.at(k), a.at(k) - a.at(j));
        cost.push_back(c);
      }
    }
  }
  sort(cost.begin(), cost.end());
  cout << cost.at(0) << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll         long long
#define fl(i,n)    for(i=0;i<n;i++)
#define fld(i,a,b) for(i=a;i>b;i--)
#define fli(i,a,n) for(i=a;i<n;i++)
#define inp(i,a,n) for(i=0;i<n;i++) {cin>>a[i];}
#define op(i,a,n)  for(i=0;i<n;i++) {cout<<a[i]<<" ";}
#define pb         push_back
#define mp         make_pair
#define F          first 
#define S          second
#define mod        998244353
#define all(x)     x.begin(),x.end()    
#define speedup    ios_base::sync_with_stdio(false),cin.tie(0)
using namespace std;
void comp() {
	ll i,j,k,l,r,n,m;
	cin>>n>>m;
	if(m>=n) cout<<"unsafe\n";
	else cout<<"safe\n";
}

int main() {
    speedup;
    ll i=0,t;
    //cin>>t;
    t=1;
    while(t--) {
        comp();
    }
    return 0;
}

Measured memory_bytes: 3648
import java.util.Collections;
import java.io.*;
import java.util.*;
import java.util.Arrays;

class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int k = sc.nextInt();
    int arr[] = new int[n];
    long sum = 0;
    for(int i=0;i<n;i++)
      arr[i] = sc.nextInt();
    for(int i=0;i<n;i++)
      arr[i] = -arr[i];
    Arrays.sort(arr);
    for(int i=0;i<n;i++)
      arr[i] = -arr[i];
    for(int i=k;i<n;i++){
      sum += arr[i];
    }
    System.out.println(sum);
  }
}


Measured memory_bytes: 86804
import java.util.*;

public class Main {
	public static HashMap<String,HashSet<String>> map;
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while(true){
			int n = sc.nextInt();
			if(n == 0) break;
			map = new HashMap<String, HashSet<String>>();
			String first = null;
			for(int i=0;i<n;i++){
				String[] s = sc.next().split(":");
				if(i == 0) first = s[0];
				s[1] = s[1].replaceAll("\\.", "");
				String[] ss = s[1].split(",");
				map.put(s[0], new HashSet<String>());
				for(String tmp : ss){
					map.get(s[0]).add(tmp);
				}
			}

			for(String si : map.keySet()){
				for(String sj : map.keySet()){
					if(map.get(si).contains(sj)){
						map.get(si).remove(sj);
						map.get(si).addAll(map.get(sj));
					}
					if(map.get(sj).contains(si)){
						map.get(sj).remove(si);
						map.get(sj).addAll(map.get(si));
					}
				}
			}

			System.out.println(map.get(first).size());
		}
	}
/*
	public static HashSet<String> solve(String group){
		for(String s : map.get(group)){

		}

	}
	*/
}

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

namespace atcoder
{
    class Program
    {
        public static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split(' ');
            int H = int.Parse(s[0]);
            int W = int.Parse(s[1]);

            for (int i = 0; i < H; i++)
            {
                string line = Console.ReadLine();
                Console.WriteLine(line);
                Console.WriteLine(line);
            }

        }
    }

}


Measured memory_bytes: 2776
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> pii;
int main(){
    int n, m;
    scanf("%d%d", &n, &m);

    vector<pii> ans;
    int mid = n/2;
    if(mid%2 == 1){
        int l = 1, r = mid;
        while(l < r){
            ans.emplace_back(pii(l, r));
            l++, r--;
        }
        l = mid+1, r = n;
        if(abs(r-l)%2 == 0) r--;
        while(l < r){
            ans.emplace_back(pii(l, r));
            l++, r--;
        }
    }
    else{
        int l = 1, r = mid;
        while(l < r){
            ans.emplace_back(pii(l, r));
            l++, r--;
        }
        l = mid+1, r = n;
        if(abs(r-l)%2 == 1) r--;
        while(l < r){
            ans.emplace_back(pii(l, r));
            l++, r--;
        }
    }
    for(int i=0;i<m;i++) printf("%d %d\n", ans[i].first, ans[i].second);
}

Measured memory_bytes: 4152
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#define endl "\n"
#define sz(x) ((ll)(x).size())
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define prt(x) cout << (x)
#define prtl(x) cout << (x) << endl
#define rep(i,a,b) for(ll i=a; i<b; i++)
#define rrep(i,a,b) for(ll i=a; i>b; i--)
#define mp(a, b) make_pair(a, b)
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define debug(v) cout << #v<< ": " << v <<endl;
using namespace std;
using vi = vector<int>;
using vll = vector<long long int>;
using vb = vector<bool>;
using vvb = vector<vector<bool>>;
using vc = vector<char>;
using vvi = vector<vector<int>>;
using vvll = vector<vector<long long int>>;
using vvc = vector<vector<char>>;
using ll = long long int;
using P = pair<long long int, long long int>;
using Map = map<long long int, long long int>;
ll INF = 1LL<<60;
ll M = 998244353;

int main(){
    char a; cin >> a;
    if(a < 'a'){
        prt("A");
    }else{
        prt("a");
    }
}






Measured memory_bytes: 3620
object Main {

  def main(args: Array[String]): Unit = {
    val n = scala.io.StdIn.readLine().toInt
    val v = scala.io.StdIn.readLine().split(" ").map(_.toInt)
    val c = scala.io.StdIn.readLine().split(" ").map(_.toInt)
    println((0 until n).map(i => v(i) - c(i)).filter(_ > 0).sum)
  }

}

Measured memory_bytes: 25532
let readString() = stdin.ReadLine()
let readStringArray() = stdin.ReadLine().Split(' ');
let readInt() = readString() |> int
let readIntArray() = readStringArray() |> Array.map(fun x -> int x)
let char2String(value) = List.ofSeq value |> List.toArray |> System.String

let n = readInt()
let h = readIntArray();

let judge index =
    let rec f i value =
        if i < 0 then 
            true
        else 
            if value >= h.[i] then f (i - 1) (max value h.[i]) else false
    f index h.[index]

let rec solve index =
    if index = n then 
        0 
    else
        if judge index then (solve (index + 1)) + 1 else solve (index + 1) 
    
            
solve 0
|> printfn "%d"

Measured memory_bytes: 14044
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <climits>
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;

#define INF INT_MAX/3
#define REP(i,n) for(int i=0;i<n;i++)

int main(){
	int K;
	int A,B;
	cin>>K;
	cin>>A>>B;


	if( static_cast<int>(B / K) > static_cast<int>(A / K)  || A % K == 0){
		cout<<"OK"<<endl;
	}else{
		cout<<"NG"<<endl;
	}
	return 0;
		
}



Measured memory_bytes: 3624
#include "bits/stdc++.h"
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(s) s.begin(), s.end()
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
const int MX = 100005, INF = 1001001001;
const ll LINF = 1e18;
const double eps = 1e-10;
const int DIV = 1e9+7;

vl lucas;
int n;

int main(int argc, char const* argv[])
{
    cin >> n;
    lucas.pb(2); lucas.pb(1);
    for(int i = 2; i <= 87; i++){
        lucas.pb(lucas[i-1] + lucas[i-2]);
    }
    cout << lucas[n] << endl;
    return 0;
}


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

int main()
{
	int W,H,x,y,r;
	cin >> W >> H >> x >> y >> r;
	if (W >= x + r && 0 <= x - r && H >= y + r && 0 <= y - r )
	{
		cout << "Yes" <<endl;
	}
	else
	{
		cout << "No" << endl;
	}
	
	return 0;
}

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

//const long double PIL = 3.141592653589793238462643383279502884L;
//const double PI = 3.14159265358979323846;

#define sz(a) int((a).size())
#define all(c) (c).begin(), (c).end()
#define what_is(x) cerr << #x << " is " << x << endl;

using ll = long long;
using ii = pair<int,int>;
using vi = vector<int>;
using vll = vector<long long>;
using vii = vector<pair<int,int>>;

int main() {
	//~ ios::sync_with_stdio(0);
	//~ cin.tie(0);
	int n, i;
	cin >> n >> i;
	cout << (n + 1 - i) << endl;
}


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

template<typename T, typename U> bool chmin(T &a, const U &b) {
	return (a > b ? a = b, true : false);
}
template<typename T, typename U> bool chmax(T &a, const U &b) {
	return (a < b ? a = b, true : false);
}

typedef long long ll;

#define writeln(n) cout<<n<<"\n";

typedef pair<int, int> P;
typedef pair<string, int> Psi;

ll numct[210000];
ll k[210000];
ll cnb[210000];
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	int n;
	cin>>n;

	for(int i=1; i<=n; i++){
		int tmp;
		cin>>tmp;

		numct[tmp]++;
		k[i] =tmp;
	}
	ll sum=0;
	for(int i=1; i<=n; i++){

		if(numct[i]){
			cnb[i] = (numct[i]*(numct[i]-1))/2;
			sum += cnb[i];
		}
	}

	for(int i=1; i<=n; i++){
		ll cbsum = sum;

		cbsum -= cnb[k[i]];

		cbsum += ((numct[k[i]]-1)*(numct[k[i]]-2))/2;

		writeln(cbsum);




	}



}


Measured memory_bytes: 6400