akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <string>

#include <cmath>
#include <queue>
#include <stack>

using namespace std;

#define LL long long

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

LL mod(LL x, LL md) {
	return ((x % md) + md) % md;
}

class Mint {
public:
	static LL md;
	LL x;
	Mint(LL _x = 0) {
		x = mod(_x, md);
	}
	Mint(const Mint &y) {
		x = mod(y.x, md);
	}
};

void MintMyExgcd(LL a, LL b, LL &x, LL &y) {
	// solve equation ax + by = 1 (mod m)
	LL md = Mint::md;
	if (b == 0) {
		y = 0;
		x = 1;
		return ;
	}
	MintMyExgcd(b, a % b, x, y);
	LL t = y;
	y = mod(x - (a / b) * y, md);
	x = t;
}

LL MintNY(LL x) {
	if (x == 0) {
		return 1;
	}
	LL md = Mint::md;
	LL a, b;
	MintMyExgcd(x, md, a, b);
	while (a < 0) {
		a += md;
	}
	return a;
}

/* LL gcd(LL a, LL b) {
	if (b == 0) {
		return a;
	}
	return gcd(b, a % b);
} */

Mint operator+(Mint a, Mint b) {
	return Mint(mod(a.x + b.x, Mint::md));
}
Mint operator-(Mint a, Mint b) {
	return Mint(mod(a.x - b.x, Mint::md));
}
Mint operator*(Mint a, Mint b) {
	return Mint(mod(a.x * b.x, Mint::md));
}
Mint operator/(Mint a, Mint b) {
	Mint c = Mint(MintNY(b.x));
	return Mint(mod(a.x * c.x, Mint::md));
}

Mint operator-(Mint a) {
	return Mint(-a.x);
}
bool operator==(Mint a, Mint b) {
	return a.x == b.x;
}
bool operator!=(Mint a, Mint b) {
	return a.x != b.x;
}
bool operator>(Mint a, Mint b) {
	return a.x > b.x;
}
bool operator<(Mint a, Mint b) {
	return a.x < b.x;
}
bool operator>=(Mint a, Mint b) {
	return a.x >= b.x;
}
bool operator<=(Mint a, Mint b) {
	return a.x <= b.x;
}

void operator+=(Mint &a, Mint b) {
	a = a + b;
}
void operator-=(Mint &a, Mint b) {
	a = a - b;
}
void operator*=(Mint &a, Mint b) {
	a = a * b;
}
void operator/=(Mint &a, Mint b) {
	a = a / b;
}

ostream& operator<<(ostream &out, Mint a) {
	out << a.x;
	return out;
}

istream& operator>>(istream &in, Mint &a) {
	in >> a.x;
	return in;
}

Mint factorial(LL n) {
	if (n == 0) {
		return Mint(1);
	}
	Mint res = 1;
	for (LL i = 1; i <= n; ++i) {
		res *= i;
	}
	return res;
}
Mint multiRange(LL s, LL t) {
	Mint res = 1;
	for (LL i = s; i <= t; ++i) {
		res *= i;
	}
	return res;
}

Mint getC(LL n, LL k) {
	if (n - k < k) {
		return getC(n, n - k);
	}
	return multiRange(n - k + 1, n) / factorial(k);
}

Mint getA(LL n, LL k) {
	return multiRange(n - k + 1, n);
}

Mint countNonNegativeDivision(LL n, LL k) {
	return getC(n + k - 1, k - 1);
}
Mint countPositiveDivision(LL n, LL k) {
	if (n < k) {
		return 0;
	}
	if (k <= 0) {
		return 0;
	}
	return getC(n - 1, k - 1);
}
Mint quickMod(Mint a, LL b) {
	Mint res = 1;
	while (b > 0) {
		if (b % 2) {
			res *= a;
		}
		a *= a;
		b /= 2;
	}
	return res;
}

int h1, m1;
int h2, m2;
int t1, t2;
LL k;
LL Mint::md = 1000000007;

int main() {
	cin >> h1 >> m1 >> h2 >> m2 >> k;
	t1 = (h1 * 60 + m1);
	t2 = (h2 * 60 + m2);
	LL res = (t2 - t1 - k);
	cout << res << endl;
	return 0;
}

Measured memory_bytes: 3600
#include <stdio.h>
#include <string.h>

typedef struct {
	char word[32];
	int freq;
	int len;
} str;

int main(void)
{
	int Max_f = 0;
	int Max_l = 0;
	int f, l;
	int i, j;
	str w[500] = { '\0', 0, 0 };

	for (i = 0; scanf("%s", w[i].word) != EOF; i++) {
		w[i].len = strlen(w[i].word);
		(w[i].freq)++;
		if (Max_l < w[i].len) {
			Max_l = w[i].len;
			l = i;
		}

		for (j = 0; j < i; j++) {
			if (strcmp(w[j].word, w[i].word) == 0) (w[j].freq)++;
			if (Max_f < w[j].freq) {
				Max_f = w[j].freq;
				f = j;
			}
		}
	}

	printf("%s %s\n", w[f].word, w[l].word);

	return 0;
}

Measured memory_bytes: 580
N = gets.to_i
A = gets.split.map(&:to_i).sort
th=A[-1]
C = Array.new(th+1,true)
N.times do |i|
    a = A[i]
    next if C[a]==false
    if a == A[i+1]
        C[a] = false
    end
    t=a*2
    while t <= th
        C[t]=false
        t+=a
    end
end
ans=0
A.each do |a|
    ans+=1 if C[a]
end
puts ans

Measured memory_bytes: 38416
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <set>
#include <algorithm>
#include <array>
#include <complex>
#include <string>
#include <utility>
#include <map>
#include <queue>
#include <list>
int dx[4] = { -1,0,1,0 };
int dy[4] = { 0,1,0,-1 };
const int INF = 1 << 21;
using pii = std::pair<int, int>;
#define SORT(v) std::sort(v.begin(), v.end())
int main(void) {
	int N,M;
	long long ans=1;
	std::cin >> N;
	std::vector<int> s(N);
	std::map<int, int> mp;
	for (int i = 0; i < N; ++i) {
		std::cin >> s[i];
		mp[s[i]]++;
	}
	std::map<int, int>::iterator itr;
	for (itr = mp.begin(); itr != mp.end(); itr++) {
		if (itr->first != 0 && itr->second == 1) {
			std::cout << 0 << std::endl;
			return 0;
		}
	}
	M = (N / 2);
	for (int i = 1; i <= M; i++) {
		ans *= 2;
		ans %= (int)((1e+9) + 7);
	}
	std::cout << ans << std::endl;
	return 0;
}

