akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <fstream>
#include <vector>
#include <cstring>
#include <queue>
#include <algorithm> // sort
#include <math.h>

#define DEBUG 0

#define REP(i, n) for (long long i = 0; i < (n); i++) 
typedef long long ll;
static const ll MOD = 1000000007;
static const ll INF = 1000000000000000000LL;
                    //999999997000000003
                    //1000000000000000000

using namespace std;

int solve(){
    int N,K;
    cin >> N >> K;
    vector <int> a(N);
    REP(i, N)cin >> a[i];

    sort(a.rbegin(),a.rend());

    //REP(i, N)cout << a[i] << endl;
    
    //にぶたん Xを実現する
    ll l = 0;
    ll r = a[0];

    while(l+1<r)
    {
        ll mid = (l + r) / 2;
        ll cnt = 0;
        for(int i = 0; i < N; ++i)
        {
            if(mid < a[i])
            {
                cnt += a[i]/mid;
            }
        }
        if(cnt <= K)r = mid;
        else l = mid;

    }

    cout << r << endl;

    return 0;

}

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


Measured memory_bytes: 4052
#include <iostream>
#include <cstdio>

using namespace std;
int main() {
    double f;
    long n,m,i,j,num,c=0;
    long a[105];
    double total=0;
    cin>>n>>m;
    for (i = 0; i < 105; ++i) {
        a[i]=0;
    }
    for (j = 0; j < n; ++j) {
        cin>>num;
        a[j]=num;
        total=total+num;
    }
    f=total/(4*m);
    for (int k = 0; k < n; ++k) {
        if(a[k]>=f)
            c++;
        if(c==m)
            break;
    }
    if(c==m){
        cout<<"Yes";
    } else{
        cout<<"No";
    }
    return 0;
}


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

int main() {
	string s1;
	string s2;
	cin>>s1;
	cin>>s2;
	reverse(s1.begin(),s1.end());
	//cout<<s1;
	
	if(s2==s1){
	    cout<<"YES"<<endl;
	}
	else{
	    cout<<"NO"<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast,no-stack-protector") 
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops")
 
#include <bits/stdc++.h>
 
#define int long long

#define ll long long
#define ull unsigned long long
#define ld long double
#define rep(i, l, r) for (int i = l; i < r; i++)
#define repb(i, r, l) for (int i = r; i > l; i--)
#define sz(a) (int)a.size()
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define pb push_back
#define mp(a, b) make_pair(a, b)
#define ret(a) {cout << a; exit(0);}


using namespace std;
 
mt19937 mrand(random_device{}()); 
const ll mod=1000000007;
int rnd(int x) { return mrand() % x;}

ll powmod(ll a,ll b,ll mod) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}

typedef pair < int , int > pii ;
typedef pair < long long  , long long > pll ;
 
const int N = 3e5 + 123;
int n , m , k;
int a[N] , val[N];
string s;
main(){
	ios::sync_with_stdio(0); cin.tie(0);cout.tie(0);
	cin >> n;
	cin >> s;
	s = '#' + s;

	if(s[1] == 'W' or s[n << 1] == 'W')
		ret(0);
	ll ans = 1 , cnt = 1;
	int l = 1 , r = 0;	
	for(int i = 2 ; i <= n + n ; i++){
		if(s[i] == s[i - 1])	
			val[i] = val[i - 1]^1;
		else val[i] = val[i - 1];
		if(val[i] == 1)        
			ans *= cnt-- , ans %= mod,r++;
		else cnt++ , l++ ;
	}
	
	if(l != r or l + r != 2 * n or cnt != 0)
		ret(0);
	/*stack < char > st;	
	st.push(s[1]);

	for(int i = 2 ; i <= (n << 1); i++){
		if(st.empty())
			st.push(s[i]);
		else if(st.top() == s[i])
				ans *= sz(st) , st.pop() , ans %= mod;
		else 
			st.push(s[i]);
	}
	if(sz(st) != 0)	
		ret(0);
	*/
	ans %= mod;
	for(int i = 2; i <= n; i++)
		ans *= i , ans %= mod;

	cout << ans % mod;
}

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

int R[200000];

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

	for (int i{ 0 }; i < N; i++)std::cin >> R[i];


	auto max_{ -1000000000 };
	auto min_{ R[0] };
	for (int i{ 1 }; i < N;i++) {
//		max_ = std::max(max_, e);

		max_ = std::max(max_, R[i] - min_);
		min_ = std::min(min_, R[i]);

//		std::cout << min_ << " " << max_<<"\n";
	}

	std::cout << (max_) << "\n";
	std::cin >> N;
	return 0;
}


