akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <stdio.h>       // printf,scanf
#include <stdlib.h>
#include <math.h>
#include <string>
#include <vector>
#include <algorithm>  //sort,binarySearch
#include <functional> 
#include <iomanip>    // setprecision
#include <utility>    // c+11 Array
#include <set>
#include <sstream>
#include <map>
#include <bits/stdc++.h>
#define MOD (1e+9)+7
#define PI 3.141592653589793238462643383279
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define pb(x) push_back(x)
#define debug(x) cerr << #x << " = " << x << endl;
#define debret(x) debug(x) ; return 0;

using namespace std;

int main(){

    long long int a;
    long long int b;
    long long int c;
    long long int ans = 0;
    cin >> a >> b >> c;

    if(a != 0 && b < c){
        cout << 0 << endl;
        return 0;
    }
    ans = b / c;
    if(a != 0){
        ans -= (a-1) / c;
    }else{
        ans++;
    }
    cout << ans << endl;
    return 0;
}


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

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

using namespace std;

using ll = long long;

int main() {
    constexpr int C_MAX = 100000;
    int N, M, R;
    cin >> N >> M >> R;
    vector<int> r(R);
    REP(i, R) {
        cin >> r[i];
        --r[i];
    }
    // const ll INF = C_MAX * N;
    const ll INF = 2 * (ll)C_MAX * M;
    vector<vector<ll>> d(N, vector<ll>(N, INF));
    REP(i, N) d[i][i] = 0;
    REP(i, M) {
        int A, B, C;
        cin >> A >> B >> C;
        --A; --B;
        d[A][B] = C;
        d[B][A] = C;
    }

    REP(k, N) REP(i, N) REP(j, N) {
        if (d[i][k] != INF && d[k][j] != INF) {
            d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
        }
    }

    ll result = INF;
    vector<int> a(R);
    REP(i, R) a[i] = i;
    do {
        ll L = 0;
        REP(i, R - 1) {
            ll dist = d[r[a[i]]][r[a[i + 1]]];
            if (dist == INF) {
                L = INF;
                break;
            } else {
                L += dist;
            }
        }
        result = min(result, L);
    } while (next_permutation(all(a)));
    cout << result << endl;
    return 0;
}

Measured memory_bytes: 512
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AOJ
{
    class triangle
    {
        static void Main(string[] args)
        {
            int num = int.Parse(System.Console.ReadLine());
            List<int> param = new List<int> {0,0,0 };
            for (int i=0;i<num;i++)
            {
                string[] tmp = System.Console.ReadLine().Split(' ');
                param[0] = int.Parse(tmp[0]);
                param[1] = int.Parse(tmp[1]);
                param[2] = int.Parse(tmp[2]);
                param.Sort();
                System.Console.WriteLine(Math.Pow(param[2],2)==Math.Pow(param[1],2)+Math.Pow(param[0],2)?"YES":"NO");
            }
        }
    }
}

Measured memory_bytes: 5644
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <functional>
#include <queue>
#include <string>
#include <cstring>
#include <numeric>
#include <cstdlib>
#include <cmath>
#include <map>
#include <unordered_map>
#include <set>
using namespace std;

typedef long long ll;

#define INF 10e17
#define rep(i,n) for(long long i=0; i<n; i++)
#define repr(i,n,m) for(long long i=m; i<n; i++)
#define END cout << endl
#define MOD 1000000007
#define pb push_back
#define sorti(x) sort(x.begin(), x.end())
#define sortd(x) sort(x.begin(), x.end(), std::greater<long long>())
#define debug(x) std::cerr << (x) << std::endl;
#define roll(x) for (auto&& itr : x) { debug(itr); }

template <class T> inline void chmax(T &ans, T t) { if (t > ans) ans = t;}
template <class T> inline void chmin(T &ans, T t) { if (t < ans) ans = t;}

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

  for (auto itr : a) {
    if (itr != mmax) {
      chmax(next, itr);
    }
  }

  rep(i, n) {
    if (cnt > 1) {
      cout << mmax  << endl;
    } else if (cnt == 1) {
      if (a[i] == mmax) {
        cout << next << endl;
      } else {
        cout << mmax << endl;
      }
    }
  }
  
}


