akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
using namespace std;
// typedef tree<pair<int,int>, null_type, less<pair<int,int>>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
#define ll long long 
#define scn(n) scanf("%d",&n)
#define lscn(n) scanf("%lld",&n)
#define lpri(n) printf("%lld",n)
#define pri(n) printf("%d",n)
#define pln() printf("\n")
#define priln(n) printf("%d\n",n)
#define lpriln(n) printf("%lld\n",n)
#define rep(i,init,n) for(int i=init;i<n;i++)
#define pb push_back     
#define mp make_pair
#define F first
#define S second
#define gcd __gcd
#define inf INT_MAX
#define ninf INT_MIN
const int mod=1e9+7;         
const int N=1e5+4;

int main()
{
	int n; scn(n); ll d; lscn(d); d*=d;

	int ans=0;

	rep(i,0,n)
	{
		int x,y; scn(x); scn(y);

		ll here= 1LL*x*x + 1LL*y*y;

		if(here<=d)
		ans++;
	}

	pri(ans);

	return 0;
}

Measured memory_bytes: 3752
#include<bits/stdc++.h>
using namespace std;
#define all(vec) vec.begin(),vec.end()
typedef long long int ll;
typedef pair<int,int> P;
const ll MOD=1000000007;
const ll INF=1000000010;
const ll LINF=4000000000000000010LL;
const int MAX=310;
const double EPS=1e-9;
int dx[4]={0,1,0,-1};
int dy[4]={1,0,-1,0};
int main(){
    int n;cin>>n;
    cout<<n*(n+1)/2<<endl;
}


