akhauriyash/Code-Regression huggingface dataset:
/**
 *    author  : 𝒌𝒚𝒐𝒎𝒖𝒌𝒚𝒐𝒎𝒖𝒑𝒖𝒓𝒊𝒏
 *    created : 2020-03-26 14:28:02
**/

#include <iostream>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <complex>
#include <numeric>
#include <bitset>
#include <cassert>
#include <cctype>
#include <iomanip>
#include <random>
#include <utility>
#include <chrono>

using namespace std;

using int64 = long long;

template<class T> using binary_heap = std::priority_queue<T, std::vector<T>, std::greater<T>>;
template<class T> std::ostream& operator<<(std::ostream& os, const std::vector<T>& vec) { os << '{'; size_t n = vec.size(); for (size_t i = 0; i < n; ++i) { os << vec[i]; if (i != n - 1) os << ','; } os << '}'; return os; }
template<class T, class U> std::ostream& operator<<(std::ostream& os, const std::pair<T, U>& p) { return os << '{' << p.first << " " << p.second << '}'; }
template<class T, class U> std::ostream& operator<<(std::ostream& os, const std::map<T, U>& mp) { os << '{'; for (auto it = mp.begin(); it != mp.end(); ++it) { os << '{' << it->first << ':' << it->second << '}'; if (it != --mp.end()) os << ','; } os << '}'; return os; }
template<class T> std::ostream& operator<<(std::ostream& os, const std::set<T>& st) { os << '{'; for (auto it = st.begin(); it != st.end(); ++it) { os << *it; if (it != --st.end()) os << ','; } os << '}'; return os; }
template<class T> std::istream& operator>>(std::istream& is, std::vector<T>& vec) { size_t n = vec.size(); for (size_t i = 0; i < n; ++i) is >> vec[i]; return is; }

#define all(_) begin(_), end(_)
#define rall(_) rbegin(_), rend(_)

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]: ", debug_out(__VA_ARGS__)
#else
#define debug(...) 1728
#endif

void debug_out() { std::cerr << '\n'; }

template <class Head, class... Tail>
void debug_out(Head&& head, Tail&&... tail) {
  std::cerr << head;
  if (sizeof...(Tail) != 0) std::cerr << ", ";
  debug_out(std::forward<Tail>(tail)...);
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);

  int n; cin >> n;

  auto rec = [&](const auto& rec, string cur, int d) -> void {
    if ((int) cur.size() == n) {
      cout << cur << '\n';
    } else {
      for (char c = 'a'; c <= (char)('a' + d); ++c) {
        if (c == (char)('a' + d)) {
          rec(rec, cur + c, d + 1);
        } else {
          rec(rec, cur + c, d);
        }
      }
    }
  };

  string s = "";

  rec(rec, s, 0);

  return 0;
}

Measured memory_bytes: 1536
import sys
sys.setrecursionlimit(2000000)

N = int(input())
edges = [[] for _ in range(N+1)]
for _ in range(N-1):
    u,v,w = map(int,input().split())
    edges[u].append((v,w))
    edges[v].append((u,w))
color = [-1]*(N+1)
def dfs(n,p,c):
    color[n]=c
    for nx,w in edges[n]:
        if nx != p:
            if w % 2 == 0:
                nxC = c
            else:
                nxC = (c+1)%2
            dfs(nx,n,nxC)

dfs(1,0,0)
for i in range(1,N+1):
    print(color[i])

Measured memory_bytes: 171168
//  SMOKE SHISHA PLAY FIFA  // 
#include<bits/stdc++.h>
using namespace std;

typedef long long int ll;
typedef long double ld;

#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL);
#define pll pair<ll,ll>
#define mp make_pair
#define ff first
#define ss second
#define pb push_back
#define mod 1000000007
#define lp(start,end) for(ll i=start;i<=end;i++) 
#define deb1(a) cout<<#a<<" = "<<(a)<<endl;
#define deb2(a,b) cout<<#a<<" = "<<(a)<<", "<<#b<<" = "<<(b)<<endl;
#define deb3(a,b,c) cout<<#a<<" = "<<(a)<<", "<<#b<<" = "<<(b)<<", "<<#c<<" = "<<(c)<<endl;

ll dp[100007];
ll h[100007];
ll n,k;

ll modu(ll a, ll b)
{
	ll ans =1;
	while(b>0)
	{
		if(b&1)
		ans = (ans*a)%mod;
		b/=2;
		a = (a*a)%mod;
	}
	return ans;
}

ll fun(ll x)
{
	if(dp[x]!=1e9)
		return dp[x];
	if(x==n)
		dp[x]=0;
	else
	{
		for(ll i=1;i<=k && (x+i) <=n;i++)
		{
			dp[x] = min(dp[x],fun(x+i) + abs(h[x]-h[x+i]));
		}
	}
//	deb2(x,dp[x]);
	return dp[x];
}
int main()
{
	fastio
	
	cin >> n >> k;
	
	h[n+1]=0;
	h[n+2]=0;
	for(ll i=1;i<=n;i++)
		cin >> h[i];
	for(ll i=1;i<=n;i++)
		dp[i]=1e9;

	cout << fun(1) << endl;
	return 0;	
}


Measured memory_bytes: 4992
###
### atcorder test program
###

### math class
class math:
    ### GCD
    def gcd(self, a, b):
        if b == 0:
            return a
        return self.gcd(b, a%b)

### input num
#i = input()
#A, B, T = [int(x) for x in i.split()]
#N = int(input())
#A = [int(x) for x in input().split()]

while True:
    temp = input()
    A, B = [int(x) for x in temp.split()]
    if A == 0 and B == 0:
        break
    if A > B :
        print(B,A)
    else:
        print(A,B)



Measured memory_bytes: 5620
#include <bits/stdc++.h>
//#include <atcoder/all>
using namespace std;
//using namespace atcoder;
#define ll long long
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define rep1(i, n) FOR(i, 1, n+1)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; --i)
#define whole(x) (x).begin(),(x).end()
#define rwhole(x) (x).rbegin(), (x).rend()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define P pair<int, int>
#define debug(var) cerr << "[" << #var << "] " << var << endl
template<typename T1, typename T2>
bool chmax(T1 &a,T2 b){if(a<b){a=b;return true;}else return false;}
template<typename T1, typename T2>
bool chmin(T1 &a,T2 b){if(a>b){a=b;return true;}else return false;}
#define vi vector<int>
#define vl vector<ll>
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define pr(s) cout << (s) << '\n'
const ll mod = 1000000007;
const int dx[] = {-1,0,1,0};
const int dy[] = {0,-1,0,1};
const int INF = 1001001001;
const ll INFll = 1E+18;


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    ll n;
    cin >> n;
    ll ans = 0;
    for (int a=1; a<=n-1; a++) {
        ll num = (n-1)/a;
        ans += num;
    }
    
    
    pr(ans);
    return 0;
}


