akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
#include<cstdio>
using namespace std;

const int MAX_N = 10;

int in[MAX_N][3];
int N;
vector<int>vec[10];
typedef pair<int,int>P;
const int INF = 1e8;

void input(){
  for(int i = 0 ; i < N ; i++){
    for(int j = 0 ; j < 3 ; j++){
      cin >> in[i][j];
    }
  }
}

int toTime(int h,int m,int s){
  return 3600*(h/5) + m*60 + s;
}

void printTime(int t){
  int h,m,s;
  h = t/3600;
  t %= 3600;
  m = t/60;
  t %= 60;
  s = t;
  printf("%02d:%02d:%02d",h,m,s);
}

void make(){
  int ind[3] = {0,1,2};
  for(int i = 0 ; i < N ; i++){
    do{
      for(int j = 0 ; j < 60 ; j++){
	int h,m,s;
	h = (in[i][ind[0]]+j)%60;
	m = (in[i][ind[1]]+j)%60;
	s = (in[i][ind[2]]+j)%60;	
	if(h/5*5 + m/12 != h)continue;
	vec[i].push_back(toTime(h,m,s));
      }
    }while(next_permutation(ind,ind+3));
    sort(vec[i].begin(),vec[i].end());
  }
  /*
  for(int i = 0 ; i < N ; i++){
    cout << "i = " << i << endl;
    for(int j = 0 ; j < vec[i].size() ; j++){
      printTime(vec[i][j]);
      cout << endl;
    }
  }
  */
}

void check(int s_id,int e_id,int s,int e,P& res){
  if(e < s)return;
  for(int i = 0 ; i < N ; i++){
    int id = lower_bound(vec[i].begin(),vec[i].end(),s) - vec[i].begin();
    if(id == vec[i].size())return;
    if(vec[i][id] > e)return;
  }
  res = min(res,P(e-s,s));
}

int main(){
  while(cin >> N,N){
    for(int i = 0 ; i < N ; i++)vec[i].clear();
    input();
    make();
    P res = P(INF,INF);
    for(int i = 0 ; i < N ; i++){
      for(int j = 0 ; j < N ; j++){
	if(i == j)continue;
	for(int ii = 0 ; ii < vec[i].size() ; ii++){
	  for(int jj = 0 ; jj < vec[j].size() ; jj++){
	    check(i,j,vec[i][ii],vec[j][jj],res);
	  }
	}
      }
    }
    printTime(res.second);
    cout << ' ';
    printTime(res.second + res.first);
    cout << endl;
    

  }
  return 0;
}

Measured memory_bytes: 1256
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <numeric>
#include <cmath>
#include <cassert>

using namespace std;

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

#define rep(i,n) for(int i=0;i<(n);++i)
#define all(x) x.begin(),x.end()

const ll mod = 1e9+7;
const ll INF = 1e9;

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

bool check(int x1,int x2,int x3){
	return (x1<=x2 && x2<=x3)||(x1>=x2 && x2>=x3);
}

int main()
{
	int n;
	cin>>n;
	vector<int>a(n+2,0);
	for (int i = 1; i < n+1; i++){
		cin>>a[i];
	}
	int sum = 0;
	for (int i = 1; i <= n+1; i++){
		sum += abs(a[i-1]-a[i]);
	}
	for (int i = 1; i < n+1; i++){
		cout<<sum - abs(a[i-1]-a[i]) - abs(a[i]-a[i+1]) + abs(a[i-1]-a[i+1])<<endl;
	}
	
	return 0;
}

Measured memory_bytes: 1664
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<stack>
#include<vector>
using namespace std;
#define MAX 100
#define WHITE 0
#define GRAY 1
#define BLACK 2

int d[MAX],f[MAX];
int color[MAX];
vector<int> V[MAX];
int tt=0,n=0;
stack<int> S;

void dfs(int x){
  S.push(x);
  d[x]=++tt;
  color[x]=GRAY;
  while(!S.empty()){
    int u=S.top();
    int next=-1;
    for(int i=0;i<V[u].size();i++){
      if(color[V[u][i]]==WHITE){
        next=V[u][i]; break;
      }
    }
    if(next==-1){
      color[u]=BLACK;
      S.pop();
      f[u]=++tt;
      continue;
    }
    color[next]=GRAY;
    S.push(next);
    d[next]=++tt;
  }
}

void begindfs(){
  for(int i=0;i<n;i++){
    if(color[i]==WHITE) dfs(i);
  }
}

int main(){
  int u,v,j;
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>u>>v;
    u--;
    for(int k=0;k<v;k++){
      cin>>j;
      j--;
      V[u].push_back(j);
    }
  }
  begindfs();
  for(int i=0;i<n;i++){
    cout<<i+1;
    printf(" %d %d\n",d[i],f[i]);
  }

}



Measured memory_bytes: 3296
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
typedef long long llong;
const int inf = 1 << 20;
const int mod = 1e9 + 7;
int main() {
   int a, b;
   cin >> a >> b;
   cout << a * b << " " << (2 * a + 2 * b) << endl;
   return 0;
}


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

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

vector<vector<int>>road(m,vector<int>(2));

for(int z=0;z<m;z++)cin>>road.at(z).at(0)>>road.at(z).at(1);

for(int i=1;i<=n;i++){
	int x=0;
		for(int j=0;j<m;j++){
			if(road.at(j).at(0)==i)x++;
			else if(road.at(j).at(1)==i)x++;
		}
	cout<<x<<endl;

}
return 0;
}

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

using namespace std;

#define LOG(...) fprintf(stderr, __VA_ARGS__)
//#define LOG(...)
#define FOR(i, a, b) for(int i=(int)(a); i<(int)(b); ++i)
#define REP(i, n) for(int i=0; i<(int)(n); ++i)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define EXIST(s, e) ((s).find(e)!=(s).end())
#define SORT(c) sort(ALL(c))
#define RSORT(c) sort(RALL(c))
#define SQ(n) (n) * (n)

typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int MAX_VALUE = 1000007;
bool prime[MAX_VALUE];

int main() {
  FOR(i, 2, MAX_VALUE){
    if(prime[i]) continue;
    for(int j = i * 2; j<MAX_VALUE; j+=i)
      prime[j]=true;
  }

  int n;
  while(cin >> n) {
    int cnt = 0;
    FOR(i, 2, n + 1){
      if (!prime[i]) cnt++;
    }
    cout << cnt << endl;
  }
}

