akhauriyash/Code-Regression huggingface dataset:
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>
 
#define _USE_MATH_DEFINES
#define mp       make_pair
#define pb       push_back
#define fst      first
#define snd      second
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;

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

const int INF=1<<29;
const double EPS=1e-9;

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

int N, M;
bool path[100][100] = {false};
bool used[100] = {false};

int cnt_path(int n, int d)
{
    if(d == N)
        return 1;

    int ret = 0;
    used[n] = true;
    rep(i, N) {
        if(!used[i] && path[n][i]) {
            ret += cnt_path(i, d+1);
        }
    }
    used[n] = false;

    return ret;
}

int main()
{
    cin >> N >> M;
    int a, b;
    rep(i, M) {
        cin >> a >> b;
        a--; b--;
        path[a][b] = path[b][a] = true;
    }

    cout << cnt_path(0, 1) << endl;
    return 0;
}


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

using namespace std;

inline int ctoi(char c) { if(c < '0' || '9' < c) throw invalid_argument("ctoi error"); return c - '0'; }
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define REP(i, k, n) for(int i = (int)(k); i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()

template <typename T>
inline T gcd(T x, T y){
	if (x <= 0 || y <= 0) throw invalid_argument("gcd error: x <= 0 or y <= 0");
	
	if(x < y) swap(x, y);
	T r = x % y;

	while(r != 0){
		x = y;
		y = r;
		r = x % y;
	}

	return y;
}
template <typename T>
inline T lcm(T x, T y){
	if (x <= 0 || y <= 0) throw invalid_argument("lcm error: x <= 0 or y <= 0");

	return x * y / gcd(x, y);
}

int main(){
	int h, w, k;
	cin >> h >> w >> k;

	vector<vector<char>> input;

	rep(i, h){
		vector<char> v(w);
		int c = 0;

		rep(j, w){
			cin >> v[j];
		}

		input.push_back(v);
	}

	vector<int> tate(w);
	vector<int> yoko(h);

	rep(i, h){
		int c = 0;

		rep(j, w){
			if(input[i][j] == '#') c++;
		}

		yoko[i] = c;
	}

	rep(i, w){
		int c = 0;

		rep(j, h){
			if(input[j][i] == '#') c++;
		}

		tate[i] = c;
	}

	int ans = 0;

	rep(i, pow(2, h)){
		rep(j, pow(2, w)){
			int c = 0;
			vector<vector<char>> tmp = input;

			int bit = 1;
			rep(y, h){
				if(bit & i){
					rep(x, w){
						tmp[y][x] = '.';
					}
				}

				bit *= 2;
			}

			bit = 1;
			rep(x, w){
				if(bit & j){
					rep(y, h){
						tmp[y][x] = '.';
					}
				}

				bit *= 2;
			}

			rep(y, h){
				rep(x, w){
					if(tmp[y][x] == '#') c++;
				}
			}

			if(c == k) ans++;
		}
	}

	cout << ans;

	return 0;
}

Measured memory_bytes: 4108
#include<bits/stdc++.h>
using namespace std;
typedef pair<int64_t ,int64_t> P;

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

    string s ,t;
    cin >> s;
    sort(s.begin() ,s.end());

    for(int i=1;i<n;i++){
        string tmp = s;
        s.erase(0);
        cin >> t;
        sort(t.begin() ,t.end());
        for(int j=0;j<tmp.size();j++){
            for(int k=0;k<t.size();k++){
                if(tmp[j] == t[k]){
                    s.push_back(tmp[j]);
                    tmp.erase(j ,1);j--;
                    t.erase(k ,1);k--;
                    //cout << tmp << " " << t << endl;
                }
            }
        }
       // cout << s << endl;
    }

    cout << s << endl;
}

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


public class Main {

    /**
     * @param args
     */
    public static void main(String[] args) throws Exception{
        while(hasNext()){
            StringBuilder s = new StringBuilder(NS());
            StringBuilder ans=new StringBuilder();
            if(s.length()==0)return;
            for (int i = 0; i < s.length(); i++) {
                if(s.charAt(i)=='@'){
                    i++;
                    int len = s.charAt(i)-'0';
                    i++;
                    for (int j = 0; j < len; j++) {
                        ans.append(s.charAt(i));
                    }
                } else {
                    ans.append(s.charAt(i));
                }
            }
            System.out.println(ans);
        }
    }

    
    static int c=0;
    static int NI(){
        try {
            c=System.in.read();
            int r=0;
            for(;c!='-'&&(c<'0'||'9'<c);)c=System.in.read();
            if(c=='-') return -NI();
            for(;'0'<=c&&c<='9';c=System.in.read())
                r = r * 10 + c - '0';
            return r;
        } catch (Exception e) {
            return -1;
        }
    }
    
    static long NL(){
        try {
            c=System.in.read();
            long r = 0;
            for(;c!='-'&&(c<'0'||'9'<c);)c=System.in.read();
            if(c=='-') return -NL();
            for(;'0'<=c&&c<='9';c=System.in.read())
                r = r * 10 + c - '0';
            return r;
        } catch (Exception e) {
            return -1;
        }
    }
    
    static char NC(){
        try {
            c=System.in.read();
            for(;isSkip();)c=System.in.read();
            return (char)c;
        } catch (Exception e) {
            return 0;
        }
    }
    
    static String NS(){
        StringBuilder sb=new StringBuilder();
        try {
            skip();
            for(;!isSkip();){
                sb.append((char)c);
                c=System.in.read();
            }
            return sb.toString();
        } catch (Exception e) {
            return "";
        }
    }
    
    static String NLine(){
        StringBuilder sb=new StringBuilder();
        try {
            c=System.in.read();
            for(;c!='\n'&&c!='\r';){
                sb.append((char)c);
                c=System.in.read();
            }
            return sb.toString();
        } catch (Exception e) {
            return "";
        }
    }
    
    static void skip(){
        
        try{
            while(isSkip()){
                c=System.in.read();
            }
            c=c;
        } catch (Exception e) {
            
        }
    }
    
    static boolean hasNext(){
        skip();
        return c!=-1;
    }
    
    static boolean isSkip(){
        return 0 <= c && c <= ' ';
    }
}

Measured memory_bytes: 16984
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
//AAAGCCCCC
int main()
{
	
   ll s,w;
   cin>>s>>w;
   if(w>=s)
   	cout<<"unsafe\n";
   else
   	cout<<"safe\n";


	
}

