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

using namespace std; 

#define pb push_back
#define ppb pop_back
#define pf push_front
#define ppf pop_front
#define mmp make_pair
#define st first
#define nd second
#define rd third
#define ll long long
#define pii pair <int, int>
#define tri pair <pii, int>
#define itr pair <int, pii>
#define pq priority_queue
#define all(v) (v).begin(), (v).end()
#define REP(i, n) for (int (i) = 0; (i) < (int)(n); i++)
#define FOR(i, a, n) for (int (i) = (a); (i) < (int)(n); i++)
#define FORN(i, a, n) for (int (i) = (a); (i) > (int)(n); i--)
#define Rep(i, n) for (int (i) = 0; (i) <= (int)(n); i++)
#define For(i, a, n) for (int (i) = (a); (i) <= (int)(n); i++)
#define Forn(i, a, n) for (int (i) = (a); (i) >= (int)(n); i--)
#define rep(i, n) for (int (i) = 1; (i) <= (int)(n); i++)
#define EACH(it, a) for (__typeof(a.begin()) it = a.begin(); it != a.end(); it++)

#define DEBUG(x) cout << #x << " = " << (x) << endl; 
#define PR(a, n) {cout << #a << " = "; FOR(_, 1, n) cout << a[_] << ' '; puts(""); }
#define PRO(a, n) { cout << #a << " = "; REP(_, n) cout << a[_] << ' '; puts(""); }
#define pi 3.1415926535897932384626433832795028841971
//#define LOCAL

const int INF = 1e9; 
const int Maxn = 1005; 
const int dx[] = {-1, 0, 1, 0}; 
const int dy[] = {0, 1, 0, -1}; 

struct pos { int first, second, third; }; 

int n, m; 

vector <vector <int> > g; 
vector <bool> was; 
vector <int> f; 

int dfs(int v)
{
	if (was[v]) return f[v]; 
	
	was[v] = true; 
	REP(i, g[v].size()) f[v] = max(f[v], dfs(g[v][i]) + 1); 
	
	return f[v]; 
}

int main()
{
	#ifdef LOCAL
		freopen("input.txt", "r", stdin); 
		freopen("output.txt", "w", stdout); 
	#endif
	
	scanf("%d%d", &n, &m); 
	g.resize(n + 1); 
	was.resize(n + 1); 
	f.resize(n + 1); 
	
	REP(i, m)
	{
		int x, y; 
		scanf("%d%d", &x, &y); 
		g[x].pb(y); 
	}
	
	int ans = 0; 
	rep(i, n) ans = max(ans, dfs(i)); 
	
	printf("%d\n", ans); 
	
	return 0; 
}

Measured memory_bytes: 8192
from collections import Counter
s = input()
i = 0
while i < len(s):
    if s[i] == 'd':
        S = s[i:i + 5]
        if i + 6 < len(s):
            if S + s[i + 5] + s[i + 6] == "dreamer":
                i += 7
                if i + 3 < len(s):
                    if s[i:i + 4] == "aser":
                        i += 4
                        continue
                if i + 2 < len(s):
                    if s[i:i + 3] == "ase":
                        i += 3
                        continue
                continue
        if S == "dream":
            i += 5
            continue
        break
    elif s[i] == 'e':
        S = s[i:i + 5]
        if i + 5 < len(s):
            if S + s[i + 5] == "eraser":
                i += 6
                continue
        if S == "erase":
            i += 5
            continue
        break
    else:
        break
    if i + 4 >= len(s):
        break
else:
    print("YES")
    exit()
print("NO")

Measured memory_bytes: 73580
use std::io::stdin;

fn main() {
    let mut s = String::new();
    stdin().read_line(&mut s).unwrap();
    let a = s[0..2].parse::<usize>().unwrap();
    let b = s[2..4].parse::<usize>().unwrap();
    let a_b = (a <= 12) && (a>0);
    let b_b = (b <= 12) && (b>0);
    println!("{}", match (a_b, b_b) {
        (true, true) => "AMBIGUOUS",
        (false, true) => "YYMM",
        (true, false) => "MMYY",
        (false, false) => "NA",
    });
}

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

template<class T> void vin(vector<T>& v, int n) {
    v.resize(n);
    for (int i = 0; i < n; ++i) {
        cin >> v[i];
    }
}

int a[1000000];

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

    int l = 0, r = N-1;
    for (int t = 0; t < 20; ++t) {
        int m;
        if (t == 0) m = l;
        else if (t == 1) m = r;
        else { m = (l + r) / 2; }

        cout << m << endl;
        string s;
        cin >> s;

        if (s == "Vacant") {
            return 0;
        }
        else if (s == "Male") {
            a[m] = 1;
        }
        else {
            a[m] = 2;
        }

        if (t >= 2) {
            if (((m-l)%2 and a[l] == a[m]) or ((m-l)%2==0 and a[l] != a[m])) {
                r = m;
            }
            else if (((r-m)%2 and a[m] == a[r]) or ((r-m)%2==0 and a[m] != a[r])) {
                l = m;
            }
        }
    }
    return 0;
}


Measured memory_bytes: 852
using System;

namespace A___White_Cells
{
    class Program
    {
        static void Main (string[] args)
        {
            var input = Console.ReadLine ().Split (' ');
            var h = int.Parse (input[0]);
            var w = int.Parse (input[1]);
            input = Console.ReadLine ().Split (' ');
            var h1 = int.Parse (input[0]);
            var w1 = int.Parse (input[1]);
            Console.WriteLine ((h * w) - ((h1 * w) + (w1 * h) - (h1 * w1)));
        }
    }
}

Measured memory_bytes: 13140
N = int(input())
A = []
XY = []
honest_count = []

for i in range (N):
    a = int(input())
    A.append(a)
    inter = []
    for x in range(a):
        xy = list(map(int, input().split()))
        inter.append(xy)
    XY.append(inter)

for i in range(2 ** N):
    pt = [0] * N
    ck = 1
    for j in range(N):
        if (i >> j) & 1:
            pt[N - j - 1] = 1

    for k in range(N): # k人目が正直者の場合チェック
        if pt[k] == 1:
            for l in range(A[k]):
                if XY[k][l][1] != pt[XY[k][l][0] - 1]:
                    ck = 0
    if ck == 1:
        honest_count.append(sum(pt))


print(max(honest_count))