Measured memory_bytes: 3960
// セグ木

#include <bits/stdc++.h>
#define FOR(i,a,n) for(ll i=(ll)a;i<(ll)n;i++)
#define rep(i,n) FOR(i,0,n)
using namespace std;
typedef long long ll;

const ll mod=1e9+7;

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

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

template<typename T,typename E>
struct SegmentTree{
private:
    typedef function<T(T,T)> F;
    typedef function<T(T,E)> G;
    int n;
    T identity;
    F f;
    G g;
    vector<T> dat;
    void init(int n_){
        n=1;
        while(n<n_)n*=2;
        dat.assign(2*n-1,identity);
    }
    void build(int n_,vector<T> v){
        for(int i=0;i<n_;i++) dat[i+n-1]=v[i];
        for(int i=n-2;i>=0;i--) dat[i]=f(dat[i*2+1],dat[i*2+2]);
    }

public:
    SegmentTree(int n_,F f,G g,T id,vector<T>v=vector<T>()):identity(id),f(f),g(g){
        init(n_);
        if(n_==(int)v.size()) build(n_,v);
    }
    void update(int k,E a){
        k+=n-1;
        dat[k]=g(dat[k],a);
        while(k>0){
            k=(k-1)/2;
            dat[k]=f(dat[k*2+1],dat[k*2+2]);
        }
    }
    T query(int a,int b){
        T vl=identity,vr=identity;
        for(int l=a+n,r=b+n;l<r;l>>=1,r>>=1){
            if(l&1) vl=f(vl,dat[(l++)-1]);
            if(r&1) vr=f(dat[(--r)-1],vr);
        }
        return f(vl,vr);
    }
};


