akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const ll maxn = 100010;
ll n,prime[3000],vis[3000],tot;
ll a[maxn],c1[maxn * 2],c2[maxn * 2],ans,sizee[maxn * 2];
map<ll,ll> M;
bool flag = false;

void prework()
{
    ll limit = 2560;
    for (ll i = 2; i <= limit; i++)
    {
        if (!vis[i])
            prime[++tot] = i;
        for (ll j = 1; j <= tot; j++)
        {
            ll t = prime[j] * i;
            if (t > limit)
                break;
            vis[t] = 1;
            if (i % prime[j] == 0)
                break;
        }
    }
}

bool check(ll x)
{
    ll y = sqrt(x);
    if (y * y == x)
        return true;
    return false;
}

int main()
{
    prework();
    scanf("%lld",&n);
    for (ll i = 1; i <= n; i++)
        scanf("%lld",&a[i]);
    for (ll i = 1; i <= n; i++)
    {
        ll x = a[i];
        c1[i] = c2[i] = 1;
        for (ll j = 1; j <= tot && prime[j] * prime[j] <= x; j++)
            if (x % prime[j] == 0)
            {
                ll num = 0;
                while (x % prime[j] == 0)
                {
                    num++;
                    x /= prime[j];
                }
                if (num % 3 == 1)
                {
                    c1[i] *= prime[j];
                    c2[i] *= prime[j] * prime[j];
                }
                else if (num % 3 == 2)
                {
                    c1[i] *= prime[j] * prime[j];
                    c2[i] *= prime[j];
                }
            }
        if (x != 1)
        {
            if (check(x))
            {
                c1[i] *= x;
                c2[i] *= sqrt(x);
            }
            else
            {
                c1[i] *= x;
                c2[i] *= x * x;
            }
        }
        if (c1[i] == 1 && c2[i] == 1)
            flag = true;
    }
    for (ll i = 1; i <= n; i++)
    {
        if (!M.count(c1[i]))
        {
            M[c1[i]] = i;
            M[c2[i]] = i + n;
            sizee[i]++;
        }
        else
            sizee[M[c1[i]]]++;
    }
    for (ll i = 1; i <= n; i++)
        if (i == M[c1[i]])
            ans += max(sizee[i],sizee[i + n]);
    if (flag)
        ans++;
    printf("%lld\n",ans);

    return 0;
}


Measured memory_bytes: 16896
//的場梨沙★担当
//結城晴★副担当
//日野茜★副担当
#include <vector>
#include <list>
#include <map>
#include <climits>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string.h>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
#include <random>
#include <cctype>
#include <complex>
#include <regex>
#include <unordered_map>
#include <string>
#include <algorithm>
#include <cctype>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <iomanip>
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <stdio.h>


using namespace std;

int main(void) {
    string S;
    cin>>S;

    if(S=="ABC"){
        cout<<"ARC"<<endl;
    }else{
        cout<<"ABC"<<endl;
    }
}


Measured memory_bytes: 3596
#include<bits/stdc++.h>
using namespace std;
#define int                 long long
#define FF(i,a,b)           for(int i=a;i<b;i++)
#define BF(i,a,b)           for(int i=a;i>=b;i--)
#define vi                  vector<int>
#define MAP                 map<int,int>
#define pb                  push_back
#define MP                  make_pair
#define F                   first
#define S                   second
#define pi                  pair<int,int>
#define all(v)              v.begin(),v.end()
#define PIE                 3.1415926535897932384626433832795
#define print0(a)           cout<<a<<"\n"
#define print1(a)           cout<<a<<' '
#define print2(a,b)         cout<<a<<" "<<b<<" ";
#define print3(a,b,c)       cout<<a<<" "<<b<<" "<<c<<" ";
#define print4(a,b,c,d)     cout<<a<<" "<<b<<" "<<c<<" "<<d<<" ";
#define FastIO              ios::sync_with_stdio(0); cin.tie(0);cout.tie(0)
/**************************************************************************************/
                       /*Global Variables*/
const int mod = 1e9+7;
const int N = 2e5+10;
const int inf = 1e18;
vector<int> g[N];

/**************************************************************************************/
template <typename A>istream& operator>>(istream& input,vector<A>& x) {for(auto& i:x)input>>i;return input;}
template<typename A>ostream& operator<<(ostream& output,vector<A>& x) {for(auto& i:x)output<<i<<' ';return output;}
template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(b<a)a=b;}
int add(int a, int b){return (a%mod + b%mod + mod)%mod;}
int sub(int a, int b){return (a%mod - b%mod + mod)%mod;}
int mul(int a, int b){return ((a%mod)*(b%mod) + mod)%mod;}
int Power(int a,int b)
{
    int res=1;
    while(b)
    {
        if(b&1)res*=a;
        a*=a;
        b>>=1;
    }
    return res;
}
signed main()
{
    // #ifndef ONLINE_JUDGE
    // freopen("input.txt","r",stdin);
    // freopen("output.txt","w",stdout);
    // #endif
    FastIO;
    int T=1;
    //cin>>T;
    while(T--)
    {
       int n;
       cin>>n;
       n--;
       int ans = ((n)*(n+1))/2;
       cout<<ans<<"\n";

       
    }

}
/*
|| Do what you can with all you have,wherever you are. ||

|| Knowing is not enough, we must apply. Wishing is not enough, we must do. ||

|| A goal is a dream with deadline. ||

|| Whether you think you can or you think you can't, you're right. ||
*/



Measured memory_bytes: 4992
#include <iostream>
#include <vector>

int main(int argc, char **argv)
{

    int N;
    std::cin >> N;

    std::vector<int> A(N);
    A.at(0) = 1;
    for(int i = 1; i < N; i++){
        std::cin >> A.at(i);
    }

    std::vector<int> BUKA(N, 0);
    for(int i = 1; i < N; i++){
        BUKA.at(A.at(i)-1) += 1;
    }

    for(int i = 0; i < N; i++){
        std::cout << BUKA.at(i) << std::endl;
    }
    
}


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