Measured memory_bytes: 3584
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
using ll = long long int;
#define INF             1e14
#define dd              double
#define MOD             1000000007
#define my_sizeof(type) ((char *)(&type+1)-(char*)(&type)) 
#define nl              cout<<endl
#define fill(a,val)     memset(a,val,sizeof(a))
#define mp              make_pair
#define endl            "\n"
#define pb              push_back
#define ff              first    
#define ss              second
#define SIZE            200005
#define all(v)          v.begin(),v.end()
#define s(ar,n)         sort(ar,ar+n)
#define rs(ar,n)        sort(ar, ar+n, greater<ll>()) 
#define oa(a,n)         for(ll i=0;i<n;i++)cout<<a[i]<<" ";nl
#define cn(a,n)         for(ll i=0;i<n;i++)cin>>a[i];
#define maxa(ar,N)      *max_element(ar,ar+N)
#define mina(ar,N)      *min_element(ar,ar+N)
#define fastio()        ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define printclock      cerr<<"Time : "<<1000*(long double)clock()/(long double)CLOCKS_PER_SEC<<"ms\n";
typedef tree<pair<ll,ll>, null_type, less<pair<ll,ll>>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
ll power(ll x, ll y){
    ll res=1;x=x;
    while(y>0){
        if(y&1)
            res = (res*x);
        y = y>>1;
        x = (x*x);
    }
    return res;
}  
ll logtwo(ll n){
    if(n==1)
        return 0;
    return logtwo(n/2)+1;
}
signed main()
{
	fastio();   
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif
	int t=1;
	//cin>>t;
	while(t--)
	{
		long double N,M;
		cin>>N>>M;
		N*=M;
		ll ans=(ll)N;
		cout<<ans<<endl;
	}
}

Measured memory_bytes: 3744
//小数点以下　cout << fixed << setprecision(10) << num << endl;
//桁数はlog10(mid)でやれ　log(mid)/log(10)はWA
//long*long<0で判定するな
//開区間と閉区間
//アルファベットが何番目かは x=s[i]-'a'
//bfsはmain()内で　rep(i,h)rep(j,w)rep(i,4)でバグ
//切り上げ：(a+(b-1))/b
//32bit以上は 1ull<<j
// map 初期値0 for(auto itr=mp.begin();itr!=mp.end();++itr) itr->fi itr->se で全探索
// for(auto u:mp) u.fi u.se も可能
//n個のgcd,lcmは一つずつみて更新していく
//大きな数を扱うときは素因数分解した形で持っておく
// (l/a[i]) = l*powmod(a[i],MOD-2)%MOD;
//auto itr=lower_bound(ALL(a),key) a[itr-a.begin()]
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <tuple>
#include <cmath>
#include <iomanip>
#include <map>
#include <stdio.h>
#include <cstring> //memset(dp,0,sizeof(dp))
#include <functional> //operator[]
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define fi first
#define se second
#define pb push_back
#define ALL(a) (a).begin(),(a).end()
using namespace std;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;

signed main(){
    int a[3][3];
    rep(i,3)rep(j,3) cin >> a[i][j];
    bool ok[3][3];
    rep(i,3)rep(j,3)ok[i][j]=0;
    
    int n; cin >> n;
    rep(i,n){
        int b; cin >> b;
        rep(j,3){
            rep(k,3){
                if(b==a[j][k]) ok[j][k]=1;
            }
        }
    }
    bool ans=0;
    rep(i,3){
        if(ok[i][0]&&ok[i][1]&&ok[i][2]) ans=1;
    }
    rep(i,3){
        if(ok[0][i]&&ok[1][i]&&ok[2][i]) ans=1;
    }
    if(ok[0][0]&&ok[1][1]&&ok[2][2])ans=1;
    if(ok[0][2]&&ok[1][1]&&ok[2][0])ans=1;
    
    if(ans) cout << "Yes" << endl;
    else cout << "No" << endl;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (lli i = 0; i < (n); i++)
#define rrep(i, n) for (lli i = (n)-1; i >= 0; i--)
#define vall(x) (x).begin(), (x).end()
using namespace std;
using lli = long long int;
void YESNO(bool), YesNo(bool);
template <class T1, class T2> bool chmin(T1 &l, const T2 &r);
template <class T1, class T2> bool chmax(T1 &l, const T2 &r);
template <class T1, class T2> void vadd(vector<T1> &v, T2 x);

#define int long long int
int c[50];
int f[50][50];
signed main() {
  int n, m, x;
  cin >> n >> m >> x;
  rep(i, n) {
    cin >> c[i];
    rep(j, m) cin >> f[i][j];
  }
  lli ret = 1e18;
  rep(i, 1 << n) {

    vector<int> su(m);
    lli sy = 0;
    rep(j, n) {
      if ((i >> j) & 1) {
        rep(k, m) su[k] += f[j][k];
        sy += c[j];
      }
    }
    if (*min_element(su.begin(), su.end()) >= x) {
      chmin(ret, sy);
    };
  }
  if (ret != 1e18)
    cout << ret << endl;
  else
    cout << -1 << endl;

  return 0;
}

// -- lib
void YESNO(bool b) { cout << (b ? "YES" : "NO") << endl; }
void YesNo(bool b) { cout << (b ? "Yes" : "No") << endl; }

template <class T1, class T2> bool chmin(T1 &l, const T2 &r) {
  return (l > r) ? (l = r, true) : false;
}

template <class T1, class T2> bool chmax(T1 &l, const T2 &r) {
  return (l < r) ? (l = r, true) : false;
}

template <class T1, class T2> void vadd(vector<T1> &v, T2 x) {
  for (auto &s : v)
    s += T2(x);
}


Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<=n;i++)
#define per(i,n,a) for (int i=n;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin,(x).end()
#define fi first
#define se second
#define SZ(x) ((int)x.size())
#define SID set<int>::iterator
#define fastCin ios::sync_with_stdio(false)
typedef vector<int> vi;
typedef long long ll;
typedef pair<int,int> pii;
typedef double db;
const db pi=acos(-1);
const int mod=1e9+7;
ll gcd(ll a,ll b) {return b?gcd(b,a%b):a;}
ll quickpow(ll x,ll k) //x^k
{
	ll ans=1;
	while (k)
	{
		if (k&1) ans=ans*x%mod;
		x=x*x%mod;
		k>>=1;
	}
	return ans;
}
ll v[100];

void ins(ll x)
{
	for (int i=63;i-- && x;)
	{
		if ((x>>i)&1) x^=v[i];
		if ((x>>i)&1) {v[i]=x;break;}
	}
}

bool que(ll x)
{
	for (int i=63;i-- && x;) if ((x>>i)&1) x^=v[i];
	return !x;
}

int n,t;
ll a[1000];
string s;

