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

#define F first 
#define S second
#define PB push_back

using namespace std;

typedef long long LL;
typedef pair<int, int> PII;
typedef priority_queue<int> HEAP;
typedef priority_queue<int, vector<int>, greater<int> > RHEAP;

const int N = 100010, M = 26;

int n, m;
int f[N][M];
char s[N], t[N];

int main()
{
	scanf("%s%s", s, t);
	n = strlen(s), m = strlen(t);
	
	memset(f, -1, sizeof f);
			
	for (int i = n - 1; i >= 0; i -- )
	{
		for (int j = 0; j < M; j ++ ) f[i][j] = f[i + 1][j];
		f[i][s[i] - 'a'] = i;
	}
	
	int a = 0, b = 0;
	for (int i = 0; i < m; i ++ )
	{
		int c = t[i] - 'a';
		if (f[0][c] == -1)
		{
			puts("-1");
			return 0;
		}
		if (f[b][c] == -1) a ++ , b = 0;
		b = f[b][c] + 1;
	}
	
	printf("%lld\n", (LL)a * n + (LL)b);
    return 0;
}

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

int main() {
    int N;
    cin >> N;
    int H[N];
    for (int i = 0; i < N; i++) {
        cin >> H[i];
    }

    bool can = true;

    H[0] --;
    for (int i = 1; i < N; i++) {
        if (H[i-1] < H[i]) H[i] --;
    }
    for (int i = 1; i < N; i++) {
        if (H[i-1] > H[i]) can = false;
    }

    if (can) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

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

int main () {
   int K;
  cin >> K;
  vector<int> vec = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  cout << vec.at(K-1) << endl;
              return 0;
}


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

using namespace std;

//long long
const long long maxn = 210000;
long long n , l;
long long a[maxn] , ra[maxn];
long long p[maxn] , sup[maxn] , sdown[maxn];
long long ans;
void solve () {
	long long i , now , pos;
	a[n+1] = l;
	for ( i = 0 ; i <= n ; i++ ) p[i] = a[i+1] - a[i];
	for ( i = n ; i >= 0 ; i-- ) ra[i] = ra[i+1] + p[i];
	sdown[0] = a[1];
	for ( i = 1 ; i <= n ; i++ ) {
		sdown[i] = sdown[i-1] + a[i+1];
	}
	for( i = n ; i >= 0 ; i-- ) {
		sup[i] = sup[i+1] + ra[i];
	}
	now = 0;
	ans = max ( ans , a[n] );
	//for ( i = 0 ; i <= n ; i++ ) printf ( "%lld " , ra[i] );
	//printf ( "\n" );
	for ( i = 2 ; i <= n ; i++ ) {
		pos = n - i / 2;
		now = 0;
		if ( i % 2 == 0 ) {
			now += sup[pos+1] * 2;
			now -= ra[pos+1];
			now += sdown[pos-1] * 2;
			if ( pos-(n-pos)-1 >= 0 ) now -= (sdown[pos-(n-pos)-1]) * 2;
		}
		else {
			now += sup[pos+1] * 2;
			now += sdown[pos-1] * 2;
			if ( pos-(n-pos)-1-1 >= 0 ) now -= (sdown[pos-(n-pos)-1-1]) * 2;
			now -= a[pos];
			//printf ( "   %lld %lld %lld %lld \n" , sup[pos+1] , sdown[pos-1] , (sdown[pos-(n-pos)-1-1]) , a[pos-1] );
		}
		//printf ( "%lld %lld %lld %lld\n" , i , pos , pos - (n-pos) - 1 , now );
		ans = max ( ans , now );
	}
}
void work () {
	long long i;
	scanf ( "%lld%lld" , &l , &n );
	for ( i = 1 ; i <= n ; i++ ) scanf ( "%lld" , &a[i] );
	solve ();
	for ( i = 1 ; i <= n / 2 ; i++ ) swap ( a[i] , a[n-i+1] );
	for ( i = 1 ; i <= n ; i++ ) {
		a[i] = l - a[i];
	}
	solve ();
	printf ( "%lld\n" , ans );
}
int main () {
	work ();
	return 0;
}


Measured memory_bytes: 8320
#include <stdio.h>

int main(void){
    int i;
    char str1[19];
    scanf("%s",str1);
    for(i=0;i<19;i++){
        if(str1[i]==','){
        printf(" ");
        }else{
        printf("%c",str1[i]);
        }
    }
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef long long ll;
typedef long double ld;
#define pb push_back
#define mp make_pair

using namespace std;

int main()
{
   FAST/**/
   
   ll n,a,b,c,d,e;
   cin>>n>>a>>b>>c>>d>>e;
   
   ll arr[5];
   arr[0] = a, arr[1] = b, arr[2] = c, arr[3] = d, arr[4] = e;
   
   ll cnt[5];
   cnt[0] = ceil((ld)n/a);
   
   ll start[5];
   start[0] = 0;
   
   for(ll i=1;i<5;i++)
   {
       start[i] = start[i-1] + 1;
       
       if(arr[i]>arr[i-1])
       {
           cnt[i] = cnt[i-1];
           arr[i] = arr[i-1];
       }
       
       else
           cnt[i] = ceil((ld)n/arr[i]);  
   }
   
   ll ans = start[4] + cnt[4];
   cout<<ans;
   
   return 0;
}

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

int main(){
	int N; cin >> N;
	vector<int> W(N), cul(N+1, 0);

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

	for(int i = 0; i < N; ++i) cul[i+1] = cul[i] + W[i];

	int min = 1000000;
	for(int i = 1; i < N; ++i){
		int s1 = cul[i] - cul[0];
		int s2 = cul[N] - cul[i];

		int dif = abs(s2 - s1);
		if(min > dif) min = dif;
	}

	cout << min << endl;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep1(i, n) for (int i = 1; i < (n); ++i)
using namespace std;
typedef long long ll;
 
int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
 
    int n;
    cin >> n;
    vector<int> o(n), p(n), q(n);
 
    rep(i, n) o[i] = i+1;
    rep(i, n) cin >> p[i];
    rep(i, n) cin >> q[i];
 
    int a, b;
    int cnt = 1;
    do{
        bool same_p = true;
        rep(i, n) {
            if(o[i] != p[i]) same_p = false;
        }
        if(same_p) a = cnt;
 
        bool same_q = true;
        rep(i, n) {
            if(o[i] != q[i]) same_q = false;
        }
        if(same_q) b = cnt;
 
        ++cnt;
    } while(next_permutation(o.begin(), o.end()));
 
    cout << abs(a - b) << endl;
 
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define For(i,n,k) for(ll i=(n);i<(k);i++)
ll n,cnt=0,ans=0;
// 素集合データ構造
struct UnionFind
{
  // par[i]：データiが属する木の親の番号。i == par[i]のとき、データiは木の根ノードである
  vector<int> par;
  // sizes[i]：根ノードiの木に含まれるデータの数。iが根ノードでない場合は無意味な値となる
  vector<int> sizes;

  UnionFind(int n) : par(n), sizes(n, 1) {
    // 最初は全てのデータiがグループiに存在するものとして初期化
    for(int i=0;i<n;i++) par[i] = i;
  }

  // データxが属する木の根を得る
  int find(int x) {
    if (x == par[x]) return x;
    return par[x] = find(par[x]);  // 根を張り替えながら再帰的に根ノードを探す
  }

  // 2つのデータx, yが属する木をマージする
  void unite(int x, int y) {
    // データの根ノードを得る
    x = find(x);
    y = find(y);

    // 既に同じ木に属しているならマージしない
    if (x == y) return;

    // xの木がyの木より大きくなるようにする
    if (sizes[x] < sizes[y]) swap(x, y);

    // xがyの親になるように連結する
    par[y] = x;
    sizes[x] += sizes[y];
    // sizes[y] = 0;  // sizes[y]は無意味な値となるので0を入れておいてもよい
  }

  // 2つのデータx, yが属する木が同じならtrueを返す
  bool same(int x, int y) {
    return find(x) == find(y);
  }

  // データxが含まれる木の大きさを返す
  int size(int x) {
    return sizes[find(x)];
  }
};
void Main(){    
    cin>>n;
    vector<pair<ll,ll>> x(n),y(n);
    For(i,0,n){
        cin>>x.at(i).first>>y.at(i).first;
        x.at(i).second=i;
        y.at(i).second=i;
    }
    sort(x.begin(),x.end());
    sort(y.begin(),y.end());
    vector<pair<ll,pair<ll,ll>>> roads;//コスト-（街）
    For(i,1,n){
        roads.push_back(make_pair(x.at(i).first-x.at(i-1).first,make_pair(x.at(i).second,x.at(i-1).second)));
        roads.push_back(make_pair(y.at(i).first-y.at(i-1).first,make_pair(y.at(i).second,y.at(i-1).second)));
    }
    sort(roads.begin(),roads.end());
    UnionFind city(n);
    for(auto road:roads){
        if(city.find(road.second.first)==city.find(road.second.second)) continue;
        else{
            ans+=road.first;
            city.unite(road.second.first,road.second.second);
        }
    }
    cout<<ans<<endl;
}
int main(){
    Main();
    return 0;
}


Measured memory_bytes: 11632
N=int(input())
i=0
j=0
L=[]
cnt=0
while i<N:
     l=list(input().split())
     L.append(l)
     i+=1
while j<N:
     if L[j][1]=="JPY":
          cnt+=int(L[j][0])
     else:
          cnt+=float(L[j][0])*380000.0
     j+=1
print(cnt)





Measured memory_bytes: 3060
#include <bits/stdc++.h>
//#pragma GCC optimize(2)
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<cmath>
#include<cstring>
#include<bitset>
#include<stack>
#include<time.h>



#define X first
#define Y second
#define PB push_back
#define MP make_pair
#define scd(a) scanf("%d",&a)
#define scdd(a,b) scanf("%d%d",&a,&b)
#define scddd(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define ALL(x) x.begin(),x.end()
#define sz(a) ((int)a.size())
#define getmid ((l+r)>>1)
#define mst(var,val) memset(var,val,sizeof(var))
#define IOS ios::sync_with_stdio(false);cin.tie(0)
#define lowbit(x) x&(-x)
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define ls rt<<1
#define rs rt<<1|1
using namespace std;
#ifdef local
#define dbg(args...) cout << #args << " -> ", err(args);
void err(){ cout << endl; }
template<typename T, typename... Args>
void err(T a, Args... args){ cout << a << ' '; err(args...); }
#else
#define dbg(args...)
#endif // local

typedef long long ll;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <double, double> pdd;
const int inf=0x3f3f3f3f;
const long long INF=0x3f3f3f3f3f3f3f3fLL;
const double PI=acos(-1.0);
const long double eps=1e-8;
const int mod=1e9+7;
const int maxn=3e5+100;
const int N=1e6+1000;
const int M=500+10;
const ll mm=(1LL<<32);

template <class T>
inline void read(T &x)
{
    x = 0;
    char c = getchar();
    bool f = 0;
    for (; !isdigit(c); c = getchar())
        f ^= c == '-';
    for (; isdigit(c); c = getchar())
        x = x * 10 + (c ^ 48);
    x = f ? -x : x;
}

template <class T>
inline void write(T x)
{
    if (x < 0)
    {
        putchar('-');
        x = -x;
    }
    T y = 1;
    int len = 1;
    for (; y <= x / 10; y *= 10)
        ++len;
    for (; len; --len, x %= y, y /= 10)
        putchar(x / y + 48);
}
ll qpow(ll a,ll b,ll mod)
{
    ll ans=1;
    while(b)
    {
        if(b&1)
            ans=(ans*a)%mod;
        b>>=1;
        a=(a*a)%mod;
    }
    return ans;
}

ll cnt[N];
int main()
{
#ifdef local
    freopen("in.txt","r",stdin);
#endif // local
    IOS;
    int n;cin>>n;
    ll sum=0;
    for(int i=1;i<=n;++i)
    {
        ll x;cin>>x;sum+=x;
        cnt[x]++;
    }
    int q;cin>>q;
    while(q--)
    {
        ll u,v;cin>>u>>v;
        sum-=cnt[u]*u;
        sum-=cnt[v]*v;
        cnt[v]+=cnt[u];
        cnt[u]=0;
        sum+=cnt[v]*v;
        cout<<sum<<"\n";
    }
    return 0;
}


Measured memory_bytes: 4456
import java.util.Scanner;

//Pocket Pager Input
public class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		char[][] ch = {
				{'a','f','k','p','u','z'},
				{'b','g','l','q','v','.'},
				{'c','h','m','r','w','?'},
				{'d','i','n','s','x','!'},
				{'e','j','o','t','y',' '}
		};
		while(sc.hasNext()){
			char[] s = sc.next().toCharArray();
			if(s.length%2==1){
				System.out.println("NA");
				continue;
			}
			String ans = "";
			for(int i=0;i<s.length;i+=2){
				int b = s[i]-'0'-1;
				int a = s[i+1]-'0'-1;
				if(0<=a&&a<5&&0<=b&&b<6)ans+=ch[a][b];
				else{
					ans = "NA";
					break;
				}
			}
			System.out.println(ans);
		}
	}
}

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

int main(){
    string s;
    cin >> s;
    vector<int> ans(s.size(),0);
    for(int i=0;i<s.size();i++){
        int j=i;
        //cout << j << endl;
        int left=i;
        int right;
        int ind=0;
        while(true){
            if(s[j]=='R'&&s[j+1]=='L'){
                ind=j;
            }
            if(s[j]=='L'&&s[j+1]=='R'){
                right=j;
                break;
            }
            if(j==s.size()-1){
                right=j;
                break;
            }
            j++;
        }
        i=j;
        int cnt_r=1+(ind-left)/2+(right-ind)/2;
        int cnt_l=1+(ind+1-left)/2+(right-(ind+1))/2;
        ans[ind]=cnt_r;
        ans[ind+1]=cnt_l;
    }
    for(int i=0;i<s.size();i++){
        cout << ans[i];
        if(i<s.size()-1){
            cout << " ";
        }
    }
    cout << endl;
}

Measured memory_bytes: 1024
using System;

namespace Sample
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] str = Console.ReadLine().Split(' ');
            int m = int.Parse(str[0]);
            int n = int.Parse(str[1]);
            int divide = 1000000007;
            string binary = Convert.ToString(n,2);
            long sum = 1;
            for(int i = 0; i < binary.Length; i++)
            {
                sum = sum * sum % divide;
                if (binary[i] == '1') sum = sum * m % divide;
            }
            Console.WriteLine(sum);
        }
    }
}

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

