akhauriyash/Code-Regression huggingface dataset:
/* Header {{{ */
#include <bits/stdc++.h>
using namespace std;

typedef long long readtype;
typedef long long var;
typedef long double let;

readtype read() {
  readtype a = 0, c = getchar(), s = 0;
  while (!isdigit(c)) s |= c == '-', c = getchar();
  while (isdigit(c)) a = a * 10 + c - 48, c = getchar();
  return s ? -a : a;
}

#ifdef LOCAL_LOGGER
#define logger(...) fprintf(stderr, __VA_ARGS__)
#define abortif(v, ...) if (v) {logger("Error in Line %d, Function '%s()'.\nInfo: ", __LINE__, __FUNCTION__); logger(__VA_ARGS__); exit(0);}
#else
#define logger(...);
#define abortif(v, ...);
#endif
/* }}} */

const let EPS = 1e-8;

struct Point {
  let x, y;
  friend Point operator + (Point a, Point b) {
    return (Point) {a.x + b.x, a.y + b.y};
  }

  friend Point operator - (Point a, Point b) {
    return (Point) {a.x - b.x, a.y - b.y};
  }

  Point operator * (let k) {
    return (Point) {x * k, y * k};
  }

  Point operator ~ () {
    return (Point) {x, -y};
  }

  let Dist() {
    return sqrt(x * x + y * y);
  }

  Point Rotate(let sink, let cosk) {
    return (Point) { x * cosk - y * sink, x * sink + y * cosk };
  }

  Point Rotate(let k) {
    return Rotate(sin(k), cos(k));
  }

  Point Rotate(Point k) {
    let z = k.Dist();
    return Rotate(k.y / z, k.x / z);
  }

  void EchoWith(char c) {
    printf("%.8Lf %.8Lf", x, y);
    putchar(c);
  }
};

typedef Point Vec;

struct Line {
  Point p;
  Vec v;

  Line() {}
  Line(Point a, Point b) { 
    p = a, v = b - a;
  }

  friend Point Projection(Line a, Point b) {
    return ((Point) {(b - a.p).Rotate(~a.v).x, 0}).Rotate(a.v) + a.p;
  }

  friend Point Reflection(Line a, Point b) {
    return b + (Projection(a, b) - b) * 2.0;
  }
};

int main() {
// #ifndef ONLINE_JUDGE
//   freopen("CGL_1_B.in", "r", stdin);
//   freopen("CGL_1_B.out", "w", stdout);
// #endif
// #ifdef LOCAL_LOGGER
//   freopen("CGL_1_B.log", "w", stderr);
// #endif
  let xp1 = read(), yp1 = read(), xp2 = read(), yp2 = read();
  Line line = (Line) { (Point) {xp1, yp1}, (Point) {xp2, yp2} };
  int q = read();
  while (q--) {
    let x = read(), y = read();
    Point res = Reflection(line, (Point) {x, y});
    res.EchoWith('\n');
  }
  return 0;
}

/* ==== Makefile ==== {{{
CompileAndRun:
	make Compile
	make Run

Compile:
	g++ -o CGL_1_B CGL_1_B.cpp -g -Wall -DLOCAL_LOGGER

CompileUF:
	g++ -o CGL_1_B CGL_1_B.cpp -g -Wall -DLOCAL_LOGGER -fsanitize=undefined

Run:
	./CGL_1_B < CGL_1_B.in > CGL_1_B.out
==================
}}} */



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

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

    for (int i = 0; i < S.size(); ++i) {
        int con = ((int)('a' - S[i]) + 26) % 26;
        if (con <= K) {
            S[i] = 'a';
            K -= con;
        }

        if (i == (int)S.size()-1) {
            K %= 26;
            S.back() += K;
        }
    }
    cout << S << endl;
}


Measured memory_bytes: 640
#include <stdio.h>
int main(void)
{
  char str[52][3];
  int n;
  int i;
  int S[14]={0}, H[14]={0}, C[14]={0}, D[14]={0};
  int s=0, h=0, c=0, d=0;
  int temp;

  scanf("%d",&n);
  for (i=0; i<n; i++) {
    scanf("%s",str[i]);
    if (str[i][0]=='S') {
      scanf("%d",&temp);
      S[temp]=1;
    }
    else if (str[i][0]=='H') {
      scanf("%d",&temp);
      H[temp]=1;
    }
    else if (str[i][0]=='C') {
      scanf("%d",&temp);
      C[temp]=1;
    }
    else if (str[i][0]=='D') {
      scanf("%d",&temp);
      D[temp]=1;
    }
  }
  for (i=1; i<14; i++) {
    if (S[i]==0) {
      printf("S %d\n",i);
    }
  }
  for (i=1; i<14; i++) {
    if (H[i]==0) {
      printf("H %d\n",i);
    }
  }
  for (i=1; i<14; i++) {
    if (C[i]==0) {
      printf("C %d\n",i);
    }
  }
  for (i=1; i<14; i++) {
    if (D[i]==0) {
      printf("D %d\n",i);
    }
  }
  return 0;
}

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

