akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
const int MX = 200005;

    // 整数スキャン（複数）
    /*
    int x;
    scanf("%d",&x);
    int y;
    scanf("%d",&y);
    int z;
    scanf("%d",&z);

    // n個の整数のスキャン
    /*
    ll a[n] = {};
    rep(i,n){
        scanf("%lld",&a[i]);
    }
    */

    // 文字列スキャン
    /*
    string s;
    cin >> s;
    */

    // n個の文字列スキャン
    /*
    vector<string> slist;
    rep(i,n){
        string s;
        cin >> s;
        slist.push_back(s);
    }
    */

int main() {
    int n;
    scanf("%d",&n);
    int a[1000] = {4,8,16,32,64,128,256,512,9,27,81,243,729,25,125,625,36,216,343,1000};
    int count = 100;
    srep(i,1,32){
        a[count]=i*i;
        count++;
    }
    sort(a,a+1000);
    drep(i,1000){
        if(a[i]<=n){
            cout << a[i] << endl;
            return 0;
        }
    }



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


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

int main(void)
{
    char s[200000];
    int n;
    int len;
    char next[200000];
    char tmp[128];
    int i, j, k;

    while (scanf("%d", &n)){
        if (n == 0){
            break;
        }
        scanf("%s", s);

        for (i = 0; i < n; i++){
            next[0] = '\0';
            len = strlen(s);
            for (j = 0; j < len; j = k){
                for (k = j + 1; k < len; k++){
                    if (s[j] != s[k]){
                        break;
                    }
                }
                sprintf(tmp, "%d%c", k - j, s[j]);
                strcat(next, tmp);
            }
            strcpy(s, next);
        }
        printf("%s\n", s);
    }

    return (0);
}

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

int main(){
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  vector <int> a(n);
  int x;
  for (int i = 2; i <= n; ++i){
	cin >> x;
	++a[--x];
  }
  for (int i = 0; i < n; ++i){
	cout << a[i] << "\n";
 }
return 0;
}


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

using namespace std;

typedef long long ll;
const ll INF = 1LL<<60;

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

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

ll modpow(ll a, ll n, ll mod) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

vector<ll> G[100100];
ll MOD = 1e9+7;
ll ans = 1;
ll N, K;

void dfs(ll v, ll p, ll num){

    ans = ans * num % MOD;

    num = K - 1;

    if(p != -1) num--;

    for(auto g : G[v]){
        if(g == p) continue;
        dfs(g, v, num);
        num--;
    }
}

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

    cin >> N >> K;

    ll a, b;
    for(int i = 0; i < (N-1); i++){
        cin >> a >> b;
        a--;
        b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }

    dfs(0, -1, K);

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



Measured memory_bytes: 9216
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <cmath>
#include <set>
#include <map>

#define N 0
#define INF 0x3f3f3f3f
#define LL long long
#define mz(x) ms(x,0)
#define ms(x,y) memset(x,y,sizeof(x))
#define mc(x,y) memcopy(x,y,sizeof(y))
#define MOD 1000000007

using namespace std ;

int main()
{
	int x ;
	scanf ("%d", &x) ;
	cout << (x ^ 1) << endl ;

	return 0 ;
}

Measured memory_bytes: 3292
n,k = map(int,input().split())
h = list(map(int,input().split()))
dp = [100000000000 for _ in range(n)]
dp[0] = 0
for i in range(n):
    for j in range(min(i,k)+1):
        dp[i] = min(dp[i-j]+abs(h[i]-h[i-j]),dp[i])
print(dp[-1])

Measured memory_bytes: 56544
#include <iostream>
#include <bits/stdc++.h>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <cstdio>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <cstdlib>
#include <stack>
#include <vector>
#define INF 0x3f3f3f3f
typedef long long ll;

using namespace std;
char a[105][105];
int main()
{
    int h, w;
    cin >> h >> w;
    for(int i = 1; i <= h; i++)
    scanf("%s", a[i]+1);
    for(int i = 1; i <= h; i++)
    {
        for(int j = 1; j <= w; j++)
        {
            int sum = 0;
            if(a[i][j] == '#')cout << '#';
            else
            {
                for(int o = -1; o <= 1; o++)
                for(int p = -1; p <= 1; p++)
                {
                    if(a[i+o][j+p]  == '#')sum++;
                }
                cout << sum;
            }
        }
        cout << endl;
    }
    return 0;
}


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

int main() {
    int n;
    cin >> n;
    std::map<std::string, int> mp;
    rep(i, n) {
        string s;
        cin >> s;
        sort(s.begin(), s.end());
        mp[s]++;
    }
    ll ans = 0;
    for ( auto& p : mp ) {
        int s = p.second;
        ans += (ll)s*(s-1)/2;
    }
    cout << ans << endl;

    return 0;
}

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


int main(){
  int N, M, X;
  cin >> N >> M >> X;
  vector<int> C(N);
  vector<vector<int>> A(N, vector<int>(M, 0));
  for(int row=0; row<N; row++){
    cin >> C[row];
    for(int col=0; col<M; col++){
      cin >> A[row][col];
    }
  }
  int ans = INT_MAX;
  int total = pow(2, N);
  for(int ii=0; ii<total; ii++){
    vector<int> score(M, 0);
    int cost=0;
    for(int jj=0; jj<N; jj++){
      if((ii>>jj)%2){
        cost += C[jj];
        for(int kk=0; kk<M; kk++){
          score[kk] += A[jj][kk];
        }
      }
    }
    bool flg=true;
    for(int kk=0; kk<M; kk++){
      if(score[kk]<X){
        flg = false;
        break;
      }
    }
    if(flg){
      ans = min(ans, cost);
    }
  }
  if(ans==INT_MAX){
    cout << -1 << endl;
  }else{
    cout << ans << endl;
  }
  return 0;
}


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

int main() {
	ll a, b, c, d;
	cin >> a >> b >> c >> d;
	ll mx = -1LL << 60;
	mx = max(mx, a * c);
	mx = max(mx, a * d);
	mx = max(mx, b * c);
	mx = max(mx, b * d);
	cout << mx << endl;
	return 0;
}

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

#define long long long

struct _ { _() { ios_base::sync_with_stdio(0); cin.tie(0); } } _;
// template<class... T> inline void read(T&... x) { ((cin >> x), ...); }

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

const int N = 30000;

/*int count_multiples(vector<int> primes = { 2, 3 }) {
	int amt = 0;
	for (int i = 1; i <= N; i++) {
		amt += any_of(primes.begin(), primes.end(), [i](int p) { return i % p == 0; } );
	}
	return amt;
}*/

vector<int> solve(int n) {
	if (n == 3) return { 2, 5, 63 };
	vector<int> ans; int cur_sum = 0;
	for (int i = 1; i <= N; i++) {
		if (i % 2 == 0 or i % 3 == 0) {
			if (n - (int)ans.size() > 2) ans.push_back(i), cur_sum += i;
			else {
				for (int j = i; j <= N; j++) {
					if ((cur_sum + j) % 3 == 0) {
						ans.push_back(j), cur_sum += j;
						break;
					}
				}
				for (int j = i; j <= N; j++) {
					if (j != ans.back() and (cur_sum + j) % 6 == 0) {
						ans.push_back(j), cur_sum += j;
						break;
					}
				}
				// assert(cur_sum % 6 == 0);
				// assert((int)(ans.size()) == n);
				return ans;
			}
		}
	}
	// exit(!printf("didn't finish? n = %d\n", n));
	return ans;
}

int main() {

	// printf("%d\n", count_multiples());
	// for (n = 3; n <= 20000; n++) solve(n);

	int n; cin >> n;

	auto x = solve(n);
	for (int y : x) printf("%d ", y);

}

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

#define LL long long
#define fi first
#define se second
#define mp make_pair
#define pb push_back

using namespace std;

LL gcd(LL a,LL b){return b?gcd(b,a%b):a;}
LL lcm(LL a,LL b){return a/gcd(a,b)*b;}
LL powmod(LL a,LL b,LL MOD){LL ans=1;while(b){if(b%2)ans=ans*a%MOD;a=a*a%MOD;b/=2;}return ans;}
const int N = 2e5 +11;
int main(){
	ios::sync_with_stdio(false);
	int n,d;
	cin>>n>>d;
	int cnt=0,pre=0;
	if(n<=d)return cout<<1<<endl,0;
	for(int i=d+1;i<=n;i+=2*d+1){
		cnt++;
		pre=i;
	}
	cout<<cnt+(pre+d<n)<<endl;
	return 0;
}
// 4 10 
// 3 

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

int main(){
    int n,x;
    cin>>n>>x;
    vector<int> m(n);
    int sum=0;
    rep(i,n){
        cin>>m[i];
        sum+=m[i];
    }
    sort(m.begin(),m.end());
    x-=sum;
    cout<<n+x/m[0]<<"\n";
    return 0;
}

Measured memory_bytes: 3616
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;

int main()
{
	ll n; cin>>n;
	cout<<n*(n-1)/2<<endl;
	return 0;
}

Measured memory_bytes: 256
N,M =map(int,input().split())
A = [0] * M
B = [0] * M
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

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

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

        if x == y:
            return

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

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

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

    def same(self, x, y):
        return self.find(x) == self.find(y)

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

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

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

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

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())
uf = UnionFind(N)
for i in range(M):
    a, b = map(int, input().split())
    uf.union(a-1,b-1)
