akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

#define rep(i, n) REP(i, 0, n)
#define REP(i, a, n) for(int i=(a); i<(n); i++)

int N;
int p[100][3];

int main() {
	cin >> N;
	int k = 0;
	rep(i, N) {
	    cin>> p[i][0] >> p[i][1] >> p[i][2];
	    if(p[i][2] > 0) k = i;
	}
	rep(cx, 101) rep(cy, 101) {
	    int h = p[k][2]+abs(p[k][0]-cx)+abs(p[k][1]-cy);
	    rep(i, N) {
	        if(p[i][2] != max(h-abs(p[i][0]-cx)-abs(p[i][1]-cy), 0)) {
	            h = -1;
	            break;
	        }
	    }
	    if(h > 0) {
	        cout << cx << " " << cy << " " << h << endl;
	        return 0;
	    }
	}
}


Measured memory_bytes: 256
n, m = map(int, input().split())

dic = {}
for i in range(1, n+1):
  dic[i] = []
for i in range(m):
  a1, a2 = map(int, input().split())
  dic[a1] += [a2]
  dic[a2] += [a1]

def next_position(position, history, dic):
  next_you_can_move = list(set(dic[position]) - set(history))
  return next_you_can_move

def serch(position, history, dic):
  counter = 0
  if len(history) == n:
    return 1
  else:
    next_you_can_move = next_position(position, history, dic)
    if next_you_can_move == []:
      return 0
    for cand in next_you_can_move:
      new_history = history + [cand]
      counter += serch(cand, new_history, dic)
    return counter
count = serch(1, [1], dic)
print(count)

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

int main() {
  int num[4];
  for(int i = 0; i < 4; i++) {
    char c;
    cin >> c;
    num[i] = c - '0';
  }
  for(int i = 0; i < 8; i++) {
    char str[10] = "0+0+0+0=7";
    int x = num[0];
    str[0] += num[0];
    for(int j = 0; j < 3; j++) {
      if ((i & (1 << j)) != 0) {
	x += num[j + 1];
	str[1 + j * 2] = '+';
      } else {
	x -= num[j + 1];
	str[1 + j * 2] = '-';
      }
      str[2 + j * 2] += num[j + 1];
    }
    if (x == 7) {
      cout << str;
      return 0;
    }
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<n;i++)
typedef priority_queue <int> pi;
typedef priority_queue <int, vector<int>, greater<int>> pg;
typedef unsigned long long int ulli;

int main()
{
    int N;
    cin >> N;
    int ans;
    ans = N / 3;
    if(N - 3 * ans > 3) ++ans;
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,s,n) for(int i=s;i<n;i++)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define int long long
using namespace std;
using P=pair<int,int>;
using Graph=vector<vector<int>>;
using ll=long long;

string IntTo26(int n,bool small){
    string ans="";
    char key;
    if(small){
        key='a';
    }else{
        key='A';
    }
    while(n>0){
        n--;
        int r=n%26;
        ans+=key+r;
        n/=26;
    }

    reverse(all(ans));
    return ans;
}

signed main(){ 
    int n; cin>>n;

    vector<int> a(n);
    for(int i=0;i<n;i++) cin>>a[i];

    int X=0;

    for(int i=0;i<n;i++){
        X=X^a[i];
    }

    vector<int> ans(n);

    for(int i=0;i<n;i++){
        if(i!=0) cout<<" ";
        cout<<(X^a[i]);
    }
    cout<<endl;
}  

Measured memory_bytes: 6336
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <cmath>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <iostream>
#include <random>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include <fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <bitset>
using namespace std;

using ll = long long;
using vll = vector<ll>;
using pll = pair<ll, ll>;
using qll = queue<ll>;
using vb = vector<bool>;
using mll = map<ll, ll>;
using sll = stack<ll>;
#define REP(i,n) for(ll i(0);(i)<(n);(i)++)
#define rep(i,n) for(ll i(0);(i)<(n);(i)++)
#define ALL(a) a.begin(), a.end()
#define enld endl //* missspell check
const ll INF = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }

void solve(long long N, std::vector<long long> A){
    map<ll, ll> CNT;
    set<ll> R;
    set<ll> Test(ALL(A));
    REP(i, N){CNT[A[i]]++;}
    for(auto x: CNT){
        if(x.second == 1) R.insert(x.first);
    }
    ll ans = 0;
    for(ll x: R){
        if( x == 1 ) {ans = 1; break;}
        bool isGood = true;
        for(ll t = 1; t*t <= x; t++){
            if(x % t != 0) continue; // not divisor
            if(Test.count(t)) {isGood = false; break;}
            if(t != 1) {
                if(Test.count(x/t)) {isGood = false; break;}
            }
        }
        if(isGood) ans ++;
    }
    cout<<ans<<endl;
}
int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> A(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&A[i]);
    }
    solve(N, std::move(A));
    return 0;
}


Measured memory_bytes: 35908
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
    int N;
    ll K;
    cin >> N >> K;
    ll A[N];
    vector<ll> B;
    vector<ll> C;
    ll z = 0;
    for (int i = 0; i < N; i++) {
        cin >> A[i];
        if (A[i] == 0) z++;
        else if (A[i] < 0) B.push_back(A[i]);
        else C.push_back(A[i]);
    }
    ll nb = B.size();
    ll nc = C.size();
    ll f0 = B.size() * C.size();
    ll f1 = f0 + z * (B.size() + C.size()) + (z * (z - 1)) / 2;
    sort(B.begin(), B.end());
    sort(C.begin(), C.end());
    if (K <= f0) {
         ll l = -1e18 - 1ll;
         ll r = 0;
         while (r - l > 1) {
             ll m = (l + r) / 2;
             ll sum = 0;
             int j = nc - 1;
             for (int i = B.size() - 1; i >= 0; i--) {
                 while (j >= 0 && B[i] * C[j] <= m) j--;
                 sum += nc - 1 - j;
             }
             if (sum < K) l = m;
             else r = m;
         }
         
         cout << r <<endl;
    } else if (K <= f1) {
      cout << 0 << endl;
    } else {
        ll l = 0;
        ll r = 1e18 + 1ll;
        while (r - l > 1) {
            ll m = (l + r) / 2;
            ll sum = f1;
            int j = nb - 1;
            for (int i = 0; i < nb - 1; i++) {
                while (j >= 0 && B[i] * B[j] <= m) j--;
                sum += min((int)nb - j - 1, (int)nb - i - 1);
            }
            
            j = 0;
            for (int i = nc - 1; i >= 1; i--) {
                while (j < nc && C[i] * C[j] <= m) j++;
                sum += min(i, j);
            }
            if (sum < K) l = m;
            else r = m;
        }
        cout << r << endl;
    }
    return 0;
}


