akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair< ll, ll > Pi;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep2(i,n) for(int i=1;i<=(n);i++)
#define rep3(i,i0,n) for(int i=i0;i<(n);i++)
#define pb push_back
#define mod 1000000007
const ll INF = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}
#define all(x) x.begin(), x.end()
#define mp make_pair
bool compare(Pi a, Pi b) {
    if(a.first != b.first){
        return a.first < b.first;
        
    }else{
        return a.second < b.second;
    }
}


bool In_map(ll y,ll x,ll h,ll w){
    if(y<0 || x<0 || y>=h || x>=w){
        return 0;
    }else{
        return 1;
    }
}
const vector<ll> dx{1,0,-1,0};
const vector<ll> dy{0,1,0,-1};


int main() {
    ll N;
    string S;
    cin >>S;
    ll ans=0;
    rep(i,S.size()){
        if(S[i]=='1'){
            ans++;
        }
    }
    
    cout << ans << endl;


    return 0;
    

}

Measured memory_bytes: 3628
# Problem C - Christmas Eve

# input
N, K = map(int, input().split())
h = [0]*N
for i in range(N):
    h[i] = int(input())

# initialization
h = sorted(h)
min_ans = float('INF')
for i in range(N-K+1):
    tmp_max = h[i+K-1]
    tmp_min = h[i]
    min_ans = min(min_ans, tmp_max - tmp_min)

# output
print(min_ans)


Measured memory_bytes: 8240
#include<bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define lint long long
#define ll long long
#define pq priority_queue
#define mp make_pair
#define pb push_back
#define vl vector<long long>
#define pii pair<long long,long long>
#define all(x) (x).begin(),(x).end()
#define rep(x) for(int i = 0;i < (x);i++)
#define repj(x) for(int j = 0;j < (x);j++)
#define REP(i,x) for(int (i) = 0;(i) < (x);(i)++)
#define rrep(x) for(int i = (x);i >= 0;i--)
#define mod 1000000007
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define F first
#define S second
int qp(int a,ll b){int ans=1;do{if(b&1)ans=1ll*ans*a;a=1ll*a*a;}while(b>>=1);return ans;}
int qp(int a,ll b,int mo){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
long long INF = 1e9;

long long amida(long long x){
    if(x <= 0) return 1;
    if(x == 1) return 2;
    vector<string> S(1 << x); //2進数にした文字列を格納するstring
    for (int i = 0; i < 1<<x; i++)
    {
        for (int j = 0; j < x; j++)
        {
            int x = 1 << j;
            x &= i;
            S[i].push_back('0' + (x >> j)); 
        }
    }
    long long cnt = 0;
    for(int i = 0;i < 1<<x;i++){
        bool chk = true;
        for(int j = 1;j < x;j++){
            if(S[i][j] == '1' && S[i][j-1] == '1'){
                chk = false;
                break;
            }
        }
        if(chk) cnt++;
    }
    return cnt;
}
long long dp[120][10];
int main(){
    long long h,w,k;cin >> h >> w >> k;
    dp[0][1] = 1ull;
    for(int i = 1;i <= h;i++){
        for(int j = 1;j <= w;j++){
            if(j == 1){
                dp[i][j] = (dp[i-1][j]*amida(w-2) + dp[i-1][j+1]*amida(w-3)) % mod;
            }else if(j == w){
                dp[i][j] = (dp[i-1][j]*amida(w-2) + dp[i-1][j-1]*amida(w-3)) % mod;
            }else{
                dp[i][j] = (dp[i-1][j-1]*amida(j-3)*amida(w-j-1) + dp[i-1][j]*amida(j-2)*amida(w-j-1)
                 + dp[i-1][j+1]*amida(j-2)*amida(w-j-2)) % mod;
            }
        }
    }
    cout << dp[h][k] << endl;
    return 0;
}

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

using namespace std;
#define taskname "A"
#define pb  push_back
#define mp  make_pair
#ifndef LOCAL
#define cerr if(0)cout
#endif

typedef long double ld;
typedef long long ll;
typedef pair<int,int> ii;
const int maxn = 1e5 + 5;

int n, a[maxn] , x;

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    if(fopen(taskname".INP","r")){
        freopen(taskname".INP", "r",stdin);
        freopen(taskname".OUT", "w",stdout);
    }
    cin >> n;
    for(int i = 1 ; i <= n ; ++i){
        cin >> a[i];
    }
    sort(a + 1 , a + n + 1,greater<int>());
    int now = 0;
    for(int i = 1 ; i <= n + 1 ; ++i){
        if(i > a[i]){
            now = i - 1;
            break;
        }
    }
//    cout << now << endl;
//    cout << (upper_bound(a + 1 , a + n + 1 , now, greater<int>()) - a - now - 1);
    if((a[now] - now) % 2 || (upper_bound(a + 1 , a + n + 1 , now, greater<int>()) - a - now - 1) % 2)cout << "First";
    else cout << "Second";
}


Measured memory_bytes: 640
S=input()
s=int(S[:2])
t=int(S[2:])
if 1<=s<=12:
    if 1<=t<=12:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if 1<=t<=12:
        print("YYMM")
    else:
        print("NA")

Measured memory_bytes: 2940
// lcmとかはg++ -std=c++17 default.cppみたいなかんじで

#include <bits/stdc++.h>
#define mod 1000000007
#define INF 1001001001
#define ll long long
#define ln cout<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define double long double
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define rep1(i,n) REP(i,1,n+1)
using namespace std;
bool my_compare(pair<ll, ll> a, pair<ll , ll> b) {
    // 基本はfirstで比較
    if(a.first != b.first){
         return a.first < b.first; // 昇順
        //return a.first > b.first; // 降順
    }

    // それ以外はsecondで比較
    if(a.second != b.second){
        return a.second > b.second;
    }else{
        // どちらも同じ
        return true;
    }
}

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

    ll a,b,m,n,maxi=0,f=0,mini=INF,sum=0;
    string str,sub;
    ll h,w;
    string str1;
    cin>>h>>w;
    
    if(w<h) {
        mini=0;
    }
    if(h==0||w==0) mini=0;
    for(ll i=h;i<w;i++){
        for(ll j=i+1;j<=w;j++){
            
        mini=min(mini,(i*j)%2019);
            if(mini==0) {
              cout<<0<<endl;
            return 0;
            }
        }
    }

    cout<<mini<<endl;

    return 0;
}


Measured memory_bytes: 256
N = int(input())
W = list(map(int, input().split()))

