akhauriyash/Code-Regression huggingface dataset:
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
from operator import mul
from functools import reduce


sys.setrecursionlimit(2147483647)
INF = 10 ** 13
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().rstrip().split()
def S(): return sys.stdin.readline().rstrip()
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 = 998244353


n, d = LI()
ans = 0
for _ in range(n):
    x, y = LI()
    if x ** 2 + y ** 2 <= d ** 2:
        ans += 1

print(ans)


Measured memory_bytes: 78264
#include<stdio.h>
int main()
{
	int a,b,k;
	int i,x[100]={0},y=0,c=0;
	scanf("%d %d %d",&a,&b,&k);
	if(a>b) y=a;
	else y=b;
	for(i=1;i<=y;i++){
		if(a%i==0&&b%i==0){
			x[c]=i;
			c++;
		}
	}
	printf("%d\n",x[c-k]);
	return 0;
}

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

int n,m;
int a[105][105],dp[105][105];

signed main()
{
	cin>>n>>m;
	for (int i=1;i<=n;i++)
	{
		for (int j=1;j<=m;j++)
		{
			char temp;
			cin>>temp;
			
			if (temp=='.')  a[i][j]=1;
			else a[i][j]=0;
		}
	}
	if (a[1][1]==1)  dp[1][1]=0;
	else dp[1][1]=1;
	
	for (int j=2;j<=m;j++)
	{
		if (a[1][j-1]==a[1][j]||(a[1][j-1]==0&&a[1][j]==1))  dp[1][j]=dp[1][j-1];
		else dp[1][j]=dp[1][j-1]+1;
	}
	for (int i=2;i<=n;i++)
	{
		if (a[i][1]==a[i-1][1]||(a[i][1]==1&&a[i-1][1]==0))  dp[i][1]=dp[i-1][1];
		else dp[i][1]=dp[i-1][1]+1;
	}
	
	for (int i=2;i<=n;i++)
	{
		for (int j=2;j<=m;j++)
		{
			int up,left;
			if (a[i-1][j]==a[i][j]||(a[i][j]==1&&a[i-1][j]==0))  up=dp[i-1][j];
			else up=dp[i-1][j]+1;
			
			if (a[i][j-1]==a[i][j]||(a[i][j]==1&&a[i][j-1]==0))  left=dp[i][j-1];
			else left=dp[i][j-1]+1;
			
			dp[i][j]=min(up,left);
		}
	}
	cout<<dp[n][m]<<endl;
	
	return 0;
}

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

using ll = long long;
using namespace std;
const int INFint = 2e9+1;
const ll INFll = 2e18+1;
ll MOD=1e9+7;