Measured memory_bytes: 3588
# coding: utf-8
# Your code here!

S = input()

# print(S)

# print(S[0])
# print(S[1])
# print(S[2])

sum = 700
if S[0] == 'o':
    sum += 100

if S[1] == 'o':
    sum += 100
    
if S[2] == 'o':
    sum += 100
    
print(sum)

Measured memory_bytes: 2940
n,m=map(int,input().split())
n3=3*n
x=lambda a,b:(a+b)%mod
d=[[0]*(n+2) for i in range(n3+4)]
d[0][0]=1
for i in range(n3):
  d0,d1,d2,d3=d[i:i+4]
  for j in range(n+1):
    d1[j]=(d1[j]+d0[j])%m
    d2[j+1]=(d2[j+1]+d0[j]*(i+1))%m
    d3[j+1]=(d3[j+1]+d0[j]*(i+1)*(i+2))%m
print(sum(d[n3][:n+1])%m)


Measured memory_bytes: 134620
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <unordered_map>
#include <cmath>
#include <numeric>
#include <iomanip>
#include <set>
#include <string.h>

using namespace std;

typedef long long ll;

#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define REP3(i,st,en) for(ll (i)=(st);(i)<(en);(i)++)

using P = pair<ll, ll>;
const int MOD = 1e9+7;
const ll INF = 1e+14;
const double PI = 3.14159265349;

// Extended Print Func
template<class T> std::ostream& operator<<(std::ostream& os, const std::vector<T>& input){
    os << "[ ";
    REP(i, input.size()){
        os << input[i];
        if (i < input.size()-1) { os << " "; }
    }
    os << " ]";
    return os;
}
void print() { std::cout << "\n"; }
template<class T, class... A> void print(const T& first, const A&... rest) { std::cout << first << " "; print(rest...); }
template<class... A> void print(const A&... rest) { print(rest...); }



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

  ll N, Q;
  cin >> N >> Q;
  vector<vector<ll>> children(N,vector<ll>());
  REP(i,N-1){
      ll ai, bi;
      cin >> ai >> bi;
      children[ai-1].push_back(bi-1);
      children[bi-1].push_back(ai-1);
  }

  vector<ll> count(N);
  REP(i,Q){
      ll pi, xi;
      cin >> pi >> xi;
      count[pi-1] += xi;
  }
  
  stack<P> stk;  // node, val
  vector<ll> seen(N);
  stk.push(P(0, 0));
  seen[0] = 1;
  while (!stk.empty()){
      P top = stk.top(); stk.pop();
      ll n = top.first;
      ll v = top.second;
      count[n] += v;
      seen[n] = 1;
      for (auto nn : children[n]){
          if (seen[nn]==0){
              stk.push(P(nn, count[n]));
          }
      }
  }
  
  cout << count[0];
  REP3(i,1,N){
      cout << " " << count[i];
  }
  cout << "\n";
  return 0;
}


Measured memory_bytes: 21104
#include <iostream>

using std::cin;
using std::cout;
using std::endl;

int main(void) {
    int n;
    cin >> n;

    int sum = 0;
    for(int i = 0; i < n; i++){
        int l, r;
        cin >> l >> r;
        sum += r - l + 1;
    }
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 888
#include<iostream>

using namespace std;
int A, B, C;

int f(int x){

    return (A*x+B)%C;
}

int main(){

    while(1){
        int N, X;
        cin>> N>> A>> B>> C>> X;
        if(!(N||A||B||C||X)) break;
        int Y[N];
        for(int i=0; i<N; i++) cin>> Y[i];

        int cnt=0, over=0;
        for(int i=0; i<N; i++){
            while(1){
                if(cnt>10000){
                    over=1;
                    cout<< -1<< endl;
                    break;
                }
                if(X==Y[i]) {X=f(X); cnt++; break;}
                X=f(X);
                cnt++;
            }
            if(over) break;
        }

        if(!over) cout<< cnt-1<< endl;
        
    }

    return 0;
}

Measured memory_bytes: 3108
#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

#A
def A():
    n,a,b = LI()
    print(min(a*n,b))
    return

#B
def B():
    n,d = LI()
    x = LIR(n)
    f = defaultdict(lambda : 0)
    for i in range(1000000):
        f[i*i] = 1
    ans = 0
    for i in range(n):
        for j in range(i+1,n):
            s = 0
            for k in range(d):
                s += (x[i][k]-x[j][k])**2
            if f[s]:
                ans += 1
    print(ans)
    return

#C
def C():
    l,r = LI()
    if r-l > 2019:
        print(0)
        quit()
    ans = float("inf")
    for i in range(l,r+1):
        for j in range(i+1,r+1):
            if i*j%2019 < ans:
                ans = i*j%2019
    print(ans)
    return

#D
def D():
    n = I()

    return

#E
def E():
    n = I()

    return

#F
def F():
    n = I()

    return


#Solve
if __name__ == "__main__":
    C()


Measured memory_bytes: 40304
fun main(args: Array<String>) {
    val (h, w) = readLine()?.split(" ")?.map(String::toInt) ?: return
    val square = mutableListOf<String>()
    repeat(h) {
        square.add(readLine() ?: return)
    }
    0.until(h).forEach { i ->
        0.until(w).forEach { j ->
            if (square[i][j] == '#') {
                when {
                    (j > 0 && square[i][j - 1] == '#') ||
                            (j < w - 1 && square[i][j + 1] == '#') ||
                            (i > 0 && square[i - 1][j] == '#') ||
                            (i < h - 1 && square[i + 1][j] == '#') -> {
                    }
                    else -> {
                        println("No")
                        return
                    }
                }
            }
        }
    }
    println("Yes")
}


Measured memory_bytes: 38000
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pi = pair<int, int>;
string s, t;
vector<int> v[128];
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    cin >> s >> t;
    for(int i=0;i<s.length();i++)
    {
        v[s[i]-'a'].push_back(i);
    }
    ll ans = 0;
    ll pos = -1;
    for(char ch : t)
    {
        if(!v[ch-'a'].size())
        {
            cout << -1;
            return 0;
        }
        vector<int>& vx = v[ch-'a'];
        auto it = upper_bound(vx.begin(), vx.end(), pos);
        if(it == vx.end())
        {
            ans += (vx.front() + s.length() - pos);
            pos = vx.front();
        }
        else
        {
            ans += (*it - pos);
            pos = *it;
        }
    }
    cout << ans;
}