signed main(){
  
  int N, L;
  cin>>N>>L;
  
  int A = L;
  int B = L + N - 1;
  
  int S = 0;
  
  for(int i=A;i<=B;i++) S += i;
  
  if( A <= 0 && 0 <= B ) cout<<S<<endl;
  else if( B < 0 ) cout<<S-B<<endl;
  else cout<<S-A<<endl;
  
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
using namespace std;
typedef long long ll;
ll p, q, r, s;
ll gcd(ll a, ll b) {
	if (a < b) swap(a, b);
	if (!b) return a;
	return gcd(b, a%b);
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a * b / g;
}
ll func(ll a, ll b, ll x) {
	ll l = a / x + ((a%x) ? 1:0);
	ll r = b / x;
	return r - l + 1;
}
int main(void) {
	scanf("%lld %lld %lld %lld", &p, &q, &r, &s);
	ll ans = q - p + 1;
	ans += -func(p, q, r) - func(p, q, s) + func(p, q, lcm(r, s));
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 128
#include <iostream>

int main()
{
using namespace std;

int x,y;

while(1)
{
cin>>x>>y;

if(x==0 && y==0)
break;

if(x>y)
cout<<y<<' '<<x<<endl;
else
cout<<x<<' '<<y<<endl;
}
return 0;
}

Measured memory_bytes: 3052
import sys

sys.setrecursionlimit(1000*1000)

H, W = map(int, input().split(" "))
map_info = [input() for i in range(H)]

visit = [[False for j in range(W)] for i in range(H)]
ans = 0


def search(i, j, want_color):
    if i < 0 or i >= H:
        return
    if j < 0 or j >= W:
        return
    if visit[i][j]:
        return
    this_color = map_info[i][j]
    if want_color != this_color:
        return

    global white
    global black

    visit[i][j] = True
    if this_color == '.':
        white += 1
        next_color = '#'
    else:
        black += 1
        next_color = '.'
    search(i, j+1, next_color)
    search(i, j-1, next_color)
    search(i+1, j, next_color)
    search(i-1, j, next_color)


for i in range(H):
    for j in range(W):
        white = 0
        black = 0
        search(i, j, map_info[i][j])
        ans += black * white
print(ans)


Measured memory_bytes: 138740
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    cout << n / 3;
}


Measured memory_bytes: 256
N = int(input())
A = list(map(int,input().split()))
l = len(A) - 1
A.sort(reverse=True)
counter = A[0]
num = 1
while l > 2:
    counter += A[num] * 2
    num += 1
    l -= 2
if l == 2:
    counter += A[num]
print(counter)

Measured memory_bytes: 31444
import numpy as np
N, M = map(int,input().split())
target_list = np.array([int(i) for i in input().split()])
if N > M:
    print(0)
else:
    target_list = np.sort(target_list)
    diff_list = target_list[1:] - target_list[:-1]
    diff_list = np.sort(diff_list)
    if N > 1:
        diff_list = diff_list[0:-(N-1)]
    print(np.sum(diff_list))

Measured memory_bytes: 22992
#include <bits/stdc++.h>
#define INF 1e18
#define int long long
#define Rep(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) Rep(i, 0, n)
#define all(a) (a).begin(), (a).end()
using namespace std;
typedef pair<int, int> P;
typedef pair<int, P> PP;
const int mod = 1000000007;

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

    int n;
    cin >> n;
    int ans = 0;
    while (n > 0)
    {
        if (n % 10 == 2)
            ans++;
        n /= 10;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	final static long mod = 2019;
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long L = sc.nextLong();
		long R = sc.nextLong();
		sc.close();
		// System.out.println("L/2019=" + L / mod + " R/2019=" + R / mod);
		if(L / mod != R / mod) { System.out.println(0); return; }
		long min = Long.MAX_VALUE;
		for(long i = L; i <= R - 1; i++) {
			for(long j = i + 1; j <= R; j++) {
				long r = (i * j) % mod;
				// System.out.println(i + "*" + j + "%2019=" + r);
				// if(r == 0) { System.out.println(0); return; }
				min = Math.min(min, r);
			}
		}
		System.out.println(min);
	}
}


