akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)

typedef long long ll;
typedef pair<ll, ll> P;
const ll INF = 1LL<<60;

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

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

ll modpow(ll a, ll n, ll mod) {
  ll res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}

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

  ll a, b, n;
  cin >> a >> b >> n;

  ll val_ = min(n, b-1);

  cout << (a * val_) / b - a * (val_ / b) << endl;
  
  return 0;
}


Measured memory_bytes: 3652
package main

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

func main() {
	s := readString()

	fmt.Println(dfs(0, s))
}

func dfs(sum int, s string) int {
	result := sum
	for i := 1; i < len(s); i++ {
		a, _ := strconv.Atoi(s[0:i])
		result += dfs(sum+a, s[i:])
	}
	a, _ := strconv.Atoi(s)
	return result + a
}

/*-------------------utilities-------------------*/

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

func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}

func max(x, y int) int {
	if x > y {
		return x
	}
	return y
}

func chmin(x *int, y int) bool {
	if *x > y {
		*x = y
		return true
	}
	return false
}

func chmax(x *int, y int) bool {
	if *x < y {
		*x = y
		return true
	}
	return false
}

// 最大公約数
func gcd(a, b int) int {
	if b == 0 {
		return a
	}
	return gcd(b, a%b)
}

// 最小公倍数
func lcm(a, b int) int {
	return (a * b) / gcd(a, b)
}

func comb(n, k int) int {
	if n < k {
		return 0
	}
	if n < 0 || k < 0 {
		return 0
	}
	return fac[n] * (finv[k] * finv[n-k] % MOD) % MOD
}

/*-------------------init-------------------*/

const (
	INF = 1000000000000000000
	MOD = 1e9 + 7

	COMB_MAX = 510000
)

var (
	readString func() string
)

var (
	fac  = [COMB_MAX]int{}
	finv = [COMB_MAX]int{}
	inv  = [COMB_MAX]int{}
)

func init() {
	readString = newReadString(os.Stdin)
}

func combInit() {
	fac[0] = 1
	fac[1] = 1
	finv[0] = 1
	finv[1] = 1
	inv[1] = 1
	for i := 2; i < COMB_MAX; i++ {
		fac[i] = fac[i-1] * i % MOD
		inv[i] = MOD - inv[MOD%i]*(MOD/i)%MOD
		finv[i] = finv[i-1] * inv[i] % MOD
	}
}

/*-------------------inputs-------------------*/

func readi() int {
	return int(readi64())
}

