akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>

using namespace std;
using ll = long long;
using ull = unsigned long long;

const ll INF = 1e16;
const ll MOD = 1e9 + 7;

#define REP(i, n) for(int i = 0; i < n; i++)
#define RREP(i, n) for(int i = n - 1; i >= 0; i--)
#define REP2(i, n, k) for(int i = 0; i < n; i += k)



int main() {
    ll n, k;
    
    cin >> n >> k;
    
    if(k == 0){
        cout << n * n << endl;
        return 0;
    }
    
    ll ans = 0;
    for(ll i = k + 1; i <= n; i++){
        /*
        for(ll j = k; j < i; j++){
            ans += (n - j) / i + 1;
        }
        */
        
        ll t = i - k;
        ans += t * ((n - k) / i + 1);
        /*
        ll j;
        for(j = k; j < i; j++){
            if(j + (i * ((n - k) / i)) > n){
                break;
            }
        }
        if(j != k - 1){
            ans -= (i - j);
        }
        */
        ll le = k, ri = i - 1, ce = (le + ri) / 2;
        while(ri - le > 1){
            if(ce + (i * ((n - k) / i)) > n){
                ri = ce;
            }
            else{
                le = ce;
            }
            ce = (le + ri) / 2;
        }

        if(!((ri + (i * ((n - k) / i)) <= n))){
            ans -= (i - ce - 1);
        }
        // cout << ans << endl;
    }
    
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bits/stdc++.h>
#include <cstdint>
#include <iostream>
#include <iterator>
#include <vector>

// lib/square.hpp
#ifndef SQUARE_HPP
#define SQUARE_HPP

/*
usage:

tools::square(5) => 25
*/

namespace tools {
  template <typename T>
  constexpr T square(const T x) {
    return x * x;
  }
}

#endif

// lib/util.hpp
#ifndef UTIL_HPP
#define UTIL_HPP


typedef ::std::int_fast64_t i64;
typedef ::std::uint_fast64_t u64;
typedef ::std::int_fast32_t i32;
typedef ::std::uint_fast32_t u32;

namespace tools {
  template <typename T>
  void read(::std::istream& is, ::std::vector<T>& vector, const typename ::std::vector<T>::size_type size) {
    vector.reserve(size);
    ::std::copy_n(::std::istream_iterator<T>(is), size, ::std::back_inserter(vector));
  }
  template <typename T>
  void read(::std::vector<T>& vector, const typename ::std::vector<T>::size_type size) {
    ::tools::read(::std::cin, vector, size);
  }

  template <typename T, ::std::size_t N>
  void read(::std::istream& is, ::std::array<T, N>& array) {
    ::std::copy_n(std::istream_iterator<T>(is), N, array.begin());
  }
  template <typename T, ::std::size_t N>
  void read(::std::array<T, N>& array) {
    ::tools::read(::std::cin, array);
  }
}

#endif

// lib/pow.hpp
#ifndef POW_H
#define POW_H


/*
usage:

tools::pow(2, 5) => 32
*/

namespace tools {
  template <typename T>
  constexpr T pow(const T base, const T exponent) {
    return exponent == 0
      ? 1
      : exponent % 2 == 0
        ? square(pow(base, exponent / 2))
        : pow(base, exponent - 1) * base;
  }
}

#endif

// main.cpp

int main() {
  i64 N;
  std::cin >> N;
  std::cout << tools::pow<i64>(N, 3) << std::endl;
  return 0;
}

Measured memory_bytes: 256
T=0..59
puts 9394,a=?+,0,1,3,?<,2,3,3,[0,1].map{|x|[a,x,3,x]+T.map{[a,v=x+4,v,v,a,v,3,6,[a,6,6,6]*(59-_1),?<,6,x,u=x*120+_1+9,a,v,u,v]}},T.map{|t|[a,2,2,2]+(1..t).map{[a,39+t-_1,158+_1,5,?<,3,5,5,a,2,5,2]}}

Measured memory_bytes: 14980
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#define mm(a,x) memset(a,x,sizeof(a))
#define sync std::ios::sync_with_stdio(false);std::cin.tie(0)
#define ll long long
using namespace std;
int main(void)
{
    double l;
    scanf("%lf",&l);
    printf("%.12lf\n",l*l*l/27);
    return 0;
}

Measured memory_bytes: 128
#include<string>
#include<string.h>
#include<map>
#include<set>
#include<vector>
#include<stdio.h>
#include<math.h>
#include<iostream>
#include<algorithm>
#include<queue>
#include<stdio.h>

using namespace std;


char a[55][55];
int main()
{
    int x,y,k=0;
    cin>>x>>y;
    for(int i=1;i<=x;i++)
    {
        for(int j=1;j<=y;j++)
        {
            cin>>a[i][j];
        }
    }
    for(int i=1;i<=x;i++)
    {
        for(int j=1;j<=y;j++)
        {
            if(a[i][j]=='#' && a[i][j+1]!='#' && a[i][j-1]!='#' && a[i+1][j]!='#' && a[i-1][j]!='#')k++;
        }
    }
    if(k==0)
    cout<<"Yes";
    else
    cout<<"No";
 
    return 0;
} 

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

typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1e9+7;
#define rep(i,N) for(ll i=0; i<(N); i++)
#define rep1(i,N) for(ll i=1; i<(N); i++)
#define pb push_back

ll c[5][5];

int main(){

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

rep1(i,4)rep1(j,4) cin>>c[i][j];

ll c1,c2,c3=0;
if(c[2][1]-c[1][1]==c[2][2]-c[1][2]) c1++;
if(c[2][1]-c[1][1]==c[2][3]-c[1][3]) c2++;
if(c[2][2]-c[1][2]==c[2][3]-c[1][3]) c3++;
ll d1,d2,d3=0;
if(c[3][1]-c[1][1]==c[3][2]-c[1][2]) d1++;
if(c[3][1]-c[1][1]==c[3][3]-c[1][3]) d2++;
if(c[3][2]-c[1][2]==c[3][3]-c[1][3]) d3++;

puts(c1*c2*c3*d1*d2*d3?"Yes":"No");


}
	


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

int main()
{
    long long n;
    cin >> n;
    if (n == 1)
    {
        cout << 0 << endl;
        return 0;
    }
    long long num = n;
    map<long long, long long> dic;
    for(long long i = 2; i * i <= n; ++i)
    {
        long long r = num % i;
        while (r == 0)
        {
            ++dic[i];
            num = num / i;
            r = num % i;
        }
    }
    // 割り続けて1とならない場合,
    // numはまだ出ていない素数となる(あるいはnそのものは素数である)
    // したがって、これもカウントする
    if (num != 1)
    {
        dic[num] = 1;
    }

    long long ans = 0;
    for (const auto& e : dic)
    {
        long long cnt = 0;
        long long ex = e.second;
        long long i = 1;
        while(ex > 0)
        {
            ex -= i;
            if (ex < 0) break;
            ++cnt;
            ++i;
        }
        ans += cnt;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3644
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (n); ++i)
typedef long long ll;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}
const ll INF = 1LL << 60;

int main(){
	int a, b;
	cin >> a >> b;
	if( a == b ) puts("Draw");
	else if (a == 1) puts("Alice");
	else if (b == 1) puts("Bob");
	else if (a > b) puts("Alice");
	else puts("Bob");
}


Measured memory_bytes: 256
a=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]
N=int(input())
li=list(input())
for i in li:
  num=a.index(i)+N
  if num >= 26:
    num-=26
  print(a[num],end="")  