print(len(uf.roots())-1)

Measured memory_bytes: 12948
s = input()
for i in range(int(input())):
    op, a, b, *p = input().split()
    a, b = int(a), int(b)
    
    if op == 'print':
        print(s[a:b + 1])
        
    elif op == 'reverse':
        s = s[:a] + s[a:b + 1][::-1] + s[b + 1:]

    elif op == 'replace':
        s = s[:a] + p[0] + s[b + 1:]
        
    else:
        print('op error')



Measured memory_bytes: 5620
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
const int N = 1e6;
LL n,m;
LL res[10052];
LL fast_mul(LL a,LL b,LL Mod)
{
    LL c = a*b -  (LL)((long double)a*b/Mod + 0.5)*Mod;
    return c<0? c+Mod : c;
}
LL M = (LL)1e9 + 7;
int main()
{
    #ifndef ONLINE_JUDGE
   // freopen("input.txt","r",stdin);
   // freopen("output.out","w",stdout);
    #endif // ONLINE_JUDGE
    cin>>n>>m;
    for(int i = 1;i<=n;++i)
    {
        cin>>res[i];
    }
    LL num1= 0 ,num2 =0;
    for(int i = 1;i<n;++i)
    {
        for(int j = i+1;j<=n;++j)
        {
            if(res[i]>res[j]) num1 ++;
        }
    }
    sort(res+1,res+n+1,greater<LL>());
    for(int i = 1;i<n;++i)
    {
        for(int j = i+1;j<=n;++j)
        {
            if(res[i]>res[j]) num2++;
        }
    }
    LL K = m,P = m;
    if(K%2==0) K = m/2,P = m-1;
    else K = m,P = (m-1)/2;
    cout<<(fast_mul(num1,m,M)%M + fast_mul(K,P,M)*num2%M )%M<<endl;

}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <tuple>
#include <cmath>
#include <iomanip>
#include <map>
#include <cstring> //memset(dp,0,sizeof(dp))
#include <functional>
#include <cctype>
#include <locale>
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define fi first
#define se second
#define pb push_back
#define ALL(a) (a).begin(),(a).end()
using namespace std;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
typedef pair<int,int> P;
typedef pair<long long,long long> Pll;
#define fout(num) cout << fixed << setprecision(20) << (num) << endl
//s[i]=tolower(s[i]); islower(s[i]); cout << tolower(s[i])はバグ
//vector<vector<ll>> dp(n,vector<ll>(n))
//exist x map o setconst ll MOD = 1e9+7;return fac[n]*(finv[k]*finv[n-k] % MOD) % MOD;