func readi64() int64 {
	i, err := strconv.ParseInt(readString(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readf() float64 {
	f, err := strconv.ParseFloat(readString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

func newReadString(ior io.Reader) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}


Measured memory_bytes: 640
#include<stdio.h>
#include<stdlib.h>
int cmp(const void*a,const void *b)
{
    return *(int*)b-*(int*)a;
}
int main()
{
    int a[10],i;
    for(i=0;i<10;i++)
        scanf("%d",&a[i]);
    qsort(a,10,sizeof(a[0]),cmp);
    printf("%d\n%d\n%d\n",a[0],a[1],a[2]);
    return 0;
}

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

#ifdef LOCAL
#include "../dump.hpp"
#else
#define dump(...)
#define showvv(v)
#endif

using namespace std;

#define rep(i,n) for(int i=0,i##_len=(n);i<i##_len;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define ROF(i,a,b) for(int i=(a)-1;i>=(b);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend() //sortで大きい順
#define UNIQUE(v) v.erase(unique(all(v)),v.end())
#define SUM(a) accumulate(all(a),0)
#define sz(x) ((int)(x).size())
#define pb push_back
#define fst first
#define snd second

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef long long ll;

int main(){
  ll n,d,x; cin >> n >> d >> x;
  vector<ll> a(n); rep(i,n) cin >> a[i];
  ll ans = 0;
  rep(i,n) for(int j = 1; j <= d; j+=a[i]) ans++;
  ans += x;

  cout << ans << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int n, t, c=0;
  scanf("%d", &n);
  t=n;
  while(t>0){
    c+=t%10;
    t/=10;
  }
  if(n%c==0){
    printf("Yes\n");
  }else{
    printf("No\n");
  }
  return 0;
}


Measured memory_bytes: 128
package main

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

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

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
	scanInt := func() int {
		scanner.Scan()
		num, err := strconv.Atoi(scanner.Text())
		if err != nil {
			log.Fatal(err)
		}
		return num
	}
	n := scanInt()
	a, b, c, memo := make([]int, n), make([]int, n), make([]int, n), make([][3]int, n)
	for i := 0; i < n; i++ {
		a[i], b[i], c[i] = scanInt(), scanInt(), scanInt()
	}
	memo[0] = [3]int{a[0], b[0], c[0]}
	for i := 1; i < n; i++ {
		(&memo[i])[0] = max(memo[i-1][1], memo[i-1][2]) + a[i]
		(&memo[i])[1] = max(memo[i-1][0], memo[i-1][2]) + b[i]
		(&memo[i])[2] = max(memo[i-1][0], memo[i-1][1]) + c[i]
	}
	ans := max(max(memo[n-1][0], memo[n-1][1]), memo[n-1][2])
	fmt.Println(ans)
}


Measured memory_bytes: 7040
#include<bits/stdc++.h>
#include<chrono>
 
using namespace std;
using namespace std::chrono;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define F first
#define S second
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define REP(i,a,b) for(i=a;i<=b;i++)
#define RAP(i,a,b) for(i=a;i>=b;i--)
ll mod=1000000007;
const int MX=0x3f3f3f;

int main(){
	IOS;
	char ch;
	cin>>ch;
	ch++;
	cout<<ch;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<cmath>
#define pb push_back
#define ld long double
#define mp make_pair
#define vl vector<ll> 
#define vd vector<double>
#define vld vector<long double>
#define ll long long int
#define pl pair<ll, ll>
#define all(a) a.begin(), a.end()
#define forr(i, n) for(ll i=0; i<n; i++) 
#define forr1(i, n) for(ll i=1; i<=n; i++)
using namespace std;
const ld PI =3.1415926535897923846;
const ll MOD = 1e9+7;
void solve()
{
    ll h1, m1, h2, m2, k;
    cin>>h1>>m1>>h2>>m2>>k;
    while(k>0)
    {
        if(k>=60)
        {
            k-=60;
            h2--;
            continue;
        }
        if(k>m2){
            h2--;
            m2=m2+60-k;
            k=0;
            continue;
        }
        if(k<=m2)
        {
            m2-=k;
            k=0;
            continue;
        }
    }
    if(m2>=m1)
    cout<<(h2-h1)*60+(m2-m1);
    else
    cout<<(h2-h1-1)*60+(m2-m1+60);
}
int main()
{
    ll test=1;
    //cin>>test;
    while(test--)
        solve();
}

Measured memory_bytes: 3648
n,m=map(int,input().split())
nums = list(map(int,input().split()))
nodes = [list(map(int,input().split())) for _ in range(m)]

class UF:
  def __init__(self,size):
    self.table= [-1]*(size+1)
    
  def unite(self,a,b):
    tmp1 = self.search(a)
    tmp2 = self.search(b)
    if tmp1 != tmp2:
      self.table[tmp2] = tmp1 
    
  def search(self,z):
    if self.table[z] < 0:
      return z
    else:
      tmp = z
      while 1:
        if self.table[tmp] < 0:
          self.table[z] = tmp
          return tmp
        tmp = self.table[tmp]

union = UF(n)
for node in nodes:
  union.unite(node[0],node[1])
result = 0
for i in range(n):
  if union.search(nums[i]) == union.search(i+1):
    result += 1
print(result)

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

using namespace std;

#define int long long
#define FOR(i, a, b) for(ll i = (a); i < (b); ++i)
#define FORR(i, a, b) for(ll i = (a); i > (b); --i)
#define REP(i, n) for(ll i = 0; i < (n); ++i)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOREACH(x, a) for(auto &(x) : (a))
#define VECCIN(x)                                                              \
    for(auto &youso_ : (x)) cin >> youso_
#define mp make_pair
#define bitcnt __builtin_popcount
#define SZ(x) ((ll)(x).size())
#define All(a) (a).begin(), (a).end()
template <typename T = long long> inline T IN() {
    T x;
    cin >> x;
    return (x);
}
inline void CIN() {}
template <class Head, class... Tail>
inline void CIN(Head &&head, Tail &&... tail) {
    cin >> head;
    CIN(move(tail)...);
}
#define CINT(...)                                                              \
    int __VA_ARGS__;                                                           \
    CIN(__VA_ARGS__)
#define LCIN(...)                                                              \
    ll __VA_ARGS__;                                                            \
    CIN(__VA_ARGS__)
#define SCIN(...)                                                              \
    string __VA_ARGS__;                                                        \
    CIN(__VA_ARGS__)
#define Yes(a) cout << (a ? "Yes" : "No") << "\n"
#define YES(a) cout << (a ? "YES" : "NO") << "\n"
#define Printv(v)                                                              \
    {                                                                          \
        FOREACH(x, v) { cout << x << " "; }                                    \
        cout << "\n";                                                          \
    }
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
    std::fill((T *)array, (T *)(array + N), val);
}

typedef long long ll;
typedef unsigned long long ul;
typedef vector<ll> VL;
typedef pair<ll, ll> PL;
typedef priority_queue<ll> PQ;
typedef priority_queue<ll, VL, greater<ll>> PQG;

const int INF = 1e9;
const int MOD = 1e9 + 7;
// const int MOD = 998244353;
const ll LINF = 1e18 + 1;
const ll dx[] = {1, -1, 0, 0};
const ll dy[] = {0, 0, 1, -1};

ll N, M;
string s;
vector<VL> G;
vector<map<char, ll>> cnt;

signed main() {
    cin >> N >> M >> s;
    G.resize(N);
    REP(i, M) {
        LCIN(a, b);
        G[--a].emplace_back(--b);
        if(a != b) G[b].emplace_back(a);
    }
    REP(i, N) sort(All(G[i]));
    set<ll> bad;
    cnt.resize(N);
    REP(i, N) {
        FOREACH(to, G[i]) { cnt[i][s[to]]++; }
        if(cnt[i]['A'] == 0 || cnt[i]['B'] == 0) bad.insert(i);
    }
    ll rem = N;
    while(!bad.empty()) {
        ll now = *bad.begin();
        bad.erase(bad.begin());
        rem--;
        FOREACH(to, G[now]) {
            if(to != now) {
                G[to].erase(lower_bound(All(G[to]), now));
                cnt[to][s[now]]--;
                if(cnt[to]['A'] == 0 || cnt[to]['B'] == 0) bad.insert(to);
            }
        }
    }
    Yes(rem);
}

Measured memory_bytes: 48004
#![allow(unused_imports)]

use std::{i32, i64, u32, u64, usize, f64};
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::io::{stdout, Write, BufWriter};
use std::mem::{swap};
use maplit::*;
use proconio::marker::{Isize1, Usize1, Bytes, Chars};

#[proconio::fastout]
fn main() {
    proconio::input!(
        n: usize,
        arr: [i64; n],
    );
    let mut counter = HashMap::new();
    for a in arr { *counter.entry(a).or_insert(0) += 1; }
    let mut ans = 0;
    for (k, n) in counter {
        if k <= n { ans += n - k; }
        else { ans += n; }
    }
    println!("{}", ans);
}


Measured memory_bytes: 7096
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin>>s;
  if(s=="Sunny"){
    cout<<"Cloudy"<<endl;
  }else if(s=="Cloudy"){
    cout<<"Rainy"<<endl;
  }else{
    cout<<"Sunny"<<endl;
  }
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <list>
#include <queue>
#include <deque>
#include <algorithm>
#include <numeric>
#include <utility>
#include <complex>
#include <functional>
#include <climits>

using namespace std;

int main() {
    int t, x;
    cin >> t >> x;
    cout << t/(double)x << endl;
}


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

int cnt_digits(long long n){
    int cnt=0;

    while(n!=0){
        cnt++;
        n/=10;
    }
    return cnt;
}

int main() {
    long long n;
    cin >> n;
    int ans=cnt_digits(n);

    for (long long i = 1; i*i <= n ; ++i){
        if(n%i!=0)continue;
        const long long b=n/i;

        const int current=max(cnt_digits(i),cnt_digits(b));
        if(ans>current)
            ans=current;
    }

    cout << ans << endl;
}


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

typedef long long int   ll;
#define int             ll
#define FIO             ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define endl            "\n"
#define scan(n)         scanf("%lld",&n)
#define pb              push_back
#define PI              3.1415926535897932384626433832795
#define rep0            for(int i=0;i<n;i++)
#define rep1            for(int i=1;i<=n;i++)
#define inputar0(ar)    for(int i=0;i<n;i++)cin>>ar[i]
#define inputar1(ar)    for(int i=1;i<=n;i++)cin>>ar[i]
#define showar0(ar)     for(int i=0;i<n;i++)cout<<ar[i]<<" "
#define showar1(ar)     for(int i=1;i<=n;i++)cout<<ar[i]<<" "
int mod=1000000007;
int maxn=200001;
int binpow(int a,int b,int mod){int res=1;while(b>0){if(b%2){res=(res*a)%mod;b--;}a=(a*a)%mod;b/=2;}return res%mod;}
int binpow(int a,int b){int res=1;while(b>0){if(b%2){res=(res*a);b--;}a=(a*a);b/=2;}return res;}
bool isPrime(int n){if(n==1)return false;for(int i=2;i*i<=n;i++){if(n%i==0)return false;}return true;}

signed main(){
    int t=1;
//    scan(t);
    while(t--){
        int n;cin>>n;
        map<string,int> mp;
        mp["AC"]=0;
        mp["WA"]=0;
        mp["TLE"]=0;
        mp["RE"]=0;
        for(int i=0;i<n;i++){
            string x;cin>>x;
            mp[x]++;
        }
        cout<<"AC x "<<mp["AC"]<<endl;
        cout<<"WA x "<<mp["WA"]<<endl;
        cout<<"TLE x "<<mp["TLE"]<<endl;
        cout<<"RE x "<<mp["RE"]<<endl;
    }
}


Measured memory_bytes: 3640
var
n,i:Longint;
A,B:Array[1..10000]of Longint;
cnt,x,y:int64;
begin
read(n);
for i:=1 to n do read(A[i]);
for i:=1 to n do read(B[i]);
for i:=1 to n do inc(cnt,B[i]-A[i]);
for i:=1 to n do begin
if A[i]>B[i]then inc(x,A[i]-B[i])else inc(y,(B[i]-A[i]+1)div 2);
end;
if(x>cnt)or(y>cnt)then writeln('No')else writeln('Yes');
end.

Measured memory_bytes: 128
from fractions import Fraction
from math import log, ceil
import heapq

(n, m), aa = [list(map(int, s.split())) for s in open(0)]
aa = [-Fraction(a) for a in aa]

heapq.heapify(aa)

while m:
    m1 = heapq.heappop(aa)
#     print(f'{m=},{m1=}')
    if len(aa):
        m2 = aa[0]
        use = min(max(ceil(log(m1/m2)/log(2)), 1), m)
#         print(f'{m2=},{use=}')
    else:
        use = min(max(ceil(log(-m1)/log(2)), 1), m)
#         print(f'else, {use=}')
#         print(f'{ceil(log(-m1)/log(2))=}')
#     print(f'{m1/Fraction(2**use)}')
    heapq.heappush(aa, m1 / Fraction(2**use))
    m -= use
    if -(aa[0]) < 1:
        break

aa = [int(-a) for a in aa]

print(sum(aa))

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

int main(void) {
	int a, b;
	cin >> a >> b;
	int ans = max((a * b), max((a+b), (a-b)));
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <math.h>
#include <regex>
#include "bits/stdc++.h"
#define FOR(i, s, e) for (int i = int(s); i < int(e); ++i)
#define REP(i, e) FOR(i, 0, e)
#define INF (INT_MAX / 2)
#define LINF (LLONG_MAX / 2)
#define EPS (1.0e-8)
const int MGN = 10;
const int ARY_SZ_MAX = (int)1e7;
using namespace std;
using ll = long long; using ull = unsigned long long;
using vi = vector<int>; using vvi = vector<vi>;
using vb = vector<bool>; using vvb = vector<vb>;
using vl = vector<ll>; using vvl = vector<vl>;
using vd = vector<double>; using vs = vector<string>;
using pii = pair<int, int>; using pll = pair<ll, ll>; using psl = pair<string, ll>;

vvi eg;
map<pii, int> col;

void dfs(int x, int px=-1, int pcl=-1) { // 頂点位置、直前の頂点位置、直前の辺の色 
  // 頂点に入る時の処理
  int cl = 1;
  for(int nx : eg[x]) {
    if (nx == px) continue;
    if (cl == pcl) cl++;
    // 辺に対する処理
    col[pii(x,nx)] = cl;
    col[pii(nx,x)] = cl;
    cl++;
    // 辺を通って頂点間を移動
    dfs(nx, x, col[pii(x,nx)]);
  }
  // 頂点を出るときの処理
}


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

  int N; cin>>N;
  vi A(N-1),B(N-1);
  REP(i,N-1) {
    cin>>A[i]>>B[i];
    A[i]--;B[i]--;
  }

  eg = vvi(N);
  vector<pii> vec;
  REP(i,N-1) {
    eg[A[i]].push_back(B[i]);
    eg[B[i]].push_back(A[i]);
    col[pii(A[i],B[i])] = -1;
    col[pii(B[i],A[i])] = -1;
    vec.push_back(pii(A[i],B[i]));
  }

  dfs(0);

  int colMax = 0;
  REP(i,N) colMax = max(colMax, (int)(eg[i].size()));
  cout << colMax << endl;  
  for(pii v : vec) cout << col[v] << endl;  

  return 0;
}


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

typedef long long ll;
typedef unsigned long long ull;
//typedef long double ld;

typedef map<int, int> mii;
typedef pair<int, int> pii;
typedef pair<double,double> pdd;
typedef set<int> si;
typedef set<ll> sll;
typedef vector<int> vi;
typedef vector<pair<int, int > > vii;
typedef vector<ll> vll;
typedef vector<double> vd;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
typedef vector<vll> vvll;

constexpr ll MOD = 1e9+7;
constexpr int INF = 1<<30;
constexpr ll  LINF = 1LL<<60;

#define Sort(x) sort(x.begin(),x.end())
#define Reverse(x) reverse(x.begin(),x.end())
#define ABS(a,b) ((a)<(b)?(b)-(a):(a)-(b))
#define bit(n) (1ll<<(n))

// sort(begin(x), end(x), greater<ll>());
// lower_bound(a.begin(), a.end(), val): a[i] ≥ valである最左の位置
// upper_bound(a.begin(), a.end(), val): a[i] > valである最左の位置

// Returns minimum of a and b.
// If a is less b, a is set to b.
template<typename T>
T chmin(T& a, T b) {
  if (a > b) {
    a = b;
  }
  return a;
}

// Returns maximum of a and b.
// If a is less b, a is set to b.
template<typename T>
T chmax(T& a, T b) {
  if (a < b) {
    a = b;
  }
  return a;
}

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

template <typename T>
void dumpContents(const T& v, const string& msg)
{
  cerr << "### " << msg << " ###\n";
  for (const auto& x : v) {
    cerr << x << " ";
  }
  cerr << endl;
}

struct before_main_function {
  before_main_function() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<setprecision(20)<<fixed;
    #define endl "\n"
  }
} before_main_function;

// ========== end of template ==========
int N, K;
string S;

// advance i to next 111(1)0
// return 1 if end
int advance(int& i) {
  while (true) {
    if (i>=N-1) {
      i = N-1;
      return 1;
    }

    if (S[i] == '1' && S[i+1] == '0') {
      return 0;
    }

    i++;
  }

  return 1;
}

int advance01(int& i) {
  while (true) {
    if (i>=N-1) {
      i = N-1;
      return 1;
    }

    if (S[i-1] == '0' && S[i] == '1') {
      return 0;
    }

    i++;
  }

  return 1;
}

int main(int argc, char** argv) {
  cin >> N >> K;
  cin >> S;

  int i=0;
  int j=0;
  while (j<N && S[j] == '1') {
    j++;
  }

    //cerr << "foo " << j << endl;
  for (int k=0; k<K; k++) {
    j++; advance(j);
    //cerr << "hoge " << j << endl;
  }

  int ret = j-i+1;

  //cerr << "i,j: " << i << ", " << j << " ret " << ret << endl;

  while(i<j) {
    j++; advance(j);
    i++; advance01(i);
    chmax(ret, j-i+1);
    //cerr << "while i,j: " << i << ", " << j << " ret " << ret << endl;
  }

  cout << ret << endl;

  return 0;
}


Measured memory_bytes: 512
import itertools
import math



def do():
    S = input()
    T = input()
    s = len(S)
    t = len(T)
    flag = False
    for i in range(s-t,-1,-1):
        if S[i] == "?" or S[i] ==T[0]:
            flag = True
            for j in range(t):
                if T[j] == S[i+j] or S[i+j] == "?":
                    pass
                else:
                    flag = False
        if flag:
            break
    if flag:
        ans = list(S)
        for k in range(i,i+t):
            ans[k] = T[k-i]
        for i,temp in enumerate(ans):
            if temp == "?":
                ans[i] = "a"
        print("".join(ans))
    else:
        print("UNRESTORABLE")





if __name__ == "__main__":
    do()

Measured memory_bytes: 3064
macro_rules! input {
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = || -> String {
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}
 
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};
 
    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
    
    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}
 
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };
 
    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

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

