akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using static System.Console;
using static System.Math;

namespace CP
{
    class Atria
    {
        static void Main(string[] args)
        {
            int n = int.Parse(ReadLine());
            string s = ReadLine();
            if (n == 1) { WriteLine("No"); return; }
            if (n % 2 == 0)
            {
                var tmp = s.Substring(0, n / 2);
                var hoge = s.Substring(n/2, n / 2);
                WriteLine(
                    tmp == hoge ? "Yes":"No"
                    );
            }
            else
            {
                WriteLine("No");
            }
        }
    }
}


Measured memory_bytes: 13140
#include<cstdlib>
#include<cstring>
#include<cstdio>
#include<string>
#include<algorithm>
#include<queue>
#include<cmath>
#define pi 3.1415926536
using namespace std;

int a[200005];
int main()
{
	int n,T;
	int sum = 0;
	scanf("%d%d",&n,&T);
	for(int i = 1; i <= n; i++){
		scanf("%d",&a[i]);
	}
	for(int i = 2; i <= n; i++){
	if(a[i] - a[i - 1] >= T) sum += T;
	else sum = sum + a[i] - a[i - 1];
	}
	sum += T;
	printf("%d\n",sum);
	return 0;
}

Measured memory_bytes: 896
#include "bits/stdc++.h"
using namespace std;
#define int long long
#define endl '\n'
int mod=1e9+7;
int mod2=998244353;
const int INF=1e9;

