akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define P pair<int,int>
using ll=int64_t;
using namespace std;
#define ketasuu(n) fixed<<setprecision(n)
#define btoe(p) p.begin(),p.end()
#define etob(p) p.rbegin(),p.rend()


//UnionFind Template
struct UnionFind{ //構造体の定義
    vector<int> d; //メンバ変数
    UnionFind(int n=0): d(n,-1) {} //コンストラクタ（構造体が呼ばれたときにすぐに実行される処理）
    int find(int x){
        if(d[x]<0) return x;
        return d[x]=find(d[x]);
    }
    bool unite(int x, int y){
        x=find(x); y=find(y);
        if(x==y) return false;
        if(d[x]<d[y]) swap(x,y);//d[x] is smaller. Then, connect d[x] to d[y].
        d[y]+=d[x];
        d[x]=y;
        return true;
    }
    bool same(int x, int y){
        return find(x)==find(y);
    }
    int size(int x){
        return -(d[find(x)]);   
    }
    int rootsize(){
        int cnt=0;
        for(auto& v: d){
            if(v<0) cnt++;
        }
        return cnt;
    }
};
//How to use
//UnionFind uf(n); などと書けば使えるようになる.ufというobjectが生成される
//uf.unite(a,b);などで中の関数を使える



int main(){
    ll n,m;
    cin>>n>>m;
    vector<pair<ll,ll>> inp(m);
    vector<ll> ans(m);
    UnionFind uf(n);
    rep(i,m){
        cin>>inp[i].first>>inp[i].second;
        inp[i].first--; inp[i].second--;
    }
    reverse(btoe(inp));
    ll a=n*(n-1)/2;
    rep(i,m-1){
        if(!uf.same(inp[i].first,inp[i].second)) a-=uf.size(inp[i].first)*uf.size(inp[i].second);
        uf.unite(inp[i].first, inp[i].second);
        ans[m-2-i]=a;
    }
    ans[m-1]=n*(n-1)/2;
    rep(i,m) cout<<ans[i]<<endl;
    return 0;
}


Measured memory_bytes: 4096
//AUTHOR: RAVAN_2070
//PUNE INSTITUTE OF COMPUTER TECHNOLOGY
/*
        PEOPLE'S LIVES DON'T END WHEN THEY DIE.
        IT ENDS WHEN THEY LOSE FAITH
                                     -ITACHI UCHIHA
        EXPLAINATION BELOW->
*/
#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vi;
typedef vector<pair<ll,ll>> vii;
typedef pair<ll,ll> pii;
typedef map<ll,ll> mii;
#define MOD7 1000000007
#define MOD9 1000000009
#define pi 3.1415926535
#define Test_cases ll TC;cin>>TC;while(TC--)
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(), x.rend()
#define sp(x) fixed<<setprecision(x)
#define sz(x) (ll)(x.size())
#define fo(i,a,b) for(i=a;i<b;i++)
#define foe(i,a,b) for(i=a;i<=b;i++)
bool isPalindrome(string str) 
{ 
    // Start from leftmost and rightmost corners of str 
    int l = 0; 
    int h = sz(str) - 1; 
  
    // Keep comparing characters while they are same 
    while (h > l) 
    { 
        if (str[l++] != str[h--]) 
        { 
            return false; 
        } 
    } 
    return true;
} 
void solve()
{
   string s;cin>>s;
   ll l,r;
   l=(sz(s)-1)/2;
   r=(sz(s)+3)/2;r--;
   string a=s.substr(0,l);
   string b=s.substr(r,sz(s)-r);
   if(isPalindrome(s)&&isPalindrome(a)&&isPalindrome(b))cout<<"Yes\n";
   else cout<<"No\n";
}
int main()
{
   fastio
   solve();
  return 0;
}


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

using ll=long long;
const ll MOD=1e9+7;

ll powm(ll x,ll k){
    ll res=1;
    while(k){
        if(k&1) res=(res*x)%MOD;
        x=(x*x)%MOD;
        k/=2;
    }
    return res;
}
ll piyo=-1;
ll mod_inv(ll x){
    if(piyo!=-1) return piyo;
    return piyo=powm(x,MOD-2);
}

int main(){
    int n,q;
    cin>>n>>q;
    vector<int> a(n);
    for(int i=0;i<n;i++) cin>>a[i];
    vector<vector<ll>> dp(n,vector<ll>(n,0));
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            dp[i][j]=(a[i]<a[j]);
        }
    }
    int rq=q;
    while(q--){
        int x,y;
        cin>>x>>y;
        x--,y--;
        for(int i=0;i<n;i++){
            if(i!=x && i!=y){
                ll tmp=((dp[i][x]+dp[i][y])%MOD)*mod_inv(2)%MOD;
                dp[i][x]=dp[i][y]=tmp;
            }
        }
        for(int i=0;i<n;i++){
            if(i!=x && i!=y){
                ll tmp=((dp[x][i]+dp[y][i])%MOD)*mod_inv(2)%MOD;
                dp[x][i]=dp[y][i]=tmp;
            }
        }
        dp[x][y]=dp[y][x]=((dp[x][y]+dp[y][x])*mod_inv(2))%MOD;        
    }
    ll res=0;
    for(int i=0;i<n;i++){
        for(int j=0;j<i;j++){
            res+=dp[i][j];
            res%=MOD;
        }
    }
    for(int i=0;i<rq;i++){
        res=(res*2)%MOD;
    }
    cout<<res<<endl;
    
    return 0;
}

Measured memory_bytes: 72704
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < (int)(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 ALL(x) (x).begin(),(x).end()
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define INF 99999999999
#define PRINT(var) std::cout<<#var"= "<<var<<std::endl

using namespace std;
typedef long long  int ll;

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

ll n,m,sum,num,val;
vector<ll> t;


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

  cin >> n ;
  t.resize(n);

  sum=0;
  for (ll i = 0; i < n; i++) {
    cin >> t[i];
    sum += t[i];
  }

  cin >> m;

  REP(i,m){
    cin >> num >>val;
    cout << sum - t[num-1]+val << endl;
  }


  return 0;
}

Measured memory_bytes: 256
# coding: utf-8
# Your code here!

import sys

n,m = list(map(int,input().split()))

pl = []
for _ in range(m):
    l,r,c = list(map(int,input().split()))
    pl.append((l-1,r-1,c))

