akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <list>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <tuple>
#include <deque>

using namespace std;

/*
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
*/

typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<long long, long long> pll;
typedef vector<pll> vpll;

typedef long double ld;
typedef vector<ld> vld;

typedef vector<bool> vb;

/*
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define reps(i, n) for (ll i = 1; i <= (n); i++)
#define rrep(i, n) for (ll i = (n) - 1; i >= 0; i--)
#define rreps(i, n) for (ll i = (n); i >= 1; i--)
#define all(v) (v).begin(), (v).end()
*/

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

constexpr int INF = 1 << 30;
constexpr ll INFL = 1LL << 60;
constexpr ll MOD = 1000000007;
constexpr ld EPS = 1e-9;

void solve() {
    ll a, b;
    cin >> a >> b;
    bool ans = a <= 8 && b <= 8;
    cout << (ans ? "Yay!" : ":(") << endl;
    return;
}

int main() {
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
}


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

using namespace std;

#define rep(i, n) for (int i = 0; i < (int) n; i++)
#define reps(i, n, m) for (int i = n; i < (int) m; i++)

int h, matrix[20][6];

bool init()
{
	cin >> h;
	if (h == 0) return false;
	for (int i = 0; i < 20; i++) {
		for (int j = 0; j < 5; j++) {
			matrix[i][j] = 0;
		}
	}
	for (int i = 0; i < h; i++) {
		cin >> matrix[h-i-1][0] >> matrix[h-i-1][1] >> matrix[h-i-1][2] >> matrix[h-i-1][3] >> matrix[h-i-1][4];
		matrix[i][5] = 0;
	}
	return true;
}

int calc(int a, int b) {
	return a * (b + 100) / 100;
}

void solve()
{
	int ans = 0;
	while (1) {
		int cflag = 0;
		for (int i = 0; i < h; i++) {
			int snode = 0, scnt = 1;
			for (int j = 1; j < 6; j++) {
				if (matrix[i][snode] == matrix[i][j] && matrix[i][snode] != 0) scnt++;
				else {
					if (scnt >= 3) {
						ans += scnt * matrix[i][snode];
						cflag = 1;
						//cout << snode<<endl;
						for (int k = 0; k < scnt; k++) matrix[i][snode+k] = 0;
						break;
					}
					else{
						scnt = 1;
						snode = j;
					}
				}
			}
		}
		if (cflag == 0) break;
		for (int i = 0; i < h; i++) {
			for (int j = 0; j < 5; j++) {
				for (int k = i; k > 0; k--) {
					if (matrix[k-1][j] == 0) swap(matrix[k-1][j], matrix[k][j]);
					else break;
				}
			}
		}	
	}
	cout << ans << endl;
}

int main()
{
	while (init()) {
		solve();
	}
}


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

typedef long long ll;
typedef long double Double;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

// chmax, chmin
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;
}

void solve(long long x) {
    cout << !x << endl;
}

int main() {
  long long x;
  scanf("%lld", &x);
  solve(x);
  return 0;
}


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

int main() {
  int N;
  cin >> N;
  vector<long long> S(N);
  if(N>=3){
  S.at(2)=1;
  if(N>=4){    
    for (int i=3; i<N; i++){
      S.at(i) = S.at(i-1)+S.at(i-3);
      S.at(i)%=1000000007;
    }
  }
  }
  cout << S.at(N-1) << endl;
  return 0;
}

Measured memory_bytes: 3592
#include <cstdio>
#include <algorithm>
#include <vector>
#include <queue>

#define Rep(i, n) for (int i = 1; i <= n; i ++)
#define Rep0(i, n) for (int i = 0; i <= n; i ++)

using namespace std;

const int N = 200010;

vector<int> t[N];
int t1[N];

priority_queue<int> q;

int main()
{
	int n, m;
	scanf("%d%d", &n, &m);
	Rep(i, n){
		int l, r;
		scanf("%d%d", &l, &r);
		t[l].push_back(r);
	}
	for (int i = m; i; i --) {
		if (t[i].size()) Rep0(j, t[i].size() - 1) q.push(t[i][j]);
		if (!q.empty()) q.pop(); 
	}
	if (t[0].size()) Rep0(i, t[0].size() - 1) q.push(t[0][i]);
	
	while (!q.empty()){
		t1[q.top()] ++;
		q.pop();
	}
	int cnt = 0;
	Rep(i, m) {
		cnt += t1[i];
		if (cnt >= 1) cnt --;
	}
	cnt += t1[m + 1];
	printf("%d\n", max(cnt, n - m));
	
	return 0;
}

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