Measured memory_bytes: 22996
#include <iostream>
#include <algorithm>
#include <string>
#include <numeric>
#include <math.h>
#include <boost/math/common_factor_rt.hpp>
using namespace std;
#define rep(i, n) for(int i = 0;i < n;i++)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define ll long long

int main(){
  int N;
  cin >> N;
  int A[200010];
  rep(i, N) cin >> A[i];
  
  int first = 0, second = 0;
  int id1, id2;
  
  rep(i, N){
    if(first<A[i]) second = first, id2 = id1, first = A[i], id1 = i;
    else if(second<A[i]) second = A[i], id2 = i;
  }

  rep(i, N){
    if(i!=id1) cout << first << endl;
    else cout << second << endl;
  }
}

Measured memory_bytes: 2432
#include <iostream>
#include <iomanip>
#include <string>
#include <cmath>
#include <numeric>
#include <climits>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <functional>
#include <utility>
#include <cctype>
#include <iterator>
////////////////////////////////////////////////
#define REP(i, n) for (int i = 0; i < (int)n; i++)
#define FOR(i, m, n) for (int i = (int)m; i < (int)n; i++)
#define REPvec(itr, mp) for (auto itr = mp.begin(); itr != mp.end(); itr++)
#define REPe(e, mp) for (auto& e : mp)
#define all(x) x.begin(), x.end()
#define MOD 1000000007  // 1e9+7
using namespace std;
using ll = long long int;
using vecint = vector<int>;
using vecll = vector<ll>;
using vec2int = vector<vector<int>>;
using P = pair<int, int>;
////////////////////////////////////////////////
////////////////////////////////////////////////
vector<pair<long long, long long>> prime_factorize(long long N) {
  vector<pair<long long, long long>> res;
  for (long long a = 2; a * a <= N; ++a) {
    if (N % a != 0) continue;
    long long ex = 0;  // 指数

    // 割れる限り割り続ける
    while (N % a == 0) {
      ++ex;
      N /= a;
    }

    // その結果を push
    res.push_back({a, ex});
  }

  // 最後に残った数について
  if (N != 1) res.push_back({N, 1});
  return res;
}
int main() {
  ////////////////////////////////////////////////
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  ////////////////////////////////////////////////
  ll n;
  cin >> n;
  const auto& res = prime_factorize(n);
  ll ans = 0;
  for (auto p : res) {  // cout << p.second << " ";
    if (p.second == 1) {
      ans++;
      // cout << 1 << endl;
      continue;
    }
    for (ll k = 0; k < p.second + 1; k++) {
      if ((k + 1) * (k + 2) > 2 * p.second) {
        ans += k;
        // cout << k << endl;
        break;
      }
    }
  }
  cout << ans << endl;
}

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


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


