akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
    #include<cstring>
    #include<cstdio>
    #include<cstdlib>
    #include<algorithm>
    #include<map>
    #include<cmath>
    #include<cstdlib>
    using namespace std;
    const int M=105;
char  a[M],b[M];
 int n,m,flag;

int main()
{
    cin>>a;
    cin>>b;
    int i=0;
    flag=0;
    while(b[i]!='\0')
    {
        if(a[i]=='\0')
        {
            flag=1;
            break;
        }
        i++;
    }
    int j=0;
    while(a[j]!='\0')
    {
        if(b[j]=='\0')
        {
            flag=2;
            break;
        }
        j++;
    }
    if(flag==0)
    {
        int k=0;
        while(b[k]!='\0')
        {
            if(a[k]<b[k])
            {
                flag=1;
                break;
            }
            else if(a[k]>b[k])
            {
                flag=2;
                break;
            }
            else if(a[k]==b[k])
            {
                flag=3;
                k++;
            }

        }
    }
    if(flag==1)
        cout<<"LESS"<<endl;
    if(flag==2)
        printf("GREATER");
    if(flag==3)
        printf("EQUAL");

}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<string>
using namespace std;

struct Node {
	string type;
	int depth;
	int parent = -1;
	vector<int> child;
};

int main() {
	int n;
	Node node[100000];
	queue<Node*> q;
	int depth = 0;

	cin >> n;
	for (int i = 0; i < n; i++) {
		int id, k;
		cin >> id >> k;
		for (int j = 0; j < k; j++) {
			int temp;
			cin >> temp;
			node[id].child.push_back(temp);
			node[temp].parent = id;
		}
	}

	for (int i = 0; i < n; i++) {
		if (node[i].parent == -1) {
			q.push(&node[i]);
			break;
		}
	}

	while (!q.empty()) {
		int size = q.size();
		for (int i = 0; i < size; i++) {

			if (q.front()->parent == -1) {
				q.front()->type = "root";
			}
			else if (q.front()->child.empty()) {
				q.front()->type = "leaf";
			}
			else {
				q.front()->type = "internal node";
			}

			for (int j = 0; j < q.front()->child.size(); j++) {
				q.push(&node[q.front()->child[j]]);
			}
			q.front()->depth = depth;
			q.pop();
		}
		depth++;
	}

	for (int i = 0; i < n; i++) {
		cout << "node " << i << ": parent = " << node[i].parent << ", ";
		cout << "depth = " << node[i].depth << ", ";
		cout << node[i].type << ", ";
		cout << "[";
		for (int j = 0; j < node[i].child.size(); j++) {
			cout << node[i].child[j];
			if (j < node[i].child.size() - 1) {
				cout << ", ";
			}
		}
		cout << "]" << endl;
	}

	return 0;
}

Measured memory_bytes: 12540
#include <iostream>
#include <vector>
#include <cmath>
#include <set>
#include <queue>
#include <map>
#include <cstdio>
#include <cstring>
#include <string>
#include <stack>
#include <algorithm>
#include <limits.h>
#include <bits/stdc++.h>
#define fw(x) freopen("x.txt","w",stdout)
#define For(i,a,b,c) for(int i = a;i < b;i+=c)
#define REP(i,n) for(int i = 0;i < n;++i)
#define REP1(i,n) for(int i = 1; i<=n;i++)
#define mem(a,s) memset(a,s,sizeof a)
#define fast ios_base::sync_with_stdio(0);cin.tie(NULL)
#define pf printf
#define sc scanf
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define all(v) v.begin(),v.end()
#define vii vector<int>
#define vll vector<ll>
#define vss vector<string>
#define debug(x)  cout<<#x"="<<(x)<<endl
#define pb push_back


using namespace std;


// moves

//int dx[]= {0,0,1,-1};/*4 side move*/
//int dy[]= {-1,1,0,0};/*4 side move*/
//int dx[]= {1,1,0,-1,-1,-1,0,1};/*8 side move*/
//int dy[]= {0,1,1,1,0,-1,-1,-1};/*8 side move*/
//int dx[]={1,1,2,2,-1,-1,-2,-2};/*knight move*/
//int dy[]={2,-2,1,-1,2,-2,1,-1};/*knight move*/


//big_mod

//ll bigmod(ll a,ll b,ll m)
//{if(b == 0) return 1%m;ll x = bigmod(a,b/2,m);x = (x * x) % m;if(b % 2 == 1) x = (x * a)% m;return x;}
//ll BigMod(ll B,ll P,ll M){ ll R=1%M; while(P>0) {if(P%2==1){R=(R*B)%M;}P/=2;B=(B*B)%M;} return R;} /// (B^P)%M

//ll getBit(ll num, int idx) {return ((num >> idx) & 1ll) == 1ll;}
//ll setBit1(ll num, int idx) {return num or (1ll<<idx);}
//ll setBit0(ll num, int idx) {return num & ~(1ll<<idx);}
//ll flipBit(ll num, int idx) {return num ^ (1ll<<idx);}

const int mod = 1000000007;

    int cost[101];
    int wt[101];
    ll dp[101][100001];
int main()
{
    fast;
    int n, w;
    cin>>n>>w;
    REP1(i, n) cin>>wt[i]>>cost[i];
    REP1(i, n){
      REP1(j, w){
        if(j>=wt[i]) dp[i][j] = max(dp[i-1][j], dp[i-1][j-wt[i]] + cost[i]);
        else  dp[i][j] = dp[i-1][j];
      }
    }
    cout<<dp[n][w]<<'\n';
    return 0;
}


Measured memory_bytes: 81732
#!/usr/bin/python3
# -*- coding: utf-8 -*-
def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
N = 10**6
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )

x, y = map(int, input().split())
if (x + y) % 3 != 0:
    print(0)
else:
    n = (x + y) // 3
    print(cmb(n, x - n, mod))