#[allow(dead_code)]
fn read_line() -> String {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

fn main() {
    input!{a: usize, b: usize}
    for i in 1..4 {
        if a*b*i % 2 == 1 { println!("Yes"); return }
    }
    println!("No");
}

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


/*
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <ctype.h>
*/



using namespace std;

typedef pair<int , int > pii;
typedef pair<long , long> pll;
typedef pair<pii , int > piii;
typedef pair<pll , long > plll;
typedef vector<int> vi;
typedef vector<long> vl;
typedef vector <pii> vii;
typedef vector<pll> vll;
typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
typedef unsigned long long int ulli;
typedef long long int lli;
typedef float f;
typedef char ch;
typedef pair<int,ll> pill;

#define loop(n) for(int i = 0; i < (n); i++)
#define lp(x , s , e) for(int x = (s); x < (e); x++)
#define lpe(x , s , e) for(int x = (s); x <= (e); x++)
#define readline(s) getline(cin,s)
#define NumofDigits(n) ((int)log10(n)+1)
#define CountofNumber(array,n,x)  (upper_bound(array, array+n, x)-lower_bound(array, array+n, x))
#define F first
#define S second
#define EPS 1e-7
#define modulo ll (1e9 + 7)
const long double PI = 3.141592653589793238L;
#define MP make_pair
#define PB push_back
#define all(a) a.begin(),a.end()
#define clr(x , val) memset((x) , (val) , sizeof(x))
#define Unique(n)   (n).erase(unique(all(n)), (n).end())
#define endl '\n'

ll power(ll a, ll b)
{
    ll res = 1;
    for(int i = 0; i<b; i++)
       res *= a;

    return res;
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int n , ac = 0 , wa = 0 , tle = 0 , re = 0;
    string temp;
    cin >> n;
    while (n--)
    {
    	cin >> temp;
    	if (temp == "AC")
    		ac++;
    	else if (temp == "WA")
    		wa++;
    	else if (temp == "TLE")
    		tle++;
    	else
    		re++;
    }
    cout << "AC x " << ac << endl;
    cout << "WA x " << wa << endl;
    cout << "TLE x " << tle << endl;
    cout << "RE x " << re << endl;
	return 0;
}


Measured memory_bytes: 3676
#include<cstdio>
#include<algorithm>

using namespace std;

int main(){
    int n, k;
    scanf("%d %d", &n, &k);
    long int h[n];
    for(int i = 0; i < n; i++){
        scanf("%ld", &h[i]);
    }
    
    sort(h, h + n);
    long int ans = 0;
    for(int i = n - 1; i >= 0; i--){
        if (n - i > k) ans += h[i];
    }
    printf("%ld\n", ans);
}

Measured memory_bytes: 1664
#include <iostream>
#include <cstdio>
#include <vector>
#include <queue>
#include <string>
#include <cmath>
#include <algorithm>

using namespace std;

#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define BIT(X, i) ((X>>i)&1)
#define REP(i, a, b) for(int i = (a); i < (b); ++i)
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(a) (a).begin(), (a).end()
#define r_all(a) (a).rbegin(), (a).rend()
#define in(x) cin>>x
#define ina(x, n) rep(x_i,n) cin>>x[x_i]
#define outa(x, n) rep(x_i,n) cout<<x[x_i]<<" \n"[x_i==n-1]

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll, ll> pll;
typedef vector<pll> vll;
typedef priority_queue<ll> pq;

const int MOD = 1e9+7;
const int INF = (1<<30);
const ll INFL = (1L<<62);

int main() {
  int a; cin >> a;
  string s; cin >> s;
  if (a >= 3200) cout << s << endl;
  else cout << "red" << endl;
  return 0;
}


Measured memory_bytes: 768
#include<iostream>
#include<cstring>
#include<cstdio>
using namespace std;
int main()
{
	char str[1001][1001] ;
	int j = 0;
	for ( int i = 0; i < 1000; i++ )
	{
		 cin >> str[i];
		if ( str[i][0] == '0' )
		{
			break;
		}
		else
		{
			j++;
		}
	}
    
	for ( int i = 0; i < j; i++ )
	{
	int sum = 0;
	for ( int k = 0; k < strlen(str[i]); k++ )
	{
    sum += (str[i][k] - '0');
	}
		cout << sum << '\n';
	}
	return 0;
}


Measured memory_bytes: 3136
#include <cstdio>
#include <iostream>
#include <array>
#include <vector>
#include <algorithm>
#include <functional>
#include <tuple>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <queue>
#include <utility>
#include <memory>
#include <valarray>
#include <climits>

using namespace std;

using ll = long long int;

#define loop(i, N) for (int i = 0; i < N; ++i)
#define scanInt(x) int x; scanf("%d", &x); getchar();
#define scanLLInt(x) ll x; scanf("%lld", &x); getchar();
#define scanVecInt(A, N) vector<int> A(N); loop(i, N){scanf("%d", &(A[i])); getchar();}
#define scanVecLLInt(A, N) vector<ll> A(N); loop(i, N){scanf("%lld", &(A[i])); getchar();}

ll mergeCount(vector<pair<ll, ll>>& A, ll l, ll c, ll r)
{
    ll count = 0;
    vector<pair<ll, ll>> B(r - l + 1);
    ll j = 0;
    ll i1 = l;
    ll i2 = c + 1;
    while (i1 <= c || i2 <= r){
        if (r < i2 || (i1 <= c && A[i1].second <= A[i2].second)){
            B[j].second = A[i1].second;
            ++i1;
        }else{ // i2 <= r && (c < i1 || A[i2].second < A[i1].second)
            count += c - i1 + 1;
            B[j].second = A[i2].second;
            ++i2;
        }
        ++j;
    }
    for (ll j = 0; j < B.size(); ++j){
        A[l + j].second = B[j].second;
    }
    return count;
}

ll mcount(vector<pair<ll, ll>>& A, ll l, ll r)
{
    if (r <= l) return 0;
    const ll c = l + (r - l) / 2;
    return mcount(A, l, c) + mcount(A, c + 1, r) + mergeCount(A, l, c, r);
}

int main()
{
    scanLLInt(N);
    scanLLInt(K);
    scanVecLLInt(A, N);
    loop(i, N){
        A[i] -= K;
        // printf("%lld ", A[i]);
    }
    // puts("");
    vector<pair<ll, ll>> Asum(A.size() + 1, make_pair(0, 0));
    loop(i, N){
        Asum[i + 1].first = Asum[i].first + A[i];
        Asum[i + 1].second = i + 1;
    }
    sort(Asum.begin(), Asum.end(), [](const pair<ll, ll>& l, const pair<ll, ll>& r){
            if (l.first < r.first){
                return true;
            }else if (l.first > r.first){
                return false;
            }else if (l.second < r.second){
                return true;
            }else{
                return false;
            }
        });
    printf("%lld\n", N * (N + 1) / 2 - mcount(Asum, 0, Asum.size() - 1));
}


Measured memory_bytes: 9608
#include<iostream>
#include<iomanip>
#include<cassert>
#include<math.h>
#include<complex>
#include<algorithm>
#include<utility>
#include<queue>
#include<string.h>
#include<string>
#include<set>
#include<map>
#include<unordered_map>
#include<functional>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll INF=2e18;
const ll MOD=1e9+7;

ll N;
string S[1000001];
int main(){
    cin>>N;
    for(ll i=0;i<N;i++)cin>>S[i];
    ll lSum=0,rSum=0;
    ll L=0,R=0;
    ll minR=INF,minL=INF;
    for(ll i=0;i<N;i++){
        ll l=0,r=0;
        for(auto c:S[i]){
            if(c=='('){
                l++;
            }else{
                if(l>0)l--;
                else r++;
            }
        }
        if(l==0&&r==0)continue;
        if(l==0){
            L+=r;
        }
        else if(r==0){
            R+=l;
        }else{
            lSum+=l;rSum+=r;
            minR=min(minR,r);
            minL=min(minL,l);
        }
    }
    if(minR==INF)minR=0;
    if(minL==INF)minL=0;
    if(lSum>rSum){
        if(R>=minR && L>=lSum-(rSum-minR) && L-(lSum-(rSum-minR))==R-minR){
            cout<<"Yes";
        }else{
            cout<<"No";
        }
    }else{
        if(L>=minL && R>=rSum-(lSum-minL) && L-minL==R-(rSum-(lSum-minL))){
            cout<<"Yes";
        }else{
            cout<<"No";
        }
    }
    return 0;
}

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

int f(int x) {
  int dig, sum;
  while(x){
    dig = x % 10;
    sum += dig;
    x /= 10;
  }
  return sum;
}

int main() {
  int N, dig, sum;
  cin >> N;

  sum = f(N);
  
  if ( N % sum == 0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}


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

typedef long long ll;
typedef unsigned long long ull;
//typedef long double ld;

typedef map<int, int> mii;
typedef pair<int, int> pii;
typedef pair<double,double> pdd;
typedef set<int> si;
typedef set<ll> sll;
typedef vector<int> vi;
typedef vector<pair<int, int > > vii;
typedef vector<ll> vll;
typedef vector<double> vd;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
typedef vector<vll> vvll;

constexpr ll MOD = 1e9+7;
constexpr int INF = 1<<30;
constexpr ll  LINF = 1LL<<60;

#define Sort(x) sort(x.begin(),x.end())
#define Reverse(x) reverse(x.begin(),x.end())
#define ABS(a,b) ((a)<(b)?(b)-(a):(a)-(b))
#define nbit(n) (1ll<<(n))

// sort(begin(x), end(x), greater<ll>());
// lower_bound(a.begin(), a.end(), val): a[i] ≥ valである最左の位置
// upper_bound(a.begin(), a.end(), val): a[i] > valである最左の位置

// Returns minimum of a and b.
// If a is less b, a is set to b.
template<typename T>
T chmin(T& a, T b) {
  if (a > b) {
    a = b;
  }
  return a;
}

// Returns maximum of a and b.
// If a is less b, a is set to b.
template<typename T>
T chmax(T& a, T b) {
  if (a < b) {
    a = b;
  }
  return a;
}

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

template <typename T>
void dumpContents(const T& v, const string& msg)
{
  cerr << "### " << msg << " ###\n";
  for (const auto& x : v) {
    cerr << x << " ";
  }
  cerr << endl;
}

struct before_main_function {
  before_main_function() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<setprecision(20)<<fixed;
    #define endl "\n"
  }
} before_main_function;

// ========== end of template ==========
struct Node {
  int cparent;
  int cself;
  int cothers;

  Node()
    : cparent(0), cself(0), cothers(0)
  {}

  int count() const {
    return cparent + cself + cothers;
  }
};

constexpr int N_MAX = 1e5;
int N, K;

vector<Node> nodes(N_MAX);

vvi tree(N_MAX);

ll dfs(int pi, int ui, ll& ret) {
  Node& u = nodes[ui];

  if (pi >= 0) {
    // not the root node
    u.cparent = 1;
    ll x = nodes[pi].count();
    ret = ret*(K-x)%MOD;
//cerr << ui << ": x " << x << ", ret " << ret << endl;
  }

  for (auto vi : tree[ui]) {
    Node& v = nodes[vi];
    if (v.cself) continue;

    v.cself = 1;
    dfs(ui, vi, ret);
    u.cothers++;
  }

  return 0;
}

int main(int argc, char** argv) {
  cin >> N >> K;

  for (int i=0; i<N-1; i++) {
    int a, b;
    cin >> a >> b;
    a--; b--; // to 0-indexed
    tree[a].push_back(b);
    tree[b].push_back(a);
  }

  ll ret = K;
  nodes[0].cself = 1;
  dfs(-1, 0, ret);
  cout << ret << endl;

  return 0;
}


Measured memory_bytes: 10368
#include<stdio.h>
int main(){
	long long n,k,a,b,x,y,z;
	while(scanf("%lld %lld",&n,&k)!=EOF){
		if(n<k){a=n;b=k;}
		else{a=k;b=n;}
		x=b%a;
		while(x!=0){
			b=a;
			a=x;
			x=b%a;
		}
		x=a;
		printf("%lld %lld\n",x,n*k/x);
	}
	return 0;
}



Measured memory_bytes: 2080
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); i++)
#define RREP(i, s, n) for (int i = s; i < (n); i++)
#define ALL(a) a.begin(), a.end()
#define RALL(a) a.rbegin(), a.rend()
using namespace std;
using ll = long long;
typedef pair<int, int> pint;
typedef pair<ll, ll> pll;
const ll MOD = 1000000007;
const ll INF = MOD * MOD;
const int inf = (1<<29);