int main(){
    double a,b,c,S,L,h;

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

    c = (c/180)*M_PI;

    S = (a*b*sin(c))/2;
    printf("%lf\n",S);

    L = sqrt(pow(a,2) + pow(b,2) - 2*a*b*cos(c)) + a + b;
    printf("%lf\n",L);

    h = b*sin(c);
    printf("%lf\n",h);


    
    


    return 0;
}



Measured memory_bytes: 2916
list = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

K = int(input())
print(list[K-1])

Measured memory_bytes: 3060
#include<cstdio>
#include<algorithm>
using namespace std;
int main(){
  int n;scanf("%d",&n);
  for(int i=0;i<n;i++){
    int a=-1,b=0,j=0;
    for(;j<10;j++){
      int c;scanf("%d",&c);
      if(a<b&&b<c){
	b=c;
      }else if(b<a&&a<c){
	a=c;
      }else if(a<c&&c<b){
	a=c;
      }else if(b<c&&c<a){
	b=c;
      }else{
	break;
      }
    }
    if(j==10) puts("YES");
    else puts("NO");
  }
}

Measured memory_bytes: 992
#include <bits/stdc++.h>
using namespace std;
#define INF 1<<30
#define endl '\n'
#define maxn 100005
#define FASTIO ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
typedef long long ll;
const double PI = acos(-1.0);
#define dbg(x) cerr << #x << " = " << x << endl;
#define dbg2(x, y) cerr << #x << " = " << x << ", " << #y << " = " << y << endl;
#define dbg3(x, y, z) cerr << #x << " = " << x << ", " << #y << " = " << y << ", " << #z << " = " << z << endl;

const ll mod = 1e9 + 7;


map<pair<int,int>, int> mp;


int main()
{
    FASTIO
    /*
    //double start_time = clock();
#ifndef ONLINE_JUDGE
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
    freopen("error.txt", "w", stderr);
#endif
//*/
    int T;
    // cin >> T;
    T = 1;
    for(int cs = 1; cs <= T; cs++)
    {
        string s;
        cin >> s;
        reverse(s.begin(), s.end());
        vector<string> v = {"dream", "dreamer", "erase", "eraser"};

        for(int i = 0; i < 4; i++){
            reverse(v[i].begin(), v[i].end());
            //cerr << v[i] << endl;
        }

        bool flag = true;
        for(int i = 0; i < (int)s.length();){
            bool ok = false;
            for(int j = 0; j < 4; j++){
                string x = v[j];
               // cerr << x << endl;
                if(s.substr(i, x.size()) == x){
                    ok = true;
                    i += x.size();
                }
            }
            if(!ok){
                flag = false;
                break;
            }

        }

        if(flag) cout << "YES\n";
        else cout << "NO\n";
    }

    //double end_time = clock();
    //printf( "Time = %lf ms\n", ( (end_time - start_time) / CLOCKS_PER_SEC)*1000);

    return 0;
}


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

using namespace std;

/* char prime[100000]; */

long gcd(long x, long y) {
    if (x < y) return gcd(y, x);
    if (y == 0) return x;
    return gcd(y, x % y);
}

int main(void) {
    /* memset(prime, 1, sizeof prime); */
    /* for(int i=2; i<100000; i++) { */
    /*     if(!prime[i]) continue; */
    /*     for(int j=2; i*j<100000; j++) */
    /*         prime[i*j] = 0; */
    /* } */

    long s;
    cin >> s;
    if((long)sqrt(s) * (long)sqrt(s) == s) {
        long t = sqrt(s);
        cout << 0 << ' ' << 0 << ' ' << t << ' ' << 0 << ' ' << 3 << ' ' << t << endl;
        return 0;
    }
    for(long k=1; k<100; k++) {
        long t = sqrt(s)+k;
        long tt = t*t;

        long x, y;
        for(long i=0; i<10000000 && i<t; i++) {
            long j = i==0 ? 10 : (tt - s) / i;
            if (i < t && j < t)
                if (tt - i*j == s) {
                    x = i, y = j;
                    cout << 0 << ' ' << 0 << ' ' << t << ' ' << y << ' ' << x << ' ' << t << endl;
                    return 0;
                }
        }
    }
}


Measured memory_bytes: 256
from collections import defaultdict

s = list(input())
x, y = list(map(int, input().split()))

X = []
Y = []
judge = "x"
l = 0
for i in s:
	if i == "F":
		l += 1
	else:
		if judge == "x":
			if l != 0:
				X.append(l)
			judge = "y"
		else:
			if l != 0:
				Y.append(l)
			judge = "x"
		l = 0

