akhauriyash/Code-Regression huggingface dataset:
#define _CRT_SECURE_NO_WARNINGS
#include"bits/stdc++.h"
#define INF          1e9
#define INFLL        1e18
#define EPS          1e-9
#define MOD          1000000007
#define REP(i,n)     for(ll i=0,i##_len=(n);i<i##_len;++i)
#define REP1(i,n)    for(ll i=1,i##_len=(n);i<=i##_len;++i)
#define REPR(i,n)    for(ll i=(n)-1;i>=0;--i)
#define REPR1(i,n)   for(ll i=(n);i>0;--i)
#define REPC(i,obj)  for(auto i:obj)
#define ALL(obj)     (obj).begin(),(obj).end()
#define SETP(n)      cout<<fixed<<setprecision(n)
#define DELNL        cin.ignore(numeric_limits<streamsize>::max(),'\n')
#define VV(T,h,w)    vector<vector<T>>(h,vector<T>(w))
#define VVI(T,h,w,i) vector<vector<T>>(h,vector<T>(w,i))
using namespace std;
using ll = long long;
template<typename T = ll>inline T in() { T ret; cin >> ret; return ret; }

int main()
{
    ll n = in(), d = in();
    auto x = VV(ll, n, d);
    REP(i, n)REP(j, d)x[i][j] = in();
    ll ans = 0;
    REP(i, n - 1) {
        for (ll j = i + 1; j < n; ++j) {
            ll dis2 = 0;
            REP(k, d)dis2 += (x[i][k] - x[j][k]) * (x[i][k] - x[j][k]);
            for (ll k = 1;; ++k) {
                if (k * k > dis2)break;
                if (k * k == dis2)++ans;
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include<bits/stdc++.h>
#include <string>
#include <stdlib.h>
#include<cmath>
#include<cstdio>
#include<algorithm>
#include<fstream>
#include<typeinfo>
#define ll long long
#define ll long long
#define ld long double
#define vll vector<ll>
#define pll pair<ll,ll>
#define vpll vector<pll>
#define I insert 
#define pb push_back
#define F first
#define S second
#define endl "\n"
#define repi(i,a,b)  for(ll i=a;i<b;i++)
#define repj(j, a, b) for (ll j = a; j < b;j++)
#define vi vector<int>
#define pii pair<int, int>
#define vpii vector< pii >
#define mod 1000000007

using namespace std;


int factorial(int n){return (n==1 || n==0) ? 1: n * factorial(n - 1); }
int max3(int a,int b,int c){ return max(a, max(c, b));}
int gcd(int a,int b){if(a==0){return b;}else{return gcd(b % a, a);}}
ll power(ll a, ll n){if(n==1) return a; else if(n==0) return 1; else{ ll r = power(a, n / 2); if(n%2==0) return r * r; else return r * a * r;}}
int nCr(int n, int r) { return ((factorial(n)) / (factorial(n - r) * factorial(r))); }
double newPrecision(double n) {  return floor(pow(10,9)*n)/pow(10,9); }

struct pos {int x; int y;};
//bool cmp(const team& left,const team& right){return (right.x>left.x || (right.x==left.y && right.y>left.y));}

bool dfs(vector< vector<int> >& roads,int *visited, int i,int length){
    visited[i] = length;
    for (int j = 0; j < roads[i].size();j++){
        if(visited[roads[i][j]]==0){
            dfs(roads, visited, roads[i][j], length + 1);
        }
    }
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string s;
    cin >> s;
    if(s[1]=='B')
        cout << "ARC";
    else
        cout << "ABC";

            return 0;
}


Measured memory_bytes: 3620
#include <stdio.h>

int main (){
	int t, a, b;
	scanf("%d %d %d", &t, &a, &b);
	int sum =0;
	for (int i=1; i<=t; i++){
		int digitsum=0;
		int temp =i;
		while (temp !=0){
			digitsum = digitsum +temp%10;
			temp/=10;
		}
		if (digitsum >=a && digitsum <=b){
			sum += i;
		}
	}
	printf("%d\n", sum);
	return 0;
}

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

ll n;

void dfs(string s){
    if(s.size() == n){
        cout << s << endl;
        return;
    }
    char mx = 'a';
    rep(i, 0, s.size()){
        mx = max(mx, s[i]);
    }
    for(char i = 'a'; i < mx+2; i++){
        string tmp(s);
        tmp.push_back(i);
        dfs(tmp);
    }
}

int main(){
    cin >> n;
    dfs("a");
   return 0;
}

Measured memory_bytes: 1536
#include <iostream>
using namespace std;
int main(){
    int a,b,k,i;
    cin >> a >> b >> k;
    if(2*k >= b-a+1){
        for(i = a;i <= b;i++){
            cout << i << endl;
        }
    }
    else{
        for(i = a;i < (a+k);i++){
            cout << i << endl;
        }
        for(i = (b-k+1);i <= b;i++){
            cout << i << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
  int a,b,c,k,ans;
  cin>>a>>b>>c>>k;
  ans = max({a*(1<<k)+b+c,a+b*(1<<k)+c,a+b+c*(1<<k)});
  cout<<ans<<endl;
} 

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

using namespace std;

bool str_com(string s1, string s2){
    return s1[0] == s2[0] && s1[1] == s2[1];
}

int main() {
    int n, m;
    cin >> n >> m;
    vector<bool> a(n, false);
    vector<int> b(n, 0);
    int count_cor = 0, count_pen = 0;
    int p;
    string s;
    for(int i = 0; i < m; ++i){
        cin >> p >> s;
        if(!a[p-1]){
            if(s == "AC"){
                a[p-1] = true;
                ++count_cor;
                count_pen += b[p-1];
            }else if(s == "WA"){
                ++b[p-1];
            }
        }
    }
    cout << count_cor << ' ' << count_pen;
    return 0;
}

Measured memory_bytes: 640
// #define LOCAL
#define CPP_IO

#pragma region

#include <bits/stdc++.h>
using namespace std;
using ii = pair<int, int>;
using ll = long long;
using vi = vector<int>;

#define f first
#define s second

#ifdef LOCAL
#define debug cout
#else
#define debug \
    if (0) cout
#endif

#define DUMP(a) debug << #a " = " << (a) << "\n";
#define DUMP2(a, b) debug << #a " = " << (a) << " " #b " = " << (b) << "\n";
#define DUMP3(a, b, c) debug << #a " = " << (a) << " " #b " = " << (b) << " " #c " = " << (c) << "\n";
#define DUMP4(a, b, c, d) debug << #a " = " << (a) << " " #b " = " << (b) << " " #c " = " << (c) << " " #d " = " << (d) << "\n";

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

template <typename T, typename V>
ostream& operator<<(ostream& os, set<T, V> v) {
    os << "{ ";
    for (auto e : v) os << e << " ";
    return os << "}";
}

template <typename T, typename V, typename S>
ostream& operator<<(ostream& os, map<T, V, S> v) {
    os << "{ ";
    for (auto e : v) os << e << " ";
    return os << "}";
}

template <typename T, typename V>
ostream& operator<<(ostream& os, pair<T, V> x) {
    return os << "( " << x.first << ", " << x.second << " )";
}

template <typename T>
istream& operator>>(istream& is, vector<T>& v) {
    for (auto& e : v) is >> e;
    return is;
}

template <typename T, typename V>
istream& operator>>(istream& is, pair<T, V>& x) {
    return is >> x.first >> x.second;
}

void solve();

int main() {
#ifdef LOCAL
    freopen("data.txt", "r", stdin);
#else
#ifdef CPP_IO
    ios_base::sync_with_stdio(0);
    cin.tie(0);
#endif
#endif
    solve();
}

#pragma endregion

int n;
int numbits(int x) {
    int ans = 0;
    for (int i = 0; i < n; ++i) {
        ans += (x >> i) & 1;
    }
    DUMP2(x, ans);
    return ans;
}

int bit(int x, int i) {
    return (x >> i) & 1;
}

void f(int x, int end, set<int> cur) {
    // DUMP3(x, end, cur);
    int x0 = x, end0 = end;
    auto cur0 = cur;
    if (cur.size() == 1) {
        cout << x << " " << (x ^ (1 << (*cur.begin()))) << " ";
        return;
    }
    int j = -1;
    for (auto i : cur) {
        if (bit(x, i) != bit(end, i)) {
            j = i;
            break;
        }
    }
    // DUMP(j);
    assert(j != -1);
    cur.erase(j);
    int k = *cur.begin();

    end ^= 1 << k;
    end ^= 1 << j;
    f(x, end, cur);
    x = end;
    end ^= 1 << j;
    end ^= 1 << k;
    x ^= 1 << j;
    f(x, end, cur);
    // debug << "END OF ";
    // DUMP3(x0, end0, cur0);
}

bool used[(1 << 17) + 1];
void solve() {
    int a, b;
    cin >> n >> a >> b;
    if ((numbits(a) % 2) == (numbits(b) % 2)) {
        cout << "NO\n";
        return;
    }

    cout << "YES\n";
    set<int> cur;
    for (int i = 0; i < n; ++i) cur.insert(i);
    f(a, b, cur);
}

Measured memory_bytes: 1024
import java.util.*;

public class Main {
    public static void main(String[] args){
            Scanner sc = new Scanner(System.in);
            // get a integer
            int n = sc.nextInt();
            int x = 800 * n;
            int y = n / 15 * 200;
             // output
            System.out.println(x-y);
    }
}

Measured memory_bytes: 20820
#include <iostream>
#include <algorithm>
using namespace std;
bool f(string s){
  int n=s.length();
  if(n==0) return true;
  if(n%2) return false;
  char c = s[0];
  if(c==')'||c==']') return false;
  char d = (c=='(')?')':']';
  int lv=1;
  int l = -1;
  for(int i=1;i<n;++i){
    if(s[i]==d) --lv;
    if(s[i]==c) ++lv;
    if(!lv){
      l = i;
      break;
    }
  }
  if(l==-1) return false;
  return f(s.substr(1,l-1))&&f(s.substr(l+1,n-l-1));
}

int main(){
  string s;
  while(getline(cin,s),s!="."){
    int t1=0,t2=0;
    int n = s.length();
    string t="";
    for(int i=0;i<n;++i){
      if(s[i]=='(' ||
	 s[i]==')' ||
	 s[i]=='[' ||
	 s[i]==']') t+=s[i];
    }
    if(f(t)) cout << "yes" << endl;
    else cout << "no" << endl;
  }
  return 0;
}
  

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

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

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

const long long MOD = 1000000007;

int main(){
    int n;
    cin >> n;
    ll ans = 1;
    rep1(i, n) ans = ans * i % MOD;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3584
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <iostream>
#include <fstream>

#include<bits/stdc++.h>
using namespace std;

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

template<class T> bool chmin(T& a,T b){
    if(a > b){ a = b; return true; }else return false;
}
template<class T> bool chmax(T& a,T b){
    if(a < b){ a = b; return true; }else return false;
}

int64_t n,m;
vector<int64_t> g[100010];

int64_t dp[100010],used[100010];

class GLongestPath {
public:
	void solve(std::istream& cin, std::ostream& cout) {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(20);

        rep(i,100010)g[i].clear();
        fill(dp,dp+100010,0);
        fill(used,used + 100010,0);

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

        rep(i,n){
            if(!used[i]) dfs(i);
        }
        int64_t ans = 0;
        rep(i,n)chmax(ans,dp[i]);
        cout << ans - 1 << '\n';
	}

	int64_t  dfs(int x){

	    if(dp[x] > 0) return dp[x];

	    used[x] = 1;
	    int64_t res = 0;
	    for(int64_t i : g[x]){
	        chmax(res , dfs(i));
	    }
	    return dp[x] = res + 1;
	}

	void main2(istream& cin,ostream& cout){

	}
};


int main() {
	GLongestPath solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


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

int main(void) {

  long n,k;
  scanf("%ld %ld", &n, &k);
  long h[n];
  for (long i = 0; i < n; i++) {
    scanf("%ld", &h[i]);
  }
  long min[n];
  min[0] = 0;
  long cost;
  long current;
  for (long i = 1; i < n; i++) {
    current = -1;
    for (long j = i-k; j < i; j++) {
      if (j < 0) {
        j = 0;
      }
      cost = min[j]+labs(h[i]-h[j]);
      if (current == -1 || cost < current) {
        current = cost;
      }
    }
    min[i] = current;
  }
  printf("%ld\n", min[n-1]);

  return 0;
}

Measured memory_bytes: 1664
#include<bits/stdc++.h>
#define pb push_back
using namespace std;
int rd()
{
	int rx=0,fx=1;char c=getchar();
	while(c<48||c>57)
	{
		if(c=='-') fx=-1;
		c=getchar();
	}
	while(c>=48&&c<=57)
	{
		rx=rx*10+c-48;
		c=getchar();
	}
	return rx*fx;
}
const int N=4e5+50;
int n,id;
int sum[N],val[N],col[N],bel[N],ans[N],siz[N],sf[N];
vector<int> e[N];
void dfs(int rt,int x,int nf)
{
	bel[x]=rt;
	siz[x]=1;
	if(col[x]) val[id]++;
	for(int v:e[x])
	{
		if(v==nf) continue;
		if(v<rt)
		{
			if(v<sf[rt]) col[v]=col[x];
			dfs(rt,v,x);
			siz[x]+=siz[v];
		}
	}
}
void solve(int,int);
void srh(int rt,int x,int nf,int w)
{
	//if(x==92) printf("P%d %d %d %d\n",rt,x,nf,w-1);
	ans[x]=w;
	for(int v:e[x])
	{
		if(v==nf) continue;
		if(v<rt) srh(rt,v,x,w);
		else solve(v,x);
	}
}
void solve(int rt,int nf)
{
	sf[rt]=bel[nf];
	bel[rt]=rt;
	col[rt]=1;
	siz[rt]=1;
	val[rt]=1;
	for(int v:e[rt])
	{
		if(v==nf||v>rt) continue;
		id=v;
		if(v<sf[rt]) col[v]=1;
		dfs(rt,v,rt);
		siz[rt]+=siz[v];
		val[rt]+=val[v];
	}
	ans[rt]=ans[nf]+val[rt];
	//printf("solve %d %d\n",rt,sum[rt]);
	for(int v:e[rt])
	{
		if(v==nf) continue;
		if(v<rt) srh(rt,v,rt,ans[rt]-val[v]+siz[v]);
		else solve(v,rt);
	}
}
int main()
{
	int i,u,v;
	n=rd();
	for(i=1;i<n;i++)
	{
		u=rd();v=rd();
		e[u].pb(v);e[v].pb(u);
	}
	solve(1,0);
	for(i=2;i<=n;i++) printf("%d ",ans[i]-1);
	return 0;
}

Measured memory_bytes: 41856
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int maxn = 1e5 + 5;
int dp[4005][4];
int main()
{
    ios::sync_with_stdio(false);
    int n ; cin >> n;
    string a; cin >>a;
    a = '#' + a;
    for (int i = n ; i >= 1 ; i --){
        for (int j = 1 ; j <= 3 ; j++){
            dp[i][j] = dp[i + 1][j];
        }
        if (a[i] == 'R') dp[i][1]++;
        else if (a[i] == 'G') dp[i][2]++;
        else dp[i][3]++;
    }
    for (int i = 1 ; i <= 4050 ; i++) a += '#';
    ll ans = 0 ;
    for (int i = 1 ; i <= n ; i++ ){
        for (int j = i + 1 ; j <= n ; j++){
            if(a[i] == a[j]) continue;
            if((a[i] == 'R' && a[j] == 'G') || (a[i] == 'G' && a[j] == 'R')){
                ans += dp[j][3];
                ans -= (a[j + (j - i)] == 'B');
            }
            if((a[i] == 'R' && a[j] == 'B') || (a[i] == 'B' && a[j] == 'R')){
                ans += dp[j][2];
                ans -= (a[j + (j - i)] == 'G');
            }
            if((a[i] == 'G' && a[j] == 'B') || (a[i] == 'B' && a[j] == 'G')){
                ans += dp[j][1];
                ans -= (a[j + (j - i)] == 'R');
            }

        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3744
#include <bits/stdc++.h>
 
using namespace std;
 
 
 
//c++ templte for help...........................................................
 
#define deb(x) cout<<#x<<" "<<x<<endl;/* for debuging  printing variable with name*/
#define debb(x,y) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<endl;										
//#define debbb(x,y,z) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<" "<<#z<<" "<<z<<endl;			
 
typedef long long ll;
	
 
//for loop
#define fo(i,n) for(int i=0;i<(ll)n;i++)
#define Fo(i,k,n) for(int i=k;i<n;i++)
 
 
//to print vector element 
template<typename T>
void printV(T vec){
	fo(i,vec.size()) cout<<vec[i]<<" "<<flush;
	cout<<endl;
	}
	
 
//#define modulo 1000000007
//const int INF=1e9+5;
 
//template<typename T>
//void printS(T st){
	//while(!st.empty()) {cout<<st.top()<<" ";st.pop();}
	//cout<<endl;
//}
 
 
 
//c++ template for help........................................................



int main() {
	//stringstream ss;
	//ss<<"akhil";
	//cout<<ss.str()<<endl;
	cout<<setprecision(16);
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	
	 // TESTCASE KO DEKH KA BHAUT SARA CONDITION GENERATE MAT KRO 
	 // PAPER PD CONFIRM HO JAO THORA JADA TIME HI KYU NA LGA
	 // greedy ma jadatr exceptional case check kr ke dekh lo
	 
	 // WHILE DOING THE QUESTION OF DYNAMIC PROGRAMMING GREEDY KA TRAH SOCHNA BAND KRO
	 // DP M DATA KA BHI USE KRNA PDTA HA BE BHULO MT 
	 // DP BHI WO LEETCODE WALE MATRIX KA QUESTION KI TARAH HA
	 // CONSTRAIN WILL BE THE DIMENSION OF DP
	 // DP MA STATE PTA KRO AUR PHIR FUNCTION GENERATE KRO
	 // OBJECT KO CHOOSE KIA YA NAE KIA AGAR KIA TO KYA HOGA AUR NAE KIA TO KYA HOGA
	 // KYA KYA CHEJ IMPORTANT HA WO STATE BN JYAGA AUR HUM LOG STATE KO CHANGE KR SKTA HA JYSA KNPSACK 2 WALE PROBLEM MA KIA THA
	 
	 
	
	string str;
	cin>>str;
	
	ll count=0;
	deque<char> dq;
	for(int i=0;i<(ll)str.size();i++){
		dq.push_back(str[i]);
	}

	
	ll q;
	cin>>q;
	bool truth =true;
	for(int i=0;i<q;i++){
		int t;
		cin>>t;
		if(t==1){
			if(truth) truth=false;
			else truth=true;
			count++;
		}else{
			int a;
			char c;
			cin>>a>>c;
			if(truth){
				if(a==1) dq.push_front(c);
				else dq.push_back(c);
			}else{
				if(a==1) dq.push_back(c);
				else dq.push_front(c);
			}
		}
	}
	
	if(count&1) reverse(dq.begin(),dq.end());
	
	for(int i=0;i<dq.size();i++){
		cout<<dq[i];
	}
	cout<<endl;
	 
	 

	
	
	return 0;
}


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

int main(){

  string s;

  while(cin >> s){

  for(int i=0;i<s.size();i++){
    if(s[i] == '@'){
      for(int j=0;j<s[i+1]-'0';j++) cout << s[i+2];
      i += 2;
    }
    else cout << s[i];
  }

  cout << endl;
  }

}

Measured memory_bytes: 1172
N , T = gets.split.map(&:to_i)
tt = gets.split.map(&:to_i)
# p tt
time = 0
# binding.pry
0.upto(tt.size - 2) do |i|
  if tt[i+1] - tt[i] < T
    time += tt[i+1] - tt[i]
  elsif tt[i+1] - tt[i] >= T
    time += T
  end
end
time += T
puts time

Measured memory_bytes: 16004
import collections
N = int(input())
S = []
for _ in range(N):
    S.append(input()) 
Slist=collections.Counter(S)

max_val = max(Slist.values())
keys_of_max_val = [key for key in Slist if Slist[key] == max_val]

result=sorted(keys_of_max_val)
[print(i) for i in result]

Measured memory_bytes: 36072
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <algorithm>
#include <stdint.h>
#include <queue>
#include <bitset>
#include <iomanip>
#include <set>
#include <map>

using namespace std;

#define PI (3.14159265358979323846)
#define INF (2147483647)
#define INF_LL (9223372036854775807)
#define DIV_NUM (1000000007)
typedef long long ll;

// 配列初期化テンプレ
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T& val) {
	std::fill((T*)array, (T*)(array + N), val);
}


int main() {

	int N;
	cin >> N;

	ll ans = 1;

	vector<ll> inputs;
	for (int i = 0; i < N; i++) {
		ll tmp;
		cin >> tmp;
		inputs.push_back(tmp);
		if (tmp == 0) {
			cout << "0" << endl;
			return 0;
		}
	}

	sort(inputs.begin(), inputs.end(), greater<ll>());

	for (int i = 0; i < N; i++) {
		if (inputs[i] > 2 * 1000000000000000000 / double(ans) ) {
			cout << "-1" << endl;
			return 0;
		}
		else {
			ans *= inputs[i];
		}

	}
	if (ans > 1000000000000000000) cout << "-1" << endl;
	else cout << ans << endl;


	return 0;

}


Measured memory_bytes: 4320
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		for (;;) {

			int i = sc.nextInt();
			int j = sc.nextInt();
			if (i == 0 && j == 0) {
				break;
			}
			System.out.printf("%d %d\n", Math.min(i, j), Math.max(i, j));
		}
		sc.close();
	}
}

Measured memory_bytes: 39528
#include <iostream>
using namespace std;
#define lld long long int

int main(){
  	lld a ,b,n;
  cin >> a >> b >>n;
	if(n >= b-1){
      cout << ((b-1)*a)/b ;
    }
  else
    cout << (n*a)/b - a*(n/b);
}

Measured memory_bytes: 3200
import math
N = int(input())
P = map(int, input().split())
Q = map(int, input().split())

a = 0
b = 0
nums = list(range(N+1)[1:])
for i, p in enumerate(P):
  if i+1 == N:
    break
  a += math.factorial(N-1-i) * (nums.index(p)) + 1
  nums.pop(nums.index(p))

nums = list(range(N+1)[1:])
for i, q in enumerate(Q):
  if i+1 == N:
    break
  b += math.factorial(N-1-i) * (nums.index(q)) + 1
  nums.pop(nums.index(q))

print(abs(a-b))

Measured memory_bytes: 38484
#include<iostream>
#include<vector>
#include<algorithm>
#include <queue>
#include<string>
#include<utility>

#define lli long long
#define all(i) i.begin(),i.end()
#define rall(i) i.rbegin(),i.rend()
#define rep0(i,j) for(lli i=0;i<j;i++)
#define rep1(i,j) for(lli i=1;i<=j;i++)
#define rep0d(i,j) for(lli i=j-1;i>=0;i--)
#define MAX 1000000007
typedef struct tree Tree;

using namespace std;


bool cmpf(pair<lli, lli> left, pair<lli, lli> right) {
	return left.first < right.first;
}

struct tree {
	queue<lli> leaf;
	lli num;
};

Tree t[200001];

void dfs(lli n, lli num) {
	t[n].num += num;
	while (!t[n].leaf.empty()) {
		dfs(t[n].leaf.front(), t[n].num);
		t[n].leaf.pop();
	}

}
int main() {
	lli n,k,ans=0;
	cin >> n;
	vector <pair<lli,lli>> vec(n);
	rep0(i,n){
		cin >> vec[i].first;
		vec[i].second=i+1;
	}
	sort(all(vec), cmpf);
	rep0(i,n)cout << vec[i].second << ' ' ;
}


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

int main() {
  vector<int>p(4);
  int o = 0,t = 0;
  rep(i,6){
    int a;
    cin >> a;
    a--;
    p[a]++;
  }
  rep(i,4){
    if(p[i] == 1) o++;
    if(p[i]== 2) t++;
  }
  if(o == 2 && t == 2) cout << "YES" << endl;
  else cout << "NO" << endl;
}

Measured memory_bytes: 256
a,b,c = map(int,input().split())
if a < b:
	if a <c:
		if b < c:
			print(a, b, c)
		else:
			print(a, c, b)
	else:
		print(c, a, b)
else:
	if b < c:
		if a < c:
			print(b, a, c)
		else:
			print(b, c, a)
	else:
		print(c, b, a)

Measured memory_bytes: 7652
#include <stdio.h>
int main(){
  int x;
  scanf("%d",&x);
  if(400<=x && x<600) printf("8");
  else if(600<=x && x<800) printf("7");
  else if(800<=x && x<1000) printf("6");
  else if(1000<=x && x<1200) printf("5");
  else if(1200<=x && x<1400) printf("4");
  else if(1400<=x && x<1600) printf("3");
  else if(1600<=x && x<1800) printf("2");
  else if(1800<=x && x<2000) printf("1");
  return 0;
}

Measured memory_bytes: 1660
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define MOD 1000000007
#define rep(i,n) for(i=0;i<(n);i++)
#define loop(i,a,n) for(i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define int ll
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;

signed main(void) {
    int i,j;
    int n, x;
    cin >> n >> x;
    vi a(n);
    rep(i,n) cin >> a[i];
    sort(all(a));
    i = 0;
    int sum = 0;
    while(sum + a[i] <= x && i < n-1){
        sum += a[i];
        i++;
    }
    if(sum + a[n-1] == x)i++;
    cout << i << endl;
}


Measured memory_bytes: 256
x,n = map(int,input().split())
p = list(map(int,input().split()))
zettaiti = float("inf")
for i in range(102):
    if i not in p:
        zettaiti2 = abs(i - x)
        if zettaiti > zettaiti2:
            zettaiti = zettaiti2
            ans = i
print(ans)

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

int H, W, ans, dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
char grid[1111][1111];
queue<pair<int, pair<int, int>>> que;

int main()
{
    cin >> H >> W;
    for (int i = 0; i < H; i++)
    {
        for (int j = 0; j < W; j++)
        {
            cin >> grid[i][j];
            if (grid[i][j] == '#')
                que.emplace(0, make_pair(i, j));
        }
    }

    while (!que.empty())
    {
        auto p = que.front();
        que.pop();
        int y = p.second.first, x = p.second.second, cnt = p.first;
        if (cnt != 0 && grid[y][x] == '#')
            continue;
        ans = max(cnt, ans), grid[y][x] = '#', cnt++;
        for (int i = 0; i < 4; i++)
        {
            int ny = y + dy[i], nx = x + dx[i];
            if ((ny < 0 || ny >= H) || (nx < 0 || nx >= W) || (grid[ny][nx] == '#'))
                continue;
            que.emplace(cnt, make_pair(ny, nx));
        }
    }
    cout << ans << endl;
}

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

using namespace std;

#define INF 1<<30
#define LINF 1ll<<60ll
#define MOD 1000000007
#define pb(a) push_back(a)
#define vi vector<int>
#define vl vector<long long>
#define vvi vector<vi>
#define P pair<int,int>
#define all(vec) (vec.begin()),(vec.end())
typedef long long ll;
typedef unsigned long long ull;
#define sz(x) ((int)(x).size())
#define in(x) int x;cin>>x
#define bit(n) (1<<(n))

#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i, n) for(int i = n;i >= 0;--i)
#define REP3(i, m, n) for(int i = m, i##_len=(n);i < i##_len;++i)
#define FORVEC(i, v) for(int i = 0;i < sz(v);++i)

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(a>b){a=b;return true;}return false;}

#define fil0(i,n) cout<<swet(n)<<setfill('0')<<i<<resetiosflags(ios_base::floatfield)
#define YES(n) cout<<((n)?"YES":"NO")<<endl
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
#define yes(n) cout<<((n)?"yes":"no")<<endl
#define possible(n) cout<<((n)?"possible":"impossible")<<endl
#define Possible(n) cout<<((n)?"Possible":"Impossible")<<endl


int main(){
    int x,y;
    set<int> group2{4,6,9,11};
    cin>>x>>y;
    if(x==2||y==2){
        Yes(0);
    }else{
        Yes(group2.count(x)==group2.count(y));
    }
    
    return 0;
}

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

#define pb push_back
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n,s) for(int i=(s);i<(n);i++)
#define rrep(i,n) for(int i=(n-1);i>=0;i--)
#define rreps(i,n,s) for(int i=s;i>=n;i--)
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 (a>b) { a=b; return 1; } return 0; }

using ll = long long;
using namespace std;
constexpr long long MAX = 5100000;
constexpr long long INF = 1LL << 60;
constexpr int MOD = 1000000007;

// //素因数分解
// map<ll,ll> get_div(ll n){
//     map<ll,ll> div;
//     ll num = n;
//     for (ll i=2; i * i < n; i++)
//     {
//         while(num%i==0){
//             div[i]++;
//              num /= i;
//              }
//     }
//     if(num>1)
//         div[num]++;

//     return div;
// }
vector<ll> yakusu(ll n) {
    vector<ll> res;
    for(ll i = 1; i*i <= n; i++) {
        if(n%i == 0) {
            res.pb(i);
            if(i != n/i) {
                res.pb(n/i);
            }
        }
    }
    sort(res.begin(),res.end());
    return res;  
}
 
int main(){
cin.tie(0);
ios::sync_with_stdio(false);
ll x;
cin >> x;
// map<ll, ll> div = get_div(x);
vector<ll> v=yakusu(x);
// if(div.size()==0){
//     div[1]++;
// }
ll a, b;
bool ok=false;

for (auto factor : v)
{
    // ll factor=v.first;
    reps(tmp_a,200,-200){
        // ll tmp_a = tmp_b+factor;
        ll tmp_b = tmp_a-factor;
        ll p=1,q=1;
        rep(i,5){
            p*=tmp_a;
            q*=tmp_b;
        }
        if (p-q == x)
        {
            ok = true;
            a = tmp_a;
            b = tmp_b;
        }
        if(ok){
            break;
        }
    }
    if(ok){
            break;
    }
}
cout << a << " " << b << endl;
return 0;
}

Measured memory_bytes: 3584
a,b,c = map(int,input().split())
if (a==b):
    if(c!=b):
        print("Yes")
    else:
        print("No")
elif(b==c):
    if(a!=b):
        print("Yes")
    else:
        print("No")
elif(a==c):
    if(a!=b):
        print("Yes")
    else:
        print("No")
else:
    print("No")

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,i;
    string s;
    cin>>n>>s;
    int p=s.size();
    for(i=0;i<p;i++)
    {
        int a=(s[i]+n-65)%26;
        char b=a+65;
        cout<<b;
        
    }
    return 0;
}

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

int main() {
  int s1s2s3;
  cin >> s1s2s3;
  cout << s1s2s3/100+(s1s2s3/10-s1s2s3/100*10)+(s1s2s3-s1s2s3/100*100-(s1s2s3/10-s1s2s3/100*10)*10)<< endl;
}

Measured memory_bytes: 3604
import math
import os
import sys

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7

N = int(sys.stdin.readline())
XY = [list(map(int, sys.stdin.readline().split())) for _ in range(N)]


def calc(bx, by):
    base = math.atan2(bx, by)

    d1 = []
    d2 = []
    for x, y in XY:
        deg = (math.atan2(x, y) - base) % (math.pi * 2)
        if deg < math.pi:
            d1.append((x, y))
        else:
            d2.append((x, y))

    x1 = 0
    y1 = 0
    x2 = 0
    y2 = 0
    for x, y in d1:
        x1 += x
        y1 += y
    for x, y in d2:
        x2 += x
        y2 += y

    return max(math.sqrt(x1 ** 2 + y1 ** 2), math.sqrt(x2 ** 2 + y2 ** 2))


ans = 0
for x, y in XY:
    ans = max(ans, calc(x, y))
print(ans)


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

int main() {
  int N, K, j, l;
  cin >> N >> K;

  // ここにプログラムを追記
  for (int i = 0; i < N; i++) {
    cin >> j;
    if (j > K - j) {
      l += (K - j) * 2;
    }
    else {
      l += j * 2;
    }
  }
  
  cout << l << endl;
}


Measured memory_bytes: 256
'use strict';
(function(stdin) {
  var line  = stdin.toString().split('\n');
  var param = line[0].split(' ').map(Number);
  var result = (function(a,b) {
     
    if (a < b) {
        return 'a < b';
    } else if (a > b) {
        return 'a > b';
    } else {
        return 'a == b';
    }
 
  }(
    param[0],param[1]
  ));
  console.log(result);
}(require('fs').readFileSync('/dev/stdin', 'utf8')));

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

int main()
{
    int H, W;
    cin >> H >> W;

    vector<vector<char>> a(H + 2, vector<char>(W + 2, '#'));
    for (int i = 1; i < H + 1; i++)
    {
        for (int j = 1; j < W + 1; j++)
            cin >> a.at(i).at(j);
    }

    for (int i = 0; i < H + 2; i++)
    {
        for (int j = 0; j < W + 2; j++)
        {
            cout << a.at(i).at(j);
        }
        cout << endl;
    }
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <numeric>
#include <vector>

using namespace std;

void print(vector<int> &v) {
  cout << v[0];
  for (auto it = ++v.begin(); it != v.end(); ++it)
    cout << " " << *it;
  cout << endl;
}

int main() {
  int n;
  cin >> n;
  vector<int> A(n);
  iota(A.begin(), A.end(), 1);
  print(A);
  while (next_permutation(A.begin(), A.end()))
    print(A);
}


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

int main() {
  int n, l, ll = 0, sl = 0;
  cin >> n;
  REP(i, n) {
    cin >> l;
    sl += l;
    ll = max(l, ll);
  }
  if (ll < sl - ll) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
	int n,w[101],sum=0,half=0,j=1;
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%d",&w[i]);
		sum+=w[i];
	}
	while(half<sum/2){
		half+=w[j];
		j++;
	}
//	printf("%d\n%d\n%d",sum,half,j);
	printf("%d",(2*half-sum)>(sum-2*(half-w[j-1]))?(sum-2*(half-w[j-1])):(2*half-sum));
	return 0;
}

Measured memory_bytes: 128
//大文字->小文字 tolower(),逆はtoupper()
//int a = stoi(c); 文字列をintへ
//途中の出力をそのまま残さない
//数値計算 個数以外はdouble
//map<キー,値> p は辞書。p[キー] = 値
//map 全探索
//auto begin = p.begin(), end = p.end();
//for (auto it = begin; it != end; i++) {}
//mapのキー：it->first mapのバリュー：it->second
//絶対値 abs()
//入力は空白で切れる
//大文字判定 isupper(文字) 小文字判定 islower(文字)
//do{}while(next_permutation(ALL(配列)))
#include <bits/stdc++.h>
#define rep(i,N) for(int i = 0; i < N;i++)
#define ALL(a) (a).begin(),(a).end()
#define ll long long int
using namespace std;

// K進数でのNの桁数
ll dig(ll N,ll K) {
	ll dig = 0;
	while (N) {
		dig++;
		N /= K;
	}
	return dig;
}
// x,yの最大公約数
ll gcd(ll x, ll y) {
	ll r;
	while (x%y) {
		r = x % y;
		x = y;
		y = r;
	}
	return y;
}

int main() {
	string S; cin >> S;
	if (S[0] == S[1] && S[1] == S[2]) {
		cout << "No" << endl;
		return 0;
	}

	cout << "Yes" << endl;
}

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

using namespace std;

int main()
{
    string s[] = {"AC", "WA", "TLE", "RE"};
    int cnt[4] = {0};
    int n;
    cin >> n;
    for( int i = 0; i < n; i++ ){
        string v;
        cin >> v;
        for( int j = 0; j < 4; j++ )
            if(s[j] == v)
                cnt[j]++;
    }
    for( int i = 0; i < 4; i++ )
        cout << s[i] << " x " << cnt[i] << endl;
    return 0;
}

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

using namespace std;

#define LL long long

LL yoko_yoko(LL height, LL width) {
    LL res = 10000000001;
    for (LL a_height = 1; a_height < height; ++a_height) {
        LL Sa = a_height * width;
        LL Sb = max((height - a_height) / 2, 1LL) * width;
        LL Sc = height * width - Sa - Sb;
        res = min(res, max({Sa, Sb, Sc}) - min({Sa, Sb, Sc}));
    }
    return res;
}

LL yoko_tate(LL height, LL width) {
    LL res = 10000000001;
    for (LL a_height = 1; a_height < height; ++a_height) {
        LL Sa = a_height * width;
        LL Sb = (height - a_height) * max(width / 2, 1LL);
        LL Sc = height * width - Sa - Sb;
        res = min(res, max({Sa, Sb, Sc}) - min({Sa, Sb, Sc}));
    }
    return res;
}

int main() {
    LL H, W;
    cin >> H >> W;

    LL ans = min({yoko_yoko(H, W), yoko_yoko(W, H),
                  yoko_tate(H, W), yoko_tate(W, H)});
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
import bisect,collections,copy,itertools,math,string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
def main():
    s = S()
    
    llst = [0 for _ in range(len(s)+2)]
    rlst = [0 for _ in range(len(s)+2)]

    for i in range(1, len(s)+1):
        if s[i-1] == "<":
            llst[i] = llst[i-1] + 1
    
    for i in range(len(s)-1, -1, -1):
        if s[i] == ">":
            rlst[i] = rlst[i+1] + 1
    
    ans = 0

    for i in range(len(s)+1):
        ans += max(llst[i], rlst[i])

    print(ans)

main()


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

int N;
ll si,ti;

bool check(ll p,ll n){
  if(p<0)p*=-1;
  if(p%(1LL<<n)==0)return true;
  else return false;
}

int solve(){
  ll p=si;
  int res=0;
  while(p!=ti){
    res++;
    for(int i=30;i>=0;i--){
      ll d=(1LL<<i);
      if(!check(p,i))continue;
      if(p+d>ti)continue;
      p=p+d;
      break;
    }
  }
  return res;
}

int main(){
  cin>>N;
  for(int i=0;i<N;i++){
    cin>>si>>ti;
    cout<<solve()<<endl;
  }
  return 0;
}

Measured memory_bytes: 1168
N=int(input())
A=list(map(int, input().split()))

ans=0
uf=False
lf=False
pre=A[0]
for i in range(1,N):
  if pre==A[i]:
    continue
  
  if A[i]>pre:
    uf=True
    if lf:
      ans+=1
      uf=False
      lf=False
  else:
    lf=True
    if uf:
      ans+=1
      uf=False
      lf=False
  pre=A[i]

print(ans+1)
  

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

typedef long long ll;
/**
 * C問以降は ll を使う.
 * double型にするのを忘れない.
 * nC2の求め方 (1/2)*n*(n-1)
 * vector<型> 変数名(要素数, 初期値)
*/
int main()
{
  double a, b;
  cin >> a >> b;
  cout << int((a+b)/2+0.5) << endl;
    return 0;
}


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

int main(){
  int i=0;
char s1,s2,s3;
cin >> s1 >> s2 >> s3;
if(s1=='1'){i++;}
if(s2=='1'){i++;}
if(s3=='1'){i++;}
cout << i << endl;
}


Measured memory_bytes: 256
import java.util.HashMap;
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main{ 
	public static void main(String[] args) {
		try(Scanner sc = new Scanner(System.in)) {
			
			while(sc.hasNext()) {
				int n = sc.nextInt();
				if(n==0)break;
				Set<Integer> hm = new HashSet<Integer>(n);
				HashMap<Integer,Integer> h = new HashMap<>();
				boolean can = true;
				
				int[][] d = new int[n+1][n+1];
				int[] cnt = new int[n+1];
				for(int i=0;i<n;i++) {
					int a = sc.nextInt();
					for(int j=0;j<a;j++) {
						d[i][j] = sc.nextInt();
					}
					cnt[i] = a;
				}
				
				int a = sc.nextInt();
				int cc = 0;
				int[] han = new int[a+1];
				int ans = 0;
				for(int i=0;i<a;i++) {
					int o = sc.nextInt();
					han[i] = o;
					if(!h.containsKey(o))h.put(o, 1);
					else h.put(o, h.get(o)+1);
				}
				
				for(int i=0;i<n;i++) {
					hm.clear();
					can = true;
					for(int j=0;j<cnt[i];j++) {
						hm.add(d[i][j]);
					}
					
					for(int k=0;k<a;k++) {
						if(hm.contains(han[k])) {
							can = true;
							if(k==a-1)cc++;
						}
						else {
							can = false;
							break;
						}
					}
					if(can) {
						if(cc==1)
							ans = i+1;
						if(cc>1){
							can = false;
							break;
						}
					}
				}
				
				if(can || cc==1)System.out.println(ans);
				else
					System.out.println(-1);
				
			}
		}
	}
}



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

int main(){
  string S,T;
  cin >> S >> T;
  
  int mycount =0;
  for(int i=0;i<S.size();i++){
    if (S[i] != T[i]) mycount++;
  }
  cout << mycount << endl;
  
  return 0;
}

Measured memory_bytes: 3920
#include <cstdio>
#include <cctype>
#include <cstring>
#include <algorithm>
using std::swap;
using std::max;
using std::min;
using std::sort;

typedef long long LL;

const int N = 1010;

int n;
int a[N], b[N], c[N];

int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) scanf("%d", &a[i]);
  for (int i = 1; i <= n; ++i) scanf("%d", &b[i]);
  for (int i = 1; i <= n - 1; ++i) scanf("%d", &c[i]);
  int last = -2, ans = 0;
  for (int i = 1; i <= n; ++i) {
    if (a[i] == last + 1)
      ans += c[last];
    ans += b[a[i]];
    last = a[i];
  }
  printf("%d\n", ans);
  return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <map>
#include <string>
#include <sstream>
#include <math.h>
using namespace std;
//for (int i = 0; i < N; i++){}

int main() {
    int N;
	cin >> N;
    int A[N];

	map<int, int> mp;

    for (int i = 0; i < N; i++){
        cin >> A[i];
        mp[{A[i]}]++;
    }

    long long res = 1;
    if(N%2 == 1){
        for (int i = 1; i < N; i++){
                if(i%2 == 0){
                    if(mp[{i}] == 2){
                        res = (res * 2)%1000000007;
                        continue;
                    }
                    else{
                        cout << 0 << endl;
                        return 0;
                    }
                }
        }
    }else{
        for (int i = 1; i < N; i++){
            if(i%2 == 1){
                if(mp[{i}] == 2){
                    res = (res * 2)%1000000007;
                    continue;
                }
                else{
                    cout << 0 << endl;
                    return 0;
                }
            }
        }
    }
    cout << res << endl;
}

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

/* typedef */
/* long系 */
typedef long long ll;   // long long
typedef long double ld; // long double
/* vector系 */
typedef vector<int> vi;                    // intのvector
typedef vector<double> vd;                 // doubleのvector
typedef vector<ll> vll;                    // llのvector
typedef vector<ld> vld;                    // ldのvector
typedef vector<vector<int>> vvi;           // intの2次元vector
typedef vector<vector<double>> vvd;        // doubleの2次元vector
typedef vector<vector<ll>> vvll;           // llの2次元vector
typedef vector<vector<ld>> vvld;           // ldの2次元vector
typedef vector<pair<int, int>> vi_i;       // i_iのvector
typedef vector<pair<double, double>> vd_d; // d_dのvector
typedef vector<pair<ll, ll>> vl_l;         // l_lのvector
typedef vector<pair<ld, ld>> vld_ld;       // ld_ldのvector
typedef vector<string> vs;                 // stringのvector
/* pair系 */
typedef pair<int, int> i_i;       // int同士のpair
typedef pair<double, double> d_d; // double同士のpair
typedef pair<ll, ll> l_l;         // ll同士のpair
typedef pair<ld, ld> ld_ld;       // ld同士のpair

/* define */
#define all(v) v.begin(), v.end() // コンテナ全体
#define PI (acos(-1))             // 円周率pi

/* stringstream */
stringstream ss;
stringstream init_ss; // save default formatting

/* upper, lower */
struct ToUpper
{
    char operator()(char c)
    {
        return toupper(c);
    }
};
struct ToLower
{
    char operator()(char c)
    {
        return tolower(c);
    }
};

/* main */
void Main(void)
{
    int n;
    cin >> n;
    int ptaro = 0, phanako = 0;
    for (int i = 0; i < n; i++)
    {
        string staro, shanako;
        cin >> staro >> shanako;
        if (staro < shanako)
        {
            phanako += 3;
        }
        else if (staro > shanako)
        {
            ptaro += 3;
        }
        else
        {
            ptaro += 1;
            phanako += 1;
        }
    }
    cout << ptaro << " " << phanako << endl;
}

int main(int argc, char const *argv[])
{
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();

    return 0;
}



Measured memory_bytes: 3172
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#include <numeric>
typedef long long Int;
#define rep(i,a,b) for(Int i=a;i<b;++i)
#define rrep(i,a,b) for(Int i=a;i>=b;--i)
using namespace std;

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

    int N, M;
    map<string, int> words;
    
    cin >> N;
    rep(i, 0, N) {
      string s; cin >> s;
      words[s]++;
    }
    
    cin >> M;
    rep(i, 0, M) {
      string s; cin >> s;
      words[s]--;
    }
    
    int res = 0;
    for(auto word : words) {
      res = max(words[word.first], res);
    }
  
    cout << res << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<limits>
#include<sstream> 
#include<unordered_map>      

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;

const int inf = numeric_limits<int>::max() >> 2;
const ll linf = numeric_limits<ll>::max() >> 2;
const ull ulinf = numeric_limits<ull>::max() >> 2;
const double pi = acos(-1);
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int dx8[8]={-1,0,1,-1,1,-1,0,1};
const int dy8[8]={-1,-1,-1,0,0,1,1,1};

#define p_queue(i) priority_queue<i> 
#define rp_queue(i) priority_queue<i, vector<i>, greater<i>> 
#define umap(i,j) unordered_map<i,j>
#define P(p) cout<<(p)<<endl
#define PS(p) cout<<(p)<< " "
#define PN cout << endl
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i = (n-1); i >= (int)(m); i--)
#define inrep(n,a) for(int i = 0; i < (int)(n); i++)cin >> a[i];
#define mod(i) ((i)%(ll)(1e9 + 7))
#define divm(a,b) (mod(a * modpow((ll)b,(ll)(1e9+5))))
#define rsort(a,b,c) sort(a, b, greater<c>())
#define vsort(v) sort(v.begin(), v.end())
#define rvsort(v,c) sort(v.begin(), v.end(), greater<c>()) 
#define ft first
#define sd second
#define pb push_back
#define it insert
#define sz(x) ((int)(x).size())
#define lb(a,n,k) (lower_bound(a,a+n,k) - (a)) 
#define vlb(a,k)  (lower_bound(a.begin(),a.end(),k) - a.begin())
#define ub(a,n,k) (upper_bound(a,a+n,k) - (a)) 
#define vub(a,k)  (upper_bound(a.begin(),a.end(),k) - a.begin())
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return

/*
ll modpow(ll i,ll j){ ll tmp=1; while(j){ if(j%2)tmp=mod(tmp*i);i=mod(i*i);j/=2;}return tmp;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
*/

/*
vector<string> split(const string &str, char sep){
    vector<string> v;
    stringstream ss(str);
    string buffer;
    while( getline(ss, buffer, sep) ) {
        v.push_back(buffer);
    }
    return v;
}
*/

/*
ll ncr[100][100];
ll nCr(int n, int r){if(n==r) ret ncr[n][r] = 1; if(r==0) ret ncr[n][r] = 1; if(r==1) ret ncr[n][r] = n;if(ncr[n][r]) ret ncr[n][r]; ret ncr[n][r] = nCr(n-1,r) + nCr(n-1,r-1);}

ll npr[100][100]={};
ll nPr(int n,int r){if(npr[n][r])ret npr[n][r];if(r==0)ret npr[n][r] = 1;if(r==1)ret npr[n][r] = n;ret npr[n][r] = n * nPr(n-1,r-1);}

ll nHr(int n,int r){ret nCr(n+r-1,r);}
*/

///////////////////////////////////////////////////////////////////////////



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

    int c = 0;
    rep(i,0,sz(s)/2){
	if(s[i] != s[sz(s)-1-i])c++;
    }
    P(c);
    return  0;
}


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

using namespace std;
int main()
{
    int i,j,k,l;
    cin>>i>>j>>k>>l;
    while(1){
        k=k-j;
        if(k<=0){
            cout<<"Yes"<<endl;
            return 0;
        }
        i=i-l;
        if(i<=0){
            cout<<"No"<<endl;
            return 0;
        }
    }
    return 0;
}


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


int main() {
  int n;
  int ans = 0, count = 0;
  cin >> n;
  vector<int> a(n);
  rep(i, n) cin >> a[i];
  for (int i = 1; i < n; i++) {
    if(a[i] <= a[i - 1]){
      count++;
    } else {
      ans = max(ans, count);
      count = 0;
    }
  }
  ans = max(ans, count);
  cout << ans << endl;
}

Measured memory_bytes: 640
import java.util.*;
public class Main{
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
      int n = sc.nextInt();
      int sn = (int) Math.sqrt(n);
      if(n == sn*sn){
      	System.out.println(n);
      }else{
      	System.out.println(sn*sn);
      }
    }
}


Measured memory_bytes: 22996
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

list1 = [a,b,c,d,e]

list2 = [a%10,b%10,c%10,d%10,e%10]  

for i in range(5):
    if list2[i] == 0:
        list2[i] += 10


for i in (range(4)):
        for j in range(4,i,-1):
            if list2[j] > list2[j-1]:
                list2[j],list2[j-1] = list2[j-1],list2[j]
                list1[j], list1[j-1] = list1[j-1], list1[j]

s = 0
for i in range(4):
    if int(list1[i])%10 != 0:
        s += int(list1[i])-int(list1[i])%10+10
    else:
        s += int(list1[i])

s += int(list1[4])

print(s)

Measured memory_bytes: 3064
s = list(str(input()))
count = 0
uppercount = 0
for i in range(len(s)):
    if s[i] == "C":
            count += 1
for c in s:
    if c.isupper():
        uppercount += 1

if s[0] == "A" and "C" in s[2:-1] and count == 1 and uppercount == 2:
    print("AC")
else:
    print("WA")

Measured memory_bytes: 3064