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

int a, b;

int digit(int x){
    int res = 1;
    while(x/10 > 0){
        res ++;
        x/=10;
    }
    return res;
}

long long pow10(int n){
    long long res = 1;
    int x = 10;
    while(n>0){
        if(n&1) res = res * x;
        x = x * x;
        n >>= 1;
    }
    return res;
}

int main(){
    scanf("%d%d", &a, &b);
    int db = digit(b);
    long long num = a * pow10(db) + b;
    for(int i=1; i< 1000; i++){
        if(i * i == num) {
            printf("Yes");
            return 0;
        }
    }
    printf("No");
}


Measured memory_bytes: 256
//inlclude before define 
#define _USE_MATH_DEFINES

//include
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<type_traits>
#include<numeric>
#include<assert.h>
#include<deque>
#include<iomanip>
#include<set>
#include<tuple>
#include<map>

using namespace std;

//typedef
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<char> VC;
typedef pair<int, int> P1;
typedef long long int ll;

//define
#define INF 1e9
#define NUM 1000000007
#define all(x) begin(x),end(x)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,a,b) for(int i=int(a);i<int(b);i++)
#define chmin(a,b) a=min((a),(b))
#define chmax(a,b) a=max((a),(b))

//function

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

/*ll lcm(ll a,ll b) {
	ll g = gcd(a, b);
	return a * (b / g);
}*/

/*int dig(int a) {
	int sum = 0;
	while (a) {
		sum += a % 10;
		a /= 10;
	}
	return sum;
}*/

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

	int cnt = 0, res = n;
	rep(i, n+1) {
		cnt = 0;
		int t = i;
		while (t > 0) {
			cnt += t % 6;
			t /= 6;
		}
		t = n - i;
		while (t > 0) {
			cnt += t % 9;
			t /= 9;
		}
		chmin(res, cnt);
		//cout << cnt << " " << res << endl;
	}
	cout << res << endl;
}



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


int main(){
    int N;
    cin >> N;
    vector<int> P(N);
    rep(i,N){
        cin >> P[i];
    }
    int m = P[0];
    int cnt = 1;
    for(int i=1;i<N;i++){
        if(P[i] < m){
            cnt++;
            m = P[i];
        }
    }
    cout << cnt << endl;
}


Measured memory_bytes: 1024
q=int(input())
from math import floor,sqrt
def isPrime(x):
  if x<2:
    return False
  elif x==2:
    return True
  elif x%2==0:
    return False
  for i in range(3,floor(sqrt(x))+1,2):
    if x%i==0:
      return False
  return True
def PrimeSet(x):
  p=set()
  for i in range(1,x+1):
    if isPrime(i):
      p.add(i)
  return p
prime1=PrimeSet(10**5)
prime2=set()
for j in range(1,10**5+1):
  if j%2:
    i=(j+1)//2
    if isPrime(i):
      prime2.add(j)
prime3=prime1&prime2
plist=[0]*(10**5+1)
for i in range(1,10**5+1):
  plist[i]=plist[i-1]
  if i in prime3:
    plist[i]+=1
for i in range(q):
  l,r=map(int,input().split())
  print(plist[r]-plist[l-1])

Measured memory_bytes: 54748
//{{{
#include <bits/stdc++.h>
using namespace std;
#define repX(a,b,c,x,...) x
#define repN(a) repX a
#define rep(...) repN((__VA_ARGS__,rep3,rep2,loop))(__VA_ARGS__)
#define rrep(...) repN((__VA_ARGS__,rrep3,rrep2))(__VA_ARGS__)
#define loop(n) rep2(i_,n)
#define rep2(i,n) rep3(i,0,n)
#define rep3(i,begin,end) for(int i=(int)(begin),i##_end=(int)(end);i<i##_end;++i)
#define rrep2(i,n) rrep3(i,n,0)
#define rrep3(i,begin,end) for(int i=(int)(begin-1),i##_end=(int)(end);i>=i##_end;--i)
#define foreach(x,a) for(auto&x:a)
using ll=long long;
const ll mod=(ll)1e9+7;
//}}}

