akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
int main(void)
{
    int a, i, wa, ac, tle, re;
    scanf("%d",&a);
    ac = 0;
    wa = 0;
    tle = 0;
    re = 0;
    
    for ( i = 0; i < a; i++)
    {
        char c[255];
        scanf("%s", c);
        if (c[0] == 'A') ac++;
        if (c[0] == 'W') wa++;
        if (c[0] == 'T') tle++;
        if (c[0] == 'R') re++;
    }
    printf("AC x %d\n", ac);
    printf("WA x %d\n", wa);
    printf("TLE x %d\n", tle);
    printf("RE x %d\n", re);
}


Measured memory_bytes: 1736
using System;

namespace A___Parking
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = Console.ReadLine().Split(' ');
            var n = int.Parse(input[0]);
            var a = int.Parse(input[1]);
            var b = int.Parse(input[2]);
            Console.WriteLine(Math.Min(b, a * n));
        }
    }
}

Measured memory_bytes: 11092
#include <stdio.h>

int main(void)
{
    char input;
    while(scanf("%c", &input) != EOF)
    {
        if(input >= 'a' && input <= 'z')
        {
            input = input - 'a' + 'A';
        }

        else if(input >= 'A' && input <= 'Z')
        {
            input = input - 'A' + 'a';
        }

        printf("%c", input);
    }

    return 0;
}

Measured memory_bytes: 524
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include <boost/multiprecision/cpp_ll.hpp>
//typedef boost::multiprecision::cpp_ll ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E16;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
string alp="abcdefghijklmnopqrstuvwxyz";
#define endl "\n"
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);


int main(){fastio
    ll n,k;cin>>n>>k;
    ll a[n+1];rep(i,1,n)cin>>a[i];
    ll dp[n+1][k+1];
    dp[0][0]=1;
    rep(i,1,k)dp[0][i]=0;
    rep(i,1,n){
        rep(j,0,k){
            if(j==0){
                dp[i][j]=1;
            }else if(j-1-a[i]>=0){
                dp[i][j]=mod(dp[i][j-1]-dp[i-1][j-1-a[i]]+dp[i-1][j]);
            }else{
                dp[i][j]=mod(dp[i][j-1]+dp[i-1][j]);
            }
        }
    }
    /*
    rep(i,0,n){
        rep(j,0,k){
            cout<<dp[i][j]<<' ';
        }
        cout<<endl;
    }*/
    cout<<dp[n][k]<<endl;
    
    return 0;
}




Measured memory_bytes: 79232
n = int(input())
P = [int(i) for i in input().split()]

ans = 0
for i in range(1, n-1):
    if P[i-1] < P[i] < P[i+1]:
        ans += 1
    elif P[i-1] > P[i] > P[i+1]:
        ans += 1
print(ans)

Measured memory_bytes: 3060
#include <queue>
#include <cstdio>
#include <iostream>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <sstream>
#include <algorithm>
#include <iomanip>
#include <stack>
#include <time.h>
#include <functional>

//#include "All.h"

using namespace std;
typedef long long int ll;

#define EPS (1e-9)
#define INF (1e9)
#define PI (acos(-1))
#define REP(i,n) for(int i=0;i<n;i++)

int gcd(int a, int b) {
    if (a < b) swap(a, b);
    if (b == 0) return a;
    return gcd(b, a % b);
}

ll beki(ll a, ll b) {
    ll tmp = 1;
    REP(i, b) tmp *= a;
    return tmp;
}

int X, Y;

