akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define ll long long
#define pii pair<int,int> 
#define mp make_pair
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fi first
#define se second
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
ll pre[205000],suf[205000],a[205000];
int n,ind;
ll ans,les;
int main(){
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
        scanf("%I64d",&a[i]);
    for(int i=1;i<=n;i++)
        pre[i]=pre[i-1]+a[i];
    for(int i=n;i>=1;i--)
        suf[i]=suf[i+1]+a[i];
    les=1e18;
    for(int i=0;i<=n;i++)
        if(les>=abs(suf[i+1]-pre[i]))
            les=abs(suf[i+1]-pre[i]),ind=i;
        else break;
    //ind
    if(suf[ind+1]-pre[ind]<=0){
        ll nowl=pre[ind],nowr=suf[ind+1];
        //cout<<nowl<<" "<<nowr<<endl;
        for(int i=1;i<=ind && nowl!=nowr;i++){
            int nnn=min(a[i]-1,nowl-nowr);
            nowl-=nnn;
            a[i]-=nnn;
            ans+=nnn;
        }
        printf("%I64d\n",ans+nowl-nowr);
    }
    else{
        printf("%I64d\n",suf[ind+1]-pre[ind]);
    }
    return 0;
}

Measured memory_bytes: 4992
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repi(i, s, n) for (int i = (s); i < (n); i++)
#ifdef LOCAL
#define INPUT_FILE                   \
  ifstream in("abc143/abc143_b.txt"); \
  cin.rdbuf(in.rdbuf());
#else
#define INPUT_FILE
#endif
#define CIN_OPTIMIZE \
  cin.tie(0);        \
  ios::sync_with_stdio(false);
typedef pair<int, int> P;
typedef long long ll;
const int INF = 100100100;
const ll LINF = 1e18+100;
const int MOD = 1e9 + 7;

int main() {
  INPUT_FILE CIN_OPTIMIZE;

  int N;
  cin >> N;
  
  vector<int> c(N);
  rep(i, N) { cin >> c[i]; }

  ll ans = 0;
  rep(i, N) {
    repi(j, i + 1, N) { ans += c[i] * c[j]; }
  }

  cout << ans << endl;
}

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

using i8  = int8_t;   /* -128 ~ 127 */
using u8  = uint8_t;  /* 0 ~ 255 */
using i16 = int16_t;  /* -32,768 ~ 32,767 */
using u16 = uint16_t; /* 0 ~ 65,535 */
using i32 = int32_t;  /* -2,147,483,648 ~ 2,147,483,647 */
using u32 = uint32_t; /* 0 ~ 4,294,967,295 */
using i64 = int64_t;  /* -9,223,372,036,854,775,808 ~ 9,223,372,036,854,775,807 */
using u64 = uint64_t; /* 0 ~ 18,446,744,073,709,551,615 */
using f32 = float;    /* (-3.4 * 10^38) ~ (3.4 * 10^38) */
using f64 = double;   /* (-1.7 * 10^308) ~ (1.7 * 10^308) */
using f80 = __float80;
template <class T> using Vec = vector<T>;
constexpr i64 INF = 1010000000000000017;
constexpr i64 MOD = 1e9 + 7;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
#define ALL(v) v.begin(), v.end()
#define GCD(a, b) __gcd(a, b) /* 最大公約数 */
#define LCM(a, b) a / __gcd(a, b) * b /* 最小公倍数 */

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}

void Main() {
    u32 a, b;
    cin >> a >> b;
    if (a > b) for (u32 i = 0; i < a; i++) cout << b;
    else for (u32 i = 0; i < b; i++) cout << a;
    cout << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <limits.h>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <math.h>
using namespace std;

long long inf = 1e9+7;

int main(void){
    int n, a, b;
    cin >> n >> a >> b;
    
    cout << min(a, b) << " " << max((a + b) - n, 0) << endl;
    
}


Measured memory_bytes: 764
#include <stdio.h>

int main(void)
{
	int i,j,k;
	int team[100],score[100];
	int rank[100];
	int count,number,tmp1,tmp2,info;
	
	count=0;
	//入力
	for(i=0;i<100;i++)
	{
		scanf("%d,%d",&team[i],&score[i]);
		if(team[i]+score[i]==0)
			break;
		count++;
	}
	
	//並び替え
	for(i=0;i<count;i++)
	{
		for(j=count-1;j>i;j--)
		{
			if(score[i]<=score[j])
			{
				tmp1=score[i];
				score[i]=score[j];
				score[j]=tmp1;
				
				tmp1=team[i];
				team[i]=team[j];
				team[j]=tmp1;
			}
		}
	}
	//順位付け
	number=1;
	rank[0]=number;
	tmp2=score[0];
	for(i=1;i<count;i++)
	{
		//printf("%d %d\n",score[i],tmp2);
		if(score[i]!=tmp2)
		{
			number++;
			tmp2=score[i];
		}
		rank[i]=number;
	}
	
	
	//問い合わせ
	while(scanf("%d",&info)!=EOF)
	{
		for(i=0;i<count;i++)
		{
			if(info==team[i])
				printf("%d\n",rank[i]);
			//printf("%d,%d\n",team[i],score[i]);
		}
	}
	return 0;
}

Measured memory_bytes: 600
n = int(input())
uv = [list(map(int, input().split())) for _ in range(n - 1)]

ans = 0
for i in range(1, n + 1):
    ans += (1 + n - i + 1) * (n - i + 1) // 2

for u, v in uv:
    u, v = min(u, v), max(u, v)
    ans -= u * (n - v + 1)

print(ans)


Measured memory_bytes: 45344
package main

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

func main() {
	log.SetFlags(log.Lshortfile)
	scan := newScanner()
	S := scan.nextLine()
	s := []byte(S)
	var a [26][]int
	for i := 0; i < len(s); i++ {
		k := s[i] - 'a'
		a[k] = append(a[k], i)
	}
	// log.Println(a)
	ans := 1 << 30
	for i := 0; i < 26; i++ {
		if len(a[i]) == 0 {
			continue
		}
		ansn := make([]int, len(s))
		for j := 0; j < len(s); j++ {
			for k := 0; k < len(a[i]); k++ {
				if a[i][k] == j {
					goto NEXT
				}
				if j < a[i][k] {
					ansn[j] = a[i][k] - j
					goto NEXT
				}
			}
			ansn[j] = len(s) - j
		NEXT:
		}
		// log.Println(ansn)
		ans = min(ans, smax(ansn))
	}
	fmt.Println(ans)
}

func zero(a int) int {
	if a == 0 {
		return 0
	} else if a > 0 {
		return 1
	} else {
		return -1
	}
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func smax(a []int) int {
	r := a[0]
	for i := 1; i < len(a); i++ {
		r = max(r, a[i])
	}
	return r
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func min(a, b int) int {
	if a > b {
		return b
	}
	return a
}

type scanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func newScanner() *scanner {
	rdr := bufio.NewReaderSize(os.Stdin, 1000)
	return &scanner{r: rdr}
}
func (s *scanner) next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *scanner) nextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *scanner) nextInt() int {
	v, _ := strconv.Atoi(s.next())
	return v
}

func (s *scanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *scanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}


Measured memory_bytes: 640
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools
import time,random

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
mod2 = 998244353
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)
def pe(s): return print(str(s), file=sys.stderr)
def JA(a, sep): return sep.join(map(str, a))
def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a)