Measured memory_bytes: 3884
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main(){
    int N,x;cin>>N>>x;int tmp;
    int min=1000;int sum=0;
    for(int i=0;i<N;i++){cin>>tmp;sum+=tmp;if(min>tmp)min=tmp;}
    cout<<N+(x-sum)/min<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define inf 0x3f3f3f3f
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef double dd;
const int N = 1e5+5;
const dd eps = 1e-8;
const int mod = 1e9+7;

double pi = 3.141592658597,r;

int main(){
  ios::sync_with_stdio(false);
  // freopen("input.txt","r",stdin);
  cin>>r;
  printf("%.10f\n",2*pi*r);
  return 0;
}


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

using namespace std;

int vet[1001000], dividers[1001000];

bool div(int x){
    if(x == 1)
        return false;
    
    if(dividers[x]++){
        return true;
    }

    int i = 2;
    while(i * i < x){
        if(x % i == 0){
            if(dividers[i]++)
                return true;

            if(dividers[x / i]++)
                return true;
        }
        i++;
    }
    
    if(x % i == 0 && x != i){
        if(dividers[i]++){
            return true;
        }
    }

    return false;
}

int gcd(int a, int b){
    while(a){
        int aux = a;
        a = b % a;
        b = aux;
    }

    return b;
}

int main(){
    int n, g;

    scanf(" %d", &n);

    scanf(" %d", vet);
    g = vet[0];

    for(int i = 1; i < n; i++)
        scanf(" %d", vet + i), g = gcd(g, vet[i]);
    
    if(g != 1){
        printf("not coprime\n");
        return 0;
    }

    for(int i = 0; i < n; i++){
        if(div(vet[i])){
            printf("setwise coprime\n");
            return 0;
        }
    }

    printf("pairwise coprime\n");

    return 0;
}

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

int main(){
  vector<int> c(9);
  for(int i=0;i<9;i++) cin >> c.at(i);
  
  int ans=1;
  
  ans*=(c[3]-c[0]==c[4]-c[1]&&c[3]-c[0]==c[5]-c[2]);
  ans*=(c[3]-c[6]==c[4]-c[7]&&c[3]-c[6]==c[5]-c[8]);
  ans*=(c[0]-c[1]==c[3]-c[4]&&c[0]-c[1]==c[6]-c[7]);
  ans*=(c[2]-c[1]==c[5]-c[4]&&c[2]-c[1]==c[8]-c[7]);
  
  if(ans) cout << "Yes" << endl;
  else cout << "No" << endl;
}

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

#define for_(i,a,b) for(int i=a;i<b;++i)
#define for_rev(i,a,b) for(int i=a;i>=b;--i)
#define allof(a) a.begin(),a.end()
#define minit(a,b) memset(a,b,sizeof(a))
#define size_of(a) (int)a.size()

typedef long long lint;
typedef double Double;
typedef pair< int, int > pii;

typedef vector< int > Array;
typedef vector< Array > Matrix;

int N, Q;
Array C;
int mod_table[300030];

void solve() {
	minit(mod_table, 0);
	sort(allof(C));
	
	for_(q,1,300001) {
		for (int j = q; j <= C[N] + q; j += q) {
			int i = lower_bound(allof(C), j) - C.begin();
			--i;
			mod_table[q] = max(mod_table[q], C[i] % q);
		}
	}
	
	for_(i,0,Q) {
		int q; cin >> q;
		cout << mod_table[q] << endl;
	}
}

int main() {
	cin >> N >> Q;
	C.push_back(0);
	for_(i,0,N) {
		int c; cin >> c;
		C.push_back(c);
	}
	C.push_back((int)1e9);
	solve();
	return 0;
}

Measured memory_bytes: 3632
import sys
# 許容する再帰処理の回数を変更
sys.setrecursionlimit(10**5+10)
# input処理を高速化する
input = sys.stdin.readline

N,M = map(int,input().split())
to = [[] for i in range(N)]
for i in range(M):
    x,y = map(int,input().split())
    to[x-1]+=[y-1]

dp = [-1 for i in range(N)] #node[i]からの最長経路長を記す -1で未決定を示す

def memo(i):
    if dp[i] != -1:
        return dp[i]
    a=0
    for j in to[i]:
        a=max(a, memo(j)+1)
    dp[i] = a
    return a

lp = 0
for i in range(N):
    lp = max(lp,memo(i))
print(lp)


Measured memory_bytes: 59092
#include <functional>
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <queue>
#include <string>
#include <cstring>
#include <math.h>
using namespace std;


int main() {
   int n;
   int m;
  
   cin >> n >> m;
  
   int a = n;
   int b = m;
  
  if(n!=m){
   if(n>m){
     
     cout << 2*n-1 << endl;
     
   }else{
     
     cout << 2*m-1 << endl;
   }
  
  }else{
    cout << 2*m << endl;
  }
   

   
  return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
  bool isLoop = true;
  int counter = 0;
  int xys[3000][2];
  while (isLoop) {
    cin >> xys[counter][0] >> xys[counter][1];

    if (xys[counter][0] == 0 && xys[counter][1] == 0) {
      isLoop = false;
    }
    counter++;
  }
  for (int i = 0; i < counter - 1; i++) {
    int x = xys[i][0];
    int y = xys[i][1];
    if (x > y) {
      cout << y << " " << x << endl;
    } else {
      cout << x << " " << y << endl;
    }
  }
}


Measured memory_bytes: 3080
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
//--<for debugging>
#define whatis(x) cout << #x << " is " << x<<" ";
#define whatisl(x) cout << #x << " is " << x<<"\n";
#define parr(array,end)for(ll loop=0;loop<end;loop++)cout<<array[loop]<<" ";cout<<"\n";
#define lline cout<<"\n";
#define errorl(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args);cout<<"\n";}
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args);cout<<"___";}
    
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cout << *it << " = " << a <<" , ";
    err(++it, args...);
}
//--</for debugging> 
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define testcase ll tt; cin >> tt; while(tt--)
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back 
#define vars ll h,i,j,k,d,l,p,q,r,x,y,a,b,c,v,var,n,m,z,s,ans,ind1,ind2,flag,limit1,limit2,limit3,mod;
#define vll vector<ll>
#define pll pair<ll,ll>
#define sll set<ll>
#define pint pair<int,int>
const ll INF=1e9+7;
const ll MOD=1e9+7;
int main()
{
    boost vars
    x=0;y=0;
    for(i=0;i<3;i++)
    {
        cin>>v;
        if(v==5)x++;
        else if(v==7)y++;
    }
    if(x==2&&y==1)cout<<"YES";
    else cout<<"NO";
}

Measured memory_bytes: 3512
// template version 1.12
using namespace std;
#include <iostream>
#include <bits/stdc++.h>

// varibable settings
#define infile "../test/sample-1.in"
#define int long long //{{{
const int INF=1e18;
const int MOD=1e9+7; //}}}

// define basic macro {{{
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _rrep(i,n) rrepi(i,0,n)
#define rrepi(i,a,b) for(int i=(int)((b)-1);i>=(int)(a);--i)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
#define each(i,a) for (auto&& i : a)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define ceil(a,b) ((a)+(b)-1)/(b)
#define uni(x) sort(all(x));x.erase(unique(all(x)),x.end())
#define ub upper_bound
#define lb lower_bound
#define posl(A, x) (lower_bound(all(A), x)-A.begin())
#define posu(A, x) (upper_bound(all(A),x)-A.begin())
template<class T> inline void chmax(T &a, const T &b) { if((a) < (b)) (a) = (b); }
template<class T> inline void chmin(T &a, const T &b) { if((a) > (b)) (a) = (b); }

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long double ld;
typedef pair<int,int> pii;
typedef tuple<int,int,int> iii;

template<typename T> using PQ = priority_queue<T, vector<T>, greater<T>>;
struct Fast { Fast(){ std::cin.tie(0); ios::sync_with_stdio(false); } } fast;

#if defined(PCM) || defined(LOCAL)
  #include "lib/dump.hpp"
#else
  #define dump(...) 42
  #define dump_1d(...) 42
  #define dump_2d(...) 42
#endif
//}}}

int solve(){
  int n;cin>>n;
  vi b(n-1);
  rep(i, n-1) cin>>b[i];
  dump(b);

  vi a(n);
  a[0] = b[0];
  a[n-1] = b[n-2];
  rep(i, 1, n-1){
    a[i] = min(b[i-1], b[i]);
  }
  dump(a);
  cout << accumulate(all(a), 0LL) << endl;
  return 0;
}

signed main() { //{{{
#ifdef INPUT_FROM_FILE
  std::ifstream in(infile);
  std::cin.rdbuf(in.rdbuf());
#endif
  solve();
  return 0;
} //}}}