Measured memory_bytes: 2432
function Main(input) {
    var S = input.trim();
    if (S[0] == S[1] || S[1] == S[2] || S[2] == S[3]) {
        console.log("Bad");
    }
    else {
        console.log("Good");
    }
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

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

using namespace std;
int main(){

  string S;
  cin >> S;

  int els[10];

  int a = 0;

  for(int i = 0;i < S.size();i++){

    if(S[i] != 'A' and S[i] != 'T' and S[i] != 'G' and S[i] != 'C'){

      els[a] = i;
      a++;

    }

  }

  int max = els[0];

  for(int i = 0;i < a - 1;i++){

    if(max < els[i+1] - els[i] - 1) max = els[i+1] - els[i] - 1;

  }

  if(max < S.size() - els[a-1] - 1) max = S.size() - els[a-1] - 1;

  if(a == 0) cout << S.size() << '\n';
  else cout << max << '\n';


}

Measured memory_bytes: 256
N, M = map(int, input().split())
K = [0] * N
A = [list(map(int, input().split())) for i in range(N)]
count = 0
for i in range(1, M+1, 1): 
    likecount = 0
    for j in range(N): 
        for k in range(1, A[j][0]+1, 1): 
            if A[j][k] == i:
                likecount += 1
    if likecount == N: 
        count += 1
print(count)


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

#define INF 1e16
#define MAX_N 200000
const long long MOD = 1e9 + 7;

long long extgcd(long long a, long long b, long long& x, long long& y) {
    long long d = a;
    if (b != 0) {
        d = extgcd(b, a % b, y, x);
        y -= (a / b) * x;
    } else {
        x = 1;
        y = 0;
    }
    return d;
}
long long mod_inverse(long long a, long long m) {
    long long x, y;
    if (extgcd(a, m, x, y) == 1)
        return (m + x % m) % m;
    else
        return -1;
}
vector<long long> fact(MAX_N + 1, INF);
long long mod_fact(long long n, long long& e) {
    if (fact[0] == INF) {
        fact[0] = 1;
        if (MAX_N != 0) fact[1] = 1;
        for (int i = 2; i <= MAX_N; ++i) {
            fact[i] = (fact[i - 1] * i) % MOD;
        }
    }
    e = 0;
    if (n == 0) return 1;
    long long res = mod_fact(n / MOD, e);
    e += n / MOD;
    if ((n / MOD) % 2 != 0) return (res * (MOD - fact[n % MOD])) % MOD;
    return (res * fact[n % MOD]) % MOD;
}

long long mod_comb(long long n, long long k) {
    if (n < 0 || k < 0 || n < k) return 0;
    long long e1, e2, e3;
    long long a1 = mod_fact(n, e1), a2 = mod_fact(k, e2),
              a3 = mod_fact(n - k, e3);
    if (e1 > e2 + e3) return 0;
    return (a1 * mod_inverse((a2 * a3) % MOD, MOD)) % MOD;
}

int main() {
    ll N, M, K;
    cin >> N >> M >> K;
    ll sum = 0;
    ll num = mod_comb(N * M - 2, K - 2);
    for (int i = 1; i <= N; i++) {
        for (int j = 1; j <= M; j++) {
            ll tmpx = (1 + N - i) * (N - i) / 2 % MOD;
            tmpx = (tmpx * M * num) % MOD;
            sum = (sum + tmpx) % MOD;

            ll tmpy = (1 + M - j) * (M - j) / 2 % MOD;
            tmpy = (tmpy * N * num) % MOD;
            sum = (sum + tmpy) % MOD;
        }
    }
    cout << sum << endl;
}

Measured memory_bytes: 1792
#include <iostream>
#include <queue>
#include <vector>
#include <string>
#define rep(i, n)   for(int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;

int h,w;
vector<vector<char> >G;
vector<vector<int> >cost;
int bfs(){
    int dx[] = {0, 1, 0, -1};
    int dy[] = {1, 0, -1, 0};
    queue<pair<int, int>>que;
    que.push(make_pair(0, 0));
    cost[0][0] = 0;
    while(!que.empty()){
        pair<int, int> p = que.front();
        que.pop();
        if(p == make_pair(h-1, w-1))    return cost[p.first][p.second];
        rep(i, 4){
            int ny = p.first + dy[i], nx = p.second + dx[i];
            if(nx < 0 || ny < 0 || nx >= w || ny >= h)  continue;
            if(G[ny][nx] == '#')    continue;
            if(cost[ny][nx] != -1)  continue;
            cost[ny][nx] = cost[p.first][p.second] + 1;
            que.push(make_pair(ny, nx));
        }
    }
    return -1;
}

int main(){
    cin >> h >> w;
    G.resize(h, vector<char>(w));
    cost.resize(h, vector<int>(w, -1));
    int block = 0;
    rep(i, h)   rep(j, w){
        char c; cin >> c;
        if(c == '#')    block++;
        G[i][j] = c;
    }
    int min = bfs();
    if(min == -1){
        cout << -1 << endl;
    }else{
        cout << h*w - block - (min+1) << endl;
    }
}


Measured memory_bytes: 256
/**
 *      author  : 𝒌𝒚𝒐𝒎𝒖𝒌𝒚𝒐𝒎𝒖𝒑𝒖𝒓𝒊𝒏
 *      created : 2019-11-21:17:05:53
**/

#include <iostream>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <complex>
#include <numeric>
#include <bitset>
#include <cassert>
#include <cctype>
#include <functional>
#include <iomanip>
#include <random>
#include <utility>

using namespace std;

using int64 = long long;
#define debug(_) cerr << #_ << ": " << (_) << '\n'
template<typename T> inline void chmin(T &a, T b) { if (a > b) a = b; return; }
template<typename T> inline void chmax(T &a, T b) { if (a < b) a = b; return; }
template<typename T> ostream& operator<<(ostream& os, const vector<T>& vec) { os << '{'; for (size_t i = 0; i < vec.size(); ++i) { os << vec[i]; if (i != vec.size() - 1) os << ','; } os << '}'; return os; }
template<typename T, typename U> ostream& operator<<(ostream& os, const pair<T, U>& p) { return os << '{' << p.first << " " << p.second << '}'; }

class Combination {
 public:
  constexpr Combination() { Build(); }
  static constexpr int mod_ = 1000000007;
  static constexpr int n_ = 800000;
  class LookupTable {
   public:
    int64 factorial_[n_];
    int64 inverse_[n_];
    int64 finverse_[n_];
  };
  LookupTable lt{};
  // return nCk
  constexpr int64 Get(int n, int k) const noexcept {
    if (n < k || n < 0 || k < 0) return 0;
    return lt.factorial_[n] * (lt.finverse_[k] * lt.finverse_[n - k] % mod_) %
           mod_;
  }

 private:
  constexpr void Build() noexcept {
    lt.factorial_[0] = 1;
    lt.factorial_[1] = 1;
    lt.finverse_[0] = 1;
    lt.finverse_[1] = 1;
    lt.inverse_[1] = 1;
    for (int i = 2; i < n_; ++i) {
      lt.factorial_[i] = lt.factorial_[i - 1] * i % mod_;
      lt.inverse_[i] = mod_ - lt.inverse_[mod_ % i] * (mod_ / i) % mod_;
      lt.finverse_[i] = lt.finverse_[i - 1] * lt.inverse_[i] % mod_;
    }
  }
};

Combination kyomukyomupurin;

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

 int x, y; cin >> x >> y;
  auto ok = [](int xx, int yy) -> bool {
    if (xx * 2 < yy || xx > yy * 2) return false;
    return (xx + yy) % 3 == 0;
  };
 
  if (!ok(x, y)) {
    cout << 0 << endl;
    return 0;
  }
 
  int nn = (x + y) / 3;
  int r = x - nn;
 
  cout << kyomukyomupurin.Get(nn, r) << endl;

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
const ll MOD = 1e9 + 7;
const ll N = 1e5 + 5;
ll n, a[N];
int main()
{
    IOS;
    ll x;
    cin >> x;
    if(x >= 30)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    return 0;
}


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

int main(){
    int x, y, h, w, n, ans = 0;
    cin >> h >> w >> n;
    cin >> h >> w;
    for(int i = 0;i<n-1;i++){
        cin >> x >> y;
        int pre = ans;
        if((x>h && y>w) || (x<h && y<w)){
            // cout << "++" <<endl;
            ans += min(abs(x-h), abs(y-w));
            ans += max(abs(x-h), abs(y-w)) - min(abs(x-h), abs(y-w));
        }
        else{
            // cout << "ot" <<endl;
            ans += (abs(h-x) + abs(y-w));
        }
        h = x;
        w = y;
        // cout << ans - pre << endl;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3092
N, K, L = [int(_) for _ in input().split()]


def find(a, x):
    if a[x] != x:
        a[x] = find(a, a[x])
    return a[x]


def unite(a, x, y):
    x = find(a, x)
    y = find(a, y)
    if x != y:
        a[x] = min(x, y)
        a[y] = a[x]


a_road = [i for i in range(N)]
for _ in range(K):
    p, q = [int(_) - 1 for _ in input().split()]
    unite(a_road, p, q)
a_railway = [i for i in range(N)]
for _ in range(L):
    r, s = [int(_) - 1 for _ in input().split()]
    unite(a_railway, r, s)
memo = {}
for i in range(N):
    memo[a_road[i], a_railway[i]] = memo.get(
        (find(a_road, i), find(a_railway, i)), 0) + 1

print(' '.join(str(memo[a_road[i], a_railway[i]]) for i in range(N)))


Measured memory_bytes: 55052
n = [int(input())]

cDict = {}
for mark in 'S H C D'.split(' '):
  for rank in range(1, 14):
    cDict[mark + ' ' + str(rank)] = 0

for nn in range(n[0]):
  c = input()
  cDict[c] = 1

for mark in 'S H C D'.split(' '):
  for rank in range(1, 14):
    key = mark + ' ' + str(rank)
    if cDict[key] == 0:
      print(key)

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

// template {{{
#define  range(i, l, r) for (int i = (int)(l); i < (int)(r); (i) += 1)
#define rrange(i, l, r) for (int i = (int)(r) - 1; i >= (int)(l); (i) -= 1)

#define  whole(f, x, ...) ([&](decltype((x)) container) { return (f)(  begin(container),  end(container), ## __VA_ARGS__); })(x)
#define rwhole(f, x, ...) ([&](decltype((x)) container) { return (f)( rbegin(container), rend(container), ## __VA_ARGS__); })(x)

#define debug(x) cerr << "(" << __LINE__ << ")" << #x << ": " << (x) << endl

using i32 = int;
using u32 = unsigned int;
using i64 = long long;
using u64 = unsigned long long;

// constexpr i32 mod   = 998244353;
constexpr i32 mod   = 1e9 + 7;
constexpr i32 inf   = 1001001001;
constexpr i64 infll = 1001001001001001001ll;

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

struct IoSetup { IoSetup(int x = 15){ cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(x); cerr << fixed << setprecision(x); } } iosetup;

template <typename T = i64> T input() { T x; cin >> x; return x; }

template <typename T> ostream &operator<<(ostream &os, vector<T> &v) { range(i, 0, v.size()) { os << v[i] << (i + 1 != v.size() ? " " : ""); } return os; }
template <typename T> istream &operator>>(istream &is, vector<T> &v) { for (T &in : v) is >> in; return is; }

template <typename T1, typename T2> ostream &operator<<(ostream &os, pair<T1, T2> p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
template <typename T1, typename T2> istream &operator>>(istream &is, pair<T1, T2> &p) { is >> p.first >> p.second; return is; }

template <typename T> vector<T> make_vector(size_t a, T b) { return vector<T>(a, b); }
template <typename... Ts> auto make_vector(size_t a, Ts... ts) { return vector<decltype(make_vector(ts...))>(a, make_vector(ts...)); }

template <typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template <typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
// }}}

void solver() {
    int s = input(), w = input();

    cout << (s <= w ? "unsafe" : "safe") << endl;
}

signed main(int argc, char *argv[]) {
    solver();
}


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

int main(){
  int n;
  cin >> n;
  vector<string>s(n);
  map<string,int> mp;
  rep(i,n)cin >> s[i];
  rep(i,n)mp[s[i]]++;
  cout << "AC x " << mp["AC"] << endl;
  cout << "WA x " << mp["WA"] << endl;
  cout << "TLE x " << mp["TLE"] << endl;
  cout << "RE x " << mp["RE"] << endl;
}


Measured memory_bytes: 6428
#include<bits/stdc++.h>
using namespace std;
int h,w,d;
const string color = "RBGY";
int main(){
	cin>>h>>w>>d;
	for( int i = 0; i < h; i++ ){
		for( int j = 0; j < w; j++ ){
			int a = i + j;
			int b = w + i - j;
			putchar(color[a/d%2+b/d%2*2]);
		} 
		puts("");
	}
	return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#include <math.h>
#include <cmath>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;//でかい整数

int main(){
  int n;
  cin >>n;
  rep(i,9){
    rep(j,9){
      if((i+1)*(j+1)==n) {
      cout<< "Yes" << endl;
      return 0;
      }
    }
  }
  cout<< "No" <<endl;
  return 0;
}



Measured memory_bytes: 256
N = int(input())
A1 = list(map(int, input().split()))
A2 = list(map(int, input().split()))

sum_r, sum_l = 0, 0
maxv = 0

for i in range(N):
    sum_l = sum(A1[:i+1])
    sum_r = sum(A2[i:])
    maxv = max([maxv, sum_l+sum_r])

print(maxv)

Measured memory_bytes: 3064
#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <stdlib.h>
#include <math.h>
#include <string>
#include <time.h>
#include <string.h>
#include <queue>
#include <stack>
#define pb push_back
using namespace std;
typedef long long int ll;
ll mod=1e9+7;
ll exp(ll t,ll x){if(x==0) return 1;if(x==1) return t;if(x%2==1) return (t*exp((t*t)%mod,x/2))%mod;if(x%2==0) return exp((t*t)%mod,x/2);} 
ll gcd(ll x,ll y){return x%y==0?y:gcd(y,x%y);}
ll lcm(ll x,ll y){return x*(y/gcd(x,y));}
ll bsum(ll u,ll b){return u<b?u:bsum(u/b,b)+u%b;}
ll prival(ll u,ll p){int cn=0;while(u%p==0){cn++;u=u/p;}return cn;}
bool isprime(ll x){for(ll i=2;i*i<=x;i++){if(x%i==0){return false;}}return true;}
void YAY(void){cout<<"YES"<<endl;}
void NAY(void){cout<<"NO"<<endl;}
int cc;
int a[111111];
int n;
int main(void)
{
	int i, j;
	cin>>n;
	for(i=1 ; i<=n ; i++)
	{
		scanf("%d",&a[i]);
	}
	for(i=1 ; i<=n ; i++)
	{
		if(a[i]==i)
		{
			swap(a[i],a[i+1]); cc++;
		}
	}
	cout<<cc;
}

Measured memory_bytes: 640
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        if (n==7||n==5||n==3){
            System.out.println("YES");
        }
        else {
            System.out.println("NO");
        }
        sc.close();
    }
}

Measured memory_bytes: 22740
#include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <vector>

using namespace std;

int main() {
  int a, b;
  cin >> a >> b;

  double a_pred, b_pred;

  a_pred = ceil((double)a / 0.08);
  b_pred = ceil((double)b / 0.1);
  double pred = max(a_pred, b_pred);

  if (floor(pred * 0.08) == a && floor(pred * 0.1) == b) {
    cout << (int)pred << endl;
    return 0;
  }

  double max_pred =
      min(ceil((double)(a + 1) / 0.08), ceil((double)(b + 1) / 0.1));

  for (pred += 1.0; pred <= max_pred; pred += 1.0) {
    if (floor(pred * 0.08) == a && floor(pred * 0.1) == b) {
      cout << (int)pred << endl;
      return 0;
    }
  }

  cout << -1 << endl;

  return 0;
}

Measured memory_bytes: 256
n=int(input())
a=list(map(int,input().split()))

import sys
import math
def setwise_coprime(a):
  ans=a[0]
  for i in range(1,n):
    ans=math.gcd(ans,a[i])
  return ans

#エラストテネスのふるい
def create_sieve(n):
  sieve=[0]*(n+1)
  for i in range(2,n+1):
    if sieve[i]==0:
      for j in range(i*i,n+1,i):
        sieve[j]=i
  return sieve

#高速素因数分解
def fast_factorization(n, sieve):
  prime={}
  while n>1:
    p=sieve[n]
    #nが素数の場合
    if p==0:
      prime[n]=prime.get(n,0)+1
      break
    #nが素数ではない場合
    else:
      prime[p]=prime.get(p,0)+1
      n=n//p
  return prime

check=set()
if setwise_coprime(a)==1:
  #素因数のダブリをcheck
  sieve=create_sieve(10**6)
  for i in range(n):
    if a[i]!=1:
      s=fast_factorization(a[i], sieve)
      for i in s:
        if i in check:
          print("setwise coprime")
          sys.exit()
        else:
          check.add(i)
  print("pairwise coprime")    
else:
  print("not coprime")
  
  



      
      
    


Measured memory_bytes: 127668
using System;
using System.Collections.Generic;
using System.Linq;

namespace ABC124

{
    class D
    {
        static void Main(string[] args)
        {
            int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int N = input[0];
            int K = input[1];
            string S = Console.ReadLine();

            List<int> list = new List<int>();
            int count;

            for (int i = 0; i < S.Length; i++)
            {
                if (i == 0 && S[0] != '1')
                {
                    list.Add(0);
                }

                count = 1;
                while (1 < S.Length && i < S.Length - 1 && S[i] == S[i + 1])
                {
                    count++;
                    i++;
                }
                list.Add(count);
            }

            if (S.Length == 1)
            {
                if (S[0] == '1') { list.Add(1); list.Add(0); }
                else { list.Add(0); list.Add(1); }
            }

            var Count = list.ToArray();

            int[] CS = new int[Count.Length + 2];
            CS[0] = 0;
            for (int i = 1; i < Count.Length; i++)
            {
                CS[i] = CS[i - 1] + Count[i - 1];
            }
            CS[Count.Length] = CS[Count.Length - 1] + Count[Count.Length - 1];
            CS[Count.Length + 1] = CS[Count.Length - 1] + Count[Count.Length - 1];

            //if (CS.Length % 2 == 1) { CS[Count.Length + 1] = 0; }

            int max = 0;
            //if (CS.Length % 2 == 1) { lin = CS.Length + 1; lin2 = 2 * K; }
            //else { lin = CS.Length; lin2 = 2 * K + 1; }
            for (int i = 0; i + 2 * K + 1 < CS.Length; i += 2)
            {
                max = Math.Max(max, CS[i + 2 * K + 1] - CS[i]);
            }

            /*
            for (int i = 0; i + lin2 < lin; i += 2)
            {
                max = Math.Max(max, CS[i + lin2] - CS[i]);
            }
            */


            if (S.Length == 1) max = 1;
            if (CS.Length / 2 <= K) max = S.Length;


            /*
            int index = 0;
            foreach (var item in CS)
            {
                Console.WriteLine("cs" + index + " " + item);
                index++;
            }
             */

            Console.WriteLine(max);
        }
    }
}

Measured memory_bytes: 14432
#include <stdio.h>
#define N 100000

typedef struct{
  int p;
  int d;
  int r;
}node;

int main()
{
  node u[N];
  int b=-1,id,k,c,l,r,i,j,n;

  scanf("%d",&n);
  for(i=0;i<n;i++){
    u[i].p=b;
    u[i].d=b;
    u[i].r=b;
  }

  for(i=0;i<n;i++){
    scanf("%d%d",&id,&k);
    for(j=0;j<k;j++){
      scanf("%d",&c);
      if(j==0)u[id].d=c;
      else u[l].r=c;
      l=c;
      u[c].p=id;
    }
  }
  for(i=0;i<n;i++) print(u,i);
  return 0;
}

void print(node *u,int i){
  int c;

  printf("node %d: ",i);
  printf("parent = %d, ",u[i]);
  printf("depth = %d, ",depth(u,i));
  if(u[i].p==-1)printf("root, ");
  if(u[i].p!=-1 && u[i].d==-1)printf("leaf, ");
  if(u[i].p!=-1 && u[i].d!=-1)printf("internal node, ");
  printf("[");
  if(u[i].d != -1){
    printf("%d",u[i].d);
    c=u[i].d;
    while(u[c].r != -1){
      printf(", %d",u[c].r);
      c=u[c].r;
    }
  }
  printf("]\n");
}

int depth(node *u,int x){
  int count=0,temp;

  while(u[x].p != -1){
    count++;
    temp=u[x].p;
    x=temp;
  }
  return count;
}



Measured memory_bytes: 2972
#include <iostream>

using namespace std;

int main()
{
	int n, m, a[1001];
	long long sum=0;
	cin>>n>>m;
	for(int i = 1;i <= n; i++){
		cin>>a[i];
		sum += a[i];
	}
	int l=0;
	for(int i = 1;i <= n; i++){
		if(a[i]*4*m >=sum){
			l++;
		}
	}
	if(l>=m){
	    cout<<"Yes"<<endl;
	}
	else{
	    cout<<"No"<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
n, T = map(int,input().split())
list_c = []
list_t = []
for i in range(n):
    c, t = map(int,input().split())
    if t > T:
        pass
    else:
        list_c.append(c)
        list_t.append(t)
if len(list_t) == 0:
    print('TLE')
else:
    print(min(list_c))

Measured memory_bytes: 3064
n = int(input())
l = []
for i in range(100002):
  l.append(0)

def sum(i):
  l[i] += 1
  l[i+1] += 1
  if i != 0:
    l[i-1] += 1

m = map(int , input().split())

for i in list(m):
  sum(i)

ans = 0

for i in range(100002):
  if ans < l[i]:
    ans = l[i]

print(ans)

Measured memory_bytes: 15308
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    n = I()
    a = [[c for c in S()] for _ in range(n)]
    r = 0
    for i in range(n):
        b = [[a[ii][(j+i)%n] for j in range(n)] for ii in range(n)]
        f = True
        for ii in range(n):
            for jj in range(ii+1,n):
                if b[ii][jj] != b[jj][ii]:
                    f = False
                    break
            if not f:
                break
        if f:
            r += 1

    return r * n




print(main())



Measured memory_bytes: 147808
#include<bits/stdc++.h>
#include <math.h>
#include<iostream>
#include <string>
using namespace std;
typedef long long ll;
#define pb pushback
#define fr(i,n) for(int i=0;i<n;i++)
#define ifr(i,n) for(int i=n-1;i>=0;i--)


int main() {
    int x,y,z,w;
	cin >> x>> y>> z>>w;
    string ans="Balanced";
    if(x+y<z+w)ans="Right";
    else if(x+y>z+w)ans = "Left";
      cout << ans << endl;
}


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

using namespace std;

bool is_palindrome(string s)
{
    int len = s.length();
    for(int i = 0, j = len - 1; i <= j; i++, j--)
    {
        if(s[i] == s[j])    continue;
        else    return false;
    }
    return true;
}

bool is_strong_palindrome(string s)
{
    return is_palindrome(s) & is_palindrome(s.substr(0, s.length() / 2)) & is_palindrome(s.substr(s.length() / 2 + 1, s.length() / 2));
}

int main()
{
    string s;
    while(cin>>s)
    {
        if(is_strong_palindrome(s))     cout<<"Yes"<<endl;
        else    cout<<"No"<<endl;
    }
    return 0;
}

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

bool isPrime(int n) 
{ 
	if (n <= 1) return false; 
	if (n <= 3) return true; 
	
	if (n%2 == 0 || n%3 == 0) return false; 
	
	for (int i=5; i*i<=n; i=i+6) 
		if (n%i == 0 || n%(i+2) == 0) 
		return false; 
	
	return true; 
} 

int nextPrime(int N) 
{ 
	if (N <= 1) 
		return 2; 

	int prime = N; 
	bool found = false; 

    if (isPrime(N)) return N;

	while (!found) { 
		prime++; 

		if (isPrime(prime)) 
			found = true; 
	} 

	return prime; 
} 

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

    cout << nextPrime(x) << endl;
	return 0; 
} 


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mod 1000000007ll
#define vll vector<ll>
#define pll pair<ll,ll>
#define vpll vector<pll>
#define pb push_back
#define mp make_pair
#define x first
#define y second
#define db(x) cout << #x << " = " << x << '\n'
#define sep cout << "********************************************\n"
#define fast ios_base::sync_with_stdio(false), cin.tie(NULL)
ll l[1000006], r[1000006], a[1000006], n;
ll solve()
{
	stack<ll> s;
	for (int i = 0; i < n; ++i)
	{
		while (!s.empty() && a[i] <= a[s.top()])
		{
			r[s.top()] = i - 1;
			s.pop();
		}
		s.push(i);
	}
	while (!s.empty())
	{
		r[s.top()] = n - 1;
		s.pop();
	}
	for (int i = n - 1; i >= 0; --i)
	{
		while (!s.empty() && a[i] < a[s.top()])
		{
			l[s.top()] = i + 1;
			s.pop();
		}
		s.push(i);
	}
	while (!s.empty())
	{
		l[s.top()] = 0;
		s.pop();
	}
	ll ans = 0;
	for (int i = 0; i < n; ++i)
	{
		ll mul = (r[i] - i + 1) * (i - l[i] + 1);
		ans += mul * a[i];
	}
	return ans;
}
int main(int argc, char const *argv[])
{
	fast;
	cin >> n;
	for (int i = 0; i < n; ++i)
	{
		cin >> a[i];
	}
	ll ans = solve();
	
	
	cout << ans;
	return 0;
}

Measured memory_bytes: 11064
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i <= n; i++)
#define FORR(i, m, n) for(int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
 
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;

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

    ll r, g, b, n;
    cin >> r >> g >> b >> n;

    ll res = 0;
    REP(i, 3001){
        REP(j, 3001){
            ll p = i * r + j * g;
            ll k = n - p;
            if(k >= 0 && k % b == 0) res++;
        }
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
N = int(input())

tmp = 0
flag = True
for k in range(N + 1):
    tmp += k
    if tmp == N:
        break
    if tmp > N:
        flag =False
        break

if not flag:
    print ('No')
    exit()


G = [[] for _ in range(k + 1)]

count = 1
for i in range(k):
    for j in range(i + 1, k + 1):
        G[i].append(count)
        G[j].append(count)
        count += 1

print ('Yes')
print (k + 1)
for tmp in G:
    print (len(tmp), *tmp, sep = ' ')

Measured memory_bytes: 9424
#include <iostream>
#include <string>
#include <map>
#include <algorithm>
#include <vector>

using namespace std;

int main(void){
    int n, m;
    vector<pair<int, pair<int, int>>> py;
    int f = -1;
    int b_count;
    vector<pair<int, string>> ans;
    

    cin >> n >> m;
    for(int i = 0; i < m; i++){
        int p, y;
        cin >> p >> y;
        py.push_back(make_pair(p,make_pair(y, i)));
    }

    /*
    for(int i = 0; i < m; i++){
        cout << py[i].first << " " << py[i].second.first << " " << py[i].second.second << endl;
    }
    */

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

    /*
    for(int i = 0; i < m; i++){
        cout << py[i].first << " " << py[i].second.first << " " << py[i].second.second << endl;
    }
    */

    for(int i = 0; i < m; i++){
        if(f != py[i].first){
            f = py[i].first;
            b_count = 1;
        }
        else{
            b_count++;
        }
        int a_num = to_string(py[i].first).length();
        int b_num = to_string(b_count).length();
        
        ans.push_back(make_pair(py[i].second.second, string(6-a_num, '0') + to_string(py[i].first) + string(6-b_num, '0') + to_string(b_count)));
    }

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

    for(int i = 0; i < m; i++){
        cout << ans[i].second << endl;
    }
    return 0;
}

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

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

    bool flag = false;
    int tmp = 0;
    for (int i = 0; i < N - 1; i++) {
        if (A[i] + A[i + 1] >= L) {
            flag = true;
            tmp = i;
        }
    }
    
    if (flag == false) cout << "Impossible" << endl;
    else {
        cout << "Possible" << endl;
        for (int i = 0; i < tmp; i++) cout << i + 1 << endl;
        for (int i = N - 2; i >= tmp; i--) cout << i + 1 << endl;
    }
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
#define all(cont) cont.begin(), cont.end()
#define pb push_back
#define fi first
#define se second
#define DEBUG(x) cerr << (#x) << ": " << (x) << '\n'
 
using namespace std;
 
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef long long ll;
typedef unsigned long long ull;
 
template<class T> bool uin(T &a, T b) {return (a < b ? false : (a = b, true));}
template<class T> bool uax(T &a, T b) {return (a > b ? false : (a = b, true));}
 
//~ ifstream f(".in");
//~ ofstream g(".out");
 
const int MOD = 1e9 + 7;

void add(int &a, int b) {
  a += b;
  while (a >= MOD) {
    a -= MOD;
  }
  while (a < 0) {
    a += MOD;
  }
}
 
struct BIT {
  int n;
  vector<int> tree;
  BIT (int _n) : n(_n + 1) {
    tree.resize(n + 2);
  }
  inline int lsb(int x) {
    return (x & (-x));
  }
  void update(int pos, int val) {
    ++pos;
    while (pos <= n) {
      add(tree[pos], val);
      pos += lsb(pos);
    }
  }
  int query(int pos) {
    ++pos;
    int ret = 0;
    while (pos) {
      add(ret, tree[pos]);
      pos -= lsb(pos);
    }
    return ret;
  }
};
 
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
#ifdef LOCAL_DEFINE
  //~ freopen(".in", "r", stdin);
#endif
 
  int n, k;
  cin >> n >> k;
  vector<int> a(n + 2);
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
  }
  vector<int> dp(k + 2);
  dp[0] = 1;
  for (int i = 1; i <= n; ++i) {
    //~ vector<int> new_dp = dp;
    BIT new_dp(k);
    for (int j = 0; j <= k; ++j) {
      int l = j + 1;
      int r = j + min(a[i], k - j);
      new_dp.update(l, dp[j]);
      new_dp.update(r + 1, -dp[j]);
      //~ for (int p = l; p <= r; ++p) {
        //~ new_dp[p] += dp[j];
      //~ } 
    }
    //~ dp = new_dp;
    for (int j = 0; j <= k; ++j) {
      add(dp[j], new_dp.query(j));
    }
  }
 
  cout << dp[k] << '\n';
 
#ifdef LOCAL_DEFINE
  cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
  return 0;
}


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

struct edge {
  int from;
  int to;
  int cost;
};

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);

  int n, m;
  cin >> n >> m;
  int64_t path[1001][1001];
  for (int i = 0; i < 1001; ++i) {
    for (int j = 0; j < 1001; ++j) {
      path[i][j] = 1000;
    }
  }

  vector<edge> edges(m);
  for (int i = 0; i < m; ++i) {
    int a, b, c;
    cin >> a >> b >> c;
    a--, b--;
    edges[i] = edge{a, b, c};
    path[a][b] = c;
    path[b][a] = c;
  }
  for (int k = 0; k < n; ++k) {
    for (int i = 0; i < m; ++i) {
      for (int j = 0; j < m; ++j) {
        path[i][j] = min(path[i][j], path[i][k] + path[k][j]);
      }
    }
  }

  int ans = 0;
  for (auto &e : edges) {
    if (path[e.from][e.to] < e.cost) {
      ++ans;
    }
  }
  cout << ans << "\n";
}


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