if judge == "x":
	if l != 0:
		X.append(l)
else:
	if l != 0:
		Y.append(l)

jj = "bad"
if len(s) >= 2:
	if s[0] == "T":
		jj = "good"


dx = defaultdict(int)
if X != []:
	if jj == "good":
		dx[X[0]] = 1
		dx[-X[0]] = 1
	else:
		dx[X[0]] = 1
	X.remove(X[0])
else:
	dx[0] = 1

for i in range(len(X)):
	D = defaultdict(int)
	for j in dx:
		if dx[j] == 1:
			D[j + X[i]] = 1
			D[j - X[i]] = 1
	dx = D


dy = defaultdict(int)
if Y != []:
	dy[Y[0]] = 1
	dy[-Y[0]] = 1
	Y.remove(Y[0])
else:
	dy[0] = 1

for i in range(len(Y)):
	D = defaultdict(int)
	for j in dy:
		if dy[j] == 1:
			D[j + Y[i]] = 1
			D[j - Y[i]] = 1
	dy = D

if dx[x] == 1 and dy[y] == 1:
	print("Yes")
else:
	print("No")

Measured memory_bytes: 4592
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
        int n;
        cin>>n;
        int ans=0;
        for(int m=1;m*m<=n;m++)
                ans+=m*(m+n/m)*(n/m+1-m)-m*m;
        cout<<ans<<endl;
}

Measured memory_bytes: 3632
#include <iostream>
#include <vector>
#include <limits.h>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <queue>
#include <map>
#include <set>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <random>
#include <functional>
#include <stack>
using namespace std;

template<class T>
void in(vector<T>& V) {
	for (auto itr = V.begin(); itr != V.end(); itr++)cin >> *itr;
	return;
}

template<class T>
void out(vector<T>& V) {
	for (T& itr : V)cout << itr << endl;
	return;
}

vector<int> H;
vector<long long> DP;
int N,K;

int main() {
	cin >> N >> K;
	H.resize(N + 1, INT_MAX);
	for (int n = 1; n <= N; n++)cin >> H[n];
	DP.resize(N + 1);
	DP[0] = INT_MAX;
	DP[1] = 0;
	for (int n = 2; n <= N; n++) {
		DP[n] = INT_MAX;
		for (int nn = n - 1; nn >= max(n - K, 1); nn--) {
			DP[n] = min(DP[n], DP[nn] + abs(H[n] - H[nn]));
		}
	}
	cout << DP[N] << endl;
	return 0;
}

Measured memory_bytes: 1408
import numpy as np

point_num, dim_num = map(int, input().split())

points = []
for i in range(point_num):
    points.append(np.array(list(map(int, input().split()))))

ans = 0
for i in range(point_num):
    for j in range(i+1, point_num):
        dist = np.linalg.norm(points[i] - points[j])
        if(dist == int(dist)):
            ans += 1

print(ans)


Measured memory_bytes: 12504
#include<iostream>
#include<iomanip>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
 
using namespace std;
 
#define P(p) cout<<(p)<<endl
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define vsort(v) sort(v.begin(), v.end());
#define rvsort(v) sort(v.begin(), v.end(),greater<int>());
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return
#define C(i) cin>>i
#define C2(i,j) cin>>i>>j
#define C3(i,j,k) cin>>i>>j>>k
#define C4(i,j,k,m) cin>>i>>j>>k>>m
////////////////////////////////////////////////////////////

int main(){
  long w,a,b;
  C3(w,a,b);
  
  if( b > w + a)
    P(b-w-a);
  else if( (b >= a && b <= a+w) || (a >= b && a<= b+w) )
    P(0);
  else
    P(a-b-w);
  
  ret 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define END '\n'
#define int long long
#define pb emplace_back
#define pii pair<int, int>
#define ff first
#define ss second
#define trace(x) cerr<<x<<END;
#define loop(i, a, b) for(int i = (a); i < (b); i++)
#define loopb(i, b, a) for(int i = (b); i > (a); --i) 
const int mod = 1e9+7;
const int mod1 = 998244353;
const int inf = 92233720000000000ll;
  
void solve()
  {
   int l,r,d;
   cin>>l>>r>>d;
   int ans = r/d - l/d + (l%d == 0);
   cout<<ans;
  }
signed main()
 {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0); 
     solve();
  //cerr<<1.0*clock();
  return 0;
} 

Measured memory_bytes: 3636
#include "bits/stdc++.h"
#include <boost/multi_array.hpp>
#include <boost/optional.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/algorithm.hpp>
#include <boost/range/adaptors.hpp>
#include <boost/operators.hpp>
#include <boost/dynamic_bitset.hpp>

namespace adaptor = boost::adaptors;
using index_t = std::size_t;

void Main()
{
	std::vector<int> primes = { 2,3 };
	for (auto i : boost::irange(5, 100005, 2))
	{
		auto flag = true;
		for (auto p : primes)
		{
			if (i < p * p)
			{
				break;
			}
			if (i % p == 0)
			{
				flag = false;
				break;
			}
		}
		if (flag)
		{
			primes.emplace_back(i);
		}
	}
	int X;
	std::cin >> X;
	std::cout << *boost::lower_bound(primes, X) << std::endl;
}

int main()
{
	std::cin.tie(nullptr);
	std::ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
	Main();
}

Measured memory_bytes: 384
#include <iostream>
#include <math.h>

int prime[500000];

bool isprime( int a )
{
	if ( a == 1 ) return false;
	int b = sqrt(a);
	for ( int k = 0; k < 500000; ++k ) {
		if ( prime[k] > b ) break;

		if ( a % prime[k] == 0 ) return false;
	}
	return true;
}

int main()
{
	int i = 1;
	prime[0] = 2;
	prime[1] = 3;

	for ( int j = 1; j < 500000; ++j ) {
		if (prime[j-1] >= sqrt(1000000) ) break;
		//std::cout << prime[j-1] << std::endl;
		int a = prime[j-1] + 1;
		while ( true ) {
			int k;
			for ( k = 0; k < j; ++k ) {
				if ( a % prime[k] == 0 ) break;
			}
			if ( k == j ) {
				prime[j] = a;
				break;
			}
			a++;
		}
	}

	while(true)
	{
		int a, d, n;
		std::cin >> a >> d >> n;
		if ( a == 0 && d == 0 && n == 0 ) break;

		int r = a;
		while(true) {
			if ( isprime(r) == true ) n--;
			if ( n == 0 ) break;
			r += d;
		}
		std::cout << r << std::endl;
	}

	return 0;
}

