akhauriyash/Code-Regression huggingface dataset:
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author toshibablack
 */

#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <fstream>
#include <functional>
#include <iostream>
#include <iomanip>
#include <iterator>
#include <memory>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <vector>

#include "string.h"

#define ll long long int
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define REP(i, n) for(int i=0;i<n;++i)
#define FOREACH(x, a) for(auto& (x) : (a))
#define ALL(a) (a).begin(),(a).end()
#define COUT(x) out << (x) << endl;
#define M0(x) memset(x,0,sizeof(x))
#define MINF(x) memset(x,0x3f,sizeof(x))
#define MMINUS(a) memset(a,0xff,sizeof(a))

const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

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

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

using namespace std;

class BFrog2 {
public:
    int N, K;
    int h[100010];
    ll dp[250000];

    void solve(std::istream& in, std::ostream& out) {
        in >> N >> K;
        FOR(i, 1, N+1) in >> h[i];
        MINF(dp);
        dp[1] = 0;
        for (int i = 1; i < N; ++i) {
            for (int s = 1; s <= K; ++s) {
                int next = i+s;
                chmin(dp[next], dp[i] + abs(h[i] - h[next]));
            }
        }
        COUT(dp[N]);
    }
};


int main() {
    BFrog2 solver;
    std::istream& in(std::cin);
    std::ostream& out(std::cout);
    solver.solve(in, out);
    return 0;
}


Measured memory_bytes: 2560
init_ts = ["SS", "SW", "WS", "WW"]

def notanim(t):
    if t=="S":
        return "W"
    else:
        return "S"

def nextAnimal(ts, s):
    if ts[1]=="S":
        if s=="o":
            return ts[0]
        else:
            return notanim(ts[0])
    elif ts[1]=="W":
        if s=="o":
            return notanim(ts[0])
        else:
            return ts[0]

def maket(n, s, init_t):
    t = init_t
    new_s = s[1:] + s[0]
    for i in range(n):
        t += nextAnimal(t[-2:], new_s[i])
    return t

n = int(input())
s = input()
flag = True
for init_t in init_ts:
    tmp_t = maket(n, s, init_t)
    if tmp_t[-2:]==init_t:
        print(tmp_t[:-2])
        flag = False
        break
    else:
        pass

if flag:
    print(-1)


Measured memory_bytes: 3572
N, M, Q = map(int, input().split())
integer_list = [list(map(int, input().split())) for i in range(Q)]
ans, use_cnt, unuse_cnt = 0, 0, 0
use_num_list = [0]
combi_list = []

def combi(use_num_list):
    for i in range(max(use_num_list), M):
        if len(use_num_list) == N:
            combi_list.append(use_num_list[1:] + [i])
            continue
        else:
            combi(use_num_list + [i])

combi(use_num_list)

for cmb in combi_list:
    tmp_ans = 0
    for int_combi in integer_list:
        if cmb[int_combi[1] - 1] - cmb[int_combi[0] - 1] == int_combi[2]:
            tmp_ans += int_combi[3]
    
    ans = max(ans, tmp_ans)
print(ans)

Measured memory_bytes: 22992
#include<iostream>
#include<algorithm>

using namespace std;

int main()
{
    int n, a[200005], b[200005], ans;
    cin >> n;
    for (int i = 1; i <= n; i++)
        cin >> a[i] >> b[i];
    sort(a + 1, a + n + 1);
    sort(b + 1, b + n + 1);
    if(n&1)
        ans = b[n / 2 + 1] - a[n / 2 + 1]+1;
    else
        ans = b[n / 2] + b[n / 2 + 1] - a[n / 2] - a[n / 2 + 1]+1;
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 5216
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		String W = scan.next();
		String end = "END_OF_TEXT";
		int tmp = 0;

		for(;;){
			String T = scan.next();
			if(T.equals(end)){
				break;
			}else if(T.equalsIgnoreCase(W)){
				tmp++;
			}
		}
		System.out.println(tmp);
	}

}

Measured memory_bytes: 18028
import std.stdio;
import std.string;
import std.conv;
import std.algorithm;

void main(){
 if(readln.chomp.to!int == 1){
  writeln("Hello World");}
 else{
  auto a = readln.chomp.to!int;
  auto b = readln.chomp.to!int;
  writeln(a+b);}
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"strconv"
)

type Tree struct {
	key   int
	left  *Tree
	right *Tree
}

func (t *Tree) insert(n int) *Tree {
	if t == nil {
		return &Tree{key: n}
	}

	if n < t.key {
		t.left = t.left.insert(n)
	} else {
		t.right = t.right.insert(n)
	}
	return t
}

func (t *Tree) find(n int) bool {
	switch {
	case t == nil:
		return false
	case t.key == n:
		return true
	case n < t.key:
		return t.left.find(n)
	default:
		return t.right.find(n)
	}
}

func main() {
	scn := bufio.NewScanner(os.Stdin)
	scn.Split(bufio.ScanWords)
	nextInt := func() int { scn.Scan(); r, _ := strconv.Atoi(scn.Text()); return r }
	w := bufio.NewWriter(os.Stdout)

	m := nextInt()
	var t *Tree

	for i := 0; i < m; i++ {
		switch scn.Scan(); scn.Text() {
		case "insert":
			t = t.insert(nextInt())
		case "find":
			if t.find(nextInt()) {
				fmt.Fprintln(w, "yes")
			} else {
				fmt.Fprintln(w, "no")
			}
		case "print":
			inorder(w, t)
			fmt.Fprintln(w)
			preorder(w, t)
			fmt.Fprintln(w)
		}
	}

	w.Flush()
}

func preorder(w io.Writer, t *Tree) {
	if t == nil {
		return
	}
	print(w, t.key)
	preorder(w, t.left)
	preorder(w, t.right)
}

func inorder(w io.Writer, t *Tree) {
	if t == nil {
		return
	}
	inorder(w, t.left)
	print(w, t.key)
	inorder(w, t.right)
}

func print(w io.Writer, n int) {
	fmt.Fprintf(w, " %d", n)
}



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