const ll MOD = 1e9+7;
const int MAX = 1001001;
signed main(){
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    int n; cin >> n;
    vector<int> G[n];
    vector<int> deg(n,0);
    rep(i,n-1){
        int a,b; cin >> a >> b;
        a--; b--;
        deg[a]++; deg[b]++;
        G[a].pb(b); G[b].pb(a);
    }
    priority_queue<int,vector<int>,greater<int>> pq;
    rep(i,n){
        int c; cin >> c;
        pq.push(c);
    }
    int cnt=n-1;
    ll sum=0;
    vector<int> ans(n,0);
    while(cnt){
        P p={100100,0};
        rep(i,n){
            if(p.fi>deg[i]&&ans[i]==0){
                p={deg[i],i};
            }
        }
        ans[p.se]=pq.top();
        pq.pop();
        sum+=ans[p.se]*deg[p.se];
        cnt-=deg[p.se];
        for(auto u:G[p.se]){
            deg[u]--;
        }
    }
    int id=0;
    while(!pq.empty()){
        if(ans[id]==0){
            ans[id]=pq.top(); pq.pop();
        }
        else id++;
    }
    cout << sum << endl;
    rep(i,n) cout << ans[i] << " ";
    return 0;
}


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

int main()
{
    long long x;
    cin >> x;
    int year = 0;
    long long monney = 100;

    while (monney < x)
    {
        monney *= 1.01;
        year++;
    }

    cout << year << endl;

    return 0;
}

Measured memory_bytes: 3644
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main(){

  


  string s;
  int a=0,b=0,c=0;
  bool ans;

  cin >> s;

  for(char h : s) {
      if(h=='a')
        a+=1;
      if(h=='b')
        b+=1;
      if(h=='c')
        c+=1;
    };

  if((a==b) and (b==c))
    ans=true;
  else
    ans=false;
  if(ans==1){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
}


Measured memory_bytes: 256
n,k = map(int,input().split())

buf = [0 for i in range(n)]
for i in range(k):
    d=int(input())
    arr = list(map(int,input().split()))

    for a in arr:
        buf[a-1] += 1

ans = 0
for b in buf:
    if b==0:
        ans += 1
print(ans)



Measured memory_bytes: 9184
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define ld long double
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; }
using P=pair<long long,long long>;
#define rep(i,n) for(long long i=0; i<(long long)n; i++)
#define req(i,n) for(long long i=n-1; i>=0; i--)
#define range(i,a,b) for(long long i=a; i<b; i++)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((long long)(x).size())
#define COUT(x) cout << x << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define onBoard(y,x) (y>=0 && y<h && x>=0 && x<w)
#define pri_que priority_queue
#define vint vector<int>
#define vvint vector<vector<int>>
#define vi vector<int>
#define vvi vector<vector<int>>
#define vs vector<string>
#define vvc vector<vector<char>>
#define vc vector<char>
#define vp vector<pair<int,int>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define show(x) cout<<#x<<"="<<x<<endl;
#define SUM(x) accumulate(x.begin(),x.end(),0)
#define MAX(x) *max_element(x.begin(),x.end())
#define MIN(x) *min_element(x.begin(),x.end())
#define couty cout<<"Yes"<<endl
#define coutn cout<<"No"<<endl
#define coutY cout<<"YES"<<endl
#define coutN cout<<"NO"<<endl
#define yn(x) cout<<(x?"Yes":"No")<<endl
#define YN(x) cout<<(x?"YES":"NO")<<endl
long long gcd(long long a,long long b){return b?gcd(b,a%b):a;}
long long lcm(long long a, long long b){return a/gcd(a,b)*b;}
const long long dx[8]={1,0,-1,0,1,-1,-1,1};
const long long dy[8]={0,1,0,-1,1,1,-1,-1};
const long long INF = 1e15;
const long long MOD = 1e9+7;

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

    int n; cin >> n;
    int res=0;
    for(int a=1; a<=n; a++){
        for(int b=1; a*b<=n; b++){
            if(n-a*b>0) res++;
        }
    }
    cout<<res<<endl;
}

Measured memory_bytes: 3648
import java.util.*; 

class Main{
public static void main(String[] args){
	Scanner sc=new Scanner(System.in);
       	int ans1=0;
  		int ans2=0;
  		int ans3=0;
  		int s1=0;
  		int s2=0;
  		int s3=0;
  		int count=0;
        int n=sc.nextInt();
		int m=sc.nextInt();
  		
		for(int d=0;d<m;d++){
    		int s=sc.nextInt();
          	int c=sc.nextInt();
          
           		if(s==1){
                  if(n==3&&c==0){
                  	count++;
                  }else if(n==2&&c==0){
                  	count++;
                  }else if(s1==0||ans1==c){
                      ans1=c;
                    }else{
                    	count++;
                    }
                  s1++;
                }else if(s==2){
                   if(s2==0||ans2==c){
                      ans2=c;
                    }else{
                    	count++;
                    }
                  s2++;
                }else{
                	if(s3==0||ans3==c){
                      ans3=c;
                    }else{
                    	count++;
                    }
                  s3++;
                }
           
        }
  		
  
  if(n==3&&ans1==0){
    		ans1=1;
    	}else if(n==2&&ans1==0){
  		ans1=1;
  }
  
   if(count>0){
    		System.out.println(-1);
    	}else if(n==3){
   	 System.out.println(Integer.parseInt(String.valueOf(ans1)+String.valueOf(ans2)+String.valueOf(ans3)));
   }else if(n==2){
    System.out.println(Integer.parseInt(String.valueOf(ans1)+String.valueOf(ans2)));
   }else{
   System.out.println(Integer.parseInt(String.valueOf(ans1)));
   }
	
   
    
    }
}



Measured memory_bytes: 21972
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**8)
INF = float('inf')
MOD = 10**9+7