int main() {

    int N;
    cin >> N;

    string S;
    cin >> S;

    int ans = N;
    for(int i = 1; i < N; i++) {
        if (S[i] == S[i-1]) ans --;
    }

    cout << ans << endl;
    


    return 0;
}

Measured memory_bytes: 512
import java.io.*;
import java.util.ArrayList;
import java.util.List;
 
  
  
  
public class Main {
     
    private static List<String> base = new ArrayList<String>();
    private static int inningScore; 
    private static List<Integer> finalScore = new ArrayList<Integer>();  
    public static void main(String[] args) {
         
        try {
            
        	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  
            String str;
            int round = Integer.parseInt(br.readLine());             
           
            /*????????\???????????°???????????????????????????*/
            for(int i = 0; i<round; i++)
            {
            /*round??????????????¨(????????????)?????¢?????????????????????inningScore,base??????????????????*/
            	int out = 0;
                inningScore = 0;
                base.clear();
                
               /*??¢?????????????????????3???????????¨???inning??????????????????*/
                while(out<3)
                {
                 
                str = br.readLine();
                
                if(str.equals("HIT"))
                {
                     
                    calHit();
                     
                }
                 
                if(str.equals("HOMERUN"))
                {
                     
                    calHomerun();
                     
                }
                 
                if(str.equals("OUT"))
                {
                    out++;
     
                }
                
            }
                /*????????£???round???inningScore???finalScore??????????????????(???????????????????????????)*/
                finalScore.add(inningScore);
           }
             for(int i = 0; i<finalScore.size(); i++)
             {
            	 System.out.println(finalScore.get(i));
             }
            
        }catch (Exception e) {
            e.printStackTrace();
        }
         
    }
    