int main() {
    cin >> X >> Y;
    REP(i, X + 1) {
        if (i * 2 + (X - i) * 4 == Y) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

using boost::multiprecision::cpp_int;
using namespace std;

#if __has_include("print.hpp")
  #include "print.hpp"
#endif

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define MOD 1000000007

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

typedef long long ll;
typedef pair<ll, ll> p;


int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int l, r, d;
  cin >> l >> r >> d;
  ll count = 0;
  for (int i = l; i <= r; ++i) {
    if(i % d == 0) count++;
  }
  cout << count << endl;
}



Measured memory_bytes: 3648
#include<cstdio>
#include<cstring>
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int f[202100],sum[70707070];
char a[202002];
int main()
{
	int n,tmp,i,j;
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	scanf("%s",a+1);
	n=strlen(a+1);
	tmp=0;
	sum[0]=1;
	for(i=1;i<=n;i++)
	{
		tmp=tmp^(1<<(a[i]-'a'));
		if(sum[tmp]!=0)
			f[i]=sum[tmp]+1;
		else
			f[i]=n+1;
		for(j=0;j<=25;j++)
		{
			if(sum[tmp^(1<<j)]!=0&&sum[tmp^(1<<j)]+1<f[i])
				f[i]=sum[tmp^(1<<j)]+1;
			//printf("%d\n",tmp^(1<<j));
			//f[i]=max(f[i],sum[tmp^(1<<j)]+1);
		}
		//printf("%d %d\n",i,f[i]);
		if(sum[tmp]==0||f[i]<sum[tmp])
			sum[tmp]=f[i];
		//sum[tmp]=min(sum[tmp],f[i]);
	}
	printf("%d",f[n]-1);
	return 0;
}


Measured memory_bytes: 266880
#include<bits/stdc++.h>
using namespace std;
typedef int sign;
typedef long long ll;
#define For(i,a,b) for(register sign i=(sign)(a);i<=(sign)(b);++i)
#define Fordown(i,a,b) for(register sign i=(sign)(a);i>=(sign)(b);--i)
const int N=100+5;
template<typename T>bool cmax(T &a,T b){return (a<b)?a=b,1:0;}
template<typename T>bool cmin(T &a,T b){return (a>b)?a=b,1:0;}
template<typename T>T read()
{
	T ans=0,f=1;
	char ch=getchar();
	while(!isdigit(ch)&&ch!='-')ch=getchar();
	if(ch=='-')f=-1,ch=getchar();
	while(isdigit(ch))ans=(ans<<3)+(ans<<1)+(ch-'0'),ch=getchar();
	return ans*f;
}
template<typename T>void write(T x,char y)
{
	if(x==0)
	{
		putchar('0'),putchar(y);
		return;
	}
	if(x<0)
	{
		putchar('-');
		x=-x;
	}
	static char wr[20];
	int top=0;
	for(;x;x/=10)wr[++top]=x%10+'0';
	while(top)putchar(wr[top--]);
	putchar(y);
}
void file()
{
#ifndef ONLINE_JUDGE
	freopen("in","r",stdin);
	freopen("out","w",stdout);
#endif
}
int n;
void input()
{
	n=read<int>();
}
int ans,num,sum;
void work()
{
	while(n)
	{
		if(n%10!=0)
		{
			ans+=n%10;
			num++;
			sum=n%10;
		}
		n/=10;
	}
	if(num==1&&sum==1)ans=10;
	write(ans,'\n');
}
int main()
{
	//file();
	input();
	work();
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef  long double lld;
typedef long long ll;
#define pii pair<int, int>
#define ff first
#define ss second


int main() {
    ll x, y;
    cin >> x >> y;
    char point;
    int d;
    cin >> point >> d;
    y = (y*100)+d;
    ll ans = x*y;
    ans /= 100;
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 3552
#include <bits/stdc++.h>
using namespace std;
int main(){
string S;
cin >> S;
int min = 1000000;
for(int i = 0; i<S.size(); i++){
    if(S[i] == 'A'){
        if(i<min){
            min = i;
        }
    }
    
}
int max = -100000;
for(int j = 0; j<S.size(); j++){
    if(S[j] == 'Z'){
        if(j>max){
            max = j;
        }
    }
}
cout<<max-min+1<<endl;
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 a = sc.next();
		String b = sc.next();
		String c = sc.next();
		sc.close();
		
		String ans = "NO";
		if(a.charAt(a.length()-1) == b.charAt(0) && 
				b.charAt(b.length()-1) == c.charAt(0)){
			ans = "YES";
		}
	
		//出力
		System.out.println(ans);

	}

}

Measured memory_bytes: 21844
x, k, d = list(map(int, input().split()))
if x < 0:
    x = -x
c = x // d
if k <= c:
    print(x - d * k)
else:
    n = k - c
    x = x - d*c
    if n % 2 == 1:
        x = abs(x - d)
    print(x)

Measured memory_bytes: 9184
S = input()
Ccount = 0
j = 0
hantei = False

for i in range(2, len(S)-1):
    if S[i] == "C":
        j = i
        Ccount += 1

if S[0] == "A":
    char_S = list(S)
    del char_S[j]
    del char_S[0]
    S = "".join(char_S)
    hantei = True

if (Ccount == 1) and (S.islower()) and hantei:
    print("AC")
else:
    print("WA")


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

int main(){
  int x;
  char s[100];
  int S[100];
  int top=1;
    
  while( scanf("%s", s) != EOF )
    {
      if ( s[0] == '+' )
	{
	  x = (S[top])+(S[top-1]);
	  top--;
	  S[top] = x;
	}
      else if ( s[0] == '-' )
	{
	  x = (S[top-1])-(S[top]);
	  top--;
	  S[top] = x;
	}
      else if ( s[0] == '*' )
	{
	  x = (S[top])*(S[top-1]);
	  top--;
	  S[top] = x; 
	}
      else
	{
	  x = atoi(s);
	  top++;
	  S[top]=x;
	}
    }
  printf("%d\n",S[top]);
  return 0;
}



Measured memory_bytes: 2108
/*** author: yuji9511 ***/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> lpair;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i = (m); i < (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define print2(x,y) cout << (x) << " " << (y) << endl;
#define printa(x,n) for(ll i = 0; i < n; i++){ cout << (x[i]) << " \n"[i==n-1];};
ll dist[100010] = {};
vector<lpair> edge[100010];
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll K;
    cin >> K;
    rep(i,0,K){
        ll after = (i+1) % K;
        edge[i].push_back(make_pair(after, 1));
        after = i * 10 % K;
        edge[i].push_back(make_pair(after, 0));
    }
    fill(dist, dist+K, INF);
    dist[1] = 0;
    priority_queue<lpair, vector<lpair>, greater<lpair> > pq;
    rep(i,0,K) pq.push(make_pair(dist[i], i));
    while(not pq.empty()){
        lpair l1 = pq.top();
        pq.pop();
        for(auto &e: edge[l1.second]) {
            if(dist[e.first] > dist[l1.second] + e.second){
                dist[e.first] = dist[l1.second] + e.second;
                pq.push(make_pair(dist[e.first], e.first));
            }
        }
    }
    print(dist[0] + 1);
    
}

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

using namespace std;
using namespace __gnu_pbds;

template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

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

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

int main()
{
    IOS;
    int a,b;
    cin>>a>>b;
    if((a==1 && b==2) || (a==2 && b==1)) cout<<3<<endl;
    else if((a==1 && b==3) || (a==3 && b==1)) cout<<2<<endl;
    else if((a==3 && b==2) || (a==2 && b==3)) cout<<1<<endl;
}  

Measured memory_bytes: 256
N = int(input())
judge = {"AC":0, "WA":0, "TLE":0, "RE":0}
 
for _ in range(N):
    j_input = input()
    for j in judge.keys():
        if j_input == j:
            judge[j] += 1
 
for j in judge.keys():
    print(j , end = " x ")
    print(judge[j])

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

#define ll long long
#define INF_LL 1LL << 60
#define INF 99999999
#define MOD (ll)1000000007
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define REP(i, a, n) for(int i = a; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

void put_double(double obj){printf("%.12f\n",obj);};

template < typename T > std::string to_string( const T& n )
{
    std::ostringstream stm ;
    stm << n ;
    return stm.str() ;
}

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


int main()
{
    string a,b;
    cin >> a >> b;
    reverse(all(b));
    if( a == b ) cout << "YES" << endl;
    else cout << "NO" << endl;
}


Measured memory_bytes: 256
#include <cstdio>
#include <functional>
#include <algorithm>
#include <vector>
#include <limits>
#include <numeric>
#include <type_traits>
#include <queue>
#include <math.h>
#include <bits/stdc++.h>
#include <queue>
#include <map>

using namespace std;

#define INF (1ll<<60)
#define INFint (1<<30)
#define MOD 1000000007
#define BOUND 27182818284

typedef long long ll;
typedef long long int lli;
// typedef pair<ll,ll> P;

#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)

template<class T>
bool umax(T &a, const T &b){
    if (a<b) {
        a=b; return true;
    }
    return false;
}

template<class T>
bool umin(T &a, const T &b) {
    if (b<a) {
        a=b; return true;
    }
    return false;
}

// gcd
template<typename T>
T gcd(T a, T b){
    if(a==0)
        return b;
    return gcd(b%a,a);
}

// gcd array
int findGCD(int arr[], int n){
    int result = arr[0];
    for (int i=1; i < n; i++)
        result = gcd(arr[i], result);
    return result;
}

template<typename T>
T lcm( T m, T n ){
    // 引数に0がある場合は0を返す
    if ( ( 0 == m ) || ( 0 == n ) )
        return 0;
    return ((m/gcd(m, n)) * n); // lcm = m * n / gcd(m,n)
}

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    fill( (T*)array, (T*)(array+N), val );
}


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

// v.front() = -BOUND;
// v.back() = BOUND;

//struct edge{
//    int cost, to;
//
//    edge(int in_cost, int in_to){
//        cost=in_cost;
//        to=in_to;
//    }
//    bool operator<(const edge &a) const
//    {
//        return cost > a.cost;
//    }
//};
int gate[100010];

int main() {
    ll N,M; cin >> N >> M;
    vector<ll>A(N);
    vector<pair<ll,ll>>BC(M);
    rep(i,N){
         cin >> A[i];
    }

    sort(A.begin(), A.end());

    rep(i,M){
        cin >> BC[i].second >> BC[i].first;
    }

    sort(BC.begin(), BC.end(), greater<pair<ll,ll>>());

    int index=0;
    for(int i=0; i<M; i++){
        bool flag=false;
        for(int j=0; j<BC[i].second; j++){
            if(index < N && A[index]<BC[i].first){
                A[index]=BC[i].first;
                index++;
            }else{
                flag = true;
            }
        }
        if(flag){
            break;
        }
    }

    ll ans=0LL;
    for(int i=0; i<N; i++){
        ans+=A[i];
    }

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


Measured memory_bytes: 2560
import java.util.Scanner;

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

        long n = sc.nextLong();
        long md = 1000000007l;

        long arr0or9 = (modpow(10, n, md) - modpow(8, n, md) + md) % md;
        long arr0 = (modpow(10, n, md) - modpow(9, n, md) + md) % md;
        long arr0and9 = (arr0 * 2 - arr0or9 + md) % md;
        System.out.println(arr0and9);

    }

    static long modpow(long a, long n, long mod) {
        long res = 1;
        while (n > 0) {
            if ((n & 1) == 1) {
                res = res * a % mod;
            }
            a = a * a % mod;
            n >>= 1;
        }
        return res;
    }
}


Measured memory_bytes: 35580
#include <cstdio>
#include <vector>
#include <iostream>
using namespace std;
int in(){ int a; scanf("%d",&a); return a; }
int main(){
	int n,S;
	while(cin >> n>>S&&(n||S)){
		int w[101]={};
		int ans = 0;
		for(int i = 0 ; i < n ; i++) w[in()]++;
		
		for(int i = 0 ; i <= 100 ; i++){
			for(int j = i ; j <= 100 ; j++){
				if(i+j>S){
					if(i==j) ans+=w[i]*(w[i]-1)/2;
					else ans += w[i]*w[j];
				}
			}
		}
		cout << ans << endl;
	}
}

Measured memory_bytes: 908
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;
inline int getInt() { int x; scanf("%d",&x); return x;}
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
const int MX = 200005;

using B = bitset<5000>;

int main() {
  int n,k;
  scanf("%d%d",&n,&k);
  vi a(n);
  cin>>a;
  sort(rng(a));
  while (sz(a) && a.back() >= k) a.pop_back();
  int l = -1, r = sz(a);
  while (l+1<r) {
    int c = (l+r)>>1;
    B dp; dp[0] = 1;
    rep(i,sz(a)) if (i != c) dp |= dp<<a[i];
    int ok = 0;
    srep(i,k-a[c],k) ok |= dp[i];
    if (ok) r = c; else l = c;
  }
  int ans = r;
  cout<<ans<<endl;
  return 0;
}






















Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FIN ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

int main() {FIN
	
	string s, t;
	cin >> s;
	cin >> t;
	if (s == t.substr(0, s.size()))
		cout << "Yes\n";
	else
		cout << "No\n";
		
	return 0;
}


Measured memory_bytes: 3652
import java.util.*;

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

        int count = 0;
        int sum = 1;
        while(sum < b) {
            sum += a - 1;
            count++;
        }
        
        System.out.println(count);
    }
}