int main(){
  ll N;
  ll K;
  cin>>N>>K;
  ll ans(0);
  for(ll i(K);i<=N+1;i++){
    ll tmp1 = i*(2*(N+1-i)+(i-1))/2;
    ll tmp2 = i*(i-1)/2;
    //cout << tmp1 << " " << tmp2 << endl;
    ans += (tmp1 - tmp2 + 1);
    ans %= MOD;
  }
  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 3636
/*----------------by syr----------------*/
/*
  -----  -----  -----
  |   |  |---|    _/
  |   |  | \_    /
  -----  |   \  -----

  |---\  \   /  |\  /|
  |   |   \_/   | \/ |
  |   |   / \   |    |
  |---/  /   \  |    |
*/
#include<bits/stdc++.h>

using namespace std;

#define PH push
#define MP make_pair
#define PB push_back
#define fst first
#define snd second
#define FOR(i,x,y) for(int i=(x);i<(y);++i)
#define REP(i,x,y) for(int i=(x);i<=(y);++i)
#define x0 x0123456789
#define y0 y0123456789
#define x1 x1234567890
#define y1 y1234567890
#define x2 x2345678901
#define y2 y2345678901
typedef double db;
typedef long long ll;
typedef long double ldb;
typedef unsigned long long ull;
typedef pair<int,int> pii;

const int INF=1e9+7;

int K,A,B;
ll ans=0;

inline ll solve1(ll k,ll a,ll b){
	return k+1;
}

inline ll solve2(ll k,ll a,ll b){
	ll ret=a;
	k-=a-1;
	if(k<=0) return 0;
	if(k&1){
		ret+=k/2*(b-a);
		++ret;
	}else{
		ret+=k/2*(b-a);
	}
	return ret;
}

int main(){
	scanf("%d%d%d",&K,&A,&B);
	ans=max(ans,solve1(K,A,B));
	ans=max(ans,solve2(K,A,B));
	printf("%lld\n",ans);
	return 0;
}


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

int main(){
  int n, k;
  cin >> n >> k;
  vector<int> p(n), c(n);
  rep(i, n) cin >> p[i];
  rep(i, n) cin >> c[i];
  rep(i, n) p[i]--;
  ll ans = -1e18;
  rep(si, n){
    int x = si;
    vector<int> s;
    ll tot = 0;
    while (1){
      x = p[x];
      s.push_back(c[x]);
      tot += c[x];
      if (x == si) break;
    }
    int l = s.size();
    ll t = 0;
    rep(i, l){
      t += s[i];
      if (i+1 > k) break;
      ll now = t;
      if (tot > 0){
        ll e = (k - (i + 1)) / l;
        now += tot * e;
      }
      ans = max(ans, now);
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3724
#include <stdio.h>

static const int N = 100;

void trace(int A[], int n){
	int i;
	for(i=0; i<n; i++){
		if(i>0)	printf(" ");
		printf("%d", A[i]);
	}
	printf("\n");
}

int main(void){
	int n, i, j, key;
	int A[N];
	scanf("%d", &n);

	for(i=0; i<n; i++)	scanf("%d", &A[i]);

	trace(A, n);

	for(i=1; i<n; i++){
		key=A[i];
		j=i-1;
		while(j>=0 && A[j]>key){
			A[j+1] = A[j];
			j--;
		}
		A[j+1]=key;
		trace(A, n);
	}

	return 0;
}

Measured memory_bytes: 604
#include <bits/stdc++.h>
#define ll long long
#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))
#define INF = 1001001001
#define pi = acos(-1)
using namespace std;
int gcd(int x, int y) { return (x % y)? gcd(y, x % y): y; }

int main(){
    ll n; cin>>n;
    ll ans = 1;
    ll kabu = 1;
    ll all = 1;

    for (int i = 0; i < n; ++i) {
        ans %= (1000000000+7);
        ans *= 9;
        kabu %= (1000000000+7);
        kabu *= 8;
        all %= (1000000000+7);
        all *= 10;
    }

    cout << (all - (ans*2 - kabu)%(1000000000+7))%(1000000000+7) << endl;


    return 0;
}

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

int main() {
  constexpr int64_t mod = 998244353;
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  vector dp(c - a + 2, vector(d - b + 2, 0l));
  dp.at(1).at(1) = 1;
  for (int i = 0; i <= c - a; i++) {
    for (int j = 0; j <= d - b; j++) {
      dp.at(i + 1).at(j + 1) += (b + j) * dp.at(i).at(j + 1) % mod;
      dp.at(i + 1).at(j + 1) += (a + i) * dp.at(i + 1).at(j) % mod;
      dp.at(i + 1).at(j + 1) -= (a + i - 1) * (b + j - 1) % mod * dp.at(i).at(j) % mod;
      dp.at(i + 1).at(j + 1) += mod;
      dp.at(i + 1).at(j + 1) %= mod;
    }
  }
  cout << dp.back().back() << endl;
}


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


int main() {
    int n;
    cin>>n;
    vector<int> a(n);
    rep(i,n){
        cin>>a[i];
    }
    sort(a.begin(),a.end());
    reverse(a.begin(),a.end());
    ll ans=0;
    rep(i,n-1){
        if(i%2==1){
            ans+=a[(i+1)/2];
        }
        if(i%2==0){
            ans+=a[i/2];
        }
    }
    cout<<ans<<endl;
}

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

int main(int argc, const char * argv[]) {
    // insert code here...
    int A, B, C;
    cin >> A >> B >> C;
    
    if (A + B >= C) cout << "Yes" << endl;
    else cout << "No" << endl;
    
    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
           
            string[] line = Console.ReadLine().Split(' ');
            double number = double.Parse(line[0]);
            double sinsu = double.Parse(line[1]);

            for(int i=0;i<100;i++){
                double ans = Math.Pow(sinsu,i);
                if(ans > number){
                    Console.WriteLine(i);
                        break;
                }

            }
           


            
        }
    }
}


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

int main ()
{
  int A,B,C;
  cin>>A>>B;
  if(A!=0 && A<=3 && B!=0 && B<=3 && A!=B){
    cout << (6 - (A + B));
  }
  return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define rep(i, m, n) for(int i = m; i < (n); i++)
#define print(x) cout << (x) << endl;
#define printa(x,n) for(int i = 0; i < n; i++){ cout << (x[i]) << " ";} cout << endl;
#define printa2(x,m,n) for(int i = 0; i < m; i++){ for(int j = 0; j < n; j++){ cout << x[i][j] << " ";} cout << endl;}
#define printp(x,n) for(int i = 0; i < n; i++){ cout << "(" << x[i].first << ", " << x[i].second << ") "; } cout << endl;
#define INF (1e9)
using namespace std;
typedef long long ll;
typedef struct{
    int x;
    int y;
} P;
typedef struct{
    ll to;
    ll cost;
} edge;
typedef pair<ll, ll> lpair;
ll dp[45][510][510];

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N,Ma,Mb;
    ll a[50], b[50], c[50];
    cin >> N >> Ma >> Mb;
    rep(i,0,N){
        cin >> a[i] >> b[i] >> c[i];
    }
    rep(i,0,N){
        rep(j,0,500){
            rep(k,0,500){
                dp[i][j][k] = 1e9;
            }
        }
    }
    dp[0][0][0] = 0;
    rep(i,0,N){
        rep(j,0,500){
            rep(k,0,500){
                if(j >= a[i] && k >= b[i]){
                    dp[i+1][j][k] = min(dp[i][j][k], dp[i][j-a[i]][k-b[i]] + c[i]);
                }else{
                    dp[i+1][j][k] = dp[i][j][k];
                }

            }
        }
    }
    ll ans = 1e9;
    rep(i,0,500){
        rep(j,0,500){
            if((i != 0 || j != 0) && i * Mb == j * Ma){
                ans = min(ans, dp[N][i][j]);
            }

        }
    }
    if(ans == 1e9){
        print(-1);
    }else{
        print(ans);
    }
}


Measured memory_bytes: 84224
import scipy as sp
import numpy as np
import math


N = int(input())

ans = 0
for a in range(1, N+1):
    for b in range(1, N+1):
        d = math.gcd(a, b)
        for c in range(1, N+1):

            ans += math.gcd(c, d)

print(ans)

Measured memory_bytes: 31140
import java.util.Scanner;

class Main {
	public static void main(String[] $) {
		Scanner sc = new Scanner(System.in);
		long n=sc.nextLong(),a=sc.nextLong(),b=sc.nextLong();
		System.out.println(n/(a+b)*a+Math.min(n%(a+b),a));
	}
}

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

int main(){
  string s;
  cin >> s;
  int ans = 0;
  rep(i,6){
    if(s[i] == '1') ++ans;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int n,a[20],v[20],i,max,vic;
	
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d %d",&a[i],&v[i]);
	}
	max=v[0];
	vic=a[0];
	for(i=0;i<n;i++){
		if((max==v[i] && vic>a[i])||(max<v[i])){
			max=v[i];
			vic=a[i];
		}
	}
	printf("%d %d\n",vic,max);
	
	return 0;
}

Measured memory_bytes: 600
#include<iostream>
#include<algorithm>
#include<cmath>
#include<string>
#include<vector>
using namespace std;
using ll =long long;
int main() {
	int A, B, C,X;
	ll count=0;
	cin >> A >> B >> C >> X;
	for (int i=0; i<=A; i++) {
		for (int j = 0; j <= B; j++)
		{
			for (int k = 0; k <= C; k++) {
				if (i * 500 + j * 100 + k * 50==X) {

					count++;
				}

			}

		}
	}
	cout << count;

}


Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
int A,B,K;
int cnt=0;
int a[106];
int main()
{
    scanf("%d %d %d",&A,&B,&K);
    for(int i=A;i<=min(A+K-1,B);i++)
    {
    printf("%d\n",i);
    }
    for(int i=B;i>=max(B-K+1,A+K);i--)
    {
        a[++cnt]=i;
    }
    sort(a+1,a+1+cnt);
    for(int i=1;i<=cnt;i++)
    printf("%d\n",a[i]);
}

Measured memory_bytes: 128
#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<algorithm>

using namespace std;

int main()
{
	int a[4];
	int n, i, j, flag;
	while(cin >> a[0] >> a[1] >> a[2])
	{
		flag = 0;
		sort(a, a + 3);
		for(i = 0; i < 2; i++)
		{
			for(j = i + 1; j < 3; j++)
				if(a[i] == a[j]) flag++;
			if(flag == 2) break;
		}
		cout << 3 - flag << endl;
	}
	return 0;
}

Measured memory_bytes: 256
/** Author: Dwai
 *  Omae wa mou shindeiru!
**/

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

#define mp make_pair
#define pb push_back
#define eb emplace_back
#define ff first
#define ss second
#define all(a) (a).begin(),(a).end()
#define fr(i,a,b) for (i = a; i <= b; i++)
#define frr(i,a,b) for (i = a; i >= b; i--)
#define rep(i,n) for (i = 0 ; i < n; i++)
#define repr(i,n) for (i = n - 1; i >= 0; i--)
#define fast ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);srand(time(NULL));
#define flushinput   cin.ignore(numeric_limits<streamsize>::max(),'\n');

void debug_out() { cerr << endl; }

void clock_out(){
  cerr<<"\nTime Elapsed : " << 1.0*clock() / CLOCKS_PER_SEC << " s\n";
}

void fileio(){
  freopen("/home/dwai/Desktop/cp/input.txt","r", stdin);
  freopen("/home/dwai/Desktop/cp/output.txt", "w", stdout);
  freopen("/home/dwai/Desktop/cp/debug.txt", "w", stderr);
}

void ofileio(){
  freopen("input.txt","r", stdin);
  freopen("output.txt", "w", stdout); 
}

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << H;
  debug_out(T...);
}

#ifndef ONLINE_JUDGE
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#define fio() fileio()
#define ofio() fileio()
#define clock() clock_out()
#else
#define debug(...) 42
#define fio() 42
#define ofio() ofileio()
#define clock() 42
#endif

typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<ll> vl;
typedef vector<pll> vll;
typedef map<ll,ll> mll;

int IT_MAX = 1 << 20;
const ll MOD = 1000000007;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const db PI = acos(-1);
const db ERR = 1e-10;



void solve()
{
	ll n,k;
	cin>>n>>k;

	ll a[n],i;
	rep(i,n) cin>>a[i];

	ll dp[100001][2];
	memset(dp,0,sizeof(dp));

	ll j;
	fr(i,0,k){
		ll w1=0;
		ll l1=0;

		fr(j,0,n-1)
		{
			if(i-a[j]>=0)
			{
				if(dp[i-a[j]][0]==1)
				{
					w1=1;
				}
				if(dp[i-a[j]][1]==1)
				{
					l1=1;
				}
			}
		}
		if(w1 && l1)
		{
			dp[i][0]=1;
			dp[i][1]=0;
		}
		else if(!w1 && l1)
		{
			dp[i][0]=1;
			dp[i][1]=0;
		}
		else if(w1 && !l1)
		{
			dp[i][0]=0;
			dp[i][1]=1;
		}
		else{
			dp[i][0]=0;
			dp[i][1]=1;
		}
	
	}
	if(dp[k][0])
	{
		cout<<"First\n";
	}
	else cout<<"Second\n";
}

int main()
{
	//fio();
	fast
	ll t=1;
	//cin>>t;

	while(t--){
		solve();
	}
	return 0;
}

Measured memory_bytes: 1792
#include<iostream>
using namespace std;
int main() {
	int card[3];
	int low;
	int high;
	while (cin >> card[0] >> card[1] >> card[2]) {
		low = 0;
		low = 20 - card[0] - card[1];
		high = 10 - low;
		for (int i = 0; i < 3; ++i) {
			if (20 - card[0] - card[1] < card[i])
				--high;
			else --low;
		}
		if (low <high)cout << "NO" << endl;
		else cout << "YES" << endl;
	}
	return 0;
}

Measured memory_bytes: 1152
#include<stdio.h>
#include<string.h>


typedef struct  {
    int first;
    int second;
    int third;
    int forth;
    int fifth;
    int sixth;
} Dice;

int main() {
	Dice one;
	int q, i;

	scanf("%d ", &one.first);
    scanf("%d ", &one.second);
    scanf("%d ", &one.third);
    scanf("%d ", &one.forth);
    scanf("%d ", &one.fifth);
    scanf("%d", &one.sixth);

    scanf("%d\n", &q);

    for(i = 0; i < q; ++i) {
    	int a[2];
    	scanf("%d %d", &a[0], &a[1]);
    	
    	if(a[0] == one.first){
			if(a[1] == one.second) printf("%d\n", one.third);
			if(a[1] == one.third) printf("%d\n", one.fifth);
			if(a[1] == one.forth) printf("%d\n", one.second);
			if(a[1] == one.fifth) printf("%d\n", one.forth);
		}
		if(a[0] == one.second){
			if(a[1] == one.first) printf("%d\n", one.forth);
			if(a[1] == one.third) printf("%d\n", one.first);
			if(a[1] == one.forth) printf("%d\n", one.sixth);
			if(a[1] == one.sixth) printf("%d\n", one.third);
		}
		if(a[0] == one.third){
			if(a[1] == one.second) printf("%d\n", one.sixth);
			if(a[1] == one.first) printf("%d\n", one.second);
			if(a[1] == one.sixth) printf("%d\n", one.fifth);
			if(a[1] == one.fifth) printf("%d\n", one.first);
		}
		if(a[0] == one.forth){
			if(a[1] == one.second) printf("%d\n", one.first);
			if(a[1] == one.sixth) printf("%d\n", one.second);
			if(a[1] == one.first) printf("%d\n", one.fifth);
			if(a[1] == one.fifth) printf("%d\n", one.sixth);
		}
		if(a[0] == one.fifth){
			if(a[1] == one.first) printf("%d\n", one.third);
			if(a[1] == one.third) printf("%d\n", one.sixth);
			if(a[1] == one.forth) printf("%d\n", one.first);
			if(a[1] == one.sixth) printf("%d\n", one.forth);
		}
		 if(a[0] == one.sixth){
			if(a[1] == one.second) printf("%d\n", one.forth);
			if(a[1] == one.third) printf("%d\n", one.second);
			if(a[1] == one.forth) printf("%d\n", one.fifth);
			if(a[1] == one.fifth) printf("%d\n", one.third);
		}
    }
    return 0;
}



 

    
 


Measured memory_bytes: 2052
/**
 *    Author:   Sambhu Show(JGEC)
 *    fb    :   https://www.facebook.com/sambhu.show.98
 *              #everyday counts.....(^_^)
**/
#include<bits/stdc++.h>
using namespace std;
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);
#define itc int t;cin>>t;while(t--)
#define ltc ll t;cin>>t;while(t--)
#define ll long long int
#define ld long double
#define pb push_back
#define vll vector<ll>
#define sll set<ll>
#define mpll map<ll ,ll>
#define sortd(arr) sort(arr,arr+n,greater<ll>())
#define revs(str) reverse(str.begin(), str.end());
#define memset(arr) memset(arr,0,sizeof(arr));//array elements to 0
//-----------------------#Sambhu.98(CF)-------------------------------//
#define fr(i,a,b) for(ll i=a;i<=b;i++)
#define frr(i,a,b) for(ll i=a;i>=b;i--)
ll const inf=1e18;
//-----------------------#sambhu_98(CC)------------------------//
bool isPrime(ll n)
{   if (n <= 1)  return false;
    if (n <= 3)  return true;
    if (n % 2 == 0 or n % 3 == 0)  return false;
    ll i = 5;
    while(i * i <= n) { 
        if (n % i == 0 or n % (i + 2) == 0)  
        return false;
        i = i + 6;}
        return true; }

