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

typedef long long ll;
typedef unsigned long long int ull;
#define endl "\n"
#define pb push_back
#define sq(a) (a)*(a)
#define all(x) (x).begin(), (x).end()
#define debug(x) cerr<<#x<<'='<<(x)<<endl;
#define debugv(v) cerr<<#v<<" : ";for (auto x:v) cerr<<x<<' ';cerr<<endl;
#define MOD 1000000007
#define PI 3.141592653589793238
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);

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

ll exp(ll x,ll n,ll mod)
{
    ll result=1;
    while(n)
    {
        if(n & 1)
            result=(result * x)%mod;
        x=(x*x)%mod;
        n>>=1;
    }
    return result;
}



int32_t main()
{
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    IOS

    double d,t,s;
    cin>>d>>t>>s;

    double t2=d/s;
    if(t2>t)
    	cout<<"No"<<endl;
    else
    	cout<<"Yes"<<endl;
    return 0;
}

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

int main(){
   string s;
   cin>>s;
  if(s=="Sunny"){
    cout<<"Cloudy"<<endl;
  }else if(s=="Cloudy"){
    cout<<"Rainy"<<endl;
  }else if(s=="Rainy"){
    cout<<"Sunny"<<endl;
  }
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES // M_PI
#include<cmath>
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define REP(i,m,n) for(int i=(int)(m);i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define rREP(i,a,n) for(int (i)=(n)-1; (i)>=(a);--(i))
#define all(x) (x).begin(),(x).end()
#define out(y,x,h,w) (y)<0||(x)<0||(y)>=(h)||(x)>=(w)
constexpr int INF = 2147483647;
constexpr ll mod = 1000000007;

template<class T>inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
template<class T>inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}
inline void init() {
	cin.tie(nullptr); cout.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}

int main() {
	init();

	int A, B, C; cin >> A >> B >> C;
	REP(i, 1, B + 1) {
		if ((A * i) % B == C) {
			cout << "YES" << "\n";
			return 0; 
		}
	}
	cout << "NO" << "\n";

	return 0;
}

Measured memory_bytes: 256
N, M = map(int, input().split())

class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return -1, -1

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

        return x, y

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)
    
    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}


bridge = [(map(int, input().split())) for _ in range(M)][::-1]

unionfind = UnionFind(N)
total = N * (N - 1) // 2
ans = [total]
roots = set()
size = [0] * (N + 1)
not_fuben = 0
for a, b in bridge[:-1]:
    x, y = unionfind.union(a - 1, b - 1)
    if x != -1:
        if x not in roots:
            roots.add(x)
            size[x] = 2
            not_fuben += 1
        else:
            if y in roots:
                not_fuben += size[y] * size[x]
                size[x] += size[y]
            else:
               not_fuben += size[x]
               size[x] += 1
    ans.append(total - not_fuben)
for a in ans[::-1]:
    print(a)

Measured memory_bytes: 123952
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<sstream>
using namespace std;
typedef  long long int lint;
typedef pair<int, int> P;
typedef pair<lint, lint> LLP;
typedef pair<char, char>CP;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define sort(v) sort((v).begin(), (v).end())
#define reverse(v) reverse((v).begin(), (v).end())
#define upper(v,hoge) upper_bound(v.begin(),v.end(),hoge)
#define lower(v,hoge) lower_bound(v.begin(),v.end(),hoge)
#define llower(v,hoge) *lower_bound(v.begin(), v.end(), hoge)
#define lupper(v,hoge) *upper_bound(v.begin(), v.end(), hoge)
/*
vector<char>al(26);
al = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
vector<char>AL(26);
AL = {'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
vector<char>NUM(10);
	NUM = { '0','1','2' ,'3' ,'4' ,'5' ,'6' ,'7' ,'8' ,'9' };
*/



int main() {
	int a, b, h;
	cin >> a >> b >> h;
	cout << (a + b) * h / 2 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll a[1212030],v[1000005];
int main()
{
    ll i,ans=0,ans2,w,t,flag=0,n,k,N,x,q,c,b;
    scanf("%lld",&n);
    for(i=1; i<=n; i++)
    {
         scanf("%lld",&a[i]);
         v[a[i]]++;
         ans+=a[i];
    }
    scanf("%lld",&q);
    while(q--)
    {
         scanf("%lld %lld",&b,&c);
         v[c]+=v[b];
         ans=ans+(c-b)*v[b];
         v[b]=0;
         printf("%lld\n",ans);
    }

// printf("%c",N+'a'-1);



}


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

#define DEBUG(x) cout << "DEBUG>" << #x << ":" << x << endl;
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)

