akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll N;
vector<ll> a,b;
ll sx(ll p){
  return (p-1+N)%N;
}
ll dx(ll p){
  return (p+1)%N;
}
ll s(ll p){
  return a[p]+a[sx(p)]+a[dx(p)];
}
ll bb(ll p){
  return b[sx(p)]+b[dx(p)];
}
bool finito(){
	for(ll i=0;i<N;i++){
		if(a[i]!=b[i])return 0;
	}
	return 1;
}
int main(){
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
		ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
		cin>>N;
		for(ll i=0;i<N;i++){
			ll k;
			cin>>k;
			a.push_back(k);
		}
		for(ll i=0;i<N;i++){
			ll k;
			cin>>k;
			b.push_back(k);
		}
		for(ll i=0;i<N;i++){
			if((a[i]<b[i] && s(i)>b[i])|| a[i]>b[i]){
				cout<<-1;
				return 0;
			}
		}
		ll tot=0;
		while(1){
			if(finito()){
				cout<<tot;
				return 0;
			}
			bool f=0;
			for(ll i=0;i<N;i++){
				if(bb(i)+a[i]<=b[i]){
					tot+=(b[i]-a[i])/bb(i);
					b[i]=(b[i]-a[i])%bb(i)+a[i];
					f=1;
				}
			}
			if(f==0){
				cout<<-1;
				return 0;
			}
		}
		return 0;
}


Measured memory_bytes: 5744
#include <stdio.h>
#include <math.h>      

#define mod 1000000007 

int main(void) {
    //code goes 
	int c11,c12,c13,c21,c22,c23,c31,c32,c33; 
	scanf("%d %d %d %d %d %d %d %d %d",&c11,&c12,&c13,&c21,&c22,&c23,&c31,&c32,&c33); 
	if(c11+c22==c21+c12 && c21+c32==c22+c31 && c12+c23==c22+c13 && c33+c22==c23+c32) 
	    printf("Yes"); 
	else      
	    printf("No");
	return 0;
}



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

int main(){
    string s;
    cin >> s;
    int a[20];
    int min  =100000;
    for(int i=0;i<s.length()-2;i++){
        a[i] = 100*(s[i]-'0') + 10*(s[i+1]-'0') + (s[i+2]-'0');
        if(min > abs(a[i]-753)){
            min = abs(a[i]-753);
        }
    }
    cout << min << endl;
    return 0;
}

Measured memory_bytes: 256
const main = stdin => {
  const input = stdin.trim().split('\n')

  const b = input[0]
  switch (b) {
    case 'A':
      console.log('T')
      break;
    case 'T':
      console.log('A')
      break;
    case 'C':
      console.log('G')
      break;
    case 'G':
      console.log('C')
      break;
    default:
      break;
  }
}
// 標準入力
main(require("fs").readFileSync("/dev/stdin", "utf8"))


Measured memory_bytes: 29540
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'
#define pb push_back
#define sz(x) ((int)x.size())

const int mod = 1000*1000*1000 + 7;
int n, k;
int a[55][55] = {{0}}, res[55][55] = {{0}};

void mul(int l[55][55], int r[55][55])
{
    int temp[55][55] = {{0}};
    for(int i = 1; i <= n; i++)
        for(int j = 1; j <= n; j++)
            for(int p = 1; p <= n; p++)
                temp[i][j] += (l[i][p]*r[p][j])%mod, temp[i][j] %= mod;
    for(int i = 1; i <= n; i++)
        for(int j = 1; j <= n; j++)
            l[i][j] = temp[i][j];
}

int solve()
{
    while(k)
    {
        if(k&1)
            mul(res, a);
        mul(a, a);
        k /= 2;
    }
    int sum = 0;
    for(int i = 1; i <= n; i++)
        for(int j = 1; j <= n; j++)
            sum += res[i][j], sum %= mod;
    return sum;
}

int32_t main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> n >> k;
    for(int i = 1; i <= n; i++) {
        res[i][i] = 1;
        for(int j = 1; j <= n; j++)
            cin >> a[i][j];
    }
    cout << solve() << endl;
}

Measured memory_bytes: 3728
#include <cstdio>
#include <algorithm>
#include <cstring>
#define N 100005
#define fi(a, b, c) for(int a = (b); a < (c); a++)
#define FI(a, b, c) for(int a = (b); a <= (c); a++)
using namespace std;

int n;
char s[N];

int main(){
	scanf("%s", s);
	n = strlen(s);
	
	if(n >= 4 && s[0] == 'Y' && s[1] == 'A' && s[2] == 'K' && s[3] == 'I'){
		puts("Yes");
	}else{
		puts("No");
	}
}

Measured memory_bytes: 128
N = int(input())
S = [input() for i in range(N)]

ac = S.count('AC')
wa = S.count('WA')
tle = S.count('TLE')
re = S.count('RE')

print('AC x ' + str(ac))
print('WA x ' + str(wa))
print('TLE x ' + str(tle))
print('RE x ' + str(re))