ll gcd (ll a, ll b) {  return b ? gcd (b, a % b) : a;}
ll lcm(ll a, ll b)  {  return (a*b)/gcd(a, b);  }

ll countDivisors(ll n) 
{ ll cnt = 0; 
    for (ll i = 1; i <= sqrt(n); i++) { 
        if (n % i == 0) { 
            if (n / i == i) 
                cnt++; 
            else  
                cnt = cnt + 2; } } 
    return cnt; }
/*/\/\/\/\/\/\/\/\/\/\/\/\//\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\*/
int main()
{
ll h;
cin>>h;
ll ans=1;ll t=h;
while(h>0)
{
    h/=2;
    ll x=ans;
    ans+=x;
}
cout<<ans-1<<endl;
return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	  public static void main(String[] args ) throws Exception {
		Scanner sc = new Scanner(System.in);
	
		int A = sc.nextInt();
		int[] array = new int[A];
		int count = 0;
		
		for (int i = 0;i < A; i++) {
			array[i] = sc.nextInt();
			if(array[i] != i+1) {
				count ++;
				if (count >= 3) {
					break;
				}
			}
		}
		if(count < 3) {
			System.out.println("YES");
		}else {
			System.out.println("NO");
		}
	}
}

Measured memory_bytes: 23764
import sys