    /*HIT?????´???,base???Runner?????°????????£?????????????¨??????????*/
    
    private static void calHit() {
       
    	/*??????(base.size()==3)????????£??????????????????HIT???????????¨???base???Runner???????????????*/
       if(base.size()==0 || base.size()==1 || base.size()==2)
       {
          base.add("Runner");
       }
       
       /*???????????????HIT???????????¨???inningScore???1????????????*/
       else if(base.size()==3)
       {
         inningScore++;
       }
        
    }
    /*HOMERUN?????´???*/
    private static void calHomerun() {
         
    	/*?????¨???inningScore???(Runner?????°+1)????¶?????????????base??????????????????*/
         inningScore = inningScore+base.size()+1;
         base.clear();
          
   }
}

Measured memory_bytes: 24032
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <queue>

typedef long long int lld;
typedef unsigned long long int ulld;
const int mod = 1000000007;

using namespace std;

int h, w;
char map[24][24];
char used[24][24];

int GoTo (int t, int l, int f) {
	if (!map[t][l] || used[t][l]) return -1;
	int pos = (t << 20) + (l << 10) + f;
	used[t][l] = 1;
	return pos;
}

int FindRode (int t, int l) {
	if (!map[t][l]) return -1; //Wall
	memset (used, 0, sizeof (used));
	queue<int> q;
	int pos = GoTo(t, l, 0), f = 0, nf, nt, nl;
	q.push (pos);

	while (!q.empty()) {
		pos = q.front();
		q.pop();
		nt = pos >> 20;
		nl = (pos >> 10) % 1024;
		nf = pos % 1024;
		if (nf > f) f = nf;
		nf ++;
		int tmp;
		tmp = GoTo(nt - 1, nl, nf); if (tmp > 0) q.push(tmp);
		tmp = GoTo(nt + 1, nl, nf); if (tmp > 0) q.push(tmp);
		tmp = GoTo(nt, nl - 1, nf); if (tmp > 0) q.push(tmp);
		tmp = GoTo(nt, nl + 1, nf); if (tmp > 0) q.push(tmp);
	}

	return f;
}