Measured memory_bytes: 16160
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<math.h>
using namespace std;
int main() {
  int a,b,c,d;
  cin >> a >> b >> c >> d;
  
  int st = max(a,c);
  int en = min(b,d);
  
  int ans = en-st;
  if (ans < 0) {
    ans = 0;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pii pair<int, int>;
#define ss second
#define ff first
#define all(x) ((x).begin(), (x).end())

using namespace std;
using ll = long long;

const int mod = 1e9 + 7;
const ll oo = 1 << 31;

int main(void){
    int n;
    cin >> n;
    cout << (n*800) - ((n/15)*200) << endl;

return 0;
}

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

using namespace std;

const int mod = 1e9 + 7;
const int N = 3005;

int n, m;
int f[N][N][2];

void Inc(int &u, const int v) { if((u += v) >= mod) u -= mod; }

int main() {
    scanf("%d %d", &n, &m);
    f[0][0][1] = 1;
    for(int i = 1; i <= n; ++i)
        f[0][i][0] = 1;
    for(int i = 0; i < m; ++i) {
        for(int j = 1; j <= n; ++j) {
            // 00
            if(j == 1) Inc(f[i + 1][j - 1][1], f[i][j][0]);
            else Inc(f[i + 1][j - 1][0], f[i][j][0]);
            Inc(f[i + 1][j - 1][1], f[i][j][1]);
            // 01
            if(j == 1) Inc(f[i + 1][j][1], f[i][j][0]);
            else Inc(f[i + 1][j][0], f[i][j][0]);
            Inc(f[i + 1][j][1], f[i][j][1]);
        }
        for(int j = 0; j < n; ++j) {
            // 10
            Inc(f[i + 1][j][0], f[i][j][0]);
            Inc(f[i + 1][j][1], f[i][j][1]);
            // 11
            Inc(f[i + 1][j + 1][0], f[i][j][0]);
            Inc(f[i + 1][j + 1][1], f[i][j][1]);
        }
    }
    int ans = 0;
    for(int i = 0; i <= n; ++i)
        Inc(ans, f[m][i][1]);
    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 70656
#include<stdio.h>
int main(viod)
{
    int n,i,j,k,o = 2;
    char l[1000001] = {0};
    int count = 0;
    while(scanf("%d",&n)!= EOF)
    {   if(n==1)
        {
            count = 0;
        }
        else
        {
            for(i = o;i<=n;i++)
            {   o++;
                if(l[i] == 1) continue;
                else
                {
                    count++;
                    for(j = i;j<=n;j+=i)
                    {
                        l[j] = 1;
                    }
                }
            }
        }
    printf("%d\n",count);
    for(k = 2;k <= n;k++) l[k] = 0;
    count = 0;
    o = 2;
    }
    return 0;
}

Measured memory_bytes: 1576
package main

import (
        "fmt"
)

func solution(n, m int, k []int, a [][]int) int {
        memo := make([]int, m+1)
        for i := 0; i < n; i++ {
                for j := 0; j < k[i]; j++ {
                        memo[a[i][j]]++
                }
        }
        c := 0
        for _, v := range memo {
                if v == n {
                        c++
                }
        }
        return c
}

func main() {
        var n, m int
        fmt.Scan(&n, &m)
        k := make([]int, 0, n)
        a := make([][]int, n)
        for i := 0; i < n; i++ {
                kt := 0
                fmt.Scan(&kt)
                k = append(k, kt)
                a[i] = make([]int, 0, kt)
                for j := 0; j < kt; j++ {
                        t := 0
                        fmt.Scan(&t)
                        a[i] = append(a[i], t)
                }
        }
        fmt.Println(solution(n, m, k, a))
}

Measured memory_bytes: 640
from collections import defaultdict
MOD = 998244353
n, s = map(int, input().split())
a = list(map(int, input().split()))

# dp[i][j] = i番目まで見て和がjとなるような場合の数
dp = [[0] * (s + 1) for _ in range(n + 1)]
dp[0][0] = 1
for i, ai in enumerate(a):
    for j in range(s + 1):
        if j - ai >= 0:
            dp[i + 1][j] = (dp[i][j] * 2 + dp[i][j - ai]) % MOD
        else:
            dp[i + 1][j] = dp[i][j] * 2 % MOD

# print(*dp, sep='\n')
print(dp[n][s])


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

using namespace std;

#define INF 1000000009
#define INFLL 0x3f3f3f3f3f3f3f3fLL 
#define EPS 10e-9
#define MOD 1000000007
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define st first
#define nd second
#define sz(v) int(v.size())
#define all(X) (X).begin(), (X).end()
#define FOR(I, A, B) for(int I = A; I < B; I++)
#define RFOR(I, A, B) for(int I = A; I >= B; I--)

typedef long long ll;
typedef pair<int,int> ii;
typedef pair<int,ii> iii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<vii> vvii;
typedef vector<iii> viii;
typedef vector<ll> vll;

ll PD[101][100005];

int main(){
	int n, W;
	scanf("%d %d", &n, &W);

	FOR(i, 0, 101){
		FOR(j, 0, 100005){
			PD[i][j] = INF;
		}
	}
	PD[0][0] = 0;
	FOR(i, 1, n+1){
		int w, v;
		scanf("%d %d", &w, &v);
		FOR(j, 0, v){
			PD[i][j] = PD[i-1][j];
		}
		FOR(j, v, 100005){
			PD[i][j] = min(PD[i-1][j-v] + w, PD[i-1][j]);
		}
	}
	ll ans = 0;
	FOR(i, 0, 100005){
		if(PD[n][i] <= W){
			ans = max(ans, (ll)i);
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 79104
n=int(input())

while n:
    n-=1
    lis=list(map(int,input().split()))
    for i in range(3):
        for j in range(i+1,3):
            if lis[i]<lis[j]:
                a=lis[i]
                lis[i]=lis[j]
                lis[j]=a

    c,a,b=lis
    if c**2==a**2+b**2:
        print("YES")

    else:
        print("NO")

    

Measured memory_bytes: 6720
using namespace std;
#include<bits/stdc++.h>
#define int long long
#define pb push_back 
#define IOS ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ff first
#define ss second
#define all(x) x.begin(), x.end()
#define repa(i,a,b) for (int i=a; i<=b; i++)
#define repd(i,b,a) for (int i=b; i>=a; i--)
#define endl "\n"
//debugging
#define debug1(a) cout<<#a<<" = "<<(a)<<endl;
#define debug2(a,b) cout<<#a<<" = "<<(a)<<", "<<#b<<" = "<<(b)<<endl;
#define debug3(a,b,c) cout<<#a<<" = "<<(a)<<", "<<#b<<" = "<<(b)<<", "<<#c<<" = "<<(c)<<endl;
#define debug4(a,b,c,d) cout<<#a<<" = "<<(a)<<", "<<#b<<" = "<<(b)<<", "<<#c<<" = "<<(c)<<", "<<#d<<" = "<<(d)<<endl;

const int N = 1e+6+5;
int big = 1e+18+3;
int mod = 1e+9+7;

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

    map<int,int>freq1,freq2;

    repa(i,1,n)
    {
        int buf; cin>>buf;
        freq1[(-i-buf)]++;
        freq2[(buf-i)]++;
    }   

    int ans = 0;

    for (auto it:freq1)
        ans+=it.ss*(freq2[it.ff]);

    cout<< ans <<endl;
}

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

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

            string zenhan = "";
            string kouhan = "";

            List<char> zen;
            List<char> kou;

            int ans = 0;

            for (int i = 1; i < N - 1; i++) {
                zenhan = S.Substring(0, i);
                kouhan = S.Substring(i, N - i);

                zen = zenhan.ToCharArray().ToList();
                kou = kouhan.ToCharArray().ToList();

                ans = Math.Max(ans, zen.Intersect(kou).Distinct().Count());


            }


            Console.WriteLine(ans);
        }

    }
}


Measured memory_bytes: 13396
#include <cstdio>
#include <cstring>
#include <vector>
#include <queue>
#include <string>
#include <algorithm>
#include <iostream>
#include <string>
#include <map>
#include <set>
#include <functional>
#include <iostream>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int n;
int a[100001];
int cnt[100001];

int main(void){
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		scanf("%d",&a[i]);
		cnt[a[i]]++;
	}
	ll res=1;
	for(int i=n-1;i>=0;i-=2){
		if(i==0){
			if(cnt[i]==1)res=res;
			else res=0;
		}else{
			if(cnt[i]==2)res=res*2LL%MOD;
			else res=0;
		}
	}
	for(int i=n-2;i>=0;i-=2){
		if(cnt[i]!=0)res=0;
	}
	printf("%lld\n",res);
	return 0;
}


Measured memory_bytes: 1024
# coding: utf-8
#N = int(input())
A,V=map(int, input().split())
B,W=map(int, input().split())
T=int(input())

if V<=W:
    print("NO")
    quit()

SA=abs(A-B)
CHIJI=(V-W)
SA=SA-(CHIJI*T)
#print(SA)
    
if SA<=0:
    print("YES")
else:
    print("NO")

Measured memory_bytes: 9216
#include <cassert>
#include <cstdio>
#include <iostream>

using namespace std;

namespace {

struct Process {
  char name[12];
  // required time to process this task.
  int time;
};

// Ring-buffer based queue. Enqueue and dequeue run in O(1).
template <int N>
class Queue {
 public:
  // Note: leave one element empty so that we can distinguish
  // that the ring buffer is empty or full.
  Queue() : size_(N + 1), head_(0), tail_(0) {}

  void Enqueue(Process& p) {
    assert(!IsFull());
    data_[tail_] = p;
    tail_ = next(tail_);
  }

  Process& Dequeue() {
    assert(!Empty());
    Process& p = data_[head_];
    head_ = next(head_);
    return p;
  }

  bool IsFull() const { return head_ == next(tail_); }

  bool Empty() const { return head_ == tail_; }

 private:
  int next(int a) const { return (a + 1) % size_; }

  Process data_[N + 1];
  const int size_;
  int head_;
  int tail_;
};

}  // namespace

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

  Queue<100000> queue;
  for (int i = 0; i < n; ++i) {
    Process p;
    scanf("%s %d", p.name, &p.time);
    queue.Enqueue(p);
  }

  int current_time = 0;
  while (!queue.Empty()) {
    auto p = queue.Dequeue();
    const int used = min(p.time, q);
    p.time -= used;
    current_time += used;

    if (p.time <= 0) {
      printf("%s %d\n", p.name, current_time);
      continue;
    }
    queue.Enqueue(p);
  }
  return 0;
}