Measured memory_bytes: 23508
#include <bits/stdc++.h>
using namespace std;
#define fst first
#define snd second
typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
#define pb push_back
#define for_tests(t, tt) int t; scanf("%d", &t); for(int tt = 1; tt <= t; tt++)
#ifndef ONLINE_JUDGE
#define debug(args...) fprintf(stderr,args)
#else
#define debug(args...)
#endif //ONLINE_JUDGE
template<typename T> inline T abs(T t) { return t < 0? -t : t; }
const ll modn = 998244353;
inline ll mod(ll x) { return x % modn; }
#define IOS() ios::sync_with_stdio(0),cin.tie(0)

const int MAXN = 4123;

int n, m, k, nn, mm;
int s[MAXN];

ll dp[MAXN][MAXN];

ll go(int i, int j){
    if(i < n || j < m)
        return 0;
    ll &r = dp[i][j];
    if(r != -1)
        return r;
    r = 0;
    if(i == n && j == m)
        return r = 1;
    ll dis = 0;
    if(i > n && j > m){
        dis = ((ll)i-1)*(j-1)*go(i-1,j-1);
    }
    r = mod(mod(j*go(i-1, j)) + mod(i*go(i, j-1)) - dis);
    //printf("go %d %d : %lld\n", i, j, r);
    r = mod(modn + r);
    return r;
}