int main() {
  int N;
  cin >> N;
  vector<int> p(N);
  REP(i, N) {
    cin >> p[i];
  }
  int maxp = -1;
  int ans = 0;
  REP(i, N) {
    maxp = max(maxp, p[i]);
    ans += p[i];
  }
  ans = ans - maxp / 2;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
using namespace std;
int main(void){
    long long int i,n,ans=0;
    cin>>n;
    for(i=sqrt(n);i>0;i--){
        if(n%i==0){
            ans=n/i+i-2;
            break;
        }
    }
    cout<<ans;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 100000005
#define MAX 1002
//#define mp make_pair
#define fi first
#define se second
using namespace std;
//__gcd(a,b), __builtin_popcount(a);

int b[MAX][MAX][6];
char a[MAX][MAX];
string str[MAX];
char c[3] = {'J', 'O', 'I'};
stack<int> st;
int main(){
	int h, w, k;
	scanf("%d%d%d", &h, &w, &k);
	rep(i,h)cin >> str[i];
	rep(i,h)rep(j,w)a[i+1][j+1] = str[i][j];
	rep(i,h)rep(j,w)rep(u,3){
		if(a[i+1][j+1] == c[u])b[i+1][j+1][u]++;
		b[i+1][j+1][u] += b[i+1][j][u];
	}
	rep(i,h)rep(j,w)rep(u,3){
		b[i+1][j+1][u+3] = b[i][j+1][u+3] + b[i+1][j+1][u];
	}
	
	int x[4], y[3];
	for(int i = 0;i < k;i++){
		rep(j,4)scanf("%d", &x[j]);
		x[0]--;x[1]--;
		rep(u,3)
		y[u] = b[x[2]][x[3]][u+3]+b[x[0]][x[1]][u+3]-b[x[2]][x[1]][u+3]-b[x[0]][x[3]][u+3];
		printf("%d %d %d\n", y[0], y[1], y[2]);
	}
	
	return 0;
}

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

#define pb push_back
#define mp make_pair
typedef long long ll;
typedef long double ld;
const int MOD = 1e9+7;
const int MX = 2e5+5;
const ll  INF = 1e18;
const ld  PI = acos((ld) -1);
template<class T> inline void array_input(T a[], size_t n){for(size_t i = 0; i < n; i++)cin >> a[i];}


//#define FILE

int main(){
#ifdef FILE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif // 0

    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    cout << max(max(a*d, a*c), max(b*c, b*d)) << '\n';

    return 0;
}


Measured memory_bytes: 3632
#include<cstdio>
using namespace std;
int main(){
   int n,ans=0;
   scanf("%d",&n);
   bool f=false;
   for(int i=1;i<=n;++i){
      int tmp;
      scanf("%d",&tmp);
      if(tmp==i){
         if(f){++ans; f=false;}
         else f=true;
      }
      else if(f){++ans; f=false;}
   }
   if(f) ++ans;
   printf("%d\n",ans);
   return 0;
}

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

#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;

typedef long long ll;

const int INF = 1 << 30;
const ll LLINF = 1LL << 60;

int mod = 1000000007;
int dp[40+1][401][401];

int main(void){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N, Ma, Mb; cin >> N >> Ma >> Mb;
    rep(i, N+1) rep(j, 401) rep(k, 401) dp[i][j][k] = INF;
    dp[0][0][0] = 0;
    int A[N], B[N], C[N]; rep(i, N) cin >> A[i] >> B[i] >> C[i];
    for(int i = 0; i < N; i++){
        for(int a = 0; a <= 400; a++){
            int to_a = a + A[i];
            for(int b = 0; b <= 400; b++){
                int to_b = b + B[i];
                if(to_a <= 400 && to_b <= 400) dp[i+1][to_a][to_b] = min(dp[i+1][to_a][to_b], dp[i][a][b] + C[i]);
                dp[i+1][a][b] = min(dp[i+1][a][b], dp[i][a][b]);
            }
        }
    }

    int ans = INF;
    int x = Ma, y = Mb;
    while(x <= 400 && y <= 400){
        ans = min(ans, dp[N][x][y]);
        x += Ma; y += Mb;
    }
    if(ans != INF) cout << ans << endl;
    else cout << -1 << endl;
    return 0;
}

Measured memory_bytes: 25984
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define TRACE
#ifdef TRACE
#define tr(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define tr(...)
#endif

#define ll long long
#define ld long double 
#define endl "\n"
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(a) (ll)(a.size())
#define all(a) a.begin(), a.end() 
#define fr(i,n) for(i=1;i<=n;i++)
#define rp(i,n) for(i=0;i<n;i++)
#define FIO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
// order_of_key (val): returns the no. of values less than val
// find_by_order (k): returns the iterator to kth largest element.(0-based)
typedef pair<ll, ll> ii;
typedef vector<ll> vl;
const ll N = 200010;
ll mod=1e9+7;

ll ffmod(ll x, ll y, ll mod)
{
    ll rt=1;
    while(y)
    {
        if(y&1ll) rt=(rt*x)%mod;
        x=(x*x)%mod, y/=2ll;
    }
    return rt;
}

ll dp[3010][3010];

int main()
{
    FIO;
    ll i,j,tp,ls,lt;
    string s,t,s1;
    cin>>s>>t;
    ls=SZ(s), lt=SZ(t);
    s="$"+s;
    t="$"+t;
    for(i=0;i<=max(ls, lt);i++)
        dp[i][0]=0, dp[0][i]=0;
    fr(i,ls) fr(j,lt)
    {
        if(s[i]==t[j])
            dp[i][j]=1+dp[i-1][j-1];
        else
            dp[i][j]=max(dp[i-1][j], dp[i][j-1]);
    }
    tp=dp[ls][lt];
    s1.clear();
    for(i=ls, j=lt;i>0 && tp>0;)
    {
        for(;j>0 && dp[i][j]==tp;j--);
        j++;
        if(dp[i][j]!=tp || s[i]!=t[j])
            i--;
        else
        {
            s1.PB(s[i]);
            i--, j--, tp--;
        }
    }
    reverse(all(s1));
    cout<<s1<<endl;
    return 0;
}


Measured memory_bytes: 70912
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<ll,pll> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-9;
const ll mod=1e9+7;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

int n;
string s;

bool f(ll x){
	string t;
	ll tmp=9*x;
	for(int i=0;i<s.size();i++){
		tmp+=s[i]-'0';
		t+=(char)('0'+tmp%10);
		tmp/=10;
	}
	while(tmp){
		t+=(char)('0'+tmp%10);
		tmp/=10;
	}
	ll sum=0;
	for(auto i:t) sum+=i-'0';
	return sum<=9*x;
}

int main(){
	cin>>s;
	string t;
	int tmp=0;
	reverse(s.begin(),s.end());
	for(int i=0;i<s.size();i++){
		tmp+=(s[i]-'0')*9;
		t+=(char)('0'+tmp%10);
		tmp/=10;
	}
	while(tmp){
		t+=(char)('0'+tmp%10);
		tmp/=10;
	}
	s=t;
	int l=0,r=inf;
	while(r-l>1){
		int m=(l+r)/2;
		if(f(m)) r=m;
		else l=m;
	}
	cout<<r<<endl;
}

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

int main()
{
	long long r, d, x;
	cin >> r >> d >> x;
	for (int i = 0; i < 10; ++i)
	{
		x = r * x - d;
		cout << x << endl;
	}


	system("pause");
	return 0;
}

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

class Dice{
private:
  int tmp;
public:
  int q[6];
  void roll(char d){
    if(d=='N'){
      tmp = q[4];
      q[4] = q[0];
      q[0] = q[1];
      q[1] = q[5];
      q[5] = tmp;
    } else if(d=='E'){
      tmp = q[2];
      q[2] = q[0];
      q[0] = q[3];
      q[3] = q[5];
      q[5] = tmp;
    } else if(d=='W'){
      tmp = q[3];
      q[3] = q[0];
      q[0] = q[2];
      q[2] = q[5];
      q[5] = tmp;
    } else if(d=='S'){
      tmp = q[1];
      q[1] = q[0];
      q[0] = q[4];
      q[4] = q[5];
      q[5] = tmp;
    }
  }
};


int main(){
  Dice d, e;
  for(int i=0; i<6; i++){
    cin >> d.q[i];
  }
  for(int i=0; i<6; i++){
    cin >> e.q[i];
  }

  for(int i=0; i<=6;i++){//上の面を揃える
    //cout << "a";
    if(i==5){
      d.roll('E');
    } else if(i==6) {
      d.roll('E');
      d.roll('E');
    } else d.roll('N');
    //cout << d.q[0] << " " << d.q[1] << endl;
    if(d.q[0]==e.q[0])break;
  }
  for(int i=0; i<=4;i++){//上の面を固定したまま、横の面をぐるっと一周
    //cout << "b";
    d.roll('E');
    d.roll('N');
    d.roll('W');
    //cout << d.q[0] << " " << d.q[1] << endl;
    if(d.q[0]==e.q[0]&&d.q[1]==e.q[1])break;
  }
  int ans=1;
  for(int i=0; i<6; i++){
    ans*=(d.q[i]==e.q[i]);
  }
  if(ans==0)cout << "No" << endl;
  else cout << "Yes" << endl;
}



Measured memory_bytes: 3100
n = int(input())
s = str(input())
R = s.count("R")
B = s.count("B")
G = s.count("G")
ans = R*G*B
cnt = 0
for i in range(2000):
    for j in range(0, n-2*i):
        if s[j] != s[j+i] and s[j+i] != s[j+2*i] and s[j] != s[j+2*i]:
            cnt += 1
print(ans - cnt)

Measured memory_bytes: 67912
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = (int)(a); i <= (int)(n); ++i)
#define rrep(i, a, n) for (int i = (int)(a); i >= (int)(n); --i)
#define debug(x) cerr << #x << " = " << x << "\n"
#define debugv(x) \
  rep(f, 0, (x.size() - 1)) cerr << x[f] << (f == (x.size() - 1) ? "\n" : " ")
#define all(x) x.begin(), x.end()
#define int long long
using namespace std;
typedef pair<int, int> pii;
typedef vector<int> vi;
const int MX = 1e5 + 5, INF = 5 << 28, MOD = 1e9 + 7;

int N, M, K;
vector<int> A, B;
string S, T;

void input() {
  cin>>N;
  B.resize(N-1);
  rep(i,0,N-2){
    cin>>B[i];
  }
}
void solve() {
  int ans = 0;

  A.resize(N+2);

A[0] = B[0];
rep(i,1,N-1){
  A[i] = min(B[i-1],B[i]);
  if (i==N-1){
    A[i]=B[i-1];
  }
}
debugv(A);
for(auto x : A){
  ans += x;
}
  ;
  cout<<ans<<endl;
}
signed main() {
  input();
  solve();
  return 0;
}

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

using namespace std;
using ull = unsigned long long;
using ll = long long;
using lli = long long int;
using ld = long double;
using pa = pair<int,int>;
using ppa = pair<pa,int>;
#define SORT(v, n) sort(v, v+n);
#define ALL(v) v.begin(),v.end()
#define VSORT(v) sort(ALL(v))
#define GRESORT(v) sort(ALL(v),greater<ll>())
#define REVERSE(v) reverse(ALL(v))
#define overlap(v) v.erase(unique(ALL(v)),v.end())
#define debug(x) cout << #x << ": " << x << endl
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,n) FOR(i,0,n)
#define RFOR(i,a,b) for(int i = (b-1); i >= a; i--)
#define rrep(i,n) RFOR(i,0,n)
#define INF INT_MAX
#define SUP INT_MIN
#define mins(a,b) a = min(a,b)
#define maxs(a,b) a = max(a,b)

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

