akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define INF 0x3f3f3f3f
typedef vector<int> VI;
typedef long long ll;
typedef pair<int,int> PII;
typedef double db;
const ll mod=1000000007;
const double PI = acos(-1.0);
const double epsilon = PI / 180.0;//角度转弧度 
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
const int N = 1e3+10;

int main() {
	ll a;
	string s;
	cin>>a;
	cin>>s;
	int len = s.length();
	ll b = 0;
	rep(i, 0, len) {
		if(s[i] >= '0'&&s[i] <= '9') {
			b *= 10;
			b += s[i] - '0';
		}
	}
	ll c = (a * b);
	c -= c % 100;
	cout<<(ll)(c / 100);
	return 0;
} 

Measured memory_bytes: 3628
import numpy as np
n = int(input())
A = [0] + list(map(int, input().split())) + [0]
x = [0]
for i in range(len(A)-1):
    x.append(abs(A[i]-A[i+1]))
ans = sum(x)
for i in range(1, n+1):
    print(ans - (x[i]+x[i+1]) + abs(A[i-1]-A[i+1]))

Measured memory_bytes: 38532
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int a = s.nextInt(),b = s.nextInt(),c = s.nextInt();
        if (a<b&&b<c) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}

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

int main(void){
    string s; cin >> s;
    bool flg=true;

    if(s[0]!='A') flg=false;

    int cnt=0;
    int upperCase=0;
    for(int i=2; i<s.size()-1; i++){
        if(s[i]=='C') cnt++;
        if(isupper(s[i])) upperCase++;
    }
    if(cnt!=1 || upperCase!=1) flg=false;
    if(!islower(s[s.size()-1])) flg=false;
    if(isupper(s[1])) flg=false;

    if(flg) cout << "AC" << endl;
    else cout << "WA" << endl;
}

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

fn main(){
    let n: usize = read();
    let mut vec: Vec<i64> = (0..n).map(|_| read::<i64>()).collect();
    let vec2 = vec.clone();
    
    vec.sort();
    let mut map: HashMap<i64, i64> = HashMap::new();
    for i in 0..n {
        map.insert(vec[i], i as i64);
    }
    let mut ans: i64 = 0;
    for i in 0..n {
        if i as i64 % 2 != map[&vec2[i]] % 2 {
            ans += 1;
        }
    }
    println!("{}", ans / 2);
}

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

Measured memory_bytes: 14588
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <string>
#include <assert.h>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cstdio>
#include <random>
#include <chrono>
#define ll long long
#define ld long double
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define int long long
using namespace std;

const int INF = 2e15;
const int MOD = 998244353;
int MB = 20;



void solve() {
	int n, w;
	cin >> n >> w;
	vector<pair<int, int>> a(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i].first >> a[i].second;
	}

	vector<int> dp(w + 1);
	for (int i = 0; i < n; i++) {
		for (int j = w; j >= a[i].first; j--) {
			dp[j] = max(dp[j - a[i].first] + a[i].second, dp[j]);
		}
	}

	cout << dp[w];
}


signed main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	cout.precision(12);
	solve();
}

Measured memory_bytes: 1024
// start fold
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<vector>
#include<cstring>
#include<set>
#include<map>
#include<cmath>
#include<queue>
#include<bitset>
using namespace std;
#define ri register int
#define il inline
#define LL long long
#define ull unsigned long long
#define pb push_back
#define mp make_pair
#define pii pair<int,int>
#define fi first
#define se second
#define enter putchar('\n')
#define size(x) ((int)x.size())
#define mem0(x) memset(x,0,sizeof(x))
template<class T>il void in(T &x)
{
	x=0; short f=1; char c=getchar();
	while(c<'0'||c>'9')
	{
		if(c=='-') f=-1;
		c=getchar();
	}
	while(c>='0'&&c<='9') x=x*10+(c^'0'),c=getchar();
	x*=f;
}
template <typename T,typename ...Args>il void in(T &x, Args &...args)
{
	in(x); in(args...);
}
template<class T>il void out(T x,const char c='\n')
{
	static short st[30];
	short m=0;
	if(x<0) putchar('-'),x=-x;
	do st[++m]=x%10,x/=10; while(x);
	while(m) putchar(st[m--]|'0');
	putchar(c);
}
template <typename T,typename ...Args>il void out(const T &x,const Args &...args)
{
	out(x,' '); out(args...);
}
template<class T>il void print(T a[],int n)
{
	if(n<=0) return;
	for(ri i=0; i<n; ++i) out(a[i],' ');
	enter;
}
namespace i207M
{
// end fold
#define N 16
#define M N*N
const int md=1e9+7;
int n,m;
int v[M],nx[M],head[N],cnte=1;
il void adde(const int uu,const int vv)
{
	v[++cnte]=vv,nx[cnte]=head[uu],head[uu]=cnte;
}
int ined[1<<N];
int f[2][1<<N];
int pw2[M];
int bit,ys[1<<N];
signed main()
{
#ifdef M207
	freopen("in.in","r",stdin);
	// freopen("out.out","w",stdout);
#endif
	in(n,m); pw2[0]=1; bit=(1<<n)-1;
	for(ri i=0; i<n; ++i) ys[1<<i]=i;
	for(ri i=1,a,b; i<=m; ++i)
	{
		in(a,b); --a,--b;
		adde(a,b), adde(b,a);
		pw2[i]=(pw2[i-1]<<1)%md;
	}
	for(ri s=1; s<=bit; ++s)
	{
		int x=s&-s;
		ined[s]=ined[s^x],x=ys[x];
		for(ri i=head[x]; i; i=nx[i])
			if((s>>v[i])&1) ++ined[s];
	}
	for(ri c=0; c<=1; ++c)
		for(ri s=1; s<=bit; ++s)
			if((s>>c)&1)
			{
				int val=pw2[ined[s]];
				for(ri t=s&(s-1); t; t=s&(t-1))
					if((t>>c)&1)
					{
						val=(val-(LL)f[c][t]*pw2[ined[s^t]]%md+md)%md;
					}
				f[c][s]=val;
			}
	int ans=0;
	for(ri s=1; s<=bit; ++s)
		if(s&1)
		{
			int bu=bit^s;
			for(ri t=bu; t; t=bu&(t-1))
				if((t&2)&&ined[s]+ined[t]==ined[s|t])
					ans=(ans+(LL)f[0][s]*f[1][t]%md*pw2[ined[(s|t)^bit]])%md;
		}
	ans=(pw2[m]-ans+md)%md;
	out(ans);
	return 0;
}
// start fold
}
signed main()
{
	i207M::main();
	return 0;
}
// end fold