Measured memory_bytes: 256
#A
N = int(input())
A = list(map(int,input().split()))
B = []
for i,a in enumerate(A):
    B.append([a,i])
B.sort()
A = [0]*N
for i in range(N):
    bind = B[i][1]
    A[i] = bind+1
    

#BIT(1-indexed)
BIT = [0]*(N+1)
def BIT_SUM(i):
    s = 0
    while i > 0:
        s+=BIT[i]
        i-=i&(-i)
    return s
def BIT_ADD(i,x):
    while i <= N:
        BIT[i]+=x
        i+=i&(-i)
        
ans = 0
for j in range(N):
    ans+=j-BIT_SUM(A[j])
    BIT_ADD(A[j],1)
print(ans)




Measured memory_bytes: 45168
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
int func(int x){
 int count=0;
 while(x%2==0){
   count++;
   x/=2;
 }
return count;
}
int main() {
  int N;
  cin>>N;
  vector<int>a(N);
  for(int i=0;i<N;i++){
    cin>>a[i];
  }
  int sum=0;
  for(int i=0;i<N;i++){
    sum+=func(a[i]);
  }
  cout<<sum<<endl;
  return 0;}

Measured memory_bytes: 384
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
#include <deque>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N, M; cin >> N >> M;
  int cnt[N+1]; CLR(cnt);
  FOR(i,0,M) {
    int a, b; cin >> a >> b;
    cnt[a]++;
    cnt[b]++;
  }
  FOR(i,1,N+1) {
    if(cnt[i] % 2 == 1) {
      cout << "NO" << endl;
      return 0;
    }
  }
  cout << "YES" << endl;
  return 0;
}

Measured memory_bytes: 640
#!usr/bin/env python3
from collections import defaultdict, deque, Counter, OrderedDict
from bisect import bisect_left, bisect_right
from functools import reduce, lru_cache
from heapq import heappush, heappop, heapify

import itertools
import bisect
import math
import fractions
import sys
import copy


def L(): return sys.stdin.readline().split()


def I(): return int(sys.stdin.readline().rstrip())


def S(): return list(sys.stdin.readline().rstrip())


def LI(): return [int(x) for x in sys.stdin.readline().split()]


def LI1(): return [int(x) - 1 for x in sys.stdin.readline().split()]


def LS(): return [list(x) for x in sys.stdin.readline().split()]


def IR(n): return [I() for _ in range(n)]


def LIR(n): return [LI() for _ in range(n)]


def LIR1(n): return [LI1() for _ in range(n)]


def SR(n): return [S() for _ in range(n)]


def LSR(n): return [LS() for _ in range(n)]


def LR(n): return [L() for _ in range(n)]


alphabets = "abcdefghijklmnopqrstuvwxyz"
ALPHABETS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

sys.setrecursionlimit(1000000)
dire = [[1, 0], [0, 1], [-1, 0], [0, -1]]
dire8 = [[1, 0], [1, 1], [0, 1], [-1, 1], [-1, 0], [-1, -1], [0, -1], [1, -1]]
MOD = 1000000007