def main():
    n,m,q = LI()
    aa = [LI() for _ in range(q)]

    r = 0
    for t in itertools.combinations_with_replacement(range(m), n):
        u = 0
        for a,b,c,d in aa:
            if t[b-1] - t[a-1] == c:
                u += d
        if r < u:
            r = u

    return r

print(main())





Measured memory_bytes: 10852
#include <stdio.h>
int main()
{
  int a,b,d,r;
  double f;

  scanf("%d %d",&a,&b);
  d=a/b;
  r=a%b;
  f=(double)a/b;

  printf("%d %d %f\n",d,r,f);

  return 0;
}

Measured memory_bytes: 636
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define INF (1<<30)
#define INFLL (1ll<<60)
typedef pair<int, int> P;
typedef pair<int, P> E;
#define MOD (1000000007ll)
#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	b += MOD;
	a += b;
	a %= MOD;
}

ll a[66][10][10],dp[66][123],f[123]={1ll,2ll};

int main(void){
	int h,w,p,i,j,k,s=0,t=0,m;
	scanf("%d%d%d",&h,&w,&p);
	for(i=2; i<w; ++i){
		f[i] = f[i-1]+f[i-2];
	}
	for(i=0; i<w; ++i){
		dp[0][i] = ((i)?0ll:1ll);
		for(j=i; j<w; ++j){
			if(abs(i-j)>1){
				a[0][i][j] = 0ll;
				continue;
			}
			if(i==0 && w-j==1){
				a[0][i][j] = 1ll;
			}else if(i==0){
				a[0][i][j] = f[w-j-2];
			}else if(w-j==1){
				a[0][i][j] = f[i-1];
			}else{
				a[0][i][j] = (f[i-1]*f[w-j-2])%MOD;
			}
			a[0][j][i] = a[0][i][j];	
		}
	}
	while(h){
		if(h%2){
			for(i=0; i<w; ++i){
				dp[s+1][i] = 0ll;
			}
			for(i=0; i<w; ++i){
				for(j=0; j<w; ++j){
					add_mod(dp[s+1][j],(dp[s][i]*a[t][i][j])%MOD);
				}
			}
			++s;
		}
		for(i=0; i<w; ++i){
			for(j=0; j<w; ++j){
				a[t+1][i][j] = 0ll;
				for(k=0; k<w; ++k){
					add_mod(a[t+1][i][j],(a[t][i][k]*a[t][k][j])%MOD);
				}
			}
		}
		++t;
		h /= 2;
	}
	printf("%lld\n",dp[s][p-1]);
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <utility>
#include <typeinfo>
#include <string>
#include <sstream>

using namespace std;

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;

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

    string S;
    cin >> S;

    if (S[0] != 'A') {
        cout << "WA" << endl;
        return 0;
    }
    int count = 0;
    for (int i = 2; i < S.length() - 1; ++i) {
        if (S[i] == 'C') {
            count++;
        }
    }
    if (count != 1) {
        cout << "WA" << endl;
        return 0;
    }
    for (int i = 1; i < S.length(); ++i) {
        if (i >= 2 && i < S.length() - 1 && S[i] == 'C') {
            continue;
        }
        if (S[i] >= 'a' && S[i] <= 'z') {
            continue;
        }
        cout << "WA" << endl;
        return 0;
    }
    cout << "AC" << endl;
}

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

int main() {
  int N;
  cin >> N;
  vector<int> Diameter(N);
  for(int i = 0; i < N; i++){
    cin >> Diameter.at(i);
  }
  sort(Diameter.begin(), Diameter.end());
  reverse(Diameter.begin(), Diameter.end());
  int Class = 1;
  for(int a = 0; a < N - 1; a++){
    if(Diameter.at(a) ==  Diameter.at(a + 1)){
      continue;
    }
    else{
      Class++;
    }
  }
  cout << Class << endl;
  
}


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

int main() {
	int M,D;
	cin>>M>>D;
	int cont= 0;
	for(int i=1;i<=M;i++){
		for(int j=10;j<=D;j++){
			if((j/10)*(j%10) == i && j/10 >=2 && j%10 >=2){
				cont++;
			}
		}
	}
	cout<<cont;
	return 0;
}

Measured memory_bytes: 256
use std::cmp::max;

fn main() {
    let (r, w) = (std::io::stdin(), std::io::stdout());
    let mut sc = IO::new(r.lock(), w.lock());
    let n: usize = sc.read();
    let mut a: Vec<usize> = sc.vec(n);
    a.sort();
    let mut count = vec![0; n];
    for a in a.into_iter() {
        count[a - 1] += 1;
    }
    let mut a: Vec<usize> = count.into_iter().filter(|&c| c > 0).collect();
    a.sort();

    let mut sum = a.iter().sum::<usize>();
    let mut upper_count = 0;

    let mut max_k = vec![n; n + 1];
    for h in (1..(n + 1)).rev() {
        while let Some(biggest) = a.pop() {
            if biggest > h {
                sum -= biggest;
                upper_count += 1;
            } else {
                a.push(biggest);
                break;
            }
        }

        let sum = sum + upper_count * h;
        max_k[h] = sum / h;
    }

    let mut ans = vec![0; n + 1];
    for h in 0..(n + 1) {
        ans[max_k[h]] = h;
    }

    for i in (0..n).rev() {
        ans[i] = max(ans[i], ans[i + 1]);
    }

    for i in 1..(n + 1) {
        sc.write(format!("{}\n", ans[i]));
    }
}