def main():
  A = [[int(x) for x in readline().split()] for _ in range(3)]
  N = int(readline())
  bingo = [[False]*3 for _ in range(3)]
  for _ in range(N):
    b = int(input())
    for i in range(3):
      for j in range(3):
        if A[i][j] == b:
          bingo[i][j] = True
  ans = 'No'
  for i in range(3):
    if bingo[i][0] == bingo[i][1] == bingo[i][2] == True:
      ans = 'Yes'
    if bingo[0][i] == bingo[1][i] == bingo[2][i] == True:
      ans = 'Yes'
  if bingo[0][0] == bingo[1][1] == bingo[2][2] == True:
    ans = 'Yes'
  if bingo[0][2] == bingo[1][1] == bingo[2][0] == True:
    ans = 'Yes'
  print(ans)
  
  
if __name__ == '__main__':
  main()

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

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) (sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg)),arg)

template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}

using namespace std;
using R=long double;

int n,x[110],y[110];

using R=long double;
constexpr R PI = acos(R(-1));
constexpr R INF = 1e40;
using P=complex<R>;
using C=tuple<R,R,R>;
#define mod(x,y) fmod(fmod(x,y)+y,y)


inline C shadow(R theta){
	R a=0.0,b=0.0,c=0.0;
	R vx=sin(theta),vy=cos(theta);

	using state=tuple<R,int>;
	vector<state> ary;

	rep(i,n) ary.push_back(make_tuple(1.0*x[i]*vx+1.0*y[i]*vy,i));
	sort(_all(ary));
	
	c+=2.0*n;

	rep(i,n-1){
		R cur,nxt; int idx,idx2;
		tie(cur,idx)=ary[i],tie(nxt,idx2)=ary[i+1];
		if(nxt-cur<2.0){
			c-=2.0;
			a+=(x[idx2]-x[idx]),b+=(y[idx2]-y[idx]);
		}
	}
	return make_tuple(a,b,c);
}

int main(void){
	while(cin >> n,n){		
		vector<R> candiate={0.0,PI/2.0,PI};
		rep(i,n) cin >> x[i] >> y[i];
		cout.precision(20);


		rep(j,n)rep(i,j){
			P a=P(x[i],y[i]),b=P(x[j],y[j]);
			R c=arg(b-a),e=asin(2.0/abs(b-a));
			candiate.push_back(mod(PI-c,PI));
			candiate.push_back(mod(PI-c+e,PI));
			candiate.push_back(mod(PI-c-e,PI));
		}

		uniq(candiate);
		candiate.push_back(candiate[0]+PI);	
		int m=int(candiate.size());

		rep(i,m-1){
			R cur=candiate[i],nxt=candiate[i+1],a,b,c;
			tie(a,b,c)=shadow((cur+nxt)/2.0);
			R theta=mod(atan(a/b),PI);
			if(cur < mod(theta,PI) && mod(theta,PI) < nxt) candiate.push_back(mod(theta,PI));
		}	

		R cmin=INF,theta1=-1.0;
		for(auto &theta:candiate){
			R a,b,c;
			tie(a,b,c)=shadow(theta);
			if(chmin(cmin,a*sin(theta)+b*cos(theta)+c)) theta1=theta;
		}
		cout << fixed << theta1 << endl;
		
		R cmax=0.0,theta2=-1.0;
		for(auto &theta:candiate){
			R a,b,c;
			tie(a,b,c)=shadow(theta);
			if(chmax(cmax,a*sin(theta)+b*cos(theta)+c)) theta2=theta;
		}
		cout << fixed << theta2 << endl;

	}
	return 0;
}

Measured memory_bytes: 3908
#include<cstdio>

int main(){
    int m,n,i,j,k,s;
    scanf("%d%d",&n,&m);
    int a[n][m],b[m][1];
    for(i=0;i<n;i++){
        for(j=0;j<m;j++){
            scanf("%d",&a[i][j]);/*Aの入力*/
        }}
            for(i=0;i<m;i++){
                for(j=0;j<1;j++){
                    scanf("%d",&b[i][j]);/*Bの入力*/
                }}
                    for(i=0;i<n;i++){

                        for(j=0;j<1;j++){
                            s = 0;
                            for(k=0;k<m;k++){
                                s = s + a[i][k] * b[k][j];
                        }
                        printf("%d",s);
                        }
                        printf("\n");
                        }
               
return 0;    
}


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

using namespace std;

int main()
{
  int n;
  cin >> n;
  string s;
  cin >> s;
  if (n&1) cout << "No"; else
  {
    n>>=1;
    bool flag = true;
    for(int i=0; i<n; ++i)
      if (s[i]!=s[i+n]) flag=false;
    if (flag) cout << "Yes"; else cout << "No";
  }
  return 0;
}

Measured memory_bytes: 256
H, W = map(int, input().split())
S = [input() for _ in range(H)]

res = [[float('inf')]*(W) for _ in range(H)]

if S[0][0] == '#':
    res[0][0] = 1
else:
    res[0][0] = 0

for h in range(H):
    for w in range(W):
        if h == 0:
            if w == 0:
                continue
            else:
                res[h][w] = res[h][w-1] + (1 if S[h][w] == '#' and S[h][w-1] == '.' else 0)
        else:
            if w == 0:
                res[h][w] = res[h-1][w] + (1 if S[h][w] == '#' and S[h-1][w] == '.' else 0)
            else:
                f_t = res[h-1][w] + (1 if S[h][w] == '#' and S[h-1][w] == '.' else 0)
                f_l = res[h][w-1] + (1if S[h][w] == '#' and S[h][w-1] == '.' else 0)
                res[h][w] = min(f_t, f_l)

print(res[H-1][W-1])


Measured memory_bytes: 42096
S = input()
T = input()
s = []
t = []
for alp in "abcdefghijklmnopqrstuvwxyz":
  s.append(S.count(alp))
  t.append(T.count(alp))
