akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>

main(){
  int dtime[100][100];
  int dcost[100][100];
  int m, n, i, j, k, a, b, cost, time, t, p, q, r;

  while(1){
    scanf("%d %d", &n, &m);
    if(n==0 && m==0) break;

    for(i=0;i<m;i++){
      for(j=0;j<m;j++){
	if(i==j){
	  dtime[i][j]=0;
	  dcost[i][j]=0;
	  continue;
	}
	dtime[i][j]=1000000;
	dcost[i][j]=1000000;
      }
    }

    for(i=0;i<n;i++){
      scanf("%d %d %d %d", &a, &b, &cost, &time);
      a--;
      b--;
      dtime[a][b]=dtime[b][a]=time;
      dcost[a][b]=dcost[b][a]=cost;
    }
    for(k=0;k<m;k++){
      for(i=0;i<m;i++){
	for(j=0;j<m;j++){
	  if(dtime[i][j]>dtime[i][k]+dtime[k][j]){
	    dtime[i][j]=dtime[i][k]+dtime[k][j];
	  }
	  if(dcost[i][j]>dcost[i][k]+dcost[k][j]){
	    dcost[i][j]=dcost[i][k]+dcost[k][j];
	  }
	}
      }
    }

    scanf("%d", &t);
    for(i=0;i<t;i++){
      scanf("%d %d %d", &p, &q, &r);
      p--;
      q--;
      if(r==0) printf("%d\n", dcost[p][q]);
      else if(r==1) printf("%d\n", dtime[p][q]);
    }
  }
  return 0;
}

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

// M A F I A - M A F I A - M A F I A - M A F I A - M A F I A - M A F I A //

#define int                                       long long
#define lop(i,s,e)                                for(int i=s;i<(int)e;i++)
#define rlop(i,e,s)                               for(int i=e;i>=s;i--)
#define prvec(v)                                  lop(R15,0,v.size())cout << v[R15] <<" "; cout << endl;
#define prarr(arr,s1,e1)                          lop(R15,s1,e1)cout << arr[R15] << " "; cout << endl;

#define endl                                      '\n'
#define ff                                        first
#define ss                                        second
#define pii                                       pair<int,int>

#define pb                                        push_back
#define all(v)                                    v.begin(),v.end()

// M A F I A - M A F I A - M A F I A - M A F I A - M A F I A - M A F I A //

const int N = 3e3 + 7, M = 1000000007, inf = INT_MAX;
const long long INF = LLONG_MAX;

int n, dp[2001];
int get(int id)
{
	if ( id < 3 ) return 0;
	if ( id == 3 ) return 1;
	int &mafia = dp[id];
	if ( mafia + 1 ) return mafia;
	int ans = 1;
	for (int i = 0; i <= id; i++)
	{
		int j = id - i;
		if ( i >= 3 and j >= 3)
		{
			ans += get(j) % M;
			ans %= M;
		}
	}

	return mafia = ans;
}


void solve()
{
	cin >> n;
	memset(dp, -1, sizeof dp);
	int ans = get(n);
	cout << ans << endl;

}

int32_t main()
{
	ios_base::sync_with_stdio(0);   cin.tie(0);   cout.tie(0);

	int test = 1;
	// cin >> ;
	while (test--)solve();


}





















Measured memory_bytes: 3680
use std::io;
use std::str::FromStr;

fn input<T:FromStr>() -> T {
    let mut line: String = String::new();
    io::stdin().read_line(&mut line);
    line.trim().parse().ok().unwrap()
}
fn input_i32_vec() -> Vec<i32> {
    let mut line: String = String::new();
    io::stdin().read_line(&mut line);
    line.split_whitespace().map(|s| s.parse().unwrap()).collect()
}

fn bs(left: usize, right: usize, l_vec: &Vec<i32>, target: i32) -> usize {
    // println!("l: {}, r: {}, target: {}", left, right, target);
    let mid = (left + right) / 2;
    if right - left <= 1 {
        // println!("{}", left);
        return left;
    }
    if l_vec[mid] >= target {
        bs(left, mid, l_vec, target)        
    } else {
        bs(mid, right, l_vec, target)
    }
}

fn main() {
    let n: i32 = input();
    let mut l_vec = input_i32_vec();
    l_vec.sort();
    // println!("{:?}", l_vec);
    let mut sum = 0;
    for i in 0..(l_vec.len() - 2) {
        for j in (i+1)..(l_vec.len()-1) {
            // println!("{}, {}", i, j);
            let mut count = 0;
            if l_vec[i] + l_vec[j] <= l_vec[j+1] {
                continue;
            } else {
                sum += bs(j+1, l_vec.len(), &l_vec, l_vec[i] + l_vec[j]) - j;
            }
        }
    }
    println!("{}", sum);
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
typedef  long long ll;
#define fr(i,a,b) for(ll i=a; i<b; i++)
#define rf(i,a,b) for(ll i=a; i>=b; i--)
typedef std::vector<long long > vi ;
#define F first
#define S second
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define mod 1000000007
#define PB push_back
#define MP make_pair
#define PI 3.14159265358979323846
#define all(a) a.begin(),a.end()
#define mx(a) *max_element(all(a))
#define mn(a) *min_element(all(a))
#define endl '\n'
#define show(a) for(auto el:a)cout<<el<<" "
const ll INF=LLONG_MAX/2;
const ll N=2e5+1;
#define yesno(f) yes(f);no(f);
#define yes(f) if(f)cout<<"YES\n";
#define no(f) if(!f)cout<<"NO\n";
using  namespace std;
ll pow1(ll n,ll p)
{
	if(p==0)	return 1;
	ll x=pow1(n, p/2);
	x=(x*x)%mod;
	if(p%2==0)
		return x;
	else
		return (x*n)%mod;
}
int main()
{
    fast;
   ll t=1;
   //std::cin >> t;
   while(t--)
   {
       ll n;
       std::cin >> n;
       ll x[n],y[n];
       ll p[n],p2[n],p3[n],p4[n];
       fr(i,0,n)
       {
           std::cin >> x[i]>>y[i];
           p[i]=x[i]+y[i];
           p2[i]=(-x[i]-y[i]);
           p3[i]=x[i]-y[i];
           p4[i]=y[i]-x[i];
       }
       sort(p,p+n);
       sort(p4,p4+n);
       sort(p3,p3+n);
       sort(p2,p2+n);
       cout<<max(p[n-1]+p2[n-1],p3[n-1]+p4[n-1])<<"\n";
   }
}

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

int main() {
  int n;
  cin>> n;
  
  if(n%10 == 7){
    cout<< "Yes";
	  return 0;
  }
  n=n/10;
  if(n%10 == 7){
    cout<< "Yes";
	  return 0;
  }
  n=n/10;
  if(n%10 == 7){
    cout<< "Yes";
	  return 0;
  }
  cout<< "No";
  
	return 0;
}


Measured memory_bytes: 3636
#include <iostream>
#include <vector>
#include <map>
#include <cstdio>
#include <string>
#include <algorithm>
using namespace std;

int main(void){
    string b;
    cin >> b;
    int max = -1;
    int count = 0;
    for(int index = 0; b.size() > index; ++index){
        if(b[index]=='A' || b[index]=='T' || b[index]=='C' || b[index]=='G'){
            ++count;
        }else{
            count = 0;
        }
        if(max < count){
            max = count;
        }
    }
    cout << max << endl;
    return 0;
}


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

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            long x = long.Parse(Console.ReadLine());
            long deposit = 100;
            long year = 0;
            while(true)
            {
                year++;
                deposit = (long)Math.Floor((deposit * 1.01));
                if(deposit >= x)
                {
                    System.Console.WriteLine(year);
                    return;
                }
            }
        }
    }
}

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

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	long double n,a,cnt2=0,cnt4=0;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a;
		if(fmod(a,4)==0){
			cnt4++;
		}else if(fmod(a,2)==0){
			cnt2++;
		}
	}
	if(cnt2>=2){
		n-=cnt2-1;
	}
	if(cnt4>=floor(n/2.0)){
		cout<<"Yes"<<endl;
	}else{
		cout<<"No"<<endl;
	}
}