//8近傍
//int dy[]={0,0,1,-1,1,1,-1,-1};
//int dx[]={1,-1,0,0,1,-1,1,-1};

const ll MOD = 1000000007;

ll pow_mod(ll a,ll b,ll mod){
    ll tmp = 1;
    a %= mod;
    if(b > 0){
        tmp = pow_mod(a, b/2, mod);
        if(b % 2) tmp = (((tmp*tmp)%mod)*a)%mod;
        else tmp = (tmp*tmp)%mod;
    }
    return tmp;
}

void solve() {
    int n; cin >> n;
    vector<int> odd;
    vector<int> a(n);
    rep(i,n){
        cin >> a[i];
        if(i%2 == 0) odd.push_back(a[i]);
    }
    VSORT(odd); VSORT(a);
    int cnt = 0;
    rep(i,odd.size()){
        int c = 0;
        while(odd[i] != a[c]) c++;
        if(c % 2 == 1) cnt++;
    }
    cout << cnt << endl;
}

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

    solve();

    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define ll long long
#define MAXN 2000005
using namespace std;
using namespace __gnu_pbds;  

int n,m;

int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	cout.tie(NULL);
	cin>>n>>m;
	if(n<=1 && m<=1) cout<<0<<endl;
	else if(n<=1) cout<<(m*(m-1)/2)<<endl;
	else if(m<=1) cout<<(n*(n-1)/2)<<endl;
	else cout<<((m*(m-1))/2)+((n*(n-1))/2)<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int INF = 1e10;
const int MOD = 1e9 + 7;
#define dump(x) cout << #x << " = " << (x) << endl;
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define P pair<int, int>
#define V vector<int>
#define M map<int, int>
#define S set<int>

void solve()
{
}