Measured memory_bytes: 122068
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <stack>
#include <numeric>
#include <algorithm>
#include <tuple>
#include <stdio.h>
#include <bitset>
#include <limits.h>
#include <complex>
#include <deque>
#include <iomanip>
#include <list>
#include <cstring>
using namespace std;
#define pi pair<int,int>
#define pl pair<long long,long long>
#define chmax(a,b) (a<b ? a=b:0)
#define chmin(a,b) (a>b ? a=b:0)
#define en cout << endl //セミコロンつけろ
//#define MM 1000000000
//#define MOD MM+7
typedef long long ll;
const int MM = 1e9;
const int MOD = MM+7;
const long double PI = acos(-1);
const long long INF = 1e15;
int dx[8] = {-1,0,1,0,-1,-1,1,1};
int dy[8] = {0,-1,0,1,-1,1,1,-1};
// 'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122
template<typename T>
T GCD(T u,T v){
    return v ? GCD(v,u%v) : u;
}
template<typename T>
T LCM(T x,T y){
    T gc = GCD(x,y);
    return x*y/gc;
}
int main(){
    int a,b; cin >> a >> b;
    if (b == 1){
        cout << 0 << endl;
    } else {
        for (int i = 1; i < 20; i++){
            if ((a*i - i+1) >= b){
                cout << i << endl;
                return 0;
            }
        }
    }
}

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

typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> pll;
#define endl "\n";
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

ll const inf = 1e18;
ll const maxn = 1e6+5;
ll const mod = 1e9+7;

// code begins here

int main(){
    fast;

    ll n;
    cin>>n;
    
    vector<ll> arr(n);
    for(auto &u: arr)
        cin>>u;
    
    sort(arr.rbegin(), arr.rend());
    
    ll ans = arr[0], cur = 1, i = 2, flag = 0;
    
    while(i<n){
        ans += arr[cur];
        i++;
        flag++;
        if(flag==2){
            cur++;
            flag = 0;
        }
    }
    
    cout<<ans<<endl;

    return 0;
}


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

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

int main() {
  int H, W;
  cin >> H >> W;
  string lines[H];
  REP(i, H) cin >> lines[i];

  bool ignore_row[H] = {false};
  bool ignore_col[W] = {false};
  REP(h, H) {
    int d = count(ALL(lines[h]), '.');
    if (d == W) ignore_row[h] = true;
  }

  REP(w, W) {
    int d = 0;
    REP(h, H) {
      if (lines[h][w] == '.') d++;
      if (d == H) ignore_col[w] = true;
    }
  }

  REP(h, H) {
    if (ignore_row[h]) continue;
    REP(w, W) {
      if (!ignore_col[w]) cout << lines[h][w];
    }
    cout << endl;
  }

  return 0;
}


Measured memory_bytes: 256
S = input()
T = input()
R_s = [-1] * 26
R_t = [-1] * 26
ans = 'Yes'

for i in range(len(S)):
  tmpS = ord(S[i]) - 97
  tmpT = ord(T[i]) - 97
  if R_s[tmpS] < 0:
    R_s[tmpS] = tmpT
  elif R_s[tmpS] != tmpT:
    ans = 'No'
  
  if R_t[tmpT] < 0:
    R_t[tmpT] = tmpS
  elif R_t[tmpT] != tmpS:
    ans = 'No'

print(ans)

Measured memory_bytes: 3632
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define DUMP(x)  cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for(ll i = m; i < n; i++)
#define IFOR(i, m, n) for(ll i = n - 1; i >= m; i-- )
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define FOREACH(x,a) for(auto& (x) : (a) )
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) ll(x.size())

int main(){
  ll N,K; cin >> N >> K;
  string s; cin >> s;
  ll ans = 0;
  REP(i,N-1){
    if(s[i]==s[i+1]) ans++;
  }
  ans = min(ans+2*K,N-1);
  cout << ans << endl;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define arep(a,i,n) for(ll i=(a);i<(n);i++)
#define rep(i,n) for(ll i=0;i<(n);i++)
#define cinf(x,n) for(ll i=0;i<(n);i++)cin>>x[i];
#define coutf(x,n) for(ll i=0;i<(n);i++)cout<<x[i]<<endl;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

using namespace std;

int ans;

int main(){
	string s;
	cin >> s;
	if(s=="RRR")
		ans=3;
	else if(s.substr(0,2)=="RR"||s.substr(1,2)=="RR")
		ans=2;
	else if(s=="SSS")
		ans=0;
	else
		ans=1;
	cout << ans << endl;
}

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

using namespace std;
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
constexpr int MOD = 1000000007;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
constexpr int dx[] = {1, 0, -1, 0, 1, 1, -1, -1};
constexpr int dy[] = {0, -1, 0, 1, 1, -1, -1, 1};

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){os << "["; for (const auto &v : vec) {os << v << ","; } os << "]"; return os; }


int cnt(int n) {
    int ret = 0;
    for(int i = 1; i <= n; i++) {
        if (n % i == 0) {
            ret++;
        }
    }
    return ret;
}
void solve() {
    int N;
    cin >> N;
    int ans = 0;
    for (int i = 1; i <= N; i += 2) {
        if (cnt(i) == 8) ans++;
    }
    cout << ans << endl;
}

int main() {
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(16);
    solve();
    return 0;
}

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

int main() {
  int a,b;
  cin>>a>>b;
  vector<int> c(a);
  for(int i=0;i<a;i++){
    cin>>c.at(i);
  }
  int d=0;
  for(int i=0;i<a;i++){
    if(c.at(i)>=b){
      d++;
    }
  }
  cout<<d<<endl;
}

Measured memory_bytes: 640
//Catchharsh
#include<bits/stdc++.h>
#define ll  long long int 
#define ld long double
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define F first
#define S second
#define sz(x) x.size()
#define all(x) x.begin(),x.end()
#define pb push_back
#define endl '\n'
#define see(x) cout<<#x<<" = "<<x<<endl
const ll MOD = 1e9+7;
const ll INF = 1011111111;
// const ll LLINF = 1000111000111000111LL;
const ld EPS = 1e-10;
const ld PI = 3.14159265358979323;
using namespace std;
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
#define ordered_set tree< pair<ll,ll> , null_type,less<pair<ll,ll> >, rb_tree_tag,tree_order_statistics_node_update> 
inline ll add(ll a,ll b){a+=b;if(a>=MOD)a-=MOD;return a;}
inline ll sub(ll a,ll b){a-=b;if(a<0)a+=MOD;return a;}
inline ll mul(ll a,ll b){return (a*1ll*b)%MOD;}
ll power (ll base,ll exponent)
{
    ll ans=1;
    //base%=MOD;
    //exponent%=(MOD-1);
    while(exponent!=0)
    {
      if(exponent&1) ans=(1LL*ans*base);
      base=(1LL*base*base);
      exponent>>=1;
    }
    return ans;
}
int32_t main()
{   
     IOS;
     
     ll n,m,i,j,k;
     cin>>n;
     vector<ll> v(n);
     for(i=0;i<n;i++) cin>>v[i];
     ordered_set pre,suf;
     pre.insert({1+v[0],1});
     ll ans=0;
     for(i=1;i<n;i++)
     {
       ll val=i+1-v[i];
       ll lef,rr;
       lef=pre.order_of_key({val,INF});
       rr=pre.order_of_key({val,-INF});
       ans+=abs(lef-rr);
       // cout<<lef<<" "<<rr<<" "<<i<<endl;
       pre.insert({i+1+v[i],i+1});
     }
     suf.insert({n-v[n-1],i+1});
     for(i=n-2;i>=0;i--)
     {
       ll val=i+1+v[i];
        ll lef,rr;
        lef=suf.order_of_key({val,INF});
       rr=suf.order_of_key({val,-INF});
       ans+=abs(lef-rr);
       suf.insert({i+1-v[i],i+1});
     }
     ans/=2;
     cout<<ans;
     
     cerr <<endl<< "Time elapsed : " << clock() * 1000.0 / CLOCKS_PER_SEC << " ms" << '\n';             
}