Measured memory_bytes: 384
#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
int main(void){
    // Your code here!
    double a,b,x;
    cin >> a >> b >> x;
    x = x / a;
    if(a*b/2 >= x){
        double c = (2*x)/b;
        cout << std::fixed << std::setprecision(15) << 90 - atan(c/b)/ M_PI * 180.0 << endl;        
    }else{
        double c = (2*(a*b -x))/a;
        cout << std::fixed << std::setprecision(15) <<  atan(c/a)/ M_PI * 180.0 << endl;
    }
}


Measured memory_bytes: 4048
#include <iostream>
#include <iomanip>
#include <fstream>
#include <sstream>
#include <string>
#include <cmath>
#include <cstdio>
#include <cctype>
#include <ctime>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <complex>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cwchar>
#include <cwctype>
#include <exception>
#include <locale>
#include <numeric>
#include <new>
#include <stdexcept>
#include <limits>
#include <valarray>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <list>
#include <utility>
#include <bitset>
#include <algorithm>
#include <functional>
#define rep(i, n) for(int i = 0; i < (int)(n); i ++)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i ++)
#define MP make_pair
using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
const int INF = 1e9 + 7;

int grundy(int x, int k)
{
	if(x < k) return 0;
	int u = x / k, v = x % k;
	if(v == 0) return u;
	return grundy(x - ((v - 1) / (u + 1) + 1) * (u + 1), k);
}

int main()
{
	int n, x, k, ans = 0;
	scanf("%d", &n);
	rep(i, n) {
		scanf("%d%d", &x, &k);
		ans ^= grundy(x, k);
	}
	printf(ans == 0 ? "Aoki\n" : "Takahashi\n");
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void){
    
    int h,w;
    scanf("%d %d",&h,&w);
    
    char moji[101][101];
    int i,j;
    for(i=0; i<h; ++i){
        scanf("%s",moji[i]);
    }
    
    
    int x[101],y[101];
    
    for(i=0; i<h; ++i){
        for(j=0; j<w; ++j){
            
            if(moji[i][j] == '.'){
                
                x[i]++;
                y[j]++;
            }
            
        }
    }
    
    
     for(i=0; i<h; ++i){
        for(j=0; j<w; ++j){
           if(x[i] != w && y[j] != h) printf("%c",moji[i][j]);
        }
        if(x[i] != w) printf("\n");
    }
    
    /*
    for(i=0; i<h; ++i){
        for(j=1; j<=w; ++j){
            if(j%w == 0)printf("%c\n",moji[i][j-1]);
            else printf("%c",moji[i][j-1]);
        }
    }
    */
   
   
    return 0;
}


Measured memory_bytes: 128
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <climits>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <stack>
#include <queue>
#include <algorithm>
#include <iostream>
#include <string>

#define REP(i,n) for(long long i=0;i<n;++i)
#define REPR(i,n) for(long long i=n;i>=0;--i)
#define REPI(itr,v) for(auto itr=v.begin();itr!=v.end();++itr)
#define REPIR(itr,v) for(auto itr=v.rbegin();itr!=v.rend();++itr)
#define FOR(i,a,b) for(long long i=a;i<b;++i)
#define SORT(v,n) sort(v, v+n)
#define SORTV(v) sort(v.begin(), v.end())
#define ALL(v) v.begin(),v.end()
#define llong long long
#define INF 999999999
#define MOD 1000000007
#define pb push_back
#define pf push_front
#define MP make_pair
#define SV(v) {for(long long sitr=0;sitr<v.size();++sitr){cin>>v[sitr];}}

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

using namespace std;

typedef pair<int,int> pii;