Measured memory_bytes: 640
import math
a,b,x = map(int,input().split())
y = (a**2)*b
h = x/(a**2)

def get_angle_from_sides(a, b, c):
    return math.acos((a ** 2 + b ** 2 - c ** 2) / (2 * a * b))

def checkio(a, b, c):
    try:
        angles = [get_angle_from_sides(*abc) for abc in ((a, b, c), (b, c, a), (c, a, b))]
        result = sorted((math.degrees(a)) for a in angles)
        return [0, 0, 0] if 0 in result else result
    except ValueError:
        return [0, 0, 0]
count = 0
if y == x:
  pass
elif y/2 <=x:
  if a>=2*(b-h):
    m = checkio(a,2*(b-h),math.sqrt(a**2+(2*(b-h))**2))
    count = m[0]
  elif a<2*(b-h):
    m = checkio(a,2*(b-h),math.sqrt(a**2+(2*(b-h))**2))
    count = m[1]
elif y/2>x:
  z = 2*x/(a*b)
  if b>=z:
    m = checkio(b,z,math.sqrt(b**2+(z)**2))
    count = m[1]
  elif b<z:
    m = checkio(b,z,math.sqrt(b**2+(z)**2))
    count = m[0]
#print(a,2*(b-h),math.sqrt(a**2+2*(b-h)**2),m)
print(count)

Measured memory_bytes: 9504
#include <bits/stdc++.h>
using namespace std;
using ll = long long int;

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

  int N = S.length();

  //反転文字列をTとする
  string T = S;
  reverse(T.begin(), T.end());

  if (S == T) {
    string U = S.substr(0, (N - 1) / 2);
    string V = U;
    reverse(V.begin(), V.end());
    if (U == V) {
      string W = S.substr((N + 3) / 2 - 1);
      string X = W;
      reverse(X.begin(), X.end());
      if (W == X) {
        cout << "Yes";
        return 0;
      }
    }
  }

  cout << "No";
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#define D


#ifdef A
int main(void)
{
	int a, b;
	cin >> a >> b;
	if (a == b)
		cout << "a == b" << endl;
	else if (a < b)
		cout << "a < b" << endl;
	else
		cout << "a > b" << endl;

	return 0;
}
#endif
#ifdef B
int main()
{
	int a, b, c;
	cin >> a >> b >> c;
	if (a < b && b < c)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
	return 0;
}
#endif
#ifdef C
int main()
{
	vector<int> arr(3);
	for (vector<int>::iterator  i = arr.begin(), e = arr.end(); i != e; ++i)
	{
		cin >> *i;
	}
	sort(arr.begin(), arr.end());

	for (vector<int>::iterator i = arr.begin(), e = arr.end(); i != e; ++i)
	{
		cout << *i << " ";
	}
	cout << endl;
	return 0;
}
#endif
#ifdef D
int main()
{
	int W, H, x, y, r;
	const string syes("Yes"), No("No");
	bool ISin = true;
	cin >> W >> H >> x >> y >> r;

	// x????????????check
	if (r > x || (x + r)> W) {
		ISin = false;
	}
	//y????????????check
	if (r > y || (y + r) > H) {
		ISin = false;
	}

	if (ISin)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;



	return 0;
}
#endif

Measured memory_bytes: 3220
#include<stdio.h>
int main(void)
{
	int f1, f2, w, h, np, pc[30][2], op[30];
	scanf("%d",&w);
	scanf("%d",&h);
	for(f1 = 0; f1 < h; f1++)
	{
		scanf("%d,%d",&pc[f1][0],&pc[f1][1]);
	}
	for(f1 = 1; f1 <= w; f1++)
	{
		np = f1;
		for(f2 = 0; f2 < h; f2++)
		{
			if(np == pc[f2][0])
				np = pc[f2][1];
			else if(np == pc[f2][1])
				np = pc[f2][0];
		}
		op[np - 1] = f1;
	}
	for(f1 = 0; f1 < w; f1++)
	{
		printf("%d\n",op[f1]);
	}
	return 0;
}

Measured memory_bytes: 0
n, x, y = map(int, input().split())
graph = [[] for _ in range(n)]
 
for i in range(n):
  if i+1 < n:
    graph[i].append(i+1)
  if i-1 >=0:
    graph[i].append(i-1)
graph[x-1].append(y-1)
graph[y-1].append(x-1)
 
ans = [0] * (n-1)
from collections import deque
for i in range(n):
  dist = [-1] * n
  dist[i] = 0
  d = deque()
  d.append(i)
  while d:
    v = d.popleft()
    for j in graph[v]:
      if dist[j] != -1:
        continue
      dist[j] = dist[v] + 1
      ans[dist[j] - 1] += 1
      d.append(j)
for a in ans:
  print(a//2)

Measured memory_bytes: 75696
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut 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")
    };
}

fn min (a: &i64, b: &i64)-> i64{
    if *a <= 0i64 {*b}
    else if *b <= 0i64  {*a}
    else if *a < *b {*a}
    else {*b}
}

fn abs (a: &i64, b: &i64) -> i64{
    if *a - *b <= 0 {*b - *a} else {*a - *b}
}

fn main(){
    input!{
        h: usize,
        w: usize,
        a: [chars;h]
    }
    let mut bl = Vec::new();
    for i in 0..h{
        for j in 0..w{
            if a[i][j] == '#'{
                bl.push((i as i64, j as i64));
            }
        }
    }
    let mut blup = a.clone();
    let mut counter: i64= 0;
    let mut ch = true;
    while ch{
        let mut next = Vec::new();
        ch = false;
        for k in bl{
            if k.0-1 > -1 {
                if blup[k.0 as usize -1][k.1 as usize] == '.' {
                    ch = true;
                    next.push((k.0-1, k.1));
                    blup[k.0 as usize -1][k.1 as usize] = '#'
                }
            }
            if k.0+1 < h as i64 {
                if blup[k.0 as usize +1][k.1 as usize] == '.' {
                    ch = true;
                    next.push((k.0+1, k.1));
                    blup[k.0 as usize +1][k.1 as usize] = '#'
                }
            }
            if k.1-1 > -1{
                 if blup[k.0 as usize][k.1 as usize -1] == '.' {
                    ch = true;
                    next.push((k.0, k.1-1));
                    blup[k.0 as usize][k.1 as usize -1] = '#'
                }
            }
            if k.1+1 < w as i64 {
                if blup[k.0 as usize][k.1 as usize +1] == '.' {
                    ch = true;
                    next.push((k.0, k.1+1));
                    blup[k.0 as usize][k.1 as usize +1] = '#'
                }
            }
        }
        if ch {
            counter += 1;
        }
        bl = next;
    }
    print!("{}", counter)
}


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