Measured memory_bytes: 4732
#include <algorithm>
#include <cassert>
#include <cfloat>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
 
#define FOR(i,k,n) for (int (i)=(k); (i)<(n); ++(i))
#define rep(i,n) FOR(i,0,n)
#define all(v) begin(v), end(v)
#define debug(x) cerr<< #x <<": "<<x<<endl
#define debug2(x,y) cerr<< #x <<": "<< x <<", "<< #y <<": "<< y <<endl
 
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<ll> vll;
typedef vector<vector<ll> > vvll;
typedef deque<bool> db;
template<class T> using vv=vector<vector< T > >;

int main() {
  ll a, b, c;
  cin >> a >> b >> c;
  int cnt = 0;
  int inf = 1000000;
  while (cnt < inf) {
    if (a % 2 == 1 || b % 2 == 1 || c % 2 == 1) { break; }
    ll a_ = (b + c) / 2;
    ll b_ = (c + a) / 2;
    ll c_ = (a + b) / 2;
    a = a_; b = b_; c = c_;
    cnt += 1;
  }
  if (cnt == inf) {
    printf("-1\n");
  } else {
    printf("%d\n", cnt);
  }

  return 0;
}


Measured memory_bytes: 888
#include<iostream>
#include<algorithm>

using namespace std;

int partition(int *A, int p, int r){
  int x = A[r];
  int i = p - 1;
  for(int j = p;j < r;j++){
    if(A[j] <= x){
      i++;
      swap(A[i], A[j]);
    }
  }
  swap(A[i + 1], A[r]);
  return i + 1;
}

int main(){

  int n, a[100000], q;

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

  q = partition(a, 0, n - 1);

  for(int i = 0;i < n;i++){
    cout << (i?" ":"");
    if(i == q) cout << '[' << a[i] << ']';
    else cout << a[i];
  }
  cout << endl;

  return 0;
}



Measured memory_bytes: 3368
using System;
using System.Linq;

namespace MSBPC2019
{
    class B
    {
        static void Main(string[] args)
        {
            long N = long.Parse(Console.ReadLine());

            for (double i = 0; i <= N; i++)
            {
                //Console.WriteLine((long)(i * 1.08));
                if (N == (long)(i * 1.08)) { Console.WriteLine(i); return; }
            }
            Console.WriteLine(":(");
        }
    }
}


Measured memory_bytes: 11092
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

n,m,c = iim()
B = iil()
ans = 0
for i in range(n):
    A = iil()
    cond = c
    for x,y in zip(A,B):
        cond += x*y
    if cond > 0:
        ans += 1
print(ans)