def main():
    N, D = LI()
    XY = LIR(N)
    ans = 0
    for x, y in XY:
        if D ** 2 >= x ** 2 + y ** 2:
            ans += 1
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 105892
#include <bits/stdc++.h>
#define INF INT_MAX
#define ll  long long
#define ull unsigned long long
#define rep(i,n) for(ll i=0; i<n; ++i)
#define FOR(i, s, e) for(ll i=s; i<e; ++i)
#define MOD 1000000007
using namespace std;
template<class T> inline bool chmin(T& a, T b) { if(a>b) {a=b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) { if(a<b) {a=b; return true;} return false;}

int n, m, cnt, s, u[55], v[55], x[55];
vector<int> g[55];
 
void dfs(int p) {
	if(x[p]) return;
	x[p] = 1;
	s++;
	rep(i,g[p].size()) dfs(g[p][i]);
}
 
int main() {
	int i, j;
	cin>>n>>m;
	rep(i,m) cin>>u[i]>>v[i];
	rep(i,m) {
		for(j=1; j<=n; j++) g[j].clear(), x[j] = 0;
		for(j=0; j<m; j++) {
			if(j==i) continue;
			g[u[j]].push_back(v[j]);
			g[v[j]].push_back(u[j]);
		}
		s = 0;
		dfs(1);
		cnt += (s!=n);
	}
	cout<<cnt<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#define LL long long

using namespace std;

int main()
{
	
	LL n;
	cin>>n;
	if(n==1) cout<<'0'<<endl;
	else cout<<n*(n+1)/2-n<<endl;
	return 0;
 } 

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

// Function Macros:
#define rep(i, n) for(int(i) = 0; (i) < (n); (i)++)
#define all(v) (v).begin(), (v).end()
#define setpre(n) cout << fixed << setprecision(n)

// Type / Class / Struct Definitions:
using namespace std;

using ll = long long;
using ull = unsigned long long;

// Constants:
const int INF = (1ll << 30) - 1;  // approx 1.07e9
const ll INFLL = 1ll << 60;       // approx 1.15e18
const int MOD = 1e9 + 7;          // 998244353
const long double EPS = 1.0e-14;

// Global Variables:

// Prototype Declarations:
int gcd(int, int);
template <class T>
inline bool chmin(T&, T);
template <class T>
inline bool chmax(T&, T);

// ================ Main Loop ================
int main() {
    int n, m;
    cin >> n >> m;
    vector<int> h(n);
    rep(i, n) {
        cin >> h[i];
    }
    int a, b;
    vector<set<int>> path(n);
    rep(i, m) {
        cin >> a >> b;
        a--;
        b--;
        path[a].insert(b);
        path[b].insert(a);
    }
    int ans = 0;
    rep(i, n) {
        //dbgmsg
        // cout << "Tower " << i << endl;
        bool flg = true;
        for(auto itr : path[i]) {
            // cout << "    - Path " << itr << ": ";
            if(h[itr] >= h[i]) {
                // cout << "x" << endl;
                flg = false;
                break;
            }
            // cout << "o" << endl;
        }
        if(flg) {
            // cout << "ans++" << endl;
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}
// ===========================================

// Functions:
int gcd(int a, int b) {
    return b ? gcd(b, a % b) : a;
}

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

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


Measured memory_bytes: 17692
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC target("avx")
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int (i)=0;i<(n);i++)
#define rrep(i,n) for(int (i)=1;i<=(n);i++)
#define REP(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define MOD 1000000007
#define INF 1e18
#define int long long
#define endl "\n"
#define yorn(f) puts((f)?"Yes":"No")
#define YORN(f) puts((f)?"YES":"NO")
typedef long long ll;
typedef pair<int, int> P;
int gcd(int a,int b){return b?gcd(b,a%b):a;};
int lcm(int a,int b){return a/gcd(a,b)*b;};
int mod(int a,int b){return (a+b-1)/b;};
template<typename A, size_t N, typename T>
void Fill(A(&array)[N],const T &val){std::fill((T*)array,(T*)(array+N),val);}
template<class T>inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;};
template<class T>inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;};

int D;
vector<int> c(26);
vector<vector<int>> s(365, vector<int>(26));
vector<int> last(26);

void input() {
	cin >> D;
	rep(i, 26) cin >> c[i];
	rep(i, D) {
		rep(j, 26) cin >> s[i][j];
	}
}

void output(vector<int> &v) {
	rep(i, v.size()) {
		cout << v[i]+1 << endl;
	}
}

int calc_score(vector<int> &t) {
	int score = 0;
	rep(i, t.size()) {
		last[t[i]] = i + 1;
		rep(j, 26) {
			score -= (i + 1 - last[i]) * c[i];
		}
		score += s[i][t[i]];
	}
	return score;
}

signed main() {
	cin.tie(0);
	cout.tie(0);
	ios::sync_with_stdio(false);
	//cout << fixed << setprecision(15);
	
	input();
	vector<int> res;
	rep(i, D) {
		int maxscore = LONG_MIN;
		int bestId = 0;
		rep(j, 26) {
			res.push_back(j);
			int now = calc_score(res);
			if(maxscore < now) {
				maxscore = now;
				bestId = j;
			}
			res.pop_back();
		}
		res.push_back(bestId);
	}
	output(res);
	return 0;
}

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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  if(N < 1000)
    cout << "ABC" << endl;
  else
    cout << "ABD" << endl;
  return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
#define ll long long
#define N 100005
#define mod 1000000007
#define rep(i,j,k) for (ll i=j;i<=k;++i)
#define per(i,j,k) for (ll i=j;i>=k;--i)
using namespace std;
inline ll read(){
	char ch=getchar(); ll x=0,f=1;
	while (ch<'0'||ch>'9') { if (ch=='-') f=-1; ch=getchar(); }
	while (ch>='0'&&ch<='9') { x=x*10+ch-'0'; ch=getchar(); }
	return x*f;
}
ll n,tot,ans1,ans2,a[N];
int main(){
	n=read();
	rep(i,1,n) a[i]=read();
	sort(a+1,a+1+n);
	for (ll l=1,r=1;l<=n;l=++r){
		while (a[l]==a[r+1]) ++r;
		if (r-l+1>=2) ans2=ans1,ans1=a[l];
		if (r-l+1>=4) ans2=ans1,ans1=a[l];
	}
	printf("%lld",ans1*ans2);
}

Measured memory_bytes: 896
# frozen_string_literal: true

n = gets.to_i
h = gets.split(' ').map(&:to_i)

res = 'No'

def possible?(ha, na)
  (na-1).times do |i|
    gap = ha[i] - ha[i + 1]
    return false if gap > 1
    ha[i + 1] += 1 if gap == 1
  end
  true
end

res = 'Yes' if possible?(h, n)

puts res

Measured memory_bytes: 8580
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int i,j,s,g,h;
int po(int f)
{
  int rui=1;
  for(g=0;g<f;g++)
  {
    rui=2*rui;
  }
  return rui;
}
int main (){
  int n,m,x,ans,ansk,cost;
  bool p=false;
  ans=1000000000;
  cin >> n >> m >> x;
  int c[n];
  int d;
  int A[n][m];
  int und[m];
  for(i=0;i<n;i++)
  {
    cin >> c[i];
    for(j=0;j<m;j++)
    {
      cin >> A[i][j];
    }
  }
 // cout << n << endl;
  
  for(i=0;i<po(n);i++)
  {
    cost=0;
     for(j=0;j<m;j++)
     {
       und[j]=0;
     }
    for(j=0;j<n;j++)
    {
       d=(i%(po(j+1))-i%(po(j)))/(po(j));
     // cout << i << " " << j << " " <<d << endl;
      if(d==1)
      {
        cost+=c[j];
        for(s=0;s<m;s++)
        {
          und[s]+=A[j][s];
        }
      }
    }
    bool w=true;
    for(j=0;j<m;j++)
    {
      if(und[j]<x)
      {
        w=false;
        break;
      }
    }
    if(w)
    {
      ans=min(ans,cost);
      p=true;
    }
  }
    if(p)
    {
      cout << ans << endl;
    }
  else
  {
    cout << "-1" << endl;
  }
}
  

Measured memory_bytes: 3640
while True:
    try:
        a, b, c, d, e, f = map(float, raw_input().split())
        a1 = (c*e-b*f)/(a*e-b*d)
        a2 = (a*f-c*d)/(a*e-b*d)
        if a1 == -0:
            a1 = 0
        if a2 == -0:
            a2 = 0
        print "{0:.3f} {1:.3f}".format(a1, a2)
    except EOFError:
        break

Measured memory_bytes: 4252
a = int(input())
b = int(input())

if a==1 and b==2:
  print(3)
elif a==1 and b==3:
  print(2)
elif a==2 and b==1:
  print(3)
elif a==2 and b==3:
  print(1)
elif a==3 and b==1:
  print(2)
elif a==3 and b==2:
  print(1)

Measured memory_bytes: 38256
#include<bits/stdc++.h>
#define ll long long
#define inf 1000000000
using namespace std;
struct node
{
    int l,r;
} num[100009];
int main()
{
    int n,a[100009],dp[100009];
    ll ans=0;
    scanf("%d",&n);
    for(int i=1; i<=n; i++)
        scanf("%d",&a[i]);
    a[0]=inf,a[n+1]=inf;
    num[0].l=0,num[n+1].r=n+1;
    for(int i=1; i<=n; i++)
    {
        int tmp=i-1;
        while(a[tmp]<a[i])
        {
            tmp=num[tmp].l;
        }
        num[i].l=tmp;
    }
    for(int i=n; i>=1; i--)
    {
        int tmp=i+1;
        while(a[tmp]<a[i])
        {
            tmp=num[tmp].r;
        }
        num[i].r=tmp;
    }
    //for(int i=1; i<=n; i++)
        //printf("%d %d\n",num[i].l,num[i].r);
    for(int i=1; i<=n; i++)
    {
        if(!num[i].l&&num[i].r==n+1)
            continue;
        int tmp,tmp1;
        if(num[i].l)
        {
            int x=num[i].l-1;
            while(a[x]<a[i])
            {
                x=num[x].l;
            }
            tmp=x;
            ans+=(ll)(a[i])*(num[i].l-tmp)*(num[i].r-i);
        }
        if(num[i].r!=n+1)
        {
            int x=num[i].r+1;
            while(a[x]<a[i])
            {
                x=num[x].r;
            }
            tmp1=x;
            ans+=(ll)(a[i])*(tmp1-num[i].r)*(i-num[i].l);
        }
    }
    printf("%lld",ans);
    return 0;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,a,b) for(ll i = (a); i < (b); ++i)
#define iter(it,c) for(__typeof((c).begin()) it = (c).begin(); it != (c).end(); ++it)
#define pb push_back
#define fs first
#define sc second
#define MOD 1000000007
typedef pair<ll,ll> ii;
typedef vector<ll> vi;
typedef vector<ii> vii;

const int INF = ~(1<<31);
const double pi = acos(-1);
const double EPS = 1e-9;

int main(){
    cin.sync_with_stdio(false);
    string s;
    cin >> s;
    rep(i,0,3){
        if(s[i] == s[i+1]) {
            cout << "Bad" << endl;
            return 0;
        }
    }
    cout << "Good" << endl;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 7)

N, mod = map(int, input().split())
edge = [[] for _ in range(N)]
for _ in range(N - 1):
    x, y = map(int, input().split())
    x -= 1
    y -= 1
    edge[x].append(y)
    edge[y].append(x)

topo = []
parent = [-1] * N
node = [0]
while node:
    s = node.pop()
    topo.append(s)
    for t in edge[s]:
        if t == parent[s]:
            continue
        parent[t] = s
        node.append(t)

memo = [1] * N
res = [1] * N
for s in reversed(topo):
    for t in edge[s]:
        if t == parent[s]:
            continue
        res[s] = res[s] * memo[t] % mod
    memo[s] = res[s] + 1


TD = [1] * N
for s in topo:
    acc = TD[s]
    for t in edge[s]:
        if t == parent[s]:
            continue
        TD[t] = acc
        acc = acc * memo[t] % mod
    acc = 1
    for t in reversed(edge[s]):
        if t == parent[s]:
            continue
        TD[t] = (TD[t] * acc + 1) % mod
        acc = acc * memo[t] % mod
        res[t] = res[t] * TD[t] % mod

print(*res, sep="\n")

Measured memory_bytes: 40616
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <map>
#include <set>
#include <utility>
#include <vector>

using namespace std;

int main(){
  int N, M;
  cin >> N >> M;
  int K;
  cin >> K;
  bool judge = false;
  for (int i = 0; i <= N; i++){
    for (int j = 0; j <= M; j++){
      if ((M*i+j*N-i*j*2) == K){
        judge = true;
      }
    }
  }
  if (judge){
    cout << "Yes";
  }else{
    cout << "No";
  }
  return 0;
}


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

int main(){
	int n, i=0;
	std::cin >> n;
	int a[n+1]={}, b[n]={};
	long ans = 0;
	for(i=0; i<= n; i++) cin >> a[i];
	for(i=0; i< n; i++) cin >> b[i];
	for( i=0 ; i < n; i++ ){
		int left = min(a[i], b[i]);
		ans += left;
		a[i] -= left;
		b[i] -= left;

		int right = min(a[i+1], b[i]);
		ans += right;
		a[i+1] -= right;
		b[i] -= right;
	}
	cout << ans;
	return 0;
}


Measured memory_bytes: 1024
#define _GLIBCXX_DEBUG
#include<algorithm>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<iostream>
#include<vector>
#include<queue>
#include<deque>
#include<stack>
#include<set>
#include<map>
#include<string>
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define rep2(i,s,n) for(int i=s;i< (int)n; i++)
#define ll long long 
#define all(v) v.begin(),v.end()

using namespace std;
// index が条件を満たすかどうか
bool isOK(int index, vector<int>& a, int b, int c) {
    if (a[index] > abs(a[b]-a[c])) return true;
    else return false;
}
// 二分探索
int binary_search(vector<int>& a, int b,int c) {
    int left = c; //「index = b+1」が条件を満たすこともあるので、初期値は -1
    int right = (int)a.size(); // 「index = a.size()-1」が条件を満たさないこともあるので、初期値は a.size()
    /* どんな二分探索でもここの書き方を変えずにできる！ */
    while (right - left > 1) {
        int mid = left + (right - left) / 2;
        if (isOK(mid, a , b, c)) right = mid;
        else left = mid;
    }
    /* left は条件を満たさない最大の値、right は条件を満たす最小の値になっている */
    return right;
}


// index が条件を満たすかどうか
bool isOK2(int index, vector<int>& a, int b, int c) {
    if (a[index] < a[b]+a[c]) return true;
    else return false;
}
// 二分探索（上から押さえる）
int binary_search2(vector<int>& a, int b,int c) {
    int left = c; //「index = b+1」が条件を満たすこともあるので、初期値は -1
    int right = (int)a.size(); // 「index = a.size()-1」が条件を満たさないこともあるので、初期値は a.size()
    /* どんな二分探索でもここの書き方を変えずにできる！ */
    while (right - left > 1) {
        int mid = left + (right - left) / 2;
        if (isOK2(mid, a , b, c)) left = mid;
        else right = mid;
    }
    /* left は条件を満たさない最大の値、right は条件を満たす最小の値になっている */
    return left;
}


int main(){
  int n; cin >>n;
  vector<int> L(n);
  rep(i,n) cin >>L[i];
  int ans=0;
  sort(all(L));
  rep(i,n-2){
    rep2(j,i+1,n-1){
       // if((binary_search(L,i,j)!=n)&&binary_search2(L,i,j)!=j) {
          ans+=binary_search2(L,i,j)-binary_search(L,i,j)+1;
       // }
  }
  }
  cout <<ans<<endl;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-


def main():
    alpha = [0 for _ in range(3)]
    s = input()

    # KeyInsight
    # abcabcabc...の形にできれば回文にならない
    for si in s:
        if si == 'a':
            alpha[0] += 1
        elif si == 'b':
            alpha[1] += 1
        else:
            alpha[2] += 1

    # a, b, cの出現回数の差が1以下なら回文にならない
    if max(alpha) - min(alpha) <= 1:
        print('YES')
    else:
        print('NO')


if __name__ == '__main__':
    main()


Measured memory_bytes: 3188
def intread():
    return [int(item) for item in input().split()]

[l,m,n]=[int(item) for item in input().split()]

gyoretuA=[]
gyoretuB = []

for i in range(l):
    gyoretuA.append(intread())

for i in range(m):
    gyoretuB.append(intread())


productedMat = []
#掛け算
for i in range(l):
    #行の抽出
    row = gyoretuA[i]
    newrow=[]
    for j in range(n):
        #列の抽出
        col=[row[j]for row in gyoretuB]
        newrow.append(sum([a*b for a,b in zip(row,col)]))
    productedMat.append(newrow) 

for row in productedMat:
    print(*row)


Measured memory_bytes: 6976
n,k=map(int,input().split())
A=sorted(list(map(int, input().split())))

mod=10**9+7

if A[-1]<0 and k%2==1:
    now=1
    for i in range(k):
        now*=A[-i-1]%mod
        now%=mod
    print(now)
    exit()
	
l=0
r=n-1
ans=1
if k%2==1:
    ans=A[-1]
#    print(ans)
    r-=1	
for i in range(k//2):
    mi=A[l]*A[l+1]
#    print(mi)
    pl=A[r]*A[r-1]
#    print(pl)
    if mi>pl:
        ans*= mi%mod
        ans%=mod
        l+=2
    else:
        ans*= pl%mod
        ans%=mod
        r-=2
		
print(ans%mod)

Measured memory_bytes: 31700
data class Double2D(val x: Double, val y: Double) {
  operator fun plus(o: Double2D): Double2D {
    return Double2D(x + o.x, y + o.y)
  }
  operator fun minus(o: Double2D): Double2D {
    return Double2D(x - o.x, y - o.y)
  }
  operator fun times(o: Double): Double2D {
    return Double2D(x * o, y * o)
  }
  fun norm2(): Double {
    return x * x + y * y
  }
  fun norm(): Double {
    return Math.sqrt(x * x + y * y)
  }
}

fun cross(v1: Double2D, v2: Double2D): Double {
  return v1.x * v2.y - v1.y * v2.x
}

fun dot(v1: Double2D, v2: Double2D): Double {
  return v1.x * v2.x + v1.y * v2.y
}

fun ccw(p: Double2D, q: Double2D, r: Double2D): Int {
  val vq = q - p
  val vr = r - p
  if (cross(vq, vr) > 0)   return +1     // counter clockwise
  if (cross(vq, vr) < 0)   return -1     // clockwise
  if (dot(vq, vr) < 0)     return +2     // r-p-q on line
  if (vq.norm2() < vr.norm2()) return -2 // p-q-r on line
  return 0
}

class Double2DComparator {
  companion object : java.util.Comparator<Double2D> {
    override fun compare(p1: Double2D, p2: Double2D): Int = compareDouble2D(p1, p2)
  }
}

fun compareDouble2D(p1: Double2D, p2: Double2D): Int {
  if (p1.x != p2.x) {
    return java.lang.Double.compare(p1.x, p2.x)
  }
  return java.lang.Double.compare(p1.y, p2.y)
}

fun convexHull(inputPs: List<Double2D>): List<Double2D> {
  val ps = inputPs.sortedWith(Double2DComparator)
  val n = ps.size
  val qs = mutableListOf<Double2D>()
  for (i in 0 until n) {
    while (qs.size >= 2 &&
        // Use "<= 0" here to exclude a point on an edge.
        ccw(qs[qs.size - 2], qs[qs.size - 1], ps[i]) == -1) {
      qs.removeAt(qs.size - 1)
    }
    qs.add(ps[i])
  }
  val lowerHullSize = qs.size
  for (i in n - 2 downTo 0) {
    while (qs.size >= lowerHullSize &&
        // Use "<= 0" here to exclude a point on an edge.
        ccw(qs[qs.size - 2], qs[qs.size - 1], ps[i]) == -1) {
      qs.removeAt(qs.size - 1)
    }
    qs.add(ps[i])
  }
  qs.removeAt(qs.size - 1)
  return qs
}

fun main(args: Array<String>) {
  val n = readLine()!!.toInt()
  // No List(n, {}) constructor for Kotlin 1.0.
  val ps = Array(n, {
    val (x, y) = readLine()!!.split(" ").map(String::toInt)
    Double2D(x.toDouble(), y.toDouble()) })
      .asList()
  val qs = convexHull(ps)
  val m = qs.size
  val args = mutableMapOf<Double2D, Double>()
  for (i in 0 until m) {
    val qm = qs[i]
    val qp = qs[(i + (m - 1)) % m]
    val qn = qs[(i + 1) % m]
    val v1 = qn - qm
    val v2 = qp - qm
    val cos_theta = dot(v1, v2) / v1.norm() / v2.norm()
    val theta = Math.acos(cos_theta)
    args[qs[i]] = Math.PI - theta
  }
  for (p in ps) {
    if (args.containsKey(p)) {
      val arg = args[p]!!
      println(String.format("%.9f", arg / (2.0 * Math.PI)))
    } else {
      println(0.0)
    }
  }
}

Measured memory_bytes: 37752
#include <iostream>
using namespace std;
#define N 128
#define M 101000
int n,k,j,ok,i,v[N],d[M];
int main()
{
    cin >> n >> k;
    for (i = 0; i < n; ++i)
        cin >> v[i];
    ++k;
    for (i = 0; i < k; ++i){
        ok = 0;
        for (j = 0; j < n; ++j)
            if (i - v[j] > -1 && !d[i - v[j]])
            ok = 1;
        d[i] = ok;
    }
    --k;
    if (d[k])
        cout << "First";
    else
        cout << "Second";
    return 0;
}


Measured memory_bytes: 640
import sys
import math
import collections
import bisect
import itertools

# import numpy as np

sys.setrecursionlimit(10 ** 7)
INF = 10 ** 20
MOD = 10 ** 9 + 7
# MOD = 998244353

ni = lambda: int(sys.stdin.readline().rstrip())
ns = lambda: map(int, sys.stdin.readline().rstrip().split())
na = lambda: list(map(int, sys.stdin.readline().rstrip().split()))
na1 = lambda: list(map(lambda x: int(x) - 1, sys.stdin.readline().rstrip().split()))


# ===CODE===

def main():
    n, l = na()
    a = na()

    max_point = -1
    max_idx = -1
    for i in range(1, n):
        tmp = a[i] + a[i - 1]
        if tmp >= l:
            max_point = max(max_point, tmp)
            max_idx = i - 1

    if max_point == -1:
        print("Impossible")
        exit(0)

    tmp = [i for i in range(n - 1)]

    ans = []
    x = tmp[:max_idx]
    y = tmp[max_idx + 1:]
    y.reverse()

    ans = x + y

    print("Possible")
    for ansi in ans:
        print(ansi + 1)
    print(max_idx + 1)


if __name__ == '__main__':
    main()


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

#define ll long long

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

	ll s=0;
	for(int i=0;i<=n;i++)
	{
		if(i%3==0||i%5==0)
		{

		}
		else
		{
			s+=i;
		}
	}
	cout<<s<<endl;
}


Measured memory_bytes: 3636
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <deque>
#include <cstdio>
#include <set>
#include <map>
#include <bitset>
#include <stack>
#include <cctype>
using namespace std;
int main() {
	int co = 0;
	bool ans = false;
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		int l, r;
		cin >> l >> r;
		if (l == r) {
			co++;
		}
		else {
			if (co >= 3) {
				ans = true;
			}
			co = 0;
		}
	}
	if (co >= 3) {
		ans = true;
	}
	if (ans) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	return 0;
}


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

namespace AtCoder.Abc
{
    //https://atcoder.jp/contests/abc141/tasks/abc141_a
    public class QuestionA
    {
        public static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            // 文字列の入力
            //string s = Console.ReadLine();

            // 整数の入力
            //long n = long.Parse(Console.ReadLine());

            // 文字列配列の入力
            //string[] inputStrArray = Console.ReadLine().Split(' ');

            // 整数配列の入力
            //var inputLongArray = Console.ReadLine().Split(' ').Select(i => long.Parse(i)).ToArray();

            string S = Console.ReadLine();
            string T = Console.ReadLine();

            T = T.Substring(0, T.Length - 1);

            if (T == S)
            {
                Console.WriteLine("Yes");
            }

            else
            {
                Console.WriteLine("No");
            }

            
            Console.Out.Flush();
        }
    }
}


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