pub struct IO<R, W: std::io::Write>(R, std::io::BufWriter<W>);

impl<R: std::io::Read, W: std::io::Write> IO<R, W> {
    pub fn new(r: R, w: W) -> IO<R, W> {
        IO(r, std::io::BufWriter::new(w))
    }
    pub fn write<S: std::ops::Deref<Target = str>>(&mut self, s: S) {
        use std::io::Write;
        self.1.write(s.as_bytes()).unwrap();
    }
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .0
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r' || b == b'\t')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r' && b != b'\t')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


Measured memory_bytes: 15896
#include<algorithm>
#include<cassert>
#include<climits>
#include<cmath>
#include<cstring>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>

using namespace std;

using lint = long long;
using P = pair<int, int>;
using LLP = pair<long long, long long>;

#define REP(i, x, n) for(int i = (x), i##_len = int(n) ; i < i##_len ; ++i)
#define rep(i, n) for(int i = 0, i##_len = int(n) ; i < i##_len ; ++i)
#define reps(i, n) for(int i = 1, i##_len = int(n) ; i <= i##_len ; ++i)
#define rrep(i, n) for(int i = int(n) - 1 ; i >= 0 ; --i)
#define rreps(i, n) for(int i = int(n) ; i > 0 ; --i)
#define SORT(x) sort((x).begin(), (x).end())
#define SORT_INV(x) sort((x).rbegin(), (x).rend())
#define TWINS(x) cout << ((x) ? "Yay!" : ":(") << endl

constexpr int IINF = (1 << 30) - 1;
constexpr long long LLINF = 1LL << 61;
constexpr double EPS = 1e-8;

