akhauriyash/Code-Regression huggingface dataset:
///   BISMILLAHIR RAHMANIR RAHEEM
///   ALLAH IS WATCHING ME
///   ALLAH save us from COVID-19.Amin.

///   Every soul shall taste death.

/// Tag ::

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>

///  order_of_key return number of elements less than x.
///  find_by_order return index.

using namespace std;
using namespace __gnu_pbds;


#define MOHAMMAD  ios::sync_with_stdio(0);cin.tie(0);
#define all(x)    (x).begin(), (x).end()
#define AE        cout << fixed << setprecision(10);

int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1}; // 8-direction.......
int dy8[] = {1,-1, 1, -1, 0, 0, -1, 1};
int dx4[]= {1,-1,0,0}; // 4-direction...........
int dy4[]= {0,0,1,-1};

typedef tree< int, null_type, less<int>, rb_tree_tag,tree_order_statistics_node_update> ordered_set;
typedef tree<pair<int, int>,null_type,less<pair<int, int>>,rb_tree_tag,tree_order_statistics_node_update> ordered_multiset;

//debug
template<typename F,typename S>ostream&operator<<(ostream&os,const pair<F,S>&p){return os<<"("<<p.first<<", "<<p.second<<")";}
template<typename T>ostream&operator<<(ostream&os,const vector<T>&v){os<<"{";for(auto it=v.begin();it!=v.end();++it){if(it!=v.begin())os<<", ";os<<*it;}return os<<"}";}
template<typename T>ostream&operator<<(ostream&os,const set<T>&v){os<<"[";for(auto it=v.begin();it!=v.end();++it){if(it!=v.begin())os<<",";os<<*it;}return os<<"]";}
template<typename T>ostream&operator<<(ostream&os,const multiset<T>&v) {os<<"[";for(auto it=v.begin();it!=v.end();++it){if(it!=v.begin())os<<", ";os<<*it;}return os<<"]";}
template<typename F,typename S>ostream&operator<<(ostream&os,const map<F,S>&v){os<<"[";for(auto it=v.begin();it!=v.end();++it){if(it!=v.begin())os<<", ";os<<it->first<<" = "<<it->second;}return os<<"]";}
#define dbg(args...) do {cerr << #args << " : "; faltu(args); } while(0)
void faltu(){cerr << endl;}
template<typename T>void faltu(T a[],int n){for(int i=0;i<n;++i)cerr<<a[i]<<' ';cerr<<endl;}
template<typename T,typename...hello>void faltu(T arg,const hello&...rest){cerr<<arg<<' ';faltu(rest...);}
//#else
//#define dbg(args...)
//***********************************************  The END **********************************************************************************************************************************
using ll =  long long;
const ll N = 1e5 + 10;
const ll INF = 1e18;
const ll mod = 7901;
const ll limit = (1LL<<64) - 1;

int main()
{

 MOHAMMAD

 string s;
 cin >> s;

 vector < ll > e[26];

 for ( ll i = 0 ; i < s.size( ) ; ++i ) {
      ll x = s[i] - 'a';
      e[x].push_back ( i + 1 );
 }

 ll lg = -1 , rg = -1;

 for ( ll i = 0 ; i<26 ; ++i  ){
     for ( ll k = 1 ; k<e[i].size() ; ++k  ){
          if( (e[i][k]-e[i][k-1])<=2 ) {
                lg = e[i][k-1];
                rg = e[i][k];
          }
     }
 }
 

 cout << lg << " " << rg << "\n";

}


/*




  Alhamdulillah
*/


Measured memory_bytes: 4568
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    ios_base:: sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    set<string> st;
    ll n;cin>>n;
    string prv;cin>>prv;
    st.insert(prv);
    for(ll i=2;i<=n;i++){
        string s;cin>>s;
        if(st.count(s) || s[0] != prv.back())return cout<<"No" , 0;
        st.insert(s);
        prv=s;
    }
    cout<<"Yes";
}

Measured memory_bytes: 256
object Main extends App {

  import scala.io.StdIn._

  val n = readInt
  val b = readLine.split("[ ]+").map(_.toInt)
  val a = Array.fill(n)(0)
  a(0) = b(0)
  a(1) = b(0)
  for (i <- 1 until n - 1) {
    a(i + 1) = b(i)
    if (b(i - 1) > b(i))
      a(i) = b(i)
  }
  println(a.sum)
}


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

using namespace std;
using namespace __gnu_cxx;

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

#define F          first
#define S          second
#define pnl        printf("\n")
#define sz(x)      (int)x.size()
#define sf(x)      scanf("%d",&x)
#define pf(x)      printf("%d\n",x)
#define all(x)     x.begin(),x.end()
#define rall(x)    x.rbegin(),x.rend()
#define rep(i, n)  for(int i = 0; i < n; ++i)

const db eps = 1e-9;
const db pi = acos(-1);
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const int mod = 1000 * 1000 * 1000 + 7;

int n;
int a[100100][3];
int dp[100100][4];

int solve(int i, int lst) {
    if (i == n) return 0;
    int &ret = dp[i][lst];
    if (~ret) return ret;
    for (int j = 0; j < 3; ++j)
        if (j != lst) ret = max(ret, solve(i + 1, j) + a[i][j]);
    return ret;
}

int main() {
    scanf("%d", &n);
    for (int i = 0; i < n; ++i)
        for (int j = 0; j < 3; ++j)
            scanf("%d", &a[i][j]);
    memset(dp, -1, sizeof dp);
    printf("%d\n", solve(0, 3));
    return 0;
}


Measured memory_bytes: 10752
#include<bits/stdc++.h>
using namespace std;
int main()
{
  string s;
  int ans=0;
  int n;
  cin>>n>>s;
  for(int i=0;i<n-2;i++)
  {
    if(s[i]=='A')
    {
      if(s[i+1]=='B')
      {
        if(s[i+2]=='C')
          ans++;
      }
    }
  }
  cout<<ans;
}

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


signed main() {
#ifdef DEBUG
	assert(freopen("input.txt", "r", stdin));
#endif
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	
	int x;
	cin >> x;
	cout << (x - 1) / 2 << "\n";
	
	return 0;
}


Measured memory_bytes: 256
N,K = map(int, input().split())
Ds = list(map(int, input().split()))

able = []
for i in range(10):
    if i in Ds:continue
    able.append(i)
# print(able)

sN = str(N)
n = len(sN)
m = able[0] #最小


if int(sN[0]) > max(able):
    if m == 0:
        ans = str(able[1]) + str(able[0]) * n
    else:
        ans = str(able[0]) * (n+1)
    print(ans)
    exit()
