akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mp make_pair
#define deb(x) cout<< #x << " " << x << "\n";
#define MAX 9223372036854775807
#define MIN -9223372036854775807
#define PI 3.141592653589
#define setbits(n) __builtin_popcountll(n)
const ll mod=1e9+7;

const int N=3e3+1;
ll dp[N][N],n,pref[N];
string s;

ll go(ll pos, ll last){
    if(pos==n-1) return 1;
    if(dp[pos][last]!=-1)
        return dp[pos][last];
    ll ans=0;
    if(s[pos]=='<'){
        for(int i=last+1;i<=pos+2;i++)
            ans=(ans+go(pos+1,i))%mod;
    }
    else{
        for(int i=1;i<=last;i++)
            ans=(ans+go(pos+1,i))%mod;
    }
    return dp[pos][last]=ans;
}


int main() {
    
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll T=clock();
    
    cin>>n;
    cin>>s;
    //memset(dp,-1,sizeof(dp));
    //cout<<go(0,1);
    dp[1][1]=1;
    for(ll i=2;i<=n;i++){
        pref[0]=0;
        for(int j=1;j<=i-1;j++)
            pref[j]=(pref[j-1]+dp[i-1][j])%mod;
        for(ll j=1;j<=i;j++){
            int l,r;
            if(s[i-2]=='<')
                dp[i][j]+=(pref[j-1]-pref[0]+mod)%mod;
            else
                dp[i][j]+=(pref[i-1]-pref[j-1]+mod)%mod;
            dp[i][j]%=mod;
        }
    }
    ll ans=0;
    for(ll i=1;i<=n;i++)
        ans=(ans+dp[n][i])%mod;
    cout<<ans;

    cerr<<"\n\nTIME: "<<(double)(clock()-T)/CLOCKS_PER_SEC<<" sec\n";
    T = clock();
    return 0;
}

Measured memory_bytes: 49892
#include<iostream>
#include<cstdio>
#include<cstring>
#define ll long long
#define maxn 200020
using namespace std;
int len; 
char s[maxn]; 
int main(){
	scanf("%s",s+1); 
	len=strlen(s+1);
	int pos=1;
	ll ans=0;
	for(int i=1;i<=len;++i)
	if(s[i]=='W')ans+=i-pos,++pos;
	printf("%lld\n",ans);
	return 0;
} 

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using P = pair<ll, ll>;
#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 all(x) (x).begin(), (x).end()
const ll INF = ll(1e18)+1;

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

    ll N;
    cin >> N;
    vector<ll> Ai(N);
    rep(i,N){
        cin >> Ai[i];
    }

    ll count = 0;
    map<ll,ll> mp;

    rep(i,N){
        count += mp[i-Ai[i]];
        // cout << mp[i-Ai[i]] << "\n";
        mp[Ai[i]+i]++;
    }

    cout << count;
}

Measured memory_bytes: 27340
#include <stdio.h>

int main(void) {
	int a, b;
	char ope;
	scanf("%d %c %d", &a, &ope, &b);
	if (ope == '+') {
		printf("%d", a + b);
	}
	else {
		printf("%d", a - b);
	}
	return 0;
}



Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
void dfs(int node,int p,int c,int inc[],int val[],vector<int>adj[]){
	val[node]=c+inc[node];
	for(auto u:adj[node]){
		if(u==p) continue; 
		dfs(u,node,c+inc[node],inc,val,adj);
	}	
  
	return ;
}

int main(){
	int n,q; cin>>n>>q; 

	vector<int>adj[n+1];
	for(int i=1;i<n;i++){
		int x,y; cin>>x>>y; 
		adj[x].push_back(y);
		adj[y].push_back(x);
	}

	int inc[n+1]={0};
	int val[n+1]={0};

	for(int i=1;i<=q;i++){
		int x,y; cin>>x>>y; 
		inc[x]+=y;
	}

	dfs(1,0,0,inc,val,adj);

	for(int i=1;i<=n;i++){
		cout<<val[i]<<" ";
	}

}

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

int main(){
  string S;
  int K;
  cin >> S >> K;
  int ans=-1;
  for(int i=0; i<K; i++){
    if(S.at(i)!='1'){
      ans=i;
      break;
    }
  }
  if(ans!=-1) cout << S.at(ans) << endl;
  else cout << 1 << endl;
}

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

int main() {
    string S; cin >> S;
    if (S[S.size() - 1] == 's') {
        S += "es";
    } else {
        S += "s";
    }
    cout << S << endl;
}


Measured memory_bytes: 3620
#include "bits/stdc++.h"
using namespace std;
#define repr(i,a,b) for(long long i=(long long)(a);i<(long long)(b);i++)
#define rep(i,n) repr(i,0,n)
#define reprrev(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define reprev(i,n) reprrev(i,0,n)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define mp make_pair
#define mt make_tuple
#define MOD 1000000007
#define PI 3.1415926535
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> Pi;
typedef pair<ll, ll> Pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<Pi> vPi;
typedef vector<Pll> vPll;
typedef vector<vector<int>> vvi;
typedef vector<vector<bool>> vvb;
typedef vector<vector<ll>> vvll;
typedef vector<vector<char>> vvc;
typedef vector<vector<string>> vvs;
typedef vector<vector<double>> vvd;
typedef vector<vector<Pi>> vvPi;
typedef priority_queue<int, vector<int>, greater<int>> pqli;
typedef priority_queue<ll, vector<ll>, greater<ll>> pqlll;
typedef priority_queue<Pi, vector<Pi>, greater<Pi>> pqlP;
string YN(bool y) { return (y?"YES":"NO"); }
string yn(bool y) { return (y?"Yes":"No"); }
string ON(bool y) { return (y?"OK":"NG"); }
int main(void)
{
	vs s(3);

	vi a(3);

	rep(i, 3){
		cin>>s[i];
		a[i]=stoi(s[i]);
	}
	sort(all(a));

	cout<<a[2]*10+a[1]+a[0]<<endl;
	
}


Measured memory_bytes: 256
#include <stdio.h>

int main()
{
  int a,b;
  scanf("%d%d",&a,&b);
  char s[a][b][6];
  char snuke[6] = {"snuke"};
  int i;
  int j;
  int k;
  k = 0;
  i = 0;
  while (i < a)
  {
    j = 0;
    while (j < b)
    {
      scanf("%s",&s[i][j]);
      k = 0;
      while (s[i][j][k])
      {
        if (s[i][j][k] != snuke[k])
        {
          break;
        }
        else if (k == 4)
        {
          printf("%c%d",'A'+j,i+1);
          return (0);
        }
        k++;
      }
      j++;
    }
    i++;
  }
}

Measured memory_bytes: 128
/// awoooooo

# include <bits/stdc++.h>
# define sz(x) (int)((x).size())

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair < int, int > pii;

const int N = (int)2e5 + 5;
const int inf = (int)1e9 + 7;

int n, a, b;

