akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0,i##_max=(N);i<i##_max;++i)
#define repp(i,l,r) for(int i=(l),i##_max=(r);i<i##_max;++i)
#define per(i,N) for(int i=(N)-1;i>=0;--i)
#define perr(i,l,r) for(int i=r-1,i##_min(l);i>=i##_min;--i)
#define all(arr) (arr).begin(), (arr).end()
#define SP << " " <<
#define SPF << " "
#define SPEEDUP cin.tie(0);ios::sync_with_stdio(false);
#define MAX_I INT_MAX //1e9
#define MIN_I INT_MIN //-1e9
#define MAX_UI UINT_MAX //1e9
#define MAX_LL LLONG_MAX //1e18
#define MIN_LL LLONG_MIN //-1e18
#define MAX_ULL ULLONG_MAX //1e19
  typedef long long ll;
  typedef pair<int,int> PII;
  typedef pair<char,char> PCC;
  typedef pair<ll,ll> PLL;
  typedef pair<char,int> PCI;
  typedef pair<int,char> PIC;
  typedef pair<ll,int> PLI;
  typedef pair<int,ll> PIL; 
  typedef pair<ll,char> PLC; 
  typedef pair<char,ll> PCL; 

inline void YesNo(bool b){ cout << (b?"Yes" : "No") << endl;}
inline void YESNO(bool b){ cout << (b?"YES" : "NO") << endl;}
inline void Yay(bool b){ cout << (b?"Yay!" : ":(") << endl;}

int main(void){
  SPEEDUP
  cout << setprecision(15);
  int N;cin >> N;
  vector<PIL> v(N);
  rep(i,N) cin >> v[i].first >> v[i].second;
  int now = 0;
  ll ans = 0;
  map<int,PLL> mp;
  mp[1] = PII(10,1);
  mp[2] = PII(5,1);
  mp[3] = PII(4,3);
  mp[4] = PII(3,3);
  mp[5] = PII(2,1);
  mp[6] = PII(2,3);
  mp[7] = PII(2,5);
  mp[8] = PII(2,7);
  mp[9] = PII(2,9);

  rep(i,N){
    if(v[i].first == 0){
      ans += v[i].second;
      continue;
    }
    int x = v[i].first;
    ll y = v[i].second;
    while(y>0){
      ll y_ = y/mp[x].first;
      int x_ = mp[x].second;
      ans += y%mp[x].first;
      now += (y%mp[x].first) * x;
      if(now/10!=0){
        now = now%10 + now/10;
        ++ans;
      }
      ans += y_*mp[x].first;
      x = x_;
      y = y_;
    }
  }
  cout << ans -1 << endl;
  return 0;
}


Measured memory_bytes: 3328
import sys

input_methods=['clipboard','file','key']
using_method=0
input_method=input_methods[using_method]

IN=lambda : map(int, input().split())
mod=1000000007

#+++++

def main():
	#a = int(input())
	n, k = IN()
	#s = input()
	kk=0
	for i in range(k-1):
		kk += i
		kk %= mod
		
	bb=0
	for i in range(k-1):
		bb += (n )- i
		bb %= mod
	cc=0
	#cc += (bb - kk)%mod
	#pa((bb,kk,cc))
	for i in range(k, n+2):
		bb += (n + 1) - i
		bb %= mod
		kk += i-1
		kk %= mod
		cc += (bb - kk + 1)
		cc%= mod 
		#pa((bb,kk,cc))
	print(cc)
	
	
	
#+++++
isTest=False

def pa(v):
	if isTest:
		print(v)
		
def input_clipboard():
	import clipboard
	input_text=clipboard.get()
	input_l=input_text.splitlines()
	for l in input_l:
		yield l

if __name__ == "__main__":
	if sys.platform =='ios':
		if input_method==input_methods[0]:
			ic=input_clipboard()
			input = lambda : ic.__next__()
		elif input_method==input_methods[1]:
			sys.stdin=open('inputFile.txt')
		else:
			pass
		isTest=True
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)

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

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repc(i, a, b) for(int i = a; i <= (int)(b); i++)
#define ll long long
#define vec vector
#define ft first
#define sd second
#define all(vec) vec.begin(), vec.end()
typedef pair<int, int> P;
const int MOD = 1e9 + 7;
const int INF = 1001001001;


int main() {
  ll x;
  cin >> x;
  for(ll a = -200; a<=200; a++) for(ll b = -200; b<=200; b++) {
    if((a - b) != 0 && x % (a - b) == 0) {
      if(a*a*a*a*a - b*b*b*b*b == x) {
        cout << a << " " << b << endl;
        return 0;
      }
    }
  }
  return 0;
}

Measured memory_bytes: 3584
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>
#include <complex>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <cstring>

#define REP(i,x) for(int i=0 ; i<(int)(x) ; i++)
#define ALL(x) (x).begin(),(x).end()
#define LL long long

using namespace std;

int N, K;
vector<int> A;

bool is_need(int idx){
    if(idx<0)return false;
    if(idx>=N)return true;
    vector<int> dp(K);
    dp[0] = 1;
    REP(i, N){
        if(i==idx)continue;
        int a = A[i];
        for(int k=K-1; k>=a; k--){
            dp[k] |= dp[k-a];
        }
    }
    //cerr << idx << endl;
    //REP(k, K)cerr << dp[k];
    //cerr << endl;
    REP(k, K){
        if(dp[k] && k+A[idx]>=K)return true;
    }
    return false;
}

int solve(){
    cin >> N >> K;
    A.resize(N);
    REP(i, N)cin >> A[i];
    sort(ALL(A));

    int lb=-1;
    int ub=N;
    while(ub-lb>1){
        int mid = (lb+ub)>>1;
        if(is_need(mid)){
            ub = mid;
        }else{
            lb = mid;
        }
    }
    return lb+1;
}

int main(){
    int res = solve();
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <string>    
#include <set>
#include <queue>
#include <map>
#include <algorithm>
#include <cmath>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
ll n, a;
string str;

int main(){
	cin >> n;
	
	queue<ll> q[1008];
	for(ll i = 1; i <= n; i++){
		for(ll j = 1; j <= n-1; j++){
			cin >> a;
			q[i].push(a);
		}
	}
	
	ll ans = 0;
	ll use[1008];
	set<ll> s;
	for(ll i = 1; i <= n; i++){s.insert(i);}
	
	
	while(true){
		bool never = true;
		memset(use, 0, sizeof(use));
		ans++;
		set<ll> t;
		t.clear();
		
		for(auto itr = s.begin(); itr != s.end(); itr++){
			ll i = *itr;
			ll j = q[i].front();
			if(use[i] == 0 && use[j] == 0 && i == q[j].front()){
				use[j] = 1;
				use[i] = 1;
				q[j].pop();
				q[i].pop();
				never = false;
				t.insert(j);
				t.insert(i);
			}
		}
		
		if(never){ans = -1; break;}
		
		bool flag = true;
		for(ll i = 1; i <= n; i++){
			if(!q[i].empty()){flag = false;}
		}
		if(flag){break;}
		
		s.swap(t);
	}
	
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 8960
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		double get = 0;
		int num = sc.nextInt();
		for(int i = 0; i < num; i ++) {
			get += sc.nextDouble() * (sc.next().equals("JPY") ? 1 : 380000.0);
		}
		System.out.println(get);
	}
}