int main()
{
    ll n,k;
    cin>>n>>k;
    ll q = n/k;
    ll temp = k*( q+1);
    ll ans = min( abs( temp - n) , n%k  );
    cout<<ans;
}

Measured memory_bytes: 3588
#include<stdio.h>
#include<string.h>

#define M 1111111/* your task*/
#define L 14

char H[M][L]; /* Hash Table */

int getChar(char ch){
  if ( ch == 'A') return 1;
  else if ( ch == 'C') return 2;
  else if ( ch == 'G') return 3;
  else if ( ch == 'T') return 4;
}

/* convert a string into an integer value */
long long getKey(char str[]){
  long long sum = 0, p = 1, i;
  for ( i = 0; i < strlen(str); i++ ){
    sum += p*(getChar(str[i]));
    p *= 5;
  }
  return sum;
}

int h1(int key){ return key % M; }
	int h2(int key){ return 1 + (key % (M - 1)); }

int find(char str[]){

    long long key,i,h;
	key = getKey(str);
	for(i = 0;;i++){
		h = (h1(key) + i * h2(key)) % M;
		if(strcmp(H[h],str) == 0)return 1;
		else if(strlen(H[h]) == 0)return 0;
	}
	return 0;

}

int insert(char str[]){
	long long key,i,h;
	key = getKey(str);
    for(i = 0;;i++){
		h = (h1(key) + i * h2(key)) % M;
		if(strcmp(H[h],str) == 0)return 1;
		else if(strlen(H[h]) == 0){
			strcpy(H[h],str);
			return 0;
	}
	}
	return 0;

}

