akhauriyash/Code-Regression huggingface dataset:
import java.util.*;
public class Main{
  public static void main(String []args){
    Scanner scan =new Scanner(System.in);
    int a=scan.nextInt();
    int b=scan.nextInt();
    int c=a*b;
    if(c%2==1){
      System.out.println("Odd");
    }else {
      System.out.println("Even");
    }
  }
}


Measured memory_bytes: 21844
#include "bits/stdc++.h"
using namespace std;

int main(void) {
	int N;
	cin >> N;
	vector<string> S;
	string str;
	for (int i = 0; i < N; i++) {
		cin >> str;
		S.push_back(str);
	}
	sort(S.begin(), S.end());
	S.erase(unique(S.begin(), S.end()), S.end());
	cout << S.size() << endl;
	return 0;
}

Measured memory_bytes: 11604
#include <stdio.h>
int main()
{
  char sute,h;
  int scood[21][2],i,j,m,rx,ry,t,cou,k,s;
  while(1){
    scanf("%d",&s);
    if(s==0)break;
    for(i=0;i<s;i++){
      scanf("%d %d",&scood[i][0],&scood[i][1]);
    }
    scanf("%d%c",&m,&sute);
    rx=10;
    ry=10;
    cou=0;
    //    printf("%d",m);
    for(i=0;i<m;i++){
      scanf("%c %d%c",&h,&k,&sute);

      //printf("%c %d\n",h,k);
      for(j=0;j<k;j++){
	if(h=='N')ry++;
	if(h=='E')rx++;
	if(h=='S')ry--;
	if(h=='W')rx--;


	//printf("%d %d \n",rx,ry);///
	for(t=0;t<s;t++){
	  if(scood[t][0]==rx&&scood[t][1]==ry){
	    cou++;
	    scood[t][0]=100;
	    scood[t][1]=100;
           }
	}
      }
    }
    //printf("%d",cou);///
    if(cou==s)printf("Yes\n");
    else if(cou!=s)printf("No\n");
  }
  return 0;
}

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

#ifdef LOCAL
#include "dump.hpp"
#else
#define dump(...)
#define dumpv(...)
#endif

#define rep(i, n) for (int i = 0; i < (n); i++)
typedef long long ll;
typedef pair<int, int> P;
const int MOD = 1e9 + 7;
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;

int m[100][100]; // 全部白0

void solve() {
  int A, B;
  cin >> A >> B;
  A--, B--;
  rep(y, 50) rep(x, 100) m[y][x] = 1; // 上半分は黒1にする
  dump(A, B);
  for (int y = 1; y < 49; y += 2) {
    for (int x = 1; x < 99; x += 2) {
      if (A > 0) {
        m[y][x] = 0;
        A--;
        if (A == 0) break;
      }
    }
    if (A == 0) break;
  }

  for (int y = 51; y < 99; y += 2) {
    for (int x = 1; x < 99; x += 2) {
      if (B > 0) {
        m[y][x] = 1;
        B--;
        if (B == 0) break;
      }
    }
    if (B == 0) break;
  }
  cout << "100 100" << endl;
  rep(y, 100) {
    rep(x, 100) {
      if (m[y][x] == 0)
        cout << ".";
      else
        cout << "#";
    }
    cout << endl;
  }
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  // freopen("temp.1", "r", stdin);
  solve();
  return 0;
}

Measured memory_bytes: 256
// https://atcoder.jp/contests/abc101/tasks/abc101_b

#include <bits/stdc++.h>
#define REP(i, n) for (int(i) = 0; (i) < (n); (i)++)
#define REPR(i, n) for (int(i) = (n); (i) >= 0; (i)--)
#define FOR(i, m, n) for (int(i) = (m); (i) < (n); i++)
#define INF 1e9
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;

int main()
{
  /* Magic word */
  // cin.tie(0);
  // ios::sync_with_stdio(false);
  /* ---------- */

  int n;

  cin >> n;

  int t = n, s = 0;
  while (0 < t)
  {
    s += t % 10;
    t /= 10;
  }

  string r = n % s == 0 ? "Yes" : "No";

  cout << r << '\n';

  return 0;
}


Measured memory_bytes: 256
/*      ex3_4
        Tarara  */
#include <stdio.h>

int main(void)
{
    int number; //整数
    scanf("%d", &number);
    if (canFactorize(number))
        printf("Yes\n");
    else
        printf("No\n");
}

// 九九で表現できることを判定する関数
// numberが九九で表現できるならば1、そうでないなら0を返す
int canFactorize(int number)
{
    for (int i = 1; i < 10; ++i)
    {
        if (number % i == 0 && number / i < 10)
            return 1;
    }
    return 0;
}

Measured memory_bytes: 128
//nomura2020_b.cpp
//Sat Jul 11 10:11:22 2020

#include <iostream>
#include <string>
#include <queue>
#include <map>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <math.h>
#include <set>
#define INTINF 2147483647
#define LLINF 9223372036854775807
#define MOD 1000000007
#define rep(i,n) for (int i=0;i<(n);++i)

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

int main(){
	string s;
	cin >> s;

	rep(i,s.length()){
		if (s[i]=='?'){
			cout << "D";
		}else {
			cout << s[i];
		}
	}

	printf("\n");
}

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

int main(){
    int N,Q;
    cin >> N>> Q;
    vector<vector<int>> edges(N);
    for(int i=0;i<N-1;i++){
        int a,b;
        cin >> a >> b;
        a--;b--;
        edges[a].push_back(b);
        edges[b].push_back(a);
    }
    vector<int> counts(N,0);
    for(int i=0;i<Q;i++){
        int p,x;
        cin >> p>> x;
        p--;
        counts[p] += x;
    }

    vector<vector<int> > children(N);
    queue<int> q;
    vector<bool> alreadyBeen(N,false);
    q.push(0);
    alreadyBeen[0] = true;
    while(!q.empty()){
        int target = q.front();
       
        q.pop();
        for(int node:edges[target]){
            if(alreadyBeen[node]){
                continue;
            }
            children[target].push_back(node);
            q.push(node);
            alreadyBeen[node] = true;
        }
    }

    queue<int> q2;
    q2.push(0);
    while(!q2.empty()){
        int pNode = q2.front();
        q2.pop();
        int pCount = counts[pNode];
        for(int node:children[pNode]){
            counts[node] += pCount;
            q2.push(node);
        }
    }
    for(int i=0;i<N;i++){
        cout << counts[i] << " ";
    }
    cout << endl;
    
    




    return 0;
}