int main(){
int cnt = 0;
int A,B,C;
cin >> A >> B >> C;
while(1){
if(B < A){
break;
}else if(cnt < C){
B-=A;
cnt++;
}else if(cnt == C){
break;
}
}
cout << cnt << endl;  
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <algorithm>
using namespace std;

int main()
{
    int a, b, c;
    cin >> a >> b >> c;
    if ((a == b && a != c) | (a == c && a != b) | (b == c && b != a))
    {
        printf("Yes");
    }
    else
    {
        printf("No");
    }
    return 0;
}

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

from collections import Counter

L = []
for a in A:
  if a % 4 == 0:
    L.append(2)
  elif a % 4 == 2:
    L.append(1)
  else:
    L.append(0)

T = [0 for i in range(3)]
for (key, value) in Counter(L).most_common():
  T[key] = value

def pop(v):
  if v == 2 and T[0] > 0:
    T[0] -= 1
    return 0
  if v in [1, 2] and T[1] > 0:
    T[1] -= 1
    return 1
  if v in [0,1,2] and T[2] > 0:
    T[2] -= 1
    return 2
  return -1

before = pop(2)
for i in range(N-1):
  before = pop(before)
  if before == -1:
    print("No")
    exit()

print("Yes")

Measured memory_bytes: 14480
# B
import sys
s = input()
t = input()
length = 0
ans = [0]*(len(s)-len(t)+1)
for i in range(len(s)-len(t)+1):
    for j in range(len(t)):
        if s[i+j] == t[j]:
            ans[i] += 1
print(len(t)-max(ans))


Measured memory_bytes: 9132
#include <iostream>
#define rep(i, n)for(int i=0; i<n; i++)
using namespace std;

int main(){
    int l, r, d, ans=0;
    cin >> l >> r >> d;
    for(int i=l; i<=r; i++){
        if(i%d==0)ans++;
    }
    cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 3560
n,t=map(int,input().split())
a=list(map(int,input().split()))
b=[a[-1]]
for i in a[::-1][1:]:b.append(max(i,b[-1]))
c=[b[n-i-1]-a[i]for i in range(n)]
print(c.count(sorted(c)[-1]))

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

using namespace std;

int main(){
	
	int n;
	int a[3];
	vector<int> frac;

	cin>>n;

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

	sort(a, a+n);

	for(int i=0; i<n-1; ++i){
		for(int j=i+1; j<n; ++j){
			for(int k=1; k<a[j]; ++k){
				
				if(a[i] % k == 0 && a[j] % k == 0){
						frac.push_back(k);
				}
			}
		}
	}

	sort(frac.begin(), frac.end());
	frac.erase( unique(frac.begin(), frac.end()), frac.end() );

	for(int i=0; i<frac.size(); ++i){
			cout << frac[i] << endl;
	}

	return 0;
}

Measured memory_bytes: 1220
#include<cstdio>


int
 n,ans;

int
 main()
 {
	
while
 (~scanf("%d"
,&n))
	
{
		
for
 (int
 f1 = 0; f1 < 10; f1++)
		
{
			
for
 (int
 f2 = 0; f2 < 10; f2++)
			
{
				
for
 (int
 f3 = 0; f3 < 10; f3++)
				
{
					
for
 (int
 f4 = 0; f4 < 10; f4++)
					
{
						
if
 (n == (f1 + f2 + f3 + f4))
							
ans++;
					
}
				
}
			
}
		
}
		
printf("%d\n"
,ans);
		
ans = 0;
	
}
 }

Measured memory_bytes: 1024
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}

int main(){
  int r,g;
  cin >> r >> g;
  cout << 2*g - r << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=1000000007;
#define INF 1LL<<30
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()

int main(){
    int n;
    cin>>n;
    vector<ll> a(n);
    ll sum=0;
    rep(i,n){
        cin>>a[i];
        sum^=a[i];
    }
    vector<ll> ans(n);
    rep(i,n){
        ans[i]=sum^a[i];
    }

    rep(i,n) cout<<ans[i]<<" ";
    cout<<endl;
}



Measured memory_bytes: 6344
import java.util.*;
public class Main {

	static class Edge{
		int x, y, c;
		Edge(int x, int y, int c){
			this.x = x;
			this.y = y;
			this.c = c;
		}
	}
	
	public static class unionfind{
		int[] parent;
		int[] rank;
		public unionfind(int n){
			this.parent = new int[n+1];
			this.rank = new int[n+1];
			for(int i = 1; i <= n; i++) set(i);
		}
		public void set(int i) {
			parent[i] = i;
			rank[i] = 0;
		}
		public int find(int i) {
			if (i == parent[i])
				return parent[i];
			else
				return parent[i] = find(parent[i]);
			
		}
		public boolean same(int x, int y){
			return find(x) == find(y);
		}
		public void unite(int x, int y) {
			int xroot = find(x);
			int yroot = find(y);
			if(xroot == yroot)
				return;
			if(rank[xroot] > rank[yroot])
				parent[yroot] = xroot;
			else if(rank[xroot] < rank[yroot])
				parent[xroot] = yroot;
			else {
				parent[yroot] = xroot;
				rank[xroot]++;
			}
		}
	}
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[][] c = new int[N][3];
		for(int i = 0; i < N; i++) {
			c[i][0] = i;
			c[i][1] = sc.nextInt();
			c[i][2] = sc.nextInt();
		}
		PriorityQueue<Edge> pq = new PriorityQueue<>((p1,p2)->Integer.compare(p1.c,p2.c));
		Arrays.sort(c, (x, y) -> x[1] - y[1]);
		for(int i = 1; i < N; i++)
			pq.add(new Edge(c[i][0], c[i-1][0], c[i][1]-c[i-1][1]));
		Arrays.sort(c, (x, y) -> x[2] - y[2]);
		for(int i = 1; i < N; i++)
			pq.add(new Edge(c[i][0], c[i-1][0], c[i][2]-c[i-1][2]));
		long ans = 0;
		unionfind u = new unionfind(N);
		while(pq.size() > 0) {
			Edge e = pq.poll();
			if(!u.same(e.x, e.y)) {
				u.unite(e.x, e.y);
				ans += e.c;
			}
		}
		System.out.println(ans);
	}

}

Measured memory_bytes: 100944
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <cmath>
#include <string>
#include <functional>

using namespace std;
typedef long long int ll;
typedef pair <int,int> P;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) for (int i = 0; i < (n); i++)
#define fst first
#define snd second
#define pb push_back
#define ALL(obj) (obj).begin(), (obj).end()
#define debug(x) cout << #x << ": " << x << endl
const int MOD = 1000000007;
const int INF = 100100100;
const double EPS = 0.000000001;

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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, k;
  string s;
  cin >> n >> k;
  cin >> s;
  int l = 0, r = 0, count = 0, ans = 0;
  while(true){
    while(count <= k){
      r++;
      if(r > n -1) break;
      if(r == 1) {
        if(s[r-1] == '0' || s[r] == '0') count++;
      }
      else if(s[r] == '0' && s[r-1] == '1') count++;
    }
    ans = max(ans, (r - l));
    if(r > (n-1)) break;
    while(count > k){
      l++;
      if(s[l-1] == '0' && s[l] == '1') count--;
    }
  }
  cout << ans << endl;


  return 0;
}


Measured memory_bytes: 512
use std::str::FromStr;
use std::collections::HashSet;

fn get_one<T : FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    return s.trim().parse().ok().unwrap();
}

fn get_vec<T : FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    return s.trim().split_whitespace().map(|e| e.parse().ok().unwrap()).collect();
}

fn main() {
    let v : Vec<i32> = get_vec();
    let mut set = HashSet::new();
    for x in v {
        set.insert(x);
    }
    println!("{}", set.len());
}


Measured memory_bytes: 4352
#include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <set>

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,j) FOR(i,0,j)
#define mp std::make_pair

typedef long long ll;
typedef unsigned long long ull;
typedef std::pair<int,int> P;
typedef std::pair<int,P> State;

const int INF = 1001001001;