int main() {
  int n;
  cin >> n;
  for (int i = 1; i < 10; i++) {
    for (int j = 1; j < 10; j++) {
      if (i * j == n) {
        cout << "Yes" << endl;
        return 0;
      }
    }
  }

  cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
*this << "[";
for (auto it = d.b; it != d.e; ++it)
*this << ", " + 2 * (it == d.b) << *it;
ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define cool ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define int  long long int
#define pb push_back
#define fe first
#define lb lower_bound 
#define ub upper_bound
#define pii pair<pair<int,int>,pair<int,int> >
#define se second
#define endl "\n"
#define pi pair<int, int>
#define mi          map<int,int>
#define mii         map<pi,int>
#define vi vector<int> 
#define vvi vector<vi>
#define bs   binary_search
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rep1(i,a,b) for(int i=a;i<=b;i++)	
#define all(c) (c).begin(),(c).end()
#define sz(x)       (int)x.size() 
#define PI 3.14159265358979323846

 const int N=2e3+5;

 int mod= 1e9+7;
 int dx[4]={0,0,+1,-1};
 int dy[4]={+1,-1,0,0};  
 
 
int po(int a, int b) {
	a %= mod;
	int res = 1;
	while (b > 0) {
		if (b & 1)
			res = (res * a) % mod;
		a =(a*a) % mod;
		b >>= 1;
	}
	 return res;	
   }
  
  
   int a[3][3],vis[3][3];
   void solve() {
	       rep(i,0,3) rep(j,0,3) cin>>a[i][j];
	              
	      int n;
	      cin>>n;
	      rep(i,0,n) {
			   int x;
			   cin>>x;
			   rep(i1,0,3) {
				      rep(j1,0,3) {
						    if(a[i1][j1]==x)
						      vis[i1][j1]=1;
						  }
				   }
			  }
			  
			rep(i,0,3) {
				 int f=0;
				  rep(j,0,3) {
					    if(vis[i][j]) f++;
					  }
					  if(f==3) {
						    cout<<"Yes\n";
						    return;
						  }
				}
				
				rep(j,0,3) {
					  int f=0;
					  rep(i,0,3) {
						    if(vis[i][j])f++;
						  }
						  if(f==3) {
							     cout<<"Yes\n";
							     return;
							  }
			      }
			      
			      int f=0;
			for(int i=0,j=0;i<3 && j<3;i++,j++) {
				    if(!vis[i][j]) f=1;   
				}
			if(!f) {
				    cout<<"Yes\n";
				    return;
				}		
				f=0;
		   for(int i=0,j=2;i<3 && j>=0;i++,j--) {
			       if(!vis[i][j]) f=1;
			   }	
			   if(!f) {
				     cout<<"Yes\n";
				     return;  
				   }	
				   
				  cout<<"No\n";						  		   		   
	   }

    
int32_t main() {
	cool;
	int t=1;
	//cin>>t;
	while(t--)
	solve();


return 0;	   
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main(){
	int N,L;
    cin >> N >> L;
    string S[N];
    for(int x=0; x<N; x++){
        cin >> S[x];
    }sort(S,S+N);
    for(int x=0; x<N; x++){
        cout << S[x];
    }
    return 0;
    }

Measured memory_bytes: 256
import Control.Monad
import Data.List

solve :: [String] -> Bool
solve (w1:w2:[]) = (last w1) == (head w2)
solve (w1:w2:ws) = ((last w1) == (head w2)) && solve (w2:ws)

main :: IO ()
main = do
  n <- readLn
  ws <- replicateM n getLine
  let isOk = (==1) . maximum . map length . group . sort
  putStrLn $ if isOk ws && solve ws then "Yes" else "No"

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

using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define ll long long int
#define INF 1000000007
// cin.eof() 入力個数の問題
int main(){
string S;
cin>>S;
ll ans=0,count=0,W=0;
rep(i,S.size()){
  if(S[i]=='W'){ W++; count+=i;}

}
rep(i,W){
  ans+=i;
}
cout<<count-ans<<endl;

  return 0;
}


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

int main(void){
  int k, x;
  cin >> k >> x;
  if(500*k >= x) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 3556
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <string>

#define rep(i, a, b) for ( int i = (a); i < (b); i++ )
#define per(i, a, b) for ( int i = (b)-1; i >= (a); i--)
#define pb push_back
#define mp make_pair
#define bg begin()
#define en end()

using namespace std;

typedef long long ll;

static const long long MOD = 1000000007;

string s;;
ll ans;
 
int main(void) {
    
    cin >> s;
    for (int i = 0; i < s.size()-1; i++) {
      if (s[i] != s[i+1]) ans++;
    }
    
    printf("%lld\n", ans);
    return 0;
}

Measured memory_bytes: 512
#include <iostream>
#define INF 100000000
#define MAX(a,b) (((a)>(b))?(a):(b))

using namespace std;

int main(void){
	int N,W;
	int dp[101][10001];
	int w[101],v[101];

	cin>>N>>W;
	for(int i=1;i<=N;i++){
		cin>>v[i]>>w[i];
	}
	for(int i=0;i<=N;i++){
		for(int j=0;j<=W;j++){
			dp[i][j]=0;
			dp[0][j]=0;
		}
		dp[0][i]=0;
	}
	for(int i=1;i<=N;i++){
		for(int j=1;j<=W;j++){
			if(j-w[i]>=0){
				dp[i][j]=MAX(dp[i-1][j],dp[i-1][j-w[i]]+v[i]);
				dp[i][j]=MAX(dp[i][j-w[i]]+v[i],dp[i][j]);
			}
			else dp[i][j]=dp[i-1][j];
			// for(int k=1;k<=N;k++){
				// dp[i][j]=MAX(dp[i][j-w[k]]+v[k],dp[i][j]);
			// }
		}
	}
	cout<<dp[N][W]<<endl;
	return 0;
}

Measured memory_bytes: 7028
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define all(x) x.begin(), x.end()
#define MOD 1000000007
#define vi vector < int >
#define pii pair < int, int >
#define INF (int)1e9
#define pb push_back
#define fastIO ios::sync_with_stdio(0); cin.tie(0);

int main()
{
    fastIO
    
    int n, k;
    cin >> n >> k;
    
    vi snukes(n + 1);
    
    int d, snuke;
    for(int i = 0; i < k; ++i)
    {
        cin >> d;
        for(int j = 0; j < d; ++j)
        {
            cin >> snuke;
            ++snukes[snuke];
        }
    }
    
    int total = 0;
    for(int i = 1; i <= n; ++i)
        if(!snukes[i])
            ++total;
            
    cout << total;

    return 0;
}



Measured memory_bytes: 3624
#include <functional>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;
const ll MOD = 1000000007LL;

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

    int n;
    cin >> n;

    cout << n / 500 * 1000 + n % 500 / 5 * 5 << "\n";
    return 0;
}

Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define reps(i, n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
#define rrep(i, n) for(int i=((int)(n)-1); i>=0; --i)
#define rreps(i, n) for(int i=((int)(n)); i>0; --i)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) ((int)(x).size())
#define pl(s) cout << (s) << "\n";
#define pls(...) {bool space = false; for(auto i : __VA_ARGS__) (cout << (space?" ":"") << i), space = true; cout << "\n";}
#define plexit(s) {cout << (s) << "\n"; exit(0);}
#define yes(s) cout << ((s)?"Yes":"No") << "\n";
template<typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using ll = long long; using ull = unsigned long long; using ld = long double;
template<typename T = int> using V = vector<T>; template<typename T = int> using P = pair<T, T>;
using Vi = V<int>; using Vl = V<ll>; using Vd = V<ld>; using VVi = V<Vi>; using VVl = V<Vl>; using Pi = P<int>; using Pl = P<ll>; using Pd = P<ld>;
constexpr ll MOD = 1000000007; constexpr int INF = (1 << 30) - 1; constexpr ll INFL = 1LL << 60; constexpr ld EPS = 1e-12; constexpr ld PI = 3.141592653589793238462643383279;

int main(void) {
  ll x, k, d; cin >> x >> k >> d;
  x = abs(x);
  ll s = min(k,x/d);
  k -= s;
  x -= s * d;
  if (k % 2 == 0) pl(x)
  else pl(d-x)

  return 0;
}


Measured memory_bytes: 3616
#include<stdio.h>
#include<string.h>
int main()
{
    int i;
    char str[100000];
    while(~scanf("%s",str))
	{
		for(i=1;i<=strlen(str);i++)
    {
        if(i%2==1)
        {
            printf("%c",str[i-1]);
        }
    }
		 printf("\n");
	}
    return 0;
}


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

int main() {
    int n;
    cin >> n;
    vector<int> v(n);
    
    for (int i = 0; i < n; i++) {
        cin >> v.at(i);
    }
    
    for (int i = (n - 1); i >= 0; i--) {
        if (i) {
            cout << v.at(i) << ' ';
        } else {
            cout << v.at(i) << endl;
        }
    }
}


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


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

using namespace std;

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

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

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


#line 2 "nomura2020_c.cpp"

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

  int n;
  cin >> n;
  vl a(n + 1);
  REP(i, n + 1) { cin >> a[i]; }

  if (n == 0) {
    cout << (a[0] == 1 ? 1 : -1) << endl;
    return 0;
  }

  vl par(n, 0), node(n + 1, 0);
  par[0] = 1 - a[0];
  FOR(i, 1, n) {
    if (par[i - 1] > 1e15) {
      par[i] = 1e18;
    } else {
      par[i] = 2LL * par[i - 1] - a[i];
      if (par[i] < 0) {
        cout << -1 << endl;
        return 0;
      }
    }
  }

  node[n] = a[n];
  for (int i = n - 1; i >= 0; i--) {
    node[i] = a[i];
    if (par[i] > node[i + 1]) {
      node[i] += node[i + 1];
    } else {
      if (2 * par[i] < node[i + 1]) {
        cout << -1 << endl;
        return 0;
      }
      node[i] += par[i];
    }
  }

  ll ans = 0;
  REP(i, n + 1) ans += node[i];
  cout << ans << endl;
}


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

#define FOR(i,b,e) for(int i=(b); i <= (e); ++i)
#define FORD(i,b,e) for(int i=(b); i >= (e); --i)
#define SIZE(c) (int) (c).size()
#define FORE(i,c) FOR(i,0,SIZE(c)-1)
#define FORDE(i,c) FORD(i,SIZE(c)-1,0)

#define pb push_back
#define mp make_pair
#define st first
#define nd second


using namespace std;

typedef long long ll;
typedef pair <int,int> pii;
typedef pair <ll,ll> pll;

typedef vector <int> VI;
typedef vector <bool> VB;
typedef vector <pii> VP;
typedef vector <ll> VL;
typedef vector <pll> VPL;

typedef vector <VI> VVI;
typedef vector <VL> VVL;
typedef vector <VB> VVB;
typedef vector <VP> VVP;

const int MOD = 1000000007;
const int INF = 1000000001;
const ll LINF = 1000000000000000001LL;


/*************************************************************************/

int main() {
    ios_base::sync_with_stdio(0);
    
    int n, p;
    cin >> n >> p;
    
    bool anyOdd = false;
    FOR(_,1,n) {
        int a;
        cin >> a;
        
        if (a % 2) anyOdd = true;
    }
    
    if (!anyOdd) {
        if (p == 0) {
            ll ans = 1LL << n;
            cout << ans;
        } else {
            cout << 0;
        }
    } else {
        ll ans = 1LL << (n - 1);
        cout << ans;
    }

    return 0;
}

/*************************************************************************/


Measured memory_bytes: 256
fn main() {
    let n = read::<usize>();
    let mut d = read_vec::<u32>();
    d.sort();

    let l = d[n / 2 - 1];
    let h = d[n / 2];

    println!("{}", h - l);
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().split_whitespace().map(|e| e.parse().ok().unwrap()).collect()
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
template<typename T> inline bool chmax(T& a,T b) { if (a < b) { a = b; return true; } return false; }
template<typename T> inline bool chmin(T& a,T b) { if (a > b) { a = b; return true; } return false; }

template<typename 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(ret.begin(), ret.end());
    return ret;
}

int main(){
    long long N, P;
    cin >> N >> P;
    vector<long long> div = divisor(P);
    long long ans = 1, cnt = 0;
    for (auto d : div) if (1 < d) {
        long long c = 0;
        long long p = P;
        while(p%d==0){
            c++;
            p /= d;
        }
        if (c >= N) {
            ans = d;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define modulo 1000000007
#define mod(mod_x) ((((long long)mod_x)+modulo)%modulo)
#define Inf 1000000000


int main(){
	int N;
	cin>>N;
	vector<int> A(N);
	
	for(int i=0;i<N;i++){
		cin>>A[i];
	}
	
	vector<int> mini1(N+1,0);
	vector<int> mini2(N+1,0);
	for(int i=0;i<N;i++){
		mini1[i+1] = max(mini1[i],A[i]);
	}
	reverse(A.begin(),A.end());
	
	for(int i=0;i<N;i++){
		mini2[i+1] = max(mini2[i],A[i]);
	}
	
	for(int i=0;i<N;i++){
		cout<<max(mini1[i],mini2[N-1-i])<<endl;;
	}
	
		
	
	return 0;
}



Measured memory_bytes: 3968
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (long long i = 0, _n = (n); i < _n; i++)
#define debug(x) cout<<#x<<": "<<x<<endl
/*Author Ritick Goenka || ritick(codechef) ||doped.silicon(codeforces) */
/*IIT Roorkee = <3 */
#define ll long long
#define ld double
#define all(ar) ar.begin(), ar.end()
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define PI 3.1415926535897932385
#define INF 1000000000000000
#define MOD 1000000007
int main () 
{
        ios_base::sync_with_stdio(false);
        cin.tie(NULL);
        cout<<setprecision(11);
            int dp[200007]={0};
            vector<int>c;
            int ar[200007]={0};
            int nex[200007]={0};
            int n;
            cin>>n;
            // debug(n);
            rep(i,200007)
            {
                ar[i]=200006;
            }
            rep(i,n)
            {
                ll x;
                cin>>x;
                if(c.empty()||c[c.size()-1]!=x)
                {
                    c.pb(x);
                }
            }
            for(ll i=c.size()-1;i>=0;i--)
            {
                nex[i]=ar[c[i]];
                ar[c[i]]=i;
            }
            dp[c.size()]=1;
            for(ll i=c.size()-1;i>=0;i--)
            {
                dp[i]=(dp[i+1]+dp[nex[i]])%MOD;
            }
            cout<<dp[0];
            return 0;
}

Measured memory_bytes: 3704
import sys

def solve():
    input = sys.stdin.readline
    N = int(input())
    A = [int(a) for a in input().split()]
    sumDict = dict()
    sumA = 0
    sumDict[0] = 1
    for i, a in enumerate(A):
        sumA += a
        if sumA in sumDict: sumDict[sumA] += 1
        else: sumDict[sumA] = 1
    ans = 0
    for key in sumDict: ans += sumDict[key] * (sumDict[key] - 1) // 2
    print(ans)

    return 0

if __name__ == "__main__":
    solve()

Measured memory_bytes: 38852
import java.util.*;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();

        if(a+b+c < 22){
        System.out.println("win");
        }else{
            System.out.println("bust");
        }
    }
}

Measured memory_bytes: 21844
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<string>
#include<sstream>
#include<cmath>
#include<numeric>
#include<map>
#include<stack>
#include<queue>
using namespace std;
long long mod = 1e9 + 7;

int main(void) {
  int a, p; cin >> a >> p;
  cout << (a*3 + p)/2 << endl;


  return 0;
}



// EOF


Measured memory_bytes: 256
#pragma gcc optimize("Ofast")
#include <bits/stdc++.h>

using namespace std;
using ll = long long;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort(ALL(V)) //小さい方からソート
#define REV(V) reverse(ALL(V)) //リバース
#define RSORT(V) SORT(V);REV(V) //大きい方からソート
#define NPN(V) next_permutation(ALL(V)) //順列
#define pb(n) push_back(n)
#define endl '\n'
#define Endl '\n'
#define DUMP(x)  cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define Yay(n) cout << ((n) ? "Yay!": ":(") << endl
#define RAPID cin.tie(0);ios::sync_with_stdio(false)
#define VSUM(V) accumulate(ALL(V), 0)
#define MID(a,b,c) (a) < (b) && (b) < (c)
#define MIDe(a,b,c) (a) <= (b) && (b) <= (c)
#define IN(n) cin >> n
#define IN2(a,b) cin >> a >> b
#define IN3(a,b,c) cin >> a >> b >> c 
#define IN4(a,b,c,d) cin >> a >> b >> c >> d
#define VIN(V) for(int i = 0; i < (V).size(); i++) {cin >> (V).at(i);}
#define OUT(n) cout << n << endl
#define VOUT(V) REP(i, (V).size()) {cout << (V)[i] << endl;}
#define VOUT2(V) REP(i, (V).size()) {cout << (V)[i] << " ";} cout<<endl;

// 型マクロ定義
#define int long long
#define P pair<ll,ll>
#define Vi vector<ll>
#define Vd vector<double>
#define Vs vector<string>
#define Vc vector<char>
#define M map<ll,ll>
#define S set<ll>
#define PQ priority_queue<ll>
#define PQG priority_queue<ll,V,greater<ll>
//

const int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI  = acos(-1.0);

int gcd(int a,int b){return b != 0 ? gcd(b, a % b) : a;} //最大公約数
int lcm(int a, int b){return a * b / gcd(a, b);}
string toStrUp(string str){char diff = 'A'-'a';REP(i,str.size()) str[i] += diff;return str;}
string gCh(string str, int key){return str.substr(key,1);}

signed main() {
  RAPID;
  // デフォルト変数定義
  int n=0,m=0,a=0,b=0,c=0,d=0,x=0,y=0,z=INF;
  string s="",t="";
  //

  // ここから
  IN2(n,x);
  Vi cv(n);
  Vi tv(n);
  REP(i,n){
    IN2(cv[i],tv[i]);
  }
  REP(i,n){
    if(tv[i] <= x) {
      z = min(z,cv[i]);
    }
  }
  if (z == INF) OUT("TLE");
  else OUT(z);
}

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

int main(){
 long long N,u,c,ans;
  cin>>N;
  ans=100000000000;
  
  vector<long long>a(N),b(N);
  cin>>a[0];
  b[0]=a[0];
  u=a[0];
    for(int i=1;i<N;i++){
      cin>>a[i];
      b[i]=b[i-1]+a[i];
      u+=a[i];
    }
     for(int i=0;i<N-1;i++){
      c=abs(u-2*b[i]);
       ans=min(ans,c);
    }
      cout<<ans<<endl;
}


Measured memory_bytes: 3328
#include<bits/stdc++.h>
using namespace std;
int main(){
	string s;
	cin >> s;
	int n=s.length();
	int t=0;
	for(int i=0;i<n;i=i+2){
		if(s[i]!='R'&&s[i]!='U'&&s[i]!='D'){
			t++;
		}
	}
	for(int i=1;i<n-1;i=i+2){
		if(s[i]!='L'&&s[i]!='U'&&s[i]!='D'){
			t++;
		}
	}
	if(t==0){
		cout<<"Yes";
	}else{
		cout<<"No";
	}


}

Measured memory_bytes: 256
var GET = (function () {function f(s) {return new g(s);}function g(s) {this._s = s.trim().split("\n");}g.prototype.getValue = function (n) {return this._s[n];};g.prototype.getArray = function (n) {return this.stoa(this._s[n]);};g.prototype.slice = function (s, limit) {return this._s.slice(s, +limit + s || undefined).map(v => this.stox(v));};g.prototype.sliceArray = function (s, limit) {return this._s.slice(s, +limit + s || undefined).map(v => this.stoa(v));};g.prototype.stoa = function (s) {return s.split(" ").map(v => this.stox(v));};g.prototype.stox = function (v) {var i = +v;return (i === i) ? i : v;};return f;})();
var o = GET(require("fs").readFileSync("/dev/stdin", "utf8"));

console.log(main());
function main(){
    var N = o.getValue(0);
    var C = {
        'AC': 0,
        'WA': 0,
        'TLE': 0,
        'RE': 0
    };

    for(var i = 0; N > i; i++) {
        var key = o.getValue(i + 1);
        C[key]++;
    }

    return Object.keys(C).map(function (v) {
        return `${v} x ${C[v]}`;
    }).join('\n');
}

Measured memory_bytes: 37408
#include<map>
#include<set>
#include<list>
#include<cmath>
#include<queue>
#include<stack>
#include<cstdio>
#include<string>
#include<vector>
#include<complex>
#include<cstdlib>
#include<cstring>
#include<numeric>
#include<sstream>
#include<iostream>
#include<algorithm>
#include<functional>

#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;

typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;

const int INF=1<<29;
const double EPS=1e-9;

const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};
int p,q,a,n;
int ans;
void dfs(int x,int y,int m,int k){
	if(p*y==q*x){//イコールなら
		ans++;
		return;
	}
	if(k==n||p*y<q*x)return;//要素がnを超えるorはp/qを超える
	for(int i =m;i*y <=a;i++){
		int nx =x*i+y;
		int ny =i*y;
		dfs(nx,ny,i,k+1);
	}
}

int main(){
	while(cin>>p>>q>>a>>n,p||a||q||n){
		ans = 0;
		dfs(0,1,1,0);//
		cout <<ans<<endl;
	}
	return 0;
}

Measured memory_bytes: 1160
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#define MOD 1000000007
#define INF 1 << 30

using namespace std;
typedef long long ll;

int main(void) {
	int ax, ay, bx, by, cx, cy;
	double S, r, a, b, c, m = 0.0, ans = 0.0;
	cin >> ax >> ay >> bx >> by >> cx >> cy;
	bx -= cx;
	by -= cy;
	ax -= cx;
	ay -= cy;
	cx = cy = 0;
	S = abs(ax * by - bx * ay);
	a = sqrt(abs(ax - bx) * abs(ax - bx) + abs(ay - by) * abs(ay - by));
	b = sqrt(abs(ax - cx) * abs(ax - cx) + abs(ay - cy) * abs(ay - cy));
	c = sqrt(abs(cx - bx) * abs(cx - bx) + abs(cy - by) * abs(cy - by));
	r = S / (a + b + c);
	a = max(a, max(b, c));
	ans = a * r / (2.0 * r + a);
	printf("%.10lf\n", ans);
	return 0;
}

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

int main(){

  char N[4];
  cin >> N;
  
  if((N[0] == N[1] && N[1] == N[2]) || (N[1] == N[2] && N[2] == N[3])){
  
    cout << "Yes" << endl;
    
  }else{
  
    cout << "No" << endl;
    
  }
  
  return 0;
  
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll MAX=1e6;
ll mod=998244353;
#define setbits(x) __builtin_popcount(x)
#define setbitsll(x) __builtin_popcountll(x)
#define endl '\n'
#define pb push_back
#define se second
#define fi first
#define maxe max_element
#define mine min_element
#define debug(x) cout<<#x<<" :: "<<x<<endl;
#define debug2(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<endl;
#define debug3(x,y,z) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<endl;
#define debug4(x,y,z,w) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<"\t"<<#w<<" :: "<<w<<endl;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define boost  ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)

long long expo(ll x,ll n,ll M)
{
    if(n==0)
        return 1;
    else if(n%2 == 0)        //n is even
        return expo((x*x)%M,n/2,M)%M;
    else                             //n is odd
        return (x*expo((x*x)%M,(n-1)/2,M))%M;

}

void solve()
{
  ll h,w;
  cin>>h>>w;
  if(h==1 || w==1)
    cout<<1<<endl;
  else 
  cout<<((h+1)/2)*((w+1)/2)+((h)/2)*((w)/2);
}

int main(){
    boost;
  solve();
}


Measured memory_bytes: 256
n,k=map(int,input().split())
MAX_NUM = 4*10**5
pr = 10**9+7
fac  = [0 for _ in range(MAX_NUM)]
finv = [0 for _ in range(MAX_NUM)]
inv  = [0 for _ in range(MAX_NUM)]
fac[0]  = fac[1] = 1
finv[0] = finv[1] = 1
inv[1] = 1
for i in range(2,MAX_NUM):
    fac[i] = fac[i-1] * i % pr
    inv[i] = pr - inv[pr%i] * (pr // i) % pr
    finv[i] = finv[i-1] * inv[i] % pr
def c(n,k):
    if n < k:
        return 0
    if n < 0 or k < 0:
        return 0
    return fac[n] * (finv[k] * finv[n-k] % pr) % pr
a=c(2*n-1,n)
if k>=n-1:
    print(a)
else:
    for i in range(k+1,n):
        a=(a-c(n,i)*c(n-1,n-i-1))%pr
    print(a)

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

using namespace std;
typedef long long ll;

#define REP(i, n) for (ll i = 0; i < (n); i++)
#define REPR(i, n) for (ll i = (n); i >= 0; i--)
#define FOR(i, m, n) for (ll i = (m); i < (n); i++)
#define FORR(i, m, n) for (ll i = (m); i >= (n); i--)
#define INF 1e9
#define pb push_back
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((ll)(x).size())
#define SORT(x) sort((x).begin(), (x).end())
#define dump(x) cerr << #x << " = " << (x) << endl
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \
                      << " " << __FILE__ << endl

int main(int argc, char const *argv[])
{
    ll n, k;
    cin >> n >> k;
    ll maxk = n / 2 + n % 2;
    if (maxk >= k)
    {
        puts("YES");
    }
    else
    {
        puts("NO");
    }
    return 0;
}


Measured memory_bytes: 256
(* O(|xs|) *)
let array_count f = Array.fold_left (fun n x -> if f x then n + 1 else n) 0
let array_for_all f xs = Array.length xs = array_count f xs

(* O(n * log(max a_s)) *)
let _ = Scanf.scanf "%d" @@ fun n ->
  let a_s = Array.init n @@ fun _ -> Scanf.scanf " %d" @@ (+) 0 in
  let rec count i =
    let f x = x mod 2 = 0 in
    if not @@ array_for_all f a_s then i
    else let g i a = a_s.(i) <- a / 2 in
      Array.iteri g a_s;
      count (i + 1) in
  count 0 |> Printf.printf "%d\n"

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

void _main() {
    int N, K;
    cin >> N >> K;
    int ans = 0;
    while (N) {
        N /= K;
        ans++;
    }
    cout << ans << endl;
}

signed main(signed argc, char **argv) {
    if (argc > 1) {
        if (strchr(argv[1], 'i')) freopen("in.txt", "r", stdin);
        if (strchr(argv[1], 'o')) freopen("out.txt", "w", stdout);
    }
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(10);
    _main();
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <stdio.h>
#include <time.h>
#include <numeric>
#define all(a) a.begin(),a.end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef long double ld;
typedef complex<ld> com;
constexpr int inf = 1000000000;
constexpr ll INF = 1000000000000000000;
constexpr ld EPS = 1e-12;
constexpr ld PI = 3.141592653589793238;
template<class T, class U> inline bool chmax(T &a, const U &b) { if (a < b) { a = b; return true; } return false; }
template<class T, class U> inline bool chmin(T &a, const U &b) { if (a > b) { a = b; return true; } return false; }

struct edge {
	int from, to, cost;
};

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

	int l;
	cin >> l;
	vector<edge> ans;
	int idx = 20;
	while (idx > 1) {
		if (l & 1) {
			if (l > 1) ans.pb({ 1, idx, l - 1 });
		}
		l >>= 1;
		ans.pb({ idx - 1, idx, 0 });
		if (l) ans.pb({ idx - 1,idx,l });
		idx--;
	}
	cout << 20 << ' ' << ans.size() << '\n';
	for (edge i : ans) cout << i.from << ' ' << i.to << ' ' << i.cost << '\n';
}

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

#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define ALL(a)  (a).begin(),(a).end()
#define endl "\n"

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

void solve() {
    // 解xに対して K回以内の切断で達成かのうか調べる O(Nlogmax(Ai))
    ll N,K;
    cin >> N >> K;
    vector<ll> A(N);
    REP(i,N) cin >> A[i];



    auto isOk = [&](ll key) {
        ll need_cut = 0;
        for(const auto &a : A) {
            // debug
            ll cut = ((a+key-1)/key)-1;
            need_cut += cut;
        }
        bool res = need_cut <= K;
        return res;
    };

    // binary search
    ll l = 0;
    ll r = INFLL;

    while((r-l) > 1) {
        ll mid = (l+r)/2;
        if(isOk(mid)) r = mid;
        else l = mid;
    }

    cout << r << endl;

}

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

Measured memory_bytes: 4836
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //これつけるとA[N]でもいいらしい
//for文のマクロ
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define big 1000000007
int main(){
    int n;
    cin>>n;
    string s;
    cin >>s;
    vector<int> vw(n+1,0),ve(n+1,0);
    //s[0]以上
    rep(i,n){
        if(s[i]=='W'){
            vw[i+1]=vw[i]+1;
            ve[i+1]=ve[i];
        }
        else{
            vw[i+1]=vw[i];
            ve[i+1]=ve[i]+1;            
        }
    }
    /*
    cout<<"vw  ve"<<endl;
    rep(i,n+1){
        cout << vw[i]<<" "<<ve[i]<<endl;
    } 
    */
    int max = 1000000;
    int ans;
    rep(i,n){
        ans = ve[n]-ve[i+1] + vw[i]-ve[0];
        if(ans<=max){
            max = ans;
        }
    }
    cout <<max<<endl;
}

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

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

using namespace std;

int64_t gcd(int64_t a, int64_t b) {
  if (a<b) return gcd(b,a);
  if (b) return gcd(b,a%b);
  return a;
}

int64_t lcm(int64_t a, int64_t b) {
  return a/gcd(a,b)*b;
}

int main() {
  int64_t n,m;
  cin>>n>>m;
  vector<int64_t> a(n), p(n);
  REP(i,n) cin>>a[i];
  REP(i,n) cin>>p[i];
  vector<int64_t> f(1<<n,m);
  vector<long double> e(1<<n,1);
  REP(i,1<<n){
    int64_t li = 1;
    REP(j,n) {
      if ((i>>j)&1) {
        f[i] /= a[j]/gcd(li, a[j]);
        if (f[i] == 0) break;
        li *= a[j]/gcd(li, a[j]);
      }
    }
  }
  f[0] = 0;
  long double res = 0.0;
  REP(i,n) {
    REP(j,1<<n){
      if((j>>i)&1) {
        e[j] *= 0.01 * p[i];
        f[j]-=f[j^(1<<i)];
      } else {
        e[j] *= 0.01 * (100 - p[i]);
      }
    }
  }
  REP(i,1<<n) {
    res += e[i] * abs(f[i]);
  }
  cout << setprecision(10) << fixed << res << endl;
  return 0;
}

Measured memory_bytes: 27360
#include<bits/stdc++.h>
#define pi 3.1415  
#define ll long long
#define pii pair<int,int>
#define debug(a) cout<<a<<'\n'
#define maxn 59
#define MOD 1000000007
#define INF (int)3000009
using namespace std;
int main(){
    ios::sync_with_stdio(false);
    ll n;
    cin>>n;
    ll vet[maxn];
    for(int i=0;i<n;i++){
        cin>>vet[i];
    }
    ll ans=0;
    for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
            ans+=vet[i]*vet[j];
        }
    }
    cout<<ans<<endl;
    return 0;
}   

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<int> vin;
typedef pair<ll,ll> P;
typedef vector<P> vp;
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define drep(i,a,b) for(ll i=(a);i>=(b);--i)
#define SIZE(a) ll((a).size())
#define out(a) cout<<(a)<<endl;
const ll inf=1e9;
const int MAX = 510000;
const ll MOD = 998244353;
vll divide(ll n){
    vll res;
    for(ll i=1;i*i<=n;i++){
        if(n%i==0){
            res.push_back(i);
            if(i!=n/i){
                res.push_back(n/i);
            }
        }
    }
    sort(res.begin(),res.end());
    return res;
}
int main(){
  ll n;cin>>n;
  ll ans=0;
  for(ll i=1;i*i<=n;i++){
    if(n%i==0&&i<(n/i)-1){
       ans+=(n/i)-1;
    }
  }
  cout<<ans<<endl;
}



Measured memory_bytes: 3648
#include <bits/stdc++.h>
#define ll long long int
#define MOD 1000000007
#define INF 1000000000000000000

using namespace std;

int main(void){
  string s;
  cin >> s;
  
  for (int i = 0; i < 3; i++){
    if (s[i] == '1')
      cout << 9;
    else
      cout << 1;
  }
  cout << endl;

  return 0;
}


Measured memory_bytes: 3568
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, a, n) for (int i = (a); i < (n); i++)
#define repr(i, n, a) for (int i = (n)-1; i >= (a); i--)
#define each(it, v) for (auto(it) = (v).begin(); (it) != (v).end(); (it)++)
#define all(v) (v).begin(), (v).end()
#define vi vector<int>
#define vvi vector<vi>
#define vd vector<double>
#define vvd vector<vd>
#define co(x) cout << (x)
#define con(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define out(x) rep(i, 0, (x).size()) cout << (x)[i] << ((i != (x).size() - 1) ? " " : "\n")
const double PI = 3.14159265;
const int MAXN = 1 << 15;
const int LINF = 1LL << 60;
const int INF = 1 << 30;
#define Pr(a) (#a) << "=" << (a) << " "
#define pr(a) cout << Pr(a) << '\n'
///////////////////////////////////////////////////////

signed main() {
  int n;
  cin >> n;
  int ans = 0;
  int a[4] = {25, 10, 5, 1};
  for (int i = 0; i < 4; i++) {
    ans += n / a[i];
    n %= a[i];
  }
  cout << ans << endl;
  return 0;
}



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

//const long double PIL = 3.141592653589793238462643383279502884L;
//const double PI = 3.14159265358979323846;

#define sz(a) int((a).size())
#define all(c) (c).begin(), (c).end()
#define what_is(x) cerr << #x << " is " << x << endl;

using ll = long long;
using ii = pair<int,int>;
using vi = vector<int>;
using vll = vector<long long>;
using vii = vector<pair<int,int>>;

int main() {
	//~ ios::sync_with_stdio(0);
	//~ cin.tie(0);
	int x1, y1, x2, y2;
	scanf("%d%d%d%d", &x1, &y1, &x2, &y2);
	x2 -= x1;
	y2 -= y1;
	int x3 = x2 - y2 + x1;
	int y3 = x2 + y2 + y1;
	int x4 = -y2 + x1;
	int y4 = x2 + y1;
	printf("%d %d %d %d\n", x3, y3, x4, y4);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define nn 65536*2
#define lf double
int n,m;
vector<int> v[nn];
int dep[nn];int siz[nn];
ll ans=0;int cnt[2];int vis[nn];
int adv[nn];
void dfs(int x,int p)
{
	vis[x]=1;
	dep[x]=dep[p]^1;cnt[dep[x]]++;
	if(dep[x]==0) siz[x]=-1-adv[x];else siz[x]=1+adv[x];
	//siz[x]+=adv[x];
	for(int i=0;i<v[x].size();i++)
	{
		if(vis[v[x][i]]) continue;
		dfs(v[x][i],x);siz[x]+=siz[v[x][i]];
	}
	ans+=abs(siz[x]);
}

int ctrl;int ij,ji;
void efs(int x,int p)
{
	dep[x]=dep[p]^1;vis[x]=1;
	for(int i=0;i<v[x].size();i++)
	{
		if(v[x][i]==p) continue;
		if(vis[v[x][i]]) 
		{
			if(dep[v[x][i]]==dep[x]) 
				ctrl=1,ij=x,ji=v[x][i];
			else
				ctrl=0,ij=x,ji=v[x][i];
		}
		else efs(v[x][i],x);
	}
}

vector<int> lft;
void spj(int x,int p)
{
	vis[x]=1;
	dep[x]=dep[p]^1;cnt[dep[x]]++;
	if(dep[x]==0) siz[x]=-1;else siz[x]=1;
	for(int i=0;i<v[x].size();i++)
	{
		if(vis[v[x][i]]) continue;
		spj(v[x][i],x);
		adv[x]+=adv[v[x][i]];
		siz[x]+=siz[v[x][i]];
	}
	if(adv[x]==1) lft.push_back(-siz[x]);
	else if(adv[x]==-1) lft.push_back(siz[x]);
	else ans+=abs(siz[x]);
}
int main()
{
	scanf("%d%d",&n,&m);
	for(int i=0;i<m;i++)
	{
		int x,y;scanf("%d%d",&x,&y);
		v[x].push_back(y);v[y].push_back(x);
	}
	if(m==n-1)
	{
		dfs(1,0);
		if(cnt[0]!=cnt[1]) puts("-1");
		else printf("%lld\n",ans);
		return 0;
	}
	efs(1,0);
	if(ctrl)
	{
		memset(vis,0,sizeof(vis));
		dfs(1,0);int o=(cnt[!dep[ij]]-cnt[dep[ij]]);//assert(dep[ij]==dep[ji]);
		if(o%2)
		{
			puts("-1");
			return 0;
		}
		adv[ij]+=o/2,adv[ji]+=o/2;//cout<<o<<":"<<o/2<<"\n";
		ans=0;memset(vis,0,sizeof(vis));dfs(1,0);
		printf("%lld\n",ans+abs(o)/2);
		return 0;
	}
	else
	{
	//	exit(0);
		memset(vis,0,sizeof(vis));adv[ij]++,adv[ji]--;
		spj(1,0);lft.push_back(0);sort(lft.begin(),lft.end());
		
		for(int i=0;i<lft.size();i++) ans+=abs(lft[i]-lft[lft.size()/2]);
		if(cnt[0]!=cnt[1]) puts("-1");
		else printf("%lld\n",ans);
		return 0;
	}
	return 0;
} 

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

int main() {
  int a;
  int b;
  int c;
  int d;
  cin >> a;
  b = a / 100;
  c = (a % 100) / 10;
  d = (a % 100) % 10;
  cout << b + c + d << endl;
  
  // ここにプログラムを追記
}

Measured memory_bytes: 256
import sys

for s in sys.stdin:
    a = (int)(s)
    c = 0
    for i in range(0,10):
        for j in range(0,10):
            for k in range(0,10):
                for l in range(0,10):
                    if i + j + k + l == a:
                        c += 1
    print c

Measured memory_bytes: 4216
/*BISMILLAH
THE WHITE WOLF
NO DREAM IS TOO BIG AND NO DREAMER IS TOO SMALL*/

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

#define io ios_base::sync_with_stdio(false)
#define ll long long
#define ull unsigned long long
#define vi vector<int>
#define vll vector<long long>
#define pb push_back
#define mod 1000000007
#define pii pair<int, int>
#define PI 2*acos(0.0)
#define forn(i, n) for(int i = 0; i < n; i++)


int main()
{
    io;
    int n;
    cin>>n;
    vll a(n), b(n);
    ll mida , midb;
    for(int i = 0; i < n; i++)
        cin>>a[i] >>b[i];
    sort(a.begin(), a.end());
    sort(b.begin(), b.end());
    if(n&1)
    {
        mida = a[n/2];
        midb = b[n/2];
    }
    else
    {
        mida = a[n/2] + a[n/2 - 1];
        midb = b[n/2] + b[n/2 - 1];
    }
    cout<<midb-mida+1;
    return 0;
}


Measured memory_bytes: 6432
#pragma warning(disable : 4996)
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
#define dup(x) x.erase(unique(x.begin(), x.end()),x.end())
typedef long long int ll;
typedef unsigned long long int ull;
using namespace std;
// https://atcoder.jp/contests/abc171/tasks/abc171_e
int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    ll xorSum = 0;
    ll n;
    cin >> n;
    vector<ll> a(n);
    for(int i = 0;i<n;i++){
        cin >> a[i]; 
        xorSum ^= a[i];
    }
    vector<ll> ans(n);
    for(int i = 0;i<n;i++){
        ll temp = xorSum ^ a[i];
        ans[i] = temp;
    }

    for(auto k : ans){
        cout << k << " ";
    }


	return 0;
}


Measured memory_bytes: 6324
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>

int main(){

  int i,j,k,l;
  int N;
  char al[26] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
  char input[100000];
  char c;
  char output[100000];
  
  scanf("%d",&N);
  scanf("%s",input);
  
  j = strlen(input);
  //printf("%d\n",j);
  
  for(i=0;i<j;i++){
    c = input[i];
    for(k=0;k<26;k++){
      if( c == al[k] ){
        if( k+N<26 ){
          c = al[k+N];
        }
        else{
          l = k+N-26;
          c = al[l];
        }
        break;
      }
    }
    output[i] = c;
  }
  
  printf("%s",output);
  return 0;
    
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
    int n , m ;
    cin>>n>>m ;
    int MIN = 1e9 , ans = 0;
    for(int i = 0 ; i < n ; ++i)
    {
        int x ;
        cin>>x ;
        if(x < MIN)
            MIN = x ;
        if(m >= x)
            m -= x ,ans++;
    }
    if(ans == n)
     ans += (m / MIN) ;
    cout<<ans;
    return 0 ;
}


Measured memory_bytes: 256
# coding: utf-8
# Your code here!

import math
from functools import reduce

n = int(input())
def gcd(*numbers):
    return reduce(math.gcd, numbers)
  
ans = 0

for a in range(1, n+1):
  for b in range(1, n+1):
      tmp = gcd(a, b)
      if not tmp == 1:
          for c in range(1, n+1):
               tmp2 = gcd(tmp, c)
               ans = ans + tmp2
      else:
          ans = ans + 1 * n
print(ans)

Measured memory_bytes: 9628
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>
#include<cmath>
#include<cstdio>
#include<tuple>
#include<bitset>
#include<map>

using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define ALL(x) x.begin(),x.end()
#define ll long long
typedef pair<int,int> P;
const int inf=1000000007;
const int MOD=1000000007;
signed main(){
  int n,m;cin>>n>>m;
  vector<int> s(n+1,0);
  vector<int> t(m+1,0);
  rep1(i,n)cin>>s[i];
  rep1(i,m)cin>>t[i];
  vector<vector<int>> dp(n+5,vector<int>(m+5,0));
  vector<vector<int>> sm(n+5,vector<int>(m+5,0));
  rep1(i,n){
      rep1(j,m){
          if(s[i]==t[j]){
              dp[i][j]+=sm[i-1][j-1]+MOD+1;
              dp[i][j]%=MOD;
          }
              sm[i][j]+=sm[i-1][j]+sm[i][j-1]-sm[i-1][j-1]+dp[i][j]+MOD;
              sm[i][j]%=MOD;
      }
  }
  int res=1;
  //cout<<"debug"<<"\n";
  rep1(i,n){
      rep1(j,m){
          res+=dp[i][j];
          res%=MOD;
          //cout<<dp[i][j]<<" ";
      }
      //cout<<endl;
  }
  cout<<res<<"\n";
  return 0;
}

Measured memory_bytes: 66340