akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
	ll int n,d,ans,a,b,i;
	cin>>n>>d;
	ans=0;
	for(i=0;i<n;i++)
	{
		cin>>a>>b;
		if(sqrt(a*a+b*b)<=d)
		ans++;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3676
#include <bits/stdc++.h>
#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 pb(a) push_back(a)
using namespace std;
typedef long long ll;

int main()
{
    string S, T;
    cin >> S >> T;

    bool flag = true;
    map<char, char> ms, mt;
    REP(i, S.size())
    {
        if (ms.count(S.at(i)) > 0 && ms[S.at(i)] != T.at(i))
            flag = false;
        if (mt.count(T.at(i)) > 0 && mt[T.at(i)] != S.at(i))
            flag = false;
        ms[S.at(i)] = T.at(i);
        mt[T.at(i)] = S.at(i);
    }

    if (flag)
        cout << "Yes";
    else
        cout << "No";
}

Measured memory_bytes: 776
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
int main() {
    int N;
    cin>>N;
    vector<int>D(N+1,0);
    for (int i = 1; i <= N; ++i) {
        cin>>D[i];
    }
    vector<int>answer(N+1,0);
    
    if(D[1]!=0){
        cout<<0<<endl;
        return 0;
    }
    answer[0]=1;
    long long ans=1;
    sort(D.begin(),D.end());
    for (int k = 2; k <= N; ++k) {
        ans *= answer[D[k]-1];
        ans = ans%998244353;
        answer[D[k]]++;
    }

    cout<<ans<<endl;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
void getmax(int &x,int y){x=max(x,y);}
void getmin(int &x,int y){x=min(x,y);}
int n,q,l,r;
int b[200100],dat[524288],mx=262144,dp[200100];
int w[200100],pre[200100];
vector<int> opr[200100];
void update(int l,int r,int delta){
	l+=mx;r+=mx;
	while(l<=r){
		getmin(dat[l],delta);
		getmin(dat[r],delta);
		l=(l+1)>>1;
		r=(r-1)>>1;
	}
}
int get(int p){
	p+=mx;
	int ret=1e9;
	while(p){
		getmin(ret,dat[p]);
		p>>=1;
	}
	return ret;
}
int main(){
	#ifdef FILIN
		#ifndef LOCAL
			freopen(FILIN,"r",stdin);
			freopen(FILOUT,"w",stdout);
		#endif
	#endif
	ios::sync_with_stdio(0);
	cin.tie(NULL);
	cout.tie(NULL);
	for(int i=1;i<mx*2;i++)
		dat[i]=1e9;
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>w[i];
		pre[i]=pre[i-1]+(1-w[i]);
	}
	cin>>q;
	for(int i=1;i<=q;i++){
		cin>>l>>r;
		opr[r].push_back(l); 
	}
	for(int i=1;i<=n;i++){
		update(i-1,i-1,dp[i-1]-pre[i-1]);
		dp[i]=dp[i-1]+w[i];
		for(int j:opr[i]){
			update(j,i,get(j-1));
		}
		getmin(dp[i],get(i)+pre[i]);
	}
	cout<<dp[n]<<endl;
	return 0;
}


Measured memory_bytes: 14208
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1e18;
const int inf = 1e9;
#define rep(i, n) for (int i = 0; i < n; i++)
using Graph = vector<vector<int>>;
using pint = pair<int, int>;
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
int dxx[8] = {1, 1, 1, 0, 0, -1, -1, -1}, dyy[8] = {-1, 0, 1, -1, 1, -1, 0, 1};

int main() {
    int n, x;
    cin >> n >> x;
    ll a[n], b[n], sum1 = 0, sum2 = 0;
    rep (i, n) cin >> a[i];
    rep (i, n) b[i] = a[i];
    //貪欲法
    if (a[0] > x) {
        sum1 += a[0] - x;
        a[0] = x;
    }
    rep (i, n - 1) {
        if (a[i] + a[i + 1] > x) {
            sum1 += a[i + 1] + a[i] - x;
            a[i + 1] = x - a[i];
        }
    }
    if (b[n - 1] > x) {
        sum2 += b[n - 1] - x;
        b[n - 1] = x;
    }
    for (int i = n - 1; i > 0; i--) {
        if (b[i] + b[i - 1] > x) {
            sum2 += b[i] + b[i - 1] - x;
            b[i - 1] = x - b[i];
        }
    }
    ll ans = min (sum1, sum2);

    cout << ans << "\n";
}

Measured memory_bytes: 1792
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <sstream>
#include <functional>
#include <map>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <set>
#include <list>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const ll INF = 1LL<<29;
const ll mod = 1e9+7;
#define rep(i,n) for(int (i)=0;(i)<(ll)(n);++(i))
#define repd(i,n,d) for(ll (i)=0;(i)<(ll)(n);(i)+=(d))
#define all(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset((m),(v),sizeof(m))
#define chmin(x,y) (x=min(x,y))
#define chmax(x,y) (x=max(x,y))
#define fst first
#define snd second
#define UNIQUE(x) (x).erase(unique(all(x)),(x).end())
template<class T> ostream &operator<<(ostream &os, const vector<T> &v){int n=v.size();rep(i,n)os<<v[i]<<(i==n-1?"":" ");return os;}

int main(){
	ll n;
	cin>>n;
	vector<ll> a(n); rep(i, n) cin>>a[i];
	sort(all(a)); UNIQUE(a);
	cout<<a.size()<<endl;
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

/**
 * Created by akensho on 2015/11/23.
 */
public class Main {
    static int n, q;
    static int[] S, T;
    static Scanner sc = new Scanner(System.in);
    public static void main(String[] args){
        while (read()){
            System.out.println(solve());
        }
    }

    static boolean read(){
        if( !sc.hasNext() ) return false;
        n = sc.nextInt();
        S = new int[n];
        for (int i = 0; i < S.length; i++){
            S[i] = sc.nextInt();
        }
        q = sc.nextInt();
        T = new int[q];
        for (int i = 0; i < T.length; i++){
            T[i] = sc.nextInt();
        }
        return true;
    }

    static int solve(){
        int res = 0;
        for (int key : T){
            if( binarySearch(S, key) ) res++;
        }
        return res;
    }
    /**
     * ??????targets???????´???¨?????????key????????¨????????????2?????¢?´¢??§??°??????????????????
     * @param targets := ??¢?´¢??????????±???¨????????????
     * @param key := ??¢?????????????´?
     * @return res
     */
    static boolean binarySearch(int[] targets, int key){
        int left = 0, right = targets.length;
        while ( left < right ){
            int middle = (left+right)/2;
            if( targets[middle] == key ) {
                return true;
            }
            if( targets[middle] < key ){
                left = middle+1;
            }else {
                right = middle;
            }
        }
        return false;
    }
}

Measured memory_bytes: 68264
#include<bits/stdc++.h>
using namespace std;
int main()
{
	cin.tie(0); 	
	cout.tie(0); 
	ios::sync_with_stdio(false);
	int a,b,c,d,min,max;
	cin >> a >> b >> c >> d;
 	if(b <= c || d <= a)
 	{
 		cout << 0;
	} 
	else 
	{
		min = a > c ? a : c;
		max = b > d ? d : b;
		cout << max - min; 
	}	
	return 0;		
}

Measured memory_bytes: 256
//Resting_Prince
#include<bits/stdc++.h>
#define mod 1000000007
#define inf 1e18
#define PI 3.141592653589
#define fi first
#define se second 
#define sv(v) sort(all(v));reverse(all(v))
#define all(v) v.begin(),v.end()
#define rep(i,a,b) for(ll i=a;i<=b;i++)
#define repr(i,a,b) for(ll i=a;i>=b;i--)
#define pb push_back
#define mk make_pair
#define en '\n'
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef long double ld;

int main()
{
    ll n,i,j,k,l,m,o;
    string s,t;
    cin>>s>>t;
    n=s.size();
    m=t.size();
    ll dp[3002][3002]={0};
    rep(i,1,n)
    {
        rep(j,1,m)
        {
            if(i==0 || j==0)continue;
            if(s[i-1]==t[j-1]) dp[i][j]=max(dp[i][j],dp[i-1][j-1]+1);
            dp[i][j]=max(dp[i][j],max(dp[i][j-1],dp[i-1][j]));
        }
    }

    string ans="";
    while(m>0 && n>0)
    {
        if(dp[n][m]==dp[n-1][m])n--;
        else if(dp[n][m]==dp[n][m-1])m--;
        else
        {
            ans=s[n-1]+ans;
            m--;n--;
        }
    }cout<<ans;
    return 0;
}


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

using namespace std;

int main()
{
    int n,k;
    cin>>n>>k;
    vector<int>theval;
    for(int i=0;i<n;i++){
        int a;
        cin>>a;
        theval.push_back(a);
    }
    vector<int>dp(n+1,1000000000);
    dp[0]=0;
    for(int i=1;i<n;i++){
        for(int j=1;j<=k;j++){
            if(i-j<0){break;}
            //cout<<dp[i-j]<<" "<<
            dp[i]=min(dp[i],dp[i-j]+abs(theval[i]-theval[i-j]));
        }
        //cout<<dp[i]<<" ";
        
    }
    cout<<dp[n-1]<<endl;
}

Measured memory_bytes: 1272
#include <stdio.h>
int main(void){
   
   int n,x,i;
   int sum=0;
   int count=0;
   int a[100];
   
   scanf("%d %d",&n,&x);
   
   for(i=0;i<n+1;i++){
       scanf("%d",&a[i]);
   }
   
   for(i=0;i<n+1;i++){
       if(sum<=x){
           count++;
       }
           sum+=a[i];
   }
   printf("%d",count);
   return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <queue>
#include <vector>
#include <utility>
#define EPS 1e-10
using namespace std;
typedef long long ll;
struct Point{
	double x,y;
	Point(double x = 0.0,double y = 0.0): x(x),y(y) {}
	Point operator + (Point p){
		return Point(x + p.x,y + p.y);
	}
	Point operator - (Point p){
		return Point(x - p.x,y - p.y);
	}
	Point operator * (double lambda){
		return Point(x * lambda,y * lambda);
	}
	Point operator / (double lambda){
		return Point(x / lambda,y / lambda);
	}
	double norm(){
		return x * x + y * y;
	}
	double abs_(){
		return sqrt(norm());
	}
	bool operator == (const Point &p)const
	{
		return abs(x - p.x) < EPS && abs(y - p.y) < EPS;
	}
	bool operator < (const Point &p)const
	{
		if(abs(x - p.x) < EPS) return y - p.y < -EPS;
		else return x - p.x < EPS;
	}
};
typedef Point Vector;
struct Segment{
	Point p1,p2;
	Segment(Point p1 = Point(),Point p2 = Point()): p1(p1),p2(p2) {}
};
typedef Segment Line;
struct Circle{
	Point c;
	double r;
	Circle(Point c = Point(),double r = 0.0): c(c),r(r) {}
};
typedef vector<Point> Polygon;
double dot(Vector a,Vector b){
	return a.x * b.x + a.y * b.y;
}
double det(Vector a,Vector b){
	return a.x * b.y - b.x * a.y;
}
bool IsConvex(Polygon p){
	int n = p.size();
	for(int i=0;i<n;i++){
		Point p1 = p[(i - 1 + n) % n],p2 = p[(i + 1) % n];
		if(det(p2 - p[i],p1 - p[i]) < -EPS) return false;
	}
	return true;
}
Polygon p;
int n;
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		Point p1;
		scanf("%lf%lf",&p1.x,&p1.y);
		p.push_back(p1);
	}
	printf("%d\n",(int)IsConvex(p));
	return 0;
}



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

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

using namespace std;
using LL = long long;
using ldouble = long double;
using P = pair<int, int>;
using LP = pair<LL, LL>;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1e9 + 7;
static const int SIZE = 200005;

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

vector<LL> Div(LL n) {
    vector<LL> ret;
    for(LL i = 1; i * i <= n; ++i) {
        if(n % i == 0) {
            ret.pb(i);
            if(i * i != n) ret.pb(n / i);
        }
    }
    sort(all(ret));
    return ret;
}

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

    string s;
    cin >> s;
    if(s == "Sunny") cout << "Cloudy";
    else if(s == "Cloudy") cout << "Rainy";
    else cout << "Sunny";
    cout << endl;

    return 0;
}


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