#define int long long 
#define dou  double 
#define endl "\n"

const int MOD=1e9+7;

void solve()
{
	int n,i,sum=0,j;
	int x,y,z;
	cin >> x >> y >> z;
	cout << z << ' ' << x  << ' ' << y << endl;

	
}

main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	
	solve();
}


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

#define REP(i,n) for(int i=0; i < (n); ++i)
#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)

#define INF 1e9


int main(){ 
  ll A, B, C;
  cin >> A >> B >> C;
  if(A*B*C % 2 == 0){
    cout << 0 << endl;
  }
  else{
    cout << min(A*B, min(B*C, C*A)) << endl;
  }

  return 0;
}



Measured memory_bytes: 256
#include <stdio.h>
int main(void){
    int n,i,ans=0;
    scanf("%d",&n);
    int x,min=n;
    for(i=0;i<n;i++){
        scanf("%d",&x);
        if(x<=min){
            ans++;
            min=x;
        }
    }
    printf("%d",ans);
    return 0;
}

Measured memory_bytes: 128
//#define _GLIBCXX_DEBUG

#include<bits/stdc++.h>
#define PI 3.14159265359
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
const int INF= 1e9+5;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll> >vvl;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> T;
const ll MOD=1000000007LL;
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
int main(){
  ll a,p;cin>>a>>p;
  cout<<(a*3+p)/2<<endl;
}

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

long long n, t = 0, h = 0;

int main() {
  cin >> n;
  for(int i = 0; i < n; ++i) {
    string s, x;
    cin >> s >> x;
    if(s < x)
      h += 3;
    else if(s > x)
      t += 3;
    else
      ++t, ++h;
  }
  cout << t << " " << h << endl;
  return 0;
}


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

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	int s; cin>>s;
	int h=s/3600; s%=3600;
	int m=s/60; s%=60;
	cout<<h<<":"s<<m<<":"s<<s<<"\n"s;
}


Measured memory_bytes: 3184
#include <bits/stdc++.h>
#define itn int
#define REP(i, n) for (int i = 0; i < n; i++)
#define IREP(i, n) for (int i = n - 1; i >= 0; i--)
#define FOR(a, b) for (int i = a; i < b + 1; i++)
#define all(v) v.begin(), v.end()
#define SENTINEL 2000000000
#define NIL -1
using namespace std;
typedef long long ll;

const ll INF = 1LL << 60;
const ll MOD = 1000000007;
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 cmb(ll n, ll k)
{
    ll tmp = 1;
    ll a=1;
    REP(i, k)
    {
        tmp = tmp * n;
        n--;
        tmp/=a;
        a++;
        //tmp %= MOD;
        //tmp = tmp * modinv(k - i, MOD) % MOD;
        //上はMOD使うときやって
    }
    return tmp;
}
int main()
{
    int n;
    cin >> n;
    vector<int> v(n);
    map<int, int> m;
    REP(i, n)
    {
        cin >> v[i];
        m[v[i]]++;
    }
    ll a = 0;
    for (auto &i : m)
    {
        a += cmb(i.second, 2);
    }
    REP(i, n)
    {
        cout << a - cmb(m[v[i]], 2) + cmb(m[v[i]] - 1, 2) << endl;
    }
}

Measured memory_bytes: 9216
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int p;
  for(int i=0; i<n; i++) {
    cin >> p;
    if(p%2 == 0) {
      if(!(p%3 == 0 || p%5 == 0)) {
        cout << "DENIED" << endl;
        return 0;
      }
    }
  }
  cout << "APPROVED" << endl;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define all(x) (x).begin(),(x).end()
#define pll pair<ll,ll>
#define pii pair<int,int>
#define rep(i,n) for(int i=0;i<n;i++)
#define For(i,a,b) for(int i=a;i<b;i++)
#define sz(x) ((ll)(x).size())
#define pb push_back
#define mp make_pair
#define bit(n) (1LL<<(n))
#define F first
#define S second
#define debug(x) cerr << x << endl
#define Complex complex<double>
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
const ll INF = 1LL<<60;
const ll mod = (int)1e9 + 7;

int main() {
    int n;
    cin >> n;
    ll sum=0;
    rep(i,n){
        ll x=i+1;
        if(x%3 && x%5)sum+=x;
    }
    cout << sum;

    
}


Measured memory_bytes: 3636
n, m, k=map(int, input().split())
A=list(map(int, input().split()))
B=list(map(int, input().split()))

a=[0]
b=[0]

for i in range(n):
    a.append(a[i]+A[i])

for i in range(m):
    b.append(b[i]+B[i])

ans, j=0, m
for i in range(0, n+1):
    if a[i]>k:
        break
    else:
        while a[i]+b[j]>k:
            j-=1
        
    ans=max(ans, i+j)


print(ans)

Measured memory_bytes: 134580
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<utility>
#include<numeric>
#include<vector>
#include<map>
#include<unordered_map>
#include<set>
#include<tuple>
#include<stack>
#include<queue>
#include<functional>
#include<iterator>
#include<cmath>
#include<cctype>

using namespace std;

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

const int INF = 1e9;
const ll LINF = 1e18;
const int MOD = INF+7;

struct edge{int to,cost;};

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

	int n;
	cin >> n;
	int a[(int)1e5+1]={};

	int tmp,ans=0;
	for(int i=0;i<n;i++){
		cin >> tmp;
		a[tmp]++;
		if(a[tmp] == 1) ans++;
	}
	int amari=0;
	for(int i=1;i<=(int)1e5;i++){
		if(a[i] >= 3){
			a[i] -= ((a[i]-1)/2)*2;
		}
		if(a[i] == 2) amari++;
	}
	cout << ans-(amari%2 == 1) << "\n";

	return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <functional>
#include <numeric>
#include <list>
#include <set>
#include <map>
#include <algorithm>
#include <cmath>
#include <limits>
#include <iomanip>
#include <bitset>
#include <queue>
#include <unordered_set>
#include <unordered_map>

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;

#define rep(i, n) for(int i = 0;i < n;i++)
const int INF = 1LL << 30;
const int MOD = 1000000007;


int main(){
    std::ios_base::sync_with_stdio(false);
    cin.tie(0);
    
    int n,m; cin >> n >> m;

    std::vector<pair<int,int>> vp;
    rep(i,m){
        int s,c; cin >> s >> c;
        vp.push_back({s,c});
    }

    rep(i,pow(10,n)){

        string x = to_string(i);

        bool good = true;

        rep(j,m){

            int s,c; s = vp[j].first; c = vp[j].second;

            if(x.length() < s){
                good = false;
                break;
            }

            if(x[s-1]!='0'+c){
                good = false;
                break;
            }

        }

        if(good && x.length()==n){
            cout << x << endl;
            return 0;
        }

    }

    cout << -1 << endl;
    

    return 0;
}