Measured memory_bytes: 3444
#include <iostream>
#include <cmath>
#include <stdio.h>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <cstring>

using namespace std;

#define f first
#define s second
#define pb push_back
#define mp make_pair
#define ll long long
#define pii pair < int, int >
#define pll pair < long long, long long>
#define ull unsigned long long
#define vi vector <int>
#define sz(a) (int)a.size()
#define forit(it, s) for(__typeof(s.begin()) it = s.begin(); it != s.end(); it++)
#define all(a) a.begin(), a.end()
#define sqr(x) ((x) * (x))
#define fname "searching"

const int inf = (int)1e9;
const ll INF = (ll)1e18;
const double eps = 1e-9;
const double pi = acos(-1.0);
const int mod = (int)1e9 + 7;

int d[100100];
int u[100100];
int n, a[100100];
int v[100100];
queue<int> q;

int main(){
	// freopen("input.txt", "r", stdin);
	// freopen(fname".in", "r", stdin);
	// freopen(fname".out", "w", stdout);
	scanf("%d", &n);
	for(int i = 0; i < n; ++i){
		scanf("%d", &a[i]);
		v[i] = a[i] - 1;
	}
	q.push(0);
	while(!q.empty()){
		int cur = q.front();
		q.pop();
		int to = v[cur];
		if(!u[to]){
			u[to] = 1;
			q.push(to);
			d[to] = d[cur] + 1;
		}
	}
	if(!u[1]){
		printf("-1\n");
	}else{
		printf("%d\n", d[1]);
	}
	return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
 
int main()
{
	int n;
	cin>>n;
 
	double prob[n];
	for(int i=0;i<n;i++)
		cin>>prob[i];
	double dp[n+1][n+1]={1.0};
double r=1.0;
	for(int z=1;z<=n;z++)
		{
		    r*=1.0-prob[z-1];
		    dp[z][0]=r;
		}
 
	for(int u=1;u<=n;u++)
	{
		for(int v=1;v<=n;v++)
		{
			if(v<u)
				dp[u][v]=(dp[u-1][v]*(1.0-prob[u-1]))+(dp[u-1][v-1]*prob[u-1]);
		
			else if(v==u)
				dp[u][v]=dp[u-1][v-1]*prob[u-1];
			else
			    dp[u][v]=0;
		}
	}
double s=0.0;
	for(int t=n/2+1;t<=n;t++)
		s+=dp[n][t];
	cout<<setprecision(10)<<s;
	return 0;
 
}

Measured memory_bytes: 70528
fun main(args: Array<String>) {
  val n = readInt()
  for (x in 1..50000) {
    if (n == (x.toDouble() * 1.08).toInt()) {
      println(x)
      return
    }
  }
  println(":(")
}

fun readString() = readLine()!!
fun readStrings() = readString().split(' ')
fun readInt() = readString().toInt()
fun readInts() = readStrings().map { it.toInt() }



Measured memory_bytes: 31756
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		String a = sc.nextLine();
      	String A = ("A");
		if(a.equals("A")){
        	System.out.println(A);
        }
		else if(a.equals("B")){
        	System.out.println(A);
        }
		else if(a.equals("C")){
        	System.out.println(A);
        }
		else if(a.equals("D")){
        	System.out.println(A);
        }
		else if(a.equals("E")){
        	System.out.println(A);
        }
		else if(a.equals("F")){
        	System.out.println(A);
        }
		else if(a.equals("G")){
        	System.out.println(A);
        }
		else if(a.equals("H")){
        	System.out.println(A);
        }
		else if(a.equals("I")){
        	System.out.println(A);
        }
		else if(a.equals("J")){
        	System.out.println(A);
        }
		else if(a.equals("K")){
        	System.out.println(A);
        }
		else if(a.equals("L")){
        	System.out.println(A);
        }
		else if(a.equals("M")){
        	System.out.println(A);
        }
		else if(a.equals("N")){
        	System.out.println(A);
        }
		else if(a.equals("O")){
        	System.out.println(A);
        }
		else if(a.equals("P")){
        	System.out.println(A);
        }
		else if(a.equals("Q")){
        	System.out.println(A);
        }
		else if(a.equals("R")){
        	System.out.println(A);
        }
		else if(a.equals("S")){
        	System.out.println(A);
        }
		else if(a.equals("T")){
        	System.out.println(A);
        }
		else if(a.equals("U")){
        	System.out.println(A);
        }
		else if(a.equals("V")){
        	System.out.println(A);
        }
		else if(a.equals("W")){
        	System.out.println(A);
        }
		else if(a.equals("X")){
        	System.out.println(A);
        }
		else if(a.equals("Y")){
        	System.out.println(A);
        }
		else if(a.equals("Z")){
        	System.out.println(A);
        }
      	else{
        	System.out.println("a");
        }
	}
}

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

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

    //good luck kittu!
    int n; cin>>n;
    n = n*(n+1)/2;
    cout<<n<<"\n";
    return 0;
}

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

int main(){
	int a,b,c;
	cin>>a>>b>>c;
	if(a==b&&b==c&&a%2==0){
	    cout<<-1<<endl;
	    return 0;
	}
	int ans=0;
	while(a%2==0&&b%2==0&&c%2==0){
	    ans++;
	    int a1=(b+c)/2;
	    int b1=(c+a)/2;
	    int c1=(a+b)/2;
	    a=a1;
	    b=b1;
	    c=c1;
	}
	cout<<ans<<endl;
	
}

Measured memory_bytes: 256
N,M=map(int,input().split())
H=list(map(int,input().split()))
AB=[list(map(int,input().split())) for i in range(M)]
anlist=[1]*N
for i in range(M):
  if H[AB[i][1]-1]>H[AB[i][0]-1]:
    anlist[AB[i][0]-1]=0
  elif H[AB[i][1]-1]<H[AB[i][0]-1]:
    anlist[AB[i][1]-1]=0
  else:
    anlist[AB[i][0]-1]=0
    anlist[AB[i][1]-1]=0
ans=sum(anlist)
print(ans)
    

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

int main() {
    int n;
    cin >> n;
    vector<int> S(n);
    for (int i = 0; i < n; i++) cin >> S[i];

    sort(S.begin(), S.end());

    int q;
    cin >> q;
    int ans = 0;
    for (int i = 0; i < q; i++) {
        int T;
        cin >> T;
        if (*lower_bound(S.begin(), S.end(), T) == T) ans++;
    }

    cout << ans << endl;
}