int main(){
    int n;
    cin>>n;
    vector<int> a(n);
    rep(i,n)cin>>a[i];
    SegmentTree<int,int> seg(
        n,
        [](int a,int b){return __gcd(a,b);},
        [](int a,int b){return b;},
        0,
        a
    );

    int ans=-1;
    rep(i,n){
        chmax(ans,__gcd(seg.query(0,i),seg.query(i+1,n)));
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 2432
#include <iostream>

using namespace std;

int main()
{
    int N, A[128], a_min, a_max;
    
    cin >> N >> A[0];
    a_min = a_max = A[0];
    for (int i = 1; i < N; i++) {
        cin >> A[i];
        a_min = min(a_min, A[i]);
        a_max = max(a_max, A[i]);
    }
    cout << a_max - a_min << endl;
}

Measured memory_bytes: 256
#include <cstdint>
#include <limits>
#include <utility>
#include<array>
#include<cassert>

using u64 = std::uint_fast64_t;
static_assert(std::numeric_limits<u64>::digits == 64,
  "this implementation is specialized for 64 bit unsigned integer");

constexpr u64 bounded_pow(const u64 base, const u64 exp) noexcept {
  constexpr u64 Inf = std::numeric_limits<u64>::max();
  u64 bit = 1;
  while (bit <= exp) {
    bit <<= 1;
  }
  u64 ret = 1;
  const u64 basemult_limit = Inf / base;
  while(bit>>=1){
    if (ret >= (u64(1) << 32)) {
      return Inf;
    }
    ret *= ret;
    if (exp&bit) {
      if (ret > basemult_limit) {
        return Inf;
      }
      ret *= base;
    }
  }
  return ret;
}

std::pair<u64, u64> perfect_power_factorization(u64 n) {
  assert(n != 0);
  if (n == 1) {
    return { 1, 0 };
  }
  //u64 floor_log2 = 63 - __builtin_clzll(n);
  u64 floor_log2 = 0;
  while (floor_log2!=63&&(u64(1) << (floor_log2 + 1)) <= n) {
    ++floor_log2;
  }
  {
    if (n == (u64(1) << floor_log2)) {
      return { u64(2), floor_log2 };
    }
  }
  {
    const u64 log3 = (floor_log2 + 1) * 7 / 11;
    u64 base = 3;
    u64 exp = log3;
    u64 pow3 = 1;
    while (exp) {
      if (exp & 1) {
        pow3 *= base;
      }
      base *= base;
      exp >>= 1;
    }
    if (pow3 == n) {
      return { u64(3), log3 };
    }
  }
  u64 ret_exp = 1;
  const std::array<u64, 9> primes = { 2, 3, 5, 7, 11, 13, 17, 19, 23 };
  for (std::size_t i = 0; i != 9;) {
    const u64 k = primes[i];
    if (floor_log2 < k * 2) {
      break;
    }
    u64 prov = u64(1) << (floor_log2 / k);
    u64 check_bit = prov;
    while (check_bit >>= 1) {
      prov ^= check_bit;
      const u64 bp = bounded_pow(prov, k);
      if (bp == n) {
        floor_log2 /= k;
        n = prov;
        ret_exp *= k;
        --i;
        break;
      }
      else if (bp > n) {
        prov ^= check_bit;
      }
    }
    ++i;
  }
  return { n, ret_exp };
}

u64 pow(u64 base, u64 exp) {
  u64 ret = 1;
  for (u64 i = 0; i < exp; ++i) {
    ret *= base;
  }
  return ret;
}

#include<iostream>

int main() {
  u64 x;
  std::cin >> x;
  while (perfect_power_factorization(x).second == 1) {
    --x;
  }
  std::cout << x << std::endl;
  return 0;
}


Measured memory_bytes: 256
N=int(input())
count=0
l=[]
for i in range(N):
    x,y=map(int,input().split())
    # l=[]
    # l.append(x)
    # l.append(y)
    # lst.append(l)
    if x==y:
        count+=1
    if x!=y:
        l.append(count)
        count=0
if len(l)==0:
    
    l.append(count)
l.sort()
x2=l[-1]
if x2>=3:
    print("Yes")
else:
    print("No")

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

#define check cout<<"-------"<<endl
#define debug(x) cout<<x<<endl;
#define loop(i,x,n) for(int i = x; i < n; i++)
#define lop(i,n) repi(i,0,n)
#define fix(x) cout<<fixed<<setprecision(x);

int main() {
    
    while(1) {
        int h, w;
        cin>>h>>w;
        if(h == 0 && w == 0) break;
        
        for(int i = 1; i <= h; i++) {
            for(int j = 1; j <= w; j++) {
                if(i != 1 && j != 1 && i != h && j != w) {
                    cout<<'.';
                    continue;
                }
                cout<<'#';
            }
            cout<<endl;
        }
        cout<<endl;
    }
    
    return 0;
}


Measured memory_bytes: 3080
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstring>
#include <map>
#include <set>
#include <queue>
#include <cstdio>
#include <cmath>
#include <limits.h>
using namespace std;
typedef long long LL;

int L;
vector<int> vc;

int main() {
	scanf("%d",&L);
	for(int i=20;i>=0;i--) {
		if((L>>i)&1) vc.push_back(i);
	}
	int n=vc[0]+1,m=vc[0]*2+vc.size()-1;
	printf("%d %d\n",n,m);
	for(int i=1;i<n;i++) {
		printf("%d %d 0\n",i,i+1);
	}
	for(int i=1;i<n;i++) {
		printf("%d %d %d\n",i,i+1,(1<<(i-1)));
	}
	int sum=1<<vc[0];
	for(int i=1;i<vc.size();i++) {
		int u=vc[i];
		printf("%d %d %d\n",u+1,n,sum);
		sum+=1<<u;
	}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
using namespace std;
#define rep(i,x) for(ll i = 0; i < (ll)(x); i++)
#define rrep(i,x) for(ll i = (ll)(x)-1;0 <= i; i--)
#define reps(i,x) for(ll i = 1; i < (ll)(x)+1; i++)
#define rreps(i,x) for(ll i = (ll)(x); 1 <= i; i--)
#define debug(x) cerr << #x << ": " << (x) << "\n";
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<vector<ll>>> vvvl;
const ll INF = numeric_limits<ll>::max()/4;
const int n_max = 1e5+10;

int main(){
    bool ok = true;
    ll a,b,c; cin >> a >> b >> c;
    if(c - a - b <= 0)ok = false;
    if(4 * a * b >= ((c - a - b) * (c - a - b)))ok = false;

    // ld a,b,c; cin >> a >> b >> c;
    // if(sqrt(a) + sqrt(b) < sqrt(c))ok = true;
    // else ok = false;

    cout << (ok ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int) n; i++)
#define repb(i, n) for (int i = (int) n; i >= 0; i--)
#define reps(i, m, n) for (int i = (int) m; i < (int) n; i++)
#define repsb(i, m, n) for (int i = (int) m; i >= (int) n; i--)
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
# define pb(a) push_back(a)
#define ll long long int
int dy[] = { 0, 0, 1, -1, 0 };
int dx[] = { 1, -1, 0, 0, 0 };
const ll LLINF = 1e18 + 10;
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; }
//vector<vector<int>> vec(n_rows, vector<int>(n_cols, value));
using namespace std;
int main(int argc, char const * argv[]){
    vector<vector<int> > v(3,vector<int>(3,-1));
    int n,ans,tate,yoko;
    ans = 0;
    
    rep(i,3)rep(j,3) cin>>v[i][j];
    cin>>n;
    vector<int> b(n, -1);

    rep(i,n) cin>>b[i];
    rep(i,n){
        rep(s,3) rep(t,3){
            if(b[i]==v[s][t])
                v[s][t] = 0;
        }
    }
    rep(i,3){
        tate=yoko = 0;
        rep(j, 3)
        {
            tate += v[i][j];
            yoko += v[j][i];
        }
        if(tate==0)
            ans++;
        if (yoko==0)
            ans++;
        if (v[0][0] + v[1][1] + v[2][2] == 0)
            ans++;
        if(v[0][2]+v[1][1]+v[2][0]==0)
            ans++;
    }
    if(ans!=0) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;

    
    
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll  long long
#define fio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define mod 1000000007
int main() {
    fio;
    string s;
    string s1;
    cin>>s>>s1;
    ll x=s.size();
    for(ll i=0;i<x;i++){
        if(s[i]!=s1[i]){
            cout<<"No"<<endl;
            return 0;
        }

    }
    cout<<"Yes"<<endl;
}



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

int main(){
  int a, b;
  cin >> a >> b;
  if (a < b) {
    cout << "a < b" << endl;
  } else if (a > b) {
    cout << "a > b" << endl;
  } else {
    cout << "a == b" << endl;
  }
}


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

using namespace std;

const int N=65;
int u[N],v[N],w[N],cnt;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int L;
    cin>>L;
    int n=log2(L)+1;
    cnt=0;
    for(int i=1;i<n;i++)
    {
        cnt++;
        u[cnt]=i,v[cnt]=i+1,w[cnt]=0;
        cnt++;
        u[cnt]=i,v[cnt]=i+1,w[cnt]=(1<<(i-1));
    }
    if((1<<n-1)!=L)
    {
        for(int i=1;i<n;i++)
        {
            if(L>>(i-1)&1)
            {
                L-=(1<<(i-1));
                cnt++;
                u[cnt]=i;
                v[cnt]=n;
                w[cnt]=L;
            }
        }
    }
    cout<<n<<' '<<cnt<<'\n';
    for(int i=1;i<=cnt;i++) cout<<u[i]<<' '<<v[i]<<' '<<w[i]<<'\n';
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl
typedef long long ll;
using namespace std;
int static fast = [](){
  ios::sync_with_stdio(false);
  cin.tie(0); cout.tie(0); return 0;
}();

// AB, AAA, BBB, BBAA, AABB, BA, ""
// A, BB, BAA, AAB, ABBB, BBBA, AAAA
// B, AA,
// A = 1, B = 2
vector<int> get_dp(string s) {
    vector<int> dp = {0};
    for(char c: s) {
        if (c == 'A') {
            dp.push_back(dp.back()+1);
        } else {
            dp.push_back(dp.back()+2);
        }
    }
    return dp;
}

int main() {
    string s, t;
    cin >> s >> t;
    int q, s1, s2, t1, t2;
    cin >> q;
    auto dp_s = get_dp(s);
    auto dp_t = get_dp(t);
    while(q--) {
        cin >> s1 >> s2 >> t1 >> t2;
        auto sum_s = dp_s[s2] - dp_s[s1-1];
        auto sum_t = dp_t[t2] - dp_t[t1-1];
        if (sum_s %3 == sum_t %3) {
            cout << "YES" << endl;
        } else {
            cout << "NO" << endl;
        }
    }
    return 0;
}




Measured memory_bytes: 1880
#include <bits/stdc++.h>
using namespace std;
 
#define forn(a, e) for (int a = 0; a < (int)(e); a++)
#define forr(a, s, e) for (int a = s; a < (int)(e); a++)
#define fore(e, a) for (auto& e : a)
 
#ifdef LOCAL
#define logv(a) {cerr << #a << " = "; fore(e, a) {cerr << e << " ";} cerr << "\n";}
#define logvp(a) {cerr << #a << " = "; fore(e, a) {cerr << "(" << e.first << ", " << e.second << ") ";} cerr << "\n";}
#define logvv(a) {cerr << #a << " = \n"; fore(r, a) { fore(e, r) {cerr << e << " ";} cerr << "\n";} }
#define logvf(a, field) {cerr << #a"."#field << " = \n"; fore(e, a) { cerr << e.field << " ";} cerr << "\n"; }
#define logvff(a, f1, f2) {cerr << #a".{"#f1 << ", "#f2 << "} = \n"; fore(e, a) { cerr << "(" << e.f1 <<", " << e.f2 << ") ";} cerr << "\n"; }
#define logs(a) cerr << #a << " = " << (a) << "\n";
#define logss(a, b) cerr << #a << " = " << (a) << ", " << #b << " = " << (b) << "\n";
#define logp(a) cerr << #a << " = " << "(" << a.first << ", " << a.second << ")" << "\n";
#define cond(pred, stmt) if (pred) { stmt }
#else
#define logv(a)
#define logvp(a)
#define logvv(a)
#define logvf(a, field)
#define logvff(a, f1, f2)
#define logs(a)
#define logss(a, b)
#define logp(a)
#define cond(pred, stmt)
#endif
 
using i64 = long long;
using iip = pair<i64, i64>;
using ivec = vector<int>;
using llvec = vector<i64>;
using svec = vector<string>;
template<typename T> using vec = vector<T>;
 
template<typename T, typename Dim>
auto make_vec(T value, Dim dim) { return vector<T>(dim, value); }
template<typename T, typename Dim1, typename... Dim>
auto make_vec(T value, Dim1 dim1, Dim... dims) { return make_vec(make_vec(value, dims...), dim1); }
 
template<typename T>
bool uax(T& v, const T& newv) { if (v < newv) { v = newv; return true; } else return false; }
template<typename T>
bool uin(T& v, const T& newv) { if (v > newv) { v = newv; return true; } else return false; }
 
template<typename T>
istream& operator>>(istream& is, vector<T>& c) { for (auto& e : c) is >> e; return is; }
 
// template<typename ...T>
// istream& read(T&... args) { return (cin >> ... >> args); }
 
static mt19937 rande(123123);
template<typename T>
T rand_int(T from, T to) { uniform_int_distribution<T> distr(from, to); return distr(rande); }
 
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    int x, y;
    while (cin >> x >> y) {
        map<int, int> prize = {
            {1, 300000},
            {2, 200000},
            {3, 100000}
        };
        
        int p = 0;
        p += prize[x];
        p += prize[y];
        if (x == 1 && y == 1) {
            p += 400000;
        }
        cout << p << endl;
    }
    
}

Measured memory_bytes: 256
import java.util.*;
public class Main{
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
      int n = sc.nextInt();
      int m = sc.nextInt();
      int[] a = new int[n];
      int[] b = new int[n];
      int[] c = new int[m];
      int[] d = new int[m];
      int[] p = new int[n];
      int min = 1000000000;
      for(int i = 0;i < n;i++){
      	a[i] = sc.nextInt();
        b[i] = sc.nextInt();
      }
      for(int i = 0;i < m;i++){
      	c[i] = sc.nextInt();
        d[i] = sc.nextInt();
      }
      for(int i = 0;i < n;i++){
      	for(int j = m-1;j >= 0;j--){
        	min = Math.min(Math.abs(a[i]-c[j])+Math.abs(b[i]-d[j]),min);
          if(min == Math.abs(a[i]-c[j])+Math.abs(b[i]-d[j])){
            p[i]=j+1;
          }
        }
        System.out.println(p[i]);
        min = 1000000000;
      }
    }
}

Measured memory_bytes: 21716
#include<iostream>
#include<algorithm>

using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    pair<int, int> odd[100001], even[100001];
    for (int i = 0; i < 100001; ++i) {
        odd[i].second = even[i].second = i;
    }
    for (int i = 0; i < n; ++i) {
        int v;
        cin >> v;
        if (i % 2 == 0) even[v].first++;
        else odd[v].first++;
    }
    sort(even, even + 100001, greater<pair<int, int> >()); // 100001に注意!
    sort(odd, odd + 100001, greater<pair<int, int> >());
    if (even[0].second != odd[0].second) {
        cout << n - even[0].first - odd[0].first << endl;
    } else {
        cout << min(n - even[0].first - odd[1].first, n - even[1].first - odd[0].first) << endl;
    }
    
}


