akhauriyash/Code-Regression huggingface dataset:
n = int(input())
l =[input() for i in range(n)]
r=[]
d={}
for i in l:
    if i in d:
        d[i]+=1
    else:
        d[i]=1
m = max(d.values())
for key,value in d.items():
    if value==m:
        r.append(key)
sorted_r = sorted(r)
print(*sorted_r,sep='\n')

Measured memory_bytes: 37132
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define ALL(x) (x).begin(), (x).end()
#define REP(i ,n) for(int i = 0; i < (int)(n); i++)
#define pb push_back
typedef vector<int>vint;
typedef vector<ll>vll;
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

int main()
{
    int N,X,T;
    cin >> N >> X >> T;
    if(0 != N%X){
        cout << T * (N/X + 1) << endl;
    }else{
        cout << T * (N/X) << endl;
    }
}

Measured memory_bytes: 3632
#include <stdio.h>
#include <string.h>
int main() {
	char S[7];
	scanf("%s", &S);

	if (strcmp(S, "Sunny") == 0) {
		printf("Cloudy");
	}
	if (strcmp(S, "Cloudy") == 0) {
		printf("Rainy");
	}
	if (strcmp(S, "Rainy") == 0) {
		printf("Sunny");
	}

	return 0;
}

Measured memory_bytes: 128
#include<stdio.h>
int main(void)
{
  int n,m,a[1000],i,j,max;

  while(scanf("%d %d",&n,&m)){

    max = 0;
    
    if(n==0 && m==0) break;

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

    for(i=0;i<n;i++){
      for(j=0;j<n;j++){
	if(i!=j && a[i]+a[j]<=m && a[i]+a[j]>max) max = a[i]+a[j];
      }
    }

    if(max!=0) printf("%d\n",max);
    else printf("NONE\n");
  }

  return 0;
}