half = sum(W) / 2
first_half = 0

for i in range(N):
    first_half += W[i]
    mid_index = i
    if first_half >= half:
        break

ans = min(abs(sum(W[:i])-sum(W[i:])), abs(first_half - sum(W[i+1:])))

print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
 
int main()
{
   long long a,b,c;
   cin>>a>>b>>c;
  
   long long s=c+b;
   long long ans=a/s;
   long long r=a%s;
   
   cout<<(b*ans)+min(r,b)<<"\n";
}

Measured memory_bytes: 256
n = int(input())
s = list(input())
l = len(s)
ans = []
answer = ""

alist = ["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", "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"]

for i in range(l):
    a = s.pop(0)
    b = int(alist.index(a))
    c = b + n
    d = alist[c]
    ans.append(d)
    
for x in ans:
    answer += x

print(answer)

Measured memory_bytes: 3188
import java.io.PrintWriter

fun next() = readLine()!!
fun nextInt() = next().toInt()
fun nextLong() = next().toLong()
fun nextDouble() = next().toDouble()
fun nextList() = next().split(" ")
fun nextIntList() = nextList().map(String::toInt)
fun nextLongList() = nextList().map(String::toLong)
fun nextDoubleList() = nextList().map(String::toDouble)

val pw = PrintWriter(System.out)
fun print(s: Any = "") = pw.print(s)
fun println(s: Any = "") = pw.println(s)

fun main(args: Array<String>) {
    main()
    pw.flush()
}

fun main() {
    val N = next().toInt()
    val T = Array(N) { nextLong() }
    val ans = T.reduce { i, j -> lcm(i, j) }
    println(ans)
}

// 最小公倍数
fun lcm(a: Long, b: Long): Long {
    return a / gcd(a, b) * b
}

// 最大公約数
tailrec fun gcd(a: Long, b: Long): Long {
    if (a < b) return gcd(b, a)
    if (b == 0L) return a
    if (a <= 0L) throw IllegalArgumentException()
    return gcd(b, a % b)
}

Measured memory_bytes: 33644
#include<bits/stdc++.h>
using namespace std;
int main(void)
{
	int a,b,c,i,j,mx,s;
	cin>>a;
	mx=-1;
	for(i=1;i<=a;i++) {
		b=0,s=i;
		while(1) {
			if(s%2==0) {
				s=s/2;
				b++;
			}
			else break;
		}
		if(mx<b) mx=b,c=i;
	}
	cout<<c<<endl;
}

Measured memory_bytes: 384
W,H,M = map(int, input().split())
maxX,minX,maxY,minY = W, 0, H ,0
for i in range(M):
  x, y, a = map(int, input().split())
  if a == 1 and x > minX:
    minX = x
  elif a == 2 and x < maxX:
    maxX = x
  elif a == 3 and y > minY:
    minY = y
  elif a == 4 and y < maxY:
    maxY = y
    
xl = maxX - minX
yl = maxY - minY
if xl > 0 and yl > 0:
  print(xl * yl)
else:
  print(0)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define FORR(i, m, n) for (int i = (m); i >= (n); --i)
#define equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const ll mod2 = 998244353;
const ll INF = 1e18;
const long double EPS = 1e-10;

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i, n) cin >> a[i];

  rep(i, n) a[i] -= i + 1;
  sort(a.begin(), a.end());

  ll ans = 0, m = a[n / 2];
  rep(i, n) ans += abs(a[i] - m);
  cout << ans << endl;


  
  return 0;
}

Measured memory_bytes: 1024
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<string>
#include<cstring>
#include<cmath>
#include<map>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<ctime>
const  int N = 2e5 + 5;
const int mod = 1e9 + 7;
const int INF = 0x3f3f3f3f;
typedef long long ll;
typedef long double lw;
#define sc(n) scanf("%d",&n)
#define fo(i,a,b) for(int i=a;i<b;i++)
#define mem(a,b) memset(a,b,sizeof a)
using namespace std;
char s[N];
ll cnt,a,b;
int main()
{
	scanf("%s", s);
	int len = strlen(s);
	fo(i, 0, len)
	{
		if (s[i] == 'A'&&b == 0)
			a++;
		else if (s[i] == 'B'&&a > 0 && b == 0)
			b++;
		else if (s[i] == 'C'&&a > 0 && b > 0)
		{
			cnt += a;
			b = 0;
		}
		else
		{
			a = b = 0;
			if (s[i] == 'A')
				a++;
		}
	}
	cout << cnt << endl;
	return 0;
}


Measured memory_bytes: 384
"""
author : halo2halo
date : 9, Jan, 2020
"""

import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

N, *P = map(int, read().split())

S = sum(x != y for x, y in enumerate(P, 1))
print('YES' if S <= 2 else 'NO')


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

double x[20],y[20];

double d(int a,int b){
    double ans;
    ans=sqrt((x[a]-x[b])*(x[a]-x[b])+(y[a]-y[b])*(y[a]-y[b]));
    return ans;
}

double tri(int f,int s,int t){
    double sum,da=d(f,s),db=d(s,t),dc=d(t,f);
    double S;
    S=(da+db+dc)/2;
    sum=sqrt(S*(S-da)*(S-db)*(S-dc));
    return sum;
}

int main(){
    int n,i,f,s,t;
    double d,ans=0;

    for(i=0;scanf("%lf,%lf",&x[i],&y[i])!=EOF;i++);
    n=i;

    for(f=0,s=1,t=2;t!=n;s++,t++){
        ans+=tri(f,s,t);
    }
    printf("%f\n",ans);
    return 0;
}

Measured memory_bytes: 652
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i = 0; i < n; i++)
#define rep2(i,x,n) for (int i = x; i < n; i++)
using ll = long long int;
int main() {
    ll A; cin >> A;
    string B; cin >> B;
    ll hunB = (B[0]-'0')*100 + (B[2]-'0')*10 + (B[3]-'0');
    A = A*hunB/100;
    cout << A << endl;
    return 0;
}

Measured memory_bytes: 3608
using System;
using System.Collections.Generic;
using System.Linq;
using BitArray = System.Collections.BitArray;
using BigInteger = System.Numerics.BigInteger;

namespace AtCoderProject
{
    public class Program
    {
        IEnumerable<int> Div(int a, int b)
        {
            for (int i = 100; i > 0; i--)
            {
                if (a % i == 0 && b % i == 0)
                    yield return i;
            }
        }
        public object Calc()
        {
            var list = new List<int>();
            var s = consoleReader.String();