Measured memory_bytes: 22996
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define int long long
#define debug(x) cerr << "\n" \
                      << #x << ": " << x << "\n"
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define all(x) (x).begin(), (x).end()
#define INF 1e9
#define pii pair<int, int>
#define pt(xx) cout << "\n" \
                    << xx << "\n"
#define debugv(x, n)               \
    cout << "\n"                   \
         << #x << ": ";            \
    rep(i, n) cout << x[i] << " "; \
    cout << endl
#define debug2d(x, m, n)            \
    cout << "\n"                    \
         << #x << " is: \n";        \
    for (int i = 0; i < m; ++i)     \
    {                               \
        for (int j = 0; j < n; ++j) \
        {                           \
            cout << x[i][j] << " "; \
        }                           \
        cout << endl;               \
    }
#define nl cout << endl

#define MOD 1000000007
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }

int N, K;
int ans;

int A[100003];
// 10^12 < (2^10)^4
//vector<vector<int>> dp(45, vector<int>(2, -1)); // dp[上からi桁][smaller(flag)];
int dp[46][2];
const int MAXDIGIT = 43;

signed main()
{
    //cin.tie(0);
    //ios::sync_with_stdio(false);
    //==============================================
    cin >> N>> K;
    rep(i, N) cin >> A[i];

    rep(i,46){rep(j,2)dp[i][j]=-1;}

    dp[MAXDIGIT][0] = 0;


    int mask;
    int cnt;
    for (int i = MAXDIGIT-1; i >= 0; --i)
    {
        mask = 1LL << i;

        cnt = 0;
        rep(j,N)
        if (A[j] & mask)
        {
            cnt++;
        }

        if (dp[i+1][1] >= 0)  /*dp[i][1] = */ chmax(dp[i][1], dp[i+1][1] + mask*max(cnt,N-cnt));

       // printf("i:%2lld, cnt:%4lld \n",i,cnt);

        //if ((K&mask) == mask) pt("uwa");
        //pt (mask);

        if (dp[i+1][0] >= 0) {
            if ((K & mask)) {
         //       pt("ya");
                /* dp[i][1] =*/ chmax(dp[i][1], dp[i+1][0] + mask*cnt);
                /*dp[i][0] = */chmax(dp[i][0], dp[i+1][0] + mask*(N-cnt));
            }
            else {
          //      pt ("non");
                /*dp[i][0] = */chmax(dp[i][0], dp[i+1][0] + mask*cnt);
            }
        }

    }

  //  cout<<"K:"<<K<<endl;

   // debug2d(dp,MAXDIGIT,2);

    ans = max(dp[0][0],dp[0][1]);
    cout<<ans<<endl;

    return 0;
}

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

int main()
{
	int n;
	cin >> n;
	string s;
	cin >> s;
	vector<vector<int>> dp(n, vector<int>(n,0));
	for (int i = 0; i < n; ++i) {
		if (s[i] == s[n - 1]) {
			dp[n - 1][i] = 1;
		}
	}

	for (int i = n - 2; 0 <= i; --i) {
		for (int j = 0; j < n - 1; ++j) {
			if (s[i] == s[j]) {
				dp[i][j] = dp[i + 1][j + 1] + 1;
			}
		}
		if (s[i] == s[n - 1]) {
			dp[i][n - 1] = 1;
		}
	}

	int ret = 0;
	for (int i = 0; i < n; ++i) {
		for (int j = 0; j < n; ++j) {
			dp[i][j] = min(abs(i - j), dp[i][j]);
			ret = max(ret, dp[i][j]);
		}
	}
	cout << ret << endl;

	return 0;
}

Measured memory_bytes: 98560
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
#define int long long
int dp[100010];
int cnt[100010];
signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, M; cin >> N >> M;
    int A[100010];
    rep(i, M) {
        cin >> A[i]; 
        cnt[A[i]] = -1;
    }

    dp[0] = 1;
    if (cnt[1] != -1) dp[1] = 1;
    rep(i, N) {
        if (cnt[i + 2] == -1) cnt[i + 2] = 0;
        else dp[i + 2] = (dp[i + 1] + dp[i]) % mod;
    }
    cout<< dp[N] << endl;

    return 0;
}


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

string s;
int cnt [3];