Measured memory_bytes: 3652
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>

#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 FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define INF 9999999999
#define m0(x) memset(x,0,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))
#define p(x) cout<<x<<endl;
#define pe(x) cout<<x<<" ";
//#define int long long


using namespace std;


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




ll gcd(ll x, ll y) {
	ll m = max(x, y), n = min(x, y);
	if (m%n == 0)return n;
	else return gcd(m%n, n);
}
ll lcm(ll x, ll y) {
	return x / gcd(x, y)*y;
}

ll myPow(ll x, ll n, ll m) {
	if (n == 0)
		return 1;
	if (n % 2 == 0)
		return myPow(x * x % m, n / 2, m);
	else
		return x * myPow(x, n - 1, m) % m;
}

ll pow2(ll a, ll n) {//aのn乗を計算します。
	ll x = 1;
	while (n > 0) {//全てのbitが捨てられるまで。
		if (n & 1) {//1番右のbitが1のとき。
			x = x * a;
		}
		a = a * a;
		n >>= 1;//bit全体を右に1つシフトして一番右を捨てる。
	}
	return x;
}

long long nCr(int n, int r) {
	if (r > n / 2) r = n - r; // because C(n, r) == C(n, n - r)
	long long ans = 1;
	int i;

	for (i = 1; i <= r; i++) {
		ans *= n - r + i;
		ans /= i;
	}

	return ans;
}


const int MOD = 1000000007;

bool arr[1050000];
vector<ll>sosuu;
void Eratosthenes() {
	ll N = 1050000;
	int c = 0;
	for (int i = 0; i < N; i++) {
		arr[i] = 1;
	}
	for (int i = 2; i < sqrt(N); i++) {
		if (arr[i]) {
			for (int j = 0; i * (j + 2) < N; j++) {
				arr[i *(j + 2)] = 0;
			}
		}
	}

	for (int i = 2; i < N; i++) {
		if (arr[i]) {
			sosuu.pb(i);
			//cout << sosuu[c] << " ";
			c++;
		}
	}
	//cout << endl;
	//cout << c << endl;
}


bool prime(ll n) {
	if (n == 1)return false;
	if (n == 2)return true;
	for (int i = 2; i < (int)sqrt(n) + 1;i++) {
		if (n%i == 0)return false;
	}
	return true;
}
vector<ll>sosu;
map<ll, int>mp;
int main() {
	ll N, P;
	cin >> N >> P;
	Eratosthenes();
	/*
	FOR(i, 2, 1000020) {
		if (prime(i))sosu.pb(i);
	}
	*/
	
	if (N == 1) {
		p(P);
		return 0;
	}
	ll x = P;
	if (P == 1) {
		p(1);
		return 0;
	}
	while (x >= 2) {
		for (auto i:sosuu) {
			if (x%i == 0) {
				mp[i]++;
				x /= i;
				break;
			}
			if (i >= (ll)sqrt(P))goto END;
		}
	}
	END:
	ll ans = 1;
	for (auto x : mp) {
		while (x.second / N > 0) {
			ans *= x.first;
			x.second -= N;
		}
	}
	p(ans);
}

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

//#define int long long
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<n;++i)
#define exrep(i, a, b) for(ll i = a; i < b; i++)
#define out(x) cout << x << endl
#define EPS (1e-7)
#define gearup ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<bool> > vvb;
typedef vector<vector<double> > vvd;
typedef vector<vector<string> > vvs;
typedef vector<ll> vl;
typedef vector<vector<ll> > vvl;
typedef vector<vector<vector<ll> > > vvvl;
ll MOD = 1000000007;
const long long L_INF = 1LL << 60;
const int INF = 2147483647; // 2^31-1
const double PI = acos(-1);
//cout<<fixed<<setprecision(10);

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> void debug(T v){rep(i,v.size()) cout<<v[i]<<" ";cout<<endl;}
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};

signed main()
{  
  gearup;
  int n,k; cin >> n >> k;
  ll max = (n-1)*(n-2)/2;
  if(k > max){
    out(-1);
    return 0;
  }
  ll cnt = max-k;
  vpii p;
  int u = 2,v = 3;
  rep(i,cnt){
    p.push_back({u,v});
    v++;
    if(v == n+1){
      u++;
      v = u+1;
    }
  }
  rep(i,n-1){
    p.push_back({1,i+2});
  }
  sort(all(p));
  out(p.size());
  for(auto a:p){
    cout << a.first << " " << a.second << endl;
  }
}


Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <stdio.h>
#include <vector>
#include <algorithm>


using namespace std;



int main() {
    int N;
    cin >> N;
    bool b = true;
    vector<int> a(N);
    for (int i = 0; i < N; i++) {
        cin >> a.at(i);
    }
    for (int i = 0; i < N; i++) {
        if (a.at(i) % 2 == 0) {
            if (a.at(i) % 3 != 0) {
                if (a.at(i) % 5 != 0) {
                    b = false;
                }
            }
        }
    }
    if (b) {
        cout << "APPROVED" << endl;
    }
    else {
        cout << "DENIED" << endl;
    }
    return 0;
}

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

using namespace std;

int main()
{
  int count = 0;
  string s;
  cin >> s;
  
  for(int i = 0; i < s.size(); i++)
  {
    for(int j = 0; j < s.size(); j++)
    {
      if(s[i] == s[j])
      {
        count++;
      }
    }
  }
  
  if(count > s.size())
  {
    cout << "no";
  }
  else
  {
    cout << "yes";
  }
}

Measured memory_bytes: 256
# 
n=gets.to_i
# print(n)
hash={}
# while num<n:
n.times{
    str=gets.split(' ')
    if str[0]=='insert'
        hash[str[1]]=1
    end
    if str[0]=='find'
        if hash[str[1]]==1
            puts "yes"
        else
            puts "no"
        end
    end
    
    # hash.sort{|(k1,v1),(k2,v2)| v2<=>v1}
}