Measured memory_bytes: 1228
#!/usr/bin/env python3


def dfs(p, cur):
    sz = len(cur)
    if sz == 3:
        return
    for i in range(p + 1, n):
        nxt = cur + s[i]
        if nxt in used[sz]:
            continue
        used[sz][nxt] = True
        dfs(i, nxt)


n = int(input())
s = input()
used = [{} for _ in range(3)]

dfs(-1, "")

print(len(used[2]))


Measured memory_bytes: 3188
#include<complex>
#include<cstdio>
using namespace std;
const int N=1e6+7;
int n,minn=0x3f3f3f3f,maxn;
int a[N];
int qread()
{
	int x=0;
	char ch=getchar();
	while(ch<'0' || ch>'9')ch=getchar();
	while(ch>='0' && ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x;
}
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		a[i]=qread();
		maxn=max(maxn,a[i]);
		minn=min(minn,a[i]);
	}
	if(maxn-minn>=2){puts("No");return 0;;}
	if(maxn==minn)
	{
		if(minn==n-1)puts("Yes");
		else if(2*minn<=n)puts("Yes");
		else puts("No");
		return 0;
	}
	int cnt=0;
	for(int i=1;i<=n;i++)
		cnt+=a[i]==minn;
	if(minn<cnt)puts("No");
	else if(n-cnt<2*(maxn-cnt))puts("No");
	else puts("Yes");
	return 0;
}

Measured memory_bytes: 512
import java.util.Scanner;

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

        int midExam = sc.nextInt();
        int finalExam = sc.nextInt();
        int reExam = sc.nextInt();

        String grade;
        int sumOfMidAndFinal;

        while(true){
            if(midExam == -1 && finalExam == -1 && reExam == -1){
                break;
            }

            sumOfMidAndFinal = midExam + finalExam;
            
            if(midExam == -1 || finalExam == -1){
                grade = "F";
            }else if(sumOfMidAndFinal >= 80){
                grade = "A";
            }else if(sumOfMidAndFinal >= 65){
                grade = "B";
            }else if(sumOfMidAndFinal >= 50){
                grade = "C";
            }else if(sumOfMidAndFinal >= 30){
                if(reExam >= 50){
                    grade = "C";
                }else{
                    grade = "D";
                }
            }else{
                grade = "F";
            }
            
            System.out.println(grade);

            midExam = sc.nextInt();
            finalExam = sc.nextInt();
            reExam = sc.nextInt();
            
        }


        sc.close();
    }
}


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

vector<vector<int>> vv(maxn);
int n,u,v;
int disu[maxn],disv[maxn];

int main(){
    cin >> n>>u>>v;
    u--;v--;
    rep(i,n-1){
        int a,b;cin >> a>>b;
        a--;b--;
        vv[a].push_back(b);
        vv[b].push_back(a);
    }

    fill(disu,disu+n,INF);
    fill(disv,disv+n,INF);
    disu[u]=0,disv[v]=0;

    queue<int> que;
    que.push(u);
    while(!que.empty()){
        int arg=que.front();que.pop();
        for(int i=0;i<vv[arg].size();i++){
            int to=vv[arg][i];
            if(disu[to]==INF){
                disu[to]=disu[arg]+1;
                que.push(to);
            }
        }
    }

    que.push(v);
    while(!que.empty()){
        int arg=que.front();que.pop();
        for(int i=0;i<vv[arg].size();i++){
            int to=vv[arg][i];
            if(disv[to]==INF){
                disv[to]=disv[arg]+1;
                que.push(to);
            }
        }
    }

    int ans=0;

    for(int i=0;i<n;i++){
        if(disu[i]<disv[i]){
            ans=max(ans,disv[i]-1);
        }
    }

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

Measured memory_bytes: 9580
#include <cstdio>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <iostream>
#include <cmath>
#include <queue>

using namespace std;

typedef long long ll;

const int N = 100100;

int n , k;


ll sum[N],a[N];

ll pos[N];

ll calc(int l , int r){
	if(l >= n + 1)
		return 0;
	if(r <= 0)
		return 0;
	return pos[r] - pos[l - 1];
}
int main(){
	//freopen("input.txt","r",stdin);
	scanf("%d%d",&n,&k);
	for (int i = 1; i <= n; ++i){
		scanf("%lld",&a[i]);
		sum[i] = sum[i - 1] + a[i];
		pos[i] = pos[i - 1] + max(0ll,a[i]);
	}
	ll fn = 0;
	int idx = 1;
	while(idx + k - 1 <= n){
		ll tmp = calc(1,idx - 1);
		tmp += calc(idx + k , n);
		tmp += max(0ll,sum[idx + k - 1] - sum[idx - 1]);
		fn = max(fn,tmp);
		idx++;
	}

	printf("%lld\n", fn);
	return 0;
}

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

int main() {
    int a,b; cin>>a>>b;
    if (a<= 0 && 0<= b) {
        cout << "Zero" << endl;
    }
    else if (0 <= a &&  a<= b) {
        cout<< "Positive" << endl;
    }
    else if (a <= b && b <= 0 && (b - a + 1) % 2 == 0) {
        cout << "Positive" << endl;
    }
    else {
        cout << "Negative" << endl;
    }
}

Measured memory_bytes: 256
import java.util.*;
class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    long A = sc.nextLong();
    long B = sc.nextLong();
    long K = sc.nextLong();
    
    if(A>=K){
      A -= K;
    }else{
      long J = K-A;
      A=0;
      
      if(B>=J){
        B -= J;
      }else{
        B = 0;
      }
    }
    System.out.println(A+" "+B);
  }
}  

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

template<class T> void vin(vector<T>& v, int n) {
    v.resize(n);
    for (int i = 0; i < n; ++i) {
        cin >> v[i];
    }
}

int main() {
    int n;
    cin >> n;
    vector<ll> x(n);
    rep(i, n) cin >> x[i];
    ll ma = -1;
    rep(i, n) {
        for (int j=i+1; j<n; ++j) {
            string str = to_string(x[i]*x[j]);
            bool ok = true;
            ll tmp = str[0]-'0';
            for (int k=1; k<str.size(); ++k) {
                ll tmp2 = str[k]-'0';
                if (tmp+1 != tmp2) {
                    ok = false;
                    break;
                }
                tmp = tmp2;
            }
            if (ok) {
                ma = max(ma, stoll(str));
            }
        }
    }
    cout << ma << endl;
    return 0;
}



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