Measured memory_bytes: 256
//y09-6 ビンゴ(3回目・自分で)
#include <iostream>
#include <fstream>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <string>
#include <vector>
#include <map>
#include <list>
#include <set>
#include <stack>
#include <queue>
#include <cstdlib>
#include <algorithm>
#include <random>
#include <cassert>
using namespace std;
#define LL long long
#undef INT_MIN
#undef INT_MAX
#define INT_MIN -2147483648
#define INT_MAX 2147483647
#define LL_MIN -9223372036854775808
#define LL_MAX 9223372036854775807
#define segment_size 65536
#define ROOP() while (true)

//i回目までの合計値がjとなる組み合わせは
//(i) i-1回目に合計値がj-iだった場合の組み合わせ(ピッタリ)
//(ii) i回目に合計値がj-iだった場合の組み合わせ(ここまでに取ってきたすべての値(i個)を1ずつ加算させればjとなる)
//(i),(ii)を合わせたもの
//ただし、合計値jが数字の個数Mを超える場合、(i)でMより大きい数を取ることはできず、
//i-1回目に合計値がj-M-1であったものを引く

int main(){
    ROOP(){
        int N,M,S;
        cin >> N >> M >> S;
        if(N==0) return 0;

        int dp[50][3001];
        for(int i=0; i<50; i++){
            for(int j=0; j<3001; j++){
                dp[i][j] = 0;
            }
        }
        dp[0][0] = 1;

        for(int i=1; i<=N*N; i++){
            for(int j=1; j<=S; j++){
                if(j>=i){
                    dp[i][j] = dp[i-1][j-i] + dp[i][j-i];
                    if(j>M) dp[i][j] -= dp[i-1][j-M-1];
                    dp[i][j] %= 100000;
                    if(dp[i][j] < 0) dp[i][j] += 100000;
                }
            }
        }

        cout << dp[N*N][S] << endl;
    }
    return 0;
}




Measured memory_bytes: 3676
n,k=map(int, input().split())
A=list(map(int, input().split()))


for gakki in range(k+1,n+1):
    #pre = A[gakki-k-1:gakki-1]
    pre = A[gakki-k-1]
    #pre_ = 1
    #for p in pre:
        #pre_ *= p

    
    #k_gakki = A[gakki-k:gakki]
    k_gakki = A[gakki-1]
    #print(k_gakki)
    #k_gakki_ = 1
    #for ga in k_gakki:
        #k_gakki_ *= ga
    
    #if pre_ < k_gakki_:
    if pre < k_gakki:
        print('Yes')
    else:
        print('No')

Measured memory_bytes: 31300
#include<stdio.h>

int main() {
    int A, B;
    scanf("%d", &A);
    scanf("%d", &B);

    if (A == 1) {
        if (B == 2) printf("3");
        else printf("2");
    }
    else if (A == 2) {
        if (B == 1) printf("3");
        else printf("1");
    }
    else {
        if (B == 1) printf("2");
        else printf("1");
    }

    return 0;
}

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

typedef vector<int> vi;
typedef vector<vi> vvi;

int N, M;
vvi A;
vector<bool> use;

int get_count(void) {
	vi C(M, 0);
	for (int j = 0; j < N; ++j) {
		for (int i = 0; i < M; ++i) {
			int g = A[j][i];
			if (use[g]) {
				++C[g];
				break;
			}
		}
	}
	vi::iterator it = max_element(C.begin(), C.end());
	size_t id = distance(C.begin(), it);

	use[id] = false;
	return C[id];
}

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

	cin >> N >> M;
	vi v(M);
	A.resize(N, v);
	for (int j = 0; j < N; ++j) {
		for (int i = 0; i < M; ++i) {
			cin >> A[j][i];
			--A[j][i];
		}
	}

	use.resize(M, true);
	int cnt;
	int min_cnt = N + 1;
	for (int i = 1; i <= M; ++i) {
		cnt = get_count();
		min_cnt = min(min_cnt, cnt);
	}

	cout << min_cnt << '\n';
	return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define ll long long
#define rep(i,j) for(int i=0;i<j;i++)
using namespace std;
int main(void)
{
	ll X,Y,A,B,C;
	cin>>X>>Y>>A>>B>>C;
	vector<ll> p(A);
	vector<ll> q(B);
	vector<ll> r(C);
    	vector<ll> ans(X+Y+C);
	ll cost=0;
	rep(i,A) cin>>p[i];
	rep(i,B) cin>>q[i];
	rep(i,C) cin>>r[i];

	sort(p.begin(),p.end(),greater<ll>());
	sort(q.begin(),q.end(),greater<ll>());
	sort(r.begin(),r.end(),greater<ll>());
	rep(i,X)ans.push_back(p[i]);
	rep(i,Y)ans.push_back(q[i]);
	rep(i,C)ans.push_back(r[i]);
	sort(ans.begin(),ans.end(),greater<ll>());
	rep(i,X+Y)cost+=ans[i];
	cout<<cost<<endl;
}

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

for i in range(m):
    ab[i].append(i)

ab_l = sorted(ab, key=lambda x: x[1])
ab_ll = sorted(ab_l, key=lambda x: x[0])

temp = 1
for j in range(m):
    if j==0 or ab_ll[j][0] != ab_ll[j-1][0]:
        temp = 1
    else:
        temp +=1
    ab_ll[j].append(temp)

ab_lll = sorted(ab_ll, key=lambda x: x[2])

for i in range(m):
    print(str(ab_lll[i][0]).zfill(6)+str(ab_lll[i][3]).zfill(6))

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

#define LL long long
typedef pair<int, int> pii;

template< typename T > inline void read(T &x)
{
    static char _c;
    static bool _f;

    x = 0;
    _f = 0;
    _c = getchar();

    while(_c < '0' || '9' < _c) {if(_c == '-') _f = true; _c = getchar();}
    while('0' <= _c && _c <= '9') {x = (x << 1) + (x << 3) + (_c & 15); _c = getchar();}
    if(_f) x = -x;
}

template < typename T > inline void Min(T &x, T y) {if(y < x) x = y;}
template < typename T > inline void Max(T &x, T y) {if(x < y) x = y;}


#define lowbit(x) ((x) & -(x))
#define lson l,mid,id<<1
#define rson mid+1,r,id<<1|1
#define ls id<<1
#define rs id<<1|1
#define MID(l,r) ((l)+(((r)-(l))>>1))
#define fi first
#define se second
#define mk make_pair
#define pb push_back