Measured memory_bytes: 29884
#include <stdio.h>

int main()
{
    int m, f, r;
    while(1) {
        scanf("%d %d %d", &m, &f, &r);
        if(m==-1 && f==-1 && r==-1) break;
        if(m==-1||f==-1) puts("F");
        else if(m+f>=80) puts("A");
        else if(m+f>=65) puts("B");
        else if(m+f>=50) puts("C");
        else if(m+f<30) puts("F");
        else if(r>=50) puts("C");
        else puts("D");
    }
    return 0;
}

Measured memory_bytes: 584
#include <iostream>
#include <vector>
#include <cmath>
#include <ctime>
#include <cassert>
#include <cstdio>
#include <queue>
#include <set>
#include <map>
#include <fstream>
#include <cstdlib>
#include <string>
#include <cstring>
#include <algorithm>
#include <numeric>

#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)

using namespace std;

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;

template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.precision(10);
    cout << fixed;
#ifdef LOCAL_DEFINE
    freopen("input.txt", "rt", stdin);
#endif

    int n;
    cin >> n;
    vi64 a(n);
    forn(i, n) cin >> a[i];
    i64 S = accumulate(all(a), 0LL);
    i64 t = 1LL * n * (n + 1) / 2;
    if (S % t) {
        cout << "NO\n";
        return 0;
    }
    forn(i, n) a[i] -= (S / t) * (i + 1);
    bool ok = true;
    i64 z = 0;
    vi64 b(n);
//    b[0] = a[0];
    forn(i, n - 1) {
        i64 d = a[i] - a[i + 1];
        if (d < 0 || d % n) {
            ok = false;
            break;
        }
        i64 y = d / n;
//        cerr << d << ' ' << y << '\n';
        b[0] += y * (n - 1 - i);
        b[i + 1] += -y * n;
        z += d / n;
    }
    forn(i, n - 1) b[i + 1] += b[i];
    ok &= a == b;
//    ok &= z <= t;
    cout << (ok ? "YES" : "NO") << '\n';

#ifdef LOCAL_DEFINE
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
    return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
#include <tuple>
#define mkp make_pair
#define mkt make_tuple
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const ll MOD=1e9+7;

int N;
vector<int> X,Y;

const double PI=acos(-1.0);

int main(){
  cin>>N;
  X.resize(N);
  Y.resize(N);
  rep(i,N) cin>>X[i]>>Y[i];

  vector<int> v;
  for(int i=0;i<N;i++) v.push_back(i);

  double ans=1e9;
  do{
    int x=0,y=0;
    double vx=1,vy=0;
    double t=0.0;
    for(int i=0;i<N;i++){
      double nvx=X[v[i]]-x;
      double nvy=Y[v[i]]-y;

      double c=sqrt(nvx*nvx+nvy*nvy);
      nvx=nvx/c;
      nvy=nvy/c;

      double nai=vx*nvx+vy*nvy;
      double a=sqrt(vx*vx+vy*vy);
      double b=sqrt(nvx*nvx+nvy*nvy);
      a*=b;
      double res=(double)nai/a;
      res=acos(res);
      res*=180.0/PI;
      t+=res;
      x=X[v[i]];
      y=Y[v[i]];
      vx=nvx;
      vy=nvy;
    }
      double nvx=0-x;
      double nvy=0-y;

      double c=sqrt(nvx*nvx+nvy*nvy);
      nvx=nvx/c;
      nvy=nvy/c;

      double nai=vx*nvx+vy*nvy;
      double a=sqrt(vx*vx+vy*vy);
      double b=sqrt(nvx*nvx+nvy*nvy);
      a*=b;
      double res=(double)nai/a;
      res=acos(res);
      res*=180.0/PI;
      t+=res;
      ans=min(ans,t);

  }while(next_permutation(v.begin(),v.end()));

  cout<<fixed<<setprecision(10)<<ans<<endl;

  return 0;
}



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

const int MAX_N = 200000;

int N;
long long a[MAX_N + 1];