using namespace std;

int main()
{
	string s;

	cin >> s;

	bool ok = true;
	for(int i = 0; i < s.size(); ++i)
	{
		if((i % 2 == 0 && s[i] == 'L') || (i % 2 == 1 && s[i] == 'R'))
		{
			ok = false;
		}
	}

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

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <unordered_set>
#include <utility>
#include <algorithm>
#include <cassert>
using namespace std;

class DisjointSet {
private:
	vector<int> P;		//添え字の番号の頂点の親
	vector< unordered_set<int> > Set;		//添え字の番号の頂点に子として繋がっている頂点の集合
public:
	DisjointSet(int n);
	void unite(int x, int y);
	bool same(int x, int y);
};

DisjointSet::DisjointSet(int n) : P(n), Set(n) {
	for (int i = 0; i<n; ++i) {
		P[i] = i;
		Set[i].insert(i);
	}
}

void DisjointSet::unite(int x, int y) {
	if (P[x] == P[y])
		return;
	int big, small;
	if (Set[P[x]].size() >= Set[P[y]].size()) {
		big = P[x];
		small = P[y];
	}
	else {
		big = P[y];
		small = P[x];
	}
	for (auto i = Set[small].begin(); i != Set[small].end(); ++i) {
		P[*i] = big;
		Set[big].insert(*i);
	}
}

bool DisjointSet::same(int x, int y) {
	return P[x] == P[y];
}

class MSTree : public DisjointSet {
private:
	const int vertex_n;
	vector< pair<int, int> > edge;		//firstは辺の重さ、secondは辺のID(始点・終点)
public:
	MSTree(int n) : DisjointSet(n), vertex_n(n), edge(n*n) {
		for (int i = 0; i < n*n; i++) {
			edge[i].first = -1;
			edge[i].second = i;
		}
	}
	int& GetEdgeWeight(int i, int j) { return edge[vertex_n*i + j].first; }
	int MinEdgeSum();
};

int MSTree::MinEdgeSum() {
	int sum = 0;
	sort(edge.begin(), edge.end());
	for (int i = 0; i < vertex_n*vertex_n; i++) {
		int from = edge[i].second / vertex_n, to = edge[i].second % vertex_n;
		if (edge[i].first == -1 || this->same(from, to))
			continue;
		else {
			this->unite(from, to);
			sum += edge[i].first;
		}
	}
	return sum;
}

int main() {
	int n;
	cin >> n;
	MSTree mst(n);
	for (int i = 0; i < n; i++)
		for (int j = 0; j < n; j++)
			cin >> mst.GetEdgeWeight(i, j);
	cout << mst.MinEdgeSum() << endl;
}


Measured memory_bytes: 3164
import sys

def input(): return sys.stdin.readline()[:-1]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def MATINT(h): return [list(map(int, input().split())) for _ in range(h)]
def MATSTR(h): return [input() for _ in range(h)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
inf = float('inf')
mod = 10 ** 9 + 7

def main():
    S = input()
    str = 'ACGT'
    tmp = 0
    maxv = 0
    for i in range(len(S)):
        if S[i] in str:
            tmp += 1
        else:
            tmp = 0
        maxv = max(maxv, tmp)
    print(maxv)

if __name__ == '__main__':
    main()


Measured memory_bytes: 38668
#include<bits/stdc++.h>
#include<unordered_map>
#define for_int(i,a,b) for(int i=(a);i<=(b);++i)
#define rep_int(i,a,b) for(int i=(a);i>=(b);--i)
#define for_ll(i,a,b) for(ll i=(a);i<=(b);++i)
#define rep_ll(i,a,b) for(ll i=(a);i>=(b);--i)
#define IOS ios::sync_with_stdio(false);
#define ull unsigned long long
#define ll long long
#define db double
#define HPMAX 1005
#define KMP_MAX 1005
#define prime_MAX 1000005
#define quick_pow_mod 1000000007
#define PII pair<int,int>
const int factor_N = 10000005;
const int tree_arr_N = 1000005;
using namespace std;
/*
	1.注意边界情况
	2.优先考虑时间复杂度
!!! 3.求最大值时，答案应至多初始化为INT_MIN；求最小值时，答案应至少初始化为INT_MAX
	4.遇事不决先暴力
	5.代码要写简洁
*/
//快读
int read() {
	char c = getchar();
	int x = 0, f = 1;
	for (; !isdigit(c); c = getchar())
		if (c == '-') f = -1;
	for (; isdigit(c); c = getchar()) x = x * 10 + c - 48;
	return x * f;
}
const int N = 1e6 + 5;
int n, m, u, v;
bool vis[N];
void dfs(vector<vector<int>>& a, int root) {
	if (vis[root]) return;
	vis[root] = true;
	for (auto it : a[root])
		dfs(a, it);
	return;
}
int res;
int main() {
	n = read(); m = read();
	vector<vector<int>>a(n + 1);
	while (m--) {
		u = read(); v = read();
		a[u].push_back(v);
		a[v].push_back(u);
	}
	for_int(i,1,n)
		if (vis[i] == false) {
			dfs(a, i);
			res++;
		}
	cout << res -1 << endl;
	return 0;
}


Measured memory_bytes: 9180
# ABC 123: B – Five Dishes
from math import ceil

time_for_serve = [int(input()) for _ in range(5)]
time_for_serve_ceil = [ceil(s / 10) * 10 for s in time_for_serve]
time_to_multiple_ten = [s % 10 for s in time_for_serve]

for i in range(len(time_to_multiple_ten)):
    if time_to_multiple_ten[i] == 0:
        time_to_multiple_ten[i] = 10

print(sum(time_for_serve_ceil) - time_for_serve_ceil[time_to_multiple_ten.index(min(time_to_multiple_ten))] + time_for_serve[time_to_multiple_ten.index(min(time_to_multiple_ten))])

Measured memory_bytes: 3060
// -*- coding:utf-8-unix -*-

use proconio::input;

// ABC086C - Traveling
// https://atcoder.jp/contests/abs/fasks/arc089_a
fn main() {
    input! {
        a: isize,
        b: isize,
        _c: isize,
        k: isize,
    }
    let mut ans: isize = 0;
    if k < a {
        ans = k;
    } else if k <= a + b {
        ans += a;
    } else {
        ans += a - (k - a - b);
    }
    println!("{}", ans);
}


Measured memory_bytes: 2144
#include<bits/stdc++.h>
using namespace std;
int n,k,s;
int cnt,head[2010],to[4010],nxt[4010];
void add(int x,int y)
{
	cnt++;
	to[cnt]=y;
	nxt[cnt]=head[x];
	head[x]=cnt;
}
void dfs(int x,int fa,int d)
{
	if (d>(k>>1))
	{
		s++;
	}
	for (int i=head[x];i;i=nxt[i])
	{
		int y=to[i];
		if (y==fa)
		{
			continue;
		}
		dfs(y,x,d+1);
	}
}
int main()
{
	scanf("%d%d",&n,&k);
	int ans=n;
	for (int i=1;i<n;i++)
	{
		int x,y;
		scanf("%d%d",&x,&y);
		add(x,y);
		add(y,x);
	}
	if (k&1)
	{
		for (int i=1;i<=n;i++)
		{
			for (int j=head[i];j;j=nxt[j])
			{
				int y=to[j];
				s=0;
				dfs(i,y,0);
				dfs(y,i,0);
				ans=min(ans,s);
			}
		}
	}
	else
	{
		for (int i=1;i<=n;i++)
		{
			s=0;
			dfs(i,0,0);
			ans=min(ans,s);
		}
	}
	cout<<ans<<endl;
	return 0;
}

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

int main() {
  int a, b;
  cin >> a >> b;
  cout << a * b << endl;
  return 0;
}

Measured memory_bytes: 3668
#include <stdio.h>

int main(){
    int n;
    int i, j, k, l;
    while (scanf("%d",&n) != EOF) {
        int counter = 0;
        for (i = 0; i < 10; i++) {
            for (j = 0; j < 10; j++) {
                for (k = 0; k < 10; k++) {
                    for (l = 0; l < 10; l++) {
                        if (i + j + k + l == n) {
                            counter++;
                        }
                    }
                }
            }
        }
        printf("%d\n",counter);
    }
    return 0;
}

Measured memory_bytes: 596
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<cstdio>
#include<string>
#include<vector>
#include<math.h>
#include<time.h>
#include<utility>
#include<cstdlib>
#include<sstream>
#include<cstring>
#include<stdio.h>
#include<iomanip>
#include<iostream>
#include<algorithm>
using namespace std;
int n;
int a[100005],two[100005],vis[100005],p[100005],odd=0,four=0;
bool f=0;
void dfs(int cur){
	if(f) return;
	if(cur==n){
		f=1;return;
	}else{
		for(int i=0;i<n;i++){
			if(vis[i]||two[i]+two[p[cur-1]]<2&&i!=0) continue;
			p[cur]=i;
			vis[i]=1;
			dfs(cur+1);
			p[cur]=0;
			vis[i]=0;
		}
	}
}
int main(){
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a[i];
		while(a[i]%2==0){
			two[i]++;
			a[i]/=2;
		}
		if(two[i]==0) odd++;
		if(two[i]>=2) four++;
	} 
	if(odd<=four){
		cout<<"Yes";
		return 0;
	}else{
		if((odd+four)%2&&odd==four+1&&odd+four==n){
			cout<<"Yes";
			return 0;
		}
		cout<<"No";
		return 0;
	}
	dfs(0);
	if(f) cout<<"Yes";
	else cout<<"No";
	return 0;
}

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

int main(){
	int a,b;
	cin>>a>>b;
	if(a>b){
		for(int i=0;i<a;i++)
			cout<<b;
	}else{
		for(int i=0;i<b;i++)
			cout<<a;
	}
	cout<<endl;
	return 0;
}


Measured memory_bytes: 3636
#include<iostream>
using namespace std;
int main (){
    int a, b, c, d=0;
    cin >> a >> b >> c;
    for (int i=a; i<=b; i++){
        if (c%i == 0){
            d++;
        }
        
    }
    cout << d << endl;
    return 0;
    

    }


Measured memory_bytes: 3108
/*
    Ujjawal Pabreja [cuber_coder]
*/
#include <bits/stdc++.h> 
#include <functional> 
using namespace std;
#define speed_cubing    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define ll              long long
#define ld              long double
#define rep(i,a)        for(ll i = 0 ; i < a ; i++)
#define repe(i,a,b)     for(ll i = a ; i < b ; i++)
#define bac(i,a)        for(ll i = a ; i >= 0 ; i--)
#define bace(i,a,b)     for(ll i = a ; i >= b ; i--)
#define pb              push_back
#define in              insert
#define ff              first
#define ss              second
#define setbit(x)       __builtin_popcountll(x)
#define init(c,a)       memset(c,a,sizeof(c))
#define all(c)          c.begin(),c.end()
#define sz(c)           (ll)c.size()
#define lb              lower_bound
#define ub              upper_bound
#define maxe            *max_element
#define mine            *min_element
#define rev             reverse
#define Y				"YES"
#define N 				"NO"
#define endl            "\n"
#define debug(x)        cout << #x << " : " << x << endl;
const ll inf = 1e18;  
const ll mod = 1e9 + 7;
const ll MOD = 998244353;
const ll MAX = 2e5 + 1;

inline ll add(ll a,ll b) {return ((a % mod) + (b % mod)) % mod;}
inline ll sub(ll a,ll b) {return ((a % mod) - (b % mod) + mod) % mod;}
inline ll mul(ll a,ll b) {return ((a % mod) * (b % mod)) % mod;}
ll pwr(ll x,ll n){
    if(n == 0){
        return 1;
    }
    if(n&1){
        return mul(x, pwr(mul(x, x), (n - 1) / 2));
    } else {
        return pwr(mul(x, x), n / 2);
    }
}
ll modInv(ll n){ 
    return pwr(n, mod - 2); 
}
ll gcd(ll a,ll b) {
    if(b == 0) {
        return a;
    }
    return gcd(b, a % b);
}
// ====== Useful functions end ======
 
// ====== Global Variables begin ======

// ====== Global Variables end ======

void speed_solve(){
    ll n;
    cin >> n;
    ll a[n];
    rep(i,n) cin >> a[i];
    ll tot = 0, mx = a[0];
    repe(i,1,n){
        tot += max(mx - a[i], 0LL);
        mx = max(mx, a[i]);
    }
    cout << tot;
}

int main(){
    // #ifndef ONLINE_JUDGE
    //     freopen("input.txt", "r", stdin);
    //     freopen("output.txt", "w", stdout);
    // #endif
    speed_cubing;
    ll test_cases = 1;
    // cin >> test_cases;
    rep(i,test_cases){
        // cout << "Case #" << i + 1 << ": ";
        speed_solve();
    }
    return 0;
}

Measured memory_bytes: 5164
package main

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

var rdr = bufio.NewReaderSize(os.Stdin, 1000000)

func readLine() (ret string) {

	buf := make([]byte, 0, 1000000)
	for {
		l, p, e := rdr.ReadLine()
		if e != nil {
			return ""
		}
		buf = append(buf, l...)
		if !p {
			break
		}
	}
	return string(buf)
}

type Utls struct {
}

type uString string

var utls = &Utls{}

func (u *Utls) readLineU() uString {
	return uString(readLine())
}

func (u *Utls) atoi(str string) int {
	r, _ := strconv.Atoi(str)
	return r
}
func (u *Utls) itoa(n int) string {
	r := strconv.Itoa(n)
	return r
}
func (u uString) atoi() int {
	r, err := strconv.Atoi(string(u))
	if err != nil {
		return -1
	}
	return r
}
func (u uString) atoiArr() []int {
	ret := make([]int, 0)

	l := strings.Split(string(u), " ")

	for i := 0; i < len(l); i++ {
		s := (uString(l[i]))

		ret = append(ret, s.atoi())

	}
	return ret
}
func (u uString) String() string {
	return string(u)
}

func main() {
	 a:= utls.readLineU().atoi()
	 r :=  (a)+ (a*a) + (a*a*a)
	 fmt.Println(r)
}

Measured memory_bytes: 1844
import sys

sys.setrecursionlimit(10 ** 8)
ini = lambda: int(sys.stdin.readline())
inl = lambda: [int(x) for x in sys.stdin.readline().split()]
ins = lambda: sys.stdin.readline().rstrip()


def solve():
    n = ini()
    for x in range(n + 1):
        y = int(x * 1.08 + 1e-8)
        if y == n:
            return x
    return ":("


print(solve())


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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}