int main(){
  int y, m, d;
  scanf("%d/%d/%d", &y, &m, &d);
  int ans = (y * 10000 + m * 100 + d) <= 20190430;
  puts(ans ? "Heisei" : "TBD");
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 int main(){
 string str;
   cin >> str;
   int n = str.size();
   for (int i=0; i<n;i++){ 
     if(str.at(i) == '7') {
     cout << "Yes" << endl;
       break;
     }
     else {
      if(i<n-1){
        //continue;
      }
      else{
       cout << "No" <<endl;
      }
     }
   }
 } 


Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
#define umap unordered_map

int main(){
  umap<string,int> mp;
  mp["SUN"] = 7;
  mp["MON"] = 6;
  mp["TUE"] = 5;
  mp["WED"] = 4;
  mp["THU"] = 3;
  mp["FRI"] = 2;
  mp["SAT"] = 1;
  string s; cin>>s;
  cout << mp[s]; 
}


Measured memory_bytes: 256
#include<iostream>
#include<list>
#include<vector>
#include<algorithm>
#include<string>
#include<stdio.h>
#include<math.h>
#include<unordered_map>

using namespace std;
using vec = vector<int>;
using mat = vector<vec>;
using lst = list<int>;


class Plant
{
public:
	
	string L;
	double rate;

	Plant()
	{
		int P, A, B, C, D, E, F, S, M;
		cin >> L >> P >> A >> B >> C >> D >> E >> F >> S >> M;

		rate = 1.0*
			(S * F * M - P)
			/ (A + B + C + M*(D + E));
	}

	bool operator<(const Plant & a)const
	{
		if (rate == a.rate)return L < a.L;
		return rate > a.rate;
	}
};


bool solve()
{
	int N; cin >> N;
	if (N == 0)return 0;

	vector<Plant> pL(N);
	sort(pL.begin(), pL.end());
	for (auto & p : pL)
	{
		cout << p.L << endl;
	}
	cout << "#" << endl;


	return true;
}


int main()
{
	while (solve());

	return 0;
}


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

fn main() {
	let (s, w): (usize, usize) = (read(), read());
	let ans = if s <= w { "unsafe" } else { "safe" };
	println!("{}", ans);
}
 
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: 2148
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;

int main() {
  ll A, B, K;
  cin >> A >> B >> K;

  ll n = A - K;
  A = max((ll)0, n);
  if (n < 0)
    B = max((ll)0, B - abs(n));

  cout << A << " " << B << endl;
}

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

struct match {
    vector<int> numbers;
    match() {
        numbers.assign(10, 0);
        numbers[0] = -1;
    }
    bool operator>(match m) {
        if (this->numbers[0] != m.numbers[0]) {
            return this->numbers[0] > m.numbers[0];
        }
        for (int i = 9; i >= 1; i--) {
            if (this->numbers[i] != m.numbers[i]) {
                return this->numbers[i] > m.numbers[i];
            }
        }
        return false;
    }
};

int main() {
    vector<int> need = {0, 2, 5, 5, 4, 5, 6, 3, 7, 6};
    int n, m;
    cin >> n >> m;
    vector<int> usable(m);
    for (int i = 0; i < m; i++) {
        cin >> usable[i];
    }
    // dp[i]:マッチi本使って作れる最強のマッチ組
    vector<match> dp(n + 1, match());
    dp[0].numbers[0] = 0;
    for (int i = 0; i < m; i++) {
        for (int j = 0; j <= n; j++) {
            if (j + need[usable[i]] > n || dp[j].numbers[0] < 0) {
                continue;
            }
            match temp = dp[j];
            temp.numbers[0]++;
            temp.numbers[usable[i]]++;
            if (temp > dp[j + need[usable[i]]]) {
                dp[j + need[usable[i]]] = temp;
            }
        }
    }
    for (int i = 9; i >= 1; i--) {
        for (int j = 0; j < dp[n].numbers[i]; j++) {
            cout << i;
        }
    }
    cout << endl;
}

Measured memory_bytes: 896
N, K = map(int, input().split())
As = list(map(int, input().split()))


for i in range(K):
    #imos法(メモ)
    table = [0 for _ in range(N+1)]
    #数値がN個なのでN個の0の要素を作る
    #index0は空白、index1からx軸のランプがある位置に対応
    #1-Nまでのランプが格納されている
    for j in range(1,N+1):
        ai = As[j-1]
        #電球jが照らす左端をメモ
        #電球jが照らす左端はj-aiなので、ここに１を足す
        table[max(j-ai, 1)] += 1
        #電球jが照らす右端をメモ
        #電球jが照らす右端はj+aiなので、この次の項に-1を加える
        if j+ai<N:
            table[min(j+ai+1, N)] -= 1 

    #imos法(総和を求める)
    for j in range(1,N+1):
        table[j] += table[j-1]
        
    #答えになおす
    for j in range(N):
        As[j] = table[j+1]
        
    
    exit_condition = True
    for j in range(N):
        if As[j] != N:
            exit_condition = False
            break
        #要素が全てNの時に、conditionはtrueのまま
    
    if exit_condition:
        print(*As)
        exit(0)#条件が正常に動作した時、ここで終了とさせる
            

print(*As)



Measured memory_bytes: 170588
object Main extends App {
	var odd = io.StdIn.readLine.toList
	var even = io.StdIn.readLine.toList

	val z = even.size;

	var list: List[Char] = List()

	for(i <- 0 until z){
		list = list :+ odd.head
		list = list :+ even.head
		odd = odd.drop(1)
		even = even.drop(1)
	}

	if(odd.size != even.size) list = list :+ odd.head

	println(list.mkString)


}

Measured memory_bytes: 27200
#include "bits/stdc++.h"
#define MOD 1000000007
#define INF 11234567890
#define in std::cin
#define out std::cout
#define rep(i,N) for(LL i=0;i<N;++i)
typedef long long int LL;
 
LL n, a[112345];
bool zero_flag = false;
LL sum, res, ans, a_c[112345];
 
int main()
{
	in >> n;
	rep(i, n) { in >> a[i]; }
 
	std::copy(a, a + n, a_c);
	{
		if (a[0] == 0)
		{
			zero_flag = true;
			++res;
			a[0] = 1;
		}
		if (a[0] < 0)
		{
			res += 1 - a[0];
			a[0] = 1;
		}
		sum = a[0];
		rep(i, n)
		{
			if (i == n - 1) { break; }
			if (sum <= 0 && sum + a[i + 1] <= 0)
			{
				LL want = abs(sum) + 1;
				res += abs(want - a[i + 1]);
				a[i + 1] = want;
			}
			else if (sum >= 0 && sum + a[i + 1] >= 0)
			{
				LL want = -(sum + 1);
				res += abs(a[i + 1] - want);
				a[i + 1] = want;
			}
			sum += a[i + 1];
		}
	}
	ans = res; res = 0;
	std::copy(a_c, a_c + n, a);
	{
		if (zero_flag)
		{
			++res;
			a[0] = -1;
		}
		if (a[0] > 0)
		{
			res += a[0] + 1;
			a[0] = -1;
		}
		sum = a[0];
		rep(i, n)
		{
			if (i == n - 1) { break; }
			if (sum <= 0 && sum + a[i + 1] <= 0)
			{
				LL want = abs(sum) + 1;
				res += abs(want - a[i + 1]);
				a[i + 1] = want;
			}
			else if (sum >= 0 && sum + a[i + 1] >= 0)
			{
				LL want = -(sum + 1);
				res += abs(a[i + 1] - want);
				a[i + 1] = want;
			}
			sum += a[i + 1];
		}
	}
	ans = std::min(ans, res);
 
	out << ans << std::endl;
	return 0;
}

Measured memory_bytes: 1792
N, T = map(int, input().split())
c_t = []
for i in range(N):
    c_t.append(list(map(int, input().split())))
c_t.sort()
min_cost = 10000
for i in range(N):
    if c_t[i][1] <= T and c_t[i][0] < min_cost:
        min_cost = c_t[i][0]
if min_cost > 1000:
    print('TLE')
else:
    print(min_cost)


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

int main(){
  int N,a=0,b;
  cin>>N;
  b=N;
  while(N>0){
    a+=N-N/10*10;
    N/=10;
  }
  if(b%a==0){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
}

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

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

    deque<char> sq;
    for(char c : s){
        sq.push_back(c);
    }

    int r_cnt = 0;
    rep(i, q){
        int t;
        cin >> t;
        if(t==1){
            r_cnt+=1;
        }
        else{
            int f;
            char c;
            cin >> f >> c;
            if(f==1){
                if(r_cnt%2==0) sq.push_front(c);
                else sq.push_back(c);
            }
            else{
                if(r_cnt%2==0) sq.push_back(c);
                else sq.push_front(c);
            }
        }
    }

    if(r_cnt%2==1){ 
        reverse(begin(sq), end(sq));   
    }

    for(char c : sq){
        cout << c;
    }
    cout << "\n";
    return 0;
}

Measured memory_bytes: 896
using System;
using System.Collections.Generic;
using System.Linq;

class Edge {
    public int Fm { get; private set; }
    public int To { get; private set; }
    public int Cost { get; private set; }

    public Edge(int fm, int to, int cost) {
        Fm = fm;
        To = to;
        Cost = cost;
    }
}

class ShortestPath {
    static int ReadInt() {
        return int.Parse(Console.ReadLine());
    }

    static int[] ReadInts() {
        return Console.ReadLine().Trim().Split().Select(int.Parse).ToArray();
    }

    static void BellmanFord(int src, int n, Edge[] edges) {
        const int INF = 1000000000;
        int[] d = new int[n];
        for (int i = 0; i < n; i++) d[i] = INF;

        d[src] = 0; // ????§??????????
        for (int i = 0; i < n; i++) {
            foreach (Edge e in edges) {
                if (d[e.To] > d[e.Fm] + e.Cost) {
                    d[e.To] = d[e.Fm] + e.Cost;
                }
            }
        }

//        bool isExistsNegativeLoop = false; // ????????????????????????
//        foreach (Edge e in edges) {
//            if (d[e.Fm] + e.Cost < d[e.To]) {
//                isExistsNegativeLoop = true;
//                break;
//            }
//        }

        int ans = 0;
        for (int i = 1; i < n; i++) {
            if (d[i] <= 2) { // ????????????????????§????????????
                ans++;
            }
        }
        Console.WriteLine(ans);
    }

    static void Main() {
        while (true) {
            int n = ReadInt();
            if (n == 0) break;

            int m = ReadInt();
            Edge[] edges = new Edge[m*2];
            for (int i = 0; i < m; i++) {
                var ab = ReadInts();
                edges[2*i] = new Edge(ab[0]-1, ab[1]-1, 1);
                edges[2*i+1] = new Edge(ab[1]-1, ab[0]-1, 1);
            }
            BellmanFord(0, n, edges);
        }
    }
}

Measured memory_bytes: 7236
#include<stdio.h>
int main(){
	int W,H,x,y,r;
	scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);
	if(W-r>=x&&H-r>=y&&0+r<=x&&0+r<=y){
		printf("Yes\n");
	}else{
		printf("No\n");
		
	}
		
	
	
	

	return 0;
}