Measured memory_bytes: 4596
#include<iostream>
#include<algorithm>
#include<string.h>
#include<cmath>
using namespace std;
int main()
{
	long long int t=1,a,b,k,i;
	while(t--)
	{
	scanf("%lld %lld %lld",&a,&b,&k);
	for(i=0;i<k;i++)
	{
		if(i%2==0)
		{
		if(a%2==0)
		{
			a=a/2;
			b=b+a;
			//printf("%lld %lld\n",a,b);
		}
		else
		{
			a=a-1;
			a=a/2;
			b=b+a;
			//printf("%lld %lld\n",a,b);
		}
		}
		else
		{
			if(b%2==0)
		{
			b=b/2;
			a=a+b;
			//printf("%lld %lld\n",a,b);
		}
		else
		{
			b=b-1;
			b=b/2;
			a=a+b;
			//printf("%lld %lld\n",a,b);
		}
			}
		}
			printf("%lld %lld",a,b);	
		
		
		
		
		
	}
	
	
	
	
	
	
	
	
	
	
	
	
	
	return 0;
}

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

struct segtree{
  vector<ll> t,u;
  int n;
   
  void init(int _n){
    n=1;
    while(n<_n)n*=2;
    t.clear();
    u.clear();
    t.resize(2*n);
    u.resize(2*n);
    for(int i=0;i<2*n;i++)t[i]=u[i]=0;
  }
   
  void delay(int k,int l,int r){
    if(r-l==1)return;
    t[k*2+1]+=u[k];
    u[k*2+1]+=u[k];
    t[k*2+2]+=u[k];
    u[k*2+2]+=u[k];
    u[k]=0;
  }
   
  void add(int a,int b,ll x,int k,int l,int r){
    if(b<=l || r<=a)return;
    delay(k,l,r);
    if(a<=l && r<=b){
      t[k]+=x;
      u[k]+=x;
    }else{
      int m=(l+r)/2;
      add(a,b,x,k*2+1,l,m);
      add(a,b,x,k*2+2,m,r);
      t[k]=min(t[k*2+1],t[k*2+2]);
    }
  }
   
  ll query(int a,int b,int k,int l,int r){
    if(b<=l || r<=a)return INF;
    delay(k,l,r);
    if(a<=l && r<=b){
      return t[k];
    }else{
      int m=(l+r)/2;
      ll lc=query(a,b,k*2+1,l,m);
      ll rc=query(a,b,k*2+2,m,r);
      return min(lc,rc);
    }
  }
   
  void add(int a,int b,ll x) {
    add(a,b,x,0,0,n);
  }
   
  ll query(int a,int b){
    return query(a,b,0,0,n);
  }
};


int N,Q;
segtree T;

void solve(ll a,ll b){
  while(b){

    //    for(int i=0;i<N;i++)cout<<T.query(i,i+1)<<' ';cout<<endl;
    
    ll key=T.query(a-1,a);
    ll left=0,right=a-1,mid;
    while(left<right){
      mid=(left+right)/2;
      if(T.query(mid,mid+1)>key)left=mid+1;
      else right=mid;
    }
    ll L=left, R=a;
    //    cout<<L<<' '<<R<<endl<<endl;
    
    if(R-L>=b){
      T.add(L,L+b,1);
      break;
    }

    ll target;
    if(L==0)target=INF;
    else target=T.query(L-1,L);

    
    ll total;
    if(target==INF)total=INF;
    else total=(R-L)*(target-key);
    
    if(b>=total){
      b-=total;
      T.add(L,R, target-key );
    }else{
      ll esc=b/(R-L);
      T.add(L,R, esc );
      b-=esc*(R-L);
    }
  }
}

int main(){
  scanf("%d %d",&N,&Q);
  T.init(N);
  
  for(int i=0;i<Q;i++){
    ll a,b;
    scanf("%lld %lld",&a,&b);
    solve(a,b);
  }
  
  for(int i=0;i<N;i++){
    ll ans=T.query(i,i+1);
    printf("%lld\n",ans);
  }
  return 0;
}


Measured memory_bytes: 5760
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		
		Scanner s = new Scanner(System.in);
		
		int a = Integer.parseInt(s.next());
		int b = Integer.parseInt(s.next());
		int c = Integer.parseInt(s.next());
		int counter = 0;
		
		while(true){
			 
			if(a>b){
				 break;
			 }
			
			if(c%a == 0){
				counter++;
			}
			a++;
			
			
		}
		
		System.out.println(counter);
	}

}

Measured memory_bytes: 26172
import std.algorithm;
import std.bigint;
import std.concurrency;
import std.container;
import std.conv;
import std.functional;
import std.format;
import std.math;
import std.meta;
import std.numeric;
import std.random;
import std.range;
import std.stdio;
import std.string;
import std.traits;
import std.typecons;


auto solve(string S) {
    if (S == "Sunny") return "Cloudy";
    if (S == "Cloudy") return "Rainy";
    if (S == "Rainy") return "Sunny";
    return "";
}