Measured memory_bytes: 3064
n = int(input())
d = {}
for i in range(n):
    s = input()
    for w in d:
        if s.count(w)==0:
            d[w]=0
    for c in s:
        if i==0:
            d[c] = d.get(c, 0) + 1
        else:
            d[c] = min(d.get(c, 0), s.count(c))

li = []
for w in d:
    for i in range(d[w]):
        li.append(w)
li.sort()
print("".join(li))

Measured memory_bytes: 9172
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define rep(i,n) for (int i = (0); i < (n); ++i)
#define rng(x) (x).begin(),(x).end()
#define rrng(x) (x).rbegin(),(x).rend()
#define show(x) cout << #x << " = " << (x) << endl
#define show2(x,y) cout << #x << " = " << (x) << ", " << #y << " = " << (y) << endl
#define show3(x,y,z) cout << #x << " = " << (x) << ", " << #y << " = " << (y) <<  ", " << #z << " = " << (z) << endl
#define showv(v) rep(i,v.size()) printf("%d%c", v[i], i==v.size()-1?'\n':' ')
#define showv2(v) rep(j,v.size()) showv(v[j])
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define uni(x) x.erase(unique(rng(x)),x.end())
#define SP << " " <<
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
const int mod = 1000000007;
const double EPS = 1e-9;
const int INF = (1<<30)-1;
const ll INFLL = (1LL<<62)-1;
//cout << fixed << setprecision(10);

//const int mod = 1000000007;
// mint(a).pow(b) -> a^b       mint(a).pow(b).x
// comb.fact[5] -> 5! = 120    comb.fact[5].x,  mint(2)*comb.fact[5]
struct mint {
  ll x;
  mint(ll x=0):x(x%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};

struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    // nCkを計算するならnの最大値を渡す combination c(n+5); -> nCk = c(n,k).x
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
};

int main () {
  int n, k;
  cin >> n >> k;
  vi a(n);
  rep(i,n) cin >> a[i];
  sort(a.begin(), a.end());

  combination c(n+5);

  mint ans = 0;
  rep(ri,2) {
    rep(i,n) {
      mint now = c(i,k-1);
      if (ri == 1) now = -now;
      ans += now*a[i];
    }
    reverse(rng(a));
  }

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

Measured memory_bytes: 2176
#include<bits/stdc++.h>
#define int long long
using namespace std;
constexpr int mod=1e9+7;
signed main(){
    int k;
    cin>>k;
    if(k%2==0||k%5==0){
        cout<<-1<<endl;
        return 0;
    }
    for(int i=1,tmp=7%k;;i++,tmp=(tmp*10+7)%k)
        if(tmp==0){
            cout<<i<<endl;
            return 0;
        }
}


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

int main() {
    int A, B, K;
    cin >> A >> B >> K;

    for (int k = 0; k < K; k++) {
        if (k % 2 == 0) {
            B += A / 2;
            A /= 2;
        } else {
            A += B / 2;
            B /= 2;
        }
    }
    cout << A << " " << B << endl;
}


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

int main() {
	int N, Q;
	cin >> N >> Q;
	string S;
	cin >> S;
	vector<vector<int>> data(Q, vector<int>(2,0));
	for (int i = 0; i < Q; i++) {
		cin >> data.at(i).at(0) >> data.at(i).at(1);
	}
	vector<int> vec(N);
	int AC = 0;
	for (int i = 0; i < N-1; i++) {
			if (S.at(i) == 'A' && S.at(i + 1) == 'C') {
				AC++;
				vec.at(i) = -1;
				vec.at(i + 1) = AC;
			}
			else {
				vec.at(i) = AC;
			}
	}
	vec.at(N - 1) = AC;
	for (int i = 0; i < Q; i++) {
		int start, end;
		if (vec.at(data.at(i).at(0) - 1) == -1) {
			start = vec.at(data.at(i).at(0)) - 1;
		}
		else {
			start = vec.at(data.at(i).at(0) - 1);
		}
		if (vec.at(data.at(i).at(1) - 1) == -1) {
			end = vec.at(data.at(i).at(1) - 2);
		}
		else {
			end = vec.at(data.at(i).at(1) - 1);
		}
		AC = end - start;
		cout << AC << endl;
	}
}

Measured memory_bytes: 6784
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); i++)
#define all(x) (x).begin(),(x).end()
#define dup(x,y) (((x)+(y)-1)/(y))
#define sz(x) (int)(x).size()
#define MOD 1000000007
using namespace std;
typedef long long ll;

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

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

namespace AtCoderABC115
{
    class Program
    {
        public static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split(' ');
            long N = long.Parse(s[0]);
            int K = int.Parse(s[1]);
            List<long> h = new List<long>();
            for (int i = 0; i < N; i++) { h.Add(long.Parse(Console.ReadLine())); }
            h = h.OrderByDescending(x => x).ToList();
            List<long> diffh = new List<long>();
            for (int i = 0; i < N - K + 1; i++) { diffh.Add(h[i] - h[i + K - 1]); }
            diffh = diffh.OrderBy(x => x).ToList();
            Console.WriteLine(diffh[0]);
        }
    }
}

Measured memory_bytes: 26588
/*
    JAI JAGANNATH!
*/
//@Author : zanj0
#include <bits/stdc++.h>
#define fastio  ios_base::sync_with_stdio(false);cin.tie(NULL);
using namespace std;
typedef long long int lli;
const lli N = 1e5 + 5;
vector < lli > graph[N];
void dfs(lli node, lli parent, vector <lli>& dist){
    for(lli i = 0; i < graph[node].size(); i++){
        lli next = graph[node][i];
        if(next != parent){
            dist[next] = dist[node] + 1;
            dfs(next, node, dist);
        }
    }
}
void solve(){
    lli n, u, v;
    cin >> n >> u >> v;
    for(lli i = 1; i <= n - 1; i++){
        lli x, y;
        cin >> x >> y;
        graph[x].push_back(y);
        graph[y].push_back(x);
    }
    vector <lli> distU(N);
    vector <lli> distV(N);
    dfs(u, -1, distU);
    dfs(v, -1, distV);
    lli ans = INT_MIN;
    for(lli i = 1; i <= n; i++ ){
        if(distU[i] < distV[i]){
            ans = max(ans, distV[i]);
        }
    }
    cout << ans - 1 << endl;
}
int main(){
    
    fastio
    solve();
    return 0;
}