dp = [float('inf') for i in range(n)]
dp[0] = 0
pl = sorted(pl)

for l,r,c in pl:
    for rr in range(r,l,-1):
        if dp[rr] > dp[l] + c:
            dp[rr] = dp[l] + c
        else:
            break

if dp[-1] == float('inf'):
    print(-1)
else:
    print(dp[-1])

Measured memory_bytes: 94040
#include <bits/stdc++.h>
using namespace std;
int main(){
    
    cin.tie( 0 );
    ios::sync_with_stdio( false );
    
    while(true){
        int n;
        cin >> n;
        
        if(n == 0){ break; }
        vector<int> vc(n);
        
        for(int i=0; i<n; i++){
            cin >> vc[i];
        }
        auto mm = minmax_element(vc.begin(),vc.end());
        auto res = (accumulate(vc.begin(), vc.end(), 0)) - (*mm.first + *mm.second);
        cout << res / (n-2) << endl;
    }
    return 0;
}

Measured memory_bytes: 3004
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define sf scanf
#define pf printf
#define pb push_back
#define llu unsigned long long
#define U unsigned int
#define SIZE 1000002
#define pie 3.14159265358979323
#define minuss 1e-6
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
ll  lcm(ll a,ll b)
{
    ll GCD=__gcd(a,b);
    ll lcm=(a*b)/GCD;
    return lcm;
}
ll dp[109][100005];
ll weight[10000],value[10000];
ll total,val;
ll call(ll n,ll c)
{
    if(n==total)
        return 0;
    if(dp[n][c]!=-1)
        return dp[n][c];

    ll res1=0,res2=0;

    if(weight[n]+c<=val)
        res1=value[n]+call(n+1,c+weight[n]);


    res2=call(n+1,c);
    dp[n][c]=max(res1,res2);
    return dp[n][c];

}
int main()
{
    cin>>total>>val;
    for ( int i = 0; i <total; ++i )
        cin>>weight[i]>>value[i];

    memset(dp, -1, sizeof(dp));
    ll ret=call(0,0);
    cout<<ret<<endl;
    return 0;
}

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

using namespace std;
using namespace __gnu_pbds;

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

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

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

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

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

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

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

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

ll dp[3001][3001];
ll a[3001];

int main()
{
    IOS;
    ll n,s;
    cin>>n>>s;
    repf(i,1,n+1) cin>>a[i];
    memset(dp,0,sizeof dp);
    repf(i,0,n+1) dp[i][0]=i+1;
    ll ans=0;
    repf(i,1,n+1)
    {
        repf(j,1,s+1)
        {
            dp[i][j]=dp[i-1][j];
            if(j-a[i]>=0)
            {
                dp[i][j]=(dp[i][j]+dp[i-1][j-a[i]])%MOD;
            }
        }
        ans=(ans+dp[i][s])%MOD;
    }
    cout<<ans<<endl;
    // repf(l,1,n+1)
    // {
    //     repf(r,l,n+1)
    //     {
    //         ans=ans+dp
    //     }
    // }
}   

Measured memory_bytes: 70656
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

typedef long long ll;
typedef int keytype;

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

void quicksort(keytype a[], int first, int last)
{
    int i, j;
    keytype x, t;

    x = a[(first + last) / 2];
    i = first;  j = last;
    for ( ; ; ) {
        while (a[i] < x) i++;
        while (x < a[j]) j--;
        if (i >= j) break;
        t = a[i];  a[i] = a[j];  a[j] = t;
        i++;  j--;
    }
    if (first  < i - 1) quicksort(a, first , i - 1);
    if (j + 1 < last) quicksort(a, j + 1, last);
}

int is_prime(int x){
    if(x <= 1) return 0;
    for(int i = 2; i * i <= x; i++){
        if(x % i == 0) return 0;
    }
    return 1;
}

int is_substr(char s[], char t[], int i){
    int flag = 1;

    if(s[i] == '\0') flag = 0;

    for(int j = 0; j < strlen(t); ++j, ++i){
        if(s[i] != t[j]){
            flag = 0;
            break;
        }
    }
    return flag;
}

// factor list, number of factors, natural number
void factorize(int ftr[], int *num, int n){
    int a = 2, cnt = 0;

    while(n >= a){
        if(n % a == 0){
            n = n / a;
            ftr[cnt++] = a;
        }else{
            a++;
        }
    }
    *num = cnt;
}

void comb(int size1, int size2, int v[size1][size2]){
  for(int i = 0; i < size1; i++){
    v[i][0] = 1;
    v[i][i] = 1;
  }
  for(int k = 1; k < size1; k++){
    for(int j = 1; j < k; j++){
      v[k][j] = (v[k-1][j-1] + v[k-1][j]);
    }
  }
}

ll ans(ll h){
    if(h == 1){
        return 1;
    }else{
        return 2 * ans(h / 2) + 1;
    }
}

int main(){
    ll h;

    scanf("%lld", &h);

#if 0
    ll sum = 1;
    for(ll i = 1; i <= (h / 2); ++i){
        sum += i * 2;
    }
#endif

    ll sum = ans(h);

    printf("%lld\n", sum);

    return 0;
}


Measured memory_bytes: 1708
use std::io;

fn read() -> String {
    let mut buff = String::new();
    io::stdin().read_line(&mut buff).unwrap();
    buff.trim().to_string()
}

fn main() {
    let n: i32 = read().parse().unwrap();
    let chars: Vec<char> = read().chars().collect();

    let r_count = chars.iter().filter(|c| c == &&'R').count();
    let g_count = chars.iter().filter(|c| c == &&'G').count();
    let b_count = chars.iter().filter(|c| c == &&'B').count();

    let mut ans = r_count * g_count * b_count;

    for i in 0..n {
        for j in (i + 1)..n {
            let k = 2 * j - i;
            if k < n {
                let ci = chars[i as usize];
                let cj = chars[j as usize];
                let ck = chars[k as usize];
                if ci != cj && ci != ck && cj != ck {
                    ans -= 1;
                }
            }
        }
    }

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


Measured memory_bytes: 2144
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
#define all(x) x.begin(),x.end()
#define ln '\n'
const long long MOD = 1000000007LL;
//const long long MOD = 998244353LL;
typedef long long ll;
typedef unsigned long long ull; 
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
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; }
///////////////////////////////////////////////////////////////////////////////////////////////////

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    string S; cin >> S;
    bool ok = false;
    if (S[0]==S[1]&&S[1]==S[2]) ok = true;
    cout << (ok ? "No" : "Yes") << ln;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define f(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) f(i,0,n)