prev = -1
flg = True #確定していない
ans = ""
for i,s in enumerate(sN):
    flg2 = False
    if flg:
        for j,a in enumerate(able):
            if int(s) < a:
                ans += str(a)
                flg = False
                flg2 = True
                break
            if int(s) == a:
                ans += str(a)
                flg = True
                flg2 = True
                break
        if not flg2:
            if prev == len(able)-1:
                if m == 0:
                    ans = str(able[1]) + str(able[0]) * n
                else:
                    ans = str(able[0]) * (n+1)
                print(ans)
                exit() 
            ans = ans[:-1]
            ans += str(able[prev+1]) + str(m)
            flg = False
    else:
        ans += str(m)    
    prev = j
    # print(ans)

print(ans)


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

int main() {
    int N, M, MIN, buf;
    int num;
    cin >> N >> M;

    vector<int> A(N), B(N), C(M), D(M);
    vector<int> ans(N);

    for(int i = 0; i < N; i++){
        cin >> A.at(i) >> B.at(i);
    }
    
    for(int i = 0; i < M; i++){
        cin >> C.at(i) >> D.at(i);
    }

    for(int i = 0; i < N; i++){
        for(int j = 0; j < M; j++){
            if(j == 0){// 初期値
                MIN = abs(A.at(i) - C.at(j)) + abs(B.at(i) - D.at(j));
                num = j;
            }else{
                buf = abs(A.at(i) - C.at(j)) + abs(B.at(i) - D.at(j));
                if(buf < MIN){ // 更新
                    MIN = buf;
                    num = j;
                }
            }
        }

        ans.at(i) = num;
    }

    for(int i = 0; i < N; i++){
        cout << ans.at(i)+1 << endl;
    }
}

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

#define all(x) (x).begin(),(x).end()
#define init() \
  ios::sync_with_stdio(false); \
  cin.tie(0)

using namespace std;

using ll = long long;
using ull = unsigned long long;

template<typename M, typename N>
constexpr common_type_t<M, N> gcd(M a, N b) {
  return a == 0 ? b
    : b == 0 ? a
    : gcd(b, a % b);
}

template <typename M, typename N>
constexpr common_type_t<M, N> lcm(M a, N b) {
  return a * b / gcd(a, b);
}

int main() {
  init();

  char c;
  cin >> c;
  cout << (char)(c + 1) << '\n';

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std; 
int main(void){

  int n, a;
  cin >> n;
  
  vector<int> vec(n + 1);
  for (int i = 0; i < n; i++) {
    cin >> a;
    vec.at(a) = i + 1;
  }
  
  for (int i = 1; i < vec.size()-1; i ++){
    cout << vec.at(i) << " ";
  }
  cout << vec.at(vec.size() - 1) << endl;

  return 0;
}

Measured memory_bytes: 1152
use std::io::Read;
use std::collections::VecDeque;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();

    let answer = solve(&buf);

    println!("{}", answer);
}

fn solve(input: &str) -> String {
    let mut iterator = input.split_whitespace();

    let n: usize = iterator.next().unwrap().parse().unwrap();
    let m: usize = iterator.next().unwrap().parse().unwrap();
    let mut edges: Vec<(usize, usize)> = Vec::new();
    let mut graph: Vec<Vec<usize>> = vec![vec![]; n];
    for _ in 0..m {
        let a: usize = iterator.next().unwrap().parse().unwrap();
        let b: usize = iterator.next().unwrap().parse().unwrap();
        edges.push((a - 1, b - 1));
        graph[a - 1].push(b - 1);
        graph[b - 1].push(a - 1);
    }

    let mut ans: usize = 0;
    for edge in edges {
        let mut visited: Vec<bool> = vec![false; n];
        let mut q: VecDeque<usize> = VecDeque::new();
        q.push_back(0);
        visited[0] = true;
        while !q.is_empty() {
            let u: usize = q.pop_front().unwrap();
            for &v in &graph[u] {
                if u == edge.0 && v == edge.1 || u == edge.1 && v == edge.0 {
                    continue;
                }
                if !visited[v] {
                    visited[v] = true;
                    q.push_back(v);
                }
            }
        }
        if visited.iter().any(|it| *it == false) {
            ans += 1;
        }
    }
    ans.to_string()
}


Measured memory_bytes: 2184
#include <iostream>
#include <sstream>
#include <stdio.h>
//#define _USE_MATH_DEFINES
#include <math.h>
#include <set>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <limits>
#include <bitset>
#include <stack>
#include <queue>
#include <ctype.h>

typedef long long int lli;
#define rep(i,s,N) for(int i=s;i<N;i++)
#define MOD 1000000007
#define more(a,b) (((a)>(b))?(a):(b))
#define less(a,b) (((a)<(b))?(a):(b))

using namespace std;


int main(void)
{
	int N; cin >> N;
	vector<int> A(N); rep(i, 0, N)cin >> A[i];
	int ans = 0, cnt = 1;
	int tmp = A[0];
	rep(i, 1, N) {
		if (A[i] == tmp)cnt++;
		else {
			ans += (cnt / 2);
			cnt = 1;
			tmp = A[i];
		}
		if(i == N - 1)ans += (cnt / 2);
	}
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <math.h>
#include <vector>
#include <iomanip>
#include <map>
using namespace std;

void solve(){
  int x, a; cin >> x >> a;
  if(x < a) cout << 0 << endl;
  else cout << 10 << endl;
  return;
}

int main(){
  solve();
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int a,b,sum;
    scanf("%d %d",&a,&b);
    sum=a+b;
    if(a%3==0 || b%3==0 || (a+b)%3==0)
{
        printf("Possible");
    }
    else
        printf("Impossible");


    return 0;

}


Measured memory_bytes: 128
import math
d=input().split()
N,D=int(d[0]),int(d[1])
l=[None]*N
for i in range(N):
  l[i]=input().split()
  for j in range(D):
    l[i][j]=int(l[i][j])
a=0
for i in range(N-1):
  for j in range(i+1,N):
    s=0
    for k in range(D):
      s+=(l[i][k]-l[j][k])**2
    if math.sqrt(s)==math.sqrt(s)//1:
      a+=1
print(a)


Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <stack>
#include <istream>
#include <map>
#include <set>
#include <queue>
#define rep0(i,n) for (int i = 0; i < (n); ++i)
#define rep1(i,n) for (int i = 1; i < (n); ++i)
#define REP(i,a,b) for (int i = a; i < (b); ++i) 
typedef long long ll;
using namespace std;
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	/*
	/
	/
	/
	*/
	ll a, b, c;
	cin >> a >> b >> c;
	cout<< (a - c) / (b + c) << endl;
	return 0;
}

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

using namespace std;