int main(void) {
    ios_base::sync_with_stdio(0); cin.tie(0);
    bool yes = true;
    string s;
    cin >> s;
    for(int i = 0; i < s.size(); ++i) {
        if(i % 2 == 0 && s[i] == 'L')   yes = false;
        if(i % 2 == 1 && s[i] == 'R')   yes = false;
    }
    if(yes) cout << "Yes";
    else    cout << "No";
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
int last[500];
long long s[500][30];
long long c[30];
int tt[500];

long long getD(int d){
    for(int i = 1; i <= 26; i++) last[i] = 0;
    long long cur = 0;
    for(int i = 1; i <= d; i++){
        int t = tt[i];
        cur += s[i][t];
        last[t] = i;
        for(int j = 1; j <= 26; j++) cur -= c[j]*(i-last[j]);
    }
    return  cur;
}

int main(){
    int d;
    scanf("%d",&d);
    for(int i = 1; i <= 26; i++) scanf("%lld",&c[i]);
    for(int i = 1; i <= d; i++){
        for(int j = 1; j <= 26; j++) scanf("%lld",&s[i][j]);
    }
    for(int i = 1; i <= d; i++) scanf("%d",&tt[i]);
    int q;
    scanf("%d",&q);
    while(q--){
        int d0, q0;
        scanf("%d%d",&d0,&q0);
        tt[d0] = q0;
        printf("%lld\n",getD(d));
    }
    
    return 0;
}


Measured memory_bytes: 1820
package main

import (
	"fmt"
	"sort"
)

type Count struct {
	str   string
	count int
}

type Counts []Count

func (c Counts) Len() int {
	return len(c)
}

func (c Counts) Swap(i, j int) {
	c[i], c[j] = c[j], c[i]
}

func (c Counts) Less(i, j int) bool {
	if c[i].count > c[j].count {
		return true
	}
	if c[i].count < c[j].count {
		return false
	}
	return c[i].str < c[j].str
}

func count(Ss []string) []Count {
	m := map[string]int{}

	for _, S := range Ss {
		if _, ok := m[S]; !ok {
			m[S] = 0
		}
		m[S]++
	}

	var cs []Count
	for k, v := range m {
		cs = append(cs, Count{
			str:   k,
			count: v,
		})
	}

	return cs
}

func main() {
	var N int
	fmt.Scan(&N)

	Ss := make([]string, N)
	for i := 0; i < N; i++ {
		fmt.Scan(&Ss[i])
	}

	cs := Counts(count(Ss))
	sort.Sort(cs)
	maxCount := cs[0].count
	for _, c := range cs {
		if c.count < maxCount {
			break
		}
		fmt.Println(c.str)
	}
}


Measured memory_bytes: 44672
import java.util.*;

class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = Integer.parseInt(sc.nextLine());
    List<Boolean[]> F = new ArrayList<>();
    List<int[]> P = new ArrayList<>();
    for (int i = 0; i < N; i++) {
      F.add(Arrays.stream(sc.nextLine().split(" ")).map(e -> e.equals("1")).toArray(Boolean[]::new));
    }
    for (int i = 0; i < N; i++) {
      P.add(Arrays.stream(sc.nextLine().split(" ")).mapToInt(Integer::parseInt).toArray());
    }
    int max = Integer.MIN_VALUE;
    for (int i = 1; i < Math.pow(2,10); i++) {
      int total = 0;
      for (int j = 0; j < N; j++) {
        int count = 0;
        for (int k = 0; k < 10; k++) {
          if ((1 & i >> k) == 1 && F.get(j)[k]) {
            count++;
          }
        }
        total += P.get(j)[count];
      }
      max = Math.max(max, total);
    }
    System.out.println(max);
  }
}

Measured memory_bytes: 27348
#include <iostream>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <random>
#include <chrono>
#include <string>
#include <bitset>
#include <cassert>
#include <queue>
#include <memory>

//#pragma comment(linker, "/STACK:16777216")
//#pragma GCC optimize("O3")
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC optimize("unswitch-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,sse4.1,sse4.2,abm,mmx,avx,avx2,popcnt,tune=native")

using namespace std;

//mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());

#define ll long long
#define ull unsigned long long
//#define double long double
//#define int ll
//#define int ull
//#define int short
//#define int unsigned short
//#define int unsigned int
#define mp make_pair
#define F first
#define S second
#define pii pair<int, int>
#define hash hash228
#define get get228
const int SZ = 1e3 + 4;
const double EPS = 1e-7;
const int mod = 998244353;
const int hashpow = 127;
const int inf = 2e9;

#define kek cout << "kek"

int n;

void read() {
    cin >> n;
}

void perebor(string &s, int i, int last) {
    if (i < n) {
        for (int j = 0; j < last; ++j) {
            s.push_back('a' + j);
            perebor(s, i + 1, last);
            s.pop_back();
        }
        s.push_back('a' + last);
        perebor(s, i + 1, last + 1);
        s.pop_back();
    } else {
        cout << s << "\n";
    }
}

void solve() {
    string s = "";
    perebor(s, 0, 0);
}

signed main() {

#ifdef __LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#else
    ios_base::sync_with_stdio(0);
    cin.tie(0);
#endif

//    int t;
//    cin >> t;
//    for (int i = 0; i < t; ++i) {
    read();
    solve();
//    }

    return 0;
}

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

int h,w;
const int B=20000;
int a[81][81],b[81][81];
bool dp[81][81][161*81+B];
int main(){
    cin>>h>>w;
    rep(i,h)rep(j,w) cin>>a[i][j];
    rep(i,h)rep(j,w) cin>>b[i][j];
    dp[0][0][abs(a[0][0]-b[0][0])+B]=true;
    dp[0][0][-abs(a[0][0]-b[0][0])+B]=true;
    rep(i,h)rep(j,w)rep(k,161*81+B){
        if(i>0){
            dp[i][j][k+abs(a[i][j]-b[i][j])]|=dp[i-1][j][k];
            dp[i][j][k-abs(a[i][j]-b[i][j])]|=dp[i-1][j][k];
        }
        if(j>0){
            dp[i][j][k+abs(a[i][j]-b[i][j])]|=dp[i][j-1][k];
            dp[i][j][k-abs(a[i][j]-b[i][j])]|=dp[i][j-1][k];
        }
    }
    rep(i,161*81)if(dp[h-1][w-1][i+B]||dp[h-1][w-1][B-i]){
        cout<<i<<endl;
        break;
    }
    return 0;
}

Measured memory_bytes: 208640
from bisect import bisect

n = int(input())
A = list(map(int, input().split()))
A.sort()
b = A.pop()
m = b / 2
i = bisect(A, m)
A.insert(i, m)

if i == 0:
    print(b, A[1])
