akhauriyash/Code-Regression huggingface dataset:
using System;

namespace B
{
    class Visit
    {
        public void visit(ref int[,] point, ref int time, ref int[,] output, int now, ref string[] color)
        {
            int i;
            color[now] = "GRAY";
            output[now-1, 1] = ++time;
            for (i = 0; i < point[now, 1]; i++)
            {
                if (color[point[now, 2+i]]=="WHITE") {
                    visit(ref point, ref time, ref output, point[now, 2 + i], ref color);
                }
            }
            color[now] = "BLACK";
            output[now-1, 2] = ++time;
        }
    }

    class Program
    {
        static void Main(string[] args)
        {
            string input = Console.ReadLine();
            int n = int.Parse(input), i, j, time=0;
            int[,] point = new int[n + 1, n + 1];
            int[,] output = new int[n, 3];
            string[] color = new string[n + 1];
            for (i = 1; i <= n; i++)
            {
                output[i - 1, 0] = i;
                color[i] = "WHITE";
                string[] input2 = Console.ReadLine().Split(' ');
                point[i, 0] = int.Parse(input2[0]);
                point[i, 1] = int.Parse(input2[1]);
                for (j = 0; j < point[i,1]; j++)
                {
                    point[i, 2 + j] = int.Parse(input2[2 + j]);
                }
            }
            Visit visit = new Visit();
            visit.visit(ref point, ref time, ref output, 1, ref color);
            for (i = 1; i <= n; i++)
            {
                if (color[i]=="WHITE")
                {
                    visit.visit(ref point, ref time, ref output, i, ref color);
                }
            }
            for (i = 0; i < n; i++)
            {
                Console.WriteLine(output[i, 0] + " " + output[i, 1] + " " + output[i, 2]);
            }
        }
    }
}



Measured memory_bytes: 17992
import java.util.Scanner;

public class Main {
    public static int[] sort3(int[] pre) {
        int tmp;
        for (int i = 2; i >= 0; i--) {
            for (int j = 0; j < i; j++) {
                if (pre[j] > pre[j + 1]) {
                    tmp  = pre[j];
                    pre[j] = pre[j + 1];
                    pre[j + 1] = tmp;
                }
            }
        }
        return pre;
    }

    public static void main(String[] args) {
        int[] num = new int[3];
        Scanner scan = new Scanner(System.in);

        num[0] = Integer.parseInt(scan.next());
        num[1] = Integer.parseInt(scan.next());
        num[2] = Integer.parseInt(scan.next());

        num = sort3(num);

        System.out.println(num[0] +" " + num[1] + " " + num[2]);
    }
}



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

int n;
int h[200055], a[200055];

typedef pair<int, long long> P;

#define ft first
#define sd second

int main() {
	cin >> n;
	
	for (int i = 0; i < n; i++) {
		scanf("%d", &h[i]);
	}
	for (int i = 0; i < n; i++) {
		scanf("%d", &a[i]);
	}
	
	set<P> dp;
	
	dp.insert(P(0, 0));
	
	for (int i = 0; i < n; i++) {
		auto ite = --dp.lower_bound(P(h[i], 0));
		P p = P(h[i], ite->sd + a[i]);
		
		++ite;
		
		while (ite != dp.end()) {
			if (ite->sd <= p.sd) {
				ite = dp.erase(ite);
			} else {
				break;
			}
		}
		
		dp.insert(p);
	}
	
	cout << dp.rbegin()->sd;
}


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

using namespace std;
typedef long long ll;


int main(){
	ll n,m;
	cin>>n>>m;
	if(n==1 || m==1)cout<<1<<endl;
	else{
	ll ans = n*m;
	if(ans % 2==0){
		cout<<ans/2<<endl;
	}
	else{
		cout<<ans/2+1<<endl;
	}
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

using u128 = __uint128_t;

#define int long long
#define idxSet tree<int, null_type,less_equal<int>, rb_tree_tag,tree_order_statistics_node_update>
#define atIdx find_by_order
#define idxOf order_of_key
#define MOD 1000000007
#define MAX 200005
#define endl '\n'

#define v(type) vector<type>
#define p(type1, type2) pair<type1 , type2>
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;

int dp[MAX];

void solve() {
    int n;
    cin>>n;
    int a[n];
    for (int i = 0; i < n; ++i) {
        cin>>a[i];
    }
    map<int,int> x;
    x[0] = 1;
    int sum = 0;
    int ans = 0;
    for(int i = 0 ; i< n ; i++){
        sum += a[i];
        ans += x[sum];
        x[sum]++;
    }
    cout<<ans<<endl;

}

int32_t main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int t = 1;
    //cin>>t;
    while (t--)
        solve();
    return 0;
}

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

#define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

int main(int argc, char **argv) {
  ios::sync_with_stdio(false), cin.tie(0);
  int n, m;
  cin >> n >> m;
  vector<int> good(n, 1);
  vector<int> h(n);
  for (int i = 0; i < n; i++) {
    cin >> h[i];
  }
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    --a, --b;
    if (h[a] >= h[b])
      good[b] = 0;
    if (h[b] >= h[a])
      good[a] = 0;
  }
  int res = 0;
  for (int p : good) {
    if (p)
      ++res;
  }
  cout << res << '\n';
  return 0;
}