int main() {
  cin >> N;
  long long sum = 0;
  long long x = 0;
  for (int i = 0; i < N; i++) {
    cin >> a[i];
    sum += a[i];
  }
  long long ans = 100000000000000;
  for (int i = 0; i < N - 1; i++) {
    x += a[i];
    ans = min(ans, abs(sum - 2 * x));
  }
  cout << ans << endl;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
#define pii std::pair<int,int>
#define pli std::pair<ll,int>
#define pil std::pair<int,ll>
#define psi std::pair<string,int>
#define pll std::pair<ll,ll>
#define pci std::pair<char,int>
#define sll(x) scanf("%lld",&x)
#define prll(x) printf("%lld ",x)
#define pri(x) printf("%d ",x)
#define si(x) scanf("%d",&x)
#define pb push_back
#define vll std::vector<ll>
#define vpi std::vector<std::pair<int,int>>
#define vi std::vector<int>
#define vvi std::vector<std::vector<int>>
#define vvpil std::vector<std::vector<std::pair<int,ll>>>
#define vlpii std::vector<std::list<pii>>
#define vlpil std::vector<std::list<pil>>
#define li std::list<int>
#define lpil std::list<pil>
#define Endl printf("\n")
#define vli vector<list<int>>
#define vvll vector<vector<ll>>
#define mp make_pair
#define x first
#define y second
#define ull uint64_t
#define ma 100000000
#define imie(...) "[" << #__VA_ARGS__": " << (__VA_ARGS__) << "] "
const ll  INF=10000000000000;
const ll mod =  1e9 + 7;
using namespace std;
void add(ll& a , ll b){
	a += b;
	if(a >= mod) a -= mod;
}
ll mul(ll a , ll b){
	return (a * b) % mod;
}
ll Pow(ll a , ll b){
	if(b == 0) return 1 ;
	ll c = Pow(a , b / 2) ;
	if(b % 2) return (a * ((c * c)% mod )) % mod ;
	return (c * c) % mod ;
}
vll fact(2001 , 1) ;
ll C(ll x , ll y){
		if(y > x) return 0 ;
		return mul(fact[x] , Pow(mul(fact[x - y] , fact[y]) , mod - 2)) ;
}

//check modulo
int main(){
	IOS;
	cout.precision(30) ;
	for(int i = 2 ; i <= 2000 ; i++) fact[i] = mul(fact[i - 1] , i) ;
	int n , k ; cin >> n >> k ;
	for(int i = 1 ; i <= k ; i++){
		cout << mul(C(n - k + 1 , i) , C(k - 1 , i - 1)) << "\n" ;
	}
	
		
	return 0;
}


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

int main(){
  string s; cin >> s;
  bool ok = false;
  rep(i,3){
    if(s[i] == s[i+1]){
      ok = true;
      break;
    }
  }
  ok ? puts("Bad") : puts("Good");
  return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int a =sc.nextInt();
    int b =sc.nextInt();
    int answer = Math.max(a*b,a+b);
    System.out.println(Math.max(answer,a-b));
  }
}

Measured memory_bytes: 21716
import sys

nums = []


for line in sys.stdin:
    nums.append(line)

for i in range(len(nums)):
    input_line = nums[i].split(" ")
    a = float(input_line[0])
    b = float(input_line[1])
    c = float(input_line[2])
    d = float(input_line[3])
    e = float(input_line[4])
    f = float(input_line[5])

    x = (f * b - e * c)/(b * d - a * e)
    y = (c - a * x)/b

    
    print("{:.3f} {:.3f}".format(x+0,y+0))
    

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

int main(){
  int N;
  int t[110000], x[110000], y[110000];
  cin >> N;
  t[0] = x[0] = y[0] = 0;
  for (int i=0; i<N; ++i)
    cin >> t[i+1] >> x[i+1] >> y[i+1]; //1-indexにしておく
  
  bool can = true;
  for (int i=0; i<N; ++i){
    int dt = t[i+1] - t[i];
    int dist = abs(x[i+1] - x[i]) + abs(y[i+1] - y[i]);
    if (dt < dist)
      can = false;
    if (dist % 2 != dt % 2)
      can = false; //distとdtの偶奇は一致する必要あり
  }
  
  if (can)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}




Measured memory_bytes: 1408
#include <iostream>
#include <bitset>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <math.h>
#include <iomanip>
typedef long long ll;
using namespace std;
#define all(v) v.begin(), v.end()
#define pb push_back
#define ff first
#define ss second
#define fori(n) for (int i = 0; i < n; i++)
#define forj(n) for (int j = 0; j < n; j++)

#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,popcnt,abm,mmx,tune=native")
#pragma GCC optimize("fast-math")
#pragma GCC optimize "-O3"
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    string s;
    cin >> s;
    int n = s.size() + 1;
    vector < int > mx;
    mx.resize(n);
    fori(s.size()) {
        if (s[i] == '<') mx[i + 1] = max(mx[i + 1], 1 + mx[i]);
    }
    for (int i = s.size() - 1; i >= 0; i--) {
        if (s[i] == '>') mx[i] = max(mx[i], mx[i + 1] + 1);
    }
    ll sum = 0;
    fori(mx.size()) sum += mx[i];
    cout << sum;
}

/*

*/


Measured memory_bytes: 2844
#include <bits/stdc++.h>
#define INF 1e18
#define int long long
#define Rep(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) Rep(i, 0, n)
#define all(a) (a).begin(), (a).end()
using namespace std;
typedef pair<int, int> P;
typedef pair<int, P> PP;
const int mod = 1000000007;
//const int mod = 998244353;

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

    string s;
    cin >> s;
    int ans = INF;
    for (int i = 0; i < 26; i++)
    {
        char c = 'a' + i;
        string t = s;
        while (1)
        {
            bool f = true;
            rep(j, t.size()) if (t[j] != c) f = false;
            if (f)
                break;
            string nt = "";
            if (t.size() == 0)
                break;
            rep(j, t.size() - 1)
            {
                if (t[j] == c || t[j + 1] == c)
                    nt += c;
                else
                    nt += '+';
            }
            t = nt;
        }
        int cnt = s.size() - t.size();
        ans = min(ans, cnt);
    }
    cout << ans << endl;
}


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

void solve(){
  int n; cin >> n;
  int maxs = 0, ans = 1;
  for(int i = 1; i <= n; i++){
    int x = i, sum = 0;
    while(x % 2 == 0){
      x /= 2;
      sum++;
    }
    if(sum > maxs){
      maxs = sum;
      ans = i;
    }
  }
  cout << ans << endl;
  return;
}

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


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

#define ll long long
#define NIL 0
#define INF 1e18
#define vi vector<int> 
#define vvi vector<vector<int>> 
#define vl vector<ll>
#define vvl vector<vector<ll>> 
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define pb push_back
#define F first
#define S second
#define pp pair<int,int> 
#define mp make_pair
#define rep(i,n) for(int i=0;i<n;i++)
#define rpk(i,k,n) for(int i=k;i<n;i++)
#define REP(i,n) for(int i=1;i<=n;i++) 
#define RPK(i,k,n) for(int i=k;i<=n;i++) 
#define ritr(i,gr) for(auto i=gr.begin();i!=gr.end();i++)

const int M = 1e9+7;

int V, E, i, j, k, u, v, x, y, p, q, r, t, n,w;
vi *g;
vb sn;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin>>n>>w;
    ll wt[n], val[n], dp[n+1][w+1];
    rep(i,n) cin>>wt[i]>>val[i];
    
    rep(i,w+1) dp[0][i] = 0;
    rep(i,n+1) dp[i][0] = 0;
    
    REP(i,n) {
        REP(j,w) {
            if(wt[i-1]<=j) {
                dp[i][j] = max(dp[i-1][j-wt[i-1]]+val[i-1], dp[i-1][j]);
            }
            else dp[i][j] = dp[i-1][j];
        }
    }
    
    cout<<dp[n][w]<<endl;
    
}
    
    
    