const int dx4[] = {1, 0, -1, 0}, dy4[] = {0, 1, 0, -1};
const int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};

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

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

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

    string s;
    cin >> s;

    if(s == "Sunny"){
        cout << "Cloudy" << endl;
    }else if(s ==  "Cloudy"){
        cout << "Rainy" << endl;
    }else{
        cout << "Sunny" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int main (){
    long long n;
    cin >> n;
    long long a[n];
    long long ans=0;
    long long b[n];
    long long t=0;
    for(long long i=0;i<n;i++){
        cin >> a[i];
        if(i==0){
            b[i]=a[i];
        }else{
            b[i]=b[i-1]+a[i];
        }
        if(b[i]==0){
            ans++;
        }
    }
    sort(b, b+n);
    for(long long i=0;i<n;i++){
        if(i==0){
            continue;
        }
        if(b[i]==b[i-1]){
            t++;
            ans+=t;
        }else{
            t=0;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3328
import static java.util.Arrays.*;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {

	static void tr(Object... os) {
		System.err.println(deepToString(os));
	}
	final int n = 12;
	char[][] t;
	boolean[][] vis;
	void solve() {
		t = new char[n][];
		for (int i = 0; i < n; i++) {
			t[i] = sc.next().toCharArray();
		}
		vis = new boolean[n][n];
		res = 0;
		for (int i = 0; i < n; i++) for (int j = 0; j < n; j++) {
			if (t[i][j] =='1' && !vis[i][j]) {
				res++;
				dfs(i, j);
			}
		}
		out.println(res);
	}
	int res;
	void dfs(int i, int j) {
		if (0 <= i && i < n && 0 <= j && j < n && t[i][j] == '1' && !vis[i][j]) {
			vis[i][j] = true;
			dfs(i+1,j);
			dfs(i-1,j);
			dfs(i,j+1);
			dfs(i,j-1);
		}
	}

	public static void main(String[] args) throws Exception {
		new Main().run();
	}

	MyScanner sc = null;
	PrintWriter out = null;
	public void run() throws Exception {
		sc = new MyScanner(System.in);
		out = new PrintWriter(System.out);
		for (;sc.hasNext();) {
			solve();
			out.flush();
		}
		out.close();
	}

	class MyScanner {
		String line;
		BufferedReader reader;
		StringTokenizer tokenizer;

		public MyScanner(InputStream stream) {
			reader = new BufferedReader(new InputStreamReader(stream));
			tokenizer = null;
		}
		public void eat() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					line = reader.readLine();
					if (line == null) {
						tokenizer = null;
						return;
					}
					tokenizer = new StringTokenizer(line);
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
		}
		public String next() {
			eat();
			return tokenizer.nextToken();
		}
		public String nextLine() {
			try {
				return reader.readLine();
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		public boolean hasNext() {
			eat();
			return (tokenizer != null && tokenizer.hasMoreElements());
		}
		public int nextInt() {
			return Integer.parseInt(next());
		}
		public long nextLong() {
			return Long.parseLong(next());
		}
		public double nextDouble() {
			return Double.parseDouble(next());
		}
		public int[] nextIntArray(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++) a[i] = nextInt();
			return a;
		}
	}
}

Measured memory_bytes: 16900
/*
*@Author  Chand Vachhani
*/
 
#include<bits/stdc++.h>
#define int         long long
#define double      long double
#define vi          vector<int>
#define vii         vector<vector<int>>
#define pii         pair<int,int>
#define pb          push_back
#define pf          push_front
#define vpii        vector<pair<int,int>>
#define fo(i,l,n)   for(int i{l}; i<n; i++)
#define rf(s)       for(auto &c : s)
#define all(a)      (a).begin(),(a).end()
#define rall(a)     (a).rbegin(),(a).rend()
#define PI          3.141592653589
#define sz(x)       (int)x.size()
#define bs(v,n)     binary_search(all((v)),(n))
#define lb(v,n)     lower_bound(all((v)),(n))
#define ub(v,n)     upper_bound(all((v)),(n))
#define tezz        ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define MOD         1000000007  
 
using namespace std;

signed main(){
    tezz
 
    string s;
    cin >> s;
    vi a(s.length()+1);
    int n=s.length();
    a[n]=0;
    for(int i=n-1; i>=0; i--){
        if(s[i]=='<'){
            a[i]=0;
        }
        else{
            a[i]=a[i+1]+1;
        }
    }
    // fo(i,0,n){
    //     cout << s[i] << " ";
    // }
    // cout << endl;
    // fo(i,0,n+1){
    //     cout << a[i] << " ";
    // }
    // cout << endl;
    n=a.size();
    fo(i,0,n-1){
        if(s[i]=='<'){
            if(a[i]>=a[i+1]){
                a[i+1]=a[i]+1;
            }
        }
    }
    
    
    // fo(i,0,n){
    //     cout << a[i] << " ";
    // }
    // cout << endl;
    int ans=0;
    for(int i=0; i<a.size(); i++){
      ans+=a[i];
    }
  cout << ans;
    return 0;
}
 
 
 


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

struct UnionFind {
    vector<int> d;
    UnionFind(int n=0): d(n,-1) {}
    int find(int x) {
        if(d[x] < 0) return x;
        return d[x] = find(d[x]);
    }
    bool unite(int x, int y){
        x = find(x); y = find(y);
        if (x == y) return false;
        //xとyのグループで連結を行う際に大きい方に従える作業
        if (d[x] > d[y]) swap(x,y);
        d[x] += d[y];
        d[y] = x;
        return true;
    }
    bool same(int x, int y) { return find(x) == find(y);}
    int size(int x) { return -d[find(x)];}
};

int deg[100005];
vector<int> to[100005];

int main() {
    int n, m, k;
    cin >> n >> m >> k;
    UnionFind uf(n);
    rep(i,m) {
        int a, b;
        cin >> a >> b;
        --a; --b;
        deg[a]++;
        deg[b]++;
        uf.unite(a,b);
    }
    rep(i,k) {
        int a, b;
        cin >> a >> b;
        --a; --b;
        to[a].push_back(b);
        to[b].push_back(a);
    }
    rep(i,n) {
        int ans = uf.size(i)-1-deg[i];
        for (int u : to[i]) {
            if(uf.same(i,u)) --ans;
        }
        printf("%d%c", ans, i==n-1?'\n':' ');
    }
    return 0;
}

Measured memory_bytes: 6784
chomp($_ = <>);
$st1 = substr($_,0,(length($_) - 1)/2);
unless($st1 =~ reverse$st1){
    print "No";
    exit;
}
$_ = substr($_,(length($_)+3)/2-1,(length($_)-1)/2);
unless($_ eq reverse $_){
    print "No";
    exit;
}
if ($st1 eq reverse $_) {
    print "Yes"
} else {
    print "No"
}



Measured memory_bytes: 512
#include <bits/stdc++.h>
#define INF (1<<30)
#define MOD 1000000007
#define l_ength size
using ll = long long;
using namespace std;

int main(){
	int n; cin >> n;
	vector<string> vs(n);
	int a = 0, b = 0, ba = 0, ans = 0;
	for( auto &str : vs ) cin >> str;
	for( auto str : vs ){
		int bound = str.l_ength();
		for( int i = 0; i < bound-1; ++i ){
			if( str[i] == 'A' && str[i+1] == 'B' ) ++ans;
		}
		if( str[0] == 'B' && str[bound-1] == 'A' ) ++ba;
		else if( str[bound-1] == 'A' ) ++a;
		else if( str[0] == 'B' ) ++b;
	}
	ans += max(0, ba-1);
	if( ba > 0 && a > 0 ){
		--a;
		++ans;
	}
	if( ba > 0 && b > 0 ){
		--b;
		++ans;
	}
	ans += min(a, b);
	cout << ans << endl;
	return 0;
}

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

ll mod = 1000000007, fact[200005];
int n,a[200005];

ll pw(ll x, ll y)
{
    if(y==0) return 1;

    ll ans= pw(x,y/2);
    ans*=ans;
    ans%=mod;
    if(y%2)
    {
        ans*=x;
        ans%=mod;
    }
    return ans;
}

ll C(int n, int r)
{
    if(r>n) return 0;
    return (fact[n]*pw((fact[r]*fact[n-r])%mod, mod-2))%mod;
}

int main()
{
    fact[0]=1;
    for(ll i=1; i<=200000; i++)
    {
        fact[i]= (fact[i-1]*i)%mod;
    }

    scanf("%d",&n);

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

    int c=-1,b=-1;

    for(int i=0; i<=n; i++)
    {
        if(a[i]==s)
        {
            if(b!=-1) c=i;
            else b=i;
        }
    }
    int q=n-c;

    for(int i=1; i<=n+1; i++)
    {
        ll r= C(n+1,i);
        r-= C(q+b,i-1);
        r%=mod;
        if(r<0) r+= mod;
        printf("%lld\n",r);
    }
}


Measured memory_bytes: 3200
#include <stdio.h>
#include <string.h>
#include <iostream>
#include <algorithm>

using namespace std;

int main()
{
	int n;
	scanf("%d",&n);
	long long int now = 1;
	for(long long int i = 1; i <= n; i++)
	{
		now *= i;
	}
	printf("%lld\n",now);
	return 0;
}

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

int main()
{
	
	//freopen ("t.txt","r",stdin);
	int n,k;
	 string s;
	cin>> n>>s>>k;
	for (int i=0;i<n;i++)
	if (s[i]!=s[k-1]) cout<<'*';
	else cout<<s[i];
	return 0;
	
}

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

#define repeat(i, n) for (auto i = decltype(n)(); (i) < (n); (i)++)

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

    int n;
    cin >> n;

    int ans = 0;
    repeat (i, n) {
        int a;
        cin >> a;

        while (a % 2 == 0) {
            ans++;
            a /= 2;
        }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		 Scanner scan = new Scanner(System.in);

//???????????´??° a???b???c ??????????????????a ?????? b ?????§?????´??°?????????
//c ????´???°?????????????????????????±???????????????°????????????????????????????????????

	            int a = Integer.parseInt(scan.next());
	            int b = Integer.parseInt(scan.next());
	            int c = Integer.parseInt(scan.next());


	            int num = a ; //?¨??????¨
	            int count = 0; //count??????????????????

//a-b a???????????????????¶??????????

	            for (int i = a; i <= b ;i++){
	            	if(c % i == 0){
	            		num++;
	            		count++;
	            	}
	            }

	            //???????????????????????°????¨???°
	            System.out.println(count);
	}

}

Measured memory_bytes: 17320
s = input()
word_list = []
for i in range(len(s)):
    word_list.append(s[i])
list = []

for i in range(len(word_list)):
    flag = 0
    w = word_list[i]
    if len(list) == 0:
        list.append([w,1])
    else:
        for j in range(len(list)+1):
            if j == len(list) and flag == 0:
                list.append([w,1])
            elif j == len(list):
                continue
            elif list[j][0] == w:
                flag = 1
                list[j][1] = list[j][1] + 1

if len(list) == 2 and list[0][1]==2 and list[1][1]==2:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 3064
#include <bits/stdc++.h> 
#define FOR(i,a,b) for(int i=(a);i<=(b);++i) 
#define RFOR(i,a,b) for(int i=(a);i>=(b);--i) 
#define REP(i,n) for(int i=0;i<(n);++i)
#define RREP(i,n) for(int i=(n);i>0;--i)
#define CI cin>> 
#define CO cout<<
#define EN <<endl 
#define all(x) (x).begin(),(x).end() 
#define asn ans
using namespace std;
template <typename T> istream& operator >> (istream& is, vector<T>& vec) { for (T& x : vec) is >> x; 	return is; }
using ll = long long;

int main() {
	int a, b, c; CI a >> b >> c;
	if (c - a <= b&&c-a>=0) { CO "YES" EN; }
	else { CO "NO" EN; }
	return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

vector<int> parse(int n, string& s) {
    char c = s[0];
    int tmp = 1;
    vector<int> res;
    for (int i = 1; i < n; i++) {
        if (s[i] != c) {
            c = s[i];
            res.push_back(tmp);
            tmp = 1;
        } else {
            tmp++;
        }
    }
    res.push_back(tmp);
    return res;
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n, k;
	string s;
	cin >> n >> k >> s;
	vector<int> par = parse(n, s);
	int m = par.size(), ans = 0;
	if(s[0] == '1') ans += par[0];
	if(m%2 != (s[0]-'0')) par.push_back(0);
	int sum = 0, cnt = 0;
	queue<int> q;
	for(int i = (s[0] - '0'); i < m; i+=2){
		if(cnt >= k){
			int now = q.front();
			q.pop();
			sum -= now;
			if(cnt != k){
				now = q.front();
				q.pop();
				sum -= now;
			}
		}
		++cnt;
		q.push(par[i]);
		q.push(par[i+1]);
		sum += par[i] + par[i+1];
		chmax(ans, sum);
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 4064
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> //__gnu_pbds::gp_hash_table<int, int> table;
//priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>> pq;  //min heap

typedef int OwO;
typedef double UwU;

#define int long long
#define double long double
#define INF 1000000000
#define PI 3.14159265358979323846
#define watch(x) cout << (#x) << " is " << (x) << endl
#define pii pair<int, int>
#define vpii vector<pair<int, int>>
#define vvi vector<vector<int>>
#define vi vector<int>

using namespace std;

OwO main(){
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  int N;
  cin >> N;
  vpii t(N);
  for(int x = 0; x<N; x++){
    int a,b;
    cin >> a >> b;
    t[x]={b,a};
  }
  sort(t.begin(), t.end());
  int ti = 0;
  for(int x = 0; x<N; x++){
    int cost = t[x].second;
    int due = t[x].first;
    if(ti+cost > due){
      cout << "No" << endl;
      return 0;
    }
    ti += cost;
  }
  cout << "Yes" << endl;

  return 0;
}

Measured memory_bytes: 3456
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vl = vector<ll>;
using vvl = vector<vl>;
using vi = vector<int>;
using vvi = vector<vi>;
#define ote(x) cout<<(x)<<endl
#define all(x) (x).begin(),(x).end()
#define rp(i,s,e) for(int i=(s);i<(e);++i)
#define rpz(i,e) rp(i,0,e)

int main(){
	string s; cin>>s;
	int ans = 700;
	ans += (s[0]=='o'?100:0);
	ans += (s[1]=='o'?100:0);
	ans += (s[2]=='o'?100:0);
	ote(ans);
}


Measured memory_bytes: 256
/**
 *    authur: Bao Trung <3
**/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define all(x) (x).begin(), (x).end()
#define set_vect(a,n); vector<int>a(n); for(auto &z : a)cin>>z;
const int mod = 1e9+7;
string s;
map <string,int> mp;
int res = 0;
void solve(){
	cin >> s;
	mp[s]++;
	if(mp[s] == 1) res++;
}

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	int t = 1; cin >> t;
	while(t--){solve();}
	cout << res;
	return 0;
}

// Code By CodeWar :3


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

#define testcase            int t; cin>>t; while (t--)
#define FOR(i,x,y)          for(int i=x;i<y;i++)
#define RFOR(i,x,y)         for(int i=x;i>=y;i--)
#define vout(v)             for(int ind=0;ind<v.size();ind++){ cout<<v[ind]; if(ind<v.size()-1) cout<<' '; else cout<<endl;}
#define sc(a)               scanf("%lld",&a)
#define sc2(a,b)            scanf("%lld %lld",&a,&b)
#define pb                  push_back
#define all(x)              (x).begin(),(x).end()
#define reversed(s)         reverse(s.begin(), s.end())
#define asort(s)            sort(s.begin(), s.end())
#define dsort(s)            sort(s.begin(), s.end(),greater<ll>())
#define gtl(x)              getline(cin, (x))
#define PI                  acos(-1)
#define CLR(x, y)           memset(x, y, sizeof(x))
#define Precision(a)        cout << fixed << setprecision(a)
#define FasterIo            ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define endl                "\n"
#define MAXP                2000006
#define MOD                 10000007
#define EPS                 1e-7

template <typename T> T Sqr(T x) { T n = x * x ; return n ;}
template <typename T> T Pow(T B,T P){ if(P==0) return 1; if(P&1) return B*Pow(B,P-1);  else return Sqr(Pow(B,P/2));}
template <typename T> T Abs(T a) {if(a<0)return -a;else return a;}
template <typename T> T Gcd(T a,T b){if(a<0)return Gcd(-a,b);if(b<0)return Gcd(a,-b);return (b==0)?a:Gcd(b,a%b);}
template <typename T> T Lcm(T a,T b) {if(a<0)return Lcm(-a,b);if(b<0)return Lcm(a,-b);return a*(b/Gcd(a,b));}

bool cmp(pair<int , int>a, pair<int, int>b){
    return (a.first<b.first);
}
int main()
{
    FasterIo
    int n;
    cin >> n;
    if(n==0) cout <<"1" << endl;
    if(n==1) cout <<"0" << endl;
    return 0;
}



Measured memory_bytes: 3612
#include <stdio.h>
#include <stdlib.h>

#include <iostream>
#include <iomanip>
#include <sstream>
#include <stdint.h>
#include <string.h>

#define _USE_MATH_DEFINES
#include <math.h>

#include <vector>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <deque>
#include <string>

#include <algorithm>
#include <functional>
#include <bitset>
#include <functional>
#include <chrono>
#include <random>

#define sqr(x) (x) * (x)

typedef unsigned int u32;
typedef int i32;
typedef unsigned long long int u64;
typedef long long int i64;
typedef uint16_t u16;
typedef int16_t i16;
typedef uint8_t u8;
typedef int8_t i8;

using namespace std;
using namespace std::chrono;

const i64 mod = 1000000007ll;
const i64 smod = 998244353ll;
const i64 inf = 1000000000000007ll;

const double eps = 1e-10;

const i64 MAXN = 100005;

i64 n;
i64 a[MAXN];

vector<pair<i64, i64>> q;

i64 binpow (i64 a, i64 n) {
    if (n == 0)
        return 1;
    if (n % 2 == 1)
        return (binpow (a, n-1) * a) % smod;
    else {
        i64 b = binpow (a, n/2) % smod;
        return (b * b) % smod;
    }
}

int main() {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cout.precision(15); cout.setf(ios::fixed);

    cin >> n;

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

    if (a[0] != 0) {
        cout << 0 << endl;
        return 0;
    }

    sort(a, a + n);

    i64 p = a[0];
    i64 c = 1;
    for (i64 i = 1; i < n; i++) {
        if (p != a[i]) {
            q.push_back({p, c});
            p = a[i];
            c = 1;
        } else {
            c++;
        }
    }
    q.push_back({p, c});

    bool f = (q[0].first == 0 && q[0].second == 1);

    for (i64 i = 1; i < q.size(); i++) {
        if (q[i - 1].first + 1 != q[i].first) {
            f = false;
            break;
        }
    }

    if (!f) {
        cout << 0 << endl;
        return 0;
    }

    i64 R = 1;

    for (i64 i = 1; i < q.size(); i++) {
        R *= binpow(q[i - 1].second, q[i].second) % smod;
        R %= smod;
    }


    cout << R << endl;

    return 0;
}


Measured memory_bytes: 3188
import java.util.Arrays;

public class Main {


  private static void solve() {
    int n = ni();
    int[][] p = ntable(n, 2);
    
    Arrays.sort(p, (o1, o2) -> o1[1] - o2[1]);
    
    long now = 0;
    for (int[] v : p) {
      now += v[0];
      if (now > v[1]) {
        System.out.println("No");
        return;
      }
    }
    System.out.println("Yes");
  }

  public static void main(String[] args) {
    new Thread(null, new Runnable() {
      @Override
      public void run() {
        long start = System.currentTimeMillis();
        String debug = args.length > 0 ? args[0] : null;
        if (debug != null) {
          try {
            is = java.nio.file.Files.newInputStream(java.nio.file.Paths.get(debug));
          } catch (Exception e) {
            throw new RuntimeException(e);
          }
        }
        reader = new java.io.BufferedReader(new java.io.InputStreamReader(is), 32768);
        solve();
        out.flush();
        tr((System.currentTimeMillis() - start) + "ms");
      }
    }, "", 64000000).start();
  }

  private static java.io.InputStream is = System.in;
  private static java.io.PrintWriter out = new java.io.PrintWriter(System.out);
  private static java.util.StringTokenizer tokenizer = null;
  private static java.io.BufferedReader reader;

  public static String next() {
    while (tokenizer == null || !tokenizer.hasMoreTokens()) {
      try {
        tokenizer = new java.util.StringTokenizer(reader.readLine());
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
    return tokenizer.nextToken();
  }

  private static double nd() {
    return Double.parseDouble(next());
  }

  private static long nl() {
    return Long.parseLong(next());
  }

  private static int[] na(int n) {
    int[] a = new int[n];
    for (int i = 0; i < n; i++)
      a[i] = ni();
    return a;
  }

  private static char[] ns() {
    return next().toCharArray();
  }

  private static long[] nal(int n) {
    long[] a = new long[n];
    for (int i = 0; i < n; i++)
      a[i] = nl();
    return a;
  }

  private static int[][] ntable(int n, int m) {
    int[][] table = new int[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[i][j] = ni();
      }
    }
    return table;
  }

  private static int[][] nlist(int n, int m) {
    int[][] table = new int[m][n];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[j][i] = ni();
      }
    }
    return table;
  }

  private static int ni() {
    return Integer.parseInt(next());
  }

  private static void tr(Object... o) {
    if (is != System.in)
      System.out.println(java.util.Arrays.deepToString(o));
  }
}


Measured memory_bytes: 54400
S = input()
s = list(v for v in S)

first = s.count(s[0])
second = s.count(s[1])
third = s.count(s[2])
fourth = s.count(s[3])

if first == 2 and second == 2 and third == 2 and fourth == 2:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 38384
from fractions import gcd

def lcm(c,d):
    return c//gcd(c,d)*d
mod=10**9+7

n=int(input())
a=[int(i) for i in input().split()]
l=a[0]
for i in range(1,n):
    l=lcm(l,a[i])
ans=0
for i in range(n):
    ans+=l//a[i]
    #ans%=mod
print(ans%mod)

Measured memory_bytes: 6108
#include<bits/stdc++.h>
using namespace std;
const int M = 1000000007;

int main() {
    int n;
    cin >> n;
    if (n == 1) {
        cout << "Hello World\n";
    }
    else {
        int a, b;
        cin >> a >> b;
        cout << a + b << "\n";
    }
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		int q = sc.nextInt();
		
		char []c = sc.next().toCharArray();
		int []s = new int [n];
		
		s[0]  = 0;
		
		for(int i = 0 ; i < n-1 ;i++) {
			if(c[i] == 'A'&& c[i+1] == 'C') {
				s[i+1] = s[i] + 1 ;
			}
			else {
				s[i+1] = s[i];
			}
				
		}
		
		for(int j = 0; j < q ; j++) {
			int l = sc.nextInt();
			int r = sc.nextInt();
			int ans = s[r-1] - s[l-1];
			System.out.println(ans);
		}
		
		
		
	}

	}



Measured memory_bytes: 68412
#include <iostream>

using namespace std;

long long int N, t[100001] = {}, x[100001] = {}, y[100001] = {};
bool flag = true;

int main() {
	cin >> N;
	for (int i = 1; i <= N; i++) {
		cin >> t[i] >> x[i] >> y[i];
		if (x[i] - x[i - 1] + y[i] - y[i - 1] > t[i] - t[i - 1]) {
			flag = false;
		}
		else if ((t[i] - t[i - 1] - (x[i] - x[i - 1] + y[i] - y[i - 1])) % 2 == 1) {
			flag = false;
		}
	}
	if (flag) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
map<int,int> data;

int main()
{
	int t;
	scanf("%d",&t);
	int banyak=0;
	while(t--)
	{
		int a;
		scanf("%d",&a);
		if(data[a]==0)
		{
			data[a]++;
			banyak++;
		}
	}
	printf("%d\n",banyak);
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void){
  int D;
  scanf("%d", &D);
  switch(D){
    case 22:
      printf("Christmas Eve Eve Eve\n");
      break;
    case 23:
      printf("Christmas Eve Eve\n");
      break;
    case 24:
      printf("Christmas Eve\n");
      break;
    case 25:
      printf("Christmas\n");
      break;
  }
  return 0;
}


Measured memory_bytes: 128
// atcoder/exawizards2019/A/main.cpp
// author: @___Johniel
// github: https://github.com/johniel/

#include <bits/stdc++.h>

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << "," << p.second << ")"; return os; }
template<typename P, typename Q> istream& operator >> (istream& is, pair<P, Q>& p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; for (auto& i: v) os << i << ","; os << ")"; return os; }
template<typename T> istream& operator >> (istream& is, vector<T>& v) { for (auto& i: v) is >> i; return is; }
template<typename T> ostream& operator << (ostream& os, set<T> s) { os << "#{"; for (auto& i: s) os << i << ","; os << "}"; return os; }
template<typename K, typename V> ostream& operator << (ostream& os, map<K, V> m) { os << "{"; for (auto& i: m) os << i << ","; os << "}"; return os; }

template<typename T> inline T setmax(T& a, T b) { return a = std::max(a, b); }
template<typename T> inline T setmin(T& a, T b) { return a = std::min(a, b); }

using lli = long long int;
using ull = unsigned long long;
using point = complex<double>;
using str = string;
template<typename T> using vec = vector<T>;

constexpr array<int, 8> di({0, 1, -1, 0, 1, -1, 1, -1});
constexpr array<int, 8> dj({1, 0, 0, -1, 1, -1, -1, 1});
constexpr lli mod = 1e9 + 7;

int main(int argc, char *argv[])
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.setf(ios_base::fixed);
  cout.precision(15);

  int a, b, c;
  while (cin >> a >> b >> c) {
    cout << (set<int>({a, b, c}).size() == 1 ? "Yes" : "No") <<endl;
  }

  return 0;
}


Measured memory_bytes: 3624
#include <iostream>

using namespace std;

int c(int n,int m)
{
    if(n==0)
        return 0;
    else
    {
    if(m==0||n==m)
        return 1;
    else
        return c(n-1,m-1)+c(n-1,m);
    }
}
int main()
{
    int a,b;
    cin>>a>>b;
    cout<<c(a,2)+c(b,2);
    return 0;
}


Measured memory_bytes: 256
n = int(input())
w = [input() for i in range(n)]
count = 0
if len(set(sorted(w))) != n:
     print("No")
else:
     for i in range(n-1):
          if w[i][-1] == w[i+1][0]:
               count += 1
     if count == n-1:
          print("Yes")
     else:
          print("No")


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

int main(){
   long long int n;
   cin >> n;
   long long int *m;
   m = new long long int[n+1];
   for (int i=0; i<n+1; i++) {
      cin >> m[i];
   }
   long long int *y;
   y = new long long int[n];

   for (int i=0; i<n; i++) {
      cin >> y[i];
   }
   long long int retval=0;
   
   for (int i=0; i<n; i++) {
      // i
      if (y[i] <= m[i]) {
         m[i] -= y[i];
         retval += y[i];
         y[i] = 0;
         continue;
      }else{
         retval += m[i];
         y[i] -= m[i];
         m[i] = 0;
      }
      // i+1
      if (y[i] <= m[i+1]) {
         retval += y[i];
         m[i+1] -= y[i];
         y[i] = 0;
      }else{
         retval += m[i+1];
         y[i] -= m[i+1];
         m[i+1] = 0;
      }
   }
   cout << retval << endl;
}


Measured memory_bytes: 1792
#include <stdio.h>

int main(void)
{
    int A, B;
    scanf("%d", &A);
    scanf("%d", &B);
    
    if (A > B+B) {
        printf("%d\n", A-(B+B));
    }
    else{
        printf("0\n");
    }
    
    return 0;
}


Measured memory_bytes: 128
#include<cstdio>
#include<map>
#include<set>
#include<algorithm>
#include<functional>
#include<vector>
using namespace std;
const int MAX = 100000 + 10;
map<long long, pair<long long,long long>> mp;
set<long long> st;
vector<long long> vv;
long long ans[MAX];
long long rec[MAX];
int main() {
    int n;
    scanf("%d", &n);
    for(int i = 0 ; i < n ; i++){
        scanf("%lld", &rec[i]);
        st.insert(rec[i]);
        if(mp.find(rec[i]) == mp.end()) {
            mp[rec[i]] = make_pair(1, i);
        } else {
            auto itr = mp.find(rec[i]);
            itr -> second = make_pair(itr -> second .first + 1, itr -> second . second);
        }
    }
    for(auto it:st) vv.push_back(it);
    for(int i = (int)vv.size() - 1 ; i > 0 ; i--) {
        pair<long long,long long> large = mp[vv[i]];
        long long sec = vv[i-1];
        ans[large.second] += (vv[i]-sec) * large.first;
        mp[sec] = make_pair(mp[sec].first + large.first, min(mp[sec].second, large.second));
    }
    ans[0] += vv[0] * n;
    for(int i = 0 ; i < n ; i++){
        printf("%lld\n", ans[i]);
    }
    return 0;
}


Measured memory_bytes: 14452
import java.util.*;
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.ArrayDeque;
import java.util.Deque;


public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String s = br.readLine();
        int n = Integer.parseInt(s);
        int count = 0;
        int i = 357;
        
        outer: while (i <= n) {
            String l = String.valueOf(i);
            for (int j = 0; j < l.length(); j++) {
                if (l.charAt(j) == '1' || l.charAt(j) == '2' || l.charAt(j) == '4' || l.charAt(j) == '6' || l.charAt(j) == '8' || l.charAt(j) == '9' || l.charAt(j) == '0') {
                    i += Math.pow(10, l.length()-j-1);
                    continue outer;
                }
            }
            /*if (l.contains("3") && l.contains("5") && l.contains("7") && !l.contains("1") && !l.contains("2") && !l.contains("4") && !l.contains("6") && !l.contains("8") && !l.contains("9") && !l.contains("0")) {
                //System.out.println(l);
                count++;
            }*/
            if (l.contains("3") && l.contains("5") && l.contains("7")) {
                count++;
            }
            i++;
            //System.out.println(l);
        }
        
        System.out.println(count);
    }
}