Measured memory_bytes: 3992
#include <bits/stdc++.h>
#define mp make_pair
#define all(vec) vec.begin(), vec.end()
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const ll INF = (1LL << 30) - 1;
const ll LINF = (1LL << 60) - 1;
const double eps = 1e-9;
const ll MOD = 998244353LL;
template <typename T>
void chmin(T& a, T b) {
    a = min(a, b);
};
template <typename T>
void chmax(T& a, T b) {
    a = max(a, b);
};
template <typename T>
vector<T> make_v(size_t a) {
    return vector<T>(a);
}
template <typename T, typename... Ts>
auto make_v(size_t a, Ts... ts) {
    return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template <typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type fill_v(T& t, const V& v) {
    t = v;
}
template <typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type fill_v(T& t, const V& v) {
    for(auto& e : t) {
        fill_v(e, v);
    }
};
int main() {
    ll n, D;
    cin >> n >> D;
    vector<ll> d(n), a(n + 10), b(n + 10);
    a[0] = D;
    for(int i = 0; i < n; i++) {
        cin >> d[i];
        a[i + 1] = min(a[i], abs(a[i] - d[i]));
    }
    b[n] = 1;
    for(int i = n - 1; i >= 0; i--) {
        if(b[i + 1] <= d[i] / 2) {
            b[i] = b[i + 1];
        } else {
            b[i] = b[i + 1] + d[i];
        }
    }
    int q;
    cin >> q;
    while(q--) {
        int t;
        cin >> t;
        --t;
        if(b[t+1] <= a[t]) {
            cout << "YES" << endl;
        } else {
            cout << "NO" << endl;
        }
    }
}


Measured memory_bytes: 15616
#include <bits/stdc++.h>
using namespace std;
#define gc getchar_unlocked
#define fo(i,n) for(i=0;i<n;i++)
#define Fo(i,k,n) for(i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define int long long int
#define si(x)   scanf("%d",&x)
#define sl(x)   scanf("%lld",&x)
#define ss(s)   scanf("%s",s)
#define pi(x)   printf("%d\n",x)
#define pl(x)   printf("%lld\n",x)
#define ps(s)   printf("%s\n",s)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
#define INF 100000000000
typedef pair<int, int>  pii;
typedef vector<int>     vi;
typedef vector<pii>     vpii;
typedef vector<vi>      vvi;
int mpow(int base, int exp);
void ipgraph(int m);
const int mod = 1000000007;
const int N = 1e5+5, M = N;
//=========================================

int weight[105], value[105];
int dp[105][N];

int knapsack(int n, int W){

    memset(dp, 0, sizeof(dp));

    for(int i = 0; i <= n; ++i){
        for(int j = 0; j <= W; ++j){
            if(i == 0 || j == 0)
                dp[i][j] = 0;

            else if(weight[i - 1] <= j)
                dp[i][j] = max(value[i - 1] + dp[i - 1][j - weight[i-1]], dp[i - 1][j]);

            else
                dp[i][j] = dp[i - 1][j];
        }
    }

    return dp[n][W];
}

int32_t main() {

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

    int n, W;
    cin >> n >> W;

    for(int i = 0; i < n; ++i)
        cin >> weight[i] >> value[i];


    int ans = knapsack(n, W);

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


Measured memory_bytes: 82304
#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def LS(): return list(map(list, input().split()))
def S(): return list(input().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = 1e10

#solve
def solve():
    n = II()
    a = LI()
    a.sort()
    print(sum(a[n::2]))
    return


#main
if __name__ == '__main__':
    solve()


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

class Main {

    public static void main( String[] args ) {
        try {
	      	BufferedReader kb = new BufferedReader( new InputStreamReader( System.in ) );
			int n = Integer.parseInt( kb.readLine( ) );        
			ArrayDeque<Integer> dq = new ArrayDeque<Integer>( );
            String str;
            for( int i=0; i<n; i++ ) {
				str = kb.readLine( );
                if( 'i' == str.charAt( 0 ) ) {
                    dq.addFirst( Integer.parseInt( str.substring( 7 ) ) );
                } else if( 'F' == str.charAt( 6 ) ) {
                    dq.removeFirst( );
                } else if( 'L' == str.charAt( 6 ) ) {
                    dq.removeLast(  );
                } else {
                    dq.removeFirstOccurrence( Integer.parseInt( str.substring( 7 ) ) );
                }
            } 	
			StringBuilder output = new  StringBuilder( );
            for( Iterator itr = dq.iterator( ); itr.hasNext( ); ) {
                output.append( itr.next( ) ).append( " " );
            }
            output.deleteCharAt( output.lastIndexOf( " " ) );
            System.out.println( output );
        } catch( IOException e ) {
            System.err.println( e );
        }
    }
}

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

int main(void)
{
    int X;

    cin >> X;

    int ret = 8;

    if ((X >= 1800) && (X <= 1999))
    {
        ret = 1;
    }
    else if (X >= 1600)
    {
        ret = 2;
    }
    else if (X >= 1400)
    {
        ret = 3;
    }
    else if (X >= 1200)
    {
        ret = 4;
    }
    else if (X >= 1000)
    {
        ret = 5;
    }
    else if (X >= 800)
    {
        ret = 6;
    }
    else if (X >= 600)
    {
        ret = 7;
    }
    else if (X >= 400)
    {
        ret = 8;
    }
    else
    {
        ret = 9;
    }

    cout << ret << "\n";
}


Measured memory_bytes: 3196
N=int(input())
D={}
for i in range(N):
    D[i]=input().split()

cou=0
for i in range(N):
    if D[i][0]==D[i][1]:
        cou+=1
        if cou ==3:
            print('Yes')
            break
    else:
        cou=0

if cou < 3:
    print('No')

Measured memory_bytes: 9188
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define repone(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define Rep(j,n) for(int j=0;j<(int)(n);++j)
#define Repo(j,o,n) for(int j=o;j<(int)(n);++j)
#define Repone(j,n) for(int j=1;j<(int)(n);++j)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define int long long
#define pb(a) push_back(a)
#define eraser(v,i) (v).erase(v.begin()+(i))
#define pbpair(a,b) push_back(make_pair(a,b))
#define MOD 1000000007
#define INF 9223372036854775807
#define pairint pair<int,int>
signed main()
{
int x=0,y=0,z=0,w=0,n=0,m=0;
string s="";
char a;
std::cin >> a;
std::cout << (char)(a+1) << '\n';

}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, o, n) for (auto i = (o); (i) < (n); ++(i))
#define FOR1(i, n) FOR(i, 1, n+1)
#define REP(i, n) FOR(i, 0, n)
#define REPR(i, n) for (auto i = (n)-1; (i) >= 0; --i)
#define REPI(itr, v) for (auto itr = v.begin(); itr != v.end(); ++itr)
#define REPIR(itr, v) for (auto itr = v.rbegin(); itr != v.rend(); ++itr)
#define fi first
#define se second
#define ll long long
#define int long long
#define V2(name, h, w) vector<vector<int> > name((h), vector<int>(w));

#define dl(line) cerr << "RUN: until " << (line) << "th line." << endl
#define dv(name, value) cerr << (name) << " is " << (value) << endl
#define da(v)  cerr << "["; REPI(itr, v){cerr << *itr << (itr != --v.end() ? ", " : "");} cerr << "]" << endl

char judgeRemainingChar (char c1, char c2) {
  if ((c1 == 'R' and c2 == 'G') or (c1 == 'G' and c2 == 'R')) {
    return 'B';
  } else
  if ((c1 == 'R' and c2 == 'B') or (c1 == 'B' and c2 == 'R')) {
    return 'G';
  } else
  if ((c1 == 'G' and c2 == 'B') or (c1 == 'B' and c2 == 'G')) {
    return 'R';
  }
  assert(false);
}

void solve(long long N, std::string S){
  N += 1;
  S = ' ' + S;

  vector<int> cSumR(N), cSumG(N), cSumB(N);
  int  sumR = 0, sumG = 0, sumB = 0;
  FOR(x, 1, N) {
    if (S.at(x) == 'R') {
      ++sumR;
    } else 
    if (S.at(x) == 'G') {
      ++sumG;
    } else 
    if (S.at(x) == 'B') {
      ++sumB;
    }

    cSumR.at(x) = sumR;
    cSumG.at(x) = sumG;
    cSumB.at(x) = sumB;
  }

  int ans = 0;
  FOR(x, 1, N) {
    FOR(y, x+1, N) {
      if (S.at(x) == S.at(y)) continue;

      int sum = 0;
      char remainingC = judgeRemainingChar(S.at(x), S.at(y)) ;
      if(remainingC == 'R') {
        sum = cSumR.back() - cSumR.at(y);
      } else
      if(remainingC == 'G') {
        sum = cSumG.back() - cSumG.at(y);
      } else
      if(remainingC == 'B') {
        sum = cSumB.back() - cSumB.at(y);
      }

      if (y - x < N - y) {
        if (S.at(y + (y-x)) == remainingC) --sum;
      }

      ans += sum;
    }
  }
  cout << ans << endl;
}

signed main(){
  long long N;
  scanf("%lld",&N);
  std::string S;
  std::cin >> S;
  solve(N, S);
}


Measured memory_bytes: 3792
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val s = (1..3).map { sc.next() }
    val c = Array(3) { Array(3) { HashSet<Int>()} }
    for (i in 0 until 3) {
        for (j in 0 until 3) {
            if (i == j) continue
            for (start in s[i].indices) {
                if (check(s[i], s[j], start)) {
                    c[i][j].add(start)
                }
            }
            c[i][j].add(s[i].length)
        }
    }

    var ans = s.map { it.length }.sum()
    for (i in 0 until 3) {
        for (j in 0 until 3) {
            if (i == j) continue
            for (k in 0 until 3) {
                if (i == k || j == k) continue
                ans = Math.min(ans, solve(s, c, listOf(i, j, k)))
            }
        }
    }
    println(ans)
}

fun solve(s: List<String>, c: Array<Array<HashSet<Int>>>, order: List<Int>): Int {
    val s0 = order[0]
    val s1 = order[1]
    val s2 = order[2]

    var ans = s.map { it.length }.sum()
    for (i in c[s0][s1]) {
        for (j in c[s1][s2]) {
            val idx = i + j
            if (idx >= s[s0].length || c[s0][s2].contains(idx)) {
                var len = s[s0].length
                len = Math.max(len, i + s[s1].length)
                len = Math.max(len, idx + s[s2].length)
                ans = Math.min(ans, len)
            }
        }
        for (j in c[s0][s2]) {
            if (j <= i + s[s1].length) continue
            var len = s[s0].length
            len = Math.max(len, j + s[s2].length)
            ans = Math.min(ans, len)
        }
    }
    return ans
}

fun check(a: String, b: String, start: Int): Boolean {
    for (i in b.indices) {
        if (start + i >= a.length) {
            return true
        }
        val ach = a[start + i]
        val bch = b[i]
        if (!(ach == '?' || bch == '?' || ach == bch)) {
            return false
        }
    }
    return true
}


Measured memory_bytes: 46300
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
#include <string>
#include <cmath>
#include <set>
#include <stack>
#include <queue>
#include <numeric>
#include <deque>
#include <cstring>
#include <iterator>
#include <map>
#include <cstdlib>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <complex>
#include <bitset>
#include <chrono>
#include <random>
#include <assert.h>

using namespace std;

#define pb push_back
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define eb emplace_back
#define el '\n'
typedef  long long  ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
typedef vector<ll> vll;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<pll> vpll;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef vector<bool> vb;


//const int mod=1000000007;
//const int mod=998244353;



struct node{
    ll s,w,v;
    bool inline operator < (const node &a) const{return this->s+this->w<a.s+a.w;}
};


int main()
{   ios_base::sync_with_stdio(false);cin.tie(NULL);
    ll t,n,m,k,q,x,a,b,c,y,l,r;
    cin >> n;
    vector<node> v(n);
    for(int i=0; i<n; i++){
        cin >> v[i].w >> v[i].s >> v[i].v;
    }
    sort(all(v));
    m=30000;
    vll dp(m,0);
    for(int i=0; i<n; i++){
        for(int j=(int)v[i].s; j>=0; j--){
            assert(j+v[i].w<m);
            dp[j+v[i].w]=max(dp[j+v[i].w],dp[j]+v[i].v);
        }
    }
    cout << *max_element(all(dp)) << el;
    return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
using namespace std;
typedef long long ll;
typedef pair<int, int> P; 
const int inf = 1<<21;
const ll INF = 1LL << 60;
const ll mod = 1e9+7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    int q;
    cin >> q;
    int now = 0;
    rep(i, q){
        int t;
        cin >> t;
        if (t==1){
            now = (now+1)%2;
        }else{
            int f;
            cin >> f;
            string c;
            cin >> c;
            if (f-now==1){
                s.insert(0, c);
            }else{
                s.insert(s.size(), c);
            }
        }
    }
    if (now) reverse(s.begin(), s.end());
    cout << s << endl;
    return 0;
}

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

int main(){
    int N;
    cin >> N;
    string S;
    cin >> S;
    if(N%2==1){
        cout << "No" <<endl;
        return 0;
    }

    else{
        int a =0;
        for(int i=0;i<N/2;i++){
            if(S[i]!=S[N/2+i]) a++;
        }
        if(a>0) cout << "No" <<endl;
        else cout << "Yes" <<endl;

        return 0;
    }
}

Measured memory_bytes: 256
#include<stdio.h>
#include<ctype.h>
int main(void){
	char a;
	while(1){
		scanf("%c",&a);
		if(isupper(a)!=0){
			a=tolower(a);
			printf("%c",a);
		}else if(islower(a)!=0){
			a=toupper(a);
			printf("%c",a);
		}else printf("%c",a);
		if(a=='\n')break;
	}
	return 0;
}



Measured memory_bytes: 2056
import std.stdio,std.string,std.conv,std.array;
void main(){
	int[4][] data;
	for(int i=0;;i++){
		auto rd = readln().chomp();
		if(rd){
			data.length = i+1;
			auto abcd = split(rd);
			data[i][0] = to!int(abcd[0]);
			data[i][1] = to!int(abcd[1]);
			data[i][2] = to!int(abcd[2]);
			data[i][3] = to!int(abcd[3]);
		}else{
			break;
		}
	}
	for( int i=0;i<data.length;i+=2 ){
		int hit=0;
		if( data[i][0] == data[i+1][0] ){	hit+=1;	}
		if( data[i][1] == data[i+1][1] ){	hit+=1;	}
		if( data[i][2] == data[i+1][2] ){	hit+=1;	}
		if( data[i][3] == data[i+1][3] ){	hit+=1;	}
		write( hit , " " );
		int blow=0;
		if( data[i][0] == data[i+1][1] ){	blow+=1;	}
		if( data[i][0] == data[i+1][2] ){	blow+=1;	}
		if( data[i][0] == data[i+1][3] ){	blow+=1;	}
		
		if( data[i][1] == data[i+1][0] ){	blow+=1;	}
		if( data[i][1] == data[i+1][2] ){	blow+=1;	}
		if( data[i][1] == data[i+1][3] ){	blow+=1;	}

		if( data[i][2] == data[i+1][0] ){	blow+=1;	}
		if( data[i][2] == data[i+1][1] ){	blow+=1;	}
		if( data[i][2] == data[i+1][3] ){	blow+=1;	}
		
		if( data[i][3] == data[i+1][0] ){	blow+=1;	}
		if( data[i][3] == data[i+1][1] ){	blow+=1;	}
		if( data[i][3] == data[i+1][2] ){	blow+=1;	}
		writeln( blow );
	}
}

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


int arr[100005];
int dp[100005][3];
const int INF = 1e9;

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

  for(int i=1;i<=n;i++)
  {
    for(int j=0;j<3;j++)
    {
      cin>>x;
      for(int k=0;k<3;k++)
        if(j != k)
        {
          dp[i][j] = max(dp[i][j], dp[i-1][k] + x);
        }
    }
  }
  cout<<max(dp[n][0], max(dp[n][1], dp[n][2]))<<endl;
  return 0;
}


Measured memory_bytes: 1408
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>

using namespace std;


int main() {
    string s;
    cin>>s;
    int n = s.length();
    int a[26] = {0};
    for (int i=0; i<n; i++) a[s[i] - 'a']++;
    long long ans = (long long)n * (n - 1) / 2 + 1;
    for (int i=0; i<26; i++) ans -= (long long)a[i] * (a[i] - 1) / 2;
    cout<<ans<<endl;
}

Measured memory_bytes: 640
while True:
    try:
        dataset = input()
    except:
        break
    flag = True
    for i in range(10):
        sequence = dataset.replace("=", "+").split("+")
        if i == 0 and any([True if seq[0]=="X" and len(seq) >= 2 else False for seq in sequence]):
            continue
        a, b, c = map(int, [seq.replace("X", str(i)) for seq in sequence])
        if a+b == c:
            print(i)
            flag = False
            break
    if flag:
        print("NA")

Measured memory_bytes: 7584
#include<bits/stdc++.h>
using namespace std;
inline int rd(char c[]){
  int i, sz=0;
  for(;;){
    i = getchar_unlocked();
    if(i!=' '&&i!='\n'&&i!='\r'&&i!='\t'&&i!=EOF){
      break;
    }
  }
  c[sz++] = i;
  for(;;){
    i = getchar_unlocked();
    if(i==' '||i=='\n'||i=='\r'||i=='\t'||i==EOF){
      break;
    }
    c[sz++] = i;
  }
  c[sz]='\0';
  return sz;
}
inline void wt_L(char a){
  putchar_unlocked(a);
}
inline void wt_L(const char c[]){
  int i=0;
  for(i=0;c[i]!='\0';i++){
    putchar_unlocked(c[i]);
  }
}
char C[2][5];
int main(){
  int i, res=1;
  {
    int Lj4PdHRW;
    for(Lj4PdHRW=0;Lj4PdHRW<2;Lj4PdHRW++){
      rd(C[Lj4PdHRW]);
    }
  }
  for(i=0;i<3;i++){
    if(C[0][i] != C[1][2-i]){
      res = 0;
    }
  }
  if(res){
    wt_L("YES");
    wt_L('\n');
  }
  else{
    wt_L("NO");
    wt_L('\n');
  }
  return 0;
}
// cLay varsion 20190721-1

// --- original code ---
// char C[2][5];
// {
//   int i, res = 1;
//   rd(C(2));
//   rep(i,3) if(C[0][i] != C[1][2-i]) res = 0;
//   wt( if[ res, "YES", "NO" ] );
// }


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm> 
#include <functional>	
using namespace std;

int main() {
	int a;
	cin >> a;
	if (a == 3 || a == 5 || a == 7) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}



	return 0;
}