int main (){
	scanf("%d%d%d%d", &n, &m, &nn, &mm);
    memset(dp, -1, sizeof(dp));
    printf("%lld\n", go(nn, mm));
    return 0;
}



Measured memory_bytes: 136716
#include <bits/stdc++.h> //C++の標準ライブラリを一行で一括でインクルードする
#include <math.h> //数学関数と数学定数を利用する
#define rep(i,n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;

int INF = 1 << 30;

void chmin(int &a, int b){
  if (a > b) a = b;
}

int main(){
  string s;
  cin >> s;
  
  int ans = INF;
  
  for (int i = 0; i < s.size() - 2; i++){
    int x = stoi(s.substr(i,3));
    chmin(ans, abs(753 - x));
  }
  
  cout << ans;
  
  return 0;
}

Measured memory_bytes: 256
#[derive(Default)]
//NOTE
//declare variables to reduce the number of parameters for dp and dfs etc.
struct Solver {}

impl Solver {
    fn solve(&mut self) {
        let stdin = std::io::stdin();
        let mut scn = Scanner {
            stdin: stdin.lock(),
        };
        let n: usize = scn.read();
        let a: Vec<i32> = scn.vec(n);
        let mut result = 0;
        for &x in a.iter() {
            result ^= x;
        }
        let ans = if result == 0 { "Yes" } else { "No" };
        println!("{}", ans);
    }
}

fn main() {
    std::thread::Builder::new()
        .stack_size(64 * 1024 * 1024) // 64MB
        .spawn(|| {
            let mut solver = Solver::default();
            solver.solve()
        })
        .unwrap()
        .join()
        .unwrap();
}
pub mod utils {
    const DYX: [(isize, isize); 8] = [
        (0, 1),   //right
        (1, 0),   //down
        (0, -1),  //left
        (-1, 0),  //top
        (1, 1),   //down right
        (-1, 1),  //top right
        (1, -1),  //down left
        (-1, -1), //top left
    ];

    pub fn try_adj(y: usize, x: usize, dir: usize, h: usize, w: usize) -> Option<(usize, usize)> {
        let ny = y as isize + DYX[dir].0;
        let nx = x as isize + DYX[dir].1;
        if ny >= 0 && nx >= 0 {
            let ny = ny as usize;
            let nx = nx as usize;
            if ny < h && nx < w {
                Some((ny, nx))
            } else {
                None
            }
        } else {
            None
        }
    }
}

//snippet from kenkoooo
pub struct Scanner<R> {
    stdin: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn read_line(&mut self) -> String {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b'\n' || b == b'\r')
            .take_while(|&b| b != b'\n' && b != b'\r')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }

    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


Measured memory_bytes: 8572
def gcd(a,b):
  if b == 0:
    return a
  return gcd(b, a % b)
 
def lcm(a,b):
  return a * b // gcd(a,b)
 
n = int(input())
av = list(map(int, input().split(' ')))
alcm = 1
for i in av:
  alcm = lcm(alcm, i)
 
tot = 0
for i in range(n):
  tot += alcm // av[i]
 
print(tot % 1000000007)

Measured memory_bytes: 4084
class Clock
  
  def initialize(h=0, m=0, s=0)
    @h = h
    @m = m
    @s = s
  end
  
  def radian_of_between_hour_hand_and_minute_hand
    r = ratio_of_hour_hand - ratio_of_minute_hand
    r = [1 - r , r].min
    2 * Math::PI * r
  end
  
  def ratio_of_hour_hand
    Rational(@h%12, 12) + Rational(@m%60, 60*12) + Rational(@s%60, 12*60*60)
  end
  
  def ratio_of_minute_hand
    Rational(@m%60, 60) + Rational(@s%60, 60*60)
  end
end

a, b, h, m = gets.to_s.split.map{|e|e.to_f}

clock = Clock.new(h, m)
r = clock.radian_of_between_hour_hand_and_minute_hand
ans = ( a ** 2 + b ** 2 - 2 * a * b * Math.cos(r) ) ** 0.5
 
puts ans

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

int main()
{    
    int i,N,cnt=0,A[210];
    cin>>N;
    for(i=0;i<N;++i){cin>>A[i];}
    
    while(true){
        bool gs=false;
        for(i=0;i<N;++i){
            if(A[i]%2!=0)  gs=true;
        }
        if(gs)break;
        for(i=0;i<N;++i){
            A[i]/=2;
        }
        ++cnt;
    }
    cout<<cnt<<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++)
#define rep2(i, s, n) for (int i = s; i < (int)n; i++)
#define all(obj) obj.begin(), obj.end()
#define debug(x) cerr << #x << ":" << x << "\n"
#define vdebug(vec) cerr << #vec << ":"; for (auto e : vec) cerr << e << " "; cout << "\n"
#define YN(f) cout << (f ? "YES" : "NO") << endl
#define Yn(f) cout << (f ? "Yes" : "No") << endl
#define yn(f) cout << (f ? "yes" : "no") << endl
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;

int main () {
	int N; cin >> N;
	map<int, int> mt; mt[0] = 1;	
	int D;
	rep(i, N) {
		cin >> D;
		if (mt.count(D)) mt[D]++;
		else mt[D] = 1;		
	}
	vi vt;
	for (auto t : mt) vt.push_back(t.first);
	sort(all(vt)); // vdebug(vt);
	vi va; bool f_even = true;
	bool f_double = false;
	for (int D : vt) {
		if (D == 0 || D == 12) {
			if (mt[D] >= 2) {
				f_double = true;
				break;
			} else if (mt[D] == 1) {
				va.push_back(D);
			}
		} else if (0 < D && D < 12) {
			if (mt[D] >= 3) {
				f_double = true;
				break;
			} else if (mt[D] == 2) {
				va.push_back(D);
				va.push_back(24 - D);
			} else if (mt[D] == 1) {
				va.push_back(f_even ? D : 24 - D);
				f_even = !f_even;
			}
		}
	}
	sort(all(va)); // vdebug(va);
	int ans = 12;
	if (f_double) ans = 0;
	else {
		rep(i, va.size() - 1) {
			ans = min(ans, va.at(i + 1) - va.at(i));			
		}
		ans = min(ans, 24 - va.at(va.size() - 1));
	}

	cout << ans << endl;	
}