elif i == len(A) - 1:
    print(b, A[-2])
elif A[i] - A[i - 1] < A[i + 1] - A[i]:
    print(b, A[i - 1])
else:
    print(b, A[i + 1])


Measured memory_bytes: 62704
n = int(input())
t, a = map(int, input().split())
h = list(map(int, input().split()))
p = 10 ** 10
ans = 0
for i in range(n):
    if abs(a - (t - (h[i] * 0.006))) < p:
        ans = i + 1
        p = abs(a - (t - (h[i] * 0.006)))
print(ans)


Measured memory_bytes: 3060
#include <stdio.h>
int main(){
	int a;
	scanf("%d",&a);
	int b;
	scanf("%d",&b);
	b--;
	double ans = (double)b / (a - 1);
	if(ans > (int)ans){
		ans++;
		}
	printf("%d",(int)ans);
     return 0;
}
		


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

int main(){
        ios_base::sync_with_stdio(false);
        cin.tie(NULL);
        #ifndef ONLINE_JUDGE
            freopen("input.txt","r",stdin);
            freopen("output.txt","w",stdout);
        #endif
        ll n;cin>>n;
        cout<<1-n;
}


Measured memory_bytes: 3648
#include <iostream>

using namespace std;


int main(){
    int n, k;

    cin >> n >> k;
    int a[n + 1], dp[k + 1];

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

    for(int i = 0; i <= k; i++){
        dp[i]=0;
    }

    for(int i = 1; i <= k; i++){
        for(int j = 0; j < n; j++){
            if(i - a[j] >=0 && !dp[i - a[j] ] ){
                dp[i] = true;
            }
        }
    }


    if(dp[k])
        cout << "First" ;
    else
        cout << "Second" ;


    return 0;
}


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

int main(){
	// sengen
	string s,t;
	// nyuryoku
	cin >> s >> t;
	int l1 = s.size(),l2 = t.size();
	int suit = 0,tmp;
	// keisan
	for(int i=0;i<=l1 - l2;i++){
		tmp = 0;
		for(int j=0;j<l2;j++){
			if(s[i+j] == t[j]){
				tmp++;
			}
		}
		suit = max(suit,tmp);
	}
	// syutsuryoku
	cout << l2 - suit << endl;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(I,A,B) for(ll I = (A); I < (B); ++I)
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin()) //ai>=v  x is sorted
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin()) //ai>v  x is sorted
#define NUM(x,v) (POSU(x,v)-POSL(x,v))  //x is sorted
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define REV(x) (reverse(x.begin(),x.end())) //reverse
#define TO(x,t,f) ((x)?(t):(f))
#define CLR(mat) memset(mat, 0, sizeof(mat))
#define FILV(x,a) fill(x.begin(),x.end(),a)
#define FILA(ar,N,a) fill(ar,ar+N,a)
#define NEXTP(x) next_permutation(x.begin(),x.end())
ll gcd(ll a,ll b){if(a<b)swap(a,b);if(a%b==0)return b;else return gcd(b,a%b);}
ll lcm(ll a,ll b){ll c=gcd(a,b);return ((a/c)*(b/c)*c);}//saisyo kobaisu
#define pb push_back
#define pri(aa) cout<<(aa)<<endl

const ll INF=1e9+7;
const ll N = 102;
ll h,w;
string s;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin>>h>>w;
	FOR(i,0,h){
		cin>>s;
		cout<<s<<endl<<s<<endl;
	}
	return 0;
}

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

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl




typedef long long ll;
const ll mod = 1e9+7;
const int maxn = 333;



int n;
int a[maxn];



double dp[301][301][301];


double solve(int zero, int one, int two) {
    //cout<<state[0]<<" "<<state[1]<<" "<<state[2]<<" "<<state[3]<<endl;
    if (zero==n) return 0;
    if (dp[zero][one][two] > -0.5) return dp[zero][one][two];

    double num = n;

    if (one>0) {
	num += one*solve(zero+1,one-1,two);
    }
    if (two>0) {
	num += two*solve(zero,one+1,two-1);
    }
    
    int three = n-zero-one-two;
    if (three>0) {
	num += three*solve(zero,one,two+1);
    }

    double den = n-zero;
    return dp[zero][one][two] = (num/den);
	    
}

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0);  cout.tie(0);
    cin>>n;
    vector<int> f(3);
    for (int i=0; i<n; i++) {
	cin>>a[i];
	if (a[i]<3) f[a[i]]++;
    }
    for (int i=0; i<301; i++) {
	for (int j=0; j<301; j++) {
	    for (int k=0; k<301; k++) {
		dp[i][j][k]=-1;
	    }
	}
    }

    solve(f[0],f[1],f[2]);

    cout<<fixed<<setprecision(12)<<dp[f[0]][f[1]][f[2]]<<endl;

    return 0;
}


Measured memory_bytes: 213376
#include<stdio.h>

int main(void){
    int r, D, x;
    int i, s;

    scanf("%d %d %d",&r, &D, &x);

    for(i = 0; i < 10; i++){
        s = r * x - D;
        printf("%d\n", s);
        x = s;
    }
}

Measured memory_bytes: 128
// Tazoe

#include <iostream>
#include <algorithm>
using namespace std;

int main()
{
	while(true){
		int n;
		cin >> n;

		if(n==0)
			break;

		int S[100];

		int sum = 0;

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

		sort(S, S+n);

		cout << (sum-S[0]-S[n-1])/(n-2) << endl;
	}

	return 0;
}

Measured memory_bytes: 0
//in the name of god
#include <bits/stdc++.h>
using namespace std;
#define ios ios::sync_with_stdio(0)
#define int long long
const int maxn=1e5+7;
const long long INF=1<<32;
int dp[maxn][3];
int n;
int h[maxn];
int a[maxn],b[maxn],c[maxn];

int32_t main(){
    ios;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>a[i]>>b[i]>>c[i];
    }
    dp[0][0]=a[0];
    dp[0][1]=b[0];
    dp[0][2]=c[0];
    for(int i=1;i<n;i++){
        dp[i][0]=max(dp[i-1][1]+a[i],dp[i-1][2]+a[i]);
        dp[i][1]=max(dp[i-1][0]+b[i],dp[i-1][2]+b[i]);
        dp[i][2]=max(dp[i-1][0]+c[i],dp[i-1][1]+c[i]);
    }
    cout<<max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2]))<<endl;
}