#define ALL(v) v.begin(), v.end()
#define V vector
#define P pair
typedef long double ld;
typedef long long ll;
const int MOD =  1000000007;
const int IINF = INT_MAX;
const ll INF = 1LL << 60;


int main() {
    ll n, k; cin >> n >> k;

    cout << min(n % k, abs((n % k) - k)) << endl;
    return 0;
}


Measured memory_bytes: 3600
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    long long ans=0;
    cin>>n;
    for(int i=1;i<=n;i++)
        if( i%15!=0 && i%5!=0 && i%3!=0)
        ans+=i;
    cout<<ans<<endl;
}



Measured memory_bytes: 3632
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		scan.close();
		int cnt = 0;
		if(N < 104) {
			System.out.println(0);
		}else {
			for(int i = 105; i <= N; i+=2) {
				int cnt1 = 0;
				for(int j = 1; j <= i; j+=2) {
					if(i % j == 0) {
						cnt1 ++;
					}
				}
				//System.out.println(cnt1);
				if(cnt1 == 8) {
					cnt ++;
				}
			}
			System.out.println(cnt);
		}
	}
}

Measured memory_bytes: 23124
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;

#define MAXN 50000

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

	int n, i, j, k, ans;
	cin >> n;
	vector<int> a(n), b(n);
	for (i = 0; i < n - 1; i++) cin >> b[i];
	a[0] = b[0]; a[n - 1] = b[n - 2];
	for (i = 1; i < n - 1; i++) a[i] = min(b[i], b[i - 1]);
	ans = 0;
	for (i = 0; i < n; i++) ans += a[i];
	cout << ans << "\n";

	return 0;
}