using namespace std;

const int MAX_N = 2e6 + 10, INF = 1e8;

int N, M, K;
int S1[MAX_N], S2[MAX_N];

void init() {
    scanf("%d%d%d", &N, &M, &K);
    char buf[MAX_N];
    scanf("%s", buf + 1);
    for (int i = 1; i <= N; i++) S1[i] = buf[N - i + 1] - '0';
    scanf("%s", buf + 1);
    for (int i = 1; i <= M; i++) S2[i] = buf[M - i + 1] - '0';
}

void print(int S[MAX_N]) {
    bool any = false;
    for (int i = MAX_N - 1; i; i--) {
        any |= S[i];
        if (any) printf("%d", S[i]);
    }
    printf("\n");
}

void solve() {
    stack<int> dirty; dirty.push(INF);
    for (int i = max(N, M); i >= 1; i--) {
        if (S1[i] + S2[i] == 1) {
            dirty.push(i);
        }
        if (S1[i] != 1 || S2[i] != 1) continue;
        int ttl = K, p = i;
        S1[i] = S2[i] = 0;
        int a1 = 1, a2 = 1;
        stack<int> curr_dirty;
        while (true) {
            int t = dirty.top();
            if (t != p) {
                if (a1 != 1 || a2 != 1) {
                    S1[p] = a1;
                    S2[p] = a2;
                    if (a1 == 1 || a2 == 1)
                        curr_dirty.push(p);
                    break;
                } else {
                    int dis = t - p;
                    if (dis > ttl) {
                        S1[p + ttl] = 1;
                        S2[p + ttl] = 1;
                        break;
                    } else {
                        ttl -= dis;
                        p = t;
                    }
                }
            }
            dirty.pop();
            if (S1[p] == 0) {
                if (a1 == 0 && a2 == 1) {
                    S2[p] = 0;
                } else if (a1 == 1 && a2 == 0) {
                    if (ttl) {
                        ttl--;
                        S2[p] = 0;
                        a1 = a2 = 1;
                    } else {
                        S1[p] = 1;
                        break;
                    }
                } else {
                    S1[p] = 1; S2[p] = 0;
                    a1 = 0;
                    curr_dirty.push(p);
                }
            } else {
                if (a1 == 0 && a2 == 1) {
                    if (ttl)  {
                        ttl--;
                        S2[p] = 0;
                        S1[p] = 0;
                        a1 = a2 = 1;
                    } else {
                        S2[p] = 1;
                        break;
                    }
                } else if (a1 == 1 && a2 == 0) {
                    S1[p] = 0;
                } else {
                    S1[p] = 0; S2[p] = 1;
                    a2 = 0;
                    curr_dirty.push(p);
                }
            }
            p++;
        }
        while (!curr_dirty.empty()) {
            dirty.push(curr_dirty.top());
            curr_dirty.pop();
        }
    }
    print(S1);
    print(S2);
}