            var count1 = s.Count(c => c == '1');
            var count0 = s.Length - count1;

            return s.Length - Math.Abs(count0 - count1);
        }

        const int mod = 1000000007;
        private readonly ConsoleReader consoleReader;
        public Program() : this(new ConsoleReader()) { }
        public Program(ConsoleReader consoleReader) { this.consoleReader = consoleReader; }
        static void Main() => Console.WriteLine(new Program().Calc());
        public static string MultiLine<T>(IEnumerable<T> source) => string.Join("\n", source);
    }

    public class ConsoleReader
    {
        public virtual string String() => Console.ReadLine();
        public int Int32() => int.Parse(String());
        public long Int64() => long.Parse(String());
        public ulong UInt64() => ulong.Parse(String());
        public double Double() => double.Parse(String());
        public string[] Split() => String().Split().ToArray();
        public int[] SplitInt32() => String().Split().Select(int.Parse).ToArray();
        public long[] SplitInt64() => String().Split().Select(long.Parse).ToArray();
        public ulong[] SplitUInt64() => String().Split().Select(ulong.Parse).ToArray();
        public double[] SplitDouble() => String().Split().Select(double.Parse).ToArray();

        public IEnumerable<string> Repeat(int count)
        {
            for (int i = 0; i < count; i++)
                yield return String();
        }
        public IEnumerable<int> RepeatInt32(int count)
        {
            for (int i = 0; i < count; i++)
                yield return Int32();
        }
        public IEnumerable<long> RepeatInt64(int count)
        {
            for (int i = 0; i < count; i++)
                yield return Int64();
        }
        public IEnumerable<string[]> RepeatSplit(int count)
        {
            for (int i = 0; i < count; i++)
                yield return Split();
        }
        public IEnumerable<int[]> RepeatSplitInt32(int count)
        {
            for (int i = 0; i < count; i++)
                yield return SplitInt32();
        }
    }
}


Measured memory_bytes: 13244
/// Containers Start
#include <algorithm>
#include <bitset>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
/// C Header Files
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <math.h>
#include <stdio.h>
/// Containers End

using namespace std;

/// Math Start
#define PI acos(-1.0)
#define Pi 3.141592653589793
#define EPS (1e-7)
#define INF (0x3f3f3f3f)
/// Math End

/// Extra Start
#define nn '\n'
#define pb push_back
#define ull unsigned long long
#define ll long long
#define MOD 1000000007
#define sz(a) int((a).size())
#define space " "
#define All(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
/// Extra End

#define rep(i, n) for (int i = 0; i < n; i++)
#define Cini(a)                                                                \
    int a;                                                                     \
    cin >> a;
#define Cinii(a, b)                                                            \
    int a, b;                                                                  \
    cin >> a >> b;
#define Ciniii(a, b, c)                                                        \
    int a, b, c;                                                               \
    cin >> a >> b >> c;
#define Cins(s)                                                                \
    string s;                                                                  \
    cin >> s;
#define Cinss(s1, s2)                                                          \
    string s1, s2;                                                             \
    cin >> s1 >> s2;
#define Cinc(c)                                                                \
    char c;                                                                    \
    cin >> c;
/// Functions End

/// Debug Start
#define deb(x) cout << #x << ": " << x << endl
#define deb2(x, y) cout << #x << ": " << x << '\t' << #y << ": " << y << endl;
#define deb3(x, y, z)                                                          \
    cout << #x << ": " << x << '\t' << #y << ": " << y << '\t' << #z << ": "   \
         << z << endl;
/// Debug End

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

/**>>>>>>>>>>>>>>>>>>> END <<<<<<<<<<<<<<<<<<**/

/// template

signed main(void) {
    cin.sync_with_stdio(false);
    cin.tie(0);
    Cinii(A,B);
    if(((A+B)%2==0)){
        cout << (A+B)/2 << nn;
    }else{
        cout << "IMPOSSIBLE" << nn;
    }
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    static Scanner scanner = new Scanner(System.in);

    public static void main(String[]$) {
        int n = scanner.nextInt();
        int sum = 0;
        for (int i = 1; i <= n; i++) {
            sum += i;
            if (n <= sum) {
                for (int j = i; j > 0; j--) {
                    if (n >= j) {
                        System.out.println(j);
                        n -= j;
                    }
                }
                return;
            }
        }
    }
}

Measured memory_bytes: 23380
use proconio::input;

fn main() {
    input! {
        a: i64,
        b: i64,
    };
    let mut found = false;
    for c in 1..=3 {
        if a * b * c % 2 != 0 {
            found = true;
        }
    }
    let ans = found;
    println!("{}", if ans { "Yes" } else { "No" });
}


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

using namespace std;
int main()
{
  int N;
  int T = 0;
  cin >> N;
  vector<pair<int,int>> V(N);

  for(int i=0;i < N;i++)
  {
    cin >> V[i].first;
  }
  for (int i=0;i < N;i++)
  {
    cin >> V[i].second;
  }
  for (int i=0;i<N;i++)
  {
    if (V[i].first - V[i].second > 0)
    {
      T += V[i].first-V[i].second;
    }
  }
  cout << T;
  return 0;



}


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

struct schedule {
  int end;
  int start;
};