Measured memory_bytes: 25088
t[20001],D;M(int*a){return*a-*1[&a];}main(n,m,d){for(;~scanf("%d%d",&n,&m);D=D&&!printf("%d\n",D)){for(m=n+=m;m;)scanf("%d",t+m--);for(qsort(t,++n,4,M);--n;d>D?D=d:0)d=t[n]-t[n-1];}}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
 
int main() {
	int r,d,x,y,i;
  	i=1;
  	cin >> r>>d>>x;
 // cout<<b<<endl;
  	while (i <= 10) {
    x=r*x-d;
    cout << x << endl;
    i++;
  }
  	
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int a, b, ans = 0; cin >> a >> b;

    for(int i = a; i <= b; i++){
        string s = to_string(i);
        if(s[0] == s[4] & s[1] == s[3]) ans++;
    }cout << ans;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
const int INF=1145141919,MOD=1e9+7;
const int64_t LINF=8931145141919364364,LMOD=998244353;
// const int dx[]={1,0,-1,0,1,1,-1,-1},dy[]={0,-1,0,1,1,-1,-1,1};

int main(){
    int a,b; cin>>a>>b;
    int ans=0;
    if(a>=13) ans=b;
    else if(a>=6) ans=b/2;
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
from collections import Counter
def solve():
    N = int(input())
    A = list(map(int, input().split()))
    C = Counter(A)
    ans = []
    for i in range(1,N+1):
        if i in C:
            ans.append(C[i])
        else:
            ans.append(0)
    return ans
print(*solve(),sep='\n')

Measured memory_bytes: 34048
#include<bits/stdc++.h>
using namespace std;
int n,ans=0;
string s;
int main(){
	cin>>s;
	n=s.length();
	for(int i=1;i<=s.length();i++){
		if(s[i-1]=='o') ans++;
	}
	if(n-ans<=7) cout<<"YES";
	else cout<<"NO";
}


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

int main(){
	int N,K;
	cin >> N >> K;
	int ans = 0;
	
	while(N >0){
		N /= K;
		ans++;
	}
	
	cout << ans <<endl;
    return 0;
}



Measured memory_bytes: 256
/*
http://blog.csdn.net/liuke19950717
*/
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int gcd(int a,int b)
{
	if(!b)
	{
		return a;
	}
	return gcd(b,a%b);
}
int main()
{
	int n,m;
	while(~scanf("%d%d",&n,&m))
	{
		int tp=gcd(n,m);
		printf("%d %d\n",tp,n/tp*m);
	}
	return 0;
} 


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

using namespace std;
using ll = long long;
// #define int ll
using PII = pair<ll, ll>;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()

template<typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template<typename T> bool IN(T a, T b, T x) { return a<=x&&x<b; }
template<typename T> T ceil(T a, T b) { return a/b + !!(a%b); }

template<typename T> vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts) {
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}
template<typename T,typename V> typename enable_if<is_class<T>::value==0>::type
fill_v(T &t, const V &v) { t=v; }
template<typename T,typename V> typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t, const V &v ) { for(auto &e:t) fill_v(e,v); }

template<class S,class T>
ostream &operator <<(ostream& out,const pair<S,T>& a){
  out<<'('<<a.first<<','<<a.second<<')'; return out;
}
template<typename T>
istream& operator >> (istream& is, vector<T>& vec){
  for(T& x: vec) {is >> x;} return is;
}
template<class T>
ostream &operator <<(ostream& out,const vector<T>& a){
  out<<'['; for(T i: a) {out<<i<<',';} out<<']'; return out;
}

int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0}; // DRUL
const int INF = 1<<30;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;

ll n, m;
vector<ll> g[100010];
ll dp[100010];

ll dfs(ll v) {
  if(dp[v] != -1) return dp[v];
  ll ret = 0;
  for(auto to: g[v]) {
    chmax(ret, dfs(to) + 1);
  }
  return dp[v] = ret;
}

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

  cin >> n >> m;
  REP(i, m) {
    ll a, b;
    cin >> a >> b;
    a--, b--;
    g[a].push_back(b);
  }

  memset(dp, -1, sizeof(dp));
  ll ret = 0;
  REP(i, n) chmax(ret, dfs(i));
  cout << ret << endl;

  return 0;
}

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