int main()
{
	fastCin;
	cin>>t;
	while (t--)
	{
		memset(v,0,sizeof(v));
		cin>>n;
		rep(i,1,n) cin>>a[i];
		cin>>s;
		bool bo=0; 
		per(i,n,1)
		{
			if (s[i-1]=='1')
			{
				if (!que(a[i]))
				{
					puts("1");
					bo=1;
					break;
				}
			}
			else ins(a[i]);
		}
		if (!bo) puts("0");
	} 
	return 0;
}


Measured memory_bytes: 3588
#include <iostream>
#include <cstdio>
#include <cstring>

const int P=110000;

using namespace std;

int main(void){
    int i,j,k,l;
    long long n,sum;
    long long prime_list[20000];
    bool prime_f[P];
    
    while(cin>>n,n!=0){
        k=0;
        memset(prime_list,0,sizeof(prime_list));
        for(i=0;i<P;i++){
            prime_f[i]=true;
        }
        prime_f[0]=prime_f[1]=false;
        for(i=2;i<P;i++){
            if(prime_f[i]){
                k++;
                if(k>n)break;
                prime_list[k]=i;
                for(j=2*i;j<=P;j+=i){
                    prime_f[j]=false;
                }
            }
        }
        sum=0;
        for(i=1;i<k;i++){
            sum+=prime_list[i];
        }
        cout<<sum<<endl;
    }
    return(0);
}

Measured memory_bytes: 1424
#include <iostream>
#include <vector>
#include <queue>
#include <string>
#include <iomanip>
using namespace std;

struct Tile {
	int x, y, dir;
	Tile(int x, int y, int dir = 0) {
		this->x = x;
		this->y = y;
		this->dir = dir;
	}
};