Measured memory_bytes: 2036
{-# LANGUAGE BangPatterns #-}

import Control.Monad
import Data.List
import Data.Maybe
import qualified Data.ByteString.Char8 as C8

type Pair = (Int, Int)

main :: IO ()
main = do
  [n,m] <- readInts
  ps <- replicateM n readPair
  print $ solve m $ sortOn fst ps
 
solve :: Int -> [Pair] -> Int
solve m = fst . foldl' f e
  where
    e = (0,0)
    f (!s,!n) (a,b)
      | n == m = (s,n)
      | n+b > m = until ((m==).snd) (\(s,n) -> (s+a,n+1)) (s,n)
      | otherwise = (s+a*b, n+b)

-- utils
readInts :: IO [Int]
readInts = map (fst . fromJust . C8.readInt) . C8.words <$> C8.getLine

readPair :: IO Pair
readPair = do
  [x,y] <- readInts
  return (x,y)

Measured memory_bytes: 57724
#include<iostream>
#include<string>
#include<cstring>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;
#define PI 3.141592653589793

int main(){
  int N; cin >> N; ll ans = 0; ll S[N];
  rep(i, N){
    cin >> S[i];
  }
  N--;
  rep(i, N){
    int m = i+1; ll ato = 0, mae = 0;
    ll bai = N/m;
    if(N%m){
      rep(j, bai){
        ato+=S[N-m*j];
        mae+=S[m*j];
        ans = max(ans, mae+ato);
      }
    }
    else{
      rep(j, (bai+1)/2){
        ato+=S[N-m*j];
        mae+=S[m*j];
        ans = max(ans, mae+ato);
      }
    }
  }
  cout << ans << endl;  
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
 
using ll = long long ;
using ld=long double;
 
 
int main(){
    int n,k;
    cin>>n>>k;
    string s;
    cin>>s;
    for(int i=0;i<n;i++){
        if(i==k-1){
            int x=s[i];
            s[i]=tolower(x);
        }
        cout<<s[i];
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
signed main(){
  int D,N;
  cin>>D>>N;
  if(N==100)
    N+=1;
  rep(i,0,D)
    N*=100;
  cout<<N;
  }


Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;

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

use std::cmp::{max, min};
use std::collections::HashMap;

fn main() {
  let n = read::<i64>();
  // let mut a = vec![];
  let mut cnt = 0;
  for _ in 0..n {
    let mut a_i = read::<i64>();
    while a_i % 2 == 0 {
      a_i = a_i / 2;
      cnt += 1;
    }
  }

  println!("{}", cnt);

}

Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
#define ios ios_base::sync_with_stdio(0);cin.tie(0)
#define scn(n) scanf("%d",&n)
#define lscn(n) scanf("%lld",&n)
typedef long long ll;
#define pri(n) printf("%d\n",n)
#define lpri(n) printf("%lld\n",n);
#define rep(i,st,ed) for(int i=st;i<ed;i++)
#define var(n) int n; scn(n)
#define F first
#define S second 
#define pb push_back
const int N=3003;
// const ll M = 998244353;
const ll M=1e9+7;
const ll inf=1e18;

ll dp[N][N],pre[N];
int n;

ll range_sum(int i,int j)
{
	return i>0 ? pre[j]-pre[i-1] : pre[j];
}

ll rec(int i,int j,ll a[])
{
	if(i==j)
		return a[i];
	if(i>j)
		return 0;
	if(i+1==j)
		return max(a[i],a[j]);
	if(dp[i][j]!=0)
		return dp[i][j];
	ll minus1 = rec(i+1,j,a);
	ll minus2 = rec(i,j-1,a);

	ll val1 = a[i] + range_sum(i+1,j)-minus1;
	ll val2 = a[j] + range_sum(i,j-1)-minus2;

	ll val = max(val1,val2);
	dp[i][j]=val;

	return val;



}

int main()
{
	scn(n);
	ll a[n];
	ll total = 0;
	rep(i,0,n)
	{
		lscn(a[i]);
		pre[i]=a[i];
		if(i)
			pre[i]+=pre[i-1];
	}

	ll sum = rec(0,n-1,a);
	ll val = pre[n-1]-sum;
	sum-=val;
	printf("%lld \n",sum);
}

Measured memory_bytes: 70272
#include<stdio.h>
int main(void)
{
    int tate,yoko,menseki,syu;

    scanf("%d %d",&tate,&yoko);

    menseki = tate * yoko;
    syu = tate * 2 + yoko * 2;

    printf("%d %d\n",menseki,syu);

    return 0;
}

Measured memory_bytes: 596
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNextInt()) {
            int H = sc.nextInt();
            int R = sc.nextInt();

            if ( H < 0 && Math.abs(H) == R ) {
                System.out.println(0);
            } else if ( H + R > 0 ) {
                System.out.println(1);
            } else {
                System.out.println(-1);
            }
        }
    }
}



Measured memory_bytes: 26224
n = int(input())
s = input()
list_pat = [["S", "S"], ["S", "W"], ["W", "S"], ["W", "W"]]
for one_s in s[1:]:
  if one_s == "o":
    for i, one_pat in enumerate(list_pat):
      if one_pat[-1] == "S":
        if one_pat[-2] == "S":
          list_pat[i].append("S")
        else:
          list_pat[i].append("W")
      else:
        if one_pat[-2] == "S":
          list_pat[i].append("W")
        else:
          list_pat[i].append("S")
  else:
    for i, one_pat in enumerate(list_pat):
      if one_pat[-1] == "S":
        if one_pat[-2] == "S":
          list_pat[i].append("W")
        else:
          list_pat[i].append("S")
      else:
        if one_pat[-2] == "S":
          list_pat[i].append("S")
        else:
          list_pat[i].append("W")

for one_pat in list_pat:
  if one_pat[0] == one_pat[-1]:
    if one_pat[0] == "S":
      if s[0] == "o" and one_pat[-2] == one_pat[1]:
        print("".join(one_pat[:-1]))
        exit()
      elif s[0] == "x" and one_pat[-2] != one_pat[1]:
        print("".join(one_pat[:-1]))
        exit()
    else:
      if s[0] == "o" and one_pat[-2] != one_pat[1]:
        print("".join(one_pat[:-1]))
        exit()
      elif s[0] == "x" and one_pat[-2] == one_pat[1]:
        print("".join(one_pat[:-1]))
        exit()
print("-1")

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

int main() {
  int A, B;

  cin >> A >> B;

  int count = 0;
  for (int n = A; n <= B; n++) {
    if (n / 10000 == n % 10 && n / 1000 % 10 == n % 100 / 10) {
      count++;
    }
  }

  cout << count << endl;
}


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

int main(){
    int N, M;
    cin >> N >> M;
    vector<int> A(M);
    for (int i = 0; i < M; ++i){
        cin >> A.at(i);
        N -= A.at(i);
    }
    if (N < 0) N = -1;
    cout << N << endl;
}

Measured memory_bytes: 3684
import java.util.*;
import java.lang.*;

public class Main{

  public static void main(String args[]){
  
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int m = sc.nextInt();
int sum=0;
    while(m--!=0){
int a = sc.nextInt();
sum+=a;
}
if(sum>n) System.out.println(-1);
else {
System.out.println(n-sum);
}
  }

}

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

using namespace std;

int main() {
   ios_base::sync_with_stdio(false); cin.tie(nullptr);
   int N; cin >> N;
   vector<vector<int>> adj(N);
   vector<int64_t> cost(N);
   for (int i = 1; i < N; ++i) {
      int par; cin >> par >> cost[i];
      adj[--par].emplace_back(i);
   }
   int64_t low = 0, high = int64_t(1e11);
   while (low < high) {
      int64_t mid = (low + high) >> 1;
      function<vector<array<int64_t, 2>>(int)> solve = [&](int v) {
         if (adj[v].empty()) return vector<array<int64_t, 2>>{{cost[v], cost[v]}};
         auto ans0 = solve(adj[v][0]);
         auto ans1 = solve(adj[v][1]);
         if (ans0.size() > ans1.size()) ans0.swap(ans1);
         if (ans0.empty() || ans1.empty()) return vector<array<int64_t, 2>>();
         vector<array<int64_t, 2>> ans;
         for (auto a : ans0) {
            for (int z = 0; z < 2; ++z) {
               if (a[z] + ans1.front()[0] <= mid) {
                  int l = 0, r = int(ans1.size()) - 1;
                  while (l < r) {
                     int md = (l + r + 1) >> 1;
                     if (a[z] + ans1[md][0] <= mid) l = md;
                     else r = md - 1;
                  }
                  ans.push_back({a[!z], ans1[l][1]});
               }
               if (a[z] + ans1.back()[1] <= mid) {
                  int l = 0, r = int(ans1.size()) - 1;
                  while (l < r) {
                     int md = (l + r) >> 1;
                     if (a[z] + ans1[md][1] <= mid) r = md;
                     else l = md + 1;
                  }
                  ans.push_back({a[!z], ans1[l][0]});
               }
            }
         }
         for (auto &a : ans) if (a[0] > a[1]) swap(a[0], a[1]);
         sort(ans.begin(), ans.end());
         int sz = 0;
         for (auto a : ans) {
            if (sz == 0 || a[1] < ans[sz-1][1]) ans[sz++] = a;
         }
         ans.resize(sz);
         for (auto &a : ans) a[0] += cost[v], a[1] += cost[v];
         return ans;
      };
      if (solve(0).empty()) low = mid + 1;
      else high = mid;
   }
   cout << low << '\n';
   return 0;
}


Measured memory_bytes: 28708
package main

import "fmt"

func main()  {
	var h, n int
	fmt.Scan(&h, &n)
	as := make([]int, n)
	for i := range as {
		fmt.Scan(&as[i])
	}
	
	var sum int
	for _, a := range as {
		sum += a
	}
	
	var result string
	if sum >= h {
		result = "Yes"
	} else {
		result = "No"
	}
	
	fmt.Print(result)
}


Measured memory_bytes: 5504
// Author: Jinhai Chen
#include <cstring>
#include <cstdio>
#include <iostream>
#include <algorithm>
using namespace std;
const int INF = 0x3f3f3f3f;
typedef long long ll;



int main() {
#ifdef CJHCJH
	// freopen("data.in","r",stdin);
#endif
	int a,b,n;
	cin>>n>>a>>b;
	ll ans1=min(a,b);
	ll ans2=max(0,(a+b)-n);
	cout<<ans1<<" "<<ans2<<endl;



	return 0;
}














Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
 
#define MAX  14
#define MAX2 12
 
char paper[MAX+1][MAX+1];
 
int main()
{
    int x, y, size;
    int cnt, max, d;
 
    for (x = 0; x < MAX; x++) for (y = 0; y < MAX; y++) paper[x][y] = 0;
 
    while (scanf("%d,%d,%d", &x, &y, &size) == 3) {
        x += 2, y += 2;
        if (size >= 3) {
            paper[x - 2][y]++;
            paper[x + 2][y]++;
            paper[x]    [y - 2]++;
            paper[x]    [y + 2]++;
        }
        if (size >= 2) {
            paper[x - 1][y - 1]++;
            paper[x - 1][y + 1]++;
            paper[x + 1][y - 1]++;
            paper[x + 1][y + 1]++;
        }
        paper[x]    [y]++;
        paper[x - 1][y]++;
        paper[x + 1][y]++;
        paper[x]    [y - 1]++;
        paper[x]    [y + 1]++;
    }
    cnt = 0, max = 0;
    for (x = 2; x < MAX2; x++) for (y = 2; y < MAX2; y++) {
        d = paper[x][y];
        if (d == 0) cnt++;
        if (d > max) max = d;
    }
    printf("%d\n%d\n", cnt, max);
    return 0;
}


Measured memory_bytes: 2108
N = str(input())
a = len(N)
if N[a-1] == "3":
  print("bon")
elif N[a-1] == "0" or N[a-1] == "1" or N[a-1] == "6" or N[a-1] == "8":
  print("pon")
else:
  print("hon")

Measured memory_bytes: 9048
#include <bits/stdc++.h>
#include <iostream>
#include<math.h>
using namespace std;
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; }
int main()
{
    int N, M;
    cin >> N >> M;
    vector<pair<int64_t, int64_t>> students(N);
    vector<pair<int64_t, int64_t>> checks(M);
    for (int i=0; i<N; i++) {
        int64_t x, y;
        cin >> x >> y;
        students[i] = make_pair(x, y);
    }

    for (int i=0; i<M; i++) {
        int64_t x, y;
        cin >> x >> y;
        checks[i] = make_pair(x, y);
    }

    vector<int>idousaki(N);
    for (int i=0; i<N; i++) {
        int64_t min_kyori = INT64_MAX;
        int64_t idou_index = 0;
        pair<int64_t, int64_t> student = students[i];
        for (int j=0; j<M; j++) {
            pair<int64_t, int64_t> idousaki = checks[j];
            int64_t idoukyori = abs(student.first - idousaki.first) + abs(student.second - idousaki.second);
            if (idoukyori < min_kyori) {
                min_kyori = idoukyori;
                idou_index = j + 1;
            }
        }

        idousaki[i] = idou_index;
    }

    for (int i=0; i<N; i++) {
        cout << idousaki[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 3632
import sys
import heapq
import math
import fractions
import bisect
import itertools
from collections import Counter
from collections import deque
from operator import itemgetter
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))

n,k=mp()
s=list(input())
ans=[]
c=1
for i in range(1,n):
    if s[i]==s[i-1]:
        c+=1
    else:
        ans.append(c)
        c=1
ans.append(c)
if len(ans)//2<=k:
    print(n-1)
else:
    print(n-len(ans)+2*k)


Measured memory_bytes: 11588
//Ruthless Coding 
#include <bits/stdc++.h>

#define uni(x)      (x).resize(unique(all(x)) - (x).begin())
#define fprint(v)   for(auto x : v) cout << x << ' '
#define ALL(x)      (x).begin(), (x).end()
#define MP(x, y)    make_pair(x, y)
#define PII         pair<int, int>
#define SZ(x)       int((x).size())
#define PB(x)       push_back(x)
#define ll          long long
#define S           second 
#define F           first
#define nl          '\n'

using namespace std;
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
mt19937_64 rnd;

const int N = 2e5 + 5;

int main() {
    ios_base::sync_with_stdio(0);cin.tie(0);
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    cout << (c - (d - b)) << ' ' << d + (c - a) << ' ' << a - (d - b) << ' ' << b + (c - a);
    return 0;
}


Measured memory_bytes: 256
def main():
    N, M = map(int, input().split())
    ab = [None] * N
    for i in range(N):
        ab[i] = list(map(int, input().split()))

    cd = [None] * M
    for j in range(M):
        cd[j] = list(map(int, input().split()))
    ans = [None] * N
    for i in range(N):
        Md = 10**16
        for j in range(M):
            Md_temp = abs(ab[i][0] - cd[j][0]) + abs(ab[i][1] - cd[j][1])
            if Md > Md_temp:
                Md = Md_temp
                ans[i] = j + 1

    print("\n".join(map(str, ans)))


if __name__ == "__main__":
    main()


Measured memory_bytes: 9156
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <string>
#include <map>
#include <bitset>
#include <vector>
#include <queue>

using namespace std;

typedef long long ll;
#define FOR(i,a,b)   for(ll i = (a); i < (b); i++ )
#define REP(i, n)    FOR(i,0,n)
typedef pair< ll, ll >   cp2;
typedef pair< ll, cp2 >   cp3;
#define fi first
#define se second
#define sec  se.fi
#define thr  se.se
const ll mod = 1000000007;
//              123456789


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

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

int N;
ll A[112345];
ll ans;
int cnt = 0;

int main(){
	
	cin>>N;
	
	REP( i, N ) scanf("%lld", A+i);
	
	sort( A, A+N );
	
	int B = mod;
	
	while( N-- && cnt < 2 ){
		if( A[N] == B ){
			if( cnt ){
				ans *= A[N];
			}
			else{
				ans = A[N];
			}
			cnt++;
			B = mod;
		}
		else{
			B = A[N];
		}
	}
	
	if( cnt < 2 ) ans = 0;
	
	cout<<ans<<endl;
	
	return 0;
	
}

Measured memory_bytes: 1024
import java.util.*

fun main(args: Array<String>) = yorukatsu8d()

fun yorukatsu8d() {
    val (h, w) = readLine()!!.split(' ').map { it.toInt() }
    val grid = (1..h).map { readLine()!!.map { it == '.' }.toBooleanArray() }.toTypedArray()

    val start = Yx(0, 0)
    val queue = ArrayDeque(listOf(start to 1))
    val visited = mutableSetOf(start)
    val distances = Array(h) { IntArray(w) }

    while (queue.isNotEmpty()) {
        val (yx, dist) = queue.poll()
        val (y, x) = yx
        distances[y][x] = dist
        around.map { Yx(y + it.first, x + it.second) }
            .filter { it.y in 0 until h && it.x in 0 until w && grid[it.y][it.x] && visited.add(it) }
            .map { it to dist + 1 }
            .let { queue.addAll(it) }
    }

    val answer = if (visited.contains(Yx(h - 1, w - 1))) {
        h * w - grid.map { it.count { !it } }.sum() - distances[h - 1][w - 1]
    } else -1

    println(answer)
}

private val around = listOf(-1 to 0, 1 to 0, 0 to -1, 0 to 1)

private data class Yx(val y: Int, val x: Int)


Measured memory_bytes: 38512
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;(i)--)
#define rrep1(i,n) for(int i=((int)(n));i>0;(i)--)
#define sz(c) ((int)(c).size())
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define fi first
#define se second

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