Measured memory_bytes: 888
#include <bits/stdc++.h>
 
#define ull unsigned long long int
#define ll long long int
#define vll vector<ll>
#define pll pair<long long, long long>
#define vpll vector < pair<long long,long long> >
#define itr vll::iterator
#define all(c) c.begin(),c.end()
#define pb push_back
#define f first
#define s second
#define mod 1000000007
#define inf 1000000000000000001
 
#define rep(i, n)      for(ll i = 0; i <  n; ++i)
#define repA(i, a, n)  for(ll i = a; i <= n; ++i)
#define repD(i, a, n)  for(ll i = a; i >= n; --i)
 
using namespace std;
 
bool func(const pll &a, const pll &b){
    return a.s < b.s;
}
 
ll power(ll x, ll y) 
{ 
    if (y == 0) 
        return 1; 
    else if (y % 2 == 0) 
        return ((power(x, y / 2)%mod) * (power(x, y / 2)%mod)%mod); 
    else
        return (x * ((power(x, y / 2)%mod) * (power(x, y / 2)%mod)%mod))%mod; 
}
 
ll modInverse(ll a, ll m){
    ll m0 = m;
    ll y = 0, x = 1;
    if (m == 1) return 0;
    while (a > 1){
        ll q = a / m;
        ll t = m;
        m = a % m, a = t;
        t = y;
        y = x - q * y;
        x = t;
    }
    if (x < 0) x += m0;
    return x;
}
vll fact(100010);
ll nCr(ll n, ll r){
    if(r > n) return 0;
    else return (((fact[n]*modInverse(fact[r], mod))%mod)*modInverse(fact[n-r], mod))%mod;
}

void solve(int t){
    ll n, k;
    cin >> n >> k;
    vll v(n);
    rep(i, n) cin >> v[i];
    fact[0] = 1;
    repA(i, 1, 100005){
        fact[i] = fact[i-1]*i;
        fact[i] %= mod;
    }
    ll res = 0;
    sort(all(v));
    rep(i, n){
        res += v[i]*nCr(i, k-1);
        res %= mod;
        res -= v[i]*nCr(n-i-1, k-1);
        res %= mod;
    }
    cout << res;
}
 
int main(){
 
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

    int t, tmp = 0;
    // cin >> t;
    t = 1;
    while(tmp++ < t){
        // cout << "Case #" << tmp << ": ";
        solve(tmp-1);
        if(t-tmp) cout << "\n";
    }
    return 0;
}

Measured memory_bytes: 1792
#include<iostream>
#include<iomanip>
#include<algorithm>
using namespace std;
double dp[100][100],g[100][100];
int main(){
  int n, m;
  while(cin >> n >> m , n){
    for(int i = 0 ; i < n ; i ++ ){
      for(int j = 0 ; j < n ; j++ ){
        cin >> g[i][j];
      }
    }
    fill_n( dp[0], n, 1.0);
    for(int i = 1 ; i < m ; i++ ) for(int j = 0 ; j < n ; j++ ) dp[i][j] = 0;
    for(int i = 1 ; i < m ; i++ ){ //回数
      for(int prev = 0 ; prev < n ; prev++ ){ // prev
        for(int now = 0 ; now < n ; now++ ){ // now
          dp[i][now] = max( dp[i][now], dp[i - 1][prev] * g[prev][now]);
        }
      }
    }
    cout << fixed << setprecision(2) << *max_element( dp[m - 1], dp[m - 1] + n ) << endl;
  }
}