Measured memory_bytes: 584
#include<iostream>
#include <algorithm>
#include <string>
using namespace std;
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(int)(n); i++)
typedef long long ll;
const int INF = numeric_limits<int>::max();
const int MOD = (1e9 + 7);
bool G[8][8] = {0};

int dfs(int V, int N, bool visited[8]){
  int res = 0;
  visited[V] = true;
  bool ALL = true;
  rep(i, N){
    if(!(visited[i])) ALL = false;
  }
  if(ALL) return 1;
  for(int i=0; i<N; i++){
    if(!G[V][i]) continue;
    else if(visited[i]) continue;
    visited[i] = true;
    res += dfs(i, N, visited);
    visited[i] = false;
  }
  return res;
}
    
 
int main(){
  int N, M;
  cin >> N >> M;
  for(int i=0; i<M; i++){
    int A, B;
    cin >> A >> B;
    G[A-1][B-1] = true;
    G[B-1][A-1] = true;
  }
  bool visited[8] = {0};
  cout << dfs(0, N, visited);
  
 
 }

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#include<math.h>
#define ll long long
#define ld long double
#define all(a) (a.begin(),a.end())
#define Summon_Tourist ios::sync_with_stdio(false);cin.tie(0);
ll gcd(ll a , ll b) { return b==0?a: gcd( b, a%b); }
ll lcm(ll a , ll b) { return a/gcd(a,b) * b ; }
ll inf = 1e15 + 1;
ll modexp( ll base ,ll power)
 {
     if( power == 0  ) return 1;
     if( power & 1) return base*modexp( base , power-1 )%inf;
     return modexp(base*base%inf,power/2);
 }
 int main()
{
  Summon_Tourist
  //freopen("input.txt" , "r" , stdin ) ;
  ll t = 1 ;
  //cin>>t ;
  while(t--)
  {
    ll n;
    cin>>n;
    vector<ll> a(n);
    ll xorr = 0  ;
    for( ll i = 0 ; i<n ; i++ )
    {
        cin>>a[i] ; xorr ^= a[i] ;
    }
    vector<ll> res(n);
    for( ll i = 0 ; i<n ; i++ )
    {
        res[i] = xorr^a[i] ;
    }
    for( auto x : res ) cout<<x<<" ";
  }
  return 0;

}


Measured memory_bytes: 6372
import java.util.Scanner;

public class Main
{
  public static void main(String []args)
  {
	int n,b;
   	Scanner sc= new Scanner(System.in);
   	n= sc.nextInt();
   	b=sc.nextInt();
    
   	if(n>=13)
    {
		System.out.println(b);
    }
    
    else if(n>5 && n<13)
    {
		System.out.println(b/2);
    }
    
    else 
    {
		System.out.println("0");
    }

  }
  
  
  
}


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