int main() {
	int h, w;
	cin >> h >> w;
	vector<string> ss(h);
	vector<vector<int>> dir(h);
	for (string& s : ss) cin >> s;
	for (vector<int>& d : dir) d.resize(w, -1);
	queue<Tile> pos;
	pos.push(Tile(0, 0));
	while (!pos.empty()) {
		auto p = pos.front();
		pos.pop();
		if (p.x < 0 || w <= p.x || p.y < 0 || h <= p.y) continue;
		if (ss[p.y][p.x] == '#') continue;
		if (dir[p.y][p.x] == -1) dir[p.y][p.x] = p.dir + 1;
		else continue;
		pos.push(Tile(p.x + 1, p.y, p.dir + 1));
		pos.push(Tile(p.x - 1, p.y, p.dir + 1));
		pos.push(Tile(p.x, p.y + 1, p.dir + 1));
		pos.push(Tile(p.x, p.y - 1, p.dir + 1));
	}
	int goal = dir[h - 1][w - 1];
	if (goal == -1) {
		cout << "-1" << endl;
		return 0;
	}
	Tile *t = new Tile(w - 1, h - 1, goal);
	while(t) {
		Tile* tmp = NULL;
		if (0 <= t->y + 1 && t->y + 1 < h && dir[t->y + 1][t->x] == t->dir - 1) tmp = new Tile(t->x, t->y + 1, t->dir - 1);
		else if (0 <= t->y - 1 && t->y - 1 < h && dir[t->y - 1][t->x] == t->dir - 1) tmp = new Tile(t->x, t->y - 1, t->dir - 1);
		else if (0 <= t->x + 1 && t->x + 1 < w && dir[t->y][t->x + 1] == t->dir - 1) tmp = new Tile(t->x + 1, t->y, t->dir - 1);
		else if (0 <= t->x - 1 && t->x - 1 < w && dir[t->y][t->x - 1] == t->dir - 1) tmp = new Tile(t->x - 1, t->y, t->dir - 1);
		dir[t->y][t->x] = -2;
		delete t;
		t = tmp;
	}
	int ans = 0;
	for (int y = 0; y < h; y++) {
		for (int x = 0; x < w; x++) {
			if (dir[y][x] != -2 && ss[y][x] == '.') ans++;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
def submit():
    n = int(input())
    hlist = list(map(int, input().split()))
    hlist = hlist[::-1]

    if n == 1:
        print("Yes")
        return

    for i in range(1, n):
        if hlist[i - 1] >= hlist[i]:
            continue

        if hlist[i - 1] == hlist[i] - 1:
            hlist[i] -= 1
        else:
            print("No")
            return

    print("Yes")


if __name__ == "__main__":
    submit()

Measured memory_bytes: 15020
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#include<bits/stdc++.h>
using ll = long long;
using namespace std;
using pii =pair<int,int>;

template <class T> T gcd(T a, T b){if (a < b) {a ^= b;b ^= a;a ^= b;}return b ? gcd(b, a % b) : a;}
template <class T> T lcm(T a, T b){return a * b / gcd(a, b);}

int counter=1;
template <class T>
map< T, int > prime_factor(T n) {
    map< T, int > ret;
    for(T i = 2; i * i <= n; i++) {
        while(n % i == 0) {
            ret[i]++;
            n /= i;
        }
    }
    if(n != 1) ret[n] = 1;
    return ret;
}
template <class T>
vector< T > divisor(T n) {
    vector< T > ret;
    for(T i = 1; i * i <= n; i++) {
        if(n % i == 0) {
        ret.push_back(i);
        if(i * i != n) ret.push_back(n / i);
        }
    }
    sort(begin(ret), end(ret));
    return (ret);
}
ll a,b;
void input(){
    cin>>a>>b;
}

void src(){
    cout<<prime_factor(gcd(a,b)).size()+1;
    return;
}

int main(int argc,char* argv[]){
 //   ifstream in( argv[1] ); cin.rdbuf(in.rdbuf());
    input();
    src();    
    return 0;
}

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

int main() {
    int n, m;
    cin >> n >> m;
    vector<bool> ac(n, false);
    vector<int> wa(n, 0);
    for (int i = 0; i < m; i++) {
        int p;
        string s;
        cin >> p >> s;
        p--;
        if (s == "AC") {
            ac[p] = true;
        } else {
            if (!ac[p]) {
                wa[p]++;
            }
        }
    }
    lint num_ac = 0;
    lint num_wa = 0;
    for (int i = 0; i < n; i++) {
        if (ac[i]) {
            num_ac++;
            num_wa += wa[i];
        }
    }
    cout << num_ac << " " << num_wa << endl;
}

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

using namespace std;

int main()
{
    int A, B, C, X, Y;

    scanf("%d %d %d %d %d", &A, &B, &C, &X, &Y);

    int ab = min(A + B, C * 2);
    int ans = min(min(min(X, Y) * ab + (X > Y ? (X - Y) * A : (Y - X) * B), max(X, Y) * ab), A * X + B * Y);

    printf("%d\n", ans);

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())//vectorの降順ソート
#define ll long long
#define pb(a) push_back(a)
#define INF 1000000000
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

typedef vector<unsigned int>vec;
typedef vector<vec> mat;
typedef tuple<ll, ll, ll> T;

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


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,m;
    cin>>n>>m;
    cout<<(1900*m+100*(n-m))*pow(2,m)<<endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	ll k;
	cin >> n >> k;
	vector<ll> a(n), b(n);
	rep(i,n) cin >> a[i] >> b[i];
	ll ans = 0;
	int r = 0;
	rep(i,n){
		bool ok = true;
		rep(j,32){
			if((a[i]>>j & 1) && !(k>>j & 1)) ok = false;
		}
		if(ok) ans += b[i];
	}
	ll tmp = 1;
	while(tmp <= k){
		ll ks = k;
		if(ks>>r & 1) ks = (k/tmp)*tmp - 1;
		ll score = 0;
		rep(i,n){
			bool ok = true;
			rep(j,32){
				if((a[i]>>j & 1) && !(ks>>j & 1)) ok = false;
			}
			if(ok) score += b[i];
		}
		++r;
		tmp *= 2;
		chmax(ans, score);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 4788
#include<bits/stdc++.h>
using namespace std;
int main(){
    ios::sync_with_stdio(false);
    cin.tie();
    int n;
    cin>>n;
    int flag = 0, count = 0;
    while (n--)
    {
        int a, b;
        cin>>a>>b;
        if(a == b){
            count++;
            if(count == 3)
            flag = 1;
        }else
        {
            count = 0;
        }
        
    }
    if(flag)    cout<<"Yes";
    else cout<<"No";
    return 0;
}

Measured memory_bytes: 3656
<?php
$N = trim(fgets(STDIN));
for($i = 0; $i < $N; $i++){
	$W[] = trim(fgets(STDIN));
}

//0はYes
$judge = 0;
for($i = 0; $i < $N - 1; $i++){
	if(strcmp(substr($W[$i], strlen($W[$i]) - 1, 1), substr($W[$i + 1], 0, 1)) != 0){
		$judge = 1;
		break;
	}
	for($j = $i + 1; $j < $N; $j++){
		if(strcmp($W[$i], $W[$j]) == 0){
			$judge = 1;
			break;
		}
	}
	if($judge == 1){
		break;
	}
}

if($judge == 0){
	printf("Yes");
}else{
	printf("No");
}
?>

Measured memory_bytes: 3576
a,b = gets.chomp.split
arr = {"A"=>10,"B"=>11,"C"=>12,"D"=>13,"E"=>14,"F"=>15}

if arr.fetch(a) < arr.fetch(b)
  puts "<"
elsif arr.fetch(a) > arr.fetch(b)
  puts ">"
else
  puts "="
end


Measured memory_bytes: 1788
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define SZ(x) ((int)(x).size())
#define rep(i,n) for(int i=0;i<(n);++i)
#define fore(i,a) for(auto &i:a)
#define min(...) min({__VA_ARGS__})
#define max(...) max({__VA_ARGS__})
#define Yes cout << "Yes" << endl;
#define No cout << "No" << endl;
#define answer cout << ans << endl;
signed _main(); signed main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
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; }
template<class T> using v = vector<T>;
template<class T> using vv = vector<v<T>>;
const int MOD=1e9+7;
const long long INF = 1LL << 60;
/*素数判定*/int isPrime(int n){if(n<2){return 0;}for(int i=2; i*i<=n; i++){if(n%i==0){return 0;}}return 1;}

signed _main(){
  int X; cin >> X;
  while(1){
    if(isPrime(X)){
      cout << X << endl;
      return 0;
    }
    X++;
  }
  return 0;
}


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

int main() {
	string s;
	cin >> s;
	int min = 999;
	for (int i = 0; i < s.size() - 2; i++) {
		int n = (s.at(i) - '0') * 100 + (s.at(i + 1) - '0') * 10 + (s.at(i + 2) - '0');
		if (abs(n - 753) < min)
			min = abs(n - 753);
	}
	cout << min << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;
int main() {
	int n, sum, medi, medil;
	vector<int> v,vs;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> sum;
		v.emplace_back(sum);
	}
	vs = v;
	sort(vs.begin(), vs.end());
	medi = vs[n / 2];
	medil = vs[n / 2-1];

	for (int i = 0; i < n; i++) {
		cout << (medi <= v[i] ? medil : medi) << endl;
	}
}

Measured memory_bytes: 3828
x1,y1,x2,y2 = map(int,input().split())
vec = [x2-x1,y2-y1]
to23 = [-1*vec[1],vec[0]]
to34 = [-1*vec[0],-1*vec[1]]

print(x2+to23[0],y2+to23[1],x2+to23[0]+to34[0],y2+to23[1]+to34[1])

Measured memory_bytes: 38256
#include<iostream>
using namespace std;
#include<cstdio>
#include<complex>

typedef double type_n;
typedef complex<type_n> point;

int ccw(const point &a, const point &c, const point &z)
{
    point w;
    w = conj(c) * (z - a);
    if(w.imag() > 0){ return 1; }
    if(w.imag() < 0){ return -1; }
    if(w.real() < 0){ return 2; }
    if(w.real() > norm(c)){ return -2; }
    return 0;
}

int main()
{
    point a, b, c, z;
    int i, q, crit;
    type_n a1, a2, b1, b2, z1, z2;
    scanf("%lf %lf %lf %lf", &a1, &a2, &b1, &b2);
    a.real(a1), a.imag(a2), b.real(b1), b.imag(b2);
    c = b - a;

    scanf("%d", &q);
    for(i = 0; i < q; i++){
        scanf("%lf %lf", &z1, &z2);
        z.real(z1), z.imag(z2);
        crit = ccw(a, c, z);
        switch(crit){
            case 1:
                printf("COUNTER_CLOCKWISE\n");
                break;
            case -1:
                printf("CLOCKWISE\n");
                break;
            case 2:
                printf("ONLINE_BACK\n");
                break;
            case -2:
                printf("ONLINE_FRONT\n");
                break;
            default:
                printf("ON_SEGMENT\n");
                break;
        }
    }
    return 0;
}

Measured memory_bytes: 1224
#include <bits/stdc++.h>
using namespace std;
vector <long long> a[100010], c[100010];
long long b[100010], mn, mx;
bool vis[100010], l;
void dfs(int x, int papa, int tmp){
    if(vis[x]){
        if(tmp!=b[x])
            l=0;
        return;
    }
    vis[x]=1;
    b[x]=tmp;
    mn=min(mn, b[x]);
    mx=max(mx, b[x]);
    for(int i=0; i<a[x].size(); ++i){
        if(a[x][i]==papa)
        continue;
        dfs(a[x][i], x, tmp+c[x][i]);
    }
}
int main(){
    int x, n, m, y, z;
    while(cin>>n>>m){
        for(int i=0; i<m; ++i){
            cin>>x>>y>>z;
            a[x].push_back(y);
            a[y].push_back(x);
            c[x].push_back(z);
            c[y].push_back(-z);
        }
        memset(vis, 0, sizeof vis);
        mn=1e15;
        mx=-1e15;
        l=1;
        for(int i=1; i<=n; ++i){
            if(!vis[i]){
                mn=1e15;
                mx=-1e15;
                dfs(i, 0, 0);
                if(mx-mn>1e9)
                    l=0;
            }
        }
        if(l)
            cout<<"Yes"<<endl;
        else
            cout<<"No"<<endl;

    }
    return 0;
}



Measured memory_bytes: 22784
#include <iostream>
#include <string>
#include <cstring>
using namespace std;
int w,h,mod=1e9+7,cnt;
string arr[1009];
int memo[1009][1009];
int dp(int i,int j)
{
    if(i<0 ||j<0||i>h||j>=w ||arr[i][j]=='#')
        return 0;
    if(i==h && j==w-1)
        return 1;
    int &ret=memo[i][j];
    if(~ret)
    {
        //cout<<"here "<<++cnt<<endl;
        return ret;

    }
    ret=dp(i+1,j);
    ret+=dp(i,j+1);
    return ret%=mod;
}
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cin>>h>>w;
    memset(memo,-1,sizeof memo);
    for(int i=1; i<=h; ++i)
        cin>>arr[i];
    cout<<dp(1,0)<<endl;


    return 0;
}


Measured memory_bytes: 8700
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#define MOD 1000000007
typedef long long ll;
using namespace std;

/*
追加クエリの直線の傾きが広義単調減少の場合    
- insert (a,b): insert y = ax + b
- query (x): min_i{a[i]*x + b}

・max の場合は広義単調増加
*/
template< typename T > 
struct ConvexHullTrick {
    using Line = pair<T, T>;
    deque<Line> lines;
    
    inline bool check(const Line &a, const Line &b, const Line &c) {// max : 同様
        return (b.first - a.first) * (c.second - b.second)
        >= (b.second - a.second) * (c.first - b.first);
    }
    
    inline T get(int k, T x) {
        return lines[k].first * x + lines[k].second;
    }
    
    void insert(T a, T b) {
        Line l(a, b);
        //　l(a,b) が不必要な場合
        if(lines.size() >= 1 && lines.back().first == a && lines.back().second <= b);// max : 不等号が反対
        else{
            // 直前の傾きが同じ直線が不必要な場合
            if(lines.size() >= 1 && lines.back().first == a && lines.back().second > b) lines.pop_back();// max : 不等号が反対
            //不必要な直線を取り除く
            while (lines.size() >= 2 && check(lines[(int)lines.size()-2], lines[(int)lines.size()-1], l))
                lines.pop_back();

            lines.push_back(l);
        }
    }
    
    T query(T x) {
        int low = -1, high = (int)lines.size()-1;
        while (high - low > 1) {
            int mid = (low + high) / 2;
            if (get(mid, x) >= get(mid + 1, x)) low = mid;//max : 不等号が反対
            else high = mid;
        }
        return get(high, x);
    }
    
    // クエリの単調性も成り立つ場合 (x が単調増加)
    T query_monotone(T x) {
        while (lines.size() >= 2 && get(0, x) >= get(1, x)) lines.pop_front();// max : 不等号が反対
        return lines[0].first * x + lines[0].second;
    }
};

int N;
ll C;
vector<ll> H;

ll dp[200020];

int main(){
  cin>>N>>C;
  H.resize(N);
  for(int i=0;i<N;i++) cin>>H[i];

  ConvexHullTrick<ll> cht;
  dp[0]=0;
  cht.insert(-2*H[0],H[0]*H[0]+dp[0]);
  for(int i=1;i<N;i++){
    dp[i]=H[i]*H[i]+C;
    dp[i]+=cht.query(H[i]);

    cht.insert(-2*H[i],H[i]*H[i]+dp[i]);
  }

  cout<<dp[N-1]<<endl;


  return 0;
}


Measured memory_bytes: 6656
#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<cassert>
#include<cassert>
#include<unordered_map>
#include<unordered_set>
#include<functional>
#include<queue>
#include<stack>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<sstream>
#include<iomanip>
#include<cstdio>
#include<cstdlib>
#include<numeric>
#include<random>
#include<chrono>
#include<bitset>
using namespace std;

#define all(x) (x).begin(), (x).end()
#define pb push_back
#define xx first
#define yy second
#define sz(x) (int)(x).size()
#define gc getchar
#define IO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define mp make_pair

#ifndef ONLINE_JUDGE
#  define LOG(x) (cerr << #x << " = " << (x) << endl)
#else
#  define LOG(x) ((void)0)
#endif

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

const double PI=3.1415926535897932384626433832795;
const ll INF = 1LL<<62;
const ll MINF = -1LL<<62;

template<typename T> T getint() {
	T val=0;
	char c;
	
	bool neg=false;
	while((c=gc()) && !(c>='0' && c<='9')) {
		neg|=c=='-';
	}

	do {
		val=(val*10)+c-'0';
	} while((c=gc()) && (c>='0' && c<='9'));

	return val*(neg?-1:1);
}

//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); uniform_int_distribution<int>(0, n-1)(rng)


int main() {
	IO;
	ll n,d,a;
	cin>>n>>d>>a;
	vector<pair<ll,ll>> lst(n);
	for(int i=0;i<n;++i) cin>>lst[i].xx>>lst[i].yy;
	sort(lst.begin(), lst.end());
	deque<pair<ll,ll>> curr; //(until, cnt)
	ll sum=0, ans=0;
	for(int i=0;i<n;++i) {
		while(!curr.empty() && curr.front().xx<lst[i].xx) {
			sum-=curr.front().second;
			curr.pop_front();
		}
		
		if(sum<lst[i].yy) {
			ll need=(lst[i].yy-sum+a-1)/a;
			ans+=need;
			sum+=need*a;
			curr.push_back(make_pair(lst[i].xx+2*d, need*a));
		}
	}
	
	cout<<ans<<"\n";
	return 0;
}


Measured memory_bytes: 4992
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) {
		FastScanner sc = new FastScanner(System.in);
		double n = sc.nextDouble();
		System.out.println(n * 2 * Math.PI);
		;

	}

	static int getDigit(int n, int d) {
		return n / d != 0 ? 1 + getDigit(n / d, d) : 1;
	}

	static class FastScanner {
		private BufferedReader reader;
		private StringTokenizer tokenizer;

		public FastScanner(InputStream in) {
			reader = new BufferedReader(new InputStreamReader(in));
			tokenizer = null;
		}

		public String next() {
			if (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}

		public String nextLine() {
			if (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					return reader.readLine();
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}

			return tokenizer.nextToken("\n");
		}

		public long nextLong() {
			return Long.parseLong(next());
		}

		public int nextInt() {
			return Integer.parseInt(next());
		}

		public double nextDouble() {
			return Double.parseDouble(next());
		}

		public long[] nextLongArray(int n) {
			long[] a = new long[n];
			for (int i = 0; i < n; i++)
				a[i] = nextLong();
			return a;
		}
	}
}

Measured memory_bytes: 33024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define ALL(n) begin(n),end(n)
#define IN(a, x, b) (a<=x && x<b)
#define INIT std::ios::sync_with_stdio(false);std::cin.tie(0);
template<class T> inline T CHMAX(T & a, const T b) { return a = (a < b) ? b : a; }
template<class T> inline T CHMIN(T & a, const T b) { return a = (a > b) ? b : a; }

const long double EPS = 1e-10;
const long long INF = 1e18;
const long double PI = acos(-1.0L);

int main()
{
    INIT;
    int n;
    cin >> n;
    int k;
    cin >> k;
    vector<int> kosu(n);
    REP(i,n){
        kosu.at(i) = 0;
    }
    vector<int> d(k);
    REP(i,k){
        int l;
        cin >> d.at(i);
        REP(j,d.at(i)){
            cin >> l;
            kosu.at(l-1)++;
        }
    }
    int ans = 0;
    REP(i,n){
        if(kosu.at(i) == 0) ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3656
#include <stdio.h>
#include <cmath>
#include <bits/stdc++.h>



using namespace std;

typedef vector<int> VI;
typedef vector<string> VS;


//container util
#define SORT(c) sort((c).begin(),(c).end())

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



int main(void){

	int N, K; cin >> N >> K;
	// vector<int> x(N);
	int ans = 0;
	REP(i,N){
		// cin >> x[i];
		int x;
		cin >> x;
		ans += min(abs(K-x)*2, abs(0-x)*2);
	}

	cout << ans << endl;

	


	return 0;

}


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

typedef long long ll;

using namespace std;

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

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

  sort(L, L + N, greater<int>());

  if (L[0] < sum - L[0]) cout << "Yes" << endl;
  else cout << "No" << endl;

}


Measured memory_bytes: 256
#include <iostream>

int main()
{
    int number;
    std::cin >> number;

    int list[number];
    for (int i = 0; i < number; i++) {
        std::cin >> list[i];
    }

    int count = 0;
    for (int i = 0; i < number; i++) {
        int min = i;
        for (int j = i; j < number; j++) {
            if (list[j] < list[min]) {
                min = j;
            }
        }
        if (min != i) {
            int tmp = list[i];
            list[i] = list[min];
            list[min] = tmp;
            count++;
        }
    }

    for (int i = 0; i < number; i++) {
        std::cout << list[i];
        if (i != number - 1) {
            std::cout << " ";
        } else {
            std::cout << std::endl;
        }
    }

    std::cout << count << std::endl;
}



Measured memory_bytes: 3100
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) (v).begin(),(v).end()
#define out(a) cout << (a) << endl
using namespace std;
using ll = long long;
int main(){
    string s;
    cin >> s;
    if(s[2] == s[3] && s[4] == s[5]) out("Yes");
    else out("No");
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, e) for(int (i) = 0; (i) < (e); ++(i))
#define FOR(i, b, e) for(int (i) = (b); (i) < (e); ++(i))
#define ALL(c) (c).begin(), (c).end()
#define PRINT(x) cout << (x) << "\n"
using namespace std;
using ll = long long; using pint = pair<int, int>; using pll = pair<ll, ll>;
const long long MOD = 1000000007;

ll N, K, M;
ll A[100010];
ll cnt[100], K2[100], pow2[100];
ll dp[100][2];

ll solve(){
    ll ret = 0;
    for(int i = 64; i >= 0; i--){
        dp[i][0] = dp[i + 1][0] + K2[i] * (N - cnt[i]) * pow2[i] + (1 - K2[i]) * cnt[i] * pow2[i];
        if(i < M) dp[i][1] = dp[i + 1][1] + max(cnt[i], N - cnt[i]) * pow2[i];
        if(K2[i] == 1) dp[i][1] = max(dp[i][1], dp[i + 1][0] + cnt[i] * pow2[i]);
    }
    return max(dp[0][0], dp[0][1]);
}

signed main(){
    cin >> N >> K;
    REP(i, N) cin >> A[i];
    REP(i, 64){
        REP(j, N){
            if(A[j] % 2 == 1) cnt[i]++;
            A[j] /= 2;
        }
        if(K % 2 == 1){
            K2[i] = 1;
            M = i;
        }
        K /= 2;
    }
    pow2[0] = 1;
    REP(i, 64) pow2[i + 1] = pow2[i] * 2;
    PRINT(solve());
    return 0;
}

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

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

#define F				first
#define S				second

int w, h, cnt = 0;

void solve( vector<vector<char>>& f, pair<int, int> mp ) {

	if( mp.F - 1 >= 0 && f[mp.S][mp.F - 1] == '.' ) {
		cnt++;
		f[mp.S][mp.F - 1] = '#';
		solve( f, make_pair( mp.F - 1, mp.S ) );
	}
	if( mp.F + 1 < w && f[mp.S][mp.F + 1] == '.' ) {
		f[mp.S][mp.F + 1] = '#';
		cnt++;
		solve( f, make_pair( mp.F + 1, mp.S ) );
	}
	if( mp.S - 1 >= 0 && f[mp.S - 1][mp.F] == '.' ) {
		f[mp.S - 1][mp.F] = '#';
		cnt++;
		solve( f, make_pair( mp.F, mp.S - 1 ) );
	}
	if( mp.S + 1 < h && f[mp.S + 1][mp.F] == '.' ) {
		f[mp.S + 1][mp.F] = '#';
		cnt++;
		solve( f, make_pair( mp.F, mp.S + 1 ) );
	}
}

int main() {

	while( 1 ) {
		cin >> w >> h; if( w == 0 && h == 0 ) break;
		
		pair<int, int> mp;
		vector<vector<char>> f;
		vector<char> tmp( w );
		REP( i, h ) {
			REP( j, w ) {
				cin >> tmp[j];
				if( tmp[j] == '@' ) { 
					mp.first = j;
					mp.second = i; 
					tmp[j] = '#';
					cnt++;
				}
			}
			f.push_back( tmp );
		}
		solve( f, mp );
		cout << cnt << endl;
		cnt = 0;
	}
}


Measured memory_bytes: 3152
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		try(Scanner sc = new Scanner(System.in)) {
			
			int a = sc.nextInt();
			int b = sc.nextInt();
			int c = sc.nextInt();
			
			System.out.println(String.format("%d %d %d", c, a, b));
		}
	}

}