void main() {
    auto input = stdin.byLine.map!split.joiner;

    string S;
    S = input.front.to!string;
    input.popFront;

    static if (is(ReturnType!solve == void))
        solve(S);
    else
        solve(S).writeln;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int M=1e9+7,M2=1e9+9;
const int Base=100,B2=457;
const int N=310;
char s[N+N][N+N];
int n;
pair<int,int> r[N][N],c[N][N];//i row rotate j
pair<int,int> calcr(int x,int y){
	pair<int,int> ret;
	int p=1,p2=1;
	for (int i=1; i<=n; ++i){
		// if (i!=x){
			(ret.first+=(long long)p*(s[x][y+i]-'a'+1)%M)%=M;
			(ret.second+=(long long)p2*(s[x][y+i]-'a'+1)%M2)%=M2;
		// }
		p=(long long)p*Base%M;
		p2=(long long)p2*B2%M2;
	}
	return ret;
}
pair<int,int> calcc(int x,int y){
	pair<int,int> ret;
	int p=1,p2=1;
	for (int i=1; i<=n; ++i){
		// if (i!=x){
			(ret.first+=(long long)p*(s[x+i][y]-'a'+1)%M)%=M;
			(ret.second+=(long long)p2*(s[x+i][y]-'a'+1)%M2)%=M2;
		// }
		p=(long long)p*Base%M;
		p2=(long long)p2*B2%M2;
	}
	return ret;
}
int main(){
	scanf("%d",&n);
	for (int i=1; i<=n; ++i){
		scanf("%s",s[i]+1);
		for (int j=n+1; j<n+n; ++j) s[i][j]=s[i][j-n];
		for (int j=0; j<n; ++j){
			r[i][j]=calcr(i,j);
			// cerr<<i<<" "<<j<<" "<<r[i][j]<<endl;
		}
	}
	for (int i=n+1; i<n+n; ++i){
		for (int j=1; j<=n; ++j)
		s[i][j]=s[i-n][j];
	}
	// for (int i=1; i<n+n; ++i) cout<<s[i]+1<<endl;
	for (int i=0; i<n; ++i)
	for (int j=1; j<=n; ++j){
		c[i][j]=calcc(i,j);
		// cerr<<"c:"<<i<<" "<<j<<" "<<c[i][j]<<endl;
	}
	int ans=0;
	for (int A=0; A<n; ++A)
	for (int B=0; B<n; ++B){
		bool flag=1;
		for (int i=1; i<=n; ++i){
			if (r[(i-A+n-1)%n+1][(n-B)%n]!=c[(n-A)%n][(i-B+n-1)%n+1]) flag=0;
			// cerr<<i<<" "<<r[(i-A+n-1)%n+1][B].first<<" "<<c[A][(i-B+n-1)%n+1].first<<endl;
		}
		// if (flag) cerr<<A<<" "<<B<<endl;
		// system("pause");
		ans+=flag;
	}
	cout<<ans;
}

Measured memory_bytes: 2048
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <cstdlib>
#include <cassert>
#include <cstdio>
#include <cmath>
#include <string>
#include <unordered_map>
#include <iomanip>
#include <deque>
using namespace std;
//#define int long long

signed main() {
#ifndef ONLINE_JUDGE
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
#endif
	int n, m, k;
	cin >> n >> m >> k;
	for (int i = 0; i <= m; ++i) {
		for (int j = 0; j <= n; ++j) {
			if (i * n + j * m - 2 * i * j == k) {
				return 0 * printf("Yes");
			}
		}
	}
	cout << "No" << endl;
}

Measured memory_bytes: 256
def main():
    N = int(input())
    h = list(map(int, input().split()))

    ans = 0
    while True:
        # max(h)が0になったら終了
        if max(h) == 0:
            break

        i = 0
        while i < N:
            # h[i]が0なら次に進む
            if h[i] == 0:
                i += 1
            else:
                # h[i]が0になるところまでとりあえず-1する
                ans += 1
                while (i < N and h[i] > 0):
                    h[i] -= 1
                    i += 1

    print(ans)


main()

Measured memory_bytes: 39152
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        List<Integer> list = new ArrayList<>();
        int ans = 0;
        for (int i = 0; i < N; i++) {
            int tmp = sc.nextInt();
            list.add(tmp);
            ans += tmp;
        }

        if (ans % 10 == 0) {
            Collections.sort(list);
            for (int i = 0; i < N; i++) {
                if ((ans - list.get(i)) % 10 != 0) {
                    ans = ans - list.get(i);
                    break;
                }
            }
        }

        if (ans % 10 == 0)
            System.out.println(0);
        else
            System.out.println(ans);
    }

}


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

int main() {
  int n;
  cin >> n;
  std::vector<int> a(n);
  std::vector<int> b(n);
  rep(i,n) {
    int x;
    cin >> x;
    a.at(i) = x;
    b.at(i) = x;
  }
  sort(b.begin(), b.end());
  rep(i,n) {
    auto result = find(a.begin(), a.end(), b.at(i));
    std::size_t index = std::distance(a.begin(), result);
    cout << index + 1 << " ";
  }
  cout << endl;
}


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

using namespace std;
using ll = long long int;
constexpr ll M = 1e9 + 7;
inline ll sum_1(const ll n) { return ((n * (n + 1)) / 2) % M; }
inline ll sum_2(const ll n) { return ((n * (n + 1) * (2 * n + 1)) / 6) % M; }
inline ll sum_3(const ll n) { return (((n * (n + 1)) / 2) % M * ((n * (n + 1)) / 2) % M) % M; }
inline ll sum_1(const ll i, const ll j) { return (sum_1(j) - sum_1(i - 1) + M) % M; }
inline ll sum_2(const ll i, const ll j) { return (sum_2(j) - sum_2(i - 1) + M) % M; }
inline ll sum_3(const ll i, const ll j) { return (sum_3(j) - sum_3(i - 1) + M) % M; }

ll pow_f(ll b, ll e) {
    ll ans = 1;
    b = b % M;
    while (e) {
        if (e&1) {
            ans = (ans * b) % M;
        }
        b = (b * b) % M;
        e >>= 1;
    }
    return ans;
}

ll nCr(ll n, ll r) {
    if (r > n || n < 0 || r < 0) { return 0; }
    if (n == r || r == 0) { return 1; }
    r = min(r, n-r);
    ll ans = 1;
    for (ll i = 1; i <= r; ++i) {
        ans = (ans * (n-i+1))/(i); 
    }
    return ans;
}

ll nCr(tuple<ll,ll> t) {
    auto n = get<0>(t);
    auto k = get<1>(t);
    return nCr(n+k-1, k);
}

template<typename T>
void print(T v) {
    cout << v << " ";
}

template<typename T>
void print(vector<T> v) {
    for (auto &i : v) {
        print(i);
    }
    cout << endl;
}

void solve() {
    ll a, b, n;
    cin >> a >> b >> n;

    ll x = min(b-1, n);
    cout << ((a*x)/b) - a*(x/b) << endl;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    #ifdef D_LOCAL
        freopen("in.in", "r", stdin);
        freopen("out.out", "w", stdout);
    #endif

    solve();

    return 0;
}

Measured memory_bytes: 3664
package main

import (
	"fmt"
)