int nextInt() { int x; scanf("%d", &x); return x;}

int main2() {
  int N; cin >> N;
  string s; cin >> s;
  vector<int> zero(N+1);
  vector<int> one(N+1);
  REP(i, N) zero[i+1] = zero[i] + (s[i] == '.');
  REP(i, N) one[i+1] = one[i] + (s[i] == '#');

  int ans = N;
  for (int i = 0; i <= N; i++) {
    int need = 0;
    need += zero[N] - zero[i];
    need += one[i];
    chmin(ans, need);
  }

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

int main() {
  for (;!cin.eof();cin>>ws)
    main2();
  return 0;
}


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

void solve(string s){
	cout << s.substr(0,4) << " " << s.substr(4,8) << endl;
}



int main(){	
	ios::sync_with_stdio(false);
	string s;
	cin >> s;
	solve(s);
	return 0;
}


Measured memory_bytes: 256
package main

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

var sc = bufio.NewScanner(os.Stdin)

func Scan() string {
	sc.Scan()
	return sc.Text()
}
func iScan() int {
	n, _ := strconv.Atoi(Scan())
	return n
}
func fScan() float64 {
	n, _ := strconv.ParseFloat(Scan(), 64)
	return n
}
func stringToInt(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}
func SScan(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = Scan()
	}
	return a
}
func iSScan(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = iScan()
	}
	return a
}
func abs(x int) int {
	if x < 0 {
		x = -x
	}
	return x
}
func larger(a, b int) int {
	if a < b {
		return b
	} else {
		return a
	}
}
func smaller(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}
func max(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x < a[i] {
			x = a[i]
		}
	}
	return x
}
func min(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x > a[i] {
			x = a[i]
		}
	}
	return x
}
func sum(a []int) int {
	x := 0
	for _, v := range a {
		x += v
	}
	return x
}