#define fd(i,a,b) for(ll i=a;i>=b;i--)
#define pb push_back
#define mp make_pair
#define vi vector< int >
#define pc(x)  __builtin_popcount (x)
#define vl vector< ll >
#define ss second
#define ff first
#define ll long long
#define ld long double
#define pii pair< int,int >
#define pll pair< ll,ll >
#define sz(a) a.size()
#define inf (1000*1000*1000+5)
#define all(a) a.begin(),a.end()
#define tri pair<int,pii>
#define vii vector<pii>
#define vll vector<pll>
#define viii vector<tri>
#define mod 1000000007
#define pqueue priority_queue< int >
#define pdqueue priority_queue< int,vi ,greater< int > >
#define flush fflush(stdout) 
#define gcd __gcd
#define primeDEN 727999983
#define nx_pe next_permutation(s.begin(),s.end())
#define cl cout<<"\n"

    
int main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin) ;
    freopen("output.txt", "w", stdout) ;
    #endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL) ; cout.tie(NULL) ;
    std::ios::sync_with_stdio(false);
    ll x,y;
    cin>>x>>y;
    if(y%2){
        cout<<"No\n";
        return 0;
    }
    ll z=y/2;
    ll t=z-x;
    if(t<0){
        cout<<"No\n";
        return 0;
    }
    ll c=x-t;
    if(c<0)
    {
        cout<<"No\n";
        return 0;
    }
    cout<<"Yes\n";

}




Measured memory_bytes: 3636
a,b=gets.split.map &:to_i
x1=(a*100+7)/8
x2=(a*100+99)/8
y1=(b*100+9)/10
y2=(b*100+99)/10
z1=[x1,y1].max
z2=[x2,y2].min
puts z1<=z2 ? z1 : -1

Measured memory_bytes: 1788
//BISMILLAHIR RAHMANIR RAHIM
#include <bits/stdc++.h>
#define mem(a, b) (memset(a, b, sizeof(a)))
#define pb push_back
#define mk make_pair
#define ff first
#define ss second
#define PI acos(-1)
#define INF 2147483647
#define MOD 1000000007
#define MAX 200005
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef pair<int, ii> pii;
typedef vector<ii> vii;
typedef priority_queue<int,vector<int>,greater<int> > PQ;

int Set(int mask, int pos){return mask = mask | (1<<pos);}
bool check(int mask, int pos){return (bool)(mask & (1<<pos));}

int main()
{
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int x, n;

    cin>>x>>n;
    set<int> s;

    for(int i = 0; i < n; i++) {
        int val;
        cin>>val;
        s.insert(val);
    }

    int Min = 1e6, ans;
    for(int i = -100; i <= 200; i++) {
        if(!s.count(i)) {
            if(abs(i - x) < Min) {
                Min = abs(i - x);
                ans = i;
            }
        }
    }

    cout<<ans<<endl;

    return 0;
}



Measured memory_bytes: 3656
#include<iostream>
#include<string>
#include<algorithm>    
#include<cmath>
#include<map>
#include<vector>
#include<math.h>
#include<stdio.h>
#include<stack>
#include<queue>
#include<tuple>
#include<cassert>
#include<set>
#define int long long
#define mod(int)(1000000007)
using namespace std;
const int INF = 1000000000000;
int siro[345678], kuro[345678];
signed main() {
	int n, m, cnt = 0, a = 1, b = 1, ans = 0; string s; 
	cin >> n >> m >> s;
	for (int h = 0; h < n; h++) {
		if (h == 0) { 
			if (s[h] == '0') { b++; }
			cnt++; continue; 
		}
		if (s[h - 1] == s[h]) { cnt++; }
		else {
			if (s[h - 1] == '0') { siro[a] = cnt; a++; cnt = 1; }
			else { kuro[b] = cnt; ans = max(ans, cnt); b++; cnt = 1; }
		}
	}
	if (s[n - 1] == '0') { siro[a] = cnt; a++; }
	else { kuro[b] = cnt; b++; ans = max(ans, cnt); }
	for (int h = 1; h <= max((long long)1, a - m); h++) {
		int sum = 0; sum += kuro[h];
		for (int i = h; i < h + m; i++) {
			sum += siro[i] + kuro[i + 1];
		}
		ans = max(ans, sum);
	}
	cout << ans << endl;
	cin >> n; return 0;
}

Measured memory_bytes: 2944
#include<iostream>
#include<vector>
#include<queue>
#include<stack>
#include<string>
#include<cmath>
#include<algorithm>
#include<bitset>
#include<map>
#include<functional>
#include<set>

#pragma region
using namespace std;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define rep(i,n) FOR(i,0,n)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define rrep(i,r) RFOR(i,0,n)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define lower(a,x) lower_bound(all(a), x) - a.begin();
#define COUNT(a,x)  upper_bound(all(a), x) - lower_bound(all(a), x);
#define MCOUNT(a,x,y) upper_bound(all(a), y) - lower_bound(all(a), x);
#define UNIQUE(a) sort(all(a)); a.erase(unique(all(a)), a.end());
#define scan(x) scanf("%lld",&x);
#define pb push_back
typedef long long int ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef vector<string> vs;
typedef map<ll, ll> MAP;
typedef set<ll> SET;
typedef double D;
const ll inf = 5555555555555555555;
const ll mod = 1000000007;
const D pi = acos(-1);
const D eps = 1e-10;

ll n = 0, m = 0, ans = 0, sum = 0, cnt = 0, tmp = 0, ma = 0, mi = 0;
string s;
bool ok, flag;
ll dx[4] = { 1,-1,0,0 }, dy[4] = { 0,0,1,-1 };
ll ddx[9] = { 1,-1,0,0,1,1,-1,-1,0 }, ddy[9] = { 0,0,1,-1,1,-1,1,-1,0 };
#pragma endregion
#define MAX 111111


int main(void) {
  cin >> n;
  vll a(n + 2), b(n + 2);
  rep(i, n) {
	cin >> tmp;
	a[tmp] += i + 1;
	b[tmp] += i + 1;
  }
  rep(i, n) a[i + 1] += a[i];
  rrep(i, n) b[i] += b[i + 1];

  rep(i, n) cout << a[i + 1] << " ";
  cout << endl;
  rep(i, n) cout << b[i + 1] << " ";
  cout << endl;

  return 0;
}