Measured memory_bytes: 13824
#include<bits/stdc++.h>
#define ll long long int
#define mi map<int,int>
#define mcr map<char,int>
using namespace std;

int main()
{
    ll a, ans = 0;
    cin >> a;
    cout << a + pow(a, 2) + pow(a, 3) << endl;
    return 0;
}


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

int main(){
  string S;
  cin >> S;
  for (int i = 0; (unsigned)i < S.size(); i++){
    if (S.at(i) == '?'){
      S.at(i) = 'D';
    }
  }
  cout << S;
}

Measured memory_bytes: 3720
#include <iostream>
#include <vector>

using namespace std;

template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}

int main() {
  int N;
  long long W;
  cin >> N >> W;
  vector<int> w(N);
  vector<long long> v(N);
  for (int i = 0; i < N; i++) {
    cin >> w[i] >> v[i];
  }

  vector<vector<long long>> dp(N + 1, vector<long long>(W + 1, 0));
  for (int i = 0; i < N; i++) {
    for (int j = 0; j <= W; j++) {
      if (0 <= j - w[i]) {
        chmax(dp[i + 1][j], dp[i][j - w[i]] + v[i]);
      }
      chmax(dp[i + 1][j], dp[i][j]);
    }
  }

  cout << dp[N][W] << endl;

  return 0;
}

Measured memory_bytes: 80256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

struct node{
  int key;
  struct node *next;
  struct node *prev;
};

typedef struct node * NodePointer;

NodePointer nil;
/////////////////////////
void insert(int a){
  NodePointer n;
  n=malloc(sizeof(struct node));
  n->key=a;
  n->next=nil->next;
  nil->next->prev=n;
  n->prev=nil;
  nil->next=n;
}
/////////////////////////
void delete(int a){
  NodePointer n;
  for(n=nil->next;n!=nil;n=n->next){
    if(n->key==a){
      n->prev->next=n->next;
      n->next->prev=n->prev;
      free(n);  
      break;
    }
  }
}
/////////////////////////
void deleteFirst(void){
  NodePointer n;
  n=nil->next;
  nil->next=n->next;
  n->next->prev=nil;
  free(n);
}
void deleteLast(void){
  NodePointer n;
  n=nil->prev;
  n->prev->next=nil;
  nil->prev=n->prev;
  free(n);
}
void init(void){
  nil=malloc(sizeof(struct node));
  nil->key=-1;
  nil->next=nil;
  nil->prev=nil;
}
int main(void){
  int i,n,key;
  char com[12];
  NodePointer k;
  scanf("%d", &n);
  init();

  for ( i = 0; i < n; i++ ){
    scanf("%s%d", com, &key);

    if ( com[0] == 'i' ) {
      insert(key);
    } else if ( com[0] == 'd' ) {
      if (strlen(com) > 6){
	if ( com[6] == 'F' ) {
	  deleteFirst();
	} else if ( com[6] == 'L' ) {
	  deleteLast();
	}
      } else {
	delete(key);
      }
    }
  }

  for(k=nil->next; k->key!=nil->key; k=k->next){
    if(k != nil->next)printf(" ");
    printf("%d",k->key);
  }
  printf("\n");
  return 0;
}

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

int main(){
    int w,h,x,y,r;
    cin >> w >> h >> x >> y >> r;
    if(r <= x && x <= w-r && r<=y && y<=h-r)
        cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 3096
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <numeric>

using namespace std;


int main()
{
    string s;
    cin >> s;
    int len = s.length();
    int n = (len + 1) / 2;
    int cnt = 0;
    for(int i = 0;i < n;i++)
    {
        if(s[i] != s[len - 1 - i])
        {
            cnt++;
        }
    }
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std;
string s, t;
int in[26], out[26], vis[26][26];
int main() {
  cin >> s >> t;
  for (int i = 0; i < s.size(); i++) {
    if (!vis[s[i] - 'a'][t[i] - 'a']) in[s[i] - 'a']++, out[t[i] - 'a']++, vis[s[i] - 'a'][t[i] - 'a'] = 1;
  }
  int ok = 1;
  for (int i = 0; i < 26; i++) if (in[i] > 1 || out[i] > 1) ok = 0;
  if (ok) printf("Yes\n");
  else printf("No\n");
}


Measured memory_bytes: 3884
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.Map;
import java.util.NoSuchElementException;

public class Main {
	public static void main(String[] args){
		FastScanner sc = new FastScanner();
		PrintWriter out = new PrintWriter(System.out);
		int N = sc.nextInt();
		int M = sc.nextInt();
		Map<Integer, Integer> matMap = new HashMap<>();
		for(int i=0;i<M;i++){
			int x = sc.nextInt();
			int y = sc.nextInt();
			if(matMap.get(x)==null){
				matMap.put(x, y);
			}else if(matMap.get(x)>y){
				matMap.put(x, y);
			}
		}
		Map<Integer, Integer> testMap = new HashMap<>();
		for(int i=1;i<=N;i++){
			testMap.put(matMap.get(i), i);
		}
		int end =0;
		int count =0;
		for(int i=1;i<=N;i++){
			if(testMap.get(i)==null) continue;
			else if(end<=testMap.get(i)){
				count++;
				end = i;
			}
		}
		out.println(count);
		out.flush();
	}
}


class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }
    public double nextDouble() { return Double.parseDouble(next());}
}

Measured memory_bytes: 51788
/*                         _
                        _ooOoo_
                       o8888888o
                       88" . "88
                       (| -_- |)
                       O\  =  /O
                    ____/`---'\____
                  .'  \\|     |//  `.
                 /  \\|||  :  |||//  \
                /  _||||| -:- |||||_  \
                |   | \\\  -  /'| |   |
                | \_|  `\`---'//  |_/ |
                \  .-\__ `-. -'__/-.  /
              ___`. .'  /--.--\  `. .'___
           ."" '<  `.___\_<|>_/___.' _> \"".
          | | :  `- \`. ;`. _/; .'/ /  .' ; |
          \  \ `-.   \_\_`. _.'_/_/  -' _.' /
===========`-.`___`-.__\ \___  /__.-'_.'_.-'================

                  Please give me AC.
*/