Measured memory_bytes: 82476
#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 debug=0;

int main(){
    int n,k,c;
    cin >> n >> k >> c;
    string s;
    cin >> s;
    auto getPositions = [&](){
        vector<int> res;
        for(int i =0 ; i< n && res.size() < k;){
            if(s[i] == 'o'){
                res.push_back(i);
                // if(debug) cout << "pb..." << i << endl;
                i += c+1;
            }else{
                ++i;
            }
        }
        return res;
    };
    vector<int> l,r;
    l = getPositions();
    reverse(s.begin(),s.end());
    r = getPositions();
    /*if(debug){
        for(auto x:r) cout << x << " ";
        cout << endl;
    } */
    rep(i,k) r[i]= n-1 -r[i];
    reverse(s.begin(),s.end());
    /*
    if(debug){
        for(auto x:r) cout << x << " ";
        cout << endl;
    }*/
    if(debug){
        for(auto x:l) cout << x << " ";
        cout << endl;
    }
    vector<int> lastL(n+1,-1);
    rep(i,k) lastL[l[i]+1] =i;
    if(debug){
        for(auto x:lastL)
            cout << x << " ";
        cout << endl;
    }
    rep(i,n){
        if(lastL[i+1] == -1) lastL[i+1] = lastL[i];
    }
    if(debug){
        for(auto x:lastL)
            cout << x << " ";
        cout << endl;
    }

    vector<int> lastR(n+1,-1);
    rep(i,k)lastR[r[i]] = i;
    if(debug){
        for(auto x:lastR)
            cout << x << " ";
        cout << endl;
    }
    for( int i = n-1 ; i>=0; --i){
        if(lastR[i] == -1) lastR[i] = lastR[i+1];
    }
    if(debug){
        for(auto x:lastR)
            cout << x << " ";
        cout << endl;
    }

    rep(i,n){
        if(s[i]=='x')continue;
        int li = lastL[i];
        int ri = lastR[i+1];
        int cnt = 0;
        if( li != -1) cnt+= li+1;
        if(ri != -1) cnt+= ri+1;
        if( li != -1 && ri != -1 && r[ri]-l[li] <=c ){
            --cnt;
        }
        if( cnt >=k )continue;
        printf("%d\n",i+1);
    }

    /*
    if(debug){
        l = getPositions();
        for(auto x:l)
            cout << x << " ";
        cout << endl;
    }
    */

    return 0;

}

Measured memory_bytes: 4984
#define rep(i, n) for (int i = 0; i < (n); i++)
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int MOD = 1000000007;
// MAX int 2,147,483,647 -> 10桁
// MAX ll 9,223,372,036,854,775,807 -> 19桁
// MAX O(n) 10^8 -> 8回
// double pi = M_PI or acos(-1)
// printf("%.10f\n", ans);

int main() {
    int n;
    cin >> n;
    vector<int> x(n), y(n);
    rep(i, n) cin >> x[i] >> y[i];
    auto dist = [&](int i, int j) {
        double dx = x[i] - x[j];
        double dy = y[i] - y[j];
        return sqrt(dx * dx + dy * dy);
    };
    double len = 0;
    rep(i, n) rep(j, i) {
        len += dist(i, j);
    }
    int num = 2;
    for (int i = n - 1; i >= 1; --i) num *= i;
    int fact = 1;
    for (int i = n; i >= 1; --i) fact *= i;
    double ans = (len * num) / fact;
    printf("%.10f\n", ans);

    return 0;
}


Measured memory_bytes: 3796
import math

n = input()

digits = len(n)
count = 0


def even_count(d):
    c = 0
    for i in range(0, int(d), +2):
        c += math.pow(10, i)
    return c * 9


if digits % 2 == 0:
    count += even_count(digits)
else:
    if digits - 1 != 0:
        count += even_count(digits - 1)
    count += int(n) - math.pow(10, digits - 1) + 1

print(int(count))

Measured memory_bytes: 3064
/*
--------------              |   /
      |                     |  /
      |                     | /
      |             *       |/          |    |         ------            *
      |                     |           |    |        /      \
      |             |       |\          |    |       |       |\          |
   \  |             |       | \         |    |       |       | \         |
    \ |             |       |  \        |    |        \     /   \        |
     V              |       |   \        \__/|         -----     \       |
*/
#include <bits/stdc++.h>
using namespace std;

#define EmiliaMyWife ios::sync_with_stdio(0); cin.tie(NULL);
#define mem(i,j) memset(i,j,sizeof (i));
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(), (a).end()
#define lowbit(x) ((x)&(-(x)))
#define siz(v) (long long)(v).size()
typedef int64_t ll;
typedef uint64_t ull;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
const double EPS  = 1e-8;
const int INF     = 0x3F3F3F3F;
const ll LINF     = 4611686018427387903;
const int MOD     = 1e9+7;
const int MAXN    = 2e5+9;
/*-----------------------------------------------------------------------------------------------------*/

signed main() {
	EmiliaMyWife

	int k, a, b;
	cin >> k >> a >>b;
	if((a/k+!!(a%k))*k >= a && (a/k+!!(a%k))*k <= b)
		cout << "OK";
	else cout << "NG";

	return 0;
}


Measured memory_bytes: 3608
#include<stdio.h>
#include<math.h>
int sosuu(int);
#define N 10000
int main(){
  int i,j,hantei,count=0,x,a[N];
  scanf("%d",&x);
  for(i=0;i<x;i++){
    scanf("%d",&a[i]);
    hantei=sosuu(a[i]);
    count=count+hantei;
  }
  printf("%d\n",count);
  return 0;
}
int sosuu(int x){
  int i=3;
  if(x==2)return 1;
  if(x<2 || x%2==0)return 0;
  while(i<=sqrt(x)){
    if(x%i==0)return 0;
    i=i+2;
  }
  return 1;
}
		    
		    
  
      



Measured memory_bytes: 2072
# index
# 0,1   : initial value
# 2     : answer
# 3     : 0
# 4-34  : 1, 2, 4, ..., 2^30
# 35-66 : 0, 1, 3, 7, ..., 2^31-1
# 67-98 : binary representation of A
# 99-130: binary representation of B
# 131-  : workspace