int main(){

  int n, k;
  cin >> n >> k;

  string s;
  cin >> s;

  s[k-1] = 'a' + (s[k-1] - 'A');

  cout << s << endl;
  return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <map>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <set>
#include <vector>
#include <queue>
#include <list>
#include <numeric>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <math.h>
#include <stack>
#include <climits>
#include <bitset>

using namespace std;
typedef long long ll;

ll gcd(ll x, ll y) {
  ll tmp = 0;
  if (x < y){
    tmp=x;
    x=y;
    y=tmp;
  }
  while (y > 0) {
    ll r = x % y;
    x = y;
    y = r;
  }
  return x;
}

//for(int i = ; i < ; i++){}

int main(){
  string s,t;
  cin>>s>>t;
  sort(s.begin(),s.end());
  sort(t.begin(),t.end());
  reverse(t.begin(),t.end());
  if(s<t) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  return 0;
}




Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#define rep(i,n) for (int i = 0; i < n; ++i)//macro
using namespace std;

int max(int a, int b, int c){
    int m = a;
    if(m<b){
        m = b;
    }
    if(m<c){
        m = c;
    }
    return m;
}

int main(){
    int n;
    cin >> n;
    vector<int> v(n);
    rep(i,n) cin >> v[i];
    int ans = 0;
    rep(i,n)rep(j,n)rep(k,n) {
        if(i<j && j<k) {
            if(v[i] == v[j]) continue;
            if(v[j] == v[k]) continue;
            if(v[i] == v[k]) continue;
            if((long long)v[i]+v[j]+v[k] <= max(v[i],v[j],v[k])*2) continue;
            ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3108
#include<bits/stdc++.h>
using namespace std;
int main ()
{
    int i,j,a,b,c,s=0;
    cin >> a >> b >> c;
    if(a>c)
    {
        cout << "NO"<< endl;
    }
    else if((a+b)>c)
    {
        cout << "YES"<< endl;
    }
    else if(a+b<c)
    {
        cout << "NO"<< endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)j; i<(int)n; i++)
int main() {
  int n,m; cin>>n;
  int t[n]; rep(i,0,n) cin>>t[i];
  cin>>m;
  int p[m],x[m]; rep(i,0,m) cin>>p[i]>>x[i];
  rep(i,0,m){
    int ans=0;
    rep(j,0,n){
      if(p[i]-1==j) ans+=x[i];
      else ans+=t[j];
    }
    cout<<ans<<endl;
  }
}

Measured memory_bytes: 256
Z=[]
for i in range(3):
    A=list(map(int,input().split()))
    Z.append(A)

Q=[]
a1=0
b1=Z[0][0]-a1
b2=Z[0][1]-a1
b3=Z[0][2]-a1
a2=Z[1][0]-b1
a3=Z[2][0]-b1
c1=[a1+b1,a1+b2,a1+b3]
c2=[a2+b1,a2+b2,a2+b3]
c3=[a3+b1,a3+b2,a3+b3]
Q.append(c1)
Q.append(c2)
Q.append(c3)

if Z==Q:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
a=[list(map(int,input().split())) for i in range (3)]
n=int(input())
for i in range(n):
    b=int(input())
    for j in range(3):
        for k in range(3):
            if a[j][k]==b:
                a[j][k]='o'
if (a[0][0]=='o'and a[0][1]=='o' and a[0][2]=='o') or(a[1][0]=='o'and a[1][1]=='o' and a[1][2]=='o') or(a[2][0]=='o'and a[2][1]=='o' and a[2][2]=='o') or(a[0][0]=='o'and a[1][0]=='o' and a[2][0]=='o') or(a[0][1]=='o'and a[1][1]=='o' and a[2][1]=='o') or(a[0][2]=='o'and a[1][2]=='o' and a[2][2]=='o') or(a[0][0]=='o'and a[1][1]=='o' and a[2][2]=='o') or(a[0][2]=='o'and a[1][1]=='o' and a[2][0]=='o'):
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007


int main() {

  int K,T;
  cin >> K >> T;

  vector<int> a(T);
  for(int i = 0;i < T;i++) {
    cin >> a.at(i);
  }

 if(T != 1) {
   while(1) {
     sort(a.begin(),a.end(),greater<int>());
     if(a.at(1) == 0) break;
     a.at(0)--;
     a.at(1)--;
   }
 }

  cout << max(0,a.at(0)-1) << endl;
}



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

int main(){
  int N;
  cin >>N;
  
  vector<int> T(N);
  int sum = 0;
  repeat(i,0,N){
    cin >>T[i];
    sum += T[i];
  }
  
  int M;
  cin >>M;
  
  int P,X;
  int ans;
  repeat(i,0,M){
    cin >>P>>X;
    ans = sum - T[P-1] + X;
    cout <<ans<< endl;
  }
}

Measured memory_bytes: 256
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {
            // 解答はココに書く
            var min = 30;
            
            var N = cin.ReadInt;
            for (int i = 0; i < N; i++)
            {
                var A = cin.ReadInt;
                var c = 0;
                while (A % 2 == 0 && A != 0) { A >>= 1; ++c; } // 2進数の変数を何回右シフトできるか
                min = Min(min, c);
            }
            WriteLine(min);
        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); } }
        public int ReadInt { get { return int.Parse(Read); } }
        public long ReadLong { get { return long.Parse(Read); } }
        public double ReadDouble { get { return double.Parse(Read); } }
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
    }
}


Measured memory_bytes: 11220
N = int(input())
a = [int(n) for n in input().split()]

steps = []

a_argmax, a_max = max(enumerate(a), key = lambda x:x[1])
a_argmin, a_min = min(enumerate(a), key = lambda x:x[1])



if a_max + a_min >= 0:
    for i in range(N):
        steps.append((a_argmax, i))
    for i in range(N-1):
        steps.append((i, i+1))
else:
    for i in range(N):
        steps.append((a_argmin, i))
    for i in range(N-1, 0, -1):
        steps.append((i, i-1))

print(2*N-1)
for x, y in steps:
    print("{} {}".format(x+1, y+1))

Measured memory_bytes: 3064
#include<stdio.h>
int main()
{
	unsigned long a,b,c,d,e,f;
	scanf("%lu %lu %lu %lu",&a,&b,&c,&d);
	e=a*b;
	f=c*d;
	if(e<=f)
	printf("%lu",f);
	else
	printf("%lu",e);
	return 0;
}

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

using namespace std;

namespace {

    typedef long long Long;

    template<class T> ostream& operator<<(ostream& os, const vector<T>& vs) {
        if (vs.empty()) return os << "[]";
        os << "[" << vs[0];
        for (int i = 1; i < vs.size(); i++) os << "," << vs[i];
        return os << "]";
    }

    string s;
    void input() {
        cin >> s;
    }

    vector<string> ops;
    Long number(const string& s, int& index) {
        Long r = 0;
        while (index < s.size() && isdigit(s[index])) {
            r = r * 10 + (s[index] - '0');
            index++;
        }
        return r;
    }

    bool check(char op, int level) {
        for (int i = 0; i < ops[level].size(); i++) {
            if (op == ops[level][i]) return true;
        }
        return false;
    }