int main()
{
    cin >> s;
    for(int i = 0; i < s.size(); i++)
        cnt[s[i] - 'a'] ++;

    if(abs(cnt[0] - cnt[1]) > 1 || abs(cnt[0] - cnt[2]) > 1 || abs(cnt[2] - cnt[1]) > 1)
        printf("NO");
    else
        printf("YES");
    return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
#define rep(i,a) for(int (i)=0; (i)<(a); (i)++)
#define rrep(i,a) for(int (i)=a-1; (i)>=(0); (i)--)
#define rep2(i,a,b) for(int (i)=(a); (i)<(b); (i)++)
#define MOD 1000000007
#define all(v) v.begin(), v.end()
#define m0(x) memset(x,0,sizeof(x))
typedef long long ll;
using namespace std;

char s[15][1050];

int main(){
    int h,w,k; cin >> h >> w >> k;

    rep(i,h)rep(j,w) cin >> s[i][j];
  
    int h1 = 0, h2; vector<int> a;
    int ans = h * w, white;
    for(int bit = 0; bit < (1 << h-1); bit++){
        a.resize(0); a.emplace_back(-1);
        rep(i,h-1) if(bit & (1<<i)) a.emplace_back(i);
        a.emplace_back(h-1);
        int dp[a.size()-1] = {};
        int w1 = 0, w2 = 0, tmp = __builtin_popcount(bit);
        bool can = true;
        while(1){
            bool ok = true;
            rep(i, a.size()-1){
                int h1 = a[i]+1, h2 = a[i+1];
                rep2(j,h1,h2+1) dp[i] += s[j][w2] - '0';
                if(dp[i] > k) ok = false;
            }
            if(!ok && w2 == w1){ can = false; break; }
            if(ok){
                if(w2+1 < w) w2++;
                else break;
            }
            if(!ok){
                w1 = w2;
                tmp++;
                m0(dp);
            }
        }
        if(can) ans = min(ans,tmp);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
/**
 *      purpose : 
 *      author  : kyomukyomupurin
 *      created : 
**/

// input/output
#include <iostream>
#include <fstream>
#include <sstream>
// container class
#include <array>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
// math, algorithm
#include <algorithm>
#include <cmath>
#include <complex>
#include <numeric>
// etc
#include <bitset>
#include <cassert>
#include <cctype>
#include <cstring>
#include <chrono>
#include <iomanip>
#include <random>
#include <utility>
// using-directive
using namespace std;
// alias template
using int64 = long long;
using vi = vector<int>;
using vl = vector<int64>;
using pii = pair<int, int>;
using pll = pair<int64, int64>;
// text macro replacement
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define print(x) cout << (x) << '\n'
#define debug(x) cerr << #x << ": " << (x) << '\n'
#define dbg(v) for (size_t _ = 0; _ < v.size(); ++_){cerr << #v << "[" << _ << "] : " << v[_] << '\n';}
// variadic template
template<typename T> inline void chmin(T &a, T b) {if (a > b) a = b; return;}
template<typename T> inline void chmax(T &a, T b) {if (a < b) a = b; return;}
// constant
const int INF = (1<<30) - 1;
const int64 INF64 = (1LL<<62) - 1;
const int MOD = 1000000007;

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

  string s; cin >> s;
  int n = s.size();
  int ans = INF;

  if (all_of(s.begin(), s.end(), [](char c){return c == '0';})) {
    cout << n << '\n'; return 0;
  }

  if (all_of(s.begin(), s.end(), [](char c){return c == '1';})) {
    cout << n << '\n'; return 0;
  }

  for (int i = 0; i < n - 1; ++i) {
    if (s[i] == s[i + 1]) continue;
    int left = i + 1, right = n - left;
    int mx = max(left, right);
    chmin(ans, mx);
  }


  print(ans);

  return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#include <chrono>
#define watch(x) cout << (#x) << " is " << (x) << endl
#define eps 1e-9
#define f first
#define s second

typedef long long ll;

using namespace std;

const int N = 1e5;

int a[N+5];

int main()

{
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

    int n, x, m = -1;

    cin >> n;

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

        cin >> x;

        a[x]++, a[x-1]++, a[x+1]++;

        m = max(m, x);
    }

    sort(a, a+m+1);

    cout << a[m];

    return 0;
}



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

int main() {
    string s;
    int count = 0;

    cin >> s;

    for(int i = 0; i < (int)s.size(); ++i) {
        if (s[i] == '1') {
            count++;
        }
    }

    cout << count << endl;
}

Measured memory_bytes: 3600
#include <iostream>
using namespace std;
static const int MAX = 100;
static const int INFTY = (1 << 21);
static const int WHITE = 0;
static const int GRAY = 1;
static const int BLACK = 2;

int n, M[MAX][MAX];

void dijkstra()
{
  int mincost;
  int d[MAX], color[MAX];

  for (int i = 0; i < n; i++)
  {
    d[i] = INFTY;
    color[i] = WHITE;
  }

  d[0] = 0;
  color[0] = GRAY;
  while (true)
  {
    mincost = INFTY;
    int u = -1;
    for (int i = 0; i < n; i++)
    {
      if (color[i] != BLACK && d[i] < mincost)
      {
        mincost = d[i];
        u = i;
      }
    }

    if (u == -1)
    {
      break;
    }

    color[u] = BLACK;
    for (int v = 0; v < n; v++)
    {
      if (color[v] != BLACK && M[u][v] != INFTY)
      {
        if (d[u] + M[u][v] < d[v])
        {
          d[v] = d[u] + M[u][v];
          color[v] = GRAY;
        }
      }
    }
  }

  for (int i = 0; i < n; i++)
  {
    cout << i << " " << d[i] << endl;
  }
}

int main()
{
  cin >> n;
  for (int i = 0; i < n; i++)
  {
    for (int j = 0; j < n; j++)
    {
      M[i][j] = INFTY;
    }
  }

  int k, c, u, v;
  for (int i = 0; i < n; i++)
  {
    cin >> u >> k;
    for (int j = 0; j < k; j++)
    {
      cin >> v >> c;
      M[u][v] = c;
    }
  }

  dijkstra();

  return 0;
}


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

#define MOD (1000000000+7)

long long power( long long x, long long n )
{
	long long res = 1;
	while( n > 0 ) {
		if( n % 2 ) res = res * x % MOD;
		x = x * x % MOD;
		n /= 2;
	}
	return res;
}

long long fac( long long n, long long m )
{
	long long res = 1;
	long long nn = n;
	for( long long i = 0; i < m; i++ ) {
		res *= nn;
		res %= MOD;
		nn--;
	}
	return res;
}
long long ifac( long long n )
{
	long long res = 1;
	for( long long i = 1; i <= n; i++ ) {
		res *= power( i, MOD - 2 );
		res %= MOD;
	}
	return res;
}

int main()
{
	long long n, a, b;
	cin >> n >> a >> b;

	long long ca = ( fac( n, a ) % MOD * ifac( a ) ) % MOD;
	long long cb = ( fac( n, b ) % MOD * ifac( b ) ) % MOD;
	long long ans = (power( 2, n ) - 1 + MOD) % MOD;
	ans = (ans - ca + MOD) % MOD;
	ans = (ans - cb + MOD) % MOD;

	cout << ans << endl;
}


Measured memory_bytes: 384
#include<stdio.h>

int main()
{
    int N,M,Ai,sum;
    scanf("%d%d",&N,&M);
    sum = 0;
    for(int i=0; i<M; i++)
    {
        scanf("%d",&Ai);
        sum = sum + Ai;
    }
    if(N<sum)
        printf("-1\n");
    else
        printf("%d\n",N - sum);


}


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

int main() 
{
    ll n, Y;
    cin >> n >> Y;
    bool a = false;
    for (int i=0; i<=n; i++)
        for (int j=i; j<=n; j++)
        {
            int x = i;
            int y = j-i;
            int z = n-j;
            if (x*10000+y*5000+z*1000==Y)
            {
                cout << x << " " << y << " " << z;
                a = true;
                return 0;
            }
        }
    if (a == false)
        cout << "-1 -1 -1";
    return 0;
}

Measured memory_bytes: 384
import sys, bisect

def solve():
    A = list(map(int, sys.stdin.readlines()))
    n = A[0]
    A = A[1:]
    L = A[:1]
    for a_i in A[1:]:
        if a_i > L[-1]:
            L.append(a_i)
        else:
            j = bisect.bisect_left(L, a_i)
            L[j] = a_i
    print(len(L))

solve()

Measured memory_bytes: 18724
// C - Bugged
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
#define all(x) (x).begin(),(x).end()

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

	int MAX = 0;
	vi S(N+1);
	for(int i=1; i<=N; ++i){
		cin>>S[i];
		MAX += S[i];
	}

	int maxi = 0;
	vi dp(MAX+1);
	for(int i=1; i<=N; ++i){
		int s = S[i];
		for(int j=MAX; j>=s; --j){
			dp[j] = max(dp[j], dp[j-s] + s);
			int c = dp[j];
			if(c%10 == 0) c = 0;
			maxi = max(maxi, c);
		}
	}
	cout<< maxi <<endl;
}

Measured memory_bytes: 256
def odd_solve(x)
    (x + 1) / 2 % 2
end

def solve(x)
    if x & 1 == 1
        odd_solve(x)
    else
        odd_solve(x) ^ x
    end
end

a, b = gets.chomp.split(" ").map(&:to_i)
puts solve(b) ^ solve(a-1)

Measured memory_bytes: 1788
#include <stdio.h>
#include<string.h>
int main () {
    char deck[205], temp;
    int m, h, l, i;
    while(1){
        scanf("%s", &deck);
        l = strlen(deck);
        if(l == 1 && deck[0] == '-')break;
        scanf("%d", &m);
        while(m--){
            scanf("%d", &h);
            while(h--){
                temp = deck[0];
                for(i=0;i<l-1;i++)deck[i] = deck[i+1];
                deck[i] = temp;
            }
        }
        printf("%s\n", deck);
    }
    return 0;
}



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

int n;

int f(int x){
	int ret=0;
	while (x){
		ret+=x%10;
		x/=10;
	}
	return ret;
}

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin >> n;
	int ans=INT_MAX;
	for (int i=1;i<n;i++){
		ans=min(ans,f(i)+f(n-i));
	}
	cout << ans << "\n";
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a[10],b[10],c[10];
	int n,x,y,z,fx=0,fy=0,ansx,ansy,cnt=0;
	cin >> n;
	for(int i=0;i<n;i++)
		cin >> a[i];
	for(int i=0;i<n;i++)
		cin >> b[i];
	for(int i=0;i<n;i++)
		c[i]=a[i];
	sort(c,c+n);
	do{
		cnt++;
		fx=0;fy=0;
		for(int i=0;i<n;i++){
			if(c[i]!=a[i])
				fx=1;
		}
		if(fx==0) ansx=cnt;
		for(int i=0;i<n;i++){
			if(c[i]!=b[i])
				fy=1;
		}
		if(fy==0) ansy=cnt;
	}while(next_permutation(c,c+n));
	/*for(int i=0;i<n;i++)
		cout << c[i] << endl;*/
	cout << abs(ansx-ansy) << endl;
	return 0;
 } 