int main() {
    init();
    solve();
}


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

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

using namespace std;
typedef long long ll;
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4765
const int mod = 1000000007;
struct mint {
  ll x;
  mint(ll x=0):x(x%mod){}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
};
mint c[4005][4005];
void init(){
  c[0][0]=1;
  REP(i,4001){
    REP(j,i+1){
      c[i+1][j]+=c[i][j];
      c[i+1][j+1]+=c[i][j];
    }
  }
}
mint comb(int n,int k){
  return c[n][k];
}
mint f2(int n,int k){
  return comb(n+k-1,k-1);
}
mint f(int n,int k){
  if(n<k)return 0;
  if(n==0&&k==0)return 1;
  if(n<1)return 0;
  return f2(n-k,k);
}
int main(){
  init();
  int n,k;
  cin>>n>>k;
  for(int i=1;i<=k;i++){
    mint blue=f(k,i);
    mint red=0;
    {
      red+=f(n-k,i-1);
      red+=f(n-k,i);
      red+=f(n-k,i);
      red+=f(n-k,i+1);
    }
    mint ans =blue*red;
    cout<<ans.x<<endl;
  }
}


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

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

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

	string S;
	cin >> S;

	char c[256] = {};
	rep(i,4)
		c[S[i]]++;

	rep(i,4)
		if (c[S[i]] != 2) {
			cout << "No" << endl;
			return 0;
		}

	cout << "Yes" << endl;

	return 0;
}