signed main()
{
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int a, b;
    cin >> a >> b;
    int ans;
    if (b == 1) {
        ans = 0;
    } else {
        ans = a - b;
    }
    cout << ans << endl;
    solve();
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main()
{
	long long i, n, m;
	long long ans;
	scanf("%lld %lld", &n, &m);
	ans = 1;
	if(n == m || n % m == 0 )
	{
		printf("-1\n");
	}
	else
	{
		for(i = 2 ; i <= 1000000 ; i++)
		{
			ans = i * n;
			if(ans % m != 0)
			{
				printf("%lld\n",ans);
				break;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 128
#include <iostream>                                                             
#include <string>                                                               
using namespace std;                                                            
int main(){                                                                     
	string S,J;                                                                    
	int i,j;                                                                       
	cin>>S>>J;                                                                     
	if (S.compare(J) == 0) {                                                       
		cout<<"Yes";                                                                  
		return 0;                                                                     
	}                                                                              
	for(i = 1;i<J.size();i++){                                                     
		if(S.compare(J.substr(J.size()-i,i) + J.substr(0,J.size()-i))==0) break;      
	}                                                                              
	if(i!=S.size()) cout<<"Yes";                                                   
	else cout<<"No";                                                               
}                                                                               

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <ctype.h>
#include <map>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <cctype>
#include <queue>
#define REP(i,n) for(int i=0;i<(int)n;++i)
#define REP1(j,n) for(int j=0;j<(int)n;++j)
#define REPD(i,n) for(int i=n;i>=0;--i)
#define REPD1(j,n) for(int j=n;j=>0;--j)
#define REPS(i,n) for(int i=1;i<=(int)n;++i)
#define REPS1(j,n) for(int j=1;j<=(int)n;++j)
#define rep(i,a,n) for(int i=a;i<=(int)n;++i)
#define SZ(x) ((int)(x).size())	//size() unsigned -> int
#define DescSort(a) sort(a.begin(),a.end(),std::greater<int>())

using namespace std;
typedef long long ll;
const ll INF=1e9+7;

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

Measured memory_bytes: 256
const input=require('fs').readFileSync('/dev/stdin', 'utf8').split(/[\s]/);const nin=()=>{const r = input[0];input.shift();return Number(r)};const nrin=(n)=>{const a:number[]=[];rep(n,()=>a.push(nin()));return a};const sin=()=>{const r = input[0];input.shift();return String(r)};const out=(...a)=>{console.log(...a)};const floor=(a)=>{return Math.floor(a)};const abs=(a)=>{return Math.abs(a)};const min=(...a)=>{return Math.min(...a)};const max=(...a)=>{return Math.max(...a)};const rep=(n, callback)=>{for(let i = 0;i < n; i++){callback()}};const strrep=(s, i, v)=>{return s.slice(0, i)+v+s.slice(i+1);};const permutation=({result=[],pre=[],post,n=post.length})=>{if(n>0){post.forEach((_,i)=>{const rest=[...post];const elem=rest.splice(i, 1);permutation({result, pre: [...pre,...elem],post:rest,n:n-1})})}else{result.push(pre)}return result};const sw=(s,a:any[],op:'=='|'>='|'>'|'<='|'<'='==')=>{for(let i=0;i<a.length;i+=2){if(op==='=='){if(s==a[i])return a[i+1]}else if(op==='>='){if(s>=a[i])return a[i+1]}else if(op==='<='){if(s<=a[i])return a[i+1]}else if(op==='>'){if(s>a[i])return a[i+1]}else if(op==='<'){if(s<a[i])return a[i+1]}}return a[a.length-1];};const or=(a,...b)=>{for(let i=0;i<b.length;i++)if(a==b[i])return true;return false};const maxindex=(...a)=>{return a.indexOf(Math.max.apply(null,a))};const asc=(ar:number[])=>{return ar.sort((a,b)=>{return a-b})};const desc=(ar:number[])=>{return ar.sort((a,b)=>{return b-a})};const ceil=a=>{return Math.ceil(a)};const srin=s=>{const a:string[]=[];rep(s,()=>a.push(sin()));return a};let ssinteger=-1;const ssin=()=>{ssinteger++;return input[0][ssinteger]};
const main = ()=>{
  out(max(nin()*nin(),nin()*nin()))
}
main()

Measured memory_bytes: 7372
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
int n;
string s;
int main(void){
  cin >> n;
  for(int k = 0; k < n; k++){
    cin >> s;
    bool f = true;
    if(s[0]== '>' && s[1]=='\''){
      int c=0;
      int i;
      for(i = 2; s[i]=='='; i++) c++;
      if(c && s[i]=='#'){
	for(i += 1; s[i]=='='; i++) c--;
	if(!c && (int)s.size() == i+1 && s[i]=='~'){
	  cout << 'A' << endl;
	  f = false;
	}
      }
    }
    else if(s[0]== '>' && s[1]=='^' && s[2]=='Q' && s[3]=='='){
      int i;
      for(i = 4; s[i]=='Q' && s[i+1]=='='; i+=2);
      if((int)s.size() == i+2 && s[i]=='~' && s[i+1]=='~'){
	  cout << 'B' << endl;
	  f = false;
      }
    }
    if(f){
      cout << "NA" << endl;
    }
  }
}

Measured memory_bytes: 1200
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <map>
#include <numeric>
#include <cmath>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <complex>
#include <string.h>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <iomanip>
#include <sys/time.h>
#include <random>
using namespace std;

#define endl '\n'
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define UNIQ(v) (v).erase(unique((v).begin(), (v).end()), (v).end())

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
typedef tuple<int, int, int> T;
typedef complex<double> comp;
typedef vector< vector<ld> > matrix;
struct pairhash {
public:
    template<typename T, typename U>
    size_t operator()(const pair<T, U> &x) const {
	size_t seed = hash<T>()(x.first);
	return hash<U>()(x.second) + 0x9e3779b9 + (seed<<6) + (seed>>2);
    }
};
const int inf = 1e9 + 9;
const ll mod = 1e9 + 7;
const double eps = 1e-8;
const double pi = acos(-1);

int n;
string s;

int b[200100], w[200100];

int solve() {
    for (int i = 1; i <= n; i++) {
        b[i] = b[i-1];
        if (s[i-1] == '#') b[i]++;
    }
    for (int i = n-1; i >= 0; i--) {
        w[i] = w[i+1];
        if (s[i] == '.') w[i]++;
    }
    
    int res = inf;
    for (int i = 0; i <= n; i++) {
        res = min(res, b[i]+w[i]);
    }
    return res;
}

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

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

    input();
    cout << solve() << endl;
}


Measured memory_bytes: 4876
import itertools

n, *l = map(int, open(0).read().split())

def f(a,b,c):
    return a+b>c and b+c>a and a+c>b


a=0
for t in itertools.combinations(range(n), 3):
    s=[l[i] for i in t]
    if len(s) != len(set(s)):
        continue
    if f(*s):
        a+=1

print(a)


Measured memory_bytes: 68420
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A,B,C,X;
  cin>>A>>B>>C>>X;
  
  int i,j,k,a=0;
  for(i=0;i<=A;i++){
    for(j=0;j<=B;j++){
      for(k=0;k<=C;k++){
        if(X==i*500+j*100+k*50){
          a++;
        }
      }
    }
  }
  cout <<a<<endl;
}



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

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

    int ans = -1;
    for(int i = 1; i <= 11000; i++){
        int A = floor(double(i) * 0.08);
        int B = floor(double(i) * 0.1);
        if(A == a && B == b){
            ans = i;
            break;
        }
    }
    cout << ans << endl;
}

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

#define FI(i,a,b) for(int i=(a);i<=(b);i++)
#define FD(i,a,b) for(int i=(a);i>=(b);i--)

#define LL long long
#define Ldouble long double
#define PI 3.14159265358979323846264338327950288419

#define PII pair<int,int>
#define PLL pair<LL,LL>
#define mp make_pair
#define fi first
#define se second

using namespace std;

int s[100005], ori[100005];
int n, grid[3][100005];

void gg(){
	printf("No\n");
	exit(0);
}

int bit[100005], inv;

int f(int x){
	int ret = 0;
	for(int i = x; i; i -= i & (-i)) ret += bit[i];
	return ret;
}

void upd(int x){
	for(int i = x; i <= n; i += i & (-i)) bit[i]++;
}
	
int main(){
	scanf("%d", &n);
	FI(i, 0, 2) FI(j, 1, n) scanf("%d", &grid[i][j]);
	//check if well-formed
	FI(i, 1, n){
		int u = grid[0][i];
		if(u % 3 == 1){
			if(grid[1][i] - grid[0][i] != 1 || grid[2][i] - grid[1][i] != 1){
				gg();
			}
			s[i] = u / 3 + 1;
			ori[i] = 0;
		}
		else{
			if(grid[0][i] - grid[1][i] != 1 || grid[1][i] - grid[2][i] != 1){
				gg();
			}
			s[i] = u / 3;
			ori[i] = 1;
		}
	}
	//check odd/even
	FI(i, 1, n) if((s[i] & 1) ^ (i & 1)) gg();
	
	//check "inversions"
	inv = 0;
	
	FI(i, 1, n - 1){
		i++;
		if(ori[i]) inv ^= 1;
	}
	FI(i, 1, n){
		inv = (inv + i / 2 - f(s[i])) % 2;
		upd(s[i]);
		i++;
	}
	if(inv & 1) gg();
	
	inv = 0;
	memset(bit, 0, sizeof(bit));
	FI(i, 1, n){
		if(ori[i]) inv ^= 1;
		i++;
	}
	FI(i, 1, n - 1){
		i++;
		inv = (inv + i / 2 - 1 - f(s[i]));
		upd(s[i]);
	}
	if(inv & 1) gg();
	printf("Yes\n");
	return 0;
}


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

int main()
{
    int n;
    cin>>n;
    string s;
    cin>>s;
    for(int i=0;i<s.size();i++)
    {
        s[i]='A'+(s[i]-'A'+n)%26;
    }
    cout<<s<<"\n";
    return 0;
}

Measured memory_bytes: 256
#include<cmath>
#include<cstdlib>
#include<string>
#include<sstream>
#include<vector>
#include<iostream>
#include<queue>
#include<deque>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<algorithm>
using namespace std;

int main(){
  int N;
  vector<int> a;
  cin >> N;

  a.resize(N);
  for(int i=0; i<N; i++) cin >> a[i];

  long long m;
  int k;
  while(true) {
    sort(a.begin(), a.end());

    for(int i=0; i<N; i++) {
      if(a[i] != 0) {
        m = a[i];
        k = i;
        break;
      }
    }

    int c = 0;
    for(int i=0; i<N; i++) {
      if(i != k) a[i] = a[i] % m;
      if(a[i] == 0) c++;
    }

    if(c==N-1) break;
  }

  cout << m << endl;
}


Measured memory_bytes: 640
N = int(input())
res=0
first, end, both = 0, 0, 0


for i in range(N):
    str = input()
    res+=str.count("AB")
    if str[0]=="B":
        first+=1
    if str[-1]=="A":
        end+=1
    if str[0]=="B" and str[-1]=="A":
        both+=1

res+=min(first, end)
if both==max(first, end) and both!=0:
    res-=1

print(res)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
 
using namespace std;
 
#define MAX 1200
#define LIMIT 1000100
typedef pair<int,int> pii;
 
int M,N;
int caves[MAX][MAX];
int dp[MAX][MAX];
map<int,pii> mp;
bool prime[LIMIT];
 
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,-1,0,1};
 
void makePrime(){
    fill(prime,prime+LIMIT,true);
    prime[0] = prime[1] = false;
    for(int i = 2 ; i*i < LIMIT ; i++){
	if(prime[i]){
	    for(int j = i*2 ; j < LIMIT ; j+=i){
		prime[j] = false;
	    }
	}
    }
}
 
void makeCaves(){
    int x = 600,y = 600,dir = 0;
    int num = 1,cnt = 1;
    while(true){
	if(cnt == LIMIT) break;
	for(int i = 0 ; i < 2 ; i++){
	    for(int j = 0 ; j < num ; j++){
		mp[cnt] = pii(y,x);
		caves[y][x] = cnt++;
		if(cnt == LIMIT){
		    return;
		}
		x += dx[dir];
		y += dy[dir];
	    }
	    dir = (dir+1)%4;   
	}
	num++;
    }
}
 
void solve(int sx,int sy){
    dp[sy][sx] = prime[caves[sy][sx]];
    for(int i = 0 ; i < MAX-1 ; i++){
	for(int j = 1 ; j < MAX-1 ; j++){
	    if(dp[i][j] >= 0 && caves[i][j] <= M){
		if(caves[i+1][j-1] <= M){
		    dp[i+1][j-1] = max(dp[i+1][j-1],dp[i][j]+prime[caves[i+1][j-1]]); 
		}
		if(caves[i+1][j] <= M){
		    dp[i+1][j] = max(dp[i+1][j],dp[i][j]+prime[caves[i+1][j]]); 
		}
		if(caves[i+1][j+1] <= M){
		    dp[i+1][j+1] = max(dp[i+1][j+1],dp[i][j]+prime[caves[i+1][j+1]]); 
		}
	    }
	}
    }
    int res = 0, num = 0;
    for(int i = 0 ; i < MAX ; i++){
	for(int j = 0 ; j < MAX ; j++){
	    if(caves[i][j] <= M && prime[caves[i][j]]){
		if(res < dp[i][j]){
		    res = dp[i][j];
		    num = caves[i][j];
		}else if(res == dp[i][j]){
		    if(num < caves[i][j]){
			num = caves[i][j];
		    }
		}
	    }
	}
    }
    cout << res << " " << num << endl;
}
 
int main(){
    makeCaves();
    makePrime();
    while(cin >> M >> N, M){
	pii src = mp[N];
	memset(dp,-1,sizeof(dp));
	solve(src.second,src.first);
    }
    return 0;
}

Measured memory_bytes: 76892
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>

using namespace std;

int main(){
  int d;
  cin >> d;
  vector<int> c(26),tmp(26);
  vector<vector<int>> s;
  for(int i=0;i<26;i++){
    cin >> c[i];
  }
  for(int i=0;i<d;i++){
    for(int j=0;j<26;j++){
      cin >> tmp[j];
    }
    s.push_back(tmp);
  }
  vector<int> t(d);
  for(int i=0;i<d;i++){
    cin >> t[i];
  }
  
  vector<int> v(d+1,0),last(26,0);
  for(int i=1;i<d+1;i++){
    last[t[i-1]-1] = i;
    v[i] = v[i-1] + s[i-1][t[i-1]-1];
    for(int j=0;j<26;j++){
      if(j!=t[i-1]-1){
        v[i] -= c[j] * (i - last[j]);
      }
    }
  }
  
  for(int i=1;i<=d;i++){
    cout << v[i] << endl;
  }
  return 0;
}

Measured memory_bytes: 3684
#include <bits/stdc++.h>
#define ll long long
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL)
#define fr(i,a,b) for(int i=a;i<b;i++)
#define frr(i,a,b) for(int i=a;i>=b;i--)
//vector
#define pb push_back
#define vi vector<int>
#define vl vector<ll>
#define pp pop_back
//pair
#define pi pair<int ,int >
#define mk make_pair
#define ff first
#define ss second
//set
#define si set<int>
#define sit set<int>::iterator 
using namespace std;
int main()
{
fast;
int x,n,t;cin>>x>>n;
int a[103]={0};
fr(i,0,n)
{
	cin>>t;
	a[t]=-1;
}
int ans=0,d=INT_MAX,cmp;
fr(i,0,102)
{
	if(a[i]==0)
	{
		cmp=abs(x-i);
		if(cmp<d)
		{
			ans=i;
			d=cmp;
		}
	}
}
cout<<ans;
return 0;
}

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