int main (void) {
	ios::sync_with_stdio (false);
	cin >> h >> w;
	memset (map[0], 0, sizeof (map[0]));
	for (int nh = 1; nh <= h; nh ++) {
		map[nh][0] = 0;
		for (int nw = 1; nw <= w; nw ++) {
			char c;
			cin >> c;
			if (c == '.') map[nh][nw] = 1;
			else map[nh][nw] = 0;
		}
		map[nh][w + 1] = 0;
	}
	memset (map[h + 1], 0, sizeof (map[0]));

	int max = 0;
	for (int t = 1; t <= h; t ++) {
		for (int l = 1; l <= w; l ++) {
			int tmp = FindRode(t, l);
			// cout << "  " << t << ", " << l << " : " << tmp << endl;
			if (tmp > max) max = tmp;
		}
	}
	cout << max << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
int n,m,f[110][110];
char a[110][110];
int main(){
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++)
		for(int j=1;j<=m;j++)
			scanf(" %c",a[i]+j);
	memset(f,0x3f,sizeof f);
	f[1][1]=a[1][1]!='.';
	for(int i=1;i<=n;i++)
		for(int j=1+(i==1);j<=m;j++)
			f[i][j]=min(f[i][j-1]+(a[i][j]=='#'&&a[i][j-1]=='.'),f[i-1][j]+(a[i][j]=='#'&&a[i-1][j]=='.'));
	printf("%d\n",f[n][m]);
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<math.h>
#include<algorithm>
#include<utility>
#include<functional>
#include<queue>
#include<string.h>
#include<string>
#include<set>
#include<map>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll INF=2e18;

ll N,M,K;
ll a,b,c,d;
string s;
ll n[11];
bool f[11][11]={};
ll cnt=0;
int main(){
    cin>>n[0]>>n[1]>>n[2];
    sort(n,n+3);
    if(n[0]==5 && n[1]==5 && n[2]==7){
        cout<<"YES"<<endl;
    }else{
        cout<<"NO"<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define MAX 1e9
#define MIN -1e9
#define MOD 1000000007
#define mod2 20071027
//#define mod 1000074259
#define base 139
#define base2 31
#define memz(a) memset(a, 0, sizeof(a))
#define memn(a) memset(a, -1, sizeof(a))
#define in1(a) scanf("%lld", &a)
#define in2(a, b) scanf("%lld%lld", &a, &b)
#define TC(c) printf("Case %d: ", ++c)
#define FAST ios_base::sync_with_stdio(false); cin.tie(NULL);
using namespace std;
const ll N=300010;
map<ll, ll>mp, val;
map<ll, bool>vis;
ll res, n, d, a;
priority_queue<ll>pq;

int main()
{
    in2(n, d);
    in1(a);
    for(int i=0; i<n; i++)
    {
        ll x, h;
        in2(x, h);
        val[x]=h;
        vis[x]=1;
        pq.push(-x);
    }
    ll cnt=0;
    while(!pq.empty())
    {
        ll u = -pq.top();
        pq.pop();
        cnt+=mp[u];
        val[u]+=cnt;
//        cout<<"u "<<u<<" "<<val[u]<<endl;
        if(val[u]>0)
        {
            ll x = u+d, y=x+d+1;
//            cout<<"x "<<x<<endl;
            ll c = (val[u]/a);
            if(val[u]%a)
                c++;
            res+=c;
            cnt-=(c*a);
            mp[y]+=c*a;
            if(vis[y]==0)
            {
                pq.push(-y);
                vis[y]=1;
            }
        }
    }
    printf("%lld\n", res);
    return 0;
}

/*

*/


Measured memory_bytes: 76784
//ritik_patel05

//&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& STL DEBUGGER &&&&&&&&&&&&&&&&&&&&&&&&&&&

// #define _GLIBCXX_DEBUG       // Iterator safety; out-of-bounds access for Containers, etc.
// #pragma GCC optimize "trapv" // abort() on (signed) integer overflow.

//&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& LIBRARIES &&&&&&&&&&&&&&&&&&&&&&&&&&&

#include <bits/stdc++.h>
using namespace std;

/*#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
template<typename T, typename V = __gnu_pbds::null_type>
using ordered_set = __gnu_pbds::tree<T, V, less<T>, __gnu_pbds::rb_tree_tag, __gnu_pbds::tree_order_statistics_node_update>; 
*/
//find_by_order()->returns an iterator to the k-th largest element(0-based indexing)
//order_of_key()->Number of items that are strictly smaller than our item

//&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& DEFINES &&&&&&&&&&&&&&&&&&&&&&&&&&&

#define int long long int
#define all(i) i.begin(), i.end()
#define sz(a) (int)a.size()
 
// const ld PI  = 3.141592;
const int dx4[4] = {0, 1, 0, -1};
const int dy4[4] = {-1, 0, 1, 0};
const int dx8[8] = {-1, -1, -1, 0, 1, 1, 1, 0};
const int dy8[8] = {-1, 0, 1, 1, 1, 0, -1, -1};
 
//&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& DEBUG &&&&&&&&&&&&&&&&&&&&&&&&&&&
 
#define XOX
vector<string> vec_splitter(string s) {
    for(char& c: s) c = c == ','?  ' ': c;
    stringstream ss; ss << s;
    vector<string> res;
    for(string z; ss >> z; res.push_back(z));
    return res;
}
 
void debug_out(vector<string> __attribute__ ((unused)) args, __attribute__ ((unused)) int idx) { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, Head H, Tail... T) {
    if(idx > 0) cerr << ", ";
    stringstream ss; ss << H;
    cerr << args[idx] << " = " << ss.str();
    debug_out(args, idx + 1, T...);
}
 
#ifdef XOX
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __VA_ARGS__)
#else
#define debug(...) 42
#endif
 
 
//&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& CODE &&&&&&&&&&&&&&&&&&&&&&&&&&&

void solve(){
    int a[5];
    for(int i = 0; i < 5; ++i){
        cin >> a[i];
        if(a[i] != (i + 1)){
            cout << i + 1 <<  "\n";
            return; 
        }
    }
}


int32_t main(){
    ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr); 
    int T = 1; 
    // cin >> T;
    for(int i = 1; i <= T; ++i){
        // brute();
        solve();
    }
    return 0;
}

/*
Sample inp
*/

Measured memory_bytes: 3620
fun main(args: Array<String>) {
    val N = readLine()?.toInt() ?: 0
    val steps
            = readLine()!!.split(" ").map(String::toInt)
    val dp = listOf(0).toMutableList()
    for ((i, v) in steps.withIndex()) {
        if (i < 1) {
            continue
        }
        val oneStepCost = (Math.abs(v - steps[i-1]) + dp[i - 1])
        val twoStepCost =
            if (i < 2) Int.MAX_VALUE else (Math.abs(v - steps[i-2]) + dp[i - 2])

        val bestMove =
            if (oneStepCost < twoStepCost) oneStepCost else twoStepCost
        dp.add(bestMove)
    }
    println(dp.last())
}

Measured memory_bytes: 49564
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
using namespace std;
int main()
{
    string s;
    cin>>s;
    int x=0;
    for(int i=0;i<s.size();i++)
    {
        if(s[i]=='o')
        {
                x++;
        }
    }
    cout<<700+x*100;          
    return 0;
}
    

Measured memory_bytes: 256
#include <iostream>
#include <string>

using namespace std;

int main() {
	string s;
	cin >> s;

	int num = 0;
	for (int i = 0; i < 6; ++i) {
		if (s[i] == '1') {
			num = num + 1;
		}
	}
	cout << num << endl;
}

Measured memory_bytes: 256
using System;
using System.Linq;

public class Hello
{
    public static void Main()
    {
        // Your code here!
        int[] a = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
        int[] x = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
        int N = a[0];
        int X = a[1];
        int min = 1000000000;
        for(int i = 0; i < x.Length; i++)
        {
            min = Math.Min(min, Math.Abs(X - x[i]));
        }
        int D = min;
        while(true)
        {
            bool flag = true;
            for(int i = 0; i < x.Length; i++)
            {
                
                if((X - x[i]) % D != 0)
                {
                    flag = false;
                    break;
                }
            }
            if(flag == true)
            {
                Console.WriteLine(D);
                return;
            }
            else
            {
                D--;
            }
            
        }
        
    }
}



Measured memory_bytes: 21728
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long int;
using ull = unsigned long long int;
using P = pair<ll, ll>;
using P3 = pair<ll, P>;
using PP = pair<P ,P>;
constexpr ll MOD = ll(1e9+7);
constexpr int IINF = INT_MAX;
constexpr ll LLINF = LLONG_MAX;
constexpr int MAX_N = int(1e6) + 5;
constexpr double EPS = 1e-8;
constexpr int di[] = {0, 1, 0, -1}, dj[] = {1, 0, -1, 0};
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define SORT(v) sort((v).begin(), (v).end())
#define SORTR(v) sort((v).rbegin(), (v).rend())
#define ALL(v) (v).begin(), (v).end()
 
int main(){
    int n;
    cin >> n;
    bool ok = false;
    for(int i=1;i<10;i++){
        for(int j=1;j<10;j++){
            if(i*j == n) ok = true;
        }
    }
    cout << (ok ? "Yes" : "No") << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <array>
#include <algorithm>
#include <vector>
#define int long long
using namespace std;

signed main() {
    int x;
    int tmp;
    bool ans = false;

    cin >> x;
    for(int i = x; i <100100; i ++){
        ans = true;
        tmp = i;
        for(int j = 2; j < i; j ++){
            if(i%j == 0) ans = false;
        }
        if(ans) break;
    }
    cout << tmp;


    return 0;
}

Measured memory_bytes: 3640
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,ceil,sqrt,factorial,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    X,Y = MI()
    ans = 0
    if X==1:
        ans = 300000
    elif X==2:
        ans = 200000
    elif X==3:
        ans = 100000
    if Y==1:
        ans += 300000
    elif Y==2:
        ans += 200000
    elif Y==3:
        ans += 100000
    if ans == 600000:
        ans = 1000000
    print(ans)
if __name__ == '__main__':
    main()

Measured memory_bytes: 39880