string S;
void input(){
	cin>>S;
	int l=sz(S);
	bool ok=true;
	rep(i,l){
		if(i%2==0){
			if(S[i]=='L')ok=false;
		}
		else{
			if(S[i]=='R')ok=false;
		}
	}

	if(ok)cout<<"Yes";
	else cout<<"No";
}

void solve(){

}

void output(){
  
}

int main(){
  input();
  solve();
  output();
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <math.h>
using namespace std;
typedef long long int ll;

int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	int b[3][3];
	bool a[3][3];
	for(int i=0;i<3;i++){
		for(int j=0;j<3;j++){
			cin >> b[i][j]; 
			a[i][j]=0;
		}
	}
	int n; cin >> n;
	for(int i=0;i<n;i++){
		int x; cin >> x;
		for(int j=0;j<3;j++){
			for(int k=0;k<3;k++){
				if(b[j][k]==x){
					a[j][k]=1;
				}
			}
		}
	}
	bool okok=0;
	for(int i=0;i<3;i++){
		if(a[i][0]&&a[i][1]&&a[i][2])okok=1;
		if(a[0][i]&&a[1][i]&&a[2][i])okok=1;
	}
	if(a[0][0]&&a[1][1]&&a[2][2])okok=1;
	if(a[0][2]&&a[1][1]&&a[2][0])okok=1;
	if(okok){
		cout <<"Yes" << endl;
	}else{
		cout << "No" << endl;
	}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) \
  for (ll i = static_cast<int>(a); i < static_cast<int>(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, ) (__VA_ARGS__)  // NOLINT
#define chmax(x, a)  do { x = max(x, a); } while(0)
#define chmin(x, a)  do { x = min(x, a); } while(0)

using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef pair<ll,ll> PLL;

void solve() {
  string s, t;
  cin >> s >> t;
  ll ans = 1e18;
  rep(offset, s.size()-t.size()+1) {
    ll d = 0;
    rep(k, t.size()) {
      if (t[k] != s[k+offset])
        d++;
    }
    chmin(ans, d);
  }
  cout << ans << endl;
}

int main() {
  //ll T;
  //cin >> T;
  //rep(_,T)
    solve();
  return 0;
}


Measured memory_bytes: 3568
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main(){
  int n;
  string s;
  cin >> n>>s;
  vector<int> a(n);
  int k=0;
  rep(i,n){
    if(s.at(i)=='E'){
      k++;
      a.at(i)=k;
    }else{
      a.at(i)=k;
    }
  }
  int ans=1e7;  
  ans=min(ans,a.at(n-1)-a.at(0));
  for(int i=1;i<n;i++){
    int mini;
    mini=(a.at(n-1)-a.at(i))+i-a.at(i-1);
    ans=min(ans,mini);
  }
  cout << ans;
}
    

Measured memory_bytes: 4780
n = int(input())
A = [list(map(int, list('{:020b}'.format(a))))
     for a in map(int, input().split())]

ans = 0
R = -1
X = [0]*20
for L in range(n):
    if R < L:
        R += 1
        for i in range(20):
            X[i] += A[R][i]

    while R+1 < n and all(x+y != 2 for x, y in zip(X, A[R+1])):
        for i in range(20):
            X[i] += A[R+1][i]
        R += 1
    ans += R-L+1
    for i in range(20):
        X[i] -= A[L][i]
print(ans)


Measured memory_bytes: 124832
#include <cstdio>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#define LL long long
const int maxn = 1e5 + 5;
using namespace std;
vector <pair<int, int> > X[maxn], Y[maxn];
set <pair<int, int> > sx[maxn], sy[maxn];
int n, s1, s2, d;
int x[maxn], y[maxn], lx[maxn], ly[maxn], ox[maxn], oy[maxn];
LL ans = 0;
queue <int> q;
bool vis[maxn];
void addx(int l, int f){
	set <pair<int, int> >::iterator it = sx[l].lower_bound(make_pair(oy[f] - d, 0));
	ans += 1ll * (upper_bound(X[l].begin(), X[l].end(), make_pair(oy[f] + d, n)) - lower_bound(X[l].begin(), X[l].end(), make_pair(oy[f] - d, 0)));
	if (it == sx[l].end()) return;
	while (oy[it->second] <= oy[f] + d && it != sx[l].end()){
		if (!vis[it->second]) q.push(it->second), vis[it->second] = 1;
		set <pair<int, int> >::iterator temp = it; ++temp;
		sx[l].erase(it); it = temp;
	}
}
void addy(int c, int f){
	set <pair<int, int> >::iterator it = sy[c].lower_bound(make_pair(ox[f] - d, 0));
	ans += 1ll * (upper_bound(Y[c].begin(), Y[c].end(), make_pair(ox[f] + d, n)) - lower_bound(Y[c].begin(), Y[c].end(), make_pair(ox[f] - d, 0)));
	if (it == sy[c].end()) return;
	while (ox[it->second] <= ox[f] + d && it != sy[c].end()){
		if (!vis[it->second]) q.push(it->second), vis[it->second] = 1;
		set <pair<int, int> >::iterator temp = it; ++temp;
		sy[c].erase(it); it = temp;
	}
}
map <pair<int, int>, int> m;
void bfs(){
	q.push(s1); vis[s1] = 1;
	while (!q.empty()){
		int cur = q.front(); q.pop();
		int l1 = lower_bound(lx + 1, lx + n + 1, ox[cur] - d) - lx;
		int l2 = lower_bound(lx + 1, lx + n + 1, ox[cur] + d) - lx;
		int c1 = lower_bound(ly + 1, ly + n + 1, oy[cur] - d) - ly;
		int c2 = lower_bound(ly + 1, ly + n + 1, oy[cur] + d) - ly;
		bool f1 = (lx[l1] == ox[cur] - d), f2 = (lx[l2] == ox[cur] + d);
		bool f3 = (ly[c1] == oy[cur] - d), f4 = (ly[c2] == oy[cur] + d);
		ans -= m[make_pair(l1, c1)] * f1 * f3;
		ans -= m[make_pair(l2, c1)] * f2 * f3;
		ans -= m[make_pair(l1, c2)] * f1 * f4;
		ans -= m[make_pair(l2, c2)] * f2 * f4;
		if (f1) addx(l1, cur);
		if (f2) addx(l2, cur);
		if (f3) addy(c1, cur);
		if (f4) addy(c2, cur);
	}
}
int _abs(int x){
	return x < 0 ? -x : x;
}
int main(){
	scanf("%d%d%d", &n, &s1, &s2);
	for (int a, b, i = 1; i <= n; i++){
		scanf("%d%d", &a, &b);
		x[i] = a - b; y[i] = a + b;
		ox[i] = x[i], oy[i] = y[i];
		lx[i] = x[i], ly[i] = y[i];
	}
	sort(lx + 1, lx + n + 1); sort(ly + 1, ly + n + 1);
	for (int i = 1; i <= n; i++){
		x[i] = lower_bound(lx + 1, lx + n + 1, x[i]) - lx;
		y[i] = lower_bound(ly + 1, ly + n + 1, y[i]) - ly;
		X[x[i]].push_back(make_pair(oy[i], i));
		Y[y[i]].push_back(make_pair(ox[i], i));
		sx[x[i]].insert(make_pair(oy[i], i));
		sy[y[i]].insert(make_pair(ox[i], i));
		m[make_pair(x[i], y[i])]++;
	}
	for (int i = 1; i <= n; i++) sort(X[i].begin(), X[i].end());
	for (int i = 1; i <= n; i++) sort(Y[i].begin(), Y[i].end());
	d = max(_abs(ox[s1] - ox[s2]), _abs(oy[s1] - oy[s2]));
	bfs();
	printf("%lld\n", ans / 2ll);
	return 0;
}


Measured memory_bytes: 59648
from collections import deque

N,M = map(int,input().split())
C = [[] for _ in range(N+1)]
for _ in range(M):
    tmp = list(map(int,input().split()))
    C[tmp[0]].append(tmp[1])
    C[tmp[1]].append(tmp[0])
d = [1000000000]*(N+1)
d[1] = 0
visited = [False]*(N+1)
q = deque()
q.append(1)

sirube = [0]*(N+1)
while q:
    node = q.popleft()
    for adj in C[node]:
        if visited[adj] == False:
            sirube[adj] = node
            q.append(adj)
            visited[adj] = True



print("Yes")
for i in range(2,N+1):
    print(sirube[i])



Measured memory_bytes: 95040
package main

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

const mod = 1000000007

// 1MB
const ioBufferSize = 1 * 1024 * 1024

var sc = func() *bufio.Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Buffer(make([]byte, ioBufferSize), ioBufferSize)
	sc.Split(bufio.ScanWords)
	return sc
}()

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

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