Measured memory_bytes: 256
import math

def main():
  X = int(input())

  if X == 2: return 2
  if X == 3: return 3
  if X == 4 or X == 5: return 5
  if X == 6 or X == 7: return 7
  if X == 8: return 11

  while True:
    if X % 2 != 0:
      for i in range(3, int(math.sqrt(X))+1, 2):
        if X % i == 0: break
      else: return X
    X += 1

ans = main()
print(ans)

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

#define rep(i, a, b) for(int i = (a); i < int(b); ++i)
#define rrep(i, a, b) for(int i = (a) - 1; i >= int(b); --i)
#define trav(it, v) for(auto &it : (v))
#define all(v) (v).begin(), (v).end()
#define what_is(x) cerr << #x << " is " << x << endl;
#define sz(x) (int)(x).size()

typedef double fl;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;

vector<int> inadj[2000];
vector<int> outadj[2000];
int OFFSET = 1000;
bool vis[2000];

void dfs(int node){
	if(vis[node])
		return;
	vis[node]=1;
	for(auto i : outadj[node])
		dfs(i);
}

int main(){
	ios::sync_with_stdio(0);
	int N, H;
	cin >> N >> H;
	rep(i,0,N){
		int A, B, C, D;
		cin >> A >> B >> C >> D;
		int from, to;
		if(C){
			from = C;
		}
		else{
			from = OFFSET+A;
		}
		if(D){
			to = OFFSET+D;
		}
		else{
			to = B;
		}
		outadj[from].push_back(to);
		inadj[to].push_back(from);
	}
	rep(i,0,1000){
		if(outadj[i].size() > inadj[i].size()){
			cout << "NO" << endl;
			return 0;
		}
		if(outadj[OFFSET+i].size() < inadj[OFFSET+i].size()){
			cout << "NO" << endl;
			return 0;
		}
	}
	/*vector<int> add1;
	vector<int> add2;
	rep(i,OFFSET,OFFSET*2){
		if(sz(outadj[i]) < sz(inadj[i])){
			rep(j,0,sz(inadj[i])-sz(outadj[i]))
				add1.push_back(i);
		}
	}
	rep(i,0,OFFSET){
		if(sz(outadj[i]) > sz(inadj[i])){
			rep(j,0,sz(outadj[i])-sz(inadj[i]))
				add2.push_back(i);
		}
	}
	if(sz(add1) != sz(add2)){
	}*/
	/*int starts = 0, stops = 0;
	int start = 0;
	rep(i,0,2000){
		int x = (int)inadj[i].size();
		int y = (int)outadj[i].size();
		if(x == y)
			continue;
		if(abs(x-y) > 1){
			cout << "NO" << endl;
			return 0;
		}
		if(x == y+1){
			if(i >= OFFSET){
				cout << "NO" << endl;
				return 0;
			}
			++stops;
		}
		else{
			if(i < OFFSET){
				cout << "NO" << endl;
				return 0;
			}
			start = i;
			++starts;
		}
	}
	if(starts > 0){
		cout << "NO" << endl;
		return 0;
	}
	dfs(start);*/
	rep(i,OFFSET,2000){
		if(sz(inadj[i]) < sz(outadj[i])){
			dfs(i);
		}
	}
	rep(i,0,2000){
		if(vis[i])
			continue;
		if(inadj[i].empty())
			continue;
		if(outadj[i].empty())
			continue;
		cout << "NO" << endl;
		return 0;
	}
	cout << "YES" << endl;
}

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

    // 二次元ベクターの基本
    /*
    vector<vector<int>> dp; // 宣言
    dp.resize(n); // 1次元めの要素数決定
    dp[i].push_back(int); // プッシュバック
    rep(i,n){
        sort(dp[i].begin(),dp[i].end()); // 二次元めを昇順ソート
    }
    */

    // 整数スキャン（複数）
    /*
    int x,y,z;
    scanf("%d%d%d",&x,&y,&z);

    // n個の整数のスキャン
    /*
    ll a[n] = {};
    rep(i,n){
        scanf("%lld",&a[i]);
    }
    */

    // 文字列スキャン
    /*
    string s; cin >> s;
    */

    // n個の文字列スキャン
    /*
    vector<string> slist;
    rep(i,n){
        string s; cin >> s;
        slist.push_back(s);
    }
    */