input = sys.stdin.readline
N = int(input())

num_list = [3, 5, 7]
count = 0
while len(num_list) > 0:
    base = num_list.pop()
    for i in [3, 5, 7]:
        v = base*10+i
        if v <= N:
            num_list.append(v)
            if ('3' in str(v)) and ('5' in str(v)) and ('7' in str(v)):
                count += 1

print(count)


Measured memory_bytes: 3188
#include<stdio.h>
#include<string.h>
int main()
{
	int i,n,m,t,b,ac,k;
	char s[100];
	char a[100];
	scanf("%s",&s);
	n=0;
	m=0;
	for(i=0;i<strlen(s);i++)
	{
		if(s[i]=='C')
		n++;
		if(s[i]=='F')
		m++;
	}
	ac=0;
	t=0;
	b=0;
	for(i=0;i<strlen(s);i++)
	{
		if(s[i]=='C')
		{
		t=i;
		for(k=i+1;k<strlen(s);k++)
		{
		if(s[k]=='F')
		b=k;
	}
		if(t<b)
		break;
	}
}
	if(t<b)
	printf("Yes");
	else
	printf("No");
}

Measured memory_bytes: 128
def two_int():
    N, K = map(int, input().split())
    return N,K

def one_int():
    return int(input())

def one_str():
    return input()

def many_int():
    return list(map(int, input().split()))

c1 = many_int()
c2 = many_int()
c3 = many_int()

import numpy as np
temp_array=np.asarray([c1,c2,c3])
temp = temp_array.T

same_flg=True

same = c1[0]-c2[0]
for a,b in zip(c1[1:],c2[1:]):
    if a-b != same:
        same_flg=False
        
same = c1[0]-c3[0]
for a,b in zip(c1[1:],c3[1:]):
    if a-b != same:
        same_flg=False
        
same = c2[0]-c3[0]
for a,b in zip(c2[1:],c3[1:]):
    if a-b != same:
        same_flg=False





c1=list(temp[0])
c2=list(temp[1])
c3=list(temp[2])

same = c1[0]-c2[0]
for a,b in zip(c1[1:],c2[1:]):
    if a-b != same:
        same_flg=False

same = c1[0]-c3[0]
for a,b in zip(c1[1:],c3[1:]):
    if a-b != same:
        same_flg=False

same = c2[0]-c3[0]
for a,b in zip(c2[1:],c3[1:]):
    if a-b != same:
        same_flg=False

if same_flg:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 14452
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define rrep2(ri,x,n) for(int ri = (int)(n-1); ri >= (int)(x); ri--)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(x) x.begin(), x.end()
using ll = long long;
using namespace std;