Measured memory_bytes: 1792
#include <iostream>
using namespace std;
int main()
{
  int n,m; //number of cards                                     
  int ct[100],ch[100]; //each card                               
  int sub; //substraction                                        
  while(cin >> n >> m && n){
    int x=200+10;
    int tmpt=0,tmph=0; //temporary                               
    int st=0,sh=0; //sum of cards                                
    for(int i=0;i<n;i++){
      cin >> ct[i];
      st+=ct[i];
    }
    for(int i=0;i<m;i++){
      cin >> ch[i];
      sh+=ch[i];
    }
    //for(int i=0;i<n;i++)                                       
    //cout << ct[i] << endl;                                     
    //for(int i=0;i<m;i++)                                       
    //cout << ch[i] << endl;                                     
    //cout << st << endl;                                        
    //cout << sh << endl;                                        
    if(st>=sh){
      if((sh+st)%2==1)
        cout << "-1" << endl;
      else{
        sub=(st-sh)/2; //????????????????????????                        
        for(int i=0;i<n;i++){
          for(int j=0;j<m;j++){
            if(ct[i]-ch[j]==sub){
              if(ct[i]+ch[j]<x){
                x=ct[i]+ch[j];
                tmpt=ct[i];
                tmph=ch[j];
}
            }
          }
        }
        if(tmpt>0 && tmph>0)
          cout << tmpt << ' ' << tmph << endl;
        else
          cout << "-1" << endl;
      }
    }
    else if(sh>st){
      if((sh+st)%2==1)
        cout << "-1" << endl;
      else{
        sub=(sh-st)/2; //????????????????????????                        
        //cout << sub << endl;                                   
        for(int i=0;i<n;i++){
          for(int j=0;j<m;j++){
            if(ch[j]-ct[i]==sub){
              //cout << ct[i] << ch[j] << endl;                  
              if(ct[i]+ch[j]<x){
                x=ct[i]+ch[j];
                tmpt=ct[i];
tmph=ch[j];
              }
            }
          }
        }
        if(tmpt>0 && tmph>0)
          cout << tmpt << ' ' << tmph << endl;
        else
          cout << "-1" <<endl;
      }
    }
  }
}