int main() {
  int N;
  cin >> N;
  vector<schedule> sch(N);
  for (int i{}; i < N; ++i) {
    int X, L;
    cin >> X >> L;
    sch[i].start = X - L;
    sch[i].end = X + L;
  }
  sort(sch.begin(), sch.end(), [](const schedule &l, const schedule &r) {
    return l.end < r.end;
  });

  int ans{};

  int end{sch[0].start};
  for (const auto& r : sch) {
    if (end > r.start)
      continue;
    end = r.end;
    ++ans;
  }

  cout << ans << endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using big = vector<int>;
struct num {
	big x;
	int sum;
};
num conv(string t){
	int len = t.size();
	num r;
	r.sum = 0;
	int carry = 0;
	for(int i = len - 1; i >= 0; i--){
		int nr = t[i] - '0';
		nr *= 9;
		nr += carry;
		r.x.push_back(nr % 10);
		r.sum += r.x.back();
		carry = nr / 10;
	}
	if(carry){
		r.x.push_back(carry);
		r.sum += carry;
	}
	return r;
}
void add_nine(num &x){
	int len = x.x.size();
	int carry = 9;
	for(int i = 0; i < len && carry; i++){
		int nr = (x.x[i] + carry);
		x.sum -= x.x[i];
		x.x[i] = nr % 10;
		x.sum += x.x[i];
		carry = nr / 10;
	}
	if(carry){
		x.x.push_back(carry);
		x.sum += carry;
	}
}
int main(){
	string s; cin >> s;
	num n = conv(s);
	for(int k = 0; ; k++){
		if(n.sum <= 9 * k){
			cout << k << endl;
			return 0;
		}
		add_nine(n);
	}
	return 0;
}


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

void solve(){
  int w, h, n; cin >> w >> h >> n;
  int dh = 0, lw = 0;
  for(int i = 0; i < n; i++){
    int x, y, a; cin >> x >> y >> a;
    if(a == 1) lw = max(x, lw);
    else if(a == 2) w = min(x, w);
    else if(a == 3) dh = max(y, dh);
    else h = min(y, h);
    //cout << lw << " " << w << " " << dh << " " << h << endl;
  }
  cout << max(h - dh, 0) * max(w - lw, 0) << endl;
  return;
}

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


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

typedef long long ll;
const ll mod =1e9+7;
const int maxn = 1e5+5;
ll a[maxn];
ll b[maxn];

ll C[maxn];
ll inv[maxn];

int n,k;
void getinv()
{
	inv[1] = 1;
	for (int i = 2; i <= n; ++i) inv[i] = (long long)(mod-mod/i) * inv[mod%i]%mod;	
}
void exgcd(ll a,ll b,ll &x,ll &y)
{
	if(b==0) 
	{
		x=1;y=0;
		return;
	}
	exgcd(b,a%b,y,x);
	y-=a/b*x;
}


void getC()
{
	memset(C,0,sizeof(C));
	C[n-k+1] = 1;
	ll beg = k-1, end = 1;
	for(int i=n-k;i>=1;i--)
	{
		ll x=0,y=0;
		beg++;
		exgcd(end,mod,x,y);
		x =( x%mod+mod )%mod;
		C[i] = (C[i+1]%mod*beg%mod*x%mod)%mod;

		end++;
	}
	/* 
	for(int i=1;i<=n;i++)
	{
		cout<<C[i]<<" ";
	}cout<<"\n";
	*/ 
}

bool cmp(ll a,ll b)
{
	return a>b;
}
int main()
{
	while(cin>>n>>k)
	{
		memset(b,0,sizeof(b));
		
		for(int i=1;i<=n;i++)
		{
			cin>>a[i];
		}
		sort(a+1,a+1+n,cmp);
		getC();
		ll ans = 0;
		for(int i=1;i<=n;i++)
		{
			b[i] = (C[i]%mod - C[n+1-i]%mod)%mod;
		}
		for(int i=1;i<=n;i++)
		{
			ans = (ans%mod + a[i]*b[i]%mod)%mod;
		}
		
		cout<<ans<<"\n";
	}
 } 
 
 /*
 10 5
 1000000000 999999999 999999998 999999997 999999996 123456789 111111111 9 8 7
 */

Measured memory_bytes: 2560
import java.util.*;

public class Main {

	static int n;
	static int answer;
	static int[][] map;
	static int[] visited;
	static int numVisited;
	
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		
		n = in.nextInt();
		int m = in.nextInt();
		
		map = new int[n][n];
		for (int i = 0; i < m; i++) {
			int a = in.nextInt() - 1;
			int b = in.nextInt() - 1;
			
			map[a][b] = 1;
			map[b][a] = 1;
		}
		
		answer = 0;
		visited = new int[n];
		visited[0] = 1;
		numVisited = 1;
		solve(0);
		
		System.out.println(answer);
	}
	
	public static void solve(int v) {
		boolean allVisited = true;
		for (int i = 0; i < n; i++) {
			if (visited[i] == 0) {
				allVisited = false;
				break;
			}
		}
		
		if (allVisited) {
			answer++;
			return;
		}
		
		for (int i = 0; i < n; i++) {
			if (map[v][i] == 1 && visited[i] == 0) {
				numVisited++;
				visited[i] = 1;
				solve(i);
				visited[i] = 0;
				numVisited--;
			}
		}
	}
}

Measured memory_bytes: 21588
from sys import stdin


def fetch_one_line():
    return stdin.readline().rstrip()


def fetch_int_input():
    return [int(s) for s in fetch_one_line().split()]


def fetch_inputs(times):
    return [fetch_one_line() for _ in range(times)]


def fetch_int_inputs(times):
    return [[int(s) for s in fetch_one_line()] for _ in range(times)]


def fetch_ints_inputs(times):
    return [fetch_int_input() for _ in range(times)]


N, K = fetch_int_input()
hps = fetch_int_input()

sort_hps = sorted(hps, reverse=True)

remain_hps = sort_hps[K:]
print(sum(remain_hps))


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

int main(){
	int S, h, m, s;
	cin >> S;

	h = (S - S%3600)/3600;
	m = (S - h*3600 - (S - h*3600)%60)/60;
	s = S - h*3600 - m*60;

	cout << h << ":";
	cout << m << ":";
	cout << s << endl;

	return 0;
}


Measured memory_bytes: 3088
const int tt = 10000;

#include<iostream>
#include<string>
#include<sstream>
using namespace std;

string toStr(int n);
string intToString(int n);

int main() {
  int a, b, c, d, e, f;
  
  while(cin >> a >> b >> c >> d >> e >> f) {
    c = c * tt;
    f = f * tt;

    int det = a * e - b * d;

    int x = ( e * c - b * f) / det;
    int y = (-d * c + a * f) / det;
//    cout << x << y << endl;

    cout << toStr(x) << " " << toStr(y) << endl;
  }
}

string toStr(int n) {
  string pm, val;
  
  if (n < 0) {
    pm = "-";
    n = -n;
  } else {
    pm = "";
  }

  int ipart = n / tt;
  int fpart = (n - ipart * tt) + tt + 5;

  val = pm + intToString(ipart) + "." + intToString(fpart).substr(1, 3);
  return val;
}

string intToString(int n) {
  stringstream ss;
  ss << n;
  return ss.str();
}

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