typedef long long lol;
const int N = 1 << 19;
const int mod = 1e9 + 7;
inline int pls( int a , int b ) { a += b - mod; return a + ( a >> 31 & mod ); }
inline int mns( int a , int b ) { a -= b; return a + ( a >> 31 & mod ); }
inline void inc( int & a , int b ) { a += b - mod; a += a >> 31 & mod; }
inline void dec( int & a , int b ) { a -= b; a += a >> 31 & mod; }
inline int fpow( int base , int k ) {
  int res = 1;
  while( k ) {
    if( k & 1 ) res = (long long)res * base % mod;
    base = (long long)base * base % mod; k >>= 1;
  }
  return res;
} int _w;

int n , lg , p[N] , ans , bac[N];

int dist( int u , int v ) {
  if( u < v ) swap( u , v );
  int res = u;
  while( u != v ) {
    u >>= 1;
    res = (lol)res*u%mod;
  }
  return res;
}
  
void upd( int u , int w , bool flag ) {
  while( u ) {
    w = (lol)w * u % mod;
    if( flag ) dec( bac[u] , w );
    else inc( bac[u] , w );
    u >>= 1;
  }
}

void qry( int u , int w ) {
  int lb = 0;
  while( u ) {
    inc( ans , (lol)w * bac[u] % mod );
    dec( ans , (lol)w * lb % mod * u % mod );
    lb = bac[u];
    w = (lol)w * u % mod;
    u >>= 1;
  }
}

int inv[N];

void solve( int u , int l , int r ) {
  if( r == l ) return;
  int mid = ( l + r ) >> 1; 
  for( int i = l ; i <= mid ; ++i ) 
    upd( p[i] , dist( i , u ) , 0 );
  for( int i = mid + 1 ; i <= r ; ++i )
    qry( p[i] , (lol)dist( i , u ) * inv[u] % mod );
  for( int i = l ; i <= mid ; ++i )
    upd( p[i] , dist( i , u ) , 1 );
  solve( u << 1 , l , mid );
  solve( u << 1 | 1 , mid + 1 , r );
}

int main( void ) {
  _w = scanf("%d",&lg);
  n = ( 1 << lg );
  inv[1] = 1;
  for( int i = 2 ; i < N ; ++i )
    inv[i] = (lol)(mod-mod/i)*inv[mod%i]%mod;
  for( int i = ( 1 << ( lg - 1 ) ) ; i < n ; ++i )
    _w = scanf("%d",p+i) , p[i] += ( 1 << ( lg - 1 ) ) - 1;
  solve( 1 , ( 1 << ( lg - 1 ) ) , n - 1 );
  cout << ans;
  return 0;
}


Measured memory_bytes: 7356
#include<iostream>
#include<vector>
#include<sstream>
#include<string>
#include<numeric>
#include <algorithm>
#include<math.h>
#include<cstdio>
#include<string.h>
#include<stdio.h>
#include<stdlib.h>




using namespace std;
typedef long long ll;
struct point{
  int x;
  int y;

};
int gcd( int m, int n )
{
	// 引数に０がある場合は０を返す
	if ( ( 0 == m ) || ( 0 == n ) )
		return 0;
	
	// ユークリッドの方法
	while( m != n )
	{
		if ( m > n ) m = m - n;
		else         n = n - m;
	}
	return m;
}//gcd
int lcm( int m, int n )
{
	// 引数に０がある場合は０を返す
	if ( ( 0 == m ) || ( 0 == n ) )
		return 0;
	
	return ((m / gcd(m, n)) * n); // lcm = m * n / gcd(m,n)
}//lcm
int input(){
  int x;
  cin>>x;
  return x;
}

int moji(char in)
{
    int ans = (int)in-(int)'a'+1;
    if((in < 1) || (in > 26)){
        ans = 100;
    }
    return ans;
}
const int VV=10;//場合に応じてVVの値のみ変更する必要あり
//dijkstra(s)sがスタート地点でそこからの最短距離を配列dで表す。正の重みのみ使用可能
int cost[VV][VV];
int d[VV];
bool used[VV];
void dijkstra(int s){
  fill(d,d+VV,100000);
  fill(used,used+VV,false);
  d[s]=0;
  while(true){
    int v=-1;
    for(int u=0;u<VV;u++){
      if(!used[u]&&(v==-1||d[u]<d[v]))v=u;
    }
    if(v==-1)break;
    used[v]=true;
    for(int u=0;u<VV;u++){
      d[u]=min(d[u],d[v]+cost[v][u]);
    }
  }

}

int compare_int(const void *a, const void *b)//qsort(quick sort利用時に使用)
{
    return *(int*)a - *(int*)b;
}





int main(){
  int K;
  int A[3];
  cin>>A[0]>>A[1]>>A[2]>>K;
  sort(A,A+3);
  for(int i=0;i<K;i++){
    A[2]*=2;

  }
  cout<<A[0]+A[1]+A[2]<<endl;





  



}


  


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

int main(){
  int N,M,ans=0;
  cin>>N>>M;
  int A[M];
  for(int i=0;i<M;i++){
    cin>>A[i];
    ans+=A[i];
  }
  
  if(N>=ans){
    cout<<N-ans<<endl;
  }
  else{
    cout<<-1<<endl;
  }
  
}

Measured memory_bytes: 3664
/***************************************************
 * Problem Name : C.cpp
 * Problem Link :
 * OJ           :
 * Verdict      : Trying
 * Date         : 2020-02-16
 * Problem Type :
 * Author Name  : Saikat Sharma
 * University   : CSE, MBSTU
 ***************************************************/
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <climits>
#include <cstring>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <list>
#include <unordered_map>
#include <unordered_set>
#include <cstdlib>
#include <deque>
#include <stack>
#include <bitset>
#include <cassert>
#include <map>
#include <set>
#include <cassert>
#include <iomanip>
#include <random>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef unsigned long long ull;

#define __FastIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define __FileRead freopen ("input.txt", "r", stdin)
#define __FileWrite freopen ("output.txt", "w", stdout)
#define SET(a,v) memset(a,v,sizeof(a))
#define SZ(v) (int)v.size()
#define pii pair<int,int>
#define pil pair <int, ll>
#define pli pair <ll, int>
#define pll pair <ll, ll>
#define debug cout <<"######\n"
#define debug1(x) cout <<"### " << x << " ###\n"
#define debug2(x,y) cout <<"# " << x <<" : "<< y <<" #\n"
#define nl cout << "\n";
#define sp cout << " ";
#define sl(n) scanf("%lld", &n)
#define sf(n) scanf("%lf", &n)
#define si(n) scanf("%d", &n)
#define ss(n) scanf("%s", n)
#define pf(n) scanf("%d", n)
#define pfl(n) scanf("%lld", n)
#define all(v) v.begin(), v.end()
#define rall(v) v.begin(), v.end()
#define srt(v) sort(v.begin(), v.end())
#define r_srt(v) sort(v.rbegin(), v.rend())
#define rev(v) reverse(v.begin(), v.end())
#define Sqr(x) ((x)*(x))
#define Mod(x, m) ((((x) % (m)) + (m)) % (m))
#define max3(a, b, c) max(a, max(b, c))
#define min3(a, b, c) min(a, min(b, c))
#define pb push_back
#define mk make_pair
#define MAX 100005
#define INF 1000000009
#define MOD 1000000007