Measured memory_bytes: 896
#include <bits/stdc++.h>
#define f(a, n) for (int a=0; a<n; a++)
#define F(a, n) for (int a=1; a<=n; a++)
using namespace std;
int n;
bool A[30005];
int main(){
	cin.tie(NULL);
	ios::sync_with_stdio(0);
	set<int> S;
	cin>>n;
	if (n <900) {
		cout<<"22 3 5 ";
		F(i, n - 3) cout<<30*i<<" ";
		cout<<endl;
	}
	else{
		int sum = 0;
		int cnt = 0;
		F(i, 30000){
			if (cnt == n) break;
			if (i%2 == 0 || i%3 == 0 || i%5 == 0){
				sum += i;
				cnt++;
				A[i] = 1;
			}
		}
		while (sum%30 != 0){
			while (1){ //del
				int x = (rand()%30000) + 1;
				if (A[x]){
					sum -= x;
					A[x] = 0;
					break;
				}
			}
			while (1){
				int x = (rand()%30000) + 1;
				if (x%2 == 0 || x%3 == 0 || x%5 == 0) if(A[x] == 0){
					sum += x;
					A[x] = 1;
					break;
				}
			}
		}
		f(i, 30000) if (A[i]) cout<<i<<" ";
		cout<<endl;
	}
}

Measured memory_bytes: 384
#include<iostream>
#include<cmath>
#include<numeric>
#include<functional>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<n;i++)
#define ll long long
#define modbig (10*10*10*10*10*10*10*10*10+7)
using namespace std;

int main(){
  int a;
  string s;
  cin>>a>>s;
  if(a>=3200){
    cout<<s;
  }else{
    cout<<"red";
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int N = 1E6 + 1;
int divs[N];

void sieve(){
   for(int i = 1; i <= N; i++){
      for(int j = i; j <= N; j += i)
         divs[j] += 1;
   }
}

int32_t main() 
{
  #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
  #endif 
  ios::sync_with_stdio(0); 
  cin.tie(0); cout.tie(0);
   
  sieve();
  int n;
  cin >> n;
  int ans = 0;

  for(int i = 1; i <= n; i++){
     ans += divs[n - i];
  }

  cout << ans;
  return 0;
}

Measured memory_bytes: 11500
S = input()

"""対象文字列
dream
erase
eraser
dreamer
"""

flg = True
while flg:
  if S[-7:] == 'dreamer':
    S = S[:-7]
  elif S[-6:] == 'eraser':
    S = S[:-6]
  elif S[-5:] == 'erase':
    S = S[:-5]
  elif S[-5:] == 'dream':
    S = S[:-5]
  else:
    flg = False


if len(S) == 0:
  ans = 'YES'
else:
  ans = 'NO'


print(ans)

Measured memory_bytes: 3188
n, m = map(int, input().split())
a = list(map(int, input().split()))

def f(x):
    res = 0
    while x % 2 == 0:
        x//= 2
        res += 1
    return res

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

def lcm(a, b):
    return a * b // gcd (a, b)

for i in range(n):
    a[i] //= 2

t = f(a[0])

ans = 0
for i in range(n):
    if f(a[i]) != t:
        print(0)
        exit()
    a[i] >>= t

m >>= t

l = 1
for i in range(n):
    l = lcm(l, a[i])
    if l > m:
        print(0)
        exit()

m //= l
ans = (m + 1)//2
print(ans)


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

#define ll long long

const int mxN=1e5;
int n, M, ui, vi;
ll dp[mxN], ans[mxN];
vector<int> adj[mxN];

void dfs1(int u=0, int p=-1) {
	dp[u]=1;
	for(int v : adj[u]) {
		if(v==p)
			continue;
		dfs1(v, u);
		dp[u]=dp[u]*dp[v]%M;
	}
	dp[u]=(dp[u]+1)%M;
}

void dfs2(int u=0, int p=-1, ll pd=1) {
	vector<ll> pp, sp;
	pp.push_back(1);
	for(int v : adj[u]) {
		if(v==p)
			continue;
		pp.push_back(dp[v]);
		sp.push_back(dp[v]);
	}
	sp.push_back(1);
	for(int i=1; i<pp.size(); ++i)
		pp[i]=pp[i]*pp[i-1]%M;
	for(int i=sp.size()-2; i>=0; --i)
		sp[i]=sp[i]*sp[i+1]%M;
	ans[u]=pp.back()*pd%M;
	int i=0;
	for(int v : adj[u]) {
		if(v==p)
			continue;
		dfs2(v, u, (pp[i]*sp[i+1]%M*pd+1)%M);
		++i;
	}
}

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

	cin >> n >> M;
	for(int i=0; i<n-1; ++i) {
		cin >> ui >> vi, --ui, --vi;
		adj[ui].push_back(vi);
		adj[vi].push_back(ui);
	}
	dfs1();
	dfs2();
	for(int i=0; i<n; ++i)
		cout << ans[i] << "\n";
}


Measured memory_bytes: 25472
#include <iostream>

using namespace std;

int main( ){

  int a,b,c;
  cin >> a >> b >> c;
  int i=0;

  for( int x=a ; x<=b ; x++ ){
    if( c%x ==0 )i=i+1;
  }
  cout << i <<endl;
 return 0;
}

Measured memory_bytes: 1164
#include<bits/stdc++.h>
using namespace std;
const long long INF = 1e7 + 1;
const long long MOD = 1000000007;
const long double PI = 3.1415926;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(x) x.begin(),x.end()
#define RALL(x) x.rbegin(),x.rend()
typedef long long int ll;
typedef vector<ll> vi;
typedef vector < pair<ll, ll > > vp;
typedef vector <string> vs;
typedef vector <char> vc;
typedef list <ll> lst;

ll n, m, k, ans = 0, sum = 0, cnt = 0;
string s;
char c;

#define Endl endl

/*--------------------template--------------------*/

bool isPrime(ll a)
{
	if (a < 2) {
		return false;
	}
	FOR(i, 2, sqrt(a) + 1)
	{
		if (a%i == 0) {
			return false;
		}
	}
	return true;
}

ll a[1005];

int main()
{
	fill(a, a + 1005, 1);
	cin >> n;
	vi v;
	REP(i, 1000) if (isPrime(i)) v.push_back(i);

	FOR(i, 2, n + 1)
	{
		k = i;
		while (1) {
		NEXT:
			if (k == 1) {
				break;
			}
			REP(j, v.size())
			{
				if (k%v[j] == 0) {
					a[j]++;
					k /= v[j];
					goto NEXT;
				}
			}
		}
	}

	ans = 1;
	REP(i, 1001)
	{
		ans *= a[i];
		ans %= MOD;
	}
	cout << ans%MOD << endl;
}


Measured memory_bytes: 256
program main
	integer(8) n,k,i,j
    integer(8),allocatable::a(:)
    integer(8)::ans=0,s=0
    integer(8),parameter::m=1000000007_8
    read *,n,k
    allocate(a(n))
    read *, (a(i),i=1,n)
    do i=1,n
    	do j=1,i-1
        	if(a(i)<a(j)) ans=ans+1
        end do
    end do
    ans=mod(ans*k,m)
    do i=1,n
    	do j=1,n
        	if(a(i)<a(j))s=s+1
        end do
    end do
    ans=mod(ans+s*mod(k*(k-1)/2,m),m)
    print '(i0)',ans
end program main

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


int bubbleSort(int a[], int n) {
	int flag = 1, cnt = 0;
	
	while (flag) {
		flag = 0;
		
		for (int j = n - 1; 1 <= j; j--) {
			if (a[j] < a[j - 1]) {
				swap(a[j], a[j - 1]);
				cnt++;
				flag = 1;
			}
		}
	}

	return cnt;
}


int main()
{
	int n, t, a[100];
	cin >> n;

	for (int i = 0;i < n;i++) {
		cin >> a[i];
	}

	t = bubbleSort(a, n);

	for (int i = 0;i < n;i++) {
		cout << a[i];
		if (i != n - 1) cout << " ";
		else cout << endl;
	}

	cout << t << endl;

    return 0;
}



Measured memory_bytes: 3080
#include <bits/stdc++.h>
#define FIXED_FLOAT(x)  std::fixed <<std::setprecision(7)<<(x)
#define all(v) (v).begin(), (v).end()
using namespace  std;

using ll = long long;
const ll mod = 998244353;
typedef pair<int , int> pairs;
typedef complex<ll> G;
const int N = 1e6+5;

const int INF = 1e9+2;
void  done() {

}
void solve(){
    int n;cin >> n;
    vector<int>a(n);
    for(int i =0;i < n;i++) {
        cin >> a[i];
    }
    int d = 0;
    int total = n;
    vector<int>pos;
    for(int i = 0;i < n-1;i++) {

    }

}

void another() {

    int n;cin >> n;
    vector<int>a(n);

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

    }
    ll cur = 1000;
    for(int i = 0;i < n-1;i++) {
        ll stocks = 0;
        if(a[i] < a[i+1])stocks = cur/a[i];
        cur += (a[i+1]-a[i]) * stocks * 1ll;
    }
    cout << cur << '\n';

}
void test_case() {
    int t;
    cin >> t;
    while(t--)another();
}
int main() {

    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    another();
}


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