Measured memory_bytes: 6704
#include <iostream>
#include<map>
using namespace std;
int main(void){
    
    int n;
    cin>>n;
    
    long long arr[n];
    
    for(int i=0;i<n;i++){
        cin>>arr[i];
    }
    long long ans=arr[0];
        for(int i=1;i<n;i++){
         ans^=arr[i];
    }
    for(int i=0;i<n;i++)
    {
        cout<<(ans^arr[i])<<" ";
    }
}


Measured memory_bytes: 4708
#include <iostream>
#include <string>

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

    int sum = 0;
    for(int i = 0; i < 3; i++) {
        if(s[i] == '1') {
            sum++;
        }
    }

    std::cout << sum << std::endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main() {
	vector<int> v;
	int A, B, K;

	cin >> A >> B >> K;

	for (int i = A ; i < A+K; i++)
	{
		if (i <= B) {
			v.push_back(i);
		}
	}

	for (int i = B; i > B-K; i--)
	{
		if (i >= A) {
			v.push_back(i);
		}
	}

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

	v.erase(unique(v.begin(), v.end()), v.end());

	for (auto it = v.begin();it != v.end();it++) {
		cout << *it << endl;
	}

	return 0;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define F first
#define S second
#define endl '\n'
#define MP make_pair
#define pb push_back

using namespace std;

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

static const int INF = INT_MAX;
static const int MIN = INT_MIN;
static const LL L_INF = LLONG_MAX;
static const int MOD = 1000000000 + 7;
static const int SIZE = 100005;

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

    int n;
    cin >> n;
    int mx = 0, mx_pos;
    int a[n];
    for( int i = 0; i < n; ++i ) {
        cin >> a[i];
        if( a[i] > mx ) {
            mx = a[i];
            mx_pos = i;

        }
    }

    int res = 0;
    for( int i = 0; i < n; ++i ) {
        if( i != mx_pos ) {
            if( abs( mx / 2 - res ) > abs( mx / 2 - a[i] ) ) {
                res = a[i];

            }
        }
    }
    cout << mx << " " << res << endl;
    return 0;
}



Measured memory_bytes: 640
#include <bits/stdc++.h>
#include <algorithm> 
#include <cstdlib>
#include <bitset>
#include <math.h>
#include <numeric>
#include <set>
#include <vector>
#define ll long long
#define pf printf
#define sf scanf
using namespace std;
int main(){
 
  ll a,b(0);
  cin>>a;
  if(a&1)cout<<0;
  else {
    a/=2;
    while(a>=5){
      a/=5;
      b+=a;
    }
    cout<<b;
  }
  





  
  


  
 
 
 
    
 
return 0;
}

Measured memory_bytes: 256
N, K = map(int, input().split())
As = list(map(int, input().split()))
d = [True]+[True]*K
for i in range(1, K+1):
    for a in As:
        if i-a<0:
            continue
        if d[i-a]:
            d[i] = False
            break

if d[-1]:
    print("Second")
else:
    print("First")



Measured memory_bytes: 41832
#include<bits/stdc++.h>
#define ll long long
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
using namespace std;
const ll MOD=1e9+7;
ll exp(ll a,ll n)
{
    if(a==0)    return 0;
    if(n==1)    return a;
    if(n==0)    return 1;
    ll temp=exp(a,n/2);
    temp*=temp;temp%=MOD;
    if(n%2)
        temp*=a,temp%=MOD;
    return temp;
}
signed main(){
    fastio
    int n,k;cin>>n>>k;
    ll a[k+1],sum=0;
    for(int i=k;i>=1;i--){
        ll have=k/i;
        ll num=exp(have,n);
        for(int j=2*i;j<=k;j+=i){
            num=(num-a[j]+MOD)%MOD;
        }
        a[i]=num;
        sum+=(a[i]*i)%MOD;sum%=MOD;
    }
    cout<<sum<<"\n";
    return 0;
}

Measured memory_bytes: 4368
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = a; i < b; i++)
#define Rep(i, a, b) for(int i = a; i <= b; i++)
#define _GLIBCXX_DEBUG
#define Vl vector<ll>
#define Vs vector<string>
#define Vp vector<pair<ll, ll>>
#define ll long long
#define ALL(v) (v).begin(),(v).end()
#define endl "\n"
using namespace std;  
const double pi = acos(-1.0);
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;



int main() {
  ll n, k; cin >> n >> k;
  Vl a(n);
  rep(i, 0, n) cin >> a[i];
  ll cnt1 = 0; // 数列内
  ll cnt2 = 0; // 数列間
  rep(i, 0, n-1) rep(j, i+1, n){
    if(a[i] > a[j]) cnt1++;
  }
  rep(i, 0, n) rep(j, 0, n){
    if(a[i] > a[j]) cnt2++;
  }
  ll ans = 0;
  ans += cnt1*k%MOD;
  ans += cnt2*(((k-1)*k/2)%MOD)%MOD;
  ans %= MOD;

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void) {

  long n;
  scanf("%ld", &n);
  char s[n][5];
  for (long i = 0; i < n; i++) {
    scanf("%s", s[i]);
  }
  long ac = 0;
  long wa = 0;
  long tle = 0;
  long re = 0;
  for (long i = 0; i < n; i++) {
    if (s[i][0] == 'A') {
      ac++;
    }
    if (s[i][0] == 'W') {
      wa++;
    }
    if (s[i][0] == 'T') {
      tle++;
    }
    if (s[i][0] == 'R') {
      re++;
    }
  }
  printf("AC x %ld\n", ac);
  printf("WA x %ld\n", wa);
  printf("TLE x %ld\n", tle);
  printf("RE x %ld\n", re);

  return 0;
}

Measured memory_bytes: 2216
#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll a,b,c,d;
int main()
{
	cin>>a>>b>>c>>d;
	if(a+b>c+d)
		cout<<"Left\n";
	else
	if(a+b<c+d)
		cout<<"Right\n";
	else
		cout<<"Balanced\n";
		return 0;
}

Measured memory_bytes: 512
#include<iostream>
#include<cstdio>
#include<algorithm>
#define reg register
#define ios ios::sync_with_stdio(false)
using namespace std;
int main() 
{
	ios;string s;cin>>s;
	int l=s.length();
	if(s[0]==s[l-1])
	{
		if(l%2==1)puts("Second");
		else	puts("First");
	}
	else
	{
		if(l%2==1)puts("First");
		else	puts("Second");
	}
    return 0;
}