Measured memory_bytes: 5760
#include <iostream>
#include <string> 
#include <vector> 
#include <algorithm> 
#include <utility> 
#include <tuple> 
#include <cstdint> 
#include <cstdio> 
#include <map> 
#include <queue> 
#include <set> 
#include <stack> 
#include <deque> 
#include <unordered_map> 
#include <unordered_set> 
#include <bitset> 
#include <cctype> 
#include <math.h>
#include <cmath>
using namespace std;

#define int long long
#define endl "\n"
#define all(v)  v.begin(),v.end()
#define fir first
#define sec second
#define fro front
#define m_p make_pair
#define rep(i,n)  for(int i=0; i<(int) (n); i++)
#define vecin(v) for(int i=0; i<(int)v.size(); i++)cin>>v[i];

const int mod = 1000000007;
const int INF = 2000000015;
const int MAX = 510000;
const int MOD = 1000000007;
long long fac[MAX], finv[MAX], inv[MAX];
int jousu(int x00, int y00) {
	int z00 = 1;
	for (int i = 0; i < y00; i++) {
		z00 *= x00;
	}
	return z00;
}
int keta(int x00) {
	int z00 = x00;
	int w00 = 0;
	while (z00 != 0) {
		z00 /= 10;
		w00++;
	}
	return w00;
}
int krag(double xx) {
	return INF - (int)(INF - xx);
}


int modinv(int a, int m) {
	int b = m, u = 1, v = 0;
	while (b) {
		int t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
int modpow(int a, int n) {
	int res = 1;
	while (n > 0) {
		if (n & 1) res=res* a% mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}
int com(int xx, int yy) {
	int zz = 1;
	for (int i = xx; i > xx - yy; i--) {
		zz *= i;
		zz %= mod;
	}
	for (int i = 1; i <= yy; i++) {
		zz *= modinv(i, mod);
		zz %= mod;
	}
	return zz;
}
int gcd(int xx, int yy) {
	int p = xx;
	int q = yy;
	if (q > p)swap(p, q);
	while (p % q != 0) {
		p %= q;
		swap(p, q);
	}
	return q;
}
int lcm(int xx, int yy) {
	return xx * yy / gcd(xx, yy);
}
bool prime(int xx) {
	int a = xx;
	for (int i = 2; i * i <= xx; i++) {
		if (xx % i == 0) {
			return 0;
		}
	}
	return 1;
}



signed main() {
	int a = 0,b=0;
	string s, t;
	cin >> s >> t;
	vector<int>s1(s.size()), t1(t.size());
	map<char, int>ma1, ma2;
	set<char>se1, se2;
	rep(i, s.size()) {
		if (!ma1.count(s[i])) {
			se1.insert(s[i]);
			ma1[s[i]] = a;
			a++;
		}
		s1[i] = ma1[s[i]];
		if (!ma2.count(t[i])) {
			se2.insert(s[i]);
			ma2[t[i]] = b;
			b++;
		}
		t1[i] = ma2[t[i]];
	}
	auto itr1 = se1.begin();
	auto itr2 = se2.begin();
	rep(i, se1.size()) {
		if (*itr1 != *itr2) {
			cout << "No" << endl;
			return 0;
		}
		itr1++;
		itr2++;
	}
	if (s1 == t1) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}

Measured memory_bytes: 3848
#include<bits/stdc++.h>
#define ll long long int
#define ul unsigned long long int
#define va vector<long long int> a 
#define vb vector<long long int> b
const ll M = 1e9+7;
const ll inf = 1e18+5;
using namespace std;
void fast(){cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(0);}
ll bs(ll arr[], ll l, ll r, ll x){
	ll mid=0;
    if (r >= l){
		if (arr[mid] == x) return mid; 
        if (arr[mid] > x) return bs(arr, l, mid - 1, x); 
        return bs(arr, mid + 1, r, x); 
    }
    return -1;
}
ll power(ll x,ul y,ll p){
	ll res = 1;
	x = x % p;
	if(x == 0) return 0;
	while (y > 0){
		if (y & 1) res = (res*x) % p;
		y = y>>1;
		x = (x*x) % p;
		}
	return res;
}
void solve(){
	ll x;
	cin>>x;
	if(x>=30) cout<<"Yes\n";
	else cout<<"No\n";
 }
int main(){
	fast();
	solve();
	return 0;
}



Measured memory_bytes: 3656
use std::cmp::max;
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("filed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n:usize = read();
    let s:String = read();
    let mut chars:Vec<char> = s.chars().collect();
    let mut ans = 0;
    for i in 1..n {
        let mut arr:Vec<char> = chars[0..i].to_vec();
        arr.sort();
        arr.dedup();
        let mut tmp = 0;
        let arr2 = chars[i..n].to_vec();
        for c in &arr {
            if arr2.contains(c) {
                tmp += 1;
            }
        }
        ans = max(ans, tmp);
    }
    println!("{}", ans);
}


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

const long long int MOD = 1e9 + 7;

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

    vector<int> fib(10,0);
    fib[0] = 1;
    fib[1] = 1;
    fib[2] = 1;
    for(int i=3; i<10; i++){
        if(fib[i] == 0){
            fib[i] = fib[i-1] + fib[i-2];
        }
    }

    vector<vector<long long int>> dp(h+1, vector<long long int>(w+2, 0));// dp[i][r] = r-th row at height i
    // dp[i][0] = 0;
    // dp[i][w+1] = 0;
    // dp[0][r] = 0
    dp[0][1] = 1;

    for(int i=1; i<=h; i++){
        for(int j=1; j<=w; j++){
            dp[i][j] = (fib[(j-2)+1] * fib[w-(j+1)+2] * dp[i-1][j-1] % MOD
                     +  fib[(j-1)+1] * fib[w-(j+1)+2] * dp[i-1][j]   % MOD
                     +  fib[(j-1)+1] * fib[w-(j+2)+2] * dp[i-1][j+1] % MOD) % MOD;
        }
    }
    cout << dp[h][k] << endl;
    return 0;
}

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

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
#define rep(i, n) for(int i = 0; i < n; i++)

typedef long long ll;
typedef pair<int, int> the;

const int INF = 1 << 29;
const ll LINF = 1LL << 60;
const int R = 1e9 + 7;

vector<string> G;
vector<vector<ll> > dp;
int h, w;

int main()
{
	cin >> h >> w;
	G.resize(h);
	rep(i, h)  cin >> G[i];

	dp.resize(h, vector<ll>(w, 0));  //初期化
	dp[0][0] = 1;  //初期条件
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			if (i + 1 < h && G[i + 1][j] != '#')  dp[i + 1][j] += dp[i][j] % R;
			if (j + 1 < w && G[i][j + 1] != '#')  dp[i][j + 1] += dp[i][j] % R;
		}
	}
	cout << dp[h - 1][w - 1] % R << endl;
}