using namespace std;

int main () {
  int N,H;
  cin >> N >> H;
  
  int count = 0,sum = 0;
  bool fin = false;
  vector<int> a(N,0),b(N,0);
  
  for(int i = 0; i < N; i++){
    cin >> a.at(i) >> b.at(i);
  }
  int amax = *max_element(a.begin(),a.end());
  sort(b.begin(),b.end());
  reverse(b.begin(),b.end());
  
  for(int i = 0; i < N; i++){
    if(b.at(i) < amax){break;}
    if(sum >= H){fin = true; break;}
    sum += b.at(i);
    count++;
  }
  if(fin == false){
    for(int i = 0; sum < H; i++){
      sum += amax;
      count++;
    }
  }
  
  cout << count << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std; 
long long x,k,d;
int main(){
	cin>>x>>k>>d;
	__int128 tmp=abs(x);
	if(tmp>(__int128)k*d){
		cout<<abs(x)-k*d;
		return 0;
	}
	k-=abs(x)/d;
	k&=1;
	x%=d;
	__int128 xx=(__int128)abs(x)-(__int128)k*d;
	if(xx<0)xx=-xx;
	x=xx;
	cout<<min(x,abs(x-2*d));
	return 0;
}

Measured memory_bytes: 3668
mod=10**9+7
MAX=10**3+100

#g1は階乗、g2はその逆元
g1=[1,1]
g2=[1,1]
for i in range(2,MAX+1):
    num_1=g1[-1]*i%mod
    g1.append(num_1)
    g2.append(pow(num_1,mod-2,mod))
    
def cmb(n,r,MOD):
    return g1[n]*g2[r]*g2[n-r]%MOD



N,A,B,C,D=map(int,input().split())

data=[[] for i in range(B+1)]
for i in range(A,B+1):
    for j in range(C,D+1):
        if i*j>N:
            break
        data[i].append([i*j, pow(g2[i], j, mod)*g2[j]%mod])

dp=[0]*(N+1)
dp[0]=1
for i in range(A,B+1):
    H=dp[:]
    for u,v in data[i]:
        for j in range(u,N+1):
            H[j]=(H[j]+dp[j-u]*v)%mod
    dp=H
print(dp[N]*g1[N]%mod)



Measured memory_bytes: 43116
#include <stdio.h>
int main()
{
    int A,B;
    int a[9],b[9];
    scanf("%d%d",&A,&B);
    for(int i=0;i<B;i++)
        b[i]=A;
    for(int j=0;j<A;j++)
        a[j]=B;
    if(a[0]<b[0])
        for(int i=0;i<A;i++)
            printf("%d",a[i]);
    else
        for(int i=0;i<B;i++)
            printf("%d",b[i]);
    return 0;
}

Measured memory_bytes: 128
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(v) v.begin(), v.end()
typedef long long ll;

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

int main(){
  string s;
  getline(cin,s);

  rep(i,s.size()){
    if(islower(s[i])) s[i]+='A'-'a';
    else if(isupper(s[i])) s[i]+='a'-'A';
  }
  
  cout<<s<<endl;
  
  return 0;
}


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

typedef pair<int,int>  pint;
typedef pair<ll,ll>    pll;
typedef vector<int>    vint;
typedef vector<ll>     vll;
typedef vector<string> vstr;
typedef vector<pint>   vpint;
typedef vector<pll>    vpll;

#define vint2(v,n,m,init) vector<vector<int>> v(n, vector<int>(m, init))
#define vll2(v,n,m,init)  vector<vector<ll>>  v(n, vector<ll>(m, init))

#define rep(i,n)         for(ll i=(ll)0; i<(ll)n; i++)
#define REP(i,m,n)       for(ll i=(ll)m; i<(ll)n; i++)
#define arr(var, n)      vint var(n); rep(i,n){cin >> var[i];}
#define arrll(var, n)    vll var(n); rep(i,n){cin >> var[i];}
#define arrst(var, n)    vstr var(n); rep(i,n){cin >> var[i];}
#define ALL(var)         (var).begin(), (var).end()
#define sortall(var)     sort(ALL(var))
#define uniqueall(v)     v.erase(unique(v.begin(), v.end()), v.end());

#define prt(var)         cout << (var) << "\n"
#define prt2(v1, v2)     cout << (v1) << " " << (v2) << "\n"
#define prt3(v1, v2, v3) cout << (v1) << " " << (v2) << " " << (v3) << "\n"
#define prtd(n, var)     cout << fixed << setprecision(n) << (var) << "\n"
#define prtfill(n, var)  cout << setw(n) << setfill('0') << (var);
#define prtall(v)        rep(i,v.size()){cout<<v[i]<<(i!=v.size()-1?" ":"\n");}
template <typename T>
bool chmax(T &a, const T& b){if(a<b){a=b; return true;} return false;}
template <typename T>
bool chmin(T &a, const T& b){if(a>b){a=b; return true;} return false;}
//-----------------------------------------------------------------------------
class Graph{

public:
  vector<vector<int>> graphs;
  vector<bool> check; // For DFS
  vector<ll> dist;   // For BFS
  queue<int> q; // For BFS

  Graph(int n){
    graphs.resize(n);
    init(n);
  }
  ~Graph(){}

  void addedge(int u, int v){
    u--; v--;
    graphs[u].push_back(v);
    graphs[v].push_back(u);
  }

  void addedge_cin(int m){
    rep(i,m){
      int a, b;
      cin >> a >> b;
      addedge(a, b);
    }
  }

  void init(int n){
    check.resize(n, false);
    dist.resize(n, -1);
  }

  void reset(){
    rep(i,check.size()){
      check[i]=false;
      dist[i]=-1;
    }
  }

  void dfs(int v){
    if(check[v]) return;
    check[v] = true;

    for(auto next_v : graphs[v]){
      if(check[next_v]) continue;
      dfs(next_v);
    }
  }

  void bfs(int v){
    dist[v] = 0;
    q.push(v);

    while(!q.empty()){
      int cur_v = q.front();
      q.pop();

      for(int next_v : graphs[cur_v]){
        if(dist[next_v] != -1){
          continue;
        }

        dist[next_v] = dist[cur_v] + 1;
        q.push(next_v);
      }
    }
  }

};

int main(void){
  int n, m;
  cin >> n >> m;
  Graph g(n);
  g.addedge_cin(m);

  int ans=0;
  rep(i,n){
    if(!g.check[i]){
      ans++;
      g.dfs(i);
    }
  }

  prt(ans-1);
}


Measured memory_bytes: 10392
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <math.h>

using namespace std;

int s[10001];

void sieve() {
    for(int i = 0; i < 10001; i++) s[i] = 1;
    s[0] = s[1] = 0;

    for(int i = 2; i <= sqrt(10001); i++) {
        if(s[i]) {
            for(int j = i * i; j < 10001; j += i) {
                s[j] = 0;
            }
        }
    }
}

int main() {
    sieve();
    int n;
    while(~scanf("%d", &n)) {
        if(n == 0) break;
        for(int i = n; i >= 2; i--) {
            if(s[i] && s[i - 2]) {
                printf("%d %d\n", i - 2, i);
                goto end;
            }
        }
        end:;
    }
}

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

int A, B, C;
  cin >> A >> B >> C;
  
  vector<int> vec = {A, B, C};
  sort(vec.begin(), vec.end());
  cout << vec.at(2) * 10 + vec.at(1) + vec.at(0);
  
return 0;
  
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
  int N, K; cin >> N >> K;
  int len; len=0;
  int l[55];
  for (int i=0; i<N; i++){
    cin >> l[i];
  }
  sort (l, l+N, greater<int>());
  for (int i=0; i<K; i++){
    len = len + l[i];
  }
  cout << len << endl;
}

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