Measured memory_bytes: 512
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        new Main();
    }

    public Main() {
        Scanner sc = new Scanner(System.in);
        int D = Integer.parseInt(sc.next());
        int T = Integer.parseInt(sc.next());
        int S = Integer.parseInt(sc.next());
        if (S * T >= D) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}


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

using namespace std;

typedef long long int ll;

#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(a) a.begin(), a.end()
#define sz(a) (ll)(a.size())
#define endl "\n"

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    
    ll s;
    cin >> s;

    if(s==2 || s==1)
    {
        cout << "4" << endl;
        return 0;
    }

    ll cnt= 1;
    while(1)
    {
        if(s==4)
        {
            cout << cnt+3 << endl;
            return 0;
        }

        if(s%2==0)
        {
            s/=2;
        }

        else
        {
            s*=3;
            s++;
        }

        cnt++;
    }

    return 0;
}

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

using namespace std;

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)

inline bool inrange(int x, int y) {
  return (0<=x&&x<8) && (0<=y&&y<8);
}

//string F[8];
char F[10][10];
bool used[8][8];
int turn;

bool debug;

int dx, dy;
int dfs(int x, int y, char me, int cnt) {

  x += dx, y += dy;
  if(!inrange(x, y)) { return 0; }
  if(F[y][x] == '.') { return 0; }
  if(F[y][x] == me) {
    return cnt;
  }
  used[y][x] = 1;
  int r = dfs(x, y, me, cnt+1);
  if(r == 0) { used[y][x] = 0; }
  return r;
}

#define DREP(i, a, b, c, d)                                 \
  for(int i=turn&1?a:c; turn&1?i>=b:i<=d; turn&1?i--:i++)

int main() {
  /*
  rep(i, 8) rep(j, 8){
    cin >> F[i][j];
  }
  //  */
  rep(i, 8) cin >> F[i];
  
  int ucnt = 0;
  for(turn=0; turn<=64; turn++) {
    int pl;
    bool u[8][8] = {};
    int mx = 0;
    DREP(i, 7, 0, 0, 7)
      DREP(j, 7, 0, 0, 7) {
      if(F[i][j] == '.') {
        rep(a, 8) rep(b, 8) used[a][b] = 0;
        used[i][j] = 1;
        int r = 0;
        for(dy=-1; dy<2; dy++) for(dx=-1; dx<2; dx++) {
          if(dx == 0 && dy == 0) { continue; }
          r += dfs(j, i, "ox"[turn&1], 0);
        }            
        
        if(mx < r) {
          memcpy(u, used, sizeof u);
          mx = r;
          pl = turn&1;
        }
        
      }
    }
    if(mx > 0) {
      rep(i, 8) rep(j, 8)
        if(u[i][j]) { F[i][j] = "ox"[pl]; }
      
      ucnt = 0;
    }
    else {
      if(ucnt) { break; }
      ucnt ++;
    }
  }
  
  rep(i, 8) {
    rep(j, 8) {
      cout << F[i][j];
    }
    cout << endl;
  }
  
  return 0;
}

Measured memory_bytes: 1136
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define vi vector<int>
#define vv vector<vi>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int> >
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define INF 100000000000
#define eps 1e-7
#define mod 1000000007
#define int ll
using namespace std;
int A;
int B;

signed main(void) {
    cin >> A >> B;
    if(A>=13){
        cout << B << endl;
    }else if(A>=6){
        cout << B/2 << endl;
    }else{
        cout << 0 << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define stop exit(0)
#define pb push_back
#define skip continue
int main(){
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    vector<long long>v;
    pair<string, long long> n;
    set<string> y;
    long long b,c,d=0,e=0,i,f=0,g=0,j,k=1,l=0,r=0,z,m,h;
    string t,s,x,q;
    double u;
    cin>>s;
    if(s[0]>=97){
        cout<<'a';
    }
    else{
        cout<<'A';
    }
}

Measured memory_bytes: 3544
#include <iomanip>
#include <iostream>

using namespace std;

int main()
{
  int n; cin >> n;
  long double p[3030]; for (int i = 0; i < n; ++i) cin >> p[i];
  
  long double dp[3030][3030] = {}; dp[0][0] = 1;
  for (int i = 0; i < n; ++i) for (int j = 0; j <= i; ++j) {
    dp[i+1][j] += dp[i][j]*(1-p[i]);
    dp[i+1][j+1] += dp[i][j]*p[i];
  }
  
  long double ans = 0;
  for (int i = n/2+1; i <= n; ++i)
    ans += dp[n][i];
  
  cout << setprecision(12) << ans << endl;
  return 0;
}

Measured memory_bytes: 143744
#include <bits/stdc++.h>
#define dum(x) cout<<#x<<'='<<x<<endl
#define ll long long
using namespace std;

int main() {
  int n, q; cin >> n >> q;
  vector<ll> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a.at(i);
  }

  for (int j = 0; j < q; j++) {
    ll x; cin >> x;

    int r = 0;
    ll sum = 0;
    ll cnt = 0;
    for (int l = 0; l < n; l++) {
      while (r < n && sum + a.at(r) <= x) {
        sum += a.at(r);
        r++;
      }
      cnt += r - l;

      if (l == r) r++;
      else sum -= a.at(l);
    }
    cout << cnt << endl;
  }
}



Measured memory_bytes: 3616
#line 1 "/mnt/c/Users/leafc/dev/compro/lib/template.hpp"


#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) (v).begin(), (v).end()
#define coutd(n) cout << fixed << setprecision(n)
#define ll long long int
#define vl vector<ll>
#define vi vector<int>
#define MM << " " <<

using namespace std;

template <class T> void say(bool val, T yes = "Yes", T no = "No") { cout << (val ? yes : no) << "\n"; }

template <class T> void chmin(T &a, T b) {
  if (a > b)
    a = b;
}

template <class T> void chmax(T &a, T b) {
  if (a < b)
    a = b;
}


#line 2 "agc044_b.cpp"

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

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

  int n;
  cin >> n;
  vector<vi> grid(n, vi(n, n));
  {
    queue<pair<int, int>> q;

    REP(i, n) {
      grid[0][i] = 0;
      grid[i][0] = 0;
      grid[n - 1][i] = 0;
      grid[i][n - 1] = 0;
      q.push({0, i});
      q.push({i, 0});
      q.push({n - 1, i});
      q.push({i, n - 1});
    }

    while (!q.empty()) {
      auto [x, y] = q.front();
      q.pop();
      REP(k, 4) {
        int nx = x + dx[k], ny = y + dy[k];
        if (0 <= nx && nx < n && 0 <= ny && ny < n) {
          if (grid[nx][ny] > grid[x][y] + 1) {
            chmin(grid[nx][ny], grid[x][y] + 1);
            q.push({nx, ny});
          }
        }
      }
    }
  }

  int ans = 0;
  vector<vector<bool>> empty(n, vector<bool>(n, false));
  REP(i, n * n) {
    int cur;
    cin >> cur;
    cur--;
    int cx = cur / n, cy = cur % n;
    ans += grid[cx][cy];
    empty[cx][cy] = true;
    queue<pair<int, int>> que;
    que.push({cx, cy});
    while (!que.empty()) {
      auto [x, y] = que.front();
      que.pop();
      REP(k, 4) {
        int nx = x + dx[k], ny = y + dy[k];
        if (0 <= nx && nx < n && 0 <= ny && ny < n) {
          if (grid[nx][ny] > grid[x][y] + (empty[x][y] ? 0 : 1)) {
            chmin(grid[nx][ny], grid[x][y] + (empty[x][y] ? 0 : 1));
            que.push({nx, ny});
          }
        }
      }
    }
  }

  cout << ans << endl;

  return 0;
}


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