func main() {
	var s string
	fmt.Scan(&s)
	
	if s[len(s)-1:] == "2" || s[len(s)-1:] == "4" || s[len(s)-1:] == "5" || s[len(s)-1:] == "7" || s[len(s)-1:] == "9" {
		fmt.Println("hon")
	}else if s[len(s)-1:] == "0" || s[len(s)-1:] == "1" || s[len(s)-1:] == "6" || s[len(s)-1:] =="8"{
		fmt.Println("pon")
	}else{
		fmt.Println("bon")
	}
}


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

using namespace std;

#define YES cout << "YES" << endl;
#define NO  cout << "NO"  << endl;
#define Yes cout << "Yes" << endl;
#define No  cout << "No"  << endl;
 
#define INF INT_MAX
#define MOD 1000000007
#define PI  acos(-1)

using ll  = long long;
using ull = unsigned long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

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

int main(int argc, char *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    int N, M;
    cin >> N >> M;

    vector<string> A(N), B(M);
    rep (i, N) {
        cin >> A[i];
    }
    rep (i, M) {
        cin >> B[i];
    }

    rep (i, N-M+1) {
        rep (j, N-M+1) {
            bool flag = true;
            rep (k, M) {
                rep (l, M) {
                    if (A[i+k][j+l] != B[k][l]) {
                        flag = false;
                    }
                }
            }
            if (flag) {
                Yes
                return 0;
            }
        }
    }

    No
    return 0;
}

Measured memory_bytes: 256
#k = int(input())
#s = input()
#a, b = map(int, input().split())
#s, t = map(str, input().split())
#l = list(map(int, input().split()))
#l = [list(map(int,input().split())) for i in range(n)]
#a = [list(input()) for _ in range(n)]
#a = [int(input()) for _ in range(n)]

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

if (abs(x-a) < abs(x-b)):
    print("A")
elif (abs(x-a) > abs(x-b)):
    print("B")


Measured memory_bytes: 9064
#include "bits/stdc++.h"
using namespace std;
const int MAX = 700000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
/*第二引数で第一引数を割ったときの切り上げの計算*/
long long int maxtime(long long int x, long long int y) {
	return(x + y - 1) / y;

}
/*最大公約数*/
long long int lcm(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;

	if (number2 > number1) {
		m = number2;
		n = number1;
	}
	long long int s = -1;
	while (s != 0) {
		s = m % n;
		m = n;
		n = s;
	}
	return m;
}
/*最大公倍数*/
long long int gcd(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;
	return m / lcm(m, n) * n;
}
int main() {
	int n;
	cin >> n;
	string s;
	cin >> s;
	int fians = 0;
	for (int i = 0; i < n; i++) {
		map<char, int> k;
		int sum = 0;
		for (int j = 0; j < i; j++) {
			if (k[s[j]]== 0) {
				k[s[j]]++;
			}
		}
		for (int j = i; j < n; j++) {
			if (k[s[j]] == 1) {
				k[s[j]]++;
			}
		}
		for (auto t : k) {
			if (t.second == 2) {
				sum++;
			}
		}
		if (sum >= fians) {
			fians = sum;
		}
	}
	cout << fians;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    int ans=0;
    cin >> n;
    for(int i=1;i<=n;i++){
    	int x;
    	cin >> x;
    	if(i%2&&x%2)
    	ans++;
	}
	cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3624
S=input()

ls = len(S)
cnt1 = 0
for i in range(ls):
    if (i % 2 == 0):
        if(S[i] == '0'):
            cnt1 += 1
    if (i % 2 == 1):
        if(S[i] == '1'):
            cnt1 += 1
cnt2 = 0
for i in range(ls):
    if (i % 2 == 0):
        if(S[i] == '1'):
            cnt2 += 1
    if (i % 2 == 1):
        if(S[i] == '0'):
            cnt2 += 1

print(min(cnt1,cnt2))

Measured memory_bytes: 3188
import java.util.*;

public class Main {
	public static void main(String[] args) {  
  		Scanner sc = new Scanner(System.in);
		int row = sc.nextInt();
      	int col = sc.nextInt();
      	int paintRow = sc.nextInt();
      	int paintCol = sc.nextInt();
      
      	System.out.println((row * col) - (paintRow * col)
        	- ((row - paintRow) * paintCol));
    }
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5+5;
int a[maxn],s[maxn];
int n,mx=0,k;
int main(){
	cin >> k >> n;
	for (int i=1;i<=n;i++){
		cin >> a[i];	
	}
	a[0] = a[n]-k;
	for (int i=1;i<=n;i++){
		s[i] = a[i] - a[i-1];
		mx = max(mx,s[i]);	
	}
	cout << (k-mx);
	return 0;
}

Measured memory_bytes: 1792
//To debug :  g++ -g file.cpp -o code
//to flush output : fflush(stdout) or cout.flush()
//cout<<setprecision(p)<<fixed<<var
//use 1LL<<i to for 64 bit shifting , (ll)2 because by default 2 is ll
 
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,a,n) for(i=a;i<n;++i)
#define irep(i,n,a) for(i=n;i>a;--i)
#define mod 1000000007
#define pb push_back
#define big 9223372036854775807
#define big1 LONG_MAX
#define big2 ll_MAX
#define big3 1000000000
#define sma1 LONG_MIN
#define sma2 ll_MIN
#define sma3 -1000000000
#define mp make_pair
#define dub double
#define ivec vector<ll>
#define lvec vector<long long>
#define cvec vector<char>
#define svec vector<string>
#define mt make_tuple
#define MOD 998244353
#define ld long double
#define pi acos(-1.0)

#define SZ(x)  (ll)(x.size())
/*
#define ss second.second
#define ff first.first
#define f first
#define s second
#define sf second.first
#define fs first.second*/
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)

int main()
{

    ll n,siz,i,tot,c,val = 26,prev=0;

    char j ;

    cin>>n;

    if(n<=26)
    {
        cout<<(char('a'-1+n))<<"\n";
        return 0;
    }


    tot = 26;

    c = 1;

    while(n>tot)
    {
        ++c;
        val = val*26;
        prev = tot;
        tot += val;
    }


    //means size of string will be c

    n -= prev;


    for(i=1;i<=c;++i)
    {

        if(i==c)
        {
            cout<<(char)('a'+(char)n-1)<<"\n";
            break;
        }

        for(j='a';j<='z';++j)
        {
            val = pow((ld)26,(ld)(c-i));

            if((n-val)<=0)
            {
                cout<<j;
                break;
            }
            else
            {
                n = n-val;
            }

        }
    }





    return 0;
}

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