const int INF = 0x3f3f3f3f;
const int MOD = (int) 998244353;
const int maxn = (int) 200000 + 20;
const int maxm = (int) 1000000 + 20;
const double pi = (double) acos(-1.0);
const double eps = (double) 1e-8;

inline int sig(double x) {return x < -eps ? -1 : eps < x;}
LL fp(LL a, LL n, LL m = MOD) {LL res = 1; for(; n; n >>= 1, a = a * a % m) if(n & 1) res = res * a % m; return res;}


void work()
{
    unsigned LL n;
    cin >>n;

    if(n <= 9 || n % 2)
    {
        cout <<0 <<endl;
    }
    else if(n <= 30)
    {
        unsigned LL tmp = 1;
        while(n > 1)
        {
            tmp *= n;
            n -= 2;
        }
        int cnt = 0;
        while(tmp % 10 == 0)
        {
            cnt++;
            tmp /= 10;
        }
        cout <<cnt <<endl;
    }
    else
    {
        unsigned LL cnt = 0;
        unsigned LL mul = 5;

        while(n >= mul)
        {
            unsigned LL t = n / mul;

            if((n % mul) & 1) cnt += t / 2;
            else cnt += (t + 1) / 2;

            mul *= 5;
        }
        cout <<cnt <<endl;
    }
}