// S N E W(南北東西)
const int dx[8] = {0, 0, 1, -1, 1, 1, -1, -1}, dy[8] = {1, -1, 0, 0, 1, -1, 1, -1};

std::vector<int> X1, X2, Y1, Y2;
ll map[500][500];
int W, H;

int compress(std::vector<int> &v1, std::vector<int> &v2){
    std::vector<int> v;

    REP(i, (int)v1.size()){
        FOR(j, -1, 2){
            int s = v1[i] + j, t = v2[i] + j;
            // if(0 <= s && s <= 1000000){
                v.push_back(s);
            // }
            // if(0 <= t && t <= 1000000){
                v.push_back(t);
            //}
        }
    }

    std::sort(v.begin(), v.end());
    v.erase(std::unique(v.begin(), v.end()), v.end());

    REP(i, (int)v1.size()){
        v1[i] = std::find(v.begin(), v.end(), v1[i]) - v.begin();
        v2[i] = std::find(v.begin(), v.end(), v2[i]) - v.begin();
    }

    return (int)v.size();
}

void dfs(int x, int y, ll v){
    map[y][x] = -1;

    REP(i, 4){
        int nx = x + dx[i], ny = y + dy[i];
        if(0 <= nx && nx < W && 0 <= ny && ny < H &&
           map[ny][nx] == v){
            dfs(nx, ny, v);
        }
    }
}

int main(){
    int N;
    while(std::cin >> N, N){
        X1.clear(); X2.clear(); Y1.clear(); Y2.clear();

        REP(i, N){
            int l, t, r, b;
            std::cin >> l >> t >> r >> b;

            X1.push_back(l);
            X2.push_back(r);
            Y1.push_back(b);
            Y2.push_back(t);
        }

        W = compress(X1, X2);
        H = compress(Y1, Y2);

        std::fill(map[0], map[0]+500*500, 0LL);
        REP(i, N){
            FOR(y, Y1[i], Y2[i]){
                FOR(x, X1[i], X2[i]){
                    map[y][x] += 1LL << i;
                }
            }
        }

        // REP(y, H){
        //     REP(x, W){
        //         printf("%3lld ", map[y][x]);
        //     }
        //     puts("");
        // }

        int t = 0;
        FOR(y, 0, H){
            FOR(x, 0, W){
                if(map[y][x] >= 0){
                    dfs(x, y, map[y][x]);
                    t += 1;
                }
            }
        }
    
        std::cout << t << std::endl;
    }
}

Measured memory_bytes: 5068
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (ll i = 1; i < (ll)(n); i++)
typedef long long ll;
const ll M=1000000000;
//------------------------------------------//

int main(){
  int x;cin>>x;
  rep(i,361){
    if(i*x%360==0){
      cout<<i<<endl;
      break;
    }
  }
}

Measured memory_bytes: 3628
use proconio::{input, fastout};
use proconio::marker::{Chars};
use std::cmp::*;

macro_rules! debug {
      ($($a:expr),*) => {
          eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
      }
  }

#[fastout]
fn main() {
    input!{
        n: usize,
        mut w: [Chars;n],
    }

    for i in 0..n-1 {
        if w[i][w[i].len()-1]!=w[i+1][0] {
            println!("No");
            return;
        }
    }
    w.sort();
    for i in 0..n-1 {
        if w[i]==w[i+1] {
            println!("No");
            return;
        }
    }
    
    println!("Yes");
}


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

long read_long() {
	long ret=0;char c=getchar();
	while(c<'0' || c>'9') c=getchar();
	while(c>='0' && c<='9') {
		ret=ret*10+c-'0';
		c=getchar();
	}	return ret;
}

const long MAXN=200100;
long prefix[MAXN],ans;
long n,k;

int main() {
	n=read_long();k=read_long();
	register long i;
	long p;
	for(i=1;i<=n;++i) {
		p=read_long();
		prefix[i]=prefix[i-1]+p;
	}
	
	for(i=k;i<=n;++i)
		ans=max(ans,prefix[i]-prefix[i-k]);
//	printf("%lf",(ans+k)*0.5);
//	printf("\n");
	cout<<setiosflags(ios::fixed)<<setprecision(6)<<(double)((ans+k)*0.5)<<endl;

	return 0;
}

Measured memory_bytes: 1792
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <cstring>
#include <set>
#include <utility>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <stack>
#include <string>
#include <map>
#define ll long long
#define read(x) scanf("%d",&x);
#define readll(x) cin>>x;
#define FOR(x,a,b) for(int x=a;x<b;x++)
#define MP make_pair
#define PB push_back
#define pii pair<int,int>
#define piii pair<int,pair<int,int> >

#define readN(N,X) for(int i=0;i<N;i++) scanf("%d",&X[i]);
using namespace std;
int M;
int N;
int kagi[99];

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

	if (c >= a && c<= b){
		cout<<"Yes"<<endl;
	} else
	cout<<"No"<<endl;
	
}

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

int INFI = 1e9;

using namespace std;

int main() {
	int n, m;
	while (1) {
		cin >> n >> m;
		if (n == 0)break;
		int *c = new int[m];
		int* x = new int[n];
		for (int i = 0;i < m;i++) {
			cin >> c[i];
		}
		for (int i = 0;i < n;i++) {
			cin >> x[i];
		}
		int** gosa = new int*[n];
		for (int i = 0;i < n;i++) {
			gosa[i] = new int[256];
			for (int j = 0;j < 256;j++) {
				gosa[i][j] = INFI;
			}
		}
		for (int i = 0;i < m;i++) {
			if (128 + c[i] >= 255) {
				gosa[0][255] = min(gosa[0][255],(int)pow(255 - x[0], 2));
			}
			else if (128 + c[i] <= 0) {
				gosa[0][0] = min(gosa[0][0],(int)pow(x[0], 2));
			}
			else {
				gosa[0][128 + c[i]] = pow(x[0]-128-c[i], 2);
			}
		}
		for (int i = 1;i < n;i++) {
			for (int j = 0;j < 256;j++) {
				if (j == 0) {
					for (int k = 0;k < m;k++) {
						if (c[k] > 0)continue;
						for (int l = -c[k];l >= 0;l--) {
							gosa[i][0] = min(gosa[i][0], gosa[i - 1][l] + (int)pow(x[i], 2));
						}
					}
				}
				else if (j == 255) {
					for (int k = 0;k < m;k++) {
						if (c[k] < 0)continue;
						for (int l = 255 - c[k];l < 256;l++) {
							gosa[i][255] = min(gosa[i][255], gosa[i - 1][l] + (int)pow(255 - x[i], 2));
						}
					}
				}
				else {
					for (int k = 0;k < m;k++) {
						if (j - c[k] < 0 || j - c[k]>255)continue;
						gosa[i][j] = min(gosa[i][j], gosa[i - 1][j - c[k]] + (int)pow(j - x[i], 2));
					}
				}
			}
		}
		int ans = gosa[n-1][0];
		for (int i = 1;i < 256;i++) {
			ans = min(ans, gosa[n - 1][i]);
		}

		cout << ans << endl;
	}
}