signed main(){
    ll x;
    cin >> x;
    ll ans=0;
    ans+=(x/500)*1000;
    x=x%500;
    ans+=(x/5)*5;
    cout << ans << endl;

}

Measured memory_bytes: 256
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int sx = sc.nextInt();
    int sy = sc.nextInt();
    int tx = sc.nextInt();
    int ty = sc.nextInt();
    int N = tx - sx + 1;
    int M = ty - sy + 1;
    String res = "";
    for(int i = 0; i < N - 1; i++) {
      res += "R";
    }
    for(int i = 0; i < M; i++) {
      res += "U";
    }
    for(int i = 0; i < N; i++) {
      res += "L";
    }
    for(int i = 0; i < M; i++) {
      res += "D";
    }
    res += "RD";
    for(int i = 0; i < N; i++) {
      res += "R";
    }
    for(int i = 0; i < M; i++) {
      res += "U";
    }
    for(int i = 0; i < N; i++) {
      res += "L";
    }
    for(int i = 0; i < M - 1; i++) {
      res += "D";
    }
    System.out.println(res);
  }
}

Measured memory_bytes: 207044
#include<bits/stdc++.h>
#define int long long
#define fi first
#define se second
#define pii pair<int,int>
#define mp make_pair
#define tp tuple<int,int,int>
#define mtp make_tuple
using namespace std;


main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int a,b,c,k;
    cin>>a>>b>>c>>k;
    if(k<=a) return cout<<k,0;
    if(k<=a+b) return cout<<a,0;
    else cout<<a-(k-a-b);
}


Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vb = vector<bool>;
using vl = vector<long>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvb = vector<vector<bool>>;
using vvc = vector<vector<char>>;
using pii = pair<int, int>;
using pll = pair<long, long>;
#define fix20 cout << fixed << setprecision(20);
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define MOD 1000000007

long dic1[10] = {2,10,5,4,3,2,2,2,2,2};
long nextnum[10] = {0,1,1,3,3,1,3,5,7,9};