int main(){
  cin >> n >> a >> b;
  if((b - a) % 2 == 0){
    cout << "Alice\n";
  } else{
    cout << "Borys\n";
  }
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<map>
#include<set>
#include<queue>
#include<cstdio>
#include<climits>
#include<cmath>
#include<cstring>
#include<string>
#include<sstream>
#include<numeric>
#include<cassert>

#define f first
#define s second
#define mp make_pair

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define rep(i,s,n) for(int i=(s); i<(int)(n); i++)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++)
#define ALL(c) (c).begin(), (c).end()
#define IN(x,s,g) ((x) >= (s) && (x) < (g))
#define ISIN(x,y,w,h) (IN((x),0,(w)) && IN((y),0,(h)))
#define print(x) printf("%d\n",x)

using namespace std;

typedef unsigned int uint;
typedef long long ll;

const int _dx[] = {0,1,0,-1};
const int _dy[] = {-1,0,1,0};

int getInt(){
  int ret = 0,c;
  c = getchar();
  while(!isdigit(c)) c = getchar();
  while(isdigit(c)){
    ret *= 10;
    ret += c - '0';
    c = getchar();
  }
  return ret;
}

#define U 0
#define D 2
#define L 1
#define R 3

bool check[4][4];
int mapping[128];
int main(){
  int n;
  cin >> n;

  REP(i,4) REP(j,4) check[i][j] = true;

  check[R][L] = false;

  REP(i,4) check[i][i] = false;

  mapping['U'] = U;
  mapping['R'] = R;
  mapping['D'] = D;
  mapping['L'] = L;

  while(n --> 0){
    string str;
    bool ansl = true;
    bool ansr = true;
    cin >> str;
    for(int i=0; i<str.size()-1; i+=2){
      int l = mapping[str[i]];
      int r = mapping[str[i+1]];
      if(!check[l][r]){
        ansl = false;
      }
      if(!check[r][l]){
        ansr = false;
      }
    }
    puts((ansl | ansr)?"Yes":"No");
  }

  return 0;
}

Measured memory_bytes: 0
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
     
#include "bits/stdc++.h"
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
#define rep2(i,a,b) for(int i=(a);i<(b);++i)
#define rrep(i,n) for(int i=(n)-1;i>=0;--i)
#define rrep2(i,a,b) for(int i=(a)-1;i>=b;--i)
#define range(i,a,b,c) for(int i=a;							\
												 c>0?i<b:							\
												 i>b;								\
												 i+=c)
#define chmax(a, b) (a = (a) < (b) ? (b) : (a))
#define chmin(a, b) (a = (a) > (b) ? (b) : (a))
using ll = long long;
using ull = unsigned long long;
using ld = long double;
#define all(a) begin(a),end(a)
#define ifnot(a) if(not (a))
#define dump(x)  cerr << #x << " = " << (x) << endl
#define int long long
#ifdef _MSC_VER
const bool test = true;
#else 
const bool test = false;
#endif
     
int dx[] = { 1,0,-1,0 };
int dy[] = { 0,1,0,-1 };
const int INF = 1 << 28;
const ll INFL = (ll)1 << 58;
ll mod_n = (int)1e9 + 7;
const double eps = 1e-10;
typedef long double Real;
// return -1, 0, 1
int sgn(const Real& r) { return (r > eps) - (r < -eps); }
int sgn(const Real& a, const Real &b) { return sgn(a - b); }
     
//.....................
const int MAX = (int)2e5 + 5;
     
vector<string> split(const string &str, char sep) {
	vector<string> v;
	stringstream ss(str);
	string buffer;
	while (getline(ss, buffer, sep)) {
		v.push_back(buffer);
	}
	return v;
}
     
template<class InputIterator>
int sum(InputIterator begin, InputIterator end) {
	return accumulate(begin, end, 0ll);
}

void solve();

signed main() {
	cout << fixed << setprecision(20);
	solve();
	while(true) {
		char s[MAX];
		if (scanf("%s", s) == EOF) break;
		int n = strlen(s);
		for (int i = n - 1; i > -1; i--) {
			ungetc(s[i], stdin);
		}
		solve();
	}
	return 0;
}

int N, M;
vector<int> graph[10];
vector<int> path;
bool visited[10];

int dfs(int cur, int visited_cnt) {
	if (visited_cnt == N) {
		for (auto v : path) {
			cerr << v << " ";
		}
		cerr << endl;
		return 1;
	}
	int res = 0;
	rep(i, graph[cur].size()) {
		int next = graph[cur][i];
		if (visited[next]) continue;
		
		visited[cur] = true;
		path.push_back(cur);
		
		res += dfs(next, visited_cnt + 1);
		
		visited[cur] = false;
		path.pop_back();
	}
	return res;
}

void solve() {
	cin >> N >> M;
	rep(i, M) {
		int a, b;
		cin >> a >> b;
		a--;
		b--;
		graph[a].push_back(b);
		graph[b].push_back(a);
	}
	cout << dfs(0, 1) << endl;
}


Measured memory_bytes: 256
N=input()
k=int(input())
ln=len(N)
DP=[[[0]*2 for _ in range(k+1)] for _ in range(len(N)+1)]
DP[0][0][0]=1
for i in range(1,len(N)+1):
  DP[i][0][1]=1
for i in range(len(N)):
  ni=int(N[i])
  for j in range(1,k+1):
    DP[i+1][j][1]=DP[i][j][1]+max(0,ni-1)*DP[i][j-1][0]+9*DP[i][j-1][1]
    if ni==0:
      DP[i+1][j][0]=DP[i][j][0]
    else:
      DP[i+1][j][0]=DP[i][j-1][0]
      DP[i+1][j][1]+=DP[i][j][0]
print(DP[ln][k][0]+DP[ln][k][1])


Measured memory_bytes: 3064
#include <bits/stdc++.h>
/*                    ॐ Shree ॐ                     */
/* ॐ ॐ ॐ
ॐ भूर् भुवः स्वः
तत् सवितुर्वरेण्यं
भर्गो देवस्य धीमहि
धियो यो नः प्रचोदयात्
*/
using namespace std;
typedef pair<int, int> pp;
typedef long long int ll;
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#else
// online submission
#endif
		int n;
		cin>>n;
		cout<<(1000-n%1000)%1000;
	

}

Measured memory_bytes: 3640
#include <iostream>
using namespace std;
int n,a,b,ok[100010],ans,sum;
int main()
{
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>a>>b; sum=max(sum,max(a,b));
		for(int j=a;j<=b;j++) ok[j]=1;
	}
	for(int i=1;i<=sum;i++) if(ok[i]) ans++;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
const int MAXN=45;
const int INF=1e9;
 
int ice[MAXN][MAXN],dp[MAXN][MAXN][MAXN][MAXN];
int n,m,hx,hy,ans=INF;
 