int main(){
    string s;
    int value = 700;
    cin >> s;
    if(s[0] == 'o'){
        value += 100;
    }
    if(s[1] == 'o'){
        value += 100;
    }
    if(s[2] == 'o'){
        value += 100;
    }
    cout << value << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main()
{
	int a,b = 0;
	int amari = 0;
	scanf("%d %d",&a,&b);
	amari = (a*b)%2;
	if(amari==1)
	{
		printf("Odd");
	}
	else
	{
		printf("Even");
	}
}

Measured memory_bytes: 128
#include <stdio.h>

int main(void){

	int W, H, x, y, r;

	scanf("%d %d %d %d %d", &W, &H, &x, &y, &r);
	
	 if((((x-r) < 0) || ((x+r) > W)) || (((y-r)< 0) || ((y+r) > H))){
	 	printf("No\n");
	 }else{
	 	printf("Yes\n");
	 }

	return 0;
}

Measured memory_bytes: 584
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
#define LL long long
#define PP pair<int,int>
LL A, B ,C;
int main(){
	LL ans = 0;
	cin >> A >> B >> C;
	if(A + B < C){
		ans = A + B + B + 1;
	}else{
		ans = B + C;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define ll long long
#define _GLIBCXX_DEBUG
const ll MOD = 1000000007;
const int MAX = 510000;

int main() {
  int N;
  cin >> N;
  vector<int> W(N);
  for (int i=0; i<N; i++) cin >> W[i];
  vector<int> memo(N); // 累積和
  memo[0] = W[0];
  for (int i=1; i<N; i++) memo[i] = memo[i-1]+W[i];
  int ans = abs(2*memo[0]-memo[N-1]);
  for (int i=1; i<N; i++) ans = min(ans, abs(2*memo[i]-memo[N-1]));
  cout << ans << endl;
}

Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace A
{
    public class Program
    {
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            Solve();
            Console.Out.Flush();
        }

        public static void Solve()
        {
            var n = long.Parse(Console.ReadLine());
            var max = (long)Math.Pow(10, 9);
            var x = (max - n % max) % max;
            var y = (n + x) / max;
            Console.WriteLine($"0 0 {max} 1 {x} {y}");
        }
    }
}


Measured memory_bytes: 13140
import sys
input = sys.stdin.readline
import sys
sys.setrecursionlimit(1000000)
n = int(input())

g = [[] * n for i in range(n)]
for i in range(n-1):
    u, v, w = map(int, input().split())
    u -= 1
    v -= 1
    g[u].append((v, w))
    g[v].append((u, w))

chk = [0]*n
chk[0] = 1

def dfs(now, prev):
    global chk
    # 今いる頂点から行ける頂点を順に next に入れてループ
    for next in g[now]:
        if next[0] != prev:
          if next[1]%2 == 0:
            chk[next[0]] = chk[now]
          elif next[1]%2 == 1:
            chk[next[0]] = (chk[now]*-1)
          
          dfs(next[0], now)
        
dfs(0,-1)
chk = tuple(chk)
for i in chk:
  if i == 1:
    print(1)
  else:
    print(0)

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

vector<int> G[100000];
bool used[100000];
int Par[100000];


int main()
{
	int n,m;
	cin >> n >> m;
	for(int i =0;i<m;i++)
	{
		int a,b;
		cin >> a >> b;
		a--;
		b--;
		G[a].push_back(b);
		G[b].push_back(a);
	}
	//cout<<';'<<endl;
	queue<int> Q;
	Q.emplace(0);
	used[0] = 1;
	while(!Q.empty())
	{
		int now = Q.front();
		//cout<<now<<endl;
		Q.pop();
		for(auto i:G[now])
		{
			if(used[i]==false)
			{
				Par[i] = now;
				Q.push(i);
				used[i]=true;
			}
		}
	}
	cout<<"Yes"<<endl;
	for(int i = 1;i<n;i++)
	{
		cout<<Par[i]+1<<endl;
	}
}

Measured memory_bytes: 10508
#include <cstdio>
#include<string>
#include<initializer_list>

int main()
{
	char ch[100000],c;
	int fl=0,f,t,i,j,q,siz;
	scanf("%s", ch);
	scanf("%d", &q);
	std::string str(ch);
	for (i = 1; i <= q; i++) {
		scanf("%d", &t);
		if (t == 1) {
			fl++;
		}
		if (t == 2) {
          	scanf("%d %c", &f,&c);
			if (((fl % 2) + f) % 2 == 1) str.insert(str.begin(),c);
			else if (((fl % 2) + f) % 2 == 0) str.push_back(c);
		}
	}
	siz = str.size();
	if (fl % 2 == 0) {
		for (j = 0; j < siz; j++) {
			printf("%c", str.at(j));
		}
	}
	else if (fl % 2 == 1) {
		for (j = siz - 1; j >= 0; j--) {
			printf("%c", str.at(j));
		}
	}
	return 0;
}

Measured memory_bytes: 1080
#include<iostream>
#include<stdio.h>
#include<ctype.h>
using namespace std;

main() {

  char ch, chl;
  int i, num, counter[26];

  for(i = 0; i < 26;i++){
    counter[i] = 0;
  }

  while(cin >> ch){
    chl = tolower(ch);
    num = chl - 'a';
    if(num >= 0 && num <= 25){
      counter[num]++;
      
    }else if(ch == EOF){
      break;
    }
  }

  for(i = 0; i < 26; i++){
    printf("%c : %d\n",i + 'a',counter[i]);
  }
  return 0;

}

Measured memory_bytes: 1124
n, m = map(int, input().split())
AB = [[int(i) for i in input().split()] for i in range(n)]
CD = [[int(i) for i in input().split()] for i in range(m)]

for ab in AB:
    ans = 10 ** 12
    id = 0
    for i, cd in enumerate(CD):
        tmp = abs(ab[0] - cd[0]) + abs(ab[1] - cd[1])
        if tmp < ans:
            ans = tmp
            id = i + 1
    print(id)

Measured memory_bytes: 3064
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <string>
using namespace std;

int main()
{
	int R, n, G;
	while(scanf("%d%d", &R, &G)!=EOF)
	{
		n=G*2-R;
		printf("%d\n", n);
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)

using namespace std;

int main() {
   int r;
   cin >> r;
   cout << 3*r*r << endl;
 }

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

typedef long long ll;
const int MAX_N = 100030;    // Change as necessary
const ll  MODD = 1000000009; //

ll A[MAX_N];

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  
  int n; cin >> n;
  ll x; cin >> x;
  
  for(int i=0;i<n;i++) cin >> A[i];
  
  ll ans = 0;
  for(int i=0;i<n;i++){
    if(A[i] > x){
      ans += A[i]-x;
      A[i] = x;
    }
  }
  
  for(int i=1;i<n;i++){
    if(A[i-1]+A[i] > x){
      ll amt = (A[i]+A[i-1]) -x;
      ans += amt;
      A[i] = max(0ll,A[i] - amt);
    }
  }
  
  cout << ans << endl;
  
  return 0;
}


Measured memory_bytes: 1024
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")

n = int(input())
lr = [None]*n
for i in range(n):
    l,r = map(int, input().split())
    lr[i] = (i,l,r)

lr1 = sorted(lr, key=lambda x: x[1])
lr2 = sorted(lr, key=lambda x: x[2])
lmax = lr1[-1][1]
rmin = lr2[0][2]
lmaxi, rmini = lr1[-1][0], lr2[0][0]
if lr1[-1][0]==lr2[0][0]:
    ans = max(0, rmin-lmax+1) + max(r-l+1 for i,l,r in lr1 if i!=lr1[-1][0])
else:
    ans = max(0, rmin-lmax+1) + max(r-l+1 for i,l,r in lr1)
    
    lr1 = [(i,l,r) for i,l,r in lr1 if i not in (lmaxi, rmini)]
    lr2 = [(i,l,r) for i,l,r in lr2 if i not in (lmaxi, rmini)]
    if len(lr1)==0:
        ans = max(ans, (lr[0][2]-lr[0][1]+1) + (lr[1][2]-lr[1][1]+1))
    else:
        lr1.sort(key=lambda x: (x[1], -x[2]))
        # lr1[i:]のrの最小値
        crmin = [0]*len(lr1)
        crmin[-1] = lr1[-1][2]
        for i in range(len(lr1)-2, -1, -1):
            crmin[i] = min(crmin[i+1], lr1[i][2])
        
        for i in range(1,len(lr1)):
            # lr1[:i]をrmin側にいれる
            _,l,r = lr1[i-1]
            v = max(0, rmin-l+1) + max(0, crmin[i]-lmax+1)
            ans = max(ans, v)
        # すべてrmin or lmax側
        v = max(0, rmin-lr1[-1][1]+1) + max(0, lr[lmaxi][2]-lr[lmaxi][1]+1)
        ans = max(ans, v)

        v = max(0, rmin-lr[rmini][1]+1) + max(0, crmin[0] - lmax +1)
        ans = max(ans, v)
print(ans)

Measured memory_bytes: 79196
#include <bits/stdc++.h>
#define LL long long
#define MEM(x,y) memset(x,y,sizeof(x))
#define MOD(x) ((x)%1000000007)

using namespace std;
const int maxn = 1e5+7;
LL a[maxn],b[maxn],c[2*maxn],sum[2*maxn],suma,sumb;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    int tot=0,n;cin>>n;
    suma=sumb=0;
    for (int i=1;i<=n;i++)
    {
        cin>>a[i]>>b[i];
        suma+=a[i];sumb+=b[i];
        c[++tot]=a[i];c[++tot]=b[i];
    }
    sort(c+1,c+1+tot);
    for (int i=1;i<=n;i++) sum[i]=c[i]+sum[i-1];
    LL ans=min(suma,sumb);
    for (int i=1;i<=n;i++)
    {
        int bound=n;
        LL tmp=0;
        if (a[i]>=c[bound]) tmp+=a[i],bound--;
        if (b[i]>=c[bound]) tmp+=b[i],bound--;
        ans=min(ans,sum[bound]+tmp);
    }
    cout<<ans;
    return 0;
}


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

public class Main {
    public static void main(String[] args) {
        try {
            // 標準入力
            InputStreamReader isr = new InputStreamReader(System.in);
            BufferedReader br = new BufferedReader(isr);
            String strArr[] = br.readLine().split(" ");
            int n  = Integer.parseInt(strArr[0]);
            int k = Integer.parseInt(strArr[1]);
            if (n % k == 0) {
                System.out.println(0);
            } else {
                System.out.println(1);
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

}


Measured memory_bytes: 21204
use proconio::input;
use std::cmp::min;
use std::collections::BTreeSet;

type XYU = (i32,i32,char);
const OFFSET:i32 = 500_000;
const SZ:usize = 1_000_000;
const INF:i32 = 1e9 as i32;
fn rotate(xyu:&Vec<XYU>)->Vec<XYU>{
    let dir = ['U','L','D','R'];
    let sub = |&xyu:&XYU| {
        let (x,y,u) = xyu;
        for i in 0..4 {
            if u==dir[i] {
                return (-y,x,dir[(i+1)%4]);
            }
        }
        assert!(false);
        return xyu;
    };
    xyu.iter().map(sub).collect()
}

fn sub(xyu:&Vec<XYU>)->i32{
    let mut ans = INF;
    let mut rdat = vec![BTreeSet::new();SZ];
    let mut ldat = vec![BTreeSet::new();SZ];
    let mut ddat = vec![BTreeSet::new();SZ];
    for &(x,y,u) in xyu {
        match u {
            'R' => {
                rdat[(x+y+OFFSET) as usize].insert(y);
            }
            'L' => {
                ldat[(x-y+OFFSET) as usize].insert(x);
            }
            'D' => {
                ddat[(x+OFFSET) as usize].insert(y);
            }
            _ => {}
        }
    }

    for &(x,y,z) in xyu {
        if z=='U' {
            if let Some(y2) = rdat[(x+y+OFFSET) as usize].range(y..).next() {
                ans = min(ans,(y2-y)*10);
            }
            if let Some(x2) = ldat[(x-y+OFFSET) as usize].range(x..).next() {
                ans = min(ans,(x2-x)*10);
            }
            if let Some(y2) = ddat[(x+OFFSET) as usize].range(y..).next() {
                ans = min(ans,(y2-y)*5);
            }
        }
    }
    ans
}

fn main() {
    input! {
        n:usize,
        xyu:[(i32,i32,char);n]
    };
    let mut xyu = xyu;

    let mut ans = INF as i32;
    for _ in 0..4 {
        ans = min(ans,sub(&xyu));
        xyu = rotate(&xyu);
    }
    if ans==INF {
        println!("SAFE");
    } 
    else{
        println!("{}",ans);
    }
        

}



Measured memory_bytes: 108188
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a, b;
  cin >> a >> b;

  if ((a % 2 != 0) && (b % 2 != 0)) {
    cout << "Yes" << endl;
  }else {
    cout << "No" << endl;
  }
}

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

typedef long long int ll;
#define MOD 1000000007
#define FASTIO cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define ROF(i,a,b) for(int i=(a);i>=(b);i--)

ll arr[200001];
ll sum[200001];

int main() {
	FASTIO;
	int N;
	ll ans = 0;
	cin >> N;
	FOR(i, 1, N) {
		cin >> arr[i];
	}
	sum[N] = arr[N];
	ROF(i, N - 1, 1) {
		sum[i] = (sum[i + 1] + arr[i]) % MOD;
	}
	FOR(i, 1, N - 1) {
		ans = (ans + arr[i] * sum[i + 1]) % MOD;
	}
	cout << ans;

	return 0;
}

Measured memory_bytes: 6780
#include "bits/stdc++.h"
#define MOD 1000000007
#define INF 11234567890
#define in std::cin
#define out std::cout
#define rep(i,N) for(LL i=0;i<N;++i)
typedef long long int LL;

LL N, M, Q, a[112345], b[112345], v[112345], d[112345], c[112345];
LL dp[112345], ans[112345];
std::vector<LL>G[112345];

void paint(LL v, LL d, LL c)
{
	if (!ans[v]) { ans[v] = c; }
	if (d == 0 || dp[v] >= d) { return; }
	dp[v] = d;
	for (auto e : G[v]) { paint(e, d - 1, c); }
	return;
}

int main()
{
	in >> N >> M;
	rep(i, M)
	{
		in >> a[i] >> b[i];
		G[a[i]].push_back(b[i]);
		G[b[i]].push_back(a[i]);
	}
	in >> Q;
	rep(i, Q) { in >> v[i] >> d[i] >> c[i]; }

	for (LL i = Q - 1; i >= 0; --i) { paint(v[i], d[i], c[i]); }

	rep(i, N) { out << ans[i + 1] << std::endl; }
	return 0;
}

Measured memory_bytes: 13172
#include <iostream>
#include <algorithm>
#include <math.h>
#include <string>
using namespace std;

int main() {
  string a;
  long int n, total;
  long int c[26];
  for(int k = 0; k<26; k++){
    c[k] = 0;
  }
  
  cin >> a;
  n = a.length();
  for(int i = 0; i<n; i++){
    c[a[i] - 'a']++;
  }
  total = n*(n-1)/2 +1;
  for(int j = 0; j<26; j++){
    total -= c[j]*(c[j]-1)/2;
  }
  cout << total << endl;
  return 0;
}

Measured memory_bytes: 3768
import numpy as np

A = [list(map(int,input().split())) for _ in range(3)]
N = int(input())
B = [int(input()) for _ in range(N)]

BINGO = np.array([[False for i in range(3)]for j in range(3)])

for i in range(3):
    for j in range(3):
        if A[i][j] in B:
            BINGO[i][j] = True

#横確認
for i in BINGO:
    if False not in i:
        print("Yes")
        exit()

BINGO = BINGO.T # 縦横を入れ替えTはnumpyの関数

#縦確認
for i in BINGO:
    if False not in i:
        print("Yes")
        exit()

#斜め確認
cross = [BINGO[i][i] for i in range(3)]
cross_re = [BINGO[i][2-i] for i in range(3)]

if False not in cross or False not in cross_re:
    print("Yes")
    exit()

print("No")

Measured memory_bytes: 12364
#include <iostream>
#include <algorithm>
#include <math.h> 
#include <string>
#include <iomanip>
#include <vector>
#include <chrono>
#include <cstdlib>
#include <bitset>
using namespace std;
int main(){
    int n;
    int a[200200];
    int b[200200];
    cin >> n;
    for(int i = 0; i < n; i++){
        cin >> a[i];
        b[i] = a[i];
    }
    sort(a,a+n);
    int max = 0;
    int smax = 0;
    max = a[n-1];
    smax = a[n-2];
    for(int i = 0; i < n; i++){
        if(b[i] == max) cout << smax << endl;
        else cout << max << endl;
    }
    
}

Measured memory_bytes: 3200
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<cstdlib>
#include<utility>
#include<vector>
using namespace std;
typedef long long LL;
const int MaxN = 1e5;

int n, ans;
bool vis[MaxN + 5];

struct NODE{
	int cost, u, v;
};

NODE box[MaxN + 5][3];
struct XX{
	int x, y;
	int p;
}a[MaxN + 5];

vector<NODE> que;

bool cmp1(XX x, XX y){
	return x.x < y.x;
}
bool cmp2(XX x, XX y){
	return x.y < y.y;
}
bool cmp3(NODE x, NODE y){
	return x.cost < y.cost;
}
int fa[MaxN + 5];
int find(int x){
	if(fa[x] == x) return x;
	else return fa[x] = find(fa[x]);
}
int main(){
	while(~scanf("%d", &n)){
		for(int i = 1; i <= n; i++){
			scanf("%d %d", &a[i].x, &a[i].y);
			a[i].p = i;
		}
		sort(a + 1, a + 1 + n, cmp1);
		for(int i = 2; i <= n; i++){
			int len = min(abs(a[i].x - a[i - 1].x), abs(a[i].y - a[i - 1].y));
			NODE temp;
			temp.cost = len, temp.u = a[i - 1].p, temp.v = a[i].p;
			que.push_back(temp);
			box[a[i].p][1].cost = len;
			box[a[i - 1].p][1].v = a[i].p;
			box[a[i].p][1].v = a[i - 1].p;
		}
		sort(a + 1, a + 1 + n, cmp2);
		for(int i = 2; i <= n; i++){
			int len = min(abs(a[i].x - a[i - 1].x), abs(a[i].y - a[i - 1].y));
			NODE temp;
			temp.cost = len, temp.u = a[i - 1].p, temp.v = a[i].p;
			que.push_back(temp);
			box[a[i].p][2].cost = len;
			box[a[i - 1].p][2].v = a[i].p;
			box[a[i].p][2].v = a[i - 1].p;
		}
		for(int i = 1; i <= n; i++){
			if(box[i][1].cost > box[i][2].cost) swap(box[i][1], box[i][2]);
		}
		int len = que.size();
		sort(que.begin(), que.end(), cmp3);
		for(int i = 1; i <= n; i++) fa[i] = i;
		LL tot = 0;
		for(int i = 0; i < len; i++){
			int u = que[i].u, v = que[i].v, cost = que[i].cost;
			if(find(u) != find(v)){
				fa[find(u)] = find(v);
				tot += cost;
			}
		}
		printf("%lld\n", tot);
	}
	return 0;
}



Measured memory_bytes: 9588
#include "iostream"
#include "algorithm"
#include "vector"
#include "string"
#include "cmath"
typedef long long ll;
using namespace std;

int  check(ll numm) {
  if(numm > 0)if(numm < 13) return(1);
  return 0;
}

int main(int argc, char const *argv[]) {
  ll SS;

  std::cin >> SS;

  ll first2, last2;
  first2 = SS/100;
  last2 = SS - first2 * 100;

  // std::cout << first2 <<" " << last2 << '\n';
  // std::cout << check(first2) <<" " << check(last2) << '\n';

  if (check(first2) == 1) {
    if(check(last2) == 1){
      std::cout << "AMBIGUOUS" << '\n';
    }else{
      std::cout << "MMYY" << '\n';
    }
  }else{
    if(check(last2) == 1){
      std::cout << "YYMM" << '\n';
    }else{
      std::cout << "NA" << '\n';
    }

  }


  return 0;
}


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

using namespace std;

int main()
{
    int N;
    while (cin >> N) {
        int cnt = 0;
        for (int i = 0; i <= 9; i++) {
            for (int j = 0; j <= 9; j++) {
                for (int k = 0; k <= 9; k++) {
                    for (int l = 0; l <= 9; l++) {
                        if (i + j + k + l == N) {
                            cnt++;
                        }
                    }
                }
            }
        }
        cout << cnt << endl;
    }
    return 0;
}

Measured memory_bytes: 3080
#include "bits/stdc++.h"
using namespace std;
using ll=long long;
#define rep(i,a,n) for(int i=a;i<n;i++)
#define ALL(s) s.begin(),s.end()
#define P pair<ll,ll>
#define vl vector<ll>
#define vi vector<int>
#define vvl vector<vector<ll>>
#define vvi vector<vector<int>>
#define print(n) cout<<n<<endl
const int M=100111;
const ll inf=1000000007;
const ll MOD=1000000007;
const long long INF=1000000000000000007;
int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};
int ddx[8]={1,-1,0,0,1,-1,-1,1},ddy[8]={0,0,1,-1,1,-1,1,-1};

struct UnionFind {
	vector<int> par;
	UnionFind(int n) : par(n, -1) { }

	int root(int x) {
		if (par[x] < 0) return x;
		else return par[x] = root(par[x]);
	}

	bool same(int x, int y) {
		return root(x) == root(y);
	}

	bool merge(int x, int y) {
		x = root(x); y = root(y);
		if (x == y) return false;
		if (par[x] > par[y]) swap(x, y); // merge technique
		par[x] += par[y];
		par[y] = x;
		return true;
	}

	int size(int x) {
		return -par[root(x)];
	}
};


int main(){
	int h,w,a,b;
	cin>>h>>w>>a>>b;
	if(a==0&&b==0){
		rep(i,0,h){
			rep(j,0,w)cout<<1;
			cout<<endl;
		}
		return 0;
	}
	if(a==0){
		rep(i,0,h){
			rep(j,0,w){
				if(i<b)cout<<1;
				else cout<<0;
			}
			cout<<endl;
		}
		return 0;
	}
	if(b==0){
		rep(i,0,h){
			rep(j,0,w){
				if(j<a)cout<<1;
				else cout<<0;
			}
			cout<<endl;
		}
		return 0;
	}
	int hh,ww;
	hh=max(b,h-b),ww=max(a,w-a);
	int even=0;
	rep(j,0,h){
		if(j>=hh)even=1;
		rep(i,0,w){
			if(even==0){
				if(i<ww)cout<<1;
				else cout<<0;
			}
			else{
				if(i<ww)cout<<0;
				else cout<<1;
			}
		}
		cout<<endl;
	}
	return 0;
}

	


Measured memory_bytes: 1280
#include <iostream>
#include<string>
using namespace std;
int main()
{
	string S ;
	int a=0 , b=0;
	while(true)
	{
		cin >> S ;
		if(S[0]=='0') break ;
		a=S.size() ;
		for(int i=0;i< a ;i++)
		{
			b+=S[i]-48 ;
		}
		cout << b << endl ;
		a=0 ;
		b=0 ;

	}
	return 0 ;
}



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

int main() {
  int x1,x2,x3,x4,x5;
  cin >> x1 >> x2 >> x3>> x4>>x5;
  int a;
  if(x1==0){
  cout << 1 <<endl;
  }
  if(x2==0){
  cout << 2 <<endl;
  }
  if(x3==0){
  cout << 3 <<endl;
  }
if(x4==0){
  cout << 4 <<endl;
  }
if(x5==0){
  cout << 5 <<endl;
  }
  
}


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


int main(){
    int N, M;
    cin >> N >> M;
    char ans[M][13];
    vector<pair<int, pair<int, int>>> a(M+1);
    a[M].first=2e9;
    for(int i=0; i<M; i++){
	cin >> a[i].first >>a[i].second.first;
	a[i].second.second=i;
    }
    sort(a.begin(), a.end());
    int right = 1;
    for(int i=0; i<M; i++){
	int left = a[i].first;
	sprintf(ans[a[i].second.second], "%06d%06d", left, right);
	if(a[i].first==a[i+1].first)
	    right++;
	else
	    right=1;
    }
    for(int i=0; i<M; i++){
    	cout << ans[i] <<endl;
    }
    
}




Measured memory_bytes: 3968
#include<stdio.h>
int main(void){
  char *s="python3 -c\""
"s=lambda a,b:a if a<b else s(a//b,b)+a%b;n=int(input());print(min(s(i,6)+s(n-i,9)for i in range(n+1)))\n"
"\"";
  system(s);
  return 0;
}            

Measured memory_bytes: 3280
#include <iostream>
#include <iomanip> //! for setprecision(10)
#include <math.h>
#include <algorithm>
#include <functional> 
#include <string>
#include <vector>

#include <cstring>
#include <set>
#include <map>
#include <queue>
#include <utility>

using namespace std;

typedef long long LL;

#define dump(c) { for (auto it = c.begin(); it != c.end(); ++it) if (it == c.begin()) cout << *it; else cout << ' ' << *it; cout << endl; } 
#define rep(i,n) for (int i = 0; i < (n); ++i)

const int MOD = 1000000007;

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

    int H, W;
    cin >> H >> W;

    vector<string> A;
    rep(i, H) {
        string s;
        cin >> s;
        if (s.find('#') != string::npos) {
            A.push_back(s);
        }
    }

    vector<string> ans(A.size());
    rep(x, W) {
        bool allWhite = true;
        for (int y = 0; allWhite && y < A.size(); ++y) {
            if (A[y][x] == '#') {
                allWhite = false;
            }
        }
        if (!allWhite) {
            for (int y = 0; y < A.size(); ++y) {
                ans[y] += A[y][x];
            }
        }
    }

    rep(i, ans.size()) {
        cout << ans[i] << endl;
    }

    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define FI(i,a,b) for(int i=(a);i<=(b);i++)
#define FD(i,b,a) for(int i=(b);i>=(a);i--)
#define len(a) int((a).size())
using namespace std;
using LL = long long;
using PII = pair<int, int>;

const int N = 2005;
int n, z, w;
int A[N];

int main() {
    scanf("%d%d%d", &n, &z, &w);
    FI(i,1,n) scanf("%d", &A[i]);
    if (n == 1) {
        printf("%d\n", abs(A[n]-w));
    } else {
        printf("%d\n", max(abs(A[n]-w), abs(A[n-1]-A[n])));
    }
}

Measured memory_bytes: 256
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
d = [x for x in a]
d.extend(b)
d.extend(c)
d.sort()
li = [d.count(i+1) for i in range(4) ]
if max(li)>=3 or min(li)==0:
    print('NO')
else:
    print('YES')

Measured memory_bytes: 3064
n, a, b = map(int,input().split())

MOD = pow(10, 9) + 7


def my_pow(n, p, m):
    """
    calculate n^p (mod m) effectively
    """
    if p == 0:
        return 1
    elif p%2 == 0:
        return ((my_pow(n, p//2, m)) ** 2) % m
    else:
        return (my_pow(n, p-1, m) * n) % m


def comb(n, r, m):
    """
    calculate nCr using the factorial table
    return: nCr % MOD
    """
    numerator = 1
    for i in range(n-r+1, n+1):
        numerator = (i * numerator) % m
    denominator = 1
    for i in range(1, r+1):
        denominator = (i * denominator) % m

    # a^p-1 ≡ 1 (mod p) (p: prime)
    # a^p-2 ≡ a^-1
    fermat = my_pow(denominator, m-2, m)
    return (numerator * fermat) % m


print((my_pow(2,n,MOD) - 1 - comb(n,a,MOD) - comb(n,b,MOD)) % MOD)





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

const int64_t MOD = 1000000007;
typedef long long ll;
typedef unsigned long long ull;

#define FOR(i, start, end) for(uint64_t i=start; i<end; i++)
#define REP(i, n) FOR(i, 0, n)

// 最大公約数gcd
// 最小公倍数lcm=m*n/gcd
uint64_t gcd(uint64_t m, uint64_t n) {
  uint64_t temp;
  while (m % n != 0){
    temp = n;
    n = m % n;
    m = temp;
  }
  return n;
}

uint64_t lcm(uint64_t m, uint64_t n) {
  return (m*n)/gcd(m,n);
}

// vector<vector<uint64_t> > v(n+1, vector<uint64_t>(n+1, 0))
// v[n][k]に組み合わせ数が入る。
void comb(vector<vector <uint64_t> > &v){
  for(uint64_t i = 0;i <v.size(); i++){
    v[i][0]=1;
    v[i][i]=1;
  }
  for(uint64_t k = 1;k <v.size();k++){
    for(uint64_t j = 1;j<k;j++){
      v[k][j]=(v[k-1][j-1]+v[k-1][j]);
    }
  }
}

// 掛け算オーバーフロー判定
bool is_product_overflow(uint64_t a, uint64_t b) {

	uint64_t prod = a * b;
	
	return (prod / b != a);
}

//素因数分解
void primeFactorization(uint64_t a, list<uint64_t> &factors){ //素因数分解を出力するプログラム
  long i,sq;
  if(a%2==0){ //偶数の場合
    factors.push_back(2);
    primeFactorization(a/2,factors); //2で割った値で再帰
    return;
  }
  sq = sqrt(a);
  for(i=3;i<=sq;i+=2){ //3以上√a以下の奇数の場合
	if(a%i==0){
	  factors.push_back(i);
      primeFactorization(a/i,factors); //割れた値で再帰
      return;
	}
  }
  //偶数でも3以上√a以下の奇数の場合でも割り切れない場合
  if(a!=1){ //aが1でないなら、a自身は素数
    factors.push_back(a);
  }
}

// フェルマーの小定理
// mod. m での a の逆元 a^{-1} を計算する
// (a/b)%m = a*movinv(b,m)%m  
int64_t modinv(int64_t a, int64_t m) {
    int64_t b = m, u = 1, v = 0;
    while (b) {
        int64_t t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

// 円周率
// M_PI

// #include <iomanip> // setprecisionを使用するのに必要
// cout << std::fixed << std::setprecision(15) << y << endl;

// 昇順
// priority_queue<int, vector<int>, greater<int> > queue;

signed main() {
  ll n,x,t;
  cin >> n >> x >> t;

  cout << ((n+x-1)/x)*t << endl;

  return 0;
}



Measured memory_bytes: 3700
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
#[allow(unused_imports)]
use std::io::{BufWriter, Write};

// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
#[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)*) => {
//        #[allow(unused_mut)]
        let $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, bytes) => {
        read_value!($next, String).into_bytes()
    };

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

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

fn solve() {
    input!(
        n: usize,
        q: usize,
        s: chars,
        mut lr: [(usize, usize); q],
    );
    let mut dp = Vec::new();
    dp.resize(n, 0);
    for i in 1..n {
        if s[i-1] == 'A' && s[i] == 'C' {
            dp[i] = dp[i-1] + 1;
        }
        else {
            dp[i] = dp[i-1];
        }
    }
    for (l, r) in lr {
        println!("{}", dp[r-1] - dp[l-1]);
    }
}

fn main() {
    let stack_size = 1 << 28;
    let thd = std::thread::Builder::new().stack_size(stack_size);
    thd.spawn(|| solve()).unwrap().join().unwrap();
}


Measured memory_bytes: 11132
a,b,c,d = list(input())
op = '+-'
for i in range(2):
    for j in range(2):
        for k in range(2):
            if eval(a+op[i]+b+op[j]+c+op[k]+d)==7:
                print(a+op[i]+b+op[j]+c+op[k]+d+'=7')
                exit()

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

#define rep(a,b) for(int a = 0;a < b;a++)
#define REP(i, x, n) for(int i = x; i < n; i++)
#define P(a) cout << a << endl
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
#define ssort(v) sort(v.begin(),v.end())
#define rev(v) reverse(v.begin(),v.end())
#define vP(v) for(int i = 0;i < v.size();i++){cout << v[i];if(i != v.size()-1)cout << endl;}
#define vcin(v,n) rep(i,n){int a;cin >> a;v.pb(a);}

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
int dx[] = { 1, -1 , 0 , 0 };
int dy[] = { 0,  0,  1, -1 };
ll MOD = 1000000007;

void solve(){
	int n,h,w;
	cin >> w >> h >> n;
	int l,r,u,d;
	l = 0;
	r = w;
	u = h;
	d = 0;
	rep(i,n){
		int a,b,c;
		cin >> a >> b >> c;
		if(c == 1){
			l = max(l,a);
		}else if(c == 2){
			r = min(r,a);
		}else if(c == 3){
			d = max(d,b);
		}else{
			u = min(u,b);
		}
	}
	P(max(0,(r-l))*max(0,(u-d)));
}

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


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<numeric>
#include<utility>

using namespace std;

typedef long long int ll;
const int INF = 1<<30;
const long long LINF = 1LL<<60;

int main(){
    int n, ans = 0;
    cin >> n;
    vector<int> a(n), b(n), c(n - 1);
    for(int i = 0; i < n; i++){
        cin >> a[i];
        a[i]--;
    }
    for(int i = 0; i < n; i++){
        cin >> b[i];
    }
    for(int i = 0; i < n - 1; i++){
        cin >> c[i];
    }
    ans = b[a[0]];
    for(int i = 1; i < n; i++){
        ans += b[a[i]];
        if(a[i - 1] + 1 == a[i]){
            ans += c[a[i - 1]];
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
#include <queue>
#include <map>
#include <set>
#include <cstring>
#include <cstdlib>
#include <string>
#include <cmath>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
const int INF = 1<<29;

int n;
int ba[365][4][4];
bool memo[366][3][3][7*7*7*7];
bool visited[366][3][3][7*7*7*7];

int dx[] = {0,1,0,-1};
int dy[] = {1,0,-1,0};

int hogex[] = {0, 0, 2, 2};
int hogey[] = {0, 2, 0, 2};

bool solve(int day, int y, int x, int S) {
  if (visited[day][y][x][S]) return memo[day][y][x][S];
  
  visited[day][y][x][S] = 1;

  if (day == n) return memo[day][y][x][S]=1;
  int tmp = S;
  int norain[4];
  REP(i,4) {
    norain[i] = tmp%7;
    tmp /= 7;
  }
  REP(i, 2) 
    REP(j, 2)
      if (ba[day][y+i][x+j]) return memo[day][y][x][S]=0;
  REP(i, 4) {
    int xx = x, yy = y;
    if (i) {
      xx+=dx[i]; yy+=dy[i];
    }
    while(0<=xx&&xx<=2&&0<=yy&&yy<=2) {
      int nextS = 0;
      int tmp = 1;
      bool f = 0;
      REP(j, 4) {
        if (!(xx==hogex[j] && yy==hogey[j])) {
          if (norain[j] == 6)
            f = 1;
          nextS += tmp * (norain[j] + 1);
        }
        tmp *= 7;
      }
      if ((day==n || !f) && solve(day+1, yy, xx, nextS)) {
        // printf("%d,%d,%d,%d\n",day,y,x,S);
        // REP(j, 4) 
        //   cout << norain[j] << " ";
        // cout<< endl;
        return memo[day][y][x][S]=1;
      }
      yy += dy[i];
      xx += dx[i];
    }
  }
  return memo[day][y][x][S]=0;
}

int main() {
  while(cin>>n,n) {
    REP(i, n) {
      REP(j,4) {
        REP(k,4) {
          cin >> ba[i][j][k];
//          cout <<ba[i][j][k] << " ";
        }
//        cout << endl;
      }
//      cout << endl;
    }
    memset(visited,0,sizeof(visited));
    cout <<  (solve(0, 1, 1, 400)? 1: 0) << endl;
  }
}

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

int main() {
    int N;
    cin >> N;
    vector <long long> T(N), A(N), num(N);
    for(int i=0;i<N;i++){
    	cin >> T[i] >> A[i];
    	num[i]=T[i]+A[i];
    }
    for(int i=1;i<N;i++){
    	long long a=T[i-1]/T[i], b=A[i-1]/A[i];
    	if(T[i-1]%T[i]) a++; if(A[i-1]%A[i]) b++;
    	T[i]*=max(a,b); A[i]*=max(a,b); num[i]*=max(a,b);
    	}
    cout << num[N-1] << endl;
    return 0;
}

Measured memory_bytes: 256
from scipy.special import comb
def main():
    n = int(input())
    # sum = 0
    # for i in range(1, n):
    #     sum += comb(n, i, exact=True)
    # sub = (n-2)*sum
    # ans = n*(n-1)*(10**(n-2))-sub
    ans = 10**n - 2*(9**n) + 8**n
    print(int(ans%((10)**9+7)))
if __name__ == '__main__':
    main()

Measured memory_bytes: 44056
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
int main(){
  int n;
  cin>>n;
  if(n%2==0){
    cout<<n<<endl;
    return 0;
  }
  for(int i=2;i<1000000000;i++){
    if(n*i%2==0){
      cout<<n*i<<endl;
      return 0;
    }
  }
}

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

using namespace std;

int main()
{
    char a;
    cin>>a;
    if(a == 'A'){ cout<<"T"; return 0;}
    if(a == 'T'){ cout<<"A"; return 0;}
    if(a == 'G'){ cout<<"C"; return 0;}
    if(a == 'C'){ cout<<"G"; return 0;}
}

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

namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = Console.ReadLine().Split().Select(s=>int.Parse(s)).ToArray()[0];
            var an = Console.ReadLine().Split().Select(s=>int.Parse(s)).ToArray();
            var ans = new int[N];
            for(var i=0;i<N-1;i++)
            {
                ans[an[i] - 1]++;
            }
            for(var i=0;i<N;i++)
            {
                Console.WriteLine(ans[i]);
            }
        }
    }
}

Measured memory_bytes: 40276
#include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int main()
{
    bool x = true;
    for(;;){
        int a, b;
        cin>>a>>b;
        if(a==0&&b==0)return 0;
        if(!x)cout<<endl;
        else x=false;

        bool y=true;
        for(int i=a;i<=b;++i){
            if(i%400 == 0||(i%100!=0&&i%4==0)){
                cout<<i<<endl;
                y=false;
            }
        }
        if(y)cout <<"NA"<< endl;
    }
}

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

using namespace std;

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

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	string S; cin >> S;
	int w; cin >> w;
	int n = (int)S.length();

	string res = "";
	rep (i, n){
		if (i % w == 0){
			res += S[i];
		} // end if
	} // end rep

	cout << res << endl;

	return 0;
}

Measured memory_bytes: 256
x, n = map(int, input().split())
p = set(map(int, input().split()))
l = {i for i in range(-100, 200)}

s = list(l - p)
min_diff = 1000
ans = 1000

for j in range(len(s)):
    diff = abs(s[j] - x)
    if min_diff > diff:
        min_diff = diff
        ans = s[j]

print(ans)

Measured memory_bytes: 9216
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
#define int long long
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr long long INFL = numeric_limits<long long>::max() / 2;
constexpr int MOD = 1000000007;
using Graph = vector<vector<int>>;



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

    int N;
    cin>>N;
    vector<int> A(N),B(N),C(N);
    rep(i,N){
        cin>>A[i];
    }
    rep(i,N){
        cin>>B[i];
    }
    rep(i,N){
        cin>>C[i];
    }
    sort(A.begin(),A.end());
    sort(B.begin(),B.end());
    sort(C.begin(),C.end());
    int ans=0;

    rep(i,N){
        int  x=lower_bound(A.begin(),A.end(),B[i]) - A.begin();
        int  y=C.end() - upper_bound(C.begin(),C.end(),B[i]);
        ans+=x*y;
    }
    cout << ans << endl;
    


}


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

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

using namespace std;

int main(){
  
  int a,b;
  cin>>a>>b;
  
  cout<<(b>=a ? a : a-1);
  
  return 0;
}

Measured memory_bytes: 256
n = int(input())
h = list(map(int, input().split()))

ans = 0
i = 1
tmp = 0
while i < n:
    if h[i] <= h[i-1]:
        tmp += 1
    else:
        tmp = 0
    ans = max(ans, tmp)
    i += 1
print(ans)


Measured memory_bytes: 15020
#include<cstdio>
const int N=5e5+77;
int es[N],enx[N],e0[N],ep=2;
int f[N],n;
void f1(int w,int pa){
	for(int i=e0[w];i;i=enx[i]){
		int u=es[i];
		if(u!=pa){
			f1(u,w);
			f[w]^=f[u]+1;
		} 
	}
}
int main(){
	scanf("%d",&n);
	for(int i=1,a,b;i<n;++i){
		scanf("%d%d",&a,&b);
		es[ep]=b;enx[ep]=e0[a];e0[a]=ep++;
		es[ep]=a;enx[ep]=e0[b];e0[b]=ep++;
	}
	f1(1,0);
	puts(f[1]?"Alice":"Bob");
	return 0;
}

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

#define rep(i,N) repv(i,0,N)
#define reps(i,N) repvs(i,0,N)
#define repv(i,a,b) for(int i=a;i<b;i++)
#define repvs(i,a,b) for(int i=a+1;i<=b;i++)
#define repr(i,N) for(int i=N-1;i>=0;i--)
#define reprs(i,N) for(int i=N;i>0;i--)

#define debug(a) if(isDebugMode) cout<<#a<<"="<<a<<","
#define debug2(a,b) if(isDebugMode) cout<<#a<<"="<<a<<","<<#b<<"="<<b
#define debug3(a,b,c) if(isDebugMode) cout<<#a<<"="<<a<<","<<#b<<"="<<b<<","<<#c<<"="<<c
#define debug4(a,b,c,d) if(isDebugMode) cout<<#a<<"="<<a<<","<<#b<<"="<<b<<","<<#c<<"="<<c<<","<<#d<<"="<<d
#define debugarr(arr,N){if(isDebugMode){ rep(i,N+1)\
	{if(arr[i]==INF)printf("INF ");\
		else cout<<arr[i]<<" ";} cout<<endl;}}
#define debugarr2(arr,N,M){if(isDebugMode) rep(i,N+1){rep(j,M+1)\
	{if(arr[i][j]==INF)printf(" INF");\
		else printf(" %3d",arr[i][j]);} cout<<endl;}}