var mod int = 1000000007

func main() {
	buf := make([]byte, 0)
	sc.Buffer(buf, mod)
	sc.Split(bufio.ScanWords)
	n := iScan()
	x := []int{iScan()}
	x = append(x, iSScan(n)...)
	ans := abs(x[0] - x[1])
	for i := 1; i < n; i++ {
		ans = gcd(ans, abs(x[i+1]-x[i]))
	}
	fmt.Println(ans)
}
func gcd(a, b int) int {
	if b == 0 {
		return a
	}
	return gcd(b, a%b)
}


Measured memory_bytes: 4956
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <sstream>
#include <cmath>
#include <set>
#include <iomanip>
#include <deque>
using namespace std;
typedef long long ll;

#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 FOREACH(i,Itr) for(auto (i)=(Itr).begin();(i)!=(Itr).end();(i)++)
#define REMOVE(Itr,n) (Itr).erase(remove((Itr).begin(),(Itr).end(),n),(Itr).end())
#define UNIQUE(Itr) sort((Itr).begin(),(Itr).end()); (Itr).erase(unique((Itr).begin(),(Itr).end()),(Itr).end())
#define LBOUND(Itr,val) lower_bound((Itr).begin(),(Itr).end(),(val))
#define UBOUND(Itr,val) upper_bound((Itr).begin(),(Itr).end(),(val))

int main() {
    
    string S;
    char ans='0';
    REP(i,3){
        cin>>S;
        if(i==1)ans=S[0];
    }
    
    cout<<"A"<<ans<<"C"<<endl;
    
    return 0;
}




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

int main()
{
    size_t N;
    string c;
    cin >> N >> c;

    vector<size_t> R(N + 1, 0);
    vector<size_t> W(N + 1, 0);
    for (size_t i = 1; i <= N; i++)
    {
        R[i] = R[i - 1];
        W[i] = W[i - 1];
        if (c[i - 1] == 'R')
        {
            R[i]++;
        }
        else
        {
            W[i]++;
        }
    }
    size_t ans = N;
    for (size_t i = 0; i <= N; i++)
    {
        size_t w = W[i];
        size_t r = R.back() - R[i];
        ans = min(ans, w + r - min(w, r));
    }
    cout << ans << endl;
}