func main() {
	s := next()
	n := len(s) + 1
	left, right := make([]int, n), make([]int, n)

	for i := 0; i < n-1; i++ {
		c := s[i]
		if c == '<' {
			left[i+1] = left[i] + 1
		}
	}
	for i := n - 2; i >= 0; i-- {
		c := s[i]
		if c == '>' {
			right[i] = right[i+1] + 1
		}
	}

	res := 0
	for i := 0; i < n; i++ {
		res += max(left[i], right[i])
	}

	fmt.Println(res)
}


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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(18);
  
  ll n, ans = 0;
  cin >> n;
  vector<ll> a(n+1);
  rep(i, 1, n+1) cin >> a[i];
  rep(i, 1, n+1) {
    if(a[a[i]] == i) ans++;
  }
  cout << ans/2 << "\n";
}

Measured memory_bytes: 1024
#define	_USE_MATH_DEFINES
#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cfloat>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <string>
#include <set>
using namespace std;
int main(){
	
	
	double x1,x2,x3,x4,y1,y2,y3,y4;
	
	while(cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4){
		double E=1e-10;
		if(abs((x2-x1)*(x4-x3)+(y2-y1)*(y4-y3))<E)
			cout<<"YES"<<endl;
		else
			cout<<"NO"<<endl;
	}
	return 0;

	
}

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