int main() {
    int n;
    cin >> n;
    ll a[n] = {};
    ll b[n] = {};
    int t,ma,e,mi;
    rep(i,n){
        scanf("%lld%lld",&a[i],&b[i]);
        if(i==0){
            ma = b[i];
            mi = b[i];
            t = a[i];
            e = a[i];
        }
        if(ma<b[i]){
            ma = b[i];
            t = a[i];
        }
        if(b[i]<mi){
            mi = b[i];
            e = a[i];
        }
    }


    ll ans = e+mi;
    
    cout << ans << endl;
    return 0;
}
 
 


Measured memory_bytes: 1792
import java.util.Scanner;

public class Main {

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

    int N = sc.nextInt();
    int M = sc.nextInt();
    int[] s = new int[M];
    int[] c = new int[M];

    for (int i = 0; i < M; i++) {
      s[i] = sc.nextInt();
      c[i] = sc.nextInt();
    }

    int begin = (int)Math.pow(10, N - 1);
    if (begin == 1) begin = 0;
    int end = (int)Math.pow(10, N);

    for (int n = begin; n < end; n++) {
      String str = String.valueOf(n);
      boolean f = true;
      for (int i = 0; i < M; i++) {
        if (Integer.parseInt(str.substring(s[i] - 1, s[i])) != c[i]) {
          f = false;
          break;
        }
      }
      if (f) {
        System.out.println(str);
        return;
      }
    }