int main(){
  int N,K;
  cin >>N>>K;
  double p[N+100];
  double temp;
  double a[N+100];
  a[0]=0;
  for (int i=1;i<N+1;i++){
    cin>>temp;
    p[i]=(temp+1)/2;
    a[i]=a[i-1]+p[i];
  }
  double ans=0;
  for (int i=1;i<N+2-K;i++){
    ans=max(ans,a[i+K-1]-a[i-1]);
  }
  cout<<setprecision(10)<<ans<<endl;  
  return 0;
}

      
      
  
  

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

int w[100][100], p[50][50], c[50][50];
int main() {
	int n, m;
	while (scanf("%d%d", &n, &m), n) {
		rep(i, n)rep(j, n)scanf("%d", &w[i][j]);
		rep(i, m)rep(j, m)scanf("%d", &p[i][j]);
		rep(i, n - m + 1)rep(j, n - m + 1) {
			rep(k, 4) {
				rep(x, m)rep(t, m)c[t][m - x - 1] = p[x][t];
				rep(x, m)rep(t, m)p[x][t] = c[x][t];
				rep(x, m)rep(t, m) {
					if (~p[x][t] && p[x][t] != w[i + x][j + t])goto g;
				}
				rep(x, m)rep(y, m) {
					if (~p[x][y]) {
						printf("%d %d\n", j + y + 1, i + x + 1); goto p;
					}
				}
			g:;
			}
		}
		puts("NA");
	p:;
	}
}

Measured memory_bytes: 3260
let () =
  Scanf.scanf "%d %d" @@ fun a b ->
  let a = a - 1 in
  Array.init 40 (fun i ->
    let d = 1 lsl i in
    let bc = b / (2 * d) * d + max 0 (b mod (2 * d) - d + 1) in
    let ac = a / (2 * d) * d + max 0 (a mod (2 * d) - d + 1) in
    ((bc - ac) mod 2) lsl i)
  |> Array.fold_left (+) 0
  |> Printf.printf "%d\n"



Measured memory_bytes: 384
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int n,k,p[100010],q[100010],A[100010],pv[100010],qv[100010],Av[100010],ans[100010],a[7][100010];
void mul(int a[],int b[],int c[])
{
	static int X[100010];
	for(int i=1;i<=n;++i)X[i]=a[b[i]];
	memcpy(c+1,X+1,n<<2);
}
void kpow(int a[],int b,int c[])
{
	static bool vis[100010];
	static int st[100010],tp,X[100010];
	memset(vis+1,0,n);
	for(int i=1;i<=n;++i)
		if(!vis[i])
		{
			int x=i;tp=0;
			while(!vis[x])st[++tp]=x,vis[x]=1,x=a[x];
			for(int j=1;j<=tp;++j)X[st[j]]=st[(j+b-1)%tp+1];
		}
	memcpy(c+1,X+1,n<<2);
}
int main()
{
	scanf("%d %d",&n,&k);
	for(int i=1;i<=n;++i)scanf("%d",&p[i]),pv[p[i]]=i;
	for(int i=1;i<=n;++i)scanf("%d",&q[i]),qv[q[i]]=i;
	memcpy(A+1,q+1,n<<2);
	mul(A,pv,A);
	mul(A,qv,A);
	mul(A,p,A);
	for(int i=1;i<=n;++i)Av[A[i]]=i;
//	for(int i=1;i<=n;++i)printf("%d ",A[i]);printf("\n");
//	for(int i=1;i<=n;++i)printf("%d ",Av[i]);printf("\n");		
	kpow(A,(k-1)/6,A);
	kpow(Av,(k-1)/6,Av);
//	for(int i=1;i<=n;++i)printf("%d ",A[i]);printf("\n");
//	for(int i=1;i<=n;++i)printf("%d ",Av[i]);printf("\n");	
	memcpy(ans+1,A+1,n<<2);
	memcpy(a[1]+1,p+1,n<<2);memcpy(a[2]+1,q+1,n<<2);
	for(int i=3;i<=(k-1)%6+1;++i)
		for(int j=1;j<=n;++j)a[i][a[i-2][j]]=a[i-1][j];
	mul(ans,a[(k-1)%6+1],ans);
	mul(ans,Av,ans);
	for(int i=1;i<=n;++i)printf("%d ",ans[i]);
	return 0;
}


Measured memory_bytes: 7040
import sys
stdin = sys.stdin

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
s = lambda h: [list(map(int, stdin.readline().split())) for i in range(h)]

a, b, c = na()

print("YES" if b - a == c - b else "NO")

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

#define lint long long

const lint INF = 1E9;
// #define P pair<lint, int>

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

    set<int> ans;

    for(int i = 0; i < K; ++i){
        ans.insert(min(A + i, B));
    }
    for(int i = 0; i < K; ++i){
        ans.insert(max(B - i, A));
    }

    for(auto e : ans){
        cout << e << endl;
    }
}


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;
import java.util.stream.IntStream;

public class Main {
	public static void main(String[] args) {
		try (Scanner s = new Scanner(System.in)) {
			final int N = s.nextInt();
			final int[] A = IntStream.generate(s::nextInt).limit(N).toArray();

			int x = Arrays.stream(A).sum()
					- 2 * IntStream.range(1, N)
							.filter(i -> i % 2 == 1)
							.mapToObj(i -> A[i])
							.mapToInt(i -> i).sum();
			System.out.print(x);
			for (int i = 1; i < N; i++) {
				x = 2 * A[i - 1] - x;
				System.out.print(" " + x);
			}
			System.out.println();
		}
	}
}


Measured memory_bytes: 64132
#include <iostream>
#include <complex>
#include <cmath>
#include <algorithm>
#include <cstdio>
using namespace std;
typedef complex<double> P;

double cross(P a, P b) {
  return (a.real() * b.imag() - a.imag() * b.real());
}
P outcircle(P a,P b,P c){
  return (norm(b-c)*(norm(c-a)+norm(a-b)-norm(b-c))*a+
	  norm(c-a)*(norm(a-b)+norm(b-c)-norm(c-a))*b+
	  norm(a-b)*(norm(b-c)+norm(c-a)-norm(a-b))*c)/(P)(4*cross(b-a,c-a)*cross(b-a,c-a));
}

int main(){
  int n;
  double x1,y1,x2,y2,x3,y3;
  P a,b,c;
  cin>>n;
  for(;n>0;n--){
    cin >>x1 >>y1 >>x2 >>y2 >>x3 >>y3;
    P a=P(x1,y1);
    P b=P(x2,y2);
    P c=P(x3,y3);
    P q = outcircle(a,b,c);
    printf("%.3f %.3f %.3f\n",q.real(),q.imag(),abs(a-q));
  }
  return 0;
}

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