Measured memory_bytes: 94976
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    long L = sc.nextLong(); 
    long R = sc.nextLong(); 

    long min = 2019;
    if(R-L>=2018){
      System.out.println(0);
      return;
    }
    for(long i=L; i<R;i++){
      // System.out.println(i);
      for(long j=i+1; j<=R;j++){
        // System.out.println(i+"aaa");
        min = Math.min((i*j)%2019, min);
     }
    }
    System.out.println(min);
  }
}



Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
    ll N; cin >> N;
    ll ans = N*(N-1)/2;
    cout << ans;
    return 0;
}

/*
 * 4 10
 * 4*1 = 4
 * 4*2 - 1 = 7
 * 4*3 - 2 = 10
 *
 * 8 9
 * 8*1 - 0 = 8
 * 8*2 - 1 = 15
 * */

/*
 * 4 10
 * 4*1 = 4
 * 4*2 - 1 = 7
 * 4*3 - 2 = 10
 *
 * 8 9
 * 8*1 - 0 = 8
 * 8*2 - 1 = 15
 * */

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
using ll = long long;

ll N;
string S;

int main(void){

    S = "";
    cin >> N;

    for (int i = 0; i < N; i++)
    {
        S += "ACL";
    }
    




    cout << S << endl;
    
    return 0;
}

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

namespace Atcoder
{
    public class Program
    {
        static void Main(string[] args)
        {
            var n = Read().Int();

            var d = new Dictionary<string, int>();
            for (int i = 0; i < n; i++)
            {
                var r = Read();
                var s = new string[10];
                for (int j = 0; j < 10; j++)
                {
                    s[j] = r[j].ToString();
                }
                Array.Sort(s, StringComparer.OrdinalIgnoreCase);
                var str = string.Join(string.Empty, s);
                if (d.ContainsKey(str))
                {
                    d[str]++;
                }
                else
                {
                    d.Add(str, 1);
                }
            }
            var ans = 0D;
            foreach (var item in d)
            {
                ans += (long)item.Value * (long)(item.Value - 1) / (long)2;
            }
            WriteRead(ans);
        }
        public static string Read()
        {
            return Console.ReadLine();
        }

        public static string[] ReadSplit()
        {
            return Console.ReadLine().Split(' ');
        }

        public static void WriteRead(object str)
        {
            Console.WriteLine(str);
            Read();
        }

        public static void Write(object str)
        {
            Console.WriteLine(str);
        }

        private static bool ChangeMin<T>(ref T a, T b) where T : IComparable
        {
            if (a.CompareTo(b) > 0)
            {
                a = b;
                return true;
            }
            return false;
        }

        private static bool ChangekMax<T>(ref T a, T b) where T : IComparable
        {
            if (b.CompareTo(a) > 0)
            {
                a = b;
                return true;
            }
            return false;
        }
    }
}


public static class Extentions
{
    public static int Int(this object obj)
    {
        return int.Parse(obj.ToString());
    }

    public static long Long(this object obj)
    {
        return long.Parse(obj.ToString());
    }

    public static decimal Decimal(this object obj)
    {
        return decimal.Parse(obj.ToString());
    }

    public static double Double(this object obj)
    {
        return double.Parse(obj.ToString());
    }

    public static T2 GetValueZero<T1, T2>(this Dictionary<T1, T2> d, T1 key) where T2 : struct
    {
        T2 value;
        if (d.TryGetValue(key, out value))
        {
            return value;
        }
        return new T2();
    }
}



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

def main():
    a,b,c=map(int,input().split())
    if a==b:
        print(c)
    elif a==c:
        print(b)
    else:
        print(a)

if __name__ == '__main__':
    main()


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

namespace Atc_0030
{
    class Program
    {
        static void Main(string[] args)
        {
            var str = Console.ReadLine();

            Int64 X = Int64.Parse(str.Split(' ')[0]);
            Int64 Y = Int64.Parse(str.Split(' ')[1]);

            Int64 result = 0;

            while (true)
            {
                X = 2 * X;

                result++;

                if (Y < X)
                {
                    break;
                }

            }

            Console.WriteLine(result);
           
        }
    }
}


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

using namespace std;
int main(){
    string A,B,C;  
    cin >> A >> B >> C;
    if(A[A.size()-1]==B[0]&&B[B.size()-1]==C[0]){
        cout << "YES" << endl;
    }
    else{
        cout << "NO" << endl;
    }
}

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

#define times(n, i)      uptil(0, n, i)
#define rtimes(n, i)     downto((n) - 1, 0, i)
#define upto(f, t, i)    for(int _##i = (t), i = (f); i <= _##i; i++)
#define uptil(f, t, i)   for(int _##i = (t), i = (f); i <  _##i; i++)
#define downto(f, t, i)  for(int _##i = (t), i = (f); i >= _##i; i--)
#define downtil(f, t, i) for(int _##i = (t), i = (f); i >  _##i; i--)
typedef long double ld;
#define long long long

#if defined(EBUG) && !defined(ONLINE_JUDGE)
    #define debug true
    #define ln << endl
#else
    #define debug false
    #define ln << '\n'
#endif
#define tb << '\t'
#define sp << ' '

const int MOD = 1e9+7;

int H[100000];

signed main() { // long: 64bit
    if(!debug) {
        cin.tie(0);
        ios::sync_with_stdio(0);
    }

    long N, A, B;
    scanf("%lld%lld%lld",&N,&A,&B);
    times(N, i) scanf("%d",H+i);

    int l = 0, r = 1e9;
    times((debug ? 35 : 100), h) {
        int m = (l + r + 1) / 2;
        long a = 0;
        times(N, i) {
            a += max(0LL, (H[i]-B*m+A-B-1) / (A-B));
        }
        if(debug) cout << m << ": " << a ln;
        if(a > m) l = m;
        else      r = m;
    }

    cout << r ln;

    return 0;
}