int main(){
  int n;
  cin >> n;
  ll c;
  cin >> c;
  vector<pair<ll, int>> pv(n);
  rep(i, n){
    ll x;
    cin >> x;
    int v;
    cin >> v;
    pv.at(i) = {x, v};
  }

  vector<ll> cp(n), cm(n);
  ll ans = 0, add = 0, bf = 0;
  rep(i, n){
    add -= pv.at(i).first - bf;
    add += pv.at(i).second;
    ans = max(ans, add);
    if(i == 0){
      cp.at(i) = max(0LL, add);
    }else{
      cp.at(i) = max(cp.at(i-1), add);
    }
    bf = pv.at(i).first;
  }
  add = 0, bf = c;
  rrep(i, n){
    add -= bf - pv.at(i).first;
    add += pv.at(i).second;
    ans = max(ans, add);
    if(i == n-1){
      cm.at(i) = max(0LL, add);
    }else{
      cm.at(i) = max(cm.at(i+1), add);
    }
    bf = pv.at(i).first;
  }

  rep(i, n-1){
    ll add = cp.at(i);
    add += cm.at(i+1);
    add -= pv.at(i).first;
    ans = max(ans, add);
  }
  rrep2(i, 1, n){
    ll add = cm.at(i);
    add += cp.at(i-1);
    add -= c - pv.at(i).first;
    ans = max(ans, add);
  }
  // rep(i, n){
  //   cerr << cp.at(i) << " ";
  // }
  // cerr << endl;
  // rep(i, n){
  //   cerr << cm.at(i) << " ";
  // }
  // cerr << endl;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 6404
#include<bits/stdc++.h>
using namespace std;
long long int dz[200007];
long long int dp[200007];

long long int ads(long long int k){
	if(k<0)return -k;
	return k;
}

int main(){
	int n;
  	long long int max=190000000000;
  	for(int i=1;i<=n;i++)dp[i]=max;
  	cin>>n;
 	for(int i=1;i<=n;i++)cin>>dz[i];
  	dp[0]=max;
	dp[1]=0;
  	
	for(int i=2;i<=n;i++){
    	dp[i]=min((dp[i-1]+ads(dz[i]-dz[i-1])),(dp[i-2]+ads(dz[i]-dz[i-2])));
    }
    
	cout<<dp[n];
  return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#define MAX 30
using namespace std;

inline void change(int array[], int a, int b){
  int c = array[a];
  array[a] = array[b];
  array[b] = c;
}

int main(){
  int array[MAX];
  int w, n, a, b;
  char comma;

  cin >> w >> n;

  for(int i = 0; i < w; i++){
    array[i]=i+1;
  }

  for(int i=0; i<n; i++){
    cin >> a >> comma >> b;
    change(array, a-1, b-1);
  }

  for(int i=0; i<w; i++){
    cout << array[i] << endl;
  }
}

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

using namespace std;

void dfs(int idx, vector<int> &color, vector<vector<pair<int, int>>> &e){
    for(auto itr = e[idx].begin(); itr != e[idx].end(); itr++){
        if(color[itr -> first] == -1){
            color[itr -> first] = (color[idx] + itr -> second) % 2;
            dfs(itr -> first, color, e);
        }
    }
}

int main(void){
    int N;
    cin >> N;
    vector<int> color(N, -1);
    vector<vector<pair<int, int>>> e(N);
    for(int i = 0; i < N - 1; i++){
        int u, v, w;
        cin >> u >> v >> w;
        e[u - 1].push_back(make_pair(v - 1, w));
        e[v - 1].push_back(make_pair(u - 1, w));
    }
    color[0] = 0;
    dfs(0, color, e);
    for(int i = 0; i < N; i++) cout << color[i] << endl;
    return 0;
}

Measured memory_bytes: 8704
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int n,m;
  cin >> n >> m;
  vector<pair<int,int>> data(n);
  priority_queue<int> que;
  
  for(int i=0; i<n; i++){
    cin >> data.at(i).first >> data.at(i).second;
  }
  
  sort(data.begin(),data.end());
  long long sum = 0;
  int date = data.at(0).first,pos=0,count = 0;
  
  if(date > m){
    cout << 0 << endl;
    return 0;
  }
  
  while(1){
    while(1){
      if(pos == n) break;
      if(date == data.at(pos).first){
        que.push(data.at(pos).second);
        pos++;
      }else{
        break;
      }
    }
    
    if(que.empty()){
      date++;
    }else{
      sum += que.top();
      que.pop();
      date++;
      count++;
    }
    
    if(date == m+1 || count == n) break;
  }
  
  cout << sum << endl;
}

Measured memory_bytes: 1660
function main(input) {
  var args = input.split('\n');
  var n = parseInt(args[0], 10);
  var k = parseInt(args[1], 10);
  var x = parseInt(args[2], 10);
  var y = parseInt(args[3], 10);
  
  if (n <= k) {
    var ans = n * x;
  } else {
    var ans = k * x + (n - k) * y;
  }

  console.log(ans);
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));

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

namespace AOJ1_7_B
{
    class Program
    {
        static void Main(string[] args)
        {
            while (true)
            {
                string[] Num = Console.ReadLine().Split(' ');
                int n = int.Parse(Num[0]);
                int x = int.Parse(Num[1]);
                int Count= 0;
                if (n == 0 && x == 0) break;
                else
                {
                    for (int i = 1; i < n+1; i++)
                    {
                        for (int j = 1; j < n+1; j++)
                        {
                            for (int k = 1; k < n+1; k++)
                            {
                                if (i == j || i == k || j == k)
                                { }
                                else if(i + j + k == x)
                                {
                                    Count = Count+1;
                                }
                            }
                        }
                    }
                }
                Count = Count / 6; //重複したものをけずる
                Console.WriteLine(Count);
            }
        }
    }
}



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

template<typename T, typename U>
using pv=vector<pair<T,U>>;
template<typename T>
using pque=priority_queue<T>;
template<typename T>
using lpque=priority_queue<T,vector<T>,greater<T>>;

using ll=long long;
using intpair=pair<int,int>;
using llpair=pair<ll,ll>;
using ilpair=pair<int,ll>;
using lipair=pair<ll,int>;
using intvec=vector<int>;
using llvec=vector<ll>;
using intq=queue<int>;
using llq=queue<ll>;
using intmat=vector<intvec>;
using llmat=vector<llvec>;

#define PI 3.141592653589793
#define INTINF ((1<<30)-1)
#define LLINF ((1LL<<62)-1)
#define MPRIME 1000000007
#define MPRIME9 998244353
#define MMPRIME ((1ll<<61)-1)

#define len length()
#define pushb push_back
#define fi first
#define se second

#define all(name) name.begin(),name.end()
#define rall(name) name.rbegin(),name.rend()
#define gsort(vbeg,vend) sort(vbeg,vend,greater<>())

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;
}

template<class T>
inline void init(T& v) {
	for(auto &a: v) cin>>a;
}
template<class T, class U>
inline void init(vector<pair<T,U>>& v) {
	for(auto &a: v) cin>>a.first>>a.second;
}
template<class T, class N>
inline void init(T& v, N n) {
	v.resize(n);
	for(auto &a: v) cin>>a;
}
template<class T, class U, class N>
inline void init(vector<pair<T,U>>& v, N n) {
	v.resize(n);
	for(auto &a: v) cin>>a.first>>a.second;
}

template<class T>
inline void out(T a) {
	cout<<a<<endl;
}
template<class T, class... U>
inline void out(T a, U... alist) {
	cout<<a<<" ";
	out(forward<U>(alist)...);
}

template<class N>
void resiz(N n) {
	//empty
}
template<class N, class T, class... U>
void resiz(N n, T&& hd, U&&... tl) {
	hd.resize(n);
	resiz(n,forward<U>(tl)...);
}

ll binpow(ll a, ll ex, ll p) {
	ll result=1;
	while(ex>0) {
		if(ex&1) result=result*a%p;
		ex>>=1;
		a=a*a%p;
	}
	return result;
}


ll A,B,C;
string S;

void input() {
	cin>>S;
}

void solve() {
	if(S[S.len-1]=='s') cout<<S<<"es"<<endl;
	else cout<<S<<'s'<<endl;
}

int main() {
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout<<fixed<<setprecision(15);
	int t=1;
	while(t) {
		input();
		solve();
		t--;
	}
}


Measured memory_bytes: 3664
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define INF (1<<30)
#define INFLL (1ll<<60)
typedef pair<ll, int> P;
#define MOD (1000000007ll)
#define l_ength size

ll sq(ll x){
	return x*x;
}

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