Measured memory_bytes: 9216
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
#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 REP(i, n) FOR(i, 0, (n))
#define REPR(i, n) FORR(i, (n) - 1, 0)
#define REP1(i, n) FOR(i, 1, (n) + 1)
#define ALL(c) (c).begin(), (c).end()
#define sz(v) (int)v.size()
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;}
const int MOD = 1000000007;
const int INF = 1000000001;
const ll LINF = 1000000001000000001LL;
const char EOL = '\n';
 
void solve();
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(numeric_limits<double>::max_digits10);
    solve();
    return 0;
}
 

void solve() {
    int n;
    cin >> n;
    vector<int> h(n);
    REP(i, n) cin >> h[i];
    
    function<int(vector<int>)> rec = [&](vector<int> v) {
        int m = sz(v);
        int mn = INF;
        REP(i, m) chmin(mn, v[i]);
        int ret = mn;
        int l = 0;
        REP(i, m) {
            v[i] -= mn;
            if (v[i] == 0) {
                if (i != l) {
                    vector<int> u(i - l);
                    REP(j, i - l) u[j] = v[l + j];
                    ret += rec(u);
                }
                l = i + 1;
            }
        }
        if (l != m) {
            vector<int> u(m - l);
            REP(j, m - l) u[j] = v[l + j];
            ret += rec(u);
        }
        return ret;
    };

    cout << rec(h) << EOL;
}


Measured memory_bytes: 384
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef pair<double, ll> pdlg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef tuple<double, double, double> tddd;

int main(void){
  int input;
  cin >> input;

  string str = to_string(input);
  int s = 0;
  for(int i = 0; i < str.size(); i++){
    int strint = (int)str[i];
    int temp = (strint - '0');
    s += temp;
  }
  if(input%s == 0){
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}

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

int main(){
  int N;
  cin >> N;
  
  double ans;
  if(N % 2 == 0){
    ans = 0.5;
  }
  else{
    ans = (N / 2 + 1) / (double)N;
  }

  cout << fixed << setprecision(10);
  cout << ans << endl; 
}

Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n = read::<usize>();
    let k = read::<usize>();
    println!("{}", if n % k > 0 { 1 } else { 0 });
}


Measured memory_bytes: 4352
/**
 *   @FileName	f.cpp
 *   @Author	kanpurin
 *   @Created	2020.09.19 21:52:53
**/

#include "bits/stdc++.h" 
using namespace std; 
typedef long long ll;