Measured memory_bytes: 256
using System;
using System.Collections.Generic;

class Program
{
    static long n;
    static long mod = (long)1e9 + 7;
    static SortedList<long, long> sl = new SortedList<long, long>
        {
            { 0, 1 },
            { 1, 1 }
        };

    static void Main()
    {
        n = long.Parse(Console.ReadLine());
        Console.WriteLine(Ans(n));
    }

    static long h(long n)
    {
        if (sl.ContainsKey(n)) return sl[n];
        long t;
        if (n % 2 == 1)
        {
            t = h(n / 2);
            sl.Add(n, t);
            return t;
        }
        long t1 = h(n / 2);
        long t2 = h(n / 2 - 1);
        t = (t1 + t2) % mod;
        sl.Add(n, t);
        return t;
    }

    static long Ans(long n)
    {
        if (n == 0) return 1;
        if (n == 1) return 2;
        long m = n / 2;
        long s = Ans(m - 1);
        long hm = h(m);
        if (n % 2 == 0)
            return (3 * s % mod + hm) % mod;
        return (3 * s % mod + 2 * hm % mod) % mod;
    }
}

Measured memory_bytes: 13652
def main():
    n = int(input())
    s = []
    for i in range(n):
        stmp = input()
        stmp = sorted(stmp)
        stmp = ''.join(stmp)
        s.append(stmp)
    s.sort()

    anslist = []
    flag = False
    counter = 1
    place = 0
    for i in range(n):
        while s[place] == s[place+counter]:
            counter +=1
            if place+counter == n:
                break
        anslist.append(counter)
        place += counter
        counter = 1
        if place >= n-1:
            break
    ans = 0
    for i in anslist:
        ans += (i*(i-1))//2
        
    print(ans)

