akhauriyash/Code-Regression huggingface dataset:
A = [list(map(int,input().split())) for i in range(3)]
N = int(input())
B = [list(map(int,input().split())) for i in range(N)]

for i in range(3):
    for j in range(3):
        for k in range(N):
            if A[i][j] in B[k]:
                A[i][j] = 0
if A[0][0] == 0 and A[0][1] == 0 and A[0][2] == 0 or A[1][0] == 0 and A[1][1] == 0 and A[1][2] == 0 or A[2][0] == 0 and A[2][1] == 0 and A[2][2] == 0 or A[0][0] == 0 and A[1][0] == 0 and A[2][0] == 0 or A[0][1] == 0 and A[1][1] == 0 and A[2][1] == 0 or A[0][2] == 0 and A[1][2] == 0 and A[2][2] == 0 or A[0][0] == 0 and A[1][1] == 0 and A[2][2] == 0 or A[0][2] == 0 and A[1][1] == 0 and A[0][2] == 0:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
import java.util.*;

public class Main{
    
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        
        char[] s = sc.next().toCharArray();
        char[] t = sc.next().toCharArray();
        
        TreeSet<Integer>[] al = new TreeSet[26];
        for(int i=0; i<26; i++){
            al[i] = new TreeSet<>();
        }
        
        int len = s.length;
        for(int i=0; i<len; i++){
            int idx = s[i]-97;
            al[idx].add(i);
        }
        
        long ans = 0L;
        int cur = -1;
        for(int i=0; i<t.length; i++){
            int idx = t[i]-97;
            Integer next = al[idx].higher(cur);
            if(next==null && al[idx].size()==0){
                System.out.println(-1);
                return;
            }else if(next==null){
                ans += len-cur-1;
                next = al[idx].higher(-1);
                ans += next+1;
                cur = next;
            }else{
                ans += next-cur;
                cur = next;
            }
        }
        
        System.out.println(ans);
        
    }
}


Measured memory_bytes: 33248
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <string>
#include <climits>
#include <tuple>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cmath>
#define rep(i, n) for(Int (i) = 0; (i) < (n); (i)++)
using namespace std;
using Int = int32_t;
using Uint = uint32_t;
constexpr long long int mod = 1e9 + 7;


int main() {

	Int N; cin >> N;
	string S; cin >> S;

	Int ans = 0;

	rep(i, N - 2) {
		if (S[i] == 'A' && S[i + 1] == 'B' && S[i + 2] == 'C')ans++;
	}

	cout << ans << endl;

}

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

int a, b, c;

unordered_map<int, int> freq;

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

    string s = "No";

    freq[a]=0;
    freq[b]=0;
    freq[c]=0;

    freq[a]++;
    freq[b]++;
    freq[c]++;
    
    if(freq[a]==2 || freq[b]==2 || freq[c]==2)
        s = "Yes";
    
    cout << s << endl;
    return 0;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;++i)
#include<string>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<int, int>P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
//max=({});
//条件式が真ならwhileの中身を回し続ける
//printf("%d\n", ans);

//pairの入力
//vector<pair<ll, ll>>work(n);
//rep(i, n) {
//	ll a, b;
//	cin >> a >> b;
//	work[i] = make_pair(a, b);
//for(auto p:mp)(mapの探索)
//printf("%.10f\n",なんちゃら)

int g[15][15];
const int INF = 1001001001;
const int dx[4] = { -1,0,1,0 };
const int dy[4] = { 0,-1,0,1 };

//最大公約数
ll gcd(ll x, ll y) {
	return y ? gcd(y, x % y) : x;
}

ll lcm(ll x, ll y) {
	if (x == 0 || y == 0)return 0;
	return (x / gcd(x, y) * y);
}

//素因数分解
vector<pair<ll, int>>factorize(ll n) {
	vector<pair<ll, int>>res;
	for (ll i = 2;i * i <= n;++i) {
		if (n % i)continue;
		res.emplace_back(i, 0);
		while (n % i == 0) {
			n /= i;
			res.back().second++;
		}
	}
	if (n != 1)res.emplace_back(n, 1);
	return res;
}

int bingo[3][3];
bool flag[3][3];
int cnt[2][105];
int h, w;
int choco[1010][1010];
int s[11][11];