inline int poi(int lx,int ly,int rx,int ry){
	if(lx>rx||ly>ry) return 0;
	return ice[rx][ry]-ice[rx][ly-1]-ice[lx-1][ry]+ice[lx-1][ly-1];
}
 
int main(){
	ios::sync_with_stdio(0);
	cin >> n >> m;
	memset(dp,0x3f,sizeof dp);
	dp[1][1][n][m]=0;
	for(int i=1;i<=n;i++){
		for(int j=1;j<=m;j++){
			char c;
			cin >> c;
			if(c=='P') hx=i,hy=j;
			ice[i][j]=ice[i-1][j]+ice[i][j-1]-ice[i-1][j-1]+(c=='#');
		}
	}
	for(int i=1;i<=hx;i++)
	for(int j=1;j<=hy;j++)
	for(int k=n;k>=hx;k--)
	for(int l=m;l>=hy;l--){
		ans=min(ans,dp[i][j][k][l]+min(min(poi(i,j,hx,hy),poi(i,hy,hx,l)),min(poi(hx,j,k,hy),poi(hx,hy,k,l))));
		for(int s=i;s<=k;s++)
		for(int t=j;t<=l;t++){
			if(s>=hx&&t>=hy)
				dp[i][j][s][t]=min(dp[i][j][s][t],dp[i][j][k][l]+poi(s+1,j,k,t)+poi(i,t+1,s,l));
			if(s>=hx&&t<=hy)
				dp[i][t][s][l]=min(dp[i][t][s][l],dp[i][j][k][l]+poi(i,j,s,t-1)+poi(s+1,t,k,l));
			if(s<=hx&&t<=hy)
				dp[s][t][k][l]=min(dp[s][t][k][l],dp[i][j][k][l]+poi(s,j,k,t-1)+poi(i,t,s-1,l));
			if(s<=hx&&t>=hy)
				dp[s][j][k][t]=min(dp[s][j][k][t],dp[i][j][k][l]+poi(i,j,s-1,t)+poi(s,t+1,k,l));
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 16256
#include <iostream>
#include <vector>
#include <queue>
#include <cstring>
#define INF 1001001001
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;

#define MAX_V 210

int R[20];
int r;
int dist[MAX_V][MAX_V];

int dp[1<<11][10];
int bitdp(int s,int v){
    if(dp[s][v] >= 0) return dp[s][v];
    if(s == (1<<r)-1){
        return dp[s][v] = 0;
    }
    int res = INF;
    rep(i,r) {
        if (!((s >> i) & 1)) res = min(res, dist[R[v]][R[i]] + bitdp(s | (1 << i), i));
    }

    if (res == INF) res = 0;
    return dp[s][v] = res;
}

int main() {
    int n,m;
    cin >> n >> m >> r;
    rep(i,r){
        cin >> R[i];
        R[i]--;
    }
    rep(i,n){
        rep(j,n){
            if(i!=j) dist[i][j] = INF;
        }
    }
    rep(i,m){
        int a,b,c;
        cin >> a >> b >> c;
//        G[a].push_back(make_pair(b,c));
//        G[b].push_back(make_pair(a,c));
        a--; b--;
        dist[a][b] = c;
        dist[b][a] = c;
    }
    rep(k,n){
        rep(i,n){
            rep(j,n){
                dist[i][j] = min(dist[i][j],dist[i][k] + dist[k][j]);
            }
        }
    }
    //ビットdp
    //dp[すでに到達した点集合][現在の地点]
    int ans = INF;
    rep(i,r){
        memset(dp,-1,sizeof(dp));
        ans = min(ans,bitdp(1<<i,i));
    }

    cout << ans << endl;
    //漸化式は `dp[S+u][u] = dp[S][v] + dist[v][u]`


    return 0;
}

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

using ll = long long;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define reps(i, x) for(int i=1;i<=(int)(x);i++)
#define rrep(i, x) for(int i=((int)(x)-1);i>=0;i--)
#define rreps(i, x) for(int i=(int)(x);i>0;i--)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))
#define vll vector<ll>
#define vi vector<int>
#define vpll vector<pair<ll,ll>>
#define vpi vector<pair<int,int>>
#define mod 1000000007
#define put2darr(arr, row, col) rep(i, row) { rep(j, col) { printf("%18d", arr[i][j]); } cout << endl; }

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

/* 1..10
 * rep:   0 1 2 3 4 5 6 7 8 9
 * reps:  1 2 3 4 5 6 7 8 9 10
 * rrep:  9 8 7 6 5 4 3 2 1 0
 * rreps: 10 9 8 7 6 5 4 3 2 1
 */

int main() {

    int n, k, q, a, s;
    cin >> n >> k >> q;
    s = q - k;
    map<int, int> mp;
    rep(i, q) {
        cin >> a;
        mp[a -1]++;
    }
    rep(i, n){
        if(mp[i] > s){
            cout << "Yes" << endl;
        } else {
            cout << "No" << endl;
        }
    }

    return 0;
}



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

int main() {
  string s, t;
  cin>>s>>t;
  sort(s.begin(), s.end());
  sort(t.begin(), t.end());
  reverse(t.begin(), t.end());
  if (s.compare(t) < 0) {
    cout<<"Yes"<<endl;
  } else {
    cout<<"No"<<endl;
  }
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;

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

Measured memory_bytes: 256
import java.util.Scanner;


 class Main{

	public static boolean search(int A[],int n,int key){
		 A[n]=key;  //???????????¨???????????¢??¢?´¢.
		 int i = 0;
		 while(A[i] != key) 
			 i++;
		return i!= n;
	}
	public static void main(String[] args) {
		int A[]=new int[10001];
		int i,j,n,q,key,sum=0;
		
		Scanner s =new Scanner(System.in);
		n=s.nextInt();
		for(i=0;i<n;i++){
			A[i]=s.nextInt();
		}
		
		q=s.nextInt();
		for(j=0;j<q;j++){
			key=s.nextInt();
			if(search(A,n,key))
                          sum++;
		}
	  System.out.println(sum);
	}

}

Measured memory_bytes: 40616
#include <iostream>

int main(int argc, char **argv) {
  std::string s; 
  std::cin >> s;
  unsigned int tmp = 0;
  for(int i=0; i<s.length()/2; i++)
    if(s[i] != s[s.length()-i-1]) tmp++;
  std::cout << tmp;
  return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <set>
#include <stdio.h>
#include <string>
#include <utility>
#include <vector>

using namespace std;

long long gcd(long long a, long long b) {
  if (a % b == 0)
    return b;
  return gcd(b, a % b);
}

int main() {
  long long n, m;
  cin >> n >> m;
  string s, t;
  cin >> s >> t;
  long long l = n * m / gcd(n, m);
  int g = gcd(n, m);
  map<long, long> mp;
  for (int i = 0; i < n; i++) {
    mp[i * m / g] = s[i];
  }
  for (int i = 0; i < m; i++) {
    if (mp[i * n / g] != 0) {
      if (mp[i * n / g] != t[i]) {
        cout << "-1" << endl;
        return 0;
      }
    } else {
      mp[i * n / g] = t[i];
    }
  }
  cout << l << endl;
  return 0;
}


Measured memory_bytes: 10880
#include <bits/stdc++.h>
#define REP(i,n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i,a,b) for (ll i=(a);i<(ll)b; i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define INF 1LL << 60
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll,ll> p;
const long long MOD=1000000007;

// vector<p> cut(M);
// cut[i].second
// cut[i].first;
// REP(i,M){
//     int a,b;cin>>a>>b;
//     cut[i] = make_pair(b,a);//last first の順番
// }
// for(int i=0; i<N;i++){
// }
// sort(cut.begin(),cut.end()); //sort
// char '' str ""
int main(void)
{
    int N[4];
    int aa;
    char res[3];
    cin>>aa;

    for(int i=0;i<=3;i++){
      N[3-i] = aa % 10;
      aa /= 10;
    }

    for(int bit=0; bit<(1<<3); bit++){
      int sum = N[0];

      for(int i=0;i<3;i++){
        if(bit & (1<<i)){
          sum += N[i+1]; res[i]='+';
        }else{
          sum -= N[i+1]; res[i]='-';
        }
      }

      if(sum==7){
        cout<<N[0];
        for(int i=0;i<3;i++){
          cout<<res[i]<<N[i+1];
        }
        cout<<"=7"<<endl;
        return 0;
      }

    }

    return 0;
}


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

int main()
{
	int a, b;
	char op[100];

	while (strcmp(op, "?"))
	{
		scanf("%d%s%d", &a, &op, &b);

		if (!strcmp(op, "+"))
		{
			printf("%d\n", a + b);
		}
		else if (!strcmp(op, "-"))
		{
			printf("%d\n", a - b);
		}
		else if (!strcmp(op, "*"))
		{
			printf("%d\n", a * b);
		}
		else if (!strcmp(op, "/"))
		{
			printf("%d\n", a / b);
		}
	}

	return 0;
}

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

#define ll long long
#define ull unsigned long long
#define N 100005
#define mod 1000000007
#define boost ios_base::sync_with_stdio(false);cin.tie(0)
#define prec(n) fixed<<setprecision(n)

#define mii unordered_map<int,int>
#define mll unordered_map<ll,ll>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define fi  first

#define se second
#define pb push_back
#define mp make_pair
#define pp pop_back
#define vii vector<int>
#define vll vector<ll>
#define vpp vector<pii>
#define all(c) c.begin(),c.end()
#define tr(it,c) for(it = c.begin() ; it!=c.end() ; it++)
int inf = INT_MAX ;
ll modulo(ll num,ll MOD=mod){ return ((num%MOD)+MOD)%MOD;} // for negative integer
ll power(ll b,ll e,ll MOD=mod){ll ans=1; while(e){if(e%2) ans=(ans*b)%MOD; b=(b*b)%MOD; e/=2;} return ans;}
ll inv(ll num,ll MOD=mod){ return power(modulo(num),MOD-2,MOD); }
ll gcd(ll a,ll b){ return ((b==0) ? a:gcd(b,a%b));}

int main(){
	boost;
    int x,y,a,b,c;
    cin>>x>>y>>a>>b>>c;
    ll a1[a],b1[b],c1[c];
    for(int i = 0;i<a;i++){
        cin>>a1[i];
    }

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

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

    sort(a1,a1+a);
    sort(b1,b1+b);
    sort(c1,c1+c);

    vector<ll> v;
    int j = c - 1;
    for(int i=0;i<x;i++){
        v.pb(a1[a-1-i]);
    }

    for(int i=0;i<y;i++){
        v.pb(b1[b-1-i]);
    }
    sort(all(v));
    for(int i = 0;i<v.size()&&j>=0;i++){
        if(v[i]<c1[j]){
            v[i] = c1[j];
            j--;
        }
    }

    ll sum = 0;
    for(int i = v.size()-1;i>=0;i--){
        sum = sum + v[i];
    }
    cout<<sum;
    return 0;
}


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

template<typename integer>
integer __lcm(integer a, integer b) {
  return (a * b) / __gcd(a, b);
}

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

  vector<long long> dp(87);
  dp[0] = 2;
  dp[1] = 1;

  rep (i, 85) {
    dp[i+2] = dp[i] + dp[i+1];
  }

  cout << dp[n] << endl;
  return 0;
}



Measured memory_bytes: 256
c=[list(map(int,input().split())) for _ in range(3)]
a=[0]*3
b=[0]*3
b[0]=c[0][0]-a[0]
b[1]=c[0][1]-a[0]
b[2]=c[0][2]-a[0]
a[1]=c[1][1]-b[1]
a[2]=c[2][2]-b[2]

f=0

for i in range(3):
    for j in range(3):

        if a[i]+b[j]==c[i][j]:
            f+=1
if f==9:
    print('Yes')
else:
    print('No')            

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

int main(){
                                                                     

    int n, i, j, f;

    
    cin >> n;

    vector<int> dp(100010);


    for( i = 1 ; i < 100001 ; i = i + 1 ){

         dp.at(i) = 100000;

         j = 1;

         while( j <= i ){

                dp.at(i) = min( dp.at(i), 1 + dp.at(i - j) );

                j *= 6;

                }

         f = 1;

         while( f <= i ){

                dp.at(i) = min( dp.at(i), 1 + dp.at(i - f) );

                f *= 9;

                }

         }


    cout << dp.at(n) << endl;

    return 0;

    }

Measured memory_bytes: 640
// Problem : B - Making Triangle
// Contest : AtCoder - AtCoder Beginner Contest 175
// URL : https://atcoder.jp/contests/abc175/tasks/abc175_b
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

/*⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⣠⣶⡾⠏⠉⠙⠳⢦⡀⠀⠀⠀
⠀⠀⠀⣴⠿⠏⠀⠀⠀⠀⠀⠀⢳⡀⠀
⠀⠀⢠⣟⣋⡀⢀⣀⣀⡀⠀⣀⡀⣧⠀
⠀⠀⢸⣯⡭⠁⠸⣛⣟⠆⡴⣻⡲⣿⠀
⠀⠀⣟⣿⡭⠀⠀⠀⠀⠀⢱⠀⠀⣿⠀
⠀⠀⠙⢿⣯⠄⠀⠀⠀⢀⡀⠀⠀⡿⠀⠀
⠀⠀⠀⠀⠹⣶⠆⠀⠀⠀⠀⠀⡴⠃⠀⠀
⠀⠀⠀⠀⠀⢸⣷⡦⢤⡤⢤⣞⣁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⢀⣤⣴⣿⣏⠁⠀⠀⠸⣏⢯⣷⣖⣦⡀⠀⠀⠀⠀⠀⠀
⢀⣾⣽⣿⣿⣿⣿⠛⢲⣶⣾⢉⡷⣿⣿⠵⣿⠀⠀⠀⠀⠀⠀
⣼⣿⠍⠉⣿⡭⠉⠙⢺⣇⣼⡏⠀⠀⠀⣄⢸⠀⠀⠀⠀⠀⠀
⣿⣿⣧⣀⣿.........⣀⣰⣏⣘⣆⣀⠀
*/
#include <bits/stdc++.h> 
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
 
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
 
 
using namespace std;
using namespace __gnu_pbds;
 
typedef long long   ll;
typedef long double ld;
typedef complex< ld > cd;
 
typedef pair<int, int> pi;
typedef pair<ll, ll>   pl;
typedef pair<ld, ld>   pd;
 
typedef vector< int > vi;
typedef vector< ld >  vd;
typedef vector< ll >  vl;
typedef vector< pi >  vpi;
typedef vector< pl >  vpl;
typedef vector< cd >  vcd;
 
#define l00p(i, a, b) for (int i=a; i<(b); i++)
#define loop(i, a)    for (int i=0; i<(a); i++)
#define rep1(i, a, b) for (int i = (b)-1; i >= a; i--)
#define rep(i, a)     for (int i = (a)-1; i >= 0; i--)
#define trav(a, x)    for (auto& a : x)
#define uid(a, b)     uniform_int_distribution<int>(a, b)(rng)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f  first
#define s  second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define ins insert
//#define MOD 998244353
 
template<class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const ld pii=3.14159265359; 
const int MOD = 1000000007;
const char nl = '\n';
const ll INF = 1e18;
const int MX = 100001; //check the limits, dummy

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0); 
	int n;
	cin>>n;
	vi a(n);
	loop(i,n)
		cin>>a[i];
		int ans=0;
	loop(i,n)
	{
		l00p(j,i,n)
		{
			l00p(k,j,n)
			{
				if(a[i]!=a[j] && a[i]!=a[k] && a[j]!=a[k])
				{
					if(a[i]+a[j]>a[k] && a[i]+a[k]>a[j] && a[j]+a[k]>a[i])
						ans++;
				}
			}
		}
	}
	cout<<ans<<nl;
	return 0;
}
// read the question correctly (ll vs int)
// template by bqi343

Measured memory_bytes: 3640
#include<vector>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<iostream>
#define LL long long
using namespace std;
vector<LL> vec[100010],l[100010],r[100010];
LL n,mod;
struct node{
	LL y,next;
}a[200010];LL len=0,last[100010],f[100010];
LL ans[100010];
void ins(LL x,LL y)
{
	a[++len].y=y;
	a[len].next=last[x];last[x]=len;
}
void dfs(LL x,LL fa)
{
	f[x]=1;LL tot=0;
	for(LL i=last[x];i;i=a[i].next)
	{
		LL y=a[i].y;
		if(y==fa) continue;
		dfs(y,x);
		vec[x].push_back(y);
		l[x].push_back(0);r[x].push_back(0);
		(f[x]*=(f[y]+1))%=mod;
		tot++;
	}
	for(LL i=0;i<tot;i++)
	{
		l[x][i]=(i==0)?1:l[x][i-1];
		(l[x][i]*=(f[vec[x][i]]+1))%=mod;
	}
	for(LL i=tot-1;i>=0;i--)
	{
		r[x][i]=(i==tot-1)?1:r[x][i+1];
		(r[x][i]*=(f[vec[x][i]]+1))%=mod;
	}
}
void solve(LL x,LL c)
{
	ans[x]=(f[x]*(c+1))%mod;
	for(LL i=0;i<vec[x].size();i++)
	{
		LL y=vec[x][i];
		LL c1=(i==0)?1:l[x][i-1];
		LL c2=(i==vec[x].size()-1)?1:r[x][i+1];
		solve(y,(c+1)*c1%mod*c2%mod);
	}
}
int main()
{
	scanf("%lld %lld",&n,&mod);
	for(LL i=1;i<n;i++)
	{
		LL x,y;scanf("%lld %lld",&x,&y);
		ins(x,y);ins(y,x);
	}
	dfs(1,0);solve(1,0);
	for(LL i=1;i<=n;i++) printf("%lld\n",ans[i]);
}


Measured memory_bytes: 27520
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>

using namespace std;

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

	string ans = "";
	while (n != 0)
	{
		int r = n % 2;
		if (r < 0)
		{
			r += 2;
		}
		ans.push_back((char)'0' + r);
		n = (n - r) / (-2);
	}

	reverse(ans.begin(), ans.end());
	if (ans == "")
	{
		cout << 0 << endl;
	}
	cout << ans << endl;
}

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

using namespace std;

int main(void)
{

    int m;
    scanf(" %d", &m);
    for(int i = 0; i < m; i++){
        int syoki;
        scanf(" %d", &syoki);
        int y;
        scanf(" %d", &y);
        int n;
        scanf("%d", &n);
        int syurui, tesuu;
        double nenri;
        int ma = 0;
        for(int j = 0; j < n; j++){
            scanf(" %d %lf %d", &syurui, &nenri, &tesuu);

            // main
            if(syurui == 1){
                int a = syoki, b;
                for(int k = 0; k < y; k++){
                    b = a * nenri;
                    a = a + b - tesuu;
                }
                ma = max(ma, a);
           //     printf("\t -->: %d", a);
            } else if(syurui == 0){
                int a = syoki, b, d = 0;
                for(int k = 0; k < y; k++){
                    b = a * nenri;
                    a = a - tesuu;
                    d += b;
                }
             //   printf("\t -->: %d", a + d);
                ma = max(ma, a + d);
            }
        }
        printf("%d\n", ma);
    }
    return 0;
}

Measured memory_bytes: 1060
#include <iostream>
#include <locale>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <limits>
#include <iomanip>
using namespace std;

int main() {
	int n;
	cin >> n;
	
	int x[n],y[n];
	
	for(int i=0;i<n;i++) cin >> x[i];
	for(int i=0;i<n;i++) cin >> y[i];
	
	double d1,d2,d3,d4;
	
	for(int i=0;i<n;i++) {
		double d = abs(x[i]-y[i]);
		d1 += d;
		d2 += pow(d,2.0);
		d3 += pow(d,3.0);
		d4  = max(d4, d);
	}
	d2 = pow(d2,1/2.0);
	d3 = pow(d3,1/3.0);
	
	cout << fixed << setprecision(6) << d1 << endl;
	cout << fixed << setprecision(6) << d2 << endl;
	cout << fixed << setprecision(6) << d3 << endl;
	cout << fixed << setprecision(6) << d4 << endl;

	return 0;
}


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

int main(){
  unsigned long long x; cin >> x;
  unsigned long long i;
  unsigned long long ans = 0;
  for (unsigned long long i = 100; i < x; i += (unsigned long long)(i * 0.01))
  {
    //cout << i << endl;
    ans++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3632
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();
  if( a < b ){
    System.out.println( "a < b" );
  }else if ( a > b ){
    System.out.println( "a > b" );
  }else{
    System.out.println( "a == b");
  }
 }
}


Measured memory_bytes: 26328
#include <algorithm>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <vector>

using namespace std;

#define rep(i, n) for (int64_t i = 0; i < (n); i++)
#define irep(i, n) for (int64_t i = 0; i <= (n); i++)
#define rrep(i, n) for (int64_t i = (n)-1; i >= 0; i--)
#define rirep(i, n) for (int64_t i = n; i >= 0; i--)

template <typename T>
class SegmentTree {
    const T unit;
    const function<T(const T&, const T&)> op;
    vector<T> container;

public:
    template <typename Op>
    SegmentTree(int size, const T& identity, const Op& operation)
        : unit(identity)
        , op(operation)
        , container(msb(size * 2 - 1))
    {
        fill(container.begin(), container.end(), unit);
    }
    void update(size_t index, T value)
    {
        int n = container.size() / 2;
        container[index + n] = value;

        int node = (index + n) >> 1;
        while (node > 0) {
            container[node] = op(container[node << 1], container[(node << 1) + 1]);
            node >>= 1;
        }
    }
    T find(size_t s, size_t t)
    {
        if (s >= t) {
            return unit;
        }
        return find_inner(s, t, 0, container.size() / 2);
    }

private:
    T find_inner(size_t s, size_t t, size_t lb, size_t ub)
    {
        if (s == lb && t == ub) {
            int n = container.size() / 2;
            return container[lca(n + s, n + t - 1)];
        }

        T result = unit;
        size_t mid = (lb + ub) / 2;
        if (mid > s) {
            result = op(result, find_inner(s, min(mid, t), lb, mid));
        }
        if (mid < t) {
            result = op(result, find_inner(max(s, mid), t, mid, ub));
        }

        return result;
    }
    int lca(int n0, int n1)
    {
        int a = n0 ^ n1;
        return n0 / msb(a);
    }
    int msb(int x)
    {
        x |= x >> 1;
        x |= x >> 2;
        x |= x >> 4;
        x |= x >> 8;
        x |= x >> 16;

        return x + 1;
    }
};

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

    vector<int> h(n), a(n);
    rep(i, n)
    {
        cin >> h[i];
    }
    rep(i, n)
    {
        cin >> a[i];
    }

    SegmentTree<int64_t> dp(n + 1, 0, [](const int64_t& lh, const int64_t& rh) {
        return max(lh, rh);
    });
    dp.update(0, 0);
    rep(i, n)
    {
        dp.update(h[i], dp.find(0, h[i]) + a[i]);
    }
    cout << dp.find(0, n + 1) << endl;
    return 0;
}