main()

Measured memory_bytes: 11272
#include <iostream>
#include <math.h> 
#include <string> 
#include <algorithm>
#include <numeric>
#include <cmath>
using namespace std;

int main() {

	string res = "Yes";
	long H , W; cin >> H >> W;
	char S[100][100]; for (int i = 1; i <= max(H , W); i++) { S[i][0] = '.'; S[0][i] = '.'; }

    for(int i = 1; i <= H; i++) for(int j = 1; j <= W; j++) cin >> S[i][j];

	for (int i = 1; i <= H; i++) {
		for (int j = 1; j <= W; j++) {

			if (S[i][j] == '#') {

				if (S[i][j + 1] != '#' && S[i][j - 1] != '#' && S[i + 1][j] != '#' && S[i - 1][j] != '#') res = "No";

			}

		}
	}
    
	cout << res << endl;
}

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

template <class T>
ostream &operator<<(ostream &o, const vector<T> &v)
{
	o << "{";
	for (int i = 0; i < (int)v.size(); i++)
		o << (i > 0 ? ", " : "") << v[i];
	o << "}";
	return o;
}

const string dna_base = "ATCG";
const string rna_base = "AUCG";

//I/O files
ifstream inputfile("ain.txt");
ofstream outputfile("aout.txt");

int basemap(char c)
{
	if (c == 'A')
		return 0;
	if (c == 'T' || c == 'U')
		return 1;
	if (c == 'C')
		return 2;
	if (c == 'G')
		return 3;
	return -1;
}