int main() {
  int A, B, C ,D;
  cin >> A >> B >> C >> D;
  if (A + B  == C + D) {
    cout << "Balanced" << endl;
  }
  else if (A + B < C + D) 
  {
      cout << "Right" << endl;
  }
  else
  {
      cout << "Left" << endl;
  }
}


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

using namespace std;

#define pb push_back
#define mp make_pair
#define fs first
#define fst first
#define sc second
#define snd second
#define sz(X) (int)(X).size()
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define fornr(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define forab(i, a, b) for(int i = int(a); i < int(b); i++)
#define all(X) X.begin(), X.end()

typedef long long ll;
typedef vector<pair<ll, ll>> vpll;
typedef pair<int, int> pii;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef double dbl;
typedef long double ld;
typedef vector<int> vi;

int cnt2(ll x) {
    int ans = 0;
    while (x % 2 == 0) {
        ans++;
        x /= 2;
    }
    return ans;
}

int cnt5(ll x) {
    int ans = 0;
    while (x % 5 == 0) {
        ans++;
        x /= 5;
    }
    return ans;
}

int main() {
    //ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cout.precision(20);
    int n;
    cin >> n;
    ll ans = 0;
    map<pii, ll> cnt;
    string s;
    forn(i, n) {
        cin >> s;
        ll x = 0;
        bool f = false;
        for (char c : s) {
            if (c != '.') x = x * 10 + (c - '0');
            else f = true;
        }
        ll y = 1;
        if (f) {
            ll p = sz(s) - s.find('.') - 1;
            forn(j, p) y *= 10;
        }
        ll g = __gcd(x, y);
        x /= g, y /= g;
        cnt[{cnt2(x) - cnt2(y), cnt5(x) - cnt5(y)}]++;
    }
    for (const auto &p1: cnt) {
        int x = p1.fst.fst, y = p1.fst.snd;
        if (x >= 0 && y >= 0) ans += p1.snd * (p1.snd - 1);
        for (const auto &p2: cnt) {
            if (p1.fst == p2.fst) continue;
            int a = p2.fst.fst, b = p2.fst.snd;
            if (a + x >= 0 && b + y >= 0) ans += p1.snd * p2.snd;
        }
    }
    ans /= 2;
    cout << ans << "\n";
    return 0;
}

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

int main() {
    long long int n,n2,a,b,ans;cin>>n;
    
    n2 = sqrt(n);
    
    for(long long int i=n2;i>=1;--i){
        if(n%i==0){
            a=n/i;
            b=i;
            break;
        }
    }
    
    ans=a+b-2;

    cout<<ans<<endl;

	return 0;
}

Measured memory_bytes: 256
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys,collections,itertools,re,math,fractions,decimal,random,array,bisect,heapq

# decimal.getcontext().prec = 50
# sys.setrecursionlimit(10000)
# MOD = 10**9 + 7

def solve(f):
    n, q = f.read_int_list()
    g = collections.defaultdict(list)
    for _ in xrange(n-1):
        a, b = f.read_int_list()
        g[a].append(b)
        g[b].append(a)

    c = [0] * (n+1)

    for _ in xrange(q):
        p, x = f.read_int_list()
        c[p] += x

    vis = [False] * (n+1)
    que = [(1, 0)]
    while len(que) > 0:
        vi, vp = que.pop()
        vis[vi] = True
        c[vi] += c[vp]
        for vii in g[vi]:
            if not vis[vii]:
                que.append((vii, vi))

    return " ".join(map(str, c[1:]))


class Reader(object):
    def __init__(self, filename=None):
        self.file = open(filename) if filename is not None else None
        self.case = 1

    def __readline(self):
        return self.file.next().strip() if self.file else raw_input()

    def next_case(self):
        self.file.next()
        self.case += 1

    def read_int(self): return int(self.__readline())
    def read_float(self): return float(self.__readline())
    def read_long(self): return long(self.__readline())
    def read_decimal(self): return decimal.Decimal(self.__readline())
    def read_str(self): return self.__readline()

    def read_int_list(self): return map(int, self.__readline().split())
    def read_float_list(self): return map(float, self.__readline().split())
    def read_long_list(self): return map(long, self.__readline().split())
    def read_decimal_list(self): return map(decimal.Decimal, self.__readline().split())
    def read_str_list(self): return self.__readline().split()

if __name__ == '__main__':
    filename = sys.argv[1] if len(sys.argv) > 1 else None
    f = Reader(filename)
    if f.file:
        while True:
            print "Case #%d\n"%f.case, solve(f)
            try:
                f.next_case()
            except StopIteration:
                break
    else:
        print solve(f)


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

int main(){
  int a,b,c,d,e;
  cin >> a >> b >> c >> d >> e;
  int hour = 0;
  int minute = 0;
  
  if(a > c){
    hour = c + 24 -a;
  }
  else{
    hour = c - a;
  }
  
  if(b > d){
    minute = d + 60 - b;
    hour--;
  }
  else{
    minute = d - b;
  }
  
  
  int result = 60 * hour + minute - e;
  cout << result << endl;
  
}

Measured memory_bytes: 3624
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <math.h>
#include <assert.h>
#include <vector>
#include <queue>
#include <set>

using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
static const double EPS = 1e-9;
static const double PI = acos(-1.0);

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, n) for (int i = (s); i < (int)(n); i++)
#define FOREQ(i, s, n) for (int i = (s); i <= (int)(n); i++)
#define FORIT(it, c) for (__typeof((c).begin())it = (c).begin(); it != (c).end(); it++)
#define MEMSET(v, h) memset((v), h, sizeof(v))

int h, w;
char field[100][100];
bool visit[100][100];
bool dfsvisit[50];
bool charvisit[200];
const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };
set<int> edges[50];

bool dfs(int where, int from) {
  if (where == from && dfsvisit[where]) { return false; }
  if (dfsvisit[where]) { return true; }
  dfsvisit[where] = true;
  FORIT(it, edges[where]) {
    if (!dfs(*it, from)) { return false; }
  }
  return true;
}