#define pb push_back
#define pob pop_back
#define show(a) cout<<a<<endl;

auto chmax =[](int &a,int b){a=max(a,b);};
auto chmin =[](int &a,int b){a=min(a,b);};

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

bool isDebugMode=false;
//--------------------------------------//
int n,k;
int x[100000];
ll d[100001];
int main(){
	cin>>n>>k;
	rep(i,n) {
		cin>>x[i];
	}
	sort(x,x+n);
	rep(i,n-1)
		d[i+1]=d[i]+x[i+1]-x[i];
	debugarr(d,n);
	ll ans=1000000000000;
	rep(i,n-k+1){
		ll a=d[k-1+i]-d[i];
		if(x[i]<0&&x[k-1+i]<0) a+=abs(x[k-1+i]);
		else if(x[i]<0&&x[k-1+i]>0) a+=min(abs(x[i]),abs(x[k-1+i]));
		else if(x[i]>0&&x[k-1+i]>0) a+=abs(x[i]);
		debug(a);
		ans=min(ans,a);
	}
	show(ans);
	return 0;
}


Measured memory_bytes: 1408
#include <iostream>
#include<queue>
#include<stack>
#include<vector>
#include<set>
#include<map>
#include<algorithm>
#include<cstring>
#include<string>
#include<cassert>
#include<cmath>
#include<climits>
#include<iomanip>
#include<bitset>
#include<unordered_map>