int main() {
    vector<vector<int>> A(3, vector<int>(3));
    for (int i=0; i<3; i++) for (int j=0; j<3; j++) cin >>A.at(i).at(j);
    int N;
    cin >> N;
    int b;
    for (int i=0; i<N; i++) {
        cin >> b;
        for (int i=0; i<3; i++) for (int j=0; j<3; j++) {
            if (A.at(i).at(j)==b) A.at(i).at(j) = -1;
        }
    }
    for (int i=0; i<3; i++) {
        for (int j=0; j<3; j++) {
            if (A.at(i).at(j)!=-1) break;
            else if (j==2) {
                cout << "Yes";
                return 0;
            }
        }
    }
    for (int j=0; j<3; j++) {
        for (int i=0; i<3; i++) {
            if (A.at(i).at(j)!=-1) break;
            else if (i==2) {
                cout << "Yes";
                return 0;
            }
        }
    }
    for (int i=0; i<3; i++) {
        if (A.at(i).at(i)!=-1) break;
        else if (i==2) {
            cout << "Yes";
            return 0;
        }
    }
    for (int i=0; i<3; i++) {
        if (A.at(i).at(2-i)!=-1) break;
        else if (i==2) {
            cout << "Yes";
            return 0;
        }
    }
    cout << "No";
}

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

int main() {
  int x,a,b;cin>>x>>a>>b;
  string ans = a >= b ? "delicious" : (a+x<b ? "dangerous" : "safe");
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string S;
  cin>>S;
  int cou=1;
  for(int i=0;i<S.size();i++){
    if(i%2==0 && S.at(i)=='L'){
      cou=0;
    }
    else if(i%2==1 && S.at(i)=='R'){
      cou=0;
    }
  }
  if(cou==1){
    cout<<"Yes";
  }
  else{
    cout<<"No";
  }
}
  

Measured memory_bytes: 256
#include<iostream>
#include<unordered_map>

using namespace std;

int main()
{
  int n;
  cin>>n;
  int a[n];
  long long int sum=0;
  unordered_map<int,int> m;
  for(int i=0;i<n;i++)
  {
    cin>>a[i];
    m[a[i]]++;
    sum=sum+a[i];
  }
	int q;
  	cin>>q;
  	while(q--)
    {
      int search,val;
      cin>>search>>val;
       sum=sum-(search*m[search]);
       sum=sum+(val*m[search]);
       m[val]=m[val]+m[search];
       m[search]=0;
      cout<<sum<<"\n";
    }
}

Measured memory_bytes: 6948
#include <bits/stdc++.h>
using namespace std;
//#define int long long
#define y1 zzz
#define fi first
#define se second
#define PII pair<int,int>
#define PII2 pair<int,PII >
#define PII3 pair<PII,int >
#define PII4 pair<PII,PII >
#define all(x) (x).begin(),(x).end()
#define pb push_back
string s;
void solve()
{
    cin>>s;
    if(s=="AAA"||s=="BBB")cout<<"No";
    else cout<<"Yes";
}
int32_t main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    //freopen("STRWC.inp","r",stdin);
    //freopen("STRWC.out","w",stdout);
    //int t;cin>>t;while(t--)
    solve();
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string s,t;
  cin >> s >> t;
  sort(s.begin(),s.end());
  sort(t.begin(),t.end(), greater<char>());
  string ans;
  if (s < t){
    ans = "Yes";
  }else{
    ans = "No";
  }
  cout << ans << endl;
}

Measured memory_bytes: 3584
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.StringTokenizer;

public class Main {
	private static final int MOD = (int)Math.pow(10, 9);
	public static void main(String[] args) {
		FastReader sc = new FastReader();
		long x = sc.nextLong();
		String res = "ARC";
		if (x < 1200) {
			res = "ABC";
		}
		System.out.println(res);
	}
	
	static class FastReader {
	    BufferedReader br;
	    StringTokenizer st;
	
	    public FastReader() {
	      br = new BufferedReader(new InputStreamReader(System.in));
	    }
	  
	    String next() { 
	      while (st == null || !st.hasMoreElements()) {
	        try {
	          st = new StringTokenizer(br.readLine());
	        } catch (IOException  e) {
	          e.printStackTrace();
	        }
	      }
	      return st.nextToken();
	    }
	
	    int nextInt() {
	      return Integer.parseInt(next());
	    }
	
	    long nextLong() {
	      return Long.parseLong(next());
	    }
	
	    double nextDouble() { 
	      return Double.parseDouble(next());
	    }
	
	    String nextLine() {
	      String str = "";
	        try{
	            str = br.readLine();
	        } catch (IOException e) {
	            e.printStackTrace();
	        }
	        return str;
	      }
	  }
}


Measured memory_bytes: 23124
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> PA;
typedef priority_queue<ll> PQ;
#define MAXN 100005

ll a, b;

int main()
{
    cin >> a >> b;
    ll c = b - a;
    cout << (c*(c + 1) / 2) - b << endl;

    return 0;
}


Measured memory_bytes: 256
import Control.Arrow
import Control.Monad
import Data.List
import qualified Data.ByteString.Char8 as B
import Data.Ord