int main()
{
    int n, cnt = 0;
    char str[52];

    scanf("%d", &n);
    scanf("%s", str);

    for(int i = 0; i < n - 2; i++)
    {
        if(str[i] == 'A' && str[i + 1] == 'B' && str[i + 2] == 'C') {
            cnt++;
        }
    }

    printf("%d\n", cnt);

    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<algorithm>
#define MAX 100000
int n, k;
long long T[MAX];
 
int check(long long p){
    int i = 0;
    for (int j = 0; j < k; j++){
        long long s = 0;
        while (s + T[i] <= p){
            s += T[i];
            i++;
            if (i == n)return n;
        }
    }
    return i;
}
 
 
int solve(){
    int v;
    long long left = 0;
    long long right = 100000 * 10000;
    long long mid;
    while (right > left + 1){
        mid = (left + right) / 2;
        v = check(mid);
        if (v >= n)right = mid;
        else left = mid;
    }
    return right;
}
int main(){
    scanf("%d %d", &n, &k);
    for (int i = 0; i < n; i++){
        scanf("%d", &T[i]);
    }
    long long p = solve();
    printf("%d\n", p);
    return 0;
}

Measured memory_bytes: 3532
#include <bits/stdc++.h>
using namespace std ;
const int MAXN = 200000 + 5 , MOD = 2019 ;
int g[ MAXN ] , len , ans , a[ MAXN ] ;
string s ;
signed main () {
    g[ 0 ] = 1 ;
    for ( int i = 1 ; i < MAXN ; i ++ ) {
        g[ i ] = g[ i - 1 ] * 10 % MOD ;
    }
    int x , y = 0 ;
    cin >> s ; len = s.size () ;
    a[ 0 ] = 1 ;
    for ( int i = len - 1 ; i >= 0 ; i -- ) {
        x = ( s[ i ] - '0' ) * g[ len - i - 1 ] % MOD ;
        int t = ( x + y ) % MOD ;
        ans += a[ t ] ;
        a[ t ] ++ ;
        y = t ;
    }
    printf ( "%d\n" , ans ) ;
    return 0 ;
}

Measured memory_bytes: 4672
#include <bits/stdc++.h>                                           
 
#define int long long
//#pragma GCC optimize("Ofast")
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4")
 
 
#define file(s) freopen(s".in","r",stdin); freopen(s".out","w",stdout);
#define forev(i, b, a) for(int i = (b); i >= (a); --i)
#define forn(i, a, b) for(int i = (a); i <= (b); ++i)
#define all(x) x.begin(), x.end()
#define sz(s) (int)s.size()
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define s second
#define f first
 
 
using namespace std;
 
 
typedef pair < long long, long long > pll;    
typedef pair < int, int > pii;
typedef unsigned long long ull;         
typedef vector < pii > vpii;
typedef vector < int > vi;
typedef long double ldb;  
typedef long long ll;  
typedef double db;                             
 
 
const int dx[] = {1, -1, 0, 0}, dy[] = {0, 0, 1, -1}, block = 555;
const pii base = mp(1171, 3307), Mod = mp(1e9 + 7, 1e9 + 9);
const int inf = 1e9, maxn = 4e5 + 148, mod = 1e9 + 7, N = 2e5 + 11;
const db eps = 1e-12, pi = 3.14159265359;
const ll INF = 1e18;


int n, k;

int get (int n) {
	return n * (n + 1) / 2;
}


main () {
	cin >> n >> k;
	int ans = 0;
	for (int k1 = k; k1 <= n + 1; ++k1) {
		int l = get(k1 - 1), r = get(n) - get(n - k1); 
		(ans += (r - l + 1)) %= mod;
	}
	cout << ans << endl;
}


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

int main() {

	int n; cin >> n;
	const int  p = 100001;
	vector<int> num(p, 0);
	for (int i = 0; i < n; i++) {
		int a; cin >> a;
		num[a]++;
	}
	int ans = 0;
	for (int i = 0; i < p - 2; i++) {
		int  tmpSum = 0;
		for (int j = 0; j < 3; j++) {
			tmpSum += num[i + j];
		}
		ans = max(ans, tmpSum);
	}
	cout << ans << endl;
	return 0;
}

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

	typedef long l;
	typedef long long ll;
	typedef vector<ll> vll;
	typedef vector<int> vi;

	#define pb push_back
	#define pi 3.14159265358979323846
	#define M 1000000007

	// #define rep(j,n,s)  for(long i=j;i<=n;i+=s)
	#define forn(j,n,s) for(long i=j; i<n; i+=s)
	#define rep(i,n,s) 	for(		; i<n; i+=s)

	#define read(k)		ll k; cin>>k;
	#define range(v)	begin(v), end(v)
	#define X first
	#define Y second

	void solve() 
	{
	    //Answer here.
	    int a,b;	cin>>a>>b;
	    cout<<a*b<<endl;
	    

	}

	int main(){

		#ifndef ONLINE_JUDGE
				freopen("input", "r", stdin);
				freopen("output","w",stdout);
		#endif

		ios_base::sync_with_stdio(0);	cin.tie(NULL);	cout.tie(0);
	    int t=1;  //cin>>t;
	    while(t--)  solve();

	    return 0;
	}


Measured memory_bytes: 3644
S = input()

ops = ('dream', 'dreamer', 'erase', 'eraser')

import sys
sys.setrecursionlimit(200000)

memo = [None] * (len(S) + 1)

def dp(pos):
    if pos > len(S): return 0
    elif pos == len(S): return 1
    elif memo[pos] != None: return memo[pos]
    #
    ret = 0
    for op in ops:
        # print("#", pos, S[pos : pos + len(op)], op)
        if S[pos : pos + len(op)] == op:
            ret = max(ret, dp(pos + len(op)))
    #
    memo[pos] = ret
    return ret

if dp(0) == 1:
    print('YES')
else:
    print('NO')

Measured memory_bytes: 19824
#include <stdio.h>


int main(void)
{
    long long int sum=0;
    long long int num[5],i,n,j,k,x;
    char name[11];
    for(i=0;i<5;i++) num[i]=0;
    scanf("%lld",&n);
    while(n>0)
    {
        scanf("%s",name);
        if(name[0]=='M') num[0]++;
        else if(name[0]=='A') num[1]++;
        else if(name[0]=='R') num[2]++;
        else if(name[0]=='C') num[3]++;
        else if(name[0]=='H') num[4]++;
        n--;
    }
    for(i=0;i<5;i++)
    {
        x=0;
        if(num[i]==0) continue;
        for(j=i+1;j<5;j++)
            for(k=j+1;k<5;k++)
                x+=num[j]*num[k];
        sum+=x*num[i];
    }
    printf("%lld",sum);
    return 0;
}




Measured memory_bytes: 128
import math
a , b , c = map(int, input().split())

h= b*math.sin(math.radians(c))
s = a*h/2
l= a+b+(a**2 + b**2 - 2*a*b*math.cos(math.radians(c)))**(1/2)

print(s)
print(l)
print(h)


Measured memory_bytes: 5712
using System;

namespace a
{
    class Program
    {
        static void Main(string[] args)
        {
            var _ = Console.ReadLine().Split();
            var a = int.Parse(_[0]);
            var b = int.Parse(_[1]);

            var s = (a * b) - (a + b - 1);

            Console.WriteLine(s);
        }
    }
}


Measured memory_bytes: 11220
///Bismillahir Rahmanir Rahim
#include "bits/stdc++.h"

#define                           ll                          long long
#define                           int                         ll
#define                           fi                          first
#define                           si                          second
#define                           mp                          make_pair
#define                           pb                          push_back
#define                           pi                          pair<ll,ll>
#define                           clr(x)                      memset(x,0,sizeof(x));
#define                           f(i,l,r)                    for(int i=l;i<=r;i++)
#define                           rf(i,r,l)                   for(int i=r;i>=l;i--)
#define                           done(i)                     cout<<"done = "<<i<<endl;
#define                           show(x,y)                   cout<<x<<" : ";for(auto z:y)cout<<z<<" ";cout<<endl;
#define                           fast                        ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

using namespace std;

const ll inf=1e18;
const int mod=1e9+7;
const int M=100005;
void bye1()
{
    printf("Yes\n");
    exit(0);
}
void bye2()
{
   printf("No\n");
   exit(0);
}
 main()

{

    int n;
    scanf("%lld",&n);
    int pa[n+2],pb[n+2];
    int a[n+2],b[n+2];
    f(i,1,n)
    {
        scanf("%lld",&a[i]);
        pa[i]=a[i];
    }
    f(i,1,n)
    {
        scanf("%lld",&b[i]);
        pb[i]=b[i];
    }
    sort(pa+1,pa+n+1);
    sort(pb+1,pb+n+1);
    map<int,int>yo;
    f(i,1,n)
    {
        if(pa[i]>pb[i])
        {
            cout<<"No"<<endl;
            return 0;
        }
        yo[pa[i]]=pb[i];
    }
    f(i,1,n-1)
    {
        if(pa[i+1]<=pb[i])
        {
            bye1();
        }
    }
    map<int,int>bidx;
    map<int,int>ses;
    f(i,1,n)
    {
        bidx[b[i]]=i;
    }
    f(i,1,n)
    {
        int x=i;
        int y=bidx[yo[a[i]]];
        ses[x]=y;
    }
    map<int,int>vis;
    int cur=1,cnt=1;
    while(1)
    {
        cur=ses[cur];
        if(cur==1)break;
        cnt++;
    }
    if(cnt!=n)
    {
        bye1();
    }
    bye2();
    return 0;

}





































Measured memory_bytes: 25492
'use strict'

function Main(input) {
  input = input.trim().split('\n')
  const a = input[0].split(' ').map(s => parseInt(s))
  const N = a[0]
  const K = a[1]
  const rest = input[1].split(' ').map(s => parseInt(s))
  const R = rest[0]
  const S = rest[1]
  const P = rest[2]
  const T = input[2]

  var dp = []

  for(var i = 0; i < N; ++i){
    let ans = T[i]

    // K個前の特典が有効であれば、contineする
    if(i >= K && T[i - K] === ans && dp[i - K] > 0) {
      dp.push(0)
      continue
    }


    if (ans === 'r') {
      dp.push(P)
    } 

    if(ans === 's') {
      dp.push(R)
    }

    if(ans === 'p') {
      dp.push(S)
    }    
  }
  console.log(dp.reduce((p, c) => p + c))
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 21064
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    string S;
    cin >> S;

    int n = S.length();
    int count = 0;
    for (int i = 0; i < n; i++){
        if (S[i] == '+'){
            count++;
        }
        else {
        count--;
        }
    }
    cout << count << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector> 
#include<limits>
#include<numeric>
#include<type_traits>
#include<math.h>
#include<fstream>
#include<set>
#include<queue>
using namespace std;
typedef long long ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i = (int)(a); i < (int)(b); i++)
#define out(str) cout << str << endl
#define ALL(a) (a).begin(),(a).end()
#define INF (1<<29)

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 (b<a) { a=b; return 1; } return 0; }