    System.out.println("-1");

    sc.close();
  }
}

Measured memory_bytes: 21332
#include <stdio.h>
	#include <iostream>
	#include <vector>
	#include <algorithm>
	using namespace std;
	typedef long long ll;
	typedef std::vector<ll> lls;
	#define MIN(a, b) ( ((a)<(b)) ? (a) : (b) )
	#define MAX(a, b) ( ((a)>(b)) ? (a) : (b) )

	void cinv(lls& llVec, ll n) {
		ll val;
		llVec.reserve((size_t)(n));
		for (ll i = 0; i < n; i++) {
			cin >> val;
			llVec.push_back(val);
		}
	}


	int main()
	{
		ll N;
		lls B;

		cin >> N;
		cinv(B, N-1);
		lls A(N);

		A[0] = B[0]; 
		A[N - 1] = B[N - 2];

		for (int i = 1; i <= N - 2; i++) {
			A[i] = MIN(B[i - 1], B[i]);
		}

		int sum = 0;
		for (auto aOne : A) {
			sum += aOne;
		}

		cout << sum << '\n';

		return 0;
	}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
int h,w,k;
cin >> h >> w >> k;
char a[h][w];int cnt = 0;
for(int i = 0;i<h;i++){
    for(int j = 0;j<w;j++){
    cin >> a[i][j];
    if(a[i][j]=='#')cnt++;}}
    int ans = 0;