int main() {
    int X, G = 0;
    cin >> X;
    while (X >= 500) {
        X -= 500;
        G += 1000;
    }
    while (X >= 5) {
        X -= 5;
        G += 5;
    }
    cout << G << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define clr(x) memset(x,0,sizeof x)
#define For(i,a,b) for (int i=(a);i<=(b);i++)
#define Fod(i,b,a) for (int i=(b);i>=(a);i--)
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define fi first
#define se second
#define outval(x) cerr<<#x" = "<<x<<endl
#define outtag(x) cerr<<"-----------------"#x"-----------------\n"
#define outarr(a,L,R) cerr<<#a"["<<L<<".."<<R<<"] = ";\
                    For(_x,L,R) cerr<<a[_x]<<" ";cerr<<endl;
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef pair <int,int> pii;
LL read(){
    LL x=0,f=0;
    char ch=getchar();
    while (!isdigit(ch))
        f=ch=='-',ch=getchar();
    while (isdigit(ch))
        x=(x<<1)+(x<<3)+(ch^48),ch=getchar();
    return f?-x:x;
}
int calc(int a,int b){
	if (a%b==0)
		return a/b;
	int L=a/b+1;
	int B=a/b*b;
	int W=max(1,(a-B)/L);
	return calc(a-W*L,b);
}
int main(){
	int n=read();
	int res=0;
	while (n--){
		int a=read(),b=read();
		res^=calc(a,b);
	}
	puts(res?"Takahashi":"Aoki");
	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
class finite_field {
  const int md;
  const int sz;
  vector<int> fct, fnv;
  int inv2;
  public :
    finite_field(
        const int md,
        const int init_factorial_size = 0,
        const int init_power_size = 0
      ) :
      md(md), sz(init_factorial_size),
      fct(sz), fnv(sz)
      {
        if (sz) {
          fct[0] = 1;
          for (int i = 1; i < sz; i++) fct[i] = prod(fct[i - 1], i);
          fnv[sz - 1] = inv(fct[sz - 1]);
          for (int i = sz - 1; i >= 1; i--) fnv[i - 1] = prod(fnv[i], i);
        }
        inv2 = inv(2);
      }
    inline void add (int& a, const int b) const {
      a += b;
      if (a >= md) a -= md;
    }
    inline void sub (int& a, const int b) const {
      a -= b;
      if (a < 0) a += md;
    }
    template<class... A> inline int sum (A... args) const {
      int ret = 0;
      for (int a : initializer_list<int>{args...}) {
        add(ret, a);
      }
      return ret;
    }
    inline int dif (int a, int b) const {
      sub(a, b);
      return a;
    }
    template<class... A> inline int prod (A... args) const {
      long long ret = 1;
      for (int a : initializer_list<int>{args...}) {
        ret *= a;
        ret %= md;
      }
      return (int)ret;
    }
    void mul (int& a, int b) const {
      a = prod(a, b);
    }
    inline int inv (int a) const {
      if (a == 2) return inv2;
      a %= md; if (a < 0) a += md;
      int b = md, u = 0, v = 1;
      while (a) {
        int t = b / a;
        b -= a * t; swap(a, b);
        u -= v * t; swap(u, v);
      }
      assert(b == 1);
      if(u < 0) u += md;
      return u;
    }
    inline int quat (int a, int b) const {
      return prod(a, inv(b));
    }
    void div (int& a, int b) const {
      a = quat(a, b);
    }
    inline int pow (int a, long long b) {
      int ret = 1;
      for (; b; b >>= 1) {
        if (b & 1) mul(ret, a);
        a = prod(a, a);
      }
      return ret;
    }
    inline int binom (int n, int k) const {
      assert(0 <= n && n < sz);
      if (k < 0 || n < k) return 0;
      return prod(fct[n], fnv[k], fnv[n - k]);
    }
};
int main() {
  cin.tie(0); cin.sync_with_stdio(false);
  finite_field fld(1e9 + 7);
  int n;
  cin >> n;
  vector<int> a(n + 1); a[0] = -1;
  for (int i = 1; i <= n; i++) cin >> a[i];
  int mx = *max_element(a.begin(), a.end());
  vector<int> sum_dp(mx + 1, 0);
  vector<int> dp(n + 1); dp[0] = 1;
  for (int i = 1; i <= n; i++) {
    if (a[i - 1] != a[i]) fld.add(sum_dp[a[i]], dp[i - 1]);
    dp[i] = sum_dp[a[i]];
  }
  cout << dp[n] << endl;
  return 0;
}

Measured memory_bytes: 2688
#include <bits/stdc++.h>
#define INF 2147483647
#define INF_LL 9223372036854775807
#define MOD 1000000007
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;

int main() {
	ll N,H,W;
	cin >> N >> H >> W;
	cout << (N - W + 1)*(N - H + 1) << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <vector>
using namespace std;
int coun[105][105][105];
vector<int>x,y,z;
int main()
{
  int n,m;
  scanf("%d %d",&n,&m);
  int a[52],b[52],c[52],d[52],e[52],f[52];
  for(int i=0;i<n;i++)
    {
      scanf("%d %d %d %d %d %d",&a[i],&b[i],&c[i],&d[i],&e[i],&f[i]);
       x.push_back(a[i]);
       x.push_back(d[i]);
       y.push_back(b[i]);
       y.push_back(e[i]);
       z.push_back(c[i]);
       z.push_back(f[i]);
    }
  sort(x.begin(),x.end());
  sort(y.begin(),y.end());
  sort(z.begin(),z.end());
  x.erase(unique(x.begin(),x.end()),x.end());
  y.erase(unique(y.begin(),y.end()),y.end());
  z.erase(unique(z.begin(),z.end()),z.end());
  for(int i=0;i<n;i++)
    {
      int r1=find(x.begin(),x.end(),a[i])-x.begin();
      int r2=find(x.begin(),x.end(),d[i])-x.begin();
      int r3=find(y.begin(),y.end(),b[i])-y.begin();
      int r4=find(y.begin(),y.end(),e[i])-y.begin();
      int r5=find(z.begin(),z.end(),c[i])-z.begin();
      int r6=find(z.begin(),z.end(),f[i])-z.begin();
      for(int i=r1;i<r2;i++)
    {
      for(int j=r3;j<r4;j++)
        {
          for(int k=r5;k<r6;k++)
        {
          coun[i][j][k]++;
        }
        }
    }
    }
  long long ans=0;
  for(int i=0;i<=100;i++)
    {
      for(int j=0;j<=100;j++)
    {
      for(int k=0;k<=100;k++)
        {
          if(coun[i][j][k]>=m)
        {
          long long s1=(x[i+1]-x[i]),s2=(y[j+1]-y[j]),s3=(z[k+1]-z[k]);
          ans+=s1*s2*s3;
        }
        }
    }
    }
  printf("%lld\n",ans);
  return 0;
}

Measured memory_bytes: 6604
#include <stdio.h>

int main(){

    int a,b,c,x,y,n,m,an = 0;
    scanf("%d %d %d %d %d",&a,&b,&c,&x,&y);

    if( a+b > 2*c ) {
        if( x >= y ) {
            if( a >= 2*c ) {
                printf("%d\n",x*c*2);
                return 0;
            }
            else {
                printf("%d\n",y*c*2 + (x-y)*a);
                return 0;
            }
        }
        else {
            if( b >= 2*c ) {
                printf("%d\n",y*c*2);
                return 0;
            }
            else {
                printf("%d\n",x*c*2 + (y-x)*b);
                return 0;
            }
        }
    }
    printf("%d\n",a*x+b*y);




    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int main(){
  string s,t;
  cin>>s>>t;
  vector <bool> used(s.size(),false);
  for(int i=0;i<t.size();i++){
    if(!used[i]){
      for(int j=i+1;j<t.size();j++){
        if(s[i]==s[j] && t[i]==t[j])used[j]=true;
        else if((s[i]==s[j] && t[i]!=t[j]) || (s[i]!=s[j] && t[i]==t[j]))
        {
          cout<<"No";return 0;
        }
      }
    }
  }
  cout<<"Yes\n";
  return 0;
}


Measured memory_bytes: 776
import numpy as np

n = int(input())
arr = list(map(int, input().split(' ')))

m = min(arr)
mi = np.argmin(arr)

while m != sum(arr):
  tmp = []
  for i, a in enumerate(arr):
    if mi == i:
      tmp.append(a)
    elif a%m != 0:
      tmp.append(a%m)
  arr = tmp
  m = min(arr)
  mi = np.argmin(arr)
print(m)

Measured memory_bytes: 23112
#include <iostream>

using namespace std;

int main() {
    string s;
    int i,cnt;
    cin>>s;
    if (s[0]=='R' )
    {
        if (s[1]=='R')
        {
            if (s[2]=='R')
            cout<<3;
            else
            cout<<2;
        }
        else if (s[2]=='R')
        {
            cout<<1;
        }
        else
        {cout<<1;}
    }
    else if (s[1]=='R')
    {
        if (s[2]=='R')
        cout<<2;
        else
        cout<<1;
    }
    else if (s[2]=='R')
    cout<<1;
    else
    cout<<0;
}

Measured memory_bytes: 3620
#include<stdio.h>
int main()
{
    int N,i,AC=0,WA=0,TLE=0,RE=0;
	char kazu[3];
    scanf("%d",&N);
    for(i=0;i<N;i++)
    {
        scanf("%s",&kazu);
        if(!strcmp(kazu, "AC"))
        {
            AC++;
        }
        if(!strcmp(kazu,"WA"))
        {
            WA++;
        }
         if(!strcmp(kazu, "TLE"))
        {
            TLE++;
        }
         if(!strcmp(kazu, "RE"))
        {
            RE++;
        }
        
    }
printf("AC x %d\nWA x %d\nTLE x %d\nRE x %d",AC,WA,TLE,RE);

return 0;
}

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

//g++ -g -o yourexe yourfile.cpp
//./yourexe < yourinput.in > youroutput.out

#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

#define M 1000000007

#define ll long long
#define ld long double
#define vi vector<ll>
#define pi pair<ll, ll>
#define vii vector<pi>
#define vvi vector<vi>
#define pb push_back
#define endl "\n"

#define REP(i, s, e) for (ll i = s; i < e; i++)
#define RREP(i, s, e) for (ll i = s; i > e; i--)

#define all(v) v.begin(), v.end()
#define part(v, s, e) v.begin() + s, v.begin() + e
#define print(v) for (auto i: v) cout << i << " ";

int main() {
    fast;
    ll n, m;
    cin >> n >> m;
    vi arr(m);
    ll sum = 0;
    REP(i, 0, m) {
        cin >> arr[i];
        sum += arr[i];
    }
    if (sum > n)
        cout << -1 << endl;
    else
        cout << n-sum << endl;
}


Measured memory_bytes: 3724
#include <iostream>
#include <cmath>
#include <math.h>
#include <iomanip>
using namespace std;

int main() {
    double a, b, c, C, S, L, h;
    cout << fixed << setprecision(12);
    cin >> a >> b >> C;
    C = C / 180 * M_PI;
    S = a * b * sin(C) / 2;
    c = sqrt(pow(a, 2) + pow(b, 2) - 2 * a * b * cos(C));
    L = a + b + c;
    h = b * sin(C);
    cout << S << endl << L << endl << h << endl;
    
    return 0;
}



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

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


Measured memory_bytes: 3604
//#include<bits/stdc++.h>
#include<algorithm>
#include<cstdio>
#include<iostream>
#include<cstring>
#include<cmath>
#include<queue>
#define ll long long
#define maxn 0x3f3f3f3f
using namespace std;


int main()
{
    int m,n;
    cin>>m>>n;
    if(m%n==0)
        cout<<m/n;
    else
        cout<<m/n+1;
    return 0;
}
























Measured memory_bytes: 384
#include<iostream>
using namespace std;
long dp[62][3];
main()
{
	long n;cin>>n;
	dp[0][0]=1;
	for(int i=0;i<61;i++)
	{
		for(int j=0;j<=2;j++)
		{
			for(int x=0;x<=1;x++)
			{
				for(int y=x;y<=1;y++)
				{
					long b=(n>>i)&1;
					(dp[i+1][(x+y+j+1-b)/2]+=dp[i][j])%=(long)1e9+7;
				}
			}
		}
	}
	cout<<dp[61][0]<<endl;
}

Measured memory_bytes: 256
from pprint import pprint

__BASE     = 1000000007
__MOD      = (2**64)
__INV      = 13499267949257065399

def main():
    s,t = input(),input()
    x = len(t)
    mp = {}
    hashv = 0
    for i in range(len(s)):
        if i - x >= 0:
            hashv = hashv - ord(s[i-x]) * ( __BASE ** (x-1) )
        hashv *= __BASE
        hashv %= __MOD
        hashv += ord(s[i])
        hashv %= __MOD
        if i >= x-1:
            if hashv in mp:
                mp[hashv].append(i)
            else:
                mp[hashv] = [i]
    hashv = 0
    for c in t:
        hashv *= __BASE
        hashv %= __MOD
        hashv += ord(c)
    if hashv in mp:
        for pos in mp[hashv]:
            print(pos-(x-1))

if __name__ == "__main__":
    main()

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

int getmd(int a,int b,int c,int d){
    return abs(a-c)+abs(b-d);
}

int main(){
    int p,q,r,ans(0),m(100);
    cin >> p >> q >> r;
    ans = p+q+r;

    m = max(p,q);
    m = max(m,r);

    cout << ans-m << endl;

    return 0;
}

Measured memory_bytes: 256
var
	L,R,ans,tmp,M,i,j:Longint;
begin
	read(L,R);
	M:=2019;
	ans:=M;
	if L+670<=R then begin
		writeln(0);
		exit;
	end;
	for i:=L to R do begin
		for j:=1 to 50 do begin
			if i+j>R then break;
			tmp:=i mod M*(i+j)mod M;
			if ans>tmp then ans:=tmp;
			if ans=1 then begin
				writeln(1);
				exit;
			end;
		end;
	end;
	writeln(ans);
end.

Measured memory_bytes: 128
#include <stdio.h>
const int MAX_V = 1000000;
int prime[MAX_V+1];
int main(){
  int n;
  for(int i = 2;i <= MAX_V;i++){
    prime[i] = 1;
  }
  for(int i = 2;i * i <= MAX_V;i++){
    if(prime[i]){
      for(int k = 2* i;k <= MAX_V;k += i)
      prime[k]=0;
    }
  }
  while(1){
    scanf("%d",&n);
    if(n == 0)break;
    for(int i = n; i > 3; i--){
      if(prime[i] == 1 && prime[i-2] == 1){
        printf("%d %d\n",i-2,i);
        break;
      }
    }
  }
  return 0;
}

Measured memory_bytes: 6580
#include<iostream>
using namespace std;
int main(){
  int A,B,C;
  cin >> A >> B >> C;
  int n5=0;
  int n7=0;
  if(A==5) n5++;
  if(B==5) n5++;
  if(C==5) n5++;
  if(A==7) n7++;
  if(B==7) n7++;
  if(C==7) n7++;
  if(n5==2 && n7==1) cout << "YES";
  else cout << "NO";
  
  return 0;
}

Measured memory_bytes: 3076
#include<stdio.h>
int main(){
  int i,j,a[100],n,minj,temp,sum=0;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&a[i]);
  }
  for(i=0;i<=n-1;i++){
    minj=i;
    for(j=i;j<=n-1;j++){
      if(a[j]<a[minj]){
	minj=j;
      }
    }
    if(minj!=i){
	temp=a[i];
	a[i]=a[minj];
	a[minj]=temp;
	sum++;
    }
   
  }
  for(i=0;i<n;i++){
    if(i==n-1)printf("%d\n",a[i]);
    else printf("%d ",a[i]);
  }
  printf("%d\n",sum);
  return 0;
}



Measured memory_bytes: 2072
n,m=map(int,input().split())
e=[list(map(int, input().split()))for _ in range(m)]
inf=float("inf")
d=[inf]*(n+1)
d[1]=0
for _ in range(n):
    for a,b,c in e:d[b]=min(d[b],d[a]-c)
x=d[n]
for a,b,c in e:d[b]=min(d[b],d[a]-c)
if x!=d[n]:print(inf)
else:print(-x)

Measured memory_bytes: 3444
import sys
read = sys.stdin.readline
import time
from heapq import heappush, heappop, heapify
import math
import itertools as it
from collections import deque 


def inp():
    return int(input())
def inpl():
    return list(map(int, input().split()))
start_time = time.perf_counter()
# ------------------------------

s = input()
t = input()
mx = 0
for i in range(len(s)-len(t)+1):
    tp = 0
    for j in range(len(t)):        
        if s[i+j] == t[j]:
            tp += 1
    mx = max(mx, tp)
print(len(t)-mx)

# -----------------------------
end_time = time.perf_counter()
print('time:', end_time-start_time, file=sys.stderr)



Measured memory_bytes: 9356
#include<iostream>
#include<string>
using namespace std;
int main()
{
	string s;
	cin >> s;
	if (s[0] == s[1] && s[1] == s[2]) {
		cout << "No" << endl;
	}
	else {
		cout << "Yes" << endl;
	}
	return 0;
}


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

int main(void){
    
    ll n, m, x, ans=999999999, z=0, tmp=0, w=0;
    ll c[19]={};
    ll a[19][19]={};
    ll y[19]={};
    
    cin >> n >> m >> x;
    
    for(ll i=1; i<=n; i++){
        
        cin >> c[i];
        
        for(ll j=1; j<=m; j++){
            
            cin >> a[i][j];
            
        }
        
    }
    
    for(ll i=0; i<=pow(2, n)-1; i++){
        
        z = 0;
        
        for(ll j=1; j<=m; j++){
            
            y[j] = 0;
            
        }
        
        tmp = i;
        
        for(ll k=1; k<=n; k++){
            
            w = pow(2, n-k);
        
        if(tmp>=w){
            
            tmp -= w;
            
            z += c[k];
            
            for(ll j=1; j<=m; j++){
                
                y[j] += a[k][j];
                
            }
            
        }
        
        }
        
        for(ll j=1; j<=m; j++){
            
            if(y[j]<x){
                
                // cout << j << " " << y[j] << endl;
                break;
                
            }
            
            if(j>=m){
                
                ans = min(ans, z);
                
            }
            
        }
        
    }
    
    if(ans==999999999){
        
        ans = -1;
        
    }
    
    cout << ans << endl;
    
    return 0;
    
}

Measured memory_bytes: 4068
#include <bits/stdc++.h>
using namespace std;
 
#define REP(i,s,n) for(int i=s; i<n; ++i)
#define rep(i,n) REP(i,0,n)
#define SORT(c) sort((c).begin(),(c).end())
#define IINF INT_MAX
#define LLINF LLONG_MAX
#define DEBUG false
 
typedef long long ll;
typedef pair<int, int> ii;

int main() {
	
	ll n;
	cin >> n;
	ll ans = n / 11LL;
	ans *= 2LL;
	n %= 11LL;
	if(n > 6LL) ans += 2LL;
	else if(n > 0LL) ans++;
	
	cout << ans << endl;
	
	return 0;
}

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

typedef long long ll;
typedef pair<ll, ll> P;


#define rep(i,n) for(ll (i)=0; (i)<(ll)(n); (i)++)
#define frep(i,m,n) for(ll (i)=(m); (i)<=(ll)(n); (i)++)
#define rrep(i,n) for(ll (i)=(n)-1; (i)>-1; (i)--)
#define frrep(i,m,n) for(ll (i)=(n); (i)>(ll)(m); (i)--)
#define ALL(x) (x).begin(), (x).end()

const ll INF = 100100100100100100;
const ll MOD = 1000000007;

// get abs
ll my_abs(ll a);
// a^n
ll a_n(ll a, ll n);
// get gcd
ll my_gcd(ll a, ll b);
// a^(-1) % MOD 
ll inv(ll a);
// (a+b+c)%MOD
ll madd(ll a, ll b, ll c);
// (a-b)%MOD
ll msub(ll a, ll b);
// (a*b*c)%MOD
ll mtime(ll a, ll b, ll c);


int main() {
    ll n, ans = 0; cin >> n;
    vector<ll> a(n), b(n, 0);
    rep(i, n) cin >> a[i];
    if(a[0] != 0) {
        cout << -1 << endl;
        return 0;
    }
    else {
        rep(i, n-1) {
            if(a[i]+1 < a[i+1]) {
                cout << -1 << endl;
                return 0;
            }
        }
        rep(i, n) {
            b[i-a[i]]++;
        }
        ll index = 0;
        rep(i, n) {
            rep(j, b[i]) {
                a[index] = i;
                index++;
            }
        }
        set<ll> s;
        rep(i, n) {
            if(!s.count(a[n-1-i])) {
                s.insert(a[n-1-i]);
                ans += (n-1-i) - a[n-1-i];
            }
        }
        cout << ans << endl;
    }
    return 0;
}

ll my_abs(ll a) {
    if(a >= 0) return a;
    else return -1 *a;
}

ll a_n(ll a, ll n) { 
    if(n == 0) return 1;
    
    ll ret = a, count = 1;
    while(count * 2 < n) {
        ret *= ret;
        count *= 2;
    }
    if(count == n) return ret;
    else return (ret * a_n(a, n-count));
}

ll my_gcd(ll a, ll b) {
    if(b == 0) return a;
    return my_gcd(b, a%b);
}

ll inv(ll a) {
    return a_n(a, MOD-2);
}

ll madd(ll a, ll b, ll c) {
    ll ret = (a+b) % MOD;
    return (ret+c) % MOD;
}

ll msub(ll a, ll b) {
    if(a < b) return (a-b+MOD) % MOD;
    else return (a-b) % MOD;
}

ll mtime(ll a, ll b, ll c) {
    ll ret = (a*b) % MOD;
    return (ret*c) % MOD;
}


Measured memory_bytes: 15588
#include <iostream>
#include <math.h>
using namespace std;



int main(void){
    int n; cin >> n;
    int R[200005];
    int minv = 0;
    int maxv = -2000000009;
    for(int i=0; i<n; i++) cin >> R[i];

    minv = R[0];
    for(int j=1; j<n; j++) {
        maxv = max(maxv, R[j] - minv);
        minv = min(minv, R[j]);
    }
    cout << maxv << endl;

    return 0;
}



Measured memory_bytes: 3860
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>
#include <cstring>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define all(c) begin(c),end(c)

template<typename T1, typename T2>
inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }

template<typename T1, typename T2>
inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }

typedef long long int ll;
using ll = long long int;
using ull = long long unsigned int;
using Int = long long int;
using namespace std;
#define INF (1 << 30) - 1
#define INFl (ll)5e15
#define DEBUG 0
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007


//edit
class Solve {
public:
    Int N;
    vector<vector<Int>> treeone;
    vector<Int> P;

    void solve() {
        cin >> N;
        treeone.resize(N);
        P.resize(N, -MOD);
        for (int i = 0; i + 1 < N; ++i) {
            int a, b;
            cin >> a >> b;
            a--, b--;
            treeone[a].push_back(b);
            treeone[b].push_back(a);
        }

        Int K;
        cin >> K;
        for (int i = 0; i < K; ++i) {
            int v, p;
            cin >> v >> p;
            v--;
            P[v] = p;
        }

        priority_queue<pair<int, int>> pq;
//        pq.push(make_pair(P[st], st));

//        int st = -1;
//        for (int i = 0; i < N; ++i) {
//            if (P[i] != -MOD) {
//                st = i;
//                break;
//            }
//        }
//
//        if (st == -1) {
//            st = 0;
//            P[st] = 114514;
//        }
        for (int i = 0; i < N; ++i) {
            if (P[i] != -MOD) {
                pq.emplace(P[i], i);
            }
        }

        if (pq.empty()) {
            P[0] = 114514;
            pq.emplace(P[0], 0);
        }


        while (!pq.empty()) {
            auto top = pq.top();
            pq.pop();

            int v = top.second;
            for (auto w : treeone[v]) {
                if (P[w] == -MOD) {
                    P[w] = P[v] - 1;
                    pq.emplace(P[w], w);
                } else if (abs(P[w] - P[v]) != 1) {
                    cout << "No" << endl;
                    return;
                }
            }
        }

        cout << "Yes" << endl;
        for (int i = 0; i < N; ++i) {
            cout << P[i] << endl;
        }


    }
};


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);

    Solve().solve();


    return 0;
}


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