Measured memory_bytes: 6752
#[allow(dead_code)]
fn is_whitespace(c: &char) -> bool {
    c.is_whitespace()
}

#[allow(dead_code)]
fn is_eol(c: &char) -> bool {
    ['\r', '\n'].contains(c)
}

#[allow(unused_macros)]
macro_rules! input {
    ($var:ident, $($r:tt)*) => {
        input_inner!{$var, $($r)*}
    };

    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        #[allow(unused_mut, unused_variables, bare_trait_objects)]
        let mut next = move |f: &Fn(&char)->bool| -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|f(&c))
                .take_while(|c|!f(&c))
                .collect()
        };
        input_inner!{next, $($r)*};
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; eol ]) => {
        $next(&is_eol).split(' ').map(|x| x.parse::<$t>().unwrap()).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, parser) => {
        $next
    };

    ($next:expr, $t:ty) => {
        $next(&is_whitespace).parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::{BinaryHeap, HashMap, HashSet};

#[allow(dead_code)]
struct Edge {
    from: usize,
    to: usize,
}

#[allow(dead_code)]
type Graph = Vec<Vec<usize>>;
#[allow(dead_code)]
const M: usize = 1_000_000_007;

fn main() {
    input! {
        x: usize, y: usize,
    }

    println!("{}", 64 - ((y / x) as u64).leading_zeros());
}


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

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

  long int A[N] = {};
  for(int i=0;i<N;i++){
    cin >> A[i];
  }

  sort(A, A+N);

  cout << (A[N-1] - A[0]) << endl;

  return 0;
}


Measured memory_bytes: 256
N, x = map(int, input().split())
if x == 1 or x == 2*N-1:
    print('No')
    exit()
print('Yes')
ans = None
if N == 2:
    ans = [1, 2, 3]
elif x+2 <= 2*N-1:
    ans = list(range(1, x-1)) + list(range(x+3, 2*N))
    ans = ans[:N-3] + [x+2, x-1, x, x+1] + ans[N-3:]
else:
    ans = list(range(1, x-2)) + list(range(x+2, 2*N))
    ans = ans[:N-3] + [x-2, x+1, x, x-1] + ans[N-3:]
for i in ans:
    print(i)



Measured memory_bytes: 50080
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}


struct UnionFind{
  Int n;
  vector<Int> r,p;
  UnionFind(){}
  UnionFind(Int sz):n(sz),r(sz,1),p(sz,0){iota(p.begin(),p.end(),0);}
  Int find(Int x){
    return (x==p[x]?x:p[x]=find(p[x]));
  }
  bool same(Int x,Int y){
    return find(x)==find(y);
  }
  void unite(Int x,Int y){
    x=find(x);y=find(y);
    if(x==y) return;
    if(r[x]<r[y]) swap(x,y);
    r[x]+=r[y];
    p[y]=x;
  }
};

//INSERT ABOVE HERE
signed main(){
  Int n,m;
  cin>>n>>m;
  vector<Int> a(m),b(m);
  for(Int i=0;i<m;i++) cin>>a[i]>>b[i];

  UnionFind uf(n);
  vector<Int> ans(m+1,0);
  ans[m]=n*(n-1)/2;
  for(Int i=m-1;i>=0;i--){
    a[i]--;b[i]--;
    ans[i]=ans[i+1];
    if(uf.same(a[i],b[i])) continue;
    
    Int x=uf.r[uf.find(a[i])];
    Int y=uf.r[uf.find(b[i])];
    ans[i]-=x*y;
    
    uf.unite(a[i],b[i]);
  }
  ans.erase(ans.begin());
  for(Int x:ans) cout<<x<<endl;
  return 0;
}


Measured memory_bytes: 5248
#include <algorithm>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
using ll = long long;

/* clang-format off */
template <class T, size_t D> struct _vec { using type = vector<typename _vec<T, D - 1>::type>; };
template <class T> struct _vec<T, 1> { using type = vector<T>; };
template <class T, size_t D> using vec = typename _vec<T, D>::type;
template <class T> vector<T> make_v(size_t size, const T& init) { return vector<T>(size, init); }
template <class... Ts> auto make_v(size_t size, Ts... rest) { return vector<decltype(make_v(rest...))>(size, make_v(rest...)); }
/* clang-format on */

ll f(const vector<ll>& A, ll b) {
  ll res = 0;
  for (ll x : A) res += abs(x - b);
  return res;
}

int main() {
  int N;
  while (cin >> N) {
    vector<ll> A(N);
    for (int i = 0; i < N; i++) cin >> A[i];
    for (int i = 0; i < N; i++) A[i] -= i + 1;
    auto B = A;
    sort(B.begin(), B.end());
    ll res = min(f(A, B[N / 2]), f(A, B[(N - 1) / 2]));
    cout << res << endl;
  }
  return 0;
}


Measured memory_bytes: 3328
#include<bits/stdc++.h>
#define maxn 100100
using namespace std;
typedef long long ll;
int n,m,a[maxn],b[maxn],c[maxn],d[maxn];
ll x[maxn];
ll k;
void mul(int a[],int b[],int c[]){
//	for(int i=1;i<=n;++i)printf("[%d]",a[i]);puts("");
//	for(int i=1;i<=n;++i)printf("[%d]",b[i]);puts("");
	for(int i=1;i<=n;++i)d[i]=a[b[i]];
	for(int i=1;i<=n;++i)c[i]=d[i];
//	for(int i=1;i<=n;++i)printf("[%d]",c[i]);puts("->");
}
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;++i)scanf("%lld",&x[i]);
	for(int i=n;i>=1;--i)x[i]-=x[i-1];
	scanf("%d%lld",&m,&k);
	for(int j=1;j<=m;++j)scanf("%d",&a[j]);
	for(int j=1;j<=n;++j)c[j]=b[j]=j;
	for(int j=1;j<=m;++j)swap(b[a[j]],b[a[j]+1]);
	for(;k;k>>=1,mul(b,b,b))
		if(k&1)mul(c,b,c);
	ll tg=0;
	for(int i=1;i<=n;++i)
		tg=(tg+x[c[i]]),printf("%lld\n",tg);
}

Measured memory_bytes: 3584
#include <stdio.h>
#include <stdlib.h>

signed compare(const void *a, const void *b){
	return *(int *)b - *(int *)a;
}