#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <numeric>
#include <string>
#include <sstream>
#include <complex>
#include <bitset>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <chrono>
#include <random>

using namespace std;

using int64 = long long;
using uint64 = unsigned long long;
using vi = vector<int>;
using vl = vector<int64>;
using pii = pair<int, int>;
using pll = pair<int64, int64>;

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(v) (v).begin(), (v).end()
#define print(x) cout << (x) << '\n'
#define print2(x, y) cout << (x) << ' ' << (y) << '\n'
#define print3(x, y, z) cout << (x) << ' ' << (y) << ' ' << (z) << '\n'
#define printn(v) rep(i, (v).size() - 1) cout << (v)[i] << ' '; cout << (v)[n - 1] << '\n';
#define debug(x) cerr << #x << ": " << (x) << '\n'
#define debug2(x, y) cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << '\n'
#define debug3(x, y, z) cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << ", " << #z << ": " << (z) << '\n'
#define dbg(v) for (size_t _ = 0; _ < v.size(); ++_){cerr << #v << "[" << _ << "] : " << v[_] << '\n';}
// constant
const int INF = (1<<30) - 1;
const int64 INF64 = (1LL<<62) - 1;

template<typename T> T gcd(T a, T b) {
    if (a < b) return gcd(b, a);
    T r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}

template<typename T> T lcm(const T a, const T b) {
    return a / gcd(a, b) * b;
}

template<typename T> bool chmin(T& a, const T& b) {
    if (a > b) return a = b, true; else return false;
}

template<typename T> bool chmax(T& a, const T& b) {
    if (a < b) return a = b, true; else return false;
}

// End of template.

int main() {
    cout << fixed << setprecision(15);
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    // cin.read(buf, sizeof buf); // 注意: ./a.out < in か pbp | ./a.out で入力すること

    string s, t;
    cin >> s >> t;

    bool ok = true;
    rep(i, s.size()) {
        ok &= s[i] == t[i];
    }

    if (ok)
        print("Yes");
    else
        print("No");

    return 0;
}



Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0; i<(n); i++)
int main() {
  int n;
  cin >> n;
  vector<int> x(n);
  rep(i,n) cin >> x[i];
  vector<int> y = x;
  sort(y.begin(), y.end());
  rep(i,n){
    if(x[i]<=y[n/2-1]) {
      cout << y[n/2] << endl;
      continue;
    }
    if(x[i]>=y[n/2]) {
      cout << y[n/2-1] << endl;
      continue;
    }
  }
}

Measured memory_bytes: 3712
#include<algorithm>
#include<iostream>
#include<stdio.h>
#include<iostream>
#include<stdio.h>
#include<vector>
#include<set>
#include<string>
#include<iomanip>
#include<queue>
#include<functional>
#include<cmath>
#include<map>
#include<tuple>
#include <numeric>
#define rep(i,n) for(int i=0; i<(int)n; i++)//n回繰り返す
#define rrep(i,n)for(int i=n-1;i>=0;i--)
#define REP(i,n) for (int i = 1; i <= (int)n; i++)//i=1からi=nまで
#define RREP(i,n)for(int i=n;i>=1;i--)
using namespace std;
using ll = long long;
using P = pair<int, int>;
using graph = vector<vector<int>>;
const ll mod = pow(10, 9) + 7;
const int INF = 1e9;
const ll LINF = 1e18;
const double pi = 3.14159265358979323846;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main() {
    int v; cin >> v;
    if (v >= 30) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
}


  

























Measured memory_bytes: 3620
#include <iostream>
using namespace std;
int s[]={-1,1,0,0},t[]={0,0,1,-1},h,w,maze[50][50],nx,ny;
bool f(int x,int y){
    for(int i=0;i<4;i++){
        nx=s[i]+x;
        ny=t[i]+y;
        if(nx>=0&&nx<h&&ny>=0&&ny<w&&maze[nx][ny]=='#'){
            return true;
        }
    }
    return false;
}
int main(void){
    cin>>h>>w;
    for(int i=0;i<h;i++){
        string ss;
        cin>>ss;
        for(int j=0;j<w;j++){
            maze[i][j]=ss[j];
        }
    }
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            if(maze[i][j]=='#'&& !f(i,j) ){
                cout<<"No"<<endl;
                return 0;
            }
        }
    }
    cout<<"Yes"<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const ll mod = 1e9 + 7;
#define pival 3.14159265359
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pqq priority_queue
#define all(a) a.begin(),a.end()
#define sz(a) (ll)(a.size())
ll power(ll x,ll y,ll p) 
{ 
    ll res=1;  
    x=x%p;
    while (y > 0) 
    { 
        if(y&1) 
            res=(res*x)%p; 
        y=y>>1;
        x=(x*x)%p;   
    } 
    return res; 
}
const ll L = 1e5 + 5;
ll vis[L];
ll ans[L];
vector<ll>ad[L];
ll dfs(ll ind)
{
	ll i;
	ll temp = 0;
	vis[ind] = 1;
	for(i=0;i<sz(ad[ind]);i++)
	{
		if(!vis[ad[ind][i]])
			temp = max(temp, dfs(ad[ind][i]) + 1);
		else
			temp = max(temp, ans[ad[ind][i]] + 1);
	}
	return ans[ind] = temp;
}
int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
 	ll i,j,n,m,x,y;
 	cin >> n >> m;
 	for(i=0;i<m;i++)
 	{
 		cin >> x >> y;
 		ad[x].pb(y);
 	}
 	ll a = 0;
 	for(i=1;i<=n;i++)
 	{
 		if(!vis[i])
 			dfs(i);
 	}
 	for(i=1;i<=n;i++)
 		a = max(a, ans[i]);
 	cout << a << endl;
	return 0;
}