Measured memory_bytes: 23764
using System;
class Program
{
    static void Main(string[] args)
    {
        int n = int.Parse(Console.ReadLine());
        string s = Console.ReadLine();
        bool ans = false;
        if (n % 2 == 1)
        {
            goto end;
        }
        if (s.Substring(0,n/2) == s.Substring(n/2,n/2))
        {
            ans = true;
        }
        end:
        Console.WriteLine(ans ? "Yes" : "No");
        return;
    }
}

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

int main(){
  int N;
  std::cin>>N;
  std::vector<std::pair<int,std::pair<int,int>> > V(N);
  std::vector<int> L(N),R(N);
  long long ans=0;
  int maxL_ind=0,minR_ind=0;
  std::priority_queue<std::pair<int,int> > minR_in_S;
  for(int i=0;i<N;i++){
    std::cin>>L[i]>>R[i];
    R[i]++;
    V[i]={L[i],{-R[i],i}};
    ans=std::max(ans,(long long)R[i]-L[i]);
    if(L[maxL_ind]<L[i]){
      maxL_ind=i;
    }
    if(R[minR_ind]>R[i]){
      minR_ind=i;
    }
    minR_in_S.push({-R[i],i});
  }

  ans=std::max(ans,ans+std::max(0,R[minR_ind]-L[maxL_ind]));
  std::sort(V.begin(),V.end());
  bool is_T[N]={};
  is_T[minR_ind]=true;
  for(int i=0;i<N;i++){
    int ind=V[i].second.second;
    if(ind!=minR_ind) is_T[ind]=true;
    std::pair<int,int> p=minR_in_S.top();
    while((is_T[p.second]==true)&&minR_in_S.size()){
      minR_in_S.pop();
      p=minR_in_S.top();
    }
    ans=std::max(ans,(long long)std::max(0,R[p.second]-L[maxL_ind])
                      +std::max(0,R[minR_ind]-L[ind]));
  }
  std::cout<<ans<<std::endl;
  return 0;
}  