Measured memory_bytes: 2996
N = int(input())
list = [list(map(int,input().split())) for i in range(N)]

for i in range(N):
    if list[i][2]:
        x0,y0,h0 = list[i]

for Cx in range(0,101):
    for Cy in range(0,101):
        for i in range(N):
            H = max(h0+abs(x0-Cx)+abs(y0-Cy),0)
            if max(H-abs(list[i][0]-Cx)-abs(list[i][1]-Cy),0) != list[i][2]:
                break
        else:
            print(Cx,Cy,H)

Measured memory_bytes: 3064
#include <iostream>
using namespace std;
int main(){
    long long n,i,j,h[100000],a=0,ans=0;
    cin >> n;
    for (i=0;i<n;i++){
        cin >> h[i];
        if (i>0){
            if (h[i]<=h[i-1])
                a++;
            if (h[i]>h[i-1]||i==n-1){
                if (ans<a)
                    ans=a;
                a=0;
            }
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
typedef long long int lli;
using namespace std;
#pragma region DEBUG
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
#pragma endregion DEBUG
#define MOD 1000000007
#define MAX 500005
#define endl "\n"
lli row[MAX];
lli col[MAX];
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);    
   // freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    lli t;
    t =1 ;
    while(t--){
        lli h,w;
        cin>>h>>w;
        lli m;
        cin>>m;
        vector <pair<lli,lli> > pts;
        for(lli i = 0; i<m; i++){
            lli x,y;
            cin>>x>>y;
            x--;
            y--;
            pts.push_back({x,y});
            row[x]++;
            col[y]++;
        }
        lli finalx = 0;
        lli finaly = 0;
        lli maxmr = *max_element(row,row+h);
        lli maxmc = *max_element(col,col+w);
        for(lli i = 0; i<h; i++){
            if(row[i] == maxmr)
                finalx++;
        }
        for(lli i = 0; i<w; i++){
            if(col[i] == maxmc)
                finaly++;
        }
        lli ans = maxmr+maxmc-1;
        lli count = 0;
        for(lli i =0; i<m; i++){
            lli x,y;
            tie(x,y) =pts[i];  
            if(row[x] == maxmr && col[y] == maxmc)
                count++;
        }
        lli a = finalx;
        lli b = finaly;
        if(count == a*b)
            cout<<ans<<endl;
        else{
            cout<<ans+1<<endl;
        }
    }
}

Measured memory_bytes: 16296
package main

import (
	"fmt"
	"math/big"
)

func lcm(a, b *big.Int) *big.Int {
	d := new(big.Int)
	gcd := d.GCD(nil, nil, a, b)
	mul := new(big.Int).Mul(a, b)
	return new(big.Int).Div(mul, gcd)
}

func main() {
	var N int
	fmt.Scan(&N)
	clocks := make([]int64, N)

	var t int64
	for i := 0; i < N; i++ {
		fmt.Scan(&t)
		clocks[i] = t
	}

	sec := big.NewInt(1)
	for _, v := range clocks {
		sec = lcm(sec, big.NewInt(v))
	}
	fmt.Println(sec)
}


Measured memory_bytes: 640
import bisect
n = int(input())
lst = list(map(int, input().split()))
lst.sort()

ans = 0

for i in range(n-2):
  for j in range(i+1, n-1):
    a = lst[i]
    b = lst[j]
    border = a + b
    dig = bisect.bisect_left(lst, border)
    ans += max(0, dig - j - 1)
    
print(ans)

Measured memory_bytes: 44652
import itertools
import math

n = int(input())
dots = [list(map(int, input().split())) for _ in range(n)]
cities = list(range(n))

res = 0
cnt = 0
for pattern in itertools.permutations(cities, len(cities)):
    cnt += 1
    for i in range(n-1):
        res += math.sqrt((dots[pattern[i]][0] - dots[pattern[i+1]][0]) ** 2 + (dots[pattern[i]][1] - dots[pattern[i+1]][1]) ** 2)


print(res/cnt)


Measured memory_bytes: 3064
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

fn main() {
    let nd: Vec<i32> = read_vec();
    let result = match nd[0] % (2 * nd[1] + 1) {
        0 => nd[0] / (2 * nd[1] + 1),
        _ => nd[0] / (2 * nd[1] + 1) + 1,
    };
    println!("{}", result);
}

Measured memory_bytes: 4352
#pragma GCC optimize ("O3")

#include <bits/stdc++.h>

using namespace std;

#ifdef LOCAL
#include <prettyprint.hpp>
#define debug(...)  cerr << "[" << #__VA_ARGS__ << "]: ", d_err(__VA_ARGS__);
#else
#define debug(...) 83;
#endif

void d_err() {
    cerr << endl;
}

template <typename H, typename... T>
void d_err(H h, T... t) {
    cerr << h << " ";
    d_err(t...);
}

#define ALL(x) (x).begin(), (x).end()
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define bcnt __builtin_popcountll

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<ll,ll> Pll;
typedef pair<int,int> Pin;

ll INF = 1e16;
int inf = 1e9;
ll MOD = 1e9+7;


int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    int N, M, X, Y;
    cin >> N >> M >> X >> Y;

    int xmax = -inf;
    REP(i, N) {
        int x;
        cin >> x;
        xmax = max(xmax, x);
    }

    int ymin = inf;
    REP(i, M) {
        int y;
        cin >> y;
        ymin = min(ymin, y);
    }

    bool f = false;
    FOR(z, X+1, Y+1) {
        if (xmax < z and ymin >= z) {
            f = true;
            break;
        }
    }

    if (f) cout << "No War" << endl;
    else cout << "War" << endl;


}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
#define TRACE
#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif
 
 
typedef long long ll;
 