# p hash


Measured memory_bytes: 41720
#include <iostream>
#include <algorithm>
using namespace std;
int main(void){
 
 int a[3];
 cin >> a[0] >> a[1] >> a[2];
 
 sort (a,a + 3);
 cout << (a[2] - a[1]) + (a[1] - a[0]) << endl;
 
 
 return 0; 
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<queue>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<queue>
#include<cstring>
#include<string>
#include<cmath>
#include<map>
#define mem0(a) memset(a,0,sizeof(a))
#define meminf(a) memset(a,0x3f,sizeof(a))
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef double db;
const int maxn =50005;
int n,m,x;
int a[110];
int sum[110];
int main()
{
    cin>>n>>m>>x;
    for(int i=0;i<m;i++)
    {
        int temp;
        scanf("%d",&temp);
        a[temp]++;
    }
    for(int i=1;i<=n;i++)
       sum[i]=sum[i-1]+a[i];
   cout<<min(sum[x],sum[n]-sum[x]);
   return 0;
}

Measured memory_bytes: 256
//inlclude前用define 
#define _USE_MATH_DEFINES

//include
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<type_traits>
#include<numeric>
//#include<deque>
#include<iomanip>
#include<set>
#include<tuple>
#include<map>
#include<limits>

using namespace std;

//typedef
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<char> VC;
typedef long long int ll;

//define
#define INF 1e9 
#define NUM 1000000007
#define all(x) begin(x), end(x)
#define rep(i,n) for(int i=0;i<(int)(n);i++)

int main(){
  string s,t,u;
  int a,b;
  cin>>s>>t>>a>>b>>u;

  if(u==s) a--;
  else b--;

  cout<<a<<" "<<b<<endl;


}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ull unsigned long long int
#define ld long double
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define intarr(arr, n)  ll arr[n];  for (ll i = 0; i < n; i++)  cin >> arr[i]
#define inpvec(vec,n) for(ll i=0;i<n;i++){ll var;cin>>var;vec.push_back(var);}
#define ff first
#define ss second
#define pb push_back
#define mkp make_pair
#define vec vector<ll>
#define pi pair<ll,ll>
#define changeline cout<<endl
#define loop(i,a,b) for(ll i=a;i<b;i++)
#define rev(i,a,b) for(ll i=a;i>=b;i--)
#define all(v) v.begin(),v.end()
#define mod2 998244353
#define NO cout << "NO" <<endl
#define YES cout << "YES" <<endl
#define mem(arr,val) memset(arr,val,sizeof(arr));
const ll mod=1e9+7;
#define piii 3.14159265358979323846264338327950
#define print(a, n, m)     for (ll i = n; i < m; i++) {  cout << a[i] << " "; }  cout << endl
#define con continue

ll cnt;
template<typename T>
class G
{
    unordered_map<T,list<T> > adjList;

    void DFSHelper(T src,map<T,bool> &visited,ll &ans){
        visited[src] = true;
        ans++;
        for(auto node:adjList[src]){
            if(!visited[node]){
                DFSHelper(node,visited,ans);
            }
        }
    }   
public:
    void addEdge(T u,T v,bool bi=true){
        adjList[u].push_back(v);
        if(bi){
            adjList[v].push_back(u);            
        }
    }

    

    void DFS(T src)
    {
        map<ll,ll> k;
        map<T,bool> visited;
        ll ans=0;
        ll component = 1;
        DFSHelper(src,visited,ans);
        cnt=ans;
        for(auto node:adjList)
        {
            if(!visited[node.first])
            {
                ans=0;
                ll asn= 0;
                DFSHelper(node.first,visited,ans);
                component ++;
                cnt=max(cnt,ans);
            }
        }
        

        //cout<<endl;
    }
};


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

    cnt=0;
    ll p = 0;
    G<ll> g;

    ll n,m;
    ll n2= 0;
    cin>>n>>m;
    loop(i,0,m)
    {
        ll u,v;
        cin>>u>>v;
        g.addEdge(u,v);
    }

    g.DFS(1);
    cout<<cnt<<endl;
    
    return 0; 
}

Measured memory_bytes: 61220
#include <bits/stdc++.h>
 
#define rep(i,n) for(ll i=0;i<n;++i)
#define ALL(a) (a).begin(),(a).end()
 
using namespace std;
using ll  = long long;
using pll = pair<ll, ll>;
using pdd = pair<double, double>;
 
const ll MOD  = 1e9 + 7;
const ll LINF = 1LL << 60;
const int INF = 1e9 + 7;

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

    ll n = s.back() - '0';
    if(n == 3)cout << "bon\n";
    else if(n == 0 || n == 6 || n == 1 || n == 8)cout << "pon";
    else cout << "hon";
}

Measured memory_bytes: 3628
n,m=map(int,input().split())
ans=0
import math
def combinations_count(w, r):
    return math.factorial(w) // (math.factorial(w - r) * math.factorial(r))
if n<=1:
    pass
else:
    ans+=combinations_count(n,2)
if m<=1:
    pass
else:
    ans+=combinations_count(m,2)
print(ans)

Measured memory_bytes: 3060
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        #[cfg(debug_assertions)]
        writeln!(&mut std::io::stderr(), concat!("[DEBUG] ", $(stringify!($a), "={:?} "),*), $($a),*);
    }
}

#[allow(unused_imports)]
use std::cmp::{min, max};
#[allow(unused_imports)]
use std::io::{stdout, stdin, BufWriter, Write};

fn main() {
    let out = std::io::stdout();
    let mut out = BufWriter::new(out.lock());
    macro_rules! puts {
        ($($format:tt)*) => (write!(out,$($format)*).unwrap());
    }

    input!{
      s: chars,
    }

    let mut t = vec![];
    for &c in s.iter() {
        if c != 'x' {
            t.push(c);
        }
    }
    let mut r = t.clone();
    r.reverse();
    if t != r {
        return puts!("{}\n", -1);
    }

    let half = (t.len()+1)/2 - 1;
    let mut l = 0;
    let mut r = s.len()-1;
    let mut ans = 0;

    for i in 0..half+1 {
        let mut lx = 0i64;
        let mut rx = 0i64;

        while s[l] == 'x' {
            lx += 1;
            l += 1;
        }
        l += 1;

        while s[r] == 'x' {
            rx += 1;
            r -= 1;
        }
        if r > 0 {
            r -= 1;
        }
        ans += (lx -rx).abs();
    }
    puts!("{}\n", ans);
}