using namespace std;
typedef long long ll;

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=ll(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=ll(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) x.begin(),x.end() //sortなどの引数を省略したい
#define SIZE(x) ll(x.size()) //sizeをsize_tからllに直しておく
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB emplace_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素
#define Umap unordered_map
#define Uset unordered_set

int main(){
    ll x;
    cin >> x;
    if(x >=30) cout << "Yes";
    else cout << "No";
    return 0;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define ALL(x) (x).begin(),(x).end()
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define INF 99999999999
#define PRINT(var) std::cout<<#var"= "<<var<<std::endl

using namespace std;
typedef long long  int ll;

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

string o,e;

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

  if(o.length()>e.length()){
    cout << "GREATER" <<endl;
    return 0;
  }
  if(o.length()<e.length()){
    cout << "LESS" <<endl;
    return 0;
  }

  REP(i,e.length()){
    if(int(o[i]) > int(e[i])){
      cout << "GREATER" <<endl;
    return 0;
    }
    if(int(o[i]) < int(e[i])){
      cout << "LESS" <<endl;
    return 0;
    }
  }

  cout <<"EQUAL" <<endl;

  return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cstdio>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;

constexpr int MOD = 1000000007;

typedef long long LL;
typedef pair<int, int> P;
typedef pair<LL, LL> PLL;

struct A {
    int type;
    LL value;

    A () {}
    A (int a, int b): type(a), value(b) {}

    bool operator < (const A& o) const {
        return value == o.value ? type > o.value : value > o.value;
    }
};

int W, H;
int p[100010], q[100010];


int main() {
    cin >> W >> H;
    for (int j = 0; j < W; ++j) {
        cin >> p[j];
    }
    for (int j = 0; j < H; ++j) {
        cin >> q[j];
    }

    priority_queue<A> pq;

    for (int j = 0; j < W; ++j) {
        pq.push(A(0, p[j]));
    }

    for (int k = 0; k < H; ++k) {
        pq.push(A(1, q[k]));
    }

    LL ret = 0;

    int mul[2] = {H+1, W+1};

    while (!pq.empty()) {
        A x = pq.top(); pq.pop();

        ret += x.value * mul[x.type];

        --mul[1-x.type];
    }

    cout << ret << endl;

    return 0;
}


Measured memory_bytes: 5232
//#define _GLIBCXX_DEBUG
#include "bits/stdc++.h"

using namespace std;

//------------------------------- Type Names -------------------------------//

using i64 = int_fast64_t;

using seika = string;
//{akari : 1D, yukari : 2D, maki : 3D} vector
template <class kizuna>
using akari = vector<kizuna>;
template <class yuzuki>
using yukari = akari<akari<yuzuki>>;
template <class tsurumaki>
using maki = akari<yukari<tsurumaki>>;
//{akane : ascending order, aoi : decending order} priority queue
template <class kotonoha>
using akane = priority_queue<kotonoha, akari<kotonoha>, greater<kotonoha>>;
template <class kotonoha>
using aoi = priority_queue<kotonoha>;
//------------------------------- Libraries --------------------------------//

//------------------------------- Dubug Functions ---------------------------//
inline void print()
{
    cout << endl;
}
template <typename First, typename... Rest>
void print(const First &first, const Rest &... rest)
{
    cout << first << ' ';
    print(rest...);
}
//------------------------------- Solver ------------------------------------//

void solve()
{
    //入力を受け取る
    int N, L;
    cin >> N >> L;
    //vector<string> に受け取る
    akari<seika> ss(N);
    for (int i = 0; i < N; i++)
    {
        cin >> ss[i];
    }
    //辞書順ときたら前から貪欲
    sort(ss.begin(), ss.end());
    for (seika s : ss)
    {
        cout << s;
    }
    cout << endl;
}

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


Measured memory_bytes: 256
import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		
		int h, w, x, y;
		
		String str;
		
		char[][] tile;
		
		
		while(true){
			h = scan.nextInt();
			w = scan.nextInt();
			if(h == 0 && w == 0)break;
			
			tile = new char[h][w];
		
			for(int i = 0; i < h; i++){
				str = scan.next();
				char[] ch = str.toCharArray();
				for(int j = 0; j < w; j++){
					tile[i][j] = ch[j];
				}
			}
			
			x = 0;
			y = 0;
			
			while(true){
				if(tile[y][x] == '>'){
					tile[y][x] = 'n';
					x++;
				}else if(tile[y][x] == '<'){
					tile[y][x] = 'n';
					x--;
				}else if(tile[y][x] == '^'){
					tile[y][x] = 'n';
					y--;
				}else if(tile[y][x] == 'v'){
					tile[y][x] = 'n';
					y++;
				}else if(tile[y][x] == '.'){
					System.out.println(x + " " + y);
					break;
				}else if(tile[y][x] == 'n'){
					System.out.println("LOOP");
					break;
				}
			}
		
		}
	}
}