if(sorted(s) == sorted(t)):
  print("Yes")
else:
  print("No")


Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	ll n;
	cin >> n;
	string s;
	cin >> s;
	ll i = 0, j = n - 1;
	ll count = 0;
	while (i <= j) {
		if (s[i] == 'W' && s[j] == 'R') {
			swap(s[i], s[j]);
			count++;
			i++;
			j--;
		}
		else if (s[i] == 'W' && s[j] == 'W') {
			j--;
		}
		else if (s[i] == 'R' && s[i] == 'R') {
			i++;
		}
		else {
			i++;
			j--;
		}
	}
	cout << count << endl;
}

Measured memory_bytes: 3756
import java.util.ArrayList;
import java.util.Scanner;

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

		// 処理対象個数の入力
		int input_1 = sc.nextInt();
		// 処理対象の入力
		ArrayList<Integer> target_list = new ArrayList<>();
		for(int i=0;i<input_1;i++) {
			target_list.add(sc.nextInt());
		}

		int result = countExponent2(target_list.get(0));
		int tmp;
		for (int i = 1; i < target_list.size(); i++) {
			tmp = countExponent2(target_list.get(i));
			if(result > tmp) {
				result = tmp;
			}
		}

		// 出力
		System.out.println(result);
		sc.close();

	}

	private static int countExponent2(int x) {
		int exponent2 = 0;
		// 引数に対して何回、２で割る処理が実行できるかを調べる
		while(x%2 == 0) {
			x = x/2;
			exponent2++;
		}

		return exponent2;
	}

}


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

int main(){
 int w,h,x,y,r;
 cin>>w>>h>>x>>y>>r;
 if(x-r<0||x+r>w||y-r<0||y+r>h){
  cout<<"No"<<'\n';
 }else{
  cout<<"Yes"<<'\n';
 }
 return 0;
}

Measured memory_bytes: 1124
#include <bits/stdc++.h>
#define X first
#define Y second
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define ini(x, y) memset(x, y, sizeof(x))
#define endl '\n'
#define fastio cin.sync_with_stdio(false); cin.tie(nullptr)
using namespace std;

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const int MOD = 1e9 + 7;
const int dx[] = { -1, 0, 1, 0, -1, 1, 1, -1 };
const int dy[] = { 0, 1, 0, -1, 1, 1, -1, -1 };

int main() {
	fastio;
	int K, N;
	cin >> K >> N;

	int arr[200000], mx = 0;
	for (int i = 0; i < N; ++i) {
		cin >> arr[i];
		if (i) mx = max(mx, arr[i] - arr[i - 1]);
	}
	mx = max(mx, K - arr[N - 1] + arr[0]);

	cout << K - mx;

	return 0;
}

Measured memory_bytes: 1152
n, m = map(int, input().split())
adj_matrix = [[False]*n for _ in range(n)]
a, b = [False]*m, [False]*m

for i in range(m):
  a[i], b[i] = map(int, input().split())
  adj_matrix[a[i]-1][b[i]-1] = True
  adj_matrix[b[i]-1][a[i]-1] = True

def dfs(v, used):
  used[v] = True
  
  if not False in used:
    return 1

  for i in range(n):
    if adj_matrix[v][i] is False:
      continue
    if used[i] is False:
      dfs(i, used)
  return 1
  
ans = 0

for i in range(m):
  adj_matrix[a[i]-1][b[i]-1] = False
  adj_matrix[b[i]-1][a[i]-1] = False
  used = [False]*n
  dfs(0, used)
  if False in used:
    ans += 1
  adj_matrix[a[i]-1][b[i]-1] = True
  adj_matrix[b[i]-1][a[i]-1] = True

print(ans)

Measured memory_bytes: 3064
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
  int frower[7][2] = {{0,0},{2,380},{3,550},{5,850},{10,1520},{12,1870},{15,2244}};
  int dp[51][7] = {0};
  for(int i=0; i<51; i++){
    for(int j=0; j<7; j++){
      dp[i][j] = 100000;
    }
  }
  for(int i=0; i<51; i++){
    for(int j=1; j<7; j++){
      if(!i){
	for(int k=1;k*frower[j][0]<51;k++){
	  dp[k*frower[j][0]][j] = min(dp[k*frower[j][0]][j],frower[j][1]*k);
	}
      }
      else{
	if(dp[i][j-1]){
	  for(int k=0;i+k*frower[j][0]<51;k++){
	    dp[i+k*frower[j][0]][j] = min(dp[i+k*frower[j][0]][j],dp[i][j-1]+frower[j][1]*k);
	  }
	}
      }
    }
  }
  int n;
  while(cin>>n,n){
    for(int i=n/100; i<51; i++){
      if(dp[i][6]){cout <<dp[i][6]<<endl;break;}
    }
  }
  return 0;
}

Measured memory_bytes: 1160
#include <iostream>
#include<ctype.h>
using namespace std;
string a,b,c;
char p,q,r;
int main() {
    cin>>a>>b>>c;
	p=*a.begin();
    q=*b.begin();
    r=*c.begin();
    p=toupper(p);
    q=toupper(q);
    r=toupper(r);
cout<<p<<q<<r<<endl;
	return 0;
}

Measured memory_bytes: 256
require 'benchmark'

loop do
  e = gets.to_i
  break if e == 0
  x_max = e
  y_max = (e**(1.0 / 2.0)).round
  z_max = (e**(1.0 / 3.0)).round
  min = e
  z_max.downto(0) do |z|
    0.upto(y_max) do |y|
      x = e - y**2 - z**3
      break if x < 0
      sum = x + y + z
      min = sum if sum < min
    end
  end
  puts min
end

Measured memory_bytes: 9072
s = raw_input()
ans = 0
for i in range(len(s)):
  if s[i] == "0" and i != len(s) - 1:
    continue

  left  = int(s[:i]) if i else 0
  right = int(s[i:])

  if left <= right and left % 2 == right % 2:
    ans += 1
print ans