int main(){
  int A, B, C;
  cin >> A >> B >> C;

  if (B + C - A >= 0){
    cout << B + C - A << endl;
  }
  else{
    cout << 0 << endl;
  }
  return 0;
}

Measured memory_bytes: 256
n,t = map(int,input().split())
ab = []
for i in range(n):
  a,b = map(int,input().split())
  ab.append([a,b])
dp = [0] * (t)
ab.sort()
m = 0
for i,j in ab:
  pdp,dp = dp,[0] * (t)
  for k in range(t):
    dp[k] = pdp[k]
  for k in range(t):
    if k+i >= t:
      m = max(m,pdp[k]+j)
    else:
      dp[k+i] = max(dp[k+i],pdp[k]+j)
if m == 0:
  print(max(dp))
else:
  print(m)

Measured memory_bytes: 48344
#include <bits/stdc++.h>
using namespace std;
using ll = int_fast64_t;
using ull = uint_fast64_t;
using ld = long double;
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define rep1(i, n) for (ll i = 1; i < n; ++i)
ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }
template <typename T> void vecout(const T &v) {
  for (auto it = v.begin(); it != v.end();
       ++it, cout << (it != v.end() ? " " : "\n")) {
    cout << *it;
  }
}

void solve() {
  // main coding
  ll INF=1e18;
  ll n,w; cin>>n>>w;
  vector<ll> W(n+1),V(n+1);
  rep1(i,n+1) cin>>W[i]>>V[i];
  vector<vector<ll>> dp(100001,vector<ll>(n,INF));
  dp[0][0]=0;
  rep(v,100001) rep1(i,n+1) {
    if(v-V[i]>=0) dp[v][i]=min(dp[v][i-1],dp[v-V[i]][i-1]+W[i]);
    else dp[v][i]=dp[v][i-1];
  }
  for(ll i=100000;i>=0;--i) {
    if(dp[i][n]<=w) {
      cout<<i<<endl;
      exit(0);
    }
  }
}

