akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i,n) for(int i=n; i>-1; --i)
#define ALL(a) (a).begin(),(a).end()
#define INIT(a,n,x); REP(i,(n)){ (a)[i]=(x); }
#define CINA(a,n); REP(i,(n)){ cin >> (a)[i]; }
#define INIT2(a,n,m,x); REP(i,(n)){ REP(j,(m)){(a)[i][j]=(x);} }
#define CINA2(a,n,m); REP(i,(n)){ REP(j,(m)){cin >> (a)[i][j];} }
#define Liny "Yes\n"
#define Linn "No\n"
#define LINY "YES\n"
#define LINN "NO\n"

#define umap unordered_map
//cout << setfill('0') << right << setw(4) << 12; // "0012"
int keta(ll x){ if(x<10){return 1;} else{return keta(x/10) + 1;}}
int keta_wa(ll x){ if(x<10){return x;} else{return keta_wa(x/10) + x%10;} }
int ctoi(char c){ return ( (c>='0' && c<='9')? c - '0': 0 );}
ll sum(ll a[],ll N){ return accumulate(a,a+N,0LL);}
ll gcd(ll a,ll b){if(a<b)swap(a,b); return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){if(a<b){swap(a,b);} return a/gcd(a,b)*b;}


int main(){
  ll N; cin>>N;
  ll a[N]; CINA(a,N);
  sort(a,a+N,greater<ll>());
  ll r1 = 0;
  ll r2 = 0;
  ll p = -1;
  REP(i,N){
    if(p==-1){p = a[i]; continue;}
    if(p==a[i]){
      if(r1==0){r1 = p; p=-1; continue;}
      else{r2 = p; break;}
    }else{
      p = a[i];
    }
  }
  cout << r1*r2;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;


#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define PSET(x,y) fixed<<setprecision(y)<<x
#define pb push_back
#define pii pair<int,int>
#define pf push_front
#define mp make_pair
#define vi vector<int>
#define vip vector<pair<int,int> >
#define ff first
#define ss second
#define int long long
#define mod 1000000007
#define BIG 998244353
#define s(t) scanf("%lld",&t)
#define p(t) printf("%lld\n",t)
#define mii map<int,int>
#define MSET(table,i) memset(table, i, sizeof(table))
#define endl '\n'
#define tc int t;cin>>t;while(t--)
#define pi  3.1415926358
#define bits(x) __builtin_popcount(x)
#define minimum(a,n) min_element(a,a+n)-a
#define maximum(a,n) max_element(a,a+n)-a
#define pqbig priority_queue<pii>
#define pqsmall priority_queue<pair<int,pii>,vector<pair<int,pii> >,greater<pair<int,pii> > >
#define all(v) v.begin(),v.end()
#define sitr set<int>:: iterator
#define spitr set<pii>:: iterator
#define mitr map<string,int>:: iterator

int toint(const string &s) {stringstream ss; ss << s; int x; ss >> x; return x;}
string tostring ( int number ) {stringstream ss; ss << number; return ss.str();}

typedef tree<pii, null_type, less<pii>, rb_tree_tag,
        tree_order_statistics_node_update>
        new_data_set;

#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl


int32_t main()
{
    fast;
    int n,k;cin>>n>>k;
    int ans=min(n%k,k-n%k);
    cout<<ans;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
#define rep(i, n) for (int i = 1; i <= (n); i++)
int main(int argc, char const *argv[]) {
  int n;
  cin >> n;
  int count = 0;
  rep(i, n) {
    string s = to_string(i);
    if (s.size() == 1 || s.size() == 3 || s.size() == 5)
      count++;
  }
  cout << count << endl;
  return 0;
}


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

int main(void)
{
    int A, B, C;
    cin >> A >> B >> C;
    
    int tmp = A - B;
    if (tmp >= C) {
        cout << 0 << endl;
    }
    else {
        cout << C - tmp << endl;
    }
}

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

int main(){
 string s;
 int a=0;
 int b=0;
 cin>>s;
 for(int i=0;i<s.size();i++){
     if(s.at(i)=='0')a++;
     else b++;
 }
 if(a>b)cout<<b*2<<endl;
 else cout<<a*2<<endl;

 
}

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

#define ll long long

int main(){
    string s;
    cin >> s;
    set<char> ss;
    for(int i=0; i<(int)s.length(); ++i){
        ss.insert(s[i]);
    }
    if(ss.size()==s.length())
        cout << "yes";
    else
        cout << "no";
    return 0;
}


Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
int64_t Lucas_Number(int);  
int main(){
  int N;
  cin >> N;
  cout << Lucas_Number(N) << endl;
}
 
int64_t Lucas_Number(int N){
  vector<int64_t> L(N+1);
  L.at(0) = 2;
  L.at(1) = 1;
  for ( int i = 2 ; i <= N; i++){
    L.at(i) = L.at(i - 1) + L.at(i - 2);
  }
  
  return L.at(N);
}

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

int index1Origin(int i) {
    return i-1;
}

int main(int argc, char** argv) {
    int nVertices;
    
    // scan number of already existed events
    scanf("%d", &nVertices); 
    
    int adjacencyMatrix[nVertices][nVertices];
//    int vertices;
    int vertex;
    int vertexReached;
    int nEdges;
    int i,j;
    
    // scan already existed events
    for (i = 1; i <= nVertices; i++) {
        scanf("%d", &vertex); 
//        adjacencyMatrix[index1Origin(vertex)];
        
        for (j = 1; j <= nVertices; j++)
            adjacencyMatrix[index1Origin(vertex)][index1Origin(j)] = 0;
        
        scanf("%d", &nEdges); 
                
        for (j = 1; j <= nEdges; j++) {
            scanf("%d", &vertexReached); 
            adjacencyMatrix[index1Origin(vertex)][index1Origin(vertexReached)] = 1;
        }
    }
    
    // print result
    for (i = 1; i <= nVertices; i++) {
        for (j = 1; j <= nVertices; j++) {
            if (j > 1) printf(" ");
            printf("%d", adjacencyMatrix[index1Origin(i)][index1Origin(j)]);
        }
        printf("\n");
    }

    return (EXIT_SUCCESS);
}




Measured memory_bytes: 2112
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <bitset>    // bitset
#include <cctype>    // isupper, islower, isdigit, toupper, tolower
#include <cstdint>   // int64_t, int*_t
#include <cstdio>    // printf
#include <deque>     // deque
#include <iomanip>
#include <iostream> // cout, endl, cin
#include <map>      // map
#include <math.h>
#include <numeric>
#include <queue>         // queue, priority_queue
#include <set>           // set
#include <stack>         // stack
#include <string>        // string, to_string, stoi
#include <tuple>         // tuple, make_tuple
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <utility>       // pair, make_pair
#include <vector>        // vector
using namespace std;
#define _GLIBCXX_DEBUG
#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++)
const int INF = 1001001001;
const int BG = 1000000007;

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

    vector<int64_t> A(N), B(N), C(N), bp(N + 1);
    rep(i, N) cin >> A[i];
    rep(i, N) cin >> B[i];
    rep(i, N) cin >> C[i];

    sort(A.begin(), A.end());
    sort(B.begin(), B.end());
    sort(C.begin(), C.end());

    int64_t j = -1, cnt = 0;
    rep(i, N)
    {
        int target = B[i];
        while (j < N - 1 && A[j + 1] < target)
        {
            j++;
            cnt++;
        }
        bp[i + 1] = cnt;
    }
    // rep(i, N + 1)
    // {
    //     cout << bp[i] << " ";
    // }
    // cout << endl;

    int64_t ans = 0, k = 0;
    cnt = 0;
    rep(i, N)
    {
        int64_t target = C[i];
        while (B[k] < target && k < N)
        {
            cnt += bp[k + 1];
            k++;
        }
        ans += cnt;
    }
    cout << ans << endl;
}


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

int main(){
int n,m,x,i;
int a[100]={0};
int num=0;
int sum=0;
cin>>n>>m>>x;

for(i=0;i<=n;i++){
cin>>a[i];
}
for(int j=0;j<=n;j++){
for(i=x;i<=n;i++){
if(a[j]==i){
num++;
}
}
}
for(int j=0;j<=n;j++){
for(i=x;i>0;i--){
if(a[j]==i){
sum++;
}
}
}
 
if(num>=sum){
cout<<sum;
}
else{
cout<<num;
}
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <cmath>
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
int main(){
    ll n; cin >> n;
    if(n==0){
        cout << 0 << endl;
        return 0;
    }
    if(n>0){
        ll k=0,res=1;
        while(res<n){
            k+=2;
            res += pow(2,k);
        }
        for(ll i=k;i>=0;i--){
            if(i%2==1){
                if(res-pow(2,i)>=n){
                    printf("1");
                    res-=pow(2,i);
                }
                else printf("0");
            }else{
                if(res-pow(2,i)>=n){
                    printf("0");
                    res-=pow(2,i);
                }
                else printf("1");
    
            }
        }
    }else{
      ll k=1,res=0;
        while(res>=n){
            if(k==1) res-=2;
            k+=2;
            res -= pow(2,k);
        }
        for(ll i=k;i>=0;i--){
            if(i%2==1){
                if(res+pow(2,i)<=n){
                    printf("0");
                    res+=pow(2,i);
                }
                else printf("1");
            }else{
                if(res+pow(2,i)<=n){
                    printf("1");
                    res+=pow(2,i);
                }
                else printf("0");
            }
        }
    }
}



Measured memory_bytes: 512
#include <iostream>
#include <stdio.h>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
#include <numeric>
#include <queue>
#include <numeric>
#include <iomanip>
#include <sstream>
#include <cmath>
#include <map>
#include <functional>
#include <limits>
#include <set>
#define rep(i,a,b) for((i)=a;i<(int)(b);i++)
#define max(a,b) (a < b ? b : a)
#define min(a,b) (a > b ? b : a)
#define AAA (1000000007)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;




int main() {
	ll i, j, k;
	ll N, M, K;
	string S;
	cin >> N >> S;

	int ans = 0;
	for (i = 0; i < N - 2; i++) {
		if (S[i] == 'A' && S[i + 1] == 'B' && S[i + 2] == 'C')
			ans++;
	}
	cout << ans;
	return 0;
}


Measured memory_bytes: 256
import math
 
K = int(input())
 
lists = []
for i in range(1, K + 1):
    for j in range(1, K + 1):
        mid = math.gcd(i, j)
        for k in range(1, K + 1):
            lists.append(math.gcd(mid, k))
 
print(sum(lists))

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

int main() {
  int S, N, O;
  cin >> S;
  N = S / 100;
  O = S % 100;
  
  if (N > 0 && N < 13 && O >= 0) {
    if (N >= 0 && N < 13 &&  O > 0 && O < 13) {
      cout << "AMBIGUOUS" << endl;
    } else {
      cout << "MMYY" << endl;
    }
  }else if (O > 0 && O < 13 && N >= 0){
    if (N > 0 && N < 13 &&  O >= 0 && O < 13) {
    cout << "AMBIGUOUS" << endl;
    }else {
      cout << "YYMM" << endl;
    }
  }else {
    cout << "NA" << endl;
  }
}

Measured memory_bytes: 256
use std::io::BufRead;

fn main() {
    let stdin = std::io::stdin();
    let s = stdin.lock().gets().into_bytes();
    for i in 0..s.len() - 1 {
        if s[i] == s[i + 1] {
            println!("{} {}", i + 1, i + 2);
            std::process::exit(0);
        }
        if i < s.len() - 2 && s[i] == s[i + 2] {
            println!("{} {}", i + 1, i + 3);
            std::process::exit(0);
        }
    }
    println!("-1 -1");
}

trait Gets { fn gets(&mut self) -> String; }
impl<T: std::io::BufRead> Gets for T {
    fn gets(&mut self) -> String { self.lines().next().unwrap().unwrap() } }


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

//Minimum Macros
using ll = long long;
using ul = unsigned long;
using ull = unsigned long long;
#define rep(_i,_n) for(ll _i = 0; _i < _n; ++_i)
#define rep2(_i,_s,_n) for(ll _i = _s; _i < _n; ++_i)
#define elif else if
//Vector Macros
#define vec vector
#define append(_x) push_back(_x)
#define fullSort(_a) sort(_a.begin(), _a.end())
#define inputVecI(_name, _n) vec<int> _name(_n);rep(_i, _n)cin >> _name[_i];
#define inputVecL(_name, _n) vec<long> _name(_n);rep(_i, _n)cin >> _name[_i];
#define inputVecLL(_name, _n) vec<ll> _name(_n);rep(_i, _n)cin >> _name[_i];
#define inputVecUL(_name, _n) vec<ul> _name(_n);rep(_i, _n)cin >> _name[_i];
#define inputVecULL(_name, _n) vec<ull> _name(_n);rep(_i, _n)cin >> _name[_i];
#define inputVecS(_name, _n) vec<string> _name(_n);rep(_i, _n)cin >> _name[_i];
#define maxIdx(_name) distance(_name.begin(), max_element(_name.begin(), _name.end()))
#define printVec(_vec) cout << "{";rep(i, _vec.size()-1)cout << _vec[i] << ",";cout << _vec[_vec.size()-1];cout << "}\n";
//Graph Macros
using Graph = vec<vec<long>>;
inline vec<long> BFS(Graph _g, long start){
  vec<long> _ans(_g.size(), -1); _ans[start] = 0; queue<long> _que; _que.push(start);
  while(!_que.empty()){
    long _target = _que.front(); _que.pop();
    for(long _towhere : _g[_target]){
      if(_ans[_towhere] == -1){
        _ans[_towhere] = _ans[_target] + 1; _que.push(_towhere);
      }
    }
  }
  return _ans;
}

int main()
{
    ll A, B;
    cin >> A >> B;
    cout << A*B << endl;
    return 0;
}


Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(long long i=0;i<x;i++)
#define repn(i,x) for(long long i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
vector<pair<string,P> >vec;

ll dp[41][1<<18];

void solve(long long N, long long X, long long Y, long long Z){
	dp[0][0] = 1;
	ll ms = (1<<(X+Y+Z-1))+(1<<(Y+Z-1))+(1<<(Z-1));
	rep(i, N) {
		rep(j, 1<<(X+Y+Z)) {
			if ((j & ms) == ms) continue;
			repn(k, 10) {
				ll n = ((j<<k) + (1<<(k-1)))%(1<<(X+Y+Z));
				dp[i+1][n] = (dp[i+1][n] + dp[i][j])%mod;
				// if ((j & ms) == ms && dp[i][j] > 0) cout << j << endl; 
				// if (i+1 == 1 && dp[i][j] > 0) cout << i+1 << " " << bitset<17>(n) << " " << dp[i+1][n] << endl;
			}
		}
	}
	ll s = 1, r = 0;
	rep(i, N) {
		s = s*10%mod;
	}
	rep(i, 1<<(X+Y+Z)) {
		if ((i & ms) != ms) r = (r+dp[N][i])%mod;
		// if (dp[N][i] == 2) cout << N << " " << bitset<17>(i) << " " << dp[N][i] << endl;
		// if ((i & ms) == ms && dp[N][i] > 0) cout << N << " " << bitset<17>(i) << " " << dp[N][i] << endl;
	}
	// cout << r << endl;
	cout << ((s+mod)-r)%mod << endl;
}

int main(){	
	long long Y;
	long long X;
	long long N;
	long long Z;
	scanf("%lld",&N);
	scanf("%lld",&X);
	scanf("%lld",&Y);
	scanf("%lld",&Z);
	solve(N, X, Y, Z);
	return 0;
}



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

int main(){
    int n;
    cin >> n;
    int l,r;
    int sum = 0;
    for(int i=0;i<n;i++){
        cin >> l >> r;
        sum += r-l+1;
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cstdio>
#define REP(i, n) for (int i = 0; i < n; ++i)
using namespace std;

int N, ptr, res, A[100000];

int main() {
  scanf("%d", &N);
  REP(i,N) scanf("%d", &A[i]);
  sort(A, A+N);
  while ( ptr < N ) {
    int cc = A[ptr], f = 0;
    while ( ptr < N && A[ptr] == cc ) ++f, ++ptr;
    res += f % 2;
  }
  printf("%d\n", res);
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using llpair=pair<ll,ll>;
using llvec=vector<ll>;
using llmat=vector<vector<ll>>;
#define llmattp(name,a,b,num) name(a,vector<ll>(b,num))
#define LLINF 1LL<<60
#define ABS(x) ( (x)>0 ? (x) : -(x) )

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;
}

ll gcd(ll a, ll b) {
	if(a==0||b==0) return 0;
	if(a<b) swap(a,b);
	ll tmp = a%b;
	while(tmp!=0) {
		a = b;
		b = tmp;
		tmp = a%b;
	}
	return b;
}

ll lcm(ll a, ll b) {
	return a*b/gcd(a,b);
}

ll factorial(ll x) {
	ll f=1;
	for(ll i=2; i<x; i++) {
		f*=i;
	}
	return f;
}

ll nPr(ll n, ll r) {
	ll result=1;
	for(ll i=r+1; i<=n; i++) result*=i;
	return result;
}

ll nCr(ll n, ll r) {

	if (n == 0) { return 0; }
	if (r == 0) { return 1; }
	if (r == 1) { return n; }
	if (n == r) { return 1; }

	if (r > n / 2) { r = n / 2; }

	double result = 1;
	for (double i = 1; i <= r; i++) {
		result *= (n - i + 1) / i;
	}

	return (ll)result;
}

bool IsPrime(ll num) {
	if (num < 2) return false;
	else if (num == 2) return true;
	else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

	double sqrtNum = sqrt(num);
	for (ll i = 3; i <= sqrtNum; i += 2)
	{
		if (num % i == 0)
		{
			// 素数ではない
			return false;
		}
	}

	// 素数である
	return true;
}

ll GreaterBinarySearch(llvec array, ll key, ll max, ll min) {
	if(array[max]<array[min]) {
		return -1LL;
	} else {
		ll mid = max + (min-max)/2;
		if(array[mid]<key) {
			return GreaterBinarySearch(array,key,max,mid-1);
		} if(array[mid]>key) {
			return GreaterBinarySearch(array,key,mid+1,min);
		} else {
			return mid;
		}
	}
}

int main() {
	ll n,a,b; cin>>n>>a>>b;
	ll times=n/(a+b);
	ll last=n%(a+b);

	cout<<a*times+min(last,a)<<endl;
}


Measured memory_bytes: 256
n,m = map(int,input().split())
h_list = list(map(int,input().split()))
edges = [list(map(int,input().split())) for _ in range(m)]

edge_dict = {}

for edge in edges:
    if edge[0] in edge_dict:
        edge_dict[edge[0]].append(edge[1])
    else:
        edge_dict[edge[0]] = [edge[1]]
    if edge[1] in edge_dict:
        edge_dict[edge[1]].append(edge[0])
    else:
        edge_dict[edge[1]] = [edge[0]]

count = 0

for i in range(1,n+1):
    if i in edge_dict:
        nums = edge_dict[i]
        target_num = h_list[i-1]
        flag = True
        for num in nums:
            num2 = h_list[num-1]
            if num2 >= target_num:
                flag = False
        if flag == True:
            count += 1
    else:
        count += 1

print(count)

Measured memory_bytes: 43912
#include<math.h>
#include<cmath>
#include<bitset>
#include<stdio.h>
#include<string>
#include<map>
#include<algorithm>
#include<vector>
#include<iostream>
#include<utility>
using namespace std;
int main(){
  int x,y,z;
  scanf("%d %d %d\n",&x,&y,&z);
  swap(x,y);
  swap(x,z);
  printf("%d %d %d\n",x,y,z);
  return 0;
}

Measured memory_bytes: 256
N, Y = map(int, input().split())
ans = ['-1','-1','-1']
for x in range(0,N+1):
    for y in range(0,N+1):
        if N >= x+y:
            if 10000*x+5000*y+1000*(N-x-y) == Y:
                ans = [x,y,N-x-y]
                ans = [str(i) for i in ans]
print(' '.join(ans))


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

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



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

int main(){
	int k, a, b;
  	cin >> k >> a >> b;
  
  	bool ans = false;
  	for(int i = a; i <= b; i++){
    	if(i % k == 0){
          ans = true;
          break;
        }
    }
  	cout << (ans ? "OK" : "NG") << endl;
}

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

ll gcd(ll x, ll y){
	if(y == 0) return x;
	else return gcd(y, x % y);
}

ll lcm(ll x, ll y){
	ll g = gcd(x, y);
	x /= g;
	return x * y;
}


int main(){
	ll n;
	cin >> n;
	ll ans = 1;
	for(ll i = 0; i < n; i++){
		ll t;
		cin >> t;
		ans = lcm(ans, t);
	}
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef map<int,int> mii;
#define pb push_back

/*int pare(int en,int start,int par[])
{
	if(par[en]==start)
	{
		return en;
	}
	pare(par[en],start,par);
}*/


int main()
{
    int t=1;
	//scanf("%d",&t);
    while(t--)
    {
		ll a,b;
		cin >> a >> b;
		cout << a*b << endl;
    }
    return 0;
}


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

// types
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
typedef vector<ll> vll;

// macros
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE second
#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 FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int MOD = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  
  string s;
  cin>>s;
  
  string t="CODEFESTIVAL2016";
  ll n=t.size();
  
  ll cnt=0;
  REP(i,n){
    if(s[i]!=t[i])
      cnt++;
  }
  
  cout<<cnt<<endl;
      
}

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

int main()
{
  uint64_t N;
  std::cin >> N;
  
  std::vector<uint64_t> p(N);
  for (uint64_t n = 0; n < N; ++n) {
    std::cin >> p[n];
  }
  
  std::sort(p.begin(), p.end());
  
  p[N - 1] /= 2;
  
  uint64_t S = std::accumulate(p.begin(), p.end(), 0);
  std::cout << S << std::endl;
  
  return 0;
}

Measured memory_bytes: 256
S = input()

if len(S)%2 == 1:
    T = "10"*(len(S)//2) + "1"
    U = "01"*(len(S)//2) + "0"
else:
    T = "10"*(len(S)//2)
    U = "01"*(len(S)//2)

t_ans = 0
u_ans = 0
for i in range(len(S)):
    if S[i] != T[i]:
        t_ans += 1
    if S[i] != U[i]:
        u_ans += 1

print(min(t_ans, u_ans))

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

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

    bool found = false;
    for (int i=0; i<10; ++i)
        for (int j=0; j<10; ++j)
            if (i*j == N) {
                found = true;
                break;
            }
    std::cout << (found ? "Yes" : "No") << std::endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
const int MOD=(int)1e9+7;
const int INF=(int)1e9;
const ll LINF=(ll)1e18;

int main(){
    int n;
    cin>>n;
    int a[n],b[n];
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    for(int i=0;i<n;i++){
        cin>>b[i];
    }
    int dp[1<<n][55];
    fill(dp[0],dp[1<<n],INF);
    dp[0][0]=0;
    for(int s=0;s<(1<<n)-1;s++){
        int cnt=0;
        for(int i=0;i<n;i++){
            if((s>>i)&1)cnt++;
        }
        for(int mx=0;mx<=50;mx++){
            if(dp[s][mx]==INF)continue;
            int pos=cnt;
            for(int i=0;i<n;i++){
                if((s>>i)&1)continue;
                int num=((cnt-i)&1)?b[i]:a[i];
                if(mx<=num){
                    dp[s+(1<<i)][num]=min(dp[s+(1<<i)][num],dp[s][mx]+abs(pos-cnt));
                }
                pos++;
            }
        }
    }
    int ans=INF;
    for(int i=1;i<=50;i++){
        ans=min(dp[(1<<n)-1][i],ans);
    }
    cout<<(ans==INF?-1:ans)<<endl;
}


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

int a[110],b[110];
char s[110][110];

int main()
{
    int n,m;
    scanf("%d%d",&n,&m);
    for(int i=1; i<=n; i++)
    {
        scanf("%s",s[i]+1);
        for(int j=1; j<=m; j++)
        if(s[i][j]=='#')a[i]=1,b[j]=1;
    }
    for(int i=1; i<=n; i++)
        if(a[i])
        {
            for(int j=1; j<=m; j++)
                if(b[j])
                    printf("%c",s[i][j]);
            printf("\n");
        }
    return 0;
}


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

int main(void)
{
	vector<int> a(3);
	for(int i=0; i<3; i++)
		cin >> a[i];

	sort(a.begin(), a.end());

	cout << a[0] + a[1] << endl;

	return 0;
}


Measured memory_bytes: 384
#include <iostream>

using namespace std;

int main() {

  int a, b, c;
  cin >> a >> b >> c;
  if((a != b && b == c) || (a != b && a == c) || (a != c && a == b)){
    cout << "Yes";
  }else{
    cout << "No";
  }
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<stack>
#include<stdlib.h>

using namespace std;

int a, b;
stack<int> s;

void solution()
{
	a = s.top();
	s.pop();
	b = s.top();
	s.pop();
}


int main()
{
	char str[1000001];

	while(cin>>str)
	{
		switch (str[0])
		{
		case '+':solution(); s.push(a + b); break;
		case '-':solution(); s.push(b - a); break;
		case '*':solution(); s.push(a*b); break;
		case ' ':break;
		default:s.push(atoi(str)); break;
		} 
	}
	cout << s.top() << endl;

return 0;

}


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

using namespace std;

using ll = int_fast64_t;
constexpr ll llmax = INT_FAST64_MAX; // std::numeric_limits<int_fast64_t>::max()
constexpr ll llmin = INT_FAST64_MIN; // std::numeric_limits<int_fast64_t>::min()
using ull = uint_fast64_t;
constexpr ull ullmax = UINT_FAST64_MAX; // std::numeric_limits<uint_fast64_t>::max()

#define FOR(i, b, e) for (int i = (b); i < (e); ++i)
#define RFOR(i, b, e) for (int i = ((e) - 1); (b) <= i; --i)
#define REP(i, N) for (int i = 0; i < (N); ++i)
#define RREP(i, N) for (int i = ((N) - 1); 0 <= i; --i)
#define scanInt(x) int x; scanf("%d", &(x)); getchar();
#define scanLLInt(x) ll x; scanf("%lld", &(x)); getchar();
#define scanVecInt(A, N) vector<int> A(N); REP(i, N){scanf("%d", &(A[i])); getchar();}
#define scanVecLLInt(A, N) vector<ll> A(N); REP(i, N){scanf("%lld", &(A[i])); getchar();}

int main()
{
    scanInt(N);
    cout << (180 * (N - 2)) << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) range(i,0,b)
#define pb(a) push_back(a)
#define all(a) (a).begin(), (a).end()
#define debug(x) cout << "debug " << x << endl;
using namespace std;

map<char, string> enc;
map<string, char> word;

void inputData(){
    enc['A'] = "00000";
    enc['B'] = "00001";
    enc['C'] = "00010";
    enc['D'] = "00011";
    enc['E'] = "00100";
    enc['F'] = "00101";
    enc['G'] = "00110";
    enc['H'] = "00111";
    enc['I'] = "01000";
    enc['J'] = "01001";
    enc['K'] = "01010";
    enc['L'] = "01011";
    enc['M'] = "01100";
    enc['N'] = "01101";
    enc['O'] = "01110";
    enc['P'] = "01111";
    enc['Q'] = "10000";
    enc['R'] = "10001";
    enc['S'] = "10010";
    enc['T'] = "10011";
    enc['U'] = "10100";
    enc['V'] = "10101";
    enc['W'] = "10110";
    enc['X'] = "10111";
    enc['Y'] = "11000";
    enc['Z'] = "11001";
    enc[' '] = "11010";
    enc['.'] = "11011";
    enc[','] = "11100";
    enc['-'] = "11101";
    enc['\''] = "11110";
    enc['?'] = "11111";
    word["101"] = ' ';
    word["000000"] = '\'';
    word["000011"] = ',';
    word["10010001"] = '-';
    word["010001"] = '.';
    word["000001"] = '?';
    word["100101"] = 'A';
    word["10011010"] = 'B';
    word["0101"] = 'C';
    word["0001"] = 'D';
    word["110"] = 'E';
    word["01001"] = 'F';
    word["10011011"] = 'G';
    word["010000"] = 'H';
    word["0111"] = 'I';
    word["10011000"] = 'J';
    word["0110"] = 'K';
    word["00100"] = 'L';
    word["10011001"] = 'M';
    word["10011110"] = 'N';
    word["00101"] = 'O';
    word["111"] = 'P';
    word["10011111"] = 'Q';
    word["1000"] = 'R';
    word["00110"] = 'S';
    word["00111"] = 'T';
    word["10011100"] = 'U';
    word["10011101"] = 'V';
    word["000010"] = 'W';
    word["10010010"] = 'X';
    word["10010011"] = 'Y';
    word["10010000"] = 'Z';
}

string changeWord(string s){
    string sentence,a;
    rep(i,s.size()){
        a+=s[i];
        if((word[a] >= 'A'&& word[a] <= 'Z') || word[a] == ' ' || word[a] == '\'' || word[a] == ',' || word[a] == '-' || word[a] == '.' || word[a] == '?'){
            sentence+=word[a];
            a = "";
        }
    }
    return sentence;
}

string changeCode(string s){
    string code;
    rep(i,s.size()){
        code+=enc[s[i]];
    }
    return code;
}

int main(){
    inputData();
    string s;
    while(getline(cin,s)){
        cout << changeWord(changeCode(s)) << endl;;
    }
}

Measured memory_bytes: 1220
//सत्यान्न प्रमदितव्यम्  ||
//Still, Taking my time to perfect the beats
//And I still got love for the streets, it's the A-D-D-U

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define nt _int128
#define fir first
#define sec second
#define fast_as_levi ios_base::sync_with_stdio(false) , cin.tie(NULL);
#define debug(x) cout<<x<<"\n";
#define debugged cout<<"debugged\n";
#define inf 0x3f3f3f3f
#define LINF  0x3f3f3f3f3f3f3f3fll
#define rall(v) v.rbegin(),v.rend()
#define all(v) v.begin(),v.end() 

const ll mod = 999983;
#define mx 1000005
const ll mxi = 10005;

int main()
{
    fast_as_levi;
    ll a,b,n;
    cin>>a>>b>>n;
    cout<<a*min(b-1,n)/b;
}

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

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


Measured memory_bytes: 3636
#include<bits/stdc++.h>
#define lowbit(x) x&(-x)
#define ll long long
#define mod 998244353
using namespace std;
int x[200001];int y[200001];int lsh[200001];int cnt;ll ans=0;	int n;
struct point {
	int x,y;
	bool operator<(const point &gv)const{
	return gv.x<x;}
}p[200001];ll tree[200001];ll tree2[200001];
int query(int x1){int ans=0;
	for(;x1;x1-=lowbit(x1))ans+=tree[x1];return ans;
}
int query2(int x1){int ans=0;
	for(;x1;x1-=lowbit(x1))ans+=tree2[x1];return ans;
}
void add(int x1,int rt){
	for(;x1<=n;x1+=lowbit(x1)) tree[x1]+=rt;
}
void add2(int x1,int rt){
	for(;x1<=n;x1+=lowbit(x1)) tree2[x1]+=rt;
}
inline ll power(ll a,ll b)
{
    ll ans=1;
    for(;b;b>>=1,a=a*a%mod)
        if(b&1)ans=ans*a%mod;
    return ans;
}
int main(){memset(tree,0,sizeof(tree));
	cin>>n;
	for(int i=1; i<=n; i++) {
    scanf("%d%d",&x[i],&y[i]);
    lsh[i] = x[i];    
}
sort(lsh+1 , lsh+n+1);
cnt = unique(lsh+1 , lsh+n+1) - lsh - 1;
for(int i=1; i<=n; i++)
    x[i] = lower_bound(lsh+1 , lsh+cnt+1 ,x[i]) - lsh;
    for(int i=1; i<=n; i++) {
    lsh[i] = y[i];    
}
sort(lsh+1 , lsh+n+1);
cnt = unique(lsh+1 , lsh+n+1) - lsh - 1;
for(int i=1; i<=n; i++)
    y[i] = lower_bound(lsh+1 , lsh+cnt+1 ,y[i]) - lsh;
for(int i=1;i<=n;i++){
	p[i].x=x[i];
	p[i].y=y[i];
}
sort(p+1,p+n+1);for(int i=1;i<=n;i++)tree2[i]=i&(-i);
for(int i=1;i<=n;i++){
	add2(p[i].y,-1);
	int A1=query(p[i].y);int B1=query(n)-query(p[i].y);int C1=query2(p[i].y);int D1=query2(n)-query2(p[i].y);
	ll A2=power(2,A1),B2=power(2,B1),C2=power(2,C1),D2=power(2,D1);
	ans=(ans+(A2-1)%mod*(B2)%mod*(C2)%mod*(D2-1)%mod)%mod;
	ans=(ans+(A2)%mod*(B2-1)%mod*(C2-1)%mod*(D2)%mod)%mod;
	ans=(ans-(A2-1)%mod*(B2-1)%mod*(C2-1)%mod*(D2-1)%mod)%mod;
	ans=(ans+power(2,n-1))%mod;
	add(p[i].y,1);
}cout<<ans;
}

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

struct Card
{
	char suit;
	int value;
};

void merge(Card A[], int left, int mid, int right);
void mergesort(Card A[], int left, int right);
int partition(Card A[], int p, int r);
void quicksort(Card A[], int p, int r);

int main()
{
	using namespace std;
	Card *A = new Card[100005];
	Card *B = new Card[100005];
	int n, val;
	cin >> n;
	char S[3];
	for (int i = 0; i < n; i++)
	{
		scanf("%s %d", S, &val);
		B[i].suit = A[i].suit = S[0];
		B[i].value = A[i].value = val;
	}
	mergesort(A, 0, n - 1);
	quicksort(B, 0, n - 1);
	bool stable = true;
	for (int i = 0; i < n; i++)
	{
		if (A[i].suit != B[i].suit)
		{
			stable = false;
			break;
		}
	}
	if (stable == true)
	{
		cout << "Stable\n";
	}
	else
	{
		cout << "Not stable\n";
	}

	for (int i = 0; i < n; i++)
	{
		printf("%c %d\n", B[i].suit, B[i].value);
		//printf("%c %d\n", A[i].suit, A[i].value);
	}

	delete[] A;
	delete[] B;
	return 0;
}

void merge(Card A[], int left, int mid, int right)
{
	int len1 = mid - left + 1;
	Card *L = new Card[len1];
	for (int i = 0; i < len1; i++)
	{
		L[i] = A[left + i];
	}
	int len2 = right - mid;
	Card *R = new Card[len2];
	for (int i = 0; i < len2; i++)
	{
		R[i] = A[mid + 1 + i];
	}

	int k = left, i = 0, j = 0;
	while (i < len1 && j < len2)
	{
		if (L[i].value <= R[j].value)
		{
			A[k++] = L[i++];
		}
		else
		{
			A[k++] = R[j++];
		}
	}
	while (i < len1)
	{
		A[k++] = L[i++];
	}
	while (j < len2)
	{
		A[k++] = R[j++];
	}

	delete[] L;
	delete[] R;
}


void mergesort(Card A[], int left, int right)
{
	if (left < right)
	{
		int mid = (left + right) / 2;
		mergesort(A, left, mid);
		mergesort(A, mid + 1, right);
		merge(A, left, mid, right);
	}
}

int partition(Card A[], int p, int r)
{
	int i = p - 1;
	for (int j = p; j < r; j++)
	{
		if (A[j].value <= A[r].value)
		{
			i++;
			Card temp = A[j];
			A[j] = A[i];
			A[i] = temp;
		}
	}
	Card temp = A[r];
	A[r] = A[i + 1];
	A[i + 1] = temp;
	return i + 1;
}

void quicksort(Card A[], int p, int r)
{
	if (p < r)
	{
		int q = partition(A, p, r);
		quicksort(A, p, q - 1);
		quicksort(A, q + 1, r);
	}
}


Measured memory_bytes: 5136
#include<iostream>
using namespace std;
int main()
{
	char s[4];
	cin >> s;
	int a[3] = {0,0,0};
		for (int i = 0; i < 3; i++) {
			if (s[i] == 'a')
				a[0]++;
			else if (s[i] == 'b')
				a[1]++;
			else if (s[i] == 'c')
				a[2]++;
			else
				break;
	}
		if (a[1] == 1 && a[0] == 1 && a[2] == 1)
			printf("Yes\n");
		else
			printf("No");
	return 0;
}

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


/// File input & output /////
#define fRead(x)        freopen("x.txt","r",stdin)
#define fWrite(x)       freopen ("x.txt","w",stdout)

#define mt              make_tuple
#define ld              long double
#define ll              long long
#define ull             unsigned long long
#define ff              first
#define ss              second
#define pb              push_back
#define INF             2e16
#define PI              acos(-1.0)
#define mp              make_pair
#define pii             pair<int,int>
#define pll             pair<LL,LL>


#define min3(a,b,c)     min(a,min(b,c))
#define max3(a,b,c)     max(a,max(b,c))
#define min4(a,b,c,d)   min(a,min(b,min(c,d)))
#define max4(a,b,c,d)   max(a,max(b,max(c,d)))
#define SQR(a)          ((a)*(a))
#define FOR(i,a,b)      for(int i=a;i<=b;i++)
#define ROF(i,a,b)      for(int i=a;i>=b;i--)
#define REP(i,b)        for(int i=0;i<b;i++)
#define MEM(a,x)        memset(a,x,sizeof(a))
#define ABS(x)          ((x)<0?-(x):(x))

#define SORT(v)         sort(v.begin(),v.end())
#define REV(v)          reverse(v.begin(),v.end())


#define FASTIO        ios_base::sync_with_stdio(0);cin.tie(nullptr);




///..................Sort by second element in a pair in decending order............. ///
bool SortbySecDesc(const pair<long long,long long > &a, const pair<long long,long long > &b)
{
    return a.second>b.second;
}

///.........................first element of pair in descending order..........................//////
bool sortinrev(const pair<int,int> &a,
               const pair<int,int> &b)
{
       return (a.first > b.first);
}



///.............................................................TEMPLATE................................................./////

int main()
{
    FASTIO;

    string st;

    cin >> st;

    for(int i=0; i<st.size(); i++)
    {
        if(st[i]=='7')
        {
            cout << "Yes" << endl;
            return 0;
        }
    }

    cout << "No" << endl;





    return 0;
}



Measured memory_bytes: 3648
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
#include <iomanip>
#include <set>
#include <stdio.h>
#include <ctype.h>
using namespace std;
#define pie 3.141592653589793238462643383279
#define mod 1000000007
#define INF 1145141919364364
#define int long long
#define all(vec) vec.begin(),vec.end()
#define P pair<int,int>
#define S second
#define F first

int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}
bool prime(int x) {
	for (int i = 2; i <= sqrt(x); i++) {
		if (x%i == 0)return false;
	}
	return true;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= i; res %= mod;
	}
	return res;
}
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y) * mod_pow(kai(y, y), mod - 2, mod) % mod;
}

int n, a[200010];
int BIT[200010];
int ans;
vector<P> vec;

int sum(int i) {
	int s = 0;
	while (i) {
		s += BIT[i];
		i -= (i & -i);
	}
	return s;
}
void add(int i, int x) {
	while (i <= n) {
		BIT[i] += x;
		i += (i & -i);
	}
}

signed main() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		vec.push_back({ a[i], i });
	}
	sort(all(vec));
	for (int i = 0; i < n; i++) {
		a[vec[i].second] = i + 1;
	}
	for (int i = 0; i < n; i++) {
		ans += i - sum(a[i]);
		add(a[i], 1);
	}
	cout << ans << endl;
}


Measured memory_bytes: 9340
import java.io.BufferedReader
import java.io.InputStream
import java.io.InputStreamReader
import java.io.PrintWriter
import java.lang.Exception
import java.util.*

fun PrintWriter.solve(sc: FastScanner) {
    val n = sc.nextInt()
    val d = sc.nextLong()
    var count = 0
    for (i in 0 until n) {
        val x = sc.nextLong()
        val y = sc.nextLong()
        if (x * x + y * y <= d * d) {
            count++
        }
    }
    println(count)
}

fun main() {
    val writer = PrintWriter(System.out, false)
    writer.solve(FastScanner(System.`in`))
    writer.flush()
}

class FastScanner(s: InputStream) {
    private var st = StringTokenizer("")
    private val br = BufferedReader(InputStreamReader(s))

    fun next(): String {
        while (!st.hasMoreTokens()) st = StringTokenizer(br.readLine())

        return st.nextToken()
    }

    fun nextInt() = next().toInt()
    fun nextLong() = next().toLong()
    fun nextLine() = br.readLine()
    fun nextDouble() = next().toDouble()
    fun ready() = br.ready()
}


Measured memory_bytes: 54688
#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize ("-ffloat-store") // to restrict undesirable precision
#pragma GCC optimize ("-fno-defer-pop")// to pop argument of function as soon as it returns
#define all(a) a.begin(),a.end()
#define ll long long int
#define ld long double
ll power(ll a,ll b,ll m){ if(b==0) return 1; if(b==1) return a%m; ll t=power(a,b/2,m)%m; t=(t*t)%m; if(b&1) t=((t%m)*(a%m))%m; return t;}
ll modInverse(ll a, ll m) { return power(a, m-2, m); }
#define ps push_back
#define fs first
#define sc second
#define takeline cin.ignore();
#define iactive cout.flush();
#define N 200005
#define endl "\n"
#define mod 1000000007
#define PI 3.141592653589793
//((1.0l)*BIG MULTIPLY MAGIC?)
// string to integer stoi()
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();
//-----------------------------------------------
ll ar[3005][3005],n,m,dp[3005][3005][4];
ll maxval(ll i,ll j,ll cnt){
	if(i==n&&j==m) return 0;
	
	if(dp[i][j][cnt]!=-1){
		return dp[i][j][cnt];
	}

	ll a=0,b=0;
	if(i+1<=n){
		a=maxval(i+1,j,0);
		if(ar[i+1][j]!=0) a=max(a,maxval(i+1,j,1)+ar[i+1][j]);
	}
	if(j+1<=m){
		b=maxval(i,j+1,cnt);
		if(ar[i][j+1]!=0&&cnt<3) b=max(b,maxval(i,j+1,cnt+1)+ar[i][j+1]);
	}
	return dp[i][j][cnt]=max(a,b);
}
int main(){
	
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

	ll i,j,k,l;
	cin>>n>>m>>k;
	ll a,b,c;
	for(i=1;i<=k;i++){
		cin>>a>>b>>c;
		ar[a][b]=c;
	}	
	memset(dp,-1,sizeof(dp));
	ll an=maxval(1,1,0);
	if(ar[1][1]!=0) an=max(an,maxval(1,1,1)+ar[1][1]);
	cout<<an;
	return 0;
}

Measured memory_bytes: 356572
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<string>
#include<iostream>
using namespace std;
int main()
{
	string s;
	cin >> s;
	int num = s.size();
	if (num % 2 == 0 && s[num / 2 - 1] != s[num / 2])printf("%d\n", num / 2);
	else
	{
		char z = s[num / 2];
		int m1, m2;
		for (int i = num / 2; i < num; i++)
		{
			if (z == s[i])m1 = i;
			else break;
		}
		for (int i = num / 2; i >= 0; i--)
		{
			if (z == s[i])m2 = i;
			else break;
		}
		printf("%d\n", min(m1 + 1, num - m2));
	}
}

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

//type
#define ll long long
typedef pair<int, int> P;
//定数
#define INF 1000000000000 //10^12:∞
#define MOD 1000000007    //10^9+7:合同式の法
#define MAXR 100000       //10^5:配列の最大のrange
//略記
#define PB push_back //挿入
#define MP make_pair //pairのコンストラクタ
#define F first      //pairの一つ目の要素
#define S second     //pairの二つ目の要素
#define Z class
// OTHER
// xの二乗を返す (関数テンプレート版)
template <typename T>
T square(T x) { return x * x; }
#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))
// loop
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repd(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i <= (b); i++)
#define FORD(i, a, b) for (ll i = a; i >= (b); i--)
#define FORA(i, I) for (const auto &i : I)

// vector
#define ALL(x) x.begin(), x.end()

// output
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define isYES(x) printf("%s\n", (x) ? "YES" : "NO")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define ln cout << '\n'
template <Z A>
void pr(A a)
{
  cout << a;
  ln;
}
template <Z A, Z B>
void pr(A a, B b)
{
  cout << a << ' ';
}

int ans = 0;
bool check = 0;
string s, t;
int N = 3;
vector<int> v(N);
int a, b;
int x, y;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

int main()
{
  cin >> a >> b;
  cin >> x >> y;
  pr((a - x) * (b - y));
  pr(s);
}

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

using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<string> vs;
using pll = pair<ll, ll>;
using vl = vector<ll>;
using vll = vector<vl>;
using vpll = vector<pll>;
struct Edge {
	ll to;
 	ll cost;
 };
using Graph = vector<vector<Edge>>;

#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
/***** define constant start *******/
const ll MOD = 1000000007;
const double PI = 3.1415926535897932;
const ll INF = LLONG_MAX;
string ch = {'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'};
/****** define constant end ********/
/****** define variable start ******/
string s;
/******* define variable end *******/
int solve() {
	cin >> s;
	bool xflag = false;
	string serasex = "";
	REP(i, s.size()){
		if(s.substr(i, 1) != "x"){
			serasex += s.substr(i, 1);
			xflag = true;
		}
	}
	if(!xflag){
		cout << 0 << endl;
		return 0;
	}
	ll hanbun = serasex.size() / 2;
	bool flag = true;
	REP(i, hanbun){
		if(serasex.substr(i, 1) != serasex.substr(serasex.size() - 1 - i,1)){
			flag = false;
		}
	}
	ll count = 0;
	ll ite;
	ll ite2;
	REP(i, s.size()){
		if(s.substr(i, 1) != "x"){
			count++;
			if(count == ceil((long double)serasex.size()/2)){
				ite = i;
				break;
			}
		}
	}
	count = 0;
	if(serasex.size() % 2 == 0){
		REP(i, s.size()){
			if(s.substr(i, 1) != "x"){
				count++;
				if(count == serasex.size()/2 + 1){
					ite2 = i;
					break;
				}
			}
		}
	}
	if(!flag){
		cout << -1 << endl;
	}else{
		if(serasex.size() % 2 == 0){
			ll ans = 0;
			bool flag2 = true;
			ll i = ite;
			ll j = ite2;
			while(flag2){
				if(i < 0 && j >= s.size()){
					flag2 = false;
					break;
				}else if(i < 0){
					ans++;
					j++;
					continue;
				}else if(j >= s.size()){
					ans++;
					i--;
					continue;
				}else if(s.substr(i, 1) != s.substr(j, 1)){
					ans++;
					if(s.substr(i, 1) == "x"){
						i--;
						continue;
					}else{
						j++;
						continue;
					}
				}
				i--;
				j++;
			}
			cout << ans << endl;
		}else{
			ll ans = 0;
			bool flag2 = true;
			ll i = ite-1;
			ll j = ite+1;
			while(flag2){
				if(i < 0 && j >= s.size()){
					flag2 = false;
					break;
				}else if(i < 0){
					ans++;
					j++;
					continue;
				}else if(j >= s.size()){
					ans++;
					i--;
					continue;
				}else if(s.substr(i, 1) != s.substr(j, 1)){
					ans++;
					if(s.substr(i, 1) == "x"){
						i--;
						continue;
					}else{
						j++;
						continue;
					}
				}
				i--;
				j++;
			}
			cout << ans << endl;
		}
	}
	return 0;
}

int main() {
	// clock_t start = clock();
	cout << std::fixed << std::setprecision(10);
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int end_solve = solve();
	/*
	clock_t end = clock();
	const double time = static_cast<double>(end - start) / CLOCKS_PER_SEC *
	1000.0; printf("time %lf[ms]\n", time);
	*/

	return end_solve;
}


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

int main() {
  string n;
  cin>>n;
  if(n[0]=='9'){
    cout<<"Yes"<<endl;
  }
  else if(n[1]=='9'){
    cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }
  
}


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


int main(){
	int n,a[10002],i;
	scanf("%d",&n);
	for(i=0;i<n;i++)
		scanf("%d",&a[i]);
	int ans=0,j;
	for(i=0;i<n;i++){
		for(j=i+1;j<n;j++){
			ans+=(a[i]*a[j]);
		}

	}
	printf("%d\n",ans );
}


Measured memory_bytes: 256
/************************************/
//
//?????? a cm ?????? b cm ???????????¢?????¢?????¨??¨?????????????±???????????????°??????
//
//http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_1_C&lang=jp
/************************************/

#include<stdio.h>

#define MIN 1
#define MAX 100

int main()
{
	int a,b;
	
	scanf("%d %d", &a, &b);
	
	/* ??¶?´? */
	if((a>=MIN) && (a<=MAX) && (b>=MIN) && (b<=MAX))
	{
		printf("%d %d\n", a*b, (a+b)*2);
	}
	else
	{
		/* ERROR */
		return -1;
	}
	
	return 0;
}

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

#define ll long long
#define loop(i,a,b) for(int i = a ; i < b; i++)
#define loop2(i,a,b) for(int i = a; i >= b ; i--)
#define fi first
#define se second
#define VI vector<int>

using namespace std;

int INF = 1e9 + 7;
ll gcd(ll a, ll b) {
	if (b == 0) {
		return a; 
	}
	a %= b;
	return gcd(b, a);
}

ll sum_of_digits(ll x) {
	ll s = 0;
	while (x) {
		s += x % 10;
		x /= 10;
	}
	return s;
}

bool check_prime(ll x) {
	if (x == 1) {
		return false;
	}
	else {
		for (int i = 2; i * i <= x; i++) {
			if (x % i == 0) {
				return false;
			}
		}
		return true;
	}
}

ll binpow(ll x, ll n) {
	if (n == 0) {
		return 1;
	}
	else {
		if (n % 2 == 0) {
			ll z = binpow(x, n >> 1);
			return z * z;
		}
		else {
			return (x * binpow(x, n - 1));
		}
	}
}

bool desc(int a, int b) {
	return (a > b);
}

int main() {
	int a;
	cin >> a;
	cout << a * (a * (a + 1) + 1);
}

Measured memory_bytes: 3536