Measured memory_bytes: 4224
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleTest
{
    class Program
    {
        
        static void Main(string[] args)
        {
            var str = Console.ReadLine();
            bool cof = str[2] == str[3] && str[4] == str[5];
            Console.WriteLine(cof ? "Yes" : "No");
           
        }

    }
    static class MyIo
    {
        public static int Int()
        {
            return int.Parse(Console.ReadLine());
        }
        public static int[] Ints()
        {
            return Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
        }
        public static int[][] MultiInts(int num)
        {
            var result = new int[num][];
            for(int i = 0; i < num; ++i)
            {
                result[i] = Ints();
            }
            return result;
        }
        public static T[] MultiItems<T>(int num, Func<string,T> parser)
        {
            var result = new T[num];
            for(int i =0; i < num; ++i)
            {
                result[i] = parser(Console.ReadLine());
            }
            return result;
        }
    }
}


Measured memory_bytes: 11092
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <sstream>
#include <unordered_map>
#include <vector>


#define INF 4000000000000000000LL
#define MOD 1000000007
#define ALL(x) std::begin(x), std::end(x)


template<typename S, typename T>
class accumulate_table_fn_t {
public:
  accumulate_table_fn_t(const std::vector<std::vector<S>>& a) :
    N_(a.size()), M_(a[0].size())
  {
    acc_.assign(N_ + 1, std::vector<T>(M_ + 1));

    for (int i = 0; i < N_; i ++)
      for (int j = 0; j < M_; j ++)
        acc_[i + 1][j + 1] = acc_[i + 1][j] + a[i][j];

    for (int j = 0; j <= M_; j ++)
      for (int i = 1; i < N_; i ++)
        acc_[i + 1][j] += acc_[i][j];
  };

public:
  T sum(int x0, int y0, int x1, int y1) const {	// [x0, x1), [y0, y1)
    assert(0 <= x0 && x0 <  M_);
    assert(0 <= y0 && y0 <  N_);
    assert(0 <= x1 && x1 <= M_);
    assert(0 <= y1 && y1 <= N_);
    assert(x0 <= x1);
    assert(y0 <= y1);

    return
        acc_[y1][x1]
      - acc_[y1][x0]
      - acc_[y0][x1]
      + acc_[y0][x0];
  };

private:
  int N_;
  int M_;

  std::vector<std::vector<T>> acc_;
};


int main(int argc, char** argv)
{
  std::cin.tie(0);
  std::ios_base::sync_with_stdio(0);

  std::cout << std::fixed << std::setprecision(6);
  std::cerr << std::fixed << std::setprecision(6);

  int N, M, Q, L, R, p, q;

  std::cin >> N >> M >> Q;

  std::vector<std::vector<int>> imos(N + 1, std::vector<int>(N + 1));

  for (int i = 0; i < M; i ++) {
    std::cin >> L >> R;

    L --;
    R --;

    imos[R    ][L    ] ++;
    imos[R + 1][L    ] --;
    imos[R    ][L + 1] --;
    imos[R + 1][L + 1] ++;
  }

  for (int i = 0; i <= N; i ++)
    for (int j = 1; j <= N; j ++)
      imos[i][j] += imos[i][j - 1];

  for (int j = 0; j <= N; j ++)
    for (int i = 1; i <= N; i ++)
      imos[i][j] += imos[i - 1][j];

  accumulate_table_fn_t<int, int> fn(imos);

  for (int i = 0; i < Q; i ++) {
    std::cin >> p >> q;

    p --;
    q --;

    std::cout << fn.sum(p, p, q + 1, q + 1) << std::endl;
  }
  
  return 0;
}


Measured memory_bytes: 2944
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Aeroui
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, Scanner in, PrintWriter out) {

            boolean[] b = new boolean[256];
            char[] arr = in.nextLine().toCharArray();


            for (char c : arr) {
                if (b[c]) {
                    out.println("no");
                    return;
                }

                b[c] = true;
            }

            out.println("yes");
        }

    }
}



Measured memory_bytes: 23764
using System;
using System.Collections.Generic;

class Program
{
    static void Main(string[] args)
    {
        string[] str = Console.ReadLine().Split(' ');
        int a = int.Parse(str[0]);
        int b = int.Parse(str[1]);
        Console.WriteLine("{0} {1}",a * b, 2 * a + 2 * b);
    }
}

Measured memory_bytes: 9204
module ABC137

  ! <module>s to import
  use, intrinsic :: iso_fortran_env

  ! require all variables to be explicitly declared
  implicit none

  ! accessibility of <subroutine>s and <function>s in this <module>
  public :: task_A

  ! contained <subroutine>s and <function>s are below
  contains

  subroutine task_A (A, B)

    ! arguments for this <subroutine>
    integer(INT16), intent(in) :: A, B

    ! variables for this <subroutine>
    integer(INT16) :: val_max

    ! STEP.01
    ! calculate the answer of this task
    val_max = A + B
    val_max = max(val_max, A - B)
    val_max = max(val_max, A * B)

    ! STEP.02
    ! output the answer of this task
    write(unit=OUTPUT_UNIT, fmt='(I0)', advance='yes') val_max

    ! STEP.END
    return

  end subroutine task_A

end module ABC137


program main

  ! <module>s to import
  use, non_intrinsic :: ABC137

  ! require all variables to be explicitly declared
  implicit none

  ! variables for this <program>
  integer(INT16) :: A, B

  ! STEP.01
  ! read out the given data
  read(unit=INPUT_UNIT, fmt=*) A, B

  ! STEP.02
  ! calculate & output the answer of this task
  call task_A (A, B)

end program main

Measured memory_bytes: 640
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <queue>

using namespace std;

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

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

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD = 1000000007;