template<class T>
using min_heap = priority_queue<T, std::vector<T>, std::greater<T>>;
template<typename T>
using ordered_set  = tree<T, null_type, less<T>, rb_tree_tag,
      tree_order_statistics_node_update>;

template <typename T> string toString ( T Number ) {
    stringstream ss;
    ss << Number;
    return ss.str();
}
template<typename T> int toInt (T str) {
    stringstream ss;
    ss << str;
    int num;
    ss >> num;
    return num;
}
ll lcm (ll a, ll b) {
    return a * b / __gcd (a, b);
}
/************************************ Code Start Here ******************************************************/
int main () {
    __FastIO;
    //~ cout << setprecision (10);
    //~ cout << fixed;
    int n;
    cin >> n;
    int mx = 0;
    map<string, int>mp;
    set<string>st;

    for (int i = 0; i < n; i++) {
        string str;
        cin >> str;
        st.insert(str);
        mp[str]++;
        mx = max (mx, mp[str]);
    }
    for(auto it : st){
		if(mp[it] == mx){
			cout << it << "\n";
		}
	}

    return 0;
}


Measured memory_bytes: 33280
n, m = map(int, input().split())
P = []
S = []
for i in range(m):
    p, s = input().split()
    P.append(p)
    S.append(s)
V = [[0] * 2 for i in range(n)]
for i in range(m):
    j = int(P[i]) - 1
    if V[j][0] != 1:
        if S[i] == 'AC':
            V[j][0] = 1
        else:
            V[j][1] += 1
a = 0
w = 0
for i in range(n):
    if V[i][0] == 1:
        a += 1
        w += V[i][1]
print(a, w)

Measured memory_bytes: 25888
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>
#include <chrono>

static constexpr int MOD = 1000000007;
using ll = long long;
using u32 = uint32_t;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

class xor_shift {
    uint32_t x, y, z, w;
public:
    xor_shift() : x(static_cast<uint32_t>((chrono::system_clock::now().time_since_epoch().count())&((1LL << 32)-1))),
    y(1068246329), z(321908594), w(1234567890) {};

    uint32_t urand(){
        uint32_t t;
        t = x ^ (x << 11);
        x = y; y = z; z = w;
        w = (w ^ (w >> 19)) ^ (t ^ (t >> 8));
        return w;
    };

    int rand(int n){
        if(n < 0) return -rand(-n);
        uint32_t t = numeric_limits<uint32_t>::max()/(n+1)*(n+1);
        uint32_t e = urand();
        while(e >= t) e = urand();
        return static_cast<int>(e%(n+1));
    }

    int rand(int a, int b){
        if(a > b) swap(a, b);
        return a+rand(b-a);
    }
};


xor_shift rd;

template<int M>
class rolling_hash {

    static ll &B() {
        static ll B_ = rd.rand(2, M-1);
        return B_;
    }
    static vector<ll> &p() {
        static vector<ll> p_{1, B()};
        return p_;
    }
public:
    vector<ll> hash;
    explicit rolling_hash(const string &s) {
        if(p().size() <= s.size()){
            int l = p().size();
            p().resize(s.size()+1);
            for (int i = l; i < p().size(); ++i) {
                p()[i] = (p()[i-1]*p()[1])%M;
            }
        }
        hash.resize(s.size()+1, 0);
        for (int i = 0; i < s.size(); ++i) {
            hash[i+1] = (hash[i]*B() + s[i]) % M;
        }
    };

    ll get(int l, int r){
        ll res = hash[r]+M-hash[l]*p()[r-l]%M;
        return res >= M ? res-M : res;
    }
};

int main() {
    int n; string s;
    cin >> n >> s;
    rolling_hash<MOD> hash(s);
    rolling_hash<INF<int>> hash2(s);
    int ok = 0, ng = n;
    while(ng - ok > 1){
        int mid = (ok+ng)/2;
        map<pair<ll, ll>, int> v;
        int good = 0;
        for (int i = 0; i+mid-1 < n; ++i) {
            pair<ll, ll> x = {hash.get(i, i+mid), hash2.get(i, i+mid)};
            if(v.count(x)){
                if(v[x]+mid-1 < i) good = 1;
            }else {
                v[x] = i;
            }
        }
        if(good) ok = mid;
        else ng = mid;
    }
    cout << ok << "\n";
    return 0;
}

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

using namespace std;

int main()
{
    string s1, s2;
    int i, judge = 1;
    cin >> s1;
    cin >> s2;

    for (i = 0; i < (int)s1.length(); i++)
    {
        if (s1[i] != s2[i])
        {
            judge = 0;
        }
    }

    if (judge == 1)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
    


    return 0;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int N;
    cin >> N;
    
    int ac, wa, tle, re;
    string str;

    ac = 0;
    wa = 0;
    tle = 0;
    re = 0;

    for (int i = 0; i < N; i++){

        cin >> str;

        if(str=="AC"){
            ac = ac + 1;
        }

        if(str=="WA"){
            wa = wa + 1;
        }

        if(str=="TLE"){
            tle = tle + 1;
        }

        if(str=="RE"){
            re = re + 1;
        }

    }

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

}

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

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    cin >> n;
    int mx = n + 1;
    int ans = 0;
    for (int i = 0; i < n; ++i) {
        int now;
        cin >> now;
        if (now < mx)
            ++ans;
        mx = min(mx, now);
    }
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

typedef long long ll;

#define N_MAX 1000001
#define P 1000000007

using namespace std;

ll inv[N_MAX], fac[N_MAX], finv[N_MAX];

ll comb(ll n, ll r){
  ll ans = 1;
  ans = (fac[n]*finv[n-r])%P;
  ans = (ans*finv[r])%P;
  if(ans < 0) ans += P;
  return ans;
}

void make(){
    fac[0]=fac[1]=1;
    finv[0]=finv[1]=1;
    inv[1]=1;
    for(int i=2;i<N_MAX;i++){
        inv[i]=P-inv[P%i]*(P/i)%P;
        fac[i]=fac[i-1]*(ll) i%P;
        finv[i]=finv[i-1]*inv[i]%P;
    }
}