Measured memory_bytes: 1444
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG 
#define rep(i, n) for (int i = 0; i < n; i++)
#define reps(i, s, n) for (int i = s; i < n; i++)
#define all(v) v.begin(), v.end() // sort(all(array))
#define INF 1000000000
#define LINF 1LL << 60
#define mod 1000000007
#define EPS 0.0001
using namespace std;
using ll = long long;
using vi = vector<int>; //vi array(要素数, 初期値)
using vll = vector<ll>; 
using pll = pair<ll, ll>;
using pii = pair<int, int>;
using vc = vector<char>;
using vs = vector<string>;
using vb = vector<bool>;
using vvi = vector<vi>; //vvi table(行数, vi(列数, 初期値))
using vvc = vector<vc>;
using vvs = vector<vs>;
using vvb = vector<vb>;

int main() {
    int n; cin >> n;
    int cnt = 0;
    for (int a = 1; a < n; a++) {
        if (n % a == 0) {
            cnt += (n / a) - 1;       
        } else {
            cnt += n / a;
        }
    }
    cout << cnt << endl;
}

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

#define MAX 2000000

void MaxHeap(int*,int);
int Insert(int*,int);
int Extract(int*);

int h=0;

int main(void){
  int S[MAX],key=0;
  char states[8];

  while(1){
    scanf("%s", states);

    if(!strcmp(states, "end")) break;
    else if(!strcmp(states, "insert")){
      scanf("%d", &key);
      Insert(S, key);
    } else if(!strcmp(states, "extract")){
      Extract(S);
    }

  }

  return 0;
}

int Insert(int *S, int key){
  int i, tmp;

  h++; i = h;
  S[i] = key;

  while(i > 1 && S[i/2] < S[i]){
    tmp = S[i];
    S[i] = S[i/2];
    S[i/2] = tmp;
    i = i/2;
  }

  return;
}

int Extract(int *S){
  int max;

  max = S[1]; S[1] = S[h];
  h--;

  MaxHeap(S, 1);
  printf("%d\n", max);

  return;
}

void MaxHeap(int *S, int i){
  int left, right, large, tmp;

  if(i*2 <= h) left = i*2;
  else left = i;

  if(i*2+1 <= h) right = i*2+1;
  else right = i;

  if(left < h+1 && S[left] && S[left] > S[i]) large = left;
  else large = i;

  if(right < h+1 && S[right] > S[large]) large = right;

  if(large != i){
    tmp = S[i];
    S[i] = S[large];
    S[large] = tmp;
    MaxHeap(S, large);
  }

    return;
}

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

int main() {
    string s;
    cin >> s;
    if(s == "SUN") cout << 7 << endl;
    if(s == "MON") cout << 6 << endl;
    if(s == "TUE") cout << 5 << endl;
    if(s == "WED") cout << 4 << endl;
    if(s == "THU") cout << 3 << endl;
    if(s == "FRI") cout << 2 << endl;
    if(s == "SAT") cout << 1 << endl;

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
 
void dfs(int x, int y, int ans);
 
int ice[100][100];
int judge[100][100];
 
int m;
int n;
     
int a = 0;
int b = 0;
 
int main(void)
{
 
start:
 
    scanf("%d",&n);
    scanf("%d",&m);
 
if(n == 0 && m == 0)
return 0;
 
    int i = 0;
    int j = 0;
    a = 0;
    for(i = 0; i < 100; i++){
        for(j = 0; j < 100; j++){
            judge[i][j] = 0;
            ice[i][j] = 0;
        }
    }
    for(i = 0; i < m; i++)
    {
        for(j = 0; j < n; j++)
        {
            scanf("%d", &ice[i][j]);
        }
    }
     
    for( j = 0; j < n; j++)
    {
        for( i = 0; i < m; i++)
        {
            dfs(i, j, 1);
        }
    }
     
     
    printf("%d\n",a);
         
         
    goto start; 
    return 0;
}
 
 
 
void dfs(int x, int y, int ans)
{
    if(!(x<m && y<n && x>=0 && y>=0 && ice[x][y] == 1 && judge[x][y] == 0)){
        return;
    }
    if(ans>a)
    {
        a = ans;    
    }
    judge[x][y] = 1;
    dfs(x+1, y, ans+1);
    dfs(x-1, y, ans+1);
    dfs(x, y+1, ans+1);
    dfs(x, y-1, ans+1);
    judge[x][y] = 0;
    return;         
}

Measured memory_bytes: 0
from typing import List


def answer(n: int, l: int, s: List[str]) -> str:
    return ''.join(sorted(s))


def main():
    n, l = map(int, input().split())
    s = [input() for _ in range(n)]
    print(answer(n, l, s))


if __name__ == '__main__':
    main()

Measured memory_bytes: 10292
import sys
s = input()
if s[0] == s[1]:
    print(1, 2)
    sys.exit()

lans = -1
rans = -1
for i in range(2, len(s)):
    if s[i] == s[i-1] or s[i] == s[i-2]:
        lans = i-1
        rans = i+1
        break

print(lans, rans)


Measured memory_bytes: 3188
#include <iostream>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <cstring>
#include <map>
#include <algorithm>
#include <math.h>
#include <iostream>     // std::cout, std::fixed
#include <iomanip>
#include<queue>
#include <cmath>
#include <queue>
#include <set>
#include <iostream>


using namespace std;
typedef long long ll;


int main () {
    ios_base::sync_with_stdio(false);
    map<int, int> have;
    map<int, int> need;
    int n;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        int x;
        cin>>x;
        have[x]++;
    }
    int m;
    cin>>m;
    for(int i=0;i<m;i++)
    {
        int x;
        cin>>x;
        need[x]++;
    }
    for(auto p : need)
    {
        if(have[p.first]<p.second)
        {
            cout<<"NO";
            return 0;
        }
    }
    cout<<"YES";
    return 0;
}