Measured memory_bytes: 5888
#include<stdio.h>
int main(){
	int i,j;
	int h,tmp;
	int top[4]={0};
	for(i=0;i<10;i++){
		scanf("%d",&h);
		for(j=2;j>=0;j--)
			if(top[j]<h){
				top[j+1]=top[j];
				top[j]=h;
			}
	}
	for(i=0;i<3;i++)printf("%d\n",top[i]);
	return 0;
}

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

typedef long long ll;

#define REP(i, n) for (int i = 0; i < (n); i++)
#define INF (1<<30)

class DisjointSet {
public:
	vector<ll> rank, p;

	DisjointSet() {}
	DisjointSet(ll size) {
		rank.resize(size, 0);
		p.resize(size, 0);
		for (ll i = 0; i < size; i++) makeSet(i);
	}

	void makeSet(ll x) {
		p[x] = x;
		rank[x] = 0;
	}

	bool same(ll x, ll y) {
		return findSet(x) == findSet(y);
	}

	void unite(ll x, ll y) {
		link(findSet(x), findSet(y));
	}

	void link(ll x, ll y) {
		if (rank[x] > rank[y]) {
			p[y] = x;
		}
		else {
			p[x] = y;
			if (rank[x] == rank[y]) {
				rank[y]++;
			}
		}
	}