Measured memory_bytes: 6396
#include<stdio.h>
int main(){
  int a,b,c,swap;
  scanf("%d%d%d",&a,&b,&c);
  if(a>c){
    swap=a;
    a=c;
    c=swap;
  }
  if(a>b){
    swap=a;
    a=b;
    b=swap;
  }
  if(b>c){
    swap=b;
    b=c;
    c=swap;
  }
  printf("%d %d %d\n",a,b,c);
  return 0;
}


Measured memory_bytes: 2104
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>

using namespace std;

#define square(s) (s)*(s)
#define scast(type,e) static_cast<type>(e)
#define rep(i,n) for(int i = 0; i < n;i++)

template<class T>
using vec = vector<T>;
using ll = long long;
using ull = unsigned long long;



int main() {
	int n;
	cin >> n;
	vec<int> A(n);
	ll sum = 0;
	rep(i, n) {
		cin >> A[i];
		sum += A[i];
	}
	int first = sum;
	for (int i = 1; i < n; i += 2) {
		first -= 2 * A[i];
	}
	cout << first;
	
	int last = first;
	rep(i, n - 1) {
		last = 2 * A[i] - last;
		cout << " " << last;
	}
	cout << endl;
	

}

Measured memory_bytes: 1664
#include <bits/stdc++.h>
#define mod 1000000007
#define pb emplace_back
#define dbg(x) cout << x << endl
#define check(k, i, j) ((k>=i) && (k<=j))
#define FAST_IO ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL)
typedef long long ll;
using namespace std;
int dx[] = {0, -1, 0, 1};
int dy[] = {1, 0, -1, 0};

template<typename T>
void printV(vector<T> v){
    for(int i=0; i<v.size(); i++){
        cout << v[i]%mod << " ";
    }
    cout << endl;
}

template<typename T>
void printA(T arr[], ll n){
    for(int i=0; i<n; i++){
        cout << arr[i] << " ";
    }
    cout << endl;
}

template<typename T>
void printPA(T* arr, ll n){
    for(int i=0; i<n; i++){
        cout << arr[i] << " ";
    }
    cout << endl;
}

// ===================================== //

int main(){

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

    FAST_IO;
    int n;
    cin >> n;
    vector<int> v(4);
    for(int i=0; i<n; i++){
        string s;
        cin >> s;
        if(s=="AC"){
            v[0]++;
        }
        else if(s=="WA"){
            v[1]++;
        }
        else if(s=="TLE"){
            v[2]++;
        }
        else{
            v[3]++;
        }
    }
    cout << "AC x " << v[0] << endl;
    cout << "WA x " << v[1] << endl;
    cout << "TLE x " << v[2] << endl;
    cout << "RE x " << v[3] << endl; 
}


Measured memory_bytes: 3656
#include <bits/stdc++.h>
#define int long long

using namespace std;

int gcd(int a, int b) {
    return b == 0 ? a : gcd(b, a%b);
}

int n, m;
string s1, s2;

void init() {
    cin >> n >> m >> s1 >> s2;
}

void solve() {
    if(s1[0] != s2[0]) cout << "-1\n";
    else {
        int L = n*m/gcd(n, m);
        map<int, char> x;
        for(int i = 0 ; i < n ; i++) x[L*i/n] = s1[i];
        for(int i = 0 ; i < m ; i++) if(x.find(L*i/m) != x.end() && x[L*i/m] != s2[i]) {
            cout << "-1\n";
            return;
        }

        cout << L << '\n';
    }
}

int32_t main() {
    init();
    solve();
}


Measured memory_bytes: 6144
# -*- coding: utf-8 -*-
 
import math
import itertools
import sys
import copy
 
# 入力
#A, B, C, D = map(int, input().split())
#L = list(map(int, input().split()))
#S = list(str(input()))
#N = int(input())
#S = str(input())
H, W = map(int, input().split())

for i in range(1, H+1) :
  L = list(map(str, input().split()))
  for j in range(W) :
    if L[j] == "snuke" :
      s = chr(j+ord("A")) + str(i)
      print (s)
      exit()




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

#define rep(i,s,n) for (int i = (int)s; i < (int)n; i++)
#define ll long long
#define pb push_back
#define eb emplace_back
#define All(x) x.begin(), x.end()
#define Range(x, i, j) x.begin() + i, x.begin() + j
#define lbidx(x, y) lower_bound(x.begin(), x.end(), y) - x.begin()
#define ubidx(x, y) upper_bound(x.begin(), x.end(), y) - x.begin()
#define llbidx(x, y, z) lower_bound(x.begin(), x.end(), z) - lower_bound(x.begin(), x.end(), y) // 二要素間の距離
#define deg2rad(deg) ((((double)deg)/((double)360)*2*M_PI))
#define rad2deg(rad) ((((double)rad)/(double)2/M_PI)*(double)360)
#define Find(set, element) set.find(element) != set.end()
#define Decimal(x) printf("%.10f\n", x) // 小数点を10桁まで表示
// debug用
#define PrintVec(x) for (auto elementPrintVec: x) { cout << elementPrintVec << " "; } cout << endl;

typedef pair<int, int> PI;
typedef pair<ll, ll> PLL;

int POWINT(int x, int n) {
  int ret = 1;
  rep(i, 0, n) ret *= x;
  return ret;
};

ll POWLL(int x, int n) {
  ll ret = 1;
  rep(i, 0, n) ret *= x;
  return ret;
};

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

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

int main() {
  int M;
  cin >> M;
  cout << 48 - M << endl;
};


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

int main(){

    int a, b;   cin >> a >> b;
    string s; cin >> s;

    bool isT = true;
    for(int i = 0; i < a; i++){
        if(s[i] == '-'){
            isT = false;
            break;
        }
    }
    if(s[a] != '-') isT = false;

    for (auto i = a+1; i < s.size(); i++)
    {
        if(s[i] == '-'){
            isT = false;
            break;
        }
    }
     
    cout << (isT?"Yes":"No") << endl; 

    return 0;
}

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