int main(){
  int64_t n; cin >> n;
  int64_t t[5];
  for (int i = 0; i < 5; i++) cin >> t[i];
  sort(t, t+5);
  int64_t ans = 4;
  ans += (n+t[0]-1) / t[0];
  cout << ans << endl;
  return 0;
} 

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int mod=1e9+7;
const int maxn=2e5+5;
char a[maxn];
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin>>(a+1);

	if(a[3]==a[4]&&a[5]==a[6])
    {
        cout<<"Yes"<<'\n';
    }
    else
        cout<<"No"<<'\n';



}


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

int n,a[25],x,t,d[25][25],s[100000],MAX[25];

signed main(){
    while(cin>>n,n){
        int ans=0;
        memset(s,0,sizeof(s));
        memset(d,0,sizeof(d));
        memset(MAX,0,sizeof(MAX));
        r(i,n){
            cin>>x>>t;
            r(j,x)cin>>a[j];
            r(j,x)d[x][j]+=a[(t+j)%x];
        }
        for(int i=1;i<=24;i++){
            if(i==13||i==17||i==19||i==23){
                r(j,i+1)MAX[i]=max(MAX[i],d[i][j]);
            }
            else{
                r(j,100000){
                    s[j]+=d[i][j%i];
                    ans=max(ans,s[j]);
                }
            }
        }
        cout<<ans+MAX[13]+MAX[17]+MAX[19]+MAX[23]<<endl;
    }
}


Measured memory_bytes: 3412
n, m = map(int, input().split())
e = [set([]) for _ in range(n+1)] # e[0] never used
for _ in range(m):
    a, b = map(int, input().split())
    e[a].add(b)
    e[b].add(a)

ans = 0
visited = [False]*(n+1) # visited[0] never used
visited[0] = True
def dfs(v):
    # current pos is v
    global visited
    global ans
    if all(v==True for v in visited):
        ans += 1
        return
    
    for next_pos in e[v]:
        if visited[next_pos] != True:
            visited[next_pos] = True
            dfs(next_pos)
            visited[next_pos] = False

visited[1] = True
dfs(1)
print(ans)