int main(){
    string S;
    int ans=0;
    cin>>S;
    for(int i=0; i*2<S.size();i++){
        if(S[i]!=S[S.size()-i-1])ans++;
    }
    out(ans);
    
    
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
 
 
int main(){
	int A, B, C;
	cin >> A >> B >> C;
	if((A < C && C < B) || (B < C && C < A)){
		cout << "Yes" << endl;
	}
	else{
		cout << "No" << endl;
	}
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
	int A,i,ans=0,cnt=0;
	scanf("%d",&A);
	long int B[A];
	for(i=0;i<A;i++){
		scanf("%ld",&B[i]);
	}
	for(i=0;i<A;i++){
		if(B[i]>=B[i+1]){
			cnt++;
		}else{
			if(ans<cnt){
				ans=cnt;
			}
			cnt=0;
		}
	}
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 896
#include <bits/stdc++.h>
#define COUT(x) cout << #x << " = " << (x) << ", "
typedef long long ll;
using namespace std;
static const ll MOD = 1000000007;

int main(){
  ll K; cin >> K;
  vector<ll> L = {1, 2, 3, 4, 5, 6, 7, 8, 9};
  ll len = 9;
  ll idx = 0;
  while(1){
    ll tmp = L[idx];
    ll l = tmp % 10;
    if(l == 0){
      L.push_back(10 * tmp);
      L.push_back(10 * tmp + 1);
      len += 2;
    }else if(l == 9){
      L.push_back(10 * tmp + 8);
      L.push_back(10 * tmp + 9);
      len += 2;
    }else{
      L.push_back(10 * tmp + l - 1);
      L.push_back(10 * tmp + l);
      L.push_back(10 * tmp + l + 1);
      len += 3;
    }
    if(idx == K - 1){
      cout << tmp << endl;
      return 0;
    }
    idx++;
  }
}


Measured memory_bytes: 2676
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

fn main() {
    let v = read_vec::<usize>();
    let (n, r) = (v[0], v[1]);
    if n >= 10 {
        println!("{}", r);
    } else {
        println!("{}", r + 100 * (10 - n));
    }
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n;
  cin >> n;

  int onesPlace = n % 10;
  n /= 10;
  int tensPlace = n % 10;
  n /= 10;
  int hundredsPlace = n % 10;
  n /= 10;
  int thousandsPlace = n;
  
  if (tensPlace == hundredsPlace && (tensPlace == onesPlace || hundredsPlace == thousandsPlace))
  {
    cout << "Yes";
  }
  else
  {
    cout << "No";
  }
}

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

#define step(i, s, n, d) for(int i=s; i<n; i+=d)
#define FOR(i,s,n) step(i,s,n,1)
#define rep(i,n) FOR(i,0,n)
#define gets(x) x; cin >> x;
#define puts(x) x; cout << x << endl;
#define list_input(x, n) x[n]; rep(i,n){ gets(x[i]);}
#define ll long long

int main(){
  int a, b;
  cin >> a >> b;
  if ((a*b) % 2 == 0 ) {
    puts("Even")
  }else{
    puts("Odd")
  }
}


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

#define rep(i, n) for(int i = 0; i < (n); ++i)
typedef long long ll;

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

  ll x; cin >> x;
  ll tmp = x/11;
  ll rest = x-tmp*11;

  if(x%11 == 0) {
    cout << 2*tmp << '\n';
    return 0;
  }

  cout << tmp*2 + (rest > 6 ? 2 : 1) << '\n';
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <stack>
#include <cstring>
#include <cmath>
#include <cstdio>
 
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define rep(i, n) for(int i = 0; i < (n); i++)
#define MP make_pair
#define X first
#define Y second
#define all(v) v.begin(), v.end()
#define rev(v) v.rbegin(), v.rend()

using namespace std;
 
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> P;

const int INF = 1<<29;

int w, h;
char dat[61][11];
int dx[] = {-1, 0, 1, 0};
int dy[] = {0, 1, 0, -1};
const int DOWN = 1;
const int UP = 3;

struct piece{
	vector<P> p;
	int lx, rx;
	piece():lx(1<<29),rx(-1){}
};

bool check(piece &v){
	int n = v.p.size();
	if(!n) return false;
	double xsum = 0;
	rep(i, n){
		xsum += v.p[i].X+0.5;
	}
	double g = xsum/n;
	return v.lx < g && g < v.rx;
}

int visit[62][11];

bool merge(piece &parent, P s){
	piece v;
	v.lx = s.X;
	v.rx = s.X+1;
	v.p.push_back(s);

	visit[s.Y][s.X] = true;

	queue<P> q;
	q.push(s);

	char mat = dat[s.Y][s.X];

	while(!q.empty()){
		P p = q.front();
		q.pop();

		rep(i, 4){
			int nx = p.X + dx[i];
			int ny = p.Y + dy[i];
			if(nx < 0 || nx >= w || ny < 0 || ny > h) continue;
			if(dat[ny][nx] == '.') continue;
			if(dat[ny][nx] != mat){
				if(i == DOWN){
					v.lx = min(v.lx, nx);
					v.rx = max(v.rx, nx+1);
				}
				if(i == UP){
					if(visit[ny][nx]) continue;
					if(merge(v, MP(nx, ny)) == false) return false;
				}
			}else{
				if(visit[ny][nx]) continue;
				visit[ny][nx] = true;

				v.p.push_back(MP(nx, ny));
				q.push(MP(nx, ny));
			}
		}
	}

	rep(i, v.p.size()){
		parent.p.push_back(v.p[i]);
	}

	return check(v);
}

int main(){
	while(cin >> w >> h, w|h){
		rep(i, h) rep(j, w) cin >> dat[i][j];
		rep(i, w) dat[h][i] = 'X';

		rep(i, w){
			if(dat[h-1][i] != '.'){
				piece v;
				memset(visit, 0, sizeof(visit));
				cout << (merge(v, MP(i, h-1))?"STABLE":"UNSTABLE") << endl;
				break;
			}
		}
	}

    return 0;
}

Measured memory_bytes: 1228
#include<stdio.h>
int main(void)
{
  char a[3];
	int i=0;
  scanf("%s",a);
  if(a[0]=='1')i++;
  if(a[1]=='1')i++;
  if(a[2]=='1')i++;
  printf("%d",i);
	return 0;
}


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

using namespace std;
#define taskname "A"
#define pb	push_back
#define mp 	make_pair
#define rep(i, l, r) for (int i = (l); i <= (r); ++i)

#ifndef LOCAL
#define cerr if(0)cout
#endif

typedef long double ld;
typedef long long ll;
typedef pair<int,int> ii;
const int maxn = 1e5 + 6;

int n , m;
int a[maxn];
int lab[maxn];
ii s[maxn];
bool c[maxn];
int Find(int x){
    return lab[x] < 0 ? x : lab[x] = Find(lab[x]);
}

int connected = 0;

void Merge(int x , int y){
    x = Find(x);
    y = Find(y);
    if(x == y)return;
    if(lab[x] > lab[y])swap(x,y);
    lab[x] += lab[y];
    lab[y] = x;
    s[x] = min(s[x],s[y]);
    ++connected;
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    if(fopen(taskname".INP","r")){
		freopen(taskname".INP", "r",stdin);
		freopen(taskname".OUT", "w",stdout);
    }
    fill_n(lab,maxn,-1);
    cin >> n >> m;
    for(int i = 1 ; i <= n ; ++i){
        cin >> a[i];
        s[i] = mp(a[i] , i);
    }
    for(int i = 1 ; i <= m ; ++i){
        int u , v;cin >> u >> v;
        ++u,++v;
        Merge(u , v);
    }
    if(connected == n - 1)return cout << 0 , 0;
    if((n - connected - 1) * 2 > n)
        return cout << "Impossible" , 0;
    vector<int> v;
    ll res = 0;
    for(int i = 1 ; i <= n ; ++i){
        if(lab[i] < 0){
            res += s[i].first;
            c[s[i].second] = 1;
        }
    }
    for(int i = 1 ; i <= n ; ++i){
        if(c[i] == 0)v.pb(a[i]);
    }
    sort(v.begin(),v.end());
    for(int i = 0 ; i < (n - connected - 2) ; ++i){
        res += v[i];
    }
    cout << res;
}



Measured memory_bytes: 2556
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int inf = 1e9 + 7;
const ll longinf = 5LL << 60;
const ll mod = 1e9 + 7;

int main() {
	int N;
	cin >> N;
	int A[N];
	for(int i = 0; i < N; i++) cin >> A[i];
	int copy[N];
	for(int i = 0; i < N; i++) copy[i] = A[i];
	sort(copy, copy + N);
	int first = copy[N - 1], second = copy[N - 2];
	for(int i = 0; i < N; i++) {
		if(A[i] == first)
			cout << second << "\n";
		else
			cout << first << "\n";
	}
	return 0;
}


Measured memory_bytes: 3200
import numpy as np
from collections import defaultdict
N, M = list(map(int, input().split()))

edge_dict = defaultdict(set)
A, B = [], []
for i in range(M):
    a, b = list(map(int, input().split()))
    A.append(a)
    B.append(b)
A = np.array(A)
B = np.array(B)
inds = np.argsort(B)

last_connected_node = 0
cnt = 0
for a, b in zip(A[inds], B[inds]):
    if last_connected_node <= a:
        last_connected_node = b
        cnt += 1
print(cnt)


Measured memory_bytes: 21300
#include<bits/stdc++.h>
#include<numeric>
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define repk(i,k,n) for (ll i = k; i <= (ll)(n); ++i)
#define MAX 500000001000000000
#define MOD 1000000007
typedef long long  ll;

using namespace std;

ll ans;

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

	ll W, H, N;
	cin >> W >> H >> N;

	ll x,y,a;
	ll l = 0, r = W;
	ll d = 0, u = H;

	rep(i, N){
		cin >> x >> y >> a;
		if(a == 1){
			if(l<x){
				l = x;
			}
		}
		if(a == 2){
			if(r>x){
				r = x;
			}
		}
		if(a == 3){
			if(d<y){
				d = y;
			}
		}
		if(a == 4){
			if(u>y){
				u = y;
			}
		}
	}
	ans = (r - l) * (u - d);
	if ((r - l) < 0 || (u - d) < 0){
		ans = 0;
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
_ = readLine()!
var ps = readLine()!.split(separator: " ").compactMap { Int($0) }

var operationCount = 0

for i in 0..<ps.count {
    if i + 1 == ps[i] {
        operationCount += 1
        if i + 1 < ps.count {
            ps.swapAt(i, i + 1)
        }
    }
}

print(operationCount)


Measured memory_bytes: 13232
from collections import deque
X=input()
N=len(X)
cnt=0
sptm=0
ans=0
d=deque()
"""
for i in range(N):
    if X[i]=="S":
        sptm=sptm+1
    if X[i]=="T":
        sptm=sptm-1
    if sptm<0:
        ans=ans+1
        sptm=0
    #print(sptm,ans)
print(ans+max(0,sptm))
"""
for i in range(N):
    d.append(X[i])
    if len(d)>1:
        s1=d.pop()
        s2=d.pop()
        if (s2!="S")or(s1!="T"):
            d.append(s2)
            d.append(s1)
    #print(d)
print(len(d))

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

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define lcm(a, b) (a)/__gcd((a),(b))*(b)
#define CEIL(a, b) (a)/(b)+(((a)%(b))?1:0)
#define endl '\n'

using namespace std;

typedef long long LL;
typedef pair<int, int> P;
typedef pair<LL, LL> LP;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1000000007;
static const int SIZE = 200005;

const int dx[] = {0, -1, 1, 0};
const int dy[] = {-1, 0, 0, 1};

vector<int> Div(int n) {
    vector<int> ret;
    for(int i = 1; i * i <= n; ++i) {
        if(n % i == 0) {
            ret.pb(i);

            if(i * i != n) ret.pb(n / i);
        }
    }
    sort(all(ret));
    return ret;
}

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

    deque<char> d;
    string s;
    cin >> s;

    for(int i = 0; i < s.size(); ++i) {
        if(s[i] == 'B') {
            if(d.empty()) continue;
            d.pop_back();

        } else {
            d.push_back(s[i]);

        }
    }

    while(!d.empty()) {
        cout << d.front();
        d.pop_front();

    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<endl
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define mp make_pair
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define sz(x) (int)(x).size()
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pll = pair<ll, ll>;
using vc = vector<char>;
using vvc = vector<vc>;
ll dx[4]={0,1,0,-1};
ll dy[4]={1,0,-1,0};
int main(){
  ll n;
  cin>>n;
  vll t(n),a(n);
  rep(i,n) cin>>t[i];
  rep(i,n) cin>>a[i];
  vll tt(0),aa(0);
  tt.pb(1);
  aa.pb(1);
  ll ma=a[0];
  ll mt=t[0];
  for(int i=1;i<n;i++){
    mt=max(t[i],mt);
    if(t[i]!=t[i-1]){
      tt.pb(1);
    }
    else{
      tt.pb(t[i]);
    }
  }
  for(int i=n-1;i>0;i--){
    ma=max(ma,a[i]);
    if(a[i]!=a[i-1]){
      aa.pb(1);
    }
    else{
      aa.pb(a[i]);
    }
  }
  if(ma!=mt){
    COUT(0);
    return 0;
  }
  ll ans=1;
  ll k=1;
  rep(i,n){
    ans*=min(aa[n-i-1],tt[i]);
    ans%=MOD;
    if(a[i]==ma&&t[i]==mt)k=0;
    if(aa[n-i-1]==1&&a[i]>t[i]){
      COUT(0);
      return 0;
    }
    if(tt[i]==1&&t[i]>a[i]){
      COUT(0);
      return 0;
    }
  }
  if(k){
    COUT(0);
    return 0;
  }
  COUT(ans);
}


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

int main(){
    string s;
    cin>>s;
    int ans=0;
    for(int i=0;i<s.length()/2;i++){
        if(s[i]!=s[s.length()-1-i])ans++;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3604
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <cmath>

using namespace std;
using ll = long long;
using ull = unsigned long long;

constexpr ll LLINF {1001002003004005006};//ll = 9*LLINF
constexpr int INTINF {1000000000};//int = 2*INTINF

#define  rep(i,n)   for(int i = 0; i < (n); ++i)
#define rrep(i,n)   for(int i = 1; i <= (n); ++i)
#define drep(i,n)   for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for(int i = s; i < t;  ++i)

template<typename T>
void maxs(T& x, T&& y) {
  x=std::max(x,y);
}
template<typename T>
void maxs(T& x, T& y) {
  x=std::max(x,y);
}

template<typename T>
void mins(T& x, T&& y) {
  x=std::min(x,y);
}
template<typename T>
void mins(T& x, T& y) {
  x=std::min(x,y);
}

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

  int N, T;
  double A;
  cin >> N;
  cin >> T >> A;
  vector<int> H(N);
  rep(i, N) cin >> H[i];
  vector<double> temparature(N);
  rep(i, N) {
    temparature[i] = T - 0.006*H[i];
  }
  double min_temparature {std::abs(A - temparature[0])};
  int min_pos {0};
  srep(i, 1, N) {
    if (min_temparature > std::abs(A-temparature[i])) {
      min_temparature = std::abs(A-temparature[i]);
      min_pos = i;
    }
  }
  cout << min_pos+1 << '\n';
}


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

stack<char> st;

int main()
{
    string str;

    cin >> str;

    st.push(str[0]);
    for (int i = 1; i < str.size(); i++) {
        if (!st.empty() && st.top() == 'S' && str[i] == 'T') {
            st.pop();
        }
        else {
            st.push(str[i]);
        }
    }

    cout << st.size() << endl;

    return 0;
}


Measured memory_bytes: 644
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(v) v.begin(),v.end()
#define len(x) (ll)(x).length()
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const int INF=1e9;
const ll INFS=1e18;
const int di[] = {-1,0,1,0};
const int dj[] = {0,-1,0,1};
 
int main() {
  vector<int> c(9);
  rep(i,9)cin>>c[i];
  if(c[0]+c[4]==c[1]+c[3]&&c[1]+c[5]==c[2]+c[4]&&c[3]+c[7]==c[4]+c[6]&&c[4]+c[8]==c[5]+c[7]){
    cout<<"Yes"<<endl;
    return 0;
  }
  cout<<"No"<<endl;
}

Measured memory_bytes: 3592
# include <iostream>
#include <deque>

using namespace std;

int main() {
    string s1,s2;
    cin>>s1>>s2;
    deque <char> dq;
    deque <char> dq1;
    if(s1==s2){
        cout<<"Yes";
        return 0;
    }
    for(int i=0;i<s1.size();i++){
        dq.push_back(s1[i]);
        dq1.push_back(s2[i]);
    }
    for(int i=s2.size()-1;i>0;i--){
            dq.push_front(s1[i]);
            dq.pop_back();
            if(dq==dq1){
                cout<<"Yes";
                return 0;
            }
    }
    cout<<"No";
}



Measured memory_bytes: 256
#include <iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
using namespace std;
int s[5]= {0};
int main()
{

    int n;
    int m;
    int i,j,k;
    int t=0;
    for(i=0; i<5; i++)
    {
        scanf("%d",&s[i]);
    }
    scanf("%d",&k);
    for(i=0; i<5; i++)
    {
        for(j=i+1; j<5; j++)
        {
            if(s[j]-s[i]>k)
            {
                printf(":(\n");
                t=1;
                break;
            }

        }
        if(t==1)
            break;
    }
    if(t!=1)
        printf("Yay!\n");
    return 0;
}


Measured memory_bytes: 256
#include <vector>
#include <iostream>
using namespace std;
int n, m;
int main() {
	while (cin >> n >> m, n) {
		int s = m;
		vector<int> v(n, 0);
		for (int i = 0; ; i = (i + 1 == n ? 0 : i + 1)) {
			if (m != 0) v[i]++, m--;
			else m = v[i], v[i] = 0;
			if (m == 0 && s - m - v[i] == 0) {
				cout << i << endl;
				break;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 3052
#include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <time.h>
//#include <unordered_map>
//#include <unordered_set>
#include <vector>

#pragma warning(disable:4996)
#pragma comment(linker, "/STACK:336777216")

using namespace std;

#define mp make_pair
#define all(x) (x).begin(), (x).end()

//typedef tuple<int, int, int> t3;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <db, db> pdd;

int IT_MAX = 1 << 18; // segment tree size
const ll MOD = 1000000007;
const int INF = 0x3f3f3f3f; // memset(dp, 0x3f, sizeof(dp)), 2*INF < INT_MAX
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const db PI = acos(-1);
const db ERR = 1e-10; // double EPS

vector <pair<pii, int>> Vx;
set <int> Sx;
int main() {
	int N, i, j, k;
	scanf("%d", &N);
	for (i = 0; i < 2 * N; i++) {
		scanf("%d %d", &j, &k);
		Vx.emplace_back(pii(j, k), i / N);
	}
	sort(all(Vx));

	int ans = 0;
	for (auto it : Vx) {
		int t1 = it.first.first, t2 = it.first.second, t3 = it.second;
		if (t3 == 0) Sx.insert(t2);
		else {
			auto it = Sx.lower_bound(t2);
			if (it == Sx.begin()) continue;
			it--;
			Sx.erase(it);
			ans++;
		}
	}
	return !printf("%d\n", ans);
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstring>

using namespace std;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	int n, m;
	cin >> n >> m;
	int map[n + 1];
	memset(map, -1, sizeof(map));
	for(int i = 0, s, c ; i < m ; i++)
	{
		cin >> s >> c;
		if((map[s] != -1 && map[s] != c) || (s == 1 && c == 0 && n > 1))
		{
			cout << -1 << '\n';
			return 0;
		}
		map[s] = c;
	}
	for(int i = 1 ; i <= n ; i++)
	{
		if(map[i] != -1)
			cout << map[i];
		else
			cout << ((i != 1 || n == 1)? 0 : 1);
	}
	cout << '\n';
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>

using namespace std;

typedef long long int ll;
typedef vector<ll> V;
typedef vector<V> VV;

int main() {
  ll n, m, c;
  V b;
  VV a;
  ll res = 0;

  cin >> n >> m >> c;
  for(ll i=0; i<m; i++) {
    ll bt;
    cin >> bt;
    b.push_back(bt);
  }
  for(ll i=0; i<n; i++) {
    V at;
    for(ll j=0; j<m; j++) {
      ll att;
      cin >> att;
      at.push_back(att);
    }
    a.push_back(at);
  }

  for(ll i=0; i<n; i++) {
    ll ev = c;
    for(ll j=0; j<m; j++) {
      ev += a[i][j] * b[j];
    }
    if(ev > 0) res++;
  }

  cout << res << endl;
  return 0;
}


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

struct item {
	int v, w;
};

int main() {
	int N, W;
	cin >> N >> W;
	int V[N + 1][W + 1];
	item items[N + 1];
	for (int i = 1; i <= N; i++) {
		cin >> items[i].v >> items[i].w;
	}

	for (int i = 0; i <= N; i++) {
		for (int j = 0; j <= W; j++)	{
			V[i][j] = 0;
		}
	}

	for (int i = 1; i <= N; i++) {
		for (int j = 1; j <= W; j++) {
			V[i][j] = j >= items[i].w ? max(V[i - 1][j], V[i - 1][j - items[i].w] + items[i].v) : V[i - 1][j];
		}
	}

	cout << V[N][W] << endl;
	return 0;
}

Measured memory_bytes: 5108
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<deque>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<string>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define reps(i,n) for(int i=1;i<=(int)n;i++)
#define all(v) v.begin(), v.end()
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define lb lower_bound
#define ub upper_bound
#define LB(a,x) lb(all(a), x) - a.begin()
#define UB(a,x) ub(all(a), x) - a.begin()
#define MOD 1000000007
#define itn int
#define enld endl
using namespace std;
typedef long long ll;
const double pi = 3.141592653589793;
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(b<a){a=b; return 1;} return 0;}
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    int x; cin >> x;
    if(x <= 599) cout << 8 << endl;
    else if(x <= 799) cout <<7 << endl;
    else if(x <= 999) cout <<6 << endl;
    else if(x <= 1199) cout << 5<< endl;
    else if(x <= 1399) cout << 4<< endl;
    else if(x <= 1599) cout << 3<< endl;
    else if(x <= 1799) cout << 2<< endl;
    else if(x <= 1999) cout << 1<< endl;
    return 0;
}

Measured memory_bytes: 3652
#include<stdio.h>

int main(){
	double a,b,c,d,e,f,x,y;

	while(~scanf("%lf%lf%lf%lf%lf%lf",&a,&b,&c,&d,&e,&f)){
		
		x=(e*c-b*f)/(a*e-b*d);
		y=(a*f-c*d)/(a*e-b*d);
		if(x==0){
			if(y==0){
				printf("0.000 0.000\n");
			}else{
				printf("0.000 %.3lf\n",y);
			}
		continue;
		}

		if(y==0){
			printf("%.3f 0.000\n",x);
			continue;
		}
		printf("%.3lf %.3lf\n",x,y);

	}



	return 0;
}

Measured memory_bytes: 0