int main(){
  long m;
  cin >> m;
  vector<int> d(m);
  vector<long> c(m);
  rep(i,m){
    cin >> d.at(i) >> c.at(i);
  }
  long ans = 0;
  long stock = 0;
  long minus = 0;
  rep(i,m){
    if(d.at(i) == 0){
      ans += c.at(i);
      c.at(i) = 0;
    }else{
      stock += c.at(i)*d.at(i);
      minus += c.at(i)*(d.at(i)-1);
    }
  }
  while(stock >= 10){
    long G = 10;
    long trans = stock%G + stock/G;
    ans += (stock/G) * G;
    stock = trans;
  }
  ans += stock - 1;
  cout << ans - minus << endl;
}


Measured memory_bytes: 2560
#include <iostream>

using namespace std;

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

	int ans = 0;
	for (int i = 0; i < 4; i++) {
		if (s[i] == '2') {
			ans++;
		}
	}
	cout << ans << '\n';
	return 0;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func Scan() string {
	sc.Scan()
	return sc.Text()
}
func iScan() int {
	n, _ := strconv.Atoi(Scan())
	return n
}
func fScan() float64 {
	n, _ := strconv.ParseFloat(Scan(), 64)
	return n
}
func stringToInt(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}
func SScan(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = Scan()
	}
	return a
}
func iSScan(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = iScan()
	}
	return a
}
func abs(x int) int {
	if x < 0 {
		x = -x
	}
	return x
}
func larger(a, b int) int {
	if a < b {
		return b
	} else {
		return a
	}
}
func smaller(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}
func max(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x < a[i] {
			x = a[i]
		}
	}
	return x
}
func min(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x > a[i] {
			x = a[i]
		}
	}
	return x
}
func sum(a []int) int {
	x := 0
	for _, v := range a {
		x += v
	}
	return x
}

var mod int = 1000000007

func main() {
	buf := make([]byte, 0)
	sc.Buffer(buf, mod)
	sc.Split(bufio.ScanWords)
	n := iScan()
	k := iScan()
	h := iSScan(n)
	sort.Ints(h)
	ans := mod * mod
	for i := 0; i+k-1 < n; i++ {
		ans = smaller(h[i+k-1]-h[i], ans)
	}
	fmt.Println(ans)
}


Measured memory_bytes: 4192
program main
  implicit none
  integer, parameter :: imax = 1010000
  integer :: d, n, i, cnt
  read(*, *) d, n
  cnt = 0
  do i = 1, imax
    if (div_hund(i) == d) then
      cnt = cnt + 1
      if (cnt == n) then
        write(*, "(i0)") i
        stop 0
      end if
    end if
  end do

  contains

  function div_hund(k)
    implicit none
    integer, intent(in) :: k
    integer :: div_hund, i, kcp
    if (k <= 0) stop 3
    kcp = k
    div_hund = 0
    do i = 1, 100
      if (mod(kcp, 100) == 0) then
        div_hund = div_hund + 1
        kcp = kcp / 100
      else
        exit
      end if
    end do
  end function div_hund
end program main


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

int main()
{
    string s;
    cin>>s;
    ll k;
    cin>>k;
    int n = s.size();
    ll cnt = 0;
    bool cha[n + 1];
    for(int i = 0 ; i <= n  ; i++)
    {
        cha[i] = 0;
    }

    if(n == 1)
    {
        cout<<(k/2)<<endl;
        return 0;
    }

    char a = s[0];
    char b = s[n-1];

    if(a != b)
    {
        for(int i = 1 ; i < n ; i++)
        {
            if(s[i] == s[i - 1])
            {
                cnt++;
                i++;
            }
        }

        cout<<(k*cnt)<<endl;
    }
    else
    {
        ll ct = 0;
        for(int i = 0 ; i < n - 1 ; i++)
        {
            if(s[i] == a) ct++;
            else break;
        }

        ll bt = 0;
        for(int i = n - 1 ; i >= 0 ; i--)
        {
            if(s[i] == a) bt++;
            else break;
        }

        if(ct + bt >= n)
        {
             ll ans = n*k;
            ans /= 2;
            cout<<ans<<endl;
        }
        else
        {
            cnt += (ct/2);
            cnt += (bt/2);

            ll lop = 0;
            for(int j = ct + 1; j <= n - bt - 1 ; j++)
            {
                if(s[j] == s[j - 1])
                {
                    lop++;
                    j++;
                }
            }

            cnt += (k*(lop));

            ct += bt;
            ct /= 2;
            cnt += ((k-1)*ct);
            cout<<cnt<<endl;
        }
    }
}

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

AL = [0]
for i in range(N):
    AL.append(AL[-1] + A[i])
BL = [0]
for i in range(M):
    BL.append(BL[-1] + B[i])

ans = 0
from bisect import bisect_right
for i in range(N+1):
    zan = K - AL[i]
    if zan < 0:
        break
    ind = bisect_right(BL, zan) - 1
    ans = max(ans, i + ind)

print(ans)


Measured memory_bytes: 127256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long p=0,i;
	string s;
	cin >> s;
	for(i=0;i<s.length();i++)
	{
		if(i%2==0)
		{
			if(s[i]=='R'||s[i]=='U'||s[i]=='D')
			{
				p++;
			}
		}
		else
		{
			if(s[i]=='L'||s[i]=='U'||s[i]=='D')
			{
				p++;
			}
		}
	}
   if(p==s.length())
   {
   	cout << "Yes";
   }
   else
   cout << "No";
}

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

int main(void)
{
    double x = 0, y = 0;
    int angle = 90;
    int d, a;

    while (scanf("%d,%d", &d, &a), d){
        double theta = angle * acos(-1) / 180;
        x += d * cos(theta);
        y += d * sin(theta);
        angle = (angle - a + 360) % 360;
    }

    printf("%d\n", (int)x);
    printf("%d\n", (int)y);

    return 0;
}

Measured memory_bytes: 604
#include <bits/stdc++.h>
using namespace std;
#define rep(i, m, n) for (int i = m; i < n; ++i)
#define rem(i, m, n) for (int i = m; i >= n; --i)
typedef long long ll;
#define mod 1000000007
template<class T>bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }

int main() {
  int N; cin >> N;
  string S; cin >> S;
  vector<ll> cnt(26, 1);
  for(auto &p:S) {
    cnt[p - 'a']++;
  }
  ll ans = 1;
  rep(i, 0, 26) {
    ans = (ans * cnt[i]) % mod;
  }
  cout << ans - 1 << endl;
  return 0;
}


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

int main() {
    int a,b;
    cin >> a >> b;
    if(a - b > 1){
        cout << a * 2 - 1 << endl;
    }else if(b - a > 1){
        cout << b * 2 - 1 << endl;
    }else{
        cout << a + b << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rng(i, a, b) for (int i = int(a); i < int(b); i++)
#define rep(i, b) rng(i, 0, b)
#define gnr(i, a, b) for (int i = int(b) - 1; i >= int(a); i--)
#define per(i, b) gnr(i, 0, b)
#define bg begin()
#define ed end()
#define all(x) x.bg, x.ed
#define vi vector<int>
template <class t, class u>
bool chmax(t &a, u b)
{
    if (a < b)
    {
        a = b;
        return true;
    }
    return false;
}
template <class t, class u>
bool chmin(t &a, u b)
{
    if (b < a)
    {
        a = b;
        return true;
    }
    return false;
}

signed main()
{
    int l,r;
    cin >> l >> r;
    if(r-l>=2019){
        cout << 0 << endl;
    }
    else{
        int a=l%2019;
        int b=r%2019;
        if(a>b){
            cout << 0 << endl;
        }
        else {
            int c = 10000;
            for (int i = a; i <= b; i++)
            {
                for (int j = i + 1; j <= b;j++){
                    chmin(c, i * j % 2019);
                }
            }
            cout << c << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 3620
import sys
input = sys.stdin.readline

def main():
    n = int(input())
    a = list(map(int, input().split()))
    a.sort(reverse=True)

    score_a = sum(a[::2])
    score_b = sum(a[1::2])
    print(score_a - score_b)

if __name__ == '__main__':
    main()


Measured memory_bytes: 9124
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<array>
#include<map>
#include<iomanip>
#include<assert.h>
#include<list>
#include<bitset>
#include<stack>
#include<memory>
using namespace std;
using namespace std::chrono;
typedef long long int llint;
typedef double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
/*cout<<fixed<<setprecision(20);cin.tie(0);ios::sync_with_stdio(false);*/
const llint mod=998244353;
const llint big=2.19e15+1;
const long double pai=3.141592653589793238462643383279502884197;
const long double eps=1e-15;
template <class T,class U>bool mineq(T& a,U b){if(a>b){a=b;return true;}return false;}
template <class T,class U>bool maxeq(T& a,U b){if(a<b){a=b;return true;}return false;}
llint gcd(llint a,llint b){if(a%b==0){return b;}else return gcd(b,a%b);}
llint lcm(llint a,llint b){if(a==0){return b;}return a/gcd(a,b)*b;}
template<class T> void SO(T& ve){sort(ve.begin(),ve.end());}
template<class T> void REV(T& ve){reverse(ve.begin(),ve.end());}
template<class T>llint LBI(const vector<T>&ar,T in){return lower_bound(ar.begin(),ar.end(),in)-ar.begin();}
template<class T>llint UBI(const vector<T>&ar,T in){return upper_bound(ar.begin(),ar.end(),in)-ar.begin();}
//16:35~
int main(void){
	cout<<fixed<<setprecision(20);
	cin.tie(0);ios::sync_with_stdio(false);
	int n,k,q,i;cin>>n>>k>>q;
	vector<int>a(n);
	for(i=0;i<q;i++){int x;cin>>x;x--;a[x]++;}
	for(i=0;i<n;i++){cout<<(k-q+a[i]>0?"Yes":"No")<<endl;}
	return 0;
}

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

#define int         long long
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define x           first
#define y           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define hell        1000000000000007LL
#define rep(i,a,b)  for(int i=a;i<b;i++)
using namespace std;
int n,w[1001],s[1001],val[1001];
vi v;
int dp[1001][20001];
int sol(int pos,int weight){
    if(weight<0) return -hell;
    if(pos==sz(v)) return 0;
    if(dp[pos][weight]!=-1) return dp[pos][weight];
    int ans=0;
    ans=max(ans,sol(pos+1,weight));
    ans=max(ans,sol(pos+1,min(weight-w[v[pos]],s[v[pos]]))+val[v[pos]]);
    return dp[pos][weight]=ans;
}
void solve(){
    cin>>n;
    rep(i,1,n+1){
        cin>>w[i]>>s[i]>>val[i];
        v.pb(i);
    }
    sort(all(v),[](int l,int r){
        return s[l]-w[r]>s[r]-w[l];
    });
    memset(dp,-1,sizeof dp);
    cout<<sol(0,20000)<<endl;
}

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t=1;
    // cin>>t;
    while(t--){
        solve();
    }
    return 0;
}

Measured memory_bytes: 156800
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;
import java.util.TreeMap;
import java.util.*;

class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;

    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        } else {
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }

    private int readByte() {
        if (hasNextByte())
            return buffer[ptr++];
        else
            return -1;
    }

    private static boolean isPrintableChar(int c) {
        return 33 <= c && c <= 126;
    }

    public boolean hasNext() {
        while (hasNextByte() && !isPrintableChar(buffer[ptr]))
            ptr++;
        return hasNextByte();
    }

    public String next() {
        if (!hasNext())
            throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while (isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    public long nextLong() {
        if (!hasNext())
            throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while (true) {
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            } else if (b == -1 || !isPrintableChar(b)) {
                return minus ? -n : n;
            } else {
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }

    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
            throw new NumberFormatException();
        return (int) nl;
    }

    public double nextDouble() {
        return Double.parseDouble(next());
    }
}

public class Main {
    static int[] w = new int[100010];
    static int[] v = new int[100010];
    static int[][] dp = new int[110][100010];
    static int k;

    static int chmin(int a, int b) {
        if (a > b) {
            a = b;
            return a;
        }
        return a;
    }

    static int chmax(int a, int b) {
        if (a < b) {
            a = b;
            return a;
        }
        return a;
    }

    public static void main(String[] args) {
        FastScanner fs = new FastScanner();
        int n = fs.nextInt();
        int i = n;
        int x = 0;
        while (n > 0) {
            x += n % 10;
            n /= 10;
        }

        System.out.println(i % x == 0 ? "Yes" : "No");
    }

}


Measured memory_bytes: 79444