main :: IO ()
main = readLn >>= flip replicateM getLine >>= printRes . solve
    where
        printRes = mapM_ print

solve :: [String] -> [Int]
solve = map fst . sortBy cmpf . map edit . zip [1..]
    where
        cmpf lhs rhs = comparing (fst . snd) lhs rhs `mappend` comparing (snd . snd) rhs lhs
        edit (i, xs) = (i, (s, read p :: Int))
            where
                [s, p] = words xs

readLine :: IO [Int]
readLine = unfoldr (fmap (second (maybe B.empty snd . B.uncons)) . B.readInt) <$> B.getLine

readContents :: Int -> IO [[Int]]
readContents = flip replicateM readLine

Measured memory_bytes: 1020
#include<iostream> 
#include<vector> 
#include<string> 
#include<algorithm> 
using namespace std; 
int main()
{
	string s;
	cin >> s;
	vector<char> m(s.size());
	for (int i = 0; i < s.size(); i++)
	{
		m.at(i) = { s.at(i) };
		int x = 0;
		for (int j = 0; j < i + 1; j++)
		{

			if (s.at(i) == m.at(j))
			{
				x++;
			}
		}
		if (x > 1)
		{
			cout << "no" << endl;
			break;
		}

		if (i==s.size()-1)
		{
			cout << "yes" << endl; 
			break;
		}
	}
}

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

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

Measured memory_bytes: 256
height, width, k = map(int, input().split())

start_w = 1
end_w = width

if end_w <= 1:
    print(1)
    exit()


def enum_no_relation_cases(n, m=0):
    front = n - (start_w + 1) - (m * (m - 1)) // 2
    rear = end_w - (n + 1) - (m * (m + 1)) // 2
    return int(enum_amida_all_cases(front) * enum_amida_all_cases(rear))


def enum_amida_all_cases(n):
    if n < 1:
        return 1
    return fibonacci(n+2)


f = [1, 1, 1] + ([0] * (end_w - 1))


def fibonacci(n):
    if f[n] == 0:
        f[n] = fibonacci(n - 1) + fibonacci(n - 2)
    return f[n]


ans = [[0] * (1 + end_w + 1) for i in range(height + 1)]
ans[0][start_w] = 1
search_range = start_w + 1
for h in range(1, height + 1):
    for w in range(1, search_range + 1):
        from_just_above = ans[h-1][w] * enum_no_relation_cases(w)
        from_upper_left = ans[h-1][w - 1] * enum_no_relation_cases(w, -1)
        from_upper_right = ans[h-1][w + 1] * enum_no_relation_cases(w, 1)
        ans[h][w] = from_just_above + from_upper_left + from_upper_right

    if search_range < end_w:
        search_range += 1

print(ans[height][k] % 1000000007)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define mm(a,b) memset(a,b,sizeof(a))
#define ACCELERATE (ios::sync_with_stdio(false),cin.tie(0))
#define pii pair<int,int>
#define pdd pair<double,double>
#define pll pair<long long,long long>
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define rush() int T;scanf("%d",&T);while(T--)
#define debug(x) cout<<#x<<": "<<x<<endl
#define sc(a) scanf("%d",&a)
#define sc2(a,b) scanf("%d%d",&a,&b)
#define sc3(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define pf(x) printf("%d\n",x)
#define pf2(x,y) printf("%d %d\n",x,y)
#define pf3(x,y,z) printf("%d %d %d\n",x,y,z)
#define all(x) (x).begin(),(x).end()
#define PI acos(-1.0)
#define E exp(1.0)
#define db double
#define ll long long
#define ld long double
#define ull unsigned long long
//#define io
using namespace std;
const int inf=0x3f3f3f3f;
const ll INF=0x3f3f3f3f3f3f3f3f;
//#define gc getchar
//char buf[1<<21],*p1=buf,*p2=buf;
//inline int gc(){return p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++;}
//inline int read()
//{
//    int ret=0,f=0;char c=gc();
//    while(!isdigit(c)){if(c=='-')f=1;c=gc();}
//    while(isdigit(c)){ret=ret*10+c-48;c=gc();}
//    if(f)return -ret;return ret;
//}
int a,b;
int main()
{
    #ifdef io
    freopen("in.txt","r",stdin);
    #endif
    cin>>a>>b;
    if(abs(a-b)%2==0){
        int t=(a+b)/2;
        cout<<t<<endl;
    }else{
        puts("IMPOSSIBLE");
    }
    return 0;
}


Measured memory_bytes: 256
// うまいやり方がわからん 愚直でいいや
// -> なんかミスったぽい たぶん順番も関係するからか？
// 仕方ないが順番逆のやつも用意して比較
// -> なぜか変わらずWA
// PからX QからYとったものをあわせて小さいものから置き換えてみる（にぶたん
// -> なぜかWAが増える
// 諦めて解説を見るも、なんで↑の考えだと駄目なのかは一切不明 これでよくない？？？？？？？？？？？？？？？？？

package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

func main() {
	buf := make([]byte, 1024*1024)
	sc.Buffer(buf, bufio.MaxScanTokenSize)
	sc.Split(bufio.ScanWords)
	defer out.Flush()
	X, Y, A, B, C := nextInt(), nextInt(), nextInt(), nextInt(), nextInt()
	P, Q, R := nextInts(A), nextInts(B), nextInts(C)
	sort.Sort(sort.Reverse(sort.IntSlice(P)))
	sort.Sort(sort.Reverse(sort.IntSlice(Q)))
	sort.Sort(sort.Reverse(sort.IntSlice(R)))
	S := append(P[:X], Q[:Y]...)
	S = append(S, R...)
	sort.Sort(sort.Reverse(sort.IntSlice(S)))
	ans := 0
	for i := 0; i < X+Y; i++ {
		ans += S[i]
	}
	fmt.Fprintln(out, ans)
	// fmt.Printf("置き換え前 %v\n", S)
	// for _, r := range R {
	// 	idx := sort.Search(X+Y, func(j int) bool {
	// 		return r > S[j]
	// 	})
	// 	if idx == X+Y {
	// 		continue // breakでもいいのでは
	// 	}
	// 	S[idx] = r
	// }
	// fmt.Println(S)
	// ans := 0
	// for _, s := range S {
	// 	ans += s
	// }
	// fmt.Fprintln(out, ans)
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a < b {
		return b
	}
	return a
}

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	a, _ := strconv.Atoi(next())
	return a
}