int main() {
	ll k, n;
	cin >> k >> n;
	vector<ll>a(n), b(n);
	rep(i, n) {
		cin >> a[i];
		b[i] = k - a[i];
	}
	ll right = a[0] + k - a[n - 1];
	ll left = b[n - 1] + k - b[0];
	rep(i, n - 1) {
		right = max(right, a[i + 1] - a[i]);
		left = max(left, b[i] - b[i + 1]);
	}
	int res = max(right, left);
	int ans = k - res;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int mod = 1e9 + 7;
const int inf = (1 << 30) - 1;
const ll infll = (1LL << 61) - 1;
#define fast() ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define digit(N) cout << fixed << setprecision((N))

int N, K, ans;

int main()
{
    cin >> N >> K;
    vector<int> h(N);
    for (int i = 0; i < N; i++)
    {
        cin >> h[i];
        if (h[i] >= K)
            ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 640
#ifdef BUILT_LOCAL

#include "niklib.h"

#endif

#include <iostream>
#include <utility>
#include <numeric>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <string>
#include <cstdio>
#include <map>
#include <cmath>
#include <set>
#include <list>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef __int128 lll;
constexpr ll mod = 1000000007;

#define bs(n) (1ull<<(ull)(n))
#define rep(i, n) for(ll (i) = 0;(i) < (n);(i)++)

int main() {
    int n, p[200000];
    cin >> n;
    rep(i, n)cin >> p[i];
    int l[200000], r = 0;
    rep(i, 200000)l[i] = 2000000000;
    rep(i, n) {
        auto t = lower_bound(l, l + n, p[i]);
        *t = min(*t, p[i]);
        r = max(r, (int) (t - l) + 1);
    }
    cout << r << endl;
}



Measured memory_bytes: 4304
S = input()
N = len(S)
S_ = ""
for i in range(N):
  S_ += S[N-1-i]
S_ = S_.replace("b","B")
S_ = S_.replace("d","b")
S_ = S_.replace("B","d")
S_ = S_.replace("p","P")
S_ = S_.replace("q","p")
S_ = S_.replace("P","q")
if S == S_:
  print("Yes")
else:
  print("No")

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

using namespace std;

#define sz(vec) ( (int)(vec).size() )
using LL = long long;

int n;

bool query(const vector<int>& pos) {
    cout << "? ";
    for (int i : pos) cout << i + 1 << ' ';
    cout << '\n'; cout.flush();
    string inp; cin >> inp;
    return inp == "Red";
}

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

    cin >> n;

    int l = 0, r = n - 1;
    vector<int> vec(n); iota(vec.begin(), vec.end(), 0);
    bool val0 = query(vec);
    while (l < r) {
        int mid = (l + r + 1) >> 1;
        iota(vec.begin(), vec.end(), mid);
        bool val = query(vec);
        if (val != val0) r = mid - 1;
        else l = mid;
    }

    vector<bool> ans(n << 1);
    vector<int> base(n - 1);
    iota(base.begin(), base.end(), l + 1);
    for (int i = 0; i < (n << 1); ++i) if (i <= l || i >= l + n) {
        vector<int> tmp = base; tmp.emplace_back(i);
        ans[i] = query(tmp);
    }

    base.clear();
    for (int i = 0; i < (n << 1); ++i) if (i <= l || i >= l + n) {
        if (ans[i] && sz(base) < ( (n - 1) >> 1) ) base.emplace_back(i);
    }

    for (int i = 0; i < (n << 1); ++i) if (i <= l || i >= l + n) {
        if (!ans[i] && sz(base) < n - 1) base.emplace_back(i);
    }

    for (int i = l + 1; i < l + n; ++i) {
        vector<int> tmp = base; tmp.emplace_back(i);
        ans[i] = query(tmp);
    }

    cout << "! ";
    for (auto i : ans) cout << (i ? 'R' : 'B');
    cout << '\n'; cout.flush();

    return 0;
}


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

typedef long long ll;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    
    string s;
    cin >> s;
    if ((s[2] == s[3]) && (s[4] == s[5])) {
        cout << "Yes";
    }
    else {
        cout << "No";
    }
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<algorithm>
#include<stdlib.h>
#define _USE_MATH_DEFINES
#include<math.h>
#include<numeric>
#include<iomanip>
#include<deque>
using namespace std;

typedef pair<int, int> P;

bool pc1(const P& firstElof, const P& secondElof)
{//first降順
	return firstElof.first > secondElof.first;
}
bool pc2(const P& firstElof, const P& secondElof)
{//first昇順
	return firstElof.first < secondElof.first;
}
bool pc3(const P& firstElof, const P& secondElof)
{//second降順
	return firstElof.second > secondElof.second;
}
bool pc4(const P& firstElof, const P& secondElof)
{//second昇順
	return firstElof.second < secondElof.second;
}


int main() {
	float t, x;
	cin >> t >> x;
	cout << std::setprecision(8)<<t / x << endl;
}




Measured memory_bytes: 256
s=input()
q=int(input())

state=0
x,y='',''
for i in range(q):
  a=input().split()
  if a[0]=='1':
    state=state^1
  else:
    if (a[1]=='1' and state==0) or (a[1]=='2' and state==1):
      x=a[2]+x
    else:
      y=y+a[2]
out=x+s+y
if state==0:
  print(out)
else:
  print(out[::-1])
  



Measured memory_bytes: 4640
#include<iostream>
using namespace std;
int main()
{
	int a;
	cin>>a;
	int x=a/100;
	int y=a%100;
	if(x>0&&x<=12&&y>0&&y<=12)
	cout<<"AMBIGUOUS";
	else if(y>0&&y<=12)
	cout<<"YYMM";
	else if(x>0&&x<=12)
	cout<<"MMYY";
	else 
	cout<<"NA";
	return 0;
}

Measured memory_bytes: 256
package main

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

func main() {
	io := NewIo()
	defer io.Flush()
	for {
		_, M := io.NextInt(), io.NextInt()
		if M == 0 {
			break
		}
		r := io.NextInt()
		t, m, s := make([]int, r), make([]int, r), make([]int, r)
		for i := 0; i < r; i++ {
			t[i], _, m[i], s[i] = io.NextInt(), io.NextInt(), io.NextInt()-1, io.NextInt()
		}
		q := io.NextInt()
		for i := 0; i < q; i++ {
			ss, ee, mm := io.NextInt(), io.NextInt(), io.NextInt()-1
			x := make([]int, 1300)
			for j := 0; j < r; j++ {
				if m[j] == mm {
					if s[j] == 1 {
						x[t[j]]++
					} else {
						x[t[j]]--
					}
				}
			}
			for j := 1; j < 1300; j++ {
				x[j] = x[j] + x[j-1]
			}
			ans := 0
			for j := ss; j < ee; j++ {
				if x[j] > 0 {
					ans++
				}
			}
			io.Println(ans)
		}
	}
}

// I/O template
type Io struct {
	reader    *bufio.Reader
	writer    *bufio.Writer
	tokens    []string
	nextToken int
}

func NewIo() *Io {
	return &Io{
		reader: bufio.NewReader(os.Stdin),
		writer: bufio.NewWriter(os.Stdout),
	}
}

func (io *Io) Flush() {
	err := io.writer.Flush()
	if err != nil {
		panic(err)
	}
}

func (io *Io) NextLine() string {
	var buff []byte
	for {
		line, isPrefix, err := io.reader.ReadLine()
		if err != nil {
			panic(err)
		}
		buff = append(buff, line...)
		if !isPrefix {
			break
		}
	}
	return string(buff)
}

func (io *Io) Next() string {
	for io.nextToken >= len(io.tokens) {
		line := io.NextLine()
		io.tokens = strings.Fields(line)
		io.nextToken = 0
	}
	s := io.tokens[io.nextToken]
	io.nextToken++
	return s
}

func (io *Io) NextInt() int {
	i, err := strconv.Atoi(io.Next())
	if err != nil {
		panic(err)
	}
	return i
}

func (io *Io) NextFloat() float64 {
	i, err := strconv.ParseFloat(io.Next(), 64)
	if err != nil {
		panic(err)
	}
	return i
}

func (io *Io) Println(a ...interface{}) {
	fmt.Fprintln(io.writer, a...)
}

func (io *Io) Printf(format string, a ...interface{}) {
	fmt.Fprintf(io.writer, format, a...)
}

func (io *Io) PrintIntSlice(a []int) {
	b := []interface{}{}
	for _, x := range a {
		b = append(b, x)
	}
	io.Println(b...)
}

func (io *Io) PrintStringSlice(a []string) {
	b := []interface{}{}
	for _, x := range a {
		b = append(b, x)
	}
	io.Println(b...)
}

func Log(name string, value interface{}) {
	fmt.Fprintf(os.Stderr, "%s=%+v\n", name, value)
}

func ExampleIo() {
	io := NewIo()
	defer io.Flush()
	a := make([]int, 0, 3)
	a[0], a[1], a[2] = io.NextInt(), io.NextInt(), io.NextInt()
	io.Println(a)
	io.PrintIntSlice(a)
	Log("io", a)
}



Measured memory_bytes: 2240
import math
from functools import reduce
k = int(input())
ans = 0
def gcd(*numbers):
    return reduce(math.gcd, numbers)

for i in range(1,k+1):
    for j in range(1,k+1):
        for l in range(1,k+1):
            ans += gcd(i,j,l)

print(ans)
            


Measured memory_bytes: 74244
// https://atcoder.jp/contests/abc176/tasks/abc176_c
// solution 2 
#include <iostream>
#include <algorithm>
#include <set>
#include <stack>
#include <string>
using namespace std;
typedef long long ll;
const int MAXN=2e5;


void solve() {
    int N; ll total = 0, maxx = 0, x;
    cin >> N;
    for (int i = 0; i < N; i++) {
        cin >> x;
        maxx = max(maxx, x);
        if (x < maxx) total += maxx -x;   
    }
    cout << total;
}

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

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

#define Online 1
// #define multitest 1
typedef long long ll;
typedef long double ld;
#define f first
#define s second
#define pb push_back
#define mp make_pair
const long long mod = 1000000007;
const long long High = 1e16;
void ControlIO();
void TimerStart();
void TimerStop();
#define db(...) ZZ(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1> void ZZ(const char* name, Arg1&& arg1){std::cerr << name << " = " << arg1 << endl;}
template <typename Arg1, typename... Args>void ZZ(const char* names, Arg1&& arg1, Args&&... args)
{
	const char* comma = strchr(names + 1, ',');
	std::cerr.write(names, comma - names) << " = " << arg1;
	ZZ(comma, args...);
}

void solve()
{
	int n;
	string str;
	cin >> n >> str;
	vector<int> Hash(26,1);
	for(int i=0;i<n;++i)
		Hash[str[i]-'a']++;
	ll ans = 1;
	for(int i=0;i<26;++i)
		ans = (ans*Hash[i])%mod;
	ans--;
	cout << ans << '\n';
}

int main()
{
  ControlIO();
  int t = 1;
#ifdef multitest
  cin >> t;
#endif
	TimerStart();
  while (t--)
    solve();
	TimerStop();
  return 0;
}

void ControlIO()
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);
#ifndef Online
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif
}