int main() {
  cout << fixed << setprecision(10);
  solve();
  return 0;
}


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

int main(){
    int N, L;
    scanf("%d %d", &N, &L);
    
    char S[N][L+1];
    for(int i = 0; i < N; i++){
        scanf("%s", S[i]);
    }
    
    char tmp[L+1];
    int j;
    for(int p = 0; p < N; p++){
        for(int q = 0; q < N-1-p; q++){
            j = 0;
            while(S[q][j] == S[q+1][j]){
                j += 1;
            }
            if(S[q][j] > S[q+1][j]){
                for(int k = 0; k < L; k++){
                    tmp[k] = S[q][k];
                    S[q][k] = S[q+1][k];
                    S[q+1][k] = tmp[k];
                }
            }
        }
    }
    
    int r;
    for(r = 0; r < N; r++){
        printf("%s",S[r]);
    }
    printf("\n");
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define endl "\n"
#define se second
#define ll long long
#define inf 0x3f3f3f3f
#define fast    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int N = 3e5+10;
const ll mod =   1e9+7;

int main()
{  fast
string s;
cin>>s;
for(int i=0;i<s.size();i++)
{
	if(s[i]=='?')
	cout<<'D';
	else
	cout<<s[i];
}
}

Measured memory_bytes: 3772
#include<bits/stdc++.h>
using namespace std;
#define maxn 305
#define ll long long
ll dis[maxn][maxn];
ll a[maxn][maxn];
bool ok[maxn][maxn];
struct node
{
    int u,v;
    ll dis;
    bool operator < (const node& b)const{return dis<b.dis;}
}V[maxn*maxn];
main()
{
    int n;scanf("%d",&n);
    int cur=0;
    for(int i=1;i<=n;i++)for(int j=1;j<=n;j++)
    {
        scanf("%lld",&dis[i][j]);
        if(i<j)V[++cur]={i,j,dis[i][j]};
    }


    for(int k=1;k<=n;k++)
    {
        for(int i=1;i<=n;i++)
        {
            for(int j=1;j<=n;j++)
            {
                if(dis[i][j]>dis[i][k]+dis[k][j]){puts("-1");return 0;}
            }
        }
    }
    sort(V+1,V+cur+1);
    for(int i=1;i<=cur;i++)
    {
        int u=V[i].u,v=V[i].v,d=V[i].dis;
        if(ok[u][v])continue;
        a[u][v]=d;
        ok[u][v]=1,ok[v][u]=1;
        for(int t=1;t<=n;t++)
        {
            if(t==u || t==v)continue;
            if(d+dis[v][t]==dis[u][t])ok[u][t]=1,ok[t][u]=1;
            if(d+dis[u][t]==dis[v][t])ok[v][t]=1,ok[t][v]=1;
        }
    }
    ll ans=0;
    for(int i=1;i<=n;i++)for(int j=1;j<=n;j++)
        ans+=a[i][j];
    printf("%lld\n",ans);
    return 0;
}


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

int main(){
	int n,sum=0;
  	cin>>n;
  	
  	for(int i=n;i>0;i/=10){
    	sum+=i%10;
    }
  
  	if(n%sum)
      cout<<"No";
  	else
      cout<<"Yes";
  	
  	
}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
 
 
int main() {
	int N;
	cin >> N;
	string Nstr = to_string(N);
	int sum = 0;
	for(int i = 0; i < Nstr.size(); i++){
		sum += Nstr[i] - '0';
	}
	if(N % sum == 0){
		cout << "Yes" << endl;
	}
	else{
		cout << "No" << endl;
	}
	return 0;
}

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

using namespace std;

string days[7] = {"Wednesday", "Thursday", "Friday", "Saturday", "Sunday", "Monday", "Tuesday"};
int monthdays[] = {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

int main()
{
  int day, month;
  while(1)
  {
    cin >> month >> day;
    if(!month)
      break;

    for(int i = 1; i < month; i++)
      day += monthdays[i];

    cout << days[day % 7] << endl;
  }
  return 0;
}

Measured memory_bytes: 1192
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

#define int long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = 1000000007;
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; }

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

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N; cin >> N;
	cout << N * N << endl;
	return 0;
}

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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}