int main() {
  int test;
  scanf("%d", &test);
  while (test--) {
    REP(i, 50) { edges[i].clear(); }
    scanf("%d %d", &h, &w);
    MEMSET(charvisit, false);
    REP(y, h) {
      scanf("%s", field[y]);
    }
    REP(iniy, h) {
      REP(inix, w) {
        if (field[iniy][inix] == '.') { continue; }
        if (charvisit[(int)field[iniy][inix]]) { continue; }
        charvisit[(int)field[iniy][inix]] = true;
        MEMSET(visit, false);
        queue<pair<int, int> > que;
        que.push(make_pair(inix, iniy));
        int minx = inix;
        int miny = iniy;
        int maxx = inix;
        int maxy = iniy;
        while (!que.empty()) {
          int x = que.front().first;
          int y = que.front().second;
          que.pop();
          if (visit[y][x]) { continue; }
          visit[y][x] = true;
          if (field[y][x] == field[iniy][inix]) {
            minx = min(minx, x);
            miny = min(miny, y);
            maxx = max(maxx, x);
            maxy = max(maxy, y);
          }
          REP(i, 4) {
            int nx = x + dx[i];
            int ny = y + dy[i];
            if (nx < 0 || nx >= w || ny < 0 || ny >= h) { continue; }
            que.push(make_pair(nx, ny));
          }
        }
        FOREQ(ny, miny, maxy) FOREQ(nx, minx, maxx) {
          if (field[ny][nx] == '.') {
            puts("SUSPICIOUS");
            goto next;
          } else if (field[ny][nx] != field[iniy][inix]) {
            edges[(int)field[iniy][inix] - 'A'].insert(field[ny][nx] - 'A');
          }
        }
      }
    }
    REP(i, 50) {
      MEMSET(dfsvisit, false);
      if (!dfs(i, i)) {
        puts("SUSPICIOUS");
        goto next;
      }
    }
    puts("SAFE");
next:;
  }
}

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

#define TRACE(x) x
#define WATCH(x) TRACE(cout << #x" = " << x << endl)
#define WATCHR(a, b) TRACE(for (auto it=a; it!=b;) cout << *(it++) << " "; cout << endl)
#define WATCHC(V) TRACE({cout << #V" = "; WATCHR(V.begin(), V.end());})

#define all(x) (x).begin(), (x).end()

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vs = vector<string>;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);

    int N;
    cin >> N;

    unordered_map<ll, int> ct;
    ct[0] = 1;
    ll pref = 0, ans = 0;

    vi val(N);
    for (int i = 0; i < N; i++) {
        cin >> val[i];
        pref += val[i];
        ans += ct[pref];
        ct[pref]++;
    }

    cout << ans << endl;

    return 0;
}



Measured memory_bytes: 9288
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define loop(i,a,b) for (int i=a; i<b; ++i)
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll N;
    cin >> N;
    vector <ll> A(N);
    loop(i,0,N) cin >> A[i];
    ll sum=0;
    loop(i,1,N)
    {
        if (A[i]<A[i-1])
        {
            sum+=A[i-1]-A[i];
            A[i]=A[i-1];
        }
    }
    cout << sum << "\n";
    return 0;
}

Measured memory_bytes: 4780
#include<stdio.h>
int main()
{
    int n,a,b;
    input:
    scanf("%d",&n);
    if(n==1)
        printf("Hello World\n");
    else if(n==2){
        scanf("%d%d",&a,&b);
        printf("%d\n",a+b);
    }
    else goto input;

}


Measured memory_bytes: 128
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <iomanip> // fixed, setprecision 
#include <math.h> // double sqrt
using namespace std;