Measured memory_bytes: 3320
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
int main(){
	ll n,time;
	cin>>n;
	std::vector<ll> c(n);
	std::vector<ll> s(n);
	std::vector<ll> f(n);
	ll cur;
	ll i,j;
	for(i=1;i<n;i++)
		cin>>c[i]>>s[i]>>f[i];
	for(j=1;j<n;j++){
		cur=s[j]+c[j];
		for(i=1+j;i<n;i++){
			time=s[i];
			while(time<cur)
				time+=f[i];
			cur=time+c[i];
		}
		cout<<cur<<endl;
	}
	cout<<0<<endl;
	return 0;
}

Measured memory_bytes: 256
//For higher stack size use g++ -O2 -std=c++11 -Wall -Wl,--stack=268435456 a.cpp -o a.exe in cmd
    #include <bits/stdc++.h>
    #include <cstdio>
    #include <cstring>
    #include <cmath>
    #include <cstring>
    #include <chrono>
    #include <complex>
    #define ll long long
    #define ld long double
    #define vi vector<int>
    #define vll vector<ll>
    #define vvi vector < vi >
    #define pii pair<int,int>
    #define pll pair<long long, long long>
    #define mod 1000000007
    #define inf 1000000000000000001;
    #define all(c) c.begin(),c.end()
    #define mp(x,y) make_pair(x,y)
    #define mem(a,val) memset(a,val,sizeof(a))
    #define eb emplace_back
    #define pb push_back
    #define f first
    #define s second
    
    using namespace std;
    int main()
    {
        std::ios::sync_with_stdio(false);
        int T;
        T=1;
        // cin.ignore(); must be there when using getline(cin, s)
        while(T--)
        {
            ll n,i,j,ans=0,a,b;
            cin>>n;
            for(i=1;i<=n;++i)
                ans=ans+i*(i+1)/2;
            for(i=1;i<=n-1;++i)
            {
                cin>>a>>b;
                if(a>b)
                    swap(a,b);
                ans=ans-a*(n-b+1);
            }
            cout<<ans<<endl;
        }
        return 0;
    }