int main(){
    int N;
    //ll f[N_MAX];
    ll ans;
    cin >> N;
    
    ll s;
    make();
    if(N%2 == 0){
        s = N/2;
        ans = (((s*comb(s-1, N-s-1))%P)*((fac[s]*fac[N-s-1])%P))%P;
        //cout << comb(s-1, N-s-1) << ' ' << fac[s] << ' ' << fac[N-s-1] << endl;
    }else{
        s = (N+1)/2;
        ans = ((s*comb(s-1, N-s-1)%P)*((fac[s]*fac[N-s-1])%P))%P;
    }
    if(ans < 0)ans+=P;
    
    s++;
    for(;s <= N-1; s++){
        ll tmp;
        tmp = (((s*comb(s-1, N-s-1))%P)*((fac[s]*fac[N-s-1])%P))%P - (((s*comb(s-2, N-s))%P)*((fac[s-1]*fac[N-s])%P))%P;
        //cout << ((s*comb(s-1, N-s-1)%P)*(fac[s]*fac[N-s-1])%P)%P << endl;
        //cout << ((s*comb(s-2, N-s)%P)*(fac[s-1]*fac[N-s])%P)%P << endl;
        tmp = tmp%P; 
        if(tmp < 0)tmp+=P;
        //cout << tmp << endl;
        ans = (ans+tmp)%P;
    }
    cout << ans << endl;
}

Measured memory_bytes: 23680
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace std;
using namespace __gnu_pbds;   
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
#define ll long long int
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define pll pair<ll,ll>
#define all(x) x.begin(),x.end()
#define sz(x) (ll)x.size() 

ll a[200005];
map<ll,ll>M;
int main()
{
    ios_base::sync_with_stdio(false);
	ll n,i,j,k,x,y,t,m;

	cin >> n;
	ll ans=0;
	for(i=1;i<=n;i++)
	{
		cin >> a[i];

		if(M.find(i-a[i])!=M.end())
			ans+=M[i-a[i]];

		if(M.find(a[i]+i)!=M.end())
			M[a[i]+i]++;
		else
			M[a[i]+i]=1;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 17676
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <iterator>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main() {
	int N, M, X, Y;
	cin >> N >> M >> X >> Y;
	vector<int> x(N), y(M);
	for (int i = 0; i < N; i++) {
		cin >> x[i];
	}
	for (int i = 0; i < M; i++) {
		cin >> y[i];
	}
	if (X >= Y) {
		cout << "War";
	}
	else {
		int max_x = *max_element(x.begin(), x.end());
		int min_y = *min_element(y.begin(), y.end());
		for (int i = X + 1; i <= Y; i++) {
			if (i > max_x && i <= min_y) {
				cout << "No War";
				return 0;
			}
		}
		cout << "War";
	}


	return 0;
}

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

int main(void) {
  int N, K;
  cin >> N >> K;
  vector<int> V(N);
  for (int i = 0; i < N; i++) {
    cin >> V[i];
  }
  int ret = -1;
  for (int numTake = 0; numTake <= K; numTake++) {
    if (numTake >= N) {
      int sum = 0;
      priority_queue<int, vector<int>, greater<int>> pq;
      for (int i = 0; i < N; i++) {
        sum += V[i];
        pq.push(V[i]);
      }
      for (int i = 0; i < numTake - N; i++) {
        if (pq.empty()) break;
        int m = pq.top();
        pq.pop();
        if (m >= 0) break;
        sum -= m;
      }
      ret = max(ret, sum);
      continue;
    }

    for (int numLeft = 0; numLeft <= numTake; numLeft++) {
      int sum = 0;
      priority_queue<int, vector<int>, greater<int>> pq;
      for (int i = 0; i < numLeft; i++) {
        sum += V[i];
        pq.push(V[i]);
      }
      for (int i = 0; i < numTake - numLeft; i++) {
        sum += V[N - 1 - i];
        pq.push(V[N - 1 - i]);
      }

      for (int i = 0; i < K - numTake; i++) {
        if (pq.empty()) break;
        int m = pq.top();
        pq.pop();
        if (m >= 0) break;
        sum -= m;
      } 
      // cerr << sum << endl;
      ret = max(ret, sum);
    }
  }
  cout << ret << endl;
  return 0;
}

Measured memory_bytes: 256
type tree = Nil | Node of int * tree * tree

let create () = Nil

let insert x t =
  let rec doit = function
    | Nil -> Node (x, Nil, Nil)
    | Node (y, l, r) when x < y -> Node (y, doit l, r)
    | Node (y, l, r) -> Node (y, l, doit r) in
  doit t

let preorder f t =
  let rec doit = function
    | Nil -> ()
    | Node (x, l, r) -> f x; doit l; doit r in
  doit t

let inorder f t =
  let rec doit = function
    | Nil -> ()
    | Node (x, l, r) -> doit l; f x; doit r in
  doit t

let print t =
  let f e = print_string " "; print_int e in
  inorder f t;
  print_newline ();
  preorder f t;
  print_newline ()

let find x t =
  let rec doit = function
    | Nil -> false
    | Node (y, _, _) when x = y -> true
    | Node (y, l, _) when x < y -> doit l
    | Node (_, _, r) -> doit r in
  doit t

let split_on_char sep s =
  let open String in
  let r = ref [] in
  let j = ref (length s) in
  for i = length s - 1 downto 0 do
    if get s i = sep then begin
      r := sub s (i + 1) (!j - i - 1) :: !r;
      j := i
    end
  done;
  sub s 0 !j :: !r

let () =
  let m = read_int () in
  let rec read i t =
    if i < m then
      match split_on_char ' ' (read_line ()) with
      | ["insert"; n] -> read (i + 1) (insert (int_of_string n) t)
      | ["find"; n] -> print_endline (if find (int_of_string n) t then "yes" else "no"); read (i + 1) t
      | _ -> print t; read (i + 1) t in
  read 0 (create ())

Measured memory_bytes: 27188
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>

using namespace std;

#define FOR(i, start, end) for(int i = (start); i < (end); ++i)
#define REP(i, n) FOR(i, 0, n)



vector<int> read_nums()
{
    int n;
    scanf("%d", &n);

    vector<int> nums(n);
    REP(i, n) {
        scanf("%d", &nums[i]);
    }

    return nums;
}

bool is_prime(int n)
{
    int dmax = static_cast<int>(sqrt(n));

    FOR(d, 2, dmax+1) {
        if(n % d == 0) return false;
    }

    return true;
}

int main()
{
    vector<int> nums = read_nums();
#if 0
    REP(i, nums.size()) {
        printf("%d ", nums[i]);
    }
#endif

    int answer = count_if(nums.begin(), nums.end(), is_prime);
    printf("%d\n", answer);

    return 0;
}

Measured memory_bytes: 2724
n = gets.to_i
an = n.times.map { gets.to_i }

sorted = an.sort.reverse

max = sorted.first
is_duplicated = max == sorted[1]
next_max = an.select {|e| e != max }.max

an.each do |a|
    if a != max
        puts max
    elsif is_duplicated
        puts max
    else
        puts next_max
    end
end

Measured memory_bytes: 8040
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define rep(i,N) for(int i = 0; i < (N); i++)
#define erep(i,N) for(int i = N; i >= 0; i--)
const ll INF = 1000000000;
const ll mod = 1000000007;
#define PI 3.1415926535
using Graph = vector<vector<int>>;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true;} return false;}
bool seen[100000];
void dfs(const Graph &G, int v) {
    seen[v] = true; // v を訪問済にする
 
    // v から行ける各頂点 next_v について
    for (auto next_v : G[v]) { 
        if (seen[next_v]) continue; // next_v が探索済だったらスルー
        dfs(G, next_v); // 再帰的に探索
    }
}