Measured memory_bytes: 9344
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, D; cin >> N >> D;
  vector<vector<int>> X(N, vector<int>(D));
  for (int i = 0; i < N; ++i) {
  for (int j = 0; j < D; ++j) {
  cin >> X[i][j];
  }
  }
  int ans = 0;
  for (int i = 0; i < N; ++i) {
    for (int j = i+1; j < N; ++j) {
      int norm = 0;
      for (int k = 0; k < D; ++k) {
        int diff = abs(X[i][k] - X[j][k]);
        norm += diff * diff;
      }
      bool flag = false;
      for (int k = 0; k <= norm; ++k) {
        if (k * k == norm) {
          flag = true;
        }
      }
      if (flag) ++ans;
    }
  }
  cout << ans << endl;
}

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

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

  vector<int> a(3);
  for (int i = 0; i < 3; i++) {
    cin >> a[i];
  }
  sort(a.begin(), a.end());
  string ans;
  ans = ((a[0] == a[1] && a[1] != a[2]) || (a[0] != a[1] && a[1] == a[2])) ? "Yes" : "No";
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
t = input()
ans = []
for i in range(len(t)):
    tt = t[i]
    if tt == '?':
        ans.append('D')
    else:
        ans.append(t[i])
    # if tt == 'D':
    #     ans += 1
    #     if i - 1 >= 0 and t[i - 1] == 'P':
    #         ans += 1
    # if tt == '?':
    #     ans += 1
    #     if i - 1 >= 0 and t[i - 1] == 'P':
    #         ans += 1
print("".join(ans))

Measured memory_bytes: 10880
#include <bits/stdc++.h>
using namespace std;
int dp[1001][1001];    
const int mod = 1e9 + 7;
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int h,w;
    cin >> h >> w;
    string a[h];
    for (int i=0; i < h; i++) cin >> a[i];
    dp[0][0] = 1;
    for (int i=0; i < h; i++) {
        for (int j=0; j < w; j++) {
            for (int row = i; row <= i+1; row++) {
                int col = j;
                if (row == i) col++;
                if (row < h && col < w && a[row][col]=='.') dp[row][col] += dp[i][j];
                if (dp[row][col]>=mod) dp[row][col] %= mod;
            }
        }
    }
    cout << dp[h-1][w-1] << "\n";
    return 0;
}

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

#define ff              first
#define ss              second
#define endl 			"\n"
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zerbefone(x)    __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define Pi 				acos(-1.0)
#define precise(x,y)    fixed<<setprecision(y)<<x
#define FIO             ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());

signed main()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	FIO;
	int tt = 1;
	// cin >> tt;
	while (tt--)
	{
		int n;
		cin >> n;
		int a[n + 1], b[n + 1], c[n + 1];
		int ans[n + 1][3];
		memset(ans, 0, sizeof(ans));
		for (int i = 1; i <= n; i++)
			cin >> a[i] >> b[i] >> c[i];
		ans[1][0] = a[1];
		ans[1][1] = b[1];
		ans[1][2] = c[1];
		for (int i = 2; i <= n; i++)
		{
			ans[i][0] = a[i] + max(ans[i - 1][1], ans[i - 1][2]);
			ans[i][1] = b[i] + max(ans[i - 1][0], ans[i - 1][2]);
			ans[i][2] = c[i] + max(ans[i - 1][1], ans[i - 1][0]);
		}
		cout << max(max(ans[n][0], ans[n][2]), ans[n][1]) << endl;
	}
	return 0;
}


Measured memory_bytes: 8328
# -*- coding: utf-8 -*-
def cout_dif(a, b):
    sum = 0
    for i in range(len(a)):
        if a[i] != b[i]:
            sum += 1
    return sum
    
def main():
    s = input()
    t = input()
    min = 10**5
    for i in range(len(s)-len(t)+1):
        sum = cout_dif(t, s[i:i+len(t)])
        if sum < min:
            min = sum
    print(min)

if __name__ == '__main__':
    main()

Measured memory_bytes: 9000
#include<iostream>
#include<iomanip>
#include<queue>
#include<string>
#include<stack>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<cassert>
#include<ctime>
#include<algorithm>
#include<utility>
#include<map>
#include<set>
#include<vector>
#include<functional>
#include<complex>

using namespace std;

typedef long long            ll;
typedef unsigned             ui;
typedef unsigned long long   ull;
typedef pair<int,int>        i_i;
typedef pair<ll,int>         ll_i;
typedef pair<ll,ll>          ll_ll;
typedef pair<double,int>     d_i;
typedef pair<double,double>  d_d;
typedef vector<int>          vi;
typedef vector<vector<int> > vii;

#ifdef DEBUG
#define dprintf      printf
#define dputs        puts
#define dout(x)      cout<<#x" = "<<(x)<<endl
#define darray(x,n)  {int i;rep(i,n)cout<<#x"["<<i<<"] = "<<*((x)+i)<<endl;}
#define dloop(i,s,g) for(int (i)=(s);(i)<(g);(i)++)
#define drep(i,n)    for(int (i)=0;(i)<(n);(i)++)
#define dstop()      scanf("%*c")
#else
#define dprintf      (1)?0:printf
#define dputs        (1)?0:puts
#define dout(x)
#define darray(x,n)
#define dloop(i,s,g) if(int i=0){}else
#define drep(i,n)    if(int i=0){}else
#define dstop()
#endif

#define F    first
#define S    second
#define pb   push_back
#define mp   make_pair

#define loop(i,s,g) for((i)=(s);(i)<(g);(i)++)
#define rep(i,n)    for((i)=0;(i)<(n);(i)++)
#define all(x)      x.begin(),x.end()
#define in(T,...) T __VA_ARGS__; impl(__VA_ARGS__)
#define array(T,id,n) T id[(n)]; for(int i=0;i<(n);i++)cin>>id[i]
#define putv(n)     cout<<(n)<<endl

//#define int long long
#ifndef int
#define INF __INT32_MAX__
#else
#define INF __INT64_MAX__
#endif

void impl(){};
template <typename T,typename... TS >
void impl(T &head,TS &... tail)
{
  cin>>head;
  impl(tail ...);
}

signed main(void)
{
  in(int,a);
  int x = sqrt(a);
  putv(x*x);
  return 0;
}


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