func nextInts(n int) []int {
	ret := make([]int, n)
	for i := 0; i < n; i++ {
		ret[i] = nextInt()
	}
	return ret
}

func nextStrings(n int) []string {
	ret := make([]string, n)
	for i := 0; i < n; i++ {
		ret[i] = next()
	}
	return ret
}

func chars(s string) []string {
	ret := make([]string, len([]rune(s)))
	for i, v := range []rune(s) {
		ret[i] = string(v)
	}
	return ret
}


Measured memory_bytes: 10624
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;

public class Main {

	public static void main(String[] args) throws IOException{

		ArrayList<Integer> l = new ArrayList<Integer>();
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		while (true) {
			String inputNum = br.readLine();
			if (inputNum.equals("0")) {
				break;
			}

			l.add(Integer.parseInt(inputNum));
		}

		for (int i = 1; i <= l.size(); i++) {

			System.out.println("Case " + i + ": " + l.get(i-1));
		}


	}

}

Measured memory_bytes: 27868
#include <iostream>
#include <algorithm>
#include <map>
#include <regex>
#include <string>
#include <cstdlib>
#include <math.h>
#include <vector>
#include <queue>
using namespace std;
using ll = long long;

int main() {
  int a, b;
  cin >> a >> b;

  string s1 = "";
  string s2 = "";
  for (int i = 0; i < a; i++) {
    s1 = s1 + to_string(b);
  }
  for (int i = 0; i < b; i++) {
    s2 = s2 + to_string(a);
  }
  if (s1 < s2) {
    cout << s1 << endl;
  } else {
    cout << s2 << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
typedef pair<int, int> pii;
typedef priority_queue<int> PQ;
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//vector<vector<int> > dp;
//vector<vector<vector<int> > > vvvi;
//dp=vector<vector<int> >(N, vector<int>(M,0));
//vector<pair<int,int> > v;
//v.push_back(make_pair(x,y));
//priority_queue<int,vector<int>, greater<int> > q2;



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

	int N, M;
	cin >> N >> M;
	VI X(N), Y(M);
	REP(i, N)cin >> X[i];
	REP(i, M)cin >> Y[i];

	int xsum = 0, ysum = 0;
	REP(i, N) {
		xsum -= X[i] * (N - i - 1);
		xsum += X[i] * i;
		xsum %= mod;
	}
	REP(i, M) {
		ysum -= Y[i] * (M - i - 1);
		ysum += Y[i] * i;
		ysum %= mod;
	}

	//cout << xsum << " " << ysum << endl;
	cout << (xsum%mod * ysum%mod) % mod << endl;

	return 0;
}



Measured memory_bytes: 1792
using System;
using System.Linq;

class Program {
  static void Main() {
    int[] arr = Console.ReadLine().Split().Select(int.Parse).ToArray();
    int a = arr[0];
    int b = arr[1];
    if (a == 1) a = 14;
    if (b == 1) b = 14;
    if (a > b) Console.WriteLine("Alice");
    else if (a < b) Console.WriteLine("Bob");
    else Console.WriteLine("Draw");
  }
}

Measured memory_bytes: 13268
//Bismillahir Rahmanir Rahim
// AtCoder-Sheep and Wolves
 
#include<bits/stdc++.h>
using namespace std;
 
int main(){
  int s,w;
  cin>>s>>w;
  if(w>=s)
  cout<<"unsafe\n";
  else cout<<"safe\n";
  return 0;
}

Measured memory_bytes: 3624
n = int(input())

def dfs(count, s):
    if int(s) > n:
        return count
    if '3' in s and '5' in s and '7' in s:
        count += 1
    for c in '357':
        count = dfs(count, s+c)
    return count

print(dfs(0, '0'))

Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include <boost/multiprecision/cpp_int.hpp>
//typedef boost::multiprecision::cpp_int ll;
typedef long double dd;
//#define i_7 (ll)(1E9+7)
#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E18;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
////////////////////////////

int main(){fastio
    ll n,k;cin>>n>>k;
    ll a[n];rep(i,0,n-1)cin>>a[i];
    ll N=50;
    ll c[N];memset(c,0,sizeof(c));
    rep(i,0,n-1){
        rep(j,0,N-1){
            if((a[i]>>(N-1-j))&1)c[j]++;
        }
    }
    //rep(i,0,N-1)cout<<c[i]<<" ";cout<<endl;
    ll dp[N][2];memset(dp,-1,sizeof(dp));
    dp[0][1]=0;
    rep(i,1,N-1){
        ll p=1ll<<(N-1-i);
        if((k>>(N-1-i))&1){
            if(dp[i-1][1]>=0)dp[i][1]=dp[i-1][1]+(n-c[i])*p;//Xとして1使う
        }else{
            if(dp[i-1][1]>=0)dp[i][1]=dp[i-1][1]+c[i]*p;//Xとして1使わない
        }
        if((k>>(N-1-i))&1){
            if(dp[i-1][0]>=0)dp[i][0]=dp[i-1][0]+max(c[i],(n-c[i]))*p;
            if(dp[i-1][1]>=0)Max(dp[i][0],dp[i-1][1]+c[i]*p);
        }else{
            if(dp[i-1][0]>=0)dp[i][0]=dp[i-1][0]+max(c[i],(n-c[i]))*p;
        }
        Max(dp[i][1],dp[i][0]);
    }
    /*
    rep(j,0,1){
        rep(i,0,N-1)cout<<dp[i][j]<<" ";
        cout<<endl;
    }
    */
    cout<<dp[N-1][1]<<endl;
    return 0;
}


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

const long long INF = 1LL << 60;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

typedef long long ll;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define vi vector<int>
#define vii vector< vector<int> >

int H, W;
string field[1100];
int dp[1100][1100];
int MOD = 1000000007;

int main() {

	cin >> H >> W;
	rep(i, H) cin >> field[i];
	
	rep(i, H) {
		if (field[i][0] == '#') break;
		else dp[i][0] = 1;
	}

	rep(j, W) {
		if (field[0][j] == '#') break;
		else dp[0][j] = 1;
	}

	rep1(i, H) {
		rep1(j, W) {
			if (field[i][j] == '#') continue;
			else {
				if (j != 0) dp[i][j] += dp[i][j - 1];
				if (i != 0) dp[i][j] += dp[i - 1][j];
				dp[i][j] %= MOD;
			}
		}
	}

	cout << dp[H - 1][W - 1] << endl;

}


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

int n;
string s[100004];

int main() {
	cin>>n;
	for(int i = 0;i<n;i++){
		cin>>s[i];
		sort(s[i].begin(), s[i].end());
	}
	sort(s, s+n);
	int cnt = 1;
	long long ans = 0;
	for(int i = 1;i<n;i++){
		if(s[i] == s[i-1])	cnt++;
		else if(cnt == 1)	continue;
		else{
			ans += 1ll*cnt*(cnt-1)/2;
			cnt = 1;
		}
	}
	ans += 1ll*cnt*(cnt-1)/2;
	cout<<ans;
	return 0;
}

Measured memory_bytes: 7296
#include<iostream>
#include<string.h>
#include<math.h>
#include<stdlib.h>
using namespace std;
int main()
{
    int a;
    cin>>a;
    int i,j;
    while(a)
    {
        int cnt=0;
       for(i=sqrt(a+0.5);i>0;i--)
        {
            int k=2;
            j=k;
            out:
            int s=1,flag=0;
            for(;j>0;j--)
            {
                s*=i;
                if(s==a)
                {
                     flag=1;

                }
                else if(s>a)
                {
                    flag=2;
                }
                else
                    flag=0;
            }
            if(flag==1)
            {
                cout<<a<<endl;
                cnt=1;
                break;
            }
            else if(flag==0)
            {
                if(k<11)
                {
                    k++;
                    j=k;
                    goto out;
                }

            }

        }
        if(cnt)
                break;
        a--;
    }

    return 0;
}

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

int main(void){
    long long R,G,B,N;cin>>R>>G>>B>>N;
    long long ans=0;
    for(long long i=0;i*R<=N;i++){
        for(long long j=0;j*G+i*R<=N;j++){
            if((N-(i*R+j*G))%B==0){
                ans++;
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3608
// algo.cpp: 定义应用程序的入口点。
//
#include <iostream>
#include <fstream>
#include <ctime>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <queue>
#include <climits>
#include <cassert>
using namespace std;
struct UnionFind {
    vector<int> par, sz;
    int n_tree;

    explicit UnionFind(int n) : par(n), sz(n, 1), n_tree(n) { //0-indexed
        iota(par.begin(), par.end(), 0);
    }

    int n_cluster() const {
        return n_tree;
    }

    int size(int x) {
        return sz[root(x)];
    }

    int root(int x) {
        return x == par[x] ? x : par[x] = root(par[x]);
    }

    bool unite(int x, int y) {
        int rx = root(x), ry = root(y);
        if (rx != ry) {
            par[rx] = ry;
            --n_tree;
            sz[ry] += sz[rx];
            return true;
        }
        return false;
    }
    bool same(int x, int y) {
        return root(x) == root(y);
    }
    bool is_root(int x) const {
        return par[x] == x;
    }
};
int gcd(int x, int y) {
    return y == 0 ? x : gcd(y, x % y);
}
int main() {
#ifdef LOCAL
    // 如何使用相对路径？
    ifstream in("in.txt");
    cin.rdbuf(in.rdbuf());
#endif
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int a, b;

    cin >> a >> b;
    cout << 1LL * a * b / gcd(a, b) << endl;
        
#if defined LOCAL
    cout << "Time elapsed: " << (double)clock() / CLOCKS_PER_SEC << " s.\n";
#endif
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main{
    public static void main(String args[]){
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();

        int[][] count = new int[10][10];
        int base = 1;
        for(int i=1; i<=N; i++){
            int last = i % 10;
            if(base * 10 <= i){ base = base * 10; }
            int first = i/base;
            count[first][last] ++;
        }
        int res = 0;
        for(int i=0; i<10; i++){
            for(int j=0; j<10; j++){
                if(i==0 || j==0){
                    res = res + 0;
                } else {
                    res = res + count[i][j] * count[j][i];
                } 
            }
        }
        System.out.println(res);
    }
}

Measured memory_bytes: 22996
#include <iostream>
#include <iomanip>
#include <bits/stdc++.h>
#include <vector>
#include <iterator>
#include <string>
#define pan(i,n) for(int i=0;i<n;i++)
#define ll long long int
#define vi vector<int>
#define pb push_back
using namespace std;
 

int main(){
    ll n;
    cin>>n;
    ll ans=0;
    if(n%2==0){
        n/=2;
        for(ll i=5;i<=n;i*=5){
            ans+=n/i;
        }
        cout<<ans;
    }
    else cout<<0;  
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <array>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <algorithm>
#include <cmath>
#include <iomanip>

#define FOR(i, a, b) for(decltype(b) i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)

typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int uint;

using namespace std;

#ifdef INPUT
#include <sstream>
stringstream input(R"(
10 1
)");
#define cin input
#endif
ll inv_mod( ll a, ll m )
{
  ll b, x, u, q, abs_m, tmp; 

  abs_m = ( m < 0 ) ? -m : m;
  b = m; x = 1; u = 0; 
  while ( b > 0 ) {
    q = a / b; 
    tmp = u; u = x - q * u; x = tmp;
    tmp = b; b = a - q * b; a = tmp;
  }

  return ( x < 0 ) ? abs_m + x : x;
}


int main()
{
	int b, w;
	cin >> b >> w;

	const ll mod = 1000000007;
    vector<ll> frac(204799 + 1);
    frac[0] = 1;
    REP (i, 204799)
        frac[i + 1] = frac[i] * (i + 1) % mod;

    vector<ll> fraci(204799 + 1);
    fraci[204799] = inv_mod(frac[204799], mod);
    for (auto i = 204799; i > 0; --i)
        fraci[i - 1] = fraci[i] * i % mod;

	ll r = 1;
	ll br = 0;
	ll bw = 0;
	REP (i, b + w)
	{
		r %= mod;
		r *= 2;
		if (i >= b)
		{
			br *= 2;
			br += frac[i - 1] * fraci[i - b] % mod * fraci[b - 1] % mod;
			br %= mod;
		}
		if (i >= w)
		{
			bw *= 2;
			bw += frac[i - 1] * fraci[i - w] % mod * fraci[w - 1] % mod;
			bw %= mod;
		}
		cout << /*' ' << (r / 2 - br + bw) << '/' << r << ' ' <<*/ ((r / 2 + mod - br + bw) % mod * inv_mod(r % mod, mod) % mod) << endl;
	}

	return 0;
}


Measured memory_bytes: 5376
#!/usr/bin/python

r, c = map(int, input().strip().split(" "))

row_lists = list()
for _ in range(r):
    row_list = list(map(int, input().strip().split(" ")))
    row_list.append(sum(row_list))
    row_lists.append(row_list)

lastrow = [sum(i) for i in zip(*row_lists)]

row_lists.append(lastrow)

for r in row_lists:
    print(" ".join(map(str, r)))

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

using namespace std;

// Problem https://atcoder.jp/contests/abc087/tasks/arc090_a

int solver(int ROWCOUNT,vector<int> UPLINE,vector<int> DOWNLINE){
    int result;
    result = 0;
    int maxcandy;
    maxcandy = 0;
    for(int j=0;j<ROWCOUNT;j++){
        int nowcandy;
        nowcandy = 0;
        for(int k=0;k<=j;k++){
            nowcandy = nowcandy + UPLINE.at(k);
        }
        for(int k=j;k<ROWCOUNT;k++){
            nowcandy = nowcandy + DOWNLINE.at(k);
        }
        if(maxcandy < nowcandy){
            maxcandy = nowcandy;
        }
    }
    result = maxcandy;
    return result;
}


int main(void){
    int answer;
    answer = 0;
    int N;
    cin >> N ;
    vector<int> A1,A2;
    A1.clear();
    A2.clear();
    for(int j=0;j<N;j++){
        int candy;
        cin >> candy;
        A1.push_back(candy);
    }
    for(int j=0;j<N;j++){
        int candy;
        cin >> candy;
        A2.push_back(candy);
    }
    answer = solver(N,A1,A2);
    cout << answer << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF (1LL<<50)
#define N 100001
using namespace std;
typedef long long ll;
ll s[N],t[N],p[N],P[N];
int main(){
  int n,m;
  cin>>n>>m;
  for(int i=0;i<n;i++) cin>>s[i]>>t[i];
  for(int i=1;i<=m;i++) cin>>p[i];
  p[m+1]=P[m+1]=(INF);
  sort(p,p+m+2);
  for(int i=1;i<m+2;i++)P[i]=p[i]-p[i-1];
  for(int i=2;i<m+1;i+=2)P[i]+=P[i-2],P[i+1]+=P[i-1];
  
  ll sum=0; 
  for(int i=0;i<n;i++){
    int idx2=upper_bound(p,p+m+2,s[i])-p,idx1=idx2-1;
    int idx4=upper_bound(p,p+m+2,t[i])-p,idx3=idx4-1;
    int f;

    if(idx2==idx4)sum+=abs(t[i]-s[i]);
    else if(s[i]<t[i]){
      sum+=(p[idx2]-s[i]);
      if(p[idx2]>s[i])idx2++;
      f=idx2%2==idx3%2;
      sum+=P[idx3-f]-P[idx2-1]+f*(t[i]-p[idx3]);
    } 
    else{
      sum+=(s[i]-p[idx1]);
      if(p[idx1]<s[i])idx1--;
      f=idx1%2==idx4%2;
      sum+=P[idx1]-P[idx4-!f]+f*(p[idx4]-t[i]);
    }
  }
  cout <<sum<<endl;
  
  return 0;
}

Measured memory_bytes: 4312
#pragma GCC optimize("O3")
#include<bits/stdc++.h>
#define INF 2147483647
#define LLINF 9223372036854775807
using namespace std;
string a[2010];
int cnt[2010][2010];
int ans[2010][2010];
int res[2010][2010];
int main(){
	int n,m,q;
    cin>>n>>m>>q;
    for(int i=0;i<n;i++){
    	cin>>a[i];
	} 
	for(int i=1;i<=n;i++){
		for(int j=1;j<=m;j++){
            cnt[i][j]=cnt[i-1][j]+cnt[i][j-1]-cnt[i-1][j-1]+(a[i-1][j-1]=='1');
            ans[i][j]=ans[i-1][j]+ans[i][j-1]-ans[i-1][j-1];
            res[i][j]=res[i-1][j]+res[i][j-1]-res[i-1][j-1];
            if(a[i-1][j-1]=='1'&&a[i-1][j]=='1')ans[i][j]++;
            if(a[i-1][j-1]=='1'&&a[i][j-1]=='1')res[i][j]++;
		}
	}
	for(int i=0;i<q;i++){
		int x1,y1,x2,y2;
        cin>>x1>>y1>>x2>>y2; 
        int l=cnt[x2][y2]-cnt[x1-1][y2]-cnt[x2][y1-1]+cnt[x1-1][y1-1];
		int r=ans[x2][y2-1]-ans[x2][y1-1]-ans[x1-1][y2-1]+ans[x1-1][y1-1]+res[x2-1][y2]-res[x2-1][y1-1]-res[x1-1][y2]+res[x1-1][y1-1];
		cout<<l-r<<endl;
    }
    return 0;
}

Measured memory_bytes: 53248
H, W = gets.split.map{|i|i.to_i}
min = H * W
if H % 3 == 0 or W % 3 == 0
    min = 0
else
    min = [H, W].min
end
if H % 2 == 0 or W % 2 == 0
    if H % 2 == 0 and min > H / 2
        min = H / 2
    end
    if W % 2 == 0 and min > W / 2
        min = W / 2
    end
else
    a, b = [H, W].sort
    b3 = b / 3
    if b % 3 == 2
        b3 += 1
    end
    s1 = b3 * a
    a, b = [a, b - b3].sort
    b2 = b / 2
    s2 = a * b2
    s3 = a * (b2 + 1)
    s = [s1, s2, s3].sort
    if min > s[2] - s[0]
        min = s[2] - s[0]
    end
end
puts min


Measured memory_bytes: 1788
#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
#include <cstdio>
#include <string>
#include <cmath>
#include <cfloat>
#include <map>
#include <queue>
#include <stack>
using namespace std;
int main(){

	int s[31]={0};
	
	int n;
	for(int i=0;i<28;i++){
		cin>>n;
		s[n]++;
	}
	
	for(int i=1;i<=30;i++){
		if(s[i]==0)
			cout<<i<<endl;
	}
	
	
}

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

int main(){
    int x = 0;
    int n;
    cin >> n;
    int ans = 0;
    rep(i,n){
        char c;
        cin >> c;
        if(c == 'I')x++;
        else x--;
        ans = max(x,ans);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
# 最大公約数(Greatest Common Divisor)、最小公倍数(Least Common Multiple)
def gcd(a, b): # a >= b
  if b < a:
    a, b = b, a
  while b:
    a, b = b, a % b
  return a
def lcm(a, b): # a >= b
  return a * b // gcd(a, b)

A, B = map(int, input().split())

print(lcm(A, B))

Measured memory_bytes: 2940