int main() {
    int n,q;cin >> n >> q;
    vector<int> h(n,-1),w(n,-1);
    int h_min = n-1,w_min = n-1;
    ll ans = (ll)(n-2) * (n-2);
    while(q--) {
        int t,x;cin >> t >> x;
        x--;
        if (t == 1) {
            if (x < w_min) {
                ans -= max(0,h_min-1);
                for(int i = x; i < w_min;i++) {
                    w[i] = h_min;
                }
                w_min = x;
            }
            else {
                ans -= max(0,w[x]-1);
            }
        }
        else {
            if (x < h_min) {
                ans -= max(0,w_min-1);
                for(int i = x; i < h_min;i++) {
                    h[i] = w_min;
                }
                h_min = x;
            }
            else {
                ans -= max(0,h[x]-1);
            }
        }
        
        
        
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4776
n=int(input())
p=list(map(int,input().split()))
ans=0
for i in range(n-1):
  q=p[i]
  if p[i]==i+1:
    p[i]=p[i+1]
    p[i+1]=q
    ans+=1
if p[n-1]==n:
  ans+=1
print(ans)

Measured memory_bytes: 20588
#include<bits/stdc++.h>
using namespace std;
int main(){
long long int i,j,c=0;
  //char s[6];
  cin>>i;
	j=i/500;
  c=(j*1000);
  i-=(j*500);
  j=i/5;
  c+=(j*5);
  cout<<c;
}


Measured memory_bytes: 384
#include <iostream>
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <map>

using namespace std;
#define LL long long
const int maxn = 1e5 + 10;
int a[maxn], b[maxn], book[maxn];
int n;
struct node
{
	int val, IS;
	int num;
}q[maxn * 2];
bool cmp(node a, node b)
{
	return a.val < b.val;
}
int main()
{
	scanf("%d", &n);
	for(int i = 1; i <= n; i ++)
		scanf("%d %d", &a[i], &b[i]);
	for(int i = 1; i <= n; i ++)
	{
		q[i].val = a[i]; q[i + n].val = b[i];
		q[i].IS = 1; q[i + n].IS = 0;
		q[i].num = i; q[i + n].num = i;
	}
	sort(a + 1, a + n + 1);
	sort(b + 1, b + n + 1);
	sort(q + 1, q + n * 2 + 1, cmp);
	int flag = 1;
	LL ans1 = 1e18, ans2 = 1e18, ans3 = 0;
	
	for(int i = 1; i <= n; i ++)
	{
		if(a[i] > b[i])
		{
			flag = 0;
			break;
		}
	}
	if(flag)
	{
		ans1 = 0;
		for(int i = 1; i <= n; i ++)
			ans1 += a[i];
	}
	//cout << "! " << ans1 << endl;
	flag = 1;
	for(int i = 1; i <= n; i ++)
	{
		if(b[i] > a[i])
		{
			flag = 0;
			break;
		}
	}
	if(flag)
	{
		ans2 = 0;
		for(int i = 1; i <= n; i ++)
			ans2 += b[i];
	}
	//cout << "! " << ans2 << endl;
	for(int i = 1; i <= n; i ++)
	{
		book[q[i].num] ++;
	}
	flag = 0;
	for(int i = 1; i <= n; i ++)
	{
		if(book[i] > 1)
		{
			flag = 1;
			break;
		}
	}
	if(flag)
	{
		for(int i = 1; i <= n; i ++)
			ans3 += q[i].val;
	}
	else
	{
		if(q[n].num != q[n + 1].num)
		{
			for(int i = 1; i < n; i ++)
				ans3 += q[i].val;
			ans3 += q[n + 1].val;
		}
		else
		{
			for(int i = 1; i < n; i ++)
				ans3 += q[i].val;
			if(q[n - 1].val + q[n + 2].val < q[n].val + q[n + 1].val)
				ans3 += q[n + 2].val;
			else
				ans3 = ans3 - q[n - 1].val + q[n].val + q[n + 1].val;
			/*
		ans3 = 1e18;
		LL sum = 0;
		for(int i = 1; i <= n; i ++)
			sum += q[i].val;
		//LL temp = ans3;
		for(int i = 1; i <= n; i ++)
		{
			LL t_ans = sum;
			t_ans -= q[i].val;
			if(q[n + 1].num == q[i].num)
				t_ans += q[n + 2].val;
			else
				t_ans += q[n + 1].val;
			ans3 = min (ans3, t_ans);
		}
			 */
		}
	}
	//cout << ans1 << " " << ans2 << " " << ans3 << endl;
	ans1 = min (ans1, ans2);
	ans1 = min (ans1, ans3);
	cout << ans1 << endl;
	return 0;
}


Measured memory_bytes: 3840
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>
#include <string>
#include <cstdio>
#include <cstring>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <bitset>

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

#define FALSE printf("false\n");
#define TRUE printf("true\n");
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i = 0;i < ((int)(n));++i)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define test(a) cout<<"line:"<<__LINE__<<"["<<(#a)<<": "<<(a)<<"]"<<endl

const int INF = 1e9+7;
const ll INFL = 9*1e18;

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

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

#define SUM(vec) accumulate(all(vec),0LL) // 配列の中身を全部足す
template<typename T>void print(T&& x){cout<<x<<endl;}// 改行付き出力
ll inline digit(ll num){int tmp = 0;while(num){tmp++;num/=10;}return tmp;} // 桁数
template<typename T>inline T digitSum(T num){T sum = 0;while(num){sum+=num%10;num/=10;}return sum;} // 各桁の和
template<typename T>inline T gcd(T a,T b){if(b == 0)return a;return gcd(b,a%b);} // 最大公約数
template<typename T>inline T lcm(T a, T b){T g = gcd(a,b);return a/g*b;} // 最小公倍数
template<typename T>inline T power(T a,T b){T tmp=1;rep(i,b){tmp*=a;}return tmp;} // 累乗
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
int ctoi(char c){return c-'0';}

// TODO: write
int main() {
  int n;cin>>n;
  print(++n/2);
  return 0;
}



Measured memory_bytes: 256
from collections import Counter
N = int(input())

def factorize(n):
    d = Counter()
    m = 2
    while m*m <= n:
        while n%m == 0:
            n //= m
            d[m] += 1
        m += 1
    if n > 1:
        d[n] += 1
    return d

factors = Counter()
for n in range(1,N+1):
    factors += factorize(n)

ans = 1
MOD = 10**9+7
for v in factors.values():
    ans = (ans * (v+1))%MOD
print(ans)


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

int main() {
  int N, M; cin >> N >> M;
  
  vector<int> likes(M, 0);
  
  for (int i = 0; i < N; i++) {
    int K; cin >> K;
    
    for (int j = 0; j < K; j++) {
      int A; cin >> A;
      likes.at(--A)++;
    }
  }
  
  int answer = 0;
  
  for (int a : likes) {
      if (a == N) answer++;
  }
  
  cout << answer << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <array>
#include <queue>
#include <utility>
#include <cstdint>
using namespace std;

int main() {
    int h, w; cin >> h >> w;
    vector<vector<char>> field(h, vector<char>(w));
    for (auto &a : field) for (auto &b : a) cin >> b;

    array<int, 4> dx = { -1, 1, 0, 0 };
    array<int, 4> dy = { 0, 0, -1, 1 };

    int64_t ans = 0;
    vector<vector<bool>> visited(h, vector<bool>(w, false));
    for (int i = 0; i < h; ++i) {
        for (int j = 0; j < w; ++j) {
            if (visited[i][j]) continue;
            visited[i][j] = true;

            array<int64_t, 2> count = { 0, 0 };
            queue<pair<int, int>> q;
            q.push({ i, j });

            while (q.size()) {
                auto [y, x] = q.front(); q.pop();

                ++count[field[y][x] == '#'];
                for (int k = 0; k < 4; ++k) {
                    int ax = x + dx[k];
                    int ay = y + dy[k];

                    if (0 <= ax && ax < w && 0 <= ay && ay < h && !visited[ay][ax] && field[y][x] != field[ay][ax]) {
                        q.push({ ay, ax });
                        visited[ay][ax] = true;
                    }
                }
            }

            ans += count[0] * count[1];
        }
    }

    cout << ans << endl;
}



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

int main(void){
  int a,b,c;
  int count = 0;
  cin >> a >> b >> c;
  for(int i = 1;i <= b;i++){
    if(i%a == 0){
      if(count < c){
        count++;
      }
    }
  }
  cout << count << "\n";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#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 fi first
#define se second
#define itrfor(itr,A) for(auto itr = A.begin(); itr !=A.end();itr++)
template <class T> using reversed_priority_queue = priority_queue<T, vector<T>, greater<T> >;
typedef long long llong;
char moji[26]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
char moji2[26]={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
char moji3[10]={'0','1','2','3','4','5','6','7','8','9'};
#define Sort(a) sort(a.begin(),a.end());
#define Reverse(a) reverse(a.begin(),a.end());
#define print(a) cout << a << endl;
#define MAX int(2 * 1e5 +5)


int main(){
    int n;
    llong A[MAX];
    cin >> n;
    REP(i,n) scanf("%lld",&A[i]);
    llong dp[MAX];
    dp[0] = 0;
    dp[1] = abs(A[1] - A[0]);
    FOR(i,2,n){
        dp[i] = min(abs(A[i] - A[i-1]) + dp[i-1] , abs(A[i] - A[i-2]) + dp[i-2]);
    }
    cout << dp[n-1] << endl;
}

Measured memory_bytes: 2816
import java.io.*;
import java.util.*;

class Main
{
    public static void main(String[] args)
    {
        Scanner sc = new Scanner(System.in);
        
        int n = sc.nextInt();
        
        for (int i = 1; i <= n; i++) {
            int x = i;
            if (x % 3 == 0) {
                System.out.printf(" %d", i);
                continue;
            }
            while (x > 0) {
                boolean endFlag = false;
                if (x % 10 == 3) {
                    System.out.printf(" %d", i);
                    endFlag = true;
                }
                if (endFlag) break;
                x /= 10;
            }
        }
    	System.out.printf("\n");           
    }
}

Measured memory_bytes: 38760
import scala.math._

// longでrangeの作り方

object Main extends App {

  val YES = "YES"
  val Yes = "Yes"
  val NO = "NO"
  val No = "No"
  ///////////////////////////////////////////

  val sc = new java.util.Scanner(System.in)
  val n = sc.nextInt
//  val list = List.fill(3)(sc.next)

  val paid = n * 800
  val received = n / 15 * 200
  val ans = paid - received

  println(ans)


  ///////////////////////////////////////////

  def bigIterator(start: BigInt, end: BigInt, step: BigInt = 1) =
    Iterator.iterate(start)(_ + step).takeWhile(_ <= end)

  def lcm(a :Int, b :Int): Int =
    a / gcd(a, b) * b

  def lcm(a :Long, b :Long): Long =
    a / gcd(a, b) * b

  def gcd(a: Int, b: Int): Int =
    if (b == 0) a else gcd(b, a % b)

  def gcd(a: Long, b: Long): Long =
    if (b == 0) a else gcd(b, a % b)

  def setOrUpdated[A, B](a: Map[A, B], key: A, value: B, f: (B, B) => B) =
    a.get(key) match {
      case Some(v) => a.updated(key, f(value, v))
      case _ => a + (key -> value)
    }
}

Measured memory_bytes: 25428
#include <stdio.h>

int main(void)
{

    int a, b, c, t;

    scanf("%d %d %d", &a, &b, &c);

    if (b < a) {
        t = a;
        a = b;
        b = t;
    }
    if (c < a) {
        t = c;
        c = a;
        a = t;
    }
    if (c < b) {
        t = c;
        c = b;
        b = t;
    }

    printf("%d %d %d\n", a, b, c);

    return 0;
}

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

int main() {
  int h, w;
  cin >> h >> w;
  vector<vector<char>> a(h, vector<char>(w));
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++)
      cin >> a.at(i).at(j);
  }
  vector<int> H(h, 0), W(w, 0);
  
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      if (a.at(i).at(j) == '#')
        break;
      if (j == w - 1)
        H.at(i) = 1;
    }
  }
  
  for (int j = 0; j < w; j++) {
    for (int i = 0; i < h; i++) {
      if (a.at(i).at(j) == '#')
        break;
      if (i == h - 1)
        W.at(j) = 1;
    }
  }
  
  for (int i = 0; i < h; i++) {
    if (H.at(i) == 0) {
      for (int j = 0; j < w; j++) {
        if (W.at(j) == 0)
          cout << a.at(i).at(j);
      }
      cout << endl;
    }
  }
  cout << endl;
}



Measured memory_bytes: 256
#include <iostream>

int main(){
	int S,h,m,s;
	std::cin >> S;
	h = S / 3600;
	m = (S - (h * 3600)) / 60;
	s = S - (h * 3600) - (m * 60);

	std::cout << h << ":" << m  << ":"  << s << std::endl;
}



Measured memory_bytes: 3132
using System;

namespace ConsoleApp
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            var s = (int)Math.Log10(N);

            var cnt = s % 2 == 0 ? N - (int)Math.Pow(10, s) + 1 : 0;
            for (int i = 0; i < s; i++)
            {
                if (i % 2 == 0) cnt += 9 * (int)Math.Pow(10, i);
            }

            Console.WriteLine(cnt);
        }
    }
}