Measured memory_bytes: 2992
#include "bits/stdc++.h"
using namespace std;
#define REP(i, n) for(ll i = 0;i < n;i++)
#define ll long long
#define MOD 1000000007

vector<vector<pair<int, int>>> g;
const int N = 200002;
const int N1 = 100001;
int used[N];
int col[N];

void dfs(int i, int c) {
  if(used[i]) return;
  used[i] = 1;
  col[i] = c;
  for(auto to : g[i]) {
    dfs(to.first, c);
  }
}



int main(){
  int n;
  cin>>n;
  g.resize(N);
  for(int i = 0; i < n; i++) {
    int x, y;
    cin >> x >> y;
    x--; y--;
    g[x].emplace_back(y+N1, 0);
    g[y+N1].emplace_back(x, 0);
  }

  REP(i,N1){
    if (col[i]==0){
      if (g[i].size()!=0)dfs(i, i+1);
    }
  }



  vector<pair<ll, ll> > pairs(N1);
  REP(i,N1){
    if (col[i]!=0)pairs[col[i]-1].first++;
    if (col[i+N1]!=0)pairs[col[i+N1]-1].second++;
  }

  ll ans=0LL;
  REP(i,N1){
    auto to=pairs[i];
    ans+=to.first*to.second;
  }


cout<<ans-n<<endl;
  
  return 0;
}

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

int main()
{
    int A[100], N;
    cin >> N;
    for (int i = 0; i < N; i++)
        cin >> A[i];

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

    for (int i = 1; i < N; i++)
    {
        int v = A[i];
        int j = i - 1;
        while (j >= 0 && A[j] > v)
        {
            A[j + 1] = A[j];
            j--;
        }
        A[j + 1] = v;
        for (int i = 0; i < N; i++)
        {
            if (i > 0)
                cout << " ";
            cout << A[i];
        }
        cout << endl;
    }
}


Measured memory_bytes: 3104
n, m = gets.split.map(&:to_i)
ary = []
n.times do
  ary << gets.split.map(&:to_i)
end

sum = 0
(0..(n-1)).each do |j|
  (0..m).each do |i|
    if i < m
      print "#{ary[j][i]} "
      sum += ary[j][i]
      i += 1
    else
      puts sum
      ary[j] << sum
      i = 0
      sum = 0
    end
  end
end

ary << []
(0..m).each do |k|
    (0..(n-1)).each do |l|
        sum += ary[l][k]
    end
    ary[n] << sum
    sum = 0
end

puts ary[n].join" "


Measured memory_bytes: 6956
#include <iostream>

using namespace std;
typedef long long ll;

int main(void) {
	ll num, a, b, mi, ma;
	cin >> num >> a >> b;
	if (num == 1 && a != b || a > b)
		printf("0\n");
	else {
		mi = a * (num - 1) + b;
		ma = b * (num - 1) + a;
		cout << ma - mi + 1 << "\n";
	}
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
  int N,A,S[10002];
  scanf("%d",&N);
  for(int i=1;i<=10000;i++)
    S[i]=0;
  for(int x=1;x<=10000;x++){
    if(x*x>10000) break;
    for(int y=1;y<=10000;y++){
      if(x*x+y*y+x*y>10000) break;
      for(int z=1;z<=10000;z++){
        A=x*x+y*y+z*z+x*y+y*z+z*x;
        if(A>10000) break;
        if(A<=10000) S[A]++;
      }
    }
  }
  for(int i=1;i<=N;i++)
    printf("%d\n",S[i]);
  return 0;
}

Measured memory_bytes: 1764
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long int n,m,sum=0;
    cin>>n>>m;
    int a[m];
    for (int i=0;i<m;i++) { cin>>a[i]; sum+=a[i]; }
    if(sum>=n) cout<<"Yes";
    else cout<<"No";
    
    return 0;
}

Measured memory_bytes: 640
import java.util.Scanner;

public class Main{
    public static void main(String[]args){
        Scanner sc = new Scanner(System.in);

        String line = sc.nextLine();
        String answer = "";
        int length = line.length();
        for(int i = 0; i < length; i++){
            char ch = line.charAt(i);
            if(Character.isLowerCase(ch) == true){
                answer += Character.toUpperCase(ch);
            }else{
                answer += Character.toLowerCase(ch);
            }
        }
        System.out.println(answer);
    }
}