using namespace std;

#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define rep(i,j,n) for(ll (i)=(j);(i)<(n);(i)++)
#define FOR(i,c) for(decltype((c).begin())i=(c).begin();i!=(c).end();++i)
#define ll long long
#define ull unsigned long long
#define all(hoge) (hoge).begin(),(hoge).end()
#define F first
#define S second
#define en "\n"
typedef pair<ll, ll> P;
const long long INF = 1LL << 60;
const long long MOD = 1e9 + 7;
typedef vector<ll> Array;
typedef vector<Array> Matrix;
const int loose = 0;
const int tight = 1;



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

//グラフ関連
struct Edge {//グラフ
	ll to, cap, rev;
	Edge(ll _to, ll _cap, ll _rev) {
		to = _to; cap = _cap; rev = _rev;
	}
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

void add_edge(Graph& G, ll from, ll to, ll cap, bool revFlag, ll revCap) {
	G[from].push_back(Edge(to, cap, (ll)G[to].size()));
	if (revFlag)G[to].push_back(Edge(from, revCap, (ll)G[from].size() - 1));
}

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

	ll n, k;
	cin >> n >> k;
	Array p(n, 0);
	REP(i, n) cin >> p[i];

	vector<double> sum(n + 1, 0);
	REP(i, n) sum[i + 1] = sum[i] + (1.0 + (double)p[i]) / 2.0;