//dpTable
int dp[100050];

int main(){
    string S;
    cin >> S;
    stack<char> hoge;
    rep (i,S.size()) {
        if (S.at(i) == 'S') hoge.push('S');
        else {
            if (hoge.empty()) hoge.push('T');
            else {
                if (hoge.top() == 'S') hoge.pop();
                else hoge.push('T');
            }
        }
    }
    int ans = 0;
    while (!hoge.empty()) {
        hoge.pop();
        ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3796
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int C = sc.nextInt();
		int D = sc.nextInt();

		System.out.println(Math.max(Math.min(B, D) - Math.max(A, C), 0));
	}
}


Measured memory_bytes: 21844
#include <iostream>
#include <algorithm>
#include <queue>
#include <tuple>
using namespace std;

#define rep(i,n) for(int i=0;i<int(n);i++)
const int INFTY=1<<29;

int main()
{
	for(int n;cin>>n,n;){
		int a[2][100];
		rep(i,2) rep(j,n) cin>>a[i][j];
		
		int memo[2][102];
		rep(i,2) rep(j,102)
			memo[i][j]=INFTY;
		
		queue<tuple<int,int,int>> q;
		q.emplace(0,0,0);
		q.emplace(1,0,0);
		while(!q.empty()){
			auto cur=q.front(); q.pop();
			int i=get<0>(cur),j=get<1>(cur),c=get<2>(cur);
			if(j>=n)
				continue;
			if(a[i][j]==1){
				int k=j;
				while(k<n && a[i][k]==1)
					k++;
				j=k-1;
			}
			else if(a[i][j]==2){
				int k=j;
				while(k>=0 && a[i][k]==2)
					k--;
				j=k;
			}
			if(memo[i][j]<=c)
				continue;
			memo[i][j]=c;
			rep(k,3)
				q.emplace(!i,j+k,c+1);
		}
		
		int res=min(memo[0][n-1],memo[1][n-1]);
		if(res==INFTY)
			cout<<"NA"<<endl;
		else
			cout<<res<<endl;
	}
	return 0;
}

Measured memory_bytes: 1216
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
  int N, K;
  cin >> N >> K;
  vector<int> l(N);
  for(int i = 0; i < N; i++) cin >> l[i];
  sort(l.begin(), l.end(), greater<int>());
  
  int sum = 0;
  for(int i = 0; i < K; i++) sum += l[i];
  cout << sum << endl;
  
  return 0;
}

Measured memory_bytes: 256
import java.util.*;
import java.io.*;
public class Main{
    public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		PrintWriter ou = new PrintWriter(System.out);
		int n = Integer.parseInt(sc.next());
		Long a = Long.parseLong(sc.next());
		long b = Long.parseLong(sc.next());
		int[] x = new int[n];
		for(int i = 0 ; i < n ; i++) x[i] = Integer.parseInt(sc.next());
		sc.close();
		long yono = 0;
		for(int i = 0 ; i < n - 1 ; i++){
			yono += Math.min(b , (x[i + 1] - x[i]) * a);
		}
		ou.print(yono + "\n");
		ou.flush();
    }
}

Measured memory_bytes: 60012
n = int(input())
w = list(map(int,input().split()))
s = 0
list = []
for i in range(n):
  s += w[i]
for i in range(n):
  t = 0
  for j in range(i):
    t += w[j]
  list.append(abs(s - 2*t))
print(min(list))

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

Measured memory_bytes: 23092
# coding: utf-8
# Your code here!
import sys
sys.setrecursionlimit(10**7)

N,M=map(int,input().split())

visited=[0]*N
frnds=[[] for i in range(N)]

for _ in range(M):
    a,b=map(int,input().split())
    frnds[a-1].append(b-1)
    frnds[b-1].append(a-1)

for i in range(N):
    frnds[i]=list(set(frnds[i]))

def saiki(num):
    value=1
    visited[num]=1
    for f in frnds[num]:
        if visited[f]!=1:
            value+=saiki(f)
    return value

ans=0
for i in range(N):
    if visited[i]!=1:
        ans=max(saiki(i),ans)

print(ans)

Measured memory_bytes: 213804
#include "bits/stdc++.h"
using namespace std;

class node
{
	public:
	int parent=-1;//親のindex
	int left=-1;
	int right=-1;//右側の子のindex
	int num;//書いてある数字
	int depth;
	node(int n,int d)
	{
		depth=d;
		num=n;
	}
};

int aparentid;
int bparentid;

vector<node> decode(string s,int mode)
{
	vector<node> ret;
	int predepth=-1;
	int now=1;//現在の深さ
	//それぞれのノードの深さと数字だけ求める
	for(int i=0;i<s.size();i++)
	{
		if(s[i]=='(')
			now++;
		else if(s[i]==')')
			now--;
		else{
			i++;
			int num=0;
			while(s[i]!=']')
			{
				num*=10;
				num+=(int)(s[i]-'0');
				i++;
			}
			ret.push_back(node(num,now));
			if(now==1)
			{
				if(mode==0)
					aparentid=ret.size()-1;
				else
					bparentid=ret.size()-1;
			}
		}
	}
	//深さ情報から木を復元する
	for(int i=0;i<ret.size();i++)
	{
		int dp=ret[i].depth;
		if(dp==1)
			continue;
		//親を探す
		//両向きに探して近いほうが答え
		int lind=i;
		int rind=i;
		while(ret[lind].depth!=dp-1)
		{
			lind--;
			if(lind==-1 || ret[lind].depth<dp-1)
			{
				lind=-10000;
				break;
			}
		}
		while(ret[rind].depth!=dp-1)
		{
			rind++;
			if(rind==ret.size() || ret[rind].depth<dp-1)
			{
				rind=50000;
				break;
			}
		}
		if(i-lind<rind-i)
		{
			ret[lind].right=i;
			ret[i].parent=lind;
		}else{
			ret[rind].left=i;
			ret[i].parent=rind;
		}
	}
	return ret;
}