	ll findSet(ll x) {
		if (x != p[x]) {
			p[x] = findSet(p[x]);
		}
		return p[x];
	}
};

int main() {
	ll n, a, b, q;
	ll t;

	cin >> n >> q;
	vector<ll> A(q), B(q);
	for (ll i = 0; i < q; i++) {
		cin >> A[i] >> B[i];
		A[i]--; B[i]--;
	}
	DisjointSet ds = DisjointSet(n);
	vector<ll> c(n, 1);

	ll ans = 0, x;
	for (ll i = 0; i<n; i++) ans += i;
	x = ans;

	vector<ll> res;
	for (ll i = q - 1; i >= 0; i--) {
		if (ds.same(A[i], B[i])) {

		}
		else {
			ll pcA, pcB;
			pcA = ds.findSet(A[i]); pcB = ds.findSet(B[i]);
			//cout <<" "<< A[i] <<" "<< B[i] << endl;
			//cout << pcA <<" "<< pcB << endl;

			ll u = c[pcA] + c[pcB];
			ans -= c[pcA] * c[pcB];
			ds.unite(A[i], B[i]);
			ll pu = ds.findSet(A[i]);
			c[pu] = u;

		}

		cerr<< ans << endl;
		res.push_back(ans);
	}

	reverse(res.begin(), res.end());
	for (ll i = 1; i<res.size(); i++) cout << res[i] << endl;
	cout << x << endl;

	return 0;
}