Measured memory_bytes: 256
#include <vector>
#include <math.h>
#include <string>
#include <ios>
#include <iomanip>
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
	int N,K;
	cin >> N >> K;

	if ((N+1) / K >= 2) {
		cout << "YES";
	}
	else {
		cout << "NO";
	}

	return 0;
}

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

int main() {
  int n;
  cin >> n;
  map<int,int> mp;
  int ans = 0;
  rep(i,n) {
    int m;
    cin >> m;
    mp[m-1]++;
    mp[m]++;
    mp[m+1]++;
  }
  int mx = 0;
  for(auto p : mp) mx = max(mx, p.second);
  
  cout << mx << endl;
}

Measured memory_bytes: 4736
#include<bits/stdc++.h>
using namespace std;
long long n,i,w,a,b,k[101][100001],j;
main()
{
    scanf("%lld %lld",&n,&w);
    for(i=1;i<=n;i++)
    {
        scanf("%lld %lld",&a,&b);
        for(j=1;j<=w;j++)
        {
            if(j<a) k[i][j]=k[i-1][j];
            else k[i][j]=max(k[i-1][j],k[i-1][j-a]+b);
        }
    }
    printf("%lld ",k[n][w]);
}


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

using namespace std;

typedef long long ll;

int n;
int par[200100];
vector<int> lis[200100];
vector<ll> D[200100], SZ[200100], P[200100];
int idx[200100];
bool done[200100];
ll two[200100], MOD = 1e9+7;

int main() {
    int i;

    scanf("%d",&n); n++;
    two[0] = 1; for (i=1;i<=n;i++) two[i]=two[i-1]*2%MOD;
    par[0] = -1; for (i=1;i<n;i++) {scanf("%d",&par[i]); lis[par[i]].push_back(i);}
    for (i=0;i<n;i++) idx[i] = i;
    for (i=n-1;i>=0;i--) {
        if (!lis[i].empty()) {
            int t = 0, mx = 0, j;
            for (j=0;j<lis[i].size();j++) if (D[idx[lis[i][j]]].size()>mx) { mx = D[idx[lis[i][j]]].size(); t = j;}
            swap(lis[i][0],lis[i][t]);
            idx[i] = idx[lis[i][0]];
            stack<int> st;
            for (j=1;j<lis[i].size();j++) {
                int v = idx[lis[i][j]], u = idx[i];
                for (int k=0;k<D[v].size();k++) {
                    int l = k+D[u].size()-D[v].size();
                    if (!done[l]) {P[u][l] = (two[SZ[u][l]]+MOD-D[u][l])%MOD; done[l] = 1; st.push(l);}
                    D[u][l] = (D[u][l]*(two[SZ[v][k]]+MOD-D[v][k])%MOD+P[u][l]*D[v][k])%MOD;
                    SZ[u][l] += SZ[v][k];
                    P[u][l] = P[u][l]*(two[SZ[v][k]]+MOD-D[v][k])%MOD;
                }
            }
            while(!st.empty()) {
                done[st.top()] = 0;
                st.pop();
            }
        }
        D[idx[i]].push_back(1);
        SZ[idx[i]].push_back(1);
        P[idx[i]].push_back(1);
    }
    ll ans = 0;
    for (i=0;i<D[idx[0]].size();i++) ans += two[n-SZ[idx[0]][i]]*D[idx[0]][i]%MOD;
    printf("%lld\n",ans%MOD);

    return 0;
}


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

#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;

using namespace std;


int main(int argc, const char * argv[]) {
    // source code
    int n ;
    cin >> n;
    string s;
    cin >> s;
    const char *c = s.c_str();
    int r = 1;
    repd(i, 1, n) {
        if (c[i -1] != c[i] ) r++;
    }
    cout << r;
    return 0;
}


Measured memory_bytes: 512
#include <stdio.h>

int num[50];
int main()
{
    int n;
    scanf("%d",&n);
    int cnt=0;
     if(n==0){
        printf("0\n");
        return 0;
    }
    while(n){
        if(n%2!=0){
            num[++cnt]=1;
            n=(n-1)/(-2);
        }else{
            num[++cnt]=0;
            n=n/(-2);
        }
    }

    for(int i=cnt;i>=1;i--)
        printf("%d",num[i]);
}


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

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,cc,n) for(int i=cc;i<n;++i)
#define lrep(i,cc,n) for(long long i=cc;i<n;++i)
#define sqrep(i,cc,n) for(long long i=cc;i*i<=n;++i)
#define rrep(i,cc,n) for(long i=cc;i>n;--i)
#define pii pair<int, int>
#define pll pair<long long, long long>
 
using ll = long long;
 
const vector<int> dx = {1, 1,  1, 0,  0, 0, -1, -1, -1};
const vector<int> dy = {1, 0, -1, 1, -1, 0,  1,  0, -1};
const double PI = 3.1415926535;
const ll inf = 1001001001;
const ll e9  = 1000000000;
const ll mod = 1000000007;
 
const int MAX = 1000000;
const int MOD = 1000000007;
 
int main(){
  string s;
  cin >> s;
  int a = 0;
  rep(i, 0, 3){
    if(s[i]=='1')a++;
  }
  cout << a << endl;
}

Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define pll pair<ll,ll>
#define x first
#define y second
#define mod 1e9+7
#define f(i,a,b) for(ll i=a;i<b;i++)
#define rof(i,a,b) for(ll i=a;i>b;i--)