//fasta format
string readg(string buf)
{
	string res = "";

	if (buf[0] == '>')
		return res;

	char nowc;

	for (char nowc : buf)
	{
		if (basemap(nowc) >= 0)
			res.push_back(nowc);
	}

	return res;
}

string rev_complement(string strand)
{
	string res = "";
	for (char c : strand)
	{
		res.push_back(dna_base[basemap(c) ^ 1]);
	}
	//reverse(res.begin(), res.end());

	return res;
}

//********************************template END****************************************//

void solve(void)
{
	string s;
	cin >> s;
	cout << rev_complement(s) << endl;
}

int main(void)
{
	/*
	if (inputfile.fail())
	{
		cout << "FILE READ ERROR" << endl;
		return 0;
	}
	int T;
	inputfile >> T;
	while(T--) solve();
	inputfile.close();
	outputfile.close();
	*/
	solve();
	//cout << "yui(*-v・)yui" << endl;
	return 0;
}


Measured memory_bytes: 256
import java.io.IOException;
import java.util.Scanner;

public class Main {
	static int[][] board = new int[10][10];

	public static void main(String[] args) throws IOException {
		// 宣言
		Scanner sc = new Scanner(System.in);
		String[] str;

		while (sc.hasNext()) {
			str = sc.nextLine().split(",");
			int x = Integer.parseInt(str[0]);
			int y = Integer.parseInt(str[1]);
			int size = Integer.parseInt(str[2]);
			if (size == 1) {
				small(x, y);
			} else if (size == 2) {
				middle(x, y);
			} else if (size == 3) {
				big(x, y);
			}
		}

		int count = 0;
		int max = 0;

		for (int xx = 0; xx < 10; xx++) {
			for (int yy = 0; yy < 10; yy++) {
				// 1個目の答え
				if (board[xx][yy] == 0) {
					count++;
				}
				// 2個目の答え
				if (max < board[xx][yy]) {
					max = board[xx][yy];
				}
			}
		}

		System.out.println(count);
		System.out.println(max);

	}