int cnt(ll a) {
	ll ans = 0;
	while(a % 2 == 0) {
		ans++;
		a = a/2;
	}
	return ans;
}
 
int main() {
	int d,n;
	cin >> d >> n;
	ll ans;
	if(n == 100) {
		ans = 101*pow(100,d);
		cout << ans << endl;
		return 0;
	}
	ans = n*pow(100,d);
	cout << ans << endl;
	// if(d == 0) {
	// 	cout << n
	// }
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
    long long N,M;cin>>N>>M;
    long long A[N],B[N];
    vector<pair<long long,long long>>C(N);
    for(int i=0;i<N;i++){
        cin>>A[i]>>B[i];
        C[i].first=A[i];
        C[i].second=B[i];
    }
    sort(C.begin(),C.end());
    long long ans=0;
    for(long long i=0;i<N;i++){
        ans+=min(C[i].second,M)*C[i].first;
        M-=C[i].second;
        if(M<=0){
            break;
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 6428
#include <cstdio>
#include <iostream>
#include <cstring>
using namespace std;
string st;
int length,res=1;

int main()
{
    scanf("%d",&length);
    cin>>st;
    for(int i=1;i<length;i++)
    {
        res++;
        if(st[i]==st[i-1]) res--;
    }
    printf("%d\n",res);
}

Measured memory_bytes: 512
import java.util.Scanner;

public class Main {

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

		char[][] ans_table = {
				{'H','D'},
				{'D','H'}
		};

		char a = sc.next().charAt(0);
		char b = sc.next().charAt(0);
		int i = a == 'H' ? 0 : 1;
		int j = b == 'H' ? 0 : 1;

		System.out.println(ans_table[i][j]);

		sc.close();
	}

}


Measured memory_bytes: 21972
#include<stdio.h>
#include<algorithm>
#include<limits>
using namespace std;

struct Card {
  char suit;
  int value;
};

void merge(struct Card A[], int left, int mid, int right) {
  int n1 = mid - left;
  int n2 = right - mid;
  struct Card L[n1+1], R[n2+1];
  for (int i=0; i<n1; i++) {
    L[i] = A[left+i];
  }
  L[n1].value = numeric_limits<int>::max();
  for (int i=0; i<n2; i++) {
    R[i] = A[mid+i];
  }
  R[n2].value = numeric_limits<int>::max();
  int i=0, j=0;
  for (int k=left; k<right; k++) {
    if (L[i].value<=R[j].value) {
      A[k] = L[i];
      i++;
    } else {
      A[k] = R[j];
      j++;
    }
  }
}

void mergeSort(struct Card A[], int left, int right) {
  if (left+1 < right) {
    int mid = (left + right)/2;
    mergeSort(A, left, mid);
    mergeSort(A, mid, right);
    merge(A, left, mid, right);
  }
}


int partition(struct Card A[], int p, int r) {
  struct Card x;
  x = A[r];
  int i = p-1;
  for (int j=p; j<r; j++) {
    if (A[j].value<=x.value) {
      i++;
      swap(A[i], A[j]);
    }
  }
  swap(A[i+1], A[r]);
  return i+1;
}

void quickSort(struct Card A[], int p, int r) {
  if (p<r) {
    int q = partition(A, p, r);
    quickSort(A, p, q-1);
    quickSort(A, q+1, r);
  }
}

bool isStable(struct Card A[], struct Card B[], int n) {
  for (int i=0; i<n; i++) {
    if (A[i].suit != B[i].suit) {
      return false;
    }
  }
  return true;
}

int main() {
  int n;
  scanf("%d", &n);
  struct Card A[n], B[n];
  char suit[2];
  int value;
  for (int i=0; i<n; i++) {
    scanf("%s %d", suit, &value);
    A[i].suit = B[i].suit = suit[0];
    A[i].value = B[i].value = value;
  }

  mergeSort(A, 0, n);
  quickSort(B, 0, n-1);

  if (isStable(A, B, n)) {
    printf("Stable\n");
  } else {
    printf("Not stable\n");
  }
  for (int i=0; i<n; i++) {
    printf("%c %d\n", B[i].suit, B[i].value);
  }
  return 0;
}



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

using namespace std;

int n, hold, xam, lol;

vector <int> h;

int main () {
	lol = 0;
	xam = 0;
	cin >> n;
	for(int ana = 0; ana < n; ana++) {
		cin >> hold;
		h.push_back(hold);
	}
	for(int ani = 0; ani < h.size(); ani++) {
		if(h[ani] >= h[ani + 1] && ani + 1 < h.size()) lol++;
		else {
			xam = max(xam, lol);
			lol = 0;
		}
	}
	cout << xam << '\n';
}

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

public class Main {
	static PrintWriter out = new PrintWriter(System.out);
	public static void main(String[] args) throws Exception {
		try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
			int n = Integer.parseInt(br.readLine());
			Map<String, Integer> map = new HashMap<>();
			int max = 0;
			for (int i = 0; i < n; i++) {
				String s = br.readLine();
				int val = map.containsKey(s) ? map.get(s) + 1 : 1;
				map.put(s, val);
				max = Math.max(max, val);
			}
			List<String> list = new ArrayList<>();
			for (String key : map.keySet()) if (map.get(key) == max) list.add(key);
			Collections.sort(list);
			for (String s : list) out.println(s);
			out.flush();
		}
	}
}

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

int main() {
	int S;
	cin >> S;
	int h, m, s;
	h = S / 3600;
	m = S % 3600 / 60;
	s = S % 60;

	printf ("%d:%d:%d\n", h, m, s);
}



Measured memory_bytes: 3220
#include <iostream>

int main()
{
    int A, B;
    std::cin >> A >> B;

    if(B == 1){
        std::cout << 0 << std::endl; return 0;
    }
    
    int c = A;
    int count = 1;
    while(c < B){
        c += A-1; count++;
    }

    std::cout << count << std::endl;
}

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

int main(){
	int a,b,c,ans;
	cin>>a>>b>>c;
	ans=c-a+b;
	if(ans<0){
		cout<<0;
	}else{
		cout<<ans;
	}
	return 0;
}



Measured memory_bytes: 256
from operator import mul
from functools import reduce


def inpl():
    return list(map(int, input().split()))


def cmb(n, r):
    # combination
    if n < r:
        return 0
    r = min(n - r, r)
    if r == 0:
        return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1, r + 1))
    return over // under