ll lcm(ll a, ll b){
    return a / __gcd(a, b) * b;
}
//memset can initialize to 0 or -1 ONLY
// memset(a,0,sizeof(a[0][0])*n*n); //2D array
//memset(a, 0, sizeof(a));  //1D array
//memset(str, 't', sizeof(str)); // string
void solve()
{
    long long int n,a,b;
    cin>>n>>a>>b;
    
    cout<<a*(n/(a+b)) + min(a,n-(n/(a+b))*(a+b));
    
}


int main()
{

ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    ll t=1;
   // cin>>t;
    while(t--)
    {
    
    solve();
    
    }

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
template <typename T>
std::ostream &operator<<(std::ostream &out, std::vector<T> const &cont) {
    for (auto &i : cont) {
        out << i << ' ';
    }
    return out;
}
template <typename T1, typename T2>
std::ostream &operator<<(std::ostream &out, std::pair<T1, T2> const &p) {
    out << '{' << p.first << ", " << p.second << "}";
    return out;
}
#define imie(...) __debug_print(#__VA_ARGS__, __VA_ARGS__)
#ifdef __GLIBCXX_DEBUG
template <typename Arg1>
void __debug_print(const char *name, Arg1 &&arg1) {
    cerr << "[" << name << ": " << arg1 << "]" << endl;
}
template <typename Arg1, typename... Args>
void __debug_print(const char *names, Arg1 &&arg1, Args &&... args) {
    const char *comma = strchr(names + 1, ',');
    cerr << "[";
    cerr.write(names, comma - names) << ": " << arg1 << "],  ";
    __debug_print(comma + 2, args...);
}
#else
#pragma GCC optimize("O2")
void __debug_print(const char *, ...) {}
#endif

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int N;
    cin >> N;
    int cnt[4] = {0, 0, 0, 0};
    for (int i = 0, x; i < N; ++i) {
        cin >> x;
        ++cnt[x];
    }
    imie(cnt[1], cnt[2], cnt[3]);
    double DP[301][301][301];
    DP[0][0][0] = 0;
    for (int threes = 0; threes <= N; ++threes) {
        for (int twos = 0; twos + threes <= N; ++twos) {
            for (int ones = 0; ones + twos + threes <= N; ++ones) {
                double s = ones + twos + threes;
                if(s == 0) continue;
                DP[ones][twos][threes] = N / s;
                if (ones > 0)
                    DP[ones][twos][threes] += DP[ones - 1][twos][threes] * ones / s;
                if (twos > 0)
                    DP[ones][twos][threes] += DP[ones + 1][twos - 1][threes] * twos / s;
                if (threes > 0)
                    DP[ones][twos][threes] += DP[ones][twos + 1][threes - 1] * threes / s;
                imie(ones, twos, threes, DP[ones][twos][threes]);
            }
        }
    }
    cout << fixed << setprecision(10) << DP[cnt[1]][cnt[2]][cnt[3]] << endl;
}

Measured memory_bytes: 111116
#include<bits/stdc++.h>
#include <iostream>
#include <vector>
#include <queue>
using namespace std;
#define int long long
#define double long double
#define fo(a,b) for(int a=0;a<b;a++)
#define Sort(a) sort(a.begin(),a.end())
#define rev(a) reverse(a.begin(),a.end())
#define fi first
#define se second
#define sz size()
#define bgn begin()
#define en end()
#define pb push_back
#define pp() pop_back()
#define V vector
#define P pair
#define yuko(a) setprecision(a)
#define uni(a) a.erase(unique(a.begin(),a.end()),a.end())
#define Q queue
#define pri priority_queue
#define Pri priority_queue<int,vector<int>,greater<int>>
#define PriP priority_queue<P<int,int>,vector<P<int,int>>,greater<P<int,int>>>
#define all(a)  (a).begin(),(a).end()

int keta(int a){
  double b=a;
  b=log10(b);
  int c=b;
  return c+1;
}
signed main(){
  int a,b,c,x,y;
  cin>>a>>b>>c>>x>>y;
  int ans=10000000000;
  for(int i=0; i<200010; i+=2){
    
    int d=max<int>(x-i/2,0);
    int e=max<int>(y-i/2,0);
    ans=min(i*c+a*d+e*b,ans);

  }
  cout<<ans<<endl;
}

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

using ll = long long;
using ull = unsigned long long;

const double PI = acos(-1);
const int inf = 2e9;
const ll INF = 2e18;
const ll MOD = 1e9+7;

#define sz(s) (s).size()
#define pb push_back
#define fi first
#define se second
#define REP(i,n) for (int i = 0; i<n; i++)
#define ALL(a) begin(a), end(a)