int main(){
    int N;
    cin>>N;
    int ans=0;
    vector<int>A(N);
    vector<int>B(N-1);
    for(int i=0;i<N-1;i++){
        cin>>B[i];
    }
    for(int i=0;i<N;i++){
        if(i==0){A[i]=B[i];continue;}
        if(i==N-1){A[i]=B[i-1];continue;}
        A[i]=min(B[i-1],B[i]);
        }
    for(int i=0;i<N;i++){
        ans+=A[i];
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF 2e9
#define MOD 1000000007
using namespace std;
typedef long long llong;
typedef long double ldouble;

using Graph = vector<vector<int>>;

// int ctoi(const char c){
//   if('0' <= c && c <= '9') return (c-'0');
//   return -1;
// }

// int gcd(int a, int b){
//   int ma = max(a,b);
//   int mi = min(a,b);
//   if(mi == 0) return ma;

//   return gcd(mi, ma%mi);
// }

int main(){
  int K, A, B;
  cin >> K >> A >> B;
  for(int i=A; i<=B; ++i){
    if(i%K==0){
      cout << "OK" << endl;
      return 0;
    }
  }
  cout << "NG" << endl;
  return 0;
}

Measured memory_bytes: 3636
#include <algorithm>
#include <iostream>
#include <vector>

int main()
{
	int n = 0;
	int k = 0;
	std::cin >> n >> k;

	std::vector<int> prices;
	prices.reserve(n);

	for (int count = 0; count < n; ++count)
	{
		int fruitPrice = 0;
		std::cin >> fruitPrice;
		prices.emplace_back(fruitPrice);
	}

	std::sort(prices.begin(), prices.end());

	int sum = 0;

	for (int count = 0; count < k; ++count)
	{
		sum += prices.at(count);
	}

	std::cout << sum << std::endl;
}

Measured memory_bytes: 3200
#include <bits/stdc++.h>
#define MOD (long long)(1E9+7)
#define rep(i, n) for(int i = 0; i < n; i++)

using namespace std;

int main(){
	int n,a,b;
	cin >> n >> a >> b;
	cout << ( n*(a/n + 1) <= b  || (a%n == 0)? "OK" : "NG" ) << endl;
}



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

using namespace std;

#define rep(i, n) for(long long i = 0; i < (long long)(n); i++)
#define all(x) (x).begin(),(x).end()

using ll = long long;

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

	cout << max(A - B * 2, 0) << endl;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <queue>
#include <map>
using namespace std;
typedef long long ll;
const int INF = 1<<30; 
const int MOD = 1e9 + 7;
const int dy[] = {1, 0, -1, 0};
const int dx[] = {0, 1, 0, -1};
vector<int> divisor(int n)
{
    vector<int> res;
    for(int i = 1; i * i <= n; i++)
    {
        if(n % i == 0)
        {
            res.push_back(i);
            if(i != n / i) res.push_back(n / i);
        }
    }
    return res;
}
map<int, int> prime_factor(int n)
{
    map<int, int> res;
    for(int i = 2; i * i <= n; i++)
    {
        while(n % i == 0)
        {
            res[i]++;
            n /= i;
        }
    }
    if(n != 1) res[n] = 1;
    return res;
}
void print(const map<int, int> &m)
{
    for(auto x: m)
    {
        for(int i = 0; i < x.second; i++) cout << " " << x.first;
    }
    cout << endl;
}
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    map<int, int> mp = prime_factor(n);
    cout << n << ":";
    print(mp);
    return 0;
}




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

int main() {
    int N; cin >> N;
    vector<int> A(N);
    for(auto &e : A) cin >> e;
    int ans = 0;
    for(int i = 1; i < N - 1; ++i) {
        int l = i - 1, r = i + 1;
        int t = 0;
        if(A[l] < A[i] or A[r] < A[i]) t--;
        if(A[l] > A[i] or A[r] > A[i]) t++;
        if(t == 0) ans++;
    }
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 256
#![allow(unused_imports)]

use text_io::*;
use proconio::*;
use std::collections::*;
use std::process::exit;
use std::cmp::*;
use itertools::Itertools;

fn main() {
    input! {
    a:usize,
    b:usize,
    }
    println!("{}",(a+b+1)/2)
}

Measured memory_bytes: 2080
#include <iostream>
#include <string>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <functional>
#include <bitset>
#include <assert.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef pair<ll,ll> P;
typedef vector<P> vpl;
typedef tuple<ll,ll,ll> tapu;
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(int i=(a); i<(b); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const int inf = 1<<30;
const ll linf = 1LL<<62;
const int MAX = 510000;
ll dy[8] = {0,1,0,-1,1,-1,1,-1};
ll dx[8] = {1,0,-1,0,1,-1,-1,1};
const double pi = acos(-1);
const double eps = 1e-7;
template<typename T1,typename T2> inline bool chmin(T1 &a,T2 b){
	if(a>b){
		a = b; return true;
	}
	else return false;
}
template<typename T1,typename T2> inline bool chmax(T1 &a,T2 b){
	if(a<b){
		a = b; return true;
	}
	else return false;
}
template<typename T1,typename T2> inline void print2(T1 a, T2 b){cout << a << " " << b << "\n";}
template<typename T1,typename T2,typename T3> inline void print3(T1 a, T2 b, T3 c){
	cout << a << " " << b << " " << c << "\n";
}
const int mod = 1e9 + 7;
//const int mod = 998244353;

int main(){
	while(1){
		ll n,m,a; cin >> n >> m >> a;
		if(!n && !m && !a) break;
		a--;
		vvl v(1010,vl(n,-1));
		rep(i,m){
			ll h,p,q; cin >> h >> p >> q; p--; q--;
			v[h][p] = q;
			v[h][q] = p;
		}
		ll now = 1000;
		ll pos = a;
		while(now > 0){
			if(v[now][pos] != -1){
				pos = v[now][pos];
			}
			now--;
		}
		cout << pos+1 << endl;
	}
}


Measured memory_bytes: 3576
#include<stdio.h>

int main(void)
{
  int n,m,k,i,j,x;
  int a[50];
  int ans = 0;
  
  for (i = 0; i < 50; i++){
    a[i] = 0;
  }
  
  scanf("%d %d", &n, &m);
  
  for (i = 0; i < n; i++){
    scanf("%d ", &k);
    for (j = 0; j < k; j++){
      scanf("%d ", &x);
      a[x-1]++;
    }
  }
  
  for (i = 0; i < m; i++){
    if(a[i] == n){
      ans++;
    }
  }
  
  printf("%d", ans);
  
  return 0;
}

Measured memory_bytes: 128
#include <cstring>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <iostream>
using namespace std;
int a[19];
int Check(int n){
	int t;
	bool flag = true;
	while(n){
		t = n%10;
		if(a[t]){
			flag = false;
			break;
		}
		n/=10;
	}
	if(flag) return 1;
	return 0;
}
int main(){
	int n,k;
	scanf("%d%d",&n,&k);
	for(int i = 1; i <= k; i++){
		int x;
		scanf("%d",&x);
		a[x] = 1;
	}
	for(int i = n; ; i++){
		if(Check(i)){
			printf("%d\n",i);
			break;
		}
	}
	return 0;
}

Measured memory_bytes: 256
s = input()

s_x = s.replace('x', '')
if s_x != s_x[::-1]:
    print(-1)
    exit()

res = 0
l, r = 0, len(s) - 1
while l < r:
    if s[l] == s[r]:
        l += 1
        r -= 1
    elif s[l] == 'x':
        l += 1
        res += 1
    else:
        r -= 1
        res += 1
print(res)


Measured memory_bytes: 3316
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define FOR(i,j,k) for(int i=j;i<k;i++)
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef pair < int, int > pii;

const int maxn=1e5+100, INF=1000000000+7;


int main(){
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    cout<<min(a,b)+min(c,d)<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(void)
{
        int a[6], r[10];
        int i, j, k=0;

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

        for(i = 0; i < 4; i++) {
                for(j = i+1; j < 5; j++) {
                        r[k] = a[j] - a[i];
                        k++;
                }
        }

        for(i = 0; i < 10; i++) {
                if(r[i] > a[5]) {
                        printf(":(");
                        return 0;
                }
        }
        printf("Yay!");
        return 0;
}

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

namespace A___Rounding
{
    class Program
    {
        static void Main(string[] args)
        {
            var XA = Console.ReadLine().Split().Select(int.Parse).ToArray();

            Console.WriteLine(XA[0] < XA[1] ? 0 : 10);
        }
    }
}


Measured memory_bytes: 13268
s=input()
s0=int(s[:2])
s1=int(s[2:])
if s0>12 or s0==0:
    if 0<s1<=12:
        print("YYMM")
    else:
        print("NA")
else:
    if 0<s1<=12:
        print("AMBIGUOUS")
    else:
        print("MMYY")

Measured memory_bytes: 2940
#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define mp          make_pair
#define pll         pair<long long,long long>
#define vll          vector<long long>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (long long)x.size()
#define hell        1000000007
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define ios         ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
int main(){
	string s;cin>>s;
	int n=s.size();
	int dp[n+1]={0};
	dp[0]=0;
	dp[1]=1;
	if(n==1)return cout<<"1",0;
	if(s[0]==s[1])dp[2]=1;
	else dp[2]=2;
	for(int i=3;i<=n;i++){
		if(s[i-1]==s[i-2]){
			dp[i]=dp[i-3]+2;
		}
		else{
			dp[i]=dp[i-1]+1;
		}
	}
	//for(int i=1;i<=n;i++)cout<<dp[i]<<" ";cout<<endl;
	cout<<dp[n]<<endl;
}

Measured memory_bytes: 1412
#include <iostream>
#include <string>

int main(){
    std::string str;
    std::cin >> str;
    
    int begin = 0, end = str.size() - 1;
    
    if(str[begin] == 'x' && str[end] == 'x') std::cout << 'x' << std::endl;
    else std::cout << 'o' << std::endl;
    return 0;
}

Measured memory_bytes: 1176