Measured memory_bytes: 29084
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var arr = input.trim().split(" ").map(Number);
arr.sort(function(a,b){
   return a - b;
});
var sum=0;
if(arr[0] == arr[1] && arr[1] == arr[2] && arr[2] == arr[3])sum++;
if(arr[0+4] == arr[1+4] && arr[1+4] == arr[2+4] && arr[2+4] == arr[3+4])sum++;
if(arr[0+8] == arr[1+8] && arr[1+8] == arr[2+8] && arr[2+8] == arr[3+8])sum++;
console.log((sum==3)?"yes":"no");

Measured memory_bytes: 15516
# -*- coding: utf-8 -*-
"""
Created on Sat Jun 16 21:57:11 2018

@author: ashida
"""

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

count = 0

for i in range(N):
    tmp = a[i]
    while tmp > 1 and tmp%2 == 0 :
        tmp = tmp//2
        count += 1

print(count)

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

#define REP(i,n) for(int i = 0;i < n;++i)
#define PB(s) push_back(s)
#define ST(n) sort(n.begin(),n.end())

const double PI  = acos(-1.0);

using namespace std;
typedef long long ll;

void solve(){
  int a;
  cin >> a;
  if(a==1)cout << "Hello World" << endl;
  else{
  	int b,c;
  	cin >> b >> c;
  	cout << b+c << endl;
  }
}

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