Measured memory_bytes: 256
import heapq
n=int(input().strip())
nu=list(map(int, input().strip().split()))
nu1=[]
nu2=[]
nu1memo=[0]*100001
nu2memo=[0]*100001
for i in range(0,n//2):
    nu1.append(nu[2*i])
    nu2.append(nu[2*i+1])
    nu1memo[nu[2*i]]+=1
    nu2memo[nu[2*i+1]]+=1
    
#mi1=max(zip(nu1memo, range(len(nu1memo))))[1]
mi1=heapq.nlargest(2, range(len(nu1memo)), key=nu1memo.__getitem__)
#mi2=max(zip(nu2memo, range(len(nu2memo))))[1]
mi2=heapq.nlargest(2, range(len(nu2memo)), key=nu2memo.__getitem__)
ans=0
if mi1[0]!=mi2[0]:
    ans=n-nu1memo[mi1[0]]-nu2memo[mi2[0]]
elif mi1[0]==mi2[0]:
    ans=min(n-nu1memo[mi1[0]]-nu2memo[mi2[1]],n-nu1memo[mi1[1]]-nu2memo[mi2[0]])
    
print(ans)

Measured memory_bytes: 14764
#define _DEBUG 1
#define _GLIBCXX_DEBUG

#include <bits/stdc++.h>
using namespace std;

using ll = long long;

#ifdef _DEBUG
#define dump(x) cerr << #x << "=" << x << endl
#define dump2(x, y) cerr << #x << "=" << x << "," << #y << "=" << y << endl
#define dump3(x, y, z)                                                     \
  cerr << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z \
       << endl
#define check(s) cerr << s << endl
#else
#define dump(x)
#define dump2(x, y)
#define dump3(x, y, z)
#define check(s)
#endif

#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define unique(v) v.erase(unique(v.begin(), v.end()), v.end());

const ll LINF = 2e18;
const int INF = 1e9;

void solve(ll K, std::string S) {
  if (S.size() <= K) {
    cout << S << endl;
  } else {
    cout << S.substr(0, K) << "..." << endl;
  }
}

int main() {
  ll K;
  scanf("%lld", &K);
  std::string S;
  std::cin >> S;
  solve(K, S);
  return 0;
}


Measured memory_bytes: 3696
#include <stdio.h>

int main(){

int i,j,n,q;
int k=0;
 int s[10000];
 int t[500];
  scanf("%d",&n);

  for(i = 0; i < n; i++){
    scanf("%d",&s[i]);
  }

  scanf("%d",&q);

  for(i = 0; i < q; i++){
    scanf("%d",&t[i]);
  }

  for(i = 0; i < q; i++){
    for(j = 0; j < n; j++){
      if(s[j] == t[i]){
    k=k+1;
    break;
      }
    }
  }

  printf("%d\n",k);

  return 0;
}



Measured memory_bytes: 2108
#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <string>
#include <queue>
#include <cmath>
#include <numeric>
#include <list>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <climits>
#include <set>
#include <memory.h>
#include <memory>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cassert>
#include <map>
#include <cassert>
#include <time.h>
#define _USE_MATH_DEFINES
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef pair<int, P> PP;
typedef pair<string, map<string, int> > Ps;
typedef vector<int> vec;
typedef vector<vec> mat;
const int INF = 1 << 30;
const double EPS = 1e-9;

bool isprime[100000];
int nums[100000];
ll pow(int p, int n){
	ll res = 1;
	for(int i = 0; i < n; i++){
		res *= p;
	}
	return res;
}

int main(){
	fill(isprime, isprime + 100000, true);
	isprime[0] = isprime[1] = false;
	for(int i = 2; i * i < 100000; i++){
		if(isprime[i])
			for(int j = 2; j * i < 100000; j++){
				isprime[i*j] = false;
			}
	}
	ll n;
	while(cin >> n && n){
		ll n2 = n;
		fill(nums, nums + 100000, 0);
		for(int i = 0; i < 100000; i++){
			if(isprime[i]){
				while(n % i == 0){
					nums[i]++;
					n /= i;
				}
			}
		}
		ll res = 1;
		for(int i = 2; i < 100000; i++){
			res *= (pow(i, nums[i] + 1) - 1) / (i - 1);
		}
		if(n != 1){
			res *= (n + 1);
		}
		res -= n2;
		if(n2 == res){
			cout << "perfect number" << endl;
		}else if(n2 > res){
			 cout << "deficient number" << endl;
		}else{
			cout << "abundant number" << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 1348
#include<bits/stdc++.h>
using namespace std;
int a,b,c,x,ans;
int main(){
	cin>>a>>b>>c;
	cin>>x;
	for(int i=0;i<=a;i++)
	for(int j=0;j<=b;j++)
	for(int k=0;k<=c;k++){
		if(500*i+100*j+50*k==x)
			ans++;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
	ll k,a,b,ans=1,bis=1;
	cin>>k>>a>>b;
	if(b>=a+2){//2回交換
		k-=a-bis;
		ans=a;
		ll cost=k/2;
		ans+=cost*(b-a);
		if(k%2==1)ans++;
	}
	else{
		ans+=k;
	}
	cout<<ans<<endl;

}


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

#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define ALL(a) (a).begin(),(a).end()
#define DEBUG(a) "(" << #a << ": " << (a) << ")"

template<typename T>
void chmin(T &x, T y) { x = min(x, y); }

template<typename T>
void chmax(T &x, T y) { x = max(x, y); }

typedef long long int lli;
typedef long double ld;
typedef tuple<int,int> P;

const int INF = INT_MAX/2 - 1;
const double EPS = 1e-14;
const bool OREWA_MOU_DAMEDA = true;
const int dx[4] = {0, 1, 0, -1}; // {-1,  0,  1, -1, 1, -1, 0, 1};
const int dy[4] = {1, 0, -1, 0}; // {-1, -1, -1,  0, 0,  1, 1, 1};

string str; unsigned int p;

lli Digit() {
  if (isdigit(str[p])) { return str[p++] - '0'; }
  throw OREWA_MOU_DAMEDA;
}

lli Factor() {
  lli lhs = Digit();
  if (p < str.size() && str[p] == '*') {
    p++; // read *
    lli rhs = Factor();
    return lhs * rhs;
  }
  return lhs;
}

lli Expr() {
  lli lhs = Factor();
  if (p < str.size() && str[p] == '+') {
    p++; // read +
    lli rhs = Expr();
    return lhs + rhs;
  }
  return lhs;
}

lli calc_left2right(const string &expr) {
  lli ans = expr[0] - '0';
  REP(i, (expr.size() - 1) / 2) {
    if (expr[2 * i + 1] == '+') {
      ans += expr[2 * i + 2] - '0';
    }
    else if (expr[2 * i + 1] == '*') {
      ans *= expr[2 * i + 2] - '0';
    }
    else {
      throw OREWA_MOU_DAMEDA;
    }
  }
  return ans;
}

char solve(string expr, lli ans) {
  str = expr, p = 0;
  lli m = Expr();
  lli l = calc_left2right(expr);
  if (ans == m && ans == l) { return 'U'; }
  if (ans == m) { return 'M'; }
  if (ans == l) { return 'L'; }
  return 'I';
}

int main() {
  cout << fixed << setprecision(10);
  string str;
  lli ans;
  cin >> str >> ans;
  cout << solve(str, ans) << endl;
  return 0;
}

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

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

using namespace std;
using ll = long long;

void solve();

int main(void){
    int N; string S;
    cin >> N >> S;
    //先頭にいくつ'('を挿入し,末尾にいくつ')'を挿入するかという問題
    int open = 0, close = 0;
    rep(i, N){
        if(S[i] == '('){
            open++;
        }
        else{
            if(open > 0) open--;
            else close++;
        }
    }
    string ans = "";
    rep(i, close) ans += '('; ans += S; rep(i, open) ans += ')';
    cout << ans << endl;
    return 0;
}

void solve(){}

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

using namespace std;
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
constexpr int MOD = 1000000007;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
constexpr int dx[] = {1, 0, -1, 0, 1, 1, -1, -1};
constexpr int dy[] = {0, -1, 0, 1, 1, -1, -1, 1};

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){os << "["; for (const auto &v : vec) {os << v << ","; } os << "]"; return os; }
template <typename T, typename U> ostream &operator<<(ostream &os, const pair<T, U> &p){os << "(" << p.first << ", " << p.second << ")"; return os;}

void solve() {
  int N;
  cin >> N;
  vector<int> A(N), B(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  for (int i = 0; i < N; i++) {
    cin >> B[i];
  }
  vector<int> way(N, -1);
  way[0] = 1;
  way.back() = 1;
  if (A[0] > B[0]) {
    cout << 0 << endl;
    return;
  }
  if (A.back() < B.back()) {
    cout << 0 << endl;
    return;
  }
  for(int i = 0; i < N - 1; i++) {
    if (A[i] < A[i + 1]) {
      way[i + 1] = 1;
      if (A[i + 1] > B[i + 1]) {
        cout << 0 << endl;
        return;
      }
    }
  }

  for(int i = 0; i < N - 1; i++) {
    if (B[i] > B[i + 1]) {
      way[i] = 1;
      if (A[i] < B[i]) {
        cout << 0 << endl;
        return;
      }
    }
  }

  for (int i = 0; i < N; i++) {
    if (way[i] == -1) {
      way[i] = min(A[i], B[i]);
    }
  }

  ll ans = 1;
  const ll mod = 1e9 + 7;
  for (int i = 0; i < N; i++) {
    ans *= way[i];
    ans %= mod;
  }
  cout << ans << endl;

}

int main() {
  std::cin.tie(0);
  std::ios::sync_with_stdio(false);
  cout.setf(ios::fixed);
  cout.precision(16);
  solve();
  return 0;
}

Measured memory_bytes: 1408
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
using namespace std;

int main(){
    int n, m;
    cin >> n >> m;
    vector<int> which_set(n, 0);
    vector<vector<pair<int, int>>> sets(n);
    for(int i = 0, p; i < n; ++i){
        cin >> p;
        --p;
        sets[i].emplace_back(i, p);
        which_set[i] = i; }

    for(int i = 0, x, y; i < m; ++i){
        cin >> x >> y;
        --x, --y;
        x = which_set[x];
        y = which_set[y];
        if(x == y) continue;
        if(sets[x].size() > sets[y].size()) swap(x, y);
        for(auto p : sets[x]){
            which_set[p.first] = y;
            sets[y].push_back(p); }
        sets[x].clear(); }

    int rez = 0;

    for(auto& x : sets){
        vector<int> s1, s2;
        for(auto& y : x)
            s1.push_back(y.first),
            s2.push_back(y.second);

        sort(begin(s1), end(s1));
        sort(begin(s2), end(s2));
        
        vector<int> tmp;
        set_intersection(begin(s1), end(s1),
            begin(s2), end(s2),
            back_inserter(tmp));

        rez += tmp.size(); }

    cout << rez << endl;
    return 0; }


Measured memory_bytes: 15212
def check():
    N = int(input())
    t1,x1,y1 = [0,0,0]
    
    for _ in range(N):
        t2,x2,y2 = [int(i) for i in input().split(' ')]
        x_sub = abs(x1-x2)
        y_sub = abs(y1-y2)
        t_sub = t2 - t1
        t = t_sub - x_sub - y_sub
        if t < 0:
            return 'No'
        else:
            if t % 2 == 0:
                t1 = t2
                x1 = x2
                y1 = y2
            else:
                return 'No'
    return 'Yes'
print(check())

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

int main () {
  int n; cin >> n;
  vector<int> s(n,0);
  int sum = 0;
  for (int i = 0; i < n; i++) {
    cin >> s[i];
    sum += s[i];
  }
  bool ok = 1;
  for (int i = 0; i < n; i++)
    if (s[i] >= sum-s[i])
      ok = 0;
  cout << (ok ? "Yes" : "No") << endl;
  return 0;
}

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

namespace AOJ
{
	class Program
	{
		static void Main(string[] args)
		{
			for (int i = 1; i <= 9; i++)
				for (int j = 1; j <= 9; j++)
					Console.WriteLine("{0}x{1}={2}", i, j, i * j);
		}
	}
}

Measured memory_bytes: 5588
import java.util.Scanner;


public class Main {

	static Scanner scanner=new Scanner(System.in);
	static int n=scanner.nextInt();
	static Node[] nodes=new Node[n];
	 static class Node{
		Node p;
		int left,right;
		int id;
		Node(int id){
			this.id=id;
		}
		void print(){
			System.out.print("node "+this.id+": ");
			System.out.print("parent = "+((this.p==null) ?"-1":p.id)+", ");
			System.out.print("sibling = "+(this.p==null?"-1":(this.p.right!=this.id)?this.p.right:this.p.left)+", ");
			
			int degree=0;
			if(this.left!=-1)
				degree++;
			if(this.right!=-1)
				degree++;
			System.out.print("degree = "+degree+", ");
			
			Node p=this.p;
			int d=0;
			while(p!=null){
				d++;
				p=p.p;
			}
			System.out.print("depth = "+d+", ");
			
			int h=height(this.id);
			System.out.print("height = "+h+", ");
			String string="";
			if(this.p==null)
				string="root";
			else if(degree==0)
				string="leaf";
			else if(degree>=1)
				string="internal node";
			System.out.println(string);
		}
		private  int height(int root) {
			int h1=0,h2=0;
			if(nodes[root].left!=-1)
				h1=height(nodes[root].left)+1;
			if(nodes[root].right!=-1)
				h2=height(nodes[root].right)+1;
			
			return Math.max(h1, h2);
		}
	}
	public static void main(String[] args) {
		// TODO Auto-generated method stub

		
		for(int i=0;i<n;i++){
			nodes[i]=new Node(i);
		}
		for(int i=0;i<n;i++){
			int id=scanner.nextInt();
			int left=scanner.nextInt();
			int right=scanner.nextInt();
			nodes[id].left=left;
			nodes[id].right=right;
			if(left!=-1){
				nodes[left].p=nodes[id];
			}	
			if(right!=-1){
				nodes[right].p=nodes[id];
			}
			
		}
		for(int i=0;i<n;i++){
			nodes[i].print();
		}
	}

}



Measured memory_bytes: 26356
#include <iostream>
#include <algorithm>
#define int long long
using namespace std;
struct edge { int to, from, cost; };
int INF = 1000000000000;
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, m, p;
  cin >> n >> m >> p;

  int a[m], b[m], c[m];
  for(int i = 0; i < m; i++) {
    cin >> a[i] >> b[i] >> c[i];
    a[i]--;
    b[i]--;
  }

  edge es[m];
  for(int i = 0; i < m; i++) {
    es[i] = (edge) { b[i], a[i], p - c[i]};
  }
  int d[n];
  for(int i = 0; i < n; i++) d[i] = INF;
  d[0] = 0;

  bool neg_loop = false;
  for(int i = 0; i < 2 * n; i++) {
    for(int j = 0; j < m; j++) {
      edge e = es[j];
      if(d[e.from] != INF && d[e.to] > d[e.from] + e.cost) {
        d[e.to] = d[e.from] + e.cost;
        if(i >= n - 1 && e.to == n - 1) {
          neg_loop = true;
          break;
        }
      }

    }
  }

  if(neg_loop) {
    cout << -1 << "\n";
    return 0;
  }


  cout << max(0LL, -d[n - 1]) << "\n";
  return 0;
}


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

using namespace std;
//typedef long long ll;
typedef unsigned long long ll;

#define rep(i, n) for (ll i = 0; i < (n); ++i)
//#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) ll(x.size())
//typedef pair<int, int> P;
typedef pair<ll, ll> P;
//const double INF = 1e10;
const ll INF = LONG_LONG_MAX;
const ll MINF = LONG_LONG_MIN;
//const int INF = INT_MAX;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)

bool contain(set<char> &s, int a) { return s.find(a) != s.end(); }


//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);

typedef priority_queue<ll, vector<ll>, greater<ll>> PQ_ASK;
const int mod = 1000000007;

ll gcd(ll x, ll y) {
    if (x < y) swap(x, y);
    if (y == 0) {
        return x;
    }
    return gcd(y, x % y);
}

ll lcm(ll x, ll y) {
    return x * y / gcd(x, y);
}

int main() {
    string s;
    cin >> s;

    int w = 0;
    int l = 0;

    rep(i, s.size()) {
        char t = s[i];
        if (i % 2 == 1) {
            if (t == 'g') w++;
        } else {
            if (t == 'p') l++;
        }
    }

    cout << w - l << endl;

}


Measured memory_bytes: 512
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
namespace AtCoder
{
    class Program
    {
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }

        //static long Mod = (long)1e9 + 7;
        static void Main(string[] args)
        {
            //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            var HW = Sarray();
            var H = HW[0];
            var W = HW[1];
            var N = Sarray()[0];
            var Ai = Sarray();
            var masu = new long[H][];
            for (var i = 0; i < H; ++i)
                masu[i] = new long[W];
            var cnt = 0;
            for (var i = 1; i <= N; ++i)
            {
                var b = cnt;
                for (; cnt < b + Ai[i - 1]; ++cnt)
                    masu[cnt / W][cnt % W] = i;
            }
            for (var i = 1; i < H; i += 2)
                masu[i] = masu[i].Reverse().ToArray();
            for (var h = 0; h < H; ++h)
            {
                for (var w = 0; w < W; ++w)
                    Write($"{masu[h][w]} ");
                WriteLine();
            }
        }
    }
}

Measured memory_bytes: 13524
#include <iostream>
#include <queue>

#define FOR(i,k,n) for (int (i)=(k); (i)<(n); ++(i))
#define REP(i,n) FOR(i,0,n)
using namespace std;

int main(){
    int n,u,k,v,src=0;
    cin >> n;
    int D[n],g[n][n];
    REP(i,n){
        D[i] = -1;
        REP(j,n){
            g[i][j] = 0;
        }    
    }
    REP(i,n){ 
        cin >> u >> k;
            REP(j,k){
                cin >> v;
                g[v-1][u-1] = 1;
            }
    }

    queue<int> Q;
    Q.push(src);
    D[src] = 0;
    while (!Q.empty()) {
        int cur = Q.front();
        Q.pop();
            REP(i,n){
                if(g[i][cur] == 1 && D[i] < 0){
                    D[i] = D[cur] + 1;
                    Q.push(i);
                }
            }
    }

    REP(i,n){
        cout << i+1 << " " << D[i] << endl;    
    }
}

Measured memory_bytes: 3116
#include <cassert>
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>

class TVertex
{
    int FValue;
    std::vector<TVertex*> FList;
public:
    TVertex(int Value)
     : FValue(Value)
    {}
    void AddPath(TVertex* Vertex)
    {
        FList.push_back(Vertex);
    }
    void PrintMatrix(std::ostream& out, int MaxIndex)const
    {
        std::vector<TVertex*>::const_iterator It = FList.begin();
        for(int i = 1; i < MaxIndex; ++i){
            if(i > 1) out << " ";
            if(It != FList.end() && (*It)->FValue == i){
                out << 1;
                ++It;
            }else{
                out << 0;
            }
        }
        out << std::endl;
    }
};
class TGraph
{
    std::vector<TVertex*> FTable;
    void Init(int n)
    {
        assert(n > 0);
        FTable.resize(n);
        for(int i = 0; i < n; ++i){
            FTable[i] = new TVertex(i);
        }
    }
public:
    TGraph(int n)
    {
        Init(n+1);
    }
    
    void SetupVertex(std::istream& in)
    {
        int Index;
        in >> Index;
        assert(Index >= 1);
        assert(Index <= FTable.size());
        int k;
        in >> k;
        for(int i = 0; i < k; ++i){
            int v;
            in >> v;
            FTable[Index]->AddPath(FTable[v]);
        }
    }
    void PrintMatrix(std::ostream& out)
    {
        for(int i = 1; i < FTable.size(); ++i){
            FTable[i]->PrintMatrix(out, FTable.size());
        }
    }
};

int main()
{
    int n;
    std::cin >> n;
    TGraph Graph(n);
    for(int i = 0; i < n; ++i){
        Graph.SetupVertex(std::cin);
    }
    Graph.PrintMatrix(std::cout);
    return 0;
    
}

Measured memory_bytes: 3136
#include <stdio.h>

int main(void) {
	int N;
	int horieyui = 0;
	int kitaeri = 0;
	int mizuhasu;
	if (scanf("%d", &N) != 1) return 1;
	for (mizuhasu = 0; mizuhasu < N; mizuhasu++) {
		int p;
		if (scanf("%d", &p) != 1) return 1;
		horieyui += p;
		if (p > kitaeri) kitaeri = p;
	}
	printf("%d\n", horieyui - kitaeri / 2);
	return 0;
}


Measured memory_bytes: 128
open System


[<EntryPoint>]
let main argv =
    let daylist = [|"SUN"; "MON"; "TUE"; "WED"; "THU"; "FRI"; "SAT"|]
    let day = stdin.ReadLine()

    stdout.WriteLine(7 - Array.findIndex (fun x -> x.Equals(day)) daylist)
    0


Measured memory_bytes: 11220
#include <cstdio>
#include <iostream>
#include <cstdlib>
#include <unordered_map>
#include <map>
#include <unordered_set>
#include <set>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <list>
#include <array>
#include <deque>
#include <bitset>
typedef long long ll;
using namespace std;
#define trace(x) cerr << #x << " is " << x << endl;

int main() {
    vector<string> v = {"Sunny", "Cloudy", "Rainy"};
    string s;
    cin >> s;
    int cnt = 0;
    for (int i = 0; i < v.size(); i++) {
        if (s == v[i]) {
            cnt = i;
            break;
        }
    }
    cout << v[(cnt + 1) % 3] <<endl;
}



Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<functional>
#include<cmath>
#include<queue>
using namespace std;
long long a, b, x = 1, mod = 1000000007;
int main() {
	cin >> a >> b; if (a < b)swap(a, b);
	if (a == b) {
		for (int i = 1; i <= a; i++) { x *= i; x %= mod; }
		for (int i = 1; i <= a; i++) { x *= i; x %= mod; }
		x *= 2; x %= mod;
		cout << x << endl;
	}
	else if (a == b + 1) {
		for (int i = 1; i <= a; i++) { x *= i; x %= mod; }
		for (int i = 1; i <= b; i++) { x *= i; x %= mod; }
		cout << x << endl;
	}
	else {
		cout << "0" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#define INF 100000000
#include <iostream>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>

using namespace std;

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

static const double eps = 1e-8;

int main(){
	int n;
	bool students[30];
	memset(students,0,sizeof(students));

	while(~scanf("%d",&n)){
		students[n-1]=1;
	}

	for(int i=0;i<30;i++){
		if(!students[i]){
			printf("%d\n",i+1);
		}
	}
}

Measured memory_bytes: 0
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<algorithm>
#include<cmath>
#include<set>
using namespace std;

int main(){
    int X;
    cin>>X;
    int64_t res=2;
    for(int i=1;i<=X;i++){
        res = 1 + res + res + 1;
        
    }
    cout<<res<<endl;
    return 0;
}


Measured memory_bytes: 256
//gcc listsirkuler.c map.c player.c mesinkata.c mesinkar.c matriks.c pcolor.c point.c queue.c unit.c main.c -o main
#include <bits/stdc++.h>
#define Semangat using
#define World namespace
#define Final std;
#define WF {ios_base::sync_with_stdio(0);cin.tie(0);}
 
Semangat World Final

char x,y;
int l,r;

int main(){
	WF
	cin>>x>>y;
	l=x-65;
	r=y-65;
	if(l<r)
		cout<<"<\n";
	else if(l>r)
		cout<<">\n";
	else
		cout<<"=\n";
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int n, W, w[100], v[100];
ll dp[100][100001];
int main()
{
    /*freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);*/
    cin >> n >> W;
    for(int i=0; i<n; ++i)
        cin >> w[i] >> v[i];
    for(int i=0; i<100; ++i)
        for(int j=0; j<1e5+1; ++j)
            dp[i][j] = 1e9+1;
    dp[0][0] = 0;
    dp[0][v[0]] = w[0];
    for(int i=1; i<n; ++i)
    {
        for(int j=0; j<=1e5; ++j)
        {
            if( j+v[i] <= 1e5 )
                dp[i][j+v[i]] = min(dp[i-1][j+v[i]], dp[i-1][j] + w[i]);
            dp[i][j] = min(dp[i][j], dp[i-1][j]);
        }
    }
    for(int i=1e5; i>=0; --i)
        if(dp[n-1][i] <= W)
        {
            cout << i;
            return 0;
        }
}

Measured memory_bytes: 78336
#include <iostream>

using namespace std;
static const int month[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

int day_count(int y, int m, int d)
{
	bool isLeap = false;
	int sum = 0;
	for(int i = 1; i < y; ++i)
	{
		if((i % 4 == 0 && i % 100 != 0) || i % 400 == 0)
		{
			sum += 366;
		}
		else
		{
			sum += 365;
		}
	}
	if((y % 4 == 0 && y % 100 != 0) || y % 400 == 0)
	{
		isLeap = true;
	}
	for(int i = 0; i < m - 1; ++i)
	{
		if(i == 1 && isLeap)
		{
			++sum;
		}
		sum += month[i];
	}
	sum += d;
	return(sum);
}

void solve()
{
	int y1, m1, d1, y2, m2, d2;
	while(cin >> y1 >> m1 >> d1 >> y2 >> m2 >> d2)
	{
		if(y1 <= -1 || m1 <= -1 || d1 <= -1 || y2 <= -1 || m2 <= -1 || d2 <= -1)
		{
			break;
		}
		cout << day_count(y2, m2, d2) - day_count(y1, m1, d1) << endl;
	}
}

int main()
{
	solve();
	return(0);
}

Measured memory_bytes: 1160
package main

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

var sc = bufio.NewScanner(os.Stdin)

func main() {
	var n int
	fmt.Scanf("%d", &n)

	sc.Split(bufio.ScanWords)
	var c [26]int

	for i := 0; i < 26; i++ {
		c[i] = nextInt()
	}

	s := make([][]int, n)
	for i := 0; i < n; i++ {
		s[i] = make([]int, 26)
		for j := 0; j < 26; j++ {
			s[i][j] = nextInt()
		}
	}

	for i := 0; i < n; i++ {

		fmt.Println(maxIntSliceIndex(s[i]) + 1)
	}
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func maxInt(a, b int) int {
	if a < b {
		return b
	}
	return a
}

func maxIntSliceIndex(a []int) int {
	b := a[0]
	ind := 0
	for i, v := range a {
		if b < v {
			ind = i
		}
	}
	return ind
}

func minInt(a, b int) int {
	if a < b {
		return a
	}
	return b
}


Measured memory_bytes: 1988
#include <bits/stdc++.h>
#define rep(i, l, r) for(register int i = l; i < r; i++)
#define hrp(i, l, r) for(register int i = l; i <= r; i++)
#define rev(i, r, l) for(register int i = r; i >= l; i--)
#define ms(n, t) memset(n, t, sizeof(n))
#define U 10050
#define pb push_back
#define int ll
#ifndef JOEON
#define D(...)
#define R(x, l)
#define sp
#endif
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
template<typename tn> inline tn next(void);
template<typename tn> inline ostream& operator << (ostream& os, const vector<tn>& v);
int w[U];
signed main(void)
{
	#ifdef JOEON
//		freopen("C:\\Users\\Joeon\\Desktop\\IN.txt", "r", stdin);
//		freopen("C:\\Users\\Joeon\\Desktop\\OUT.txt", "w", stdout);
	#endif
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n, k, sum = 0;
	cin>>n>>k;
	rep(i, 0, n) cin>>w[i];
	sort(w, w+n);
	rep(i, 0, k) sum += w[i];
	cout<<sum<<endl;
	return 0;
}
template<typename tn> inline tn next(void)
{
	tn k;
	cin>>k;
	return k;
}
template<typename tn> inline ostream& operator << (ostream& os, const vector<tn>& v)
{
	rep(i, 0, v.size()) os<<v[i]<<' ';
	return os;
}

Measured memory_bytes: 3656
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        int[] p = new int[N];
        for (int i=0; i<N; i++){
            p[i] = sc.nextInt();
        }
        sc.close();

        int count=0;

        for (int i=1; i<N-1; i++){
            if(p[i-1] < p[i] && p[i] < p[i+1]){
                count++;
            }else if (p[i-1] > p[i] && p[i] > p[i+1]){
                count++;
            }

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

Measured memory_bytes: 21716
#include <iostream> 
#include <sstream> 
#include <iomanip> 
#include <algorithm> 
#include <cmath> 
#include <string> 
#include <vector> 
#include <list> 
#include <queue> 
#include <stack> 
#include <set> 
#include <map> 
#include <bitset> 
#include <numeric> 
#include <climits> 
#include <cfloat> 
using namespace std;

int n, k;
vector<int> c;

int solve()
{
    int tmp = 1;
    for(int i=0; i<k; ++i)
        tmp *= c[i];

    int ret = tmp;
    for(int i=k; i<n; ++i){
        tmp /= c[i-k];
        tmp *= c[i];
        ret = max(ret, tmp);
    }

    return ret;
}

int main()
{
    for(;;){
        cin >> n >> k;
        if(n == 0)
            return 0;

        c.resize(n);
        for(int i=0; i<n; ++i)
            cin >> c[i];

        int teacher = solve();
        int student = 0;
        for(int i=0; i<n; ++i){
            for(int j=0; j<i; ++j){
                swap(c[i], c[j]);
                student = max(student, solve());
                swap(c[i], c[j]);
            }
        }

        int ret = student - teacher;
        cout << ret << endl;
    }
}

Measured memory_bytes: 908
l = input().split()
i = 0
while i < 5:
    l[i] = int(l[i])
    i += 1
W = l[0]; H = l[1]; x = l[2]; y = l[3]; r = l[4]

if x - r >= 0 and y - r >= 0 and x + r <= W and y + r <= H:
    print("Yes")
else:
    print("No")



Measured memory_bytes: 5596
n=int(input())
d,x=map(int,input().split())
al=[int(input()) for i in range(n)]
total=0
for i in range(n):
    total+=1
    day=al[i]
    while True:
        if day+1<=d:
            total+=1
            day+=al[i]
        else:
            break
print(total+x)



Measured memory_bytes: 9112
A, B, C, D, E, F = map(int, input().split())

best = -1.0
ws = sg = 0

for a in range(0, F + 1, 100 * A):
    for b in range(0, F - a + 1, 100 * B):
        w = a + b
        m = min(F - w, w * E // 100)

        if w == 0: continue
        for c in range(0, m + 1, C):
            for d in range(0, m - c + 1, D):
                s = c + d
                if best < s / (w + s):
                    best = s / (w + s)
                    ws = w + s
                    sg = s
print(ws, sg)

Measured memory_bytes: 3064
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <utility>
#include <iostream>
#include <algorithm>
#include <functional>
/*
#include <unordered_map>
#include <unordered_set>
*/
using namespace std;

#define INF (1 << 30)
//#define INFL (1LL << 62)
#define MOD7 1000000007
#define MOD9 1000000009
#define EPS 1e-10

#define ll long long
#define ull unsigned long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pul pair<ull, ull>
#define all(a) (a).begin(), (a).end()
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);--i)
#define REP(i,n) for (int i=0;i<(n);++i)
#define RREP(i,n) for (int i=(n)-1;i>=0;--i)

void YES() { cout << "YES" << endl; }
void NO() { cout << "NO" << endl; }
void Yes() { cout << "Yes" << endl; }
void No() { cout << "No" << endl; }
void yes() { cout << "yes" << endl; }
void no() { cout << "no" << endl; }
void digit(int d) { cout << fixed << setprecision(d); }
void IOup() { cin.tie(0); ios::sync_with_stdio(false); }

#define INFL 2147483647

class RMQ {
	vector<ll> data;
	int size;
	int suffix;
	
public:
	RMQ() {}
	RMQ(int n) {
		suffix = -1;
		resize(n);
	}

	void resize(int n) {
		size = 1;
		while (size < n) {
			size <<= 1;
		}
		data.resize(size * 2 - 1, INFL);
	}

	ll operator[](int i) const {
		return data[i + size - 1];
	}

	ll& operator[](int i) {
		update();
		suffix = i;
		return data[i + size - 1];
	}

	void update() {
		if (suffix < 0)
			return;
		int k = suffix + size - 1;
		suffix = -1;
		while (k > 0) {
			k = (k - 1) / 2;
			data[k] = std::min(data[k * 2 + 1], data[k * 2 + 2]);
		}
	}

	ll min(int a, int b) {
		update();
		suffix = -1;
		return min(a, b, 0, 0, size);
	}

	ll min(int a, int b, int k, int l, int r) {
		if (r <= a || b <= l)
			return INFL;
		if (a <= l && r <= b)
			return data[k];
		int m = (l + r) / 2;
		return std::min(min(a, b, k * 2 + 1, l, m), min(a, b, k * 2 + 2, m, r));
	}
};

int main() {
	int n, q, c, x, y;
	cin >> n >> q;
	RMQ rmq(n);
	while (q--) {
		cin >> c >> x >> y;
		if (c) {
			cout << rmq.min(x, y + 1) << endl;
		}
		else {
			rmq[x] = y;
		}
	}

	return 0;
}

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

int main()
{
    int N, Y, x, y;
    cin >> N >> Y;

    rep(x, N+1) rep(y, N+1) {
        int z = Y - (10000 * x + 5000 * y);
        int num = z / 1000;
        if (z >= 0 && (x + y + num) == N) {
            cout << x << " " << y << " " << num << endl;
            return 0;
        }
    }
    cout << -1 << " " << -1 << " " << -1 << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define mod (int)(1e9+7)
int lcm_matrices[1000005];
//258279424
//515373828
int inv_mod(int a){
    int res = 1;
    int mod_temp = mod-2;
    while(mod_temp){
        if(mod_temp&1){
            res = ((res%mod)*(a%mod))%mod;
        }
        a = ((a%mod)*(a%mod))%mod;
        mod_temp >>= 1;
    }
    return res%mod;
}
signed main(){
    int n;
    cin >> n;
    int arr[n];
    for(int i = 0; i < n; i++){
        cin >> arr[i];
        int x = arr[i];
        for(int j = 2; j*j <= x; j++){
            if(x%j == 0){
                int cnt = 1;
                while((x/=j)%j == 0) cnt++;
                lcm_matrices[j] = max(lcm_matrices[j], cnt);
            }
            
        }
        if(x > 1) lcm_matrices[x] = max(lcm_matrices[x], 1LL);
    }

    int mul = 1;
    for(int i = 0; i <= 1000000; i++){
        while(lcm_matrices[i]--){
            mul = ((mul%mod)*(i%mod))%mod;
        }
    }
    // cout << "mul = " << mul << endl;
    int ans = 0;
    for(int i = 0; i < n; i++){
        ans = ((ans%mod) + ((mul%mod)*(inv_mod(arr[i])))%mod)%mod;
    }

    cout << ans << endl;


}

Measured memory_bytes: 8192
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
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[] ac = new int[n];
	    int[] wa = new int[n];
	    
	    for (int i = 0; i < m; i++) {
			int temp = sc.nextInt() - 1;
			String s = sc.next();
			// まだACが出ていないなら
			if (ac[temp] == 0) {
				if (s.equals("AC")) {
					ac[temp]++;
				} else {
					wa[temp]++;
				}
			}
		}
	    
	    int ans1 = 0;
	    int ans2 = 0;
	    for (int i = 0; i < n; i++) {
	    	// ACが出ている問題のみカウント
			if (ac[i] == 1) {
				ans1 += ac[i];
				ans2 += wa[i];
			}
		}
	    
	    System.out.println(ans1 + " " + ans2);
	  
	  }
	}

Measured memory_bytes: 66120
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1e18;
const ll mod = 1e9+7;
#define rep(i,n) for(int i = 0;i<n;i++)

int main(){
	int n,m,x;
	cin >> n>>m >> x;
	vector<int> c(n);
	vector<vector<int>> a(n,vector<int>(m));
	rep(i,n){
		cin >> c[i];
		rep(j,m)cin >> a[i][j];
	}
	int cost = 1e9;

	for(int bit = 0; bit < (1 << n); bit++){
		int subcost = 0;
		vector<int> study(m,0);
		for(int flag = 0; flag < n; flag++){
			if(bit & (1<<flag) ){
				subcost += c[flag];
				for(int j = 0; j <m; j++){
					study[j] += a[flag][j];
				}
			}
		}
		bool hantei = true;
		rep(j,m){
			if(study[j] < x)hantei = false;
		}
		if(hantei){
			cost = min(subcost,cost);
		}
	}
	if(cost == 1e9)cout << -1 << endl;
	else cout << cost << endl;


	return 0;
}

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


public class Contest
{
	public static void Main()
	{

/*
		int n = a[0];
		int[][] e = new int[n][];
		for(int i=0; i<n; i++) MyIO.ReadArray(out e[i]);

		int[] a;
		MyIO.ReadArray(out a);

        long a,b,c,d,e,f;
        MyIO.ReadMulti(out a, out b, out c, out d, out e, out f);

		MyIO.WriteArray(ans);
*/

        int n,y;
		MyIO.ReadMulti(out n, out y);


		

		Console.WriteLine(Math.Max(Math.Max(n-y,n+y),n*y));
	}


}

public static class MyIO
{
	private static bool eq<T, U>() => typeof(T).Equals(typeof(U));
	private static T ct<T, U>(U a) => (T)Convert.ChangeType(a, typeof(T));
	private static T cv<T>(string s) => eq<T, int>()    ? ct<T, int>(int.Parse(s))
	                                  : eq<T, long>()   ? ct<T, long>(long.Parse(s))
	                                  : eq<T, double>() ? ct<T, double>(double.Parse(s))
	                                  : eq<T, char>()   ? ct<T, char>(s[0])
	                                                    : ct<T, string>(s);
	public static string[] ReadArray<T>(out T[] a) {		
		var ar = Console.ReadLine().Split(new char[] {' '}, StringSplitOptions.RemoveEmptyEntries); 												
		a = System.Array.ConvertAll(ar, new Converter<string,T>(cv<T>));
		return ar;
	}										
	public static string[] ReadMulti<T>(out T a) {
		var ar = Console.ReadLine().Split(new char[] {' '}, StringSplitOptions.RemoveEmptyEntries); 
		a = cv<T>(ar[0]);
		return ar;
	}
	public static string[] ReadMulti<T, U>(out T a, out U b) {
		var ar = ReadMulti<T>(out a); 
        b = cv<U>(ar[1]);
		return ar;
	}
	public static string[] ReadMulti<T, U, V>(out T a, out U b, out V c) {
		var ar = ReadMulti<T, U>(out a, out b); 
        c = cv<V>(ar[2]);
		return ar;
	}
	public static string[] ReadMulti<T, U, V, W>(out T a, out U b, out V c, out W d) {
		var ar = ReadMulti<T, U, V>(out a, out b, out c); 
        d = cv<W>(ar[3]);
		return ar;
	}
	public static string[] ReadMulti<T, U, V, W, X>(out T a, out U b, out V c, out W d, out X e) {
		var ar = ReadMulti<T, U, V, W>(out a, out b, out c, out d); 
        e = cv<X>(ar[4]);
		return ar;
	}
	public static string[] ReadMulti<T, U, V, W, X, Y>(out T a, out U b, out V c, out W d, out X e, out Y f) {
		var ar = ReadMulti<T, U, V, W, X>(out a, out b, out c, out d, out e); 
        f = cv<Y>(ar[5]);
		return ar;
	}

	public static void WriteArray<T>(T[] a) {
		Console.WriteLine(string.Join(" ", Array.ConvertAll(a, x => x.ToString())));
	}


}




Measured memory_bytes: 11348
#include <iostream>
#include <vector>
#include <algorithm>
int main(){
    int N;
    std::cin >> N;
    std::vector<int> a(N), b(N), c(N);
    for(int i = 0; i < N; i++) std::cin >> a[i];
    for(int i = 0; i < N; i++) std::cin >> b[i];
    for(int i = 0; i < N; i++) std::cin >> c[i];
    std::sort(a.begin(), a.end());
    std::sort(c.begin(), c.end());
    long long ans = 0;
    for(int i = 0; i < N; i++){
        long long ac = std::lower_bound(a.begin(), a.end(), b[i]) - a.begin();
        long long cc = c.end() - std::upper_bound(c.begin(), c.end(), b[i]);
        ans += ac*cc;
    }
    std::cout << ans << std::endl;
}

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

int main() {
  int N, K;

  cin >> N >> K;

  vector<bool> v(N, false);
  for (int i = 0; i < K; i++) {
    int d;
    cin >> d;
    for (int j = 0; j < d; j++) {
      int tmp;
      cin >> tmp;
      if (!v.at(tmp - 1)) {
        v.at(tmp - 1) = true;
      }
    }
  }

  int count = 0;
  for (bool have : v) {
    if (!have) {
      count++;
    }
  }
  cout << count << endl;

  return 0;
}

Measured memory_bytes: 3628
import java.util.*;


public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        String S = sc.next();
        List<Integer> R = new ArrayList<>();
        List<Integer> G = new ArrayList<>();
        Set<Integer> B = new HashSet<>();
        for (int i = 0; i < N; i++) {
            char c = S.charAt(i);
            if (c == 'R') R.add(i+1);
            if (c == 'G') G.add(i+1);
            if (c == 'B') B.add(i+1);
        }

        long ans = 0;
        for (int i = 0; i < R.size(); i++) {
            for (int j = 0; j < G.size(); j++) {
                int r = R.get(i);
                int g = G.get(j);
                int diff = Math.abs(r-g);
                int left = Math.min(r,g);
                int right = Math.max(r,g);
                ans += B.size();
                if (diff%2 == 0 && B.contains(left+diff/2)) ans--;
                if (B.contains(right+diff)) ans--;
                if (B.contains(left-diff)) ans--;
            }
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 45708
s = list(input())
t = [i for i in range(len(s)) if s[i] not in ["A","T","G","C"]]
if len(t) == 0:
	print(len(s))
else:
  t = t + [len(s)]
  u = 0
  w = -1
  for i in range(len(t)):
    if u <= t[i]-w:
      u = t[i]-w
    w = t[i]
  print(u-1)

Measured memory_bytes: 3064
import numpy as np
n,k = map(int,input().split())
ls_2dim = [0] * n
for i in range(n):
    a,b = map(int,input().split())
    ls_2dim[i] = [a,b]
ls_2dim.sort(key=lambda x: x[0])
count = 0
i = 0
while True:
    a,b = ls_2dim[i]
    count += b
    if count >= k:
        ans = a
        break
    i += 1
print(ans)

Measured memory_bytes: 30292
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long

using namespace std;

const ll MOD = 998244353;

ll lgput(ll a, ll b) {
    ll ans = 1;
    while(b) {
        if(b % 2)
            ans = (ans * a) % MOD;
        a = (a * a) % MOD;
        b /= 2;
    }

    return ans;
}

int main() {
    //freopen("a.in", "r", stdin);
    //freopen("a.out", "w", stdout);

    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    int n;
    cin >> n;
    vector<int> cnt(n, 0);
    ll ans = 1;
    for(int i = 1; i <= n; i ++) {
        int x;
        cin >> x;
        cnt[x] ++;

        if(i == 1 && x != 0)
            ans = 0;

    }

    if(cnt[0] != 1)
        ans = 0;
    for(int i = 1; i < n && cnt[i - 1] != 0; i ++)
        ans = (ans * lgput(cnt[i - 1], cnt[i])) % MOD;

    int i;
    bool check = 0;
    for(i = 1; i < n; i ++) {
        if(cnt[i] == 0 && !check)
            check = 1;
        if(cnt[i] != 0 && check)
            ans = 0;
    }

    cout << ans;

    return 0;
}


Measured memory_bytes: 640
#include <stdio.h>
#include <vector>
#include <algorithm>
#define pb push_back
using namespace std;

const int MAXN = (int)1e5 + 5;

int mod;
vector<int> g[MAXN];
vector<int> tree[MAXN];
int p[MAXN];

vector<long long> pref[MAXN];
vector<long long> suf[MAXN];
long long down[MAXN];
long long up[MAXN];

void DFS(int node, int par = 0) {
    p[node] = par;

    for (int i = 0; i < (int)g[node].size(); i++) {
        int viz = g[node][i];
        if (viz != par) {
            tree[node].pb(viz);
            DFS(viz, node);
        }
    }
    return;
}

void solve_down(int node) {
    int sz = tree[node].size();
    pref[node].resize(sz);
    suf[node].resize(sz);

    down[node] = 1;
    for (int i = 0; i < sz; i++) {
        int viz = tree[node][i];
        solve_down(viz);
        down[node] = (down[node] * (1 + down[viz])) % mod;
    }

    for (int i = 0; i < sz; i++) {
        int viz = tree[node][i];
        pref[node][i] = 1 + down[viz];
        if (i != 0) {
            pref[node][i] *= pref[node][i - 1];
            pref[node][i] %= mod;
        }
    }
    for (int i = sz - 1; i >= 0; i--) {
        int viz = tree[node][i];
        suf[node][i] = 1 + down[viz];
        if (i != sz - 1) {
            suf[node][i] *= suf[node][i + 1];
            suf[node][i] %= mod;
        }
    }
    return;
}

void solve_up(int node) {
    if (node == 1) up[node] = 1;

    int sz = tree[node].size();
    for (int i = 0; i < sz; i++) {
        int viz = tree[node][i];
        up[viz] = up[node];
        if (i != 0) up[viz] = (up[viz] * pref[node][i - 1]) % mod;
        if (i != sz - 1) up[viz] = (up[viz] * suf[node][i + 1]) % mod;

        up[viz] = (up[viz] + 1) % mod;
        solve_up(viz);
    }
    return;
}

int main(void) {
    int n;
    int x, y;

    scanf(" %d %d", &n, &mod);
    for (int i = 1; i < n; i++) {
        scanf(" %d %d", &x, &y);
        g[x].pb(y);
        g[y].pb(x);
    }

    DFS(1);
    solve_down(1);
    solve_up(1);

    for (int i = 1; i <= n; i++) {
        printf("%lld\n", (down[i] * up[i]) % mod);
    }

    return 0;
}


Measured memory_bytes: 30592
//{
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double lf;
typedef pair<ll,ll> ii;
#define REP(i,n) for(ll i=0;i<n;i++)
#define REP1(i,n) for(ll i=1;i<=n;i++)
#define FILL(i,n) memset(i,n,sizeof i)
#define X first
#define Y second
#define SZ(_a) (int)_a.size()
#define ALL(_a) _a.begin(),_a.end()
#define pb push_back
#ifdef brian
#define debug(...) do{\
    fprintf(stderr,"%s - %d (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
    _do(__VA_ARGS__);\
}while(0)
template<typename T>void _do(T &&_x){cerr<<_x<<endl;}
template<typename T,typename ...S> void _do(T &&_x,S &&..._t){cerr<<_x<<" ,";_do(_t...);}
template<typename _a,typename _b> ostream& operator << (ostream &_s,const pair<_a,_b> &_p){return _s<<"("<<_p.X<<","<<_p.Y<<")";}
template<typename It> ostream& _OUTC(ostream &_s,It _ita,It _itb)
{
    _s<<"{";
    for(It _it=_ita;_it!=_itb;_it++)
    {
        _s<<(_it==_ita?"":",")<<*_it;
    }
    _s<<"}";
    return _s;
}
template<typename _a> ostream &operator << (ostream &_s,vector<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,set<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a,typename _b> ostream &operator << (ostream &_s,map<_a,_b> &_c){return _OUTC(_s,ALL(_c));}
template<typename _t> void pary(_t _a,_t _b){_OUTC(cerr,_a,_b);cerr<<endl;}
#define IOS()
#else
#define debug(...)
#define pary(...)
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0);
#endif // brian
//}


const ll MAXn=1e5+5,MAXlg=__lg(MAXn)+2;
const ll MOD=1000000007;
const ll INF=ll(1e15);

ll n,m;

int main()
{
    IOS();
    cin>>n>>m;
    ll mx = 1;
    for(ll i = 1;i*i<=m;i++)if(m % i == 0)
    {
      if(m / i >= n)mx=max(mx,i);
      if(i >= n)mx = max(mx,m / i);
    }
    cout<<mx<<endl;
}


Measured memory_bytes: 256
#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>;

struct UnionFind {
  vector<int> d;
  UnionFind(int n=0): d(n,-1) {}
  int find(int x) {
    if (d[x] < 0) return x;
    return d[x] = find(d[x]);
  }
  bool unite(int x, int y) {
    x = find(x); y = find(y);
    if (x == y) return false;
    if (d[x] > d[y]) swap(x,y);
    d[x] += d[y];
    d[y] = x;
    return true;
  }
  bool same(int x, int y) { return find(x) == find(y);}
  int size(int x) { return -d[find(x)];}
};

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

    UnionFind uf(n);
    for (int i = 0; i < m; i++) {
        int a, b;
        cin >> a >> b;
        a--; b--;
        uf.unite(a, b);
    }
    int ans = 0;
    rep(i, n) ans = max(ans, uf.size(i));
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 4012
from collections import Counter

N = int(input())
A = [int(i) for i in input().split()]
cnt_list = Counter(A)

total = sum([cnt*(cnt-1)//2 if cnt > 1 else 0 for cnt in cnt_list.values()])
print(*[total-cnt_list[a]+1 for a in A], sep='\n')

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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int x;
    cin >> x;
    if (x >= 400 && x <= 599) {
        cout << 8 << '\n';
    } else if (x >= 600 && x <= 799) {
        cout << 7 << '\n';
    } else if (x >= 800 && x <= 999) {
        cout << 6 << '\n';
    } else if (x >= 1000 && x <= 1199) {
        cout << 5 << '\n';
    } else if (x >= 1200 && x <= 1399) {
        cout << 4 << '\n';
    } else if (x >= 1400 && x <= 1599) {
        cout << 3 << '\n';
    } else if (x >= 1600 && x <= 1799) {
        cout << 2 << '\n';
    } else if (x >= 1800 && x <= 1999) {
        cout << 1 << '\n';
    }
    return 0;
}

Measured memory_bytes: 3636