bool isvowel(char c){
	int i;
	string v="aeiou";
	for(i = (v.size()-1); i>=0; --i){
		if(c == v[i]){
			return true;
		}
	}
	return false;
}

ll manhattan(ll x1, ll y1, ll x2, ll y2){
	return ((ll)(abs(x1-x2)+abs(y1-y2)));
}

ll digit(ll x){
	ll ans = 0ll;
	if(!x){
		return 0ll;
	}
	while(x>0){
		ans++;
		x /= 10;
	}
	return ans;
}

ll f(ll a, ll b){
	return max(digit(a),digit(b));
}

char ltou(char c){
	c -= 'a';
	c += 'A';
	return c;
}

int lcm(int a, int b){
	if(a<b){
		return lcm(b,a);
	}
	return ((a%b)?(lcm(b,a%b)):(b));
}

int main(void){
	int a,b,c;
	cin >> a >> b >> c;
	cout << ((c%lcm(a,b))?"NO":"YES") << endl;
	return 0;
}

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

int tot, lg[30], a[30], b[30];
vector<tuple<char, int, int, int>> ans;

int main() {
    auto plus = [&](int i, int j, int k) {
        ans.push_back(make_tuple('+', i, j, k));
    };
    auto less = [&](int i, int j, int k) {
        ans.push_back(make_tuple('<', i, j, k));
    };
    // a[2]: 0; a[3]: 1; a[lg[i]]: 2^i
    plus(0, 1, 3), less(2, 3, 3), tot = lg[0] = 3;
    for (int i = 1; i <= 29; i++) {
        plus(lg[i - 1], lg[i - 1], lg[i] = ++tot);
    }
    auto shift = [&](int i, int k) { // a[i]: a[i]*2^k
        while (k--) plus(i, i, i);
    };
    auto solve = [&](int *a, int pos) {
        plus(pos, 3, ++tot), pos = tot;
        int cur = ++tot;
        for (int i = 29; ~i; i--) {
            int tmp = ++tot;
            plus(cur, lg[i], tmp);
            less(tmp, pos, a[i] = ++tot);
            plus(a[i], 2, tmp = ++tot);
            shift(tmp, i);
            plus(cur, tmp, cur);
        }
    };
    solve(a, 0), solve(b, 1);
    for (int i = 0; i <= 29; i++) {
        for (int j = 0; j <= 29; j++) {
            int tmp = ++tot;
            plus(a[i], b[j], tmp);
            less(3, tmp, tmp);
            shift(tmp, i + j);
            plus(2, tmp, 2);
        }
    }
    printf("%d\n", ans.size());
    for (auto p : ans) {
        printf("%c %d %d %d\n", get<0>(p), get<1>(p), get<2>(p), get<3>(p));
    }
    return 0;
}

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

bool is_new_word(int n,string past_word[],string temp_word){
	for(int l=0;l<n;l++){
		if(temp_word==past_word[l]) return false;
	}
	
	return true;
}


int main()
{
	//変数 mデータセット n答えの個数 i,j,k繰り返し変数
	int m;
	cin>>m;
	for(int i=0;i<m;i++){
		int n=0;
		string word;
		string ch_word[10000]={};
		
		cin>>word;
		
		for(int j=0;j<word.length();j++){
			string right="",left="",re_right,re_left,temp[7];
			left=word.substr(0,j);
			right=word.substr(j);
			for(int k=0;k<right.length();k++)
				re_right += right[right.length()-1-k];
			for(int k=0;k<left.length();k++)
				re_left += left[left.length()-1-k];

			temp[0] = right   + left;
			temp[1] = re_left + right;
			temp[2] = right   + re_left;
			temp[3] = left    + re_right;
			temp[4] = re_right+ left;
			temp[5] = re_left + re_right;
			temp[6] = re_right+ re_left;
	/*---------------test----------------------------
			cout<<endl<<j<<"文字目"<<endl;
			cout<<"left="<<left<<" right="<<right<<endl;
			cout<<"re_left="<<re_left<<" re_right="<<re_right<<endl;
			cout<<"temp[0]="<<temp[0]<<endl;
			cout<<"temp[1]="<<temp[1]<<endl;
			cout<<"temp[2]="<<temp[2]<<endl;
			cout<<"temp[3]="<<temp[3]<<endl;
			cout<<"temp[4]="<<temp[4]<<endl;
			cout<<"temp[5]="<<temp[5]<<endl;
			cout<<"temp[6]="<<temp[6]<<endl;
	-------------------------------------------------*/			

			
			for(int j=0;j<7;j++){
				if(is_new_word(n,ch_word,temp[j])==true){
					ch_word[n]=temp[j];
					n++;
				}

			}
	/*---------------test------------------------------
			for(int j=0;j<n;j++)
				cout<<"ch_word["<<j<<"]="<<ch_word[j]<<endl;
	-------------------------------------------------*/
		}
		cout<<n<<endl;
	}
}

Measured memory_bytes: 1360
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        
        int[] digit = new int[n];
        Arrays.fill(digit, -1);
        
        for (int i = 0; i < m; i++) {
            int s = sc.nextInt() - 1;
            int c = sc.nextInt();
            
            if (digit[s] == -1) {
                digit[s] = c;
            } else if (digit[s] != c) {
                System.out.println(-1);
                return;
            }
        }
        
        if (n != 1 && digit[0] == -1) {
            digit[0] = 1;
        }
        
        if (n != 1 && digit[0] == 0) {
            System.out.println(-1);
            return;
        }
        
        for (int i = 0; i < n; i++) {
            if (digit[i] == -1) {
                digit[i] = 0;
            }
        }
        
        for (int i = 0; i < n; i++) {
            int num = digit[i];
            System.out.print(num);
        }
        System.out.println();
    }
}


Measured memory_bytes: 23764
from copy import deepcopy
from sys import exit,setrecursionlimit
import math
from collections import defaultdict,Counter,deque
from itertools import permutations, combinations,combinations_with_replacement,product
from fractions import Fraction as frac
import bisect
import heapq

import logging
logging.basicConfig(level=logging.DEBUG)

import sys
#input = sys.stdin.readline().rstrip

setrecursionlimit(1000000)

MOD = 10**9+7
INF = float('inf')

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

    if 0 < A and A < 10 and 0 < B and B < 10 :
        print (A*B)
    else:
        print(-1)
main()



Measured memory_bytes: 69356
#include <bits/stdc++.h>
using namespace std;
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
template<class T> inline T sqr(T x) {return x*x;}
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long ll;
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(v, n) sort(v, v+n)
#define VSORT(v) sort(v.begin(), v.end())
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define INF 999999999
const double EPS = 1e-10;
const double PI  = acos(-1.0);
#define CLR(a) memset((a), 0 ,sizeof(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