auto TimeStart = chrono::steady_clock::now();
auto TimeEnd = chrono::steady_clock::now();

void TimerStart()
{
	#ifndef Online
		TimeStart = chrono::steady_clock::now();
	#endif
}

void TimerStop() {
	#ifndef Online
		TimeEnd = chrono::steady_clock::now();
		auto ElapsedTime = TimeEnd - TimeStart;
		cout << "\n\nTime elapsed: " << chrono::duration<double>(ElapsedTime).count() << " seconds.\n";
	#endif
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using ll=long long;
using namespace std;
#define rep_i(i, n) for (int i = 0; i < (n); ++i)
#define rep_ll(i, n) for (long long i = 0; i < (n); ++i)
#define r_rep_i(i, start, end) for (int i = (start); i < (end); ++i)
#define r_rep_ll(i, start, end) for (long long i = (start); i < (end); ++i)
#define debug_vi(v) copy((v).begin(), (v).end(), ostream_iterator<int>(cout, " "));
#define debug_vll(v) copy((v).begin(), (v).end(), ostream_iterator<long long>(cout, " "));
#define debug_vd(v) copy((v).begin(), (v).end(), ostream_iterator<double>(cout, " "));
#define sort_v(v) sort((v).begin(), (v).end()); //昇順
#define d_sort_vi(v) sort((v).begin(), (v).end(), greater<int>()); //昇順
#define d_sort_vd(v) sort((v).begin(), (v).end(), greater<double>()); //昇順

int main(){
  string s;
  cin >> s;
  string output;
  rep_i(i, s.length()){
    if(s[i] == '0'){
      output += "0";
    }else if(s[i] == '1'){
      output += "1";
    }else{
      if (output.length() != 0){
        output.pop_back();
      }
    }
  }
  cout << output << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <queue>
#include <stack>
#include <stdlib.h>
using namespace std;
#define rep(i,n) for (int (i) = 0; (i) <(n); (i)++) 
#include <math.h>
#include <bits/stdc++.h>
using namespace std;
int binary(int bina){
    int ans = 0;
    for (int i = 0; bina>0 ; i++)
    {
        ans = ans+(bina%2)*pow(10,i);
        bina = bina/2;
    }
    return ans;
}
long comb(int n, int r) {
    long ans = 1;
    for (int i = n; i > n - r; --i) {
        ans = ans*i;
    }
    for (int i = 1 ; i < r + 1; ++i) {
        ans = ans / i;
    }
    return ans;
}
using namespace std;

int main(){
   int n;
   std::cin >> n;
   int a[n];
   rep(i,n){std::cin >> a[i];}
   rep(i,n){
       if(a[i]%2==0){
           if((a[i]%3!=0)&&(a[i]%5!=0)){
               std::cout << "DENIED" << std::endl;
               return 0;
           }
       }
   }
   std::cout << "APPROVED" << std::endl;
}





Measured memory_bytes: 256
#include <stdio.h>
//#include <stdlib.h>
//#include <string.h>
#include <stdbool.h>
//#include <limits.h>
//#include <math.h>

#define max(a,b) (a > b ? a : b)

int main() {
  int n;
  scanf("%d", &n);
  int x, y, a, b[n][n], ans = 0;
  for (int i=0; i<n; i++)
    for (int j=0; j<n; j++)
      b[i][j] = 2;
  for (int i=0; i<n; i++) {
    scanf("%d", &a);
    for (int j=0; j<a; j++) {
      scanf("%d %d", &x, &y);
      b[i][x-1] = y;
    }
  }
  for (unsigned int i=0; i<(unsigned int)(1 << n); i++) {
    bool c = false;
    for (int j=0; j<n; j++) {
      for (int k=0; k<n; k++) {
        if (j == k) continue;
        if (b[j][k] == 2) continue;
        if (((i>>j)&1) == 1) {
          if (b[j][k] != ((i>>k)&1)) {
            c = true;
            break;
          }
        }
      }
      if (c) break;
    }
    if (c) continue;
    int cnt = 0;
    for (int j=0; j<n; j++) {if (((i>>j)&1) == 1) cnt++;}
    ans = max(ans, cnt);
  }
  printf("%d\n", ans);
  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for( int i = 0 ; i < n ; i++ )
typedef long long ll ;
ll gcd (ll a , ll b ){ return b ? gcd(b,a%b) : a;}
ll lcm (ll a , ll b ){ return a/gcd(a,b)*b ;}

int main(){
  int N ;
  cin >> N ;
  ll A[N] ;
  rep(i,N) cin >> A[i] ;
  ll ans = A[0] ;
  rep(i,N) ans = lcm(ans,A[i]) ;
  cout << ans << endl;
}

Measured memory_bytes: 384
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};
    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

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

fn main() {
    input! {
        a: chars,
        b: chars,
        c: chars,
    }
    println!("{}",
        if a.iter().last().unwrap() == b.iter().next().unwrap()
        && b.iter().last().unwrap() == c.iter().next().unwrap()
        { "YES" } else { "NO" }
    );
}


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

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

const int INT_INF = 2147483646;
const ll LL_INF = 9223372036854775807;

bool SecondCompare(const pair<int,int> &a,const pair<int,int> &b)
{
       return a.second<b.second;
}
 
bool SecondCompareDes(const pair<int,int> &a,const pair<int,int> &b)
{
       return a.second>b.second;
}

ll minll(ll a, ll b){
    if(a >= b)  return b;
    else    return a;
}

ll maxll(ll a, ll b){
    if(a >= b)  return a;
    else    return b;
}

int dp[110][110];
int ans;
int n, m;

void warshall_floyd(int edge_num){
    for(int k = 0; k < edge_num; k++){
        for(int i = 0; i < edge_num; i++){
            for(int j = 0; j < edge_num; j++){
                if(dp[i][j] > (dp[i][k]+dp[k][j])){
                    dp[i][j] = dp[i][k]+dp[k][j];
                }
            }
        }
    }
}

int main(){
    for(int i = 0; i < 110; i++){
        for(int j = 0; j < 110; j++){
            dp[i][j] = INT_INF/2-100;
        }
    }
    for(int i = 0; i < 110; i++){
        dp[i][i] = 0;
    }

    cin >> n >> m;
    int a[1000],b[1000], c[1000];
    for(int i = 0; i < m; i++){
        cin >> a[i] >> b[i] >> c[i];
        --a[i];
        --b[i];
        dp[a[i]][b[i]] = dp[b[i]][a[i]] = c[i];
    }

    warshall_floyd(n);

    ans = m;
    
    for(int i = 0; i < m; i++){
        for(int j = 0; j < n; j++){
            if(dp[j][a[i]] + c[i] == dp[j][b[i]]){
                --ans;
                break;
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
struct union_find{
    vector<int> par;
    vector<int> rank;
	vector<int> size;
    union_find(int sz){
        par.resize(sz);
		iota(par.begin(),par.end(),0);
        rank.assign(sz,0);
        size.assign(sz,1);
    }
    int find(int a){
        if(par[a]==a) return a;
        else return par[a] = find(par[a]);
    }
    void unite(int a,int b){
        int root_a=find(a) ,root_b=find(b);
		if(root_a==root_b) return;
		if(rank[root_a]<rank[root_b]) swap(root_a,root_b);
        if(rank[root_a]==rank[root_b]) rank[root_a]++;
		par[root_b] = root_a;
		size[root_a]+=size[root_b];
    }
    bool same(int a,int b){return find(a)==find(b);}
};

int main(){
	int n, m, k;
	cin >> n >> m >> k;

	union_find uf(n);
	vector<int> fr(n,0);
	for(int i=0; i<m; ++i){
		int a, b;
		cin >> a >> b;
		--a; --b;
		uf.unite(a,b);
		++fr[a];
		++fr[b];
	}
	for(int i=0; i<k; ++i){
		int c, d;
		cin >> c >> d;
		--c; --d;
		if(uf.same(c,d)){
			++fr[c];
			++fr[d];
		}
	}

	for(int i=0; i<n; ++i){
		cout << uf.size[uf.find(i)]-fr[i]-1 << " ";
	}
	cout << endl;
}

Measured memory_bytes: 2432
import sys

s = input()
t = "abcdefghijklmnopqrstuvwxyz"

if s[0] != 'A':
    print('WA')
    sys.exit(0)

st = s[2:-1]
if st.count('C') != 1:
    print('WA')
    sys.exit(0)
p = s.find('C')

for i in range(1,len(s)):
    if i == p:
        continue
    elif t.find(s[i]) >= 0:
        continue
    else:
        print('WA')
        sys.exit(0)

print('AC')

Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		String[] input = sc.next().split("");
		int res = input.length - 2;
		loop: while (true) {
			for (int i = 0; i < res / 2; i++) {
				if (!input[i].equals(input[res / 2 + i])) {
					res -= 2;
					continue loop;
				}
			}
			System.out.println(res);
			System.exit(0);
		}
	}
}


Measured memory_bytes: 35552
#include <iostream>

using namespace std;

long long n, last = 0, actual, answer = 0;
int main()
{
    cin >> n;
    for(int i = 0; i < n; ++i){
        cin >> actual;
        if(!actual) {last = 0; continue;}
        actual += last;
        answer += actual/2;
        actual %= 2;
        last = actual;
        
    }
    cout << answer << endl;
    return 0;
}

Measured memory_bytes: 256
fun main(args: Array<String>) {
    val (n, k) = readLine()?.split(" ")?.map { it.toInt() } ?: return
    val aList = readLine()?.split(" ")?.map { it.toInt() } ?: return

    if (n <= k) {
        println(1)
        return
    }

    println((n - k) / (k - 1) + 1 + if ((n - 1) % (k - 1) == 0) 0 else 1)
}

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

using ll = long long;
using ld  = long double;
using pint = pair<int, int>;
using pll = pair<ll, ll>;
using pld = pair<ld, ld>;
const int INF=1e9+7;
const ll LINF=9223372036854775807;
const ll MOD=1e9+7;
const ld PI=acos(-1);
const ld EPS = 1e-10; //微調整用（EPSより小さいと0と判定など）

int ii() { int x; if (scanf("%d", &x)==1) return x; else return 0; }
long long il() { long long x; if (scanf("%lld", &x)==1) return x; else return 0; }
string is() { string x; cin >> x; return x; }
char ic() { char x; cin >> x; return x; }
void oi(int x) { printf("%d ", x); }
void ol(long long x) { printf("%lld ", x); }
void od_nosp(double x) { printf("%.15f", x); } // 古い問題用
void od(double x) { printf("%.15f ", x); }
// long doubleで受け取り、fをLfなどに変えて出力すると、変な数値が出る
// それをなんとかするには独自の出力を作らなければならなそう
void os(const string &s) { printf("%s ", s.c_str()); }
void oc(const char &c) { printf("%c ", c); }
#define o_map(v){cerr << #v << endl; for(const auto& xxx: v){cout << xxx.first << " " << xxx.second << "\n";}} //動作未確認
void br() { putchar('\n'); }

// #define gcd __gcd //llは受け取らない C++17~のgcdと違うので注意
// int lcm(int a, int b){return a / gcd(a, b) * b;}
#define begin_end(a) a.begin(),a.end() //sort(begin_end(vec));
#define REP(i,m,n) for(ll i=(ll)(m) ; i < (ll) (n) ; i++ )
#define rep(i,n) REP(i,0,n)
#define m_p(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define p_b push_back
#define SZ(x) ((int)(x).size) //size()がunsignedなのでエラー避けに


// coutによるpairの出力（空白区切り）
template<typename T1, typename T2> ostream& operator<<(ostream& s, const pair<T1, T2>& p) {return s << "(" << p.first << " " << p.second << ")";}
// coutによるvectorの出力（空白区切り）
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
  int len = v.size();
  for (int i = 0; i < len; ++i) {
    s << v[i]; if (i < len - 1) s << " "; //"\t"に変えるとTabで見やすく区切る
  }
  return s;
}
// coutによる多次元vectorの出力（空白区切り）
template<typename T> ostream& operator<<(ostream& s, const vector< vector<T> >& vv) {
  int len = vv.size();
  for (int i = 0; i < len; ++i) {
    s << vv[i] << endl;
  }
  return s;
}

//最大値、最小値の更新。更新したor等しければtrueを返す
template<typename T>
bool chmax(T& a, T b){return (a = max(a, b)) == b;}
template<typename T>
bool chmin(T& a, T b){return (a = min(a, b)) == b;}

//4近傍（上下左右） rep(i, 2) にすると右・下だけに進む
vector<int> dx_4 = {1, 0, -1, 0};
vector<int> dy_4 = {0, 1, 0, -1};

// -------- template end - //


// - library ------------- //



// --------- library end - //


int main(){

  ll N = il();
  ll ac = 0;
  ll wa = 0;
  ll tle = 0;
  ll re = 0;
  rep(i, N){
    string s = is();
    if (s=="AC"){
      ac++;
    }
    else if (s=="WA"){
      wa++;
    }
    else if (s=="TLE"){
      tle++;
    }
    else{
      re++;
    }
  }

  cout << "AC x " << ac << endl;
  cout << "WA x " << wa << endl;
  cout << "TLE x " << tle << endl;
  cout << "RE x " << re << endl;

}

Measured memory_bytes: 3692
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;

int main() {
  int n;
  string s;
  cin >> n >> s;
  string a = s.substr(0, n / 2);
  string b = s.substr(n / 2);
  if (a == b)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i,n) for(int i = 0; i < (n); ++i)
int main() {
    int a, b, x;
    cin >> a >> b >> x;
    if ( a + b < x || a > x ) cout << "NO" << endl;
    else                      cout << "YES" << endl;
    return 0;
}


Measured memory_bytes: 256
// AtCoder Beginner Contest 125 - Problem D: Flipping Signs (https://atcoder.jp/contests/abc125/tasks/abc125_d)
#include <bits/stdc++.h>

using namespace std;
using ll = long long;

ll solve(int N, const vector<ll>& as)
{
    int minus = 0;
    vector<ll> xs(N);

    for (int i = 0; i < N; ++i)
    {
        minus += (as[i] < 0 ? 1 : 0);
        xs[i] = llabs(as[i]);
    }

    ll ans = accumulate(xs.begin(), xs.end(), 0LL);
    ll m = *min_element(xs.begin(), xs.end());

    return minus % 2 == 0 ? ans : ans - 2*m;
}

int main()
{
    ios::sync_with_stdio(false);

    int N;
    cin >> N;

    vector<ll> as(N);

    for (int i = 0; i < N; ++i)
        cin >> as[i];

    auto ans = solve(N, as);

    cout << ans << '\n';

    return 0;
}


Measured memory_bytes: 1792
#include <algorithm>
#include <cassert>
#include <chrono>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <map>
#include <set>
#include <sstream>
#include <vector>
using namespace std;

ostringstream ss;

void solve_small(int k, int n, int64_t ix)
{
    if (n == 0) {
        return;
    }

    if (ix < 0) {
        return;
    }

    int64_t t = 0, u = 1;
    bool small = false;
    for (int i = 0; i < n; i++) {
        u *= k;
        t += u;
    }

    // cout << t << ", " << k << ", " << n << endl;

    while (n > 0 && ix >= 0) {
        int64_t d = ix * k / t;
        int64_t base = t / k * d;
        ss << " " << (int)(d + 1);
        n--;
        ix = ix - base - 1;
        t /= k;
        t--;
    }
}

void solve(int k, int n)
{
    int ofs = 1;

    while (n > 0) {
        int64_t t = 0, u = 1;
        bool small = true;
        for (int i = 0; i < n; i++) {
            u *= k;
            t += u;
            if (t > 9 * 10000000000L) {
                small = false;
                break;
            }
        }

        if (small) {
            // assert((t - ofs + 1) / 2 - 1 >= 0);
            solve_small(k, n, (t - ofs + 1) / 2 - 1);
            return;
        }

        ss << " " << (int)(k / 2 + 1);

        n--;
        ofs += 1;
    }
}

int main()
{
    cin.tie(0);

    int64_t k, n;
    cin >> k >> n;

    if (k % 2 == 0) {
        ss << k / 2;
        for (int i = 1; i < n; i++) {
            ss << " " << k;
        }
    } else if (k == 1) {
        ss << 1;
        for (int i = 1; i < (n + 1) / 2; i++) {
            ss << " 1";
        }
    } else {
        ss << (int)(k / 2 + 1);
        solve(k, n - 1);
    }
    cout << ss.str() << endl;

    return 0;
}


Measured memory_bytes: 8196
(n, m, l) = [int(i) for i in input().split()]
 
A = []
for nc in range(n):
    A.append([int(i) for i in input().split()])
 
B = []
for mc in range(m):
    B.append([int(i) for i in input().split()])
 
product = [[0 for d in range(l)] for dd in range(n)]
 
for nc in range(n):
    for lc in range(l):
        for mc in range(m):
            product[nc][lc] += A[nc][mc] * B[mc][lc]
 
for r in product:
    print(' '.join([str(d) for d in r]))

Measured memory_bytes: 8948
;; -*- coding: utf-8 -*-
(eval-when (:compile-toplevel :load-toplevel :execute)
  (defparameter OPT
    #+swank '(optimize (speed 3) (safety 2))
    #-swank '(optimize (speed 3) (safety 0) (debug 0)))
  #+swank (ql:quickload '(:cl-debug-print :fiveam))
  #-swank (set-dispatch-macro-character #\# #\> (lambda (s c p) (declare (ignore c p)) (read s nil (values) t))))
#+swank (cl-syntax:use-syntax cl-debug-print:debug-print-syntax)
#-swank (disable-debugger) ; for CS Academy

;; BEGIN_INSERTED_CONTENTS
(declaim (inline read-line-into))
(defun read-line-into (buffer-string &key (in *standard-input*) (term-char #\Space))
  "Receives ASCII inputs and returns multiple values: the string and the end
position.

This function calls READ-BYTE to read characters though it calls READ-CHAR
instead on SLIME because SLIME's IO is not bivalent."
  (declare (inline read-byte)) ; declaring (sb-kernel:ansi-stream in) will be faster
  (loop for c of-type base-char =
           #-swank (code-char (read-byte in nil #.(char-code #\Newline)))
           #+swank (read-char in nil #\Newline)
        for idx from 0
        until (char= c #\Newline)
        do (setf (char buffer-string idx) c)
        finally (when (< idx (length buffer-string))
                  (setf (char buffer-string idx) term-char))
                (return (values buffer-string idx))))

(defmacro dbg (&rest forms)
  #+swank
  (if (= (length forms) 1)
      `(format *error-output* "~A => ~A~%" ',(car forms) ,(car forms))
      `(format *error-output* "~A => ~A~%" ',forms `(,,@forms)))
  #-swank (declare (ignore forms)))

(defmacro define-int-types (&rest bits)
  `(progn
     ,@(mapcar (lambda (b) `(deftype ,(intern (format nil "UINT~A" b)) () '(unsigned-byte ,b))) bits)
     ,@(mapcar (lambda (b) `(deftype ,(intern (format nil "INT~A" b)) () '(signed-byte ,b))) bits)))
(define-int-types 2 4 7 8 15 16 31 32 62 63 64)

(declaim (inline println))
(defun println (obj &optional (stream *standard-output*))
  (let ((*read-default-float-format* 'double-float))
    (prog1 (princ obj stream) (terpri stream))))

(defconstant +mod+ 1000000007)

;; Body

(defun main ()
  (declare #.OPT)
  (let* ((n (read))
         (line (make-string 10 :element-type 'base-char))
         (table (make-hash-table :test #'equalp :size n))
         (res 0))
    (dotimes (i n)
      (read-line-into line)
      (let ((histo (make-array 26 :element-type 'uint8 :initial-element 0)))
        (loop for c across line
              do (incf (aref histo (- (char-code c) 97))))
        (if (gethash histo table)
            (incf (gethash histo table))
            (setf (gethash histo table) 1))))
    (loop for value being each hash-value of table
          do (incf res (floor (* value (- value 1)) 2)))
    (println res)))

#-swank (main)


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


long long int Exp(long long int exp_n,long long int exp_e, long long exp_mod);


int main(){
  int N, X, T;
  cin >> N >> X >> T;

  
  cout << ((N+X-1)/X)*T;
  
  return 0;
}


long long int Exp(long long int exp_n,long long int exp_e, long long int exp_mod){
  long long int exp_o = 1;
  long long int exp_x=exp_n;
  long long int exp_tmp;
  
  while(0<exp_e){
    exp_tmp = exp_e/2;
    if(exp_e - exp_tmp*2 == 1){
      exp_o = exp_o*exp_x;
      if(exp_o>exp_mod){
        exp_o=exp_o%exp_mod;
      }
    }
    
    exp_x = exp_x*exp_x;
    if(exp_x>exp_mod){
      exp_x=exp_x%exp_mod;
    }
    exp_e = exp_tmp;
  }
  return exp_o;
}


Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'
#define SPEED ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
typedef vector<int>vi;
typedef pair<int,int>pi;
typedef vector<pi>vpi;
typedef vector<vi>vvi;
#define double long double
#define pow powl
#define sqrt sqrtl
#define cbrt cbrtl
#define floor floorl
#define ceil ceill
#define pb push_back
#define ep emplace_back
#define PB pop_back
#define pf push_front
#define ef emplace_front
#define PF pop_front
#define mp make_pair
#define ub(a,b) upper_bound(all(a),b)-a.begin()
#define lb(a,b) lower_bound(all(a),b)-a.begin()
#define bs(a,b) binary_search(all(a),b)
#define mem(a,b) memset(a,b,sizeof(a))
#define in(a,n) FOR(i,0,n-1) cin>>a[i]
#define in1(a,n) FOR(i,1,n) cin>>a[i]
#define ff first
#define ss second
#define out(a,n) FOR(i,0,n-1) cout<<a[i]<<" ";cout<<endl;
#define out1(a,n) FOR(i,1,n) cout<<a[i]<<" ";cout<<endl;
#define clr(a) a.clear()
#define pow2(a) (1LL<<a)
#define all(a) a.begin(),a.end()
#define all1(a) a.begin()+1,a.end()
#define rall(a) a.rbegin(),a.rend()
#define rall1(a) a.rbegin(),a.rend()
#define sz(a) ((int)a.size())
#define FOR(i,a,b) for(auto i=a;i<=b;i++)
#define NFOR(i,a,b) for(auto i=a;i>=b;i--)
const int mod=1e9+7;

inline int add(int a,int b){return (a%mod + b%mod)%mod;}
inline int sub(int a ,int b){return (a%mod - b%mod + mod)%mod;}
inline int mul(int a,int b){return (a%mod * b%mod)%mod;}
inline int power(int a,int b,int MOD){int res=1;while(b){if(b&1){res*=a;res%=MOD;}a=a*a;a%=MOD;b>>=1;}return res;}

#define trace(x) cout<<#x<<" :: "<<x<<endl;
#define trace2(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<endl;
#define trace3(x,y,z) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<endl;
#define trace4(x,y,z,w) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<"\t"<<#w<<" :: "<<w<<endl;
clock_t time_p = clock();
void time()
{
  time_p = clock() - time_p;
  cerr << "Time elapsed : " << (double)(time_p)/CLOCKS_PER_SEC <<endl;
}
signed main()
{
     SPEED;
     string s;
     cin>>s;
     int n=s.length();
     vector<int>indices;
     for(int i=0;i+1<n;i++)
     	indices.pb(i);
     int p=sz(indices);
     int res=0;
     for(int i=0;i<(1LL<<p);++i)
     {
     	   vector<int>subset;
     	   for(int j=0;j<p;j++)
     	   {
     	   	    if(i&(1LL<<j))
     	   	    {
                    subset.pb(j);
     	   	    }  
     	   }
     	   if(subset.empty())
     	   {
     	   	    res+=stoll(s);
     	   	    continue;
     	   }
     	   int current=0;
     	   string ans;
     	   int go=0;
     	   for(int i=0;i<n;i++)
     	   {
     	   	     
     	   	     if(current<sz(subset)&&subset[current]==i)
     	   	     {
     	   	     	   ans+=s[i];
                       go+=stoll(ans);
                       ans="";
                       current++;
                 }
                 else
                 	ans+=s[i];
     	   }
     	   go+=stoll(ans);
     	   res+=go;
     }
     cout<<res<<endl;
     time();
     return 0;
}

Measured memory_bytes: 256
#include<stdio.h>


int main(void)
{
	int a[100][100];
	int b[100];
	int n,m;
	scanf("%d %d",&n ,&m);
	for(int i=0 ; i<n ; i++)
	{
		for(int j =0 ;j<m ;j++)
		{
			scanf("%d" ,&a[i][j]);
		}
	}
	for(int i=0 ;i<m ; i++)
	{
			scanf("%d" ,&b[i]);

	}
	int c[100]={0};
	
	for(int i =0 ; i<n ;i++)
	{
		for(int j =0 ;j<m ;j++)
		{
			c[i]+=a[i][j]*b[j];
		}
	}
	for(int i=0 ;i<n ;i++)
	{
		printf("%d\n",c[i]);
	}
	return 0;
}


Measured memory_bytes: 2736
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
#define show(x) {for(auto i: x){cout << i << " ";} cout << endl;}
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
  vector<string> day = {"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"};
  string S;
  cin >> S;
  rep(i, 7) {
    if (day[i] == S) {
      cout << 7 - i << '\n';
      return 0;
    }
  }
  return 0;
}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define mst(a,b) memset(a,b,sizeof(a))
#define lowbit(x) ((x)&(-x))
#define X first
#define Y second
#define lc o<<1
#define rc o<<1|1
using namespace std;
using namespace __gnu_cxx;
using namespace __gnu_pbds;
typedef long long LL;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int inf = 0x3f3f3f3f;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const int maxn = 100000+10;
const int maxm = 2000+10;
const int mod = 1e9+7;
const double eps = 1e-8;
pii a[maxn];
int main() {
#ifdef local
    freopen("in.txt", "r", stdin);
//    freopen("out.txt", "w", stdout);
#endif
    ios::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    int n,m; cin>>n>>m;
    for (int i=0;i<n;i++) cin>>a[i].X>>a[i].Y;
    sort(a,a+n);
    ll ans=0;
    for (int i=0;i<n && m;i++){
        if (a[i].Y<=m){
            m-=a[i].Y;
            ans+=1ll*a[i].X*a[i].Y;
        } else {
            ans+=1ll*a[i].X*m;
            break;
        }
    }
    cout<<ans<<"\n";
    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <iomanip>
#include <cstring>
#include <algorithm> 
#include <math.h>
#include <queue>
#include <functional>
#include <map>
#include <vector>
#include <string>
using namespace std;

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

const ll INF = 1e15;
int dx[4] = { 1,0,-1,0 };
int dy[4] = { 0,1,0,-1 };


vector<int>G[100010];
bool visit[100010];

int main(void) {
	int N, M; cin >> N >> M;
	int red[100010], white[100010];

	for (int i = 0; i < N; i++) {
		if (i == 0) {
			red[i] = 1; white[i] = 0;
		}
		else {
			red[i] = 0; white[i] = 1;
		}
	}
	for (int i = 0; i < M; i++) {
		int x, y; cin >> x >> y;
		x--; y--;

		if (red[x] > 0) {
			red[x]--;
			red[y] += white[y] + 1;
			white[y] = 0;
		}
		else {
			white[x]--;
			if (red[y] > 0)red[y]++;
			else white[y]++;
		}
	}

	int ans = 0;
	for (int i = 0; i < N; i++) if (red[i] > 0)ans++;

	cout << ans << endl;
}


Measured memory_bytes: 3328
#include<bits/stdc++.h>
using namespace std;
string s;
main()
{
    long long i,k;
    while(cin>>s>>k)
    {
        for(i=0;i<s.size();i++) if(s[i]!='1') break;
        k<=i ? printf("1\n") : printf("%c\n",s[i]);
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <map>
#include <set>
#include <queue>
#include <ostream>
#include <istream>
#include <typeinfo>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cassert>
#include <limits>
#include <fstream>
#include <array>
#include <list>
#include <bitset>
#include <functional>
#include <random>
#include <cstring>
#include <chrono>
#include<string>
using namespace std;
#define endl "\n"
#define ll long long int
#define ld long double

#define mx 1000005
#define ASCII 256

ll pos[100001];

void testcases(){
    ll arr[101]={0};
    ll n,a,b,indx=0;
    cin>>n;
    while(n--){
        cin>>a>>b;
        if(a==b){
            arr[indx]=1;
            indx++;
        }
        else{
            indx++;
        }
    }
    ll flag=0;
    for(ll i=0;i<=101-2;i++){
        if(arr[i]==1 && arr[i+1]==1 && arr[i+2]==1){
            flag=1;
        }
    }
    if(flag==1){
        cout<<"Yes";
    }
    else{
        cout<<"No";
    }
}

int main(){
    //boost;


  testcases();
}

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

using namespace std ;

const int MAX = 1e5 + 10 ;

int arr[MAX] ;
int n , k ;

int main()
{
	ios_base::sync_with_stdio(0) ;
	cin.tie(0) ;
	cin>>n>>k ;
	for(int i = 0 ; i < n ; ++i)
		cin>>arr[i] ;
	sort(arr , arr + n) ;
	int ans = 0 ;
	for(int i = 0 ; i < k ; ++i)
		ans += arr[i] ;
	return cout<<ans<<"\n" , 0 ;
}		

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

int main(){

  string str;

  while(cin >> str){
    int len = str.length();
    for(int i=0; i<len; i++){
      if(str[i] != '@'){
        cout << str[i];
      }
      else{
        int n = (int)str[i+1] - '0';
        char c = str[i+2];
        for(int j=0; j<n; j++){
          cout << c;
        }
        i += 2;
      }
    }
    cout << endl;
  }

  return 0;

}

Measured memory_bytes: 1172
#include <iostream>
#include <cmath>

using namespace std;

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

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

    long ans = 10000000000000;
    for(int i=0; i<pow(2,N); i++){
        int max = a[0];
        long t = 0;
        int cnt = 1;
        for(int j=1; j<N; j++){
            if(a[j] > max){
                cnt++;
                max = a[j];
                continue;
            }
            if((i >> j) & 1){
                t += max - a[j] + 1;     
                max = max + 1;
                cnt++;
            }
        }
        if(cnt <K) continue;
        if(t <= ans) ans = t;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
   double w,a,b;
   cin>>w>>a>>b;
   if(w+a< b)
      cout<<b-(a+w);
     else if(a> b+w)
       cout<<a-(b+w);
       else 
           cout<<"0";
       

	 	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
                                        #include<iostream>
                                        #include<cstdio>
                                        #include<vector>
                                        #include<queue>
                                        #include<map>
                                        #include<cstring>
                                        #include<string>
                                        #include <math.h>
                                        #include<algorithm>
                                    //    #include <boost/multiprecision/cpp_int.hpp>
                                        #include<functional>
                                #define int long long
                                        #define inf  1000000007
                                        #define pa pair<int,int>
                                        #define ll long long
                                        #define pal pair<double,pa>
                                        #define ppa pair<int,int>
                                        #define ppap pair<pa,pa>
                                        #define ssa pair<string,int>
                                        #define  mp make_pair
                                        #define  pb push_back
                                        #define EPS (1e-10)
                                        #define equals(a,b) (fabs((a)-(b))<EPS)
                                  #define VI vector<int>
                                        using namespace std;


int gcd(int a,int b){
	if(a<b) return gcd(b,a);
	if(b==0) return a;
	if(a%b==0) return b;
	return gcd(b,a%b);
}
VI sosuu,kosuu;
           signed main(){
               int n;
  cin>>n;
               int nn=n;
               for(int i=2;i<=100000;i++){
                   if(nn%i!=0) continue;
                   int an=0;
                   while(nn%i==0){
                   an++;
                   nn/=i;
                   }
                   sosuu.pb(i);
                   kosuu.pb(an);
               }
               if(nn>1){
                   sosuu.pb(nn);
                   kosuu.pb(1);
                    
                    
               }
               int ans=0;
           	int l=sosuu.size();
           	for(int i=1;i<(1<<l);i++){
           		int c=0;
           		int g=1;
           		for(int j=0;j<l;j++) if(i&(1<<j))c++,g*=sosuu[j];
           		g=n/g;
           		
           		if(c%2==0) g*=-1;
           	//	cout<<g<<endl;
           		ans+=g;
           	}
           	
           	cout<<n-ans<<endl;
           	
           }
             

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

 int power(int x, int y){
    int res = 1;
    while(y > 0){
        if(y % 2 == 1){
            res *= x;
        }
        x *= x;
        y /= 2;
    }

    return res;
 }

int main()
{
    cout << setprecision(15) << fixed;

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

    double ch = 0;
    for(int i = 1; i <= n; ++i){
        double lg = log2(1.0 * k / i);
        lg = (k % i == 0 && lg == (int)lg ? lg : lg + 1);
        ch += 1.0 / n * 1 / power(2, lg);
    }

    cout << ch << "\n";
    return 0;
}


Measured memory_bytes: 384
N=int(input())
S=input()
K=int(input())
n=0
s=list(S)
a=s[K-1]
while True:
    if s[n] is not a:
        s[n]='*'
    n=n+1
    if n==N:
        break
mojiretu=''.join(s)
print(mojiretu)

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

using namespace std;

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

  int n;
  cin >> n;
  vector<int> l(n), r(n);
  map<int, int> mapchik;
  for (int i = 0; i < n; ++i) {
    int a, b;
    cin >> a >> b;
    l[i] = a - b + 1;
    r[i] = a + b;
    mapchik[l[i]] = mapchik[r[i]] = 1;
  }
  int it = 1;
  for (auto& val : mapchik) {
    val.second = it++;
  }
  vector<vector<int>> p(it);
  vector<int> dp(it);
  for (int i = 0; i < n; ++i) {
    l[i] = mapchik[l[i]];
    r[i] = mapchik[r[i]];
    p[l[i]].push_back(r[i]);
  }
  for (int i = 1; i < it; ++i) {
    dp[i] = max(dp[i - 1], dp[i]);
    for (int rr : p[i]) {
      dp[rr] = max(dp[rr], dp[i - 1] + 1);
    }
  }
  cout << dp[it - 1];

  return 0;
}


Measured memory_bytes: 19072