Measured memory_bytes: 3680
//26/04/2020
#include<bits/stdc++.h>
#include<cmath>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define debug printf("Debug\n");
#define en '\n'


#define ll long long
#define ull unsigned long long

#define pi acos(-1.0)
#define mod 1000000007

#define _fastio  ios_base:: sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define in_fre  freopen("in.txt", "r", stdin);
#define out_fre freopen("out.txt", "w", stdout);

struct Node{
    ll val,pos;
};

//Algos
template<typename T> using Pbds=tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;

//Number Theory
template <typename T> T BigMod (T b,T p,T m){if (p == 0) return 1;if (p%2 == 0){T s = BigMod(b,p/2,m);return ((s%m)*(s%m))%m;}return ((b%m)*(BigMod(b,p-1,m)%m))%m;}
template <typename T> T ModInv (T b,T m){return BigMod(b,m-2,m);}
template <typename T> T gcd(T a,T b){if(a<0)return gcd(-a,b);if(b<0)return gcd(a,-b);return (b==0)?a:gcd(b,a%b);}
template <typename T> T lcm(T a,T b) {if(a<0)return lcm(-a,b);if(b<0)return lcm(a,-b);return a*(b/gcd(a,b));}

//Geometry
template <typename T> T Dis(T x1,T y1,T x2, T y2){return sqrt( SQR(x1-x2) + SQR(y1-y2) );}
template <typename T> T Angle(T x1,T y1,T x2, T y2){ return atan2( double(y1-y2) , double(x1-x2));}


/*Containers*/
vector<ll>v;
deque<ll>dq;
stack<ll>stk;
map<ll,ll>mp;
unordered_map<ll,ll>ump;
set<ll>st;
multiset<ll>mst;
unordered_set<ll>ust;
unordered_multiset<ll>umst;
priority_queue<ll,deque<ll>,greater<ll>>pq;
Pbds<ll>ost;

set<string>st1;

int main(){
    _fastio
    ll n;
    cin>>n;
    for(ll i=1;i<=n;i++){
        string s;
        cin>>s;
        st1.insert(s);
    }
    cout<<st1.size()<<en;



    return 0;
}


Measured memory_bytes: 19284
#include <algorithm>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
using ll = long long;

/* clang-format off */
template <class T, size_t D> struct _vec { using type = vector<typename _vec<T, D - 1>::type>; };
template <class T> struct _vec<T, 1> { using type = vector<T>; };
template <class T, size_t D> using vec = typename _vec<T, D>::type;
template <class T> vector<T> make_v(size_t size, const T& init) { return vector<T>(size, init); }
template <class... Ts> auto make_v(size_t size, Ts... rest) { return vector<decltype(make_v(rest...))>(size, make_v(rest...)); }
/* clang-format on */