Measured memory_bytes: 896
#include<bits/stdc++.h>
using namespace std;
#define boost ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define mp make_pair
#define pb push_back
#define fp first
#define sp second
typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> pp;
#define check(x, i) ((x>>i)&1LL)
#define set(x,i) (x|(1LL<<i))
#define unset(x,i) (x&~(1LL<<i))
#define INF LONG_MAX
#define MAX_N 20
#define MAX 4000005
#define mod 1000000007
#define REP(i,n) for(i=0;i<n;i++)
#define FOR(i,a,b) for(i=a;i<=b;i++)
#define RFOR(i,a,b) for(i=a;i>=b;i--)
#define len(i,s) for(i=0;s[i];i++)
#define T() while(t--)
ll gcd (ll a, ll b){return (a?gcd(b%a,a):b);}
ll pow1(ll a,ll b,ll MOD){ll ans=1;while(b!=0){if(b&1)ans=(ans*a)%MOD;a=(a*a)%MOD;b=b/2;}return ans;}
ll modInverse(ll a,ll p){return pow1(a,p-2,p);}



int main()
{
    boost
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);    
    freopen("output.txt", "w", stdout);
#endif  
    cout<<fixed;
cout<<setprecision(15);
ld pi = 2 * acos(0.0);
ld a,b,h,m;
cin>>a>>b>>h>>m;
ld o=h*60+m;
ld a1=360*(m/60.0); 
ld a2=(o/(12*60))*360;
ld t=abs(a1-a2);;
ld ans=sqrt(a*a+b*b-2*a*b*(cos(t*pi/180)));
cout<<ans;
}

Measured memory_bytes: 4184
#![allow(non_snake_case)]

use std::io::{stdin, Read};
use std::str::FromStr;
fn read_option<T: FromStr>() -> Option<T> {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok()
}
fn read<T: FromStr>() -> T {
    let opt = read_option();
    opt.expect("failed to parse token")
}