LL dp[210][10010];
LL sum[210];

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

  int N, W; cin >> N >> W;
  vector<LL> ws(N);
  REP(i,N) cin >> ws[i];
  SORT(ws);

  dp[N+1][0] = dp[N][0] = 1;
  for(int i=N-1;i>=0;--i){
	for(int w=0;w<=W;++w){
	  dp[i][w] = dp[i+1][w];
	  if(w - ws[i] >= 0)
		dp[i][w] = (dp[i][w] + dp[i+1][w-ws[i]]) % MOD;
	}
  }
  sum[0] = 0;
  REP(i,N) sum[i+1] = sum[i] + ws[i];
  //REP(i,N+1) cout << sum[i] << " ";cout << endl;

  LL ans = 0;
  if(W < ws[0]) ans = 1;
  else{
	for(int i=0;i<N;++i){
	  if(sum[i] > W) break;
	  for(int w=0;w<=W-sum[i];++w){
		if(!(W - ws[i] < w + sum[i])) continue;
		ans = (ans + dp[i+1][w]) % MOD;
		//		cout << i << ", " << w << endl;
	  }
	}
	if(sum[N] <= W) ans = (ans+1)%MOD;
  }
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 17576
#include<bits/stdc++.h>
using namespace std;
#define N 25
#define M 1000000007
#define ll long long
#define inf 1000000000000000000
ll n, arr[N][N], dp[3000000];


int main()
{
    cin >> n;
    for(int i = 1; i <= n; i++) for(int j = 1;j <= n; j++) cin >>arr[i][j];
    dp[0] = 1;
    for(int i = 0; i < (1 << n); i++)
    {
        int cn = __builtin_popcount(i);
        for(int j = 0; j < n; j++)
        {
            if(arr[cn + 1][j + 1] && !((i >> j) & 1))
            {
                dp[i | (1 << j)] = (dp[i | (1 << j)] + dp[i]) % M;
            }
        }
    }
    cout << dp[(1 << n) - 1] << endl;
}





Measured memory_bytes: 18688
#include <iostream>
#include <string>
#include <vector>
#include <climits>
#include <set>
#include <algorithm>
#include <unordered_map>
#include <queue>
#include <iomanip>
#include <map>
#include <utility>
#include <numeric>

#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define P pair<int, int>
#define debug(x) cout << #x << ": " << x << ", "
#define debugln(x) cout << #x << ": " << x << '\n'

using namespace std;
using ll = long long;
const int mod = 1e9+7;

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

  int n; cin >> n;
  int ans = n/111;
  if (n%111 != 0) {
    ans++;
  }
  cout << ans*111 << endl;
}

Measured memory_bytes: 256
// AtCoder Beginner Contest 152 C.cpp

#include <iostream>
#include <vector>

using namespace std;

int main()
{
	int n, flag = 0, p1, answer = 1;
	cin >> n >> p1;
	flag = p1;
	for (int i = 0; i < n - 1; i++) {
		cin >> p1;
		if (flag >= p1) {
			answer++;
			flag = p1;
		}
	}

	cout << answer << endl;

}

Measured memory_bytes: 256
/*
    ->->->->-> Vora Mahammasasim <-<-<-<-<-
*/
#include<bits/stdc++.h>
#define Quick std :: ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long
#define pb emplace_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define MOD 1e7+7;
using namespace std;





signed main(){

    Quick;
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    cout<<max({a*c,b*d,a*d,b*c});
    return 0;
}


Measured memory_bytes: 3692
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)   // 0-indexed昇順

int main() {
    int N; cin >> N;
    vector<int> S(N);
    int sum = 0;
    rep(i,N) {
        cin >> S.at(i);
        sum += S.at(i);
    }
    if (sum % 10 == 0) {
        sort(begin(S), end(S));
        for (int i = 0; i < N; i++) {
            if (S[i] % 10 != 0) {
                sum -= S[i];
                break;
            }
        }
        if (sum % 10 == 0) sum = 0;
    }
    cout << sum << endl;
}


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

using namespace std;
int n , m;
int a, b,result;
int dp[100003] = {0};
vector<int>neibors[100003];
int solve(int n)
{
    if (dp[n] != 0) return dp[n];
    if(neibors[n].empty()) { dp[n] = 0; return 0; }
    //cout << "not reach";
    int maxn = 0;
    for(vector<int>::iterator it = neibors[n].begin();  it!= neibors[n].end(); it++)
    {
        //cout << *it << " ";
        int temp = solve(*it);
        if (maxn < temp) maxn = temp;
    }
   // cout << endl;

    dp[n] = maxn + 1;
    return dp[n];
}


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

    cin>>n>>m;
    for(int i = 1 ; i<= m ;i++)
    {
        cin>>a>>b;
        neibors[a].push_back(b);
    }
    for(int i =1; i<= n ;i++)
    {
        if(result < solve(i)) result = solve(i);
    }
    cout<<result;
    return 0;
}


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

int n, f[105];

int main() {
	scanf("%d", &n);

	int mn = 1e9;
	for(int i = 1; i <= n; i++) {
		int x; scanf("%d", &x);
		f[x]++;
		mn = min(mn, x);
	}

	if(f[mn] > 2) {
		printf("Impossible\n");
		return 0;
	}

	int up = 2 * mn - (f[mn] == 2);

	for(int i = mn + 1; i <= up; i++) {
		if(f[i] < 2) {
			printf("Impossible\n");
			return 0;
		}
	}

	for(int i = up + 1; i <= 100; i++) {
		if(f[i] > 0) {
			printf("Impossible\n");
			return 0;
		}
	}

	/*for(int i = mn + 2; i <= up; i++) {
		if(f[i] > f[i - 1]) {
			printf("Impossible\n");
			return 0;
		}
	}*/

	printf("Possible\n");
	return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<vector>
#include<functional>
#include<algorithm>
#include<stdlib.h>
#include<string>
#include<string.h>
#define _USE_MATH_DEFINES
#include<math.h>
#include<deque>
#include<set>
#include<map>
#include<queue>
#include<iostream>
using namespace std;
typedef long long ll;
#define rep(i,a,b) for(auto i=a;i<b;i++)
#define all(_x) _x.begin(), _x.end()
#define r_sort(_x) sort(_x.begin(), _x.end(), std::greater<int>())
#define vec_cnt(_a, _n) (upper_bound(all(_a), _n) - lower_bound(all(_a), _n))
ll gcd(ll a, ll b) { return a % b == 0 ? b : gcd(b, a % b); }
ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; }
#define INF 1 << 30
int main() {
	int K, T;
	cin >> K >> T;
	vector<int> a(T);
	rep(i, 0, T)cin >> a[i];
	sort(all(a));
	printf("%d\n", max(2 * a[T - 1] - 1 - K, 0));
	return 0;
}


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