int nextInt() { int x; scanf("%d", &x); return x;}
ll nextLong() { ll x; scanf("%lld", &x); return x;}

const int MAX_N = 112345;
int A[MAX_N];
int B[MAX_N];
int tA[MAX_N];
int tB[MAX_N];
pair<int,int> P[MAX_N];

bool solve() {
  int N = nextInt();
  REP(i, N) A[i] = nextInt();
  REP(i, N) B[i] = nextInt();
  {
    REP(i, N) tA[i] = A[i];
    REP(i, N) tB[i] = B[i];
    sort(tA, tA + N);
    sort(tB, tB + N);
    REP(i, N) if (tA[i] > tB[i]) return false;

    for (int i = 1; i < N; i++) {
      swap(tA[i-1], tA[i]);
      if (tA[i] <= tB[i] && tA[i-1] <= tB[i-1]) return true;
      swap(tA[i-1], tA[i]);
    }
  }

  REP(i, N) P[i] = make_pair(A[i], B[i]);
  sort(P, P+N, [](const pair<int,int>&a, const pair<int,int>& b){
    return a.second < b.second;
  });
  REP(i, N) P[i] = make_pair(P[i].first, i);
  sort(P, P+N);

  int cycle_len = 0;
  int i = 0;
  do {
    i = P[i].second;
    cycle_len++;
  } while (i != 0);
  if (cycle_len == N) return false;
  return true;
}

int main2() {
  bool ans = solve();
  cout << (ans?"Yes":"No") << endl;
  return 0;
}

int main() {

#ifdef LOCAL
  for (;!cin.eof();cin>>ws)
#endif
    main2();
  return 0;
}

Measured memory_bytes: 2560
#include <iostream>
using namespace std;
 
int main()
{
  int H,W;
  while(1){
    cin >>H>>W;
    if(H==0 && W==0){break;}
    for(int i=0;i<H;i++){
      for(int j=0;j<W;j++){
        cout<<"#";
      }
      cout<<endl;
    }
    cout<<endl;
  }
  return 0;
}

Measured memory_bytes: 1156
import numpy as np

N,M,X = map(int, input().split())
CA = []

for i in range(N):
    CA.append(list(map(int, input().split())))

CA = np.array(CA)
CAsum = CA.sum(axis=0)
cmin = CAsum[0]

if np.any(CAsum[1:] < X):
    cmin = -1
else:
    for i in range(2**N):
        casum = np.zeros(M+1)
        for j in range(N):
            if((i >> j) & 1):
                casum += CA[j]
        if np.all(casum[1:] >= X):
            cmin = min(cmin,casum[0])

print(int(cmin))

Measured memory_bytes: 27184
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <map>
#include <unordered_map>
#include <set>
#include <deque>
#include <utility>

int main(){
  int N;
  scanf("%d", &N);
  std::vector<int > a(N);
  int xorsum=0;
  for (int i=0; i<N; i++){
    scanf("%d", &a[i]);
    xorsum = xorsum ^ a[i];
  }
  for (int i=0; i<N; i++){
    printf("%d%c", xorsum^a[i], (i==N-1)?'\n':' ');
  }
  return 0;
}
 