fn main() {
    let x: String = read();
    let mut remains = vec![];
    for c in x.chars() {
        match c {
            'S' => remains.push('S'),
            'T' => {
                if remains.is_empty() || remains.last().unwrap() == &'T' {
                    remains.push('T')
                } else {
                    remains.pop();
                }
            }
            _ => unreachable!(),
        }
    }
    println!("{}", remains.len())
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
priority_queue<int>H; // 升序
priority_queue<int,vector<int> , greater<int> >L; // 降序
int main()
{
  int n;
  scanf("%d",&n);
  LL ans = 0;
  for(int i = 0 ; i < n ; i++)
  {
    int op;scanf("%d",&op);
    if(op == 1)
    {
      int a,b;scanf("%d%d",&a,&b);
      H.push(a);
      L.push(a);
      ans += b;
      if(H.top() > L.top())
      {
        int x = H.top();
        int y = L.top();
        H.pop() , L.pop();
        ans += abs(x-y);
        H.push(y), L.push(x);
      }
    }
    else 
    {
      cout<<H.top() <<" " << ans<<endl;
    }
  }
}

Measured memory_bytes: 3828
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class AtCoderA
{
    static void Main()
    {
        var sc = new Scanner();

        long n = sc.NextLong();
        string a = sc.Next();
        string b = sc.Next();
        string c = sc.Next();

        long answer = 0;

        for (int i = 0; i < n; i++)
        {
            char[] chars = new char[] { a[i], b[i], c[i] };
            long count = chars.Distinct().Count();
            answer += count - 1;
        }

        Console.WriteLine(answer);
    }

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}


Measured memory_bytes: 28228
use std::vec::Vec;

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>().split_whitespace().map(|e| e.parse().ok().unwrap()).collect()
}

const MOD: i64 = 1_000_000_000 + 7;

fn main() {
  let (a, b, c) = {
    let v: Vec<usize> = read_vec();
    (v[0], v[1], v[2])
  };

  let mut v = vec![a + b, a + c, b + c];
  v.sort();
  println!("{}", v[0]);
}


Measured memory_bytes: 4352
#include <algorithm>
//#include <cstdio>
//#include <functional>
//#include <bits/stdc++.h>
#include <iostream>
//#include <cfloat>
//#include <climits>
//#include <cstdlib>
//#include <cstring>
//#include <cmath>
//#include <map>
//#include <queue>
//#include <set>
//#include <sstream>
//#include <stack>
#include <string>
//#include <time.h>
//#include <vector>
//#include <random>
//#include <unordered_set>
//#include <complex>
#define rt0 return 0
using namespace std;
 
int main()
{
	int a,b,c,x,y;
	int temp;

	cin>>a>>b>>c>>x>>y;

	int ans=min((a*x+b*y),(c*2*max(x,y)));
	if(x>y) temp=a*(x-y);
	else temp=b*(y-x);
	ans=min(c*2*min(x,y)+temp, ans);
		
	cout<<ans;
    rt0;
}


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

int main() {
  int A;
  cin>>A;
  int a;
  a=A/100;
  int b;
  b=(A-a*100)/10;
  int c;
  c=A-(a*100+b*10);
  cout << a+b+c << endl;
}

Measured memory_bytes: 256
n,k=map(int,input().split())
a=list(map(int,input().split()))
l1=set([a[0]])
num1=a[0]
num2=1
l2=[]
def al(num):
    l1.add(num)
def n2(num5):
    return num5 in l1
for i in range(n):
    num1=a[num1-1]
    al(num1)
    if num2==len(l1):
        break
    else:
        num2=len(l1)
l1=list(l1)
num=l1.index(num1)
l2=l1[num:]
l1=l1[:num]
num1=len(l1)
num2=len(l2)
if k<=num1:
    print(l1[k-1])
else:
    num3=(k-num1)%num2
    print(l2[num3-1])


Measured memory_bytes: 123484
#include <iostream>
#include <vector>
#include <limits.h>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <queue>
#include <map>
#include <set>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <random>
#include <functional>
#include <stack>
#include <iomanip>
#include <cassert>
//#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
const long long MOD = 1e9+7;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<ld, ll> pdl;
typedef pair<ld, ld> pdd;
//typedef boost::multiprecision::cpp_int bigint;

//拡張拡張Euclidの互除法による(階乗)逆元の求め方
//O(N)
void stairs(long long N, vector<long long>& st, long long mod = 1e9 + 7) {
	st.resize(N + 1, 1);
	for (long long n = 2; n <= N; n++) {
		st[n] = (st[n - 1] * n) % mod;
	}
}

void modinvs(long long N, vector<long long>& inv, vector<long long>& sinv, long long mod = 1e9 + 7) {
	inv.resize(N + 1);
	sinv.resize(N + 1);
	inv[1] = 1;
	sinv[0] = 1;
	sinv[1] = 1;
	for (int n = 2; n <= N; n++) {
		inv[n] = mod - (inv[mod % n] * (mod / n)) % mod;
		sinv[n] = (sinv[n - 1] * inv[n]) % mod;
	}
}

long long Comb(long long n, long long k, vector<long long>& st, vector<long long>& sinv, long long mod = 1e9 + 7) {
	long long ans = st[n];
	ans = (ans * sinv[n - k]) % mod;
	ans = (ans * sinv[k]) % mod;
	return ans;
}

ll N;
vector<ll> stair, inv, sinv;
vector<ll> pows3,pows2;

int main() {
	cin >> N;
	stairs(N, stair, 998244353);
	modinvs(N, inv, sinv, 998244353);
	ll temp = 0;
	ll mod = 998244353;
	pows3.resize(N + 1);
	pows3[0] = 1;
	for (ll n = 1; n <= N; n++) {
		pows3[n] = (pows3[n - 1] * 3) % mod;
	}
	pows2.resize(N + 1);
	pows2[0] = 1;
	for (ll n = 1; n <= N; n++) {
		pows2[n] = (pows2[n - 1] * 2) % mod;
	}
	ll ans = pows3[N];
	for (ll k = N / 2+1; k <= N; k++) {
		ll comb = Comb(N, k, stair, sinv, mod);
		comb = (2 * comb * pows2[N - k]) % mod;
		temp = (temp + comb) % mod;
	}
	ans = (ans - temp) % mod;
	ans = (ans + mod) % mod;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 390912