Measured memory_bytes: 256
#include <stdio.h>

int main(){
  int i, j, k, l;
  char str1[100001], str2[100001];
  k=0;
  l=1;
  scanf("%s", str1);
  for(i=0;str1[i]!='\0';i++){
    str2[i]=str1[i];
    
  }
  str2[i]='\0';
  for(i=0;str2[i]!='\0';i++){
    if(str2[i]=='b'){
      str2[i]='d';
    }else if(str2[i]=='d'){
      str2[i]='b';
    }else if(str2[i]=='p'){
      str2[i]='q';
    }else if(str2[i]=='q'){
      str2[i]='p';
    }
     
  }
  for(j=i-1;j>=0;j--){
    if (str2[k]!=str1[j]){
      l =0;
    }
    k++;
  }
  if (l==1){
    printf("Yes\n");
  }else{
    printf("No\n");
  }
  
 
}


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

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int h,w;
    cin>>h>>w;
    int sum = 0;
    for(int i=0;i<h;i++){
        string s;
        cin>>s;
        for(int j=0;j<w;j++){
            if(s[j] == '#') ++sum;
        }
    }
    if(sum == h+w-1){
        cout<<"Possible\n";
    }else{
        cout<<"Impossible\n";
    }
    return 0;
}




Measured memory_bytes: 256
import fractions

a , b , c , d = map(int,input().split())

f=fractions.gcd(c,d)
f2=c*d//f

p = b//c - (a-1)//c
q = b//d - (a-1)//d
r = b//(f2) - (a-1)//(f2)

print((b-a+1) - (p+q-r))

Measured memory_bytes: 5048
struct DSU {
    n: usize,
    parent_or_size: Vec<usize>,
}

impl DSU {
    fn new(n: usize) -> DSU {
        DSU { n, parent_or_size: vec![!1; n] }
    }

    fn merge(&mut self, a: usize, b: usize) -> usize {
        let (mut x, mut y) = (self.leader(a), self.leader(b));
        if x == y { return x; }
        if !self.parent_or_size[x] < !self.parent_or_size[y] {
            std::mem::swap(&mut x, &mut y);
        }
        self.parent_or_size[x] -= !self.parent_or_size[y];
        self.parent_or_size[y] = x;
        x
    }

    fn same(&mut self, a: usize, b: usize) -> bool {
        self.leader(a) == self.leader(b)
    }

    fn leader(&mut self, a: usize) -> usize {
        if self.parent_or_size[a] >= self.n { return a; }
        self.parent_or_size[a] = self.leader(self.parent_or_size[a]);
        self.parent_or_size[a]
    }

    fn size(&mut self, a: usize) -> usize {
        let x = self.leader(a);
        !self.parent_or_size[x]
    }
}

fn main() {
    let (n, q): (usize, usize) = {
        let mut buf = String::new();
        std::io::stdin().read_line(&mut buf).unwrap();
        let mut iter = buf.split_whitespace();
        (
            iter.next().unwrap().parse().unwrap(),
            iter.next().unwrap().parse().unwrap(),
        )
    };

    let mut dsu = DSU::new(n);

    for _ in 0..q {
        let (t, u, v): (usize, usize, usize) = {
            let mut buf = String::new();
            std::io::stdin().read_line(&mut buf).unwrap();
            let mut iter = buf.split_whitespace();
            (
                iter.next().unwrap().parse().unwrap(),
                iter.next().unwrap().parse().unwrap(),
                iter.next().unwrap().parse().unwrap(),
            )
        };

        if t == 0 {
            dsu.merge(u, v);
        } else {
            println!("{}", if dsu.same(u, v) { "1" } else { "0" });
        }
    }
}

Measured memory_bytes: 3524
from sys import stdin
N = int(stdin.readline().rstrip())
a = [int(x) for x in stdin.readline().rstrip().split()]
hai = 0
cha = 0
mdr = 0
miz = 0
aao = 0
kii = 0
dai = 0
aka = 0
kan = 0