struct RollingHash{
  int n;
  vector<long long> base, mod;
  vector<vector<long long>> hash, power;
  RollingHash(string s){
    base = {1009,9973};
    mod = {1000000007,1000000009};
    n = s.size();
    hash = vector<vector<long long>>(n+1,vector<long long>(2));
    power = vector<vector<long long>>(n+1,vector<long long>(2,1));
    for(int i = 0; i < n; ++i){
      for(int j = 0; j < 2; ++j){
        hash[i+1][j] = (hash[i][j]+s[i])*base[j]%mod[j];
        power[i+1][j] = power[i][j]*base[j]%mod[j];
      }
    }
  }
  vector<long long> get(int l, int r){//[l,r)
    vector<long long> ret(2);
    for(int i = 0; i < 2; ++i)
      ret[i] = ((hash[r][i]-hash[l][i]*power[r-l][i])%mod[i]+mod[i])%mod[i];
    return ret;
  }
};

struct RollingHash_64{
  int n;
  unsigned long long base;
  vector<long long> hash, power;
  RollingHash_64(string s){
    base = 1e9 + 7;
    n = s.size();
    // hash = vector<long long>(n+1);
    // power = vector<long long>(n+1,1);
    hash.assign(n+1,0);
    power.assign(n+1,1);
    for(int i = 0; i < n; ++i){
      hash[i+1] = (hash[i]+s[i])*base;
      power[i+1] = power[i]*base;
    }
  }
  unsigned long long get(int l, int r){//[l,r)
    return hash[r]-hash[l]*power[r-l];
  }
};

int main(){
  int N;
  cin >> N;
  vector<string> S(2*N);
  for(int i = 0; i < N; ++i){
    cin >> S[i];
    S[i] += S[i];
    S[i+N] = S[i];
  }
  vector<RollingHash_64> H, V;
  int N_ = 2*N;
  for(int i = 0; i < N_; ++i) V.emplace_back(S[i]);
  for(int j = 0; j < N_; ++j){
    string s;
    for(int i = 0; i < N_; ++i){
      s += S[i][j];
    }
    H.emplace_back(s);
  }
  int ans = 0;
  for(int i = 0; i < N; ++i){
    for(int j = 0; j < N; ++j){
      bool f = true;
      for(int k = 0; k < N; ++k){
        auto v = V[i+k].get(j,j+N), h = H[j+k].get(i,i+N);
        if(v != h){
          f = false;
          break;
        }
      }
      if(f) ++ans;
    }
  }
  cout << ans << endl;
  return 0;
}


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

#define INF ((1<<30)-1)
#define LLINF (1LL<<60)
#define EPS (1e-10)

int main() {
    string S;
    cin >> S;
    int ans = 0;
    S += "X";
    int tmp = 0;
    rep(i, S.size()) {
        if (S[i] == 'R') {
            tmp++;
            ans = max(tmp, ans);
        }
        else {
            tmp = 0;
        }
        ans = max(tmp, ans);
    }
    cout << ans << endl;
}


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

#define hell                         1000000007
#define lcm(a,b)                     (a*b)/__gcd(a,b)
#define ll                           long long
#define vll                          vector<ll>
#define vi                           vector<int>
#define pll                          vector< pair<ll,ll> >
#define pb                           push_back
#define mp                           make_pair
#define all(v)                       v.begin(),v.end()
#define lbnd                         lower_bound
#define ubnd                         upper_bound
#define bs                           binary_search
#define F                            first
#define S                            second
#define rep(i,a,b)                   for(i=a;i<b;i++)
#define parr(a,n)                    for(ll it=0;it<n;it++) cout<<a[it]<<" ";cout<<endl;
#define pcont(a)                     for(auto it:a) cout<<it<<" ";cout<<endl;
#define ret(x)                       return cout<<x,0;
#define endl                           '\n'

/*constants*/
#define MAXN                         100005
#define PI                           3.14159265358979323846

/*debug*/
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>void __f(const char* name, Arg1&& arg1){ std::cout << name << " : " << arg1 << '\n';}
    template <typename Arg1, typename... Args>void __f(const char* names, Arg1&& arg1, Args&&... args){const char* comma = strchr(names + 1, ','); std::cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);}
#else
#define trace(...)
#endif

using namespace std;


int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);cout.tie(NULL);
	
	ll i,j,n,m,k,cnt=0,ans=0,t=1;
	cin>>n;
	ll a[n];
	rep(i,0,n) cin>>a[i];
	sort(a,a+n);
	double val=a[0];
	rep(i,1,n){
		val=(val+a[i]*1.0)/2;
		// trace(val);
	}	
	ret(val)
	
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const long long INF = 1LL << 60;

int main(){
  int n;
  cin >> n;
  int dp[n + 1][3], a[n + 1], b[n + 1], c[n + 1];
  dp[0][0] = 0;
  dp[0][1] = 0;
  dp[0][2] = 0;
  for(int i = 1; i <= n; i++) cin >> a[i] >> b[i] >> c[i];
  for(int i = 1; i <= n; i++){
    dp[i][0] = max(dp[i - 1][1] + b[i], dp[i - 1][2] + c[i]);
    dp[i][1] = max(dp[i - 1][0] + a[i], dp[i - 1][2] + c[i]);
    dp[i][2] = max(dp[i - 1][0] + a[i], dp[i - 1][1] + b[i]);
  }
  cout << max({dp[n][0], dp[n][1], dp[n][2]}) << endl;
}

Measured memory_bytes: 5840
#include<stdio.h>
int main(){
  int a[109],i,j,m,s,n,c=0,d=0;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&a[i]);
  }
  
  for(i=0;i<n;i++){
    m=i;
    for(j=i;j<n;j++){
      if(a[j]<a[m]){
	m=j;
	d=1;
      }
    }
    if(d==1){
      s=a[i];
      a[i]=a[m];
      a[m]=s;
      c++;
      d=0;
    }
  }
  
  for(i=0;i<n-1;i++){
    printf("%d ",a[i]);
  }
  printf("%d\n%d\n",a[n-1],c);
  return 0;
}



Measured memory_bytes: 2104