Measured memory_bytes: 19072
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
int N;
int A[501][501];
bool yoko[501];
int aki[501];
int main(){
        cin>>N;
        REP(i,N){
            yoko[i]=false;
            aki[i]=N;
        }
        bool all_one=true;
        bool all_zero=true;
        REP(i,N){
            string s;
            cin>>s;
            REP(j,N){
                if(s[j]=='.'){
                   A[i][j]=0;
                   all_one=false;
                }else{
                   A[i][j]=1;
                   all_zero=false;
                }
            }
        }
        if(all_one){
           cout<<0<<endl;
           return 0;
        }
        if(all_zero){
           cout<<-1<<endl;
           return 0;
        }
        REP(i,N){
            REP(j,N){
                if(A[i][j]==1){
                   yoko[j]=true;
                   aki[i]--;
                }
            }
        }
        int kansei=0;
        REP(j,N){
            REP(i,N){
                if(A[i][j]==0)break;
                if(i==N-1)kansei++;
            }
        }
        int ans=1000000;
        REP(i,N){
            int temp=aki[i];
            if(yoko[i]==false)temp++;
            temp+=(N-kansei);
            ans=min(ans,temp);
        }
        cout<<ans<<endl;
	return(0);
}

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

#define rep(i,n) for (int i = 0; i < (n); ++i)
typedef pair<int,int> P;

int main() {
    int N,T,r=-1;
    cin >> N >> T;
    vector<P> ct(N);

    rep(i,N)
        cin >> ct.at(i).first >> ct.at(i).second;
    sort(ct.begin(), ct.end());

    rep(i,N) {
        if(r==-1 && ct.at(i).second <= T)
            r = ct.at(i).first;
        else if(r!=-1)
            break;
    }

    if(r != -1)
        cout << r;
    else
        cout << "TLE";
    cout << endl;
}

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

using namespace std;
typedef pair<double, int> P;

void solve()
{
	vector<P> second;
	vector<P> a(8);
	vector<P> b(8);
	vector<P> c(8);
	for(int i = 0; i < 8; ++i)
	{
		cin >> a[i].second >> a[i].first;
	}
	for(int i = 0; i < 8; ++i)
	{
		cin >> b[i].second >> b[i].first;
	}
	for(int i = 0; i < 8; ++i)
	{
		cin >> c[i].second >> c[i].first;
	}
	sort(a.begin(), a.end());
	sort(b.begin(), b.end());
	sort(c.begin(), c.end());
	second.push_back(a[2]);
	second.push_back(a[3]);
	second.push_back(b[2]);
	second.push_back(b[3]);
	second.push_back(c[2]);
	second.push_back(c[3]);
	sort(second.begin(), second.end());
	cout << a[0].second << " " << a[0].first << endl;
	cout << a[1].second << " " << a[1].first << endl;
	cout << b[0].second << " " << b[0].first << endl;
	cout << b[1].second << " " << b[1].first << endl;
	cout << c[0].second << " " << c[0].first << endl;
	cout << c[1].second << " " << c[1].first << endl;
	cout << second[0].second << " " << second[0].first << endl;
	cout << second[1].second << " " << second[1].first << endl;
}

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

Measured memory_bytes: 1304
/**
 *      ABC 68 B
 *      author  : kyomukyomupurin
 *      created : 2018-09-04 23:47:10
**/

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

int CountEven(int x){
    int count = 0;
    while (x % 2 == 0){
        x /= 2;
        ++count;
    }
    return count;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int N; cin >> N;
    int max = 0;
    for (int i = 1; i <= N; ++i) {
        if (CountEven(i) > max){
            max = CountEven(i);
        }
    }
    cout << pow(2, max) << endl;
    return 0;
}


Measured memory_bytes: 512
import java.util.Iterator;
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {

	public static final int FROM = 0;
	public static final int TO = 1;
	public static final int DIS = 2;

	public static void main(String[] args) {
		doIt();
	}

	public static void printQueue(PriorityQueue<E> pq){
		Iterator<E> it = pq.iterator();
		while(it.hasNext()){
			E t = it.next();
			System.out.println("from " + t.from + " , to " + t.to + " , distance " + t.distance);
		}
	}
	
	public static void print(int[] a){
		for(int n : a){
			System.out.print(n + " ");
		}
		System.out.println();
	}

	public static void doIt(){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		PriorityQueue<E> pq = new PriorityQueue<E>();
		while(n != 0){
			int m = sc.nextInt();
			for(int i = 0; i < m; i++){
				String s = sc.next();
				//System.out.println(s);
				String[] ss = s.split(",");
				pq.add(new E(Integer.parseInt(ss[FROM]),Integer.parseInt(ss[TO]),Integer.parseInt(ss[DIS])));
			}
			//printQueue(pq);
			//連結関係を表す。同じ数字なら連結している
			int[] con = new int[n];
			for(int i = 0; i < n; i++){
				con[i] = i;
			}

			//pqを初めから見ていき、頂点を連結させていく
			int len = pq.size();
			int ans = 0;
			int len2 = con.length;
			for(int i = 0; i < len; i++){
				E edge = pq.poll();
				//まだ連結されていなかったら
				if(con[edge.from] != con[edge.to]){
					//連結する
					//con[edge.to] = con[edge.from];
					ans += edge.distance / 100 - 1;
					if(connectAndCheck(con, len2, con[edge.to], con[edge.from])){
						break;
					}
				}
				//print(con);
			}
			System.out.println(ans);
			n = sc.nextInt();
		}
	}

	public static boolean connectAndCheck(int[] con, int len, int bef, int aft){
		boolean bRet = true;
		int e = con[0];
		for(int i = 0; i < len; i++){
			if(con[i] == bef){
				con[i] = aft;
			}
			if(e != con[i]){
				bRet = false;
			}
		}
		return bRet;
	}


}

class E implements Comparable<E>{
	public int from,to,distance;
	public E(int f, int t, int d){
		from = f;
		to = t;
		distance = d;
	}
	public int compareTo(E arg0) {
		// TODO 自動生成されたメソッド・スタブ
		return distance - arg0.distance;
	}
}

Measured memory_bytes: 13000
#include <bits/stdc++.h>
using namespace std;
typedef long long 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; }
 
/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
*/