for(int y = 0;y<(1<<h);y++){
    bool b[h][w];
    memset(b,0,sizeof(b));
    int num = cnt;
    int tem = y;
    int idx = 0;
    while(tem){
        if(tem&1){
            for(int j = 0;j<w;j++){
                if(a[idx][j] =='#') {num--;b[idx][j] = 1;}
            }
        }
        idx++;
        tem /= 2;}
        for(int x = 0;x<(1<<w);x++){
                int temp = x;int te = num;
    int idy = 0;
    while(temp){
        if(temp&1){
            for(int i = 0;i<h;i++){
                if(a[i][idy] =='#'&&b[i][idy]==0) {num--;}
            }
        }
        idy++;
        temp /= 2;
    }
if(num==k) ans++;
num = te;
    }
}
cout << ans;
return 0;
}

Measured memory_bytes: 3600
/**

   Author : sea_26

**/


#pragma GCC optimize("03")
#include <bits/stdc++.h>

using namespace std;

const int M = 1000000007;
const double PI = acos(-1.0);

// const double pi = atan2(0, -1);
// const double PI = 4 * atan(1);
// const double pi = 2*cos(0.0);

typedef long long ll;
typedef long double ld;

const int iinf = 0x3f3f3f3f;
const ll linf = 0x3f3f3f3f3f3f3f3f;

#define mp make_pair
#define pb push_back
#define f first
#define s second
#define ln(x) (int)x.size()

#define bp(n)  __builtin_popcount(n)
#define bclz(n) __builtin_clzll(n)
#define bctz(n) __builtin_ctzll(n)
#define bip(n) __builtin_parity(n)

#define vsort(v) sort(v.begin(),v.end())
#define rvsort(v) sort(v.begin(),v.end(),greater<int>())

#define rep(n) for(int i=0; i<n; i++)
#define rrep(n) for(int i=n-1; i>=0; i--)
#define lrep(p,q) for(int i=p; i<=q; i++)
#define prep(n) for(int i=1; i*i<=n; i++)
#define it(a, x)  for(auto &a : x)
#define yes cout << "YES" << endl
#define no cout << "NO" << endl

//priority_queue<int> pq;

#define fs   ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);

template< typename T> inline T lcm(T a, T b){ return (a / gcd(a,b)) * b; }
template< typename T> inline T MAX(T a, T b){ return a ^ ((a ^ b) & -(a < b)); }
template< typename T> inline T MIN(T a, T b){ return b ^ ((a ^ b) & -(a < b)); }
//template< typename T> void tpns(T n){ rrep(30){ if(n & (1 << i)) pq.push(1 << i); } }
template< typename T> void SWAP(T &a, T &b){ a = ((a) ^= (b)),  b = ((b) ^= (a)),  a = ((a) ^= (b)); }
template< typename T> inline T ABS(T a){ int x = a >> sizeof(int) * CHAR_BIT - 1; return (a + x) ^ x; }
template< typename T> inline T mod(T a, T b){ return a >= b ? a % b : a; }
template< typename T> inline T gcd(T a, T b){ while (b) b ^= a ^= b ^= a %= b; return a; }
/*
ll gcdextd(ll a, ll b, ll& x, ll& y) {
    if (!a) { x = 0; y = 1; return b; }
    ll y1,d;
    d = gcdextd(b % a, a, y, y1);
    x = y1 - (b / a) * y;
    return d;
}

*/
/*
double WT() {
	return double(clock()) / CLOCKS_PER_SEC;
}

void ReT(){

	cout << "\nTime = " << fixed << setprecision(3) << WT()  << " Sec"<< endl;

exit(0);
}

*/


int A,B,T;
int main(){

        fs;
        cin >> A >> B >> T;
        cout << T/A * B << endl;

     //   ReT();

}


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

#define ll long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define sc(x) scanf("%lld",&x)
#define pr(x) printf("%lld\n",x)
#define clr(x) memset(x, 0, sizeof(x))
#define all(x) x.begin(), x.end()
typedef pair<ll, ll> pii;
typedef vector< ll > vl;
typedef vector< pii > vpii;

//DONT WASTE YOUR TIME
//prove yourself
//remember....fuck ps&&as hard....show them your are better then them
//Be confident.....dont lose hope.......You can do it.....
//dimaag  khoob h tere meh ....bas concentration ki kami h
//CONCENTRATE
//A,B,C dimaag nhi ...observation h .....zyaada mat sochna unme.....bas observe karna dhyaan se aur implement kar daal jitni jaldi ho sake

//capture it

const ll N= 1e6+55,mod = 1e9+7;

int main() {
 	//freopen("task.in","r",stdin);freopen("task.out","w",stdout);
	ll i,j,k,a,b,f,c,x,y,z,n;
	sc(n);sc(y);
	b=c=0;
	z=10000;
	j=y;
	while(1){
		//if(b>2000)break;
		j=y;
		j-=b*5000;
		f=j;
		//cout<<b<<" ";
		if(j<0)break;
		c=0;
		while(1){
			j=f;
			j-=c*1000;
			if(j<0)break;
			if((j%z)==0){
				i=j/z;
				if((i+b+c)==n){
				printf("%lld %lld %lld\n",i,b,c);
				return 0;
				}
			}
			c++;
		}
		b++;
	}	
	printf("-1 -1 -1\n");
}

Measured memory_bytes: 256
N = input()
F = [map(int, raw_input().split()) for _ in range(N)]
P = [map(int, raw_input().split()) for _ in range(N)]
ans = -10**100
for b in range(1,2**10):
  a = 0
  for i in range(N):
    c = 0
    for j in range(10):
      c += int(b>>j&1 and F[i][j])
    a += P[i][c]
  ans = max(ans, a)
print ans


Measured memory_bytes: 2692
#include <bits/stdc++.h>
#define ll long long
#define REV(v) reverse(v.begin(), v.end());
#define REP(i, n) for (ll i = 0; i < n; i++)
#define REPR(i, n) for (ll i = n; i >= 0; i--)
#define FOR(i, start, stop) for (ll i = start; i < stop; i++)
#define FORR(i, start, stop) for (ll i = start; i > stop; i--)
#define SORT(v, n) sort(v, v + n);
#define SORTR(v, n) sort(v, v + n,greater<ll>());
#define VSORT(v) sort(v.begin(), v.end());
#define VSORTR(v) sort(v.begin(), v.end(),greater<ll>());
#define REMOVE(v,n) remove(vector<ll> v,v+v.size(),ll n)
#define ERASE(v,n) v.erase(v.begin()+n);
#define ull unsigned long long
#define pb(a) push_back(a)
#define INF 999999999
#define V(v,i,j) vector(v.begin() + i, v.begin() + j)
#define INSERT(va,vb) va.insert(va.end(), vb.begin(), vb.end())
using namespace std;
typedef vector<ll> vll;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;
int dy[] = {0, 0, 1, -1};
int dx[] = {1, -1, 0, 0};
const int MOD = 1000000007;
void chmin(int &a, int b) { if (a > b) a = b; }