Measured memory_bytes: 3064
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task solver = new Task();
        solver.solve(1, in, out);
        out.close();
    }

    static class Task {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int[] arr = new int[]{in.nextInt(), in.nextInt(), in.nextInt()};
            Arrays.sort(arr);
            out.append(Arrays.equals(arr, new int[]{5, 5, 7}) ? "YES" : "NO");
        }

    }
}



Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define mfill(x,y) memset(x,y,sizeof(x))
#define all(v) v.begin(), v.end()
#define in(x,y,h,w) if(0<=x&&x<h&&0<=y&&y<w)
#define y0 y12345
#define y1 y54321

#ifdef LOCAL
#define debug(...) fprintf(stderr,__VA_ARGS__)
#else
#define debug(...) 42
#endif

using ul = unsigned long;
using ll = long long;
using P = pair<int, int>;
using vint = vector<int>;using vvint = vector<vector<int>>;
using vll = vector<ll>;using vvll = vector<vector<ll>>;
template<class T>bool chmax(T &a, const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a, const T &b){if(a>b){a=b;return 1;}return 0;}
template <class T>void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
    v.assign(a, vector<T>(b, t));
}
template <class T>T gcd(T &a, T &b){if(a<b){swap(a,b);} T r = a%b; while(r!=0){a=b;b=r;r=a%b;} return b;}