def test(ans):
    arr = [67, 20] + [0] * 300

    for s in ans:
        dbg = False
        if s[-1] == '*':
            s = s[:-1]
            dbg = True
        op, i, j, k = s.split()
        i = int(i)
        j = int(j)
        k = int(k)
        if op == '<':
            arr[k] = int(arr[i] < arr[j])
        elif op == '+':
            arr[k] = arr[i] + arr[j]
        else:
            raise NotImplementedError
        if dbg:
            print(s, arr[i], arr[j], arr[k])
    print(arr)
    return arr


ans = []
ans.append('< 3 0 4')
for i in range(4, 34):
    ans.append('+ {} {} {}'.format(i, i, i + 1))
ans.append('+ 3 4 36')
for i in range(30):
    ans.append('+ {} {} {}'.format(i + 5, i + 36, i + 37))


# 130: current sum
# 131: temporary sum for comparison
# 132: > result

def binary_convert(target, offset):
    for d in range(31, -1, -1):
        ans.append(f'+ {d + 35} 130 131')
        ans.append(f'< 131 {target} 132')
        ans.append(f'+ 3 132 {d + offset}')
        ans.extend(['+ 132 132 132'] * d)
        ans.append('+ 130 132 130')


binary_convert(0, 67)
binary_convert(1, 99)

# Ad,Bd: focused bit
# 130: Ad + Bd

for di in range(30):
    i = di + 67
    for dj in range(30):
        j = dj + 99
        ans.append(f'+ {i} {j} 130')
        ans.append('< 4 130 130')
        ans.extend(['+ 130 130 130'] * (di + dj))
        ans.append('+ 2 130 2')

# arr = test(ans)

print(len(ans))
print('\n'.join(ans))


Measured memory_bytes: 10060
#include<bits/stdc++.h>
#define ll long long
#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))
#define swap(x,y) (x^=y^=x^=y)
inline int read()
{
	int x=0,f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=(x<<3)+(x<<1)+ch-'0';ch=getchar();}
	return x*f;
}
#define MN 100005 
int n,m,a[MN],b[MN],c[MN];
int t[MN<<1];
void C(int x){for(;x<MN*2;x+=(x&-x))t[x]++;}
int G(int x){int res=0;for(;x;x-=(x&-x))res+=t[x];return res;}
inline bool check(int x)
{
	ll cnt=0ll;
	register int i;
	for(i=1;i<=n;++i) c[i]=c[i-1]+(a[i]>=x?1:-1);
	memset(t,0,sizeof t);
	for(i=1;i<=n;++i)
	{
		C(c[i-1]+MN);
		cnt+=G(c[i]+MN);
	}
	return cnt*4>=1ll*n*(n+1);
}
int main()
{
	n=read();register int i;
	for(i=1;i<=n;++i) a[i]=b[i]=read();
	std::sort(b+1,b+n+1);
	m=std::unique(b+1,b+n+1)-b-1;
	int l,r,ans;
	for(l=1,r=m,ans=0;l<=r;)
	{
		int mid=l+r>>1;
		if(check(b[mid])) ans=mid,l=mid+1;
		else r=mid-1;
	}
	printf("%d\n",b[ans]);
}

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

#define reint register int
#define coint const int

using namespace std;

typedef pair<int, int> pii;

coint SIZE = 100000 + 5;

struct Edge { int v, head; };

int  ecnt, head[SIZE];
Edge edge[SIZE];

inline void addEdge(coint u, coint v) {
    edge[++ecnt] = (Edge) {v, head[u]}, head[u] = ecnt;
    return;
}

inline int getint(void) {
    reint x = 0, ch = getchar();
    for (; ch < '0' || ch > '9'; ch = getchar());
    for (; ch >= '0' && ch <= '9';
            x = (x << 1) + (x << 3) + (ch - '0'), ch = getchar());
    return x;
}

inline pii mkp(coint a, coint b) { return make_pair(a, b); }

queue<pii> que;
int dis[3][SIZE];

inline int mod(coint num) { return num >= 3 ? num - 3 : num; }

void bfs(coint st) {
    for (; !que.empty(); que.pop());
    memset(dis, -1, sizeof dis);
    dis[0][st] = 0, que.push(mkp(0, st));

    while (!que.empty()) {
        coint x = que.front().first, y = que.front().second;
        que.pop();

        for (reint i = head[y]; ~i; i = edge[i].head) {
            coint nx = mod(x + 1), v = edge[i].v;
            if (~dis[nx][v]) continue;
            dis[nx][v] = dis[x][y] + 1, que.push(mkp(nx, v));
        }
    }

    return;
}

int main(void) {
    ecnt = 0, memset(head, -1, sizeof head);

    getint();
    coint m = getint();
    for (reint i = 1; i <= m; ++i) {
        coint u = getint(), v = getint();
        addEdge(u, v);
    }
    coint st = getint(), ed = getint();

    bfs(st), printf("%d\n", ~dis[0][ed] ? dis[0][ed] / 3 : -1);

    return 0;
}



Measured memory_bytes: 2944
#include <bits/stdc++.h>
#define ff first
#define ss second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define pii pair<int, int>
#define pll pair<long long,long long>
#define vl vector<long long>
#define vll vector<pll>
#define vi vector<int>
#define vii vector<pii>
#define sws ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl '\n'
#define tcase int tt; cin>>tt; while(tt--)
#define tcase2 int tt; cin>>tt; for(int qq=1;qq<=tt;qq++)
using namespace std;
typedef long long int ll;
typedef  unsigned long long int ull;
typedef long double ld;
const int MAXN = 1000002;
const int MOD2 = 998244353;
const int MOD = 1000000007; 
const int INF = 1e8;
const ld EPS = 1e-7;
// Extra
#define forn(i, n) for(int i = 0; i < (int)n; i++)
#define forne(i, a, b) for(int i = a; i <= b; i++)
#define all(x) x.begin(), x.end()
#define trav(a, x) for(auto& a : x)
#define fill(x,y) memset(x,y,sizeof(x))
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
ll mul(ll x, ll y)
{
    return (x * 1ll * y) % MOD2;
}