//vector< vector<int> > v (size1, vector<int>(size2) );



int main(){
    string al="abcdefghijklmnopqrstuvwxyz";
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    ll K;
    cin>>s>>K;
    ll N=s.size();
    vector<int> S(N);
    char c;
    FOR(i,0,N){
        S[i]=(int)s[i]-97;
    }
    
    /*FOR(i,0,N){
        cout<<S[i]<<endl;
    }*/
   
    FOR(i,0,N){
        if(S[i] && 26-S[i]<=K){
            K-=26-S[i];
            S[i]=0;
        }
        //cout<<K<<' ';
    }
    
    if(K%26>0) S[N-1]+=K%26;

    FOR(i,0,N){
        cout<<al[S[i]];
        //cout<<i<<endl;
        
    }
    

    return 0;
}

Measured memory_bytes: 976
#include <iostream>
#include <iomanip>
#include <queue>
#include <vector>
using namespace std;

#define M_MAX 100000
int N,M,P,Y;
//city[i]:市iが属している県番号[0],順番[1]
int city[M_MAX+1][2]={0};

//YI:<year,city i>
typedef pair<int,int> YI;
//Pre[i]:県iに属する市のqueue
priority_queue<YI,vector<YI>,greater<YI>> pre[M_MAX+1];

int main(){
  int i,k;
  
  //入力処理
  cin >> N >> M;
  for(i=1;i<=M;i++){
    cin >> P >> Y;
    city[i][0]=P;
    pre[P].push(make_pair(Y,i));
  }
  
  //順番割り当て処理
  for(i=1;i<=N;i++){
   for(k=1;!pre[i].empty();k++){
      city[pre[i].top().second][1]=k;
      pre[i].pop();
    }
  }
  
  //出力処理
  for(i=1;i<=M;i++){
    cout << setw(6) << setfill('0') << city[i][0] 
         << setw(6) << setfill('0') << city[i][1] << endl;
  }
  
  return 0;
}

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

using namespace std;

int main() {
	string S;
	cin >> S;
	int first = (S[0] - '0')*10 + (S[1] - '0');
	int second = (S[2] - '0')*10 + (S[3] - '0');
	if(first > 0 && first <= 12) {
		if(second > 0 && second <= 12)
			cout << "AMBIGUOUS";
		else cout << "MMYY";
	} else {
		if(second > 0 && second <= 12)
			cout << "YYMM";
		else cout << "NA";
	}
		
	
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define ll          long long
#define fio         ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pb          push_back
#define vi          vector<ll>
#define pp          push_pop
#define pll         pair<ll,ll>
#define in          insert
#define ini(a,n)    memset(a,n,sizeof(a))
#define ff          first
#define ss          second
#define inf         10000000000000000
#define all(p)      p.begin(), p.end()
#define que_max     priority_queue <int>
#define que_min     priority_queue <int, vi, greater<int>>
#define print(a)    for(auto i:a){cout<<i<<" ";}
#define print1(a)   for(auto i:a){cout<<i.ff<<" "<<i.ss<<endl;}

typedef tree<pll, null_type, less<pll>, rb_tree_tag, tree_order_statistics_node_update> Set;
unordered_map<ll,vi> g;
unordered_map<ll,ll> vis;

const ll mod = 1e9+7;

ll power(ll x,ll y,ll p){ll r=1;x=x%p;while(y>0){if(y&1)r=(r*x)%p;y=y>>1;x=(x*x)%p;}return r;}
const ll N = 2e5+10;
ll dx[4]={-1, +1, 0, 0};
ll dy[4]={0, 0, +1, -1};
bool imp = false;
bool isPowerOfTwo (ll x)
{
    return x && (!(x&(x-1)));
}


void solve() {


    string s;cin>>s;
    for(ll i=0;i<s.size();i++)
        cout<<"x";


}

int main()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
#endif

    fio
    int t=1;
    if(imp) cin>>t;

    while(t--)
    {
        // cout<<"Case #"<<tc<<": ";
        g.clear();
        vis.clear();
        solve();
        // tc++;
    }

}


Measured memory_bytes: 3664
h, w = map(int, input().split())

mtx = [input() for _ in range(h)]

ret_mtx1 = [[0] * w for _ in range(h)]
ret_mtx2 = [[0] * w for _ in range(h)]
ret_mtx3 = [[0] * w for _ in range(h)]
ret_mtx4 = [[0] * w for _ in range(h)]

# left 2 right
for i in range(h):
    for j in range(w):
        if mtx[i][j] == '.':
            ret_mtx1[i][j] = 1 if i == 0 else ret_mtx1[i-1][j] + 1
            ret_mtx2[i][j] = 1 if j == 0 else ret_mtx2[i][j-1] + 1
        if mtx[-1-i][-1-j] == '.':
            ret_mtx3[-1-i][-1-j] = 1 if i == 0 else ret_mtx3[-i][-1-j] + 1
            ret_mtx4[-1-i][-1-j] = 1 if j == 0 else ret_mtx4[-1-i][-j] + 1

ret = 0

for i in range(h):
    for j in range(w):
        tmp = ret_mtx1[i][j] + ret_mtx2[i][j] + \
            ret_mtx3[i][j] + ret_mtx4[i][j] - 3
        ret = max(ret, tmp)

print(ret)


Measured memory_bytes: 181380
//080B
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; i++)