Measured memory_bytes: 31188
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <vector>
#include <map>
#include <list>
#include <stack>
#define REP(i, n) for(i=0; i<n; i++)
#define REPR(i, n) for(i=n; i>=0; i--)
#define FOR(i, m, n) for(i=m; i<n; i++)
#define max(a, b) ((a)>(b) ? (a):(b))
#define min(a, b) ((a)<(b) ? (a):(b))
#define INF 10000000000
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<ll, ll> p;
typedef pair<double, double> doup;
ll rec(ll n);

int main(void) {
    ll n, k;
    cin >> n >> k;
    
    if(n%k==0)
        cout << 0 << endl;
    else
        cout << 1 << endl;
    
    
}


Measured memory_bytes: 256
#include <iostream>
#include<cstdio>
#include<vector>
#include<cstring>
#include<algorithm>
#include<set>
#include<queue>
#include<map>
#include<cmath>
using namespace std;
#define LL long long
#define rep(i,a,n) for(int i=a;i<n;++i)
#define per(i,a,n) for(int i=n-1;i>=a;--i)
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define all(v) v.begin(),v.end()
#define sz(v) ((int)sizeof(v))
#define N 200005
vector<int>p[N],q[N];
map<pair<int,int>,int>num;
int pre1[N],pre2[N];
int vis1[N],vis2[N];
void dfs1(int u,int id){
    pre1[u]=id;
    vis1[u]=1;
    for(int i=0;i<p[u].size();++i){
        int v=p[u][i];
        if(!vis1[v]){
            dfs1(v,id);
        }
    }
}
void dfs2(int u,int id){
    pre2[u]=id;
    vis2[u]=1;
    for(int i=0;i<q[u].size();++i){
        int v=q[u][i];
        if(!vis2[v]){
            dfs2(v,id);
        }
    }
}
int main()
{
    int n,k,l,u,v;
    cin>>n>>k>>l;
    rep(i,0,k) {
        cin>>u>>v;
        --u;--v;
        p[u].pb(v);
        p[v].pb(u);
    }
    rep(i,0,l) {
        cin>>u>>v;
        --u;--v;
        q[u].pb(v);
        q[v].pb(u);
    }
    rep(i,0,n) {
        vis1[i]=0;
        vis2[i]=0;
    }
    rep(i,0,n){
        if(!vis1[i])
            dfs1(i,i);
    }
    rep(i,0,n){
        if(!vis2[i])
            dfs2(i,i);
    }
    rep(i,0,n){
        ++num[mp(pre1[i],pre2[i])];
    }
    rep(i,0,n){
        cout<<num[mp(pre1[i],pre2[i])]<<' ';
    }
    return 0;
}