int main(){
    int i, n, h;
    char str[L], com[9];
    for ( i = 0; i < M; i++ ) H[i][0] = '\0';
    
    scanf("%d", &n);
    
    for ( i = 0; i < n; i++ ){
	scanf("%s %s", com, str);
	
	if ( com[0] == 'i' ){
	    insert(str);
	} else {
	    if (find(str)){
		printf("yes\n");
	    } else {
		printf("no\n");
	    }
	}
    }

    return 0;
}


Measured memory_bytes: 16976
A, B, M = map(int, input().split())

a = list(map(int, input().split()))
b = list(map(int, input().split()))

mini = float('inf')

for i in range(M):
    x, y, c = map(int,input().split())
    if a[x-1] + b[y-1] - c < mini:
        mini = a[x-1] + b[y-1] - c

if min(a) + min(b) < mini:
    print(min(a) + min(b))
else:
    print(mini)



Measured memory_bytes: 25420
#include<bits/stdc++.h>
#define U [7<<15]={}
#define G )+((c=A[a]+A[P[a]]+C[a])%k?c:0)-M(
typedef long long L;using namespace std;map<L,L>T U;L P U,E U,Z U,H U,C U,A U,O U,X U,B U,k,n,a,b,c;char s U;L M(L f){return f?B[f]+M(f^f&-f):0;}L S(L a,L i){for(a=M(i++G i);i<2e5;i+=i&-i)B[i]+=a;}L D(L f){L d;for(map<L,L>::iterator I=T[f].begin();I!=T[f].end();I++)d=I->first,d&&!E[d]?P[d]=f,E[d]=E[f]+1,C[d]=I->second,D(d),Z[f]+=++Z[d],Z[H[f]]<Z[d]?H[f]=d:0:0;}L K(L f){a=X[f];n=X[b];return a-n?M(O[E[a]<E[n]?a=n,n=b,b=f,n:f]G O[a])+K(P[a]):abs(M(O[f])-M(O[b]));}main(){for(cin>>n>>k;--*Z+n;T[a][b]=T[b][a]=c)cin>>a>>b>>c;for(D(a=n=0);Z[n];a=H[P[++n]]-n?n:0)for(;!O[a];S(a=H[a],O[a]=++b))X[a]=n;for(cin>>a;cin>>s>>a>>b;S(H[a],O[a]),S(a,O[a]-1))*s&2?cout<<K(a)<<endl,0:A[a]+=b;}