using namespace std;
int main(void){
    int n,r=0, copy=0;
    cin >> n;
    copy = n;
    while(true){
        //cout << n%10 << endl;
        r += n%10;
        n = n/10;
        if (n==0) break;
    }
    if(copy%r==0){
        cout << "Yes" << endl;
    }else cout << "No" << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<math.h>
#include<algorithm>
#include<cmath>
#include<iomanip>
#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;
typedef long long ll;
ll ans = 1;
int main() {
	ll N, P;
	cin >> N >> P;
	if (N == 1) {
		cout << P << endl;
	}
	else {
		for (ll i = 1; pow(i, N) <= P; i++) {
			if (P % (ll)pow(i, N) == 0) ans = i;
		}
		cout << ans << endl;
	}
	return 0;
}



Measured memory_bytes: 384
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast","-funroll-loops","-fdelete-null-pointer-checks")
#pragma GCC target("ssse3","sse3","sse2","sse","avx2","avx")
using namespace std;

const int N = 3030, MOD = 998244353;
int n, s, a[N];
int ways[N];
int add(int a, int b) {
  return a + b >= MOD ? a + b - MOD : a + b;
}
int main() {
  scanf ("%d%d", &n, &s);
  for (int i = 1; i <= n; ++i) scanf ("%d", &a[i]);

  int ans = 0;
  for (int i = 1; i <= n; ++i)
  {
    for (int j = s; j >= a[i]; --j) ways[j] = add(ways[j], ways[j - a[i]]);
    ways[a[i]] = add(ways[a[i]], i);
    ans = add(ans, ways[s]);
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
)

var bufin *bufio.Reader
var bufout *bufio.Writer

func reverse(S string) string {
	runes := []rune(S)
	for i, j := 0, len(runes)-1; i < j; i, j = i+1, j-1 {
		runes[i], runes[j] = runes[j], runes[i]
	}
	return string(runes)
}
func solve(S string) int {
	c := S[0]
	ret := 0
	for i := 1; i < len(S); i++ {
		if c != S[i] {
			ret += 1
			c = S[i]
		}
	}
	return ret
}

func main() {
	bufin = bufio.NewReader(os.Stdin)
	bufout = bufio.NewWriter(os.Stdout)
	defer bufout.Flush()
	var S string
	fmt.Fscanf(bufin, "%s\n", &S)
	a := solve(S)
	T := reverse(S)
	b := solve(T)
	if a > b {
		a = b
	}
	fmt.Fprintf(bufout, "%d\n", a)
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#include <algorithm>
#include <stack>
using namespace std;
int main(){
	string S; 
	cin >> S; 
	int N = S.size(); 
	bool possible = true; 
	if(S.at(0) == '0' || S.at(N-2) == '0' || S.at(N-1) == '1') possible = false; 
	for(int i = 0; i * 2 <= N-2; i++){
		if(S.at(i) != S.at(N-2-i)) possible = false; 
	}
	if(!possible) cout << -1 << endl; 
	else{
		vector<int> A; 
		for(int i = 0; i < N-1; i++){
			if(S.at(i) == '1') A.push_back(i+1); 
		}
		A.push_back(N); 
		int M = A.size(); 
		for(int i = 0; i < M-1; i++){
			for(int j = A.at(i); j < A.at(i+1); j++){
				cout << j << " " << A.at(i+1) << endl; 
			}
		}
	}
}

Measured memory_bytes: 2040
#include <stdio.h>
#define rep(i, a, b) for(int i = (a); i < (b); ++i)

void sort(int arr[], size_t s){
    for(int i = 0; i < s; i++){
        for(int j = 0; j < s - 1; j++){
            int mn, mx;
            if(arr[j] >= arr[j + 1]){
                mx = arr[j];
                mn = arr[j + 1];
            }else{
                mx = arr[j + 1];
                mn = arr[j];
            }
            arr[j] = mn;
            arr[j + 1] = mx;
        }
    }
}

int main(){
    int A[3];
    rep(i, 0, 3) scanf("%d", &A[i]);
    sort(A, sizeof(A) / sizeof(A[0]));
    rep(i, 0, 2) printf("%d ", A[i]);
    printf("%d\n", A[2]);

    return 0;
}



Measured memory_bytes: 2036
def search(arr, v, l, r)
  if l == r
    if v <= arr[l]
      return l
    else
      return l + 1
    end
  elsif v <= arr[l + (r - l) / 2]
    return search(arr, v, l, l + (r - l) / 2)
  else
    return search(arr, v, l + (r - l) / 2 + 1, r)
  end
end

loop do
  n, q = gets.split.map(&:to_i)
  break if n == 0
  era = {}
  n.times do
    name, ey, wy = gets.split
    era[wy.to_i] = [name, ey.to_i]
  end
  era = era.sort
  q.times do
    y = gets.to_i
    k = era.transpose[0]
    v = era.transpose[1]
    x = search(k, y, 0, n - 1)
    if x != n && k[x] - y < v[x][1]
      puts "#{v[x][0]} #{v[x][1] - (k[x] - y)}"
    else puts "Unknown"
    end
  end
end

Measured memory_bytes: 57068
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>

// output
#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
// utility
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
template<class T> inline T chmax(T & a, const T b) { return a = (a < b) ? b : a; }
template<class T> inline T chmin(T& a, const T b) { return a = (a > b) ? b : a; }

// type/const
#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
/* const int MOD = 998244353; */
const int INF = 1e18;
const double PI = acos(-1);

using namespace std;


signed main() {
  int N; 
  cin >> N;

  vector<vector<int>> A(N, vector<int>(N-1));
  REP(i, N) REP(j, N-1){
    cin >> A[i][j];
    A[i][j]--;
  }

  int ans = 0;
  vector<int> cnt(N, 0);
  vector<bool> ok(N, false);
  vector<int> vec(N);
  REP(i, N) vec[i] = i;
  while(1){
    bool flag = false;
    fill(ALL(ok), false);
    vector<int> now;
    for(auto i : vec){
      if(cnt[i] == N-1) continue;
      int j = A[i][cnt[i]];
      if(cnt[j] == N-1) continue;
      if(ok[i]) continue;
      if(ok[j]) continue;

      if(A[j][cnt[j]] == i){
        now.emplace_back(i);
        now.emplace_back(j);
        cnt[i]++; cnt[j]++;
        ok[i] = true; ok[j] = true;
        flag = true;
      }
    }

    vec = now;
    if(!flag) break;
    ans++;
  }

  REP(i, N) if(cnt[i] != N-1) ans = -1;
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 8064
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CSharp_AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            int r = int.Parse(Console.ReadLine());

            Console.WriteLine(r * r);

        }
    }
}


Measured memory_bytes: 13140