signed main(){
  int n;
  cin>>n;
  vector<int> l(n);
  for(int i=0;i<n;i++)cin>>l[i];
  sort(l.begin(),l.end(),greater<int>());
  int x=l[0];
  int sum=0;
  for(int i=1;i<n;i++)sum+=l[i];
  if(x<sum)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define inf 0x3f3f3f3f3f3f3f3fLL
#define rep(i,a,b) for(register ll i=(a);i<=(b);i++)
#define dep(i,a,b) for(register ll i=(a);i>=(b);i--)
using namespace std;
const int maxn=50+5;
const int maxm=5000+5;
//const double pi=acos(-1.0);
//const double eps=1e-9;
const ll mo=1e9+7;
ll n,m,k;
int a[maxn];
ll ans,tmp,cnt;
char s[maxn];
ll power(ll a,ll n)
{
    ll sum=1;
    while(n)
    {
        if(n&1) sum=sum*a%mo;
        n>>=1;
        a=a*a%mo;
    }
    return sum;
}
ll f(ll b,ll n)
{
    if(n<b) return n;
    return (n%b)+f(b,(n/b));
}
int main()
{
    while(scanf("%lld%lld",&n,&m)!=EOF)
    {
        ll ans=inf,tmp=sqrt(n*1.0);
        if(n==m) ans=n+1;
        for(ll i=1;i<=tmp;i++)
        {
            ll b=n/i;
            if((n/b)!=i) continue;
            ll x=n%b;
            ll y=(n/i)-(n/(i+1));
            ll z=m-i-x;
            if(z>=0&&((z/i)<y)&&(z%i==0))
            {
                b-=(z/i);
                if(b>=2&&((n/b)<b)&&(f(b,n)==m))
                ans=min(ans,b);
            }
        }
        for(ll i=2;i<=tmp+5;i++)
        {
            if(f(i,n)==m)
            {ans=min(i,ans);break;}
        }
        if(ans==inf) ans=-1;
        printf("%lld\n",ans);
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<vector>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
using namespace std;

//ループマクロ
#define FOR(i , a , b)  for(int i = (a) ; i < (b) ; i++)
#define REP(i , n)      for(int i = 0 ; i < n ; i++)
#define REPR(i , n)     for(int i = n ; 0 <= i ; i--)

//入出力
#define SCOUT(x) cout << (x) << " "
#define VECCIN(x) for(auto& ele : (x) ) cin >> ele
#define CEVCOUT(x) for(auto& ele : (x) ) cout << ele << " "; cout << endl;

//その他
#define ALL(obj) (obj).begin() , (obj).end() 
#define P pair<int , int>
#define V vector<int>
#define M map<int,int>
#define S set<int>
#define PQ priority_queue<int>
#define PQG priority_queue<int , V , greater<int>>

int main(void){

    int A, B, C;
    cin >> A >> B >> C;
    if(A + B >= C)
      SCOUT("Yes") << endl;
    else
      SCOUT("No" ) << endl;


    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
#include <utility> // pair
#include <string>
#include <vector>
#define MAX_N 200001
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
#define FOR(i, a, b) for(ll i=a; i<b; i++)
#define REP(i, n) for(ll i=0; i<n; i++)
#define REV(i, n) for(ll i=n-1; i>=0; i--)
#define ALL(v) v.begin(), v.end()
#define pb push_back
const ll INF = 9e18;
ll n, c[10][10];

// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

signed main(){
    cin >> n;
    Fill(c, 0);
    for(ll i=1; i<=n; i++){
        ll b = i % 10;
        ll t = i;
        while(t >= 10){
            t /= 10;
        }
        // assert(t > 0);
        c[t][b]++;
    }
    ll ret = 0;
    REP(i, 10) REP(j, 10) ret += c[i][j] * c[j][i];
    cout << ret << endl;
    return 0;
}

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

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

#define mp make_pair
#define pb push_back
#define pt(i) printf("%lld\n",(ll)i)
#define mp make_pair
#define ff first
#define ss second
#define pi acos(-1.0)

ll in() { ll a;scanf("%lld",&a); return a;}
db din(){ db a;scanf("%lf",&a); return a; }
ll bigmod(ll b, ll p,ll md){if(p==0) return 1;if(p%2==1){ return ((b%md)*bigmod(b,p-1,md))%md;} else {ll y=bigmod(b,p/2,md);return (y*y)%md;}}
ll gcd(ll a,ll b){ if(b==0) return a; else return gcd(b,a%b);}

long long getRandom(long long a,long long b){
    long long ret = (long long)rand()*(long long)rand();
    ret %= (b - a + 1);
    ret += a;
    return ret;
}

int dp[100005],ar[100005],n,k;

int solve(int pos)
{
	if(pos==n-1)
		return 0;
	if(dp[pos]!=-1)
		return dp[pos];
	int mn=INT_MAX;
	for(int i=1;i<=k;i++)
	{
		if(pos+i>=n)
			break;
		mn=min(mn,solve(pos+i)+abs(ar[i+pos]-ar[pos]));
	}
	return dp[pos]=mn;
}

int main()
{
	//freopen("in.c","r",stdin);
	//freopen("out.c","w",stdout);
	n=in(),k=in();
	for(int i=0;i<n;i++)
		ar[i]=in();
	memset(dp,-1,sizeof dp);
	pt(solve(0));
}

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

int main() {
	string s;
	cin>>s;
	int i=0,j=s.size()-1,count =0;
	while(i<=j){
		if(s[i]!=s[j])
		count++;
		i++;
		j--;
	}
	cout<<count;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <stdio.h>
#include <iomanip>
#include <limits>
#include <list>
#include <string>
#include <queue>
#include <deque>
#include <tuple>
#include <map>
#include <sstream>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define FOR(i,a,b) for(int i=a; i<(int)(b); i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort(ALL(x))
#define CLR(a) memset((a), 0 ,sizeof(a))
#define PB push_back
#define MP make_pair
#define SP << " " <<
const int INF = 1001001001;
const ll LINF = 100100100100100100;
const double EPS = 1e-10;
const long double PI  = acos(-1.0L);
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
#define chmax(a,b) a = (((a)<(b))?(b):(a))
#define chmin(a,b) a = (((a)>(b))?(b):(a))

__attribute__((constructor))
void initial(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}

const int MAX_V = 10;
int d[MAX_V][MAX_V];
const int V = 10;

void warshall_floyd(){
	rep(k,V){
		rep(i,V){
			rep(j,V){
				chmin(d[i][j],d[i][k]+d[k][j]);
			}
		}
	}
}

signed main(){
  int h,w; cin>>h>>w;
	rep(i,V) rep(j,V) cin>>d[i][j];
	int a[10]; CLR(a);
	rep(i,h) rep(j,w){
		int b; cin>>b;
		if(b!=-1) a[b]++;
	}
	warshall_floyd();
	int ans = 0;
	rep(i,10){
		ans += d[i][1]*a[i];
	}
	cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int MOD = (int)1e9 + 7;
const int INF = 100100100;
const double PI = 3.14159265358979323846;
typedef long long ll;
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)

int main() {
  int n, x[10] = {0}, y[10] = {0};
  cin >> n;
  REP(i, n) cin >> x[i] >> y[i];
  double routeSum = 0.0;
  REP(i, n) {
    FOR(j, i, n) {
      double xx = (double)(x[i] - x[j]) * (x[i] - x[j]);
      double yy = (double)(y[i] - y[j]) * (y[i] - y[j]);
      routeSum += sqrt(xx + yy);
    }
  }
  double ans = routeSum * 2.0 / n;
  cout << fixed << setprecision(6) << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define maxn 10005
#define MOD 998244353
#define INF 10000000

using namespace std;

#define ll long long
#define pii pair<ll, ll>
#define piii pair<ll, pii>
#define ft first
#define sd second

void fast(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
}

ll dp[maxn];

void solve(){
    ll n, r;
    cin >> n >> r;
    ll ans = 0;
    while(n){
        ans++;
        n /= r;
    }cout << ans;
}

int main()
{
    fast();
    int t= 1; //cin >> t;
    while(t--){
        solve();
    }
}

/*
5
1 2
2 3
3 4
3 5
*/


Measured memory_bytes: 256
N, X, Y = map(int, input().split())
X -= 1
Y -= 1

dist_l = [0] * N
for i in range(N):
    for j in range(i+1,N):
        dist_l[min(j-i, abs(i - X) + 1 + abs(Y - j))] += 1

for i in range(1,N):
    print(dist_l[i])

Measured memory_bytes: 3444
#include <iostream>

#define Nfori(N) for(int i=0;i<N;i++)
#define Nforj(N) for(int j=0;j<N;j++)
using namespace std;

int main(){
  	int c[3][3];
  	Nfori(3){
      	Nforj(3) cin >> c[i][j];
    }
  	int difi[2][3];
  	int difj[3][2];
  	Nfori(2){
      	Nforj(3){
          	difi[i][j]=c[i][j]-c[i+1][j];
          	difj[j][i]=c[j][i]-c[j][i+1];
        }
    }
  	string ans = "Yes";
  	Nfori(2){
      	if(difi[i][0]!=difi[i][1] || difi[i][1]!=difi[i][2] || difj[0][i]!=difj[1][i] || difj[1][i]!=difj[2][i]){
          	ans="No";
        }
    }
  	cout << ans << endl;
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
typedef long long ll;
#define ALL(l)  (l).begin(),(l).end()
#define rep(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using namespace std;

//const ll mod =  1000000007;
//const ll maxn = 1000000000;

//---------------------------------------------------------------------------------------------------
using vi = vector<int>; // intの1次元の型に vi という別名をつける
using vll = vector<ll>; // intの1次元の型に vi という別名をつける
using vvll = vector<vll>; // intの2次元の型に vvi という別名をつける
using vs = vector<string>; // stringの1次元の型に vs という別名をつける
using pll = pair<ll, ll>; // これ以降 pii という型名はpair<ll, ll> と同じ意味で使える
//---------------------------------------------------------------------------------------------------

int main() {
    vi b(1000,0);
    
   int n,ans=0;
   cin>>n;
   string s;
   cin>>s;
   vi a(n);
   rep(i,n){
       a.at(i)=s.at(i)-'0';
   }
   rep2(i,1,n-1){
       
       int k=a.at(i);
       vi r(10,0),l(10,0);
       
       rep(j,i){
           l.at(a.at(j))=1;
       }
       rep2(j,i+1,n){
            r.at(a.at(j))=1;
       }
       rep(i,10){
           rep(j,10){
               if(l.at(i)==1&&r.at(j)==1){
                   b.at(100*i+10*k+j)=1;
               }
           }
       }
       
   }
   rep(i,1000){
       ans+=b.at(i);
   }
   cout<<ans<<endl;
    
}



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

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

signed main()
{
    int n,k; cin >> n >> k;

    int ans = k;
    --k;
    rep(i,n-1) ans *= (k);

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<map>
#include<cstdio>
#include<stack>
#include<queue>
#include<fstream>
#include<cstdio>
#include<deque>
#include<iomanip>
#include <numeric>

using namespace std;
#define ok1 printf("ok1\n");
#define ok2 printf("ok2\n");
#define M 1000000000000000000LL
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);(i)--)
#define all(a) (a).begin(),(a).end()
#define reall(a) (a).rbegin(),(a).rend()
#define pb push_back
#define pf push_front
#define MIN(a,b) a=min((a),(b))
#define MAX(a,b) a=max((a),(b))
#define SIZE(v) (int)v.size()
const double pi = acos(-1.0);

typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef deque<ll> dll;
typedef pair<string, int> P;

int main()
{
	ios_base::sync_with_stdio(false);

	ll k;
	string s;
	cin >> s >> k;
	vs v;
	rep(i, s.size()) {
		REP(j, i + 1, i + 10) v.pb(s.substr(i, j - i));
	}
	sort(all(v));
	v.erase(unique(v.begin(), v.end()), v.end());
	cout << v[k - 1] << endl;
	return 0;
}


Measured memory_bytes: 2680
(function main(){
  const lines = require('fs').readFileSync('/dev/stdin', 'utf8').trim().split('\n');
  const n = Number(lines.shift());
  const arr = lines.shift().split(' ');
  buildMaxHeap(arr);
  console.log(' ' + arr.join(' '));
})();

function buildMaxHeap(arr) {
  const n = arr.length;
  const maxHeapify = (i) => {
    let left, right, largest = i;
    left = 2 * i + 1|0;
    right = 2 * i + 2|0;
    if (left < n && Number(arr[left]) > Number(arr[largest])) largest = left;
    if (right < n && Number(arr[right]) > Number(arr[largest])) largest = right;
    if (largest != i) {
      arr[largest] = [arr[i], arr[i] = arr[largest]][0];
      maxHeapify(largest);
    }
  };
  for (let i = Math.floor(n / 2 - 1); i >= 0; i=i-1|0) maxHeapify(i);
}



Measured memory_bytes: 88316
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n,t,a[100],b[100];
	cin>>n>>t;
	for(int i=0;i<n;i++){
		cin>>a[i]>>b[i];
	}
	int ans=114514;
	for(int i=0;i<n;i++){
		if(b[i]<=t){
			if(ans>a[i])ans=a[i];
		}
	}
	if(ans==114514)cout<<"TLE"<<endl;
	else cout<<ans<<endl;

	return 0;
}


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner; // 文字列を標準入力からscanする

public class Main { 

  static long return_smaller(long a, long b){
    if(a > b){
      return b;
    }
      return a;
  }
    
  public static void main(final String[] args) {
    Scanner scan = new Scanner(System.in);
		String str = "";
    str = scan.nextLine();
    String[] strs2 = str.split(" ");
    int N = Integer.parseInt(strs2[0]);
    int K = Integer.parseInt(strs2[1]);
    
    long[] hi = new long[N+K+1];
    long[] dp = new long[N+K+1];
    long oo = 1L << 60;
    Arrays.fill(dp, oo);

    str = scan.nextLine();
    String[] strs3 = str.split(" ");
    for(int i=0; i<strs3.length; i++) {
      hi[i] = Integer.parseInt(strs3[i]);
    }
    scan.close();

    int i = 0;
    int j = 0;

    dp[0] = 0;
    for (i = 0; i < N; i++) {
      for(j = 1; j <= K; j++){
        if(i-j < 0){
          break;
        }
        dp[i] = return_smaller(dp[i], dp[i-j] + Math.abs(hi[i] - hi[i-j]));
      }
    }

    System.out.println(dp[N-1]);

  }
}

Measured memory_bytes: 63400
/*
  AOJ 2576
  Title:Doctor Course Is Recommended
  @kankichi573
*/
#include <stdio.h>

#define max(x,y) (((x)>(y))?(x):(y))
#define min(x,y) (((x)<(y))?(x):(y))
int D,x,y;
int d_point[100];
int dd_point[50];
int d_count,dd_count;
void dump()
{
  int i;
  for(i=0;i<x;i++)
    printf("%d:",d_point[i]);
  printf("\n");
  for(i=0;i<x;i++)
    printf("%d:",dd_point[i]);
  printf("\n");
}
int compare(const void *a, const void *b)
{
    return *(int*)b - *(int*)a;
}
int solve()
{
  int i,j,max_,sum1,sum2,sum;

  if(x>0)
    qsort(d_point,x ,sizeof(int),compare);
  if(y>0)
    qsort(dd_point,y,sizeof(int),compare);

  //dump();
  
  max_=0;
  
  for(i=0;i<=min(y,D/2);i++)
    {
      sum1=sum2=0;
      for(j=0;j<i;j++)
	sum1 += dd_point[j];

      for(j=0;j<min(D-2*i,x);j++)
	sum2 += d_point[j];
      sum=sum1+sum2;
#ifdef DEBUG
      printf("i=%d,s=%d %d %d\n",i,sum1,sum2,sum);
#endif
      if(sum>max_)
	max_=sum;
    }
  
  return(max_);
}

main()
{
  int i,point,ret;
  char ans[3];

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

  d_count=0;
  for(i=0;i<x;i++)
    {
      scanf("%s %d ",&ans[0],&point);
      if(ans[0]=='D')
	{
	  d_point[d_count]=point;
	  d_count++;
	}
    }
  scanf("%d",&y);
  dd_count=0;
  for(i=0;i<y;i++)
    {
      scanf("%s %d",&ans[0],&point);
      if(ans[0]=='D' && ans[1]=='D')
	{
	  dd_point[dd_count]=point;
	  dd_count++;
	}
    }
  ret=solve();
  printf("%d\n",ret);

  return(0);
}

Measured memory_bytes: 604
n,y  = map(int,input().split())

m = y//10000 + 1

for i in range(m):
  rest = y - i*10000
  o = max(0,rest//5000 + 1)
  
  for j in range(o):
    k = n-i-j
    if rest == 5000*j + 1000*k:
      print(i,j,k)
      exit()
print(-1,-1,-1)

Measured memory_bytes: 3060
bingo = [list(map(int, input().split())) for _  in range(3)]
N = int(input())
out = [int(input()) for _ in range(N)]

for i in out: # 出た目を順番にiに入力
    for j in range(3):
        if i in bingo[j]: #iがbingoにあるかどうか
            bingo[j][bingo[j].index(i)] = 0

if bingo[0][0] == bingo[1][1] == bingo[2][2] == 0 or bingo[0][2] == bingo[1][1] == bingo[2][0] == 0:
    print("Yes")

else :
    for i in range(3):
        if bingo[i][0] == bingo[i][1] == bingo[i][2] == 0:
            print("Yes")
            break
        elif bingo[0][i] == bingo[1][i] == bingo[2][i] == 0:
            print("Yes")
            break
    else:
        print("No")
        


Measured memory_bytes: 3064
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;

#define rep(i,n) for(int i = 0; i<n; ++i)
#define REP(i,n) for(int i = 1; i<=n; ++i)
#define all(x) begin(x),end(x)
#define show(obj) {for(auto x:obj)cout<<x<<' ';cout<<endl;}
#define line "----------"
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,ll> LP;
const int inf = 1001001000;
const ll INF = 1LL<<60;
const int MOD = (int)1e9 + 7;

int main(){
	int N, K;
	cin >> N >> K;
	cout << N - K + 1 << endl;
		return 0;
}


Measured memory_bytes: 3592
x=[]
y=[]
count=0
while True:
    i,j=map(int,raw_input().split())
    if (i,j)==(0,0):
        break
    count+=1
    x.append(i)
    y.append(j)

for i in range(count):
    print('#'*y[i])
    for j in range(x[i]-2):
        print('#'+'.'*(y[i]-2)+'#')
    if x[i]!=1:    
        print('#'*y[i])
    print('')

Measured memory_bytes: 6336
import math
tmp = list(map(int, input().split()))
tmp.sort()
a = tmp[0]
b = tmp[1]
c = tmp[2]

if a % 2 == 0 or b % 2 == 0 or c % 2 == 0:
    print(0)
else:

    print(abs(a * b * (c // 2) - (a * b * (math.ceil(c / 2)))))


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

const int mod = 1000000007;

int cnt = 0;
int vis[60];
int dfn[60], low[60], fa[60];
vector <int> s;
vector <vector <int> > bcc;
vector <int> from[60];

void dfs(int x, int last){
	dfn[x] = low[x] = ++cnt;
	for (int i = 0; i < from[x].size(); i++){
		int v = from[x][i];
		if (v == last) continue;
		if (!dfn[v]){
			s.push_back(v), dfs(v, x);
			if (low[v] >= dfn[x]){
				bcc.push_back({});
				while (1){
					int xx = s.back(); s.pop_back();
					bcc.back().push_back(xx);
					if (xx == v) break;
				}
				bcc.back().push_back(x);
			}
			low[x] = min(low[x], low[v]);
		}
		low[x] = min(low[x], dfn[v]);
	}
}

int n, m, k;

int gcd(int a, int b){return !b ? a : gcd(b, a % b);}

long long power(int a, int b){
	if (!b) return 1;
	long long tmp = power(a, b >> 1);
	return b & 1 ? tmp * tmp % mod * a % mod : tmp * tmp % mod;
}

long long inv(int x){return power(x, mod - 2);}

long long calc1(int x){
	long long ans = 0;
	for (int i = 0; i < x; i++){
		int g = gcd(i, x);
		ans = (ans + power(k, g)) % mod;
	}
	return ans * inv(x) % mod;
}

long long dp[110][110];
long long sum[110][110];

long long get_pre(){
	dp[0][1] = 1;
	for (int i = 0; i <= m; i++){
		for (int j = 1; j <= k; j++){
			sum[i][j] = (sum[i][j - 1] + dp[i][j]) % mod;
		}
		for (int j = 1; j <= k; j++){
			dp[i + 1][j] = sum[i][j];
		}
	}
}

long long calc2(int x){return sum[x][k];}

int main(){
	scanf("%d%d%d", &n, &m, &k);
	get_pre();
	for (int i = 0; i < m; i++){
		int u, v; scanf("%d%d", &u, &v);
		from[u].push_back(v);
		from[v].push_back(u);
	}
	for (int i = 1; i <= n; i++){
		if (!dfn[i]) dfs(i, i);
	}
	int tot = 0;
	long long ans = 1;
	for (auto v : bcc){
		tot++;
		for (int x : v){
			vis[x] = tot;
		}
		int cnt = 0;
		for (int i = 0; i < v.size(); i++){
			int x = v[i];
			for (int vv : from[x]){
				if (vis[vv] == tot) cnt++;
			}
		}
		cnt /= 2;
		if (cnt == v.size()) ans = ans * calc1(v.size()) % mod;
		else ans = ans * calc2(cnt) % mod;
	}
	printf("%lld\n", ans);
	return 0;
}


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

#define N 100005

const int mod = 1e9 + 7;

int n;
int fac[N] = {1, 1}, C[N], x[N], inv[N] = {0, 1};

void init() {
	for (int i = 2; i < N; i ++) {
		fac[i] = 1ll * fac[i-1] * i % mod;
		inv[i] = 1ll * (mod / i) * (mod - inv[mod % i]) % mod;
	}
    return;
}

int a[N], sum[N];

int main() {
    cin >> n;
    init();
    for (int i = 1; i <= n; i ++) cin >> x[i];
    C[0] = 1;
    for (int i = 1; i < n; i ++) {
        C[i] = 1ll * C[i-1] * (n - i) % mod;
        C[i] = 1ll * C[i] * inv[i] % mod;
    }
    int ans = 0;
    for (int i = 1; i < n; i ++) {
		ans = (ans + 1ll * C[i] * fac[i-1] % mod * (x[n] - x[n-i]) % mod * fac[n-1-i]) % mod;
    }
    for (int i = 1; i < n; i ++) {
        a[i] = 1ll * C[i+1] * fac[i-1] % mod * fac[n-2-i] % mod;
    }
    for (int i = 1; i <= n; i ++) {
        sum[i] = x[i] + sum[i-1];
        if (sum[i] >= mod) sum[i] -= mod;
    }
    for (int i = 1; i < n-1; i ++) {
        int r = sum[n-1] - sum[i] - sum[n-1-i];
        if (r < 0) r += mod;
        if (r < 0) r += mod;
        ans = (ans + 1ll * r * a[i]) % mod;
    }
    cout << ans << endl;
	return 0;
}


Measured memory_bytes: 2560
use std::vec::Vec;

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 (n, m) = {
        let v: Vec<usize> = read_vec();
        (v[0], v[1])
    };

    let mut g = vec![Vec::new(); n];
    for _ in 0..m {
        let v: Vec<usize> = read_vec();
        g[v[0]-1].push(v[1]-1);
        g[v[1]-1].push(v[0]-1);
    }

    g.iter().map(|c| println!("{}", c.len())).collect::<Vec<_>>();
}


Measured memory_bytes: 4352
#include <iostream>

using namespace std;

int main()
{
	int A, B, C, D;
	cin >> A >> B >> C >> D;
	while (A > 0 && C > 0)
	{
		C -= B;
		if (C <= 0)
			break;
		A -= D;
	}
	if (A <= 0)
		cout << "No" << endl;
	else
		cout << "Yes" << endl;
}

Measured memory_bytes: 3596
#include<bits/stdc++.h>
using namespace std;
int a,b,c,d,e,tes,t,tp,tpp;
string s,h,hh,ans;
char ch;
bool bo;
int main(){
    ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
    cin>>s;
    cin>>tes;
    for(t=1; t<=tes; t++){
        cin>>tp;
        if(tp==1){
            bo=!bo;
        }else{
            cin>>tpp>>ch;
            if(tpp==1){
                if(bo==0) h.push_back(ch); else hh.push_back(ch);
            }else{
                if(bo==1) h.push_back(ch); else hh.push_back(ch);
            }
        }
    }
    if(h.size()>=1){
        for(c=h.size()-1; c>=0; c--) ans.push_back(h[c]);
    }
    ans+=s;
    ans+=hh;
    if(bo==0){
        cout<<ans;
    }else{
        for(c=ans.size()-1; c>=0; c--) cout<<ans[c];
    }
    return 0;
}

Measured memory_bytes: 1428
use whiteread::parse_line;

fn main() {
    let _n: i32 = parse_line().unwrap();
    let x: Vec<i32> = parse_line().unwrap();
    let mut energy: i32 = 100 * 100 * 100;
    for p in 1..=100 {
        let mut e = 0;
        for xi in &x {
            e += (xi - p) * (xi - p);
        }
        if e < energy {
            energy = e;
        }
    }
    println!("{}", energy);
}


Measured memory_bytes: 2148
#define _USE_NATH_DEFINES
#include<cstdio>
#include <iostream>
#include<sstream>
#include<fstream>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<complex>
#include <string>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<numeric>
#include<limits>
#include<climits>
#include<cfloat>
#include<functional>
#include<iterator>
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
using namespace std;

int main() {
    string o, e;
	cin >> o >> e;
	int lo = o.length();
	int le = e.length();
	string ans;
	
	rep(i, le) {
		cout << o[i] << e[i];
	}
	if (lo > le) {
		cout << o[lo - 1];
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 256
N, A, B = map(int, input().split())

if A == 0:
    print("0")
    exit(0)

AB = A+B

#print (N//AB)

if N <= AB*(10**100):
    print (min(A,(N-(N//AB)*AB)) + ((N//AB)*A))
else:
    print (A*(10**100))


Measured memory_bytes: 2940
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
using namespace std;

int main(){
	int n;
	scanf(" %d", &n);
	for(int i=0; i<n; ++i){
		string s;
		cin >> s;
		int now=0; //文字列の位置
		int p=26; //現在の車両位置
		
		char train[60];
		memset(train, '0', sizeof(train));
		
		while(now<s.size()){
			if('a'<=s[now] && s[now]<='z'){ //文字だったら
				train[p]=s[now++];	
			}
			else{ //矢印だったら
				if(s[now] == '-') p++;
				else if(s[now] == '<') p--;
				now+=2;
			}
		}
		
		int t=0;
		while(train[t]=='0') t++;
		while(train[t]!='0') printf("%c", train[t++]);
		printf("\n");			
	}
}

Measured memory_bytes: 1196
#include <iostream>
#include <algorithm>
#include <math.h> 
#include <string>
#include <iomanip>
#include <vector>
#include <chrono>
#include <cstdlib>
#include <bitset>
using namespace std;
int main(){
    int x[4];
    for(int i = 0; i < 5; i++) cin >> x[i];
    for(int i = 0; i < 5; i++){
        if(x[i] == 0){
            cout << i+1 << endl;
            break;
        }
    }
}

Measured memory_bytes: 3188
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
ans=0
con=10000000
for i in a:
    ans+=b[i-1]
    if con+1==i :
        ans+=c[con-1]
    con=i
print(ans)

Measured memory_bytes: 9140
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

vector<int> get_prime(int n){
    if(n <= 1) return vector<int>();
    vector<bool> is_prime(n+1, true);
    vector<int> prime;
    is_prime[0] = is_prime[1] = 0;
    for (int i = 2; i <= n; ++i) {
        if(is_prime[i]) prime.emplace_back(i);
        for (auto &&j : prime){
            if(i*j > n) break;
            is_prime[i*j] = false;
            if(i % j == 0) break;
        }
    }
    return prime;
}

auto v = get_prime(1000000);
int main() {
    int n;
    while(cin >> n, n){
        int ans = 0;
        for (int i = 0; i < n; ++i) {
            int p, m;
            cin >> p >> m;
            ans += upper_bound(v.begin(),v.end(), p+m) - lower_bound(v.begin(),v.end(), p-m)-1;
        }
        cout << ans << "\n";
    }
    return 0;
}


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

using namespace std;
using ll = long long;


int main()
{
	int n, m; cin >> n >> m;
	vector<pair<int,int>> que(m), ans(m);
	map<pair<int,int>, int> sor;
	for(int i = 0; i < m; i++) {
		cin >> que[i].first >> que[i].second;
		ans[i] = que[i];
	}
	sort(que.begin(), que.end());
	for(int i = 1; i < m; i++) {
		if(que[i].first != que[i - 1].first) {
			sor[que[i]] = 0;
		}else {
			sor[que[i]] = sor[que[i - 1]] + 1;
		}
	}

	for(int i = 0; i < m; i++) {
		std::cout << std::setfill('0') << std::right << std::setw(6) << ans[i].first; // "0012"
		std::cout << std::setfill('0') << std::right << std::setw(6) << sor[ans[i]]+1 << endl;; // "0012"

	}

}

Measured memory_bytes: 9344
#pragma region template
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using vld = vector<ld>;
using vvld = vector<vld>;
using vvvld = vector<vvld>;
using vs = vector<string>;
using pll = pair<ll, ll>;
using vp = vector<pll>;
template <typename T>
using pqrev = priority_queue<T, vector<T>, greater<T>>;
#define rep(i, n) for (ll i = 0, i##_end = (n); i < i##_end; i++)
#define repb(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repr(i, a, b) for (ll i = (a), i##_end = (b); i < i##_end; i++)
#define reprb(i, a, b) for (ll i = (b)-1, i##_end = (a); i >= i##_end; i--)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((ll)(x).size())
//*
constexpr ll MOD = 1e9 + 7;
/*/
constexpr ll MOD = 998244353;
//*/
constexpr ll INF = 1e+18;
constexpr ld EPS = 1e-12L;
constexpr ld PI = 3.14159265358979323846L;
constexpr ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
constexpr ll LCM(ll a, ll b) { return a / GCD(a, b) * b; }
template <typename S, typename T>
constexpr bool chmax(S &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename S, typename T>
constexpr bool chmin(S &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
#ifdef OJ_LOCAL
#include "dump.hpp"
#else
#define dump(...) ((void)0)
#endif
template <typename T>
bool print_(const T &a) {
  cout << a;
  return true;
}
template <typename T>
bool print_(const vector<T> &vec) {
  for (auto &a : vec) {
    cout << a;
    if (&a != &vec.back()) {
      cout << " ";
    }
  }
  return false;
}
template <typename T>
bool print_(const vector<vector<T>> &vv) {
  for (auto &v : vv) {
    for (auto &a : v) {
      cout << a;
      if (&a != &v.back()) {
        cout << " ";
      }
    }
    if (&v != &vv.back()) {
      cout << "\n";
    }
  }
  return false;
}
void print() { cout << "\n"; }
template <typename Head, typename... Tail>
void print(Head &&head, Tail &&... tail) {
  bool f = print_(head);
  if (sizeof...(tail) != 0) {
    cout << (f ? " " : "\n");
  }
  print(forward<Tail>(tail)...);
}
#pragma endregion

void Pr(bool f){
  cout << (f ? "Yes" : "No") << "\n";
  exit(0);
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  ll l, r, d;
  cin >> l >> r >> d;
  ll ans = 0;
  repr(i, l, r+1){
    ans += i%d == 0;
  }
  print(ans);
}


Measured memory_bytes: 3620
<?php
fscanf(STDIN, "%d %d", $m, $n);
$str = "";
for ($i = 0; $i < $n - 1; $i++) {
    $str .= "%d ";
}
$str .= "%d";
$homeworks = fscanf(STDIN, $str);
$sumdays = array_sum($homeworks);
if ($m - $sumdays >= 0) {
    echo $m - $sumdays . "\n";
} else {
    echo -1 . "\n";
}


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

const int N = 100005;
int main() {
	int n, a[N];
	cin >> n;
	for (int i = 0; i < N; i++)
		a[i] = 0;

	for (int i = 0; i < n; i++) {
		int t; cin >> t;
		a[t]++;
	}
	
	int ans = 0;
	for (int i = 0; i < N - 2; i++)
		ans = max(ans,a[i] + a[i + 1] + a[i + 2]);
	
	cout << ans << endl;

	return 0;
}

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

int main() {
	int A, B, C, K;
	cin >> A >> B >> C >> K;
	for(int i = 0; i < K; i++){
		if(A >= B && A >= C){
			A *= 2;
		}
		else if(B >= A && B >= C){
			B *= 2;
		}
		else{
			C *= 2;
		}
	}
	cout << A + B + C << endl;
	return 0;
}

Measured memory_bytes: 256
using System;
using System.Text.RegularExpressions;
using System.Linq;
using System.Collections.Generic;
using System.IO;
using System.Numerics;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            var str = Console.ReadLine().Split();
            var n = Int32.Parse(str[0]);
            var l = Int32.Parse(str[1]);
            str = Console.ReadLine().Split();
            var a = str.Select(s => Int32.Parse(s)).ToList();

            var tgt = -1;
            for (int i = 0; i < n - 1; i++)
            {
                if (a[i] + a[i + 1] >= l)
                {
                    tgt = i;
                    break;
                }
            }

            if (tgt == -1)
            {
                Console.WriteLine("Impossible");
                return;
            }

            Console.WriteLine("Possible");
            for (int i = 0; i < tgt; i++)
            {
                Console.WriteLine(i + 1);
            }
            for (int i = n - 1; i > tgt; i--)
            {
                Console.WriteLine(i);
            }
        }
    }
}

Measured memory_bytes: 18136
#include <iostream>
#include <cstring>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <set>
#include <utility>
#include <cstdlib>
#include <queue>
#include <stack>
#include <iomanip>
#include <cstdio>
#include <map>
#include <list>

using namespace std;

typedef long long Int;
typedef pair<Int,Int> P;

#define rep(i,x) for(Int i = 0; i < (Int)(x); i++)
#define rrep(i,x) for(Int i = ((Int)(x) - 1); i >= 0; i--)
#define _upgrade ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define all(x) (x).begin(), (x).end()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define pb push_back
#define MX 100010


template<class T1, class T2> void chmin(T1 &a, T2 b){if(a>b)a=b;}
template<class T1, class T2> void chmax(T1 &a, T2 b){if(a<b)a=b;}

//ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
//ll lcm(ll x, ll y) {return x / gcd(x, y) * y;}

Int dx[4] = {1,0,-1,0};
Int dy[4] = {0,1,0,-1};
const Int INF = 1001002003004005006ll;
const Int mod = 1e9 + 7;
const double PI = 3.14159265358979323846;


// ****************************************CODE***************************************//










int n;
int a[100010];

int main(){
        cin >> n;
        rep(i,n) cin >> a[i];
        n = unique(a, a+n) - a;
        int cnt = 0;
        for(int i = 1; i+1<n; i++)
        {
                if(a[i] > a[i-1] && a[i] > a[i+1]){
                        cnt++, i++;
                }
                else if(a[i] < a[i-1] && a[i] < a[i+1]){
                        cnt++, i++;
                }
        }

        cout << cnt + 1 << endl;
        return 0;
}































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

int main() {
    int n, r;
    while(~scanf("%d%d", &n, &r)) {
        if(n >= 10) {
            printf("%d\n", r);
            continue;
        }
        printf("%d\n", r + 100 * (10 - n));
    }
    return 0;
}

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

#define Max(a,b) max({a,b})
#define Min(a,b) min({a,b})
#define rep(i,n) for(long long int (i)=0;(i)<(int)(n);(i)++)
#define len(n)
using namespace std;

int n,m,a,b,c,cou,co,ans;
double d,k;
string s,t;

int lis[3];

int main(){

    cin >> lis[0] >> lis[1] >> lis[2];
    cin >> n;

    sort(lis,lis+3);

    for(int i = 0;i < n;i++){
        lis[2] *= 2;
    }

    cout << lis[0]+lis[1]+lis[2] << endl;
    
    return 0;
}

Measured memory_bytes: 256
/*input
4
1 1 1 1
*/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
typedef vector<ll> vll;
typedef std::vector<pll > vpll;
#define pb push_back 
#define f first
#define s second
#define mp make_pair
#define int ll
#define fr(j,n) for(int i=j;i<=n;i++)
#define reset(a) memset(a,0,sizeof(a))
#define minqueue priority_queue<int,vector<int>,greater<int> >
int const mod = 1e9+7;
int const inf = 2e18;


int power(int x, int y, int mod = inf)
{
    int ans = 1;
    x %= mod;
    while(y)
    {
        if(y&1)
            ans = (x * ans) % mod;

        x = (x * x) % mod;
        y >>= 1;
    }
    return ans;
}
int gcd(int a , int b)
{
	if(a==0)
	return b;
	return gcd(b%a,a);
}

bool comp (pll p1,pll p2)
{
	return p1.s>p2.s;
}
signed main() {
	ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
	int n;
	cin>>n;
	int a[n];
	for(int i=0;i<n;i++)
	cin>>a[i];


	std::map<int, int> mp1;    
	std::map<int, int> mp2;    
	for(int i=0;i<n;i++) 
	{
		if(i%2==0)
			mp1[a[i]]++;
		else
			mp2[a[i]]++;
	}
	vpll v1;
	vpll v2;
	for(auto x:mp1 )
		v1.pb(mp(x.f,x.s));
	for(auto x:mp2 )
		v2.pb(mp(x.f,x.s));

	sort(v1.begin(), v1.end(),comp);
	sort(v2.begin(), v2.end(),comp);


	if(v1[0].f!=v2[0].f)
	{
		cout<<n-v1[0].s-v2[0].s;
		return 0;
	}
	v1.pb(mp(0,0));
	v2.pb(mp(0,0));
	cout<<min(n-v1[0].s-v2[1].s,n-v1[1].s-v2[0].s);	  
return 0;
}


Measured memory_bytes: 9592
import java.util.*;

class Main {

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

    int ac = 0, wa = 0, tle = 0, re = 0;

    int n = sc.nextInt();
    for (int i = 0; i < n; i++) {
      String s = sc.next();
      if (s.equals("AC")) {
        ac++;
      } else if (s.equals("WA")) {
        wa++;
      } else if (s.equals("TLE")) {
        tle++;
      } else if (s.equals("RE")) {
        re++;
      }
    }
    sc.close();

    System.out.println("AC x " + ac);
    System.out.println("WA x " + wa);
    System.out.println("TLE x " + tle);
    System.out.println("RE x " + re);


  }
}


Measured memory_bytes: 58036
def f(x,y,z)
  return x**2 + y**2 + z**2 + x*y + y*z + z*x
end
N = gets.to_i
c = [0] * (N+1)
1.upto(100) do |x|
  1.upto(100) do |y|
    1.upto(100) do |z|
      i = f(x, y, z)
      if i <= N
        c[i] += 1
      end
    end
  end
end
1.upto(N) do |i|
  puts c[i]
end

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

int main()
{
  vector<string> c2s(128, "");
  c2s['A'] = "00000";
  c2s['B'] = "00001";
  c2s['C'] = "00010";
  c2s['D'] = "00011";
  c2s['E'] = "00100";
  c2s['F'] = "00101";
  c2s['G'] = "00110";
  c2s['H'] = "00111";
  c2s['I'] = "01000";
  c2s['J'] = "01001";
  c2s['K'] = "01010";
  c2s['L'] = "01011";
  c2s['M'] = "01100";
  c2s['N'] = "01101";
  c2s['O'] = "01110";
  c2s['P'] = "01111";
  c2s['Q'] = "10000";
  c2s['R'] = "10001";
  c2s['S'] = "10010";
  c2s['T'] = "10011";
  c2s['U'] = "10100";
  c2s['V'] = "10101";
  c2s['W'] = "10110";
  c2s['X'] = "10111";
  c2s['Y'] = "11000";
  c2s['Z'] = "11001";
  c2s[' '] = "11010";
  c2s['.'] = "11011";
  c2s[','] = "11100";
  c2s['-'] = "11101";
  c2s['\''] = "11110";
  c2s['?'] = "11111";

  map<string, char> s2c;
  s2c["101"] = ' ';
  s2c["000000"] = '\'';
  s2c["000011"] = ',';
  s2c["10010001"] = '-';
  s2c["010001"] = '.';
  s2c["000001"] = '?';
  s2c["100101"] = 'A';
  s2c["10011010"] = 'B';
  s2c["0101"] = 'C';
  s2c["0001"] = 'D';
  s2c["110"] = 'E';
  s2c["01001"] = 'F';
  s2c["10011011"] = 'G';
  s2c["010000"] = 'H';
  s2c["0111"] = 'I';
  s2c["10011000"] = 'J';
  s2c["0110"] = 'K';
  s2c["00100"] = 'L';
  s2c["10011001"] = 'M';
  s2c["10011110"] = 'N';
  s2c["00101"] = 'O';
  s2c["111"] = 'P';
  s2c["10011111"] = 'Q';
  s2c["1000"] = 'R';
  s2c["00110"] = 'S';
  s2c["00111"] = 'T';
  s2c["10011100"] = 'U';
  s2c["10011101"] = 'V';
  s2c["000010"] = 'W';
  s2c["10010010"] = 'X';
  s2c["10010011"] = 'Y';
  s2c["10010000"] = 'Z';

  string s;
  while (getline(cin, s)) {
    string enc = "";
    for (unsigned int i = 0; i < s.size(); ++i)
      enc += c2s[s[i]];

    string ans = "";
    string::size_type b = 0;
    for (unsigned int i = 0; i < enc.size(); ++i) {
      string sub = enc.substr(b, i-b+1);
      map<string, char>::iterator it = s2c.find(sub);
      if (it != s2c.end()) {
	b = i+1;
	ans += it->second;
      }
    }

    map<string, char>::iterator it = s2c.find(enc.substr(b));
    if (it != s2c.end())
      ans += it->second;
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <stdio.h>

int main() {
    std::string S;
    std::cin >> S;
    int count = 0;
    int maxi = 0;
    for(int i=0;i<S.size();i++){
        if(S[i] == 'A' || S[i] == 'T' || S[i] == 'C' ||S[i] == 'G' ){
            count++;
            if(maxi < count){
                maxi = count;
            }
        }else {
            count = 0;
        }
    }
    std::cout << maxi;
    return 0;
}

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

int main(){
  vector<int> a;
  int w,n,s1,s2;
  char c;
  cin >> w >> n;
  for(int i=1;i<=w;i++)a.push_back(i);
  for(int i=0;i<n;i++){
	cin >> s1 >> c >> s2;
	swap(a[s1-1],a[s2-1]);
  }
  for(auto i:a)cout << i << endl;
  return 0;
}

Measured memory_bytes: 1212
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

//#define int long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
const double PI = acos(-1);
const double EPS = 1e-9;
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; }
int partition(vector<int>&a, int l, int r) {
	int x = a[r];
	int i(l - 1);
	rep(j, 0, r) {
		if (a[j] <= x)swap(a[++i], a[j]);
	}
	swap(a[++i], a[r]);
	return i;
}
signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N; cin >> N;
	vector<int> a(N); rep(i, 0, N) { cin >> a[i]; }
	int q = partition(a, 0, N - 1);
	rep(i, 0, N) {
		if (i == q)cout << "[" << a[i] << "]";
		else cout << a[i];
		cout << (i == N - 1 ? '\n' : ' ');
	}
	return 0;
}

Measured memory_bytes: 3352
import java.util.*;
public class Main {
	public static void main(String[] args){
	  Scanner sc = new Scanner(System.in);
      int n = sc.nextInt();
      String s = "";
      if( 400 <= n && n < 600 ){
        s = "8";
      }else if( 400 <= n && n < 800 ){
        s = "7";
      }else if( 400 <= n && n < 1000 ){
        s = "6";
      }else if( 400 <= n && n < 1200 ){
        s = "5";
      }else if( 400 <= n && n < 1400 ){
       s = "4";
      }else if( 400 <= n && n < 1600 ){
        s="3";
      }else if( 400 <= n && n < 1800 ){
        s="2";
      }else if( 400 <= n && n < 2000 ){
        s="1";
      }
      System.out.println(s);
	}
}

Measured memory_bytes: 27064
#include<vector>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
#include<stack>
#include<bitset>
#include<functional>
#include<ctime>
#include<queue>
#include<deque>
#include<complex>
#include<cassert>
using namespace std;
#define pb push_back
#define pf push_front
typedef long long lint;
typedef complex<double> P;
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
//問題文および制約はちゃんと確認しよう！
//サイズは10^5じゃなくて2×10^5とかかもしれないし、重要な制約・条件を見落としているかも
//とりあえずサンプルを読んでから解法を考えよう？
vector<int> v;
int num[10];
int main()
{
	int zyo=1,out=0,n;
	cin>>n;
	REP(i,1,10){
		zyo*=3;
		rep(j,zyo){
			memset(num,0,sizeof(num));
			int now=0,a=j;
			rep(j,i){
				int b=a%3;a/=3;
				num[b]++;now*=10;now+=b*2+3;
			}
			if(num[0]*num[1]*num[2]>0 && now<=n) out++;
		}
	}
	cout<<out<<endl;
}


Measured memory_bytes: 256
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <math.h> // sqrt
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
using namespace std;
using ll = long long;
using vi = vector<int>;
using vb = vector<bool>;
using vll = vector<long long>;
using vvi = vector<vector<int>>;
using vvll = vector<vector<long long>>;
using pii = pair<int, int>;
using psi = pair<string, int>;

int main() {
    ll N;
    cin >> N;
    vll data(N);
    for (int i = 0; i < N; i++) {
        cin >> data.at(i);
    }
    vll rsum(N + 1, 0);
    ll sum = 0;
    for (int i = 0; i < N; i++) {
        sum += data.at(i);
        rsum.at(i + 1) = sum;
    }
    sort(rsum.begin(), rsum.end());
    ll ans = 0;
    for (ll i = 0; i < N + 1; i++) {
        ll count = 1;
        while (true) {
            if (N + 1 <= i + count) {
                break;
            }
            if (rsum.at(i) == rsum.at(i + count)) {
                count++;
            }
            else {
                break;
            }
        }
        if (count == 1) {
            continue;
        }
        ans += count * (count - 1) / 2;
        i+= count - 1;
    }
    cout << ans << endl;
}

Measured memory_bytes: 6420
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MOD=1000000007;
const ll MOD2=998244353;
const double PI=acos(-1);
const ll INF=1e18;
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
struct edge{ll to,cost;};

int main() {
  ll a;
  string b;
  cin >> a >> b;
  ll k=b.size();
  ll c=0;
  ll A=100;
  rep(i,k){
    if(b[i]!='.'){
    c+=(b[i]-'0')*A;
    A/=10;
    }
  }
  cout << c*a/100 << endl;
}


Measured memory_bytes: 3620
import math

def is_prime(n):
    if n==1:
        return False
    for i in range(n-2):
        if n % (i+2) == 0:
            return False
    return True

prime_list = []
for i in range(100):
    if is_prime(i+1):
        prime_list.append(i+1)


factor_list = [0] * len(prime_list)

N = int(input())

for i in range(N):
    for p in prime_list:
        j = i+1
        while j % p == 0:
            factor_list[prime_list.index(p)] += 1
            j = j / p

ans = 0
for i in range(len(factor_list)):
    if factor_list[i] >= 74:
        ans += 1

cnta = 0
cntb = 0
for i in range(len(factor_list)):
    if factor_list[i] >= 14:
        cnta += 1
    if factor_list[i] >= 4:
        cntb += 1
ans += cnta * (cntb-1)

cnta = 0
cntb = 0
for i in range(len(factor_list)):
    if factor_list[i] >= 24:
        cnta += 1
    if factor_list[i] >= 2:
        cntb += 1
ans += cnta * (cntb-1)

cnta = 0
cntb = 0
for i in range(len(factor_list)):
    if factor_list[i] >= 4:
        cnta += 1
    if factor_list[i] >= 2:
        cntb += 1
ans += cnta * (cnta-1) * (cntb-2) /2

print(int(ans))


Measured memory_bytes: 3064
#include <iostream>

using namespace std;

int main() {
  int n;
  cin >> n;
  int a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < n; i++) {
    int v = a[i];
    int j = i - 1;
    while (j >= 0 && a[j] > v) {
      a[j+1] = a[j];
      j--;
    }
    a[j+1] = v;
    for (int i = 0; i < n; i++) {
      cout << a[i];
      if (i != n-1) {
        cout << " ";
      }
    }
    cout << endl;
  }
  return 0;
}



Measured memory_bytes: 3092
def divisor(num)
    num_sqrt = Math.sqrt(num).floor
    (1..num_sqrt).select{ |i| num % i == 0 }
end

n = gets.to_i

divisions = divisor(n)

divisions_list = []

divisions.each do |d|
    b = n/d
    arr = [d, b]
    divisions_list.push(arr)  
end

divisions_list.each do |d|
    d_len = d[0].to_s.length 
    b_len = d[1].to_s.length
    if d_len == 1 && b_len == 1
        puts("Yes")
        exit
    end
end

puts("No")

Measured memory_bytes: 14388
n=gets.to_i
array=[]
n.times{
   array.push(gets.split.map(&:to_i)) 
}

array=array.sort_by{|i| i[0]+i[1]}.reverse
turn=1
taka=0
aoki=0
n.times{|j|
    if turn==1
        taka+=array[j][0]
    elsif turn==-1
        aoki+=array[j][1]
    end
    turn*=-1
}

puts taka-aoki

Measured memory_bytes: 12664