Measured memory_bytes: 38116
#include<bits/stdc++.h>
using namespace std;
int main(){
  int x; cin >> x;
  int cnt = 1;
  int kaku = x;
  while(1){
    if(kaku == 0){
      cout << cnt << endl;
      return 0;
    }
    cnt++;
    kaku += x;
    if(kaku >=360)
      kaku -= 360;
  }
}
      

Measured memory_bytes: 3580
#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>
#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--)
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;
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 dp[110000];
int main(){
    int N, K; cin >> N >> K;
    int h[110000];
    rep(i, N) {
        cin >> h[i];
        dp[i] = INF;
    }
    
    dp[0] = 0;
    rep(i,N){
        rep(j, K+1) {
            chmin(dp[i + j], dp[i] + abs(h[i + j] - h[i]));
        }
    }
    cout << dp[N-1] << endl;
}



   

    
    



    
                

 













































































































































Measured memory_bytes: 1024
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

A, B, T = MAP()

print(T//A * B)

Measured memory_bytes: 4396
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define fo(a,b) for(int a=0;a<b;a++)
#define Sort(a) sort(a.begin(),a.end())
#define rev(a) reverse(a.begin(),a.end())
#define fi first
#define se second
#define co(a) cout<<a<<endl
#define sz size
#define bgn begin()
#define en end()
#define pb(a) push_back(a)
#define pop pop_back
#define V vector
#define P pair
template<class T>
 void cou(vector<vector<T>> a){
  int b=a.size();
  int c=a[0].size();
  fo(i,b){
    fo(j,c){
      cout<<a[i][j];
      if(j==c-1)
        cout<<endl;
      else
        cout<<' ';
    }
  }
}
//template<>
 void cou(vector<vector<char>> a){
  int b=a.size();
  int c=a[0].size();
  fo(i,b){
    fo(j,c){
      cout<<a[i][j];
      if(j==c-1)
        cout<<endl;
      else
        cout<<' ';
    }
  }
}
 int wari(int a,int b) {
   if(a%b==0)
     return a/b;
   else
     return a/b+1;
 }
 int keta(int a){
  double b=a;
  b=log10(b);
  int c=b;
  return c+1;
 }
 int souwa(int a){
  return a*(a+1)/2;
 }
 int lcm(int a,int b){
  int d=a,e=b,f;
  if(a<b)
    swap(a,b);
  int c,m=1;
  while(m){
    c=a%b;
    if(c==0){
       f=b;
      m--;
    }
    else{
      a=b;
      b=c;
 }
  }
  return d*e/f;
    }
  int gcm(int a,int b){
      int d=a,e=b,f;
  if(a<b)
    swap(a,b);
  int c,m=1;
  while(m){
    c=a%b;
    if(c==0){
       f=b;
      m--;
    }
    else{
      a=b;
      b=c;
 }
  }
  return f;
  }
 bool prime(int a){
   if(a<2)
     return false;
   else if(a==2)
     return true;
   else if(a%2==0)
     return false;
   double b=sqrt(a);
    for(int i=3;i<=b;i+=2){
      if(a%i==0){
        return false;
      }
    }
   return true;
 }
struct Union{
  vector<int> par;
  Union(int n){
	par= vector<int>(n, -1);
  }
  int find(int x){
    if(par[x]<0)
      return x;
    else
      return par[x]=find(par[x]);
  }
  bool same(int a,int b){
    return find(a)==find(b);
  }
  int Size(int a){
    return -par[find(a)];
  }
  void unite(int a,int b){
    a=find(a);
    b=find(b);
    if(a==b)
      return;
    if(Size(b)>Size(a))
      swap<int>(a,b);
    par[a]+=par[b];
    par[b]=a;
  }
};
int ketas(int a){
  string b=to_string(a);
  int c=0;
  fo(i,keta(a)){
    c+=b[i]-'0';
  }
  return c;
}
signed main(){
  int a,e=0,f;
  cin>>a;
  f=a;
  vector<int> b(a),c,d(a);
  fo(i,a)
    cin>>b[i];
  Sort(b);
  d[0]=b[0];
  for(int i=1;i<a;i++)
    d[i]=d[i-1]+b[i];
  rev(d);
  fo(i,a){
    if(d[i]>d[i+1]*3){
      f=i+1;
      break;
    }
  }
  cout<<f<<endl;
}


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

#define rep(i, n) for(int i = 0; i<(n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
using ll = long long;

const int mod = 1000000007;

int main() {
    string S, T;
    cin >> S >> T;

    int ans = T.size();
    for (int i = 0; i < S.size() - T.size() + 1; i++) {
        int cnt = 0;
        for (int j = 0; j < T.size(); j++) {
            if (S[i + j] != T[j]) cnt++;
        }
        chmin(ans, cnt);
    }
    cout << ans << endl;
}


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

int main() {
	int a, b;
	cin >> a >> b;
	
	cout << 100 << " " << 100 << endl;
	int t = 0;
	char c[] = {'.', '#'};
	rep(i, 100) {
		rep(j, 100) {
			char now;
			if(i%2 == 0) {
				now = c[t];
			} else {
				if(j%2 == 1) {
					if(t == 0){
						if(b > 1) {
							now = c[!t];
							b--;
						} else {
							now = c[t];
						}
					} else {
						if(a > 1) {
							now = c[!t];
							a--;
						} else {
							now = c[t];
						}
					}
				} else {
					now = c[t];
				}
			}
			cout << now;
		}
		cout << endl;
		if (i%2==0 && t == 0) if(b == 1) {
			i++;
			t = 1; 
			rep(j, 100) {
				cout << c[t];
			}
			cout << endl;
		}
	}
	
	return 0;
}

Measured memory_bytes: 384
import java.util.Scanner;

/**
 *
 * @author kke2
 */
public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int weight = sc.nextInt();
        int time = sc.nextInt();
        int i = weight - time;
        if (weight < time) {
            i = 0;
        }
        
        System.out.println(i);
    }
}