ll fastpow(ll x, ll y)
{
    ll z = 1;
    while(y)
    {
        if(y & 1) z = mul(z, x);
        x = mul(x, x);
        y >>= 1;
    }
    return z;
}
struct Comp {
  bool operator()(const std::pair<int, int> &a, const std::pair<int, int> &b) {
    if (a.first != b.first) {
      return a.first > b.first;
    }
    return a.second >b.second;
  }
};
int main(int argc, char** argv)
{   sws ;
   // tcase
    {
    ll n ;
    cin>>n ;
    string s ;
    cin>>s ;
    ll r=0,w=0 ;
    forn(i,n)
    {
    	if(s[i]=='R')
    	r++ ;
    	else
    	w++;
	}
	ll k=0 ;
	ll t=0 ;
	forn(i,n)
	{
		if(s[i]=='W')
		{
			k++ ;
			t++ ;
		}
		else 
		{
			t++;
		}
		if(t==r)
		break ;
	}
	cout<<min(r,(min(w,k)));
    }
return 0 ;
}

Measured memory_bytes: 3700
#include<stdio.h>
#include<iostream>
#include<cstring>
#include<iomanip>
#include<stack>
#include<queue>
#include<cmath>
#include<algorithm>
using namespace std;
typedef long long ll;
//const int maxn=;
int n,h,w,ans; 
int main(){
	//freopen("","r",stdin);
	//freopen("","w",stdout);
	cin>>n>>h>>w;
	if(h>n||w>n){
		cout<<0<<endl;
	}
	else{
		ans=(n-h+1)*(n-w+1);
		cout<<ans<<endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
long long n;
cin>>n;
long long t=0,m=100,i=0;
if(t+m>=n)
    cout<<i;
else
while(1){
    t=m/100;
    i++;
    if(t+m>=n){
       cout<<i;
       break;
    }
    m+=t;
}


}


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

#define int long long
#define double long double
#define ff first
#define ss second
#define endl '\n'
#define ii pair<int, int>
#define mp make_pair
#define mt make_tuple
#define DESYNC ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define pb push_back
#define vi vector<int>
#define vii vector< ii >
#define EPS 1e-9
#define INF 1e18
#define ROOT 1
#define M 1000000007
const double PI = acos(-1);

using namespace std;

inline int mod(int n, int m){ int ret = n%m; if(ret < 0) ret += m; return ret; }

int gcd(int a, int b){
  if(a == 0) return b;
  else return gcd(b%a, a);
}

/* Z-function */
/* Calculate the size K of the largest substring which is a prefix */

struct ZFunction{

  vector<int> z;
  
  ZFunction() {}
  
  void calculate(string t){
    int n = t.size();
    z.resize(n);
    z[0] = 0;
    int l = 0, r = 0;
    for(int i=1; i<n; i++){
      if(i > r){
        l = i;
        r = i;
      }
      z[i] = min(z[i-l], r-i+1);
      while(i + z[i] < n && t[i + z[i]] == t[z[i]]) z[i]++;
      if(i + z[i] > r){
        l = i;
        r = i + z[i]-1;
      }
    }
  }
  
};

vector<int> g[2123456];
bool mrk[2123456];
int vis[2123456];
bool cycle;
int w;

void go(int u, int p){
  vis[u] = 1;
  w++;
  for(int v : g[u]){
    if(v == p) continue;
    if(vis[v]) cycle = true;
    else if(vis[v] == 0) go(v, u);
  }
}

int32_t main(){
  DESYNC;
  string s,t;
  cin >> s >> t;
  string z = s;
  while(z.size() < t.size()) z += z;
  s = z;
  z = t + "#" + z + z;
  //cout << z << endl;
  ZFunction zeta;
  zeta.calculate(z);
  int cnt = 0;
  int cur = t.size()+1;
  
  for(int i=0; i<s.size(); i++){
    if(zeta.z[i+cur] == t.size()){
      mrk[i] = true;
      //cout << "mark " << i << endl;
    }
  }
  
  for(int i=0; i<s.size(); i++){
    if(mrk[i] and mrk[(i+t.size())%(int)(s.size())]){
      g[i].pb((i+t.size())%(int)(s.size()));
      g[(i+t.size())%(int)(s.size())].pb(i);
      //cout << "edge" << endl;
      //cout << i << " " << (i+t.size())%(int)(s.size()) << endl;
    }
  }
  cycle = false;  
  int walk = 0;
  for(int i=0; i<s.size(); i++){
    if(vis[i] == 0 and mrk[i]){
      w = 0;
      go(i, -1);
      walk = max(w, walk);
    }
  }
  if(cycle) cout << -1 << endl;
  else cout << walk << endl;
}



Measured memory_bytes: 138600
import sys, re
from math import ceil, floor, sqrt, pi, factorial, gcd
from copy import deepcopy
from collections import Counter, deque
from heapq import heapify, heappop, heappush
from itertools import accumulate, product, combinations, combinations_with_replacement
from bisect import bisect, bisect_left, bisect_right
from functools import reduce
from decimal import Decimal, getcontext
# input = sys.stdin.readline 
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_str(N): return [s_list() for _ in range(N)]
def s_row_list(N): return [list(s_input()) for _ in range(N)]
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 6)
INF = float('inf')
MOD = 10 ** 9 + 7
num_list = []
str_list = []

def main():
    n = i_input()

    if n % 2 == 0:
        print(n)
    else:
        print(2*n)

if __name__ == '__main__':
    main()


Measured memory_bytes: 77156
/** 
 *  Author : Parth Prajapati
 * 	Institute : Pandit Deendayal Petroleum University
**/
#include<bits/stdc++.h>

using namespace std; 

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n,k;
    cin>>n>>k;
    if(n%k) cout<<1;
    else    cout<<0;
    return 0;
}

Measured memory_bytes: 256
N = gets.to_i
B = gets.chomp.split.map(&:to_i)

ans = []
found = false
N.times do |i|
  found = false
  (B.length - 1).downto(0) do |i|
    if B[i] == i + 1
      found = true
      ans.unshift(B.delete_at(i))
      break
    end
  end
  break if not found
end

if found
  ans.each do |item|
    puts item
  end
else
  puts -1
end

Measured memory_bytes: 1788
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,sum=0;
    cin >> n;
    int w[n];
    for(int i=0;i<n;i++){
        cin >> w[i];
        sum += w[i];
    }
    int mini = sum;
    int sum2 = 0;
    for(int i=0;i<n;i++){
        sum2 += w[i];
        mini = min(mini,abs(sum2 - (sum - sum2)));
    }
    cout << mini << endl;
    return 0;
}

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