Measured memory_bytes: 3152
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second

const int mx=100010;
const ll mod=1e9+7;


int main(){
  int n,k; cin >> n >> k;
  string s; cin >> s;
  vector<int> m;

  int cur=0;
  char now=s[0];
  m.emplace_back(0);
  rep(i,n){
    if(s[i]!=now){
      m.emplace_back(i);
      now = s[i];
    }
  }
  int msz = m.size();
  rep(i,2*k+1){m.emplace_back(n);}  
  
  int ans = 0;
  rep(i,msz){
    int tmp=0;
    if(s[m[i]]=='1'){
      tmp = m[i+2*k+1] - m[i];
    } else {
      tmp = m[i+2*k] - m[i];
    }
    ans = max(ans,tmp);
  }
  
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1528
#include<stdio.h>
int main(void)
{
	int n,s[1700];
	int i[1000],p[1000],q[1000],r[1000];
	int a,b,c,d;
	int flag;
	int j;
	scanf("%d",&n);
	while(n!=0){	
		flag=0;
		for(j=0;j<n;j++){
			scanf("%d %d %d %d",&i[j],&p[j],&q[j],&r[j]);
			s[j]=p[j]*4+q[j]*9+r[j]*4;
		}
		scanf("%d %d %d %d",&a,&b,&c,&d);
		for(j=0;j<n;j++){
			if(p[j]<=a && q[j]<=b && r[j]<=c && s[j]<=d){
				printf("%d\n",i[j]);
				flag=1;
			}
		}
		if(flag==0){
			printf("NA\n");
		}
		scanf("%d",&n);
	}
	return 0;
}

Measured memory_bytes: 1060
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
using namespace std;
using lint = long long;//
template <typename T>
T sq (T x) {
    return x * x;
}

signed main () {
    int N,K;
    cin >> N >> K;
    vector<int> D(K);
    rep(i,K) cin >> D.at(i);
    for (int ans = N ; N < 100000; ans++){
        int e = (ans / 10000) % 10;
        int a = (ans / 1000) % 10;
        int b = (ans / 100) % 10;
        int c = (ans/10) % 10;
        int d = ans % 10;
        if(ans >= 10000){
            if (count(all(D),e)!=0)continue;
        }
        if(ans >= 1000){
            if(count(all(D),a)!=0)continue;
        }
        if(ans >= 100 ){
            if(count(all(D),b)!=0)continue;
        }
        if(ans >= 10){
            if(count(all(D),c)!=0)continue;
        }
        if(count(all(D),d)!=0)continue;
        cout << ans <<endl;
        return 0 ;

    }
}


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

int main(void){
    int a,b,c,tmp;
    cin >> a >> b >> c;
    if(a > b){
        tmp = a;
        a = b;
        b = tmp;
    }
    if(b > c){
        tmp = b;
        b = c;
        c = tmp;
    }
    if(a > b){
        tmp = a;
        a = b;
        b = tmp;
    }
    cout << a << " " << b << " " << c << endl;
}



Measured memory_bytes: 3084
#include <bits/stdc++.h>
#define MOD (long long)(1E9+7)
#define rep(i, n) for(int i = 0; i < n; i++)

using namespace std;

int main(){
  	int h,n,t = 0;
	cin >>h>>n;
  	int dp[n+1][h+1];
	vector<int> a(n);
	vector<int> b(n);
  	rep(i, n) {
    	cin >> a[i]>> b[i];
      	for(int j = 0; j <= h; j++) {
          	t = (b[i]*((j-1)/a[i]+1));
       		if(i == 0) {
          		dp[i][j] = t;
           		continue;
            }
          	dp[i][j] = min(t, dp[i-1][j]);
          	if(j >= a[i]) {
          		dp[i][j] = min(dp[i][j], dp[i][j-a[i]] + b[i]);
            }
        }
    }
  	cout << dp[n-1][h] << endl;
}


Measured memory_bytes: 39296
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <sstream>
#include <unordered_map>
#include <vector>


#define INF 4000000000000000000LL
#define MOD 1000000007
#define ALL(x) std::begin(x), std::end(x)


int main(int argc, char** argv)
{
  std::cin.tie(0);
  std::ios_base::sync_with_stdio(0);

  std::cout << std::fixed << std::setprecision(6);
  std::cerr << std::fixed << std::setprecision(6);

  int N, A[222222];

  std::cin >> N;

  for (int i = 0; i < N; i ++)
    std::cin >> A[i];

  std::multiset<int> set(A, A + N);

  for (int i = 0; i < N; i ++) {
    auto it = set.find(A[i]);

    assert(it != std::end(set));

    set.erase(it);

    std::cout << *set.rbegin() << std::endl;

    set.insert(A[i]);
  }
  
  return 0;
}


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

using namespace std;

// Repetitions
#define FOR(i,a,n) for(ll i = ((ll) a); i < ((ll) n); ++i)
#define FORR(i, s, g) for(ll i = ((ll)s - 1); i >= ((ll) g); --i)
#define REP(i, n) FOR(i, 0, n)
#define REPR(i, n) FORR(i, n, 0)

// Container Utils
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define SORTALL(v) sort(ALL(v))
#define SZ(a) int((a).size())
#define CLR(a) memset((a), 0 ,sizeof(a))
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())

// For Debug
#define DMP(x)  cerr << #x << " = " << (x) << endl
#define DBG(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl

// Aliases
#define PB push_back
#define MP make_pair
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<long long> vll;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;

// I/O Asynchronizing
struct aaa{
    aaa(){
        cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);
    };
}aaaaaaa;