Measured memory_bytes: 6132
import bisect
import copy
import heapq
import sys
import itertools
import math
import queue
from functools import lru_cache
input = sys.stdin.readline
sys.setrecursionlimit(1000000)
mod = 998244353

def read_values(): return map(int, input().split())
def read_index(): return map(lambda x: int(x) - 1, input().split())
def read_list(): return list(read_values())
def read_lists(N): return [read_list() for n in range(N)]


def main():
    a = input()
    print("a" if a.islower() else "A")


if __name__ == "__main__":
    main()



Measured memory_bytes: 93432
#include <iostream>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <stdlib.h>
#include <cstring>
#include <math.h>


using namespace std;


int main(){
    int r;
    cin >> r;
    cout << 3*r*r << endl;
    return 0;

}

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

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





using ll = long long;


const int maxn = 1e6 + 5;


ll n,x,mod;

map<ll,ll> A;
map<ll,ll> Ai;

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0);  cout.tie(0);
    cin>>n>>x>>mod;

    A[1] = x;
    ll start = -1, end = -1;
    
    for (ll i=2; ;i++) {
	A[i]=A[i-1]*A[i-1]%mod;
	if (Ai.count(A[i])) {
	    start = Ai[A[i]];
	    end = i;
	    break;
	} else {
	    Ai[A[i]] = i;
	}
    }



    
    // watch(start);
    // watch(end);
    // for (int i=1; i<=end; i++) {
    // 	cout<<A[i]<<" ";
    // }
    // cout<<endl;


    if (n < start) {
	ll res = 0;
	for (int i=1; i<=n; i++) {
	    res += A[i];
	}
	out(res);
    }

    ll cycle = 0;
    vector<ll> v;
    for (int i=start; i<end; i++) {
	cycle += A[i];
	v.push_back(A[i]);
    }

    ll len = end-start;
    ll iters = (n-(start-1))/len;


    ll res = 0;
    for (int i=1; i<start; i++) {
	res += A[i];
    }

    res += iters*cycle;

    ll at = start + len*iters;
    ll todo = n - at + 1;

    for (int i=0; i<todo; i++) {
	res += v[i];
    }

    cout<<res<<endl;
    return 0;
}