int main()
{
#ifdef yukihana0416
freopen("in.txt", "r", stdin);
//freopen("out.txt", "w", stdout);
#endif // yukihana0416
//    get_prime();
    int tc = 1;
//    read(tc);
    for(int ca = 1; ca <= tc; ca++)
    {
//        printf("Case #%d: ", ca);
        work();
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define mod 1000000007
#define N 200009
using namespace std;

int n,b[N],c[N],dp[N];
struct node{ int x,y; }a[N],p[N];
bool cmpx(node u,node v){ return u.x<v.x; }
bool cmpy(node u,node v){
	return u.y<v.y || u.y==v.y && u.x<v.x;
}
void ins(int x,int y){
	for (x++; x<=n+1; x+=x&-x) c[x]=(c[x]+y)%mod;
}
int getsum(int x){
	int y=0; for (; x; x^=x&-x) y=(y+c[x])%mod; return y;
}
int qry(int x,int y){ return (getsum(y+1)-getsum(x)+mod)%mod; }
int main(){
	scanf("%d",&n);
	int i,j,x,y,tmp;
	for (i=1; i<=n; i++) scanf("%d%d",&a[i].x,&a[i].y);
	sort(a+1,a+n+1,cmpx);
	for (i=1; i<=n; i++) a[i].x=i;
	sort(a+1,a+n+1,cmpy);
	for (i=1; i<=n; i++){
		for (j=a[i].x; j && !b[j]; j--) b[j]=i;
		p[i].x=b[a[i].x];
	}
	memset(b,0,sizeof(b));
	for (i=n; i; i--){
		for (j=a[i].x; j<=n && !b[j]; j++) b[j]=i;
		p[i].y=b[a[i].x];
	}
	sort(p+1,p+n+1,cmpy);
	dp[0]=1; ins(0,1);
	for (i=1; i<=n; i++){
		x=p[i].x; y=p[i].y;
		tmp=qry(x-1,y);
		dp[y]=(dp[y]+tmp)%mod; ins(y,tmp);
	}
	printf("%d\n",dp[n]);
	return 0;
}


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

using namespace std;

int main() {
	
	int a,b;
	int ans=-10000000;

	cin >> a >> b;

	ans = a + b;
	if (ans < a - b) {
		ans = a - b;
	}
	
	if (ans < a * b) {
		ans = a * b;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<string>
#include<algorithm>
#include<memory.h>
#include<vector>
#include<stdio.h>
#include<cstdlib>
#include<map>
#include <set>
#include<stack>
#include<cmath>
#include<queue>
#include<bitset>
using namespace std;
typedef long long ll;
const int inf = 1e9;
const int MOD = 1e9 + 7;
typedef pair<int, int> ii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<ii> vii;
const int N = 1e9 + 1;



int main() {
	int a, b, c, d;
	scanf("%d %d %d %d", &a, &b, &c, &d);
	if (abs(c - a) <= d || (abs(c - b) <= d && abs(b - a) <= d))
		puts("Yes");
	else
		puts("No");


	return 0;
}



Measured memory_bytes: 256
class UnionFind():
    """
    UnionFindTreeのクラス
    
    Attributes:
    n: int: ノード数
    parents: そのノードが属する木の根を格納, 根の場合は-1

    """
    def __init__(self, n):
        """ノード数nで初期化"""
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        """ノードxが属するグループの根を返す"""
        if self.parents[x] < 0:
            return x
        else:
            #経路圧縮
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        """xが属するグループとyが属するグループを併合"""
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        """xが属するグループの要素数を返す"""
        return -self.parents[self.find(x)]

    def same(self, x, y):
        """x, yが同じグループに属するかどうかを返す"""
        return self.find(x) == self.find(y)

    def members(self, x):
        """xが属するグループ内の要素をリストで返す"""
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        """全ての根に対する要素をリストで返す"""
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        """グループの総数を返す"""
        return len(self.roots())

    def all_group_members(self):
        """{root: [そのグループの要素リスト]}の辞書を返す"""
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        """printデバッグ用. root: [要素リスト]をstrで返す"""
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())


N, M = map(int, input().split())
AB = [tuple(map(int, input().split())) for _ in range(M)]
uf = UnionFind(N)
ans = N*(N-1)//2
ans_stack = []
for br in range(M-1, -1, -1):
    a, b = AB[br]
    a -= 1
    b -= 1
    ans_stack.append(ans)
    if not uf.same(a, b):
        ans -= uf.size(a) * uf.size(b)
        if ans < 0:
            ans = 0
    uf.union(a, b)

for _ in range(M):
    print(ans_stack.pop())

Measured memory_bytes: 97116
#include <bits/stdc++.h>
using namespace std;
#define all(c) (c).begin(),(c).end()
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define rrep(i,n) for(int i=(int)(n)-1; i>=0; i--)
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define iter(c) __typeof((c).begin())
#define tr(it,c) for(iter(c) it=(c).begin(); it!=(c).end(); it++)
#define pb(a) push_back(a)
#define pr(a) cout << (a) << endl
#define PR(a,b) cout << (a) << " " << (b) << endl
#define F first
#define S second
typedef long long ll;
typedef pair<int,string> P;
const int MAX=1000000001;
const ll MAXL=1000000000000000001LL;
const ll mod=1000000007;
int dx[4]={-1,-4,1,4};

int main() {
  map<string,int> d;
  string s="01234567";
  d[s]=0;
  queue<P> que;
  que.push(P(0,s));
  while(!que.empty()) {
    P p=que.front();
    que.pop();
    int x=p.F;
    s=p.S;
    rep(i,4) {
      int y=x+dx[i];
      if(y<0 || y>=8) continue;
      if(i==2 && y==4) continue;
      if(i==0 && y==3) continue;
      string t=s;
      swap(t[x],t[y]);
      if(d.count(t)) continue;
      d[t]=d[s]+1;
      que.push(P(y,t));
    }
  }
  
  char c;
  while(cin >> c) {
    s="";
    s+=c;
    REP(i,1,8) {
      cin >> c;
      s+=c;
    }
    pr(d[s]);
  }
  return 0;
}


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

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

  long long x;
  cin >> x;

  long long a = 100, result = 0;
  while (a < x) {
    a += a / 100;
    ++result;
  }

  cout << result << '\n';
}

Measured memory_bytes: 3616
import numpy as np
N, W = map(int, input().split())
ndp = np.zeros(W+1, dtype= np.int64)
for _ in range(N):
    w, v = map(int,input().split())

    # 離散より連続で扱った方が簡単になる。
    np.maximum(ndp[:-w] + v, ndp[w:], out = ndp[w:])
print(ndp[-1])


"""
https://atcoder.jp/contests/dp/submissions/6657472
より失敬。

めっちゃスマートな解法。
"""


Measured memory_bytes: 21372
#include <iostream>
#include <stdexcept>
#include <cassert>
#include <cmath>
#include <string>
#include <vector>
using namespace std;


int main() {
  long long N;
  cin >> N;
  assert(N >= 1);

  const string alphabets = "abcdefghijklmnopqrstuvwxyz";
  const long long MAX_N = 1000000000000001;
  const int M = 26;

  int j = 1000000000;
  long long th = 0;
  vector<long long> ths = {0};
  for (int i = 1; i < log(MAX_N) / log(M) + 1; i++) {
    th += pow(M, i);
    ths.push_back(th);
    if (N <= th) j = min(j, i);
  }

  // cout << "length: " << j << endl;

  string ans = "";
  N -= 1;
  for (; j > 0; j--) {
    int x = (N - ths[j-1]) / pow(M, j-1);
    N -= (x + 1) * pow(M, j-1);
    cout << alphabets[x];
  }

  cout << endl;

  return 0;
}


Measured memory_bytes: 4108
D, N = map(int, input().split())
if N<100:
	if D==0:
		print(N)
	elif D==1:
		print(100*N)
	else:
		print(10000*N)
else:
	if D==0:
		print(101)
	elif D==1:
		print(10100)
	else:
		print(1010000)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 2e5 + 10;
int n;
ll ans;
int a[maxn];
void no()
{
	puts("-1");
	exit(0);
}
int main()
{
	scanf("%d", &n);
	for(int i = 1; i <= n; ++i) scanf("%d", &a[i]);
	if(a[n] >= n) no();
	ans += a[n];
	int pre = n - a[n];
	for(int i = n - 1; i; --i)
	{
		if(a[i] >= i) no();
		if(i - a[i] > pre) no();
		else if(i - a[i] < pre)
		{
			ans += a[i];
			pre = i - a[i];
		}
	}
	printf("%lld\n", ans);
	return 0;
}
		

Measured memory_bytes: 4588
#include <bits/stdc++.h>
using namespace std;
#define fr(i,k,n) for(int i=k;i<n;i++)
#define read(x) cin>>x
#define ll long long int
#define mod 1000000007 
#define print(x) cout<<x<<endl
#define pb(x) push_back(x)
#define fastIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int dp[100000];
 
int main() { 
    fastIO;
     int t=1,n,k=2;
      
      
       cin>>n ;
       memset(dp,0,sizeof(dp));
       int a[100000];
        fr(i,0,n)
          cin>>a[i];
       int ans[100000];
       ans[0]=0;
         fr(i,1,n)
           ans[i]=INT_MAX;
       dp[0]=0;
       fr(i,0,n)
       { fr(j,i+1, i+k+1){
       if(j<n)
       { 
        ans[j]=min(ans[i]+abs(a[j]-a[i]) ,ans[j]);}
         
       }
       }
    print(ans[n-1]);   
     
    
      
	 
	return 0;
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string s;
  int c0 = 0;
  int c1 = 0;
  cin >> s;

  for(int i=0;i<s.size();i++){
  	if(i % 2 == 0){
  		if(s.at(i) == '1')
  			c0++;
  	}
  	else{
  		if(s.at(i) == '0')
  			c0++;
  	}
  }

  for(int i=0;i<s.size();i++){
  	if(i % 2 == 0){
  		if(s.at(i) == '0')
  			c1++;
  	}
  	else{
  		if(s.at(i) == '1')
  			c1++;
  	}
  }

  cout << min(c0, c1) << endl;
}

Measured memory_bytes: 512
#include <stdio.h>

int main(){

    
    int W[100],H[100],i=0,j,k,l; 

 	  scanf("%d",&H[0]);
 	  scanf("%d",&W[0]);
 	  
     while((H[i]!=0)&&(H[i]!=0)){
        
      ++i;
      scanf("%d",&H[i]);
 	  scanf("%d",&W[i]);
      }
           
 	 for(j=0;j<i;++j){
 	 
 	   for(k=0;k<H[j];++k){
	 
	      for(l=0;l<W[j];++l){
			if ((k==0)||(k==H[j]-1)) {  	
		    printf("#");
		   }else if((l==0)||(l==W[j]-1)){
			printf("#");
		   }else{
			printf(".");
		   } 
	      }
	      
	      printf("\n");
	   }
	      printf("\n");
	 }

    
	return 0;
}

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

namespace ABC89
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            Console.WriteLine(N / 3);
        }
    }
}


Measured memory_bytes: 11092
from bisect import bisect,bisect_left
N=int(input())
A=sorted(list(map(int,input().split())))
B=sorted(list(map(int,input().split())))
C=sorted(list(map(int,input().split())))
ans=0
for b in B:
  i=bisect_left(A,b)
  j=bisect(C,b)
  ans+=i*(N-j)
print(ans)

Measured memory_bytes: 29388
#include <iostream>
#include <cmath>
#include <cstdio>
using namespace std;
int n,m;
double l[20],a[20],b[20];
double difTable[20][20];
double d[1<<20]; // max distance