int main() {
    int n;
    cin >> n;
    int cnt = 0;
    FOR(i, 1, n + 1) {
        if(to_string(i).length() % 2 == 1) cnt++;
    }

    cout << cnt << "\n";

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <string>
#include <vector>
#include <math.h>
#include <queue>
#include <map>
#define ll long long
const int MOD = 1e9+7;
using namespace std;

int par[100000];
int ran[100000];
int fri[100000];
int blo[100000];
int coun[100000];

void init(int n){
	for (int i = 0; i < n; i++){
		par[i] = i;
		ran[i] = 0;
	}
}

int find(int x){
	if (par[x] == x){
		return x;
	}else{
		return par[x] = find(par[x]);
	}
}

void unite(int x, int y){
	x = find(x);
	y = find(y);
	if (x == y) return;

	if (ran[x] < ran[y]){
		par[x] = y;
	}else{
		par[y] = x;
		if (ran[x] == ran[y]) ran[x]++;
	}
}

bool same(int x, int y){
	return find(x) == find(y);
}

int main(){
	int n, m, k;
	cin >> n >> m >> k;
	init(n);
	for (int i = 0; i < m; i++){
		int a, b;
		cin >> a >> b;
		fri[a-1]++;
		fri[b-1]++;
		unite(a-1, b-1);
	}

	for (int i = 0; i < k; i++){
		int c, d;
		cin >> c >> d;
		if (same(c-1, d-1)){
			blo[c-1]++;
			blo[d-1]++;
		}
	}

	for (int i = 0; i < n; i++){
		coun[find(i)]++;
	}
	
	for (int i = 0; i < n; i++){
		cout << max(0, coun[find(i)] - fri[i] - blo[i] - 1) << " ";
	}
	cout << endl;
	return 0;
}


Measured memory_bytes: 2688
#include <iostream>
#include <vector>
#include <cassert>
#include <cmath>
#include <algorithm>

using ll = long long;

#define MIN(a, b) (((a) < (b)) ? (a) : (b))
#define MAX(a, b) (((a) < (b)) ? (b) : (a))

int const nmax = 100000;
int const rad = 500;
int const modulo = 998244353;
std::vector<int> g[3][1 + nmax];
int nimber[3][1 + nmax];

int lgpow(int a, int b) {
  if(b == 0)
    return 1;
  else if(b == 1)
    return a;
  else {
    int result = lgpow(a, b / 2);
    if(b % 2 == 0)
      return 1LL * result * result % modulo;
    else
      return 1LL * result * result % modulo * a % modulo;
  }
}

int mex(std::vector<int> v) {
  std::sort(v.begin(), v.end());
  v.erase(std::unique(v.begin(), v.end()), v.end());
  for(int i = 0; i < v.size(); i++)
    if(i != v[i])
      return i;
  return v.size();
}

int sum[3][5 + nmax];

int main() {
  int n, m[3];
  std::cin >> n;
  for(int h = 0; h < 3; h++) {
    std::cin >> m[h];
    for(int i = 1;i <= m[h]; i++){
      int x, y;
      std::cin >> x >> y;
      if(y < x)
        std::swap(x, y);
      g[h][x].push_back(y);
    }
    std::vector<int> cand;
    for(int i = n; 1 <= i; i--) {
      cand.clear();
      for(int h_ = 0; h_ < g[h][i].size(); h_++){
        int to = g[h][i][h_];
        cand.push_back(nimber[h][to]);
      }
      nimber[h][i] = mex(cand);
      sum[h][nimber[h][i]] = (sum[h][nimber[h][i]] + lgpow(10, 18 * i)) % modulo;
    }
  }

  int result = 0;
  
  for(int i = 0; i < rad; i++)
    for(int j = 0; j < rad; j++)
      if((i ^ j) < rad) { 
        result = (result + 1LL * sum[0][i] * sum[1][j] % modulo * sum[2][i ^ j]) % modulo;
      }
  std::cout << result;
}


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

int main(){
    int N,X,L[100],sum=0,ans=1;
    cin >>N>>X;
    for(int i=0;i<N;i++){
        cin >>L[i];
    }
    for(int i=0;i<N;i++){
        sum=sum+L[i];
        if(sum<=X){
            ans++;
        }
    }
    cout <<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))

cnt = 0
for i in range(n):
    minj = i
    for j in range(i+1,n):
        if a[j]<a[minj]:
            minj = j
    if minj!=i:
        a[i], a[minj] = a[minj], a[i]
        cnt+=1

print(*a)
print(cnt)


Measured memory_bytes: 5608
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

int N, K;

string S;

int main(void) {

	cin >> N >> K;
	cin >> S;

	S = "#" + S + "#";

	int ans = 0;
	int H = 0;

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

	
	for (int i = 1; i <= K; i++) {
		ans += 2;
	}

	ans = min(ans, N - 1);

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 512
n = int(input())
A = [list(map(int, input().split())) for i in range(2)]

score = A[0][0] + sum(A[1])
ans = A[0][0] + sum(A[1])
for i in range(n-1):
    score = score - A[1][i] + A[0][i+1]
    ans = max(ans, score)

print(ans)


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

typedef pair<int,int> P;

int N, M;
priority_queue<int> Q;
vector<P> A;

signed main(){
  
  cin>>N>>M;
  
  for(int i=0;i<N;i++){
    int a;
    cin>>a;
    Q.push(a);
  }
  
  for(int i=0;i<M;i++){
    int b, c;
    cin>>b>>c;
    A.push_back(P(c,b));
  }
  
  sort(A.begin(),A.end());
  
  int cnt = N;
  int idx = M-1;
  
  while(cnt){
    
    while( cnt && A[idx].second ){
      Q.push(A[idx].first);
      cnt--;
      A[idx].second--;
    }
    
    idx--;
    
    if( idx < 0 ) break;
      
  }
  
  int ans = 0;
  cnt = N;
  
  while(cnt){

    ans += Q.top(); Q.pop();
    
    cnt--;
    
  }
  
  cout<<ans<<endl;
  
  return 0;
}


Measured memory_bytes: 3952
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <iterator>  // std::back_inserter()
#include <set>
#include <algorithm>  // std::copy()
#include <functional>  // std::greater<T>()
#include <utility>  // std::swap()
#include <numeric>  // accumulate(ALL(vec), 0)  0 は初期値
#include <cmath>
#include <climits>  // INT_MIN
#include <cctype>  // std::isdigit()
using namespace std;

#define ALL(obj) (obj).begin(), (obj).end()
#define REP(i, n) for (int i=0; i < (int)(n); i++)  // 0 ~ n-1
#define REPN(i, n) for (int i=1; i <= (int)(n); i++)  // 1 ~ n
#define MIN(vec) min_element(ALL((vec)))  // イテレータのため、値を取り出すときは * を先頭につける
#define MAX(vec) max_element(ALL((vec)))
#define IDX(vec, element_iter) distance((vec).begin(), element_iter)
#define SUM(vec) accumulate(ALL((vec)), 0)  // 0 は初期値
#define COPY(vec1, vec2) copy(ALL(vec1), back_inserter(vec2))  // vec1をvec2にコピーする vec2は空にしておく必要あり
typedef long long ll;

const int MOD = 1000000007;  // 1 000 000 007


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

    // input
    string A;
    cin >> A;
    
    // calc
    int sum = 0;
    REP(i, 4) {
        if (A[i] == '2') {
            sum++;
        }
    }
    cout << sum << "\n";
    return 0;
}