// def
#define debug(x) cout << #x << ": " << x << endl
#define out(x) cout << x << endl
#define repeat(i, a, b) for (int i = (a); i < (b); i++)
#define revrepeat(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define revrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define foreach(e, v) for (auto &e : v)
#define all(x) (x).begin(), (x).end()
#define CYES cout << "Yes" << endl
#define CNO cout << "No" << endl
#define SPC(x) cout << fixed << setprecision(x)
#define ZERO(a) memset(a, 0, sizeof(a))
#define MINUS(a) memset(a, 0xff, sizeof(a))

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vector<int>> vii;
typedef vector<ll> vl;
typedef vector<vector<ll>> vll;
typedef pair<int, int> P;
const int MOD = 1e9 + 7;
const int INF = __INT_MAX__;               // 2^31 - 1
const long long INFLL = __LONG_LONG_MAX__; // 2^61 - 1
const int MAX_N = 1e5 + 5;
const double PI = acos(-1);

struct mint {
    // Preparation: MOD is already defined.
    ll value;

    mint(ll value = 0) : value((value % MOD + MOD) % MOD) {}

    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }

    mint pow(mint m) const {
        return pow(m.value);
    }

    mint inv() const {
        ll a = value, b = MOD, u = 1, v = 0;
        while (b) {
            ll t = a / b;
            a -= t * b;
            swap(a, b);
            u -= t * v;
            swap(u, v);
        }
        u %= MOD;
        return u;
    }

    mint &operator+=(const mint a) {
        if ((value += a.value) >= MOD) value -= MOD;
        return *this;
    }
    mint &operator-=(const mint a) {
        if ((value += MOD - a.value) >= MOD) value -= MOD;
        return *this;
    }
    mint &operator*=(const mint a) {
        (value *= a.value) %= MOD;
        return *this;
    }
    mint &operator/=(const mint a) {
        return (*this) *= a.inv();
    }

    mint operator+(const mint a) const {
        mint res(*this);
        return res += a;
    }
    mint operator-(const mint a) const {
        mint res(*this);
        return res -= a;
    }
    mint operator*(const mint a) const {
        mint res(*this);
        return res *= a;
    }
    mint operator/(const mint a) const {
        mint res(*this);
        return res /= a;
    }
};

int main() {
    int n;
    cin >> n;
    set<int> m;
    rep(i, n) {
        int x;
        cin >> x;
        m.insert(x);
    }

    int k = m.size();
    if (k % 2)
        out(k);
    else
        out(k - 1);
}


Measured memory_bytes: 4992
n, m = gets.split.map(&:to_i)
p m < 2 || n < 2 ? 0 : n.times.map{ gets.split.map(&:to_f) }.combination(m).map{  |a|
    a.combination(2).to_a.map{ |p, q|
      p.zip(q).reduce(0){ |sum, (c, d)| sum + (c - d) ** 2 }
    }.reduce(:+)
  }.max

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

int n, ans = 0;
vector<vector<int>> x;
vector<vector<int>> y;
vector<int> tempX;
vector<int> tempY;

int check(int k, int n){
	bitset<15> pos(k);

	for(int i = 0; i<n; i++){
		if(pos[i] == 1){
			for(int j = 0; j<x[i].size() ; j++){
				if(pos[x[i][j]] != y[i][j]){
					return 0;
				}
			}
		}
	}

	return pos.count();
}

int main(){
	cin >> n;

	for(int i = 0, a; i<n; i++){
		cin >> a;
		for(int j = 0, idx, val; j<a; j++){
			cin >> idx >> val;
			tempX.push_back(idx-1);
			tempY.push_back(val);
		}
		x.push_back(tempX);
		y.push_back(tempY);
		tempX.clear();
		tempY.clear();
	}

	for(int i = 1; i < 1<<n; i++){
		ans = max(ans, check(i, n));
	}

	cout << ans << endl;
}

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

int d[9];

int main(){
    int in;
    
    for(int i=0; i<4; ++i){
        cin >> in;
        d[in] ++;
    }

    if(d[7] == 1 && d[1] == 1 && d[9] == 1 && d[4] == 1)
        cout << "YES";
    else
        cout << "NO";
}

Measured memory_bytes: 3588
#include <stdio.h>

int main(void)
{
    int n;
    int s;
    int i;

    scanf("%d", &n);

    s = 0;
    i = n;
    
    while(i >= 10){
    s += i % 10;
    i = i / 10;
    }
    s += i;
    
    if(n % s == 0){
        printf("Yes\n");
    }
    else{
        printf("No\n");
    }

    return(0);
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i < (n); ++i)
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; }
template<class T> inline bool change(T& a, T b) { if (a != b) { a = b; return 1; } return 0; }
using namespace std;
typedef long long ll;

int main(){
    int a,b,c,k; cin >> a >> b >> c >> k;
    while(k>=0){
        if(a>=b) b*=2;
        else if(b>=c) c*=2;
        else break;
        k--;
    }
    if(k>=0) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;++i)
#define REPR(i, n) for(int i = n;i >= 0;--i)
#define FOR(i, m, n) for(int i = m;i < n;++i)
#define FORR(i, m, n) for(int i = m;i >= n;--i)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define FI first
#define SE second
#define PB(a) push_back(a)
#define DEBUG(x) cerr << __LINE__ << ":" << #x << ": " << x << "\n";
#define SZ(x) ((int)(x).size())
#define SO(x) sizeof((x)) / sizeof((x)[0])
//#define int long long
using namespace std;
using lint = long long;
struct Fast{Fast(){cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);};} fast;
const int INF = INT_MAX;
const lint LINF = LLONG_MAX;
const int MOD = 1e9 + 7;
const double EPS = 1e-9;
inline int in() {int x; cin >> x; return x;}
inline lint IN() {lint x; cin >> x; return x;}
inline void co(int a[], int n) {REP(i, n) cout << a[i] << " "; cout << "\n";}
//if (IO > 1e5){lint a;	scanf(%lld, &a);	printf("%lld\n", a);}

signed main(){
	int n = in();	int i = in();
	cout << n - i + 1 << endl;
return 0;
}


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

struct Point{ double x,y; };

void koch(int n,struct Point a,struct Point b){
  if(n==0){
    return;
  }
  struct Point s,t,u;
  double th=M_PI*60.0/180.0;

  s.x=(2.0*a.x+1.0*b.x)/3.0;
  s.y=(2.0*a.y+1.0*b.y)/3.0;
  t.x=(1.0*a.x+2.0*b.x)/3.0;
  t.y=(1.0*a.y+2.0*b.y)/3.0;
  u.x=(t.x-s.x)*cos(th)-(t.y-s.y)*sin(th)+s.x;
  u.y=(t.x-s.x)*sin(th)+(t.y-s.y)*cos(th)+s.y;

  koch(n-1,a,s);
  printf("%.8f %.8f\n",s.x,s.y);
  koch(n-1,s,u);
  printf("%.8f %.8f\n",u.x,u.y);
  koch(n-1,u,t);
  printf("%.8f %.8f\n",t.x,t.y);
  koch(n-1,t,b);
}