Measured memory_bytes: 10132
#include <stdio.h>

int main(void){
	long n, x, a, sum = 0, pre = 0;

	scanf("%ld%ld", &n, &x);
	for(int i=0; i < n; i++) {
		scanf("%ld", &a);
		if(pre + a > x) {
			sum += pre + a - x;
			a = x - pre;
		}
		pre = a;
	}
	printf("%ld", sum);

	return 0;
}


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

typedef long long ll;

const ll mod=1e9+7;
const int maxn=2e5+5;

ll sum[maxn];
ll a[maxn];
map<ll,ll> mp;
int main(){
	int n,m;
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++){
		scanf("%lld",a+i); 
	}
	
	for(int i=1;i<=n;i++){
		sum[i]=sum[i-1]+a[i];
	}
	for(int i=1;i<=n;i++){
		sum[i]=(sum[i]-i%m+m)%m;
	}
	
	int low=min(m-1,n);
	ll ans=0;
	for(int i=0;i<=low;i++){
		ans+=mp[sum[i]];
		mp[sum[i]]++;
	}
	for(int i=low+1;i<=n;i++){
		mp[sum[i-m]]--;
		ans+=mp[sum[i]];
		mp[sum[i]]++;
	}
	printf("%lld",ans);
	return 0;
}

Measured memory_bytes: 15872
#include <iostream>
#include <string>
using namespace std;
int main(){
	string S;
  	string T;
    cin>>S>>T;
  	int tmp;
  	tmp = size(T);
  	T.erase(tmp-1);
  	//cout << tmp <<"\n";
  	if(S==T){
    	cout << "Yes" <<"\n";
    }else{
    	cout << "No" <<"\n";
    }
    return 0;
}

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

using ll = long long;

int main() {
  ll H;
  cin >> H;
  ll ans{1};
  ll div{2};
  while (H / div > 0) {
    ans += div;
    div *= 2;
  }

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


Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
ll INF = 1e18;
int MOD = 1e9+7;
main(){
    int N,A[200000];
    ll sum = 0,mind = INF,sumd = 0;
    cin >> N;
    for(int i = 0;i < N;i++){
        cin >> A[i];
        sum += A[i];
    }
    for(int i = 0;i < N-1;i++){
        sumd += A[i];
        sum -= A[i];
        mind = min(mind,llabs(sum-sumd));
    }
    cout << mind << endl;
}   

Measured memory_bytes: 1024
#[allow(unused_imports)]
use itertools::Itertools;
#[allow(unused_imports)]
use num::*;
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::*;
#[allow(unused_imports)]
use std::collections::*;

fn solve() {
    input! {
        a: char
    };

    let res = if a.is_ascii_uppercase() { "A" } else { "a" };
    println!("{}", res);
}

fn main() {
    std::thread::Builder::new()
        .name("big stack size".into())
        .stack_size(256 * 1024 * 1024)
        .spawn(|| {
            solve();
        })
        .unwrap()
        .join()
        .unwrap();
}


Measured memory_bytes: 2180
#include<bits/stdc++.h>
using namespace  std;
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int x,y,z;
    while(cin>>x>>y>>z)
    {
        cout<<z<<' '<<x<<' '<<y<<' '<<endl;
    }
    return 0;
}


Measured memory_bytes: 3612
from fractions import gcd
from functools import reduce

MOD = 10 ** 9 + 7
N = int(input())
A = list(map(int, input().split()))

L = reduce(lambda x, y: x * y // gcd(x, y), A)

ans = 0
for i in range(N):
    ans += L // A[i]
print(ans % MOD)


Measured memory_bytes: 6100
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a;
  int b;
  cin >> a >> b;
  int sum = 0;
  
  for (int i = a; i <= b; i++){
    if(i % 10 == i / 10000 % 10 && i / 10 % 10 == i / 1000 % 10) sum++;
  }
  cout << sum << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<atcoder/all>
using namespace std;
using namespace atcoder;
int main(){
  int N,Q;
  cin>>N>>Q;
  fenwick_tree<long long> F(N);
  for(int i=0;i<N;i++){
    int a;
    cin>>a;
    F.add(i,a);
  }
  while(Q--){
    int a,b,c;
    cin>>a>>b>>c;
    if(a)cout<<F.sum(b,c)<<endl;
    else F.add(b,c);
  }
}

Measured memory_bytes: 8208
import sys
n = int(input())
if n<100:
  print(0)
  sys.exit()

a = n%100
if a==0:
  print(1)
  sys.exit()
b = n//100
if 5*b<a:
  print(0)
  sys.exit()
for i in range(b+1):
  for j in range(b-i+1):
    for k in range(b-i-j+1):
      for l in range(b-i-j-k+1):
        for m in range(b-i-j-k-l+1):
          if i+2*j+3*k+4*l+5*m==a:
            print(1)
            sys.exit()
print(0)

Measured memory_bytes: 3064
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <cmath>
# include <functional>
# include <utility>
# include <queue>
# include <stack>
# define MOD 1000000007
# define INF 2000000000
#define rep(i,rept)	for(ll i = 0; i<rept;i++)
typedef long long ll;
using namespace std;
int main() {
	int ans = 0, counter = 0, maxi = -1, mini = INF,pass=0;
	//new
	int N = 0;
	pair<int, int>stu[100001];
	cin >> N;
	rep(i, N) {
		cin >> pass;
		stu[i] = make_pair(pass, i+1);
	}
	sort(stu, stu + N);
	rep(i, N) {
		cout << stu[i].second << endl;
	}
}



Measured memory_bytes: 1536
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef unsigned int uint;
typedef unsigned char uchar;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;

#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();i++)
#define RFOR(i,c) for(__typeof((c).rbegin())i=(c).rbegin();i!=(c).rend();i++)
#define ALL(container) (container).begin(), (container).end()
#define RALL(container) (container).rbegin(), (container).rend()
#define SZ(container) ((int)container.size())
#define mp(a,b) make_pair(a, b)
#define pb push_back
#define eb emplace_back
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

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 (a>b) { a=b; return 1; } return 0; }
template<class T> ostream& operator<<(ostream &os, const vector<T> &t) {
os<<"["; FOR(it,t) {if(it!=t.begin()) os<<","; os<<*it;} os<<"]"; return os;
}
template<class T> ostream& operator<<(ostream &os, const set<T> &t) {
os<<"{"; FOR(it,t) {if(it!=t.begin()) os<<","; os<<*it;} os<<"}"; return os;
}
template<class S, class T> ostream& operator<<(ostream &os, const pair<S,T> &t) { return os<<"("<<t.first<<","<<t.second<<")";}
template<class S, class T> pair<S,T> operator+(const pair<S,T> &s, const pair<S,T> &t){ return pair<S,T>(s.first+t.first, s.second+t.second);}
template<class S, class T> pair<S,T> operator-(const pair<S,T> &s, const pair<S,T> &t){ return pair<S,T>(s.first-t.first, s.second-t.second);}