vint dx = {-1, 0, 1, 0}, dy = {0, -1, 0, 1};
vint dx8 = {-1, -1, -1, 0, 1, 1, 1, 0}, dy8 = {-1, 0, 1, 1, 1, 0, -1, -1};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    debug("debug test\n");
    int n, a, b, c;cin>>n>>a>>b>>c;
    vint l(n);
    rep(i, n)cin>>l[i];
    int ans = 10000000;
    rep(bit, pow(4, n)){
        int mp = 0;
        vint x(3);
        rep(k, n){
            int type = (int)(bit/pow(4, k))%4;
            if(type != 0){
                if(x[type-1]!=0)mp+=10;
                x[type-1]+=l[k];
            }
        }
        if(x[0]==0||x[1]==0||x[2]==0){continue;}
        mp += abs(a-x[0]);
        mp += abs(b-x[1]);
        mp += abs(c-x[2]);
        chmin(ans, mp);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define maxn 100005
using namespace std;
ll sum[maxn];
ll cal(int n,int state) {
	ll ret = 0 , delta = 0;
	for(int i=1;i<=n;i++,state*=-1) {
		ll add = state - (sum[i] + delta);
		if(add * state > 0) {
			ret += add * state;
			delta += add;
		}
	}
	return ret;
}
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n;
	cin >> n;
	for(int i=1,val;i<=n;i++) {
		cin >> val;
		sum[i] = sum[i-1] + val;
	}
	cout << min(cal(n,1),cal(n,-1)) << endl;
	return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main(){
  long long a,b[10000000],c=0,d;
  cin>>a;
  for(int i=1;i<=1000000;i++){
    if(a%i==0){
      d=a/i;
      b[c]=d+i-2;
      c++;
    }
  }
  sort(b,b+c);
  cout<<b[0]<<endl;
  return(0);
}

Measured memory_bytes: 2304
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.NoSuchElementException;
public class Main {
	public static void main(String[] args)throws Exception{
		PrintWriter out = new PrintWriter(System.out);
		int H=nextInt();
		int W=nextInt();
		int A=nextInt();
		int B=nextInt();
		for(int i=0;i<H;i++){
			for(int j=0;j<W;j++){
				if(j<A&&i<B)
					System.out.print(0);
				else
					if(A<=j&&B<=i)
						System.out.print(0);
					else
						System.out.print(1);
			}
			System.out.println();
		}
	}
	static boolean isOK(int index,String key,String[]a){
		if (a[index].compareTo(key)>=0) return true;
	    else return false;
	}
	static int binary_search(String key,String[] a) {
	    int ng = -1; //「index = 0」が条件を満たすこともあるので、初期値は -1
	    int ok = (int)a.length; // 「index = a.size()-1」が条件を満たさないこともあるので、初期値は a.size()
	    while (Math.abs(ok - ng) > 1) {
	        int mid = (ok + ng) / 2;
	        if (isOK(mid,key,a)) ok = mid;
	        else ng = mid;
	    }
	    return ok;
	}
	//FastScanner
	static InputStream in = System.in;
	static  byte[] buffer = new byte[1024];
	static int length = 0, p = 0;
	public static boolean hasNextByte () {
		if (p < length) return true;
		else {
			p = 0;
			try {length = in.read(buffer);}
			catch (Exception e) {e.printStackTrace();}
			if (length == 0) return false;
		}
		return true;
	}
	public static int readByte () {
		if (hasNextByte() == true) return buffer[p++];
		return -1;
	}
	public static boolean isPrintable (int n) {return 33<=n&&n<=126;}
	public static void skip () {
		while (hasNextByte() && !isPrintable(buffer[p])) p++;
	}
	public static boolean hasNext () {skip(); return hasNextByte();}
	public static String next () {
		if (!hasNext()) throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int temp = readByte();
		while (isPrintable(temp)) {
			sb.appendCodePoint(temp);
			temp = readByte();
		}
		return sb.toString();
	}
	public static int nextInt () {return Math.toIntExact(nextLong());}
	public static int[] nextInts (int n) {
		int[] ar = new int[n];
		for (int i=0; i<n; i++) ar[i] = nextInt();
		return ar;
	}
	public static long nextLong () {
		if (!hasNext()) throw new NoSuchElementException();
		boolean minus = false;
		int temp = readByte();
		if (temp == '-') {
			minus = true;
			temp = readByte();
		}
		if (temp<'0' || '9'<temp) throw new NumberFormatException();
		long n = 0;
		while (isPrintable(temp)) {
			if ('0'<=temp && temp<='9') {
				n *= 10;
				n += temp - '0';
			}
			temp = readByte();
		}
		return minus? -n : n;
	}
}



Measured memory_bytes: 52280
#include<bits/stdc++.h>
using namespace std;
int main()
{
      long long n,x,t;
      long long sum=0;
      vector<long long>v;
      cin>>n;
     for(int i=0;i<n;i++)
     {
          cin>>x;
          v.push_back(x);


     }
     for(int i=1;i<n;i++)
     {
          if(v[i]<v[i-1])
          {
                t=v[i-1]-v[i];
                   sum+=t;
                   v[i]=v[i-1];
          }


     }
     cout<<sum<<endl;
    return 0;
}



Measured memory_bytes: 5360
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<cmath>
#include<map>
#include<iomanip>
#include<numeric>
#include<queue>
#include<functional>
#include<tuple>
#include<math.h>
#include<bitset>
#include<stack>
#include<set>
#define rip(i,n) for(int i=0;i<n;i++)
#define ll long long
#define ld long double
#define sec setprecision　//小数点以下何位まで知りたいか
#define mod 1000000007
#define pi 3.1415926

using namespace std;
ll gcd(ll a, ll b)//最大公約数
{
	if (a % b == 0)	return(b);
	else return(gcd(b, a % b));
}
ll lcm(ll a, ll b)//最小公倍数
{
	return a * b / gcd(a, b);
}
ll pow(ll a, ll b) {
	ll k = b % 30000, h = b / 30000, s = 1;
	rip(i, 30000)s = (s * a) % mod; ll j = 1;
	if (h != 0)rip(i, h)j = j * s % mod;
	if (k != 0)rip(i, k)j = j * a % mod;
	return(j);
}

int main() {
	ll n, m, x;
	cin >> n >> m >> x;
	vector<ll>c(n);
	vector<vector<ll>> a(n, vector<ll>(m));
	rip(i, n) {
		cin >> c[i];
		rip(j, m) {
			cin >> a[i][j];
		}
	}
	ll cont = 0;
	rip(i, m) {
		ll k = 0;
		rip(j, n)k += a[j][i];
		if (k < x)cont++;
	}
	if (cont != 0)cout << "-1" << endl;
	else {
		ll mini = 10000000;
		ll k = pow(2, n+1);
		rip(i, k) {
			ll nadann = 0;
			vector<ll>d(m, 0);
			rip(j, n) {
				ll p = i / pow(2, j);
				if (p % 2 == 1) {
					rip(i, m)d[i] += a[j][i];
					nadann += c[j];
				}
				ll count = 0;
				rip(i, m)if (d[i] < x)count++;
				if (count == 0)mini = min(mini, nadann);
			}
		}
		cout << mini << endl;
	}
}


Measured memory_bytes: 4108
#include<stdio.h>
int main() {
    int N, y, x, z;
    scanf("%d", &N);
        y = N % 10;
        x = N / 10;
        z = x / 10;

if(y==z)
{
    printf("Yes\n");
}
else{
    printf("No\n");
}
    return 0;
}

Measured memory_bytes: 128
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.*;

public class Main {
	static long m=(long)1e9+7;
	public static long mod(long a) {
		return (a%m+m)%m;
		
	}
	public static long add(long a,long b) {
		return mod(mod(a)+mod(b));
		
	}
	public static long mul(long a,long b) {
		return mod(mod(a)*mod(b));
		
	}
	
	
	static long findProductSum(int a[], int n) 
	{ 
	  
		long ans1=0;
		long sum=0;
		for(int i=0;i<n;i++) {
			ans1=add(mul(sum, a[i]), ans1);
			sum=add(sum, a[i]);
		}
		return ans1;
		
	} 
	public static void main(String []args) {
		
		FastScanner scanner=new FastScanner();
		int n=scanner.nextInt();
		int a[]=scanner.readArray(n);
		System.out.println(findProductSum(a, n));
	}
	  

	static class FastScanner {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer("");

		String next() {
			while (!st.hasMoreTokens())
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}

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

		int[] readArray(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		}

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

}

Measured memory_bytes: 56144
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
#define ordered_set tree<int,null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
#define ordered_set_pair tree<pair<int,int>,null_type,less<pair<int,int>>, rb_tree_tag,tree_order_statistics_node_update> 
#define ordered_set_mutiset tree<int,null_type,less_equal<int>, rb_tree_tag,tree_order_statistics_node_update>
typedef long long int ll;
typedef long double ld;
typedef unsigned long long int ull;
typedef pair<int,int> pi; 
#define PI 3.1415926535897932384
#define FOR(i,vv,n) for(ll i=vv;i<n;i++)
#define FORR(i,n,vv) for(ll i=n-1;i>=vv;i--)
#define ve vector 
#define maxind(v) (max_element(v.begin(),v.end())-v.begin())
#define minind(v) (min_element(v.begin(),v.end())-v.begin())
#define maxe(v) *max_element(v.begin(),v.end())
#define mine(v) *min_element(v.begin(),v.end())
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define eb emplace_back
#define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define mp make_pair
#define M 1000000007ll
#define INF 1000000000000000000ll
#define PRECISE cout.precision(18);
#define all(v) v.begin(),v.end()
#define BS(v,n) binary_search(all(v),n)
#define srt(v) sort(v.begin(),v.end())
#define rsrt(v) sort(all(v),greater <ll>())
#define uni(v) v.resize(unique(all(v))-v.begin())
#define F first
#define S second
#define GET(i,p) get<p>(i)

ll const maxn=2*100000+5;
ve <ll> adj[maxn];
ve <ll> used(maxn);
void dfs(ll u,ll &ans){
	ans++;
	used[u]=1;
	for(auto i:adj[u]){
		if(!used[i])
			dfs(i,ans);
	}

}


int main(){

	#ifndef ONLINE_JUDGE
    // for getting input from input.txt	
    freopen("input.txt", "r", stdin);
    // for writing output to output.txt
    freopen("output.txt", "w", stdout);
	 #endif

    FAST
	//PRECISE

ll n,m;
cin>>n>>m;
FOR(i,0,m)
{
	ll x,y;
	cin>>x>>y;
	x--;y--;
	adj[x].pb(y);
	adj[y].pb(x);
}
ll ans=0;
FOR(i,0,n){
if(!used[i]){
	ll lans=0;
	dfs(i,lans);
	ans=max(ans,lans);
}
}
cout<<ans;
return 0;
 }

Measured memory_bytes: 21916
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int a[100001],dp[100001],n,k;

int call(int i){
    if(i>=n-1)
        return 0;
    if(dp[i]!=-1)
        return dp[i];
    int res=INT_MAX;
    for(int j=i+1;j<=min(n-1,i+k);j++){
        res=min(res, abs(a[i]-a[j])+call(j));
    }
    return dp[i]=res;
}


int main(){

    cin>>n>>k;
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    memset(dp,-1,sizeof(dp));
    cout<<call(0);



return 0;
}


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

int main() {
    int N, L;
    cin >> N >> L;
    vector<string> S(N);
    string answer;
    for (int i = 0; i < N; i++)
    {
        cin >> S.at(i);
    }
    sort(S.begin(), S.end());
    for (int i = 0; i < N; i++)
    {
        cout << S.at(i);
    }
    cout << endl;
    
    

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll zero = 0;
const ll INF = 10000000000000000; //10^16
const ll MOD = 1000000007; //10^9+7
const ll MOD2 = 998244353;

int main(){
    int H, W, D;
    cin >> H >> W >> D;
    vector<pair<int,int>> place(H*W);
    vector<int> cost(H*W);
    int tmp;
    for(int i = 0; i < H; i++){
        for (int j = 0; j < W; j++){
            cin >> tmp; tmp--;
            place.at(tmp).first = i;
            place.at(tmp).second = j;
        }
    }
    for (int i = 0; i < H*W; i++){
        if(i < D){
            cost.at(i) = 0;
            continue;
        }
        else{
            cost.at(i) = cost.at(i-D);
            cost.at(i) += abs(place.at(i).first - place.at(i-D).first);
            cost.at(i) += abs(place.at(i).second - place.at(i-D).second);
        }
    }
    
    int Q; cin >> Q;
    int tmpl,tmpr,ans;
    for (int i = 0; i < Q; i++){
        cin >> tmpl >> tmpr; tmpl--; tmpr--;
        ans = cost.at(tmpr) - cost.at(tmpl);
        printf("%d\n", ans);
    }
    
    

}


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

int stoi(string str) {
  int ans = 0;
  for(int i = 0; i < str.length(); i++) {
    ans += ((int)str[i]-(int)'0') * (int)pow(10.0, (int)str.length()-i-1);
  }
  return ans;
}

int main() {
  int n;
  cin >> n;
  for(int t = 0; t < n; t++) {
    int x;
    cin >> x;
    cout << "Case " << t+1 << ":" << endl;
    for(int i = 0; i < 10; i++) {
      char s[9];
      int newX = x*x;
      sprintf(s, "%.8d", newX);
      string str = "00000000";
      for(int j = 0; j < 8; j++) {
	str[j] = s[j];
      }
      x = stoi(str.substr(2, 4));
      cout << x << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 0
count = int(input())
# print(count)
a = 0
b = 0
c = 0
d = 0
while count:
	val = input()
	# print(val)
	if val == 'AC':
		a += 1
	elif val == 'WA':
		b += 1
	elif val == 'TLE':
		c += 1
	elif val == 'RE':
		d += 1
	count -= 1

print('AC x ' + str(a))
print('WA x ' + str(b))
print('TLE x ' + str(c))
print('RE x ' + str(d))


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

int main(){
  	int d;
	cin >> d;
  	string ans;
  	if(d == 25) ans = "Christmas";
  	else if(d == 24) ans = "Christmas Eve";
  	else if(d == 23) ans = "Christmas Eve Eve";
  	else if(d == 22) ans = "Christmas Eve Eve Eve";
  	cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
//#pragma comment(linker, "/STACK:102400000,102400000")
#include <stdio.h>
#include <iostream>
#include <iomanip>
#include <fstream>
#include <string.h>
#include <stdlib.h>
#include <time.h>
#include <limits.h>
#include <math.h>
#include <algorithm>
#include <deque>
#include <queue>
#include <stack>
#include <list>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <string>
#include <vector>
#include <bitset>
#include <functional>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef double db;
typedef long double ldb;
#define rep(i,a,b) for(i=a;i<b;i++)
#define repu(i,a,b) for(i=a;i<=b;i++)
#define repd(i,a,b) for(i=a;i>=b;i--)
#define repc(i,a,b,c) for(i=a;i<b;i+=c)
#define repcu(i,a,b,c) for(i=a;i<=b;i+=c)
#define repcd(i,a,b,c) for(i=a;i>=b;i-=c)
#define FIN freopen("input.in","r",stdin)
#define FOUT freopen("output.out","w",stdout)
#define CC(a) memset(a,0,sizeof(a))
#define MST(a,b) memset(a,b,sizeof(a))
#define PII pair<int,int>
#define PLL pair<long long,long long>
#define VI vector<int>
#define VL vector<long long>
#define VII vector<PII>
#define VLL vector<PLL>
#define all(x) x.begin(),x.end()
#define mp make_pair
#define pb push_back
#define pf push_front
 
template<typename T>inline void gn(T &x){
	x=0;T f=1;char ch=getchar();
	while(!isdigit(ch)){if(ch=='-')f=-1;ch=getchar();}
	while(isdigit(ch)){x=x*10+ch-'0';ch=getchar();}
	x*=f;
}
template<typename T>inline void gt(T x){
	if(!x)return;
	gt(x/10);putchar(x%10+'0');
}
 
const LL N=1e6+5;
LL t,n,m,q,ans;
LL MOD=1e9+7,inf=0x1f1f1f1f;
db eps=1e-5;

int main()
{
//	ios_base::sync_with_stdio(false);cin.tie(0);
	LL i,j,k,l,ca=0;
	cin>>n>>m>>t;
	repu(i,1,n)cin>>k,ans+=(k<m||k>=t);
	cout<<ans<<endl; 
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define f first
#define s second
#define int long long int

main() {
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int n;
	
	cin>>n;
	if(n%1000==0){
		cout<<0;
		return 0;
	}
	cout<<1000-(n%1000);
	
	return 0;
}

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

int N,M,T[200000];

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

void uni(int x,int y){
	x=par(x);
	y=par(y);
	if(x==y)return;
	T[x]+=T[y];
	T[y]=x;
}

int main(){
	cin>>N>>M;
	for(int i=0;i<N;i++){
		T[i]=-1;
	}
	for(int i=0;i<M;i++){
		int a,b;
		cin>>a>>b;
		a--;
		b--;
		uni(a,b);
	}
	int mx=0;
	for(int i=0;i<N;i++){
		mx=max(mx,-T[i]);
	}
	cout<<mx<<endl;
}


Measured memory_bytes: 4340
#include <stdio.h>

int main(void){
  int a[2],b[2],m[2];

  scanf("%d %d %d %d",&a[0],&a[1],&b[0],&b[1]);
  if(a[0]> a[1]){
    m[0] = a[1];
  }else{
    m[0] = a[0];
  }
  if(b[0]> b[1]){
    m[1] = b[1];
  }else{
    m[1] = b[0];
  }
  printf("%d\n",m[0]+m[1]);
  return 0;
}

Measured memory_bytes: 128