int main (void) {
    int N,K;
    cin >> N >> K;
    vector<ll> bi(30,1);
    for (int i = 1; i < 30; i++) {
        bi[i] = bi[i-1]*2;
    }

    double ans = 0;
    for (int i = 1; i <= N; i++) {
        if (i >= K) {
            ans += (double)1/N;
        }
        else {
            double temp = (double)1/N;
            int t = (i+K-1)/i;
            ll p = 1;
            REP(j,30) {
                if (bi[j] >= t) {
                    p = bi[j];
                    break;
                }
            }
            temp *= (double)1/p;
            ans += temp;
        }
    }
    cout << setprecision(12) << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <array>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <string>
#include <algorithm>
#include <limits>
#include <iterator>
#include <cmath>
#include <numeric>
#include <stack>
#include <queue>
#include <cassert>
#include <forward_list>
#include <chrono>
#include <deque>
#include <list>
#include <random>
#include <cstdio>
#include <sstream>

using namespace std;

int main()
{
	int n, k;
	string s;
	cin >> n >> k >> s;

	s[k-1] = s[k-1] + 0x20;

	cout << s << endl;

	return 0;
}

Measured memory_bytes: 256
import java.util.*;
class Main{
    static int[] dx = {0,0,1,-1};
    static int[] dy = {-1,1,0,0};
    static int h;
    static int w;
    static int thismax;
    static int[][] visited;
    static char[][] s;
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        h = scanner.nextInt();
        w = scanner.nextInt();
        thismax = 0;
        
        s = new char[h][w];
        for(int i = 0; i < h; i++){
            String str = scanner.next();
            for(int j = 0; j < w; j++){
                s[i][j] = str.charAt(j); 
            }
        }
        for(int i = 0; i < h; i++){
            for(int j = 0; j < w; j++){
                visited = new int[h][w];
                if(s[i][j] == '.'){
                    s[i][j] = '#';
                    bfs(i,j,visited);
                    s[i][j] = '.';
                }
            }
        }
        System.out.println(thismax);
    }
    
    public static boolean bfs (int x, int y, int[][] visited) {
        Queue <Point> queue = new LinkedList<Point>();
        queue.add(new Point(x,y));
        while (!queue.isEmpty()) {
            Point cur = queue.poll();
            if(!(cur.x >= 0 && cur.y >= 0 && cur.x < h && cur.y < w)){continue;}
            for (int i=0; i<4; i++) {
                Point now = new Point(cur.x+dx[i], cur.y+dy[i]);
                if(now.x >= 0 && now.y >= 0 && now.x < h && now.y < w){
                    if(s[now.x][now.y] == '.' && visited[now.x][now.y] == 0){
                        visited[now.x][now.y] = visited[cur.x][cur.y] + 1;
                        thismax = Math.max(thismax, visited[now.x][now.y]);
                        queue.add(now);
                    }
                }
            }
        }
        return false;
    }

    static class Point implements Comparable<Point>{
		int x,y;
		public Point(int x,int y){
			this.x=x;
			this.y=y;
		}
		@Override
		public int compareTo(Point j){
			return this.y-j.y;
		}
	}


}


Measured memory_bytes: 36348
#include"bits/stdc++.h"
using namespace std;

int main() {
    long long N, W;
    cin >> N >> W;

    vector<long long> w(N), v(N);
    for (int i = 0; i < N; i++) {
        cin >> w[i] >> v[i];
    }

    vector<vector<long long>> values(4);
    long long base = w[0];
    for (int i = 0; i < N; i++) {
        values[w[i] - base].push_back(v[i]);
    }

    for (int i = 0; i < 4; i++) {
        sort(values[i].begin(), values[i].end(), greater<long long>());
    }

    vector<vector<long long>> sum(4);
    for (int i = 0; i < 4; i++) {
        sum[i].resize(values[i].size() + 1, 0);
        for (int j = 0; j < values[i].size(); j++) {
            sum[i][j + 1] = sum[i][j] + values[i][j];
        }
    }

    long long ans = 0;
    for (int i = 0; i <= values[0].size(); i++) {
        for (int j = 0; j <= values[1].size(); j++) {
            for (int k = 0; k <= values[2].size(); k++) {
                for (int l = 0; l <= values[3].size(); l++) {
                    long long all_weight = base * i + (base + 1) * j + (base + 2) * k + (base + 3) * l;
                    if (all_weight <= W) {
                        long long all_value = sum[0][i] + sum[1][j] + sum[2][k] + sum[3][l];
                        ans = max(ans, all_value);
                    }
                }
            }
        }
    }

    cout << ans << endl;
}

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

int main()
{
  int a, b;
  cin >> a >> b;
  cout << ((a == 1 || b == 1) && (a == 2 || b == 2) ? 3 : \
          (a == 3 || b == 3) && (a == 2 || b == 2) ? 1 : 2) << endl;
}

Measured memory_bytes: 256
S = input()

S = S[:-2]

flg = True

while flg:
    flg = False
    x = 0
    for i in range(len(S) // 2):
        if S[x] != S[len(S) // 2 + x]:
            flg = True
            S = S[:-2]
            break
        x += 1

print(len(S))


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

using namespace std;

int main()
{
  int n;
  cin>>n;
  int temp;
  int a[n];


  for(auto i = 1 ;i<=n ; i++)
  {
    cin>>temp;
    a[temp - 1]=i;
  }


    for(auto i =0 ; i<n ;i++)
      cout<<a[i]<<" ";
  return 0;
}


Measured memory_bytes: 1152
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)  //  repマクロ
#define leng(n) (int)(log10(n)+1)  //  桁数
using namespace std;

signed main() {
  string s;
  cin >> s;
  int L = s.size();
  int ans = 0;
  for (int i = 0; i < L; i++) {
    int atgc = 0;
  for (int j = i; j < L; j++) {
    if (s[j]=='A'||s[j]=='T'||s[j]=='G'||s[j]=='C') atgc++;
    else {
      ans = max(ans, atgc);
      break;
    }
    if (j==L-1) {
      ans = max(ans, atgc);
      break;
    }
  }
  }
  cout << ans << endl;
}

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

using namespace std;

int n, cnt[1000];
char s[1005];

int main() {
    scanf("%s", s + 1);
    n = strlen(s + 1);
    for (int i = 1; i <= n; ++i)
        cnt[s[i]]++;
    if ((cnt['N'] > 0) ^ (cnt['S'] > 0)) {
        printf("No\n");
        return 0;
    }
    if ((cnt['E'] > 0) ^ (cnt['W'] > 0)) {
        printf("No\n");
        return 0;
    }
    printf("Yes\n");
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	vector<int>cnt(26,1e9);
	for(int i=0;i<n;i++)
	{
		string s;
		cin>>s;
		vector<int>v(26);
		for(int j=0;j<s.size();j++)
		v[s[j]-'a']++;
		for(int j=0;j<26;j++)
		cnt[j]=min(cnt[j],v[j]);
	}
	for(int i=0;i<26;i++)
	cout<<string(cnt[i],i+'a');
	cout<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define endl '\n'
#define ll long long int
#define vi vector<int>
#define vll vector<ll>
#define vvi vector < vi >
#define pii pair<int,int>
#define pll pair<long long, long long>
#define mod 1000000007
#define inf 1000000000000000001;
#define all(c) c.begin(),c.end()
#define mp(x,y) make_pair(x,y)
#define mem(a,val) memset(a,val,sizeof(a))
#define eb emplace_back
#define f first
#define faster ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define s second
#define rep(i, a, b) for(int i = int(a); i <= int(b); ++i)
using namespace std;


bool solve(map<int,int> mp, int ans){
    while(ans){
        if(mp[ans%10] == 1) return false;
        ans/=10;
    }
    return true;
}


int main(){
    faster
    int T = 1;
    while(T--){
        string s;
        cin>>s;
        
        int n = s.size();
        if(n==2){
            if(s[0] == s[1]) cout<<"1 2";
            else cout<<"-1 -1";
            continue;
        }
        
        map<int,int> mp;
        int f = 0,a,b;
        
        rep(i,0,n-3){
            rep(j,i,i+2){
                if(mp[s[j]] == 1){
                    a=i,b=j;
                    f = 1;
                    break;
                }
                mp[s[j]]++;
            }
            if(f) break;
            mp.clear();
        }
        
        if(!f){
            cout<<"-1 -1";
        } else{
            cout<<a+1<<" "<<b+1;
        }
    }
    return 0;
}








Measured memory_bytes: 512
#include<cstdio>
#include<algorithm>
#define MAXN 406
#define MAXM 100006
using namespace std;
int n,m,p[MAXN],fa[MAXN],u[MAXM],v[MAXM],ans,vis[MAXN][MAXN];
int root(int x)
{
	if(fa[x]!=x) fa[x]=root(fa[x]);
	return fa[x];
}
int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1;i<=m;i++)
		scanf("%d%d",&u[i],&v[i]);
	for(int i=1;i<=n;i++)
	{
		p[i]=1;
		for(int j=1;j<=n;j++)
			fa[j]=j;
		for(int j=m;j>=1;j--)
		{
			int l=root(u[j]);
			int r=root(v[j]);
			if(l!=root(i)&&r!=root(i)) continue;
			if(l==root(i)&&r==root(i))
			{
				p[i]=0;
				break;
			}
			if(l!=root(i)) fa[l]=root(i);
			if(r!=root(i)) fa[r]=root(i);
		}
		if(!p[i]) continue;
		for(int j=1;j<=n;j++)
			if(root(j)==root(i)) vis[i][j]=1;
	}
	for(int i=1;i<=n;i++)
		for(int j=i+1;j<=n;j++)
			if(p[i]&&p[j])
			{
				int ok=1;
				for(int k=1;k<=n;k++)
					if(vis[i][k]&&vis[j][k])
					{
						ok=0;
						break;
					}
				ans+=ok;
			}
	printf("%d",ans);
}