Measured memory_bytes: 640
#include <stdio.h>
int main(){
  int a,b,c;
  scanf("%d%d%d",&a,&b,&c);
  int ans = 0; // 「1増やす」の操作回数
  while(!(a==b && b==c) || ans%2==1){
    ans += 1;
    if(a<=b && a<=c){
      a += 1;
    }else if(b<=a && b<=c){
      b += 1;
    }else{
      c += 1;
    }
  }
  ans /= 2;
  printf("%d\n",ans);
  return 0;
}

Measured memory_bytes: 128
sx, sy, tx, ty = map(int, input().split())
dx, dy = tx-sx, ty-sy
s = ""
s += "U"*dy + "R"*dx + "D"*dy + "L"*dx
s += "L" + "U"*(dy+1) + "R"*(dx+1) + "D"
s += "R" + "D"*(dy+1) + "L"*(dx+1) + "U"
print(s)

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

int main(){
 	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	vector<int> A;
	int n;
	cin>>n;
	A.resize(n);
	for(int i=0;i<n;i++){
		cin>>A[i];
	}
	vector<int>dp(n);
	dp[0]= 0;
	dp[1]= abs(A[1]-A[0]);	
	for(int i=2;i<=n;i++){
		dp[i]=min((dp[i-1]+abs(A[i]-A[i-1])),(dp[i-2]+abs(A[i]-A[i-2])));
	}
	
	cout<<dp[n-1]<<endl;
	return 0;
}


	 
 
 
 
 

Measured memory_bytes: 1024
def main():
    k=int(input())
    if k%2==0 or k%5==0:
        print(-1)
        exit()
    if k==1 or k==7:
        print(1)
        exit()
    lep=7
    for i in range(1,1000001):
        lep+=7*(pow(10,i,k))%k
        if lep%k==0:
            print(i+1)
            exit()
    print(-1)
main()

Measured memory_bytes: 9176
#include <stdio.h>

int main(void)
{
	int a,b;
	
	scanf("%d %d",&a,&b);
	
	if (a<b){
		printf("a < b\n");
	}else if (a>b){
		printf("a > b\n");
	}else{
		printf("a == b\n");
	}
	
	return 0;
}

Measured memory_bytes: 580
using System;
 
class C
{
    static void Main()
    {
        Console.ReadLine();
        var a = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
        int max = a[0];
        long ans = 0;
        for (int i = 0; i < a.Length; i++)
        {
            max = Math.Max(max, a[i]);
            if (a[i] < max) ans += max - a[i];
        }
        Console.WriteLine(ans);
    }
}

Measured memory_bytes: 46420
#include<iostream>
#include<vector>
#include<cmath>
#include<algorithm>
#include <string>
#include <utility>
#define EPS (1e-7)
using namespace std;




int main() {

	int N, T;
	cin >> N >> T;
	int t, pre_t =0;
	int ans = 0;
	cin >> t;
	for (size_t i = 0; i < N-1; i++)
	{
		cin >> t;

		if (T >= (t-pre_t)) {
			ans += (t-pre_t);
		}
		else {
			ans += T;
		}
		pre_t = t;
	}
	ans += T;






	cout << ans <<endl;

	return 0;
}

Measured memory_bytes: 256
N = int(input())
if int(N/10) == 0:
  print(N)
elif int(N/100) == 0:
  print(9)
elif int (N/1000) == 0:
  print(N-90)
elif int(N/10000) == 0:
  print(909)
elif int (N/100000) == 0:
  print(N-9090)
else:
  print(90909)

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

#ifndef ONLINE_JUDGE
#  define LOG(x) (cerr <<">>>>>>"<< #x << " = " << (x) << endl)
#else
#  define LOG(x) ((void)0)
#endif
int d[256];
int main()
{
	
int n,an=0;
cin>>n;
int a[n],b;
for(int i=0;i<n;i++)cin>>a[i];
for(int i=0;i<n;i++){cin>>b;an+=max(0,a[i]-b);}
cout<<an<<endl;

}



Measured memory_bytes: 3600
#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <limits.h>
#include <algorithm>
#include <iomanip>
using namespace std;

int main(){
  long long int N, K, total = 0, ans = 0 ;
  cin >> N >> K ;
  N = N % K ;
  if(N > (K/2)){
    N = K - N ;
  }
  cout << N << endl ;
  return 0 ;
}  

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



int main()

{
    long long int x=0,y=0,a;
    int n,i;
    scanf("%d",&n);
    long long int ara[n];
    for(i=0;i<n;i++) scanf("%lld",&ara[i]);

    sort(ara,ara+n);

    for(i=n-1;i>=1;i--){
        if(ara[i]==ara[i-1]){
            x=ara[i];
            break;
        }
    }
    i=i-2;
    for(;i>=1;i--){
        if(ara[i]==ara[i-1]){
            y=ara[i];
            break;
        }
    }
    if(x==0||y==0){
        printf("0");
        return 0;
    }
    else{
        a=x*y;
        printf("%lld",a);
    }



}


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

#define int long long
#define DBG 1
#define dump(o) if(DBG){cerr<<#o<<" "<<o<<endl;}
#define dumpc(o) if(DBG){cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define each(it,c) for(auto it=(c).begin();it!=(c).end();it++)
#define all(c) c.begin(),c.end()
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9 + 7);

signed main() {
	int x; cin >> x;
	int ans = x / 11;
	ans *= 2;
	if (0 < x % 11 && x % 11 <= 6)ans++;
	else if (x % 11 != 0)ans += 2;
	cout << ans << endl;
	return 0;
}

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

class Node{
    public:
        int key;
        Node *left;
        Node *right;
        Node *parent;
        Node(): key(-1), left(this), right(this), parent(this){};
};

Node *root, *NIL;

Node* treeMinimum(Node *x){
    while(x->left != NIL){
        x = x->left;
    }
    return x;
}

Node* treeMaximum(Node *x){
    while(x->right != NIL){
        x = x->right;
    }
    return x;
}
void insert(int k){
    //node x を移動させてkey kを挿入する
    Node *x = root, *y = NIL, *z;

    //allocate memory area
    //z = (Node*)malloc(sizeof(Node));
    z = new Node;
    z->key = k;
    z->left = NIL;
    z->right = NIL;

    //zのkey kを基準にしてnode xを辿っていって葉まで移動する
    while (x != NIL){
        y = x;
        //new node keyよりcurrent node keyの方が大きければ左の子へ移動する
        if (z->key < x->key) x = x->left;
        //逆であれば右の子へ
        else x = x->right;
    }
    //node xを辿って行き着いた葉をnode yに代入する
    //親がNILであればroot is z
    z->parent = y;
    if (y == NIL) root = z;
    else{
        if (z->key < y->key) y->left = z;
        else y->right = z;
    }
}