vector<node> ans;
//2つの木を結合する
void ketu(vector<node> a,vector<node> b,int anow,int bnow,int oya)
{
	//cerr<<a[anow].num<<" "<<b[bnow].num<<endl;
	bool f;
	//aの情報からどっち向きの子かを調べる
	if(oya!=-1)
	{
		if(anow==a[a[anow].parent].left)
			f=true;
		else
			f=false;
	}
	//aの現在地とbの現在地をマージする
	ans.push_back(node(a[anow].num+b[bnow].num,a[anow].depth));
	int now=ans.size()-1;//現在のノード番号
	if(oya!=-1)
	{
		ans[now].parent=oya;
		//左の子
		if(f)
		{
			ans[oya].left=now;
		}else{//右の子
			ans[oya].right=now;
		}
	}
	//継続判定
	if(a[anow].left!=-1 && b[bnow].left!=-1)
		ketu(a,b,a[anow].left,b[bnow].left,now);
	if(a[anow].right!=-1 && b[bnow].right!=-1)
		ketu(a,b,a[anow].right,b[bnow].right,now);
	return;
}

string encode(vector<node> a,int now)
{
	string ret;
	ret+='(';
	if(a[now].left!=-1)
		ret+=encode(a,a[now].left);//左側
	ret+=")[";
	ret+=to_string(a[now].num);//数字を文字列にして加える
	ret+="](";
	if(a[now].right!=-1)
		ret+=encode(a,a[now].right);//右側
	ret+=')';
	return ret;
}

int main()
{
	string a,b;
	cin>>a;
	cin>>b;
	vector<node> atree;
	vector<node> btree;
	atree=decode(a,0);
	btree=decode(b,1);
	//デコード結果を結合する
	ketu(atree,btree,aparentid,bparentid,-1);
	//cerr<<atree.size()<<" "<<btree.size()<<" "<<ans.size()<<endl;
	cout<<encode(ans,0)<<endl;
}


Measured memory_bytes: 3776
while(1):
    n=int(raw_input())
    if n==0:
        break
    else:
        pricelist=[]
        recipedict={}
        costdict={}
        for i in range(n):
            [ii,p]=raw_input().split()
            pricelist.append([ii,int(p)])
            costdict[ii]=1000000000000
        pricelist.sort(key=lambda x:x[1])
        m=int(raw_input())
        for i in range(m):
            rec=raw_input().split()
            o=rec[0]
            k=int(rec[1])
            recipedict[o]=rec[2:]
        query=raw_input()
        while(1):
            cheapest=pricelist.pop(0)
            #if able to make
            if cheapest[0] in recipedict:
                priceifmade=0
                for reqitem in recipedict[cheapest[0]]:
                    priceifmade=priceifmade+costdict[reqitem]
                if priceifmade<cheapest[1]:
                    costdict[cheapest[0]]=priceifmade
                else:
                    costdict[cheapest[0]]=cheapest[1]
            else:
                costdict[cheapest[0]]=cheapest[1]
            for item in recipedict:
                priceifmade=0
                for reqitem in recipedict[item]:
                    priceifmade=priceifmade+costdict[reqitem]
                if priceifmade<costdict[item]:
                    costdict[item]=priceifmade
            if cheapest[0]==query:
                print costdict[cheapest[0]]
                break

Measured memory_bytes: 4300
#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<algorithm>
#include<utility>

using namespace std;

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

constexpr long long INF = (long long)1e18;
constexpr long long MOD = 1'000'000'007; 

struct fast_io {
	fast_io(){
		std::cin.tie(nullptr);
		std::ios::sync_with_stdio(false);
	};
} fio;

signed main(){
	cout<<fixed<<setprecision(10);
	
	int X, Y, Z;
	
	cin>>X>>Y>>Z;
	
	swap(X, Y);
	swap(X, Z);
	
	cout<<X<<" "<<Y<<" "<<Z<<endl;
	
	return 0;
}

Measured memory_bytes: 256
from collections import Counter
n = int(input())
ans = Counter(input())
for _ in range(n-1):
    c = Counter(input())
    for key in ans.keys():
        ans[key] = min(ans[key], c[key])
s = []
for i in ans.keys():
    s.append(i*ans[i])
print(''.join(sorted(s)))


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

typedef long long LL;
typedef long double LD;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;
typedef pair<LD, LD> PDD;

#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x).size()
#define dbl(k, x) fixed << setprecision(k) << (x)

template <typename _T>
inline void _DBG(const char *s, _T x) {
  cerr << s << " = " << x << "\n";
}
template <typename _T, typename... args>
void _DBG(const char *s, _T x, args... a) {
  while (*s != ',') cerr << *s++;
  cerr << " = " << x << ',';
  _DBG(s + 1, a...);
}

#define _upgrade                \
  ios_base::sync_with_stdio(0); \
  cin.tie(0);                   \
  cout.tie(0);
#define DBG(...) _DBG(#__VA_ARGS__, __VA_ARGS__)

// ********************** CODE ********************** //

int main() {
  _upgrade;
  LL a;
  LD b;
  cin >> a >> b;
  cout << (LL)(a * b) << "\n";
}

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