Measured memory_bytes: 29440
#define scanf_s scanf
//#define gets_s gets
#include <stdio.h>
#include <string>
#include <iostream>
#include <math.h>
using namespace std;
#define MAX 10
#define MIN -100001
#define _MAX 10
int main(void)
{
	char *days[7] = { "Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday" };
	int month_sum[12] = { 31,29,31,30,31,30,31,31,30,31,30,31 };
	int month, day, sum = 0;
	while (1) {
		scanf_s("%d %d", &month, &day);
		if (month == 0) break;
		for (int i = 1; i < month; ++i) {
			sum += month_sum[i - 1];
		}
		sum += day;
		printf("%s\n", days[(sum + 2) % 7]);
		sum = 0;
	}
}

Measured memory_bytes: 1168
package main

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

var sc, wr = bufio.NewScanner(os.Stdin), bufio.NewWriter(os.Stdout)

func scanString() string   { sc.Scan(); return sc.Text() }
func scanRunes() []rune    { return []rune(scanString()) }
func scanInt() int         { a, _ := strconv.Atoi(scanString()); return a }
func scanInt64() int64     { a, _ := strconv.ParseInt(scanString(), 10, 64); return a }
func scanFloat64() float64 { a, _ := strconv.ParseFloat(scanString(), 64); return a }

func scanInts(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = scanInt()
	}
	return res
}

func debug(a ...interface{}) { fmt.Fprintln(os.Stderr, a...) }

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}
func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

//•*¨*•.¸¸♪main•*¨*•.¸¸♪(　-ω-)ノ　(　・ω・)
func main() {
	defer wr.Flush()
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 10000), 1001001)

	n := scanInt()
	if n == 1 {
		fmt.Fprintln(wr, "Hello World")
	} else {
		fmt.Fprintln(wr, scanInt()+scanInt())
	}
}


Measured memory_bytes: 1776