Node* Successer(Node *x){
    if (x->right != NIL){
        return treeMinimum(x->right);
    }
    Node *y = x->parent;
    while(y != NIL && x == y->parent){
        x = y;
        y = y->parent;
    }
    return y;
}

void treeDelete(Node *z){
    //削除対象のノードy, yの子x
    Node *x, *y;
    //zが葉であればzを削除する
    if (z->left == NIL || z->right == NIL) y = z;
    //zの次節点yを求める
    else y = Successer(z);

    //xに子がいるとき
    if (y->left != NIL) x = y->left;
    //yに左の子がいれば、xにyの右の子を代入
    //xに右の子がいる、または子がいない
    else x = y->right;

    if (x != NIL) x->parent = y->parent;

    if (y->parent == NIL) root = x;
    else{
        if (y == y->parent->left) y->parent->left = x;
        else y->parent->right = x;
    }

    if (y != z) z->key = y->key;

    free(y);
}
Node* treeSearch(Node *u, int k){
    //NIL nodeでないかつ、keyがnode uのkeyと一致しないか確かめる
    while (u != NIL && k != u->key){
        //k をnode uのkeyと比較する
        if (k < u->key) u = u->left;
        else u = u->right;
    }
    return u;
}

void inorder(Node *u){
    if (u == NIL){ return; }
    inorder(u->left);
    printf(" %d", u->key);
    inorder(u->right);
}

void preorder(Node *u){
    if (u == NIL){ return; }
    printf(" %d", u->key);
    preorder(u->left);
    preorder(u->right);
}

int main(){
    int n, x;
    string cmd;
    cin >> n;

    while(n--){
        cin >> cmd;
        if (cmd == "find"){
            //find
            scanf("%d", &x);
            cout << (treeSearch(root, x) == NIL? "no": "yes") << endl;
        }else if (cmd == "insert"){
            // insert
            scanf("%d", &x);
            insert(x);
        }else if (cmd == "print"){
            // print
            inorder(root);
            printf("\n");
            preorder(root);
            printf("\n");
        }else if (cmd == "delete"){
            // delete
            scanf("%d", &x);
            treeDelete(treeSearch(root, x));
        }
    }

    return 0;
}



Measured memory_bytes: 22044
#include <iostream>
#include <iomanip>
#include <ios> 
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <bitset>
#include <map>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define sz(c) ((int)(c).size())
#define mp make_pair

using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
//typedef pair<int, int> P;
//typedef pair<int, pair<int, int> > PP;
//const int MAX=;

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

ll ct(ll x,  ll a, ll b, ll g){
	return x-(x/a)-(x/b)+(x/g);
}

int main(){
	ll A,B,C,D;
	cin>>A>>B>>C>>D;
	ll G=gcd(C,D);
  	ll L=C*D/G;
	ll ans=ct(B,C,D,L)-ct(A-1,C,D,L);
	cout<<ans<<endl;
}

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

int main() {
    int a, b, c, d; cin >> a >> b >> c >> d;
    while (true) {
        c -= b;
        if (c <= 0) {
            cout << "Yes" << endl;
            break;
        }
        a -= d;
        if (a <= 0) {
            cout << "No" << endl;
            break;
        }
    }
    return 0;
}


Measured memory_bytes: 3624
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>

#include <algorithm>
#include <numeric>
#include <cmath>

using namespace std;
typedef long long ll;
typedef long long ull;
const long double PI = (acos(-1));
const long long MOD = 1000000007;
const long long MOD2 = 998244353;

static const int  MAX_INT = std::numeric_limits<int>::max();
static const long MAX_LONG = std::numeric_limits<long>::max();
static const ll   MAX_LL = std::numeric_limits<long long>::max();

#define rep(i,n) REP(i,0,n)
#define REP(i,x,n) for(int i=x;i<n;++i)

///////////////////////////////////////////////////
// ------------------- utils ------------------- //
///////////////////////////////////////////////////
// change min/max
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; }

///////////////////////////////////////////////////
// ------------------- main -------------------- //
///////////////////////////////////////////////////

// O(N^2) implementation
//void Main() {
//    ll N, K; cin >> N >> K;
//    vector<pair<ll,ll> > rng(K);
//    rep(i, K) {
//        ll lb, rb; cin >> lb >> rb;
//        rng[i].first  = lb;
//        rng[i].second = rb;
//    }
//    vector<ll> dp(N + 1, 0);
//    dp[1] = 1;
//
//    for (ll i = 1; i <= N; ++i) {
//        for (auto& r : rng) {
//            for (ll j = r.first; j <= r.second; ++j) {
//                if (i - j > 0) {
//                    dp[i] = (dp[i] + dp[i - j]) % MOD2;
//                }
//            }
//        }
//    }
//    cout << dp[N] << endl;
//}

// O(N) implementation
void Main() {
    ll N, K; cin >> N >> K;
    vector<pair<ll, ll> > rng(K);
    rep(i, K) {
        ll lb, rb; cin >> lb >> rb;
        rng[i].first = lb;
        rng[i].second = rb;
    }
    vector<ll> cum(N + 1, 0);
    cum[1] = 1;
    vector<ll> dp(N + 1, 0);
    dp[1] = 1;

    for (ll i = 2; i <= N; ++i) {
        for (auto& r : rng) {
            const ll lb = i - r.first;
            if (lb < 1) continue;
            const ll rb = std::max<ll>(i - r.second, 1);
            const ll sum = cum[lb] - cum[rb - 1];
            dp[i] = (dp[i] + sum) % MOD2;
        }
        cum[i] = cum[i - 1] + dp[i];
    }
    cout << dp[N] << endl;
}

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

    double tmp;
    cin >> tmp;

    return 0;
}


Measured memory_bytes: 6368
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n)     for(int i = 0; i < (int)(n); i++)
#define rep2(i, m, n) for(int i = m; i <= (int)(n); i++)
#define MOD 1000000007
#define Graph vector<vector<int>>
typedef pair<int, int> PII;
typedef long long int ll;

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

  vector<int> Ai(N);
  
  rep(i,N){
    int tmpAi; 
    cin >> tmpAi;
    Ai.at(i) = tmpAi;
  }
  
  sort(Ai.begin(),Ai.end());

  bool ans = false;
  rep(i,N-1){
    if(Ai.at(i) == Ai.at(i+1)) ans = true;
  }

  if(ans == true){
    cout << "NO" << endl;
  }else{
    cout << "YES" << endl;
  }

  return 0;

}