N, K = inpl()

MOD = 10**9 + 7

ans = 0
for bluew in range(1, K + 1):
    blue = K - bluew
    red = N - K - (bluew - 1)
    redw = bluew + 1
    # print(bluew, redw)
    tmp = cmb(blue + bluew - 1, bluew - 1) * cmb(red + redw - 1, redw - 1)
    print(tmp % MOD)


Measured memory_bytes: 3944
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace C
{
    public class Program
    {
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            Solve();
            Console.Out.Flush();
        }

        public static void Solve()
        {
            var n = int.Parse(Console.ReadLine());
            var ai = Console.ReadLine().Trim().Split(' ').Select(int.Parse).ToArray();
            Console.WriteLine(ai.Aggregate((x, y) => GCD(x, y)));
        }

        static int GCD(int a, int b) => b == 0 ? a : GCD(b, a % b);
    }
}


Measured memory_bytes: 21344
until (n = gets.to_i) == 0
  i = -1
  before_s = nil
  freq = {}
  current_s = gets.split(' ').map(&:to_i)
  freq = current_s.each_with_object({}) {|v, f| f[v] = (f[v] || 0) + 1 }
  until current_s == before_s
    i += 1
    n_freq = {}
    before_s = current_s
    current_s = current_s.map {|v|
      vv = freq[v]
      n_freq[vv] = (n_freq[vv] || 0) + 1
      vv
    }
    freq = n_freq
  end
  puts i, current_s.join(' ')
end

Measured memory_bytes: 6152
from sys import stdin

N = int(stdin.readline().rstrip())
S = stdin.readline().rstrip()

str = []
for i in range(N):
    str.append(S[i])

result = 0

for i in range(N-1):
    front = str[:i+1]
    tail = str[i+1:]
    tmp = len(set(front) & set(tail))
    if tmp > result:
        result = tmp

print(result)


Measured memory_bytes: 3060
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int a;    //第一个数据
		int b;    //第二个数据
		while(in.hasNext()) {
			a = in.nextInt();
			b = in.nextInt();
			a = a+b;
			String str = String.valueOf(a);
			System.out.println(str.length());
		}
		in.close();
	}
}


Measured memory_bytes: 26332
#include <bits/stdc++.h>
#define debug(x) cerr << "\n" \
                      << #x << " = " << x << ".\n"
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define print(xx) cout << (xx) << endl
using namespace std;
#define int long long
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vint;
const int INF = ((1LL << 30) + (1LL << 29));
const ll MOD = 1000000007;

/* 
*/
//================== INPUT ========================
int N,K;
//=================================================
//=================================================
void input()
{
    cin>>N>>K;
}
//=================================================
void solve()
{
    int ans = (N+K)/2;
    if ((N+K)%2 == 1){
        cout<<"IMPOSSIBLE"<<endl;
    }
    else
    cout<<ans<<endl;
}

//=================================================
signed main()
{
    input();
    solve();
    return 0;
}

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

int main () {
  int n,k; cin >> n >> k;
  string s;cin >>s;
  int i = 1;
  for (char c:s){
    if(i==k){
      if(c=='A') cout << 'a';
      if(c=='B') cout << 'b';
      if(c=='C') cout << 'c';
    }
    else{
      cout << c;
    }
    ++i;
  }
  return 0;
}

Measured memory_bytes: 256
//code by lynmisakura.wish to be accepted!
/****************************/
#include<iostream>
#include<iomanip>
#include<math.h>
#include<vector>
#include<string>
#include<stack>
#include<queue>
#include<map>
#include<algorithm>
#include<bitset>
#include<climits>
#include<set>
#include<bitset>
using namespace std;
/***************************/
typedef long long ll;
typedef vector<ll> vi;
typedef vector<long long> vl;
typedef pair<ll, ll> pi;
typedef vector<pair<ll, ll>> vpi;

//const long long INF = 1LL << 55;

#define itn ll
#define endl '\n'
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ss second
#define ff first
#define dup(x,y) ((x) + (y) - 1)/(y)
#define mins(x,y) x = min(x,y)
#define maxs(x,y) x = max(x,y)
#define all(x) (x).begin(),(x).end()
#define Rep(n) for(ll i = 0;i < n;i++)
#define rep(i,n) for(ll i = 0;i < n;i++)
#define flush fflush(stdout)
#define rrep(i,n) for(ll i = n - 1;i >= 0;i--)
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )
#define ioboost cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20)
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll qp(ll a, ll b) { ll ans = 1; do { if (b & 1)ans = 1ll * ans*a; a = 1ll * a*a; } while (b >>= 1); return ans; }
ll qp(ll a, ll b, ll mo) { ll ans = 1; do { if (b & 1)ans = 1ll * ans*a%mo; a = 1ll * a*a%mo; } while (b >>= 1); return ans; }

#define _GLIBCXX_DEBUG
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl

int main(void){
    int n;cin >> n;
    string s;cin >> s;
    if(n %2 != 0){
        cout << "No" << endl;
        return 0;
    }
    
    for (int i = 0; i < n/2; ++i)
    {
        if(s[i] != s[i + (n / 2)]){
            cout << "No" << endl; return 0;
        }
    }
    cout << "Yes" << endl;
}

Measured memory_bytes: 256
import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
from math import floor
from decimal import Decimal

def main():
    x = int(input())
    n = Decimal(100)
    r = 0
    while n < x:
        n = Decimal(floor((n * Decimal(101) / Decimal(100))))
        r += 1
    print(r)

if __name__ == '__main__':
    main()

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