	static void small(int x, int y) {
		int smallx[] = { 1, 0, -1, 0 };
		int smally[] = { 0, 1, 0, -1 };
		paint(x, y);
		for (int i = 0; i < 4; i++) {
			int nx = smallx[i] + x;
			int ny = smally[i] + y;
			paint(nx, ny);
		}
	}

	static void middle(int x, int y) {
		for (int yrange = -1; yrange <= 1; yrange++) {
			for (int xrange = -1; xrange <= 1; xrange++) {
				paint(x + xrange, y + yrange);
			}
		}
	}

	static void big(int x, int y) {
		middle(x, y);
		paint(x, y - 2);
		paint(x, y + 2);
		paint(x + 2, y);
		paint(x - 2, y);
	}

	static void paint(int x, int y) {
		if (x < 0 || y < 0 || x >9 || y >9) {
			return;
		} else {
			board[x][y] += 1;
		}
		
	}

}

Measured memory_bytes: 17328
#include<stdio.h>
int main()
{
	int n,i,a=0,b=0,c=0,d=0;
	char s[100000];
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%s",s);
		if(s[0]=='A') a++;
		if(s[0]=='W') b++;
		if(s[0]=='T') c++;
		if(s[0]=='R') d++;
	}
	printf("AC x %d\n",a);
	printf("WA x %d\n",b);
	printf("TLE x %d\n",c);
	printf("RE x %d\n",d);
	return 0;
}


Measured memory_bytes: 1740
import numpy as np
N, M = map(int, input().split())
cities = np.array(tuple(tuple(map(int, input().split())) for _ in range(M)), dtype=np.int64)
arg = np.argsort(cities[:, 0] * 10 ** 10 + cities[:, 1])
pref = 0
ans = []
for p, y in cities[arg]:
    if p != pref:
        pref = p
        count = 1
    ans.append("{:06d}{:06d}".format(p, count))
    count += 1
for i in np.argsort(arg):
    print(ans[i])

Measured memory_bytes: 35812
#include<bits/stdc++.h>
using namespace std;
int main()
{

    long long a,b,c,d,e,f,g,h,i,j,k,l,m,n,t,x,y,z;
    cin>>n;
   map<long ,long>mp;
    for(i=1;i<=9;i++)
    {
for(j=1;j<=9;j++)
{


    mp[i*j]++;
}



    }
    if(mp[n]==0)
cout<<"No"<<endl;
else cout<<"Yes"<<endl;






}


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

int main()
{
    string s;
    cin >> s;
    bool check = true;

    rep(i, s.length()){
        if(!(i%2)){
            if(s[i] == 'L') check = false;
        }
        else{
            if(s[i] == 'R') check = false;
        }
    }

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

Measured memory_bytes: 3608
#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<algorithm>
#include<stack>
#include<cstring>
#include<unordered_map>
#include<cmath>
#include<climits>
using namespace std;

template<typename T>
istream& operator>>(istream& in, vector<T> &a) {for(auto &i : a) {in >> i; } return in; } 
template<typename T>
ostream& operator<<(ostream& out, vector<T> &a) {for(auto &i : a) {out << i << ' '; } out << '\n'; return out; }

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



bool isVowel(char c)
{
	if(c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u')
	{
		return true;
	}
	return false;
}
int32_t main()
{
	#ifndef ONLINE_JUDGE
		freopen("input/input.txt", "r", stdin);
		freopen("input/output.txt", "w", stdout);
	#endif
	int n;
	cin >> n;
	vector<pair<int, int>> dice(n);
	for(int i = 0; i < n; i++)
	{
		cin >> dice[i].first >> dice[i].second;
 	}
 	bool flag = false;
 	for(int i = 0; i < n; i++)
 	{
 		int one = dice[i].first;
 		int two = dice[i].second;
 		int cnt = 0;
 		for(int j = i; j < i+3 && j < n; j++)
 		{
 			if(dice[j].first == dice[j].second) cnt++;
 		}
 		if(cnt == 3)
 		{
 			flag = true;
 		}
 	}
 	if(flag) cout << "Yes" << '\n';
 	else cout << "No" << '\n';
	return 0;
}


Measured memory_bytes: 3620
#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=n-1;i>=0;i--) {
		if(!(i==0)) {
			cout << a[i] << " ";
		} else {
			cout << a[i] << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 3108