for i in a:
    if i <= 399:
        hai = 1
    elif i <= 799:
        cha = 1
    elif i <= 1199:
        mdr = 1
    elif i <= 1599:
        miz = 1
    elif i <= 1999:
        aao = 1
    elif i <= 2399:
        kii = 1
    elif i <= 2799:
        dai = 1
    elif i <= 3199:
        aka = 1
    else:
        kan += 1

ans1 = kan+aka+dai+kii+aao+miz+mdr+cha+hai
ans2 = max(aka+dai+kii+aao+miz+mdr+cha+hai,1)
print(ans2,ans1)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define all(v) v.begin(), v.end()
using in = int64_t;
#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 Yes cout<<"Yes"<<endl 
#define No cout<<"No"<<endl
#define yes cout<<"yes"<<endl 
#define no cout<<"no"<<endl
#define vec(a,y,x)  vector<vector<char>> a (y,vector<char>(x))
const double PI=3.14159265358979323846;
const in MOD = 1000000007;
const in INF=1e18+7;
const int inf=1e9+7;
const vector<int> dx={1,0,-1,0};
const vector<int> dy={0,1,0,-1};
 
int main(){
  int n;
  cin>>n;
  printf("%.4f",n*PI*2);
}

Measured memory_bytes: 3784
#include <iostream>
#include <vector>
#include <cmath>

using namespace std;

int main(void){
  vector<int> data;
  vector< vector< int > > ans;
  int i = 0;
  int j = 0;
  int k;
  while(1){
    cin >> k;
    data.push_back(k);
    vector<int> t;
    ans.push_back(t);
    if (k == 1) break;
    i++;
  }

  int n = data.size() - 1; //number of data

  //calculate
  for(i=0;i<n;i++){
    int tmp = data[i];
    int zo = 0;
    int flag;
    j = 6;
    while(j<=tmp){
      if(tmp%j == 0){
        flag=1;
        for(k=0;k<ans[i].size();k++){
          if (j % ans[i][k] == 0) flag=0;
        }
        if (flag==1)ans[i].push_back(j);
      }
      switch (zo){
        case 0:
          zo = 1;
          j += 2;
          break;
        case 1:
          zo = 0;
          j += 5;
          break;
      }
    }
  }

  // print answer
  for(i=0;i<n;i++){
    cout << data[i] << ":";
    for(j=0;j<ans[i].size();j++){
      cout << " " << ans[i][j];
    }
    cout << endl;
  }

  return 0;
}

Measured memory_bytes: 3088
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

ll gcd (ll x, ll y){
    if (y==0) return x;
    else return gcd(y,x%y);
}


int main() {
    int N;
    cin >> N;
    vector<ll>As(N);
    for(int i=0; i<N; i++)cin >> As[i];

    ll g = 0;
    for (int i=0; i<N; i++){
        g = gcd(As[i], g);
    }

    cout << g << endl;

}

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