int main(){
  int N; cin >> N;
  vector<int> P(N); vector<int> Q(N);
  for(auto &it:P)
    cin >> it;
  for(auto &it:Q)
    cin >> it;

  vector<int> permu(N);
  for(int i=0; i<N; i++)
    permu.at(i) = i+1;
  
  int a = 0;
  int b = 0;
  int count = 1;
  
  do{
    bool aflag = true;
    bool bflag = true;
    
    for(int i=0; i<N; i++){
      if(P.at(i) != permu.at(i))
        aflag = false;
      if(Q.at(i) != permu.at(i))
        bflag = false;
    }
    
    if(aflag == true){
      a = count;
    }
    if(bflag == true){
      b = count;
    }
    
    count++;
    
  }while( next_permutation( permu.begin(),permu.end() ));
  
  cout << abs(a-b) << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <climits>
#include <iomanip>
#include <string.h>
#include <algorithm>
#include <functional>

using namespace std;
#define fast ios::sync_with_stdio(false);cin.tie(0); cout.tie(0)
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, a, b) for (int i = (int)(a); i >= b; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
#define all(c) c.begin(), c.end()
#define rall(c) c.rbegin(), c.rend()
#define tr(container, it) \
for(typeof(container.begin()) it = container.begin(); it != container.end(); it++)
#define sz(a) int((a).size())
#define pb push_back

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

template<typename T> T gcd(T a,T b) { if(a==0) return b; return gcd(b%a,a); }
template<typename T> T pow(T a,T b, ll m){T ans=1; while(b>0){ if(b%2==1) ans=(ans*a)%m; b/=2; a=(a*a)%m; } return ans%m; }

const int N = (int)2e5+77;
const int mod = (int)1e9+7;

ll n,m,k,x,y;

int main() {
    fast;
    cin>>n;
    if(n%10==n/100) cout<<"Yes\n";
    else cout<<"No\n";
    return 0;
}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();

		if (1 <= A && A <= 9 && 1 <= B && B <= 9) {
			System.out.print(A * B);
		}else {
			System.out.print("-1");			
		}

	}
}


Measured memory_bytes: 23764
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Text;
using System.Text.RegularExpressions;
using System.Linq;
using System.IO;

class Magatro
{
    private int N, M;
    private int[] D, T;
    public void Solve()
    {
        N = int.Parse(Console.ReadLine());
        D = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
        M = int.Parse(Console.ReadLine());
        T = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();

        if (M > N)
        {
            Console.WriteLine("NO");
            return;
        }
        Array.Sort(D);
        Array.Sort(T);
        int index = -1;
        foreach (int i in T)
        {
            while (true)
            {
                index++;
                if (index >= D.Length)
                {
                    Console.WriteLine("NO");
                    return;
                }
                if (D[index] == i)
                {
                    break;
                }
            }
        }
        Console.WriteLine("YES");
    }

    static public void Main()
    {
        new Magatro().Solve();

    }
}


Measured memory_bytes: 39792
// This amazing code is by Eric Sunli Chen.
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <utility>
#include <vector>
using namespace std;
template<typename T> bool get_int(T &x)
{
	char t=getchar();
	bool neg=false;
	x=0;
	for(; (t>'9'||t<'0')&&t!='-'&&t!=EOF; t=getchar());
	if(t=='-')neg=true,t=getchar();if(t==EOF)return false;
	for(; t<='9'&&t>='0'; t=getchar())x=x*10+t-'0';
	if(neg)x=-x;return true;
}
template<typename T> void print_int(T x)
{
	if(x<0)putchar('-'),x=-x;
	short a[20]= {},sz=0;
	while(x>0)a[sz++]=x%10,x/=10;
	if(sz==0)putchar('0');
	for(int i=sz-1; i>=0; i--)putchar('0'+a[i]);
}
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define get1(a) get_int(a)
#define get2(a,b) (get1(a)&&get1(b))
#define get3(a,b,c) (get1(a)&&get2(b,c))
#define printendl(a) print_int(a),puts("")
typedef long long LL;
typedef unsigned long long uLL;
typedef pair<int,int> pii;
const int inf=0x3f3f3f3f;
const LL Linf=1ll<<61;
const double pi=acos(-1.0);
 
bool np[100111];
int cnt,pr[10111],ans,n,id[100111];
LL a[100111],b[100111],ta[100111];
bool cmp(int x,int y){return b[x]<b[y];}
int main()
{
	np[1]=1;
	for(int i=2;i<100111;i++)if(!np[i])
	{
		pr[++cnt]=i;
		for(int j=i+i;j<100111;j+=i)np[j]=1;
	}
	
	get1(n);
	for(int i=1;i<=n;i++)
	{
		get1(a[i]);
		LL tmp=1;b[i]=1;
		for(int j=1;j<=cnt&&1ll*pr[j]*pr[j]*pr[j]<=a[i];j++)
		{
			while(a[i]%(1ll*pr[j]*pr[j]*pr[j])==0)
				a[i]/=1ll*pr[j]*pr[j]*pr[j];
			if(a[i]%(1ll*pr[j]*pr[j])==0)
			{
				tmp*=1ll*pr[j]*pr[j];
				b[i]*=pr[j];if(b[i]>10000000000ll)b[i]=0;
			}
			else if(a[i]%pr[j]==0)
			{
				tmp*=pr[j];
				b[i]*=pr[j];if(b[i]>10000000000ll)b[i]=0;
				b[i]*=pr[j];if(b[i]>10000000000ll)b[i]=0;
			}
		}
		tmp=a[i]/tmp;int rt=(int)(sqrt(tmp+0.5));
		if(1ll*rt*rt==tmp&&!np[rt])
		{
			b[i]*=rt;if(b[i]>10000000000ll)b[i]=0;
		}
		else
		{
			b[i]*=tmp;if(b[i]>10000000000ll)b[i]=0;
			b[i]*=tmp;if(b[i]>10000000000ll)b[i]=0;
		}
		id[i]=i;ta[i]=a[i];
	}
	sort(a+1,a+n+1);sort(id+1,id+n+1,cmp);
	int cur=0;
	for(int _=1,i;_<=n;_++)
	{
		i=id[_];
		cur++;
		if(_==n||b[i]!=b[id[_+1]])
		{
			if(b[i]!=1)
			{
				int n1=upper_bound(a+1,a+n+1,b[i])-lower_bound(a+1,a+n+1,b[i]);
				if(b[i]==0||n1==0||ta[i]<b[i])
					ans+=max(cur,n1);
//				printf("b= %d cur= %d n1= %d ta= %d ans= %d ok= %d\n",b[i],cur,n1,ta[i],ans,(b[i]==0||n1==0||ta[i]<b[i]));
			}
			else ans++;
//			printf("b= %d ans= %d\n",b[i],ans);
			cur=0;
		}
	}
	printendl(ans);
	return 0;
}

Measured memory_bytes: 3072