    Long calc(char op, Long a, Long b) {
        if (op == '+') return a + b;
        if (op == '-') return a - b;
        if (op == '*') return a * b;
        assert(0);
    }

    Long parse(const string& s, int& index, int level) {
        if (level == 3) {
            if (s[index] == '(') {
                index++;
                Long r = parse(s, index, 0);
                assert(s[index] == ')');
                index++;
                return r;
            }
            return number(s, index);
        }
        Long r = parse(s, index, level + 1);
        while (index < s.size() && check(s[index], level)) {
            char op = s[index];
            index++;
            Long a = parse(s, index, level + 1);
            r = calc(op, r, a);
        }
        return r;
    }

    const Long INF = LLONG_MIN;

    void solve() {
        string t = "+-*";
        sort(t.begin(), t.end());
        Long ans = -INF;
        for (int a = 0; a < 3; a++) {
            for (int b = 0; b < 3; b++) {
                for (int c = 0; c < 3; c++) {
                    for (int i = 0; i < 4; i++) {
                        ops.clear(); ops.resize(3);
                        ops[a].push_back(t[0]);
                        ops[b].push_back(t[1]);
                        ops[c].push_back(t[2]);
                        int index = 0;
                        ans = max(ans, parse(s, index, 0));
                    }
                }
            }
        }
        cout << ans << endl;
    }
}

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

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

using namespace std;

vector<int> es[10000];
int h[10000];

int main() {
    int V, E;
    cin >> V >> E;
    
    for (int i = 0; i < E; i++) {
        int u, v;
        cin >> u >> v;
        es[u].push_back(v);
        h[v]++;
    }
    
    stack<int> st;
    for (int i = 0; i < V; i++) if (h[i] == 0) st.push(i);
    
    vector<int> ans;
    
    while (!st.empty()) {
        int u = st.top(); st.pop();
        ans.push_back(u);
        
        for (auto v: es[u]) {
            h[v]--;
            if (h[v] == 0) st.push(v);
        }
    }
    
    for (auto u: ans) cout << u << endl;
    
    return 0;
}


Measured memory_bytes: 3848
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define YES cout<<"YES"<<endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define ANS cout << ans << endl
#define all(a) a.begin(),a.end()
#define SORT(a) sort(all(a))
#define REVERSE(a) reverse(all(a))
#define int long long
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define VIin(a) for(int i=0; i<a.size(); i++) cin >> a[i]
#define OUT(a) cout << a << endl
typedef vector<int> VI;
typedef vector<VI> VVI;
const int MOD=1e9+7;
const long long INF = 1LL << 60;
/*最大公約数*/int gcd(int x, int y) { return y ? gcd(y,x%y) : x;}
/*最小公倍数*/int lcm(int a, int b) { int g = gcd(a, b); return a / g * b; }
/*素数判定*/int isPrime(int n){if(n<2){return 0;}for(int i=2; i*i<=n; i++){if(n%i==0){return 0;}}return 1;}
/*約数列挙*/vector<int> getDivisor(int n){vector<int> v; for(int i=1; i*i<=n; i++){if(n%i==0){v.push_back(i);if(i!=n/i){v.push_back(n/i);}}}sort(v.begin(),v.end()); return v;}
//----------------------------------------------
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    int n; cin >> n;
    VI p(n); VIin(p);
     int ans = 0;
    rep(i,n) ans += p[i];
    SORT(p);
    OUT(ans - p[n-1]/2);

    return 0;
}


Measured memory_bytes: 256
N=int(input())
cnt_M=0
cnt_A=0
cnt_R=0
cnt_C=0
cnt_H=0
for _ in range(N):
    s=input()[0]
    if s=='M':
        cnt_M+=1
    elif s=='A':
        cnt_A+=1
    elif s=='R':
        cnt_R+=1
    elif s=='C':
        cnt_C+=1
    elif s=='H':
        cnt_H+=1
arr=[cnt_M, cnt_A, cnt_R, cnt_C, cnt_H]
ans=0
for i in range(5):
    for j in range(5):
        for k in range(5):
            if i!=j and j!=k and k!=i:
                ans+=arr[i]*arr[j]*arr[k]