int main(){
  int n;
  cin >> n;
  int ans=1;
  for(int i=2;i<=sqrt(n);i++){
    int x=i*i;
    while(x<=n){
      ans=max(ans,x);
      x*=i;
    }
  }
  cout << ans << endl;
}

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

using namespace std;
#define FOR(i,o,n) for(long long i = o;i<n;i++)
#define oneforall ios::sync_with_stdio(false);cin.tie(0);
#define all(v) (v).begin(),(v).end()
#define ini(...) int __VA_ARGS__; in(__VA_ARGS__)
#define inl(...) long long __VA_ARGS__; in(__VA_ARGS__)
#define ins(...) string __VA_ARGS__; in(__VA_ARGS__)
#define int long long
const long long INF=1e18;
void in(){} template <typename T,class... U> void in(T &t,U &...u){ cin >> t; in(u...);}
void out(){cout << "\n";} template <typename T,class... U> void out(const T &t,const U &...u){ cout << t; if(sizeof...(u)) cout << " "; out(u...);}
typedef vector<int> vi;
typedef vector<long long> vl;
typedef long long ll;
typedef vector<pair<long, long > > vpll;
typedef vector<pair<int, int > > vpii;


int32_t main() {
    oneforall
    oneforall
    oneforall
    oneforall
    oneforall
    oneforall
    oneforall
    oneforall
    oneforall
    oneforall
    oneforall
    oneforall
    oneforall
    oneforall
    
    
    ini(x);
    ini(x1);
    ini(x_);
    ini(pizza1);
    ini(pizza2);
    int tmp1 = x*pizza1+x1*pizza2;
    int tmp2 = x_*2*pizza1+(pizza1<pizza2?(pizza2-pizza1)*x1:0);
    int tmp3 = x_*2*pizza2+(pizza2<pizza1?(pizza1-pizza2)*x:0);
    int tmp = min({tmp1,tmp2,tmp3});
    out(tmp);
    


  
    
    
    
    
    
    
    
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main()
{
    int a,b;
    scanf("%d %d",&a,&b);
    if(a < b){
        printf("a < b\n");
    }
    else if(a > b){
        printf("a > b\n");
    }
    else{
        printf("a == b\n");
    }
    return 0;
}

Measured memory_bytes: 580
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder2 {
	class Program {
		static void Main(string[] args) {

			//出力の都度更新をやめる
			var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
			Console.SetOut(sw);


			Ans();

			//更新する
			Console.Out.Flush();
			
		}
public static void Ans() {

			var inputArray = retreiveLongArray();
			var inputCount = 1;

			// 不正な入力は処理しない
			if (inputArray.Length != inputCount) {
				Console.WriteLine("invalid input");
				return;
			}
			long N = inputArray[0];

			var stones = retreiveStringArray()[0].Select(x => x).ToArray() ;

			var count = 0;
			var right = N - 1;
			for (int i = 0; i < N; i++) {
				var stone = stones[i];

				if (stone=='W') {
					var irekae = getRedStone(stones, i, right);
					if (irekae==-1) {
						break;
					}
					stones[i] = 'R';
					stones[irekae] = 'W';
					right = irekae - 1;
					count++;
				}


			}

			//答えの出力
			var ans =count;
			Console.WriteLine(ans);

		}

		/// <summary>
		/// 指定された右端から赤い石を探す
		/// </summary>
		/// <param name="stones"></param>
		/// <param name="left"></param>
		/// <param name="right"></param>
		/// <returns></returns>
		private static long getRedStone(char[] stones,long left,long right) {

			long target = -1;
			for (var i = right; i >= left; i--) {
				if (stones[i]=='R') {
					target = i;
					break;
				}
			}
			return target;
		}

		/// <summary>
		/// スペースで区切られた文字列配列の入力を受け取る
		/// </summary>
		/// <returns></returns>
		private static string[] retreiveStringArray() {
			var inputArray = Console.ReadLine().Split(' ');
			return inputArray;
		}

		/// <summary>
		/// スペースで区切られた整数配列の入力を受け取る
		/// </summary>
		/// <returns></returns>
		private static long[] retreiveLongArray() {
			var inputArray = Console.ReadLine().Split(' ');
			var longArray = inputArray.Select(s => long.Parse(s));
			return longArray.ToArray();
		}


		/// <summary>
		/// 2組みずつの入力データ(数値)からTuppleListを作成する
		/// </summary>
		/// <param name="N"></param>
		/// <returns></returns>
		private static List<Tuple<long, long>> createLongTuppleList(long N) {
			var inpList = new List<Tuple<long, long>>();

			for (int i = 0; i < N; i++) {
				var inp = retreiveLongArray();
				var item1 = inp[0];
				var item2 = inp[1];
				inpList.Add(new Tuple<long, long>(item1, item2));
			}
			return inpList;
		}
	}
}

Measured memory_bytes: 29884
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using vi = vector<ll>;

int main(void) {
    ull n, a, b;
    cin >> n >> a >> b;
    if (!a) {
        cout << 0 << endl;
        return 0;
    }
    ull sum = a + b;
    ull divided = n / sum;
    ull mod = n % sum;
    ull blue = divided * a + min(a, mod);
    cout << blue << endl;
    return 0;
}


Measured memory_bytes: 256
A,B,M = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
XYC = [tuple(map(int,input().split())) for i in range(M)]

ans = min(A) + min(B)
for x,y,c in XYC:
    x,y = x-1,y-1
    p = A[x] + B[y] - c
    ans = min(ans,p)
print(ans)

Measured memory_bytes: 29428
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main() {
    long double x;
    cin>>x;
    long double val=100;
    ll count=0;
    while(val<x)
    {
        count+=1;
        val=val*(long double)1.01;
        val=(ll)val;
    }
    cout<<count;
}

Measured memory_bytes: 3744
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
#include <set>

using namespace std;

int n;
set<string> ans;

void dfs(string s, char maxi) {
	if (s.size() == n) {
		ans.insert(s);
		return;
	}

	for (char c = 'a'; c <= maxi + 1; c++) {
		dfs(s + c, max(c, maxi));
	}
}

int main() {
	cin >> n;

	dfs("a", 'a');
	for (auto s: ans) {
		cout << s << endl;
	}
	return 0;
}


Measured memory_bytes: 12416
#include<bits/stdc++.h>
typedef long long int ll;
#define pb push_back
#define mp make_pair
#define pi  3.141592653589793238462643383279
#define int long long
#define ff first
#define ss second
#define endl '\n'
#define all(x) (x).begin(), (x).end()
#define rep(i,x,y) for(int i=(int)x; i<y; i++)
#define high_functioning_sociopath  ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
const unsigned int M = 998244353;
/*------------------------------------- THE GAME IS ON ---------------------------------------------*/
void solve()
{
       int k;
       cin>>k;
       string s="ACL";
       for(int i=0;i<k;i++)cout<<s;
}
int32_t main()
{
   high_functioning_sociopath
   ll t=1;
   //cin>>t;
   while(t--)
   {
      solve();
   }
}

Measured memory_bytes: 3596
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <string>
#include <iomanip>
#include <math.h>
#include <utility>
#include <vector>
#include <map>
#include <unordered_map>
#include <cstdlib>
#include <stack>
#include <queue>
#define div1 1000000007
const long long INF = 1LL << 60;
using namespace std;
using ll = long long;
using ld = long double;
// a>b -> a==b;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
// a<b -> a==b;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

int main(void)
{
    ll N, K, a, b, ans=0, num;

    cin >> N >> K;

    if(K > N*2){
        cout << 0 << endl;
    }

    else if(K%2==1){
        a = N/K;
        ans = powl(a,3);
        cout << ans << endl;
    }

    else if(K%2==0){
        a = N/K;
        ans += powl(a,3);

        if(N%K >= K/2){
            b = a+1;
        }
        else{
            b = a;
        }

        ans += powl(b,3);

        cout << ans << endl;
    }

    return 0;
}

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

string str;
stack<char> blacket;

void init() {
	str.clear();
	while(!blacket.empty())
		blacket.pop();
}

bool input() {
	getline(cin, str);
	if(str.size() == 1 && str[0] == '.')
		return false;

	return true;
}

bool solve() {
	for(int i = 0; i < str.size(); i++) {
		switch(str[i]) {
			case '(':
				blacket.push(str[i]);
				break;
			case '[':
				blacket.push(str[i]);
				break;
			case ')':
				if(blacket.size() > 0 && blacket.top() == '(')
					blacket.pop();
				else
					return false;
				break;
			case ']':
				if(blacket.size() > 0 && blacket.top() == '[')
					blacket.pop();
				else
					return false;
				break;
		}
	}

	if(blacket.size() > 0)
		return false;

	return true;
}

int main() {
	while(init(), input()) {
		if(solve())
			cout << "yes" << endl;
		else
			cout << "no" << endl;
	}
	
	return 0;
}

Measured memory_bytes: 1172
def max(a, b)
  a > b ? a : b
end

N, W = gets.chomp.split.map(&:to_i)
dp = Array.new(W + 1) { -1 }
dp[0] = 0
N.times do
  wi, vi = gets.chomp.split.map(&:to_i)

  (W-wi).downto(0) do |j|
    next if dp[j] == -1

    dp[j + wi] = max(dp[j + wi], dp[j] + vi)
  end
end

puts dp.max

Measured memory_bytes: 2556
#coding:utf-8
#A,Bの上からi桁目のビットの組み合わせの数を求める
L = input()
lenL = len(L)
dp1 = [0] * lenL  #i桁目まででL未満になることが確定済みの組み合わせの数
dp2 = [0] * lenL  #i桁目まででA+BがLと一致している組み合わせの数、dp1[i+1]を求めるためにも利用
dp1[0] = 1 #0... となる数,最初の1桁目は(0,0)
dp2[0] = 2 #1... 

mod = 10**9 + 7
for i in range(1,lenL):
    
    dp1[i] = (3 * dp1[i-1]) % mod  #L未満であることは確定しているので(0,0),(1,0),(0,1)の3通り
    if L[i] == '1':
        dp2[i] = (dp2[i] + 2 * dp2[i-1]) % mod  #A+BをLと一致させるために(1,0),(0,1)の2通りをとる
        dp1[i] = (dp1[i] + dp2[i-1]) % mod  #Lのi桁目が1で(0,0)を選択した場合これ以降の桁(この桁を含む)でどんな組み合わせを選んでもL以下になることが確定
    else:
        dp2[i] = dp2[i-1]  #A+BをLと一致させるために(0,0)の1通り

print((dp1[-1] + dp2[-1]) % mod)

Measured memory_bytes: 11108
#include <iostream>
#include <iomanip>
#include <ios>
#include <sstream>
#include <cstdio>

#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <numeric>
#include <regex>
#include <utility>
#include <random>

#include <cstddef>
#include <cstdint>
#include <cfloat>
#include <limits>

#include <array>
#include <bitset>
#include <iterator>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <valarray>
#include <vector>
#include <deque>
#include <forward_list>

#define FOR(i, a, b) for(auto i{a}; i < (b); ++i)
#define RFOR(i, a, b) for(auto i{(b)-1};i >= (a); --i)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, 0, n)
#define ALL(a) std::begin(a), std::end(a)
#define EACH(x, xs) for (auto &x : xs)
#define CAST static_cast

template<typename T>
constexpr bool in_range(T const &l, T const &a, T const &u){ return l < a && a < u; };
constexpr double inf {std::numeric_limits<double>::infinity()};

#define FAST_TYPE
#ifdef FAST_TYPE
using i32 = std::int_fast32_t;  using i64 = std::int_fast64_t;
using u32 = std::uint_fast32_t; using u64 = std::uint_fast64_t;
#else
using i32 = std::int_least32_t;  using i64 = std::int_least64_t;
using u32 = std::uint_least32_t; using u64 = std::uint_least64_t;
#endif

using imx = std::intmax_t;
using umx = std::uintmax_t;

using namespace std;

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

  i64 W, H, x, y;

  cin >> W >> H >> x >> y;

  double area = W * H / 2.;

  cout << area << ' ' << (W == x * 2 && H == y * 2) << endl;

  return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <array>
#include <bitset>
#include <climits>
#include <cmath>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

typedef long long ll;

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

  vector<int> v = {1, 1, 1, 2, 1, 2, 1, 5,  2, 2, 1, 5, 1, 2, 1, 14,
                   1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  int k;
  cin >> k;
  cout << v[k - 1];
}

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

int main() {
  vector<int> vec(3);
  
  for (int i=0; i<3; i++) {
    cin >> vec.at(i);
  }
  
  sort(vec.begin(),vec.end());
  
  if (vec.at(0)==5 && vec.at(1)==5 && vec.at(2)==7) {
    cout << "YES" << endl;
  }
  
  else {
    cout << "NO" << endl;
  }
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<stdint.h>
#include<inttypes.h>

typedef int32_t i32;
typedef int64_t i64;

#define MAX(a,b) ((a) > (b) ? (a) : (b))

void run (void) {
  i32 n = 1000;
  scanf ("%" SCNi32, &n);
  i32 *s = (i32 *) calloc (n, sizeof (i32));
  for (i32 i = 0; i < n; ++i) {
    scanf ("%" SCNi32, s + i);
  }
  i64 max = 0;
  for (i32 d = 1; d < n - d; ++d) {
    i64 sum = 0;
    for (i32 k = 2; n - 1 - k * d > 0; ++k) {
      sum += s[(k - 1) * d] + s[n - 1 - (k - 1) * d];
      i32 b = n - 1 - k * d;
      if (b % d == 0 && b / d + 1 < k) break;
      max = MAX (max, sum);
    }
  }
  printf ("%" PRIi64 "\n", max);
}

int main (void) {
  run();
  return 0;
}


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

typedef long long ll;

int N;
ll mod = 1000000007;
ll A,B;
ll S[100010];
ll bit[100010];

void init()
{
    for(int i = 0; i <= N + 10; i++)bit[i] = 0;
    return;
}

void add(int i,ll x)
{
    i += 2;
    while(i <= N + 10)
    {
        bit[i] = (bit[i] + mod + x) % mod;
        i += i & -i;
    }
    return;
}

ll sum(int i)
{
    i += 2;
    ll res = 0;
    while(i > 0)
    {
        res = (res + bit[i]) % mod;
        i -= i & -i;
    }
    return res;
}

int main()
{
    scanf("%d%lld%lld",&N,&A,&B);
    for(int i = 1; i <= N; i++)scanf("%lld",S + i);
    S[0] = -1001001001001001001;

    if(A > B)swap(A,B);
    init();

    add(0,1LL);
    add(1,1LL);

    int z = 0,l = 0;
    for(int i = 2; i <= N; i++)
    {
        if(S[i] - S[i - 2] < A)

        {
            printf("0\n");
            return 0;
        }
        while(S[i] - S[l] >= B)l++;
        add(i,sum(l - 1));

        if(S[i] - S[i - 1] < A)
            for(;z < i - 1; z++)add(z,-sum(z));
    }
    printf("%lld\n",sum(N));
    return 0;
}


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

#define mem(dp,a)           memset(dp,a,sizeof dp)
#define rep(i,a,b)          for(ll i=a;i<b;i++)
#define pb(x)               push_back(x)
#define mp(x,y)             make_pair(x,y)
#define xlr8                ios_base::sync_with_stdio(false);cin.tie(NULL)
#define F                   first
#define S                   second
#define all(c)              (c).begin(),(c).end()

vector<ll> def;

int main()
{
    int n,k;cin>>n>>k;
    def.pb(0);
    rep(i,1,105)
    def.pb((i*(i+1))/2);

    if(k>(((n-1)*(n-2))/2))
        cout<<-1;
    else if(k==0)
    {
        cout<<n*(n-1)/2<<"\n";
        for(int i=1;i<=n;i++)
        {
            for(int j=i+1;j<=n;j++)
                cout<<i<<" "<<j<<"\n";
        }
    }
    else
    {
        vector<pair<int,int>> ans;
        vector<ll>::iterator it = lower_bound(def.begin(),def.end(),k+1);
        int in=it-def.begin();
        in+=1;
        int out=in;in=n-in;
        for(int i=out+1;i<=n;i++)
            for(int j=1;j<i;j++)
                if(i!=j)ans.push_back({i,j});
        int req=(out*(out-1))/2;
        req=req-k;
        for(int i=2;i<=req+1;i++)
            ans.push_back({1,i});

        int siz=ans.size();
        cout<<siz<<"\n";
        for(auto to : ans)
            cout<<to.first<<" "<<to.second<<"\n";
    }
}


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

#define mod 1000000007
using ll=long long;

ll modpow(ll n,ll m=mod-2){
  ll r=1;
  while(m){
    r=r*((m%2)?n:1)%mod,n=n*n%mod,m>>=1;
  }
  return r;
}

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

	ll ans = modpow(10,n);
	ans=ans+modpow(8,n);
	ans=ans-modpow(9,n)*2;
    ans=ans%mod;

	//これだとオーバーフローする
	//ll ans = modpow(10,n)+modpow(8,n)-modpow(9,n)-modpow(9,n);

	ans=(ans+mod)%mod;
	cout << ans << endl;
}


Measured memory_bytes: 3632
A = int(input())
No1,No2 = 0,0
for i in range(A):
    B = int(input())
    if No2 < B:
        No2 = B
        if No1 < B:
            place = i
        No1,No2 = max(No1,No2),min(No1,No2)
if No1 == No2:
    for i in range(A):
        print(No1)
else:
    for i in range(place):
        print(No1)
    print(No2)
    for i in range(A-place-1):
        print(No1)

Measured memory_bytes: 4668
#include <iostream>
#include <cstdio>
using namespace std;
int n,r;
int main()
{
	scanf("%d %d",&n,&r);
	if (n>=10) return 0&printf("%d\n",r);
	else return 0&printf("%d\n",100*(10-n)+r);
	return 0;
}

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

int n, m, x;
int c[20], a[20][20];
int re[20];

constexpr int INF = 1e7;

void add(int index)
{

    for (int i = 0; i < m; ++i)
        re[i] += a[index][i];
}

bool ok()
{

    for (int i = 0; i < m; ++i)
    {
        if (re[i] < x)
            return 0;
    }
    return 1;
}

void init()
{
    for (int i = 0; i < m; ++i)
        re[i] = 0;
}

int main()
{

    std::cin >> n >> m >> x;

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

    int ans = INF;

    for (int bit = 0; bit < (1 << n); ++bit)
    {
        init();

        int cst = 0;

        for (int i = 0; i < n; ++i)
        {
            if (bit & (1 << i))
            {
                add(i);
                cst += c[i];
            }
        }
        //if (cst == 1067)
        //std::cerr << "DD" << std::endl;
        if (ok())
            ans = std::min(ans, cst);
    }

    std::cout << ((ans == INF) ? -1 : ans) << std::endl;

    return 0;
}

Measured memory_bytes: 3192
n, c, k = map(int, input().split(" "))
t = []
for i in range(n):
    t.append(int(input()))

t.sort()
i = 0
count = 0
while i < n:
    
    j = i + 1
    if i == n - 1:
        count += 1
        break
    while t[j] - t[i] <= k and j < i + c:
        j += 1
        if j == n:
            i = j
            break

    i = j
    count += 1

print(count)

Measured memory_bytes: 13352
#include<stdio.h>
int main(){
    int c[3][3];

    for(int i=0;i<3;i++){
        for(int j=0;j<3;j++){
            scanf("%d",&c[i][j]);
        }
    }
    int min_x[3],min_y[3];
    for(int i=0;i<3;i++){
        min_x[i]=101;
        min_y[i]=101;
    }

    for(int i=0;i<3;i++){
        for(int j=0;j<3;j++){
            if(min_x[i]>c[i][j]){
                min_x[i]=c[i][j];
            }
        }
        for(int j=0;j<3;j++){
            c[i][j]-=min_x[i];
        }
    }
    for(int i=0;i<3;i++){
        for(int j=0;j<3;j++){
            if(min_y[i]>c[j][i]){
                min_y[i]=c[j][i];
            }
        }
        for(int j=0;j<3;j++){
            c[j][i]-=min_y[i];
        }
    }
    
    for(int i=0;i<3;i++){
        for(int j=0;j<3;j++){
            if(c[i][j]){
               printf("No\n");
               return 0; 
            }
        }
    }
    printf("Yes\n");
    return 0;
}

Measured memory_bytes: 128
from collections import Counter

n = int(input())
S = [input() for _ in range(n)]
S_cnt = Counter(S)

print('AC x ' + str(S_cnt['AC']))
print('WA x ' + str(S_cnt['WA']))
print('TLE x ' + str(S_cnt['TLE']))
print('RE x ' + str(S_cnt['RE']))


Measured memory_bytes: 16488
import java.util.*;
import java.io.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
import static java.lang.Math.*;

public class Main {

	int INF = 1 << 28;
	//long INF = 1L << 62;
	double EPS = 1e-10;

	void run() {
		Scanner sc = new Scanner(System.in);
		for (int c=1;;c++) {
			int W = sc.nextInt();
			if (W == 0) break;
			
			int n = sc.nextInt();
			int[] v = new int[n], w = new int[n];
			for (int i=0;i<n;i++) {
				String[] ws = sc.next().split(",");
				v[i] = Integer.valueOf(ws[0]); w[i] = Integer.valueOf(ws[1]);
			}
			
			int[] dp = new int[W+1];
			fill(dp, -1); dp[0] = 0;
			for (int i=0;i<n;i++) for (int j=W;j>=w[i];j--) if (dp[j-w[i]]>=0){
				dp[j] = max(dp[j], dp[j-w[i]] + v[i]);
			}
			int aw = 0, av = 0;
			for (int i=0;i<=W;i++) if (av < dp[i]){
				av = dp[i];
				aw = i;
			}
			System.out.println("Case " + c + ":");
			System.out.println(av);
			System.out.println(aw);
		}
	}

	void debug(Object... os) {
		System.err.println(Arrays.deepToString(os));
	}

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

Measured memory_bytes: 25264
def lcs(x, y)
  xn = x.size
  yn = y.size
  m = Array.new(yn+1){0}
  xn.times{|i|
    tmp = m.clone
    yn.times{|j|
      k = j+1
      if x[i] == y[j] then
        m[k] = tmp[j] + 1
      elsif m[k] < m[j]
        m[k] = m[j]
      end
    }
  }
  return m[-1]
end

n = gets.to_i
n.times{
  x = gets.chomp.split("")
  y = gets.chomp.split("")
  puts lcs(x, y)
}

Measured memory_bytes: 52884
import collections

def main():
    N=int(input())
    if N==0:
        return 0
    DL=[int(x) for x in input().split()]
    if DL[0]!=0:
        return 0
    
    
    dic=collections.Counter(DL)
    if dic[0]!=1:
        return 0
    keys=dic.keys()
    result=1
    for i in range(1,max(keys)+1):
        if dic[i]==0 and dic[i-1]==0:
            return 0
        result*=dic[i-1]**dic[i]

    return result%998244353


print(main())


Measured memory_bytes: 62260
#include<iostream>
#include<vector>
#include<cstdio>
using namespace std;
int main(){
    int h,w;
    cin>>h>>w;
    int hw[h][w];
    int ans[250000][4];
    int n=0;
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            cin>>hw[i][j];
        }
    }
    for(int i=0;i<h-1;i++){
        for(int j=0;j<w;j++){
            if(hw[i][j]%2!=0){
                hw[i+1][j]++;
                ans[n][0]=i+1;
                ans[n][1]=j+1;
                ans[n][2]=i+2;
                ans[n][3]=j+1;
                n++;
            }
        }
    }
    for(int j=0;j<w-1;j++){
        if(hw[h-1][j]%2!=0){
            hw[h-1][j+1]++;
            ans[n][0]=h;
            ans[n][1]=j+1;
            ans[n][2]=h;
            ans[n][3]=j+2;
            n++;
        }
    }
    cout<<n<<endl;
    for(int i=0;i<n;i++){
        printf("%d %d %d %d\n",ans[i][0],ans[i][1],ans[i][2],ans[i][3]);
    }
    return 0;
}


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

int main() {
    vector<int> v(5);
    for(int i=0; i<5; ++i) {
        cin >> v[i];
    }
    sort(v.rbegin(), v.rend());
    for(int i=0; i<5; ++i) {
        cout << v[i] << " \n"[i == 4] << flush;
    }
}


Measured memory_bytes: 3084
s=input().rstrip()
x=list(s)
if len(x)%2!=0:
  C=list(s)
  C.reverse();
  if(C!=x):
    print("No")
  else:
    A=(len(x)-1)//2;
    B=x[0:A];
    A=(len(x)+3)//2;
    C=x[A-1:len(x)]
    D=list(B)
    E=list(C)
    D.reverse();
    E.reverse();
    if(B==D and E==C):
      print("Yes")
    else:
      print("No")
else:
  print("No")

Measured memory_bytes: 38256