double getDif(int i, int j){
  double ll=l[i]-l[j], aa=a[i]-a[j], bb=b[i]-b[j];
  return ll*ll + aa*aa + bb*bb;
}

double cal( const int num ){
  if( d[num] > 0.0 || fabs(d[num])<1e-6 )
    return d[num];

  double ret=0.0;
  for( int shiftIndex=0;shiftIndex<n;shiftIndex++ ){
    int shift = 1<<shiftIndex;
    if( num & shift ){
      int prevValue = num-shift;
      double prev = cal( prevValue );
      for( int i=0;i<n;i++ ){
	if( prevValue & (1<<i) ){
	  prev += getDif( shiftIndex, i );
	}
      }
      ret = max( ret, prev );
    }
  }
  return d[num] = ret;
}


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

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

  int len=1<<n;
  for( int i=0;i<len;i++ )
    d[i] = -1.0;
  d[0] = 0.0;
  for( int i=0;i<n;i++ ){
    difTable[i][i] = 0.0;
    d[1<<i] = 0.0;
    for( int j=i+1;j<n;j++ )
      difTable[i][j] = getDif( i, j );
  }

  double ans=0.0;
  if( m > 1 ){
    for( int i=1;i<len;i++ ){
      int sum=0;
      for( int j=0;j<20;j++ )
	if( i&(1<<j) )sum++;
      if( sum==m )
	ans = max( ans, cal(i) );
    }
  }

  printf("%.10lf\n",ans);

  return 0;
}

Measured memory_bytes: 9444
#ifdef DEBUG_IS_VALID
#define DEB 1 
#define _LIBCPP_DEBUG 0
#else
#define DEB 0
#define NDEBUG
#endif

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

#define ALL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i, x, n) for(int i = x; i >= n; i--)
#define rrep(i, n) RREP(i,n,0)
#define pb push_back
#define fi first
#define se second
#pragma GCC optimize ("-O3")

using namespace std;

#define DUMPOUT cout
#define dump(...) if(DEB) DUMPOUT<<"  "<<#__VA_ARGS__<<" :["<<__LINE__<<":"<<__FUNCTION__<<"]"<<endl<<"    "; if(DEB) dump_func(__VA_ARGS__)
template<typename T1,typename T2>ostream& operator << (ostream& os, pair<T1,T2> p){cout << "(" << p.first << ", " << p.second << ")"; return os;}
template<typename T>ostream& operator << (ostream& os, vector<T>& vec) { os << "{"; for (int i = 0; i<vec.size(); i++) os << vec[i] << (i + 1 == vec.size() ? "" : ", "); os << "}"; return os; }
template<typename T>ostream& operator << (ostream& os, set<T>& st){cout << "{"; for(auto itr = st.begin(); itr != st.end(); itr++) cout << *itr << (next(itr)!=st.end() ? ", " : ""); cout << "}"; return os;}
template<typename T1,typename T2>ostream& operator << (ostream& os, map<T1,T2> mp){cout << "{"; for(auto itr = mp.begin(); itr != mp.end(); itr++) cout << "(" << (itr->first) << ", " << (itr->second) << ")" << (next(itr)!=mp.end() ? "," : ""); cout << "}"; return os; }

void dump_func(){DUMPOUT << endl;}
template <class Head, class... Tail>void dump_func(Head&& head, Tail&&... tail){ DUMPOUT << head; if (sizeof...(Tail) == 0) { DUMPOUT << " "; } else { DUMPOUT << ", "; } dump_func(std::move(tail)...);}
template<class T> inline bool chmax(T& a,T const& b){if(a>=b) return false; a=b; return true;}
template<class T> inline bool chmin(T& a,T const& b){if(a<=b) return false; a=b; return true;}

using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vp = vector<Pl>;
using vvp = vector<vp>;

const int INF = 1<<29;
const long long LINF=1LL<<59;


void solve(std::string S, std::string T){
  int ans = 0;
  rep(i,3) ans += int(S[i]==T[i]);
  cout << ans << endl;
}

int main(){
  std::cout << std::fixed << std::setprecision(15);
  std::string S;
  std::cin >> S;
  std::string T;
  std::cin >> T;
  solve(S, T);
  return 0;
}


Measured memory_bytes: 256
<?php
// 桁数が増えてもOK！$valueと$sumを任意で変更する
$value = fgets(STDIN);
// 計算後の値
$sum = 7;
// 桁数
$length = strlen(trim($value));
// +,-の数
$signCount = $length - 1;
// 左から順番に1桁ずつ配列に格納
$array = array();
for ($i = 0; $i < $length; $i ++) {
    $array[] = (int) substr($value, $i, 1);
}

// 全探索(記号種類2(+,-)を計算回数分べき乗する)
// 1ならプラス、0ならマイナス
for ($i = 0; $i < pow(2, $signCount); $i ++) {
    $result = $array[0];
    $resultStr = $array[0];
    // 桁の左から比較する
    for ($j = $signCount - 1; $j >= 0; $j --) {
        // 左シフトした値と比べる
        if (($i & (1 << $j)) === (1 << $j)) {
            $result += $array[$signCount - $j];
            $resultStr .= "+" . $array[$signCount - $j];
        } else {
            $result -= $array[$signCount - $j];
            $resultStr .= "-" . $array[$signCount - $j];
        }
    }
    if ($result === $sum) {
        echo $resultStr . "=" . $sum;
        exit(0);
    }
}


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

const long long INF = 1LL << 60;
const ll MOD = ll(1e9)+7;

bool has_key(unordered_map<string, ll> &m, string s){
    if (m.find(s) == m.end()){
        return false;
    }
    else{
        return true;
    }
}


bool vector_find(std::vector<ll> vec, ll number) {
  auto itr = std::find(vec.begin(), vec.end(), number);
  size_t index = std::distance( vec.begin(), itr );
  if (index != vec.size()) {
    return true;
  }
  else {
    return false;
  }
}


void recursive_comb(int *indexes, int s, int rest, std::function<void(int *)> f) {
  if (rest == 0) {
    f(indexes);
  } else {
    if (s < 0) return;
    recursive_comb(indexes, s - 1, rest, f);
    indexes[rest - 1] = s;
    recursive_comb(indexes, s - 1, rest - 1, f);
  }
}


void foreach_comb(int n, int k, std::function<void(int *)> f) {
  int indexes[k];
  recursive_comb(indexes, n - 1, k, f);
}