print(ans//6)

Measured memory_bytes: 3064
import numpy as np
N,D = map(int,input().split())
x_y = [0]*N
ans = 0

for i in range(N):
    x_y[i]= list(map(int,input().split()))
    x_y[i][0] *= x_y[i][0]
    x_y[i][1] *= x_y[i][1]

# print(x_y)
D = D**2
for i in range(N):
    if(x_y[i][0]+x_y[i][1]<=D):
        ans += 1
print(ans)

Measured memory_bytes: 63116
#include<iostream>
#include<algorithm>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define NMAX 100000
#define INF 1e+6
#define scan(arg) cin>>arg
#define prin(arg) cout<<arg<<"\n"
#define prin2(arg1,arg2) cout<<arg1<<" "<<arg2<<"\n"
using namespace std;
typedef long long ll;
const ll MOD=1000000007;
ll Extgcd(ll a,ll b,ll &x,ll &y){
  ll d=a;
  if(b!=0){
    Extgcd(b,a%b,y,x);
    y-=(a/b)*x;
  }
  else{
    x=1;y=0;
  }
  return d;
}

ll Invmod(ll a,ll p){//mod pでのaの逆元を求める
  ll x,y;
  Extgcd(a,p,x,y);
  return (x%p+p)%p;
}
ll n;
ll a[100010];
int main(){
  scan(n);
  rep(i,n)scan(a[i]);
  ll invsum[100010];
  invsum[0]=0;
  rep1(i,n){
    invsum[i]=(invsum[i-1]+Invmod(i,MOD))%MOD;
  }
  ll nmod=1;
  rep1(i,n){
    nmod=(nmod*i)%MOD;
  }
  ll ans=0;
  rep(i,n){
    ans=(ans+(((a[i]*nmod)%MOD)*((invsum[n-i]+invsum[i+1]-1)%MOD))%MOD)%MOD;
  }
  prin(ans);
  

  return 0;
}


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

using namespace std;

#define all(v) (v).begin(), (v).end()
#define vi vector<int>
#define vvi vector<vi>

typedef long long ll;

int main() {
  string S;
  ll K;
  char ans, cnt = 0;
  cin >> S >> K;
  for (int i = 0; i < S.size(); i++) {
    if (S[i] != '1') {
      ans = S[i];
      break;
    }
    cnt++;
  }
  if (cnt >= K) {
    ans = '1';
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <unordered_map>
#include <utility>
#include <algorithm>
#include <set>
#include <cmath>
#include <array>
#include <bitset>
using namespace std;
typedef long long ll;
const ll mod=1000000007;
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,n) for(int i=1;i<n+1;i++)
int main(){
    int N;
    int A[100];
    cin>>N;
    rep(i,N) cin>>A[i];
    rep(i,N){
        if(A[i]%2 == 1);
        else if((A[i]%3 == 0)||(A[i]%5==0));
        else{
            cout<<"DENIED"<<endl;
            return 0;
        }
    }
    cout<<"APPROVED"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
    int a, t;
    while(scanf("%d", &a) == 1){
        t = a / 3600;
        a = a % 3600;
        printf("%d:", t);
        t = a / 60;
        a = a % 60;
        printf("%d:%d\n", t, a);
    }
return 0;
}



Measured memory_bytes: 2056
#include <bits/stdc++.h>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<P,int> PP;
ll labs(ll v){
	if(v<0LL)return -v;
	return v;
}

int n;
PP p[100001];
PP p2[100001];
bool used[100001];

int main(void){
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		scanf("%lld%lld",&p[i].first.first,&p[i].first.second);
		p[i].second=i;
		p2[i]=p[i];
	}
	sort(p,p+n);
	reverse(p,p+n);
	for(int i=0;i<n;i++){
		swap(p2[i].first.first,p2[i].first.second);
	}
	sort(p2,p2+n);
	for(int i=0;i<n;i++){
		swap(p2[i].first.first,p2[i].first.second);
	}
	ll now=0;
	ll sum=0;
	int l[2]={0,0};
	int ty=0;
	for(int i=0;i<n;i++){
		P use;
		if(ty==0){
			while(l[0]<n && used[p[l[0]].second])l[0]++;
			if(l[0]==n)break;
			used[p[l[0]].second]=true;
			use=p[l[0]].first;
			l[0]++;
		}else{
			while(l[1]<n && used[p2[l[1]].second])l[1]++;
			if(l[1]==n)break;
			used[p2[l[1]].second]=true;
			use=p2[l[1]].first;
			l[1]++;
		}
		if(use.first>now){
			sum+=(use.first-now);
			now=use.first;
		}
		if(use.second<now){
			sum+=now-use.second;
			now=use.second;
		}
		ty=1-ty;
	}
	sum+=labs(now);
	ll ans=sum;
	now=0;
	sum=0;
	memset(used,false,sizeof(used));
	l[0]=l[1]=0;
	ty=1;
	for(int i=0;i<n;i++){
		P use;
		if(ty==0){
			while(l[0]<n && used[p[l[0]].second])l[0]++;
			if(l[0]==n)break;
			used[p[l[0]].second]=true;
			use=p[l[0]].first;
			l[0]++;
		}else{
			while(l[1]<n && used[p2[l[1]].second])l[1]++;
			if(l[1]==n)break;
			used[p2[l[1]].second]=true;
			use=p2[l[1]].first;
			l[1]++;
		}
		if(use.first>now){
			sum+=(use.first-now);
			now=use.first;
		}
		if(use.second<now){
			sum+=now-use.second;
			now=use.second;
		}
		ty=1-ty;
	}
	sum+=labs(now);
	ans=max(ans,sum);
	printf("%lld\n",ans);
	return 0;
}

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

int main(){
int A,B,C,K;
cin >> A >> B >> C >> K;
if(A>K){
	cout << K <<endl;
	return 0;
}
else if(K>=A && B>K-A){
	cout << A <<endl;
	return 0;
}
else if(K>=A+B && C>K-A-B){
	cout << A-(K-A-B) << endl;
	return 0;
}
else{
	cout << A-C << endl;
}

}

Measured memory_bytes: 3620
#include <iostream>
using namespace std;
int main() {
    int n, k; cin >> n >> k;
    int a[n]; for (int i = 0; i < n; i++) cin >> a[i];
    int lb = 0, ub = 1e9;
    while (ub - lb > 1) {
        int m = (ub + lb) / 2;
        int count = 0;
        for (int i = 0; i < n; i++) count += (m - 1 + a[i]) / m - 1;
        if (count <= k) ub = m;
        else lb = m;
    }
    cout << ub << endl;
}


Measured memory_bytes: 3940
s = raw_input()
q = int(raw_input())
for i in range(q):
	m = raw_input().split(' ')
	if m[0]=="print":
		print s[int(m[1]):int(m[2])+1]
	elif m[0] == "replace":
		s = s[:int(m[1])]+m[3]+s[int(m[2])+1:]
	else:
		t = s[int(m[1]):int(m[2])+1]
		s = s[:int(m[1])]+t[::-1]+s[int(m[2])+1:]

Measured memory_bytes: 4232
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
#define yn {puts("Yes");}else{puts("No");}
#define MAX_N 200005

vector<P> G[MAX_N];

int main() {
    int n, m;
    cin >> n >> m;
    int d[n];
    rep(i,n)cin >> d[i];
    int a[m];
    rep(i,m)a[i] = 1000000000;
    int x[n] = {};
    int u[m], v[m];
    rep(i,m){
        cin >> u[i] >> v[i];
        u[i]--; v[i]--;
        G[u[i]].push_back(P(v[i], i));
        G[v[i]].push_back(P(u[i], i));
    }

    // 座標圧縮
    vector<int> b, pre_b, z;
    rep(i,n)pre_b.push_back(d[i]);
    sort(pre_b.begin(), pre_b.end());
    rep(i,n){
        if(i == 0){
            b.push_back(pre_b[i]);
        }else{
            if(pre_b[i] != pre_b[i-1]){
                b.push_back(pre_b[i]);
            }
        }
    }
    rep(i,n){
        int tmp_z = lower_bound(b.begin(), b.end(), d[i]) - b.begin() + 1;
        z.push_back(tmp_z);
    }

    int f[n] = {};
    int flag = 1;
    int cnt = 0;
    queue<int> que;
    rep(i,m){
        if(z[u[i]] == 1 && z[v[i]] == 1){
            flag = 0;
            f[u[i]] = 1; f[v[i]] = 1;
            x[u[i]] = 0; x[v[i]] = 1;
            a[i] = d[u[i]];
            que.push(u[i]);
            que.push(v[i]);
            cnt = 2;
            break;
        }
    }

    if(flag){
        cout << -1 << endl;
        return 0;
    }

    while(true){
        if(cnt == n)break;
        while(que.size() > 0){
            int y = que.front();
            que.pop();
            rep(i, G[y].size()){
                if(f[G[y][i].first] == 0 && d[G[y][i].first] >= d[y]){
                    f[G[y][i].first] = 1;
                    x[G[y][i].first] = (x[y] + 1) % 2;
                    a[G[y][i].second] = d[G[y][i].first];
                    que.push(G[y][i].first);
                    cnt++;
                }
            }
        }
        if(cnt == n)break;
        flag = 1;
        rep(i,m){
            if(f[u[i]] == 0 && f[v[i]] == 0 && z[u[i]] == z[v[i]]){
                flag = 0;
                f[u[i]] = 1; f[v[i]] = 1;
                x[u[i]] = 0; x[v[i]] = 1;
                a[i] = d[u[i]];
                que.push(u[i]);
                que.push(v[i]);
                cnt += 2;
                // break;
            }
        }
        if(flag){
            cout << -1 << endl;
            return 0;
        }
    }
    
    rep(i,n){
        if(x[i] == 0)cout << 'B';
        else cout << 'W';
    }
    cout << endl;
    rep(i,m)cout << a[i] << endl;

    return 0;
}
 
 


Measured memory_bytes: 17532
#include "bits/stdc++.h"
using namespace std;
#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 ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size)
#define MOD 1000000007
const long long mod = 1e9+7;
typedef vector<long long> Vl;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<Vl> VVl;
typedef pair<int, int> PII;
typedef long long ll;

int main(){
    int a=0,b=0,c=0,d,n=0,x;
    VI m(3);
    string s,s1,s2;
    cin >> a >> b;   
    if (a<b) cout << 1 << endl;
    else if(a%b==0) cout << 0 << endl;
    else cout << 1 << endl;
    return 0;
} 

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int A = scanner.nextInt();
        int B = scanner.nextInt();
        int H = scanner.nextInt();
        int M = scanner.nextInt();
        scanner.close();

        double hour = 30 * H + 0.5 * M;
        double minitue = 6 * M;

        double diff = Math.min(Math.abs(hour - minitue), 360 - Math.abs(hour - minitue));

        double temp = Math.pow(A, 2) + Math.pow(B, 2) - (2 * A * B * Math.cos(Math.toRadians(diff)));

        System.out.println(Math.pow(temp, 0.5));

    }
}