Measured memory_bytes: 11092
#include<iostream>
using namespace std;
int main()
{	int n,a,b=0,c=0,d[200001]={0},e=0;
 	cin>>n;
 	for(int i=1;i<=n;i++)
    	{cin>>a;
		 d[i]=a;
		 if(a>b)
		 b=a;
        }
    for(int i=1;i<=n;i++)
    	{if(d[i]>c&&d[i]!=b)
		 c=d[i];
		 else continue;
        }
    for(int i=1;i<=n;i++)
    	{if(d[i]==b)
    		e++;
    	else continue;
		}
    for(int i=1;i<=n;i++)
    	{if(d[i]==b&&e==1)
    		cout<<c<<"  ";
    	 else
    	 cout<<b<<"  ";
		}
return 0;
}

Measured memory_bytes: 2560
/**
  * @brief atcoder
  * @author yao
  */
#include <cstdlib>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <utility>
#include <algorithm>
#include <functional>
#include <climits>
#define ft first
#define sd second
#ifdef DBG
#   define dbg_pri(x...) fprintf(stderr,x)
#else
#   define dbg_pri(x...) 0
#   define NDEBUG
#endif //DBG
#include <cassert>

typedef unsigned int uint;
typedef long long int lli;
typedef unsigned long long int ulli;

#define N 262144

int a[N], b[N];

int main()
{
    int n,m,k;
    scanf("%d%d%d", &n, &m, &k);
    for(int i=0;i<n;++i)scanf("%d", &a[i]);
    for(int i=0;i<m;++i)scanf("%d", &b[i]);
    int sum=0, ca=0, cb=0;
    while(ca<n && sum+a[ca]<=k) sum += a[ca++];
    while(cb<m && sum+b[cb]<=k) sum += b[cb++];
    int ans = ca+cb;
    while(ca)
    {
        sum -= a[--ca];
        while(cb<m && sum+b[cb]<=k) sum += b[cb++];
        ans = std::max(ans, ca+cb);
    }
    printf("%d\n", ans);
    return 0;
}


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