Measured memory_bytes: 1024
#include <algorithm>
#include <iostream>
#include <vector>
#include <functional>
#include <string>
#include <cmath>  //sqrt 
#include <iomanip> //setprecision
using namespace std;

int main(){
    int n ; cin >> n;
    if(n%2==0) n--;
    int yc=0,count=0;
    for(int i = n; i>0;i=i-2){
        yc=0;
        for(int j =i;j>0;j--){
            if(i%j==0) yc++;
        }
        if(yc==8) count++;
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 3144
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define MOD 1000000007
using namespace std;
using ll = long long;
int main()
{
    int n,k;
    string s;
    cin >> n >> s >> k;
    char ch = s[k - 1];
    for(int i = 0;i < n;i++)
    {
        if(s[i] != ch)
        {
            s[i] = '*';
        }
    }
    cout << s << "\n";
    
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <string>
#include <iostream>
#include <vector>
static const long long MAX = pow(10, 9);
int main()
{
    int N;
    std::vector<long long> A;
    std::cin >> N;
    for (int i = 0; i < N; ++i)
    {
        long long element;
        std::cin >> element;
        A.push_back(element);
    }

    long long  sumA = 0;
    int count = 0;
    long long add = 0;
    long long nearzero = MAX;
    for (int i = 0; i < N; ++i)
    {
        if (A[i] < 0)
        {
            ++count;
            sumA -= A[i];
            nearzero = std::min(nearzero, -A[i]);
        }
        else
        {
            sumA += A[i];
            nearzero = std::min(nearzero, A[i]);
        }
    }

    if (count % 2 != 0)
    {
        sumA -= 2 * nearzero;
    }
    std::cout << sumA << std::endl;
    return 0;
}

Measured memory_bytes: 1400
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> iint;
typedef pair<ll,ll> llll;
#define ALL(x) (x).begin(),(x).end()
const ll zero = 0;
const ll INF = 3000000000000000000; //10^18
const int inINF = 1000000000; //10^9
const ll MOD = 1000000007; //10^9+7
const ll MOD2 = 998244353;
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

int main(){
    ll N;
    cin >> N;
    vector<ll> H(N);
    for (ll i = 0; i < N; i++) {
        cin >> H[i];
    }
    ll m = 0;
    ll cnt = 0;
    for (ll i = 1; i < N; i++) {
        if(H[i-1] >= H[i]){
            cnt++;
        }
        else{
            m = max(cnt, m);
            cnt = 0;
        }
    }
    m = max(cnt, m);
    printf("%lld\n", m);
}

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

using namespace std;

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

typedef long long ll;

const int Inf = 1e9;
const double EPS = 1e-9;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    ll a, b, c;
    cin >> a >> b >> c;
    if (c <= a + b) {
        cout << b + c << endl;
    } else {
        cout << a + 2 * b + 1 << endl;
    }

    return 0;
}


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

int main()
{
  int N;
  cin >> N;
  
  int price;
  for (int i = 0; i< N/4 + 1;i++) {
    for (int j = 0; j < N/7 + 1; j++){
      price = 4 * i + 7 * j;
      if (price == N) {
        cout << "Yes" << endl;
        return 0;
      }
    }
  }
  cout << "No" << endl;
}

Measured memory_bytes: 256
n = int(input())
a = [int(i) for i in input().split()]
mod = 10**9+7
ans = 0
m = max(a)
x = 0
while m > 0:
    m >>= 1
    x += 1 

for i in range(x):
    cnt = 0
    for j in range(n):
        if a[j]>>i & 1 == 0: cnt += 1
    ans = (ans+pow(2,i,mod)*cnt%mod*(n-cnt)%mod)%mod
    
print(ans)

Measured memory_bytes: 122808
#include <iostream>

typedef long long ll;

ll gcd(ll a, ll b){
   if(a<b) return gcd(b,a);
   ll r;
   while(r=a%b){
      a = b;
      b = r;
   }
   return b;
}

int main(){
   ll A, B, C, D;
   std::cin >> A >> B >> C >> D;

   ll E = C * D / gcd(C,D);

   ll ans = B - A + 1;
   ans -= B/C - (A-1)/C;
   ans -= B/D - (A-1)/D;
   ans += B/E - (A-1)/E;

   std::cout << ans << std::endl;

   return 0;
}


Measured memory_bytes: 256
#include"bits/stdc++.h"
using namespace std;
int main() {
	int n, m, n2[101] = { 99999 }, m2[101];
	//memset(n2, 0, sizeof(n2));
	//memset(m2, 0, sizeof(m2));
	cin >> n;
	for (int i = 0; i < 100; i++)n2[i] = 24*60+60+1;
	for (int i = 0; i < n; i++) {
		int h, m;
		cin >> h >> m;
		n2[i] = h * 60 + m;
	}
	cin >> m;
	for (int i = 0; i < m; i++) {
		int k, g;
		cin >> k >> g;
		m2[i] = k * 60 + g;
	}
	for (int i = n; i < m + n; i++) {
		n2[i] = m2[i - n];
	}
	sort(n2, n2 + (m+n));
	int suu = 0;
	for (int i = 0; i < m + n; i++) {
		if (n2[i] == n2[i + 1]) {
			for (int j = i+1; n2[i] == n2[j] && n2[j] != 24 * 60 + 60 + 1; j++) {
				i++;
			}
		}
		if (i != m + n - 1) {
			printf("%d:%02d ", n2[i] / 60, n2[i] % 60);
		}
		else printf("%d:%02d\n", n2[i] / 60, n2[i] % 60);
	}
	/*for (int i = 0; i < m + n - suu; i++) {
		if (n2[i + 1+suu] != 24*60*60+1) {
			printf("%d:%02d ", n2[i] / 60, n2[i] % 60);
		}
		else printf("%d:%02d\n", n2[i] / 60, n2[i] % 60);
	}
	
	//cout << "000000" << endl;*/
}

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


int main(){
	string s,t;

	cin >> s >> t;

	ll sn = s.size();
	ll tn = t.size();

	ll mn = 1e9, curr;
	
	for(int i = 0; i <= sn-tn; i++){
		ll pt = i;
		curr = 0;
		for(int j = 0; j < tn; j++){


			if(s[pt] != t[j]){

				curr++;
			}
			pt++;
		}
		mn = min(mn,curr);
	}

	cout << mn << "\n";
	
}

Measured memory_bytes: 3628
from collections import defaultdict


def main():
    a = input()
    cnt = defaultdict(lambda: 0)
    for aa in a:
        cnt[aa] += 1
    ans = len(a) * (len(a) - 1) // 2 + 1
    for c, n in cnt.items():
        ans -= n * (n - 1) // 2
    print(ans)


if __name__ == '__main__':
    main()



Measured memory_bytes: 9472
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <limits.h>
#include <queue>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
#define REP(i, n) for(int i=0; i<n; i++)
const int MAX_N = 110;
const int INF = 10000;

int d[MAX_N][MAX_N];
int d2[MAX_N][MAX_N];
bool e[MAX_N][MAX_N];
bool isvisit[MAX_N][MAX_N];
int N, M;

void dfs(int s, int dest){
    for(int i = 0; i < N; i++){
        if(dest != i && e[dest][i] && d[dest][s] == d[i][s] + d2[dest][i]){
            isvisit[dest][i] = true;
            isvisit[i][dest] = true;
            if(i != s) dfs(s, i);
        }
    }
}

int main(){
    cin >> N >> M;
    REP(i,N) REP(k,N) d[i][k] = INF;
    REP(i,N) d[i][i] = 0;
    REP(i,M){
        int a,b,c;
        cin >> a >> b >> c;
        a--;
        b--;
        d[a][b] = c;
        d[b][a] = c;
        d2[a][b] = c;
        d2[b][a] = c;
        e[a][b] = true;
        e[b][a] = true;
    }


    for(int k = 0; k < N; k++)
        for(int i = 0; i < N; i++)
            for(int j = 0; j < N; j++)
                d[i][j] = min(d[i][j], d[i][k] + d[k][j]);

    for(int s = 0; s < N; s++){
        for(int e = s+1; e < N; e++){
            dfs(s, e);
        }
    }

    int cnt = 0;
    REP(i,N){
        REP(j,N){
            if(e[i][j] && !isvisit[i][j]){
                cnt++;
            }
        }
    }
    cnt /= 2;

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


Measured memory_bytes: 384
#include <iostream>
#include <cstdio>
#include <cmath>

using namespace std;

int main(void){
  double x1, y1, x2, y2;

  cin >> x1 >> y1 >> x2 >> y2;

  printf("%.8lf\n", sqrt(((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)))); 

  return 0;
}

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

using namespace std;
using ll = long long;
using P = pair<int,int>;
#define all(c) (c).begin(),(c).end()
const int INF = INT_MAX;
const ll LINF = LLONG_MAX;
const ll MOD = 1e9+7;

template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"[";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"]";return o;}
template <class T, class U>ostream &operator<<(ostream &o, const pair<T, U>&p)
{o<<"{"<<p.first<<", "<<p.second<<"}";return o;}
template <class T, class U>ostream &operator<<(ostream &o, const map<T, U>&obj)
{o<<"{";for(auto itr=obj.begin();itr!=obj.end();++itr)o<<(itr!=obj.begin()?", ":"")<<*itr;o<<"}";return o;}
void dump() {}
template <class H, class... T>void dump(H&& head, T&&... tail)
{cout << head << (sizeof...(tail)==0 ? "\n" : " "); dump(forward<T>(tail)...);}


int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int n,k;
  cin >> n >> k;
  vector<int> p(n);
  for(int i = 0; i < n; ++i){
    cin >> p[i];
  }
  vector<int> asc(n,0);

  for(int i = 0; i < n-1; ++i){
    asc[i+1] = p[i+1] > p[i] ? asc[i] + 1 : 0;
  }

  int ans = 0;
  set<int> window; 
  for(int i = 0; i < k; ++i){
    window.insert(p[i]);
  }
  int ext = 0;
  int i = k-1;
  while(i < n){
    if(asc[i] - asc[i-k+1] != k-1){
      ++ans;
      while(i+1<n){
        auto itr = window.begin();
        int mi = *(itr);
        auto itr2 = window.rbegin();
        int ma = *(itr2);
        if(!(p[i+1] > ma && p[i-k+1] == mi)){
          break;
        }
        ++i;
        window.insert(p[i]);
        window.erase(p[i-k]);
      }
    }else{
      ext = 1;
    }

    ++i;
    window.insert(p[i]);
    window.erase(p[i-k]);
  }
  cout << ans + ext << endl;
  return 0;
}


Measured memory_bytes: 11264
#include "bits/stdc++.h"
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++)
#define REPm(i,n) for(int i=(n)-1;i>=0;i--)
#define REP1(i,n) for(int i=1;i<=(n);i++)
#define mp make_pair
typedef long long ll;
int main(){
    string X,Y;
    cin >> X >> Y;
    if(X < Y) cout << '<' << endl;
    else if(X > Y) cout << '>' << endl;
    else cout << '=' << endl;
    return 0;
}