int main() {
  int N;
  while (cin >> N) {
    int p = -1;
    int res = 0;
    for (int i = 0; i < N; i++) {
      int a;
      cin >> a;
      if (a == p) {
        ++res;
        p = -1;
      } else {
        p = a;
      }
    }
    cout << res << endl;
  }
  return 0;
}


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

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

    string S, T;
    cin >> S >> T;
    if (S == T) {
        cout << "Yes" << endl;
        exit(0);
    }
    for (int i = 0; i < S.size(); ++i) {
        S = S.back() + S.substr(0, S.size() - 1);
        if (S == T) {
            cout << "Yes" << endl;
            exit(0);
        }
    }
    cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 256
n=int(input())
sp=[list(map(str,input().split())) for i in range(n)]
for i in range(n):
  sp[i][1]=-int(sp[i][1])
  sp[i].append(i+1)
sp.sort(key=lambda x: (x[0],x[1]))
for i in range(n):
  print(sp[i][2])


Measured memory_bytes: 3060
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)

N, Q = map(int, input().split())

ab_list = [[] for _ in range(N)]

for _ in range(N-1):
    a, b = map(int, input().split())
    ab_list[a-1].append(b-1)
    ab_list[b-1].append(a-1)
    
px_list = [list(map(int,input().split())) for _ in range(Q)]
ans = [0] * N

for q, x in px_list:
    ans[q-1] += x

def add_point(num, root=-1):
    for c in ab_list[num]:
        if root == c:
            continue
        ans[c] += ans[num]
        add_point(c, num)
        
add_point(0, -1)

print(*ans)

Measured memory_bytes: 310892
# agc029_a.py
# W の後ろに何個Bがあるかをカウントすれば行けそう
def swap(s,i,j):
    return s[:i] + s[j] + s[i] + s[j+1:]
cnt = 0
S = input()
bcnt = 0
ans = 0
for i in S:
    if i =="B":
        bcnt +=1
    else:
        ans += bcnt
print(ans)

Measured memory_bytes: 3500
#include<stdio.h>
#include<algorithm>
#include<string.h>
#include<strstream>
#include<math.h>
using namespace std;
int main()
{
    int x,a,b;
    scanf("%d%d%d",&x,&a,&b);
    a=fabs(a-x); b=fabs(b-x);
    if(a>b)
        printf("B\n");
    else
        printf("A\n");
}


Measured memory_bytes: 128
import java.util.Scanner;

public class Main
{
    public static void main(String[] args)
    {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        char[] cs = sc.next().toCharArray();
        char[] out = new char[cs.length];

        for (int i = 0; i < cs.length; i++) {
            char c = cs[i];
            if (c + n > 'Z') {
                out[i] = (char) (c + n - 26);
            }
            else {
                out[i] = (char) (c + n);
            }
        }

        System.out.println(out);
    }
}


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

long long int n,p,q,i,a;

int main()
{
  cin >> n;
  p=1;
  q=n;
  for (i=0;i<n;i++)
  {
    cin >> a;
    if (a==p)
      p+=1;
    else
      q-=1;
  }
  if (q==0)
    cout << -1 << endl;
  else
    cout << n-q << endl; 
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <numeric> 
using namespace std;
typedef long long ll;
typedef pair<int, string> P;
const int INF = 1<<30; 
const int MOD = 1e9 + 7;
const int dx[] = {1, 0, -1, 0};
const int dy[] = {0, 1, 0, -1};
int main()
{
    int n, m;
    cin >> n;
    vector<P> vec;
    for(int i = 0; i < n; i++)
    {
        string c;
        int d;
        cin >> c >> d;
        vec.push_back(P(d, c));
    }
    sort(vec.begin(), vec.end());
    cin >> m;
    vector<string> color(m + 1);
    for(int i = 0; i < m; i++) cin >> color[i]; 
    int val = -1, cnt = 0;
    for(int i = 0; i < n; i++)
    {
        if(cnt >= m) break;
        if (vec[i].first <= val) continue;
        if (vec[i].second == color[cnt])
        {
            val = vec[i].first;
            cnt++;
        }
    }
    cout << (cnt == m ? "Yes" : "No") << endl;
    return 0;
}


Measured memory_bytes: 20812
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()

if N%2 == 0:
	print(N*(N-2)//2)
	for i, j in combinations(range(1, N+1), 2):
		if i+j == N+1:
			continue
		print(i, j)

else:
	print(N*(N-1)//2-(N-1)//2)
	for i, j in combinations(range(1, N+1), 2):
		if i+j == N:
			continue
		print(i, j)


Measured memory_bytes: 5708
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
 
int main(){
    ll N, M;
    cin >> N >> M;
    ll sum = 0;
    for(int i=0;i<M;i++){
        ll A;
        cin >> A;
        sum += A;
    }

    if(sum > N){
        cout << -1 << endl;
    }else{
        cout << N - sum << endl;
    }

}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REP2(i, a, b) for (int i = (a); i < (int)(b); i++)
typedef long long ll;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef vector<string> VS;

int Main(int H, int W, VS &a) {
    VVL dp(H, VL(W, 0));
    REP2(i, 1, H) {
        if(a[i][0] == '#') {
            REP2(j, i, H) dp[i][0] = 0;
            break;
        }
        else dp[i][0] = 1;
    }
    REP2(i, 1, W) {
        if(a[0][i] == '#') {
            REP2(j, i, W) dp[0][i] = 0;
            break;
        }
        else dp[0][i] = 1;
    }   
    REP2(i, 1, H) {
        REP2(j, 1, W) {
            if(a[i][j] == '#') dp[i][j] = 0;
            else {
                dp[i][j] = (dp[i-1][j] % (ll)(pow(10,9)+7) + dp[i][j-1] % (ll)(pow(10,9)+7)) % (ll)(pow(10,9)+7) ;
            }
        }
    }
    return dp[H-1][W-1];
}

int main(void) {
    int H, W;
    cin >> H >> W;
    VS a(H);
    REP(i, H) cin >> a[i];
    cout << Main(H, W, a) << endl;
    return 0;
}

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

using namespace std;

int main() {
	int n,m;
	cin >> n >> m;

	vector< vector<int> > a;
	vector<int> b;

	a.resize( n );
	for( int i=0; i<n; i++ ) {
		a[i].resize( m );
	}
	b.resize( m );

	for( int i=0; i<n; i++ ) {
		for( int j=0; j<m; j++ ) {
			cin >> a[i][j];
		}
	}
	for( int i=0; i<m; i++ ) {
		cin >> b[i];
	}

	for( int i=0 ; i<n; i++ ) {
		int sum=0;
		for( int j=0; j<m; j++ ) {
			sum += a[i][j] * b[j];
		}
		cout << sum << endl;
	}
	return 0;
}

Measured memory_bytes: 3144