//関数


    
    
    
//main関数
int main() {
    
    
    //入力
    string S;
    cin >>S;
    
    
    
    
    
    
    //計算
    bool n=false,w=false,s=false,e=false;
    //cout <<n<<w<<s<<e<<endl;
    for(int i=0;i<S.size();i++){
        if(S.at(i)=='N') n=true;
        if(S.at(i)=='W') w=true;
        if(S.at(i)=='S') s=true;
        if(S.at(i)=='E') e=true;
    }
    //cout <<n<<w<<s<<e<<endl;
    
    //出力
    if(((n&&s)||((!n)&&(!s))) && ((e&&w)||((!e)&&(!w)))){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
// Macros for easier access
#define ll long long
#define endl '\n'
#define F first
#define S second
#define umap unordered_map
#define uset unordered_set
#define test ll cases; cin>>cases; for(ll testCase = 1; testCase <= cases; testCase++)   //test cases
#define fill(name, val) memset(name, val, sizeof(name));
#define mop(a, op, b)    (a%mod op b%mod)%mod
#define error(x) fixed<<setprecision(x) //cout<<error(5)<<someDouble    -> example - 3.14159
#define vll vector<ll>
#define vvll vector<vll>
#define pll pair<ll, ll>
#define get(a, n)    for(ll i = 0; i < n; i++)    cin>>a[i];
#define boost ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define debug(x) cerr << #x << " : " << (x) << endl
// Constants
#define MX 100001
#define mod 1000000007LL
#define inf 1000000000000000000LL
void init(){
	boost;
	#ifndef ONLINE_JUDGE
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif
}

/*	Author: 🆉🅴🅽🅾🅻🆄🆂	*/

ll n, m, q, a[50][4], A[10];
ll calc(ll i, ll cm){
	if(i == n){
		ll score = 0;
		for(ll j = 0; j < q; j++)
			if(A[a[j][1]-1] - A[a[j][0]-1] == a[j][2])	score += a[j][3];
		return score;
	}
	ll ans = 0;
	for(ll j = cm; j <= m; j++){
		A[i] = j;
		ans = max(ans, calc(i+1, j));
	}
	return ans;
}
int main(){
	init();
	cin>>n>>m>>q;
	for(ll i = 0; i < q; i++)	cin>>a[i][0]>>a[i][1]>>a[i][2]>>a[i][3];
	cout<<calc(0, 1);
}

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

int main() {
  ll n, m;
  cin >> n >> m;
  using P = pair<ll, ll>;
  vector<P> vp;
  for (ll i = 0; i < n; i++) {
    ll a, b;
    cin >> a >> b;
    vp.emplace_back(a, b);
  }
  sort(vp.begin(), vp.end());
  ll ans = 0;
  for (auto p : vp) {
    ll cnt = min(m, p.second);
    ans += p.first * cnt;
    m -= cnt;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 2420
#include<iostream>
#include<algorithm>

using namespace std;

int main()
{
    int H, W;
    int num=0,ans=0;

    cin>>H>>W;
    char A[H+1][W+1];
    for(int i=0;i<H;i++)
    {
        for(int j=0;j<W;j++)
            cin>>A[i][j];
    }
    int h[H+1][W+1];
    int v[H+1][W+1];
    for(int i=0;i<H;i++)
    {
        for(int j=0;j<W;j++)
        {
            h[i][j] = 0;
            v[i][j] = 0;
        }
    }
    for(int i=0;i<H;i++)
    {
        int bi=-1;
        for(int j=0;j<W;j++)
        {
            if(A[i][j] == '#')
            {
                
                for(int k = bi+1;k<j;k++)
                {
                    h[i][k] = j - bi - 1;
                }
                bi = j;
            }
            if(j+1 == W)
            {
                for(int k = bi+1;k<W;k++)
                    h[i][k] = W - bi - 1;
            }
        }
    }
    for(int j=0;j<W;j++)
    {
        int bi=-1;
        for(int i=0;i<H;i++)
        {
            if(A[i][j] == '#')
            {
                for(int k = bi+1;k<i;k++)
                {
                    v[k][j] = i - bi - 1;
                }
                bi = i;
            }
            if(i+1 == H)
            {
                for(int k = bi+1;k<H;k++)
                    v[k][j] = H - bi - 1;
            }
        }
    }
    for(int i=0;i<H;i++)
    {
        for(int j=0;j<W;j++)
        {
            num = h[i][j] + v[i][j] -1;
            ans = max(ans,num);
        }
    }
    cout<<ans;
    return 0;
}

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

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

    vector<int> c(26);
    vector<vector<int>> s(D, vector<int>(26));

    for (int i = 0; i < 26; i++)
    {
        cin >> c.at(i);
    }

    for (int i = 0; i < D; i++)
    {
        for (int j = 0; j < 26; j++)
        {
            cin >> s.at(i).at(j);
        }
    }

    vector<int> T(D);
    for (int i = 0; i < D; i++)
    {
        T.at(i) = rand() % 26 + 1;
    }

    for (int i = 0; i < D; i++)
    {
        cout << T.at(i) << endl;
    }

    return 0;
}

Measured memory_bytes: 3676
#include <bits/stdc++.h>
using i64 = long long;

constexpr i64 inf = 1000000000000000;

struct Edge {
    int to;
    i64 cap;
    int rev;
    Edge(int t, i64 c, int r) : to(t), cap(c), rev(r) {}
};

std::vector<std::deque<Edge>> g;
std::vector<int> level, iter;

void add_edge(int from, int to, i64 cap) {
    g[from].emplace_back(to, cap, g[to].size());
    g[to].emplace_back(from, 0, g[from].size() - 1);
}

void bfs(int s) {
    for (auto &el : level) el = -1;
    level[s] = 0;

    std::deque<int> q { s };

    while (!q.empty()) {
        auto curr = q.front();
        q.pop_front();
        for (auto &e : g[curr]) {
            if (e.cap > 0 && level[e.to] < 0) {
                level[e.to] = level[curr] + 1;
                q.push_back(e.to);
            }
        }
    }
}

i64 dfs(int v, int t, i64 f) {
    if (v == t) return f;

    for (int i = iter[v]; i < (int)g[v].size(); i++) {
        iter[v] = i;
        auto &e = g[v][i];

        if (e.cap > 0 && level[v] < level[e.to]) {
            i64 d = dfs(e.to, t, std::min(f, e.cap));
            if (d > 0) {
                e.cap -= d;
                g[e.to][e.rev].cap += d;
                return d;
            }
        }
    }

    return 0;
}

i64 max_flow(int s, int t) {
    i64 flow = 0;
    while (true) {
        bfs(s);
        if (level[t] < 0) return flow;

        for (auto &el : iter) el = 0;

        i64 f = dfs(s, t, inf);
        while (f > 0) {
            flow += f;
            f = dfs(s, t, inf);
        }
    }
}

int main() {
    int h, w;
    std::cin >> h >> w;
    std::string in;
    g.resize(h + w + 2);
    level.resize(h + w + 2);
    iter.resize(h + w + 2);

    for (int i = 0; i < h; i++) {
        std::cin >> in;
        for (int j = 0; j < w; j++) {
            char c = in[j];
            if (c == 'o') {
                add_edge(i, h + j, 1);
                add_edge(h + j, i, 1);
            } else if (c == 'S') {
                add_edge(h + w, i, inf);
                add_edge(h + w, h + j, inf);
            } else if (c == 'T') {
                add_edge(i, h + w + 1, inf);
                add_edge(h + j, h + w + 1, inf);
            }
        }
    }

    auto ret = max_flow(h + w, h + w + 1);
    if (ret >= inf) ret = -1;
    std::cout << ret << std::endl;

    return 0;
}

Measured memory_bytes: 1280
#include <cstdio>

int n, a[200010], p[200010];

int main(){
	scanf("%d", &n);
	for(int i=1; i<=n; i++){
		scanf("%d", &a[i]);
		p[a[i]] = i;
	}
	int maxcnt = 1;
	for(int i=2, cnt=1; i<=n; i++){
		if(p[i-1] < p[i]) cnt++;
		else cnt=1;
		if(maxcnt < cnt) maxcnt = cnt;
	}
	printf("%d\n", n-maxcnt);
	return 0;
}


Measured memory_bytes: 1664
n = int(input())
X = list(map(int,input().split()))
Y = list(map(int,input().split()))
# p=1,2,3
for p in range(1,4):
    print("{0:.6f}".format(sum([abs(a-b)**p for a,b in zip(X,Y)])**(1/p)))
# p=infinity
print("{0:.6f}".format(max([abs(a-b) for a,b in zip(X,Y)])))

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

using namespace std;

typedef long long int ll;

template<class T> inline bool chmax(T& a,T b){ if(a<b){ a=b; return true;} return false; }
template<class T> inline bool chmin(T& a,T b){ if(a>b){ a=b; return true;} return false; }

typedef pair<int,int> pair;

int main(){
    ll h; cin >> h;

    int count;

    ll twi=1;
    while(h>=twi) twi*=2;
    
    cout << twi-1 << endl;
}

Measured memory_bytes: 256
import std.container;
import std.range;
import std.algorithm;
import std.array;
import std.string;
import std.conv;
import std.stdio;
import std.container;

void main() {
	auto n = readln.chomp.to!int;
	auto a = readln.chomp.split(' ').map!(to!long).array;
	auto dp = new long[][](n + 1, n + 1);
	foreach (l;dp) {
		l[] = -1;
	}

	long solve(int turn, size_t f, size_t l) {
		if (f >= l) return 0;

		if (dp[f][l] != -1) {
			return dp[f][l];
		}

		if (turn == 0) {
			auto p0 = solve(1, f + 1, l) + a[f];
			auto p1 = solve(1, f, l - 1) + a[l - 1];
			auto result = max(p0, p1);
			dp[f][l] = result;
			return result;
		} else {
			auto p0 = solve(0, f + 1, l) - a[f];
			auto p1 = solve(0, f, l - 1) - a[l - 1];
			auto result = min(p0, p1);
			dp[f][l] = result;
			return result;
		}
	}

	writeln(solve(0, 0, a.length));
}


Measured memory_bytes: 75228
//clear adj and visited vector declared globally after each test case
//check for long long overflow
//while adding and subs check if mod becomes -ve
//while using an integer directly in a builtin function add ll

#include <bits/stdc++.h>
#define int long long
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);cout.precision(dbl::max_digits10);
#define pb push_back
#define mod 1000000007 //998244353
#define lld long double
#define mii map<int, int>
#define mci map<char, int>
#define msi map<string, int>
#define pii pair<int, int>
#define ff first
#define ss second
#define all(x) (x).begin(), (x).end()
#define rep(i,x,y) for(int i=x; i<y; i++)
#define fill(a,b) memset(a, b, sizeof(a))
#define vi vector<int>
#define setbits(x) __builtin_popcountll(x)
#define print2d(dp,n,m) for(int i=0;i<=n;i++){for(int j=0;j<=m;j++)cout<<dp[i][j]<<" ";cout<<"\n";}
typedef std::numeric_limits< double > dbl;
using namespace std;
const long long N=200005, INF=2000000000000000000;
int power(int a, int b, int p)
    {
        if(a==0)
        return 0;
        int res=1;
        a%=p;
        while(b>0)
        {
            if(b&1)
            res=(res*a)%p;
            b>>=1;
            a=(a*a)%p;
        }
        return res;
    }

int32_t main()
{
    IOS;
    string s,t;
    cin>>s>>t;
    int n=s.size();
    int nn=t.size();
    if(nn!=(n+1))
    {
        cout<<"No";
        return 0;
    }
    for(int i=0;i<n;i++)
    {
        if(s[i]!=t[i])
        {
            cout<<"No";
            return 0;
        }
    }
    cout<<"Yes";
}

Measured memory_bytes: 3648
#include "bits/stdc++.h"
using namespace std;
const int maxn = 26;
class dsu{
private:
    const int default_size = 100100;
    vector<int> parent;
    int size;
public:
    int find(int vertex){
        return (parent[vertex] < 0)?vertex:parent[vertex] = find(parent[vertex]);
    }
    dsu(){
        this->size = default_size;
        parent.assign(size, -1);
    }
    dsu(int size){
        this->size = size;
        parent.assign(size, -1);
    }
    void clear(){
        parent.assign(size, -1);
    }
    bool isConnected(int u, int v){
        return find(u) == find(v);
    }
    bool connect(int u, int v){
        u = find(u);
        v = find(v);
        if(u != v){
            if(-parent[u] < -parent[v]) swap(u, v);
            parent[u] += parent[v];
            parent[v] = u;
        }
        return u != v;
    }
    int componentSize(int u){
        return - parent[find(u)];
    }
    bool isRoot(int u){
        return parent[u] < 0;
    }
};
int main(){
    int n, m;
    cin >> n >> m;
    dsu sol(n);
    vector<long long> cost(n);
    for(auto & it : cost) scanf("%lld", &it);
    for(int e = 0; e < m; e++){
        int x, y;
        cin >> x >> y;
        sol.connect(x, y);
    }
    vector<pair<long long, int> > go;
    for(int e = 0; e < n; e++) go.push_back({cost[e], sol.find(e)});
    sort(go.begin(), go.end());
    int comps = 0;
    for(int e = 0; e < n; e++) if(e == sol.find(e)) comps++;
    if(n < 2 * comps - 2) return ! printf("Impossible\n");
    long long ans = 0;
    vector<int> outt(n, 0);
    vector<bool> bad(n, 0);
    int select = 0;
    for(int e = 0; e < comps - 1; e++){
        outt[go[e].second]++;
        ans += go[e].first;
        select += 1;
    }
    for(int e = comps - 1; e < n && select < 2 * comps - 2; e++){
        if(outt[go[e].second] == 0){
            outt[go[e].second] += 1;
            ans += go[e].first;
            select += 1;
            bad[e] = true;
        }
    }
    for(int e = comps - 1; e < n && select < 2 * comps - 2; e++){
        if(bad[e]) continue;
        if(outt[go[e].second] < comps - 1){
            outt[go[e].second] += 1;
            ans += go[e].first;
            select++;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3572
N = int(input())
B = list(map(int, input().split()))

ans = [0]*N
for i in range(N, 0, -1):
    cnt = 0
    j = 1
    while i*j<=N:
        cnt += ans[i*j-1]
        j += 1
    if cnt%2 != B[i-1]:
        ans[i-1] = 1

print(sum(ans))

A =[]
for i, j in enumerate(ans, 1):
    if j == 1:
        A.append(i)

print(*A)

Measured memory_bytes: 14136
#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <string.h>
using namespace std;

int n;
char s[205];

int main()
{
	cin>>s+1;
	
	if (strlen(s+1)%2 == 1) n=strlen(s+1)-1;
	else n=strlen(s+1)-2;
	
	for (int i=n;i>=1;i-=2)
	{
		int dis=i/2,flag=0;
		for (int j=1;j<=dis;j++)
			if (s[j] != s[j+dis]) {
				flag=1;break;
			}
		if (!flag) {
			cout<<dis*2<<endl;
			return 0;
		}
	}
	
	cout<<0<<endl;
	return 0;
}

Measured memory_bytes: 256
import sys

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


def main():
    N = int(input())
    A = [int(x) for x in input().split()]

    s = 0
    for a in A:
        s ^= a
    for a in A:
        print(s ^ a)
    
    

if __name__ == '__main__':
    main()



Measured memory_bytes: 31408
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <iostream>
using namespace std;
const int MAXN = 1e6+10;
typedef long long LL;
int main()
{
    LL D,T,S;
    cin >> D >> T >> S;
    if(T*S>=D)
       printf("Yes\n");
    else
        printf("No\n");
    return 0;
}


Measured memory_bytes: 3488
import sys
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]

mod = 10 ** 9 + 7

N, M, K = LI()
desk = LIR(2)
a, b = [0], [0]

# a = [0, 0 + A1, 0 + A1 + A2, ....]
# b = [0, 0 + B1, 0 + B1 + B2, ....]
for i in range(N):
    a.append(a[i] + desk[0][i])
for j in range(M):
    b.append(b[j] + desk[1][j])

# a + b <= K を求める　⇒　変形してb >= K - a とすることで、
# aは全件トライ、bのみ選択可能な最大値を算出することで計算量をO(N + M)に抑える
ans, j = 0, M 

for i in range(N + 1):
    if a[i] > K:
        break
    while b[j] > K - a[i]:
        j -= 1
    ans = max(ans, i + j)

print(ans)

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

typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<long long> VL;
typedef vector<vector<long long>> VVL;
typedef pair<int,int> P;
typedef tuple<int,int,int> tpl;

#define ALL(a)  (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())
#define EXIST(m,v) (m).find((v)) != (m).end()
#define LB(a,x) lower_bound((a).begin(), (a).end(), x) - (a).begin()
#define UB(a,x) upper_bound((a).begin(), (a).end(), x) - (a).begin()

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RFOR(i,a,b) for(int i=(a)-1;i>=(b);--i)
#define RREP(i,n) RFOR(i,n,0)

#define en "\n"

constexpr double EPS = 1e-9;
constexpr double PI  = 3.1415926535897932;
constexpr int INF = 2147483647;
constexpr long long LINF = 1LL<<60;
constexpr long long MOD = 1000000007; // 998244353;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

void Main(){
    int K; cin >> K;
    string ans = "";
    REP(i,K) ans += "ACL";
    cout << ans << en;
    return;
}

int main(void){
    cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(0);cout<<fixed<<setprecision(15);
    int t=1; //cin>>t;
    REP(_,t) Main();
    return 0;
}

Measured memory_bytes: 3612
#include<cstdio>
#include<cstring>
#include <algorithm>
using namespace std;
const int maxn=1e5+7;
int n,m,k,a[maxn],b[maxn],sum,c[maxn],d[maxn];
struct g{
	int x;int y;int f;
}e[maxn];
inline int read(){
   int s=0,w=1;
   char ch=getchar();
   while(ch<'0'||ch>'9'){if(ch=='-')w=-1;ch=getchar();}
   while(ch>='0'&&ch<='9') s=s*10+ch-'0',ch=getchar();
   return s*w;
}
int main()
{
	n=read(),m=read(),k=read();
	for(int i=1;i<=n;i++)
	{
	a[i]=read();
	c[i]=a[i];
	}
	for(int i=1;i<=m;i++)
	{
	scanf("%d",&b[i]);
	d[i]=b[i];
	}
	for(int i=1;i<=k;i++)
    {
    scanf("%d%d%d",&e[i].x,&e[i].y,&e[i].f);
	}
	sort(c+1,c+n+1);
	sort(d+1,d+m+1);
	sum=c[1]+d[1];
	for(int i=1;i<=k;i++)
	{
	sum=min(sum,a[e[i].x]+b[e[i].y]-e[i].f);		
	}
	printf("%d",sum);
}

Measured memory_bytes: 2944
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define rep(i,n) for(int i=0;i<n;i++)
#define mod 1000000007 // 10^9+7
#define INF 99999999999 //10^12-1
#define dev 998244353 //tenka1
#define P pair<int,int>
#define F first
#define S second
int w,h,x,y;
signed main(){
    cin>>w>>h>>x>>y;
    double a=w*h*1.000000000/2;
    printf("%.8LF ",a);
    if(w%2==0&&x==w/2&&h%2==0&&y==h/2)cout<<1<<endl;
    else cout<<0<<endl;
    return 0;
}


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

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF = (1<<30) - 1;
const ll LINF = (1LL<<60) - 1;

ll dp[110][2][4];

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

    dp[0][0][0] = 1;
    for (int i = 0; i < n.size(); ++i) {
        int d = n[i] - '0';
        // from 0
        if (d == 0){
            for (int j = 0; j < 4; ++j) {
                dp[i+1][0][j] += dp[i][0][j];
            }
        }
        else{
            for (int j = 0; j < 3; ++j) {
                dp[i+1][0][j+1] += dp[i][0][j];
                dp[i+1][1][j+1] += dp[i][0][j] * (d-1);
            }
            for (int j = 0; j < 4; ++j) {
                dp[i+1][1][j] += dp[i][0][j];
            }
        }
        // from 1
        for (int j = 0; j < 3; ++j) {
            dp[i+1][1][j+1] += dp[i][1][j] * 9;
        }
        for (int j = 0; j < 4; ++j) {
            dp[i+1][1][j] += dp[i][1][j];
        }

    }
    cout << dp[n.size()][0][k] + dp[n.size()][1][k] << endl;
}

Measured memory_bytes: 3580
#include<iostream>
#include<cstdlib>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;
typedef long long ll;

ll gcd(ll a,ll b)
{
    if (!b) return a;
    else return gcd(b,a%b);
}

int main()
{
    ll a,b;
    while(cin>>a>>b)
    {
        ll gcd1=gcd(a,b);
        ll lcm1=a/gcd1*b;
        cout<<gcd1<<" "<<lcm1<<endl;
    }
}

Measured memory_bytes: 3008
from math import gcd
def calc(a,b,n):
  return b//n-(a-1)//n
def solve():
  A, B, C, D = map(int, input().split())
  ans = B-A+1-calc(A,B,C)-calc(A,B,D)+calc(A,B,C*D//gcd(C,D))
  return ans
print(solve())

Measured memory_bytes: 62072
// 2011/07/27 Tazoe

#include <iostream>
using namespace std;

void insert(int T[300][2], int& N, int I, int t)
{
	for(int i=N; i>I; i--){
		T[i][0] = T[i-1][0];
		T[i][1] = T[i-1][1];
	}

	T[I][0] = t;
	T[I][1] = T[I-1][1];

	N++;
}

int main()
{
	while(true){
		int n;
		cin >> n;
		if(n==0)
			break;

		int T[300][2];		// JnÆÌdÌa
		T[0][0] = 0;
		T[0][1] = 0;
		int N = 1;		// f[^ÌÂ

		for(int i=0; i<n; i++){
			int m, a, b;
			cin >> m >> a >> b;

			int I = 0;

			while(I<N&&T[I][0]<a)		// aÌf[^ÊuðT·
				I++;

			if(I==N){			// ÅãöÈçÎ
				T[N][0] = a;
				T[N][1] = m;
				N++;
				T[N][0] = b;
				T[N][1] = 0;
				N++;
				continue;
			}

			if(T[I][0]>a)			// aÌf[^ªÈ¯êÎ
				insert(T, N, I, a);

			while(I<N&&T[I][0]<b){		// bÌf[^ÊuðT·
				T[I][1] += m;
				I++;
			}

			if(I==N){			// ÅãöÈçÎ
				T[N][0] = b;
				T[N][1] = 0;
				N++;
				continue;
			}

			if(T[I][0]>b){			// bÌf[^ªÈ¯êÎ
				insert(T, N, I, b);
				T[I][1] -= m;
			}
		}

		bool flg = true;
		for(int i=0; i<N; i++)
			if(T[i][1]>150){
				flg = false;
				break;
			}

		if(flg)
			cout << "OK" << endl;
		else
			cout << "NG" << endl;
	}

	return 0;
}

Measured memory_bytes: 0
# Fast IO (only use in integer input)

import os,io
input=io.BytesIO(os.read(0,os.fstat(0).st_size)).readline

N,K = map(int,input().split())
a = list(map(int,input().split()))
ans = ""
for i in range(N):
    if i < K:
        continue
    if a[i] <= a[i - K]:
        ans += "No"
    else:
        ans += "Yes"
    if i != N-1:
        ans += "\n"
print(ans)


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

int main() {
    int N , R ;
    cin >> N >> R ; // 1 ≤ N ≤ 100 , 0 ≤ R ≤ 4111
    if (N >= 10 ) cout << R <<endl;
    else cout << R + 100*(10 - N) << endl;
	return 0;
}

Measured memory_bytes: 3564