Measured memory_bytes: 256
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

//#undef _GLIBCXX_DEBUG //(compiler options)
#include <bits/stdc++.h>
#define all(x) begin(x), end(x)
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) ((int)(x).size())
#define pb push_back
#define eb emplace_back
#define fst first
#define snd second
using namespace std;
using ll = long long; using ull = unsigned ll; using ld = long double; using pii = pair<int, int>; using pll = pair<ll, ll>; using vi = vector<int>;
template<typename T> T mind(T &x, const T &y) {if (y < x) {T d = y-x; x = y; return d;} else return 0;} //RETURNS A NON-POSITIVE VALUE
template<typename T> T maxd(T &x, const T &y) {if (y > x) {T d = y-x; x = y; return d;} else return 0;}
const int mod = 1e9+7, mod9 = 1e9+9, infi = 1e9+100; const ll infl = 1e18L+1000, modl = 1e18L+3; const ld infd = INFINITY;

#define x(a) real(a)
#define y(a) imag(a)
using G = ll; using point = complex<G>;
istream& operator>>(istream &is, point &p){G x, y; is >> x >> y; p = {x, y}; return is;}
ostream& operator<<(ostream &os, const point &p){os << p.x() << ' ' << p.y(); return os;}
G dot(const point &a, const point &b) {return (conj(a)*b).x();}
G crs(const point &a, const point &b) {return (conj(a)*b).y();}
G ori(const point &a, const point &b, const point &c) {return crs(b-a, c-b);};
bool cmpyx(const point &a, const point &b) {return a.y()<b.y() || (a.y()==b.y()&&a.x()<b.x());};

int32_t main()
{
    #ifndef LOCAL
    //ifstream cin("hull.in"); ofstream cout("hull.out");
    #endif // LOCAL
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0), cout << fixed << setprecision(15);
    ll x, y; cin >> x >> y;
    int ans = 0;
    for(ll c = x; c <= y; ++ans, c *= 2);
    cout << ans;
}


Measured memory_bytes: 256