int main()
{
    int n;
    cin >> n;
    int c0 = 0, c1 = 0, c2 = 0, c3 = 0;

    for (int i = 0; i < n; i++)
    {
        string s;
        cin >> s;
        if (s == "AC")
            c0++;
        else if (s == "WA")
            c1++;
        else if (s == "TLE")
            c2++;
        else
            c3++;

    }

    cout << "AC x " << c0 << endl
         << "WA x " << c1 << endl
         << "TLE x " << c2 << endl
         << "RE x " << c3 << endl;

    return 0;
}

Measured memory_bytes: 3532
#include <algorithm>
#include <functional>
#include <iostream>
#include <numeric>
#include <queue>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

using ll = long long;
using ull = unsigned long long;

using vll = vector<ll>;

void solve();

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

  solve();

  return 0;
}

#define ini(...)   \
  int __VA_ARGS__; \
  in(__VA_ARGS__)

#define ins(...)      \
  string __VA_ARGS__; \
  in(__VA_ARGS__);

void in() {}
template <typename T, class... U>
void in(T& t, U&... u) {
  cin >> t;
  in(u...);
}

void out() {
  cout << endl;
}
template <typename T, class... U>
void out(const T& t, const U&... u) {
  cout << t;
  if (sizeof...(u))
    cout << " ";
  out(u...);
}

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

void solve();
#ifndef ONLINE_JUDGE
#include "./lib.hpp"
#endif

void solve() {
  ini(N, A, B);
  vll h(N);
  rep(i, N) cin >> h[i];

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

  ll left = 0;
  ll right = (h.back() + B - 1) / B;

  ll C = A - B;
  for (;;) {
    ll mid = (left + right + 1) / 2;
    if (left + 1 == right) {
      out(right);
      return;
    }

    ll over = 0;
    rep(i, N) {
      if (h[i] > B * mid)
        over += (h[i] - B * mid + C - 1) / C;
    }

    if (over <= mid) {
      right = mid;
    } else {
      left = mid;
    }
  }
}


Measured memory_bytes: 3948
#include <iostream>
#include <string>
using namespace std;
string s, mx = "";
int main() {
  cin >> s;
  for (int i = 0; i < s.size(); i++) {
    string t = "";
    for (int j = i; j < s.size(); j++) {
      if (s[j] == 'A' || s[j] == 'G' || s[j] == 'C' || s[j] == 'T') {
        t.push_back(s[j]);
      } else {
        break;
      }
    }
    if (t.size() > mx.size()) {
      mx = t;
    }
  }
  cout << mx.size() << '\n';
  return 0;
}

Measured memory_bytes: 256
seiseki=Array.new()
while true do
mp=gets.split(' ').map(&:to_i)
if mp[0]==-1 && mp[1]==-1 && mp[2]==-1 then
   break
end
   if mp[0]==-1 || mp[1]==-1 then
   seiseki.push('F')
   elsif mp[0]+mp[1]>=80 then
   seiseki.push('A')
   elsif mp[0]+mp[1]>=65 then
   seiseki.push('B')
   elsif mp[0]+mp[1]>=50 || mp[2]>=50 then
   seiseki.push('C')
   elsif mp[0]+mp[1]>=30 then
   seiseki.push('D')
   else
   seiseki.push('F')
end
end

seiseki.each{|s|
   printf("%s\n",s)
}

Measured memory_bytes: 8668
#include<iostream>
using namespace std;
// Problem https://atcoder.jp/contests/agc025/tasks/agc025_a

int sumDigit(int N){
    int result=0;
    while(N>0){
        int edigit;
        edigit=N%10;
        result = result + edigit;
        N=N/10;
    }
    return result;
}
int solve(int N){
    int result=100000000;
 //   for(int j=2;j<=N-2;j++){
     for(int j=1;j<N;j++){
        int A,B,abSum;
        A = j;
        B = N - j;
        abSum = sumDigit(A) + sumDigit(B);
        if(abSum < result){
            result = abSum;
        }
    }
    return result;
}
int main(void){
    int N;
    int answer;
    cin >> N;
    answer = solve(N);
    cout << answer << endl;
}


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

int a[100000];
int main() {
  ios::sync_with_stdio(0); cin.tie(0);
  int n;
  cin >> n;
  pair<int,int> mi(1e9,0),ma(-1e9,0);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    pair<int,int> p(a[i],i);
    mi = min(mi, p);
    ma = max(ma, p);
  }
  ll ans = ma.first-mi.first;
  vector<pair<int,int>> path;
  for (int i = 0; i < n; i++) {
    if (i == mi.second || i == ma.second) continue;
    ans += abs(a[i]);
    if (a[i] > 0) {
      path.emplace_back(mi.first, a[i]);
      mi.first -= a[i];
    } else {
      path.emplace_back(ma.first, a[i]);
      ma.first -= a[i];
    }
  }
  path.emplace_back(ma.first, mi.first);
  cout << ans << endl;
  for (auto p : path)
    cout << p.first << ' ' << p.second << endl;
}


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

int H, W;
vector<vector<bool>> field;
vector<vector<int>> dist;
vector<int> dy = {-1, 0, 1, 0};
vector<int> dx = {0, 1, 0, -1};
void init()
{
  field.resize(H + 2, vector<bool>(W + 2, false));
  dist.resize(H + 1, vector<int>(W + 1, 0));
}

int bfs()
{
  queue<pair<int, int>> que;
  dist.at(1).at(1) = 1;
  que.push(make_pair(1, 1));
  int cur_y, cur_x;
  while (!que.empty())
  {
    tie(cur_y, cur_x) = que.front();
    que.pop();
    int ny, nx;
    for (int direction = 0; direction < 4; direction++)
    {
      ny = cur_y + dy.at(direction);
      nx = cur_x + dx.at(direction);
      if (field.at(ny).at(nx) && dist.at(ny).at(nx) == 0)
      {
        dist.at(ny).at(nx) = dist.at(cur_y).at(cur_x) + 1;
        que.push(make_pair(ny, nx));
      }
    }
  }
  return dist.at(H).at(W);
}

int main()
{
  cin >> H >> W;
  init();
  int cnt = 0;
  char c;
  for (int y = 1; y <= H; y++)
  {
    for (int x = 1; x <= W; x++)
    {
      cin >> c;
      if (c == '.')
      {
        field.at(y).at(x) = true;
        cnt++;
      }
    }
  }
  int res = bfs();
  if (res == 0)
  {
    cout << -1 << endl;
  }
  else
  {
    cout << cnt - res << endl;
  }
}

Measured memory_bytes: 256