int main() {

  ll N;

  cin >> N;

  ll tmp = 0;
  vector<ll> vec_sum(12, 0);
  for (ll i = 1; i <= 11; i++) {
    tmp += pow(26, i);
    vec_sum.at(i) = tmp;
  }

  string ans = "";


  vector<string> alphabet{"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"};

  vector<ll> index;
  ll div_tmp;

  for (ll i = 1; i <= 11; i++) {
    
    if (N <= vec_sum.at(i)) {
      N -= vec_sum.at(i-1);

      for (ll j = i-1; j >= 0; j--) {
        if (N == 0){
          ans += "z";
        } else if (j == 0) {
          ans += alphabet.at(N-1);
        } else if (pow(26, j) < N) {
          div_tmp = (N-1) / ll(pow(26, j));
          N -= pow(26, j)*div_tmp;
          if (div_tmp == 26) {
            ans += "z";
          } else {
            ans += alphabet.at(div_tmp);
          }
        } else {
          ans += "a";
        }
      }
      

      break;
    }

  }
  




  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 4124
//============================================================================
// Name        : JOI.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;

// 1. dp?????????
//???J?????????O ?????????I
//???0?????????0?????????1?????????
//???0?????????1?????????0?????????
//???0?????????1?????????1?????????
//???1?????????0?????????0?????????
//???1?????????0?????????1?????????
//???1?????????1?????????0?????????
//???1?????????1?????????1?????????

int dp[9][1001];
// 2. n?????????
int N;
char D[1001];

// 7. calc?????????
int calc(int k,int m){
	// 8. dp???????????°??????
	if(dp[k][m]>=0)return dp[k][m];
	// 9. dp????¨????

	if(k==1)dp[k][m]=calc(1,m-1)+calc(3,m-1)+calc(5,m-1)+calc(7,m-1);
	if(k==2)dp[k][m]=calc(2,m-1)+calc(3,m-1)+calc(6,m-1)+calc(7,m-1);
	if(k==3)dp[k][m]=calc(1,m-1)+calc(2,m-1)+calc(3,m-1)+calc(5,m-1)+calc(6,m-1)+calc(7,m-1);
	if(k==4)dp[k][m]=calc(4,m-1)+calc(5,m-1)+calc(6,m-1)+calc(7,m-1);
	if(k==5)dp[k][m]=calc(1,m-1)+calc(3,m-1)+calc(4,m-1)+calc(5,m-1)+calc(6,m-1)+calc(7,m-1);
	if(k==6)dp[k][m]=calc(2,m-1)+calc(3,m-1)+calc(4,m-1)+calc(5,m-1)+calc(6,m-1)+calc(7,m-1);
	if(k==7)dp[k][m]=calc(1,m-1)+calc(2,m-1)+calc(3,m-1)+calc(4,m-1)+calc(5,m-1)+calc(6,m-1)+calc(7,m-1);
	dp[k][m]=dp[k][m]%10007;
	return dp[k][m];
}
int main() {
	cin>>N;

	//3.?????????
	for(int i=0;i<8;i++){
		for(int j=0;j<1001;j++){
			dp[i][j]=-1;
		}
	}
	//4.??\???
	for(int i=1;i<N+1;i++){
		cin>>D[i];
		if(D[i]=='J'){
			dp[1][i]=0;
			dp[2][i]=0;
			dp[3][i]=0;
		}
		if(D[i]=='O'){
			dp[1][i]=0;
			dp[4][i]=0;
			dp[5][i]=0;
		}
		if(D[i]=='I'){
			dp[2][i]=0;
			dp[4][i]=0;
			dp[6][i]=0;
		}
	}

	//5.???????????¨???
		dp[4][1]=1;
		dp[5][1]=1;
		dp[6][1]=1;
		dp[7][1]=1;
		dp[1][1]=0;
		dp[2][1]=0;
		dp[3][1]=0;

	if(D[1]=='O'){
		dp[4][1]=0;
		dp[5][1]=0;
	}
	if(D[1]=='I'){
		dp[4][1]=0;
		dp[6][1]=0;
	}

	//6.??????
	int total=0;
	for(int i=1;i<8;i++){
		total+=calc(i,N);
		total=total%10007;
	}
	cout<<total<<endl;



	return 0;
}

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

//前処理は O(n)、毎回の二項係数計算は O(1)

const int MAX = 510000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < 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;
	}
}

// 二項係数計算
long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

map<int, int>prime_factor(int n) {
	map<int, int>res;
	for (int i = 2; i*i <= n; i++) {
		while (n%i == 0) {
			res[i]++;
			n /= i;
		}
	}
	if (n != 1)res[n]++;//nは素数
	return res;
}


int main() {
	// 前処理
	COMinit();
	int n, m;
	cin >> n >> m;
	map<int, int>mp = prime_factor(m);
	long long ans = 1;
    long long d = 1;
	for (int i = 2; i*i <= m; i++) {
		if (mp[i] > 0) {
			//iの素因数
			ans *= COM(n + mp[i] - 1, mp[i]);
			ans %= MOD;
                        for (int j = 0; j < mp[i]; j++) {
                            d *= i;
                        }
			//n/iの素因数
			if ((m / d) * (m / d) > m) {
				ans *= COM(n + mp[m / d] - 1, mp[m / d]);
				ans %= MOD;
			}
		}
	}
	if (mp[m] == 1)ans = n;
	cout << ans << endl;
}


Measured memory_bytes: 13696
Sec = input()
S = int(Sec)
h = int(S/3600)
m = int(S%3600/60)
s = S%3600%60
st=(str(h)+':'+str(m)+':'+str(s))
print(st)
#1h=3600s
#1m=60s
#1s=1s
'''
8000s
h=2
8000%60=20
'''



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

int main()
{
    int n;
    while (cin >> n && n) {
        int t[100]={0}, h[100]={0}, c[200]={0};

        for(int i=0, idx;i < n;++i) { cin >> idx; c[idx-1] = 1; }

        for(int i=0,idx[2]={0};i < n*2;++i) {
            if (c[i]) t[idx[0]++] = i+1;
            else h[idx[1]++] = i+1;
        }

        int mx, tn, hn;
        tn = hn = n;
        mx = 0;

        while(tn && hn) {
            bool flag = true;
            for(int i=0;i < n;++i) {
                if (t[i] && mx < t[i]) {
                    mx = t[i]; t[i] = 0; --tn;
                    flag = false;
                    break;
                } 
            }
            
            if (!hn || !tn) break;
            else if (flag) mx = 0;

            flag = true;

            for(int i=0;i < n;++i) {
                if (h[i] && mx < h[i]) {
                    mx = h[i]; h[i] = 0; --hn;
                    flag = false;
                    break;
                }
            }

            if (flag) mx = 0;
        }

        printf("%d\n%d\n", hn, tn);
    }
    return 0;
}

Measured memory_bytes: 1148