int main(){
  int N, M, C, B[20], A[20][20];
  
  cin >> N >> M >> C;
  for(int i = 0; i < M; i++){
    cin >> B[i];
  }
  for(int i = 0; i < N; i++){
    for(int j = 0; j < M; j++){
      cin >> A[i][j];
    }
  }
  
  int k = 0; int s = C;
  
  for(int i = 0; i < N; i++){
    for(int j = 0; j < M; j++){
      s += A[i][j] * B[j];
    }
    if(s > 0){
      k++;
      s = C;
    }
    else{
      s = C;
    }
  }
  
  cout << k << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define ld long double
#define fi first
#define se second
#define pb push_back
#define all(v) v.begin(),v.end()
#define repf(i,a,b) for(ll i=a;i<b;i++)
#define repb(i,a,b) for(ll i=a;i>=b;i--)
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define mod 1000000007
#define MOD 998244353 

using namespace std;
using namespace __gnu_pbds;

typedef
tree<
	pair<int, int>,
	null_type,
	less<pair<int, int>>,
	rb_tree_tag,
	tree_order_statistics_node_update>
ordered_set;

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

ll power(ll a, ll n, ll m)
{
    ll ans=1;
    while(n)
    {
        if(n&1) ans=(ans*a)%m;
        n>>=1;
        a=(a*a)%m;
    }
    return ans;
}

ll invmod(ll a, ll m)
{
    return power(a,m-2,m);
}

struct tr{
    tr* nxt[26];
    ll c=0;
};

ll n,k;
        
void insert(tr* p, string s)
{
    tr *cur=p;
    repf(i,0,s.length())
    {
        if(!cur->nxt[s[i]-'A']) 
        {
            cur->nxt[s[i]-'A']=new tr();
        }
        cur=cur->nxt[s[i]-'A'];
        cur->c++;
    }
}

ll f(tr *p)
{
    if(!p) return 0;
    ll ans=p->c/k;
    repf(i,0,26)
    {
        if(p->nxt[i]) ans+=f(p->nxt[i]);
    }
    return ans;
}

bool ispalin(string s)
{
    repf(i,0,s.length()/2)
    {
        if(s[i]!=s[s.length()-i-1]) return false;
    }
    return true;
}

int main()
{
    IOS;
    string s;
    cin>>s;
    bool f=true;
    f&=ispalin(s);
    string s1;
    repf(i,0,s.length()/2) s1.pb(s[i]);
    f&=ispalin(s1);
    s1.clear();
    repf(i,(s.length()+3)/2-1,s.length()) s1.pb(s[i]);
    f&=ispalin(s1);
    if(f) cout<<"Yes\n";
    else cout<<"No\n";
}   

Measured memory_bytes: 256
def ABC_123_A():

    a = [0 for i in range(6)]

    count=0
   
    for i in range(6):
        a[i] = int(input())

    for i in range(5):
        for j in range(4):
            if i+j+1 <= 4:
                if abs(a[i] - a[i+j+1]) > a[5]:
                    count=1
                else:
                    count+=0
            else:
                count+=0
    if count == 1:
        print(':(')
    else:
        print('Yay!')

if __name__ == '__main__':

    ABC_123_A()

Measured memory_bytes: 3064
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>

int main()
{
    std::string w;
    std::cin >> w;

    std::vector<std::string> words;

    std::string buf;
    while(std::cin >> buf) {
        if (buf == "END_OF_TEXT") {
            break;
        }
        std::transform(buf.begin(), buf.end(), buf.begin(), ::tolower);
        words.push_back(buf);
    }

    int count = 0;
    for (const std::string& word : words) {
        if (word == w) {
            count++;
        }
    }

    std::cout << count << std::endl;

    return 0;
}


Measured memory_bytes: 3148
#include<bits/stdc++.h>
using namespace std;
int main(){
	int a,b;
	cin>>a;
	cin>>b;
	int arr[3]={0,0,0};	
	arr[a-1]=1;
	arr[b-1]=1;
	for(int i=0;i<3;i++){
		if(arr[i]==0){
			cout<<(i+1)<<endl;
			break;
		}
	}
	
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
	long long N,A,B,ans;
 	cin >> N;
   	cin >> A;
 	cin >> B;  
  if(N%(A+B)>A){
    ans=A+A*(N/(A+B));
  }else{
  	ans=N%(A+B)+A*(N/(A+B));
  }

   cout << ans << endl; 

}

Measured memory_bytes: 256
n,m=map(int,input().split())
l=[[] for _ in range(n)]
for i in range(m):
    a,b=map(int,input().split())
    l[b-1]+=[a]
for i in l[n-1]:
    if 1 in l[i-1]:
        print('POSSIBLE')
        break
else:
    print('IMPOSSIBLE')


Measured memory_bytes: 64460
#include<bits/stdc++.h>
using namespace std;
int n,x;
priority_queue<int,vector<int>,greater<int> >a;
int main(){
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>x;
        a.push(x);
    }for(int i=0;i<n;i++){
        int x=a.top();a.pop();
        if(a.empty()){
            puts("YES");
            return 0;
        }if(x==a.top()){
            puts("NO");
            return 0;
        }
    }return 0;
}

Measured memory_bytes: 1400
# Aさんは a[m] 地点、Bさんは b[m] 地点、Cさんは c [m] 地点にいます。
# 二人の人間は、距離が d [m] 以内のとき直接会話が出来ます。
# AさんとCさんが直接的、あるいは間接的に会話ができるか判定してください。
# ただしAさんとCさんが間接的に会話ができるとは、AさんとBさんが直接会話でき、かつBさんとCさんが直接会話できることを指します。

# a,b,c,d(距離） ：標準入力
a, b, c, d = map(int, input().split())


# 直接的に会話可↓
# AさんとCさんが直接会話可→ a-c(絶対値） <= d
# 間接的に可↓
# AさんとBさんが直接会話可→ a-b(絶対値） <= d
# BさんとCさんが直接会話可→ b-c(絶対値） <= d
# 距離は絶対値を取る abs()
if abs(a - c) <= d or (abs(a - b) <= d and abs(b - c) <= d):
    print('Yes')
else:
    print('No')

Measured memory_bytes: 9056
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <queue>
#include <set>

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

int main()
{
    int a, b, i;
    scanf("%d %d", &a, &b);
    if(a <= 0 && b>=0)
    {
        printf("Zero\n");

    }
    else if(a > 0)
    {
        printf("Positive\n");
    }
    else
    {
        int t;
        if(b > 0)
            t = 0 - a;
        else
            t = b - a + 1;
        if(t % 2 == 0)
            printf("Positive\n");
        else
            printf("Negative\n");
    }
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<functional>
#include<map>
#include<cmath>
#include<iomanip>
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

using namespace std;

#define INF 1e20
#define min_3(a, b, c) min(a, min(b, c));
typedef long long ll;

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

  ll n = s.size();
  for (int i = 0; i < k; i++)
  {
    if(s[i] != '1'){
      cout << s[i] << endl;
      return 0;
    }
    if(i == n - 1) break;
  }
  cout << '1' << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>

int main(){
    int n;
    double x, y, angle;

    while(scanf("%d", &n), n != -1){
        x = y = angle = 0;
        for(; n > 0; n--){
            x += cos(angle);
            y += sin(angle);
            angle = atan2(y, x) + M_PI / 2; 
        }
        printf("%.2f\n%.2f\n", x, y);
    }
    return 0;
}

Measured memory_bytes: 724
#include<bits/stdc++.h>
using namespace std;
int w,h,ans;
bool ice[95][95];
int dx[4]={1,-1,0,0};
int dy[4]={0,0,1,-1};
void dfs(int y,int x,int sum){
  ice[y][x] = 0;
  for(int i=0;i<4;i++){
    int ay = y+dy[i];
    int ax = x+dx[i];
    if(ice[ay][ax] == 1) dfs(ay,ax,sum+1);
  }
  ice[y][x] = 1;
  if(ice[y-1][x]==0&&ice[y+1][x]==0&&ice[y][x-1]==0&&ice[y][x+1]==0){
    ans = max(ans,sum+1);
  }
}
int main(){
  while(scanf("%d %d",&w,&h),w!=0&&h!=0){
    fill_n(*ice,95*95,0);
    for(int i=1;i<=h;i++){
      for(int j=1;j<=w;j++)
	scanf("%d",&ice[i][j]);
    }
    ans = 0;
    for(int i=1;i<=h;i++){
      for(int j=1;j<=w;j++){
	if(ice[i][j] == 1) dfs(i,j,0);
      }
    }
    printf("%d\n",ans);
  }
  return (0);
}

Measured memory_bytes: 3096