Measured memory_bytes: 768
mod = 998244353

N = int(input())
A = [int(input()) for _ in range(N)]

S = sum(A)

dp1 = [[0] * (S+1) for _ in range(N+1)]
dp1[0][0] = 1
for i in range(N):
    for r in range(S+1):
        if r + A[i] < S+1:
            dp1[i+1][r+A[i]] += dp1[i][r]
            dp1[i+1][r+A[i]] %= mod
        dp1[i+1][r] += 2 * dp1[i][r]
        dp1[i+1][r] %= mod

dp2 = [[0] * (S+1) for _ in range(N+1)]
dp2[0][0] = 1
for i in range(N):
    for r in range(S+1):
        if r + A[i] < S+1:
            dp2[i+1][r+A[i]] += dp2[i][r]
            dp2[i+1][r+A[i]] %= mod
        dp2[i+1][r] += dp2[i][r]
        dp2[i+1][r] %= mod

res1 = sum(dp1[N][r] for r in range(-(-S//2), S+1))
res2 = dp2[N][S//2] if S % 2 == 0 else 0

ans = pow(3, N, mod) - (3*res1 - 3*res2)
ans %= mod
print(ans)

Measured memory_bytes: 457224
n=int(input())
p=[[int(i)for i in input().split()] for _ in range(n)]
p.sort(key=lambda x: x[2])
a,b,c=p[-1]
for y in range(101):
    for x in range(101):
        h=c+abs(a-x)+abs(b-y)
        if all(k==max(h-abs(i-x)-abs(y-j),0) for i,j,k in p):
            print(x,y,h)
            exit()

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main(){int n,i,k=1,ans=0;
cin>>n;
int a[n];
for(i=0;i<n;i++){
    cin>>a[i];
}
for(i=0;i<n;i++){
    if(a[i]==k){ans++;
        k++;
    }
}if(k==1){cout<<"-1";return 0;}
cout<<n-ans;
    return 0;}

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

using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod = int(1e9)+7;
using V = vector<ll>;
using P = pair<ll,ll>;


int main(){
   string s;cin >>s;
   string ans="";
   ll n=s.size();
    for (int i = 0; i < n; ++i) {
        if(s[i]!='B'){
            ans+=s[i];
        }
        else {
            if(!ans.empty()){
                ans.erase(ans.size()-1);
            }
        }
    }
    cout <<ans <<endl;
    return 0;
}

Measured memory_bytes: 256
A = raw_input()
C = raw_input()

B = int(C)

num = map(int, str(A))

numnum = len(num)


i = 0

while num[i] == 1 and numnum-1 > i:
  i = i +1

  
if i < B:
  print num[i]
elif i > B-1:
  print 1



Measured memory_bytes: 2568
#include <iostream>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <vector>
#include <complex>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <bitset>
#include <ctime>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cassert>
#include <cstddef>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <sstream>
#include <fstream>

using namespace std;
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define FOR(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define RREP(i, a) for(int (i) = (a) - 1; (i) >= 0; (i)--)
#define FORR(i, a, b) for(int (i) = (a) - 1; (i) >= (b); (i)--)
#define DEBUG(C) cerr << #C << " = " << C << endl;
using LL = long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<LL>;
using VVL = vector<VL>;
using VD = vector<double>;
using VVD = vector<VD>;
using PII = pair<int, int>;
using PDD = pair<double, double>;
using PLL = pair<LL, LL>;
using VPII = vector<PII>;
template<typename T> using VT = vector<T>;
#define ALL(a) begin((a)), end((a))
#define RALL(a) rbegin((a)), rend((a))
#define SORT(a) sort(ALL((a)))
#define RSORT(a) sort(RALL((a)))
#define REVERSE(a) reverse(ALL((a)))
#define MP make_pair
#define FORE(a, b) for (auto &&a : (b))
#define FIND(s, e) ((s).find(e) != (s).end())
#define EB emplace_back

const int INF = 1e9;
const int MOD = INF + 7;
const LL LLINF = 1e18;

int main(void) {
	int H, W;
	cin >> H >> W;
	VT<string> C(H);
	REP(i, H) cin >> C[i];
	REP(i, H) {
		cout << C[i] << endl << C[i] << endl;
	}
}


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

const int INF = 1e9;
const int MOD = 1e9 + 7;

using namespace std;

typedef long long ll;

#define REP(i, n) for (int i = 0; i < int(n); i++)
#define REPD(i, n) for (int i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (int i = a; i < int(b); i++)
#define FORD(i, a, b) for (int i = b - 1; i >= int(a); i--)
#define WRAP(y, x, h, w) (0 <= y && y < h && 0 <= x && x < w)

#define ALL(x) (x).begin(), (x).end()

int gcd(int a, int b)
{
    return b ? gcd(b, a % b) : a;
}
int dx[4] = { 1, 0, -1, 0 };
int dy[4] = { 0, 1, 0, -1 };

int main()
{
    double pi = 3.14159265358979323;
    double a, b, h, m;
    cin >> a >> b >> h >> m;
    h += m / 60.0;
    h = pi / 2.0 - (h / 12.0) * 2 * pi;
    m = pi / 2.0 - (m / 60.0) * 2 * pi;
    double ax, ay, bx, by;
    ax = sin(h) * a;
    ay = cos(h) * a;
    bx = sin(m) * b;
    by = cos(m) * b;
    cout << fixed << setprecision(10) << sqrt((ax - bx) * (ax - bx) + (ay - by) * (ay - by)) << endl;
}

Measured memory_bytes: 4104
#include<queue>
#include<stack>
#include<math.h>
#include<cmath>
#include<bitset>
#include<stdio.h>
#include<string>
#include<map>
#include<algorithm>
#include<vector>
#include<iostream>
#include<utility>
#include<functional>
#include<deque>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
template<typename X,typename M>
  struct segtree{
    using FX=function<X(X,X)>;
    using FA=function<X(X,M)>;
    using FM=function<M(M,M)>;
    int n;
    FX fx;
    FA fa;
    FM fm;
    const X ex;
    const M em;
    vector<X> dat;
    vector<M> lazy;
    segtree(int n_,FX fx_,FA fa_,FM fm_,X ex_,M em_)
      :n(),fx(fx_),fa(fa_),fm(fm_),ex(ex_),em(em_),dat(n_*4,ex),lazy(n_*4,em){
        int x=1;
        while(n_>x){
          x*=2;
        }
        n=x;
      }
    void set(int i,X x){
      dat[i+n-1]=x;
    }
    void build(){
      for(int k=n-2;k>=0;k--){
        dat[k]=fx(dat[2*k+1],dat[2*k+2]);
      }
    }
    void eval(int k){
      if(lazy[k]==em){
        return;
      }
      if(k<n-1){
        lazy[k*2+1]=fm(lazy[k*2+1],lazy[k]);
        lazy[k*2+2]=fm(lazy[k*2+2],lazy[k]);
      }
      dat[k]=fa(dat[k],lazy[k]);
      lazy[k]=em;
    }
    void update(int a,int b,M x,int k,int l,int r){
      eval(k);
      if(a<=l && r<=b){
        lazy[k]=fm(lazy[k],x);
        eval(k);
      }
      else if(a<r && l<b){
        update(a,b,x,k*2+1,l,(l+r)/2);
        update(a,b,x,k*2+2,(l+r)/2,r);
        dat[k]=fx(dat[k*2+1],dat[k*2+2]);
      }
    }
    void update(int a,int b,M x){
      update(a,b,x,0,0,n);
    }
    X query_sub(int a,int b,int k,int l,int r){
      eval(k);
      if(r<=a  || b<=l){
        return ex;
      }
      else if(a<=l && r<=b){
        return dat[k];
      }
      else{
        X vl=query_sub(a,b,k*2+1,l,(l+r)/2);
        X vr=query_sub(a,b,k*2+2,(l+r)/2,r);
        return fx(vl,vr);
      }
    }
    X query(int a,int b){
      return query_sub(a,b,0,0,n);
    }
  };
int main(){
  using X=ll;
  using M=ll;
  auto fx=[](X x1,X x2) -> X{return min(x1,x2);};
  auto fa=[](X x,M m) -> X{return m;};
  auto fm=[](M m1,M m2) -> M{return m2;};
  long long ex=2147483647;
  long long em=2147483647;
  segtree<X,M> seg(100010,fx,fa,fm,ex,em);
  int i,n,q,a,b,c;
  ll d;
  cin >> n >> q;
  for(i=0;i<q;i++){
    cin >> a;
    if(a==0){
      cin >> b >> c >> d;
      seg.update(b,c+1,d);
    }
    else{
      cin >> b;
      cout << seg.query(b,b+1) << endl;
    }
  }
  return 0;
}


Measured memory_bytes: 9008
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
import java.util.NoSuchElementException;

public class Main {
	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		System.out.println(Math.min(a, b) * Math.min(Math.max(a, b), c) / 2);
	}
}

class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;

    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        } else {
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }

    private int readByte() {
        if (hasNextByte())
            return buffer[ptr++];
        else
            return -1;
    }

    private static boolean isPrintableChar(int c) {
        return 33 <= c && c <= 126;
    }

    public boolean hasNext() {
        while (hasNextByte() && !isPrintableChar(buffer[ptr]))
            ptr++;
        return hasNextByte();
    }

    public String next() {
        if (!hasNext())
            throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while (isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    public long nextLong() {
        if (!hasNext())
            throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while (true) {
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            } else if (b == -1 || !isPrintableChar(b)) {
                return minus ? -n : n;
            } else {
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }

    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
            throw new NumberFormatException();
        return (int) nl;
    }

    public double nextDouble() {
        return Double.parseDouble(next());
    }
}

Measured memory_bytes: 21332
#include<stdio.h>
#include<stdlib.h>

#define MAX 1000000

typedef struct{
  int parent;
  int left;
  int right;
}Node;

void RootedTree(int);
Node T[MAX];

int main(){
  int n,i,j;
  int k,id,child,x,depth;

  scanf("%d",&n);

  for(i=0;i<n;i++){
    T[i].parent=-1;
    T[i].left=-1;
    T[i].right=-1;
  }

  for(i=0;i<n;i++){
    scanf("%d%d",&id, &k);
    for(j=0;j<k;j++){
      scanf("%d",&child);
      T[child].parent=id;
      if(j==0) T[id].left=child;
      else if(j>0) T[x].right=child;
      x=child;
    }
  }

  for(i=0;i<n;i++) RootedTree(i);
  return 0;
}

void RootedTree(int n){
  int i=T[n].parent;
  int depth=0;

  while(i!=-1){
    i = T[i].parent;
    depth++;
  }

  if(depth == 0) printf("node %d: parent = %d, depth = %d, root, ",n ,T[n].parent, depth);
  else if(T[n].left == -1) printf("node %d: parent = %d, depth = %d, leaf, ",n ,T[n].parent, depth);
  else printf("node %d: parent = %d, depth = %d, internal node, ",n ,T[n].parent, depth);

  i=T[n].left;
  printf("[");
  if(i!=-1) printf("%d",i);

  while(i!=-1){
    i=T[i].right;
    if(i!=-1) printf(", %d",i);
  }
  printf("]\n");
}

Measured memory_bytes: 1788
import sys

input = sys.stdin.readline


def main():
    N, Y = map(int, input().split())

    ans = [-1, -1, -1]
    for x in range(N + 1):
        A = 10000 * x
        for y in range(N + 1 - x):
            z = N - (x + y)
            total = A + 5000 * y + 1000 * z
            if total == Y:
                ans = [x, y, z]
    print(*ans)


if __name__ == "__main__":
    main()


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

class UnionFind
{
public:
    vector<int> parent;
    vector<int> sz;
    
    UnionFind(int n): parent(n), sz(n)
    {
        for(int i=0;i<n;i++)
        {
            parent[i] = i;
            sz[i] = 1;
        }
    }

    int root(int x)
    {
        return parent[x]==x ? x : parent[x] = root(parent[x]);
    }

    bool same(int x, int y)
    {
        return root(x)==root(y);
    }

    void unite(int x, int y)
    {
        x = root(x);
        y = root(y);
        if (x != y)
        {
            if (sz[x] < sz[y])
            {
                parent[x] = y;
                sz[y] += sz[x];
            }
            else
            {
                parent[y] = x;
                sz[x] += sz[y];
            }
        }
    }

    int size(int x)
    {
        return sz[root(x)];
    }
};

#include <iostream>
#include <set>

int main()
{
    int N, M, K;
    cin>>N>>M>>K;
    vector<int> A(M), B(M);
    for (int i=0; i<M; i++)
        cin>>A[i]>>B[i],
        A[i]--, B[i]--;
    vector<int> C(K), D(K);
    for (int i=0; i<K; i++)
        cin>>C[i]>>D[i],
        C[i]--, D[i]--;

    UnionFind UF(N);
    for (int i=0; i<M; i++)
        UF.unite(A[i], B[i]);
    vector<set<int>> S(N);
    for (int i=0; i<N; i++)
        S[UF.root(i)].insert(i);
    vector<int> ans(N);
    for (int i=0; i<N; i++)
        ans[i] = UF.size(i)-1;
    for (int i=0; i<M; i++)
        if (S[UF.root(A[i])].count(B[i])>0)
        {
            ans[A[i]]--;
            ans[B[i]]--;
        }
    for (int i=0; i<K; i++)
        if (S[UF.root(C[i])].count(D[i])>0)
        {
            ans[C[i]]--;
            ans[D[i]]--;
        }
    for (int a: ans)
        cout<<a<<endl;
}


Measured memory_bytes: 10624
#include <iostream>
using namespace std;
typedef long long ll;

int main()
{
    ll n, x;
    cin >> n >> x;
    ll a[100001];
    for(int i = 0; i < n; i++){
        cin >> a[i];
    }
    ll ans = 0;
    if(a[0] > x){
        ans += a[0] - x;
        a[0] = x;
    }
    for(int i = 1; i < n; i++){
        if(a[i - 1] + a[i] > x){
            ans += a[i - 1] + a[i] - x;
            a[i] = x - a[i - 1];
        }
    }
    cout << ans << endl;
}

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

static long long f (long long n) {
    return n * (n+1) / 2;
}

int main (void) {
    int N;
    std::cin >> N;

    long long ans = 0;
    for ( int i = 1; i <= N; i++ ) {
        ans += i * f(N/i);
    }

    std::cout << ans << std::endl;
    return 0;
}


Measured memory_bytes: 3636
#include<bits/stdc++.h>
#define REP(x,y,z) for(int x=y;x<=z;x++)
#define MSET(x,y) memset(x,y,sizeof(x))
#define M 
using namespace std;
int main()
{
    int n;
    while (~scanf("%d", &n)) {
        int ans = n*n*n;
        printf("%d\n", ans);
    }
    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define vi vector<int>
#define pb push_back
#define INF 999999999
int main(){
    int n,m;
    cin>>n>>m;
    vector<vector<double>> data;
    rep(i,n){
        vector<double> tmp;
        double  a,b,c;
        cin>>a>>b>>c;
        tmp.pb(a);
        tmp.pb(b);
        tmp.pb(c);
        data.pb(tmp);
    }
    
    vector<int> com;
    rep(i,m)com.pb(1);
    rep(i,n-m)com.pb(0);
    sort(all(com));
    
    
    double ans = -INF;
    do{
        double sum = 0;
        
        vector<int> use;
        rep(i,n)if(com[i]==1)use.pb(i);
        rep(i,m){
            for(int j=0;j<i+1;j++){
                int x=0,y=0;
                rep(k,3){
                    sum+=(data[use[i]][k]-data[use[j]][k]) * (data[use[i]][k]-data[use[j]][k]);
                }
            }
        }
        ans = max(sum,ans);
        
    }while(next_permutation(all(com)));
    printf("%.20lf\n",ans);
}

Measured memory_bytes: 3344
def main():
    n = int(input())
    a_list = list(map(int, input().split()))

    all_xor = 0
    for a in a_list:
        all_xor ^= a

    x_list = [a ^ all_xor for a in a_list]

    print(*x_list, sep=" ")


if __name__ == "__main__":
    main()


Measured memory_bytes: 114312
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <map>
typedef long long ll;
#define rep(i,a,b) for(int i=a;i<b;++i)
#define rrep(i,a,b) for(int i=a;i>=b;--i)
using namespace std;

int N, A;
int x[111];
ll coudp[111][111][5555];
string divide[4] = { "dream","dreamer","erase","eraser" };
int main()
{
	string S;
	cin >> S;
	reverse(S.begin(), S.end());
	for (int i = 0; i < 4; i++)
	{
		reverse(divide[i].begin(), divide[i].end());
	}
	bool can = true;
	for (int j = 0; j < S.size();)
	{
		bool can2 = false;
		for (int i = 0; i < 4; i++)
		{
			string d = divide[i];
			if (S.substr(j, d.size()) == d)
			{
				can2 = true;
				j += d.size();
			}
		}
		if (!can2)
		{
			can = false;
			break;
		}
	}

	if (can)cout << "YES" << endl;
	else cout << "NO" << endl;

	return 0;
}

Measured memory_bytes: 512
#!/usr/bin/env python
# -*- coding: utf-8 -*-

def solve():
    n, m = map(int, input().split())
    am = set(int(input()) for i in range(m))
    ans = [0] * (n + 10)
    ans[0] = 1
    md = 10 ** 9 + 7
    for i in range(n):
        if (i + 1) not in am:
            ans[i + 1] += ans[i]
            ans[i + 1] %= md
        if (i + 2) not in am:
            ans[i + 2] += ans[i]
            ans[i + 2] %= md
    print(ans[n])

if __name__=="__main__":
    solve()


Measured memory_bytes: 11884
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <numeric>
#include <utility>
#include <tuple>

#define REP(i, a, b) for (int i = int(a); i < int(b); i++)
using namespace std;
using ll = long long int;
using P = pair<ll, ll>;

// clang-format off
#ifdef _DEBUG_
#define dump(...) do{ cerr << __LINE__ << ":\t" << #__VA_ARGS__ << " = "; PPPPP(__VA_ARGS__); cerr << endl; } while(false)
template<typename T> void PPPPP(T t) { cerr << t; }
template<typename T, typename... S> void PPPPP(T t, S... s) { cerr << t << ", "; PPPPP(s...); }
#else
#define dump(...) do{ } while(false)
#endif
template<typename T> vector<T> make_v(size_t a, T b) { return vector<T>(a, b); }
template<typename... Ts> auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v(ts...))>(a, make_v(ts...)); }
template<typename T> bool chmin(T &a, T b) { if (a > b) {a = b; return true; } return false; }
template<typename T> bool chmax(T &a, T b) { if (a < b) {a = b; return true; } return false; }
template<typename T> void print(T a) { cout << a << endl; }
template<typename T, typename... Ts> void print(T a, Ts... ts) { cout << a << ' '; print(ts...); }
template<typename T> istream &operator,(istream &in, T &t) { return in >> t; }
// clang-format on

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int a,b;
    cin, a, b;
    cout << a * b << endl;
    return 0;
}


Measured memory_bytes: 3648
N, Q = map(int, input().split())
S = input()
t = [0]*(N+1)
for i in range(N):
    t[i+1] = t[i] + (1 if S[i:i+2] == 'AC' else 0)
for i in range(Q):
    l, r = map(int, input().split())
    print(t[r-1] - t[l-1])

Measured memory_bytes: 9540
#include<bits/stdc++.h>
using namespace std;
int main(){
  int A, B;
  cin >> A >> B;
  for(int i=0; i<100000; i++){
    int x = i*0.08;
    int y = i*0.1;
    if(x == A && y == B){
      cout << i << endl;
      break;
    }
    if(i == 99999){
      cout << -1 << endl;
    }
  }
}

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

namespace AtCoder_20190707_1
{    class Program
    {
        static List<List<int>> allA = new List<List<int>>();
        static void Main(string[] args)
        {
            string N = Console.ReadLine();

            for (int i = 0; i < N.Length; i++)
            {
                if(N[i] == '7')
                {
                    Console.WriteLine("Yes");
                    return;
                }
            }

            Console.WriteLine("No");
        }
    }
}

Measured memory_bytes: 25756
#include <iostream>
#include <vector>
#include <map>
#include <cstdio>
#include <string>
#include <algorithm>
using namespace std;

int main(void){
	long long K, A, B;
	cin >> K >> A >> B;
	long long sum = 1;
	if (A >= B - 2){
		sum = 1 + K;
	}else{
		int money = 0;
		while (K > 0){
			if (money >= 1){
				sum += B;
				money -= 1;
			} else if (sum >= A){
				sum -= A;
				money += 1;
			} else{
				sum++;
			}
			--K;
		}
		if (money != 0){
			sum += money * (A + 1);
		}
	}
	cout << sum << endl;
    return 0;
}


Measured memory_bytes: 256
n,k=map(int,input().split())
h=list(map(int,input().split()))
dp=[0]*n
for i in range(1,n):
    cnt=[]
    for j in range(max(0,i-k),i):
        cnt.append(dp[j]+abs(h[j]-h[i]))
    dp[i]=min(cnt)
print(dp[-1])


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

using namespace std;

#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl
#define DEBUG_MAT(v) cerr<<#v<<endl;for(int i=0;i<v.size();i++){for(int j=0;j<v[i].size();j++) {cerr<<v[i][j]<<" ";}cerr<<endl;}


typedef long long ll;
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
template<class S, class T> pair<S, T> operator+(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first + t.first, s.second + t.second); }
template<class S, class T> pair<S, T> operator-(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first - t.first, s.second - t.second); }
template<class S, class T> ostream& operator<<(ostream& os, pair<S, T> p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
#define X first
#define Y second
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define rrep1(i,n) for(int i=(n);i>0;i--)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define in(x, a, b) (a <= x && x < b)
#define all(c) c.begin(),c.end()
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a = b; return 1; } return 0; }
#define UNIQUE(v) v.erase(std::unique(v.begin(), v.end()), v.end());
const ll inf = 1000000001;
const ll INF = (ll)1e18 + 1;
const ll MOD = 1000000007;
//const ll MOD = 998244353;
const double pi = 3.14159265358979323846;
#define Sp(p) cout<<setprecision(15)<< fixed<<p<<endl;
int dx[4] = { -1,0, 1,0 }, dy[4] = { 0,1,0,-1 };
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };
#define fio() cin.tie(0); ios::sync_with_stdio(false);
//#define mp make_pair