Measured memory_bytes: 35816
#include <stdio.h>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
#include <functional>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef vector<vector<int>> v2int;
typedef vector<ll> vll;
typedef vector<vector<ll>> v2ll;
typedef list<int> liint;
typedef pair<int, int> pint;
const int INF = int(2e9);
const ll LINF = ll(2e9) * ll(2e9);
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T, class C> void chmax(T& a, C b) { a > b ? : a = b; }
template<class T, class C> void chmin(T& a, C b) { a < b ? : a = b; }



int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int N, A;
 
    cin >> N >> A;
    vint x(N);
    rep(i, N) cin >> x[i];

    vector<v2ll> dp(N + 1, v2ll(N * A + 1, vll(N + 1, -1)));
    dp[0][0][0] = 1;
    rep(i, N) {
        rep(j, A * N + 1) {
            rep(k, N + 1) {
                if (dp[i][j][k] == -1) continue;
                if (dp[i + 1][j][k] == -1)
                    dp[i + 1][j][k] = dp[i][j][k];
                else
                    dp[i + 1][j][k] += dp[i][j][k];
                if (j + x[i] <= N * A) {
                    if (dp[i + 1][j + x[i]][k + 1] == -1)
                        dp[i + 1][j + x[i]][k + 1] = dp[i][j][k] ;
                    else
                        dp[i + 1][j + x[i]][k + 1] += dp[i][j][k] ;
                }

            }
        }
    }

    ll ans = 0;
    REP(i, 1, N* A + 1) {
        REP(j, 1, N + 1) {
            if (i % A == 0 && i / j == A && i % j == 0) {
                if (dp[N][i][j] == -1) continue;
               
                ans += dp[N][i][j] ;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 56192
while line = gets
  m = /([0-9X]+)\+([0-9X]+)=([0-9X]+)/.match(line)
  next unless m

  x_s, y_s, z_s = m[1], m[2], m[3]
  numbers = (0..9).to_a
  [x_s, y_s, z_s].each do |s|
    if s.length > 1 && s[0] == "X"
      numbers -= [0]
      break
    end
  end

  found = false
  numbers.each do |n|
    x, y, z = [x_s, y_s, z_s].map {|s| s.gsub("X", n.to_s).to_i}
    if x + y == z
      found = true
      puts n
      break
    end
  end

  puts "NA" unless found
end

Measured memory_bytes: 8884
#include<bits/stdc++.h>
#define fo(i,n) for(int i=0;i<n;i++)
#define fab(i,a,b) for(int i=a;i<=b;i++)
#define loop(i,b,a) for(int i=a;i>=b;i--)
#define dsort(arr,n) sort(arr, arr + n, greater<int>())
#define vsortd(a) sort(a.begin(), a.end(), greater<double>())
#define vsort(a) sort(a.begin(), a.end())
#define ll long long int
#define test int tc;cin>>tc;while(tc--)
#define dbg(x) cout<<#x<<'='<<(x)<<endl;
#define dbg2(x,y) cout<<#x<<'='<<(x)<<endl<<#y<<'='<<(y)<<endl;
#define dbg3(x,y,z) cout<<#x<<'='<<(x)<<endl<<#y<<'='<<(y)<<endl<<#z<<"="<<(z)<<endl;
#define minheap priority_queue <int, vector<int>, greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define pb push_back
#define ff first
#define ss second
#define mpr make_pair
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define mkv vector<int>
#define endl "\n"
#define print(x) cout<<x<<endl;
const int mod=1e9+7;
using namespace std;
bool sortcol( const vector<int>& v1,const vector<int>& v2 ) {return v1[1] < v2[1];}
void fastio()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
}


void solve()
{
    string a,b;cin>>a>>b;int ans=0;
    fo(i,a.size())
    {
        if(a[i]!=b[i])ans++;
    }
    print(ans)
}

int main()
{
  //  fastio();
  //  test
    solve();
}


Measured memory_bytes: 3916
#include<stdio.h>
int main(void)
{
	int x,y;
	while(1) {
	scanf("%d %d",&x,&y);
	if(x==0 && y==0) break;
	if(x < y) {
			printf("%d %d\n",x,y);
	}
	else if(x == y) {
			printf("%d %d\n",y,x);
	}
	else if(x > y) {
			printf("%d %d\n",y,x);
	}
	}
	return 0;
}

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

typedef long long ll;
const int MOD = 1e9 + 7;
typedef vector<ll> vll;
typedef vector<int> vi;

static int speedUp = []() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    return 0;
}();

int main() {
    int n;
    cin >> n;
    int k = sqrt(2 * n);
    if (k * (k + 1) == 2 * n) {
        cout << "Yes" << endl;
        // k is the number of subsets
        k = k + 1;
        cout << k << endl;
        vector<vi> nums(k + 1);
        int cnt = 1;
        for (int i = 1; i < k; ++i) {
            for (int j = i + 1; j <= k; ++j) {
                nums[i].push_back(cnt);
                nums[j].push_back(cnt);
                ++cnt;
            }
        }
        for (int i = 1; i <= k; ++i) {
            cout << k - 1 << " ";
            for (auto& x : nums[i]) {
                cout << x << " ";
            }
            cout << endl;
        }
    }
    else cout << "No" << endl;
    return 0;

}

Measured memory_bytes: 2304
#include<stdio.h>
int main(void){
int a,b,c;
int count=0;
int i;
scanf("%d %d %d",&a,&b,&c);
for(i=a;i<=b;i++){
if(c%i==0)
count++;
}
printf("%d\n",count);
return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <cstring>
#include <vector>
#include <queue>
#include <algorithm>
#include <cmath>
#include <string>
#include <map>
#include <stack>

#define rep(i,n) for(int i = 0;i< (n);i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<int, ll> pil;

//priority_queue<int, vector<int>, greater<int>> min_heap;
//long long ccw(const Point& A, const Point& B, const Point& C) {
//   return 1LL * (B.x - A.x)*(C.y - A.y) - 1LL * (B.y - A.y)*(C.x - A.x);
//}
int main() { // E 
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	string s; cin >> s;
	if (s == "Sunny") {
		cout << "Cloudy" << '\n';
	}
	else if (s == "Cloudy") {
		cout << "Rainy" << '\n';
	}
	else {
		cout << "Sunny" << '\n';
	}






}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define mp make_pair
#define ff first
#define ss second
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<db, db> pdd;
typedef vector<int> vi;
#define m1 make_pair
#define in insert
#define pb push_back
#define IOS                           \
    std::ios::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
#define endl "\n"
inline ll gcd(ll a, ll b)
{
    if (a == 0)
        return b;
    return gcd(b % a, a);
}
inline ll power(ll a, ll n, ll m)
{
    if (n == 0)
        return 1;
    ll p = power(a, n / 2, m);
    p = (p * p) % m;
    if (n % 2)
        return (p * a) % m;
    else
        return p;
}
const ll MOD = 1e9 + 7;
const int N = int(3e5) + 999;
#define int long long int
#define inf 1e18

int32_t main()
{
    IOS;
    int n, m;
    cin >> n >> m;
    int g[n + 1][m + 1];
    for (int i = 1; i <= n; i++)
    {
        string s;
        cin >> s;
        for (int j = 1; j <= m; j++)
        {
            char ch = s[j - 1];
            if (ch == '.')
                g[i][j] = 0;
            else
                g[i][j] = 1;
        }
    }

    int dp[n + 1][m + 1];
    memset(dp, 0, sizeof dp);
    for (int i = 1; i <= n; i++)
    {
        for (int j = 1; j <= m; j++)
        {
            if (i == 1 and j == 1)
                dp[i][j] = 1;
            else if (g[i][j] == 1)
                dp[i][j] = 0;
            else
            {
                dp[i][j] = dp[i - 1][j] + dp[i][j - 1];
                dp[i][j] %= MOD;
            }
        }
    }
    cout << dp[n][m];
    return 0;
}

Measured memory_bytes: 15872
import Foundation

let K = readLine()!
let input = readLine()!

let nums = input.components(separatedBy: " ")
let KInt = Int(K)!

let a = Int(nums[0])!
let b = Int(nums[1])!

for i in a...b {
    if i % KInt == 0{
        print("OK")
        break
    } else if i == b {
        print("NG")
    }
}

Measured memory_bytes: 13988
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,X,T;
  cin >> N >> X >> T;
  
  int time = 0;
  
  if(N % X != 0){
    time = (N / X + 1)*T;
  }else{
    time = (N / X)*T;
  }
  cout << time << endl;
  
}

Measured memory_bytes: 3620
#include <iostream>
#include <iomanip>
#include <cmath>
#include <cstdio>
#include <fstream>
#include <cstring>
#include <string>
#include <set>
#include <map>
using namespace std;
//ifstream cin();
//ofstream cout();
int main(){
    long long a,b;
    cin>>a>>b;
    cout<<(a+b+1)/2;
	ios::sync_with_stdio(false);
	return 0;
}

Measured memory_bytes: 256
/*input
6
30 10 60 10 60 50
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef tree<long long, null_type, less<long long>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
#pragma GCC optimize("unroll-loops,no-stack-protector")
//order_of_key #of elements less than x
// find_by_order kth element
typedef long long int ll;
#define ld long double
#define pii pair<int,int>
#define f first
#define s second
#define pb emplace_back
#define REP(i,n) for(ll i=0;i<n;i++)
#define sz(_a) (ll)(_a.size())
#define FILL(n) memset(n,0,sizeof(n))
#define ALL(_a) _a.begin(),_a.end()
const ll maxn=100005;
const ll maxlg=__lg(maxn)+2;
const ll INF64=8000000000000000000LL;
const int INF=0x3f3f3f3f;
const ll MOD=ll(1e9+7);
const ld PI=acos(-1);
const ld eps=1e-9;
ll mypow(ll a,ll b){
    ll res=1LL;
    while(b){
        if(b&1) res=res*a%MOD;
        a=a*a%MOD;
        b>>=1;
    }
    return res;
}
int arr[maxn],dp[maxn];
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin>>n;
	REP(i,n) cin>>arr[i];
	dp[0]=0;
	dp[1]=abs(arr[1]-arr[0]);
	for(int i=2;i<n;i++){
		dp[i]=min(dp[i-1]+abs(arr[i]-arr[i-1]),dp[i-2]+abs(arr[i]-arr[i-2]));
	}
	cout<<dp[n-1];
}

Measured memory_bytes: 1024
#正の最大か負の最大を2回足す
##ay[に]ax[を]足す
n = int(input())
a = list(map(int, input().split( )))

mx = max(a)

manu = []
mn = min(a)

#print(mx, mn)
if abs(mx)>abs(mn):
    for i in range(n-1):
        if a[i]>a[i+1]:
            mx = max(a)
            mx_id = a.index(mx)
            manu.append((i+1,mx_id))
            a[i+1] += mx
            
            mx = max(a)
            mx_id = a.index(mx)
            manu.append((i+1,mx_id))
            a[i+1] += mx###
else:
    #print("hit")
    for i in range(n-1,0,-1):
        if a[i-1]>a[i]:
            mn = min(a)
            mn_id = a.index(mn)
            manu.append((i-1,mn_id))
            a[i-1] += mn
            
            mn = min(a)
            mn_id = a.index(mn)
            manu.append((i-1,mn_id))
            a[i-1] += mn
print(len(manu))
for i,j in manu:
    print(j+1,i+1)###
"""
print(*a)

for i in range(n-1):
    if a[i]>a[i+1]:
        print("false")
        exit()
print("true")
"""

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

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

    int n, k;
    cin >> n >> k;
    vector<ll> h(n);
    REP(i, n) cin >> h[i];
    sort(h.begin(), h.end());

    vector<ll> sum(n, 0);
    REP(i, n - 1)
        sum[i + 1] = sum[i] + abs(h[i] - h[i + 1]);

    ll mini = LONG_MAX;
    int ansIndex = 0;
    for (int i = k - 1; i < n; i++) {
        ll diff = h[i] - h[i - (k - 1)];
        if (mini > diff) {
            mini = diff;
            ansIndex = i;
        }
    }

    cout << h[ansIndex] - h[ansIndex - (k - 1)] << '\n';
    return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <algorithm>
#include <string>
 
using namespace std;
 
int main() {
    string W;
    cin >> W;
    string T;
    int num = 0;
    while(true){
        cin >> T;
        if(T == "END_OF_TEXT") break;
        transform(T.begin(), T.end(), T.begin(), ::tolower);
        if(T == W) ++num;
    }
    cout << num << endl;
    return 0;
}

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

int n;

string s[607];

int dp[607][607];

int main()
{
    scanf("%d",&n);
    char ch;
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<n;j++)
        {
            ch=getchar();
            while(ch<'a'||ch>'z')ch=getchar();
            s[i].push_back(ch);
        }
        for(int j=0;j<n;j++)s[i].push_back(s[i][j]);
    }

    for(int i=n;i<2*n;i++)s[i]=s[i-n];

    int ans=0;
    for(int i=0;i<2*n;i++)dp[2*n-1][i]=dp[i][2*n-1]=1;
    int bana,x;
    for(int i=2*n-2;i>=0;i--)
    {
        for(int j=2*n-2;j>=0;j--)
        {
            bana=dp[i+1][j+1]+1;
            bana=min(bana,n);
            bana=min(bana,min(2*n-i,2*n-j));
            for(x=0;x<=bana;x++)
            {
                if(x==bana)break;
                if(s[i][j+x]!=s[i+x][j])break;
            }
            dp[i][j]=x;
            if(i<n && j<n)
            {
                if(x==n)ans++;
            }
        }
    }
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 2176
//Name-Deepesh Bhatt
//Institute-IIT Dhanbad

#include <bits/stdc++.h>
using namespace std;
typedef  long long ll;
#define m 100000000;
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/gcd(a,b)*b;
}
ll power(ll a, ll n)
{
    if (n == 0)
        return 1;
    ll p = power(a, n / 2);
    p = (p * p);
    if (n % 2)
        return (p * a);
    else
        return p;
}

int main()
{
    ios_base::sync_with_stdio(false);    //for fast I/O operation
    cin.tie(NULL);
    ll n;
    cin>>n;
    ll sum=0;
    for(ll i=1;i<=n;i++){
        for(ll j=1;j<=n;j++){
            for(ll k=1;k<=n;k++){
                sum+=gcd(i,gcd(j,k));
            }
        }
    }
    cout<<sum;
    return 0;
}

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

#include <algorithm>
#include <cstdio>
#include <functional>
#include <vector>

using namespace std;

typedef long long ll;
#define all(x) (x).begin(), (x).end()
#define lim 100010
#define mod 1e9 + 7
#define INF 1e9
#define REP(i, n) for (int i = 0; i < n; i++)

ll GCD(int x, int y) { return x % y == 0 ? y : GCD(y, x % y); }

int atama(int k){
  while(k>9){
    k /= 10;
  }
  return k;
}

int main() {
  int N;
  scanf("%d", &N);
  ll ans = 0;
  ll c[10][10]={0};
  for (int k = 1; k <= N;k++){
    int i, j;
    j = k % 10;
    i = atama(k);
    c[i][j]++;
  }
  for (int i = 0; i <= 9;i++){
    for (int j = 0; j <= 9;j++){
      ans += c[i][j] * c[j][i];
    }
  }
  printf("%lld", ans);
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ios ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
#define ll long long
#define endl '\n'
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
bool sortbysec(const pair<int,int>&a,const pair<int,int>&b)
{
    return (a.second<b.second);
}
int main()
{
    ios;
    char c;
    cin>>c;
    if(c>='A'&&c<='Z')
        cout<<"A"<<endl;
    else if(c>='a'&&c<='z')
        cout<<"a"<<endl;
}































Measured memory_bytes: 3648
#include<iostream>
#include<algorithm>
#include<numeric>
#include<cmath>
using namespace std;

int main(){
    int n, x[100];
    cin >> n;
    for(int i = 0; i < n; i++){
        cin >> x[i];
    }
    int ave = round((double)accumulate(x, x+n, 0) / n);

    int ans = 0;
    for(int i = 0; i < n; i++){
        ans += pow(x[i] - ave, 2.0);
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256