int main(){
	int N, i;
	scanf("%d", &N);
	int *a = (int *)malloc(sizeof(int) * N);
	for(i = 0; i < N; i++){
		scanf("%d", &a[i]);
		a[i]--;
	}
	qsort(a, N, sizeof(int), compare);
	for(i = 0; i < N; i++){
		if(a[i] < i){
			break;
		}
	}
	i--;
	int k = a[i] - i, l;
	for(l = 0; l < N; l++){
		if(a[l] < i){
			break;
		}
	}
	l = l - i - 1;
//	printf("(k, l) = (%d, %d)\n", k, l);
	if(k % 2 == 0 && l % 2 == 0){
		printf("Second\n");
	}
	else{
		printf("First\n");
	}
	return 0;
}

Measured memory_bytes: 892
import string
import sys
s = str(raw_input())
if (s[0] == 'A') & (s[2:-1].count('C') == 1):
	if (s.count('A') == 1) & (s.count('C') == 1):
		strans = s.translate(string.maketrans("AC", "ac"))
		slower = s.lower()
		if strans == slower:
			print 'AC'
			sys.exit()
print 'WA'

Measured memory_bytes: 2692
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <stdio.h>

using namespace std;

//typedefリスト
typedef vector<int> vint;
typedef vector<string> vstr;




int main(void) {
	int N,ans;
	ans = 0;
	cin >> N;
	vint d(N);
	map<int, int>mp;
	for (int i = 0; i < N; i++) {
		cin >> d[i];
		mp[d[i]]++;
		if (mp[d[i]] < 2)ans++;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.*;import java.io.*;import java.math.*;
public class Main
{
    public static void process()throws IOException
    {
        int n=ni();
        int m=ni();
        int[]A=new int[n+1];
        Arrays.fill(A,0);
        int pen=0,ac=0;
        for(int i=0;i<m;i++)
        {
            int x=ni();
            String s=sc.next();
            if(A[x]==-1)
                continue;
            if(s.equals("AC"))
            {
                pen+=A[x];
                A[x]=-1;
                ac++;
            }
            else
                A[x]++;
        }
        pn(ac+" "+pen);
    }

    static AnotherReader sc;
    static PrintWriter out;
    public static void main(String[]args)throws IOException
    {
        boolean oj = true;
        if(oj){sc=new AnotherReader();out=new PrintWriter(System.out);}
        else{sc=new AnotherReader(100);out=new PrintWriter("output.txt");}
        int t=1;
        // t=ni();
        while(t-->0) {process();}
        out.flush();out.close();  
    }

    static void pn(Object o){out.println(o);}
    static void p(Object o){out.print(o);}
    static void pni(Object o){out.println(o);out.flush();}
    static int ni()throws IOException{return sc.nextInt();}
    static long nl()throws IOException{return sc.nextLong();}
    static double nd()throws IOException{return sc.nextDouble();}
    static String nln()throws IOException{return sc.nextLine();}
    static int[] nai(int N)throws IOException{int[]A=new int[N];for(int i=0;i!=N;i++){A[i]=ni();}return A;}
    static long[] nal(int N)throws IOException{long[]A=new long[N];for(int i=0;i!=N;i++){A[i]=nl();}return A;}
    static long gcd(long a, long b)throws IOException{return (b==0)?a:gcd(b,a%b);}
    static int gcd(int a, int b)throws IOException{return (b==0)?a:gcd(b,a%b);}
    static int bit(long n)throws IOException{return (n==0)?0:(1+bit(n&(n-1)));}

/////////////////////////////////////////////////////////////////////////////////////////////////////////

    static class AnotherReader{BufferedReader br; StringTokenizer st;
    AnotherReader()throws FileNotFoundException{
    br=new BufferedReader(new InputStreamReader(System.in));}
    AnotherReader(int a)throws FileNotFoundException{
    br = new BufferedReader(new FileReader("input.txt"));}
    String next()throws IOException{
    while (st == null || !st.hasMoreElements()) {try{
    st = new StringTokenizer(br.readLine());}
    catch (IOException  e){ e.printStackTrace(); }}
    return st.nextToken(); } int nextInt() throws IOException{
    return Integer.parseInt(next());}
    long nextLong() throws IOException
    {return Long.parseLong(next());}
    double nextDouble()throws IOException { return Double.parseDouble(next()); }
    String nextLine() throws IOException{ String str = ""; try{
    str = br.readLine();} catch (IOException e){
    e.printStackTrace();} return str;}}
   
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
}

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

#define int long long
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

template<class T> struct BinaryIndexTree{
    int n;
    vector<T> bit; 
    vector<T> org;

    BinaryIndexTree(int si): bit(si+1), org(si+1) { n = si; }; 

    void add(int idx, T v){
        org[++idx] += v;
        for(int i = idx;i <= n;i+=i&-i) bit[i] += v;
    }

    void update(int idx, T v){
        T vv = v - org[++idx];
        org[idx] = v;
        for(int i = idx;i <= n;i+=i&-i) bit[i] += vv;
    }

    T sum(int a){
        T ret = 0;
        for(int i = a;i > 0;i-=i&-i) ret += bit[i];
        return ret;
    }

    T sum(int l, int r) { return sum(r)-sum(l); }; 
};

#define MOD 998244353

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

	BinaryIndexTree<int> bit(3*n);
	int l[100];
	int r[100];

	for(int i = 0;i < k;i++){
		cin >> l[i] >> r[i];
		l[i];
		r[i]++;
	}

	bit.update(n-1, 1);

	int ans;
	for(int i = n-2;i >= 0;i--){
		ans = 0;
		for(int j = 0;j < k;j++){
			ans += bit.sum(i+l[j], i+r[j]); 
			ans %= MOD;
		}
		bit.update(i, ans);
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 12756
#include<bits/stdc++.h>
using namespace std;
typedef long long l;
int main(){
    l x,y=1;
    cin>>x;
    for(int i=2;i*i<=x;i++){
        for(int j=2;pow(i,j)<=x;j++){
            if(y<pow(i,j)) y=pow(i,j);
        }
    }
    cout<<y<<endl;
}
    

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

int main(){
	bool id[31] = {0};
	for(int i = 1; i <= 28; i++){
		int tmp;
		cin >> tmp;
		id[tmp] = true;
	}

	for(int i = 1; i <= 30; i++){
		if(!id[i]) cout << i << endl;
	}
	return 0;
}

Measured memory_bytes: 1160