const int INF = 1<<28;
const double EPS = 1e-8;
const int MOD = 1000000007;


int T, n, m;
string s = "CODEFESTIVAL2016";
int main(int argc, char *argv[]){
	ios::sync_with_stdio(false);
	string t;
	cin >> t;
	int ans = 0;
	REP(i, s.size()) ans += s[i] != t[i];
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
n = int(input())
p = list(input().split())
p = [int(p[i]) for i in range(n)]
count = 0

for i in range(1, n-1):
    if p[i-1] > p[i] > p[i+1] or p[i-1] < p[i] < p[i+1]:
        count += 1

print(count)

Measured memory_bytes: 3064
#include <cstdio>

using namespace std;

int main() {
	int n;
	scanf("%d",&n);
	long long ans = 0;
	for (int i = 1; i <= n; i++) {
		if (!(i%3) || !(i%5)) {
			continue;
		}
		ans += i;
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 1688
N = int(input())
A = map(int, input().split())
B = list(map(int, input().split()))
B.append(0)

z = 0
ans = 0
for a, b in zip(A, B):
    ans += min(a, b + z)
    z = max(0, b - max(0, a - z))

print(ans)


Measured memory_bytes: 81124
#include <iostream> 
#include <string> 
#include <vector> 
#include <cmath> 
#include <algorithm> 
#include <cstdlib> 
#include <ctime> 
#include <cstdio> 
#include <functional> 
#include <set> 
#include <sstream> 
#include <cctype>
#include <stack>
#include <queue>
#include <cstring>
#include <map>
#include <list>
#include <cassert>
 
using namespace std; 

long long eval(string eq, int pos=0){

	long long res=0;
	for(;pos<eq.size();pos++){
		if('0'<=eq[pos] && eq[pos]<='9') res=res*10LL+(long long)(eq[pos]-'0');
		else return res+eval(eq,pos+1);
	}

	return res;

}

int main(){

	string s;
	cin>>s;

	int n=s.size()-1;
	long long sum=0;

	for(int bit=0;bit<(1<<n);bit++){
		string eq;
		for(int i=0;i<n;i++){
			eq+=s[i];
			if(bit&(1<<i)) eq+='+';
		}
		eq+=s[n];
		sum+=eval(eq);
	}
	cout<<sum<<endl;



}

Measured memory_bytes: 256
#include<iostream>
#include<memory.h>
#include<algorithm>
using namespace std;
int  dp[1002][1002];
const int INF = 1ll << 30;
int main()
{
	int c[1001],d[1001] ;
	int n, m;
	cin >> n >> m;
	for (int i = 0; i <1002; i++){
		for (int i2 = 0; i2 <1002; i2++){
			dp[i][i2] = INF;
		}
		
	}
	for (int i = 0; i < n; i++){
		cin >> d[i];
	}
	for (int i = 0; i < m; i++){
		cin >> c[i];
	}
	dp[0][0] = 0;
	for (int i = 0; i < m; i++){
		for (int i2 = 0; i2 <= n; i2++){
			if (dp[i][i2]  != INF){
				dp[i + 1][i2] = min(dp[i][i2],dp[i+1][i2]);
				dp[i + 1][i2+1] =  min(dp[i+1][i2+1],dp[i][i2] +d[i2] * c[i]);
			}
		}
	}
	cout << dp[m][n] << endl;
}

Measured memory_bytes: 5088
// AOL Q.0181
// YAMADA Terushige 2013.4.3.
 
#include<iostream>
#include<set>
#include<map>
#include<vector>
#include<algorithm>
 
using namespace std;

int M,N,D[100];

bool store(int w){
  int sum=0;
  int dan=1;
  for(int i=0;i<N;i++){
    sum+=D[i];
    if(sum>w){
      sum=0;
      dan++;
      if(dan > M) return false;
      i--;
    }      
  }
  return true;
}
 
int main(){
  int wmin,wmid,wmax;
  while(cin >> M >> N){
    if(M == 0 && N == 0) break;
    for(int i=0;i<N;i++){
      cin >> D[i];
    }
    wmin = 1;
    wmax = 1500000;
    while(wmin<wmax){
      wmid = (wmin + wmax)/2;
      if(store(wmid)) wmax = wmid;
      else wmin = wmid +1;
    }
    cout << wmax << endl;
  }
  return 0;
}


Measured memory_bytes: 1160
#include<iostream>
using namespace std;
int main(){
    int S;
    int h;
    int h2;
    int m;
    int s;
    cin>>S;
    h = S/3600;
    h2 = S%3600;
    m = h2/60;
    s = h2%60;
    cout<<h<<":"<<m<<":"<<s<<endl;
}


Measured memory_bytes: 3088
import math

h, w = map(int, input().split())

pic = []
for y in range(h):
  p = []
  for x in input():
    p.append(x)
  pic.append(p)

pic_2 = []
for y in range(h*2):
  p_2 = []
  for x in range(w):
    py = int(math.floor(y / 2))
    if len(pic) <= py:
      p_2.append(pic_2[py][x])
    else:
      p_2.append(pic[py][x])
  pic_2.append(p_2)
    
    
for p in pic_2:
  print(''.join(p))

Measured memory_bytes: 3316
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define all(v) v.begin(),v.end()
#define endll "\n"

#define fin             freopen("input.txt","r",stdin);
#define fout            freopen("output.txt","w",stdout);


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int x,y,m,n;
    cin >> x >> y >> n >> m;
    for(int i=x;i<n;i++) cout << "R";
    for(int i=y;i<m;i++) cout << "U";
    for(int i=x;i<n;i++) cout << "L";
    for(int i=y;i<m;i++) cout << "D";

    cout << "D";
    for(int i=x;i<=n;i++) cout << "R";
    for(int i=y;i<=m;i++) cout << "U";
    cout << "L" << "U";
    for(int i=x;i<=n;i++) cout << "L";
    for(int i=y;i<=m;i++) cout << "D";
    cout << "R" << endl;
    return 0;
}



Measured memory_bytes: 3548
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <string>
#include <iomanip>
#include <math.h>
#include <utility>

#define div1 1000000007

using namespace std;

int main(void)
{
    char c;

    cin >> c;

    c++;

    cout << c << endl;

    return 0;
}

Measured memory_bytes: 256