Measured memory_bytes: 1408
#include<stdio.h>
int main()
{
	int S, T, U;
	scanf("%d", &S);
	int c = 0;
	
	T = S % 100;
	U = (S - T) / 100;
	
	if(1 <= T && T<= 12) c = c+1;
	if(1 <= U && U<= 12) c = c+2;
	
	if(c==1) printf("YYMM");
	else if(c==2) printf("MMYY");
	else if(c==3) printf("AMBIGUOUS");
	else printf("NA");
	
	return 0;
	
}

Measured memory_bytes: 128
#include<iostream>
#include<string>

using namespace std;


int main()
{
	string str,str2;
	int num,c;
	cin >> str;
	cin >> num;

	if (str.size() % num == 0)c = str.size() / num;
	else c = str.size() / num + 1;

	for (int i = 0; i < c; i++)
	{
		str2.push_back(str[i*num]);
	}
	//cout << str2[str2.size()] << endl;

	//if (str2[str2.size()] == ' ')str2.pop_back();

	cout << str2;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
typedef unsigned long long ULL;

using namespace std;

void process();
int main(){
    int X[3];
    int A,B,C;
    int temp;
    int ans;
    
    cin >> X[0] >> X[1] >> X[2];
    sort(X,X+3);
    A = X[2];
    B = X[1];
    C = X[0];
    //cout << A << endl;
    ans = 0;
    ans = A - B;
    C += A - B;
    while( C < A){
        C+=2;
        ans++;
    }
    if( C > A ){
        ans++;
    }
    cout << ans << endl;
    return 0;
}


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

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

    vector<string> ans;
    for(int i=0;i<s.size();++i){
        int cnt = 0;
        for(int j=0;j<t.size();++j){
            if(s[i+j] == '?' || s[i+j] == t[j])cnt++;
            else break;
        }
        if(cnt == t.size()){
            string tmp = "";
            for(int j=0;j<s.size();++j){
                if(j >= i && j < i + cnt){
                    tmp.push_back(t[j-i]);
                }else if(s[j] == '?'){
                    tmp.push_back('a');
                }else{
                    tmp.push_back(s[j]);
                }
            }
            ans.push_back(tmp);
        }
    }
    sort(ans.begin(), ans.end());
    if(ans.size() == 0)cout << "UNRESTORABLE" << endl;
    else cout << ans[0] << endl;

    return 0;
}


Measured memory_bytes: 256
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		Set<Integer>  mochi = new HashSet<>();
		
		while (sc.hasNext()) {
			mochi.add(sc.nextInt());
		}
		System.out.println(mochi.size());
	}
}


Measured memory_bytes: 23764
// ------------------
// author: MatsuTaku
// date  : 27/02/2020
// ------------------

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

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

  constexpr ll INF = 1e18;
  int n,m;
  while (cin>>n>>m and (n!=0 or m!=0)) {
    vector<int> code(m); for(auto&v:code) cin >> v;
    vector<array<ll, 256>> dp(n+1);
    for (int j = 0; j < n+1; j++) for (int i = 0; i < 256; i++)
      dp[j][i] = INF;
    dp[0][128] = 0;
    for (int i = 0; i < n; i++) {
      ll v; cin>>v;
      for (int f = 0; f < 256; f++) {
        if (dp[i][f]==INF) continue;
        for (auto c:code) {
          ll t = max(min(f+c, 255), 0);
          dp[i+1][t] = min(dp[i+1][t], dp[i][f]+(v-t)*(v-t));
        }
      }
    }
    cout << *min_element(dp[n].begin(), dp[n].end()) << endl;
  }

  return 0;
}



Measured memory_bytes: 42836