Measured memory_bytes: 31440
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,a,n) for(i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;

int main(void) {
    int i,j;
    int q;
    cin >> q;
    ll a = 0, b = 0;
    rep(i,q){
        ll p,n;
        string c;
        cin >> p >> c >> n;
        if(c == "(")a += n;
        else b += n;
        if(a == b)cout << "Yes" << endl;
        else cout << "No" << endl;
    }
}



Measured memory_bytes: 3176
n, m = map(int, input().split())
h = list(map(int, input().split()))
a = [0]*m
b = [0]*m
for i in range(m):
    a[i], b[i] = map(int, input().split())
l = {}
for i in range(n):
    l[i] = []

for i in range(m):
    l[a[i]-1].append(b[i]-1)
    l[b[i]-1].append(a[i]-1)

ans = 0
for i in range(n):
    flag = True
    for j in range(len(l[i])):
        if h[i] <= h[l[i][j]]:
            flag = False
            break
    if flag:
        ans += 1

print(ans)


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

int main() {
  int n,k,q; cin>>n>>k>>q;
  map<int,int> d;
  for(int i=0; i<q; i++){
    int a; cin>>a;
    a-=1;
    if (d.count(a)) d[a]+=1;
    else d[a]+=1;
  }
  
  for(int j=0; j<n; j++){
    int win=d[j];
//    if (d.count(j)) win=d[j];
    if (k-q+win>0) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
  }
}

Measured memory_bytes: 5376
#include <stdio.h>

int main(void)
{
	int a=0,b=0,c,d,e,f,g,x[10000],i,j,k,l,m,n;
	while(a==0){
		scanf("%d %d",&x[b],&x[b+1]);
		if(x[b]==0&&x[b+1]==0){
			a=1;
		}
		b=b+2;
	}
	c=b/2-1;
	for(d=1;d<=c;d++){
		for(e=1;e<=x[2*d-2];e++){
			if(e%2!=0){
				if(x[2*d-1]%2==0){
					for(i=1;i<=x[2*d-1]/2;i++){
						printf("#.");
					}
				}else{
					for(j=1;j<=x[2*d-1]/2;j++){
						printf("#.");
					}
					printf("#");
				}
				printf("\n");
			}else{
				if(x[2*d-1]%2==0){
					for(i=1;i<=x[2*d-1]/2;i++){
						printf(".#");
					}
				}else{
					for(j=1;j<=x[2*d-1]/2;j++){
						printf(".#");
					}
					printf(".");
				}
				printf("\n");
			}
		}
		printf("\n");
	}
	return 0;
}


Measured memory_bytes: 2100
#include <iostream>
#include <stdio.h>
#include <math.h>
#include <vector>
#include <algorithm>
#include <utility>
using namespace std;

int main() {
	int n;
	cin >> n;
	if (n % 2 == 0)cout << n << endl;
	else cout << n * 2 << endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
  char s[51];
  int a[26],b[26];
  int n,i,j;
  scanf("%d",&n);
  for(i=0;i<26;i++)a[i]=100;
  for(i=0;i<n;i++){
    for(j=0;j<26;j++)b[j]=0;
    scanf("%s",s);for(j=0;s[j];j++)b[s[j]-'a']++;
    for(j=0;j<26;j++)a[j]=a[j]<b[j]?a[j]:b[j];
  }
  for(i=0;i<26;i++)for(j=0;j<a[i];j++)printf("%c",'a'+i);printf("\n");
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
vector<long long int> box;

void make(long long int mother,int depth){
  depth++;
  if(depth>10) return;
  if(mother%10!=0){
    box.push_back(mother*10+mother%10-1);
    make(mother*10+mother%10-1,depth);
  }
  box.push_back(mother*10+mother%10);
  make(mother*10+mother%10,depth);
  if(mother%10!=9){
    box.push_back(mother*10+mother%10+1);
    make(mother*10+mother%10+1,depth);
  }
}

int main(){
  int K;
  cin >> K;
  int D=0;
  for(int i=1;i<10;i++){
    box.push_back(i);
    make(i,D);
  }
  sort(box.begin(),box.end());
  cout << box[K-1];
}


Measured memory_bytes: 10476
#include <bits/stdc++.h>
using namespace std;
 
 
int main(){
  string s;
  cin >> s;
  int n = s.size();
  int ans = 0;
  for(int i = 0;i < n/2;i++){
    if(s.at(i) != s.at(n-i-1)){
      ans++;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3624
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;


namespace AtCoder {
    class Program {
        static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {
            var N = cin.ReadInt;
            var ans = cin.ReadIntArray(N).Min(x =>
              {
                  var c = 0;
                  while (x % 2 == 0 && x != 0) { x >>= 1; ++c; }
                  return c;
              });
            WriteLine(ans);

        }
    }


    public class ConsoleInput {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputstream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputstream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputstream.Count != 0) return inputstream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (var i = 0; i < tmp.Length; ++i)
                    inputstream.Enqueue(tmp[i]);
                return inputstream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); } }
        public int ReadInt { get { return int.Parse(Read); } }
        public long ReadLong { get { return long.Parse(Read); } }
        public double ReadDouble { get { return double.Parse(Read); } }
        public string[] ReadStrArray(long N)
        {
            var ret = new string[N];
            for (long i = 0; i < N; ++i)
                ret[i] = Read;
            return ret;
        }
        public int[] ReadIntArray(long N)   //配列の長さを引数で指定,入力された整数を配列に格納して返す
        {
            var ret = new int[N];
            for (long i = 0; i < N; ++i)
                ret[i] = ReadInt;
            return ret;
        }
        public long[] ReadLongArray(long N)
        {
            var ret = new long[N];
            for (long i = 0; i < N; ++i)
                ret[i] = ReadLong;
            return ret;
        }
    }
}


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

bool fc(vector<int> &p, vector<int> &ss){
  rep(i, p.size()){
    if(p.at(i) != ss.at(i)) return false;
  }
  return true;
}

int main(){
  int n;
  cin >> n;
  vector<int> ss(n);
  rep(i, n){
    ss.at(i) = i+1;
  }
  int co = 0, pc = 0, qc = 0;
  vector<int> p(n);
  rep(snip_i, n) cin >> p.at(snip_i);
  vector<int> q(n);
  rep(snip_i, n) cin >> q.at(snip_i);
  do{
    if(fc(p, ss) == true) pc = co;
    if(fc(q, ss) == true) qc = co;
    co++;
  }while(next_permutation(ss.begin(), ss.end()));

  cout << abs(pc-qc) << endl;
  return 0;
}

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

int main() {
    int k, s;
    cin >> k >> s;
    int ans = 0;
    rep(x, k+1){
        rep(y, k+1){
            int z = s-x-y;
            if (0 <= z && z <= k) ans += 1;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.*;
public class Main{
	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int[] pasta = new int[3];
		int[] drink = new int[2];
		for(int i=0; i<3; i++){
			pasta[i] = s.nextInt();
		}
		for(int i=0; i<2; i++){
			drink[i] = s.nextInt();
		}
		int pmin = pasta[0];
		int dmin = drink[0];
		for(int i=1; i<3; i++){
			if(pasta[i]<pmin){
				pmin = pasta[i];
			}
		}
		for(int i=1; i<2; i++){
			if(drink[i]<dmin){
				dmin = drink[i];
			}
		}
		System.out.println(pmin+dmin-50);
	}
}

Measured memory_bytes: 17168
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
#define rev(i, n) for(int i = (int)(n - 1); i >= 0; i--)
#define rev1(i, n) for(int i = (int)(n); i > 0; i--)
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define resort(v) sort((v).rbegin(), (v).rend())
#define vi vector<int>
#define vvi vector<vector<int>>
using ll = long long;
using P = pair<int, int>;
/* ------------------------------------------------ */
ll fact(int i) {       //階乗
    if (i == 0) return 1;
    return (fact(i - 1)) * i;
}
ll gcd(ll a, ll b) {        //最大公約数
    if(b == 0) return a;
    return gcd(b, a % b); 
}
ll lcm(ll a, ll b) {      //最小公倍数
    return a * b / gcd(a, b);
}
int keta(ll n) {        //桁数を求める
    if(n == 0) return 1;
    int count = 0;
    while(n != 0) {
        n /= 10;
        count++;
    }
    return count;
}
ll ketasum(ll n) {    //各桁の和
    ll sum = 0;
    while(n != 0) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}
/* ------------------------------------------------ */
int main() {
    int n;cin >> n;
    vi h(n);
    int ans = -1;
    int count = 0;
    rep(i, n) {
        cin >> h[i];
        if(i>0) {
            if(h[i]<=h[i-1]){
                // if(count == 0)count = 1;
                count++;
            }
            else {
                ans = max(count,ans);
                count = 0;
            }
        }
    }
    ans = max(ans,count);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3708
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <bitset>
#include <map>
#include <tuple>
#include <unordered_map>
#include <list>
#include <numeric>
#include <utility>
#include <iterator>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <ctime>
#include <cassert>
#include <random>

#define INF 1000000000
#define LINF 9000000000000000000
#define mod  1000000007

#define rep(i,n) for(int i=0;i<int(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define REP(i,a,b) for(int i=(a);i<int(b);i++)
#define all(x) (x).begin(),x.end()
#define pb push_back
#define mp make_pair

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef pair<int,int> pi;

int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
int ddx[8]={-1,-1,0,1,1,1,0,-1};
int ddy[8]={0,1,1,1,0,-1,-1,-1};
bool debug=false;

/*---------------------------------------------------*/

int main(){
  int a, b;
  cin >> a >> b;
  cout << abs(a - b) << endl;
}



Measured memory_bytes: 3024
#include <bits/stdc++.h>
using namespace std;
 
#define rp(i, k, n) for (int i = k; i < n; i++)
typedef long long ll;
typedef double ld;
 
template<class T>inline bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>inline bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const ll INF = 1ll << 60;
const ll MOD = 1e9 + 7ll;
const double PI=3.14159265358979323846;
 
 
int main() {
    int n, k;
    cin >> n >> k;
    vector<int> sum(n+1);
    rp(i, 0, n) {
        int a; cin >> a;
        sum[i+1] = (((sum[i] + a -1) % k) + k) % k;
    }
    ll res = 0;
    map<int, ll> m;
    rp(i, 1, n+1) {
        m[sum[i-1]]++;
        if(i-k>=0) m[sum[i-k]]--;
        res += m[sum[i]];
    }
    cout << res << endl;
    // for(auto x: sum) cout << x;
    // cout << endl;
    return 0;
}

Measured memory_bytes: 16456
def solve(a, b):
    c = a % b
    if c == 0:
        return b
    else:
        return solve(b, c)


A, B, C = [int(i) for i in input().split()]
z = 0
num = abs(A - B)
if num == 0:
    print('NO')
    exit()
else:
    num = solve(B, num)
if C % num == 0:
    print('YES')
else:
    print('NO')


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using PII = pair<int, int>;
#define FI(i, a, b) for (int i = (a); i <= (b); ++i)
#define FD(i, b, a) for (int i = (b); i >= (a); --i)
#define DEBUG(x) cerr << #x << ": " << (x) << endl;

struct Edge {
  int u, v, c, d;
};
struct Node {
  int c, ccnt, csum, sum, depth;
};
const int N = 1e5 + 5;
int n, q, xs[N], ys[N], us[N], vs[N], anc[N], dep[N], fa[N][20];
Node info[N];
Edge edges[N];
vector<int> g[N], need[N], exist[N];
unordered_map<int, int> mp[N];

void dfs1(int u, int p, int depth) {
  fa[u][0] = p, dep[u] = depth;
  for (int i = 1; i < 20; i++) fa[u][i] = fa[fa[u][i - 1]][i - 1];
  for (auto i : g[u]) {
    const auto& e = edges[i];
    int v = e.u == u ? e.v : e.u;
    if (v == p) continue;
    dfs1(v, u, depth + 1);
  }
}
int lca(int x, int y) {
  int c = dep[x] - dep[y];
  if (c > 0)
    for (int i = 0; i < 20; i++)
      if (+c & 1 << i) x = fa[x][i];
  if (c < 0)
    for (int i = 0; i < 20; i++)
      if (-c & 1 << i) y = fa[y][i];
  if (x == y) return x;
  for (int i = 20 - 1; ~i; i--)
    if (fa[x][i] != fa[y][i]) x = fa[x][i], y = fa[y][i];
  return fa[x][0] != fa[y][0] ? -1 : fa[x][0];
}

void dfs2(int u, int p, int color, int len, int sum) {
  info[u] = {color, 0, 0, sum, dep[u]};
  if (exist[color].empty()) {
    info[u].csum = len;
    info[u].ccnt = 1;
  } else {
    info[u].csum = info[exist[color].back()].csum + len;
    info[u].ccnt = info[exist[color].back()].ccnt + 1;
  }
  exist[color].push_back(u);
  for (auto c : need[u])
    if (!exist[c].empty()) mp[u][c] = exist[c].back();
  for (auto i : g[u]) {
    const auto& e = edges[i];
    int v = e.u == u ? e.v : e.u;
    if (v == p) continue;
    dfs2(v, u, e.c, e.d, sum + e.d);
  }
  exist[color].pop_back();
}

int main() {
  cin >> n >> q;
  FI(i, 1, n - 1) {
    int u, v, c, d;
    scanf("%d%d%d%d", &u, &v, &c, &d);
    edges[i] = {u, v, c, d};
    g[u].push_back(i), g[v].push_back(i);
  }
  dfs1(1, 1, 1);
  FI(i, 1, q) {
    scanf("%d%d%d%d", &xs[i], &ys[i], &us[i], &vs[i]);
    anc[i] = lca(us[i], vs[i]);
    need[anc[i]].push_back(xs[i]);
    need[us[i]].push_back(xs[i]);
    need[vs[i]].push_back(xs[i]);
  }
  dfs2(1, -1, 0, 0, 0);
  auto query = [&](int u, int c, int d) {
    LL ans = info[u].sum;
    int pos = mp[u][c];
    if (pos) {
      ans += d * info[pos].ccnt - info[pos].csum;
    }
    return ans;
  };
  FI(i, 1, q) {
    LL ans1 = query(us[i], xs[i], ys[i]);
    LL ans2 = query(vs[i], xs[i], ys[i]);
    LL ans3 = query(anc[i], xs[i], ys[i]);
    printf("%lld\n", ans1 - ans3 + ans2 - ans3);
  }
}


Measured memory_bytes: 50296
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string s;
  cin >> s;
  
  vector<int> count(26,0);
  
  for (int i = 0; i < s.length(); i++) {
    int temp = s[i] - 'a';
    count[temp] ++;
  }
  
  bool ans = true;  
  for (int i = 0; i < 26; i++) {
    if (count[i] >= 2)
      ans = false;
  }
  
  if (ans)
    cout << "yes";
  else
    cout << "no";
  
}

Measured memory_bytes: 3592