Measured memory_bytes: 3616
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<cmath>
#include<utility>
#include<set>
#include<complex>
#include<map>
#define vi vector<int>
#define vvi vector<vector<int> >
#define ll long long int
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<s;i++)
#define CC puts("-------ok--------");
#define all(in) in.begin(), in.end()
using namespace std;
typedef pair<int, int> pii;
#define MAX 99999999
typedef struct {
    int first;
    int secound;
    int third;
}pi;
vector<pi>v(3);
vector<pi>ans(3);
int main(){
    rep(i,3){
        cin>>v[i].first>>v[i].secound>>v[i].third;
        int temp=v[i].first*3600+v[i].secound*60+v[i].third;
        cin>>v[i].first>>v[i].secound>>v[i].third;
        int hoge=v[i].first*3600+v[i].secound*60+v[i].third;
        hoge-=temp;
        ans[i].first=hoge/3600; hoge=hoge%3600;
        ans[i].secound=hoge/60;hoge=hoge%60;
        ans[i].third=hoge;
    }rep(i,3)cout<<ans[i].first<<" "<<ans[i].secound<<" "<<ans[i].third<<endl;
}

Measured memory_bytes: 3072
A = [[int(i) for i in input().split()] for _ in range(3)]
N = int(input())
bingo = [[False] * 3 for _ in range(3)]
for _ in range(N):
    b = int(input())
    for i in range(3):
        for j in range(3):
            if A[i][j] == b:
                bingo[i][j] = True

flag = False

if bingo[0][0] == bingo[1][1] == bingo[2][2] == True:
    flag = True
if bingo[0][2] == bingo[1][1] == bingo[2][0] == True:
    flag = True
for i in range(3):
    tmp = True
    for j in range(3):
        if not bingo[i][j]:
            tmp = False
    flag |= tmp
for i in range(3):
    tmp = True
    for j in range(3):
        if not bingo[j][i]:
            tmp = False
    flag |= tmp

if flag:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
#pragma region template 2.4
#include <bits/stdc++.h>
using namespace std;
template <typename T>
using pq_asc = priority_queue<T, vector<T>, greater<T>>;
typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll, ll> ii;
typedef vector<ii> vii;
typedef vector<string> vs;
#define REP(i, n) for (ll i = 0; i < (n); ++i)
#define REP1(i, n) for (ll i = 1; i <= (n); ++i)
#define FOR(i, a) for (auto &i : a)
#define CH(f, x, y) x = f(x, y)
#define IN(T, x) \
    T x;         \
    cin >> x;
#define AIN(T, a, n) \
    vector<T> a(n);  \
    FOR(i, a)        \
    cin >> i;
#define A2IN(T1, a, T2, b, n) \
    vector<T1> a(n);          \
    vector<T2> b(n);          \
    REP(i, n)                 \
    cin >> a[i] >> b[i];
#define OUT(x) cout << (x) << endl;
#define FOUT(x) cout << fixed << setprecision(15) << (x) << endl;
#define ALL(a) (a).begin(), (a).end()
#define SORT(a) sort(ALL(a))
#define RSORT(a) \
    SORT(a);     \
    reverse(ALL(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define DUMPA(a)          \
    cout << #a << " = {"; \
    JOUT(ALL(a), cout, ", ") << "}" << endl;

template <typename T>
ostream &JOUT(T s, T e, ostream &os = cout, string sep = " ")
{
    if (s != e)
    {
        os << *s;
        ++s;
    }
    while (s != e)
    {
        os << sep << *s;
        ++s;
    }
    return os;
}

ostream &YES(bool cond, string yes = "Yes", string no = "No", ostream &os = cout)
{
    if (cond)
    {
        os << yes << endl;
    }
    else
    {
        os << no << endl;
    }
    return os;
}

template <typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p)
{
    os << '(' << p.first << ", " << p.second << ')';
    return os;
}

template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v)
{
    os << '[';
    JOUT(ALL(v), os, ", ") << ']';
    return os;
}

const ll INF = 1e18;
const ll MOD = 1e9 + 7;
#pragma endregion template

int main()
{
    IN(ll, R);
    OUT(2 * 3.1415 * R);
}


Measured memory_bytes: 3796
import java.util.Scanner

object Main {
  def solve(sc: => Scanner): Unit = {
    val H, W = sc.nextInt
    val A = Array.fill[Int](sc.nextInt)(sc.nextInt).zipWithIndex
    var B = Array.fill[Int](0)(0)
    for (i <- A) {
      B = B ++ Array.fill[Int](i._1)(i._2 + 1)
    }
    B.grouped(W).zipWithIndex.map { case (arr, idx) => if (idx % 2 == 0) (arr) else (arr.reverse) }.foreach(x => println(x.mkString(" ")))
  }

  def main(args: Array[String]): Unit = {
    val sc: Scanner = new Scanner(System.in)
    solve(sc)
  }
}

Measured memory_bytes: 94944
#include <bits/stdc++.h>
using i64 = long long;

int main() {
    i64 a, b;
    std::cin >> a >> b;
    if ((a & 1) != (b & 1)) std::cout << "IMPOSSIBLE" << std::endl;
    else std::cout << (a + b) / 2 << std::endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){

int maisu, number;
char mark;

bool cards[4][13]={
{false, false,false,false,false,false,false,false,false,false,false,false,false},
{false, false,false,false,false,false,false,false,false,false,false,false,false},
{false, false,false,false,false,false,false,false,false,false,false,false,false},
{false, false,false,false,false,false,false,false,false,false,false,false,false}
};

cin >> maisu;

    for(int i=0;i< maisu ; i++){
        cin >> mark;
        cin >> number;

        if (mark == 'S'){
        cards[0][number-1] = true;
        }else if(mark == 'H'){
        cards[1][number-1] = true;
        }else if(mark == 'C'){
        cards[2][number-1] = true;
        }else if(mark == 'D'){
        cards[3][number-1] = true;
        }
    }

    for(int i=0; i<4; i++){
        for(int j = 0;j < 13; j++){
            if(cards[i][j]==false){
                if(i==0){
                    cout << "S" << " " << j+1 << endl;
                }else if(i == 1){
                    cout << "H" << " " << j+1 << endl;
                }else if(i == 2){
                    cout << "C" << " " << j+1 << endl;
                }else if(i == 3){
                    cout << "D" << " " << j+1 << endl;
                }
            }
        }
    }
}



Measured memory_bytes: 3096