vi c(111111);
vector<vector<pll> > G(111111);

void dfs(int now, int par, ll d) {
  c[now] = d % 2;
  rep (i, G[now].size()) {
    int ch = G[now][i].first;
    if (ch == par) continue;
    dfs(ch, now, d + G[now][i].second);
  }
}

int main() {
  int n;
  cin >> n;
  rep (i, n - 1) {
    int u, v, w;
    cin >> u >> v >> w;
    u--; v--;
    G[u].push_back(pll(v, w));
    G[v].push_back(pll(u, w));
  }
  dfs(0, -1, 0);
  rep (i, n) {
    cout << c[i] << endl;
  }
}



Measured memory_bytes: 10112
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long; 
using pii =  pair<int, int>;
using pll =  pair<long long, long long>;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
//constexpr long long MOD = 998244353LL;
template<class T, class U> inline bool chmax(T &a, U b) { if (a < b) { a = b; return true;} return false; }
template<class T, class U> inline bool chmin(T &a, U b) { if (a > b) { a = b; return true;} return false; }
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    
    int n; cin>>n;
    string s; cin>>s;
    
    rep(i,s.size()) {
        if(s[i]+n>90) s[i]-=26;
        s[i]+=n;
    }
    
    cout << s << ln;
    return 0;
 }


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>

using namespace std;

typedef pair<int, int> pii;
typedef pair<int, pii> p3i;
typedef vector<int> vi;

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

    int h, w, d;
    cin >> h >> w >> d;
    int n = h * w;
    p3i axy[n];
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            int a;
            cin >> a;
            axy[i*w+j] = {--a, {i, j}};
        }
    }
    sort(axy, axy+n);

    vi ps[d];
    for (int i = 0; i < n; i++) {
        int cx = axy[i].second.first, cy = axy[i].second.second;
        int t = 0;
        if (i / d != 0) {
            int lx = axy[i-d].second.first, ly = axy[i-d].second.second;
            t = ps[i%d][ps[i%d].size()-1] + abs(cx - lx) + abs(cy - ly);
        }
        ps[i%d].push_back(t);
    }

    int q;
    cin >> q;
    while (q--) {
        int l, r;
        cin >> l >> r;
        l--, r--;
        cout << ps[r%d][r/d] - ps[l%d][l/d] << endl;
    }

    return 0;
}


Measured memory_bytes: 6528