//{ SFT
using namespace std;
#define int int64_t
#define rep(i, a, n) for (int i = (a); i < (n); ++i)
#define reps(i, a, n) for (int i = (a); i > (n); --i)
#define arep(i, a) for (auto &&i : (a))
#define irep(i, x) for (auto i = (x).begin(); i != (x).end(); ++i)
#define size(x) ((int)(x).size())
//降順はgreater<T>()
#define all(x) (x).begin(), (x).end()
#define rv(s) reverse((s).begin(), (s).end())
//gcd lcmはそのままok
#define gcd(a, b) __gcd(a, b)
#define bit(n) (1LL << (n))
#define bits(n) bitset(n)
#define pcnt(x) __builitin_popcountll(x)
//配列内等要素削除
#define unique(x) (x).erase(unique(x).begin(),(x).end()),(x).end());
#define Fixed(n) fixed << setprecision(n)
//総和
#define sowa(n) ((n) * ((n) + 1)) / 2
#define pb(x, a) (x).push_back(a)
#define fb(x, a) (x).flont_back(a)
#define eb(x, a) (x).emplaes_back(a)
#define F first
#define S second
#define cauto (const auto &)
template <class A, class B>
using pii = vector<pair<A, B>>;
//昇順
template <class T>
using min_heap = priority_queue<T, vector<T>, greater<T>>;
//降順
template <class T>
using max_heap = priority_queue<T>;
template <class A, class B>
using umap = unordered_map<A, B>;
template <class A>
using uset = unordered_set<A>;
template <class T>
bool chmax(T &a, const T &b) //最大値更新 返り値はbool
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b) //最小値更新 返り値はbool
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
constexpr int INF = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr long long mod1 = 1e9 + 7;
constexpr long long mod2 = 998244353;
//} END

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

    int n, k;
    cin >> n >> k;
    int ans = 0;

    rep(i, k, n + 2)
    {
        ans += (sowa(n) - sowa(n - i)) - sowa(i - 1) + 1;
        ans %= mod1;
    }

    cout<<ans<<'\n';
}

Measured memory_bytes: 3644
import java.util.Scanner;

public class Main {
	
	static int min_price;
	
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		
		int g = scanner.nextInt();
		while (g != 0) {
			min_price = Integer.MAX_VALUE;
			calculate(0, 0, 0, g);
			System.out.println(min_price);
			g = scanner.nextInt();
		}
	}
	
	private static void calculate(int num_A, int num_B, int num_C, int gram) {
		if (gram == 0) {
			int dis_A = (num_A / 5) * 5;
			int dis_B = (num_B / 4) * 4;
			int dis_C = (num_C / 3) * 3;
			int price = (dis_A * 380 * 80 / 100) + (num_A - dis_A) * 380 + (dis_B * 550 * 85 / 100) + (num_B - dis_B) * 550 + (dis_C * 850 * 88 / 100) + (num_C - dis_C) * 850;
			if (min_price > price) {min_price = price;}
			return;
		} else if (gram < 0) {
			return;
		}
		
		calculate(num_A, num_B, num_C + 1, gram - 500);
		calculate(num_A, num_B + 1, num_C, gram - 300);
		calculate(num_A + 1, num_B, num_C, gram - 200);
	}
}

Measured memory_bytes: 19824
S = list(input())

cnt = 0

if len(S)%2 == 0:
  for i in range(0,int(len(S)/2)):
    if S[i] != S[-1-i]:
      cnt +=1
else:
  for i in range(0,int(len(S)/2)):
    if S[i] != S[-1-i]:
      cnt +=1

print(cnt)
                

Measured memory_bytes: 3060
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

#define ll long long
#define vi vector<int>
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)

int A,B,C, ans = 0;

int main(){
    cin >> A >> B >> C;

    ans = max(A * 10 + B + C, ans);
    ans = max(B * 10 + A + C, ans);
    ans = max(C * 10 + B + A, ans);

    cout << ans << endl;
}


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

int main(){
  int H, W;
  cin >> H >> W;
  char T[H+2][W+2];
  for(int i=1; i<H+1; i++){
    for(int j=1; j<W+1; j++) cin >> T[i][j];
  }
  int S[H+2][W+2];
  for(int i=1; i<H+1; i++){
    for(int j=1; j<W+1; j++){
      if(T[i][j]=='.'){
        int cnt=0;
        if(T[i-1][j-1]=='#') cnt++;
        if(T[i-1][j]=='#') cnt++;
        if(T[i-1][j+1]=='#') cnt++;
        if(T[i][j-1]=='#') cnt++;
        if(T[i][j+1]=='#') cnt++;
        if(T[i+1][j-1]=='#') cnt++;
        if(T[i+1][j]=='#') cnt++;
        if(T[i+1][j+1]=='#') cnt++;
        S[i][j] =cnt;
      }
    }
  }
  for(int i=1; i<H+1; i++){
    for(int j=1; j<W+1; j++){
      if(T[i][j]=='#') cout << T[i][j];
      else cout << S[i][j];
    }
    cout << endl;
  }
}

Measured memory_bytes: 256
//hail to jwalaji
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
#define mod 1000000007
lli h,w;
vector<lli> r(2),d(2);
char grid[10005][10005];
vector<vector<lli>> store(10005,vector<lli>(10005,-1));
lli ans(lli i=1,lli j=1){
    lli answer=0;
    if(store[i][j]!=-1){
        return((answer)+(store[i][j]))%mod;
    }
    else{
    if((i+r[0])<=h&&(j+r[1])<=w&&(grid[i+r[0]][j+r[1]]=='.')){
        answer=((answer)+(ans((i+r[0]),(j+r[1]))))%mod;
    }
    if((i+d[0])<=h&&(j+d[1])<=w&&(grid[i+d[0]][j+d[1]]=='.')){
        answer=((answer)+(ans((i+d[0]),(j+d[1]))))%mod;
    }
    }
    store[i][j]=answer;
    return answer;
}
int main(){
    ios::sync_with_stdio(false);
    cin.tie(NULL);
r[0]=0;
r[1]=1;
d[0]=1;
d[1]=0;
cin>>h>>w;
store[h][w]=1;
for(lli i=1;i<=h;i++){
    for(lli j=1;j<=w;j++){
        cin>>grid[i][j];
    }
}
cout<<ans();
return 0;
}


Measured memory_bytes: 790824
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define REP(i,a,b) for (int i = a; i < (b); ++i)
#define all(x) (x).begin(),(x).end()
const int INF = 1000000007;
typedef long long ll;
using namespace std;
using Graph = vector<vector<int>>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
int solve(){
  int h,w,n;
  cin >> h >> w >> n;
  int now = 0;
  if(w > h)swap(h,w);
  if(n % h == 0)cout << n / h << endl;
  else cout << n / h + 1 << endl;
  return 0;
}
int main(){
  // ios::sync_with_stdio(false);cin.tie(nullptr);
  // cout << fixed;cout << setprecision(16) << endl; 
  solve();
  return 0;
} 

Measured memory_bytes: 256