	double ans = 0.0;

	REP(i, n) {
		if (i + k > n) break;
		chmax(ans, sum[i + k] - sum[i]);
	}
	cout << fixed << setprecision(8)<<ans << endl;
	return 0;
}


Measured memory_bytes: 3456
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define F first
#define S second

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

const int MOD=1000000007;
int INF=100100100100100;

signed main(){
  int n;cin>>n;
  string s;cin>>s;
  int k;cin>>k;k--;
  rep(i,n){
    if(s[i]!=s[k])s[i]='*';
  }
  cout<<s<<endl;
  return 0;
}

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

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

int main() {
  vector<vector<int>> A(3, vector<int>(3));
  REP(i, 3) {
    REP(j, 3) { cin >> A[i][j]; }
  }
  vector<int>::iterator itr;

  int N;
  int b;
  cin >> N;

  REP(i, N) {
    cin >> b;
    REP(j, 3) {
      itr = find(A[j].begin(), A[j].end(), b);
      if (itr != A[j].end()) {
        size_t idx = distance(A[j].begin(), itr);
        A[j][idx] = 0;
      }
    }
  }

  REP(i, 3) {
    int sum = accumulate(A[i].begin(), A[i].end(), 0);
    if (sum == 0) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  REP(i, 3) {
    int sum = A[0][i] + A[1][i] + A[2][i];
    if (sum == 0) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  if (A[0][0] + A[1][1] + A[2][2] == 0) {
    cout << "Yes" << endl;
    return 0;
  } else if (A[0][2] + A[1][1] + A[2][0] == 0) {
    cout << "Yes" << endl;
    return 0;
  } else {
    cout << "No" << endl;
    return 0;
  }
}


Measured memory_bytes: 3556