#define INPUT_ARRAY(N, A) \
    int N; \
    std::cin >> N; \
    std::vector<int> A(N); \
    for(int i = 0; i < N; ++i) std::cin >> A[i];

template<class T>
void print(const T &C)
{
    for(auto i : C)
    {
        std::cout << i << " ";
    }
    std::cout << std::endl;
}

template<class T>
T abs(T t)
{
    if(t < 0)
        return -t;
    else
        return t;
}

bool valid(const std::vector<int> &t,
           const std::vector<int> &x,
           const std::vector<int> &y)
{
    int prev_t = 0, prev_x = 0, prev_y = 0;
    int N = (int)t.size();
    for(int i = 0; i < N; ++i)
    {
        int diff_t = t[i] - prev_t;
            int l = abs(x[i] - prev_x) + abs(y[i] - prev_y);
        int amari = diff_t - l;
        if(amari < 0 || amari % 2 != 0)
        {
            return false;
        }
        
        prev_t = t[i];
        prev_x = x[i];
        prev_y = y[i];
    }
    return true;
}


int main()
{
    int N;
    std::cin >> N;
    
    std::vector<int> t(N), x(N), y(N);
    for(int i = 0; i < N; ++i)
    {
        std::cin >> t[i] >> x[i] >> y[i];
    }
    
    std::string ans_str = valid(t, x, y) ? "Yes" : "No";
    std::cout << ans_str << std::endl;
}


Measured memory_bytes: 1408
#include <iostream>
#include <algorithm>
#include <string> 
#include <vector>
#include <iomanip>
#include <math.h>
using namespace std;

int main()
{
	double N, T, A;
	cin >> N >> T >> A;
	vector<double> H(N);
	double ans = 1145141919.0;
	int ansH = 0;
	for (int i = 0; i < N; i++) {
		cin >> H[i];
	}
	for (int j = 0; j < N; j++) {
		if (fabs(T - H[j] * 0.006 - A) < ans) {
			ans = fabs(T - H[j] * 0.006 - A);
				ansH = j + 1;
		}
	}
	cout << ansH << endl;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
)

const (
	// 初期バッファサイズ
	initialBufSize = 20000
	// バッファサイズの最大値。Scannerは必要に応じこのサイズまでバッファを大きくして各行をスキャンする。
	// この値がinitialBufSize以下の場合、Scannerはバッファの拡張を一切行わず与えられた初期バッファのみを使う。
	maxBufSize = 2000000
)

var sc = bufio.NewScanner(os.Stdin)
var s string
var N int
var ds []int
var sums []int

func main() {
	var buf = make([]byte, initialBufSize)
	sc.Buffer(buf, maxBufSize)
	if sc.Scan() {
		s = sc.Text()
	}
	N = len(s)
	ds = make([]int, len(s))
	sums = make([]int, N)

	for i, c := range s {
		ds[i] = int(c - '0')
	}
	mods := make(map[int]int)
	accum()
	ans := 0
	for _, sum := range sums {
		mods[sum]++
	}
	for k, v := range mods {
		if k == 0 {
			ans += v
		}
		ans += ((v - 1) * v) / 2
	}
	fmt.Println(ans)
}

func accum() {
	for i, d := range ds {
		if i == 0 {
			sums[i] = d
		} else {
			sums[i] = madd(mmul(sums[i-1], 10, 2019), d, 2019)
		}
	}

	for i := range sums {
		sums[i] = mmul(sums[i], minv(mpow(10, i, 2019), 2019), 2019)
	}
}

const MOD = 1000000007

func Madd(a, b int) int { return madd(a, b, MOD) }
func madd(a, b, mod int) int {
	if a+b > mod {
		return a + b - mod
	}
	return a + b
}

func Msub(a, b int) int { return msub(a, b, MOD) }
func msub(a, b, mod int) int {
	if a-b < 0 {
		return a - b + mod
	}
	return a - b
}

func Mmul(a, b int) int { return mmul(a, b, MOD) }
func mmul(a, b, mod int) int {
	return ((a % mod) * (b % mod)) % mod
}

func Mpow(a, b int) int { return mpow(a, b, MOD) }
func mpow(k, p, mod int) int {
	r := 1
	for ; p > 0; p >>= 1 {
		if p&1 == 1 {
			r = mmul(r, k, mod)
		}
		k = mmul(k, k, mod)
	}
	return r
}

func Minv(a int) int { return minv(a, MOD) }
func minv(a, mod int) int {
	b := mod
	u, v := 1, 0
	for b > 0 {
		t := a / b
		a -= t * b
		a, b = b, a
		u -= t * v
		u, v = v, u
	}
	u %= mod
	if u < 0 {
		u += mod
	}
	return u
}

func Mdiv(a, b int) int { return mdiv(a, b, MOD) }
func mdiv(a, b, mod int) int {
	return mmul(a, minv(b, mod), mod)
}


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

int n, a1, b1, c1, a2, b2, c2;

int main() {
	cin >> n;
    cin >> a1 >> b1 >> c1;
    for (int i=2; i<=n; i++) {
      cin >> a2 >> b2 >> c2;
      a2 += max(b1, c1);
      b2 += max(a1, c1);
      c2 += max(a1, b1);
      a1 = a2;
      b1 = b2;
      c1 = c2;
    }
    cout << max(max(a1, b1), c1);
    return 0;
}

Measured memory_bytes: 256