int main(){
    
    int N;
    cin >> N;
    int maxi=0;
    int res = 0;
    FOR(i,1,N+1){
        int temp = i;
        int cnt=0;
        while(1){
            if(temp%2==0){
                temp/=2;
                cnt++;
            }else break;
        }
        if(maxi < cnt){
            res = i;
            maxi = cnt;
        }
    }
    if(res==0)cout << 1 << endl;
    else cout << res<< endl;
    
    
    
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
using namespace std;

#define ll long long
#define pb push_back

ll func(ll num){
	if(num % 2 == 0)return num / 2;
	else return 3 * num + 1;
}
int main(){

	int N;
	vector<int> H;
	cin >> N;
	H.pb(0);
	for(int i = 0; i < N; i ++){
		int h;
		cin >> h;
		H.pb(h);
	}
	int ans = 0;
	for(int i = 1; i <= N; i ++){
		if(H[i - 1] < H[i])ans += H[i] - H[i - 1];
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
#define ll long long
#define ld long double
#define pb push_back
// #define mp make_pair
#define nt _int128 
#define fir first
#define sec second
#define fast_as_levi ios_base::sync_with_stdio(false) , cin.tie(NULL);
#define debug(x) cout<<x<<"\n";
#define debug cout<<"debugged\n";
#define inf 0x3f3f3f3f
 
const ll mod = 1e9 + 7;
const ll mx = 2e6 + 5;
const ll mxi = 2e3 + 5;

int main()
{
    fast_as_levi;
    ll i,j,n,m;
    cin>>n>>m;
    ll wt[n],cs[n];
    for(i=0;i<n;i++)
    {
        cin>>wt[i]>>cs[i];
    }
    ll dp[n+1][m+1];
    for(i=0;i<=n;i++)
    {
        for(j=0;j<=m;j++)
        {
            if(i==0||j==0)
            {
                dp[i][j] = 0;
            }
            else
            {
                if(j-wt[i-1]>=0)
                dp[i][j] = max(dp[i-1][j] , cs[i-1] + dp[i-1][j-wt[i-1]]);
                else
                dp[i][j] = dp[i-1][j];
            }
        }
    }
    // for(i=0;i<=n;i++)
    // {
    //     for(j=0;j<=m;j++)
    //     {
    //         cout<<dp[i][j]<<" ";
    //     }
    //     cout<<"\n";
    // }
    cout<<dp[n][m];
}

Measured memory_bytes: 79232
#include <cstdio>
#include <cctype>
#include <utility>
#include <vector>
#include <algorithm>
using namespace std;

const auto gcu = getchar_unlocked;
const auto pcu = putchar_unlocked;
#define _DEF(r, n, ...) inline r n(__VA_ARGS__) noexcept
#define _T template <typename T>
#define _HT template <typename H,typename... T>
_T _DEF(T,in,int c){T n=0;int m=1;while(isspace(c)){c=gcu();}if(c=='-')m=-1,c=gcu();
	do{n=10*n+(c-'0'),c=gcu();}while(c>='0'&&c<='9');return m*n;}
_DEF(int, in){return in<int>(gcu());}
#define _SCAN(...) _DEF(bool,scan,__VA_ARGS__)
_T _SCAN(T &n){int c=gcu();return c==EOF?false:(n=in<T>(c),true);}
_DEF(bool, scan, char &c){c=gcu();gcu();return c!=EOF;}
#ifdef _GLIBCXX_STRING
_SCAN(string &s){int c;s="";
	for(;;){c=gcu();if(c=='\n'||c==' ')return true;else if(c==EOF)return false;s+=c;}}
#endif
_HT _SCAN(H &h,T&&... t){return scan(h)&&scan(t...);}
#define _OUT(...) _DEF(void,out,__VA_ARGS__)
#define _OUTL(...) _DEF(void,outl,__VA_ARGS__)
_OUT(bool b){pcu('0'+b);}
_OUT(const char *s){while(*s)pcu(*s++);}
_OUT(char c){pcu(c);}
#ifdef _GLIBCXX_STRING
_OUT(string s){for(char c:s)pcu(c);}
#endif
_T _OUT(T n){static char b[20];char *p=b,m=n<0?pcu('-'),-1:1;
	if(!n)*p++='0';else while(n)*p++=n%10*m+'0',n/=10;while(p!=b)pcu(*--p);}
_OUTL(){out('\n');}
#ifdef _GLIBCXX_VECTOR
_T _OUT(vector<T> &v){for(T &x:v)out(&x == &v[0]?"":" "),out(x);outl();}
#endif
_HT _OUT(H&& h, T&&... t){out(h);out(move(t)...);}
template <typename... T> _OUTL(T&&... t){out(move(t)...);outl();}

int main() {
	outl(in() * 32);
}


Measured memory_bytes: 2460
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
int main(void){
    int n,l[105];
    int yes=0;
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%d",&l[i]);
    }
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            for(int k=0;k<n;k++){
                if(i>=j){continue;}
                else if(j>=k){continue;}

                if(l[i]==l[j]||l[j]==l[k]||l[i]==l[k]){continue;}

                if(l[i]+l[j]>l[k]&&l[k]+l[j]>l[i]&&l[i]+l[k]>l[j]){yes++;}

            }
        }
    }
    printf("%d\n",yes);
}


Measured memory_bytes: 1732
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
#define pb push_back
#define rsz resize
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
using pi = pair<int,int>;
#define f first
#define s second
#define mp make_pair
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
void setIO(string name = "b") {
    ios_base::sync_with_stdio(0); cin.tie(0);
    freopen((name+".in").c_str(), "r", stdin);
    freopen((name+".out").c_str(), "w", stdout);
}

int main() {
    //setIO();
    string str; cin >> str;
    int a[26] = { 0 };
    for (char c : str) {
        a[c - 'a']++;
    }
    bool ok = 1;
    for (int i : a) {
        if (i % 2 != 0) {
            ok = 0;
        }
    }
    if (ok) {
        cout << "Yes" << '\n';
    } else {
        cout << "No" << '\n';
    }
}

Measured memory_bytes: 3580
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb emplace_back
typedef long long ll;
typedef pair<int,int> pint;

ll dp[100001][4];
const int mod=1000000007;
int main(){
    string s;
    cin>>s;
    int n=s.size();
    dp[0][0]=1;
    rep(i,n){
        rep(j,3){
            if(j==s[i]-'A'||s[i]=='?'){
                dp[i+1][j+1]+=dp[i][j];
                dp[i+1][j+1]%=mod;
            }
            if(s[i]=='?')dp[i+1][j]+=dp[i][j]*3;
            else  dp[i+1][j]+=dp[i][j];
            dp[i+1][j]%=mod;
        }
        if(s[i]=='?')dp[i+1][3]+=dp[i][3]*3;
        else  dp[i+1][3]+=dp[i][3];
        dp[i+1][3]%=mod;
    }
    cout<<dp[n][3]<<endl;
    return 0;
}


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