Measured memory_bytes: 22224
//AOJ 0527: Setting Go Stones 
#include <iostream>
using namespace std;
int n, stones[100001], ans;
int main() {
	while (cin >> n){
		if (n == 0)
			break;
		for (int i = 1; i <= n; i++){
			cin >> stones[i];
			if (i % 2 == 0 && i != 1 && stones[i] != stones[i - 1]){
				for (int j = i - 1; j > 0; j--){
					if (stones[j] == stones[i])
						break;
					stones[j] = stones[i];
				}
			}
		}
		ans = 0;
		for (int i = 1; i <= n; i++){
			if (stones[i] == 0)
				ans++;
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 1548
/* 
	Author: ankrypt
*/
#include <bits/stdc++.h>

using namespace std;

int A, B;

int main()
{
	cin >> A;
	cin >> B;
	if((A * B) % 2 == 0)
	{
		cout << "Even" << "\n";
	}
	else
	{
		cout << "Odd\n";
	}
	
	return 0;
}
/*
	Powered by Buggy Plugin
*/


Measured memory_bytes: 256
def abc122_b():
    s = input()
    ans = 0

    # listのスライス操作でバグらないように!!!
    # list[0]はすらいすでとろうとするとlist[0:1]

    acgt = list('ACGT')

    for i in range(len(s)):
        for j in range(i, len(s)):

            # スライスなので、jには1加える必要あり。
            if all([x in acgt for x in ｓ[i : j + 1]]):
                # ifとか書かなくてもmaxで大きいほうを勝手に格納してしまう
                ans = max(ans, len(ｓ[i : j + 1]))

    print(ans)

if __name__ == '__main__':
    abc122_b()

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

int main() {
  int N, x;
  cin >> N >> x;
  vector<int> a(N);
  for (int i = 0; i < N; i++) cin >> a.at(i);
  sort(a.begin(), a.end());
  int count = 0;
  while (x > 0) {
    x -= a.at(count);
    count++;
    if (count == N) break;
  }
  if (x == 0) cout << count << endl;
  else cout << count - 1 << endl;
}


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

int main(){
  int M, D;
  cin >> M >> D;
  int d1=0, d2=0;
  int s=0;
  long ans = 0;
  for(int i = 1; i <= D; i++){
    d1 = i % 10;
    d2 = i / 10;
    if(d1 < 2 || d2 < 2) continue;
    s = d1 * d2;
    if(s <= M) ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256