int main(){
  struct Point a,b;
  int n;

  scanf("%d",&n);

  a.x=0;
  a.y=0;
  b.x=100;
  b.y=0;

  printf("%.8f %.8f\n",a.x,a.y);
  koch(n,a,b);
  printf("%.8f %.8f\n",b.x,b.y);

  return 0;
}



Measured memory_bytes: 2108
#include <iostream>
#include <algorithm>
#include <string>
#define int long long
using namespace std;

int n;
int p10[10];

signed main() {
	cin >> n;
	
	p10[0] = 1;
	for (int i = 1; i < 10; i++) p10[i] = p10[i - 1] * 10;
	
	int ans = 0;
	for (int a = 1; a <= n; a++) {
		int pre = a;
		while (pre >= 10) pre /= 10;
		int suf = a % 10;
		
		if (suf == 0) continue;
		
		int cnt = 0;
		
		//1桁
		if (pre == suf) {
			if (pre <= n) cnt++;
		}
		
		//2桁
		if (suf * 10 + pre <= n) cnt++;
		
		//3桁以上, 0-9, 00-99, 000-999…
		for (int i = 1; ; i++) {	//i桁挿入
			if (suf * p10[i + 1] + (p10[i] - 1) * 10 + pre <= n) {
				cnt += p10[i];
			}
			else {
				if (n - suf * p10[i + 1] - pre >= 0) {
					int xmax = (n - suf * p10[i + 1] - pre) / 10;
					//cout << "a = " << a << ", xmax = " << xmax << endl;
					cnt += xmax + 1;
				}
				break;
			}
		}
		
		ans += cnt;
	}
	
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.*;
import java.util.Map.Entry;

import javax.swing.text.Segment;
import javax.xml.ws.WebEndpoint;

import java.io.*;
import java.lang.reflect.Array;
import java.math.BigInteger;

import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
 
public class Main //implements Runnable
{
//    static int dx[]={-1,0,1,0};
//    static int dy[]={0,-1,0,1};
	
    public static void main(String[] args)   throws Exception, IOException{        
        long mod=1000000007;
        Reader sc = new Reader(System.in);
        PrintWriter out=new PrintWriter(System.out);

//        int n=sc.nextInt();
        String s=sc.nextString();
        String t=sc.nextString();

        out.println(t+s);
     	out.flush();
    }


    static void ret(String ans) {
    	System.out.println(ans);
    	System.exit(0);
    }
    
    static boolean validpos(int x,int y,int r, int c){
        return x<r && 0<=x && y<c && 0<=y;
    }

    static void db(Object... os){
        System.err.println(Arrays.deepToString(os));
    }
}

//
//class P {
//	int x, y, d;
//	P(int  x, int y, int d) {
//	  this.x=x;
//	  this.y=y;
//	  this.d=d;
//	}
//}
//

//class P implements Comparable<P>{
//    int a,b;
//    P(int a, int b) {
//    	this.b=b;
//    	this.a=a;
//    }
//
//    public int compareTo(P p){
//        return -p.a+a;//as
//    }
//}

class Reader
{ 
    private BufferedReader x;
    private StringTokenizer st;
    
    public Reader(InputStream in)
    {
        x = new BufferedReader(new InputStreamReader(in));
        st = null;
    }
    public String nextString() throws IOException
    {
        while( st==null || !st.hasMoreTokens() )
            st = new StringTokenizer(x.readLine());
        return st.nextToken();
    }
    public int nextInt() throws IOException
    {
        return Integer.parseInt(nextString());
    }
    public int[] nextIntArray(int size) throws IOException{
        int r[] = new int[size];
        for (int i = 0; i < size; i++) {
            r[i] = this.nextInt(); 
        }
        return r;
    }
    public long[] nextLongArray(int size) throws IOException{
        long r[] = new long[size];
        for (int i = 0; i < size; i++) {
            r[i] = this.nextLong(); 
        }
        return r;
    }
    public char[] getCharSet() throws IOException{
        return this.nextString().toCharArray();
    }    
    public long nextLong() throws IOException
    {
        return Long.parseLong(nextString());
    }
    public double nextDouble() throws IOException
    {
        return Double.parseDouble(nextString());
    }
}


Measured memory_bytes: 21332
#include <bits/stdc++.h>
//#include "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 chmax(a, b) a = max(a, b)
#define chmin(a, b) a = max(a, b)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

using namespace std;
using ll = long long;
using pii = pair<int, int>;

int		main(void)
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	int n;
	cin >> n;
	vector<pair<string, int>> mp;
	while (n--) {
		string s;
		int t;
		cin >> s >> t;
		mp.push_back({s, t});
	}
	string x;
	cin >> x;
	bool ok = false;
	int ans = 0;
	for (auto p : mp) {
		if (ok) {
			ans += p.second;
		} 
		if (p.first == x) ok = true;
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define irep(i, n) for (int i = (n); i >= 0; i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = 1 << 30;
ll lucas[100]; 
int main() {
  int n;
  cin >> n;
  lucas[0] = 2;
  lucas[1] = 1;
  for (int i = 2; i <= n; i++)
  {
    lucas[i] = lucas[i-1] + lucas[i-2];
  }
  cout << lucas[n] << endl;
    return 0;
}

Measured memory_bytes: 3644
#include<stdio.h>
#define MAX 100000000
int n,data[100][100];
void alg();
int main(){
    int i,j,u,k,v,c;
    scanf("%d",&n);
    for(i=0;i<n;i++){
        for(j=0;j<n;j++){
            data[i][j]=MAX;
        }
    }
    for(i=0;i<n;i++){
        scanf("%d",&u);
        scanf("%d",&k);
        for(j=0;j<k;j++){
            scanf("%d",&v);
            scanf("%d",&c);
            data[u][v]=c;
        }
    }
    alg();
    return 0;
}
void alg(){
    int i,x[100],flag[100],min,s;
    for(i=0;i<n;i++){
        x[i]=MAX;
        flag[i]=0;
    }
    flag[0]=1;
    x[0]=0;
    while(1){
        min=MAX;
        s=-1;
        for(i=0;i<n;i++){
            if(flag[i]!=2 && x[i]<min){
                s=i;
                min=x[i];
            }
        }
        if(s==-1)break;
        flag[s]=2;
        for(i=0;i<n;i++){
            if(flag[i]!= 2 && data[s][i]!=MAX){
                if(x[i]>x[s]+data[s][i]){
                    x[i]=x[s]+data[s][i];
                    flag[i]=1;
                }
            }
        }
    }  
    for(i=0;i<n-1;i++){
        if(x[i]!=MAX)printf("%d %d\n",i,x[i]);
        else printf("%d -1\n",i);
        

    }
    if(x[n-1]!=MAX)printf("%d %d\n",n-1,x[n-1]);
    else printf("%d -1\n",n-1);
    
}


Measured memory_bytes: 2084
import sys

sys.setrecursionlimit(10 ** 6)
input = sys.stdin.readline
int1 = lambda x: int(x) - 1

def main():
    input()
    aa=list(map(int, input().split()))
    aa.sort(reverse=True)
    print(sum(aa[::2])-sum(aa[1::2]))

main()

Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
const int N=2e5+10;
int fa[N],num[N];
int father(int x)
{
	if(fa[x]==x)
		return fa[x];
	else
		return fa[x]=father(fa[x]);
}
void add(int x,int y)
{
	x=father(x);
	y=father(y);
	if(x!=y)
	{
		fa[y]=x;
		num[x]+=num[y];
	}
}
int main()
{
	int n,m;
	cin>>n>>m;
	for(int i=0;i<N;i++)
	{
		fa[i]=i;
		num[i]=1;
	}
	for(int i=1;i<=m;i++)
	{
		int x,y;
		cin>>x>>y;
		add(x,y);
	}
	int maxn=-1;
	for(int i=1;i<=N;i++)
		maxn=max(maxn,num[i]);
	cout<<maxn<<endl;
	return 0;
}

Measured memory_bytes: 5160
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define rep2(i,x,n) for(int i=x; i<(n); i++)
#define ALL(c) (c).begin(), (c).end()
#define pb push_back
#define eb emplace_back
const long long INF = 1LL<<60; // 仮想的な無限大の値;
using namespace std;
using ll = long long;
using P  = pair<int, int>;
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; }
using Graph = vector<vector<ll>>;
const ll MOD = 998244353;
int main()
{
    int N, S;
    cin >> N >> S;
    vector<int> A(N);
    rep(i, N) cin >> A[i];
    //sort(ALL(A));

    Graph G(N+1);//i個まで選んで和がjになる
    rep(i, N+1)rep(j, S+1){
        G[i].pb(0);
        //if(i==1)if(j == A[i]) G[i][j]++;
    } 
    // rep(i, N)rep(j, S+1)
    // {
    //     if(j == A[i]) G[1][j]++;
    // }
    G[0][0] = 1;
    rep2(i, 0, N)rep(j, S+1) {
       G[i+1][j] += G[i][j]*2;
       if(j>=A[i]) G[i+1][j] +=G[i][j-A[i]] ;
       G[i+1][j]%= MOD;
    }
    // ll ans = 0;
    // rep(i, N+1){
    //     ans += G[i][S];
    //     ans %= MOD;
    // }
    cout << G[N][S]%MOD << endl;




    return 0;
}

Measured memory_bytes: 85616
#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for(ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF (1ll << 60)
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
using vl = vector<ll>;
using vvl = vector<vl>;
typedef double db;
typedef string str;
typedef pair<ll, ll> p;
constexpr int MOD = 1000000007;
using ll = long long;
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;
}

void print(const std::vector<int> &v) {
    std::for_each(v.begin(), v.end(), [](int x) { std::cout << x << " "; });
    std::cout << std::endl;
}

int dp[201010];
int main() {
    ll N;
    cin >> N;
    vector<ll> P(N);
    REP(i, N) { cin >> P[i]; }
    // longest increasing subsequence
    int ans = 0;
    REP(i, N) {
        dp[P[i]] = dp[P[i] - 1] + 1;
        ans = max(ans, dp[P[i]]);
    }
    cout << N - ans << endl;
    return 0;
}

Measured memory_bytes: 2688
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const long long MOD=1e9+7;

int main() {
  int x,y;
  cin>>x>>y;
  cout<<x+y/2<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <array>
#include <set>
#include <cmath>
#include <string>
#include <sstream>
#include <queue> 
#include <list>
#include <stack>
#include <unordered_map>
#include <algorithm> 
#include <numeric>  
#include <functional>
#include <cassert>
#include <bitset>
#include <cctype>  
#include <iomanip> 
#include <limits>  
#include <regex>
// std::numeric_limits<int>::max(), min()
// std::setprecision(X)
// std::islower(), std::isupper(), std::tolower, std::toupper
// std::accumulate(m.begin(), m.end(), 0LL);
// std::sort(begin(),end()) // 0, 1, 2, 3 ,4 (default, less);
// std::priority_queue<int, vector<int>, less<int>> que; // 4, 3, 2, 1 (defualt, less) : 
// if ( std::regex_match(S, std::regex("(dream|dreamer|erase|eraser)*")) ) std::cout << "YES" << std::endl;
 
#define rep(i, n) for(int i = 0; i < (int)(n);    i++)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
typedef long long ll;
typedef std::vector<int> vi;
typedef std::vector<std::vector<int>> vvi;

ll gcd ( ll a, ll b ) { if ( b == 0 ) return a; else return gcd ( b, a%b ); }
ll lcm ( ll a, ll b ) { return a * b / gcd(a, b); }


int main (void) {
  std::cin.tie(0);  std::ios::sync_with_stdio(false);
  ll X, Y; std::cin >> X >> Y;
  if ( std::abs(X-Y) <= 1 ) std::cout << "Brown" << std::endl;
  else std::cout << "Alice" << std::endl;
  return 0;
}


Measured memory_bytes: 256
S = input()

ans = 0
for i in range(len(S)):
    tmp = 0
    for j in range(i, len(S)):
        if S[j] == 'A' or S[j] == 'T' or S[j] == 'G' or S[j] == 'C':
            tmp += 1
        else:
            ans = max(ans, tmp)
            break
        if j == len(S) - 1:
            ans = max(ans, tmp)

print(ans)




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

int main() {
    int N;
    cin >> N;
    int MAX = 55556;
    vector<int> is_prime(MAX, 1);
    is_prime[0] = 0, is_prime[1] = 0;
    for (int i = 2; i < MAX; ++i) {
        if (!is_prime[i])
            continue;
        for (int j = i * 2; j < MAX; j += i)
            is_prime[j] = 0;
    }

    vector<int> fives;
    rep(i, is_prime.size()) {
        if (is_prime[i] && i % 5 == 1)
            fives.push_back(i);
    }

    rep(i, N) { cout << fives[i] << " "; }
}

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

int main() {
    int N = 0;
    cin >> N ;
    vector<double> A(N);
    double sum = 0;
    double value_now = 0, value_old = 0;
    for (int i = 0; i < N ; i++){
        cin >> A.at(i);
    }
    sort(A.begin(),A.end());

    value_old = (A.at(0)+A.at(1)) / 2;

    if (N != 2){
        value_now = value_old;
        for (int i = 2; i < N - 1 ; i++){
            value_now = (value_old + A.at(i)) / 2;
            value_old = value_now;
        }

        cout << (value_now + A.at(N-1)) / 2 <<endl;

    }
    else{
        cout << value_old <<endl;
    }

}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
     int a,b,c;
     cin>>a>>b>>c;
     if((a==5&&b==5&&c==7)||(a==5&&b==7&&c==5)||(a==7&&b==5&&c==5))
     {
         cout<<"YES"<<endl;
     }
    else
    {
        cout<<"NO"<<endl;
    }


    return 0;
}


Measured memory_bytes: 3124
#include <iostream>
#include <cmath>
#include <cstdio>
#include <bits/stdc++.h>
typedef long long int ll;
using namespace std;

int main(){
    string s;
    int price=700;
    cin>>s;
    for(int i=0;i<s.length();i++){
        if(s[i]=='o'){
            price+=100;
        }
    }
    cout<<price<<endl;
}

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

int main() {
  long long N,M,i,x;
  cin >> N >> M;
  
  bool D[N+2];
  long long dp[N+2];
  rep(i,N){
    dp[i]=1;
  	D[i] = true;
  }
    dp[0]=1;
  
  rep(i,M){
    cin >> x;
    D[x] = false;
  }

  if(!D[1])
    dp[1]=0;
  
  const int mod = 1000000007;
  for(int i=2;i<=N;i++){
    if(D[i]){
     	dp[i] = (dp[i-2]+dp[i-1])%mod;
    }
    else dp[i] = 0;
                   
  }
  
  cout << dp[N] <<endl;
}


Measured memory_bytes: 1152
N,A,B=[int(x) for x in input().split()]

if (B-A)%2==0:
    print(int((B-A)//2))

else:
    if B-1 <= N-A:
        print(int(min((B-A-1)//2+A,B-1)))
    if B-1 > N-A:
        print(int(min(N-A, (N-(A+N-B+1))//2 + N-B+1)))


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

using namespace std;

typedef long long ll;
typedef complex<double> point;
#define mapii map<int, int>
#define debug(a) cout << #a << ": " << a << endl
#define debuga1(a, l, r) fto(i, l, r) cout << a[i] << " "; cout << endl
#define fdto(i, r, l) for(int i = (r); i >= (l); --i)
#define fto(i, l, r) for(int i = (l); i <= (r); ++i)
#define forit(it, var) for(__typeof(var.begin()) it = var.begin(); it != var.end(); it++)
#define forrit(rit, var) for(__typeof(var.rbegin()) rit = var.rbegin(); rit != var.rend(); rit++)
#define ii pair<int, int>
#define iii pair<int, ii>
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define maxN 2005
#define MOD 1000
#define oo 1000000007
#define sz(a) (int)a.size()

const double PI = acos(-1.0);

double fRand(double fMin, double fMax)
{
    double f = (double)rand() / RAND_MAX;
    return fMin + f * (fMax - fMin);
}

template <class T>
T min(T a, T b, T c) {
    return min(a, min(b, c));
}

template <class T>
T max(T a, T b, T c) {
    return max(a, max(b, c));
}

int n, k, q, a[maxN], b[maxN], c[maxN];

int Solve(int a[]) {
    vector<int> pos;
    pos.pb(0);
    fto(i, 1, n) {
        if (a[i] == -1) pos.pb(i);
    }
    pos.pb(n+1);

    int res = 0;
    fto(i, 0, sz(pos)-2) {
        int cnt0 = 0;
        fto(j, pos[i]+1, pos[i+1]-1) {
            if (a[j] == 0) ++cnt0;
        }
        int x = min(cnt0, pos[i+1]-pos[i]-k);
        x = max(x, 0);
        res += x;
    }

    return res;
}

int main () {
    scanf("%d%d%d", &n, &k, &q);
    fto(i, 1, n) scanf("%d", &a[i]);

    fto(i, 1, n) b[i] = a[i];
    sort(b+1, b+n+1);

    int ans = oo;
    fto(i, 1, n) {
        int lo = i, hi = n;
        while (lo <= hi) {
            int mid = (lo+hi)/2;
            fto(j, 1, n) {
                if (a[j] < b[i]) c[j] = -1;
                else if (a[j] > b[mid]) c[j] = 1;
                else c[j] = 0;
            }
            if (Solve(c) >= q) {
                ans = min(ans, b[mid]-b[i]);
                hi = mid-1;
            } else lo = mid+1;
        }
    }

    printf("%d", ans);

    return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define endl "\n"
typedef long long int lli;
#define optimize ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define vi vector<int>
#define pii pair<int,int>
#define mii map<int,int>
#define F first
#define S second
#define forn(i,n) for(int i = 0; i<n; i++)
#define forab(i,a,b) for(int i = a; i<b; i++)
#define forll(i,a,b) for(lli i = a; i<b; i++)
#define mp make_pair
#define pb push_back
#define sortv(v) sort(v.begin(), v.end())
#define debug(x) cout<<#x<<" : "<<x<<endl
#define all(x) x.begin(),x.end()
#define printv(v) for(auto it : v) cout<<it<<" ";cout<<endl;
#define prec(n) fixed<<setprecision(n)
const int mod1 = 1000000007;
const int mod2 = 998244353;
const int N = 1e5;

int main()
{
	optimize

	#ifndef ONLINE_JUDGE
	freopen("inputf.in", "r", stdin);
	freopen("outputf.in", "w", stdout);
	#endif

	int d,t,s;
	cin>>d>>t>>s;

	if(d<=t*s)
		cout<<"Yes"<<endl;
	else
		cout<<"No"<<endl;


	return 0;
}

Measured memory_bytes: 3648