int main(){
    int N; cin >> N;
    int highest = 0;
    int ans = 0;

    vector<int> h(N);
    for(int i=0; i<N; i++) cin >> h[i];

    for(int i=0; i<N; i++){
        if(h[i] >= highest){
            ans++;
            highest = h[i];
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
#define speedX ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
using namespace std;
// #define ONLINE_JUDGE
#ifndef ONLINE_JUDGE
template<typename T>
void __p(T a) { cout << a << " "; }
template<typename T, typename F>
void __p(pair<T, F> a) { cout << "{ "; __p(a.first); __p(a.second); cout << "}"; }
template<typename T>
void __f(const char* s, T t) { cout << s << " : "; __p(t); }
template<typename T>
void __t(const char* s, const T &x) { cout << s << " : { "; for (auto it : x) __p(it); cout << "} ";}
template<typename T, typename ... F>
void __f(const char* s, T t, F ... f) {
	int i = 0; for (;; ++i) if (s[i] == ',') break;
	cout.write(s, i) << " : "; __p(t); cout << " | "; __f(s + i + 1, f...);
}
#define trace(...) { cout<<"LINE: "<<__LINE__<<" || "; __f(#__VA_ARGS__,__VA_ARGS__); cout<<"\n\n"; }
#define debug(...) { cout<<"LINE: "<<__LINE__<<" || "; __t(#__VA_ARGS__,__VA_ARGS__); cout<<"\n\n"; }
int begtime = clock();
#define end_time() cout << "\n\nTime of execution: " << (clock() - begtime)*1000/CLOCKS_PER_SEC << " ms\n\n";
#else
#define trace(...)
#define debug(...) 
#define end_time()
#endif
 
 
#define int long long 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<pii, int> piii;
typedef vector<int> vi;
typedef vector<pii> vii;

inline bool equals(ld a, ld b) {return fabs(a - b) < 1e-9;}
inline int gcd(int a, int b) { a=abs(a); b=abs(b); while(a>0 && b>0) (a>b?a%=b:b%=a); return (a==0?b:a); } 
inline int power(int x, int n, int m = LLONG_MAX)
    {  int res=1; x = (x%m + m)%m;
       while(n) { if(n&1) res=(res*x)%m;  x=(x*x)%m;  n >>= 1; }  return res;
    }
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define ff first
#define ss second
#define uset unordered_set
#define umap unordered_map
#define all(x) x.begin(), x.end()
#define mod 1000000007
int vis[100005];
int dp[100005];
int go(int h[], int idx, int n){
	if(idx>=(n-1)) return 0;
	if(vis[idx]) return dp[idx];
	vis[idx] = 1;
	if(idx==(n-2)) dp[idx] = abs(h[idx]-h[idx+1])+go(h,idx+1,n);
	else dp[idx] = min((abs(h[idx]-h[idx+1])+go(h,idx+1,n)),(abs(h[idx]-h[idx+2])+go(h,idx+2,n)));
	return dp[idx];
}
void solve(){
	memset(vis,0,sizeof(vis));
	memset(dp,0,sizeof(dp));
	int n;
	cin>>n;
	int h[n];
	for(int i = 0; i<n; i++){
		cin>>h[i];
	}
	cout<<go(h,0,n)<<"\n";
}
signed main(){
	speedX;
	#ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
	int t=1;
	//cin>>t;
	for(int i=1;i<=t;++i) {
		//cout<<"Case #"<<i<<": ";
		solve();
	}
	end_time();
	return 0;
}


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

#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x,y) x ## y

using i8  = int8_t;
using u8  = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;

using f32 = float;
using f64 = double;

#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPS(i, n) for(i64 i = 1; i <= n; ++i)
#define RREP(i, n) for(i64 i = n - 1; i >= 0 ; --i)
#define RREPS(i, n) for(i64 i = n; i >= 1; --i)

#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))

#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define pb push_back
#define mp make_pair
#define F first
#define S second

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }

template<typename T, size_t N>
i64 SIZE(const T (&)[N]) { return static_cast<i64>(N); }


struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;

    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;

int main() {
    i64 X, Y; cin >> X >> Y;
    cout << (X + Y / 2) << endl;

    return 0;
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef vector<ll> vl;
typedef vector<pair<ll,ll>> vp;
#define rep(i,n) for(ll i = 0; i < ll(n); i++)
#define MMOD(i) ((i%MOD)+MOD)%MOD;
#define all(v) v.begin() , v.end()
#define vec(i,j) vector<vector<ll>>(i,vector<ll>(j,0))
const ll INF=99999999999999;
const ll MOD=1000000007;
const ll MAX_N=100010;
ll a,b,c,d,e,f,x,y,z,k,m,n,l,q,h,w,t,ans=0;
vl v,v1,v2;
vp p;
string s;
priority_queue<ll> q1;
priority_queue<ll,vector<ll>,greater<ll>> q2;
ll solve(){
   if(x<a)return 0;
   return 10; 
}
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin>>x>>a;
    cout<<solve()<<endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <cassert>

//std::cout << std::fixed << std::setprecision(10)
//std::ios::sync_with_stdio(false);
constexpr long long MOD = 1000000007;

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

int main()
{
  long long N, M;
  std::cin >> N >> M;
  std::cout << (N*(N-1)/2) + (M*(M-1)/2) << std::endl;
  return 0;
}



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

int main(){
  string s;
  cin >> s;
  int cnt = 0;
  for(int i = 0; i < s.size(); i++){
    if(s[i] == 'R'){
     	cnt++; 
    }
  }
  
  if(cnt == 2 && s[1] == 'S'){
    cnt = 1;
  }
  cout << cnt << endl;
}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for(ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF 1000000000000000
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll, ll> p;
constexpr int MOD = 1000000007;
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;
}

void print(const std::vector<int> &v) {
    std::for_each(v.begin(), v.end(), [](int x) { std::cout << x << " "; });
    std::cout << std::endl;
}
class UnionFind {
  private:
    vector<int> parent;
    vector<int> height;
    vector<int> m_size;

  public:
    UnionFind(int size_) : parent(size_), height(size_, 0), m_size(size_, 1) {
        for(int i = 0; i < size_; ++i)
            parent[i] = i;
    }
    void init(int size_) {
        parent.resize(size_);
        height.resize(size_, 0);
        m_size.resize(size_, 0);
        for(int i = 0; i < size_; ++i)
            parent[i] = i;
    }
    int find(int x) {
        if(parent[x] == x)
            return x;
        return parent[x] = find(parent[x]);
    }
    void unite(int x, int y) {
        x = find(x);
        y = find(y);
        if(x == y)
            return;
        int t = size(x) + size(y);
        m_size[x] = m_size[y] = t;
        if(height[x] < height[y])
            parent[x] = y;
        else
            parent[y] = x;
        if(height[x] == height[y])
            ++height[x];
    }
    bool same(int x, int y) { return find(x) == find(y); }
    int size(int x) {
        if(parent[x] == x)
            return m_size[x];
        return size(parent[x] = find(parent[x]));
    }
};

int main() {
    int N, M;
    cin >> N >> M;
    vector<int> X(M), Y(M), Z(M);
    REP(i, M) cin >> X[i] >> Y[i] >> Z[i];
    UnionFind tree(N);
    REP(i, M) { tree.unite(X[i] - 1, Y[i] - 1); }

    set<int> ans;
    REP(i, N) {
        int temp = tree.find(i);
        // cout << temp << endl;
        if(ans.count(temp) == 0) {
            ans.insert(temp);
        }
    }
    cout << ans.size() << endl;
}

Measured memory_bytes: 7296
/**
 *      ABC 50 B
 *      author  : kyomukyomupurin
 *      created : 2018-09-06 04:39:39
**/

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

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int N; cin >> N;
    int T[N + 10] = {};
    for (int i = 0; i < N; ++i) {
        cin >> T[i];
    }
    int M; cin >> M;
    int P[M + 10] = {}; int X[M + 10] = {};
    for (int i = 0; i < M; ++i) {
        cin >> P[i] >> X[i];
    }
    int sum = 0;
    for (int i = 0; i < N; ++i) {
        sum += T[i];
    }

    for (int i = 0; i < M; ++i) {
        cout << sum - T[P[i] - 1] + X[i] << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
#include<iostream>
using namespace std;
int main()
{
	long long n, k, ans, q = 1;
	int i;
	scanf("%lld %lld", &n, &k);
	for(i = 1; i <= n - 1; i++)
		q = q * (k - 1);
		ans = k * q;
		printf("%lld\n", ans);
		return 0;
}

Measured memory_bytes: 256
from sys import stdin
import collections
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a
ans = 0
n = int(stdin.readline().rstrip())
for c  in range(1,n):
    cnt = 1
    n2 = n - c#ここからユークリッド,a * b = n2→これやめた、素因数分解する
    #約数の個数がわかればよい
    data = collections.Counter(prime_factorize(n2))
    tmp = list(data.values())
    for x in range(len(tmp)):
        cnt *= tmp[x] + 1
    ans += cnt
print(ans)

Measured memory_bytes: 70384
def main():
    input_line = raw_input()
    N = int(input_line)
    
    for i in range(N):
        input_line = raw_input()
        num_lis = []
        for num in input_line.split(' '):
            num_lis.append(int(num))
        num_lis.sort(reverse=True)
        if num_lis[0]**2 == num_lis[1]**2 + num_lis[2]**2:
            print('YES')
        else:
            print('NO')

if __name__ == '__main__':
    main()

Measured memory_bytes: 4228
def main():
    n = int(input())
    a = []
    for i in range(n):
        a.append(tuple(map(int,input().split(' '))))
    a_sorted = sorted(a,key=lambda x:x[1])
    job_time = 0
    end_time = 0
    for a,b in a_sorted:
        job_time += a
        end_time = b
        if job_time > end_time:
            return 'No'
    return 'Yes'

print(main())

Measured memory_bytes: 33456
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
#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 INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

int gcd(int a,int b){
    int ma = max(a,b);
    int mi = min(a,b);
    if(ma % mi == 0){
        return mi;
    }
    else{
        return gcd(mi,ma%mi);
    }
 }

int main()
{
    int A,B,K;
    cin >> A >> B >> K;
    int C = gcd(A,B);
    int itr = 0;
    vector <int> vec; //約数を列挙
    for(int i = 1; i <= sqrt(C); i++){
        if(C % i == 0){
            vec.push_back(i);
            itr++;
        }
    }
    REPR(i,itr-1){
        vec.push_back(C / vec[i]);
    }
    if(vec[itr-1] == vec[itr]){vec.erase(vec.begin() + itr);}

    /*REP(i,vec.size()){
        cout << vec[i] << endl;
    }*/

    cout << vec[vec.size() - K] << endl;
}

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



#define int long long

// int euclidean_gcd(unsigned a, unsigned b) {
//   while(1) {
//     if(a < b) swap(a, b);
//     if(!b) break;
//     a %= b;
//   }
//   return a;
// }

signed main(void){
    int n; cin >> n;
    int t,a;
    cin >> t >> a;
    for(int i=1;i<n;i++){
        int tmp_t,tmp_a; cin >> tmp_t >> tmp_a;
        int x,y;
        x = (t+tmp_t-1)/tmp_t;
        y = (a+tmp_a-1)/tmp_a;
        if(x < y) t = tmp_t*y,a = tmp_a*y;
        else t = tmp_t*x, a = tmp_a * x;
    }
    cout << t+a << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include <cmath>
#include <limits>
#include <numeric>

using namespace std;

int64_t gcd(int64_t, int64_t);
int64_t lcm(int64_t, int64_t);

int main(){
    int64_t A, B, C;
    cin >> A >> B;
    C = lcm(A, B);
    cout << C << endl;
}

int64_t gcd(int64_t a, int64_t b){
    while(1){
        if(a < b){
            swap(a, b);
        }
        if (b == 0){
            break;
        }
        a %= b;
    }
    return a;
}

int64_t lcm(int64_t a, int64_t b){
    return a * b / gcd(a, b);
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
  int n;cin>>n;
  double sum=0;
  for(int i=0;i<n;i++){
	double x;cin>>x;
	string s;cin>>s;
	switch(s[0]){
	case 'J':sum+=x;break;
	default:sum+=x*(380000);
	}
  }
  cout<<sum<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <list>
#include <set>
#include <queue>
#include <map>
#include <algorithm>
#include <functional>
#include <string>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <tuple>
using namespace std;

#define REP(i,p,n) for(ll i=p;i<ll(n);++i)
#define rep(i,n) REP(i,0,n)

using ll = long long int;
using pll = pair<ll, ll>;

const ll mod = static_cast<ll>(1e9) + 7;

ll H, W, K;

const ll MAXH = 11;
string S[MAXH];

ll N[MAXH];
ll M[MAXH];

ll solve(ll b)
{
    rep (i, H) { N[i] = 0; }

    ll res = 0;
    rep (i, H) { res += (b>>i)&1; }

    for (ll x=0;x<W;++x)
    {
        rep (i, H) { M[i] = 0; }

        ll ni = 0;

        for (ll y=0;y<H;++y)
        {
            // ホワイトチョコが見つかった
            if (S[y][x] == '1') { ++M[ni]; }

            // 失敗させる
            if (M[ni] > K) { return H * W + 1; }

            // 横の区切りが見つかった
            if ((b>>y)&1) { ++ni; }
        }

        bool isOver = false;

        rep (j, ni + 1)
        {
            N[j] += M[j];
            if (N[j] > K) { isOver = true; }
        }

        if (isOver)
        {
            ++res;
            rep (j, ni + 1) { N[j] = M[j]; }
        }
    }

    return res;
}

int main()
{
    cin >> H >> W >> K;
    rep (i, H) { cin >> S[i]; }

    ll ans = H * W + 1;

    for (ll i=0,n=(1<<(H-1));i<n;++i)
    {
        const ll res = solve(i);
        ans = min(ans, res);
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
n=int(input())
l=[]
for i in range(n):
    a,b=map(int,input().split())
    l.append([a-b,a+b])
l.sort(key=lambda x: x[1])
ans=1
nl=l[0][0]
nr=l[0][1]
for i in range(1,n):
    if l[i][0]<nr:
        continue
    else:
        nr=l[i][1]
        ans+=1
print(ans)


Measured memory_bytes: 21336
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

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

    string r;

    while (n > 0) {
        n--;
        r.push_back('a' + n % 26);
        n /= 26;
    }

    reverse(r.begin(), r.end());

    cout << r << endl;

    return 0;
}

Measured memory_bytes: 3592
H,W = map(int,input().split())
N = int(input())
a = list(map(int,input().split()))

b = [0 for _ in range(N)]
b[0] = a[0]
for i in range(N-1):
    b[i+1] = b[i] + a[i]

C = [[None for _ in range(W)] for _ in range(H)]

pt = 0
for i in range(N):
    for j in range(a[i]):
        s,t = pt // W,pt % W
        C[s][t] = i+1
        pt += 1

for i in range(H):
    if i % 2 == 1:
        for j in range(W//2):
            C[i][j],C[i][W-j-1] = C[i][W-j-1],C[i][j]

for i in range(H):
    print(" ".join(map(str,C[i])))


Measured memory_bytes: 3952
use proconio::{input, fastout};

#[fastout]
fn main() {
    input! {
        alpha: char,
    }

    // println!("a: {}, A: {}", 'a' as i32, 'A' as i32);
    let res = if (alpha as i32) >= ('a' as i32) {'a'} else {'A'};

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


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

int main(void){
    int N, X;
    cin >> N >> X;
    long long int L[N + 1];
    for(int i = 0; i < N; i++){
        cin >> L[i];
    }
    long long int D[N];
    D[0] = 0;
    for(int i = 1; i <= N; i++){
        D[i] = D[i-1] + L[i-1];
    }
    int counter = 0;
    for(int i = 0; i <= N; i++){
        if(D[i] <= X){counter++;}
    }
    cout << counter << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<cmath>
using namespace std;
int main() {
	long long n, a, sum = 0, num = 0, ans = 0; cin >> n;
	for (int h = 0; h < n; h++) {
		cin >> a;
		if (a % 4 == 0) { sum++; }
		else if (a % 2 == 0) { num++; }
		else { ans++; }
	}
	if (num == 0 && sum >= ans - 1) {
		cout << "Yes" << endl;
	}
	else if (num != 0 && sum >= ans) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	cin >> n;
}

Measured memory_bytes: 256
#include <cstdio>
#include <map>
#include <algorithm>
 
using namespace std;
 
long long a, b, c, d;
map<long long, long long> mp;

long long calc(long long n) {
    int i;
    long long ans = 1e18;
    if (mp.count(n)) return mp[n];
    if (n == 0) return mp[n] = 0;
    
    for (i = -1; i <= 1; i++) {
        if (n + i > 0 && (n + i) % 2 == 0 && ( n+i ) / 2 < n) {
            ans = min(ans, calc((n + i) / 2) + a + abs(i) * d);
        }
            
    }
    for (i = -2; i <= 2; i++) {
        if (n + i > 0 && (n + i) % 3 == 0 && (n + i) / 3 < n) {
            ans = min(ans, calc((n + i) / 3) + b + abs(i) * d);
        }
            
    }
    for (i = -4; i <= 4; i++) {
        if (n + i > 0 && (n + i) % 5 == 0 && (n + i) / 5 < n) {
            ans = min(ans, calc((n + i) / 5) + c + abs(i) * d);
        }
            
    }
    if (n <= ans / d) ans = min(ans, n * d);
    return mp[n] = ans;
}
 
int main() {
    int s, i;
    scanf("%d", &s);
    for (i = 0; i < s; i++) {
        long long n;
        scanf("%lld %lld %lld %lld %lld", &n, &a, &b, &c, &d);
        mp.clear();
        printf("%lld\n", calc(n));
    }
    return 0;
}

Measured memory_bytes: 3968