using namespace std;

#define int long long

main() {
#ifdef HOME
    freopen("input.txt", "r", stdin);
#endif // HOME
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n, k, ans = 0;
    cin >> n >> k;
    if (k == 0) {
        cout << n * n << '\n';
        exit(0);
    }
    for (int b = k + 1; b <= n; ++b) {
        ans += (b - k) * (n / b);
        ans += max(0ll, n % b - k + 1);
    }
    cout << ans << '\n';
    return 0;
}



Measured memory_bytes: 3604
S = input()
N = len(S)
f = True
for i in range(N):
  if i%2 == 1:
    if S[i] == "L" or S[i] == "U" or S[i] == "D":
      pass
    else:
      f = False
  else:
    if S[i] == "R" or S[i] == "U" or S[i] == "D":
      pass
    else:
      f = False
    
if f:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 3060
#include "bits/stdc++.h"

using namespace std;

using ll = long long;
using ld = long double;

const double PI = 3.1415926535897932384626433832795;

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

int gcd(int x, int y) { return y ? gcd(y, x % y) : x; }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
int lcm(int x, int y) { return x / gcd(x, y) * y; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }

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

	int a, b;
	cin >> a >> b;

	for (int i = 1; i <= 3; i++) {
		int v = a * b * i;
		if (v & 1) {
			cout << "Yes" << endl;
			return 0;
		}
	}

	cout << "No" << endl;
	return 0;
}


Measured memory_bytes: 256
// D - Road to Millionaire
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);++i)

int main(){
	int N; cin>>N;
	int64_t yen = 1000, stock = 0;
	int nxt; cin>>nxt;
	rep(i, N-1){
		int now = nxt; cin>>nxt;
		if(now < nxt){
			stock += yen / now;
			yen -= yen / now * now;
		}
		else{
			yen += stock * now;
			stock = 0;
		}
	}
	cout<< yen + stock * nxt <<endl;
}


Measured memory_bytes: 3620
#include <iostream>
#include <string>
#include <math.h>
#include <vector>
#include<stdio.h>
#include <functional>
#include<algorithm>
#define PI 3.14159265
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n)  FOR(i,0,n)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
#define SZ(x) ((int)(x).size())

using namespace std;



int main() {
	int n;
	cin >> n;
	if (n < 1000) {
		cout << "ABC" << endl;
	}
	else {
		cout << "ABD" << endl;
	}
	return 0;
}

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

i=1
cnt=0
while i<n:
    if (x[i]-x[i-1])*a>b:
        cnt+=b
    else:
        cnt+=(x[i]-x[i-1])*a
    i+=1

print(cnt)

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

using namespace std;

#define ll long long
#define fix cout << fixed; cout << setprecision(10)





void solve() {

	int a, b;
	cin >> a >> b;
	if(a >= b) {
		for(int i = 0; i < a; i++) {
			cout << b;
		}
	}
	else {
		for(int i = 0; i < b; i++) {
			cout << a;
		}
	}
	




	
}

int main() {

	ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	
	solve();

	return 0;
}

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

int main() {
	ll n;
	cin >> n;
	vector<ll> a(n), b(n);
	for (ll i = 0; i < n; ++i)cin >> a[i] >> b[i];
	sort(a.begin(), a.end());
	sort(b.begin(), b.end());
	if (n % 2) {
		cout << b[n / 2] - a[n / 2] + 1 << endl;
	}
	else {
		ll Max = b[n / 2] + b[n / 2 - 1];
		ll Min = a[n / 2] + a[n / 2 - 1];
		cout << Max - Min + 1 << endl;
	}
}


Measured memory_bytes: 6424
#include <iostream>
#include <bitset>
#include <fstream>
#include <string>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <functional>
#include <cctype>
#include <list>
#include <limits>
//#include <boost/multiprecision/cpp_int.hpp>

const double EPS = (1e-10);


using namespace std;
using Int = long long;
//using namespace boost::multiprecision;

const Int MOD = 1000000007;

Int mod_pow(Int x, Int n){
    Int res = 1;
    for(int i = 0;i < 60; i++){
        if(n >> i & 1) res = res * x % MOD;
        x = x * x % MOD;
    }
    return res;
}


int main(){
    cin.tie(0);
    
    int N, M, X, Y;
    cin >> N >> M >> X >> Y;
    int ma = X;
    int mi = Y;
    for (int i = 0; i < N; i++){
        int x;
        cin >> x;
        ma = max(ma, x);
    }
    for (int i = 0; i < M; i++){
        int y;
        cin >> y;
        mi = min(mi, y);
    }
    if (ma < mi) cout << "No War";
    else cout << "War";
    cout << endl;
} 


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define ll long long
#define _GLIBCXX_DEBUG
const ll MOD = 1000000007;
const ll Mod = 998244353;
const int MAX = 510000;
const double PI = 3.14159265358979;
const vector<int> dx = {1, 0};
const vector<int> dy = {0, 1};

int main() {
  string S;
  cin >> S;
  cout << S[0] << S[1] << S[2] << endl;
  return 0;
}

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

using namespace std;

int main()
{
    int N, M;
    cin >> N >> M;
    vector<pair<int, int>> v;
    for (int i = 0; i < M; i++) {
        int x, y;
        cin >> x >> y; y--;
        v.emplace_back(x, y);
    }

    sort(v.begin(), v.end());    
    
    vector<int> cnt(N, 1);
    vector<vector<int>> prev(N, vector<int>(2));

    for (int i = 0; i < M; i++) {
        int p = v[i].second;
        int c1 = cnt[p], c2 = cnt[p + 1];
        
        cnt[p]     += c2 - prev[p][0];
        cnt[p + 1] += c1 - prev[p][1];

        prev[p][0] = cnt[p];
        prev[p][1] = cnt[p + 1];
    }

    for (int i = 0; i < N; i++) {
        if (i > 0) cout << " ";
        cout << cnt[i];
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 15532
N, Y = map(int, input().split())
ans1 = ["-1", "-1", "-1"]
for i in range(0, N+1):
    for j in range(0, N+1):
        if N-j>=0 and N-i-j >= 0:
            if Y == 10000*i+5000*j+1000*(N-i-j):
                ans1 = [str(i), str(j), str(N-i-j)]
print(" ".join(ans1))

Measured memory_bytes: 3060